@rstest/core 0.9.5 → 0.9.6
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 +80 -0
- package/dist/0~8843.js +9 -1
- package/dist/{0~lib.js → 0~@babel/code-frame.js} +2 -2
- package/dist/0~@clack/prompts.js +1044 -0
- package/dist/0~browserLoader.js +1 -1
- package/dist/0~browser~1.js +17 -17
- package/dist/0~checkThresholds.js +1 -1
- package/dist/0~chokidar.js +43 -42
- package/dist/0~fake-timers.js +173 -70
- package/dist/0~generate.js +1 -2
- package/dist/0~magic-string.es.js +1 -181
- package/dist/0~restart.js +1 -1
- package/dist/0~snapshot.js +1 -1
- package/dist/1255.js +11 -11
- package/dist/3145.js +102 -9
- package/dist/4411.js +13 -13
- package/dist/6830.js +1 -1
- package/dist/6887.js +15 -0
- package/dist/9743.js +1 -1
- package/dist/9784.js +2 -2
- package/dist/browser-runtime/2~fake-timers.js +172 -65
- package/dist/browser-runtime/2~magic-string.es.js +3 -189
- package/dist/browser-runtime/2~snapshot.js +2 -2
- package/dist/browser-runtime/723.js +70 -2
- package/dist/browser-runtime/index.d.ts +16 -5
- package/dist/browser.d.ts +16 -5
- package/dist/globalSetupWorker.js +1 -1
- package/dist/index.d.ts +39 -11
- package/dist/index.js +1 -1
- package/dist/worker.d.ts +16 -5
- package/dist/worker.js +1 -1
- package/package.json +11 -11
- package/dist/0~dist.js +0 -1014
- package/dist/4899.js +0 -11
- package/dist/browser-runtime/rslib-runtime.js +0 -49
- /package/dist/{rslib-runtime.js → 0~rslib-runtime.js} +0 -0
package/dist/0~browserLoader.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pathToFileURL } from "node:url";
|
|
|
4
4
|
import "./4411.js";
|
|
5
5
|
import { logger as logger_logger, color as logger_color } from "./6830.js";
|
|
6
6
|
async function loadBrowserModule(options = {}) {
|
|
7
|
-
const coreVersion = "0.9.
|
|
7
|
+
const coreVersion = "0.9.6";
|
|
8
8
|
const { projectRoots = [] } = options;
|
|
9
9
|
let browserModule;
|
|
10
10
|
let browserVersion;
|
package/dist/0~browser~1.js
CHANGED
|
@@ -2,7 +2,7 @@ import "node:module";
|
|
|
2
2
|
import node_path from "node:path";
|
|
3
3
|
import node_fs from "node:fs";
|
|
4
4
|
import { detect, resolveCommand } from "./3145.js";
|
|
5
|
-
import { confirm as
|
|
5
|
+
import { confirm as dist_ot, intro as mt, log as dist_O, note as wt, outro as gt, cancel as pt, isCancel as dist_q, spinner as fe, select as _t } from "./0~@clack/prompts.js";
|
|
6
6
|
import "./4411.js";
|
|
7
7
|
import { determineAgent, color as logger_color } from "./6830.js";
|
|
8
8
|
function getUniqueBaseName(dir, baseName, ext) {
|
|
@@ -347,16 +347,16 @@ async function createNonInteractive(cwd, projectInfo) {
|
|
|
347
347
|
async function createInteractive(cwd, projectInfo, isAgent) {
|
|
348
348
|
const { agent, language, testDir, framework, reactVersion } = projectInfo;
|
|
349
349
|
const effectiveFramework = 'react' === framework ? 'react' : 'vanilla';
|
|
350
|
-
|
|
350
|
+
mt(logger_color.bgCyan(logger_color.black(' rstest init browser ')));
|
|
351
351
|
const detectionLines = [];
|
|
352
352
|
if ('react' === framework && reactVersion) detectionLines.push(`${logger_color.green('✓')} Found React ${reactVersion}`);
|
|
353
353
|
else if ('react' === framework) detectionLines.push(`${logger_color.green('✓')} Found React`);
|
|
354
354
|
else detectionLines.push(`${logger_color.yellow('⚠')} Framework not detected, will generate vanilla DOM example`);
|
|
355
355
|
detectionLines.push(`${logger_color.green('✓')} Found ${'ts' === language ? 'TypeScript' : 'JavaScript'}`);
|
|
356
356
|
detectionLines.push(`${logger_color.green('✓')} Test directory: ${testDir}/`);
|
|
357
|
-
|
|
358
|
-
if (isAgent)
|
|
359
|
-
const providerSelection = await
|
|
357
|
+
wt(detectionLines.join('\n'), 'Detecting project...');
|
|
358
|
+
if (isAgent) dist_O.info(`AI Agent detected. For non-interactive mode, run:\n ${logger_color.cyan('npx rstest init browser --yes')}`);
|
|
359
|
+
const providerSelection = await _t({
|
|
360
360
|
message: 'Choose a browser provider (so far, only Playwright)',
|
|
361
361
|
options: [
|
|
362
362
|
{
|
|
@@ -366,13 +366,13 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
366
366
|
}
|
|
367
367
|
]
|
|
368
368
|
});
|
|
369
|
-
if (
|
|
370
|
-
|
|
369
|
+
if (dist_q(providerSelection)) {
|
|
370
|
+
pt('Operation cancelled.');
|
|
371
371
|
process.exit(0);
|
|
372
372
|
}
|
|
373
373
|
const provider = providerSelection;
|
|
374
374
|
const preview = computeFilePreview(cwd, projectInfo);
|
|
375
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.
|
|
375
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.6");
|
|
376
376
|
const depsList = Object.entries(deps).map(([name, version])=>`${name}@${version}`).join(', ');
|
|
377
377
|
const previewLines = [
|
|
378
378
|
`${logger_color.cyan('+')} Create ${preview.configFile}`,
|
|
@@ -382,22 +382,22 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
382
382
|
' - Add "test:browser" script',
|
|
383
383
|
` - Add devDependencies: ${logger_color.dim(depsList)}`
|
|
384
384
|
];
|
|
385
|
-
|
|
386
|
-
const confirmed = await
|
|
385
|
+
wt(previewLines.join('\n'), 'Changes to be made');
|
|
386
|
+
const confirmed = await dist_ot({
|
|
387
387
|
message: 'Proceed with these changes?',
|
|
388
388
|
initialValue: true
|
|
389
389
|
});
|
|
390
|
-
if (
|
|
391
|
-
|
|
390
|
+
if (dist_q(confirmed) || !confirmed) {
|
|
391
|
+
pt('Operation cancelled.');
|
|
392
392
|
process.exit(0);
|
|
393
393
|
}
|
|
394
|
-
const s =
|
|
394
|
+
const s = fe();
|
|
395
395
|
s.start('Creating files...');
|
|
396
396
|
const createdFiles = await generateFiles(cwd, projectInfo, provider);
|
|
397
397
|
s.stop('Created files');
|
|
398
398
|
const fileLines = createdFiles.map((f)=>`${logger_color.green('✓')} Created ${f}`);
|
|
399
399
|
fileLines.push(`${logger_color.green('✓')} Updated package.json`);
|
|
400
|
-
|
|
400
|
+
wt(fileLines.join('\n'), 'Files');
|
|
401
401
|
const nextStepsLines = [
|
|
402
402
|
`${logger_color.bold('1.')} Install dependencies:`,
|
|
403
403
|
` ${logger_color.cyan(getInstallCommand(agent))}`,
|
|
@@ -408,8 +408,8 @@ async function createInteractive(cwd, projectInfo, isAgent) {
|
|
|
408
408
|
`${logger_color.bold('3.')} Run your tests:`,
|
|
409
409
|
` ${logger_color.cyan(getRunCommand(agent))}`
|
|
410
410
|
];
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
wt(nextStepsLines.join('\n'), 'Next steps');
|
|
412
|
+
gt(logger_color.green('Done! Happy testing with Rstest!'));
|
|
413
413
|
}
|
|
414
414
|
async function generateFiles(cwd, projectInfo, provider) {
|
|
415
415
|
const { language, testDir, framework } = projectInfo;
|
|
@@ -450,7 +450,7 @@ async function generateFiles(cwd, projectInfo, provider) {
|
|
|
450
450
|
updatePackageJsonScripts(cwd, {
|
|
451
451
|
'test:browser': 'rstest --config=rstest.browser.config.mts'
|
|
452
452
|
});
|
|
453
|
-
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.
|
|
453
|
+
const deps = getDependenciesWithVersions(effectiveFramework, provider, "0.9.6");
|
|
454
454
|
updatePackageJsonDevDeps(cwd, deps);
|
|
455
455
|
return createdFiles;
|
|
456
456
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
2
|
+
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
3
3
|
import "./4411.js";
|
|
4
4
|
import { relative, color as logger_color } from "./6830.js";
|
|
5
5
|
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js");
|
package/dist/0~chokidar.js
CHANGED
|
@@ -3,9 +3,10 @@ import "node:module";
|
|
|
3
3
|
import { EventEmitter } from "node:events";
|
|
4
4
|
import { stat as external_node_fs_stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
5
5
|
import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "node:fs/promises";
|
|
6
|
-
import {
|
|
6
|
+
import { join, relative as external_node_path_relative, resolve as external_node_path_resolve, sep } from "node:path";
|
|
7
7
|
import { Readable } from "node:stream";
|
|
8
8
|
import { type as external_node_os_type } from "node:os";
|
|
9
|
+
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
9
10
|
const EntryTypes = {
|
|
10
11
|
FILE_TYPE: 'files',
|
|
11
12
|
DIR_TYPE: 'directories',
|
|
@@ -531,7 +532,7 @@ const binaryExtensions = new Set([
|
|
|
531
532
|
'zip',
|
|
532
533
|
'zipx'
|
|
533
534
|
]);
|
|
534
|
-
const isBinaryPath = (filePath)=>binaryExtensions.has(extname(filePath).slice(1).toLowerCase());
|
|
535
|
+
const isBinaryPath = (filePath)=>binaryExtensions.has(__rspack_external_node_path_c5b9b54f.extname(filePath).slice(1).toLowerCase());
|
|
535
536
|
const foreach = (val, fn)=>{
|
|
536
537
|
if (val instanceof Set) val.forEach(fn);
|
|
537
538
|
else fn(val);
|
|
@@ -561,7 +562,7 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
|
561
562
|
emitRaw(rawEvent, evPath, {
|
|
562
563
|
watchedPath: path
|
|
563
564
|
});
|
|
564
|
-
if (evPath && path !== evPath) fsWatchBroadcast(
|
|
565
|
+
if (evPath && path !== evPath) fsWatchBroadcast(__rspack_external_node_path_c5b9b54f.resolve(path, evPath), KEY_LISTENERS, __rspack_external_node_path_c5b9b54f.join(path, evPath));
|
|
565
566
|
};
|
|
566
567
|
try {
|
|
567
568
|
return watch(path, {
|
|
@@ -676,11 +677,11 @@ class NodeFsHandler {
|
|
|
676
677
|
}
|
|
677
678
|
_watchWithNodeFs(path, listener) {
|
|
678
679
|
const opts = this.fsw.options;
|
|
679
|
-
const directory =
|
|
680
|
-
const basename =
|
|
680
|
+
const directory = __rspack_external_node_path_c5b9b54f.dirname(path);
|
|
681
|
+
const basename = __rspack_external_node_path_c5b9b54f.basename(path);
|
|
681
682
|
const parent = this.fsw._getWatchedDir(directory);
|
|
682
683
|
parent.add(basename);
|
|
683
|
-
const absolutePath =
|
|
684
|
+
const absolutePath = __rspack_external_node_path_c5b9b54f.resolve(path);
|
|
684
685
|
const options = {
|
|
685
686
|
persistent: opts.persistent
|
|
686
687
|
};
|
|
@@ -702,8 +703,8 @@ class NodeFsHandler {
|
|
|
702
703
|
}
|
|
703
704
|
_handleFile(file, stats, initialAdd) {
|
|
704
705
|
if (this.fsw.closed) return;
|
|
705
|
-
const dirname =
|
|
706
|
-
const basename =
|
|
706
|
+
const dirname = __rspack_external_node_path_c5b9b54f.dirname(file);
|
|
707
|
+
const basename = __rspack_external_node_path_c5b9b54f.basename(file);
|
|
707
708
|
const parent = this.fsw._getWatchedDir(dirname);
|
|
708
709
|
let prevStats = stats;
|
|
709
710
|
if (parent.has(basename)) return;
|
|
@@ -770,7 +771,7 @@ class NodeFsHandler {
|
|
|
770
771
|
this.fsw._symlinkPaths.set(full, true);
|
|
771
772
|
}
|
|
772
773
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
773
|
-
directory = join(directory, '');
|
|
774
|
+
directory = __rspack_external_node_path_c5b9b54f.join(directory, '');
|
|
774
775
|
const throttleKey = target ? `${directory}:${target}` : directory;
|
|
775
776
|
throttler = this.fsw._throttle('readdir', throttleKey, 1000);
|
|
776
777
|
if (!throttler) return;
|
|
@@ -787,7 +788,7 @@ class NodeFsHandler {
|
|
|
787
788
|
return;
|
|
788
789
|
}
|
|
789
790
|
const item = entry.path;
|
|
790
|
-
let path = join(directory, item);
|
|
791
|
+
let path = __rspack_external_node_path_c5b9b54f.join(directory, item);
|
|
791
792
|
current.add(item);
|
|
792
793
|
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) return;
|
|
793
794
|
if (this.fsw.closed) {
|
|
@@ -796,7 +797,7 @@ class NodeFsHandler {
|
|
|
796
797
|
}
|
|
797
798
|
if (item === target || !target && !previous.has(item)) {
|
|
798
799
|
this.fsw._incrReadyCount();
|
|
799
|
-
path = join(dir,
|
|
800
|
+
path = __rspack_external_node_path_c5b9b54f.join(dir, __rspack_external_node_path_c5b9b54f.relative(dir, path));
|
|
800
801
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
801
802
|
}
|
|
802
803
|
}).on(EV.ERROR, this._boundHandleError);
|
|
@@ -818,10 +819,10 @@ class NodeFsHandler {
|
|
|
818
819
|
});
|
|
819
820
|
}
|
|
820
821
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
|
821
|
-
const parentDir = this.fsw._getWatchedDir(
|
|
822
|
-
const tracked = parentDir.has(
|
|
822
|
+
const parentDir = this.fsw._getWatchedDir(__rspack_external_node_path_c5b9b54f.dirname(dir));
|
|
823
|
+
const tracked = parentDir.has(__rspack_external_node_path_c5b9b54f.basename(dir));
|
|
823
824
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
824
|
-
parentDir.add(
|
|
825
|
+
parentDir.add(__rspack_external_node_path_c5b9b54f.basename(dir));
|
|
825
826
|
this.fsw._getWatchedDir(dir);
|
|
826
827
|
let throttler;
|
|
827
828
|
let closer;
|
|
@@ -859,7 +860,7 @@ class NodeFsHandler {
|
|
|
859
860
|
const follow = this.fsw.options.followSymlinks;
|
|
860
861
|
let closer;
|
|
861
862
|
if (stats.isDirectory()) {
|
|
862
|
-
const absPath =
|
|
863
|
+
const absPath = __rspack_external_node_path_c5b9b54f.resolve(path);
|
|
863
864
|
const targetPath = follow ? await promises_realpath(path) : path;
|
|
864
865
|
if (this.fsw.closed) return;
|
|
865
866
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -868,12 +869,12 @@ class NodeFsHandler {
|
|
|
868
869
|
} else if (stats.isSymbolicLink()) {
|
|
869
870
|
const targetPath = follow ? await promises_realpath(path) : path;
|
|
870
871
|
if (this.fsw.closed) return;
|
|
871
|
-
const parent =
|
|
872
|
+
const parent = __rspack_external_node_path_c5b9b54f.dirname(wh.watchPath);
|
|
872
873
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
873
874
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
874
875
|
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
|
|
875
876
|
if (this.fsw.closed) return;
|
|
876
|
-
if (void 0 !== targetPath) this.fsw._symlinkPaths.set(
|
|
877
|
+
if (void 0 !== targetPath) this.fsw._symlinkPaths.set(__rspack_external_node_path_c5b9b54f.resolve(path), targetPath);
|
|
877
878
|
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
878
879
|
ready();
|
|
879
880
|
if (closer) this.fsw._addPathCloser(path, closer);
|
|
@@ -908,9 +909,9 @@ function createPattern(matcher) {
|
|
|
908
909
|
if ('object' == typeof matcher && null !== matcher) return (string)=>{
|
|
909
910
|
if (matcher.path === string) return true;
|
|
910
911
|
if (matcher.recursive) {
|
|
911
|
-
const relative =
|
|
912
|
+
const relative = __rspack_external_node_path_c5b9b54f.relative(matcher.path, string);
|
|
912
913
|
if (!relative) return false;
|
|
913
|
-
return !relative.startsWith('..') && !isAbsolute(relative);
|
|
914
|
+
return !relative.startsWith('..') && !__rspack_external_node_path_c5b9b54f.isAbsolute(relative);
|
|
914
915
|
}
|
|
915
916
|
return false;
|
|
916
917
|
};
|
|
@@ -918,7 +919,7 @@ function createPattern(matcher) {
|
|
|
918
919
|
}
|
|
919
920
|
function normalizePath(path) {
|
|
920
921
|
if ('string' != typeof path) throw new Error('string expected');
|
|
921
|
-
path = normalize(path);
|
|
922
|
+
path = __rspack_external_node_path_c5b9b54f.normalize(path);
|
|
922
923
|
path = path.replace(/\\/g, '/');
|
|
923
924
|
let prepend = false;
|
|
924
925
|
if (path.startsWith('//')) prepend = true;
|
|
@@ -954,14 +955,14 @@ const toUnix = (string)=>{
|
|
|
954
955
|
if (prepend) str = SLASH + str;
|
|
955
956
|
return str;
|
|
956
957
|
};
|
|
957
|
-
const normalizePathToUnix = (path)=>toUnix(normalize(toUnix(path)));
|
|
958
|
+
const normalizePathToUnix = (path)=>toUnix(__rspack_external_node_path_c5b9b54f.normalize(toUnix(path)));
|
|
958
959
|
const normalizeIgnored = (cwd = '')=>(path)=>{
|
|
959
|
-
if ('string' == typeof path) return normalizePathToUnix(isAbsolute(path) ? path : join(cwd, path));
|
|
960
|
+
if ('string' == typeof path) return normalizePathToUnix(__rspack_external_node_path_c5b9b54f.isAbsolute(path) ? path : __rspack_external_node_path_c5b9b54f.join(cwd, path));
|
|
960
961
|
return path;
|
|
961
962
|
};
|
|
962
963
|
const getAbsolutePath = (path, cwd)=>{
|
|
963
|
-
if (isAbsolute(path)) return path;
|
|
964
|
-
return join(cwd, path);
|
|
964
|
+
if (__rspack_external_node_path_c5b9b54f.isAbsolute(path)) return path;
|
|
965
|
+
return __rspack_external_node_path_c5b9b54f.join(cwd, path);
|
|
965
966
|
};
|
|
966
967
|
const EMPTY_SET = Object.freeze(new Set());
|
|
967
968
|
class DirEntry {
|
|
@@ -987,7 +988,7 @@ class DirEntry {
|
|
|
987
988
|
try {
|
|
988
989
|
await readdir(dir);
|
|
989
990
|
} catch (err) {
|
|
990
|
-
if (this._removeWatcher) this._removeWatcher(
|
|
991
|
+
if (this._removeWatcher) this._removeWatcher(__rspack_external_node_path_c5b9b54f.dirname(dir), __rspack_external_node_path_c5b9b54f.basename(dir));
|
|
991
992
|
}
|
|
992
993
|
}
|
|
993
994
|
has(item) {
|
|
@@ -1025,7 +1026,7 @@ class WatchHelper {
|
|
|
1025
1026
|
const watchPath = path;
|
|
1026
1027
|
this.path = path = path.replace(REPLACER_RE, '');
|
|
1027
1028
|
this.watchPath = watchPath;
|
|
1028
|
-
this.fullWatchPath =
|
|
1029
|
+
this.fullWatchPath = __rspack_external_node_path_c5b9b54f.resolve(watchPath);
|
|
1029
1030
|
this.dirParts = [];
|
|
1030
1031
|
this.dirParts.forEach((parts)=>{
|
|
1031
1032
|
if (parts.length > 1) parts.pop();
|
|
@@ -1034,7 +1035,7 @@ class WatchHelper {
|
|
|
1034
1035
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
1035
1036
|
}
|
|
1036
1037
|
entryPath(entry) {
|
|
1037
|
-
return join(this.watchPath,
|
|
1038
|
+
return __rspack_external_node_path_c5b9b54f.join(this.watchPath, __rspack_external_node_path_c5b9b54f.relative(this.watchPath, entry.fullPath));
|
|
1038
1039
|
}
|
|
1039
1040
|
filterPath(entry) {
|
|
1040
1041
|
const { stats } = entry;
|
|
@@ -1159,7 +1160,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1159
1160
|
})).then((results)=>{
|
|
1160
1161
|
if (this.closed) return;
|
|
1161
1162
|
results.forEach((item)=>{
|
|
1162
|
-
if (item) this.add(
|
|
1163
|
+
if (item) this.add(__rspack_external_node_path_c5b9b54f.dirname(item), __rspack_external_node_path_c5b9b54f.basename(_origAdd || item));
|
|
1163
1164
|
});
|
|
1164
1165
|
});
|
|
1165
1166
|
return this;
|
|
@@ -1169,9 +1170,9 @@ class FSWatcher extends EventEmitter {
|
|
|
1169
1170
|
const paths = unifyPaths(paths_);
|
|
1170
1171
|
const { cwd } = this.options;
|
|
1171
1172
|
paths.forEach((path)=>{
|
|
1172
|
-
if (!isAbsolute(path) && !this._closers.has(path)) {
|
|
1173
|
-
if (cwd) path = join(cwd, path);
|
|
1174
|
-
path =
|
|
1173
|
+
if (!__rspack_external_node_path_c5b9b54f.isAbsolute(path) && !this._closers.has(path)) {
|
|
1174
|
+
if (cwd) path = __rspack_external_node_path_c5b9b54f.join(cwd, path);
|
|
1175
|
+
path = __rspack_external_node_path_c5b9b54f.resolve(path);
|
|
1175
1176
|
}
|
|
1176
1177
|
this._closePath(path);
|
|
1177
1178
|
this._addIgnoredPath(path);
|
|
@@ -1208,7 +1209,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1208
1209
|
getWatched() {
|
|
1209
1210
|
const watchList = {};
|
|
1210
1211
|
this._watched.forEach((entry, dir)=>{
|
|
1211
|
-
const key = this.options.cwd ?
|
|
1212
|
+
const key = this.options.cwd ? __rspack_external_node_path_c5b9b54f.relative(this.options.cwd, dir) : dir;
|
|
1212
1213
|
const index = key || ONE_DOT;
|
|
1213
1214
|
watchList[index] = entry.getChildren().sort();
|
|
1214
1215
|
});
|
|
@@ -1221,8 +1222,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1221
1222
|
async _emit(event, path, stats) {
|
|
1222
1223
|
if (this.closed) return;
|
|
1223
1224
|
const opts = this.options;
|
|
1224
|
-
if (isWindows) path = normalize(path);
|
|
1225
|
-
if (opts.cwd) path =
|
|
1225
|
+
if (isWindows) path = __rspack_external_node_path_c5b9b54f.normalize(path);
|
|
1226
|
+
if (opts.cwd) path = __rspack_external_node_path_c5b9b54f.relative(opts.cwd, path);
|
|
1226
1227
|
const args = [
|
|
1227
1228
|
path
|
|
1228
1229
|
];
|
|
@@ -1273,7 +1274,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1273
1274
|
if (isThrottled) return this;
|
|
1274
1275
|
}
|
|
1275
1276
|
if (opts.alwaysStat && void 0 === stats && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
1276
|
-
const fullPath = opts.cwd ? join(opts.cwd, path) : path;
|
|
1277
|
+
const fullPath = opts.cwd ? __rspack_external_node_path_c5b9b54f.join(opts.cwd, path) : path;
|
|
1277
1278
|
let stats;
|
|
1278
1279
|
try {
|
|
1279
1280
|
stats = await promises_stat(fullPath);
|
|
@@ -1325,7 +1326,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1325
1326
|
const pollInterval = awf.pollInterval;
|
|
1326
1327
|
let timeoutHandler;
|
|
1327
1328
|
let fullPath = path;
|
|
1328
|
-
if (this.options.cwd && !isAbsolute(path)) fullPath = join(this.options.cwd, path);
|
|
1329
|
+
if (this.options.cwd && !__rspack_external_node_path_c5b9b54f.isAbsolute(path)) fullPath = __rspack_external_node_path_c5b9b54f.join(this.options.cwd, path);
|
|
1329
1330
|
const now = new Date();
|
|
1330
1331
|
const writes = this._pendingWrites;
|
|
1331
1332
|
function awaitWriteFinishFn(prevStat) {
|
|
@@ -1380,7 +1381,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1380
1381
|
return new WatchHelper(path, this.options.followSymlinks, this);
|
|
1381
1382
|
}
|
|
1382
1383
|
_getWatchedDir(directory) {
|
|
1383
|
-
const dir =
|
|
1384
|
+
const dir = __rspack_external_node_path_c5b9b54f.resolve(directory);
|
|
1384
1385
|
if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
1385
1386
|
return this._watched.get(dir);
|
|
1386
1387
|
}
|
|
@@ -1389,8 +1390,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1389
1390
|
return Boolean(256 & Number(stats.mode));
|
|
1390
1391
|
}
|
|
1391
1392
|
_remove(directory, item, isDirectory) {
|
|
1392
|
-
const path = join(directory, item);
|
|
1393
|
-
const fullPath =
|
|
1393
|
+
const path = __rspack_external_node_path_c5b9b54f.join(directory, item);
|
|
1394
|
+
const fullPath = __rspack_external_node_path_c5b9b54f.resolve(path);
|
|
1394
1395
|
isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
|
|
1395
1396
|
if (!this._throttle('remove', path, 100)) return;
|
|
1396
1397
|
if (!isDirectory && 1 === this._watched.size) this.add(directory, item, true);
|
|
@@ -1402,7 +1403,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1402
1403
|
parent.remove(item);
|
|
1403
1404
|
if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
|
|
1404
1405
|
let relPath = path;
|
|
1405
|
-
if (this.options.cwd) relPath =
|
|
1406
|
+
if (this.options.cwd) relPath = __rspack_external_node_path_c5b9b54f.relative(this.options.cwd, path);
|
|
1406
1407
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
1407
1408
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
1408
1409
|
if (event === EVENTS.ADD) return;
|
|
@@ -1415,8 +1416,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1415
1416
|
}
|
|
1416
1417
|
_closePath(path) {
|
|
1417
1418
|
this._closeFile(path);
|
|
1418
|
-
const dir =
|
|
1419
|
-
this._getWatchedDir(dir).remove(
|
|
1419
|
+
const dir = __rspack_external_node_path_c5b9b54f.dirname(path);
|
|
1420
|
+
this._getWatchedDir(dir).remove(__rspack_external_node_path_c5b9b54f.basename(path));
|
|
1420
1421
|
}
|
|
1421
1422
|
_closeFile(path) {
|
|
1422
1423
|
const closers = this._closers.get(path);
|