({
take: [
{ key: "code", type: "code", label: "CoffeeScript" },
{
type: "toggle",
label: "Use CoffeeScript v2",
key: "useCS2",
detail:
"Treat the input as CoffeeScript 2 code. This version has some small breaking changes and differences in behavior to version 1.",
},
{
type: "toggle",
label: "Use JavaScript Modules",
key: "useJSModules",
detail:
"Convert `require` and `module.exports` to `import` and `export`. Note this may result in incorrect `import` statements",
},
{
type: "toggle",
label: "Modernize JavaScript",
key: "modernizeJS",
detail:
"Treat the input as JavaScript and only run the JavaScript-to-JavaScript transforms.",
},
{
type: "toggle",
label: "Literate",
key: "literate",
detail: "Treat the input as Literate CoffeeScript.",
},
{
type: "toggle",
label: "Disable suggestion comment",
key: "disableSuggestionComment",
detail:
"Do not include a comment with suggestions at the top of the output file.",
},
{
type: "toggle",
label: "No array includes",
key: "noArrayIncludes",
detail: "Do not use `Array.prototype.includes` in generated code.",
},
{
type: "toggle",
label: "Prefer let",
key: "preferLet",
detail: "Use `let` instead of `const` for most variables in output code.",
},
{
type: "toggle",
label: "Loose",
key: "loose",
detail: "Enable all `loose` options.",
},
{
type: "toggle",
label: "Loose default params",
key: "looseDefaultParams",
detail:
"Convert CoffeeScript default params to JavaScript default params.",
},
{
type: "toggle",
label: "Loose for expressions",
key: "looseForExpressions",
detail: "Do not wrap expression loop targets in `Array.from`.",
},
{
type: "toggle",
label: "Loose for of",
key: "looseForOf",
detail: "Do not wrap `for...of` loop targets in `Array.from`.",
},
{
type: "toggle",
label: "Loose includes",
key: "looseIncludes",
detail: "Do not wrap in `Array.from` when converting `in` to `includes`.",
},
{
type: "toggle",
label: "Loose comparison negation",
key: "looseComparisonNegation",
detail: "Allow unsafe simplifications like `!(a > b)` to `a <= b`.",
},
{
type: "toggle",
label: "Loose JavaScript Modules",
key: "looseJSModules",
detail: "Allow named exports when converting to JavaScript modules.",
},
{
type: "toggle",
label: "Disallow invalid constructors",
key: "disallowInvalidConstructors",
detail:
"Give an error when constructors use `this` before `super` or omit the `super` call in a subclass.",
},
{
type: "toggle",
label: "Optional chaining",
key: "optionalChaining",
detail:
"Target JavaScript optional chaining. Note the semantics may not match exactly.",
},
{
type: "toggle",
label: "Nullish coalescing",
key: "nullishCoalescing",
detail:
"Target JavaScript nullish coalescing. Note the semantics may not match exactly.",
},
{
type: "toggle",
label: "Logical assignment",
key: "logicalAssignment",
detail:
"Use the ES2021 logical assignment operators `&&=`, `||=`, and `??=`.",
},
{
type: "list",
label: "Safe import function identifiers",
key: "safeImportFunctionIdentifiers",
detail:
"Function names (one per line) that may safely be in the `import/require` section of the file. All other function calls will disqualify later requires from being converted to imports.",
},
{
type: "import",
value: "https://decaffeinate-project.org/scripts/decaffeinate.js",
},
],
make: ({ code, ...options }) => ({
type: "code",
label: "JavaScript",
value: decaffeinate.convert(code, { bare: true, ...options }).code,
}),
})