Initial commit
This commit is contained in:
22
node_modules/@babel/cli/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/cli/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@babel/cli/README.md
generated
vendored
Normal file
19
node_modules/@babel/cli/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/cli
|
||||
|
||||
> Babel command line.
|
||||
|
||||
See our website [@babel/cli](https://babeljs.io/docs/babel-cli) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/cli
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/cli --dev
|
||||
```
|
||||
3
node_modules/@babel/cli/bin/babel-external-helpers.js
generated
vendored
Executable file
3
node_modules/@babel/cli/bin/babel-external-helpers.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel-external-helpers");
|
||||
3
node_modules/@babel/cli/bin/babel-external-helpers.mjs
generated
vendored
Normal file
3
node_modules/@babel/cli/bin/babel-external-helpers.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import "../lib/babel-external-helpers.js";
|
||||
3
node_modules/@babel/cli/bin/babel.js
generated
vendored
Executable file
3
node_modules/@babel/cli/bin/babel.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel");
|
||||
3
node_modules/@babel/cli/bin/babel.mjs
generated
vendored
Normal file
3
node_modules/@babel/cli/bin/babel.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import "../lib/babel/index.js";
|
||||
1
node_modules/@babel/cli/index.js
generated
vendored
Normal file
1
node_modules/@babel/cli/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
throw new Error("Use the `@babel/core` package instead of `@babel/cli`.");
|
||||
36
node_modules/@babel/cli/lib/babel-external-helpers.js
generated
vendored
Normal file
36
node_modules/@babel/cli/lib/babel-external-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
function commander() {
|
||||
const data = _interopRequireWildcard(require("commander"), true);
|
||||
commander = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _core() {
|
||||
const data = require("@babel/core");
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
const program = commander().default.program;
|
||||
function collect(value, previousValue) {
|
||||
if (typeof value !== "string") return previousValue;
|
||||
const values = value.split(",");
|
||||
if (previousValue) {
|
||||
previousValue.push(...values);
|
||||
return previousValue;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
program.option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);
|
||||
program.option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");
|
||||
program.usage("[options]");
|
||||
program.parse(process.argv);
|
||||
const opts = program.opts();
|
||||
console.log((0, _core().buildExternalHelpers)(opts.whitelist, opts.outputType));
|
||||
|
||||
//# sourceMappingURL=babel-external-helpers.js.map
|
||||
1
node_modules/@babel/cli/lib/babel-external-helpers.js.map
generated
vendored
Normal file
1
node_modules/@babel/cli/lib/babel-external-helpers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["commander","data","_interopRequireWildcard","require","_core","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","program","collect","value","previousValue","values","split","push","option","usage","parse","process","argv","opts","console","log","buildExternalHelpers","whitelist","outputType"],"sources":["../src/babel-external-helpers.ts"],"sourcesContent":["import * as commander from \"commander\";\nimport { buildExternalHelpers } from \"@babel/core\";\n\nconst program = process.env.BABEL_8_BREAKING\n ? commander.program\n : commander.default.program;\n\nfunction collect(value: unknown, previousValue: Array<string>): Array<string> {\n // If the user passed the option with no value, like \"babel-external-helpers --whitelist\", do nothing.\n if (typeof value !== \"string\") return previousValue;\n\n const values = value.split(\",\");\n\n if (previousValue) {\n previousValue.push(...values);\n return previousValue;\n }\n return values;\n}\n\nprogram.option(\n \"-l, --whitelist [whitelist]\",\n \"Whitelist of helpers to ONLY include\",\n collect,\n);\nprogram.option(\n \"-t, --output-type [type]\",\n \"Type of output (global|umd|var)\",\n \"global\",\n);\n\nprogram.usage(\"[options]\");\nprogram.parse(process.argv);\nconst opts = program.opts();\n\nconsole.log(buildExternalHelpers(opts.whitelist, opts.outputType));\n"],"mappings":";;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmD,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEnD,MAAMW,OAAO,GAETzB,SAAS,CAAD,CAAC,CAACW,OAAO,CAACc,OAAO;AAE7B,SAASC,OAAOA,CAACC,KAAc,EAAEC,aAA4B,EAAiB;EAE5E,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE,OAAOC,aAAa;EAEnD,MAAMC,MAAM,GAAGF,KAAK,CAACG,KAAK,CAAC,GAAG,CAAC;EAE/B,IAAIF,aAAa,EAAE;IACjBA,aAAa,CAACG,IAAI,CAAC,GAAGF,MAAM,CAAC;IAC7B,OAAOD,aAAa;EACtB;EACA,OAAOC,MAAM;AACf;AAEAJ,OAAO,CAACO,MAAM,CACZ,6BAA6B,EAC7B,sCAAsC,EACtCN,OACF,CAAC;AACDD,OAAO,CAACO,MAAM,CACZ,0BAA0B,EAC1B,iCAAiC,EACjC,QACF,CAAC;AAEDP,OAAO,CAACQ,KAAK,CAAC,WAAW,CAAC;AAC1BR,OAAO,CAACS,KAAK,CAACC,OAAO,CAACC,IAAI,CAAC;AAC3B,MAAMC,IAAI,GAAGZ,OAAO,CAACY,IAAI,CAAC,CAAC;AAE3BC,OAAO,CAACC,GAAG,CAAC,IAAAC,4BAAoB,EAACH,IAAI,CAACI,SAAS,EAAEJ,IAAI,CAACK,UAAU,CAAC,CAAC","ignoreList":[]}
|
||||
235
node_modules/@babel/cli/lib/babel/dir.js
generated
vendored
Normal file
235
node_modules/@babel/cli/lib/babel/dir.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
function _slash() {
|
||||
const data = require("slash");
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var util = require("./util.js");
|
||||
var watcher = require("./watcher.js");
|
||||
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
||||
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
||||
const FILE_TYPE = Object.freeze({
|
||||
NON_COMPILABLE: "NON_COMPILABLE",
|
||||
COMPILED: "COMPILED",
|
||||
IGNORED: "IGNORED",
|
||||
ERR_COMPILATION: "ERR_COMPILATION"
|
||||
});
|
||||
function outputFileSync(filePath, data) {
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(filePath), {
|
||||
recursive: true
|
||||
});
|
||||
_fs().writeFileSync(filePath, data);
|
||||
}
|
||||
function _default(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
function _ref() {
|
||||
_ref = _asyncToGenerator(function* ({
|
||||
cliOptions,
|
||||
babelOptions
|
||||
}) {
|
||||
function write(_x2, _x3) {
|
||||
return _write.apply(this, arguments);
|
||||
}
|
||||
function _write() {
|
||||
_write = _asyncToGenerator(function* (src, base) {
|
||||
let relative = _path().relative(base, src);
|
||||
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
||||
return FILE_TYPE.NON_COMPILABLE;
|
||||
}
|
||||
relative = util.withExtension(relative, cliOptions.keepFileExtension ? _path().extname(relative) : cliOptions.outFileExtension);
|
||||
const dest = getDest(relative, base);
|
||||
try {
|
||||
const res = yield util.compile(src, Object.assign({}, babelOptions, {
|
||||
sourceFileName: _slash()(_path().relative(dest + "/..", src))
|
||||
}));
|
||||
if (!res) return FILE_TYPE.IGNORED;
|
||||
if (res.map) {
|
||||
let outputMap = false;
|
||||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||
outputMap = "external";
|
||||
} else if (babelOptions.sourceMaps == null) {
|
||||
outputMap = util.hasDataSourcemap(res.code) ? "external" : "both";
|
||||
}
|
||||
if (outputMap) {
|
||||
const mapLoc = dest + ".map";
|
||||
if (outputMap === "external") {
|
||||
res.code = util.addSourceMappingUrl(res.code, mapLoc);
|
||||
}
|
||||
res.map.file = _path().basename(relative);
|
||||
outputFileSync(mapLoc, JSON.stringify(res.map));
|
||||
}
|
||||
}
|
||||
outputFileSync(dest, res.code);
|
||||
util.chmod(src, dest);
|
||||
if (cliOptions.verbose) {
|
||||
console.log(_path().relative(process.cwd(), src) + " -> " + dest);
|
||||
}
|
||||
return FILE_TYPE.COMPILED;
|
||||
} catch (err) {
|
||||
if (cliOptions.watch) {
|
||||
console.error(err);
|
||||
return FILE_TYPE.ERR_COMPILATION;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
return _write.apply(this, arguments);
|
||||
}
|
||||
function getDest(filename, base) {
|
||||
if (cliOptions.relative) {
|
||||
return _path().join(base, cliOptions.outDir, filename);
|
||||
}
|
||||
return _path().join(cliOptions.outDir, filename);
|
||||
}
|
||||
function handleFile(_x4, _x5) {
|
||||
return _handleFile.apply(this, arguments);
|
||||
}
|
||||
function _handleFile() {
|
||||
_handleFile = _asyncToGenerator(function* (src, base) {
|
||||
const written = yield write(src, base);
|
||||
if (cliOptions.copyFiles && written === FILE_TYPE.NON_COMPILABLE || cliOptions.copyIgnored && written === FILE_TYPE.IGNORED) {
|
||||
const filename = _path().relative(base, src);
|
||||
const dest = getDest(filename, base);
|
||||
outputFileSync(dest, _fs().readFileSync(src));
|
||||
util.chmod(src, dest);
|
||||
}
|
||||
return written === FILE_TYPE.COMPILED;
|
||||
});
|
||||
return _handleFile.apply(this, arguments);
|
||||
}
|
||||
function handle(_x6) {
|
||||
return _handle.apply(this, arguments);
|
||||
}
|
||||
function _handle() {
|
||||
_handle = _asyncToGenerator(function* (filenameOrDir) {
|
||||
if (!_fs().existsSync(filenameOrDir)) return 0;
|
||||
const stat = _fs().statSync(filenameOrDir);
|
||||
if (stat.isDirectory()) {
|
||||
const dirname = filenameOrDir;
|
||||
let count = 0;
|
||||
const files = util.readdir(dirname, cliOptions.includeDotfiles);
|
||||
for (const filename of files) {
|
||||
const written = yield handleFile(filename, dirname);
|
||||
if (written) count += 1;
|
||||
}
|
||||
return count;
|
||||
} else {
|
||||
const filename = filenameOrDir;
|
||||
const written = yield handleFile(filename, _path().dirname(filename));
|
||||
return written ? 1 : 0;
|
||||
}
|
||||
});
|
||||
return _handle.apply(this, arguments);
|
||||
}
|
||||
let compiledFiles = 0;
|
||||
let startTime = null;
|
||||
const logSuccess = util.debounce(function () {
|
||||
if (startTime === null) {
|
||||
return;
|
||||
}
|
||||
const diff = process.hrtime(startTime);
|
||||
console.log(`Successfully compiled ${compiledFiles} ${compiledFiles !== 1 ? "files" : "file"} with Babel (${diff[0] * 1e3 + Math.round(diff[1] / 1e6)}ms).`);
|
||||
compiledFiles = 0;
|
||||
startTime = null;
|
||||
}, 100);
|
||||
if (cliOptions.watch) watcher.enable({
|
||||
enableGlobbing: true
|
||||
});
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
if (cliOptions.deleteDirOnStart) {
|
||||
util.deleteDir(cliOptions.outDir);
|
||||
}
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(cliOptions.outDir, {
|
||||
recursive: true
|
||||
});
|
||||
startTime = process.hrtime();
|
||||
for (const filename of cliOptions.filenames) {
|
||||
compiledFiles += yield handle(filename);
|
||||
}
|
||||
if (!cliOptions.quiet) {
|
||||
logSuccess();
|
||||
logSuccess.flush();
|
||||
}
|
||||
}
|
||||
if (cliOptions.watch) {
|
||||
let processing = 0;
|
||||
const {
|
||||
filenames
|
||||
} = cliOptions;
|
||||
let getBase;
|
||||
if (filenames.length === 1) {
|
||||
const base = filenames[0];
|
||||
const absoluteBase = _path().resolve(base);
|
||||
getBase = filename => {
|
||||
return filename === absoluteBase ? _path().dirname(base) : base;
|
||||
};
|
||||
} else {
|
||||
const filenameToBaseMap = new Map(filenames.map(filename => {
|
||||
const absoluteFilename = _path().resolve(filename);
|
||||
return [absoluteFilename, _path().dirname(filename)];
|
||||
}));
|
||||
const absoluteFilenames = new Map(filenames.map(filename => {
|
||||
const absoluteFilename = _path().resolve(filename);
|
||||
return [absoluteFilename, filename];
|
||||
}));
|
||||
const {
|
||||
sep
|
||||
} = _path();
|
||||
getBase = filename => {
|
||||
const base = filenameToBaseMap.get(filename);
|
||||
if (base !== undefined) {
|
||||
return base;
|
||||
}
|
||||
for (const [absoluteFilenameOrDir, relative] of absoluteFilenames) {
|
||||
if (filename.startsWith(absoluteFilenameOrDir + sep)) {
|
||||
filenameToBaseMap.set(filename, relative);
|
||||
return relative;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
}
|
||||
filenames.forEach(filenameOrDir => {
|
||||
watcher.watch(filenameOrDir);
|
||||
});
|
||||
watcher.startWatcher();
|
||||
watcher.onFilesChange(_asyncToGenerator(function* (filenames) {
|
||||
processing++;
|
||||
if (startTime === null) startTime = process.hrtime();
|
||||
try {
|
||||
const written = yield Promise.all(filenames.map(filename => handleFile(filename, getBase(filename))));
|
||||
compiledFiles += written.filter(Boolean).length;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
processing--;
|
||||
if (processing === 0 && !cliOptions.quiet) logSuccess();
|
||||
}));
|
||||
}
|
||||
});
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=dir.js.map
|
||||
1
node_modules/@babel/cli/lib/babel/dir.js.map
generated
vendored
Normal file
1
node_modules/@babel/cli/lib/babel/dir.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
228
node_modules/@babel/cli/lib/babel/file.js
generated
vendored
Normal file
228
node_modules/@babel/cli/lib/babel/file.js
generated
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
function _convertSourceMap() {
|
||||
const data = require("convert-source-map");
|
||||
_convertSourceMap = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _traceMapping() {
|
||||
const data = require("@jridgewell/trace-mapping");
|
||||
_traceMapping = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _slash() {
|
||||
const data = require("slash");
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var util = require("./util.js");
|
||||
var watcher = require("./watcher.js");
|
||||
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
||||
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
||||
function _default(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
function _ref() {
|
||||
_ref = _asyncToGenerator(function* ({
|
||||
cliOptions,
|
||||
babelOptions
|
||||
}) {
|
||||
function buildResult(fileResults) {
|
||||
const mapSections = [];
|
||||
let code = "";
|
||||
let offset = 0;
|
||||
let hasRawMap = false;
|
||||
for (const result of fileResults) {
|
||||
if (!result) continue;
|
||||
hasRawMap = !!result.map;
|
||||
mapSections.push({
|
||||
offset: {
|
||||
line: offset,
|
||||
column: 0
|
||||
},
|
||||
map: result.map || {
|
||||
version: 3,
|
||||
names: [],
|
||||
sources: [],
|
||||
mappings: []
|
||||
}
|
||||
});
|
||||
code += result.code + "\n";
|
||||
offset += countNewlines(result.code) + 1;
|
||||
}
|
||||
const map = new (_traceMapping().AnyMap)({
|
||||
version: 3,
|
||||
file: cliOptions.sourceMapTarget || _path().basename(cliOptions.outFile || "") || "stdout",
|
||||
sections: mapSections
|
||||
});
|
||||
map.sourceRoot = babelOptions.sourceRoot;
|
||||
if (babelOptions.sourceMaps === "inline" || !cliOptions.outFile && babelOptions.sourceMaps) {
|
||||
code += "\n" + _convertSourceMap().fromObject((0, _traceMapping().encodedMap)(map)).toComment();
|
||||
}
|
||||
return {
|
||||
map: map,
|
||||
code: code,
|
||||
hasRawMap: hasRawMap
|
||||
};
|
||||
}
|
||||
function countNewlines(code) {
|
||||
let count = 0;
|
||||
let index = -1;
|
||||
while ((index = code.indexOf("\n", index + 1)) !== -1) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
function output(fileResults) {
|
||||
const result = buildResult(fileResults);
|
||||
if (cliOptions.outFile) {
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(cliOptions.outFile), {
|
||||
recursive: true
|
||||
});
|
||||
let outputMap = false;
|
||||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||
outputMap = "external";
|
||||
} else if (babelOptions.sourceMaps == null && result.hasRawMap) {
|
||||
outputMap = util.hasDataSourcemap(result.code) ? "external" : "both";
|
||||
}
|
||||
if (outputMap) {
|
||||
const mapLoc = cliOptions.outFile + ".map";
|
||||
if (outputMap === "external") {
|
||||
result.code = util.addSourceMappingUrl(result.code, mapLoc);
|
||||
}
|
||||
_fs().writeFileSync(mapLoc, JSON.stringify((0, _traceMapping().encodedMap)(result.map)));
|
||||
}
|
||||
_fs().writeFileSync(cliOptions.outFile, result.code);
|
||||
} else {
|
||||
process.stdout.write(result.code + "\n");
|
||||
}
|
||||
}
|
||||
function readStdin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let code = "";
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.on("readable", function () {
|
||||
const chunk = process.stdin.read();
|
||||
if (chunk !== null) code += chunk;
|
||||
});
|
||||
process.stdin.on("end", function () {
|
||||
resolve(code);
|
||||
});
|
||||
process.stdin.on("error", reject);
|
||||
});
|
||||
}
|
||||
function stdin() {
|
||||
return _stdin.apply(this, arguments);
|
||||
}
|
||||
function _stdin() {
|
||||
_stdin = _asyncToGenerator(function* () {
|
||||
const code = yield readStdin();
|
||||
const res = yield util.transformRepl(cliOptions.filename, code, Object.assign({}, babelOptions, {
|
||||
sourceFileName: "stdin"
|
||||
}));
|
||||
output([res]);
|
||||
});
|
||||
return _stdin.apply(this, arguments);
|
||||
}
|
||||
function walk(_x2) {
|
||||
return _walk.apply(this, arguments);
|
||||
}
|
||||
function _walk() {
|
||||
_walk = _asyncToGenerator(function* (filenames) {
|
||||
const _filenames = [];
|
||||
filenames.forEach(function (filename) {
|
||||
if (!_fs().existsSync(filename)) return;
|
||||
const stat = _fs().statSync(filename);
|
||||
if (stat.isDirectory()) {
|
||||
_filenames.push(...util.readdirForCompilable(filename, cliOptions.includeDotfiles, cliOptions.extensions));
|
||||
} else {
|
||||
_filenames.push(filename);
|
||||
}
|
||||
});
|
||||
const results = yield Promise.all(_filenames.map(_asyncToGenerator(function* (filename) {
|
||||
let sourceFilename = filename;
|
||||
if (cliOptions.outFile) {
|
||||
sourceFilename = _path().relative(_path().dirname(cliOptions.outFile), sourceFilename);
|
||||
}
|
||||
sourceFilename = _slash()(sourceFilename);
|
||||
try {
|
||||
return yield util.compile(filename, Object.assign({}, babelOptions, {
|
||||
sourceFileName: sourceFilename,
|
||||
sourceMaps: babelOptions.sourceMaps === "inline" ? true : babelOptions.sourceMaps
|
||||
}));
|
||||
} catch (err) {
|
||||
if (!cliOptions.watch) {
|
||||
throw err;
|
||||
}
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
})));
|
||||
output(results);
|
||||
});
|
||||
return _walk.apply(this, arguments);
|
||||
}
|
||||
function files(_x3) {
|
||||
return _files.apply(this, arguments);
|
||||
}
|
||||
function _files() {
|
||||
_files = _asyncToGenerator(function* (filenames) {
|
||||
if (cliOptions.watch) {
|
||||
watcher.enable({
|
||||
enableGlobbing: false
|
||||
});
|
||||
}
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
yield walk(filenames);
|
||||
}
|
||||
if (cliOptions.watch) {
|
||||
filenames.forEach(watcher.watch);
|
||||
watcher.startWatcher();
|
||||
watcher.onFilesChange((changes, event, cause) => {
|
||||
const actionableChange = changes.some(filename => util.isCompilableExtension(filename, cliOptions.extensions) || filenames.includes(filename));
|
||||
if (!actionableChange) return;
|
||||
if (cliOptions.verbose) {
|
||||
console.log(`${event} ${cause}`);
|
||||
}
|
||||
walk(filenames).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
return _files.apply(this, arguments);
|
||||
}
|
||||
if (cliOptions.filenames.length) {
|
||||
yield files(cliOptions.filenames);
|
||||
} else {
|
||||
yield stdin();
|
||||
}
|
||||
});
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=file.js.map
|
||||
1
node_modules/@babel/cli/lib/babel/file.js.map
generated
vendored
Normal file
1
node_modules/@babel/cli/lib/babel/file.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
node_modules/@babel/cli/lib/babel/index.js
generated
vendored
Normal file
18
node_modules/@babel/cli/lib/babel/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
var _options = require("./options.js");
|
||||
var _dir = require("./dir.js");
|
||||
var _file = require("./file.js");
|
||||
const opts = (0, _options.default)(process.argv);
|
||||
if (opts) {
|
||||
const fn = opts.cliOptions.outDir ? _dir.default : _file.default;
|
||||
fn(opts).catch(err => {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
} else {
|
||||
process.exitCode = 2;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@babel/cli/lib/babel/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/cli/lib/babel/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_options","require","_dir","_file","opts","parseArgv","process","argv","fn","cliOptions","outDir","dirCommand","fileCommand","catch","err","console","error","exitCode"],"sources":["../../src/babel/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport parseArgv from \"./options.ts\";\nimport dirCommand from \"./dir.ts\";\nimport fileCommand from \"./file.ts\";\n\nconst opts = parseArgv(process.argv);\n\nif (opts) {\n const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;\n fn(opts).catch(err => {\n console.error(err);\n process.exitCode = 1;\n });\n} else {\n process.exitCode = 2;\n}\n"],"mappings":"AAAA;AAAmB;;AAEnB,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,MAAMG,IAAI,GAAG,IAAAC,gBAAS,EAACC,OAAO,CAACC,IAAI,CAAC;AAEpC,IAAIH,IAAI,EAAE;EACR,MAAMI,EAAE,GAAGJ,IAAI,CAACK,UAAU,CAACC,MAAM,GAAGC,YAAU,GAAGC,aAAW;EAC5DJ,EAAE,CAACJ,IAAI,CAAC,CAACS,KAAK,CAACC,GAAG,IAAI;IACpBC,OAAO,CAACC,KAAK,CAACF,GAAG,CAAC;IAClBR,OAAO,CAACW,QAAQ,GAAG,CAAC;EACtB,CAAC,CAAC;AACJ,CAAC,MAAM;EACLX,OAAO,CAACW,QAAQ,GAAG,CAAC;AACtB","ignoreList":[]}
|
||||
212
node_modules/@babel/cli/lib/babel/options.js
generated
vendored
Normal file
212
node_modules/@babel/cli/lib/babel/options.js
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = parseArgv;
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function commander() {
|
||||
const data = _interopRequireWildcard(require("commander"), true);
|
||||
commander = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _core() {
|
||||
const data = require("@babel/core");
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function glob() {
|
||||
const data = _interopRequireWildcard(require("glob"), true);
|
||||
glob = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _util = require("./util.js");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
const program = commander().default.program;
|
||||
program.option("-f, --filename [filename]", "The filename to use when reading from stdin. This will be used in source-maps, errors etc.");
|
||||
program.option("--presets [list]", "A comma-separated list of preset names.", collect);
|
||||
program.option("--plugins [list]", "A comma-separated list of plugin names.", collect);
|
||||
program.option("--config-file [path]", "Path to a .babelrc file to use.");
|
||||
program.option("--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + "Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.");
|
||||
program.option("--root-mode [mode]", "The project-root resolution mode. " + "One of 'root' (the default), 'upward', or 'upward-optional'.");
|
||||
program.option("--source-type [script|module]", "");
|
||||
program.option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files.");
|
||||
program.option("--ignore [list]", "List of glob paths to **not** compile.", collect);
|
||||
program.option("--only [list]", "List of glob paths to **only** compile.", collect);
|
||||
program.option("--no-highlight-code", "Enable or disable ANSI syntax highlighting of code frames. (on by default)");
|
||||
program.option("--no-comments", "Write comments to generated output. (true by default)");
|
||||
program.option("--retain-lines", "Retain line numbers. This will result in really ugly code.");
|
||||
program.option("--compact [true|false|auto]", "Do not include superfluous whitespace characters and line terminators.", booleanify);
|
||||
program.option("--minified", "Save as many bytes when printing. (false by default)");
|
||||
program.option("--auxiliary-comment-before [string]", "Print a comment before any injected non-user code.");
|
||||
program.option("--auxiliary-comment-after [string]", "Print a comment after any injected non-user code.");
|
||||
program.option("-s, --source-maps [true|false|inline|both]", "", booleanify, undefined);
|
||||
program.option("--source-map-target [string]", "Set `file` on returned source map.");
|
||||
program.option("--source-file-name [string]", "Set `sources[0]` on returned source map.");
|
||||
program.option("--source-root [filename]", "The root from which all sources are relative.");
|
||||
{
|
||||
program.option("--module-root [filename]", "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.");
|
||||
program.option("-M, --module-ids", "Insert an explicit id for modules.");
|
||||
program.option("--module-id [string]", "Specify a custom name for module ids.");
|
||||
}
|
||||
program.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been the input. [" + _core().DEFAULT_EXTENSIONS.join() + "]", collect);
|
||||
program.option("--keep-file-extension", "Preserve the file extensions of the input files.");
|
||||
program.option("-w, --watch", "Recompile files on changes.");
|
||||
program.option("--skip-initial-build", "Do not compile files before watching.");
|
||||
program.option("-o, --out-file [out]", "Compile all input files into a single file.");
|
||||
program.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory.");
|
||||
program.option("--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]");
|
||||
program.option("-D, --copy-files", "When compiling a directory copy over non-compilable files.");
|
||||
program.option("--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files.");
|
||||
program.option("--no-copy-ignored", "Exclude ignored files when copying non-compilable files.");
|
||||
program.option("--verbose", "Log everything. This option conflicts with --quiet");
|
||||
program.option("--quiet", "Don't log anything. This option conflicts with --verbose");
|
||||
program.option("--delete-dir-on-start", "Delete the out directory before compilation.");
|
||||
program.option("--out-file-extension [string]", "Use a specific extension for the output files");
|
||||
program.version("7.25.9" + " (@babel/core " + _core().version + ")");
|
||||
program.usage("[options] <files ...>");
|
||||
program.action(() => {});
|
||||
function parseArgv(args) {
|
||||
program.parse(args);
|
||||
const opts = program.opts();
|
||||
const errors = [];
|
||||
let filenames = program.args.reduce(function (globbed, input) {
|
||||
let files = glob().sync(input);
|
||||
if (!files.length) files = [input];
|
||||
globbed.push(...files);
|
||||
return globbed;
|
||||
}, []);
|
||||
filenames = Array.from(new Set(filenames));
|
||||
filenames.forEach(function (filename) {
|
||||
if (!_fs().existsSync(filename)) {
|
||||
errors.push(filename + " does not exist");
|
||||
}
|
||||
});
|
||||
if (opts.outDir && !filenames.length) {
|
||||
errors.push("--out-dir requires filenames");
|
||||
}
|
||||
if (opts.outFile && opts.outDir) {
|
||||
errors.push("--out-file and --out-dir cannot be used together");
|
||||
}
|
||||
if (opts.relative && !opts.outDir) {
|
||||
errors.push("--relative requires --out-dir usage");
|
||||
}
|
||||
if (opts.watch) {
|
||||
if (!opts.outFile && !opts.outDir) {
|
||||
errors.push("--watch requires --out-file or --out-dir");
|
||||
}
|
||||
if (!filenames.length) {
|
||||
errors.push("--watch requires filenames");
|
||||
}
|
||||
}
|
||||
if (opts.skipInitialBuild && !opts.watch) {
|
||||
errors.push("--skip-initial-build requires --watch");
|
||||
}
|
||||
if (opts.deleteDirOnStart && !opts.outDir) {
|
||||
errors.push("--delete-dir-on-start requires --out-dir");
|
||||
}
|
||||
if (opts.verbose && opts.quiet) {
|
||||
errors.push("--verbose and --quiet cannot be used together");
|
||||
}
|
||||
if (!opts.outDir && filenames.length === 0 && typeof opts.filename !== "string" && opts.babelrc !== false) {
|
||||
errors.push("stdin compilation requires either -f/--filename [filename] or --no-babelrc");
|
||||
}
|
||||
if (opts.keepFileExtension && opts.outFileExtension) {
|
||||
errors.push("--out-file-extension cannot be used with --keep-file-extension");
|
||||
}
|
||||
if (errors.length) {
|
||||
console.error("babel:");
|
||||
errors.forEach(function (e) {
|
||||
console.error(" " + e);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
const babelOptions = {
|
||||
presets: opts.presets,
|
||||
plugins: opts.plugins,
|
||||
rootMode: opts.rootMode,
|
||||
configFile: opts.configFile,
|
||||
envName: opts.envName,
|
||||
sourceType: opts.sourceType,
|
||||
ignore: opts.ignore,
|
||||
only: opts.only,
|
||||
retainLines: opts.retainLines,
|
||||
compact: opts.compact,
|
||||
minified: opts.minified,
|
||||
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
||||
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
||||
sourceMaps: opts.sourceMaps,
|
||||
sourceFileName: opts.sourceFileName,
|
||||
sourceRoot: opts.sourceRoot,
|
||||
babelrc: opts.babelrc === true ? undefined : opts.babelrc,
|
||||
highlightCode: opts.highlightCode === true ? undefined : opts.highlightCode,
|
||||
comments: opts.comments === true ? undefined : opts.comments
|
||||
};
|
||||
{
|
||||
Object.assign(babelOptions, {
|
||||
moduleRoot: opts.moduleRoot,
|
||||
moduleIds: opts.moduleIds,
|
||||
moduleId: opts.moduleId
|
||||
});
|
||||
}
|
||||
for (const key of Object.keys(babelOptions)) {
|
||||
if (babelOptions[key] === undefined) {
|
||||
delete babelOptions[key];
|
||||
}
|
||||
}
|
||||
return {
|
||||
babelOptions,
|
||||
cliOptions: {
|
||||
filename: opts.filename,
|
||||
filenames,
|
||||
extensions: opts.extensions,
|
||||
keepFileExtension: opts.keepFileExtension,
|
||||
outFileExtension: opts.outFileExtension,
|
||||
watch: opts.watch,
|
||||
skipInitialBuild: opts.skipInitialBuild,
|
||||
outFile: opts.outFile,
|
||||
outDir: opts.outDir,
|
||||
relative: opts.relative,
|
||||
copyFiles: opts.copyFiles,
|
||||
copyIgnored: opts.copyFiles && opts.copyIgnored,
|
||||
includeDotfiles: opts.includeDotfiles,
|
||||
verbose: opts.verbose,
|
||||
quiet: opts.quiet,
|
||||
deleteDirOnStart: opts.deleteDirOnStart,
|
||||
sourceMapTarget: opts.sourceMapTarget
|
||||
}
|
||||
};
|
||||
}
|
||||
function booleanify(val) {
|
||||
if (val === "true" || val === "1") {
|
||||
return true;
|
||||
}
|
||||
if (val === "false" || val === "0" || val === "") {
|
||||
return false;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
function collect(value, previousValue) {
|
||||
if (typeof value !== "string") return previousValue;
|
||||
const values = value.split(",");
|
||||
if (previousValue) {
|
||||
previousValue.push(...values);
|
||||
return previousValue;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
node_modules/@babel/cli/lib/babel/options.js.map
generated
vendored
Normal file
1
node_modules/@babel/cli/lib/babel/options.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
161
node_modules/@babel/cli/lib/babel/util.js
generated
vendored
Normal file
161
node_modules/@babel/cli/lib/babel/util.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.addSourceMappingUrl = addSourceMappingUrl;
|
||||
exports.alphasort = alphasort;
|
||||
exports.chmod = chmod;
|
||||
exports.compile = compile;
|
||||
exports.debounce = debounce;
|
||||
exports.deleteDir = deleteDir;
|
||||
exports.hasDataSourcemap = hasDataSourcemap;
|
||||
exports.isCompilableExtension = isCompilableExtension;
|
||||
exports.readdir = readdir;
|
||||
exports.readdirForCompilable = readdirForCompilable;
|
||||
exports.transformRepl = transformRepl;
|
||||
exports.withExtension = withExtension;
|
||||
function _fsReaddirRecursive() {
|
||||
const data = require("fs-readdir-recursive");
|
||||
_fsReaddirRecursive = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function babel() {
|
||||
const data = require("@babel/core");
|
||||
babel = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var watcher = require("./watcher.js");
|
||||
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
||||
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
||||
function chmod(src, dest) {
|
||||
try {
|
||||
_fs().chmodSync(dest, _fs().statSync(src).mode);
|
||||
} catch (_) {
|
||||
console.warn(`Cannot change permissions of ${dest}`);
|
||||
}
|
||||
}
|
||||
function alphasort(a, b) {
|
||||
return a.localeCompare(b, "en");
|
||||
}
|
||||
function readdir(dirname, includeDotfiles, filter) {
|
||||
{
|
||||
return _fsReaddirRecursive()("", (filename, index, currentDirectory) => {
|
||||
const stat = _fs().statSync(_path().join(currentDirectory, filename));
|
||||
if (stat.isDirectory()) return true;
|
||||
return (includeDotfiles || filename[0] !== ".") && (!filter || filter(filename));
|
||||
}, [], dirname);
|
||||
}
|
||||
}
|
||||
function readdirForCompilable(dirname, includeDotfiles, altExts) {
|
||||
return readdir(dirname, includeDotfiles, function (filename) {
|
||||
return isCompilableExtension(filename, altExts);
|
||||
});
|
||||
}
|
||||
function isCompilableExtension(filename, altExts) {
|
||||
const exts = altExts || babel().DEFAULT_EXTENSIONS;
|
||||
const ext = _path().extname(filename);
|
||||
return exts.includes(ext);
|
||||
}
|
||||
function addSourceMappingUrl(code, loc) {
|
||||
return code + "\n//# sourceMappingURL=" + _path().basename(loc);
|
||||
}
|
||||
function hasDataSourcemap(code) {
|
||||
const pos = code.lastIndexOf("\n", code.length - 2);
|
||||
return pos !== -1 && code.lastIndexOf("//# sourceMappingURL") < pos;
|
||||
}
|
||||
const CALLER = {
|
||||
name: "@babel/cli"
|
||||
};
|
||||
function transformRepl(filename, code, opts) {
|
||||
opts = Object.assign({}, opts, {
|
||||
caller: CALLER,
|
||||
filename
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
babel().transform(code, opts, (err, result) => {
|
||||
if (err) reject(err);else resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
function compile(_x, _x2) {
|
||||
return _compile.apply(this, arguments);
|
||||
}
|
||||
function _compile() {
|
||||
_compile = _asyncToGenerator(function* (filename, opts) {
|
||||
opts = Object.assign({}, opts, {
|
||||
caller: CALLER
|
||||
});
|
||||
const result = yield new Promise((resolve, reject) => {
|
||||
babel().transformFile(filename, opts, (err, result) => {
|
||||
if (err) reject(err);else resolve(result);
|
||||
});
|
||||
});
|
||||
if (result) {
|
||||
{
|
||||
if (!result.externalDependencies) return result;
|
||||
}
|
||||
watcher.updateExternalDependencies(filename, result.externalDependencies);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
return _compile.apply(this, arguments);
|
||||
}
|
||||
function deleteDir(path) {
|
||||
(_fs().rmSync || function d(p) {
|
||||
if (_fs().existsSync(p)) {
|
||||
_fs().readdirSync(p).forEach(function (f) {
|
||||
const c = p + "/" + f;
|
||||
if (_fs().lstatSync(c).isDirectory()) {
|
||||
d(c);
|
||||
} else {
|
||||
_fs().unlinkSync(c);
|
||||
}
|
||||
});
|
||||
_fs().rmdirSync(p);
|
||||
}
|
||||
})(path, {
|
||||
force: true,
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
process.on("uncaughtException", function (err) {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
function withExtension(filename, ext = ".js") {
|
||||
const newBasename = _path().basename(filename, _path().extname(filename)) + ext;
|
||||
return _path().join(_path().dirname(filename), newBasename);
|
||||
}
|
||||
function debounce(fn, time) {
|
||||
let timer;
|
||||
function debounced() {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(fn, time);
|
||||
}
|
||||
debounced.flush = () => {
|
||||
clearTimeout(timer);
|
||||
fn();
|
||||
};
|
||||
return debounced;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=util.js.map
|
||||
1
node_modules/@babel/cli/lib/babel/util.js.map
generated
vendored
Normal file
1
node_modules/@babel/cli/lib/babel/util.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
129
node_modules/@babel/cli/lib/babel/watcher.js
generated
vendored
Normal file
129
node_modules/@babel/cli/lib/babel/watcher.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.enable = enable;
|
||||
exports.onFilesChange = onFilesChange;
|
||||
exports.startWatcher = startWatcher;
|
||||
exports.updateExternalDependencies = updateExternalDependencies;
|
||||
exports.watch = watch;
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
const fileToDeps = new Map();
|
||||
const depToFiles = new Map();
|
||||
let isWatchMode = false;
|
||||
let watcher;
|
||||
const watchQueue = new Set();
|
||||
let hasStarted = false;
|
||||
function enable({
|
||||
enableGlobbing
|
||||
}) {
|
||||
isWatchMode = true;
|
||||
const {
|
||||
FSWatcher
|
||||
} = requireChokidar();
|
||||
const options = {
|
||||
disableGlobbing: !enableGlobbing,
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 50,
|
||||
pollInterval: 10
|
||||
}
|
||||
};
|
||||
watcher = new FSWatcher(options);
|
||||
watcher.on("unlink", unwatchFile);
|
||||
}
|
||||
function startWatcher() {
|
||||
hasStarted = true;
|
||||
for (const dep of watchQueue) {
|
||||
watcher.add(dep);
|
||||
}
|
||||
watchQueue.clear();
|
||||
watcher.on("ready", () => {
|
||||
console.log("The watcher is ready.");
|
||||
});
|
||||
}
|
||||
function watch(filename) {
|
||||
if (!isWatchMode) {
|
||||
throw new Error("Internal Babel error: .watch called when not in watch mode.");
|
||||
}
|
||||
if (!hasStarted) {
|
||||
watchQueue.add(_path().resolve(filename));
|
||||
} else {
|
||||
watcher.add(_path().resolve(filename));
|
||||
}
|
||||
}
|
||||
function onFilesChange(callback) {
|
||||
if (!isWatchMode) {
|
||||
throw new Error("Internal Babel error: .onFilesChange called when not in watch mode.");
|
||||
}
|
||||
watcher.on("all", (event, filename) => {
|
||||
var _depToFiles$get;
|
||||
if (event !== "change" && event !== "add") return;
|
||||
const absoluteFile = _path().resolve(filename);
|
||||
callback([absoluteFile, ...((_depToFiles$get = depToFiles.get(absoluteFile)) != null ? _depToFiles$get : [])], event, absoluteFile);
|
||||
});
|
||||
}
|
||||
function updateExternalDependencies(filename, dependencies) {
|
||||
if (!isWatchMode) return;
|
||||
const absFilename = _path().resolve(filename);
|
||||
const absDependencies = new Set(Array.from(dependencies, dep => _path().resolve(dep)));
|
||||
const deps = fileToDeps.get(absFilename);
|
||||
if (deps) {
|
||||
for (const dep of deps) {
|
||||
if (!absDependencies.has(dep)) {
|
||||
removeFileDependency(absFilename, dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const dep of absDependencies) {
|
||||
let deps = depToFiles.get(dep);
|
||||
if (!deps) {
|
||||
depToFiles.set(dep, deps = new Set());
|
||||
if (!hasStarted) {
|
||||
watchQueue.add(dep);
|
||||
} else {
|
||||
watcher.add(dep);
|
||||
}
|
||||
}
|
||||
deps.add(absFilename);
|
||||
}
|
||||
fileToDeps.set(absFilename, absDependencies);
|
||||
}
|
||||
function removeFileDependency(filename, dep) {
|
||||
const deps = depToFiles.get(dep);
|
||||
deps.delete(filename);
|
||||
if (deps.size === 0) {
|
||||
depToFiles.delete(dep);
|
||||
if (!hasStarted) {
|
||||
watchQueue.delete(dep);
|
||||
} else {
|
||||
watcher.unwatch(dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
function unwatchFile(filename) {
|
||||
const deps = fileToDeps.get(filename);
|
||||
if (!deps) return;
|
||||
for (const dep of deps) {
|
||||
removeFileDependency(filename, dep);
|
||||
}
|
||||
fileToDeps.delete(filename);
|
||||
}
|
||||
function requireChokidar() {
|
||||
try {
|
||||
return parseInt(process.versions.node) >= 8 ? require("chokidar") : require("@nicolo-ribaudo/chokidar-2");
|
||||
} catch (err) {
|
||||
console.error("The optional dependency chokidar failed to install and is required for " + "--watch. Chokidar is likely not supported on your platform.");
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=watcher.js.map
|
||||
1
node_modules/@babel/cli/lib/babel/watcher.js.map
generated
vendored
Normal file
1
node_modules/@babel/cli/lib/babel/watcher.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
57
node_modules/@babel/cli/package.json
generated
vendored
Normal file
57
node_modules/@babel/cli/package.json
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "@babel/cli",
|
||||
"version": "7.25.9",
|
||||
"description": "Babel command line.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-cli",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-cli"
|
||||
},
|
||||
"keywords": [
|
||||
"6to5",
|
||||
"babel",
|
||||
"es6",
|
||||
"transpile",
|
||||
"transpiler",
|
||||
"babel-cli",
|
||||
"compiler"
|
||||
],
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"commander": "^6.2.0",
|
||||
"convert-source-map": "^2.0.0",
|
||||
"fs-readdir-recursive": "^1.1.0",
|
||||
"glob": "^7.2.0",
|
||||
"make-dir": "^2.1.0",
|
||||
"slash": "^2.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3",
|
||||
"chokidar": "^3.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.9",
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.25.9",
|
||||
"@types/fs-readdir-recursive": "^1.1.0",
|
||||
"@types/glob": "^7.2.0",
|
||||
"semver": "^6.3.1"
|
||||
},
|
||||
"bin": {
|
||||
"babel": "./bin/babel.js",
|
||||
"babel-external-helpers": "./bin/babel-external-helpers.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
||||
Reference in New Issue
Block a user