{"_id":"@codemayonnaise/schema-utils","_rev":"1-e8c7e5c7402520a4d9df08e5e4e0bd2f","name":"@codemayonnaise/schema-utils","dist-tags":{"latest":"3.1.3"},"versions":{"2.7.3":{"name":"@codemayonnaise/schema-utils","version":"2.7.3","description":"webpack Validation Utils","license":"MIT","repository":{"type":"git","url":"git+https://github.com/webpack/schema-utils.git"},"author":{"name":"webpack Contrib","url":"https://github.com/webpack-contrib"},"homepage":"https://github.com/webpack/schema-utils","bugs":{"url":"https://github.com/webpack/schema-utils/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"main":"dist/index.js","types":"declarations/index.d.ts","engines":{"node":">= 8.9.0"},"scripts":{"start":"npm run build -- -w","clean":"del-cli dist declarations","prebuild":"npm run clean","build:types":"tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write","build:code":"cross-env NODE_ENV=production babel src -d dist --copy-files","build":"npm-run-all -p \"build:**\"","commitlint":"commitlint --from=master","security":"npm audit","lint:prettier":"prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different","lint:js":"eslint --cache .","lint:types":"tsc --pretty --noEmit","lint":"npm-run-all -l -p \"lint:**\"","test:only":"cross-env NODE_ENV=test jest","test:watch":"npm run test:only -- --watch","test:coverage":"npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage","pretest":"npm run lint","test":"npm run test:coverage","prepare":"npm run build","release":"standard-version","defaults":"webpack-defaults"},"dependencies":{"ajv":"^6.12.4","@codemayonnaise/ajv-keywords":"^3.5.4","@types/json-schema":"^7.0.5"},"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","@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","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","npm-run-all":"^4.1.5","prettier":"^1.19.1","standard-version":"^9.0.0","typescript":"^4.0.2"},"keywords":["webpack"],"gitHead":"5263a6093fa63fcdb37f2011210f1f9cc703ae51","_id":"@codemayonnaise/schema-utils@2.7.3","_nodeVersion":"12.22.12","_npmVersion":"6.14.16","dist":{"integrity":"sha512-pXCAqoKdkm8pE416oW43h/DfZOmKXMK7tfV+vAlrI+IenrcN1gAsuccv/5BcoOAGHr3Jdq0JyIgYdAPgcgM5Ow==","shasum":"38cf932e96c945cae72016366f42d07e995029f1","tarball":"https://registry.npmjs.org/@codemayonnaise/schema-utils/-/schema-utils-2.7.3.tgz","fileCount":16,"unpackedSize":77458,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEoEMUYyN4Iz6DXdVs1jAwqaPO/V6aKkM5pNYNi885bAAiAhOMRuPWKy20eLpcA3DVSfktY7PkoHWu670fluCO+AtQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkBcVFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoRBw//SZx1E74SgYCIPjpceBELTvdQ1smI4Lq6Zky+33bnIivlHO6Z\r\nIwygls6xWYnAIrx8eEIgXifFQTXmjT9576HVIe8OvLxuS3vxwVaRQTkJWY4K\r\ngdwB/OKnDXpiEqlCZe57+0pAEgbJ/LiMeXthrKcJVPSgoBxSP8/KS53m/eJX\r\n0crZjsCzdGzT2XBpuB3vGqfYiRcBeVUQZoKPPXq1+ZdLyVmatKha6hCqesgr\r\n8nuCgzKbavN2gJsvaGHgGAkMr7a9mFLDXgwulvTv7AeNx1jryiJ2kasNTnsT\r\ncjCV3M3jwqM5VFVrnIc7lOxGdyO1C2zJJJjUx9W0dM/39Pn27+/BwfjMq8Ak\r\nYg08FhPQWZpxtgU7S2Q4gfoi5xqNcAiX4PVI7ELfq7FOhTCgvI0p08V5jLYW\r\nHs0eWTkMqOcq2VkveW0Lxkt2C4k+wP3rPyuMOJNmdWyd03SoKbED606kwocQ\r\nAN0EXwMMimUt/AQguT5OGyAeEjMVmoKHVgwhBGF3QA/Q/5IshIusxpvwPbNz\r\n2m97NO5K9jOdjjsibsTrJlLRfH8LCYpjPnIxUEl1Lmr6N4Z9rKDx1TfeiIpa\r\nvrNZaF+4Ah6zDpu26EeRYnVQSQFbedrO22YZtR+EtpCl0xMMZnOaWoDVbP4L\r\nIbOhBMh/Yy6W8QLJ+5VYiZUou2FAceCCCT0=\r\n=wgCp\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"codemayonnaise","email":"christopher.tokar@ibm.com"},"directories":{},"maintainers":[{"name":"codemayonnaise","email":"christopher.tokar@ibm.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/schema-utils_2.7.3_1678099780769_0.32453717851612107"},"_hasShrinkwrap":false},"3.1.3":{"name":"@codemayonnaise/schema-utils","version":"3.1.3","description":"webpack Validation Utils","license":"MIT","repository":{"type":"git","url":"git+https://github.com/webpack/schema-utils.git"},"author":{"name":"webpack Contrib","url":"https://github.com/webpack-contrib"},"homepage":"https://github.com/webpack/schema-utils","bugs":{"url":"https://github.com/webpack/schema-utils/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"main":"dist/index.js","types":"declarations/index.d.ts","engines":{"node":">= 10.13.0"},"scripts":{"start":"npm run build -- -w","clean":"del-cli dist declarations","prebuild":"npm run clean","build:types":"tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write","build:code":"cross-env NODE_ENV=production babel src -d dist --copy-files","build":"npm-run-all -p \"build:**\"","commitlint":"commitlint --from=master","security":"npm audit --production","fmt:check":"prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different","lint:js":"eslint --cache .","lint:types":"tsc --pretty --noEmit","lint":"npm-run-all lint:js lint:types fmt:check","fmt":"npm run fmt:check -- --write","fix:js":"npm run lint:js -- --fix","fix":"npm-run-all fix:js fmt","test:only":"cross-env NODE_ENV=test jest","test:watch":"npm run test:only -- --watch","test:coverage":"npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage","pretest":"npm run lint","test":"npm run test:coverage","release":"standard-version"},"dependencies":{"@codemayonnaise/ajv-keywords":"^3.5.5","@types/json-schema":"^7.0.8","ajv":"^6.12.5"},"devDependencies":{"@babel/cli":"^7.14.3","@babel/core":"^7.14.6","@babel/preset-env":"^7.14.7","@commitlint/cli":"^12.1.4","@commitlint/config-conventional":"^12.1.4","@webpack-contrib/eslint-config-webpack":"^3.0.0","babel-jest":"^27.0.6","cross-env":"^7.0.3","del":"^6.0.0","del-cli":"^3.0.1","eslint":"^7.31.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","husky":"^6.0.0","jest":"^27.0.6","lint-staged":"^11.0.1","npm-run-all":"^4.1.5","prettier":"^2.3.2","standard-version":"^9.3.1","typescript":"^4.3.5","webpack":"^5.45.1"},"keywords":["webpack"],"gitHead":"8e10060346fda3655ec7ac4507381e4f69637ae9","_id":"@codemayonnaise/schema-utils@3.1.3","_nodeVersion":"18.14.2","_npmVersion":"9.5.0","dist":{"integrity":"sha512-yvFmB5fUz7B3pOMrLXbFffUVaIKCjfiaYbepk/PEzx13qHOjaWdq8Sp9U3Itbk6qm0rXhLW31dejhDKa9IdXYA==","shasum":"179607ab74e36787362c3428effcbb40b5bf0a74","tarball":"https://registry.npmjs.org/@codemayonnaise/schema-utils/-/schema-utils-3.1.3.tgz","fileCount":15,"unpackedSize":66174,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkIH+MfuD3GVH0wPkYv0e1CIET4l9l7F0QATHKURputQIgDdtCO6akcVqTkWenF8NGSjiktRp1sA7iSZztvnS9UJQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCI3UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqe8A/+JovNT8gPvWnnalAb+enMRduJjUjWm5/PBeaSo8GfZccBGYVG\r\ne0sciAuDre5hfgiiQOLfzXiNklIX/e9uXd2zS21QFgbuUc3c561h39jYHFSe\r\n1F/tskzb57kjVfM70ZvubYqxjn/3hjLa8eNdBZG9E+ZTZoLI/wvmdkgYcp/r\r\ny05C0CQ/C5xXCqsPq5/sh3icXTheBNNy5Irtq0FQGvafDmP3usV3HokS8UOI\r\nbxS7wcS+dLvm0F6BQExkM55vg1ilpcdAgT6pelZIO6MQw187OwsIksB5e0+D\r\n20XMtzreU7WQcmEjOqKZRHAX5IrS3j18UkcmvH3cEjhtueVKFKIRDOl4Z6io\r\nHca2VCfJQ3RNJ5DYQFNCuHo8aBGSVxuST+qDiyou9gzLDlNgNm0aQJkjWt2W\r\nBn7azcXs2OydsqhrWMTPfXYejMoEemfIaRnAEBprrHq6sLSReV4XG//9cg/x\r\ni5ISo+imp5t4VT7Lfii9h4mJ+rmol3k0sYWRFQUPYU5gDfLRotGw1QbLHmPM\r\niALMePCRa7RRl3VigYnsJkESmT3K4eJLjPEQ0Zdl2y7DXkG6/KpE9it261Pc\r\n+Shfjk2lHOEvqZhDWdfSY8OeNtWyDYU1UicgDFNEaJNePiXdJVgYdBUwXtEA\r\np0lubDA8Z5O9hWlV/zcOgykArVJZPqmVBRk=\r\n=uMQd\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"codemayonnaise","email":"christopher.tokar@ibm.com"},"directories":{},"maintainers":[{"name":"codemayonnaise","email":"christopher.tokar@ibm.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/schema-utils_3.1.3_1678282195989_0.8852940183519615"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-06T10:49:40.562Z","2.7.3":"2023-03-06T10:49:40.975Z","modified":"2023-03-08T13:29:56.307Z","3.1.3":"2023-03-08T13:29:56.214Z"},"maintainers":[{"name":"codemayonnaise","email":"christopher.tokar@ibm.com"}],"description":"webpack Validation Utils","homepage":"https://github.com/webpack/schema-utils","keywords":["webpack"],"repository":{"type":"git","url":"git+https://github.com/webpack/schema-utils.git"},"author":{"name":"webpack Contrib","url":"https://github.com/webpack-contrib"},"bugs":{"url":"https://github.com/webpack/schema-utils/issues"},"license":"MIT","readme":"<div align=\"center\">\n  <a href=\"http://json-schema.org\">\n    <img width=\"160\" height=\"160\"\n      src=\"https://raw.githubusercontent.com/webpack-contrib/schema-utils/master/.github/assets/logo.png\">\n  </a>\n  <a href=\"https://github.com/webpack/webpack\">\n    <img width=\"200\" height=\"200\"\n      src=\"https://webpack.js.org/assets/icon-square-big.svg\">\n  </a>\n</div>\n\n[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![deps][deps]][deps-url]\n[![tests][tests]][tests-url]\n[![coverage][cover]][cover-url]\n[![chat][chat]][chat-url]\n[![size][size]][size-url]\n\n# schema-utils\n\nPackage for validate options in loaders and plugins.\n\n## Getting Started\n\nTo begin, you'll need to install `schema-utils`:\n\n```console\nnpm install schema-utils\n```\n\n## API\n\n**schema.json**\n\n```json\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"option\": {\n      \"type\": \"boolean\"\n    }\n  },\n  \"additionalProperties\": false\n}\n```\n\n```js\nimport schema from \"./path/to/schema.json\";\nimport { validate } from \"schema-utils\";\n\nconst options = { option: true };\nconst configuration = { name: \"Loader Name/Plugin Name/Name\" };\n\nvalidate(schema, options, configuration);\n```\n\n### `schema`\n\nType: `String`\n\nJSON schema.\n\nSimple example of schema:\n\n```json\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": {\n      \"description\": \"This is description of option.\",\n      \"type\": \"string\"\n    }\n  },\n  \"additionalProperties\": false\n}\n```\n\n### `options`\n\nType: `Object`\n\nObject with options.\n\n```js\nimport schema from \"./path/to/schema.json\";\nimport { validate } from \"schema-utils\";\n\nconst options = { foo: \"bar\" };\n\nvalidate(schema, { name: 123 }, { name: \"MyPlugin\" });\n```\n\n### `configuration`\n\nAllow to configure validator.\n\nThere is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema.\nFor example:\n\n```json\n{\n  \"title\": \"My Loader options\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": {\n      \"description\": \"This is description of option.\",\n      \"type\": \"string\"\n    }\n  },\n  \"additionalProperties\": false\n}\n```\n\nThe last word used for the `baseDataPath` option, other words used for the `name` option.\nBased on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`.\n\n#### `name`\n\nType: `Object`\nDefault: `\"Object\"`\n\nAllow to setup name in validation errors.\n\n```js\nimport schema from \"./path/to/schema.json\";\nimport { validate } from \"schema-utils\";\n\nconst options = { foo: \"bar\" };\n\nvalidate(schema, options, { name: \"MyPlugin\" });\n```\n\n```shell\nInvalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema.\n - configuration.optionName should be a integer.\n```\n\n#### `baseDataPath`\n\nType: `String`\nDefault: `\"configuration\"`\n\nAllow to setup base data path in validation errors.\n\n```js\nimport schema from \"./path/to/schema.json\";\nimport { validate } from \"schema-utils\";\n\nconst options = { foo: \"bar\" };\n\nvalidate(schema, options, { name: \"MyPlugin\", baseDataPath: \"options\" });\n```\n\n```shell\nInvalid options object. MyPlugin has been initialised using an options object that does not match the API schema.\n - options.optionName should be a integer.\n```\n\n#### `postFormatter`\n\nType: `Function`\nDefault: `undefined`\n\nAllow to reformat errors.\n\n```js\nimport schema from \"./path/to/schema.json\";\nimport { validate } from \"schema-utils\";\n\nconst options = { foo: \"bar\" };\n\nvalidate(schema, options, {\n  name: \"MyPlugin\",\n  postFormatter: (formattedError, error) => {\n    if (error.keyword === \"type\") {\n      return `${formattedError}\\nAdditional Information.`;\n    }\n\n    return formattedError;\n  },\n});\n```\n\n```shell\nInvalid options object. MyPlugin has been initialized using an options object that does not match the API schema.\n - options.optionName should be a integer.\n   Additional Information.\n```\n\n## Examples\n\n**schema.json**\n\n```json\n{\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": {\n      \"type\": \"string\"\n    },\n    \"test\": {\n      \"anyOf\": [\n        { \"type\": \"array\" },\n        { \"type\": \"string\" },\n        { \"instanceof\": \"RegExp\" }\n      ]\n    },\n    \"transform\": {\n      \"instanceof\": \"Function\"\n    },\n    \"sourceMap\": {\n      \"type\": \"boolean\"\n    }\n  },\n  \"additionalProperties\": false\n}\n```\n\n### `Loader`\n\n```js\nimport { getOptions } from \"loader-utils\";\nimport { validate } from \"schema-utils\";\n\nimport schema from \"path/to/schema.json\";\n\nfunction loader(src, map) {\n  const options = getOptions(this);\n\n  validate(schema, options, {\n    name: \"Loader Name\",\n    baseDataPath: \"options\",\n  });\n\n  // Code...\n}\n\nexport default loader;\n```\n\n### `Plugin`\n\n```js\nimport { validate } from \"schema-utils\";\n\nimport schema from \"path/to/schema.json\";\n\nclass Plugin {\n  constructor(options) {\n    validate(schema, options, {\n      name: \"Plugin Name\",\n      baseDataPath: \"options\",\n    });\n\n    this.options = options;\n  }\n\n  apply(compiler) {\n    // Code...\n  }\n}\n\nexport default Plugin;\n```\n\n## Contributing\n\nPlease take a moment to read our contributing guidelines if you haven't yet done so.\n\n[CONTRIBUTING](./.github/CONTRIBUTING.md)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm]: https://img.shields.io/npm/v/schema-utils.svg\n[npm-url]: https://npmjs.com/package/schema-utils\n[node]: https://img.shields.io/node/v/schema-utils.svg\n[node-url]: https://nodejs.org\n[deps]: https://david-dm.org/webpack/schema-utils.svg\n[deps-url]: https://david-dm.org/webpack/schema-utils\n[tests]: https://github.com/webpack/schema-utils/workflows/schema-utils/badge.svg\n[tests-url]: https://github.com/webpack/schema-utils/actions\n[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/webpack/schema-utils\n[chat]: https://badges.gitter.im/webpack/webpack.svg\n[chat-url]: https://gitter.im/webpack/webpack\n[size]: https://packagephobia.com/badge?p=schema-utils\n[size-url]: https://packagephobia.com/result?p=schema-utils\n","readmeFilename":"README.md"}