-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
preset-stage-1.ts
36 lines (33 loc) 路 1.02 KB
/
preset-stage-1.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
import presetStage2 from "./preset-stage-2";
import * as babelPlugins from "./generated/plugins";
export default (_: any, opts: any = {}) => {
const {
loose = false,
useBuiltIns = false,
decoratorsLegacy = false,
pipelineProposal = "minimal",
recordAndTupleSyntax: recordAndTupleSyntax = "hash",
} = opts;
if (!process.env.BABEL_8_BREAKING) {
// eslint-disable-next-line no-var
var { decoratorsBeforeExport } = opts;
}
return {
presets: [
[
presetStage2,
process.env.BABEL_8_BREAKING
? { loose, useBuiltIns, decoratorsLegacy }
: { loose, useBuiltIns, decoratorsLegacy, decoratorsBeforeExport },
],
],
plugins: [
babelPlugins.syntaxDecimal,
[babelPlugins.syntaxRecordAndTuple, { syntaxType: recordAndTupleSyntax }],
babelPlugins.syntaxModuleBlocks,
babelPlugins.proposalExportDefaultFrom,
[babelPlugins.proposalPipelineOperator, { proposal: pipelineProposal }],
babelPlugins.proposalDoExpressions,
],
};
};