mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 20:30:04 +02:00
Compare commits
52 Commits
040e1c6c4f
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a7f274f78a | ||
c77d496b31 | |||
806ebf9a57 | |||
09663a35a5
|
|||
cea9885dde
|
|||
ef3070bdb7
|
|||
3ec373077c
|
|||
d81e8e9fb8
|
|||
2b23424b86
|
|||
783511ce12 | |||
411fa7ff39 | |||
c2f45abf0f | |||
5edcdf96f7 | |||
371a36ff4c | |||
abdd8fb1a0 | |||
4c0b055996 | |||
a4b62da0ba | |||
db9b32db65 | |||
7e88906795 | |||
325ec064b9 | |||
21485f0e5a | |||
c116fbffbd | |||
4cf254c12f | |||
9dc253a6be | |||
439b2733a6 | |||
d989c9f491 | |||
e659f2acb8 | |||
16d5a653c2 | |||
42c88a6689 | |||
ea913f84b8 | |||
5166260592 | |||
f6eb8cfad8 | |||
32f7857516 | |||
c4eea9da65 | |||
65dcc1916f | |||
e58d000d4f | |||
5a7294bcf9 | |||
91ce9fe859 | |||
96dbb27eea | |||
01c4e4d60d | |||
9aa30e929e | |||
1f26e93c5e | |||
d1fd48f7e1 | |||
86e1333c3e | |||
9528e1e8e1 | |||
e0ce9dada5 | |||
f2842bfe6e | |||
8b3a40cfc2 | |||
5b866b81af | |||
89c32fb4e6 | |||
f114871153 | |||
e51ab1e925 |
4
.babelrc
4
.babelrc
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"presets": ["minify"],
|
||||
"plugins": ["babel-plugin-transform-es2015-template-literals"]
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"level": {
|
||||
"1": {
|
||||
"specialComments": false,
|
||||
"rebase": false
|
||||
}
|
||||
}
|
||||
}
|
14
.editorconfig
Normal file
14
.editorconfig
Normal file
@@ -0,0 +1,14 @@
|
||||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
dist
|
33
.eslintrc.json
Normal file
33
.eslintrc.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{"parserOptions":
|
||||
{"ecmaVersion": 6},
|
||||
"rules": {
|
||||
"quotes": [2, "single", {"allowTemplateLiterals": true}],
|
||||
"curly": [2, "all"],
|
||||
"keyword-spacing": [2, {"overrides": {"else": {"before": true}, "catch": {"before": true, "after": false}}}],
|
||||
"space-before-blocks": [2, "always"],
|
||||
"wrap-iife": [2, "inside"],
|
||||
"space-before-function-paren": [2, "never"],
|
||||
"one-var": [2, "never"],
|
||||
"vars-on-top": 0, "no-empty": [2, {"allowEmptyCatch": true}],
|
||||
"array-bracket-spacing": [2, "never"],
|
||||
"space-in-parens": [2, "never"],
|
||||
"no-underscore-dangle": 0,
|
||||
"comma-style": [2, "last"],
|
||||
"comma-spacing": [2, {"before": false, "after": true}],
|
||||
"space-unary-ops": [2, {"words": false, "nonwords": false}],
|
||||
"no-multi-spaces": 2,
|
||||
"space-infix-ops": 2,
|
||||
"no-with": 2,
|
||||
"indent": [2, "tab", {"SwitchCase": 1, "FunctionExpression": {"body": 1, "parameters": 1}, "MemberExpression": 0}],
|
||||
"no-mixed-spaces-and-tabs": 2,
|
||||
"no-trailing-spaces": 2,
|
||||
"comma-dangle": [2, "never"],
|
||||
"semi": [2, "always"],
|
||||
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
|
||||
"eol-last": 2,
|
||||
"dot-notation": 0,
|
||||
"no-multi-str": 2,
|
||||
"key-spacing": [2, {"afterColon": true}],
|
||||
"func-call-spacing": [2, "never"]
|
||||
}
|
||||
}
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/dist
|
72
.jscsrc
72
.jscsrc
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"requireCurlyBraces": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"case",
|
||||
"return",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"disallowSpacesInNamedFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionDeclaration": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"requireSpaceBetweenArguments": true,
|
||||
"disallowMultipleVarDecl": true,
|
||||
"requireVarDeclFirst": false,
|
||||
"requireBlocksOnNewline": false,
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
"disallowSpacesInsideObjectBrackets": true,
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"disallowDanglingUnderscores": false,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"disallowSpaceBeforePostfixUnaryOperators": true,
|
||||
"disallowSpaceBeforeBinaryOperators": [
|
||||
","
|
||||
],
|
||||
"requireSpacesInForStatement": true,
|
||||
"requireSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"requireSpaceBeforeBinaryOperators": true,
|
||||
"requireSpaceAfterBinaryOperators": true,
|
||||
"disallowKeywords": [
|
||||
"with"
|
||||
],
|
||||
"validateIndentation": "\t",
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"disallowTrailingComma": true,
|
||||
"disallowKeywordsOnNewLine": [
|
||||
"else"
|
||||
],
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireCapitalizedConstructors": true,
|
||||
"requireDotNotation": false,
|
||||
"disallowNewlineBeforeBlockStatements": true,
|
||||
"disallowMultipleLineStrings": true,
|
||||
"requireSpaceBeforeObjectValues": true
|
||||
}
|
25
.vscode/launch.json
vendored
Normal file
25
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"name": "Attach to Remote",
|
||||
"address": "127.0.0.1",
|
||||
"port": 9229,
|
||||
"localRoot": "${workspaceFolder}",
|
||||
"remoteRoot": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}\\minifyfromhtml.js",
|
||||
"args": ["--js=../dist/mywidget.min.js", "--css=../dist/mywidget.min.css", "< index.html"],
|
||||
"cwd": "${workspaceFolder}\\example"
|
||||
}
|
||||
]
|
||||
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
74
README.md
74
README.md
@@ -1,13 +1,77 @@
|
||||
# minifyfromhtml
|
||||
|
||||
This little helper minifies scripts and css starting from an html file. I made it after asking this question on stackoverflow: https://stackoverflow.com/questions/50188269/minify-js-and-css-in-one-go-starting-from-html/
|
||||
This little helper minifies scripts and css starting from an html file.
|
||||
|
||||
## What it is
|
||||
|
||||
I am making a `js` widget, like a map, or a calendar field or something. This is the `index.html` I use while developing the widget:
|
||||
|
||||
It takes an input html file, parses it, and outputs all included javascript and css files minified to a file you specify:
|
||||
```
|
||||
minifyfromhtml --js=<output js file> --css=<output css file> < <input file>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>example page</title>
|
||||
|
||||
<script src="somelib.js"></script>
|
||||
<script src="someotherlib.js"></script>
|
||||
<script src="awesomelib.js"></script>
|
||||
<script src="spectacularlib.js"></script>
|
||||
<script src="app.js"></script>
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="some.css" />
|
||||
<link rel="stylesheet" type="text/css" href="app.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="widget"></div>
|
||||
|
||||
<script>
|
||||
myapp(document.getElementById('widget'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
example:
|
||||
I am not using a framework like angular or react. I am coding along in `app.js`, and add libraries as I need them to `index.html`.
|
||||
|
||||
Then comes a time I want to distribute my widget to the world. To do that, I would like to
|
||||
|
||||
- minify all referenced js files in index.html
|
||||
- minify all css files
|
||||
|
||||
so that users of my widget can just include `widget.js` and `widget.css` and be good to go.
|
||||
|
||||
Is there something I can use that does that for me **with minimal hassle**? Something like
|
||||
|
||||
```
|
||||
minifyfromhtml --js=dist/mywidget.min.js --css=dist/mywidget.min.css < example/index.html
|
||||
$ magictool index.html
|
||||
- nice html you have. let me parse that and see what I need to do...
|
||||
- oh, you have somelib.js. let me minify that for you and put it in dist.js
|
||||
- oh, you have someotherlib.js. let me minify that for you and put it in dist.js
|
||||
- oh, you have awesomelib.js. let me minify that for you and put it in dist.js
|
||||
- oh, you have spectacularlib.js. let me minify that for you and put it in dist.js
|
||||
- oh, you have app.js. let me minify that for you and put it in dist.js
|
||||
- oh, you have some.css. let me minify that for you and put it in dist.css
|
||||
- oh, you have app.css. let me minify that for you and put it in dist.css
|
||||
! dist.js and dist.css created!
|
||||
```
|
||||
that reads `index.html` and creates a `dist.js` and `dist.css`.
|
||||
|
||||
the magictool is **minifyfromhtml**.
|
||||
|
||||
## Quickstart
|
||||
|
||||
```
|
||||
npm i -g minifyfromhtml
|
||||
minifyfromhtml --js=dist.js --css=dist.css < index.html
|
||||
```
|
||||
=>
|
||||
```
|
||||
some.css -> dist.css
|
||||
app.css -> dist.css
|
||||
somelib.js -> dist.js
|
||||
someotherlib.js -> dist.js
|
||||
awesomelib.js -> dist.js
|
||||
spectacularlib.js -> dist.js
|
||||
app.js -> dist.js
|
||||
```
|
||||
|
3
example/css/more.css
Normal file
3
example/css/more.css
Normal file
@@ -0,0 +1,3 @@
|
||||
#mywidget {
|
||||
color: blue;
|
||||
}
|
3
example/css/mywidget-alt.css
Normal file
3
example/css/mywidget-alt.css
Normal file
@@ -0,0 +1,3 @@
|
||||
#mywidget {
|
||||
border: 2px solid blue;
|
||||
}
|
1
example/dist.css
Normal file
1
example/dist.css
Normal file
@@ -0,0 +1 @@
|
||||
#mywidget{border:2px solid red}#mywidget{color:#00f}
|
2
example/dist.js
Normal file
2
example/dist.js
Normal file
File diff suppressed because one or more lines are too long
1
example/dist.js.map
Normal file
1
example/dist.js.map
Normal file
File diff suppressed because one or more lines are too long
2
example/dist/dist.css
vendored
2
example/dist/dist.css
vendored
@@ -1 +1 @@
|
||||
#mywidget{border:2px solid red}
|
||||
#mywidget{border:2px solid red}#mywidget{color:#00f}
|
3
example/dist/dist.js
vendored
3
example/dist/dist.js
vendored
File diff suppressed because one or more lines are too long
1
example/dist/dist.js.map
vendored
Normal file
1
example/dist/dist.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -13,7 +13,8 @@
|
||||
|
||||
<!-- some css -->
|
||||
<link rel="stylesheet" type="text/css" href="css/mywidget.css" />
|
||||
|
||||
<link rel="alternate stylesheet" type="text/css" href="css/mywidget.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/more.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@@ -1,21 +1,18 @@
|
||||
let argv = require('minimist')(process.argv.slice(2));
|
||||
let fs = require('fs');
|
||||
let path = require('path');
|
||||
let Terser = require('terser');
|
||||
let CleanCSS = require('clean-css');
|
||||
let jsdom = require('jsdom');
|
||||
let JSDOM = jsdom.JSDOM;
|
||||
let babel = require("babel-core");
|
||||
let CleanCSS = require('clean-css');
|
||||
|
||||
process.on('unhandledRejection', up => { throw up; });
|
||||
|
||||
let usage = `usage:
|
||||
minifyfromhtml --js=<output js file> --css=<output css file> --exclude=<exclude files> < <input file>
|
||||
|
||||
the minification process uses babel under the hood, so you can modify
|
||||
the minification with a .babelrc file.
|
||||
https://babeljs.io/
|
||||
|
||||
the css minification process uses clean-css. to modify the default settings,
|
||||
create a file named .cleancssrc and put the json configuration in that file.
|
||||
https://github.com/jakubpawlowicz/clean-css
|
||||
the minification process uses minify under the hood.
|
||||
http://coderaiser.github.io/minify/
|
||||
|
||||
example:
|
||||
minifyfromhtml --js=dist/mywidget.min.js --css=dist/mywidget.min.css --exclude=js/jquery.js < example/index.html
|
||||
@@ -23,15 +20,15 @@ let usage = `usage:
|
||||
|
||||
if (argv.h) {
|
||||
console.log(usage);
|
||||
return;
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (!argv.js || !argv.css) {
|
||||
if (!argv.js && !argv.css) {
|
||||
console.log(usage);
|
||||
return;
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
var excludeFiles = argv.exclude || [];
|
||||
let excludeFiles = argv.exclude || [];
|
||||
if (typeof(excludeFiles) === 'string') {
|
||||
excludeFiles = [excludeFiles];
|
||||
}
|
||||
@@ -46,103 +43,79 @@ let readStdin = function(cb) {
|
||||
process.stdin.on('end', function() {
|
||||
cb(stdin);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
readStdin(function(html) {
|
||||
let dom = new JSDOM(html);
|
||||
let getTagAttrs = function(dom, tag, attr) {
|
||||
let scripts = [];
|
||||
let getTagAttrs = function(dom, tag, attr, filter) {
|
||||
let elements = [];
|
||||
|
||||
let document = dom.window.document;
|
||||
let scriptTags = document.getElementsByTagName(tag);
|
||||
let i = scriptTags.length;
|
||||
for (let i = 0; i < scriptTags.length; i++) {
|
||||
let src = scriptTags[i].getAttribute(attr);
|
||||
if (src) {
|
||||
scripts.push(src);
|
||||
}
|
||||
}
|
||||
return scripts;
|
||||
}
|
||||
|
||||
//process scripts
|
||||
let scripts = getTagAttrs(dom, 'script', 'src');
|
||||
|
||||
//remove exluded
|
||||
excludeFiles.forEach(i => {
|
||||
var index = scripts.indexOf(i);
|
||||
if (index !== -1) {
|
||||
scripts.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
let processedScripts = {};
|
||||
for (let i = 0; i < scripts.length; i++) {
|
||||
let script = scripts[i];
|
||||
|
||||
babel.transformFile(script, {}, function(err, result) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
processedScripts[script] = result.code;
|
||||
|
||||
if (Object.keys(processedScripts).length === scripts.length) {
|
||||
//write scripts
|
||||
|
||||
//clear out dist file
|
||||
fs.writeFileSync(argv.js, '');
|
||||
|
||||
//write files
|
||||
for (let i = 0; i < scripts.length; i++) {
|
||||
const script = scripts[i];
|
||||
|
||||
console.log(script + ' -> ' + argv.js);
|
||||
fs.appendFileSync(argv.js, processedScripts[script] + '\n');
|
||||
let elementTags = document.getElementsByTagName(tag);
|
||||
let i = elementTags.length;
|
||||
for (let i = 0; i < elementTags.length; i++) {
|
||||
if (!filter ||
|
||||
(filter && elementTags[i].getAttribute(Object.keys(filter)[0]) === filter[Object.keys(filter)[0]])) {
|
||||
let src = elementTags[i].getAttribute(attr);
|
||||
if (src) {
|
||||
elements.push(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
return elements;
|
||||
};
|
||||
|
||||
let processJs = function(things, outFile) {
|
||||
let terserOptions = {
|
||||
output: {
|
||||
comments: false
|
||||
},
|
||||
sourceMap: {
|
||||
includeSources: true,
|
||||
url: path.basename(outFile) + '.map'
|
||||
}
|
||||
};
|
||||
|
||||
//remove exluded
|
||||
excludeFiles.forEach(i => {
|
||||
let index = things.indexOf(i);
|
||||
if (index !== -1) {
|
||||
things.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
let code = {};
|
||||
for (let i = 0; i < things.length; i++) {
|
||||
let thing = things[i];
|
||||
code[thing] = fs.readFileSync(thing, 'utf8');
|
||||
console.log(thing + ' -> ' + outFile);
|
||||
}
|
||||
|
||||
const datap = Terser.minify(code, terserOptions);
|
||||
datap.then((data) => {
|
||||
fs.writeFileSync(outFile, data.code);
|
||||
if (data.map) {
|
||||
fs.writeFileSync(outFile + '.map', data.map);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
let processCss = function(things, outFile) {
|
||||
fs.writeFileSync(outFile, '');
|
||||
for (let i = 0; i < things.length; i++) {
|
||||
let thing = things[i];
|
||||
console.log(thing + ' -> ' + outFile);
|
||||
let minified = new CleanCSS().minify(fs.readFileSync(thing, 'utf8'));
|
||||
fs.appendFileSync(outFile, minified.styles);
|
||||
}
|
||||
};
|
||||
|
||||
if (argv.js) {
|
||||
processJs(getTagAttrs(dom, 'script', 'src'), argv.js);
|
||||
}
|
||||
|
||||
//process css
|
||||
let styles = getTagAttrs(dom, 'link', 'href');
|
||||
|
||||
//remove exluded
|
||||
excludeFiles.forEach(i => {
|
||||
var index = styles.indexOf(i);
|
||||
if (index !== -1) {
|
||||
styles.splice(index, 1);
|
||||
}
|
||||
});
|
||||
|
||||
let processedStyles = {};
|
||||
fs.writeFileSync(argv.css, '');
|
||||
for (let i = 0; i < styles.length; i++) {
|
||||
let style = styles[i];
|
||||
|
||||
if (excludeFiles.indexOf(style) > -1) {
|
||||
console.log(style + ' excluded');
|
||||
continue;
|
||||
}
|
||||
|
||||
let css = fs.readFileSync(style);
|
||||
let cleanCssOptions = '';
|
||||
|
||||
let readConfig = function(configfilepath) {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(configfilepath + '/.cleancssrc'));
|
||||
} catch (e) {
|
||||
if (configfilepath.length < 4) {
|
||||
configfilepath = path.resolve(path.normalize(configfilepath + '/../'));
|
||||
return readConfig(configfilepath);
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
cleanCssOptions = readConfig(path.resolve('./'));
|
||||
|
||||
console.log(style + ' -> ' + argv.css);
|
||||
fs.appendFileSync(argv.css, (new CleanCSS(cleanCssOptions).minify(css)).styles + '\n');
|
||||
if (argv.css) {
|
||||
processCss(getTagAttrs(dom, 'link', 'href', {rel: 'stylesheet'}), argv.css);
|
||||
}
|
||||
});
|
||||
|
16
node_modules/.bin/acorn
generated
vendored
16
node_modules/.bin/acorn
generated
vendored
@@ -1 +1,15 @@
|
||||
../acorn/bin/acorn
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../acorn/bin/acorn" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
17
node_modules/.bin/acorn.cmd
generated
vendored
Normal file
17
node_modules/.bin/acorn.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\acorn\bin\acorn" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/acorn.ps1
generated
vendored
Normal file
18
node_modules/.bin/acorn.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../acorn/bin/acorn" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
1
node_modules/.bin/babel-minify
generated
vendored
1
node_modules/.bin/babel-minify
generated
vendored
@@ -1 +0,0 @@
|
||||
../babel-minify/bin/minify.js
|
1
node_modules/.bin/babylon
generated
vendored
1
node_modules/.bin/babylon
generated
vendored
@@ -1 +0,0 @@
|
||||
../babylon/bin/babylon.js
|
16
node_modules/.bin/escodegen
generated
vendored
16
node_modules/.bin/escodegen
generated
vendored
@@ -1 +1,15 @@
|
||||
../escodegen/bin/escodegen.js
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../escodegen/bin/escodegen.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../escodegen/bin/escodegen.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
17
node_modules/.bin/escodegen.cmd
generated
vendored
Normal file
17
node_modules/.bin/escodegen.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\escodegen\bin\escodegen.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/escodegen.ps1
generated
vendored
Normal file
18
node_modules/.bin/escodegen.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../escodegen/bin/escodegen.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../escodegen/bin/escodegen.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
16
node_modules/.bin/esgenerate
generated
vendored
16
node_modules/.bin/esgenerate
generated
vendored
@@ -1 +1,15 @@
|
||||
../escodegen/bin/esgenerate.js
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../escodegen/bin/esgenerate.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../escodegen/bin/esgenerate.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
17
node_modules/.bin/esgenerate.cmd
generated
vendored
Normal file
17
node_modules/.bin/esgenerate.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\escodegen\bin\esgenerate.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/esgenerate.ps1
generated
vendored
Normal file
18
node_modules/.bin/esgenerate.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../escodegen/bin/esgenerate.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../escodegen/bin/esgenerate.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
16
node_modules/.bin/esparse
generated
vendored
16
node_modules/.bin/esparse
generated
vendored
@@ -1 +1,15 @@
|
||||
../esprima/bin/esparse.js
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../esprima/bin/esparse.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
17
node_modules/.bin/esparse.cmd
generated
vendored
Normal file
17
node_modules/.bin/esparse.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\esprima\bin\esparse.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/esparse.ps1
generated
vendored
Normal file
18
node_modules/.bin/esparse.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
16
node_modules/.bin/esvalidate
generated
vendored
16
node_modules/.bin/esvalidate
generated
vendored
@@ -1 +1,15 @@
|
||||
../esprima/bin/esvalidate.js
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
17
node_modules/.bin/esvalidate.cmd
generated
vendored
Normal file
17
node_modules/.bin/esvalidate.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\esprima\bin\esvalidate.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/esvalidate.ps1
generated
vendored
Normal file
18
node_modules/.bin/esvalidate.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
1
node_modules/.bin/jsesc
generated
vendored
1
node_modules/.bin/jsesc
generated
vendored
@@ -1 +0,0 @@
|
||||
../jsesc/bin/jsesc
|
1
node_modules/.bin/json5
generated
vendored
1
node_modules/.bin/json5
generated
vendored
@@ -1 +0,0 @@
|
||||
../json5/lib/cli.js
|
15
node_modules/.bin/latest
generated
vendored
Normal file
15
node_modules/.bin/latest
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../latest/bin/latest.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../latest/bin/latest.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/.bin/latest.cmd
generated
vendored
Normal file
17
node_modules/.bin/latest.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\latest\bin\latest.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/latest.ps1
generated
vendored
Normal file
18
node_modules/.bin/latest.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../latest/bin/latest.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../latest/bin/latest.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
1
node_modules/.bin/loose-envify
generated
vendored
1
node_modules/.bin/loose-envify
generated
vendored
@@ -1 +0,0 @@
|
||||
../loose-envify/cli.js
|
1
node_modules/.bin/minify
generated
vendored
1
node_modules/.bin/minify
generated
vendored
@@ -1 +0,0 @@
|
||||
../babel-minify/bin/minify.js
|
1
node_modules/.bin/mkdirp
generated
vendored
1
node_modules/.bin/mkdirp
generated
vendored
@@ -1 +0,0 @@
|
||||
../mkdirp/bin/cmd.js
|
15
node_modules/.bin/npm
generated
vendored
Normal file
15
node_modules/.bin/npm
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../npm/bin/npm-cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../npm/bin/npm-cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/.bin/npm.cmd
generated
vendored
Normal file
17
node_modules/.bin/npm.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\npm\bin\npm-cli.js" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/npm.ps1
generated
vendored
Normal file
18
node_modules/.bin/npm.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../npm/bin/npm-cli.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../npm/bin/npm-cli.js" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
1
node_modules/.bin/semver
generated
vendored
1
node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
||||
../semver/bin/semver
|
1
node_modules/.bin/sshpk-conv
generated
vendored
1
node_modules/.bin/sshpk-conv
generated
vendored
@@ -1 +0,0 @@
|
||||
../sshpk/bin/sshpk-conv
|
1
node_modules/.bin/sshpk-sign
generated
vendored
1
node_modules/.bin/sshpk-sign
generated
vendored
@@ -1 +0,0 @@
|
||||
../sshpk/bin/sshpk-sign
|
1
node_modules/.bin/sshpk-verify
generated
vendored
1
node_modules/.bin/sshpk-verify
generated
vendored
@@ -1 +0,0 @@
|
||||
../sshpk/bin/sshpk-verify
|
15
node_modules/.bin/terser
generated
vendored
Symbolic link
15
node_modules/.bin/terser
generated
vendored
Symbolic link
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../terser/bin/terser" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../terser/bin/terser" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
17
node_modules/.bin/terser.cmd
generated
vendored
Normal file
17
node_modules/.bin/terser.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
"%_prog%" "%dp0%\..\terser\bin\terser" %*
|
||||
ENDLOCAL
|
||||
EXIT /b %errorlevel%
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
18
node_modules/.bin/terser.ps1
generated
vendored
Normal file
18
node_modules/.bin/terser.ps1
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
& "$basedir/node$exe" "$basedir/../terser/bin/terser" $args
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
& "node$exe" "$basedir/../terser/bin/terser" $args
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
1
node_modules/.bin/uuid
generated
vendored
1
node_modules/.bin/uuid
generated
vendored
@@ -1 +0,0 @@
|
||||
../uuid/bin/uuid
|
142
node_modules/@babel/code-frame/README.md
generated
vendored
142
node_modules/@babel/code-frame/README.md
generated
vendored
@@ -1,142 +0,0 @@
|
||||
# @babel/code-frame
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/code-frame
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { codeFrameColumns } from '@babel/code-frame';
|
||||
|
||||
const rawLines = `class Foo {
|
||||
constructor()
|
||||
}`;
|
||||
const location = { start: { line: 2, column: 16 } };
|
||||
|
||||
const result = codeFrameColumns(rawLines, location, { /* options */ });
|
||||
|
||||
console.log(result);
|
||||
```
|
||||
|
||||
```
|
||||
1 | class Foo {
|
||||
> 2 | constructor()
|
||||
| ^
|
||||
3 | }
|
||||
```
|
||||
|
||||
If the column number is not known, you may omit it.
|
||||
|
||||
You can also pass an `end` hash in `location`.
|
||||
|
||||
```js
|
||||
import { codeFrameColumns } from '@babel/code-frame';
|
||||
|
||||
const rawLines = `class Foo {
|
||||
constructor() {
|
||||
console.log("hello");
|
||||
}
|
||||
}`;
|
||||
const location = { start: { line: 2, column: 17 }, end: { line: 4, column: 3 } };
|
||||
|
||||
const result = codeFrameColumns(rawLines, location, { /* options */ });
|
||||
|
||||
console.log(result);
|
||||
```
|
||||
|
||||
```
|
||||
1 | class Foo {
|
||||
> 2 | constructor() {
|
||||
| ^
|
||||
> 3 | console.log("hello");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
> 4 | }
|
||||
| ^^^
|
||||
5 | };
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `highlightCode`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Toggles syntax highlighting the code as JavaScript for terminals.
|
||||
|
||||
|
||||
### `linesAbove`
|
||||
|
||||
`number`, defaults to `2`.
|
||||
|
||||
Adjust the number of lines to show above the error.
|
||||
|
||||
### `linesBelow`
|
||||
|
||||
`number`, defaults to `3`.
|
||||
|
||||
Adjust the number of lines to show below the error.
|
||||
|
||||
### `forceColor`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`.
|
||||
|
||||
### `message`
|
||||
|
||||
`string`, otherwise nothing
|
||||
|
||||
Pass in a string to be displayed inline (if possible) next to the highlighted
|
||||
location in the code. If it can't be positioned inline, it will be placed above
|
||||
the code frame.
|
||||
|
||||
```
|
||||
1 | class Foo {
|
||||
> 2 | constructor()
|
||||
| ^ Missing {
|
||||
3 | };
|
||||
```
|
||||
|
||||
## Upgrading from prior versions
|
||||
|
||||
Prior to version 7, the only API exposed by this module was for a single line and optional column pointer. The old API will now log a deprecation warning.
|
||||
|
||||
The new API takes a `location` object, similar to what is available in an AST.
|
||||
|
||||
This is an example of the deprecated (but still available) API:
|
||||
|
||||
```js
|
||||
import codeFrame from '@babel/code-frame';
|
||||
|
||||
const rawLines = `class Foo {
|
||||
constructor()
|
||||
}`;
|
||||
const lineNumber = 2;
|
||||
const colNumber = 16;
|
||||
|
||||
const result = codeFrame(rawLines, lineNumber, colNumber, { /* options */ });
|
||||
|
||||
console.log(result);
|
||||
```
|
||||
|
||||
To get the same highlighting using the new API:
|
||||
|
||||
```js
|
||||
import { codeFrameColumns } from '@babel/code-frame';
|
||||
|
||||
const rawLines = `class Foo {
|
||||
constructor() {
|
||||
console.log("hello");
|
||||
}
|
||||
}`;
|
||||
const location = { start: { line: 2, column: 16 } };
|
||||
|
||||
const result = codeFrameColumns(rawLines, location, { /* options */ });
|
||||
|
||||
console.log(result);
|
||||
```
|
185
node_modules/@babel/code-frame/lib/index.js
generated
vendored
185
node_modules/@babel/code-frame/lib/index.js
generated
vendored
@@ -1,185 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = _default;
|
||||
|
||||
function _highlight() {
|
||||
var data = _interopRequireWildcard(require("@babel/highlight"));
|
||||
|
||||
_highlight = function _highlight() {
|
||||
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; } }
|
||||
|
||||
var deprecationWarningShown = false;
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
gutter: chalk.grey,
|
||||
marker: chalk.red.bold,
|
||||
message: chalk.red.bold
|
||||
};
|
||||
}
|
||||
|
||||
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
|
||||
function getMarkerLines(loc, source, opts) {
|
||||
var startLoc = Object.assign({}, {
|
||||
column: 0,
|
||||
line: -1
|
||||
}, loc.start);
|
||||
var endLoc = Object.assign({}, startLoc, loc.end);
|
||||
|
||||
var _ref = opts || {},
|
||||
_ref$linesAbove = _ref.linesAbove,
|
||||
linesAbove = _ref$linesAbove === void 0 ? 2 : _ref$linesAbove,
|
||||
_ref$linesBelow = _ref.linesBelow,
|
||||
linesBelow = _ref$linesBelow === void 0 ? 3 : _ref$linesBelow;
|
||||
|
||||
var startLine = startLoc.line;
|
||||
var startColumn = startLoc.column;
|
||||
var endLine = endLoc.line;
|
||||
var endColumn = endLoc.column;
|
||||
var start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
var end = Math.min(source.length, endLine + linesBelow);
|
||||
|
||||
if (startLine === -1) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (endLine === -1) {
|
||||
end = source.length;
|
||||
}
|
||||
|
||||
var lineDiff = endLine - startLine;
|
||||
var markerLines = {};
|
||||
|
||||
if (lineDiff) {
|
||||
for (var i = 0; i <= lineDiff; i++) {
|
||||
var lineNumber = i + startLine;
|
||||
|
||||
if (!startColumn) {
|
||||
markerLines[lineNumber] = true;
|
||||
} else if (i === 0) {
|
||||
var sourceLength = source[lineNumber - 1].length;
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
var _sourceLength = source[lineNumber - i].length;
|
||||
markerLines[lineNumber] = [0, _sourceLength];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (startColumn === endColumn) {
|
||||
if (startColumn) {
|
||||
markerLines[startLine] = [startColumn, 0];
|
||||
} else {
|
||||
markerLines[startLine] = true;
|
||||
}
|
||||
} else {
|
||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
start: start,
|
||||
end: end,
|
||||
markerLines: markerLines
|
||||
};
|
||||
}
|
||||
|
||||
function codeFrameColumns(rawLines, loc, opts) {
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
|
||||
var chalk = (0, _highlight().getChalk)(opts);
|
||||
var defs = getDefs(chalk);
|
||||
|
||||
var maybeHighlight = function maybeHighlight(chalkFn, string) {
|
||||
return highlighted ? chalkFn(string) : string;
|
||||
};
|
||||
|
||||
if (highlighted) rawLines = (0, _highlight().default)(rawLines, opts);
|
||||
var lines = rawLines.split(NEWLINE);
|
||||
|
||||
var _getMarkerLines = getMarkerLines(loc, lines, opts),
|
||||
start = _getMarkerLines.start,
|
||||
end = _getMarkerLines.end,
|
||||
markerLines = _getMarkerLines.markerLines;
|
||||
|
||||
var hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
var numberMaxWidth = String(end).length;
|
||||
var frame = lines.slice(start, end).map(function (line, index) {
|
||||
var number = start + 1 + index;
|
||||
var paddedNumber = (" " + number).slice(-numberMaxWidth);
|
||||
var gutter = " " + paddedNumber + " | ";
|
||||
var hasMarker = markerLines[number];
|
||||
var lastMarkerLine = !markerLines[number + 1];
|
||||
|
||||
if (hasMarker) {
|
||||
var markerLine = "";
|
||||
|
||||
if (Array.isArray(hasMarker)) {
|
||||
var markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
var numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||
}
|
||||
}
|
||||
|
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
|
||||
} else {
|
||||
return " " + maybeHighlight(defs.gutter, gutter) + line;
|
||||
}
|
||||
}).join("\n");
|
||||
|
||||
if (opts.message && !hasColumns) {
|
||||
frame = "" + " ".repeat(numberMaxWidth + 1) + opts.message + "\n" + frame;
|
||||
}
|
||||
|
||||
if (highlighted) {
|
||||
return chalk.reset(frame);
|
||||
} else {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
function _default(rawLines, lineNumber, colNumber, opts) {
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
if (!deprecationWarningShown) {
|
||||
deprecationWarningShown = true;
|
||||
var message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||
|
||||
if (process.emitWarning) {
|
||||
process.emitWarning(message, "DeprecationWarning");
|
||||
} else {
|
||||
var deprecationError = new Error(message);
|
||||
deprecationError.name = "DeprecationWarning";
|
||||
console.warn(new Error(message));
|
||||
}
|
||||
}
|
||||
|
||||
colNumber = Math.max(colNumber, 0);
|
||||
var location = {
|
||||
start: {
|
||||
column: colNumber,
|
||||
line: lineNumber
|
||||
}
|
||||
};
|
||||
return codeFrameColumns(rawLines, location, opts);
|
||||
}
|
51
node_modules/@babel/code-frame/package.json
generated
vendored
51
node_modules/@babel/code-frame/package.json
generated
vendored
@@ -1,51 +0,0 @@
|
||||
{
|
||||
"_from": "@babel/code-frame@7.0.0-beta.46",
|
||||
"_id": "@babel/code-frame@7.0.0-beta.46",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-7BKRkmYaPZm3Yff5HGZJKCz7RqZ5jUjknsXT6Gz5YKG23J3uq9hAj0epncCB0rlqmnZ8Q+UUpQB2tCR5mT37vw==",
|
||||
"_location": "/@babel/code-frame",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/code-frame@7.0.0-beta.46",
|
||||
"name": "@babel/code-frame",
|
||||
"escapedName": "@babel%2fcode-frame",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.0.0-beta.46",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.0.0-beta.46"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core",
|
||||
"/@babel/template",
|
||||
"/@babel/traverse"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.46.tgz",
|
||||
"_shasum": "e0d002100805daab1461c0fcb32a07e304f3a4f4",
|
||||
"_spec": "@babel/code-frame@7.0.0-beta.46",
|
||||
"_where": "/home/s2/Documents/Code/minifyfromhtml/node_modules/@babel/core",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/highlight": "7.0.0-beta.46"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/code-frame",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
|
||||
},
|
||||
"version": "7.0.0-beta.46"
|
||||
}
|
250
node_modules/@babel/core/README.md
generated
vendored
250
node_modules/@babel/core/README.md
generated
vendored
@@ -1,250 +0,0 @@
|
||||
# @babel/core
|
||||
|
||||
> Babel compiler core.
|
||||
|
||||
|
||||
```javascript
|
||||
var babel = require("@babel/core");
|
||||
import { transform } from "@babel/core";
|
||||
import * as babel from "@babel/core";
|
||||
```
|
||||
|
||||
All transformations will use your local configuration files (`.babelrc` or in `package.json`). See [options](#options) to disable it.
|
||||
|
||||
|
||||
## babel.transform(code: string, [options?](#options): Object, callback: Function)
|
||||
|
||||
Transforms the passed in `code`. Calling a callback with an object with the generated code,
|
||||
source map, and AST.
|
||||
|
||||
```js
|
||||
babel.transform(code, options, function(err, result) {
|
||||
result; // => { code, map, ast }
|
||||
});
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
babel.transform("code();", options, function(err, result) {
|
||||
result.code;
|
||||
result.map;
|
||||
result.ast;
|
||||
});
|
||||
```
|
||||
|
||||
### Compat Note:
|
||||
|
||||
In Babel 6, this method was synchronous and `transformSync` did not exist. For backward-compatibility,
|
||||
this function will behave synchronously if no callback is given. If you're starting with Babel 7
|
||||
and need synchronous behavior, please use `transformSync` since this backward-compat may be dropped in
|
||||
future major versions of Babel.
|
||||
|
||||
|
||||
## babel.transformSync(code: string, [options?](#options): Object)
|
||||
|
||||
Transforms the passed in `code`. Returning an object with the generated code,
|
||||
source map, and AST.
|
||||
|
||||
```js
|
||||
babel.transformSync(code, options) // => { code, map, ast }
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
var result = babel.transformSync("code();", options);
|
||||
result.code;
|
||||
result.map;
|
||||
result.ast;
|
||||
```
|
||||
|
||||
|
||||
## babel.transformFile(filename: string, [options?](#options): Object, callback: Function)
|
||||
|
||||
Asynchronously transforms the entire contents of a file.
|
||||
|
||||
```js
|
||||
babel.transformFile(filename, options, callback)
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
babel.transformFile("filename.js", options, function (err, result) {
|
||||
result; // => { code, map, ast }
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## babel.transformFileSync(filename: string, [options?](#options): Object)
|
||||
|
||||
Synchronous version of `babel.transformFile`. Returns the transformed contents of
|
||||
the `filename`.
|
||||
|
||||
```js
|
||||
babel.transformFileSync(filename, options) // => { code, map, ast }
|
||||
```
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
babel.transformFileSync("filename.js", options).code;
|
||||
```
|
||||
|
||||
|
||||
## babel.transformFromAst(ast: Object, code?: string, [options?](#options): Object, callback: Function): FileNode | null
|
||||
|
||||
Given an [AST](https://astexplorer.net/), transform it.
|
||||
|
||||
```js
|
||||
const sourceCode = "if (true) return;";
|
||||
const parsedAst = babylon.parse(sourceCode, { allowReturnOutsideFunction: true });
|
||||
babel.transformFromAst(parsedAst, sourceCode, options, function(err, result) {
|
||||
const { code, map, ast } = result;
|
||||
});
|
||||
```
|
||||
|
||||
### Compat Note:
|
||||
|
||||
In Babel 6, this method was synchronous and `transformFromAstSync` did not exist. For backward-compatibility,
|
||||
this function will behave synchronously if no callback is given. If you're starting with Babel 7
|
||||
and need synchronous behavior, please use `transformFromAstSync` since this backward-compat may be dropped in
|
||||
future major versions of Babel.
|
||||
|
||||
|
||||
## babel.transformFromAstSync(ast: Object, code?: string, [options?](#options): Object)
|
||||
|
||||
Given an [AST](https://astexplorer.net/), transform it.
|
||||
|
||||
```js
|
||||
const sourceCode = "if (true) return;";
|
||||
const parsedAst = babylon.parse(sourceCode, { allowReturnOutsideFunction: true });
|
||||
const { code, map, ast } = babel.transformFromAstSync(parsedAst, sourceCode, options);
|
||||
```
|
||||
|
||||
## babel.parse(code: string, [options?](#options): Object)
|
||||
|
||||
Given some code, parse it using Babel's standard behavior. Referenced presets and
|
||||
plugins will be loaded such that optional syntax plugins are automatically
|
||||
enabled.
|
||||
|
||||
|
||||
## Advanced APIs
|
||||
|
||||
Many systems that wrap Babel like to automatically inject plugins and presets,
|
||||
or override options. To accomplish this goal, Babel exposes several functions
|
||||
that aid in loading the configuration part-way without transforming.
|
||||
|
||||
### babel.loadOptions([options?](#options): Object)
|
||||
|
||||
Resolve Babel's options fully, resulting in an options object where:
|
||||
|
||||
* `opts.plugins` is a full list of `Plugin` instances.
|
||||
* `opts.presets` is empty and all presets are flattened into `opts`.
|
||||
* It can be safely passed back to Babel. Fields like `babelrc` have been set to
|
||||
false so that later calls to Babel will not make a second attempt to load
|
||||
config files.
|
||||
|
||||
`Plugin` instances aren't meant to be manipulated directly, but often
|
||||
callers will serialize this `opts` to JSON to use it as a cache key representing
|
||||
the options Babel has received. Caching on this isn't 100% guaranteed to
|
||||
invalidate properly, but it is the best we have at the moment.
|
||||
|
||||
|
||||
### babel.loadPartialConfig([options?](#options): Object): PartialConfig
|
||||
|
||||
To allow systems to easily manipulate and validate a user's config, this function
|
||||
resolves the plugins and presets and proceeds no further. The expectation is
|
||||
that callers will take the config's `.options`, manipulate it as then see fit
|
||||
and pass it back to Babel again.
|
||||
|
||||
* `babelrc: string | void` - The path of the `.babelrc` file, if there was one.
|
||||
* `babelignore: string | void` - The path of the `.babelignore` file, if there was one.
|
||||
* `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back to Babel again.
|
||||
* `plugins: Array<ConfigItem>` - See below.
|
||||
* `presets: Array<ConfigItem>` - See below.
|
||||
* It can be safely passed back to Babel. Fields like `babelrc` have been set
|
||||
to false so that later calls to Babel will not make a second attempt to
|
||||
load config files.
|
||||
* `hasFilesystemConfig(): boolean` - Check if the resolved config loaded any settings from the filesystem.
|
||||
|
||||
[`ConfigItem`](#configitem-type) instances expose properties to introspect the values, but each
|
||||
item should be treated as immutable. If changes are desired, the item should be
|
||||
removed from the list and replaced with either a normal Babel config value, or
|
||||
with a replacement item created by `babel.createConfigItem`. See that
|
||||
function for information about `ConfigItem` fields.
|
||||
|
||||
|
||||
### babel.createConfigItem(value: string | {} | Function | [string | {} | Function, {} | void], { dirname?: string, type?: "preset" | "plugin" }): ConfigItem
|
||||
|
||||
Allows build tooling to create and cache config items up front. If this function
|
||||
is called multiple times for a given plugin, Babel will call the plugin's function itself
|
||||
multiple times. If you have a clear set of expected plugins and presets to
|
||||
inject, pre-constructing the config items would be recommended.
|
||||
|
||||
|
||||
### `ConfigItem` type
|
||||
|
||||
Each `ConfigItem` exposes all of the information Babel knows. The fields are:
|
||||
|
||||
* `value: {} | Function` - The resolved value of the plugin.
|
||||
* `options: {} | void` - The options object passed to the plugin.
|
||||
* `dirname: string` - The path that the options are relative to.
|
||||
* `name: string | void` - The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]`
|
||||
* `file: Object | void` - Information about the plugin's file, if Babel knows it.
|
||||
* `request: string` - The file that the user requested, e.g. `"@babel/env"`
|
||||
* `resolved: string` - The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"`
|
||||
|
||||
|
||||
## Options
|
||||
|
||||
<blockquote class="babel-callout babel-callout-info">
|
||||
<h4>Babel CLI</h4>
|
||||
<p>
|
||||
You can pass these options from the Babel CLI like so:
|
||||
</p>
|
||||
<p>
|
||||
<code>babel --name<span class="o">=</span>value</code>
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
Following is a table of the options you can use:
|
||||
|
||||
| Option | Default | Description |
|
||||
| ------------------------ | -------------------- | ------------------------------- |
|
||||
| `ast` | `false` | Include the AST in the returned object |
|
||||
| `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code |
|
||||
| `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code |
|
||||
| `root` | `"."` | Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of.|
|
||||
| `configFile` | `undefined` | The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.|
|
||||
| `babelrc` | `true` | Specify whether or not to use .babelrc and .babelignore files. Not available when using the CLI, [use `--no-babelrc` instead](https://babeljs.io/docs/usage/cli/#babel-ignoring-babelrc) |
|
||||
| `babelrcRoots` | `(root)` | Specify which packages should be search for .babelrc files when they are being compiled. `true` to _always_ search, or a path string or an array of paths to packages to search inside of. Defaults to only searching the "root" package. |
|
||||
| `envName` | env vars | Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"` |
|
||||
| `code` | `true` | Enable code generation |
|
||||
| `comments` | `true` | Output comments in generated output |
|
||||
| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB |
|
||||
| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the `envName` is `production` |
|
||||
| `extends` | `null` | A path to a `.babelrc` file to extend |
|
||||
| `filename` | `"unknown"` | Filename for use in errors etc |
|
||||
| `filenameRelative` | `(filename)` | Filename relative to `sourceRoot` |
|
||||
| `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, @babel/generator |
|
||||
| `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used |
|
||||
| `highlightCode` | `true` | ANSI highlight syntax error code frames |
|
||||
| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified |
|
||||
| `inputSourceMap` | `null` | A source map object that the output source map will be based on |
|
||||
| `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) |
|
||||
| `moduleId` | `null` | Specify a custom name for module ids |
|
||||
| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) |
|
||||
| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions |
|
||||
| `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim |
|
||||
| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon |
|
||||
| `plugins` | `[]` | List of [plugins](https://babeljs.io/docs/plugins/) to load and use |
|
||||
| `presets` | `[]` | List of [presets](https://babeljs.io/docs/plugins/#presets) (a set of plugins) to load and use |
|
||||
| `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) |
|
||||
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used |
|
||||
| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map |
|
||||
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option |
|
||||
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative |
|
||||
| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to _guess_, based on the presence of ES6 `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`. |
|
||||
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.
|
223
node_modules/@babel/core/lib/config/caching.js
generated
vendored
223
node_modules/@babel/core/lib/config/caching.js
generated
vendored
@@ -1,223 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeStrongCache = makeStrongCache;
|
||||
exports.makeWeakCache = makeWeakCache;
|
||||
|
||||
function makeStrongCache(handler) {
|
||||
return makeCachedFunction(new Map(), handler);
|
||||
}
|
||||
|
||||
function makeWeakCache(handler) {
|
||||
return makeCachedFunction(new WeakMap(), handler);
|
||||
}
|
||||
|
||||
function makeCachedFunction(callCache, handler) {
|
||||
return function cachedFunction(arg, data) {
|
||||
var cachedValue = callCache.get(arg);
|
||||
|
||||
if (cachedValue) {
|
||||
for (var _iterator = cachedValue, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref2 = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref2 = _i.value;
|
||||
}
|
||||
|
||||
var _ref3 = _ref2;
|
||||
var _value = _ref3.value,
|
||||
_valid = _ref3.valid;
|
||||
if (_valid(data)) return _value;
|
||||
}
|
||||
}
|
||||
|
||||
var cache = new CacheConfigurator(data);
|
||||
var value = handler(arg, cache);
|
||||
if (!cache.configured()) cache.forever();
|
||||
cache.deactivate();
|
||||
|
||||
switch (cache.mode()) {
|
||||
case "forever":
|
||||
cachedValue = [{
|
||||
value: value,
|
||||
valid: function valid() {
|
||||
return true;
|
||||
}
|
||||
}];
|
||||
callCache.set(arg, cachedValue);
|
||||
break;
|
||||
|
||||
case "invalidate":
|
||||
cachedValue = [{
|
||||
value: value,
|
||||
valid: cache.validator()
|
||||
}];
|
||||
callCache.set(arg, cachedValue);
|
||||
break;
|
||||
|
||||
case "valid":
|
||||
if (cachedValue) {
|
||||
cachedValue.push({
|
||||
value: value,
|
||||
valid: cache.validator()
|
||||
});
|
||||
} else {
|
||||
cachedValue = [{
|
||||
value: value,
|
||||
valid: cache.validator()
|
||||
}];
|
||||
callCache.set(arg, cachedValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
var CacheConfigurator = function () {
|
||||
function CacheConfigurator(data) {
|
||||
this._active = true;
|
||||
this._never = false;
|
||||
this._forever = false;
|
||||
this._invalidate = false;
|
||||
this._configured = false;
|
||||
this._pairs = [];
|
||||
this._data = data;
|
||||
}
|
||||
|
||||
var _proto = CacheConfigurator.prototype;
|
||||
|
||||
_proto.simple = function simple() {
|
||||
return makeSimpleConfigurator(this);
|
||||
};
|
||||
|
||||
_proto.mode = function mode() {
|
||||
if (this._never) return "never";
|
||||
if (this._forever) return "forever";
|
||||
if (this._invalidate) return "invalidate";
|
||||
return "valid";
|
||||
};
|
||||
|
||||
_proto.forever = function forever() {
|
||||
if (!this._active) {
|
||||
throw new Error("Cannot change caching after evaluation has completed.");
|
||||
}
|
||||
|
||||
if (this._never) {
|
||||
throw new Error("Caching has already been configured with .never()");
|
||||
}
|
||||
|
||||
this._forever = true;
|
||||
this._configured = true;
|
||||
};
|
||||
|
||||
_proto.never = function never() {
|
||||
if (!this._active) {
|
||||
throw new Error("Cannot change caching after evaluation has completed.");
|
||||
}
|
||||
|
||||
if (this._forever) {
|
||||
throw new Error("Caching has already been configured with .forever()");
|
||||
}
|
||||
|
||||
this._never = true;
|
||||
this._configured = true;
|
||||
};
|
||||
|
||||
_proto.using = function using(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._configured = true;
|
||||
var key = handler(this._data);
|
||||
|
||||
this._pairs.push([key, handler]);
|
||||
|
||||
return key;
|
||||
};
|
||||
|
||||
_proto.invalidate = function 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;
|
||||
var key = handler(this._data);
|
||||
|
||||
this._pairs.push([key, handler]);
|
||||
|
||||
return key;
|
||||
};
|
||||
|
||||
_proto.validator = function validator() {
|
||||
var pairs = this._pairs;
|
||||
return function (data) {
|
||||
return pairs.every(function (_ref4) {
|
||||
var key = _ref4[0],
|
||||
fn = _ref4[1];
|
||||
return key === fn(data);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
_proto.deactivate = function deactivate() {
|
||||
this._active = false;
|
||||
};
|
||||
|
||||
_proto.configured = function configured() {
|
||||
return this._configured;
|
||||
};
|
||||
|
||||
return CacheConfigurator;
|
||||
}();
|
||||
|
||||
function makeSimpleConfigurator(cache) {
|
||||
function cacheFn(val) {
|
||||
if (typeof val === "boolean") {
|
||||
if (val) cache.forever();else cache.never();
|
||||
return;
|
||||
}
|
||||
|
||||
return cache.using(val);
|
||||
}
|
||||
|
||||
cacheFn.forever = function () {
|
||||
return cache.forever();
|
||||
};
|
||||
|
||||
cacheFn.never = function () {
|
||||
return cache.never();
|
||||
};
|
||||
|
||||
cacheFn.using = function (cb) {
|
||||
return cache.using(function () {
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
cacheFn.invalidate = function (cb) {
|
||||
return cache.invalidate(function () {
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
||||
return cacheFn;
|
||||
}
|
558
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
558
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
@@ -1,558 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.buildRootChain = buildRootChain;
|
||||
exports.buildPresetChain = void 0;
|
||||
|
||||
function _path() {
|
||||
var data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _micromatch() {
|
||||
var data = _interopRequireDefault(require("micromatch"));
|
||||
|
||||
_micromatch = function _micromatch() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _debug() {
|
||||
var data = _interopRequireDefault(require("debug"));
|
||||
|
||||
_debug = function _debug() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _options = require("./validation/options");
|
||||
|
||||
var _files = require("./files");
|
||||
|
||||
var _caching = require("./caching");
|
||||
|
||||
var _configDescriptors = require("./config-descriptors");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var debug = (0, _debug().default)("babel:config:config-chain");
|
||||
var buildPresetChain = makeChainWalker({
|
||||
init: function init(arg) {
|
||||
return arg;
|
||||
},
|
||||
root: function root(preset) {
|
||||
return loadPresetDescriptors(preset);
|
||||
},
|
||||
env: function env(preset, envName) {
|
||||
return loadPresetEnvDescriptors(preset)(envName);
|
||||
},
|
||||
overrides: function overrides(preset, index) {
|
||||
return loadPresetOverridesDescriptors(preset)(index);
|
||||
},
|
||||
overridesEnv: function overridesEnv(preset, index, envName) {
|
||||
return loadPresetOverridesEnvDescriptors(preset)(index)(envName);
|
||||
}
|
||||
});
|
||||
exports.buildPresetChain = buildPresetChain;
|
||||
var loadPresetDescriptors = (0, _caching.makeWeakCache)(function (preset) {
|
||||
return buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors);
|
||||
});
|
||||
var loadPresetEnvDescriptors = (0, _caching.makeWeakCache)(function (preset) {
|
||||
return (0, _caching.makeStrongCache)(function (envName) {
|
||||
return buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName);
|
||||
});
|
||||
});
|
||||
var loadPresetOverridesDescriptors = (0, _caching.makeWeakCache)(function (preset) {
|
||||
return (0, _caching.makeStrongCache)(function (index) {
|
||||
return buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index);
|
||||
});
|
||||
});
|
||||
var loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCache)(function (preset) {
|
||||
return (0, _caching.makeStrongCache)(function (index) {
|
||||
return (0, _caching.makeStrongCache)(function (envName) {
|
||||
return buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function buildRootChain(opts, context) {
|
||||
var programmaticChain = loadProgrammaticChain({
|
||||
options: opts,
|
||||
dirname: context.cwd
|
||||
}, context);
|
||||
if (!programmaticChain) return null;
|
||||
var _opts$root = opts.root,
|
||||
rootDir = _opts$root === void 0 ? "." : _opts$root,
|
||||
_opts$babelrc = opts.babelrc,
|
||||
babelrc = _opts$babelrc === void 0 ? true : _opts$babelrc,
|
||||
babelrcRoots = opts.babelrcRoots,
|
||||
_opts$configFile = opts.configFile,
|
||||
configFileName = _opts$configFile === void 0 ? true : _opts$configFile;
|
||||
|
||||
var absoluteRoot = _path().default.resolve(context.cwd, rootDir);
|
||||
|
||||
var configFile;
|
||||
|
||||
if (typeof configFileName === "string") {
|
||||
configFile = (0, _files.loadConfig)(configFileName, context.cwd, context.envName);
|
||||
} else if (configFileName === true) {
|
||||
configFile = (0, _files.findRootConfig)(absoluteRoot, context.envName);
|
||||
}
|
||||
|
||||
var configFileChain = emptyChain();
|
||||
|
||||
if (configFile) {
|
||||
var result = loadFileChain(configFile, context);
|
||||
if (!result) return null;
|
||||
mergeChain(configFileChain, result);
|
||||
}
|
||||
|
||||
var pkgData = typeof context.filename === "string" ? (0, _files.findPackageData)(context.filename) : null;
|
||||
var ignoreFile, babelrcFile;
|
||||
var fileChain = emptyChain();
|
||||
|
||||
if (babelrc && pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, absoluteRoot)) {
|
||||
var _findRelativeConfig = (0, _files.findRelativeConfig)(pkgData, context.envName);
|
||||
|
||||
ignoreFile = _findRelativeConfig.ignore;
|
||||
babelrcFile = _findRelativeConfig.config;
|
||||
|
||||
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (babelrcFile) {
|
||||
var _result = loadFileChain(babelrcFile, context);
|
||||
|
||||
if (!_result) return null;
|
||||
mergeChain(fileChain, _result);
|
||||
}
|
||||
}
|
||||
|
||||
var chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
|
||||
return {
|
||||
plugins: dedupDescriptors(chain.plugins),
|
||||
presets: dedupDescriptors(chain.presets),
|
||||
options: chain.options.map(function (o) {
|
||||
return normalizeOptions(o);
|
||||
}),
|
||||
ignore: ignoreFile || undefined,
|
||||
babelrc: babelrcFile || undefined,
|
||||
config: configFile || undefined
|
||||
};
|
||||
}
|
||||
|
||||
function babelrcLoadEnabled(context, pkgData, babelrcRoots, absoluteRoot) {
|
||||
if (typeof babelrcRoots === "boolean") return babelrcRoots;
|
||||
|
||||
if (babelrcRoots === undefined) {
|
||||
return pkgData.directories.indexOf(absoluteRoot) !== -1;
|
||||
}
|
||||
|
||||
var babelrcPatterns = babelrcRoots;
|
||||
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
|
||||
babelrcPatterns = babelrcPatterns.map(function (pat) {
|
||||
return _path().default.resolve(context.cwd, pat);
|
||||
});
|
||||
|
||||
if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {
|
||||
return pkgData.directories.indexOf(absoluteRoot) !== -1;
|
||||
}
|
||||
|
||||
return (0, _micromatch().default)(pkgData.directories, babelrcPatterns).length > 0;
|
||||
}
|
||||
|
||||
var loadProgrammaticChain = makeChainWalker({
|
||||
init: function init(arg) {
|
||||
return arg;
|
||||
},
|
||||
root: function root(input) {
|
||||
return buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors);
|
||||
},
|
||||
env: function env(input, envName) {
|
||||
return buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName);
|
||||
},
|
||||
overrides: function overrides(input, index) {
|
||||
return buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index);
|
||||
},
|
||||
overridesEnv: function overridesEnv(input, index, envName) {
|
||||
return buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName);
|
||||
}
|
||||
});
|
||||
var loadFileChain = makeChainWalker({
|
||||
init: function init(input) {
|
||||
return validateFile(input);
|
||||
},
|
||||
root: function root(file) {
|
||||
return loadFileDescriptors(file);
|
||||
},
|
||||
env: function env(file, envName) {
|
||||
return loadFileEnvDescriptors(file)(envName);
|
||||
},
|
||||
overrides: function overrides(file, index) {
|
||||
return loadFileOverridesDescriptors(file)(index);
|
||||
},
|
||||
overridesEnv: function overridesEnv(file, index, envName) {
|
||||
return loadFileOverridesEnvDescriptors(file)(index)(envName);
|
||||
}
|
||||
});
|
||||
var validateFile = (0, _caching.makeWeakCache)(function (file) {
|
||||
return {
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: (0, _options.validate)("file", file.options)
|
||||
};
|
||||
});
|
||||
var loadFileDescriptors = (0, _caching.makeWeakCache)(function (file) {
|
||||
return buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors);
|
||||
});
|
||||
var loadFileEnvDescriptors = (0, _caching.makeWeakCache)(function (file) {
|
||||
return (0, _caching.makeStrongCache)(function (envName) {
|
||||
return buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName);
|
||||
});
|
||||
});
|
||||
var loadFileOverridesDescriptors = (0, _caching.makeWeakCache)(function (file) {
|
||||
return (0, _caching.makeStrongCache)(function (index) {
|
||||
return buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index);
|
||||
});
|
||||
});
|
||||
var loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCache)(function (file) {
|
||||
return (0, _caching.makeStrongCache)(function (index) {
|
||||
return (0, _caching.makeStrongCache)(function (envName) {
|
||||
return buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function buildRootDescriptors(_ref, alias, descriptors) {
|
||||
var dirname = _ref.dirname,
|
||||
options = _ref.options;
|
||||
return descriptors(dirname, options, alias);
|
||||
}
|
||||
|
||||
function buildEnvDescriptors(_ref2, alias, descriptors, envName) {
|
||||
var dirname = _ref2.dirname,
|
||||
options = _ref2.options;
|
||||
var opts = options.env && options.env[envName];
|
||||
return opts ? descriptors(dirname, opts, alias + ".env[\"" + envName + "\"]") : null;
|
||||
}
|
||||
|
||||
function buildOverrideDescriptors(_ref3, alias, descriptors, index) {
|
||||
var dirname = _ref3.dirname,
|
||||
options = _ref3.options;
|
||||
var opts = options.overrides && options.overrides[index];
|
||||
if (!opts) throw new Error("Assertion failure - missing override");
|
||||
return descriptors(dirname, opts, alias + ".overrides[" + index + "]");
|
||||
}
|
||||
|
||||
function buildOverrideEnvDescriptors(_ref4, alias, descriptors, index, envName) {
|
||||
var dirname = _ref4.dirname,
|
||||
options = _ref4.options;
|
||||
var override = options.overrides && options.overrides[index];
|
||||
if (!override) throw new Error("Assertion failure - missing override");
|
||||
var opts = override.env && override.env[envName];
|
||||
return opts ? descriptors(dirname, opts, alias + ".overrides[" + index + "].env[\"" + envName + "\"]") : null;
|
||||
}
|
||||
|
||||
function makeChainWalker(_ref5) {
|
||||
var init = _ref5.init,
|
||||
root = _ref5.root,
|
||||
env = _ref5.env,
|
||||
overrides = _ref5.overrides,
|
||||
overridesEnv = _ref5.overridesEnv;
|
||||
return function (arg, context, files) {
|
||||
if (files === void 0) {
|
||||
files = new Set();
|
||||
}
|
||||
|
||||
var input = init(arg);
|
||||
var dirname = input.dirname;
|
||||
var flattenedConfigs = [];
|
||||
var rootOpts = root(input);
|
||||
|
||||
if (configIsApplicable(rootOpts, dirname, context)) {
|
||||
flattenedConfigs.push(rootOpts);
|
||||
var envOpts = env(input, context.envName);
|
||||
|
||||
if (envOpts && configIsApplicable(envOpts, dirname, context)) {
|
||||
flattenedConfigs.push(envOpts);
|
||||
}
|
||||
|
||||
(rootOpts.options.overrides || []).forEach(function (_, index) {
|
||||
var overrideOps = overrides(input, index);
|
||||
|
||||
if (configIsApplicable(overrideOps, dirname, context)) {
|
||||
flattenedConfigs.push(overrideOps);
|
||||
var overrideEnvOpts = overridesEnv(input, index, context.envName);
|
||||
|
||||
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) {
|
||||
flattenedConfigs.push(overrideEnvOpts);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (flattenedConfigs.some(function (_ref6) {
|
||||
var _ref6$options = _ref6.options,
|
||||
ignore = _ref6$options.ignore,
|
||||
only = _ref6$options.only;
|
||||
return shouldIgnore(context, ignore, only, dirname);
|
||||
})) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var chain = emptyChain();
|
||||
|
||||
for (var _i = 0; _i < flattenedConfigs.length; _i++) {
|
||||
var op = flattenedConfigs[_i];
|
||||
|
||||
if (!mergeExtendsChain(chain, op.options, dirname, context, files)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
mergeChainOpts(chain, op);
|
||||
}
|
||||
|
||||
return chain;
|
||||
};
|
||||
}
|
||||
|
||||
function mergeExtendsChain(chain, opts, dirname, context, files) {
|
||||
if (opts.extends === undefined) return true;
|
||||
var file = (0, _files.loadConfig)(opts.extends, dirname, context.envName);
|
||||
|
||||
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, function (file) {
|
||||
return " - " + file.filepath;
|
||||
}).join("\n"));
|
||||
}
|
||||
|
||||
files.add(file);
|
||||
var fileChain = loadFileChain(file, context, files);
|
||||
files.delete(file);
|
||||
if (!fileChain) return false;
|
||||
mergeChain(chain, fileChain);
|
||||
return true;
|
||||
}
|
||||
|
||||
function mergeChain(target, source) {
|
||||
var _target$options, _target$plugins, _target$presets;
|
||||
|
||||
(_target$options = target.options).push.apply(_target$options, source.options);
|
||||
|
||||
(_target$plugins = target.plugins).push.apply(_target$plugins, source.plugins);
|
||||
|
||||
(_target$presets = target.presets).push.apply(_target$presets, source.presets);
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
function mergeChainOpts(target, _ref7) {
|
||||
var _target$plugins2, _target$presets2;
|
||||
|
||||
var options = _ref7.options,
|
||||
plugins = _ref7.plugins,
|
||||
presets = _ref7.presets;
|
||||
target.options.push(options);
|
||||
|
||||
(_target$plugins2 = target.plugins).push.apply(_target$plugins2, plugins());
|
||||
|
||||
(_target$presets2 = target.presets).push.apply(_target$presets2, presets());
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
function emptyChain() {
|
||||
return {
|
||||
options: [],
|
||||
presets: [],
|
||||
plugins: []
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeOptions(opts) {
|
||||
var options = Object.assign({}, opts);
|
||||
delete options.extends;
|
||||
delete options.env;
|
||||
delete options.plugins;
|
||||
delete options.presets;
|
||||
delete options.passPerPreset;
|
||||
delete options.ignore;
|
||||
delete options.only;
|
||||
|
||||
if (options.sourceMap) {
|
||||
options.sourceMaps = options.sourceMap;
|
||||
delete options.sourceMap;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function dedupDescriptors(items) {
|
||||
var map = new Map();
|
||||
var descriptors = [];
|
||||
|
||||
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref8;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i2 >= _iterator.length) break;
|
||||
_ref8 = _iterator[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator.next();
|
||||
if (_i2.done) break;
|
||||
_ref8 = _i2.value;
|
||||
}
|
||||
|
||||
var item = _ref8;
|
||||
|
||||
if (typeof item.value === "function") {
|
||||
var fnKey = item.value;
|
||||
var nameMap = map.get(fnKey);
|
||||
|
||||
if (!nameMap) {
|
||||
nameMap = new Map();
|
||||
map.set(fnKey, nameMap);
|
||||
}
|
||||
|
||||
var desc = nameMap.get(item.name);
|
||||
|
||||
if (!desc) {
|
||||
desc = {
|
||||
value: null
|
||||
};
|
||||
descriptors.push(desc);
|
||||
if (!item.ownPass) nameMap.set(item.name, desc);
|
||||
}
|
||||
|
||||
if (item.options === false) {
|
||||
desc.value = null;
|
||||
} else {
|
||||
desc.value = item;
|
||||
}
|
||||
} else {
|
||||
descriptors.push({
|
||||
value: item
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return descriptors.reduce(function (acc, desc) {
|
||||
if (desc.value) acc.push(desc.value);
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
|
||||
function configIsApplicable(_ref9, dirname, context) {
|
||||
var options = _ref9.options;
|
||||
return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname));
|
||||
}
|
||||
|
||||
function configFieldIsApplicable(context, test, dirname) {
|
||||
if (context.filename === null) {
|
||||
throw new Error("Configuration contains explicit test/include/exclude checks, but no filename was passed to Babel");
|
||||
}
|
||||
|
||||
var ctx = context;
|
||||
var patterns = Array.isArray(test) ? test : [test];
|
||||
return matchesPatterns(ctx, patterns, dirname, false);
|
||||
}
|
||||
|
||||
function shouldIgnore(context, ignore, only, dirname) {
|
||||
if (ignore) {
|
||||
if (context.filename === null) {
|
||||
throw new Error("Configuration contains ignore checks, but no filename was passed to Babel");
|
||||
}
|
||||
|
||||
var ctx = context;
|
||||
|
||||
if (matchesPatterns(ctx, ignore, dirname)) {
|
||||
debug("Ignored %o because it matched one of %O from %o", context.filename, ignore, dirname);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (only) {
|
||||
if (context.filename === null) {
|
||||
throw new Error("Configuration contains ignore checks, but no filename was passed to Babel");
|
||||
}
|
||||
|
||||
var _ctx = context;
|
||||
|
||||
if (!matchesPatterns(_ctx, only, dirname)) {
|
||||
debug("Ignored %o because it failed to match one of %O from %o", context.filename, only, dirname);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function matchesPatterns(context, patterns, dirname, allowNegation) {
|
||||
if (allowNegation === void 0) {
|
||||
allowNegation = true;
|
||||
}
|
||||
|
||||
var res = [];
|
||||
var strings = [];
|
||||
var fns = [];
|
||||
patterns.forEach(function (pattern) {
|
||||
if (typeof pattern === "string") strings.push(pattern);else if (typeof pattern === "function") fns.push(pattern);else res.push(pattern);
|
||||
});
|
||||
var filename = context.filename;
|
||||
if (res.some(function (re) {
|
||||
return re.test(context.filename);
|
||||
})) return true;
|
||||
if (fns.some(function (fn) {
|
||||
return fn(filename);
|
||||
})) return true;
|
||||
|
||||
if (strings.length > 0) {
|
||||
var possibleDirs = getPossibleDirs(context);
|
||||
var absolutePatterns = strings.map(function (pattern) {
|
||||
var negate = pattern[0] === "!";
|
||||
|
||||
if (negate && !allowNegation) {
|
||||
throw new Error("Negation of file paths is not supported.");
|
||||
}
|
||||
|
||||
if (negate) pattern = pattern.slice(1);
|
||||
return (negate ? "!" : "") + _path().default.resolve(dirname, pattern);
|
||||
});
|
||||
|
||||
if ((0, _micromatch().default)(possibleDirs, absolutePatterns, {
|
||||
nocase: true,
|
||||
nonegate: !allowNegation
|
||||
}).length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var getPossibleDirs = (0, _caching.makeWeakCache)(function (context) {
|
||||
var current = context.filename;
|
||||
if (current === null) return [];
|
||||
var possibleDirs = [current];
|
||||
|
||||
while (true) {
|
||||
var previous = current;
|
||||
current = _path().default.dirname(current);
|
||||
if (previous === current) break;
|
||||
possibleDirs.push(current);
|
||||
}
|
||||
|
||||
return possibleDirs;
|
||||
});
|
225
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
225
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
@@ -1,225 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createCachedDescriptors = createCachedDescriptors;
|
||||
exports.createUncachedDescriptors = createUncachedDescriptors;
|
||||
exports.createDescriptor = createDescriptor;
|
||||
|
||||
var _files = require("./files");
|
||||
|
||||
var _item = require("./item");
|
||||
|
||||
var _caching = require("./caching");
|
||||
|
||||
function createCachedDescriptors(dirname, options, alias) {
|
||||
var plugins = options.plugins,
|
||||
presets = options.presets,
|
||||
passPerPreset = options.passPerPreset;
|
||||
return {
|
||||
options: options,
|
||||
plugins: plugins ? function () {
|
||||
return createCachedPluginDescriptors(plugins, dirname)(alias);
|
||||
} : function () {
|
||||
return [];
|
||||
},
|
||||
presets: presets ? function () {
|
||||
return createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset);
|
||||
} : function () {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function createUncachedDescriptors(dirname, options, alias) {
|
||||
var plugins;
|
||||
var presets;
|
||||
return {
|
||||
options: options,
|
||||
plugins: function (_plugins) {
|
||||
function plugins() {
|
||||
return _plugins.apply(this, arguments);
|
||||
}
|
||||
|
||||
plugins.toString = function () {
|
||||
return _plugins.toString();
|
||||
};
|
||||
|
||||
return plugins;
|
||||
}(function () {
|
||||
if (!plugins) {
|
||||
plugins = createPluginDescriptors(options.plugins || [], dirname, alias);
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}),
|
||||
presets: function (_presets) {
|
||||
function presets() {
|
||||
return _presets.apply(this, arguments);
|
||||
}
|
||||
|
||||
presets.toString = function () {
|
||||
return _presets.toString();
|
||||
};
|
||||
|
||||
return presets;
|
||||
}(function () {
|
||||
if (!presets) {
|
||||
presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);
|
||||
}
|
||||
|
||||
return presets;
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
var createCachedPresetDescriptors = (0, _caching.makeWeakCache)(function (items, cache) {
|
||||
var dirname = cache.using(function (dir) {
|
||||
return dir;
|
||||
});
|
||||
return (0, _caching.makeStrongCache)(function (alias) {
|
||||
return (0, _caching.makeStrongCache)(function (passPerPreset) {
|
||||
return createPresetDescriptors(items, dirname, alias, passPerPreset);
|
||||
});
|
||||
});
|
||||
});
|
||||
var createCachedPluginDescriptors = (0, _caching.makeWeakCache)(function (items, cache) {
|
||||
var dirname = cache.using(function (dir) {
|
||||
return dir;
|
||||
});
|
||||
return (0, _caching.makeStrongCache)(function (alias) {
|
||||
return createPluginDescriptors(items, dirname, alias);
|
||||
});
|
||||
});
|
||||
|
||||
function createPresetDescriptors(items, dirname, alias, passPerPreset) {
|
||||
return createDescriptors("preset", items, dirname, alias, passPerPreset);
|
||||
}
|
||||
|
||||
function createPluginDescriptors(items, dirname, alias) {
|
||||
return createDescriptors("plugin", items, dirname, alias);
|
||||
}
|
||||
|
||||
function createDescriptors(type, items, dirname, alias, ownPass) {
|
||||
var descriptors = items.map(function (item, index) {
|
||||
return createDescriptor(item, dirname, {
|
||||
type: type,
|
||||
alias: alias + "$" + index,
|
||||
ownPass: !!ownPass
|
||||
});
|
||||
});
|
||||
assertNoDuplicates(descriptors);
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
function createDescriptor(pair, dirname, _ref) {
|
||||
var type = _ref.type,
|
||||
alias = _ref.alias,
|
||||
ownPass = _ref.ownPass;
|
||||
var desc = (0, _item.getItemDescriptor)(pair);
|
||||
|
||||
if (desc) {
|
||||
return desc;
|
||||
}
|
||||
|
||||
var name;
|
||||
var options;
|
||||
var value = pair;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length === 3) {
|
||||
var _value = value;
|
||||
value = _value[0];
|
||||
options = _value[1];
|
||||
name = _value[2];
|
||||
} else {
|
||||
var _value2 = value;
|
||||
value = _value2[0];
|
||||
options = _value2[1];
|
||||
}
|
||||
}
|
||||
|
||||
var file = undefined;
|
||||
var filepath = null;
|
||||
|
||||
if (typeof value === "string") {
|
||||
if (typeof type !== "string") {
|
||||
throw new Error("To resolve a string-based item, the type of item must be given");
|
||||
}
|
||||
|
||||
var resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset;
|
||||
var _request = value;
|
||||
|
||||
var _resolver = resolver(value, dirname);
|
||||
|
||||
filepath = _resolver.filepath;
|
||||
value = _resolver.value;
|
||||
file = {
|
||||
request: _request,
|
||||
resolved: filepath
|
||||
};
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
throw new Error("Unexpected falsy value: " + String(value));
|
||||
}
|
||||
|
||||
if (typeof value === "object" && value.__esModule) {
|
||||
if (value.default) {
|
||||
value = value.default;
|
||||
} else {
|
||||
throw new Error("Must export a default export when using ES6 modules.");
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof value !== "object" && typeof value !== "function") {
|
||||
throw new Error("Unsupported format: " + typeof value + ". Expected an object or a function.");
|
||||
}
|
||||
|
||||
if (filepath !== null && typeof value === "object" && value) {
|
||||
throw new Error("Plugin/Preset files are not allowed to export objects, only functions. In " + filepath);
|
||||
}
|
||||
|
||||
return {
|
||||
name: name,
|
||||
alias: filepath || alias,
|
||||
value: value,
|
||||
options: options,
|
||||
dirname: dirname,
|
||||
ownPass: ownPass,
|
||||
file: file
|
||||
};
|
||||
}
|
||||
|
||||
function assertNoDuplicates(items) {
|
||||
var map = new Map();
|
||||
|
||||
for (var _iterator = items, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref2 = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref2 = _i.value;
|
||||
}
|
||||
|
||||
var item = _ref2;
|
||||
if (typeof item.value !== "function") continue;
|
||||
var nameMap = map.get(item.value);
|
||||
|
||||
if (!nameMap) {
|
||||
nameMap = new Set();
|
||||
map.set(item.value, nameMap);
|
||||
}
|
||||
|
||||
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 neen separate names, e.g.", "", " plugins: [", " ['some-plugin', {}],", " ['some-plugin', {}, 'some unique name'],", " ]"].join("\n"));
|
||||
}
|
||||
|
||||
nameMap.add(item.name);
|
||||
}
|
||||
}
|
283
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
283
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
@@ -1,283 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
|
||||
function _debug() {
|
||||
var data = _interopRequireDefault(require("debug"));
|
||||
|
||||
_debug = function _debug() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
var data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
var data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function _fs() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _json() {
|
||||
var data = _interopRequireDefault(require("json5"));
|
||||
|
||||
_json = function _json() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _resolve() {
|
||||
var data = _interopRequireDefault(require("resolve"));
|
||||
|
||||
_resolve = function _resolve() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _caching = require("../caching");
|
||||
|
||||
var _configApi = _interopRequireDefault(require("../helpers/config-api"));
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var debug = (0, _debug().default)("babel:config:loading:files:configuration");
|
||||
var BABEL_CONFIG_JS_FILENAME = "babel.config.js";
|
||||
var BABELRC_FILENAME = ".babelrc";
|
||||
var BABELRC_JS_FILENAME = ".babelrc.js";
|
||||
var BABELIGNORE_FILENAME = ".babelignore";
|
||||
|
||||
function findRelativeConfig(packageData, envName) {
|
||||
var config = null;
|
||||
var ignore = null;
|
||||
|
||||
var dirname = _path().default.dirname(packageData.filepath);
|
||||
|
||||
var _loop = function _loop() {
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) return "break";
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) return "break";
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var loc = _ref;
|
||||
|
||||
if (!config) {
|
||||
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce(function (previousConfig, name) {
|
||||
var filepath = _path().default.join(loc, name);
|
||||
|
||||
var config = readConfig(filepath, envName);
|
||||
|
||||
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);
|
||||
var 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);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignore) {
|
||||
var ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
|
||||
|
||||
ignore = readIgnoreConfig(ignoreLoc);
|
||||
|
||||
if (ignore) {
|
||||
debug("Found ignore %o from %o.", ignore.filepath, dirname);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (var _iterator = packageData.directories, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
var _ret = _loop();
|
||||
|
||||
if (_ret === "break") break;
|
||||
}
|
||||
|
||||
return {
|
||||
config: config,
|
||||
ignore: ignore
|
||||
};
|
||||
}
|
||||
|
||||
function findRootConfig(dirname, envName) {
|
||||
var filepath = _path().default.resolve(dirname, BABEL_CONFIG_JS_FILENAME);
|
||||
|
||||
var conf = readConfig(filepath, envName);
|
||||
|
||||
if (conf) {
|
||||
debug("Found root config %o in $o.", BABEL_CONFIG_JS_FILENAME, dirname);
|
||||
}
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
function loadConfig(name, dirname, envName) {
|
||||
var filepath = _resolve().default.sync(name, {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
var conf = readConfig(filepath, envName);
|
||||
|
||||
if (!conf) {
|
||||
throw new Error("Config file " + filepath + " contains no configuration data");
|
||||
}
|
||||
|
||||
debug("Loaded config %o from $o.", name, dirname);
|
||||
return conf;
|
||||
}
|
||||
|
||||
function readConfig(filepath, envName) {
|
||||
return _path().default.extname(filepath) === ".js" ? readConfigJS(filepath, {
|
||||
envName: envName
|
||||
}) : readConfigJSON5(filepath);
|
||||
}
|
||||
|
||||
var LOADING_CONFIGS = new Set();
|
||||
var readConfigJS = (0, _caching.makeStrongCache)(function (filepath, cache) {
|
||||
if (!_fs().default.existsSync(filepath)) {
|
||||
cache.forever();
|
||||
return null;
|
||||
}
|
||||
|
||||
if (LOADING_CONFIGS.has(filepath)) {
|
||||
cache.never();
|
||||
debug("Auto-ignoring usage of config %o.", filepath);
|
||||
return {
|
||||
filepath: filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
options: {}
|
||||
};
|
||||
}
|
||||
|
||||
var options;
|
||||
|
||||
try {
|
||||
LOADING_CONFIGS.add(filepath);
|
||||
|
||||
var configModule = require(filepath);
|
||||
|
||||
options = configModule && configModule.__esModule ? configModule.default || undefined : configModule;
|
||||
} catch (err) {
|
||||
err.message = filepath + ": Error while loading config - " + err.message;
|
||||
throw err;
|
||||
} finally {
|
||||
LOADING_CONFIGS.delete(filepath);
|
||||
}
|
||||
|
||||
if (typeof options === "function") {
|
||||
options = options((0, _configApi.default)(cache));
|
||||
if (!cache.configured()) throwConfigError();
|
||||
}
|
||||
|
||||
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
||||
throw new Error(filepath + ": Configuration should be an exported JavaScript object.");
|
||||
}
|
||||
|
||||
if (typeof options.then === "function") {
|
||||
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.");
|
||||
}
|
||||
|
||||
return {
|
||||
filepath: filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
options: options
|
||||
};
|
||||
});
|
||||
var packageToBabelConfig = (0, _caching.makeWeakCache)(function (file) {
|
||||
if (typeof file.options.babel === "undefined") return null;
|
||||
var babel = file.options.babel;
|
||||
|
||||
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
|
||||
throw new Error(file.filepath + ": .babel property must be an object");
|
||||
}
|
||||
|
||||
return {
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: babel
|
||||
};
|
||||
});
|
||||
var readConfigJSON5 = (0, _utils.makeStaticFileCache)(function (filepath, content) {
|
||||
var options;
|
||||
|
||||
try {
|
||||
options = _json().default.parse(content);
|
||||
} catch (err) {
|
||||
err.message = filepath + ": Error while parsing config - " + err.message;
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (!options) throw new Error(filepath + ": No config detected");
|
||||
|
||||
if (typeof options !== "object") {
|
||||
throw new Error(filepath + ": Config returned typeof " + typeof options);
|
||||
}
|
||||
|
||||
if (Array.isArray(options)) {
|
||||
throw new Error(filepath + ": Expected config object but found array");
|
||||
}
|
||||
|
||||
return {
|
||||
filepath: filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
options: options
|
||||
};
|
||||
});
|
||||
var readIgnoreConfig = (0, _utils.makeStaticFileCache)(function (filepath, content) {
|
||||
var ignore = content.split("\n").map(function (line) {
|
||||
return line.replace(/#(.*?)$/, "").trim();
|
||||
}).filter(function (line) {
|
||||
return !!line;
|
||||
});
|
||||
return {
|
||||
filepath: filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
ignore: ignore
|
||||
};
|
||||
});
|
||||
|
||||
function throwConfigError() {
|
||||
throw new Error("Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured\nfor various types of caching, using the first param of their handler functions:\n\nmodule.exports = function(api) {\n // The API exposes the following:\n\n // Cache the returned value forever and don't call this function again.\n api.cache(true);\n\n // Don't cache at all. Not recommended because it will be very slow.\n api.cache(false);\n\n // Cached based on the value of some function. If this function returns a value different from\n // a previously-encountered value, the plugins will re-evaluate.\n var env = api.cache(() => process.env.NODE_ENV);\n\n // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for\n // any possible NODE_ENV value that might come up during plugin execution.\n var isProd = api.cache(() => process.env.NODE_ENV === \"production\");\n\n // .cache(fn) will perform a linear search though instances to find the matching plugin based\n // based on previous instantiated plugins. If you want to recreate the plugin and discard the\n // previous instance whenever something changes, you may use:\n var isProd = api.cache.invalidate(() => process.env.NODE_ENV === \"production\");\n\n // Note, we also expose the following more-verbose versions of the above examples:\n api.cache.forever(); // api.cache(true)\n api.cache.never(); // api.cache(false)\n api.cache.using(fn); // api.cache(fn)\n\n // Return the value that will be cached.\n return { };\n};");
|
||||
}
|
54
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
54
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
@@ -1,54 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.findPackageData = findPackageData;
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
exports.loadPlugin = loadPlugin;
|
||||
exports.loadPreset = loadPreset;
|
||||
|
||||
function findPackageData(filepath) {
|
||||
return {
|
||||
filepath: filepath,
|
||||
directories: [],
|
||||
pkg: null,
|
||||
isPackage: false
|
||||
};
|
||||
}
|
||||
|
||||
function findRelativeConfig(pkgData, envName) {
|
||||
return {
|
||||
pkg: null,
|
||||
config: null,
|
||||
ignore: null
|
||||
};
|
||||
}
|
||||
|
||||
function findRootConfig(dirname, envName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function loadConfig(name, dirname, envName) {
|
||||
throw new Error("Cannot load " + name + " relative to " + dirname + " in a browser");
|
||||
}
|
||||
|
||||
function resolvePlugin(name, dirname) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function resolvePreset(name, dirname) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function loadPlugin(name, dirname) {
|
||||
throw new Error("Cannot load plugin " + name + " relative to " + dirname + " in a browser");
|
||||
}
|
||||
|
||||
function loadPreset(name, dirname) {
|
||||
throw new Error("Cannot load preset " + name + " relative to " + dirname + " in a browser");
|
||||
}
|
61
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
61
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
@@ -1,61 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "findPackageData", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _package.findPackageData;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findRelativeConfig", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _configuration.findRelativeConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findRootConfig", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _configuration.findRootConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadConfig", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _configuration.loadConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePlugin", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _plugins.resolvePlugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePreset", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _plugins.resolvePreset;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPlugin", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _plugins.loadPlugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPreset", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _plugins.loadPreset;
|
||||
}
|
||||
});
|
||||
|
||||
var _package = require("./package");
|
||||
|
||||
var _configuration = require("./configuration");
|
||||
|
||||
var _plugins = require("./plugins");
|
||||
|
||||
({});
|
76
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
76
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
@@ -1,76 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.findPackageData = findPackageData;
|
||||
|
||||
function _path() {
|
||||
var data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var PACKAGE_FILENAME = "package.json";
|
||||
|
||||
function findPackageData(filepath) {
|
||||
var pkg = null;
|
||||
var directories = [];
|
||||
var isPackage = true;
|
||||
|
||||
var dirname = _path().default.dirname(filepath);
|
||||
|
||||
while (!pkg && _path().default.basename(dirname) !== "node_modules") {
|
||||
directories.push(dirname);
|
||||
pkg = readConfigPackage(_path().default.join(dirname, PACKAGE_FILENAME));
|
||||
|
||||
var nextLoc = _path().default.dirname(dirname);
|
||||
|
||||
if (dirname === nextLoc) {
|
||||
isPackage = false;
|
||||
break;
|
||||
}
|
||||
|
||||
dirname = nextLoc;
|
||||
}
|
||||
|
||||
return {
|
||||
filepath: filepath,
|
||||
directories: directories,
|
||||
pkg: pkg,
|
||||
isPackage: isPackage
|
||||
};
|
||||
}
|
||||
|
||||
var readConfigPackage = (0, _utils.makeStaticFileCache)(function (filepath, content) {
|
||||
var options;
|
||||
|
||||
try {
|
||||
options = JSON.parse(content);
|
||||
} catch (err) {
|
||||
err.message = filepath + ": Error while parsing JSON - " + err.message;
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (typeof options !== "object") {
|
||||
throw new Error(filepath + ": Config returned typeof " + typeof options);
|
||||
}
|
||||
|
||||
if (Array.isArray(options)) {
|
||||
throw new Error(filepath + ": Expected config object but found array");
|
||||
}
|
||||
|
||||
return {
|
||||
filepath: filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
options: options
|
||||
};
|
||||
});
|
172
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
172
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
@@ -1,172 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
exports.loadPlugin = loadPlugin;
|
||||
exports.loadPreset = loadPreset;
|
||||
|
||||
function _debug() {
|
||||
var data = _interopRequireDefault(require("debug"));
|
||||
|
||||
_debug = function _debug() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _resolve() {
|
||||
var data = _interopRequireDefault(require("resolve"));
|
||||
|
||||
_resolve = function _resolve() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
var data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var debug = (0, _debug().default)("babel:config:loading:files:plugins");
|
||||
var EXACT_RE = /^module:/;
|
||||
var BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
|
||||
var BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
|
||||
var BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
|
||||
var BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
|
||||
var OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-plugin-|[^/]+\/)/;
|
||||
var OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-preset-|[^/]+\/)/;
|
||||
|
||||
function resolvePlugin(name, dirname) {
|
||||
return resolveStandardizedName("plugin", name, dirname);
|
||||
}
|
||||
|
||||
function resolvePreset(name, dirname) {
|
||||
return resolveStandardizedName("preset", name, dirname);
|
||||
}
|
||||
|
||||
function loadPlugin(name, dirname) {
|
||||
var filepath = resolvePlugin(name, dirname);
|
||||
|
||||
if (!filepath) {
|
||||
throw new Error("Plugin " + name + " not found relative to " + dirname);
|
||||
}
|
||||
|
||||
var value = requireModule("plugin", filepath);
|
||||
debug("Loaded plugin %o from %o.", name, dirname);
|
||||
return {
|
||||
filepath: filepath,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
|
||||
function loadPreset(name, dirname) {
|
||||
var filepath = resolvePreset(name, dirname);
|
||||
|
||||
if (!filepath) {
|
||||
throw new Error("Preset " + name + " not found relative to " + dirname);
|
||||
}
|
||||
|
||||
var value = requireModule("preset", filepath);
|
||||
debug("Loaded preset %o from %o.", name, dirname);
|
||||
return {
|
||||
filepath: filepath,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
|
||||
function standardizeName(type, name) {
|
||||
if (_path().default.isAbsolute(name)) return name;
|
||||
var isPreset = type === "preset";
|
||||
return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, "babel-" + type + "-").replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, "$1" + type + "-").replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, "$1babel-" + type + "-").replace(EXACT_RE, "");
|
||||
}
|
||||
|
||||
function resolveStandardizedName(type, name, dirname) {
|
||||
if (dirname === void 0) {
|
||||
dirname = process.cwd();
|
||||
}
|
||||
|
||||
var standardizedName = standardizeName(type, name);
|
||||
|
||||
try {
|
||||
return _resolve().default.sync(standardizedName, {
|
||||
basedir: dirname
|
||||
});
|
||||
} catch (e) {
|
||||
if (e.code !== "MODULE_NOT_FOUND") throw e;
|
||||
|
||||
if (standardizedName !== name) {
|
||||
var resolvedOriginal = false;
|
||||
|
||||
try {
|
||||
_resolve().default.sync(name, {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
resolvedOriginal = true;
|
||||
} catch (e2) {}
|
||||
|
||||
if (resolvedOriginal) {
|
||||
e.message += "\n- If you want to resolve \"" + name + "\", use \"module:" + name + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
var resolvedBabel = false;
|
||||
|
||||
try {
|
||||
_resolve().default.sync(standardizeName(type, "@babel/" + name), {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
resolvedBabel = true;
|
||||
} catch (e2) {}
|
||||
|
||||
if (resolvedBabel) {
|
||||
e.message += "\n- Did you mean \"@babel/" + name + "\"?";
|
||||
}
|
||||
|
||||
var resolvedOppositeType = false;
|
||||
var oppositeType = type === "preset" ? "plugin" : "preset";
|
||||
|
||||
try {
|
||||
_resolve().default.sync(standardizeName(oppositeType, name), {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
resolvedOppositeType = true;
|
||||
} catch (e2) {}
|
||||
|
||||
if (resolvedOppositeType) {
|
||||
e.message += "\n- Did you accidentally pass a " + type + " as a " + oppositeType + "?";
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
var LOADING_MODULES = new Set();
|
||||
|
||||
function requireModule(type, name) {
|
||||
if (LOADING_MODULES.has(name)) {
|
||||
throw new Error("Reentrant " + type + " detected trying to load \"" + name + "\". This module is not ignored " + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.');
|
||||
}
|
||||
|
||||
try {
|
||||
LOADING_MODULES.add(name);
|
||||
return require(name);
|
||||
} finally {
|
||||
LOADING_MODULES.delete(name);
|
||||
}
|
||||
}
|
1
node_modules/@babel/core/lib/config/files/types.js
generated
vendored
1
node_modules/@babel/core/lib/config/files/types.js
generated
vendored
@@ -1 +0,0 @@
|
||||
"use strict";
|
43
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
43
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
@@ -1,43 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeStaticFileCache = makeStaticFileCache;
|
||||
|
||||
function _fs() {
|
||||
var data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function _fs() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _caching = require("../caching");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function makeStaticFileCache(fn) {
|
||||
return (0, _caching.makeStrongCache)(function (filepath, cache) {
|
||||
if (cache.invalidate(function () {
|
||||
return fileMtime(filepath);
|
||||
}) === null) {
|
||||
cache.forever();
|
||||
return null;
|
||||
}
|
||||
|
||||
return fn(filepath, _fs().default.readFileSync(filepath, "utf8"));
|
||||
});
|
||||
}
|
||||
|
||||
function fileMtime(filepath) {
|
||||
try {
|
||||
return +_fs().default.statSync(filepath).mtime;
|
||||
} catch (e) {
|
||||
if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
281
node_modules/@babel/core/lib/config/full.js
generated
vendored
281
node_modules/@babel/core/lib/config/full.js
generated
vendored
@@ -1,281 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadFullConfig;
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
var context = _interopRequireWildcard(require("../index"));
|
||||
|
||||
var _plugin = _interopRequireDefault(require("./plugin"));
|
||||
|
||||
var _item = require("./item");
|
||||
|
||||
var _configChain = require("./config-chain");
|
||||
|
||||
function _traverse() {
|
||||
var data = _interopRequireDefault(require("@babel/traverse"));
|
||||
|
||||
_traverse = function _traverse() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _caching = require("./caching");
|
||||
|
||||
var _options = require("./validation/options");
|
||||
|
||||
var _plugins = require("./validation/plugins");
|
||||
|
||||
var _configApi = _interopRequireDefault(require("./helpers/config-api"));
|
||||
|
||||
var _partial = _interopRequireDefault(require("./partial"));
|
||||
|
||||
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) {
|
||||
var result = (0, _partial.default)(inputOpts);
|
||||
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var options = result.options,
|
||||
context = result.context;
|
||||
var optionDefaults = {};
|
||||
var passes = [[]];
|
||||
|
||||
try {
|
||||
var plugins = options.plugins,
|
||||
presets = options.presets;
|
||||
|
||||
if (!plugins || !presets) {
|
||||
throw new Error("Assertion failure - plugins and presets exist");
|
||||
}
|
||||
|
||||
var ignored = function recurseDescriptors(config, pass) {
|
||||
var plugins = config.plugins.map(function (descriptor) {
|
||||
return loadPluginDescriptor(descriptor, context);
|
||||
});
|
||||
var presets = config.presets.map(function (descriptor) {
|
||||
return {
|
||||
preset: loadPresetDescriptor(descriptor, context),
|
||||
pass: descriptor.ownPass ? [] : pass
|
||||
};
|
||||
});
|
||||
|
||||
if (presets.length > 0) {
|
||||
passes.splice.apply(passes, [1, 0].concat(presets.map(function (o) {
|
||||
return o.pass;
|
||||
}).filter(function (p) {
|
||||
return p !== pass;
|
||||
})));
|
||||
|
||||
for (var _iterator = presets, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref2 = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref2 = _i.value;
|
||||
}
|
||||
|
||||
var _ref3 = _ref2;
|
||||
var preset = _ref3.preset,
|
||||
_pass = _ref3.pass;
|
||||
if (!preset) return true;
|
||||
|
||||
var _ignored = recurseDescriptors({
|
||||
plugins: preset.plugins,
|
||||
presets: preset.presets
|
||||
}, _pass);
|
||||
|
||||
if (_ignored) return true;
|
||||
preset.options.forEach(function (opts) {
|
||||
(0, _util.mergeOptions)(optionDefaults, opts);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (plugins.length > 0) {
|
||||
pass.unshift.apply(pass, plugins);
|
||||
}
|
||||
}({
|
||||
plugins: plugins.map(function (item) {
|
||||
var desc = (0, _item.getItemDescriptor)(item);
|
||||
|
||||
if (!desc) {
|
||||
throw new Error("Assertion failure - must be config item");
|
||||
}
|
||||
|
||||
return desc;
|
||||
}),
|
||||
presets: presets.map(function (item) {
|
||||
var desc = (0, _item.getItemDescriptor)(item);
|
||||
|
||||
if (!desc) {
|
||||
throw new Error("Assertion failure - must be config item");
|
||||
}
|
||||
|
||||
return desc;
|
||||
})
|
||||
}, passes[0]);
|
||||
|
||||
if (ignored) return null;
|
||||
} catch (e) {
|
||||
if (!/^\[BABEL\]/.test(e.message)) {
|
||||
e.message = "[BABEL] " + (context.filename || "unknown") + ": " + e.message;
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
var opts = optionDefaults;
|
||||
(0, _util.mergeOptions)(opts, options);
|
||||
opts.plugins = passes[0];
|
||||
opts.presets = passes.slice(1).filter(function (plugins) {
|
||||
return plugins.length > 0;
|
||||
}).map(function (plugins) {
|
||||
return {
|
||||
plugins: plugins
|
||||
};
|
||||
});
|
||||
opts.passPerPreset = opts.presets.length > 0;
|
||||
return {
|
||||
options: opts,
|
||||
passes: passes
|
||||
};
|
||||
}
|
||||
|
||||
var loadDescriptor = (0, _caching.makeWeakCache)(function (_ref4, cache) {
|
||||
var value = _ref4.value,
|
||||
options = _ref4.options,
|
||||
dirname = _ref4.dirname,
|
||||
alias = _ref4.alias;
|
||||
if (options === false) throw new Error("Assertion failure");
|
||||
options = options || {};
|
||||
var item = value;
|
||||
|
||||
if (typeof value === "function") {
|
||||
var api = Object.assign({}, context, (0, _configApi.default)(cache));
|
||||
|
||||
try {
|
||||
item = value(api, options, dirname);
|
||||
} catch (e) {
|
||||
if (alias) {
|
||||
e.message += " (While processing: " + JSON.stringify(alias) + ")";
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
if (!item || typeof item !== "object") {
|
||||
throw new Error("Plugin/Preset did not return an object.");
|
||||
}
|
||||
|
||||
if (typeof item.then === "function") {
|
||||
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.");
|
||||
}
|
||||
|
||||
return {
|
||||
value: item,
|
||||
options: options,
|
||||
dirname: dirname,
|
||||
alias: alias
|
||||
};
|
||||
});
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
return descriptor.value;
|
||||
}
|
||||
|
||||
return instantiatePlugin(loadDescriptor(descriptor, context), context);
|
||||
}
|
||||
|
||||
var instantiatePlugin = (0, _caching.makeWeakCache)(function (_ref5, cache) {
|
||||
var value = _ref5.value,
|
||||
options = _ref5.options,
|
||||
dirname = _ref5.dirname,
|
||||
alias = _ref5.alias;
|
||||
var pluginObj = (0, _plugins.validatePluginObject)(value);
|
||||
var plugin = Object.assign({}, pluginObj);
|
||||
|
||||
if (plugin.visitor) {
|
||||
plugin.visitor = _traverse().default.explode(Object.assign({}, plugin.visitor));
|
||||
}
|
||||
|
||||
if (plugin.inherits) {
|
||||
var inheritsDescriptor = {
|
||||
name: undefined,
|
||||
alias: alias + "$inherits",
|
||||
value: plugin.inherits,
|
||||
options: options,
|
||||
dirname: dirname
|
||||
};
|
||||
var inherits = cache.invalidate(function (data) {
|
||||
return loadPluginDescriptor(inheritsDescriptor, data);
|
||||
});
|
||||
plugin.pre = chain(inherits.pre, plugin.pre);
|
||||
plugin.post = chain(inherits.post, plugin.post);
|
||||
plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions);
|
||||
plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]);
|
||||
}
|
||||
|
||||
return new _plugin.default(plugin, options, alias);
|
||||
});
|
||||
|
||||
var loadPresetDescriptor = function loadPresetDescriptor(descriptor, context) {
|
||||
return (0, _configChain.buildPresetChain)(instantiatePreset(loadDescriptor(descriptor, context)), context);
|
||||
};
|
||||
|
||||
var instantiatePreset = (0, _caching.makeWeakCache)(function (_ref6) {
|
||||
var value = _ref6.value,
|
||||
dirname = _ref6.dirname,
|
||||
alias = _ref6.alias;
|
||||
return {
|
||||
options: (0, _options.validate)("preset", value),
|
||||
alias: alias,
|
||||
dirname: dirname
|
||||
};
|
||||
});
|
||||
|
||||
function chain(a, b) {
|
||||
var fns = [a, b].filter(Boolean);
|
||||
if (fns.length <= 1) return fns[0];
|
||||
return function () {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
for (var _iterator2 = fns, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||||
var _ref7;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref7 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref7 = _i2.value;
|
||||
}
|
||||
|
||||
var fn = _ref7;
|
||||
fn.apply(this, args);
|
||||
}
|
||||
};
|
||||
}
|
80
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
80
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
@@ -1,80 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeAPI;
|
||||
|
||||
function _semver() {
|
||||
var data = _interopRequireDefault(require("semver"));
|
||||
|
||||
_semver = function _semver() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _ = require("../../");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function makeAPI(cache) {
|
||||
var env = function env(value) {
|
||||
return cache.using(function (data) {
|
||||
if (typeof value === "undefined") return data.envName;
|
||||
if (typeof value === "function") return value(data.envName);
|
||||
if (!Array.isArray(value)) value = [value];
|
||||
return value.some(function (entry) {
|
||||
if (typeof entry !== "string") {
|
||||
throw new Error("Unexpected non-string value");
|
||||
}
|
||||
|
||||
return entry === data.envName;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
version: _.version,
|
||||
cache: cache.simple(),
|
||||
env: env,
|
||||
async: function async() {
|
||||
return false;
|
||||
},
|
||||
assertVersion: assertVersion
|
||||
};
|
||||
}
|
||||
|
||||
function assertVersion(range) {
|
||||
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.");
|
||||
}
|
||||
|
||||
if (_semver().default.satisfies(_.version, range)) return;
|
||||
var limit = Error.stackTraceLimit;
|
||||
|
||||
if (typeof limit === "number" && limit < 25) {
|
||||
Error.stackTraceLimit = 25;
|
||||
}
|
||||
|
||||
var 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: _.version,
|
||||
range: range
|
||||
});
|
||||
}
|
14
node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
14
node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getEnv = getEnv;
|
||||
|
||||
function getEnv(defaultValue) {
|
||||
if (defaultValue === void 0) {
|
||||
defaultValue = "development";
|
||||
}
|
||||
|
||||
return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
|
||||
}
|
44
node_modules/@babel/core/lib/config/index.js
generated
vendored
44
node_modules/@babel/core/lib/config/index.js
generated
vendored
@@ -1,44 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.loadOptions = loadOptions;
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _full.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfig", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _partial.loadPartialConfig;
|
||||
}
|
||||
});
|
||||
exports.OptionManager = void 0;
|
||||
|
||||
var _full = _interopRequireDefault(require("./full"));
|
||||
|
||||
var _partial = require("./partial");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function loadOptions(opts) {
|
||||
var config = (0, _full.default)(opts);
|
||||
return config ? config.options : null;
|
||||
}
|
||||
|
||||
var OptionManager = function () {
|
||||
function OptionManager() {}
|
||||
|
||||
var _proto = OptionManager.prototype;
|
||||
|
||||
_proto.init = function init(opts) {
|
||||
return loadOptions(opts);
|
||||
};
|
||||
|
||||
return OptionManager;
|
||||
}();
|
||||
|
||||
exports.OptionManager = OptionManager;
|
70
node_modules/@babel/core/lib/config/item.js
generated
vendored
70
node_modules/@babel/core/lib/config/item.js
generated
vendored
@@ -1,70 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createItemFromDescriptor = createItemFromDescriptor;
|
||||
exports.createConfigItem = createConfigItem;
|
||||
exports.getItemDescriptor = getItemDescriptor;
|
||||
|
||||
function _path() {
|
||||
var data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _configDescriptors = require("./config-descriptors");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createItemFromDescriptor(desc) {
|
||||
return new ConfigItem(desc);
|
||||
}
|
||||
|
||||
function createConfigItem(value, _temp) {
|
||||
var _ref = _temp === void 0 ? {} : _temp,
|
||||
_ref$dirname = _ref.dirname,
|
||||
dirname = _ref$dirname === void 0 ? "." : _ref$dirname,
|
||||
type = _ref.type;
|
||||
|
||||
var descriptor = (0, _configDescriptors.createDescriptor)(value, _path().default.resolve(dirname), {
|
||||
type: type,
|
||||
alias: "programmatic item"
|
||||
});
|
||||
return createItemFromDescriptor(descriptor);
|
||||
}
|
||||
|
||||
function getItemDescriptor(item) {
|
||||
if (item instanceof ConfigItem) {
|
||||
return item._descriptor;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var ConfigItem = function ConfigItem(descriptor) {
|
||||
this._descriptor = descriptor;
|
||||
Object.defineProperty(this, "_descriptor", {
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
if (this._descriptor.options === false) {
|
||||
throw new Error("Assertion failure - unexpected false options");
|
||||
}
|
||||
|
||||
this.value = this._descriptor.value;
|
||||
this.options = this._descriptor.options;
|
||||
this.dirname = this._descriptor.dirname;
|
||||
this.name = this._descriptor.name;
|
||||
this.file = this._descriptor.file ? {
|
||||
request: this._descriptor.file.request,
|
||||
resolved: this._descriptor.file.resolved
|
||||
} : undefined;
|
||||
Object.freeze(this);
|
||||
};
|
||||
|
||||
Object.freeze(ConfigItem.prototype);
|
109
node_modules/@babel/core/lib/config/partial.js
generated
vendored
109
node_modules/@babel/core/lib/config/partial.js
generated
vendored
@@ -1,109 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadPrivatePartialConfig;
|
||||
exports.loadPartialConfig = loadPartialConfig;
|
||||
|
||||
function _path() {
|
||||
var data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _plugin = _interopRequireDefault(require("./plugin"));
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
var _item = require("./item");
|
||||
|
||||
var _configChain = require("./config-chain");
|
||||
|
||||
var _environment = require("./helpers/environment");
|
||||
|
||||
var _options = require("./validation/options");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function loadPrivatePartialConfig(inputOpts) {
|
||||
if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) {
|
||||
throw new Error("Babel options must be an object, null, or undefined");
|
||||
}
|
||||
|
||||
var args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {};
|
||||
var _args$envName = args.envName,
|
||||
envName = _args$envName === void 0 ? (0, _environment.getEnv)() : _args$envName,
|
||||
_args$cwd = args.cwd,
|
||||
cwd = _args$cwd === void 0 ? "." : _args$cwd;
|
||||
|
||||
var absoluteCwd = _path().default.resolve(cwd);
|
||||
|
||||
var context = {
|
||||
filename: args.filename ? _path().default.resolve(cwd, args.filename) : null,
|
||||
cwd: absoluteCwd,
|
||||
envName: envName
|
||||
};
|
||||
var configChain = (0, _configChain.buildRootChain)(args, context);
|
||||
if (!configChain) return null;
|
||||
var options = {};
|
||||
configChain.options.forEach(function (opts) {
|
||||
(0, _util.mergeOptions)(options, opts);
|
||||
});
|
||||
options.babelrc = false;
|
||||
options.envName = envName;
|
||||
options.cwd = absoluteCwd;
|
||||
options.passPerPreset = false;
|
||||
options.plugins = configChain.plugins.map(function (descriptor) {
|
||||
return (0, _item.createItemFromDescriptor)(descriptor);
|
||||
});
|
||||
options.presets = configChain.presets.map(function (descriptor) {
|
||||
return (0, _item.createItemFromDescriptor)(descriptor);
|
||||
});
|
||||
return {
|
||||
options: options,
|
||||
context: context,
|
||||
ignore: configChain.ignore,
|
||||
babelrc: configChain.babelrc,
|
||||
config: configChain.config
|
||||
};
|
||||
}
|
||||
|
||||
function loadPartialConfig(inputOpts) {
|
||||
var result = loadPrivatePartialConfig(inputOpts);
|
||||
if (!result) return null;
|
||||
var options = result.options,
|
||||
babelrc = result.babelrc,
|
||||
ignore = result.ignore,
|
||||
config = result.config;
|
||||
(options.plugins || []).forEach(function (item) {
|
||||
if (item.value instanceof _plugin.default) {
|
||||
throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()");
|
||||
}
|
||||
});
|
||||
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined);
|
||||
}
|
||||
|
||||
var PartialConfig = function () {
|
||||
function PartialConfig(options, babelrc, ignore, config) {
|
||||
this.options = options;
|
||||
this.babelignore = ignore;
|
||||
this.babelrc = babelrc;
|
||||
this.config = config;
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
var _proto = PartialConfig.prototype;
|
||||
|
||||
_proto.hasFilesystemConfig = function hasFilesystemConfig() {
|
||||
return this.babelrc !== undefined || this.config !== undefined;
|
||||
};
|
||||
|
||||
return PartialConfig;
|
||||
}();
|
||||
|
||||
Object.freeze(PartialConfig.prototype);
|
19
node_modules/@babel/core/lib/config/plugin.js
generated
vendored
19
node_modules/@babel/core/lib/config/plugin.js
generated
vendored
@@ -1,19 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var Plugin = function Plugin(plugin, options, key) {
|
||||
this.key = plugin.name || key;
|
||||
this.manipulateOptions = plugin.manipulateOptions;
|
||||
this.post = plugin.post;
|
||||
this.pre = plugin.pre;
|
||||
this.visitor = plugin.visitor || {};
|
||||
this.parserOverride = plugin.parserOverride;
|
||||
this.generatorOverride = plugin.generatorOverride;
|
||||
this.options = options;
|
||||
};
|
||||
|
||||
exports.default = Plugin;
|
39
node_modules/@babel/core/lib/config/util.js
generated
vendored
39
node_modules/@babel/core/lib/config/util.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.mergeOptions = mergeOptions;
|
||||
|
||||
function mergeOptions(target, source) {
|
||||
var _arr = Object.keys(source);
|
||||
|
||||
for (var _i = 0; _i < _arr.length; _i++) {
|
||||
var k = _arr[_i];
|
||||
|
||||
if (k === "parserOpts" && source.parserOpts) {
|
||||
var parserOpts = source.parserOpts;
|
||||
var targetObj = target.parserOpts = target.parserOpts || {};
|
||||
mergeDefaultFields(targetObj, parserOpts);
|
||||
} else if (k === "generatorOpts" && source.generatorOpts) {
|
||||
var generatorOpts = source.generatorOpts;
|
||||
|
||||
var _targetObj = target.generatorOpts = target.generatorOpts || {};
|
||||
|
||||
mergeDefaultFields(_targetObj, generatorOpts);
|
||||
} else {
|
||||
var val = source[k];
|
||||
if (val !== undefined) target[k] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mergeDefaultFields(target, source) {
|
||||
var _arr2 = Object.keys(source);
|
||||
|
||||
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
|
||||
var k = _arr2[_i2];
|
||||
var val = source[k];
|
||||
if (val !== undefined) target[k] = val;
|
||||
}
|
||||
}
|
209
node_modules/@babel/core/lib/config/validation/option-assertions.js
generated
vendored
209
node_modules/@babel/core/lib/config/validation/option-assertions.js
generated
vendored
@@ -1,209 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.assertSourceMaps = assertSourceMaps;
|
||||
exports.assertCompact = assertCompact;
|
||||
exports.assertSourceType = assertSourceType;
|
||||
exports.assertInputSourceMap = assertInputSourceMap;
|
||||
exports.assertString = assertString;
|
||||
exports.assertFunction = assertFunction;
|
||||
exports.assertBoolean = assertBoolean;
|
||||
exports.assertObject = assertObject;
|
||||
exports.assertArray = assertArray;
|
||||
exports.assertIgnoreList = assertIgnoreList;
|
||||
exports.assertConfigApplicableTest = assertConfigApplicableTest;
|
||||
exports.assertConfigFileSearch = assertConfigFileSearch;
|
||||
exports.assertBabelrcSearch = assertBabelrcSearch;
|
||||
exports.assertPluginList = assertPluginList;
|
||||
|
||||
function assertSourceMaps(key, value) {
|
||||
if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") {
|
||||
throw new Error("." + key + " must be a boolean, \"inline\", \"both\", or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertCompact(key, value) {
|
||||
if (value !== undefined && typeof value !== "boolean" && value !== "auto") {
|
||||
throw new Error("." + key + " must be a boolean, \"auto\", or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertSourceType(key, value) {
|
||||
if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") {
|
||||
throw new Error("." + key + " must be \"module\", \"script\", \"unambiguous\", or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertInputSourceMap(key, value) {
|
||||
if (value !== undefined && typeof value !== "boolean" && (typeof value !== "object" || !value)) {
|
||||
throw new Error(".inputSourceMap must be a boolean, object, or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertString(key, value) {
|
||||
if (value !== undefined && typeof value !== "string") {
|
||||
throw new Error("." + key + " must be a string, or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertFunction(key, value) {
|
||||
if (value !== undefined && typeof value !== "function") {
|
||||
throw new Error("." + key + " must be a function, or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertBoolean(key, value) {
|
||||
if (value !== undefined && typeof value !== "boolean") {
|
||||
throw new Error("." + key + " must be a boolean, or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertObject(key, value) {
|
||||
if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) {
|
||||
throw new Error("." + key + " must be an object, or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertArray(key, value) {
|
||||
if (value != null && !Array.isArray(value)) {
|
||||
throw new Error("." + key + " must be an array, or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertIgnoreList(key, value) {
|
||||
var arr = assertArray(key, value);
|
||||
|
||||
if (arr) {
|
||||
arr.forEach(function (item, i) {
|
||||
return assertIgnoreItem(key, i, item);
|
||||
});
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
function assertIgnoreItem(key, index, value) {
|
||||
if (typeof value !== "string" && typeof value !== "function" && !(value instanceof RegExp)) {
|
||||
throw new Error("." + key + "[" + index + "] must be an array of string/Funtion/RegExp values, or undefined");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertConfigApplicableTest(key, value) {
|
||||
if (value === undefined) return value;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(function (item, i) {
|
||||
if (!checkValidTest(item)) {
|
||||
throw new Error("." + key + "[" + i + "] must be a string/Function/RegExp.");
|
||||
}
|
||||
});
|
||||
} else if (!checkValidTest(value)) {
|
||||
throw new Error("." + key + " must be a string/Function/RegExp, or an array of those");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function checkValidTest(value) {
|
||||
return typeof value === "string" || typeof value === "function" || value instanceof RegExp;
|
||||
}
|
||||
|
||||
function assertConfigFileSearch(key, value) {
|
||||
if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") {
|
||||
throw new Error("." + key + " must be a undefined, a boolean, a string, " + ("got " + JSON.stringify(value)));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertBabelrcSearch(key, value) {
|
||||
if (value === undefined || typeof value === "boolean") return value;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(function (item, i) {
|
||||
if (typeof item !== "string") {
|
||||
throw new Error("." + key + "[" + i + "] must be a string.");
|
||||
}
|
||||
});
|
||||
} else if (typeof value !== "string") {
|
||||
throw new Error("." + key + " must be a undefined, a boolean, a string, " + ("or an array of strings, got " + JSON.stringify(value)));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertPluginList(key, value) {
|
||||
var arr = assertArray(key, value);
|
||||
|
||||
if (arr) {
|
||||
arr.forEach(function (item, i) {
|
||||
return assertPluginItem(key, i, item);
|
||||
});
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
function assertPluginItem(key, index, value) {
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length === 0) {
|
||||
throw new Error("." + key + "[" + index + "] must include an object");
|
||||
}
|
||||
|
||||
if (value.length > 3) {
|
||||
throw new Error("." + key + "[" + index + "] may only be a two-tuple or three-tuple");
|
||||
}
|
||||
|
||||
assertPluginTarget(key, index, true, value[0]);
|
||||
|
||||
if (value.length > 1) {
|
||||
var opts = value[1];
|
||||
|
||||
if (opts !== undefined && opts !== false && (typeof opts !== "object" || Array.isArray(opts))) {
|
||||
throw new Error("." + key + "[" + index + "][1] must be an object, false, or undefined");
|
||||
}
|
||||
}
|
||||
|
||||
if (value.length === 3) {
|
||||
var name = value[2];
|
||||
|
||||
if (name !== undefined && typeof name !== "string") {
|
||||
throw new Error("." + key + "[" + index + "][2] must be a string, or undefined");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assertPluginTarget(key, index, false, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertPluginTarget(key, index, inArray, value) {
|
||||
if ((typeof value !== "object" || !value) && typeof value !== "string" && typeof value !== "function") {
|
||||
throw new Error("." + key + "[" + index + "]" + (inArray ? "[0]" : "") + " must be a string, object, function");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
163
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
163
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
@@ -1,163 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validate = validate;
|
||||
|
||||
var _plugin = _interopRequireDefault(require("../plugin"));
|
||||
|
||||
var _removed = _interopRequireDefault(require("./removed"));
|
||||
|
||||
var _optionAssertions = require("./option-assertions");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var ROOT_VALIDATORS = {
|
||||
cwd: _optionAssertions.assertString,
|
||||
root: _optionAssertions.assertString,
|
||||
configFile: _optionAssertions.assertConfigFileSearch,
|
||||
filename: _optionAssertions.assertString,
|
||||
filenameRelative: _optionAssertions.assertString,
|
||||
babelrc: _optionAssertions.assertBoolean,
|
||||
babelrcRoots: _optionAssertions.assertBabelrcSearch,
|
||||
code: _optionAssertions.assertBoolean,
|
||||
ast: _optionAssertions.assertBoolean,
|
||||
envName: _optionAssertions.assertString
|
||||
};
|
||||
var NONPRESET_VALIDATORS = {
|
||||
extends: _optionAssertions.assertString,
|
||||
env: assertEnvSet,
|
||||
ignore: _optionAssertions.assertIgnoreList,
|
||||
only: _optionAssertions.assertIgnoreList,
|
||||
overrides: assertOverridesList,
|
||||
test: _optionAssertions.assertConfigApplicableTest,
|
||||
include: _optionAssertions.assertConfigApplicableTest,
|
||||
exclude: _optionAssertions.assertConfigApplicableTest
|
||||
};
|
||||
var COMMON_VALIDATORS = {
|
||||
inputSourceMap: _optionAssertions.assertInputSourceMap,
|
||||
presets: _optionAssertions.assertPluginList,
|
||||
plugins: _optionAssertions.assertPluginList,
|
||||
passPerPreset: _optionAssertions.assertBoolean,
|
||||
retainLines: _optionAssertions.assertBoolean,
|
||||
comments: _optionAssertions.assertBoolean,
|
||||
shouldPrintComment: _optionAssertions.assertFunction,
|
||||
compact: _optionAssertions.assertCompact,
|
||||
minified: _optionAssertions.assertBoolean,
|
||||
auxiliaryCommentBefore: _optionAssertions.assertString,
|
||||
auxiliaryCommentAfter: _optionAssertions.assertString,
|
||||
sourceType: _optionAssertions.assertSourceType,
|
||||
wrapPluginVisitorMethod: _optionAssertions.assertFunction,
|
||||
highlightCode: _optionAssertions.assertBoolean,
|
||||
sourceMaps: _optionAssertions.assertSourceMaps,
|
||||
sourceMap: _optionAssertions.assertSourceMaps,
|
||||
sourceFileName: _optionAssertions.assertString,
|
||||
sourceRoot: _optionAssertions.assertString,
|
||||
getModuleId: _optionAssertions.assertFunction,
|
||||
moduleRoot: _optionAssertions.assertString,
|
||||
moduleIds: _optionAssertions.assertBoolean,
|
||||
moduleId: _optionAssertions.assertString,
|
||||
parserOpts: _optionAssertions.assertObject,
|
||||
generatorOpts: _optionAssertions.assertObject
|
||||
};
|
||||
|
||||
function validate(type, opts) {
|
||||
assertNoDuplicateSourcemap(opts);
|
||||
Object.keys(opts).forEach(function (key) {
|
||||
if (type === "preset" && NONPRESET_VALIDATORS[key]) {
|
||||
throw new Error("." + key + " is not allowed in preset options");
|
||||
}
|
||||
|
||||
if (type !== "arguments" && ROOT_VALIDATORS[key]) {
|
||||
throw new Error("." + key + " is only allowed in root programmatic options");
|
||||
}
|
||||
|
||||
if (type === "env" && key === "env") {
|
||||
throw new Error("." + key + " is not allowed inside another env block");
|
||||
}
|
||||
|
||||
if (type === "env" && key === "overrides") {
|
||||
throw new Error("." + key + " is not allowed inside an env block");
|
||||
}
|
||||
|
||||
if (type === "override" && key === "overrides") {
|
||||
throw new Error("." + key + " is not allowed inside an overrides block");
|
||||
}
|
||||
|
||||
var validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || ROOT_VALIDATORS[key];
|
||||
if (validator) validator(key, opts[key]);else throw buildUnknownError(key);
|
||||
});
|
||||
return opts;
|
||||
}
|
||||
|
||||
function buildUnknownError(key) {
|
||||
if (_removed.default[key]) {
|
||||
var _removed$key = _removed.default[key],
|
||||
message = _removed$key.message,
|
||||
_removed$key$version = _removed$key.version,
|
||||
version = _removed$key$version === void 0 ? 5 : _removed$key$version;
|
||||
throw new ReferenceError("Using removed Babel " + version + " option: ." + key + " - " + message);
|
||||
} else {
|
||||
var unknownOptErr = "Unknown option: ." + key + ". Check out http://babeljs.io/docs/usage/options/ for more information about options.";
|
||||
throw new ReferenceError(unknownOptErr);
|
||||
}
|
||||
}
|
||||
|
||||
function has(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
function assertNoDuplicateSourcemap(opts) {
|
||||
if (has(opts, "sourceMap") && has(opts, "sourceMaps")) {
|
||||
throw new Error(".sourceMap is an alias for .sourceMaps, cannot use both");
|
||||
}
|
||||
}
|
||||
|
||||
function assertEnvSet(key, value) {
|
||||
var obj = (0, _optionAssertions.assertObject)(key, value);
|
||||
|
||||
if (obj) {
|
||||
var _arr = Object.keys(obj);
|
||||
|
||||
for (var _i = 0; _i < _arr.length; _i++) {
|
||||
var _key = _arr[_i];
|
||||
|
||||
var _env = (0, _optionAssertions.assertObject)(_key, obj[_key]);
|
||||
|
||||
if (_env) validate("env", _env);
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function assertOverridesList(key, value) {
|
||||
var arr = (0, _optionAssertions.assertArray)(key, value);
|
||||
|
||||
if (arr) {
|
||||
for (var _iterator = arr.entries(), _isArray = Array.isArray(_iterator), _i2 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i2 >= _iterator.length) break;
|
||||
_ref = _iterator[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator.next();
|
||||
if (_i2.done) break;
|
||||
_ref = _i2.value;
|
||||
}
|
||||
|
||||
var _ref2 = _ref,
|
||||
index = _ref2[0],
|
||||
item = _ref2[1];
|
||||
|
||||
var _env2 = (0, _optionAssertions.assertObject)("" + index, item);
|
||||
|
||||
if (!_env2) throw new Error("." + key + "[" + index + "] must be an object");
|
||||
validate("override", _env2);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
57
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
57
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
@@ -1,57 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validatePluginObject = validatePluginObject;
|
||||
|
||||
var _optionAssertions = require("./option-assertions");
|
||||
|
||||
var VALIDATORS = {
|
||||
name: _optionAssertions.assertString,
|
||||
manipulateOptions: _optionAssertions.assertFunction,
|
||||
pre: _optionAssertions.assertFunction,
|
||||
post: _optionAssertions.assertFunction,
|
||||
inherits: _optionAssertions.assertFunction,
|
||||
visitor: assertVisitorMap,
|
||||
parserOverride: _optionAssertions.assertFunction,
|
||||
generatorOverride: _optionAssertions.assertFunction
|
||||
};
|
||||
|
||||
function assertVisitorMap(key, value) {
|
||||
var obj = (0, _optionAssertions.assertObject)(key, value);
|
||||
|
||||
if (obj) {
|
||||
Object.keys(obj).forEach(function (prop) {
|
||||
return 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.");
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function assertVisitorHandler(key, value) {
|
||||
if (value && typeof value === "object") {
|
||||
Object.keys(value).forEach(function (handler) {
|
||||
if (handler !== "enter" && handler !== "exit") {
|
||||
throw new Error(".visitor[\"" + key + "\"] may only have .enter and/or .exit handlers.");
|
||||
}
|
||||
});
|
||||
} else if (typeof value !== "function") {
|
||||
throw new Error(".visitor[\"" + key + "\"] must be a function");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function validatePluginObject(obj) {
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var validator = VALIDATORS[key];
|
||||
if (validator) validator(key, obj[key]);else throw new Error("." + key + " is not a valid Plugin property");
|
||||
});
|
||||
return obj;
|
||||
}
|
66
node_modules/@babel/core/lib/config/validation/removed.js
generated
vendored
66
node_modules/@babel/core/lib/config/validation/removed.js
generated
vendored
@@ -1,66 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = {
|
||||
auxiliaryComment: {
|
||||
message: "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
|
||||
},
|
||||
blacklist: {
|
||||
message: "Put the specific transforms you want in the `plugins` option"
|
||||
},
|
||||
breakConfig: {
|
||||
message: "This is not a necessary option in Babel 6"
|
||||
},
|
||||
experimental: {
|
||||
message: "Put the specific transforms you want in the `plugins` option"
|
||||
},
|
||||
externalHelpers: {
|
||||
message: "Use the `external-helpers` plugin instead. " + "Check out http://babeljs.io/docs/plugins/external-helpers/"
|
||||
},
|
||||
extra: {
|
||||
message: ""
|
||||
},
|
||||
jsxPragma: {
|
||||
message: "use the `pragma` option in the `react-jsx` plugin. " + "Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
|
||||
},
|
||||
loose: {
|
||||
message: "Specify the `loose` option for the relevant plugin you are using " + "or use a preset that sets the option."
|
||||
},
|
||||
metadataUsedHelpers: {
|
||||
message: "Not required anymore as this is enabled by default"
|
||||
},
|
||||
modules: {
|
||||
message: "Use the corresponding module transform plugin in the `plugins` option. " + "Check out http://babeljs.io/docs/plugins/#modules"
|
||||
},
|
||||
nonStandard: {
|
||||
message: "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. " + "Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
|
||||
},
|
||||
optional: {
|
||||
message: "Put the specific transforms you want in the `plugins` option"
|
||||
},
|
||||
sourceMapName: {
|
||||
message: "The `sourceMapName` option has been removed because it makes more sense for the " + "tooling that calls Babel to assign `map.file` themselves."
|
||||
},
|
||||
stage: {
|
||||
message: "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
|
||||
},
|
||||
whitelist: {
|
||||
message: "Put the specific transforms you want in the `plugins` option"
|
||||
},
|
||||
resolveModuleSource: {
|
||||
version: 6,
|
||||
message: "Use `babel-plugin-module-resolver@3`'s 'resolvePath' options"
|
||||
},
|
||||
metadata: {
|
||||
version: 6,
|
||||
message: "Generated plugin metadata is always included in the output result"
|
||||
},
|
||||
sourceMapTarget: {
|
||||
version: 6,
|
||||
message: "The `sourceMapTarget` option has been removed because it makes more sense for the tooling " + "that calls Babel to assign `map.file` themselves."
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
197
node_modules/@babel/core/lib/index.js
generated
vendored
197
node_modules/@babel/core/lib/index.js
generated
vendored
@@ -1,197 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Plugin = Plugin;
|
||||
Object.defineProperty(exports, "File", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _file.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "buildExternalHelpers", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _buildExternalHelpers.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePlugin", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _files.resolvePlugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePreset", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _files.resolvePreset;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "version", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _package.version;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getEnv", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _environment.getEnv;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "traverse", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _traverse().default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "template", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _template().default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfig", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _config.loadPartialConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptions", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _config.loadOptions;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "OptionManager", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _config.OptionManager;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createConfigItem", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _item.createConfigItem;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transform", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _transform.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformSync", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _transformSync.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFile", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _transformFile.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFileSync", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _transformFileSync.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFromAst", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _transformAst.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFromAstSync", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _transformAstSync.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parse", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _parse.default;
|
||||
}
|
||||
});
|
||||
exports.types = exports.DEFAULT_EXTENSIONS = void 0;
|
||||
|
||||
var _file = _interopRequireDefault(require("./transformation/file/file"));
|
||||
|
||||
var _buildExternalHelpers = _interopRequireDefault(require("./tools/build-external-helpers"));
|
||||
|
||||
var _files = require("./config/files");
|
||||
|
||||
var _package = require("../package.json");
|
||||
|
||||
var _environment = require("./config/helpers/environment");
|
||||
|
||||
function _types() {
|
||||
var data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
_types = function _types() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Object.defineProperty(exports, "types", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _types();
|
||||
}
|
||||
});
|
||||
|
||||
function _traverse() {
|
||||
var data = _interopRequireDefault(require("@babel/traverse"));
|
||||
|
||||
_traverse = function _traverse() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _template() {
|
||||
var data = _interopRequireDefault(require("@babel/template"));
|
||||
|
||||
_template = function _template() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = require("./config");
|
||||
|
||||
var _item = require("./config/item");
|
||||
|
||||
var _transform = _interopRequireDefault(require("./transform"));
|
||||
|
||||
var _transformSync = _interopRequireDefault(require("./transform-sync"));
|
||||
|
||||
var _transformFile = _interopRequireDefault(require("./transform-file"));
|
||||
|
||||
var _transformFileSync = _interopRequireDefault(require("./transform-file-sync"));
|
||||
|
||||
var _transformAst = _interopRequireDefault(require("./transform-ast"));
|
||||
|
||||
var _transformAstSync = _interopRequireDefault(require("./transform-ast-sync"));
|
||||
|
||||
var _parse = _interopRequireDefault(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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function Plugin(alias) {
|
||||
throw new Error("The (" + alias + ") Babel 5 plugin is being run with an unsupported Babel version.");
|
||||
}
|
||||
|
||||
var DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
|
||||
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;
|
25
node_modules/@babel/core/lib/parse.js
generated
vendored
25
node_modules/@babel/core/lib/parse.js
generated
vendored
@@ -1,25 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = parse;
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _normalizeFile = _interopRequireDefault(require("./transformation/normalize-file"));
|
||||
|
||||
var _normalizeOpts = _interopRequireDefault(require("./transformation/normalize-opts"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function parse(code, opts) {
|
||||
var config = (0, _config.default)(opts);
|
||||
|
||||
if (config === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code);
|
||||
return file.ast;
|
||||
}
|
142
node_modules/@babel/core/lib/tools/build-external-helpers.js
generated
vendored
142
node_modules/@babel/core/lib/tools/build-external-helpers.js
generated
vendored
@@ -1,142 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function helpers() {
|
||||
var data = _interopRequireWildcard(require("@babel/helpers"));
|
||||
|
||||
helpers = function helpers() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _generator() {
|
||||
var data = _interopRequireDefault(require("@babel/generator"));
|
||||
|
||||
_generator = function _generator() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _template() {
|
||||
var data = _interopRequireDefault(require("@babel/template"));
|
||||
|
||||
_template = function _template() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
var data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function t() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _templateObject = _taggedTemplateLiteralLoose(["\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n "]);
|
||||
|
||||
function _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 _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
||||
|
||||
var buildUmdWrapper = function buildUmdWrapper(replacements) {
|
||||
return (0, _template().default)(_templateObject)(replacements);
|
||||
};
|
||||
|
||||
function buildGlobal(whitelist) {
|
||||
var namespace = t().identifier("babelHelpers");
|
||||
var body = [];
|
||||
var container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
|
||||
var 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);
|
||||
return tree;
|
||||
}
|
||||
|
||||
function buildModule(whitelist) {
|
||||
var body = [];
|
||||
var refs = buildHelpers(body, null, whitelist);
|
||||
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(function (name) {
|
||||
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name));
|
||||
})));
|
||||
return t().program(body, [], "module");
|
||||
}
|
||||
|
||||
function buildUmd(whitelist) {
|
||||
var namespace = t().identifier("babelHelpers");
|
||||
var body = [];
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))]));
|
||||
buildHelpers(body, namespace, whitelist);
|
||||
return t().program([buildUmdWrapper({
|
||||
FACTORY_PARAMETERS: t().identifier("global"),
|
||||
BROWSER_ARGUMENTS: t().assignmentExpression("=", t().memberExpression(t().identifier("root"), namespace), t().objectExpression([])),
|
||||
COMMON_ARGUMENTS: t().identifier("exports"),
|
||||
AMD_ARGUMENTS: t().arrayExpression([t().stringLiteral("exports")]),
|
||||
FACTORY_BODY: body,
|
||||
UMD_ROOT: t().identifier("this")
|
||||
})]);
|
||||
}
|
||||
|
||||
function buildVar(whitelist) {
|
||||
var namespace = t().identifier("babelHelpers");
|
||||
var body = [];
|
||||
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))]));
|
||||
var tree = t().program(body);
|
||||
buildHelpers(body, namespace, whitelist);
|
||||
body.push(t().expressionStatement(namespace));
|
||||
return tree;
|
||||
}
|
||||
|
||||
function buildHelpers(body, namespace, whitelist) {
|
||||
var getHelperReference = function getHelperReference(name) {
|
||||
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier("_" + name);
|
||||
};
|
||||
|
||||
var refs = {};
|
||||
helpers().list.forEach(function (name) {
|
||||
if (whitelist && whitelist.indexOf(name) < 0) return;
|
||||
var ref = refs[name] = getHelperReference(name);
|
||||
|
||||
var _helpers$get = helpers().get(name, getHelperReference, ref),
|
||||
nodes = _helpers$get.nodes;
|
||||
|
||||
body.push.apply(body, nodes);
|
||||
});
|
||||
return refs;
|
||||
}
|
||||
|
||||
function _default(whitelist, outputType) {
|
||||
if (outputType === void 0) {
|
||||
outputType = "global";
|
||||
}
|
||||
|
||||
var tree;
|
||||
var build = {
|
||||
global: buildGlobal,
|
||||
module: buildModule,
|
||||
umd: buildUmd,
|
||||
var: buildVar
|
||||
}[outputType];
|
||||
|
||||
if (build) {
|
||||
tree = build(whitelist);
|
||||
} else {
|
||||
throw new Error("Unsupported output type " + outputType);
|
||||
}
|
||||
|
||||
return (0, _generator().default)(tree).code;
|
||||
}
|
19
node_modules/@babel/core/lib/transform-ast-sync.js
generated
vendored
19
node_modules/@babel/core/lib/transform-ast-sync.js
generated
vendored
@@ -1,19 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = transformFromAstSync;
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _transformation = require("./transformation");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function transformFromAstSync(ast, code, opts) {
|
||||
var 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);
|
||||
}
|
39
node_modules/@babel/core/lib/transform-ast.js
generated
vendored
39
node_modules/@babel/core/lib/transform-ast.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _transformation = require("./transformation");
|
||||
|
||||
var _transformAstSync = _interopRequireDefault(require("./transform-ast-sync"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var transformFromAst = function transformFromAst(ast, code, opts, callback) {
|
||||
if (typeof opts === "function") {
|
||||
opts = undefined;
|
||||
callback = opts;
|
||||
}
|
||||
|
||||
if (callback === undefined) return (0, _transformAstSync.default)(ast, code, opts);
|
||||
var cb = callback;
|
||||
process.nextTick(function () {
|
||||
var cfg;
|
||||
|
||||
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);
|
||||
});
|
||||
};
|
||||
|
||||
exports.default = transformFromAst;
|
18
node_modules/@babel/core/lib/transform-file-browser.js
generated
vendored
18
node_modules/@babel/core/lib/transform-file-browser.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = transformFile;
|
||||
|
||||
function transformFile(filename, opts, callback) {
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
}
|
||||
|
||||
callback(new Error("Transforming files is not supported in browsers"), null);
|
||||
}
|
10
node_modules/@babel/core/lib/transform-file-sync-browser.js
generated
vendored
10
node_modules/@babel/core/lib/transform-file-sync-browser.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = transformFileSync;
|
||||
|
||||
function transformFileSync() {
|
||||
throw new Error("Transforming files is not supported in browsers");
|
||||
}
|
40
node_modules/@babel/core/lib/transform-file-sync.js
generated
vendored
40
node_modules/@babel/core/lib/transform-file-sync.js
generated
vendored
@@ -1,40 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = transformFileSync;
|
||||
|
||||
function _fs() {
|
||||
var data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function _fs() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _transformation = require("./transformation");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function transformFileSync(filename, opts) {
|
||||
var options;
|
||||
|
||||
if (opts == null) {
|
||||
options = {
|
||||
filename: filename
|
||||
};
|
||||
} else if (opts && typeof opts === "object") {
|
||||
options = Object.assign({}, opts, {
|
||||
filename: filename
|
||||
});
|
||||
}
|
||||
|
||||
var config = (0, _config.default)(options);
|
||||
if (config === null) return null;
|
||||
return (0, _transformation.runSync)(config, _fs().default.readFileSync(filename, "utf8"));
|
||||
}
|
61
node_modules/@babel/core/lib/transform-file.js
generated
vendored
61
node_modules/@babel/core/lib/transform-file.js
generated
vendored
@@ -1,61 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _fs() {
|
||||
var data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function _fs() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _transformation = require("./transformation");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var transformFile = function transformFile(filename, opts, callback) {
|
||||
var options;
|
||||
|
||||
if (typeof opts === "function") {
|
||||
callback = opts;
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
if (opts == null) {
|
||||
options = {
|
||||
filename: filename
|
||||
};
|
||||
} else if (opts && typeof opts === "object") {
|
||||
options = Object.assign({}, opts, {
|
||||
filename: filename
|
||||
});
|
||||
}
|
||||
|
||||
process.nextTick(function () {
|
||||
var cfg;
|
||||
|
||||
try {
|
||||
cfg = (0, _config.default)(options);
|
||||
if (cfg === null) return callback(null, null);
|
||||
} catch (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
var config = cfg;
|
||||
|
||||
_fs().default.readFile(filename, "utf8", function (err, code) {
|
||||
if (err) return callback(err, null);
|
||||
(0, _transformation.runAsync)(config, code, null, callback);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.default = transformFile;
|
18
node_modules/@babel/core/lib/transform-sync.js
generated
vendored
18
node_modules/@babel/core/lib/transform-sync.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = transformSync;
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _transformation = require("./transformation");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function transformSync(code, opts) {
|
||||
var config = (0, _config.default)(opts);
|
||||
if (config === null) return null;
|
||||
return (0, _transformation.runSync)(config, code);
|
||||
}
|
38
node_modules/@babel/core/lib/transform.js
generated
vendored
38
node_modules/@babel/core/lib/transform.js
generated
vendored
@@ -1,38 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
|
||||
var _transformation = require("./transformation");
|
||||
|
||||
var _transformSync = _interopRequireDefault(require("./transform-sync"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var transform = function transform(code, opts, callback) {
|
||||
if (typeof opts === "function") {
|
||||
opts = undefined;
|
||||
callback = opts;
|
||||
}
|
||||
|
||||
if (callback === undefined) return (0, _transformSync.default)(code, opts);
|
||||
var cb = callback;
|
||||
process.nextTick(function () {
|
||||
var 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);
|
||||
});
|
||||
};
|
||||
|
||||
exports.default = transform;
|
65
node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
generated
vendored
65
node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
generated
vendored
@@ -1,65 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadBlockHoistPlugin;
|
||||
|
||||
function _sortBy() {
|
||||
var data = _interopRequireDefault(require("lodash/sortBy"));
|
||||
|
||||
_sortBy = function _sortBy() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = _interopRequireDefault(require("../config"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var LOADED_PLUGIN;
|
||||
|
||||
function loadBlockHoistPlugin() {
|
||||
if (!LOADED_PLUGIN) {
|
||||
var config = (0, _config.default)({
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
plugins: [blockHoistPlugin]
|
||||
});
|
||||
LOADED_PLUGIN = config ? config.passes[0][0] : undefined;
|
||||
if (!LOADED_PLUGIN) throw new Error("Assertion failure");
|
||||
}
|
||||
|
||||
return LOADED_PLUGIN;
|
||||
}
|
||||
|
||||
var blockHoistPlugin = {
|
||||
name: "internal.blockHoist",
|
||||
visitor: {
|
||||
Block: {
|
||||
exit: function exit(_ref) {
|
||||
var node = _ref.node;
|
||||
var hasChange = false;
|
||||
|
||||
for (var i = 0; i < node.body.length; i++) {
|
||||
var bodyNode = node.body[i];
|
||||
|
||||
if (bodyNode && bodyNode._blockHoist != null) {
|
||||
hasChange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasChange) return;
|
||||
node.body = (0, _sortBy().default)(node.body, function (bodyNode) {
|
||||
var priority = bodyNode && bodyNode._blockHoist;
|
||||
if (priority == null) priority = 1;
|
||||
if (priority === true) priority = 2;
|
||||
return -1 * priority;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
247
node_modules/@babel/core/lib/transformation/file/file.js
generated
vendored
247
node_modules/@babel/core/lib/transformation/file/file.js
generated
vendored
@@ -1,247 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function helpers() {
|
||||
var data = _interopRequireWildcard(require("@babel/helpers"));
|
||||
|
||||
helpers = function helpers() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _traverse() {
|
||||
var data = _interopRequireWildcard(require("@babel/traverse"));
|
||||
|
||||
_traverse = function _traverse() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _codeFrame() {
|
||||
var data = require("@babel/code-frame");
|
||||
|
||||
_codeFrame = function _codeFrame() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
var data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function t() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
var errorVisitor = {
|
||||
enter: function enter(path, state) {
|
||||
var loc = path.node.loc;
|
||||
|
||||
if (loc) {
|
||||
state.loc = loc;
|
||||
path.stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var File = function () {
|
||||
function File(options, _ref) {
|
||||
var code = _ref.code,
|
||||
ast = _ref.ast,
|
||||
shebang = _ref.shebang,
|
||||
inputMap = _ref.inputMap;
|
||||
this._map = new Map();
|
||||
this.declarations = {};
|
||||
this.path = null;
|
||||
this.ast = {};
|
||||
this.metadata = {};
|
||||
this.hub = new (_traverse().Hub)(this);
|
||||
this.code = "";
|
||||
this.shebang = "";
|
||||
this.inputMap = null;
|
||||
this.opts = options;
|
||||
this.code = code;
|
||||
this.ast = ast;
|
||||
this.shebang = shebang;
|
||||
this.inputMap = inputMap;
|
||||
this.path = _traverse().NodePath.get({
|
||||
hub: this.hub,
|
||||
parentPath: null,
|
||||
parent: this.ast,
|
||||
container: this.ast,
|
||||
key: "program"
|
||||
}).setContext();
|
||||
this.scope = this.path.scope;
|
||||
}
|
||||
|
||||
var _proto = File.prototype;
|
||||
|
||||
_proto.set = function set(key, val) {
|
||||
this._map.set(key, val);
|
||||
};
|
||||
|
||||
_proto.get = function get(key) {
|
||||
return this._map.get(key);
|
||||
};
|
||||
|
||||
_proto.has = function has(key) {
|
||||
return this._map.has(key);
|
||||
};
|
||||
|
||||
_proto.getModuleName = function getModuleName() {
|
||||
var _opts = this.opts,
|
||||
filename = _opts.filename,
|
||||
_opts$filenameRelativ = _opts.filenameRelative,
|
||||
filenameRelative = _opts$filenameRelativ === void 0 ? filename : _opts$filenameRelativ,
|
||||
moduleId = _opts.moduleId,
|
||||
_opts$moduleIds = _opts.moduleIds,
|
||||
moduleIds = _opts$moduleIds === void 0 ? !!moduleId : _opts$moduleIds,
|
||||
getModuleId = _opts.getModuleId,
|
||||
sourceRootTmp = _opts.sourceRoot,
|
||||
_opts$moduleRoot = _opts.moduleRoot,
|
||||
moduleRoot = _opts$moduleRoot === void 0 ? sourceRootTmp : _opts$moduleRoot,
|
||||
_opts$sourceRoot = _opts.sourceRoot,
|
||||
sourceRoot = _opts$sourceRoot === void 0 ? moduleRoot : _opts$sourceRoot;
|
||||
if (!moduleIds) return null;
|
||||
|
||||
if (moduleId != null && !getModuleId) {
|
||||
return moduleId;
|
||||
}
|
||||
|
||||
var moduleName = moduleRoot != null ? moduleRoot + "/" : "";
|
||||
|
||||
if (filenameRelative) {
|
||||
var 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;
|
||||
}
|
||||
};
|
||||
|
||||
_proto.resolveModuleSource = function resolveModuleSource(source) {
|
||||
return source;
|
||||
};
|
||||
|
||||
_proto.addImport = function addImport() {
|
||||
throw new Error("This API has been removed. If you're looking for this " + "functionality in Babel 7, you should import the " + "'@babel/helper-module-imports' module and use the functions exposed " + " from that module, such as 'addNamed' or 'addDefault'.");
|
||||
};
|
||||
|
||||
_proto.addHelper = function addHelper(name) {
|
||||
var _this = this;
|
||||
|
||||
var declar = this.declarations[name];
|
||||
if (declar) return t().cloneNode(declar);
|
||||
var generator = this.get("helperGenerator");
|
||||
var runtime = this.get("helpersNamespace");
|
||||
|
||||
if (generator) {
|
||||
var res = generator(name);
|
||||
if (res) return res;
|
||||
} else if (runtime) {
|
||||
return t().memberExpression(t().cloneNode(runtime), t().identifier(name));
|
||||
}
|
||||
|
||||
var uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
|
||||
var dependencies = {};
|
||||
|
||||
for (var _iterator = helpers().getDependencies(name), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref2 = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref2 = _i.value;
|
||||
}
|
||||
|
||||
var dep = _ref2;
|
||||
dependencies[dep] = this.addHelper(dep);
|
||||
}
|
||||
|
||||
var _helpers$get = helpers().get(name, function (dep) {
|
||||
return dependencies[dep];
|
||||
}, uid, Object.keys(this.scope.getAllBindings())),
|
||||
nodes = _helpers$get.nodes,
|
||||
globals = _helpers$get.globals;
|
||||
|
||||
globals.forEach(function (name) {
|
||||
if (_this.path.scope.hasBinding(name, true)) {
|
||||
_this.path.scope.rename(name);
|
||||
}
|
||||
});
|
||||
nodes.forEach(function (node) {
|
||||
node._compact = true;
|
||||
});
|
||||
this.path.unshiftContainer("body", nodes);
|
||||
this.path.get("body").forEach(function (path) {
|
||||
if (nodes.indexOf(path.node) === -1) return;
|
||||
if (path.isVariableDeclaration()) _this.scope.registerDeclaration(path);
|
||||
});
|
||||
return uid;
|
||||
};
|
||||
|
||||
_proto.addTemplateObject = function addTemplateObject() {
|
||||
throw new Error("This function has been moved into the template literal transform itself.");
|
||||
};
|
||||
|
||||
_proto.buildCodeFrameError = function buildCodeFrameError(node, msg, Error) {
|
||||
if (Error === void 0) {
|
||||
Error = SyntaxError;
|
||||
}
|
||||
|
||||
var loc = node && (node.loc || node._loc);
|
||||
msg = this.opts.filename + ": " + msg;
|
||||
|
||||
if (!loc && node) {
|
||||
var state = {
|
||||
loc: null
|
||||
};
|
||||
(0, _traverse().default)(node, errorVisitor, this.scope, state);
|
||||
loc = state.loc;
|
||||
var txt = "This is an error on an internal node. Probably an internal error.";
|
||||
if (loc) txt += " Location has been estimated.";
|
||||
msg += " (" + txt + ")";
|
||||
}
|
||||
|
||||
if (loc) {
|
||||
var _opts$highlightCode = this.opts.highlightCode,
|
||||
highlightCode = _opts$highlightCode === void 0 ? true : _opts$highlightCode;
|
||||
msg += "\n" + (0, _codeFrame().codeFrameColumns)(this.code, {
|
||||
start: {
|
||||
line: loc.start.line,
|
||||
column: loc.start.column + 1
|
||||
}
|
||||
}, {
|
||||
highlightCode: highlightCode
|
||||
});
|
||||
}
|
||||
|
||||
return new Error(msg);
|
||||
};
|
||||
|
||||
return File;
|
||||
}();
|
||||
|
||||
exports.default = File;
|
155
node_modules/@babel/core/lib/transformation/file/generate.js
generated
vendored
155
node_modules/@babel/core/lib/transformation/file/generate.js
generated
vendored
@@ -1,155 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = generateCode;
|
||||
|
||||
function _convertSourceMap() {
|
||||
var data = _interopRequireDefault(require("convert-source-map"));
|
||||
|
||||
_convertSourceMap = function _convertSourceMap() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _sourceMap() {
|
||||
var data = _interopRequireDefault(require("source-map"));
|
||||
|
||||
_sourceMap = function _sourceMap() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _generator() {
|
||||
var data = _interopRequireDefault(require("@babel/generator"));
|
||||
|
||||
_generator = function _generator() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function generateCode(pluginPasses, file) {
|
||||
var opts = file.opts,
|
||||
ast = file.ast,
|
||||
shebang = file.shebang,
|
||||
code = file.code,
|
||||
inputMap = file.inputMap;
|
||||
var results = [];
|
||||
|
||||
for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var plugins = _ref;
|
||||
|
||||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var plugin = _ref2;
|
||||
var generatorOverride = plugin.generatorOverride;
|
||||
|
||||
if (generatorOverride) {
|
||||
var _result2 = generatorOverride(ast, opts.generatorOpts, code, _generator().default);
|
||||
|
||||
if (_result2 !== undefined) results.push(_result2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result;
|
||||
|
||||
if (results.length === 0) {
|
||||
result = (0, _generator().default)(ast, opts.generatorOpts, code);
|
||||
} else if (results.length === 1) {
|
||||
result = results[0];
|
||||
|
||||
if (typeof result.then === "function") {
|
||||
throw new Error("You appear to be using an async parser plugin, " + "which your current version of Babel does not support. " + "If you're using a published plugin, " + "you may need to upgrade your @babel/core version.");
|
||||
}
|
||||
} else {
|
||||
throw new Error("More than one plugin attempted to override codegen.");
|
||||
}
|
||||
|
||||
var _result = result,
|
||||
outputCode = _result.code,
|
||||
outputMap = _result.map;
|
||||
|
||||
if (shebang) {
|
||||
outputCode = shebang + "\n" + outputCode;
|
||||
}
|
||||
|
||||
if (outputMap && inputMap) {
|
||||
outputMap = mergeSourceMap(inputMap.toObject(), outputMap);
|
||||
}
|
||||
|
||||
if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
|
||||
outputCode += "\n" + _convertSourceMap().default.fromObject(outputMap).toComment();
|
||||
}
|
||||
|
||||
if (opts.sourceMaps === "inline") {
|
||||
outputMap = null;
|
||||
}
|
||||
|
||||
return {
|
||||
outputCode: outputCode,
|
||||
outputMap: outputMap
|
||||
};
|
||||
}
|
||||
|
||||
function mergeSourceMap(inputMap, map) {
|
||||
var inputMapConsumer = new (_sourceMap().default.SourceMapConsumer)(inputMap);
|
||||
var outputMapConsumer = new (_sourceMap().default.SourceMapConsumer)(map);
|
||||
var mergedGenerator = new (_sourceMap().default.SourceMapGenerator)({
|
||||
file: inputMapConsumer.file,
|
||||
sourceRoot: inputMapConsumer.sourceRoot
|
||||
});
|
||||
var source = outputMapConsumer.sources[0];
|
||||
inputMapConsumer.eachMapping(function (mapping) {
|
||||
var generatedPosition = outputMapConsumer.generatedPositionFor({
|
||||
line: mapping.generatedLine,
|
||||
column: mapping.generatedColumn,
|
||||
source: source
|
||||
});
|
||||
|
||||
if (generatedPosition.column != null) {
|
||||
mergedGenerator.addMapping({
|
||||
source: mapping.source,
|
||||
original: mapping.source == null ? null : {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn
|
||||
},
|
||||
generated: generatedPosition,
|
||||
name: mapping.name
|
||||
});
|
||||
}
|
||||
});
|
||||
var mergedMap = mergedGenerator.toJSON();
|
||||
inputMap.mappings = mergedMap.mappings;
|
||||
return inputMap;
|
||||
}
|
137
node_modules/@babel/core/lib/transformation/index.js
generated
vendored
137
node_modules/@babel/core/lib/transformation/index.js
generated
vendored
@@ -1,137 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.runAsync = runAsync;
|
||||
exports.runSync = runSync;
|
||||
|
||||
function _traverse() {
|
||||
var data = _interopRequireDefault(require("@babel/traverse"));
|
||||
|
||||
_traverse = function _traverse() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _pluginPass = _interopRequireDefault(require("./plugin-pass"));
|
||||
|
||||
var _blockHoistPlugin = _interopRequireDefault(require("./block-hoist-plugin"));
|
||||
|
||||
var _normalizeOpts = _interopRequireDefault(require("./normalize-opts"));
|
||||
|
||||
var _normalizeFile = _interopRequireDefault(require("./normalize-file"));
|
||||
|
||||
var _generate = _interopRequireDefault(require("./file/generate"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function runAsync(config, code, ast, callback) {
|
||||
var result;
|
||||
|
||||
try {
|
||||
result = runSync(config, code, ast);
|
||||
} catch (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
return callback(null, result);
|
||||
}
|
||||
|
||||
function runSync(config, code, ast) {
|
||||
var file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
|
||||
transformFile(file, config.passes);
|
||||
var opts = file.opts;
|
||||
|
||||
var _ref = opts.code !== false ? (0, _generate.default)(config.passes, file) : {},
|
||||
outputCode = _ref.outputCode,
|
||||
outputMap = _ref.outputMap;
|
||||
|
||||
return {
|
||||
metadata: file.metadata,
|
||||
options: opts,
|
||||
ast: opts.ast === true ? file.ast : null,
|
||||
code: outputCode === undefined ? null : outputCode,
|
||||
map: outputMap === undefined ? null : outputMap,
|
||||
sourceType: file.ast.program.sourceType
|
||||
};
|
||||
}
|
||||
|
||||
function transformFile(file, pluginPasses) {
|
||||
for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref2 = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref2 = _i.value;
|
||||
}
|
||||
|
||||
var pluginPairs = _ref2;
|
||||
var passPairs = [];
|
||||
var passes = [];
|
||||
var visitors = [];
|
||||
|
||||
for (var _iterator2 = pluginPairs.concat([(0, _blockHoistPlugin.default)()]), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||||
var _ref3;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref3 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref3 = _i2.value;
|
||||
}
|
||||
|
||||
var plugin = _ref3;
|
||||
var pass = new _pluginPass.default(file, plugin.key, plugin.options);
|
||||
passPairs.push([plugin, pass]);
|
||||
passes.push(pass);
|
||||
visitors.push(plugin.visitor);
|
||||
}
|
||||
|
||||
for (var _i3 = 0; _i3 < passPairs.length; _i3++) {
|
||||
var _passPairs$_i = passPairs[_i3],
|
||||
_plugin = _passPairs$_i[0],
|
||||
_pass = _passPairs$_i[1];
|
||||
var fn = _plugin.pre;
|
||||
|
||||
if (fn) {
|
||||
var result = fn.call(_pass, file);
|
||||
|
||||
if (isThenable(result)) {
|
||||
throw new Error("You appear to be using an plugin with an async .pre, " + "which your current version of Babel does not support." + "If you're using a published plugin, you may need to upgrade " + "your @babel/core version.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod);
|
||||
|
||||
(0, _traverse().default)(file.ast, visitor, file.scope);
|
||||
|
||||
for (var _i4 = 0; _i4 < passPairs.length; _i4++) {
|
||||
var _passPairs$_i2 = passPairs[_i4],
|
||||
_plugin2 = _passPairs$_i2[0],
|
||||
_pass2 = _passPairs$_i2[1];
|
||||
var _fn = _plugin2.post;
|
||||
|
||||
if (_fn) {
|
||||
var _result = _fn.call(_pass2, file);
|
||||
|
||||
if (isThenable(_result)) {
|
||||
throw new Error("You appear to be using an plugin with an async .post, " + "which your current version of Babel does not support." + "If you're using a published plugin, you may need to upgrade " + "your @babel/core version.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isThenable(val) {
|
||||
return !!val && (typeof val === "object" || typeof val === "function") && typeof val.then === "function";
|
||||
}
|
177
node_modules/@babel/core/lib/transformation/normalize-file.js
generated
vendored
177
node_modules/@babel/core/lib/transformation/normalize-file.js
generated
vendored
@@ -1,177 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = normalizeFile;
|
||||
|
||||
function t() {
|
||||
var data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function t() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _convertSourceMap() {
|
||||
var data = _interopRequireDefault(require("convert-source-map"));
|
||||
|
||||
_convertSourceMap = function _convertSourceMap() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _babylon() {
|
||||
var data = require("babylon");
|
||||
|
||||
_babylon = function _babylon() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _codeFrame() {
|
||||
var data = require("@babel/code-frame");
|
||||
|
||||
_codeFrame = function _codeFrame() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _file = _interopRequireDefault(require("./file/file"));
|
||||
|
||||
var _missingPluginHelper = _interopRequireDefault(require("./util/missing-plugin-helper"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
var shebangRegex = /^#!.*/;
|
||||
|
||||
function normalizeFile(pluginPasses, options, code, ast) {
|
||||
code = "" + (code || "");
|
||||
var shebang = null;
|
||||
var inputMap = null;
|
||||
|
||||
if (options.inputSourceMap !== false) {
|
||||
inputMap = _convertSourceMap().default.fromSource(code);
|
||||
|
||||
if (inputMap) {
|
||||
code = _convertSourceMap().default.removeComments(code);
|
||||
} else if (typeof options.inputSourceMap === "object") {
|
||||
inputMap = _convertSourceMap().default.fromObject(options.inputSourceMap);
|
||||
}
|
||||
}
|
||||
|
||||
var shebangMatch = shebangRegex.exec(code);
|
||||
|
||||
if (shebangMatch) {
|
||||
shebang = shebangMatch[0];
|
||||
code = code.replace(shebangRegex, "");
|
||||
}
|
||||
|
||||
if (ast) {
|
||||
if (ast.type === "Program") {
|
||||
ast = t().file(ast, [], []);
|
||||
} else if (ast.type !== "File") {
|
||||
throw new Error("AST root must be a Program or File node");
|
||||
}
|
||||
} else {
|
||||
ast = parser(pluginPasses, options, code);
|
||||
}
|
||||
|
||||
return new _file.default(options, {
|
||||
code: code,
|
||||
ast: ast,
|
||||
shebang: shebang,
|
||||
inputMap: inputMap
|
||||
});
|
||||
}
|
||||
|
||||
function parser(pluginPasses, options, code) {
|
||||
try {
|
||||
var results = [];
|
||||
|
||||
for (var _iterator = pluginPasses, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var plugins = _ref;
|
||||
|
||||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var plugin = _ref2;
|
||||
var parserOverride = plugin.parserOverride;
|
||||
|
||||
if (parserOverride) {
|
||||
var _ast = parserOverride(code, options.parserOpts, _babylon().parse);
|
||||
|
||||
if (_ast !== undefined) results.push(_ast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (results.length === 0) {
|
||||
return (0, _babylon().parse)(code, options.parserOpts);
|
||||
} else if (results.length === 1) {
|
||||
if (typeof results[0].then === "function") {
|
||||
throw new Error("You appear to be using an async codegen plugin, " + "which your current version of Babel does not support. " + "If you're using a published plugin, you may need to upgrade " + "your @babel/core version.");
|
||||
}
|
||||
|
||||
return results[0];
|
||||
}
|
||||
|
||||
throw new Error("More than one plugin attempted to override parsing.");
|
||||
} catch (err) {
|
||||
if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") {
|
||||
err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file.";
|
||||
}
|
||||
|
||||
var loc = err.loc,
|
||||
missingPlugin = err.missingPlugin;
|
||||
|
||||
if (loc) {
|
||||
var codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
|
||||
start: {
|
||||
line: loc.line,
|
||||
column: loc.column + 1
|
||||
}
|
||||
}, options);
|
||||
|
||||
if (missingPlugin) {
|
||||
err.message = (options.filename || "unknown") + ": " + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
|
||||
} else {
|
||||
err.message = (options.filename || "unknown") + ": " + err.message + "\n\n" + codeFrame;
|
||||
}
|
||||
|
||||
err.code = "BABEL_PARSE_ERROR";
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
96
node_modules/@babel/core/lib/transformation/normalize-opts.js
generated
vendored
96
node_modules/@babel/core/lib/transformation/normalize-opts.js
generated
vendored
@@ -1,96 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = normalizeOptions;
|
||||
|
||||
function _path() {
|
||||
var data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function normalizeOptions(config) {
|
||||
var _config$options = config.options,
|
||||
filename = _config$options.filename,
|
||||
_config$options$filen = _config$options.filenameRelative,
|
||||
filenameRelative = _config$options$filen === void 0 ? filename || "unknown" : _config$options$filen,
|
||||
_config$options$sourc = _config$options.sourceType,
|
||||
sourceType = _config$options$sourc === void 0 ? "module" : _config$options$sourc,
|
||||
inputSourceMap = _config$options.inputSourceMap,
|
||||
_config$options$sourc2 = _config$options.sourceMaps,
|
||||
sourceMaps = _config$options$sourc2 === void 0 ? !!inputSourceMap : _config$options$sourc2,
|
||||
moduleRoot = _config$options.moduleRoot,
|
||||
_config$options$sourc3 = _config$options.sourceRoot,
|
||||
sourceRoot = _config$options$sourc3 === void 0 ? moduleRoot : _config$options$sourc3,
|
||||
_config$options$sourc4 = _config$options.sourceFileName,
|
||||
sourceFileName = _config$options$sourc4 === void 0 ? filenameRelative : _config$options$sourc4,
|
||||
_config$options$comme = _config$options.comments,
|
||||
comments = _config$options$comme === void 0 ? true : _config$options$comme,
|
||||
_config$options$compa = _config$options.compact,
|
||||
compact = _config$options$compa === void 0 ? "auto" : _config$options$compa;
|
||||
var opts = config.options;
|
||||
var options = Object.assign({}, opts, {
|
||||
parserOpts: Object.assign({
|
||||
sourceType: _path().default.extname(filenameRelative) === ".mjs" ? "module" : sourceType,
|
||||
sourceFileName: filename,
|
||||
plugins: []
|
||||
}, opts.parserOpts),
|
||||
generatorOpts: Object.assign({
|
||||
filename: filename,
|
||||
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
||||
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
||||
retainLines: opts.retainLines,
|
||||
comments: comments,
|
||||
shouldPrintComment: opts.shouldPrintComment,
|
||||
compact: compact,
|
||||
minified: opts.minified,
|
||||
sourceMaps: sourceMaps,
|
||||
sourceRoot: sourceRoot,
|
||||
sourceFileName: sourceFileName
|
||||
}, opts.generatorOpts)
|
||||
});
|
||||
|
||||
for (var _iterator = config.passes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
||||
var _ref;
|
||||
|
||||
if (_isArray) {
|
||||
if (_i >= _iterator.length) break;
|
||||
_ref = _iterator[_i++];
|
||||
} else {
|
||||
_i = _iterator.next();
|
||||
if (_i.done) break;
|
||||
_ref = _i.value;
|
||||
}
|
||||
|
||||
var plugins = _ref;
|
||||
|
||||
for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
||||
var _ref2;
|
||||
|
||||
if (_isArray2) {
|
||||
if (_i2 >= _iterator2.length) break;
|
||||
_ref2 = _iterator2[_i2++];
|
||||
} else {
|
||||
_i2 = _iterator2.next();
|
||||
if (_i2.done) break;
|
||||
_ref2 = _i2.value;
|
||||
}
|
||||
|
||||
var plugin = _ref2;
|
||||
|
||||
if (plugin.manipulateOptions) {
|
||||
plugin.manipulateOptions(options, options.parserOpts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
46
node_modules/@babel/core/lib/transformation/plugin-pass.js
generated
vendored
46
node_modules/@babel/core/lib/transformation/plugin-pass.js
generated
vendored
@@ -1,46 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var PluginPass = function () {
|
||||
function PluginPass(file, key, options) {
|
||||
this._map = new Map();
|
||||
this.key = key;
|
||||
this.file = file;
|
||||
this.opts = options || {};
|
||||
this.filename = typeof file.opts.filename === "string" ? file.opts.filename : undefined;
|
||||
}
|
||||
|
||||
var _proto = PluginPass.prototype;
|
||||
|
||||
_proto.set = function set(key, val) {
|
||||
this._map.set(key, val);
|
||||
};
|
||||
|
||||
_proto.get = function get(key) {
|
||||
return this._map.get(key);
|
||||
};
|
||||
|
||||
_proto.addHelper = function addHelper(name) {
|
||||
return this.file.addHelper(name);
|
||||
};
|
||||
|
||||
_proto.addImport = function addImport() {
|
||||
return this.file.addImport();
|
||||
};
|
||||
|
||||
_proto.getModuleName = function getModuleName() {
|
||||
return this.file.getModuleName();
|
||||
};
|
||||
|
||||
_proto.buildCodeFrameError = function buildCodeFrameError(node, msg, Error) {
|
||||
return this.file.buildCodeFrameError(node, msg, Error);
|
||||
};
|
||||
|
||||
return PluginPass;
|
||||
}();
|
||||
|
||||
exports.default = PluginPass;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user