@volter/tabnode 0.5.30 → 0.5.32

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.
@@ -17671,11 +17671,9 @@ class Zlib {
17671
17671
  __privateMethod(this, _Zlib_instances, run_fn).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17672
17672
  (_a4 = __privateGet(this, _callback)) == null ? void 0 : _a4.call(this);
17673
17673
  });
17674
- return this;
17675
17674
  }
17676
17675
  writeSync(flush2, inBuf, inOff, inLen, outBuf, outOff, outLen) {
17677
17676
  __privateMethod(this, _Zlib_instances, run_fn).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17678
- return this;
17679
17677
  }
17680
17678
  /**
17681
17679
  * `deflateParams` mid-stream. pako's deflate does not carry it, so the
@@ -17844,11 +17842,9 @@ class BrotliDecoderHandle {
17844
17842
  __privateMethod(this, _BrotliDecoderHandle_instances, run_fn2).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17845
17843
  (_a4 = __privateGet(this, _callback2)) == null ? void 0 : _a4.call(this);
17846
17844
  });
17847
- return this;
17848
17845
  }
17849
17846
  writeSync(flush2, inBuf, inOff, inLen, outBuf, outOff, outLen) {
17850
17847
  __privateMethod(this, _BrotliDecoderHandle_instances, run_fn2).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17851
- return this;
17852
17848
  }
17853
17849
  params() {
17854
17850
  }
@@ -79676,6 +79672,17 @@ function createRequire(vfs2, fsShim, process2, currentDir, moduleCache, options,
79676
79672
  runModuleBody(module, vfs2.readFileSync(prepared, "utf8"), resolvedPath, dirname$1, true);
79677
79673
  return module;
79678
79674
  }
79675
+ if (prepared) {
79676
+ const body = __substrateScopeGlobalCalls(prepareModuleCode(rawCode, resolvedPath));
79677
+ try {
79678
+ const partial = `${prepared}.${process2.pid}.partial`;
79679
+ vfs2.writeFileSync(partial, body);
79680
+ vfs2.renameSync(partial, prepared);
79681
+ } catch {
79682
+ }
79683
+ runModuleBody(module, body, resolvedPath, dirname$1, true);
79684
+ return module;
79685
+ }
79679
79686
  }
79680
79687
  runModuleBody(module, prepareModuleCode(rawCode, resolvedPath, format2), resolvedPath, dirname$1);
79681
79688
  return module;
package/dist/index.mjs CHANGED
@@ -17799,11 +17799,9 @@ class Zlib {
17799
17799
  __privateMethod(this, _Zlib_instances, run_fn).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17800
17800
  (_a3 = __privateGet(this, _callback)) == null ? void 0 : _a3.call(this);
17801
17801
  });
17802
- return this;
17803
17802
  }
17804
17803
  writeSync(flush2, inBuf, inOff, inLen, outBuf, outOff, outLen) {
17805
17804
  __privateMethod(this, _Zlib_instances, run_fn).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17806
- return this;
17807
17805
  }
17808
17806
  /**
17809
17807
  * `deflateParams` mid-stream. pako's deflate does not carry it, so the
@@ -17972,11 +17970,9 @@ class BrotliDecoderHandle {
17972
17970
  __privateMethod(this, _BrotliDecoderHandle_instances, run_fn2).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17973
17971
  (_a3 = __privateGet(this, _callback2)) == null ? void 0 : _a3.call(this);
17974
17972
  });
17975
- return this;
17976
17973
  }
17977
17974
  writeSync(flush2, inBuf, inOff, inLen, outBuf, outOff, outLen) {
17978
17975
  __privateMethod(this, _BrotliDecoderHandle_instances, run_fn2).call(this, flush2, inBuf, inOff, inLen, outBuf, outOff, outLen);
17979
- return this;
17980
17976
  }
17981
17977
  params() {
17982
17978
  }
@@ -21288,10 +21284,17 @@ var implementation$1 = function bind2(that) {
21288
21284
  var implementation = implementation$1;
21289
21285
  var functionBind = Function.prototype.bind || implementation;
21290
21286
  var functionCall = Function.prototype.call;
21291
- var functionApply = Function.prototype.apply;
21287
+ var functionApply;
21288
+ var hasRequiredFunctionApply;
21289
+ function requireFunctionApply() {
21290
+ if (hasRequiredFunctionApply) return functionApply;
21291
+ hasRequiredFunctionApply = 1;
21292
+ functionApply = Function.prototype.apply;
21293
+ return functionApply;
21294
+ }
21292
21295
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
21293
21296
  var bind$2 = functionBind;
21294
- var $apply$1 = functionApply;
21297
+ var $apply$1 = requireFunctionApply();
21295
21298
  var $call$2 = functionCall;
21296
21299
  var $reflectApply = reflectApply;
21297
21300
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
@@ -21411,7 +21414,7 @@ var hasSymbols = requireHasSymbols()();
21411
21414
  var getProto = requireGetProto();
21412
21415
  var $ObjectGPO = requireObject_getPrototypeOf();
21413
21416
  var $ReflectGPO = requireReflect_getPrototypeOf();
21414
- var $apply = functionApply;
21417
+ var $apply = requireFunctionApply();
21415
21418
  var $call = functionCall;
21416
21419
  var needsEval = {};
21417
21420
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
@@ -22052,7 +22055,7 @@ function requireApplyBind() {
22052
22055
  if (hasRequiredApplyBind) return applyBind;
22053
22056
  hasRequiredApplyBind = 1;
22054
22057
  var bind3 = functionBind;
22055
- var $apply2 = functionApply;
22058
+ var $apply2 = requireFunctionApply();
22056
22059
  var actualApply$1 = actualApply;
22057
22060
  applyBind = function applyBind2() {
22058
22061
  return actualApply$1(bind3, $apply2, arguments);
@@ -39330,6 +39333,17 @@ function createRequire(vfs2, fsShim, process2, currentDir, moduleCache, options,
39330
39333
  runModuleBody(module, vfs2.readFileSync(prepared, "utf8"), resolvedPath, dirname$1, true);
39331
39334
  return module;
39332
39335
  }
39336
+ if (prepared) {
39337
+ const body = __substrateScopeGlobalCalls(prepareModuleCode(rawCode, resolvedPath));
39338
+ try {
39339
+ const partial = `${prepared}.${process2.pid}.partial`;
39340
+ vfs2.writeFileSync(partial, body);
39341
+ vfs2.renameSync(partial, prepared);
39342
+ } catch {
39343
+ }
39344
+ runModuleBody(module, body, resolvedPath, dirname$1, true);
39345
+ return module;
39346
+ }
39333
39347
  }
39334
39348
  runModuleBody(module, prepareModuleCode(rawCode, resolvedPath, format2), resolvedPath, dirname$1);
39335
39349
  return module;
@@ -40222,7 +40236,7 @@ class WorkerRuntime {
40222
40236
  this.worker = new Worker(
40223
40237
  new URL(
40224
40238
  /* @vite-ignore */
40225
- "/assets/runtime-worker-Dv_vTkXr.js",
40239
+ "/assets/runtime-worker-g2I0tMiC.js",
40226
40240
  import.meta.url
40227
40241
  ),
40228
40242
  { type: "module" }
@@ -11,8 +11,8 @@ export declare class Zlib {
11
11
  onerror: ((message: string, errno: number, code?: string) => void) | null;
12
12
  constructor(mode: number);
13
13
  init(windowBits: number, level: number, memLevel: number, strategy: number, writeState: Uint32Array, processCallback: ProcessCallback, dictionary?: Uint8Array): void;
14
- write(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): this;
15
- writeSync(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): this;
14
+ write(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): void;
15
+ writeSync(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): void;
16
16
  /**
17
17
  * `deflateParams` mid-stream. pako's deflate does not carry it, so the
18
18
  * level and strategy are taken by starting the stream again -- which is
@@ -31,8 +31,8 @@ declare class BrotliDecoderHandle {
31
31
  onerror: ((message: string, errno: number, code?: string) => void) | null;
32
32
  constructor(mode: number);
33
33
  init(_params: Uint32Array, writeState: Uint32Array, processCallback: ProcessCallback): boolean;
34
- write(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): this;
35
- writeSync(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): this;
34
+ write(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): void;
35
+ writeSync(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): void;
36
36
  params(): void;
37
37
  reset(): void;
38
38
  close(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/tabnode",
3
- "version": "0.5.30",
3
+ "version": "0.5.32",
4
4
  "description": "Node's own library, in a browser tab.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -163,7 +163,7 @@ export class Zlib {
163
163
  write(
164
164
  flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number,
165
165
  outBuf: Uint8Array, outOff: number, outLen: number,
166
- ): this {
166
+ ): void {
167
167
  // Node's own binding does this work on the thread pool and calls back;
168
168
  // a tab has one thread, so the work is done here and the callback is the
169
169
  // next tick, which is the difference a program can observe.
@@ -173,15 +173,15 @@ export class Zlib {
173
173
  this.#run(flush, inBuf, inOff, inLen, outBuf, outOff, outLen);
174
174
  this.#callback?.();
175
175
  });
176
- return this;
177
176
  }
178
177
 
179
178
  writeSync(
180
179
  flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number,
181
180
  outBuf: Uint8Array, outOff: number, outLen: number,
182
- ): this {
181
+ ): void {
182
+ // Node's binding returns nothing: the answer is the shared pair, and
183
+ // pngjs's `res || this._writeState` reads a returned value in its place.
183
184
  this.#run(flush, inBuf, inOff, inLen, outBuf, outOff, outLen);
184
- return this;
185
185
  }
186
186
 
187
187
  /**
@@ -292,19 +292,17 @@ class BrotliDecoderHandle {
292
292
  }
293
293
  }
294
294
 
295
- write(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): this {
295
+ write(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): void {
296
296
  const tick = (globalThis as { process?: { nextTick?: (fn: () => void) => void } }).process?.nextTick
297
297
  ?? ((fn: () => void) => { queueMicrotask(fn); });
298
298
  tick(() => {
299
299
  this.#run(flush, inBuf, inOff, inLen, outBuf, outOff, outLen);
300
300
  this.#callback?.();
301
301
  });
302
- return this;
303
302
  }
304
303
 
305
- writeSync(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): this {
304
+ writeSync(flush: number, inBuf: Uint8Array | null, inOff: number, inLen: number, outBuf: Uint8Array, outOff: number, outLen: number): void {
306
305
  this.#run(flush, inBuf, inOff, inLen, outBuf, outOff, outLen);
307
- return this;
308
306
  }
309
307
 
310
308
  params(): void {}
package/src/runtime.ts CHANGED
@@ -1997,6 +1997,20 @@ function createRequire(
1997
1997
  runModuleBody(module, vfs.readFileSync(prepared, 'utf8'), resolvedPath, dirname, true);
1998
1998
  return module;
1999
1999
  }
2000
+ // A file the image carries no body for (a package installed in the
2001
+ // tab) is prepared here once and kept under the same name, so the next
2002
+ // process takes it: every Playwright test worker required
2003
+ // playwright-core afresh, 28 s each, measured in a tab.
2004
+ if (prepared) {
2005
+ const body = __substrateScopeGlobalCalls(prepareModuleCode(rawCode, resolvedPath));
2006
+ try {
2007
+ const partial = `${prepared}.${process.pid}.partial`;
2008
+ vfs.writeFileSync(partial, body);
2009
+ vfs.renameSync(partial, prepared);
2010
+ } catch { /* a process that may not write there prepares its own */ }
2011
+ runModuleBody(module, body, resolvedPath, dirname, true);
2012
+ return module;
2013
+ }
2000
2014
  }
2001
2015
  runModuleBody(module, prepareModuleCode(rawCode, resolvedPath, format), resolvedPath, dirname);
2002
2016
  return module;