/
preset-stage-2.ts
37 lines (35 loc) 路 1.05 KB
/
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
34
35
36
37
import presetStage3 from "./preset-stage-3";
import * as babelPlugins from "./generated/plugins";
export default (_: any, opts: any = {}) => {
const {
loose = false,
useBuiltIns = false,
decoratorsLegacy = false,
decoratorsVersion = "2018-09",
decoratorsBeforeExport,
pipelineProposal = "minimal",
pipelineTopicToken = "%",
recordAndTupleSyntax = "hash",
} = opts;
return {
presets: [[presetStage3, { loose, useBuiltIns }]],
plugins: [
[
babelPlugins.proposalDecorators,
{
version: decoratorsLegacy ? "legacy" : decoratorsVersion,
decoratorsBeforeExport,
},
],
babelPlugins.proposalDestructuringPrivate,
[
babelPlugins.proposalPipelineOperator,
{ proposal: pipelineProposal, topicToken: pipelineTopicToken },
],
babelPlugins.proposalFunctionSent,
babelPlugins.proposalThrowExpressions,
[babelPlugins.syntaxRecordAndTuple, { syntaxType: recordAndTupleSyntax }],
babelPlugins.syntaxModuleBlocks,
],
};
};