From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/url-loader/CHANGELOG.md | 122 +++++++++++++++ node_modules/url-loader/LICENSE | 20 +++ node_modules/url-loader/README.md | 166 +++++++++++++++++++++ node_modules/url-loader/dist/cjs.js | 6 + node_modules/url-loader/dist/index.js | 77 ++++++++++ node_modules/url-loader/dist/options.json | 40 +++++ .../url-loader/dist/utils/normalizeFallback.js | 38 +++++ node_modules/url-loader/node_modules/.bin/mime | 1 + node_modules/url-loader/node_modules/.bin/webpack | 1 + .../node_modules/schema-utils/CHANGELOG.md | 134 +++++++++++++++++ .../url-loader/node_modules/schema-utils/LICENSE | 20 +++ .../url-loader/node_modules/schema-utils/README.md | 149 ++++++++++++++++++ .../node_modules/schema-utils/package.json | 41 +++++ .../schema-utils/src/ValidationError.js | 30 ++++ .../node_modules/schema-utils/src/index.js | 9 ++ .../schema-utils/src/validateOptions.js | 38 +++++ node_modules/url-loader/package.json | 96 ++++++++++++ 17 files changed, 988 insertions(+) create mode 100644 node_modules/url-loader/CHANGELOG.md create mode 100644 node_modules/url-loader/LICENSE create mode 100644 node_modules/url-loader/README.md create mode 100644 node_modules/url-loader/dist/cjs.js create mode 100644 node_modules/url-loader/dist/index.js create mode 100644 node_modules/url-loader/dist/options.json create mode 100644 node_modules/url-loader/dist/utils/normalizeFallback.js create mode 120000 node_modules/url-loader/node_modules/.bin/mime create mode 120000 node_modules/url-loader/node_modules/.bin/webpack create mode 100644 node_modules/url-loader/node_modules/schema-utils/CHANGELOG.md create mode 100644 node_modules/url-loader/node_modules/schema-utils/LICENSE create mode 100644 node_modules/url-loader/node_modules/schema-utils/README.md create mode 100644 node_modules/url-loader/node_modules/schema-utils/package.json create mode 100644 node_modules/url-loader/node_modules/schema-utils/src/ValidationError.js create mode 100644 node_modules/url-loader/node_modules/schema-utils/src/index.js create mode 100644 node_modules/url-loader/node_modules/schema-utils/src/validateOptions.js create mode 100644 node_modules/url-loader/package.json (limited to 'node_modules/url-loader') diff --git a/node_modules/url-loader/CHANGELOG.md b/node_modules/url-loader/CHANGELOG.md new file mode 100644 index 00000000..d1f23f0c --- /dev/null +++ b/node_modules/url-loader/CHANGELOG.md @@ -0,0 +1,122 @@ +# 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. + + +## [1.1.2](https://github.com/webpack-contrib/url-loader/compare/v1.1.0...v1.1.2) (2018-10-10) + + +### Bug Fixes + +* fallback options behaviour ([#145](https://github.com/webpack-contrib/url-loader/issues/145)) ([03e631f](https://github.com/webpack-contrib/url-loader/commit/03e631f)) +* **package:** add support for `webpack =< v3.0.0` (`peerDependencies`) ([#150](https://github.com/webpack-contrib/url-loader/issues/150)) ([a6860fc](https://github.com/webpack-contrib/url-loader/commit/a6860fc)) +* **package:** relax `node` version range (`engines`) ([#155](https://github.com/webpack-contrib/url-loader/issues/155)) ([d37b108](https://github.com/webpack-contrib/url-loader/commit/d37b108)) +* **utils/normalizeFallback:** correctly pass all `options` to the default fallback (`file-loader`) ([#139](https://github.com/webpack-contrib/url-loader/issues/139)) ([401be63](https://github.com/webpack-contrib/url-loader/commit/401be63)) + + + + +## [1.1.1](https://github.com/webpack-contrib/url-loader/compare/v1.1.0...v1.1.1) (2018-08-17) + + +### Bug Fixes + +* correctly pass all `options` to the fallback ([#143](https://github.com/webpack-contrib/url-loader/issues/143)) ([03e631f](https://github.com/webpack-contrib/url-loader/commit/03e631f)) + + + +# [1.1.0](https://github.com/webpack-contrib/url-loader/compare/v1.0.1...v1.1.0) (2018-08-13) + + +### Features + +* support fallback loader in options.fallback ([#123](https://github.com/webpack-contrib/url-loader/issues/123)) ([017adc7](https://github.com/webpack-contrib/url-loader/commit/017adc7)), closes [#118](https://github.com/webpack-contrib/url-loader/issues/118) + + + + +## [1.0.1](https://github.com/webpack-contrib/url-loader/compare/v1.0.0...v1.0.1) (2018-03-03) + + +### Bug Fixes + +* **index:** revert to CJS exports (`module.exports`) ([#116](https://github.com/webpack-contrib/url-loader/issues/116)) ([7b60cc2](https://github.com/webpack-contrib/url-loader/commit/7b60cc2)) + + + + +# [1.0.0](https://github.com/webpack-contrib/url-loader/compare/v1.0.0-beta.0...v1.0.0) (2018-03-03) + + +### Bug Fixes + +* **index:** use `Buffer.from` instead of deprecated `new Buffer` ([#113](https://github.com/webpack-contrib/url-loader/issues/113)) ([457618b](https://github.com/webpack-contrib/url-loader/commit/457618b)) + + + + +# [1.0.0-beta.0](https://github.com/webpack-contrib/url-loader/compare/v0.6.2...v1.0.0-beta.0) (2017-12-17) + + +### Code Refactoring + +* apply `webpack-defaults` ([#102](https://github.com/webpack-contrib/url-loader/issues/102)) ([073b588](https://github.com/webpack-contrib/url-loader/commit/073b588)) + + +### BREAKING CHANGES + +* Sets `engines` to `"node": ">= 6.9.0 || >= 8.9.0"` +* Drops support for `webpack =< v2.0.0` + + + + +## [0.6.2](https://github.com/webpack-contrib/url-loader/compare/v0.6.1...v0.6.2) (2017-10-04) + + +### Bug Fixes + +* allow use `limit` as string ([#96](https://github.com/webpack-contrib/url-loader/issues/96)) ([b31684d](https://github.com/webpack-contrib/url-loader/commit/b31684d)) + + + + +## [0.6.1](https://github.com/webpack-contrib/url-loader/compare/v0.6.0...v0.6.1) (2017-10-04) + + +### Bug Fixes + +* **schema:** allow `additionalProperties` ([#94](https://github.com/webpack-contrib/url-loader/issues/94)) ([2b01ea2](https://github.com/webpack-contrib/url-loader/commit/2b01ea2)) + + + + +# [0.6.0](https://github.com/webpack-contrib/url-loader/compare/v0.5.9...v0.6.0) (2017-10-03) + + +### Features + +* **index:** add options validation (`schema-utils`) ([#78](https://github.com/webpack-contrib/url-loader/issues/78)) ([ced5990](https://github.com/webpack-contrib/url-loader/commit/ced5990)) +* add `fallback` option ([#88](https://github.com/webpack-contrib/url-loader/issues/88)) ([636ebed](https://github.com/webpack-contrib/url-loader/commit/636ebed)) + +### Security + +* Updates Mime pacakge due to Regex DOS security vulnerability ([#87](https://github.com/webpack-contrib/url-loader/issues/87)) ([d19ee2d](https://github.com/webpack-contrib/url-loader/commit/d19ee2d)) + + - Reference issue https://nodesecurity.io/advisories/535 + + + +## [0.5.9](https://github.com/webpack/url-loader/compare/v0.5.8...v0.5.9) (2017-06-12) + + +### Bug Fixes + +* `String` not being `base64` encoded ([#67](https://github.com/webpack/url-loader/issues/67)) ([e9496b9](https://github.com/webpack/url-loader/commit/e9496b9)) +* don't default to `0` (`options.limit`) ([#74](https://github.com/webpack/url-loader/issues/74)) ([020c2a8](https://github.com/webpack/url-loader/commit/020c2a8)) + + + +# 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. diff --git a/node_modules/url-loader/LICENSE b/node_modules/url-loader/LICENSE new file mode 100644 index 00000000..8c11fc72 --- /dev/null +++ b/node_modules/url-loader/LICENSE @@ -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. diff --git a/node_modules/url-loader/README.md b/node_modules/url-loader/README.md new file mode 100644 index 00000000..959d9287 --- /dev/null +++ b/node_modules/url-loader/README.md @@ -0,0 +1,166 @@ +
+ + + +
+ +[![npm][npm]][npm-url] +[![node][node]][node-url] +[![deps][deps]][deps-url] +[![tests][tests]][tests-url] +[![chat][chat]][chat-url] +[![size][size]][size-url] + +# url-loader + +A loader for webpack which transforms files into base64 URIs. + +## Requirements + +This module requires a minimum of Node v6.9.0 and Webpack v4.0.0. + +## Getting Started + +To begin, you'll need to install `url-loader`: + +```console +$ npm install url-loader --save-dev +``` + +`url-loader` works like +[`file-loader`](https://github.com/webpack-contrib/file-loader), but can return +a DataURL if the file is smaller than a byte limit. + + +```js +import img from './image.png' +``` + +```js +// webpack.config.js +module.exports = { + module: { + rules: [ + { + test: /\.(png|jpg|gif)$/i, + use: [ + { + loader: 'url-loader', + options: { + limit: 8192 + } + } + ] + } + ] + } +} +``` + +And run `webpack` via your preferred method. + +## Options + +### `fallback` + +Type: `String` +Default: `'file-loader'` + +Specifies an alternative loader to use when a target file's size exceeds the +limit set in the `limit` option. + +```js +// webpack.config.js +{ + loader: 'url-loader', + options: { + fallback: 'responsive-loader' + } +} +``` + +The fallback loader will receive the same configuration options as url-loader. + +For example, to set the quality option of a responsive-loader above use: + +```js +{ + loader: 'url-loader', + options: { + fallback: 'responsive-loader', + quality: 85 + } +} +``` + +### `limit` + +Type: `Number` +Default: `undefined` + +A `Number` specifying the maximum size of a file in bytes. If the file is +greater than the limit, +[`file-loader`](https://github.com/webpack-contrib/file-loader) is used by +default and all query parameters are passed to it. Using an alternative to +`file-loader` is enabled via the `fallback` option. + +The limit can be specified via loader options and defaults to no limit. + +```js +// webpack.config.js +{ + loader: 'url-loader', + options: { + limit: 8192 + } +} +``` + +### `mimetype` + +Type: `String` +Default: `(file extension)` + +Sets the MIME type for the file to be transformed. If unspecified the file +extensions will be used to lookup the MIME type. + +```js +// webpack.config.js +{ + loader: 'url-loader', + options: { + mimetype: 'image/png' + } +} +``` + +## Contributing + +Please take a moment to read our contributing guidelines if you haven't yet done so. + +[CONTRIBUTING](./.github/CONTRIBUTING.md) + +## License + +[MIT](./LICENSE) + +[npm]: https://img.shields.io/npm/v/url-loader.svg +[npm-url]: https://npmjs.com/package/url-loader + +[node]: https://img.shields.io/node/v/url-loader.svg +[node-url]: https://nodejs.org + +[deps]: https://david-dm.org/webpack-contrib/url-loader.svg +[deps-url]: https://david-dm.org/webpack-contrib/url-loader + +[tests]: https://img.shields.io/circleci/project/github/webpack-contrib/url-loader.svg +[tests-url]: https://circleci.com/gh/webpack-contrib/url-loader + +[cover]: https://codecov.io/gh/webpack-contrib/url-loader/branch/master/graph/badge.svg +[cover-url]: https://codecov.io/gh/webpack-contrib/url-loader + +[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg +[chat-url]: https://gitter.im/webpack/webpack + +[size]: https://packagephobia.now.sh/badge?p=url-loader +[size-url]: https://packagephobia.now.sh/result?p=url-loader diff --git a/node_modules/url-loader/dist/cjs.js b/node_modules/url-loader/dist/cjs.js new file mode 100644 index 00000000..294238e2 --- /dev/null +++ b/node_modules/url-loader/dist/cjs.js @@ -0,0 +1,6 @@ +'use strict'; + +const loader = require('./index'); + +module.exports = loader.default; +module.exports.raw = loader.raw; \ No newline at end of file diff --git a/node_modules/url-loader/dist/index.js b/node_modules/url-loader/dist/index.js new file mode 100644 index 00000000..f722ab25 --- /dev/null +++ b/node_modules/url-loader/dist/index.js @@ -0,0 +1,77 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.raw = undefined; +exports.default = loader; + +var _loaderUtils = require('loader-utils'); + +var _schemaUtils = require('schema-utils'); + +var _schemaUtils2 = _interopRequireDefault(_schemaUtils); + +var _mime = require('mime'); + +var _mime2 = _interopRequireDefault(_mime); + +var _normalizeFallback = require('./utils/normalizeFallback'); + +var _normalizeFallback2 = _interopRequireDefault(_normalizeFallback); + +var _options = require('./options.json'); + +var _options2 = _interopRequireDefault(_options); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Loader Mode +const raw = exports.raw = true; /* eslint-disable + global-require, + no-param-reassign, + prefer-destructuring, + import/no-dynamic-require, + */ +function loader(src) { + // Loader Options + const options = (0, _loaderUtils.getOptions)(this) || {}; + + (0, _schemaUtils2.default)(_options2.default, options, 'URL Loader'); + + const file = this.resourcePath; + // Set limit for resource inlining (file size) + let limit = options.limit; + + if (limit) { + limit = parseInt(limit, 10); + } + // Get MIME type + const mimetype = options.mimetype || _mime2.default.getType(file); + + // No limit or within the specified limit + if (!limit || src.length < limit) { + if (typeof src === 'string') { + src = Buffer.from(src); + } + + return `module.exports = ${JSON.stringify(`data:${mimetype || ''};base64,${src.toString('base64')}`)}`; + } + + // Normalize the fallback. + const { + loader: fallbackLoader, + options: fallbackOptions + } = (0, _normalizeFallback2.default)(options.fallback, options); + + // Require the fallback. + const fallback = require(fallbackLoader); + + // Call the fallback, passing a copy of the loader context. The copy has the query replaced. This way, the fallback + // loader receives the query which was intended for it instead of the query which was intended for url-loader. + const fallbackLoaderContext = Object.assign({}, this, { + query: fallbackOptions + }); + + return fallback.call(fallbackLoaderContext, src); +} \ No newline at end of file diff --git a/node_modules/url-loader/dist/options.json b/node_modules/url-loader/dist/options.json new file mode 100644 index 00000000..743e136f --- /dev/null +++ b/node_modules/url-loader/dist/options.json @@ -0,0 +1,40 @@ +{ + "type": "object", + "properties": { + "limit": { + "type": ["string", "number"] + }, + "mimetype": { + "type": "string" + }, + "fallback": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "loader": { + "description": "Fallback loader name", + "type": "string" + }, + "options": { + "description": "Fallback loader options", + "anyOf": [ + { + "type": "object" + }, + { + "type": "string" + } + ] + } + }, + "type": "object" + } + ] + } + }, + "additionalProperties": true +} diff --git a/node_modules/url-loader/dist/utils/normalizeFallback.js b/node_modules/url-loader/dist/utils/normalizeFallback.js new file mode 100644 index 00000000..61563d5a --- /dev/null +++ b/node_modules/url-loader/dist/utils/normalizeFallback.js @@ -0,0 +1,38 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = normalizeFallback; + +var _loaderUtils = require('loader-utils'); + +var _loaderUtils2 = _interopRequireDefault(_loaderUtils); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function normalizeFallback(fallback, originalOptions) { + let loader = 'file-loader'; + let options = {}; + + if (typeof fallback === 'string') { + loader = fallback; + + const index = fallback.indexOf('?'); + + if (index >= 0) { + loader = fallback.substr(0, index); + options = _loaderUtils2.default.parseQuery(fallback.substr(index)); + } + } + + if (fallback !== null && typeof fallback === 'object') { + ({ loader, options } = fallback); + } + + options = Object.assign({}, originalOptions, options); + + delete options.fallback; + + return { loader, options }; +} \ No newline at end of file diff --git a/node_modules/url-loader/node_modules/.bin/mime b/node_modules/url-loader/node_modules/.bin/mime new file mode 120000 index 00000000..210a0bd4 --- /dev/null +++ b/node_modules/url-loader/node_modules/.bin/mime @@ -0,0 +1 @@ +../../../mime/cli.js \ No newline at end of file diff --git a/node_modules/url-loader/node_modules/.bin/webpack b/node_modules/url-loader/node_modules/.bin/webpack new file mode 120000 index 00000000..8a1900f6 --- /dev/null +++ b/node_modules/url-loader/node_modules/.bin/webpack @@ -0,0 +1 @@ +../../../webpack/bin/webpack.js \ No newline at end of file diff --git a/node_modules/url-loader/node_modules/schema-utils/CHANGELOG.md b/node_modules/url-loader/node_modules/schema-utils/CHANGELOG.md new file mode 100644 index 00000000..a5f2834c --- /dev/null +++ b/node_modules/url-loader/node_modules/schema-utils/CHANGELOG.md @@ -0,0 +1,134 @@ +# 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. + + +# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07) + + +### Features + +* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef)) + + + + +## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07) + + +### Bug Fixes + +* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4)) + + + + +## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06) + + +### Bug Fixes + +* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81)) +* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5)) + + + + +## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13) + + +### Bug Fixes + +* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f)) +* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba)) + + + + +## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13) + + +### Bug Fixes + +* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6)) + + + + +## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14) + + +### Bug Fixes + +* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda)) +* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791)) + + + + +## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09) + + +### Bug Fixes + +* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e)) + + + + +## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03) + + +### Bug Fixes + +* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974)) + + + + +# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28) + + +### Features + +* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816)) + + + + +# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29) + + +### Features + +* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb)) + + + + +## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13) + + +### Bug Fixes + +* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363)) +* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f)) + + + + +# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12) + + +# 0.1.0 (2017-03-07) + + +### Features + +* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b)) + + + +# 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. diff --git a/node_modules/url-loader/node_modules/schema-utils/LICENSE b/node_modules/url-loader/node_modules/schema-utils/LICENSE new file mode 100644 index 00000000..8c11fc72 --- /dev/null +++ b/node_modules/url-loader/node_modules/schema-utils/LICENSE @@ -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. diff --git a/node_modules/url-loader/node_modules/schema-utils/README.md b/node_modules/url-loader/node_modules/schema-utils/README.md new file mode 100644 index 00000000..7b75d549 --- /dev/null +++ b/node_modules/url-loader/node_modules/schema-utils/README.md @@ -0,0 +1,149 @@ +[![npm][npm]][npm-url] +[![node][node]][node-url] +[![deps][deps]][deps-url] +[![test][test]][test-url] +[![coverage][cover]][cover-url] +[![chat][chat]][chat-url] + +
+ + + + + + +

Schema Utils

+
+ +

Install

+ +```bash +npm i schema-utils +``` + +

Usage

+ +### `validateOptions` + +**`schema.json`** +```js +{ + "type": "object", + "properties": { + // Options... + }, + "additionalProperties": false +} +``` + +#### Error Messages (Custom) + +**`schema.json`** +```js +{ + "type": "object", + "properties": { + "option": { + "type": [ "boolean" ] + } + }, + // Overrides the default err.message for option + "errorMessage": { + "option": "should be {Boolean} (https:/github.com/org/repo#anchor)" + } + "additionalProperties": false +} +``` + +```js +import schema from 'path/to/schema.json' +import validateOptions from 'schema-utils' + +validateOptions(schema, options, 'Loader/Plugin Name') +``` + +

Examples

+ +**schema.json** +```json +{ + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "test": { + "anyOf": [ + { "type": "array" }, + { "type": "string" }, + { "instanceof": "RegExp" } + ] + }, + "transform": { + "instanceof": "Function" + }, + "sourceMap": { + "type": "boolean" + } + }, + "additionalProperties": false +} +``` + +### `Loader` + +```js +import { getOptions } from 'loader-utils' +import validateOptions from 'schema-utils' + +import schema from 'path/to/schema.json' + +function loader (src, map) { + const options = getOptions(this) || {} + + validateOptions(schema, options, 'Loader Name') + + // Code... +} +``` + +### `Plugin` + +```js +import validateOptions from 'schema-utils' + +import schema from 'path/to/schema.json' + +class Plugin { + constructor (options) { + validateOptions(schema, options, 'Plugin Name') + + this.options = options + } + + apply (compiler) { + // Code... + } +} +``` + + +[npm]: https://img.shields.io/npm/v/schema-utils.svg +[npm-url]: https://npmjs.com/package/schema-utils + +[node]: https://img.shields.io/node/v/schema-utils.svg +[node-url]: https://nodejs.org + +[deps]: https://david-dm.org/webpack-contrib/schema-utils.svg +[deps-url]: https://david-dm.org/webpack-contrib/schema-utils + +[test]: http://img.shields.io/travis/webpack-contrib/schema-utils.svg +[test-url]: https://travis-ci.org/webpack-contrib/schema-utils + +[cover]: https://codecov.io/gh/webpack-contrib/schema-utils/branch/master/graph/badge.svg +[cover-url]: https://codecov.io/gh/webpack-contrib/schema-utils + +[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg +[chat-url]: https://gitter.im/webpack/webpack diff --git a/node_modules/url-loader/node_modules/schema-utils/package.json b/node_modules/url-loader/node_modules/schema-utils/package.json new file mode 100644 index 00000000..621da697 --- /dev/null +++ b/node_modules/url-loader/node_modules/schema-utils/package.json @@ -0,0 +1,41 @@ +{ + "name": "schema-utils", + "version": "1.0.0", + "description": "webpack Validation Utils", + "main": "src/index.js", + "files": [ + "src" + ], + "engines": { + "node": ">= 4" + }, + "scripts": { + "lint": "eslint --cache src test", + "test": "jest --env node --verbose --coverage", + "clean": "del-cli coverage", + "commits": "commitlint --from $(git rev-list --tags --max-count=1)", + "release": "npm run commits && standard-version" + }, + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "devDependencies": { + "@commitlint/cli": "^7.0.0", + "@commitlint/config-conventional": "^7.0.0", + "@webpack-contrib/eslint-config-webpack": "^2.0.0", + "del-cli": "^1.0.0", + "eslint": "^5.0.0", + "eslint-plugin-import": "^2.0.0", + "eslint-plugin-prettier": "^2.0.0", + "jest": "^21.0.0", + "prettier": "^1.0.0", + "standard-version": "^4.0.0" + }, + "author": "webpack Contrib (https://github.com/webpack-contrib)", + "bugs": "https://github.com/webpack-contrib/schema-utils/issues", + "homepage": "https://github.com/webpack-contrib/schema-utils", + "repository": "https://github.com/webpack-contrib/schema-utils", + "license": "MIT" +} diff --git a/node_modules/url-loader/node_modules/schema-utils/src/ValidationError.js b/node_modules/url-loader/node_modules/schema-utils/src/ValidationError.js new file mode 100644 index 00000000..0589bf85 --- /dev/null +++ b/node_modules/url-loader/node_modules/schema-utils/src/ValidationError.js @@ -0,0 +1,30 @@ +/* eslint-disable + strict, + no-param-reassign +*/ + +'use strict'; + +class ValidationError extends Error { + constructor(errors, name) { + super(); + + this.name = 'ValidationError'; + + this.message = `${name || ''} Invalid Options\n\n`; + + this.errors = errors.map((err) => { + err.dataPath = err.dataPath.replace(/\//g, '.'); + + return err; + }); + + this.errors.forEach((err) => { + this.message += `options${err.dataPath} ${err.message}\n`; + }); + + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = ValidationError; diff --git a/node_modules/url-loader/node_modules/schema-utils/src/index.js b/node_modules/url-loader/node_modules/schema-utils/src/index.js new file mode 100644 index 00000000..13108c21 --- /dev/null +++ b/node_modules/url-loader/node_modules/schema-utils/src/index.js @@ -0,0 +1,9 @@ +/* eslint-disable + strict +*/ + +'use strict'; + +const validateOptions = require('./validateOptions'); + +module.exports = validateOptions; diff --git a/node_modules/url-loader/node_modules/schema-utils/src/validateOptions.js b/node_modules/url-loader/node_modules/schema-utils/src/validateOptions.js new file mode 100644 index 00000000..363af447 --- /dev/null +++ b/node_modules/url-loader/node_modules/schema-utils/src/validateOptions.js @@ -0,0 +1,38 @@ +/* eslint-disable + strict, + no-param-reassign +*/ + +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +const Ajv = require('ajv'); +const errors = require('ajv-errors'); +const keywords = require('ajv-keywords'); + +const ValidationError = require('./ValidationError'); + +const ajv = new Ajv({ + allErrors: true, + jsonPointers: true, +}); + +errors(ajv); +keywords(ajv, ['instanceof', 'typeof']); + +const validateOptions = (schema, options, name) => { + if (typeof schema === 'string') { + schema = fs.readFileSync(path.resolve(schema), 'utf8'); + schema = JSON.parse(schema); + } + + if (!ajv.validate(schema, options)) { + throw new ValidationError(ajv.errors, name); + } + + return true; +}; + +module.exports = validateOptions; diff --git a/node_modules/url-loader/package.json b/node_modules/url-loader/package.json new file mode 100644 index 00000000..90250a13 --- /dev/null +++ b/node_modules/url-loader/package.json @@ -0,0 +1,96 @@ +{ + "name": "url-loader", + "version": "1.1.2", + "description": "A loader for webpack which transforms files into base64 URIs", + "license": "MIT", + "repository": "webpack-contrib/url-loader", + "author": "Tobias Koppers @sokra", + "homepage": "https://github.com/webpack-contrib/url-loader", + "bugs": "https://github.com/webpack-contrib/url-loader/issues", + "bin": "", + "main": "dist/cjs.js", + "engines": { + "node": ">= 6.9.0" + }, + "scripts": { + "start": "npm run build -- -w", + "build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js' --copy-files", + "clean": "del-cli dist", + "commitlint": "commitlint", + "commitmsg": "commitlint -e $GIT_PARAMS", + "lint": "eslint --cache src test", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "lint-staged": "lint-staged", + "prebuild": "npm run clean", + "prepublish": "npm run build", + "release": "standard-version", + "release:ci": "conventional-github-releaser -p angular", + "release:validate": "commitlint --from=$(git describe --tags --abbrev=0) --to=$(git rev-parse HEAD)", + "security": "nsp check", + "test": "jest", + "test:watch": "jest --watch", + "test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage", + "ci:lint": "npm run lint && npm run security", + "ci:test": "npm run test -- --runInBand", + "ci:coverage": "npm run test:coverage -- --runInBand", + "defaults": "webpack-defaults" + }, + "files": [ + "dist" + ], + "peerDependencies": { + "webpack": "^3.0.0 || ^4.0.0" + }, + "dependencies": { + "loader-utils": "^1.1.0", + "mime": "^2.0.3", + "schema-utils": "^1.0.0" + }, + "devDependencies": { + "@commitlint/cli": "^5.2.5", + "@commitlint/config-angular": "^5.1.1", + "@commitlint/config-conventional": "^7.0.1", + "@webpack-contrib/defaults": "^2.4.0", + "@webpack-contrib/eslint-config-webpack": "^2.0.2", + "@webpack-contrib/test-utils": "^0.1.2", + "babel-cli": "^6.26.0", + "babel-jest": "^22.0.3", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "^1.6.1", + "conventional-github-releaser": "^2.0.0", + "cross-env": "^5.1.1", + "del": "^3.0.0", + "del-cli": "^1.1.0", + "eslint": "^4.13.1", + "eslint-plugin-import": "^2.8.0", + "eslint-plugin-prettier": "^2.4.0", + "file-loader": "^1.1.6", + "husky": "^0.14.3", + "jest": "^22.0.3", + "jest-serializer-path": "^0.1.15", + "lint-staged": "^6.0.0", + "memory-fs": "^0.4.1", + "nsp": "^3.1.0", + "pre-commit": "^1.2.2", + "prettier": "^1.9.2", + "standard-version": "^4.2.0", + "webpack": "^4.0.0" + }, + "keywords": [ + "webpack" + ], + "jest": { + "snapshotSerializers": [ + "jest-serializer-path" + ], + "testEnvironment": "node" + }, + "pre-commit": "lint-staged", + "lint-staged": { + "*.js": [ + "eslint --fix", + "git add" + ] + } +} -- cgit v1.2.3