mirror of
https://github.com/actions/labeler.git
synced 2025-12-15 06:27:13 +00:00
build
This commit is contained in:
18
node_modules/@babel/code-frame/lib/index.js
generated
vendored
18
node_modules/@babel/code-frame/lib/index.js
generated
vendored
@@ -6,17 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = _default;
|
||||
|
||||
function _highlight() {
|
||||
const data = _interopRequireWildcard(require("@babel/highlight"));
|
||||
var _highlight = _interopRequireWildcard(require("@babel/highlight"));
|
||||
|
||||
_highlight = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
|
||||
@@ -94,8 +88,8 @@ function getMarkerLines(loc, source, opts) {
|
||||
}
|
||||
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
|
||||
const chalk = (0, _highlight().getChalk)(opts);
|
||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
||||
const chalk = (0, _highlight.getChalk)(opts);
|
||||
const defs = getDefs(chalk);
|
||||
|
||||
const maybeHighlight = (chalkFn, string) => {
|
||||
@@ -110,7 +104,7 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
} = getMarkerLines(loc, lines, opts);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end).length;
|
||||
const highlightedLines = highlighted ? (0, _highlight().default)(rawLines, opts) : rawLines;
|
||||
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
|
||||
44
node_modules/@babel/code-frame/package.json
generated
vendored
44
node_modules/@babel/code-frame/package.json
generated
vendored
@@ -1,27 +1,20 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/code-frame@7.5.5",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/code-frame@7.5.5",
|
||||
"_id": "@babel/code-frame@7.5.5",
|
||||
"_from": "@babel/code-frame@^7.0.0",
|
||||
"_id": "@babel/code-frame@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
|
||||
"_integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
|
||||
"_location": "/@babel/code-frame",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/code-frame@7.5.5",
|
||||
"raw": "@babel/code-frame@^7.0.0",
|
||||
"name": "@babel/code-frame",
|
||||
"escapedName": "@babel%2fcode-frame",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.5.5",
|
||||
"rawSpec": "^7.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.5.5"
|
||||
"fetchSpec": "^7.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core",
|
||||
@@ -30,22 +23,28 @@
|
||||
"/jest-message-util",
|
||||
"/read-pkg/parse-json"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
|
||||
"_spec": "7.5.5",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
|
||||
"_shasum": "168da1a36e90da68ae8d49c0f1b48c7c6249213a",
|
||||
"_spec": "@babel/code-frame@^7.0.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/read-pkg/node_modules/parse-json",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.0.0"
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.10.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"devDependencies": {
|
||||
"chalk": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@@ -55,7 +54,8 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-code-frame"
|
||||
},
|
||||
"version": "7.5.5"
|
||||
"version": "7.10.4"
|
||||
}
|
||||
|
||||
257
node_modules/@babel/core/lib/config/caching.js
generated
vendored
257
node_modules/@babel/core/lib/config/caching.js
generated
vendored
@@ -3,74 +3,177 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeStrongCache = makeStrongCache;
|
||||
exports.makeWeakCache = makeWeakCache;
|
||||
exports.makeWeakCacheSync = makeWeakCacheSync;
|
||||
exports.makeStrongCache = makeStrongCache;
|
||||
exports.makeStrongCacheSync = makeStrongCacheSync;
|
||||
exports.assertSimpleType = assertSimpleType;
|
||||
|
||||
function makeStrongCache(handler) {
|
||||
return makeCachedFunction(new Map(), handler);
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _async = require("../gensync-utils/async");
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const synchronize = gen => {
|
||||
return (0, _gensync().default)(gen).sync;
|
||||
};
|
||||
|
||||
function* genTrue(data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function makeWeakCache(handler) {
|
||||
return makeCachedFunction(new WeakMap(), handler);
|
||||
return makeCachedFunction(WeakMap, handler);
|
||||
}
|
||||
|
||||
function makeCachedFunction(callCache, handler) {
|
||||
return function cachedFunction(arg, data) {
|
||||
let cachedValue = callCache.get(arg);
|
||||
function makeWeakCacheSync(handler) {
|
||||
return synchronize(makeWeakCache(handler));
|
||||
}
|
||||
|
||||
if (cachedValue) {
|
||||
for (const _ref of cachedValue) {
|
||||
const {
|
||||
value,
|
||||
valid
|
||||
} = _ref;
|
||||
if (valid(data)) return value;
|
||||
}
|
||||
function makeStrongCache(handler) {
|
||||
return makeCachedFunction(Map, handler);
|
||||
}
|
||||
|
||||
function makeStrongCacheSync(handler) {
|
||||
return synchronize(makeStrongCache(handler));
|
||||
}
|
||||
|
||||
function makeCachedFunction(CallCache, handler) {
|
||||
const callCacheSync = new CallCache();
|
||||
const callCacheAsync = new CallCache();
|
||||
const futureCache = new CallCache();
|
||||
return function* cachedFunction(arg, data) {
|
||||
const asyncContext = yield* (0, _async.isAsync)();
|
||||
const callCache = asyncContext ? callCacheAsync : callCacheSync;
|
||||
const cached = yield* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data);
|
||||
if (cached.valid) return cached.value;
|
||||
const cache = new CacheConfigurator(data);
|
||||
const handlerResult = handler(arg, cache);
|
||||
let finishLock;
|
||||
let value;
|
||||
|
||||
if ((0, _util.isIterableIterator)(handlerResult)) {
|
||||
const gen = handlerResult;
|
||||
value = yield* (0, _async.onFirstPause)(gen, () => {
|
||||
finishLock = setupAsyncLocks(cache, futureCache, arg);
|
||||
});
|
||||
} else {
|
||||
value = handlerResult;
|
||||
}
|
||||
|
||||
const cache = new CacheConfigurator(data);
|
||||
const value = handler(arg, cache);
|
||||
if (!cache.configured()) cache.forever();
|
||||
cache.deactivate();
|
||||
|
||||
switch (cache.mode()) {
|
||||
case "forever":
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: () => true
|
||||
}];
|
||||
callCache.set(arg, cachedValue);
|
||||
break;
|
||||
|
||||
case "invalidate":
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: cache.validator()
|
||||
}];
|
||||
callCache.set(arg, cachedValue);
|
||||
break;
|
||||
|
||||
case "valid":
|
||||
if (cachedValue) {
|
||||
cachedValue.push({
|
||||
value,
|
||||
valid: cache.validator()
|
||||
});
|
||||
} else {
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: cache.validator()
|
||||
}];
|
||||
callCache.set(arg, cachedValue);
|
||||
}
|
||||
updateFunctionCache(callCache, cache, arg, value);
|
||||
|
||||
if (finishLock) {
|
||||
futureCache.delete(arg);
|
||||
finishLock.release(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
function* getCachedValue(cache, arg, data) {
|
||||
const cachedValue = cache.get(arg);
|
||||
|
||||
if (cachedValue) {
|
||||
for (const {
|
||||
value,
|
||||
valid
|
||||
} of cachedValue) {
|
||||
if (yield* valid(data)) return {
|
||||
valid: true,
|
||||
value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
valid: false,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
|
||||
function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) {
|
||||
const cached = yield* getCachedValue(callCache, arg, data);
|
||||
|
||||
if (cached.valid) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
if (asyncContext) {
|
||||
const cached = yield* getCachedValue(futureCache, arg, data);
|
||||
|
||||
if (cached.valid) {
|
||||
const value = yield* (0, _async.waitFor)(cached.value.promise);
|
||||
return {
|
||||
valid: true,
|
||||
value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
valid: false,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
|
||||
function setupAsyncLocks(config, futureCache, arg) {
|
||||
const finishLock = new Lock();
|
||||
updateFunctionCache(futureCache, config, arg, finishLock);
|
||||
return finishLock;
|
||||
}
|
||||
|
||||
function updateFunctionCache(cache, config, arg, value) {
|
||||
if (!config.configured()) config.forever();
|
||||
let cachedValue = cache.get(arg);
|
||||
config.deactivate();
|
||||
|
||||
switch (config.mode()) {
|
||||
case "forever":
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: genTrue
|
||||
}];
|
||||
cache.set(arg, cachedValue);
|
||||
break;
|
||||
|
||||
case "invalidate":
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: config.validator()
|
||||
}];
|
||||
cache.set(arg, cachedValue);
|
||||
break;
|
||||
|
||||
case "valid":
|
||||
if (cachedValue) {
|
||||
cachedValue.push({
|
||||
value,
|
||||
valid: config.validator()
|
||||
});
|
||||
} else {
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: config.validator()
|
||||
}];
|
||||
cache.set(arg, cachedValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class CacheConfigurator {
|
||||
constructor(data) {
|
||||
this._active = true;
|
||||
@@ -130,33 +233,35 @@ class CacheConfigurator {
|
||||
|
||||
this._configured = true;
|
||||
const key = handler(this._data);
|
||||
const fn = (0, _async.maybeAsync)(handler, `You appear to be using an async cache handler, but Babel has been called synchronously`);
|
||||
|
||||
this._pairs.push([key, handler]);
|
||||
if ((0, _async.isThenable)(key)) {
|
||||
return key.then(key => {
|
||||
this._pairs.push([key, fn]);
|
||||
|
||||
return key;
|
||||
});
|
||||
}
|
||||
|
||||
this._pairs.push([key, fn]);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
invalidate(handler) {
|
||||
if (!this._active) {
|
||||
throw new Error("Cannot change caching after evaluation has completed.");
|
||||
}
|
||||
|
||||
if (this._never || this._forever) {
|
||||
throw new Error("Caching has already been configured with .never or .forever()");
|
||||
}
|
||||
|
||||
this._invalidate = true;
|
||||
this._configured = true;
|
||||
const key = handler(this._data);
|
||||
|
||||
this._pairs.push([key, handler]);
|
||||
|
||||
return key;
|
||||
return this.using(handler);
|
||||
}
|
||||
|
||||
validator() {
|
||||
const pairs = this._pairs;
|
||||
return data => pairs.every(([key, fn]) => key === fn(data));
|
||||
return function* (data) {
|
||||
for (const [key, fn] of pairs) {
|
||||
if (key !== (yield* fn(data))) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
deactivate() {
|
||||
@@ -191,9 +296,29 @@ function makeSimpleConfigurator(cache) {
|
||||
}
|
||||
|
||||
function assertSimpleType(value) {
|
||||
if ((0, _async.isThenable)(value)) {
|
||||
throw new Error(`You appear to be using an async cache handler, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously handle your caching logic.`);
|
||||
}
|
||||
|
||||
if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") {
|
||||
throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
class Lock {
|
||||
constructor() {
|
||||
this.released = false;
|
||||
this.promise = new Promise(resolve => {
|
||||
this._resolve = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
release(value) {
|
||||
this.released = true;
|
||||
|
||||
this._resolve(value);
|
||||
}
|
||||
|
||||
}
|
||||
168
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
168
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
@@ -31,6 +31,8 @@ var _options = require("./validation/options");
|
||||
|
||||
var _patternToRegex = _interopRequireDefault(require("./pattern-to-regex"));
|
||||
|
||||
var _printer = require("./printer");
|
||||
|
||||
var _files = require("./files");
|
||||
|
||||
var _caching = require("./caching");
|
||||
@@ -41,8 +43,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
const debug = (0, _debug().default)("babel:config:config-chain");
|
||||
|
||||
function buildPresetChain(arg, context) {
|
||||
const chain = buildPresetChainWalker(arg, context);
|
||||
function* buildPresetChain(arg, context) {
|
||||
const chain = yield* buildPresetChainWalker(arg, context);
|
||||
if (!chain) return null;
|
||||
return {
|
||||
plugins: dedupDescriptors(chain.plugins),
|
||||
@@ -52,30 +54,33 @@ function buildPresetChain(arg, context) {
|
||||
}
|
||||
|
||||
const buildPresetChainWalker = makeChainWalker({
|
||||
init: arg => arg,
|
||||
root: preset => loadPresetDescriptors(preset),
|
||||
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
|
||||
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
|
||||
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName)
|
||||
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName),
|
||||
createLogger: () => () => {}
|
||||
});
|
||||
exports.buildPresetChainWalker = buildPresetChainWalker;
|
||||
const loadPresetDescriptors = (0, _caching.makeWeakCache)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
|
||||
const loadPresetEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
|
||||
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
|
||||
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
|
||||
const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
|
||||
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
|
||||
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
|
||||
function buildRootChain(opts, context) {
|
||||
const programmaticChain = loadProgrammaticChain({
|
||||
function* buildRootChain(opts, context) {
|
||||
let configReport, babelRcReport;
|
||||
const programmaticLogger = new _printer.ConfigPrinter();
|
||||
const programmaticChain = yield* loadProgrammaticChain({
|
||||
options: opts,
|
||||
dirname: context.cwd
|
||||
}, context);
|
||||
}, context, undefined, programmaticLogger);
|
||||
if (!programmaticChain) return null;
|
||||
const programmaticReport = programmaticLogger.output();
|
||||
let configFile;
|
||||
|
||||
if (typeof opts.configFile === "string") {
|
||||
configFile = (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
|
||||
configFile = yield* (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
|
||||
} else if (opts.configFile !== false) {
|
||||
configFile = (0, _files.findRootConfig)(context.root, context.envName, context.caller);
|
||||
configFile = yield* (0, _files.findRootConfig)(context.root, context.envName, context.caller);
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -84,11 +89,13 @@ function buildRootChain(opts, context) {
|
||||
} = opts;
|
||||
let babelrcRootsDirectory = context.cwd;
|
||||
const configFileChain = emptyChain();
|
||||
const configFileLogger = new _printer.ConfigPrinter();
|
||||
|
||||
if (configFile) {
|
||||
const validatedFile = validateConfigFile(configFile);
|
||||
const result = loadFileChain(validatedFile, context);
|
||||
const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger);
|
||||
if (!result) return null;
|
||||
configReport = configFileLogger.output();
|
||||
|
||||
if (babelrc === undefined) {
|
||||
babelrc = validatedFile.options.babelrc;
|
||||
@@ -102,7 +109,7 @@ function buildRootChain(opts, context) {
|
||||
mergeChain(configFileChain, result);
|
||||
}
|
||||
|
||||
const pkgData = typeof context.filename === "string" ? (0, _files.findPackageData)(context.filename) : null;
|
||||
const pkgData = typeof context.filename === "string" ? yield* (0, _files.findPackageData)(context.filename) : null;
|
||||
let ignoreFile, babelrcFile;
|
||||
const fileChain = emptyChain();
|
||||
|
||||
@@ -110,19 +117,27 @@ function buildRootChain(opts, context) {
|
||||
({
|
||||
ignore: ignoreFile,
|
||||
config: babelrcFile
|
||||
} = (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
|
||||
} = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
|
||||
|
||||
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (babelrcFile) {
|
||||
const result = loadFileChain(validateBabelrcFile(babelrcFile), context);
|
||||
const validatedFile = validateBabelrcFile(babelrcFile);
|
||||
const babelrcLogger = new _printer.ConfigPrinter();
|
||||
const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger);
|
||||
if (!result) return null;
|
||||
babelRcReport = babelrcLogger.output();
|
||||
mergeChain(fileChain, result);
|
||||
}
|
||||
}
|
||||
|
||||
if (context.showConfig) {
|
||||
console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n"));
|
||||
return null;
|
||||
}
|
||||
|
||||
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
|
||||
return {
|
||||
plugins: dedupDescriptors(chain.plugins),
|
||||
@@ -163,17 +178,17 @@ function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirector
|
||||
});
|
||||
}
|
||||
|
||||
const validateConfigFile = (0, _caching.makeWeakCache)(file => ({
|
||||
const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: (0, _options.validate)("configfile", file.options)
|
||||
}));
|
||||
const validateBabelrcFile = (0, _caching.makeWeakCache)(file => ({
|
||||
const validateBabelrcFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: (0, _options.validate)("babelrcfile", file.options)
|
||||
}));
|
||||
const validateExtendFile = (0, _caching.makeWeakCache)(file => ({
|
||||
const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: (0, _options.validate)("extendsfile", file.options)
|
||||
@@ -182,18 +197,30 @@ const loadProgrammaticChain = makeChainWalker({
|
||||
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
|
||||
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
|
||||
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
|
||||
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName)
|
||||
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName),
|
||||
createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger)
|
||||
});
|
||||
const loadFileChain = makeChainWalker({
|
||||
root: file => loadFileDescriptors(file),
|
||||
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
|
||||
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
|
||||
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName)
|
||||
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName),
|
||||
createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger)
|
||||
});
|
||||
const loadFileDescriptors = (0, _caching.makeWeakCache)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
|
||||
const loadFileEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
|
||||
const loadFileOverridesDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
|
||||
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
|
||||
const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
|
||||
const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
|
||||
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
|
||||
function buildFileLogger(filepath, context, baseLogger) {
|
||||
if (!baseLogger) {
|
||||
return () => {};
|
||||
}
|
||||
|
||||
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, {
|
||||
filepath
|
||||
});
|
||||
}
|
||||
|
||||
function buildRootDescriptors({
|
||||
dirname,
|
||||
@@ -202,6 +229,18 @@ function buildRootDescriptors({
|
||||
return descriptors(dirname, options, alias);
|
||||
}
|
||||
|
||||
function buildProgrammaticLogger(_, context, baseLogger) {
|
||||
var _context$caller;
|
||||
|
||||
if (!baseLogger) {
|
||||
return () => {};
|
||||
}
|
||||
|
||||
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, {
|
||||
callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name
|
||||
});
|
||||
}
|
||||
|
||||
function buildEnvDescriptors({
|
||||
dirname,
|
||||
options
|
||||
@@ -233,9 +272,10 @@ function makeChainWalker({
|
||||
root,
|
||||
env,
|
||||
overrides,
|
||||
overridesEnv
|
||||
overridesEnv,
|
||||
createLogger
|
||||
}) {
|
||||
return (input, context, files = new Set()) => {
|
||||
return function* (input, context, files = new Set(), baseLogger) {
|
||||
const {
|
||||
dirname
|
||||
} = input;
|
||||
@@ -243,60 +283,84 @@ function makeChainWalker({
|
||||
const rootOpts = root(input);
|
||||
|
||||
if (configIsApplicable(rootOpts, dirname, context)) {
|
||||
flattenedConfigs.push(rootOpts);
|
||||
flattenedConfigs.push({
|
||||
config: rootOpts,
|
||||
envName: undefined,
|
||||
index: undefined
|
||||
});
|
||||
const envOpts = env(input, context.envName);
|
||||
|
||||
if (envOpts && configIsApplicable(envOpts, dirname, context)) {
|
||||
flattenedConfigs.push(envOpts);
|
||||
flattenedConfigs.push({
|
||||
config: envOpts,
|
||||
envName: context.envName,
|
||||
index: undefined
|
||||
});
|
||||
}
|
||||
|
||||
(rootOpts.options.overrides || []).forEach((_, index) => {
|
||||
const overrideOps = overrides(input, index);
|
||||
|
||||
if (configIsApplicable(overrideOps, dirname, context)) {
|
||||
flattenedConfigs.push(overrideOps);
|
||||
flattenedConfigs.push({
|
||||
config: overrideOps,
|
||||
index,
|
||||
envName: undefined
|
||||
});
|
||||
const overrideEnvOpts = overridesEnv(input, index, context.envName);
|
||||
|
||||
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) {
|
||||
flattenedConfigs.push(overrideEnvOpts);
|
||||
flattenedConfigs.push({
|
||||
config: overrideEnvOpts,
|
||||
index,
|
||||
envName: context.envName
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (flattenedConfigs.some(({
|
||||
options: {
|
||||
ignore,
|
||||
only
|
||||
config: {
|
||||
options: {
|
||||
ignore,
|
||||
only
|
||||
}
|
||||
}
|
||||
}) => shouldIgnore(context, ignore, only, dirname))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const chain = emptyChain();
|
||||
const logger = createLogger(input, context, baseLogger);
|
||||
|
||||
for (const op of flattenedConfigs) {
|
||||
if (!mergeExtendsChain(chain, op.options, dirname, context, files)) {
|
||||
for (const {
|
||||
config,
|
||||
index,
|
||||
envName
|
||||
} of flattenedConfigs) {
|
||||
if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
mergeChainOpts(chain, op);
|
||||
logger(config, index, envName);
|
||||
mergeChainOpts(chain, config);
|
||||
}
|
||||
|
||||
return chain;
|
||||
};
|
||||
}
|
||||
|
||||
function mergeExtendsChain(chain, opts, dirname, context, files) {
|
||||
function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) {
|
||||
if (opts.extends === undefined) return true;
|
||||
const file = (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller);
|
||||
const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller);
|
||||
|
||||
if (files.has(file)) {
|
||||
throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n"));
|
||||
}
|
||||
|
||||
files.add(file);
|
||||
const fileChain = loadFileChain(validateExtendFile(file), context, files);
|
||||
const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger);
|
||||
files.delete(file);
|
||||
if (!fileChain) return false;
|
||||
mergeChain(chain, fileChain);
|
||||
@@ -343,7 +407,7 @@ function normalizeOptions(opts) {
|
||||
delete options.include;
|
||||
delete options.exclude;
|
||||
|
||||
if (options.hasOwnProperty("sourceMap")) {
|
||||
if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
|
||||
options.sourceMaps = options.sourceMap;
|
||||
delete options.sourceMap;
|
||||
}
|
||||
@@ -402,12 +466,28 @@ function configFieldIsApplicable(context, test, dirname) {
|
||||
|
||||
function shouldIgnore(context, ignore, only, dirname) {
|
||||
if (ignore && matchesPatterns(context, ignore, dirname)) {
|
||||
debug("Ignored %o because it matched one of %O from %o", context.filename, ignore, dirname);
|
||||
var _context$filename;
|
||||
|
||||
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
|
||||
if (context.showConfig) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (only && !matchesPatterns(context, only, dirname)) {
|
||||
debug("Ignored %o because it failed to match one of %O from %o", context.filename, only, dirname);
|
||||
var _context$filename2;
|
||||
|
||||
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
|
||||
if (context.showConfig) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
11
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
11
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
@@ -53,14 +53,14 @@ function createUncachedDescriptors(dirname, options, alias) {
|
||||
}
|
||||
|
||||
const PRESET_DESCRIPTOR_CACHE = new WeakMap();
|
||||
const createCachedPresetDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
|
||||
const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||
const dirname = cache.using(dir => dir);
|
||||
return (0, _caching.makeStrongCache)(alias => (0, _caching.makeStrongCache)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc))));
|
||||
return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCacheSync)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc))));
|
||||
});
|
||||
const PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
|
||||
const createCachedPluginDescriptors = (0, _caching.makeWeakCache)((items, cache) => {
|
||||
const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||
const dirname = cache.using(dir => dir);
|
||||
return (0, _caching.makeStrongCache)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
|
||||
return (0, _caching.makeStrongCacheSync)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
|
||||
});
|
||||
const DEFAULT_OPTIONS = {};
|
||||
|
||||
@@ -202,7 +202,8 @@ function assertNoDuplicates(items) {
|
||||
}
|
||||
|
||||
if (nameMap.has(item.name)) {
|
||||
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`].join("\n"));
|
||||
const conflicts = items.filter(i => i.value === item.value);
|
||||
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, ``, `Duplicates detected are:`, `${JSON.stringify(conflicts, null, 2)}`].join("\n"));
|
||||
}
|
||||
|
||||
nameMap.add(item.name);
|
||||
|
||||
144
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
144
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
@@ -7,6 +7,8 @@ exports.findConfigUpwards = findConfigUpwards;
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
|
||||
function _debug() {
|
||||
const data = _interopRequireDefault(require("debug"));
|
||||
@@ -28,16 +30,6 @@ function _path() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _json() {
|
||||
const data = _interopRequireDefault(require("json5"));
|
||||
|
||||
@@ -48,10 +40,10 @@ function _json() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _resolve() {
|
||||
const data = _interopRequireDefault(require("resolve"));
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_resolve = function () {
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -64,22 +56,34 @@ var _configApi = _interopRequireDefault(require("../helpers/config-api"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _moduleTypes = _interopRequireDefault(require("./module-types"));
|
||||
|
||||
var _patternToRegex = _interopRequireDefault(require("../pattern-to-regex"));
|
||||
|
||||
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
|
||||
|
||||
var _resolve = _interopRequireDefault(require("../../gensync-utils/resolve"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const debug = (0, _debug().default)("babel:config:loading:files:configuration");
|
||||
const BABEL_CONFIG_JS_FILENAME = "babel.config.js";
|
||||
const BABELRC_FILENAME = ".babelrc";
|
||||
const BABELRC_JS_FILENAME = ".babelrc.js";
|
||||
const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json"];
|
||||
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
|
||||
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json"];
|
||||
const BABELIGNORE_FILENAME = ".babelignore";
|
||||
|
||||
function findConfigUpwards(rootDir) {
|
||||
function* findConfigUpwards(rootDir) {
|
||||
let dirname = rootDir;
|
||||
|
||||
while (true) {
|
||||
if (_fs().default.existsSync(_path().default.join(dirname, BABEL_CONFIG_JS_FILENAME))) {
|
||||
return dirname;
|
||||
for (const filename of ROOT_CONFIG_FILENAMES) {
|
||||
if (yield* fs.exists(_path().default.join(dirname, filename))) {
|
||||
return dirname;
|
||||
}
|
||||
}
|
||||
|
||||
const nextDir = _path().default.dirname(dirname);
|
||||
@@ -91,7 +95,7 @@ function findConfigUpwards(rootDir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function findRelativeConfig(packageData, envName, caller) {
|
||||
function* findRelativeConfig(packageData, envName, caller) {
|
||||
let config = null;
|
||||
let ignore = null;
|
||||
|
||||
@@ -99,36 +103,15 @@ function findRelativeConfig(packageData, envName, caller) {
|
||||
|
||||
for (const loc of packageData.directories) {
|
||||
if (!config) {
|
||||
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce((previousConfig, name) => {
|
||||
const filepath = _path().default.join(loc, name);
|
||||
var _packageData$pkg;
|
||||
|
||||
const config = readConfig(filepath, envName, caller);
|
||||
|
||||
if (config && previousConfig) {
|
||||
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${name}\n` + `from ${loc}`);
|
||||
}
|
||||
|
||||
return config || previousConfig;
|
||||
}, null);
|
||||
const pkgConfig = packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) : null;
|
||||
|
||||
if (pkgConfig) {
|
||||
if (config) {
|
||||
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(pkgConfig.filepath)}#babel\n` + ` - ${_path().default.basename(config.filepath)}\n` + `from ${loc}`);
|
||||
}
|
||||
|
||||
config = pkgConfig;
|
||||
}
|
||||
|
||||
if (config) {
|
||||
debug("Found configuration %o from %o.", config.filepath, dirname);
|
||||
}
|
||||
config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null);
|
||||
}
|
||||
|
||||
if (!ignore) {
|
||||
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
|
||||
|
||||
ignore = readIgnoreConfig(ignoreLoc);
|
||||
ignore = yield* readIgnoreConfig(ignoreLoc);
|
||||
|
||||
if (ignore) {
|
||||
debug("Found ignore %o from %o.", ignore.filepath, dirname);
|
||||
@@ -143,23 +126,31 @@ function findRelativeConfig(packageData, envName, caller) {
|
||||
}
|
||||
|
||||
function findRootConfig(dirname, envName, caller) {
|
||||
const filepath = _path().default.resolve(dirname, BABEL_CONFIG_JS_FILENAME);
|
||||
|
||||
const conf = readConfig(filepath, envName, caller);
|
||||
|
||||
if (conf) {
|
||||
debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname);
|
||||
}
|
||||
|
||||
return conf;
|
||||
return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
|
||||
}
|
||||
|
||||
function loadConfig(name, dirname, envName, caller) {
|
||||
const filepath = _resolve().default.sync(name, {
|
||||
function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) {
|
||||
const configs = yield* _gensync().default.all(names.map(filename => readConfig(_path().default.join(dirname, filename), envName, caller)));
|
||||
const config = configs.reduce((previousConfig, config) => {
|
||||
if (config && previousConfig) {
|
||||
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`);
|
||||
}
|
||||
|
||||
return config || previousConfig;
|
||||
}, previousConfig);
|
||||
|
||||
if (config) {
|
||||
debug("Found configuration %o from %o.", config.filepath, dirname);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function* loadConfig(name, dirname, envName, caller) {
|
||||
const filepath = yield* (0, _resolve.default)(name, {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
const conf = readConfig(filepath, envName, caller);
|
||||
const conf = yield* readConfig(filepath, envName, caller);
|
||||
|
||||
if (!conf) {
|
||||
throw new Error(`Config file ${filepath} contains no configuration data`);
|
||||
@@ -170,15 +161,17 @@ function loadConfig(name, dirname, envName, caller) {
|
||||
}
|
||||
|
||||
function readConfig(filepath, envName, caller) {
|
||||
return _path().default.extname(filepath) === ".js" ? readConfigJS(filepath, {
|
||||
const ext = _path().default.extname(filepath);
|
||||
|
||||
return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, {
|
||||
envName,
|
||||
caller
|
||||
}) : readConfigJSON5(filepath);
|
||||
}
|
||||
|
||||
const LOADING_CONFIGS = new Set();
|
||||
const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
|
||||
if (!_fs().default.existsSync(filepath)) {
|
||||
const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepath, cache) {
|
||||
if (!fs.exists.sync(filepath)) {
|
||||
cache.forever();
|
||||
return null;
|
||||
}
|
||||
@@ -197,10 +190,7 @@ const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
|
||||
|
||||
try {
|
||||
LOADING_CONFIGS.add(filepath);
|
||||
|
||||
const configModule = require(filepath);
|
||||
|
||||
options = configModule && configModule.__esModule ? configModule.default || undefined : configModule;
|
||||
options = yield* (0, _moduleTypes.default)(filepath, "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously.");
|
||||
} catch (err) {
|
||||
err.message = `${filepath}: Error while loading config - ${err.message}`;
|
||||
throw err;
|
||||
@@ -208,9 +198,12 @@ const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
|
||||
LOADING_CONFIGS.delete(filepath);
|
||||
}
|
||||
|
||||
let assertCache = false;
|
||||
|
||||
if (typeof options === "function") {
|
||||
yield* [];
|
||||
options = options((0, _configApi.default)(cache));
|
||||
if (!cache.configured()) throwConfigError();
|
||||
assertCache = true;
|
||||
}
|
||||
|
||||
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
||||
@@ -221,13 +214,14 @@ const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
|
||||
throw new Error(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`);
|
||||
}
|
||||
|
||||
if (assertCache && !cache.configured()) throwConfigError();
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
options
|
||||
};
|
||||
});
|
||||
const packageToBabelConfig = (0, _caching.makeWeakCache)(file => {
|
||||
const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => {
|
||||
const babel = file.options["babel"];
|
||||
if (typeof babel === "undefined") return null;
|
||||
|
||||
@@ -285,6 +279,24 @@ const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) =>
|
||||
};
|
||||
});
|
||||
|
||||
function* resolveShowConfigPath(dirname) {
|
||||
const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;
|
||||
|
||||
if (targetPath != null) {
|
||||
const absolutePath = _path().default.resolve(dirname, targetPath);
|
||||
|
||||
const stats = yield* fs.stat(absolutePath);
|
||||
|
||||
if (!stats.isFile()) {
|
||||
throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);
|
||||
}
|
||||
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function throwConfigError() {
|
||||
throw new Error(`\
|
||||
Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
|
||||
|
||||
10
node_modules/@babel/core/lib/config/files/import.js
generated
vendored
Normal file
10
node_modules/@babel/core/lib/config/files/import.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = import_;
|
||||
|
||||
function import_(filepath) {
|
||||
return import(filepath);
|
||||
}
|
||||
19
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
19
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
@@ -8,16 +8,18 @@ exports.findPackageData = findPackageData;
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
exports.loadPlugin = loadPlugin;
|
||||
exports.loadPreset = loadPreset;
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
|
||||
function findConfigUpwards(rootDir) {
|
||||
function* findConfigUpwards(rootDir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function findPackageData(filepath) {
|
||||
function* findPackageData(filepath) {
|
||||
return {
|
||||
filepath,
|
||||
directories: [],
|
||||
@@ -26,7 +28,7 @@ function findPackageData(filepath) {
|
||||
};
|
||||
}
|
||||
|
||||
function findRelativeConfig(pkgData, envName, caller) {
|
||||
function* findRelativeConfig(pkgData, envName, caller) {
|
||||
return {
|
||||
pkg: null,
|
||||
config: null,
|
||||
@@ -34,14 +36,21 @@ function findRelativeConfig(pkgData, envName, caller) {
|
||||
};
|
||||
}
|
||||
|
||||
function findRootConfig(dirname, envName, caller) {
|
||||
function* findRootConfig(dirname, envName, caller) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function loadConfig(name, dirname, envName, caller) {
|
||||
function* loadConfig(name, dirname, envName, caller) {
|
||||
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
|
||||
}
|
||||
|
||||
function* resolveShowConfigPath(dirname) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ROOT_CONFIG_FILENAMES = [];
|
||||
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
|
||||
|
||||
function resolvePlugin(name, dirname) {
|
||||
return null;
|
||||
}
|
||||
|
||||
12
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
12
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
@@ -33,6 +33,18 @@ Object.defineProperty(exports, "loadConfig", {
|
||||
return _configuration.loadConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolveShowConfigPath", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.resolveShowConfigPath;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.ROOT_CONFIG_FILENAMES;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePlugin", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
|
||||
96
node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
Normal file
96
node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadCjsOrMjsDefault;
|
||||
|
||||
var _async = require("../../gensync-utils/async");
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _url() {
|
||||
const data = require("url");
|
||||
|
||||
_url = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
let import_;
|
||||
|
||||
try {
|
||||
import_ = require("./import").default;
|
||||
} catch (_unused) {}
|
||||
|
||||
function* loadCjsOrMjsDefault(filepath, asyncError) {
|
||||
switch (guessJSModuleType(filepath)) {
|
||||
case "cjs":
|
||||
return loadCjsDefault(filepath);
|
||||
|
||||
case "unknown":
|
||||
try {
|
||||
return loadCjsDefault(filepath);
|
||||
} catch (e) {
|
||||
if (e.code !== "ERR_REQUIRE_ESM") throw e;
|
||||
}
|
||||
|
||||
case "mjs":
|
||||
if (yield* (0, _async.isAsync)()) {
|
||||
return yield* (0, _async.waitFor)(loadMjsDefault(filepath));
|
||||
}
|
||||
|
||||
throw new Error(asyncError);
|
||||
}
|
||||
}
|
||||
|
||||
function guessJSModuleType(filename) {
|
||||
switch (_path().default.extname(filename)) {
|
||||
case ".cjs":
|
||||
return "cjs";
|
||||
|
||||
case ".mjs":
|
||||
return "mjs";
|
||||
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
function loadCjsDefault(filepath) {
|
||||
const module = require(filepath);
|
||||
|
||||
return (module == null ? void 0 : module.__esModule) ? module.default || undefined : module;
|
||||
}
|
||||
|
||||
function loadMjsDefault(_x) {
|
||||
return _loadMjsDefault.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _loadMjsDefault() {
|
||||
_loadMjsDefault = _asyncToGenerator(function* (filepath) {
|
||||
if (!import_) {
|
||||
throw new Error("Internal error: Native ECMAScript modules aren't supported" + " by this platform.\n");
|
||||
}
|
||||
|
||||
const module = yield import_((0, _url().pathToFileURL)(filepath));
|
||||
return module.default;
|
||||
});
|
||||
return _loadMjsDefault.apply(this, arguments);
|
||||
}
|
||||
6
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
6
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
@@ -21,7 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
|
||||
const PACKAGE_FILENAME = "package.json";
|
||||
|
||||
function findPackageData(filepath) {
|
||||
function* findPackageData(filepath) {
|
||||
let pkg = null;
|
||||
const directories = [];
|
||||
let isPackage = true;
|
||||
@@ -30,7 +30,7 @@ function findPackageData(filepath) {
|
||||
|
||||
while (!pkg && _path().default.basename(dirname) !== "node_modules") {
|
||||
directories.push(dirname);
|
||||
pkg = readConfigPackage(_path().default.join(dirname, PACKAGE_FILENAME));
|
||||
pkg = yield* readConfigPackage(_path().default.join(dirname, PACKAGE_FILENAME));
|
||||
|
||||
const nextLoc = _path().default.dirname(dirname);
|
||||
|
||||
@@ -60,6 +60,8 @@ const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) =>
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!options) throw new Error(`${filepath}: No config detected`);
|
||||
|
||||
if (typeof options !== "object") {
|
||||
throw new Error(`${filepath}: Config returned typeof ${typeof options}`);
|
||||
}
|
||||
|
||||
6
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
6
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
@@ -113,7 +113,7 @@ function resolveStandardizedName(type, name, dirname = process.cwd()) {
|
||||
});
|
||||
|
||||
resolvedOriginal = true;
|
||||
} catch (e2) {}
|
||||
} catch (_unused) {}
|
||||
|
||||
if (resolvedOriginal) {
|
||||
e.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
|
||||
@@ -128,7 +128,7 @@ function resolveStandardizedName(type, name, dirname = process.cwd()) {
|
||||
});
|
||||
|
||||
resolvedBabel = true;
|
||||
} catch (e2) {}
|
||||
} catch (_unused2) {}
|
||||
|
||||
if (resolvedBabel) {
|
||||
e.message += `\n- Did you mean "@babel/${name}"?`;
|
||||
@@ -143,7 +143,7 @@ function resolveStandardizedName(type, name, dirname = process.cwd()) {
|
||||
});
|
||||
|
||||
resolvedOppositeType = true;
|
||||
} catch (e2) {}
|
||||
} catch (_unused3) {}
|
||||
|
||||
if (resolvedOppositeType) {
|
||||
e.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
|
||||
|
||||
25
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
25
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
@@ -5,34 +5,41 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.makeStaticFileCache = makeStaticFileCache;
|
||||
|
||||
function _fs() {
|
||||
var _caching = require("../caching");
|
||||
|
||||
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
|
||||
|
||||
function _fs2() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
_fs2 = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _caching = require("../caching");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function makeStaticFileCache(fn) {
|
||||
return (0, _caching.makeStrongCache)((filepath, cache) => {
|
||||
if (cache.invalidate(() => fileMtime(filepath)) === null) {
|
||||
cache.forever();
|
||||
return (0, _caching.makeStrongCache)(function* (filepath, cache) {
|
||||
const cached = cache.invalidate(() => fileMtime(filepath));
|
||||
|
||||
if (cached === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return fn(filepath, _fs().default.readFileSync(filepath, "utf8"));
|
||||
return fn(filepath, yield* fs.readFile(filepath, "utf8"));
|
||||
});
|
||||
}
|
||||
|
||||
function fileMtime(filepath) {
|
||||
try {
|
||||
return +_fs().default.statSync(filepath).mtime;
|
||||
return +_fs2().default.statSync(filepath).mtime;
|
||||
} catch (e) {
|
||||
if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e;
|
||||
}
|
||||
|
||||
137
node_modules/@babel/core/lib/config/full.js
generated
vendored
137
node_modules/@babel/core/lib/config/full.js
generated
vendored
@@ -3,7 +3,19 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadFullConfig;
|
||||
exports.default = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _async = require("../gensync-utils/async");
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
@@ -35,12 +47,14 @@ var _configApi = _interopRequireDefault(require("./helpers/config-api"));
|
||||
|
||||
var _partial = _interopRequireDefault(require("./partial"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
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; } }
|
||||
|
||||
function loadFullConfig(inputOpts) {
|
||||
const result = (0, _partial.default)(inputOpts);
|
||||
var _default = (0, _gensync().default)(function* loadFullConfig(inputOpts) {
|
||||
const result = yield* (0, _partial.default)(inputOpts);
|
||||
|
||||
if (!result) {
|
||||
return null;
|
||||
@@ -63,35 +77,55 @@ function loadFullConfig(inputOpts) {
|
||||
throw new Error("Assertion failure - plugins and presets exist");
|
||||
}
|
||||
|
||||
const ignored = function recurseDescriptors(config, pass) {
|
||||
const plugins = config.plugins.reduce((acc, descriptor) => {
|
||||
if (descriptor.options !== false) {
|
||||
acc.push(loadPluginDescriptor(descriptor, context));
|
||||
}
|
||||
const ignored = yield* function* recurseDescriptors(config, pass) {
|
||||
const plugins = [];
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
const presets = config.presets.reduce((acc, descriptor) => {
|
||||
if (descriptor.options !== false) {
|
||||
acc.push({
|
||||
preset: loadPresetDescriptor(descriptor, context),
|
||||
pass: descriptor.ownPass ? [] : pass
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < config.plugins.length; i++) {
|
||||
const descriptor = config.plugins[i];
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
plugins.push(yield* loadPluginDescriptor(descriptor, context));
|
||||
} catch (e) {
|
||||
if (i > 0 && e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(config.plugins[i - 1], descriptor, "plugin", i, e);
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const presets = [];
|
||||
|
||||
for (let i = 0; i < config.presets.length; i++) {
|
||||
const descriptor = config.presets[i];
|
||||
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
presets.push({
|
||||
preset: yield* loadPresetDescriptor(descriptor, context),
|
||||
pass: descriptor.ownPass ? [] : pass
|
||||
});
|
||||
} catch (e) {
|
||||
if (i > 0 && e.code === "BABEL_UNKNOWN_OPTION") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(config.presets[i - 1], descriptor, "preset", i, e);
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (presets.length > 0) {
|
||||
passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass));
|
||||
|
||||
for (const _ref of presets) {
|
||||
const {
|
||||
preset,
|
||||
pass
|
||||
} = _ref;
|
||||
for (const {
|
||||
preset,
|
||||
pass
|
||||
} of presets) {
|
||||
if (!preset) return true;
|
||||
const ignored = recurseDescriptors({
|
||||
const ignored = yield* recurseDescriptors({
|
||||
plugins: preset.plugins,
|
||||
presets: preset.presets
|
||||
}, pass);
|
||||
@@ -125,7 +159,6 @@ function loadFullConfig(inputOpts) {
|
||||
return desc;
|
||||
})
|
||||
}, passes[0]);
|
||||
|
||||
if (ignored) return null;
|
||||
} catch (e) {
|
||||
if (!/^\[BABEL\]/.test(e.message)) {
|
||||
@@ -146,14 +179,15 @@ function loadFullConfig(inputOpts) {
|
||||
options: opts,
|
||||
passes: passes
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const loadDescriptor = (0, _caching.makeWeakCache)(({
|
||||
exports.default = _default;
|
||||
const loadDescriptor = (0, _caching.makeWeakCache)(function* ({
|
||||
value,
|
||||
options,
|
||||
dirname,
|
||||
alias
|
||||
}, cache) => {
|
||||
}, cache) {
|
||||
if (options === false) throw new Error("Assertion failure");
|
||||
options = options || {};
|
||||
let item = value;
|
||||
@@ -177,6 +211,7 @@ const loadDescriptor = (0, _caching.makeWeakCache)(({
|
||||
}
|
||||
|
||||
if (typeof item.then === "function") {
|
||||
yield* [];
|
||||
throw new Error(`You appear to be using an async 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.`);
|
||||
}
|
||||
|
||||
@@ -188,7 +223,7 @@ const loadDescriptor = (0, _caching.makeWeakCache)(({
|
||||
};
|
||||
});
|
||||
|
||||
function loadPluginDescriptor(descriptor, context) {
|
||||
function* loadPluginDescriptor(descriptor, context) {
|
||||
if (descriptor.value instanceof _plugin.default) {
|
||||
if (descriptor.options) {
|
||||
throw new Error("Passed options to an existing Plugin instance will not work.");
|
||||
@@ -197,15 +232,15 @@ function loadPluginDescriptor(descriptor, context) {
|
||||
return descriptor.value;
|
||||
}
|
||||
|
||||
return instantiatePlugin(loadDescriptor(descriptor, context), context);
|
||||
return yield* instantiatePlugin(yield* loadDescriptor(descriptor, context), context);
|
||||
}
|
||||
|
||||
const instantiatePlugin = (0, _caching.makeWeakCache)(({
|
||||
const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
|
||||
value,
|
||||
options,
|
||||
dirname,
|
||||
alias
|
||||
}, cache) => {
|
||||
}, cache) {
|
||||
const pluginObj = (0, _plugins.validatePluginObject)(value);
|
||||
const plugin = Object.assign({}, pluginObj);
|
||||
|
||||
@@ -221,7 +256,9 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(({
|
||||
options,
|
||||
dirname
|
||||
};
|
||||
const inherits = cache.invalidate(data => loadPluginDescriptor(inheritsDescriptor, data));
|
||||
const inherits = yield* (0, _async.forwardAsync)(loadPluginDescriptor, run => {
|
||||
return cache.invalidate(data => run(inheritsDescriptor, data));
|
||||
});
|
||||
plugin.pre = chain(inherits.pre, plugin.pre);
|
||||
plugin.post = chain(inherits.post, plugin.post);
|
||||
plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions);
|
||||
@@ -231,11 +268,33 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(({
|
||||
return new _plugin.default(plugin, options, alias);
|
||||
});
|
||||
|
||||
const loadPresetDescriptor = (descriptor, context) => {
|
||||
return (0, _configChain.buildPresetChain)(instantiatePreset(loadDescriptor(descriptor, context)), context);
|
||||
const validateIfOptionNeedsFilename = (options, descriptor) => {
|
||||
if (options.test || options.include || options.exclude) {
|
||||
const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */";
|
||||
throw new Error([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n"));
|
||||
}
|
||||
};
|
||||
|
||||
const instantiatePreset = (0, _caching.makeWeakCache)(({
|
||||
const validatePreset = (preset, context, descriptor) => {
|
||||
if (!context.filename) {
|
||||
const {
|
||||
options
|
||||
} = preset;
|
||||
validateIfOptionNeedsFilename(options, descriptor);
|
||||
|
||||
if (options.overrides) {
|
||||
options.overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function* loadPresetDescriptor(descriptor, context) {
|
||||
const preset = instantiatePreset(yield* loadDescriptor(descriptor, context));
|
||||
validatePreset(preset, context, descriptor);
|
||||
return yield* (0, _configChain.buildPresetChain)(preset, context);
|
||||
}
|
||||
|
||||
const instantiatePreset = (0, _caching.makeWeakCacheSync)(({
|
||||
value,
|
||||
dirname,
|
||||
alias
|
||||
|
||||
3
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
3
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
@@ -47,8 +47,7 @@ function makeAPI(cache) {
|
||||
env,
|
||||
async: () => false,
|
||||
caller,
|
||||
assertVersion,
|
||||
tokTypes: undefined
|
||||
assertVersion
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
50
node_modules/@babel/core/lib/config/index.js
generated
vendored
50
node_modules/@babel/core/lib/config/index.js
generated
vendored
@@ -3,19 +3,23 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.loadOptions = loadOptions;
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _full.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _partial.loadPartialConfig;
|
||||
}
|
||||
});
|
||||
exports.loadOptionsAsync = exports.loadOptionsSync = exports.loadOptions = exports.loadPartialConfigAsync = exports.loadPartialConfigSync = exports.loadPartialConfig = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _full = _interopRequireDefault(require("./full"));
|
||||
|
||||
@@ -23,7 +27,31 @@ var _partial = require("./partial");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function loadOptions(opts) {
|
||||
const config = (0, _full.default)(opts);
|
||||
return config ? config.options : null;
|
||||
}
|
||||
const loadOptionsRunner = (0, _gensync().default)(function* (opts) {
|
||||
var _config$options;
|
||||
|
||||
const config = yield* (0, _full.default)(opts);
|
||||
return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null;
|
||||
});
|
||||
|
||||
const maybeErrback = runner => (opts, callback) => {
|
||||
if (callback === undefined && typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
return callback ? runner.errback(opts, callback) : runner.sync(opts);
|
||||
};
|
||||
|
||||
const loadPartialConfig = maybeErrback(_partial.loadPartialConfig);
|
||||
exports.loadPartialConfig = loadPartialConfig;
|
||||
const loadPartialConfigSync = _partial.loadPartialConfig.sync;
|
||||
exports.loadPartialConfigSync = loadPartialConfigSync;
|
||||
const loadPartialConfigAsync = _partial.loadPartialConfig.async;
|
||||
exports.loadPartialConfigAsync = loadPartialConfigAsync;
|
||||
const loadOptions = maybeErrback(loadOptionsRunner);
|
||||
exports.loadOptions = loadOptions;
|
||||
const loadOptionsSync = loadOptionsRunner.sync;
|
||||
exports.loadOptionsSync = loadOptionsSync;
|
||||
const loadOptionsAsync = loadOptionsRunner.async;
|
||||
exports.loadOptionsAsync = loadOptionsAsync;
|
||||
46
node_modules/@babel/core/lib/config/partial.js
generated
vendored
46
node_modules/@babel/core/lib/config/partial.js
generated
vendored
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadPrivatePartialConfig;
|
||||
exports.loadPartialConfig = loadPartialConfig;
|
||||
exports.loadPartialConfig = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
@@ -16,6 +16,16 @@ function _path() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _plugin = _interopRequireDefault(require("./plugin"));
|
||||
|
||||
var _util = require("./util");
|
||||
@@ -32,33 +42,33 @@ var _files = require("./files");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function resolveRootMode(rootDir, rootMode) {
|
||||
function* resolveRootMode(rootDir, rootMode) {
|
||||
switch (rootMode) {
|
||||
case "root":
|
||||
return rootDir;
|
||||
|
||||
case "upward-optional":
|
||||
{
|
||||
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
|
||||
const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
|
||||
return upwardRootDir === null ? rootDir : upwardRootDir;
|
||||
}
|
||||
|
||||
case "upward":
|
||||
{
|
||||
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
|
||||
const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
|
||||
if (upwardRootDir !== null) return upwardRootDir;
|
||||
throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}"`), {
|
||||
throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}".\n` + `One of the following config files must be in the directory tree: ` + `"${_files.ROOT_CONFIG_FILENAMES.join(", ")}".`), {
|
||||
code: "BABEL_ROOT_NOT_FOUND",
|
||||
dirname: rootDir
|
||||
});
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error(`Assertion failure - unknown rootMode value`);
|
||||
throw new Error(`Assertion failure - unknown rootMode value.`);
|
||||
}
|
||||
}
|
||||
|
||||
function loadPrivatePartialConfig(inputOpts) {
|
||||
function* loadPrivatePartialConfig(inputOpts) {
|
||||
if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) {
|
||||
throw new Error("Babel options must be an object, null, or undefined");
|
||||
}
|
||||
@@ -69,25 +79,30 @@ function loadPrivatePartialConfig(inputOpts) {
|
||||
cwd = ".",
|
||||
root: rootDir = ".",
|
||||
rootMode = "root",
|
||||
caller
|
||||
caller,
|
||||
cloneInputAst = true
|
||||
} = args;
|
||||
|
||||
const absoluteCwd = _path().default.resolve(cwd);
|
||||
|
||||
const absoluteRootDir = resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode);
|
||||
const absoluteRootDir = yield* resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode);
|
||||
const filename = typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined;
|
||||
const showConfigPath = yield* (0, _files.resolveShowConfigPath)(absoluteCwd);
|
||||
const context = {
|
||||
filename: typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined,
|
||||
filename,
|
||||
cwd: absoluteCwd,
|
||||
root: absoluteRootDir,
|
||||
envName,
|
||||
caller
|
||||
caller,
|
||||
showConfig: showConfigPath === filename
|
||||
};
|
||||
const configChain = (0, _configChain.buildRootChain)(args, context);
|
||||
const configChain = yield* (0, _configChain.buildRootChain)(args, context);
|
||||
if (!configChain) return null;
|
||||
const options = {};
|
||||
configChain.options.forEach(opts => {
|
||||
(0, _util.mergeOptions)(options, opts);
|
||||
});
|
||||
options.cloneInputAst = cloneInputAst;
|
||||
options.babelrc = false;
|
||||
options.configFile = false;
|
||||
options.passPerPreset = false;
|
||||
@@ -106,8 +121,8 @@ function loadPrivatePartialConfig(inputOpts) {
|
||||
};
|
||||
}
|
||||
|
||||
function loadPartialConfig(inputOpts) {
|
||||
const result = loadPrivatePartialConfig(inputOpts);
|
||||
const loadPartialConfig = (0, _gensync().default)(function* (inputOpts) {
|
||||
const result = yield* loadPrivatePartialConfig(inputOpts);
|
||||
if (!result) return null;
|
||||
const {
|
||||
options,
|
||||
@@ -121,7 +136,8 @@ function loadPartialConfig(inputOpts) {
|
||||
}
|
||||
});
|
||||
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined);
|
||||
}
|
||||
});
|
||||
exports.loadPartialConfig = loadPartialConfig;
|
||||
|
||||
class PartialConfig {
|
||||
constructor(options, babelrc, ignore, config) {
|
||||
|
||||
127
node_modules/@babel/core/lib/config/printer.js
generated
vendored
Normal file
127
node_modules/@babel/core/lib/config/printer.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ConfigPrinter = exports.ChainFormatter = void 0;
|
||||
const ChainFormatter = {
|
||||
Programmatic: 0,
|
||||
Config: 1
|
||||
};
|
||||
exports.ChainFormatter = ChainFormatter;
|
||||
const Formatter = {
|
||||
title(type, callerName, filepath) {
|
||||
let title = "";
|
||||
|
||||
if (type === ChainFormatter.Programmatic) {
|
||||
title = "programmatic options";
|
||||
|
||||
if (callerName) {
|
||||
title += " from " + callerName;
|
||||
}
|
||||
} else {
|
||||
title = "config " + filepath;
|
||||
}
|
||||
|
||||
return title;
|
||||
},
|
||||
|
||||
loc(index, envName) {
|
||||
let loc = "";
|
||||
|
||||
if (index != null) {
|
||||
loc += `.overrides[${index}]`;
|
||||
}
|
||||
|
||||
if (envName != null) {
|
||||
loc += `.env["${envName}"]`;
|
||||
}
|
||||
|
||||
return loc;
|
||||
},
|
||||
|
||||
optionsAndDescriptors(opt) {
|
||||
const content = Object.assign({}, opt.options);
|
||||
delete content.overrides;
|
||||
delete content.env;
|
||||
const pluginDescriptors = [...opt.plugins()];
|
||||
|
||||
if (pluginDescriptors.length) {
|
||||
content.plugins = pluginDescriptors.map(d => descriptorToConfig(d));
|
||||
}
|
||||
|
||||
const presetDescriptors = [...opt.presets()];
|
||||
|
||||
if (presetDescriptors.length) {
|
||||
content.presets = [...presetDescriptors].map(d => descriptorToConfig(d));
|
||||
}
|
||||
|
||||
return JSON.stringify(content, undefined, 2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function descriptorToConfig(d) {
|
||||
var _d$file;
|
||||
|
||||
let name = (_d$file = d.file) == null ? void 0 : _d$file.request;
|
||||
|
||||
if (name == null) {
|
||||
if (typeof d.value === "object") {
|
||||
name = d.value;
|
||||
} else if (typeof d.value === "function") {
|
||||
name = `[Function: ${d.value.toString().substr(0, 50)} ... ]`;
|
||||
}
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
name = "[Unknown]";
|
||||
}
|
||||
|
||||
if (d.options === undefined) {
|
||||
return name;
|
||||
} else if (d.name == null) {
|
||||
return [name, d.options];
|
||||
} else {
|
||||
return [name, d.options, d.name];
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigPrinter {
|
||||
constructor() {
|
||||
this._stack = [];
|
||||
}
|
||||
|
||||
configure(enabled, type, {
|
||||
callerName,
|
||||
filepath
|
||||
}) {
|
||||
if (!enabled) return () => {};
|
||||
return (content, index, envName) => {
|
||||
this._stack.push({
|
||||
type,
|
||||
callerName,
|
||||
filepath,
|
||||
content,
|
||||
index,
|
||||
envName
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
static format(config) {
|
||||
let title = Formatter.title(config.type, config.callerName, config.filepath);
|
||||
const loc = Formatter.loc(config.index, config.envName);
|
||||
if (loc) title += ` ${loc}`;
|
||||
const content = Formatter.optionsAndDescriptors(config.content);
|
||||
return `${title}\n${content}`;
|
||||
}
|
||||
|
||||
output() {
|
||||
if (this._stack.length === 0) return "";
|
||||
return this._stack.map(s => ConfigPrinter.format(s)).join("\n\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.ConfigPrinter = ConfigPrinter;
|
||||
5
node_modules/@babel/core/lib/config/util.js
generated
vendored
5
node_modules/@babel/core/lib/config/util.js
generated
vendored
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.mergeOptions = mergeOptions;
|
||||
exports.isIterableIterator = isIterableIterator;
|
||||
|
||||
function mergeOptions(target, source) {
|
||||
for (const k of Object.keys(source)) {
|
||||
@@ -27,4 +28,8 @@ function mergeDefaultFields(target, source) {
|
||||
const val = source[k];
|
||||
if (val !== undefined) target[k] = val;
|
||||
}
|
||||
}
|
||||
|
||||
function isIterableIterator(value) {
|
||||
return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
|
||||
}
|
||||
15
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
15
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validate = validate;
|
||||
exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs;
|
||||
|
||||
var _plugin = _interopRequireDefault(require("../plugin"));
|
||||
|
||||
@@ -23,6 +24,7 @@ const ROOT_VALIDATORS = {
|
||||
filenameRelative: _optionAssertions.assertString,
|
||||
code: _optionAssertions.assertBoolean,
|
||||
ast: _optionAssertions.assertBoolean,
|
||||
cloneInputAst: _optionAssertions.assertBoolean,
|
||||
envName: _optionAssertions.assertString
|
||||
};
|
||||
const BABELRC_VALIDATORS = {
|
||||
@@ -117,10 +119,11 @@ function throwUnknownError(loc) {
|
||||
message,
|
||||
version = 5
|
||||
} = _removed.default[key];
|
||||
throw new ReferenceError(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`);
|
||||
throw new Error(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`);
|
||||
} else {
|
||||
const unknownOptErr = `Unknown option: ${(0, _optionAssertions.msg)(loc)}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`;
|
||||
throw new ReferenceError(unknownOptErr);
|
||||
const unknownOptErr = new Error(`Unknown option: ${(0, _optionAssertions.msg)(loc)}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`);
|
||||
unknownOptErr.code = "BABEL_UNKNOWN_OPTION";
|
||||
throw unknownOptErr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,4 +188,10 @@ function assertOverridesList(loc, value) {
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
function checkNoUnwrappedItemOptionPairs(lastItem, thisItem, type, index, e) {
|
||||
if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") {
|
||||
e.message += `\n- Maybe you meant to use\n` + `"${type}": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;
|
||||
}
|
||||
}
|
||||
24
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
24
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
@@ -18,14 +18,14 @@ const VALIDATORS = {
|
||||
generatorOverride: _optionAssertions.assertFunction
|
||||
};
|
||||
|
||||
function assertVisitorMap(key, value) {
|
||||
const obj = (0, _optionAssertions.assertObject)(key, value);
|
||||
function assertVisitorMap(loc, value) {
|
||||
const obj = (0, _optionAssertions.assertObject)(loc, value);
|
||||
|
||||
if (obj) {
|
||||
Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop]));
|
||||
|
||||
if (obj.enter || obj.exit) {
|
||||
throw new Error(`.${key} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`);
|
||||
throw new Error(`${(0, _optionAssertions.msg)(loc)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,25 @@ function assertVisitorHandler(key, value) {
|
||||
}
|
||||
|
||||
function validatePluginObject(obj) {
|
||||
const rootPath = {
|
||||
type: "root",
|
||||
source: "plugin"
|
||||
};
|
||||
Object.keys(obj).forEach(key => {
|
||||
const validator = VALIDATORS[key];
|
||||
if (validator) validator(key, obj[key]);else throw new Error(`.${key} is not a valid Plugin property`);
|
||||
|
||||
if (validator) {
|
||||
const optLoc = {
|
||||
type: "option",
|
||||
name: key,
|
||||
parent: rootPath
|
||||
};
|
||||
validator(optLoc, obj[key]);
|
||||
} else {
|
||||
const invalidPluginPropertyError = new Error(`.${key} is not a valid Plugin property`);
|
||||
invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY";
|
||||
throw invalidPluginPropertyError;
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
89
node_modules/@babel/core/lib/gensync-utils/async.js
generated
vendored
Normal file
89
node_modules/@babel/core/lib/gensync-utils/async.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.maybeAsync = maybeAsync;
|
||||
exports.forwardAsync = forwardAsync;
|
||||
exports.isThenable = isThenable;
|
||||
exports.waitFor = exports.onFirstPause = exports.isAsync = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const id = x => x;
|
||||
|
||||
const runGenerator = (0, _gensync().default)(function* (item) {
|
||||
return yield* item;
|
||||
});
|
||||
const isAsync = (0, _gensync().default)({
|
||||
sync: () => false,
|
||||
errback: cb => cb(null, true)
|
||||
});
|
||||
exports.isAsync = isAsync;
|
||||
|
||||
function maybeAsync(fn, message) {
|
||||
return (0, _gensync().default)({
|
||||
sync(...args) {
|
||||
const result = fn.apply(this, args);
|
||||
if (isThenable(result)) throw new Error(message);
|
||||
return result;
|
||||
},
|
||||
|
||||
async(...args) {
|
||||
return Promise.resolve(fn.apply(this, args));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
const withKind = (0, _gensync().default)({
|
||||
sync: cb => cb("sync"),
|
||||
async: cb => cb("async")
|
||||
});
|
||||
|
||||
function forwardAsync(action, cb) {
|
||||
const g = (0, _gensync().default)(action);
|
||||
return withKind(kind => {
|
||||
const adapted = g[kind];
|
||||
return cb(adapted);
|
||||
});
|
||||
}
|
||||
|
||||
const onFirstPause = (0, _gensync().default)({
|
||||
name: "onFirstPause",
|
||||
arity: 2,
|
||||
sync: function (item) {
|
||||
return runGenerator.sync(item);
|
||||
},
|
||||
errback: function (item, firstPause, cb) {
|
||||
let completed = false;
|
||||
runGenerator.errback(item, (err, value) => {
|
||||
completed = true;
|
||||
cb(err, value);
|
||||
});
|
||||
|
||||
if (!completed) {
|
||||
firstPause();
|
||||
}
|
||||
}
|
||||
});
|
||||
exports.onFirstPause = onFirstPause;
|
||||
const waitFor = (0, _gensync().default)({
|
||||
sync: id,
|
||||
async: id
|
||||
});
|
||||
exports.waitFor = waitFor;
|
||||
|
||||
function isThenable(val) {
|
||||
return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function";
|
||||
}
|
||||
53
node_modules/@babel/core/lib/gensync-utils/fs.js
generated
vendored
Normal file
53
node_modules/@babel/core/lib/gensync-utils/fs.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.stat = exports.exists = exports.readFile = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const readFile = (0, _gensync().default)({
|
||||
sync: _fs().default.readFileSync,
|
||||
errback: _fs().default.readFile
|
||||
});
|
||||
exports.readFile = readFile;
|
||||
const exists = (0, _gensync().default)({
|
||||
sync(path) {
|
||||
try {
|
||||
_fs().default.accessSync(path);
|
||||
|
||||
return true;
|
||||
} catch (_unused) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
errback: (path, cb) => _fs().default.access(path, undefined, err => cb(null, !err))
|
||||
});
|
||||
exports.exists = exists;
|
||||
const stat = (0, _gensync().default)({
|
||||
sync: _fs().default.statSync,
|
||||
errback: _fs().default.stat
|
||||
});
|
||||
exports.stat = stat;
|
||||
35
node_modules/@babel/core/lib/gensync-utils/resolve.js
generated
vendored
Normal file
35
node_modules/@babel/core/lib/gensync-utils/resolve.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _resolve() {
|
||||
const data = _interopRequireDefault(require("resolve"));
|
||||
|
||||
_resolve = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = (0, _gensync().default)({
|
||||
sync: _resolve().default.sync,
|
||||
errback: _resolve().default
|
||||
});
|
||||
|
||||
exports.default = _default;
|
||||
28
node_modules/@babel/core/lib/index.js
generated
vendored
28
node_modules/@babel/core/lib/index.js
generated
vendored
@@ -70,12 +70,36 @@ Object.defineProperty(exports, "loadPartialConfig", {
|
||||
return _config.loadPartialConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfigSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfigSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfigAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfigAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptions", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptions;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptionsSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptionsSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptionsAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptionsAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transform", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
@@ -219,7 +243,9 @@ var _transformAst = require("./transform-ast");
|
||||
|
||||
var _parse = require("./parse");
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
|
||||
71
node_modules/@babel/core/lib/parse.js
generated
vendored
71
node_modules/@babel/core/lib/parse.js
generated
vendored
@@ -3,63 +3,48 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseSync = parseSync;
|
||||
exports.parseAsync = parseAsync;
|
||||
exports.parse = void 0;
|
||||
exports.parseAsync = exports.parseSync = exports.parse = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _normalizeFile = _interopRequireDefault(require("./transformation/normalize-file"));
|
||||
var _parser = _interopRequireDefault(require("./parser"));
|
||||
|
||||
var _normalizeOpts = _interopRequireDefault(require("./transformation/normalize-opts"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const parseRunner = (0, _gensync().default)(function* parse(code, opts) {
|
||||
const config = yield* (0, _config.default)(opts);
|
||||
|
||||
if (config === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return yield* (0, _parser.default)(config.passes, (0, _normalizeOpts.default)(config), code);
|
||||
});
|
||||
|
||||
const parse = function parse(code, opts, callback) {
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
if (callback === undefined) return parseSync(code, opts);
|
||||
const config = (0, _config.default)(opts);
|
||||
|
||||
if (config === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const cb = callback;
|
||||
process.nextTick(() => {
|
||||
let ast = null;
|
||||
|
||||
try {
|
||||
const cfg = (0, _config.default)(opts);
|
||||
if (cfg === null) return cb(null, null);
|
||||
ast = (0, _normalizeFile.default)(cfg.passes, (0, _normalizeOpts.default)(cfg), code).ast;
|
||||
} catch (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
cb(null, ast);
|
||||
});
|
||||
if (callback === undefined) return parseRunner.sync(code, opts);
|
||||
parseRunner.errback(code, opts, callback);
|
||||
};
|
||||
|
||||
exports.parse = parse;
|
||||
|
||||
function parseSync(code, opts) {
|
||||
const config = (0, _config.default)(opts);
|
||||
|
||||
if (config === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code).ast;
|
||||
}
|
||||
|
||||
function parseAsync(code, opts) {
|
||||
return new Promise((res, rej) => {
|
||||
parse(code, opts, (err, result) => {
|
||||
if (err == null) res(result);else rej(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
const parseSync = parseRunner.sync;
|
||||
exports.parseSync = parseSync;
|
||||
const parseAsync = parseRunner.async;
|
||||
exports.parseAsync = parseAsync;
|
||||
97
node_modules/@babel/core/lib/parser/index.js
generated
vendored
Normal file
97
node_modules/@babel/core/lib/parser/index.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = parser;
|
||||
|
||||
function _parser() {
|
||||
const data = require("@babel/parser");
|
||||
|
||||
_parser = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _codeFrame() {
|
||||
const data = require("@babel/code-frame");
|
||||
|
||||
_codeFrame = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _missingPluginHelper = _interopRequireDefault(require("./util/missing-plugin-helper"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function* parser(pluginPasses, {
|
||||
parserOpts,
|
||||
highlightCode = true,
|
||||
filename = "unknown"
|
||||
}, code) {
|
||||
try {
|
||||
const results = [];
|
||||
|
||||
for (const plugins of pluginPasses) {
|
||||
for (const plugin of plugins) {
|
||||
const {
|
||||
parserOverride
|
||||
} = plugin;
|
||||
|
||||
if (parserOverride) {
|
||||
const ast = parserOverride(code, parserOpts, _parser().parse);
|
||||
if (ast !== undefined) results.push(ast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (results.length === 0) {
|
||||
return (0, _parser().parse)(code, parserOpts);
|
||||
} else if (results.length === 1) {
|
||||
yield* [];
|
||||
|
||||
if (typeof results[0].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.`);
|
||||
}
|
||||
|
||||
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,
|
||||
missingPlugin
|
||||
} = err;
|
||||
|
||||
if (loc) {
|
||||
const codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
|
||||
start: {
|
||||
line: loc.line,
|
||||
column: loc.column + 1
|
||||
}
|
||||
}, {
|
||||
highlightCode
|
||||
});
|
||||
|
||||
if (missingPlugin) {
|
||||
err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
|
||||
} else {
|
||||
err.message = `${filename}: ${err.message}\n\n` + codeFrame;
|
||||
}
|
||||
|
||||
err.code = "BABEL_PARSE_ERROR";
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,32 @@ const pluginNameMap = {
|
||||
url: "https://git.io/vb4SL"
|
||||
}
|
||||
},
|
||||
classPrivateProperties: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-class-properties",
|
||||
url: "https://git.io/vb4yQ"
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-proposal-class-properties",
|
||||
url: "https://git.io/vb4SL"
|
||||
}
|
||||
},
|
||||
classPrivateMethods: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-class-properties",
|
||||
url: "https://git.io/vb4yQ"
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-proposal-private-methods",
|
||||
url: "https://git.io/JvpRG"
|
||||
}
|
||||
},
|
||||
decimal: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-decimal",
|
||||
url: "https://git.io/JfKOH"
|
||||
}
|
||||
},
|
||||
decorators: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-decorators",
|
||||
@@ -67,8 +93,8 @@ const pluginNameMap = {
|
||||
url: "https://git.io/vb4yb"
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-transform-flow-strip-types",
|
||||
url: "https://git.io/vb49g"
|
||||
name: "@babel/preset-flow",
|
||||
url: "https://git.io/JfeDn"
|
||||
}
|
||||
},
|
||||
functionBind: {
|
||||
@@ -103,28 +129,14 @@ const pluginNameMap = {
|
||||
url: "https://git.io/vb4yA"
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-transform-react-jsx",
|
||||
url: "https://git.io/vb4yd"
|
||||
name: "@babel/preset-react",
|
||||
url: "https://git.io/JfeDR"
|
||||
}
|
||||
},
|
||||
logicalAssignment: {
|
||||
moduleAttributes: {
|
||||
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"
|
||||
name: "@babel/plugin-syntax-module-attributes",
|
||||
url: "https://git.io/JfK3k"
|
||||
}
|
||||
},
|
||||
numericSeparator: {
|
||||
@@ -157,6 +169,22 @@ const pluginNameMap = {
|
||||
url: "https://git.io/vb4SU"
|
||||
}
|
||||
},
|
||||
privateIn: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-private-property-in-object",
|
||||
url: "https://git.io/JfK3q"
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-proposal-private-property-in-object",
|
||||
url: "https://git.io/JfK3O"
|
||||
}
|
||||
},
|
||||
recordAndTuple: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-record-and-tuple",
|
||||
url: "https://git.io/JvKp3"
|
||||
}
|
||||
},
|
||||
throwExpressions: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-throw-expressions",
|
||||
@@ -173,8 +201,8 @@ const pluginNameMap = {
|
||||
url: "https://git.io/vb4SC"
|
||||
},
|
||||
transform: {
|
||||
name: "@babel/plugin-transform-typescript",
|
||||
url: "https://git.io/vb4Sm"
|
||||
name: "@babel/preset-typescript",
|
||||
url: "https://git.io/JfeDz"
|
||||
}
|
||||
},
|
||||
asyncGenerators: {
|
||||
@@ -187,6 +215,26 @@ const pluginNameMap = {
|
||||
url: "https://git.io/vb4yp"
|
||||
}
|
||||
},
|
||||
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"
|
||||
}
|
||||
},
|
||||
objectRestSpread: {
|
||||
syntax: {
|
||||
name: "@babel/plugin-syntax-object-rest-spread",
|
||||
@@ -208,6 +256,7 @@ const pluginNameMap = {
|
||||
}
|
||||
}
|
||||
};
|
||||
pluginNameMap.privateIn.syntax = pluginNameMap.privateIn.transform;
|
||||
|
||||
const getNameURLCombination = ({
|
||||
name,
|
||||
@@ -225,11 +274,14 @@ function generateMissingPluginMessage(missingPluginName, loc, codeFrame) {
|
||||
} = pluginInfo;
|
||||
|
||||
if (syntaxPlugin) {
|
||||
const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);
|
||||
|
||||
if (transformPlugin) {
|
||||
const transformPluginInfo = getNameURLCombination(transformPlugin);
|
||||
helpMessage += `\n\nAdd ${transformPluginInfo} to the 'plugins' section of your Babel config ` + `to enable transformation.`;
|
||||
const sectionType = transformPlugin.name.startsWith("@babel/plugin") ? "plugins" : "presets";
|
||||
helpMessage += `\n\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation.
|
||||
If you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`;
|
||||
} else {
|
||||
const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);
|
||||
helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`;
|
||||
}
|
||||
}
|
||||
33
node_modules/@babel/core/lib/tools/build-external-helpers.js
generated
vendored
33
node_modules/@babel/core/lib/tools/build-external-helpers.js
generated
vendored
@@ -45,11 +45,15 @@ function t() {
|
||||
return data;
|
||||
}
|
||||
|
||||
var _file = _interopRequireDefault(require("../transformation/file/file"));
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
const buildUmdWrapper = replacements => _template().default`
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const buildUmdWrapper = replacements => (0, _template().default)`
|
||||
(function (root, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(AMD_ARGUMENTS, factory);
|
||||
@@ -63,30 +67,30 @@ const buildUmdWrapper = replacements => _template().default`
|
||||
});
|
||||
`(replacements);
|
||||
|
||||
function buildGlobal(whitelist) {
|
||||
function buildGlobal(allowlist) {
|
||||
const namespace = t().identifier("babelHelpers");
|
||||
const body = [];
|
||||
const container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
|
||||
const tree = t().program([t().expressionStatement(t().callExpression(container, [t().conditionalExpression(t().binaryExpression("===", t().unaryExpression("typeof", t().identifier("global")), t().stringLiteral("undefined")), t().identifier("self"), t().identifier("global"))]))]);
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().assignmentExpression("=", t().memberExpression(t().identifier("global"), namespace), t().objectExpression([])))]));
|
||||
buildHelpers(body, namespace, whitelist);
|
||||
buildHelpers(body, namespace, allowlist);
|
||||
return tree;
|
||||
}
|
||||
|
||||
function buildModule(whitelist) {
|
||||
function buildModule(allowlist) {
|
||||
const body = [];
|
||||
const refs = buildHelpers(body, null, whitelist);
|
||||
const refs = buildHelpers(body, null, allowlist);
|
||||
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(name => {
|
||||
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name));
|
||||
})));
|
||||
return t().program(body, [], "module");
|
||||
}
|
||||
|
||||
function buildUmd(whitelist) {
|
||||
function buildUmd(allowlist) {
|
||||
const namespace = t().identifier("babelHelpers");
|
||||
const body = [];
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))]));
|
||||
buildHelpers(body, namespace, whitelist);
|
||||
buildHelpers(body, namespace, allowlist);
|
||||
return t().program([buildUmdWrapper({
|
||||
FACTORY_PARAMETERS: t().identifier("global"),
|
||||
BROWSER_ARGUMENTS: t().assignmentExpression("=", t().memberExpression(t().identifier("root"), namespace), t().objectExpression([])),
|
||||
@@ -97,25 +101,26 @@ function buildUmd(whitelist) {
|
||||
})]);
|
||||
}
|
||||
|
||||
function buildVar(whitelist) {
|
||||
function buildVar(allowlist) {
|
||||
const namespace = t().identifier("babelHelpers");
|
||||
const body = [];
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))]));
|
||||
const tree = t().program(body);
|
||||
buildHelpers(body, namespace, whitelist);
|
||||
buildHelpers(body, namespace, allowlist);
|
||||
body.push(t().expressionStatement(namespace));
|
||||
return tree;
|
||||
}
|
||||
|
||||
function buildHelpers(body, namespace, whitelist) {
|
||||
function buildHelpers(body, namespace, allowlist) {
|
||||
const getHelperReference = name => {
|
||||
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier(`_${name}`);
|
||||
};
|
||||
|
||||
const refs = {};
|
||||
helpers().list.forEach(function (name) {
|
||||
if (whitelist && whitelist.indexOf(name) < 0) return;
|
||||
if (allowlist && allowlist.indexOf(name) < 0) return;
|
||||
const ref = refs[name] = getHelperReference(name);
|
||||
helpers().ensure(name, _file.default);
|
||||
const {
|
||||
nodes
|
||||
} = helpers().get(name, getHelperReference, ref);
|
||||
@@ -124,7 +129,7 @@ function buildHelpers(body, namespace, whitelist) {
|
||||
return refs;
|
||||
}
|
||||
|
||||
function _default(whitelist, outputType = "global") {
|
||||
function _default(allowlist, outputType = "global") {
|
||||
let tree;
|
||||
const build = {
|
||||
global: buildGlobal,
|
||||
@@ -134,7 +139,7 @@ function _default(whitelist, outputType = "global") {
|
||||
}[outputType];
|
||||
|
||||
if (build) {
|
||||
tree = build(whitelist);
|
||||
tree = build(allowlist);
|
||||
} else {
|
||||
throw new Error(`Unsupported output type ${outputType}`);
|
||||
}
|
||||
|
||||
58
node_modules/@babel/core/lib/transform-ast.js
generated
vendored
58
node_modules/@babel/core/lib/transform-ast.js
generated
vendored
@@ -3,9 +3,17 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transformFromAstSync = transformFromAstSync;
|
||||
exports.transformFromAstAsync = transformFromAstAsync;
|
||||
exports.transformFromAst = void 0;
|
||||
exports.transformFromAstAsync = exports.transformFromAstSync = exports.transformFromAst = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
@@ -13,42 +21,28 @@ var _transformation = require("./transformation");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const transformFromAstRunner = (0, _gensync().default)(function* (ast, code, opts) {
|
||||
const config = yield* (0, _config.default)(opts);
|
||||
if (config === null) return null;
|
||||
if (!ast) throw new Error("No AST given");
|
||||
return yield* (0, _transformation.run)(config, code, ast);
|
||||
});
|
||||
|
||||
const transformFromAst = function transformFromAst(ast, code, opts, callback) {
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
if (callback === undefined) return transformFromAstSync(ast, code, opts);
|
||||
const cb = callback;
|
||||
process.nextTick(() => {
|
||||
let cfg;
|
||||
if (callback === undefined) {
|
||||
return transformFromAstRunner.sync(ast, code, opts);
|
||||
}
|
||||
|
||||
try {
|
||||
cfg = (0, _config.default)(opts);
|
||||
if (cfg === null) return cb(null, null);
|
||||
} catch (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
if (!ast) return cb(new Error("No AST given"));
|
||||
(0, _transformation.runAsync)(cfg, code, ast, cb);
|
||||
});
|
||||
transformFromAstRunner.errback(ast, code, opts, callback);
|
||||
};
|
||||
|
||||
exports.transformFromAst = transformFromAst;
|
||||
|
||||
function transformFromAstSync(ast, code, opts) {
|
||||
const config = (0, _config.default)(opts);
|
||||
if (config === null) return null;
|
||||
if (!ast) throw new Error("No AST given");
|
||||
return (0, _transformation.runSync)(config, code, ast);
|
||||
}
|
||||
|
||||
function transformFromAstAsync(ast, code, opts) {
|
||||
return new Promise((res, rej) => {
|
||||
transformFromAst(ast, code, opts, (err, result) => {
|
||||
if (err == null) res(result);else rej(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
const transformFromAstSync = transformFromAstRunner.sync;
|
||||
exports.transformFromAstSync = transformFromAstSync;
|
||||
const transformFromAstAsync = transformFromAstRunner.async;
|
||||
exports.transformFromAstAsync = transformFromAstAsync;
|
||||
92
node_modules/@babel/core/lib/transform-file.js
generated
vendored
92
node_modules/@babel/core/lib/transform-file.js
generated
vendored
@@ -3,14 +3,12 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transformFileSync = transformFileSync;
|
||||
exports.transformFileAsync = transformFileAsync;
|
||||
exports.transformFile = void 0;
|
||||
exports.transformFileAsync = exports.transformFileSync = exports.transformFile = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_fs = function () {
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -21,71 +19,27 @@ var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _transformation = require("./transformation");
|
||||
|
||||
var fs = _interopRequireWildcard(require("./gensync-utils/fs"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
({});
|
||||
|
||||
const transformFile = function transformFile(filename, opts, callback) {
|
||||
let options;
|
||||
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
if (opts == null) {
|
||||
options = {
|
||||
filename
|
||||
};
|
||||
} else if (opts && typeof opts === "object") {
|
||||
options = Object.assign({}, opts, {
|
||||
filename
|
||||
});
|
||||
}
|
||||
|
||||
process.nextTick(() => {
|
||||
let cfg;
|
||||
|
||||
try {
|
||||
cfg = (0, _config.default)(options);
|
||||
if (cfg === null) return callback(null, null);
|
||||
} catch (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
const config = cfg;
|
||||
|
||||
_fs().default.readFile(filename, "utf8", function (err, code) {
|
||||
if (err) return callback(err, null);
|
||||
(0, _transformation.runAsync)(config, code, null, callback);
|
||||
});
|
||||
const transformFileRunner = (0, _gensync().default)(function* (filename, opts) {
|
||||
const options = Object.assign({}, opts, {
|
||||
filename
|
||||
});
|
||||
};
|
||||
|
||||
exports.transformFile = transformFile;
|
||||
|
||||
function transformFileSync(filename, opts) {
|
||||
let options;
|
||||
|
||||
if (opts == null) {
|
||||
options = {
|
||||
filename
|
||||
};
|
||||
} else if (opts && typeof opts === "object") {
|
||||
options = Object.assign({}, opts, {
|
||||
filename
|
||||
});
|
||||
}
|
||||
|
||||
const config = (0, _config.default)(options);
|
||||
const config = yield* (0, _config.default)(options);
|
||||
if (config === null) return null;
|
||||
return (0, _transformation.runSync)(config, _fs().default.readFileSync(filename, "utf8"));
|
||||
}
|
||||
|
||||
function transformFileAsync(filename, opts) {
|
||||
return new Promise((res, rej) => {
|
||||
transformFile(filename, opts, (err, result) => {
|
||||
if (err == null) res(result);else rej(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
const code = yield* fs.readFile(filename, "utf8");
|
||||
return yield* (0, _transformation.run)(config, code);
|
||||
});
|
||||
const transformFile = transformFileRunner.errback;
|
||||
exports.transformFile = transformFile;
|
||||
const transformFileSync = transformFileRunner.sync;
|
||||
exports.transformFileSync = transformFileSync;
|
||||
const transformFileAsync = transformFileRunner.async;
|
||||
exports.transformFileAsync = transformFileAsync;
|
||||
54
node_modules/@babel/core/lib/transform.js
generated
vendored
54
node_modules/@babel/core/lib/transform.js
generated
vendored
@@ -3,9 +3,17 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transformSync = transformSync;
|
||||
exports.transformAsync = transformAsync;
|
||||
exports.transform = void 0;
|
||||
exports.transformAsync = exports.transformSync = exports.transform = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
@@ -13,40 +21,24 @@ var _transformation = require("./transformation");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const transformRunner = (0, _gensync().default)(function* transform(code, opts) {
|
||||
const config = yield* (0, _config.default)(opts);
|
||||
if (config === null) return null;
|
||||
return yield* (0, _transformation.run)(config, code);
|
||||
});
|
||||
|
||||
const transform = function transform(code, opts, callback) {
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
if (callback === undefined) return transformSync(code, opts);
|
||||
const cb = callback;
|
||||
process.nextTick(() => {
|
||||
let cfg;
|
||||
|
||||
try {
|
||||
cfg = (0, _config.default)(opts);
|
||||
if (cfg === null) return cb(null, null);
|
||||
} catch (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
(0, _transformation.runAsync)(cfg, code, null, cb);
|
||||
});
|
||||
if (callback === undefined) return transformRunner.sync(code, opts);
|
||||
transformRunner.errback(code, opts, callback);
|
||||
};
|
||||
|
||||
exports.transform = transform;
|
||||
|
||||
function transformSync(code, opts) {
|
||||
const config = (0, _config.default)(opts);
|
||||
if (config === null) return null;
|
||||
return (0, _transformation.runSync)(config, code);
|
||||
}
|
||||
|
||||
function transformAsync(code, opts) {
|
||||
return new Promise((res, rej) => {
|
||||
transform(code, opts, (err, result) => {
|
||||
if (err == null) res(result);else rej(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
const transformSync = transformRunner.sync;
|
||||
exports.transformSync = transformSync;
|
||||
const transformAsync = transformRunner.async;
|
||||
exports.transformAsync = transformAsync;
|
||||
7
node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
generated
vendored
7
node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
generated
vendored
@@ -23,11 +23,12 @@ let LOADED_PLUGIN;
|
||||
|
||||
function loadBlockHoistPlugin() {
|
||||
if (!LOADED_PLUGIN) {
|
||||
const config = (0, _config.default)({
|
||||
const config = _config.default.sync({
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
plugins: [blockHoistPlugin]
|
||||
});
|
||||
|
||||
LOADED_PLUGIN = config ? config.passes[0][0] : undefined;
|
||||
if (!LOADED_PLUGIN) throw new Error("Assertion failure");
|
||||
}
|
||||
@@ -47,7 +48,7 @@ const blockHoistPlugin = {
|
||||
for (let i = 0; i < node.body.length; i++) {
|
||||
const bodyNode = node.body[i];
|
||||
|
||||
if (bodyNode && bodyNode._blockHoist != null) {
|
||||
if ((bodyNode == null ? void 0 : bodyNode._blockHoist) != null) {
|
||||
hasChange = true;
|
||||
break;
|
||||
}
|
||||
@@ -55,7 +56,7 @@ const blockHoistPlugin = {
|
||||
|
||||
if (!hasChange) return;
|
||||
node.body = (0, _sortBy().default)(node.body, function (bodyNode) {
|
||||
let priority = bodyNode && bodyNode._blockHoist;
|
||||
let priority = bodyNode == null ? void 0 : bodyNode._blockHoist;
|
||||
if (priority == null) priority = 1;
|
||||
if (priority === true) priority = 2;
|
||||
return -1 * priority;
|
||||
|
||||
54
node_modules/@babel/core/lib/transformation/file/file.js
generated
vendored
54
node_modules/@babel/core/lib/transformation/file/file.js
generated
vendored
@@ -45,6 +45,16 @@ function t() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _helperModuleTransforms() {
|
||||
const data = require("@babel/helper-module-transforms");
|
||||
|
||||
_helperModuleTransforms = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _semver() {
|
||||
const data = _interopRequireDefault(require("semver"));
|
||||
|
||||
@@ -57,7 +67,9 @@ function _semver() {
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const errorVisitor = {
|
||||
enter(path, state) {
|
||||
@@ -137,36 +149,7 @@ class File {
|
||||
}
|
||||
|
||||
getModuleName() {
|
||||
const {
|
||||
filename,
|
||||
filenameRelative = filename,
|
||||
moduleId,
|
||||
moduleIds = !!moduleId,
|
||||
getModuleId,
|
||||
sourceRoot: sourceRootTmp,
|
||||
moduleRoot = sourceRootTmp,
|
||||
sourceRoot = moduleRoot
|
||||
} = this.opts;
|
||||
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;
|
||||
}
|
||||
return (0, _helperModuleTransforms().getModuleName)(this.opts, this.opts);
|
||||
}
|
||||
|
||||
addImport() {
|
||||
@@ -198,7 +181,7 @@ class File {
|
||||
if (res) return res;
|
||||
}
|
||||
|
||||
helpers().ensure(name);
|
||||
helpers().ensure(name, File);
|
||||
const uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
|
||||
const dependencies = {};
|
||||
|
||||
@@ -232,7 +215,6 @@ class File {
|
||||
|
||||
buildCodeFrameError(node, msg, Error = SyntaxError) {
|
||||
let loc = node && (node.loc || node._loc);
|
||||
msg = `${this.opts.filename}: ${msg}`;
|
||||
|
||||
if (!loc && node) {
|
||||
const state = {
|
||||
@@ -253,7 +235,11 @@ class File {
|
||||
start: {
|
||||
line: loc.start.line,
|
||||
column: loc.start.column + 1
|
||||
}
|
||||
},
|
||||
end: loc.end && loc.start.line === loc.end.line ? {
|
||||
line: loc.end.line,
|
||||
column: loc.end.column + 1
|
||||
} : undefined
|
||||
}, {
|
||||
highlightCode
|
||||
});
|
||||
|
||||
2
node_modules/@babel/core/lib/transformation/file/generate.js
generated
vendored
2
node_modules/@babel/core/lib/transformation/file/generate.js
generated
vendored
@@ -59,7 +59,7 @@ function generateCode(pluginPasses, file) {
|
||||
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.`);
|
||||
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.`);
|
||||
}
|
||||
} else {
|
||||
throw new Error("More than one plugin attempted to override codegen.");
|
||||
|
||||
36
node_modules/@babel/core/lib/transformation/file/merge-map.js
generated
vendored
36
node_modules/@babel/core/lib/transformation/file/merge-map.js
generated
vendored
@@ -22,11 +22,9 @@ function mergeSourceMap(inputMap, map) {
|
||||
const output = buildMappingData(map);
|
||||
const mergedGenerator = new (_sourceMap().default.SourceMapGenerator)();
|
||||
|
||||
for (const _ref of input.sources) {
|
||||
const {
|
||||
source
|
||||
} = _ref;
|
||||
|
||||
for (const {
|
||||
source
|
||||
} of input.sources) {
|
||||
if (typeof source.content === "string") {
|
||||
mergedGenerator.setSourceContent(source.path, source.content);
|
||||
}
|
||||
@@ -95,11 +93,9 @@ function makeMappingKey(item) {
|
||||
function eachOverlappingGeneratedOutputRange(outputFile, inputGeneratedRange, callback) {
|
||||
const overlappingOriginal = filterApplicableOriginalRanges(outputFile, inputGeneratedRange);
|
||||
|
||||
for (const _ref2 of overlappingOriginal) {
|
||||
const {
|
||||
generated
|
||||
} = _ref2;
|
||||
|
||||
for (const {
|
||||
generated
|
||||
} of overlappingOriginal) {
|
||||
for (const item of generated) {
|
||||
callback(item);
|
||||
}
|
||||
@@ -125,18 +121,14 @@ function filterApplicableOriginalRanges({
|
||||
}
|
||||
|
||||
function eachInputGeneratedRange(map, callback) {
|
||||
for (const _ref3 of map.sources) {
|
||||
const {
|
||||
source,
|
||||
mappings
|
||||
} = _ref3;
|
||||
|
||||
for (const _ref4 of mappings) {
|
||||
const {
|
||||
original,
|
||||
generated
|
||||
} = _ref4;
|
||||
|
||||
for (const {
|
||||
source,
|
||||
mappings
|
||||
} of map.sources) {
|
||||
for (const {
|
||||
original,
|
||||
generated
|
||||
} of mappings) {
|
||||
for (const item of generated) {
|
||||
callback(item, original, source);
|
||||
}
|
||||
|
||||
56
node_modules/@babel/core/lib/transformation/index.js
generated
vendored
56
node_modules/@babel/core/lib/transformation/index.js
generated
vendored
@@ -3,8 +3,7 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.runAsync = runAsync;
|
||||
exports.runSync = runSync;
|
||||
exports.run = run;
|
||||
|
||||
function _traverse() {
|
||||
const data = _interopRequireDefault(require("@babel/traverse"));
|
||||
@@ -28,26 +27,45 @@ var _generate = _interopRequireDefault(require("./file/generate"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function runAsync(config, code, ast, callback) {
|
||||
let result;
|
||||
function* run(config, code, ast) {
|
||||
const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
|
||||
const opts = file.opts;
|
||||
|
||||
try {
|
||||
result = runSync(config, code, ast);
|
||||
} catch (err) {
|
||||
return callback(err);
|
||||
yield* transformFile(file, config.passes);
|
||||
} catch (e) {
|
||||
var _opts$filename;
|
||||
|
||||
e.message = `${(_opts$filename = opts.filename) != null ? _opts$filename : "unknown"}: ${e.message}`;
|
||||
|
||||
if (!e.code) {
|
||||
e.code = "BABEL_TRANSFORM_ERROR";
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
return callback(null, result);
|
||||
}
|
||||
let outputCode, outputMap;
|
||||
|
||||
try {
|
||||
if (opts.code !== false) {
|
||||
({
|
||||
outputCode,
|
||||
outputMap
|
||||
} = (0, _generate.default)(config.passes, file));
|
||||
}
|
||||
} catch (e) {
|
||||
var _opts$filename2;
|
||||
|
||||
e.message = `${(_opts$filename2 = opts.filename) != null ? _opts$filename2 : "unknown"}: ${e.message}`;
|
||||
|
||||
if (!e.code) {
|
||||
e.code = "BABEL_GENERATE_ERROR";
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
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 {
|
||||
outputCode,
|
||||
outputMap
|
||||
} = opts.code !== false ? (0, _generate.default)(config.passes, file) : {};
|
||||
return {
|
||||
metadata: file.metadata,
|
||||
options: opts,
|
||||
@@ -58,7 +76,7 @@ function runSync(config, code, ast) {
|
||||
};
|
||||
}
|
||||
|
||||
function transformFile(file, pluginPasses) {
|
||||
function* transformFile(file, pluginPasses) {
|
||||
for (const pluginPairs of pluginPasses) {
|
||||
const passPairs = [];
|
||||
const passes = [];
|
||||
@@ -76,6 +94,7 @@ function transformFile(file, pluginPasses) {
|
||||
|
||||
if (fn) {
|
||||
const result = fn.call(pass, file);
|
||||
yield* [];
|
||||
|
||||
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.`);
|
||||
@@ -92,6 +111,7 @@ function transformFile(file, pluginPasses) {
|
||||
|
||||
if (fn) {
|
||||
const result = fn.call(pass, file);
|
||||
yield* [];
|
||||
|
||||
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.`);
|
||||
|
||||
212
node_modules/@babel/core/lib/transformation/normalize-file.js
generated
vendored
212
node_modules/@babel/core/lib/transformation/normalize-file.js
generated
vendored
@@ -5,6 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = normalizeFile;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
@@ -55,76 +65,21 @@ function _convertSourceMap() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _parser() {
|
||||
const data = require("@babel/parser");
|
||||
|
||||
_parser = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _codeFrame() {
|
||||
const data = require("@babel/code-frame");
|
||||
|
||||
_codeFrame = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _file = _interopRequireDefault(require("./file/file"));
|
||||
|
||||
var _missingPluginHelper = _interopRequireDefault(require("./util/missing-plugin-helper"));
|
||||
var _parser = _interopRequireDefault(require("../parser"));
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const debug = (0, _debug().default)("babel:transform:file");
|
||||
const LARGE_INPUT_SOURCEMAP_THRESHOLD = 1000000;
|
||||
|
||||
function normalizeFile(pluginPasses, options, code, ast) {
|
||||
function* normalizeFile(pluginPasses, options, code, ast) {
|
||||
code = `${code || ""}`;
|
||||
let inputMap = null;
|
||||
|
||||
if (options.inputSourceMap !== false) {
|
||||
if (typeof options.inputSourceMap === "object") {
|
||||
inputMap = _convertSourceMap().default.fromObject(options.inputSourceMap);
|
||||
}
|
||||
|
||||
if (!inputMap) {
|
||||
try {
|
||||
inputMap = _convertSourceMap().default.fromSource(code);
|
||||
|
||||
if (inputMap) {
|
||||
code = _convertSourceMap().default.removeComments(code);
|
||||
}
|
||||
} catch (err) {
|
||||
debug("discarding unknown inline input sourcemap", err);
|
||||
code = _convertSourceMap().default.removeComments(code);
|
||||
}
|
||||
}
|
||||
|
||||
if (!inputMap) {
|
||||
if (typeof options.filename === "string") {
|
||||
try {
|
||||
inputMap = _convertSourceMap().default.fromMapFileSource(code, _path().default.dirname(options.filename));
|
||||
|
||||
if (inputMap) {
|
||||
code = _convertSourceMap().default.removeMapFileComments(code);
|
||||
}
|
||||
} catch (err) {
|
||||
debug("discarding unknown file input sourcemap", err);
|
||||
code = _convertSourceMap().default.removeMapFileComments(code);
|
||||
}
|
||||
} else {
|
||||
debug("discarding un-loadable file input sourcemap");
|
||||
code = _convertSourceMap().default.removeMapFileComments(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ast) {
|
||||
if (ast.type === "Program") {
|
||||
@@ -133,9 +88,57 @@ function normalizeFile(pluginPasses, options, code, ast) {
|
||||
throw new Error("AST root must be a Program or File node");
|
||||
}
|
||||
|
||||
ast = (0, _cloneDeep().default)(ast);
|
||||
const {
|
||||
cloneInputAst
|
||||
} = options;
|
||||
|
||||
if (cloneInputAst) {
|
||||
ast = (0, _cloneDeep().default)(ast);
|
||||
}
|
||||
} else {
|
||||
ast = parser(pluginPasses, options, code);
|
||||
ast = yield* (0, _parser.default)(pluginPasses, options, code);
|
||||
}
|
||||
|
||||
let inputMap = null;
|
||||
|
||||
if (options.inputSourceMap !== false) {
|
||||
if (typeof options.inputSourceMap === "object") {
|
||||
inputMap = _convertSourceMap().default.fromObject(options.inputSourceMap);
|
||||
}
|
||||
|
||||
if (!inputMap) {
|
||||
const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);
|
||||
|
||||
if (lastComment) {
|
||||
try {
|
||||
inputMap = _convertSourceMap().default.fromComment(lastComment);
|
||||
} catch (err) {
|
||||
debug("discarding unknown inline input sourcemap", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!inputMap) {
|
||||
const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);
|
||||
|
||||
if (typeof options.filename === "string" && lastComment) {
|
||||
try {
|
||||
const match = EXTERNAL_SOURCEMAP_REGEX.exec(lastComment);
|
||||
|
||||
const inputMapContent = _fs().default.readFileSync(_path().default.resolve(_path().default.dirname(options.filename), match[1]));
|
||||
|
||||
if (inputMapContent.length > LARGE_INPUT_SOURCEMAP_THRESHOLD) {
|
||||
debug("skip merging input map > 1 MB");
|
||||
} else {
|
||||
inputMap = _convertSourceMap().default.fromJSON(inputMapContent);
|
||||
}
|
||||
} catch (err) {
|
||||
debug("discarding unknown file input sourcemap", err);
|
||||
}
|
||||
} else if (lastComment) {
|
||||
debug("discarding un-loadable file input sourcemap");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new _file.default(options, {
|
||||
@@ -145,67 +148,32 @@ function normalizeFile(pluginPasses, options, code, ast) {
|
||||
});
|
||||
}
|
||||
|
||||
function parser(pluginPasses, {
|
||||
parserOpts,
|
||||
highlightCode = true,
|
||||
filename = "unknown"
|
||||
}, code) {
|
||||
try {
|
||||
const results = [];
|
||||
const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/;
|
||||
const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/;
|
||||
|
||||
for (const plugins of pluginPasses) {
|
||||
for (const plugin of plugins) {
|
||||
const {
|
||||
parserOverride
|
||||
} = plugin;
|
||||
|
||||
if (parserOverride) {
|
||||
const ast = parserOverride(code, parserOpts, _parser().parse);
|
||||
if (ast !== undefined) results.push(ast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (results.length === 0) {
|
||||
return (0, _parser().parse)(code, 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.`);
|
||||
function extractCommentsFromList(regex, comments, lastComment) {
|
||||
if (comments) {
|
||||
comments = comments.filter(({
|
||||
value
|
||||
}) => {
|
||||
if (regex.test(value)) {
|
||||
lastComment = value;
|
||||
return false;
|
||||
}
|
||||
|
||||
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,
|
||||
missingPlugin
|
||||
} = err;
|
||||
|
||||
if (loc) {
|
||||
const codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
|
||||
start: {
|
||||
line: loc.line,
|
||||
column: loc.column + 1
|
||||
}
|
||||
}, {
|
||||
highlightCode
|
||||
});
|
||||
|
||||
if (missingPlugin) {
|
||||
err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
|
||||
} else {
|
||||
err.message = `${filename}: ${err.message}\n\n` + codeFrame;
|
||||
}
|
||||
|
||||
err.code = "BABEL_PARSE_ERROR";
|
||||
}
|
||||
|
||||
throw err;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
return [comments, lastComment];
|
||||
}
|
||||
|
||||
function extractComments(regex, ast) {
|
||||
let lastComment = null;
|
||||
t().traverseFast(ast, node => {
|
||||
[node.leadingComments, lastComment] = extractCommentsFromList(regex, node.leadingComments, lastComment);
|
||||
[node.innerComments, lastComment] = extractCommentsFromList(regex, node.innerComments, lastComment);
|
||||
[node.trailingComments, lastComment] = extractCommentsFromList(regex, node.trailingComments, lastComment);
|
||||
});
|
||||
return lastComment;
|
||||
}
|
||||
24
node_modules/@babel/core/node_modules/debug/package.json
generated
vendored
24
node_modules/@babel/core/node_modules/debug/package.json
generated
vendored
@@ -1,33 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"debug@4.1.1",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "debug@4.1.1",
|
||||
"_from": "debug@^4.1.0",
|
||||
"_id": "debug@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"_location": "/@babel/core/debug",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "debug@4.1.1",
|
||||
"raw": "debug@^4.1.0",
|
||||
"name": "debug",
|
||||
"escapedName": "debug",
|
||||
"rawSpec": "4.1.1",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.1.1"
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"_spec": "4.1.1",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_shasum": "3b72260255109c6b589cee050f1d516139664791",
|
||||
"_spec": "debug@^4.1.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/core",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
@@ -36,6 +30,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
@@ -50,6 +45,7 @@
|
||||
"dependencies": {
|
||||
"ms": "^2.1.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
|
||||
24
node_modules/@babel/core/node_modules/ms/package.json
generated
vendored
24
node_modules/@babel/core/node_modules/ms/package.json
generated
vendored
@@ -1,36 +1,32 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"ms@2.1.2",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "ms@2.1.2",
|
||||
"_from": "ms@^2.1.1",
|
||||
"_id": "ms@2.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"_location": "/@babel/core/ms",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ms@2.1.2",
|
||||
"raw": "ms@^2.1.1",
|
||||
"name": "ms",
|
||||
"escapedName": "ms",
|
||||
"rawSpec": "2.1.2",
|
||||
"rawSpec": "^2.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.1.2"
|
||||
"fetchSpec": "^2.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core/debug"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"_spec": "2.1.2",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_shasum": "d09d1f357b443f493382a8eb3ccd183872ae6009",
|
||||
"_spec": "ms@^2.1.1",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/core/node_modules/debug",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zeit/ms/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tiny millisecond conversion utility",
|
||||
"devDependencies": {
|
||||
"eslint": "4.12.1",
|
||||
|
||||
23
node_modules/@babel/core/node_modules/semver/README.md
generated
vendored
23
node_modules/@babel/core/node_modules/semver/README.md
generated
vendored
@@ -398,14 +398,15 @@ range, use the `satisfies(version, range)` function.
|
||||
|
||||
* `coerce(version)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver
|
||||
string to semver. It looks for the first digit in a string, and
|
||||
consumes all remaining characters which satisfy at least a partial semver
|
||||
(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters).
|
||||
Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).
|
||||
All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`).
|
||||
Only text which lacks digits will fail coercion (`version one` is not valid).
|
||||
The maximum length for any semver component considered for coercion is 16 characters;
|
||||
longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`).
|
||||
The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;
|
||||
higher value components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string, and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
32
node_modules/@babel/core/node_modules/semver/package.json
generated
vendored
32
node_modules/@babel/core/node_modules/semver/package.json
generated
vendored
@@ -1,39 +1,35 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"semver@5.7.0",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "semver@5.7.0",
|
||||
"_id": "semver@5.7.0",
|
||||
"_from": "semver@^5.4.1",
|
||||
"_id": "semver@5.7.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
|
||||
"_integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"_location": "/@babel/core/semver",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "semver@5.7.0",
|
||||
"raw": "semver@^5.4.1",
|
||||
"name": "semver",
|
||||
"escapedName": "semver",
|
||||
"rawSpec": "5.7.0",
|
||||
"rawSpec": "^5.4.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5.7.0"
|
||||
"fetchSpec": "^5.4.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
|
||||
"_spec": "5.7.0",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"_shasum": "a954f931aeba508d307bbf069eff0c01c96116f7",
|
||||
"_spec": "semver@^5.4.1",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/core",
|
||||
"bin": {
|
||||
"semver": "./bin/semver"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/npm/node-semver/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"devDependencies": {
|
||||
"tap": "^13.0.0-rc.18"
|
||||
@@ -60,5 +56,5 @@
|
||||
"tap": {
|
||||
"check-coverage": true
|
||||
},
|
||||
"version": "5.7.0"
|
||||
"version": "5.7.1"
|
||||
}
|
||||
|
||||
24
node_modules/@babel/core/node_modules/source-map/package.json
generated
vendored
24
node_modules/@babel/core/node_modules/source-map/package.json
generated
vendored
@@ -1,33 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"source-map@0.5.7",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "source-map@0.5.7",
|
||||
"_from": "source-map@^0.5.0",
|
||||
"_id": "source-map@0.5.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
|
||||
"_location": "/@babel/core/source-map",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "source-map@0.5.7",
|
||||
"raw": "source-map@^0.5.0",
|
||||
"name": "source-map",
|
||||
"escapedName": "source-map",
|
||||
"rawSpec": "0.5.7",
|
||||
"rawSpec": "^0.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.5.7"
|
||||
"fetchSpec": "^0.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
"_spec": "0.5.7",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_shasum": "8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc",
|
||||
"_spec": "source-map@^0.5.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/core",
|
||||
"author": {
|
||||
"name": "Nick Fitzgerald",
|
||||
"email": "nfitzgerald@mozilla.com"
|
||||
@@ -35,6 +29,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/source-map/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tobias Koppers",
|
||||
@@ -181,6 +176,7 @@
|
||||
"email": "nicolas.lalevee@hibnet.org"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Generates and consumes source maps",
|
||||
"devDependencies": {
|
||||
"doctoc": "^0.15.0",
|
||||
|
||||
73
node_modules/@babel/core/package.json
generated
vendored
73
node_modules/@babel/core/package.json
generated
vendored
@@ -1,68 +1,74 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/core@7.5.5",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/core@7.5.5",
|
||||
"_id": "@babel/core@7.5.5",
|
||||
"_from": "@babel/core@^7.1.0",
|
||||
"_id": "@babel/core@7.11.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg==",
|
||||
"_integrity": "sha512-Wpcv03AGnmkgm6uS6k8iwhIwTrcP0m17TL1n1sy7qD0qelDu4XNeW0dN0mHfa+Gei211yDaLoEe/VlbXQzM4Bg==",
|
||||
"_location": "/@babel/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/core@7.5.5",
|
||||
"raw": "@babel/core@^7.1.0",
|
||||
"name": "@babel/core",
|
||||
"escapedName": "@babel%2fcore",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.5.5",
|
||||
"rawSpec": "^7.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.5.5"
|
||||
"fetchSpec": "^7.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@jest/transform",
|
||||
"/jest-config"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.5.tgz",
|
||||
"_spec": "7.5.5",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/core/-/core-7.11.6.tgz",
|
||||
"_shasum": "3a9455dc7387ff1bac45770650bc13ba04a15651",
|
||||
"_spec": "@babel/core@^7.1.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@jest/transform",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/config/files/index.js": "./lib/config/files/index-browser.js",
|
||||
"./lib/transform-file.js": "./lib/transform-file-browser.js"
|
||||
"./lib/transform-file.js": "./lib/transform-file-browser.js",
|
||||
"./src/config/files/index.js": "./src/config/files/index-browser.js",
|
||||
"./src/transform-file.js": "./src/transform-file-browser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/generator": "^7.5.5",
|
||||
"@babel/helpers": "^7.5.5",
|
||||
"@babel/parser": "^7.5.5",
|
||||
"@babel/template": "^7.4.4",
|
||||
"@babel/traverse": "^7.5.5",
|
||||
"@babel/types": "^7.5.5",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"@babel/code-frame": "^7.10.4",
|
||||
"@babel/generator": "^7.11.6",
|
||||
"@babel/helper-module-transforms": "^7.11.0",
|
||||
"@babel/helpers": "^7.10.4",
|
||||
"@babel/parser": "^7.11.5",
|
||||
"@babel/template": "^7.10.4",
|
||||
"@babel/traverse": "^7.11.5",
|
||||
"@babel/types": "^7.11.5",
|
||||
"convert-source-map": "^1.7.0",
|
||||
"debug": "^4.1.0",
|
||||
"json5": "^2.1.0",
|
||||
"lodash": "^4.17.13",
|
||||
"gensync": "^1.0.0-beta.1",
|
||||
"json5": "^2.1.2",
|
||||
"lodash": "^4.17.19",
|
||||
"resolve": "^1.3.2",
|
||||
"semver": "^5.4.1",
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Babel compiler core.",
|
||||
"devDependencies": {
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.5.5",
|
||||
"@babel/register": "^7.5.5"
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.11.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/babel"
|
||||
},
|
||||
"gitHead": "e51139d7fd850e7f5b8cd6aafb17cc88b7010218",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"keywords": [
|
||||
"6to5",
|
||||
@@ -87,7 +93,8 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-core"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-core"
|
||||
},
|
||||
"version": "7.5.5"
|
||||
"version": "7.11.6"
|
||||
}
|
||||
|
||||
25
node_modules/@babel/generator/lib/buffer.js
generated
vendored
25
node_modules/@babel/generator/lib/buffer.js
generated
vendored
@@ -4,19 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _trimRight() {
|
||||
const data = _interopRequireDefault(require("trim-right"));
|
||||
|
||||
_trimRight = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const SPACES_RE = /^[ \t]+$/;
|
||||
|
||||
class Buffer {
|
||||
@@ -44,9 +31,9 @@ class Buffer {
|
||||
|
||||
const map = this._map;
|
||||
const result = {
|
||||
code: (0, _trimRight().default)(this._buf.join("")),
|
||||
code: this._buf.join("").trimRight(),
|
||||
map: null,
|
||||
rawMappings: map && map.getRawMappings()
|
||||
rawMappings: map == null ? void 0 : map.getRawMappings()
|
||||
};
|
||||
|
||||
if (map) {
|
||||
@@ -221,10 +208,10 @@ class Buffer {
|
||||
const origLine = targetObj.line;
|
||||
const origColumn = targetObj.column;
|
||||
const origFilename = targetObj.filename;
|
||||
targetObj.identifierName = prop === "start" && loc && loc.identifierName || null;
|
||||
targetObj.line = pos ? pos.line : null;
|
||||
targetObj.column = pos ? pos.column : null;
|
||||
targetObj.filename = loc && loc.filename || null;
|
||||
targetObj.identifierName = prop === "start" && (loc == null ? void 0 : loc.identifierName) || null;
|
||||
targetObj.line = pos == null ? void 0 : pos.line;
|
||||
targetObj.column = pos == null ? void 0 : pos.column;
|
||||
targetObj.filename = loc == null ? void 0 : loc.filename;
|
||||
|
||||
if (force || targetObj.line !== origLine || targetObj.column !== origColumn || targetObj.filename !== origFilename) {
|
||||
targetObj.force = force;
|
||||
|
||||
4
node_modules/@babel/generator/lib/generators/base.js
generated
vendored
4
node_modules/@babel/generator/lib/generators/base.js
generated
vendored
@@ -28,9 +28,11 @@ function Program(node) {
|
||||
}
|
||||
|
||||
function BlockStatement(node) {
|
||||
var _node$directives;
|
||||
|
||||
this.token("{");
|
||||
this.printInnerComments(node);
|
||||
const hasDirectives = node.directives && node.directives.length;
|
||||
const hasDirectives = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
|
||||
|
||||
if (node.body.length || hasDirectives) {
|
||||
this.newline();
|
||||
|
||||
51
node_modules/@babel/generator/lib/generators/classes.js
generated
vendored
51
node_modules/@babel/generator/lib/generators/classes.js
generated
vendored
@@ -11,20 +11,14 @@ exports.ClassMethod = ClassMethod;
|
||||
exports.ClassPrivateMethod = ClassPrivateMethod;
|
||||
exports._classMethodHead = _classMethodHead;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function ClassDeclaration(node, parent) {
|
||||
if (!this.format.decoratorsBeforeExport || !t().isExportDefaultDeclaration(parent) && !t().isExportNamedDeclaration(parent)) {
|
||||
if (!this.format.decoratorsBeforeExport || !t.isExportDefaultDeclaration(parent) && !t.isExportNamedDeclaration(parent)) {
|
||||
this.printJoin(node.decorators, node);
|
||||
}
|
||||
|
||||
@@ -84,26 +78,7 @@ function ClassBody(node) {
|
||||
|
||||
function ClassProperty(node) {
|
||||
this.printJoin(node.decorators, node);
|
||||
|
||||
if (node.accessibility) {
|
||||
this.word(node.accessibility);
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.static) {
|
||||
this.word("static");
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.abstract) {
|
||||
this.word("abstract");
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.readonly) {
|
||||
this.word("readonly");
|
||||
this.space();
|
||||
}
|
||||
this.tsPrintClassMemberModifiers(node, true);
|
||||
|
||||
if (node.computed) {
|
||||
this.token("[");
|
||||
@@ -170,21 +145,7 @@ function ClassPrivateMethod(node) {
|
||||
|
||||
function _classMethodHead(node) {
|
||||
this.printJoin(node.decorators, node);
|
||||
|
||||
if (node.accessibility) {
|
||||
this.word(node.accessibility);
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.abstract) {
|
||||
this.word("abstract");
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.static) {
|
||||
this.word("static");
|
||||
this.space();
|
||||
}
|
||||
this.tsPrintClassMemberModifiers(node, false);
|
||||
|
||||
this._methodHead(node);
|
||||
}
|
||||
32
node_modules/@babel/generator/lib/generators/expressions.js
generated
vendored
32
node_modules/@babel/generator/lib/generators/expressions.js
generated
vendored
@@ -25,21 +25,16 @@ exports.BindExpression = BindExpression;
|
||||
exports.MemberExpression = MemberExpression;
|
||||
exports.MetaProperty = MetaProperty;
|
||||
exports.PrivateName = PrivateName;
|
||||
exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier;
|
||||
exports.AwaitExpression = exports.YieldExpression = void 0;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var n = _interopRequireWildcard(require("../node"));
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function UnaryExpression(node) {
|
||||
if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || node.operator === "throw") {
|
||||
@@ -93,9 +88,9 @@ function NewExpression(node, parent) {
|
||||
this.space();
|
||||
this.print(node.callee, node);
|
||||
|
||||
if (this.format.minified && node.arguments.length === 0 && !node.optional && !t().isCallExpression(parent, {
|
||||
if (this.format.minified && node.arguments.length === 0 && !node.optional && !t.isCallExpression(parent, {
|
||||
callee: node
|
||||
}) && !t().isMemberExpression(parent) && !t().isNewExpression(parent)) {
|
||||
}) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,13 +127,13 @@ function Decorator(node) {
|
||||
function OptionalMemberExpression(node) {
|
||||
this.print(node.object, node);
|
||||
|
||||
if (!node.computed && t().isMemberExpression(node.property)) {
|
||||
if (!node.computed && t.isMemberExpression(node.property)) {
|
||||
throw new TypeError("Got a MemberExpression for MemberExpression property");
|
||||
}
|
||||
|
||||
let computed = node.computed;
|
||||
|
||||
if (t().isLiteral(node.property) && typeof node.property.value === "number") {
|
||||
if (t.isLiteral(node.property) && typeof node.property.value === "number") {
|
||||
computed = true;
|
||||
}
|
||||
|
||||
@@ -260,13 +255,13 @@ function BindExpression(node) {
|
||||
function MemberExpression(node) {
|
||||
this.print(node.object, node);
|
||||
|
||||
if (!node.computed && t().isMemberExpression(node.property)) {
|
||||
if (!node.computed && t.isMemberExpression(node.property)) {
|
||||
throw new TypeError("Got a MemberExpression for MemberExpression property");
|
||||
}
|
||||
|
||||
let computed = node.computed;
|
||||
|
||||
if (t().isLiteral(node.property) && typeof node.property.value === "number") {
|
||||
if (t.isLiteral(node.property) && typeof node.property.value === "number") {
|
||||
computed = true;
|
||||
}
|
||||
|
||||
@@ -289,4 +284,9 @@ function MetaProperty(node) {
|
||||
function PrivateName(node) {
|
||||
this.token("#");
|
||||
this.print(node.id, node);
|
||||
}
|
||||
|
||||
function V8IntrinsicIdentifier(node) {
|
||||
this.token("%");
|
||||
this.word(node.name);
|
||||
}
|
||||
144
node_modules/@babel/generator/lib/generators/flow.js
generated
vendored
144
node_modules/@babel/generator/lib/generators/flow.js
generated
vendored
@@ -20,6 +20,15 @@ exports.DeclareOpaqueType = DeclareOpaqueType;
|
||||
exports.DeclareVariable = DeclareVariable;
|
||||
exports.DeclareExportDeclaration = DeclareExportDeclaration;
|
||||
exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
|
||||
exports.EnumDeclaration = EnumDeclaration;
|
||||
exports.EnumBooleanBody = EnumBooleanBody;
|
||||
exports.EnumNumberBody = EnumNumberBody;
|
||||
exports.EnumStringBody = EnumStringBody;
|
||||
exports.EnumSymbolBody = EnumSymbolBody;
|
||||
exports.EnumDefaultedMember = EnumDefaultedMember;
|
||||
exports.EnumBooleanMember = EnumBooleanMember;
|
||||
exports.EnumNumberMember = EnumNumberMember;
|
||||
exports.EnumStringMember = EnumStringMember;
|
||||
exports.ExistsTypeAnnotation = ExistsTypeAnnotation;
|
||||
exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
|
||||
exports.FunctionTypeParam = FunctionTypeParam;
|
||||
@@ -49,6 +58,7 @@ exports.ObjectTypeIndexer = ObjectTypeIndexer;
|
||||
exports.ObjectTypeProperty = ObjectTypeProperty;
|
||||
exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
|
||||
exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
|
||||
exports.SymbolTypeAnnotation = SymbolTypeAnnotation;
|
||||
exports.UnionTypeAnnotation = UnionTypeAnnotation;
|
||||
exports.TypeCastExpression = TypeCastExpression;
|
||||
exports.Variance = Variance;
|
||||
@@ -66,21 +76,15 @@ Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
|
||||
}
|
||||
});
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _modules = require("./modules");
|
||||
|
||||
var _types2 = require("./types");
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function AnyTypeAnnotation() {
|
||||
this.word("any");
|
||||
@@ -105,7 +109,7 @@ function NullLiteralTypeAnnotation() {
|
||||
}
|
||||
|
||||
function DeclareClass(node, parent) {
|
||||
if (!t().isDeclareExportDeclaration(parent)) {
|
||||
if (!t.isDeclareExportDeclaration(parent)) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
@@ -117,7 +121,7 @@ function DeclareClass(node, parent) {
|
||||
}
|
||||
|
||||
function DeclareFunction(node, parent) {
|
||||
if (!t().isDeclareExportDeclaration(parent)) {
|
||||
if (!t.isDeclareExportDeclaration(parent)) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
@@ -180,7 +184,7 @@ function DeclareTypeAlias(node) {
|
||||
}
|
||||
|
||||
function DeclareOpaqueType(node, parent) {
|
||||
if (!t().isDeclareExportDeclaration(parent)) {
|
||||
if (!t.isDeclareExportDeclaration(parent)) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
@@ -189,7 +193,7 @@ function DeclareOpaqueType(node, parent) {
|
||||
}
|
||||
|
||||
function DeclareVariable(node, parent) {
|
||||
if (!t().isDeclareExportDeclaration(parent)) {
|
||||
if (!t.isDeclareExportDeclaration(parent)) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
@@ -222,11 +226,112 @@ function DeclareExportAllDeclaration() {
|
||||
_modules.ExportAllDeclaration.apply(this, arguments);
|
||||
}
|
||||
|
||||
function EnumDeclaration(node) {
|
||||
const {
|
||||
id,
|
||||
body
|
||||
} = node;
|
||||
this.word("enum");
|
||||
this.space();
|
||||
this.print(id, node);
|
||||
this.print(body, node);
|
||||
}
|
||||
|
||||
function enumExplicitType(context, name, hasExplicitType) {
|
||||
if (hasExplicitType) {
|
||||
context.space();
|
||||
context.word("of");
|
||||
context.space();
|
||||
context.word(name);
|
||||
}
|
||||
|
||||
context.space();
|
||||
}
|
||||
|
||||
function enumBody(context, node) {
|
||||
const {
|
||||
members
|
||||
} = node;
|
||||
context.token("{");
|
||||
context.indent();
|
||||
context.newline();
|
||||
|
||||
for (const member of members) {
|
||||
context.print(member, node);
|
||||
context.newline();
|
||||
}
|
||||
|
||||
context.dedent();
|
||||
context.token("}");
|
||||
}
|
||||
|
||||
function EnumBooleanBody(node) {
|
||||
const {
|
||||
explicitType
|
||||
} = node;
|
||||
enumExplicitType(this, "boolean", explicitType);
|
||||
enumBody(this, node);
|
||||
}
|
||||
|
||||
function EnumNumberBody(node) {
|
||||
const {
|
||||
explicitType
|
||||
} = node;
|
||||
enumExplicitType(this, "number", explicitType);
|
||||
enumBody(this, node);
|
||||
}
|
||||
|
||||
function EnumStringBody(node) {
|
||||
const {
|
||||
explicitType
|
||||
} = node;
|
||||
enumExplicitType(this, "string", explicitType);
|
||||
enumBody(this, node);
|
||||
}
|
||||
|
||||
function EnumSymbolBody(node) {
|
||||
enumExplicitType(this, "symbol", true);
|
||||
enumBody(this, node);
|
||||
}
|
||||
|
||||
function EnumDefaultedMember(node) {
|
||||
const {
|
||||
id
|
||||
} = node;
|
||||
this.print(id, node);
|
||||
this.token(",");
|
||||
}
|
||||
|
||||
function enumInitializedMember(context, node) {
|
||||
const {
|
||||
id,
|
||||
init
|
||||
} = node;
|
||||
context.print(id, node);
|
||||
context.space();
|
||||
context.token("=");
|
||||
context.space();
|
||||
context.print(init, node);
|
||||
context.token(",");
|
||||
}
|
||||
|
||||
function EnumBooleanMember(node) {
|
||||
enumInitializedMember(this, node);
|
||||
}
|
||||
|
||||
function EnumNumberMember(node) {
|
||||
enumInitializedMember(this, node);
|
||||
}
|
||||
|
||||
function EnumStringMember(node) {
|
||||
enumInitializedMember(this, node);
|
||||
}
|
||||
|
||||
function FlowExportDeclaration(node) {
|
||||
if (node.declaration) {
|
||||
const declar = node.declaration;
|
||||
this.print(declar, node);
|
||||
if (!t().isStatement(declar)) this.semicolon();
|
||||
if (!t.isStatement(declar)) this.semicolon();
|
||||
} else {
|
||||
this.token("{");
|
||||
|
||||
@@ -583,6 +688,11 @@ function ObjectTypeProperty(node) {
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.kind === "get" || node.kind === "set") {
|
||||
this.word(node.kind);
|
||||
this.space();
|
||||
}
|
||||
|
||||
this._variance(node);
|
||||
|
||||
this.print(node.key, node);
|
||||
@@ -607,6 +717,10 @@ function QualifiedTypeIdentifier(node) {
|
||||
this.print(node.id, node);
|
||||
}
|
||||
|
||||
function SymbolTypeAnnotation() {
|
||||
this.word("symbol");
|
||||
}
|
||||
|
||||
function orSeparator() {
|
||||
this.space();
|
||||
this.token("|");
|
||||
|
||||
18
node_modules/@babel/generator/lib/generators/methods.js
generated
vendored
18
node_modules/@babel/generator/lib/generators/methods.js
generated
vendored
@@ -12,17 +12,11 @@ exports._functionHead = _functionHead;
|
||||
exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression;
|
||||
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _params(node) {
|
||||
this.print(node.typeParameters, node);
|
||||
@@ -62,6 +56,8 @@ function _methodHead(node) {
|
||||
}
|
||||
|
||||
if (node.async) {
|
||||
this._catchUp("start", key.loc);
|
||||
|
||||
this.word("async");
|
||||
this.space();
|
||||
}
|
||||
@@ -132,8 +128,8 @@ function ArrowFunctionExpression(node) {
|
||||
|
||||
const firstParam = node.params[0];
|
||||
|
||||
if (node.params.length === 1 && t().isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
|
||||
if (this.format.retainLines && node.loc && node.body.loc && node.loc.start.line < node.body.loc.start.line) {
|
||||
if (node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
|
||||
if ((this.format.retainLines || node.async) && node.loc && node.body.loc && node.loc.start.line < node.body.loc.start.line) {
|
||||
this.token("(");
|
||||
|
||||
if (firstParam.loc && firstParam.loc.start.line > node.loc.start.line) {
|
||||
|
||||
46
node_modules/@babel/generator/lib/generators/modules.js
generated
vendored
46
node_modules/@babel/generator/lib/generators/modules.js
generated
vendored
@@ -12,19 +12,14 @@ exports.ExportAllDeclaration = ExportAllDeclaration;
|
||||
exports.ExportNamedDeclaration = ExportNamedDeclaration;
|
||||
exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
|
||||
exports.ImportDeclaration = ImportDeclaration;
|
||||
exports.ImportAttribute = ImportAttribute;
|
||||
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function ImportSpecifier(node) {
|
||||
if (node.importKind === "type" || node.importKind === "typeof") {
|
||||
@@ -87,7 +82,7 @@ function ExportAllDeclaration(node) {
|
||||
}
|
||||
|
||||
function ExportNamedDeclaration(node) {
|
||||
if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) {
|
||||
if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
|
||||
this.printJoin(node.declaration.decorators, node);
|
||||
}
|
||||
|
||||
@@ -97,7 +92,7 @@ function ExportNamedDeclaration(node) {
|
||||
}
|
||||
|
||||
function ExportDefaultDeclaration(node) {
|
||||
if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) {
|
||||
if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
|
||||
this.printJoin(node.declaration.decorators, node);
|
||||
}
|
||||
|
||||
@@ -112,7 +107,7 @@ function ExportDeclaration(node) {
|
||||
if (node.declaration) {
|
||||
const declar = node.declaration;
|
||||
this.print(declar, node);
|
||||
if (!t().isStatement(declar)) this.semicolon();
|
||||
if (!t.isStatement(declar)) this.semicolon();
|
||||
} else {
|
||||
if (node.exportKind === "type") {
|
||||
this.word("type");
|
||||
@@ -122,10 +117,10 @@ function ExportDeclaration(node) {
|
||||
const specifiers = node.specifiers.slice(0);
|
||||
let hasSpecial = false;
|
||||
|
||||
while (true) {
|
||||
for (;;) {
|
||||
const first = specifiers[0];
|
||||
|
||||
if (t().isExportDefaultSpecifier(first) || t().isExportNamespaceSpecifier(first)) {
|
||||
if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) {
|
||||
hasSpecial = true;
|
||||
this.print(specifiers.shift(), node);
|
||||
|
||||
@@ -162,6 +157,8 @@ function ExportDeclaration(node) {
|
||||
}
|
||||
|
||||
function ImportDeclaration(node) {
|
||||
var _node$attributes;
|
||||
|
||||
this.word("import");
|
||||
this.space();
|
||||
|
||||
@@ -172,11 +169,11 @@ function ImportDeclaration(node) {
|
||||
|
||||
const specifiers = node.specifiers.slice(0);
|
||||
|
||||
if (specifiers && specifiers.length) {
|
||||
while (true) {
|
||||
if (specifiers == null ? void 0 : specifiers.length) {
|
||||
for (;;) {
|
||||
const first = specifiers[0];
|
||||
|
||||
if (t().isImportDefaultSpecifier(first) || t().isImportNamespaceSpecifier(first)) {
|
||||
if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
|
||||
this.print(specifiers.shift(), node);
|
||||
|
||||
if (specifiers.length) {
|
||||
@@ -202,9 +199,24 @@ function ImportDeclaration(node) {
|
||||
}
|
||||
|
||||
this.print(node.source, node);
|
||||
|
||||
if ((_node$attributes = node.attributes) == null ? void 0 : _node$attributes.length) {
|
||||
this.space();
|
||||
this.word("with");
|
||||
this.space();
|
||||
this.printList(node.attributes, node);
|
||||
}
|
||||
|
||||
this.semicolon();
|
||||
}
|
||||
|
||||
function ImportAttribute(node) {
|
||||
this.print(node.key);
|
||||
this.token(":");
|
||||
this.space();
|
||||
this.print(node.value);
|
||||
}
|
||||
|
||||
function ImportNamespaceSpecifier(node) {
|
||||
this.token("*");
|
||||
this.space();
|
||||
|
||||
21
node_modules/@babel/generator/lib/generators/statements.js
generated
vendored
21
node_modules/@babel/generator/lib/generators/statements.js
generated
vendored
@@ -18,17 +18,11 @@ exports.VariableDeclaration = VariableDeclaration;
|
||||
exports.VariableDeclarator = VariableDeclarator;
|
||||
exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForOfStatement = exports.ForInStatement = void 0;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function WithStatement(node) {
|
||||
this.word("with");
|
||||
@@ -46,7 +40,7 @@ function IfStatement(node) {
|
||||
this.print(node.test, node);
|
||||
this.token(")");
|
||||
this.space();
|
||||
const needsBlock = node.alternate && t().isIfStatement(getLastStatement(node.consequent));
|
||||
const needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent));
|
||||
|
||||
if (needsBlock) {
|
||||
this.token("{");
|
||||
@@ -71,7 +65,7 @@ function IfStatement(node) {
|
||||
}
|
||||
|
||||
function getLastStatement(statement) {
|
||||
if (!t().isStatement(statement.body)) return statement;
|
||||
if (!t.isStatement(statement.body)) return statement;
|
||||
return getLastStatement(statement.body);
|
||||
}
|
||||
|
||||
@@ -208,6 +202,7 @@ function CatchClause(node) {
|
||||
if (node.param) {
|
||||
this.token("(");
|
||||
this.print(node.param, node);
|
||||
this.print(node.param.typeAnnotation, node);
|
||||
this.token(")");
|
||||
this.space();
|
||||
}
|
||||
@@ -280,7 +275,7 @@ function VariableDeclaration(node, parent) {
|
||||
this.space();
|
||||
let hasInits = false;
|
||||
|
||||
if (!t().isFor(parent)) {
|
||||
if (!t.isFor(parent)) {
|
||||
for (const declar of node.declarations) {
|
||||
if (declar.init) {
|
||||
hasInits = true;
|
||||
@@ -298,7 +293,7 @@ function VariableDeclaration(node, parent) {
|
||||
separator
|
||||
});
|
||||
|
||||
if (t().isFor(parent)) {
|
||||
if (t.isFor(parent)) {
|
||||
if (parent.left === node || parent.init === node) return;
|
||||
}
|
||||
|
||||
|
||||
113
node_modules/@babel/generator/lib/generators/types.js
generated
vendored
113
node_modules/@babel/generator/lib/generators/types.js
generated
vendored
@@ -10,39 +10,28 @@ exports.ObjectPattern = exports.ObjectExpression = ObjectExpression;
|
||||
exports.ObjectMethod = ObjectMethod;
|
||||
exports.ObjectProperty = ObjectProperty;
|
||||
exports.ArrayPattern = exports.ArrayExpression = ArrayExpression;
|
||||
exports.RecordExpression = RecordExpression;
|
||||
exports.TupleExpression = TupleExpression;
|
||||
exports.RegExpLiteral = RegExpLiteral;
|
||||
exports.BooleanLiteral = BooleanLiteral;
|
||||
exports.NullLiteral = NullLiteral;
|
||||
exports.NumericLiteral = NumericLiteral;
|
||||
exports.StringLiteral = StringLiteral;
|
||||
exports.BigIntLiteral = BigIntLiteral;
|
||||
exports.DecimalLiteral = DecimalLiteral;
|
||||
exports.PipelineTopicExpression = PipelineTopicExpression;
|
||||
exports.PipelineBareFunction = PipelineBareFunction;
|
||||
exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jsesc() {
|
||||
const data = _interopRequireDefault(require("jsesc"));
|
||||
|
||||
_jsesc = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var _jsesc = _interopRequireDefault(require("jsesc"));
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function Identifier(node) {
|
||||
this.exactSource(node.loc, () => {
|
||||
@@ -93,14 +82,14 @@ function ObjectProperty(node) {
|
||||
this.print(node.key, node);
|
||||
this.token("]");
|
||||
} else {
|
||||
if (t().isAssignmentPattern(node.value) && t().isIdentifier(node.key) && node.key.name === node.value.left.name) {
|
||||
if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
|
||||
this.print(node.value, node);
|
||||
return;
|
||||
}
|
||||
|
||||
this.print(node.key, node);
|
||||
|
||||
if (node.shorthand && t().isIdentifier(node.key) && t().isIdentifier(node.value) && node.key.name === node.value.name) {
|
||||
if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -131,6 +120,68 @@ function ArrayExpression(node) {
|
||||
this.token("]");
|
||||
}
|
||||
|
||||
function RecordExpression(node) {
|
||||
const props = node.properties;
|
||||
let startToken;
|
||||
let endToken;
|
||||
|
||||
if (this.format.recordAndTupleSyntaxType === "bar") {
|
||||
startToken = "{|";
|
||||
endToken = "|}";
|
||||
} else if (this.format.recordAndTupleSyntaxType === "hash") {
|
||||
startToken = "#{";
|
||||
endToken = "}";
|
||||
} else {
|
||||
throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
|
||||
}
|
||||
|
||||
this.token(startToken);
|
||||
this.printInnerComments(node);
|
||||
|
||||
if (props.length) {
|
||||
this.space();
|
||||
this.printList(props, node, {
|
||||
indent: true,
|
||||
statement: true
|
||||
});
|
||||
this.space();
|
||||
}
|
||||
|
||||
this.token(endToken);
|
||||
}
|
||||
|
||||
function TupleExpression(node) {
|
||||
const elems = node.elements;
|
||||
const len = elems.length;
|
||||
let startToken;
|
||||
let endToken;
|
||||
|
||||
if (this.format.recordAndTupleSyntaxType === "bar") {
|
||||
startToken = "[|";
|
||||
endToken = "|]";
|
||||
} else if (this.format.recordAndTupleSyntaxType === "hash") {
|
||||
startToken = "#[";
|
||||
endToken = "]";
|
||||
} else {
|
||||
throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
|
||||
}
|
||||
|
||||
this.token(startToken);
|
||||
this.printInnerComments(node);
|
||||
|
||||
for (let i = 0; i < elems.length; i++) {
|
||||
const elem = elems[i];
|
||||
|
||||
if (elem) {
|
||||
if (i > 0) this.space();
|
||||
this.print(elem, node);
|
||||
if (i < len - 1) this.token(",");
|
||||
}
|
||||
}
|
||||
|
||||
this.token(endToken);
|
||||
}
|
||||
|
||||
function RegExpLiteral(node) {
|
||||
this.word(`/${node.pattern}/${node.flags}`);
|
||||
}
|
||||
@@ -145,9 +196,12 @@ function NullLiteral() {
|
||||
|
||||
function NumericLiteral(node) {
|
||||
const raw = this.getPossibleRaw(node);
|
||||
const opts = this.format.jsescOption;
|
||||
const value = node.value + "";
|
||||
|
||||
if (raw == null) {
|
||||
if (opts.numbers) {
|
||||
this.number((0, _jsesc.default)(node.value, opts));
|
||||
} else if (raw == null) {
|
||||
this.number(value);
|
||||
} else if (this.format.minified) {
|
||||
this.number(raw.length < value.length ? raw : value);
|
||||
@@ -170,7 +224,7 @@ function StringLiteral(node) {
|
||||
opts.json = true;
|
||||
}
|
||||
|
||||
const val = (0, _jsesc().default)(node.value, opts);
|
||||
const val = (0, _jsesc.default)(node.value, opts);
|
||||
return this.token(val);
|
||||
}
|
||||
|
||||
@@ -182,7 +236,18 @@ function BigIntLiteral(node) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.token(node.value);
|
||||
this.token(node.value + "n");
|
||||
}
|
||||
|
||||
function DecimalLiteral(node) {
|
||||
const raw = this.getPossibleRaw(node);
|
||||
|
||||
if (!this.format.minified && raw != null) {
|
||||
this.token(raw);
|
||||
return;
|
||||
}
|
||||
|
||||
this.token(node.value + "m");
|
||||
}
|
||||
|
||||
function PipelineTopicExpression(node) {
|
||||
|
||||
60
node_modules/@babel/generator/lib/generators/typescript.js
generated
vendored
60
node_modules/@babel/generator/lib/generators/typescript.js
generated
vendored
@@ -17,6 +17,7 @@ exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName;
|
||||
exports.TSMethodSignature = TSMethodSignature;
|
||||
exports.TSIndexSignature = TSIndexSignature;
|
||||
exports.TSAnyKeyword = TSAnyKeyword;
|
||||
exports.TSBigIntKeyword = TSBigIntKeyword;
|
||||
exports.TSUnknownKeyword = TSUnknownKeyword;
|
||||
exports.TSNumberKeyword = TSNumberKeyword;
|
||||
exports.TSObjectKeyword = TSObjectKeyword;
|
||||
@@ -41,6 +42,7 @@ exports.TSArrayType = TSArrayType;
|
||||
exports.TSTupleType = TSTupleType;
|
||||
exports.TSOptionalType = TSOptionalType;
|
||||
exports.TSRestType = TSRestType;
|
||||
exports.TSNamedTupleMember = TSNamedTupleMember;
|
||||
exports.TSUnionType = TSUnionType;
|
||||
exports.TSIntersectionType = TSIntersectionType;
|
||||
exports.tsPrintUnionOrIntersectionType = tsPrintUnionOrIntersectionType;
|
||||
@@ -68,6 +70,7 @@ exports.TSNonNullExpression = TSNonNullExpression;
|
||||
exports.TSExportAssignment = TSExportAssignment;
|
||||
exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
|
||||
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
|
||||
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
|
||||
|
||||
function TSTypeAnnotation(node) {
|
||||
this.token(":");
|
||||
@@ -139,12 +142,14 @@ function TSQualifiedName(node) {
|
||||
|
||||
function TSCallSignatureDeclaration(node) {
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
this.token(";");
|
||||
}
|
||||
|
||||
function TSConstructSignatureDeclaration(node) {
|
||||
this.word("new");
|
||||
this.space();
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
this.token(";");
|
||||
}
|
||||
|
||||
function TSPropertySignature(node) {
|
||||
@@ -216,6 +221,10 @@ function TSAnyKeyword() {
|
||||
this.word("any");
|
||||
}
|
||||
|
||||
function TSBigIntKeyword() {
|
||||
this.word("bigint");
|
||||
}
|
||||
|
||||
function TSUnknownKeyword() {
|
||||
this.word("unknown");
|
||||
}
|
||||
@@ -293,11 +302,19 @@ function TSTypeReference(node) {
|
||||
}
|
||||
|
||||
function TSTypePredicate(node) {
|
||||
if (node.asserts) {
|
||||
this.word("asserts");
|
||||
this.space();
|
||||
}
|
||||
|
||||
this.print(node.parameterName);
|
||||
this.space();
|
||||
this.word("is");
|
||||
this.space();
|
||||
this.print(node.typeAnnotation.typeAnnotation);
|
||||
|
||||
if (node.typeAnnotation) {
|
||||
this.space();
|
||||
this.word("is");
|
||||
this.space();
|
||||
this.print(node.typeAnnotation.typeAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
function TSTypeQuery(node) {
|
||||
@@ -354,6 +371,14 @@ function TSRestType(node) {
|
||||
this.print(node.typeAnnotation, node);
|
||||
}
|
||||
|
||||
function TSNamedTupleMember(node) {
|
||||
this.print(node.label, node);
|
||||
if (node.optional) this.token("?");
|
||||
this.token(":");
|
||||
this.space();
|
||||
this.print(node.elementType, node);
|
||||
}
|
||||
|
||||
function TSUnionType(node) {
|
||||
this.tsPrintUnionOrIntersectionType(node, "|");
|
||||
}
|
||||
@@ -712,4 +737,31 @@ function tsPrintSignatureDeclarationBase(node) {
|
||||
|
||||
this.token(")");
|
||||
this.print(node.typeAnnotation, node);
|
||||
}
|
||||
|
||||
function tsPrintClassMemberModifiers(node, isField) {
|
||||
if (isField && node.declare) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.accessibility) {
|
||||
this.word(node.accessibility);
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.static) {
|
||||
this.word("static");
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.abstract) {
|
||||
this.word("abstract");
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (isField && node.readonly) {
|
||||
this.word("readonly");
|
||||
this.space();
|
||||
}
|
||||
}
|
||||
3
node_modules/@babel/generator/lib/index.js
generated
vendored
3
node_modules/@babel/generator/lib/index.js
generated
vendored
@@ -47,7 +47,8 @@ function normalizeOptions(code, opts) {
|
||||
jsescOption: Object.assign({
|
||||
quotes: "double",
|
||||
wrap: true
|
||||
}, opts.jsescOption)
|
||||
}, opts.jsescOption),
|
||||
recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType
|
||||
};
|
||||
|
||||
if (format.minified) {
|
||||
|
||||
26
node_modules/@babel/generator/lib/node/index.js
generated
vendored
26
node_modules/@babel/generator/lib/node/index.js
generated
vendored
@@ -12,17 +12,11 @@ var whitespace = _interopRequireWildcard(require("./whitespace"));
|
||||
|
||||
var parens = _interopRequireWildcard(require("./parentheses"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function expandAliases(obj) {
|
||||
const newObj = {};
|
||||
@@ -36,7 +30,7 @@ function expandAliases(obj) {
|
||||
}
|
||||
|
||||
for (const type of Object.keys(obj)) {
|
||||
const aliases = t().FLIPPED_ALIAS_KEYS[type];
|
||||
const aliases = t.FLIPPED_ALIAS_KEYS[type];
|
||||
|
||||
if (aliases) {
|
||||
for (const alias of aliases) {
|
||||
@@ -60,21 +54,17 @@ function find(obj, node, parent, printStack) {
|
||||
}
|
||||
|
||||
function isOrHasCallExpression(node) {
|
||||
if (t().isCallExpression(node)) {
|
||||
if (t.isCallExpression(node)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t().isMemberExpression(node)) {
|
||||
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return t.isMemberExpression(node) && isOrHasCallExpression(node.object);
|
||||
}
|
||||
|
||||
function needsWhitespace(node, parent, type) {
|
||||
if (!node) return 0;
|
||||
|
||||
if (t().isExpressionStatement(node)) {
|
||||
if (t.isExpressionStatement(node)) {
|
||||
node = node.expression;
|
||||
}
|
||||
|
||||
@@ -109,7 +99,7 @@ function needsWhitespaceAfter(node, parent) {
|
||||
function needsParens(node, parent, printStack) {
|
||||
if (!parent) return false;
|
||||
|
||||
if (t().isNewExpression(parent) && parent.callee === node) {
|
||||
if (t.isNewExpression(parent) && parent.callee === node) {
|
||||
if (isOrHasCallExpression(node)) return true;
|
||||
}
|
||||
|
||||
|
||||
118
node_modules/@babel/generator/lib/node/parentheses.js
generated
vendored
118
node_modules/@babel/generator/lib/node/parentheses.js
generated
vendored
@@ -13,6 +13,7 @@ exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnno
|
||||
exports.TSAsExpression = TSAsExpression;
|
||||
exports.TSTypeAssertion = TSTypeAssertion;
|
||||
exports.TSIntersectionType = exports.TSUnionType = TSUnionType;
|
||||
exports.TSInferType = TSInferType;
|
||||
exports.BinaryExpression = BinaryExpression;
|
||||
exports.SequenceExpression = SequenceExpression;
|
||||
exports.AwaitExpression = exports.YieldExpression = YieldExpression;
|
||||
@@ -21,24 +22,19 @@ exports.UnaryLike = UnaryLike;
|
||||
exports.FunctionExpression = FunctionExpression;
|
||||
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
||||
exports.ConditionalExpression = ConditionalExpression;
|
||||
exports.OptionalMemberExpression = OptionalMemberExpression;
|
||||
exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
|
||||
exports.AssignmentExpression = AssignmentExpression;
|
||||
exports.NewExpression = NewExpression;
|
||||
exports.LogicalExpression = LogicalExpression;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const PRECEDENCE = {
|
||||
"||": 0,
|
||||
"??": 0,
|
||||
"&&": 1,
|
||||
"|": 2,
|
||||
"^": 3,
|
||||
@@ -64,24 +60,20 @@ const PRECEDENCE = {
|
||||
"**": 10
|
||||
};
|
||||
|
||||
const isClassExtendsClause = (node, parent) => (t().isClassDeclaration(parent) || t().isClassExpression(parent)) && parent.superClass === node;
|
||||
const isClassExtendsClause = (node, parent) => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node;
|
||||
|
||||
const hasPostfixPart = (node, parent) => (t.isMemberExpression(parent) || t.isOptionalMemberExpression(parent)) && parent.object === node || (t.isCallExpression(parent) || t.isOptionalCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isTaggedTemplateExpression(parent) && parent.tag === node || t.isTSNonNullExpression(parent);
|
||||
|
||||
function NullableTypeAnnotation(node, parent) {
|
||||
return t().isArrayTypeAnnotation(parent);
|
||||
return t.isArrayTypeAnnotation(parent);
|
||||
}
|
||||
|
||||
function FunctionTypeAnnotation(node, parent) {
|
||||
return t().isUnionTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isArrayTypeAnnotation(parent);
|
||||
function FunctionTypeAnnotation(node, parent, printStack) {
|
||||
return t.isUnionTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isArrayTypeAnnotation(parent) || t.isTypeAnnotation(parent) && t.isArrowFunctionExpression(printStack[printStack.length - 3]);
|
||||
}
|
||||
|
||||
function UpdateExpression(node, parent) {
|
||||
return t().isMemberExpression(parent, {
|
||||
object: node
|
||||
}) || t().isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isNewExpression(parent, {
|
||||
callee: node
|
||||
}) || isClassExtendsClause(node, parent);
|
||||
return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);
|
||||
}
|
||||
|
||||
function ObjectExpression(node, parent, printStack) {
|
||||
@@ -95,7 +87,7 @@ function DoExpression(node, parent, printStack) {
|
||||
}
|
||||
|
||||
function Binary(node, parent) {
|
||||
if (node.operator === "**" && t().isBinaryExpression(parent, {
|
||||
if (node.operator === "**" && t.isBinaryExpression(parent, {
|
||||
operator: "**"
|
||||
})) {
|
||||
return parent.left === node;
|
||||
@@ -105,26 +97,24 @@ function Binary(node, parent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((t().isCallExpression(parent) || t().isNewExpression(parent)) && parent.callee === node || t().isUnaryLike(parent) || t().isMemberExpression(parent) && parent.object === node || t().isAwaitExpression(parent)) {
|
||||
if (hasPostfixPart(node, parent) || t.isUnaryLike(parent) || t.isAwaitExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t().isBinary(parent)) {
|
||||
if (t.isBinary(parent)) {
|
||||
const parentOp = parent.operator;
|
||||
const parentPos = PRECEDENCE[parentOp];
|
||||
const nodeOp = node.operator;
|
||||
const nodePos = PRECEDENCE[nodeOp];
|
||||
|
||||
if (parentPos === nodePos && parent.right === node && !t().isLogicalExpression(parent) || parentPos > nodePos) {
|
||||
if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent) || parentPos > nodePos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function UnionTypeAnnotation(node, parent) {
|
||||
return t().isArrayTypeAnnotation(parent) || t().isNullableTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isUnionTypeAnnotation(parent);
|
||||
return t.isArrayTypeAnnotation(parent) || t.isNullableTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isUnionTypeAnnotation(parent);
|
||||
}
|
||||
|
||||
function TSAsExpression() {
|
||||
@@ -136,15 +126,19 @@ function TSTypeAssertion() {
|
||||
}
|
||||
|
||||
function TSUnionType(node, parent) {
|
||||
return t().isTSArrayType(parent) || t().isTSOptionalType(parent) || t().isTSIntersectionType(parent) || t().isTSUnionType(parent) || t().isTSRestType(parent);
|
||||
return t.isTSArrayType(parent) || t.isTSOptionalType(parent) || t.isTSIntersectionType(parent) || t.isTSUnionType(parent) || t.isTSRestType(parent);
|
||||
}
|
||||
|
||||
function TSInferType(node, parent) {
|
||||
return t.isTSArrayType(parent) || t.isTSOptionalType(parent);
|
||||
}
|
||||
|
||||
function BinaryExpression(node, parent) {
|
||||
return node.operator === "in" && (t().isVariableDeclarator(parent) || t().isFor(parent));
|
||||
return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent));
|
||||
}
|
||||
|
||||
function SequenceExpression(node, parent) {
|
||||
if (t().isForStatement(parent) || t().isThrowStatement(parent) || t().isReturnStatement(parent) || t().isIfStatement(parent) && parent.test === node || t().isWhileStatement(parent) && parent.test === node || t().isForInStatement(parent) && parent.right === node || t().isSwitchStatement(parent) && parent.discriminant === node || t().isExpressionStatement(parent) && parent.expression === node) {
|
||||
if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -152,7 +146,7 @@ function SequenceExpression(node, parent) {
|
||||
}
|
||||
|
||||
function YieldExpression(node, parent) {
|
||||
return t().isBinary(parent) || t().isUnaryLike(parent) || t().isCallExpression(parent) || t().isMemberExpression(parent) || t().isNewExpression(parent) || t().isAwaitExpression(parent) && t().isYieldExpression(node) || t().isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
|
||||
return t.isBinary(parent) || t.isUnaryLike(parent) || hasPostfixPart(node, parent) || t.isAwaitExpression(parent) && t.isYieldExpression(node) || t.isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
|
||||
}
|
||||
|
||||
function ClassExpression(node, parent, printStack) {
|
||||
@@ -162,13 +156,7 @@ function ClassExpression(node, parent, printStack) {
|
||||
}
|
||||
|
||||
function UnaryLike(node, parent) {
|
||||
return t().isMemberExpression(parent, {
|
||||
object: node
|
||||
}) || t().isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isNewExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isBinaryExpression(parent, {
|
||||
return hasPostfixPart(node, parent) || t.isBinaryExpression(parent, {
|
||||
operator: "**",
|
||||
left: node
|
||||
}) || isClassExtendsClause(node, parent);
|
||||
@@ -181,13 +169,13 @@ function FunctionExpression(node, parent, printStack) {
|
||||
}
|
||||
|
||||
function ArrowFunctionExpression(node, parent) {
|
||||
return t().isExportDeclaration(parent) || ConditionalExpression(node, parent);
|
||||
return t.isExportDeclaration(parent) || ConditionalExpression(node, parent);
|
||||
}
|
||||
|
||||
function ConditionalExpression(node, parent) {
|
||||
if (t().isUnaryLike(parent) || t().isBinary(parent) || t().isConditionalExpression(parent, {
|
||||
if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, {
|
||||
test: node
|
||||
}) || t().isAwaitExpression(parent) || t().isOptionalMemberExpression(parent) || t().isTaggedTemplateExpression(parent) || t().isTSTypeAssertion(parent) || t().isTSAsExpression(parent)) {
|
||||
}) || t.isAwaitExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -195,19 +183,35 @@ function ConditionalExpression(node, parent) {
|
||||
}
|
||||
|
||||
function OptionalMemberExpression(node, parent) {
|
||||
return t().isCallExpression(parent) || t().isMemberExpression(parent);
|
||||
return t.isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t.isMemberExpression(parent, {
|
||||
object: node
|
||||
});
|
||||
}
|
||||
|
||||
function AssignmentExpression(node) {
|
||||
if (t().isObjectPattern(node.left)) {
|
||||
function AssignmentExpression(node, parent, printStack) {
|
||||
if (t.isObjectPattern(node.left)) {
|
||||
return true;
|
||||
} else {
|
||||
return ConditionalExpression(...arguments);
|
||||
return ConditionalExpression(node, parent, printStack);
|
||||
}
|
||||
}
|
||||
|
||||
function NewExpression(node, parent) {
|
||||
return isClassExtendsClause(node, parent);
|
||||
function LogicalExpression(node, parent) {
|
||||
switch (node.operator) {
|
||||
case "||":
|
||||
if (!t.isLogicalExpression(parent)) return false;
|
||||
return parent.operator === "??" || parent.operator === "&&";
|
||||
|
||||
case "&&":
|
||||
return t.isLogicalExpression(parent, {
|
||||
operator: "??"
|
||||
});
|
||||
|
||||
case "??":
|
||||
return t.isLogicalExpression(parent) && parent.operator !== "??";
|
||||
}
|
||||
}
|
||||
|
||||
function isFirstInStatement(printStack, {
|
||||
@@ -220,25 +224,21 @@ function isFirstInStatement(printStack, {
|
||||
let parent = printStack[i];
|
||||
|
||||
while (i > 0) {
|
||||
if (t().isExpressionStatement(parent, {
|
||||
if (t.isExpressionStatement(parent, {
|
||||
expression: node
|
||||
}) || t().isTaggedTemplateExpression(parent) || considerDefaultExports && t().isExportDefaultDeclaration(parent, {
|
||||
}) || considerDefaultExports && t.isExportDefaultDeclaration(parent, {
|
||||
declaration: node
|
||||
}) || considerArrow && t().isArrowFunctionExpression(parent, {
|
||||
}) || considerArrow && t.isArrowFunctionExpression(parent, {
|
||||
body: node
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t().isCallExpression(parent, {
|
||||
callee: node
|
||||
}) || t().isSequenceExpression(parent) && parent.expressions[0] === node || t().isMemberExpression(parent, {
|
||||
object: node
|
||||
}) || t().isConditional(parent, {
|
||||
if (hasPostfixPart(node, parent) && !t.isNewExpression(parent) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isConditional(parent, {
|
||||
test: node
|
||||
}) || t().isBinary(parent, {
|
||||
}) || t.isBinary(parent, {
|
||||
left: node
|
||||
}) || t().isAssignmentExpression(parent, {
|
||||
}) || t.isAssignmentExpression(parent, {
|
||||
left: node
|
||||
})) {
|
||||
node = parent;
|
||||
|
||||
63
node_modules/@babel/generator/lib/node/whitespace.js
generated
vendored
63
node_modules/@babel/generator/lib/node/whitespace.js
generated
vendored
@@ -5,31 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.list = exports.nodes = void 0;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function crawl(node, state = {}) {
|
||||
if (t().isMemberExpression(node)) {
|
||||
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
|
||||
crawl(node.object, state);
|
||||
if (node.computed) crawl(node.property, state);
|
||||
} else if (t().isBinary(node) || t().isAssignmentExpression(node)) {
|
||||
} else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
|
||||
crawl(node.left, state);
|
||||
crawl(node.right, state);
|
||||
} else if (t().isCallExpression(node)) {
|
||||
} else if (t.isCallExpression(node) || t.isOptionalCallExpression(node)) {
|
||||
state.hasCall = true;
|
||||
crawl(node.callee, state);
|
||||
} else if (t().isFunction(node)) {
|
||||
} else if (t.isFunction(node)) {
|
||||
state.hasFunction = true;
|
||||
} else if (t().isIdentifier(node)) {
|
||||
} else if (t.isIdentifier(node)) {
|
||||
state.hasHelper = state.hasHelper || isHelper(node.callee);
|
||||
}
|
||||
|
||||
@@ -37,21 +31,21 @@ function crawl(node, state = {}) {
|
||||
}
|
||||
|
||||
function isHelper(node) {
|
||||
if (t().isMemberExpression(node)) {
|
||||
if (t.isMemberExpression(node)) {
|
||||
return isHelper(node.object) || isHelper(node.property);
|
||||
} else if (t().isIdentifier(node)) {
|
||||
} else if (t.isIdentifier(node)) {
|
||||
return node.name === "require" || node.name[0] === "_";
|
||||
} else if (t().isCallExpression(node)) {
|
||||
} else if (t.isCallExpression(node)) {
|
||||
return isHelper(node.callee);
|
||||
} else if (t().isBinary(node) || t().isAssignmentExpression(node)) {
|
||||
return t().isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
|
||||
} else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
|
||||
return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isType(node) {
|
||||
return t().isLiteral(node) || t().isObjectExpression(node) || t().isArrayExpression(node) || t().isIdentifier(node) || t().isMemberExpression(node);
|
||||
return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node);
|
||||
}
|
||||
|
||||
const nodes = {
|
||||
@@ -74,7 +68,7 @@ const nodes = {
|
||||
},
|
||||
|
||||
LogicalExpression(node) {
|
||||
if (t().isFunction(node.left) || t().isFunction(node.right)) {
|
||||
if (t.isFunction(node.left) || t.isFunction(node.right)) {
|
||||
return {
|
||||
after: true
|
||||
};
|
||||
@@ -90,7 +84,16 @@ const nodes = {
|
||||
},
|
||||
|
||||
CallExpression(node) {
|
||||
if (t().isFunction(node.callee) || isHelper(node)) {
|
||||
if (t.isFunction(node.callee) || isHelper(node)) {
|
||||
return {
|
||||
before: true,
|
||||
after: true
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
OptionalCallExpression(node) {
|
||||
if (t.isFunction(node.callee)) {
|
||||
return {
|
||||
before: true,
|
||||
after: true
|
||||
@@ -118,7 +121,7 @@ const nodes = {
|
||||
},
|
||||
|
||||
IfStatement(node) {
|
||||
if (t().isBlockStatement(node.consequent)) {
|
||||
if (t.isBlockStatement(node.consequent)) {
|
||||
return {
|
||||
before: true,
|
||||
after: true
|
||||
@@ -138,7 +141,9 @@ nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function
|
||||
};
|
||||
|
||||
nodes.ObjectTypeCallProperty = function (node, parent) {
|
||||
if (parent.callProperties[0] === node && (!parent.properties || !parent.properties.length)) {
|
||||
var _parent$properties;
|
||||
|
||||
if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) == null ? void 0 : _parent$properties.length)) {
|
||||
return {
|
||||
before: true
|
||||
};
|
||||
@@ -146,7 +151,9 @@ nodes.ObjectTypeCallProperty = function (node, parent) {
|
||||
};
|
||||
|
||||
nodes.ObjectTypeIndexer = function (node, parent) {
|
||||
if (parent.indexers[0] === node && (!parent.properties || !parent.properties.length) && (!parent.callProperties || !parent.callProperties.length)) {
|
||||
var _parent$properties2, _parent$callPropertie;
|
||||
|
||||
if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) == null ? void 0 : _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) == null ? void 0 : _parent$callPropertie.length)) {
|
||||
return {
|
||||
before: true
|
||||
};
|
||||
@@ -154,7 +161,9 @@ nodes.ObjectTypeIndexer = function (node, parent) {
|
||||
};
|
||||
|
||||
nodes.ObjectTypeInternalSlot = function (node, parent) {
|
||||
if (parent.internalSlots[0] === node && (!parent.properties || !parent.properties.length) && (!parent.callProperties || !parent.callProperties.length) && (!parent.indexers || !parent.indexers.length)) {
|
||||
var _parent$properties3, _parent$callPropertie2, _parent$indexers;
|
||||
|
||||
if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) == null ? void 0 : _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) == null ? void 0 : _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) == null ? void 0 : _parent$indexers.length)) {
|
||||
return {
|
||||
before: true
|
||||
};
|
||||
@@ -184,7 +193,7 @@ exports.list = list;
|
||||
};
|
||||
}
|
||||
|
||||
[type].concat(t().FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
|
||||
[type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
|
||||
nodes[type] = function () {
|
||||
return amounts;
|
||||
};
|
||||
|
||||
105
node_modules/@babel/generator/lib/printer.js
generated
vendored
105
node_modules/@babel/generator/lib/printer.js
generated
vendored
@@ -5,49 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _isInteger() {
|
||||
const data = _interopRequireDefault(require("lodash/isInteger"));
|
||||
|
||||
_isInteger = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _repeat() {
|
||||
const data = _interopRequireDefault(require("lodash/repeat"));
|
||||
|
||||
_repeat = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _buffer = _interopRequireDefault(require("./buffer"));
|
||||
|
||||
var n = _interopRequireWildcard(require("./node"));
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var generatorFunctions = _interopRequireWildcard(require("./generators"));
|
||||
|
||||
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; } }
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const SCIENTIFIC_NOTATION = /e/i;
|
||||
const ZERO_DECIMAL_INTEGER = /\.0+$/;
|
||||
const NON_DECIMAL_LITERAL = /^0[box]/;
|
||||
const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/;
|
||||
|
||||
class Printer {
|
||||
constructor(format, map) {
|
||||
@@ -120,7 +95,7 @@ class Printer {
|
||||
|
||||
number(str) {
|
||||
this.word(str);
|
||||
this._endsWithInteger = (0, _isInteger().default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
|
||||
this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
|
||||
}
|
||||
|
||||
token(str) {
|
||||
@@ -205,19 +180,32 @@ class Printer {
|
||||
_maybeAddParen(str) {
|
||||
const parenPushNewlineState = this._parenPushNewlineState;
|
||||
if (!parenPushNewlineState) return;
|
||||
this._parenPushNewlineState = null;
|
||||
let i;
|
||||
|
||||
for (i = 0; i < str.length && str[i] === " "; i++) continue;
|
||||
|
||||
if (i === str.length) return;
|
||||
if (i === str.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cha = str[i];
|
||||
|
||||
if (cha !== "\n") {
|
||||
if (cha !== "/") return;
|
||||
if (i + 1 === str.length) return;
|
||||
if (cha !== "/" || i + 1 === str.length) {
|
||||
this._parenPushNewlineState = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const chaPost = str[i + 1];
|
||||
if (chaPost !== "/" && chaPost !== "*") return;
|
||||
|
||||
if (chaPost === "*") {
|
||||
if (PURE_ANNOTATION_RE.test(str.slice(i + 2, str.length - 2))) {
|
||||
return;
|
||||
}
|
||||
} else if (chaPost !== "/") {
|
||||
this._parenPushNewlineState = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.token("(");
|
||||
@@ -229,7 +217,7 @@ class Printer {
|
||||
if (!this.format.retainLines) return;
|
||||
const pos = loc ? loc[prop] : null;
|
||||
|
||||
if (pos && pos.line !== null) {
|
||||
if ((pos == null ? void 0 : pos.line) != null) {
|
||||
const count = pos.line - this._buf.getCurrentLine();
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
@@ -239,7 +227,7 @@ class Printer {
|
||||
}
|
||||
|
||||
_getIndent() {
|
||||
return (0, _repeat().default)(this.format.indent.style, this._indent);
|
||||
return this.format.indent.style.repeat(this._indent);
|
||||
}
|
||||
|
||||
startTerminatorless(isLabel = false) {
|
||||
@@ -256,7 +244,7 @@ class Printer {
|
||||
endTerminatorless(state) {
|
||||
this._noLineTerminator = false;
|
||||
|
||||
if (state && state.printed) {
|
||||
if (state == null ? void 0 : state.printed) {
|
||||
this.dedent();
|
||||
this.newline();
|
||||
this.token(")");
|
||||
@@ -274,7 +262,7 @@ class Printer {
|
||||
const printMethod = this[node.type];
|
||||
|
||||
if (!printMethod) {
|
||||
throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`);
|
||||
throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node == null ? void 0 : node.constructor.name)}`);
|
||||
}
|
||||
|
||||
this._printStack.push(node);
|
||||
@@ -294,7 +282,7 @@ class Printer {
|
||||
|
||||
this._printLeadingComments(node);
|
||||
|
||||
const loc = t().isProgram(node) || t().isFile(node) ? null : node.loc;
|
||||
const loc = t.isProgram(node) || t.isFile(node) ? null : node.loc;
|
||||
this.withSource("start", loc, () => {
|
||||
printMethod.call(this, node, parent);
|
||||
});
|
||||
@@ -349,7 +337,7 @@ class Printer {
|
||||
}
|
||||
|
||||
printJoin(nodes, parent, opts = {}) {
|
||||
if (!nodes || !nodes.length) return;
|
||||
if (!(nodes == null ? void 0 : nodes.length)) return;
|
||||
if (opts.indent) this.indent();
|
||||
const newlineOpts = {
|
||||
addNewlines: opts.addNewlines
|
||||
@@ -385,7 +373,7 @@ class Printer {
|
||||
printBlock(parent) {
|
||||
const node = parent.body;
|
||||
|
||||
if (!t().isEmptyStatement(node)) {
|
||||
if (!t.isEmptyStatement(node)) {
|
||||
this.space();
|
||||
}
|
||||
|
||||
@@ -397,11 +385,13 @@ class Printer {
|
||||
}
|
||||
|
||||
_printLeadingComments(node) {
|
||||
this._printComments(this._getComments(true, node));
|
||||
this._printComments(this._getComments(true, node), true);
|
||||
}
|
||||
|
||||
printInnerComments(node, indent = true) {
|
||||
if (!node.innerComments || !node.innerComments.length) return;
|
||||
var _node$innerComments;
|
||||
|
||||
if (!((_node$innerComments = node.innerComments) == null ? void 0 : _node$innerComments.length)) return;
|
||||
if (indent) this.indent();
|
||||
|
||||
this._printComments(node.innerComments);
|
||||
@@ -446,7 +436,7 @@ class Printer {
|
||||
return node && (leading ? node.leadingComments : node.trailingComments) || [];
|
||||
}
|
||||
|
||||
_printComment(comment) {
|
||||
_printComment(comment, skipNewLines) {
|
||||
if (!this.format.shouldPrintComment(comment.value)) return;
|
||||
if (comment.ignore) return;
|
||||
if (this._printedComments.has(comment)) return;
|
||||
@@ -459,12 +449,15 @@ class Printer {
|
||||
}
|
||||
|
||||
const isBlockComment = comment.type === "CommentBlock";
|
||||
this.newline(this._buf.hasContent() && !this._noLineTerminator && isBlockComment ? 1 : 0);
|
||||
const printNewLines = isBlockComment && !skipNewLines && !this._noLineTerminator;
|
||||
if (printNewLines && this._buf.hasContent()) this.newline(1);
|
||||
if (!this.endsWith("[") && !this.endsWith("{")) this.space();
|
||||
let val = !isBlockComment && !this._noLineTerminator ? `//${comment.value}\n` : `/*${comment.value}*/`;
|
||||
|
||||
if (isBlockComment && this.format.indent.adjustMultilineComment) {
|
||||
const offset = comment.loc && comment.loc.start.column;
|
||||
var _comment$loc;
|
||||
|
||||
const offset = (_comment$loc = comment.loc) == null ? void 0 : _comment$loc.start.column;
|
||||
|
||||
if (offset) {
|
||||
const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
|
||||
@@ -472,21 +465,25 @@ class Printer {
|
||||
}
|
||||
|
||||
const indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn());
|
||||
val = val.replace(/\n(?!$)/g, `\n${(0, _repeat().default)(" ", indentSize)}`);
|
||||
val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`);
|
||||
}
|
||||
|
||||
if (this.endsWith("/")) this._space();
|
||||
this.withSource("start", comment.loc, () => {
|
||||
this._append(val);
|
||||
});
|
||||
this.newline(isBlockComment && !this._noLineTerminator ? 1 : 0);
|
||||
if (printNewLines) this.newline(1);
|
||||
}
|
||||
|
||||
_printComments(comments) {
|
||||
if (!comments || !comments.length) return;
|
||||
_printComments(comments, inlinePureAnnotation) {
|
||||
if (!(comments == null ? void 0 : comments.length)) return;
|
||||
|
||||
for (const comment of comments) {
|
||||
this._printComment(comment);
|
||||
if (inlinePureAnnotation && comments.length === 1 && PURE_ANNOTATION_RE.test(comments[0].value)) {
|
||||
this._printComment(comments[0], this._buf.hasContent() && !this.endsWith("\n"));
|
||||
} else {
|
||||
for (const comment of comments) {
|
||||
this._printComment(comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
20
node_modules/@babel/generator/lib/source-map.js
generated
vendored
20
node_modules/@babel/generator/lib/source-map.js
generated
vendored
@@ -5,15 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _sourceMap() {
|
||||
const data = _interopRequireDefault(require("source-map"));
|
||||
|
||||
_sourceMap = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
var _sourceMap = _interopRequireDefault(require("source-map"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@@ -27,20 +19,20 @@ class SourceMap {
|
||||
|
||||
get() {
|
||||
if (!this._cachedMap) {
|
||||
const map = this._cachedMap = new (_sourceMap().default.SourceMapGenerator)({
|
||||
const map = this._cachedMap = new _sourceMap.default.SourceMapGenerator({
|
||||
sourceRoot: this._opts.sourceRoot
|
||||
});
|
||||
const code = this._code;
|
||||
|
||||
if (typeof code === "string") {
|
||||
map.setSourceContent(this._opts.sourceFileName, code);
|
||||
map.setSourceContent(this._opts.sourceFileName.replace(/\\/g, "/"), code);
|
||||
} else if (typeof code === "object") {
|
||||
Object.keys(code).forEach(sourceFileName => {
|
||||
map.setSourceContent(sourceFileName, code[sourceFileName]);
|
||||
map.setSourceContent(sourceFileName.replace(/\\/g, "/"), code[sourceFileName]);
|
||||
});
|
||||
}
|
||||
|
||||
this._rawMappings.forEach(map.addMapping, map);
|
||||
this._rawMappings.forEach(mapping => map.addMapping(mapping), map);
|
||||
}
|
||||
|
||||
return this._cachedMap.toJSON();
|
||||
@@ -68,7 +60,7 @@ class SourceMap {
|
||||
line: generatedLine,
|
||||
column: generatedColumn
|
||||
},
|
||||
source: line == null ? undefined : filename || this._opts.sourceFileName,
|
||||
source: line == null ? undefined : (filename || this._opts.sourceFileName).replace(/\\/g, "/"),
|
||||
original: line == null ? undefined : {
|
||||
line: line,
|
||||
column: column
|
||||
|
||||
24
node_modules/@babel/generator/node_modules/source-map/package.json
generated
vendored
24
node_modules/@babel/generator/node_modules/source-map/package.json
generated
vendored
@@ -1,33 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"source-map@0.5.7",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "source-map@0.5.7",
|
||||
"_from": "source-map@^0.5.0",
|
||||
"_id": "source-map@0.5.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
|
||||
"_location": "/@babel/generator/source-map",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "source-map@0.5.7",
|
||||
"raw": "source-map@^0.5.0",
|
||||
"name": "source-map",
|
||||
"escapedName": "source-map",
|
||||
"rawSpec": "0.5.7",
|
||||
"rawSpec": "^0.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.5.7"
|
||||
"fetchSpec": "^0.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/generator"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
"_spec": "0.5.7",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_shasum": "8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc",
|
||||
"_spec": "source-map@^0.5.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/generator",
|
||||
"author": {
|
||||
"name": "Nick Fitzgerald",
|
||||
"email": "nfitzgerald@mozilla.com"
|
||||
@@ -35,6 +29,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/source-map/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Tobias Koppers",
|
||||
@@ -181,6 +176,7 @@
|
||||
"email": "nicolas.lalevee@hibnet.org"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Generates and consumes source maps",
|
||||
"devDependencies": {
|
||||
"doctoc": "^0.15.0",
|
||||
|
||||
54
node_modules/@babel/generator/package.json
generated
vendored
54
node_modules/@babel/generator/package.json
generated
vendored
@@ -1,56 +1,53 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/generator@7.5.5",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/generator@7.5.5",
|
||||
"_id": "@babel/generator@7.5.5",
|
||||
"_from": "@babel/generator@^7.11.6",
|
||||
"_id": "@babel/generator@7.11.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ==",
|
||||
"_integrity": "sha512-DWtQ1PV3r+cLbySoHrwn9RWEgKMBLLma4OBQloPRyDYvc5msJM9kvTLo1YnlJd1P/ZuKbdli3ijr5q3FvAF3uA==",
|
||||
"_location": "/@babel/generator",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/generator@7.5.5",
|
||||
"raw": "@babel/generator@^7.11.6",
|
||||
"name": "@babel/generator",
|
||||
"escapedName": "@babel%2fgenerator",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.5.5",
|
||||
"rawSpec": "^7.11.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.5.5"
|
||||
"fetchSpec": "^7.11.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core",
|
||||
"/@babel/traverse",
|
||||
"/istanbul-lib-instrument"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.5.5.tgz",
|
||||
"_spec": "7.5.5",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.6.tgz",
|
||||
"_shasum": "b868900f81b163b4d464ea24545c61cbac4dc620",
|
||||
"_spec": "@babel/generator@^7.11.6",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/core",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.5.5",
|
||||
"jsesc": "^2.5.1",
|
||||
"lodash": "^4.17.13",
|
||||
"source-map": "^0.5.0",
|
||||
"trim-right": "^1.0.1"
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.11.5",
|
||||
"jsesc": "^2.5.1",
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Turns an AST into code.",
|
||||
"devDependencies": {
|
||||
"@babel/helper-fixtures": "^7.5.5",
|
||||
"@babel/parser": "^7.5.5"
|
||||
"@babel/helper-fixtures": "^7.10.5",
|
||||
"@babel/parser": "^7.11.5"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
|
||||
"gitHead": "e51139d7fd850e7f5b8cd6aafb17cc88b7010218",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@@ -60,7 +57,8 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-generator"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-generator"
|
||||
},
|
||||
"version": "7.5.5"
|
||||
"version": "7.11.6"
|
||||
}
|
||||
|
||||
2
node_modules/@babel/helper-function-name/LICENSE
generated
vendored
2
node_modules/@babel/helper-function-name/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2018 Sebastian McKenzie and other contributors
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
72
node_modules/@babel/helper-function-name/lib/index.js
generated
vendored
72
node_modules/@babel/helper-function-name/lib/index.js
generated
vendored
@@ -5,41 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function _helperGetFunctionArity() {
|
||||
const data = _interopRequireDefault(require("@babel/helper-get-function-arity"));
|
||||
var _helperGetFunctionArity = _interopRequireDefault(require("@babel/helper-get-function-arity"));
|
||||
|
||||
_helperGetFunctionArity = function () {
|
||||
return data;
|
||||
};
|
||||
var _template = _interopRequireDefault(require("@babel/template"));
|
||||
|
||||
return data;
|
||||
}
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
function _template() {
|
||||
const data = _interopRequireDefault(require("@babel/template"));
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
_template = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const buildPropertyMethodAssignmentWrapper = (0, _template().default)(`
|
||||
const buildPropertyMethodAssignmentWrapper = (0, _template.default)(`
|
||||
(function (FUNCTION_KEY) {
|
||||
function FUNCTION_ID() {
|
||||
return FUNCTION_KEY.apply(this, arguments);
|
||||
@@ -52,7 +30,7 @@ const buildPropertyMethodAssignmentWrapper = (0, _template().default)(`
|
||||
return FUNCTION_ID;
|
||||
})(FUNCTION)
|
||||
`);
|
||||
const buildGeneratorPropertyMethodAssignmentWrapper = (0, _template().default)(`
|
||||
const buildGeneratorPropertyMethodAssignmentWrapper = (0, _template.default)(`
|
||||
(function (FUNCTION_KEY) {
|
||||
function* FUNCTION_ID() {
|
||||
return yield* FUNCTION_KEY.apply(this, arguments);
|
||||
@@ -77,15 +55,15 @@ const visitor = {
|
||||
};
|
||||
|
||||
function getNameFromLiteralId(id) {
|
||||
if (t().isNullLiteral(id)) {
|
||||
if (t.isNullLiteral(id)) {
|
||||
return "null";
|
||||
}
|
||||
|
||||
if (t().isRegExpLiteral(id)) {
|
||||
if (t.isRegExpLiteral(id)) {
|
||||
return `_${id.pattern}_${id.flags}`;
|
||||
}
|
||||
|
||||
if (t().isTemplateLiteral(id)) {
|
||||
if (t.isTemplateLiteral(id)) {
|
||||
return id.quasis.map(quasi => quasi.value.raw).join("");
|
||||
}
|
||||
|
||||
@@ -101,7 +79,7 @@ function wrap(state, method, id, scope) {
|
||||
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
|
||||
scope.rename(id.name);
|
||||
} else {
|
||||
if (!t().isFunction(method)) return;
|
||||
if (!t.isFunction(method)) return;
|
||||
let build = buildPropertyMethodAssignmentWrapper;
|
||||
|
||||
if (method.generator) {
|
||||
@@ -115,7 +93,7 @@ function wrap(state, method, id, scope) {
|
||||
}).expression;
|
||||
const params = template.callee.body.body[0].params;
|
||||
|
||||
for (let i = 0, len = (0, _helperGetFunctionArity().default)(method); i < len; i++) {
|
||||
for (let i = 0, len = (0, _helperGetFunctionArity.default)(method); i < len; i++) {
|
||||
params.push(scope.generateUidIdentifier("x"));
|
||||
}
|
||||
|
||||
@@ -156,23 +134,25 @@ function _default({
|
||||
}, localBinding = false) {
|
||||
if (node.id) return;
|
||||
|
||||
if ((t().isObjectProperty(parent) || t().isObjectMethod(parent, {
|
||||
if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, {
|
||||
kind: "method"
|
||||
})) && (!parent.computed || t().isLiteral(parent.key))) {
|
||||
})) && (!parent.computed || t.isLiteral(parent.key))) {
|
||||
id = parent.key;
|
||||
} else if (t().isVariableDeclarator(parent)) {
|
||||
} else if (t.isVariableDeclarator(parent)) {
|
||||
id = parent.id;
|
||||
|
||||
if (t().isIdentifier(id) && !localBinding) {
|
||||
if (t.isIdentifier(id) && !localBinding) {
|
||||
const binding = scope.parent.getBinding(id.name);
|
||||
|
||||
if (binding && binding.constant && scope.getBinding(id.name) === binding) {
|
||||
node.id = t().cloneNode(id);
|
||||
node.id[t().NOT_LOCAL_BINDING] = true;
|
||||
node.id = t.cloneNode(id);
|
||||
node.id[t.NOT_LOCAL_BINDING] = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (t().isAssignmentExpression(parent)) {
|
||||
} else if (t.isAssignmentExpression(parent, {
|
||||
operator: "="
|
||||
})) {
|
||||
id = parent.left;
|
||||
} else if (!id) {
|
||||
return;
|
||||
@@ -180,9 +160,9 @@ function _default({
|
||||
|
||||
let name;
|
||||
|
||||
if (id && t().isLiteral(id)) {
|
||||
if (id && t.isLiteral(id)) {
|
||||
name = getNameFromLiteralId(id);
|
||||
} else if (id && t().isIdentifier(id)) {
|
||||
} else if (id && t.isIdentifier(id)) {
|
||||
name = id.name;
|
||||
}
|
||||
|
||||
@@ -190,9 +170,9 @@ function _default({
|
||||
return;
|
||||
}
|
||||
|
||||
name = t().toBindingIdentifierName(name);
|
||||
id = t().identifier(name);
|
||||
id[t().NOT_LOCAL_BINDING] = true;
|
||||
name = t.toBindingIdentifierName(name);
|
||||
id = t.identifier(name);
|
||||
id[t.NOT_LOCAL_BINDING] = true;
|
||||
const state = visit(node, name, scope);
|
||||
return wrap(state, node, id, scope) || node;
|
||||
}
|
||||
48
node_modules/@babel/helper-function-name/package.json
generated
vendored
48
node_modules/@babel/helper-function-name/package.json
generated
vendored
@@ -1,40 +1,41 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/helper-function-name@7.1.0",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/helper-function-name@7.1.0",
|
||||
"_id": "@babel/helper-function-name@7.1.0",
|
||||
"_from": "@babel/helper-function-name@^7.10.4",
|
||||
"_id": "@babel/helper-function-name@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==",
|
||||
"_integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
|
||||
"_location": "/@babel/helper-function-name",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-function-name@7.1.0",
|
||||
"raw": "@babel/helper-function-name@^7.10.4",
|
||||
"name": "@babel/helper-function-name",
|
||||
"escapedName": "@babel%2fhelper-function-name",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.1.0",
|
||||
"rawSpec": "^7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.1.0"
|
||||
"fetchSpec": "^7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/traverse"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz",
|
||||
"_spec": "7.1.0",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"dependencies": {
|
||||
"@babel/helper-get-function-arity": "^7.0.0",
|
||||
"@babel/template": "^7.1.0",
|
||||
"@babel/types": "^7.0.0"
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
|
||||
"_shasum": "d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a",
|
||||
"_spec": "@babel/helper-function-name@^7.10.4",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/traverse",
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/helper-get-function-arity": "^7.10.4",
|
||||
"@babel/template": "^7.10.4",
|
||||
"@babel/types": "^7.10.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper function to change the property 'name' of every function",
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://github.com/babel/babel#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-function-name",
|
||||
@@ -43,7 +44,8 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-function-name"
|
||||
},
|
||||
"version": "7.1.0"
|
||||
"version": "7.10.4"
|
||||
}
|
||||
|
||||
2
node_modules/@babel/helper-get-function-arity/LICENSE
generated
vendored
2
node_modules/@babel/helper-get-function-arity/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
14
node_modules/@babel/helper-get-function-arity/lib/index.js
generated
vendored
14
node_modules/@babel/helper-get-function-arity/lib/index.js
generated
vendored
@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
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; } }
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _default(node) {
|
||||
const params = node.params;
|
||||
@@ -23,7 +17,7 @@ function _default(node) {
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
const param = params[i];
|
||||
|
||||
if (t().isAssignmentPattern(param) || t().isRestElement(param)) {
|
||||
if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
47
node_modules/@babel/helper-get-function-arity/package.json
generated
vendored
47
node_modules/@babel/helper-get-function-arity/package.json
generated
vendored
@@ -1,44 +1,49 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/helper-get-function-arity@7.0.0",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/helper-get-function-arity@7.0.0",
|
||||
"_id": "@babel/helper-get-function-arity@7.0.0",
|
||||
"_from": "@babel/helper-get-function-arity@^7.10.4",
|
||||
"_id": "@babel/helper-get-function-arity@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==",
|
||||
"_integrity": "sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A==",
|
||||
"_location": "/@babel/helper-get-function-arity",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-get-function-arity@7.0.0",
|
||||
"raw": "@babel/helper-get-function-arity@^7.10.4",
|
||||
"name": "@babel/helper-get-function-arity",
|
||||
"escapedName": "@babel%2fhelper-get-function-arity",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.0.0",
|
||||
"rawSpec": "^7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.0.0"
|
||||
"fetchSpec": "^7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/helper-function-name"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz",
|
||||
"_spec": "7.0.0",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0"
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz",
|
||||
"_shasum": "98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2",
|
||||
"_spec": "@babel/helper-get-function-arity@^7.10.4",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/helper-function-name",
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.10.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper function to get function arity",
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://github.com/babel/babel#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-get-function-arity",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-get-function-arity"
|
||||
},
|
||||
"version": "7.0.0"
|
||||
"version": "7.10.4"
|
||||
}
|
||||
|
||||
22
node_modules/@babel/helper-member-expression-to-functions/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-member-expression-to-functions/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other 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.
|
||||
19
node_modules/@babel/helper-member-expression-to-functions/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-member-expression-to-functions/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-member-expression-to-functions
|
||||
|
||||
> Helper function to replace certain member expressions with function calls
|
||||
|
||||
See our website [@babel/helper-member-expression-to-functions](https://babeljs.io/docs/en/next/babel-helper-member-expression-to-functions.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-member-expression-to-functions
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-member-expression-to-functions --dev
|
||||
```
|
||||
336
node_modules/@babel/helper-member-expression-to-functions/lib/index.js
generated
vendored
Normal file
336
node_modules/@babel/helper-member-expression-to-functions/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = memberExpressionToFunctions;
|
||||
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
class AssignmentMemoiser {
|
||||
constructor() {
|
||||
this._map = new WeakMap();
|
||||
}
|
||||
|
||||
has(key) {
|
||||
return this._map.has(key);
|
||||
}
|
||||
|
||||
get(key) {
|
||||
if (!this.has(key)) return;
|
||||
|
||||
const record = this._map.get(key);
|
||||
|
||||
const {
|
||||
value
|
||||
} = record;
|
||||
record.count--;
|
||||
|
||||
if (record.count === 0) {
|
||||
return t.assignmentExpression("=", value, key);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
set(key, value, count) {
|
||||
return this._map.set(key, {
|
||||
count,
|
||||
value
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function toNonOptional(path, base) {
|
||||
const {
|
||||
node
|
||||
} = path;
|
||||
|
||||
if (path.isOptionalMemberExpression()) {
|
||||
return t.memberExpression(base, node.property, node.computed);
|
||||
}
|
||||
|
||||
if (path.isOptionalCallExpression()) {
|
||||
const callee = path.get("callee");
|
||||
|
||||
if (path.node.optional && callee.isOptionalMemberExpression()) {
|
||||
const {
|
||||
object
|
||||
} = callee.node;
|
||||
const context = path.scope.maybeGenerateMemoised(object) || object;
|
||||
callee.get("object").replaceWith(t.assignmentExpression("=", context, object));
|
||||
return t.callExpression(t.memberExpression(base, t.identifier("call")), [context, ...node.arguments]);
|
||||
}
|
||||
|
||||
return t.callExpression(base, node.arguments);
|
||||
}
|
||||
|
||||
return path.node;
|
||||
}
|
||||
|
||||
function isInDetachedTree(path) {
|
||||
while (path) {
|
||||
if (path.isProgram()) break;
|
||||
const {
|
||||
parentPath,
|
||||
container,
|
||||
listKey
|
||||
} = path;
|
||||
const parentNode = parentPath.node;
|
||||
|
||||
if (listKey) {
|
||||
if (container !== parentNode[listKey]) return true;
|
||||
} else {
|
||||
if (container !== parentNode) return true;
|
||||
}
|
||||
|
||||
path = parentPath;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const handle = {
|
||||
memoise() {},
|
||||
|
||||
handle(member) {
|
||||
const {
|
||||
node,
|
||||
parent,
|
||||
parentPath
|
||||
} = member;
|
||||
|
||||
if (member.isOptionalMemberExpression()) {
|
||||
if (isInDetachedTree(member)) return;
|
||||
const endPath = member.find(({
|
||||
node,
|
||||
parent,
|
||||
parentPath
|
||||
}) => {
|
||||
if (parentPath.isOptionalMemberExpression()) {
|
||||
return parent.optional || parent.object !== node;
|
||||
}
|
||||
|
||||
if (parentPath.isOptionalCallExpression()) {
|
||||
return node !== member.node && parent.optional || parent.callee !== node;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
const rootParentPath = endPath.parentPath;
|
||||
|
||||
if (rootParentPath.isUpdateExpression({
|
||||
argument: node
|
||||
}) || rootParentPath.isAssignmentExpression({
|
||||
left: node
|
||||
})) {
|
||||
throw member.buildCodeFrameError(`can't handle assignment`);
|
||||
}
|
||||
|
||||
const isDeleteOperation = rootParentPath.isUnaryExpression({
|
||||
operator: "delete"
|
||||
});
|
||||
|
||||
if (isDeleteOperation && endPath.isOptionalMemberExpression() && endPath.get("property").isPrivateName()) {
|
||||
throw member.buildCodeFrameError(`can't delete a private class element`);
|
||||
}
|
||||
|
||||
let startingOptional = member;
|
||||
|
||||
for (;;) {
|
||||
if (startingOptional.isOptionalMemberExpression()) {
|
||||
if (startingOptional.node.optional) break;
|
||||
startingOptional = startingOptional.get("object");
|
||||
continue;
|
||||
} else if (startingOptional.isOptionalCallExpression()) {
|
||||
if (startingOptional.node.optional) break;
|
||||
startingOptional = startingOptional.get("callee");
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new Error(`Internal error: unexpected ${startingOptional.node.type}`);
|
||||
}
|
||||
|
||||
const {
|
||||
scope
|
||||
} = member;
|
||||
const startingProp = startingOptional.isOptionalMemberExpression() ? "object" : "callee";
|
||||
const startingNode = startingOptional.node[startingProp];
|
||||
const baseNeedsMemoised = scope.maybeGenerateMemoised(startingNode);
|
||||
const baseRef = baseNeedsMemoised != null ? baseNeedsMemoised : startingNode;
|
||||
const parentIsOptionalCall = parentPath.isOptionalCallExpression({
|
||||
callee: node
|
||||
});
|
||||
const parentIsCall = parentPath.isCallExpression({
|
||||
callee: node
|
||||
});
|
||||
startingOptional.replaceWith(toNonOptional(startingOptional, baseRef));
|
||||
|
||||
if (parentIsOptionalCall) {
|
||||
if (parent.optional) {
|
||||
parentPath.replaceWith(this.optionalCall(member, parent.arguments));
|
||||
} else {
|
||||
parentPath.replaceWith(this.call(member, parent.arguments));
|
||||
}
|
||||
} else if (parentIsCall) {
|
||||
member.replaceWith(this.boundGet(member));
|
||||
} else {
|
||||
member.replaceWith(this.get(member));
|
||||
}
|
||||
|
||||
let regular = member.node;
|
||||
|
||||
for (let current = member; current !== endPath;) {
|
||||
const {
|
||||
parentPath
|
||||
} = current;
|
||||
|
||||
if (parentPath === endPath && parentIsOptionalCall && parent.optional) {
|
||||
regular = parentPath.node;
|
||||
break;
|
||||
}
|
||||
|
||||
regular = toNonOptional(parentPath, regular);
|
||||
current = parentPath;
|
||||
}
|
||||
|
||||
let context;
|
||||
const endParentPath = endPath.parentPath;
|
||||
|
||||
if (t.isMemberExpression(regular) && endParentPath.isOptionalCallExpression({
|
||||
callee: endPath.node,
|
||||
optional: true
|
||||
})) {
|
||||
const {
|
||||
object
|
||||
} = regular;
|
||||
context = member.scope.maybeGenerateMemoised(object);
|
||||
|
||||
if (context) {
|
||||
regular.object = t.assignmentExpression("=", context, object);
|
||||
}
|
||||
}
|
||||
|
||||
let replacementPath = endPath;
|
||||
|
||||
if (isDeleteOperation) {
|
||||
replacementPath = endParentPath;
|
||||
regular = endParentPath.node;
|
||||
}
|
||||
|
||||
replacementPath.replaceWith(t.conditionalExpression(t.logicalExpression("||", t.binaryExpression("===", baseNeedsMemoised ? t.assignmentExpression("=", t.cloneNode(baseRef), t.cloneNode(startingNode)) : t.cloneNode(baseRef), t.nullLiteral()), t.binaryExpression("===", t.cloneNode(baseRef), scope.buildUndefinedNode())), isDeleteOperation ? t.booleanLiteral(true) : scope.buildUndefinedNode(), regular));
|
||||
|
||||
if (context) {
|
||||
const endParent = endParentPath.node;
|
||||
endParentPath.replaceWith(t.optionalCallExpression(t.optionalMemberExpression(endParent.callee, t.identifier("call"), false, true), [t.cloneNode(context), ...endParent.arguments], false));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (parentPath.isUpdateExpression({
|
||||
argument: node
|
||||
})) {
|
||||
if (this.simpleSet) {
|
||||
member.replaceWith(this.simpleSet(member));
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
operator,
|
||||
prefix
|
||||
} = parent;
|
||||
this.memoise(member, 2);
|
||||
const value = t.binaryExpression(operator[0], t.unaryExpression("+", this.get(member)), t.numericLiteral(1));
|
||||
|
||||
if (prefix) {
|
||||
parentPath.replaceWith(this.set(member, value));
|
||||
} else {
|
||||
const {
|
||||
scope
|
||||
} = member;
|
||||
const ref = scope.generateUidIdentifierBasedOnNode(node);
|
||||
scope.push({
|
||||
id: ref
|
||||
});
|
||||
value.left = t.assignmentExpression("=", t.cloneNode(ref), value.left);
|
||||
parentPath.replaceWith(t.sequenceExpression([this.set(member, value), t.cloneNode(ref)]));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (parentPath.isAssignmentExpression({
|
||||
left: node
|
||||
})) {
|
||||
if (this.simpleSet) {
|
||||
member.replaceWith(this.simpleSet(member));
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
operator,
|
||||
right: value
|
||||
} = parent;
|
||||
|
||||
if (operator === "=") {
|
||||
parentPath.replaceWith(this.set(member, value));
|
||||
} else {
|
||||
const operatorTrunc = operator.slice(0, -1);
|
||||
|
||||
if (t.LOGICAL_OPERATORS.includes(operatorTrunc)) {
|
||||
this.memoise(member, 1);
|
||||
parentPath.replaceWith(t.logicalExpression(operatorTrunc, this.get(member), this.set(member, value)));
|
||||
} else {
|
||||
this.memoise(member, 2);
|
||||
parentPath.replaceWith(this.set(member, t.binaryExpression(operatorTrunc, this.get(member), value)));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (parentPath.isCallExpression({
|
||||
callee: node
|
||||
})) {
|
||||
parentPath.replaceWith(this.call(member, parent.arguments));
|
||||
return;
|
||||
}
|
||||
|
||||
if (parentPath.isOptionalCallExpression({
|
||||
callee: node
|
||||
})) {
|
||||
parentPath.replaceWith(this.optionalCall(member, parent.arguments));
|
||||
return;
|
||||
}
|
||||
|
||||
if (parentPath.isForXStatement({
|
||||
left: node
|
||||
}) || parentPath.isObjectProperty({
|
||||
value: node
|
||||
}) && parentPath.parentPath.isObjectPattern() || parentPath.isAssignmentPattern({
|
||||
left: node
|
||||
}) && parentPath.parentPath.isObjectProperty({
|
||||
value: parent
|
||||
}) && parentPath.parentPath.parentPath.isObjectPattern() || parentPath.isArrayPattern() || parentPath.isAssignmentPattern({
|
||||
left: node
|
||||
}) && parentPath.parentPath.isArrayPattern() || parentPath.isRestElement()) {
|
||||
member.replaceWith(this.destructureSet(member));
|
||||
return;
|
||||
}
|
||||
|
||||
member.replaceWith(this.get(member));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function memberExpressionToFunctions(path, visitor, state) {
|
||||
path.traverse(visitor, Object.assign({}, handle, state, {
|
||||
memoiser: new AssignmentMemoiser()
|
||||
}));
|
||||
}
|
||||
52
node_modules/@babel/helper-member-expression-to-functions/package.json
generated
vendored
Normal file
52
node_modules/@babel/helper-member-expression-to-functions/package.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"_from": "@babel/helper-member-expression-to-functions@^7.10.4",
|
||||
"_id": "@babel/helper-member-expression-to-functions@7.11.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-JbFlKHFntRV5qKw3YC0CvQnDZ4XMwgzzBbld7Ly4Mj4cbFy3KywcR8NtNctRToMWJOVvLINJv525Gd6wwVEx/Q==",
|
||||
"_location": "/@babel/helper-member-expression-to-functions",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-member-expression-to-functions@^7.10.4",
|
||||
"name": "@babel/helper-member-expression-to-functions",
|
||||
"escapedName": "@babel%2fhelper-member-expression-to-functions",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/helper-replace-supers"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.11.0.tgz",
|
||||
"_shasum": "ae69c83d84ee82f4b42f96e2a09410935a8f26df",
|
||||
"_spec": "@babel/helper-member-expression-to-functions@^7.10.4",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/helper-replace-supers",
|
||||
"author": {
|
||||
"name": "Justin Ridgewell",
|
||||
"email": "justin@ridgewell.name"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.11.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper function to replace certain member expressions with function calls",
|
||||
"homepage": "https://github.com/babel/babel#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-member-expression-to-functions",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-member-expression-to-functions"
|
||||
},
|
||||
"version": "7.11.0"
|
||||
}
|
||||
22
node_modules/@babel/helper-module-imports/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-module-imports/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other 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.
|
||||
19
node_modules/@babel/helper-module-imports/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-module-imports/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-module-imports
|
||||
|
||||
> Babel helper functions for inserting module loads
|
||||
|
||||
See our website [@babel/helper-module-imports](https://babeljs.io/docs/en/next/babel-helper-module-imports.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-module-imports
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-module-imports --dev
|
||||
```
|
||||
139
node_modules/@babel/helper-module-imports/lib/import-builder.js
generated
vendored
Normal file
139
node_modules/@babel/helper-module-imports/lib/import-builder.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _assert = _interopRequireDefault(require("assert"));
|
||||
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class ImportBuilder {
|
||||
constructor(importedSource, scope, hub) {
|
||||
this._statements = [];
|
||||
this._resultName = null;
|
||||
this._scope = null;
|
||||
this._hub = null;
|
||||
this._scope = scope;
|
||||
this._hub = hub;
|
||||
this._importedSource = importedSource;
|
||||
}
|
||||
|
||||
done() {
|
||||
return {
|
||||
statements: this._statements,
|
||||
resultName: this._resultName
|
||||
};
|
||||
}
|
||||
|
||||
import() {
|
||||
this._statements.push(t.importDeclaration([], t.stringLiteral(this._importedSource)));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
require() {
|
||||
this._statements.push(t.expressionStatement(t.callExpression(t.identifier("require"), [t.stringLiteral(this._importedSource)])));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
namespace(name = "namespace") {
|
||||
name = this._scope.generateUidIdentifier(name);
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
(0, _assert.default)(statement.type === "ImportDeclaration");
|
||||
(0, _assert.default)(statement.specifiers.length === 0);
|
||||
statement.specifiers = [t.importNamespaceSpecifier(name)];
|
||||
this._resultName = t.cloneNode(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
default(name) {
|
||||
name = this._scope.generateUidIdentifier(name);
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
(0, _assert.default)(statement.type === "ImportDeclaration");
|
||||
(0, _assert.default)(statement.specifiers.length === 0);
|
||||
statement.specifiers = [t.importDefaultSpecifier(name)];
|
||||
this._resultName = t.cloneNode(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
named(name, importName) {
|
||||
if (importName === "default") return this.default(name);
|
||||
name = this._scope.generateUidIdentifier(name);
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
(0, _assert.default)(statement.type === "ImportDeclaration");
|
||||
(0, _assert.default)(statement.specifiers.length === 0);
|
||||
statement.specifiers = [t.importSpecifier(name, t.identifier(importName))];
|
||||
this._resultName = t.cloneNode(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
var(name) {
|
||||
name = this._scope.generateUidIdentifier(name);
|
||||
let statement = this._statements[this._statements.length - 1];
|
||||
|
||||
if (statement.type !== "ExpressionStatement") {
|
||||
(0, _assert.default)(this._resultName);
|
||||
statement = t.expressionStatement(this._resultName);
|
||||
|
||||
this._statements.push(statement);
|
||||
}
|
||||
|
||||
this._statements[this._statements.length - 1] = t.variableDeclaration("var", [t.variableDeclarator(name, statement.expression)]);
|
||||
this._resultName = t.cloneNode(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
defaultInterop() {
|
||||
return this._interop(this._hub.addHelper("interopRequireDefault"));
|
||||
}
|
||||
|
||||
wildcardInterop() {
|
||||
return this._interop(this._hub.addHelper("interopRequireWildcard"));
|
||||
}
|
||||
|
||||
_interop(callee) {
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
|
||||
if (statement.type === "ExpressionStatement") {
|
||||
statement.expression = t.callExpression(callee, [statement.expression]);
|
||||
} else if (statement.type === "VariableDeclaration") {
|
||||
(0, _assert.default)(statement.declarations.length === 1);
|
||||
statement.declarations[0].init = t.callExpression(callee, [statement.declarations[0].init]);
|
||||
} else {
|
||||
_assert.default.fail("Unexpected type.");
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
prop(name) {
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
|
||||
if (statement.type === "ExpressionStatement") {
|
||||
statement.expression = t.memberExpression(statement.expression, t.identifier(name));
|
||||
} else if (statement.type === "VariableDeclaration") {
|
||||
(0, _assert.default)(statement.declarations.length === 1);
|
||||
statement.declarations[0].init = t.memberExpression(statement.declarations[0].init, t.identifier(name));
|
||||
} else {
|
||||
_assert.default.fail("Unexpected type:" + statement.type);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
read(name) {
|
||||
this._resultName = t.memberExpression(this._resultName, t.identifier(name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ImportBuilder;
|
||||
271
node_modules/@babel/helper-module-imports/lib/import-injector.js
generated
vendored
Normal file
271
node_modules/@babel/helper-module-imports/lib/import-injector.js
generated
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _assert = _interopRequireDefault(require("assert"));
|
||||
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _importBuilder = _interopRequireDefault(require("./import-builder"));
|
||||
|
||||
var _isModule = _interopRequireDefault(require("./is-module"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class ImportInjector {
|
||||
constructor(path, importedSource, opts) {
|
||||
this._defaultOpts = {
|
||||
importedSource: null,
|
||||
importedType: "commonjs",
|
||||
importedInterop: "babel",
|
||||
importingInterop: "babel",
|
||||
ensureLiveReference: false,
|
||||
ensureNoContext: false
|
||||
};
|
||||
const programPath = path.find(p => p.isProgram());
|
||||
this._programPath = programPath;
|
||||
this._programScope = programPath.scope;
|
||||
this._hub = programPath.hub;
|
||||
this._defaultOpts = this._applyDefaults(importedSource, opts, true);
|
||||
}
|
||||
|
||||
addDefault(importedSourceIn, opts) {
|
||||
return this.addNamed("default", importedSourceIn, opts);
|
||||
}
|
||||
|
||||
addNamed(importName, importedSourceIn, opts) {
|
||||
(0, _assert.default)(typeof importName === "string");
|
||||
return this._generateImport(this._applyDefaults(importedSourceIn, opts), importName);
|
||||
}
|
||||
|
||||
addNamespace(importedSourceIn, opts) {
|
||||
return this._generateImport(this._applyDefaults(importedSourceIn, opts), null);
|
||||
}
|
||||
|
||||
addSideEffect(importedSourceIn, opts) {
|
||||
return this._generateImport(this._applyDefaults(importedSourceIn, opts), false);
|
||||
}
|
||||
|
||||
_applyDefaults(importedSource, opts, isInit = false) {
|
||||
const optsList = [];
|
||||
|
||||
if (typeof importedSource === "string") {
|
||||
optsList.push({
|
||||
importedSource
|
||||
});
|
||||
optsList.push(opts);
|
||||
} else {
|
||||
(0, _assert.default)(!opts, "Unexpected secondary arguments.");
|
||||
optsList.push(importedSource);
|
||||
}
|
||||
|
||||
const newOpts = Object.assign({}, this._defaultOpts);
|
||||
|
||||
for (const opts of optsList) {
|
||||
if (!opts) continue;
|
||||
Object.keys(newOpts).forEach(key => {
|
||||
if (opts[key] !== undefined) newOpts[key] = opts[key];
|
||||
});
|
||||
|
||||
if (!isInit) {
|
||||
if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint;
|
||||
if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist;
|
||||
}
|
||||
}
|
||||
|
||||
return newOpts;
|
||||
}
|
||||
|
||||
_generateImport(opts, importName) {
|
||||
const isDefault = importName === "default";
|
||||
const isNamed = !!importName && !isDefault;
|
||||
const isNamespace = importName === null;
|
||||
const {
|
||||
importedSource,
|
||||
importedType,
|
||||
importedInterop,
|
||||
importingInterop,
|
||||
ensureLiveReference,
|
||||
ensureNoContext,
|
||||
nameHint,
|
||||
blockHoist
|
||||
} = opts;
|
||||
let name = nameHint || importName;
|
||||
const isMod = (0, _isModule.default)(this._programPath);
|
||||
const isModuleForNode = isMod && importingInterop === "node";
|
||||
const isModuleForBabel = isMod && importingInterop === "babel";
|
||||
const builder = new _importBuilder.default(importedSource, this._programScope, this._hub);
|
||||
|
||||
if (importedType === "es6") {
|
||||
if (!isModuleForNode && !isModuleForBabel) {
|
||||
throw new Error("Cannot import an ES6 module from CommonJS");
|
||||
}
|
||||
|
||||
builder.import();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.namespace(nameHint || importedSource);
|
||||
} else if (isDefault || isNamed) {
|
||||
builder.named(name, importName);
|
||||
}
|
||||
} else if (importedType !== "commonjs") {
|
||||
throw new Error(`Unexpected interopType "${importedType}"`);
|
||||
} else if (importedInterop === "babel") {
|
||||
if (isModuleForNode) {
|
||||
name = name !== "default" ? name : importedSource;
|
||||
const es6Default = `${importedSource}$es6Default`;
|
||||
builder.import();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.default(es6Default).var(name || importedSource).wildcardInterop();
|
||||
} else if (isDefault) {
|
||||
if (ensureLiveReference) {
|
||||
builder.default(es6Default).var(name || importedSource).defaultInterop().read("default");
|
||||
} else {
|
||||
builder.default(es6Default).var(name).defaultInterop().prop(importName);
|
||||
}
|
||||
} else if (isNamed) {
|
||||
builder.default(es6Default).read(importName);
|
||||
}
|
||||
} else if (isModuleForBabel) {
|
||||
builder.import();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.namespace(name || importedSource);
|
||||
} else if (isDefault || isNamed) {
|
||||
builder.named(name, importName);
|
||||
}
|
||||
} else {
|
||||
builder.require();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.var(name || importedSource).wildcardInterop();
|
||||
} else if ((isDefault || isNamed) && ensureLiveReference) {
|
||||
if (isDefault) {
|
||||
name = name !== "default" ? name : importedSource;
|
||||
builder.var(name).read(importName);
|
||||
builder.defaultInterop();
|
||||
} else {
|
||||
builder.var(importedSource).read(importName);
|
||||
}
|
||||
} else if (isDefault) {
|
||||
builder.var(name).defaultInterop().prop(importName);
|
||||
} else if (isNamed) {
|
||||
builder.var(name).prop(importName);
|
||||
}
|
||||
}
|
||||
} else if (importedInterop === "compiled") {
|
||||
if (isModuleForNode) {
|
||||
builder.import();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.default(name || importedSource);
|
||||
} else if (isDefault || isNamed) {
|
||||
builder.default(importedSource).read(name);
|
||||
}
|
||||
} else if (isModuleForBabel) {
|
||||
builder.import();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.namespace(name || importedSource);
|
||||
} else if (isDefault || isNamed) {
|
||||
builder.named(name, importName);
|
||||
}
|
||||
} else {
|
||||
builder.require();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.var(name || importedSource);
|
||||
} else if (isDefault || isNamed) {
|
||||
if (ensureLiveReference) {
|
||||
builder.var(importedSource).read(name);
|
||||
} else {
|
||||
builder.prop(importName).var(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (importedInterop === "uncompiled") {
|
||||
if (isDefault && ensureLiveReference) {
|
||||
throw new Error("No live reference for commonjs default");
|
||||
}
|
||||
|
||||
if (isModuleForNode) {
|
||||
builder.import();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.default(name || importedSource);
|
||||
} else if (isDefault) {
|
||||
builder.default(name);
|
||||
} else if (isNamed) {
|
||||
builder.default(importedSource).read(name);
|
||||
}
|
||||
} else if (isModuleForBabel) {
|
||||
builder.import();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.default(name || importedSource);
|
||||
} else if (isDefault) {
|
||||
builder.default(name);
|
||||
} else if (isNamed) {
|
||||
builder.named(name, importName);
|
||||
}
|
||||
} else {
|
||||
builder.require();
|
||||
|
||||
if (isNamespace) {
|
||||
builder.var(name || importedSource);
|
||||
} else if (isDefault) {
|
||||
builder.var(name);
|
||||
} else if (isNamed) {
|
||||
if (ensureLiveReference) {
|
||||
builder.var(importedSource).read(name);
|
||||
} else {
|
||||
builder.var(name).prop(importName);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Error(`Unknown importedInterop "${importedInterop}".`);
|
||||
}
|
||||
|
||||
const {
|
||||
statements,
|
||||
resultName
|
||||
} = builder.done();
|
||||
|
||||
this._insertStatements(statements, blockHoist);
|
||||
|
||||
if ((isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier") {
|
||||
return t.sequenceExpression([t.numericLiteral(0), resultName]);
|
||||
}
|
||||
|
||||
return resultName;
|
||||
}
|
||||
|
||||
_insertStatements(statements, blockHoist = 3) {
|
||||
statements.forEach(node => {
|
||||
node._blockHoist = blockHoist;
|
||||
});
|
||||
|
||||
const targetPath = this._programPath.get("body").find(p => {
|
||||
const val = p.node._blockHoist;
|
||||
return Number.isFinite(val) && val < 4;
|
||||
});
|
||||
|
||||
if (targetPath) {
|
||||
targetPath.insertBefore(statements);
|
||||
} else {
|
||||
this._programPath.unshiftContainer("body", statements);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ImportInjector;
|
||||
43
node_modules/@babel/helper-module-imports/lib/index.js
generated
vendored
Normal file
43
node_modules/@babel/helper-module-imports/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.addDefault = addDefault;
|
||||
exports.addNamed = addNamed;
|
||||
exports.addNamespace = addNamespace;
|
||||
exports.addSideEffect = addSideEffect;
|
||||
Object.defineProperty(exports, "ImportInjector", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _importInjector.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isModule", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _isModule.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _importInjector = _interopRequireDefault(require("./import-injector"));
|
||||
|
||||
var _isModule = _interopRequireDefault(require("./is-module"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function addDefault(path, importedSource, opts) {
|
||||
return new _importInjector.default(path).addDefault(importedSource, opts);
|
||||
}
|
||||
|
||||
function addNamed(path, name, importedSource, opts) {
|
||||
return new _importInjector.default(path).addNamed(name, importedSource, opts);
|
||||
}
|
||||
|
||||
function addNamespace(path, importedSource, opts) {
|
||||
return new _importInjector.default(path).addNamespace(importedSource, opts);
|
||||
}
|
||||
|
||||
function addSideEffect(path, importedSource, opts) {
|
||||
return new _importInjector.default(path).addSideEffect(importedSource, opts);
|
||||
}
|
||||
18
node_modules/@babel/helper-module-imports/lib/is-module.js
generated
vendored
Normal file
18
node_modules/@babel/helper-module-imports/lib/is-module.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isModule;
|
||||
|
||||
function isModule(path) {
|
||||
const {
|
||||
sourceType
|
||||
} = path.node;
|
||||
|
||||
if (sourceType !== "module" && sourceType !== "script") {
|
||||
throw path.buildCodeFrameError(`Unknown sourceType "${sourceType}", cannot transform.`);
|
||||
}
|
||||
|
||||
return path.node.sourceType === "module";
|
||||
}
|
||||
56
node_modules/@babel/helper-module-imports/package.json
generated
vendored
Normal file
56
node_modules/@babel/helper-module-imports/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"_from": "@babel/helper-module-imports@^7.10.4",
|
||||
"_id": "@babel/helper-module-imports@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==",
|
||||
"_location": "/@babel/helper-module-imports",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-module-imports@^7.10.4",
|
||||
"name": "@babel/helper-module-imports",
|
||||
"escapedName": "@babel%2fhelper-module-imports",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/helper-module-transforms"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz",
|
||||
"_shasum": "4c5c54be04bd31670a7382797d75b9fa2e5b5620",
|
||||
"_spec": "@babel/helper-module-imports@^7.10.4",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/helper-module-transforms",
|
||||
"author": {
|
||||
"name": "Logan Smyth",
|
||||
"email": "loganfsmyth@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.10.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Babel helper functions for inserting module loads",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.10.4"
|
||||
},
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-module-imports",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-module-imports"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
}
|
||||
22
node_modules/@babel/helper-module-transforms/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-module-transforms/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other 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.
|
||||
19
node_modules/@babel/helper-module-transforms/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-module-transforms/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-module-transforms
|
||||
|
||||
> Babel helper functions for implementing ES6 module transformations
|
||||
|
||||
See our website [@babel/helper-module-transforms](https://babeljs.io/docs/en/next/babel-helper-module-transforms.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-module-transforms
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-module-transforms --dev
|
||||
```
|
||||
42
node_modules/@babel/helper-module-transforms/lib/get-module-name.js
generated
vendored
Normal file
42
node_modules/@babel/helper-module-transforms/lib/get-module-name.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getModuleName;
|
||||
|
||||
function getModuleName(rootOpts, pluginOpts) {
|
||||
var _pluginOpts$moduleRoo, _rootOpts$moduleIds, _rootOpts$moduleRoot;
|
||||
|
||||
const {
|
||||
filename,
|
||||
filenameRelative = filename,
|
||||
sourceRoot = (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
|
||||
} = rootOpts;
|
||||
const {
|
||||
moduleId = rootOpts.moduleId,
|
||||
moduleIds = (_rootOpts$moduleIds = rootOpts.moduleIds) != null ? _rootOpts$moduleIds : !!moduleId,
|
||||
getModuleId = rootOpts.getModuleId,
|
||||
moduleRoot = (_rootOpts$moduleRoot = rootOpts.moduleRoot) != null ? _rootOpts$moduleRoot : sourceRoot
|
||||
} = pluginOpts;
|
||||
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;
|
||||
}
|
||||
}
|
||||
316
node_modules/@babel/helper-module-transforms/lib/index.js
generated
vendored
Normal file
316
node_modules/@babel/helper-module-transforms/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,316 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.rewriteModuleStatementsAndPrepareHeader = rewriteModuleStatementsAndPrepareHeader;
|
||||
exports.ensureStatementsHoisted = ensureStatementsHoisted;
|
||||
exports.wrapInterop = wrapInterop;
|
||||
exports.buildNamespaceInitStatements = buildNamespaceInitStatements;
|
||||
Object.defineProperty(exports, "isModule", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperModuleImports.isModule;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "rewriteThis", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _rewriteThis.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "hasExports", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _normalizeAndLoadMetadata.hasExports;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isSideEffectImport", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _normalizeAndLoadMetadata.isSideEffectImport;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getModuleName", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _getModuleName.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _assert = _interopRequireDefault(require("assert"));
|
||||
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _template = _interopRequireDefault(require("@babel/template"));
|
||||
|
||||
var _chunk = _interopRequireDefault(require("lodash/chunk"));
|
||||
|
||||
var _helperModuleImports = require("@babel/helper-module-imports");
|
||||
|
||||
var _rewriteThis = _interopRequireDefault(require("./rewrite-this"));
|
||||
|
||||
var _rewriteLiveReferences = _interopRequireDefault(require("./rewrite-live-references"));
|
||||
|
||||
var _normalizeAndLoadMetadata = _interopRequireWildcard(require("./normalize-and-load-metadata"));
|
||||
|
||||
var _getModuleName = _interopRequireDefault(require("./get-module-name"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function rewriteModuleStatementsAndPrepareHeader(path, {
|
||||
exportName,
|
||||
strict,
|
||||
allowTopLevelThis,
|
||||
strictMode,
|
||||
loose,
|
||||
noInterop,
|
||||
lazy,
|
||||
esNamespaceOnly
|
||||
}) {
|
||||
(0, _assert.default)((0, _helperModuleImports.isModule)(path), "Cannot process module statements in a script");
|
||||
path.node.sourceType = "script";
|
||||
const meta = (0, _normalizeAndLoadMetadata.default)(path, exportName, {
|
||||
noInterop,
|
||||
loose,
|
||||
lazy,
|
||||
esNamespaceOnly
|
||||
});
|
||||
|
||||
if (!allowTopLevelThis) {
|
||||
(0, _rewriteThis.default)(path);
|
||||
}
|
||||
|
||||
(0, _rewriteLiveReferences.default)(path, meta);
|
||||
|
||||
if (strictMode !== false) {
|
||||
const hasStrict = path.node.directives.some(directive => {
|
||||
return directive.value.value === "use strict";
|
||||
});
|
||||
|
||||
if (!hasStrict) {
|
||||
path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict")));
|
||||
}
|
||||
}
|
||||
|
||||
const headers = [];
|
||||
|
||||
if ((0, _normalizeAndLoadMetadata.hasExports)(meta) && !strict) {
|
||||
headers.push(buildESModuleHeader(meta, loose));
|
||||
}
|
||||
|
||||
const nameList = buildExportNameListDeclaration(path, meta);
|
||||
|
||||
if (nameList) {
|
||||
meta.exportNameListName = nameList.name;
|
||||
headers.push(nameList.statement);
|
||||
}
|
||||
|
||||
headers.push(...buildExportInitializationStatements(path, meta, loose));
|
||||
return {
|
||||
meta,
|
||||
headers
|
||||
};
|
||||
}
|
||||
|
||||
function ensureStatementsHoisted(statements) {
|
||||
statements.forEach(header => {
|
||||
header._blockHoist = 3;
|
||||
});
|
||||
}
|
||||
|
||||
function wrapInterop(programPath, expr, type) {
|
||||
if (type === "none") {
|
||||
return null;
|
||||
}
|
||||
|
||||
let helper;
|
||||
|
||||
if (type === "default") {
|
||||
helper = "interopRequireDefault";
|
||||
} else if (type === "namespace") {
|
||||
helper = "interopRequireWildcard";
|
||||
} else {
|
||||
throw new Error(`Unknown interop: ${type}`);
|
||||
}
|
||||
|
||||
return t.callExpression(programPath.hub.addHelper(helper), [expr]);
|
||||
}
|
||||
|
||||
function buildNamespaceInitStatements(metadata, sourceMetadata, loose = false) {
|
||||
const statements = [];
|
||||
let srcNamespace = t.identifier(sourceMetadata.name);
|
||||
if (sourceMetadata.lazy) srcNamespace = t.callExpression(srcNamespace, []);
|
||||
|
||||
for (const localName of sourceMetadata.importsNamespace) {
|
||||
if (localName === sourceMetadata.name) continue;
|
||||
statements.push(_template.default.statement`var NAME = SOURCE;`({
|
||||
NAME: localName,
|
||||
SOURCE: t.cloneNode(srcNamespace)
|
||||
}));
|
||||
}
|
||||
|
||||
if (loose) {
|
||||
statements.push(...buildReexportsFromMeta(metadata, sourceMetadata, loose));
|
||||
}
|
||||
|
||||
for (const exportName of sourceMetadata.reexportNamespace) {
|
||||
statements.push((sourceMetadata.lazy ? _template.default.statement`
|
||||
Object.defineProperty(EXPORTS, "NAME", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return NAMESPACE;
|
||||
}
|
||||
});
|
||||
` : _template.default.statement`EXPORTS.NAME = NAMESPACE;`)({
|
||||
EXPORTS: metadata.exportName,
|
||||
NAME: exportName,
|
||||
NAMESPACE: t.cloneNode(srcNamespace)
|
||||
}));
|
||||
}
|
||||
|
||||
if (sourceMetadata.reexportAll) {
|
||||
const statement = buildNamespaceReexport(metadata, t.cloneNode(srcNamespace), loose);
|
||||
statement.loc = sourceMetadata.reexportAll.loc;
|
||||
statements.push(statement);
|
||||
}
|
||||
|
||||
return statements;
|
||||
}
|
||||
|
||||
const getTemplateForReexport = loose => {
|
||||
return loose ? _template.default.statement`EXPORTS.EXPORT_NAME = NAMESPACE.IMPORT_NAME;` : (0, _template.default)`
|
||||
Object.defineProperty(EXPORTS, "EXPORT_NAME", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return NAMESPACE.IMPORT_NAME;
|
||||
},
|
||||
});
|
||||
`;
|
||||
};
|
||||
|
||||
const buildReexportsFromMeta = (meta, metadata, loose) => {
|
||||
const namespace = metadata.lazy ? t.callExpression(t.identifier(metadata.name), []) : t.identifier(metadata.name);
|
||||
const templateForCurrentMode = getTemplateForReexport(loose);
|
||||
return Array.from(metadata.reexports, ([exportName, importName]) => templateForCurrentMode({
|
||||
EXPORTS: meta.exportName,
|
||||
EXPORT_NAME: exportName,
|
||||
NAMESPACE: t.cloneNode(namespace),
|
||||
IMPORT_NAME: importName
|
||||
}));
|
||||
};
|
||||
|
||||
function buildESModuleHeader(metadata, enumerable = false) {
|
||||
return (enumerable ? _template.default.statement`
|
||||
EXPORTS.__esModule = true;
|
||||
` : _template.default.statement`
|
||||
Object.defineProperty(EXPORTS, "__esModule", {
|
||||
value: true,
|
||||
});
|
||||
`)({
|
||||
EXPORTS: metadata.exportName
|
||||
});
|
||||
}
|
||||
|
||||
function buildNamespaceReexport(metadata, namespace, loose) {
|
||||
return (loose ? _template.default.statement`
|
||||
Object.keys(NAMESPACE).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
VERIFY_NAME_LIST;
|
||||
|
||||
EXPORTS[key] = NAMESPACE[key];
|
||||
});
|
||||
` : _template.default.statement`
|
||||
Object.keys(NAMESPACE).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
VERIFY_NAME_LIST;
|
||||
|
||||
Object.defineProperty(EXPORTS, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return NAMESPACE[key];
|
||||
},
|
||||
});
|
||||
});
|
||||
`)({
|
||||
NAMESPACE: namespace,
|
||||
EXPORTS: metadata.exportName,
|
||||
VERIFY_NAME_LIST: metadata.exportNameListName ? (0, _template.default)`
|
||||
if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return;
|
||||
`({
|
||||
EXPORTS_LIST: metadata.exportNameListName
|
||||
}) : null
|
||||
});
|
||||
}
|
||||
|
||||
function buildExportNameListDeclaration(programPath, metadata) {
|
||||
const exportedVars = Object.create(null);
|
||||
|
||||
for (const data of metadata.local.values()) {
|
||||
for (const name of data.names) {
|
||||
exportedVars[name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
let hasReexport = false;
|
||||
|
||||
for (const data of metadata.source.values()) {
|
||||
for (const exportName of data.reexports.keys()) {
|
||||
exportedVars[exportName] = true;
|
||||
}
|
||||
|
||||
for (const exportName of data.reexportNamespace) {
|
||||
exportedVars[exportName] = true;
|
||||
}
|
||||
|
||||
hasReexport = hasReexport || data.reexportAll;
|
||||
}
|
||||
|
||||
if (!hasReexport || Object.keys(exportedVars).length === 0) return null;
|
||||
const name = programPath.scope.generateUidIdentifier("exportNames");
|
||||
delete exportedVars.default;
|
||||
return {
|
||||
name: name.name,
|
||||
statement: t.variableDeclaration("var", [t.variableDeclarator(name, t.valueToNode(exportedVars))])
|
||||
};
|
||||
}
|
||||
|
||||
function buildExportInitializationStatements(programPath, metadata, loose = false) {
|
||||
const initStatements = [];
|
||||
const exportNames = [];
|
||||
|
||||
for (const [localName, data] of metadata.local) {
|
||||
if (data.kind === "import") {} else if (data.kind === "hoisted") {
|
||||
initStatements.push(buildInitStatement(metadata, data.names, t.identifier(localName)));
|
||||
} else {
|
||||
exportNames.push(...data.names);
|
||||
}
|
||||
}
|
||||
|
||||
for (const data of metadata.source.values()) {
|
||||
if (!loose) {
|
||||
initStatements.push(...buildReexportsFromMeta(metadata, data, loose));
|
||||
}
|
||||
|
||||
for (const exportName of data.reexportNamespace) {
|
||||
exportNames.push(exportName);
|
||||
}
|
||||
}
|
||||
|
||||
initStatements.push(...(0, _chunk.default)(exportNames, 100).map(members => {
|
||||
return buildInitStatement(metadata, members, programPath.scope.buildUndefinedNode());
|
||||
}));
|
||||
return initStatements;
|
||||
}
|
||||
|
||||
function buildInitStatement(metadata, exportNames, initExpr) {
|
||||
return t.expressionStatement(exportNames.reduce((acc, exportName) => _template.default.expression`EXPORTS.NAME = VALUE`({
|
||||
EXPORTS: metadata.exportName,
|
||||
NAME: exportName,
|
||||
VALUE: acc
|
||||
}), initExpr));
|
||||
}
|
||||
346
node_modules/@babel/helper-module-transforms/lib/normalize-and-load-metadata.js
generated
vendored
Normal file
346
node_modules/@babel/helper-module-transforms/lib/normalize-and-load-metadata.js
generated
vendored
Normal file
@@ -0,0 +1,346 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.hasExports = hasExports;
|
||||
exports.isSideEffectImport = isSideEffectImport;
|
||||
exports.default = normalizeModuleAndLoadMetadata;
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _helperSplitExportDeclaration = _interopRequireDefault(require("@babel/helper-split-export-declaration"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function hasExports(metadata) {
|
||||
return metadata.hasExports;
|
||||
}
|
||||
|
||||
function isSideEffectImport(source) {
|
||||
return source.imports.size === 0 && source.importsNamespace.size === 0 && source.reexports.size === 0 && source.reexportNamespace.size === 0 && !source.reexportAll;
|
||||
}
|
||||
|
||||
function normalizeModuleAndLoadMetadata(programPath, exportName, {
|
||||
noInterop = false,
|
||||
loose = false,
|
||||
lazy = false,
|
||||
esNamespaceOnly = false
|
||||
} = {}) {
|
||||
if (!exportName) {
|
||||
exportName = programPath.scope.generateUidIdentifier("exports").name;
|
||||
}
|
||||
|
||||
nameAnonymousExports(programPath);
|
||||
const {
|
||||
local,
|
||||
source,
|
||||
hasExports
|
||||
} = getModuleMetadata(programPath, {
|
||||
loose,
|
||||
lazy
|
||||
});
|
||||
removeModuleDeclarations(programPath);
|
||||
|
||||
for (const [, metadata] of source) {
|
||||
if (metadata.importsNamespace.size > 0) {
|
||||
metadata.name = metadata.importsNamespace.values().next().value;
|
||||
}
|
||||
|
||||
if (noInterop) metadata.interop = "none";else if (esNamespaceOnly) {
|
||||
if (metadata.interop === "namespace") {
|
||||
metadata.interop = "default";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
exportName,
|
||||
exportNameListName: null,
|
||||
hasExports,
|
||||
local,
|
||||
source
|
||||
};
|
||||
}
|
||||
|
||||
function getModuleMetadata(programPath, {
|
||||
loose,
|
||||
lazy
|
||||
}) {
|
||||
const localData = getLocalExportMetadata(programPath, loose);
|
||||
const sourceData = new Map();
|
||||
|
||||
const getData = sourceNode => {
|
||||
const source = sourceNode.value;
|
||||
let data = sourceData.get(source);
|
||||
|
||||
if (!data) {
|
||||
data = {
|
||||
name: programPath.scope.generateUidIdentifier((0, _path.basename)(source, (0, _path.extname)(source))).name,
|
||||
interop: "none",
|
||||
loc: null,
|
||||
imports: new Map(),
|
||||
importsNamespace: new Set(),
|
||||
reexports: new Map(),
|
||||
reexportNamespace: new Set(),
|
||||
reexportAll: null,
|
||||
lazy: false
|
||||
};
|
||||
sourceData.set(source, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
let hasExports = false;
|
||||
programPath.get("body").forEach(child => {
|
||||
if (child.isImportDeclaration()) {
|
||||
const data = getData(child.node.source);
|
||||
if (!data.loc) data.loc = child.node.loc;
|
||||
child.get("specifiers").forEach(spec => {
|
||||
if (spec.isImportDefaultSpecifier()) {
|
||||
const localName = spec.get("local").node.name;
|
||||
data.imports.set(localName, "default");
|
||||
const reexport = localData.get(localName);
|
||||
|
||||
if (reexport) {
|
||||
localData.delete(localName);
|
||||
reexport.names.forEach(name => {
|
||||
data.reexports.set(name, "default");
|
||||
});
|
||||
}
|
||||
} else if (spec.isImportNamespaceSpecifier()) {
|
||||
const localName = spec.get("local").node.name;
|
||||
data.importsNamespace.add(localName);
|
||||
const reexport = localData.get(localName);
|
||||
|
||||
if (reexport) {
|
||||
localData.delete(localName);
|
||||
reexport.names.forEach(name => {
|
||||
data.reexportNamespace.add(name);
|
||||
});
|
||||
}
|
||||
} else if (spec.isImportSpecifier()) {
|
||||
const importName = spec.get("imported").node.name;
|
||||
const localName = spec.get("local").node.name;
|
||||
data.imports.set(localName, importName);
|
||||
const reexport = localData.get(localName);
|
||||
|
||||
if (reexport) {
|
||||
localData.delete(localName);
|
||||
reexport.names.forEach(name => {
|
||||
data.reexports.set(name, importName);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (child.isExportAllDeclaration()) {
|
||||
hasExports = true;
|
||||
const data = getData(child.node.source);
|
||||
if (!data.loc) data.loc = child.node.loc;
|
||||
data.reexportAll = {
|
||||
loc: child.node.loc
|
||||
};
|
||||
} else if (child.isExportNamedDeclaration() && child.node.source) {
|
||||
hasExports = true;
|
||||
const data = getData(child.node.source);
|
||||
if (!data.loc) data.loc = child.node.loc;
|
||||
child.get("specifiers").forEach(spec => {
|
||||
if (!spec.isExportSpecifier()) {
|
||||
throw spec.buildCodeFrameError("Unexpected export specifier type");
|
||||
}
|
||||
|
||||
const importName = spec.get("local").node.name;
|
||||
const exportName = spec.get("exported").node.name;
|
||||
data.reexports.set(exportName, importName);
|
||||
|
||||
if (exportName === "__esModule") {
|
||||
throw exportName.buildCodeFrameError('Illegal export "__esModule".');
|
||||
}
|
||||
});
|
||||
} else if (child.isExportNamedDeclaration() || child.isExportDefaultDeclaration()) {
|
||||
hasExports = true;
|
||||
}
|
||||
});
|
||||
|
||||
for (const metadata of sourceData.values()) {
|
||||
let needsDefault = false;
|
||||
let needsNamed = false;
|
||||
|
||||
if (metadata.importsNamespace.size > 0) {
|
||||
needsDefault = true;
|
||||
needsNamed = true;
|
||||
}
|
||||
|
||||
if (metadata.reexportAll) {
|
||||
needsNamed = true;
|
||||
}
|
||||
|
||||
for (const importName of metadata.imports.values()) {
|
||||
if (importName === "default") needsDefault = true;else needsNamed = true;
|
||||
}
|
||||
|
||||
for (const importName of metadata.reexports.values()) {
|
||||
if (importName === "default") needsDefault = true;else needsNamed = true;
|
||||
}
|
||||
|
||||
if (needsDefault && needsNamed) {
|
||||
metadata.interop = "namespace";
|
||||
} else if (needsDefault) {
|
||||
metadata.interop = "default";
|
||||
}
|
||||
}
|
||||
|
||||
for (const [source, metadata] of sourceData) {
|
||||
if (lazy !== false && !(isSideEffectImport(metadata) || metadata.reexportAll)) {
|
||||
if (lazy === true) {
|
||||
metadata.lazy = !/\./.test(source);
|
||||
} else if (Array.isArray(lazy)) {
|
||||
metadata.lazy = lazy.indexOf(source) !== -1;
|
||||
} else if (typeof lazy === "function") {
|
||||
metadata.lazy = lazy(source);
|
||||
} else {
|
||||
throw new Error(`.lazy must be a boolean, string array, or function`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
hasExports,
|
||||
local: localData,
|
||||
source: sourceData
|
||||
};
|
||||
}
|
||||
|
||||
function getLocalExportMetadata(programPath, loose) {
|
||||
const bindingKindLookup = new Map();
|
||||
programPath.get("body").forEach(child => {
|
||||
let kind;
|
||||
|
||||
if (child.isImportDeclaration()) {
|
||||
kind = "import";
|
||||
} else {
|
||||
if (child.isExportDefaultDeclaration()) child = child.get("declaration");
|
||||
|
||||
if (child.isExportNamedDeclaration()) {
|
||||
if (child.node.declaration) {
|
||||
child = child.get("declaration");
|
||||
} else if (loose && child.node.source && child.get("source").isStringLiteral()) {
|
||||
child.node.specifiers.forEach(specifier => {
|
||||
bindingKindLookup.set(specifier.local.name, "block");
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (child.isFunctionDeclaration()) {
|
||||
kind = "hoisted";
|
||||
} else if (child.isClassDeclaration()) {
|
||||
kind = "block";
|
||||
} else if (child.isVariableDeclaration({
|
||||
kind: "var"
|
||||
})) {
|
||||
kind = "var";
|
||||
} else if (child.isVariableDeclaration()) {
|
||||
kind = "block";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(child.getOuterBindingIdentifiers()).forEach(name => {
|
||||
bindingKindLookup.set(name, kind);
|
||||
});
|
||||
});
|
||||
const localMetadata = new Map();
|
||||
|
||||
const getLocalMetadata = idPath => {
|
||||
const localName = idPath.node.name;
|
||||
let metadata = localMetadata.get(localName);
|
||||
|
||||
if (!metadata) {
|
||||
const kind = bindingKindLookup.get(localName);
|
||||
|
||||
if (kind === undefined) {
|
||||
throw idPath.buildCodeFrameError(`Exporting local "${localName}", which is not declared.`);
|
||||
}
|
||||
|
||||
metadata = {
|
||||
names: [],
|
||||
kind
|
||||
};
|
||||
localMetadata.set(localName, metadata);
|
||||
}
|
||||
|
||||
return metadata;
|
||||
};
|
||||
|
||||
programPath.get("body").forEach(child => {
|
||||
if (child.isExportNamedDeclaration() && (loose || !child.node.source)) {
|
||||
if (child.node.declaration) {
|
||||
const declaration = child.get("declaration");
|
||||
const ids = declaration.getOuterBindingIdentifierPaths();
|
||||
Object.keys(ids).forEach(name => {
|
||||
if (name === "__esModule") {
|
||||
throw declaration.buildCodeFrameError('Illegal export "__esModule".');
|
||||
}
|
||||
|
||||
getLocalMetadata(ids[name]).names.push(name);
|
||||
});
|
||||
} else {
|
||||
child.get("specifiers").forEach(spec => {
|
||||
const local = spec.get("local");
|
||||
const exported = spec.get("exported");
|
||||
|
||||
if (exported.node.name === "__esModule") {
|
||||
throw exported.buildCodeFrameError('Illegal export "__esModule".');
|
||||
}
|
||||
|
||||
getLocalMetadata(local).names.push(exported.node.name);
|
||||
});
|
||||
}
|
||||
} else if (child.isExportDefaultDeclaration()) {
|
||||
const declaration = child.get("declaration");
|
||||
|
||||
if (declaration.isFunctionDeclaration() || declaration.isClassDeclaration()) {
|
||||
getLocalMetadata(declaration.get("id")).names.push("default");
|
||||
} else {
|
||||
throw declaration.buildCodeFrameError("Unexpected default expression export.");
|
||||
}
|
||||
}
|
||||
});
|
||||
return localMetadata;
|
||||
}
|
||||
|
||||
function nameAnonymousExports(programPath) {
|
||||
programPath.get("body").forEach(child => {
|
||||
if (!child.isExportDefaultDeclaration()) return;
|
||||
(0, _helperSplitExportDeclaration.default)(child);
|
||||
});
|
||||
}
|
||||
|
||||
function removeModuleDeclarations(programPath) {
|
||||
programPath.get("body").forEach(child => {
|
||||
if (child.isImportDeclaration()) {
|
||||
child.remove();
|
||||
} else if (child.isExportNamedDeclaration()) {
|
||||
if (child.node.declaration) {
|
||||
child.node.declaration._blockHoist = child.node._blockHoist;
|
||||
child.replaceWith(child.node.declaration);
|
||||
} else {
|
||||
child.remove();
|
||||
}
|
||||
} else if (child.isExportDefaultDeclaration()) {
|
||||
const declaration = child.get("declaration");
|
||||
|
||||
if (declaration.isFunctionDeclaration() || declaration.isClassDeclaration()) {
|
||||
declaration._blockHoist = child.node._blockHoist;
|
||||
child.replaceWith(declaration);
|
||||
} else {
|
||||
throw declaration.buildCodeFrameError("Unexpected default expression export.");
|
||||
}
|
||||
} else if (child.isExportAllDeclaration()) {
|
||||
child.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
292
node_modules/@babel/helper-module-transforms/lib/rewrite-live-references.js
generated
vendored
Normal file
292
node_modules/@babel/helper-module-transforms/lib/rewrite-live-references.js
generated
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = rewriteLiveReferences;
|
||||
|
||||
var _assert = _interopRequireDefault(require("assert"));
|
||||
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
var _template = _interopRequireDefault(require("@babel/template"));
|
||||
|
||||
var _helperSimpleAccess = _interopRequireDefault(require("@babel/helper-simple-access"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function rewriteLiveReferences(programPath, metadata) {
|
||||
const imported = new Map();
|
||||
const exported = new Map();
|
||||
|
||||
const requeueInParent = path => {
|
||||
programPath.requeue(path);
|
||||
};
|
||||
|
||||
for (const [source, data] of metadata.source) {
|
||||
for (const [localName, importName] of data.imports) {
|
||||
imported.set(localName, [source, importName, null]);
|
||||
}
|
||||
|
||||
for (const localName of data.importsNamespace) {
|
||||
imported.set(localName, [source, null, localName]);
|
||||
}
|
||||
}
|
||||
|
||||
for (const [local, data] of metadata.local) {
|
||||
let exportMeta = exported.get(local);
|
||||
|
||||
if (!exportMeta) {
|
||||
exportMeta = [];
|
||||
exported.set(local, exportMeta);
|
||||
}
|
||||
|
||||
exportMeta.push(...data.names);
|
||||
}
|
||||
|
||||
programPath.traverse(rewriteBindingInitVisitor, {
|
||||
metadata,
|
||||
requeueInParent,
|
||||
scope: programPath.scope,
|
||||
exported
|
||||
});
|
||||
(0, _helperSimpleAccess.default)(programPath, new Set([...Array.from(imported.keys()), ...Array.from(exported.keys())]));
|
||||
programPath.traverse(rewriteReferencesVisitor, {
|
||||
seen: new WeakSet(),
|
||||
metadata,
|
||||
requeueInParent,
|
||||
scope: programPath.scope,
|
||||
imported,
|
||||
exported,
|
||||
buildImportReference: ([source, importName, localName], identNode) => {
|
||||
const meta = metadata.source.get(source);
|
||||
|
||||
if (localName) {
|
||||
if (meta.lazy) identNode = t.callExpression(identNode, []);
|
||||
return identNode;
|
||||
}
|
||||
|
||||
let namespace = t.identifier(meta.name);
|
||||
if (meta.lazy) namespace = t.callExpression(namespace, []);
|
||||
return t.memberExpression(namespace, t.identifier(importName));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const rewriteBindingInitVisitor = {
|
||||
Scope(path) {
|
||||
path.skip();
|
||||
},
|
||||
|
||||
ClassDeclaration(path) {
|
||||
const {
|
||||
requeueInParent,
|
||||
exported,
|
||||
metadata
|
||||
} = this;
|
||||
const {
|
||||
id
|
||||
} = path.node;
|
||||
if (!id) throw new Error("Expected class to have a name");
|
||||
const localName = id.name;
|
||||
const exportNames = exported.get(localName) || [];
|
||||
|
||||
if (exportNames.length > 0) {
|
||||
const statement = t.expressionStatement(buildBindingExportAssignmentExpression(metadata, exportNames, t.identifier(localName)));
|
||||
statement._blockHoist = path.node._blockHoist;
|
||||
requeueInParent(path.insertAfter(statement)[0]);
|
||||
}
|
||||
},
|
||||
|
||||
VariableDeclaration(path) {
|
||||
const {
|
||||
requeueInParent,
|
||||
exported,
|
||||
metadata
|
||||
} = this;
|
||||
Object.keys(path.getOuterBindingIdentifiers()).forEach(localName => {
|
||||
const exportNames = exported.get(localName) || [];
|
||||
|
||||
if (exportNames.length > 0) {
|
||||
const statement = t.expressionStatement(buildBindingExportAssignmentExpression(metadata, exportNames, t.identifier(localName)));
|
||||
statement._blockHoist = path.node._blockHoist;
|
||||
requeueInParent(path.insertAfter(statement)[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const buildBindingExportAssignmentExpression = (metadata, exportNames, localExpr) => {
|
||||
return (exportNames || []).reduce((expr, exportName) => {
|
||||
return t.assignmentExpression("=", t.memberExpression(t.identifier(metadata.exportName), t.identifier(exportName)), expr);
|
||||
}, localExpr);
|
||||
};
|
||||
|
||||
const buildImportThrow = localName => {
|
||||
return _template.default.expression.ast`
|
||||
(function() {
|
||||
throw new Error('"' + '${localName}' + '" is read-only.');
|
||||
})()
|
||||
`;
|
||||
};
|
||||
|
||||
const rewriteReferencesVisitor = {
|
||||
ReferencedIdentifier(path) {
|
||||
const {
|
||||
seen,
|
||||
buildImportReference,
|
||||
scope,
|
||||
imported,
|
||||
requeueInParent
|
||||
} = this;
|
||||
if (seen.has(path.node)) return;
|
||||
seen.add(path.node);
|
||||
const localName = path.node.name;
|
||||
const localBinding = path.scope.getBinding(localName);
|
||||
const rootBinding = scope.getBinding(localName);
|
||||
if (rootBinding !== localBinding) return;
|
||||
const importData = imported.get(localName);
|
||||
|
||||
if (importData) {
|
||||
const ref = buildImportReference(importData, path.node);
|
||||
ref.loc = path.node.loc;
|
||||
|
||||
if ((path.parentPath.isCallExpression({
|
||||
callee: path.node
|
||||
}) || path.parentPath.isOptionalCallExpression({
|
||||
callee: path.node
|
||||
}) || path.parentPath.isTaggedTemplateExpression({
|
||||
tag: path.node
|
||||
})) && t.isMemberExpression(ref)) {
|
||||
path.replaceWith(t.sequenceExpression([t.numericLiteral(0), ref]));
|
||||
} else if (path.isJSXIdentifier() && t.isMemberExpression(ref)) {
|
||||
const {
|
||||
object,
|
||||
property
|
||||
} = ref;
|
||||
path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), t.JSXIdentifier(property.name)));
|
||||
} else {
|
||||
path.replaceWith(ref);
|
||||
}
|
||||
|
||||
requeueInParent(path);
|
||||
path.skip();
|
||||
}
|
||||
},
|
||||
|
||||
AssignmentExpression: {
|
||||
exit(path) {
|
||||
const {
|
||||
scope,
|
||||
seen,
|
||||
imported,
|
||||
exported,
|
||||
requeueInParent,
|
||||
buildImportReference
|
||||
} = this;
|
||||
if (seen.has(path.node)) return;
|
||||
seen.add(path.node);
|
||||
const left = path.get("left");
|
||||
if (left.isMemberExpression()) return;
|
||||
|
||||
if (left.isIdentifier()) {
|
||||
const localName = left.node.name;
|
||||
|
||||
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const exportedNames = exported.get(localName);
|
||||
const importData = imported.get(localName);
|
||||
|
||||
if ((exportedNames == null ? void 0 : exportedNames.length) > 0 || importData) {
|
||||
(0, _assert.default)(path.node.operator === "=", "Path was not simplified");
|
||||
const assignment = path.node;
|
||||
|
||||
if (importData) {
|
||||
assignment.left = buildImportReference(importData, assignment.left);
|
||||
assignment.right = t.sequenceExpression([assignment.right, buildImportThrow(localName)]);
|
||||
}
|
||||
|
||||
path.replaceWith(buildBindingExportAssignmentExpression(this.metadata, exportedNames, assignment));
|
||||
requeueInParent(path);
|
||||
}
|
||||
} else {
|
||||
const ids = left.getOuterBindingIdentifiers();
|
||||
const programScopeIds = Object.keys(ids).filter(localName => scope.getBinding(localName) === path.scope.getBinding(localName));
|
||||
const id = programScopeIds.find(localName => imported.has(localName));
|
||||
|
||||
if (id) {
|
||||
path.node.right = t.sequenceExpression([path.node.right, buildImportThrow(id)]);
|
||||
}
|
||||
|
||||
const items = [];
|
||||
programScopeIds.forEach(localName => {
|
||||
const exportedNames = exported.get(localName) || [];
|
||||
|
||||
if (exportedNames.length > 0) {
|
||||
items.push(buildBindingExportAssignmentExpression(this.metadata, exportedNames, t.identifier(localName)));
|
||||
}
|
||||
});
|
||||
|
||||
if (items.length > 0) {
|
||||
let node = t.sequenceExpression(items);
|
||||
|
||||
if (path.parentPath.isExpressionStatement()) {
|
||||
node = t.expressionStatement(node);
|
||||
node._blockHoist = path.parentPath.node._blockHoist;
|
||||
}
|
||||
|
||||
const statement = path.insertAfter(node)[0];
|
||||
requeueInParent(statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
"ForOfStatement|ForInStatement"(path) {
|
||||
const {
|
||||
scope,
|
||||
node
|
||||
} = path;
|
||||
const {
|
||||
left
|
||||
} = node;
|
||||
const {
|
||||
exported,
|
||||
scope: programScope
|
||||
} = this;
|
||||
|
||||
if (!t.isVariableDeclaration(left)) {
|
||||
let didTransform = false;
|
||||
const bodyPath = path.get("body");
|
||||
const loopBodyScope = bodyPath.scope;
|
||||
|
||||
for (const name of Object.keys(t.getOuterBindingIdentifiers(left))) {
|
||||
if (exported.get(name) && programScope.getBinding(name) === scope.getBinding(name)) {
|
||||
didTransform = true;
|
||||
|
||||
if (loopBodyScope.hasOwnBinding(name)) {
|
||||
loopBodyScope.rename(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!didTransform) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newLoopId = scope.generateUidIdentifierBasedOnNode(left);
|
||||
bodyPath.unshiftContainer("body", t.expressionStatement(t.assignmentExpression("=", left, newLoopId)));
|
||||
path.get("left").replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.cloneNode(newLoopId))]));
|
||||
scope.registerDeclaration(path.get("left"));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
31
node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
generated
vendored
Normal file
31
node_modules/@babel/helper-module-transforms/lib/rewrite-this.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = rewriteThis;
|
||||
|
||||
var _helperReplaceSupers = require("@babel/helper-replace-supers");
|
||||
|
||||
function rewriteThis(programPath) {
|
||||
programPath.traverse(rewriteThisVisitor);
|
||||
}
|
||||
|
||||
const rewriteThisVisitor = {
|
||||
ThisExpression(path) {
|
||||
path.replaceWith(path.scope.buildUndefinedNode());
|
||||
},
|
||||
|
||||
Function(path) {
|
||||
if (path.isMethod()) (0, _helperReplaceSupers.skipAllButComputedKey)(path);else if (!path.isArrowFunctionExpression()) path.skip();
|
||||
},
|
||||
|
||||
ClassProperty(path) {
|
||||
(0, _helperReplaceSupers.skipAllButComputedKey)(path);
|
||||
},
|
||||
|
||||
ClassPrivateProperty(path) {
|
||||
path.skip();
|
||||
}
|
||||
|
||||
};
|
||||
58
node_modules/@babel/helper-module-transforms/package.json
generated
vendored
Normal file
58
node_modules/@babel/helper-module-transforms/package.json
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"_from": "@babel/helper-module-transforms@^7.11.0",
|
||||
"_id": "@babel/helper-module-transforms@7.11.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-02EVu8COMuTRO1TAzdMtpBPbe6aQ1w/8fePD2YgQmxZU4gpNWaL9gK3Jp7dxlkUlUCJOTaSeA+Hrm1BRQwqIhg==",
|
||||
"_location": "/@babel/helper-module-transforms",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-module-transforms@^7.11.0",
|
||||
"name": "@babel/helper-module-transforms",
|
||||
"escapedName": "@babel%2fhelper-module-transforms",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.11.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.11.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.11.0.tgz",
|
||||
"_shasum": "b16f250229e47211abdd84b34b64737c2ab2d359",
|
||||
"_spec": "@babel/helper-module-transforms@^7.11.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/core",
|
||||
"author": {
|
||||
"name": "Logan Smyth",
|
||||
"email": "loganfsmyth@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "^7.10.4",
|
||||
"@babel/helper-replace-supers": "^7.10.4",
|
||||
"@babel/helper-simple-access": "^7.10.4",
|
||||
"@babel/helper-split-export-declaration": "^7.11.0",
|
||||
"@babel/template": "^7.10.4",
|
||||
"@babel/types": "^7.11.0",
|
||||
"lodash": "^4.17.19"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Babel helper functions for implementing ES6 module transformations",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-module-transforms",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-module-transforms"
|
||||
},
|
||||
"version": "7.11.0"
|
||||
}
|
||||
22
node_modules/@babel/helper-optimise-call-expression/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-optimise-call-expression/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other 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.
|
||||
19
node_modules/@babel/helper-optimise-call-expression/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-optimise-call-expression/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-optimise-call-expression
|
||||
|
||||
> Helper function to optimise call expression
|
||||
|
||||
See our website [@babel/helper-optimise-call-expression](https://babeljs.io/docs/en/next/babel-helper-optimise-call-expression.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-optimise-call-expression
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-optimise-call-expression --dev
|
||||
```
|
||||
26
node_modules/@babel/helper-optimise-call-expression/lib/index.js
generated
vendored
Normal file
26
node_modules/@babel/helper-optimise-call-expression/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _default(callee, thisNode, args, optional) {
|
||||
if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, {
|
||||
name: "arguments"
|
||||
})) {
|
||||
return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [thisNode, args[0].argument]);
|
||||
} else {
|
||||
if (optional) {
|
||||
return t.optionalCallExpression(t.optionalMemberExpression(callee, t.identifier("call"), false, true), [thisNode, ...args], false);
|
||||
}
|
||||
|
||||
return t.callExpression(t.memberExpression(callee, t.identifier("call")), [thisNode, ...args]);
|
||||
}
|
||||
}
|
||||
49
node_modules/@babel/helper-optimise-call-expression/package.json
generated
vendored
Normal file
49
node_modules/@babel/helper-optimise-call-expression/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"_from": "@babel/helper-optimise-call-expression@^7.10.4",
|
||||
"_id": "@babel/helper-optimise-call-expression@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg==",
|
||||
"_location": "/@babel/helper-optimise-call-expression",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-optimise-call-expression@^7.10.4",
|
||||
"name": "@babel/helper-optimise-call-expression",
|
||||
"escapedName": "@babel%2fhelper-optimise-call-expression",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/helper-replace-supers"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz",
|
||||
"_shasum": "50dc96413d594f995a77905905b05893cd779673",
|
||||
"_spec": "@babel/helper-optimise-call-expression@^7.10.4",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/helper-replace-supers",
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.10.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper function to optimise call expression",
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://github.com/babel/babel#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-optimise-call-expression",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-optimise-call-expression"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
}
|
||||
2
node_modules/@babel/helper-plugin-utils/LICENSE
generated
vendored
2
node_modules/@babel/helper-plugin-utils/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
42
node_modules/@babel/helper-plugin-utils/package.json
generated
vendored
42
node_modules/@babel/helper-plugin-utils/package.json
generated
vendored
@@ -1,47 +1,51 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/helper-plugin-utils@7.0.0",
|
||||
"/Users/pjquirk/Source/GitHub/actions/labeler"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/helper-plugin-utils@7.0.0",
|
||||
"_id": "@babel/helper-plugin-utils@7.0.0",
|
||||
"_from": "@babel/helper-plugin-utils@^7.0.0",
|
||||
"_id": "@babel/helper-plugin-utils@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==",
|
||||
"_integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==",
|
||||
"_location": "/@babel/helper-plugin-utils",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-plugin-utils@7.0.0",
|
||||
"raw": "@babel/helper-plugin-utils@^7.0.0",
|
||||
"name": "@babel/helper-plugin-utils",
|
||||
"escapedName": "@babel%2fhelper-plugin-utils",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.0.0",
|
||||
"rawSpec": "^7.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.0.0"
|
||||
"fetchSpec": "^7.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/plugin-syntax-object-rest-spread",
|
||||
"/babel-plugin-istanbul"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz",
|
||||
"_spec": "7.0.0",
|
||||
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz",
|
||||
"_shasum": "2f75a831269d4f677de49986dff59927533cf375",
|
||||
"_spec": "@babel/helper-plugin-utils@^7.0.0",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/babel-plugin-istanbul",
|
||||
"author": {
|
||||
"name": "Logan Smyth",
|
||||
"email": "loganfsmyth@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "General utilities for plugins to use",
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-plugin-utils",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-utils"
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-plugin-utils"
|
||||
},
|
||||
"version": "7.0.0"
|
||||
"version": "7.10.4"
|
||||
}
|
||||
|
||||
95
node_modules/@babel/helper-plugin-utils/src/index.js
generated
vendored
95
node_modules/@babel/helper-plugin-utils/src/index.js
generated
vendored
@@ -1,95 +0,0 @@
|
||||
export function declare(builder) {
|
||||
return (api, options, dirname) => {
|
||||
if (!api.assertVersion) {
|
||||
// Inject a custom version of 'assertVersion' for Babel 6 and early
|
||||
// versions of Babel 7's beta that didn't have it.
|
||||
api = Object.assign(copyApiObject(api), {
|
||||
assertVersion(range) {
|
||||
throwVersionError(range, api.version);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return builder(api, options || {}, dirname);
|
||||
};
|
||||
}
|
||||
|
||||
function copyApiObject(api) {
|
||||
// Babel >= 7 <= beta.41 passed the API as a new object that had
|
||||
// babel/core as the prototype. While slightly faster, it also
|
||||
// means that the Object.assign copy below fails. Rather than
|
||||
// keep complexity, the Babel 6 behavior has been reverted and this
|
||||
// normalizes all that for Babel 7.
|
||||
let proto = null;
|
||||
if (typeof api.version === "string" && /^7\./.test(api.version)) {
|
||||
proto = Object.getPrototypeOf(api);
|
||||
if (
|
||||
proto &&
|
||||
(!has(proto, "version") ||
|
||||
!has(proto, "transform") ||
|
||||
!has(proto, "template") ||
|
||||
!has(proto, "types"))
|
||||
) {
|
||||
proto = null;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...proto,
|
||||
...api,
|
||||
};
|
||||
}
|
||||
|
||||
function has(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
function throwVersionError(range, version) {
|
||||
if (typeof range === "number") {
|
||||
if (!Number.isInteger(range)) {
|
||||
throw new Error("Expected string or integer value.");
|
||||
}
|
||||
range = `^${range}.0.0-0`;
|
||||
}
|
||||
if (typeof range !== "string") {
|
||||
throw new Error("Expected string or integer value.");
|
||||
}
|
||||
|
||||
const limit = Error.stackTraceLimit;
|
||||
|
||||
if (typeof limit === "number" && limit < 25) {
|
||||
// Bump up the limit if needed so that users are more likely
|
||||
// to be able to see what is calling Babel.
|
||||
Error.stackTraceLimit = 25;
|
||||
}
|
||||
|
||||
let err;
|
||||
if (version.slice(0, 2) === "7.") {
|
||||
err = new Error(
|
||||
`Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` +
|
||||
`You'll need to update your @babel/core version.`,
|
||||
);
|
||||
} else {
|
||||
err = new Error(
|
||||
`Requires Babel "${range}", but was loaded with "${version}". ` +
|
||||
`If you are sure you have a compatible version of @babel/core, ` +
|
||||
`it is likely that something in your build process is loading the ` +
|
||||
`wrong version. Inspect the stack trace of this error to look for ` +
|
||||
`the first entry that doesn't mention "@babel/core" or "babel-core" ` +
|
||||
`to see what is calling Babel.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof limit === "number") {
|
||||
Error.stackTraceLimit = limit;
|
||||
}
|
||||
|
||||
throw Object.assign(
|
||||
err,
|
||||
({
|
||||
code: "BABEL_VERSION_UNSUPPORTED",
|
||||
version,
|
||||
range,
|
||||
}: any),
|
||||
);
|
||||
}
|
||||
22
node_modules/@babel/helper-replace-supers/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-replace-supers/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other 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.
|
||||
19
node_modules/@babel/helper-replace-supers/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-replace-supers/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-replace-supers
|
||||
|
||||
> Helper function to replace supers
|
||||
|
||||
See our website [@babel/helper-replace-supers](https://babeljs.io/docs/en/next/babel-helper-replace-supers.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-replace-supers
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-replace-supers --dev
|
||||
```
|
||||
245
node_modules/@babel/helper-replace-supers/lib/index.js
generated
vendored
Normal file
245
node_modules/@babel/helper-replace-supers/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,245 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.skipAllButComputedKey = skipAllButComputedKey;
|
||||
exports.default = exports.environmentVisitor = void 0;
|
||||
|
||||
var _traverse = _interopRequireDefault(require("@babel/traverse"));
|
||||
|
||||
var _helperMemberExpressionToFunctions = _interopRequireDefault(require("@babel/helper-member-expression-to-functions"));
|
||||
|
||||
var _helperOptimiseCallExpression = _interopRequireDefault(require("@babel/helper-optimise-call-expression"));
|
||||
|
||||
var t = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
|
||||
objectRef = t.cloneNode(objectRef);
|
||||
const targetRef = isStatic || isPrivateMethod ? objectRef : t.memberExpression(objectRef, t.identifier("prototype"));
|
||||
return t.callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
|
||||
}
|
||||
|
||||
function skipAllButComputedKey(path) {
|
||||
if (!path.node.computed) {
|
||||
path.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const keys = t.VISITOR_KEYS[path.type];
|
||||
|
||||
for (const key of keys) {
|
||||
if (key !== "key") path.skipKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
const environmentVisitor = {
|
||||
TypeAnnotation(path) {
|
||||
path.skip();
|
||||
},
|
||||
|
||||
Function(path) {
|
||||
if (path.isMethod()) return;
|
||||
if (path.isArrowFunctionExpression()) return;
|
||||
path.skip();
|
||||
},
|
||||
|
||||
"Method|ClassProperty|ClassPrivateProperty"(path) {
|
||||
skipAllButComputedKey(path);
|
||||
}
|
||||
|
||||
};
|
||||
exports.environmentVisitor = environmentVisitor;
|
||||
|
||||
const visitor = _traverse.default.visitors.merge([environmentVisitor, {
|
||||
Super(path, state) {
|
||||
const {
|
||||
node,
|
||||
parentPath
|
||||
} = path;
|
||||
if (!parentPath.isMemberExpression({
|
||||
object: node
|
||||
})) return;
|
||||
state.handle(parentPath);
|
||||
}
|
||||
|
||||
}]);
|
||||
|
||||
const specHandlers = {
|
||||
memoise(superMember, count) {
|
||||
const {
|
||||
scope,
|
||||
node
|
||||
} = superMember;
|
||||
const {
|
||||
computed,
|
||||
property
|
||||
} = node;
|
||||
|
||||
if (!computed) {
|
||||
return;
|
||||
}
|
||||
|
||||
const memo = scope.maybeGenerateMemoised(property);
|
||||
|
||||
if (!memo) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.memoiser.set(property, memo, count);
|
||||
},
|
||||
|
||||
prop(superMember) {
|
||||
const {
|
||||
computed,
|
||||
property
|
||||
} = superMember.node;
|
||||
|
||||
if (this.memoiser.has(property)) {
|
||||
return t.cloneNode(this.memoiser.get(property));
|
||||
}
|
||||
|
||||
if (computed) {
|
||||
return t.cloneNode(property);
|
||||
}
|
||||
|
||||
return t.stringLiteral(property.name);
|
||||
},
|
||||
|
||||
get(superMember) {
|
||||
return this._get(superMember, this._getThisRefs());
|
||||
},
|
||||
|
||||
_get(superMember, thisRefs) {
|
||||
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
|
||||
return t.callExpression(this.file.addHelper("get"), [thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]);
|
||||
},
|
||||
|
||||
_getThisRefs() {
|
||||
if (!this.isDerivedConstructor) {
|
||||
return {
|
||||
this: t.thisExpression()
|
||||
};
|
||||
}
|
||||
|
||||
const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper");
|
||||
return {
|
||||
memo: t.assignmentExpression("=", thisRef, t.thisExpression()),
|
||||
this: t.cloneNode(thisRef)
|
||||
};
|
||||
},
|
||||
|
||||
set(superMember, value) {
|
||||
const thisRefs = this._getThisRefs();
|
||||
|
||||
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
|
||||
return t.callExpression(this.file.addHelper("set"), [thisRefs.memo ? t.sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, t.booleanLiteral(superMember.isInStrictMode())]);
|
||||
},
|
||||
|
||||
destructureSet(superMember) {
|
||||
throw superMember.buildCodeFrameError(`Destructuring to a super field is not supported yet.`);
|
||||
},
|
||||
|
||||
call(superMember, args) {
|
||||
const thisRefs = this._getThisRefs();
|
||||
|
||||
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), t.cloneNode(thisRefs.this), args, false);
|
||||
}
|
||||
|
||||
};
|
||||
const looseHandlers = Object.assign({}, specHandlers, {
|
||||
prop(superMember) {
|
||||
const {
|
||||
property
|
||||
} = superMember.node;
|
||||
|
||||
if (this.memoiser.has(property)) {
|
||||
return t.cloneNode(this.memoiser.get(property));
|
||||
}
|
||||
|
||||
return t.cloneNode(property);
|
||||
},
|
||||
|
||||
get(superMember) {
|
||||
const {
|
||||
isStatic,
|
||||
superRef
|
||||
} = this;
|
||||
const {
|
||||
computed
|
||||
} = superMember.node;
|
||||
const prop = this.prop(superMember);
|
||||
let object;
|
||||
|
||||
if (isStatic) {
|
||||
object = superRef ? t.cloneNode(superRef) : t.memberExpression(t.identifier("Function"), t.identifier("prototype"));
|
||||
} else {
|
||||
object = superRef ? t.memberExpression(t.cloneNode(superRef), t.identifier("prototype")) : t.memberExpression(t.identifier("Object"), t.identifier("prototype"));
|
||||
}
|
||||
|
||||
return t.memberExpression(object, prop, computed);
|
||||
},
|
||||
|
||||
set(superMember, value) {
|
||||
const {
|
||||
computed
|
||||
} = superMember.node;
|
||||
const prop = this.prop(superMember);
|
||||
return t.assignmentExpression("=", t.memberExpression(t.thisExpression(), prop, computed), value);
|
||||
},
|
||||
|
||||
destructureSet(superMember) {
|
||||
const {
|
||||
computed
|
||||
} = superMember.node;
|
||||
const prop = this.prop(superMember);
|
||||
return t.memberExpression(t.thisExpression(), prop, computed);
|
||||
},
|
||||
|
||||
call(superMember, args) {
|
||||
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), t.thisExpression(), args, false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
class ReplaceSupers {
|
||||
constructor(opts) {
|
||||
const path = opts.methodPath;
|
||||
this.methodPath = path;
|
||||
this.isDerivedConstructor = path.isClassMethod({
|
||||
kind: "constructor"
|
||||
}) && !!opts.superRef;
|
||||
this.isStatic = path.isObjectMethod() || path.node.static;
|
||||
this.isPrivateMethod = path.isPrivate() && path.isMethod();
|
||||
this.file = opts.file;
|
||||
this.superRef = opts.superRef;
|
||||
this.isLoose = opts.isLoose;
|
||||
this.opts = opts;
|
||||
}
|
||||
|
||||
getObjectRef() {
|
||||
return t.cloneNode(this.opts.objectRef || this.opts.getObjectRef());
|
||||
}
|
||||
|
||||
replace() {
|
||||
const handler = this.isLoose ? looseHandlers : specHandlers;
|
||||
(0, _helperMemberExpressionToFunctions.default)(this.methodPath, visitor, Object.assign({
|
||||
file: this.file,
|
||||
scope: this.methodPath.scope,
|
||||
isDerivedConstructor: this.isDerivedConstructor,
|
||||
isStatic: this.isStatic,
|
||||
isPrivateMethod: this.isPrivateMethod,
|
||||
getObjectRef: this.getObjectRef.bind(this),
|
||||
superRef: this.superRef
|
||||
}, handler));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ReplaceSupers;
|
||||
52
node_modules/@babel/helper-replace-supers/package.json
generated
vendored
Normal file
52
node_modules/@babel/helper-replace-supers/package.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"_from": "@babel/helper-replace-supers@^7.10.4",
|
||||
"_id": "@babel/helper-replace-supers@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A==",
|
||||
"_location": "/@babel/helper-replace-supers",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-replace-supers@^7.10.4",
|
||||
"name": "@babel/helper-replace-supers",
|
||||
"escapedName": "@babel%2fhelper-replace-supers",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/helper-module-transforms"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz",
|
||||
"_shasum": "d585cd9388ea06e6031e4cd44b6713cbead9e6cf",
|
||||
"_spec": "@babel/helper-replace-supers@^7.10.4",
|
||||
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/helper-module-transforms",
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/helper-member-expression-to-functions": "^7.10.4",
|
||||
"@babel/helper-optimise-call-expression": "^7.10.4",
|
||||
"@babel/traverse": "^7.10.4",
|
||||
"@babel/types": "^7.10.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper function to replace supers",
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://github.com/babel/babel#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-replace-supers",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-replace-supers"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
}
|
||||
22
node_modules/@babel/helper-simple-access/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-simple-access/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other 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.
|
||||
19
node_modules/@babel/helper-simple-access/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-simple-access/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-simple-access
|
||||
|
||||
> Babel helper for ensuring that access to a given value is performed through simple accesses
|
||||
|
||||
See our website [@babel/helper-simple-access](https://babeljs.io/docs/en/next/babel-helper-simple-access.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-simple-access
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-simple-access --dev
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user