@rspack-debug/test-tools 1.7.3 → 2.0.0-canary.20260120
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.js +4 -7
- package/dist/case/cache.js +20 -11
- package/dist/case/common.js +10 -0
- package/dist/case/compiler.js +5 -0
- package/dist/case/config.d.ts +1 -0
- package/dist/case/config.js +22 -17
- package/dist/case/defaults.js +1 -2
- package/dist/case/diagnostic.js +11 -7
- package/dist/case/error.js +10 -5
- package/dist/case/esm-output.js +12 -6
- package/dist/case/hash.js +11 -7
- package/dist/case/hook.js +12 -8
- package/dist/case/hot-step.js +1 -1
- package/dist/case/hot.js +19 -7
- package/dist/case/normal.js +8 -6
- package/dist/case/runner.js +6 -0
- package/dist/case/stats-api.js +9 -5
- package/dist/case/stats-output.js +23 -14
- package/dist/case/watch.js +26 -10
- package/dist/helper/expect/placeholder.js +4 -0
- package/dist/runner/node/index.js +3 -2
- package/package.json +2 -2
package/dist/case/builtin.js
CHANGED
|
@@ -63,7 +63,7 @@ function defaultOptions(context) {
|
|
|
63
63
|
cssChunkFilename: '[name].css',
|
|
64
64
|
assetModuleFilename: '[hash][ext][query]',
|
|
65
65
|
sourceMapFilename: '[file].map',
|
|
66
|
-
chunkLoadingGlobal: '
|
|
66
|
+
chunkLoadingGlobal: 'rspackChunk',
|
|
67
67
|
chunkLoading: 'jsonp',
|
|
68
68
|
uniqueName: '__rspack_test__',
|
|
69
69
|
enabledLibraryTypes: ['system'],
|
|
@@ -78,6 +78,9 @@ function defaultOptions(context) {
|
|
|
78
78
|
webassemblyModuleFilename: '[hash].module.wasm',
|
|
79
79
|
workerChunkLoading: 'import-scripts',
|
|
80
80
|
workerWasmLoading: 'fetch',
|
|
81
|
+
bundlerInfo: {
|
|
82
|
+
force: false,
|
|
83
|
+
},
|
|
81
84
|
},
|
|
82
85
|
module: {
|
|
83
86
|
rules: [
|
|
@@ -144,13 +147,7 @@ function defaultOptions(context) {
|
|
|
144
147
|
extensions: ['.js'],
|
|
145
148
|
},
|
|
146
149
|
experiments: {
|
|
147
|
-
css: true,
|
|
148
150
|
futureDefaults: true,
|
|
149
|
-
rspackFuture: {
|
|
150
|
-
bundlerInfo: {
|
|
151
|
-
force: false,
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
151
|
},
|
|
155
152
|
devtool: false,
|
|
156
153
|
context: context.getSource(),
|
package/dist/case/cache.js
CHANGED
|
@@ -84,20 +84,15 @@ async function generateOptions(context, temp, target, updatePlugin) {
|
|
|
84
84
|
chunkFilename: '[name].chunk.[fullhash].js',
|
|
85
85
|
publicPath: 'https://test.cases/path/',
|
|
86
86
|
library: { type: 'commonjs2' },
|
|
87
|
+
bundlerInfo: {
|
|
88
|
+
force: false,
|
|
89
|
+
},
|
|
87
90
|
},
|
|
88
91
|
optimization: {
|
|
89
92
|
moduleIds: 'named',
|
|
90
93
|
emitOnErrors: true,
|
|
91
94
|
},
|
|
92
95
|
target,
|
|
93
|
-
experiments: {
|
|
94
|
-
css: true,
|
|
95
|
-
rspackFuture: {
|
|
96
|
-
bundlerInfo: {
|
|
97
|
-
force: false,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
96
|
};
|
|
102
97
|
options.plugins ??= [];
|
|
103
98
|
options.plugins.push(new core_1.default.HotModuleReplacementPlugin());
|
|
@@ -196,7 +191,13 @@ function createRunner(context, name, file, env) {
|
|
|
196
191
|
await updatePlugin.goNext();
|
|
197
192
|
const stats = await compiler.build();
|
|
198
193
|
const jsonStats = stats.toJson({
|
|
199
|
-
|
|
194
|
+
assets: true,
|
|
195
|
+
chunks: true,
|
|
196
|
+
chunkModules: true,
|
|
197
|
+
modules: true,
|
|
198
|
+
entrypoints: true,
|
|
199
|
+
chunkGroups: true,
|
|
200
|
+
// errorDetails: true
|
|
200
201
|
});
|
|
201
202
|
await checkStats(jsonStats);
|
|
202
203
|
const updatedModules = await m.hot.check(options || true);
|
|
@@ -212,7 +213,11 @@ function createRunner(context, name, file, env) {
|
|
|
212
213
|
compiler.createCompiler();
|
|
213
214
|
const stats = await compiler.build();
|
|
214
215
|
const jsonStats = stats.toJson({
|
|
215
|
-
|
|
216
|
+
assets: true,
|
|
217
|
+
chunks: true,
|
|
218
|
+
entrypoints: true,
|
|
219
|
+
chunkGroups: true,
|
|
220
|
+
// errorDetails: true
|
|
216
221
|
});
|
|
217
222
|
await checkStats(jsonStats);
|
|
218
223
|
env.it(`NEXT_START run with compilerIndex==${compilerIndex}`, async () => {
|
|
@@ -230,7 +235,11 @@ function createRunner(context, name, file, env) {
|
|
|
230
235
|
compiler.createCompiler();
|
|
231
236
|
const stats = await compiler.build();
|
|
232
237
|
const jsonStats = stats.toJson({
|
|
233
|
-
|
|
238
|
+
assets: true,
|
|
239
|
+
chunks: true,
|
|
240
|
+
entrypoints: true,
|
|
241
|
+
chunkGroups: true,
|
|
242
|
+
// errorDetails: true
|
|
234
243
|
});
|
|
235
244
|
await checkStats(jsonStats);
|
|
236
245
|
env.it(`NEXT_MOVE_DIR_START run with compilerIndex==${compilerIndex}`, async () => {
|
package/dist/case/common.js
CHANGED
|
@@ -104,6 +104,10 @@ async function check(env, context, name) {
|
|
|
104
104
|
}
|
|
105
105
|
if (testConfig.writeStatsJson) {
|
|
106
106
|
const jsonStats = stats.toJson({
|
|
107
|
+
assets: true,
|
|
108
|
+
chunks: true,
|
|
109
|
+
entrypoints: true,
|
|
110
|
+
chunkGroups: true,
|
|
107
111
|
errorDetails: true,
|
|
108
112
|
});
|
|
109
113
|
fs_extra_1.default.writeFileSync(path_1.default.join(context.getDist(), 'stats.json'), JSON.stringify(jsonStats, null, 2), 'utf-8');
|
|
@@ -113,6 +117,12 @@ async function check(env, context, name) {
|
|
|
113
117
|
stats.hasErrors() ||
|
|
114
118
|
stats.hasWarnings()) {
|
|
115
119
|
const statsJson = stats.toJson({
|
|
120
|
+
assets: true,
|
|
121
|
+
chunks: true,
|
|
122
|
+
chunkModules: true,
|
|
123
|
+
modules: true,
|
|
124
|
+
entrypoints: true,
|
|
125
|
+
chunkGroups: true,
|
|
116
126
|
errorDetails: true,
|
|
117
127
|
});
|
|
118
128
|
if (statsJson.errors) {
|
package/dist/case/compiler.js
CHANGED
|
@@ -95,7 +95,12 @@ function createCompilerProcessor(name, caseConfig) {
|
|
|
95
95
|
expect(typeof stats).toBe('object');
|
|
96
96
|
const compilation = stats.compilation;
|
|
97
97
|
const statsJson = stats.toJson({
|
|
98
|
+
assets: true,
|
|
99
|
+
chunks: true,
|
|
100
|
+
chunkModules: true,
|
|
98
101
|
modules: true,
|
|
102
|
+
entrypoints: true,
|
|
103
|
+
chunkGroups: true,
|
|
99
104
|
reasons: true,
|
|
100
105
|
});
|
|
101
106
|
expect(typeof statsJson).toBe('object');
|
package/dist/case/config.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export type TConfigCaseConfig = Omit<TTestConfig, 'validate'>;
|
|
|
4
4
|
export declare function createConfigProcessor(name: string): ITestProcessor;
|
|
5
5
|
export declare function createConfigCase(name: string, src: string, dist: string): void;
|
|
6
6
|
export declare function defaultOptions(index: number, context: ITestContext): RspackOptions;
|
|
7
|
+
export declare function enableEsmLibraryPlugin(options: RspackOptions): boolean;
|
|
7
8
|
export declare function overrideOptions(index: number, context: ITestContext, options: RspackOptions): void;
|
|
8
9
|
export declare function findBundle(index: number, context: ITestContext, options: RspackOptions): string | string[];
|
package/dist/case/config.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createConfigProcessor = createConfigProcessor;
|
|
7
7
|
exports.createConfigCase = createConfigCase;
|
|
8
8
|
exports.defaultOptions = defaultOptions;
|
|
9
|
+
exports.enableEsmLibraryPlugin = enableEsmLibraryPlugin;
|
|
9
10
|
exports.overrideOptions = overrideOptions;
|
|
10
11
|
exports.findBundle = findBundle;
|
|
11
12
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -69,20 +70,20 @@ function defaultOptions(index, context) {
|
|
|
69
70
|
cache: false,
|
|
70
71
|
output: {
|
|
71
72
|
path: context.getDist(),
|
|
73
|
+
bundlerInfo: {
|
|
74
|
+
force: false,
|
|
75
|
+
},
|
|
72
76
|
},
|
|
73
77
|
optimization: {
|
|
74
78
|
minimize: false,
|
|
75
79
|
},
|
|
76
|
-
experiments: {
|
|
77
|
-
css: true,
|
|
78
|
-
rspackFuture: {
|
|
79
|
-
bundlerInfo: {
|
|
80
|
-
force: false,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
80
|
};
|
|
85
81
|
}
|
|
82
|
+
function enableEsmLibraryPlugin(options) {
|
|
83
|
+
return (options.output?.library === 'modern-module' ||
|
|
84
|
+
(typeof options.output?.library === 'object' &&
|
|
85
|
+
(options.output?.library).type === 'modern-module'));
|
|
86
|
+
}
|
|
86
87
|
function overrideOptions(index, context, options) {
|
|
87
88
|
if (!options.entry) {
|
|
88
89
|
options.entry = './index.js';
|
|
@@ -91,9 +92,15 @@ function overrideOptions(index, context, options) {
|
|
|
91
92
|
options.amd = {};
|
|
92
93
|
}
|
|
93
94
|
if (!options.output?.filename) {
|
|
94
|
-
const
|
|
95
|
+
const runtimeChunkForModernModule = options.optimization?.runtimeChunk === undefined &&
|
|
96
|
+
enableEsmLibraryPlugin(options);
|
|
97
|
+
const outputModule = options.experiments?.outputModule || enableEsmLibraryPlugin(options);
|
|
95
98
|
options.output ??= {};
|
|
96
|
-
options.output.filename = `bundle${index}${outputModule ? '.mjs' : '.js'}`;
|
|
99
|
+
options.output.filename = `${runtimeChunkForModernModule ? `[name]${outputModule ? '.mjs' : '.js'}` : `bundle${index}${outputModule ? '.mjs' : '.js'}`}`;
|
|
100
|
+
}
|
|
101
|
+
if (enableEsmLibraryPlugin(options)) {
|
|
102
|
+
options.optimization ??= {};
|
|
103
|
+
options.optimization.runtimeChunk ??= { name: `runtime~${index}` };
|
|
97
104
|
}
|
|
98
105
|
if (options.cache === undefined)
|
|
99
106
|
options.cache = false;
|
|
@@ -112,13 +119,11 @@ function findBundle(index, context, options) {
|
|
|
112
119
|
const bundlePath = [];
|
|
113
120
|
if (options.output?.path &&
|
|
114
121
|
fs_extra_1.default.existsSync(path_1.default.join(options.output.path, `bundle${index}${ext}`))) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
bundlePath.push(path_1.default.relative(options.output.path, cssOutputPath));
|
|
121
|
-
}
|
|
122
|
+
const cssOutputPath = path_1.default.join(options.output.path, (typeof options.output?.cssFilename === 'string' &&
|
|
123
|
+
options.output?.cssFilename) ||
|
|
124
|
+
`bundle${index}.css`);
|
|
125
|
+
if (fs_extra_1.default.existsSync(cssOutputPath)) {
|
|
126
|
+
bundlePath.push(path_1.default.relative(options.output.path, cssOutputPath));
|
|
122
127
|
}
|
|
123
128
|
bundlePath.push(`./bundle${index}${ext}`);
|
|
124
129
|
}
|
package/dist/case/defaults.js
CHANGED
|
@@ -40,8 +40,7 @@ function getRspackDefaultConfig(cwd, config) {
|
|
|
40
40
|
const normalizedConfig = getNormalizedWebpackOptions(config);
|
|
41
41
|
applyWebpackOptionsDefaults(normalizedConfig);
|
|
42
42
|
// make snapshot stable
|
|
43
|
-
normalizedConfig.
|
|
44
|
-
'$version$';
|
|
43
|
+
normalizedConfig.output.bundlerInfo.version = '$version$';
|
|
45
44
|
process.chdir(CURRENT_CWD);
|
|
46
45
|
return normalizedConfig;
|
|
47
46
|
}
|
package/dist/case/diagnostic.js
CHANGED
|
@@ -66,6 +66,15 @@ function defaultOptions(context) {
|
|
|
66
66
|
entry: {
|
|
67
67
|
main: './',
|
|
68
68
|
},
|
|
69
|
+
module: {
|
|
70
|
+
defaultRules: [
|
|
71
|
+
'...',
|
|
72
|
+
{
|
|
73
|
+
test: /\.css/,
|
|
74
|
+
type: 'css/auto',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
69
78
|
mode: 'development',
|
|
70
79
|
devServer: {
|
|
71
80
|
hot: false,
|
|
@@ -75,13 +84,8 @@ function defaultOptions(context) {
|
|
|
75
84
|
},
|
|
76
85
|
output: {
|
|
77
86
|
path: context.getDist(),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
css: true,
|
|
81
|
-
rspackFuture: {
|
|
82
|
-
bundlerInfo: {
|
|
83
|
-
force: false,
|
|
84
|
-
},
|
|
87
|
+
bundlerInfo: {
|
|
88
|
+
force: false,
|
|
85
89
|
},
|
|
86
90
|
},
|
|
87
91
|
};
|
package/dist/case/error.js
CHANGED
|
@@ -78,12 +78,17 @@ function options(context, custom) {
|
|
|
78
78
|
moduleIds: 'named',
|
|
79
79
|
chunkIds: 'named',
|
|
80
80
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
module: {
|
|
82
|
+
defaultRules: [
|
|
83
|
+
{
|
|
84
|
+
test: /\.css$/i,
|
|
85
|
+
type: 'css/auto',
|
|
86
86
|
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
otuput: {
|
|
90
|
+
bundlerInfo: {
|
|
91
|
+
force: false,
|
|
87
92
|
},
|
|
88
93
|
},
|
|
89
94
|
};
|
package/dist/case/esm-output.js
CHANGED
|
@@ -93,6 +93,18 @@ const defaultOptions = (_index, context) => ({
|
|
|
93
93
|
filename: '[name].mjs',
|
|
94
94
|
pathinfo: true,
|
|
95
95
|
module: true,
|
|
96
|
+
bundlerInfo: {
|
|
97
|
+
force: false,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
module: {
|
|
101
|
+
defaultRules: [
|
|
102
|
+
'...',
|
|
103
|
+
{
|
|
104
|
+
test: /\.css$/i,
|
|
105
|
+
type: 'css/auto',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
96
108
|
},
|
|
97
109
|
bail: true,
|
|
98
110
|
optimization: {
|
|
@@ -107,12 +119,6 @@ const defaultOptions = (_index, context) => ({
|
|
|
107
119
|
},
|
|
108
120
|
plugins: [new core_1.default.experiments.EsmLibraryPlugin()],
|
|
109
121
|
experiments: {
|
|
110
|
-
css: true,
|
|
111
|
-
rspackFuture: {
|
|
112
|
-
bundlerInfo: {
|
|
113
|
-
force: false,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
122
|
outputModule: true,
|
|
117
123
|
},
|
|
118
124
|
});
|
package/dist/case/hash.js
CHANGED
|
@@ -43,15 +43,19 @@ function createHashCase(name, src, dist) {
|
|
|
43
43
|
function defaultOptions(index, context) {
|
|
44
44
|
return {
|
|
45
45
|
context: context.getSource(),
|
|
46
|
+
module: {
|
|
47
|
+
defaultRules: [
|
|
48
|
+
'...',
|
|
49
|
+
{
|
|
50
|
+
test: /\.css$/i,
|
|
51
|
+
type: 'css/auto',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
46
55
|
output: {
|
|
47
56
|
path: context.getDist(),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
css: true,
|
|
51
|
-
rspackFuture: {
|
|
52
|
-
bundlerInfo: {
|
|
53
|
-
force: false,
|
|
54
|
-
},
|
|
57
|
+
bundlerInfo: {
|
|
58
|
+
force: false,
|
|
55
59
|
},
|
|
56
60
|
},
|
|
57
61
|
};
|
package/dist/case/hook.js
CHANGED
|
@@ -203,18 +203,22 @@ function defaultOptions(context, custom) {
|
|
|
203
203
|
entry: './hook',
|
|
204
204
|
output: {
|
|
205
205
|
path: context.getDist(),
|
|
206
|
+
bundlerInfo: {
|
|
207
|
+
force: false,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
module: {
|
|
211
|
+
defaultRules: [
|
|
212
|
+
'...',
|
|
213
|
+
{
|
|
214
|
+
test: /\.css$/i,
|
|
215
|
+
type: 'css/auto',
|
|
216
|
+
},
|
|
217
|
+
],
|
|
206
218
|
},
|
|
207
219
|
optimization: {
|
|
208
220
|
minimize: false,
|
|
209
221
|
},
|
|
210
|
-
experiments: {
|
|
211
|
-
css: true,
|
|
212
|
-
rspackFuture: {
|
|
213
|
-
bundlerInfo: {
|
|
214
|
-
force: false,
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
222
|
};
|
|
219
223
|
if (custom) {
|
|
220
224
|
defaultOptions = (0, webpack_merge_1.default)(defaultOptions, custom(context));
|
package/dist/case/hot-step.js
CHANGED
|
@@ -17,7 +17,7 @@ const SELF_HANDLER = (file, options) => {
|
|
|
17
17
|
const hotUpdateGlobal = (_, modules) => {
|
|
18
18
|
res = Object.keys(modules);
|
|
19
19
|
};
|
|
20
|
-
const hotUpdateGlobalKey = escapeLocalName(`${options.output?.hotUpdateGlobal || '
|
|
20
|
+
const hotUpdateGlobalKey = escapeLocalName(`${options.output?.hotUpdateGlobal || 'rspackHotUpdate'}${options.output?.uniqueName || ''}`);
|
|
21
21
|
global.self ??= {};
|
|
22
22
|
global.self[hotUpdateGlobalKey] = hotUpdateGlobal;
|
|
23
23
|
require(file);
|
package/dist/case/hot.js
CHANGED
|
@@ -97,20 +97,26 @@ function defaultOptions(context, target) {
|
|
|
97
97
|
chunkFilename: '[name].chunk.[fullhash].js',
|
|
98
98
|
publicPath: 'https://test.cases/path/',
|
|
99
99
|
library: { type: 'commonjs2' },
|
|
100
|
+
bundlerInfo: {
|
|
101
|
+
force: false,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
module: {
|
|
105
|
+
defaultRules: [
|
|
106
|
+
'...',
|
|
107
|
+
{
|
|
108
|
+
test: /\.css$/i,
|
|
109
|
+
type: 'css/auto',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
100
112
|
},
|
|
101
113
|
optimization: {
|
|
102
114
|
moduleIds: 'named',
|
|
103
115
|
},
|
|
104
116
|
target,
|
|
105
117
|
experiments: {
|
|
106
|
-
css: true,
|
|
107
118
|
// test incremental: "safe" here, we test default incremental in Incremental-*.test.js
|
|
108
119
|
incremental: 'safe',
|
|
109
|
-
rspackFuture: {
|
|
110
|
-
bundlerInfo: {
|
|
111
|
-
force: false,
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
120
|
},
|
|
115
121
|
};
|
|
116
122
|
options.plugins ??= [];
|
|
@@ -183,7 +189,13 @@ function createHotRunner(context, name, file, env) {
|
|
|
183
189
|
throw new Error('Should generate stats during build');
|
|
184
190
|
}
|
|
185
191
|
const jsonStats = stats.toJson({
|
|
186
|
-
|
|
192
|
+
assets: true,
|
|
193
|
+
chunks: true,
|
|
194
|
+
chunkModules: true,
|
|
195
|
+
modules: true,
|
|
196
|
+
entrypoints: true,
|
|
197
|
+
chunkGroups: true,
|
|
198
|
+
// errorDetails: true
|
|
187
199
|
});
|
|
188
200
|
const compilerOptions = compiler.getOptions();
|
|
189
201
|
const checker = context.getValue(jsonStats.errors?.length
|
package/dist/case/normal.js
CHANGED
|
@@ -141,6 +141,9 @@ function defaultOptions(context, compilerOptions, mode) {
|
|
|
141
141
|
pathinfo: 'verbose',
|
|
142
142
|
path: context.getDist(),
|
|
143
143
|
filename: compilerOptions?.module ? 'bundle.mjs' : 'bundle.js',
|
|
144
|
+
bundlerInfo: {
|
|
145
|
+
force: false,
|
|
146
|
+
},
|
|
144
147
|
},
|
|
145
148
|
resolve: {
|
|
146
149
|
modules: ['web_modules', 'node_modules'],
|
|
@@ -169,6 +172,11 @@ function defaultOptions(context, compilerOptions, mode) {
|
|
|
169
172
|
type: 'webassembly/async',
|
|
170
173
|
},
|
|
171
174
|
],
|
|
175
|
+
parser: {
|
|
176
|
+
javascript: {
|
|
177
|
+
requireAlias: true,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
172
180
|
},
|
|
173
181
|
plugins: (compilerOptions?.plugins || [])
|
|
174
182
|
.concat(testConfig.plugins || [])
|
|
@@ -189,13 +197,7 @@ function defaultOptions(context, compilerOptions, mode) {
|
|
|
189
197
|
}),
|
|
190
198
|
experiments: {
|
|
191
199
|
css: false,
|
|
192
|
-
rspackFuture: {
|
|
193
|
-
bundlerInfo: {
|
|
194
|
-
force: false,
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
200
|
asyncWebAssembly: true,
|
|
198
|
-
topLevelAwait: true,
|
|
199
201
|
// CHANGE: rspack does not support `backCompat` yet.
|
|
200
202
|
// backCompat: false,
|
|
201
203
|
// CHANGE: Rspack enables `css` by default.
|
package/dist/case/runner.js
CHANGED
|
@@ -22,6 +22,12 @@ function cachedStats(context, name) {
|
|
|
22
22
|
return cached;
|
|
23
23
|
}
|
|
24
24
|
cached = compiler.getStats().toJson({
|
|
25
|
+
assets: true,
|
|
26
|
+
chunks: true,
|
|
27
|
+
chunkModules: true,
|
|
28
|
+
modules: true,
|
|
29
|
+
entrypoints: true,
|
|
30
|
+
chunkGroups: true,
|
|
25
31
|
errorDetails: true,
|
|
26
32
|
});
|
|
27
33
|
return cached;
|
package/dist/case/stats-api.js
CHANGED
|
@@ -52,11 +52,15 @@ function createStatsAPICase(name, src, dist, testConfig) {
|
|
|
52
52
|
}
|
|
53
53
|
function options(context, custom) {
|
|
54
54
|
const res = (custom?.(context) || {});
|
|
55
|
-
res.
|
|
56
|
-
res.
|
|
57
|
-
res.
|
|
58
|
-
res.
|
|
59
|
-
|
|
55
|
+
res.output ??= {};
|
|
56
|
+
res.module ??= {};
|
|
57
|
+
res.module.defaultRules ??= ['...'];
|
|
58
|
+
res.module.defaultRules.push({
|
|
59
|
+
test: /\.css$/,
|
|
60
|
+
type: 'css/auto',
|
|
61
|
+
});
|
|
62
|
+
res.output.bundlerInfo ??= {};
|
|
63
|
+
res.output.bundlerInfo.force ??= false;
|
|
60
64
|
if (!global.printLogger) {
|
|
61
65
|
res.infrastructureLogging = {
|
|
62
66
|
level: 'error',
|
|
@@ -56,14 +56,20 @@ function defaultOptions(index, context) {
|
|
|
56
56
|
if (fs_extra_1.default.existsSync(node_path_1.default.join(context.getSource(), 'rspack.config.js')) ||
|
|
57
57
|
fs_extra_1.default.existsSync(node_path_1.default.join(context.getSource(), 'webpack.config.js'))) {
|
|
58
58
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
bundlerInfo: {
|
|
63
|
-
force: false,
|
|
64
|
-
},
|
|
59
|
+
output: {
|
|
60
|
+
bundlerInfo: {
|
|
61
|
+
force: false,
|
|
65
62
|
},
|
|
66
63
|
},
|
|
64
|
+
module: {
|
|
65
|
+
defaultRules: [
|
|
66
|
+
'...',
|
|
67
|
+
{
|
|
68
|
+
test: /\.css$/i,
|
|
69
|
+
type: 'css/auto',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
67
73
|
};
|
|
68
74
|
}
|
|
69
75
|
return {
|
|
@@ -73,18 +79,21 @@ function defaultOptions(index, context) {
|
|
|
73
79
|
output: {
|
|
74
80
|
filename: 'bundle.js',
|
|
75
81
|
path: context.getDist(),
|
|
82
|
+
bundlerInfo: {
|
|
83
|
+
force: false,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
module: {
|
|
87
|
+
defaultRules: [
|
|
88
|
+
{
|
|
89
|
+
test: /\.css$/i,
|
|
90
|
+
type: 'css/auto',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
76
93
|
},
|
|
77
94
|
optimization: {
|
|
78
95
|
minimize: false,
|
|
79
96
|
},
|
|
80
|
-
experiments: {
|
|
81
|
-
css: true,
|
|
82
|
-
rspackFuture: {
|
|
83
|
-
bundlerInfo: {
|
|
84
|
-
force: false,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
97
|
};
|
|
89
98
|
}
|
|
90
99
|
function overrideOptions(index, context, options) {
|
package/dist/case/watch.js
CHANGED
|
@@ -104,6 +104,12 @@ function createWatchInitialProcessor(name, tempDir, step, watchState, { incremen
|
|
|
104
104
|
return () => {
|
|
105
105
|
if (!cached) {
|
|
106
106
|
cached = stats.toJson({
|
|
107
|
+
assets: true,
|
|
108
|
+
chunks: true,
|
|
109
|
+
chunkModules: true,
|
|
110
|
+
modules: true,
|
|
111
|
+
entrypoints: true,
|
|
112
|
+
chunkGroups: true,
|
|
107
113
|
errorDetails: true,
|
|
108
114
|
});
|
|
109
115
|
}
|
|
@@ -140,6 +146,12 @@ function createWatchInitialProcessor(name, tempDir, step, watchState, { incremen
|
|
|
140
146
|
stats.hasErrors() ||
|
|
141
147
|
stats.hasWarnings()) {
|
|
142
148
|
const statsJson = stats.toJson({
|
|
149
|
+
assets: true,
|
|
150
|
+
chunks: true,
|
|
151
|
+
chunkModules: true,
|
|
152
|
+
modules: true,
|
|
153
|
+
entrypoints: true,
|
|
154
|
+
chunkGroups: true,
|
|
143
155
|
errorDetails: true,
|
|
144
156
|
});
|
|
145
157
|
if (statsJson.errors) {
|
|
@@ -245,21 +257,20 @@ function overrideOptions(index, context, options, tempDir, nativeWatcher) {
|
|
|
245
257
|
options.output.pathinfo = false;
|
|
246
258
|
if (!options.output.filename)
|
|
247
259
|
options.output.filename = 'bundle.js';
|
|
248
|
-
if (options.cache && options.cache.type === 'filesystem') {
|
|
249
|
-
const cacheDirectory = node_path_1.default.join(tempDir, '.cache');
|
|
250
|
-
options.cache.cacheDirectory = cacheDirectory;
|
|
251
|
-
options.cache.name = `config-${index}`;
|
|
252
|
-
}
|
|
253
260
|
options.optimization ??= {};
|
|
254
261
|
options.experiments ??= {};
|
|
255
|
-
options.
|
|
262
|
+
options.module ??= {};
|
|
263
|
+
options.module.defaultRules ??= ['...'];
|
|
264
|
+
options.module.defaultRules.push({
|
|
265
|
+
test: /\.css$/,
|
|
266
|
+
type: 'css/auto',
|
|
267
|
+
});
|
|
256
268
|
if (nativeWatcher) {
|
|
257
269
|
options.experiments.nativeWatcher ??= true;
|
|
258
270
|
}
|
|
259
|
-
options.
|
|
260
|
-
options.
|
|
261
|
-
options.
|
|
262
|
-
false;
|
|
271
|
+
options.output ??= {};
|
|
272
|
+
options.output.bundlerInfo ??= {};
|
|
273
|
+
options.output.bundlerInfo.force ??= false;
|
|
263
274
|
// test incremental: "safe" here, we test default incremental in Incremental-*.test.js
|
|
264
275
|
options.experiments.incremental ??= 'safe';
|
|
265
276
|
if (!global.printLogger) {
|
|
@@ -304,6 +315,11 @@ function cachedWatchStats(context, name) {
|
|
|
304
315
|
return cached[stepName];
|
|
305
316
|
}
|
|
306
317
|
cached[stepName] = compiler.getStats().toJson({
|
|
318
|
+
entrypoints: true,
|
|
319
|
+
assets: true,
|
|
320
|
+
chunks: true,
|
|
321
|
+
chunkModules: true,
|
|
322
|
+
modules: true,
|
|
307
323
|
errorDetails: true,
|
|
308
324
|
});
|
|
309
325
|
return cached[stepName];
|
|
@@ -23,6 +23,10 @@ const placeholderSerializer = (0, path_serializer_1.createSnapshotSerializer)({
|
|
|
23
23
|
match: __RSPACK_PATH__,
|
|
24
24
|
mark: 'rspack_root',
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
match: /<ROOT>\/packages\/rspack/g,
|
|
28
|
+
mark: 'rspack_root',
|
|
29
|
+
},
|
|
26
30
|
{
|
|
27
31
|
match: /:\d+:\d+-\d+:\d+/g,
|
|
28
32
|
mark: 'line_col_range',
|
|
@@ -41,6 +41,7 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
41
41
|
const node_path_1 = __importDefault(require("node:path"));
|
|
42
42
|
const node_url_1 = require("node:url");
|
|
43
43
|
const node_vm_1 = __importStar(require("node:vm"));
|
|
44
|
+
const config_1 = require("../../case/config");
|
|
44
45
|
const asModule_1 = __importDefault(require("../../helper/legacy/asModule"));
|
|
45
46
|
const createFakeWorker_1 = __importDefault(require("../../helper/legacy/createFakeWorker"));
|
|
46
47
|
const urlToRelativePath_1 = __importDefault(require("../../helper/legacy/urlToRelativePath"));
|
|
@@ -279,8 +280,8 @@ class NodeRunner {
|
|
|
279
280
|
file,
|
|
280
281
|
});
|
|
281
282
|
}
|
|
282
|
-
if (file.path.endsWith('.mjs')
|
|
283
|
-
this._options.compilerOptions
|
|
283
|
+
if (file.path.endsWith('.mjs') ||
|
|
284
|
+
(0, config_1.enableEsmLibraryPlugin)(this._options.compilerOptions)) {
|
|
284
285
|
return this.requirers.get('esm')(currentDirectory, modulePath, {
|
|
285
286
|
...context,
|
|
286
287
|
file,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-debug/test-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-canary.20260120",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Test tools for rspack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/jsdom": "^21.1.7",
|
|
66
66
|
"typescript": "^5.9.3",
|
|
67
67
|
"wast-loader": "^1.14.1",
|
|
68
|
-
"@rspack/core": "npm:@rspack-debug/core@
|
|
68
|
+
"@rspack/core": "npm:@rspack-debug/core@2.0.0-canary.20260120"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@rspack/core": ">=1.0.0"
|