@rspack/test-tools 1.1.5 → 1.1.8
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/helper/expect/placeholder.d.ts +1 -1
- package/dist/helper/expect/placeholder.js +12 -8
- package/dist/helper/index.d.ts +0 -1
- package/dist/helper/index.js +0 -1
- package/dist/helper/setup-expect.js +1 -11
- package/dist/helper/win.d.ts +0 -1
- package/dist/helper/win.js +0 -4
- package/dist/processor/diagnostic.js +4 -5
- package/dist/processor/hook.js +13 -16
- package/dist/processor/hot-step.js +5 -4
- package/dist/processor/snapshot.d.ts +1 -0
- package/dist/processor/snapshot.js +6 -5
- package/dist/processor/stats.js +2 -2
- package/dist/processor/treeshaking.d.ts +1 -0
- package/dist/processor/treeshaking.js +4 -0
- package/package.json +5 -5
- package/dist/helper/expect/char.d.ts +0 -4
- package/dist/helper/expect/char.js +0 -25
- package/dist/helper/replace-paths.d.ts +0 -1
- package/dist/helper/replace-paths.js +0 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const normalizePlaceholder: any;
|
|
1
|
+
export declare const normalizePlaceholder: (val: any) => string;
|
|
@@ -5,17 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.normalizePlaceholder = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const path_serializer_1 = require("path-serializer");
|
|
9
|
+
// 1. escapeEOL \r\n -> \n
|
|
10
|
+
// 2. replace <RSPACK_ROOT> etc
|
|
11
|
+
// 3. transform win32 sep
|
|
12
|
+
const placeholderSerializer = (0, path_serializer_1.createSnapshotSerializer)({
|
|
13
|
+
root: node_path_1.default.resolve(__dirname, "../../../../../"),
|
|
11
14
|
replace: [
|
|
12
15
|
{
|
|
13
|
-
match: node_path_1.default.resolve(__dirname, "../../../
|
|
14
|
-
mark: "
|
|
16
|
+
match: node_path_1.default.resolve(__dirname, "../../../"),
|
|
17
|
+
mark: "test_tools_root"
|
|
15
18
|
},
|
|
16
19
|
{
|
|
17
|
-
match: node_path_1.default.resolve(__dirname, "
|
|
18
|
-
mark: "
|
|
20
|
+
match: node_path_1.default.resolve(__dirname, "../../../../rspack"),
|
|
21
|
+
mark: "rspack_root"
|
|
19
22
|
},
|
|
20
23
|
{
|
|
21
24
|
match: /:\d+:\d+-\d+:\d+/g,
|
|
@@ -27,8 +30,9 @@ const placeholderSerializer = createSnapshotSerializer({
|
|
|
27
30
|
}
|
|
28
31
|
],
|
|
29
32
|
features: {
|
|
33
|
+
replaceWorkspace: false,
|
|
30
34
|
addDoubleQuotes: false,
|
|
31
|
-
|
|
35
|
+
escapeDoubleQuotes: false
|
|
32
36
|
}
|
|
33
37
|
});
|
|
34
38
|
exports.normalizePlaceholder = placeholderSerializer.serialize;
|
package/dist/helper/index.d.ts
CHANGED
package/dist/helper/index.js
CHANGED
|
@@ -19,5 +19,4 @@ __exportStar(require("./parse-modules"), exports);
|
|
|
19
19
|
__exportStar(require("./read-config-file"), exports);
|
|
20
20
|
__exportStar(require("./update-snapshot"), exports);
|
|
21
21
|
__exportStar(require("./win"), exports);
|
|
22
|
-
__exportStar(require("./replace-paths"), exports);
|
|
23
22
|
__exportStar(require("./util/checkStats"), exports);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const char_1 = require("./expect/char");
|
|
4
3
|
const diff_1 = require("./expect/diff");
|
|
5
4
|
const error_1 = require("./expect/error");
|
|
6
5
|
const placeholder_1 = require("./expect/placeholder");
|
|
@@ -8,7 +7,6 @@ const rspack_1 = require("./expect/rspack");
|
|
|
8
7
|
const to_be_typeof_1 = require("./expect/to-be-typeof");
|
|
9
8
|
const to_end_with_1 = require("./expect/to-end-with");
|
|
10
9
|
const to_match_file_snapshot_1 = require("./expect/to-match-file-snapshot");
|
|
11
|
-
const { normalizePaths } = require("jest-serializer-path");
|
|
12
10
|
expect.extend({
|
|
13
11
|
// CHANGE: new test matcher for `rspack-test-tools`
|
|
14
12
|
// @ts-ignore
|
|
@@ -16,20 +14,12 @@ expect.extend({
|
|
|
16
14
|
toBeTypeOf: to_be_typeof_1.toBeTypeOf,
|
|
17
15
|
toEndWith: to_end_with_1.toEndWith
|
|
18
16
|
});
|
|
19
|
-
const pipes = [
|
|
20
|
-
char_1.normalizeSlash,
|
|
21
|
-
char_1.normalizeCLR,
|
|
22
|
-
char_1.normalizeCRLF,
|
|
23
|
-
placeholder_1.normalizePlaceholder,
|
|
24
|
-
normalizePaths
|
|
25
|
-
];
|
|
26
|
-
const serialize = (str, extra = []) => [...pipes, ...extra].reduce((res, transform) => transform(res), str);
|
|
27
17
|
expect.addSnapshotSerializer({
|
|
28
18
|
test(received) {
|
|
29
19
|
return typeof received === "string";
|
|
30
20
|
},
|
|
31
21
|
print(received) {
|
|
32
|
-
return
|
|
22
|
+
return (0, placeholder_1.normalizePlaceholder)(received.trim());
|
|
33
23
|
}
|
|
34
24
|
});
|
|
35
25
|
// for diff
|
package/dist/helper/win.d.ts
CHANGED
package/dist/helper/win.js
CHANGED
|
@@ -4,11 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.escapeSep = escapeSep;
|
|
7
|
-
exports.escapeEOL = escapeEOL;
|
|
8
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
8
|
function escapeSep(str) {
|
|
10
9
|
return str.split(node_path_1.default.win32.sep).join(node_path_1.default.posix.sep);
|
|
11
10
|
}
|
|
12
|
-
function escapeEOL(str) {
|
|
13
|
-
return str.split("\r\n").join("\n").trim();
|
|
14
|
-
}
|
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.DiagnosticProcessor = void 0;
|
|
7
7
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const
|
|
10
|
-
const replace_paths_1 = require("../helper/replace-paths");
|
|
9
|
+
const placeholder_1 = require("../helper/expect/placeholder");
|
|
11
10
|
const basic_1 = require("./basic");
|
|
12
11
|
class DiagnosticProcessor extends basic_1.BasicProcessor {
|
|
13
12
|
constructor(_diagnosticOptions) {
|
|
@@ -25,16 +24,16 @@ class DiagnosticProcessor extends basic_1.BasicProcessor {
|
|
|
25
24
|
throw new Error("Stats should exists");
|
|
26
25
|
}
|
|
27
26
|
(0, node_assert_1.default)(stats.hasErrors() || stats.hasWarnings());
|
|
28
|
-
let output = (0,
|
|
27
|
+
let output = (0, placeholder_1.normalizePlaceholder)(stats.toString({
|
|
29
28
|
all: false,
|
|
30
29
|
errors: true,
|
|
31
30
|
warnings: true
|
|
32
|
-
}));
|
|
31
|
+
})).replaceAll("\\", "/"); // stats has some win32 paths that path-serializer can not handle
|
|
33
32
|
if (typeof this._diagnosticOptions.format === "function") {
|
|
34
33
|
output = this._diagnosticOptions.format(output);
|
|
35
34
|
}
|
|
36
35
|
const errorOutputPath = node_path_1.default.resolve(context.getSource(this._diagnosticOptions.snapshot));
|
|
37
|
-
env.expect(
|
|
36
|
+
env.expect(output).toMatchFileSnapshot(errorOutputPath);
|
|
38
37
|
}
|
|
39
38
|
static defaultOptions(context) {
|
|
40
39
|
return {
|
package/dist/processor/hook.js
CHANGED
|
@@ -8,10 +8,9 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
8
8
|
const core_1 = require("@rspack/core");
|
|
9
9
|
const jest_snapshot_1 = require("jest-snapshot");
|
|
10
10
|
const pretty_format_1 = require("pretty-format");
|
|
11
|
+
const path_serializer_1 = require("path-serializer");
|
|
11
12
|
const context_1 = require("../test/context");
|
|
12
13
|
const snapshot_1 = require("./snapshot");
|
|
13
|
-
const pathSerializer = require("jest-serializer-path");
|
|
14
|
-
const normalizePaths = pathSerializer.normalizePaths;
|
|
15
14
|
const srcDir = node_path_1.default.resolve(__dirname, "../../tests/fixtures");
|
|
16
15
|
const distDir = node_path_1.default.resolve(__dirname, "../../tests/js/hook");
|
|
17
16
|
const sourceSerializer = {
|
|
@@ -30,20 +29,18 @@ const internalSerializer = {
|
|
|
30
29
|
return JSON.stringify(`${val.constructor.name}(internal ignored)`);
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
|
-
const testPathSerializer = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
};
|
|
32
|
+
const testPathSerializer = (0, path_serializer_1.createSnapshotSerializer)({
|
|
33
|
+
replace: [
|
|
34
|
+
{
|
|
35
|
+
match: srcDir,
|
|
36
|
+
mark: "<HOOK_SRC_DIR>"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
match: distDir,
|
|
40
|
+
mark: "<HOOK_DIST_DIR>"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
});
|
|
47
44
|
const escapeRegex = true;
|
|
48
45
|
const printFunctionName = false;
|
|
49
46
|
const normalizeNewlines = (str) => str.replace(/\r\n|\r/g, "\n");
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.HotSnapshotProcessor = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
const
|
|
9
|
+
const placeholder_1 = require("../helper/expect/placeholder");
|
|
10
|
+
const win_1 = require("../helper/win");
|
|
10
11
|
const hot_1 = require("./hot");
|
|
11
12
|
const NOOP_SET = new Set();
|
|
12
13
|
const escapeLocalName = (str) => str.split(/[-<>:"/|?*.]/).join("_");
|
|
@@ -110,7 +111,7 @@ class HotSnapshotProcessor extends hot_1.HotProcessor {
|
|
|
110
111
|
const title = `Case ${node_path_1.default.basename(this._options.name)}: Step ${step}`;
|
|
111
112
|
const hotUpdateFile = [];
|
|
112
113
|
const hotUpdateManifest = [];
|
|
113
|
-
const changedFiles = this.updateOptions.changedFiles.map((i) => (0,
|
|
114
|
+
const changedFiles = this.updateOptions.changedFiles.map((i) => (0, win_1.escapeSep)(node_path_1.default.relative(context.getSource(), i)));
|
|
114
115
|
changedFiles.sort();
|
|
115
116
|
const hashes = {
|
|
116
117
|
[lastHash || "LAST_HASH"]: "LAST_HASH",
|
|
@@ -134,7 +135,7 @@ class HotSnapshotProcessor extends hot_1.HotProcessor {
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
const replaceContent = (str) => {
|
|
137
|
-
return (0,
|
|
138
|
+
return (0, placeholder_1.normalizePlaceholder)(Object.entries(hashes)
|
|
138
139
|
.reduce((str, [raw, replacement]) => {
|
|
139
140
|
return str.split(raw).join(replacement);
|
|
140
141
|
}, str)
|
|
@@ -286,7 +287,7 @@ ${runtime.javascript.disposedModules.map(i => `- ${i}`).join("\n")}
|
|
|
286
287
|
: ""}
|
|
287
288
|
|
|
288
289
|
`.trim();
|
|
289
|
-
env.expect(
|
|
290
|
+
env.expect(content).toMatchFileSnapshot(snapshotPath);
|
|
290
291
|
}
|
|
291
292
|
}
|
|
292
293
|
exports.HotSnapshotProcessor = HotSnapshotProcessor;
|
|
@@ -8,4 +8,5 @@ export declare class SnapshotProcessor<T extends ECompilerType> extends BasicPro
|
|
|
8
8
|
protected _snapshotOptions: ISnapshotProcessorOptions<T>;
|
|
9
9
|
constructor(_snapshotOptions: ISnapshotProcessorOptions<T>);
|
|
10
10
|
check(env: ITestEnv, context: ITestContext): Promise<void>;
|
|
11
|
+
serializeEachFile(content: string): string;
|
|
11
12
|
}
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SnapshotProcessor = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const helper_1 = require("../helper");
|
|
9
8
|
const basic_1 = require("./basic");
|
|
10
9
|
class SnapshotProcessor extends basic_1.BasicProcessor {
|
|
11
10
|
constructor(_snapshotOptions) {
|
|
@@ -35,16 +34,18 @@ class SnapshotProcessor extends basic_1.BasicProcessor {
|
|
|
35
34
|
.filter(([file]) => snapshotFileFilter(file))
|
|
36
35
|
.map(([file, source]) => {
|
|
37
36
|
const tag = node_path_1.default.extname(file).slice(1) || "txt";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
.toString()}\n\`\`\``;
|
|
37
|
+
const content = this.serializeEachFile(source.source().toString());
|
|
38
|
+
return `\`\`\`${tag} title=${file}\n${content}\n\`\`\``;
|
|
41
39
|
});
|
|
42
40
|
fileContents.sort();
|
|
43
|
-
const content =
|
|
41
|
+
const content = fileContents.join("\n\n");
|
|
44
42
|
const snapshotPath = node_path_1.default.isAbsolute(this._snapshotOptions.snapshot)
|
|
45
43
|
? this._snapshotOptions.snapshot
|
|
46
44
|
: node_path_1.default.resolve(context.getSource(), `./__snapshots__/${this._snapshotOptions.snapshot}`);
|
|
47
45
|
env.expect(content).toMatchFileSnapshot(snapshotPath);
|
|
48
46
|
}
|
|
47
|
+
serializeEachFile(content) {
|
|
48
|
+
return content;
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
51
|
exports.SnapshotProcessor = SnapshotProcessor;
|
package/dist/processor/stats.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.StatsProcessor = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const
|
|
9
|
+
const placeholder_1 = require("../helper/expect/placeholder");
|
|
10
10
|
const captureStdio_1 = __importDefault(require("../helper/legacy/captureStdio"));
|
|
11
11
|
const multi_1 = require("./multi");
|
|
12
12
|
const REG_ERROR_CASE = /error$/;
|
|
@@ -51,7 +51,7 @@ class StatsProcessor extends multi_1.MultiTaskProcessor {
|
|
|
51
51
|
return callback(err);
|
|
52
52
|
if (!/\.(js|json|txt)$/.test(args[0]))
|
|
53
53
|
return callback(null, result);
|
|
54
|
-
callback(null, (0,
|
|
54
|
+
callback(null, (0, placeholder_1.normalizePlaceholder)(result.toString("utf-8")));
|
|
55
55
|
}
|
|
56
56
|
]));
|
|
57
57
|
};
|
|
@@ -6,4 +6,5 @@ export declare class TreeShakingProcessor<T extends ECompilerType> extends Snaps
|
|
|
6
6
|
protected _treeShakingOptions: ITreeShakingProcessorOptions<T>;
|
|
7
7
|
constructor(_treeShakingOptions: ITreeShakingProcessorOptions<T>);
|
|
8
8
|
static overrideOptions<T extends ECompilerType>(context: ITestContext, options: TCompilerOptions<T>): void;
|
|
9
|
+
serializeEachFile(content: string): string;
|
|
9
10
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TreeShakingProcessor = void 0;
|
|
4
|
+
const placeholder_1 = require("../helper/expect/placeholder");
|
|
4
5
|
const builtin_1 = require("./builtin");
|
|
5
6
|
const snapshot_1 = require("./snapshot");
|
|
6
7
|
class TreeShakingProcessor extends snapshot_1.SnapshotProcessor {
|
|
@@ -20,5 +21,8 @@ class TreeShakingProcessor extends snapshot_1.SnapshotProcessor {
|
|
|
20
21
|
options.optimization.innerGraph = true;
|
|
21
22
|
options.optimization.usedExports = true;
|
|
22
23
|
}
|
|
24
|
+
serializeEachFile(content) {
|
|
25
|
+
return (0, placeholder_1.normalizePlaceholder)(content);
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
exports.TreeShakingProcessor = TreeShakingProcessor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/test-tools",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Test tools for rspack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"@babel/template": "7.22.15",
|
|
38
38
|
"@babel/traverse": "7.23.2",
|
|
39
39
|
"@babel/types": "7.23.0",
|
|
40
|
+
"cross-env": "^7.0.3",
|
|
40
41
|
"csv-to-markdown-table": "^1.3.0",
|
|
41
42
|
"deepmerge": "^4.3.1",
|
|
42
43
|
"filenamify": "4.3.0",
|
|
43
44
|
"fs-extra": "^11.2.0",
|
|
44
45
|
"glob": "^10.3.10",
|
|
45
46
|
"jest-diff": "^29.7.0",
|
|
46
|
-
"jest-serializer-path": "^0.1.15",
|
|
47
47
|
"jest-snapshot": "29.7.0",
|
|
48
48
|
"jsdom": "^25.0.0",
|
|
49
49
|
"memfs": "4.14.0",
|
|
50
50
|
"mkdirp": "0.5.6",
|
|
51
|
-
"path-serializer": "0.
|
|
51
|
+
"path-serializer": "0.3.4",
|
|
52
52
|
"pretty-format": "29.7.0",
|
|
53
53
|
"rimraf": "3.0.2",
|
|
54
54
|
"webpack": "^5.94.0",
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
"typescript": "^5.6.3",
|
|
103
103
|
"wast-loader": "^1.12.1",
|
|
104
104
|
"worker-rspack-loader": "^3.1.2",
|
|
105
|
-
"@rspack/cli": "1.1.
|
|
106
|
-
"@rspack/core": "1.1.
|
|
105
|
+
"@rspack/cli": "1.1.8",
|
|
106
|
+
"@rspack/core": "1.1.8"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
109
|
"@rspack/core": ">=1.0.0"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeSlash = exports.normalizeColor = exports.normalizeCLR = exports.normalizeCRLF = void 0;
|
|
4
|
-
const normalizeCRLF = (str) => {
|
|
5
|
-
return str.replace(/\r\n?/g, "\n");
|
|
6
|
-
};
|
|
7
|
-
exports.normalizeCRLF = normalizeCRLF;
|
|
8
|
-
const normalizeCLR = (str) => {
|
|
9
|
-
return (str
|
|
10
|
-
.replace(/\u001b\[1m\u001b\[([0-9;]*)m/g, "<CLR=$1,BOLD>")
|
|
11
|
-
.replace(/\u001b\[1m/g, "<CLR=BOLD>")
|
|
12
|
-
.replace(/\u001b\[39m\u001b\[22m/g, "</CLR>")
|
|
13
|
-
.replace(/\u001b\[([0-9;]*)m/g, "<CLR=$1>")
|
|
14
|
-
// CHANGE: The time unit display in Rspack is second
|
|
15
|
-
.replace(/[.0-9]+(<\/CLR>)?(\s?s)/g, "X$1$2"));
|
|
16
|
-
};
|
|
17
|
-
exports.normalizeCLR = normalizeCLR;
|
|
18
|
-
const normalizeColor = (str) => {
|
|
19
|
-
return str.replace(/\u001b\[[0-9;]*m/g, "");
|
|
20
|
-
};
|
|
21
|
-
exports.normalizeColor = normalizeColor;
|
|
22
|
-
const normalizeSlash = (str) => {
|
|
23
|
-
return str.replace(/(\\)+/g, "/");
|
|
24
|
-
};
|
|
25
|
-
exports.normalizeSlash = normalizeSlash;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function replacePaths(input: string): any;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.replacePaths = replacePaths;
|
|
7
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const serializer = require("jest-serializer-path");
|
|
10
|
-
const normalizePaths = serializer.normalizePaths;
|
|
11
|
-
const rspackPath = node_path_1.default.resolve(__dirname, "../../../rspack");
|
|
12
|
-
function replacePaths(input) {
|
|
13
|
-
const paths = input.split("\\\\").join("\\");
|
|
14
|
-
const rspackRoot = normalizePaths(rspackPath);
|
|
15
|
-
if (node_os_1.default.platform() === "win32") {
|
|
16
|
-
const winRspackRoot = rspackRoot.split("\\\\").join(node_path_1.default.win32.sep);
|
|
17
|
-
return normalizePaths(paths)
|
|
18
|
-
.split(rspackRoot)
|
|
19
|
-
.join("<RSPACK_ROOT>")
|
|
20
|
-
.split(winRspackRoot)
|
|
21
|
-
.join("<RSPACK_ROOT>");
|
|
22
|
-
}
|
|
23
|
-
return normalizePaths(paths).split(rspackRoot).join("<RSPACK_ROOT>");
|
|
24
|
-
}
|