aboutsummaryrefslogtreecommitdiff
path: root/node_modules/babel-loader
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/babel-loader
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/babel-loader')
-rw-r--r--node_modules/babel-loader/CHANGELOG.md169
-rw-r--r--node_modules/babel-loader/LICENSE22
-rw-r--r--node_modules/babel-loader/README.md284
-rw-r--r--node_modules/babel-loader/lib/Error.js36
-rw-r--r--node_modules/babel-loader/lib/cache.js218
-rw-r--r--node_modules/babel-loader/lib/index.js149
-rw-r--r--node_modules/babel-loader/lib/transform.js48
-rw-r--r--node_modules/babel-loader/lib/utils/relative.js15
l---------node_modules/babel-loader/node_modules/.bin/mkdirp1
l---------node_modules/babel-loader/node_modules/.bin/webpack1
-rw-r--r--node_modules/babel-loader/package.json118
11 files changed, 1061 insertions, 0 deletions
diff --git a/node_modules/babel-loader/CHANGELOG.md b/node_modules/babel-loader/CHANGELOG.md
new file mode 100644
index 00000000..0dc39044
--- /dev/null
+++ b/node_modules/babel-loader/CHANGELOG.md
@@ -0,0 +1,169 @@
+# Changelog
+
+For changes in version v7.0.0 and up please go to [release](https://github.com/babel/babel-loader/releases)
+
+# Old Changelog
+
+## v6.4.1
+
+### 🐛 Bug Fix
+
+- Fixed reset of BABEL_ENV when options.forceEnv is used (#420) @nikopavlica
+
+## v6.4.0
+
+### 🚀 New Feature
+
+- added metadata passing from babel to webpack, which is currently used by react-intl (#398) @Ognian
+
+## v6.3.2
+
+### 😢 Regression
+
+- `forceEnv` was interfering with regular environment handling
+
+## v6.3.1
+
+### 🐛 Bug Fix
+
+ - The new `forceEnv` options wasn't working as expected (#379) @chrisvasz
+
+## v6.3.0
+
+### 🚀 New Feature
+
+- Add new config option `forceEnv` (#368) @moimael
+
+Allow to override BABEL_ENV/NODE_ENV at loader-level. Useful for isomorphic applications which have separate babel config for client and server.
+
+### 🐛 Bug Fix
+
+- Update loader-utils dependency to ^0.2.16 to fix compatibility with webpack 2 (#371) @leonaves
+
+### 💅 Polish
+
+- Improve FS caching to do less sync calls which improves performance slightly (#375) @akx
+
+## v6.2.10
+
+Support for webpack 2.2-rc has been added in this release
+
+### 🐛 Bug Fix
+
+- If cache directory not writable, try to fallback to tmpdir before failing
+
+## v6.2.9
+
+### 😢 Regression
+
+Source maps on windows did not work correctly with v6.2.8.
+Thanks @josephst
+
+### 🏠 Internal
+
+- Add AppVeyor to run tests on windows @danez
+- Fix tests on windows (#343) @danez
+
+## v6.2.8
+
+### 🐛 Bug Fix
+
+- gzipped files should have `.gz` as the extension, not `.gzip` (#326) @bjornstar
+- fix options.sourceFileName gennerate bug (#260) @creeperyang
+
+### 📝 Documentation
+
+- Update README docs for cacheDirectory's actual behaviour (#245) @sohkai
+- updates docs re: transform-runtime (#197) @gbrassey
+
+### 🏠 Internal
+
+- Use eslint and nyc (#321) @danez
+- Adjust travis config (#320) @danez
+- Use babel to compile babel-loader (#319) @danez
+
+## v6.2.7
+
+### 😢 Regression
+
+Fallback to `os.tmpdir()` if no cachedir found (#318) (fixes #317) @danez
+
+Fixes an issue with v6.2.6 when using `babel-loader` as a global package.
+
+## v6.2.6
+
+### 🐛 Bug Fix
+
+- Use standard cache dir as default `cacheDirectory` (#301) @fson
+
+Use the common cache directory, `./node_modules/.cache/babel-loader`, as the default cache directory (when the cacheDirectory setting is enabled).
+
+```js
+query: {
+ cacheDirectory: true
+}
+```
+
+## v6.2.5
+
+- Don't show the call stack for a Babel error (such as when you have a syntax error)
+
+<img width="415" alt="screenshot 2016-08-15 15 24 37" src="https://cloud.githubusercontent.com/assets/30594/17664401/727ba098-62fc-11e6-9f12-42da0cf47f14.png">
+
+- resolve the .babelrc relative to the file path rather than the cwd (current working directory).
+
+ * fix: more concise formatting for Babel errors (#287) (Andrey Popp)
+ * fix(resolve-rc): resolve-rc relative file path (#253) (Luke Page)
+ * add babel-core and preset-2015 to dev dependencies (#273) (timse)
+ * chore(docs): add issue and pr templates (#280) (Joshua Wiens)
+ * chore(docs): fix badge formatting (Joshua Wiens)
+ * chore(ci): expand travis testing (#278) (Joshua Wiens)
+ * Update README: add env vars to cacheIdentifier (#267) (Dominik Ferber)
+ * add npm badge [skip ci] (Henry Zhu)
+ * update [skip ci] (Henry Zhu)
+ * remove jsx references as well [skip ci] (Henry Zhu)
+ * Save the transform to devDependencies (Ray Booysen)
+ * Remove 'react' preset (Jake Rios)
+ * Removed babel-preset-react from README.md (Ben Stephenson)
+
+## v6.2.4
+ * change allowed peer deps (all webpack 2 beta versions)
+
+## v6.2.3
+ * change allowed peer deps (2.0.7-beta)
+
+## v6.2.2
+ * Update peerDependencies to accept webpack 2 [#208](https://github.com/babel/babel-loader/pull/208)
+ * Remove duplicated dependencies
+
+## v6.2.0
+ * Pass true filenames [#106](https://github.com/babel/babel-loader/issues/106)
+ * Remove babel-core from devDependencies
+
+## v6.1.0
+
+ * Merge [PR #146](https://github.com/babel/babel-loader/pull/146) Set source file name relative to options.sourceRoot
+ * Merge [PR #136](https://github.com/babel/babel-loader/pull/136) use container-based infrastructure for faster build
+ * Merge [PR #121](https://github.com/babel/babel-loader/pull/121) Make babelrc configurable
+ * Merge [PR #113](https://github.com/babel/babel-loader/pull/113) Include BABEL_ENV || NODE_ENV in cacheIdentifier
+
+## v6.0.1
+
+ * Update to babel v6.
+
+## v5.3.1
+
+ * Merge [PR #85](https://github.com/babel/babel-loader/pull/85) - Don't override sourcemap if sourcesContent already exists.
+
+
+## v5.3.1
+
+ * Merge [PR #82](https://github.com/babel/babel-loader/pull/82) - Fallback global options to empty object to avoid conflicts with object-assign polyfill.
+
+## v5.3.0
+
+ * Merge [PR #79](https://github.com/babel/babel-loader/pull/79) - This should allow babel-loader to work with [enhanced-require](https://github.com/webpack/enhanced-require).
+
+## v5.2.0
+
+ * Include `.babelrc` file into the `cacheIdentifier` if it exists
diff --git a/node_modules/babel-loader/LICENSE b/node_modules/babel-loader/LICENSE
new file mode 100644
index 00000000..c9d38e26
--- /dev/null
+++ b/node_modules/babel-loader/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2014-2016 Luís Couto <hello@luiscouto.pt>
+
+MIT License
+
+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.
diff --git a/node_modules/babel-loader/README.md b/node_modules/babel-loader/README.md
new file mode 100644
index 00000000..09a1b466
--- /dev/null
+++ b/node_modules/babel-loader/README.md
@@ -0,0 +1,284 @@
+> This readme is for babel-loader v8 + Babel v7
+> Check the [7.x branch](https://github.com/babel/babel-loader/tree/7.x) for docs with Babel v6
+
+[![NPM Status](https://img.shields.io/npm/v/babel-loader.svg?style=flat)](https://www.npmjs.com/package/babel-loader)
+[![Build Status](https://travis-ci.org/babel/babel-loader.svg?branch=master)](https://travis-ci.org/babel/babel-loader)
+[![Build Status](https://ci.appveyor.com/api/projects/status/vgtpr2i5bykgyuqo/branch/master?svg=true)](https://ci.appveyor.com/project/danez/babel-loader/branch/master)
+[![codecov](https://codecov.io/gh/babel/babel-loader/branch/master/graph/badge.svg)](https://codecov.io/gh/babel/babel-loader)
+
+<div align="center">
+ <a href="https://github.com/babel/babel/">
+ <img width="200" height="200" src="https://rawgit.com/babel/logo/master/babel.svg">
+ </a>
+ <a href="https://github.com/webpack/webpack">
+ <img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
+ </a>
+ <h1>Babel Loader</h1>
+</div>
+
+This package allows transpiling JavaScript files using [Babel](https://github.com/babel/babel) and [webpack](https://github.com/webpack/webpack).
+
+__Notes:__ Issues with the output should be reported on the babel [issue tracker](https://github.com/babel/babel/issues).
+
+<h2 align="center">Install</h2>
+
+> webpack 3.x | babel-loader 8.x | babel 7.x
+
+```bash
+npm install "babel-loader@^8.0.0-beta" @babel/core @babel/preset-env webpack
+```
+
+> webpack 3.x babel-loader 7.x | babel 6.x
+
+```bash
+npm install babel-loader babel-core babel-preset-env webpack
+```
+
+<h2 align="center">Usage</h2>
+
+[Documentation: Using loaders](https://webpack.js.org/loaders/)
+
+Within your webpack configuration object, you'll need to add the babel-loader to the list of modules, like so:
+
+```javascript
+module: {
+ rules: [
+ {
+ test: /\.js$/,
+ exclude: /(node_modules|bower_components)/,
+ use: {
+ loader: 'babel-loader',
+ options: {
+ presets: ['@babel/preset-env']
+ }
+ }
+ }
+ ]
+}
+```
+
+### Options
+
+See the `babel` [options](https://babeljs.io/docs/usage/api/#options).
+
+
+You can pass options to the loader by using the [options property](https://webpack.js.org/configuration/module/#rule-options-rule-query):
+
+```javascript
+module: {
+ rules: [
+ {
+ test: /\.js$/,
+ exclude: /(node_modules|bower_components)/,
+ use: {
+ loader: 'babel-loader',
+ options: {
+ presets: ['@babel/preset-env'],
+ plugins: [require('@babel/plugin-proposal-object-rest-spread')]
+ }
+ }
+ }
+ ]
+}
+```
+
+This loader also supports the following loader-specific option:
+
+* `cacheDirectory`: Default `false`. When set, the given directory will be used to cache the results of the loader. Future webpack builds will attempt to read from the cache to avoid needing to run the potentially expensive Babel recompilation process on each run. If the value is blank (`loader: 'babel-loader?cacheDirectory'`) or `true` (`loader: babel-loader?cacheDirectory=true`) the loader will use the default cache directory in `node_modules/.cache/babel-loader` or fallback to the default OS temporary file directory if no `node_modules` folder could be found in any root directory.
+
+* `cacheIdentifier`: Default is a string composed by the babel-core's version, the babel-loader's version, the contents of .babelrc file if it exists and the value of the environment variable `BABEL_ENV` with a fallback to the `NODE_ENV` environment variable. This can be set to a custom value to force cache busting if the identifier changes.
+
+* `babelrc`: Default `true`. When `false`, no options from `.babelrc` files will be used; only the options passed to
+`babel-loader` will be used.
+
+__Note:__ The `sourceMap` option is ignored, instead sourceMaps are automatically enabled when webpack is configured to use them (via the `devtool` config option).
+
+## Troubleshooting
+
+### babel-loader is slow!
+
+Make sure you are transforming as few files as possible. Because you are probably
+matching `/\.js$/`, you might be transforming the `node_modules` folder or other unwanted
+source.
+
+To exclude `node_modules`, see the `exclude` option in the `loaders` config as documented above.
+
+You can also speed up babel-loader by as much as 2x by using the `cacheDirectory` option.
+This will cache transformations to the filesystem.
+
+### babel is injecting helpers into each file and bloating my code!
+
+babel uses very small helpers for common functions such as `_extend`. By default
+this will be added to every file that requires it.
+
+You can instead require the babel runtime as a separate module to avoid the duplication.
+
+The following configuration disables automatic per-file runtime injection in babel, instead
+requiring `babel-plugin-transform-runtime` and making all helper references use it.
+
+See the [docs](http://babeljs.io/docs/plugins/transform-runtime/) for more information.
+
+**NOTE:** You must run `npm install @babel/plugin-transform-runtime --save-dev` to include this in your project and `babel-runtime` itself as a dependency with `npm install @babel/runtime --save`.
+
+```javascript
+rules: [
+ // the 'transform-runtime' plugin tells babel to require the runtime
+ // instead of inlining it.
+ {
+ test: /\.js$/,
+ exclude: /(node_modules|bower_components)/,
+ use: {
+ loader: 'babel-loader',
+ options: {
+ presets: ['@babel/preset-env'],
+ plugins: ['@babel/plugin-transform-runtime']
+ }
+ }
+ }
+]
+```
+
+#### **NOTE:** transform-runtime & custom polyfills (e.g. Promise library)
+
+Since [babel-plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime) includes a polyfill that includes a custom [regenerator runtime](https://github.com/facebook/regenerator/blob/master/packages/regenerator-runtime/runtime.js) and [core.js](https://github.com/zloirock/core-js), the following usual shimming method using `webpack.ProvidePlugin` will not work:
+
+```javascript
+// ...
+ new webpack.ProvidePlugin({
+ 'Promise': 'bluebird'
+ }),
+// ...
+```
+
+The following approach will not work either:
+
+```javascript
+require('@babel/runtime/core-js/promise').default = require('bluebird');
+
+var promise = new Promise;
+```
+
+which outputs to (using `runtime`):
+
+```javascript
+'use strict';
+
+var _Promise = require('@babel/runtime/core-js/promise')['default'];
+
+require('@babel/runtime/core-js/promise')['default'] = require('bluebird');
+
+var promise = new _Promise();
+```
+
+The previous `Promise` library is referenced and used before it is overridden.
+
+One approach is to have a "bootstrap" step in your application that would first override the default globals before your application:
+
+```javascript
+// bootstrap.js
+
+require('@babel/runtime/core-js/promise').default = require('bluebird');
+
+// ...
+
+require('./app');
+```
+
+### The node API for `babel` has been moved to `babel-core`.
+
+If you receive this message it means that you have the npm package `babel` installed and use the short notation of the loader in the webpack config (which is not valid anymore as of webpack 2.x):
+```js
+ {
+ test: /\.js$/,
+ loader: 'babel',
+ }
+```
+
+Webpack then tries to load the `babel` package instead of the `babel-loader`.
+
+To fix this you should uninstall the npm package `babel` as it is deprecated in babel v6. (instead install `babel-cli` or `babel-core`)
+In the case one of your dependencies is installing `babel` and you cannot uninstall it yourself, use the complete name of the loader in the webpack config:
+```js
+ {
+ test: /\.js$/,
+ loader: 'babel-loader',
+ }
+```
+
+## Customized Loader
+
+`babel-loader` exposes a loader-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.
+
+### Example
+
+```js
+module.exports = require("babel-loader").custom(babel => {
+ function myPlugin() {
+ return {
+ visitor: {},
+ };
+ }
+
+ return {
+ // Passed the loader options.
+ customOptions({ opt1, opt2, ...loader }) {
+ return {
+ // Pull out any custom options that the loader might have.
+ custom: { opt1, opt2 },
+
+ // Pass the options back with the two custom options removed.
+ loader,
+ };
+ },
+
+ // Passed Babel's 'PartialConfig' object.
+ config(cfg) {
+ 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) {
+ return {
+ ...result,
+ code: result.code + "\n// Generated by some custom loader",
+ };
+ },
+ };
+});
+```
+
+### `customOptions(options: Object): { custom: Object, loader: Object }`
+
+Given the loader's options, split custom options out of `babel-loader`'s
+options.
+
+
+### `config(cfg: PartialConfig): Object`
+
+Given Babel's `PartialConfig` object, return the `options` object that should
+be passed to `babel.transform`.
+
+
+### `result(result: Result): Result`
+
+Given Babel's result object, allow loaders to make additional tweaks to it.
+
+
+## [License](http://couto.mit-license.org/)
diff --git a/node_modules/babel-loader/lib/Error.js b/node_modules/babel-loader/lib/Error.js
new file mode 100644
index 00000000..02b3fbc4
--- /dev/null
+++ b/node_modules/babel-loader/lib/Error.js
@@ -0,0 +1,36 @@
+"use strict";
+
+const STRIP_FILENAME_RE = /^[^:]+: /;
+
+const format = err => {
+ if (err instanceof SyntaxError) {
+ err.name = "SyntaxError";
+ err.message = err.message.replace(STRIP_FILENAME_RE, "");
+ err.hideStack = true;
+ } else if (err instanceof TypeError) {
+ err.name = null;
+ err.message = err.message.replace(STRIP_FILENAME_RE, "");
+ err.hideStack = true;
+ }
+
+ return err;
+};
+
+class LoaderError extends Error {
+ constructor(err) {
+ super();
+ const {
+ name,
+ message,
+ codeFrame,
+ hideStack
+ } = format(err);
+ this.name = "BabelLoaderError";
+ this.message = `${name ? `${name}: ` : ""}${message}\n\n${codeFrame}\n`;
+ this.hideStack = hideStack;
+ Error.captureStackTrace(this, this.constructor);
+ }
+
+}
+
+module.exports = LoaderError; \ No newline at end of file
diff --git a/node_modules/babel-loader/lib/cache.js b/node_modules/babel-loader/lib/cache.js
new file mode 100644
index 00000000..c86ae60b
--- /dev/null
+++ b/node_modules/babel-loader/lib/cache.js
@@ -0,0 +1,218 @@
+"use strict";
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; }
+
+/**
+ * Filesystem Cache
+ *
+ * Given a file and a transform function, cache the result into files
+ * or retrieve the previously cached files if the given file is already known.
+ *
+ * @see https://github.com/babel/babel-loader/issues/34
+ * @see https://github.com/babel/babel-loader/pull/41
+ */
+const fs = require("fs");
+
+const os = require("os");
+
+const path = require("path");
+
+const zlib = require("zlib");
+
+const crypto = require("crypto");
+
+const mkdirpOrig = require("mkdirp");
+
+const findCacheDir = require("find-cache-dir");
+
+const promisify = require("util.promisify");
+
+const transform = require("./transform"); // Lazily instantiated when needed
+
+
+let defaultCacheDirectory = null;
+const readFile = promisify(fs.readFile);
+const writeFile = promisify(fs.writeFile);
+const gunzip = promisify(zlib.gunzip);
+const gzip = promisify(zlib.gzip);
+const mkdirp = promisify(mkdirpOrig);
+/**
+ * Read the contents from the compressed file.
+ *
+ * @async
+ * @params {String} filename
+ */
+
+const read =
+/*#__PURE__*/
+function () {
+ var _ref = _asyncToGenerator(function* (filename) {
+ const data = yield readFile(filename);
+ const content = yield gunzip(data);
+ return JSON.parse(content);
+ });
+
+ return function read(_x) {
+ return _ref.apply(this, arguments);
+ };
+}();
+/**
+ * Write contents into a compressed file.
+ *
+ * @async
+ * @params {String} filename
+ * @params {String} result
+ */
+
+
+const write =
+/*#__PURE__*/
+function () {
+ var _ref2 = _asyncToGenerator(function* (filename, result) {
+ const content = JSON.stringify(result);
+ const data = yield gzip(content);
+ return yield writeFile(filename, data);
+ });
+
+ return function write(_x2, _x3) {
+ return _ref2.apply(this, arguments);
+ };
+}();
+/**
+ * Build the filename for the cached file
+ *
+ * @params {String} source File source code
+ * @params {Object} options Options used
+ *
+ * @return {String}
+ */
+
+
+const filename = function (source, identifier, options) {
+ const hash = crypto.createHash("SHA1");
+ const contents = JSON.stringify({
+ source,
+ options,
+ identifier
+ });
+ hash.end(contents);
+ return hash.read().toString("hex") + ".json.gz";
+};
+/**
+ * Handle the cache
+ *
+ * @params {String} directory
+ * @params {Object} params
+ */
+
+
+const handleCache =
+/*#__PURE__*/
+function () {
+ var _ref3 = _asyncToGenerator(function* (directory, params) {
+ const {
+ source,
+ options = {},
+ cacheIdentifier,
+ cacheDirectory
+ } = params;
+ const fallback = typeof cacheDirectory !== "string" && directory !== os.tmpdir(); // Make sure the directory exists.
+
+ try {
+ yield mkdirp(directory);
+ } catch (err) {
+ if (fallback) {
+ return handleCache(os.tmpdir(), params);
+ }
+
+ throw err;
+ }
+
+ const file = path.join(directory, filename(source, cacheIdentifier, options));
+
+ try {
+ // No errors mean that the file was previously cached
+ // we just need to return it
+ return yield read(file);
+ } catch (err) {} // Otherwise just transform the file
+ // return it to the user asap and write it in cache
+
+
+ const result = yield transform(source, options);
+
+ try {
+ yield write(file, result);
+ } catch (err) {
+ if (fallback) {
+ // Fallback to tmpdir if node_modules folder not writable
+ return handleCache(os.tmpdir(), params);
+ }
+
+ throw err;
+ }
+
+ return result;
+ });
+
+ return function handleCache(_x4, _x5) {
+ return _ref3.apply(this, arguments);
+ };
+}();
+/**
+ * Retrieve file from cache, or create a new one for future reads
+ *
+ * @async
+ * @param {Object} params
+ * @param {String} params.directory Directory to store cached files
+ * @param {String} params.identifier Unique identifier to bust cache
+ * @param {String} params.source Original contents of the file to be cached
+ * @param {Object} params.options Options to be given to the transform fn
+ * @param {Function} params.transform Function that will transform the
+ * original file and whose result will be
+ * cached
+ *
+ * @example
+ *
+ * cache({
+ * directory: '.tmp/cache',
+ * identifier: 'babel-loader-cachefile',
+ * source: *source code from file*,
+ * options: {
+ * experimental: true,
+ * runtime: true
+ * },
+ * transform: function(source, options) {
+ * var content = *do what you need with the source*
+ * return content;
+ * }
+ * }, function(err, result) {
+ *
+ * });
+ */
+
+
+module.exports =
+/*#__PURE__*/
+function () {
+ var _ref4 = _asyncToGenerator(function* (params) {
+ let directory;
+
+ if (typeof params.cacheDirectory === "string") {
+ directory = params.cacheDirectory;
+ } else {
+ if (defaultCacheDirectory === null) {
+ defaultCacheDirectory = findCacheDir({
+ name: "babel-loader"
+ }) || os.tmpdir();
+ }
+
+ directory = defaultCacheDirectory;
+ }
+
+ return yield handleCache(directory, params);
+ });
+
+ return function (_x6) {
+ return _ref4.apply(this, arguments);
+ };
+}(); \ No newline at end of file
diff --git a/node_modules/babel-loader/lib/index.js b/node_modules/babel-loader/lib/index.js
new file mode 100644
index 00000000..e4928e7a
--- /dev/null
+++ b/node_modules/babel-loader/lib/index.js
@@ -0,0 +1,149 @@
+"use strict";
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; }
+
+const babel = require("@babel/core");
+
+const pkg = require("../package.json");
+
+const cache = require("./cache");
+
+const transform = require("./transform");
+
+const relative = require("./utils/relative");
+
+const loaderUtils = require("loader-utils");
+
+function subscribe(subscriber, metadata, context) {
+ if (context[subscriber]) {
+ context[subscriber](metadata);
+ }
+}
+
+module.exports = makeLoader();
+module.exports.custom = makeLoader;
+
+function makeLoader(callback) {
+ const overrides = callback ? callback(babel) : undefined;
+ return function (source, inputSourceMap) {
+ // Make the loader async
+ const callback = this.async();
+ loader.call(this, source, inputSourceMap, overrides).then(args => callback(null, ...args), err => callback(err));
+ };
+}
+
+function loader(_x, _x2, _x3) {
+ return _loader.apply(this, arguments);
+}
+
+function _loader() {
+ _loader = _asyncToGenerator(function* (source, inputSourceMap, overrides) {
+ const filename = this.resourcePath;
+ let loaderOptions = loaderUtils.getOptions(this) || {};
+ let customOptions;
+
+ if (overrides && overrides.customOptions) {
+ const result = yield overrides.customOptions.call(this, loaderOptions);
+ customOptions = result.custom;
+ loaderOptions = result.loader;
+ } // Deprecation handling
+
+
+ if ("forceEnv" in loaderOptions) {
+ console.warn("The option `forceEnv` has been removed in favor of `envName` in Babel 7.");
+ }
+
+ if (typeof loaderOptions.babelrc === "string") {
+ console.warn("The option `babelrc` should not be set to a string anymore in the babel-loader config. " + "Please update your configuration and set `babelrc` to true or false.\n" + "If you want to specify a specific babel config file to inherit config from " + "please use the `extends` option.\nFor more information about this options see " + "https://babeljs.io/docs/core-packages/#options");
+ } // Set babel-loader's default options.
+
+
+ const {
+ sourceRoot = process.cwd(),
+ sourceMap = this.sourceMap,
+ sourceFileName = relative(sourceRoot, filename)
+ } = loaderOptions;
+ const programmaticOptions = Object.assign({}, loaderOptions, {
+ filename,
+ inputSourceMap: inputSourceMap || undefined,
+ sourceRoot,
+ sourceMap,
+ sourceFileName
+ }); // Remove loader related options
+
+ delete programmaticOptions.cacheDirectory;
+ delete programmaticOptions.cacheIdentifier;
+ delete programmaticOptions.metadataSubscribers;
+
+ if (!babel.loadPartialConfig) {
+ throw new Error(`babel-loader ^8.0.0-beta.3 requires @babel/core@7.0.0-beta.41, but ` + `you appear to be using "${babel.version}". Either update your ` + `@babel/core version, or pin you babel-loader version to 8.0.0-beta.2`);
+ }
+
+ const config = babel.loadPartialConfig(programmaticOptions);
+
+ if (config) {
+ let options = config.options;
+
+ if (overrides && overrides.config) {
+ options = yield overrides.config.call(this, config, {
+ source,
+ customOptions
+ });
+ }
+
+ const {
+ cacheDirectory = null,
+ cacheIdentifier = JSON.stringify({
+ options,
+ "@babel/core": transform.version,
+ "@babel/loader": pkg.version
+ }),
+ metadataSubscribers = []
+ } = loaderOptions;
+ let result;
+
+ if (cacheDirectory) {
+ result = yield cache({
+ source,
+ options,
+ transform,
+ cacheDirectory,
+ cacheIdentifier
+ });
+ } else {
+ result = yield transform(source, options);
+ } // TODO: Babel should really provide the full list of config files that
+ // were used so that this can also handle files loaded with 'extends'.
+
+
+ if (typeof config.babelrc === "string") {
+ this.addDependency(config.babelrc);
+ }
+
+ if (result) {
+ if (overrides && overrides.result) {
+ result = yield overrides.result.call(this, result, {
+ source,
+ customOptions,
+ config,
+ options
+ });
+ }
+
+ const {
+ code,
+ map,
+ metadata
+ } = result;
+ metadataSubscribers.forEach(subscriber => {
+ subscribe(subscriber, metadata, this);
+ });
+ return [code, map];
+ }
+ } // If the file was ignored, pass through the original content.
+
+
+ return [source, inputSourceMap];
+ });
+ return _loader.apply(this, arguments);
+} \ No newline at end of file
diff --git a/node_modules/babel-loader/lib/transform.js b/node_modules/babel-loader/lib/transform.js
new file mode 100644
index 00000000..bc5011e3
--- /dev/null
+++ b/node_modules/babel-loader/lib/transform.js
@@ -0,0 +1,48 @@
+"use strict";
+
+function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; }
+
+const babel = require("@babel/core");
+
+const promisify = require("util.promisify");
+
+const LoaderError = require("./Error");
+
+const transform = promisify(babel.transform);
+
+module.exports =
+/*#__PURE__*/
+function () {
+ var _ref = _asyncToGenerator(function* (source, options) {
+ let result;
+
+ try {
+ result = yield transform(source, options);
+ } catch (err) {
+ throw err.message && err.codeFrame ? new LoaderError(err) : err;
+ }
+
+ if (!result) return null;
+ const {
+ code,
+ map,
+ metadata
+ } = result;
+
+ if (map && (!map.sourcesContent || !map.sourcesContent.length)) {
+ map.sourcesContent = [source];
+ }
+
+ return {
+ code,
+ map,
+ metadata
+ };
+ });
+
+ return function (_x, _x2) {
+ return _ref.apply(this, arguments);
+ };
+}();
+
+module.exports.version = babel.version; \ No newline at end of file
diff --git a/node_modules/babel-loader/lib/utils/relative.js b/node_modules/babel-loader/lib/utils/relative.js
new file mode 100644
index 00000000..e9e9a5b1
--- /dev/null
+++ b/node_modules/babel-loader/lib/utils/relative.js
@@ -0,0 +1,15 @@
+"use strict";
+
+const path = require("path");
+
+module.exports = function relative(root, file) {
+ const rootPath = root.replace(/\\/g, "/").split("/")[1];
+ const filePath = file.replace(/\\/g, "/").split("/")[1]; // If the file is in a completely different root folder
+ // use the absolute path of the file
+
+ if (rootPath && rootPath !== filePath) {
+ return file;
+ }
+
+ return path.relative(root, file);
+}; \ No newline at end of file
diff --git a/node_modules/babel-loader/node_modules/.bin/mkdirp b/node_modules/babel-loader/node_modules/.bin/mkdirp
new file mode 120000
index 00000000..91a5f623
--- /dev/null
+++ b/node_modules/babel-loader/node_modules/.bin/mkdirp
@@ -0,0 +1 @@
+../../../mkdirp/bin/cmd.js \ No newline at end of file
diff --git a/node_modules/babel-loader/node_modules/.bin/webpack b/node_modules/babel-loader/node_modules/.bin/webpack
new file mode 120000
index 00000000..8a1900f6
--- /dev/null
+++ b/node_modules/babel-loader/node_modules/.bin/webpack
@@ -0,0 +1 @@
+../../../webpack/bin/webpack.js \ No newline at end of file
diff --git a/node_modules/babel-loader/package.json b/node_modules/babel-loader/package.json
new file mode 100644
index 00000000..4af637fd
--- /dev/null
+++ b/node_modules/babel-loader/package.json
@@ -0,0 +1,118 @@
+{
+ "name": "babel-loader",
+ "version": "8.0.0-beta.3",
+ "description": "babel module loader for webpack",
+ "files": [
+ "lib"
+ ],
+ "main": "lib/index.js",
+ "engines": {
+ "node": ">= 6.9"
+ },
+ "dependencies": {
+ "find-cache-dir": "^1.0.0",
+ "loader-utils": "^1.0.2",
+ "mkdirp": "^0.5.1",
+ "util.promisify": "^1.0.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0 || ^7.0.0-rc || ^7.0.0-beta.41",
+ "webpack": ">=2"
+ },
+ "devDependencies": {
+ "@babel/cli": "^7.0.0-beta.41",
+ "@babel/core": "^7.0.0-beta.41",
+ "@babel/preset-env": "^7.0.0-beta.41",
+ "ava": "0.25.0",
+ "babel-eslint": "^8.0.0",
+ "babel-plugin-istanbul": "^4.0.0",
+ "babel-plugin-react-intl": "^2.1.3",
+ "cross-env": "^5.0.0",
+ "eslint": "^4.1.0",
+ "eslint-config-babel": "^7.0.0",
+ "eslint-plugin-flowtype": "^2.25.0",
+ "eslint-plugin-prettier": "^2.1.2",
+ "husky": "^0.14.0",
+ "lint-staged": "^7.1.0",
+ "nyc": "^11.0.1",
+ "prettier": "^1.2.2",
+ "react": "^16.0.0",
+ "react-intl": "^2.1.2",
+ "react-intl-webpack-plugin": "^0.0.3",
+ "rimraf": "^2.4.3",
+ "webpack": "^4.0.0"
+ },
+ "scripts": {
+ "clean": "rimraf lib/",
+ "build": "babel src/ --out-dir lib/",
+ "format": "prettier --write --trailing-comma all 'src/**/*.js' 'test/**/*.test.js' 'test/helpers/*.js' && prettier --write --trailing-comma es5 'scripts/*.js'",
+ "lint": "eslint src test",
+ "precommit": "lint-staged",
+ "prepublish": "yarn run clean && yarn run build",
+ "preversion": "yarn run test",
+ "test": "yarn run lint && cross-env BABEL_ENV=test yarn run build && yarn run test-only",
+ "test-only": "nyc ava"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/babel/babel-loader.git"
+ },
+ "keywords": [
+ "webpack",
+ "loader",
+ "babel",
+ "es6",
+ "transpiler",
+ "module"
+ ],
+ "author": "Luis Couto <hello@luiscouto.pt>",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/babel/babel-loader/issues"
+ },
+ "homepage": "https://github.com/babel/babel-loader",
+ "nyc": {
+ "all": true,
+ "include": [
+ "src/**/*.js"
+ ],
+ "reporter": [
+ "text",
+ "json"
+ ],
+ "sourceMap": false,
+ "instrument": false
+ },
+ "ava": {
+ "files": [
+ "test/**/*.test.js",
+ "!test/fixtures/**/*",
+ "!test/helpers/**/*"
+ ],
+ "source": [
+ "src/**/*.js"
+ ]
+ },
+ "lint-staged": {
+ "scripts/*.js": [
+ "prettier --trailing-comma es5 --write",
+ "git add"
+ ],
+ "src/**/*.js": [
+ "prettier --trailing-comma all --write",
+ "git add"
+ ],
+ "test/**/*.test.js": [
+ "prettier --trailing-comma all --write",
+ "git add"
+ ],
+ "test/helpers/*.js": [
+ "prettier --trailing-comma all --write",
+ "git add"
+ ],
+ "package.json": [
+ "node ./scripts/yarn-install.js",
+ "git add yarn.lock"
+ ]
+ }
+}