jass 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +47 -0
- data/README.md +45 -0
- data/lib/jass.rb +55 -0
- data/lib/jass/base.rb +141 -0
- data/lib/jass/bundle_processor.rb +28 -0
- data/lib/jass/compiler.rb +112 -0
- data/lib/jass/dependency.rb +14 -0
- data/lib/jass/errors.rb +29 -0
- data/lib/jass/es6_processor.rb +17 -0
- data/lib/jass/function.rb +13 -0
- data/lib/jass/global_directive_processor.rb +12 -0
- data/lib/jass/plugin.rb +13 -0
- data/lib/jass/railtie.rb +12 -0
- data/lib/jass/version.rb +3 -0
- data/vendor/node_modules/@types/acorn/index.d.ts +256 -0
- data/vendor/node_modules/@types/acorn/package.json +29 -0
- data/vendor/node_modules/@types/estree/index.d.ts +546 -0
- data/vendor/node_modules/@types/estree/package.json +22 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/index.js +17 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/inject.js +72 -0
- data/vendor/node_modules/acorn-dynamic-import/lib/walk.js +22 -0
- data/vendor/node_modules/acorn-dynamic-import/package.json +45 -0
- data/vendor/node_modules/acorn-dynamic-import/src/index.js +4 -0
- data/vendor/node_modules/acorn-dynamic-import/src/inject.js +52 -0
- data/vendor/node_modules/acorn-dynamic-import/src/walk.js +12 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-es7-plugin.js +17 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-v3.js +333 -0
- data/vendor/node_modules/acorn-es7-plugin/acorn-v4.js +194 -0
- data/vendor/node_modules/acorn-es7-plugin/package.json +29 -0
- data/vendor/node_modules/acorn-jsx/index.js +3 -0
- data/vendor/node_modules/acorn-jsx/inject.js +449 -0
- data/vendor/node_modules/acorn-jsx/package.json +28 -0
- data/vendor/node_modules/acorn-jsx/xhtml.js +255 -0
- data/vendor/node_modules/acorn/bin/_acorn.js +69 -0
- data/vendor/node_modules/acorn/bin/acorn +4 -0
- data/vendor/node_modules/acorn/bin/run_test262.js +22 -0
- data/vendor/node_modules/acorn/bin/test262.whitelist +409 -0
- data/vendor/node_modules/acorn/dist/acorn.es.js +5305 -0
- data/vendor/node_modules/acorn/dist/acorn.js +5336 -0
- data/vendor/node_modules/acorn/dist/acorn_loose.es.js +1412 -0
- data/vendor/node_modules/acorn/dist/acorn_loose.js +1422 -0
- data/vendor/node_modules/acorn/dist/walk.es.js +419 -0
- data/vendor/node_modules/acorn/dist/walk.js +439 -0
- data/vendor/node_modules/acorn/package.json +56 -0
- data/vendor/node_modules/ansi-styles/index.js +165 -0
- data/vendor/node_modules/ansi-styles/package.json +56 -0
- data/vendor/node_modules/arr-diff/index.js +58 -0
- data/vendor/node_modules/arr-diff/package.json +49 -0
- data/vendor/node_modules/arr-flatten/index.js +22 -0
- data/vendor/node_modules/arr-flatten/package.json +76 -0
- data/vendor/node_modules/array-unique/index.js +28 -0
- data/vendor/node_modules/array-unique/package.json +37 -0
- data/vendor/node_modules/braces/index.js +399 -0
- data/vendor/node_modules/braces/package.json +83 -0
- data/vendor/node_modules/buble/bin/buble +24 -0
- data/vendor/node_modules/buble/bin/handleError.js +58 -0
- data/vendor/node_modules/buble/bin/runBuble.js +150 -0
- data/vendor/node_modules/buble/bin/showHelp.js +16 -0
- data/vendor/node_modules/buble/dist/buble-browser-deps.umd.js +14857 -0
- data/vendor/node_modules/buble/dist/buble-browser.cjs.js +9941 -0
- data/vendor/node_modules/buble/dist/buble-browser.es.js +9933 -0
- data/vendor/node_modules/buble/dist/buble.cjs.js +9433 -0
- data/vendor/node_modules/buble/dist/buble.es.js +9425 -0
- data/vendor/node_modules/buble/package.json +74 -0
- data/vendor/node_modules/buble/register.js +90 -0
- data/vendor/node_modules/buble/src/index.js +98 -0
- data/vendor/node_modules/buble/src/program/BlockStatement.js +373 -0
- data/vendor/node_modules/buble/src/program/Node.js +112 -0
- data/vendor/node_modules/buble/src/program/Program.js +74 -0
- data/vendor/node_modules/buble/src/program/Scope.js +116 -0
- data/vendor/node_modules/buble/src/program/extractNames.js +35 -0
- data/vendor/node_modules/buble/src/program/keys.js +4 -0
- data/vendor/node_modules/buble/src/program/types/ArrayExpression.js +70 -0
- data/vendor/node_modules/buble/src/program/types/ArrowFunctionExpression.js +52 -0
- data/vendor/node_modules/buble/src/program/types/AssignmentExpression.js +185 -0
- data/vendor/node_modules/buble/src/program/types/BinaryExpression.js +12 -0
- data/vendor/node_modules/buble/src/program/types/BreakStatement.js +26 -0
- data/vendor/node_modules/buble/src/program/types/CallExpression.js +104 -0
- data/vendor/node_modules/buble/src/program/types/ClassBody.js +237 -0
- data/vendor/node_modules/buble/src/program/types/ClassDeclaration.js +79 -0
- data/vendor/node_modules/buble/src/program/types/ClassExpression.js +51 -0
- data/vendor/node_modules/buble/src/program/types/ContinueStatement.js +17 -0
- data/vendor/node_modules/buble/src/program/types/ExportDefaultDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ExportNamedDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ForInStatement.js +76 -0
- data/vendor/node_modules/buble/src/program/types/ForOfStatement.js +89 -0
- data/vendor/node_modules/buble/src/program/types/ForStatement.js +54 -0
- data/vendor/node_modules/buble/src/program/types/FunctionDeclaration.js +25 -0
- data/vendor/node_modules/buble/src/program/types/FunctionExpression.js +74 -0
- data/vendor/node_modules/buble/src/program/types/Identifier.js +54 -0
- data/vendor/node_modules/buble/src/program/types/IfStatement.js +29 -0
- data/vendor/node_modules/buble/src/program/types/ImportDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/types/ImportDefaultSpecifier.js +8 -0
- data/vendor/node_modules/buble/src/program/types/ImportSpecifier.js +8 -0
- data/vendor/node_modules/buble/src/program/types/JSXAttribute.js +20 -0
- data/vendor/node_modules/buble/src/program/types/JSXClosingElement.js +27 -0
- data/vendor/node_modules/buble/src/program/types/JSXClosingFragment.js +22 -0
- data/vendor/node_modules/buble/src/program/types/JSXElement.js +57 -0
- data/vendor/node_modules/buble/src/program/types/JSXExpressionContainer.js +10 -0
- data/vendor/node_modules/buble/src/program/types/JSXFragment.js +4 -0
- data/vendor/node_modules/buble/src/program/types/JSXOpeningElement.js +93 -0
- data/vendor/node_modules/buble/src/program/types/JSXOpeningFragment.js +7 -0
- data/vendor/node_modules/buble/src/program/types/JSXSpreadAttribute.js +10 -0
- data/vendor/node_modules/buble/src/program/types/Literal.js +43 -0
- data/vendor/node_modules/buble/src/program/types/MemberExpression.js +13 -0
- data/vendor/node_modules/buble/src/program/types/NewExpression.js +55 -0
- data/vendor/node_modules/buble/src/program/types/ObjectExpression.js +250 -0
- data/vendor/node_modules/buble/src/program/types/Property.js +52 -0
- data/vendor/node_modules/buble/src/program/types/ReturnStatement.js +32 -0
- data/vendor/node_modules/buble/src/program/types/SpreadElement.js +12 -0
- data/vendor/node_modules/buble/src/program/types/Super.js +88 -0
- data/vendor/node_modules/buble/src/program/types/TaggedTemplateExpression.js +63 -0
- data/vendor/node_modules/buble/src/program/types/TemplateElement.js +7 -0
- data/vendor/node_modules/buble/src/program/types/TemplateLiteral.js +80 -0
- data/vendor/node_modules/buble/src/program/types/ThisExpression.js +31 -0
- data/vendor/node_modules/buble/src/program/types/UpdateExpression.js +32 -0
- data/vendor/node_modules/buble/src/program/types/VariableDeclaration.js +101 -0
- data/vendor/node_modules/buble/src/program/types/VariableDeclarator.js +43 -0
- data/vendor/node_modules/buble/src/program/types/index.js +98 -0
- data/vendor/node_modules/buble/src/program/types/shared/LoopStatement.js +105 -0
- data/vendor/node_modules/buble/src/program/types/shared/ModuleDeclaration.js +10 -0
- data/vendor/node_modules/buble/src/program/wrap.js +68 -0
- data/vendor/node_modules/buble/src/support.js +97 -0
- data/vendor/node_modules/buble/src/utils/CompileError.js +30 -0
- data/vendor/node_modules/buble/src/utils/array.js +11 -0
- data/vendor/node_modules/buble/src/utils/checkConst.js +8 -0
- data/vendor/node_modules/buble/src/utils/deindent.js +30 -0
- data/vendor/node_modules/buble/src/utils/destructure.js +377 -0
- data/vendor/node_modules/buble/src/utils/getSnippet.js +30 -0
- data/vendor/node_modules/buble/src/utils/isReference.js +41 -0
- data/vendor/node_modules/buble/src/utils/locate.js +20 -0
- data/vendor/node_modules/buble/src/utils/patterns.js +1 -0
- data/vendor/node_modules/buble/src/utils/removeTrailingComma.js +13 -0
- data/vendor/node_modules/buble/src/utils/reserved.js +6 -0
- data/vendor/node_modules/buble/src/utils/spread.js +70 -0
- data/vendor/node_modules/builtin-modules/builtin-modules.json +39 -0
- data/vendor/node_modules/builtin-modules/index.js +10 -0
- data/vendor/node_modules/builtin-modules/package.json +40 -0
- data/vendor/node_modules/builtin-modules/static.js +2 -0
- data/vendor/node_modules/chalk/index.js +228 -0
- data/vendor/node_modules/chalk/package.json +66 -0
- data/vendor/node_modules/chalk/templates.js +128 -0
- data/vendor/node_modules/chalk/types/index.d.ts +97 -0
- data/vendor/node_modules/color-convert/conversions.js +861 -0
- data/vendor/node_modules/color-convert/index.js +78 -0
- data/vendor/node_modules/color-convert/package.json +46 -0
- data/vendor/node_modules/color-convert/route.js +97 -0
- data/vendor/node_modules/color-name/index.js +152 -0
- data/vendor/node_modules/color-name/package.json +25 -0
- data/vendor/node_modules/color-name/test.js +7 -0
- data/vendor/node_modules/date-time/index.js +33 -0
- data/vendor/node_modules/date-time/package.json +39 -0
- data/vendor/node_modules/escape-string-regexp/index.js +11 -0
- data/vendor/node_modules/escape-string-regexp/package.json +41 -0
- data/vendor/node_modules/estree-walker/dist/estree-walker.es.js +57 -0
- data/vendor/node_modules/estree-walker/dist/estree-walker.umd.js +68 -0
- data/vendor/node_modules/estree-walker/package.json +34 -0
- data/vendor/node_modules/estree-walker/src/estree-walker.js +51 -0
- data/vendor/node_modules/expand-brackets/index.js +163 -0
- data/vendor/node_modules/expand-brackets/package.json +62 -0
- data/vendor/node_modules/expand-range/index.js +43 -0
- data/vendor/node_modules/expand-range/package.json +73 -0
- data/vendor/node_modules/extglob/index.js +178 -0
- data/vendor/node_modules/extglob/package.json +60 -0
- data/vendor/node_modules/filename-regex/index.js +10 -0
- data/vendor/node_modules/filename-regex/package.json +50 -0
- data/vendor/node_modules/fill-range/index.js +408 -0
- data/vendor/node_modules/fill-range/package.json +61 -0
- data/vendor/node_modules/for-in/index.js +16 -0
- data/vendor/node_modules/for-in/package.json +68 -0
- data/vendor/node_modules/for-own/index.js +19 -0
- data/vendor/node_modules/for-own/package.json +70 -0
- data/vendor/node_modules/glob-base/index.js +51 -0
- data/vendor/node_modules/glob-base/package.json +52 -0
- data/vendor/node_modules/glob-parent/index.js +10 -0
- data/vendor/node_modules/glob-parent/package.json +35 -0
- data/vendor/node_modules/glob-parent/test.js +28 -0
- data/vendor/node_modules/has-flag/index.js +8 -0
- data/vendor/node_modules/has-flag/package.json +44 -0
- data/vendor/node_modules/irregular-plurals/irregular-plurals.json +146 -0
- data/vendor/node_modules/irregular-plurals/package.json +39 -0
- data/vendor/node_modules/is-buffer/index.js +21 -0
- data/vendor/node_modules/is-buffer/package.json +51 -0
- data/vendor/node_modules/is-dotfile/index.js +14 -0
- data/vendor/node_modules/is-dotfile/package.json +69 -0
- data/vendor/node_modules/is-equal-shallow/index.js +27 -0
- data/vendor/node_modules/is-equal-shallow/package.json +54 -0
- data/vendor/node_modules/is-extendable/index.js +13 -0
- data/vendor/node_modules/is-extendable/package.json +51 -0
- data/vendor/node_modules/is-extglob/index.js +11 -0
- data/vendor/node_modules/is-extglob/package.json +48 -0
- data/vendor/node_modules/is-glob/index.js +14 -0
- data/vendor/node_modules/is-glob/package.json +60 -0
- data/vendor/node_modules/is-module/index.js +11 -0
- data/vendor/node_modules/is-module/package.json +20 -0
- data/vendor/node_modules/is-number/index.js +19 -0
- data/vendor/node_modules/is-number/package.json +59 -0
- data/vendor/node_modules/is-posix-bracket/index.js +10 -0
- data/vendor/node_modules/is-posix-bracket/package.json +64 -0
- data/vendor/node_modules/is-primitive/index.js +13 -0
- data/vendor/node_modules/is-primitive/package.json +46 -0
- data/vendor/node_modules/is-reference/dist/is-reference.es.js +26 -0
- data/vendor/node_modules/is-reference/dist/is-reference.js +34 -0
- data/vendor/node_modules/is-reference/dist/types/index.d.ts +2 -0
- data/vendor/node_modules/is-reference/package.json +47 -0
- data/vendor/node_modules/isarray/index.js +5 -0
- data/vendor/node_modules/isarray/package.json +45 -0
- data/vendor/node_modules/isarray/test.js +20 -0
- data/vendor/node_modules/isobject/index.js +14 -0
- data/vendor/node_modules/isobject/package.json +67 -0
- data/vendor/node_modules/kind-of/index.js +116 -0
- data/vendor/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/locate-character/dist/locate-character.es.js +43 -0
- data/vendor/node_modules/locate-character/dist/locate-character.umd.js +54 -0
- data/vendor/node_modules/locate-character/dist/types/index.d.ts +17 -0
- data/vendor/node_modules/locate-character/package.json +41 -0
- data/vendor/node_modules/magic-string/dist/magic-string.cjs.js +1300 -0
- data/vendor/node_modules/magic-string/dist/magic-string.es.js +1296 -0
- data/vendor/node_modules/magic-string/dist/magic-string.umd.js +1352 -0
- data/vendor/node_modules/magic-string/index.d.ts +83 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/dist/vlq.js +91 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/package.json +27 -0
- data/vendor/node_modules/magic-string/node_modules/vlq/src/vlq.js +78 -0
- data/vendor/node_modules/magic-string/package.json +55 -0
- data/vendor/node_modules/micromatch/index.js +431 -0
- data/vendor/node_modules/micromatch/lib/chars.js +67 -0
- data/vendor/node_modules/micromatch/lib/expand.js +304 -0
- data/vendor/node_modules/micromatch/lib/glob.js +193 -0
- data/vendor/node_modules/micromatch/lib/utils.js +149 -0
- data/vendor/node_modules/micromatch/package.json +114 -0
- data/vendor/node_modules/minimist/index.js +236 -0
- data/vendor/node_modules/minimist/package.json +45 -0
- data/vendor/node_modules/nodent-compiler/compiler.js +171 -0
- data/vendor/node_modules/nodent-compiler/lib/arboriculture.js +2694 -0
- data/vendor/node_modules/nodent-compiler/lib/output.js +934 -0
- data/vendor/node_modules/nodent-compiler/lib/parser.js +291 -0
- data/vendor/node_modules/nodent-compiler/package.json +37 -0
- data/vendor/node_modules/normalize-path/index.js +19 -0
- data/vendor/node_modules/normalize-path/package.json +78 -0
- data/vendor/node_modules/object.omit/index.js +40 -0
- data/vendor/node_modules/object.omit/package.json +67 -0
- data/vendor/node_modules/os-homedir/index.js +24 -0
- data/vendor/node_modules/os-homedir/package.json +41 -0
- data/vendor/node_modules/parse-glob/index.js +156 -0
- data/vendor/node_modules/parse-glob/package.json +62 -0
- data/vendor/node_modules/parse-ms/index.js +16 -0
- data/vendor/node_modules/parse-ms/package.json +34 -0
- data/vendor/node_modules/path-parse/index.js +93 -0
- data/vendor/node_modules/path-parse/index.min.js +1 -0
- data/vendor/node_modules/path-parse/package.json +33 -0
- data/vendor/node_modules/path-parse/test.js +77 -0
- data/vendor/node_modules/path-parse/test.min.js +1 -0
- data/vendor/node_modules/plur/index.js +20 -0
- data/vendor/node_modules/plur/package.json +42 -0
- data/vendor/node_modules/preserve/index.js +54 -0
- data/vendor/node_modules/preserve/package.json +48 -0
- data/vendor/node_modules/preserve/test.js +48 -0
- data/vendor/node_modules/pretty-ms/index.js +48 -0
- data/vendor/node_modules/pretty-ms/package.json +48 -0
- data/vendor/node_modules/randomatic/index.js +82 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/index.js +22 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +116 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/randomatic/node_modules/is-number/package.json +83 -0
- data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +119 -0
- data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +90 -0
- data/vendor/node_modules/randomatic/package.json +78 -0
- data/vendor/node_modules/regex-cache/index.js +68 -0
- data/vendor/node_modules/regex-cache/package.json +64 -0
- data/vendor/node_modules/remove-trailing-separator/index.js +17 -0
- data/vendor/node_modules/remove-trailing-separator/package.json +37 -0
- data/vendor/node_modules/repeat-element/index.js +18 -0
- data/vendor/node_modules/repeat-element/package.json +44 -0
- data/vendor/node_modules/repeat-string/index.js +70 -0
- data/vendor/node_modules/repeat-string/package.json +77 -0
- data/vendor/node_modules/require-relative/index.js +33 -0
- data/vendor/node_modules/require-relative/package.json +22 -0
- data/vendor/node_modules/resolve/index.js +8 -0
- data/vendor/node_modules/resolve/lib/async.js +203 -0
- data/vendor/node_modules/resolve/lib/caller.js +8 -0
- data/vendor/node_modules/resolve/lib/core.js +53 -0
- data/vendor/node_modules/resolve/lib/core.json +69 -0
- data/vendor/node_modules/resolve/lib/node-modules-paths.js +45 -0
- data/vendor/node_modules/resolve/lib/sync.js +93 -0
- data/vendor/node_modules/resolve/package.json +40 -0
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +804 -0
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +800 -0
- data/vendor/node_modules/rollup-plugin-commonjs/package.json +52 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/ast-utils.js +104 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/defaultResolver.js +39 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/helpers.js +19 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +198 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +431 -0
- data/vendor/node_modules/rollup-plugin-commonjs/src/utils.js +13 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +218 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +214 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/package.json +51 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/src/empty.js +1 -0
- data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +205 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +223 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +214 -0
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +217 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +55 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +59 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +65 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +33 -0
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +49 -0
- data/vendor/node_modules/rollup-pluginutils/package.json +40 -0
- data/vendor/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
- data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +147 -0
- data/vendor/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
- data/vendor/node_modules/rollup-pluginutils/src/index.js +4 -0
- data/vendor/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
- data/vendor/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
- data/vendor/node_modules/rollup/bin/rollup +4085 -0
- data/vendor/node_modules/rollup/dist/rollup.browser.js +19829 -0
- data/vendor/node_modules/rollup/dist/rollup.es.js +23586 -0
- data/vendor/node_modules/rollup/dist/rollup.js +23597 -0
- data/vendor/node_modules/rollup/dist/typings/Chunk.d.ts +85 -0
- data/vendor/node_modules/rollup/dist/typings/ExternalModule.d.ts +30 -0
- data/vendor/node_modules/rollup/dist/typings/Graph.d.ts +47 -0
- data/vendor/node_modules/rollup/dist/typings/Module.d.ts +130 -0
- data/vendor/node_modules/rollup/dist/typings/ast/CallOptions.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/Entity.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/ExecutionPathOptions.d.ts +57 -0
- data/vendor/node_modules/rollup/dist/typings/ast/clone.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/ast/enhance.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/ast/keys.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayExpression.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayPattern.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrowFunctionExpression.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentPattern.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentProperty.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/AwaitExpression.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BinaryExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BlockStatement.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/BreakStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/CallExpression.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/CatchClause.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassBody.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassDeclaration.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassExpression.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ConditionalExpression.d.ts +28 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/DoWhileStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/EmptyStatement.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportAllDeclaration.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportDefaultDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportNamedDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportSpecifier.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExpressionStatement.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForInStatement.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForOfStatement.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForStatement.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionDeclaration.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionExpression.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Identifier.d.ts +29 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/IfStatement.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Import.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDeclaration.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDefaultSpecifier.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportNamespaceSpecifier.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportSpecifier.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/LabeledStatement.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Literal.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/LogicalExpression.d.ts +23 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/MemberExpression.d.ts +34 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/MethodDefinition.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/NewExpression.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/NodeType.d.ts +64 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectExpression.d.ts +22 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectPattern.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Program.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/Property.d.ts +30 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/RestElement.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ReturnStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SequenceExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SpreadElement.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchCase.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchStatement.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TaggedTemplateExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateElement.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateLiteral.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThisExpression.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThrowStatement.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnaryExpression.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnknownNode.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/UpdateExpression.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclaration.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclarator.d.ts +13 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/WhileStatement.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/YieldExpression.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/index.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/ClassNode.d.ts +17 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Expression.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/FunctionNode.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Node.d.ts +133 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Pattern.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/pureFunctions.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/BlockScope.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/CatchScope.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/FunctionScope.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/GlobalScope.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ModuleScope.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ParameterScope.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/ReturnValueScope.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/scopes/Scope.d.ts +42 -0
- data/vendor/node_modules/rollup/dist/typings/ast/utils/extractNames.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/ast/values.d.ts +31 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ArgumentsVariable.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ExportDefaultVariable.d.ts +16 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ExternalVariable.d.ts +12 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/GlobalVariable.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/LocalVariable.d.ts +21 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/NamespaceVariable.d.ts +20 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ParameterVariable.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ReplaceableInitializationVariable.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/ThisVariable.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/Variable.d.ts +43 -0
- data/vendor/node_modules/rollup/dist/typings/ast/variables/VariableReassignmentTracker.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/amd.d.ts +11 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/cjs.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/es.d.ts +9 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/iife.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/index.d.ts +15 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/esModuleExport.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getExportBlock.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getGlobalNameMaker.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getInteropBlock.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/sanitize.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/setupNamespace.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/trimEmptyImports.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/shared/warnOnBuiltins.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/system.d.ts +8 -0
- data/vendor/node_modules/rollup/dist/typings/finalisers/umd.d.ts +10 -0
- data/vendor/node_modules/rollup/dist/typings/node-entry.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/rollup/index.d.ts +167 -0
- data/vendor/node_modules/rollup/dist/typings/utils/callIfFunction.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/collapseSourcemaps.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/utils/commondir.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/defaults.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/deprecateOptions.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/ensureArray.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/utils/entryHashing.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/error.d.ts +18 -0
- data/vendor/node_modules/rollup/dist/typings/utils/first-sync.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/first.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/flushTime.d.ts +5 -0
- data/vendor/node_modules/rollup/dist/typings/utils/fs.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getCodeFrame.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getExportMode.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/getIndentString.d.ts +4 -0
- data/vendor/node_modules/rollup/dist/typings/utils/identifierHelpers.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/mergeOptions.d.ts +19 -0
- data/vendor/node_modules/rollup/dist/typings/utils/object.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/utils/path.d.ts +6 -0
- data/vendor/node_modules/rollup/dist/typings/utils/promise.d.ts +2 -0
- data/vendor/node_modules/rollup/dist/typings/utils/relativeId.d.ts +1 -0
- data/vendor/node_modules/rollup/dist/typings/utils/renderHelpers.d.ts +26 -0
- data/vendor/node_modules/rollup/dist/typings/utils/sourceMappingURL.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/utils/timers.d.ts +7 -0
- data/vendor/node_modules/rollup/dist/typings/utils/transform.d.ts +25 -0
- data/vendor/node_modules/rollup/dist/typings/utils/transformBundle.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/watch/chokidar.d.ts +3 -0
- data/vendor/node_modules/rollup/dist/typings/watch/fileWatchers.d.ts +14 -0
- data/vendor/node_modules/rollup/dist/typings/watch/index.d.ts +47 -0
- data/vendor/node_modules/rollup/package.json +122 -0
- data/vendor/node_modules/rollup/typings/package.json.d.ts +3 -0
- data/vendor/node_modules/signal-exit/index.js +157 -0
- data/vendor/node_modules/signal-exit/package.json +38 -0
- data/vendor/node_modules/signal-exit/signals.js +53 -0
- data/vendor/node_modules/source-map/dist/source-map.debug.js +3091 -0
- data/vendor/node_modules/source-map/dist/source-map.js +3090 -0
- data/vendor/node_modules/source-map/dist/source-map.min.js +2 -0
- data/vendor/node_modules/source-map/lib/array-set.js +121 -0
- data/vendor/node_modules/source-map/lib/base64-vlq.js +140 -0
- data/vendor/node_modules/source-map/lib/base64.js +67 -0
- data/vendor/node_modules/source-map/lib/binary-search.js +111 -0
- data/vendor/node_modules/source-map/lib/mapping-list.js +79 -0
- data/vendor/node_modules/source-map/lib/quick-sort.js +114 -0
- data/vendor/node_modules/source-map/lib/source-map-consumer.js +1082 -0
- data/vendor/node_modules/source-map/lib/source-map-generator.js +416 -0
- data/vendor/node_modules/source-map/lib/source-node.js +413 -0
- data/vendor/node_modules/source-map/lib/util.js +417 -0
- data/vendor/node_modules/source-map/package.json +72 -0
- data/vendor/node_modules/source-map/source-map.js +8 -0
- data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.es.js +129 -0
- data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.umd.js +140 -0
- data/vendor/node_modules/sourcemap-codec/dist/types/sourcemap-codec.d.ts +5 -0
- data/vendor/node_modules/sourcemap-codec/package.json +52 -0
- data/vendor/node_modules/supports-color/browser.js +5 -0
- data/vendor/node_modules/supports-color/index.js +135 -0
- data/vendor/node_modules/supports-color/package.json +53 -0
- data/vendor/node_modules/time-zone/index.js +10 -0
- data/vendor/node_modules/time-zone/package.json +35 -0
- data/vendor/node_modules/vlq/dist/types/vlq.d.ts +2 -0
- data/vendor/node_modules/vlq/dist/vlq.es.js +64 -0
- data/vendor/node_modules/vlq/dist/vlq.js +75 -0
- data/vendor/node_modules/vlq/package.json +30 -0
- data/vendor/package.json +15 -0
- data/vendor/yarn.lock +453 -0
- metadata +641 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
import Node from '../Node.js';
|
2
|
+
|
3
|
+
export default class TemplateLiteral extends Node {
|
4
|
+
transpile(code, transforms) {
|
5
|
+
super.transpile(code, transforms);
|
6
|
+
|
7
|
+
if (
|
8
|
+
transforms.templateString &&
|
9
|
+
this.parent.type !== 'TaggedTemplateExpression'
|
10
|
+
) {
|
11
|
+
let ordered = this.expressions
|
12
|
+
.concat(this.quasis)
|
13
|
+
.sort((a, b) => a.start - b.start || a.end - b.end)
|
14
|
+
.filter((node, i) => {
|
15
|
+
// include all expressions
|
16
|
+
if (node.type !== 'TemplateElement') return true;
|
17
|
+
|
18
|
+
// include all non-empty strings
|
19
|
+
if (node.value.raw) return true;
|
20
|
+
|
21
|
+
// exclude all empty strings not at the head
|
22
|
+
return !i;
|
23
|
+
});
|
24
|
+
|
25
|
+
// special case – we may be able to skip the first element,
|
26
|
+
// if it's the empty string, but only if the second and
|
27
|
+
// third elements aren't both expressions (since they maybe
|
28
|
+
// be numeric, and `1 + 2 + '3' === '33'`)
|
29
|
+
if (ordered.length >= 3) {
|
30
|
+
const [first, , third] = ordered;
|
31
|
+
if (
|
32
|
+
first.type === 'TemplateElement' &&
|
33
|
+
first.value.raw === '' &&
|
34
|
+
third.type === 'TemplateElement'
|
35
|
+
) {
|
36
|
+
ordered.shift();
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
const parenthesise =
|
41
|
+
(this.quasis.length !== 1 || this.expressions.length !== 0) &&
|
42
|
+
this.parent.type !== 'TemplateLiteral' &&
|
43
|
+
this.parent.type !== 'AssignmentExpression' &&
|
44
|
+
this.parent.type !== 'AssignmentPattern' &&
|
45
|
+
this.parent.type !== 'VariableDeclarator' &&
|
46
|
+
(this.parent.type !== 'BinaryExpression' ||
|
47
|
+
this.parent.operator !== '+');
|
48
|
+
|
49
|
+
if (parenthesise) code.appendRight(this.start, '(');
|
50
|
+
|
51
|
+
let lastIndex = this.start;
|
52
|
+
|
53
|
+
ordered.forEach((node, i) => {
|
54
|
+
let prefix = i === 0 ? (parenthesise ? '(' : '') : ' + ';
|
55
|
+
|
56
|
+
if (node.type === 'TemplateElement') {
|
57
|
+
code.overwrite(
|
58
|
+
lastIndex,
|
59
|
+
node.end,
|
60
|
+
prefix + JSON.stringify(node.value.cooked)
|
61
|
+
);
|
62
|
+
} else {
|
63
|
+
const parenthesise = node.type !== 'Identifier'; // TODO other cases where it's safe
|
64
|
+
|
65
|
+
if (parenthesise) prefix += '(';
|
66
|
+
|
67
|
+
code.remove(lastIndex, node.start);
|
68
|
+
|
69
|
+
if (prefix) code.prependRight(node.start, prefix);
|
70
|
+
if (parenthesise) code.appendLeft(node.end, ')');
|
71
|
+
}
|
72
|
+
|
73
|
+
lastIndex = node.end;
|
74
|
+
});
|
75
|
+
|
76
|
+
if (parenthesise) code.appendLeft(lastIndex, ')');
|
77
|
+
code.overwrite(lastIndex, this.end, "", { contentOnly: true } );
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import Node from '../Node.js';
|
2
|
+
import { loopStatement } from '../../utils/patterns.js';
|
3
|
+
|
4
|
+
export default class ThisExpression extends Node {
|
5
|
+
initialise(transforms) {
|
6
|
+
if (transforms.arrow) {
|
7
|
+
const lexicalBoundary = this.findLexicalBoundary();
|
8
|
+
const arrowFunction = this.findNearest('ArrowFunctionExpression');
|
9
|
+
const loop = this.findNearest(loopStatement);
|
10
|
+
|
11
|
+
if (
|
12
|
+
(arrowFunction && arrowFunction.depth > lexicalBoundary.depth) ||
|
13
|
+
(loop &&
|
14
|
+
loop.body.contains(this) &&
|
15
|
+
loop.depth > lexicalBoundary.depth) ||
|
16
|
+
(loop && loop.right && loop.right.contains(this))
|
17
|
+
) {
|
18
|
+
this.alias = lexicalBoundary.getThisAlias();
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
transpile(code) {
|
24
|
+
if (this.alias) {
|
25
|
+
code.overwrite(this.start, this.end, this.alias, {
|
26
|
+
storeName: true,
|
27
|
+
contentOnly: true
|
28
|
+
});
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import Node from '../Node.js';
|
2
|
+
import checkConst from '../../utils/checkConst.js';
|
3
|
+
|
4
|
+
export default class UpdateExpression extends Node {
|
5
|
+
initialise(transforms) {
|
6
|
+
if (this.argument.type === 'Identifier') {
|
7
|
+
const declaration = this.findScope(false).findDeclaration(
|
8
|
+
this.argument.name
|
9
|
+
);
|
10
|
+
// special case – https://gitlab.com/Rich-Harris/buble/issues/150
|
11
|
+
const statement = declaration && declaration.node.ancestor(3);
|
12
|
+
if (
|
13
|
+
statement &&
|
14
|
+
statement.type === 'ForStatement' &&
|
15
|
+
statement.body.contains(this)
|
16
|
+
) {
|
17
|
+
statement.reassigned[this.argument.name] = true;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
super.initialise(transforms);
|
22
|
+
}
|
23
|
+
|
24
|
+
transpile(code, transforms) {
|
25
|
+
if (this.argument.type === 'Identifier') {
|
26
|
+
// Do this check after everything has been initialized to find
|
27
|
+
// shadowing declarations after this expression
|
28
|
+
checkConst(this.argument, this.findScope(false));
|
29
|
+
}
|
30
|
+
super.transpile(code, transforms);
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import Node from '../Node.js';
|
2
|
+
import destructure from '../../utils/destructure.js';
|
3
|
+
import { loopStatement } from '../../utils/patterns.js';
|
4
|
+
|
5
|
+
export default class VariableDeclaration extends Node {
|
6
|
+
initialise(transforms) {
|
7
|
+
this.scope = this.findScope(this.kind === 'var');
|
8
|
+
this.declarations.forEach(declarator => declarator.initialise(transforms));
|
9
|
+
}
|
10
|
+
|
11
|
+
transpile(code, transforms) {
|
12
|
+
const i0 = this.getIndentation();
|
13
|
+
let kind = this.kind;
|
14
|
+
|
15
|
+
if (transforms.letConst && kind !== 'var') {
|
16
|
+
kind = 'var';
|
17
|
+
code.overwrite(this.start, this.start + this.kind.length, kind, {
|
18
|
+
storeName: true
|
19
|
+
});
|
20
|
+
}
|
21
|
+
|
22
|
+
if (transforms.destructuring && this.parent.type !== 'ForOfStatement' && this.parent.type !== 'ForInStatement') {
|
23
|
+
let c = this.start;
|
24
|
+
let lastDeclaratorIsPattern;
|
25
|
+
|
26
|
+
this.declarations.forEach((declarator, i) => {
|
27
|
+
declarator.transpile(code, transforms);
|
28
|
+
|
29
|
+
if (declarator.id.type === 'Identifier') {
|
30
|
+
if (i > 0 && this.declarations[i - 1].id.type !== 'Identifier') {
|
31
|
+
code.overwrite(c, declarator.id.start, `var `);
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
const inline = loopStatement.test(this.parent.type);
|
35
|
+
|
36
|
+
if (i === 0) {
|
37
|
+
code.remove(c, declarator.id.start);
|
38
|
+
} else {
|
39
|
+
code.overwrite(c, declarator.id.start, `;\n${i0}`);
|
40
|
+
}
|
41
|
+
|
42
|
+
const simple =
|
43
|
+
declarator.init.type === 'Identifier' && !declarator.init.rewritten;
|
44
|
+
|
45
|
+
const name = simple
|
46
|
+
? (declarator.init.alias || declarator.init.name)
|
47
|
+
: declarator.findScope(true).createIdentifier('ref');
|
48
|
+
|
49
|
+
c = declarator.start;
|
50
|
+
|
51
|
+
let statementGenerators = [];
|
52
|
+
|
53
|
+
if (simple) {
|
54
|
+
code.remove(declarator.id.end, declarator.end);
|
55
|
+
} else {
|
56
|
+
statementGenerators.push((start, prefix, suffix) => {
|
57
|
+
code.prependRight(declarator.id.end, `var ${name}`);
|
58
|
+
code.appendLeft(declarator.init.end, `${suffix}`);
|
59
|
+
code.move(declarator.id.end, declarator.end, start);
|
60
|
+
});
|
61
|
+
}
|
62
|
+
|
63
|
+
const scope = declarator.findScope(false);
|
64
|
+
destructure(
|
65
|
+
code,
|
66
|
+
id => scope.createIdentifier(id),
|
67
|
+
({ name }) => scope.resolveName(name),
|
68
|
+
declarator.id,
|
69
|
+
name,
|
70
|
+
inline,
|
71
|
+
statementGenerators
|
72
|
+
);
|
73
|
+
|
74
|
+
let prefix = inline ? 'var ' : '';
|
75
|
+
let suffix = inline ? `, ` : `;\n${i0}`;
|
76
|
+
statementGenerators.forEach((fn, j) => {
|
77
|
+
if (
|
78
|
+
i === this.declarations.length - 1 &&
|
79
|
+
j === statementGenerators.length - 1
|
80
|
+
) {
|
81
|
+
suffix = inline ? '' : ';';
|
82
|
+
}
|
83
|
+
|
84
|
+
fn(declarator.start, j === 0 ? prefix : '', suffix);
|
85
|
+
});
|
86
|
+
}
|
87
|
+
|
88
|
+
c = declarator.end;
|
89
|
+
lastDeclaratorIsPattern = declarator.id.type !== 'Identifier';
|
90
|
+
});
|
91
|
+
|
92
|
+
if (lastDeclaratorIsPattern && this.end > c) {
|
93
|
+
code.overwrite(c, this.end, '', { contentOnly: true });
|
94
|
+
}
|
95
|
+
} else {
|
96
|
+
this.declarations.forEach(declarator => {
|
97
|
+
declarator.transpile(code, transforms);
|
98
|
+
});
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import Node from '../Node.js';
|
2
|
+
|
3
|
+
export default class VariableDeclarator extends Node {
|
4
|
+
initialise(transforms) {
|
5
|
+
let kind = this.parent.kind;
|
6
|
+
if (kind === 'let' && this.parent.parent.type === 'ForStatement') {
|
7
|
+
kind = 'for.let'; // special case...
|
8
|
+
}
|
9
|
+
|
10
|
+
this.parent.scope.addDeclaration(this.id, kind);
|
11
|
+
super.initialise(transforms);
|
12
|
+
}
|
13
|
+
|
14
|
+
transpile(code, transforms) {
|
15
|
+
if (!this.init && transforms.letConst && this.parent.kind !== 'var') {
|
16
|
+
let inLoop = this.findNearest(
|
17
|
+
/Function|^For(In|Of)?Statement|^(?:Do)?WhileStatement/
|
18
|
+
);
|
19
|
+
if (
|
20
|
+
inLoop &&
|
21
|
+
!/Function/.test(inLoop.type) &&
|
22
|
+
!this.isLeftDeclaratorOfLoop()
|
23
|
+
) {
|
24
|
+
code.appendLeft(this.id.end, ' = (void 0)');
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
if (this.id) this.id.transpile(code, transforms);
|
29
|
+
if (this.init) this.init.transpile(code, transforms);
|
30
|
+
}
|
31
|
+
|
32
|
+
isLeftDeclaratorOfLoop() {
|
33
|
+
return (
|
34
|
+
this.parent &&
|
35
|
+
this.parent.type === 'VariableDeclaration' &&
|
36
|
+
this.parent.parent &&
|
37
|
+
(this.parent.parent.type === 'ForInStatement' ||
|
38
|
+
this.parent.parent.type === 'ForOfStatement') &&
|
39
|
+
this.parent.parent.left &&
|
40
|
+
this.parent.parent.left.declarations[0] === this
|
41
|
+
);
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import ArrayExpression from './ArrayExpression.js';
|
2
|
+
import ArrowFunctionExpression from './ArrowFunctionExpression.js';
|
3
|
+
import AssignmentExpression from './AssignmentExpression.js';
|
4
|
+
import BinaryExpression from './BinaryExpression.js';
|
5
|
+
import BreakStatement from './BreakStatement.js';
|
6
|
+
import CallExpression from './CallExpression.js';
|
7
|
+
import ClassBody from './ClassBody.js';
|
8
|
+
import ClassDeclaration from './ClassDeclaration.js';
|
9
|
+
import ClassExpression from './ClassExpression.js';
|
10
|
+
import ContinueStatement from './ContinueStatement.js';
|
11
|
+
import ExportDefaultDeclaration from './ExportDefaultDeclaration.js';
|
12
|
+
import ExportNamedDeclaration from './ExportNamedDeclaration.js';
|
13
|
+
import ForStatement from './ForStatement.js';
|
14
|
+
import ForInStatement from './ForInStatement.js';
|
15
|
+
import ForOfStatement from './ForOfStatement.js';
|
16
|
+
import FunctionDeclaration from './FunctionDeclaration.js';
|
17
|
+
import FunctionExpression from './FunctionExpression.js';
|
18
|
+
import Identifier from './Identifier.js';
|
19
|
+
import IfStatement from './IfStatement.js';
|
20
|
+
import ImportDeclaration from './ImportDeclaration.js';
|
21
|
+
import ImportDefaultSpecifier from './ImportDefaultSpecifier.js';
|
22
|
+
import ImportSpecifier from './ImportSpecifier.js';
|
23
|
+
import JSXAttribute from './JSXAttribute.js';
|
24
|
+
import JSXClosingElement from './JSXClosingElement.js';
|
25
|
+
import JSXClosingFragment from './JSXClosingFragment.js';
|
26
|
+
import JSXElement from './JSXElement.js';
|
27
|
+
import JSXExpressionContainer from './JSXExpressionContainer.js';
|
28
|
+
import JSXFragment from './JSXFragment.js';
|
29
|
+
import JSXOpeningElement from './JSXOpeningElement.js';
|
30
|
+
import JSXOpeningFragment from './JSXOpeningFragment.js';
|
31
|
+
import JSXSpreadAttribute from './JSXSpreadAttribute.js';
|
32
|
+
import Literal from './Literal.js';
|
33
|
+
import LoopStatement from './shared/LoopStatement.js';
|
34
|
+
import MemberExpression from './MemberExpression.js';
|
35
|
+
import NewExpression from './NewExpression.js';
|
36
|
+
import ObjectExpression from './ObjectExpression.js';
|
37
|
+
import Property from './Property.js';
|
38
|
+
import ReturnStatement from './ReturnStatement.js';
|
39
|
+
import SpreadElement from './SpreadElement.js';
|
40
|
+
import Super from './Super.js';
|
41
|
+
import TaggedTemplateExpression from './TaggedTemplateExpression.js';
|
42
|
+
import TemplateElement from './TemplateElement.js';
|
43
|
+
import TemplateLiteral from './TemplateLiteral.js';
|
44
|
+
import ThisExpression from './ThisExpression.js';
|
45
|
+
import UpdateExpression from './UpdateExpression.js';
|
46
|
+
import VariableDeclaration from './VariableDeclaration.js';
|
47
|
+
import VariableDeclarator from './VariableDeclarator.js';
|
48
|
+
|
49
|
+
export default {
|
50
|
+
ArrayExpression,
|
51
|
+
ArrowFunctionExpression,
|
52
|
+
AssignmentExpression,
|
53
|
+
BinaryExpression,
|
54
|
+
BreakStatement,
|
55
|
+
CallExpression,
|
56
|
+
ClassBody,
|
57
|
+
ClassDeclaration,
|
58
|
+
ClassExpression,
|
59
|
+
ContinueStatement,
|
60
|
+
DoWhileStatement: LoopStatement,
|
61
|
+
ExportNamedDeclaration,
|
62
|
+
ExportDefaultDeclaration,
|
63
|
+
ForStatement,
|
64
|
+
ForInStatement,
|
65
|
+
ForOfStatement,
|
66
|
+
FunctionDeclaration,
|
67
|
+
FunctionExpression,
|
68
|
+
Identifier,
|
69
|
+
IfStatement,
|
70
|
+
ImportDeclaration,
|
71
|
+
ImportDefaultSpecifier,
|
72
|
+
ImportSpecifier,
|
73
|
+
JSXAttribute,
|
74
|
+
JSXClosingElement,
|
75
|
+
JSXClosingFragment,
|
76
|
+
JSXElement,
|
77
|
+
JSXExpressionContainer,
|
78
|
+
JSXFragment,
|
79
|
+
JSXOpeningElement,
|
80
|
+
JSXOpeningFragment,
|
81
|
+
JSXSpreadAttribute,
|
82
|
+
Literal,
|
83
|
+
MemberExpression,
|
84
|
+
NewExpression,
|
85
|
+
ObjectExpression,
|
86
|
+
Property,
|
87
|
+
ReturnStatement,
|
88
|
+
SpreadElement,
|
89
|
+
Super,
|
90
|
+
TaggedTemplateExpression,
|
91
|
+
TemplateElement,
|
92
|
+
TemplateLiteral,
|
93
|
+
ThisExpression,
|
94
|
+
UpdateExpression,
|
95
|
+
VariableDeclaration,
|
96
|
+
VariableDeclarator,
|
97
|
+
WhileStatement: LoopStatement
|
98
|
+
};
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import Node from '../../Node.js';
|
2
|
+
|
3
|
+
export default class LoopStatement extends Node {
|
4
|
+
findScope(functionScope) {
|
5
|
+
return functionScope || !this.createdScope
|
6
|
+
? this.parent.findScope(functionScope)
|
7
|
+
: this.body.scope;
|
8
|
+
}
|
9
|
+
|
10
|
+
initialise(transforms) {
|
11
|
+
this.body.createScope();
|
12
|
+
this.createdScope = true;
|
13
|
+
|
14
|
+
// this is populated as and when reassignments occur
|
15
|
+
this.reassigned = Object.create(null);
|
16
|
+
this.aliases = Object.create(null);
|
17
|
+
|
18
|
+
super.initialise(transforms);
|
19
|
+
|
20
|
+
if (transforms.letConst) {
|
21
|
+
// see if any block-scoped declarations are referenced
|
22
|
+
// inside function expressions
|
23
|
+
const names = Object.keys(this.body.scope.declarations);
|
24
|
+
|
25
|
+
let i = names.length;
|
26
|
+
while (i--) {
|
27
|
+
const name = names[i];
|
28
|
+
const declaration = this.body.scope.declarations[name];
|
29
|
+
|
30
|
+
let j = declaration.instances.length;
|
31
|
+
while (j--) {
|
32
|
+
const instance = declaration.instances[j];
|
33
|
+
const nearestFunctionExpression = instance.findNearest(/Function/);
|
34
|
+
|
35
|
+
if (
|
36
|
+
nearestFunctionExpression &&
|
37
|
+
nearestFunctionExpression.depth > this.depth
|
38
|
+
) {
|
39
|
+
this.shouldRewriteAsFunction = true;
|
40
|
+
break;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
if (this.shouldRewriteAsFunction) break;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
transpile(code, transforms) {
|
50
|
+
const needsBlock =
|
51
|
+
this.type != 'ForOfStatement' &&
|
52
|
+
(this.body.type !== 'BlockStatement' ||
|
53
|
+
(this.body.type === 'BlockStatement' && this.body.synthetic));
|
54
|
+
|
55
|
+
if (this.shouldRewriteAsFunction) {
|
56
|
+
const i0 = this.getIndentation();
|
57
|
+
const i1 = i0 + code.getIndentString();
|
58
|
+
|
59
|
+
const argString = this.args ? ` ${this.args.join(', ')} ` : '';
|
60
|
+
const paramString = this.params ? ` ${this.params.join(', ')} ` : '';
|
61
|
+
|
62
|
+
const functionScope = this.findScope(true);
|
63
|
+
const loop = functionScope.createIdentifier('loop');
|
64
|
+
|
65
|
+
const before =
|
66
|
+
`var ${loop} = function (${paramString}) ` +
|
67
|
+
(this.body.synthetic ? `{\n${i0}${code.getIndentString()}` : '');
|
68
|
+
const after = (this.body.synthetic ? `\n${i0}}` : '') + `;\n\n${i0}`;
|
69
|
+
|
70
|
+
code.prependRight(this.body.start, before);
|
71
|
+
code.appendLeft(this.body.end, after);
|
72
|
+
code.move(this.start, this.body.start, this.body.end);
|
73
|
+
|
74
|
+
if (this.canBreak || this.canReturn) {
|
75
|
+
const returned = functionScope.createIdentifier('returned');
|
76
|
+
|
77
|
+
let insert = `{\n${i1}var ${returned} = ${loop}(${argString});\n`;
|
78
|
+
if (this.canBreak)
|
79
|
+
insert += `\n${i1}if ( ${returned} === 'break' ) break;`;
|
80
|
+
if (this.canReturn)
|
81
|
+
insert += `\n${i1}if ( ${returned} ) return ${returned}.v;`;
|
82
|
+
insert += `\n${i0}}`;
|
83
|
+
|
84
|
+
code.prependRight(this.body.end, insert);
|
85
|
+
} else {
|
86
|
+
const callExpression = `${loop}(${argString});`;
|
87
|
+
|
88
|
+
if (this.type === 'DoWhileStatement') {
|
89
|
+
code.overwrite(
|
90
|
+
this.start,
|
91
|
+
this.body.start,
|
92
|
+
`do {\n${i1}${callExpression}\n${i0}}`
|
93
|
+
);
|
94
|
+
} else {
|
95
|
+
code.prependRight(this.body.end, callExpression);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
} else if (needsBlock) {
|
99
|
+
code.appendLeft(this.body.start, '{ ');
|
100
|
+
code.prependRight(this.body.end, ' }');
|
101
|
+
}
|
102
|
+
|
103
|
+
super.transpile(code, transforms);
|
104
|
+
}
|
105
|
+
}
|