0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

151
web/node_modules/rollup-plugin-babel/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,151 @@
## 4.3.2
- Fixed usage with `externalHelpers: true` option
## 4.3.1
- Add `.js` extension to the virtual babel helpers file (only matters when using `preserveModules` option in rollup)
## 4.3.0
- Added `.custom` builder.
- Fail build when a plugin tries to add non existent babel helper
## 4.2.0
Allow `rollup@1` as peer dependency.
## 4.1.0
- Fixed "preflight check" for ignored files.
- Return `null` when no transformation has been done (fixing source maps for this case)
## 4.0.3
Fixed fallback class transform in "preflight check".
## 4.0.2
Fixed `rollup` peer dependency.
## 4.0.0
Babel 7 compatible! (dropped Babel 6 compatibility though).
Additionally:
- Internal preflight checks are created now per plugin instance, so using 2 instances of rollup-plugin-babel (i.e. targeting 2 different set of files with include/exclude options) shouldn't conflict with each other
- Transpiling by default only what Babel transpiles - files with those extensions: .js, .jsx, .es6, .es, .mjs. You can customize this with new `extensions` option. This also fixes long standing issue with rollup-plugin-babel trying to transform JSON files.
## 3.0.3
- Drop babel7 support. Use 4.0.0-beta if you use babel 7
- Use "module" in addition to "jsnext:main" ([#150](https://github.com/rollup/rollup-plugin-babel/issues/150))
- Remove unused babel helpers namespace declaration & expression ([#164](https://github.com/rollup/rollup-plugin-babel/issues/164))
## 3.0.2
- Fix regression with Babel 6 ([#158](https://github.com/rollup/rollup-plugin-babel/issues/158))
## 3.0.1
- Wasn't working, fix bug with transform (not using es2015-classes for preflight check)
## 3.0.0
- Drop Node 0.10/0.12 (Use native `Object.assign`)
- Change `babel-core` to be a peerDependency
- Support `babel-core` v7 as well as a peerDep (no changes necessary)
## 2.7.1
- Prevent erroneous warnings about duplicated runtime helpers ([#105](https://github.com/rollup/rollup-plugin-babel/issues/105))
- Ignore `ignore` option in preflight check ([#102](https://github.com/rollup/rollup-plugin-babel/issues/102))
- Allow custom `moduleName` with `runtime-helpers` ([#95](https://github.com/rollup/rollup-plugin-babel/issues/95))
## 2.7.0
- Add `externalHelpersWhitelist` option ([#92](https://github.com/rollup/rollup-plugin-babel/pull/92))
- Ignore `only` option during preflight checks ([#98](https://github.com/rollup/rollup-plugin-babel/issues/98))
- Use `options.onwarn` if available ([#84](https://github.com/rollup/rollup-plugin-babel/issues/84))
- Update documentation and dependencies
## 2.6.1
- Return a `name`
## 2.6.0
- Use `\0` convention for helper module ID ([#64](https://github.com/rollup/rollup-plugin-babel/issues/64))
## 2.5.1
- Don't mutate `options.plugins` ([#47](https://github.com/rollup/rollup-plugin-babel/issues/47))
## 2.5.0
- Import `babelHelpers` rather than injecting them allows `transform` function to be pure ([#rollup/658](https://github.com/rollup/rollup/pull/658#issuecomment-223876824))
## 2.4.0
- Add `externalHelpers` option ([#41](https://github.com/rollup/rollup-plugin-babel/pull/41))
## 2.3.9
- Do not rename Babel helpers ([#34](https://github.com/rollup/rollup-plugin-babel/pull/34))
## 2.3.8
- Create new version to (hopefully) solve bizarre CI issue
## 2.3.7
- Be less clever about renaming Babel helpers ([#19](https://github.com/rollup/rollup-plugin-babel/issues/19))
## 2.3.6
- Fix cache misses in preflight check ([#29](https://github.com/rollup/rollup-plugin-babel/pull/29))
## 2.3.5
- Use class transformer local to plugin, not project being built
## 2.3.4
- Ensure class transformer is present for preflight check, and only run check once per directory ([#23](https://github.com/rollup/rollup-plugin-babel/issues/23))
## 2.3.3
- Fix helper renaming ([#22](https://github.com/rollup/rollup-plugin-babel/issues/22))
## 2.3.1-2
- Include correct files in npm package
## 2.3.0
- Allow `transform-runtime` Babel plugin, if combined with `runtimeHelpers: true` option ([#17](https://github.com/rollup/rollup-plugin-babel/issues/17))
- More permissive handling of helpers only warn if inline helpers are duplicated
- Handle plugins that change export patterns ([#18](https://github.com/rollup/rollup-plugin-babel/issues/18))
## 2.2.0
- Preflight checks are run per-file, to avoid configuration snafus ([#16](https://github.com/rollup/rollup-plugin-babel/issues/16))
## 2.1.0
- Generate sourcemaps by default
## 2.0.1
- Use object-assign ponyfill
- Add travis support
- Fix test
## 2.0.0
- Babel 6 compatible
## 1.0.0
- First release

21
web/node_modules/rollup-plugin-babel/LICENSE.md generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 [these people](https://github.com/rollup/rollup-plugin-babel/graphs/contributors)
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.

201
web/node_modules/rollup-plugin-babel/README.md generated vendored Normal file
View file

@ -0,0 +1,201 @@
# rollup-plugin-babel
Seamless integration between Rollup and Babel.
## Why?
If you're using Babel to transpile your ES6/7 code and Rollup to generate a standalone bundle, you have a couple of options:
- run the code through Babel first, being careful to exclude the module transformer, or
- run the code through Rollup first, and _then_ pass it to Babel.
Both approaches have disadvantages in the first case, on top of the additional configuration complexity, you may end up with Babel's helpers (like `classCallCheck`) repeated throughout your code (once for each module where the helpers are used). In the second case, transpiling is likely to be slower, because transpiling a large bundle is much more work for Babel than transpiling a set of small files.
Either way, you have to worry about a place to put the intermediate files, and getting sourcemaps to behave becomes a royal pain.
Using Rollup with rollup-plugin-babel makes the process far easier.
## Installation
> babel 7.x
```bash
npm install --save-dev rollup-plugin-babel@latest
```
> babel 6.x
```bash
npm install --save-dev rollup-plugin-babel@3
```
## Usage
```js
import { rollup } from 'rollup';
import babel from 'rollup-plugin-babel';
rollup({
entry: 'main.js',
plugins: [
babel({
exclude: 'node_modules/**'
})
]
}).then(...)
```
All options are as per the [Babel documentation](https://babeljs.io/), plus the following:
- `options.externalHelpers`: a boolean value indicating whether to bundle in the Babel helpers
- `options.include` and `options.exclude`: each a minimatch pattern, or array of minimatch patterns, which determine which files are transpiled by Babel (by default, all files are transpiled)
- `options.externalHelpersWhitelist`: an array which gives explicit control over which babelHelper functions are allowed in the bundle (by default, every helper is allowed)
- `options.extensions`: an array of file extensions that Babel should transpile (by default the Babel defaults of .js, .jsx, .es6, .es, .mjs. are used)
Babel will respect `.babelrc` files this is generally the best place to put your configuration.
### External dependencies
Ideally, you should only be transforming your source code, rather than running all of your external dependencies through Babel hence the `exclude: 'node_modules/**'` in the example above. If you have a dependency that exposes untranspiled ES6 source code that doesn't run in your target environment, then you may need to break this rule, but it often causes problems with unusual `.babelrc` files or mismatched versions of Babel.
We encourage library authors not to distribute code that uses untranspiled ES6 features (other than modules) for this reason. Consumers of your library should _not_ have to transpile your ES6 code, any more than they should have to transpile your CoffeeScript, ClojureScript or TypeScript.
Use `babelrc: false` to prevent Babel from using local (i.e. to your external dependencies) `.babelrc` files, relying instead on the configuration you pass in.
### Helpers
In some cases Babel uses _helpers_ to avoid repeating chunks of code  for example, if you use the `class` keyword, it will use a `classCallCheck` function to ensure that the class is instantiated correctly.
By default, those helpers will be inserted at the top of the file being transformed, which can lead to duplication. This rollup plugin automatically deduplicates those helpers, keeping only one copy of each one used in the output bundle. Rollup will combine the helpers in a single block at the top of your bundle. To achieve the same in Babel 6 you must use the `external-helpers` plugin.
Alternatively, if you know what you're doing, you can use the `transform-runtime` plugin. If you do this, use `runtimeHelpers: true`:
```js
rollup.rollup({
...,
plugins: [
babel({ runtimeHelpers: true })
]
}).then(...)
```
By default `externalHelpers` option is set to `false` so babel helpers will be included in your bundle.
If you do not wish the babel helpers to be included in your bundle at all (but instead reference the global `babelHelpers` object), you may set the `externalHelpers` option to `true`:
```js
rollup.rollup({
...,
plugins: [
babel({
plugins: ['external-helpers'],
externalHelpers: true
})
]
}).then(...)
```
### Modules
_This is not needed for Babel 7 - it knows automatically that Rollup understands ES modules & that it shouldn't use any module transform with it. The section below describes what needs to be done for Babel 6._
The `env` preset includes the [transform-es2015-modules-commonjs](http://babeljs.io/docs/plugins/transform-es2015-modules-commonjs/) plugin, which converts ES6 modules to CommonJS preventing Rollup from working. Since Babel 6.3 it's possible to deactivate module transformation with `"modules": false`. So there is no need to use the old workaround with `babel-preset-es2015-rollup`, that will work for Babel <6.13. Rollup will throw an error if this is incorrectly configured.
However, setting `modules: false` in your `.babelrc` may conflict if you are using `babel-register`. To work around this, specify `babelrc: false` in your rollup config. This allows Rollup to bypass your `.babelrc` file. In order to use the `env` preset, you will also need to specify it with `modules: false` option:
```js
plugins: [
babel({
babelrc: false,
presets: [['env', { modules: false }]],
}),
];
```
## Configuring Babel 6
**The following applies to Babel 6 only. If you're using Babel 5, do `npm i -D rollup-plugin-babel@1`, as version 2 and above no longer supports Babel 5**
```bash
npm install --save-dev rollup-plugin-babel@3 babel-preset-env babel-plugin-external-helpers
```
```js
// .babelrc
{
"presets": [
[
"env",
{
"modules": false
}
]
],
"plugins": [
"external-helpers"
]
}
```
## Custom plugin builder
`rollup-plugin-babel` exposes a plugin-builder utility that allows users to add custom handling of Babel's configuration for each file that it processes.
`.custom` accepts a callback that will be called with the loader's instance of `babel` so that tooling can ensure that it using exactly the same `@babel/core` instance as the loader itself.
It's main purpose is to allow other tools for configuration of transpilation without forcing people to add extra configuration but still allow for using their own babelrc / babel config files.
### Example
```js
import babel from 'rollup-plugin-babel';
export default babel.custom(babelCore => {
function myPlugin() {
return {
visitor: {},
};
}
return {
// Passed the plugin options.
options({ opt1, opt2, ...pluginOptions }) {
return {
// Pull out any custom options that the plugin might have.
customOptions: { opt1, opt2 },
// Pass the options back with the two custom options removed.
pluginOptions,
};
},
config(cfg /* Passed Babel's 'PartialConfig' object. */, { code, customOptions }) {
if (cfg.hasFilesystemConfig()) {
// Use the normal config
return cfg.options;
}
return {
...cfg.options,
plugins: [
...(cfg.options.plugins || []),
// Include a custom plugin in the options.
myPlugin,
],
};
},
result(result, { code, customOptions, config, transformOptions }) {
return {
...result,
code: result.code + '\n// Generated by some custom plugin',
};
},
};
});
```
## License
MIT

View file

@ -0,0 +1,246 @@
'use strict';
var babel = require('@babel/core');
var rollupPluginutils = require('rollup-pluginutils');
var helperModuleImports = require('@babel/helper-module-imports');
var INLINE = {};
var RUNTIME = {};
var EXTERNAL = {};
// NOTE: DO NOT REMOVE the null character `\0` as it may be used by other plugins
// e.g. https://github.com/rollup/rollup-plugin-node-resolve/blob/313a3e32f432f9eb18cc4c231cc7aac6df317a51/src/index.js#L74
var HELPERS = '\0rollupPluginBabelHelpers.js';
var addBabelPlugin = function (options, plugin) { return (Object.assign({}, options, {plugins: options.plugins.concat(plugin)})); };
var warned = {};
function warnOnce(ctx, msg) {
if (warned[msg]) { return; }
warned[msg] = true;
ctx.warn(msg);
}
var regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g;
var escapeRegExpCharacters = function (str) { return str.replace(regExpCharactersRegExp, '\\$&'); };
var MODULE_ERROR =
'Rollup requires that your Babel configuration keeps ES6 module syntax intact. ' +
'Unfortunately it looks like your configuration specifies a module transformer ' +
'to replace ES6 modules with another module format. To continue you have to disable it.' +
'\n\n' +
"Most commonly it's a CommonJS transform added by @babel/preset-env - " +
'in such case you should disable it by adding `modules: false` option to that preset ' +
'(described in more detail here - https://github.com/rollup/rollup-plugin-babel#modules ).';
var UNEXPECTED_ERROR =
'An unexpected situation arose. Please raise an issue at ' +
'https://github.com/rollup/rollup-plugin-babel/issues. Thanks!';
function fallbackClassTransform() {
return {
visitor: {
ClassDeclaration: function ClassDeclaration(path, state) {
path.replaceWith(state.file.addHelper('inherits'));
},
},
};
}
function createPreflightCheck() {
var preflightCheckResults = {};
return function (ctx, options) {
var key = options.filename;
if (preflightCheckResults[key] === undefined) {
var helpers;
var inputCode = 'class Foo extends Bar {};\nexport default Foo;';
var transformed = babel.transformSync(inputCode, options);
var check = transformed.code;
if (~check.indexOf('class ')) {
check = babel.transformSync(inputCode, addBabelPlugin(options, fallbackClassTransform)).code;
}
if (
!~check.indexOf('export default') &&
!~check.indexOf('export default Foo') &&
!~check.indexOf('export { Foo as default }')
) {
ctx.error(MODULE_ERROR);
}
if (check.match(/\/helpers\/(esm\/)?inherits/)) { helpers = RUNTIME; }
else if (~check.indexOf('function _inherits')) { helpers = INLINE; }
else if (~check.indexOf('babelHelpers')) { helpers = EXTERNAL; }
else {
ctx.error(UNEXPECTED_ERROR);
}
preflightCheckResults[key] = helpers;
}
return preflightCheckResults[key];
};
}
function importHelperPlugin() {
return {
pre: function pre(file) {
var cachedHelpers = {};
file.set('helperGenerator', function (name) {
if (!file.availableHelper(name)) {
return;
}
if (cachedHelpers[name]) {
return cachedHelpers[name];
}
return (cachedHelpers[name] = helperModuleImports.addNamed(file.path, name, HELPERS));
});
},
};
}
function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
var unpackOptions = function (ref) {
if ( ref === void 0 ) ref = {};
var extensions = ref.extensions; if ( extensions === void 0 ) extensions = babel.DEFAULT_EXTENSIONS;
var sourcemap = ref.sourcemap; if ( sourcemap === void 0 ) sourcemap = true;
var sourcemaps = ref.sourcemaps; if ( sourcemaps === void 0 ) sourcemaps = true;
var sourceMap = ref.sourceMap; if ( sourceMap === void 0 ) sourceMap = true;
var sourceMaps = ref.sourceMaps; if ( sourceMaps === void 0 ) sourceMaps = true;
var rest$1 = objectWithoutProperties( ref, ["extensions", "sourcemap", "sourcemaps", "sourceMap", "sourceMaps"] );
var rest = rest$1;
return (Object.assign({}, {extensions: extensions,
plugins: [],
sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps},
rest,
{caller: Object.assign({}, {name: 'rollup-plugin-babel',
supportsStaticESM: true,
supportsDynamicImport: true},
rest.caller)}));
};
var returnObject = function () { return ({}); };
function createBabelPluginFactory(customCallback) {
if ( customCallback === void 0 ) customCallback = returnObject;
var overrides = customCallback(babel);
return function (pluginOptions) {
var assign;
var customOptions = null;
if (overrides.options) {
var overridden = overrides.options(pluginOptions);
if (typeof overridden.then === 'function') {
throw new Error(
".options hook can't be asynchronous. It should return `{ customOptions, pluginsOptions }` synchronously."
);
}
((assign = overridden, customOptions = assign.customOptions, customOptions = customOptions === void 0 ? null : customOptions, pluginOptions = assign.pluginOptions));
}
var ref = unpackOptions(pluginOptions);
var exclude = ref.exclude;
var extensions = ref.extensions;
var externalHelpers = ref.externalHelpers;
var externalHelpersWhitelist = ref.externalHelpersWhitelist;
var include = ref.include;
var runtimeHelpers = ref.runtimeHelpers;
var rest = objectWithoutProperties( ref, ["exclude", "extensions", "externalHelpers", "externalHelpersWhitelist", "include", "runtimeHelpers"] );
var babelOptions = rest;
var extensionRegExp = new RegExp(("(" + (extensions.map(escapeRegExpCharacters).join('|')) + ")$"));
var includeExcludeFilter = rollupPluginutils.createFilter(include, exclude);
var filter = function (id) { return extensionRegExp.test(id) && includeExcludeFilter(id); };
var preflightCheck = createPreflightCheck();
return {
name: 'babel',
resolveId: function resolveId(id) {
if (id === HELPERS) { return id; }
},
load: function load(id) {
if (id !== HELPERS) {
return;
}
return babel.buildExternalHelpers(externalHelpersWhitelist, 'module');
},
transform: function transform(code, filename) {
var this$1 = this;
if (!filter(filename)) { return Promise.resolve(null); }
if (filename === HELPERS) { return Promise.resolve(null); }
var config = babel.loadPartialConfig(Object.assign({}, babelOptions, {filename: filename}));
// file is ignored
if (!config) {
return Promise.resolve(null);
}
return Promise.resolve(
!overrides.config
? config.options
: overrides.config.call(this, config, {
code: code,
customOptions: customOptions,
})
).then(function (transformOptions) {
var helpers = preflightCheck(this$1, transformOptions);
if (helpers === EXTERNAL && !externalHelpers) {
warnOnce(
this$1,
'Using "external-helpers" plugin with rollup-plugin-babel is deprecated, as it now automatically deduplicates your Babel helpers.'
);
} else if (helpers === RUNTIME && !runtimeHelpers) {
this$1.error(
'Runtime helpers are not enabled. Either exclude the transform-runtime Babel plugin or pass the `runtimeHelpers: true` option. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information'
);
}
if (helpers !== RUNTIME && !externalHelpers) {
transformOptions = addBabelPlugin(transformOptions, importHelperPlugin);
}
var result = babel.transformSync(code, transformOptions);
return Promise.resolve(
!overrides.result
? result
: overrides.result.call(this$1, result, {
code: code,
customOptions: customOptions,
config: config,
transformOptions: transformOptions,
})
).then(function (ref) {
var code = ref.code;
var map = ref.map;
return ({ code: code, map: map });
});
});
},
};
};
}
var babelPluginFactory = createBabelPluginFactory();
babelPluginFactory.custom = createBabelPluginFactory;
module.exports = babelPluginFactory;
//# sourceMappingURL=rollup-plugin-babel.cjs.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,245 @@
import * as babel from '@babel/core';
import { transformSync, buildExternalHelpers, loadPartialConfig, DEFAULT_EXTENSIONS } from '@babel/core';
import { createFilter } from 'rollup-pluginutils';
import { addNamed } from '@babel/helper-module-imports';
var INLINE = {};
var RUNTIME = {};
var EXTERNAL = {};
// NOTE: DO NOT REMOVE the null character `\0` as it may be used by other plugins
// e.g. https://github.com/rollup/rollup-plugin-node-resolve/blob/313a3e32f432f9eb18cc4c231cc7aac6df317a51/src/index.js#L74
var HELPERS = '\0rollupPluginBabelHelpers.js';
var addBabelPlugin = function (options, plugin) { return (Object.assign({}, options, {plugins: options.plugins.concat(plugin)})); };
var warned = {};
function warnOnce(ctx, msg) {
if (warned[msg]) { return; }
warned[msg] = true;
ctx.warn(msg);
}
var regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g;
var escapeRegExpCharacters = function (str) { return str.replace(regExpCharactersRegExp, '\\$&'); };
var MODULE_ERROR =
'Rollup requires that your Babel configuration keeps ES6 module syntax intact. ' +
'Unfortunately it looks like your configuration specifies a module transformer ' +
'to replace ES6 modules with another module format. To continue you have to disable it.' +
'\n\n' +
"Most commonly it's a CommonJS transform added by @babel/preset-env - " +
'in such case you should disable it by adding `modules: false` option to that preset ' +
'(described in more detail here - https://github.com/rollup/rollup-plugin-babel#modules ).';
var UNEXPECTED_ERROR =
'An unexpected situation arose. Please raise an issue at ' +
'https://github.com/rollup/rollup-plugin-babel/issues. Thanks!';
function fallbackClassTransform() {
return {
visitor: {
ClassDeclaration: function ClassDeclaration(path, state) {
path.replaceWith(state.file.addHelper('inherits'));
},
},
};
}
function createPreflightCheck() {
var preflightCheckResults = {};
return function (ctx, options) {
var key = options.filename;
if (preflightCheckResults[key] === undefined) {
var helpers;
var inputCode = 'class Foo extends Bar {};\nexport default Foo;';
var transformed = transformSync(inputCode, options);
var check = transformed.code;
if (~check.indexOf('class ')) {
check = transformSync(inputCode, addBabelPlugin(options, fallbackClassTransform)).code;
}
if (
!~check.indexOf('export default') &&
!~check.indexOf('export default Foo') &&
!~check.indexOf('export { Foo as default }')
) {
ctx.error(MODULE_ERROR);
}
if (check.match(/\/helpers\/(esm\/)?inherits/)) { helpers = RUNTIME; }
else if (~check.indexOf('function _inherits')) { helpers = INLINE; }
else if (~check.indexOf('babelHelpers')) { helpers = EXTERNAL; }
else {
ctx.error(UNEXPECTED_ERROR);
}
preflightCheckResults[key] = helpers;
}
return preflightCheckResults[key];
};
}
function importHelperPlugin() {
return {
pre: function pre(file) {
var cachedHelpers = {};
file.set('helperGenerator', function (name) {
if (!file.availableHelper(name)) {
return;
}
if (cachedHelpers[name]) {
return cachedHelpers[name];
}
return (cachedHelpers[name] = addNamed(file.path, name, HELPERS));
});
},
};
}
function objectWithoutProperties (obj, exclude) { var target = {}; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k]; return target; }
var unpackOptions = function (ref) {
if ( ref === void 0 ) ref = {};
var extensions = ref.extensions; if ( extensions === void 0 ) extensions = DEFAULT_EXTENSIONS;
var sourcemap = ref.sourcemap; if ( sourcemap === void 0 ) sourcemap = true;
var sourcemaps = ref.sourcemaps; if ( sourcemaps === void 0 ) sourcemaps = true;
var sourceMap = ref.sourceMap; if ( sourceMap === void 0 ) sourceMap = true;
var sourceMaps = ref.sourceMaps; if ( sourceMaps === void 0 ) sourceMaps = true;
var rest$1 = objectWithoutProperties( ref, ["extensions", "sourcemap", "sourcemaps", "sourceMap", "sourceMaps"] );
var rest = rest$1;
return (Object.assign({}, {extensions: extensions,
plugins: [],
sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps},
rest,
{caller: Object.assign({}, {name: 'rollup-plugin-babel',
supportsStaticESM: true,
supportsDynamicImport: true},
rest.caller)}));
};
var returnObject = function () { return ({}); };
function createBabelPluginFactory(customCallback) {
if ( customCallback === void 0 ) customCallback = returnObject;
var overrides = customCallback(babel);
return function (pluginOptions) {
var assign;
var customOptions = null;
if (overrides.options) {
var overridden = overrides.options(pluginOptions);
if (typeof overridden.then === 'function') {
throw new Error(
".options hook can't be asynchronous. It should return `{ customOptions, pluginsOptions }` synchronously."
);
}
((assign = overridden, customOptions = assign.customOptions, customOptions = customOptions === void 0 ? null : customOptions, pluginOptions = assign.pluginOptions));
}
var ref = unpackOptions(pluginOptions);
var exclude = ref.exclude;
var extensions = ref.extensions;
var externalHelpers = ref.externalHelpers;
var externalHelpersWhitelist = ref.externalHelpersWhitelist;
var include = ref.include;
var runtimeHelpers = ref.runtimeHelpers;
var rest = objectWithoutProperties( ref, ["exclude", "extensions", "externalHelpers", "externalHelpersWhitelist", "include", "runtimeHelpers"] );
var babelOptions = rest;
var extensionRegExp = new RegExp(("(" + (extensions.map(escapeRegExpCharacters).join('|')) + ")$"));
var includeExcludeFilter = createFilter(include, exclude);
var filter = function (id) { return extensionRegExp.test(id) && includeExcludeFilter(id); };
var preflightCheck = createPreflightCheck();
return {
name: 'babel',
resolveId: function resolveId(id) {
if (id === HELPERS) { return id; }
},
load: function load(id) {
if (id !== HELPERS) {
return;
}
return buildExternalHelpers(externalHelpersWhitelist, 'module');
},
transform: function transform(code, filename) {
var this$1 = this;
if (!filter(filename)) { return Promise.resolve(null); }
if (filename === HELPERS) { return Promise.resolve(null); }
var config = loadPartialConfig(Object.assign({}, babelOptions, {filename: filename}));
// file is ignored
if (!config) {
return Promise.resolve(null);
}
return Promise.resolve(
!overrides.config
? config.options
: overrides.config.call(this, config, {
code: code,
customOptions: customOptions,
})
).then(function (transformOptions) {
var helpers = preflightCheck(this$1, transformOptions);
if (helpers === EXTERNAL && !externalHelpers) {
warnOnce(
this$1,
'Using "external-helpers" plugin with rollup-plugin-babel is deprecated, as it now automatically deduplicates your Babel helpers.'
);
} else if (helpers === RUNTIME && !runtimeHelpers) {
this$1.error(
'Runtime helpers are not enabled. Either exclude the transform-runtime Babel plugin or pass the `runtimeHelpers: true` option. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information'
);
}
if (helpers !== RUNTIME && !externalHelpers) {
transformOptions = addBabelPlugin(transformOptions, importHelperPlugin);
}
var result = transformSync(code, transformOptions);
return Promise.resolve(
!overrides.result
? result
: overrides.result.call(this$1, result, {
code: code,
customOptions: customOptions,
config: config,
transformOptions: transformOptions,
})
).then(function (ref) {
var code = ref.code;
var map = ref.map;
return ({ code: code, map: map });
});
});
},
};
};
}
var babelPluginFactory = createBabelPluginFactory();
babelPluginFactory.custom = createBabelPluginFactory;
export default babelPluginFactory;
//# sourceMappingURL=rollup-plugin-babel.esm.js.map

File diff suppressed because one or more lines are too long

65
web/node_modules/rollup-plugin-babel/package.json generated vendored Normal file
View file

@ -0,0 +1,65 @@
{
"name": "rollup-plugin-babel",
"version": "4.4.0",
"description": "Seamless integration between Rollup and Babel.",
"main": "dist/rollup-plugin-babel.cjs.js",
"module": "dist/rollup-plugin-babel.esm.js",
"files": [
"src",
"dist"
],
"keywords": [
"rollup-plugin",
"babel",
"es2015",
"es6"
],
"homepage": "https://github.com/rollup/rollup-plugin-babel",
"author": "Rich Harris",
"contributors": [
"Bogdan Chadkin <trysound@yandex.ru>",
"Mateusz Burzyński <mateuszburzynski@gmail.com> (https://github.com/Andarist)"
],
"license": "MIT",
"scripts": {
"lint": "eslint src",
"pretest": "npm run build",
"test": "mocha",
"prebuild": "rm -rf dist/*",
"build": "rollup -c",
"prepare": "npm run build",
"preversion": "npm run lint && npm test"
},
"dependencies": {
"@babel/helper-module-imports": "^7.0.0",
"rollup-pluginutils": "^2.8.1"
},
"peerDependencies": {
"@babel/core": "7 || ^7.0.0-rc.2",
"rollup": ">=0.60.0 <3"
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/plugin-external-helpers": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.3.4",
"buble": "^0.19.3",
"eslint": "^5.15.1",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-prettier": "^3.0.0",
"husky": "^1.0.1",
"lint-staged": "^7.2.2",
"mocha": "^5.2.0",
"prettier": "^1.15.3",
"rollup": "^2.0.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-json": "^3.0.0",
"source-map": "^0.6.1",
"source-map-support": "^0.5.6"
},
"repository": "rollup/rollup-plugin-babel",
"bugs": {
"url": "https://github.com/rollup/rollup-plugin-babel/issues"
}
}

View file

@ -0,0 +1,7 @@
export const INLINE = {};
export const RUNTIME = {};
export const EXTERNAL = {};
// NOTE: DO NOT REMOVE the null character `\0` as it may be used by other plugins
// e.g. https://github.com/rollup/rollup-plugin-node-resolve/blob/313a3e32f432f9eb18cc4c231cc7aac6df317a51/src/index.js#L74
export const HELPERS = '\0rollupPluginBabelHelpers.js';

View file

@ -0,0 +1,21 @@
import { HELPERS } from './constants.js';
import { addNamed } from '@babel/helper-module-imports';
export default function importHelperPlugin() {
return {
pre(file) {
const cachedHelpers = {};
file.set('helperGenerator', name => {
if (!file.availableHelper(name)) {
return;
}
if (cachedHelpers[name]) {
return cachedHelpers[name];
}
return (cachedHelpers[name] = addNamed(file.path, name, HELPERS));
});
},
};
}

133
web/node_modules/rollup-plugin-babel/src/index.js generated vendored Normal file
View file

@ -0,0 +1,133 @@
import * as babel from '@babel/core';
import { createFilter } from 'rollup-pluginutils';
import createPreflightCheck from './preflightCheck.js';
import helperPlugin from './helperPlugin.js';
import { addBabelPlugin, escapeRegExpCharacters, warnOnce } from './utils.js';
import { RUNTIME, EXTERNAL, HELPERS } from './constants.js';
const unpackOptions = ({
extensions = babel.DEFAULT_EXTENSIONS,
// rollup uses sourcemap, babel uses sourceMaps
// just normalize them here so people don't have to worry about it
sourcemap = true,
sourcemaps = true,
sourceMap = true,
sourceMaps = true,
...rest
} = {}) => ({
extensions,
plugins: [],
sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps,
...rest,
caller: {
name: 'rollup-plugin-babel',
supportsStaticESM: true,
supportsDynamicImport: true,
...rest.caller,
},
});
const returnObject = () => ({});
function createBabelPluginFactory(customCallback = returnObject) {
const overrides = customCallback(babel);
return pluginOptions => {
let customOptions = null;
if (overrides.options) {
const overridden = overrides.options(pluginOptions);
if (typeof overridden.then === 'function') {
throw new Error(
".options hook can't be asynchronous. It should return `{ customOptions, pluginsOptions }` synchronously.",
);
}
({ customOptions = null, pluginOptions } = overridden);
}
const {
exclude,
extensions,
externalHelpers,
externalHelpersWhitelist,
include,
runtimeHelpers,
...babelOptions
} = unpackOptions(pluginOptions);
const extensionRegExp = new RegExp(`(${extensions.map(escapeRegExpCharacters).join('|')})$`);
const includeExcludeFilter = createFilter(include, exclude);
const filter = id => extensionRegExp.test(id) && includeExcludeFilter(id);
const preflightCheck = createPreflightCheck();
return {
name: 'babel',
resolveId(id) {
if (id === HELPERS) return id;
},
load(id) {
if (id !== HELPERS) {
return;
}
return babel.buildExternalHelpers(externalHelpersWhitelist, 'module');
},
transform(code, filename) {
if (!filter(filename)) return Promise.resolve(null);
if (filename === HELPERS) return Promise.resolve(null);
const config = babel.loadPartialConfig({ ...babelOptions, filename });
// file is ignored
if (!config) {
return Promise.resolve(null);
}
return Promise.resolve(
!overrides.config
? config.options
: overrides.config.call(this, config, {
code,
customOptions,
}),
).then(transformOptions => {
const helpers = preflightCheck(this, transformOptions);
if (helpers === EXTERNAL && !externalHelpers) {
warnOnce(
this,
'Using "external-helpers" plugin with rollup-plugin-babel is deprecated, as it now automatically deduplicates your Babel helpers.',
);
} else if (helpers === RUNTIME && !runtimeHelpers) {
this.error(
'Runtime helpers are not enabled. Either exclude the transform-runtime Babel plugin or pass the `runtimeHelpers: true` option. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information',
);
}
if (helpers !== RUNTIME && !externalHelpers) {
transformOptions = addBabelPlugin(transformOptions, helperPlugin);
}
const result = babel.transformSync(code, transformOptions);
return Promise.resolve(
!overrides.result
? result
: overrides.result.call(this, result, {
code,
customOptions,
config,
transformOptions,
}),
).then(({ code, map }) => ({ code, map }));
});
},
};
};
}
const babelPluginFactory = createBabelPluginFactory();
babelPluginFactory.custom = createBabelPluginFactory;
export default babelPluginFactory;

View file

@ -0,0 +1,66 @@
import { transformSync } from '@babel/core';
import { INLINE, RUNTIME, EXTERNAL } from './constants.js';
import { addBabelPlugin } from './utils.js';
const MODULE_ERROR =
'Rollup requires that your Babel configuration keeps ES6 module syntax intact. ' +
'Unfortunately it looks like your configuration specifies a module transformer ' +
'to replace ES6 modules with another module format. To continue you have to disable it.' +
'\n\n' +
"Most commonly it's a CommonJS transform added by @babel/preset-env - " +
'in such case you should disable it by adding `modules: false` option to that preset ' +
'(described in more detail here - https://github.com/rollup/rollup-plugin-babel#modules ).';
const UNEXPECTED_ERROR =
'An unexpected situation arose. Please raise an issue at ' +
'https://github.com/rollup/rollup-plugin-babel/issues. Thanks!';
function fallbackClassTransform() {
return {
visitor: {
ClassDeclaration(path, state) {
path.replaceWith(state.file.addHelper('inherits'));
},
},
};
}
export default function createPreflightCheck() {
let preflightCheckResults = {};
return (ctx, options) => {
const key = options.filename;
if (preflightCheckResults[key] === undefined) {
let helpers;
const inputCode = 'class Foo extends Bar {};\nexport default Foo;';
const transformed = transformSync(inputCode, options);
let check = transformed.code;
if (~check.indexOf('class ')) {
check = transformSync(inputCode, addBabelPlugin(options, fallbackClassTransform)).code;
}
if (
!~check.indexOf('export default') &&
!~check.indexOf('export default Foo') &&
!~check.indexOf('export { Foo as default }')
) {
ctx.error(MODULE_ERROR);
}
if (check.match(/\/helpers\/(esm\/)?inherits/)) helpers = RUNTIME;
else if (~check.indexOf('function _inherits')) helpers = INLINE;
else if (~check.indexOf('babelHelpers')) helpers = EXTERNAL;
else {
ctx.error(UNEXPECTED_ERROR);
}
preflightCheckResults[key] = helpers;
}
return preflightCheckResults[key];
};
}

11
web/node_modules/rollup-plugin-babel/src/utils.js generated vendored Normal file
View file

@ -0,0 +1,11 @@
export const addBabelPlugin = (options, plugin) => ({ ...options, plugins: options.plugins.concat(plugin) });
let warned = {};
export function warnOnce(ctx, msg) {
if (warned[msg]) return;
warned[msg] = true;
ctx.warn(msg);
}
const regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g;
export const escapeRegExpCharacters = str => str.replace(regExpCharactersRegExp, '\\$&');