schema-utils
Advanced tools
Comparing version 2.7.1 to 3.0.0
@@ -5,2 +5,11 @@ # Changelog | ||
## [3.0.0](https://github.com/webpack/schema-utils/compare/v2.7.1...v3.0.0) (2020-10-05) | ||
### ⚠ BREAKING CHANGES | ||
* minimum supported `Node.js` version is `10.13.0`, | ||
* the packages exports was changed, please use `const { validate } = require('schema-utils');` | ||
* the `ValidateError` export was removed in favor the `ValidationError` export, please use `const { ValidationError } = require('schema-utils');` | ||
### [2.7.1](https://github.com/webpack/schema-utils/compare/v2.7.0...v2.7.1) (2020-08-31) | ||
@@ -7,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
declare const _exports: typeof import('./validate').default; | ||
export = _exports; | ||
export const validate: typeof import('./validate').validate; | ||
export const ValidationError: typeof import('./ValidationError').default; |
@@ -1,2 +0,1 @@ | ||
export default validate; | ||
export type JSONSchema4 = import('json-schema').JSONSchema4; | ||
@@ -34,3 +33,3 @@ export type JSONSchema6 = import('json-schema').JSONSchema6; | ||
*/ | ||
declare function validate( | ||
export function validate( | ||
schema: Schema, | ||
@@ -40,6 +39,3 @@ options: Array<object> | object, | ||
): void; | ||
declare namespace validate { | ||
export { ValidationError }; | ||
export { ValidationError as ValidateError }; | ||
} | ||
import ValidationError from './ValidationError'; | ||
export { ValidationError }; |
"use strict"; | ||
const validate = require('./validate'); | ||
const { | ||
validate, | ||
ValidationError | ||
} = require('./validate'); | ||
module.exports = validate.default; | ||
module.exports = { | ||
validate, | ||
ValidationError | ||
}; |
@@ -6,3 +6,9 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports.validate = validate; | ||
Object.defineProperty(exports, "ValidationError", { | ||
enumerable: true, | ||
get: function () { | ||
return _ValidationError.default; | ||
} | ||
}); | ||
@@ -157,8 +163,2 @@ var _absolutePath = _interopRequireDefault(require("./keywords/absolutePath")); | ||
return newErrors; | ||
} // TODO change after resolve https://github.com/microsoft/TypeScript/issues/34994 | ||
validate.ValidationError = _ValidationError.default; | ||
validate.ValidateError = _ValidationError.default; | ||
var _default = validate; | ||
exports.default = _default; | ||
} |
{ | ||
"name": "schema-utils", | ||
"version": "2.7.1", | ||
"version": "3.0.0", | ||
"description": "webpack Validation Utils", | ||
@@ -17,3 +17,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 8.9.0" | ||
"node": ">= 10.13.0" | ||
}, | ||
@@ -47,28 +47,28 @@ "scripts": { | ||
"dependencies": { | ||
"ajv": "^6.12.4", | ||
"ajv": "^6.12.5", | ||
"ajv-keywords": "^3.5.2", | ||
"@types/json-schema": "^7.0.5" | ||
"@types/json-schema": "^7.0.6" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.10.5", | ||
"@babel/core": "^7.11.4", | ||
"@babel/preset-env": "^7.11.0", | ||
"@commitlint/cli": "^10.0.0", | ||
"@commitlint/config-conventional": "^10.0.0", | ||
"@babel/cli": "^7.11.6", | ||
"@babel/core": "^7.11.6", | ||
"@babel/preset-env": "^7.11.5", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@webpack-contrib/defaults": "^6.3.0", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"babel-jest": "^25.5.1", | ||
"cross-env": "^6.0.3", | ||
"del": "^5.1.0", | ||
"babel-jest": "^26.5.0", | ||
"cross-env": "^7.0.2", | ||
"del": "^6.0.0", | ||
"del-cli": "^3.0.1", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"husky": "^4.2.5", | ||
"jest": "^25.5.4", | ||
"lint-staged": "^10.2.13", | ||
"eslint": "^7.10.0", | ||
"eslint-config-prettier": "^6.12.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"husky": "^4.3.0", | ||
"jest": "^26.5.0", | ||
"lint-staged": "^10.4.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^1.19.1", | ||
"prettier": "^2.1.2", | ||
"standard-version": "^9.0.0", | ||
"typescript": "^4.0.2" | ||
"typescript": "^4.0.3" | ||
}, | ||
@@ -75,0 +75,0 @@ "keywords": [ |
@@ -50,3 +50,3 @@ <div align="center"> | ||
import schema from './path/to/schema.json'; | ||
import validate from 'schema-utils'; | ||
import { validate } from 'schema-utils'; | ||
@@ -87,9 +87,8 @@ const options = { option: true }; | ||
```js | ||
validate( | ||
schema, | ||
{ | ||
name: 123, | ||
}, | ||
{ name: 'MyPlugin' } | ||
); | ||
import schema from './path/to/schema.json'; | ||
import { validate } from 'schema-utils'; | ||
const options = { foo: 'bar' }; | ||
validate(schema, { name: 123 }, { name: 'MyPlugin' }); | ||
``` | ||
@@ -129,2 +128,7 @@ | ||
```js | ||
import schema from './path/to/schema.json'; | ||
import { validate } from 'schema-utils'; | ||
const options = { foo: 'bar' }; | ||
validate(schema, options, { name: 'MyPlugin' }); | ||
@@ -146,2 +150,7 @@ ``` | ||
```js | ||
import schema from './path/to/schema.json'; | ||
import { validate } from 'schema-utils'; | ||
const options = { foo: 'bar' }; | ||
validate(schema, options, { name: 'MyPlugin', baseDataPath: 'options' }); | ||
@@ -163,2 +172,7 @@ ``` | ||
```js | ||
import schema from './path/to/schema.json'; | ||
import { validate } from 'schema-utils'; | ||
const options = { foo: 'bar' }; | ||
validate(schema, options, { | ||
@@ -215,3 +229,3 @@ name: 'MyPlugin', | ||
import { getOptions } from 'loader-utils'; | ||
import validateOptions from 'schema-utils'; | ||
import { validate } from 'schema-utils'; | ||
@@ -221,5 +235,5 @@ import schema from 'path/to/schema.json'; | ||
function loader(src, map) { | ||
const options = getOptions(this) || {}; | ||
const options = getOptions(this); | ||
validateOptions(schema, options, { | ||
validate(schema, options, { | ||
name: 'Loader Name', | ||
@@ -238,3 +252,3 @@ baseDataPath: 'options', | ||
```js | ||
import validateOptions from 'schema-utils'; | ||
import { validate } from 'schema-utils'; | ||
@@ -245,3 +259,3 @@ import schema from 'path/to/schema.json'; | ||
constructor(options) { | ||
validateOptions(schema, options, { | ||
validate(schema, options, { | ||
name: 'Plugin Name', | ||
@@ -248,0 +262,0 @@ baseDataPath: 'options', |
78169
1703
291
Updated@types/json-schema@^7.0.6
Updatedajv@^6.12.5