Webpack Schema Validator (util/validateSchema.js)

webpack · lib/util/validateSchema.js · javascript · MIT
dev-tools, database, lang:javascript, fw:webpack, tag:validation, tag:utils

Validates configuration options against precompiled schemas using schema-utils. Reuse when building Webpack plugins requiring robust validation.

// Source: https://github.com/webpack/webpack | License: MIT | Copyright JS Foundation and other contributors
// Provided via justclaw.it.com; keep this notice with the code.
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
*/

"use strict";

const memoize = require("./memoize");

const getValidate = memoize(() => require("schema-utils").validate);

/** @import { Schema, ValidationErrorConfiguration } from "schema-utils" */

/**
 * A check precompiled from a schema with `schema-utils precompile`, it only
 * says whether the value is valid
 * @template [T=EXPECTED_ANY]
 * @typedef {(value: T) => boolean} PrecompiledCheck
 */

/**
 * Reads the name and data path from a schema titled `"<name> <baseDataPath>"`,
 * e.g. `"Css Loader options"`
 * @param {Schema} schema schema
 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key