/
preset-stage-2.ts
33 lines (31 loc) 路 973 Bytes
/
preset-stage-2.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import presetStage3 from "./preset-stage-3";
import * as babelPlugins from "./generated/plugins";
export default (_: any, opts: any = {}) => {
const {
loose = false,
useBuiltIns = false,
decoratorsLegacy = false,
decoratorsBeforeExport,
pipelineProposal = "minimal",
pipelineTopicToken = "%",
recordAndTupleSyntax = "hash",
} = opts;
return {
presets: [[presetStage3, { loose, useBuiltIns }]],
plugins: [
[
babelPlugins.proposalDecorators,
{ legacy: decoratorsLegacy, decoratorsBeforeExport },
],
babelPlugins.syntaxDestructuringPrivate,
[
babelPlugins.proposalPipelineOperator,
{ proposal: pipelineProposal, topicToken: pipelineTopicToken },
],
babelPlugins.proposalFunctionSent,
babelPlugins.proposalThrowExpressions,
[babelPlugins.syntaxRecordAndTuple, { syntaxType: recordAndTupleSyntax }],
babelPlugins.syntaxModuleBlocks,
],
};
};