vitest 0.27.0 → 0.27.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/LICENSE.md +13 -12
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +9 -9
- package/dist/{chunk-api-setup.16ac28c0.js → chunk-api-setup.2be3cc38.js} +54 -30
- package/dist/{chunk-install-pkg.6dd2bae6.js → chunk-install-pkg.7b006b3e.js} +8 -8
- package/dist/{chunk-integrations-globals.3dfaeb99.js → chunk-integrations-globals.02f1259c.js} +6 -6
- package/dist/{chunk-mock-date.a1c85759.js → chunk-mock-date.149ed990.js} +11 -6
- package/dist/{chunk-node-git.543e964a.js → chunk-node-git.125c9008.js} +3 -3
- package/dist/{chunk-runtime-chain.6df5a66b.js → chunk-runtime-chain.4e2aa823.js} +6 -6
- package/dist/{chunk-runtime-error.fad2c32b.js → chunk-runtime-error.97854396.js} +1 -1
- package/dist/{chunk-runtime-mocker.a677dd28.js → chunk-runtime-mocker.4755840f.js} +4 -4
- package/dist/{chunk-runtime-rpc.7f83c8a9.js → chunk-runtime-rpc.25cc9413.js} +1 -1
- package/dist/{chunk-runtime-setup.731b2b04.js → chunk-runtime-setup.56d71d30.js} +11 -11
- package/dist/{chunk-snapshot-manager.700322bf.js → chunk-snapshot-manager.1a2dbf96.js} +70 -40
- package/dist/{chunk-utils-env.b861e3a0.js → chunk-utils-env.f4a39d2c.js} +7 -7
- package/dist/{chunk-utils-import.2baa69a9.js → chunk-utils-import.16d9fb0d.js} +3 -3
- package/dist/{chunk-utils-source-map.60562959.js → chunk-utils-source-map.4e9b891d.js} +2 -2
- package/dist/cli-wrapper.js +5 -5
- package/dist/cli.js +7 -7
- package/dist/config.d.ts +1 -1
- package/dist/entry.js +8 -8
- package/dist/environments.d.ts +1 -1
- package/dist/{index-2d10c3fd.d.ts → index-1cfc7f58.d.ts} +4 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/loader.js +8 -9
- package/dist/node.d.ts +2 -2
- package/dist/node.js +11 -9
- package/dist/suite.js +5 -5
- package/dist/{types-e1e1d1e5.d.ts → types-5617096e.d.ts} +9 -1
- package/dist/{vendor-index.b2fdde54.js → vendor-index.451e37bc.js} +1 -1
- package/dist/vendor-index.b0346fe4.js +395 -0
- package/dist/{vendor-index.7a2cebfe.js → vendor-index.e6c27006.js} +12 -12
- package/dist/worker.js +23 -18
- package/package.json +10 -9
- package/dist/vendor-index.2e96c50b.js +0 -215
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import require$$0$1 from 'child_process';
|
|
2
|
-
import
|
|
2
|
+
import k from 'path';
|
|
3
3
|
import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
|
|
4
4
|
import require$$0 from 'fs';
|
|
5
|
-
import
|
|
5
|
+
import require$$0$2 from 'assert';
|
|
6
6
|
import require$$2 from 'events';
|
|
7
|
-
import require$$0$
|
|
8
|
-
import require$$0$
|
|
7
|
+
import require$$0$4 from 'buffer';
|
|
8
|
+
import require$$0$3 from 'stream';
|
|
9
9
|
import util from 'util';
|
|
10
10
|
|
|
11
11
|
var crossSpawn = {exports: {}};
|
|
@@ -172,7 +172,7 @@ const isWindows = process.platform === 'win32' ||
|
|
|
172
172
|
process.env.OSTYPE === 'cygwin' ||
|
|
173
173
|
process.env.OSTYPE === 'msys';
|
|
174
174
|
|
|
175
|
-
const path$2 =
|
|
175
|
+
const path$2 = k;
|
|
176
176
|
const COLON = isWindows ? ';' : ':';
|
|
177
177
|
const isexe = isexe_1;
|
|
178
178
|
|
|
@@ -311,7 +311,7 @@ pathKey$1.exports = pathKey;
|
|
|
311
311
|
// TODO: Remove this for the next major release
|
|
312
312
|
pathKey$1.exports.default = pathKey;
|
|
313
313
|
|
|
314
|
-
const path$1 =
|
|
314
|
+
const path$1 = k;
|
|
315
315
|
const which = which_1;
|
|
316
316
|
const getPathKey = pathKey$1.exports;
|
|
317
317
|
|
|
@@ -451,7 +451,7 @@ function readShebang$1(command) {
|
|
|
451
451
|
|
|
452
452
|
var readShebang_1 = readShebang$1;
|
|
453
453
|
|
|
454
|
-
const path =
|
|
454
|
+
const path = k;
|
|
455
455
|
const resolveCommand = resolveCommand_1;
|
|
456
456
|
const escape = _escape;
|
|
457
457
|
const readShebang = readShebang_1;
|
|
@@ -729,7 +729,7 @@ if (!processOk(process$1)) {
|
|
|
729
729
|
return function () {}
|
|
730
730
|
};
|
|
731
731
|
} else {
|
|
732
|
-
var assert =
|
|
732
|
+
var assert = require$$0$2;
|
|
733
733
|
var signals = requireSignals();
|
|
734
734
|
var isWin = /^win/i.test(process$1.platform);
|
|
735
735
|
|
|
@@ -909,7 +909,7 @@ if (!processOk(process$1)) {
|
|
|
909
909
|
|
|
910
910
|
var getStream$1 = {exports: {}};
|
|
911
911
|
|
|
912
|
-
const {PassThrough: PassThroughStream} = require$$0$
|
|
912
|
+
const {PassThrough: PassThroughStream} = require$$0$3;
|
|
913
913
|
|
|
914
914
|
var bufferStream$1 = options => {
|
|
915
915
|
options = {...options};
|
|
@@ -961,8 +961,8 @@ var bufferStream$1 = options => {
|
|
|
961
961
|
return stream;
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
const {constants: BufferConstants} = require$$0$
|
|
965
|
-
const stream = require$$0$
|
|
964
|
+
const {constants: BufferConstants} = require$$0$4;
|
|
965
|
+
const stream = require$$0$3;
|
|
966
966
|
const {promisify} = util;
|
|
967
967
|
const bufferStream = bufferStream$1;
|
|
968
968
|
|
|
@@ -1022,7 +1022,7 @@ getStream$1.exports.buffer = (stream, options) => getStream(stream, {...options,
|
|
|
1022
1022
|
getStream$1.exports.array = (stream, options) => getStream(stream, {...options, array: true});
|
|
1023
1023
|
getStream$1.exports.MaxBufferError = MaxBufferError;
|
|
1024
1024
|
|
|
1025
|
-
const { PassThrough } = require$$0$
|
|
1025
|
+
const { PassThrough } = require$$0$3;
|
|
1026
1026
|
|
|
1027
1027
|
var mergeStream = function (/*streams...*/) {
|
|
1028
1028
|
var sources = [];
|
package/dist/worker.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { b as resolve, f as distDir } from './chunk-utils-env.
|
|
1
|
+
import { r as relative, b as resolve, f as distDir } from './chunk-utils-env.f4a39d2c.js';
|
|
2
2
|
import { c as createBirpc } from './vendor-index.783e7f3e.js';
|
|
3
3
|
import { workerId } from 'tinypool';
|
|
4
4
|
import { ModuleCacheMap } from 'vite-node/client';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { isPrimitive } from 'vite-node/utils';
|
|
6
|
+
import { g as getWorkerState } from './chunk-mock-date.149ed990.js';
|
|
7
|
+
import { e as executeInViteNode } from './chunk-runtime-mocker.4755840f.js';
|
|
8
|
+
import { r as rpc } from './chunk-runtime-rpc.25cc9413.js';
|
|
9
|
+
import { p as processError } from './chunk-runtime-error.97854396.js';
|
|
9
10
|
import 'node:url';
|
|
10
11
|
import 'path';
|
|
11
12
|
import 'node:path';
|
|
12
13
|
import 'picocolors';
|
|
13
14
|
import 'local-pkg';
|
|
14
|
-
import 'vite-node/utils';
|
|
15
15
|
import 'vite';
|
|
16
|
-
import './vendor-index.
|
|
16
|
+
import './vendor-index.b0346fe4.js';
|
|
17
17
|
import 'acorn';
|
|
18
18
|
import 'node:module';
|
|
19
19
|
import 'node:fs';
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import '
|
|
23
|
-
import '
|
|
24
|
-
import 'util';
|
|
20
|
+
import 'node:assert';
|
|
21
|
+
import 'node:process';
|
|
22
|
+
import 'node:v8';
|
|
23
|
+
import 'node:util';
|
|
25
24
|
import './chunk-utils-timers.52534f96.js';
|
|
25
|
+
import 'util';
|
|
26
26
|
import 'chai';
|
|
27
27
|
|
|
28
28
|
let _viteNode;
|
|
@@ -31,18 +31,23 @@ const mockMap = /* @__PURE__ */ new Map();
|
|
|
31
31
|
async function startViteNode(ctx) {
|
|
32
32
|
if (_viteNode)
|
|
33
33
|
return _viteNode;
|
|
34
|
+
const { config } = ctx;
|
|
34
35
|
const processExit = process.exit;
|
|
35
|
-
process.on("beforeExit", (code) => {
|
|
36
|
-
rpc().onWorkerExit(code);
|
|
37
|
-
});
|
|
38
36
|
process.exit = (code = process.exitCode || 0) => {
|
|
39
|
-
|
|
37
|
+
const error = new Error(`process.exit called with "${code}"`);
|
|
38
|
+
rpc().onWorkerExit(error, code);
|
|
40
39
|
return processExit(code);
|
|
41
40
|
};
|
|
42
41
|
process.on("unhandledRejection", (err) => {
|
|
43
|
-
|
|
42
|
+
var _a;
|
|
43
|
+
const worker = getWorkerState();
|
|
44
|
+
const error = processError(err);
|
|
45
|
+
if (worker.filepath && !isPrimitive(error)) {
|
|
46
|
+
error.VITEST_TEST_NAME = (_a = worker.current) == null ? void 0 : _a.name;
|
|
47
|
+
error.VITEST_TEST_PATH = relative(config.root, worker.filepath);
|
|
48
|
+
}
|
|
49
|
+
rpc().onUnhandledRejection(error);
|
|
44
50
|
});
|
|
45
|
-
const { config } = ctx;
|
|
46
51
|
const { run: run2 } = (await executeInViteNode({
|
|
47
52
|
files: [
|
|
48
53
|
resolve(distDir, "entry.js")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.1",
|
|
5
5
|
"description": "A blazing fast unit test framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,7 +117,8 @@
|
|
|
117
117
|
"tinypool": "^0.3.0",
|
|
118
118
|
"tinyspy": "^1.0.2",
|
|
119
119
|
"vite": "^3.0.0 || ^4.0.0",
|
|
120
|
-
"
|
|
120
|
+
"why-is-node-running": "^2.2.2",
|
|
121
|
+
"vite-node": "0.27.1"
|
|
121
122
|
},
|
|
122
123
|
"devDependencies": {
|
|
123
124
|
"@antfu/install-pkg": "^0.1.1",
|
|
@@ -139,13 +140,13 @@
|
|
|
139
140
|
"fast-glob": "^3.2.12",
|
|
140
141
|
"find-up": "^6.3.0",
|
|
141
142
|
"flatted": "^3.2.7",
|
|
142
|
-
"get-tsconfig": "^4.
|
|
143
|
+
"get-tsconfig": "^4.3.0",
|
|
143
144
|
"happy-dom": "^7.8.1",
|
|
144
145
|
"jsdom": "^20.0.3",
|
|
145
146
|
"log-update": "^5.0.1",
|
|
146
147
|
"magic-string": "^0.27.0",
|
|
147
148
|
"micromatch": "^4.0.5",
|
|
148
|
-
"mlly": "^1.
|
|
149
|
+
"mlly": "^1.1.0",
|
|
149
150
|
"natural-compare": "^1.4.0",
|
|
150
151
|
"p-limit": "^4.0.0",
|
|
151
152
|
"pathe": "^0.2.0",
|
|
@@ -155,11 +156,11 @@
|
|
|
155
156
|
"rollup": "^2.79.1",
|
|
156
157
|
"strip-ansi": "^7.0.1",
|
|
157
158
|
"typescript": "^4.9.4",
|
|
158
|
-
"ws": "^8.
|
|
159
|
-
"@vitest/expect": "0.27.
|
|
160
|
-
"@vitest/
|
|
161
|
-
"@vitest/
|
|
162
|
-
"@vitest/
|
|
159
|
+
"ws": "^8.12.0",
|
|
160
|
+
"@vitest/expect": "0.27.1",
|
|
161
|
+
"@vitest/ui": "0.27.1",
|
|
162
|
+
"@vitest/utils": "0.27.1",
|
|
163
|
+
"@vitest/spy": "0.27.1"
|
|
163
164
|
},
|
|
164
165
|
"scripts": {
|
|
165
166
|
"build": "rimraf dist && rollup -c",
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import 'acorn';
|
|
2
|
-
import { builtinModules } from 'node:module';
|
|
3
|
-
import 'node:fs';
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import 'url';
|
|
6
|
-
import 'fs';
|
|
7
|
-
import 'path';
|
|
8
|
-
import 'module';
|
|
9
|
-
import assert from 'assert';
|
|
10
|
-
import { format, inspect } from 'util';
|
|
11
|
-
import 'node:path';
|
|
12
|
-
|
|
13
|
-
const BUILTIN_MODULES = new Set(builtinModules);
|
|
14
|
-
|
|
15
|
-
const isWindows = process.platform === "win32";
|
|
16
|
-
const own$1 = {}.hasOwnProperty;
|
|
17
|
-
const messages = /* @__PURE__ */ new Map();
|
|
18
|
-
const nodeInternalPrefix = "__node_internal_";
|
|
19
|
-
let userStackTraceLimit;
|
|
20
|
-
createError(
|
|
21
|
-
"ERR_INVALID_MODULE_SPECIFIER",
|
|
22
|
-
(request, reason, base = void 0) => {
|
|
23
|
-
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
24
|
-
},
|
|
25
|
-
TypeError
|
|
26
|
-
);
|
|
27
|
-
createError(
|
|
28
|
-
"ERR_INVALID_PACKAGE_CONFIG",
|
|
29
|
-
(path, base, message) => {
|
|
30
|
-
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
31
|
-
},
|
|
32
|
-
Error
|
|
33
|
-
);
|
|
34
|
-
createError(
|
|
35
|
-
"ERR_INVALID_PACKAGE_TARGET",
|
|
36
|
-
(pkgPath, key, target, isImport = false, base = void 0) => {
|
|
37
|
-
const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
38
|
-
if (key === ".") {
|
|
39
|
-
assert(isImport === false);
|
|
40
|
-
return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
41
|
-
}
|
|
42
|
-
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
|
43
|
-
target
|
|
44
|
-
)} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
45
|
-
},
|
|
46
|
-
Error
|
|
47
|
-
);
|
|
48
|
-
createError(
|
|
49
|
-
"ERR_MODULE_NOT_FOUND",
|
|
50
|
-
(path, base, type = "package") => {
|
|
51
|
-
return `Cannot find ${type} '${path}' imported from ${base}`;
|
|
52
|
-
},
|
|
53
|
-
Error
|
|
54
|
-
);
|
|
55
|
-
createError(
|
|
56
|
-
"ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
|
57
|
-
(specifier, packagePath, base) => {
|
|
58
|
-
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
|
|
59
|
-
},
|
|
60
|
-
TypeError
|
|
61
|
-
);
|
|
62
|
-
createError(
|
|
63
|
-
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
64
|
-
(pkgPath, subpath, base = void 0) => {
|
|
65
|
-
if (subpath === ".") {
|
|
66
|
-
return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
67
|
-
}
|
|
68
|
-
return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
69
|
-
},
|
|
70
|
-
Error
|
|
71
|
-
);
|
|
72
|
-
createError(
|
|
73
|
-
"ERR_UNSUPPORTED_DIR_IMPORT",
|
|
74
|
-
"Directory import '%s' is not supported resolving ES modules imported from %s",
|
|
75
|
-
Error
|
|
76
|
-
);
|
|
77
|
-
createError(
|
|
78
|
-
"ERR_UNKNOWN_FILE_EXTENSION",
|
|
79
|
-
'Unknown file extension "%s" for %s',
|
|
80
|
-
TypeError
|
|
81
|
-
);
|
|
82
|
-
createError(
|
|
83
|
-
"ERR_INVALID_ARG_VALUE",
|
|
84
|
-
(name, value, reason = "is invalid") => {
|
|
85
|
-
let inspected = inspect(value);
|
|
86
|
-
if (inspected.length > 128) {
|
|
87
|
-
inspected = `${inspected.slice(0, 128)}...`;
|
|
88
|
-
}
|
|
89
|
-
const type = name.includes(".") ? "property" : "argument";
|
|
90
|
-
return `The ${type} '${name}' ${reason}. Received ${inspected}`;
|
|
91
|
-
},
|
|
92
|
-
TypeError
|
|
93
|
-
);
|
|
94
|
-
createError(
|
|
95
|
-
"ERR_UNSUPPORTED_ESM_URL_SCHEME",
|
|
96
|
-
(url) => {
|
|
97
|
-
let message = "Only file and data URLs are supported by the default ESM loader";
|
|
98
|
-
if (isWindows && url.protocol.length === 2) {
|
|
99
|
-
message += ". On Windows, absolute paths must be valid file:// URLs";
|
|
100
|
-
}
|
|
101
|
-
message += `. Received protocol '${url.protocol}'`;
|
|
102
|
-
return message;
|
|
103
|
-
},
|
|
104
|
-
Error
|
|
105
|
-
);
|
|
106
|
-
function createError(sym, value, def) {
|
|
107
|
-
messages.set(sym, value);
|
|
108
|
-
return makeNodeErrorWithCode(def, sym);
|
|
109
|
-
}
|
|
110
|
-
function makeNodeErrorWithCode(Base, key) {
|
|
111
|
-
return NodeError;
|
|
112
|
-
function NodeError(...args) {
|
|
113
|
-
const limit = Error.stackTraceLimit;
|
|
114
|
-
if (isErrorStackTraceLimitWritable()) {
|
|
115
|
-
Error.stackTraceLimit = 0;
|
|
116
|
-
}
|
|
117
|
-
const error = new Base();
|
|
118
|
-
if (isErrorStackTraceLimitWritable()) {
|
|
119
|
-
Error.stackTraceLimit = limit;
|
|
120
|
-
}
|
|
121
|
-
const message = getMessage(key, args, error);
|
|
122
|
-
Object.defineProperty(error, "message", {
|
|
123
|
-
value: message,
|
|
124
|
-
enumerable: false,
|
|
125
|
-
writable: true,
|
|
126
|
-
configurable: true
|
|
127
|
-
});
|
|
128
|
-
Object.defineProperty(error, "toString", {
|
|
129
|
-
value() {
|
|
130
|
-
return `${this.name} [${key}]: ${this.message}`;
|
|
131
|
-
},
|
|
132
|
-
enumerable: false,
|
|
133
|
-
writable: true,
|
|
134
|
-
configurable: true
|
|
135
|
-
});
|
|
136
|
-
addCodeToName(error, Base.name, key);
|
|
137
|
-
error.code = key;
|
|
138
|
-
return error;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
const addCodeToName = hideStackFrames(
|
|
142
|
-
function(error, name, code) {
|
|
143
|
-
error = captureLargerStackTrace(error);
|
|
144
|
-
error.name = `${name} [${code}]`;
|
|
145
|
-
error.stack;
|
|
146
|
-
if (name === "SystemError") {
|
|
147
|
-
Object.defineProperty(error, "name", {
|
|
148
|
-
value: name,
|
|
149
|
-
enumerable: false,
|
|
150
|
-
writable: true,
|
|
151
|
-
configurable: true
|
|
152
|
-
});
|
|
153
|
-
} else {
|
|
154
|
-
delete error.name;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
function isErrorStackTraceLimitWritable() {
|
|
159
|
-
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
160
|
-
if (desc === void 0) {
|
|
161
|
-
return Object.isExtensible(Error);
|
|
162
|
-
}
|
|
163
|
-
return own$1.call(desc, "writable") ? desc.writable : desc.set !== void 0;
|
|
164
|
-
}
|
|
165
|
-
function hideStackFrames(fn) {
|
|
166
|
-
const hidden = nodeInternalPrefix + fn.name;
|
|
167
|
-
Object.defineProperty(fn, "name", { value: hidden });
|
|
168
|
-
return fn;
|
|
169
|
-
}
|
|
170
|
-
const captureLargerStackTrace = hideStackFrames(
|
|
171
|
-
function(error) {
|
|
172
|
-
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
173
|
-
if (stackTraceLimitIsWritable) {
|
|
174
|
-
userStackTraceLimit = Error.stackTraceLimit;
|
|
175
|
-
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
176
|
-
}
|
|
177
|
-
Error.captureStackTrace(error);
|
|
178
|
-
if (stackTraceLimitIsWritable) {
|
|
179
|
-
Error.stackTraceLimit = userStackTraceLimit;
|
|
180
|
-
}
|
|
181
|
-
return error;
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
function getMessage(key, args, self) {
|
|
185
|
-
const message = messages.get(key);
|
|
186
|
-
if (typeof message === "function") {
|
|
187
|
-
assert(
|
|
188
|
-
message.length <= args.length,
|
|
189
|
-
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).`
|
|
190
|
-
);
|
|
191
|
-
return Reflect.apply(message, self, args);
|
|
192
|
-
}
|
|
193
|
-
const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
|
|
194
|
-
assert(
|
|
195
|
-
expectedLength === args.length,
|
|
196
|
-
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
|
|
197
|
-
);
|
|
198
|
-
if (args.length === 0) {
|
|
199
|
-
return message;
|
|
200
|
-
}
|
|
201
|
-
args.unshift(message);
|
|
202
|
-
return Reflect.apply(format, null, args);
|
|
203
|
-
}
|
|
204
|
-
Object.freeze(["node", "import"]);
|
|
205
|
-
function isNodeBuiltin(id = "") {
|
|
206
|
-
id = id.replace(/^node:/, "").split("/")[0];
|
|
207
|
-
return BUILTIN_MODULES.has(id);
|
|
208
|
-
}
|
|
209
|
-
pathToFileURL(process.cwd());
|
|
210
|
-
const CJS_RE = /([\s;]|^)(module.exports\b|exports\.\w|require\s*\(|global\.\w)/m;
|
|
211
|
-
function hasCJSSyntax(code) {
|
|
212
|
-
return CJS_RE.test(code);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export { hasCJSSyntax as h, isNodeBuiltin as i };
|