diff options
Diffstat (limited to 'node_modules/schema-utils')
| -rw-r--r-- | node_modules/schema-utils/CHANGELOG.md | 124 | ||||
| -rw-r--r-- | node_modules/schema-utils/LICENSE | 20 | ||||
| -rw-r--r-- | node_modules/schema-utils/README.md | 130 | ||||
| -rw-r--r-- | node_modules/schema-utils/package.json | 40 | ||||
| -rw-r--r-- | node_modules/schema-utils/src/ValidationError.js | 25 | ||||
| -rw-r--r-- | node_modules/schema-utils/src/index.js | 9 | ||||
| -rw-r--r-- | node_modules/schema-utils/src/validateOptions.js | 37 |
7 files changed, 0 insertions, 385 deletions
diff --git a/node_modules/schema-utils/CHANGELOG.md b/node_modules/schema-utils/CHANGELOG.md deleted file mode 100644 index 9c0bfd45..00000000 --- a/node_modules/schema-utils/CHANGELOG.md +++ /dev/null @@ -1,124 +0,0 @@ -# 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="0.4.7"></a> -## [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)) - - - -<a name="0.4.6"></a> -## [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)) - - - -<a name="0.4.5"></a> -## [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)) - - - -<a name="0.4.4"></a> -## [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)) - - - -<a name="0.4.3"></a> -## [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)) - - - -<a name="0.4.2"></a> -## [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)) - - - -<a name="0.4.1"></a> -## [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)) - - - -<a name="0.4.0"></a> -# [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)) - - - -<a name="0.3.0"></a> -# [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)) - - - -<a name="0.2.1"></a> -## [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)) - - - -<a name="0.2.0"></a> -# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12) - -<a name="0.1.0"></a> -# 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/schema-utils/LICENSE b/node_modules/schema-utils/LICENSE deleted file mode 100644 index 8c11fc72..00000000 --- a/node_modules/schema-utils/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -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/schema-utils/README.md b/node_modules/schema-utils/README.md deleted file mode 100644 index 2c4d9967..00000000 --- a/node_modules/schema-utils/README.md +++ /dev/null @@ -1,130 +0,0 @@ -[![npm][npm]][npm-url] -[![node][node]][node-url] -[![deps][deps]][deps-url] -[![test][test]][test-url] -[![coverage][cover]][cover-url] -[![chat][chat]][chat-url] - -<div align="center"> - <a href="http://json-schema.org"> - <img width="160" height="160" - src="https://raw.githubusercontent.com/webpack-contrib/schema-utils/master/docs/logo.png"> - </a> - <a href="https://github.com/webpack/webpack"> - <img width="200" height="200" - src="https://webpack.js.org/assets/icon-square-big.svg"> - </a> - <h1>Schema Utils</h1> -</div> - -<h2 align="center">Install</h2> - -```bash -npm i schema-utils -``` - -<h2 align="center">Usage</h2> - -### `validateOptions` - -**schema.json** -```js -{ - "type": "object", - "properties": { - // Options... - }, - "additionalProperties": false -} -``` - -```js -import schema from 'path/to/schema.json' -import validateOptions from 'schema-utils' - -validateOptions(schema, options, 'Loader/Plugin Name') -``` - -<h2 align="center">Examples</h2> - -**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/schema-utils/package.json b/node_modules/schema-utils/package.json deleted file mode 100644 index ab2bf607..00000000 --- a/node_modules/schema-utils/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "schema-utils", - "version": "0.4.7", - "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-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/schema-utils/src/ValidationError.js b/node_modules/schema-utils/src/ValidationError.js deleted file mode 100644 index 21264b5c..00000000 --- a/node_modules/schema-utils/src/ValidationError.js +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable - strict -*/ - -'use strict'; - -class ValidationError extends Error { - constructor(errors, name) { - super(); - - this.name = 'ValidationError'; - - this.message = `${name || ''} Invalid Options\n\n`; - - errors.forEach((err) => { - this.message += `options${err.dataPath} ${err.message}\n`; - }); - - this.errors = errors; - - Error.captureStackTrace(this, this.constructor); - } -} - -module.exports = ValidationError; diff --git a/node_modules/schema-utils/src/index.js b/node_modules/schema-utils/src/index.js deleted file mode 100644 index 13108c21..00000000 --- a/node_modules/schema-utils/src/index.js +++ /dev/null @@ -1,9 +0,0 @@ -/* eslint-disable - strict -*/ - -'use strict'; - -const validateOptions = require('./validateOptions'); - -module.exports = validateOptions; diff --git a/node_modules/schema-utils/src/validateOptions.js b/node_modules/schema-utils/src/validateOptions.js deleted file mode 100644 index f6d9f22f..00000000 --- a/node_modules/schema-utils/src/validateOptions.js +++ /dev/null @@ -1,37 +0,0 @@ -/* eslint-disable - strict, - no-param-reassign -*/ - -'use strict'; - -const fs = require('fs'); -const path = require('path'); - -const Ajv = require('ajv'); -const ajvKeywords = require('ajv-keywords'); - -const ValidationError = require('./ValidationError'); - -const ajv = new Ajv({ - allErrors: true, - useDefaults: true, - errorDataPath: 'property', -}); - -ajvKeywords(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; |
