From efbc2ffe6a1ee5ec38a4396305561d6515d0943e Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 30 Aug 2024 17:21:18 +0800 Subject: node fixes, updates --- .../webpack/lib/util/create-schema-validation.js | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 node_modules/webpack/lib/util/create-schema-validation.js (limited to 'node_modules/webpack/lib/util/create-schema-validation.js') diff --git a/node_modules/webpack/lib/util/create-schema-validation.js b/node_modules/webpack/lib/util/create-schema-validation.js new file mode 100644 index 00000000..290eaf47 --- /dev/null +++ b/node_modules/webpack/lib/util/create-schema-validation.js @@ -0,0 +1,28 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const memoize = require("./memoize"); + +const getValidate = memoize(() => require("schema-utils").validate); + +const createSchemaValidation = (check, getSchema, options) => { + getSchema = memoize(getSchema); + return value => { + if (check && !check(value)) { + getValidate()(getSchema(), value, options); + if (check) { + require("util").deprecate( + () => {}, + "webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.", + "DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID" + )(); + } + } + }; +}; + +module.exports = createSchemaValidation; -- cgit v1.2.3