@rspack-canary/test-tools 1.6.0-canary-6cd722f4-20251022123039 → 1.6.0-canary-4ad8b49f-20251023175711
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/case/builtin.d.ts +3 -2
- package/dist/case/builtin.js +1 -1
- package/dist/case/cache.d.ts +2 -2
- package/dist/case/cache.js +9 -6
- package/dist/case/common.d.ts +10 -10
- package/dist/case/common.js +33 -30
- package/dist/case/compiler.d.ts +9 -8
- package/dist/case/compiler.js +5 -6
- package/dist/case/config.d.ts +6 -5
- package/dist/case/defaults.d.ts +5 -4
- package/dist/case/defaults.js +10 -10
- package/dist/case/diagnostic.js +4 -5
- package/dist/case/error.d.ts +5 -5
- package/dist/case/error.js +7 -8
- package/dist/case/example.js +2 -2
- package/dist/case/hash.d.ts +2 -2
- package/dist/case/hash.js +1 -1
- package/dist/case/hook.d.ts +4 -3
- package/dist/case/hook.js +3 -2
- package/dist/case/hot-step.d.ts +2 -2
- package/dist/case/hot-step.js +4 -6
- package/dist/case/hot.d.ts +5 -4
- package/dist/case/hot.js +6 -6
- package/dist/case/incremental.d.ts +2 -2
- package/dist/case/index.d.ts +0 -1
- package/dist/case/index.js +1 -3
- package/dist/case/multi-compiler.d.ts +9 -8
- package/dist/case/multi-compiler.js +3 -4
- package/dist/case/normal.js +1 -1
- package/dist/case/runner.d.ts +5 -4
- package/dist/case/runner.js +12 -8
- package/dist/case/serial.d.ts +2 -2
- package/dist/case/stats-api.d.ts +6 -5
- package/dist/case/stats-api.js +5 -7
- package/dist/case/stats-output.d.ts +3 -2
- package/dist/case/stats-output.js +1 -1
- package/dist/case/treeshaking.js +1 -1
- package/dist/case/watch.d.ts +6 -6
- package/dist/case/watch.js +15 -14
- package/dist/compiler.d.ts +16 -17
- package/dist/compiler.js +116 -16
- package/dist/helper/index.d.ts +1 -0
- package/dist/helper/index.js +1 -0
- package/dist/helper/legacy/checkArrayExpectation.js +1 -1
- package/dist/helper/read-config-file.d.ts +3 -2
- package/dist/helper/read-config-file.js +7 -0
- package/dist/helper/setup-env.js +1 -0
- package/dist/helper/stringify-config.d.ts +2 -0
- package/dist/helper/stringify-config.js +43 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/plugin/index.d.ts +0 -3
- package/dist/plugin/index.js +0 -3
- package/dist/runner/node/index.d.ts +13 -8
- package/dist/runner/node/index.js +86 -7
- package/dist/runner/web/index.d.ts +6 -5
- package/dist/runner/web/index.js +38 -50
- package/dist/test/context.d.ts +15 -16
- package/dist/test/context.js +44 -59
- package/dist/test/creator.d.ts +14 -14
- package/dist/test/creator.js +4 -5
- package/dist/test/debug.d.ts +15 -0
- package/dist/test/debug.js +205 -0
- package/dist/test/tester.js +13 -4
- package/dist/type.d.ts +37 -50
- package/dist/type.js +1 -6
- package/package.json +5 -9
- package/dist/case/diff.d.ts +0 -19
- package/dist/case/diff.js +0 -274
- package/dist/compare/comparator.d.ts +0 -17
- package/dist/compare/comparator.js +0 -52
- package/dist/compare/compare.d.ts +0 -17
- package/dist/compare/compare.js +0 -178
- package/dist/compare/format-code.d.ts +0 -16
- package/dist/compare/format-code.js +0 -244
- package/dist/compare/index.d.ts +0 -5
- package/dist/compare/index.js +0 -21
- package/dist/compare/replace-module-argument.d.ts +0 -1
- package/dist/compare/replace-module-argument.js +0 -8
- package/dist/compare/replace-runtime-module-name.d.ts +0 -1
- package/dist/compare/replace-runtime-module-name.js +0 -71
- package/dist/plugin/rspack-diff-config-plugin.d.ts +0 -7
- package/dist/plugin/rspack-diff-config-plugin.js +0 -42
- package/dist/plugin/webpack-diff-config-plugin.d.ts +0 -7
- package/dist/plugin/webpack-diff-config-plugin.js +0 -41
- package/dist/plugin/webpack-module-placeholder-plugin.d.ts +0 -3
- package/dist/plugin/webpack-module-placeholder-plugin.js +0 -106
- package/template/diff.bundle.css +0 -1
- package/template/diff.bundle.js +0 -144
- package/template/diff.html +0 -14
- package/template/editor.worker.js +0 -1
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebpackModulePlaceholderPlugin = void 0;
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
const { ConcatSource, RawSource, CachedSource, PrefixSource } = require("webpack-sources");
|
|
6
|
-
function createRenderRuntimeModulesFn(Template) {
|
|
7
|
-
return function renderRuntimeModules(runtimeModules, renderContext) {
|
|
8
|
-
const source = new ConcatSource();
|
|
9
|
-
for (const module of runtimeModules) {
|
|
10
|
-
const codeGenerationResults = renderContext.codeGenerationResults;
|
|
11
|
-
let runtimeSource;
|
|
12
|
-
if (codeGenerationResults) {
|
|
13
|
-
runtimeSource = codeGenerationResults.getSource(module, renderContext.chunk.runtime, "runtime");
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
const codeGenResult = module.codeGeneration({
|
|
17
|
-
chunkGraph: renderContext.chunkGraph,
|
|
18
|
-
dependencyTemplates: renderContext.dependencyTemplates,
|
|
19
|
-
moduleGraph: renderContext.moduleGraph,
|
|
20
|
-
runtimeTemplate: renderContext.runtimeTemplate,
|
|
21
|
-
runtime: renderContext.chunk.runtime,
|
|
22
|
-
codeGenerationResults
|
|
23
|
-
});
|
|
24
|
-
if (!codeGenResult)
|
|
25
|
-
continue;
|
|
26
|
-
runtimeSource = codeGenResult.sources.get("runtime");
|
|
27
|
-
}
|
|
28
|
-
if (runtimeSource) {
|
|
29
|
-
const identifier = module.identifier();
|
|
30
|
-
source.add(`${Template.toNormalComment(`start::${identifier}`)}\n`);
|
|
31
|
-
if (!module.shouldIsolate()) {
|
|
32
|
-
source.add(runtimeSource);
|
|
33
|
-
source.add("\n\n");
|
|
34
|
-
}
|
|
35
|
-
else if (renderContext.runtimeTemplate.supportsArrowFunction()) {
|
|
36
|
-
source.add("(() => {\n");
|
|
37
|
-
source.add(new PrefixSource("\t", runtimeSource));
|
|
38
|
-
source.add("\n})();\n\n");
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
source.add("!function() {\n");
|
|
42
|
-
source.add(new PrefixSource("\t", runtimeSource));
|
|
43
|
-
source.add("\n}();\n\n");
|
|
44
|
-
}
|
|
45
|
-
source.add(`${Template.toNormalComment(`end::${identifier}`)}\n`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return source;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const caches = new WeakMap();
|
|
52
|
-
class WebpackModulePlaceholderPlugin {
|
|
53
|
-
apply(compiler) {
|
|
54
|
-
const { webpack } = compiler;
|
|
55
|
-
const { Template, javascript: { JavascriptModulesPlugin } } = webpack;
|
|
56
|
-
Template.renderRuntimeModules = createRenderRuntimeModulesFn(Template);
|
|
57
|
-
compiler.hooks.compilation.tap("RuntimeDiffPlugin", compilation => {
|
|
58
|
-
const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
59
|
-
hooks.inlineInRuntimeBailout.tap("RuntimeDiffPlugin", () => "not allow inline startup");
|
|
60
|
-
hooks.renderModulePackage.tap("RuntimeDiffPlugin", (moduleSource, module) => {
|
|
61
|
-
let cacheEntry;
|
|
62
|
-
let cache = caches.get(compilation);
|
|
63
|
-
if (cache === undefined) {
|
|
64
|
-
caches.set(compilation, (cache = new WeakMap()));
|
|
65
|
-
cache.set(module, (cacheEntry = {
|
|
66
|
-
header: undefined,
|
|
67
|
-
footer: undefined,
|
|
68
|
-
full: new WeakMap()
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
cacheEntry = cache.get(module);
|
|
73
|
-
if (cacheEntry === undefined) {
|
|
74
|
-
cache.set(module, (cacheEntry = {
|
|
75
|
-
header: undefined,
|
|
76
|
-
footer: undefined,
|
|
77
|
-
full: new WeakMap()
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
const cachedSource = cacheEntry.full.get(moduleSource);
|
|
82
|
-
if (cachedSource !== undefined)
|
|
83
|
-
return cachedSource;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const source = new ConcatSource();
|
|
87
|
-
let header = cacheEntry.header;
|
|
88
|
-
let footer = cacheEntry.footer;
|
|
89
|
-
if (header === undefined) {
|
|
90
|
-
const identifier = module.identifier();
|
|
91
|
-
header = new RawSource(`\n${Template.toNormalComment(`start::${identifier}`)}\n`);
|
|
92
|
-
footer = new RawSource(`\n${Template.toNormalComment(`end::${identifier}`)}\n`);
|
|
93
|
-
cacheEntry.header = header;
|
|
94
|
-
cacheEntry.footer = footer;
|
|
95
|
-
}
|
|
96
|
-
source.add(header);
|
|
97
|
-
source.add(moduleSource);
|
|
98
|
-
source.add(footer);
|
|
99
|
-
const cachedSource = new CachedSource(source);
|
|
100
|
-
cacheEntry.full.set(moduleSource, cachedSource);
|
|
101
|
-
return cachedSource;
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.WebpackModulePlaceholderPlugin = WebpackModulePlaceholderPlugin;
|