first commit
This commit is contained in:
121
build/node_modules/babel-core/README.md
generated
vendored
Normal file
121
build/node_modules/babel-core/README.md
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
# babel-core
|
||||
|
||||
> Babel compiler core.
|
||||
|
||||
|
||||
```javascript
|
||||
var babel = require("babel-core");
|
||||
import { transform } from 'babel-core';
|
||||
import * as babel from 'babel-core';
|
||||
```
|
||||
|
||||
All transformations will use your local configuration files (.babelrc or in package.json). See [options](#options) to disable it.
|
||||
|
||||
## babel.transform(code: string, [options?](#options): Object)
|
||||
|
||||
Transforms the passed in `code`. Returning an object with the generated code,
|
||||
source map, and AST.
|
||||
|
||||
```js
|
||||
babel.transform(code, options) // => { code, map, ast }
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var result = babel.transform("code();", options);
|
||||
result.code;
|
||||
result.map;
|
||||
result.ast;
|
||||
```
|
||||
|
||||
## babel.transformFile(filename: string, [options?](#options): Object, callback: Function)
|
||||
|
||||
Asynchronously transforms the entire contents of a file.
|
||||
|
||||
```js
|
||||
babel.transformFile(filename, options, callback)
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
babel.transformFile("filename.js", options, function (err, result) {
|
||||
result; // => { code, map, ast }
|
||||
});
|
||||
```
|
||||
|
||||
## babel.transformFileSync(filename: string, [options?](#options): Object)
|
||||
|
||||
Synchronous version of `babel.transformFile`. Returns the transformed contents of
|
||||
the `filename`.
|
||||
|
||||
```js
|
||||
babel.transformFileSync(filename, options) // => { code, map, ast }
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
babel.transformFileSync("filename.js", options).code;
|
||||
```
|
||||
|
||||
## babel.transformFromAst(ast: Object, code?: string, [options?](#options): Object)
|
||||
|
||||
Given, an [AST](https://astexplorer.net/), transform it.
|
||||
|
||||
```js
|
||||
const code = "if (true) return;";
|
||||
const ast = babylon.parse(code, { allowReturnOutsideFunction: true });
|
||||
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>
|
||||
|
||||
Following is a table of the options you can use:
|
||||
|
||||
| Option | Default | Description |
|
||||
| ------------------------ | -------------------- | ------------------------------- |
|
||||
| `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). |
|
||||
| `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. |
|
||||
| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the environment variable `BABEL_ENV` is set to `"production"`. If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"` |
|
||||
| `extends` | `null` | A path to an `.babelrc` file to extend |
|
||||
| `filename` | `"unknown"` | Filename for use in errors etc. |
|
||||
| `filenameRelative` | `(filename)` | Filename relative to `sourceRoot`. |
|
||||
| `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, babel-generator |
|
||||
| `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used. |
|
||||
| `highlightCode` | `true` | ANSI highlight syntax error code frames |
|
||||
| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified. |
|
||||
| `inputSourceMap` | `null` | A source map object that the output source map will be based on. |
|
||||
| `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) |
|
||||
| `moduleId` | `null` | Specify a custom name for module ids. |
|
||||
| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) |
|
||||
| `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. |
|
||||
| `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. |
|
||||
| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map. |
|
||||
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. |
|
||||
| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. |
|
||||
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. |
|
||||
| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be either "script" or "module". |
|
||||
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
|
||||
1
build/node_modules/babel-core/index.js
generated
vendored
Normal file
1
build/node_modules/babel-core/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./lib/api/node.js");
|
||||
190
build/node_modules/babel-core/lib/api/browser.js
generated
vendored
Normal file
190
build/node_modules/babel-core/lib/api/browser.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.transformFileSync = exports.transformFile = exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.Plugin = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined;
|
||||
|
||||
var _node = require("./node");
|
||||
|
||||
Object.defineProperty(exports, "File", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.File;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "options", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.options;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "buildExternalHelpers", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.buildExternalHelpers;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "template", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.template;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "version", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.version;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "util", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.util;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "messages", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.messages;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "types", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.types;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "traverse", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.traverse;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "OptionManager", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.OptionManager;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Plugin", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.Plugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Pipeline", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.Pipeline;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "analyse", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.analyse;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transform", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.transform;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFromAst", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.transformFromAst;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFile", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.transformFile;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFileSync", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _node.transformFileSync;
|
||||
}
|
||||
});
|
||||
exports.run = run;
|
||||
exports.load = load;
|
||||
function run(code) {
|
||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
return new Function((0, _node.transform)(code, opts).code)();
|
||||
}
|
||||
|
||||
function load(url, callback) {
|
||||
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var hold = arguments[3];
|
||||
|
||||
opts.filename = opts.filename || url;
|
||||
|
||||
var xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest();
|
||||
xhr.open("GET", url, true);
|
||||
if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain");
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState !== 4) return;
|
||||
|
||||
var status = xhr.status;
|
||||
if (status === 0 || status === 200) {
|
||||
var param = [xhr.responseText, opts];
|
||||
if (!hold) run(param);
|
||||
if (callback) callback(param);
|
||||
} else {
|
||||
throw new Error("Could not load " + url);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
function runScripts() {
|
||||
var scripts = [];
|
||||
var types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"];
|
||||
var index = 0;
|
||||
|
||||
function exec() {
|
||||
var param = scripts[index];
|
||||
if (param instanceof Array) {
|
||||
run(param, index);
|
||||
index++;
|
||||
exec();
|
||||
}
|
||||
}
|
||||
|
||||
function run(script, i) {
|
||||
var opts = {};
|
||||
|
||||
if (script.src) {
|
||||
load(script.src, function (param) {
|
||||
scripts[i] = param;
|
||||
exec();
|
||||
}, opts, true);
|
||||
} else {
|
||||
opts.filename = "embedded";
|
||||
scripts[i] = [script.innerHTML, opts];
|
||||
}
|
||||
}
|
||||
|
||||
var _scripts = global.document.getElementsByTagName("script");
|
||||
|
||||
for (var i = 0; i < _scripts.length; ++i) {
|
||||
var _script = _scripts[i];
|
||||
if (types.indexOf(_script.type) >= 0) scripts.push(_script);
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < scripts.length; _i++) {
|
||||
run(scripts[_i], _i);
|
||||
}
|
||||
|
||||
exec();
|
||||
}
|
||||
|
||||
if (global.addEventListener) {
|
||||
global.addEventListener("DOMContentLoaded", runScripts, false);
|
||||
} else if (global.attachEvent) {
|
||||
global.attachEvent("onload", runScripts);
|
||||
}
|
||||
153
build/node_modules/babel-core/lib/api/node.js
generated
vendored
Normal file
153
build/node_modules/babel-core/lib/api/node.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.resolvePreset = exports.resolvePlugin = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined;
|
||||
|
||||
var _file = require("../transformation/file");
|
||||
|
||||
Object.defineProperty(exports, "File", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_file).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _config = require("../transformation/file/options/config");
|
||||
|
||||
Object.defineProperty(exports, "options", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_config).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _buildExternalHelpers = require("../tools/build-external-helpers");
|
||||
|
||||
Object.defineProperty(exports, "buildExternalHelpers", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_buildExternalHelpers).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _babelTemplate = require("babel-template");
|
||||
|
||||
Object.defineProperty(exports, "template", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_babelTemplate).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _resolvePlugin = require("../helpers/resolve-plugin");
|
||||
|
||||
Object.defineProperty(exports, "resolvePlugin", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_resolvePlugin).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _resolvePreset = require("../helpers/resolve-preset");
|
||||
|
||||
Object.defineProperty(exports, "resolvePreset", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_resolvePreset).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _package = require("../../package");
|
||||
|
||||
Object.defineProperty(exports, "version", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _package.version;
|
||||
}
|
||||
});
|
||||
exports.Plugin = Plugin;
|
||||
exports.transformFile = transformFile;
|
||||
exports.transformFileSync = transformFileSync;
|
||||
|
||||
var _fs = require("fs");
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
var _util = require("../util");
|
||||
|
||||
var util = _interopRequireWildcard(_util);
|
||||
|
||||
var _babelMessages = require("babel-messages");
|
||||
|
||||
var messages = _interopRequireWildcard(_babelMessages);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
var _babelTraverse = require("babel-traverse");
|
||||
|
||||
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
|
||||
|
||||
var _optionManager = require("../transformation/file/options/option-manager");
|
||||
|
||||
var _optionManager2 = _interopRequireDefault(_optionManager);
|
||||
|
||||
var _pipeline = require("../transformation/pipeline");
|
||||
|
||||
var _pipeline2 = _interopRequireDefault(_pipeline);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.util = util;
|
||||
exports.messages = messages;
|
||||
exports.types = t;
|
||||
exports.traverse = _babelTraverse2.default;
|
||||
exports.OptionManager = _optionManager2.default;
|
||||
function Plugin(alias) {
|
||||
throw new Error("The (" + alias + ") Babel 5 plugin is being run with Babel 6.");
|
||||
}
|
||||
|
||||
exports.Pipeline = _pipeline2.default;
|
||||
|
||||
|
||||
var pipeline = new _pipeline2.default();
|
||||
var analyse = exports.analyse = pipeline.analyse.bind(pipeline);
|
||||
var transform = exports.transform = pipeline.transform.bind(pipeline);
|
||||
var transformFromAst = exports.transformFromAst = pipeline.transformFromAst.bind(pipeline);
|
||||
|
||||
function transformFile(filename, opts, callback) {
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = {};
|
||||
}
|
||||
|
||||
opts.filename = filename;
|
||||
|
||||
_fs2.default.readFile(filename, function (err, code) {
|
||||
var result = void 0;
|
||||
|
||||
if (!err) {
|
||||
try {
|
||||
result = transform(code, opts);
|
||||
} catch (_err) {
|
||||
err = _err;
|
||||
}
|
||||
}
|
||||
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function transformFileSync(filename) {
|
||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
opts.filename = filename;
|
||||
return transform(_fs2.default.readFileSync(filename, "utf8"), opts);
|
||||
}
|
||||
8
build/node_modules/babel-core/lib/helpers/get-possible-plugin-names.js
generated
vendored
Normal file
8
build/node_modules/babel-core/lib/helpers/get-possible-plugin-names.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = getPossiblePluginNames;
|
||||
function getPossiblePluginNames(pluginName) {
|
||||
return ["babel-plugin-" + pluginName, pluginName];
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
18
build/node_modules/babel-core/lib/helpers/get-possible-preset-names.js
generated
vendored
Normal file
18
build/node_modules/babel-core/lib/helpers/get-possible-preset-names.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = getPossiblePresetNames;
|
||||
function getPossiblePresetNames(presetName) {
|
||||
var possibleNames = ["babel-preset-" + presetName, presetName];
|
||||
|
||||
var matches = presetName.match(/^(@[^/]+)\/(.+)$/);
|
||||
if (matches) {
|
||||
var orgName = matches[1],
|
||||
presetPath = matches[2];
|
||||
|
||||
possibleNames.push(orgName + "/babel-preset-" + presetPath);
|
||||
}
|
||||
|
||||
return possibleNames;
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
46
build/node_modules/babel-core/lib/helpers/merge.js
generated
vendored
Normal file
46
build/node_modules/babel-core/lib/helpers/merge.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
||||
|
||||
exports.default = function (dest, src) {
|
||||
if (!dest || !src) return;
|
||||
|
||||
return (0, _mergeWith2.default)(dest, src, function (a, b) {
|
||||
if (b && Array.isArray(a)) {
|
||||
var newArray = b.slice(0);
|
||||
|
||||
for (var _iterator = a, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var item = _ref;
|
||||
|
||||
if (newArray.indexOf(item) < 0) {
|
||||
newArray.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
return newArray;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var _mergeWith = require("lodash/mergeWith");
|
||||
|
||||
var _mergeWith2 = _interopRequireDefault(_mergeWith);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = exports["default"];
|
||||
23
build/node_modules/babel-core/lib/helpers/normalize-ast.js
generated
vendored
Normal file
23
build/node_modules/babel-core/lib/helpers/normalize-ast.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
exports.default = function (ast, comments, tokens) {
|
||||
if (ast) {
|
||||
if (ast.type === "Program") {
|
||||
return t.file(ast, comments || [], tokens || []);
|
||||
} else if (ast.type === "File") {
|
||||
return ast;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Not a valid ast?");
|
||||
};
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
module.exports = exports["default"];
|
||||
17
build/node_modules/babel-core/lib/helpers/resolve-from-possible-names.js
generated
vendored
Normal file
17
build/node_modules/babel-core/lib/helpers/resolve-from-possible-names.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = resolveFromPossibleNames;
|
||||
|
||||
var _resolve = require("./resolve");
|
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function resolveFromPossibleNames(possibleNames, dirname) {
|
||||
return possibleNames.reduce(function (accum, curr) {
|
||||
return accum || (0, _resolve2.default)(curr, dirname);
|
||||
}, null);
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
21
build/node_modules/babel-core/lib/helpers/resolve-plugin.js
generated
vendored
Normal file
21
build/node_modules/babel-core/lib/helpers/resolve-plugin.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = resolvePlugin;
|
||||
|
||||
var _resolveFromPossibleNames = require("./resolve-from-possible-names");
|
||||
|
||||
var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
|
||||
|
||||
var _getPossiblePluginNames = require("./get-possible-plugin-names");
|
||||
|
||||
var _getPossiblePluginNames2 = _interopRequireDefault(_getPossiblePluginNames);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function resolvePlugin(pluginName) {
|
||||
var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
|
||||
|
||||
return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePluginNames2.default)(pluginName), dirname);
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
21
build/node_modules/babel-core/lib/helpers/resolve-preset.js
generated
vendored
Normal file
21
build/node_modules/babel-core/lib/helpers/resolve-preset.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = resolvePreset;
|
||||
|
||||
var _resolveFromPossibleNames = require("./resolve-from-possible-names");
|
||||
|
||||
var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
|
||||
|
||||
var _getPossiblePresetNames = require("./get-possible-preset-names");
|
||||
|
||||
var _getPossiblePresetNames2 = _interopRequireDefault(_getPossiblePresetNames);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function resolvePreset(presetName) {
|
||||
var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
|
||||
|
||||
return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePresetNames2.default)(presetName), dirname);
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
46
build/node_modules/babel-core/lib/helpers/resolve.js
generated
vendored
Normal file
46
build/node_modules/babel-core/lib/helpers/resolve.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _typeof2 = require("babel-runtime/helpers/typeof");
|
||||
|
||||
var _typeof3 = _interopRequireDefault(_typeof2);
|
||||
|
||||
exports.default = function (loc) {
|
||||
var relative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
|
||||
|
||||
if ((typeof _module2.default === "undefined" ? "undefined" : (0, _typeof3.default)(_module2.default)) === "object") return null;
|
||||
|
||||
var relativeMod = relativeModules[relative];
|
||||
|
||||
if (!relativeMod) {
|
||||
relativeMod = new _module2.default();
|
||||
|
||||
var filename = _path2.default.join(relative, ".babelrc");
|
||||
relativeMod.id = filename;
|
||||
relativeMod.filename = filename;
|
||||
|
||||
relativeMod.paths = _module2.default._nodeModulePaths(relative);
|
||||
relativeModules[relative] = relativeMod;
|
||||
}
|
||||
|
||||
try {
|
||||
return _module2.default._resolveFilename(loc, relativeMod);
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
var _module = require("module");
|
||||
|
||||
var _module2 = _interopRequireDefault(_module);
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var relativeModules = {};
|
||||
|
||||
module.exports = exports["default"];
|
||||
55
build/node_modules/babel-core/lib/store.js
generated
vendored
Normal file
55
build/node_modules/babel-core/lib/store.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _map = require("babel-runtime/core-js/map");
|
||||
|
||||
var _map2 = _interopRequireDefault(_map);
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require("babel-runtime/helpers/inherits");
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var Store = function (_Map) {
|
||||
(0, _inherits3.default)(Store, _Map);
|
||||
|
||||
function Store() {
|
||||
(0, _classCallCheck3.default)(this, Store);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this));
|
||||
|
||||
_this.dynamicData = {};
|
||||
return _this;
|
||||
}
|
||||
|
||||
Store.prototype.setDynamic = function setDynamic(key, fn) {
|
||||
this.dynamicData[key] = fn;
|
||||
};
|
||||
|
||||
Store.prototype.get = function get(key) {
|
||||
if (this.has(key)) {
|
||||
return _Map.prototype.get.call(this, key);
|
||||
} else {
|
||||
if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) {
|
||||
var val = this.dynamicData[key]();
|
||||
this.set(key, val);
|
||||
return val;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Store;
|
||||
}(_map2.default);
|
||||
|
||||
exports.default = Store;
|
||||
module.exports = exports["default"];
|
||||
101
build/node_modules/babel-core/lib/tools/build-external-helpers.js
generated
vendored
Normal file
101
build/node_modules/babel-core/lib/tools/build-external-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
exports.default = function (whitelist) {
|
||||
var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "global";
|
||||
|
||||
var namespace = t.identifier("babelHelpers");
|
||||
|
||||
var builder = function builder(body) {
|
||||
return buildHelpers(body, namespace, whitelist);
|
||||
};
|
||||
|
||||
var tree = void 0;
|
||||
|
||||
var build = {
|
||||
global: buildGlobal,
|
||||
umd: buildUmd,
|
||||
var: buildVar
|
||||
}[outputType];
|
||||
|
||||
if (build) {
|
||||
tree = build(namespace, builder);
|
||||
} else {
|
||||
throw new Error(messages.get("unsupportedOutputType", outputType));
|
||||
}
|
||||
|
||||
return (0, _babelGenerator2.default)(tree).code;
|
||||
};
|
||||
|
||||
var _babelHelpers = require("babel-helpers");
|
||||
|
||||
var helpers = _interopRequireWildcard(_babelHelpers);
|
||||
|
||||
var _babelGenerator = require("babel-generator");
|
||||
|
||||
var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
|
||||
|
||||
var _babelMessages = require("babel-messages");
|
||||
|
||||
var messages = _interopRequireWildcard(_babelMessages);
|
||||
|
||||
var _babelTemplate = require("babel-template");
|
||||
|
||||
var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
var buildUmdWrapper = (0, _babelTemplate2.default)("\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n");
|
||||
|
||||
function buildGlobal(namespace, builder) {
|
||||
var body = [];
|
||||
var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));
|
||||
var tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]);
|
||||
|
||||
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])))]));
|
||||
|
||||
builder(body);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
function buildUmd(namespace, builder) {
|
||||
var body = [];
|
||||
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))]));
|
||||
|
||||
builder(body);
|
||||
|
||||
return t.program([buildUmdWrapper({
|
||||
FACTORY_PARAMETERS: t.identifier("global"),
|
||||
BROWSER_ARGUMENTS: t.assignmentExpression("=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression([])),
|
||||
COMMON_ARGUMENTS: t.identifier("exports"),
|
||||
AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]),
|
||||
FACTORY_BODY: body,
|
||||
UMD_ROOT: t.identifier("this")
|
||||
})]);
|
||||
}
|
||||
|
||||
function buildVar(namespace, builder) {
|
||||
var body = [];
|
||||
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression([]))]));
|
||||
builder(body);
|
||||
body.push(t.expressionStatement(namespace));
|
||||
return t.program(body);
|
||||
}
|
||||
|
||||
function buildHelpers(body, namespace, whitelist) {
|
||||
helpers.list.forEach(function (name) {
|
||||
if (whitelist && whitelist.indexOf(name) < 0) return;
|
||||
|
||||
var key = t.identifier(name);
|
||||
body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name))));
|
||||
});
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
737
build/node_modules/babel-core/lib/transformation/file/index.js
generated
vendored
Normal file
737
build/node_modules/babel-core/lib/transformation/file/index.js
generated
vendored
Normal file
@@ -0,0 +1,737 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.File = undefined;
|
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
||||
|
||||
var _create = require("babel-runtime/core-js/object/create");
|
||||
|
||||
var _create2 = _interopRequireDefault(_create);
|
||||
|
||||
var _assign = require("babel-runtime/core-js/object/assign");
|
||||
|
||||
var _assign2 = _interopRequireDefault(_assign);
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require("babel-runtime/helpers/inherits");
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _babelHelpers = require("babel-helpers");
|
||||
|
||||
var _babelHelpers2 = _interopRequireDefault(_babelHelpers);
|
||||
|
||||
var _metadata = require("./metadata");
|
||||
|
||||
var metadataVisitor = _interopRequireWildcard(_metadata);
|
||||
|
||||
var _convertSourceMap = require("convert-source-map");
|
||||
|
||||
var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap);
|
||||
|
||||
var _optionManager = require("./options/option-manager");
|
||||
|
||||
var _optionManager2 = _interopRequireDefault(_optionManager);
|
||||
|
||||
var _pluginPass = require("../plugin-pass");
|
||||
|
||||
var _pluginPass2 = _interopRequireDefault(_pluginPass);
|
||||
|
||||
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);
|
||||
|
||||
var _babelCodeFrame = require("babel-code-frame");
|
||||
|
||||
var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
|
||||
|
||||
var _defaults = require("lodash/defaults");
|
||||
|
||||
var _defaults2 = _interopRequireDefault(_defaults);
|
||||
|
||||
var _logger = require("./logger");
|
||||
|
||||
var _logger2 = _interopRequireDefault(_logger);
|
||||
|
||||
var _store = require("../../store");
|
||||
|
||||
var _store2 = _interopRequireDefault(_store);
|
||||
|
||||
var _babylon = require("babylon");
|
||||
|
||||
var _util = require("../../util");
|
||||
|
||||
var util = _interopRequireWildcard(_util);
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
var _resolve = require("../../helpers/resolve");
|
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve);
|
||||
|
||||
var _blockHoist = require("../internal-plugins/block-hoist");
|
||||
|
||||
var _blockHoist2 = _interopRequireDefault(_blockHoist);
|
||||
|
||||
var _shadowFunctions = require("../internal-plugins/shadow-functions");
|
||||
|
||||
var _shadowFunctions2 = _interopRequireDefault(_shadowFunctions);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var shebangRegex = /^#!.*/;
|
||||
|
||||
var INTERNAL_PLUGINS = [[_blockHoist2.default], [_shadowFunctions2.default]];
|
||||
|
||||
var errorVisitor = {
|
||||
enter: function enter(path, state) {
|
||||
var loc = path.node.loc;
|
||||
if (loc) {
|
||||
state.loc = loc;
|
||||
path.stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var File = function (_Store) {
|
||||
(0, _inherits3.default)(File, _Store);
|
||||
|
||||
function File() {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var pipeline = arguments[1];
|
||||
(0, _classCallCheck3.default)(this, File);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
|
||||
|
||||
_this.pipeline = pipeline;
|
||||
|
||||
_this.log = new _logger2.default(_this, opts.filename || "unknown");
|
||||
_this.opts = _this.initOptions(opts);
|
||||
|
||||
_this.parserOpts = {
|
||||
sourceType: _this.opts.sourceType,
|
||||
sourceFileName: _this.opts.filename,
|
||||
plugins: []
|
||||
};
|
||||
|
||||
_this.pluginVisitors = [];
|
||||
_this.pluginPasses = [];
|
||||
|
||||
_this.buildPluginsForOptions(_this.opts);
|
||||
|
||||
if (_this.opts.passPerPreset) {
|
||||
_this.perPresetOpts = [];
|
||||
_this.opts.presets.forEach(function (presetOpts) {
|
||||
var perPresetOpts = (0, _assign2.default)((0, _create2.default)(_this.opts), presetOpts);
|
||||
_this.perPresetOpts.push(perPresetOpts);
|
||||
_this.buildPluginsForOptions(perPresetOpts);
|
||||
});
|
||||
}
|
||||
|
||||
_this.metadata = {
|
||||
usedHelpers: [],
|
||||
marked: [],
|
||||
modules: {
|
||||
imports: [],
|
||||
exports: {
|
||||
exported: [],
|
||||
specifiers: []
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_this.dynamicImportTypes = {};
|
||||
_this.dynamicImportIds = {};
|
||||
_this.dynamicImports = [];
|
||||
_this.declarations = {};
|
||||
_this.usedHelpers = {};
|
||||
|
||||
_this.path = null;
|
||||
_this.ast = {};
|
||||
|
||||
_this.code = "";
|
||||
_this.shebang = "";
|
||||
|
||||
_this.hub = new _babelTraverse.Hub(_this);
|
||||
return _this;
|
||||
}
|
||||
|
||||
File.prototype.getMetadata = function getMetadata() {
|
||||
var has = false;
|
||||
for (var _iterator = this.ast.program.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var node = _ref;
|
||||
|
||||
if (t.isModuleDeclaration(node)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (has) {
|
||||
this.path.traverse(metadataVisitor, this);
|
||||
}
|
||||
};
|
||||
|
||||
File.prototype.initOptions = function initOptions(opts) {
|
||||
opts = new _optionManager2.default(this.log, this.pipeline).init(opts);
|
||||
|
||||
if (opts.inputSourceMap) {
|
||||
opts.sourceMaps = true;
|
||||
}
|
||||
|
||||
if (opts.moduleId) {
|
||||
opts.moduleIds = true;
|
||||
}
|
||||
|
||||
opts.basename = _path2.default.basename(opts.filename, _path2.default.extname(opts.filename));
|
||||
|
||||
opts.ignore = util.arrayify(opts.ignore, util.regexify);
|
||||
|
||||
if (opts.only) opts.only = util.arrayify(opts.only, util.regexify);
|
||||
|
||||
(0, _defaults2.default)(opts, {
|
||||
moduleRoot: opts.sourceRoot
|
||||
});
|
||||
|
||||
(0, _defaults2.default)(opts, {
|
||||
sourceRoot: opts.moduleRoot
|
||||
});
|
||||
|
||||
(0, _defaults2.default)(opts, {
|
||||
filenameRelative: opts.filename
|
||||
});
|
||||
|
||||
var basenameRelative = _path2.default.basename(opts.filenameRelative);
|
||||
|
||||
(0, _defaults2.default)(opts, {
|
||||
sourceFileName: basenameRelative,
|
||||
sourceMapTarget: basenameRelative
|
||||
});
|
||||
|
||||
return opts;
|
||||
};
|
||||
|
||||
File.prototype.buildPluginsForOptions = function buildPluginsForOptions(opts) {
|
||||
if (!Array.isArray(opts.plugins)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var plugins = opts.plugins.concat(INTERNAL_PLUGINS);
|
||||
var currentPluginVisitors = [];
|
||||
var currentPluginPasses = [];
|
||||
|
||||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var ref = _ref2;
|
||||
var plugin = ref[0],
|
||||
pluginOpts = ref[1];
|
||||
|
||||
|
||||
currentPluginVisitors.push(plugin.visitor);
|
||||
currentPluginPasses.push(new _pluginPass2.default(this, plugin, pluginOpts));
|
||||
|
||||
if (plugin.manipulateOptions) {
|
||||
plugin.manipulateOptions(opts, this.parserOpts, this);
|
||||
}
|
||||
}
|
||||
|
||||
this.pluginVisitors.push(currentPluginVisitors);
|
||||
this.pluginPasses.push(currentPluginPasses);
|
||||
};
|
||||
|
||||
File.prototype.getModuleName = function getModuleName() {
|
||||
var opts = this.opts;
|
||||
if (!opts.moduleIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (opts.moduleId != null && !opts.getModuleId) {
|
||||
return opts.moduleId;
|
||||
}
|
||||
|
||||
var filenameRelative = opts.filenameRelative;
|
||||
var moduleName = "";
|
||||
|
||||
if (opts.moduleRoot != null) {
|
||||
moduleName = opts.moduleRoot + "/";
|
||||
}
|
||||
|
||||
if (!opts.filenameRelative) {
|
||||
return moduleName + opts.filename.replace(/^\//, "");
|
||||
}
|
||||
|
||||
if (opts.sourceRoot != null) {
|
||||
var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?");
|
||||
filenameRelative = filenameRelative.replace(sourceRootRegEx, "");
|
||||
}
|
||||
|
||||
filenameRelative = filenameRelative.replace(/\.(\w*?)$/, "");
|
||||
|
||||
moduleName += filenameRelative;
|
||||
|
||||
moduleName = moduleName.replace(/\\/g, "/");
|
||||
|
||||
if (opts.getModuleId) {
|
||||
return opts.getModuleId(moduleName) || moduleName;
|
||||
} else {
|
||||
return moduleName;
|
||||
}
|
||||
};
|
||||
|
||||
File.prototype.resolveModuleSource = function resolveModuleSource(source) {
|
||||
var resolveModuleSource = this.opts.resolveModuleSource;
|
||||
if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename);
|
||||
return source;
|
||||
};
|
||||
|
||||
File.prototype.addImport = function addImport(source, imported) {
|
||||
var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : imported;
|
||||
|
||||
var alias = source + ":" + imported;
|
||||
var id = this.dynamicImportIds[alias];
|
||||
|
||||
if (!id) {
|
||||
source = this.resolveModuleSource(source);
|
||||
id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name);
|
||||
|
||||
var specifiers = [];
|
||||
|
||||
if (imported === "*") {
|
||||
specifiers.push(t.importNamespaceSpecifier(id));
|
||||
} else if (imported === "default") {
|
||||
specifiers.push(t.importDefaultSpecifier(id));
|
||||
} else {
|
||||
specifiers.push(t.importSpecifier(id, t.identifier(imported)));
|
||||
}
|
||||
|
||||
var declar = t.importDeclaration(specifiers, t.stringLiteral(source));
|
||||
declar._blockHoist = 3;
|
||||
|
||||
this.path.unshiftContainer("body", declar);
|
||||
}
|
||||
|
||||
return id;
|
||||
};
|
||||
|
||||
File.prototype.addHelper = function addHelper(name) {
|
||||
var declar = this.declarations[name];
|
||||
if (declar) return declar;
|
||||
|
||||
if (!this.usedHelpers[name]) {
|
||||
this.metadata.usedHelpers.push(name);
|
||||
this.usedHelpers[name] = true;
|
||||
}
|
||||
|
||||
var generator = this.get("helperGenerator");
|
||||
var runtime = this.get("helpersNamespace");
|
||||
if (generator) {
|
||||
var res = generator(name);
|
||||
if (res) return res;
|
||||
} else if (runtime) {
|
||||
return t.memberExpression(runtime, t.identifier(name));
|
||||
}
|
||||
|
||||
var ref = (0, _babelHelpers2.default)(name);
|
||||
var uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
|
||||
|
||||
if (t.isFunctionExpression(ref) && !ref.id) {
|
||||
ref.body._compact = true;
|
||||
ref._generated = true;
|
||||
ref.id = uid;
|
||||
ref.type = "FunctionDeclaration";
|
||||
this.path.unshiftContainer("body", ref);
|
||||
} else {
|
||||
ref._compact = true;
|
||||
this.scope.push({
|
||||
id: uid,
|
||||
init: ref,
|
||||
unique: true
|
||||
});
|
||||
}
|
||||
|
||||
return uid;
|
||||
};
|
||||
|
||||
File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) {
|
||||
var stringIds = raw.elements.map(function (string) {
|
||||
return string.value;
|
||||
});
|
||||
var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(",");
|
||||
|
||||
var declar = this.declarations[name];
|
||||
if (declar) return declar;
|
||||
|
||||
var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject");
|
||||
|
||||
var helperId = this.addHelper(helperName);
|
||||
var init = t.callExpression(helperId, [strings, raw]);
|
||||
init._compact = true;
|
||||
this.scope.push({
|
||||
id: uid,
|
||||
init: init,
|
||||
_blockHoist: 1.9 });
|
||||
return uid;
|
||||
};
|
||||
|
||||
File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) {
|
||||
var Error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SyntaxError;
|
||||
|
||||
var loc = node && (node.loc || node._loc);
|
||||
|
||||
var err = new Error(msg);
|
||||
|
||||
if (loc) {
|
||||
err.loc = loc.start;
|
||||
} else {
|
||||
(0, _babelTraverse2.default)(node, errorVisitor, this.scope, err);
|
||||
|
||||
err.message += " (This is an error on an internal node. Probably an internal error";
|
||||
|
||||
if (err.loc) {
|
||||
err.message += ". Location has been estimated.";
|
||||
}
|
||||
|
||||
err.message += ")";
|
||||
}
|
||||
|
||||
return err;
|
||||
};
|
||||
|
||||
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;
|
||||
} else {
|
||||
return map;
|
||||
}
|
||||
};
|
||||
|
||||
File.prototype.parse = function parse(code) {
|
||||
var parseCode = _babylon.parse;
|
||||
var parserOpts = this.opts.parserOpts;
|
||||
|
||||
if (parserOpts) {
|
||||
parserOpts = (0, _assign2.default)({}, this.parserOpts, parserOpts);
|
||||
|
||||
if (parserOpts.parser) {
|
||||
if (typeof parserOpts.parser === "string") {
|
||||
var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
|
||||
var parser = (0, _resolve2.default)(parserOpts.parser, dirname);
|
||||
if (parser) {
|
||||
parseCode = require(parser).parse;
|
||||
} else {
|
||||
throw new Error("Couldn't find parser " + parserOpts.parser + " with \"parse\" method " + ("relative to directory " + dirname));
|
||||
}
|
||||
} else {
|
||||
parseCode = parserOpts.parser;
|
||||
}
|
||||
|
||||
parserOpts.parser = {
|
||||
parse: function parse(source) {
|
||||
return (0, _babylon.parse)(source, parserOpts);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
this.log.debug("Parse start");
|
||||
var ast = parseCode(code, parserOpts || this.parserOpts);
|
||||
this.log.debug("Parse stop");
|
||||
return ast;
|
||||
};
|
||||
|
||||
File.prototype._addAst = function _addAst(ast) {
|
||||
this.path = _babelTraverse.NodePath.get({
|
||||
hub: this.hub,
|
||||
parentPath: null,
|
||||
parent: ast,
|
||||
container: ast,
|
||||
key: "program"
|
||||
}).setContext();
|
||||
this.scope = this.path.scope;
|
||||
this.ast = ast;
|
||||
this.getMetadata();
|
||||
};
|
||||
|
||||
File.prototype.addAst = function addAst(ast) {
|
||||
this.log.debug("Start set AST");
|
||||
this._addAst(ast);
|
||||
this.log.debug("End set AST");
|
||||
};
|
||||
|
||||
File.prototype.transform = function transform() {
|
||||
for (var i = 0; i < this.pluginPasses.length; i++) {
|
||||
var pluginPasses = this.pluginPasses[i];
|
||||
this.call("pre", pluginPasses);
|
||||
this.log.debug("Start transform traverse");
|
||||
|
||||
var visitor = _babelTraverse2.default.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod);
|
||||
(0, _babelTraverse2.default)(this.ast, visitor, this.scope);
|
||||
|
||||
this.log.debug("End transform traverse");
|
||||
this.call("post", pluginPasses);
|
||||
}
|
||||
|
||||
return this.generate();
|
||||
};
|
||||
|
||||
File.prototype.wrap = function wrap(code, callback) {
|
||||
code = code + "";
|
||||
|
||||
try {
|
||||
if (this.shouldIgnore()) {
|
||||
return this.makeResult({ code: code, ignored: true });
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
} catch (err) {
|
||||
if (err._babel) {
|
||||
throw err;
|
||||
} else {
|
||||
err._babel = true;
|
||||
}
|
||||
|
||||
var message = err.message = this.opts.filename + ": " + err.message;
|
||||
|
||||
var loc = err.loc;
|
||||
if (loc) {
|
||||
err.codeFrame = (0, _babelCodeFrame2.default)(code, loc.line, loc.column + 1, this.opts);
|
||||
message += "\n" + err.codeFrame;
|
||||
}
|
||||
|
||||
if (process.browser) {
|
||||
err.message = message;
|
||||
}
|
||||
|
||||
if (err.stack) {
|
||||
var newStack = err.stack.replace(err.message, message);
|
||||
err.stack = newStack;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
File.prototype.addCode = function addCode(code) {
|
||||
code = (code || "") + "";
|
||||
code = this.parseInputSourceMap(code);
|
||||
this.code = code;
|
||||
};
|
||||
|
||||
File.prototype.parseCode = function parseCode() {
|
||||
this.parseShebang();
|
||||
var ast = this.parse(this.code);
|
||||
this.addAst(ast);
|
||||
};
|
||||
|
||||
File.prototype.shouldIgnore = function shouldIgnore() {
|
||||
var opts = this.opts;
|
||||
return util.shouldIgnore(opts.filename, opts.ignore, opts.only);
|
||||
};
|
||||
|
||||
File.prototype.call = function call(key, pluginPasses) {
|
||||
for (var _iterator3 = pluginPasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
|
||||
var _ref3;
|
||||
|
||||
if (_isArray3) {
|
||||
if (_i3 >= _iterator3.length) break;
|
||||
_ref3 = _iterator3[_i3++];
|
||||
} else {
|
||||
_i3 = _iterator3.next();
|
||||
if (_i3.done) break;
|
||||
_ref3 = _i3.value;
|
||||
}
|
||||
|
||||
var pass = _ref3;
|
||||
|
||||
var plugin = pass.plugin;
|
||||
var fn = plugin[key];
|
||||
if (fn) fn.call(pass, this);
|
||||
}
|
||||
};
|
||||
|
||||
File.prototype.parseInputSourceMap = function parseInputSourceMap(code) {
|
||||
var opts = this.opts;
|
||||
|
||||
if (opts.inputSourceMap !== false) {
|
||||
var inputMap = _convertSourceMap2.default.fromSource(code);
|
||||
if (inputMap) {
|
||||
opts.inputSourceMap = inputMap.toObject();
|
||||
code = _convertSourceMap2.default.removeComments(code);
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
};
|
||||
|
||||
File.prototype.parseShebang = function parseShebang() {
|
||||
var shebangMatch = shebangRegex.exec(this.code);
|
||||
if (shebangMatch) {
|
||||
this.shebang = shebangMatch[0];
|
||||
this.code = this.code.replace(shebangRegex, "");
|
||||
}
|
||||
};
|
||||
|
||||
File.prototype.makeResult = function makeResult(_ref4) {
|
||||
var code = _ref4.code,
|
||||
map = _ref4.map,
|
||||
ast = _ref4.ast,
|
||||
ignored = _ref4.ignored;
|
||||
|
||||
var result = {
|
||||
metadata: null,
|
||||
options: this.opts,
|
||||
ignored: !!ignored,
|
||||
code: null,
|
||||
ast: null,
|
||||
map: map || null
|
||||
};
|
||||
|
||||
if (this.opts.code) {
|
||||
result.code = code;
|
||||
}
|
||||
|
||||
if (this.opts.ast) {
|
||||
result.ast = ast;
|
||||
}
|
||||
|
||||
if (this.opts.metadata) {
|
||||
result.metadata = this.metadata;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
File.prototype.generate = function generate() {
|
||||
var opts = this.opts;
|
||||
var ast = this.ast;
|
||||
|
||||
var result = { ast: ast };
|
||||
if (!opts.code) return this.makeResult(result);
|
||||
|
||||
var gen = _babelGenerator2.default;
|
||||
if (opts.generatorOpts.generator) {
|
||||
gen = opts.generatorOpts.generator;
|
||||
|
||||
if (typeof gen === "string") {
|
||||
var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
|
||||
var generator = (0, _resolve2.default)(gen, dirname);
|
||||
if (generator) {
|
||||
gen = require(generator).print;
|
||||
} else {
|
||||
throw new Error("Couldn't find generator " + gen + " with \"print\" method relative " + ("to directory " + dirname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.log.debug("Generation start");
|
||||
|
||||
var _result = gen(ast, opts.generatorOpts ? (0, _assign2.default)(opts, opts.generatorOpts) : opts, this.code);
|
||||
result.code = _result.code;
|
||||
result.map = _result.map;
|
||||
|
||||
this.log.debug("Generation end");
|
||||
|
||||
if (this.shebang) {
|
||||
result.code = this.shebang + "\n" + result.code;
|
||||
}
|
||||
|
||||
if (result.map) {
|
||||
result.map = this.mergeSourceMap(result.map);
|
||||
}
|
||||
|
||||
if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
|
||||
result.code += "\n" + _convertSourceMap2.default.fromObject(result.map).toComment();
|
||||
}
|
||||
|
||||
if (opts.sourceMaps === "inline") {
|
||||
result.map = null;
|
||||
}
|
||||
|
||||
return this.makeResult(result);
|
||||
};
|
||||
|
||||
return File;
|
||||
}(_store2.default);
|
||||
|
||||
exports.default = File;
|
||||
exports.File = File;
|
||||
72
build/node_modules/babel-core/lib/transformation/file/logger.js
generated
vendored
Normal file
72
build/node_modules/babel-core/lib/transformation/file/logger.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _node = require("debug/node");
|
||||
|
||||
var _node2 = _interopRequireDefault(_node);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var verboseDebug = (0, _node2.default)("babel:verbose");
|
||||
var generalDebug = (0, _node2.default)("babel");
|
||||
|
||||
var seenDeprecatedMessages = [];
|
||||
|
||||
var Logger = function () {
|
||||
function Logger(file, filename) {
|
||||
(0, _classCallCheck3.default)(this, Logger);
|
||||
|
||||
this.filename = filename;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
Logger.prototype._buildMessage = function _buildMessage(msg) {
|
||||
var parts = "[BABEL] " + this.filename;
|
||||
if (msg) parts += ": " + msg;
|
||||
return parts;
|
||||
};
|
||||
|
||||
Logger.prototype.warn = function warn(msg) {
|
||||
console.warn(this._buildMessage(msg));
|
||||
};
|
||||
|
||||
Logger.prototype.error = function error(msg) {
|
||||
var Constructor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;
|
||||
|
||||
throw new Constructor(this._buildMessage(msg));
|
||||
};
|
||||
|
||||
Logger.prototype.deprecate = function deprecate(msg) {
|
||||
if (this.file.opts && this.file.opts.suppressDeprecationMessages) return;
|
||||
|
||||
msg = this._buildMessage(msg);
|
||||
|
||||
if (seenDeprecatedMessages.indexOf(msg) >= 0) return;
|
||||
|
||||
seenDeprecatedMessages.push(msg);
|
||||
|
||||
console.error(msg);
|
||||
};
|
||||
|
||||
Logger.prototype.verbose = function verbose(msg) {
|
||||
if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg));
|
||||
};
|
||||
|
||||
Logger.prototype.debug = function debug(msg) {
|
||||
if (generalDebug.enabled) generalDebug(this._buildMessage(msg));
|
||||
};
|
||||
|
||||
Logger.prototype.deopt = function deopt(node, msg) {
|
||||
this.debug(msg);
|
||||
};
|
||||
|
||||
return Logger;
|
||||
}();
|
||||
|
||||
exports.default = Logger;
|
||||
module.exports = exports["default"];
|
||||
178
build/node_modules/babel-core/lib/transformation/file/metadata.js
generated
vendored
Normal file
178
build/node_modules/babel-core/lib/transformation/file/metadata.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.ImportDeclaration = exports.ModuleDeclaration = undefined;
|
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
||||
|
||||
exports.ExportDeclaration = ExportDeclaration;
|
||||
exports.Scope = Scope;
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ModuleDeclaration = exports.ModuleDeclaration = {
|
||||
enter: function enter(path, file) {
|
||||
var node = path.node;
|
||||
|
||||
if (node.source) {
|
||||
node.source.value = file.resolveModuleSource(node.source.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var ImportDeclaration = exports.ImportDeclaration = {
|
||||
exit: function exit(path, file) {
|
||||
var node = path.node;
|
||||
|
||||
|
||||
var specifiers = [];
|
||||
var imported = [];
|
||||
file.metadata.modules.imports.push({
|
||||
source: node.source.value,
|
||||
imported: imported,
|
||||
specifiers: specifiers
|
||||
});
|
||||
|
||||
for (var _iterator = path.get("specifiers"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var specifier = _ref;
|
||||
|
||||
var local = specifier.node.local.name;
|
||||
|
||||
if (specifier.isImportDefaultSpecifier()) {
|
||||
imported.push("default");
|
||||
specifiers.push({
|
||||
kind: "named",
|
||||
imported: "default",
|
||||
local: local
|
||||
});
|
||||
}
|
||||
|
||||
if (specifier.isImportSpecifier()) {
|
||||
var importedName = specifier.node.imported.name;
|
||||
imported.push(importedName);
|
||||
specifiers.push({
|
||||
kind: "named",
|
||||
imported: importedName,
|
||||
local: local
|
||||
});
|
||||
}
|
||||
|
||||
if (specifier.isImportNamespaceSpecifier()) {
|
||||
imported.push("*");
|
||||
specifiers.push({
|
||||
kind: "namespace",
|
||||
local: local
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function ExportDeclaration(path, file) {
|
||||
var node = path.node;
|
||||
|
||||
|
||||
var source = node.source ? node.source.value : null;
|
||||
var exports = file.metadata.modules.exports;
|
||||
|
||||
var declar = path.get("declaration");
|
||||
if (declar.isStatement()) {
|
||||
var bindings = declar.getBindingIdentifiers();
|
||||
|
||||
for (var name in bindings) {
|
||||
exports.exported.push(name);
|
||||
exports.specifiers.push({
|
||||
kind: "local",
|
||||
local: name,
|
||||
exported: path.isExportDefaultDeclaration() ? "default" : name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (path.isExportNamedDeclaration() && node.specifiers) {
|
||||
for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var specifier = _ref2;
|
||||
|
||||
var exported = specifier.exported.name;
|
||||
exports.exported.push(exported);
|
||||
|
||||
if (t.isExportDefaultSpecifier(specifier)) {
|
||||
exports.specifiers.push({
|
||||
kind: "external",
|
||||
local: exported,
|
||||
exported: exported,
|
||||
source: source
|
||||
});
|
||||
}
|
||||
|
||||
if (t.isExportNamespaceSpecifier(specifier)) {
|
||||
exports.specifiers.push({
|
||||
kind: "external-namespace",
|
||||
exported: exported,
|
||||
source: source
|
||||
});
|
||||
}
|
||||
|
||||
var local = specifier.local;
|
||||
if (!local) continue;
|
||||
|
||||
if (source) {
|
||||
exports.specifiers.push({
|
||||
kind: "external",
|
||||
local: local.name,
|
||||
exported: exported,
|
||||
source: source
|
||||
});
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
exports.specifiers.push({
|
||||
kind: "local",
|
||||
local: local.name,
|
||||
exported: exported
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (path.isExportAllDeclaration()) {
|
||||
exports.specifiers.push({
|
||||
kind: "external-all",
|
||||
source: source
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function Scope(path) {
|
||||
path.skip();
|
||||
}
|
||||
215
build/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js
generated
vendored
Normal file
215
build/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js
generated
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _assign = require("babel-runtime/core-js/object/assign");
|
||||
|
||||
var _assign2 = _interopRequireDefault(_assign);
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
exports.default = buildConfigChain;
|
||||
|
||||
var _resolve = require("../../../helpers/resolve");
|
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve);
|
||||
|
||||
var _json = require("json5");
|
||||
|
||||
var _json2 = _interopRequireDefault(_json);
|
||||
|
||||
var _pathIsAbsolute = require("path-is-absolute");
|
||||
|
||||
var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute);
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _fs = require("fs");
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var existsCache = {};
|
||||
var jsonCache = {};
|
||||
|
||||
var BABELIGNORE_FILENAME = ".babelignore";
|
||||
var BABELRC_FILENAME = ".babelrc";
|
||||
var PACKAGE_FILENAME = "package.json";
|
||||
|
||||
function exists(filename) {
|
||||
var cached = existsCache[filename];
|
||||
if (cached == null) {
|
||||
return existsCache[filename] = _fs2.default.existsSync(filename);
|
||||
} else {
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
|
||||
function buildConfigChain() {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var log = arguments[1];
|
||||
|
||||
var filename = opts.filename;
|
||||
var builder = new ConfigChainBuilder(log);
|
||||
|
||||
if (opts.babelrc !== false) {
|
||||
builder.findConfigs(filename);
|
||||
}
|
||||
|
||||
builder.mergeConfig({
|
||||
options: opts,
|
||||
alias: "base",
|
||||
dirname: filename && _path2.default.dirname(filename)
|
||||
});
|
||||
|
||||
return builder.configs;
|
||||
}
|
||||
|
||||
var ConfigChainBuilder = function () {
|
||||
function ConfigChainBuilder(log) {
|
||||
(0, _classCallCheck3.default)(this, ConfigChainBuilder);
|
||||
|
||||
this.resolvedConfigs = [];
|
||||
this.configs = [];
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
ConfigChainBuilder.prototype.findConfigs = function findConfigs(loc) {
|
||||
if (!loc) return;
|
||||
|
||||
if (!(0, _pathIsAbsolute2.default)(loc)) {
|
||||
loc = _path2.default.join(process.cwd(), loc);
|
||||
}
|
||||
|
||||
var foundConfig = false;
|
||||
var foundIgnore = false;
|
||||
|
||||
while (loc !== (loc = _path2.default.dirname(loc))) {
|
||||
if (!foundConfig) {
|
||||
var configLoc = _path2.default.join(loc, BABELRC_FILENAME);
|
||||
if (exists(configLoc)) {
|
||||
this.addConfig(configLoc);
|
||||
foundConfig = true;
|
||||
}
|
||||
|
||||
var pkgLoc = _path2.default.join(loc, PACKAGE_FILENAME);
|
||||
if (!foundConfig && exists(pkgLoc)) {
|
||||
foundConfig = this.addConfig(pkgLoc, "babel", JSON);
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundIgnore) {
|
||||
var ignoreLoc = _path2.default.join(loc, BABELIGNORE_FILENAME);
|
||||
if (exists(ignoreLoc)) {
|
||||
this.addIgnoreConfig(ignoreLoc);
|
||||
foundIgnore = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundIgnore && foundConfig) return;
|
||||
}
|
||||
};
|
||||
|
||||
ConfigChainBuilder.prototype.addIgnoreConfig = function addIgnoreConfig(loc) {
|
||||
var file = _fs2.default.readFileSync(loc, "utf8");
|
||||
var lines = file.split("\n");
|
||||
|
||||
lines = lines.map(function (line) {
|
||||
return line.replace(/#(.*?)$/, "").trim();
|
||||
}).filter(function (line) {
|
||||
return !!line;
|
||||
});
|
||||
|
||||
if (lines.length) {
|
||||
this.mergeConfig({
|
||||
options: { ignore: lines },
|
||||
alias: loc,
|
||||
dirname: _path2.default.dirname(loc)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ConfigChainBuilder.prototype.addConfig = function addConfig(loc, key) {
|
||||
var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _json2.default;
|
||||
|
||||
if (this.resolvedConfigs.indexOf(loc) >= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.resolvedConfigs.push(loc);
|
||||
|
||||
var content = _fs2.default.readFileSync(loc, "utf8");
|
||||
var options = void 0;
|
||||
|
||||
try {
|
||||
options = jsonCache[content] = jsonCache[content] || json.parse(content);
|
||||
if (key) options = options[key];
|
||||
} catch (err) {
|
||||
err.message = loc + ": Error while parsing JSON - " + err.message;
|
||||
throw err;
|
||||
}
|
||||
|
||||
this.mergeConfig({
|
||||
options: options,
|
||||
alias: loc,
|
||||
dirname: _path2.default.dirname(loc)
|
||||
});
|
||||
|
||||
return !!options;
|
||||
};
|
||||
|
||||
ConfigChainBuilder.prototype.mergeConfig = function mergeConfig(_ref) {
|
||||
var options = _ref.options,
|
||||
alias = _ref.alias,
|
||||
loc = _ref.loc,
|
||||
dirname = _ref.dirname;
|
||||
|
||||
if (!options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
options = (0, _assign2.default)({}, options);
|
||||
|
||||
dirname = dirname || process.cwd();
|
||||
loc = loc || alias;
|
||||
|
||||
if (options.extends) {
|
||||
var extendsLoc = (0, _resolve2.default)(options.extends, dirname);
|
||||
if (extendsLoc) {
|
||||
this.addConfig(extendsLoc);
|
||||
} else {
|
||||
if (this.log) this.log.error("Couldn't resolve extends clause of " + options.extends + " in " + alias);
|
||||
}
|
||||
delete options.extends;
|
||||
}
|
||||
|
||||
this.configs.push({
|
||||
options: options,
|
||||
alias: alias,
|
||||
loc: loc,
|
||||
dirname: dirname
|
||||
});
|
||||
|
||||
var envOpts = void 0;
|
||||
var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development";
|
||||
if (options.env) {
|
||||
envOpts = options.env[envKey];
|
||||
delete options.env;
|
||||
}
|
||||
|
||||
this.mergeConfig({
|
||||
options: envOpts,
|
||||
alias: alias + ".env." + envKey,
|
||||
dirname: dirname
|
||||
});
|
||||
};
|
||||
|
||||
return ConfigChainBuilder;
|
||||
}();
|
||||
|
||||
module.exports = exports["default"];
|
||||
211
build/node_modules/babel-core/lib/transformation/file/options/config.js
generated
vendored
Normal file
211
build/node_modules/babel-core/lib/transformation/file/options/config.js
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
filename: {
|
||||
type: "filename",
|
||||
description: "filename to use when reading from stdin - this will be used in source-maps, errors etc",
|
||||
default: "unknown",
|
||||
shorthand: "f"
|
||||
},
|
||||
|
||||
filenameRelative: {
|
||||
hidden: true,
|
||||
type: "string"
|
||||
},
|
||||
|
||||
inputSourceMap: {
|
||||
hidden: true
|
||||
},
|
||||
|
||||
env: {
|
||||
hidden: true,
|
||||
default: {}
|
||||
},
|
||||
|
||||
mode: {
|
||||
description: "",
|
||||
hidden: true
|
||||
},
|
||||
|
||||
retainLines: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
description: "retain line numbers - will result in really ugly code"
|
||||
},
|
||||
|
||||
highlightCode: {
|
||||
description: "enable/disable ANSI syntax highlighting of code frames (on by default)",
|
||||
type: "boolean",
|
||||
default: true
|
||||
},
|
||||
|
||||
suppressDeprecationMessages: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
hidden: true
|
||||
},
|
||||
|
||||
presets: {
|
||||
type: "list",
|
||||
description: "",
|
||||
default: []
|
||||
},
|
||||
|
||||
plugins: {
|
||||
type: "list",
|
||||
default: [],
|
||||
description: ""
|
||||
},
|
||||
|
||||
ignore: {
|
||||
type: "list",
|
||||
description: "list of glob paths to **not** compile",
|
||||
default: []
|
||||
},
|
||||
|
||||
only: {
|
||||
type: "list",
|
||||
description: "list of glob paths to **only** compile"
|
||||
},
|
||||
|
||||
code: {
|
||||
hidden: true,
|
||||
default: true,
|
||||
type: "boolean"
|
||||
},
|
||||
|
||||
metadata: {
|
||||
hidden: true,
|
||||
default: true,
|
||||
type: "boolean"
|
||||
},
|
||||
|
||||
ast: {
|
||||
hidden: true,
|
||||
default: true,
|
||||
type: "boolean"
|
||||
},
|
||||
|
||||
extends: {
|
||||
type: "string",
|
||||
hidden: true
|
||||
},
|
||||
|
||||
comments: {
|
||||
type: "boolean",
|
||||
default: true,
|
||||
description: "write comments to generated output (true by default)"
|
||||
},
|
||||
|
||||
shouldPrintComment: {
|
||||
hidden: true,
|
||||
description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"
|
||||
},
|
||||
|
||||
wrapPluginVisitorMethod: {
|
||||
hidden: true,
|
||||
description: "optional callback to wrap all visitor methods"
|
||||
},
|
||||
|
||||
compact: {
|
||||
type: "booleanString",
|
||||
default: "auto",
|
||||
description: "do not include superfluous whitespace characters and line terminators [true|false|auto]"
|
||||
},
|
||||
|
||||
minified: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
description: "save as much bytes when printing [true|false]"
|
||||
},
|
||||
|
||||
sourceMap: {
|
||||
alias: "sourceMaps",
|
||||
hidden: true
|
||||
},
|
||||
|
||||
sourceMaps: {
|
||||
type: "booleanString",
|
||||
description: "[true|false|inline]",
|
||||
default: false,
|
||||
shorthand: "s"
|
||||
},
|
||||
|
||||
sourceMapTarget: {
|
||||
type: "string",
|
||||
description: "set `file` on returned source map"
|
||||
},
|
||||
|
||||
sourceFileName: {
|
||||
type: "string",
|
||||
description: "set `sources[0]` on returned source map"
|
||||
},
|
||||
|
||||
sourceRoot: {
|
||||
type: "filename",
|
||||
description: "the root from which all sources are relative"
|
||||
},
|
||||
|
||||
babelrc: {
|
||||
description: "Whether or not to look up .babelrc and .babelignore files",
|
||||
type: "boolean",
|
||||
default: true
|
||||
},
|
||||
|
||||
sourceType: {
|
||||
description: "",
|
||||
default: "module"
|
||||
},
|
||||
|
||||
auxiliaryCommentBefore: {
|
||||
type: "string",
|
||||
description: "print a comment before any injected non-user code"
|
||||
},
|
||||
|
||||
auxiliaryCommentAfter: {
|
||||
type: "string",
|
||||
description: "print a comment after any injected non-user code"
|
||||
},
|
||||
|
||||
resolveModuleSource: {
|
||||
hidden: true
|
||||
},
|
||||
|
||||
getModuleId: {
|
||||
hidden: true
|
||||
},
|
||||
|
||||
moduleRoot: {
|
||||
type: "filename",
|
||||
description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"
|
||||
},
|
||||
|
||||
moduleIds: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
shorthand: "M",
|
||||
description: "insert an explicit id for modules"
|
||||
},
|
||||
|
||||
moduleId: {
|
||||
description: "specify a custom name for module ids",
|
||||
type: "string"
|
||||
},
|
||||
|
||||
passPerPreset: {
|
||||
description: "Whether to spawn a traversal pass per a preset. By default all presets are merged.",
|
||||
type: "boolean",
|
||||
default: false,
|
||||
hidden: true
|
||||
},
|
||||
|
||||
parserOpts: {
|
||||
description: "Options to pass into the parser, or to change parsers (parserOpts.parser)",
|
||||
default: false
|
||||
},
|
||||
|
||||
generatorOpts: {
|
||||
description: "Options to pass into the generator, or to change generators (generatorOpts.generator)",
|
||||
default: false
|
||||
}
|
||||
};
|
||||
38
build/node_modules/babel-core/lib/transformation/file/options/index.js
generated
vendored
Normal file
38
build/node_modules/babel-core/lib/transformation/file/options/index.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.config = undefined;
|
||||
exports.normaliseOptions = normaliseOptions;
|
||||
|
||||
var _parsers = require("./parsers");
|
||||
|
||||
var parsers = _interopRequireWildcard(_parsers);
|
||||
|
||||
var _config = require("./config");
|
||||
|
||||
var _config2 = _interopRequireDefault(_config);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
exports.config = _config2.default;
|
||||
function normaliseOptions() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
for (var key in options) {
|
||||
var val = options[key];
|
||||
if (val == null) continue;
|
||||
|
||||
var opt = _config2.default[key];
|
||||
if (opt && opt.alias) opt = _config2.default[opt.alias];
|
||||
if (!opt) continue;
|
||||
|
||||
var parser = parsers[opt.type];
|
||||
if (parser) val = parser(val);
|
||||
|
||||
options[key] = val;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
383
build/node_modules/babel-core/lib/transformation/file/options/option-manager.js
generated
vendored
Normal file
383
build/node_modules/babel-core/lib/transformation/file/options/option-manager.js
generated
vendored
Normal file
@@ -0,0 +1,383 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
|
||||
var _stringify = require("babel-runtime/core-js/json/stringify");
|
||||
|
||||
var _stringify2 = _interopRequireDefault(_stringify);
|
||||
|
||||
var _assign = require("babel-runtime/core-js/object/assign");
|
||||
|
||||
var _assign2 = _interopRequireDefault(_assign);
|
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
||||
|
||||
var _typeof2 = require("babel-runtime/helpers/typeof");
|
||||
|
||||
var _typeof3 = _interopRequireDefault(_typeof2);
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _node = require("../../../api/node");
|
||||
|
||||
var context = _interopRequireWildcard(_node);
|
||||
|
||||
var _plugin2 = require("../../plugin");
|
||||
|
||||
var _plugin3 = _interopRequireDefault(_plugin2);
|
||||
|
||||
var _babelMessages = require("babel-messages");
|
||||
|
||||
var messages = _interopRequireWildcard(_babelMessages);
|
||||
|
||||
var _index = require("./index");
|
||||
|
||||
var _resolvePlugin = require("../../../helpers/resolve-plugin");
|
||||
|
||||
var _resolvePlugin2 = _interopRequireDefault(_resolvePlugin);
|
||||
|
||||
var _resolvePreset = require("../../../helpers/resolve-preset");
|
||||
|
||||
var _resolvePreset2 = _interopRequireDefault(_resolvePreset);
|
||||
|
||||
var _cloneDeepWith = require("lodash/cloneDeepWith");
|
||||
|
||||
var _cloneDeepWith2 = _interopRequireDefault(_cloneDeepWith);
|
||||
|
||||
var _clone = require("lodash/clone");
|
||||
|
||||
var _clone2 = _interopRequireDefault(_clone);
|
||||
|
||||
var _merge = require("../../../helpers/merge");
|
||||
|
||||
var _merge2 = _interopRequireDefault(_merge);
|
||||
|
||||
var _config2 = require("./config");
|
||||
|
||||
var _config3 = _interopRequireDefault(_config2);
|
||||
|
||||
var _removed = require("./removed");
|
||||
|
||||
var _removed2 = _interopRequireDefault(_removed);
|
||||
|
||||
var _buildConfigChain = require("./build-config-chain");
|
||||
|
||||
var _buildConfigChain2 = _interopRequireDefault(_buildConfigChain);
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var OptionManager = function () {
|
||||
function OptionManager(log) {
|
||||
(0, _classCallCheck3.default)(this, OptionManager);
|
||||
|
||||
this.resolvedConfigs = [];
|
||||
this.options = OptionManager.createBareOptions();
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
OptionManager.memoisePluginContainer = function memoisePluginContainer(fn, loc, i, alias) {
|
||||
for (var _iterator = OptionManager.memoisedPlugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var cache = _ref;
|
||||
|
||||
if (cache.container === fn) return cache.plugin;
|
||||
}
|
||||
|
||||
var obj = void 0;
|
||||
|
||||
if (typeof fn === "function") {
|
||||
obj = fn(context);
|
||||
} else {
|
||||
obj = fn;
|
||||
}
|
||||
|
||||
if ((typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) === "object") {
|
||||
var _plugin = new _plugin3.default(obj, alias);
|
||||
OptionManager.memoisedPlugins.push({
|
||||
container: fn,
|
||||
plugin: _plugin
|
||||
});
|
||||
return _plugin;
|
||||
} else {
|
||||
throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) + loc + i);
|
||||
}
|
||||
};
|
||||
|
||||
OptionManager.createBareOptions = function createBareOptions() {
|
||||
var opts = {};
|
||||
|
||||
for (var _key in _config3.default) {
|
||||
var opt = _config3.default[_key];
|
||||
opts[_key] = (0, _clone2.default)(opt.default);
|
||||
}
|
||||
|
||||
return opts;
|
||||
};
|
||||
|
||||
OptionManager.normalisePlugin = function normalisePlugin(plugin, loc, i, alias) {
|
||||
plugin = plugin.__esModule ? plugin.default : plugin;
|
||||
|
||||
if (!(plugin instanceof _plugin3.default)) {
|
||||
if (typeof plugin === "function" || (typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)) === "object") {
|
||||
plugin = OptionManager.memoisePluginContainer(plugin, loc, i, alias);
|
||||
} else {
|
||||
throw new TypeError(messages.get("pluginNotFunction", loc, i, typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)));
|
||||
}
|
||||
}
|
||||
|
||||
plugin.init(loc, i);
|
||||
|
||||
return plugin;
|
||||
};
|
||||
|
||||
OptionManager.normalisePlugins = function normalisePlugins(loc, dirname, plugins) {
|
||||
return plugins.map(function (val, i) {
|
||||
var plugin = void 0,
|
||||
options = void 0;
|
||||
|
||||
if (!val) {
|
||||
throw new TypeError("Falsy value found in plugins");
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
plugin = val[0];
|
||||
options = val[1];
|
||||
} else {
|
||||
plugin = val;
|
||||
}
|
||||
|
||||
var alias = typeof plugin === "string" ? plugin : loc + "$" + i;
|
||||
|
||||
if (typeof plugin === "string") {
|
||||
var pluginLoc = (0, _resolvePlugin2.default)(plugin, dirname);
|
||||
if (pluginLoc) {
|
||||
plugin = require(pluginLoc);
|
||||
} else {
|
||||
throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
|
||||
}
|
||||
}
|
||||
|
||||
plugin = OptionManager.normalisePlugin(plugin, loc, i, alias);
|
||||
|
||||
return [plugin, options];
|
||||
});
|
||||
};
|
||||
|
||||
OptionManager.prototype.mergeOptions = function mergeOptions(_ref2) {
|
||||
var _this = this;
|
||||
|
||||
var rawOpts = _ref2.options,
|
||||
extendingOpts = _ref2.extending,
|
||||
alias = _ref2.alias,
|
||||
loc = _ref2.loc,
|
||||
dirname = _ref2.dirname;
|
||||
|
||||
alias = alias || "foreign";
|
||||
if (!rawOpts) return;
|
||||
|
||||
if ((typeof rawOpts === "undefined" ? "undefined" : (0, _typeof3.default)(rawOpts)) !== "object" || Array.isArray(rawOpts)) {
|
||||
this.log.error("Invalid options type for " + alias, TypeError);
|
||||
}
|
||||
|
||||
var opts = (0, _cloneDeepWith2.default)(rawOpts, function (val) {
|
||||
if (val instanceof _plugin3.default) {
|
||||
return val;
|
||||
}
|
||||
});
|
||||
|
||||
dirname = dirname || process.cwd();
|
||||
loc = loc || alias;
|
||||
|
||||
for (var _key2 in opts) {
|
||||
var option = _config3.default[_key2];
|
||||
|
||||
if (!option && this.log) {
|
||||
if (_removed2.default[_key2]) {
|
||||
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.";
|
||||
|
||||
|
||||
this.log.error(unknownOptErr + "\n\n" + presetConfigErr, ReferenceError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(0, _index.normaliseOptions)(opts);
|
||||
|
||||
if (opts.plugins) {
|
||||
opts.plugins = OptionManager.normalisePlugins(loc, dirname, opts.plugins);
|
||||
}
|
||||
|
||||
if (opts.presets) {
|
||||
if (opts.passPerPreset) {
|
||||
opts.presets = this.resolvePresets(opts.presets, dirname, function (preset, presetLoc) {
|
||||
_this.mergeOptions({
|
||||
options: preset,
|
||||
extending: preset,
|
||||
alias: presetLoc,
|
||||
loc: presetLoc,
|
||||
dirname: dirname
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.mergePresets(opts.presets, dirname);
|
||||
delete opts.presets;
|
||||
}
|
||||
}
|
||||
|
||||
if (rawOpts === extendingOpts) {
|
||||
(0, _assign2.default)(extendingOpts, opts);
|
||||
} else {
|
||||
(0, _merge2.default)(extendingOpts || this.options, opts);
|
||||
}
|
||||
};
|
||||
|
||||
OptionManager.prototype.mergePresets = function mergePresets(presets, dirname) {
|
||||
var _this2 = this;
|
||||
|
||||
this.resolvePresets(presets, dirname, function (presetOpts, presetLoc) {
|
||||
_this2.mergeOptions({
|
||||
options: presetOpts,
|
||||
alias: presetLoc,
|
||||
loc: presetLoc,
|
||||
dirname: _path2.default.dirname(presetLoc || "")
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
OptionManager.prototype.resolvePresets = function resolvePresets(presets, dirname, onResolve) {
|
||||
return presets.map(function (val) {
|
||||
var options = void 0;
|
||||
if (Array.isArray(val)) {
|
||||
if (val.length > 2) {
|
||||
throw new Error("Unexpected extra options " + (0, _stringify2.default)(val.slice(2)) + " passed to preset.");
|
||||
}
|
||||
|
||||
var _val = val;
|
||||
val = _val[0];
|
||||
options = _val[1];
|
||||
}
|
||||
|
||||
var presetLoc = void 0;
|
||||
try {
|
||||
if (typeof val === "string") {
|
||||
presetLoc = (0, _resolvePreset2.default)(val, dirname);
|
||||
|
||||
if (!presetLoc) {
|
||||
throw new Error("Couldn't find preset " + (0, _stringify2.default)(val) + " relative to directory " + (0, _stringify2.default)(dirname));
|
||||
}
|
||||
|
||||
val = require(presetLoc);
|
||||
}
|
||||
|
||||
if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.__esModule) {
|
||||
if (val.default) {
|
||||
val = val.default;
|
||||
} else {
|
||||
var _val2 = val,
|
||||
__esModule = _val2.__esModule,
|
||||
rest = (0, _objectWithoutProperties3.default)(_val2, ["__esModule"]);
|
||||
|
||||
val = rest;
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.buildPreset) val = val.buildPreset;
|
||||
|
||||
if (typeof val !== "function" && options !== undefined) {
|
||||
throw new Error("Options " + (0, _stringify2.default)(options) + " passed to " + (presetLoc || "a preset") + " which does not accept options.");
|
||||
}
|
||||
|
||||
if (typeof val === "function") val = val(context, options, { dirname: dirname });
|
||||
|
||||
if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) !== "object") {
|
||||
throw new Error("Unsupported preset format: " + val + ".");
|
||||
}
|
||||
|
||||
onResolve && onResolve(val, presetLoc);
|
||||
} catch (e) {
|
||||
if (presetLoc) {
|
||||
e.message += " (While processing preset: " + (0, _stringify2.default)(presetLoc) + ")";
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return val;
|
||||
});
|
||||
};
|
||||
|
||||
OptionManager.prototype.normaliseOptions = function normaliseOptions() {
|
||||
var opts = this.options;
|
||||
|
||||
for (var _key3 in _config3.default) {
|
||||
var option = _config3.default[_key3];
|
||||
var val = opts[_key3];
|
||||
|
||||
if (!val && option.optional) continue;
|
||||
|
||||
if (option.alias) {
|
||||
opts[option.alias] = opts[option.alias] || val;
|
||||
} else {
|
||||
opts[_key3] = val;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
OptionManager.prototype.init = function init() {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
for (var _iterator2 = (0, _buildConfigChain2.default)(opts, this.log), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
|
||||
var _ref3;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref3 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref3 = _i2.value;
|
||||
}
|
||||
|
||||
var _config = _ref3;
|
||||
|
||||
this.mergeOptions(_config);
|
||||
}
|
||||
|
||||
this.normaliseOptions(opts);
|
||||
|
||||
return this.options;
|
||||
};
|
||||
|
||||
return OptionManager;
|
||||
}();
|
||||
|
||||
exports.default = OptionManager;
|
||||
|
||||
|
||||
OptionManager.memoisedPlugins = [];
|
||||
module.exports = exports["default"];
|
||||
33
build/node_modules/babel-core/lib/transformation/file/options/parsers.js
generated
vendored
Normal file
33
build/node_modules/babel-core/lib/transformation/file/options/parsers.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.filename = undefined;
|
||||
exports.boolean = boolean;
|
||||
exports.booleanString = booleanString;
|
||||
exports.list = list;
|
||||
|
||||
var _slash = require("slash");
|
||||
|
||||
var _slash2 = _interopRequireDefault(_slash);
|
||||
|
||||
var _util = require("../../../util");
|
||||
|
||||
var util = _interopRequireWildcard(_util);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var filename = exports.filename = _slash2.default;
|
||||
|
||||
function boolean(val) {
|
||||
return !!val;
|
||||
}
|
||||
|
||||
function booleanString(val) {
|
||||
return util.booleanify(val);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return util.list(val);
|
||||
}
|
||||
50
build/node_modules/babel-core/lib/transformation/file/options/removed.js
generated
vendored
Normal file
50
build/node_modules/babel-core/lib/transformation/file/options/removed.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"auxiliaryComment": {
|
||||
"message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
|
||||
},
|
||||
"blacklist": {
|
||||
"message": "Put the specific transforms you want in the `plugins` option"
|
||||
},
|
||||
"breakConfig": {
|
||||
"message": "This is not a necessary option in Babel 6"
|
||||
},
|
||||
"experimental": {
|
||||
"message": "Put the specific transforms you want in the `plugins` option"
|
||||
},
|
||||
"externalHelpers": {
|
||||
"message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"
|
||||
},
|
||||
"extra": {
|
||||
"message": ""
|
||||
},
|
||||
"jsxPragma": {
|
||||
"message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
|
||||
},
|
||||
|
||||
"loose": {
|
||||
"message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."
|
||||
},
|
||||
"metadataUsedHelpers": {
|
||||
"message": "Not required anymore as this is enabled by default"
|
||||
},
|
||||
"modules": {
|
||||
"message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"
|
||||
},
|
||||
"nonStandard": {
|
||||
"message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
|
||||
},
|
||||
"optional": {
|
||||
"message": "Put the specific transforms you want in the `plugins` option"
|
||||
},
|
||||
"sourceMapName": {
|
||||
"message": "Use the `sourceMapTarget` option"
|
||||
},
|
||||
"stage": {
|
||||
"message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
|
||||
},
|
||||
"whitelist": {
|
||||
"message": "Put the specific transforms you want in the `plugins` option"
|
||||
}
|
||||
};
|
||||
45
build/node_modules/babel-core/lib/transformation/internal-plugins/block-hoist.js
generated
vendored
Normal file
45
build/node_modules/babel-core/lib/transformation/internal-plugins/block-hoist.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _plugin = require("../plugin");
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _sortBy = require("lodash/sortBy");
|
||||
|
||||
var _sortBy2 = _interopRequireDefault(_sortBy);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = new _plugin2.default({
|
||||
|
||||
name: "internal.blockHoist",
|
||||
|
||||
visitor: {
|
||||
Block: {
|
||||
exit: function exit(_ref) {
|
||||
var node = _ref.node;
|
||||
|
||||
var hasChange = false;
|
||||
for (var i = 0; i < node.body.length; i++) {
|
||||
var bodyNode = node.body[i];
|
||||
if (bodyNode && bodyNode._blockHoist != null) {
|
||||
hasChange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasChange) return;
|
||||
|
||||
node.body = (0, _sortBy2.default)(node.body, function (bodyNode) {
|
||||
var priority = bodyNode && bodyNode._blockHoist;
|
||||
if (priority == null) priority = 1;
|
||||
if (priority === true) priority = 2;
|
||||
|
||||
return -1 * priority;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
module.exports = exports["default"];
|
||||
132
build/node_modules/babel-core/lib/transformation/internal-plugins/shadow-functions.js
generated
vendored
Normal file
132
build/node_modules/babel-core/lib/transformation/internal-plugins/shadow-functions.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _symbol = require("babel-runtime/core-js/symbol");
|
||||
|
||||
var _symbol2 = _interopRequireDefault(_symbol);
|
||||
|
||||
var _plugin = require("../plugin");
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var SUPER_THIS_BOUND = (0, _symbol2.default)("super this bound");
|
||||
|
||||
var superVisitor = {
|
||||
CallExpression: function CallExpression(path) {
|
||||
if (!path.get("callee").isSuper()) return;
|
||||
|
||||
var node = path.node;
|
||||
|
||||
if (node[SUPER_THIS_BOUND]) return;
|
||||
node[SUPER_THIS_BOUND] = true;
|
||||
|
||||
path.replaceWith(t.assignmentExpression("=", this.id, node));
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = new _plugin2.default({
|
||||
name: "internal.shadowFunctions",
|
||||
|
||||
visitor: {
|
||||
ThisExpression: function ThisExpression(path) {
|
||||
remap(path, "this");
|
||||
},
|
||||
ReferencedIdentifier: function ReferencedIdentifier(path) {
|
||||
if (path.node.name === "arguments") {
|
||||
remap(path, "arguments");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function shouldShadow(path, shadowPath) {
|
||||
if (path.is("_forceShadow")) {
|
||||
return true;
|
||||
} else {
|
||||
return shadowPath;
|
||||
}
|
||||
}
|
||||
|
||||
function remap(path, key) {
|
||||
var shadowPath = path.inShadow(key);
|
||||
if (!shouldShadow(path, shadowPath)) return;
|
||||
|
||||
var shadowFunction = path.node._shadowedFunctionLiteral;
|
||||
|
||||
var currentFunction = void 0;
|
||||
var passedShadowFunction = false;
|
||||
|
||||
var fnPath = path.find(function (innerPath) {
|
||||
if (innerPath.parentPath && innerPath.parentPath.isClassProperty() && innerPath.key === "value") {
|
||||
return true;
|
||||
}
|
||||
if (path === innerPath) return false;
|
||||
if (innerPath.isProgram() || innerPath.isFunction()) {
|
||||
currentFunction = currentFunction || innerPath;
|
||||
}
|
||||
|
||||
if (innerPath.isProgram()) {
|
||||
passedShadowFunction = true;
|
||||
|
||||
return true;
|
||||
} else if (innerPath.isFunction() && !innerPath.isArrowFunctionExpression()) {
|
||||
if (shadowFunction) {
|
||||
if (innerPath === shadowFunction || innerPath.node === shadowFunction.node) return true;
|
||||
} else {
|
||||
if (!innerPath.is("shadow")) return true;
|
||||
}
|
||||
|
||||
passedShadowFunction = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()) {
|
||||
fnPath = path.findParent(function (p) {
|
||||
return p.isProgram() || p.isFunction();
|
||||
});
|
||||
}
|
||||
|
||||
if (fnPath === currentFunction) return;
|
||||
|
||||
if (!passedShadowFunction) return;
|
||||
|
||||
var cached = fnPath.getData(key);
|
||||
if (cached) return path.replaceWith(cached);
|
||||
|
||||
var id = path.scope.generateUidIdentifier(key);
|
||||
|
||||
fnPath.setData(key, id);
|
||||
|
||||
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 });
|
||||
|
||||
fnPath.traverse(superVisitor, { id: id });
|
||||
} else {
|
||||
var init = key === "this" ? t.thisExpression() : t.identifier(key);
|
||||
|
||||
if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction;
|
||||
|
||||
fnPath.scope.push({ id: id, init: init });
|
||||
}
|
||||
|
||||
return path.replaceWith(id);
|
||||
}
|
||||
module.exports = exports["default"];
|
||||
81
build/node_modules/babel-core/lib/transformation/pipeline.js
generated
vendored
Normal file
81
build/node_modules/babel-core/lib/transformation/pipeline.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _normalizeAst = require("../helpers/normalize-ast");
|
||||
|
||||
var _normalizeAst2 = _interopRequireDefault(_normalizeAst);
|
||||
|
||||
var _plugin = require("./plugin");
|
||||
|
||||
var _plugin2 = _interopRequireDefault(_plugin);
|
||||
|
||||
var _file = require("./file");
|
||||
|
||||
var _file2 = _interopRequireDefault(_file);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var Pipeline = function () {
|
||||
function Pipeline() {
|
||||
(0, _classCallCheck3.default)(this, Pipeline);
|
||||
}
|
||||
|
||||
Pipeline.prototype.lint = function lint(code) {
|
||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
opts.code = false;
|
||||
opts.mode = "lint";
|
||||
return this.transform(code, opts);
|
||||
};
|
||||
|
||||
Pipeline.prototype.pretransform = function pretransform(code, opts) {
|
||||
var file = new _file2.default(opts, this);
|
||||
return file.wrap(code, function () {
|
||||
file.addCode(code);
|
||||
file.parseCode(code);
|
||||
return file;
|
||||
});
|
||||
};
|
||||
|
||||
Pipeline.prototype.transform = function transform(code, opts) {
|
||||
var file = new _file2.default(opts, this);
|
||||
return file.wrap(code, function () {
|
||||
file.addCode(code);
|
||||
file.parseCode(code);
|
||||
return file.transform();
|
||||
});
|
||||
};
|
||||
|
||||
Pipeline.prototype.analyse = function analyse(code) {
|
||||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var visitor = arguments[2];
|
||||
|
||||
opts.code = false;
|
||||
if (visitor) {
|
||||
opts.plugins = opts.plugins || [];
|
||||
opts.plugins.push(new _plugin2.default({ visitor: visitor }));
|
||||
}
|
||||
return this.transform(code, opts).metadata;
|
||||
};
|
||||
|
||||
Pipeline.prototype.transformFromAst = function transformFromAst(ast, code, opts) {
|
||||
ast = (0, _normalizeAst2.default)(ast);
|
||||
|
||||
var file = new _file2.default(opts, this);
|
||||
return file.wrap(code, function () {
|
||||
file.addCode(code);
|
||||
file.addAst(ast);
|
||||
return file.transform();
|
||||
});
|
||||
};
|
||||
|
||||
return Pipeline;
|
||||
}();
|
||||
|
||||
exports.default = Pipeline;
|
||||
module.exports = exports["default"];
|
||||
71
build/node_modules/babel-core/lib/transformation/plugin-pass.js
generated
vendored
Normal file
71
build/node_modules/babel-core/lib/transformation/plugin-pass.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require("babel-runtime/helpers/inherits");
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _store = require("../store");
|
||||
|
||||
var _store2 = _interopRequireDefault(_store);
|
||||
|
||||
var _file5 = require("./file");
|
||||
|
||||
var _file6 = _interopRequireDefault(_file5);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var PluginPass = function (_Store) {
|
||||
(0, _inherits3.default)(PluginPass, _Store);
|
||||
|
||||
function PluginPass(file, plugin) {
|
||||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
(0, _classCallCheck3.default)(this, PluginPass);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
|
||||
|
||||
_this.plugin = plugin;
|
||||
_this.key = plugin.key;
|
||||
_this.file = file;
|
||||
_this.opts = options;
|
||||
return _this;
|
||||
}
|
||||
|
||||
PluginPass.prototype.addHelper = function addHelper() {
|
||||
var _file;
|
||||
|
||||
return (_file = this.file).addHelper.apply(_file, arguments);
|
||||
};
|
||||
|
||||
PluginPass.prototype.addImport = function addImport() {
|
||||
var _file2;
|
||||
|
||||
return (_file2 = this.file).addImport.apply(_file2, arguments);
|
||||
};
|
||||
|
||||
PluginPass.prototype.getModuleName = function getModuleName() {
|
||||
var _file3;
|
||||
|
||||
return (_file3 = this.file).getModuleName.apply(_file3, arguments);
|
||||
};
|
||||
|
||||
PluginPass.prototype.buildCodeFrameError = function buildCodeFrameError() {
|
||||
var _file4;
|
||||
|
||||
return (_file4 = this.file).buildCodeFrameError.apply(_file4, arguments);
|
||||
};
|
||||
|
||||
return PluginPass;
|
||||
}(_store2.default);
|
||||
|
||||
exports.default = PluginPass;
|
||||
module.exports = exports["default"];
|
||||
163
build/node_modules/babel-core/lib/transformation/plugin.js
generated
vendored
Normal file
163
build/node_modules/babel-core/lib/transformation/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
||||
|
||||
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require("babel-runtime/helpers/inherits");
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _optionManager = require("./file/options/option-manager");
|
||||
|
||||
var _optionManager2 = _interopRequireDefault(_optionManager);
|
||||
|
||||
var _babelMessages = require("babel-messages");
|
||||
|
||||
var messages = _interopRequireWildcard(_babelMessages);
|
||||
|
||||
var _store = require("../store");
|
||||
|
||||
var _store2 = _interopRequireDefault(_store);
|
||||
|
||||
var _babelTraverse = require("babel-traverse");
|
||||
|
||||
var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
|
||||
|
||||
var _assign = require("lodash/assign");
|
||||
|
||||
var _assign2 = _interopRequireDefault(_assign);
|
||||
|
||||
var _clone = require("lodash/clone");
|
||||
|
||||
var _clone2 = _interopRequireDefault(_clone);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var GLOBAL_VISITOR_PROPS = ["enter", "exit"];
|
||||
|
||||
var Plugin = function (_Store) {
|
||||
(0, _inherits3.default)(Plugin, _Store);
|
||||
|
||||
function Plugin(plugin, key) {
|
||||
(0, _classCallCheck3.default)(this, Plugin);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
|
||||
|
||||
_this.initialized = false;
|
||||
_this.raw = (0, _assign2.default)({}, plugin);
|
||||
_this.key = _this.take("name") || key;
|
||||
|
||||
_this.manipulateOptions = _this.take("manipulateOptions");
|
||||
_this.post = _this.take("post");
|
||||
_this.pre = _this.take("pre");
|
||||
_this.visitor = _this.normaliseVisitor((0, _clone2.default)(_this.take("visitor")) || {});
|
||||
return _this;
|
||||
}
|
||||
|
||||
Plugin.prototype.take = function take(key) {
|
||||
var val = this.raw[key];
|
||||
delete this.raw[key];
|
||||
return val;
|
||||
};
|
||||
|
||||
Plugin.prototype.chain = function chain(target, key) {
|
||||
if (!target[key]) return this[key];
|
||||
if (!this[key]) return target[key];
|
||||
|
||||
var fns = [target[key], this[key]];
|
||||
|
||||
return function () {
|
||||
var val = void 0;
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var fn = _ref;
|
||||
|
||||
if (fn) {
|
||||
var ret = fn.apply(this, args);
|
||||
if (ret != null) val = ret;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
};
|
||||
};
|
||||
|
||||
Plugin.prototype.maybeInherit = function maybeInherit(loc) {
|
||||
var inherits = this.take("inherits");
|
||||
if (!inherits) return;
|
||||
|
||||
inherits = _optionManager2.default.normalisePlugin(inherits, loc, "inherits");
|
||||
|
||||
this.manipulateOptions = this.chain(inherits, "manipulateOptions");
|
||||
this.post = this.chain(inherits, "post");
|
||||
this.pre = this.chain(inherits, "pre");
|
||||
this.visitor = _babelTraverse2.default.visitors.merge([inherits.visitor, this.visitor]);
|
||||
};
|
||||
|
||||
Plugin.prototype.init = function init(loc, i) {
|
||||
if (this.initialized) return;
|
||||
this.initialized = true;
|
||||
|
||||
this.maybeInherit(loc);
|
||||
|
||||
for (var key in this.raw) {
|
||||
throw new Error(messages.get("pluginInvalidProperty", loc, i, key));
|
||||
}
|
||||
};
|
||||
|
||||
Plugin.prototype.normaliseVisitor = function normaliseVisitor(visitor) {
|
||||
for (var _iterator2 = GLOBAL_VISITOR_PROPS, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var key = _ref2;
|
||||
|
||||
if (visitor[key]) {
|
||||
throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " + "Please target individual nodes.");
|
||||
}
|
||||
}
|
||||
|
||||
_babelTraverse2.default.explode(visitor);
|
||||
return visitor;
|
||||
};
|
||||
|
||||
return Plugin;
|
||||
}(_store2.default);
|
||||
|
||||
exports.default = Plugin;
|
||||
module.exports = exports["default"];
|
||||
184
build/node_modules/babel-core/lib/util.js
generated
vendored
Normal file
184
build/node_modules/babel-core/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.inspect = exports.inherits = undefined;
|
||||
|
||||
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
|
||||
|
||||
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
||||
|
||||
var _util = require("util");
|
||||
|
||||
Object.defineProperty(exports, "inherits", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _util.inherits;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "inspect", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _util.inspect;
|
||||
}
|
||||
});
|
||||
exports.canCompile = canCompile;
|
||||
exports.list = list;
|
||||
exports.regexify = regexify;
|
||||
exports.arrayify = arrayify;
|
||||
exports.booleanify = booleanify;
|
||||
exports.shouldIgnore = shouldIgnore;
|
||||
|
||||
var _escapeRegExp = require("lodash/escapeRegExp");
|
||||
|
||||
var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);
|
||||
|
||||
var _startsWith = require("lodash/startsWith");
|
||||
|
||||
var _startsWith2 = _interopRequireDefault(_startsWith);
|
||||
|
||||
var _minimatch = require("minimatch");
|
||||
|
||||
var _minimatch2 = _interopRequireDefault(_minimatch);
|
||||
|
||||
var _includes = require("lodash/includes");
|
||||
|
||||
var _includes2 = _interopRequireDefault(_includes);
|
||||
|
||||
var _isRegExp = require("lodash/isRegExp");
|
||||
|
||||
var _isRegExp2 = _interopRequireDefault(_isRegExp);
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _slash = require("slash");
|
||||
|
||||
var _slash2 = _interopRequireDefault(_slash);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function canCompile(filename, altExts) {
|
||||
var exts = altExts || canCompile.EXTENSIONS;
|
||||
var ext = _path2.default.extname(filename);
|
||||
return (0, _includes2.default)(exts, ext);
|
||||
}
|
||||
|
||||
canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"];
|
||||
|
||||
function list(val) {
|
||||
if (!val) {
|
||||
return [];
|
||||
} else if (Array.isArray(val)) {
|
||||
return val;
|
||||
} else if (typeof val === "string") {
|
||||
return val.split(",");
|
||||
} else {
|
||||
return [val];
|
||||
}
|
||||
}
|
||||
|
||||
function regexify(val) {
|
||||
if (!val) {
|
||||
return new RegExp(/.^/);
|
||||
}
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
val = new RegExp(val.map(_escapeRegExp2.default).join("|"), "i");
|
||||
}
|
||||
|
||||
if (typeof val === "string") {
|
||||
val = (0, _slash2.default)(val);
|
||||
|
||||
if ((0, _startsWith2.default)(val, "./") || (0, _startsWith2.default)(val, "*/")) val = val.slice(2);
|
||||
if ((0, _startsWith2.default)(val, "**/")) val = val.slice(3);
|
||||
|
||||
var regex = _minimatch2.default.makeRe(val, { nocase: true });
|
||||
return new RegExp(regex.source.slice(1, -1), "i");
|
||||
}
|
||||
|
||||
if ((0, _isRegExp2.default)(val)) {
|
||||
return val;
|
||||
}
|
||||
|
||||
throw new TypeError("illegal type for regexify");
|
||||
}
|
||||
|
||||
function arrayify(val, mapFn) {
|
||||
if (!val) return [];
|
||||
if (typeof val === "boolean") return arrayify([val], mapFn);
|
||||
if (typeof val === "string") return arrayify(list(val), mapFn);
|
||||
|
||||
if (Array.isArray(val)) {
|
||||
if (mapFn) val = val.map(mapFn);
|
||||
return val;
|
||||
}
|
||||
|
||||
return [val];
|
||||
}
|
||||
|
||||
function booleanify(val) {
|
||||
if (val === "true" || val == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (val === "false" || val == 0 || !val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function shouldIgnore(filename) {
|
||||
var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
||||
var only = arguments[2];
|
||||
|
||||
filename = filename.replace(/\\/g, "/");
|
||||
|
||||
if (only) {
|
||||
for (var _iterator = only, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var pattern = _ref;
|
||||
|
||||
if (_shouldIgnore(pattern, filename)) return false;
|
||||
}
|
||||
return true;
|
||||
} else if (ignore.length) {
|
||||
for (var _iterator2 = ignore, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var _pattern = _ref2;
|
||||
|
||||
if (_shouldIgnore(_pattern, filename)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _shouldIgnore(pattern, filename) {
|
||||
if (typeof pattern === "function") {
|
||||
return pattern(filename);
|
||||
} else {
|
||||
return pattern.test(filename);
|
||||
}
|
||||
}
|
||||
1
build/node_modules/babel-core/node_modules/.bin/json5
generated
vendored
Symbolic link
1
build/node_modules/babel-core/node_modules/.bin/json5
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../json5/lib/cli.js
|
||||
169
build/node_modules/babel-core/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
169
build/node_modules/babel-core/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]]
|
||||
|
||||
[c0.5.1]: https://github.com/aseemk/json5/tree/v0.5.1
|
||||
[d0.5.1]: https://github.com/aseemk/json5/compare/v0.5.0...v0.5.1
|
||||
|
||||
This release includes a minor fix for indentations when stringifying empty
|
||||
arrays.
|
||||
|
||||
- Fix: Indents no longer appear in empty arrays when stringified. ([#134])
|
||||
|
||||
|
||||
### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]]
|
||||
|
||||
[c0.5.0]: https://github.com/aseemk/json5/tree/v0.5.0
|
||||
[d0.5.0]: https://github.com/aseemk/json5/compare/v0.4.0...v0.5.0
|
||||
|
||||
This release includes major internal changes and public API enhancements.
|
||||
|
||||
- **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for
|
||||
Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12
|
||||
remain.
|
||||
|
||||
- Fix: YUI Compressor no longer fails when compressing json5.js. ([#97])
|
||||
|
||||
- New: `parse` and the CLI provide line and column numbers when displaying error
|
||||
messages. ([#101]; awesome work by [@amb26].)
|
||||
|
||||
|
||||
### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]]
|
||||
|
||||
[c0.4.0]: https://github.com/aseemk/json5/tree/v0.4.0
|
||||
[d0.4.0]: https://github.com/aseemk/json5/compare/v0.2.0...v0.4.0
|
||||
|
||||
Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0
|
||||
changelog entry includes v0.3.0 features.
|
||||
|
||||
This is a massive release that adds `stringify` support, among other things.
|
||||
|
||||
- **Major:** `JSON5.stringify()` now exists!
|
||||
This method is analogous to the native `JSON.stringify()`;
|
||||
it just avoids quoting keys where possible.
|
||||
See the [usage documentation](./README.md#usage) for more.
|
||||
([#32]; huge thanks and props [@aeisenberg]!)
|
||||
|
||||
- New: `NaN` and `-NaN` are now allowed number literals.
|
||||
([#30]; thanks [@rowanhill].)
|
||||
|
||||
- New: Duplicate object keys are now allowed; the last value is used.
|
||||
This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].)
|
||||
|
||||
- Fix: Properly handle various whitespace and newline cases now.
|
||||
E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings,
|
||||
and JSON5 now accepts the same whitespace as JSON (stricter than ES5).
|
||||
([#58], [#60], and [#63]; thanks [@jordanbtucker].)
|
||||
|
||||
- New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again.
|
||||
(They were disallowed in v0.2.0; see below.)
|
||||
It turns out they *are* valid in ES5, so JSON5 supports them now too.
|
||||
([#36]; thanks [@jordanbtucker]!)
|
||||
|
||||
|
||||
### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]]
|
||||
|
||||
[c0.2.0]: https://github.com/aseemk/json5/tree/v0.2.0
|
||||
[d0.2.0]: https://github.com/aseemk/json5/compare/v0.1.0...v0.2.0
|
||||
|
||||
This release fixes some bugs and adds some more utility features to help you
|
||||
express data more easily:
|
||||
|
||||
- **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now.
|
||||
While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid
|
||||
in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome
|
||||
and Node), so JSON5 officially rejects them now, too. ([#36])
|
||||
|
||||
- New: Trailing decimal points in decimal numbers are allowed again.
|
||||
(They were disallowed in v0.1.0; see below.)
|
||||
They're allowed by ES5, and differentiating between integers and floats may
|
||||
make sense on some platforms. ([#16]; thanks [@Midar].)
|
||||
|
||||
- New: `Infinity` and `-Infinity` are now allowed number literals.
|
||||
([#30]; thanks [@pepkin88].)
|
||||
|
||||
- New: Plus signs (`+`) in front of numbers are now allowed, since it can
|
||||
be helpful in some contexts to explicitly mark numbers as positive.
|
||||
(E.g. when a property represents changes or deltas.)
|
||||
|
||||
- Fix: unescaped newlines in strings are rejected now.
|
||||
([#24]; thanks [@Midar].)
|
||||
|
||||
|
||||
### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]]
|
||||
|
||||
[c0.1.0]: https://github.com/aseemk/json5/tree/v0.1.0
|
||||
[d0.1.0]: https://github.com/aseemk/json5/compare/v0.0.1...v0.1.0
|
||||
|
||||
This release tightens JSON5 support and adds helpful utility features:
|
||||
|
||||
- New: Support hexadecimal numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- Fix: Reject octal numbers properly now. Previously, they were accepted but
|
||||
improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a
|
||||
leading zero). These are disallowed by both JSON5 and JSON, as well as by
|
||||
ES5's strict mode. (Thanks [@MaxNanasy].)
|
||||
|
||||
- New: Support leading decimal points in decimal numbers.
|
||||
(Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject trailing decimal points in decimal numbers now. These
|
||||
are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject omitted elements in arrays now. These are disallowed by
|
||||
both JSON5 and JSON.
|
||||
|
||||
- Fix: Throw proper `SyntaxError` instances on errors now.
|
||||
|
||||
- New: Add Node.js `require()` hook. Register via `json5/lib/require`.
|
||||
|
||||
- New: Add Node.js `json5` executable to compile JSON5 files to JSON.
|
||||
|
||||
|
||||
### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]]
|
||||
|
||||
[c0.0.1]: https://github.com/aseemk/json5/tree/v0.0.1
|
||||
[d0.0.1]: https://github.com/aseemk/json5/compare/v0.0.0...v0.0.1
|
||||
|
||||
This was the first implementation of this JSON5 parser.
|
||||
|
||||
- Support unquoted object keys, including reserved words. Unicode characters
|
||||
and escape sequences sequences aren't yet supported.
|
||||
|
||||
- Support single-quoted strings.
|
||||
|
||||
- Support multi-line strings.
|
||||
|
||||
- Support trailing commas in arrays and objects.
|
||||
|
||||
- Support comments, both inline and block.
|
||||
|
||||
|
||||
### v0.0.0 [[code](https://github.com/aseemk/json5/tree/v0.0.0)]
|
||||
|
||||
Let's consider this to be Douglas Crockford's original [json_parse.js] — a
|
||||
parser for the regular JSON format.
|
||||
|
||||
|
||||
[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
[v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240
|
||||
|
||||
[@MaxNanasy]: https://github.com/MaxNanasy
|
||||
[@Midar]: https://github.com/Midar
|
||||
[@pepkin88]: https://github.com/pepkin88
|
||||
[@rowanhill]: https://github.com/rowanhill
|
||||
[@aeisenberg]: https://github.com/aeisenberg
|
||||
[@jordanbtucker]: https://github.com/jordanbtucker
|
||||
[@amb26]: https://github.com/amb26
|
||||
|
||||
[#16]: https://github.com/aseemk/json5/issues/16
|
||||
[#24]: https://github.com/aseemk/json5/issues/24
|
||||
[#30]: https://github.com/aseemk/json5/issues/30
|
||||
[#32]: https://github.com/aseemk/json5/issues/32
|
||||
[#36]: https://github.com/aseemk/json5/issues/36
|
||||
[#57]: https://github.com/aseemk/json5/issues/57
|
||||
[#58]: https://github.com/aseemk/json5/pull/58
|
||||
[#60]: https://github.com/aseemk/json5/pull/60
|
||||
[#63]: https://github.com/aseemk/json5/pull/63
|
||||
[#97]: https://github.com/aseemk/json5/pull/97
|
||||
[#101]: https://github.com/aseemk/json5/pull/101
|
||||
21
build/node_modules/babel-core/node_modules/json5/LICENSE.md
generated
vendored
Normal file
21
build/node_modules/babel-core/node_modules/json5/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012-2016 Aseem Kishore, and [others](https://github.com/aseemk/json5/contributors).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
286
build/node_modules/babel-core/node_modules/json5/README.md
generated
vendored
Normal file
286
build/node_modules/babel-core/node_modules/json5/README.md
generated
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
# JSON5 – Modern JSON
|
||||
|
||||
[](https://travis-ci.org/json5/json5)
|
||||
|
||||
JSON is an excellent data format, but we think it can be better.
|
||||
|
||||
**JSON5 is a proposed extension to JSON** that aims to make it easier for
|
||||
*humans to write and maintain* by hand. It does this by adding some minimal
|
||||
syntax features directly from ECMAScript 5.
|
||||
|
||||
JSON5 remains a **strict subset of JavaScript**, adds **no new data types**,
|
||||
and **works with all existing JSON content**.
|
||||
|
||||
JSON5 is *not* an official successor to JSON, and JSON5 content may *not*
|
||||
work with existing JSON parsers. For this reason, JSON5 files use a new .json5
|
||||
extension. *(TODO: new MIME type needed too.)*
|
||||
|
||||
The code here is a **reference JavaScript implementation** for both Node.js
|
||||
and all browsers. It’s based directly off of Douglas Crockford’s own [JSON
|
||||
implementation][json_parse.js], and it’s both robust and secure.
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
JSON isn’t the friendliest to *write*. Keys need to be quoted, objects and
|
||||
arrays can’t have trailing commas, and comments aren’t allowed — even though
|
||||
none of these are the case with regular JavaScript today.
|
||||
|
||||
That was fine when JSON’s goal was to be a great data format, but JSON’s usage
|
||||
has expanded beyond *machines*. JSON is now used for writing [configs][ex1],
|
||||
[manifests][ex2], even [tests][ex3] — all by *humans*.
|
||||
|
||||
[ex1]: http://plovr.com/docs.html
|
||||
[ex2]: https://www.npmjs.org/doc/files/package.json.html
|
||||
[ex3]: http://code.google.com/p/fuzztester/wiki/JSONFileFormat
|
||||
|
||||
There are other formats that are human-friendlier, like YAML, but changing
|
||||
from JSON to a completely different format is undesirable in many cases.
|
||||
JSON5’s aim is to remain close to JSON and JavaScript.
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
The following is the exact list of additions to JSON’s syntax introduced by
|
||||
JSON5. **All of these are optional**, and **all of these come from ES5**.
|
||||
|
||||
### Objects
|
||||
|
||||
- Object keys can be unquoted if they’re valid [identifiers][mdn_variables].
|
||||
Yes, even reserved keywords (like `default`) are valid unquoted keys in ES5
|
||||
[[§11.1.5](http://es5.github.com/#x11.1.5), [§7.6](http://es5.github.com/#x7.6)].
|
||||
([More info](https://mathiasbynens.be/notes/javascript-identifiers))
|
||||
|
||||
*(TODO: Unicode characters and escape sequences aren’t yet supported in this
|
||||
implementation.)*
|
||||
|
||||
- Object keys can also be single-quoted.
|
||||
|
||||
- Objects can have trailing commas.
|
||||
|
||||
[mdn_variables]: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables
|
||||
|
||||
### Arrays
|
||||
|
||||
- Arrays can have trailing commas.
|
||||
|
||||
### Strings
|
||||
|
||||
- Strings can be single-quoted.
|
||||
|
||||
- Strings can be split across multiple lines; just prefix each newline with a
|
||||
backslash. [ES5 [§7.8.4](http://es5.github.com/#x7.8.4)]
|
||||
|
||||
### Numbers
|
||||
|
||||
- Numbers can be hexadecimal (base 16).
|
||||
|
||||
- Numbers can begin or end with a (leading or trailing) decimal point.
|
||||
|
||||
- Numbers can include `Infinity`, `-Infinity`, `NaN`, and `-NaN`.
|
||||
|
||||
- Numbers can begin with an explicit plus sign.
|
||||
|
||||
### Comments
|
||||
|
||||
- Both inline (single-line) and block (multi-line) comments are allowed.
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
The following is a contrived example, but it illustrates most of the features:
|
||||
|
||||
```js
|
||||
{
|
||||
foo: 'bar',
|
||||
while: true,
|
||||
|
||||
this: 'is a \
|
||||
multi-line string',
|
||||
|
||||
// this is an inline comment
|
||||
here: 'is another', // inline comment
|
||||
|
||||
/* this is a block comment
|
||||
that continues on another line */
|
||||
|
||||
hex: 0xDEADbeef,
|
||||
half: .5,
|
||||
delta: +10,
|
||||
to: Infinity, // and beyond!
|
||||
|
||||
finally: 'a trailing comma',
|
||||
oh: [
|
||||
"we shouldn't forget",
|
||||
'arrays can have',
|
||||
'trailing commas too',
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
This implementation’s own [package.json5](package.json5) is more realistic:
|
||||
|
||||
```js
|
||||
// This file is written in JSON5 syntax, naturally, but npm needs a regular
|
||||
// JSON file, so compile via `npm run build`. Be sure to keep both in sync!
|
||||
|
||||
{
|
||||
name: 'json5',
|
||||
version: '0.5.0',
|
||||
description: 'JSON for the ES5 era.',
|
||||
keywords: ['json', 'es5'],
|
||||
author: 'Aseem Kishore <aseem.kishore@gmail.com>',
|
||||
contributors: [
|
||||
// TODO: Should we remove this section in favor of GitHub's list?
|
||||
// https://github.com/aseemk/json5/contributors
|
||||
'Max Nanasy <max.nanasy@gmail.com>',
|
||||
'Andrew Eisenberg <andrew@eisenberg.as>',
|
||||
'Jordan Tucker <jordanbtucker@gmail.com>',
|
||||
],
|
||||
main: 'lib/json5.js',
|
||||
bin: 'lib/cli.js',
|
||||
files: ["lib/"],
|
||||
dependencies: {},
|
||||
devDependencies: {
|
||||
gulp: "^3.9.1",
|
||||
'gulp-jshint': "^2.0.0",
|
||||
jshint: "^2.9.1",
|
||||
'jshint-stylish': "^2.1.0",
|
||||
mocha: "^2.4.5"
|
||||
},
|
||||
scripts: {
|
||||
build: 'node ./lib/cli.js -c package.json5',
|
||||
test: 'mocha --ui exports --reporter spec',
|
||||
// TODO: Would it be better to define these in a mocha.opts file?
|
||||
},
|
||||
homepage: 'http://json5.org/',
|
||||
license: 'MIT',
|
||||
repository: {
|
||||
type: 'git',
|
||||
url: 'https://github.com/aseemk/json5.git',
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Community
|
||||
|
||||
Join the [Google Group](http://groups.google.com/group/json5) if you’re
|
||||
interested in JSON5 news, updates, and general discussion.
|
||||
Don’t worry, it’s very low-traffic.
|
||||
|
||||
The [GitHub wiki](https://github.com/aseemk/json5/wiki) is a good place to track
|
||||
JSON5 support and usage. Contribute freely there!
|
||||
|
||||
[GitHub Issues](https://github.com/aseemk/json5/issues) is the place to
|
||||
formally propose feature requests and report bugs. Questions and general
|
||||
feedback are better directed at the Google Group.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
This JavaScript implementation of JSON5 simply provides a `JSON5` object just
|
||||
like the native ES5 `JSON` object.
|
||||
|
||||
To use from Node:
|
||||
|
||||
```sh
|
||||
npm install json5
|
||||
```
|
||||
|
||||
```js
|
||||
var JSON5 = require('json5');
|
||||
```
|
||||
|
||||
To use in the browser (adds the `JSON5` object to the global namespace):
|
||||
|
||||
```html
|
||||
<script src="json5.js"></script>
|
||||
```
|
||||
|
||||
Then in both cases, you can simply replace native `JSON` calls with `JSON5`:
|
||||
|
||||
```js
|
||||
var obj = JSON5.parse('{unquoted:"key",trailing:"comma",}');
|
||||
var str = JSON5.stringify(obj);
|
||||
```
|
||||
|
||||
`JSON5.parse` supports all of the JSON5 features listed above (*TODO: except
|
||||
Unicode*), as well as the native [`reviver` argument][json-parse].
|
||||
|
||||
[json-parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
|
||||
|
||||
`JSON5.stringify` mainly avoids quoting keys where possible, but we hope to
|
||||
keep expanding it in the future (e.g. to also output trailing commas).
|
||||
It supports the native [`replacer` and `space` arguments][json-stringify],
|
||||
as well. *(TODO: Any implemented `toJSON` methods aren’t used today.)*
|
||||
|
||||
[json-stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
|
||||
|
||||
|
||||
### Extras
|
||||
|
||||
If you’re running this on Node, you can also register a JSON5 `require()` hook
|
||||
to let you `require()` `.json5` files just like you can `.json` files:
|
||||
|
||||
```js
|
||||
require('json5/lib/require');
|
||||
require('./path/to/foo'); // tries foo.json5 after foo.js, foo.json, etc.
|
||||
require('./path/to/bar.json5');
|
||||
```
|
||||
|
||||
This module also provides a `json5` executable (requires Node) for converting
|
||||
JSON5 files to JSON:
|
||||
|
||||
```sh
|
||||
json5 -c path/to/foo.json5 # generates path/to/foo.json
|
||||
```
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
```sh
|
||||
git clone git://github.com/aseemk/json5.git
|
||||
cd json5
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
As the `package.json5` file states, be sure to run `npm run build` on changes
|
||||
to `package.json5`, since npm requires `package.json`.
|
||||
|
||||
Feel free to [file issues](https://github.com/aseemk/json5/issues) and submit
|
||||
[pull requests](https://github.com/aseemk/json5/pulls) — contributions are
|
||||
welcome. If you do submit a pull request, please be sure to add or update the
|
||||
tests, and ensure that `npm test` continues to pass.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT. See [LICENSE.md](./LICENSE.md) for details.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
[Michael Bolin](http://bolinfest.com/) independently arrived at and published
|
||||
some of these same ideas with awesome explanations and detail.
|
||||
Recommended reading:
|
||||
[Suggested Improvements to JSON](http://bolinfest.com/essays/json.html)
|
||||
|
||||
[Douglas Crockford](http://www.crockford.com/) of course designed and built
|
||||
JSON, but his state machine diagrams on the [JSON website](http://json.org/),
|
||||
as cheesy as it may sound, gave me motivation and confidence that building a
|
||||
new parser to implement these ideas this was within my reach!
|
||||
This code is also modeled directly off of Doug’s open-source [json_parse.js][]
|
||||
parser. I’m super grateful for that clean and well-documented code.
|
||||
|
||||
[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
|
||||
[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific
|
||||
supporter, contributing multiple patches and ideas. Thanks Max!
|
||||
|
||||
[Andrew Eisenberg](https://github.com/aeisenberg) has contributed the
|
||||
`stringify` method.
|
||||
|
||||
[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely
|
||||
with ES5 and is actively maintaining this project.
|
||||
41
build/node_modules/babel-core/node_modules/json5/lib/cli.js
generated
vendored
Executable file
41
build/node_modules/babel-core/node_modules/json5/lib/cli.js
generated
vendored
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// cli.js
|
||||
// JSON5 command-line interface.
|
||||
//
|
||||
// This is pretty minimal for now; just supports compiling files via `-c`.
|
||||
// TODO More useful functionality, like output path, watch, etc.?
|
||||
|
||||
var FS = require('fs');
|
||||
var JSON5 = require('./json5');
|
||||
var Path = require('path');
|
||||
|
||||
var USAGE = [
|
||||
'Usage: json5 -c path/to/file.json5 ...',
|
||||
'Compiles JSON5 files into sibling JSON files with the same basenames.',
|
||||
].join('\n');
|
||||
|
||||
// if valid, args look like [node, json5, -c, file1, file2, ...]
|
||||
var args = process.argv;
|
||||
|
||||
if (args.length < 4 || args[2] !== '-c') {
|
||||
console.error(USAGE);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var cwd = process.cwd();
|
||||
var files = args.slice(3);
|
||||
|
||||
// iterate over each file and convert JSON5 files to JSON:
|
||||
files.forEach(function (file) {
|
||||
var path = Path.resolve(cwd, file);
|
||||
var basename = Path.basename(path, '.json5');
|
||||
var dirname = Path.dirname(path);
|
||||
|
||||
var json5 = FS.readFileSync(path, 'utf8');
|
||||
var obj = JSON5.parse(json5);
|
||||
var json = JSON.stringify(obj, null, 4); // 4 spaces; TODO configurable?
|
||||
|
||||
path = Path.join(dirname, basename + '.json');
|
||||
FS.writeFileSync(path, json, 'utf8');
|
||||
});
|
||||
770
build/node_modules/babel-core/node_modules/json5/lib/json5.js
generated
vendored
Normal file
770
build/node_modules/babel-core/node_modules/json5/lib/json5.js
generated
vendored
Normal file
@@ -0,0 +1,770 @@
|
||||
// json5.js
|
||||
// Modern JSON. See README.md for details.
|
||||
//
|
||||
// This file is based directly off of Douglas Crockford's json_parse.js:
|
||||
// https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
|
||||
var JSON5 = (typeof exports === 'object' ? exports : {});
|
||||
|
||||
JSON5.parse = (function () {
|
||||
"use strict";
|
||||
|
||||
// This is a function that can parse a JSON5 text, producing a JavaScript
|
||||
// data structure. It is a simple, recursive descent parser. It does not use
|
||||
// eval or regular expressions, so it can be used as a model for implementing
|
||||
// a JSON5 parser in other languages.
|
||||
|
||||
// We are defining the function inside of another function to avoid creating
|
||||
// global variables.
|
||||
|
||||
var at, // The index of the current character
|
||||
lineNumber, // The current line number
|
||||
columnNumber, // The current column number
|
||||
ch, // The current character
|
||||
escapee = {
|
||||
"'": "'",
|
||||
'"': '"',
|
||||
'\\': '\\',
|
||||
'/': '/',
|
||||
'\n': '', // Replace escaped newlines in strings w/ empty string
|
||||
b: '\b',
|
||||
f: '\f',
|
||||
n: '\n',
|
||||
r: '\r',
|
||||
t: '\t'
|
||||
},
|
||||
ws = [
|
||||
' ',
|
||||
'\t',
|
||||
'\r',
|
||||
'\n',
|
||||
'\v',
|
||||
'\f',
|
||||
'\xA0',
|
||||
'\uFEFF'
|
||||
],
|
||||
text,
|
||||
|
||||
renderChar = function (chr) {
|
||||
return chr === '' ? 'EOF' : "'" + chr + "'";
|
||||
},
|
||||
|
||||
error = function (m) {
|
||||
|
||||
// Call error when something is wrong.
|
||||
|
||||
var error = new SyntaxError();
|
||||
// beginning of message suffix to agree with that provided by Gecko - see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
|
||||
error.message = m + " at line " + lineNumber + " column " + columnNumber + " of the JSON5 data. Still to read: " + JSON.stringify(text.substring(at - 1, at + 19));
|
||||
error.at = at;
|
||||
// These two property names have been chosen to agree with the ones in Gecko, the only popular
|
||||
// environment which seems to supply this info on JSON.parse
|
||||
error.lineNumber = lineNumber;
|
||||
error.columnNumber = columnNumber;
|
||||
throw error;
|
||||
},
|
||||
|
||||
next = function (c) {
|
||||
|
||||
// If a c parameter is provided, verify that it matches the current character.
|
||||
|
||||
if (c && c !== ch) {
|
||||
error("Expected " + renderChar(c) + " instead of " + renderChar(ch));
|
||||
}
|
||||
|
||||
// Get the next character. When there are no more characters,
|
||||
// return the empty string.
|
||||
|
||||
ch = text.charAt(at);
|
||||
at++;
|
||||
columnNumber++;
|
||||
if (ch === '\n' || ch === '\r' && peek() !== '\n') {
|
||||
lineNumber++;
|
||||
columnNumber = 0;
|
||||
}
|
||||
return ch;
|
||||
},
|
||||
|
||||
peek = function () {
|
||||
|
||||
// Get the next character without consuming it or
|
||||
// assigning it to the ch varaible.
|
||||
|
||||
return text.charAt(at);
|
||||
},
|
||||
|
||||
identifier = function () {
|
||||
|
||||
// Parse an identifier. Normally, reserved words are disallowed here, but we
|
||||
// only use this for unquoted object keys, where reserved words are allowed,
|
||||
// so we don't check for those here. References:
|
||||
// - http://es5.github.com/#x7.6
|
||||
// - https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables
|
||||
// - http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm
|
||||
// TODO Identifiers can have Unicode "letters" in them; add support for those.
|
||||
|
||||
var key = ch;
|
||||
|
||||
// Identifiers must start with a letter, _ or $.
|
||||
if ((ch !== '_' && ch !== '$') &&
|
||||
(ch < 'a' || ch > 'z') &&
|
||||
(ch < 'A' || ch > 'Z')) {
|
||||
error("Bad identifier as unquoted key");
|
||||
}
|
||||
|
||||
// Subsequent characters can contain digits.
|
||||
while (next() && (
|
||||
ch === '_' || ch === '$' ||
|
||||
(ch >= 'a' && ch <= 'z') ||
|
||||
(ch >= 'A' && ch <= 'Z') ||
|
||||
(ch >= '0' && ch <= '9'))) {
|
||||
key += ch;
|
||||
}
|
||||
|
||||
return key;
|
||||
},
|
||||
|
||||
number = function () {
|
||||
|
||||
// Parse a number value.
|
||||
|
||||
var number,
|
||||
sign = '',
|
||||
string = '',
|
||||
base = 10;
|
||||
|
||||
if (ch === '-' || ch === '+') {
|
||||
sign = ch;
|
||||
next(ch);
|
||||
}
|
||||
|
||||
// support for Infinity (could tweak to allow other words):
|
||||
if (ch === 'I') {
|
||||
number = word();
|
||||
if (typeof number !== 'number' || isNaN(number)) {
|
||||
error('Unexpected word for number');
|
||||
}
|
||||
return (sign === '-') ? -number : number;
|
||||
}
|
||||
|
||||
// support for NaN
|
||||
if (ch === 'N' ) {
|
||||
number = word();
|
||||
if (!isNaN(number)) {
|
||||
error('expected word to be NaN');
|
||||
}
|
||||
// ignore sign as -NaN also is NaN
|
||||
return number;
|
||||
}
|
||||
|
||||
if (ch === '0') {
|
||||
string += ch;
|
||||
next();
|
||||
if (ch === 'x' || ch === 'X') {
|
||||
string += ch;
|
||||
next();
|
||||
base = 16;
|
||||
} else if (ch >= '0' && ch <= '9') {
|
||||
error('Octal literal');
|
||||
}
|
||||
}
|
||||
|
||||
switch (base) {
|
||||
case 10:
|
||||
while (ch >= '0' && ch <= '9' ) {
|
||||
string += ch;
|
||||
next();
|
||||
}
|
||||
if (ch === '.') {
|
||||
string += '.';
|
||||
while (next() && ch >= '0' && ch <= '9') {
|
||||
string += ch;
|
||||
}
|
||||
}
|
||||
if (ch === 'e' || ch === 'E') {
|
||||
string += ch;
|
||||
next();
|
||||
if (ch === '-' || ch === '+') {
|
||||
string += ch;
|
||||
next();
|
||||
}
|
||||
while (ch >= '0' && ch <= '9') {
|
||||
string += ch;
|
||||
next();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
while (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {
|
||||
string += ch;
|
||||
next();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(sign === '-') {
|
||||
number = -string;
|
||||
} else {
|
||||
number = +string;
|
||||
}
|
||||
|
||||
if (!isFinite(number)) {
|
||||
error("Bad number");
|
||||
} else {
|
||||
return number;
|
||||
}
|
||||
},
|
||||
|
||||
string = function () {
|
||||
|
||||
// Parse a string value.
|
||||
|
||||
var hex,
|
||||
i,
|
||||
string = '',
|
||||
delim, // double quote or single quote
|
||||
uffff;
|
||||
|
||||
// When parsing for string values, we must look for ' or " and \ characters.
|
||||
|
||||
if (ch === '"' || ch === "'") {
|
||||
delim = ch;
|
||||
while (next()) {
|
||||
if (ch === delim) {
|
||||
next();
|
||||
return string;
|
||||
} else if (ch === '\\') {
|
||||
next();
|
||||
if (ch === 'u') {
|
||||
uffff = 0;
|
||||
for (i = 0; i < 4; i += 1) {
|
||||
hex = parseInt(next(), 16);
|
||||
if (!isFinite(hex)) {
|
||||
break;
|
||||
}
|
||||
uffff = uffff * 16 + hex;
|
||||
}
|
||||
string += String.fromCharCode(uffff);
|
||||
} else if (ch === '\r') {
|
||||
if (peek() === '\n') {
|
||||
next();
|
||||
}
|
||||
} else if (typeof escapee[ch] === 'string') {
|
||||
string += escapee[ch];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (ch === '\n') {
|
||||
// unescaped newlines are invalid; see:
|
||||
// https://github.com/aseemk/json5/issues/24
|
||||
// TODO this feels special-cased; are there other
|
||||
// invalid unescaped chars?
|
||||
break;
|
||||
} else {
|
||||
string += ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
error("Bad string");
|
||||
},
|
||||
|
||||
inlineComment = function () {
|
||||
|
||||
// Skip an inline comment, assuming this is one. The current character should
|
||||
// be the second / character in the // pair that begins this inline comment.
|
||||
// To finish the inline comment, we look for a newline or the end of the text.
|
||||
|
||||
if (ch !== '/') {
|
||||
error("Not an inline comment");
|
||||
}
|
||||
|
||||
do {
|
||||
next();
|
||||
if (ch === '\n' || ch === '\r') {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
} while (ch);
|
||||
},
|
||||
|
||||
blockComment = function () {
|
||||
|
||||
// Skip a block comment, assuming this is one. The current character should be
|
||||
// the * character in the /* pair that begins this block comment.
|
||||
// To finish the block comment, we look for an ending */ pair of characters,
|
||||
// but we also watch for the end of text before the comment is terminated.
|
||||
|
||||
if (ch !== '*') {
|
||||
error("Not a block comment");
|
||||
}
|
||||
|
||||
do {
|
||||
next();
|
||||
while (ch === '*') {
|
||||
next('*');
|
||||
if (ch === '/') {
|
||||
next('/');
|
||||
return;
|
||||
}
|
||||
}
|
||||
} while (ch);
|
||||
|
||||
error("Unterminated block comment");
|
||||
},
|
||||
|
||||
comment = function () {
|
||||
|
||||
// Skip a comment, whether inline or block-level, assuming this is one.
|
||||
// Comments always begin with a / character.
|
||||
|
||||
if (ch !== '/') {
|
||||
error("Not a comment");
|
||||
}
|
||||
|
||||
next('/');
|
||||
|
||||
if (ch === '/') {
|
||||
inlineComment();
|
||||
} else if (ch === '*') {
|
||||
blockComment();
|
||||
} else {
|
||||
error("Unrecognized comment");
|
||||
}
|
||||
},
|
||||
|
||||
white = function () {
|
||||
|
||||
// Skip whitespace and comments.
|
||||
// Note that we're detecting comments by only a single / character.
|
||||
// This works since regular expressions are not valid JSON(5), but this will
|
||||
// break if there are other valid values that begin with a / character!
|
||||
|
||||
while (ch) {
|
||||
if (ch === '/') {
|
||||
comment();
|
||||
} else if (ws.indexOf(ch) >= 0) {
|
||||
next();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
word = function () {
|
||||
|
||||
// true, false, or null.
|
||||
|
||||
switch (ch) {
|
||||
case 't':
|
||||
next('t');
|
||||
next('r');
|
||||
next('u');
|
||||
next('e');
|
||||
return true;
|
||||
case 'f':
|
||||
next('f');
|
||||
next('a');
|
||||
next('l');
|
||||
next('s');
|
||||
next('e');
|
||||
return false;
|
||||
case 'n':
|
||||
next('n');
|
||||
next('u');
|
||||
next('l');
|
||||
next('l');
|
||||
return null;
|
||||
case 'I':
|
||||
next('I');
|
||||
next('n');
|
||||
next('f');
|
||||
next('i');
|
||||
next('n');
|
||||
next('i');
|
||||
next('t');
|
||||
next('y');
|
||||
return Infinity;
|
||||
case 'N':
|
||||
next( 'N' );
|
||||
next( 'a' );
|
||||
next( 'N' );
|
||||
return NaN;
|
||||
}
|
||||
error("Unexpected " + renderChar(ch));
|
||||
},
|
||||
|
||||
value, // Place holder for the value function.
|
||||
|
||||
array = function () {
|
||||
|
||||
// Parse an array value.
|
||||
|
||||
var array = [];
|
||||
|
||||
if (ch === '[') {
|
||||
next('[');
|
||||
white();
|
||||
while (ch) {
|
||||
if (ch === ']') {
|
||||
next(']');
|
||||
return array; // Potentially empty array
|
||||
}
|
||||
// ES5 allows omitting elements in arrays, e.g. [,] and
|
||||
// [,null]. We don't allow this in JSON5.
|
||||
if (ch === ',') {
|
||||
error("Missing array element");
|
||||
} else {
|
||||
array.push(value());
|
||||
}
|
||||
white();
|
||||
// If there's no comma after this value, this needs to
|
||||
// be the end of the array.
|
||||
if (ch !== ',') {
|
||||
next(']');
|
||||
return array;
|
||||
}
|
||||
next(',');
|
||||
white();
|
||||
}
|
||||
}
|
||||
error("Bad array");
|
||||
},
|
||||
|
||||
object = function () {
|
||||
|
||||
// Parse an object value.
|
||||
|
||||
var key,
|
||||
object = {};
|
||||
|
||||
if (ch === '{') {
|
||||
next('{');
|
||||
white();
|
||||
while (ch) {
|
||||
if (ch === '}') {
|
||||
next('}');
|
||||
return object; // Potentially empty object
|
||||
}
|
||||
|
||||
// Keys can be unquoted. If they are, they need to be
|
||||
// valid JS identifiers.
|
||||
if (ch === '"' || ch === "'") {
|
||||
key = string();
|
||||
} else {
|
||||
key = identifier();
|
||||
}
|
||||
|
||||
white();
|
||||
next(':');
|
||||
object[key] = value();
|
||||
white();
|
||||
// If there's no comma after this pair, this needs to be
|
||||
// the end of the object.
|
||||
if (ch !== ',') {
|
||||
next('}');
|
||||
return object;
|
||||
}
|
||||
next(',');
|
||||
white();
|
||||
}
|
||||
}
|
||||
error("Bad object");
|
||||
};
|
||||
|
||||
value = function () {
|
||||
|
||||
// Parse a JSON value. It could be an object, an array, a string, a number,
|
||||
// or a word.
|
||||
|
||||
white();
|
||||
switch (ch) {
|
||||
case '{':
|
||||
return object();
|
||||
case '[':
|
||||
return array();
|
||||
case '"':
|
||||
case "'":
|
||||
return string();
|
||||
case '-':
|
||||
case '+':
|
||||
case '.':
|
||||
return number();
|
||||
default:
|
||||
return ch >= '0' && ch <= '9' ? number() : word();
|
||||
}
|
||||
};
|
||||
|
||||
// Return the json_parse function. It will have access to all of the above
|
||||
// functions and variables.
|
||||
|
||||
return function (source, reviver) {
|
||||
var result;
|
||||
|
||||
text = String(source);
|
||||
at = 0;
|
||||
lineNumber = 1;
|
||||
columnNumber = 1;
|
||||
ch = ' ';
|
||||
result = value();
|
||||
white();
|
||||
if (ch) {
|
||||
error("Syntax error");
|
||||
}
|
||||
|
||||
// If there is a reviver function, we recursively walk the new structure,
|
||||
// passing each name/value pair to the reviver function for possible
|
||||
// transformation, starting with a temporary root object that holds the result
|
||||
// in an empty key. If there is not a reviver function, we simply return the
|
||||
// result.
|
||||
|
||||
return typeof reviver === 'function' ? (function walk(holder, key) {
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}({'': result}, '')) : result;
|
||||
};
|
||||
}());
|
||||
|
||||
// JSON5 stringify will not quote keys where appropriate
|
||||
JSON5.stringify = function (obj, replacer, space) {
|
||||
if (replacer && (typeof(replacer) !== "function" && !isArray(replacer))) {
|
||||
throw new Error('Replacer must be a function or an array');
|
||||
}
|
||||
var getReplacedValueOrUndefined = function(holder, key, isTopLevel) {
|
||||
var value = holder[key];
|
||||
|
||||
// Replace the value with its toJSON value first, if possible
|
||||
if (value && value.toJSON && typeof value.toJSON === "function") {
|
||||
value = value.toJSON();
|
||||
}
|
||||
|
||||
// If the user-supplied replacer if a function, call it. If it's an array, check objects' string keys for
|
||||
// presence in the array (removing the key/value pair from the resulting JSON if the key is missing).
|
||||
if (typeof(replacer) === "function") {
|
||||
return replacer.call(holder, key, value);
|
||||
} else if(replacer) {
|
||||
if (isTopLevel || isArray(holder) || replacer.indexOf(key) >= 0) {
|
||||
return value;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
function isWordChar(c) {
|
||||
return (c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
c === '_' || c === '$';
|
||||
}
|
||||
|
||||
function isWordStart(c) {
|
||||
return (c >= 'a' && c <= 'z') ||
|
||||
(c >= 'A' && c <= 'Z') ||
|
||||
c === '_' || c === '$';
|
||||
}
|
||||
|
||||
function isWord(key) {
|
||||
if (typeof key !== 'string') {
|
||||
return false;
|
||||
}
|
||||
if (!isWordStart(key[0])) {
|
||||
return false;
|
||||
}
|
||||
var i = 1, length = key.length;
|
||||
while (i < length) {
|
||||
if (!isWordChar(key[i])) {
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// export for use in tests
|
||||
JSON5.isWord = isWord;
|
||||
|
||||
// polyfills
|
||||
function isArray(obj) {
|
||||
if (Array.isArray) {
|
||||
return Array.isArray(obj);
|
||||
} else {
|
||||
return Object.prototype.toString.call(obj) === '[object Array]';
|
||||
}
|
||||
}
|
||||
|
||||
function isDate(obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Date]';
|
||||
}
|
||||
|
||||
var objStack = [];
|
||||
function checkForCircular(obj) {
|
||||
for (var i = 0; i < objStack.length; i++) {
|
||||
if (objStack[i] === obj) {
|
||||
throw new TypeError("Converting circular structure to JSON");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeIndent(str, num, noNewLine) {
|
||||
if (!str) {
|
||||
return "";
|
||||
}
|
||||
// indentation no more than 10 chars
|
||||
if (str.length > 10) {
|
||||
str = str.substring(0, 10);
|
||||
}
|
||||
|
||||
var indent = noNewLine ? "" : "\n";
|
||||
for (var i = 0; i < num; i++) {
|
||||
indent += str;
|
||||
}
|
||||
|
||||
return indent;
|
||||
}
|
||||
|
||||
var indentStr;
|
||||
if (space) {
|
||||
if (typeof space === "string") {
|
||||
indentStr = space;
|
||||
} else if (typeof space === "number" && space >= 0) {
|
||||
indentStr = makeIndent(" ", space, true);
|
||||
} else {
|
||||
// ignore space parameter
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from Crokford's implementation of JSON
|
||||
// See https://github.com/douglascrockford/JSON-js/blob/e39db4b7e6249f04a195e7dd0840e610cc9e941e/json2.js#L195
|
||||
// Begin
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
};
|
||||
function escapeString(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string' ?
|
||||
c :
|
||||
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' : '"' + string + '"';
|
||||
}
|
||||
// End
|
||||
|
||||
function internalStringify(holder, key, isTopLevel) {
|
||||
var buffer, res;
|
||||
|
||||
// Replace the value, if necessary
|
||||
var obj_part = getReplacedValueOrUndefined(holder, key, isTopLevel);
|
||||
|
||||
if (obj_part && !isDate(obj_part)) {
|
||||
// unbox objects
|
||||
// don't unbox dates, since will turn it into number
|
||||
obj_part = obj_part.valueOf();
|
||||
}
|
||||
switch(typeof obj_part) {
|
||||
case "boolean":
|
||||
return obj_part.toString();
|
||||
|
||||
case "number":
|
||||
if (isNaN(obj_part) || !isFinite(obj_part)) {
|
||||
return "null";
|
||||
}
|
||||
return obj_part.toString();
|
||||
|
||||
case "string":
|
||||
return escapeString(obj_part.toString());
|
||||
|
||||
case "object":
|
||||
if (obj_part === null) {
|
||||
return "null";
|
||||
} else if (isArray(obj_part)) {
|
||||
checkForCircular(obj_part);
|
||||
buffer = "[";
|
||||
objStack.push(obj_part);
|
||||
|
||||
for (var i = 0; i < obj_part.length; i++) {
|
||||
res = internalStringify(obj_part, i, false);
|
||||
buffer += makeIndent(indentStr, objStack.length);
|
||||
if (res === null || typeof res === "undefined") {
|
||||
buffer += "null";
|
||||
} else {
|
||||
buffer += res;
|
||||
}
|
||||
if (i < obj_part.length-1) {
|
||||
buffer += ",";
|
||||
} else if (indentStr) {
|
||||
buffer += "\n";
|
||||
}
|
||||
}
|
||||
objStack.pop();
|
||||
if (obj_part.length) {
|
||||
buffer += makeIndent(indentStr, objStack.length, true)
|
||||
}
|
||||
buffer += "]";
|
||||
} else {
|
||||
checkForCircular(obj_part);
|
||||
buffer = "{";
|
||||
var nonEmpty = false;
|
||||
objStack.push(obj_part);
|
||||
for (var prop in obj_part) {
|
||||
if (obj_part.hasOwnProperty(prop)) {
|
||||
var value = internalStringify(obj_part, prop, false);
|
||||
isTopLevel = false;
|
||||
if (typeof value !== "undefined" && value !== null) {
|
||||
buffer += makeIndent(indentStr, objStack.length);
|
||||
nonEmpty = true;
|
||||
key = isWord(prop) ? prop : escapeString(prop);
|
||||
buffer += key + ":" + (indentStr ? ' ' : '') + value + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
objStack.pop();
|
||||
if (nonEmpty) {
|
||||
buffer = buffer.substring(0, buffer.length-1) + makeIndent(indentStr, objStack.length) + "}";
|
||||
} else {
|
||||
buffer = '{}';
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
default:
|
||||
// functions and undefined should be ignored
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// special case...when undefined is used inside of
|
||||
// a compound object/array, return null.
|
||||
// but when top-level, return undefined
|
||||
var topLevelHolder = {"":obj};
|
||||
if (obj === undefined) {
|
||||
return getReplacedValueOrUndefined(topLevelHolder, '', true);
|
||||
}
|
||||
return internalStringify(topLevelHolder, '', true);
|
||||
};
|
||||
18
build/node_modules/babel-core/node_modules/json5/lib/require.js
generated
vendored
Normal file
18
build/node_modules/babel-core/node_modules/json5/lib/require.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// require.js
|
||||
// Node.js only: adds a require() hook for .json5 files, just like the native
|
||||
// hook for .json files.
|
||||
//
|
||||
// Usage:
|
||||
// require('json5/require');
|
||||
// require('./foo'); // will check foo.json5 after foo.js, foo.json, etc.
|
||||
// require('./bar.json5');
|
||||
|
||||
var FS = require('fs');
|
||||
var JSON5 = require('./json5');
|
||||
|
||||
// Modeled off of (v0.6.18 link; check latest too):
|
||||
// https://github.com/joyent/node/blob/v0.6.18/lib/module.js#L468-L472
|
||||
require.extensions['.json5'] = function (module, filename) {
|
||||
var content = FS.readFileSync(filename, 'utf8');
|
||||
module.exports = JSON5.parse(content);
|
||||
};
|
||||
80
build/node_modules/babel-core/node_modules/json5/package.json
generated
vendored
Normal file
80
build/node_modules/babel-core/node_modules/json5/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "json5@^0.5.1",
|
||||
"_id": "json5@0.5.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=",
|
||||
"_location": "/babel-core/json5",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "json5@^0.5.1",
|
||||
"name": "json5",
|
||||
"escapedName": "json5",
|
||||
"rawSpec": "^0.5.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.5.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
|
||||
"_shasum": "1eade7acc012034ad84e2396767ead9fa5495821",
|
||||
"_spec": "json5@^0.5.1",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/babel-core",
|
||||
"author": {
|
||||
"name": "Aseem Kishore",
|
||||
"email": "aseem.kishore@gmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/aseemk/json5/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Max Nanasy",
|
||||
"email": "max.nanasy@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Eisenberg",
|
||||
"email": "andrew@eisenberg.as"
|
||||
},
|
||||
{
|
||||
"name": "Jordan Tucker",
|
||||
"email": "jordanbtucker@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "JSON for the ES5 era.",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-jshint": "^2.0.1",
|
||||
"jshint": "^2.9.3",
|
||||
"jshint-stylish": "^2.2.1",
|
||||
"mocha": "^3.1.0"
|
||||
},
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"homepage": "http://json5.org/",
|
||||
"keywords": [
|
||||
"json",
|
||||
"es5"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/json5.js",
|
||||
"name": "json5",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/aseemk/json5.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node ./lib/cli.js -c package.json5",
|
||||
"test": "mocha --ui exports --reporter spec"
|
||||
},
|
||||
"version": "0.5.1"
|
||||
}
|
||||
301
build/node_modules/babel-core/node_modules/source-map/CHANGELOG.md
generated
vendored
Normal file
301
build/node_modules/babel-core/node_modules/source-map/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,301 @@
|
||||
# Change Log
|
||||
|
||||
## 0.5.6
|
||||
|
||||
* Fix for regression when people were using numbers as names in source maps. See
|
||||
#236.
|
||||
|
||||
## 0.5.5
|
||||
|
||||
* Fix "regression" of unsupported, implementation behavior that half the world
|
||||
happens to have come to depend on. See #235.
|
||||
|
||||
* Fix regression involving function hoisting in SpiderMonkey. See #233.
|
||||
|
||||
## 0.5.4
|
||||
|
||||
* Large performance improvements to source-map serialization. See #228 and #229.
|
||||
|
||||
## 0.5.3
|
||||
|
||||
* Do not include unnecessary distribution files. See
|
||||
commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86.
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Include browser distributions of the library in package.json's `files`. See
|
||||
issue #212.
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See
|
||||
ff05274becc9e6e1295ed60f3ea090d31d843379.
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Node 0.8 is no longer supported.
|
||||
|
||||
* Use webpack instead of dryice for bundling.
|
||||
|
||||
* Big speedups serializing source maps. See pull request #203.
|
||||
|
||||
* Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that
|
||||
explicitly start with the source root. See issue #199.
|
||||
|
||||
## 0.4.4
|
||||
|
||||
* Fix an issue where using a `SourceMapGenerator` after having created a
|
||||
`SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See
|
||||
issue #191.
|
||||
|
||||
* Fix an issue with where `SourceMapGenerator` would mistakenly consider
|
||||
different mappings as duplicates of each other and avoid generating them. See
|
||||
issue #192.
|
||||
|
||||
## 0.4.3
|
||||
|
||||
* A very large number of performance improvements, particularly when parsing
|
||||
source maps. Collectively about 75% of time shaved off of the source map
|
||||
parsing benchmark!
|
||||
|
||||
* Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy
|
||||
searching in the presence of a column option. See issue #177.
|
||||
|
||||
* Fix a bug with joining a source and its source root when the source is above
|
||||
the root. See issue #182.
|
||||
|
||||
* Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to
|
||||
determine when all sources' contents are inlined into the source map. See
|
||||
issue #190.
|
||||
|
||||
## 0.4.2
|
||||
|
||||
* Add an `.npmignore` file so that the benchmarks aren't pulled down by
|
||||
dependent projects. Issue #169.
|
||||
|
||||
* Add an optional `column` argument to
|
||||
`SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines
|
||||
with no mappings. Issues #172 and #173.
|
||||
|
||||
## 0.4.1
|
||||
|
||||
* Fix accidentally defining a global variable. #170.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* The default direction for fuzzy searching was changed back to its original
|
||||
direction. See #164.
|
||||
|
||||
* There is now a `bias` option you can supply to `SourceMapConsumer` to control
|
||||
the fuzzy searching direction. See #167.
|
||||
|
||||
* About an 8% speed up in parsing source maps. See #159.
|
||||
|
||||
* Added a benchmark for parsing and generating source maps.
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* Change the default direction that searching for positions fuzzes when there is
|
||||
not an exact match. See #154.
|
||||
|
||||
* Support for environments using json2.js for JSON serialization. See #156.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* Support for consuming "indexed" source maps which do not have any remote
|
||||
sections. See pull request #127. This introduces a minor backwards
|
||||
incompatibility if you are monkey patching `SourceMapConsumer.prototype`
|
||||
methods.
|
||||
|
||||
## 0.1.43
|
||||
|
||||
* Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue
|
||||
#148 for some discussion and issues #150, #151, and #152 for implementations.
|
||||
|
||||
## 0.1.42
|
||||
|
||||
* Fix an issue where `SourceNode`s from different versions of the source-map
|
||||
library couldn't be used in conjunction with each other. See issue #142.
|
||||
|
||||
## 0.1.41
|
||||
|
||||
* Fix a bug with getting the source content of relative sources with a "./"
|
||||
prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768).
|
||||
|
||||
* Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the
|
||||
column span of each mapping.
|
||||
|
||||
* Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find
|
||||
all generated positions associated with a given original source and line.
|
||||
|
||||
## 0.1.40
|
||||
|
||||
* Performance improvements for parsing source maps in SourceMapConsumer.
|
||||
|
||||
## 0.1.39
|
||||
|
||||
* Fix a bug where setting a source's contents to null before any source content
|
||||
had been set before threw a TypeError. See issue #131.
|
||||
|
||||
## 0.1.38
|
||||
|
||||
* Fix a bug where finding relative paths from an empty path were creating
|
||||
absolute paths. See issue #129.
|
||||
|
||||
## 0.1.37
|
||||
|
||||
* Fix a bug where if the source root was an empty string, relative source paths
|
||||
would turn into absolute source paths. Issue #124.
|
||||
|
||||
## 0.1.36
|
||||
|
||||
* Allow the `names` mapping property to be an empty string. Issue #121.
|
||||
|
||||
## 0.1.35
|
||||
|
||||
* A third optional parameter was added to `SourceNode.fromStringWithSourceMap`
|
||||
to specify a path that relative sources in the second parameter should be
|
||||
relative to. Issue #105.
|
||||
|
||||
* If no file property is given to a `SourceMapGenerator`, then the resulting
|
||||
source map will no longer have a `null` file property. The property will
|
||||
simply not exist. Issue #104.
|
||||
|
||||
* Fixed a bug where consecutive newlines were ignored in `SourceNode`s.
|
||||
Issue #116.
|
||||
|
||||
## 0.1.34
|
||||
|
||||
* Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103.
|
||||
|
||||
* Fix bug involving source contents and the
|
||||
`SourceMapGenerator.prototype.applySourceMap`. Issue #100.
|
||||
|
||||
## 0.1.33
|
||||
|
||||
* Fix some edge cases surrounding path joining and URL resolution.
|
||||
|
||||
* Add a third parameter for relative path to
|
||||
`SourceMapGenerator.prototype.applySourceMap`.
|
||||
|
||||
* Fix issues with mappings and EOLs.
|
||||
|
||||
## 0.1.32
|
||||
|
||||
* Fixed a bug where SourceMapConsumer couldn't handle negative relative columns
|
||||
(issue 92).
|
||||
|
||||
* Fixed test runner to actually report number of failed tests as its process
|
||||
exit code.
|
||||
|
||||
* Fixed a typo when reporting bad mappings (issue 87).
|
||||
|
||||
## 0.1.31
|
||||
|
||||
* Delay parsing the mappings in SourceMapConsumer until queried for a source
|
||||
location.
|
||||
|
||||
* Support Sass source maps (which at the time of writing deviate from the spec
|
||||
in small ways) in SourceMapConsumer.
|
||||
|
||||
## 0.1.30
|
||||
|
||||
* Do not join source root with a source, when the source is a data URI.
|
||||
|
||||
* Extend the test runner to allow running single specific test files at a time.
|
||||
|
||||
* Performance improvements in `SourceNode.prototype.walk` and
|
||||
`SourceMapConsumer.prototype.eachMapping`.
|
||||
|
||||
* Source map browser builds will now work inside Workers.
|
||||
|
||||
* Better error messages when attempting to add an invalid mapping to a
|
||||
`SourceMapGenerator`.
|
||||
|
||||
## 0.1.29
|
||||
|
||||
* Allow duplicate entries in the `names` and `sources` arrays of source maps
|
||||
(usually from TypeScript) we are parsing. Fixes github issue 72.
|
||||
|
||||
## 0.1.28
|
||||
|
||||
* Skip duplicate mappings when creating source maps from SourceNode; github
|
||||
issue 75.
|
||||
|
||||
## 0.1.27
|
||||
|
||||
* Don't throw an error when the `file` property is missing in SourceMapConsumer,
|
||||
we don't use it anyway.
|
||||
|
||||
## 0.1.26
|
||||
|
||||
* Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70.
|
||||
|
||||
## 0.1.25
|
||||
|
||||
* Make compatible with browserify
|
||||
|
||||
## 0.1.24
|
||||
|
||||
* Fix issue with absolute paths and `file://` URIs. See
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=885597
|
||||
|
||||
## 0.1.23
|
||||
|
||||
* Fix issue with absolute paths and sourcesContent, github issue 64.
|
||||
|
||||
## 0.1.22
|
||||
|
||||
* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21.
|
||||
|
||||
## 0.1.21
|
||||
|
||||
* Fixed handling of sources that start with a slash so that they are relative to
|
||||
the source root's host.
|
||||
|
||||
## 0.1.20
|
||||
|
||||
* Fixed github issue #43: absolute URLs aren't joined with the source root
|
||||
anymore.
|
||||
|
||||
## 0.1.19
|
||||
|
||||
* Using Travis CI to run tests.
|
||||
|
||||
## 0.1.18
|
||||
|
||||
* Fixed a bug in the handling of sourceRoot.
|
||||
|
||||
## 0.1.17
|
||||
|
||||
* Added SourceNode.fromStringWithSourceMap.
|
||||
|
||||
## 0.1.16
|
||||
|
||||
* Added missing documentation.
|
||||
|
||||
* Fixed the generating of empty mappings in SourceNode.
|
||||
|
||||
## 0.1.15
|
||||
|
||||
* Added SourceMapGenerator.applySourceMap.
|
||||
|
||||
## 0.1.14
|
||||
|
||||
* The sourceRoot is now handled consistently.
|
||||
|
||||
## 0.1.13
|
||||
|
||||
* Added SourceMapGenerator.fromSourceMap.
|
||||
|
||||
## 0.1.12
|
||||
|
||||
* SourceNode now generates empty mappings too.
|
||||
|
||||
## 0.1.11
|
||||
|
||||
* Added name support to SourceNode.
|
||||
|
||||
## 0.1.10
|
||||
|
||||
* Added sourcesContent support to the customer and generator.
|
||||
28
build/node_modules/babel-core/node_modules/source-map/LICENSE
generated
vendored
Normal file
28
build/node_modules/babel-core/node_modules/source-map/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the Mozilla Foundation nor the names of project
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
729
build/node_modules/babel-core/node_modules/source-map/README.md
generated
vendored
Normal file
729
build/node_modules/babel-core/node_modules/source-map/README.md
generated
vendored
Normal file
@@ -0,0 +1,729 @@
|
||||
# Source Map
|
||||
|
||||
[](https://travis-ci.org/mozilla/source-map)
|
||||
|
||||
[](https://www.npmjs.com/package/source-map)
|
||||
|
||||
This is a library to generate and consume the source map format
|
||||
[described here][format].
|
||||
|
||||
[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
|
||||
|
||||
## Use with Node
|
||||
|
||||
$ npm install source-map
|
||||
|
||||
## Use on the Web
|
||||
|
||||
<script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" defer></script>
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
<!-- `npm run toc` to regenerate the Table of Contents -->
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
## Table of Contents
|
||||
|
||||
- [Examples](#examples)
|
||||
- [Consuming a source map](#consuming-a-source-map)
|
||||
- [Generating a source map](#generating-a-source-map)
|
||||
- [With SourceNode (high level API)](#with-sourcenode-high-level-api)
|
||||
- [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api)
|
||||
- [API](#api)
|
||||
- [SourceMapConsumer](#sourcemapconsumer)
|
||||
- [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap)
|
||||
- [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans)
|
||||
- [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition)
|
||||
- [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition)
|
||||
- [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition)
|
||||
- [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources)
|
||||
- [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing)
|
||||
- [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order)
|
||||
- [SourceMapGenerator](#sourcemapgenerator)
|
||||
- [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap)
|
||||
- [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer)
|
||||
- [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping)
|
||||
- [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent)
|
||||
- [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
|
||||
- [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring)
|
||||
- [SourceNode](#sourcenode)
|
||||
- [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
|
||||
- [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath)
|
||||
- [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk)
|
||||
- [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk)
|
||||
- [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent)
|
||||
- [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn)
|
||||
- [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn)
|
||||
- [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep)
|
||||
- [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement)
|
||||
- [SourceNode.prototype.toString()](#sourcenodeprototypetostring)
|
||||
- [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Examples
|
||||
|
||||
### Consuming a source map
|
||||
|
||||
```js
|
||||
var rawSourceMap = {
|
||||
version: 3,
|
||||
file: 'min.js',
|
||||
names: ['bar', 'baz', 'n'],
|
||||
sources: ['one.js', 'two.js'],
|
||||
sourceRoot: 'http://example.com/www/js/',
|
||||
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
|
||||
};
|
||||
|
||||
var smc = new SourceMapConsumer(rawSourceMap);
|
||||
|
||||
console.log(smc.sources);
|
||||
// [ 'http://example.com/www/js/one.js',
|
||||
// 'http://example.com/www/js/two.js' ]
|
||||
|
||||
console.log(smc.originalPositionFor({
|
||||
line: 2,
|
||||
column: 28
|
||||
}));
|
||||
// { source: 'http://example.com/www/js/two.js',
|
||||
// line: 2,
|
||||
// column: 10,
|
||||
// name: 'n' }
|
||||
|
||||
console.log(smc.generatedPositionFor({
|
||||
source: 'http://example.com/www/js/two.js',
|
||||
line: 2,
|
||||
column: 10
|
||||
}));
|
||||
// { line: 2, column: 28 }
|
||||
|
||||
smc.eachMapping(function (m) {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
### Generating a source map
|
||||
|
||||
In depth guide:
|
||||
[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
|
||||
|
||||
#### With SourceNode (high level API)
|
||||
|
||||
```js
|
||||
function compile(ast) {
|
||||
switch (ast.type) {
|
||||
case 'BinaryExpression':
|
||||
return new SourceNode(
|
||||
ast.location.line,
|
||||
ast.location.column,
|
||||
ast.location.source,
|
||||
[compile(ast.left), " + ", compile(ast.right)]
|
||||
);
|
||||
case 'Literal':
|
||||
return new SourceNode(
|
||||
ast.location.line,
|
||||
ast.location.column,
|
||||
ast.location.source,
|
||||
String(ast.value)
|
||||
);
|
||||
// ...
|
||||
default:
|
||||
throw new Error("Bad AST");
|
||||
}
|
||||
}
|
||||
|
||||
var ast = parse("40 + 2", "add.js");
|
||||
console.log(compile(ast).toStringWithSourceMap({
|
||||
file: 'add.js'
|
||||
}));
|
||||
// { code: '40 + 2',
|
||||
// map: [object SourceMapGenerator] }
|
||||
```
|
||||
|
||||
#### With SourceMapGenerator (low level API)
|
||||
|
||||
```js
|
||||
var map = new SourceMapGenerator({
|
||||
file: "source-mapped.js"
|
||||
});
|
||||
|
||||
map.addMapping({
|
||||
generated: {
|
||||
line: 10,
|
||||
column: 35
|
||||
},
|
||||
source: "foo.js",
|
||||
original: {
|
||||
line: 33,
|
||||
column: 2
|
||||
},
|
||||
name: "christopher"
|
||||
});
|
||||
|
||||
console.log(map.toString());
|
||||
// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Get a reference to the module:
|
||||
|
||||
```js
|
||||
// Node.js
|
||||
var sourceMap = require('source-map');
|
||||
|
||||
// Browser builds
|
||||
var sourceMap = window.sourceMap;
|
||||
|
||||
// Inside Firefox
|
||||
const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
|
||||
```
|
||||
|
||||
### SourceMapConsumer
|
||||
|
||||
A SourceMapConsumer instance represents a parsed source map which we can query
|
||||
for information about the original file positions by giving it a file position
|
||||
in the generated source.
|
||||
|
||||
#### new SourceMapConsumer(rawSourceMap)
|
||||
|
||||
The only parameter is the raw source map (either as a string which can be
|
||||
`JSON.parse`'d, or an object). According to the spec, source maps have the
|
||||
following attributes:
|
||||
|
||||
* `version`: Which version of the source map spec this map is following.
|
||||
|
||||
* `sources`: An array of URLs to the original source files.
|
||||
|
||||
* `names`: An array of identifiers which can be referenced by individual
|
||||
mappings.
|
||||
|
||||
* `sourceRoot`: Optional. The URL root from which all sources are relative.
|
||||
|
||||
* `sourcesContent`: Optional. An array of contents of the original source files.
|
||||
|
||||
* `mappings`: A string of base64 VLQs which contain the actual mappings.
|
||||
|
||||
* `file`: Optional. The generated filename this source map is associated with.
|
||||
|
||||
```js
|
||||
var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.computeColumnSpans()
|
||||
|
||||
Compute the last column for each generated mapping. The last column is
|
||||
inclusive.
|
||||
|
||||
```js
|
||||
// Before:
|
||||
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1 },
|
||||
// { line: 2,
|
||||
// column: 10 },
|
||||
// { line: 2,
|
||||
// column: 20 } ]
|
||||
|
||||
consumer.computeColumnSpans();
|
||||
|
||||
// After:
|
||||
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1,
|
||||
// lastColumn: 9 },
|
||||
// { line: 2,
|
||||
// column: 10,
|
||||
// lastColumn: 19 },
|
||||
// { line: 2,
|
||||
// column: 20,
|
||||
// lastColumn: Infinity } ]
|
||||
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
|
||||
|
||||
Returns the original source, line, and column information for the generated
|
||||
source's line and column positions provided. The only argument is an object with
|
||||
the following properties:
|
||||
|
||||
* `line`: The line number in the generated source.
|
||||
|
||||
* `column`: The column number in the generated source.
|
||||
|
||||
* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or
|
||||
`SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest
|
||||
element that is smaller than or greater than the one we are searching for,
|
||||
respectively, if the exact element cannot be found. Defaults to
|
||||
`SourceMapConsumer.GREATEST_LOWER_BOUND`.
|
||||
|
||||
and an object is returned with the following properties:
|
||||
|
||||
* `source`: The original source file, or null if this information is not
|
||||
available.
|
||||
|
||||
* `line`: The line number in the original source, or null if this information is
|
||||
not available.
|
||||
|
||||
* `column`: The column number in the original source, or null if this
|
||||
information is not available.
|
||||
|
||||
* `name`: The original identifier, or null if this information is not available.
|
||||
|
||||
```js
|
||||
consumer.originalPositionFor({ line: 2, column: 10 })
|
||||
// { source: 'foo.coffee',
|
||||
// line: 2,
|
||||
// column: 2,
|
||||
// name: null }
|
||||
|
||||
consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
|
||||
// { source: null,
|
||||
// line: null,
|
||||
// column: null,
|
||||
// name: null }
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
|
||||
|
||||
Returns the generated line and column information for the original source,
|
||||
line, and column positions provided. The only argument is an object with
|
||||
the following properties:
|
||||
|
||||
* `source`: The filename of the original source.
|
||||
|
||||
* `line`: The line number in the original source.
|
||||
|
||||
* `column`: The column number in the original source.
|
||||
|
||||
and an object is returned with the following properties:
|
||||
|
||||
* `line`: The line number in the generated source, or null.
|
||||
|
||||
* `column`: The column number in the generated source, or null.
|
||||
|
||||
```js
|
||||
consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
|
||||
// { line: 1,
|
||||
// column: 56 }
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
|
||||
|
||||
Returns all generated line and column information for the original source, line,
|
||||
and column provided. If no column is provided, returns all mappings
|
||||
corresponding to a either the line we are searching for or the next closest line
|
||||
that has any mappings. Otherwise, returns all mappings corresponding to the
|
||||
given line and either the column we are searching for or the next closest column
|
||||
that has any offsets.
|
||||
|
||||
The only argument is an object with the following properties:
|
||||
|
||||
* `source`: The filename of the original source.
|
||||
|
||||
* `line`: The line number in the original source.
|
||||
|
||||
* `column`: Optional. The column number in the original source.
|
||||
|
||||
and an array of objects is returned, each with the following properties:
|
||||
|
||||
* `line`: The line number in the generated source, or null.
|
||||
|
||||
* `column`: The column number in the generated source, or null.
|
||||
|
||||
```js
|
||||
consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1 },
|
||||
// { line: 2,
|
||||
// column: 10 },
|
||||
// { line: 2,
|
||||
// column: 20 } ]
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.hasContentsOfAllSources()
|
||||
|
||||
Return true if we have the embedded source content for every source listed in
|
||||
the source map, false otherwise.
|
||||
|
||||
In other words, if this method returns `true`, then
|
||||
`consumer.sourceContentFor(s)` will succeed for every source `s` in
|
||||
`consumer.sources`.
|
||||
|
||||
```js
|
||||
// ...
|
||||
if (consumer.hasContentsOfAllSources()) {
|
||||
consumerReadyCallback(consumer);
|
||||
} else {
|
||||
fetchSources(consumer, consumerReadyCallback);
|
||||
}
|
||||
// ...
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
|
||||
|
||||
Returns the original source content for the source provided. The only
|
||||
argument is the URL of the original source file.
|
||||
|
||||
If the source content for the given source is not found, then an error is
|
||||
thrown. Optionally, pass `true` as the second param to have `null` returned
|
||||
instead.
|
||||
|
||||
```js
|
||||
consumer.sources
|
||||
// [ "my-cool-lib.clj" ]
|
||||
|
||||
consumer.sourceContentFor("my-cool-lib.clj")
|
||||
// "..."
|
||||
|
||||
consumer.sourceContentFor("this is not in the source map");
|
||||
// Error: "this is not in the source map" is not in the source map
|
||||
|
||||
consumer.sourceContentFor("this is not in the source map", true);
|
||||
// null
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
|
||||
|
||||
Iterate over each mapping between an original source/line/column and a
|
||||
generated line/column in this source map.
|
||||
|
||||
* `callback`: The function that is called with each mapping. Mappings have the
|
||||
form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
|
||||
name }`
|
||||
|
||||
* `context`: Optional. If specified, this object will be the value of `this`
|
||||
every time that `callback` is called.
|
||||
|
||||
* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
|
||||
`SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
|
||||
the mappings sorted by the generated file's line/column order or the
|
||||
original's source/line/column order, respectively. Defaults to
|
||||
`SourceMapConsumer.GENERATED_ORDER`.
|
||||
|
||||
```js
|
||||
consumer.eachMapping(function (m) { console.log(m); })
|
||||
// ...
|
||||
// { source: 'illmatic.js',
|
||||
// generatedLine: 1,
|
||||
// generatedColumn: 0,
|
||||
// originalLine: 1,
|
||||
// originalColumn: 0,
|
||||
// name: null }
|
||||
// { source: 'illmatic.js',
|
||||
// generatedLine: 2,
|
||||
// generatedColumn: 0,
|
||||
// originalLine: 2,
|
||||
// originalColumn: 0,
|
||||
// name: null }
|
||||
// ...
|
||||
```
|
||||
### SourceMapGenerator
|
||||
|
||||
An instance of the SourceMapGenerator represents a source map which is being
|
||||
built incrementally.
|
||||
|
||||
#### new SourceMapGenerator([startOfSourceMap])
|
||||
|
||||
You may pass an object with the following properties:
|
||||
|
||||
* `file`: The filename of the generated source that this source map is
|
||||
associated with.
|
||||
|
||||
* `sourceRoot`: A root for all relative URLs in this source map.
|
||||
|
||||
* `skipValidation`: Optional. When `true`, disables validation of mappings as
|
||||
they are added. This can improve performance but should be used with
|
||||
discretion, as a last resort. Even then, one should avoid using this flag when
|
||||
running tests, if possible.
|
||||
|
||||
```js
|
||||
var generator = new sourceMap.SourceMapGenerator({
|
||||
file: "my-generated-javascript-file.js",
|
||||
sourceRoot: "http://example.com/app/js/"
|
||||
});
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.fromSourceMap(sourceMapConsumer)
|
||||
|
||||
Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance.
|
||||
|
||||
* `sourceMapConsumer` The SourceMap.
|
||||
|
||||
```js
|
||||
var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer);
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.addMapping(mapping)
|
||||
|
||||
Add a single mapping from original source line and column to the generated
|
||||
source's line and column for this source map being created. The mapping object
|
||||
should have the following properties:
|
||||
|
||||
* `generated`: An object with the generated line and column positions.
|
||||
|
||||
* `original`: An object with the original line and column positions.
|
||||
|
||||
* `source`: The original source file (relative to the sourceRoot).
|
||||
|
||||
* `name`: An optional original token name for this mapping.
|
||||
|
||||
```js
|
||||
generator.addMapping({
|
||||
source: "module-one.scm",
|
||||
original: { line: 128, column: 0 },
|
||||
generated: { line: 3, column: 456 }
|
||||
})
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
|
||||
|
||||
Set the source content for an original source file.
|
||||
|
||||
* `sourceFile` the URL of the original source file.
|
||||
|
||||
* `sourceContent` the content of the source file.
|
||||
|
||||
```js
|
||||
generator.setSourceContent("module-one.scm",
|
||||
fs.readFileSync("path/to/module-one.scm"))
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
|
||||
|
||||
Applies a SourceMap for a source file to the SourceMap.
|
||||
Each mapping to the supplied source file is rewritten using the
|
||||
supplied SourceMap. Note: The resolution for the resulting mappings
|
||||
is the minimum of this map and the supplied map.
|
||||
|
||||
* `sourceMapConsumer`: The SourceMap to be applied.
|
||||
|
||||
* `sourceFile`: Optional. The filename of the source file.
|
||||
If omitted, sourceMapConsumer.file will be used, if it exists.
|
||||
Otherwise an error will be thrown.
|
||||
|
||||
* `sourceMapPath`: Optional. The dirname of the path to the SourceMap
|
||||
to be applied. If relative, it is relative to the SourceMap.
|
||||
|
||||
This parameter is needed when the two SourceMaps aren't in the same
|
||||
directory, and the SourceMap to be applied contains relative source
|
||||
paths. If so, those relative source paths need to be rewritten
|
||||
relative to the SourceMap.
|
||||
|
||||
If omitted, it is assumed that both SourceMaps are in the same directory,
|
||||
thus not needing any rewriting. (Supplying `'.'` has the same effect.)
|
||||
|
||||
#### SourceMapGenerator.prototype.toString()
|
||||
|
||||
Renders the source map being generated to a string.
|
||||
|
||||
```js
|
||||
generator.toString()
|
||||
// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
|
||||
```
|
||||
|
||||
### SourceNode
|
||||
|
||||
SourceNodes provide a way to abstract over interpolating and/or concatenating
|
||||
snippets of generated JavaScript source code, while maintaining the line and
|
||||
column information associated between those snippets and the original source
|
||||
code. This is useful as the final intermediate representation a compiler might
|
||||
use before outputting the generated JS and source map.
|
||||
|
||||
#### new SourceNode([line, column, source[, chunk[, name]]])
|
||||
|
||||
* `line`: The original line number associated with this source node, or null if
|
||||
it isn't associated with an original line.
|
||||
|
||||
* `column`: The original column number associated with this source node, or null
|
||||
if it isn't associated with an original column.
|
||||
|
||||
* `source`: The original source's filename; null if no filename is provided.
|
||||
|
||||
* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
|
||||
below.
|
||||
|
||||
* `name`: Optional. The original identifier.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.cpp", [
|
||||
new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
|
||||
new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
|
||||
new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
|
||||
]);
|
||||
```
|
||||
|
||||
#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
|
||||
|
||||
Creates a SourceNode from generated code and a SourceMapConsumer.
|
||||
|
||||
* `code`: The generated code
|
||||
|
||||
* `sourceMapConsumer` The SourceMap for the generated code
|
||||
|
||||
* `relativePath` The optional path that relative sources in `sourceMapConsumer`
|
||||
should be relative to.
|
||||
|
||||
```js
|
||||
var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
|
||||
var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
|
||||
consumer);
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.add(chunk)
|
||||
|
||||
Add a chunk of generated JS to this source node.
|
||||
|
||||
* `chunk`: A string snippet of generated JS code, another instance of
|
||||
`SourceNode`, or an array where each member is one of those things.
|
||||
|
||||
```js
|
||||
node.add(" + ");
|
||||
node.add(otherNode);
|
||||
node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.prepend(chunk)
|
||||
|
||||
Prepend a chunk of generated JS to this source node.
|
||||
|
||||
* `chunk`: A string snippet of generated JS code, another instance of
|
||||
`SourceNode`, or an array where each member is one of those things.
|
||||
|
||||
```js
|
||||
node.prepend("/** Build Id: f783haef86324gf **/\n\n");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
|
||||
|
||||
Set the source content for a source file. This will be added to the
|
||||
`SourceMap` in the `sourcesContent` field.
|
||||
|
||||
* `sourceFile`: The filename of the source file
|
||||
|
||||
* `sourceContent`: The content of the source file
|
||||
|
||||
```js
|
||||
node.setSourceContent("module-one.scm",
|
||||
fs.readFileSync("path/to/module-one.scm"))
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.walk(fn)
|
||||
|
||||
Walk over the tree of JS snippets in this node and its children. The walking
|
||||
function is called once for each snippet of JS and is passed that snippet and
|
||||
the its original associated source's line/column location.
|
||||
|
||||
* `fn`: The traversal function.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.walk(function (code, loc) { console.log("WALK:", code, loc); })
|
||||
// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
|
||||
// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
|
||||
// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
|
||||
// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.walkSourceContents(fn)
|
||||
|
||||
Walk over the tree of SourceNodes. The walking function is called for each
|
||||
source file content and is passed the filename and source content.
|
||||
|
||||
* `fn`: The traversal function.
|
||||
|
||||
```js
|
||||
var a = new SourceNode(1, 2, "a.js", "generated from a");
|
||||
a.setSourceContent("a.js", "original a");
|
||||
var b = new SourceNode(1, 2, "b.js", "generated from b");
|
||||
b.setSourceContent("b.js", "original b");
|
||||
var c = new SourceNode(1, 2, "c.js", "generated from c");
|
||||
c.setSourceContent("c.js", "original c");
|
||||
|
||||
var node = new SourceNode(null, null, null, [a, b, c]);
|
||||
node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
|
||||
// WALK: a.js : original a
|
||||
// WALK: b.js : original b
|
||||
// WALK: c.js : original c
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.join(sep)
|
||||
|
||||
Like `Array.prototype.join` except for SourceNodes. Inserts the separator
|
||||
between each of this source node's children.
|
||||
|
||||
* `sep`: The separator.
|
||||
|
||||
```js
|
||||
var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
|
||||
var operand = new SourceNode(3, 4, "a.rs", "=");
|
||||
var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
|
||||
|
||||
var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
|
||||
var joinedNode = node.join(" ");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.replaceRight(pattern, replacement)
|
||||
|
||||
Call `String.prototype.replace` on the very right-most source snippet. Useful
|
||||
for trimming white space from the end of a source node, etc.
|
||||
|
||||
* `pattern`: The pattern to replace.
|
||||
|
||||
* `replacement`: The thing to replace the pattern with.
|
||||
|
||||
```js
|
||||
// Trim trailing white space.
|
||||
node.replaceRight(/\s*$/, "");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.toString()
|
||||
|
||||
Return the string representation of this source node. Walks over the tree and
|
||||
concatenates all the various snippets together to one string.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.toString()
|
||||
// 'unodostresquatro'
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
|
||||
|
||||
Returns the string representation of this tree of source nodes, plus a
|
||||
SourceMapGenerator which contains all the mappings between the generated and
|
||||
original sources.
|
||||
|
||||
The arguments are the same as those to `new SourceMapGenerator`.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.toStringWithSourceMap({ file: "my-output-file.js" })
|
||||
// { code: 'unodostresquatro',
|
||||
// map: [object SourceMapGenerator] }
|
||||
```
|
||||
3091
build/node_modules/babel-core/node_modules/source-map/dist/source-map.debug.js
generated
vendored
Normal file
3091
build/node_modules/babel-core/node_modules/source-map/dist/source-map.debug.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3090
build/node_modules/babel-core/node_modules/source-map/dist/source-map.js
generated
vendored
Normal file
3090
build/node_modules/babel-core/node_modules/source-map/dist/source-map.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
build/node_modules/babel-core/node_modules/source-map/dist/source-map.min.js
generated
vendored
Normal file
2
build/node_modules/babel-core/node_modules/source-map/dist/source-map.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
build/node_modules/babel-core/node_modules/source-map/dist/source-map.min.js.map
generated
vendored
Normal file
1
build/node_modules/babel-core/node_modules/source-map/dist/source-map.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
121
build/node_modules/babel-core/node_modules/source-map/lib/array-set.js
generated
vendored
Normal file
121
build/node_modules/babel-core/node_modules/source-map/lib/array-set.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var util = require('./util');
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
var hasNativeMap = typeof Map !== "undefined";
|
||||
|
||||
/**
|
||||
* A data structure which is a combination of an array and a set. Adding a new
|
||||
* member is O(1), testing for membership is O(1), and finding the index of an
|
||||
* element is O(1). Removing elements from the set is not supported. Only
|
||||
* strings are supported for membership.
|
||||
*/
|
||||
function ArraySet() {
|
||||
this._array = [];
|
||||
this._set = hasNativeMap ? new Map() : Object.create(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Static method for creating ArraySet instances from an existing array.
|
||||
*/
|
||||
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
|
||||
var set = new ArraySet();
|
||||
for (var i = 0, len = aArray.length; i < len; i++) {
|
||||
set.add(aArray[i], aAllowDuplicates);
|
||||
}
|
||||
return set;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return how many unique items are in this ArraySet. If duplicates have been
|
||||
* added, than those do not count towards the size.
|
||||
*
|
||||
* @returns Number
|
||||
*/
|
||||
ArraySet.prototype.size = function ArraySet_size() {
|
||||
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the given string to this set.
|
||||
*
|
||||
* @param String aStr
|
||||
*/
|
||||
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
|
||||
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
|
||||
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
|
||||
var idx = this._array.length;
|
||||
if (!isDuplicate || aAllowDuplicates) {
|
||||
this._array.push(aStr);
|
||||
}
|
||||
if (!isDuplicate) {
|
||||
if (hasNativeMap) {
|
||||
this._set.set(aStr, idx);
|
||||
} else {
|
||||
this._set[sStr] = idx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Is the given string a member of this set?
|
||||
*
|
||||
* @param String aStr
|
||||
*/
|
||||
ArraySet.prototype.has = function ArraySet_has(aStr) {
|
||||
if (hasNativeMap) {
|
||||
return this._set.has(aStr);
|
||||
} else {
|
||||
var sStr = util.toSetString(aStr);
|
||||
return has.call(this._set, sStr);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* What is the index of the given string in the array?
|
||||
*
|
||||
* @param String aStr
|
||||
*/
|
||||
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
|
||||
if (hasNativeMap) {
|
||||
var idx = this._set.get(aStr);
|
||||
if (idx >= 0) {
|
||||
return idx;
|
||||
}
|
||||
} else {
|
||||
var sStr = util.toSetString(aStr);
|
||||
if (has.call(this._set, sStr)) {
|
||||
return this._set[sStr];
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('"' + aStr + '" is not in the set.');
|
||||
};
|
||||
|
||||
/**
|
||||
* What is the element at the given index?
|
||||
*
|
||||
* @param Number aIdx
|
||||
*/
|
||||
ArraySet.prototype.at = function ArraySet_at(aIdx) {
|
||||
if (aIdx >= 0 && aIdx < this._array.length) {
|
||||
return this._array[aIdx];
|
||||
}
|
||||
throw new Error('No element indexed by ' + aIdx);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the array representation of this set (which has the proper indices
|
||||
* indicated by indexOf). Note that this is a copy of the internal array used
|
||||
* for storing the members so that no one can mess with internal state.
|
||||
*/
|
||||
ArraySet.prototype.toArray = function ArraySet_toArray() {
|
||||
return this._array.slice();
|
||||
};
|
||||
|
||||
exports.ArraySet = ArraySet;
|
||||
140
build/node_modules/babel-core/node_modules/source-map/lib/base64-vlq.js
generated
vendored
Normal file
140
build/node_modules/babel-core/node_modules/source-map/lib/base64-vlq.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* Based on the Base 64 VLQ implementation in Closure Compiler:
|
||||
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
|
||||
*
|
||||
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Google Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
var base64 = require('./base64');
|
||||
|
||||
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
|
||||
// length quantities we use in the source map spec, the first bit is the sign,
|
||||
// the next four bits are the actual value, and the 6th bit is the
|
||||
// continuation bit. The continuation bit tells us whether there are more
|
||||
// digits in this value following this digit.
|
||||
//
|
||||
// Continuation
|
||||
// | Sign
|
||||
// | |
|
||||
// V V
|
||||
// 101011
|
||||
|
||||
var VLQ_BASE_SHIFT = 5;
|
||||
|
||||
// binary: 100000
|
||||
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
||||
|
||||
// binary: 011111
|
||||
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
||||
|
||||
// binary: 100000
|
||||
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
||||
|
||||
/**
|
||||
* Converts from a two-complement value to a value where the sign bit is
|
||||
* placed in the least significant bit. For example, as decimals:
|
||||
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
|
||||
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
|
||||
*/
|
||||
function toVLQSigned(aValue) {
|
||||
return aValue < 0
|
||||
? ((-aValue) << 1) + 1
|
||||
: (aValue << 1) + 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts to a two-complement value from a value where the sign bit is
|
||||
* placed in the least significant bit. For example, as decimals:
|
||||
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
|
||||
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
|
||||
*/
|
||||
function fromVLQSigned(aValue) {
|
||||
var isNegative = (aValue & 1) === 1;
|
||||
var shifted = aValue >> 1;
|
||||
return isNegative
|
||||
? -shifted
|
||||
: shifted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base 64 VLQ encoded value.
|
||||
*/
|
||||
exports.encode = function base64VLQ_encode(aValue) {
|
||||
var encoded = "";
|
||||
var digit;
|
||||
|
||||
var vlq = toVLQSigned(aValue);
|
||||
|
||||
do {
|
||||
digit = vlq & VLQ_BASE_MASK;
|
||||
vlq >>>= VLQ_BASE_SHIFT;
|
||||
if (vlq > 0) {
|
||||
// There are still more digits in this value, so we must make sure the
|
||||
// continuation bit is marked.
|
||||
digit |= VLQ_CONTINUATION_BIT;
|
||||
}
|
||||
encoded += base64.encode(digit);
|
||||
} while (vlq > 0);
|
||||
|
||||
return encoded;
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes the next base 64 VLQ value from the given string and returns the
|
||||
* value and the rest of the string via the out parameter.
|
||||
*/
|
||||
exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
|
||||
var strLen = aStr.length;
|
||||
var result = 0;
|
||||
var shift = 0;
|
||||
var continuation, digit;
|
||||
|
||||
do {
|
||||
if (aIndex >= strLen) {
|
||||
throw new Error("Expected more digits in base 64 VLQ value.");
|
||||
}
|
||||
|
||||
digit = base64.decode(aStr.charCodeAt(aIndex++));
|
||||
if (digit === -1) {
|
||||
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
|
||||
}
|
||||
|
||||
continuation = !!(digit & VLQ_CONTINUATION_BIT);
|
||||
digit &= VLQ_BASE_MASK;
|
||||
result = result + (digit << shift);
|
||||
shift += VLQ_BASE_SHIFT;
|
||||
} while (continuation);
|
||||
|
||||
aOutParam.value = fromVLQSigned(result);
|
||||
aOutParam.rest = aIndex;
|
||||
};
|
||||
67
build/node_modules/babel-core/node_modules/source-map/lib/base64.js
generated
vendored
Normal file
67
build/node_modules/babel-core/node_modules/source-map/lib/base64.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
||||
|
||||
/**
|
||||
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
|
||||
*/
|
||||
exports.encode = function (number) {
|
||||
if (0 <= number && number < intToCharMap.length) {
|
||||
return intToCharMap[number];
|
||||
}
|
||||
throw new TypeError("Must be between 0 and 63: " + number);
|
||||
};
|
||||
|
||||
/**
|
||||
* Decode a single base 64 character code digit to an integer. Returns -1 on
|
||||
* failure.
|
||||
*/
|
||||
exports.decode = function (charCode) {
|
||||
var bigA = 65; // 'A'
|
||||
var bigZ = 90; // 'Z'
|
||||
|
||||
var littleA = 97; // 'a'
|
||||
var littleZ = 122; // 'z'
|
||||
|
||||
var zero = 48; // '0'
|
||||
var nine = 57; // '9'
|
||||
|
||||
var plus = 43; // '+'
|
||||
var slash = 47; // '/'
|
||||
|
||||
var littleOffset = 26;
|
||||
var numberOffset = 52;
|
||||
|
||||
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
if (bigA <= charCode && charCode <= bigZ) {
|
||||
return (charCode - bigA);
|
||||
}
|
||||
|
||||
// 26 - 51: abcdefghijklmnopqrstuvwxyz
|
||||
if (littleA <= charCode && charCode <= littleZ) {
|
||||
return (charCode - littleA + littleOffset);
|
||||
}
|
||||
|
||||
// 52 - 61: 0123456789
|
||||
if (zero <= charCode && charCode <= nine) {
|
||||
return (charCode - zero + numberOffset);
|
||||
}
|
||||
|
||||
// 62: +
|
||||
if (charCode == plus) {
|
||||
return 62;
|
||||
}
|
||||
|
||||
// 63: /
|
||||
if (charCode == slash) {
|
||||
return 63;
|
||||
}
|
||||
|
||||
// Invalid base64 digit.
|
||||
return -1;
|
||||
};
|
||||
111
build/node_modules/babel-core/node_modules/source-map/lib/binary-search.js
generated
vendored
Normal file
111
build/node_modules/babel-core/node_modules/source-map/lib/binary-search.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
exports.GREATEST_LOWER_BOUND = 1;
|
||||
exports.LEAST_UPPER_BOUND = 2;
|
||||
|
||||
/**
|
||||
* Recursive implementation of binary search.
|
||||
*
|
||||
* @param aLow Indices here and lower do not contain the needle.
|
||||
* @param aHigh Indices here and higher do not contain the needle.
|
||||
* @param aNeedle The element being searched for.
|
||||
* @param aHaystack The non-empty array being searched.
|
||||
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
|
||||
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
||||
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
||||
* closest element that is smaller than or greater than the one we are
|
||||
* searching for, respectively, if the exact element cannot be found.
|
||||
*/
|
||||
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
|
||||
// This function terminates when one of the following is true:
|
||||
//
|
||||
// 1. We find the exact element we are looking for.
|
||||
//
|
||||
// 2. We did not find the exact element, but we can return the index of
|
||||
// the next-closest element.
|
||||
//
|
||||
// 3. We did not find the exact element, and there is no next-closest
|
||||
// element than the one we are searching for, so we return -1.
|
||||
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
|
||||
var cmp = aCompare(aNeedle, aHaystack[mid], true);
|
||||
if (cmp === 0) {
|
||||
// Found the element we are looking for.
|
||||
return mid;
|
||||
}
|
||||
else if (cmp > 0) {
|
||||
// Our needle is greater than aHaystack[mid].
|
||||
if (aHigh - mid > 1) {
|
||||
// The element is in the upper half.
|
||||
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
|
||||
}
|
||||
|
||||
// The exact needle element was not found in this haystack. Determine if
|
||||
// we are in termination case (3) or (2) and return the appropriate thing.
|
||||
if (aBias == exports.LEAST_UPPER_BOUND) {
|
||||
return aHigh < aHaystack.length ? aHigh : -1;
|
||||
} else {
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Our needle is less than aHaystack[mid].
|
||||
if (mid - aLow > 1) {
|
||||
// The element is in the lower half.
|
||||
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
|
||||
}
|
||||
|
||||
// we are in termination case (3) or (2) and return the appropriate thing.
|
||||
if (aBias == exports.LEAST_UPPER_BOUND) {
|
||||
return mid;
|
||||
} else {
|
||||
return aLow < 0 ? -1 : aLow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an implementation of binary search which will always try and return
|
||||
* the index of the closest element if there is no exact hit. This is because
|
||||
* mappings between original and generated line/col pairs are single points,
|
||||
* and there is an implicit region between each of them, so a miss just means
|
||||
* that you aren't on the very start of a region.
|
||||
*
|
||||
* @param aNeedle The element you are looking for.
|
||||
* @param aHaystack The array that is being searched.
|
||||
* @param aCompare A function which takes the needle and an element in the
|
||||
* array and returns -1, 0, or 1 depending on whether the needle is less
|
||||
* than, equal to, or greater than the element, respectively.
|
||||
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
|
||||
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
|
||||
* closest element that is smaller than or greater than the one we are
|
||||
* searching for, respectively, if the exact element cannot be found.
|
||||
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
|
||||
*/
|
||||
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
|
||||
if (aHaystack.length === 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
|
||||
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
|
||||
if (index < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// We have found either the exact element, or the next-closest element than
|
||||
// the one we are searching for. However, there may be more than one such
|
||||
// element. Make sure we always return the smallest of these.
|
||||
while (index - 1 >= 0) {
|
||||
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
|
||||
break;
|
||||
}
|
||||
--index;
|
||||
}
|
||||
|
||||
return index;
|
||||
};
|
||||
79
build/node_modules/babel-core/node_modules/source-map/lib/mapping-list.js
generated
vendored
Normal file
79
build/node_modules/babel-core/node_modules/source-map/lib/mapping-list.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2014 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
/**
|
||||
* Determine whether mappingB is after mappingA with respect to generated
|
||||
* position.
|
||||
*/
|
||||
function generatedPositionAfter(mappingA, mappingB) {
|
||||
// Optimized for most common case
|
||||
var lineA = mappingA.generatedLine;
|
||||
var lineB = mappingB.generatedLine;
|
||||
var columnA = mappingA.generatedColumn;
|
||||
var columnB = mappingB.generatedColumn;
|
||||
return lineB > lineA || lineB == lineA && columnB >= columnA ||
|
||||
util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* A data structure to provide a sorted view of accumulated mappings in a
|
||||
* performance conscious manner. It trades a neglibable overhead in general
|
||||
* case for a large speedup in case of mappings being added in order.
|
||||
*/
|
||||
function MappingList() {
|
||||
this._array = [];
|
||||
this._sorted = true;
|
||||
// Serves as infimum
|
||||
this._last = {generatedLine: -1, generatedColumn: 0};
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through internal items. This method takes the same arguments that
|
||||
* `Array.prototype.forEach` takes.
|
||||
*
|
||||
* NOTE: The order of the mappings is NOT guaranteed.
|
||||
*/
|
||||
MappingList.prototype.unsortedForEach =
|
||||
function MappingList_forEach(aCallback, aThisArg) {
|
||||
this._array.forEach(aCallback, aThisArg);
|
||||
};
|
||||
|
||||
/**
|
||||
* Add the given source mapping.
|
||||
*
|
||||
* @param Object aMapping
|
||||
*/
|
||||
MappingList.prototype.add = function MappingList_add(aMapping) {
|
||||
if (generatedPositionAfter(this._last, aMapping)) {
|
||||
this._last = aMapping;
|
||||
this._array.push(aMapping);
|
||||
} else {
|
||||
this._sorted = false;
|
||||
this._array.push(aMapping);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the flat, sorted array of mappings. The mappings are sorted by
|
||||
* generated position.
|
||||
*
|
||||
* WARNING: This method returns internal data without copying, for
|
||||
* performance. The return value must NOT be mutated, and should be treated as
|
||||
* an immutable borrow. If you want to take ownership, you must make your own
|
||||
* copy.
|
||||
*/
|
||||
MappingList.prototype.toArray = function MappingList_toArray() {
|
||||
if (!this._sorted) {
|
||||
this._array.sort(util.compareByGeneratedPositionsInflated);
|
||||
this._sorted = true;
|
||||
}
|
||||
return this._array;
|
||||
};
|
||||
|
||||
exports.MappingList = MappingList;
|
||||
114
build/node_modules/babel-core/node_modules/source-map/lib/quick-sort.js
generated
vendored
Normal file
114
build/node_modules/babel-core/node_modules/source-map/lib/quick-sort.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
// It turns out that some (most?) JavaScript engines don't self-host
|
||||
// `Array.prototype.sort`. This makes sense because C++ will likely remain
|
||||
// faster than JS when doing raw CPU-intensive sorting. However, when using a
|
||||
// custom comparator function, calling back and forth between the VM's C++ and
|
||||
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
|
||||
// worse generated code for the comparator function than would be optimal. In
|
||||
// fact, when sorting with a comparator, these costs outweigh the benefits of
|
||||
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
|
||||
// a ~3500ms mean speed-up in `bench/bench.html`.
|
||||
|
||||
/**
|
||||
* Swap the elements indexed by `x` and `y` in the array `ary`.
|
||||
*
|
||||
* @param {Array} ary
|
||||
* The array.
|
||||
* @param {Number} x
|
||||
* The index of the first item.
|
||||
* @param {Number} y
|
||||
* The index of the second item.
|
||||
*/
|
||||
function swap(ary, x, y) {
|
||||
var temp = ary[x];
|
||||
ary[x] = ary[y];
|
||||
ary[y] = temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a random integer within the range `low .. high` inclusive.
|
||||
*
|
||||
* @param {Number} low
|
||||
* The lower bound on the range.
|
||||
* @param {Number} high
|
||||
* The upper bound on the range.
|
||||
*/
|
||||
function randomIntInRange(low, high) {
|
||||
return Math.round(low + (Math.random() * (high - low)));
|
||||
}
|
||||
|
||||
/**
|
||||
* The Quick Sort algorithm.
|
||||
*
|
||||
* @param {Array} ary
|
||||
* An array to sort.
|
||||
* @param {function} comparator
|
||||
* Function to use to compare two items.
|
||||
* @param {Number} p
|
||||
* Start index of the array
|
||||
* @param {Number} r
|
||||
* End index of the array
|
||||
*/
|
||||
function doQuickSort(ary, comparator, p, r) {
|
||||
// If our lower bound is less than our upper bound, we (1) partition the
|
||||
// array into two pieces and (2) recurse on each half. If it is not, this is
|
||||
// the empty array and our base case.
|
||||
|
||||
if (p < r) {
|
||||
// (1) Partitioning.
|
||||
//
|
||||
// The partitioning chooses a pivot between `p` and `r` and moves all
|
||||
// elements that are less than or equal to the pivot to the before it, and
|
||||
// all the elements that are greater than it after it. The effect is that
|
||||
// once partition is done, the pivot is in the exact place it will be when
|
||||
// the array is put in sorted order, and it will not need to be moved
|
||||
// again. This runs in O(n) time.
|
||||
|
||||
// Always choose a random pivot so that an input array which is reverse
|
||||
// sorted does not cause O(n^2) running time.
|
||||
var pivotIndex = randomIntInRange(p, r);
|
||||
var i = p - 1;
|
||||
|
||||
swap(ary, pivotIndex, r);
|
||||
var pivot = ary[r];
|
||||
|
||||
// Immediately after `j` is incremented in this loop, the following hold
|
||||
// true:
|
||||
//
|
||||
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
|
||||
//
|
||||
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
|
||||
for (var j = p; j < r; j++) {
|
||||
if (comparator(ary[j], pivot) <= 0) {
|
||||
i += 1;
|
||||
swap(ary, i, j);
|
||||
}
|
||||
}
|
||||
|
||||
swap(ary, i + 1, j);
|
||||
var q = i + 1;
|
||||
|
||||
// (2) Recurse on each half.
|
||||
|
||||
doQuickSort(ary, comparator, p, q - 1);
|
||||
doQuickSort(ary, comparator, q + 1, r);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the given array in-place with the given comparator function.
|
||||
*
|
||||
* @param {Array} ary
|
||||
* An array to sort.
|
||||
* @param {function} comparator
|
||||
* Function to use to compare two items.
|
||||
*/
|
||||
exports.quickSort = function (ary, comparator) {
|
||||
doQuickSort(ary, comparator, 0, ary.length - 1);
|
||||
};
|
||||
1082
build/node_modules/babel-core/node_modules/source-map/lib/source-map-consumer.js
generated
vendored
Normal file
1082
build/node_modules/babel-core/node_modules/source-map/lib/source-map-consumer.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
416
build/node_modules/babel-core/node_modules/source-map/lib/source-map-generator.js
generated
vendored
Normal file
416
build/node_modules/babel-core/node_modules/source-map/lib/source-map-generator.js
generated
vendored
Normal file
@@ -0,0 +1,416 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var base64VLQ = require('./base64-vlq');
|
||||
var util = require('./util');
|
||||
var ArraySet = require('./array-set').ArraySet;
|
||||
var MappingList = require('./mapping-list').MappingList;
|
||||
|
||||
/**
|
||||
* An instance of the SourceMapGenerator represents a source map which is
|
||||
* being built incrementally. You may pass an object with the following
|
||||
* properties:
|
||||
*
|
||||
* - file: The filename of the generated source.
|
||||
* - sourceRoot: A root for all relative URLs in this source map.
|
||||
*/
|
||||
function SourceMapGenerator(aArgs) {
|
||||
if (!aArgs) {
|
||||
aArgs = {};
|
||||
}
|
||||
this._file = util.getArg(aArgs, 'file', null);
|
||||
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
|
||||
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
|
||||
this._sources = new ArraySet();
|
||||
this._names = new ArraySet();
|
||||
this._mappings = new MappingList();
|
||||
this._sourcesContents = null;
|
||||
}
|
||||
|
||||
SourceMapGenerator.prototype._version = 3;
|
||||
|
||||
/**
|
||||
* Creates a new SourceMapGenerator based on a SourceMapConsumer
|
||||
*
|
||||
* @param aSourceMapConsumer The SourceMap.
|
||||
*/
|
||||
SourceMapGenerator.fromSourceMap =
|
||||
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
|
||||
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
||||
var generator = new SourceMapGenerator({
|
||||
file: aSourceMapConsumer.file,
|
||||
sourceRoot: sourceRoot
|
||||
});
|
||||
aSourceMapConsumer.eachMapping(function (mapping) {
|
||||
var newMapping = {
|
||||
generated: {
|
||||
line: mapping.generatedLine,
|
||||
column: mapping.generatedColumn
|
||||
}
|
||||
};
|
||||
|
||||
if (mapping.source != null) {
|
||||
newMapping.source = mapping.source;
|
||||
if (sourceRoot != null) {
|
||||
newMapping.source = util.relative(sourceRoot, newMapping.source);
|
||||
}
|
||||
|
||||
newMapping.original = {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn
|
||||
};
|
||||
|
||||
if (mapping.name != null) {
|
||||
newMapping.name = mapping.name;
|
||||
}
|
||||
}
|
||||
|
||||
generator.addMapping(newMapping);
|
||||
});
|
||||
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
||||
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
||||
if (content != null) {
|
||||
generator.setSourceContent(sourceFile, content);
|
||||
}
|
||||
});
|
||||
return generator;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a single mapping from original source line and column to the generated
|
||||
* source's line and column for this source map being created. The mapping
|
||||
* object should have the following properties:
|
||||
*
|
||||
* - generated: An object with the generated line and column positions.
|
||||
* - original: An object with the original line and column positions.
|
||||
* - source: The original source file (relative to the sourceRoot).
|
||||
* - name: An optional original token name for this mapping.
|
||||
*/
|
||||
SourceMapGenerator.prototype.addMapping =
|
||||
function SourceMapGenerator_addMapping(aArgs) {
|
||||
var generated = util.getArg(aArgs, 'generated');
|
||||
var original = util.getArg(aArgs, 'original', null);
|
||||
var source = util.getArg(aArgs, 'source', null);
|
||||
var name = util.getArg(aArgs, 'name', null);
|
||||
|
||||
if (!this._skipValidation) {
|
||||
this._validateMapping(generated, original, source, name);
|
||||
}
|
||||
|
||||
if (source != null) {
|
||||
source = String(source);
|
||||
if (!this._sources.has(source)) {
|
||||
this._sources.add(source);
|
||||
}
|
||||
}
|
||||
|
||||
if (name != null) {
|
||||
name = String(name);
|
||||
if (!this._names.has(name)) {
|
||||
this._names.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
this._mappings.add({
|
||||
generatedLine: generated.line,
|
||||
generatedColumn: generated.column,
|
||||
originalLine: original != null && original.line,
|
||||
originalColumn: original != null && original.column,
|
||||
source: source,
|
||||
name: name
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the source content for a source file.
|
||||
*/
|
||||
SourceMapGenerator.prototype.setSourceContent =
|
||||
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
|
||||
var source = aSourceFile;
|
||||
if (this._sourceRoot != null) {
|
||||
source = util.relative(this._sourceRoot, source);
|
||||
}
|
||||
|
||||
if (aSourceContent != null) {
|
||||
// Add the source content to the _sourcesContents map.
|
||||
// Create a new _sourcesContents map if the property is null.
|
||||
if (!this._sourcesContents) {
|
||||
this._sourcesContents = Object.create(null);
|
||||
}
|
||||
this._sourcesContents[util.toSetString(source)] = aSourceContent;
|
||||
} else if (this._sourcesContents) {
|
||||
// Remove the source file from the _sourcesContents map.
|
||||
// If the _sourcesContents map is empty, set the property to null.
|
||||
delete this._sourcesContents[util.toSetString(source)];
|
||||
if (Object.keys(this._sourcesContents).length === 0) {
|
||||
this._sourcesContents = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Applies the mappings of a sub-source-map for a specific source file to the
|
||||
* source map being generated. Each mapping to the supplied source file is
|
||||
* rewritten using the supplied source map. Note: The resolution for the
|
||||
* resulting mappings is the minimium of this map and the supplied map.
|
||||
*
|
||||
* @param aSourceMapConsumer The source map to be applied.
|
||||
* @param aSourceFile Optional. The filename of the source file.
|
||||
* If omitted, SourceMapConsumer's file property will be used.
|
||||
* @param aSourceMapPath Optional. The dirname of the path to the source map
|
||||
* to be applied. If relative, it is relative to the SourceMapConsumer.
|
||||
* This parameter is needed when the two source maps aren't in the same
|
||||
* directory, and the source map to be applied contains relative source
|
||||
* paths. If so, those relative source paths need to be rewritten
|
||||
* relative to the SourceMapGenerator.
|
||||
*/
|
||||
SourceMapGenerator.prototype.applySourceMap =
|
||||
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
|
||||
var sourceFile = aSourceFile;
|
||||
// If aSourceFile is omitted, we will use the file property of the SourceMap
|
||||
if (aSourceFile == null) {
|
||||
if (aSourceMapConsumer.file == null) {
|
||||
throw new Error(
|
||||
'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
|
||||
'or the source map\'s "file" property. Both were omitted.'
|
||||
);
|
||||
}
|
||||
sourceFile = aSourceMapConsumer.file;
|
||||
}
|
||||
var sourceRoot = this._sourceRoot;
|
||||
// Make "sourceFile" relative if an absolute Url is passed.
|
||||
if (sourceRoot != null) {
|
||||
sourceFile = util.relative(sourceRoot, sourceFile);
|
||||
}
|
||||
// Applying the SourceMap can add and remove items from the sources and
|
||||
// the names array.
|
||||
var newSources = new ArraySet();
|
||||
var newNames = new ArraySet();
|
||||
|
||||
// Find mappings for the "sourceFile"
|
||||
this._mappings.unsortedForEach(function (mapping) {
|
||||
if (mapping.source === sourceFile && mapping.originalLine != null) {
|
||||
// Check if it can be mapped by the source map, then update the mapping.
|
||||
var original = aSourceMapConsumer.originalPositionFor({
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn
|
||||
});
|
||||
if (original.source != null) {
|
||||
// Copy mapping
|
||||
mapping.source = original.source;
|
||||
if (aSourceMapPath != null) {
|
||||
mapping.source = util.join(aSourceMapPath, mapping.source)
|
||||
}
|
||||
if (sourceRoot != null) {
|
||||
mapping.source = util.relative(sourceRoot, mapping.source);
|
||||
}
|
||||
mapping.originalLine = original.line;
|
||||
mapping.originalColumn = original.column;
|
||||
if (original.name != null) {
|
||||
mapping.name = original.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var source = mapping.source;
|
||||
if (source != null && !newSources.has(source)) {
|
||||
newSources.add(source);
|
||||
}
|
||||
|
||||
var name = mapping.name;
|
||||
if (name != null && !newNames.has(name)) {
|
||||
newNames.add(name);
|
||||
}
|
||||
|
||||
}, this);
|
||||
this._sources = newSources;
|
||||
this._names = newNames;
|
||||
|
||||
// Copy sourcesContents of applied map.
|
||||
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
||||
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
||||
if (content != null) {
|
||||
if (aSourceMapPath != null) {
|
||||
sourceFile = util.join(aSourceMapPath, sourceFile);
|
||||
}
|
||||
if (sourceRoot != null) {
|
||||
sourceFile = util.relative(sourceRoot, sourceFile);
|
||||
}
|
||||
this.setSourceContent(sourceFile, content);
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* A mapping can have one of the three levels of data:
|
||||
*
|
||||
* 1. Just the generated position.
|
||||
* 2. The Generated position, original position, and original source.
|
||||
* 3. Generated and original position, original source, as well as a name
|
||||
* token.
|
||||
*
|
||||
* To maintain consistency, we validate that any new mapping being added falls
|
||||
* in to one of these categories.
|
||||
*/
|
||||
SourceMapGenerator.prototype._validateMapping =
|
||||
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
|
||||
aName) {
|
||||
// When aOriginal is truthy but has empty values for .line and .column,
|
||||
// it is most likely a programmer error. In this case we throw a very
|
||||
// specific error message to try to guide them the right way.
|
||||
// For example: https://github.com/Polymer/polymer-bundler/pull/519
|
||||
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
|
||||
throw new Error(
|
||||
'original.line and original.column are not numbers -- you probably meant to omit ' +
|
||||
'the original mapping entirely and only map the generated position. If so, pass ' +
|
||||
'null for the original mapping instead of an object with empty or null values.'
|
||||
);
|
||||
}
|
||||
|
||||
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
||||
&& aGenerated.line > 0 && aGenerated.column >= 0
|
||||
&& !aOriginal && !aSource && !aName) {
|
||||
// Case 1.
|
||||
return;
|
||||
}
|
||||
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
||||
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
|
||||
&& aGenerated.line > 0 && aGenerated.column >= 0
|
||||
&& aOriginal.line > 0 && aOriginal.column >= 0
|
||||
&& aSource) {
|
||||
// Cases 2 and 3.
|
||||
return;
|
||||
}
|
||||
else {
|
||||
throw new Error('Invalid mapping: ' + JSON.stringify({
|
||||
generated: aGenerated,
|
||||
source: aSource,
|
||||
original: aOriginal,
|
||||
name: aName
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Serialize the accumulated mappings in to the stream of base 64 VLQs
|
||||
* specified by the source map format.
|
||||
*/
|
||||
SourceMapGenerator.prototype._serializeMappings =
|
||||
function SourceMapGenerator_serializeMappings() {
|
||||
var previousGeneratedColumn = 0;
|
||||
var previousGeneratedLine = 1;
|
||||
var previousOriginalColumn = 0;
|
||||
var previousOriginalLine = 0;
|
||||
var previousName = 0;
|
||||
var previousSource = 0;
|
||||
var result = '';
|
||||
var next;
|
||||
var mapping;
|
||||
var nameIdx;
|
||||
var sourceIdx;
|
||||
|
||||
var mappings = this._mappings.toArray();
|
||||
for (var i = 0, len = mappings.length; i < len; i++) {
|
||||
mapping = mappings[i];
|
||||
next = ''
|
||||
|
||||
if (mapping.generatedLine !== previousGeneratedLine) {
|
||||
previousGeneratedColumn = 0;
|
||||
while (mapping.generatedLine !== previousGeneratedLine) {
|
||||
next += ';';
|
||||
previousGeneratedLine++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (i > 0) {
|
||||
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
|
||||
continue;
|
||||
}
|
||||
next += ',';
|
||||
}
|
||||
}
|
||||
|
||||
next += base64VLQ.encode(mapping.generatedColumn
|
||||
- previousGeneratedColumn);
|
||||
previousGeneratedColumn = mapping.generatedColumn;
|
||||
|
||||
if (mapping.source != null) {
|
||||
sourceIdx = this._sources.indexOf(mapping.source);
|
||||
next += base64VLQ.encode(sourceIdx - previousSource);
|
||||
previousSource = sourceIdx;
|
||||
|
||||
// lines are stored 0-based in SourceMap spec version 3
|
||||
next += base64VLQ.encode(mapping.originalLine - 1
|
||||
- previousOriginalLine);
|
||||
previousOriginalLine = mapping.originalLine - 1;
|
||||
|
||||
next += base64VLQ.encode(mapping.originalColumn
|
||||
- previousOriginalColumn);
|
||||
previousOriginalColumn = mapping.originalColumn;
|
||||
|
||||
if (mapping.name != null) {
|
||||
nameIdx = this._names.indexOf(mapping.name);
|
||||
next += base64VLQ.encode(nameIdx - previousName);
|
||||
previousName = nameIdx;
|
||||
}
|
||||
}
|
||||
|
||||
result += next;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
SourceMapGenerator.prototype._generateSourcesContent =
|
||||
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
|
||||
return aSources.map(function (source) {
|
||||
if (!this._sourcesContents) {
|
||||
return null;
|
||||
}
|
||||
if (aSourceRoot != null) {
|
||||
source = util.relative(aSourceRoot, source);
|
||||
}
|
||||
var key = util.toSetString(source);
|
||||
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
|
||||
? this._sourcesContents[key]
|
||||
: null;
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Externalize the source map.
|
||||
*/
|
||||
SourceMapGenerator.prototype.toJSON =
|
||||
function SourceMapGenerator_toJSON() {
|
||||
var map = {
|
||||
version: this._version,
|
||||
sources: this._sources.toArray(),
|
||||
names: this._names.toArray(),
|
||||
mappings: this._serializeMappings()
|
||||
};
|
||||
if (this._file != null) {
|
||||
map.file = this._file;
|
||||
}
|
||||
if (this._sourceRoot != null) {
|
||||
map.sourceRoot = this._sourceRoot;
|
||||
}
|
||||
if (this._sourcesContents) {
|
||||
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
|
||||
}
|
||||
|
||||
return map;
|
||||
};
|
||||
|
||||
/**
|
||||
* Render the source map being generated to a string.
|
||||
*/
|
||||
SourceMapGenerator.prototype.toString =
|
||||
function SourceMapGenerator_toString() {
|
||||
return JSON.stringify(this.toJSON());
|
||||
};
|
||||
|
||||
exports.SourceMapGenerator = SourceMapGenerator;
|
||||
413
build/node_modules/babel-core/node_modules/source-map/lib/source-node.js
generated
vendored
Normal file
413
build/node_modules/babel-core/node_modules/source-map/lib/source-node.js
generated
vendored
Normal file
@@ -0,0 +1,413 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
|
||||
var util = require('./util');
|
||||
|
||||
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
|
||||
// operating systems these days (capturing the result).
|
||||
var REGEX_NEWLINE = /(\r?\n)/;
|
||||
|
||||
// Newline character code for charCodeAt() comparisons
|
||||
var NEWLINE_CODE = 10;
|
||||
|
||||
// Private symbol for identifying `SourceNode`s when multiple versions of
|
||||
// the source-map library are loaded. This MUST NOT CHANGE across
|
||||
// versions!
|
||||
var isSourceNode = "$$$isSourceNode$$$";
|
||||
|
||||
/**
|
||||
* SourceNodes provide a way to abstract over interpolating/concatenating
|
||||
* snippets of generated JavaScript source code while maintaining the line and
|
||||
* column information associated with the original source code.
|
||||
*
|
||||
* @param aLine The original line number.
|
||||
* @param aColumn The original column number.
|
||||
* @param aSource The original source's filename.
|
||||
* @param aChunks Optional. An array of strings which are snippets of
|
||||
* generated JS, or other SourceNodes.
|
||||
* @param aName The original identifier.
|
||||
*/
|
||||
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
|
||||
this.children = [];
|
||||
this.sourceContents = {};
|
||||
this.line = aLine == null ? null : aLine;
|
||||
this.column = aColumn == null ? null : aColumn;
|
||||
this.source = aSource == null ? null : aSource;
|
||||
this.name = aName == null ? null : aName;
|
||||
this[isSourceNode] = true;
|
||||
if (aChunks != null) this.add(aChunks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a SourceNode from generated code and a SourceMapConsumer.
|
||||
*
|
||||
* @param aGeneratedCode The generated code
|
||||
* @param aSourceMapConsumer The SourceMap for the generated code
|
||||
* @param aRelativePath Optional. The path that relative sources in the
|
||||
* SourceMapConsumer should be relative to.
|
||||
*/
|
||||
SourceNode.fromStringWithSourceMap =
|
||||
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
|
||||
// The SourceNode we want to fill with the generated code
|
||||
// and the SourceMap
|
||||
var node = new SourceNode();
|
||||
|
||||
// All even indices of this array are one line of the generated code,
|
||||
// while all odd indices are the newlines between two adjacent lines
|
||||
// (since `REGEX_NEWLINE` captures its match).
|
||||
// Processed fragments are accessed by calling `shiftNextLine`.
|
||||
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
|
||||
var remainingLinesIndex = 0;
|
||||
var shiftNextLine = function() {
|
||||
var lineContents = getNextLine();
|
||||
// The last line of a file might not have a newline.
|
||||
var newLine = getNextLine() || "";
|
||||
return lineContents + newLine;
|
||||
|
||||
function getNextLine() {
|
||||
return remainingLinesIndex < remainingLines.length ?
|
||||
remainingLines[remainingLinesIndex++] : undefined;
|
||||
}
|
||||
};
|
||||
|
||||
// We need to remember the position of "remainingLines"
|
||||
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
||||
|
||||
// The generate SourceNodes we need a code range.
|
||||
// To extract it current and last mapping is used.
|
||||
// Here we store the last mapping.
|
||||
var lastMapping = null;
|
||||
|
||||
aSourceMapConsumer.eachMapping(function (mapping) {
|
||||
if (lastMapping !== null) {
|
||||
// We add the code from "lastMapping" to "mapping":
|
||||
// First check if there is a new line in between.
|
||||
if (lastGeneratedLine < mapping.generatedLine) {
|
||||
// Associate first line with "lastMapping"
|
||||
addMappingWithCode(lastMapping, shiftNextLine());
|
||||
lastGeneratedLine++;
|
||||
lastGeneratedColumn = 0;
|
||||
// The remaining code is added without mapping
|
||||
} else {
|
||||
// There is no new line in between.
|
||||
// Associate the code between "lastGeneratedColumn" and
|
||||
// "mapping.generatedColumn" with "lastMapping"
|
||||
var nextLine = remainingLines[remainingLinesIndex];
|
||||
var code = nextLine.substr(0, mapping.generatedColumn -
|
||||
lastGeneratedColumn);
|
||||
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
|
||||
lastGeneratedColumn);
|
||||
lastGeneratedColumn = mapping.generatedColumn;
|
||||
addMappingWithCode(lastMapping, code);
|
||||
// No more remaining code, continue
|
||||
lastMapping = mapping;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// We add the generated code until the first mapping
|
||||
// to the SourceNode without any mapping.
|
||||
// Each line is added as separate string.
|
||||
while (lastGeneratedLine < mapping.generatedLine) {
|
||||
node.add(shiftNextLine());
|
||||
lastGeneratedLine++;
|
||||
}
|
||||
if (lastGeneratedColumn < mapping.generatedColumn) {
|
||||
var nextLine = remainingLines[remainingLinesIndex];
|
||||
node.add(nextLine.substr(0, mapping.generatedColumn));
|
||||
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
|
||||
lastGeneratedColumn = mapping.generatedColumn;
|
||||
}
|
||||
lastMapping = mapping;
|
||||
}, this);
|
||||
// We have processed all mappings.
|
||||
if (remainingLinesIndex < remainingLines.length) {
|
||||
if (lastMapping) {
|
||||
// Associate the remaining code in the current line with "lastMapping"
|
||||
addMappingWithCode(lastMapping, shiftNextLine());
|
||||
}
|
||||
// and add the remaining lines without any mapping
|
||||
node.add(remainingLines.splice(remainingLinesIndex).join(""));
|
||||
}
|
||||
|
||||
// Copy sourcesContent into SourceNode
|
||||
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
||||
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
||||
if (content != null) {
|
||||
if (aRelativePath != null) {
|
||||
sourceFile = util.join(aRelativePath, sourceFile);
|
||||
}
|
||||
node.setSourceContent(sourceFile, content);
|
||||
}
|
||||
});
|
||||
|
||||
return node;
|
||||
|
||||
function addMappingWithCode(mapping, code) {
|
||||
if (mapping === null || mapping.source === undefined) {
|
||||
node.add(code);
|
||||
} else {
|
||||
var source = aRelativePath
|
||||
? util.join(aRelativePath, mapping.source)
|
||||
: mapping.source;
|
||||
node.add(new SourceNode(mapping.originalLine,
|
||||
mapping.originalColumn,
|
||||
source,
|
||||
code,
|
||||
mapping.name));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a chunk of generated JS to this source node.
|
||||
*
|
||||
* @param aChunk A string snippet of generated JS code, another instance of
|
||||
* SourceNode, or an array where each member is one of those things.
|
||||
*/
|
||||
SourceNode.prototype.add = function SourceNode_add(aChunk) {
|
||||
if (Array.isArray(aChunk)) {
|
||||
aChunk.forEach(function (chunk) {
|
||||
this.add(chunk);
|
||||
}, this);
|
||||
}
|
||||
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
||||
if (aChunk) {
|
||||
this.children.push(aChunk);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new TypeError(
|
||||
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
||||
);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a chunk of generated JS to the beginning of this source node.
|
||||
*
|
||||
* @param aChunk A string snippet of generated JS code, another instance of
|
||||
* SourceNode, or an array where each member is one of those things.
|
||||
*/
|
||||
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
|
||||
if (Array.isArray(aChunk)) {
|
||||
for (var i = aChunk.length-1; i >= 0; i--) {
|
||||
this.prepend(aChunk[i]);
|
||||
}
|
||||
}
|
||||
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
|
||||
this.children.unshift(aChunk);
|
||||
}
|
||||
else {
|
||||
throw new TypeError(
|
||||
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
||||
);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Walk over the tree of JS snippets in this node and its children. The
|
||||
* walking function is called once for each snippet of JS and is passed that
|
||||
* snippet and the its original associated source's line/column location.
|
||||
*
|
||||
* @param aFn The traversal function.
|
||||
*/
|
||||
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
|
||||
var chunk;
|
||||
for (var i = 0, len = this.children.length; i < len; i++) {
|
||||
chunk = this.children[i];
|
||||
if (chunk[isSourceNode]) {
|
||||
chunk.walk(aFn);
|
||||
}
|
||||
else {
|
||||
if (chunk !== '') {
|
||||
aFn(chunk, { source: this.source,
|
||||
line: this.line,
|
||||
column: this.column,
|
||||
name: this.name });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
|
||||
* each of `this.children`.
|
||||
*
|
||||
* @param aSep The separator.
|
||||
*/
|
||||
SourceNode.prototype.join = function SourceNode_join(aSep) {
|
||||
var newChildren;
|
||||
var i;
|
||||
var len = this.children.length;
|
||||
if (len > 0) {
|
||||
newChildren = [];
|
||||
for (i = 0; i < len-1; i++) {
|
||||
newChildren.push(this.children[i]);
|
||||
newChildren.push(aSep);
|
||||
}
|
||||
newChildren.push(this.children[i]);
|
||||
this.children = newChildren;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Call String.prototype.replace on the very right-most source snippet. Useful
|
||||
* for trimming whitespace from the end of a source node, etc.
|
||||
*
|
||||
* @param aPattern The pattern to replace.
|
||||
* @param aReplacement The thing to replace the pattern with.
|
||||
*/
|
||||
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
|
||||
var lastChild = this.children[this.children.length - 1];
|
||||
if (lastChild[isSourceNode]) {
|
||||
lastChild.replaceRight(aPattern, aReplacement);
|
||||
}
|
||||
else if (typeof lastChild === 'string') {
|
||||
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
|
||||
}
|
||||
else {
|
||||
this.children.push(''.replace(aPattern, aReplacement));
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the source content for a source file. This will be added to the SourceMapGenerator
|
||||
* in the sourcesContent field.
|
||||
*
|
||||
* @param aSourceFile The filename of the source file
|
||||
* @param aSourceContent The content of the source file
|
||||
*/
|
||||
SourceNode.prototype.setSourceContent =
|
||||
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
|
||||
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
|
||||
};
|
||||
|
||||
/**
|
||||
* Walk over the tree of SourceNodes. The walking function is called for each
|
||||
* source file content and is passed the filename and source content.
|
||||
*
|
||||
* @param aFn The traversal function.
|
||||
*/
|
||||
SourceNode.prototype.walkSourceContents =
|
||||
function SourceNode_walkSourceContents(aFn) {
|
||||
for (var i = 0, len = this.children.length; i < len; i++) {
|
||||
if (this.children[i][isSourceNode]) {
|
||||
this.children[i].walkSourceContents(aFn);
|
||||
}
|
||||
}
|
||||
|
||||
var sources = Object.keys(this.sourceContents);
|
||||
for (var i = 0, len = sources.length; i < len; i++) {
|
||||
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the string representation of this source node. Walks over the tree
|
||||
* and concatenates all the various snippets together to one string.
|
||||
*/
|
||||
SourceNode.prototype.toString = function SourceNode_toString() {
|
||||
var str = "";
|
||||
this.walk(function (chunk) {
|
||||
str += chunk;
|
||||
});
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the string representation of this source node along with a source
|
||||
* map.
|
||||
*/
|
||||
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
|
||||
var generated = {
|
||||
code: "",
|
||||
line: 1,
|
||||
column: 0
|
||||
};
|
||||
var map = new SourceMapGenerator(aArgs);
|
||||
var sourceMappingActive = false;
|
||||
var lastOriginalSource = null;
|
||||
var lastOriginalLine = null;
|
||||
var lastOriginalColumn = null;
|
||||
var lastOriginalName = null;
|
||||
this.walk(function (chunk, original) {
|
||||
generated.code += chunk;
|
||||
if (original.source !== null
|
||||
&& original.line !== null
|
||||
&& original.column !== null) {
|
||||
if(lastOriginalSource !== original.source
|
||||
|| lastOriginalLine !== original.line
|
||||
|| lastOriginalColumn !== original.column
|
||||
|| lastOriginalName !== original.name) {
|
||||
map.addMapping({
|
||||
source: original.source,
|
||||
original: {
|
||||
line: original.line,
|
||||
column: original.column
|
||||
},
|
||||
generated: {
|
||||
line: generated.line,
|
||||
column: generated.column
|
||||
},
|
||||
name: original.name
|
||||
});
|
||||
}
|
||||
lastOriginalSource = original.source;
|
||||
lastOriginalLine = original.line;
|
||||
lastOriginalColumn = original.column;
|
||||
lastOriginalName = original.name;
|
||||
sourceMappingActive = true;
|
||||
} else if (sourceMappingActive) {
|
||||
map.addMapping({
|
||||
generated: {
|
||||
line: generated.line,
|
||||
column: generated.column
|
||||
}
|
||||
});
|
||||
lastOriginalSource = null;
|
||||
sourceMappingActive = false;
|
||||
}
|
||||
for (var idx = 0, length = chunk.length; idx < length; idx++) {
|
||||
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
|
||||
generated.line++;
|
||||
generated.column = 0;
|
||||
// Mappings end at eol
|
||||
if (idx + 1 === length) {
|
||||
lastOriginalSource = null;
|
||||
sourceMappingActive = false;
|
||||
} else if (sourceMappingActive) {
|
||||
map.addMapping({
|
||||
source: original.source,
|
||||
original: {
|
||||
line: original.line,
|
||||
column: original.column
|
||||
},
|
||||
generated: {
|
||||
line: generated.line,
|
||||
column: generated.column
|
||||
},
|
||||
name: original.name
|
||||
});
|
||||
}
|
||||
} else {
|
||||
generated.column++;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.walkSourceContents(function (sourceFile, sourceContent) {
|
||||
map.setSourceContent(sourceFile, sourceContent);
|
||||
});
|
||||
|
||||
return { code: generated.code, map: map };
|
||||
};
|
||||
|
||||
exports.SourceNode = SourceNode;
|
||||
417
build/node_modules/babel-core/node_modules/source-map/lib/util.js
generated
vendored
Normal file
417
build/node_modules/babel-core/node_modules/source-map/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,417 @@
|
||||
/* -*- Mode: js; js-indent-level: 2; -*- */
|
||||
/*
|
||||
* Copyright 2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is a helper function for getting values from parameter/options
|
||||
* objects.
|
||||
*
|
||||
* @param args The object we are extracting values from
|
||||
* @param name The name of the property we are getting.
|
||||
* @param defaultValue An optional value to return if the property is missing
|
||||
* from the object. If this is not specified and the property is missing, an
|
||||
* error will be thrown.
|
||||
*/
|
||||
function getArg(aArgs, aName, aDefaultValue) {
|
||||
if (aName in aArgs) {
|
||||
return aArgs[aName];
|
||||
} else if (arguments.length === 3) {
|
||||
return aDefaultValue;
|
||||
} else {
|
||||
throw new Error('"' + aName + '" is a required argument.');
|
||||
}
|
||||
}
|
||||
exports.getArg = getArg;
|
||||
|
||||
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
|
||||
var dataUrlRegexp = /^data:.+\,.+$/;
|
||||
|
||||
function urlParse(aUrl) {
|
||||
var match = aUrl.match(urlRegexp);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
scheme: match[1],
|
||||
auth: match[2],
|
||||
host: match[3],
|
||||
port: match[4],
|
||||
path: match[5]
|
||||
};
|
||||
}
|
||||
exports.urlParse = urlParse;
|
||||
|
||||
function urlGenerate(aParsedUrl) {
|
||||
var url = '';
|
||||
if (aParsedUrl.scheme) {
|
||||
url += aParsedUrl.scheme + ':';
|
||||
}
|
||||
url += '//';
|
||||
if (aParsedUrl.auth) {
|
||||
url += aParsedUrl.auth + '@';
|
||||
}
|
||||
if (aParsedUrl.host) {
|
||||
url += aParsedUrl.host;
|
||||
}
|
||||
if (aParsedUrl.port) {
|
||||
url += ":" + aParsedUrl.port
|
||||
}
|
||||
if (aParsedUrl.path) {
|
||||
url += aParsedUrl.path;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
exports.urlGenerate = urlGenerate;
|
||||
|
||||
/**
|
||||
* Normalizes a path, or the path portion of a URL:
|
||||
*
|
||||
* - Replaces consecutive slashes with one slash.
|
||||
* - Removes unnecessary '.' parts.
|
||||
* - Removes unnecessary '<dir>/..' parts.
|
||||
*
|
||||
* Based on code in the Node.js 'path' core module.
|
||||
*
|
||||
* @param aPath The path or url to normalize.
|
||||
*/
|
||||
function normalize(aPath) {
|
||||
var path = aPath;
|
||||
var url = urlParse(aPath);
|
||||
if (url) {
|
||||
if (!url.path) {
|
||||
return aPath;
|
||||
}
|
||||
path = url.path;
|
||||
}
|
||||
var isAbsolute = exports.isAbsolute(path);
|
||||
|
||||
var parts = path.split(/\/+/);
|
||||
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
||||
part = parts[i];
|
||||
if (part === '.') {
|
||||
parts.splice(i, 1);
|
||||
} else if (part === '..') {
|
||||
up++;
|
||||
} else if (up > 0) {
|
||||
if (part === '') {
|
||||
// The first part is blank if the path is absolute. Trying to go
|
||||
// above the root is a no-op. Therefore we can remove all '..' parts
|
||||
// directly after the root.
|
||||
parts.splice(i + 1, up);
|
||||
up = 0;
|
||||
} else {
|
||||
parts.splice(i, 2);
|
||||
up--;
|
||||
}
|
||||
}
|
||||
}
|
||||
path = parts.join('/');
|
||||
|
||||
if (path === '') {
|
||||
path = isAbsolute ? '/' : '.';
|
||||
}
|
||||
|
||||
if (url) {
|
||||
url.path = path;
|
||||
return urlGenerate(url);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
exports.normalize = normalize;
|
||||
|
||||
/**
|
||||
* Joins two paths/URLs.
|
||||
*
|
||||
* @param aRoot The root path or URL.
|
||||
* @param aPath The path or URL to be joined with the root.
|
||||
*
|
||||
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
|
||||
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
|
||||
* first.
|
||||
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
|
||||
* is updated with the result and aRoot is returned. Otherwise the result
|
||||
* is returned.
|
||||
* - If aPath is absolute, the result is aPath.
|
||||
* - Otherwise the two paths are joined with a slash.
|
||||
* - Joining for example 'http://' and 'www.example.com' is also supported.
|
||||
*/
|
||||
function join(aRoot, aPath) {
|
||||
if (aRoot === "") {
|
||||
aRoot = ".";
|
||||
}
|
||||
if (aPath === "") {
|
||||
aPath = ".";
|
||||
}
|
||||
var aPathUrl = urlParse(aPath);
|
||||
var aRootUrl = urlParse(aRoot);
|
||||
if (aRootUrl) {
|
||||
aRoot = aRootUrl.path || '/';
|
||||
}
|
||||
|
||||
// `join(foo, '//www.example.org')`
|
||||
if (aPathUrl && !aPathUrl.scheme) {
|
||||
if (aRootUrl) {
|
||||
aPathUrl.scheme = aRootUrl.scheme;
|
||||
}
|
||||
return urlGenerate(aPathUrl);
|
||||
}
|
||||
|
||||
if (aPathUrl || aPath.match(dataUrlRegexp)) {
|
||||
return aPath;
|
||||
}
|
||||
|
||||
// `join('http://', 'www.example.com')`
|
||||
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
|
||||
aRootUrl.host = aPath;
|
||||
return urlGenerate(aRootUrl);
|
||||
}
|
||||
|
||||
var joined = aPath.charAt(0) === '/'
|
||||
? aPath
|
||||
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
|
||||
|
||||
if (aRootUrl) {
|
||||
aRootUrl.path = joined;
|
||||
return urlGenerate(aRootUrl);
|
||||
}
|
||||
return joined;
|
||||
}
|
||||
exports.join = join;
|
||||
|
||||
exports.isAbsolute = function (aPath) {
|
||||
return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
|
||||
};
|
||||
|
||||
/**
|
||||
* Make a path relative to a URL or another path.
|
||||
*
|
||||
* @param aRoot The root path or URL.
|
||||
* @param aPath The path or URL to be made relative to aRoot.
|
||||
*/
|
||||
function relative(aRoot, aPath) {
|
||||
if (aRoot === "") {
|
||||
aRoot = ".";
|
||||
}
|
||||
|
||||
aRoot = aRoot.replace(/\/$/, '');
|
||||
|
||||
// It is possible for the path to be above the root. In this case, simply
|
||||
// checking whether the root is a prefix of the path won't work. Instead, we
|
||||
// need to remove components from the root one by one, until either we find
|
||||
// a prefix that fits, or we run out of components to remove.
|
||||
var level = 0;
|
||||
while (aPath.indexOf(aRoot + '/') !== 0) {
|
||||
var index = aRoot.lastIndexOf("/");
|
||||
if (index < 0) {
|
||||
return aPath;
|
||||
}
|
||||
|
||||
// If the only part of the root that is left is the scheme (i.e. http://,
|
||||
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
|
||||
// have exhausted all components, so the path is not relative to the root.
|
||||
aRoot = aRoot.slice(0, index);
|
||||
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
|
||||
return aPath;
|
||||
}
|
||||
|
||||
++level;
|
||||
}
|
||||
|
||||
// Make sure we add a "../" for each component we removed from the root.
|
||||
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
||||
}
|
||||
exports.relative = relative;
|
||||
|
||||
var supportsNullProto = (function () {
|
||||
var obj = Object.create(null);
|
||||
return !('__proto__' in obj);
|
||||
}());
|
||||
|
||||
function identity (s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Because behavior goes wacky when you set `__proto__` on objects, we
|
||||
* have to prefix all the strings in our set with an arbitrary character.
|
||||
*
|
||||
* See https://github.com/mozilla/source-map/pull/31 and
|
||||
* https://github.com/mozilla/source-map/issues/30
|
||||
*
|
||||
* @param String aStr
|
||||
*/
|
||||
function toSetString(aStr) {
|
||||
if (isProtoString(aStr)) {
|
||||
return '$' + aStr;
|
||||
}
|
||||
|
||||
return aStr;
|
||||
}
|
||||
exports.toSetString = supportsNullProto ? identity : toSetString;
|
||||
|
||||
function fromSetString(aStr) {
|
||||
if (isProtoString(aStr)) {
|
||||
return aStr.slice(1);
|
||||
}
|
||||
|
||||
return aStr;
|
||||
}
|
||||
exports.fromSetString = supportsNullProto ? identity : fromSetString;
|
||||
|
||||
function isProtoString(s) {
|
||||
if (!s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var length = s.length;
|
||||
|
||||
if (length < 9 /* "__proto__".length */) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
||||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
||||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
||||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 9) !== 95 /* '_' */) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = length - 10; i >= 0; i--) {
|
||||
if (s.charCodeAt(i) !== 36 /* '$' */) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparator between two mappings where the original positions are compared.
|
||||
*
|
||||
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
||||
* mappings with the same original source/line/column, but different generated
|
||||
* line and column the same. Useful when searching for a mapping with a
|
||||
* stubbed out mapping.
|
||||
*/
|
||||
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
||||
var cmp = mappingA.source - mappingB.source;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.originalLine - mappingB.originalLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
||||
if (cmp !== 0 || onlyCompareOriginal) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
return mappingA.name - mappingB.name;
|
||||
}
|
||||
exports.compareByOriginalPositions = compareByOriginalPositions;
|
||||
|
||||
/**
|
||||
* Comparator between two mappings with deflated source and name indices where
|
||||
* the generated positions are compared.
|
||||
*
|
||||
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
||||
* mappings with the same generated line and column, but different
|
||||
* source/name/original line and column the same. Useful when searching for a
|
||||
* mapping with a stubbed out mapping.
|
||||
*/
|
||||
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
||||
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
||||
if (cmp !== 0 || onlyCompareGenerated) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.source - mappingB.source;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.originalLine - mappingB.originalLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
return mappingA.name - mappingB.name;
|
||||
}
|
||||
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
||||
|
||||
function strcmp(aStr1, aStr2) {
|
||||
if (aStr1 === aStr2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (aStr1 > aStr2) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparator between two mappings with inflated source and name strings where
|
||||
* the generated positions are compared.
|
||||
*/
|
||||
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
||||
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = strcmp(mappingA.source, mappingB.source);
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.originalLine - mappingB.originalLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
return strcmp(mappingA.name, mappingB.name);
|
||||
}
|
||||
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
||||
211
build/node_modules/babel-core/node_modules/source-map/package.json
generated
vendored
Normal file
211
build/node_modules/babel-core/node_modules/source-map/package.json
generated
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
{
|
||||
"_from": "source-map@^0.5.6",
|
||||
"_id": "source-map@0.5.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
|
||||
"_location": "/babel-core/source-map",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "source-map@^0.5.6",
|
||||
"name": "source-map",
|
||||
"escapedName": "source-map",
|
||||
"rawSpec": "^0.5.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.5.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
"_shasum": "8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc",
|
||||
"_spec": "source-map@^0.5.6",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/babel-core",
|
||||
"author": {
|
||||
"name": "Nick Fitzgerald",
|
||||
"email": "nfitzgerald@mozilla.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/source-map/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tobias Koppers",
|
||||
"email": "tobias.koppers@googlemail.com"
|
||||
},
|
||||
{
|
||||
"name": "Duncan Beevers",
|
||||
"email": "duncan@dweebd.com"
|
||||
},
|
||||
{
|
||||
"name": "Stephen Crane",
|
||||
"email": "scrane@mozilla.com"
|
||||
},
|
||||
{
|
||||
"name": "Ryan Seddon",
|
||||
"email": "seddon.ryan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Miles Elam",
|
||||
"email": "miles.elam@deem.com"
|
||||
},
|
||||
{
|
||||
"name": "Mihai Bazon",
|
||||
"email": "mihai.bazon@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Michael Ficarra",
|
||||
"email": "github.public.email@michael.ficarra.me"
|
||||
},
|
||||
{
|
||||
"name": "Todd Wolfson",
|
||||
"email": "todd@twolfson.com"
|
||||
},
|
||||
{
|
||||
"name": "Alexander Solovyov",
|
||||
"email": "alexander@solovyov.net"
|
||||
},
|
||||
{
|
||||
"name": "Felix Gnass",
|
||||
"email": "fgnass@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Conrad Irwin",
|
||||
"email": "conrad.irwin@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "usrbincc",
|
||||
"email": "usrbincc@yahoo.com"
|
||||
},
|
||||
{
|
||||
"name": "David Glasser",
|
||||
"email": "glasser@davidglasser.net"
|
||||
},
|
||||
{
|
||||
"name": "Chase Douglas",
|
||||
"email": "chase@newrelic.com"
|
||||
},
|
||||
{
|
||||
"name": "Evan Wallace",
|
||||
"email": "evan.exe@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Heather Arthur",
|
||||
"email": "fayearthur@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Hugh Kennedy",
|
||||
"email": "hughskennedy@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "David Glasser",
|
||||
"email": "glasser@davidglasser.net"
|
||||
},
|
||||
{
|
||||
"name": "Simon Lydell",
|
||||
"email": "simon.lydell@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jmeas Smith",
|
||||
"email": "jellyes2@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Michael Z Goddard",
|
||||
"email": "mzgoddard@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "azu",
|
||||
"email": "azu@users.noreply.github.com"
|
||||
},
|
||||
{
|
||||
"name": "John Gozde",
|
||||
"email": "john@gozde.ca"
|
||||
},
|
||||
{
|
||||
"name": "Adam Kirkton",
|
||||
"email": "akirkton@truefitinnovation.com"
|
||||
},
|
||||
{
|
||||
"name": "Chris Montgomery",
|
||||
"email": "christopher.montgomery@dowjones.com"
|
||||
},
|
||||
{
|
||||
"name": "J. Ryan Stinnett",
|
||||
"email": "jryans@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jack Herrington",
|
||||
"email": "jherrington@walmartlabs.com"
|
||||
},
|
||||
{
|
||||
"name": "Chris Truter",
|
||||
"email": "jeffpalentine@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Daniel Espeset",
|
||||
"email": "daniel@danielespeset.com"
|
||||
},
|
||||
{
|
||||
"name": "Jamie Wong",
|
||||
"email": "jamie.lf.wong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Eddy Bruël",
|
||||
"email": "ejpbruel@mozilla.com"
|
||||
},
|
||||
{
|
||||
"name": "Hawken Rives",
|
||||
"email": "hawkrives@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gilad Peleg",
|
||||
"email": "giladp007@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "djchie",
|
||||
"email": "djchie.dev@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gary Ye",
|
||||
"email": "garysye@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Lalevée",
|
||||
"email": "nicolas.lalevee@hibnet.org"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Generates and consumes source maps",
|
||||
"devDependencies": {
|
||||
"doctoc": "^0.15.0",
|
||||
"webpack": "^1.12.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"source-map.js",
|
||||
"lib/",
|
||||
"dist/source-map.debug.js",
|
||||
"dist/source-map.js",
|
||||
"dist/source-map.min.js",
|
||||
"dist/source-map.min.js.map"
|
||||
],
|
||||
"homepage": "https://github.com/mozilla/source-map",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "./source-map.js",
|
||||
"name": "source-map",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/mozilla/source-map.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --color",
|
||||
"test": "npm run build && node test/run-tests.js",
|
||||
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
|
||||
},
|
||||
"typings": "source-map",
|
||||
"version": "0.5.7"
|
||||
}
|
||||
8
build/node_modules/babel-core/node_modules/source-map/source-map.js
generated
vendored
Normal file
8
build/node_modules/babel-core/node_modules/source-map/source-map.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE.txt or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
|
||||
exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
|
||||
exports.SourceNode = require('./lib/source-node').SourceNode;
|
||||
88
build/node_modules/babel-core/package-lock.json
generated
vendored
Normal file
88
build/node_modules/babel-core/package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"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="
|
||||
}
|
||||
}
|
||||
}
|
||||
86
build/node_modules/babel-core/package.json
generated
vendored
Normal file
86
build/node_modules/babel-core/package.json
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"_from": "babel-core@^6.26.0",
|
||||
"_id": "babel-core@6.26.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=",
|
||||
"_location": "/babel-core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "babel-core@^6.26.0",
|
||||
"name": "babel-core",
|
||||
"escapedName": "babel-core",
|
||||
"rawSpec": "^6.26.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.26.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-register",
|
||||
"/prepack"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",
|
||||
"_shasum": "af32f78b31a6fcef119c87b0fd8d9753f03a0bb8",
|
||||
"_spec": "babel-core@^6.26.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/prepack",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"babel-code-frame": "^6.26.0",
|
||||
"babel-generator": "^6.26.0",
|
||||
"babel-helpers": "^6.24.1",
|
||||
"babel-messages": "^6.23.0",
|
||||
"babel-register": "^6.26.0",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"babel-template": "^6.26.0",
|
||||
"babel-traverse": "^6.26.0",
|
||||
"babel-types": "^6.26.0",
|
||||
"babylon": "^6.18.0",
|
||||
"convert-source-map": "^1.5.0",
|
||||
"debug": "^2.6.8",
|
||||
"json5": "^0.5.1",
|
||||
"lodash": "^4.17.4",
|
||||
"minimatch": "^3.0.4",
|
||||
"path-is-absolute": "^1.0.1",
|
||||
"private": "^0.1.7",
|
||||
"slash": "^1.0.0",
|
||||
"source-map": "^0.5.6"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Babel compiler core.",
|
||||
"devDependencies": {
|
||||
"babel-helper-fixtures": "^6.26.0",
|
||||
"babel-helper-transform-fixture-test-runner": "^6.26.0",
|
||||
"babel-polyfill": "^6.26.0"
|
||||
},
|
||||
"homepage": "https://babeljs.io/",
|
||||
"keywords": [
|
||||
"6to5",
|
||||
"babel",
|
||||
"classes",
|
||||
"const",
|
||||
"es6",
|
||||
"harmony",
|
||||
"let",
|
||||
"modules",
|
||||
"transpile",
|
||||
"transpiler",
|
||||
"var",
|
||||
"babel-core",
|
||||
"compiler"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "babel-core",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-core"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "make bench",
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "6.26.0"
|
||||
}
|
||||
3
build/node_modules/babel-core/register.js
generated
vendored
Normal file
3
build/node_modules/babel-core/register.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/* eslint max-len: 0 */
|
||||
// TODO: eventually deprecate this console.trace("use the `babel-register` package instead of `babel-core/register`");
|
||||
module.exports = require("babel-register");
|
||||
Reference in New Issue
Block a user