aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/core/lib/transformation
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/@babel/core/lib/transformation
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/@babel/core/lib/transformation')
-rw-r--r--node_modules/@babel/core/lib/transformation/block-hoist-plugin.js67
-rw-r--r--node_modules/@babel/core/lib/transformation/file/file.js238
-rw-r--r--node_modules/@babel/core/lib/transformation/file/generate.js114
-rw-r--r--node_modules/@babel/core/lib/transformation/file/merge-map.js332
-rw-r--r--node_modules/@babel/core/lib/transformation/index.js137
-rw-r--r--node_modules/@babel/core/lib/transformation/normalize-file.js176
-rw-r--r--node_modules/@babel/core/lib/transformation/normalize-opts.js97
-rw-r--r--node_modules/@babel/core/lib/transformation/plugin-pass.js43
-rw-r--r--node_modules/@babel/core/lib/transformation/util/missing-plugin-helper.js237
9 files changed, 1441 insertions, 0 deletions
diff --git a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
new file mode 100644
index 00000000..4e6056af
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
@@ -0,0 +1,67 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = loadBlockHoistPlugin;
+
+function _sortBy() {
+ const data = _interopRequireDefault(require("lodash/sortBy"));
+
+ _sortBy = function _sortBy() {
+ return data;
+ };
+
+ return data;
+}
+
+var _config = _interopRequireDefault(require("../config"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+let LOADED_PLUGIN;
+
+function loadBlockHoistPlugin() {
+ if (!LOADED_PLUGIN) {
+ const config = (0, _config.default)({
+ babelrc: false,
+ configFile: false,
+ plugins: [blockHoistPlugin]
+ });
+ LOADED_PLUGIN = config ? config.passes[0][0] : undefined;
+ if (!LOADED_PLUGIN) throw new Error("Assertion failure");
+ }
+
+ return LOADED_PLUGIN;
+}
+
+const blockHoistPlugin = {
+ name: "internal.blockHoist",
+ visitor: {
+ Block: {
+ exit({
+ node
+ }) {
+ let hasChange = false;
+
+ for (let i = 0; i < node.body.length; i++) {
+ const bodyNode = node.body[i];
+
+ if (bodyNode && bodyNode._blockHoist != null) {
+ hasChange = true;
+ break;
+ }
+ }
+
+ if (!hasChange) return;
+ node.body = (0, _sortBy().default)(node.body, function (bodyNode) {
+ let priority = bodyNode && bodyNode._blockHoist;
+ if (priority == null) priority = 1;
+ if (priority === true) priority = 2;
+ return -1 * priority;
+ });
+ }
+
+ }
+ }
+}; \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/file/file.js b/node_modules/@babel/core/lib/transformation/file/file.js
new file mode 100644
index 00000000..c326b9f9
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/file/file.js
@@ -0,0 +1,238 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+function helpers() {
+ const data = _interopRequireWildcard(require("@babel/helpers"));
+
+ helpers = function helpers() {
+ return data;
+ };
+
+ return data;
+}
+
+function _traverse() {
+ const data = _interopRequireWildcard(require("@babel/traverse"));
+
+ _traverse = function _traverse() {
+ return data;
+ };
+
+ return data;
+}
+
+function _codeFrame() {
+ const data = require("@babel/code-frame");
+
+ _codeFrame = function _codeFrame() {
+ return data;
+ };
+
+ return data;
+}
+
+function t() {
+ const data = _interopRequireWildcard(require("@babel/types"));
+
+ t = function t() {
+ return data;
+ };
+
+ return data;
+}
+
+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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
+
+const errorVisitor = {
+ enter(path, state) {
+ const loc = path.node.loc;
+
+ if (loc) {
+ state.loc = loc;
+ path.stop();
+ }
+ }
+
+};
+
+class File {
+ constructor(options, {
+ code,
+ ast,
+ shebang,
+ inputMap
+ }) {
+ this._map = new Map();
+ this.declarations = {};
+ this.path = null;
+ this.ast = {};
+ this.metadata = {};
+ this.hub = new (_traverse().Hub)(this);
+ this.code = "";
+ this.shebang = "";
+ this.inputMap = null;
+ this.opts = options;
+ this.code = code;
+ this.ast = ast;
+ this.shebang = shebang;
+ this.inputMap = inputMap;
+ this.path = _traverse().NodePath.get({
+ hub: this.hub,
+ parentPath: null,
+ parent: this.ast,
+ container: this.ast,
+ key: "program"
+ }).setContext();
+ this.scope = this.path.scope;
+ }
+
+ set(key, val) {
+ this._map.set(key, val);
+ }
+
+ get(key) {
+ return this._map.get(key);
+ }
+
+ has(key) {
+ return this._map.has(key);
+ }
+
+ getModuleName() {
+ const _this$opts = this.opts,
+ filename = _this$opts.filename,
+ _this$opts$filenameRe = _this$opts.filenameRelative,
+ filenameRelative = _this$opts$filenameRe === void 0 ? filename : _this$opts$filenameRe,
+ moduleId = _this$opts.moduleId,
+ _this$opts$moduleIds = _this$opts.moduleIds,
+ moduleIds = _this$opts$moduleIds === void 0 ? !!moduleId : _this$opts$moduleIds,
+ getModuleId = _this$opts.getModuleId,
+ sourceRootTmp = _this$opts.sourceRoot,
+ _this$opts$moduleRoot = _this$opts.moduleRoot,
+ moduleRoot = _this$opts$moduleRoot === void 0 ? sourceRootTmp : _this$opts$moduleRoot,
+ _this$opts$sourceRoot = _this$opts.sourceRoot,
+ sourceRoot = _this$opts$sourceRoot === void 0 ? moduleRoot : _this$opts$sourceRoot;
+ if (!moduleIds) return null;
+
+ if (moduleId != null && !getModuleId) {
+ return moduleId;
+ }
+
+ let moduleName = moduleRoot != null ? moduleRoot + "/" : "";
+
+ if (filenameRelative) {
+ const sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : "";
+ moduleName += filenameRelative.replace(sourceRootReplacer, "").replace(/\.(\w*?)$/, "");
+ }
+
+ moduleName = moduleName.replace(/\\/g, "/");
+
+ if (getModuleId) {
+ return getModuleId(moduleName) || moduleName;
+ } else {
+ return moduleName;
+ }
+ }
+
+ resolveModuleSource(source) {
+ return source;
+ }
+
+ addImport() {
+ throw new Error("This API has been removed. If you're looking for this " + "functionality in Babel 7, you should import the " + "'@babel/helper-module-imports' module and use the functions exposed " + " from that module, such as 'addNamed' or 'addDefault'.");
+ }
+
+ addHelper(name) {
+ const declar = this.declarations[name];
+ if (declar) return t().cloneNode(declar);
+ const generator = this.get("helperGenerator");
+ const runtime = this.get("helpersNamespace");
+
+ if (generator) {
+ const res = generator(name);
+ if (res) return res;
+ } else if (runtime) {
+ return t().memberExpression(t().cloneNode(runtime), t().identifier(name));
+ }
+
+ const uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
+ const dependencies = {};
+
+ for (var _iterator = helpers().getDependencies(name), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref = _i.value;
+ }
+
+ const dep = _ref;
+ dependencies[dep] = this.addHelper(dep);
+ }
+
+ const _helpers$get = helpers().get(name, dep => dependencies[dep], uid, Object.keys(this.scope.getAllBindings())),
+ nodes = _helpers$get.nodes,
+ globals = _helpers$get.globals;
+
+ globals.forEach(name => {
+ if (this.path.scope.hasBinding(name, true)) {
+ this.path.scope.rename(name);
+ }
+ });
+ nodes.forEach(node => {
+ node._compact = true;
+ });
+ this.path.unshiftContainer("body", nodes);
+ this.path.get("body").forEach(path => {
+ if (nodes.indexOf(path.node) === -1) return;
+ if (path.isVariableDeclaration()) this.scope.registerDeclaration(path);
+ });
+ return uid;
+ }
+
+ addTemplateObject() {
+ throw new Error("This function has been moved into the template literal transform itself.");
+ }
+
+ buildCodeFrameError(node, msg, Error = SyntaxError) {
+ let loc = node && (node.loc || node._loc);
+ msg = `${this.opts.filename}: ${msg}`;
+
+ if (!loc && node) {
+ const state = {
+ loc: null
+ };
+ (0, _traverse().default)(node, errorVisitor, this.scope, state);
+ loc = state.loc;
+ let txt = "This is an error on an internal node. Probably an internal error.";
+ if (loc) txt += " Location has been estimated.";
+ msg += ` (${txt})`;
+ }
+
+ if (loc) {
+ const _this$opts$highlightC = this.opts.highlightCode,
+ highlightCode = _this$opts$highlightC === void 0 ? true : _this$opts$highlightC;
+ msg += "\n" + (0, _codeFrame().codeFrameColumns)(this.code, {
+ start: {
+ line: loc.start.line,
+ column: loc.start.column + 1
+ }
+ }, {
+ highlightCode
+ });
+ }
+
+ return new Error(msg);
+ }
+
+}
+
+exports.default = File; \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/file/generate.js b/node_modules/@babel/core/lib/transformation/file/generate.js
new file mode 100644
index 00000000..98f2a54f
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/file/generate.js
@@ -0,0 +1,114 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = generateCode;
+
+function _convertSourceMap() {
+ const data = _interopRequireDefault(require("convert-source-map"));
+
+ _convertSourceMap = function _convertSourceMap() {
+ return data;
+ };
+
+ return data;
+}
+
+function _generator() {
+ const data = _interopRequireDefault(require("@babel/generator"));
+
+ _generator = function _generator() {
+ return data;
+ };
+
+ return data;
+}
+
+var _mergeMap = _interopRequireDefault(require("./merge-map"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function generateCode(pluginPasses, file) {
+ const opts = file.opts,
+ ast = file.ast,
+ shebang = file.shebang,
+ code = file.code,
+ inputMap = file.inputMap;
+ const results = [];
+
+ for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref = _i.value;
+ }
+
+ const plugins = _ref;
+
+ for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
+ var _ref2;
+
+ if (_isArray2) {
+ if (_i2 >= _iterator2.length) break;
+ _ref2 = _iterator2[_i2++];
+ } else {
+ _i2 = _iterator2.next();
+ if (_i2.done) break;
+ _ref2 = _i2.value;
+ }
+
+ const plugin = _ref2;
+ const generatorOverride = plugin.generatorOverride;
+
+ if (generatorOverride) {
+ const result = generatorOverride(ast, opts.generatorOpts, code, _generator().default);
+ if (result !== undefined) results.push(result);
+ }
+ }
+ }
+
+ let result;
+
+ if (results.length === 0) {
+ result = (0, _generator().default)(ast, opts.generatorOpts, code);
+ } else if (results.length === 1) {
+ result = results[0];
+
+ if (typeof result.then === "function") {
+ throw new Error(`You appear to be using an async parser plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
+ }
+ } else {
+ throw new Error("More than one plugin attempted to override codegen.");
+ }
+
+ let _result = result,
+ outputCode = _result.code,
+ outputMap = _result.map;
+
+ if (shebang) {
+ outputCode = `${shebang}\n${outputCode}`;
+ }
+
+ if (outputMap && inputMap) {
+ outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap);
+ }
+
+ if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
+ outputCode += "\n" + _convertSourceMap().default.fromObject(outputMap).toComment();
+ }
+
+ if (opts.sourceMaps === "inline") {
+ outputMap = null;
+ }
+
+ return {
+ outputCode,
+ outputMap
+ };
+} \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/file/merge-map.js b/node_modules/@babel/core/lib/transformation/file/merge-map.js
new file mode 100644
index 00000000..6f0edd17
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/file/merge-map.js
@@ -0,0 +1,332 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = mergeSourceMap;
+
+function _sourceMap() {
+ const data = _interopRequireDefault(require("source-map"));
+
+ _sourceMap = function _sourceMap() {
+ return data;
+ };
+
+ return data;
+}
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function mergeSourceMap(inputMap, map) {
+ const input = buildMappingData(inputMap);
+ const output = buildMappingData(map);
+ const mergedGenerator = new (_sourceMap().default.SourceMapGenerator)();
+
+ for (var _iterator = input.sources, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref2;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref2 = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref2 = _i.value;
+ }
+
+ const _ref = _ref2;
+ const source = _ref.source;
+
+ if (typeof source.content === "string") {
+ mergedGenerator.setSourceContent(source.path, source.content);
+ }
+ }
+
+ if (output.sources.length === 1) {
+ const defaultSource = output.sources[0];
+ const insertedMappings = new Map();
+ eachInputGeneratedRange(input, (generated, original, source) => {
+ eachOverlappingGeneratedOutputRange(defaultSource, generated, item => {
+ const key = makeMappingKey(item);
+ if (insertedMappings.has(key)) return;
+ insertedMappings.set(key, item);
+ mergedGenerator.addMapping({
+ source: source.path,
+ original: {
+ line: original.line,
+ column: original.columnStart
+ },
+ generated: {
+ line: item.line,
+ column: item.columnStart
+ },
+ name: original.name
+ });
+ });
+ });
+
+ for (var _iterator2 = insertedMappings.values(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
+ var _ref3;
+
+ if (_isArray2) {
+ if (_i2 >= _iterator2.length) break;
+ _ref3 = _iterator2[_i2++];
+ } else {
+ _i2 = _iterator2.next();
+ if (_i2.done) break;
+ _ref3 = _i2.value;
+ }
+
+ const item = _ref3;
+
+ if (item.columnEnd === Infinity) {
+ continue;
+ }
+
+ const clearItem = {
+ line: item.line,
+ columnStart: item.columnEnd
+ };
+ const key = makeMappingKey(clearItem);
+
+ if (insertedMappings.has(key)) {
+ continue;
+ }
+
+ mergedGenerator.addMapping({
+ generated: {
+ line: clearItem.line,
+ column: clearItem.columnStart
+ }
+ });
+ }
+ }
+
+ const result = mergedGenerator.toJSON();
+
+ if (typeof input.sourceRoot === "string") {
+ result.sourceRoot = input.sourceRoot;
+ }
+
+ return result;
+}
+
+function makeMappingKey(item) {
+ return JSON.stringify([item.line, item.columnStart]);
+}
+
+function eachOverlappingGeneratedOutputRange(outputFile, inputGeneratedRange, callback) {
+ const overlappingOriginal = filterApplicableOriginalRanges(outputFile, inputGeneratedRange);
+
+ for (var _iterator3 = overlappingOriginal, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
+ var _ref5;
+
+ if (_isArray3) {
+ if (_i3 >= _iterator3.length) break;
+ _ref5 = _iterator3[_i3++];
+ } else {
+ _i3 = _iterator3.next();
+ if (_i3.done) break;
+ _ref5 = _i3.value;
+ }
+
+ const _ref4 = _ref5;
+ const generated = _ref4.generated;
+
+ for (var _iterator4 = generated, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
+ var _ref6;
+
+ if (_isArray4) {
+ if (_i4 >= _iterator4.length) break;
+ _ref6 = _iterator4[_i4++];
+ } else {
+ _i4 = _iterator4.next();
+ if (_i4.done) break;
+ _ref6 = _i4.value;
+ }
+
+ const item = _ref6;
+ callback(item);
+ }
+ }
+}
+
+function filterApplicableOriginalRanges({
+ mappings
+}, {
+ line,
+ columnStart,
+ columnEnd
+}) {
+ return filterSortedArray(mappings, ({
+ original: outOriginal
+ }) => {
+ if (line > outOriginal.line) return -1;
+ if (line < outOriginal.line) return 1;
+ if (columnStart >= outOriginal.columnEnd) return -1;
+ if (columnEnd <= outOriginal.columnStart) return 1;
+ return 0;
+ });
+}
+
+function eachInputGeneratedRange(map, callback) {
+ for (var _iterator5 = map.sources, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
+ var _ref8;
+
+ if (_isArray5) {
+ if (_i5 >= _iterator5.length) break;
+ _ref8 = _iterator5[_i5++];
+ } else {
+ _i5 = _iterator5.next();
+ if (_i5.done) break;
+ _ref8 = _i5.value;
+ }
+
+ const _ref7 = _ref8;
+ const source = _ref7.source,
+ mappings = _ref7.mappings;
+
+ for (var _iterator6 = mappings, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) {
+ var _ref10;
+
+ if (_isArray6) {
+ if (_i6 >= _iterator6.length) break;
+ _ref10 = _iterator6[_i6++];
+ } else {
+ _i6 = _iterator6.next();
+ if (_i6.done) break;
+ _ref10 = _i6.value;
+ }
+
+ const _ref9 = _ref10;
+ const original = _ref9.original,
+ generated = _ref9.generated;
+
+ for (var _iterator7 = generated, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) {
+ var _ref11;
+
+ if (_isArray7) {
+ if (_i7 >= _iterator7.length) break;
+ _ref11 = _iterator7[_i7++];
+ } else {
+ _i7 = _iterator7.next();
+ if (_i7.done) break;
+ _ref11 = _i7.value;
+ }
+
+ const item = _ref11;
+ callback(item, original, source);
+ }
+ }
+ }
+}
+
+function buildMappingData(map) {
+ const consumer = new (_sourceMap().default.SourceMapConsumer)(Object.assign({}, map, {
+ sourceRoot: null
+ }));
+ const sources = new Map();
+ const mappings = new Map();
+ let last = null;
+ consumer.computeColumnSpans();
+ consumer.eachMapping(m => {
+ if (m.originalLine === null) return;
+ let source = sources.get(m.source);
+
+ if (!source) {
+ source = {
+ path: m.source,
+ content: consumer.sourceContentFor(m.source, true)
+ };
+ sources.set(m.source, source);
+ }
+
+ let sourceData = mappings.get(source);
+
+ if (!sourceData) {
+ sourceData = {
+ source,
+ mappings: []
+ };
+ mappings.set(source, sourceData);
+ }
+
+ const obj = {
+ line: m.originalLine,
+ columnStart: m.originalColumn,
+ columnEnd: Infinity,
+ name: m.name
+ };
+
+ if (last && last.source === source && last.mapping.line === m.originalLine) {
+ last.mapping.columnEnd = m.originalColumn;
+ }
+
+ last = {
+ source,
+ mapping: obj
+ };
+ sourceData.mappings.push({
+ original: obj,
+ generated: consumer.allGeneratedPositionsFor({
+ source: m.source,
+ line: m.originalLine,
+ column: m.originalColumn
+ }).map(item => ({
+ line: item.line,
+ columnStart: item.column,
+ columnEnd: item.lastColumn + 1
+ }))
+ });
+ }, null, _sourceMap().default.SourceMapConsumer.ORIGINAL_ORDER);
+ return {
+ file: map.file,
+ sourceRoot: map.sourceRoot,
+ sources: Array.from(mappings.values())
+ };
+}
+
+function findInsertionLocation(array, callback) {
+ let left = 0;
+ let right = array.length;
+
+ while (left < right) {
+ const mid = Math.floor((left + right) / 2);
+ const item = array[mid];
+ const result = callback(item);
+
+ if (result === 0) {
+ left = mid;
+ break;
+ }
+
+ if (result >= 0) {
+ right = mid;
+ } else {
+ left = mid + 1;
+ }
+ }
+
+ let i = left;
+
+ if (i < array.length) {
+ while (i > 0 && callback(array[i]) >= 0) {
+ i--;
+ }
+
+ return i + 1;
+ }
+
+ return i;
+}
+
+function filterSortedArray(array, callback) {
+ const start = findInsertionLocation(array, callback);
+ const results = [];
+
+ for (let i = start; i < array.length && callback(array[i]) === 0; i++) {
+ results.push(array[i]);
+ }
+
+ return results;
+} \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/index.js b/node_modules/@babel/core/lib/transformation/index.js
new file mode 100644
index 00000000..fc6aedba
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/index.js
@@ -0,0 +1,137 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.runAsync = runAsync;
+exports.runSync = runSync;
+
+function _traverse() {
+ const data = _interopRequireDefault(require("@babel/traverse"));
+
+ _traverse = function _traverse() {
+ return data;
+ };
+
+ return data;
+}
+
+var _pluginPass = _interopRequireDefault(require("./plugin-pass"));
+
+var _blockHoistPlugin = _interopRequireDefault(require("./block-hoist-plugin"));
+
+var _normalizeOpts = _interopRequireDefault(require("./normalize-opts"));
+
+var _normalizeFile = _interopRequireDefault(require("./normalize-file"));
+
+var _generate = _interopRequireDefault(require("./file/generate"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function runAsync(config, code, ast, callback) {
+ let result;
+
+ try {
+ result = runSync(config, code, ast);
+ } catch (err) {
+ return callback(err);
+ }
+
+ return callback(null, result);
+}
+
+function runSync(config, code, ast) {
+ const file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
+ transformFile(file, config.passes);
+ const opts = file.opts;
+
+ const _ref = opts.code !== false ? (0, _generate.default)(config.passes, file) : {},
+ outputCode = _ref.outputCode,
+ outputMap = _ref.outputMap;
+
+ return {
+ metadata: file.metadata,
+ options: opts,
+ ast: opts.ast === true ? file.ast : null,
+ code: outputCode === undefined ? null : outputCode,
+ map: outputMap === undefined ? null : outputMap,
+ sourceType: file.ast.program.sourceType
+ };
+}
+
+function transformFile(file, pluginPasses) {
+ for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref2;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref2 = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref2 = _i.value;
+ }
+
+ const pluginPairs = _ref2;
+ const passPairs = [];
+ const passes = [];
+ const visitors = [];
+
+ for (var _iterator2 = pluginPairs.concat([(0, _blockHoistPlugin.default)()]), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
+ var _ref3;
+
+ if (_isArray2) {
+ if (_i2 >= _iterator2.length) break;
+ _ref3 = _iterator2[_i2++];
+ } else {
+ _i2 = _iterator2.next();
+ if (_i2.done) break;
+ _ref3 = _i2.value;
+ }
+
+ const plugin = _ref3;
+ const pass = new _pluginPass.default(file, plugin.key, plugin.options);
+ passPairs.push([plugin, pass]);
+ passes.push(pass);
+ visitors.push(plugin.visitor);
+ }
+
+ for (var _i3 = 0; _i3 < passPairs.length; _i3++) {
+ const _passPairs$_i = passPairs[_i3],
+ plugin = _passPairs$_i[0],
+ pass = _passPairs$_i[1];
+ const fn = plugin.pre;
+
+ if (fn) {
+ const result = fn.call(pass, file);
+
+ if (isThenable(result)) {
+ throw new Error(`You appear to be using an plugin with an async .pre, ` + `which your current version of Babel does not support.` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
+ }
+ }
+ }
+
+ const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod);
+
+ (0, _traverse().default)(file.ast, visitor, file.scope);
+
+ for (var _i4 = 0; _i4 < passPairs.length; _i4++) {
+ const _passPairs$_i2 = passPairs[_i4],
+ plugin = _passPairs$_i2[0],
+ pass = _passPairs$_i2[1];
+ const fn = plugin.post;
+
+ if (fn) {
+ const result = fn.call(pass, file);
+
+ if (isThenable(result)) {
+ throw new Error(`You appear to be using an plugin with an async .post, ` + `which your current version of Babel does not support.` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
+ }
+ }
+ }
+ }
+}
+
+function isThenable(val) {
+ return !!val && (typeof val === "object" || typeof val === "function") && typeof val.then === "function";
+} \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/normalize-file.js b/node_modules/@babel/core/lib/transformation/normalize-file.js
new file mode 100644
index 00000000..6d21f2ef
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/normalize-file.js
@@ -0,0 +1,176 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = normalizeFile;
+
+function t() {
+ const data = _interopRequireWildcard(require("@babel/types"));
+
+ t = function t() {
+ return data;
+ };
+
+ return data;
+}
+
+function _convertSourceMap() {
+ const data = _interopRequireDefault(require("convert-source-map"));
+
+ _convertSourceMap = function _convertSourceMap() {
+ return data;
+ };
+
+ return data;
+}
+
+function _babylon() {
+ const data = require("babylon");
+
+ _babylon = function _babylon() {
+ return data;
+ };
+
+ return data;
+}
+
+function _codeFrame() {
+ const data = require("@babel/code-frame");
+
+ _codeFrame = function _codeFrame() {
+ return data;
+ };
+
+ return data;
+}
+
+var _file = _interopRequireDefault(require("./file/file"));
+
+var _missingPluginHelper = _interopRequireDefault(require("./util/missing-plugin-helper"));
+
+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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
+
+const shebangRegex = /^#!.*/;
+
+function normalizeFile(pluginPasses, options, code, ast) {
+ code = `${code || ""}`;
+ let shebang = null;
+ let inputMap = null;
+
+ if (options.inputSourceMap !== false) {
+ inputMap = _convertSourceMap().default.fromSource(code);
+
+ if (inputMap) {
+ code = _convertSourceMap().default.removeComments(code);
+ } else if (typeof options.inputSourceMap === "object") {
+ inputMap = _convertSourceMap().default.fromObject(options.inputSourceMap);
+ }
+ }
+
+ const shebangMatch = shebangRegex.exec(code);
+
+ if (shebangMatch) {
+ shebang = shebangMatch[0];
+ code = code.replace(shebangRegex, "");
+ }
+
+ if (ast) {
+ if (ast.type === "Program") {
+ ast = t().file(ast, [], []);
+ } else if (ast.type !== "File") {
+ throw new Error("AST root must be a Program or File node");
+ }
+ } else {
+ ast = parser(pluginPasses, options, code);
+ }
+
+ return new _file.default(options, {
+ code,
+ ast,
+ shebang,
+ inputMap
+ });
+}
+
+function parser(pluginPasses, options, code) {
+ try {
+ const results = [];
+
+ for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref = _i.value;
+ }
+
+ const plugins = _ref;
+
+ for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
+ var _ref2;
+
+ if (_isArray2) {
+ if (_i2 >= _iterator2.length) break;
+ _ref2 = _iterator2[_i2++];
+ } else {
+ _i2 = _iterator2.next();
+ if (_i2.done) break;
+ _ref2 = _i2.value;
+ }
+
+ const plugin = _ref2;
+ const parserOverride = plugin.parserOverride;
+
+ if (parserOverride) {
+ const ast = parserOverride(code, options.parserOpts, _babylon().parse);
+ if (ast !== undefined) results.push(ast);
+ }
+ }
+ }
+
+ if (results.length === 0) {
+ return (0, _babylon().parse)(code, options.parserOpts);
+ } else if (results.length === 1) {
+ if (typeof results[0].then === "function") {
+ throw new Error(`You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
+ }
+
+ return results[0];
+ }
+
+ throw new Error("More than one plugin attempted to override parsing.");
+ } catch (err) {
+ if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") {
+ err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file.";
+ }
+
+ const loc = err.loc,
+ missingPlugin = err.missingPlugin;
+
+ if (loc) {
+ const codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
+ start: {
+ line: loc.line,
+ column: loc.column + 1
+ }
+ }, options);
+
+ if (missingPlugin) {
+ err.message = `${options.filename || "unknown"}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
+ } else {
+ err.message = `${options.filename || "unknown"}: ${err.message}\n\n` + codeFrame;
+ }
+
+ err.code = "BABEL_PARSE_ERROR";
+ }
+
+ throw err;
+ }
+} \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/normalize-opts.js b/node_modules/@babel/core/lib/transformation/normalize-opts.js
new file mode 100644
index 00000000..9afc83db
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/normalize-opts.js
@@ -0,0 +1,97 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = normalizeOptions;
+
+function _path() {
+ const data = _interopRequireDefault(require("path"));
+
+ _path = function _path() {
+ return data;
+ };
+
+ return data;
+}
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function normalizeOptions(config) {
+ const _config$options = config.options,
+ filename = _config$options.filename,
+ cwd = _config$options.cwd,
+ _config$options$filen = _config$options.filenameRelative,
+ filenameRelative = _config$options$filen === void 0 ? typeof filename === "string" ? _path().default.relative(cwd, filename) : "unknown" : _config$options$filen,
+ _config$options$sourc = _config$options.sourceType,
+ sourceType = _config$options$sourc === void 0 ? "module" : _config$options$sourc,
+ inputSourceMap = _config$options.inputSourceMap,
+ _config$options$sourc2 = _config$options.sourceMaps,
+ sourceMaps = _config$options$sourc2 === void 0 ? !!inputSourceMap : _config$options$sourc2,
+ moduleRoot = _config$options.moduleRoot,
+ _config$options$sourc3 = _config$options.sourceRoot,
+ sourceRoot = _config$options$sourc3 === void 0 ? moduleRoot : _config$options$sourc3,
+ _config$options$sourc4 = _config$options.sourceFileName,
+ sourceFileName = _config$options$sourc4 === void 0 ? _path().default.basename(filenameRelative) : _config$options$sourc4,
+ _config$options$comme = _config$options.comments,
+ comments = _config$options$comme === void 0 ? true : _config$options$comme,
+ _config$options$compa = _config$options.compact,
+ compact = _config$options$compa === void 0 ? "auto" : _config$options$compa;
+ const opts = config.options;
+ const options = Object.assign({}, opts, {
+ parserOpts: Object.assign({
+ sourceType: _path().default.extname(filenameRelative) === ".mjs" ? "module" : sourceType,
+ sourceFileName: filename,
+ plugins: []
+ }, opts.parserOpts),
+ generatorOpts: Object.assign({
+ filename,
+ auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
+ auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
+ retainLines: opts.retainLines,
+ comments,
+ shouldPrintComment: opts.shouldPrintComment,
+ compact,
+ minified: opts.minified,
+ sourceMaps,
+ sourceRoot,
+ sourceFileName
+ }, opts.generatorOpts)
+ });
+
+ for (var _iterator = config.passes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+ var _ref;
+
+ if (_isArray) {
+ if (_i >= _iterator.length) break;
+ _ref = _iterator[_i++];
+ } else {
+ _i = _iterator.next();
+ if (_i.done) break;
+ _ref = _i.value;
+ }
+
+ const plugins = _ref;
+
+ for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
+ var _ref2;
+
+ if (_isArray2) {
+ if (_i2 >= _iterator2.length) break;
+ _ref2 = _iterator2[_i2++];
+ } else {
+ _i2 = _iterator2.next();
+ if (_i2.done) break;
+ _ref2 = _i2.value;
+ }
+
+ const plugin = _ref2;
+
+ if (plugin.manipulateOptions) {
+ plugin.manipulateOptions(options, options.parserOpts);
+ }
+ }
+ }
+
+ return options;
+} \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/plugin-pass.js b/node_modules/@babel/core/lib/transformation/plugin-pass.js
new file mode 100644
index 00000000..fe24bfd2
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/plugin-pass.js
@@ -0,0 +1,43 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+class PluginPass {
+ constructor(file, key, options) {
+ this._map = new Map();
+ this.key = key;
+ this.file = file;
+ this.opts = options || {};
+ this.filename = typeof file.opts.filename === "string" ? file.opts.filename : undefined;
+ }
+
+ set(key, val) {
+ this._map.set(key, val);
+ }
+
+ get(key) {
+ return this._map.get(key);
+ }
+
+ addHelper(name) {
+ return this.file.addHelper(name);
+ }
+
+ addImport() {
+ return this.file.addImport();
+ }
+
+ getModuleName() {
+ return this.file.getModuleName();
+ }
+
+ buildCodeFrameError(node, msg, Error) {
+ return this.file.buildCodeFrameError(node, msg, Error);
+ }
+
+}
+
+exports.default = PluginPass; \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/transformation/util/missing-plugin-helper.js b/node_modules/@babel/core/lib/transformation/util/missing-plugin-helper.js
new file mode 100644
index 00000000..d568709d
--- /dev/null
+++ b/node_modules/@babel/core/lib/transformation/util/missing-plugin-helper.js
@@ -0,0 +1,237 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = generateMissingPluginMessage;
+const pluginNameMap = {
+ asyncGenerators: {
+ syntax: {
+ name: "@babel/plugin-syntax-async-generators",
+ url: "https://git.io/vb4SY"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-async-generator-functions",
+ url: "https://git.io/vb4yp"
+ }
+ },
+ classProperties: {
+ syntax: {
+ name: "@babel/plugin-syntax-class-properties",
+ url: "https://git.io/vb4yQ"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-class-properties",
+ url: "https://git.io/vb4SL"
+ }
+ },
+ decorators: {
+ syntax: {
+ name: "@babel/plugin-syntax-decorators",
+ url: "https://git.io/vb4y9"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-decorators",
+ url: "https://git.io/vb4ST"
+ }
+ },
+ doExpressions: {
+ syntax: {
+ name: "@babel/plugin-syntax-do-expressions",
+ url: "https://git.io/vb4yh"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-do-expressions",
+ url: "https://git.io/vb4S3"
+ }
+ },
+ dynamicImport: {
+ syntax: {
+ name: "@babel/plugin-syntax-dynamic-import",
+ url: "https://git.io/vb4Sv"
+ }
+ },
+ exportDefaultFrom: {
+ syntax: {
+ name: "@babel/plugin-syntax-export-default-from",
+ url: "https://git.io/vb4SO"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-export-default-from",
+ url: "https://git.io/vb4yH"
+ }
+ },
+ exportNamespaceFrom: {
+ syntax: {
+ name: "@babel/plugin-syntax-export-namespace-from",
+ url: "https://git.io/vb4Sf"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-export-namespace-from",
+ url: "https://git.io/vb4SG"
+ }
+ },
+ flow: {
+ syntax: {
+ name: "@babel/plugin-syntax-flow",
+ url: "https://git.io/vb4yb"
+ },
+ transform: {
+ name: "@babel/plugin-transform-flow-strip-types",
+ url: "https://git.io/vb49g"
+ }
+ },
+ functionBind: {
+ syntax: {
+ name: "@babel/plugin-syntax-function-bind",
+ url: "https://git.io/vb4y7"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-function-bind",
+ url: "https://git.io/vb4St"
+ }
+ },
+ functionSent: {
+ syntax: {
+ name: "@babel/plugin-syntax-function-sent",
+ url: "https://git.io/vb4yN"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-function-sent",
+ url: "https://git.io/vb4SZ"
+ }
+ },
+ importMeta: {
+ syntax: {
+ name: "@babel/plugin-syntax-import-meta",
+ url: "https://git.io/vbKK6"
+ }
+ },
+ jsx: {
+ syntax: {
+ name: "@babel/plugin-syntax-jsx",
+ url: "https://git.io/vb4yA"
+ },
+ transform: {
+ name: "@babel/plugin-transform-react-jsx",
+ url: "https://git.io/vb4yd"
+ }
+ },
+ logicalAssignment: {
+ syntax: {
+ name: "@babel/plugin-syntax-logical-assignment-operators",
+ url: "https://git.io/vAlBp"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-logical-assignment-operators",
+ url: "https://git.io/vAlRe"
+ }
+ },
+ nullishCoalescingOperator: {
+ syntax: {
+ name: "@babel/plugin-syntax-nullish-coalescing-operator",
+ url: "https://git.io/vb4yx"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-nullish-coalescing-operator",
+ url: "https://git.io/vb4Se"
+ }
+ },
+ numericSeparator: {
+ syntax: {
+ name: "@babel/plugin-syntax-numeric-separator",
+ url: "https://git.io/vb4Sq"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-numeric-separator",
+ url: "https://git.io/vb4yS"
+ }
+ },
+ objectRestSpread: {
+ syntax: {
+ name: "@babel/plugin-syntax-object-rest-spread",
+ url: "https://git.io/vb4y5"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-object-rest-spread",
+ url: "https://git.io/vb4Ss"
+ }
+ },
+ optionalCatchBinding: {
+ syntax: {
+ name: "@babel/plugin-syntax-optional-catch-binding",
+ url: "https://git.io/vb4Sn"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-optional-catch-binding",
+ url: "https://git.io/vb4SI"
+ }
+ },
+ optionalChaining: {
+ syntax: {
+ name: "@babel/plugin-syntax-optional-chaining",
+ url: "https://git.io/vb4Sc"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-optional-chaining",
+ url: "https://git.io/vb4Sk"
+ }
+ },
+ pipelineOperator: {
+ syntax: {
+ name: "@babel/plugin-syntax-pipeline-operator",
+ url: "https://git.io/vb4yj"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-pipeline-operator",
+ url: "https://git.io/vb4SU"
+ }
+ },
+ throwExpressions: {
+ syntax: {
+ name: "@babel/plugin-syntax-throw-expressions",
+ url: "https://git.io/vb4SJ"
+ },
+ transform: {
+ name: "@babel/plugin-proposal-throw-expressions",
+ url: "https://git.io/vb4yF"
+ }
+ },
+ typescript: {
+ syntax: {
+ name: "@babel/plugin-syntax-typescript",
+ url: "https://git.io/vb4SC"
+ },
+ transform: {
+ name: "@babel/plugin-transform-typescript",
+ url: "https://git.io/vb4Sm"
+ }
+ }
+};
+
+const getNameURLCombination = ({
+ name,
+ url
+}) => `${name} (${url})`;
+
+function generateMissingPluginMessage(missingPluginName, loc, codeFrame) {
+ let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame;
+ const pluginInfo = pluginNameMap[missingPluginName];
+
+ if (pluginInfo) {
+ const syntaxPlugin = pluginInfo.syntax,
+ transformPlugin = pluginInfo.transform;
+
+ if (syntaxPlugin) {
+ if (transformPlugin) {
+ const transformPluginInfo = getNameURLCombination(transformPlugin);
+ helpMessage += `\n\nAdd ${transformPluginInfo} to the 'plugins' section of your Babel config ` + `to enable transformation.`;
+ } else {
+ const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);
+ helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`;
+ }
+ }
+ }
+
+ return helpMessage;
+} \ No newline at end of file