vitest 2.1.0-beta.5 → 2.1.0-beta.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/LICENSE.md +59 -320
- package/dist/browser.d.ts +6 -3
- package/dist/browser.js +2 -2
- package/dist/chunks/{RandomSequencer.B4M2ux5b.js → RandomSequencer.Bh5-tlNJ.js} +77 -58
- package/dist/chunks/{base.BH-FAiX7.js → base.BlXpj3e_.js} +1 -29
- package/dist/chunks/{base.BYvKfYzm.js → base.CchlWrnV.js} +2 -4
- package/dist/chunks/{cac.DosbLiJg.js → cac.B5XYKv2_.js} +26 -17
- package/dist/chunks/{cli-api.D8zgNrBU.js → cli-api.ByZPnilx.js} +7419 -7959
- package/dist/chunks/{constants.CaAN7icJ.js → constants.fzPh7AOq.js} +1 -1
- package/dist/chunks/{coverage.CqfT4xaf.js → coverage.zlNdAMHK.js} +5 -3
- package/dist/chunks/{creator.COdKw_ZN.js → creator.zfBZSJzo.js} +9 -9
- package/dist/chunks/{environment.0M5R1SX_.d.ts → environment.C5eAp3K6.d.ts} +1 -1
- package/dist/chunks/{execute.DT9BA6zp.js → execute._eQQfgI8.js} +322 -232
- package/dist/chunks/{git.ZtkbKc8u.js → git.B5SDxu-n.js} +5 -5
- package/dist/chunks/{globals.DRPLtPOv.js → globals.jM7MxN2t.js} +4 -4
- package/dist/chunks/{index.CM5UI-4O.js → index.Bn75ITYg.js} +3 -3
- package/dist/chunks/index.CPD77dLA.js +133 -0
- package/dist/chunks/{index.CxWPpGJz.js → index.CSjyR2-v.js} +2 -2
- package/dist/chunks/{index.Dx3f477d.js → index.DpJO1tkB.js} +1110 -1104
- package/dist/chunks/{index.CNZXZ9PJ.js → index.xm8OIiKD.js} +1 -1
- package/dist/chunks/mocker.cRtM890J.d.ts +17 -0
- package/dist/chunks/{reporters.DbwOGCsU.d.ts → reporters.WnPwkmgA.d.ts} +154 -129
- package/dist/chunks/{resolveConfig.RHsAM2_Q.js → resolveConfig.-K5hHm0S.js} +56 -34
- package/dist/chunks/{runBaseTests.BAhL8UH_.js → runBaseTests.Cztfoflv.js} +7 -7
- package/dist/chunks/{setup-common.KBrCO5LJ.js → setup-common.fGBFoQKJ.js} +1 -1
- package/dist/chunks/{utils.C3_cBsyn.js → utils.Cn0zI1t3.js} +16 -3
- package/dist/chunks/{utils.DO38lwfj.js → utils.Dbnmsfq1.js} +1 -1
- package/dist/chunks/{vi.B6QZ938s.js → vi.DGgiNzJE.js} +46 -37
- package/dist/chunks/vite.D2yAwzwa.d.ts +11 -0
- package/dist/chunks/{vm.kl9T_5ai.js → vm.CPXwWp4C.js} +1 -2
- package/dist/chunks/{worker.Cx2xE71X.d.ts → worker.Bws9Zuxu.d.ts} +1 -1
- package/dist/chunks/{worker.BANO5ak1.d.ts → worker.CmPmTxgH.d.ts} +2 -14
- package/dist/cli.js +3 -3
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +70 -2
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +4 -3
- package/dist/coverage.js +29 -5
- package/dist/environments.d.ts +2 -2
- package/dist/execute.d.ts +13 -14
- package/dist/execute.js +3 -2
- package/dist/index.d.ts +23 -16
- package/dist/index.js +4 -4
- package/dist/mocker.d.ts +1 -0
- package/dist/mocker.js +1 -0
- package/dist/node.d.ts +27 -9
- package/dist/node.js +44 -39
- package/dist/reporters.d.ts +2 -2
- package/dist/reporters.js +8 -8
- package/dist/runners.js +2 -2
- package/dist/utils.d.ts +1 -0
- package/dist/worker.js +3 -2
- package/dist/workers/forks.js +5 -4
- package/dist/workers/runVmTests.js +6 -6
- package/dist/workers/threads.js +5 -4
- package/dist/workers/vmForks.js +4 -4
- package/dist/workers/vmThreads.js +4 -4
- package/dist/workers.d.ts +4 -16
- package/dist/workers.js +6 -5
- package/mocker.d.ts +1 -0
- package/package.json +22 -17
- package/dist/chunks/index.DNUmWFkO.js +0 -319
package/dist/workers/forks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.
|
|
3
|
-
import { r as runBaseTests } from '../chunks/base.
|
|
2
|
+
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.Cn0zI1t3.js';
|
|
3
|
+
import { r as runBaseTests } from '../chunks/base.CchlWrnV.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'vite-node/client';
|
|
6
6
|
import '../chunks/utils.Ck2hJTRs.js';
|
|
7
|
-
import '../chunks/execute.
|
|
7
|
+
import '../chunks/execute._eQQfgI8.js';
|
|
8
8
|
import 'node:vm';
|
|
9
9
|
import 'node:url';
|
|
10
10
|
import 'node:fs';
|
|
@@ -12,7 +12,8 @@ import 'vite-node/utils';
|
|
|
12
12
|
import 'pathe';
|
|
13
13
|
import '@vitest/utils/error';
|
|
14
14
|
import '../path.js';
|
|
15
|
-
import '
|
|
15
|
+
import '@vitest/mocker';
|
|
16
|
+
import 'node:module';
|
|
16
17
|
|
|
17
18
|
class ForksBaseWorker {
|
|
18
19
|
getRpcOptions() {
|
|
@@ -5,11 +5,11 @@ import { performance } from 'node:perf_hooks';
|
|
|
5
5
|
import { startTests, collectTests } from '@vitest/runner';
|
|
6
6
|
import { installSourcemapsSupport } from 'vite-node/source-map';
|
|
7
7
|
import { KNOWN_ASSET_TYPES } from 'vite-node/constants';
|
|
8
|
-
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/index.
|
|
9
|
-
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../chunks/coverage.
|
|
10
|
-
import { V as VitestIndex } from '../chunks/index.
|
|
8
|
+
import { s as setupChaiConfig, r as resolveTestRunner, a as resolveSnapshotEnvironment } from '../chunks/index.CSjyR2-v.js';
|
|
9
|
+
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../chunks/coverage.zlNdAMHK.js';
|
|
10
|
+
import { V as VitestIndex } from '../chunks/index.xm8OIiKD.js';
|
|
11
11
|
import { g as getWorkerState } from '../chunks/utils.Ck2hJTRs.js';
|
|
12
|
-
import { s as setupCommonEnv } from '../chunks/setup-common.
|
|
12
|
+
import { s as setupCommonEnv } from '../chunks/setup-common.fGBFoQKJ.js';
|
|
13
13
|
import { c as closeInspector } from '../chunks/inspector.70d6emsh.js';
|
|
14
14
|
import 'chai';
|
|
15
15
|
import 'pathe';
|
|
@@ -24,14 +24,14 @@ import '../chunks/index.CxRxs566.js';
|
|
|
24
24
|
import '../chunks/env.CmHVDJnw.js';
|
|
25
25
|
import 'std-env';
|
|
26
26
|
import '../chunks/run-once.Sxe67Wng.js';
|
|
27
|
-
import '../chunks/vi.
|
|
27
|
+
import '../chunks/vi.DGgiNzJE.js';
|
|
28
28
|
import '../chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
29
29
|
import '@vitest/expect';
|
|
30
30
|
import '@vitest/snapshot';
|
|
31
31
|
import '@vitest/utils/error';
|
|
32
32
|
import '../chunks/tasks.BZnCS9aT.js';
|
|
33
33
|
import '@vitest/utils/source-map';
|
|
34
|
-
import '../chunks/base.
|
|
34
|
+
import '../chunks/base.BlXpj3e_.js';
|
|
35
35
|
import '../chunks/date.W2xKR2qe.js';
|
|
36
36
|
import '@vitest/spy';
|
|
37
37
|
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../chunks/base.
|
|
2
|
-
import { a as createThreadsRpcOptions } from '../chunks/utils.
|
|
1
|
+
import { r as runBaseTests } from '../chunks/base.CchlWrnV.js';
|
|
2
|
+
import { a as createThreadsRpcOptions } from '../chunks/utils.Cn0zI1t3.js';
|
|
3
3
|
import 'vite-node/client';
|
|
4
4
|
import '../chunks/utils.Ck2hJTRs.js';
|
|
5
|
-
import '../chunks/execute.
|
|
5
|
+
import '../chunks/execute._eQQfgI8.js';
|
|
6
6
|
import 'node:vm';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:fs';
|
|
@@ -11,7 +11,8 @@ import 'pathe';
|
|
|
11
11
|
import '@vitest/utils/error';
|
|
12
12
|
import '../path.js';
|
|
13
13
|
import '@vitest/utils';
|
|
14
|
-
import '
|
|
14
|
+
import '@vitest/mocker';
|
|
15
|
+
import 'node:module';
|
|
15
16
|
|
|
16
17
|
class ThreadsBaseWorker {
|
|
17
18
|
getRpcOptions(ctx) {
|
package/dist/workers/vmForks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
|
-
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.
|
|
3
|
-
import { r as runVmTests } from '../chunks/vm.
|
|
2
|
+
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.Cn0zI1t3.js';
|
|
3
|
+
import { r as runVmTests } from '../chunks/vm.CPXwWp4C.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'node:vm';
|
|
6
6
|
import 'node:url';
|
|
@@ -15,13 +15,13 @@ import '@vitest/runner/utils';
|
|
|
15
15
|
import '../chunks/utils.Ck2hJTRs.js';
|
|
16
16
|
import '../chunks/env.CmHVDJnw.js';
|
|
17
17
|
import 'std-env';
|
|
18
|
-
import '../chunks/execute.
|
|
18
|
+
import '../chunks/execute._eQQfgI8.js';
|
|
19
19
|
import 'node:fs';
|
|
20
20
|
import 'vite-node/client';
|
|
21
21
|
import 'vite-node/utils';
|
|
22
22
|
import '@vitest/utils/error';
|
|
23
23
|
import '../path.js';
|
|
24
|
-
import '
|
|
24
|
+
import '@vitest/mocker';
|
|
25
25
|
import 'node:module';
|
|
26
26
|
import 'vite-node/constants';
|
|
27
27
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createThreadsRpcOptions } from '../chunks/utils.
|
|
2
|
-
import { r as runVmTests } from '../chunks/vm.
|
|
1
|
+
import { a as createThreadsRpcOptions } from '../chunks/utils.Cn0zI1t3.js';
|
|
2
|
+
import { r as runVmTests } from '../chunks/vm.CPXwWp4C.js';
|
|
3
3
|
import '@vitest/utils';
|
|
4
4
|
import 'node:vm';
|
|
5
5
|
import 'node:url';
|
|
@@ -14,13 +14,13 @@ import '@vitest/runner/utils';
|
|
|
14
14
|
import '../chunks/utils.Ck2hJTRs.js';
|
|
15
15
|
import '../chunks/env.CmHVDJnw.js';
|
|
16
16
|
import 'std-env';
|
|
17
|
-
import '../chunks/execute.
|
|
17
|
+
import '../chunks/execute._eQQfgI8.js';
|
|
18
18
|
import 'node:fs';
|
|
19
19
|
import 'vite-node/client';
|
|
20
20
|
import 'vite-node/utils';
|
|
21
21
|
import '@vitest/utils/error';
|
|
22
22
|
import '../path.js';
|
|
23
|
-
import '
|
|
23
|
+
import '@vitest/mocker';
|
|
24
24
|
import 'node:module';
|
|
25
25
|
import 'vite-node/constants';
|
|
26
26
|
|
package/dist/workers.d.ts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import * as v8 from 'v8';
|
|
2
2
|
import { S as SerializedConfig } from './chunks/config.CHuotKvS.js';
|
|
3
|
-
import './chunks/
|
|
4
|
-
import { W as
|
|
5
|
-
import { B as BirpcOptions, R as RuntimeRPC, C as ContextRPC, W as WorkerGlobalState } from './chunks/worker.BANO5ak1.js';
|
|
3
|
+
import { W as WorkerContext } from './chunks/worker.Bws9Zuxu.js';
|
|
4
|
+
import { B as BirpcOptions, R as RuntimeRPC, C as ContextRPC, W as WorkerGlobalState } from './chunks/worker.CmPmTxgH.js';
|
|
6
5
|
import { Awaitable } from '@vitest/utils';
|
|
7
6
|
import '@vitest/pretty-format';
|
|
8
7
|
import '@vitest/runner';
|
|
9
8
|
import '@vitest/snapshot';
|
|
10
9
|
import '@vitest/snapshot/environment';
|
|
11
|
-
import 'vite';
|
|
12
|
-
import 'vite-node';
|
|
13
|
-
import './chunks/environment.0M5R1SX_.js';
|
|
14
|
-
import 'node:stream';
|
|
15
|
-
import 'vite-node/client';
|
|
16
|
-
import '@vitest/snapshot/manager';
|
|
17
|
-
import 'vite-node/server';
|
|
18
|
-
import '@vitest/utils/source-map';
|
|
19
|
-
import 'node:fs';
|
|
20
|
-
import 'chai';
|
|
21
|
-
import './chunks/benchmark.puBFxyfE.js';
|
|
22
|
-
import '@vitest/runner/utils';
|
|
23
|
-
import 'tinybench';
|
|
24
10
|
import 'node:worker_threads';
|
|
11
|
+
import 'vite-node';
|
|
12
|
+
import './chunks/environment.C5eAp3K6.js';
|
|
25
13
|
|
|
26
14
|
type WorkerRpcOptions = Pick<BirpcOptions<RuntimeRPC>, 'on' | 'post' | 'serialize' | 'deserialize'>;
|
|
27
15
|
interface VitestWorker {
|
package/dist/workers.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './chunks/utils.
|
|
1
|
+
export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSerializableConfig } from './chunks/utils.Cn0zI1t3.js';
|
|
2
2
|
export { p as provideWorkerState } from './chunks/utils.Ck2hJTRs.js';
|
|
3
3
|
export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
|
|
4
|
-
export { r as runVmTests } from './chunks/vm.
|
|
5
|
-
export { r as runBaseTests } from './chunks/base.
|
|
4
|
+
export { r as runVmTests } from './chunks/vm.CPXwWp4C.js';
|
|
5
|
+
export { r as runBaseTests } from './chunks/base.CchlWrnV.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'tinypool';
|
|
@@ -11,7 +11,7 @@ import 'node:fs';
|
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import './chunks/index.lVXYBqEP.js';
|
|
13
13
|
import 'node:console';
|
|
14
|
-
import './chunks/base.
|
|
14
|
+
import './chunks/base.BlXpj3e_.js';
|
|
15
15
|
import './chunks/inspector.70d6emsh.js';
|
|
16
16
|
import 'node:module';
|
|
17
17
|
import './chunks/rpc.B7Mfb-Yf.js';
|
|
@@ -25,8 +25,9 @@ import './chunks/date.W2xKR2qe.js';
|
|
|
25
25
|
import '@vitest/runner/utils';
|
|
26
26
|
import './chunks/env.CmHVDJnw.js';
|
|
27
27
|
import 'std-env';
|
|
28
|
-
import './chunks/execute.
|
|
28
|
+
import './chunks/execute._eQQfgI8.js';
|
|
29
29
|
import 'vite-node/utils';
|
|
30
30
|
import '@vitest/utils/error';
|
|
31
31
|
import './path.js';
|
|
32
|
+
import '@vitest/mocker';
|
|
32
33
|
import 'vite-node/constants';
|
package/mocker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/mocker.js'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.0-beta.
|
|
4
|
+
"version": "2.1.0-beta.7",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -94,6 +94,10 @@
|
|
|
94
94
|
"./snapshot": {
|
|
95
95
|
"types": "./dist/snapshot.d.ts",
|
|
96
96
|
"default": "./dist/snapshot.js"
|
|
97
|
+
},
|
|
98
|
+
"./mocker": {
|
|
99
|
+
"types": "./dist/mocker.d.ts",
|
|
100
|
+
"default": "./dist/mocker.js"
|
|
97
101
|
}
|
|
98
102
|
},
|
|
99
103
|
"main": "./dist/index.js",
|
|
@@ -118,8 +122,8 @@
|
|
|
118
122
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
119
123
|
"happy-dom": "*",
|
|
120
124
|
"jsdom": "*",
|
|
121
|
-
"@vitest/ui": "2.1.0-beta.
|
|
122
|
-
"@vitest/browser": "2.1.0-beta.
|
|
125
|
+
"@vitest/ui": "2.1.0-beta.7",
|
|
126
|
+
"@vitest/browser": "2.1.0-beta.7"
|
|
123
127
|
},
|
|
124
128
|
"peerDependenciesMeta": {
|
|
125
129
|
"@edge-runtime/vm": {
|
|
@@ -142,28 +146,29 @@
|
|
|
142
146
|
}
|
|
143
147
|
},
|
|
144
148
|
"dependencies": {
|
|
145
|
-
"@ampproject/remapping": "^2.3.0",
|
|
146
149
|
"chai": "^5.1.1",
|
|
147
150
|
"debug": "^4.3.6",
|
|
148
|
-
"execa": "^8.0.1",
|
|
149
151
|
"magic-string": "^0.30.11",
|
|
150
152
|
"pathe": "^1.1.2",
|
|
151
153
|
"std-env": "^3.7.0",
|
|
152
154
|
"tinybench": "^2.9.0",
|
|
155
|
+
"tinyexec": "^0.3.0",
|
|
153
156
|
"tinypool": "^1.0.0",
|
|
154
157
|
"tinyrainbow": "^1.2.0",
|
|
155
158
|
"vite": "^5.0.0",
|
|
156
159
|
"why-is-node-running": "^2.3.0",
|
|
157
|
-
"@vitest/expect": "2.1.0-beta.
|
|
158
|
-
"@vitest/
|
|
159
|
-
"@vitest/
|
|
160
|
-
"@vitest/
|
|
161
|
-
"@vitest/
|
|
162
|
-
"
|
|
163
|
-
"@vitest/
|
|
160
|
+
"@vitest/expect": "2.1.0-beta.7",
|
|
161
|
+
"@vitest/mocker": "2.1.0-beta.7",
|
|
162
|
+
"@vitest/pretty-format": "^2.1.0-beta.7",
|
|
163
|
+
"@vitest/snapshot": "2.1.0-beta.7",
|
|
164
|
+
"@vitest/spy": "2.1.0-beta.7",
|
|
165
|
+
"@vitest/utils": "2.1.0-beta.7",
|
|
166
|
+
"@vitest/runner": "2.1.0-beta.7",
|
|
167
|
+
"vite-node": "2.1.0-beta.7"
|
|
164
168
|
},
|
|
165
169
|
"devDependencies": {
|
|
166
|
-
"@
|
|
170
|
+
"@ampproject/remapping": "^2.3.0",
|
|
171
|
+
"@antfu/install-pkg": "^0.4.1",
|
|
167
172
|
"@edge-runtime/vm": "^4.0.1",
|
|
168
173
|
"@sinonjs/fake-timers": "11.1.0",
|
|
169
174
|
"@types/debug": "^4.1.12",
|
|
@@ -172,7 +177,7 @@
|
|
|
172
177
|
"@types/istanbul-reports": "^3.0.4",
|
|
173
178
|
"@types/jsdom": "^21.1.7",
|
|
174
179
|
"@types/micromatch": "^4.0.9",
|
|
175
|
-
"@types/node": "^
|
|
180
|
+
"@types/node": "^22.5.2",
|
|
176
181
|
"@types/prompts": "^2.4.9",
|
|
177
182
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
178
183
|
"acorn-walk": "^8.3.3",
|
|
@@ -181,12 +186,11 @@
|
|
|
181
186
|
"chai-subset": "^1.6.0",
|
|
182
187
|
"cli-truncate": "^4.0.0",
|
|
183
188
|
"expect-type": "^0.19.0",
|
|
184
|
-
"fast-glob": "^3.3.2",
|
|
185
189
|
"find-up": "^6.3.0",
|
|
186
190
|
"flatted": "^3.3.1",
|
|
187
191
|
"get-tsconfig": "^4.7.6",
|
|
188
|
-
"happy-dom": "^
|
|
189
|
-
"jsdom": "^
|
|
192
|
+
"happy-dom": "^15.7.3",
|
|
193
|
+
"jsdom": "^25.0.0",
|
|
190
194
|
"local-pkg": "^0.5.0",
|
|
191
195
|
"log-update": "^5.0.1",
|
|
192
196
|
"micromatch": "^4.0.7",
|
|
@@ -194,6 +198,7 @@
|
|
|
194
198
|
"prompts": "^2.4.2",
|
|
195
199
|
"strip-ansi": "^7.1.0",
|
|
196
200
|
"strip-literal": "^2.1.0",
|
|
201
|
+
"tinyglobby": "^0.2.6",
|
|
197
202
|
"ws": "^8.18.0"
|
|
198
203
|
},
|
|
199
204
|
"scripts": {
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import require$$0, { promises } from 'fs';
|
|
2
|
-
import p from 'path';
|
|
3
|
-
import process from 'process';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import { execa } from 'execa';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __publicField = (obj, key, value) => {
|
|
10
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11
|
-
return value;
|
|
12
|
-
};
|
|
13
|
-
var __accessCheck = (obj, member, msg) => {
|
|
14
|
-
if (!member.has(obj))
|
|
15
|
-
throw TypeError("Cannot " + msg);
|
|
16
|
-
};
|
|
17
|
-
var __privateGet = (obj, member, getter) => {
|
|
18
|
-
__accessCheck(obj, member, "read from private field");
|
|
19
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
20
|
-
};
|
|
21
|
-
var __privateAdd = (obj, member, value) => {
|
|
22
|
-
if (member.has(obj))
|
|
23
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
24
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
25
|
-
};
|
|
26
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
27
|
-
__accessCheck(obj, member, "write to private field");
|
|
28
|
-
member.set(obj, value);
|
|
29
|
-
return value;
|
|
30
|
-
};
|
|
31
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
32
|
-
set _(value) {
|
|
33
|
-
__privateSet(obj, member, value);
|
|
34
|
-
},
|
|
35
|
-
get _() {
|
|
36
|
-
return __privateGet(obj, member, getter);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
|
|
41
|
-
var Node = class {
|
|
42
|
-
constructor(value) {
|
|
43
|
-
__publicField(this, "value");
|
|
44
|
-
__publicField(this, "next");
|
|
45
|
-
this.value = value;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var _head, _tail, _size;
|
|
49
|
-
var Queue = class {
|
|
50
|
-
constructor() {
|
|
51
|
-
__privateAdd(this, _head, void 0);
|
|
52
|
-
__privateAdd(this, _tail, void 0);
|
|
53
|
-
__privateAdd(this, _size, void 0);
|
|
54
|
-
this.clear();
|
|
55
|
-
}
|
|
56
|
-
enqueue(value) {
|
|
57
|
-
const node = new Node(value);
|
|
58
|
-
if (__privateGet(this, _head)) {
|
|
59
|
-
__privateGet(this, _tail).next = node;
|
|
60
|
-
__privateSet(this, _tail, node);
|
|
61
|
-
} else {
|
|
62
|
-
__privateSet(this, _head, node);
|
|
63
|
-
__privateSet(this, _tail, node);
|
|
64
|
-
}
|
|
65
|
-
__privateWrapper(this, _size)._++;
|
|
66
|
-
}
|
|
67
|
-
dequeue() {
|
|
68
|
-
const current = __privateGet(this, _head);
|
|
69
|
-
if (!current) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
73
|
-
__privateWrapper(this, _size)._--;
|
|
74
|
-
return current.value;
|
|
75
|
-
}
|
|
76
|
-
clear() {
|
|
77
|
-
__privateSet(this, _head, void 0);
|
|
78
|
-
__privateSet(this, _tail, void 0);
|
|
79
|
-
__privateSet(this, _size, 0);
|
|
80
|
-
}
|
|
81
|
-
get size() {
|
|
82
|
-
return __privateGet(this, _size);
|
|
83
|
-
}
|
|
84
|
-
*[Symbol.iterator]() {
|
|
85
|
-
let current = __privateGet(this, _head);
|
|
86
|
-
while (current) {
|
|
87
|
-
yield current.value;
|
|
88
|
-
current = current.next;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
_head = new WeakMap();
|
|
93
|
-
_tail = new WeakMap();
|
|
94
|
-
_size = new WeakMap();
|
|
95
|
-
|
|
96
|
-
// node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
|
|
97
|
-
function pLimit(concurrency) {
|
|
98
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
99
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
100
|
-
}
|
|
101
|
-
const queue = new Queue();
|
|
102
|
-
let activeCount = 0;
|
|
103
|
-
const next = () => {
|
|
104
|
-
activeCount--;
|
|
105
|
-
if (queue.size > 0) {
|
|
106
|
-
queue.dequeue()();
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const run = async (fn, resolve, args) => {
|
|
110
|
-
activeCount++;
|
|
111
|
-
const result = (async () => fn(...args))();
|
|
112
|
-
resolve(result);
|
|
113
|
-
try {
|
|
114
|
-
await result;
|
|
115
|
-
} catch {
|
|
116
|
-
}
|
|
117
|
-
next();
|
|
118
|
-
};
|
|
119
|
-
const enqueue = (fn, resolve, args) => {
|
|
120
|
-
queue.enqueue(run.bind(void 0, fn, resolve, args));
|
|
121
|
-
(async () => {
|
|
122
|
-
await Promise.resolve();
|
|
123
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
124
|
-
queue.dequeue()();
|
|
125
|
-
}
|
|
126
|
-
})();
|
|
127
|
-
};
|
|
128
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
129
|
-
enqueue(fn, resolve, args);
|
|
130
|
-
});
|
|
131
|
-
Object.defineProperties(generator, {
|
|
132
|
-
activeCount: {
|
|
133
|
-
get: () => activeCount
|
|
134
|
-
},
|
|
135
|
-
pendingCount: {
|
|
136
|
-
get: () => queue.size
|
|
137
|
-
},
|
|
138
|
-
clearQueue: {
|
|
139
|
-
value: () => {
|
|
140
|
-
queue.clear();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return generator;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
|
|
148
|
-
var EndError = class extends Error {
|
|
149
|
-
constructor(value) {
|
|
150
|
-
super();
|
|
151
|
-
this.value = value;
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
var testElement = async (element, tester) => tester(await element);
|
|
155
|
-
var finder = async (element) => {
|
|
156
|
-
const values = await Promise.all(element);
|
|
157
|
-
if (values[1] === true) {
|
|
158
|
-
throw new EndError(values[0]);
|
|
159
|
-
}
|
|
160
|
-
return false;
|
|
161
|
-
};
|
|
162
|
-
async function pLocate(iterable, tester, {
|
|
163
|
-
concurrency = Number.POSITIVE_INFINITY,
|
|
164
|
-
preserveOrder = true
|
|
165
|
-
} = {}) {
|
|
166
|
-
const limit = pLimit(concurrency);
|
|
167
|
-
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
168
|
-
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
169
|
-
try {
|
|
170
|
-
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
171
|
-
} catch (error) {
|
|
172
|
-
if (error instanceof EndError) {
|
|
173
|
-
return error.value;
|
|
174
|
-
}
|
|
175
|
-
throw error;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
|
|
180
|
-
var typeMappings = {
|
|
181
|
-
directory: "isDirectory",
|
|
182
|
-
file: "isFile"
|
|
183
|
-
};
|
|
184
|
-
function checkType(type) {
|
|
185
|
-
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
throw new Error(`Invalid type specified: ${type}`);
|
|
189
|
-
}
|
|
190
|
-
var matchType = (type, stat) => stat[typeMappings[type]]();
|
|
191
|
-
var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
192
|
-
async function locatePath(paths, {
|
|
193
|
-
cwd = process.cwd(),
|
|
194
|
-
type = "file",
|
|
195
|
-
allowSymlinks = true,
|
|
196
|
-
concurrency,
|
|
197
|
-
preserveOrder
|
|
198
|
-
} = {}) {
|
|
199
|
-
checkType(type);
|
|
200
|
-
cwd = toPath(cwd);
|
|
201
|
-
const statFunction = allowSymlinks ? promises.stat : promises.lstat;
|
|
202
|
-
return pLocate(paths, async (path_) => {
|
|
203
|
-
try {
|
|
204
|
-
const stat = await statFunction(p.resolve(cwd, path_));
|
|
205
|
-
return matchType(type, stat);
|
|
206
|
-
} catch {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
}, { concurrency, preserveOrder });
|
|
210
|
-
}
|
|
211
|
-
function toPath2(urlOrPath) {
|
|
212
|
-
return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
|
|
216
|
-
var findUpStop = Symbol("findUpStop");
|
|
217
|
-
async function findUpMultiple(name, options = {}) {
|
|
218
|
-
let directory = p.resolve(toPath2(options.cwd) ?? "");
|
|
219
|
-
const { root } = p.parse(directory);
|
|
220
|
-
const stopAt = p.resolve(directory, toPath2(options.stopAt ?? root));
|
|
221
|
-
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
222
|
-
const paths = [name].flat();
|
|
223
|
-
const runMatcher = async (locateOptions) => {
|
|
224
|
-
if (typeof name !== "function") {
|
|
225
|
-
return locatePath(paths, locateOptions);
|
|
226
|
-
}
|
|
227
|
-
const foundPath = await name(locateOptions.cwd);
|
|
228
|
-
if (typeof foundPath === "string") {
|
|
229
|
-
return locatePath([foundPath], locateOptions);
|
|
230
|
-
}
|
|
231
|
-
return foundPath;
|
|
232
|
-
};
|
|
233
|
-
const matches = [];
|
|
234
|
-
while (true) {
|
|
235
|
-
const foundPath = await runMatcher({ ...options, cwd: directory });
|
|
236
|
-
if (foundPath === findUpStop) {
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
if (foundPath) {
|
|
240
|
-
matches.push(p.resolve(directory, foundPath));
|
|
241
|
-
}
|
|
242
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
directory = p.dirname(directory);
|
|
246
|
-
}
|
|
247
|
-
return matches;
|
|
248
|
-
}
|
|
249
|
-
async function findUp(name, options = {}) {
|
|
250
|
-
const matches = await findUpMultiple(name, { ...options, limit: 1 });
|
|
251
|
-
return matches[0];
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// src/detect.ts
|
|
255
|
-
var AGENTS = ["pnpm", "yarn", "npm", "pnpm@6", "yarn@berry", "bun"];
|
|
256
|
-
var LOCKS = {
|
|
257
|
-
"bun.lockb": "bun",
|
|
258
|
-
"pnpm-lock.yaml": "pnpm",
|
|
259
|
-
"yarn.lock": "yarn",
|
|
260
|
-
"package-lock.json": "npm",
|
|
261
|
-
"npm-shrinkwrap.json": "npm"
|
|
262
|
-
};
|
|
263
|
-
async function detectPackageManager(cwd = process.cwd()) {
|
|
264
|
-
let agent = null;
|
|
265
|
-
const lockPath = await findUp(Object.keys(LOCKS), { cwd });
|
|
266
|
-
let packageJsonPath;
|
|
267
|
-
if (lockPath)
|
|
268
|
-
packageJsonPath = p.resolve(lockPath, "../package.json");
|
|
269
|
-
else
|
|
270
|
-
packageJsonPath = await findUp("package.json", { cwd });
|
|
271
|
-
if (packageJsonPath && require$$0.existsSync(packageJsonPath)) {
|
|
272
|
-
try {
|
|
273
|
-
const pkg = JSON.parse(require$$0.readFileSync(packageJsonPath, "utf8"));
|
|
274
|
-
if (typeof pkg.packageManager === "string") {
|
|
275
|
-
const [name, version] = pkg.packageManager.split("@");
|
|
276
|
-
if (name === "yarn" && Number.parseInt(version) > 1)
|
|
277
|
-
agent = "yarn@berry";
|
|
278
|
-
else if (name === "pnpm" && Number.parseInt(version) < 7)
|
|
279
|
-
agent = "pnpm@6";
|
|
280
|
-
else if (AGENTS.includes(name))
|
|
281
|
-
agent = name;
|
|
282
|
-
else
|
|
283
|
-
console.warn("[ni] Unknown packageManager:", pkg.packageManager);
|
|
284
|
-
}
|
|
285
|
-
} catch {
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (!agent && lockPath)
|
|
289
|
-
agent = LOCKS[p.basename(lockPath)];
|
|
290
|
-
return agent;
|
|
291
|
-
}
|
|
292
|
-
async function installPackage(names, options = {}) {
|
|
293
|
-
const detectedAgent = options.packageManager || await detectPackageManager(options.cwd) || "npm";
|
|
294
|
-
const [agent] = detectedAgent.split("@");
|
|
295
|
-
if (!Array.isArray(names))
|
|
296
|
-
names = [names];
|
|
297
|
-
const args = options.additionalArgs || [];
|
|
298
|
-
if (options.preferOffline) {
|
|
299
|
-
if (detectedAgent === "yarn@berry")
|
|
300
|
-
args.unshift("--cached");
|
|
301
|
-
else
|
|
302
|
-
args.unshift("--prefer-offline");
|
|
303
|
-
}
|
|
304
|
-
return execa(
|
|
305
|
-
agent,
|
|
306
|
-
[
|
|
307
|
-
agent === "yarn" ? "add" : "install",
|
|
308
|
-
options.dev ? "-D" : "",
|
|
309
|
-
...args,
|
|
310
|
-
...names
|
|
311
|
-
].filter(Boolean),
|
|
312
|
-
{
|
|
313
|
-
stdio: options.silent ? "ignore" : "inherit",
|
|
314
|
-
cwd: options.cwd
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export { detectPackageManager, installPackage };
|