@vitest/web-worker 3.0.5 → 3.0.7
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/pure.js +22 -5
- package/package.json +3 -3
package/dist/pure.js
CHANGED
@@ -90,6 +90,12 @@ const deserializer = ($, _) => {
|
|
90
90
|
return as(BigInt(value), index);
|
91
91
|
case 'BigInt':
|
92
92
|
return as(Object(BigInt(value)), index);
|
93
|
+
case 'ArrayBuffer':
|
94
|
+
return as(new Uint8Array(value).buffer, value);
|
95
|
+
case 'DataView': {
|
96
|
+
const { buffer } = new Uint8Array(value);
|
97
|
+
return as(new DataView(buffer), value);
|
98
|
+
}
|
93
99
|
}
|
94
100
|
return as(new env[type](value), index);
|
95
101
|
};
|
@@ -132,6 +138,8 @@ const typeOf = value => {
|
|
132
138
|
return [MAP, EMPTY];
|
133
139
|
case 'Set':
|
134
140
|
return [SET, EMPTY];
|
141
|
+
case 'DataView':
|
142
|
+
return [ARRAY, asString];
|
135
143
|
}
|
136
144
|
|
137
145
|
if (asString.includes('Array'))
|
@@ -181,9 +189,17 @@ const serializer = (strict, json, $, _) => {
|
|
181
189
|
return as([TYPE, entry], value);
|
182
190
|
}
|
183
191
|
case ARRAY: {
|
184
|
-
if (type)
|
185
|
-
|
186
|
-
|
192
|
+
if (type) {
|
193
|
+
let spread = value;
|
194
|
+
if (type === 'DataView') {
|
195
|
+
spread = new Uint8Array(value.buffer);
|
196
|
+
}
|
197
|
+
else if (type === 'ArrayBuffer') {
|
198
|
+
spread = new Uint8Array(value);
|
199
|
+
}
|
200
|
+
return as([type, [...spread]], value);
|
201
|
+
}
|
202
|
+
|
187
203
|
const arr = [];
|
188
204
|
const index = as([TYPE, arr], value);
|
189
205
|
for (const entry of value)
|
@@ -298,7 +314,7 @@ function assertGlobalExists(name) {
|
|
298
314
|
function createClonedMessageEvent(data, transferOrOptions, clone) {
|
299
315
|
const transfer = Array.isArray(transferOrOptions) ? transferOrOptions : transferOrOptions?.transfer;
|
300
316
|
debug("clone worker message %o", data);
|
301
|
-
const origin = typeof location === "undefined" ?
|
317
|
+
const origin = typeof location === "undefined" ? void 0 : location.origin;
|
302
318
|
if (typeof structuredClone === "function" && clone === "native") {
|
303
319
|
debug("create message event, using native structured clone");
|
304
320
|
return new MessageEvent("message", {
|
@@ -336,7 +352,7 @@ function createMessageEvent(data, transferOrOptions, clone) {
|
|
336
352
|
}
|
337
353
|
function getRunnerOptions() {
|
338
354
|
const state = getWorkerState();
|
339
|
-
const { config, rpc, moduleCache } = state;
|
355
|
+
const { config, rpc, moduleCache, moduleExecutionInfo } = state;
|
340
356
|
return {
|
341
357
|
async fetchModule(id) {
|
342
358
|
const result = await rpc.fetch(id, "web");
|
@@ -350,6 +366,7 @@ function getRunnerOptions() {
|
|
350
366
|
return rpc.resolveId(id, importer, "web");
|
351
367
|
},
|
352
368
|
moduleCache,
|
369
|
+
moduleExecutionInfo,
|
353
370
|
interopDefault: config.deps.interopDefault ?? true,
|
354
371
|
moduleDirectories: config.deps.moduleDirectories,
|
355
372
|
root: config.root,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/web-worker",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.
|
4
|
+
"version": "3.0.7",
|
5
5
|
"description": "Web Worker support for testing in Vitest",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"dist"
|
34
34
|
],
|
35
35
|
"peerDependencies": {
|
36
|
-
"vitest": "3.0.
|
36
|
+
"vitest": "3.0.7"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
39
|
"debug": "^4.4.0"
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"devDependencies": {
|
42
42
|
"@types/debug": "^4.1.12",
|
43
43
|
"@types/ungap__structured-clone": "^1.2.0",
|
44
|
-
"@ungap/structured-clone": "^1.
|
44
|
+
"@ungap/structured-clone": "^1.3.0"
|
45
45
|
},
|
46
46
|
"scripts": {
|
47
47
|
"build": "rimraf dist && rollup -c",
|