html-validate 10.1.1 → 10.2.1
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/cli.js +201 -203
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core-browser.js.map +1 -1
- package/dist/cjs/core-nodejs.js +3 -3
- package/dist/cjs/core-nodejs.js.map +1 -1
- package/dist/cjs/core.js +431 -368
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/elements.js +2 -2
- package/dist/cjs/elements.js.map +1 -1
- package/dist/cjs/html-validate.js +2 -3
- package/dist/cjs/html-validate.js.map +1 -1
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/jest-diff.js +2 -0
- package/dist/cjs/jest-diff.js.map +1 -1
- package/dist/cjs/jest-worker.js.map +1 -1
- package/dist/cjs/jest.js +1 -1
- package/dist/cjs/jest.js.map +1 -1
- package/dist/cjs/matchers-jestonly.js +1 -1
- package/dist/cjs/matchers-jestonly.js.map +1 -1
- package/dist/cjs/matchers.js.map +1 -1
- package/dist/cjs/meta-helper.js +4 -4
- package/dist/cjs/meta-helper.js.map +1 -1
- package/dist/cjs/test-utils.js +2 -2
- package/dist/cjs/test-utils.js.map +2 -2
- package/dist/cjs/tsdoc-metadata.json +1 -1
- package/dist/cjs/vitest.js.map +1 -1
- package/dist/esm/browser.js +1 -1
- package/dist/esm/cli.js +201 -202
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/core-browser.js.map +1 -1
- package/dist/esm/core-nodejs.js +3 -3
- package/dist/esm/core-nodejs.js.map +1 -1
- package/dist/esm/core.js +432 -369
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/elements.js +3 -3
- package/dist/esm/elements.js.map +1 -1
- package/dist/esm/html-validate.js +2 -3
- package/dist/esm/html-validate.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/jest-diff.js +2 -0
- package/dist/esm/jest-diff.js.map +1 -1
- package/dist/esm/jest-worker.js.map +1 -1
- package/dist/esm/jest.js +1 -1
- package/dist/esm/jest.js.map +1 -1
- package/dist/esm/matchers-jestonly.js +1 -1
- package/dist/esm/matchers-jestonly.js.map +1 -1
- package/dist/esm/matchers.js.map +1 -1
- package/dist/esm/meta-helper.js +4 -4
- package/dist/esm/meta-helper.js.map +1 -1
- package/dist/esm/test-utils.js +1 -1
- package/dist/esm/test-utils.js.map +1 -1
- package/dist/esm/vitest.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/browser.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/cjs/cli.js
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
var coreNodejs = require('./core-nodejs.js');
|
|
4
4
|
var core = require('./core.js');
|
|
5
5
|
var path$1 = require('node:path/posix');
|
|
6
|
-
var fs = require('fs');
|
|
6
|
+
var fs = require('node:fs');
|
|
7
7
|
var path = require('node:path');
|
|
8
8
|
var glob = require('glob');
|
|
9
9
|
var prompts = require('prompts');
|
|
10
10
|
require('./meta-helper.js');
|
|
11
|
-
var fs$1 = require('node:fs');
|
|
12
|
-
var betterAjvErrors = require('@sidvind/better-ajv-errors');
|
|
13
11
|
var kleur = require('kleur');
|
|
12
|
+
var betterAjvErrors = require('@sidvind/better-ajv-errors');
|
|
14
13
|
|
|
15
14
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
16
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -19,9 +18,8 @@ var path__default$1 = /*#__PURE__*/_interopDefault(path$1);
|
|
|
19
18
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
20
19
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
21
20
|
var prompts__default = /*#__PURE__*/_interopDefault(prompts);
|
|
22
|
-
var fs__default$1 = /*#__PURE__*/_interopDefault(fs$1);
|
|
23
|
-
var betterAjvErrors__default = /*#__PURE__*/_interopDefault(betterAjvErrors);
|
|
24
21
|
var kleur__default = /*#__PURE__*/_interopDefault(kleur);
|
|
22
|
+
var betterAjvErrors__default = /*#__PURE__*/_interopDefault(betterAjvErrors);
|
|
25
23
|
|
|
26
24
|
const DEFAULT_EXTENSIONS = ["html"];
|
|
27
25
|
function isDirectory(filename) {
|
|
@@ -112,55 +110,34 @@ function getFormatter(formatters) {
|
|
|
112
110
|
};
|
|
113
111
|
}
|
|
114
112
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Clear cache
|
|
130
|
-
*/
|
|
131
|
-
clearCache() {
|
|
132
|
-
this.cacheIgnore.clear();
|
|
133
|
-
}
|
|
134
|
-
match(target) {
|
|
135
|
-
let current = path__default.default.dirname(target);
|
|
136
|
-
while (true) {
|
|
137
|
-
const relative = path__default.default.relative(current, target);
|
|
138
|
-
const filename = path__default.default.join(current, ".htmlvalidateignore");
|
|
139
|
-
const ig = this.parseFile(filename);
|
|
140
|
-
if (ig?.ignores(relative)) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
const child = current;
|
|
144
|
-
current = path__default.default.dirname(current);
|
|
145
|
-
if (current === child) {
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return false;
|
|
113
|
+
function parseSeverity(ruleId, severity) {
|
|
114
|
+
switch (severity) {
|
|
115
|
+
case "off":
|
|
116
|
+
case "0":
|
|
117
|
+
return "off";
|
|
118
|
+
case "warn":
|
|
119
|
+
case "1":
|
|
120
|
+
return "warn";
|
|
121
|
+
case "error":
|
|
122
|
+
case "2":
|
|
123
|
+
return "error";
|
|
124
|
+
default:
|
|
125
|
+
throw new Error(`Invalid severity "${severity}" for rule "${ruleId}"`);
|
|
150
126
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const ig = core.ignore().add(content);
|
|
161
|
-
this.cacheIgnore.set(filename, ig);
|
|
162
|
-
return ig;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function parseItem(value) {
|
|
130
|
+
const [ruleId, severity = "error"] = value.split(":", 2);
|
|
131
|
+
return { ruleId, severity: parseSeverity(ruleId, severity) };
|
|
132
|
+
}
|
|
133
|
+
function getRuleConfig(values) {
|
|
134
|
+
if (typeof values === "string") {
|
|
135
|
+
return getRuleConfig([values]);
|
|
163
136
|
}
|
|
137
|
+
return values.reduce((parsedRules, value) => {
|
|
138
|
+
const { ruleId, severity } = parseItem(value.trim());
|
|
139
|
+
return { [ruleId]: severity, ...parsedRules };
|
|
140
|
+
}, {});
|
|
164
141
|
}
|
|
165
142
|
|
|
166
143
|
const frameworkConfig = {
|
|
@@ -229,41 +206,62 @@ async function init$1(cwd) {
|
|
|
229
206
|
];
|
|
230
207
|
const answers = await prompts__default.default(questions);
|
|
231
208
|
let config = initialConfig;
|
|
232
|
-
config = addFrameworks(config, answers
|
|
209
|
+
config = addFrameworks(config, answers["frameworks"]);
|
|
233
210
|
await writeConfig(filename, config);
|
|
234
211
|
return {
|
|
235
212
|
filename
|
|
236
213
|
};
|
|
237
214
|
}
|
|
238
215
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
case "warn":
|
|
245
|
-
case "1":
|
|
246
|
-
return "warn";
|
|
247
|
-
case "error":
|
|
248
|
-
case "2":
|
|
249
|
-
return "error";
|
|
250
|
-
default:
|
|
251
|
-
throw new Error(`Invalid severity "${severity}" for rule "${ruleId}"`);
|
|
216
|
+
class IsIgnored {
|
|
217
|
+
/** Cache for parsed .htmlvalidateignore files */
|
|
218
|
+
cacheIgnore;
|
|
219
|
+
constructor() {
|
|
220
|
+
this.cacheIgnore = /* @__PURE__ */ new Map();
|
|
252
221
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Searches ".htmlvalidateignore" files from filesystem and returns `true` if
|
|
224
|
+
* one of them contains a pattern matching given filename.
|
|
225
|
+
*/
|
|
226
|
+
isIgnored(filename) {
|
|
227
|
+
return this.match(filename);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Clear cache
|
|
231
|
+
*/
|
|
232
|
+
clearCache() {
|
|
233
|
+
this.cacheIgnore.clear();
|
|
234
|
+
}
|
|
235
|
+
match(target) {
|
|
236
|
+
let current = path__default.default.dirname(target);
|
|
237
|
+
for (; ; ) {
|
|
238
|
+
const relative = path__default.default.relative(current, target);
|
|
239
|
+
const filename = path__default.default.join(current, ".htmlvalidateignore");
|
|
240
|
+
const ig = this.parseFile(filename);
|
|
241
|
+
if (ig?.ignores(relative)) {
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
const child = current;
|
|
245
|
+
current = path__default.default.dirname(current);
|
|
246
|
+
if (current === child) {
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
parseFile(filename) {
|
|
253
|
+
if (this.cacheIgnore.has(filename)) {
|
|
254
|
+
return this.cacheIgnore.get(filename);
|
|
255
|
+
}
|
|
256
|
+
if (!fs__default.default.existsSync(filename)) {
|
|
257
|
+
this.cacheIgnore.set(filename, void 0);
|
|
258
|
+
return void 0;
|
|
259
|
+
}
|
|
260
|
+
const content = fs__default.default.readFileSync(filename, "utf-8");
|
|
261
|
+
const ig = core.ignore().add(content);
|
|
262
|
+
this.cacheIgnore.set(filename, ig);
|
|
263
|
+
return ig;
|
|
262
264
|
}
|
|
263
|
-
return values.reduce((parsedRules, value) => {
|
|
264
|
-
const { ruleId, severity } = parseItem(value.trim());
|
|
265
|
-
return { [ruleId]: severity, ...parsedRules };
|
|
266
|
-
}, {});
|
|
267
265
|
}
|
|
268
266
|
|
|
269
267
|
const resolver = coreNodejs.esmResolver();
|
|
@@ -391,51 +389,53 @@ class CLI {
|
|
|
391
389
|
}
|
|
392
390
|
}
|
|
393
391
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
392
|
+
const jsonIgnored = [
|
|
393
|
+
"annotation",
|
|
394
|
+
"blockedRules",
|
|
395
|
+
"cache",
|
|
396
|
+
"closed",
|
|
397
|
+
"depth",
|
|
398
|
+
"disabledRules",
|
|
399
|
+
"nodeType",
|
|
400
|
+
"unique",
|
|
401
|
+
"voidElement"
|
|
402
|
+
];
|
|
403
|
+
const jsonFiltered = [
|
|
404
|
+
"childNodes",
|
|
405
|
+
"children",
|
|
406
|
+
"data",
|
|
407
|
+
"meta",
|
|
408
|
+
"metaElement",
|
|
409
|
+
"originalData",
|
|
410
|
+
"parent"
|
|
411
|
+
];
|
|
412
|
+
function isLocation(key, value) {
|
|
413
|
+
return Boolean(value && (key === "location" || key.endsWith("Location")));
|
|
404
414
|
}
|
|
405
|
-
function
|
|
406
|
-
|
|
407
|
-
const filename = path__default.default.relative(process.cwd(), err.filename);
|
|
408
|
-
console.error(kleur__default.default.red(`A configuration error was found in "${filename}":`));
|
|
409
|
-
} else {
|
|
410
|
-
console.error(kleur__default.default.red(`A configuration error was found:`));
|
|
411
|
-
}
|
|
412
|
-
console.group();
|
|
413
|
-
{
|
|
414
|
-
console.error(prettyError(err));
|
|
415
|
-
}
|
|
416
|
-
console.groupEnd();
|
|
415
|
+
function isIgnored(key) {
|
|
416
|
+
return key.startsWith("_") || jsonIgnored.includes(key);
|
|
417
417
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
418
|
+
function isFiltered(key, value) {
|
|
419
|
+
return Boolean(value && jsonFiltered.includes(key));
|
|
420
|
+
}
|
|
421
|
+
function eventReplacer(key, value) {
|
|
422
|
+
if (isLocation(key, value)) {
|
|
423
|
+
const filename = value.filename;
|
|
424
|
+
const line = String(value.line);
|
|
425
|
+
const column = String(value.column);
|
|
426
|
+
return `${filename}:${line}:${column}`;
|
|
425
427
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
return [
|
|
431
|
-
kleur__default.default.red(`Error: ${message}.`),
|
|
432
|
-
"",
|
|
433
|
-
`Either ensure you are running a supported NodeJS version:`,
|
|
434
|
-
` Current: ${currentVersion}`,
|
|
435
|
-
` Required: ${requiredVersion.join(", ")} or later`,
|
|
436
|
-
`Or set NODE_OPTIONS="--experimental-import-meta-resolve"`
|
|
437
|
-
].join("\n");
|
|
428
|
+
if (isIgnored(key)) {
|
|
429
|
+
return void 0;
|
|
430
|
+
}
|
|
431
|
+
if (isFiltered(key, value)) {
|
|
432
|
+
return "[truncated]";
|
|
438
433
|
}
|
|
434
|
+
return value;
|
|
435
|
+
}
|
|
436
|
+
function eventFormatter(entry) {
|
|
437
|
+
const strdata = JSON.stringify(entry.data, eventReplacer, 2);
|
|
438
|
+
return `${entry.event}: ${strdata}`;
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
var Mode = /* @__PURE__ */ ((Mode2) => {
|
|
@@ -467,6 +467,48 @@ function modeToFlag(mode) {
|
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
+
async function dump(htmlvalidate, output, files, mode) {
|
|
471
|
+
let lines;
|
|
472
|
+
switch (mode) {
|
|
473
|
+
case Mode.DUMP_EVENTS:
|
|
474
|
+
lines = files.map(async (filename) => {
|
|
475
|
+
const lines2 = await htmlvalidate.dumpEvents(filename);
|
|
476
|
+
return lines2.map(eventFormatter);
|
|
477
|
+
});
|
|
478
|
+
break;
|
|
479
|
+
case Mode.DUMP_TOKENS:
|
|
480
|
+
lines = files.map(async (filename) => {
|
|
481
|
+
const lines2 = await htmlvalidate.dumpTokens(filename);
|
|
482
|
+
return lines2.map((entry) => {
|
|
483
|
+
const data = JSON.stringify(entry.data);
|
|
484
|
+
return `TOKEN: ${entry.token}
|
|
485
|
+
Data: ${data}
|
|
486
|
+
Location: ${entry.location}`;
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
break;
|
|
490
|
+
case Mode.DUMP_TREE:
|
|
491
|
+
lines = files.map((filename) => htmlvalidate.dumpTree(filename));
|
|
492
|
+
break;
|
|
493
|
+
case Mode.DUMP_SOURCE:
|
|
494
|
+
lines = files.map((filename) => htmlvalidate.dumpSource(filename));
|
|
495
|
+
break;
|
|
496
|
+
default:
|
|
497
|
+
throw new Error(`Unknown mode "${String(mode)}"`);
|
|
498
|
+
}
|
|
499
|
+
const flat = (await Promise.all(lines)).reduce((s, c) => s.concat(c), []);
|
|
500
|
+
output.write(flat.join("\n"));
|
|
501
|
+
output.write("\n");
|
|
502
|
+
return Promise.resolve(true);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
async function init(cli, output, options) {
|
|
506
|
+
const result = await cli.init(options.cwd);
|
|
507
|
+
output.write(`Configuration written to "${result.filename}"
|
|
508
|
+
`);
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
|
|
470
512
|
function renameStdin(report, filename) {
|
|
471
513
|
const stdin = report.results.find((cur) => cur.filePath === "/dev/stdin");
|
|
472
514
|
if (stdin) {
|
|
@@ -501,13 +543,6 @@ html-validate found too many warnings (maximum: ${String(options.maxWarnings)}).
|
|
|
501
543
|
return merged.valid;
|
|
502
544
|
}
|
|
503
545
|
|
|
504
|
-
async function init(cli, output, options) {
|
|
505
|
-
const result = await cli.init(options.cwd);
|
|
506
|
-
output.write(`Configuration written to "${result.filename}"
|
|
507
|
-
`);
|
|
508
|
-
return true;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
546
|
async function printConfig(htmlvalidate, output, files) {
|
|
512
547
|
if (files.length > 1) {
|
|
513
548
|
output.write(`\`--print-config\` expected a single filename but got multiple:
|
|
@@ -527,88 +562,51 @@ async function printConfig(htmlvalidate, output, files) {
|
|
|
527
562
|
return true;
|
|
528
563
|
}
|
|
529
564
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
"closed",
|
|
535
|
-
"depth",
|
|
536
|
-
"disabledRules",
|
|
537
|
-
"nodeType",
|
|
538
|
-
"unique",
|
|
539
|
-
"voidElement"
|
|
540
|
-
];
|
|
541
|
-
const jsonFiltered = [
|
|
542
|
-
"childNodes",
|
|
543
|
-
"children",
|
|
544
|
-
"data",
|
|
545
|
-
"meta",
|
|
546
|
-
"metaElement",
|
|
547
|
-
"originalData",
|
|
548
|
-
"parent"
|
|
549
|
-
];
|
|
550
|
-
function isLocation(key, value) {
|
|
551
|
-
return Boolean(value && (key === "location" || key.endsWith("Location")));
|
|
552
|
-
}
|
|
553
|
-
function isIgnored(key) {
|
|
554
|
-
return key.startsWith("_") || jsonIgnored.includes(key);
|
|
555
|
-
}
|
|
556
|
-
function isFiltered(key, value) {
|
|
557
|
-
return Boolean(value && jsonFiltered.includes(key));
|
|
558
|
-
}
|
|
559
|
-
function eventReplacer(key, value) {
|
|
560
|
-
if (isLocation(key, value)) {
|
|
561
|
-
const filename = value.filename;
|
|
562
|
-
const line = String(value.line);
|
|
563
|
-
const column = String(value.column);
|
|
564
|
-
return `${filename}:${line}:${column}`;
|
|
565
|
+
function prettyError(err) {
|
|
566
|
+
let json;
|
|
567
|
+
if (err.filename && fs__default.default.existsSync(err.filename)) {
|
|
568
|
+
json = fs__default.default.readFileSync(err.filename, "utf-8");
|
|
565
569
|
}
|
|
566
|
-
|
|
567
|
-
|
|
570
|
+
return betterAjvErrors__default.default(err.schema, err.obj, err.errors, {
|
|
571
|
+
format: "cli",
|
|
572
|
+
indent: 2,
|
|
573
|
+
json
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
function handleSchemaValidationError(console, err) {
|
|
577
|
+
if (err.filename) {
|
|
578
|
+
const filename = path__default.default.relative(process.cwd(), err.filename);
|
|
579
|
+
console.error(kleur__default.default.red(`A configuration error was found in "${filename}":`));
|
|
580
|
+
} else {
|
|
581
|
+
console.error(kleur__default.default.red(`A configuration error was found:`));
|
|
568
582
|
}
|
|
569
|
-
|
|
570
|
-
|
|
583
|
+
console.group();
|
|
584
|
+
{
|
|
585
|
+
console.error(prettyError(err));
|
|
571
586
|
}
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
function eventFormatter(entry) {
|
|
575
|
-
const strdata = JSON.stringify(entry.data, eventReplacer, 2);
|
|
576
|
-
return `${entry.event}: ${strdata}`;
|
|
587
|
+
console.groupEnd();
|
|
577
588
|
}
|
|
578
589
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
break;
|
|
599
|
-
case Mode.DUMP_TREE:
|
|
600
|
-
lines = files.map((filename) => htmlvalidate.dumpTree(filename));
|
|
601
|
-
break;
|
|
602
|
-
case Mode.DUMP_SOURCE:
|
|
603
|
-
lines = files.map((filename) => htmlvalidate.dumpSource(filename));
|
|
604
|
-
break;
|
|
605
|
-
default:
|
|
606
|
-
throw new Error(`Unknown mode "${String(mode)}"`);
|
|
590
|
+
class ImportResolveMissingError extends core.UserError {
|
|
591
|
+
constructor() {
|
|
592
|
+
const message = `import.meta.resolve(..) is not available on this system`;
|
|
593
|
+
super(message);
|
|
594
|
+
Error.captureStackTrace(this, ImportResolveMissingError);
|
|
595
|
+
this.name = ImportResolveMissingError.name;
|
|
596
|
+
}
|
|
597
|
+
prettyFormat() {
|
|
598
|
+
const { message } = this;
|
|
599
|
+
const currentVersion = process.version;
|
|
600
|
+
const requiredVersion = core.engines.node.split("||").map((it) => `v${it.replace(/^[^\d]+/, "").trim()}`);
|
|
601
|
+
return [
|
|
602
|
+
kleur__default.default.red(`Error: ${message}.`),
|
|
603
|
+
"",
|
|
604
|
+
`Either ensure you are running a supported NodeJS version:`,
|
|
605
|
+
` Current: ${currentVersion}`,
|
|
606
|
+
` Required: ${requiredVersion.join(", ")} or later`,
|
|
607
|
+
`Or set NODE_OPTIONS="--experimental-import-meta-resolve"`
|
|
608
|
+
].join("\n");
|
|
607
609
|
}
|
|
608
|
-
const flat = (await Promise.all(lines)).reduce((s, c) => s.concat(c), []);
|
|
609
|
-
output.write(flat.join("\n"));
|
|
610
|
-
output.write("\n");
|
|
611
|
-
return Promise.resolve(true);
|
|
612
610
|
}
|
|
613
611
|
|
|
614
612
|
function haveImportMetaResolve() {
|