summaryrefslogtreecommitdiff
path: root/node_modules/schema-utils/dist/keywords
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-11-05 17:23:37 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-11-05 17:23:37 +0800
commit2cdf0cb352ab6a2d0f8cb25120e4ebc92c5316e3 (patch)
tree6b088c99810bd013f17b80522c936ca6dfc09858 /node_modules/schema-utils/dist/keywords
parentf8ee6ef722e6c560c4a1c879e04dbdf0b01f0316 (diff)
removed autoprefix hover as it will have a high chance of making hover stopped working
Diffstat (limited to 'node_modules/schema-utils/dist/keywords')
-rw-r--r--node_modules/schema-utils/dist/keywords/absolutePath.js93
-rw-r--r--node_modules/schema-utils/dist/keywords/undefinedAsNull.js95
2 files changed, 0 insertions, 188 deletions
diff --git a/node_modules/schema-utils/dist/keywords/absolutePath.js b/node_modules/schema-utils/dist/keywords/absolutePath.js
deleted file mode 100644
index 0a912da7..00000000
--- a/node_modules/schema-utils/dist/keywords/absolutePath.js
+++ /dev/null
@@ -1,93 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
-
-/** @typedef {import("ajv").Ajv} Ajv */
-
-/** @typedef {import("ajv").ValidateFunction} ValidateFunction */
-
-/** @typedef {import("../validate").SchemaUtilErrorObject} SchemaUtilErrorObject */
-
-/**
- * @param {string} message
- * @param {object} schema
- * @param {string} data
- * @returns {SchemaUtilErrorObject}
- */
-function errorMessage(message, schema, data) {
- return {
- // @ts-ignore
- // eslint-disable-next-line no-undefined
- dataPath: undefined,
- // @ts-ignore
- // eslint-disable-next-line no-undefined
- schemaPath: undefined,
- keyword: "absolutePath",
- params: {
- absolutePath: data
- },
- message,
- parentSchema: schema
- };
-}
-/**
- * @param {boolean} shouldBeAbsolute
- * @param {object} schema
- * @param {string} data
- * @returns {SchemaUtilErrorObject}
- */
-
-
-function getErrorFor(shouldBeAbsolute, schema, data) {
- const message = shouldBeAbsolute ? `The provided value ${JSON.stringify(data)} is not an absolute path!` : `A relative path is expected. However, the provided value ${JSON.stringify(data)} is an absolute path!`;
- return errorMessage(message, schema, data);
-}
-/**
- *
- * @param {Ajv} ajv
- * @returns {Ajv}
- */
-
-
-function addAbsolutePathKeyword(ajv) {
- ajv.addKeyword("absolutePath", {
- errors: true,
- type: "string",
-
- compile(schema, parentSchema) {
- /** @type {ValidateFunction} */
- const callback = data => {
- let passes = true;
- const isExclamationMarkPresent = data.includes("!");
-
- if (isExclamationMarkPresent) {
- callback.errors = [errorMessage(`The provided value ${JSON.stringify(data)} contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.`, parentSchema, data)];
- passes = false;
- } // ?:[A-Za-z]:\\ - Windows absolute path
- // \\\\ - Windows network absolute path
- // \/ - Unix-like OS absolute path
-
-
- const isCorrectAbsolutePath = schema === /^(?:[A-Za-z]:(\\|\/)|\\\\|\/)/.test(data);
-
- if (!isCorrectAbsolutePath) {
- callback.errors = [getErrorFor(schema, parentSchema, data)];
- passes = false;
- }
-
- return passes;
- };
-
- callback.errors = [];
- return callback;
- }
-
- });
- return ajv;
-}
-
-var _default = addAbsolutePathKeyword;
-exports.default = _default; \ No newline at end of file
diff --git a/node_modules/schema-utils/dist/keywords/undefinedAsNull.js b/node_modules/schema-utils/dist/keywords/undefinedAsNull.js
deleted file mode 100644
index 1d54aabc..00000000
--- a/node_modules/schema-utils/dist/keywords/undefinedAsNull.js
+++ /dev/null
@@ -1,95 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = void 0;
-
-/** @typedef {import("ajv").Ajv} Ajv */
-
-/**
- *
- * @param {Ajv} ajv
- * @param {string} keyword
- * @param {any} definition
- */
-function addKeyword(ajv, keyword, definition) {
- let customRuleCode;
-
- try {
- // @ts-ignore
- // eslint-disable-next-line global-require
- customRuleCode = require("ajv/lib/dotjs/custom"); // @ts-ignore
-
- const {
- RULES
- } = ajv;
- let ruleGroup;
-
- for (let i = 0; i < RULES.length; i++) {
- const rg = RULES[i];
-
- if (typeof rg.type === "undefined") {
- ruleGroup = rg;
- break;
- }
- }
-
- const rule = {
- keyword,
- definition,
- custom: true,
- code: customRuleCode,
- implements: definition.implements
- };
- ruleGroup.rules.unshift(rule);
- RULES.custom[keyword] = rule;
- RULES.keywords[keyword] = true;
- RULES.all[keyword] = true;
- } catch (e) {// Nothing, fallback
- }
-}
-/**
- *
- * @param {Ajv} ajv
- * @returns {Ajv}
- */
-
-
-function addUndefinedAsNullKeyword(ajv) {
- // There is workaround for old versions of ajv, where `before` is not implemented
- addKeyword(ajv, "undefinedAsNull", {
- modifying: true,
-
- /**
- * @param {boolean} kwVal
- * @param {unknown} data
- * @param {any} parentSchema
- * @param {string} dataPath
- * @param {unknown} parentData
- * @param {number | string} parentDataProperty
- * @return {boolean}
- */
- validate(kwVal, data, parentSchema, dataPath, parentData, parentDataProperty) {
- if (kwVal && parentSchema && typeof parentSchema.enum !== "undefined" && parentData && typeof parentDataProperty === "number") {
- const idx =
- /** @type {number} */
- parentDataProperty;
- const parentDataRef =
- /** @type {any[]} */
- parentData;
-
- if (typeof parentDataRef[idx] === "undefined") {
- parentDataRef[idx] = null;
- }
- }
-
- return true;
- }
-
- });
- return ajv;
-}
-
-var _default = addUndefinedAsNullKeyword;
-exports.default = _default; \ No newline at end of file