patchwright 1.64.1 → 1.65.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/README.md +116 -145
- package/helpers.mjs +387 -0
- package/lib/cli/testActions.js +0 -1
- package/lib/common/index.js +142 -65
- package/lib/common/index.js.txt +7 -7
- package/lib/matchers/expect.js +56 -30
- package/lib/matchers/expect.js.LICENSE +3 -3
- package/lib/matchers/expect.js.txt +4 -4
- package/lib/mcp/test/testContext.js +2 -8
- package/lib/runner/index.js +500 -401
- package/lib/runner/index.js.txt +24 -23
- package/lib/transform/babelBundle.js +81 -57
- package/lib/transform/babelBundle.js.txt +2 -2
- package/lib/transform/esmLoader.js +361 -163
- package/lib/transform/esmLoader.js.LICENSE +3 -3
- package/lib/transform/esmLoader.js.txt +9 -8
- package/lib/worker/workerProcessEntry.js +6 -14
- package/lib/worker/workerProcessEntry.js.txt +2 -2
- package/package.json +6 -5
- package/types/test.d.ts +365 -41
- package/types/testReporter.d.ts +22 -2
|
@@ -154,34 +154,34 @@ var require_util = __commonJS({
|
|
|
154
154
|
}
|
|
155
155
|
exports2.urlParse = urlParse;
|
|
156
156
|
function urlGenerate(aParsedUrl) {
|
|
157
|
-
var
|
|
157
|
+
var url5 = "";
|
|
158
158
|
if (aParsedUrl.scheme) {
|
|
159
|
-
|
|
159
|
+
url5 += aParsedUrl.scheme + ":";
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
url5 += "//";
|
|
162
162
|
if (aParsedUrl.auth) {
|
|
163
|
-
|
|
163
|
+
url5 += aParsedUrl.auth + "@";
|
|
164
164
|
}
|
|
165
165
|
if (aParsedUrl.host) {
|
|
166
|
-
|
|
166
|
+
url5 += aParsedUrl.host;
|
|
167
167
|
}
|
|
168
168
|
if (aParsedUrl.port) {
|
|
169
|
-
|
|
169
|
+
url5 += ":" + aParsedUrl.port;
|
|
170
170
|
}
|
|
171
171
|
if (aParsedUrl.path) {
|
|
172
|
-
|
|
172
|
+
url5 += aParsedUrl.path;
|
|
173
173
|
}
|
|
174
|
-
return
|
|
174
|
+
return url5;
|
|
175
175
|
}
|
|
176
176
|
exports2.urlGenerate = urlGenerate;
|
|
177
177
|
function normalize(aPath) {
|
|
178
178
|
var path7 = aPath;
|
|
179
|
-
var
|
|
180
|
-
if (
|
|
181
|
-
if (!
|
|
179
|
+
var url5 = urlParse(aPath);
|
|
180
|
+
if (url5) {
|
|
181
|
+
if (!url5.path) {
|
|
182
182
|
return aPath;
|
|
183
183
|
}
|
|
184
|
-
path7 =
|
|
184
|
+
path7 = url5.path;
|
|
185
185
|
}
|
|
186
186
|
var isAbsolute = exports2.isAbsolute(path7);
|
|
187
187
|
var parts = path7.split(/\/+/);
|
|
@@ -205,9 +205,9 @@ var require_util = __commonJS({
|
|
|
205
205
|
if (path7 === "") {
|
|
206
206
|
path7 = isAbsolute ? "/" : ".";
|
|
207
207
|
}
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
return urlGenerate(
|
|
208
|
+
if (url5) {
|
|
209
|
+
url5.path = path7;
|
|
210
|
+
return urlGenerate(url5);
|
|
211
211
|
}
|
|
212
212
|
return path7;
|
|
213
213
|
}
|
|
@@ -1285,13 +1285,13 @@ var require_source_map_consumer = __commonJS({
|
|
|
1285
1285
|
if (this.sourceRoot != null) {
|
|
1286
1286
|
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
1287
1287
|
}
|
|
1288
|
-
var
|
|
1289
|
-
if (this.sourceRoot != null && (
|
|
1288
|
+
var url5;
|
|
1289
|
+
if (this.sourceRoot != null && (url5 = util.urlParse(this.sourceRoot))) {
|
|
1290
1290
|
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
|
1291
|
-
if (
|
|
1291
|
+
if (url5.scheme == "file" && this._sources.has(fileUriAbsPath)) {
|
|
1292
1292
|
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
|
|
1293
1293
|
}
|
|
1294
|
-
if ((!
|
|
1294
|
+
if ((!url5.path || url5.path == "/") && this._sources.has("/" + relativeSource)) {
|
|
1295
1295
|
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
@@ -1924,17 +1924,17 @@ var require_source_map_support = __commonJS({
|
|
|
1924
1924
|
}
|
|
1925
1925
|
return fileContentsCache[path8] = contents;
|
|
1926
1926
|
});
|
|
1927
|
-
function supportRelativeURL(file2,
|
|
1928
|
-
if (!file2) return
|
|
1927
|
+
function supportRelativeURL(file2, url5) {
|
|
1928
|
+
if (!file2) return url5;
|
|
1929
1929
|
var dir = path7.dirname(file2);
|
|
1930
1930
|
var match2 = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
1931
1931
|
var protocol = match2 ? match2[0] : "";
|
|
1932
1932
|
var startPath = dir.slice(protocol.length);
|
|
1933
1933
|
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
1934
1934
|
protocol += "/";
|
|
1935
|
-
return protocol + path7.resolve(dir.slice(protocol.length),
|
|
1935
|
+
return protocol + path7.resolve(dir.slice(protocol.length), url5).replace(/\\/g, "/");
|
|
1936
1936
|
}
|
|
1937
|
-
return protocol + path7.resolve(dir.slice(protocol.length),
|
|
1937
|
+
return protocol + path7.resolve(dir.slice(protocol.length), url5);
|
|
1938
1938
|
}
|
|
1939
1939
|
function retrieveSourceMapURL(source) {
|
|
1940
1940
|
var fileData;
|
|
@@ -1992,8 +1992,8 @@ var require_source_map_support = __commonJS({
|
|
|
1992
1992
|
sourceMap.map.sources.forEach(function(source, i) {
|
|
1993
1993
|
var contents = sourceMap.map.sourcesContent[i];
|
|
1994
1994
|
if (contents) {
|
|
1995
|
-
var
|
|
1996
|
-
fileContentsCache[
|
|
1995
|
+
var url5 = supportRelativeURL(sourceMap.url, source);
|
|
1996
|
+
fileContentsCache[url5] = contents;
|
|
1997
1997
|
}
|
|
1998
1998
|
});
|
|
1999
1999
|
}
|
|
@@ -4172,14 +4172,70 @@ var require_src = __commonJS({
|
|
|
4172
4172
|
|
|
4173
4173
|
// packages/playwright/src/transform/esmLoader.ts
|
|
4174
4174
|
var import_fs6 = __toESM(require("fs"));
|
|
4175
|
-
var
|
|
4175
|
+
var import_url4 = __toESM(require("url"));
|
|
4176
4176
|
|
|
4177
4177
|
// packages/playwright/src/transform/compilationCache.ts
|
|
4178
4178
|
var import_fs = __toESM(require("fs"));
|
|
4179
4179
|
var import_os = __toESM(require("os"));
|
|
4180
4180
|
var import_path = __toESM(require("path"));
|
|
4181
|
+
var import_url = __toESM(require("url"));
|
|
4181
4182
|
var import_source_map_support = __toESM(require_source_map_support());
|
|
4182
4183
|
|
|
4184
|
+
// packages/isomorphic/multimap.ts
|
|
4185
|
+
var MultiMap = class {
|
|
4186
|
+
constructor() {
|
|
4187
|
+
this._map = /* @__PURE__ */ new Map();
|
|
4188
|
+
}
|
|
4189
|
+
set(key, value) {
|
|
4190
|
+
let values = this._map.get(key);
|
|
4191
|
+
if (!values) {
|
|
4192
|
+
values = [];
|
|
4193
|
+
this._map.set(key, values);
|
|
4194
|
+
}
|
|
4195
|
+
values.push(value);
|
|
4196
|
+
}
|
|
4197
|
+
get(key) {
|
|
4198
|
+
return this._map.get(key) || [];
|
|
4199
|
+
}
|
|
4200
|
+
has(key) {
|
|
4201
|
+
return this._map.has(key);
|
|
4202
|
+
}
|
|
4203
|
+
delete(key, value) {
|
|
4204
|
+
const values = this._map.get(key);
|
|
4205
|
+
if (!values)
|
|
4206
|
+
return;
|
|
4207
|
+
if (values.includes(value))
|
|
4208
|
+
this._map.set(key, values.filter((v) => value !== v));
|
|
4209
|
+
}
|
|
4210
|
+
deleteAll(key) {
|
|
4211
|
+
this._map.delete(key);
|
|
4212
|
+
}
|
|
4213
|
+
hasValue(key, value) {
|
|
4214
|
+
const values = this._map.get(key);
|
|
4215
|
+
if (!values)
|
|
4216
|
+
return false;
|
|
4217
|
+
return values.includes(value);
|
|
4218
|
+
}
|
|
4219
|
+
get size() {
|
|
4220
|
+
return this._map.size;
|
|
4221
|
+
}
|
|
4222
|
+
[Symbol.iterator]() {
|
|
4223
|
+
return this._map[Symbol.iterator]();
|
|
4224
|
+
}
|
|
4225
|
+
keys() {
|
|
4226
|
+
return this._map.keys();
|
|
4227
|
+
}
|
|
4228
|
+
values() {
|
|
4229
|
+
const result2 = [];
|
|
4230
|
+
for (const key of this.keys())
|
|
4231
|
+
result2.push(...this.get(key));
|
|
4232
|
+
return result2;
|
|
4233
|
+
}
|
|
4234
|
+
clear() {
|
|
4235
|
+
this._map.clear();
|
|
4236
|
+
}
|
|
4237
|
+
};
|
|
4238
|
+
|
|
4183
4239
|
// packages/utils/crypto.ts
|
|
4184
4240
|
var import_crypto = __toESM(require("crypto"));
|
|
4185
4241
|
function calculateSha1(buffer) {
|
|
@@ -4191,7 +4247,7 @@ function calculateSha1(buffer) {
|
|
|
4191
4247
|
// packages/playwright/src/transform/compilationCache.ts
|
|
4192
4248
|
var import_globals = require("../globals");
|
|
4193
4249
|
var import_package = require("../package");
|
|
4194
|
-
var cacheDir = process.env.PWTEST_CACHE_DIR || (() => {
|
|
4250
|
+
var cacheDir = process.env.PLAYWRIGHT_TRANSFORM_CACHE_DIR || process.env.PWTEST_CACHE_DIR || (() => {
|
|
4195
4251
|
if (process.platform === "win32")
|
|
4196
4252
|
return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache`);
|
|
4197
4253
|
return import_path.default.join(import_os.default.tmpdir(), `playwright-transform-cache-` + process.geteuid?.());
|
|
@@ -4315,12 +4371,30 @@ function clearOldCacheEntries(cacheFolderName, filePathHash) {
|
|
|
4315
4371
|
}
|
|
4316
4372
|
}
|
|
4317
4373
|
var depsCollector2;
|
|
4374
|
+
var importGraph = new MultiMap();
|
|
4375
|
+
function recordResolvedFile(resolvedUrl, parentUrl) {
|
|
4376
|
+
if ((0, import_globals.isWorkerProcess)() || !resolvedUrl?.startsWith("file://"))
|
|
4377
|
+
return;
|
|
4378
|
+
const child = import_url.default.fileURLToPath(resolvedUrl);
|
|
4379
|
+
depsCollector2?.add(child);
|
|
4380
|
+
if (!parentUrl?.startsWith("file://"))
|
|
4381
|
+
return;
|
|
4382
|
+
const parent = import_url.default.fileURLToPath(parentUrl);
|
|
4383
|
+
if (!belongsToNodeModules(parent) && !importGraph.hasValue(parent, child))
|
|
4384
|
+
importGraph.set(parent, child);
|
|
4385
|
+
}
|
|
4318
4386
|
function startCollectingFileDeps() {
|
|
4319
4387
|
depsCollector2 = /* @__PURE__ */ new Set();
|
|
4320
4388
|
}
|
|
4321
|
-
function stopCollectingFileDeps(filename) {
|
|
4389
|
+
function stopCollectingFileDeps(filename, additionalDeps = []) {
|
|
4322
4390
|
if (!depsCollector2)
|
|
4323
4391
|
return;
|
|
4392
|
+
for (const dep of additionalDeps)
|
|
4393
|
+
depsCollector2.add(dep);
|
|
4394
|
+
for (const dep of depsCollector2) {
|
|
4395
|
+
for (const child of importGraph.get(dep))
|
|
4396
|
+
depsCollector2.add(child);
|
|
4397
|
+
}
|
|
4324
4398
|
depsCollector2.delete(filename);
|
|
4325
4399
|
for (const dep of depsCollector2) {
|
|
4326
4400
|
if (belongsToNodeModules(dep))
|
|
@@ -4332,6 +4406,9 @@ function stopCollectingFileDeps(filename) {
|
|
|
4332
4406
|
function currentFileDepsCollector() {
|
|
4333
4407
|
return depsCollector2;
|
|
4334
4408
|
}
|
|
4409
|
+
function dependenciesForTestFile(filename) {
|
|
4410
|
+
return fileDependencies.get(filename) || /* @__PURE__ */ new Set();
|
|
4411
|
+
}
|
|
4335
4412
|
var kPlaywrightInternalPrefix = import_package.packageRoot;
|
|
4336
4413
|
function belongsToNodeModules(file2) {
|
|
4337
4414
|
if (file2.includes(`${import_path.default.sep}node_modules${import_path.default.sep}`))
|
|
@@ -4387,7 +4464,7 @@ var PortTransport = class {
|
|
|
4387
4464
|
var import_fs5 = __toESM(require("fs"));
|
|
4388
4465
|
var import_module2 = __toESM(require("module"));
|
|
4389
4466
|
var import_path5 = __toESM(require("path"));
|
|
4390
|
-
var
|
|
4467
|
+
var import_url3 = __toESM(require("url"));
|
|
4391
4468
|
var import_crypto5 = __toESM(require("crypto"));
|
|
4392
4469
|
var import_source_map_support2 = __toESM(require_source_map_support());
|
|
4393
4470
|
|
|
@@ -4407,13 +4484,26 @@ ${e.message}`);
|
|
|
4407
4484
|
}
|
|
4408
4485
|
}
|
|
4409
4486
|
function resolveConfigFile(baseConfigFile, referencedConfigFile) {
|
|
4410
|
-
if (!referencedConfigFile.endsWith(".json"))
|
|
4411
|
-
referencedConfigFile += ".json";
|
|
4412
4487
|
const currentDir = import_path2.default.dirname(baseConfigFile);
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4488
|
+
const referencedFile = referencedConfigFile.endsWith(".json") ? referencedConfigFile : referencedConfigFile + ".json";
|
|
4489
|
+
const resolvedConfigFile = import_path2.default.resolve(currentDir, referencedFile);
|
|
4490
|
+
if (import_fs2.default.existsSync(resolvedConfigFile) || referencedConfigFile.startsWith(".") || import_path2.default.isAbsolute(referencedConfigFile))
|
|
4491
|
+
return resolvedConfigFile;
|
|
4492
|
+
const packageDir = import_path2.default.join(currentDir, "node_modules", referencedConfigFile);
|
|
4493
|
+
const candidates = [import_path2.default.join(currentDir, "node_modules", referencedFile)];
|
|
4494
|
+
const packageTsconfig = packageJsonTsconfigField(import_path2.default.join(packageDir, "package.json"));
|
|
4495
|
+
if (packageTsconfig)
|
|
4496
|
+
candidates.push(import_path2.default.resolve(packageDir, packageTsconfig));
|
|
4497
|
+
candidates.push(import_path2.default.join(packageDir, "tsconfig.json"));
|
|
4498
|
+
return candidates.find((candidate) => import_fs2.default.existsSync(candidate)) ?? resolvedConfigFile;
|
|
4499
|
+
}
|
|
4500
|
+
function packageJsonTsconfigField(packageJsonFile) {
|
|
4501
|
+
try {
|
|
4502
|
+
const tsconfig = JSON.parse(import_fs2.default.readFileSync(packageJsonFile, "utf8")).tsconfig;
|
|
4503
|
+
return typeof tsconfig === "string" ? tsconfig : void 0;
|
|
4504
|
+
} catch {
|
|
4505
|
+
return void 0;
|
|
4506
|
+
}
|
|
4417
4507
|
}
|
|
4418
4508
|
function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
|
|
4419
4509
|
if (visited.has(configFilePath))
|
|
@@ -4439,6 +4529,10 @@ function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */
|
|
|
4439
4529
|
if (parsedConfig.compilerOptions?.[name] !== void 0)
|
|
4440
4530
|
result2[name] = parsedConfig.compilerOptions[name];
|
|
4441
4531
|
}
|
|
4532
|
+
if (parsedConfig.compilerOptions?.target !== void 0)
|
|
4533
|
+
result2.target = parsedConfig.compilerOptions.target;
|
|
4534
|
+
if (parsedConfig.compilerOptions?.useDefineForClassFields !== void 0)
|
|
4535
|
+
result2.useDefineForClassFields = parsedConfig.compilerOptions.useDefineForClassFields;
|
|
4442
4536
|
if (parsedConfig.compilerOptions?.paths !== void 0) {
|
|
4443
4537
|
result2.paths = {
|
|
4444
4538
|
mapping: parsedConfig.compilerOptions.paths,
|
|
@@ -5722,6 +5816,9 @@ var closePattern = /\\}/g;
|
|
|
5722
5816
|
var commaPattern = /\\,/g;
|
|
5723
5817
|
var periodPattern = /\\\./g;
|
|
5724
5818
|
var EXPANSION_MAX = 1e5;
|
|
5819
|
+
var EXPANSION_MAX_LENGTH = 4e6;
|
|
5820
|
+
var EXPANSION_MAX_DEPTH = 1e3;
|
|
5821
|
+
var EXPANSION_MAX_REWRITES = 1e3;
|
|
5725
5822
|
function numeric(str) {
|
|
5726
5823
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
5727
5824
|
}
|
|
@@ -5731,36 +5828,44 @@ function escapeBraces(str) {
|
|
|
5731
5828
|
function unescapeBraces(str) {
|
|
5732
5829
|
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
5733
5830
|
}
|
|
5734
|
-
function
|
|
5735
|
-
|
|
5736
|
-
|
|
5831
|
+
function pushAll(target, items) {
|
|
5832
|
+
for (let i = 0; i < items.length; i++) {
|
|
5833
|
+
target.push(items[i]);
|
|
5737
5834
|
}
|
|
5835
|
+
}
|
|
5836
|
+
function parseCommaParts(str) {
|
|
5738
5837
|
const parts = [];
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
;
|
|
5749
|
-
p
|
|
5750
|
-
p
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5838
|
+
let carry = "";
|
|
5839
|
+
for (; ; ) {
|
|
5840
|
+
const m = balanced("{", "}", str);
|
|
5841
|
+
if (!m) {
|
|
5842
|
+
const tail = str.split(",");
|
|
5843
|
+
tail[0] = carry + tail[0];
|
|
5844
|
+
pushAll(parts, tail);
|
|
5845
|
+
return parts;
|
|
5846
|
+
}
|
|
5847
|
+
const { pre, body, post } = m;
|
|
5848
|
+
const p = pre.split(",");
|
|
5849
|
+
p[0] = carry + p[0];
|
|
5850
|
+
p[p.length - 1] += "{" + body + "}";
|
|
5851
|
+
if (!post.length) {
|
|
5852
|
+
pushAll(parts, p);
|
|
5853
|
+
return parts;
|
|
5854
|
+
}
|
|
5855
|
+
carry = p.pop();
|
|
5856
|
+
pushAll(parts, p);
|
|
5857
|
+
str = post;
|
|
5858
|
+
}
|
|
5754
5859
|
}
|
|
5755
5860
|
function expand(str, options = {}) {
|
|
5756
5861
|
if (!str) {
|
|
5757
5862
|
return [];
|
|
5758
5863
|
}
|
|
5759
|
-
const { max = EXPANSION_MAX } = options;
|
|
5864
|
+
const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } = options;
|
|
5760
5865
|
if (str.slice(0, 2) === "{}") {
|
|
5761
5866
|
str = "\\{\\}" + str.slice(2);
|
|
5762
5867
|
}
|
|
5763
|
-
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
5868
|
+
return expand_(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
|
|
5764
5869
|
}
|
|
5765
5870
|
function embrace(str) {
|
|
5766
5871
|
return "{" + str + "}";
|
|
@@ -5774,99 +5879,152 @@ function lte(i, y) {
|
|
|
5774
5879
|
function gte(i, y) {
|
|
5775
5880
|
return i >= y;
|
|
5776
5881
|
}
|
|
5777
|
-
function
|
|
5778
|
-
const
|
|
5882
|
+
function combine(acc, pre, values, max, maxLength, dropEmpties) {
|
|
5883
|
+
const out = [];
|
|
5884
|
+
let length = 0;
|
|
5885
|
+
for (let a = 0; a < acc.length; a++) {
|
|
5886
|
+
for (let v = 0; v < values.length; v++) {
|
|
5887
|
+
if (out.length >= max)
|
|
5888
|
+
return out;
|
|
5889
|
+
const expansion = acc[a] + pre + values[v];
|
|
5890
|
+
if (dropEmpties && !expansion)
|
|
5891
|
+
continue;
|
|
5892
|
+
if (length + expansion.length > maxLength)
|
|
5893
|
+
return out;
|
|
5894
|
+
out.push(expansion);
|
|
5895
|
+
length += expansion.length;
|
|
5896
|
+
}
|
|
5897
|
+
}
|
|
5898
|
+
return out;
|
|
5899
|
+
}
|
|
5900
|
+
function expandSequence(body, isAlphaSequence, max, maxLength) {
|
|
5901
|
+
const n = body.split(/\.\./);
|
|
5902
|
+
const N = [];
|
|
5903
|
+
if (n[0] === void 0 || n[1] === void 0) {
|
|
5904
|
+
return N;
|
|
5905
|
+
}
|
|
5906
|
+
const x = numeric(n[0]);
|
|
5907
|
+
const y = numeric(n[1]);
|
|
5908
|
+
const width = Math.max(n[0].length, n[1].length);
|
|
5909
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
5910
|
+
let test = lte;
|
|
5911
|
+
const reverse = y < x;
|
|
5912
|
+
if (reverse) {
|
|
5913
|
+
incr *= -1;
|
|
5914
|
+
test = gte;
|
|
5915
|
+
}
|
|
5916
|
+
const pad = n.some(isPadded);
|
|
5917
|
+
let length = 0;
|
|
5918
|
+
for (let i = x; test(i, y) && N.length < max; i += incr) {
|
|
5919
|
+
let c;
|
|
5920
|
+
if (isAlphaSequence) {
|
|
5921
|
+
c = String.fromCharCode(i);
|
|
5922
|
+
if (c === "\\") {
|
|
5923
|
+
c = "";
|
|
5924
|
+
}
|
|
5925
|
+
} else {
|
|
5926
|
+
c = String(i);
|
|
5927
|
+
if (pad) {
|
|
5928
|
+
const need = width - c.length;
|
|
5929
|
+
if (need > 0) {
|
|
5930
|
+
const z = new Array(need + 1).join("0");
|
|
5931
|
+
if (i < 0) {
|
|
5932
|
+
c = "-" + z + c.slice(1);
|
|
5933
|
+
} else {
|
|
5934
|
+
c = z + c;
|
|
5935
|
+
}
|
|
5936
|
+
}
|
|
5937
|
+
}
|
|
5938
|
+
}
|
|
5939
|
+
if (length + c.length > maxLength)
|
|
5940
|
+
break;
|
|
5941
|
+
N.push(c);
|
|
5942
|
+
length += c.length;
|
|
5943
|
+
}
|
|
5944
|
+
return N;
|
|
5945
|
+
}
|
|
5946
|
+
function expand_(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
|
|
5947
|
+
if (depth > maxDepth) {
|
|
5948
|
+
return [str];
|
|
5949
|
+
}
|
|
5950
|
+
let acc = [""];
|
|
5951
|
+
let rewrites = 0;
|
|
5952
|
+
let dropEmpties = false;
|
|
5953
|
+
let firstGroup = true;
|
|
5779
5954
|
for (; ; ) {
|
|
5780
5955
|
const m = balanced("{", "}", str);
|
|
5781
|
-
if (!m)
|
|
5782
|
-
return [
|
|
5956
|
+
if (!m) {
|
|
5957
|
+
return combine(acc, str, [""], max, maxLength, dropEmpties);
|
|
5958
|
+
}
|
|
5783
5959
|
const pre = m.pre;
|
|
5784
|
-
if (/\$$/.test(
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5960
|
+
if (/\$$/.test(pre)) {
|
|
5961
|
+
acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
|
|
5962
|
+
firstGroup = false;
|
|
5963
|
+
if (!m.post.length)
|
|
5964
|
+
break;
|
|
5965
|
+
str = m.post;
|
|
5966
|
+
continue;
|
|
5791
5967
|
}
|
|
5792
5968
|
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
5793
5969
|
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
5794
5970
|
const isSequence = isNumericSequence || isAlphaSequence;
|
|
5795
5971
|
const isOptions = m.body.indexOf(",") >= 0;
|
|
5796
5972
|
if (!isSequence && !isOptions) {
|
|
5797
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
5973
|
+
if (rewrites < maxRewrites && m.post.match(/,(?!,).*\}/)) {
|
|
5974
|
+
rewrites++;
|
|
5798
5975
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
5799
5976
|
isTop = true;
|
|
5800
5977
|
continue;
|
|
5801
5978
|
}
|
|
5802
|
-
return [
|
|
5979
|
+
return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
|
|
5803
5980
|
}
|
|
5804
|
-
|
|
5805
|
-
|
|
5981
|
+
if (firstGroup) {
|
|
5982
|
+
dropEmpties = isTop && !isSequence;
|
|
5983
|
+
firstGroup = false;
|
|
5984
|
+
}
|
|
5985
|
+
let values;
|
|
5806
5986
|
if (isSequence) {
|
|
5807
|
-
|
|
5987
|
+
values = expandSequence(m.body, isAlphaSequence, max, maxLength);
|
|
5808
5988
|
} else {
|
|
5809
|
-
n = parseCommaParts(m.body);
|
|
5989
|
+
let n = parseCommaParts(m.body);
|
|
5810
5990
|
if (n.length === 1 && n[0] !== void 0) {
|
|
5811
|
-
n = expand_(n[0], max, false).map(embrace);
|
|
5991
|
+
n = expand_(n[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
|
|
5812
5992
|
if (n.length === 1) {
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
|
5819
|
-
const x = numeric(n[0]);
|
|
5820
|
-
const y = numeric(n[1]);
|
|
5821
|
-
const width = Math.max(n[0].length, n[1].length);
|
|
5822
|
-
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
5823
|
-
let test = lte;
|
|
5824
|
-
const reverse = y < x;
|
|
5825
|
-
if (reverse) {
|
|
5826
|
-
incr *= -1;
|
|
5827
|
-
test = gte;
|
|
5828
|
-
}
|
|
5829
|
-
const pad = n.some(isPadded);
|
|
5830
|
-
N = [];
|
|
5831
|
-
for (let i = x; test(i, y) && N.length < max; i += incr) {
|
|
5832
|
-
let c;
|
|
5833
|
-
if (isAlphaSequence) {
|
|
5834
|
-
c = String.fromCharCode(i);
|
|
5835
|
-
if (c === "\\") {
|
|
5836
|
-
c = "";
|
|
5837
|
-
}
|
|
5838
|
-
} else {
|
|
5839
|
-
c = String(i);
|
|
5840
|
-
if (pad) {
|
|
5841
|
-
const need = width - c.length;
|
|
5842
|
-
if (need > 0) {
|
|
5843
|
-
const z = new Array(need + 1).join("0");
|
|
5844
|
-
if (i < 0) {
|
|
5845
|
-
c = "-" + z + c.slice(1);
|
|
5846
|
-
} else {
|
|
5847
|
-
c = z + c;
|
|
5848
|
-
}
|
|
5849
|
-
}
|
|
5850
|
-
}
|
|
5993
|
+
acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
|
|
5994
|
+
if (!m.post.length)
|
|
5995
|
+
break;
|
|
5996
|
+
str = m.post;
|
|
5997
|
+
continue;
|
|
5851
5998
|
}
|
|
5852
|
-
N.push(c);
|
|
5853
5999
|
}
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
6000
|
+
let dropsEmpties = dropEmpties && !m.post.length && !pre;
|
|
6001
|
+
for (let d = 0; dropsEmpties && d < acc.length; d++) {
|
|
6002
|
+
if (acc[d]) {
|
|
6003
|
+
dropsEmpties = false;
|
|
6004
|
+
}
|
|
5858
6005
|
}
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
for (let
|
|
5862
|
-
const
|
|
5863
|
-
|
|
5864
|
-
|
|
6006
|
+
values = [];
|
|
6007
|
+
let valuesLength = 0;
|
|
6008
|
+
outer: for (let j = 0; j < n.length; j++) {
|
|
6009
|
+
const expanded = expand_(n[j], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
|
|
6010
|
+
for (let k = 0; k < expanded.length; k++) {
|
|
6011
|
+
const v = expanded[k];
|
|
6012
|
+
if (dropsEmpties && !v)
|
|
6013
|
+
continue;
|
|
6014
|
+
if (values.length >= max || valuesLength + v.length > maxLength) {
|
|
6015
|
+
break outer;
|
|
6016
|
+
}
|
|
6017
|
+
values.push(v);
|
|
6018
|
+
valuesLength += v.length;
|
|
5865
6019
|
}
|
|
5866
6020
|
}
|
|
5867
6021
|
}
|
|
5868
|
-
|
|
6022
|
+
acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
|
|
6023
|
+
if (!m.post.length)
|
|
6024
|
+
break;
|
|
6025
|
+
str = m.post;
|
|
5869
6026
|
}
|
|
6027
|
+
return acc;
|
|
5870
6028
|
}
|
|
5871
6029
|
|
|
5872
6030
|
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
@@ -7629,18 +7787,17 @@ function dirExists(resolved) {
|
|
|
7629
7787
|
|
|
7630
7788
|
// packages/playwright/src/transform/esmLoaderSync.ts
|
|
7631
7789
|
var import_fs4 = __toESM(require("fs"));
|
|
7632
|
-
var
|
|
7790
|
+
var import_url2 = __toESM(require("url"));
|
|
7633
7791
|
function resolve(specifier, context, nextResolve) {
|
|
7634
7792
|
if (context.parentURL && context.parentURL.startsWith("file://")) {
|
|
7635
|
-
const filename =
|
|
7793
|
+
const filename = import_url2.default.fileURLToPath(context.parentURL);
|
|
7636
7794
|
const resolved = resolveHook(filename, specifier);
|
|
7637
7795
|
if (resolved !== void 0) {
|
|
7638
|
-
specifier = new Set(context.conditions).has("import") ?
|
|
7796
|
+
specifier = new Set(context.conditions).has("import") ? import_url2.default.pathToFileURL(resolved).toString() : resolved;
|
|
7639
7797
|
}
|
|
7640
7798
|
}
|
|
7641
7799
|
const result2 = nextResolve(specifier, context);
|
|
7642
|
-
|
|
7643
|
-
currentFileDepsCollector()?.add(import_url.default.fileURLToPath(result2.url));
|
|
7800
|
+
recordResolvedFile(result2?.url, context.parentURL);
|
|
7644
7801
|
return result2;
|
|
7645
7802
|
}
|
|
7646
7803
|
var kSupportedFormats = /* @__PURE__ */ new Map([
|
|
@@ -7657,8 +7814,10 @@ function load(moduleUrl, context, nextLoad) {
|
|
|
7657
7814
|
return nextLoad(moduleUrl, context);
|
|
7658
7815
|
if (!moduleUrl.startsWith("file://"))
|
|
7659
7816
|
return nextLoad(moduleUrl, context);
|
|
7660
|
-
const filename =
|
|
7661
|
-
if (
|
|
7817
|
+
const filename = import_url2.default.fileURLToPath(moduleUrl);
|
|
7818
|
+
if (isStyleFile(filename))
|
|
7819
|
+
return { format: "commonjs", source: "", shortCircuit: true };
|
|
7820
|
+
if (!shouldTransform(filename) || !hasTransformedExtension(filename))
|
|
7662
7821
|
return nextLoad(moduleUrl, context);
|
|
7663
7822
|
const isRequire = !new Set(context.conditions).has("import");
|
|
7664
7823
|
const format = isRequire ? "commonjs" : kSupportedFormats.get(context.format) || (fileIsModule(filename) ? "module" : "commonjs");
|
|
@@ -7730,9 +7889,15 @@ function validateTsConfig(tsconfig) {
|
|
|
7730
7889
|
jsxFactory: tsconfig.jsxFactory,
|
|
7731
7890
|
jsxFragmentFactory: tsconfig.jsxFragmentFactory,
|
|
7732
7891
|
jsxImportSource: tsconfig.jsxImportSource
|
|
7733
|
-
} : void 0
|
|
7892
|
+
} : void 0,
|
|
7893
|
+
useDefineForClassFields: tsconfig.useDefineForClassFields ?? (tsconfig.target ? targetUsesDefineForClassFields(tsconfig.target) : void 0)
|
|
7734
7894
|
};
|
|
7735
7895
|
}
|
|
7896
|
+
function targetUsesDefineForClassFields(target) {
|
|
7897
|
+
const normalized = target.toLowerCase();
|
|
7898
|
+
const year = normalized.match(/^es(\d{4})$/)?.[1];
|
|
7899
|
+
return normalized === "esnext" || !!year && +year >= 2022;
|
|
7900
|
+
}
|
|
7736
7901
|
function loadAndValidateTsconfigsForFile(file2) {
|
|
7737
7902
|
if (_singleTSConfigPath && !_singleTSConfig)
|
|
7738
7903
|
_singleTSConfig = loadTsConfig(_singleTSConfigPath).map(validateTsConfig);
|
|
@@ -7827,37 +7992,48 @@ function resolveHook(filename, specifier) {
|
|
|
7827
7992
|
return resolveImportSpecifierAfterMapping(specifier, false);
|
|
7828
7993
|
}
|
|
7829
7994
|
}
|
|
7995
|
+
var kStyleExtensions = [".css", ".less", ".scss"];
|
|
7996
|
+
function isStyleFile(filename) {
|
|
7997
|
+
return kStyleExtensions.includes(import_path5.default.extname(filename));
|
|
7998
|
+
}
|
|
7830
7999
|
function shouldTransform(filename) {
|
|
7831
8000
|
if (_externalMatcher(filename))
|
|
7832
8001
|
return false;
|
|
7833
8002
|
return !belongsToNodeModules(filename);
|
|
7834
8003
|
}
|
|
8004
|
+
var kTransformedExtensions = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".mts", ".cjs", ".cts"];
|
|
8005
|
+
function hasTransformedExtension(filename) {
|
|
8006
|
+
const extension = import_path5.default.extname(filename);
|
|
8007
|
+
return !extension || kTransformedExtensions.includes(extension);
|
|
8008
|
+
}
|
|
7835
8009
|
function transformHook(originalCode, filename, moduleUrl) {
|
|
7836
8010
|
const hasPreprocessor = process.env.PW_TEST_SOURCE_TRANSFORM && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE && process.env.PW_TEST_SOURCE_TRANSFORM_SCOPE.split(pathSeparator).some((f) => filename.startsWith(f));
|
|
7837
8011
|
const pluginsEpilogue = hasPreprocessor ? [[process.env.PW_TEST_SOURCE_TRANSFORM]] : [];
|
|
7838
|
-
const
|
|
7839
|
-
const
|
|
8012
|
+
const tsconfigs = loadAndValidateTsconfigsForFile(filename);
|
|
8013
|
+
const jsx = tsconfigs.find((tsconfig) => tsconfig.jsx)?.jsx;
|
|
8014
|
+
const useDefineForClassFields = tsconfigs.find((tsconfig) => tsconfig.useDefineForClassFields !== void 0)?.useDefineForClassFields ?? true;
|
|
8015
|
+
const hash = calculateHash(originalCode, filename, !!moduleUrl, pluginsEpilogue, useDefineForClassFields, jsx);
|
|
7840
8016
|
const { cachedCode, addToCache, serializedCache } = getFromCompilationCache(filename, hash, moduleUrl);
|
|
7841
8017
|
if (cachedCode !== void 0)
|
|
7842
8018
|
return { code: cachedCode, serializedCache };
|
|
7843
8019
|
process.env.BROWSERSLIST_IGNORE_OLD_DATA = "true";
|
|
7844
8020
|
const { babelTransform } = require((0, import_package2.libPath)("transform", "babelBundle"));
|
|
7845
|
-
const babelResult = babelTransform(originalCode, filename, !!moduleUrl, pluginsEpilogue, jsx);
|
|
8021
|
+
const babelResult = babelTransform(originalCode, filename, !!moduleUrl, pluginsEpilogue, useDefineForClassFields, jsx);
|
|
7846
8022
|
if (!babelResult?.code)
|
|
7847
8023
|
return { code: originalCode, serializedCache };
|
|
7848
8024
|
const { code, map } = babelResult;
|
|
7849
8025
|
const added = addToCache(code, map);
|
|
7850
8026
|
return { code, serializedCache: added.serializedCache };
|
|
7851
8027
|
}
|
|
7852
|
-
function calculateHash(content, filePath, isModule2, pluginsEpilogue, jsx) {
|
|
7853
|
-
const hash = import_crypto5.default.createHash("sha1").update(isModule2 ? "esm" : "no_esm").update(content).update(filePath).update(version).update(pluginsEpilogue.map((p) => p[0]).join(",")).update(jsx ? JSON.stringify(jsx) : "").digest("hex");
|
|
8028
|
+
function calculateHash(content, filePath, isModule2, pluginsEpilogue, useDefineForClassFields, jsx) {
|
|
8029
|
+
const hash = import_crypto5.default.createHash("sha1").update(isModule2 ? "esm" : "no_esm").update(content).update(filePath).update(version).update(pluginsEpilogue.map((p) => p[0]).join(",")).update(useDefineForClassFields ? "define" : "assign").update(jsx ? JSON.stringify(jsx) : "").digest("hex");
|
|
7854
8030
|
return hash;
|
|
7855
8031
|
}
|
|
7856
8032
|
async function requireOrImport(file) {
|
|
7857
8033
|
installTransformIfNeeded();
|
|
7858
8034
|
const isModule = fileIsModule(file);
|
|
7859
8035
|
if (isModule) {
|
|
7860
|
-
const fileName =
|
|
8036
|
+
const fileName = import_url3.default.pathToFileURL(file);
|
|
7861
8037
|
const esmImport = () => eval(`import(${JSON.stringify(fileName)})`);
|
|
7862
8038
|
if (loaderChannel) {
|
|
7863
8039
|
await eval(`import(${JSON.stringify(fileName + ".esm.preflight")})`).catch((error) => debugTest("Failed to load preflight for " + file + ", source maps may be missing for errors thrown during loading.", error)).finally(nextTask);
|
|
@@ -7882,6 +8058,8 @@ function installTransformIfNeeded() {
|
|
|
7882
8058
|
if (transformInstalled)
|
|
7883
8059
|
return;
|
|
7884
8060
|
transformInstalled = true;
|
|
8061
|
+
if ("Bun" in globalThis)
|
|
8062
|
+
return;
|
|
7885
8063
|
registerESMLoader();
|
|
7886
8064
|
installSourceMapSupport();
|
|
7887
8065
|
if (loaderChannel) {
|
|
@@ -7905,7 +8083,11 @@ function installCJSHooks() {
|
|
|
7905
8083
|
import_module2.default._resolveFilename = resolveFilename;
|
|
7906
8084
|
addHook((code, filename) => {
|
|
7907
8085
|
return transformHook(code, filename).code;
|
|
7908
|
-
}, shouldTransform,
|
|
8086
|
+
}, shouldTransform, kTransformedExtensions);
|
|
8087
|
+
const extensions = import_module2.default._extensions;
|
|
8088
|
+
for (const ext2 of kStyleExtensions)
|
|
8089
|
+
extensions[ext2] = () => {
|
|
8090
|
+
};
|
|
7909
8091
|
}
|
|
7910
8092
|
var collectCJSDependencies = (module2, dependencies) => {
|
|
7911
8093
|
module2.children.forEach((child) => {
|
|
@@ -7918,26 +8100,41 @@ var collectCJSDependencies = (module2, dependencies) => {
|
|
|
7918
8100
|
function wrapFunctionWithLocation(func) {
|
|
7919
8101
|
return (...args) => {
|
|
7920
8102
|
const oldPrepareStackTrace = Error.prepareStackTrace;
|
|
7921
|
-
Error.prepareStackTrace = (error, stackFrames) => {
|
|
7922
|
-
const frame = import_source_map_support2.default.wrapCallSite(stackFrames[1]);
|
|
7923
|
-
const fileName2 = frame.getFileName();
|
|
7924
|
-
const file2 = fileName2 && fileName2.startsWith("file://") ? import_url2.default.fileURLToPath(fileName2) : fileName2;
|
|
7925
|
-
return {
|
|
7926
|
-
file: file2,
|
|
7927
|
-
line: frame.getLineNumber(),
|
|
7928
|
-
column: frame.getColumnNumber()
|
|
7929
|
-
};
|
|
7930
|
-
};
|
|
7931
8103
|
const oldStackTraceLimit = Error.stackTraceLimit;
|
|
8104
|
+
Error.prepareStackTrace = bunHasZeroBasedColumns ? bunCallerLocation : nodeCallerLocation;
|
|
7932
8105
|
Error.stackTraceLimit = 2;
|
|
7933
8106
|
const obj = {};
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
8107
|
+
let location;
|
|
8108
|
+
try {
|
|
8109
|
+
Error.captureStackTrace(obj);
|
|
8110
|
+
location = obj.stack;
|
|
8111
|
+
} finally {
|
|
8112
|
+
Error.stackTraceLimit = oldStackTraceLimit;
|
|
8113
|
+
Error.prepareStackTrace = oldPrepareStackTrace;
|
|
8114
|
+
}
|
|
7938
8115
|
return func(location, ...args);
|
|
7939
8116
|
};
|
|
7940
8117
|
}
|
|
8118
|
+
function nodeCallerLocation(error, stackFrames) {
|
|
8119
|
+
const frame = import_source_map_support2.default.wrapCallSite(stackFrames[1]);
|
|
8120
|
+
const fileName2 = frame.getFileName();
|
|
8121
|
+
const file2 = fileName2 && fileName2.startsWith("file://") ? import_url3.default.fileURLToPath(fileName2) : fileName2;
|
|
8122
|
+
return {
|
|
8123
|
+
file: file2,
|
|
8124
|
+
line: frame.getLineNumber(),
|
|
8125
|
+
column: frame.getColumnNumber()
|
|
8126
|
+
};
|
|
8127
|
+
}
|
|
8128
|
+
var bunHasZeroBasedColumns = "Bun" in globalThis && Bun.semver.order(Bun.version, "1.4.4") < 0;
|
|
8129
|
+
function bunCallerLocation(error, stackFrames) {
|
|
8130
|
+
const frame = stackFrames[1];
|
|
8131
|
+
const position = import_source_map_support2.default.mapSourcePosition({ source: frame.getFileName(), line: frame.getLineNumber(), column: frame.getColumnNumber() });
|
|
8132
|
+
return {
|
|
8133
|
+
file: position.source,
|
|
8134
|
+
line: position.line,
|
|
8135
|
+
column: position.column + 1
|
|
8136
|
+
};
|
|
8137
|
+
}
|
|
7941
8138
|
function isRelativeSpecifier(specifier) {
|
|
7942
8139
|
return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../");
|
|
7943
8140
|
}
|
|
@@ -7948,8 +8145,6 @@ var loaderChannel;
|
|
|
7948
8145
|
function registerESMLoader() {
|
|
7949
8146
|
if (process.env.PW_DISABLE_TS_ESM)
|
|
7950
8147
|
return;
|
|
7951
|
-
if ("Bun" in globalThis)
|
|
7952
|
-
return;
|
|
7953
8148
|
const nodeModule = require("node:module");
|
|
7954
8149
|
if (nodeModule.registerHooks && !process.env.PLAYWRIGHT_FORCE_ASYNC_LOADER) {
|
|
7955
8150
|
nodeModule.registerHooks({ resolve, load });
|
|
@@ -7958,7 +8153,7 @@ function registerESMLoader() {
|
|
|
7958
8153
|
if (!nodeModule.register)
|
|
7959
8154
|
return;
|
|
7960
8155
|
const { port1, port2 } = new MessageChannel();
|
|
7961
|
-
nodeModule.register(
|
|
8156
|
+
nodeModule.register(import_url3.default.pathToFileURL(require.resolve("../transform/esmLoader.js")), {
|
|
7962
8157
|
data: { port: port2 },
|
|
7963
8158
|
transferList: [port2]
|
|
7964
8159
|
});
|
|
@@ -7978,7 +8173,7 @@ async function startCollectingFileDeps2() {
|
|
|
7978
8173
|
async function stopCollectingFileDeps2(file2) {
|
|
7979
8174
|
stopCollectingFileDeps(file2);
|
|
7980
8175
|
if (loaderChannel)
|
|
7981
|
-
await loaderChannel.send("stopCollectingFileDeps", { file: file2 });
|
|
8176
|
+
await loaderChannel.send("stopCollectingFileDeps", { file: file2, dependencies: [...dependenciesForTestFile(file2)] });
|
|
7982
8177
|
}
|
|
7983
8178
|
async function incorporateCompilationCache() {
|
|
7984
8179
|
if (!loaderChannel)
|
|
@@ -7992,14 +8187,13 @@ var esmPreflightExtension = ".esm.preflight";
|
|
|
7992
8187
|
async function resolve2(originalSpecifier, context, defaultResolve) {
|
|
7993
8188
|
let specifier = originalSpecifier.replace(esmPreflightExtension, "");
|
|
7994
8189
|
if (context.parentURL && context.parentURL.startsWith("file://")) {
|
|
7995
|
-
const filename =
|
|
8190
|
+
const filename = import_url4.default.fileURLToPath(context.parentURL);
|
|
7996
8191
|
const resolved = resolveHook(filename, specifier);
|
|
7997
8192
|
if (resolved !== void 0)
|
|
7998
|
-
specifier =
|
|
8193
|
+
specifier = import_url4.default.pathToFileURL(resolved).toString();
|
|
7999
8194
|
}
|
|
8000
8195
|
const result2 = await defaultResolve(specifier, context, defaultResolve);
|
|
8001
|
-
|
|
8002
|
-
currentFileDepsCollector()?.add(import_url3.default.fileURLToPath(result2.url));
|
|
8196
|
+
recordResolvedFile(result2?.url, context.parentURL);
|
|
8003
8197
|
if (originalSpecifier.endsWith(esmPreflightExtension))
|
|
8004
8198
|
result2.url = result2.url + esmPreflightExtension;
|
|
8005
8199
|
return result2;
|
|
@@ -8017,12 +8211,16 @@ async function load2(moduleUrl, context, defaultLoad) {
|
|
|
8017
8211
|
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
8018
8212
|
if (!moduleUrl.startsWith("file://"))
|
|
8019
8213
|
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
8020
|
-
const filename =
|
|
8214
|
+
const filename = import_url4.default.fileURLToPath(moduleUrl);
|
|
8021
8215
|
const isPreflight = moduleUrl.endsWith(esmPreflightExtension);
|
|
8216
|
+
if (isStyleFile(filename))
|
|
8217
|
+
return { format: "commonjs", source: "", shortCircuit: true };
|
|
8022
8218
|
if (!shouldTransform(filename))
|
|
8023
8219
|
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
8024
8220
|
const originalModuleUrl = isPreflight ? moduleUrl.slice(0, -esmPreflightExtension.length) : moduleUrl;
|
|
8025
|
-
const originalFilename = isPreflight ?
|
|
8221
|
+
const originalFilename = isPreflight ? import_url4.default.fileURLToPath(originalModuleUrl) : filename;
|
|
8222
|
+
if (!hasTransformedExtension(originalFilename))
|
|
8223
|
+
return defaultLoad(moduleUrl, context, defaultLoad);
|
|
8026
8224
|
const code = import_fs6.default.readFileSync(originalFilename, "utf-8");
|
|
8027
8225
|
const transformed = transformHook(code, originalFilename, originalModuleUrl);
|
|
8028
8226
|
if (transformed.serializedCache)
|
|
@@ -8058,7 +8256,7 @@ function createTransport(port) {
|
|
|
8058
8256
|
return;
|
|
8059
8257
|
}
|
|
8060
8258
|
if (method === "stopCollectingFileDeps") {
|
|
8061
|
-
stopCollectingFileDeps(params.file);
|
|
8259
|
+
stopCollectingFileDeps(params.file, params.dependencies);
|
|
8062
8260
|
return;
|
|
8063
8261
|
}
|
|
8064
8262
|
});
|