Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
canvas
/
node_modules
/
@instructure
/
ui-media-player
/
babel-preset
/
Filename :
index.js
back
Copy
/* * The MIT License (MIT) * * Copyright (c) 2015 - present Instructure, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ module.exports = function ( context, opts = { esModules: false, coverage: false, node: false, removeConsole: false, } ) { const envPresetConfig = opts.node ? getNodeEnvConfig() : getWebEnvConfig(opts) const presets = [ [require('@babel/preset-env').default, envPresetConfig], [require('@babel/preset-react').default, { useBuiltIns: true }], ] let plugins = [] // Work around https://github.com/babel/babel/issues/10261, which causes // Babel to not use the runtime helpers for things like _objectSpread. // Remove this once that babel issue is fixed let babelHelperVersion = {} try { // eslint-disable-next-line import/no-extraneous-dependencies const version = require('@babel/helpers/package.json').version babelHelperVersion.version = version } catch (e) { // if something goes wrong, continue and don't try to explicitly set a helper version } plugins = plugins.concat([ require('babel-plugin-macros'), require('@babel/plugin-transform-destructuring').default, [require('@babel/plugin-proposal-decorators').default, { legacy: true }], [ require('@babel/plugin-proposal-class-properties').default, { loose: true }, ], require('@babel/plugin-proposal-export-default-from').default, [ require('@babel/plugin-proposal-object-rest-spread').default, { useBuiltIns: true }, ], require('@babel/plugin-proposal-optional-chaining').default, [ require('@babel/plugin-transform-runtime').default, { ...babelHelperVersion, corejs: false, regenerator: true, helpers: true, useESModules: opts.esModules, }, ], require('@babel/plugin-syntax-dynamic-import').default, require('babel-plugin-transform-undefined-to-void'), require('@babel/plugin-proposal-nullish-coalescing-operator'), ]) if (process.env.NODE_ENV === 'production') { plugins.push( require('@babel/plugin-transform-react-constant-elements').default ) } if (opts.removeConsole) { if (typeof opts.removeConsole === 'object') { plugins.push([ require('babel-plugin-transform-remove-console'), opts.removeConsole, ]) } else { plugins.push(require('babel-plugin-transform-remove-console')) } } if (opts.node) { plugins = plugins.concat([ require('babel-plugin-transform-ensure-ignore').default, require('babel-plugin-dynamic-import-node'), ]) } if (opts.coverage) { plugins = [ [ require('babel-plugin-istanbul').default, { include: ['**/src/**/*.js'], exclude: [ '**/*.test.js', '**/*.examples.js', '**/*.fixture.js', '**/*.config.js', '**/*.conf.js', '__tests__/**/*.js', '__testfixtures__/**/*.js', '__examples__/**/*.js', '__fixtures__/**/*.js', ], }, ], ].concat(plugins) } return { presets, plugins, } } function getNodeEnvConfig() { return { targets: { node: 'current', }, modules: 'commonjs', include: ['transform-classes'], } } function getWebEnvConfig(opts) { return { useBuiltIns: 'entry', corejs: 3, modules: opts.esModules ? false : 'commonjs', // debug: true, // un-comment if you want to see what browsers are being targeted and what plugins that means it will activate exclude: ['transform-typeof-symbol'], } }