初始化代码
This commit is contained in:
134
uniapp/uni-app/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
134
uniapp/uni-app/node_modules/schema-utils/CHANGELOG.md
generated
vendored
Normal file
@@ -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.
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
# [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))
|
||||
|
||||
|
||||
|
||||
<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.
|
||||
20
uniapp/uni-app/node_modules/schema-utils/LICENSE
generated
vendored
Normal file
20
uniapp/uni-app/node_modules/schema-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.
|
||||
149
uniapp/uni-app/node_modules/schema-utils/README.md
generated
vendored
Normal file
149
uniapp/uni-app/node_modules/schema-utils/README.md
generated
vendored
Normal file
@@ -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]
|
||||
|
||||
<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
|
||||
}
|
||||
```
|
||||
|
||||
#### 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')
|
||||
```
|
||||
|
||||
<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
|
||||
78
uniapp/uni-app/node_modules/schema-utils/package.json
generated
vendored
Normal file
78
uniapp/uni-app/node_modules/schema-utils/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"schema-utils@1.0.0",
|
||||
"C:\\Users\\Administrator\\Desktop\\wechat农场"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "schema-utils@1.0.0",
|
||||
"_id": "schema-utils@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
|
||||
"_location": "/schema-utils",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "schema-utils@1.0.0",
|
||||
"name": "schema-utils",
|
||||
"escapedName": "schema-utils",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/postcss-loader"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "C:\\Users\\Administrator\\Desktop\\wechat农场",
|
||||
"author": {
|
||||
"name": "webpack Contrib",
|
||||
"url": "https://github.com/webpack-contrib"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/webpack-contrib/schema-utils/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": "^6.1.0",
|
||||
"ajv-errors": "^1.0.0",
|
||||
"ajv-keywords": "^3.1.0"
|
||||
},
|
||||
"description": "webpack Validation Utils",
|
||||
"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"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4"
|
||||
},
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"homepage": "https://github.com/webpack-contrib/schema-utils",
|
||||
"license": "MIT",
|
||||
"main": "src/index.js",
|
||||
"name": "schema-utils",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/webpack-contrib/schema-utils.git"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "del-cli coverage",
|
||||
"commits": "commitlint --from $(git rev-list --tags --max-count=1)",
|
||||
"lint": "eslint --cache src test",
|
||||
"release": "npm run commits && standard-version",
|
||||
"test": "jest --env node --verbose --coverage"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
30
uniapp/uni-app/node_modules/schema-utils/src/ValidationError.js
generated
vendored
Normal file
30
uniapp/uni-app/node_modules/schema-utils/src/ValidationError.js
generated
vendored
Normal file
@@ -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;
|
||||
9
uniapp/uni-app/node_modules/schema-utils/src/index.js
generated
vendored
Normal file
9
uniapp/uni-app/node_modules/schema-utils/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/* eslint-disable
|
||||
strict
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const validateOptions = require('./validateOptions');
|
||||
|
||||
module.exports = validateOptions;
|
||||
38
uniapp/uni-app/node_modules/schema-utils/src/validateOptions.js
generated
vendored
Normal file
38
uniapp/uni-app/node_modules/schema-utils/src/validateOptions.js
generated
vendored
Normal file
@@ -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;
|
||||
Reference in New Issue
Block a user