@rspack-canary/test-tools 1.6.8-canary-02b3377e-20251215174244 → 1.7.0-canary-a0fc091c-20251217174017

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.
@@ -123,6 +123,7 @@ function defaultOptions(context) {
123
123
  chunkIds: "named",
124
124
  sideEffects: false,
125
125
  mangleExports: false,
126
+ inlineExports: false,
126
127
  usedExports: false,
127
128
  concatenateModules: false,
128
129
  nodeEnv: false
@@ -96,8 +96,7 @@ async function generateOptions(context, temp, target, updatePlugin) {
96
96
  bundlerInfo: {
97
97
  force: false
98
98
  }
99
- },
100
- inlineConst: true
99
+ }
101
100
  }
102
101
  };
103
102
  options.plugins ??= [];
@@ -79,8 +79,7 @@ function defaultOptions(index, context) {
79
79
  bundlerInfo: {
80
80
  force: false
81
81
  }
82
- },
83
- inlineConst: true
82
+ }
84
83
  }
85
84
  };
86
85
  }
@@ -82,8 +82,7 @@ function defaultOptions(context) {
82
82
  bundlerInfo: {
83
83
  force: false
84
84
  }
85
- },
86
- inlineConst: true
85
+ }
87
86
  }
88
87
  };
89
88
  }
@@ -101,6 +101,10 @@ const defaultOptions = (_index, context) => ({
101
101
  chunkIds: "named",
102
102
  runtimeChunk: "single"
103
103
  },
104
+ externals: {
105
+ fs: "module-import fs",
106
+ path: "module-import path"
107
+ },
104
108
  plugins: [new core_1.default.experiments.EsmLibraryPlugin()],
105
109
  experiments: {
106
110
  css: true,
package/dist/case/hash.js CHANGED
@@ -52,8 +52,7 @@ function defaultOptions(index, context) {
52
52
  bundlerInfo: {
53
53
  force: false
54
54
  }
55
- },
56
- inlineConst: true
55
+ }
57
56
  }
58
57
  };
59
58
  }
package/dist/case/hook.js CHANGED
@@ -213,8 +213,7 @@ function defaultOptions(context, custom) {
213
213
  bundlerInfo: {
214
214
  force: false
215
215
  }
216
- },
217
- inlineConst: true
216
+ }
218
217
  }
219
218
  };
220
219
  if (custom) {
package/dist/case/hot.js CHANGED
@@ -110,8 +110,7 @@ function defaultOptions(context, target) {
110
110
  bundlerInfo: {
111
111
  force: false
112
112
  }
113
- },
114
- inlineConst: true
113
+ }
115
114
  }
116
115
  };
117
116
  options.plugins ??= [];
@@ -111,6 +111,7 @@ function defaultOptions(context, compilerOptions, mode) {
111
111
  providedExports: true,
112
112
  usedExports: true,
113
113
  mangleExports: true,
114
+ inlineExports: true,
114
115
  // CHANGE: rspack does not support `emitOnErrors` yet.
115
116
  emitOnErrors: true,
116
117
  concatenateModules: !!testConfig?.optimization?.concatenateModules,
@@ -195,7 +196,6 @@ function defaultOptions(context, compilerOptions, mode) {
195
196
  },
196
197
  asyncWebAssembly: true,
197
198
  topLevelAwait: true,
198
- inlineConst: true,
199
199
  // CHANGE: rspack does not support `backCompat` yet.
200
200
  // backCompat: false,
201
201
  // CHANGE: Rspack enables `css` by default.
@@ -83,8 +83,7 @@ function defaultOptions(index, context) {
83
83
  bundlerInfo: {
84
84
  force: false
85
85
  }
86
- },
87
- inlineConst: true
86
+ }
88
87
  }
89
88
  };
90
89
  }
@@ -87,20 +87,50 @@ module.exports = async function checkArrayExpectation(testDirectory, object, kin
87
87
  done(new Error(`Less ${kind}s (${array.length} instead of ${expected.length}) while compiling than expected:\n\n${diff}\n\nCheck expected ${kind}s: ${expectedFilename}`));
88
88
  return true;
89
89
  }
90
+ const usedExpected = new Array(expected.length).fill(false);
90
91
  for (let i = 0; i < array.length; i++) {
91
- if (Array.isArray(expected[i])) {
92
- for (let j = 0; j < expected[i].length; j++) {
93
- if (!check(expected[i][j], array[i])) {
94
- done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match ${explain(expected[i][j])}`));
95
- return true;
92
+ let found = false;
93
+ for (let j = 0; j < expected.length; j++) {
94
+ if (usedExpected[j])
95
+ continue;
96
+ if (Array.isArray(expected[j])) {
97
+ for (let k = 0; k < expected[j].length; k++) {
98
+ if (check(expected[j][k], array[i])) {
99
+ usedExpected[j] = true;
100
+ found = true;
101
+ break;
102
+ }
96
103
  }
97
104
  }
105
+ else {
106
+ if (check(expected[j], array[i])) {
107
+ usedExpected[j] = true;
108
+ found = true;
109
+ break;
110
+ }
111
+ }
112
+ if (found)
113
+ break;
98
114
  }
99
- else if (!check(expected[i], array[i])) {
100
- done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match ${explain(expected[i])}`));
115
+ if (!found) {
116
+ done(new Error(`${upperCaseKind} ${i}: ${explain(array[i])} doesn't match any expected value`));
101
117
  return true;
102
118
  }
103
119
  }
120
+ const unused = [];
121
+ for (let j = 0; j < expected.length; j++) {
122
+ if (!usedExpected[j]) {
123
+ unused.push(Array.isArray(expected[j])
124
+ ? expected[j].map(explain).join(' | ')
125
+ : explain(expected[j]));
126
+ }
127
+ }
128
+ if (unused.length > 0) {
129
+ done(new Error(`The following expected ${kind}s were not matched:\n${unused
130
+ .map(u => ` ${u}`)
131
+ .join('\n')}`));
132
+ return true;
133
+ }
104
134
  }
105
135
  else if (array.length > 0) {
106
136
  done(new Error(`${upperCaseKind}s while compiling:\n\n${array
@@ -36,6 +36,22 @@ self.importScripts = url => {
36
36
  : "require(urlToPath(url))"};
37
37
  };
38
38
  self.fetch = async url => {
39
+ if (typeof url === "string" ? url.endsWith(".wasm") : url.toString().endsWith(".wasm")) {
40
+ return new Promise((resolve, reject) => {
41
+ fs.readFile(require("node:url").fileURLToPath(url), (err, data) => {
42
+ if (err) {
43
+ reject(err);
44
+ return;
45
+ }
46
+ return resolve(
47
+ new Response(data, {
48
+ headers: { "Content-Type": "application/wasm" }
49
+ })
50
+ );
51
+ });
52
+ });
53
+ }
54
+
39
55
  try {
40
56
  const buffer = await new Promise((resolve, reject) =>
41
57
  fs.readFile(urlToPath(url), (err, b) =>
@@ -43,7 +59,9 @@ self.fetch = async url => {
43
59
  )
44
60
  );
45
61
  return {
46
- headers: { get(name) { } },
62
+ headers: { get(name) {
63
+ if (name.toLowerCase() === "content-type") {}
64
+ } },
47
65
  status: 200,
48
66
  ok: true,
49
67
  arrayBuffer() { return buffer; },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/test-tools",
3
- "version": "1.6.8-canary-02b3377e-20251215174244",
3
+ "version": "1.7.0-canary-a0fc091c-20251217174017",
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-canary/core@1.6.8-canary-02b3377e-20251215174244"
68
+ "@rspack/core": "npm:@rspack-canary/core@1.7.0-canary-a0fc091c-20251217174017"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@rspack/core": ">=1.0.0"