initial commit
This commit is contained in:
22
node_modules/@babel/standalone/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/standalone/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/standalone/README.md
generated
vendored
Normal file
19
node_modules/@babel/standalone/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/standalone
|
||||
|
||||
> Standalone build of Babel for use in non-Node.js environments.
|
||||
|
||||
See our website [@babel/standalone](https://babeljs.io/docs/en/babel-standalone) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20standalone%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/standalone
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/standalone --dev
|
||||
```
|
||||
126516
node_modules/@babel/standalone/babel.js
generated
vendored
Normal file
126516
node_modules/@babel/standalone/babel.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@babel/standalone/babel.js.map
generated
vendored
Normal file
1
node_modules/@babel/standalone/babel.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
node_modules/@babel/standalone/babel.min.js
generated
vendored
Normal file
15
node_modules/@babel/standalone/babel.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@babel/standalone/babel.min.js.map
generated
vendored
Normal file
1
node_modules/@babel/standalone/babel.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
139
node_modules/@babel/standalone/package.json
generated
vendored
Normal file
139
node_modules/@babel/standalone/package.json
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
{
|
||||
"name": "@babel/standalone",
|
||||
"version": "7.20.11",
|
||||
"description": "Standalone build of Babel for use in non-Node.js environments.",
|
||||
"main": "./babel.js",
|
||||
"files": [
|
||||
"babel.js",
|
||||
"babel.js.map",
|
||||
"babel.min.js",
|
||||
"babel.min.js.map"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.7",
|
||||
"@babel/plugin-external-helpers": "^7.18.6",
|
||||
"@babel/plugin-proposal-async-generator-functions": "^7.20.7",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-proposal-class-static-block": "^7.20.7",
|
||||
"@babel/plugin-proposal-decorators": "^7.20.7",
|
||||
"@babel/plugin-proposal-destructuring-private": "^7.18.9",
|
||||
"@babel/plugin-proposal-do-expressions": "^7.18.6",
|
||||
"@babel/plugin-proposal-duplicate-named-capturing-groups-regex": "^7.20.5",
|
||||
"@babel/plugin-proposal-dynamic-import": "^7.18.6",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.18.10",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
|
||||
"@babel/plugin-proposal-function-bind": "^7.18.9",
|
||||
"@babel/plugin-proposal-function-sent": "^7.18.6",
|
||||
"@babel/plugin-proposal-json-strings": "^7.18.6",
|
||||
"@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
||||
"@babel/plugin-proposal-optional-catch-binding": "^7.18.6",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.20.7",
|
||||
"@babel/plugin-proposal-pipeline-operator": "^7.18.9",
|
||||
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
||||
"@babel/plugin-proposal-private-property-in-object": "^7.20.5",
|
||||
"@babel/plugin-proposal-record-and-tuple": "^7.18.6",
|
||||
"@babel/plugin-proposal-throw-expressions": "^7.18.6",
|
||||
"@babel/plugin-proposal-unicode-property-regex": "^7.18.6",
|
||||
"@babel/plugin-proposal-unicode-sets-regex": "^7.18.6",
|
||||
"@babel/plugin-syntax-decimal": "^7.18.6",
|
||||
"@babel/plugin-syntax-decorators": "^7.19.0",
|
||||
"@babel/plugin-syntax-destructuring-private": "^7.18.6",
|
||||
"@babel/plugin-syntax-do-expressions": "^7.18.6",
|
||||
"@babel/plugin-syntax-explicit-resource-management": "^7.20.0",
|
||||
"@babel/plugin-syntax-export-default-from": "^7.18.6",
|
||||
"@babel/plugin-syntax-flow": "^7.18.6",
|
||||
"@babel/plugin-syntax-function-bind": "^7.18.6",
|
||||
"@babel/plugin-syntax-function-sent": "^7.18.6",
|
||||
"@babel/plugin-syntax-import-assertions": "^7.20.0",
|
||||
"@babel/plugin-syntax-import-reflection": "^7.20.0",
|
||||
"@babel/plugin-syntax-jsx": "^7.18.6",
|
||||
"@babel/plugin-syntax-module-blocks": "^7.18.6",
|
||||
"@babel/plugin-syntax-pipeline-operator": "^7.18.6",
|
||||
"@babel/plugin-syntax-record-and-tuple": "^7.18.6",
|
||||
"@babel/plugin-syntax-typescript": "^7.20.0",
|
||||
"@babel/plugin-transform-arrow-functions": "^7.20.7",
|
||||
"@babel/plugin-transform-async-to-generator": "^7.20.7",
|
||||
"@babel/plugin-transform-block-scoped-functions": "^7.18.6",
|
||||
"@babel/plugin-transform-block-scoping": "^7.20.11",
|
||||
"@babel/plugin-transform-classes": "^7.20.7",
|
||||
"@babel/plugin-transform-computed-properties": "^7.20.7",
|
||||
"@babel/plugin-transform-destructuring": "^7.20.7",
|
||||
"@babel/plugin-transform-dotall-regex": "^7.18.6",
|
||||
"@babel/plugin-transform-duplicate-keys": "^7.18.9",
|
||||
"@babel/plugin-transform-exponentiation-operator": "^7.18.6",
|
||||
"@babel/plugin-transform-flow-comments": "^7.19.0",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.19.0",
|
||||
"@babel/plugin-transform-for-of": "^7.18.8",
|
||||
"@babel/plugin-transform-function-name": "^7.18.9",
|
||||
"@babel/plugin-transform-instanceof": "^7.18.9",
|
||||
"@babel/plugin-transform-jscript": "^7.20.2",
|
||||
"@babel/plugin-transform-literals": "^7.18.9",
|
||||
"@babel/plugin-transform-member-expression-literals": "^7.18.6",
|
||||
"@babel/plugin-transform-modules-amd": "^7.20.11",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.20.11",
|
||||
"@babel/plugin-transform-modules-systemjs": "^7.20.11",
|
||||
"@babel/plugin-transform-modules-umd": "^7.18.6",
|
||||
"@babel/plugin-transform-named-capturing-groups-regex": "^7.20.5",
|
||||
"@babel/plugin-transform-new-target": "^7.18.6",
|
||||
"@babel/plugin-transform-object-assign": "^7.18.6",
|
||||
"@babel/plugin-transform-object-set-prototype-of-to-assign": "^7.18.6",
|
||||
"@babel/plugin-transform-object-super": "^7.18.6",
|
||||
"@babel/plugin-transform-parameters": "^7.20.7",
|
||||
"@babel/plugin-transform-property-literals": "^7.18.6",
|
||||
"@babel/plugin-transform-property-mutators": "^7.20.7",
|
||||
"@babel/plugin-transform-proto-to-assign": "^7.20.7",
|
||||
"@babel/plugin-transform-react-constant-elements": "^7.20.2",
|
||||
"@babel/plugin-transform-react-display-name": "^7.18.6",
|
||||
"@babel/plugin-transform-react-inline-elements": "^7.18.6",
|
||||
"@babel/plugin-transform-react-jsx": "^7.20.7",
|
||||
"@babel/plugin-transform-react-jsx-compat": "^7.18.6",
|
||||
"@babel/plugin-transform-react-jsx-development": "^7.18.6",
|
||||
"@babel/plugin-transform-react-jsx-self": "^7.18.6",
|
||||
"@babel/plugin-transform-react-jsx-source": "^7.19.6",
|
||||
"@babel/plugin-transform-regenerator": "^7.20.5",
|
||||
"@babel/plugin-transform-reserved-words": "^7.18.6",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/plugin-transform-shorthand-properties": "^7.18.6",
|
||||
"@babel/plugin-transform-spread": "^7.20.7",
|
||||
"@babel/plugin-transform-sticky-regex": "^7.18.6",
|
||||
"@babel/plugin-transform-strict-mode": "^7.18.6",
|
||||
"@babel/plugin-transform-template-literals": "^7.18.9",
|
||||
"@babel/plugin-transform-typeof-symbol": "^7.18.9",
|
||||
"@babel/plugin-transform-typescript": "^7.20.7",
|
||||
"@babel/plugin-transform-unicode-escapes": "^7.18.10",
|
||||
"@babel/plugin-transform-unicode-regex": "^7.18.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-flow": "^7.18.6",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"acorn": "^8.7.0"
|
||||
},
|
||||
"keywords": [
|
||||
"babel",
|
||||
"babeljs",
|
||||
"6to5",
|
||||
"transpile",
|
||||
"transpiler"
|
||||
],
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20standalone%22+is%3Aopen"
|
||||
},
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-standalone",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-standalone"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
||||
257
node_modules/@babel/standalone/test/babel.js
generated
vendored
Normal file
257
node_modules/@babel/standalone/test/babel.js
generated
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
import { createRequire } from "module";
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
// Basic smoke tests for @babel/standalone
|
||||
describe("@babel/standalone", () => {
|
||||
let Babel;
|
||||
beforeAll(() => {
|
||||
Babel = require("../babel.js");
|
||||
});
|
||||
|
||||
it("handles the es2015-no-commonjs preset", () => {
|
||||
const output = Babel.transform('const getMessage = () => "Hello World"', {
|
||||
presets: ["es2015-no-commonjs"],
|
||||
}).code;
|
||||
expect(output).toBe(
|
||||
"var getMessage = function getMessage() {\n" +
|
||||
' return "Hello World";\n' +
|
||||
"};",
|
||||
);
|
||||
});
|
||||
it("handles the es2015-loose preset", () => {
|
||||
const output = Babel.transform("class A {}", {
|
||||
sourceType: "script",
|
||||
presets: ["es2015-loose"],
|
||||
}).code;
|
||||
expect(output).toBe('var A = function A() {\n "use strict";\n};');
|
||||
});
|
||||
it("handles the typescript preset", () => {
|
||||
const output = Babel.transform("var a: string;", {
|
||||
presets: [["typescript", { allExtensions: true }]],
|
||||
}).code;
|
||||
expect(output).toBe("var a;");
|
||||
});
|
||||
it("handles the flow preset", () => {
|
||||
const output = Babel.transform("var a: string;", {
|
||||
presets: ["flow"],
|
||||
}).code;
|
||||
expect(output).toBe("var a;");
|
||||
});
|
||||
it("can translate simple ast", () => {
|
||||
const ast = {
|
||||
type: "Program",
|
||||
start: 0,
|
||||
end: 2,
|
||||
directives: [],
|
||||
body: [
|
||||
{
|
||||
type: "ExpressionStatement",
|
||||
start: 0,
|
||||
end: 1,
|
||||
expression: {
|
||||
type: "NumericLiteral",
|
||||
start: 0,
|
||||
end: 2,
|
||||
value: 42,
|
||||
raw: "42",
|
||||
},
|
||||
},
|
||||
],
|
||||
sourceType: "script",
|
||||
};
|
||||
const output = Babel.transformFromAst(ast, "42", {
|
||||
presets: ["es2015"],
|
||||
}).code;
|
||||
expect(output).toBe("42;");
|
||||
});
|
||||
|
||||
it("handles the react preset", () => {
|
||||
const output = Babel.transform(
|
||||
"const someDiv = <div>{getMessage()}</div>",
|
||||
{
|
||||
presets: [["react", { runtime: "classic" }]],
|
||||
},
|
||||
).code;
|
||||
expect(output).toBe(
|
||||
'const someDiv = /*#__PURE__*/React.createElement("div", null, getMessage());',
|
||||
);
|
||||
});
|
||||
|
||||
it("handles presets with options", () => {
|
||||
const output = Babel.transform("export let x", {
|
||||
presets: [["es2015", { modules: false }]],
|
||||
}).code;
|
||||
expect(output).toBe("export var x;");
|
||||
});
|
||||
|
||||
it("handles specifying a plugin by name", () => {
|
||||
const output = Babel.transform('const getMessage = () => "Hello World"', {
|
||||
plugins: ["transform-arrow-functions"],
|
||||
}).code;
|
||||
// Transforms arrow syntax but NOT "const".
|
||||
expect(output).toBe(
|
||||
"const getMessage = function () {\n" + ' return "Hello World";\n' + "};",
|
||||
);
|
||||
});
|
||||
|
||||
it("handles plugins with options", () => {
|
||||
const output = Babel.transform("`${x}`", {
|
||||
plugins: [["transform-template-literals", { loose: true }]],
|
||||
}).code;
|
||||
expect(output).toBe('"" + x;');
|
||||
});
|
||||
|
||||
it("throws on invalid preset name", () => {
|
||||
expect(() => Babel.transform("var foo", { presets: ["lolfail"] })).toThrow(
|
||||
/Invalid preset specified in Babel options: "lolfail"/,
|
||||
);
|
||||
});
|
||||
|
||||
it("throws on invalid plugin name", () => {
|
||||
expect(() => Babel.transform("var foo", { plugins: ["lolfail"] })).toThrow(
|
||||
/Invalid plugin specified in Babel options: "lolfail"/,
|
||||
);
|
||||
});
|
||||
|
||||
describe("env preset", () => {
|
||||
it("works w/o targets", () => {
|
||||
const output = Babel.transform("const a = 1;", {
|
||||
sourceType: "script",
|
||||
presets: [["env", { targets: { browsers: "ie 6" } }]],
|
||||
}).code;
|
||||
expect(output).toBe("var a = 1;");
|
||||
});
|
||||
|
||||
it("doesn't transpile `const` with chrome 60", () => {
|
||||
const output = Babel.transform("const a = 1;", {
|
||||
sourceType: "script",
|
||||
presets: [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
targets: {
|
||||
chrome: 60,
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
}).code;
|
||||
expect(output).toBe("const a = 1;");
|
||||
});
|
||||
|
||||
it("transpiles `const` with chrome 60 and preset-es2015", () => {
|
||||
const output = Babel.transform("const a = 1;", {
|
||||
sourceType: "script",
|
||||
presets: [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
targets: {
|
||||
chrome: 60,
|
||||
},
|
||||
},
|
||||
],
|
||||
"es2015",
|
||||
],
|
||||
}).code;
|
||||
expect(output).toBe("var a = 1;");
|
||||
});
|
||||
|
||||
it("uses transform-new-targets plugin", () => {
|
||||
const output = Babel.transform("function Foo() {new.target}", {
|
||||
sourceType: "script",
|
||||
presets: [["env", { targets: { browsers: "ie 6" } }]],
|
||||
}).code;
|
||||
expect(output).toBe(
|
||||
"function Foo() {\n this instanceof Foo ? this.constructor : void 0;\n}",
|
||||
);
|
||||
});
|
||||
|
||||
it("useBuiltIns works", () => {
|
||||
const output = Babel.transform("[].includes(2)", {
|
||||
sourceType: "module",
|
||||
targets: { ie: 11 },
|
||||
presets: [["env", { useBuiltIns: "usage", corejs: 3, modules: false }]],
|
||||
}).code;
|
||||
|
||||
expect(output).toMatchInlineSnapshot(`
|
||||
"import \\"core-js/modules/es.array.includes.js\\";
|
||||
[].includes(2);"
|
||||
`);
|
||||
});
|
||||
|
||||
it("regenerator works", () => {
|
||||
const output = Babel.transform("function* fn() {}", {
|
||||
sourceType: "module",
|
||||
targets: { ie: 11 },
|
||||
presets: ["env"],
|
||||
}).code;
|
||||
|
||||
expect(output).toMatch("regeneratorRuntime().mark(fn)");
|
||||
});
|
||||
});
|
||||
|
||||
describe("custom plugins and presets", () => {
|
||||
const lolizer = () => ({
|
||||
visitor: {
|
||||
Identifier(path) {
|
||||
path.node.name = "LOL";
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
it("allows custom plugins to be registered", () => {
|
||||
Babel.registerPlugin("lolizer", lolizer);
|
||||
const output = Babel.transform(
|
||||
"function helloWorld() { alert(hello); }",
|
||||
{ plugins: ["lolizer"] },
|
||||
);
|
||||
expect(output.code).toBe(`function LOL() {
|
||||
LOL(LOL);
|
||||
}`);
|
||||
});
|
||||
|
||||
it("allows custom presets to be registered", () => {
|
||||
Babel.registerPreset("lulz", { plugins: [lolizer] });
|
||||
const output = Babel.transform(
|
||||
"function helloWorld() { alert(hello); }",
|
||||
{ presets: ["lulz"] },
|
||||
);
|
||||
expect(output.code).toBe(`function LOL() {
|
||||
LOL(LOL);
|
||||
}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("regressions", () => {
|
||||
it("#11534 - supports quantifiers in unicode regexps", () => {
|
||||
expect(() =>
|
||||
Babel.transform("/a*/u", { presets: ["es2015"] }),
|
||||
).not.toThrow();
|
||||
});
|
||||
it("#11628 - supports stage-0 passing importAssertionsVersion to stage-1", () => {
|
||||
expect(() =>
|
||||
Babel.transform("const getMessage = () => 'Hello World'", {
|
||||
presets: [["stage-0", { decoratorsVersion: "legacy" }]],
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
it("#11897 - [...map.keys()] in Babel source should be transformed correctly", () => {
|
||||
expect(() =>
|
||||
Babel.transform("for (let el of []) { s => el }", {
|
||||
plugins: ["transform-block-scoping"],
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
it("#12815 - unicode property letter short alias should be transformed", () => {
|
||||
expect(() =>
|
||||
Babel.transform("/\\p{L}/u", {
|
||||
plugins: ["proposal-unicode-property-regex"],
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
it("#14425 - numeric separators should be parsed correctly", () => {
|
||||
expect(() => Babel.transform("1_1", {})).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user