standalone: update preset-stage-* (#13476)
* Move classStaticBlock to stage-3 * Remove stage-4 proposals * Move PrivatePropertyInObject * Remove options from preset-stage-3 * Move RecordAndTuple to stage-2 * Move ModuleBlocks to stage-2 * Undo breaking change Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
parent
ddaf0d4296
commit
13af87cd3b
@ -9,20 +9,24 @@ export default (_: any, opts: any = {}) => {
|
||||
decoratorsBeforeExport,
|
||||
pipelineProposal = "minimal",
|
||||
pipelineTopicToken = "%",
|
||||
recordAndTupleSyntax: recordAndTupleSyntax = "hash",
|
||||
recordAndTupleSyntax,
|
||||
} = opts;
|
||||
|
||||
return {
|
||||
presets: [
|
||||
[
|
||||
presetStage2,
|
||||
{ loose, useBuiltIns, decoratorsLegacy, decoratorsBeforeExport },
|
||||
{
|
||||
loose,
|
||||
useBuiltIns,
|
||||
decoratorsLegacy,
|
||||
decoratorsBeforeExport,
|
||||
recordAndTupleSyntax,
|
||||
},
|
||||
],
|
||||
],
|
||||
plugins: [
|
||||
babelPlugins.syntaxDecimal,
|
||||
[babelPlugins.syntaxRecordAndTuple, { syntaxType: recordAndTupleSyntax }],
|
||||
babelPlugins.syntaxModuleBlocks,
|
||||
babelPlugins.proposalExportDefaultFrom,
|
||||
[
|
||||
babelPlugins.proposalPipelineOperator,
|
||||
|
||||
@ -7,19 +7,20 @@ export default (_: any, opts: any = {}) => {
|
||||
useBuiltIns = false,
|
||||
decoratorsLegacy = false,
|
||||
decoratorsBeforeExport,
|
||||
recordAndTupleSyntax = "hash",
|
||||
} = opts;
|
||||
|
||||
return {
|
||||
presets: [[presetStage3, { loose, useBuiltIns }]],
|
||||
plugins: [
|
||||
babelPlugins.proposalClassStaticBlock,
|
||||
[
|
||||
babelPlugins.proposalDecorators,
|
||||
{ legacy: decoratorsLegacy, decoratorsBeforeExport },
|
||||
],
|
||||
babelPlugins.proposalFunctionSent,
|
||||
babelPlugins.proposalPrivatePropertyInObject,
|
||||
babelPlugins.proposalThrowExpressions,
|
||||
[babelPlugins.syntaxRecordAndTuple, { syntaxType: recordAndTupleSyntax }],
|
||||
babelPlugins.syntaxModuleBlocks,
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
import * as babelPlugins from "./generated/plugins";
|
||||
|
||||
export default (_: any, opts: any) => {
|
||||
let loose = false;
|
||||
export default (_: any, { loose = false } = {}) => {
|
||||
const plugins = [
|
||||
babelPlugins.syntaxImportAssertions,
|
||||
babelPlugins.proposalClassStaticBlock,
|
||||
];
|
||||
|
||||
if (opts !== undefined) {
|
||||
if (opts.loose !== undefined) loose = opts.loose;
|
||||
}
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
babelPlugins.syntaxImportAssertions,
|
||||
if (!process.env.BABEL_8_BREAKING) {
|
||||
// These are Stage 4
|
||||
plugins.push(
|
||||
babelPlugins.syntaxImportMeta,
|
||||
babelPlugins.syntaxTopLevelAwait,
|
||||
babelPlugins.proposalExportNamespaceFrom,
|
||||
@ -20,6 +19,9 @@ export default (_: any, opts: any) => {
|
||||
babelPlugins.proposalJsonStrings,
|
||||
babelPlugins.proposalNumericSeparator,
|
||||
[babelPlugins.proposalPrivateMethods, { loose }],
|
||||
],
|
||||
};
|
||||
babelPlugins.proposalPrivatePropertyInObject,
|
||||
);
|
||||
}
|
||||
|
||||
return { plugins };
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user