likec4 1.48.0 → 1.49.0
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/README.md +11 -1
- package/__app__/src/likec4.js +5595 -4127
- package/__app__/src/routes/index.js +3 -153
- package/__app__/src/routes/projects.js +21 -1087
- package/__app__/src/routes/single.js +1221 -16
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +3507 -894
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +155 -143
- package/dist/THIRD-PARTY-LICENSES.md +1739 -0
- package/dist/_chunks/GraphvizBinaryAdapter.mjs +72 -0
- package/dist/_chunks/filenames.mjs +14 -0
- package/dist/_chunks/index.d.mts +224 -129
- package/dist/_chunks/index2.d.mts +2033 -1908
- package/dist/_chunks/libs/@chevrotain/gast.mjs +1 -3969
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -785
- package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -37
- package/dist/_chunks/libs/@hono/mcp.mjs +34 -0
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -436
- package/dist/_chunks/libs/@logtape/logtape.d.mts +741 -0
- package/dist/_chunks/libs/@logtape/logtape.mjs +6 -1354
- package/dist/_chunks/libs/@lume/kiwi.mjs +1 -1355
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +14 -14
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +12 -25105
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -1503
- package/dist/_chunks/libs/@nanostores/react.mjs +1 -30
- package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -100
- package/dist/_chunks/libs/ajv.mjs +1 -777
- package/dist/_chunks/libs/atomically.mjs +1 -362
- package/dist/_chunks/libs/birpc.mjs +1 -201
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -850
- package/dist/_chunks/libs/chevrotain.mjs +55 -6229
- package/dist/_chunks/libs/conf.mjs +1 -2258
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/esm-env.mjs +1 -5
- package/dist/_chunks/libs/eventemitter3.mjs +1 -243
- package/dist/_chunks/libs/fast-equals.mjs +1 -446
- package/dist/_chunks/libs/find-up-simple.mjs +1 -24
- package/dist/_chunks/libs/get-port.mjs +1 -107
- package/dist/_chunks/libs/is-docker.mjs +1 -26
- package/dist/_chunks/libs/is-error-instance.mjs +1 -26
- package/dist/_chunks/libs/is-inside-container.mjs +1 -20
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/isexe.mjs +1 -127
- package/dist/_chunks/libs/json5.mjs +14 -959
- package/dist/_chunks/libs/khroma.mjs +1 -605
- package/dist/_chunks/libs/ky.mjs +2 -807
- package/dist/_chunks/libs/langium.d.mts +2880 -2844
- package/dist/_chunks/libs/langium.mjs +32 -20351
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -746
- package/dist/_chunks/libs/nanostores.mjs +1 -198
- package/dist/_chunks/libs/p-limit.mjs +1 -120
- package/dist/_chunks/libs/p-queue.mjs +1 -449
- package/dist/_chunks/libs/package-manager-detector.mjs +1 -559
- package/dist/_chunks/libs/package-up.mjs +1 -10
- package/dist/_chunks/libs/parse-ms.mjs +1 -36
- package/dist/_chunks/libs/pathe.mjs +1 -0
- package/dist/_chunks/libs/picomatch.mjs +1 -1673
- package/dist/_chunks/libs/pretty-ms.mjs +1 -80
- package/dist/_chunks/libs/remeda.mjs +1 -690
- package/dist/_chunks/libs/safe-stringify.mjs +1 -21
- package/dist/_chunks/libs/strip-indent.mjs +1 -15
- package/dist/_chunks/libs/tinyrainbow.mjs +1 -88
- package/dist/_chunks/libs/ts-graphviz.mjs +4 -725
- package/dist/_chunks/libs/ufo.mjs +1 -240
- package/dist/_chunks/libs/which.mjs +1 -84
- package/dist/_chunks/libs/word-wrap.mjs +12 -43
- package/dist/_chunks/node.mjs +481 -0
- package/dist/_chunks/plugin.mjs +98 -772
- package/dist/_chunks/rolldown-runtime.mjs +1 -48
- package/dist/_chunks/sequence-view.mjs +1 -575
- package/dist/cli/index.mjs +127 -1846
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +1 -6
- package/dist/index.d.mts +148 -7
- package/dist/index.mjs +1 -21
- package/dist/model/builder.mjs +1 -3
- package/dist/model/index.d.mts +57 -3
- package/dist/model/index.mjs +1 -5
- package/dist/vite-plugin/index.d.mts +4 -3
- package/dist/vite-plugin/index.mjs +1 -22
- package/dist/vite-plugin/internal.d.mts +5 -5
- package/dist/vite-plugin/internal.mjs +1 -68
- package/package.json +60 -41
- package/react/{index.d.ts → index.d.mts} +112 -70
- package/react/{index.js → index.mjs} +21361 -22064
- package/react/package.json +2 -5
- package/vite-plugin-modules.d.ts +5 -5
- package/dist/_chunks/LikeC4.d.mts +0 -121
- package/dist/_chunks/LikeC4.mjs +0 -202
- package/dist/_chunks/config-app.prod.d.mts +0 -18
- package/dist/_chunks/config-app.prod.mjs +0 -188
- package/dist/_chunks/config-webcomponent.prod.mjs +0 -71
- package/dist/_chunks/define-config.mjs +0 -409
- package/dist/_chunks/index3.d.mts +0 -60
- package/dist/_chunks/index4.d.mts +0 -1
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +0 -10
- package/dist/_chunks/libs/hono.mjs +0 -1829
- package/dist/_chunks/libs/nanoid.mjs +0 -29
- package/dist/_chunks/model.mjs +0 -12
- package/dist/_chunks/module.d.mts +0 -71
- package/dist/_chunks/module.mjs +0 -18657
- package/dist/_chunks/vite-build.mjs +0 -69
- package/dist/_chunks/vite-dev.mjs +0 -79
- package/dist/_chunks/vite-preview.mjs +0 -27
- package/dist/language/module.d.mts +0 -5
- package/dist/language/module.mjs +0 -20
- package/dist/vite/vite-build.d.mts +0 -26
- package/dist/vite/vite-build.mjs +0 -27
- package/dist/vite/vite-dev.d.mts +0 -34
- package/dist/vite/vite-dev.mjs +0 -29
- package/dist/vite/vite-preview.d.mts +0 -20
- package/dist/vite/vite-preview.mjs +0 -26
|
@@ -1,559 +1 @@
|
|
|
1
|
-
import path from
|
|
2
|
-
import fsPromises from "node:fs/promises";
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
|
|
5
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
6
|
-
function dashDashArg(agent, agentCommand) {
|
|
7
|
-
return (args) => {
|
|
8
|
-
if (args.length > 1) return [
|
|
9
|
-
agent,
|
|
10
|
-
agentCommand,
|
|
11
|
-
args[0],
|
|
12
|
-
"--",
|
|
13
|
-
...args.slice(1)
|
|
14
|
-
];
|
|
15
|
-
else return [
|
|
16
|
-
agent,
|
|
17
|
-
agentCommand,
|
|
18
|
-
args[0]
|
|
19
|
-
];
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function denoExecute() {
|
|
23
|
-
return (args) => {
|
|
24
|
-
return [
|
|
25
|
-
"deno",
|
|
26
|
-
"run",
|
|
27
|
-
`npm:${args[0]}`,
|
|
28
|
-
...args.slice(1)
|
|
29
|
-
];
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
const npm = {
|
|
33
|
-
"agent": ["npm", 0],
|
|
34
|
-
"run": dashDashArg("npm", "run"),
|
|
35
|
-
"install": [
|
|
36
|
-
"npm",
|
|
37
|
-
"i",
|
|
38
|
-
0
|
|
39
|
-
],
|
|
40
|
-
"frozen": [
|
|
41
|
-
"npm",
|
|
42
|
-
"ci",
|
|
43
|
-
0
|
|
44
|
-
],
|
|
45
|
-
"global": [
|
|
46
|
-
"npm",
|
|
47
|
-
"i",
|
|
48
|
-
"-g",
|
|
49
|
-
0
|
|
50
|
-
],
|
|
51
|
-
"add": [
|
|
52
|
-
"npm",
|
|
53
|
-
"i",
|
|
54
|
-
0
|
|
55
|
-
],
|
|
56
|
-
"upgrade": [
|
|
57
|
-
"npm",
|
|
58
|
-
"update",
|
|
59
|
-
0
|
|
60
|
-
],
|
|
61
|
-
"upgrade-interactive": null,
|
|
62
|
-
"dedupe": [
|
|
63
|
-
"npm",
|
|
64
|
-
"dedupe",
|
|
65
|
-
0
|
|
66
|
-
],
|
|
67
|
-
"execute": ["npx", 0],
|
|
68
|
-
"execute-local": ["npx", 0],
|
|
69
|
-
"uninstall": [
|
|
70
|
-
"npm",
|
|
71
|
-
"uninstall",
|
|
72
|
-
0
|
|
73
|
-
],
|
|
74
|
-
"global_uninstall": [
|
|
75
|
-
"npm",
|
|
76
|
-
"uninstall",
|
|
77
|
-
"-g",
|
|
78
|
-
0
|
|
79
|
-
]
|
|
80
|
-
};
|
|
81
|
-
const yarn = {
|
|
82
|
-
"agent": ["yarn", 0],
|
|
83
|
-
"run": [
|
|
84
|
-
"yarn",
|
|
85
|
-
"run",
|
|
86
|
-
0
|
|
87
|
-
],
|
|
88
|
-
"install": [
|
|
89
|
-
"yarn",
|
|
90
|
-
"install",
|
|
91
|
-
0
|
|
92
|
-
],
|
|
93
|
-
"frozen": [
|
|
94
|
-
"yarn",
|
|
95
|
-
"install",
|
|
96
|
-
"--frozen-lockfile",
|
|
97
|
-
0
|
|
98
|
-
],
|
|
99
|
-
"global": [
|
|
100
|
-
"yarn",
|
|
101
|
-
"global",
|
|
102
|
-
"add",
|
|
103
|
-
0
|
|
104
|
-
],
|
|
105
|
-
"add": [
|
|
106
|
-
"yarn",
|
|
107
|
-
"add",
|
|
108
|
-
0
|
|
109
|
-
],
|
|
110
|
-
"upgrade": [
|
|
111
|
-
"yarn",
|
|
112
|
-
"upgrade",
|
|
113
|
-
0
|
|
114
|
-
],
|
|
115
|
-
"upgrade-interactive": [
|
|
116
|
-
"yarn",
|
|
117
|
-
"upgrade-interactive",
|
|
118
|
-
0
|
|
119
|
-
],
|
|
120
|
-
"dedupe": null,
|
|
121
|
-
"execute": ["npx", 0],
|
|
122
|
-
"execute-local": dashDashArg("yarn", "exec"),
|
|
123
|
-
"uninstall": [
|
|
124
|
-
"yarn",
|
|
125
|
-
"remove",
|
|
126
|
-
0
|
|
127
|
-
],
|
|
128
|
-
"global_uninstall": [
|
|
129
|
-
"yarn",
|
|
130
|
-
"global",
|
|
131
|
-
"remove",
|
|
132
|
-
0
|
|
133
|
-
]
|
|
134
|
-
};
|
|
135
|
-
const yarnBerry = {
|
|
136
|
-
...yarn,
|
|
137
|
-
"frozen": [
|
|
138
|
-
"yarn",
|
|
139
|
-
"install",
|
|
140
|
-
"--immutable",
|
|
141
|
-
0
|
|
142
|
-
],
|
|
143
|
-
"upgrade": [
|
|
144
|
-
"yarn",
|
|
145
|
-
"up",
|
|
146
|
-
0
|
|
147
|
-
],
|
|
148
|
-
"upgrade-interactive": [
|
|
149
|
-
"yarn",
|
|
150
|
-
"up",
|
|
151
|
-
"-i",
|
|
152
|
-
0
|
|
153
|
-
],
|
|
154
|
-
"dedupe": [
|
|
155
|
-
"yarn",
|
|
156
|
-
"dedupe",
|
|
157
|
-
0
|
|
158
|
-
],
|
|
159
|
-
"execute": [
|
|
160
|
-
"yarn",
|
|
161
|
-
"dlx",
|
|
162
|
-
0
|
|
163
|
-
],
|
|
164
|
-
"execute-local": [
|
|
165
|
-
"yarn",
|
|
166
|
-
"exec",
|
|
167
|
-
0
|
|
168
|
-
],
|
|
169
|
-
"global": [
|
|
170
|
-
"npm",
|
|
171
|
-
"i",
|
|
172
|
-
"-g",
|
|
173
|
-
0
|
|
174
|
-
],
|
|
175
|
-
"global_uninstall": [
|
|
176
|
-
"npm",
|
|
177
|
-
"uninstall",
|
|
178
|
-
"-g",
|
|
179
|
-
0
|
|
180
|
-
]
|
|
181
|
-
};
|
|
182
|
-
const pnpm = {
|
|
183
|
-
"agent": ["pnpm", 0],
|
|
184
|
-
"run": [
|
|
185
|
-
"pnpm",
|
|
186
|
-
"run",
|
|
187
|
-
0
|
|
188
|
-
],
|
|
189
|
-
"install": [
|
|
190
|
-
"pnpm",
|
|
191
|
-
"i",
|
|
192
|
-
0
|
|
193
|
-
],
|
|
194
|
-
"frozen": [
|
|
195
|
-
"pnpm",
|
|
196
|
-
"i",
|
|
197
|
-
"--frozen-lockfile",
|
|
198
|
-
0
|
|
199
|
-
],
|
|
200
|
-
"global": [
|
|
201
|
-
"pnpm",
|
|
202
|
-
"add",
|
|
203
|
-
"-g",
|
|
204
|
-
0
|
|
205
|
-
],
|
|
206
|
-
"add": [
|
|
207
|
-
"pnpm",
|
|
208
|
-
"add",
|
|
209
|
-
0
|
|
210
|
-
],
|
|
211
|
-
"upgrade": [
|
|
212
|
-
"pnpm",
|
|
213
|
-
"update",
|
|
214
|
-
0
|
|
215
|
-
],
|
|
216
|
-
"upgrade-interactive": [
|
|
217
|
-
"pnpm",
|
|
218
|
-
"update",
|
|
219
|
-
"-i",
|
|
220
|
-
0
|
|
221
|
-
],
|
|
222
|
-
"dedupe": [
|
|
223
|
-
"pnpm",
|
|
224
|
-
"dedupe",
|
|
225
|
-
0
|
|
226
|
-
],
|
|
227
|
-
"execute": [
|
|
228
|
-
"pnpm",
|
|
229
|
-
"dlx",
|
|
230
|
-
0
|
|
231
|
-
],
|
|
232
|
-
"execute-local": [
|
|
233
|
-
"pnpm",
|
|
234
|
-
"exec",
|
|
235
|
-
0
|
|
236
|
-
],
|
|
237
|
-
"uninstall": [
|
|
238
|
-
"pnpm",
|
|
239
|
-
"remove",
|
|
240
|
-
0
|
|
241
|
-
],
|
|
242
|
-
"global_uninstall": [
|
|
243
|
-
"pnpm",
|
|
244
|
-
"remove",
|
|
245
|
-
"--global",
|
|
246
|
-
0
|
|
247
|
-
]
|
|
248
|
-
};
|
|
249
|
-
const bun = {
|
|
250
|
-
"agent": ["bun", 0],
|
|
251
|
-
"run": [
|
|
252
|
-
"bun",
|
|
253
|
-
"run",
|
|
254
|
-
0
|
|
255
|
-
],
|
|
256
|
-
"install": [
|
|
257
|
-
"bun",
|
|
258
|
-
"install",
|
|
259
|
-
0
|
|
260
|
-
],
|
|
261
|
-
"frozen": [
|
|
262
|
-
"bun",
|
|
263
|
-
"install",
|
|
264
|
-
"--frozen-lockfile",
|
|
265
|
-
0
|
|
266
|
-
],
|
|
267
|
-
"global": [
|
|
268
|
-
"bun",
|
|
269
|
-
"add",
|
|
270
|
-
"-g",
|
|
271
|
-
0
|
|
272
|
-
],
|
|
273
|
-
"add": [
|
|
274
|
-
"bun",
|
|
275
|
-
"add",
|
|
276
|
-
0
|
|
277
|
-
],
|
|
278
|
-
"upgrade": [
|
|
279
|
-
"bun",
|
|
280
|
-
"update",
|
|
281
|
-
0
|
|
282
|
-
],
|
|
283
|
-
"upgrade-interactive": [
|
|
284
|
-
"bun",
|
|
285
|
-
"update",
|
|
286
|
-
"-i",
|
|
287
|
-
0
|
|
288
|
-
],
|
|
289
|
-
"dedupe": null,
|
|
290
|
-
"execute": [
|
|
291
|
-
"bun",
|
|
292
|
-
"x",
|
|
293
|
-
0
|
|
294
|
-
],
|
|
295
|
-
"execute-local": [
|
|
296
|
-
"bun",
|
|
297
|
-
"x",
|
|
298
|
-
0
|
|
299
|
-
],
|
|
300
|
-
"uninstall": [
|
|
301
|
-
"bun",
|
|
302
|
-
"remove",
|
|
303
|
-
0
|
|
304
|
-
],
|
|
305
|
-
"global_uninstall": [
|
|
306
|
-
"bun",
|
|
307
|
-
"remove",
|
|
308
|
-
"-g",
|
|
309
|
-
0
|
|
310
|
-
]
|
|
311
|
-
};
|
|
312
|
-
const deno = {
|
|
313
|
-
"agent": ["deno", 0],
|
|
314
|
-
"run": [
|
|
315
|
-
"deno",
|
|
316
|
-
"task",
|
|
317
|
-
0
|
|
318
|
-
],
|
|
319
|
-
"install": [
|
|
320
|
-
"deno",
|
|
321
|
-
"install",
|
|
322
|
-
0
|
|
323
|
-
],
|
|
324
|
-
"frozen": [
|
|
325
|
-
"deno",
|
|
326
|
-
"install",
|
|
327
|
-
"--frozen",
|
|
328
|
-
0
|
|
329
|
-
],
|
|
330
|
-
"global": [
|
|
331
|
-
"deno",
|
|
332
|
-
"install",
|
|
333
|
-
"-g",
|
|
334
|
-
0
|
|
335
|
-
],
|
|
336
|
-
"add": [
|
|
337
|
-
"deno",
|
|
338
|
-
"add",
|
|
339
|
-
0
|
|
340
|
-
],
|
|
341
|
-
"upgrade": [
|
|
342
|
-
"deno",
|
|
343
|
-
"outdated",
|
|
344
|
-
"--update",
|
|
345
|
-
0
|
|
346
|
-
],
|
|
347
|
-
"upgrade-interactive": [
|
|
348
|
-
"deno",
|
|
349
|
-
"outdated",
|
|
350
|
-
"--update",
|
|
351
|
-
0
|
|
352
|
-
],
|
|
353
|
-
"dedupe": null,
|
|
354
|
-
"execute": denoExecute(),
|
|
355
|
-
"execute-local": [
|
|
356
|
-
"deno",
|
|
357
|
-
"task",
|
|
358
|
-
"--eval",
|
|
359
|
-
0
|
|
360
|
-
],
|
|
361
|
-
"uninstall": [
|
|
362
|
-
"deno",
|
|
363
|
-
"remove",
|
|
364
|
-
0
|
|
365
|
-
],
|
|
366
|
-
"global_uninstall": [
|
|
367
|
-
"deno",
|
|
368
|
-
"uninstall",
|
|
369
|
-
"-g",
|
|
370
|
-
0
|
|
371
|
-
]
|
|
372
|
-
};
|
|
373
|
-
const COMMANDS = {
|
|
374
|
-
"npm": npm,
|
|
375
|
-
"yarn": yarn,
|
|
376
|
-
"yarn@berry": yarnBerry,
|
|
377
|
-
"pnpm": pnpm,
|
|
378
|
-
"pnpm@6": {
|
|
379
|
-
...pnpm,
|
|
380
|
-
run: dashDashArg("pnpm", "run")
|
|
381
|
-
},
|
|
382
|
-
"bun": bun,
|
|
383
|
-
"deno": deno
|
|
384
|
-
};
|
|
385
|
-
function resolveCommand(agent, command, args) {
|
|
386
|
-
const value = COMMANDS[agent][command];
|
|
387
|
-
return constructCommand(value, args);
|
|
388
|
-
}
|
|
389
|
-
function constructCommand(value, args) {
|
|
390
|
-
if (value == null) return null;
|
|
391
|
-
const list = typeof value === "function" ? value(args) : value.flatMap((v) => {
|
|
392
|
-
if (typeof v === "number") return args;
|
|
393
|
-
return [v];
|
|
394
|
-
});
|
|
395
|
-
return {
|
|
396
|
-
command: list[0],
|
|
397
|
-
args: list.slice(1)
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
//#endregion
|
|
402
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
403
|
-
const AGENTS = [
|
|
404
|
-
"npm",
|
|
405
|
-
"yarn",
|
|
406
|
-
"yarn@berry",
|
|
407
|
-
"pnpm",
|
|
408
|
-
"pnpm@6",
|
|
409
|
-
"bun",
|
|
410
|
-
"deno"
|
|
411
|
-
];
|
|
412
|
-
const LOCKS = {
|
|
413
|
-
"bun.lock": "bun",
|
|
414
|
-
"bun.lockb": "bun",
|
|
415
|
-
"deno.lock": "deno",
|
|
416
|
-
"pnpm-lock.yaml": "pnpm",
|
|
417
|
-
"pnpm-workspace.yaml": "pnpm",
|
|
418
|
-
"yarn.lock": "yarn",
|
|
419
|
-
"package-lock.json": "npm",
|
|
420
|
-
"npm-shrinkwrap.json": "npm"
|
|
421
|
-
};
|
|
422
|
-
const INSTALL_METADATA = {
|
|
423
|
-
"node_modules/.deno/": "deno",
|
|
424
|
-
"node_modules/.pnpm/": "pnpm",
|
|
425
|
-
"node_modules/.yarn-state.yml": "yarn",
|
|
426
|
-
"node_modules/.yarn_integrity": "yarn",
|
|
427
|
-
"node_modules/.package-lock.json": "npm",
|
|
428
|
-
".pnp.cjs": "yarn",
|
|
429
|
-
".pnp.js": "yarn",
|
|
430
|
-
"bun.lock": "bun",
|
|
431
|
-
"bun.lockb": "bun"
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
//#endregion
|
|
435
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
436
|
-
async function pathExists(path2, type) {
|
|
437
|
-
try {
|
|
438
|
-
const stat = await fsPromises.stat(path2);
|
|
439
|
-
return type === "file" ? stat.isFile() : stat.isDirectory();
|
|
440
|
-
} catch {
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
function* lookup(cwd = process.cwd()) {
|
|
445
|
-
let directory = path.resolve(cwd);
|
|
446
|
-
const { root } = path.parse(directory);
|
|
447
|
-
while (directory && directory !== root) {
|
|
448
|
-
yield directory;
|
|
449
|
-
directory = path.dirname(directory);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
async function parsePackageJson(filepath, options) {
|
|
453
|
-
if (!filepath || !await pathExists(filepath, "file")) return null;
|
|
454
|
-
return await handlePackageManager(filepath, options);
|
|
455
|
-
}
|
|
456
|
-
async function detect(options = {}) {
|
|
457
|
-
const { cwd, strategies = [
|
|
458
|
-
"lockfile",
|
|
459
|
-
"packageManager-field",
|
|
460
|
-
"devEngines-field"
|
|
461
|
-
] } = options;
|
|
462
|
-
let stopDir;
|
|
463
|
-
if (typeof options.stopDir === "string") {
|
|
464
|
-
const resolved = path.resolve(options.stopDir);
|
|
465
|
-
stopDir = (dir) => dir === resolved;
|
|
466
|
-
} else stopDir = options.stopDir;
|
|
467
|
-
for (const directory of lookup(cwd)) {
|
|
468
|
-
for (const strategy of strategies) switch (strategy) {
|
|
469
|
-
case "lockfile":
|
|
470
|
-
for (const lock of Object.keys(LOCKS)) if (await pathExists(path.join(directory, lock), "file")) {
|
|
471
|
-
const name = LOCKS[lock];
|
|
472
|
-
const result = await parsePackageJson(path.join(directory, "package.json"), options);
|
|
473
|
-
if (result) return result;
|
|
474
|
-
else return {
|
|
475
|
-
name,
|
|
476
|
-
agent: name
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
break;
|
|
480
|
-
case "packageManager-field":
|
|
481
|
-
case "devEngines-field": {
|
|
482
|
-
const result = await parsePackageJson(path.join(directory, "package.json"), options);
|
|
483
|
-
if (result) return result;
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
case "install-metadata":
|
|
487
|
-
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
488
|
-
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
489
|
-
if (await pathExists(path.join(directory, metadata), fileOrDir)) {
|
|
490
|
-
const name = INSTALL_METADATA[metadata];
|
|
491
|
-
return {
|
|
492
|
-
name,
|
|
493
|
-
agent: name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
if (stopDir?.(directory)) break;
|
|
500
|
-
}
|
|
501
|
-
return null;
|
|
502
|
-
}
|
|
503
|
-
function getNameAndVer(pkg) {
|
|
504
|
-
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
505
|
-
if (typeof pkg.packageManager === "string") {
|
|
506
|
-
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
507
|
-
return {
|
|
508
|
-
name,
|
|
509
|
-
ver: handelVer(ver)
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
if (typeof pkg.devEngines?.packageManager?.name === "string") return {
|
|
513
|
-
name: pkg.devEngines.packageManager.name,
|
|
514
|
-
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
async function handlePackageManager(filepath, options) {
|
|
518
|
-
try {
|
|
519
|
-
const content = await fsPromises.readFile(filepath, "utf8");
|
|
520
|
-
const pkg = options.packageJsonParser ? await options.packageJsonParser(content, filepath) : JSON.parse(content);
|
|
521
|
-
let agent;
|
|
522
|
-
const nameAndVer = getNameAndVer(pkg);
|
|
523
|
-
if (nameAndVer) {
|
|
524
|
-
const name = nameAndVer.name;
|
|
525
|
-
const ver = nameAndVer.ver;
|
|
526
|
-
let version = ver;
|
|
527
|
-
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
528
|
-
agent = "yarn@berry";
|
|
529
|
-
version = "berry";
|
|
530
|
-
return {
|
|
531
|
-
name,
|
|
532
|
-
agent,
|
|
533
|
-
version
|
|
534
|
-
};
|
|
535
|
-
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
536
|
-
agent = "pnpm@6";
|
|
537
|
-
return {
|
|
538
|
-
name,
|
|
539
|
-
agent,
|
|
540
|
-
version
|
|
541
|
-
};
|
|
542
|
-
} else if (AGENTS.includes(name)) {
|
|
543
|
-
agent = name;
|
|
544
|
-
return {
|
|
545
|
-
name,
|
|
546
|
-
agent,
|
|
547
|
-
version
|
|
548
|
-
};
|
|
549
|
-
} else return options.onUnknown?.(pkg.packageManager) ?? null;
|
|
550
|
-
}
|
|
551
|
-
} catch {}
|
|
552
|
-
return null;
|
|
553
|
-
}
|
|
554
|
-
function isMetadataYarnClassic(metadataPath) {
|
|
555
|
-
return metadataPath.endsWith(".yarn_integrity");
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
//#endregion
|
|
559
|
-
export { resolveCommand as n, detect as t };
|
|
1
|
+
import fs from"node:fs/promises";import path from"node:path";import process from"node:process";function dashDashArg(e,t){return n=>n.length>1?[e,t,n[0],`--`,...n.slice(1)]:[e,t,n[0]]}function denoExecute(){return e=>[`deno`,`run`,`npm:${e[0]}`,...e.slice(1)]}const npm={agent:[`npm`,0],run:dashDashArg(`npm`,`run`),install:[`npm`,`i`,0],frozen:[`npm`,`ci`,0],global:[`npm`,`i`,`-g`,0],add:[`npm`,`i`,0],upgrade:[`npm`,`update`,0],"upgrade-interactive":null,dedupe:[`npm`,`dedupe`,0],execute:[`npx`,0],"execute-local":[`npx`,0],uninstall:[`npm`,`uninstall`,0],global_uninstall:[`npm`,`uninstall`,`-g`,0]},yarn={agent:[`yarn`,0],run:[`yarn`,`run`,0],install:[`yarn`,`install`,0],frozen:[`yarn`,`install`,`--frozen-lockfile`,0],global:[`yarn`,`global`,`add`,0],add:[`yarn`,`add`,0],upgrade:[`yarn`,`upgrade`,0],"upgrade-interactive":[`yarn`,`upgrade-interactive`,0],dedupe:null,execute:[`npx`,0],"execute-local":dashDashArg(`yarn`,`exec`),uninstall:[`yarn`,`remove`,0],global_uninstall:[`yarn`,`global`,`remove`,0]},yarnBerry={...yarn,frozen:[`yarn`,`install`,`--immutable`,0],upgrade:[`yarn`,`up`,0],"upgrade-interactive":[`yarn`,`up`,`-i`,0],dedupe:[`yarn`,`dedupe`,0],execute:[`yarn`,`dlx`,0],"execute-local":[`yarn`,`exec`,0],global:[`npm`,`i`,`-g`,0],global_uninstall:[`npm`,`uninstall`,`-g`,0]},pnpm={agent:[`pnpm`,0],run:[`pnpm`,`run`,0],install:[`pnpm`,`i`,0],frozen:[`pnpm`,`i`,`--frozen-lockfile`,0],global:[`pnpm`,`add`,`-g`,0],add:[`pnpm`,`add`,0],upgrade:[`pnpm`,`update`,0],"upgrade-interactive":[`pnpm`,`update`,`-i`,0],dedupe:[`pnpm`,`dedupe`,0],execute:[`pnpm`,`dlx`,0],"execute-local":[`pnpm`,`exec`,0],uninstall:[`pnpm`,`remove`,0],global_uninstall:[`pnpm`,`remove`,`--global`,0]},bun={agent:[`bun`,0],run:[`bun`,`run`,0],install:[`bun`,`install`,0],frozen:[`bun`,`install`,`--frozen-lockfile`,0],global:[`bun`,`add`,`-g`,0],add:[`bun`,`add`,0],upgrade:[`bun`,`update`,0],"upgrade-interactive":[`bun`,`update`,`-i`,0],dedupe:null,execute:[`bun`,`x`,0],"execute-local":[`bun`,`x`,0],uninstall:[`bun`,`remove`,0],global_uninstall:[`bun`,`remove`,`-g`,0]},deno={agent:[`deno`,0],run:[`deno`,`task`,0],install:[`deno`,`install`,0],frozen:[`deno`,`install`,`--frozen`,0],global:[`deno`,`install`,`-g`,0],add:[`deno`,`add`,0],upgrade:[`deno`,`outdated`,`--update`,0],"upgrade-interactive":[`deno`,`outdated`,`--update`,0],dedupe:null,execute:denoExecute(),"execute-local":[`deno`,`task`,`--eval`,0],uninstall:[`deno`,`remove`,0],global_uninstall:[`deno`,`uninstall`,`-g`,0]},COMMANDS={npm,yarn,"yarn@berry":yarnBerry,pnpm,"pnpm@6":{...pnpm,run:dashDashArg(`pnpm`,`run`)},bun,deno};function resolveCommand(e,t,n){let r=COMMANDS[e][t];return constructCommand(r,n)}function constructCommand(e,t){if(e==null)return null;let n=typeof e==`function`?e(t):e.flatMap(e=>typeof e==`number`?t:[e]);return{command:n[0],args:n.slice(1)}}const AGENTS=[`npm`,`yarn`,`yarn@berry`,`pnpm`,`pnpm@6`,`bun`,`deno`],LOCKS={"bun.lock":`bun`,"bun.lockb":`bun`,"deno.lock":`deno`,"pnpm-lock.yaml":`pnpm`,"pnpm-workspace.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`,"npm-shrinkwrap.json":`npm`},INSTALL_METADATA={"node_modules/.deno/":`deno`,"node_modules/.pnpm/":`pnpm`,"node_modules/.yarn-state.yml":`yarn`,"node_modules/.yarn_integrity":`yarn`,"node_modules/.package-lock.json":`npm`,".pnp.cjs":`yarn`,".pnp.js":`yarn`,"bun.lock":`bun`,"bun.lockb":`bun`};async function pathExists(t,n){try{let r=await fs.stat(t);return n===`file`?r.isFile():r.isDirectory()}catch{return!1}}function*lookup(e=process.cwd()){let r=path.resolve(e),{root:i}=path.parse(r);for(;r&&r!==i;)yield r,r=path.dirname(r)}async function parsePackageJson(e,t){return!e||!await pathExists(e,`file`)?null:await handlePackageManager(e,t)}async function detect(e={}){let{cwd:n,strategies:r=[`lockfile`,`packageManager-field`,`devEngines-field`]}=e,i;if(typeof e.stopDir==`string`){let n=path.resolve(e.stopDir);i=e=>e===n}else i=e.stopDir;for(let a of lookup(n)){for(let n of r)switch(n){case`lockfile`:for(let n of Object.keys(LOCKS))if(await pathExists(path.join(a,n),`file`)){let r=LOCKS[n];return await parsePackageJson(path.join(a,`package.json`),e)||{name:r,agent:r}}break;case`packageManager-field`:case`devEngines-field`:{let n=await parsePackageJson(path.join(a,`package.json`),e);if(n)return n;break}case`install-metadata`:for(let e of Object.keys(INSTALL_METADATA)){let n=e.endsWith(`/`)?`dir`:`file`;if(await pathExists(path.join(a,e),n)){let t=INSTALL_METADATA[e];return{name:t,agent:t===`yarn`?isMetadataYarnClassic(e)?`yarn`:`yarn@berry`:t}}}break}if(i?.(a))break}return null}function getNameAndVer(e){let t=e=>e?.match(/\d+(\.\d+){0,2}/)?.[0]??e;if(typeof e.packageManager==`string`){let[n,r]=e.packageManager.replace(/^\^/,``).split(`@`);return{name:n,ver:t(r)}}if(typeof e.devEngines?.packageManager?.name==`string`)return{name:e.devEngines.packageManager.name,ver:t(e.devEngines.packageManager.version)}}async function handlePackageManager(t,n){try{let r=await fs.readFile(t,`utf8`),i=n.packageJsonParser?await n.packageJsonParser(r,t):JSON.parse(r),a,o=getNameAndVer(i);if(o){let e=o.name,t=o.ver,r=t;return e===`yarn`&&t&&Number.parseInt(t)>1?(a=`yarn@berry`,r=`berry`,{name:e,agent:a,version:r}):e===`pnpm`&&t&&Number.parseInt(t)<7?(a=`pnpm@6`,{name:e,agent:a,version:r}):AGENTS.includes(e)?(a=e,{name:e,agent:a,version:r}):n.onUnknown?.(i.packageManager)??null}}catch{}return null}function isMetadataYarnClassic(e){return e.endsWith(`.yarn_integrity`)}export{resolveCommand as n,detect as t};
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/package-up@5.0.0/node_modules/package-up/index.js
|
|
5
|
-
function packageUpSync({ cwd = process.cwd() } = {}) {
|
|
6
|
-
return findUpSync("package.json", { cwd });
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { packageUpSync as t };
|
|
1
|
+
import{t as findUpSync}from"./find-up-simple.mjs";import process from"node:process";function packageUpSync({cwd:e=process.cwd()}={}){return findUpSync(`package.json`,{cwd:e})}export{packageUpSync as t};
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const toZeroIfInfinity = (value) => Number.isFinite(value) ? value : 0;
|
|
3
|
-
function parseNumber(milliseconds) {
|
|
4
|
-
return {
|
|
5
|
-
days: Math.trunc(milliseconds / 864e5),
|
|
6
|
-
hours: Math.trunc(milliseconds / 36e5 % 24),
|
|
7
|
-
minutes: Math.trunc(milliseconds / 6e4 % 60),
|
|
8
|
-
seconds: Math.trunc(milliseconds / 1e3 % 60),
|
|
9
|
-
milliseconds: Math.trunc(milliseconds % 1e3),
|
|
10
|
-
microseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e3) % 1e3),
|
|
11
|
-
nanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1e3)
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function parseBigint(milliseconds) {
|
|
15
|
-
return {
|
|
16
|
-
days: milliseconds / 86400000n,
|
|
17
|
-
hours: milliseconds / 3600000n % 24n,
|
|
18
|
-
minutes: milliseconds / 60000n % 60n,
|
|
19
|
-
seconds: milliseconds / 1000n % 60n,
|
|
20
|
-
milliseconds: milliseconds % 1000n,
|
|
21
|
-
microseconds: 0n,
|
|
22
|
-
nanoseconds: 0n
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function parseMilliseconds(milliseconds) {
|
|
26
|
-
switch (typeof milliseconds) {
|
|
27
|
-
case "number":
|
|
28
|
-
if (Number.isFinite(milliseconds)) return parseNumber(milliseconds);
|
|
29
|
-
break;
|
|
30
|
-
case "bigint": return parseBigint(milliseconds);
|
|
31
|
-
}
|
|
32
|
-
throw new TypeError("Expected a finite number or bigint");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { parseMilliseconds as t };
|
|
1
|
+
const toZeroIfInfinity=e=>Number.isFinite(e)?e:0;function parseNumber(t){return{days:Math.trunc(t/864e5),hours:Math.trunc(t/36e5%24),minutes:Math.trunc(t/6e4%60),seconds:Math.trunc(t/1e3%60),milliseconds:Math.trunc(t%1e3),microseconds:Math.trunc(toZeroIfInfinity(t*1e3)%1e3),nanoseconds:Math.trunc(toZeroIfInfinity(t*1e6)%1e3)}}function parseBigint(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function parseMilliseconds(e){switch(typeof e){case`number`:if(Number.isFinite(e))return parseNumber(e);break;case`bigint`:return parseBigint(e)}throw TypeError(`Expected a finite number or bigint`)}export{parseMilliseconds as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _DRIVE_LETTER_START_RE=/^[A-Za-z]:\//;function normalizeWindowsPath(t=``){return t&&t.replace(/\\/g,`/`).replace(_DRIVE_LETTER_START_RE,e=>e.toUpperCase())}const _IS_ABSOLUTE_RE=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,_EXTNAME_RE=/.(\.[^./]+|\.)$/;function cwd(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const resolve=function(...e){e=e.map(e=>normalizeWindowsPath(e));let n=``,r=!1;for(let t=e.length-1;t>=-1&&!r;t--){let a=t>=0?e[t]:cwd();!a||a.length===0||(n=`${a}/${n}`,r=isAbsolute(a))}return n=normalizeString(n,!r),r&&!isAbsolute(n)?`/${n}`:n.length>0?n:`.`};function normalizeString(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const isAbsolute=function(e){return _IS_ABSOLUTE_RE.test(e)},extname=function(e){if(e===`..`)return``;let n=_EXTNAME_RE.exec(normalizeWindowsPath(e));return n&&n[1]||``},basename=function(e,n){let r=normalizeWindowsPath(e).split(`/`),i=``;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t){i=t;break}}return n&&i.endsWith(n)?i.slice(0,-n.length):i};export{extname as n,resolve as r,basename as t};
|