mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-02 14:12:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
169
web/node_modules/babel-loader/CHANGELOG.md
generated
vendored
Normal file
169
web/node_modules/babel-loader/CHANGELOG.md
generated
vendored
Normal file
|
@ -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
|
22
web/node_modules/babel-loader/LICENSE
generated
vendored
Normal file
22
web/node_modules/babel-loader/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2014-2019 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.
|
323
web/node_modules/babel-loader/README.md
generated
vendored
Normal file
323
web/node_modules/babel-loader/README.md
generated
vendored
Normal file
|
@ -0,0 +1,323 @@
|
|||
> 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
|
||||
|
||||
[](https://www.npmjs.com/package/babel-loader)
|
||||
[](https://travis-ci.org/babel/babel-loader)
|
||||
[](https://ci.appveyor.com/project/babel/babel-loader/branch/master)
|
||||
[](https://codecov.io/gh/babel/babel-loader)
|
||||
|
||||
<div align="center">
|
||||
<a href="https://github.com/babel/babel">
|
||||
<img src="https://rawgit.com/babel/logo/master/babel.svg" alt="Babel logo" width="200" height="200">
|
||||
</a>
|
||||
<a href="https://github.com/webpack/webpack">
|
||||
<img src="https://webpack.js.org/assets/icon-square-big.svg" alt="webpack logo" width="200" height="200">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<h1 align="center">Babel Loader</h1>
|
||||
|
||||
This package allows transpiling JavaScript files using [Babel](https://github.com/babel/babel) and [webpack](https://github.com/webpack/webpack).
|
||||
|
||||
**Note**: Issues with the output should be reported on the Babel [Issues](https://github.com/babel/babel/issues) tracker.
|
||||
|
||||
<h2 align="center">Install</h2>
|
||||
|
||||
> webpack 4.x | babel-loader 8.x | babel 7.x
|
||||
|
||||
```bash
|
||||
npm install -D babel-loader @babel/core @babel/preset-env webpack
|
||||
```
|
||||
|
||||
<h2 align="center">Usage</h2>
|
||||
|
||||
webpack documentation: [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: /\.m?js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env']
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
See the `babel` [options](https://babeljs.io/docs/en/options).
|
||||
|
||||
You can pass options to the loader by using the [`options`](https://webpack.js.org/configuration/module/#rule-options-rule-query) property:
|
||||
|
||||
```javascript
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
plugins: ['@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 set to `true` in options (`{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.
|
||||
|
||||
* `cacheCompression`: Default `true`. When set, each Babel transform output will be compressed with Gzip. If you want to opt-out of cache compression, set it to `false` -- your project may benefit from this if it transpiles thousands of files.
|
||||
|
||||
* `customize`: Default `null`. The path of a module that exports a `custom` callback [like the one that you'd pass to `.custom()`](#customized-loader). Since you already have to make a new file to use this, it is recommended that you instead use `.custom` to create a wrapper loader. Only use this if you _must_ continue using `babel-loader` directly, but still want to customize.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### babel-loader is slow!
|
||||
|
||||
Make sure you are transforming as few files as possible. Because you are probably matching `/\.m?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, requiring `@babel/plugin-transform-runtime` instead and making all helper references use it.
|
||||
|
||||
See the [docs](https://babeljs.io/docs/plugins/transform-runtime/) for more information.
|
||||
|
||||
**NOTE**: You must run `npm install -D @babel/plugin-transform-runtime` to include this in your project and `@babel/runtime` itself as a dependency with `npm install @babel/runtime`.
|
||||
|
||||
```javascript
|
||||
rules: [
|
||||
// the 'transform-runtime' plugin tells Babel to
|
||||
// require the runtime instead of inlining it.
|
||||
{
|
||||
test: /\.m?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.js 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 are using the short notation of the loader in the webpack config (which is not valid anymore as of webpack 2.x):
|
||||
```javascript
|
||||
{
|
||||
test: /\.m?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:
|
||||
```javascript
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
loader: 'babel-loader',
|
||||
}
|
||||
```
|
||||
|
||||
## Customize config based on webpack target
|
||||
|
||||
Webpack supports bundling multiple [targets](https://webpack.js.org/concepts/targets/). For cases where you may want different Babel configurations for each target (like `web` _and_ `node`), this loader provides a `target` property via Babel's [caller](https://babeljs.io/docs/en/config-files#apicallercb) API.
|
||||
|
||||
For example, to change the environment targets passed to `@babel/preset-env` based on the webpack target:
|
||||
|
||||
```javascript
|
||||
// babel.config.js
|
||||
|
||||
module.exports = api => {
|
||||
return {
|
||||
plugins: [
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
"@babel/plugin-proposal-optional-chaining"
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: "entry",
|
||||
// caller.target will be the same as the target option from webpack
|
||||
targets: api.caller(caller => caller && caller.target === "node")
|
||||
? { node: "current" }
|
||||
: { chrome: "58", ie: "11" }
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
In cases where you want to customize without actually having a file to call `.custom`, you
|
||||
may also pass the `customize` option with a string pointing at a file that exports
|
||||
your `custom` callback function.
|
||||
|
||||
### Example
|
||||
|
||||
```js
|
||||
// Export from "./my-custom-loader.js" or whatever you want.
|
||||
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",
|
||||
};
|
||||
},
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
```js
|
||||
// And in your Webpack config
|
||||
module.exports = {
|
||||
// ..
|
||||
module: {
|
||||
rules: [{
|
||||
// ...
|
||||
loader: path.join(__dirname, 'my-custom-loader.js'),
|
||||
// ...
|
||||
}]
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### `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
|
||||
[MIT](https://couto.mit-license.org/)
|
36
web/node_modules/babel-loader/lib/Error.js
generated
vendored
Normal file
36
web/node_modules/babel-loader/lib/Error.js
generated
vendored
Normal file
|
@ -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;
|
222
web/node_modules/babel-loader/lib/cache.js
generated
vendored
Normal file
222
web/node_modules/babel-loader/lib/cache.js
generated
vendored
Normal file
|
@ -0,0 +1,222 @@
|
|||
"use strict";
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, 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 _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
/**
|
||||
* 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("pify");
|
||||
|
||||
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, compress) {
|
||||
const data = yield readFile(filename + (compress ? ".gz" : ""));
|
||||
const content = compress ? yield gunzip(data) : data;
|
||||
return JSON.parse(content.toString());
|
||||
});
|
||||
|
||||
return function read(_x, _x2) {
|
||||
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, compress, result) {
|
||||
const content = JSON.stringify(result);
|
||||
const data = compress ? yield gzip(content) : content;
|
||||
return yield writeFile(filename + (compress ? ".gz" : ""), data);
|
||||
});
|
||||
|
||||
return function write(_x3, _x4, _x5) {
|
||||
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("md4");
|
||||
const contents = JSON.stringify({
|
||||
source,
|
||||
options,
|
||||
identifier
|
||||
});
|
||||
hash.update(contents);
|
||||
return hash.digest("hex") + ".json";
|
||||
};
|
||||
/**
|
||||
* Handle the cache
|
||||
*
|
||||
* @params {String} directory
|
||||
* @params {Object} params
|
||||
*/
|
||||
|
||||
|
||||
const handleCache =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
var _ref3 = _asyncToGenerator(function* (directory, params) {
|
||||
const {
|
||||
source,
|
||||
options = {},
|
||||
cacheIdentifier,
|
||||
cacheDirectory,
|
||||
cacheCompression
|
||||
} = params;
|
||||
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, cacheCompression);
|
||||
} catch (err) {}
|
||||
|
||||
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;
|
||||
} // 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, cacheCompression, 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(_x6, _x7) {
|
||||
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',
|
||||
* cacheCompression: false,
|
||||
* 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 (_x8) {
|
||||
return _ref4.apply(this, arguments);
|
||||
};
|
||||
}();
|
232
web/node_modules/babel-loader/lib/index.js
generated
vendored
Normal file
232
web/node_modules/babel-loader/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,232 @@
|
|||
"use strict";
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, 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 _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
let babel;
|
||||
|
||||
try {
|
||||
babel = require("@babel/core");
|
||||
} catch (err) {
|
||||
if (err.code === "MODULE_NOT_FOUND") {
|
||||
err.message += "\n babel-loader@8 requires Babel 7.x (the package '@babel/core'). " + "If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.";
|
||||
}
|
||||
|
||||
throw err;
|
||||
} // Since we've got the reverse bridge package at @babel/core@6.x, give
|
||||
// people useful feedback if they try to use it alongside babel-loader.
|
||||
|
||||
|
||||
if (/^6\./.test(babel.version)) {
|
||||
throw new Error("\n babel-loader@8 will not work with the '@babel/core@6' bridge package. " + "If you want to use Babel 6.x, install 'babel-loader@7'.");
|
||||
}
|
||||
|
||||
const {
|
||||
version
|
||||
} = require("../package.json");
|
||||
|
||||
const cache = require("./cache");
|
||||
|
||||
const transform = require("./transform");
|
||||
|
||||
const injectCaller = require("./injectCaller");
|
||||
|
||||
const schema = require("./schema");
|
||||
|
||||
const {
|
||||
isAbsolute
|
||||
} = require("path");
|
||||
|
||||
const loaderUtils = require("loader-utils");
|
||||
|
||||
const validateOptions = require("schema-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) || {};
|
||||
validateOptions(schema, loaderOptions, {
|
||||
name: "Babel loader"
|
||||
});
|
||||
|
||||
if (loaderOptions.customize != null) {
|
||||
if (typeof loaderOptions.customize !== "string") {
|
||||
throw new Error("Customized loaders must be implemented as standalone modules.");
|
||||
}
|
||||
|
||||
if (!isAbsolute(loaderOptions.customize)) {
|
||||
throw new Error("Customized loaders must be passed as absolute paths, since " + "babel-loader has no way to know what they would be relative to.");
|
||||
}
|
||||
|
||||
if (overrides) {
|
||||
throw new Error("babel-loader's 'customize' option is not available when already " + "using a customized babel-loader wrapper.");
|
||||
}
|
||||
|
||||
let override = require(loaderOptions.customize);
|
||||
|
||||
if (override.__esModule) override = override.default;
|
||||
|
||||
if (typeof override !== "function") {
|
||||
throw new Error("Custom overrides must be functions.");
|
||||
}
|
||||
|
||||
overrides = override(babel);
|
||||
}
|
||||
|
||||
let customOptions;
|
||||
|
||||
if (overrides && overrides.customOptions) {
|
||||
const result = yield overrides.customOptions.call(this, loaderOptions, {
|
||||
source,
|
||||
map: inputSourceMap
|
||||
});
|
||||
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");
|
||||
} // Standardize on 'sourceMaps' as the key passed through to Webpack, so that
|
||||
// users may safely use either one alongside our default use of
|
||||
// 'this.sourceMap' below without getting error about conflicting aliases.
|
||||
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMap") && !Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMaps")) {
|
||||
loaderOptions = Object.assign({}, loaderOptions, {
|
||||
sourceMaps: loaderOptions.sourceMap
|
||||
});
|
||||
delete loaderOptions.sourceMap;
|
||||
}
|
||||
|
||||
const programmaticOptions = Object.assign({}, loaderOptions, {
|
||||
filename,
|
||||
inputSourceMap: inputSourceMap || undefined,
|
||||
// Set the default sourcemap behavior based on Webpack's mapping flag,
|
||||
// but allow users to override if they want.
|
||||
sourceMaps: loaderOptions.sourceMaps === undefined ? this.sourceMap : loaderOptions.sourceMaps,
|
||||
// Ensure that Webpack will get a full absolute path in the sourcemap
|
||||
// so that it can properly map the module back to its internal cached
|
||||
// modules.
|
||||
sourceFileName: filename
|
||||
}); // Remove loader related options
|
||||
|
||||
delete programmaticOptions.customize;
|
||||
delete programmaticOptions.cacheDirectory;
|
||||
delete programmaticOptions.cacheIdentifier;
|
||||
delete programmaticOptions.cacheCompression;
|
||||
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(injectCaller(programmaticOptions, this.target));
|
||||
|
||||
if (config) {
|
||||
let options = config.options;
|
||||
|
||||
if (overrides && overrides.config) {
|
||||
options = yield overrides.config.call(this, config, {
|
||||
source,
|
||||
map: inputSourceMap,
|
||||
customOptions
|
||||
});
|
||||
}
|
||||
|
||||
if (options.sourceMaps === "inline") {
|
||||
// Babel has this weird behavior where if you set "inline", we
|
||||
// inline the sourcemap, and set 'result.map = null'. This results
|
||||
// in bad behavior from Babel since the maps get put into the code,
|
||||
// which Webpack does not expect, and because the map we return to
|
||||
// Webpack is null, which is also bad. To avoid that, we override the
|
||||
// behavior here so "inline" just behaves like 'true'.
|
||||
options.sourceMaps = true;
|
||||
}
|
||||
|
||||
const {
|
||||
cacheDirectory = null,
|
||||
cacheIdentifier = JSON.stringify({
|
||||
options,
|
||||
"@babel/core": transform.version,
|
||||
"@babel/loader": version
|
||||
}),
|
||||
cacheCompression = true,
|
||||
metadataSubscribers = []
|
||||
} = loaderOptions;
|
||||
let result;
|
||||
|
||||
if (cacheDirectory) {
|
||||
result = yield cache({
|
||||
source,
|
||||
options,
|
||||
transform,
|
||||
cacheDirectory,
|
||||
cacheIdentifier,
|
||||
cacheCompression
|
||||
});
|
||||
} 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,
|
||||
map: inputSourceMap,
|
||||
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);
|
||||
}
|
46
web/node_modules/babel-loader/lib/injectCaller.js
generated
vendored
Normal file
46
web/node_modules/babel-loader/lib/injectCaller.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
|
||||
const babel = require("@babel/core");
|
||||
|
||||
module.exports = function injectCaller(opts, target) {
|
||||
if (!supportsCallerOption()) return opts;
|
||||
return Object.assign({}, opts, {
|
||||
caller: Object.assign({
|
||||
name: "babel-loader",
|
||||
// Provide plugins with insight into webpack target.
|
||||
// https://github.com/babel/babel-loader/issues/787
|
||||
target,
|
||||
// Webpack >= 2 supports ESM and dynamic import.
|
||||
supportsStaticESM: true,
|
||||
supportsDynamicImport: true,
|
||||
// Webpack 5 supports TLA behind a flag. We enable it by default
|
||||
// for Babel, and then webpack will throw an error if the experimental
|
||||
// flag isn't enabled.
|
||||
supportsTopLevelAwait: true
|
||||
}, opts.caller)
|
||||
});
|
||||
}; // TODO: We can remove this eventually, I'm just adding it so that people have
|
||||
// a little time to migrate to the newer RCs of @babel/core without getting
|
||||
// hard-to-diagnose errors about unknown 'caller' options.
|
||||
|
||||
|
||||
let supportsCallerOptionFlag = undefined;
|
||||
|
||||
function supportsCallerOption() {
|
||||
if (supportsCallerOptionFlag === undefined) {
|
||||
try {
|
||||
// Rather than try to match the Babel version, we just see if it throws
|
||||
// when passed a 'caller' flag, and use that to decide if it is supported.
|
||||
babel.loadPartialConfig({
|
||||
caller: undefined,
|
||||
babelrc: false,
|
||||
configFile: false
|
||||
});
|
||||
supportsCallerOptionFlag = true;
|
||||
} catch (err) {
|
||||
supportsCallerOptionFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
return supportsCallerOptionFlag;
|
||||
}
|
28
web/node_modules/babel-loader/lib/schema.json
generated
vendored
Normal file
28
web/node_modules/babel-loader/lib/schema.json
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cacheDirectory": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"default": false
|
||||
},
|
||||
"cacheIdentifier": {
|
||||
"type": "string"
|
||||
},
|
||||
"cacheCompression": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"customize": {
|
||||
"type": "string",
|
||||
"default": null
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
59
web/node_modules/babel-loader/lib/transform.js
generated
vendored
Normal file
59
web/node_modules/babel-loader/lib/transform.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, 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 _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
const babel = require("@babel/core");
|
||||
|
||||
const promisify = require("pify");
|
||||
|
||||
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; // We don't return the full result here because some entries are not
|
||||
// really serializable. For a full list of properties see here:
|
||||
// https://github.com/babel/babel/blob/master/packages/babel-core/src/transformation/index.js
|
||||
// For discussion on this topic see here:
|
||||
// https://github.com/babel/babel-loader/pull/629
|
||||
|
||||
const {
|
||||
ast,
|
||||
code,
|
||||
map,
|
||||
metadata,
|
||||
sourceType
|
||||
} = result;
|
||||
|
||||
if (map && (!map.sourcesContent || !map.sourcesContent.length)) {
|
||||
map.sourcesContent = [source];
|
||||
}
|
||||
|
||||
return {
|
||||
ast,
|
||||
code,
|
||||
map,
|
||||
metadata,
|
||||
sourceType
|
||||
};
|
||||
});
|
||||
|
||||
return function (_x, _x2) {
|
||||
return _ref.apply(this, arguments);
|
||||
};
|
||||
}();
|
||||
|
||||
module.exports.version = babel.version;
|
1
web/node_modules/babel-loader/node_modules/.bin/json5
generated
vendored
Symbolic link
1
web/node_modules/babel-loader/node_modules/.bin/json5
generated
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
../json5/lib/cli.js
|
274
web/node_modules/babel-loader/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
274
web/node_modules/babel-loader/node_modules/json5/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,274 @@
|
|||
### v1.0.1 [[code][c1.0.1], [diff][d1.0.1]]
|
||||
|
||||
[c1.0.1]: https://github.com/json5/json5/tree/v1.0.1
|
||||
[d1.0.1]: https://github.com/json5/json5/compare/v1.0.0...v1.0.1
|
||||
|
||||
This release includes a bug fix and minor change.
|
||||
|
||||
- Fix: `parse` throws on unclosed objects and arrays.
|
||||
|
||||
- New: `package.json5` has been removed until an easier way to keep it in sync
|
||||
with `package.json` is found.
|
||||
|
||||
|
||||
### v1.0.0 [[code][c1.0.0], [diff][d1.0.0]]
|
||||
|
||||
[c1.0.0]: https://github.com/json5/json5/tree/v1.0.0
|
||||
[d1.0.0]: https://github.com/json5/json5/compare/v0.5.1...v1.0.0
|
||||
|
||||
This release includes major internal changes and public API enhancements.
|
||||
|
||||
- **Major** JSON5 officially supports Node.js v4 and later. Support for Node.js
|
||||
v0.10 and v0.12 have been dropped.
|
||||
|
||||
- New: Unicode property names and Unicode escapes in property names are
|
||||
supported. ([#1])
|
||||
|
||||
- New: `stringify` outputs trailing commas in objects and arrays when a `space`
|
||||
option is provided. ([#66])
|
||||
|
||||
- New: JSON5 allows line and paragraph separator characters (U+2028 and U+2029)
|
||||
in strings in order to be compatible with JSON. However, ES5 does not allow
|
||||
these characters in strings, so JSON5 gives a warning when they are parsed and
|
||||
escapes them when they are stringified. ([#70])
|
||||
|
||||
- New: `stringify` accepts an options object as its second argument. The
|
||||
supported options are `replacer`, `space`, and a new `quote` option that
|
||||
specifies the quote character used in strings. ([#71])
|
||||
|
||||
- New: The CLI supports STDIN and STDOUT and adds `--out-file`, `--space`, and
|
||||
`--validate` options. See `json5 --help` for more information. ([#72], [#84],
|
||||
and [#108])
|
||||
|
||||
- New: In addition to the white space characters space `\t`, `\v`, `\f`, `\n`,
|
||||
`\r`, and `\xA0`, the additional white space characters `\u2028`, `\u2029`,
|
||||
and all other characters in the Space Separator Unicode category are allowed.
|
||||
|
||||
- New: In addition to the character escapes `\'`, `\"`, `\\`, `\b`, `\f`, `\n`,
|
||||
`\r`, and `\t`, the additional character escapes `\v` and `\0`, hexadecimal
|
||||
escapes like `\x0F`, and unnecessary escapes like `\a` are allowed in string
|
||||
values and string property names.
|
||||
|
||||
- New: `stringify` outputs strings with single quotes by default but
|
||||
intelligently uses double quotes if there are more single quotes than double
|
||||
quotes inside the string. (i.e. `stringify('Stay here.')` outputs
|
||||
`'Stay here.'` while `stringify('Let\'s go.')` outputs `"Let's go."`)
|
||||
|
||||
- New: When a character is not allowed in a string, `stringify` outputs a
|
||||
character escape like `\t` when available, a hexadecimal escape like `\x0F`
|
||||
when the Unicode code point is less than 256, or a Unicode character escape
|
||||
like `\u01FF`, in that order.
|
||||
|
||||
- New: `stringify` checks for a `toJSON5` method on objects and, if it exists,
|
||||
stringifies its return value instead of the object. `toJSON5` overrides
|
||||
`toJSON` if they both exist.
|
||||
|
||||
- New: To `require` or `import` JSON5 files, use `require('json5/lib/register')`
|
||||
or `import 'json5/lib/register'`. Previous versions used `json5/lib/require`,
|
||||
which still exists for backward compatibility but is deprecated and will give
|
||||
a warning.
|
||||
|
||||
- New: To use JSON5 in browsers, use the file at `dist/index.js` or
|
||||
`https://unpkg.com/json5@^1.0.0`.
|
||||
|
||||
- Fix: `stringify` properly outputs `Infinity` and `NaN`. ([#67])
|
||||
|
||||
- Fix: `isWord` no longer becomes a property of `JSON5` after calling
|
||||
`stringify`. ([#68] and [#89])
|
||||
|
||||
- Fix: `stringify` no longer throws when an object does not have a `prototype`.
|
||||
([#154])
|
||||
|
||||
- Fix: `stringify` properly handles the `key` argument of `toJSON(key)` methods.
|
||||
`toJSON5(key)` follows this pattern.
|
||||
|
||||
- Fix: `stringify` accepts `Number` and `String` objects as its `space`
|
||||
argument.
|
||||
|
||||
- Fix: In addition to a function, `stringify` also accepts an array of keys to
|
||||
include in the output as its `replacer` argument. Numbers, `Number` objects,
|
||||
and `String` objects will be converted to a string if they are given as array
|
||||
values.
|
||||
|
||||
|
||||
### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]]
|
||||
|
||||
[c0.5.1]: https://github.com/json5/json5/tree/v0.5.1
|
||||
[d0.5.1]: https://github.com/json5/json5/compare/v0.5.0...v0.5.1
|
||||
|
||||
This release includes a minor fix for indentations when stringifying empty
|
||||
arrays.
|
||||
|
||||
- Fix: Indents no longer appear in empty arrays when stringified. ([#134])
|
||||
|
||||
|
||||
### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]]
|
||||
|
||||
[c0.5.0]: https://github.com/json5/json5/tree/v0.5.0
|
||||
[d0.5.0]: https://github.com/json5/json5/compare/v0.4.0...v0.5.0
|
||||
|
||||
This release includes major internal changes and public API enhancements.
|
||||
|
||||
- **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for
|
||||
Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12
|
||||
remain.
|
||||
|
||||
- Fix: YUI Compressor no longer fails when compressing json5.js. ([#97])
|
||||
|
||||
- New: `parse` and the CLI provide line and column numbers when displaying error
|
||||
messages. ([#101]; awesome work by [@amb26].)
|
||||
|
||||
|
||||
### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]]
|
||||
|
||||
[c0.4.0]: https://github.com/json5/json5/tree/v0.4.0
|
||||
[d0.4.0]: https://github.com/json5/json5/compare/v0.2.0...v0.4.0
|
||||
|
||||
Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0
|
||||
changelog entry includes v0.3.0 features.
|
||||
|
||||
This is a massive release that adds `stringify` support, among other things.
|
||||
|
||||
- **Major:** `JSON5.stringify()` now exists!
|
||||
This method is analogous to the native `JSON.stringify()`;
|
||||
it just avoids quoting keys where possible.
|
||||
See the [usage documentation](./README.md#usage) for more.
|
||||
([#32]; huge thanks and props [@aeisenberg]!)
|
||||
|
||||
- New: `NaN` and `-NaN` are now allowed number literals.
|
||||
([#30]; thanks [@rowanhill].)
|
||||
|
||||
- New: Duplicate object keys are now allowed; the last value is used.
|
||||
This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].)
|
||||
|
||||
- Fix: Properly handle various whitespace and newline cases now.
|
||||
E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings,
|
||||
and JSON5 now accepts the same whitespace as JSON (stricter than ES5).
|
||||
([#58], [#60], and [#63]; thanks [@jordanbtucker].)
|
||||
|
||||
- New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again.
|
||||
(They were disallowed in v0.2.0; see below.)
|
||||
It turns out they *are* valid in ES5, so JSON5 supports them now too.
|
||||
([#36]; thanks [@jordanbtucker]!)
|
||||
|
||||
|
||||
### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]]
|
||||
|
||||
[c0.2.0]: https://github.com/json5/json5/tree/v0.2.0
|
||||
[d0.2.0]: https://github.com/json5/json5/compare/v0.1.0...v0.2.0
|
||||
|
||||
This release fixes some bugs and adds some more utility features to help you
|
||||
express data more easily:
|
||||
|
||||
- **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now.
|
||||
While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid
|
||||
in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome
|
||||
and Node), so JSON5 officially rejects them now, too. ([#36])
|
||||
|
||||
- New: Trailing decimal points in decimal numbers are allowed again.
|
||||
(They were disallowed in v0.1.0; see below.)
|
||||
They're allowed by ES5, and differentiating between integers and floats may
|
||||
make sense on some platforms. ([#16]; thanks [@Midar].)
|
||||
|
||||
- New: `Infinity` and `-Infinity` are now allowed number literals.
|
||||
([#30]; thanks [@pepkin88].)
|
||||
|
||||
- New: Plus signs (`+`) in front of numbers are now allowed, since it can
|
||||
be helpful in some contexts to explicitly mark numbers as positive.
|
||||
(E.g. when a property represents changes or deltas.)
|
||||
|
||||
- Fix: unescaped newlines in strings are rejected now.
|
||||
([#24]; thanks [@Midar].)
|
||||
|
||||
|
||||
### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]]
|
||||
|
||||
[c0.1.0]: https://github.com/json5/json5/tree/v0.1.0
|
||||
[d0.1.0]: https://github.com/json5/json5/compare/v0.0.1...v0.1.0
|
||||
|
||||
This release tightens JSON5 support and adds helpful utility features:
|
||||
|
||||
- New: Support hexadecimal numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- Fix: Reject octal numbers properly now. Previously, they were accepted but
|
||||
improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a
|
||||
leading zero). These are disallowed by both JSON5 and JSON, as well as by
|
||||
ES5's strict mode. (Thanks [@MaxNanasy].)
|
||||
|
||||
- New: Support leading decimal points in decimal numbers.
|
||||
(Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject trailing decimal points in decimal numbers now. These
|
||||
are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].)
|
||||
|
||||
- **Breaking:** Reject omitted elements in arrays now. These are disallowed by
|
||||
both JSON5 and JSON.
|
||||
|
||||
- Fix: Throw proper `SyntaxError` instances on errors now.
|
||||
|
||||
- New: Add Node.js `require()` hook. Register via `json5/lib/require`.
|
||||
|
||||
- New: Add Node.js `json5` executable to compile JSON5 files to JSON.
|
||||
|
||||
|
||||
### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]]
|
||||
|
||||
[c0.0.1]: https://github.com/json5/json5/tree/v0.0.1
|
||||
[d0.0.1]: https://github.com/json5/json5/compare/v0.0.0...v0.0.1
|
||||
|
||||
This was the first implementation of this JSON5 parser.
|
||||
|
||||
- Support unquoted object keys, including reserved words. Unicode characters
|
||||
and escape sequences sequences aren't yet supported.
|
||||
|
||||
- Support single-quoted strings.
|
||||
|
||||
- Support multi-line strings.
|
||||
|
||||
- Support trailing commas in arrays and objects.
|
||||
|
||||
- Support comments, both inline and block.
|
||||
|
||||
|
||||
### v0.0.0 [[code](https://github.com/json5/json5/tree/v0.0.0)]
|
||||
|
||||
Let's consider this to be Douglas Crockford's original [json_parse.js] — a
|
||||
parser for the regular JSON format.
|
||||
|
||||
|
||||
[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
[v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240
|
||||
|
||||
[@MaxNanasy]: https://github.com/MaxNanasy
|
||||
[@Midar]: https://github.com/Midar
|
||||
[@pepkin88]: https://github.com/pepkin88
|
||||
[@rowanhill]: https://github.com/rowanhill
|
||||
[@aeisenberg]: https://github.com/aeisenberg
|
||||
[@jordanbtucker]: https://github.com/jordanbtucker
|
||||
[@amb26]: https://github.com/amb26
|
||||
|
||||
[#1]: https://github.com/json5/json5/issues/1
|
||||
[#16]: https://github.com/json5/json5/issues/16
|
||||
[#24]: https://github.com/json5/json5/issues/24
|
||||
[#30]: https://github.com/json5/json5/issues/30
|
||||
[#32]: https://github.com/json5/json5/issues/32
|
||||
[#36]: https://github.com/json5/json5/issues/36
|
||||
[#57]: https://github.com/json5/json5/issues/57
|
||||
[#58]: https://github.com/json5/json5/pull/58
|
||||
[#60]: https://github.com/json5/json5/pull/60
|
||||
[#63]: https://github.com/json5/json5/pull/63
|
||||
[#66]: https://github.com/json5/json5/issues/66
|
||||
[#67]: https://github.com/json5/json5/issues/67
|
||||
[#68]: https://github.com/json5/json5/issues/68
|
||||
[#70]: https://github.com/json5/json5/issues/70
|
||||
[#71]: https://github.com/json5/json5/issues/71
|
||||
[#72]: https://github.com/json5/json5/issues/72
|
||||
[#84]: https://github.com/json5/json5/pull/84
|
||||
[#89]: https://github.com/json5/json5/pull/89
|
||||
[#97]: https://github.com/json5/json5/pull/97
|
||||
[#101]: https://github.com/json5/json5/pull/101
|
||||
[#108]: https://github.com/json5/json5/pull/108
|
||||
[#134]: https://github.com/json5/json5/pull/134
|
||||
[#154]: https://github.com/json5/json5/issues/154
|
23
web/node_modules/babel-loader/node_modules/json5/LICENSE.md
generated
vendored
Normal file
23
web/node_modules/babel-loader/node_modules/json5/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2012-2018 Aseem Kishore, and [others].
|
||||
|
||||
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.
|
||||
|
||||
[others]: https://github.com/json5/json5/contributors
|
234
web/node_modules/babel-loader/node_modules/json5/README.md
generated
vendored
Normal file
234
web/node_modules/babel-loader/node_modules/json5/README.md
generated
vendored
Normal file
|
@ -0,0 +1,234 @@
|
|||
# JSON5 – JSON for Humans
|
||||
|
||||
[][Build Status]
|
||||
[][Coverage
|
||||
Status]
|
||||
|
||||
The JSON5 Data Interchange Format (JSON5) is a superset of [JSON] that aims to
|
||||
alleviate some of the limitations of JSON by expanding its syntax to include
|
||||
some productions from [ECMAScript 5.1].
|
||||
|
||||
This JavaScript library is the official reference implementation for JSON5
|
||||
parsing and serialization libraries.
|
||||
|
||||
[Build Status]: https://travis-ci.org/json5/json5
|
||||
|
||||
[Coverage Status]: https://coveralls.io/github/json5/json5
|
||||
|
||||
[JSON]: https://tools.ietf.org/html/rfc7159
|
||||
|
||||
[ECMAScript 5.1]: https://www.ecma-international.org/ecma-262/5.1/
|
||||
|
||||
## Summary of Features
|
||||
The following ECMAScript 5.1 features, which are not supported in JSON, have
|
||||
been extended to JSON5.
|
||||
|
||||
### Objects
|
||||
- Object keys may be an ECMAScript 5.1 _[IdentifierName]_.
|
||||
- Objects may have a single trailing comma.
|
||||
|
||||
### Arrays
|
||||
- Arrays may have a single trailing comma.
|
||||
|
||||
### Strings
|
||||
- Strings may be single quoted.
|
||||
- Strings may span multiple lines by escaping new line characters.
|
||||
- Strings may include character escapes.
|
||||
|
||||
### Numbers
|
||||
- Numbers may be hexadecimal.
|
||||
- Numbers may have a leading or trailing decimal point.
|
||||
- Numbers may be [IEEE 754] positive infinity, negative infinity, and NaN.
|
||||
- Numbers may begin with an explicit plus sign.
|
||||
|
||||
### Comments
|
||||
- Single and multi-line comments are allowed.
|
||||
|
||||
### White Space
|
||||
- Additional white space characters are allowed.
|
||||
|
||||
[IdentifierName]: https://www.ecma-international.org/ecma-262/5.1/#sec-7.6
|
||||
|
||||
[IEEE 754]: http://ieeexplore.ieee.org/servlet/opac?punumber=4610933
|
||||
|
||||
## Short Example
|
||||
```js
|
||||
{
|
||||
// comments
|
||||
unquoted: 'and you can quote me on that',
|
||||
singleQuotes: 'I can use "double quotes" here',
|
||||
lineBreaks: "Look, Mom! \
|
||||
No \\n's!",
|
||||
hexadecimal: 0xdecaf,
|
||||
leadingDecimalPoint: .8675309, andTrailing: 8675309.,
|
||||
positiveSign: +1,
|
||||
trailingComma: 'in objects', andIn: ['arrays',],
|
||||
"backwardsCompatible": "with JSON",
|
||||
}
|
||||
```
|
||||
|
||||
## Specification
|
||||
For a detailed explanation of the JSON5 format, please read the [official
|
||||
specification](https://json5.github.io/json5-spec/).
|
||||
|
||||
## Installation
|
||||
### Node.js
|
||||
```sh
|
||||
npm install json5
|
||||
```
|
||||
|
||||
```js
|
||||
const JSON5 = require('json5')
|
||||
```
|
||||
|
||||
### Browsers
|
||||
```html
|
||||
<script src="https://unpkg.com/json5@^1.0.0"></script>
|
||||
```
|
||||
|
||||
This will create a global `JSON5` variable.
|
||||
|
||||
## API
|
||||
The JSON5 API is compatible with the [JSON API].
|
||||
|
||||
[JSON API]:
|
||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
|
||||
|
||||
### JSON5.parse()
|
||||
Parses a JSON5 string, constructing the JavaScript value or object described by
|
||||
the string. An optional reviver function can be provided to perform a
|
||||
transformation on the resulting object before it is returned.
|
||||
|
||||
#### Syntax
|
||||
JSON5.parse(text[, reviver])
|
||||
|
||||
#### Parameters
|
||||
- `text`: The string to parse as JSON5.
|
||||
- `reviver`: If a function, this prescribes how the value originally produced by
|
||||
parsing is transformed, before being returned.
|
||||
|
||||
#### Return value
|
||||
The object corresponding to the given JSON5 text.
|
||||
|
||||
### JSON5.stringify()
|
||||
Converts a JavaScript value to a JSON5 string, optionally replacing values if a
|
||||
replacer function is specified, or optionally including only the specified
|
||||
properties if a replacer array is specified.
|
||||
|
||||
#### Syntax
|
||||
JSON5.stringify(value[, replacer[, space]])
|
||||
JSON5.stringify(value[, options])
|
||||
|
||||
#### Parameters
|
||||
- `value`: The value to convert to a JSON5 string.
|
||||
- `replacer`: A function that alters the behavior of the stringification
|
||||
process, or an array of String and Number objects that serve as a whitelist
|
||||
for selecting/filtering the properties of the value object to be included in
|
||||
the JSON5 string. If this value is null or not provided, all properties of the
|
||||
object are included in the resulting JSON5 string.
|
||||
- `space`: A String or Number object that's used to insert white space into the
|
||||
output JSON5 string for readability purposes. If this is a Number, it
|
||||
indicates the number of space characters to use as white space; this number is
|
||||
capped at 10 (if it is greater, the value is just 10). Values less than 1
|
||||
indicate that no space should be used. If this is a String, the string (or the
|
||||
first 10 characters of the string, if it's longer than that) is used as white
|
||||
space. If this parameter is not provided (or is null), no white space is used.
|
||||
If white space is used, trailing commas will be used in objects and arrays.
|
||||
- `options`: An object with the following properties:
|
||||
- `replacer`: Same as the `replacer` parameter.
|
||||
- `space`: Same as the `space` parameter.
|
||||
- `quote`: A String representing the quote character to use when serializing
|
||||
strings.
|
||||
|
||||
#### Return value
|
||||
A JSON5 string representing the value.
|
||||
|
||||
### Node.js `require()` JSON5 files
|
||||
When using Node.js, you can `require()` JSON5 files by adding the following
|
||||
statement.
|
||||
|
||||
```js
|
||||
require('json5/lib/register')
|
||||
```
|
||||
|
||||
Then you can load a JSON5 file with a Node.js `require()` statement. For
|
||||
example:
|
||||
|
||||
```js
|
||||
const config = require('./config.json5')
|
||||
```
|
||||
|
||||
## CLI
|
||||
Since JSON is more widely used than JSON5, this package includes a CLI for
|
||||
converting JSON5 to JSON and for validating the syntax of JSON5 documents.
|
||||
|
||||
### Installation
|
||||
```sh
|
||||
npm install --global json5
|
||||
```
|
||||
|
||||
### Usage
|
||||
```sh
|
||||
json5 [options] <file>
|
||||
```
|
||||
|
||||
If `<file>` is not provided, then STDIN is used.
|
||||
|
||||
#### Options:
|
||||
- `-s`, `--space`: The number of spaces to indent or `t` for tabs
|
||||
- `-o`, `--out-file [file]`: Output to the specified file, otherwise STDOUT
|
||||
- `-v`, `--validate`: Validate JSON5 but do not output JSON
|
||||
- `-V`, `--version`: Output the version number
|
||||
- `-h`, `--help`: Output usage information
|
||||
|
||||
## Contibuting
|
||||
### Development
|
||||
```sh
|
||||
git clone https://github.com/json5/json5
|
||||
cd json5
|
||||
npm install
|
||||
```
|
||||
|
||||
When contributing code, please write relevant tests and run `npm test` and `npm
|
||||
run lint` before submitting pull requests. Please use an editor that supports
|
||||
[EditorConfig](http://editorconfig.org/).
|
||||
|
||||
### Issues
|
||||
To report bugs or request features regarding the JSON5 data format, please
|
||||
submit an issue to the [official specification
|
||||
repository](https://github.com/json5/json5-spec).
|
||||
|
||||
To report bugs or request features regarding the JavaScript implentation of
|
||||
JSON5, please submit an issue to this repository.
|
||||
|
||||
## License
|
||||
MIT. See [LICENSE.md](./LICENSE.md) for details.
|
||||
|
||||
## Credits
|
||||
[Assem Kishore](https://github.com/aseemk) founded this project.
|
||||
|
||||
[Michael Bolin](http://bolinfest.com/) independently arrived at and published
|
||||
some of these same ideas with awesome explanations and detail. Recommended
|
||||
reading: [Suggested Improvements to JSON](http://bolinfest.com/essays/json.html)
|
||||
|
||||
[Douglas Crockford](http://www.crockford.com/) of course designed and built
|
||||
JSON, but his state machine diagrams on the [JSON website](http://json.org/), as
|
||||
cheesy as it may sound, gave us motivation and confidence that building a new
|
||||
parser to implement these ideas was within reach! The original
|
||||
implementation of JSON5 was also modeled directly off of Doug’s open-source
|
||||
[json_parse.js] parser. We’re grateful for that clean and well-documented
|
||||
code.
|
||||
|
||||
[json_parse.js]:
|
||||
https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
|
||||
|
||||
[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific
|
||||
supporter, contributing multiple patches and ideas.
|
||||
|
||||
[Andrew Eisenberg](https://github.com/aeisenberg) contributed the original
|
||||
`stringify` method.
|
||||
|
||||
[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely
|
||||
with ES5, wrote the official JSON5 specification, completely rewrote the
|
||||
codebase from the ground up, and is actively maintaining this project.
|
1
web/node_modules/babel-loader/node_modules/json5/dist/index.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/dist/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
web/node_modules/babel-loader/node_modules/json5/lib/cli.js
generated
vendored
Executable file
2
web/node_modules/babel-loader/node_modules/json5/lib/cli.js
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _path=require('path');var _path2=_interopRequireDefault(_path);var _minimist=require('minimist');var _minimist2=_interopRequireDefault(_minimist);var _package=require('../package.json');var _package2=_interopRequireDefault(_package);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var argv=(0,_minimist2.default)(process.argv.slice(2),{alias:{'convert':'c','space':'s','validate':'v','out-file':'o','version':'V','help':'h'},boolean:['convert','validate','version','help'],string:['space','out-file']});if(argv.version){version()}else if(argv.help){usage()}else{var inFilename=argv._[0];var readStream=void 0;if(inFilename){readStream=_fs2.default.createReadStream(inFilename)}else{readStream=process.stdin}var json5='';readStream.on('data',function(data){json5+=data});readStream.on('end',function(){var space=void 0;if(argv.space==='t'||argv.space==='tab'){space='\t'}else{space=Number(argv.space)}var value=void 0;try{value=_2.default.parse(json5);if(!argv.validate){var json=JSON.stringify(value,null,space);var writeStream=void 0;if(argv.convert&&inFilename&&!argv.o){var parsedFilename=_path2.default.parse(inFilename);var outFilename=_path2.default.format(Object.assign(parsedFilename,{base:_path2.default.basename(parsedFilename.base,parsedFilename.ext)+'.json'}));writeStream=_fs2.default.createWriteStream(outFilename)}else if(argv.o){writeStream=_fs2.default.createWriteStream(argv.o)}else{writeStream=process.stdout}writeStream.write(json)}}catch(err){console.error(err.message);process.exit(1)}})}function version(){console.log(_package2.default.version)}function usage(){console.log('\n Usage: json5 [options] <file>\n\n If <file> is not provided, then STDIN is used.\n\n Options:\n\n -s, --space The number of spaces to indent or \'t\' for tabs\n -o, --out-file [file] Output to the specified file, otherwise STDOUT\n -v, --validate Validate JSON5 but do not output JSON\n -V, --version Output the version number\n -h, --help Output usage information')}
|
1
web/node_modules/babel-loader/node_modules/json5/lib/index.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _parse=require('./parse');var _parse2=_interopRequireDefault(_parse);var _stringify=require('./stringify');var _stringify2=_interopRequireDefault(_stringify);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default'];
|
1
web/node_modules/babel-loader/node_modules/json5/lib/parse.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/lib/parse.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/babel-loader/node_modules/json5/lib/register.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/lib/register.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}require.extensions['.json5']=function(module,filename){var content=_fs2.default.readFileSync(filename,'utf8');try{module.exports=_2.default.parse(content)}catch(err){err.message=filename+': '+err.message;throw err}};
|
1
web/node_modules/babel-loader/node_modules/json5/lib/require.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/lib/require.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
"use strict";require("./register");console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.");
|
1
web/node_modules/babel-loader/node_modules/json5/lib/stringify.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/lib/stringify.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/babel-loader/node_modules/json5/lib/unicode.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/lib/unicode.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/babel-loader/node_modules/json5/lib/util.js
generated
vendored
Normal file
1
web/node_modules/babel-loader/node_modules/json5/lib/util.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports.isSpaceSeparator=isSpaceSeparator;exports.isIdStartChar=isIdStartChar;exports.isIdContinueChar=isIdContinueChar;exports.isDigit=isDigit;exports.isHexDigit=isHexDigit;var _unicode=require('../lib/unicode');var unicode=_interopRequireWildcard(_unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)}
|
76
web/node_modules/babel-loader/node_modules/json5/package.json
generated
vendored
Normal file
76
web/node_modules/babel-loader/node_modules/json5/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"name": "json5",
|
||||
"version": "1.0.1",
|
||||
"description": "JSON for humans.",
|
||||
"main": "lib/index.js",
|
||||
"bin": "lib/cli.js",
|
||||
"browser": "dist/index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"dist/"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "babel-node build/build.js && babel src -d lib && rollup -c",
|
||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||
"lint": "eslint --fix build src",
|
||||
"prepublishOnly": "npm run lint && npm test && npm run production",
|
||||
"pretest": "cross-env NODE_ENV=test npm run build",
|
||||
"preversion": "npm run lint && npm test && npm run production",
|
||||
"production": "cross-env NODE_ENV=production npm run build",
|
||||
"test": "nyc --reporter=html --reporter=text mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/json5/json5.git"
|
||||
},
|
||||
"keywords": [
|
||||
"json",
|
||||
"json5",
|
||||
"es5",
|
||||
"es2015",
|
||||
"ecmascript"
|
||||
],
|
||||
"author": "Aseem Kishore <aseem.kishore@gmail.com>",
|
||||
"contributors": [
|
||||
"Max Nanasy <max.nanasy@gmail.com>",
|
||||
"Andrew Eisenberg <andrew@eisenberg.as>",
|
||||
"Jordan Tucker <jordanbtucker@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/json5/json5/issues"
|
||||
},
|
||||
"homepage": "http://json5.org/",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-external-helpers": "^6.22.0",
|
||||
"babel-plugin-istanbul": "^4.1.5",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-register": "^6.26.0",
|
||||
"babelrc-rollup": "^3.0.0",
|
||||
"coveralls": "^3.0.0",
|
||||
"cross-env": "^5.1.4",
|
||||
"del": "^3.0.0",
|
||||
"eslint": "^4.18.2",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-plugin-import": "^2.9.0",
|
||||
"eslint-plugin-node": "^6.0.1",
|
||||
"eslint-plugin-promise": "^3.7.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"mocha": "^5.0.4",
|
||||
"nyc": "^11.4.1",
|
||||
"regenerate": "^1.3.3",
|
||||
"rollup": "^0.56.5",
|
||||
"rollup-plugin-babel": "^3.0.3",
|
||||
"rollup-plugin-commonjs": "^9.0.0",
|
||||
"rollup-plugin-node-resolve": "^3.2.0",
|
||||
"rollup-plugin-uglify": "^3.0.0",
|
||||
"sinon": "^4.4.2",
|
||||
"unicode-9.0.0": "^0.7.5"
|
||||
}
|
||||
}
|
87
web/node_modules/babel-loader/node_modules/loader-utils/CHANGELOG.md
generated
vendored
Normal file
87
web/node_modules/babel-loader/node_modules/loader-utils/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
# [1.4.0](https://github.com/webpack/loader-utils/compare/v1.3.0...v1.4.0) (2020-02-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* the `resourceQuery` is passed to the `interpolateName` method ([#163](https://github.com/webpack/loader-utils/issues/163)) ([cd0e428](https://github.com/webpack/loader-utils/commit/cd0e428))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
# [1.3.0](https://github.com/webpack/loader-utils/compare/v1.2.3...v1.3.0) (2020-02-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support the `[query]` template for the `interpolatedName` method ([#162](https://github.com/webpack/loader-utils/issues/162)) ([469eeba](https://github.com/webpack/loader-utils/commit/469eeba))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.3"></a>
|
||||
## [1.2.3](https://github.com/webpack/loader-utils/compare/v1.2.2...v1.2.3) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **interpolateName:** don't interpolated `hashType` without `hash` or `contenthash` ([#140](https://github.com/webpack/loader-utils/issues/140)) ([3528fd9](https://github.com/webpack/loader-utils/commit/3528fd9))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.2"></a>
|
||||
## [1.2.2](https://github.com/webpack/loader-utils/compare/v1.2.1...v1.2.2) (2018-12-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fixed a hash type extracting in interpolateName ([#137](https://github.com/webpack/loader-utils/issues/137)) ([f8a71f4](https://github.com/webpack/loader-utils/commit/f8a71f4))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.1"></a>
|
||||
## [1.2.1](https://github.com/webpack/loader-utils/compare/v1.2.0...v1.2.1) (2018-12-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **isUrlRequest:** better handle absolute urls and non standards ([#134](https://github.com/webpack/loader-utils/issues/134)) ([aca43da](https://github.com/webpack/loader-utils/commit/aca43da))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* PR [#79](https://github.com/webpack/loader-utils/issues/79) ([#135](https://github.com/webpack/loader-utils/issues/135)) ([73d350a](https://github.com/webpack/loader-utils/commit/73d350a))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
# [1.2.0](https://github.com/webpack/loader-utils/compare/v1.1.0...v1.2.0) (2018-12-24)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **interpolateName:** support `[contenthash]`
|
||||
|
||||
### Fixes
|
||||
|
||||
* **urlToRequest:** empty urls are not rewritten to relative requests
|
||||
* **urlToRequest:** don't rewrite absolute urls
|
||||
* **isUrlRequest:** ignore all url with `extension` (like `moz-extension:`, `ms-browser-extension:` and etc)
|
||||
* **isUrlRequest:** ignore `about:blank`
|
||||
* **interpolateName:** failing explicitly when ran out of emoji
|
||||
* **interpolateName:** `[hash]` token regex in interpolate string to capture any hash algorithm name
|
||||
* **interpolateName:** parse string for emoji count before use
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
# [1.1.0](https://github.com/webpack/loader-utils/compare/v1.0.4...v1.1.0) (2017-03-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **automatic-release:** Generation of automatic release ([7484d13](https://github.com/webpack/loader-utils/commit/7484d13))
|
||||
* **parseQuery:** export parseQuery ([ddf64e4](https://github.com/webpack/loader-utils/commit/ddf64e4))
|
20
web/node_modules/babel-loader/node_modules/loader-utils/LICENSE
generated
vendored
Normal file
20
web/node_modules/babel-loader/node_modules/loader-utils/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other 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.
|
275
web/node_modules/babel-loader/node_modules/loader-utils/README.md
generated
vendored
Normal file
275
web/node_modules/babel-loader/node_modules/loader-utils/README.md
generated
vendored
Normal file
|
@ -0,0 +1,275 @@
|
|||
# loader-utils
|
||||
|
||||
## Methods
|
||||
|
||||
### `getOptions`
|
||||
|
||||
Recommended way to retrieve the options of a loader invocation:
|
||||
|
||||
```javascript
|
||||
// inside your loader
|
||||
const options = loaderUtils.getOptions(this);
|
||||
```
|
||||
|
||||
1. If `this.query` is a string:
|
||||
- Tries to parse the query string and returns a new object
|
||||
- Throws if it's not a valid query string
|
||||
2. If `this.query` is object-like, it just returns `this.query`
|
||||
3. In any other case, it just returns `null`
|
||||
|
||||
**Please note:** The returned `options` object is *read-only*. It may be re-used across multiple invocations.
|
||||
If you pass it on to another library, make sure to make a *deep copy* of it:
|
||||
|
||||
```javascript
|
||||
const options = Object.assign(
|
||||
{},
|
||||
defaultOptions,
|
||||
loaderUtils.getOptions(this) // it is safe to pass null to Object.assign()
|
||||
);
|
||||
// don't forget nested objects or arrays
|
||||
options.obj = Object.assign({}, options.obj);
|
||||
options.arr = options.arr.slice();
|
||||
someLibrary(options);
|
||||
```
|
||||
|
||||
[clone](https://www.npmjs.com/package/clone) is a good library to make a deep copy of the options.
|
||||
|
||||
#### Options as query strings
|
||||
|
||||
If the loader options have been passed as loader query string (`loader?some¶ms`), the string is parsed by using [`parseQuery`](#parsequery).
|
||||
|
||||
### `parseQuery`
|
||||
|
||||
Parses a passed string (e.g. `loaderContext.resourceQuery`) as a query string, and returns an object.
|
||||
|
||||
``` javascript
|
||||
const params = loaderUtils.parseQuery(this.resourceQuery); // resource: `file?param1=foo`
|
||||
if (params.param1 === "foo") {
|
||||
// do something
|
||||
}
|
||||
```
|
||||
|
||||
The string is parsed like this:
|
||||
|
||||
``` text
|
||||
-> Error
|
||||
? -> {}
|
||||
?flag -> { flag: true }
|
||||
?+flag -> { flag: true }
|
||||
?-flag -> { flag: false }
|
||||
?xyz=test -> { xyz: "test" }
|
||||
?xyz=1 -> { xyz: "1" } // numbers are NOT parsed
|
||||
?xyz[]=a -> { xyz: ["a"] }
|
||||
?flag1&flag2 -> { flag1: true, flag2: true }
|
||||
?+flag1,-flag2 -> { flag1: true, flag2: false }
|
||||
?xyz[]=a,xyz[]=b -> { xyz: ["a", "b"] }
|
||||
?a%2C%26b=c%2C%26d -> { "a,&b": "c,&d" }
|
||||
?{data:{a:1},isJSON5:true} -> { data: { a: 1 }, isJSON5: true }
|
||||
```
|
||||
|
||||
### `stringifyRequest`
|
||||
|
||||
Turns a request into a string that can be used inside `require()` or `import` while avoiding absolute paths.
|
||||
Use it instead of `JSON.stringify(...)` if you're generating code inside a loader.
|
||||
|
||||
**Why is this necessary?** Since webpack calculates the hash before module paths are translated into module ids, we must avoid absolute paths to ensure
|
||||
consistent hashes across different compilations.
|
||||
|
||||
This function:
|
||||
|
||||
- resolves absolute requests into relative requests if the request and the module are on the same hard drive
|
||||
- replaces `\` with `/` if the request and the module are on the same hard drive
|
||||
- won't change the path at all if the request and the module are on different hard drives
|
||||
- applies `JSON.stringify` to the result
|
||||
|
||||
```javascript
|
||||
loaderUtils.stringifyRequest(this, "./test.js");
|
||||
// "\"./test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, ".\\test.js");
|
||||
// "\"./test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "test");
|
||||
// "\"test\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "test/lib/index.js");
|
||||
// "\"test/lib/index.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "otherLoader?andConfig!test?someConfig");
|
||||
// "\"otherLoader?andConfig!test?someConfig\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, require.resolve("test"));
|
||||
// "\"../node_modules/some-loader/lib/test.js\""
|
||||
|
||||
loaderUtils.stringifyRequest(this, "C:\\module\\test.js");
|
||||
// "\"../../test.js\"" (on Windows, in case the module and the request are on the same drive)
|
||||
|
||||
loaderUtils.stringifyRequest(this, "C:\\module\\test.js");
|
||||
// "\"C:\\module\\test.js\"" (on Windows, in case the module and the request are on different drives)
|
||||
|
||||
loaderUtils.stringifyRequest(this, "\\\\network-drive\\test.js");
|
||||
// "\"\\\\network-drive\\\\test.js\"" (on Windows, in case the module and the request are on different drives)
|
||||
```
|
||||
|
||||
### `urlToRequest`
|
||||
|
||||
Converts some resource URL to a webpack module request.
|
||||
|
||||
> i Before call `urlToRequest` you need call `isUrlRequest` to ensure it is requestable url
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
|
||||
if (loaderUtils.isUrlRequest(url)) {
|
||||
// Logic for requestable url
|
||||
const request = loaderUtils.urlToRequest(url);
|
||||
} else {
|
||||
// Logic for not requestable url
|
||||
}
|
||||
```
|
||||
|
||||
Simple example:
|
||||
|
||||
```javascript
|
||||
const url = "path/to/module.js";
|
||||
const request = loaderUtils.urlToRequest(url); // "./path/to/module.js"
|
||||
```
|
||||
|
||||
#### Module URLs
|
||||
|
||||
Any URL containing a `~` will be interpreted as a module request. Anything after the `~` will be considered the request path.
|
||||
|
||||
```javascript
|
||||
const url = "~path/to/module.js";
|
||||
const request = loaderUtils.urlToRequest(url); // "path/to/module.js"
|
||||
```
|
||||
|
||||
#### Root-relative URLs
|
||||
|
||||
URLs that are root-relative (start with `/`) can be resolved relative to some arbitrary path by using the `root` parameter:
|
||||
|
||||
```javascript
|
||||
const url = "/path/to/module.js";
|
||||
const root = "./root";
|
||||
const request = loaderUtils.urlToRequest(url, root); // "./root/path/to/module.js"
|
||||
```
|
||||
|
||||
To convert a root-relative URL into a module URL, specify a `root` value that starts with `~`:
|
||||
|
||||
```javascript
|
||||
const url = "/path/to/module.js";
|
||||
const root = "~";
|
||||
const request = loaderUtils.urlToRequest(url, root); // "path/to/module.js"
|
||||
```
|
||||
|
||||
### `interpolateName`
|
||||
|
||||
Interpolates a filename template using multiple placeholders and/or a regular expression.
|
||||
The template and regular expression are set as query params called `name` and `regExp` on the current loader's context.
|
||||
|
||||
```javascript
|
||||
const interpolatedName = loaderUtils.interpolateName(loaderContext, name, options);
|
||||
```
|
||||
|
||||
The following tokens are replaced in the `name` parameter:
|
||||
|
||||
* `[ext]` the extension of the resource
|
||||
* `[name]` the basename of the resource
|
||||
* `[path]` the path of the resource relative to the `context` query parameter or option.
|
||||
* `[folder]` the folder the resource is in
|
||||
* `[query]` the queryof the resource, i.e. `?foo=bar`
|
||||
* `[emoji]` a random emoji representation of `options.content`
|
||||
* `[emoji:<length>]` same as above, but with a customizable number of emojis
|
||||
* `[contenthash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:contenthash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
* other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* and `length` the length in chars
|
||||
* `[hash]` the hash of `options.content` (Buffer) (by default it's the hex digest of the md5 hash)
|
||||
* `[<hashType>:hash:<digestType>:<length>]` optionally one can configure
|
||||
* other `hashType`s, i. e. `sha1`, `md5`, `sha256`, `sha512`
|
||||
* other `digestType`s, i. e. `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* and `length` the length in chars
|
||||
* `[N]` the N-th match obtained from matching the current file name against `options.regExp`
|
||||
|
||||
In loader context `[hash]` and `[contenthash]` are the same, but we recommend using `[contenthash]` for avoid misleading.
|
||||
|
||||
Examples
|
||||
|
||||
``` javascript
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
// loaderContext.resourceQuery = "?foo=bar"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext][query]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js?foo=bar
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
loaderUtils.interpolateName(loaderContext, "js/[contenthash].script.[ext]", { content: ... });
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/page.html"
|
||||
loaderUtils.interpolateName(loaderContext, "html-[hash:6].html", { content: ... });
|
||||
// => html-9473fd.html
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/flash.txt"
|
||||
loaderUtils.interpolateName(loaderContext, "[hash]", { content: ... });
|
||||
// => c31e9820c001c9c4a86bce33ce43b679
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.gif"
|
||||
loaderUtils.interpolateName(loaderContext, "[emoji]", { content: ... });
|
||||
// => 👍
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.gif"
|
||||
loaderUtils.interpolateName(loaderContext, "[emoji:4]", { content: ... });
|
||||
// => 🙍🏢📤🐝
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/image.png"
|
||||
loaderUtils.interpolateName(loaderContext, "[sha512:hash:base64:7].[ext]", { content: ... });
|
||||
// => 2BKDTjl.png
|
||||
// use sha512 hash instead of md5 and with only 7 chars of base64
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/img/myself.png"
|
||||
// loaderContext.query.name =
|
||||
loaderUtils.interpolateName(loaderContext, "picture.png");
|
||||
// => picture.png
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/dir/file.png"
|
||||
loaderUtils.interpolateName(loaderContext, "[path][name].[ext]?[hash]", { content: ... });
|
||||
// => /app/dir/file.png?9473fdd0d880a43c21b7778d34872157
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/page-home.js"
|
||||
loaderUtils.interpolateName(loaderContext, "script-[1].[ext]", { regExp: "page-(.*)\\.js", content: ... });
|
||||
// => script-home.js
|
||||
|
||||
// loaderContext.resourcePath = "/absolute/path/to/app/js/javascript.js"
|
||||
// loaderContext.resourceQuery = "?foo=bar"
|
||||
loaderUtils.interpolateName(
|
||||
loaderContext,
|
||||
(resourcePath, resourceQuery) => {
|
||||
// resourcePath - `/app/js/javascript.js`
|
||||
// resourceQuery - `?foo=bar`
|
||||
|
||||
return "js/[hash].script.[ext]";
|
||||
},
|
||||
{ content: ... }
|
||||
);
|
||||
// => js/9473fdd0d880a43c21b7778d34872157.script.js
|
||||
```
|
||||
|
||||
### `getHashDigest`
|
||||
|
||||
``` javascript
|
||||
const digestString = loaderUtils.getHashDigest(buffer, hashType, digestType, maxLength);
|
||||
```
|
||||
|
||||
* `buffer` the content that should be hashed
|
||||
* `hashType` one of `sha1`, `md5`, `sha256`, `sha512` or any other node.js supported hash type
|
||||
* `digestType` one of `hex`, `base26`, `base32`, `base36`, `base49`, `base52`, `base58`, `base62`, `base64`
|
||||
* `maxLength` the maximum length in chars
|
||||
|
||||
## License
|
||||
|
||||
MIT (http://www.opensource.org/licenses/mit-license.php)
|
16
web/node_modules/babel-loader/node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
Normal file
16
web/node_modules/babel-loader/node_modules/loader-utils/lib/getCurrentRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
function getCurrentRequest(loaderContext) {
|
||||
if (loaderContext.currentRequest) {
|
||||
return loaderContext.currentRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getCurrentRequest;
|
69
web/node_modules/babel-loader/node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
Normal file
69
web/node_modules/babel-loader/node_modules/loader-utils/lib/getHashDigest.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
'use strict';
|
||||
|
||||
const baseEncodeTables = {
|
||||
26: 'abcdefghijklmnopqrstuvwxyz',
|
||||
32: '123456789abcdefghjkmnpqrstuvwxyz', // no 0lio
|
||||
36: '0123456789abcdefghijklmnopqrstuvwxyz',
|
||||
49: 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no lIO
|
||||
52: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
58: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ', // no 0lIO
|
||||
62: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
64: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_',
|
||||
};
|
||||
|
||||
function encodeBufferToBase(buffer, base) {
|
||||
const encodeTable = baseEncodeTables[base];
|
||||
if (!encodeTable) {
|
||||
throw new Error('Unknown encoding base' + base);
|
||||
}
|
||||
|
||||
const readLength = buffer.length;
|
||||
const Big = require('big.js');
|
||||
|
||||
Big.RM = Big.DP = 0;
|
||||
let b = new Big(0);
|
||||
|
||||
for (let i = readLength - 1; i >= 0; i--) {
|
||||
b = b.times(256).plus(buffer[i]);
|
||||
}
|
||||
|
||||
let output = '';
|
||||
while (b.gt(0)) {
|
||||
output = encodeTable[b.mod(base)] + output;
|
||||
b = b.div(base);
|
||||
}
|
||||
|
||||
Big.DP = 20;
|
||||
Big.RM = 1;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function getHashDigest(buffer, hashType, digestType, maxLength) {
|
||||
hashType = hashType || 'md5';
|
||||
maxLength = maxLength || 9999;
|
||||
|
||||
const hash = require('crypto').createHash(hashType);
|
||||
|
||||
hash.update(buffer);
|
||||
|
||||
if (
|
||||
digestType === 'base26' ||
|
||||
digestType === 'base32' ||
|
||||
digestType === 'base36' ||
|
||||
digestType === 'base49' ||
|
||||
digestType === 'base52' ||
|
||||
digestType === 'base58' ||
|
||||
digestType === 'base62' ||
|
||||
digestType === 'base64'
|
||||
) {
|
||||
return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(
|
||||
0,
|
||||
maxLength
|
||||
);
|
||||
} else {
|
||||
return hash.digest(digestType || 'hex').substr(0, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = getHashDigest;
|
20
web/node_modules/babel-loader/node_modules/loader-utils/lib/getOptions.js
generated
vendored
Normal file
20
web/node_modules/babel-loader/node_modules/loader-utils/lib/getOptions.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
const parseQuery = require('./parseQuery');
|
||||
|
||||
function getOptions(loaderContext) {
|
||||
const query = loaderContext.query;
|
||||
|
||||
if (typeof query === 'string' && query !== '') {
|
||||
return parseQuery(loaderContext.query);
|
||||
}
|
||||
|
||||
if (!query || typeof query !== 'object') {
|
||||
// Not object-like queries are not supported.
|
||||
return null;
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
module.exports = getOptions;
|
16
web/node_modules/babel-loader/node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
Normal file
16
web/node_modules/babel-loader/node_modules/loader-utils/lib/getRemainingRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
function getRemainingRequest(loaderContext) {
|
||||
if (loaderContext.remainingRequest) {
|
||||
return loaderContext.remainingRequest;
|
||||
}
|
||||
|
||||
const request = loaderContext.loaders
|
||||
.slice(loaderContext.loaderIndex + 1)
|
||||
.map((obj) => obj.request)
|
||||
.concat([loaderContext.resource]);
|
||||
|
||||
return request.join('!');
|
||||
}
|
||||
|
||||
module.exports = getRemainingRequest;
|
23
web/node_modules/babel-loader/node_modules/loader-utils/lib/index.js
generated
vendored
Normal file
23
web/node_modules/babel-loader/node_modules/loader-utils/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
const getOptions = require('./getOptions');
|
||||
const parseQuery = require('./parseQuery');
|
||||
const stringifyRequest = require('./stringifyRequest');
|
||||
const getRemainingRequest = require('./getRemainingRequest');
|
||||
const getCurrentRequest = require('./getCurrentRequest');
|
||||
const isUrlRequest = require('./isUrlRequest');
|
||||
const urlToRequest = require('./urlToRequest');
|
||||
const parseString = require('./parseString');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
const interpolateName = require('./interpolateName');
|
||||
|
||||
exports.getOptions = getOptions;
|
||||
exports.parseQuery = parseQuery;
|
||||
exports.stringifyRequest = stringifyRequest;
|
||||
exports.getRemainingRequest = getRemainingRequest;
|
||||
exports.getCurrentRequest = getCurrentRequest;
|
||||
exports.isUrlRequest = isUrlRequest;
|
||||
exports.urlToRequest = urlToRequest;
|
||||
exports.parseString = parseString;
|
||||
exports.getHashDigest = getHashDigest;
|
||||
exports.interpolateName = interpolateName;
|
151
web/node_modules/babel-loader/node_modules/loader-utils/lib/interpolateName.js
generated
vendored
Normal file
151
web/node_modules/babel-loader/node_modules/loader-utils/lib/interpolateName.js
generated
vendored
Normal file
|
@ -0,0 +1,151 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const emojisList = require('emojis-list');
|
||||
const getHashDigest = require('./getHashDigest');
|
||||
|
||||
const emojiRegex = /[\uD800-\uDFFF]./;
|
||||
const emojiList = emojisList.filter((emoji) => emojiRegex.test(emoji));
|
||||
const emojiCache = {};
|
||||
|
||||
function encodeStringToEmoji(content, length) {
|
||||
if (emojiCache[content]) {
|
||||
return emojiCache[content];
|
||||
}
|
||||
|
||||
length = length || 1;
|
||||
|
||||
const emojis = [];
|
||||
|
||||
do {
|
||||
if (!emojiList.length) {
|
||||
throw new Error('Ran out of emoji');
|
||||
}
|
||||
|
||||
const index = Math.floor(Math.random() * emojiList.length);
|
||||
|
||||
emojis.push(emojiList[index]);
|
||||
emojiList.splice(index, 1);
|
||||
} while (--length > 0);
|
||||
|
||||
const emojiEncoding = emojis.join('');
|
||||
|
||||
emojiCache[content] = emojiEncoding;
|
||||
|
||||
return emojiEncoding;
|
||||
}
|
||||
|
||||
function interpolateName(loaderContext, name, options) {
|
||||
let filename;
|
||||
|
||||
const hasQuery =
|
||||
loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1;
|
||||
|
||||
if (typeof name === 'function') {
|
||||
filename = name(
|
||||
loaderContext.resourcePath,
|
||||
hasQuery ? loaderContext.resourceQuery : undefined
|
||||
);
|
||||
} else {
|
||||
filename = name || '[hash].[ext]';
|
||||
}
|
||||
|
||||
const context = options.context;
|
||||
const content = options.content;
|
||||
const regExp = options.regExp;
|
||||
|
||||
let ext = 'bin';
|
||||
let basename = 'file';
|
||||
let directory = '';
|
||||
let folder = '';
|
||||
let query = '';
|
||||
|
||||
if (loaderContext.resourcePath) {
|
||||
const parsed = path.parse(loaderContext.resourcePath);
|
||||
let resourcePath = loaderContext.resourcePath;
|
||||
|
||||
if (parsed.ext) {
|
||||
ext = parsed.ext.substr(1);
|
||||
}
|
||||
|
||||
if (parsed.dir) {
|
||||
basename = parsed.name;
|
||||
resourcePath = parsed.dir + path.sep;
|
||||
}
|
||||
|
||||
if (typeof context !== 'undefined') {
|
||||
directory = path
|
||||
.relative(context, resourcePath + '_')
|
||||
.replace(/\\/g, '/')
|
||||
.replace(/\.\.(\/)?/g, '_$1');
|
||||
directory = directory.substr(0, directory.length - 1);
|
||||
} else {
|
||||
directory = resourcePath.replace(/\\/g, '/').replace(/\.\.(\/)?/g, '_$1');
|
||||
}
|
||||
|
||||
if (directory.length === 1) {
|
||||
directory = '';
|
||||
} else if (directory.length > 1) {
|
||||
folder = path.basename(directory);
|
||||
}
|
||||
}
|
||||
|
||||
if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
|
||||
query = loaderContext.resourceQuery;
|
||||
|
||||
const hashIdx = query.indexOf('#');
|
||||
|
||||
if (hashIdx >= 0) {
|
||||
query = query.substr(0, hashIdx);
|
||||
}
|
||||
}
|
||||
|
||||
let url = filename;
|
||||
|
||||
if (content) {
|
||||
// Match hash template
|
||||
url = url
|
||||
// `hash` and `contenthash` are same in `loader-utils` context
|
||||
// let's keep `hash` for backward compatibility
|
||||
.replace(
|
||||
/\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi,
|
||||
(all, hashType, digestType, maxLength) =>
|
||||
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10))
|
||||
)
|
||||
.replace(/\[emoji(?::(\d+))?\]/gi, (all, length) =>
|
||||
encodeStringToEmoji(content, parseInt(length, 10))
|
||||
);
|
||||
}
|
||||
|
||||
url = url
|
||||
.replace(/\[ext\]/gi, () => ext)
|
||||
.replace(/\[name\]/gi, () => basename)
|
||||
.replace(/\[path\]/gi, () => directory)
|
||||
.replace(/\[folder\]/gi, () => folder)
|
||||
.replace(/\[query\]/gi, () => query);
|
||||
|
||||
if (regExp && loaderContext.resourcePath) {
|
||||
const match = loaderContext.resourcePath.match(new RegExp(regExp));
|
||||
|
||||
match &&
|
||||
match.forEach((matched, i) => {
|
||||
url = url.replace(new RegExp('\\[' + i + '\\]', 'ig'), matched);
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
typeof loaderContext.options === 'object' &&
|
||||
typeof loaderContext.options.customInterpolateName === 'function'
|
||||
) {
|
||||
url = loaderContext.options.customInterpolateName.call(
|
||||
loaderContext,
|
||||
url,
|
||||
name,
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
module.exports = interpolateName;
|
31
web/node_modules/babel-loader/node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
Normal file
31
web/node_modules/babel-loader/node_modules/loader-utils/lib/isUrlRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
function isUrlRequest(url, root) {
|
||||
// An URL is not an request if
|
||||
|
||||
// 1. It's an absolute url and it is not `windows` path like `C:\dir\file`
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(url) && !path.win32.isAbsolute(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. It's a protocol-relative
|
||||
if (/^\/\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. It's some kind of url for a template
|
||||
if (/^[{}[\]#*;,'§$%&(=?`´^°<>]/.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 4. It's also not an request if root isn't set and it's a root-relative url
|
||||
if ((root === undefined || root === false) && /^\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isUrlRequest;
|
68
web/node_modules/babel-loader/node_modules/loader-utils/lib/parseQuery.js
generated
vendored
Normal file
68
web/node_modules/babel-loader/node_modules/loader-utils/lib/parseQuery.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
'use strict';
|
||||
|
||||
const JSON5 = require('json5');
|
||||
|
||||
const specialValues = {
|
||||
null: null,
|
||||
true: true,
|
||||
false: false,
|
||||
};
|
||||
|
||||
function parseQuery(query) {
|
||||
if (query.substr(0, 1) !== '?') {
|
||||
throw new Error(
|
||||
"A valid query string passed to parseQuery should begin with '?'"
|
||||
);
|
||||
}
|
||||
|
||||
query = query.substr(1);
|
||||
|
||||
if (!query) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (query.substr(0, 1) === '{' && query.substr(-1) === '}') {
|
||||
return JSON5.parse(query);
|
||||
}
|
||||
|
||||
const queryArgs = query.split(/[,&]/g);
|
||||
const result = {};
|
||||
|
||||
queryArgs.forEach((arg) => {
|
||||
const idx = arg.indexOf('=');
|
||||
|
||||
if (idx >= 0) {
|
||||
let name = arg.substr(0, idx);
|
||||
let value = decodeURIComponent(arg.substr(idx + 1));
|
||||
|
||||
if (specialValues.hasOwnProperty(value)) {
|
||||
value = specialValues[value];
|
||||
}
|
||||
|
||||
if (name.substr(-2) === '[]') {
|
||||
name = decodeURIComponent(name.substr(0, name.length - 2));
|
||||
|
||||
if (!Array.isArray(result[name])) {
|
||||
result[name] = [];
|
||||
}
|
||||
|
||||
result[name].push(value);
|
||||
} else {
|
||||
name = decodeURIComponent(name);
|
||||
result[name] = value;
|
||||
}
|
||||
} else {
|
||||
if (arg.substr(0, 1) === '-') {
|
||||
result[decodeURIComponent(arg.substr(1))] = false;
|
||||
} else if (arg.substr(0, 1) === '+') {
|
||||
result[decodeURIComponent(arg.substr(1))] = true;
|
||||
} else {
|
||||
result[decodeURIComponent(arg)] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = parseQuery;
|
23
web/node_modules/babel-loader/node_modules/loader-utils/lib/parseString.js
generated
vendored
Normal file
23
web/node_modules/babel-loader/node_modules/loader-utils/lib/parseString.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
function parseString(str) {
|
||||
try {
|
||||
if (str[0] === '"') {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
if (str[0] === "'" && str.substr(str.length - 1) === "'") {
|
||||
return parseString(
|
||||
str
|
||||
.replace(/\\.|"/g, (x) => (x === '"' ? '\\"' : x))
|
||||
.replace(/^'|'$/g, '"')
|
||||
);
|
||||
}
|
||||
|
||||
return JSON.parse('"' + str + '"');
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parseString;
|
51
web/node_modules/babel-loader/node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
Normal file
51
web/node_modules/babel-loader/node_modules/loader-utils/lib/stringifyRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const matchRelativePath = /^\.\.?[/\\]/;
|
||||
|
||||
function isAbsolutePath(str) {
|
||||
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
|
||||
}
|
||||
|
||||
function isRelativePath(str) {
|
||||
return matchRelativePath.test(str);
|
||||
}
|
||||
|
||||
function stringifyRequest(loaderContext, request) {
|
||||
const splitted = request.split('!');
|
||||
const context =
|
||||
loaderContext.context ||
|
||||
(loaderContext.options && loaderContext.options.context);
|
||||
|
||||
return JSON.stringify(
|
||||
splitted
|
||||
.map((part) => {
|
||||
// First, separate singlePath from query, because the query might contain paths again
|
||||
const splittedPart = part.match(/^(.*?)(\?.*)/);
|
||||
const query = splittedPart ? splittedPart[2] : '';
|
||||
let singlePath = splittedPart ? splittedPart[1] : part;
|
||||
|
||||
if (isAbsolutePath(singlePath) && context) {
|
||||
singlePath = path.relative(context, singlePath);
|
||||
|
||||
if (isAbsolutePath(singlePath)) {
|
||||
// If singlePath still matches an absolute path, singlePath was on a different drive than context.
|
||||
// In this case, we leave the path platform-specific without replacing any separators.
|
||||
// @see https://github.com/webpack/loader-utils/pull/14
|
||||
return singlePath + query;
|
||||
}
|
||||
|
||||
if (isRelativePath(singlePath) === false) {
|
||||
// Ensure that the relative path starts at least with ./ otherwise it would be a request into the modules directory (like node_modules).
|
||||
singlePath = './' + singlePath;
|
||||
}
|
||||
}
|
||||
|
||||
return singlePath.replace(/\\/g, '/') + query;
|
||||
})
|
||||
.join('!')
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = stringifyRequest;
|
60
web/node_modules/babel-loader/node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
Normal file
60
web/node_modules/babel-loader/node_modules/loader-utils/lib/urlToRequest.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
// we can't use path.win32.isAbsolute because it also matches paths starting with a forward slash
|
||||
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
|
||||
|
||||
function urlToRequest(url, root) {
|
||||
// Do not rewrite an empty url
|
||||
if (url === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
const moduleRequestRegex = /^[^?]*~/;
|
||||
let request;
|
||||
|
||||
if (matchNativeWin32Path.test(url)) {
|
||||
// absolute windows path, keep it
|
||||
request = url;
|
||||
} else if (root !== undefined && root !== false && /^\//.test(url)) {
|
||||
// if root is set and the url is root-relative
|
||||
switch (typeof root) {
|
||||
// 1. root is a string: root is prefixed to the url
|
||||
case 'string':
|
||||
// special case: `~` roots convert to module request
|
||||
if (moduleRequestRegex.test(root)) {
|
||||
request = root.replace(/([^~/])$/, '$1/') + url.slice(1);
|
||||
} else {
|
||||
request = root + url;
|
||||
}
|
||||
break;
|
||||
// 2. root is `true`: absolute paths are allowed
|
||||
// *nix only, windows-style absolute paths are always allowed as they doesn't start with a `/`
|
||||
case 'boolean':
|
||||
request = url;
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
"Unexpected parameters to loader-utils 'urlToRequest': url = " +
|
||||
url +
|
||||
', root = ' +
|
||||
root +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
} else if (/^\.\.?\//.test(url)) {
|
||||
// A relative url stays
|
||||
request = url;
|
||||
} else {
|
||||
// every other url is threaded like a relative url
|
||||
request = './' + url;
|
||||
}
|
||||
|
||||
// A `~` makes the url an module
|
||||
if (moduleRequestRegex.test(request)) {
|
||||
request = request.replace(moduleRequestRegex, '');
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
module.exports = urlToRequest;
|
39
web/node_modules/babel-loader/node_modules/loader-utils/package.json
generated
vendored
Normal file
39
web/node_modules/babel-loader/node_modules/loader-utils/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "loader-utils",
|
||||
"version": "1.4.0",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"description": "utils for webpack loaders",
|
||||
"dependencies": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
"json5": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint lib test",
|
||||
"pretest": "yarn lint",
|
||||
"test": "jest",
|
||||
"test:ci": "jest --coverage",
|
||||
"release": "yarn test && standard-version"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/webpack/loader-utils.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.2",
|
||||
"eslint": "^5.11.0",
|
||||
"eslint-plugin-node": "^8.0.0",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"jest": "^21.2.1",
|
||||
"prettier": "^1.19.1",
|
||||
"standard-version": "^4.0.0"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
]
|
||||
}
|
123
web/node_modules/babel-loader/package.json
generated
vendored
Normal file
123
web/node_modules/babel-loader/package.json
generated
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
{
|
||||
"name": "babel-loader",
|
||||
"version": "8.1.0",
|
||||
"description": "babel module loader for webpack",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
"node": ">= 6.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"find-cache-dir": "^2.1.0",
|
||||
"loader-utils": "^1.4.0",
|
||||
"mkdirp": "^0.5.3",
|
||||
"pify": "^4.0.1",
|
||||
"schema-utils": "^2.6.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"webpack": ">=2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.0",
|
||||
"@babel/core": "^7.2.0",
|
||||
"@babel/preset-env": "^7.2.0",
|
||||
"ava": "^2.4.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-plugin-istanbul": "^5.1.0",
|
||||
"babel-plugin-react-intl": "^4.1.19",
|
||||
"cross-env": "^6.0.0",
|
||||
"eslint": "^6.5.1",
|
||||
"eslint-config-babel": "^9.0.0",
|
||||
"eslint-config-prettier": "^6.3.0",
|
||||
"eslint-plugin-flowtype": "^4.3.0",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"husky": "^3.0.7",
|
||||
"lint-staged": "^9.4.1",
|
||||
"nyc": "^14.1.1",
|
||||
"prettier": "^1.15.3",
|
||||
"react": "^16.0.0",
|
||||
"react-intl": "^3.3.2",
|
||||
"react-intl-webpack-plugin": "^0.3.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"webpack": "^4.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf lib/",
|
||||
"build": "babel src/ --out-dir lib/ --copy-files",
|
||||
"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/**/*"
|
||||
],
|
||||
"helpers": [
|
||||
"**/helpers/**/*"
|
||||
],
|
||||
"sources": [
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue