mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-06 08:02:18 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
77
web/node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.js
generated
vendored
Normal file
77
web/node_modules/@babel/preset-env/lib/polyfills/babel-polyfill.js
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var t = require("@babel/types");
|
||||
|
||||
const BABEL_POLYFILL_DEPRECATION = `
|
||||
\`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`
|
||||
and \`regenerator-runtime/runtime\` separately`;
|
||||
const NO_DIRECT_POLYFILL_IMPORT = `
|
||||
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
|
||||
Please remove the direct import of \`SPECIFIER\` or use \`useBuiltIns: 'entry'\` instead.`;
|
||||
|
||||
function _default({
|
||||
template
|
||||
}, {
|
||||
regenerator,
|
||||
deprecated,
|
||||
usage
|
||||
}) {
|
||||
return {
|
||||
name: "preset-env/replace-babel-polyfill",
|
||||
visitor: {
|
||||
ImportDeclaration(path) {
|
||||
const src = (0, _utils.getImportSource)(path);
|
||||
|
||||
if (usage && (0, _utils.isPolyfillSource)(src)) {
|
||||
console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src));
|
||||
if (!deprecated) path.remove();
|
||||
} else if (src === "@babel/polyfill") {
|
||||
if (deprecated) {
|
||||
console.warn(BABEL_POLYFILL_DEPRECATION);
|
||||
} else if (regenerator) {
|
||||
path.replaceWithMultiple(template.ast`
|
||||
import "core-js";
|
||||
import "regenerator-runtime/runtime.js";
|
||||
`);
|
||||
} else {
|
||||
path.replaceWith(template.ast`
|
||||
import "core-js";
|
||||
`);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Program(path) {
|
||||
path.get("body").forEach(bodyPath => {
|
||||
const src = (0, _utils.getRequireSource)(bodyPath);
|
||||
|
||||
if (usage && (0, _utils.isPolyfillSource)(src)) {
|
||||
console.warn(NO_DIRECT_POLYFILL_IMPORT.replace("SPECIFIER", src));
|
||||
if (!deprecated) bodyPath.remove();
|
||||
} else if (src === "@babel/polyfill") {
|
||||
if (deprecated) {
|
||||
console.warn(BABEL_POLYFILL_DEPRECATION);
|
||||
} else if (regenerator) {
|
||||
bodyPath.replaceWithMultiple(template.ast`
|
||||
require("core-js");
|
||||
require("regenerator-runtime/runtime.js");
|
||||
`);
|
||||
} else {
|
||||
bodyPath.replaceWith(template.ast`
|
||||
require("core-js");
|
||||
`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
54
web/node_modules/@babel/preset-env/lib/polyfills/regenerator.js
generated
vendored
Normal file
54
web/node_modules/@babel/preset-env/lib/polyfills/regenerator.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function isRegeneratorSource(source) {
|
||||
return source === "regenerator-runtime/runtime" || source === "regenerator-runtime/runtime.js";
|
||||
}
|
||||
|
||||
function _default() {
|
||||
const visitor = {
|
||||
ImportDeclaration(path) {
|
||||
if (isRegeneratorSource((0, _utils.getImportSource)(path))) {
|
||||
this.regeneratorImportExcluded = true;
|
||||
path.remove();
|
||||
}
|
||||
},
|
||||
|
||||
Program(path) {
|
||||
path.get("body").forEach(bodyPath => {
|
||||
if (isRegeneratorSource((0, _utils.getRequireSource)(bodyPath))) {
|
||||
this.regeneratorImportExcluded = true;
|
||||
bodyPath.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
return {
|
||||
name: "preset-env/remove-regenerator",
|
||||
visitor,
|
||||
|
||||
pre() {
|
||||
this.regeneratorImportExcluded = false;
|
||||
},
|
||||
|
||||
post() {
|
||||
if (this.opts.debug && this.regeneratorImportExcluded) {
|
||||
let filename = this.file.opts.filename;
|
||||
|
||||
if (process.env.BABEL_ENV === "test") {
|
||||
filename = filename.replace(/\\/g, "/");
|
||||
}
|
||||
|
||||
console.log(`\n[${filename}] Based on your targets, regenerator-runtime import excluded.`);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
33
web/node_modules/@babel/preset-env/lib/polyfills/utils.js
generated
vendored
Normal file
33
web/node_modules/@babel/preset-env/lib/polyfills/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getImportSource = getImportSource;
|
||||
exports.getRequireSource = getRequireSource;
|
||||
exports.isPolyfillSource = isPolyfillSource;
|
||||
|
||||
var t = require("@babel/types");
|
||||
|
||||
function getImportSource({
|
||||
node
|
||||
}) {
|
||||
if (node.specifiers.length === 0) return node.source.value;
|
||||
}
|
||||
|
||||
function getRequireSource({
|
||||
node
|
||||
}) {
|
||||
if (!t.isExpressionStatement(node)) return;
|
||||
const {
|
||||
expression
|
||||
} = node;
|
||||
|
||||
if (t.isCallExpression(expression) && t.isIdentifier(expression.callee) && expression.callee.name === "require" && expression.arguments.length === 1 && t.isStringLiteral(expression.arguments[0])) {
|
||||
return expression.arguments[0].value;
|
||||
}
|
||||
}
|
||||
|
||||
function isPolyfillSource(source) {
|
||||
return source === "@babel/polyfill" || source === "core-js";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue