vitest 0.32.1 → 0.32.3

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.
Files changed (42) hide show
  1. package/LICENSE.md +33 -4
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +22 -5
  4. package/dist/child.js +3 -3
  5. package/dist/{chunk-api-setup.05e3917b.js → chunk-api-setup.8f785c4a.js} +18 -11
  6. package/dist/{chunk-install-pkg.65daeadb.js → chunk-install-pkg.0716919d.js} +69 -55
  7. package/dist/{chunk-integrations-globals.a56dee90.js → chunk-integrations-globals.0093e2ed.js} +5 -5
  8. package/dist/{chunk-node-git.4c43bd73.js → chunk-node-git.c410fed8.js} +3 -2
  9. package/dist/cli-wrapper.js +2 -2
  10. package/dist/cli.js +8 -8
  11. package/dist/config.d.ts +1 -1
  12. package/dist/coverage.d.ts +1 -1
  13. package/dist/entry.js +9 -9
  14. package/dist/environments.d.ts +1 -1
  15. package/dist/environments.js +1 -1
  16. package/dist/index.d.ts +60 -40
  17. package/dist/index.js +6 -6
  18. package/dist/loader.js +140 -4
  19. package/dist/node.d.ts +3 -3
  20. package/dist/node.js +9 -9
  21. package/dist/runners.d.ts +1 -1
  22. package/dist/runners.js +24 -19
  23. package/dist/suite.d.ts +1 -0
  24. package/dist/{types-2b1c412e.d.ts → types-198fd1d9.d.ts} +302 -77
  25. package/dist/vendor-_commonjsHelpers.7d1333e8.js +7 -0
  26. package/dist/{vendor-cli-api.17011d0a.js → vendor-cli-api.ff679aa2.js} +281 -229
  27. package/dist/{vendor-coverage.de2180ed.js → vendor-coverage.2e41927a.js} +1 -1
  28. package/dist/{vendor-execute.001ae440.js → vendor-execute.3576af13.js} +14 -16
  29. package/dist/{vendor-index.c1e09929.js → vendor-index.1f85e5f1.js} +52 -39
  30. package/dist/{vendor-index.fad2598b.js → vendor-index.23ac4e13.js} +1 -1
  31. package/dist/{vendor-index.0f133dbe.js → vendor-index.2af39fbb.js} +5 -3
  32. package/dist/{vendor-index.fc98d30f.js → vendor-index.98139333.js} +4 -22
  33. package/dist/{vendor-index.87ab04c3.js → vendor-index.cc463d9e.js} +2 -1
  34. package/dist/{vendor-rpc.4d3d7a54.js → vendor-rpc.ad5b08c7.js} +10 -10
  35. package/dist/{vendor-run-once.69ce7172.js → vendor-run-once.1fa85ba7.js} +2 -2
  36. package/dist/vendor-vi.dd6706cb.js +3421 -0
  37. package/dist/worker.js +3 -3
  38. package/package.json +21 -22
  39. package/dist/vendor-_commonjsHelpers.76cdd49e.js +0 -3
  40. package/dist/vendor-setup.common.f1cf2231.js +0 -20
  41. package/dist/vendor-vi.74cf3ef7.js +0 -3354
  42. /package/dist/{vendor-index.75f2b63d.js → vendor-environments.75f2b63d.js} +0 -0
@@ -51,4 +51,4 @@ async function stopCoverageInsideWorker(options, loader) {
51
51
  return null;
52
52
  }
53
53
 
54
- export { CoverageProviderMap as C, startCoverageInsideWorker as a, getCoverageProvider as g, stopCoverageInsideWorker as s, takeCoverageInsideWorker as t };
54
+ export { CoverageProviderMap as C, stopCoverageInsideWorker as a, getCoverageProvider as g, startCoverageInsideWorker as s, takeCoverageInsideWorker as t };
@@ -7,16 +7,14 @@ import { g as getWorkerState, a as getCurrentEnvironment } from './vendor-global
7
7
  import { d as distDir } from './vendor-paths.84fc7a99.js';
8
8
  import { existsSync, readdirSync } from 'node:fs';
9
9
  import { getColors, getType } from '@vitest/utils';
10
- import { e as getAllMockableProperties } from './vendor-index.87ab04c3.js';
10
+ import { g as getAllMockableProperties } from './vendor-index.cc463d9e.js';
11
11
  import { spyOn } from '@vitest/spy';
12
- import { r as rpc } from './vendor-rpc.4d3d7a54.js';
12
+ import { a as rpc } from './vendor-rpc.ad5b08c7.js';
13
13
 
14
14
  const filterPublicKeys = ["__esModule", Symbol.asyncIterator, Symbol.hasInstance, Symbol.isConcatSpreadable, Symbol.iterator, Symbol.match, Symbol.matchAll, Symbol.replace, Symbol.search, Symbol.split, Symbol.species, Symbol.toPrimitive, Symbol.toStringTag, Symbol.unscopables];
15
15
  class RefTracker {
16
- constructor() {
17
- this.idMap = /* @__PURE__ */ new Map();
18
- this.mockedValueMap = /* @__PURE__ */ new Map();
19
- }
16
+ idMap = /* @__PURE__ */ new Map();
17
+ mockedValueMap = /* @__PURE__ */ new Map();
20
18
  getId(value) {
21
19
  return this.idMap.get(value);
22
20
  }
@@ -33,11 +31,12 @@ class RefTracker {
33
31
  function isSpecialProp(prop, parentType) {
34
32
  return parentType.includes("Function") && typeof prop === "string" && ["arguments", "callee", "caller", "length", "name"].includes(prop);
35
33
  }
36
- const _VitestMocker = class {
34
+ class VitestMocker {
37
35
  constructor(executor) {
38
36
  this.executor = executor;
39
- this.resolveCache = /* @__PURE__ */ new Map();
40
37
  }
38
+ static pendingIds = [];
39
+ resolveCache = /* @__PURE__ */ new Map();
41
40
  get root() {
42
41
  return this.executor.options.root;
43
42
  }
@@ -92,16 +91,16 @@ const _VitestMocker = class {
92
91
  };
93
92
  }
94
93
  async resolveMocks() {
95
- if (!_VitestMocker.pendingIds.length)
94
+ if (!VitestMocker.pendingIds.length)
96
95
  return;
97
- await Promise.all(_VitestMocker.pendingIds.map(async (mock) => {
96
+ await Promise.all(VitestMocker.pendingIds.map(async (mock) => {
98
97
  const { fsPath, external } = await this.resolvePath(mock.id, mock.importer);
99
98
  if (mock.type === "unmock")
100
99
  this.unmockPath(fsPath);
101
100
  if (mock.type === "mock")
102
101
  this.mockPath(mock.id, fsPath, external, mock.factory);
103
102
  }));
104
- _VitestMocker.pendingIds = [];
103
+ VitestMocker.pendingIds = [];
105
104
  }
106
105
  async callFunctionMock(dep, mock) {
107
106
  var _a, _b;
@@ -306,14 +305,12 @@ ${c.green(`vi.mock("${mockpath}", async () => {
306
305
  return mock;
307
306
  }
308
307
  queueMock(id, importer, factory) {
309
- _VitestMocker.pendingIds.push({ type: "mock", id, importer, factory });
308
+ VitestMocker.pendingIds.push({ type: "mock", id, importer, factory });
310
309
  }
311
310
  queueUnmock(id, importer) {
312
- _VitestMocker.pendingIds.push({ type: "unmock", id, importer });
311
+ VitestMocker.pendingIds.push({ type: "unmock", id, importer });
313
312
  }
314
- };
315
- let VitestMocker = _VitestMocker;
316
- VitestMocker.pendingIds = [];
313
+ }
317
314
 
318
315
  async function createVitestExecutor(options) {
319
316
  const runner = new VitestExecutor(options);
@@ -376,6 +373,7 @@ class VitestExecutor extends ViteNodeRunner {
376
373
  configurable: true
377
374
  });
378
375
  }
376
+ mocker;
379
377
  shouldResolveId(id, _importee) {
380
378
  if (isInternalRequest(id) || id.startsWith("data:"))
381
379
  return false;
@@ -2,18 +2,18 @@ import { Buffer as Buffer$1 } from 'node:buffer';
2
2
  import path$3 from 'node:path';
3
3
  import childProcess, { ChildProcess } from 'node:child_process';
4
4
  import process$2 from 'node:process';
5
- import require$$0$2 from 'child_process';
6
- import p from 'path';
7
- import { c as commonjsGlobal } from './vendor-_commonjsHelpers.76cdd49e.js';
8
- import require$$0$1 from 'fs';
5
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './vendor-_commonjsHelpers.7d1333e8.js';
6
+ import require$$0$1 from 'child_process';
7
+ import f from 'path';
8
+ import $ from 'fs';
9
9
  import url from 'node:url';
10
10
  import os, { constants } from 'node:os';
11
11
  import require$$0 from 'assert';
12
12
  import require$$2 from 'events';
13
13
  import { createWriteStream, createReadStream } from 'node:fs';
14
- import require$$0$5 from 'buffer';
15
- import require$$0$3 from 'stream';
16
- import require$$0$4 from 'util';
14
+ import require$$0$3 from 'buffer';
15
+ import require$$0$2 from 'stream';
16
+ import require$$2$1 from 'util';
17
17
  import { debuglog } from 'node:util';
18
18
 
19
19
  var signalExit = {exports: {}};
@@ -78,8 +78,8 @@ function requireSignals () {
78
78
  'SIGSTKFLT',
79
79
  'SIGUNUSED'
80
80
  );
81
- }
82
- } (signals$1));
81
+ }
82
+ } (signals$1));
83
83
  return signals$1.exports;
84
84
  }
85
85
 
@@ -286,7 +286,10 @@ if (!processOk(process$1)) {
286
286
  };
287
287
  }
288
288
 
289
- var crossSpawn = {exports: {}};
289
+ var signalExitExports = signalExit.exports;
290
+ var onExit = /*@__PURE__*/getDefaultExportFromCjs(signalExitExports);
291
+
292
+ var crossSpawn$1 = {exports: {}};
290
293
 
291
294
  var windows;
292
295
  var hasRequiredWindows;
@@ -297,7 +300,7 @@ function requireWindows () {
297
300
  windows = isexe;
298
301
  isexe.sync = sync;
299
302
 
300
- var fs = require$$0$1;
303
+ var fs = $;
301
304
 
302
305
  function checkPathExt (path, options) {
303
306
  var pathext = options.pathExt !== undefined ?
@@ -348,7 +351,7 @@ function requireMode () {
348
351
  mode = isexe;
349
352
  isexe.sync = sync;
350
353
 
351
- var fs = require$$0$1;
354
+ var fs = $;
352
355
 
353
356
  function isexe (path, options, cb) {
354
357
  fs.stat(path, function (er, stat) {
@@ -450,7 +453,7 @@ const isWindows = process.platform === 'win32' ||
450
453
  process.env.OSTYPE === 'cygwin' ||
451
454
  process.env.OSTYPE === 'msys';
452
455
 
453
- const path$2 = p;
456
+ const path$2 = f;
454
457
  const COLON = isWindows ? ';' : ':';
455
458
  const isexe = isexe_1;
456
459
 
@@ -589,9 +592,11 @@ pathKey$2.exports = pathKey$1;
589
592
  // TODO: Remove this for the next major release
590
593
  pathKey$2.exports.default = pathKey$1;
591
594
 
592
- const path$1 = p;
595
+ var pathKeyExports = pathKey$2.exports;
596
+
597
+ const path$1 = f;
593
598
  const which = which_1;
594
- const getPathKey = pathKey$2.exports;
599
+ const getPathKey = pathKeyExports;
595
600
 
596
601
  function resolveCommandAttempt(parsed, withoutPathExt) {
597
602
  const env = parsed.options.env || process.env;
@@ -707,7 +712,7 @@ var shebangCommand$1 = (string = '') => {
707
712
  return argument ? `${binary} ${argument}` : binary;
708
713
  };
709
714
 
710
- const fs = require$$0$1;
715
+ const fs = $;
711
716
  const shebangCommand = shebangCommand$1;
712
717
 
713
718
  function readShebang$1(command) {
@@ -729,7 +734,7 @@ function readShebang$1(command) {
729
734
 
730
735
  var readShebang_1 = readShebang$1;
731
736
 
732
- const path = p;
737
+ const path = f;
733
738
  const resolveCommand = resolveCommand_1;
734
739
  const escape = _escape;
735
740
  const readShebang = readShebang_1;
@@ -877,7 +882,7 @@ var enoent$1 = {
877
882
  notFoundError,
878
883
  };
879
884
 
880
- const cp = require$$0$2;
885
+ const cp = require$$0$1;
881
886
  const parse = parse_1;
882
887
  const enoent = enoent$1;
883
888
 
@@ -908,12 +913,15 @@ function spawnSync(command, args, options) {
908
913
  return result;
909
914
  }
910
915
 
911
- crossSpawn.exports = spawn;
912
- crossSpawn.exports.spawn = spawn;
913
- crossSpawn.exports.sync = spawnSync;
916
+ crossSpawn$1.exports = spawn;
917
+ crossSpawn$1.exports.spawn = spawn;
918
+ crossSpawn$1.exports.sync = spawnSync;
914
919
 
915
- crossSpawn.exports._parse = parse;
916
- crossSpawn.exports._enoent = enoent;
920
+ crossSpawn$1.exports._parse = parse;
921
+ crossSpawn$1.exports._enoent = enoent;
922
+
923
+ var crossSpawnExports = crossSpawn$1.exports;
924
+ var crossSpawn = /*@__PURE__*/getDefaultExportFromCjs(crossSpawnExports);
917
925
 
918
926
  function stripFinalNewline(input) {
919
927
  const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
@@ -1679,7 +1687,7 @@ const setExitHandler = async (spawned, {cleanup, detached}, timedPromise) => {
1679
1687
  return timedPromise;
1680
1688
  }
1681
1689
 
1682
- const removeExitHandler = signalExit.exports(() => {
1690
+ const removeExitHandler = onExit(() => {
1683
1691
  spawned.kill();
1684
1692
  });
1685
1693
 
@@ -1740,9 +1748,9 @@ const addPipeMethods = spawned => {
1740
1748
  }
1741
1749
  };
1742
1750
 
1743
- var getStream$1 = {exports: {}};
1751
+ var getStream$2 = {exports: {}};
1744
1752
 
1745
- const {PassThrough: PassThroughStream} = require$$0$3;
1753
+ const {PassThrough: PassThroughStream} = require$$0$2;
1746
1754
 
1747
1755
  var bufferStream$1 = options => {
1748
1756
  options = {...options};
@@ -1794,9 +1802,9 @@ var bufferStream$1 = options => {
1794
1802
  return stream;
1795
1803
  };
1796
1804
 
1797
- const {constants: BufferConstants} = require$$0$5;
1798
- const stream = require$$0$3;
1799
- const {promisify} = require$$0$4;
1805
+ const {constants: BufferConstants} = require$$0$3;
1806
+ const stream = require$$0$2;
1807
+ const {promisify} = require$$2$1;
1800
1808
  const bufferStream = bufferStream$1;
1801
1809
 
1802
1810
  const streamPipelinePromisified = promisify(stream.pipeline);
@@ -1850,12 +1858,15 @@ async function getStream(inputStream, options) {
1850
1858
  return stream.getBufferedValue();
1851
1859
  }
1852
1860
 
1853
- getStream$1.exports = getStream;
1854
- getStream$1.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
1855
- getStream$1.exports.array = (stream, options) => getStream(stream, {...options, array: true});
1856
- getStream$1.exports.MaxBufferError = MaxBufferError;
1861
+ getStream$2.exports = getStream;
1862
+ getStream$2.exports.buffer = (stream, options) => getStream(stream, {...options, encoding: 'buffer'});
1863
+ getStream$2.exports.array = (stream, options) => getStream(stream, {...options, array: true});
1864
+ getStream$2.exports.MaxBufferError = MaxBufferError;
1865
+
1866
+ var getStreamExports = getStream$2.exports;
1867
+ var getStream$1 = /*@__PURE__*/getDefaultExportFromCjs(getStreamExports);
1857
1868
 
1858
- const { PassThrough } = require$$0$3;
1869
+ const { PassThrough } = require$$0$2;
1859
1870
 
1860
1871
  var mergeStream = function (/*streams...*/) {
1861
1872
  var sources = [];
@@ -1895,6 +1906,8 @@ var mergeStream = function (/*streams...*/) {
1895
1906
  }
1896
1907
  };
1897
1908
 
1909
+ var mergeStream$1 = /*@__PURE__*/getDefaultExportFromCjs(mergeStream);
1910
+
1898
1911
  const validateInputOptions = input => {
1899
1912
  if (input !== undefined) {
1900
1913
  throw new TypeError('The `input` and `inputFile` options cannot be both set.');
@@ -1931,7 +1944,7 @@ const makeAllStream = (spawned, {all}) => {
1931
1944
  return;
1932
1945
  }
1933
1946
 
1934
- const mixed = mergeStream();
1947
+ const mixed = mergeStream$1();
1935
1948
 
1936
1949
  if (spawned.stdout) {
1937
1950
  mixed.add(spawned.stdout);
@@ -1966,10 +1979,10 @@ const getStreamPromise = (stream, {encoding, buffer, maxBuffer}) => {
1966
1979
  }
1967
1980
 
1968
1981
  if (encoding) {
1969
- return getStream$1.exports(stream, {encoding, maxBuffer});
1982
+ return getStream$1(stream, {encoding, maxBuffer});
1970
1983
  }
1971
1984
 
1972
- return getStream$1.exports.buffer(stream, {maxBuffer});
1985
+ return getStream$1.buffer(stream, {maxBuffer});
1973
1986
  };
1974
1987
 
1975
1988
  // Retrieve result of child process: exit code, signal, error, streams (stdout/stderr/all)
@@ -2080,7 +2093,7 @@ const getEnv = ({env: envOption, extendEnv, preferLocal, localDir, execPath}) =>
2080
2093
  };
2081
2094
 
2082
2095
  const handleArguments = (file, args, options = {}) => {
2083
- const parsed = crossSpawn.exports._parse(file, args, options);
2096
+ const parsed = crossSpawn._parse(file, args, options);
2084
2097
  file = parsed.command;
2085
2098
  args = parsed.args;
2086
2099
  options = parsed.options;
@@ -2220,4 +2233,4 @@ function execa(file, args, options) {
2220
2233
  return spawned;
2221
2234
  }
2222
2235
 
2223
- export { crossSpawn as c, execa as e, getStream$1 as g, mergeStream as m, pathKey$2 as p, signalExit as s };
2236
+ export { crossSpawnExports as c, execa as e, getStreamExports as g, mergeStream as m, onExit as o, pathKeyExports as p, signalExitExports as s };
@@ -41,4 +41,4 @@ function removeUndefinedValues(obj) {
41
41
  return obj;
42
42
  }
43
43
 
44
- export { removeUndefinedValues as a, isWindows as b, resetModules as c, isRunningInBenchmark as d, isNode as i, relativePath as r };
44
+ export { isNode as a, relativePath as b, removeUndefinedValues as c, isWindows as d, isRunningInBenchmark as i, resetModules as r };
@@ -1,6 +1,6 @@
1
1
  import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, suite, test } from '@vitest/runner';
2
- import { e as bench, c as createExpect, d as globalExpect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.74cf3ef7.js';
3
- import { i as isFirstRun, a as runOnce } from './vendor-run-once.69ce7172.js';
2
+ import { e as bench, c as createExpect, d as globalExpect, s as setupChaiConfig, v as vi, f as vitest } from './vendor-vi.dd6706cb.js';
3
+ import { i as isFirstRun, r as runOnce } from './vendor-run-once.1fa85ba7.js';
4
4
  import * as chai from 'chai';
5
5
  import { assert, should } from 'chai';
6
6
 
@@ -47,9 +47,11 @@ var dist = {};
47
47
  'not',
48
48
  'items',
49
49
  'constructorParameters',
50
+ 'thisParameter',
50
51
  'instance',
51
52
  'guards',
52
53
  'asserts',
54
+ 'branded',
53
55
  ];
54
56
  const obj = {
55
57
  /* eslint-disable mmkal/@typescript-eslint/no-unsafe-assignment */
@@ -81,7 +83,7 @@ var dist = {};
81
83
  getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) }));
82
84
  return obj;
83
85
  };
84
- exports.expectTypeOf = expectTypeOf;
86
+ exports.expectTypeOf = expectTypeOf;
85
87
  } (dist));
86
88
 
87
89
  function noop() {
@@ -1,21 +1,4 @@
1
- import { c as commonjsGlobal } from './vendor-_commonjsHelpers.76cdd49e.js';
2
-
3
- function _mergeNamespaces(n, m) {
4
- m.forEach(function (e) {
5
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
- if (k !== 'default' && !(k in n)) {
7
- var d = Object.getOwnPropertyDescriptor(e, k);
8
- Object.defineProperty(n, k, d.get ? d : {
9
- enumerable: true,
10
- get: function () { return e[k]; }
11
- });
12
- }
13
- });
14
- });
15
- return Object.freeze(n);
16
- }
17
-
18
- var eventTargetPolyfill = {};
1
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.7d1333e8.js';
19
2
 
20
3
  const root =
21
4
  (typeof globalThis !== "undefined" && globalThis) ||
@@ -139,9 +122,8 @@ if (typeof root.EventTarget === "undefined" || !isConstructor(root.Event)) {
139
122
  })();
140
123
  }
141
124
 
142
- var index = /*#__PURE__*/_mergeNamespaces({
143
- __proto__: null,
144
- default: eventTargetPolyfill
145
- }, [eventTargetPolyfill]);
125
+ var index = /*#__PURE__*/Object.freeze({
126
+ __proto__: null
127
+ });
146
128
 
147
129
  export { index as i };
@@ -88,6 +88,7 @@ function getEnvironmentTransformMode(config, environment) {
88
88
  return environment === "happy-dom" || environment === "jsdom" ? "web" : "ssr";
89
89
  }
90
90
  class AggregateErrorPonyfill extends Error {
91
+ errors;
91
92
  constructor(errors, message = "") {
92
93
  super(message);
93
94
  this.errors = [...errors];
@@ -185,4 +186,4 @@ function nanoid(size = 21) {
185
186
  return id;
186
187
  }
187
188
 
188
- export { AggregateErrorPonyfill as A, getEnvironmentTransformMode as a, stdout as b, createBirpc as c, deepMerge as d, getAllMockableProperties as e, groupBy as g, isPrimitive as i, noop as n, slash as s, toArray as t };
189
+ export { AggregateErrorPonyfill as A, groupBy as a, getEnvironmentTransformMode as b, createBirpc as c, deepMerge as d, stdout as e, getAllMockableProperties as g, isPrimitive as i, noop as n, slash as s, toArray as t };
@@ -2,33 +2,33 @@ import { getSafeTimers } from '@vitest/utils';
2
2
  import { g as getWorkerState } from './vendor-global.6795f91f.js';
3
3
 
4
4
  const { get } = Reflect;
5
- const safeRandom = Math.random;
6
5
  function withSafeTimers(fn) {
6
+ var _a;
7
7
  const { setTimeout, clearTimeout, nextTick, setImmediate, clearImmediate } = getSafeTimers();
8
8
  const currentSetTimeout = globalThis.setTimeout;
9
9
  const currentClearTimeout = globalThis.clearTimeout;
10
- const currentRandom = globalThis.Math.random;
11
- const currentNextTick = globalThis.process.nextTick;
12
10
  const currentSetImmediate = globalThis.setImmediate;
13
11
  const currentClearImmediate = globalThis.clearImmediate;
12
+ const currentNextTick = (_a = globalThis.process) == null ? void 0 : _a.nextTick;
14
13
  try {
15
14
  globalThis.setTimeout = setTimeout;
16
15
  globalThis.clearTimeout = clearTimeout;
17
- globalThis.Math.random = safeRandom;
18
- globalThis.process.nextTick = nextTick;
19
16
  globalThis.setImmediate = setImmediate;
20
17
  globalThis.clearImmediate = clearImmediate;
18
+ if (globalThis.process)
19
+ globalThis.process.nextTick = nextTick;
21
20
  const result = fn();
22
21
  return result;
23
22
  } finally {
24
23
  globalThis.setTimeout = currentSetTimeout;
25
24
  globalThis.clearTimeout = currentClearTimeout;
26
- globalThis.Math.random = currentRandom;
27
25
  globalThis.setImmediate = currentSetImmediate;
28
26
  globalThis.clearImmediate = currentClearImmediate;
29
- nextTick(() => {
30
- globalThis.process.nextTick = currentNextTick;
31
- });
27
+ if (globalThis.process) {
28
+ nextTick(() => {
29
+ globalThis.process.nextTick = currentNextTick;
30
+ });
31
+ }
32
32
  }
33
33
  }
34
34
  const promises = /* @__PURE__ */ new Set();
@@ -58,4 +58,4 @@ function rpc() {
58
58
  });
59
59
  }
60
60
 
61
- export { rpcDone as a, rpc as r };
61
+ export { rpc as a, rpcDone as r };
@@ -1,4 +1,4 @@
1
- import './vendor-index.fad2598b.js';
1
+ import './vendor-index.23ac4e13.js';
2
2
  import { g as getWorkerState } from './vendor-global.6795f91f.js';
3
3
 
4
4
  const filesCount = /* @__PURE__ */ new Map();
@@ -25,4 +25,4 @@ function resetRunOnceCounter() {
25
25
  filesCount.clear();
26
26
  }
27
27
 
28
- export { runOnce as a, isFirstRun as i, resetRunOnceCounter as r };
28
+ export { resetRunOnceCounter as a, isFirstRun as i, runOnce as r };