UNPKG

babel-preset-7-esnext

Version:

ES.Next transpile preset for babel7 by Harald Rudell

62 lines (56 loc) 2.96 kB
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var env = _interopDefault(require('@babel/preset-env')); var functionBind = _interopDefault(require('@babel/plugin-proposal-function-bind')); var exportDefaultFrom = _interopDefault(require('@babel/plugin-proposal-export-default-from')); var logicalAssignmentOperators = _interopDefault(require('@babel/plugin-proposal-logical-assignment-operators')); var optionalChaining = _interopDefault(require('@babel/plugin-proposal-optional-chaining')); var pipelineOperator = _interopDefault(require('@babel/plugin-proposal-pipeline-operator')); var nullishCoalescingOperator = _interopDefault(require('@babel/plugin-proposal-nullish-coalescing-operator')); var doExpressions = _interopDefault(require('@babel/plugin-proposal-do-expressions')); var decorators = _interopDefault(require('@babel/plugin-proposal-decorators')); var functionSent = _interopDefault(require('@babel/plugin-proposal-function-sent')); var exportNamespaceFrom = _interopDefault(require('@babel/plugin-proposal-export-namespace-from')); var numericSeparator = _interopDefault(require('@babel/plugin-proposal-numeric-separator')); var throwExpressions = _interopDefault(require('@babel/plugin-proposal-throw-expressions')); var dynamicImport = _interopDefault(require('@babel/plugin-syntax-dynamic-import')); var importMeta = _interopDefault(require('@babel/plugin-syntax-import-meta')); var classProperties = _interopDefault(require('@babel/plugin-proposal-class-properties')); var jsonStrings = _interopDefault(require('@babel/plugin-proposal-json-strings')); /* © 2017-present Harald Rudell <harald.rudell@gmail.com> (http://www.haraldrudell.com) This source code is licensed under the ISC-style license found in the LICENSE file in the root directory of this source tree. */ var presetEsNext = ((api, options, dirname) => { !options && (options = {}); const envOptions = options.env || { targets: { node: true } }; const decoratorsOptions = options.decorators || { decoratorsBeforeExport: false }; return { presets: [[env, envOptions]], plugins: [// @babel/stage-0 181212 functionBind, // Stage 0 exportDefaultFrom, // Stage 1 logicalAssignmentOperators, [optionalChaining, { loose: false }], [pipelineOperator, { proposal: 'minimal' }], [nullishCoalescingOperator, { loose: false }], doExpressions, [decorators, decoratorsOptions], // Stage 2 functionSent, exportNamespaceFrom, numericSeparator, throwExpressions, dynamicImport, // Stage 3 importMeta, [classProperties, { loose: false }], jsonStrings] }; }); /* © 2017-present Harald Rudell <harald.rudell@gmail.com> (http://www.haraldrudell.com) This source code is licensed under the ISC-style license found in the LICENSE file in the root directory of this source tree. */ module.exports = presetEsNext;