vitest 2.1.0-beta.4 → 2.1.0-beta.6
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 +29 -0
- package/dist/browser.d.ts +4 -3
- package/dist/browser.js +2 -2
- package/dist/chunks/{RandomSequencer.B4M2ux5b.js → RandomSequencer.CjkAy_bL.js} +67 -21
- package/dist/chunks/{base.BYvKfYzm.js → base.B-9RAXb6.js} +1 -1
- package/dist/chunks/{cac.C8rwFluK.js → cac.BZlOqtiQ.js} +7 -6
- package/dist/chunks/{cli-api.Bej3bUwz.js → cli-api.B-2f6g4d.js} +7541 -7357
- 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.GreKbaUc.js → creator.D0TxjnLa.js} +27 -22
- package/dist/chunks/{environment.0M5R1SX_.d.ts → environment.C5eAp3K6.d.ts} +1 -1
- package/dist/chunks/{globals.DRPLtPOv.js → globals.Br36EZIp.js} +3 -3
- package/dist/chunks/{index.YuPJueCg.js → index.C4LZENmc.js} +4446 -4416
- package/dist/chunks/index.CWhwfxXK.js +835 -0
- package/dist/chunks/{index.CxWPpGJz.js → index.dWDhoZDV.js} +2 -2
- package/dist/chunks/{index.CNZXZ9PJ.js → index.m3Xip5Zz.js} +1 -1
- package/dist/chunks/{reporters.DRZ7ndzr.d.ts → reporters.B0Ao6Zu1.d.ts} +154 -117
- package/dist/chunks/{resolveConfig.CGobt8AB.js → resolveConfig.C0vpvVRF.js} +43 -33
- package/dist/chunks/{runBaseTests.BAhL8UH_.js → runBaseTests.Cf8lGnUq.js} +5 -5
- package/dist/chunks/{setup-common.KBrCO5LJ.js → setup-common.B7uEQsGB.js} +1 -1
- package/dist/chunks/{vi.B6QZ938s.js → vi.DBepMgvg.js} +9 -0
- package/dist/chunks/vite.Bvz2vSw0.d.ts +11 -0
- package/dist/chunks/{worker.BANO5ak1.d.ts → worker.CTdJUeeB.d.ts} +3 -2
- package/dist/chunks/{worker.Cx2xE71X.d.ts → worker.DTM-0OlZ.d.ts} +1 -1
- package/dist/cli.js +2 -2
- 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 +27 -3
- package/dist/environments.d.ts +2 -2
- package/dist/execute.d.ts +2 -2
- package/dist/index.d.ts +11 -6
- package/dist/index.js +3 -3
- package/dist/node.d.ts +17 -7
- package/dist/node.js +39 -36
- package/dist/reporters.d.ts +2 -2
- package/dist/reporters.js +5 -5
- package/dist/runners.js +1 -1
- package/dist/workers/forks.js +1 -1
- package/dist/workers/runVmTests.js +5 -5
- package/dist/workers/threads.js +1 -1
- package/dist/workers.d.ts +4 -16
- package/dist/workers.js +1 -1
- package/package.json +12 -12
- package/dist/chunks/index.DNUmWFkO.js +0 -319
package/dist/node.js
CHANGED
|
@@ -1,37 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
import { f as TestModule } from './chunks/index.C4LZENmc.js';
|
|
2
|
+
export { e as TestCase, i as TestProject, g as TestSuite } from './chunks/index.C4LZENmc.js';
|
|
3
|
+
export { G as GitNotFoundError, F as TestsNotFoundError, a as VitestPackageInstaller, V as VitestPlugin, c as createVitest, r as registerConsoleShortcuts, b as resolveFsAllow, s as startVitest } from './chunks/cli-api.B-2f6g4d.js';
|
|
4
|
+
export { p as parseCLI } from './chunks/cac.BZlOqtiQ.js';
|
|
5
|
+
export { c as createMethodsRPC, g as getFilePoolName, a as resolveApiServerConfig, b as resolveConfig } from './chunks/resolveConfig.C0vpvVRF.js';
|
|
4
6
|
import createDebug from 'debug';
|
|
5
7
|
export { distDir, rootDir } from './path.js';
|
|
6
|
-
export { B as BaseSequencer } from './chunks/RandomSequencer.
|
|
8
|
+
export { B as BaseSequencer } from './chunks/RandomSequencer.CjkAy_bL.js';
|
|
7
9
|
export { createServer, isFileServingAllowed, parseAst, parseAstAsync } from 'vite';
|
|
8
|
-
export { d as TestCase, e as TestFile, h as TestProject, f as TestSuite } from './chunks/index.YuPJueCg.js';
|
|
9
10
|
import 'node:fs';
|
|
11
|
+
import 'tinyrainbow';
|
|
10
12
|
import 'pathe';
|
|
11
|
-
import './chunks/
|
|
13
|
+
import './chunks/tasks.BZnCS9aT.js';
|
|
14
|
+
import '@vitest/runner/utils';
|
|
15
|
+
import '@vitest/utils';
|
|
16
|
+
import './chunks/env.CmHVDJnw.js';
|
|
17
|
+
import 'std-env';
|
|
18
|
+
import './chunks/utils.DO38lwfj.js';
|
|
19
|
+
import './chunks/base.BH-FAiX7.js';
|
|
20
|
+
import 'node:perf_hooks';
|
|
21
|
+
import '@vitest/utils/source-map';
|
|
22
|
+
import './chunks/index.CxRxs566.js';
|
|
23
|
+
import './chunks/utils.Ck2hJTRs.js';
|
|
24
|
+
import 'node:os';
|
|
25
|
+
import 'node:stream';
|
|
26
|
+
import 'node:console';
|
|
27
|
+
import 'node:process';
|
|
28
|
+
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
29
|
+
import 'assert';
|
|
30
|
+
import 'events';
|
|
31
|
+
import 'node:module';
|
|
32
|
+
import 'node:fs/promises';
|
|
33
|
+
import 'vite-node/utils';
|
|
34
|
+
import './chunks/coverage.zlNdAMHK.js';
|
|
12
35
|
import './chunks/index.CM5UI-4O.js';
|
|
13
36
|
import 'node:path';
|
|
14
37
|
import 'node:url';
|
|
15
|
-
import 'node:process';
|
|
16
|
-
import './chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
17
38
|
import 'readline';
|
|
18
|
-
import '
|
|
19
|
-
import './chunks/constants.CaAN7icJ.js';
|
|
20
|
-
import 'node:worker_threads';
|
|
21
|
-
import 'os';
|
|
22
|
-
import 'path';
|
|
23
|
-
import 'util';
|
|
24
|
-
import 'stream';
|
|
25
|
-
import 'fs';
|
|
39
|
+
import './chunks/constants.fzPh7AOq.js';
|
|
26
40
|
import 'vite-node/client';
|
|
27
41
|
import '@vitest/snapshot/manager';
|
|
28
42
|
import 'vite-node/server';
|
|
29
|
-
import '@vitest/runner/utils';
|
|
30
|
-
import './chunks/base.BH-FAiX7.js';
|
|
31
|
-
import '@vitest/utils';
|
|
32
|
-
import './chunks/env.CmHVDJnw.js';
|
|
33
|
-
import 'std-env';
|
|
34
43
|
import './chunks/index.BpSiYbpB.js';
|
|
44
|
+
import 'stream';
|
|
35
45
|
import 'zlib';
|
|
36
46
|
import 'buffer';
|
|
37
47
|
import 'crypto';
|
|
@@ -40,31 +50,22 @@ import 'http';
|
|
|
40
50
|
import 'net';
|
|
41
51
|
import 'tls';
|
|
42
52
|
import 'url';
|
|
43
|
-
import '
|
|
44
|
-
import '
|
|
45
|
-
import '
|
|
53
|
+
import 'os';
|
|
54
|
+
import 'path';
|
|
55
|
+
import 'util';
|
|
56
|
+
import 'fs';
|
|
46
57
|
import 'node:crypto';
|
|
47
|
-
import 'vite-node/utils';
|
|
48
58
|
import 'magic-string';
|
|
49
59
|
import '@vitest/utils/ast';
|
|
50
|
-
import 'node:
|
|
51
|
-
import 'tinyrainbow';
|
|
52
|
-
import './chunks/index.CxRxs566.js';
|
|
53
|
-
import './chunks/utils.Ck2hJTRs.js';
|
|
60
|
+
import 'node:worker_threads';
|
|
54
61
|
import 'node:readline';
|
|
55
|
-
import './chunks/utils.DO38lwfj.js';
|
|
56
62
|
import 'node:assert';
|
|
57
63
|
import 'node:v8';
|
|
58
64
|
import 'node:util';
|
|
59
65
|
import 'node:events';
|
|
60
66
|
import 'tinypool';
|
|
61
|
-
import 'node:perf_hooks';
|
|
62
67
|
import 'execa';
|
|
63
68
|
import 'module';
|
|
64
|
-
import './chunks/tasks.BZnCS9aT.js';
|
|
65
|
-
import 'node:stream';
|
|
66
|
-
import 'node:console';
|
|
67
|
-
import 'assert';
|
|
68
69
|
|
|
69
70
|
function createDebugger(namespace) {
|
|
70
71
|
const debug = createDebug(namespace);
|
|
@@ -73,4 +74,6 @@ function createDebugger(namespace) {
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
|
|
77
|
+
const TestFile = TestModule;
|
|
78
|
+
|
|
79
|
+
export { TestFile, TestModule, createDebugger };
|
package/dist/reporters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { az as BaseReporter, aq as BasicReporter, aJ as BenchmarkBuiltinReporters, aI as BenchmarkReportsMap, aE as BuiltinReporterOptions, aD as BuiltinReporters, ap as DefaultReporter, ar as DotReporter, aB as FileDiagnostic, ay as GithubActionsReporter, ax as HangingProcessReporter, av as JUnitReporter, aF as JsonAssertionResult, as as JsonReporter, aG as JsonTestResult, aH as JsonTestResults, q as Reporter, aC as ReportersMap, aw as TapFlatReporter, au as TapReporter, ai as TaskOptions, ae as TestCase, ah as TestCollection, aj as TestDiagnostic, aA as TestFile, N as TestModule, ag as TestProject, ak as TestResult, am as TestResultFailed, al as TestResultPassed, an as TestResultSkipped, af as TestSuite, at as VerboseReporter } from './chunks/reporters.B0Ao6Zu1.js';
|
|
2
2
|
import '@vitest/runner';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import '@vitest/pretty-format';
|
|
@@ -6,7 +6,7 @@ import './chunks/config.CHuotKvS.js';
|
|
|
6
6
|
import '@vitest/snapshot';
|
|
7
7
|
import '@vitest/snapshot/environment';
|
|
8
8
|
import 'vite-node';
|
|
9
|
-
import './chunks/environment.
|
|
9
|
+
import './chunks/environment.C5eAp3K6.js';
|
|
10
10
|
import 'node:stream';
|
|
11
11
|
import 'vite-node/client';
|
|
12
12
|
import '@vitest/snapshot/manager';
|
package/dist/reporters.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { B as BasicReporter,
|
|
2
|
-
import './chunks/tasks.BZnCS9aT.js';
|
|
3
|
-
import '@vitest/runner/utils';
|
|
4
|
-
import '@vitest/utils';
|
|
1
|
+
export { B as BasicReporter, h as BenchmarkReportsMap, D as DefaultReporter, a as DotReporter, G as GithubActionsReporter, H as HangingProcessReporter, b as JUnitReporter, J as JsonReporter, R as ReportersMap, c as TapFlatReporter, T as TapReporter, e as TestCase, d as TestFile, f as TestModule, g as TestSuite, V as VerboseReporter } from './chunks/index.C4LZENmc.js';
|
|
5
2
|
import 'node:fs';
|
|
6
3
|
import 'tinyrainbow';
|
|
7
4
|
import 'pathe';
|
|
5
|
+
import './chunks/tasks.BZnCS9aT.js';
|
|
6
|
+
import '@vitest/runner/utils';
|
|
7
|
+
import '@vitest/utils';
|
|
8
8
|
import './chunks/env.CmHVDJnw.js';
|
|
9
9
|
import 'std-env';
|
|
10
10
|
import './chunks/utils.DO38lwfj.js';
|
|
@@ -13,7 +13,7 @@ import 'node:perf_hooks';
|
|
|
13
13
|
import '@vitest/utils/source-map';
|
|
14
14
|
import './chunks/index.CxRxs566.js';
|
|
15
15
|
import './chunks/utils.Ck2hJTRs.js';
|
|
16
|
-
import './chunks/RandomSequencer.
|
|
16
|
+
import './chunks/RandomSequencer.CjkAy_bL.js';
|
|
17
17
|
import 'node:fs/promises';
|
|
18
18
|
import 'execa';
|
|
19
19
|
import 'node:url';
|
package/dist/runners.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
|
|
2
|
-
import { g as getSnapshotClient, c as createExpect, v as vi } from './chunks/vi.
|
|
2
|
+
import { g as getSnapshotClient, c as createExpect, v as vi } from './chunks/vi.DBepMgvg.js';
|
|
3
3
|
import 'pathe';
|
|
4
4
|
import { g as getTestName } from './chunks/tasks.BZnCS9aT.js';
|
|
5
5
|
import { createDefer, getSafeTimers } from '@vitest/utils';
|
package/dist/workers/forks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import v8 from 'node:v8';
|
|
2
2
|
import { c as createForksRpcOptions, u as unwrapSerializableConfig } from '../chunks/utils.C3_cBsyn.js';
|
|
3
|
-
import { r as runBaseTests } from '../chunks/base.
|
|
3
|
+
import { r as runBaseTests } from '../chunks/base.B-9RAXb6.js';
|
|
4
4
|
import '@vitest/utils';
|
|
5
5
|
import 'vite-node/client';
|
|
6
6
|
import '../chunks/utils.Ck2hJTRs.js';
|
|
@@ -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.dWDhoZDV.js';
|
|
9
|
+
import { a as startCoverageInsideWorker, s as stopCoverageInsideWorker } from '../chunks/coverage.zlNdAMHK.js';
|
|
10
|
+
import { V as VitestIndex } from '../chunks/index.m3Xip5Zz.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.B7uEQsGB.js';
|
|
13
13
|
import { c as closeInspector } from '../chunks/inspector.70d6emsh.js';
|
|
14
14
|
import 'chai';
|
|
15
15
|
import 'pathe';
|
|
@@ -24,7 +24,7 @@ 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.DBepMgvg.js';
|
|
28
28
|
import '../chunks/_commonjsHelpers.BFTU3MAI.js';
|
|
29
29
|
import '@vitest/expect';
|
|
30
30
|
import '@vitest/snapshot';
|
package/dist/workers/threads.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as runBaseTests } from '../chunks/base.
|
|
1
|
+
import { r as runBaseTests } from '../chunks/base.B-9RAXb6.js';
|
|
2
2
|
import { a as createThreadsRpcOptions } from '../chunks/utils.C3_cBsyn.js';
|
|
3
3
|
import 'vite-node/client';
|
|
4
4
|
import '../chunks/utils.Ck2hJTRs.js';
|
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.DTM-0OlZ.js';
|
|
4
|
+
import { B as BirpcOptions, R as RuntimeRPC, C as ContextRPC, W as WorkerGlobalState } from './chunks/worker.CTdJUeeB.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
|
@@ -2,7 +2,7 @@ export { c as createForksRpcOptions, a as createThreadsRpcOptions, u as unwrapSe
|
|
|
2
2
|
export { p as provideWorkerState } from './chunks/utils.Ck2hJTRs.js';
|
|
3
3
|
export { collect as collectVitestWorkerTests, run as runVitestWorker } from './worker.js';
|
|
4
4
|
export { r as runVmTests } from './chunks/vm.kl9T_5ai.js';
|
|
5
|
-
export { r as runBaseTests } from './chunks/base.
|
|
5
|
+
export { r as runBaseTests } from './chunks/base.B-9RAXb6.js';
|
|
6
6
|
import '@vitest/utils';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'tinypool';
|
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.6",
|
|
5
5
|
"description": "Next generation testing framework powered by Vite",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
"@types/node": "^18.0.0 || >=20.0.0",
|
|
119
119
|
"happy-dom": "*",
|
|
120
120
|
"jsdom": "*",
|
|
121
|
-
"@vitest/
|
|
122
|
-
"@vitest/
|
|
121
|
+
"@vitest/browser": "2.1.0-beta.6",
|
|
122
|
+
"@vitest/ui": "2.1.0-beta.6"
|
|
123
123
|
},
|
|
124
124
|
"peerDependenciesMeta": {
|
|
125
125
|
"@edge-runtime/vm": {
|
|
@@ -154,16 +154,16 @@
|
|
|
154
154
|
"tinyrainbow": "^1.2.0",
|
|
155
155
|
"vite": "^5.0.0",
|
|
156
156
|
"why-is-node-running": "^2.3.0",
|
|
157
|
-
"@vitest/
|
|
158
|
-
"@vitest/
|
|
159
|
-
"@vitest/
|
|
160
|
-
"@vitest/spy": "2.1.0-beta.
|
|
161
|
-
"@vitest/utils": "2.1.0-beta.
|
|
162
|
-
"
|
|
163
|
-
"
|
|
157
|
+
"@vitest/pretty-format": "^2.1.0-beta.6",
|
|
158
|
+
"@vitest/runner": "2.1.0-beta.6",
|
|
159
|
+
"@vitest/expect": "2.1.0-beta.6",
|
|
160
|
+
"@vitest/spy": "2.1.0-beta.6",
|
|
161
|
+
"@vitest/utils": "2.1.0-beta.6",
|
|
162
|
+
"@vitest/snapshot": "2.1.0-beta.6",
|
|
163
|
+
"vite-node": "2.1.0-beta.6"
|
|
164
164
|
},
|
|
165
165
|
"devDependencies": {
|
|
166
|
-
"@antfu/install-pkg": "0.3.
|
|
166
|
+
"@antfu/install-pkg": "^0.3.4",
|
|
167
167
|
"@edge-runtime/vm": "^4.0.1",
|
|
168
168
|
"@sinonjs/fake-timers": "11.1.0",
|
|
169
169
|
"@types/debug": "^4.1.12",
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"@types/istanbul-reports": "^3.0.4",
|
|
173
173
|
"@types/jsdom": "^21.1.7",
|
|
174
174
|
"@types/micromatch": "^4.0.9",
|
|
175
|
-
"@types/node": "^20.14.
|
|
175
|
+
"@types/node": "^20.14.15",
|
|
176
176
|
"@types/prompts": "^2.4.9",
|
|
177
177
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
178
178
|
"acorn-walk": "^8.3.3",
|
|
@@ -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 };
|