html-validate 8.7.4 → 8.9.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.
Files changed (74) hide show
  1. package/dist/cjs/browser.js +7 -21
  2. package/dist/cjs/browser.js.map +1 -1
  3. package/dist/cjs/cli.js +483 -451
  4. package/dist/cjs/cli.js.map +1 -1
  5. package/dist/cjs/core-browser.js +9 -20
  6. package/dist/cjs/core-browser.js.map +1 -1
  7. package/dist/cjs/core-nodejs.js +203 -297
  8. package/dist/cjs/core-nodejs.js.map +1 -1
  9. package/dist/cjs/core.js +9735 -10454
  10. package/dist/cjs/core.js.map +1 -1
  11. package/dist/cjs/elements.js +2311 -2296
  12. package/dist/cjs/elements.js.map +1 -1
  13. package/dist/cjs/html-validate.js +148 -169
  14. package/dist/cjs/html-validate.js.map +1 -1
  15. package/dist/cjs/html5.js.map +1 -1
  16. package/dist/cjs/index.js +8 -21
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/jest-diff.js +26 -36
  19. package/dist/cjs/jest-diff.js.map +1 -1
  20. package/dist/cjs/jest.js +8 -8
  21. package/dist/cjs/jest.js.map +1 -1
  22. package/dist/cjs/matcher-utils.js +12 -28
  23. package/dist/cjs/matcher-utils.js.map +1 -1
  24. package/dist/cjs/matchers-jestonly.js +38 -47
  25. package/dist/cjs/matchers-jestonly.js.map +1 -1
  26. package/dist/cjs/matchers.js +196 -196
  27. package/dist/cjs/matchers.js.map +1 -1
  28. package/dist/cjs/meta-helper.js +40 -60
  29. package/dist/cjs/meta-helper.js.map +1 -1
  30. package/dist/cjs/test-utils.js +26 -47
  31. package/dist/cjs/test-utils.js.map +1 -1
  32. package/dist/cjs/tsdoc-metadata.json +1 -1
  33. package/dist/cjs/utils/natural-join.js +10 -23
  34. package/dist/cjs/utils/natural-join.js.map +1 -1
  35. package/dist/cjs/vitest.js +6 -6
  36. package/dist/cjs/vitest.js.map +1 -1
  37. package/dist/es/browser.js +2 -2
  38. package/dist/es/cli.js +482 -454
  39. package/dist/es/cli.js.map +1 -1
  40. package/dist/es/core-browser.js +10 -21
  41. package/dist/es/core-browser.js.map +1 -1
  42. package/dist/es/core-nodejs.js +204 -299
  43. package/dist/es/core-nodejs.js.map +1 -1
  44. package/dist/es/core.js +9730 -10455
  45. package/dist/es/core.js.map +1 -1
  46. package/dist/es/elements.js +2311 -2296
  47. package/dist/es/elements.js.map +1 -1
  48. package/dist/es/html-validate.js +150 -171
  49. package/dist/es/html-validate.js.map +1 -1
  50. package/dist/es/html5.js.map +1 -1
  51. package/dist/es/index.js +3 -3
  52. package/dist/es/jest-diff.js +11 -21
  53. package/dist/es/jest-diff.js.map +1 -1
  54. package/dist/es/jest.js +8 -8
  55. package/dist/es/jest.js.map +1 -1
  56. package/dist/es/matcher-utils.js +12 -28
  57. package/dist/es/matcher-utils.js.map +1 -1
  58. package/dist/es/matchers-jestonly.js +39 -48
  59. package/dist/es/matchers-jestonly.js.map +1 -1
  60. package/dist/es/matchers.js +196 -196
  61. package/dist/es/matchers.js.map +1 -1
  62. package/dist/es/meta-helper.js +40 -60
  63. package/dist/es/meta-helper.js.map +1 -1
  64. package/dist/es/test-utils.js +26 -47
  65. package/dist/es/test-utils.js.map +1 -1
  66. package/dist/es/utils/natural-join.js +10 -23
  67. package/dist/es/utils/natural-join.js.map +1 -1
  68. package/dist/es/vitest.js +6 -6
  69. package/dist/es/vitest.js.map +1 -1
  70. package/dist/schema/elements.json +6 -0
  71. package/dist/tsdoc-metadata.json +1 -1
  72. package/dist/types/browser.d.ts +78 -32
  73. package/dist/types/index.d.ts +105 -34
  74. package/package.json +15 -15
@@ -1,344 +1,249 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import { a as ConfigError, b as ConfigLoader, C as Config, F as compatibilityCheckImpl, v as version } from './core.js';
3
+ import { a as ConfigError, b as ConfigLoader, C as Config, G as compatibilityCheckImpl, v as version } from './core.js';
4
4
  import { createRequire } from 'node:module';
5
5
  import kleur from 'kleur';
6
6
 
7
- /**
8
- * Similar to `require(..)` but removes the cached copy first.
9
- */
10
7
  function requireUncached(require, moduleId) {
11
- const filename = require.resolve(moduleId);
12
- /* remove references from the parent module to prevent memory leak */
13
- const m = require.cache[filename];
14
- if (m === null || m === void 0 ? void 0 : m.parent) {
15
- const { parent } = m;
16
- for (let i = parent.children.length - 1; i >= 0; i--) {
17
- if (parent.children[i].id === filename) {
18
- parent.children.splice(i, 1);
19
- }
20
- }
8
+ const filename = require.resolve(moduleId);
9
+ const m = require.cache[filename];
10
+ if (m == null ? void 0 : m.parent) {
11
+ const { parent } = m;
12
+ for (let i = parent.children.length - 1; i >= 0; i--) {
13
+ if (parent.children[i].id === filename) {
14
+ parent.children.splice(i, 1);
15
+ }
21
16
  }
22
- /* remove old module from cache */
23
- /* eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- needed to perform its function */
24
- delete require.cache[filename];
25
- /* eslint-disable-next-line import/no-dynamic-require, security/detect-non-literal-require -- as expected but should be moved to upcoming resolver class */
26
- return require(filename);
17
+ }
18
+ delete require.cache[filename];
19
+ return require(filename);
27
20
  }
28
21
 
29
22
  const legacyRequire = createRequire(import.meta.url);
30
23
 
31
24
  let cachedRootDir = null;
32
- /**
33
- * @internal
34
- */
35
- function determineRootDirImpl(intial, fs) {
36
- /* try to locate package.json */
37
- let current = intial;
38
- // eslint-disable-next-line no-constant-condition -- break outs when filesystem is traversed
39
- while (true) {
40
- const search = path.join(current, "package.json");
41
- if (fs.existsSync(search)) {
42
- return current;
43
- }
44
- /* get the parent directory */
45
- const child = current;
46
- current = path.dirname(current);
47
- /* stop if this is the root directory */
48
- if (current === child) {
49
- break;
50
- }
25
+ function determineRootDirImpl(intial, fs2) {
26
+ let current = intial;
27
+ while (true) {
28
+ const search = path.join(current, "package.json");
29
+ if (fs2.existsSync(search)) {
30
+ return current;
31
+ }
32
+ const child = current;
33
+ current = path.dirname(current);
34
+ if (current === child) {
35
+ break;
51
36
  }
52
- /* default to working directory if no package.json is found */
53
- return intial;
37
+ }
38
+ return intial;
54
39
  }
55
- /**
56
- * Try to determine root directory based on the location of the closest
57
- * `package.json`. Fallbacks on `process.cwd()` if no package.json was found.
58
- *
59
- * @internal
60
- */
61
- /* istanbul ignore next: cached version of determineRootDirImpl, no need to test */
62
40
  function determineRootDir() {
63
- if (cachedRootDir === null) {
64
- cachedRootDir = determineRootDirImpl(process.cwd(), fs);
65
- }
66
- return cachedRootDir;
41
+ if (cachedRootDir === null) {
42
+ cachedRootDir = determineRootDirImpl(process.cwd(), fs);
43
+ }
44
+ return cachedRootDir;
67
45
  }
68
46
 
69
- /**
70
- * @internal
71
- */
72
47
  function expandRelativePath(value, { cwd }) {
73
- if (typeof value === "string" && value.startsWith(".")) {
74
- return path.normalize(path.join(cwd, value));
75
- }
76
- else {
77
- return value;
78
- }
48
+ if (typeof value === "string" && value.startsWith(".")) {
49
+ return path.normalize(path.join(cwd, value));
50
+ } else {
51
+ return value;
52
+ }
79
53
  }
80
54
 
81
55
  function isRequireError(error) {
82
- return Boolean(error && typeof error === "object" && "code" in error);
56
+ return Boolean(error && typeof error === "object" && "code" in error);
83
57
  }
84
58
  function isTransformer(value) {
85
- return typeof value === "function";
59
+ return typeof value === "function";
86
60
  }
87
- /**
88
- * Create a new resolver for NodeJS packages using `require(..)`.
89
- *
90
- * If the module name contains `<rootDir>` (e.g. `<rootDir/foo`) it will be
91
- * expanded relative to the root directory either explicitly set by the
92
- * `rootDir` parameter or determined automatically by the closest `package.json`
93
- * file (starting at the current working directory).
94
- *
95
- * @public
96
- * @since 8.0.0
97
- */
98
- function nodejsResolver(options = {}) {
99
- var _a;
100
- const rootDir = (_a = options.rootDir) !== null && _a !== void 0 ? _a : determineRootDir();
101
- function internalRequire(id, { cache }) {
102
- const moduleName = id.replace("<rootDir>", rootDir);
103
- try {
104
- /* istanbul ignore else: the tests only runs the cached versions to get
105
- * unmodified access to `require`, the implementation of `requireUncached`
106
- * is assumed to be tested elsewhere */
107
- if (cache) {
108
- return legacyRequire(moduleName);
109
- }
110
- else {
111
- return requireUncached(legacyRequire, moduleName);
112
- }
113
- }
114
- catch (err) {
115
- if (isRequireError(err) && err.code === "MODULE_NOT_FOUND") {
116
- return null;
117
- }
118
- throw err;
119
- }
61
+ function cjsResolver(options = {}) {
62
+ const rootDir = options.rootDir ?? determineRootDir();
63
+ function internalRequire(id, { cache }) {
64
+ const moduleName = id.replace("<rootDir>", rootDir);
65
+ try {
66
+ if (cache) {
67
+ return legacyRequire(moduleName);
68
+ } else {
69
+ return requireUncached(legacyRequire, moduleName);
70
+ }
71
+ } catch (err) {
72
+ if (isRequireError(err) && err.code === "MODULE_NOT_FOUND") {
73
+ return null;
74
+ }
75
+ throw err;
120
76
  }
121
- return {
122
- name: "nodejs-resolver",
123
- resolveElements(id, options) {
124
- return internalRequire(id, options);
125
- },
126
- resolveConfig(id, options) {
127
- const configData = internalRequire(id, options);
128
- if (!configData) {
129
- return null;
130
- }
131
- /* expand any relative paths */
132
- const cwd = path.dirname(id);
133
- const expand = (value) => expandRelativePath(value, { cwd });
134
- if (configData.elements) {
135
- configData.elements = configData.elements.map(expand);
136
- }
137
- if (configData.extends) {
138
- configData.extends = configData.extends.map(expand);
139
- }
140
- if (configData.plugins) {
141
- configData.plugins = configData.plugins.map(expand);
142
- }
143
- return configData;
144
- },
145
- resolvePlugin(id, options) {
146
- return internalRequire(id, options);
147
- },
148
- resolveTransformer(id, options) {
149
- const mod = internalRequire(id, options);
150
- if (!mod) {
151
- return null;
152
- }
153
- if (isTransformer(mod)) {
154
- return mod;
155
- }
156
- /* this is not a proper transformer, is it a plugin exposing a transformer? */
157
- if (mod.transformer) {
158
- throw new ConfigError(`Module "${id}" is not a valid transformer. This looks like a plugin, did you forget to load the plugin first?`);
159
- }
160
- throw new ConfigError(`Module "${id}" is not a valid transformer.`);
161
- },
162
- };
77
+ }
78
+ return {
79
+ name: "nodejs-resolver",
80
+ resolveElements(id, options2) {
81
+ return internalRequire(id, options2);
82
+ },
83
+ resolveConfig(id, options2) {
84
+ const configData = internalRequire(id, options2);
85
+ if (!configData) {
86
+ return null;
87
+ }
88
+ const cwd = path.dirname(id);
89
+ const expand = (value) => expandRelativePath(value, { cwd });
90
+ if (Array.isArray(configData.elements)) {
91
+ configData.elements = configData.elements.map(expand);
92
+ }
93
+ if (Array.isArray(configData.extends)) {
94
+ configData.extends = configData.extends.map(expand);
95
+ }
96
+ if (Array.isArray(configData.plugins)) {
97
+ configData.plugins = configData.plugins.map(expand);
98
+ }
99
+ return configData;
100
+ },
101
+ resolvePlugin(id, options2) {
102
+ return internalRequire(id, options2);
103
+ },
104
+ resolveTransformer(id, options2) {
105
+ const mod = internalRequire(id, options2);
106
+ if (!mod) {
107
+ return null;
108
+ }
109
+ if (isTransformer(mod)) {
110
+ return mod;
111
+ }
112
+ if (mod.transformer) {
113
+ throw new ConfigError(
114
+ `Module "${id}" is not a valid transformer. This looks like a plugin, did you forget to load the plugin first?`
115
+ );
116
+ }
117
+ throw new ConfigError(`Module "${id}" is not a valid transformer.`);
118
+ }
119
+ };
120
+ }
121
+ function nodejsResolver(options = {}) {
122
+ return cjsResolver(options);
163
123
  }
164
124
 
165
- /**
166
- * @internal
167
- */
168
- function findConfigurationFiles(fs, directory) {
169
- return ["json", "cjs", "js"]
170
- .map((extension) => path.join(directory, `.htmlvalidate.${extension}`))
171
- .filter((filePath) => fs.existsSync(filePath));
125
+ function findConfigurationFiles(fs2, directory) {
126
+ return ["json", "cjs", "js"].map((extension) => path.join(directory, `.htmlvalidate.${extension}`)).filter((filePath) => fs2.existsSync(filePath));
172
127
  }
173
- const defaultResolvers = [nodejsResolver()];
128
+ const defaultResolvers = [cjsResolver()];
174
129
  function hasResolver(value) {
175
- return Array.isArray(value[0]);
130
+ return Array.isArray(value[0]);
176
131
  }
177
- /**
178
- * Loads configuration by traversing filesystem.
179
- *
180
- * Configuration is read from three sources and in the following order:
181
- *
182
- * 1. Global configuration passed to constructor.
183
- * 2. Configuration files found when traversing the directory structure.
184
- * 3. Override passed to this function.
185
- *
186
- * The following configuration filenames are searched:
187
- *
188
- * - `.htmlvalidate.json`
189
- * - `.htmlvalidate.js`
190
- * - `.htmlvalidate.cjs`
191
- *
192
- * Global configuration is used when no configuration file is found. The
193
- * result is always merged with override if present.
194
- *
195
- * The `root` property set to `true` affects the configuration as following:
196
- *
197
- * 1. If set in override the override is returned as-is.
198
- * 2. If set in the global config the override is merged into global and
199
- * returned. No configuration files are searched.
200
- * 3. Setting `root` in configuration file only stops directory traversal.
201
- *
202
- * @public
203
- */
204
132
  class FileSystemConfigLoader extends ConfigLoader {
205
- constructor(...args) {
206
- var _a, _b;
207
- if (hasResolver(args)) {
208
- /* istanbul ignore next */
209
- const [resolvers, config, options = {}] = args;
210
- super(resolvers, config);
211
- this.fs = /* istanbul ignore next */ (_a = options.fs) !== null && _a !== void 0 ? _a : fs;
212
- }
213
- else {
214
- /* istanbul ignore next */
215
- const [config, options = {}] = args;
216
- super(defaultResolvers, config);
217
- this.fs = /* istanbul ignore next */ (_b = options.fs) !== null && _b !== void 0 ? _b : fs;
218
- }
219
- this.cache = new Map();
133
+ constructor(...args) {
134
+ var __super = (...args) => {
135
+ super(...args);
136
+ };
137
+ if (hasResolver(args)) {
138
+ const [resolvers, config, options = {}] = args;
139
+ __super(resolvers, config);
140
+ this.fs = /* istanbul ignore next */
141
+ options.fs ?? fs;
142
+ } else {
143
+ const [config, options = {}] = args;
144
+ __super(defaultResolvers, config);
145
+ this.fs = /* istanbul ignore next */
146
+ options.fs ?? fs;
220
147
  }
221
- /**
222
- * Get configuration for given filename.
223
- *
224
- * @param filename - Filename to get configuration for.
225
- * @param configOverride - Configuration to merge final result with.
226
- */
227
- getConfigFor(filename, configOverride) {
228
- /* special case when the overridden configuration is marked as root, should
229
- * not try to load any more configuration files */
230
- const override = this.loadFromObject(configOverride !== null && configOverride !== void 0 ? configOverride : {});
231
- if (override.isRootFound()) {
232
- override.init();
233
- return override.resolve();
234
- }
235
- /* special case when the global configuration is marked as root, should not
236
- * try to load and more configuration files */
237
- if (this.globalConfig.isRootFound()) {
238
- const merged = this.globalConfig.merge(this.resolvers, override);
239
- merged.init();
240
- return merged.resolve();
241
- }
242
- const config = this.fromFilename(filename);
243
- const merged = config
244
- ? config.merge(this.resolvers, override)
245
- : this.globalConfig.merge(this.resolvers, override);
246
- merged.init();
247
- return merged.resolve();
148
+ this.cache = /* @__PURE__ */ new Map();
149
+ }
150
+ /**
151
+ * Get configuration for given filename.
152
+ *
153
+ * @param filename - Filename to get configuration for.
154
+ * @param configOverride - Configuration to merge final result with.
155
+ */
156
+ getConfigFor(filename, configOverride) {
157
+ const override = this.loadFromObject(configOverride ?? {});
158
+ if (override.isRootFound()) {
159
+ override.init();
160
+ return override.resolve();
248
161
  }
249
- /**
250
- * Flush configuration cache.
251
- *
252
- * @param filename - If given only the cache for that file is flushed.
253
- */
254
- flushCache(filename) {
255
- if (filename) {
256
- this.cache.delete(filename);
257
- }
258
- else {
259
- this.cache.clear();
260
- }
162
+ if (this.globalConfig.isRootFound()) {
163
+ const merged2 = this.globalConfig.merge(this.resolvers, override);
164
+ merged2.init();
165
+ return merged2.resolve();
261
166
  }
262
- /**
263
- * Load raw configuration from directory traversal.
264
- *
265
- * This configuration is not merged with global configuration and may return
266
- * `null` if no configuration files are found.
267
- */
268
- fromFilename(filename) {
269
- if (filename === "inline") {
270
- return null;
271
- }
272
- const cache = this.cache.get(filename);
273
- if (cache) {
274
- return cache;
275
- }
276
- let found = false;
277
- let current = path.resolve(path.dirname(filename));
278
- let config = this.empty();
279
- // eslint-disable-next-line no-constant-condition -- it will break out when filesystem is traversed
280
- while (true) {
281
- /* search configuration files in current directory */
282
- for (const configFile of findConfigurationFiles(this.fs, current)) {
283
- const local = this.loadFromFile(configFile);
284
- found = true;
285
- config = local.merge(this.resolvers, config);
286
- }
287
- /* stop if a configuration with "root" is set to true */
288
- if (config.isRootFound()) {
289
- break;
290
- }
291
- /* get the parent directory */
292
- const child = current;
293
- current = path.dirname(current);
294
- /* stop if this is the root directory */
295
- if (current === child) {
296
- break;
297
- }
298
- }
299
- /* no config was found by loader, return null and let caller decide what to do */
300
- if (!found) {
301
- this.cache.set(filename, null);
302
- return null;
303
- }
304
- this.cache.set(filename, config);
305
- return config;
167
+ const config = this.fromFilename(filename);
168
+ const merged = config ? config.merge(this.resolvers, override) : this.globalConfig.merge(this.resolvers, override);
169
+ merged.init();
170
+ return merged.resolve();
171
+ }
172
+ /**
173
+ * Flush configuration cache.
174
+ *
175
+ * @param filename - If given only the cache for that file is flushed.
176
+ */
177
+ flushCache(filename) {
178
+ if (filename) {
179
+ this.cache.delete(filename);
180
+ } else {
181
+ this.cache.clear();
306
182
  }
307
- /**
308
- * @internal For testing only
309
- */
310
- _getInternalCache() {
311
- return this.cache;
183
+ }
184
+ /**
185
+ * Load raw configuration from directory traversal.
186
+ *
187
+ * This configuration is not merged with global configuration and may return
188
+ * `null` if no configuration files are found.
189
+ */
190
+ fromFilename(filename) {
191
+ if (filename === "inline") {
192
+ return null;
312
193
  }
313
- defaultConfig() {
314
- return Config.defaultConfig();
194
+ const cache = this.cache.get(filename);
195
+ if (cache) {
196
+ return cache;
315
197
  }
198
+ let found = false;
199
+ let current = path.resolve(path.dirname(filename));
200
+ let config = this.empty();
201
+ while (true) {
202
+ for (const configFile of findConfigurationFiles(this.fs, current)) {
203
+ const local = this.loadFromFile(configFile);
204
+ found = true;
205
+ config = local.merge(this.resolvers, config);
206
+ }
207
+ if (config.isRootFound()) {
208
+ break;
209
+ }
210
+ const child = current;
211
+ current = path.dirname(current);
212
+ if (current === child) {
213
+ break;
214
+ }
215
+ }
216
+ if (!found) {
217
+ this.cache.set(filename, null);
218
+ return null;
219
+ }
220
+ this.cache.set(filename, config);
221
+ return config;
222
+ }
223
+ /**
224
+ * @internal For testing only
225
+ */
226
+ _getInternalCache() {
227
+ return this.cache;
228
+ }
229
+ defaultConfig() {
230
+ return Config.defaultConfig();
231
+ }
316
232
  }
317
233
 
318
234
  const defaults = {
319
- silent: false,
320
- version,
321
- logger(text) {
322
- /* eslint-disable-next-line no-console -- expected to log */
323
- console.error(kleur.red(text));
324
- },
235
+ silent: false,
236
+ version,
237
+ logger(text) {
238
+ console.error(kleur.red(text));
239
+ }
325
240
  };
326
- /**
327
- * Tests if plugin is compatible with html-validate library. Unless the `silent`
328
- * option is used a warning is displayed on the console.
329
- *
330
- * @public
331
- * @since v5.0.0
332
- * @param name - Name of plugin
333
- * @param declared - What library versions the plugin support (e.g. declared peerDependencies)
334
- * @returns - `true` if version is compatible
335
- */
336
241
  function compatibilityCheck(name, declared, options) {
337
- return compatibilityCheckImpl(name, declared, {
338
- ...defaults,
339
- ...options,
340
- });
242
+ return compatibilityCheckImpl(name, declared, {
243
+ ...defaults,
244
+ ...options
245
+ });
341
246
  }
342
247
 
343
- export { FileSystemConfigLoader as F, compatibilityCheck as c, legacyRequire as l, nodejsResolver as n };
248
+ export { FileSystemConfigLoader as F, compatibilityCheck as a, cjsResolver as c, legacyRequire as l, nodejsResolver as n };
344
249
  //# sourceMappingURL=core-nodejs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-nodejs.js","sources":["../../../src/utils/require-uncached.ts","../../../src/config/resolver/nodejs/determine-root-dir.ts","../../../src/config/resolver/nodejs/expand-relative-path.ts","../../../src/config/resolver/nodejs/nodejs-resolver.ts","../../../src/config/loaders/file-system.ts","../../../src/utils/compatibility-check.nodejs.ts"],"sourcesContent":[null,null,null,null,null,null],"names":[],"mappings":";;;;;;AAAA;;AAEG;AACa,SAAA,eAAe,CAAC,OAAuB,EAAE,QAAgB,EAAA;IACxE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;;IAG3C,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,aAAD,CAAC,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAD,CAAC,CAAE,MAAM,EAAE;AACd,QAAA,M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C7C;;AAGD,YAAA,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE;gBACzB,MAAM;aACN;;YAGD,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,YAAA,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;;AAGhC,YAAA,IAAI,OAAO,KAAK,KAAK,EAAE;gBACtB,MAAM;aACN;SACD;;QAGD,IAAI,CAAC,KAAK,EAAE;YACX,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC/B,YAAA,OAAO,IAAI,CAAC;SACZ;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACjC,QAAA,OAAO,MAAM,CAAC;KACd;AAED;;AAEG;IACI,iBAAiB,GAAA;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC;KAClB;IAES,aAAa,GAAA;AACtB,QAAA,OAAO,MAAM,CAAC,aAAa,EAAE,CAAC;KAC9B;AACD;;ACvND,MAAM,QAAQ,GAAyB;AACtC,IAAA,MAAM,EAAE,KAAK;IACb,OAAO;AACP,IAAA,MAAM,CAAC,IAAY,EAAA;;QAElB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;KAC/B;CACD,CAAC;AAEF;;;;;;;;;AASG;SACa,kBAAkB,CACjC,IAAY,EACZ,QAAgB,EAChB,OAAuC,EAAA;AAEvC,IAAA,OAAO,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE;AAC7C,QAAA,GAAG,QAAQ;AACX,QAAA,GAAG,OAAO;AACV,KAAA,CAAC,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"core-nodejs.js","sources":["../../src/utils/require-uncached.ts","../../src/config/resolver/nodejs/determine-root-dir.ts","../../src/config/resolver/nodejs/expand-relative-path.ts","../../src/config/resolver/nodejs/cjs-resolver.ts","../../src/config/loaders/file-system.ts","../../src/utils/compatibility-check.nodejs.ts"],"sourcesContent":["/**\n * Similar to `require(..)` but removes the cached copy first.\n */\nexport function requireUncached(require: NodeJS.Require, moduleId: string): unknown {\n\tconst filename = require.resolve(moduleId);\n\n\t/* remove references from the parent module to prevent memory leak */\n\tconst m = require.cache[filename];\n\tif (m?.parent) {\n\t\tconst { parent } = m;\n\t\tfor (let i = parent.children.length - 1; i >= 0; i--) {\n\t\t\tif (parent.children[i].id === filename) {\n\t\t\t\tparent.children.splice(i, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\t/* remove old module from cache */\n\t/* eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- needed to perform its function */\n\tdelete require.cache[filename];\n\n\t/* eslint-disable-next-line import/no-dynamic-require, security/detect-non-literal-require -- as expected but should be moved to upcoming resolver class */\n\treturn require(filename);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nlet cachedRootDir: string | null = null;\n\ninterface FSLike {\n\texistsSync(path: string): boolean;\n}\n\n/**\n * @internal\n */\nexport function determineRootDirImpl(intial: string, fs: FSLike): string {\n\t/* try to locate package.json */\n\tlet current = intial;\n\n\t// eslint-disable-next-line no-constant-condition -- break outs when filesystem is traversed\n\twhile (true) {\n\t\tconst search = path.join(current, \"package.json\");\n\t\tif (fs.existsSync(search)) {\n\t\t\treturn current;\n\t\t}\n\n\t\t/* get the parent directory */\n\t\tconst child = current;\n\t\tcurrent = path.dirname(current);\n\n\t\t/* stop if this is the root directory */\n\t\tif (current === child) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* default to working directory if no package.json is found */\n\treturn intial;\n}\n\n/**\n * Try to determine root directory based on the location of the closest\n * `package.json`. Fallbacks on `process.cwd()` if no package.json was found.\n *\n * @internal\n */\n/* istanbul ignore next: cached version of determineRootDirImpl, no need to test */\nexport function determineRootDir(): string {\n\tif (cachedRootDir === null) {\n\t\tcachedRootDir = determineRootDirImpl(process.cwd(), fs);\n\t}\n\treturn cachedRootDir;\n}\n","import path from \"node:path\";\n\n/**\n * @internal\n */\nexport function expandRelativePath<T>(value: string | T, { cwd }: { cwd: string }): string | T {\n\tif (typeof value === \"string\" && value.startsWith(\".\")) {\n\t\treturn path.normalize(path.join(cwd, value));\n\t} else {\n\t\treturn value;\n\t}\n}\n","import path from \"node:path\";\nimport { type MetaDataTable } from \"../../../meta\";\nimport { type Plugin } from \"../../../plugin\";\nimport { legacyRequire } from \"../../../resolve\";\nimport { type Transformer } from \"../../../transform\";\nimport { requireUncached } from \"../../../utils\";\nimport { type ConfigData } from \"../../config-data\";\nimport { ConfigError } from \"../../error\";\nimport { type Resolver, type ResolverOptions } from \"../resolver\";\nimport { determineRootDir } from \"./determine-root-dir\";\nimport { expandRelativePath } from \"./expand-relative-path\";\n\n/**\n * @internal\n */\nexport interface RequireError extends Error {\n\tcode: string;\n}\n\nfunction isRequireError(error: unknown): error is RequireError {\n\treturn Boolean(error && typeof error === \"object\" && \"code\" in error);\n}\n\nfunction isTransformer(value: Transformer | Plugin): value is Transformer {\n\treturn typeof value === \"function\";\n}\n\n/**\n * CommonJS resolver.\n *\n * @public\n * @since 8.8.0\n */\nexport type CommonJSResolver = Required<Resolver>;\n\n/**\n * CommonJS resolver.\n *\n * @public\n * @deprecated Deprecated alias for [[CommonJSResolver]].\n * @since 8.0.0\n */\nexport type NodeJSResolver = Required<Resolver>;\n\n/**\n * Create a new resolver for NodeJS packages using `require(..)`.\n *\n * If the module name contains `<rootDir>` (e.g. `<rootDir/foo`) it will be\n * expanded relative to the root directory either explicitly set by the\n * `rootDir` parameter or determined automatically by the closest `package.json`\n * file (starting at the current working directory).\n *\n * @public\n * @since 8.8.0\n */\nexport function cjsResolver(options: { rootDir?: string } = {}): CommonJSResolver {\n\tconst rootDir = options.rootDir ?? determineRootDir();\n\n\tfunction internalRequire<T = unknown>(id: string, { cache }: ResolverOptions): T | null {\n\t\tconst moduleName = id.replace(\"<rootDir>\", rootDir);\n\t\ttry {\n\t\t\t/* istanbul ignore else: the tests only runs the cached versions to get\n\t\t\t * unmodified access to `require`, the implementation of `requireUncached`\n\t\t\t * is assumed to be tested elsewhere */\n\t\t\tif (cache) {\n\t\t\t\treturn legacyRequire(moduleName) as T;\n\t\t\t} else {\n\t\t\t\treturn requireUncached(legacyRequire, moduleName) as T;\n\t\t\t}\n\t\t} catch (err: unknown) {\n\t\t\tif (isRequireError(err) && err.code === \"MODULE_NOT_FOUND\") {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\treturn {\n\t\tname: \"nodejs-resolver\",\n\n\t\tresolveElements(id: string, options: ResolverOptions): MetaDataTable | null {\n\t\t\treturn internalRequire(id, options);\n\t\t},\n\n\t\tresolveConfig(id: string, options: ResolverOptions): ConfigData | null {\n\t\t\tconst configData = internalRequire<ConfigData>(id, options);\n\t\t\tif (!configData) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t/* expand any relative paths */\n\t\t\tconst cwd = path.dirname(id);\n\t\t\tconst expand = <T>(value: string | T): string | T => expandRelativePath(value, { cwd });\n\n\t\t\tif (Array.isArray(configData.elements)) {\n\t\t\t\tconfigData.elements = configData.elements.map(expand);\n\t\t\t}\n\n\t\t\tif (Array.isArray(configData.extends)) {\n\t\t\t\tconfigData.extends = configData.extends.map(expand);\n\t\t\t}\n\n\t\t\tif (Array.isArray(configData.plugins)) {\n\t\t\t\tconfigData.plugins = configData.plugins.map(expand);\n\t\t\t}\n\n\t\t\treturn configData;\n\t\t},\n\n\t\tresolvePlugin(id: string, options: ResolverOptions): Plugin | null {\n\t\t\treturn internalRequire<Plugin>(id, options);\n\t\t},\n\n\t\tresolveTransformer(id: string, options: ResolverOptions): Transformer | null {\n\t\t\tconst mod = internalRequire<Transformer | Plugin>(id, options);\n\t\t\tif (!mod) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (isTransformer(mod)) {\n\t\t\t\treturn mod;\n\t\t\t}\n\n\t\t\t/* this is not a proper transformer, is it a plugin exposing a transformer? */\n\t\t\tif (mod.transformer) {\n\t\t\t\tthrow new ConfigError(\n\t\t\t\t\t`Module \"${id}\" is not a valid transformer. This looks like a plugin, did you forget to load the plugin first?`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new ConfigError(`Module \"${id}\" is not a valid transformer.`);\n\t\t},\n\t};\n}\n\n/**\n * Create a new resolver for NodeJS packages using `require(..)`.\n *\n * If the module name contains `<rootDir>` (e.g. `<rootDir/foo`) it will be\n * expanded relative to the root directory either explicitly set by the\n * `rootDir` parameter or determined automatically by the closest `package.json`\n * file (starting at the current working directory).\n *\n * @public\n * @deprecated Deprecated alias for [[commonjsResolver]].\n * @since 8.0.0\n */\n/* istanbul ignore next -- deprecated alias */\nexport function nodejsResolver(options: { rootDir?: string } = {}): NodeJSResolver {\n\treturn cjsResolver(options);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Config } from \"../config\";\nimport { type ConfigData } from \"../config-data\";\nimport { ConfigLoader } from \"../config-loader\";\nimport { type ResolvedConfig } from \"../resolved-config\";\nimport { type Resolver } from \"../resolver\";\nimport { type FSLike, cjsResolver } from \"../resolver/nodejs\";\n\n/**\n * Options for [[FileSystemConfigLoader]].\n *\n * @public\n */\nexport interface FileSystemConfigLoaderOptions {\n\t/** An implementation of `fs` as needed by [[FileSystemConfigLoader]] */\n\tfs: FSLike;\n}\n\n/**\n * @internal\n */\nfunction findConfigurationFiles(fs: FSLike, directory: string): string[] {\n\treturn [\"json\", \"cjs\", \"js\"]\n\t\t.map((extension) => path.join(directory, `.htmlvalidate.${extension}`))\n\t\t.filter((filePath) => fs.existsSync(filePath));\n}\n\nconst defaultResolvers: Resolver[] = [cjsResolver()];\n\ntype ConstructorParametersDefault = [ConfigData?, Partial<FileSystemConfigLoaderOptions>?];\ntype ConstructorParametersResolver = [\n\tResolver[],\n\tConfigData?,\n\tPartial<FileSystemConfigLoaderOptions>?,\n];\ntype ConstructorParameters = ConstructorParametersDefault | ConstructorParametersResolver;\n\nfunction hasResolver(value: ConstructorParameters): value is ConstructorParametersResolver {\n\treturn Array.isArray(value[0]);\n}\n\n/**\n * Loads configuration by traversing filesystem.\n *\n * Configuration is read from three sources and in the following order:\n *\n * 1. Global configuration passed to constructor.\n * 2. Configuration files found when traversing the directory structure.\n * 3. Override passed to this function.\n *\n * The following configuration filenames are searched:\n *\n * - `.htmlvalidate.json`\n * - `.htmlvalidate.js`\n * - `.htmlvalidate.cjs`\n *\n * Global configuration is used when no configuration file is found. The\n * result is always merged with override if present.\n *\n * The `root` property set to `true` affects the configuration as following:\n *\n * 1. If set in override the override is returned as-is.\n * 2. If set in the global config the override is merged into global and\n * returned. No configuration files are searched.\n * 3. Setting `root` in configuration file only stops directory traversal.\n *\n * @public\n */\nexport class FileSystemConfigLoader extends ConfigLoader {\n\tprotected cache: Map<string, Config | null>;\n\tprivate fs: FSLike;\n\n\t/**\n\t * Create a filesystem configuration loader with default resolvers.\n\t *\n\t * @param fs - `fs` implementation,\n\t * @param config - Global configuration.\n\t * @param configFactory - Optional configuration factory.\n\t */\n\tpublic constructor(config?: ConfigData, options?: Partial<FileSystemConfigLoaderOptions>);\n\n\t/**\n\t * Create a filesystem configuration loader with custom resolvers.\n\t *\n\t * @param fs - `fs` implementation,\n\t * @param resolvers - Resolvers to use.\n\t * @param config - Global configuration.\n\t * @param configFactory - Optional configuration factory.\n\t */\n\tpublic constructor(\n\t\tresolvers: Resolver[],\n\t\tconfig?: ConfigData,\n\t\toptions?: Partial<FileSystemConfigLoaderOptions>,\n\t);\n\n\tpublic constructor(...args: ConstructorParameters) {\n\t\tif (hasResolver(args)) {\n\t\t\t/* istanbul ignore next */\n\t\t\tconst [resolvers, config, options = {}] = args;\n\t\t\tsuper(resolvers, config);\n\t\t\tthis.fs = /* istanbul ignore next */ options.fs ?? fs;\n\t\t} else {\n\t\t\t/* istanbul ignore next */\n\t\t\tconst [config, options = {}] = args;\n\t\t\tsuper(defaultResolvers, config);\n\t\t\tthis.fs = /* istanbul ignore next */ options.fs ?? fs;\n\t\t}\n\t\tthis.cache = new Map();\n\t}\n\n\t/**\n\t * Get configuration for given filename.\n\t *\n\t * @param filename - Filename to get configuration for.\n\t * @param configOverride - Configuration to merge final result with.\n\t */\n\tpublic override getConfigFor(filename: string, configOverride?: ConfigData): ResolvedConfig {\n\t\t/* special case when the overridden configuration is marked as root, should\n\t\t * not try to load any more configuration files */\n\t\tconst override = this.loadFromObject(configOverride ?? {});\n\t\tif (override.isRootFound()) {\n\t\t\toverride.init();\n\t\t\treturn override.resolve();\n\t\t}\n\n\t\t/* special case when the global configuration is marked as root, should not\n\t\t * try to load and more configuration files */\n\t\tif (this.globalConfig.isRootFound()) {\n\t\t\tconst merged = this.globalConfig.merge(this.resolvers, override);\n\t\t\tmerged.init();\n\t\t\treturn merged.resolve();\n\t\t}\n\n\t\tconst config = this.fromFilename(filename);\n\t\tconst merged = config\n\t\t\t? config.merge(this.resolvers, override)\n\t\t\t: this.globalConfig.merge(this.resolvers, override);\n\t\tmerged.init();\n\t\treturn merged.resolve();\n\t}\n\n\t/**\n\t * Flush configuration cache.\n\t *\n\t * @param filename - If given only the cache for that file is flushed.\n\t */\n\tpublic override flushCache(filename?: string): void {\n\t\tif (filename) {\n\t\t\tthis.cache.delete(filename);\n\t\t} else {\n\t\t\tthis.cache.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Load raw configuration from directory traversal.\n\t *\n\t * This configuration is not merged with global configuration and may return\n\t * `null` if no configuration files are found.\n\t */\n\tpublic fromFilename(filename: string): Config | null {\n\t\tif (filename === \"inline\") {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst cache = this.cache.get(filename);\n\t\tif (cache) {\n\t\t\treturn cache;\n\t\t}\n\n\t\tlet found = false;\n\t\tlet current = path.resolve(path.dirname(filename));\n\t\tlet config = this.empty();\n\n\t\t// eslint-disable-next-line no-constant-condition -- it will break out when filesystem is traversed\n\t\twhile (true) {\n\t\t\t/* search configuration files in current directory */\n\t\t\tfor (const configFile of findConfigurationFiles(this.fs, current)) {\n\t\t\t\tconst local = this.loadFromFile(configFile);\n\t\t\t\tfound = true;\n\t\t\t\tconfig = local.merge(this.resolvers, config);\n\t\t\t}\n\n\t\t\t/* stop if a configuration with \"root\" is set to true */\n\t\t\tif (config.isRootFound()) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t/* get the parent directory */\n\t\t\tconst child = current;\n\t\t\tcurrent = path.dirname(current);\n\n\t\t\t/* stop if this is the root directory */\n\t\t\tif (current === child) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t/* no config was found by loader, return null and let caller decide what to do */\n\t\tif (!found) {\n\t\t\tthis.cache.set(filename, null);\n\t\t\treturn null;\n\t\t}\n\n\t\tthis.cache.set(filename, config);\n\t\treturn config;\n\t}\n\n\t/**\n\t * @internal For testing only\n\t */\n\tpublic _getInternalCache(): Map<string, Config | null> {\n\t\treturn this.cache;\n\t}\n\n\tprotected defaultConfig(): Config {\n\t\treturn Config.defaultConfig();\n\t}\n}\n","import kleur from \"kleur\";\nimport { version } from \"../generated/package\";\nimport { type CompatibilityOptions, compatibilityCheckImpl } from \"./compatibility-check\";\n\nconst defaults: CompatibilityOptions = {\n\tsilent: false,\n\tversion,\n\tlogger(text: string): void {\n\t\t/* eslint-disable-next-line no-console -- expected to log */\n\t\tconsole.error(kleur.red(text));\n\t},\n};\n\n/**\n * Tests if plugin is compatible with html-validate library. Unless the `silent`\n * option is used a warning is displayed on the console.\n *\n * @public\n * @since v5.0.0\n * @param name - Name of plugin\n * @param declared - What library versions the plugin support (e.g. declared peerDependencies)\n * @returns - `true` if version is compatible\n */\nexport function compatibilityCheck(\n\tname: string,\n\tdeclared: string,\n\toptions?: Partial<CompatibilityOptions>,\n): boolean {\n\treturn compatibilityCheckImpl(name, declared, {\n\t\t...defaults,\n\t\t...options,\n\t});\n}\n"],"names":["fs","options","merged"],"mappings":";;;;;;AAGgB,SAAA,eAAA,CAAgB,SAAyB,QAA2B,EAAA;AACnF,EAAM,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