html-validate 8.28.0 → 8.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core.js +25 -9
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +3 -1
- package/dist/cjs/elements.js.map +1 -1
- package/dist/es/core.js +25 -9
- package/dist/es/core.js.map +1 -1
- package/dist/es/elements.js +3 -1
- package/dist/es/elements.js.map +1 -1
- package/dist/schema/config.json +2 -2
- package/dist/schema/elements.json +5 -1
- package/dist/types/browser.d.ts +20 -4
- package/dist/types/index.d.ts +20 -4
- package/package.json +1 -1
package/dist/cjs/core.js
CHANGED
|
@@ -643,6 +643,9 @@ const patternProperties = {
|
|
|
643
643
|
{
|
|
644
644
|
type: "boolean"
|
|
645
645
|
},
|
|
646
|
+
{
|
|
647
|
+
"function": true
|
|
648
|
+
},
|
|
646
649
|
{
|
|
647
650
|
$ref: "#/definitions/expression"
|
|
648
651
|
}
|
|
@@ -1203,7 +1206,7 @@ const schemaCache = /* @__PURE__ */ new Map();
|
|
|
1203
1206
|
function clone(src) {
|
|
1204
1207
|
return JSON.parse(JSON.stringify(src));
|
|
1205
1208
|
}
|
|
1206
|
-
function overwriteMerge$1(
|
|
1209
|
+
function overwriteMerge$1(_a, b) {
|
|
1207
1210
|
return b;
|
|
1208
1211
|
}
|
|
1209
1212
|
class MetaTable {
|
|
@@ -3354,10 +3357,17 @@ const properties = {
|
|
|
3354
3357
|
transform: {
|
|
3355
3358
|
type: "object",
|
|
3356
3359
|
additionalProperties: {
|
|
3357
|
-
|
|
3360
|
+
anyOf: [
|
|
3361
|
+
{
|
|
3362
|
+
type: "string"
|
|
3363
|
+
},
|
|
3364
|
+
{
|
|
3365
|
+
"function": true
|
|
3366
|
+
}
|
|
3367
|
+
]
|
|
3358
3368
|
},
|
|
3359
3369
|
title: "File transformations to use.",
|
|
3360
|
-
description: "Object where key is regular expression to match filename and value is name of transformer.",
|
|
3370
|
+
description: "Object where key is regular expression to match filename and value is name of transformer or a function.",
|
|
3361
3371
|
examples: [
|
|
3362
3372
|
{
|
|
3363
3373
|
"^.*\\.foo$": "my-transformer",
|
|
@@ -10965,12 +10975,13 @@ class ResolvedConfig {
|
|
|
10965
10975
|
if (!transformer) {
|
|
10966
10976
|
return [source];
|
|
10967
10977
|
}
|
|
10968
|
-
const fn = getCachedTransformerFunction(this.cache, resolvers, transformer.name, this.plugins);
|
|
10978
|
+
const fn = transformer.kind === "import" ? getCachedTransformerFunction(this.cache, resolvers, transformer.name, this.plugins) : transformer.function;
|
|
10979
|
+
const name = transformer.kind === "import" ? transformer.name : transformer.function.name;
|
|
10969
10980
|
try {
|
|
10970
10981
|
const transformedSources = Array.from(fn.call(context, source));
|
|
10971
10982
|
for (const source2 of transformedSources) {
|
|
10972
10983
|
source2.transformedBy ??= [];
|
|
10973
|
-
source2.transformedBy.push(
|
|
10984
|
+
source2.transformedBy.push(name);
|
|
10974
10985
|
}
|
|
10975
10986
|
return transformedSources;
|
|
10976
10987
|
} catch (err) {
|
|
@@ -11018,8 +11029,9 @@ class ResolvedConfig {
|
|
|
11018
11029
|
|
|
11019
11030
|
const ajv = new Ajv__default.default({ strict: true, strictTuples: true, strictTypes: true });
|
|
11020
11031
|
ajv.addMetaSchema(ajvSchemaDraft);
|
|
11032
|
+
ajv.addKeyword(ajvFunctionKeyword);
|
|
11021
11033
|
const validator = ajv.compile(configurationSchema);
|
|
11022
|
-
function overwriteMerge(
|
|
11034
|
+
function overwriteMerge(_a, b) {
|
|
11023
11035
|
return b;
|
|
11024
11036
|
}
|
|
11025
11037
|
function mergeInternal(base, rhs) {
|
|
@@ -11041,9 +11053,13 @@ function toArray(value) {
|
|
|
11041
11053
|
}
|
|
11042
11054
|
}
|
|
11043
11055
|
function transformerEntries(transform) {
|
|
11044
|
-
return Object.entries(transform).map(([pattern,
|
|
11056
|
+
return Object.entries(transform).map(([pattern, value]) => {
|
|
11045
11057
|
const regex = new RegExp(pattern);
|
|
11046
|
-
|
|
11058
|
+
if (typeof value === "string") {
|
|
11059
|
+
return { kind: "import", pattern: regex, name: value };
|
|
11060
|
+
} else {
|
|
11061
|
+
return { kind: "function", pattern: regex, function: value };
|
|
11062
|
+
}
|
|
11047
11063
|
});
|
|
11048
11064
|
}
|
|
11049
11065
|
class Config {
|
|
@@ -13024,7 +13040,7 @@ class HtmlValidate {
|
|
|
13024
13040
|
}
|
|
13025
13041
|
|
|
13026
13042
|
const name = "html-validate";
|
|
13027
|
-
const version = "8.
|
|
13043
|
+
const version = "8.29.0";
|
|
13028
13044
|
const bugs = "https://gitlab.com/html-validate/html-validate/issues/new";
|
|
13029
13045
|
|
|
13030
13046
|
function definePlugin(plugin) {
|