Throw when using Stage presets (#8293)
* inline stage presets into standalone, throw error with using Stage presets
This commit is contained in:
parent
6f3a800677
commit
c70a32ab9d
@ -1,7 +1,10 @@
|
||||
{
|
||||
"compact": false,
|
||||
"presets": [
|
||||
"env",
|
||||
["stage-2", { "decoratorsLegacy": true }]
|
||||
"env"
|
||||
],
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"proposal-object-rest-spread"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
{
|
||||
"presets": [
|
||||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }],
|
||||
"env"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
{
|
||||
"plugins": ["external-helpers", ["proposal-class-properties", {"loose": true}]],
|
||||
"presets": [
|
||||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }],
|
||||
"env"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "proposal-class-properties"],
|
||||
"presets": [
|
||||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }],
|
||||
"env"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
{
|
||||
"presets": [
|
||||
"env",
|
||||
["stage-2", { "decoratorsLegacy": true }]
|
||||
"env"
|
||||
],
|
||||
"plugins": [
|
||||
"proposal-class-properties"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
{
|
||||
"presets": [
|
||||
"env",
|
||||
["stage-0", { "decoratorsLegacy": true, "pipelineProposal": "minimal" }]
|
||||
"env"
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,19 +1,64 @@
|
||||
# @babel/preset-stage-0
|
||||
|
||||
> Babel preset for stage 0 plugins
|
||||
> As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue [#7770](https://github.com/babel/babel/issues/7770), but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-0"
|
||||
|
||||
See our website [@babel/preset-stage-0](https://babeljs.io/docs/en/next/babel-preset-stage-0.html) for more information.
|
||||
---
|
||||
|
||||
## Install
|
||||
If you want the same configuration as before:
|
||||
|
||||
Using npm:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
// Stage 0
|
||||
"@babel/plugin-proposal-function-bind",
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/preset-stage-0
|
||||
// Stage 1
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-proposal-logical-assignment-operators",
|
||||
["@babel/plugin-proposal-optional-chaining", { "loose": false }],
|
||||
["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
|
||||
["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
|
||||
"@babel/plugin-proposal-do-expressions",
|
||||
|
||||
// Stage 2
|
||||
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
|
||||
// Stage 3
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
```sh
|
||||
yarn add @babel/preset-stage-0 --dev
|
||||
```js
|
||||
module.exports = function() {
|
||||
return {
|
||||
plugins: [
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
// ...
|
||||
],
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@ -6,16 +6,5 @@
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-0",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-function-bind": "7.0.0-beta.54",
|
||||
"@babel/preset-stage-1": "7.0.0-beta.54"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.54"
|
||||
}
|
||||
"main": "lib/index.js"
|
||||
}
|
||||
|
||||
@ -1,39 +1,60 @@
|
||||
import { declare } from "@babel/helper-plugin-utils";
|
||||
import presetStage1 from "@babel/preset-stage-1";
|
||||
export default function() {
|
||||
throw new Error(`
|
||||
As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue #7770: https://github.com/babel/babel/issues/7770, but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-0"
|
||||
|
||||
import transformFunctionBind from "@babel/plugin-proposal-function-bind";
|
||||
If you want the same configuration as before:
|
||||
|
||||
export default declare((api, opts = {}) => {
|
||||
api.assertVersion(7);
|
||||
{
|
||||
"plugins": [
|
||||
// Stage 0
|
||||
"@babel/plugin-proposal-function-bind",
|
||||
|
||||
const {
|
||||
loose = false,
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = true,
|
||||
pipelineProposal = "minimal",
|
||||
} = opts;
|
||||
// Stage 1
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-proposal-logical-assignment-operators",
|
||||
["@babel/plugin-proposal-optional-chaining", { "loose": false }],
|
||||
["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
|
||||
["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
|
||||
"@babel/plugin-proposal-do-expressions",
|
||||
|
||||
if (typeof loose !== "boolean") {
|
||||
throw new Error("@babel/preset-stage-0 'loose' option must be a boolean.");
|
||||
}
|
||||
if (typeof useBuiltIns !== "boolean") {
|
||||
throw new Error(
|
||||
"@babel/preset-stage-0 'useBuiltIns' option must be a boolean.",
|
||||
);
|
||||
}
|
||||
if (typeof decoratorsLegacy !== "boolean") {
|
||||
throw new Error(
|
||||
"@babel/preset-stage-0 'decoratorsLegacy' option must be a boolean.",
|
||||
);
|
||||
// Stage 2
|
||||
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
|
||||
// Stage 3
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
module.exports = function() {
|
||||
return {
|
||||
plugins: [
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
presetStage1,
|
||||
{ loose, useBuiltIns, decoratorsLegacy, pipelineProposal },
|
||||
// ...
|
||||
],
|
||||
],
|
||||
plugins: [transformFunctionBind],
|
||||
};
|
||||
});
|
||||
};
|
||||
`);
|
||||
}
|
||||
|
||||
@ -1,19 +1,61 @@
|
||||
# @babel/preset-stage-1
|
||||
|
||||
> Babel preset for stage 1 plugins
|
||||
> As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue [#7770](https://github.com/babel/babel/issues/7770), but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-1"
|
||||
|
||||
See our website [@babel/preset-stage-1](https://babeljs.io/docs/en/next/babel-preset-stage-1.html) for more information.
|
||||
---
|
||||
|
||||
## Install
|
||||
If you want the same configuration as before:
|
||||
|
||||
Using npm:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
// Stage 1
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-proposal-logical-assignment-operators",
|
||||
["@babel/plugin-proposal-optional-chaining", { "loose": false }],
|
||||
["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
|
||||
["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
|
||||
"@babel/plugin-proposal-do-expressions",
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/preset-stage-1
|
||||
// Stage 2
|
||||
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
|
||||
// Stage 3
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
```sh
|
||||
yarn add @babel/preset-stage-1 --dev
|
||||
```js
|
||||
module.exports = function() {
|
||||
return {
|
||||
plugins: [
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
// ...
|
||||
],
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@ -6,21 +6,5 @@
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-1",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-do-expressions": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-export-default-from": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-logical-assignment-operators": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-pipeline-operator": "7.0.0-beta.54",
|
||||
"@babel/preset-stage-2": "7.0.0-beta.54"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.54"
|
||||
}
|
||||
"main": "lib/index.js"
|
||||
}
|
||||
|
||||
@ -1,46 +1,57 @@
|
||||
import { declare } from "@babel/helper-plugin-utils";
|
||||
import presetStage2 from "@babel/preset-stage-2";
|
||||
export default function() {
|
||||
throw new Error(`
|
||||
As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue #7770: https://github.com/babel/babel/issues/7770, but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-1"
|
||||
|
||||
import transformExportDefaultFrom from "@babel/plugin-proposal-export-default-from";
|
||||
import transformLogicalAssignmentOperators from "@babel/plugin-proposal-logical-assignment-operators";
|
||||
import transformOptionalChaining from "@babel/plugin-proposal-optional-chaining";
|
||||
import transformPipelineOperator from "@babel/plugin-proposal-pipeline-operator";
|
||||
import transformNullishCoalescingOperator from "@babel/plugin-proposal-nullish-coalescing-operator";
|
||||
import transformDoExpressions from "@babel/plugin-proposal-do-expressions";
|
||||
If you want the same configuration as before:
|
||||
|
||||
export default declare((api, opts = {}) => {
|
||||
api.assertVersion(7);
|
||||
{
|
||||
"plugins": [
|
||||
// Stage 1
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-proposal-logical-assignment-operators",
|
||||
["@babel/plugin-proposal-optional-chaining", { "loose": false }],
|
||||
["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
|
||||
["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
|
||||
"@babel/plugin-proposal-do-expressions",
|
||||
|
||||
const {
|
||||
loose = false,
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = true,
|
||||
pipelineProposal = "minimal",
|
||||
} = opts;
|
||||
// Stage 2
|
||||
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
|
||||
if (typeof loose !== "boolean") {
|
||||
throw new Error("@babel/preset-stage-1 'loose' option must be a boolean.");
|
||||
}
|
||||
if (typeof useBuiltIns !== "boolean") {
|
||||
throw new Error(
|
||||
"@babel/preset-stage-1 'useBuiltIns' option must be a boolean.",
|
||||
);
|
||||
}
|
||||
if (typeof decoratorsLegacy !== "boolean") {
|
||||
throw new Error(
|
||||
"@babel/preset-stage-1 'decoratorsLegacy' option must be a boolean.",
|
||||
);
|
||||
// Stage 3
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
module.exports = function() {
|
||||
return {
|
||||
presets: [[presetStage2, { loose, useBuiltIns, decoratorsLegacy }]],
|
||||
plugins: [
|
||||
transformExportDefaultFrom,
|
||||
transformLogicalAssignmentOperators,
|
||||
[transformOptionalChaining, { loose }],
|
||||
[transformPipelineOperator, { proposal: pipelineProposal }],
|
||||
[transformNullishCoalescingOperator, { loose }],
|
||||
transformDoExpressions,
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
// ...
|
||||
],
|
||||
};
|
||||
});
|
||||
};
|
||||
`);
|
||||
}
|
||||
|
||||
@ -1,19 +1,53 @@
|
||||
# @babel/preset-stage-2
|
||||
|
||||
> Babel preset for stage 2 plugins
|
||||
> As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue [#7770](https://github.com/babel/babel/issues/7770), but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-2"
|
||||
|
||||
See our website [@babel/preset-stage-2](https://babeljs.io/docs/en/next/babel-preset-stage-2.html) for more information.
|
||||
---
|
||||
|
||||
## Install
|
||||
If you want the same configuration as before:
|
||||
|
||||
Using npm:
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
// Stage 2
|
||||
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/preset-stage-2
|
||||
// Stage 3
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
```sh
|
||||
yarn add @babel/preset-stage-2 --dev
|
||||
```js
|
||||
module.exports = function() {
|
||||
return {
|
||||
plugins: [
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
// ...
|
||||
],
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@ -6,20 +6,5 @@
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-2",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-decorators": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-export-namespace-from": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-function-sent": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-numeric-separator": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-throw-expressions": "7.0.0-beta.54",
|
||||
"@babel/preset-stage-3": "7.0.0-beta.54"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.54"
|
||||
}
|
||||
"main": "lib/index.js"
|
||||
}
|
||||
|
||||
@ -1,39 +1,49 @@
|
||||
import { declare } from "@babel/helper-plugin-utils";
|
||||
import presetStage3 from "@babel/preset-stage-3";
|
||||
export default function() {
|
||||
throw new Error(`
|
||||
As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue #7770: https://github.com/babel/babel/issues/7770, but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-2"
|
||||
|
||||
import transformDecorators from "@babel/plugin-proposal-decorators";
|
||||
import transformFunctionSent from "@babel/plugin-proposal-function-sent";
|
||||
import transformExportNamespaceFrom from "@babel/plugin-proposal-export-namespace-from";
|
||||
import transformNumericSeparator from "@babel/plugin-proposal-numeric-separator";
|
||||
import transformThrowExpressions from "@babel/plugin-proposal-throw-expressions";
|
||||
If you want the same configuration as before:
|
||||
|
||||
export default declare((api, opts = {}) => {
|
||||
api.assertVersion(7);
|
||||
{
|
||||
"plugins": [
|
||||
// Stage 2
|
||||
["@babel/plugin-proposal-decorators", { "legacy": true }],
|
||||
"@babel/plugin-proposal-function-sent",
|
||||
"@babel/plugin-proposal-export-namespace-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-throw-expressions",
|
||||
|
||||
const { loose = false, useBuiltIns = false, decoratorsLegacy = true } = opts;
|
||||
|
||||
if (typeof loose !== "boolean") {
|
||||
throw new Error("@babel/preset-stage-2 'loose' option must be a boolean.");
|
||||
}
|
||||
if (typeof useBuiltIns !== "boolean") {
|
||||
throw new Error(
|
||||
"@babel/preset-stage-2 'useBuiltIns' option must be a boolean.",
|
||||
);
|
||||
}
|
||||
if (typeof decoratorsLegacy !== "boolean") {
|
||||
throw new Error(
|
||||
"@babel/preset-stage-2 'decoratorsLegacy' option must be a boolean.",
|
||||
);
|
||||
// Stage 3
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
module.exports = function() {
|
||||
return {
|
||||
presets: [[presetStage3, { loose, useBuiltIns }]],
|
||||
plugins: [
|
||||
[transformDecorators, { legacy: decoratorsLegacy }],
|
||||
transformFunctionSent,
|
||||
transformExportNamespaceFrom,
|
||||
transformNumericSeparator,
|
||||
transformThrowExpressions,
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
// ...
|
||||
],
|
||||
};
|
||||
});
|
||||
};
|
||||
`);
|
||||
}
|
||||
|
||||
@ -1,19 +1,45 @@
|
||||
# @babel/preset-stage-3
|
||||
|
||||
> Babel preset for stage 3 plugins
|
||||
> As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue [#7770](https://github.com/babel/babel/issues/7770), but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-3"
|
||||
|
||||
See our website [@babel/preset-stage-3](https://babeljs.io/docs/en/next/babel-preset-stage-3.html) for more information.
|
||||
---
|
||||
|
||||
## Install
|
||||
If you want the same configuration as before:
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/preset-stage-3
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
```sh
|
||||
yarn add @babel/preset-stage-3 --dev
|
||||
```js
|
||||
module.exports = function() {
|
||||
return {
|
||||
plugins: [
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
// ...
|
||||
],
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
@ -6,22 +6,5 @@
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-3",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-plugin-utils": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-async-generator-functions": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-class-properties": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-json-strings": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-optional-catch-binding": "7.0.0-beta.54",
|
||||
"@babel/plugin-proposal-unicode-property-regex": "7.0.0-beta.54",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.0.0-beta.54",
|
||||
"@babel/plugin-syntax-import-meta": "7.0.0-beta.54"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.54"
|
||||
}
|
||||
"main": "lib/index.js"
|
||||
}
|
||||
|
||||
@ -1,43 +1,42 @@
|
||||
import { declare } from "@babel/helper-plugin-utils";
|
||||
import syntaxDynamicImport from "@babel/plugin-syntax-dynamic-import";
|
||||
import syntaxImportMeta from "@babel/plugin-syntax-import-meta";
|
||||
import transformAsyncGeneratorFunctions from "@babel/plugin-proposal-async-generator-functions";
|
||||
import transformClassProperties from "@babel/plugin-proposal-class-properties";
|
||||
import transformJsonStrings from "@babel/plugin-proposal-json-strings";
|
||||
import transformObjectRestSpread from "@babel/plugin-proposal-object-rest-spread";
|
||||
import transformOptionalCatchBinding from "@babel/plugin-proposal-optional-catch-binding";
|
||||
import transformUnicodePropertyRegex from "@babel/plugin-proposal-unicode-property-regex";
|
||||
export default function() {
|
||||
throw new Error(`
|
||||
As of v7.0.0-beta.54, we've decided to remove
|
||||
the official Babel Stage presets. You can find more information
|
||||
at issue #7770: https://github.com/babel/babel/issues/7770, but
|
||||
the TL;DR is that it's causing more harm than convenience in that
|
||||
the preset is always out of date, each change is usually going to
|
||||
require a major version bump and thus people will be behind,
|
||||
and it encouraged too many people to opt-in to too many proposals
|
||||
that they didn't intend to. This is intended to be the last publish
|
||||
of "@babel/preset-stage-3"
|
||||
|
||||
export default declare((api, opts) => {
|
||||
api.assertVersion(7);
|
||||
If you want the same configuration as before:
|
||||
|
||||
let loose = false;
|
||||
let useBuiltIns = false;
|
||||
|
||||
if (opts !== undefined) {
|
||||
if (opts.loose !== undefined) loose = opts.loose;
|
||||
if (opts.useBuiltIns !== undefined) useBuiltIns = opts.useBuiltIns;
|
||||
{
|
||||
"plugins": [
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": false }],
|
||||
"@babel/plugin-proposal-json-strings"
|
||||
]
|
||||
}
|
||||
|
||||
if (typeof loose !== "boolean") {
|
||||
throw new Error("@babel/preset-stage-3 'loose' option must be a boolean.");
|
||||
}
|
||||
if (typeof useBuiltIns !== "boolean") {
|
||||
throw new Error(
|
||||
"@babel/preset-stage-3 'useBuiltIns' option must be a boolean.",
|
||||
);
|
||||
}
|
||||
|
||||
If you're using the same configuration across many separate projects,
|
||||
keep in mind that you can also create your own custom presets with
|
||||
whichever plugins and presets you're looking to use.
|
||||
|
||||
module.exports = function() {
|
||||
return {
|
||||
plugins: [
|
||||
syntaxDynamicImport,
|
||||
syntaxImportMeta,
|
||||
transformAsyncGeneratorFunctions,
|
||||
[transformClassProperties, { loose }],
|
||||
transformJsonStrings,
|
||||
[transformObjectRestSpread, { loose, useBuiltIns }],
|
||||
transformOptionalCatchBinding,
|
||||
transformUnicodePropertyRegex,
|
||||
require("@babel/plugin-syntax-dynamic-import"),
|
||||
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
||||
[require("@babel/plugin-proposal-class-properties"), { "loose": false }],
|
||||
],
|
||||
presets: [
|
||||
// ...
|
||||
],
|
||||
};
|
||||
});
|
||||
};
|
||||
`);
|
||||
}
|
||||
|
||||
@ -233,10 +233,10 @@ registerPresets({
|
||||
};
|
||||
},
|
||||
react: require("@babel/preset-react"),
|
||||
"stage-0": require("@babel/preset-stage-0"),
|
||||
"stage-1": require("@babel/preset-stage-1"),
|
||||
"stage-2": require("@babel/preset-stage-2"),
|
||||
"stage-3": require("@babel/preset-stage-3"),
|
||||
"stage-0": require("./preset-stage-0"),
|
||||
"stage-1": require("./preset-stage-1"),
|
||||
"stage-2": require("./preset-stage-2"),
|
||||
"stage-3": require("./preset-stage-3"),
|
||||
"es2015-loose": {
|
||||
presets: [[require("./preset-es2015"), { loose: true }]],
|
||||
},
|
||||
|
||||
@ -24,7 +24,6 @@ import transformES2015Instanceof from "@babel/plugin-transform-instanceof";
|
||||
import transformRegenerator from "@babel/plugin-transform-regenerator";
|
||||
|
||||
export default (_, opts) => {
|
||||
const moduleTypes = ["commonjs", "cjs", "amd", "umd", "systemjs"];
|
||||
let loose = false;
|
||||
let modules = "commonjs";
|
||||
let spec = false;
|
||||
@ -35,19 +34,6 @@ export default (_, opts) => {
|
||||
if (opts.spec !== undefined) spec = opts.spec;
|
||||
}
|
||||
|
||||
if (typeof loose !== "boolean") {
|
||||
throw new Error("Preset es2015 'loose' option must be a boolean.");
|
||||
}
|
||||
if (typeof spec !== "boolean") {
|
||||
throw new Error("Preset es2015 'spec' option must be a boolean.");
|
||||
}
|
||||
if (modules !== false && moduleTypes.indexOf(modules) === -1) {
|
||||
throw new Error(
|
||||
"Preset es2015 'modules' option must be 'false' to indicate no modules\n" +
|
||||
"or a module type which be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'",
|
||||
);
|
||||
}
|
||||
|
||||
// be DRY
|
||||
const optsLoose = { loose };
|
||||
|
||||
|
||||
22
packages/babel-standalone/src/preset-stage-0.js
Normal file
22
packages/babel-standalone/src/preset-stage-0.js
Normal file
@ -0,0 +1,22 @@
|
||||
import presetStage1 from "./preset-stage-1";
|
||||
|
||||
import transformFunctionBind from "@babel/plugin-proposal-function-bind";
|
||||
|
||||
export default (_, opts = {}) => {
|
||||
const {
|
||||
loose = false,
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = false,
|
||||
pipelineProposal = "minimal",
|
||||
} = opts;
|
||||
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
presetStage1,
|
||||
{ loose, useBuiltIns, decoratorsLegacy, pipelineProposal },
|
||||
],
|
||||
],
|
||||
plugins: [transformFunctionBind],
|
||||
};
|
||||
};
|
||||
29
packages/babel-standalone/src/preset-stage-1.js
Normal file
29
packages/babel-standalone/src/preset-stage-1.js
Normal file
@ -0,0 +1,29 @@
|
||||
import presetStage2 from "./preset-stage-2";
|
||||
|
||||
import transformExportDefaultFrom from "@babel/plugin-proposal-export-default-from";
|
||||
import transformLogicalAssignmentOperators from "@babel/plugin-proposal-logical-assignment-operators";
|
||||
import transformOptionalChaining from "@babel/plugin-proposal-optional-chaining";
|
||||
import transformPipelineOperator from "@babel/plugin-proposal-pipeline-operator";
|
||||
import transformNullishCoalescingOperator from "@babel/plugin-proposal-nullish-coalescing-operator";
|
||||
import transformDoExpressions from "@babel/plugin-proposal-do-expressions";
|
||||
|
||||
export default (_, opts = {}) => {
|
||||
const {
|
||||
loose = false,
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = false,
|
||||
pipelineProposal = "minimal",
|
||||
} = opts;
|
||||
|
||||
return {
|
||||
presets: [[presetStage2, { loose, useBuiltIns, decoratorsLegacy }]],
|
||||
plugins: [
|
||||
transformExportDefaultFrom,
|
||||
transformLogicalAssignmentOperators,
|
||||
[transformOptionalChaining, { loose }],
|
||||
[transformPipelineOperator, { proposal: pipelineProposal }],
|
||||
[transformNullishCoalescingOperator, { loose }],
|
||||
transformDoExpressions,
|
||||
],
|
||||
};
|
||||
};
|
||||
22
packages/babel-standalone/src/preset-stage-2.js
Normal file
22
packages/babel-standalone/src/preset-stage-2.js
Normal file
@ -0,0 +1,22 @@
|
||||
import presetStage3 from "./preset-stage-3";
|
||||
|
||||
import transformDecorators from "@babel/plugin-proposal-decorators";
|
||||
import transformFunctionSent from "@babel/plugin-proposal-function-sent";
|
||||
import transformExportNamespaceFrom from "@babel/plugin-proposal-export-namespace-from";
|
||||
import transformNumericSeparator from "@babel/plugin-proposal-numeric-separator";
|
||||
import transformThrowExpressions from "@babel/plugin-proposal-throw-expressions";
|
||||
|
||||
export default (_, opts = {}) => {
|
||||
const { loose = false, useBuiltIns = false, decoratorsLegacy = false } = opts;
|
||||
|
||||
return {
|
||||
presets: [[presetStage3, { loose, useBuiltIns }]],
|
||||
plugins: [
|
||||
[transformDecorators, { legacy: decoratorsLegacy }],
|
||||
transformFunctionSent,
|
||||
transformExportNamespaceFrom,
|
||||
transformNumericSeparator,
|
||||
transformThrowExpressions,
|
||||
],
|
||||
};
|
||||
};
|
||||
21
packages/babel-standalone/src/preset-stage-3.js
Normal file
21
packages/babel-standalone/src/preset-stage-3.js
Normal file
@ -0,0 +1,21 @@
|
||||
import syntaxDynamicImport from "@babel/plugin-syntax-dynamic-import";
|
||||
import syntaxImportMeta from "@babel/plugin-syntax-import-meta";
|
||||
import transformClassProperties from "@babel/plugin-proposal-class-properties";
|
||||
import transformJsonStrings from "@babel/plugin-proposal-json-strings";
|
||||
|
||||
export default (_, opts) => {
|
||||
let loose = false;
|
||||
|
||||
if (opts !== undefined) {
|
||||
if (opts.loose !== undefined) loose = opts.loose;
|
||||
}
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
syntaxDynamicImport,
|
||||
syntaxImportMeta,
|
||||
[transformClassProperties, { loose }],
|
||||
transformJsonStrings,
|
||||
],
|
||||
};
|
||||
};
|
||||
@ -66,6 +66,7 @@ yarn add ${name} --dev
|
||||
|
||||
packages
|
||||
.filter(x => x !== "README.md") // ignore root readme
|
||||
.filter(x => x.indexOf("babel-preset-stage-") === -1) // ignore stages
|
||||
.forEach(id => {
|
||||
const { name, description } = getPackageJson(id);
|
||||
const readmePath = join(packageDir, id, "README.md");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user