diff options
Diffstat (limited to 'node_modules/babel-core')
6 files changed, 42 insertions, 162 deletions
diff --git a/node_modules/babel-core/README.md b/node_modules/babel-core/README.md index ebff1f183..def3bd08d 100644 --- a/node_modules/babel-core/README.md +++ b/node_modules/babel-core/README.md @@ -72,15 +72,11 @@ const { code, map, ast } = babel.transformFromAst(ast, code, options); ## Options -<blockquote class="babel-callout babel-callout-info"> - <h4>Babel CLI</h4> - <p> - You can pass these options from the Babel CLI like so: - </p> - <p> - <code>babel --name<span class="o">=</span>value</code> - </p> -</blockquote> +> #### Babel CLI +> +> You can pass these options from the Babel CLI like so: +> +> `babel --name=value` Following is a table of the options you can use: @@ -89,7 +85,7 @@ Following is a table of the options you can use: | `ast` | `true` | Include the AST in the returned object | | `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code. | | `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code. | -| `babelrc` | `true` | Specify whether or not to use .babelrc and .babelignore files. Not available when using the CLI, [use `--no-babelrc` instead](https://babeljs.io/docs/usage/cli/#babel-ignoring-babelrc). | +| `babelrc` | `true` | Specify whether or not to use .babelrc and .babelignore files. Not available when using the CLI, [use `--no-babelrc` instead](https://babeljs.io/docs/en/babel-cli#ignoring-babelrc). | | `code` | `true` | Enable code generation | | `comments` | `true` | Output comments in generated output. | | `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. | @@ -108,8 +104,8 @@ Following is a table of the options you can use: | `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. | | `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. | | `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon | -| `plugins` | `[]` | List of [plugins](https://babeljs.io/docs/plugins/) to load and use. | -| `presets` | `[]` | List of [presets](https://babeljs.io/docs/plugins/#presets) (a set of plugins) to load and use. | +| `plugins` | `[]` | List of [plugins](https://babeljs.io/docs/en/plugins) to load and use. | +| `presets` | `[]` | List of [presets](https://babeljs.io/docs/en/plugins#presets) (a set of plugins) to load and use. | | `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) | | `resolveModuleSource` | `null` | Resolve a module source ie. `import "SOURCE";` to a custom value. Called as `resolveModuleSource(source, filename)`. | | `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. | diff --git a/node_modules/babel-core/lib/transformation/file/index.js b/node_modules/babel-core/lib/transformation/file/index.js index 76dc7c522..d3d0e0705 100644 --- a/node_modules/babel-core/lib/transformation/file/index.js +++ b/node_modules/babel-core/lib/transformation/file/index.js @@ -51,10 +51,6 @@ var _babelTraverse = require("babel-traverse"); var _babelTraverse2 = _interopRequireDefault(_babelTraverse); -var _sourceMap = require("source-map"); - -var _sourceMap2 = _interopRequireDefault(_sourceMap); - var _babelGenerator = require("babel-generator"); var _babelGenerator2 = _interopRequireDefault(_babelGenerator); @@ -89,6 +85,10 @@ var _babelTypes = require("babel-types"); var t = _interopRequireWildcard(_babelTypes); +var _mergeMap = require("./merge-map"); + +var _mergeMap2 = _interopRequireDefault(_mergeMap); + var _resolve = require("../../helpers/resolve"); var _resolve2 = _interopRequireDefault(_resolve); @@ -446,40 +446,8 @@ var File = function (_Store) { File.prototype.mergeSourceMap = function mergeSourceMap(map) { var inputMap = this.opts.inputSourceMap; - if (inputMap) { - var inputMapConsumer = new _sourceMap2.default.SourceMapConsumer(inputMap); - var outputMapConsumer = new _sourceMap2.default.SourceMapConsumer(map); - - var mergedGenerator = new _sourceMap2.default.SourceMapGenerator({ - file: inputMapConsumer.file, - sourceRoot: inputMapConsumer.sourceRoot - }); - - var source = outputMapConsumer.sources[0]; - - inputMapConsumer.eachMapping(function (mapping) { - var generatedPosition = outputMapConsumer.generatedPositionFor({ - line: mapping.generatedLine, - column: mapping.generatedColumn, - source: source - }); - if (generatedPosition.column != null) { - mergedGenerator.addMapping({ - source: mapping.source, - - original: mapping.source == null ? null : { - line: mapping.originalLine, - column: mapping.originalColumn - }, - - generated: generatedPosition - }); - } - }); - - var mergedMap = mergedGenerator.toJSON(); - inputMap.mappings = mergedMap.mappings; - return inputMap; + if (inputMap && map) { + return (0, _mergeMap2.default)(inputMap, map); } else { return map; } diff --git a/node_modules/babel-core/lib/transformation/file/options/option-manager.js b/node_modules/babel-core/lib/transformation/file/options/option-manager.js index 571c834ec..a15e47cb9 100644 --- a/node_modules/babel-core/lib/transformation/file/options/option-manager.js +++ b/node_modules/babel-core/lib/transformation/file/options/option-manager.js @@ -220,7 +220,7 @@ var OptionManager = function () { this.log.error("Using removed Babel 5 option: " + alias + "." + _key2 + " - " + _removed2.default[_key2].message, ReferenceError); } else { var unknownOptErr = "Unknown option: " + alias + "." + _key2 + ". Check out http://babeljs.io/docs/usage/options/ for more information about options."; - var presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options."; + var presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see https://babeljs.io/docs/en/plugins#pluginpresets-options."; this.log.error(unknownOptErr + "\n\n" + presetConfigErr, ReferenceError); diff --git a/node_modules/babel-core/lib/transformation/internal-plugins/shadow-functions.js b/node_modules/babel-core/lib/transformation/internal-plugins/shadow-functions.js index ae1d7b3d1..e7f8739c3 100644 --- a/node_modules/babel-core/lib/transformation/internal-plugins/shadow-functions.js +++ b/node_modules/babel-core/lib/transformation/internal-plugins/shadow-functions.js @@ -104,29 +104,33 @@ function remap(path, key) { if (!passedShadowFunction) return; var cached = fnPath.getData(key); - if (cached) return path.replaceWith(cached); + if (!cached) { + var id = path.scope.generateUidIdentifier(key); - var id = path.scope.generateUidIdentifier(key); + fnPath.setData(key, id); + cached = id; - fnPath.setData(key, id); - - var classPath = fnPath.findParent(function (p) { - return p.isClass(); - }); - var hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass); + var classPath = fnPath.findParent(function (p) { + return p.isClass(); + }); + var hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass); - if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) { - fnPath.scope.push({ id: id }); + if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) { + fnPath.scope.push({ id: id }); - fnPath.traverse(superVisitor, { id: id }); - } else { - var init = key === "this" ? t.thisExpression() : t.identifier(key); + fnPath.traverse(superVisitor, { id: id }); + } else { + var init = key === "this" ? t.thisExpression() : t.identifier(key); - if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction; + if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction; - fnPath.scope.push({ id: id, init: init }); + fnPath.scope.push({ id: id, init: init }); + } } - return path.replaceWith(id); + var node = t.cloneDeep(cached); + node.loc = path.node.loc; + + return path.replaceWith(node); } module.exports = exports["default"];
\ No newline at end of file diff --git a/node_modules/babel-core/package-lock.json b/node_modules/babel-core/package-lock.json deleted file mode 100644 index c5932ccbb..000000000 --- a/node_modules/babel-core/package-lock.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "babel-core", - "version": "6.25.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "convert-source-map": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", - "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=" - }, - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "requires": { - "ms": "2.0.0" - } - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "1.1.8" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" - }, - "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=" - } - } -} diff --git a/node_modules/babel-core/package.json b/node_modules/babel-core/package.json index 496cdfc50..c609c0b86 100644 --- a/node_modules/babel-core/package.json +++ b/node_modules/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "6.26.0", + "version": "6.26.3", "description": "Babel compiler core.", "author": "Sebastian McKenzie <sebmck@gmail.com>", "homepage": "https://babeljs.io/", @@ -36,19 +36,19 @@ "babel-traverse": "^6.26.0", "babel-types": "^6.26.0", "babylon": "^6.18.0", - "convert-source-map": "^1.5.0", - "debug": "^2.6.8", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", "json5": "^0.5.1", "lodash": "^4.17.4", "minimatch": "^3.0.4", "path-is-absolute": "^1.0.1", - "private": "^0.1.7", + "private": "^0.1.8", "slash": "^1.0.0", - "source-map": "^0.5.6" + "source-map": "^0.5.7" }, "devDependencies": { - "babel-helper-fixtures": "^6.26.0", - "babel-helper-transform-fixture-test-runner": "^6.26.0", + "babel-helper-fixtures": "^6.26.2", + "babel-helper-transform-fixture-test-runner": "^6.26.2", "babel-polyfill": "^6.26.0" } } |