html-validate 10.16.0 → 11.0.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.
@@ -2,7 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import kleur from 'kleur';
4
4
  import minimist from 'minimist';
5
- import { a5 as name, v as version, z as SchemaValidationError, Q as isUserError, a6 as bugs } from './core.js';
5
+ import { a3 as name, v as version, y as SchemaValidationError, O as isUserError, a4 as bugs } from './core.js';
6
6
  import { M as Mode, m as modeToFlag, C as CLI, h as haveImportMetaResolve, I as ImportResolveMissingError, d as dump, p as printConfig, i as init, l as lint, a as handleSchemaValidationError } from './cli.js';
7
7
  import 'ajv';
8
8
  import './elements.js';
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export { F as FileSystemConfigLoader, H as HtmlValidate, c as cjsResolver, a as compatibilityCheck, e as esmResolver, n as nodejsResolver } from './core-nodejs.js';
2
- export { A as Attribute, g as Config, f as ConfigError, C as ConfigLoader, D as DOMNode, o as DOMTokenList, p as DOMTree, q as DynamicValue, r as EventHandler, H as HtmlElement, M as MetaCopyableProperty, s as MetaTable, N as NestedError, u as NodeClosed, w as NodeType, a as Parser, P as PerformanceTracker, R as Reporter, x as ResolvedConfig, y as Rule, z as SchemaValidationError, B as Severity, S as StaticConfigLoader, T as TextClassification, F as TextContent, G as TextNode, U as UserError, V as Validator, W as WrappedError, I as ariaNaming, J as classifyNodeText, K as configPresets, L as defineConfig, O as definePlugin, k as formatterFactory, Q as isUserError, X as keywordPatternMatcher, Y as ruleExists, Z as sliceLocation, _ as staticResolver, v as version, $ as walk } from './core.js';
1
+ export { F as FileSystemConfigLoader, H as HtmlValidate, c as cjsResolver, a as compatibilityCheck, e as esmResolver } from './core-nodejs.js';
2
+ export { A as Attribute, g as Config, f as ConfigError, C as ConfigLoader, D as DOMNode, o as DOMTokenList, p as DOMTree, q as DynamicValue, r as EventHandler, H as HtmlElement, M as MetaCopyableProperty, s as MetaTable, N as NestedError, u as Node, a as Parser, P as PerformanceTracker, R as Reporter, w as ResolvedConfig, x as Rule, y as SchemaValidationError, z as Severity, S as StaticConfigLoader, T as TextClassification, B as TextContent, F as TextNode, U as UserError, W as WrappedError, G as ariaNaming, I as classifyNodeText, J as configPresets, K as defineConfig, L as definePlugin, k as formatterFactory, O as isUserError, Q as keywordPatternMatcher, V as ruleExists, X as sliceLocation, Y as staticResolver, v as version, Z as walk } from './core.js';
3
3
  export { C as CLI } from './cli.js';
4
4
  export { d as defineMetadata, m as metadataHelper } from './meta-helper.js';
5
5
  import 'node:fs';
@@ -1,4 +1,4 @@
1
- import { a1 as codeFrameColumns, a2 as getEndLocation, a3 as getStartLocation } from './core.js';
1
+ import { $ as codeFrameColumns, a0 as getEndLocation, a1 as getStartLocation } from './core.js';
2
2
  import { MessageChannel, Worker, receiveMessageOnPort } from 'node:worker_threads';
3
3
  import { l as legacyRequire } from './core-nodejs.js';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { d as diverge, c as createSyncFn, f as flattenMessages } from './matcher-utils.js';
2
- import { l as deepmerge, a4 as workerPath } from './core.js';
2
+ import { l as deepmerge, a2 as workerPath } from './core.js';
3
3
 
4
4
  function createMatcher$4() {
5
5
  function toBeValid(report) {
@@ -638,14 +638,6 @@ export declare class DOMTree {
638
638
  get readyState(): "loading" | "complete";
639
639
  /* Excluded from this release type: resolveMeta */
640
640
  getElementsByTagName(tagName: string): HtmlElement[];
641
- /**
642
- * @deprecated use utility function `walk.depthFirst(..)` instead (since 8.21.0).
643
- */
644
- visitDepthFirst(callback: (node: HtmlElement) => void): void;
645
- /**
646
- * @deprecated use `querySelector(..)` instead (since 8.21.0)
647
- */
648
- find(callback: (node: HtmlElement) => boolean): HtmlElement | null;
649
641
  querySelector(selector: string): HtmlElement | null;
650
642
  querySelectorAll(selector: string): HtmlElement[];
651
643
  }
@@ -1246,56 +1238,8 @@ export declare class HtmlValidate {
1246
1238
  * @returns Contextual documentation or `null` if the rule does not exist.
1247
1239
  */
1248
1240
  getContextualDocumentationSync(message: Pick<Message, "ruleId" | "context">, config: ResolvedConfig): RuleDocumentation | null;
1249
- /**
1250
- * Get contextual documentation for the given rule.
1251
- *
1252
- * Typical usage:
1253
- *
1254
- * ```js
1255
- * const report = await htmlvalidate.validateFile("my-file.html");
1256
- * for (const result of report.results){
1257
- * const config = await htmlvalidate.getConfigFor(result.filePath);
1258
- * for (const message of result.messages){
1259
- * const documentation = await htmlvalidate.getRuleDocumentation(message.ruleId, config, message.context);
1260
- * // do something with documentation
1261
- * }
1262
- * }
1263
- * ```
1264
- *
1265
- * @public
1266
- * @deprecated Deprecated since 8.0.0, use [[getContextualDocumentation]] instead.
1267
- * @param ruleId - Rule to get documentation for.
1268
- * @param config - If set it provides more accurate description by using the
1269
- * correct configuration for the file.
1270
- * @param context - If set to `Message.context` some rules can provide
1271
- * contextual details and suggestions.
1272
- */
1273
- getRuleDocumentation(ruleId: string, config?: ResolvedConfig | Promise<ResolvedConfig> | null, context?: unknown | null): Promise<RuleDocumentation | null>;
1274
- /**
1275
- * Get contextual documentation for the given rule.
1276
- *
1277
- * Typical usage:
1278
- *
1279
- * ```js
1280
- * const report = htmlvalidate.validateFileSync("my-file.html");
1281
- * for (const result of report.results){
1282
- * const config = htmlvalidate.getConfigForSync(result.filePath);
1283
- * for (const message of result.messages){
1284
- * const documentation = htmlvalidate.getRuleDocumentationSync(message.ruleId, config, message.context);
1285
- * // do something with documentation
1286
- * }
1287
- * }
1288
- * ```
1289
- *
1290
- * @public
1291
- * @deprecated Deprecated since 8.0.0, use [[getContextualDocumentationSync]] instead.
1292
- * @param ruleId - Rule to get documentation for.
1293
- * @param config - If set it provides more accurate description by using the
1294
- * correct configuration for the file.
1295
- * @param context - If set to `Message.context` some rules can provide
1296
- * contextual details and suggestions.
1297
- */
1298
- getRuleDocumentationSync(ruleId: string, config?: ResolvedConfig | null, context?: unknown | null): RuleDocumentation | null;
1241
+ /* Excluded from this release type: getRuleDocumentation */
1242
+ /* Excluded from this release type: getRuleDocumentationSync */
1299
1243
  /* Excluded from this release type: getParserFor */
1300
1244
  /**
1301
1245
  * Get configuration for given filename.
@@ -1633,8 +1577,6 @@ export declare interface MetaData {
1633
1577
  * does not directly affect the DOM tree.
1634
1578
  */
1635
1579
  templateRoot?: boolean;
1636
- /** @deprecated use {@link MetaAria.implicitRole} instead */
1637
- implicitRole?: MetaImplicitRoleCallback;
1638
1580
  /** WAI-ARIA attributes */
1639
1581
  aria?: MetaAria;
1640
1582
  deprecatedAttributes?: string[];
@@ -1705,8 +1647,6 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1705
1647
  * does not directly affect the DOM tree.
1706
1648
  */
1707
1649
  templateRoot: boolean;
1708
- /** @deprecated Use {@link MetaAria.implicitRole} instead */
1709
- implicitRole: MetaImplicitRoleCallback;
1710
1650
  /** WAI-ARIA attributes */
1711
1651
  aria: NormalizedMetaAria;
1712
1652
  attributes: Record<string, MetaAttribute>;
@@ -1836,22 +1776,48 @@ export declare class NestedError extends Error {
1836
1776
  /**
1837
1777
  * @public
1838
1778
  */
1839
- export declare enum NodeClosed {
1840
- Open = 0,// element wasn't closed
1841
- EndTag = 1,// element closed with end tag <p>...</p>
1842
- VoidOmitted = 2,// void element with omitted end tag <input>
1843
- VoidSelfClosed = 3,// self-closed void element <input/>
1844
- ImplicitClosed = 4
1845
- }
1779
+ declare const Node_2: {
1780
+ readonly ELEMENT_NODE: 1 & {
1781
+ NODE_TYPE: 1;
1782
+ };
1783
+ readonly TEXT_NODE: 3 & {
1784
+ NODE_TYPE: 3;
1785
+ };
1786
+ readonly DOCUMENT_NODE: 9 & {
1787
+ NODE_TYPE: 9;
1788
+ };
1789
+ /** element wasn't closed */
1790
+ readonly CLOSED_OPEN: 0 & {
1791
+ CLOSED: 0;
1792
+ };
1793
+ /** element closed with end tag <p>...</p> */
1794
+ readonly CLOSED_END_TAG: 1 & {
1795
+ CLOSED: 1;
1796
+ };
1797
+ /** void element with omitted end tag <input> */
1798
+ readonly CLOSED_VOID_OMITTED: 2 & {
1799
+ CLOSED: 2;
1800
+ };
1801
+ /** self-closed void element <input/> */
1802
+ readonly CLOSED_VOID_SELF_CLOSED: 3 & {
1803
+ CLOSED: 3;
1804
+ };
1805
+ /** element with optional end tag <li>foo<li>bar */
1806
+ readonly CLOSED_IMPLICIT_CLOSED: 4 & {
1807
+ CLOSED: 4;
1808
+ };
1809
+ };
1810
+ export { Node_2 as Node }
1846
1811
 
1847
1812
  /**
1848
1813
  * @public
1849
1814
  */
1850
- export declare enum NodeType {
1851
- ELEMENT_NODE = 1,
1852
- TEXT_NODE = 3,
1853
- DOCUMENT_NODE = 9
1854
- }
1815
+ export declare type NodeClosed = typeof Node_2.CLOSED_OPEN | typeof Node_2.CLOSED_END_TAG | typeof Node_2.CLOSED_VOID_OMITTED | typeof Node_2.CLOSED_VOID_SELF_CLOSED | typeof Node_2.CLOSED_IMPLICIT_CLOSED;
1816
+
1817
+ /**
1818
+ * @public
1819
+ */
1820
+ export declare type NodeType = typeof Node_2.ELEMENT_NODE | typeof Node_2.TEXT_NODE | typeof Node_2.DOCUMENT_NODE;
1855
1821
 
1856
1822
  /**
1857
1823
  * Element ARIA metadata.
@@ -2967,88 +2933,6 @@ export declare interface UserErrorData extends Error {
2967
2933
  prettyFormat(): string | undefined;
2968
2934
  }
2969
2935
 
2970
- /**
2971
- * Helper class to validate elements against metadata rules.
2972
- *
2973
- * @public
2974
- */
2975
- export declare class Validator {
2976
- /**
2977
- * Test if element is used in a proper context.
2978
- *
2979
- * @param node - Element to test.
2980
- * @param rules - List of rules.
2981
- * @returns `true` if element passes all tests.
2982
- */
2983
- static validatePermitted(node: HtmlElement, rules: Permitted | null): boolean;
2984
- /**
2985
- * Test if an element is used the correct amount of times.
2986
- *
2987
- * For instance, a `<table>` element can only contain a single `<tbody>`
2988
- * child. If multiple `<tbody>` exists this test will fail both nodes.
2989
- * Note that this is called on the parent but will fail the children violating
2990
- * the rule.
2991
- *
2992
- * @param children - Array of children to validate.
2993
- * @param rules - List of rules of the parent element.
2994
- * @returns `true` if the parent element of the children passes the test.
2995
- */
2996
- static validateOccurrences(children: HtmlElement[], rules: Permitted | null, cb: (node: HtmlElement, category: string) => void): boolean;
2997
- /**
2998
- * Validate elements order.
2999
- *
3000
- * Given a parent element with children and metadata containing permitted
3001
- * order it will validate each children and ensure each one exists in the
3002
- * specified order.
3003
- *
3004
- * For instance, for a `<table>` element the `<caption>` element must come
3005
- * before a `<thead>` which must come before `<tbody>`.
3006
- *
3007
- * @param children - Array of children to validate.
3008
- */
3009
- static validateOrder(children: HtmlElement[], rules: PermittedOrder | null, cb: (node: HtmlElement, prev: HtmlElement) => void): boolean;
3010
- /**
3011
- * Validate element ancestors.
3012
- *
3013
- * Check if an element has the required set of elements. At least one of the
3014
- * selectors must match.
3015
- */
3016
- static validateAncestors(node: HtmlElement, rules: RequiredAncestors | null): boolean;
3017
- /**
3018
- * Validate element required content.
3019
- *
3020
- * Check if an element has the required set of elements. At least one of the
3021
- * selectors must match.
3022
- *
3023
- * Returns `[]` when valid or a list of required but missing tagnames or
3024
- * categories.
3025
- */
3026
- static validateRequiredContent(node: HtmlElement, rules: RequiredContent | null): CategoryOrTag[];
3027
- /**
3028
- * Test if an attribute has an allowed value and/or format.
3029
- *
3030
- * @param attr - Attribute to test.
3031
- * @param rules - Element attribute metadta.
3032
- * @returns `true` if attribute passes all tests.
3033
- */
3034
- static validateAttribute(attr: Attribute, rules: Record<string, MetaAttribute | undefined>): boolean;
3035
- private static validateAttributeValue;
3036
- private static validatePermittedRule;
3037
- /**
3038
- * Validate node against a content category.
3039
- *
3040
- * When matching parent nodes against permitted parents use the superset
3041
- * parameter to also match for `@flow`. E.g. if a node expects a `@phrasing`
3042
- * parent it should also allow `@flow` parent since `@phrasing` is a subset of
3043
- * `@flow`.
3044
- *
3045
- * @param node - The node to test against
3046
- * @param category - Name of category with `@` prefix or tag name.
3047
- * @param defaultMatch - The default return value when node categories is not known.
3048
- */
3049
- static validatePermittedCategory(node: HtmlElement, category: string, defaultMatch: boolean): boolean;
3050
- }
3051
-
3052
2936
  /** @public */
3053
2937
  export declare const version: string;
3054
2938
 
@@ -736,14 +736,6 @@ export declare class DOMTree {
736
736
  get readyState(): "loading" | "complete";
737
737
  /* Excluded from this release type: resolveMeta */
738
738
  getElementsByTagName(tagName: string): HtmlElement[];
739
- /**
740
- * @deprecated use utility function `walk.depthFirst(..)` instead (since 8.21.0).
741
- */
742
- visitDepthFirst(callback: (node: HtmlElement) => void): void;
743
- /**
744
- * @deprecated use `querySelector(..)` instead (since 8.21.0)
745
- */
746
- find(callback: (node: HtmlElement) => boolean): HtmlElement | null;
747
739
  querySelector(selector: string): HtmlElement | null;
748
740
  querySelectorAll(selector: string): HtmlElement[];
749
741
  }
@@ -1482,56 +1474,8 @@ export declare class HtmlValidate {
1482
1474
  * @returns Contextual documentation or `null` if the rule does not exist.
1483
1475
  */
1484
1476
  getContextualDocumentationSync(message: Pick<Message, "ruleId" | "context">, config: ResolvedConfig): RuleDocumentation | null;
1485
- /**
1486
- * Get contextual documentation for the given rule.
1487
- *
1488
- * Typical usage:
1489
- *
1490
- * ```js
1491
- * const report = await htmlvalidate.validateFile("my-file.html");
1492
- * for (const result of report.results){
1493
- * const config = await htmlvalidate.getConfigFor(result.filePath);
1494
- * for (const message of result.messages){
1495
- * const documentation = await htmlvalidate.getRuleDocumentation(message.ruleId, config, message.context);
1496
- * // do something with documentation
1497
- * }
1498
- * }
1499
- * ```
1500
- *
1501
- * @public
1502
- * @deprecated Deprecated since 8.0.0, use [[getContextualDocumentation]] instead.
1503
- * @param ruleId - Rule to get documentation for.
1504
- * @param config - If set it provides more accurate description by using the
1505
- * correct configuration for the file.
1506
- * @param context - If set to `Message.context` some rules can provide
1507
- * contextual details and suggestions.
1508
- */
1509
- getRuleDocumentation(ruleId: string, config?: ResolvedConfig | Promise<ResolvedConfig> | null, context?: unknown | null): Promise<RuleDocumentation | null>;
1510
- /**
1511
- * Get contextual documentation for the given rule.
1512
- *
1513
- * Typical usage:
1514
- *
1515
- * ```js
1516
- * const report = htmlvalidate.validateFileSync("my-file.html");
1517
- * for (const result of report.results){
1518
- * const config = htmlvalidate.getConfigForSync(result.filePath);
1519
- * for (const message of result.messages){
1520
- * const documentation = htmlvalidate.getRuleDocumentationSync(message.ruleId, config, message.context);
1521
- * // do something with documentation
1522
- * }
1523
- * }
1524
- * ```
1525
- *
1526
- * @public
1527
- * @deprecated Deprecated since 8.0.0, use [[getContextualDocumentationSync]] instead.
1528
- * @param ruleId - Rule to get documentation for.
1529
- * @param config - If set it provides more accurate description by using the
1530
- * correct configuration for the file.
1531
- * @param context - If set to `Message.context` some rules can provide
1532
- * contextual details and suggestions.
1533
- */
1534
- getRuleDocumentationSync(ruleId: string, config?: ResolvedConfig | null, context?: unknown | null): RuleDocumentation | null;
1477
+ /* Excluded from this release type: getRuleDocumentation */
1478
+ /* Excluded from this release type: getRuleDocumentationSync */
1535
1479
  /* Excluded from this release type: getParserFor */
1536
1480
  /**
1537
1481
  * Get configuration for given filename.
@@ -1876,8 +1820,6 @@ export declare interface MetaData {
1876
1820
  * does not directly affect the DOM tree.
1877
1821
  */
1878
1822
  templateRoot?: boolean;
1879
- /** @deprecated use {@link MetaAria.implicitRole} instead */
1880
- implicitRole?: MetaImplicitRoleCallback;
1881
1823
  /** WAI-ARIA attributes */
1882
1824
  aria?: MetaAria;
1883
1825
  deprecatedAttributes?: string[];
@@ -1948,8 +1890,6 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1948
1890
  * does not directly affect the DOM tree.
1949
1891
  */
1950
1892
  templateRoot: boolean;
1951
- /** @deprecated Use {@link MetaAria.implicitRole} instead */
1952
- implicitRole: MetaImplicitRoleCallback;
1953
1893
  /** WAI-ARIA attributes */
1954
1894
  aria: NormalizedMetaAria;
1955
1895
  attributes: Record<string, MetaAttribute>;
@@ -2079,47 +2019,48 @@ export declare class NestedError extends Error {
2079
2019
  /**
2080
2020
  * @public
2081
2021
  */
2082
- export declare enum NodeClosed {
2083
- Open = 0,// element wasn't closed
2084
- EndTag = 1,// element closed with end tag <p>...</p>
2085
- VoidOmitted = 2,// void element with omitted end tag <input>
2086
- VoidSelfClosed = 3,// self-closed void element <input/>
2087
- ImplicitClosed = 4
2088
- }
2089
-
2090
- /**
2091
- * CommonJS resolver.
2092
- *
2093
- * @public
2094
- * @deprecated Deprecated alias for [[CommonJSResolver]].
2095
- * @since 8.0.0
2096
- */
2097
- export declare type NodeJSResolver = Required<Resolver>;
2022
+ declare const Node_2: {
2023
+ readonly ELEMENT_NODE: 1 & {
2024
+ NODE_TYPE: 1;
2025
+ };
2026
+ readonly TEXT_NODE: 3 & {
2027
+ NODE_TYPE: 3;
2028
+ };
2029
+ readonly DOCUMENT_NODE: 9 & {
2030
+ NODE_TYPE: 9;
2031
+ };
2032
+ /** element wasn't closed */
2033
+ readonly CLOSED_OPEN: 0 & {
2034
+ CLOSED: 0;
2035
+ };
2036
+ /** element closed with end tag <p>...</p> */
2037
+ readonly CLOSED_END_TAG: 1 & {
2038
+ CLOSED: 1;
2039
+ };
2040
+ /** void element with omitted end tag <input> */
2041
+ readonly CLOSED_VOID_OMITTED: 2 & {
2042
+ CLOSED: 2;
2043
+ };
2044
+ /** self-closed void element <input/> */
2045
+ readonly CLOSED_VOID_SELF_CLOSED: 3 & {
2046
+ CLOSED: 3;
2047
+ };
2048
+ /** element with optional end tag <li>foo<li>bar */
2049
+ readonly CLOSED_IMPLICIT_CLOSED: 4 & {
2050
+ CLOSED: 4;
2051
+ };
2052
+ };
2053
+ export { Node_2 as Node }
2098
2054
 
2099
2055
  /**
2100
- * Create a new resolver for NodeJS packages using `require(..)`.
2101
- *
2102
- * If the module name contains `<rootDir>` (e.g. `<rootDir/foo`) it will be
2103
- * expanded relative to the root directory either explicitly set by the
2104
- * `rootDir` parameter or determined automatically by the closest `package.json`
2105
- * file (starting at the current working directory).
2106
- *
2107
2056
  * @public
2108
- * @deprecated Deprecated alias for [[commonjsResolver]].
2109
- * @since 8.0.0
2110
2057
  */
2111
- export declare function nodejsResolver(options?: {
2112
- rootDir?: string;
2113
- }): NodeJSResolver;
2058
+ export declare type NodeClosed = typeof Node_2.CLOSED_OPEN | typeof Node_2.CLOSED_END_TAG | typeof Node_2.CLOSED_VOID_OMITTED | typeof Node_2.CLOSED_VOID_SELF_CLOSED | typeof Node_2.CLOSED_IMPLICIT_CLOSED;
2114
2059
 
2115
2060
  /**
2116
2061
  * @public
2117
2062
  */
2118
- export declare enum NodeType {
2119
- ELEMENT_NODE = 1,
2120
- TEXT_NODE = 3,
2121
- DOCUMENT_NODE = 9
2122
- }
2063
+ export declare type NodeType = typeof Node_2.ELEMENT_NODE | typeof Node_2.TEXT_NODE | typeof Node_2.DOCUMENT_NODE;
2123
2064
 
2124
2065
  /**
2125
2066
  * Element ARIA metadata.
@@ -3235,88 +3176,6 @@ export declare interface UserErrorData extends Error {
3235
3176
  prettyFormat(): string | undefined;
3236
3177
  }
3237
3178
 
3238
- /**
3239
- * Helper class to validate elements against metadata rules.
3240
- *
3241
- * @public
3242
- */
3243
- export declare class Validator {
3244
- /**
3245
- * Test if element is used in a proper context.
3246
- *
3247
- * @param node - Element to test.
3248
- * @param rules - List of rules.
3249
- * @returns `true` if element passes all tests.
3250
- */
3251
- static validatePermitted(node: HtmlElement, rules: Permitted | null): boolean;
3252
- /**
3253
- * Test if an element is used the correct amount of times.
3254
- *
3255
- * For instance, a `<table>` element can only contain a single `<tbody>`
3256
- * child. If multiple `<tbody>` exists this test will fail both nodes.
3257
- * Note that this is called on the parent but will fail the children violating
3258
- * the rule.
3259
- *
3260
- * @param children - Array of children to validate.
3261
- * @param rules - List of rules of the parent element.
3262
- * @returns `true` if the parent element of the children passes the test.
3263
- */
3264
- static validateOccurrences(children: HtmlElement[], rules: Permitted | null, cb: (node: HtmlElement, category: string) => void): boolean;
3265
- /**
3266
- * Validate elements order.
3267
- *
3268
- * Given a parent element with children and metadata containing permitted
3269
- * order it will validate each children and ensure each one exists in the
3270
- * specified order.
3271
- *
3272
- * For instance, for a `<table>` element the `<caption>` element must come
3273
- * before a `<thead>` which must come before `<tbody>`.
3274
- *
3275
- * @param children - Array of children to validate.
3276
- */
3277
- static validateOrder(children: HtmlElement[], rules: PermittedOrder | null, cb: (node: HtmlElement, prev: HtmlElement) => void): boolean;
3278
- /**
3279
- * Validate element ancestors.
3280
- *
3281
- * Check if an element has the required set of elements. At least one of the
3282
- * selectors must match.
3283
- */
3284
- static validateAncestors(node: HtmlElement, rules: RequiredAncestors | null): boolean;
3285
- /**
3286
- * Validate element required content.
3287
- *
3288
- * Check if an element has the required set of elements. At least one of the
3289
- * selectors must match.
3290
- *
3291
- * Returns `[]` when valid or a list of required but missing tagnames or
3292
- * categories.
3293
- */
3294
- static validateRequiredContent(node: HtmlElement, rules: RequiredContent | null): CategoryOrTag[];
3295
- /**
3296
- * Test if an attribute has an allowed value and/or format.
3297
- *
3298
- * @param attr - Attribute to test.
3299
- * @param rules - Element attribute metadta.
3300
- * @returns `true` if attribute passes all tests.
3301
- */
3302
- static validateAttribute(attr: Attribute, rules: Record<string, MetaAttribute | undefined>): boolean;
3303
- private static validateAttributeValue;
3304
- private static validatePermittedRule;
3305
- /**
3306
- * Validate node against a content category.
3307
- *
3308
- * When matching parent nodes against permitted parents use the superset
3309
- * parameter to also match for `@flow`. E.g. if a node expects a `@phrasing`
3310
- * parent it should also allow `@flow` parent since `@phrasing` is a subset of
3311
- * `@flow`.
3312
- *
3313
- * @param node - The node to test against
3314
- * @param category - Name of category with `@` prefix or tag name.
3315
- * @param defaultMatch - The default return value when node categories is not known.
3316
- */
3317
- static validatePermittedCategory(node: HtmlElement, category: string, defaultMatch: boolean): boolean;
3318
- }
3319
-
3320
3179
  /** @public */
3321
3180
  export declare const version: string;
3322
3181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-validate",
3
- "version": "10.16.0",
3
+ "version": "11.0.0",
4
4
  "description": "Offline HTML5 validator and linter",
5
5
  "keywords": [
6
6
  "html",
@@ -99,11 +99,11 @@
99
99
  "semver": "^7.0.0"
100
100
  },
101
101
  "peerDependencies": {
102
- "@jest/globals": "^28.1.3 || ^29.0.3 || ^30.0.0",
103
- "jest": "^28.1.3 || ^29.0.3 || ^30.0.0",
104
- "jest-diff": "^28.1.3 || ^29.0.3 || ^30.0.0",
105
- "jest-snapshot": "^28.1.3 || ^29.0.3 || ^30.0.0",
106
- "vitest": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.1"
102
+ "@jest/globals": "^29.0.3 || ^30.0.0",
103
+ "jest": "^29.0.3 || ^30.0.0",
104
+ "jest-diff": "^29.0.3 || ^30.0.0",
105
+ "jest-snapshot": "^29.0.3 || ^30.0.0",
106
+ "vitest": "^3.0.0 || ^4.0.1"
107
107
  },
108
108
  "peerDependenciesMeta": {
109
109
  "@jest/globals": {
@@ -123,6 +123,6 @@
123
123
  }
124
124
  },
125
125
  "engines": {
126
- "node": "^20.19.0 || ^22.16.0 || >= 24.0.0"
126
+ "node": "^22.16.0 || >= 24.0.0"
127
127
  }
128
128
  }