GoScrobble/web/node_modules/rollup-plugin-babel/dist/rollup-plugin-babel.cjs.js.map

1 line
13 KiB
Plaintext
Raw Normal View History

2022-04-25 02:47:15 +00:00
{"version":3,"file":"rollup-plugin-babel.cjs.js","sources":["../src/constants.js","../src/utils.js","../src/preflightCheck.js","../src/helperPlugin.js","../src/index.js"],"sourcesContent":["export const INLINE = {};\nexport const RUNTIME = {};\nexport const EXTERNAL = {};\n\n// NOTE: DO NOT REMOVE the null character `\\0` as it may be used by other plugins\n// e.g. https://github.com/rollup/rollup-plugin-node-resolve/blob/313a3e32f432f9eb18cc4c231cc7aac6df317a51/src/index.js#L74\nexport const HELPERS = '\\0rollupPluginBabelHelpers.js';\n","export const addBabelPlugin = (options, plugin) => ({ ...options, plugins: options.plugins.concat(plugin) });\n\nlet warned = {};\nexport function warnOnce(ctx, msg) {\n\tif (warned[msg]) return;\n\twarned[msg] = true;\n\tctx.warn(msg);\n}\n\nconst regExpCharactersRegExp = /[\\\\^$.*+?()[\\]{}|]/g;\nexport const escapeRegExpCharacters = str => str.replace(regExpCharactersRegExp, '\\\\$&');\n","import { transformSync } from '@babel/core';\nimport { INLINE, RUNTIME, EXTERNAL } from './constants.js';\nimport { addBabelPlugin } from './utils.js';\n\nconst MODULE_ERROR =\n\t'Rollup requires that your Babel configuration keeps ES6 module syntax intact. ' +\n\t'Unfortunately it looks like your configuration specifies a module transformer ' +\n\t'to replace ES6 modules with another module format. To continue you have to disable it.' +\n\t'\\n\\n' +\n\t\"Most commonly it's a CommonJS transform added by @babel/preset-env - \" +\n\t'in such case you should disable it by adding `modules: false` option to that preset ' +\n\t'(described in more detail here - https://github.com/rollup/rollup-plugin-babel#modules ).';\n\nconst UNEXPECTED_ERROR =\n\t'An unexpected situation arose. Please raise an issue at ' +\n\t'https://github.com/rollup/rollup-plugin-babel/issues. Thanks!';\n\nfunction fallbackClassTransform() {\n\treturn {\n\t\tvisitor: {\n\t\t\tClassDeclaration(path, state) {\n\t\t\t\tpath.replaceWith(state.file.addHelper('inherits'));\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport default function createPreflightCheck() {\n\tlet preflightCheckResults = {};\n\n\treturn (ctx, options) => {\n\t\tconst key = options.filename;\n\n\t\tif (preflightCheckResults[key] === undefined) {\n\t\t\tlet helpers;\n\n\t\t\tconst inputCode = 'class Foo extends Bar {};\\nexport default Foo;';\n\t\t\tconst transformed = transformSync(inputCode, options);\n\n\t\t\tlet check = transformed.code;\n\n\t\t\tif (~check.indexOf('class ')) {\n\t\t\t\tcheck = transformSync(inputCode, addBabelPlugin(options, fallbackClassTransform)).code;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!~check.indexOf('export default') &&\n\t\t\t\t!~check.indexOf('export default Foo') &&\n\t\t\t\t!~check.indexOf('export { Foo as default }')\n\t\t\t) {\n\t\t\t\tctx.error(MODULE_ERROR);\n\t\t\t}\n\n\t\t\tif (check.match(/\\/helpers\\/(esm\\/)?inherits/)) helpers = RUNTIME;\n\t\t\telse if (~check.indexOf('function _inherits')) helpers = INLINE;\n\t\t\telse if (~check.indexOf('babelHelpers')) helpers = EXTERNAL;\n\t\t\telse {\n\t\t\t\tctx.error(UNEXPECTED_ERROR);\n\t\t\t}\n\n\t\t\tpreflightCheckResults[key] = helpers;\n\t\t}\n\n\t\treturn preflightCheckResults[key];\n\t};\n}\n","import { HELPERS } from './constants.js';\nimport { addNamed } from '@babel/helper-module-imports';\n\nexport default function importHelperPlugin() {\n\treturn {\n\t\tpre(file) {\n\t\t\tconst cachedHelpers = {};\n\t\t\tfile.set('helperGenerator', name => {\n\t\t\t\tif (!file.availableHelper(name)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (cachedHelpers[name]) {\n\t\t\t\t\treturn cachedHelpers[name];\n\t\t\t\t}\n\n\t\t\t\treturn (cachedHelpers[name] = addNamed(file.path, name, HELPERS));\n\t\t\t});\n\t\t},\n\t};\n}\n","import * as babel from '@babel/core';\nimport { createFilter } from 'rollup-pluginutils';\nimport createPreflightCheck from './preflightCheck.js';\nimport helperPlugin from './helperPlugin.js';\nimport { addBabelPlugin, escapeRegExpCharacters, warnOnce } from './utils.js';\nimport { RUNTIME, EXTERNAL, HELPERS } from './constants.js';\n\nconst unpackOptions = ({\n\textensions = babe