| 1 | import presetStage3 from "./preset-stage-3"; |
| 2 | import * as babelPlugins from "./generated/plugins"; |
| 3 | |
| 4 | export default (_: any, opts: any = {}) => { |
| 5 | const { |
| 6 | loose = false, |
| 7 | useBuiltIns = false, |
| 8 | decoratorsLegacy = false, |
| 9 | decoratorsVersion = "2018-09", |
| 10 | decoratorsBeforeExport, |
| 11 | pipelineProposal = "minimal", |
| 12 | pipelineTopicToken = "%", |
| 13 | recordAndTupleSyntax = "hash", |
| 14 | } = opts; |
| 15 | |
| 16 | return { |
| 17 | presets: [[presetStage3, { loose, useBuiltIns }]], |
| 18 | plugins: [ |
| 19 | [ |
| 20 | babelPlugins.proposalDecorators, |
| 21 | { |
| 22 | version: decoratorsLegacy ? "legacy" : decoratorsVersion, |
| 23 | decoratorsBeforeExport, |
| 24 | }, |
| 25 | ], |
| 26 | babelPlugins.proposalDestructuringPrivate, |
| 27 | [ |
| 28 | babelPlugins.proposalPipelineOperator, |
| 29 | { proposal: pipelineProposal, topicToken: pipelineTopicToken }, |
| 30 | ], |
| 31 | babelPlugins.proposalFunctionSent, |
| 32 | babelPlugins.proposalThrowExpressions, |
| 33 | [ |
| 34 | babelPlugins.proposalRecordAndTuple, |
| 35 | { syntaxType: recordAndTupleSyntax }, |
| 36 | ], |
| 37 | babelPlugins.syntaxExplicitResourceManagement, |
| 38 | babelPlugins.syntaxModuleBlocks, |
| 39 | babelPlugins.syntaxImportReflection, |
| 40 | ], |
| 41 | }; |
| 42 | }; |