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,74 @@
|
|
1
|
+
{
|
2
|
+
"name": "buble",
|
3
|
+
"version": "0.19.3",
|
4
|
+
"description": "The blazing fast, batteries-included ES2015 compiler",
|
5
|
+
"main": "dist/buble.cjs.js",
|
6
|
+
"module": "dist/buble.es.js",
|
7
|
+
"browser": {
|
8
|
+
"dist/buble.cjs.js": "./dist/buble-browser.cjs.js",
|
9
|
+
"dist/buble.es.js": "./dist/buble-browser.es.js"
|
10
|
+
},
|
11
|
+
"unpkg": "dist/buble-browser-deps.umd.js",
|
12
|
+
"files": [
|
13
|
+
"bin",
|
14
|
+
"src",
|
15
|
+
"dist",
|
16
|
+
"register.js",
|
17
|
+
"README.md"
|
18
|
+
],
|
19
|
+
"scripts": {
|
20
|
+
"build": "rollup -c",
|
21
|
+
"test": "mocha test/test.js",
|
22
|
+
"pretest": "npm run build",
|
23
|
+
"prepublish": "npm test",
|
24
|
+
"lint": "eslint src"
|
25
|
+
},
|
26
|
+
"bin": {
|
27
|
+
"buble": "./bin/buble"
|
28
|
+
},
|
29
|
+
"repository": {
|
30
|
+
"type": "git",
|
31
|
+
"url": "git+https://github.com/Rich-Harris/buble.git"
|
32
|
+
},
|
33
|
+
"keywords": [
|
34
|
+
"javascript",
|
35
|
+
"transpilation",
|
36
|
+
"compilation",
|
37
|
+
"esnext",
|
38
|
+
"es2015",
|
39
|
+
"es2017",
|
40
|
+
"es6",
|
41
|
+
"es7"
|
42
|
+
],
|
43
|
+
"author": "Rich Harris",
|
44
|
+
"license": "MIT",
|
45
|
+
"bugs": {
|
46
|
+
"url": "https://github.com/Rich-Harris/buble/issues"
|
47
|
+
},
|
48
|
+
"homepage": "https://github.com/Rich-Harris/buble#README",
|
49
|
+
"devDependencies": {
|
50
|
+
"console-group": "^0.3.3",
|
51
|
+
"eslint": "^4.17.0",
|
52
|
+
"glob": "^7.0.3",
|
53
|
+
"mocha": "^5.0.0",
|
54
|
+
"regexpu-core": "^4.1.3",
|
55
|
+
"rimraf": "^2.5.2",
|
56
|
+
"rollup": "^0.55.5",
|
57
|
+
"rollup-plugin-buble": "^0.19.1",
|
58
|
+
"rollup-plugin-commonjs": "^8.3.0",
|
59
|
+
"rollup-plugin-json": "^2.3.0",
|
60
|
+
"rollup-plugin-node-resolve": "^3.0.2",
|
61
|
+
"source-map": "^0.6.1",
|
62
|
+
"source-map-support": "^0.5.3"
|
63
|
+
},
|
64
|
+
"dependencies": {
|
65
|
+
"acorn": "^5.4.1",
|
66
|
+
"acorn-dynamic-import": "^3.0.0",
|
67
|
+
"acorn-jsx": "^4.1.1",
|
68
|
+
"chalk": "^2.3.1",
|
69
|
+
"magic-string": "^0.22.4",
|
70
|
+
"minimist": "^1.2.0",
|
71
|
+
"os-homedir": "^1.0.1",
|
72
|
+
"vlq": "^1.0.0"
|
73
|
+
}
|
74
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
var fs = require( 'fs' );
|
2
|
+
var path = require( 'path' );
|
3
|
+
var crypto = require( 'crypto' );
|
4
|
+
var homedir = require( 'os-homedir' );
|
5
|
+
var buble = require( './' );
|
6
|
+
|
7
|
+
var original = require.extensions[ '.js' ];
|
8
|
+
var nodeModulesPattern = path.sep === '/' ? /\/node_modules\// : /\\node_modules\\/;
|
9
|
+
|
10
|
+
var nodeVersion = /(?:0\.)?\d+/.exec( process.version )[0];
|
11
|
+
var versions = [ '0.10', '0.12', '4', '5', '6' ];
|
12
|
+
|
13
|
+
if ( !~versions.indexOf( nodeVersion ) ) {
|
14
|
+
if ( +nodeVersion > 6 ) {
|
15
|
+
nodeVersion = '6';
|
16
|
+
} else {
|
17
|
+
throw new Error( 'Unsupported version (' + nodeVersion + '). Please raise an issue at https://github.com/Rich-Harris/buble/issues' );
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
var options = {
|
22
|
+
target: {
|
23
|
+
node: nodeVersion
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
27
|
+
function mkdirp ( dir ) {
|
28
|
+
var parent = path.dirname( dir );
|
29
|
+
if ( dir === parent ) return;
|
30
|
+
mkdirp( parent );
|
31
|
+
|
32
|
+
try {
|
33
|
+
fs.mkdirSync( dir );
|
34
|
+
} catch ( err ) {
|
35
|
+
if ( err.code !== 'EEXIST' ) throw err;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
var home = homedir();
|
40
|
+
if ( home ) {
|
41
|
+
var cachedir = path.join( home, '.buble-cache', String(nodeVersion) );
|
42
|
+
mkdirp( cachedir );
|
43
|
+
fs.writeFileSync( path.join( home, '.buble-cache/README.txt' ), 'These files enable a faster startup when using buble/register. You can safely delete this folder at any time. See https://buble.surge.sh/guide/ for more information.' );
|
44
|
+
}
|
45
|
+
|
46
|
+
var optionsStringified = JSON.stringify( options );
|
47
|
+
|
48
|
+
require.extensions[ '.js' ] = function ( m, filename ) {
|
49
|
+
if ( nodeModulesPattern.test( filename ) ) return original( m, filename );
|
50
|
+
|
51
|
+
var source = fs.readFileSync( filename, 'utf-8' );
|
52
|
+
var hash = crypto.createHash( 'sha256' );
|
53
|
+
hash.update( buble.VERSION );
|
54
|
+
hash.update( optionsStringified );
|
55
|
+
hash.update( source );
|
56
|
+
var key = hash.digest( 'hex' ) + '.json';
|
57
|
+
var cachepath = path.join( cachedir, key );
|
58
|
+
|
59
|
+
var compiled;
|
60
|
+
|
61
|
+
if ( cachedir ) {
|
62
|
+
try {
|
63
|
+
compiled = JSON.parse( fs.readFileSync( cachepath, 'utf-8' ) );
|
64
|
+
} catch ( err ) {
|
65
|
+
// noop
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
if ( !compiled ) {
|
70
|
+
try {
|
71
|
+
compiled = buble.transform( source, options );
|
72
|
+
|
73
|
+
if ( cachedir ) {
|
74
|
+
fs.writeFileSync( cachepath, JSON.stringify( compiled ) );
|
75
|
+
}
|
76
|
+
} catch ( err ) {
|
77
|
+
if ( err.snippet ) {
|
78
|
+
console.log( 'Error compiling ' + filename + ':\n---' );
|
79
|
+
console.log( err.snippet );
|
80
|
+
console.log( err.message );
|
81
|
+
console.log( '' )
|
82
|
+
process.exit( 1 );
|
83
|
+
}
|
84
|
+
|
85
|
+
throw err;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
m._compile( '"use strict";\n' + compiled.code, filename );
|
90
|
+
};
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import * as acorn from 'acorn';
|
2
|
+
import acornJsx from 'acorn-jsx/inject';
|
3
|
+
import acornDynamicImport from 'acorn-dynamic-import/lib/inject';
|
4
|
+
import Program from './program/Program.js';
|
5
|
+
import { features, matrix } from './support.js';
|
6
|
+
import getSnippet from './utils/getSnippet.js';
|
7
|
+
|
8
|
+
const { parse } = [acornJsx, acornDynamicImport].reduce(
|
9
|
+
(final, plugin) => plugin(final),
|
10
|
+
acorn
|
11
|
+
);
|
12
|
+
|
13
|
+
const dangerousTransforms = ['dangerousTaggedTemplateString', 'dangerousForOf'];
|
14
|
+
|
15
|
+
export function target(target) {
|
16
|
+
const targets = Object.keys(target);
|
17
|
+
let bitmask = targets.length
|
18
|
+
? 0b11111111111111111111
|
19
|
+
: 0b01000000000000000000;
|
20
|
+
|
21
|
+
Object.keys(target).forEach(environment => {
|
22
|
+
const versions = matrix[environment];
|
23
|
+
if (!versions)
|
24
|
+
throw new Error(
|
25
|
+
`Unknown environment '${environment}'. Please raise an issue at https://github.com/Rich-Harris/buble/issues`
|
26
|
+
);
|
27
|
+
|
28
|
+
const targetVersion = target[environment];
|
29
|
+
if (!(targetVersion in versions))
|
30
|
+
throw new Error(
|
31
|
+
`Support data exists for the following versions of ${environment}: ${Object.keys(
|
32
|
+
versions
|
33
|
+
).join(
|
34
|
+
', '
|
35
|
+
)}. Please raise an issue at https://github.com/Rich-Harris/buble/issues`
|
36
|
+
);
|
37
|
+
const support = versions[targetVersion];
|
38
|
+
|
39
|
+
bitmask &= support;
|
40
|
+
});
|
41
|
+
|
42
|
+
let transforms = Object.create(null);
|
43
|
+
features.forEach((name, i) => {
|
44
|
+
transforms[name] = !(bitmask & (1 << i));
|
45
|
+
});
|
46
|
+
|
47
|
+
dangerousTransforms.forEach(name => {
|
48
|
+
transforms[name] = false;
|
49
|
+
});
|
50
|
+
|
51
|
+
return transforms;
|
52
|
+
}
|
53
|
+
|
54
|
+
export function transform(source, options = {}) {
|
55
|
+
let ast;
|
56
|
+
let jsx = null;
|
57
|
+
|
58
|
+
try {
|
59
|
+
ast = parse(source, {
|
60
|
+
ecmaVersion: 9,
|
61
|
+
preserveParens: true,
|
62
|
+
sourceType: 'module',
|
63
|
+
onComment: (block, text) => {
|
64
|
+
if (!jsx) {
|
65
|
+
let match = /@jsx\s+([^\s]+)/.exec(text);
|
66
|
+
if (match) jsx = match[1];
|
67
|
+
}
|
68
|
+
},
|
69
|
+
plugins: {
|
70
|
+
jsx: true,
|
71
|
+
dynamicImport: true
|
72
|
+
}
|
73
|
+
});
|
74
|
+
options.jsx = jsx || options.jsx;
|
75
|
+
} catch (err) {
|
76
|
+
err.snippet = getSnippet(source, err.loc);
|
77
|
+
err.toString = () => `${err.name}: ${err.message}\n${err.snippet}`;
|
78
|
+
throw err;
|
79
|
+
}
|
80
|
+
|
81
|
+
let transforms = target(options.target || {});
|
82
|
+
Object.keys(options.transforms || {}).forEach(name => {
|
83
|
+
if (name === 'modules') {
|
84
|
+
if (!('moduleImport' in options.transforms))
|
85
|
+
transforms.moduleImport = options.transforms.modules;
|
86
|
+
if (!('moduleExport' in options.transforms))
|
87
|
+
transforms.moduleExport = options.transforms.modules;
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
|
91
|
+
if (!(name in transforms)) throw new Error(`Unknown transform '${name}'`);
|
92
|
+
transforms[name] = options.transforms[name];
|
93
|
+
});
|
94
|
+
|
95
|
+
return new Program(source, ast, transforms, options).export(options);
|
96
|
+
}
|
97
|
+
|
98
|
+
export { version as VERSION } from '../package.json';
|
@@ -0,0 +1,373 @@
|
|
1
|
+
import Node from './Node.js';
|
2
|
+
import Scope from './Scope.js';
|
3
|
+
import destructure from '../utils/destructure.js';
|
4
|
+
|
5
|
+
function isUseStrict(node) {
|
6
|
+
if (!node) return false;
|
7
|
+
if (node.type !== 'ExpressionStatement') return false;
|
8
|
+
if (node.expression.type !== 'Literal') return false;
|
9
|
+
return node.expression.value === 'use strict';
|
10
|
+
}
|
11
|
+
|
12
|
+
export default class BlockStatement extends Node {
|
13
|
+
createScope() {
|
14
|
+
this.parentIsFunction = /Function/.test(this.parent.type);
|
15
|
+
this.isFunctionBlock = this.parentIsFunction || this.parent.type === 'Root';
|
16
|
+
this.scope = new Scope({
|
17
|
+
block: !this.isFunctionBlock,
|
18
|
+
parent: this.parent.findScope(false),
|
19
|
+
declare: id => this.createdDeclarations.push(id)
|
20
|
+
});
|
21
|
+
|
22
|
+
if (this.parentIsFunction) {
|
23
|
+
this.parent.params.forEach(node => {
|
24
|
+
this.scope.addDeclaration(node, 'param');
|
25
|
+
});
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
initialise(transforms) {
|
30
|
+
this.thisAlias = null;
|
31
|
+
this.argumentsAlias = null;
|
32
|
+
this.defaultParameters = [];
|
33
|
+
this.createdDeclarations = [];
|
34
|
+
|
35
|
+
// normally the scope gets created here, during initialisation,
|
36
|
+
// but in some cases (e.g. `for` statements), we need to create
|
37
|
+
// the scope early, as it pertains to both the init block and
|
38
|
+
// the body of the statement
|
39
|
+
if (!this.scope) this.createScope();
|
40
|
+
|
41
|
+
this.body.forEach(node => node.initialise(transforms));
|
42
|
+
|
43
|
+
this.scope.consolidate();
|
44
|
+
}
|
45
|
+
|
46
|
+
findLexicalBoundary() {
|
47
|
+
if (this.type === 'Program') return this;
|
48
|
+
if (/^Function/.test(this.parent.type)) return this;
|
49
|
+
|
50
|
+
return this.parent.findLexicalBoundary();
|
51
|
+
}
|
52
|
+
|
53
|
+
findScope(functionScope) {
|
54
|
+
if (functionScope && !this.isFunctionBlock)
|
55
|
+
return this.parent.findScope(functionScope);
|
56
|
+
return this.scope;
|
57
|
+
}
|
58
|
+
|
59
|
+
getArgumentsAlias() {
|
60
|
+
if (!this.argumentsAlias) {
|
61
|
+
this.argumentsAlias = this.scope.createIdentifier('arguments');
|
62
|
+
}
|
63
|
+
|
64
|
+
return this.argumentsAlias;
|
65
|
+
}
|
66
|
+
|
67
|
+
getArgumentsArrayAlias() {
|
68
|
+
if (!this.argumentsArrayAlias) {
|
69
|
+
this.argumentsArrayAlias = this.scope.createIdentifier('argsArray');
|
70
|
+
}
|
71
|
+
|
72
|
+
return this.argumentsArrayAlias;
|
73
|
+
}
|
74
|
+
|
75
|
+
getThisAlias() {
|
76
|
+
if (!this.thisAlias) {
|
77
|
+
this.thisAlias = this.scope.createIdentifier('this');
|
78
|
+
}
|
79
|
+
|
80
|
+
return this.thisAlias;
|
81
|
+
}
|
82
|
+
|
83
|
+
getIndentation() {
|
84
|
+
if (this.indentation === undefined) {
|
85
|
+
const source = this.program.magicString.original;
|
86
|
+
|
87
|
+
const useOuter = this.synthetic || !this.body.length;
|
88
|
+
let c = useOuter ? this.start : this.body[0].start;
|
89
|
+
|
90
|
+
while (c && source[c] !== '\n') c -= 1;
|
91
|
+
|
92
|
+
this.indentation = '';
|
93
|
+
|
94
|
+
// eslint-disable-next-line no-constant-condition
|
95
|
+
while (true) {
|
96
|
+
c += 1;
|
97
|
+
const char = source[c];
|
98
|
+
|
99
|
+
if (char !== ' ' && char !== '\t') break;
|
100
|
+
|
101
|
+
this.indentation += char;
|
102
|
+
}
|
103
|
+
|
104
|
+
const indentString = this.program.magicString.getIndentString();
|
105
|
+
|
106
|
+
// account for dedented class constructors
|
107
|
+
let parent = this.parent;
|
108
|
+
while (parent) {
|
109
|
+
if (parent.kind === 'constructor' && !parent.parent.parent.superClass) {
|
110
|
+
this.indentation = this.indentation.replace(indentString, '');
|
111
|
+
}
|
112
|
+
|
113
|
+
parent = parent.parent;
|
114
|
+
}
|
115
|
+
|
116
|
+
if (useOuter) this.indentation += indentString;
|
117
|
+
}
|
118
|
+
|
119
|
+
return this.indentation;
|
120
|
+
}
|
121
|
+
|
122
|
+
transpile(code, transforms) {
|
123
|
+
const indentation = this.getIndentation();
|
124
|
+
|
125
|
+
let introStatementGenerators = [];
|
126
|
+
|
127
|
+
if (this.argumentsAlias) {
|
128
|
+
introStatementGenerators.push((start, prefix, suffix) => {
|
129
|
+
const assignment = `${prefix}var ${this.argumentsAlias} = arguments${
|
130
|
+
suffix
|
131
|
+
}`;
|
132
|
+
code.appendLeft(start, assignment);
|
133
|
+
});
|
134
|
+
}
|
135
|
+
|
136
|
+
if (this.thisAlias) {
|
137
|
+
introStatementGenerators.push((start, prefix, suffix) => {
|
138
|
+
const assignment = `${prefix}var ${this.thisAlias} = this${suffix}`;
|
139
|
+
code.appendLeft(start, assignment);
|
140
|
+
});
|
141
|
+
}
|
142
|
+
|
143
|
+
if (this.argumentsArrayAlias) {
|
144
|
+
introStatementGenerators.push((start, prefix, suffix) => {
|
145
|
+
const i = this.scope.createIdentifier('i');
|
146
|
+
const assignment = `${prefix}var ${i} = arguments.length, ${
|
147
|
+
this.argumentsArrayAlias
|
148
|
+
} = Array(${i});\n${indentation}while ( ${i}-- ) ${
|
149
|
+
this.argumentsArrayAlias
|
150
|
+
}[${i}] = arguments[${i}]${suffix}`;
|
151
|
+
code.appendLeft(start, assignment);
|
152
|
+
});
|
153
|
+
}
|
154
|
+
|
155
|
+
if (/Function/.test(this.parent.type)) {
|
156
|
+
this.transpileParameters(
|
157
|
+
this.parent.params,
|
158
|
+
code,
|
159
|
+
transforms,
|
160
|
+
indentation,
|
161
|
+
introStatementGenerators
|
162
|
+
);
|
163
|
+
} else if ('CatchClause' === this.parent.type) {
|
164
|
+
this.transpileParameters(
|
165
|
+
[this.parent.param],
|
166
|
+
code,
|
167
|
+
transforms,
|
168
|
+
indentation,
|
169
|
+
introStatementGenerators
|
170
|
+
);
|
171
|
+
}
|
172
|
+
|
173
|
+
if (transforms.letConst && this.isFunctionBlock) {
|
174
|
+
this.transpileBlockScopedIdentifiers(code);
|
175
|
+
}
|
176
|
+
|
177
|
+
super.transpile(code, transforms);
|
178
|
+
|
179
|
+
if (this.createdDeclarations.length) {
|
180
|
+
introStatementGenerators.push((start, prefix, suffix) => {
|
181
|
+
const assignment = `${prefix}var ${this.createdDeclarations.join(', ')}${suffix}`;
|
182
|
+
code.appendLeft(start, assignment);
|
183
|
+
});
|
184
|
+
}
|
185
|
+
|
186
|
+
if (this.synthetic) {
|
187
|
+
if (this.parent.type === 'ArrowFunctionExpression') {
|
188
|
+
const expr = this.body[0];
|
189
|
+
|
190
|
+
if (introStatementGenerators.length) {
|
191
|
+
code
|
192
|
+
.appendLeft(this.start, `{`)
|
193
|
+
.prependRight(this.end, `${this.parent.getIndentation()}}`);
|
194
|
+
|
195
|
+
code.prependRight(expr.start, `\n${indentation}return `);
|
196
|
+
code.appendLeft(expr.end, `;\n`);
|
197
|
+
} else if (transforms.arrow) {
|
198
|
+
code.prependRight(expr.start, `{ return `);
|
199
|
+
code.appendLeft(expr.end, `; }`);
|
200
|
+
}
|
201
|
+
} else if (introStatementGenerators.length) {
|
202
|
+
code.prependRight(this.start, `{`).appendLeft(this.end, `}`);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
let start;
|
207
|
+
if (isUseStrict(this.body[0])) {
|
208
|
+
start = this.body[0].end;
|
209
|
+
} else if (this.synthetic || this.parent.type === 'Root') {
|
210
|
+
start = this.start;
|
211
|
+
} else {
|
212
|
+
start = this.start + 1;
|
213
|
+
}
|
214
|
+
|
215
|
+
let prefix = `\n${indentation}`;
|
216
|
+
let suffix = ';';
|
217
|
+
introStatementGenerators.forEach((fn, i) => {
|
218
|
+
if (i === introStatementGenerators.length - 1) suffix = `;\n`;
|
219
|
+
fn(start, prefix, suffix);
|
220
|
+
});
|
221
|
+
}
|
222
|
+
|
223
|
+
transpileParameters(params, code, transforms, indentation, introStatementGenerators) {
|
224
|
+
params.forEach(param => {
|
225
|
+
if (
|
226
|
+
param.type === 'AssignmentPattern' &&
|
227
|
+
param.left.type === 'Identifier'
|
228
|
+
) {
|
229
|
+
if (transforms.defaultParameter) {
|
230
|
+
introStatementGenerators.push((start, prefix, suffix) => {
|
231
|
+
const lhs = `${prefix}if ( ${param.left.name} === void 0 ) ${
|
232
|
+
param.left.name
|
233
|
+
}`;
|
234
|
+
|
235
|
+
code
|
236
|
+
.prependRight(param.left.end, lhs)
|
237
|
+
.move(param.left.end, param.right.end, start)
|
238
|
+
.appendLeft(param.right.end, suffix);
|
239
|
+
});
|
240
|
+
}
|
241
|
+
} else if (param.type === 'RestElement') {
|
242
|
+
if (transforms.spreadRest) {
|
243
|
+
introStatementGenerators.push((start, prefix, suffix) => {
|
244
|
+
const penultimateParam = params[params.length - 2];
|
245
|
+
|
246
|
+
if (penultimateParam) {
|
247
|
+
code.remove(
|
248
|
+
penultimateParam ? penultimateParam.end : param.start,
|
249
|
+
param.end
|
250
|
+
);
|
251
|
+
} else {
|
252
|
+
let start = param.start,
|
253
|
+
end = param.end; // TODO https://gitlab.com/Rich-Harris/buble/issues/8
|
254
|
+
|
255
|
+
while (/\s/.test(code.original[start - 1])) start -= 1;
|
256
|
+
while (/\s/.test(code.original[end])) end += 1;
|
257
|
+
|
258
|
+
code.remove(start, end);
|
259
|
+
}
|
260
|
+
|
261
|
+
const name = param.argument.name;
|
262
|
+
const len = this.scope.createIdentifier('len');
|
263
|
+
const count = params.length - 1;
|
264
|
+
|
265
|
+
if (count) {
|
266
|
+
code.prependRight(
|
267
|
+
start,
|
268
|
+
`${prefix}var ${name} = [], ${len} = arguments.length - ${
|
269
|
+
count
|
270
|
+
};\n${indentation}while ( ${len}-- > 0 ) ${name}[ ${
|
271
|
+
len
|
272
|
+
} ] = arguments[ ${len} + ${count} ]${suffix}`
|
273
|
+
);
|
274
|
+
} else {
|
275
|
+
code.prependRight(
|
276
|
+
start,
|
277
|
+
`${prefix}var ${name} = [], ${len} = arguments.length;\n${
|
278
|
+
indentation
|
279
|
+
}while ( ${len}-- ) ${name}[ ${len} ] = arguments[ ${len} ]${
|
280
|
+
suffix
|
281
|
+
}`
|
282
|
+
);
|
283
|
+
}
|
284
|
+
});
|
285
|
+
}
|
286
|
+
} else if (param.type !== 'Identifier') {
|
287
|
+
if (transforms.parameterDestructuring) {
|
288
|
+
const ref = this.scope.createIdentifier('ref');
|
289
|
+
destructure(
|
290
|
+
code,
|
291
|
+
id => this.scope.createIdentifier(id),
|
292
|
+
({ name }) => this.scope.resolveName(name),
|
293
|
+
param,
|
294
|
+
ref,
|
295
|
+
false,
|
296
|
+
introStatementGenerators
|
297
|
+
);
|
298
|
+
code.prependRight(param.start, ref);
|
299
|
+
}
|
300
|
+
}
|
301
|
+
});
|
302
|
+
}
|
303
|
+
|
304
|
+
transpileBlockScopedIdentifiers(code) {
|
305
|
+
Object.keys(this.scope.blockScopedDeclarations).forEach(name => {
|
306
|
+
const declarations = this.scope.blockScopedDeclarations[name];
|
307
|
+
|
308
|
+
for (let declaration of declarations) {
|
309
|
+
let cont = false; // TODO implement proper continue...
|
310
|
+
|
311
|
+
if (declaration.kind === 'for.let') {
|
312
|
+
// special case
|
313
|
+
const forStatement = declaration.node.findNearest('ForStatement');
|
314
|
+
|
315
|
+
if (forStatement.shouldRewriteAsFunction) {
|
316
|
+
const outerAlias = this.scope.createIdentifier(name);
|
317
|
+
const innerAlias = forStatement.reassigned[name]
|
318
|
+
? this.scope.createIdentifier(name)
|
319
|
+
: name;
|
320
|
+
|
321
|
+
declaration.name = outerAlias;
|
322
|
+
code.overwrite(
|
323
|
+
declaration.node.start,
|
324
|
+
declaration.node.end,
|
325
|
+
outerAlias,
|
326
|
+
{ storeName: true }
|
327
|
+
);
|
328
|
+
|
329
|
+
forStatement.aliases[name] = {
|
330
|
+
outer: outerAlias,
|
331
|
+
inner: innerAlias
|
332
|
+
};
|
333
|
+
|
334
|
+
for (const identifier of declaration.instances) {
|
335
|
+
const alias = forStatement.body.contains(identifier)
|
336
|
+
? innerAlias
|
337
|
+
: outerAlias;
|
338
|
+
|
339
|
+
if (name !== alias) {
|
340
|
+
code.overwrite(identifier.start, identifier.end, alias, {
|
341
|
+
storeName: true
|
342
|
+
});
|
343
|
+
}
|
344
|
+
}
|
345
|
+
|
346
|
+
cont = true;
|
347
|
+
}
|
348
|
+
}
|
349
|
+
|
350
|
+
if (!cont) {
|
351
|
+
const alias = this.scope.createIdentifier(name);
|
352
|
+
|
353
|
+
if (name !== alias) {
|
354
|
+
declaration.name = alias;
|
355
|
+
code.overwrite(
|
356
|
+
declaration.node.start,
|
357
|
+
declaration.node.end,
|
358
|
+
alias,
|
359
|
+
{ storeName: true }
|
360
|
+
);
|
361
|
+
|
362
|
+
for (const identifier of declaration.instances) {
|
363
|
+
identifier.rewritten = true;
|
364
|
+
code.overwrite(identifier.start, identifier.end, alias, {
|
365
|
+
storeName: true
|
366
|
+
});
|
367
|
+
}
|
368
|
+
}
|
369
|
+
}
|
370
|
+
}
|
371
|
+
});
|
372
|
+
}
|
373
|
+
}
|