Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# 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.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.

View 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.

View File

@@ -0,0 +1,109 @@
[![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">
<!-- src="https://webpack-contrib.github.io/schema-utils/logo.png" -->
<img width="180" height="180"
src="https://raw.githubusercontent.com/json-schema-org/json-schema-org.github.io/master/img/logo.png">
</a>
<a href="https://github.com/webpack/webpack">
<img width="200" height="200" hspace="10"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
<h1>Schema Utils</h1>
</div>
<h2 align="center">Install</h2>
```bash
npm install --save schema-utils
```
<h2 align="center">Usage</h2>
### `validateOptions`
```js
import validateOptions from 'schema-utils'
validateOptions('path/to/schema.json', options, 'Loader/Plugin Name')
```
<h2 align="center">Examples</h2>
### Loader
```js
import { getOptions } from 'loader-utils'
import validateOptions from 'schema-utils'
function loader (src, map) {
const options = getOptions(this) || {}
validateOptions('path/to/schema.json', options, 'Loader Name')
}
```
### Plugin
```js
import Tapable from 'tapable'
import validateOptions from 'schema-utils'
class Plugin extends Tapable {
constructor (options) {
validateOptions('path/to/schema.json', options, 'Plugin Name')
}
}
```
<h2 align="center">Maintainers</h2>
<table>
<tbody>
<tr>
<td align="center">
<img width="150" height="150"
src="https://github.com/bebraw.png?v=3&s=150">
</br>
<a href="https://github.com/bebraw">Juho Vepsäläinen</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://github.com/d3viant0ne.png?v=3&s=150">
</br>
<a href="https://github.com/d3viant0ne">Joshua Wiens</a>
</td>
<td align="center">
<img width="150" height="150"
src="https://github.com/michael-ciniawsky.png?v=3&s=150">
</br>
<a href="https://github.com/michael-ciniawsky">Michael Ciniawsky</a>
</td>
</tr>
<tbody>
</table>
[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

View File

@@ -0,0 +1,38 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var ValidationError = function (_Error) {
_inherits(ValidationError, _Error);
function ValidationError(err, name) {
var _ret;
_classCallCheck(this, ValidationError);
var _this = _possibleConstructorReturn(this, (ValidationError.__proto__ || Object.getPrototypeOf(ValidationError)).call(this, err));
_this.err = err;
_this.stack = false;
_this.message = 'Validation Error\n\n' + String(name || '') + ' Invalid Options\n\n';
err.forEach(function (msg) {
_this.message += 'options' + String(msg.dataPath) + ' ' + String(msg.message) + '\n';
});
return _ret = _this, _possibleConstructorReturn(_this, _ret);
}
return ValidationError;
}(Error);
exports.default = ValidationError;

View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('./index').default;

View File

@@ -0,0 +1,13 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _validateOptions = require('./validateOptions');
var _validateOptions2 = _interopRequireDefault(_validateOptions);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _validateOptions2.default;

View File

@@ -0,0 +1,46 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _ajv = require('ajv');
var _ajv2 = _interopRequireDefault(_ajv);
var _ValidationError = require('./ValidationError');
var _ValidationError2 = _interopRequireDefault(_ValidationError);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// eslint-disable-line
var validateOptions = function validateOptions(schema, options, name) {
var ajv = new _ajv2.default({
useDefaults: true,
allErrors: true,
errorDataPath: 'property'
});
if (typeof schema === 'string') {
schema = _fs2.default.readFileSync(_path2.default.resolve(schema), 'utf8'); // eslint-disable-line
schema = JSON.parse(schema); // eslint-disable-line
}
if (!ajv.validate(schema, options)) {
throw new _ValidationError2.default(ajv.errors, name);
}
return true;
};
exports.default = validateOptions;

View File

@@ -0,0 +1,122 @@
{
"_from": "schema-utils@^0.3.0",
"_id": "schema-utils@0.3.0",
"_inBundle": false,
"_integrity": "sha1-9YdyIs4+kx7a4DnxfrNxbnE3+M8=",
"_location": "/schema-utils",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "schema-utils@^0.3.0",
"name": "schema-utils",
"escapedName": "schema-utils",
"rawSpec": "^0.3.0",
"saveSpec": null,
"fetchSpec": "^0.3.0"
},
"_requiredBy": [
"/extract-text-webpack-plugin",
"/style-loader"
],
"_resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.3.0.tgz",
"_shasum": "f5877222ce3e931edae039f17eb3716e7137f8cf",
"_spec": "schema-utils@^0.3.0",
"_where": "D:\\developments\\teaser-inertia\\nova-components\\NovaLeader\\node_modules\\extract-text-webpack-plugin",
"author": {
"name": "Webpack Contrib",
"url": "https://github.com/webpack-contrib"
},
"bugs": {
"url": "https://github.com/webpack-contrib/schema-utils/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Juho Vepsäläinen",
"email": "@bebraw"
},
{
"name": "Joshua Wiens",
"email": "@d3viant0ne"
},
{
"name": "Michael Ciniawsky",
"email": "@michael-ciniawsky"
}
],
"dependencies": {
"ajv": "^5.0.0"
},
"deprecated": false,
"description": "Webpack Schema Validation Utilities",
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-jest": "^19.0.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.4.0",
"babel-preset-webpack": "^1.0.0",
"codecov": "^2.0.1",
"cross-env": "^4.0.0",
"del-cli": "^0.2.1",
"eslint": "^3.19.0",
"eslint-config-webpack": "^1.2.1",
"eslint-plugin-import": "^2.2.0",
"jest": "^19.0.2",
"lint-staged": "^3.4.0",
"nsp": "^2.6.3",
"pre-commit": "^1.2.2",
"standard-version": "^4.0.0",
"webpack-defaults": "^0.4.5"
},
"engines": {
"node": ">= 4.3 < 5.0.0 || >= 5.10"
},
"eslintConfig": {
"extends": "webpack",
"installedESLint": true
},
"files": [
"dist"
],
"homepage": "https://github.com/webpack-contrib/schema-utils#readme",
"keywords": [
"webpack",
"plugin",
"es2015"
],
"license": "MIT",
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
},
"main": "dist/cjs.js",
"name": "schema-utils",
"pre-commit": "lint-staged",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack-contrib/schema-utils.git"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js'",
"clean": "del-cli dist",
"lint": "eslint --cache src test",
"lint-staged": "lint-staged",
"prebuild": "yarn run clean",
"prepublish": "yarn run build",
"release": "yarn run standard-version",
"security": "nsp check",
"start": "yarn run build -- -w",
"test": "jest",
"test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage",
"test:watch": "jest --watch",
"travis:coverage": "yarn run test:coverage",
"travis:lint": "yarn run lint && yarn run security",
"travis:test": "yarn run test",
"webpack-defaults": "webpack-defaults"
},
"version": "0.3.0"
}