@secondlayer/cli 1.5.1 → 1.6.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/dist/cli.js +468 -873
- package/dist/cli.js.map +18 -26
- package/dist/index.js +6 -17
- package/dist/index.js.map +2 -2
- package/dist/plugin-manager.js +6 -2
- package/dist/plugin-manager.js.map +2 -2
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -4529,20 +4547,20 @@ __export(exports_api_client, {
|
|
|
4529
4547
|
rotateSecret: () => rotateSecret,
|
|
4530
4548
|
resumeAllStreams: () => resumeAllStreams,
|
|
4531
4549
|
resolveStreamId: () => resolveStreamId,
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4550
|
+
reindexSubgraphApi: () => reindexSubgraphApi,
|
|
4551
|
+
querySubgraphTableCount: () => querySubgraphTableCount,
|
|
4552
|
+
querySubgraphTable: () => querySubgraphTable,
|
|
4535
4553
|
pauseAllStreams: () => pauseAllStreams,
|
|
4536
|
-
|
|
4554
|
+
listSubgraphsApi: () => listSubgraphsApi,
|
|
4537
4555
|
listStreams: () => listStreams,
|
|
4538
4556
|
handleApiError: () => handleApiError,
|
|
4539
|
-
|
|
4557
|
+
getSubgraphApi: () => getSubgraphApi,
|
|
4540
4558
|
getStream: () => getStream,
|
|
4541
4559
|
getQueueStats: () => getQueueStats,
|
|
4542
4560
|
enableStream: () => enableStream,
|
|
4543
4561
|
disableStream: () => disableStream,
|
|
4544
|
-
|
|
4545
|
-
|
|
4562
|
+
deploySubgraphApi: () => deploySubgraphApi,
|
|
4563
|
+
deleteSubgraphApi: () => deleteSubgraphApi,
|
|
4546
4564
|
deleteStream: () => deleteStream,
|
|
4547
4565
|
createStream: () => createStream,
|
|
4548
4566
|
authHeaders: () => authHeaders,
|
|
@@ -4620,26 +4638,26 @@ async function resumeAllStreams() {
|
|
|
4620
4638
|
async function getQueueStats() {
|
|
4621
4639
|
return (await getClient()).getQueueStats();
|
|
4622
4640
|
}
|
|
4623
|
-
async function
|
|
4624
|
-
return (await getClient()).
|
|
4641
|
+
async function listSubgraphsApi() {
|
|
4642
|
+
return (await getClient()).subgraphs.list();
|
|
4625
4643
|
}
|
|
4626
|
-
async function
|
|
4627
|
-
return (await getClient()).
|
|
4644
|
+
async function getSubgraphApi(name) {
|
|
4645
|
+
return (await getClient()).subgraphs.get(name);
|
|
4628
4646
|
}
|
|
4629
|
-
async function
|
|
4630
|
-
return (await getClient()).
|
|
4647
|
+
async function reindexSubgraphApi(name, options) {
|
|
4648
|
+
return (await getClient()).subgraphs.reindex(name, options);
|
|
4631
4649
|
}
|
|
4632
|
-
async function
|
|
4633
|
-
return (await getClient()).
|
|
4650
|
+
async function deleteSubgraphApi(name) {
|
|
4651
|
+
return (await getClient()).subgraphs.delete(name);
|
|
4634
4652
|
}
|
|
4635
|
-
async function
|
|
4636
|
-
return (await getClient()).
|
|
4653
|
+
async function deploySubgraphApi(data) {
|
|
4654
|
+
return (await getClient()).subgraphs.deploy(data);
|
|
4637
4655
|
}
|
|
4638
|
-
async function
|
|
4639
|
-
return (await getClient()).
|
|
4656
|
+
async function querySubgraphTable(name, table, params = {}) {
|
|
4657
|
+
return (await getClient()).subgraphs.queryTable(name, table, params);
|
|
4640
4658
|
}
|
|
4641
|
-
async function
|
|
4642
|
-
return (await getClient()).
|
|
4659
|
+
async function querySubgraphTableCount(name, table, params = {}) {
|
|
4660
|
+
return (await getClient()).subgraphs.queryTableCount(name, table, params);
|
|
4643
4661
|
}
|
|
4644
4662
|
var init_api_client = __esm(() => {
|
|
4645
4663
|
init_config();
|
|
@@ -6374,7 +6392,7 @@ var init_responselike = __esm(() => {
|
|
|
6374
6392
|
|
|
6375
6393
|
// ../../node_modules/json-buffer/index.js
|
|
6376
6394
|
var require_json_buffer = __commonJS((exports) => {
|
|
6377
|
-
exports.stringify = function
|
|
6395
|
+
exports.stringify = function stringify2(o) {
|
|
6378
6396
|
if (typeof o == "undefined")
|
|
6379
6397
|
return o;
|
|
6380
6398
|
if (o && Buffer.isBuffer(o))
|
|
@@ -6396,9 +6414,9 @@ var require_json_buffer = __commonJS((exports) => {
|
|
|
6396
6414
|
if (o[k] == undefined)
|
|
6397
6415
|
s += "null";
|
|
6398
6416
|
else
|
|
6399
|
-
s +=
|
|
6417
|
+
s += stringify2(o[k]);
|
|
6400
6418
|
} else if (o[k] !== undefined) {
|
|
6401
|
-
s +=
|
|
6419
|
+
s += stringify2(k) + ":" + stringify2(o[k]);
|
|
6402
6420
|
}
|
|
6403
6421
|
}
|
|
6404
6422
|
}
|
|
@@ -7342,7 +7360,7 @@ var init_FormDataEncoder = __esm(() => {
|
|
|
7342
7360
|
}
|
|
7343
7361
|
}
|
|
7344
7362
|
}
|
|
7345
|
-
[(_FormDataEncoder_CRLF = new WeakMap, _FormDataEncoder_CRLF_BYTES = new WeakMap, _FormDataEncoder_CRLF_BYTES_LENGTH = new WeakMap, _FormDataEncoder_DASHES = new WeakMap, _FormDataEncoder_encoder = new WeakMap, _FormDataEncoder_footer = new WeakMap, _FormDataEncoder_form = new WeakMap, _FormDataEncoder_options = new WeakMap, _FormDataEncoder_instances = new WeakSet, _FormDataEncoder_getFieldHeader = function
|
|
7363
|
+
[(_FormDataEncoder_CRLF = new WeakMap, _FormDataEncoder_CRLF_BYTES = new WeakMap, _FormDataEncoder_CRLF_BYTES_LENGTH = new WeakMap, _FormDataEncoder_DASHES = new WeakMap, _FormDataEncoder_encoder = new WeakMap, _FormDataEncoder_footer = new WeakMap, _FormDataEncoder_form = new WeakMap, _FormDataEncoder_options = new WeakMap, _FormDataEncoder_instances = new WeakSet, _FormDataEncoder_getFieldHeader = function _FormDataEncoder_getFieldHeader2(name, value) {
|
|
7346
7364
|
let header = "";
|
|
7347
7365
|
header += `${__classPrivateFieldGet(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")}`;
|
|
7348
7366
|
header += `Content-Disposition: form-data; name="${escapeName(name)}"`;
|
|
@@ -7355,7 +7373,7 @@ var init_FormDataEncoder = __esm(() => {
|
|
|
7355
7373
|
header += `${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")}Content-Length: ${isFile(value) ? value.size : value.byteLength}`;
|
|
7356
7374
|
}
|
|
7357
7375
|
return __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(`${header}${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f").repeat(2)}`);
|
|
7358
|
-
}, _FormDataEncoder_getContentLength = function
|
|
7376
|
+
}, _FormDataEncoder_getContentLength = function _FormDataEncoder_getContentLength2() {
|
|
7359
7377
|
let length = 0;
|
|
7360
7378
|
for (const [name, raw] of __classPrivateFieldGet(this, _FormDataEncoder_form, "f")) {
|
|
7361
7379
|
const value = isFile(raw) ? raw : __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(normalizeValue(raw));
|
|
@@ -13258,21 +13276,21 @@ var init_webhook_server = __esm(() => {
|
|
|
13258
13276
|
init_output();
|
|
13259
13277
|
});
|
|
13260
13278
|
|
|
13261
|
-
// src/services/
|
|
13279
|
+
// src/services/subgraph-processor.ts
|
|
13262
13280
|
import { resolve as resolve5, dirname as dirname4 } from "node:path";
|
|
13263
|
-
async function
|
|
13281
|
+
async function startSubgraphProcessor(options2) {
|
|
13264
13282
|
const rootDir = dirname4(dirname4(dirname4(dirname4(import.meta.dir))));
|
|
13265
|
-
const servicePath = resolve5(rootDir, "packages/
|
|
13283
|
+
const servicePath = resolve5(rootDir, "packages/subgraphs/src/service.ts");
|
|
13266
13284
|
await serviceManager.start(SERVICE_NAME4, ["bun", "run", "--watch", servicePath], {
|
|
13267
13285
|
env: {
|
|
13268
|
-
|
|
13286
|
+
SUBGRAPH_CONCURRENCY: String(options2.concurrency ?? 5)
|
|
13269
13287
|
},
|
|
13270
13288
|
onStdout: options2.onLog,
|
|
13271
13289
|
onStderr: options2.onLog
|
|
13272
13290
|
});
|
|
13273
13291
|
}
|
|
13274
|
-
var SERVICE_NAME4 = "
|
|
13275
|
-
var
|
|
13292
|
+
var SERVICE_NAME4 = "subgraph-processor";
|
|
13293
|
+
var init_subgraph_processor = __esm(() => {
|
|
13276
13294
|
init_manager();
|
|
13277
13295
|
});
|
|
13278
13296
|
|
|
@@ -13283,7 +13301,7 @@ var init_services = __esm(() => {
|
|
|
13283
13301
|
init_worker();
|
|
13284
13302
|
init_api2();
|
|
13285
13303
|
init_webhook_server();
|
|
13286
|
-
|
|
13304
|
+
init_subgraph_processor();
|
|
13287
13305
|
});
|
|
13288
13306
|
|
|
13289
13307
|
// src/commands/dev-impl.ts
|
|
@@ -13422,19 +13440,19 @@ async function runBackground(options2) {
|
|
|
13422
13440
|
console.log(green(" ✓ Worker"), dim("processing jobs"));
|
|
13423
13441
|
}
|
|
13424
13442
|
{
|
|
13425
|
-
const
|
|
13426
|
-
const
|
|
13443
|
+
const subgraphsLogFile = getLogFile("subgraphs");
|
|
13444
|
+
const subgraphsProc = Bun.spawn(["bun", "run", resolve6(packagesDir, "packages/subgraphs/src/service.ts")], {
|
|
13427
13445
|
env: { ...process.env, ...env },
|
|
13428
|
-
stdout: Bun.file(
|
|
13429
|
-
stderr: Bun.file(
|
|
13446
|
+
stdout: Bun.file(subgraphsLogFile),
|
|
13447
|
+
stderr: Bun.file(subgraphsLogFile)
|
|
13430
13448
|
});
|
|
13431
|
-
state.services.
|
|
13432
|
-
pid:
|
|
13449
|
+
state.services.subgraphs = {
|
|
13450
|
+
pid: subgraphsProc.pid,
|
|
13433
13451
|
port: null,
|
|
13434
13452
|
startedAt: new Date().toISOString(),
|
|
13435
|
-
logFile:
|
|
13453
|
+
logFile: subgraphsLogFile
|
|
13436
13454
|
};
|
|
13437
|
-
console.log(green(" ✓
|
|
13455
|
+
console.log(green(" ✓ Subgraph processor"), dim("processing subgraphs"));
|
|
13438
13456
|
}
|
|
13439
13457
|
if (options2.webhook) {
|
|
13440
13458
|
const webhookLogFile = getLogFile("webhook");
|
|
@@ -13567,8 +13585,8 @@ async function runForeground(options2) {
|
|
|
13567
13585
|
await startWorker({ onLog: (line) => logService("worker", line) });
|
|
13568
13586
|
console.log(green(" ✓ Worker"), dim("processing jobs"));
|
|
13569
13587
|
}
|
|
13570
|
-
await
|
|
13571
|
-
console.log(green(" ✓
|
|
13588
|
+
await startSubgraphProcessor({ onLog: (line) => logService("subgraphs", line) });
|
|
13589
|
+
console.log(green(" ✓ Subgraph processor"), dim("processing subgraphs"));
|
|
13572
13590
|
console.log("");
|
|
13573
13591
|
printUrls(indexerPort, apiPort, webhookPort, options2.webhook);
|
|
13574
13592
|
console.log("");
|
|
@@ -13836,20 +13854,20 @@ async function restartDev() {
|
|
|
13836
13854
|
};
|
|
13837
13855
|
console.log(green(" ✓ Webhook server"), dim(`http://localhost:${webhookPort}`));
|
|
13838
13856
|
}
|
|
13839
|
-
if (state.services.
|
|
13840
|
-
const
|
|
13841
|
-
const
|
|
13857
|
+
if (state.services.subgraphs) {
|
|
13858
|
+
const subgraphsLogFile = getLogFile("subgraphs");
|
|
13859
|
+
const subgraphsProc = Bun.spawn(["bun", "run", resolve6(packagesDir, "packages/subgraphs/src/service.ts")], {
|
|
13842
13860
|
env: { ...process.env, ...env },
|
|
13843
|
-
stdout: Bun.file(
|
|
13844
|
-
stderr: Bun.file(
|
|
13861
|
+
stdout: Bun.file(subgraphsLogFile),
|
|
13862
|
+
stderr: Bun.file(subgraphsLogFile)
|
|
13845
13863
|
});
|
|
13846
|
-
newState.services.
|
|
13847
|
-
pid:
|
|
13864
|
+
newState.services.subgraphs = {
|
|
13865
|
+
pid: subgraphsProc.pid,
|
|
13848
13866
|
port: null,
|
|
13849
13867
|
startedAt: new Date().toISOString(),
|
|
13850
|
-
logFile:
|
|
13868
|
+
logFile: subgraphsLogFile
|
|
13851
13869
|
};
|
|
13852
|
-
console.log(green(" ✓
|
|
13870
|
+
console.log(green(" ✓ Subgraph processor"), dim("processing subgraphs"));
|
|
13853
13871
|
}
|
|
13854
13872
|
await Bun.sleep(500);
|
|
13855
13873
|
for (const [name, service] of Object.entries(newState.services)) {
|
|
@@ -13999,7 +14017,7 @@ var init_dev_impl = __esm(() => {
|
|
|
13999
14017
|
api: blue,
|
|
14000
14018
|
indexer: cyan,
|
|
14001
14019
|
worker: yellow,
|
|
14002
|
-
|
|
14020
|
+
subgraphs: magenta,
|
|
14003
14021
|
webhook: green
|
|
14004
14022
|
};
|
|
14005
14023
|
});
|
|
@@ -21131,23 +21149,23 @@ var require_ansis = __commonJS((exports, module) => {
|
|
|
21131
21149
|
}, s2 = t2, c2 = l2;
|
|
21132
21150
|
return e2 && (s2 = e2.o + t2, c2 = l2 + e2.c), n(o2, r), o2.p = { open: t2, close: l2, o: s2, c: c2, p: e2 }, o2.open = s2, o2.close = c2, o2;
|
|
21133
21151
|
};
|
|
21134
|
-
var w = new function
|
|
21135
|
-
let s2 = { Ansis:
|
|
21136
|
-
for (let t3 in
|
|
21137
|
-
let r2 =
|
|
21152
|
+
var w = new function e2(t2 = f) {
|
|
21153
|
+
let s2 = { Ansis: e2, level: t2, isSupported: () => a2, strip: (e3) => e3.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i), extend(e3) {
|
|
21154
|
+
for (let t3 in e3) {
|
|
21155
|
+
let r2 = e3[t3], l2 = (typeof r2)[0];
|
|
21138
21156
|
l2 === "s" ? (c2(t3, T(...p(r2))), c2(_(t3), v(...p(r2)))) : c2(t3, r2, l2 === "f");
|
|
21139
21157
|
}
|
|
21140
21158
|
return r = o({}, O), n(s2, r), s2;
|
|
21141
|
-
} }, c2 = (
|
|
21142
|
-
O[
|
|
21143
|
-
let n2 = r2 ? (...
|
|
21144
|
-
return l(this,
|
|
21159
|
+
} }, c2 = (e3, t3, r2) => {
|
|
21160
|
+
O[e3] = { get() {
|
|
21161
|
+
let n2 = r2 ? (...e4) => m(this, t3(...e4)) : m(this, t3);
|
|
21162
|
+
return l(this, e3, { value: n2 }), n2;
|
|
21145
21163
|
} };
|
|
21146
|
-
}, a2 = t2 > 0, w2 = (
|
|
21147
|
-
t2 === 2 ? (T = x(C), v = x(E)) : t2 === 1 && (T = $(0, h), v = $(10, b2), C = (
|
|
21148
|
-
let M, I = { fg: C, bg: E, rgb: T, bgRgb: v, hex: y(T), bgHex: y(v), visible: g, reset: w2(0, 0), bold: w2(1, 22), dim: w2(2, 22), italic: w2(3, 23), underline: w2(4, 24), inverse: w2(7, 27), hidden: w2(8, 28), strikethrough: w2(9, 29) }, _ = (
|
|
21149
|
-
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map((
|
|
21150
|
-
M = _(
|
|
21164
|
+
}, a2 = t2 > 0, w2 = (e3, t3) => a2 ? { open: `\x1B[${e3}m`, close: `\x1B[${t3}m` } : g, y = (e3) => (t3) => e3(...p(t3)), R = (e3, t3) => (r2, l2, n2) => w2(`${e3}8;2;${r2};${l2};${n2}`, t3), $ = (e3, t3) => (r2, l2, n2) => w2(((e4, t4, r3) => d(u(e4, t4, r3)))(r2, l2, n2) + e3, t3), x = (e3) => (t3, r2, l2) => e3(u(t3, r2, l2)), T = R(3, h), v = R(4, b2), C = (e3) => w2("38;5;" + e3, h), E = (e3) => w2("48;5;" + e3, b2);
|
|
21165
|
+
t2 === 2 ? (T = x(C), v = x(E)) : t2 === 1 && (T = $(0, h), v = $(10, b2), C = (e3) => w2(d(e3), h), E = (e3) => w2(d(e3) + 10, b2));
|
|
21166
|
+
let M, I = { fg: C, bg: E, rgb: T, bgRgb: v, hex: y(T), bgHex: y(v), visible: g, reset: w2(0, 0), bold: w2(1, 22), dim: w2(2, 22), italic: w2(3, 23), underline: w2(4, 24), inverse: w2(7, 27), hidden: w2(8, 28), strikethrough: w2(9, 29) }, _ = (e3) => "bg" + e3[0].toUpperCase() + e3.slice(1), k = "Bright";
|
|
21167
|
+
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map((e3, t3) => {
|
|
21168
|
+
M = _(e3), 8 > t3 ? (I[e3 + k] = w2(90 + t3, h), I[M + k] = w2(100 + t3, b2)) : t3 = 60, I[e3] = w2(30 + t3, h), I[M] = w2(40 + t3, b2);
|
|
21151
21169
|
}), s2.extend(I);
|
|
21152
21170
|
};
|
|
21153
21171
|
module.exports = w, w.default = w;
|
|
@@ -21159,302 +21177,11 @@ var init_ansis = __esm(() => {
|
|
|
21159
21177
|
import__2 = __toESM(require_ansis(), 1);
|
|
21160
21178
|
});
|
|
21161
21179
|
|
|
21162
|
-
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/commands.mjs
|
|
21163
|
-
function dashDashArg(agent, agentCommand) {
|
|
21164
|
-
return (args) => {
|
|
21165
|
-
if (args.length > 1) {
|
|
21166
|
-
return [agent, agentCommand, args[0], "--", ...args.slice(1)];
|
|
21167
|
-
} else {
|
|
21168
|
-
return [agent, agentCommand, args[0]];
|
|
21169
|
-
}
|
|
21170
|
-
};
|
|
21171
|
-
}
|
|
21172
|
-
function denoExecute() {
|
|
21173
|
-
return (args) => {
|
|
21174
|
-
return ["deno", "run", `npm:${args[0]}`, ...args.slice(1)];
|
|
21175
|
-
};
|
|
21176
|
-
}
|
|
21177
|
-
var npm, yarn, yarnBerry, pnpm, bun, deno, COMMANDS;
|
|
21178
|
-
var init_commands = __esm(() => {
|
|
21179
|
-
npm = {
|
|
21180
|
-
agent: ["npm", 0],
|
|
21181
|
-
run: dashDashArg("npm", "run"),
|
|
21182
|
-
install: ["npm", "i", 0],
|
|
21183
|
-
frozen: ["npm", "ci", 0],
|
|
21184
|
-
global: ["npm", "i", "-g", 0],
|
|
21185
|
-
add: ["npm", "i", 0],
|
|
21186
|
-
upgrade: ["npm", "update", 0],
|
|
21187
|
-
"upgrade-interactive": null,
|
|
21188
|
-
dedupe: ["npm", "dedupe", 0],
|
|
21189
|
-
execute: ["npx", 0],
|
|
21190
|
-
"execute-local": ["npx", 0],
|
|
21191
|
-
uninstall: ["npm", "uninstall", 0],
|
|
21192
|
-
global_uninstall: ["npm", "uninstall", "-g", 0]
|
|
21193
|
-
};
|
|
21194
|
-
yarn = {
|
|
21195
|
-
agent: ["yarn", 0],
|
|
21196
|
-
run: ["yarn", "run", 0],
|
|
21197
|
-
install: ["yarn", "install", 0],
|
|
21198
|
-
frozen: ["yarn", "install", "--frozen-lockfile", 0],
|
|
21199
|
-
global: ["yarn", "global", "add", 0],
|
|
21200
|
-
add: ["yarn", "add", 0],
|
|
21201
|
-
upgrade: ["yarn", "upgrade", 0],
|
|
21202
|
-
"upgrade-interactive": ["yarn", "upgrade-interactive", 0],
|
|
21203
|
-
dedupe: null,
|
|
21204
|
-
execute: ["npx", 0],
|
|
21205
|
-
"execute-local": dashDashArg("yarn", "exec"),
|
|
21206
|
-
uninstall: ["yarn", "remove", 0],
|
|
21207
|
-
global_uninstall: ["yarn", "global", "remove", 0]
|
|
21208
|
-
};
|
|
21209
|
-
yarnBerry = {
|
|
21210
|
-
...yarn,
|
|
21211
|
-
frozen: ["yarn", "install", "--immutable", 0],
|
|
21212
|
-
upgrade: ["yarn", "up", 0],
|
|
21213
|
-
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
21214
|
-
dedupe: ["yarn", "dedupe", 0],
|
|
21215
|
-
execute: ["yarn", "dlx", 0],
|
|
21216
|
-
"execute-local": ["yarn", "exec", 0],
|
|
21217
|
-
global: ["npm", "i", "-g", 0],
|
|
21218
|
-
global_uninstall: ["npm", "uninstall", "-g", 0]
|
|
21219
|
-
};
|
|
21220
|
-
pnpm = {
|
|
21221
|
-
agent: ["pnpm", 0],
|
|
21222
|
-
run: ["pnpm", "run", 0],
|
|
21223
|
-
install: ["pnpm", "i", 0],
|
|
21224
|
-
frozen: ["pnpm", "i", "--frozen-lockfile", 0],
|
|
21225
|
-
global: ["pnpm", "add", "-g", 0],
|
|
21226
|
-
add: ["pnpm", "add", 0],
|
|
21227
|
-
upgrade: ["pnpm", "update", 0],
|
|
21228
|
-
"upgrade-interactive": ["pnpm", "update", "-i", 0],
|
|
21229
|
-
dedupe: ["pnpm", "dedupe", 0],
|
|
21230
|
-
execute: ["pnpm", "dlx", 0],
|
|
21231
|
-
"execute-local": ["pnpm", "exec", 0],
|
|
21232
|
-
uninstall: ["pnpm", "remove", 0],
|
|
21233
|
-
global_uninstall: ["pnpm", "remove", "--global", 0]
|
|
21234
|
-
};
|
|
21235
|
-
bun = {
|
|
21236
|
-
agent: ["bun", 0],
|
|
21237
|
-
run: ["bun", "run", 0],
|
|
21238
|
-
install: ["bun", "install", 0],
|
|
21239
|
-
frozen: ["bun", "install", "--frozen-lockfile", 0],
|
|
21240
|
-
global: ["bun", "add", "-g", 0],
|
|
21241
|
-
add: ["bun", "add", 0],
|
|
21242
|
-
upgrade: ["bun", "update", 0],
|
|
21243
|
-
"upgrade-interactive": ["bun", "update", "-i", 0],
|
|
21244
|
-
dedupe: null,
|
|
21245
|
-
execute: ["bun", "x", 0],
|
|
21246
|
-
"execute-local": ["bun", "x", 0],
|
|
21247
|
-
uninstall: ["bun", "remove", 0],
|
|
21248
|
-
global_uninstall: ["bun", "remove", "-g", 0]
|
|
21249
|
-
};
|
|
21250
|
-
deno = {
|
|
21251
|
-
agent: ["deno", 0],
|
|
21252
|
-
run: ["deno", "task", 0],
|
|
21253
|
-
install: ["deno", "install", 0],
|
|
21254
|
-
frozen: ["deno", "install", "--frozen", 0],
|
|
21255
|
-
global: ["deno", "install", "-g", 0],
|
|
21256
|
-
add: ["deno", "add", 0],
|
|
21257
|
-
upgrade: ["deno", "outdated", "--update", 0],
|
|
21258
|
-
"upgrade-interactive": ["deno", "outdated", "--update", 0],
|
|
21259
|
-
dedupe: null,
|
|
21260
|
-
execute: denoExecute(),
|
|
21261
|
-
"execute-local": ["deno", "task", "--eval", 0],
|
|
21262
|
-
uninstall: ["deno", "remove", 0],
|
|
21263
|
-
global_uninstall: ["deno", "uninstall", "-g", 0]
|
|
21264
|
-
};
|
|
21265
|
-
COMMANDS = {
|
|
21266
|
-
npm,
|
|
21267
|
-
yarn,
|
|
21268
|
-
"yarn@berry": yarnBerry,
|
|
21269
|
-
pnpm,
|
|
21270
|
-
"pnpm@6": {
|
|
21271
|
-
...pnpm,
|
|
21272
|
-
run: dashDashArg("pnpm", "run")
|
|
21273
|
-
},
|
|
21274
|
-
bun,
|
|
21275
|
-
deno
|
|
21276
|
-
};
|
|
21277
|
-
});
|
|
21278
|
-
|
|
21279
|
-
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/constants.mjs
|
|
21280
|
-
var AGENTS, LOCKS, INSTALL_METADATA, INSTALL_PAGE;
|
|
21281
|
-
var init_constants = __esm(() => {
|
|
21282
|
-
AGENTS = [
|
|
21283
|
-
"npm",
|
|
21284
|
-
"yarn",
|
|
21285
|
-
"yarn@berry",
|
|
21286
|
-
"pnpm",
|
|
21287
|
-
"pnpm@6",
|
|
21288
|
-
"bun",
|
|
21289
|
-
"deno"
|
|
21290
|
-
];
|
|
21291
|
-
LOCKS = {
|
|
21292
|
-
"bun.lock": "bun",
|
|
21293
|
-
"bun.lockb": "bun",
|
|
21294
|
-
"deno.lock": "deno",
|
|
21295
|
-
"pnpm-lock.yaml": "pnpm",
|
|
21296
|
-
"pnpm-workspace.yaml": "pnpm",
|
|
21297
|
-
"yarn.lock": "yarn",
|
|
21298
|
-
"package-lock.json": "npm",
|
|
21299
|
-
"npm-shrinkwrap.json": "npm"
|
|
21300
|
-
};
|
|
21301
|
-
INSTALL_METADATA = {
|
|
21302
|
-
"node_modules/.deno/": "deno",
|
|
21303
|
-
"node_modules/.pnpm/": "pnpm",
|
|
21304
|
-
"node_modules/.yarn-state.yml": "yarn",
|
|
21305
|
-
"node_modules/.yarn_integrity": "yarn",
|
|
21306
|
-
"node_modules/.package-lock.json": "npm",
|
|
21307
|
-
".pnp.cjs": "yarn",
|
|
21308
|
-
".pnp.js": "yarn",
|
|
21309
|
-
"bun.lock": "bun",
|
|
21310
|
-
"bun.lockb": "bun"
|
|
21311
|
-
};
|
|
21312
|
-
INSTALL_PAGE = {
|
|
21313
|
-
bun: "https://bun.sh",
|
|
21314
|
-
deno: "https://deno.com",
|
|
21315
|
-
pnpm: "https://pnpm.io/installation",
|
|
21316
|
-
"pnpm@6": "https://pnpm.io/6.x/installation",
|
|
21317
|
-
yarn: "https://classic.yarnpkg.com/en/docs/install",
|
|
21318
|
-
"yarn@berry": "https://yarnpkg.com/getting-started/install",
|
|
21319
|
-
npm: "https://docs.npmjs.com/cli/configuring-npm/install"
|
|
21320
|
-
};
|
|
21321
|
-
});
|
|
21322
|
-
|
|
21323
|
-
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/detect.mjs
|
|
21324
|
-
import fs5 from "node:fs/promises";
|
|
21325
|
-
import path3 from "node:path";
|
|
21326
|
-
import process5 from "node:process";
|
|
21327
|
-
async function pathExists(path22, type) {
|
|
21328
|
-
try {
|
|
21329
|
-
const stat2 = await fs5.stat(path22);
|
|
21330
|
-
return type === "file" ? stat2.isFile() : stat2.isDirectory();
|
|
21331
|
-
} catch {
|
|
21332
|
-
return false;
|
|
21333
|
-
}
|
|
21334
|
-
}
|
|
21335
|
-
function* lookup(cwd = process5.cwd()) {
|
|
21336
|
-
let directory = path3.resolve(cwd);
|
|
21337
|
-
const { root } = path3.parse(directory);
|
|
21338
|
-
while (directory && directory !== root) {
|
|
21339
|
-
yield directory;
|
|
21340
|
-
directory = path3.dirname(directory);
|
|
21341
|
-
}
|
|
21342
|
-
}
|
|
21343
|
-
async function parsePackageJson(filepath, options2) {
|
|
21344
|
-
if (!filepath || !await pathExists(filepath, "file"))
|
|
21345
|
-
return null;
|
|
21346
|
-
return await handlePackageManager(filepath, options2);
|
|
21347
|
-
}
|
|
21348
|
-
async function detect(options2 = {}) {
|
|
21349
|
-
const {
|
|
21350
|
-
cwd,
|
|
21351
|
-
strategies = ["lockfile", "packageManager-field", "devEngines-field"]
|
|
21352
|
-
} = options2;
|
|
21353
|
-
let stopDir;
|
|
21354
|
-
if (typeof options2.stopDir === "string") {
|
|
21355
|
-
const resolved = path3.resolve(options2.stopDir);
|
|
21356
|
-
stopDir = (dir) => dir === resolved;
|
|
21357
|
-
} else {
|
|
21358
|
-
stopDir = options2.stopDir;
|
|
21359
|
-
}
|
|
21360
|
-
for (const directory of lookup(cwd)) {
|
|
21361
|
-
for (const strategy of strategies) {
|
|
21362
|
-
switch (strategy) {
|
|
21363
|
-
case "lockfile": {
|
|
21364
|
-
for (const lock of Object.keys(LOCKS)) {
|
|
21365
|
-
if (await pathExists(path3.join(directory, lock), "file")) {
|
|
21366
|
-
const name = LOCKS[lock];
|
|
21367
|
-
const result = await parsePackageJson(path3.join(directory, "package.json"), options2);
|
|
21368
|
-
if (result)
|
|
21369
|
-
return result;
|
|
21370
|
-
else
|
|
21371
|
-
return { name, agent: name };
|
|
21372
|
-
}
|
|
21373
|
-
}
|
|
21374
|
-
break;
|
|
21375
|
-
}
|
|
21376
|
-
case "packageManager-field":
|
|
21377
|
-
case "devEngines-field": {
|
|
21378
|
-
const result = await parsePackageJson(path3.join(directory, "package.json"), options2);
|
|
21379
|
-
if (result)
|
|
21380
|
-
return result;
|
|
21381
|
-
break;
|
|
21382
|
-
}
|
|
21383
|
-
case "install-metadata": {
|
|
21384
|
-
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
21385
|
-
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
21386
|
-
if (await pathExists(path3.join(directory, metadata), fileOrDir)) {
|
|
21387
|
-
const name = INSTALL_METADATA[metadata];
|
|
21388
|
-
const agent = name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
|
|
21389
|
-
return { name, agent };
|
|
21390
|
-
}
|
|
21391
|
-
}
|
|
21392
|
-
break;
|
|
21393
|
-
}
|
|
21394
|
-
}
|
|
21395
|
-
}
|
|
21396
|
-
if (stopDir?.(directory))
|
|
21397
|
-
break;
|
|
21398
|
-
}
|
|
21399
|
-
return null;
|
|
21400
|
-
}
|
|
21401
|
-
function getNameAndVer(pkg) {
|
|
21402
|
-
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
21403
|
-
if (typeof pkg.packageManager === "string") {
|
|
21404
|
-
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
21405
|
-
return { name, ver: handelVer(ver) };
|
|
21406
|
-
}
|
|
21407
|
-
if (typeof pkg.devEngines?.packageManager?.name === "string") {
|
|
21408
|
-
return {
|
|
21409
|
-
name: pkg.devEngines.packageManager.name,
|
|
21410
|
-
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
21411
|
-
};
|
|
21412
|
-
}
|
|
21413
|
-
return;
|
|
21414
|
-
}
|
|
21415
|
-
async function handlePackageManager(filepath, options2) {
|
|
21416
|
-
try {
|
|
21417
|
-
const content = await fs5.readFile(filepath, "utf8");
|
|
21418
|
-
const pkg = options2.packageJsonParser ? await options2.packageJsonParser(content, filepath) : JSON.parse(content);
|
|
21419
|
-
let agent;
|
|
21420
|
-
const nameAndVer = getNameAndVer(pkg);
|
|
21421
|
-
if (nameAndVer) {
|
|
21422
|
-
const name = nameAndVer.name;
|
|
21423
|
-
const ver = nameAndVer.ver;
|
|
21424
|
-
let version = ver;
|
|
21425
|
-
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
21426
|
-
agent = "yarn@berry";
|
|
21427
|
-
version = "berry";
|
|
21428
|
-
return { name, agent, version };
|
|
21429
|
-
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
21430
|
-
agent = "pnpm@6";
|
|
21431
|
-
return { name, agent, version };
|
|
21432
|
-
} else if (AGENTS.includes(name)) {
|
|
21433
|
-
agent = name;
|
|
21434
|
-
return { name, agent, version };
|
|
21435
|
-
} else {
|
|
21436
|
-
return options2.onUnknown?.(pkg.packageManager) ?? null;
|
|
21437
|
-
}
|
|
21438
|
-
}
|
|
21439
|
-
} catch {}
|
|
21440
|
-
return null;
|
|
21441
|
-
}
|
|
21442
|
-
function isMetadataYarnClassic(metadataPath) {
|
|
21443
|
-
return metadataPath.endsWith(".yarn_integrity");
|
|
21444
|
-
}
|
|
21445
|
-
var init_detect = __esm(() => {
|
|
21446
|
-
init_constants();
|
|
21447
|
-
});
|
|
21448
|
-
|
|
21449
21180
|
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/index.mjs
|
|
21450
21181
|
import"node:fs/promises";
|
|
21451
21182
|
import"node:path";
|
|
21452
21183
|
import"node:process";
|
|
21453
|
-
var init_dist3 =
|
|
21454
|
-
init_commands();
|
|
21455
|
-
init_constants();
|
|
21456
|
-
init_detect();
|
|
21457
|
-
});
|
|
21184
|
+
var init_dist3 = () => {};
|
|
21458
21185
|
|
|
21459
21186
|
// ../../node_modules/tinyexec/dist/main.js
|
|
21460
21187
|
import { createRequire as e } from "module";
|
|
@@ -22149,12 +21876,143 @@ var init_main = __esm(() => {
|
|
|
22149
21876
|
q = K;
|
|
22150
21877
|
});
|
|
22151
21878
|
|
|
21879
|
+
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/constants.mjs
|
|
21880
|
+
var INSTALL_PAGE2;
|
|
21881
|
+
var init_constants = __esm(() => {
|
|
21882
|
+
INSTALL_PAGE2 = {
|
|
21883
|
+
bun: "https://bun.sh",
|
|
21884
|
+
deno: "https://deno.com",
|
|
21885
|
+
pnpm: "https://pnpm.io/installation",
|
|
21886
|
+
"pnpm@6": "https://pnpm.io/6.x/installation",
|
|
21887
|
+
yarn: "https://classic.yarnpkg.com/en/docs/install",
|
|
21888
|
+
"yarn@berry": "https://yarnpkg.com/getting-started/install",
|
|
21889
|
+
npm: "https://docs.npmjs.com/cli/configuring-npm/install"
|
|
21890
|
+
};
|
|
21891
|
+
});
|
|
21892
|
+
|
|
21893
|
+
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/commands.mjs
|
|
21894
|
+
function dashDashArg(agent, agentCommand) {
|
|
21895
|
+
return (args) => {
|
|
21896
|
+
if (args.length > 1) {
|
|
21897
|
+
return [agent, agentCommand, args[0], "--", ...args.slice(1)];
|
|
21898
|
+
} else {
|
|
21899
|
+
return [agent, agentCommand, args[0]];
|
|
21900
|
+
}
|
|
21901
|
+
};
|
|
21902
|
+
}
|
|
21903
|
+
function denoExecute() {
|
|
21904
|
+
return (args) => {
|
|
21905
|
+
return ["deno", "run", `npm:${args[0]}`, ...args.slice(1)];
|
|
21906
|
+
};
|
|
21907
|
+
}
|
|
21908
|
+
var npm, yarn, yarnBerry, pnpm, bun, deno, COMMANDS2;
|
|
21909
|
+
var init_commands = __esm(() => {
|
|
21910
|
+
npm = {
|
|
21911
|
+
agent: ["npm", 0],
|
|
21912
|
+
run: dashDashArg("npm", "run"),
|
|
21913
|
+
install: ["npm", "i", 0],
|
|
21914
|
+
frozen: ["npm", "ci", 0],
|
|
21915
|
+
global: ["npm", "i", "-g", 0],
|
|
21916
|
+
add: ["npm", "i", 0],
|
|
21917
|
+
upgrade: ["npm", "update", 0],
|
|
21918
|
+
"upgrade-interactive": null,
|
|
21919
|
+
dedupe: ["npm", "dedupe", 0],
|
|
21920
|
+
execute: ["npx", 0],
|
|
21921
|
+
"execute-local": ["npx", 0],
|
|
21922
|
+
uninstall: ["npm", "uninstall", 0],
|
|
21923
|
+
global_uninstall: ["npm", "uninstall", "-g", 0]
|
|
21924
|
+
};
|
|
21925
|
+
yarn = {
|
|
21926
|
+
agent: ["yarn", 0],
|
|
21927
|
+
run: ["yarn", "run", 0],
|
|
21928
|
+
install: ["yarn", "install", 0],
|
|
21929
|
+
frozen: ["yarn", "install", "--frozen-lockfile", 0],
|
|
21930
|
+
global: ["yarn", "global", "add", 0],
|
|
21931
|
+
add: ["yarn", "add", 0],
|
|
21932
|
+
upgrade: ["yarn", "upgrade", 0],
|
|
21933
|
+
"upgrade-interactive": ["yarn", "upgrade-interactive", 0],
|
|
21934
|
+
dedupe: null,
|
|
21935
|
+
execute: ["npx", 0],
|
|
21936
|
+
"execute-local": dashDashArg("yarn", "exec"),
|
|
21937
|
+
uninstall: ["yarn", "remove", 0],
|
|
21938
|
+
global_uninstall: ["yarn", "global", "remove", 0]
|
|
21939
|
+
};
|
|
21940
|
+
yarnBerry = {
|
|
21941
|
+
...yarn,
|
|
21942
|
+
frozen: ["yarn", "install", "--immutable", 0],
|
|
21943
|
+
upgrade: ["yarn", "up", 0],
|
|
21944
|
+
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
21945
|
+
dedupe: ["yarn", "dedupe", 0],
|
|
21946
|
+
execute: ["yarn", "dlx", 0],
|
|
21947
|
+
"execute-local": ["yarn", "exec", 0],
|
|
21948
|
+
global: ["npm", "i", "-g", 0],
|
|
21949
|
+
global_uninstall: ["npm", "uninstall", "-g", 0]
|
|
21950
|
+
};
|
|
21951
|
+
pnpm = {
|
|
21952
|
+
agent: ["pnpm", 0],
|
|
21953
|
+
run: ["pnpm", "run", 0],
|
|
21954
|
+
install: ["pnpm", "i", 0],
|
|
21955
|
+
frozen: ["pnpm", "i", "--frozen-lockfile", 0],
|
|
21956
|
+
global: ["pnpm", "add", "-g", 0],
|
|
21957
|
+
add: ["pnpm", "add", 0],
|
|
21958
|
+
upgrade: ["pnpm", "update", 0],
|
|
21959
|
+
"upgrade-interactive": ["pnpm", "update", "-i", 0],
|
|
21960
|
+
dedupe: ["pnpm", "dedupe", 0],
|
|
21961
|
+
execute: ["pnpm", "dlx", 0],
|
|
21962
|
+
"execute-local": ["pnpm", "exec", 0],
|
|
21963
|
+
uninstall: ["pnpm", "remove", 0],
|
|
21964
|
+
global_uninstall: ["pnpm", "remove", "--global", 0]
|
|
21965
|
+
};
|
|
21966
|
+
bun = {
|
|
21967
|
+
agent: ["bun", 0],
|
|
21968
|
+
run: ["bun", "run", 0],
|
|
21969
|
+
install: ["bun", "install", 0],
|
|
21970
|
+
frozen: ["bun", "install", "--frozen-lockfile", 0],
|
|
21971
|
+
global: ["bun", "add", "-g", 0],
|
|
21972
|
+
add: ["bun", "add", 0],
|
|
21973
|
+
upgrade: ["bun", "update", 0],
|
|
21974
|
+
"upgrade-interactive": ["bun", "update", "-i", 0],
|
|
21975
|
+
dedupe: null,
|
|
21976
|
+
execute: ["bun", "x", 0],
|
|
21977
|
+
"execute-local": ["bun", "x", 0],
|
|
21978
|
+
uninstall: ["bun", "remove", 0],
|
|
21979
|
+
global_uninstall: ["bun", "remove", "-g", 0]
|
|
21980
|
+
};
|
|
21981
|
+
deno = {
|
|
21982
|
+
agent: ["deno", 0],
|
|
21983
|
+
run: ["deno", "task", 0],
|
|
21984
|
+
install: ["deno", "install", 0],
|
|
21985
|
+
frozen: ["deno", "install", "--frozen", 0],
|
|
21986
|
+
global: ["deno", "install", "-g", 0],
|
|
21987
|
+
add: ["deno", "add", 0],
|
|
21988
|
+
upgrade: ["deno", "outdated", "--update", 0],
|
|
21989
|
+
"upgrade-interactive": ["deno", "outdated", "--update", 0],
|
|
21990
|
+
dedupe: null,
|
|
21991
|
+
execute: denoExecute(),
|
|
21992
|
+
"execute-local": ["deno", "task", "--eval", 0],
|
|
21993
|
+
uninstall: ["deno", "remove", 0],
|
|
21994
|
+
global_uninstall: ["deno", "uninstall", "-g", 0]
|
|
21995
|
+
};
|
|
21996
|
+
COMMANDS2 = {
|
|
21997
|
+
npm,
|
|
21998
|
+
yarn,
|
|
21999
|
+
"yarn@berry": yarnBerry,
|
|
22000
|
+
pnpm,
|
|
22001
|
+
"pnpm@6": {
|
|
22002
|
+
...pnpm,
|
|
22003
|
+
run: dashDashArg("pnpm", "run")
|
|
22004
|
+
},
|
|
22005
|
+
bun,
|
|
22006
|
+
deno
|
|
22007
|
+
};
|
|
22008
|
+
});
|
|
22009
|
+
|
|
22152
22010
|
// ../../node_modules/@antfu/ni/dist/shared/ni.B5qNAuoI.mjs
|
|
22153
|
-
import
|
|
22011
|
+
import path3, { join as join7, dirname as dirname6, resolve as resolve7 } from "node:path";
|
|
22154
22012
|
import process$1 from "node:process";
|
|
22155
22013
|
import require$$0 from "readline";
|
|
22156
22014
|
import require$$2 from "events";
|
|
22157
|
-
import
|
|
22015
|
+
import fs5, { promises, existsSync as existsSync2 } from "node:fs";
|
|
22158
22016
|
import require$$0$1 from "os";
|
|
22159
22017
|
import require$$1 from "tty";
|
|
22160
22018
|
import os4 from "node:os";
|
|
@@ -25003,10 +24861,10 @@ function requirePosix() {
|
|
|
25003
24861
|
posix.sync = posix.isexe = undefined;
|
|
25004
24862
|
const fs_1 = require$$0$2;
|
|
25005
24863
|
const promises_1 = require$$1$1;
|
|
25006
|
-
const isexe = async (
|
|
24864
|
+
const isexe = async (path4, options2 = {}) => {
|
|
25007
24865
|
const { ignoreErrors = false } = options2;
|
|
25008
24866
|
try {
|
|
25009
|
-
return checkStat(await (0, promises_1.stat)(
|
|
24867
|
+
return checkStat(await (0, promises_1.stat)(path4), options2);
|
|
25010
24868
|
} catch (e2) {
|
|
25011
24869
|
const er = e2;
|
|
25012
24870
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25015,10 +24873,10 @@ function requirePosix() {
|
|
|
25015
24873
|
}
|
|
25016
24874
|
};
|
|
25017
24875
|
posix.isexe = isexe;
|
|
25018
|
-
const sync = (
|
|
24876
|
+
const sync = (path4, options2 = {}) => {
|
|
25019
24877
|
const { ignoreErrors = false } = options2;
|
|
25020
24878
|
try {
|
|
25021
|
-
return checkStat((0, fs_1.statSync)(
|
|
24879
|
+
return checkStat((0, fs_1.statSync)(path4), options2);
|
|
25022
24880
|
} catch (e2) {
|
|
25023
24881
|
const er = e2;
|
|
25024
24882
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25055,10 +24913,10 @@ function requireWin32() {
|
|
|
25055
24913
|
win32.sync = win32.isexe = undefined;
|
|
25056
24914
|
const fs_1 = require$$0$2;
|
|
25057
24915
|
const promises_1 = require$$1$1;
|
|
25058
|
-
const isexe = async (
|
|
24916
|
+
const isexe = async (path4, options2 = {}) => {
|
|
25059
24917
|
const { ignoreErrors = false } = options2;
|
|
25060
24918
|
try {
|
|
25061
|
-
return checkStat(await (0, promises_1.stat)(
|
|
24919
|
+
return checkStat(await (0, promises_1.stat)(path4), path4, options2);
|
|
25062
24920
|
} catch (e2) {
|
|
25063
24921
|
const er = e2;
|
|
25064
24922
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25067,10 +24925,10 @@ function requireWin32() {
|
|
|
25067
24925
|
}
|
|
25068
24926
|
};
|
|
25069
24927
|
win32.isexe = isexe;
|
|
25070
|
-
const sync = (
|
|
24928
|
+
const sync = (path4, options2 = {}) => {
|
|
25071
24929
|
const { ignoreErrors = false } = options2;
|
|
25072
24930
|
try {
|
|
25073
|
-
return checkStat((0, fs_1.statSync)(
|
|
24931
|
+
return checkStat((0, fs_1.statSync)(path4), path4, options2);
|
|
25074
24932
|
} catch (e2) {
|
|
25075
24933
|
const er = e2;
|
|
25076
24934
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25079,7 +24937,7 @@ function requireWin32() {
|
|
|
25079
24937
|
}
|
|
25080
24938
|
};
|
|
25081
24939
|
win32.sync = sync;
|
|
25082
|
-
const checkPathExt = (
|
|
24940
|
+
const checkPathExt = (path4, options2) => {
|
|
25083
24941
|
const { pathExt = process.env.PATHEXT || "" } = options2;
|
|
25084
24942
|
const peSplit = pathExt.split(";");
|
|
25085
24943
|
if (peSplit.indexOf("") !== -1) {
|
|
@@ -25087,14 +24945,14 @@ function requireWin32() {
|
|
|
25087
24945
|
}
|
|
25088
24946
|
for (let i2 = 0;i2 < peSplit.length; i2++) {
|
|
25089
24947
|
const p2 = peSplit[i2].toLowerCase();
|
|
25090
|
-
const ext =
|
|
24948
|
+
const ext = path4.substring(path4.length - p2.length).toLowerCase();
|
|
25091
24949
|
if (p2 && ext === p2) {
|
|
25092
24950
|
return true;
|
|
25093
24951
|
}
|
|
25094
24952
|
}
|
|
25095
24953
|
return false;
|
|
25096
24954
|
};
|
|
25097
|
-
const checkStat = (stat2,
|
|
24955
|
+
const checkStat = (stat2, path4, options2) => stat2.isFile() && checkPathExt(path4, options2);
|
|
25098
24956
|
return win32;
|
|
25099
24957
|
}
|
|
25100
24958
|
function requireOptions() {
|
|
@@ -25269,7 +25127,7 @@ async function detect2({ autoInstall, programmatic, cwd } = {}) {
|
|
|
25269
25127
|
`);
|
|
25270
25128
|
if (process$1.env.CI)
|
|
25271
25129
|
process$1.exit(1);
|
|
25272
|
-
const link2 = terminalLink(name,
|
|
25130
|
+
const link2 = terminalLink(name, INSTALL_PAGE2[name]);
|
|
25273
25131
|
const { tryInstall } = await prompts({
|
|
25274
25132
|
name: "tryInstall",
|
|
25275
25133
|
type: "confirm",
|
|
@@ -25344,7 +25202,7 @@ var init_ni_B5qNAuoI = __esm(() => {
|
|
|
25344
25202
|
CLI_TEMP_DIR = join7(os4.tmpdir(), "antfu-ni");
|
|
25345
25203
|
customRcPath = process$1.env.NI_CONFIG_FILE;
|
|
25346
25204
|
home = process$1.platform === "win32" ? process$1.env.USERPROFILE : process$1.env.HOME;
|
|
25347
|
-
defaultRcPath =
|
|
25205
|
+
defaultRcPath = path3.join(home || "~/", ".nirc");
|
|
25348
25206
|
});
|
|
25349
25207
|
|
|
25350
25208
|
// ../../node_modules/@antfu/ni/dist/index.mjs
|
|
@@ -25552,10 +25410,10 @@ var init_template = __esm(() => {
|
|
|
25552
25410
|
});
|
|
25553
25411
|
|
|
25554
25412
|
// ../../node_modules/execa/lib/utils/standard-stream.js
|
|
25555
|
-
import
|
|
25413
|
+
import process5 from "node:process";
|
|
25556
25414
|
var isStandardStream = (stream2) => STANDARD_STREAMS.includes(stream2), STANDARD_STREAMS, STANDARD_STREAMS_ALIASES, getStreamName = (fdNumber) => STANDARD_STREAMS_ALIASES[fdNumber] ?? `stdio[${fdNumber}]`;
|
|
25557
25415
|
var init_standard_stream = __esm(() => {
|
|
25558
|
-
STANDARD_STREAMS = [
|
|
25416
|
+
STANDARD_STREAMS = [process5.stdin, process5.stdout, process5.stderr];
|
|
25559
25417
|
STANDARD_STREAMS_ALIASES = ["stdin", "stdout", "stderr"];
|
|
25560
25418
|
});
|
|
25561
25419
|
|
|
@@ -25677,11 +25535,11 @@ var init_escape = __esm(() => {
|
|
|
25677
25535
|
});
|
|
25678
25536
|
|
|
25679
25537
|
// ../../node_modules/is-unicode-supported/index.js
|
|
25680
|
-
import
|
|
25538
|
+
import process6 from "node:process";
|
|
25681
25539
|
function isUnicodeSupported() {
|
|
25682
|
-
const { env: env2 } =
|
|
25540
|
+
const { env: env2 } = process6;
|
|
25683
25541
|
const { TERM, TERM_PROGRAM } = env2;
|
|
25684
|
-
if (
|
|
25542
|
+
if (process6.platform !== "win32") {
|
|
25685
25543
|
return TERM !== "linux";
|
|
25686
25544
|
}
|
|
25687
25545
|
return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
@@ -26043,7 +25901,6 @@ var init_base = __esm(() => {
|
|
|
26043
25901
|
// ../../node_modules/yoctocolors/index.js
|
|
26044
25902
|
var init_yoctocolors = __esm(() => {
|
|
26045
25903
|
init_base();
|
|
26046
|
-
init_base();
|
|
26047
25904
|
});
|
|
26048
25905
|
|
|
26049
25906
|
// ../../node_modules/execa/lib/verbose/default.js
|
|
@@ -26215,8 +26072,8 @@ var init_command = __esm(() => {
|
|
|
26215
26072
|
var require_windows = __commonJS((exports, module) => {
|
|
26216
26073
|
module.exports = isexe;
|
|
26217
26074
|
isexe.sync = sync;
|
|
26218
|
-
var
|
|
26219
|
-
function checkPathExt(
|
|
26075
|
+
var fs6 = __require("fs");
|
|
26076
|
+
function checkPathExt(path4, options3) {
|
|
26220
26077
|
var pathext = options3.pathExt !== undefined ? options3.pathExt : process.env.PATHEXT;
|
|
26221
26078
|
if (!pathext) {
|
|
26222
26079
|
return true;
|
|
@@ -26227,25 +26084,25 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
26227
26084
|
}
|
|
26228
26085
|
for (var i2 = 0;i2 < pathext.length; i2++) {
|
|
26229
26086
|
var p2 = pathext[i2].toLowerCase();
|
|
26230
|
-
if (p2 &&
|
|
26087
|
+
if (p2 && path4.substr(-p2.length).toLowerCase() === p2) {
|
|
26231
26088
|
return true;
|
|
26232
26089
|
}
|
|
26233
26090
|
}
|
|
26234
26091
|
return false;
|
|
26235
26092
|
}
|
|
26236
|
-
function checkStat(stat2,
|
|
26093
|
+
function checkStat(stat2, path4, options3) {
|
|
26237
26094
|
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
26238
26095
|
return false;
|
|
26239
26096
|
}
|
|
26240
|
-
return checkPathExt(
|
|
26097
|
+
return checkPathExt(path4, options3);
|
|
26241
26098
|
}
|
|
26242
|
-
function isexe(
|
|
26243
|
-
|
|
26244
|
-
cb(er, er ? false : checkStat(stat2,
|
|
26099
|
+
function isexe(path4, options3, cb) {
|
|
26100
|
+
fs6.stat(path4, function(er, stat2) {
|
|
26101
|
+
cb(er, er ? false : checkStat(stat2, path4, options3));
|
|
26245
26102
|
});
|
|
26246
26103
|
}
|
|
26247
|
-
function sync(
|
|
26248
|
-
return checkStat(
|
|
26104
|
+
function sync(path4, options3) {
|
|
26105
|
+
return checkStat(fs6.statSync(path4), path4, options3);
|
|
26249
26106
|
}
|
|
26250
26107
|
});
|
|
26251
26108
|
|
|
@@ -26253,14 +26110,14 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
26253
26110
|
var require_mode = __commonJS((exports, module) => {
|
|
26254
26111
|
module.exports = isexe;
|
|
26255
26112
|
isexe.sync = sync;
|
|
26256
|
-
var
|
|
26257
|
-
function isexe(
|
|
26258
|
-
|
|
26113
|
+
var fs6 = __require("fs");
|
|
26114
|
+
function isexe(path4, options3, cb) {
|
|
26115
|
+
fs6.stat(path4, function(er, stat2) {
|
|
26259
26116
|
cb(er, er ? false : checkStat(stat2, options3));
|
|
26260
26117
|
});
|
|
26261
26118
|
}
|
|
26262
|
-
function sync(
|
|
26263
|
-
return checkStat(
|
|
26119
|
+
function sync(path4, options3) {
|
|
26120
|
+
return checkStat(fs6.statSync(path4), options3);
|
|
26264
26121
|
}
|
|
26265
26122
|
function checkStat(stat2, options3) {
|
|
26266
26123
|
return stat2.isFile() && checkMode(stat2, options3);
|
|
@@ -26282,7 +26139,7 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
26282
26139
|
|
|
26283
26140
|
// ../../node_modules/isexe/index.js
|
|
26284
26141
|
var require_isexe = __commonJS((exports, module) => {
|
|
26285
|
-
var
|
|
26142
|
+
var fs6 = __require("fs");
|
|
26286
26143
|
var core2;
|
|
26287
26144
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
26288
26145
|
core2 = require_windows();
|
|
@@ -26291,7 +26148,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26291
26148
|
}
|
|
26292
26149
|
module.exports = isexe;
|
|
26293
26150
|
isexe.sync = sync;
|
|
26294
|
-
function isexe(
|
|
26151
|
+
function isexe(path4, options3, cb) {
|
|
26295
26152
|
if (typeof options3 === "function") {
|
|
26296
26153
|
cb = options3;
|
|
26297
26154
|
options3 = {};
|
|
@@ -26301,7 +26158,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26301
26158
|
throw new TypeError("callback not provided");
|
|
26302
26159
|
}
|
|
26303
26160
|
return new Promise(function(resolve8, reject) {
|
|
26304
|
-
isexe(
|
|
26161
|
+
isexe(path4, options3 || {}, function(er, is2) {
|
|
26305
26162
|
if (er) {
|
|
26306
26163
|
reject(er);
|
|
26307
26164
|
} else {
|
|
@@ -26310,7 +26167,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26310
26167
|
});
|
|
26311
26168
|
});
|
|
26312
26169
|
}
|
|
26313
|
-
core2(
|
|
26170
|
+
core2(path4, options3 || {}, function(er, is2) {
|
|
26314
26171
|
if (er) {
|
|
26315
26172
|
if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
|
|
26316
26173
|
er = null;
|
|
@@ -26320,9 +26177,9 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26320
26177
|
cb(er, is2);
|
|
26321
26178
|
});
|
|
26322
26179
|
}
|
|
26323
|
-
function sync(
|
|
26180
|
+
function sync(path4, options3) {
|
|
26324
26181
|
try {
|
|
26325
|
-
return core2.sync(
|
|
26182
|
+
return core2.sync(path4, options3 || {});
|
|
26326
26183
|
} catch (er) {
|
|
26327
26184
|
if (options3 && options3.ignoreErrors || er.code === "EACCES") {
|
|
26328
26185
|
return false;
|
|
@@ -26336,7 +26193,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26336
26193
|
// ../../node_modules/which/which.js
|
|
26337
26194
|
var require_which = __commonJS((exports, module) => {
|
|
26338
26195
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
26339
|
-
var
|
|
26196
|
+
var path4 = __require("path");
|
|
26340
26197
|
var COLON = isWindows ? ";" : ":";
|
|
26341
26198
|
var isexe = require_isexe();
|
|
26342
26199
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -26372,7 +26229,7 @@ var require_which = __commonJS((exports, module) => {
|
|
|
26372
26229
|
return opt.all && found.length ? resolve8(found) : reject(getNotFoundError(cmd));
|
|
26373
26230
|
const ppRaw = pathEnv[i2];
|
|
26374
26231
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
26375
|
-
const pCmd =
|
|
26232
|
+
const pCmd = path4.join(pathPart, cmd);
|
|
26376
26233
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
26377
26234
|
resolve8(subStep(p2, i2, 0));
|
|
26378
26235
|
});
|
|
@@ -26399,7 +26256,7 @@ var require_which = __commonJS((exports, module) => {
|
|
|
26399
26256
|
for (let i2 = 0;i2 < pathEnv.length; i2++) {
|
|
26400
26257
|
const ppRaw = pathEnv[i2];
|
|
26401
26258
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
26402
|
-
const pCmd =
|
|
26259
|
+
const pCmd = path4.join(pathPart, cmd);
|
|
26403
26260
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
26404
26261
|
for (let j2 = 0;j2 < pathExt.length; j2++) {
|
|
26405
26262
|
const cur = p2 + pathExt[j2];
|
|
@@ -26440,7 +26297,7 @@ var require_path_key = __commonJS((exports, module) => {
|
|
|
26440
26297
|
|
|
26441
26298
|
// ../../node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
26442
26299
|
var require_resolveCommand = __commonJS((exports, module) => {
|
|
26443
|
-
var
|
|
26300
|
+
var path4 = __require("path");
|
|
26444
26301
|
var which2 = require_which();
|
|
26445
26302
|
var getPathKey = require_path_key();
|
|
26446
26303
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -26457,7 +26314,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
|
|
|
26457
26314
|
try {
|
|
26458
26315
|
resolved = which2.sync(parsed.command, {
|
|
26459
26316
|
path: env2[getPathKey({ env: env2 })],
|
|
26460
|
-
pathExt: withoutPathExt ?
|
|
26317
|
+
pathExt: withoutPathExt ? path4.delimiter : undefined
|
|
26461
26318
|
});
|
|
26462
26319
|
} catch (e2) {} finally {
|
|
26463
26320
|
if (shouldSwitchCwd) {
|
|
@@ -26465,7 +26322,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
|
|
|
26465
26322
|
}
|
|
26466
26323
|
}
|
|
26467
26324
|
if (resolved) {
|
|
26468
|
-
resolved =
|
|
26325
|
+
resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
26469
26326
|
}
|
|
26470
26327
|
return resolved;
|
|
26471
26328
|
}
|
|
@@ -26510,8 +26367,8 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
26510
26367
|
if (!match) {
|
|
26511
26368
|
return null;
|
|
26512
26369
|
}
|
|
26513
|
-
const [
|
|
26514
|
-
const binary =
|
|
26370
|
+
const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
26371
|
+
const binary = path4.split("/").pop();
|
|
26515
26372
|
if (binary === "env") {
|
|
26516
26373
|
return argument;
|
|
26517
26374
|
}
|
|
@@ -26521,16 +26378,16 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
26521
26378
|
|
|
26522
26379
|
// ../../node_modules/cross-spawn/lib/util/readShebang.js
|
|
26523
26380
|
var require_readShebang = __commonJS((exports, module) => {
|
|
26524
|
-
var
|
|
26381
|
+
var fs6 = __require("fs");
|
|
26525
26382
|
var shebangCommand = require_shebang_command();
|
|
26526
26383
|
function readShebang(command) {
|
|
26527
26384
|
const size2 = 150;
|
|
26528
26385
|
const buffer2 = Buffer.alloc(size2);
|
|
26529
26386
|
let fd;
|
|
26530
26387
|
try {
|
|
26531
|
-
fd =
|
|
26532
|
-
|
|
26533
|
-
|
|
26388
|
+
fd = fs6.openSync(command, "r");
|
|
26389
|
+
fs6.readSync(fd, buffer2, 0, size2, 0);
|
|
26390
|
+
fs6.closeSync(fd);
|
|
26534
26391
|
} catch (e2) {}
|
|
26535
26392
|
return shebangCommand(buffer2.toString());
|
|
26536
26393
|
}
|
|
@@ -26539,7 +26396,7 @@ var require_readShebang = __commonJS((exports, module) => {
|
|
|
26539
26396
|
|
|
26540
26397
|
// ../../node_modules/cross-spawn/lib/parse.js
|
|
26541
26398
|
var require_parse3 = __commonJS((exports, module) => {
|
|
26542
|
-
var
|
|
26399
|
+
var path4 = __require("path");
|
|
26543
26400
|
var resolveCommand2 = require_resolveCommand();
|
|
26544
26401
|
var escape2 = require_escape();
|
|
26545
26402
|
var readShebang = require_readShebang();
|
|
@@ -26564,7 +26421,7 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
26564
26421
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
26565
26422
|
if (parsed.options.forceShell || needsShell) {
|
|
26566
26423
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
26567
|
-
parsed.command =
|
|
26424
|
+
parsed.command = path4.normalize(parsed.command);
|
|
26568
26425
|
parsed.command = escape2.command(parsed.command);
|
|
26569
26426
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
26570
26427
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -26681,7 +26538,7 @@ function pathKey(options3 = {}) {
|
|
|
26681
26538
|
// ../../node_modules/unicorn-magic/node.js
|
|
26682
26539
|
import { promisify as promisify4 } from "node:util";
|
|
26683
26540
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
26684
|
-
import
|
|
26541
|
+
import path4 from "node:path";
|
|
26685
26542
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
26686
26543
|
function toPath(urlOrPath) {
|
|
26687
26544
|
return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
|
|
@@ -26689,12 +26546,12 @@ function toPath(urlOrPath) {
|
|
|
26689
26546
|
function traversePathUp(startPath) {
|
|
26690
26547
|
return {
|
|
26691
26548
|
*[Symbol.iterator]() {
|
|
26692
|
-
let currentPath =
|
|
26549
|
+
let currentPath = path4.resolve(toPath(startPath));
|
|
26693
26550
|
let previousPath;
|
|
26694
26551
|
while (previousPath !== currentPath) {
|
|
26695
26552
|
yield currentPath;
|
|
26696
26553
|
previousPath = currentPath;
|
|
26697
|
-
currentPath =
|
|
26554
|
+
currentPath = path4.resolve(currentPath, "..");
|
|
26698
26555
|
}
|
|
26699
26556
|
}
|
|
26700
26557
|
};
|
|
@@ -26706,38 +26563,38 @@ var init_node = __esm(() => {
|
|
|
26706
26563
|
});
|
|
26707
26564
|
|
|
26708
26565
|
// ../../node_modules/npm-run-path/index.js
|
|
26709
|
-
import
|
|
26710
|
-
import
|
|
26566
|
+
import process7 from "node:process";
|
|
26567
|
+
import path5 from "node:path";
|
|
26711
26568
|
var npmRunPath = ({
|
|
26712
|
-
cwd =
|
|
26713
|
-
path: pathOption =
|
|
26569
|
+
cwd = process7.cwd(),
|
|
26570
|
+
path: pathOption = process7.env[pathKey()],
|
|
26714
26571
|
preferLocal = true,
|
|
26715
|
-
execPath =
|
|
26572
|
+
execPath = process7.execPath,
|
|
26716
26573
|
addExecPath = true
|
|
26717
26574
|
} = {}) => {
|
|
26718
|
-
const cwdPath =
|
|
26575
|
+
const cwdPath = path5.resolve(toPath(cwd));
|
|
26719
26576
|
const result = [];
|
|
26720
|
-
const pathParts = pathOption.split(
|
|
26577
|
+
const pathParts = pathOption.split(path5.delimiter);
|
|
26721
26578
|
if (preferLocal) {
|
|
26722
26579
|
applyPreferLocal(result, pathParts, cwdPath);
|
|
26723
26580
|
}
|
|
26724
26581
|
if (addExecPath) {
|
|
26725
26582
|
applyExecPath(result, pathParts, execPath, cwdPath);
|
|
26726
26583
|
}
|
|
26727
|
-
return pathOption === "" || pathOption ===
|
|
26584
|
+
return pathOption === "" || pathOption === path5.delimiter ? `${result.join(path5.delimiter)}${pathOption}` : [...result, pathOption].join(path5.delimiter);
|
|
26728
26585
|
}, applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
26729
26586
|
for (const directory of traversePathUp(cwdPath)) {
|
|
26730
|
-
const pathPart =
|
|
26587
|
+
const pathPart = path5.join(directory, "node_modules/.bin");
|
|
26731
26588
|
if (!pathParts.includes(pathPart)) {
|
|
26732
26589
|
result.push(pathPart);
|
|
26733
26590
|
}
|
|
26734
26591
|
}
|
|
26735
26592
|
}, applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
26736
|
-
const pathPart =
|
|
26593
|
+
const pathPart = path5.resolve(cwdPath, toPath(execPath), "..");
|
|
26737
26594
|
if (!pathParts.includes(pathPart)) {
|
|
26738
26595
|
result.push(pathPart);
|
|
26739
26596
|
}
|
|
26740
|
-
}, npmRunPathEnv = ({ env: env2 =
|
|
26597
|
+
}, npmRunPathEnv = ({ env: env2 = process7.env, ...options3 } = {}) => {
|
|
26741
26598
|
env2 = { ...env2 };
|
|
26742
26599
|
const pathName = pathKey({ env: env2 });
|
|
26743
26600
|
options3.path = env2[pathName];
|
|
@@ -27843,7 +27700,7 @@ var init_timeout = __esm(() => {
|
|
|
27843
27700
|
|
|
27844
27701
|
// ../../node_modules/execa/lib/methods/node.js
|
|
27845
27702
|
import { execPath, execArgv } from "node:process";
|
|
27846
|
-
import
|
|
27703
|
+
import path6 from "node:path";
|
|
27847
27704
|
var mapNode = ({ options: options3 }) => {
|
|
27848
27705
|
if (options3.node === false) {
|
|
27849
27706
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -27861,7 +27718,7 @@ var mapNode = ({ options: options3 }) => {
|
|
|
27861
27718
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
27862
27719
|
}
|
|
27863
27720
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
|
|
27864
|
-
const resolvedNodePath =
|
|
27721
|
+
const resolvedNodePath = path6.resolve(cwd, normalizedNodePath);
|
|
27865
27722
|
const newOptions = {
|
|
27866
27723
|
...options3,
|
|
27867
27724
|
nodePath: resolvedNodePath,
|
|
@@ -27871,7 +27728,7 @@ var mapNode = ({ options: options3 }) => {
|
|
|
27871
27728
|
if (!shouldHandleNode) {
|
|
27872
27729
|
return [file, commandArguments, newOptions];
|
|
27873
27730
|
}
|
|
27874
|
-
if (
|
|
27731
|
+
if (path6.basename(file, ".exe") === "node") {
|
|
27875
27732
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
27876
27733
|
}
|
|
27877
27734
|
return [
|
|
@@ -27962,14 +27819,14 @@ var init_encoding_option = __esm(() => {
|
|
|
27962
27819
|
|
|
27963
27820
|
// ../../node_modules/execa/lib/arguments/cwd.js
|
|
27964
27821
|
import { statSync } from "node:fs";
|
|
27965
|
-
import
|
|
27966
|
-
import
|
|
27822
|
+
import path7 from "node:path";
|
|
27823
|
+
import process8 from "node:process";
|
|
27967
27824
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
27968
27825
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
27969
|
-
return
|
|
27826
|
+
return path7.resolve(cwdString);
|
|
27970
27827
|
}, getDefaultCwd = () => {
|
|
27971
27828
|
try {
|
|
27972
|
-
return
|
|
27829
|
+
return process8.cwd();
|
|
27973
27830
|
} catch (error2) {
|
|
27974
27831
|
error2.message = `The current directory does not exist.
|
|
27975
27832
|
${error2.message}`;
|
|
@@ -27998,8 +27855,8 @@ var init_cwd = __esm(() => {
|
|
|
27998
27855
|
});
|
|
27999
27856
|
|
|
28000
27857
|
// ../../node_modules/execa/lib/arguments/options.js
|
|
28001
|
-
import
|
|
28002
|
-
import
|
|
27858
|
+
import path8 from "node:path";
|
|
27859
|
+
import process9 from "node:process";
|
|
28003
27860
|
var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
28004
27861
|
rawOptions.cwd = normalizeCwd(rawOptions.cwd);
|
|
28005
27862
|
const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, rawOptions);
|
|
@@ -28016,7 +27873,7 @@ var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions)
|
|
|
28016
27873
|
options3.killSignal = normalizeKillSignal(options3.killSignal);
|
|
28017
27874
|
options3.forceKillAfterDelay = normalizeForceKillAfterDelay(options3.forceKillAfterDelay);
|
|
28018
27875
|
options3.lines = options3.lines.map((lines2, fdNumber) => lines2 && !BINARY_ENCODINGS.has(options3.encoding) && options3.buffer[fdNumber]);
|
|
28019
|
-
if (
|
|
27876
|
+
if (process9.platform === "win32" && path8.basename(file, ".exe") === "cmd") {
|
|
28020
27877
|
commandArguments.unshift("/q");
|
|
28021
27878
|
}
|
|
28022
27879
|
return { file, commandArguments, options: options3 };
|
|
@@ -28055,7 +27912,7 @@ var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions)
|
|
|
28055
27912
|
ipc,
|
|
28056
27913
|
serialization
|
|
28057
27914
|
}), getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
|
|
28058
|
-
const env2 = extendEnv ? { ...
|
|
27915
|
+
const env2 = extendEnv ? { ...process9.env, ...envOption } : envOption;
|
|
28059
27916
|
if (preferLocal || node) {
|
|
28060
27917
|
return npmRunPathEnv({
|
|
28061
27918
|
env: env2,
|
|
@@ -28173,10 +28030,6 @@ function i2() {
|
|
|
28173
28030
|
function o2(r2) {
|
|
28174
28031
|
return this[n2].return(r2);
|
|
28175
28032
|
}
|
|
28176
|
-
function h2({ preventCancel: r2 = false } = {}) {
|
|
28177
|
-
const e2 = this.getReader(), t2 = new c2(e2, r2), s2 = Object.create(u2);
|
|
28178
|
-
return s2[n2] = t2, s2;
|
|
28179
|
-
}
|
|
28180
28033
|
var a3, n2, u2;
|
|
28181
28034
|
var init_asyncIterator = __esm(() => {
|
|
28182
28035
|
a3 = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype);
|
|
@@ -28209,276 +28062,18 @@ var init_ponyfill = __esm(() => {
|
|
|
28209
28062
|
});
|
|
28210
28063
|
|
|
28211
28064
|
// ../../node_modules/get-stream/source/stream.js
|
|
28212
|
-
var
|
|
28213
|
-
if (isReadableStream(stream2, { checkOpen: false }) && nodeImports.on !== undefined) {
|
|
28214
|
-
return getStreamIterable(stream2);
|
|
28215
|
-
}
|
|
28216
|
-
if (typeof stream2?.[Symbol.asyncIterator] === "function") {
|
|
28217
|
-
return stream2;
|
|
28218
|
-
}
|
|
28219
|
-
if (toString2.call(stream2) === "[object ReadableStream]") {
|
|
28220
|
-
return h2.call(stream2);
|
|
28221
|
-
}
|
|
28222
|
-
throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
28223
|
-
}, toString2, getStreamIterable = async function* (stream2) {
|
|
28224
|
-
const controller = new AbortController;
|
|
28225
|
-
const state = {};
|
|
28226
|
-
handleStreamEnd(stream2, controller, state);
|
|
28227
|
-
try {
|
|
28228
|
-
for await (const [chunk] of nodeImports.on(stream2, "data", { signal: controller.signal })) {
|
|
28229
|
-
yield chunk;
|
|
28230
|
-
}
|
|
28231
|
-
} catch (error2) {
|
|
28232
|
-
if (state.error !== undefined) {
|
|
28233
|
-
throw state.error;
|
|
28234
|
-
} else if (!controller.signal.aborted) {
|
|
28235
|
-
throw error2;
|
|
28236
|
-
}
|
|
28237
|
-
} finally {
|
|
28238
|
-
stream2.destroy();
|
|
28239
|
-
}
|
|
28240
|
-
}, handleStreamEnd = async (stream2, controller, state) => {
|
|
28241
|
-
try {
|
|
28242
|
-
await nodeImports.finished(stream2, {
|
|
28243
|
-
cleanup: true,
|
|
28244
|
-
readable: true,
|
|
28245
|
-
writable: false,
|
|
28246
|
-
error: false
|
|
28247
|
-
});
|
|
28248
|
-
} catch (error2) {
|
|
28249
|
-
state.error = error2;
|
|
28250
|
-
} finally {
|
|
28251
|
-
controller.abort();
|
|
28252
|
-
}
|
|
28253
|
-
}, nodeImports;
|
|
28065
|
+
var toString2, nodeImports;
|
|
28254
28066
|
var init_stream = __esm(() => {
|
|
28255
28067
|
init_ponyfill();
|
|
28256
28068
|
({ toString: toString2 } = Object.prototype);
|
|
28257
28069
|
nodeImports = {};
|
|
28258
28070
|
});
|
|
28259
28071
|
|
|
28260
|
-
// ../../node_modules/get-stream/source/contents.js
|
|
28261
|
-
var getStreamContents = async (stream2, { init: init2, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
28262
|
-
const asyncIterable = getAsyncIterable(stream2);
|
|
28263
|
-
const state = init2();
|
|
28264
|
-
state.length = 0;
|
|
28265
|
-
try {
|
|
28266
|
-
for await (const chunk of asyncIterable) {
|
|
28267
|
-
const chunkType = getChunkType(chunk);
|
|
28268
|
-
const convertedChunk = convertChunk[chunkType](chunk, state);
|
|
28269
|
-
appendChunk({
|
|
28270
|
-
convertedChunk,
|
|
28271
|
-
state,
|
|
28272
|
-
getSize,
|
|
28273
|
-
truncateChunk,
|
|
28274
|
-
addChunk,
|
|
28275
|
-
maxBuffer
|
|
28276
|
-
});
|
|
28277
|
-
}
|
|
28278
|
-
appendFinalChunk({
|
|
28279
|
-
state,
|
|
28280
|
-
convertChunk,
|
|
28281
|
-
getSize,
|
|
28282
|
-
truncateChunk,
|
|
28283
|
-
addChunk,
|
|
28284
|
-
getFinalChunk,
|
|
28285
|
-
maxBuffer
|
|
28286
|
-
});
|
|
28287
|
-
return finalize(state);
|
|
28288
|
-
} catch (error2) {
|
|
28289
|
-
const normalizedError = typeof error2 === "object" && error2 !== null ? error2 : new Error(error2);
|
|
28290
|
-
normalizedError.bufferedData = finalize(state);
|
|
28291
|
-
throw normalizedError;
|
|
28292
|
-
}
|
|
28293
|
-
}, appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
|
|
28294
|
-
const convertedChunk = getFinalChunk(state);
|
|
28295
|
-
if (convertedChunk !== undefined) {
|
|
28296
|
-
appendChunk({
|
|
28297
|
-
convertedChunk,
|
|
28298
|
-
state,
|
|
28299
|
-
getSize,
|
|
28300
|
-
truncateChunk,
|
|
28301
|
-
addChunk,
|
|
28302
|
-
maxBuffer
|
|
28303
|
-
});
|
|
28304
|
-
}
|
|
28305
|
-
}, appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
|
|
28306
|
-
const chunkSize = getSize(convertedChunk);
|
|
28307
|
-
const newLength = state.length + chunkSize;
|
|
28308
|
-
if (newLength <= maxBuffer) {
|
|
28309
|
-
addNewChunk(convertedChunk, state, addChunk, newLength);
|
|
28310
|
-
return;
|
|
28311
|
-
}
|
|
28312
|
-
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
|
|
28313
|
-
if (truncatedChunk !== undefined) {
|
|
28314
|
-
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
|
|
28315
|
-
}
|
|
28316
|
-
throw new MaxBufferError;
|
|
28317
|
-
}, addNewChunk = (convertedChunk, state, addChunk, newLength) => {
|
|
28318
|
-
state.contents = addChunk(convertedChunk, state, newLength);
|
|
28319
|
-
state.length = newLength;
|
|
28320
|
-
}, getChunkType = (chunk) => {
|
|
28321
|
-
const typeOfChunk = typeof chunk;
|
|
28322
|
-
if (typeOfChunk === "string") {
|
|
28323
|
-
return "string";
|
|
28324
|
-
}
|
|
28325
|
-
if (typeOfChunk !== "object" || chunk === null) {
|
|
28326
|
-
return "others";
|
|
28327
|
-
}
|
|
28328
|
-
if (globalThis.Buffer?.isBuffer(chunk)) {
|
|
28329
|
-
return "buffer";
|
|
28330
|
-
}
|
|
28331
|
-
const prototypeName = objectToString2.call(chunk);
|
|
28332
|
-
if (prototypeName === "[object ArrayBuffer]") {
|
|
28333
|
-
return "arrayBuffer";
|
|
28334
|
-
}
|
|
28335
|
-
if (prototypeName === "[object DataView]") {
|
|
28336
|
-
return "dataView";
|
|
28337
|
-
}
|
|
28338
|
-
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString2.call(chunk.buffer) === "[object ArrayBuffer]") {
|
|
28339
|
-
return "typedArray";
|
|
28340
|
-
}
|
|
28341
|
-
return "others";
|
|
28342
|
-
}, objectToString2, MaxBufferError;
|
|
28343
|
-
var init_contents = __esm(() => {
|
|
28344
|
-
init_stream();
|
|
28345
|
-
({ toString: objectToString2 } = Object.prototype);
|
|
28346
|
-
MaxBufferError = class MaxBufferError extends Error {
|
|
28347
|
-
name = "MaxBufferError";
|
|
28348
|
-
constructor() {
|
|
28349
|
-
super("maxBuffer exceeded");
|
|
28350
|
-
}
|
|
28351
|
-
};
|
|
28352
|
-
});
|
|
28353
|
-
|
|
28354
|
-
// ../../node_modules/get-stream/source/utils.js
|
|
28355
|
-
var identity2 = (value) => value, noop5 = () => {
|
|
28356
|
-
return;
|
|
28357
|
-
}, getContentsProperty = ({ contents }) => contents, throwObjectStream = (chunk) => {
|
|
28358
|
-
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
28359
|
-
}, getLengthProperty = (convertedChunk) => convertedChunk.length;
|
|
28360
|
-
|
|
28361
|
-
// ../../node_modules/get-stream/source/array.js
|
|
28362
|
-
async function getStreamAsArray(stream2, options3) {
|
|
28363
|
-
return getStreamContents(stream2, arrayMethods, options3);
|
|
28364
|
-
}
|
|
28365
|
-
var initArray = () => ({ contents: [] }), increment = () => 1, addArrayChunk = (convertedChunk, { contents }) => {
|
|
28366
|
-
contents.push(convertedChunk);
|
|
28367
|
-
return contents;
|
|
28368
|
-
}, arrayMethods;
|
|
28369
|
-
var init_array = __esm(() => {
|
|
28370
|
-
init_contents();
|
|
28371
|
-
arrayMethods = {
|
|
28372
|
-
init: initArray,
|
|
28373
|
-
convertChunk: {
|
|
28374
|
-
string: identity2,
|
|
28375
|
-
buffer: identity2,
|
|
28376
|
-
arrayBuffer: identity2,
|
|
28377
|
-
dataView: identity2,
|
|
28378
|
-
typedArray: identity2,
|
|
28379
|
-
others: identity2
|
|
28380
|
-
},
|
|
28381
|
-
getSize: increment,
|
|
28382
|
-
truncateChunk: noop5,
|
|
28383
|
-
addChunk: addArrayChunk,
|
|
28384
|
-
getFinalChunk: noop5,
|
|
28385
|
-
finalize: getContentsProperty
|
|
28386
|
-
};
|
|
28387
|
-
});
|
|
28388
|
-
|
|
28389
|
-
// ../../node_modules/get-stream/source/array-buffer.js
|
|
28390
|
-
async function getStreamAsArrayBuffer(stream2, options3) {
|
|
28391
|
-
return getStreamContents(stream2, arrayBufferMethods, options3);
|
|
28392
|
-
}
|
|
28393
|
-
var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) }), useTextEncoder = (chunk) => textEncoder2.encode(chunk), textEncoder2, useUint8Array = (chunk) => new Uint8Array(chunk), useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength), truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize), addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
|
|
28394
|
-
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
28395
|
-
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
28396
|
-
return newContents;
|
|
28397
|
-
}, resizeArrayBufferSlow = (contents, length) => {
|
|
28398
|
-
if (length <= contents.byteLength) {
|
|
28399
|
-
return contents;
|
|
28400
|
-
}
|
|
28401
|
-
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
28402
|
-
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
28403
|
-
return arrayBuffer;
|
|
28404
|
-
}, resizeArrayBuffer = (contents, length) => {
|
|
28405
|
-
if (length <= contents.maxByteLength) {
|
|
28406
|
-
contents.resize(length);
|
|
28407
|
-
return contents;
|
|
28408
|
-
}
|
|
28409
|
-
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
|
|
28410
|
-
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
28411
|
-
return arrayBuffer;
|
|
28412
|
-
}, getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR)), SCALE_FACTOR = 2, finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length), hasArrayBufferResize = () => ("resize" in ArrayBuffer.prototype), arrayBufferMethods;
|
|
28413
|
-
var init_array_buffer = __esm(() => {
|
|
28414
|
-
init_contents();
|
|
28415
|
-
textEncoder2 = new TextEncoder;
|
|
28416
|
-
arrayBufferMethods = {
|
|
28417
|
-
init: initArrayBuffer,
|
|
28418
|
-
convertChunk: {
|
|
28419
|
-
string: useTextEncoder,
|
|
28420
|
-
buffer: useUint8Array,
|
|
28421
|
-
arrayBuffer: useUint8Array,
|
|
28422
|
-
dataView: useUint8ArrayWithOffset,
|
|
28423
|
-
typedArray: useUint8ArrayWithOffset,
|
|
28424
|
-
others: throwObjectStream
|
|
28425
|
-
},
|
|
28426
|
-
getSize: getLengthProperty,
|
|
28427
|
-
truncateChunk: truncateArrayBufferChunk,
|
|
28428
|
-
addChunk: addArrayBufferChunk,
|
|
28429
|
-
getFinalChunk: noop5,
|
|
28430
|
-
finalize: finalizeArrayBuffer
|
|
28431
|
-
};
|
|
28432
|
-
});
|
|
28433
|
-
|
|
28434
|
-
// ../../node_modules/get-stream/source/buffer.js
|
|
28435
|
-
var init_buffer = __esm(() => {
|
|
28436
|
-
init_array_buffer();
|
|
28437
|
-
});
|
|
28438
|
-
|
|
28439
|
-
// ../../node_modules/get-stream/source/string.js
|
|
28440
|
-
async function getStreamAsString(stream2, options3) {
|
|
28441
|
-
return getStreamContents(stream2, stringMethods, options3);
|
|
28442
|
-
}
|
|
28443
|
-
var initString = () => ({ contents: "", textDecoder: new TextDecoder }), useTextDecoder = (chunk, { textDecoder: textDecoder2 }) => textDecoder2.decode(chunk, { stream: true }), addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk, truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize), getFinalStringChunk = ({ textDecoder: textDecoder2 }) => {
|
|
28444
|
-
const finalChunk = textDecoder2.decode();
|
|
28445
|
-
return finalChunk === "" ? undefined : finalChunk;
|
|
28446
|
-
}, stringMethods;
|
|
28447
|
-
var init_string = __esm(() => {
|
|
28448
|
-
init_contents();
|
|
28449
|
-
stringMethods = {
|
|
28450
|
-
init: initString,
|
|
28451
|
-
convertChunk: {
|
|
28452
|
-
string: identity2,
|
|
28453
|
-
buffer: useTextDecoder,
|
|
28454
|
-
arrayBuffer: useTextDecoder,
|
|
28455
|
-
dataView: useTextDecoder,
|
|
28456
|
-
typedArray: useTextDecoder,
|
|
28457
|
-
others: throwObjectStream
|
|
28458
|
-
},
|
|
28459
|
-
getSize: getLengthProperty,
|
|
28460
|
-
truncateChunk: truncateStringChunk,
|
|
28461
|
-
addChunk: addStringChunk,
|
|
28462
|
-
getFinalChunk: getFinalStringChunk,
|
|
28463
|
-
finalize: getContentsProperty
|
|
28464
|
-
};
|
|
28465
|
-
});
|
|
28466
|
-
|
|
28467
|
-
// ../../node_modules/get-stream/source/exports.js
|
|
28468
|
-
var init_exports = __esm(() => {
|
|
28469
|
-
init_array();
|
|
28470
|
-
init_array_buffer();
|
|
28471
|
-
init_buffer();
|
|
28472
|
-
init_string();
|
|
28473
|
-
init_contents();
|
|
28474
|
-
});
|
|
28475
|
-
|
|
28476
28072
|
// ../../node_modules/get-stream/source/index.js
|
|
28477
28073
|
import { on } from "node:events";
|
|
28478
28074
|
import { finished } from "node:stream/promises";
|
|
28479
28075
|
var init_source5 = __esm(() => {
|
|
28480
28076
|
init_stream();
|
|
28481
|
-
init_exports();
|
|
28482
28077
|
Object.assign(nodeImports, { on, finished });
|
|
28483
28078
|
});
|
|
28484
28079
|
|
|
@@ -29242,7 +28837,7 @@ var init_normalize = __esm(() => {
|
|
|
29242
28837
|
});
|
|
29243
28838
|
|
|
29244
28839
|
// ../../node_modules/execa/lib/stdio/direction.js
|
|
29245
|
-
import
|
|
28840
|
+
import process10 from "node:process";
|
|
29246
28841
|
var getStreamDirection = (stdioItems, fdNumber, optionName) => {
|
|
29247
28842
|
const directions = stdioItems.map((stdioItem) => getStdioItemDirection(stdioItem, fdNumber));
|
|
29248
28843
|
if (directions.includes("input") && directions.includes("output")) {
|
|
@@ -29252,10 +28847,10 @@ var getStreamDirection = (stdioItems, fdNumber, optionName) => {
|
|
|
29252
28847
|
}, getStdioItemDirection = ({ type, value }, fdNumber) => KNOWN_DIRECTIONS[fdNumber] ?? guessStreamDirection[type](value), KNOWN_DIRECTIONS, anyDirection = () => {
|
|
29253
28848
|
return;
|
|
29254
28849
|
}, alwaysInput = () => "input", guessStreamDirection, getStandardStreamDirection = (value) => {
|
|
29255
|
-
if ([0,
|
|
28850
|
+
if ([0, process10.stdin].includes(value)) {
|
|
29256
28851
|
return "input";
|
|
29257
28852
|
}
|
|
29258
|
-
if ([1, 2,
|
|
28853
|
+
if ([1, 2, process10.stdout, process10.stderr].includes(value)) {
|
|
29259
28854
|
return "output";
|
|
29260
28855
|
}
|
|
29261
28856
|
}, DEFAULT_DIRECTION = "output";
|
|
@@ -29834,11 +29429,11 @@ var getEncodingTransformGenerator = (binary, encoding, skipped) => {
|
|
|
29834
29429
|
transform: encodingStringGenerator.bind(undefined, stringDecoder),
|
|
29835
29430
|
final: encodingStringFinal.bind(undefined, stringDecoder)
|
|
29836
29431
|
};
|
|
29837
|
-
}, encodingUint8ArrayGenerator = function* (
|
|
29432
|
+
}, encodingUint8ArrayGenerator = function* (textEncoder2, chunk) {
|
|
29838
29433
|
if (Buffer5.isBuffer(chunk)) {
|
|
29839
29434
|
yield bufferToUint8Array(chunk);
|
|
29840
29435
|
} else if (typeof chunk === "string") {
|
|
29841
|
-
yield
|
|
29436
|
+
yield textEncoder2.encode(chunk);
|
|
29842
29437
|
} else {
|
|
29843
29438
|
yield chunk;
|
|
29844
29439
|
}
|
|
@@ -30148,13 +29743,13 @@ var transformOutputSync = ({ fileDescriptors, syncResult: { output }, options: o
|
|
|
30148
29743
|
state.error ??= error2;
|
|
30149
29744
|
}
|
|
30150
29745
|
}, writeToFiles = (serializedResult, stdioItems, outputFiles) => {
|
|
30151
|
-
for (const { path:
|
|
30152
|
-
const pathString = typeof
|
|
29746
|
+
for (const { path: path9, append } of stdioItems.filter(({ type }) => FILE_TYPES.has(type))) {
|
|
29747
|
+
const pathString = typeof path9 === "string" ? path9 : path9.toString();
|
|
30153
29748
|
if (append || outputFiles.has(pathString)) {
|
|
30154
|
-
appendFileSync(
|
|
29749
|
+
appendFileSync(path9, serializedResult);
|
|
30155
29750
|
} else {
|
|
30156
29751
|
outputFiles.add(pathString);
|
|
30157
|
-
writeFileSync(
|
|
29752
|
+
writeFileSync(path9, serializedResult);
|
|
30158
29753
|
}
|
|
30159
29754
|
}
|
|
30160
29755
|
};
|
|
@@ -30520,13 +30115,13 @@ var init_get_each = __esm(() => {
|
|
|
30520
30115
|
});
|
|
30521
30116
|
|
|
30522
30117
|
// ../../node_modules/execa/lib/ipc/methods.js
|
|
30523
|
-
import
|
|
30118
|
+
import process11 from "node:process";
|
|
30524
30119
|
var addIpcMethods = (subprocess, { ipc }) => {
|
|
30525
30120
|
Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
|
|
30526
30121
|
}, getIpcExport = () => {
|
|
30527
|
-
const anyProcess =
|
|
30122
|
+
const anyProcess = process11;
|
|
30528
30123
|
const isSubprocess = true;
|
|
30529
|
-
const ipc =
|
|
30124
|
+
const ipc = process11.channel !== undefined;
|
|
30530
30125
|
return {
|
|
30531
30126
|
...getIpcMethods(anyProcess, isSubprocess, ipc),
|
|
30532
30127
|
getCancelSignal: getCancelSignal.bind(undefined, {
|
|
@@ -30808,13 +30403,13 @@ var getHighWaterMark = (streams, objectMode) => {
|
|
|
30808
30403
|
}
|
|
30809
30404
|
}, errorStream = (stream2, error2) => {
|
|
30810
30405
|
if (!stream2.destroyed) {
|
|
30811
|
-
stream2.once("error",
|
|
30406
|
+
stream2.once("error", noop5);
|
|
30812
30407
|
stream2.destroy(error2);
|
|
30813
30408
|
}
|
|
30814
|
-
},
|
|
30409
|
+
}, noop5 = () => {}, updateMaxListeners = (passThroughStream, increment) => {
|
|
30815
30410
|
const maxListeners = passThroughStream.getMaxListeners();
|
|
30816
30411
|
if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
|
|
30817
|
-
passThroughStream.setMaxListeners(maxListeners +
|
|
30412
|
+
passThroughStream.setMaxListeners(maxListeners + increment);
|
|
30818
30413
|
}
|
|
30819
30414
|
}, PASSTHROUGH_LISTENERS_COUNT = 2, PASSTHROUGH_LISTENERS_PER_STREAM = 1;
|
|
30820
30415
|
var init_merge_streams = __esm(() => {
|
|
@@ -31020,7 +30615,7 @@ class Emitter {
|
|
|
31020
30615
|
|
|
31021
30616
|
class SignalExitBase {
|
|
31022
30617
|
}
|
|
31023
|
-
var processOk = (
|
|
30618
|
+
var processOk = (process12) => !!process12 && typeof process12 === "object" && typeof process12.removeListener === "function" && typeof process12.emit === "function" && typeof process12.reallyExit === "function" && typeof process12.listeners === "function" && typeof process12.kill === "function" && typeof process12.pid === "number" && typeof process12.on === "function", kExitEmitter, global2, ObjectDefineProperty, signalExitWrap = (handler) => {
|
|
31024
30619
|
return {
|
|
31025
30620
|
onExit(cb, opts) {
|
|
31026
30621
|
return handler.onExit(cb, opts);
|
|
@@ -31032,7 +30627,7 @@ var processOk = (process13) => !!process13 && typeof process13 === "object" && t
|
|
|
31032
30627
|
return handler.unload();
|
|
31033
30628
|
}
|
|
31034
30629
|
};
|
|
31035
|
-
}, SignalExitFallback, SignalExit,
|
|
30630
|
+
}, SignalExitFallback, SignalExit, process12, onExit, load, unload;
|
|
31036
30631
|
var init_mjs = __esm(() => {
|
|
31037
30632
|
init_signals2();
|
|
31038
30633
|
kExitEmitter = Symbol.for("signal-exit emitter");
|
|
@@ -31046,22 +30641,22 @@ var init_mjs = __esm(() => {
|
|
|
31046
30641
|
unload() {}
|
|
31047
30642
|
};
|
|
31048
30643
|
SignalExit = class SignalExit extends SignalExitBase {
|
|
31049
|
-
#hupSig =
|
|
30644
|
+
#hupSig = process12.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
31050
30645
|
#emitter = new Emitter;
|
|
31051
30646
|
#process;
|
|
31052
30647
|
#originalProcessEmit;
|
|
31053
30648
|
#originalProcessReallyExit;
|
|
31054
30649
|
#sigListeners = {};
|
|
31055
30650
|
#loaded = false;
|
|
31056
|
-
constructor(
|
|
30651
|
+
constructor(process12) {
|
|
31057
30652
|
super();
|
|
31058
|
-
this.#process =
|
|
30653
|
+
this.#process = process12;
|
|
31059
30654
|
this.#sigListeners = {};
|
|
31060
30655
|
for (const sig of signals) {
|
|
31061
30656
|
this.#sigListeners[sig] = () => {
|
|
31062
30657
|
const listeners = this.#process.listeners(sig);
|
|
31063
30658
|
let { count: count2 } = this.#emitter;
|
|
31064
|
-
const p2 =
|
|
30659
|
+
const p2 = process12;
|
|
31065
30660
|
if (typeof p2.__signal_exit_emitter__ === "object" && typeof p2.__signal_exit_emitter__.count === "number") {
|
|
31066
30661
|
count2 += p2.__signal_exit_emitter__.count;
|
|
31067
30662
|
}
|
|
@@ -31070,12 +30665,12 @@ var init_mjs = __esm(() => {
|
|
|
31070
30665
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
31071
30666
|
const s2 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
31072
30667
|
if (!ret)
|
|
31073
|
-
|
|
30668
|
+
process12.kill(process12.pid, s2);
|
|
31074
30669
|
}
|
|
31075
30670
|
};
|
|
31076
30671
|
}
|
|
31077
|
-
this.#originalProcessReallyExit =
|
|
31078
|
-
this.#originalProcessEmit =
|
|
30672
|
+
this.#originalProcessReallyExit = process12.reallyExit;
|
|
30673
|
+
this.#originalProcessEmit = process12.emit;
|
|
31079
30674
|
}
|
|
31080
30675
|
onExit(cb, opts) {
|
|
31081
30676
|
if (!processOk(this.#process)) {
|
|
@@ -31153,12 +30748,12 @@ var init_mjs = __esm(() => {
|
|
|
31153
30748
|
}
|
|
31154
30749
|
}
|
|
31155
30750
|
};
|
|
31156
|
-
|
|
30751
|
+
process12 = globalThis.process;
|
|
31157
30752
|
({
|
|
31158
30753
|
onExit,
|
|
31159
30754
|
load,
|
|
31160
30755
|
unload
|
|
31161
|
-
} = signalExitWrap(processOk(
|
|
30756
|
+
} = signalExitWrap(processOk(process12) ? new SignalExit(process12) : new SignalExitFallback));
|
|
31162
30757
|
});
|
|
31163
30758
|
|
|
31164
30759
|
// ../../node_modules/execa/lib/terminate/cleanup.js
|
|
@@ -31544,7 +31139,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31544
31139
|
allMixed
|
|
31545
31140
|
});
|
|
31546
31141
|
const [output] = await Promise.all([
|
|
31547
|
-
|
|
31142
|
+
getStreamContents({
|
|
31548
31143
|
stream: stream2,
|
|
31549
31144
|
iterable,
|
|
31550
31145
|
fdNumber,
|
|
@@ -31578,7 +31173,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31578
31173
|
if (stream2.readableFlowing === null) {
|
|
31579
31174
|
stream2.resume();
|
|
31580
31175
|
}
|
|
31581
|
-
},
|
|
31176
|
+
}, getStreamContents = async ({ stream: stream2, stream: { readableObjectMode }, iterable, fdNumber, encoding, maxBuffer, lines: lines2 }) => {
|
|
31582
31177
|
try {
|
|
31583
31178
|
if (readableObjectMode || lines2) {
|
|
31584
31179
|
return await getStreamAsArray(iterable, { maxBuffer });
|
|
@@ -31586,7 +31181,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31586
31181
|
if (encoding === "buffer") {
|
|
31587
31182
|
return new Uint8Array(await getStreamAsArrayBuffer(iterable, { maxBuffer }));
|
|
31588
31183
|
}
|
|
31589
|
-
return await
|
|
31184
|
+
return await default4(iterable, { maxBuffer });
|
|
31590
31185
|
} catch (error2) {
|
|
31591
31186
|
return handleBufferedData(handleMaxBuffer({
|
|
31592
31187
|
error: error2,
|
|
@@ -31604,7 +31199,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31604
31199
|
return handleBufferedData(error2);
|
|
31605
31200
|
}
|
|
31606
31201
|
}, handleBufferedData = ({ bufferedData }) => isArrayBuffer(bufferedData) ? new Uint8Array(bufferedData) : bufferedData;
|
|
31607
|
-
var
|
|
31202
|
+
var init_contents = __esm(() => {
|
|
31608
31203
|
init_source5();
|
|
31609
31204
|
init_uint_array();
|
|
31610
31205
|
init_output2();
|
|
@@ -31699,7 +31294,7 @@ var waitForStdioStreams = ({ subprocess, encoding, buffer: buffer2, maxBuffer, l
|
|
|
31699
31294
|
return output;
|
|
31700
31295
|
};
|
|
31701
31296
|
var init_stdio = __esm(() => {
|
|
31702
|
-
|
|
31297
|
+
init_contents();
|
|
31703
31298
|
init_wait_stream();
|
|
31704
31299
|
});
|
|
31705
31300
|
|
|
@@ -31909,7 +31504,7 @@ var init_wait_subprocess = __esm(() => {
|
|
|
31909
31504
|
init_graceful2();
|
|
31910
31505
|
init_standard_stream();
|
|
31911
31506
|
init_type();
|
|
31912
|
-
|
|
31507
|
+
init_contents();
|
|
31913
31508
|
init_buffer_messages();
|
|
31914
31509
|
init_ipc_input();
|
|
31915
31510
|
init_all_async();
|
|
@@ -32557,8 +32152,8 @@ var init_execa = __esm(() => {
|
|
|
32557
32152
|
});
|
|
32558
32153
|
|
|
32559
32154
|
// src/utils/dependencies.ts
|
|
32560
|
-
import { promises as
|
|
32561
|
-
import
|
|
32155
|
+
import { promises as fs6 } from "fs";
|
|
32156
|
+
import path9 from "path";
|
|
32562
32157
|
async function getPackageManager(targetDir) {
|
|
32563
32158
|
const packageManager = await detect2({ programmatic: true, cwd: targetDir });
|
|
32564
32159
|
if (packageManager === "yarn@berry")
|
|
@@ -32573,16 +32168,16 @@ async function getPackageManager(targetDir) {
|
|
|
32573
32168
|
}
|
|
32574
32169
|
async function hasPackageJson(targetDir) {
|
|
32575
32170
|
try {
|
|
32576
|
-
const packageJsonPath =
|
|
32577
|
-
await
|
|
32171
|
+
const packageJsonPath = path9.join(targetDir, "package.json");
|
|
32172
|
+
await fs6.access(packageJsonPath);
|
|
32578
32173
|
return true;
|
|
32579
32174
|
} catch {
|
|
32580
32175
|
return false;
|
|
32581
32176
|
}
|
|
32582
32177
|
}
|
|
32583
32178
|
async function readPackageJson(targetDir) {
|
|
32584
|
-
const packageJsonPath =
|
|
32585
|
-
const content = await
|
|
32179
|
+
const packageJsonPath = path9.join(targetDir, "package.json");
|
|
32180
|
+
const content = await fs6.readFile(packageJsonPath, "utf-8");
|
|
32586
32181
|
return JSON.parse(content);
|
|
32587
32182
|
}
|
|
32588
32183
|
async function getMissingDependenciesFor(targetDir, requiredDeps) {
|
|
@@ -32635,7 +32230,7 @@ __export(exports_generate, {
|
|
|
32635
32230
|
resolveContract: () => resolveContract,
|
|
32636
32231
|
generate: () => generate
|
|
32637
32232
|
});
|
|
32638
|
-
import
|
|
32233
|
+
import path10 from "path";
|
|
32639
32234
|
import { toCamelCase as toCamelCase7 } from "@secondlayer/stacks/clarity";
|
|
32640
32235
|
import { getErrorMessage as getErrorMessage2 } from "@secondlayer/shared";
|
|
32641
32236
|
function isContractAddress(input4) {
|
|
@@ -32660,7 +32255,7 @@ async function parseInputs(inputs) {
|
|
|
32660
32255
|
continue;
|
|
32661
32256
|
}
|
|
32662
32257
|
if (input4.endsWith(".clar")) {
|
|
32663
|
-
const absolutePath =
|
|
32258
|
+
const absolutePath = path10.resolve(process.cwd(), input4);
|
|
32664
32259
|
files.push(absolutePath);
|
|
32665
32260
|
}
|
|
32666
32261
|
}
|
|
@@ -32670,7 +32265,7 @@ async function parseInputs(inputs) {
|
|
|
32670
32265
|
};
|
|
32671
32266
|
}
|
|
32672
32267
|
function deriveContractName(filePath) {
|
|
32673
|
-
const basename =
|
|
32268
|
+
const basename = path10.basename(filePath, ".clar");
|
|
32674
32269
|
return basename.replace(/[-_](.)/g, (_2, char) => char.toUpperCase()).replace(/^(.)/, (_2, char) => char.toLowerCase()).replace(/^\d/, "_$&");
|
|
32675
32270
|
}
|
|
32676
32271
|
async function buildConfigFromInputs(parsedInputs, outPath, apiKey, defaultAddress) {
|
|
@@ -32797,9 +32392,9 @@ ${getErrorMessage2(error2)}`));
|
|
|
32797
32392
|
}
|
|
32798
32393
|
async function resolveContract(source, network, apiKey, apiUrl) {
|
|
32799
32394
|
if (source.source) {
|
|
32800
|
-
const filePath =
|
|
32395
|
+
const filePath = path10.resolve(process.cwd(), source.source);
|
|
32801
32396
|
const abi = await parseClarityFile(filePath);
|
|
32802
|
-
const name = source.name ||
|
|
32397
|
+
const name = source.name || path10.basename(source.source, ".clar").replace(/-/g, "_").replace(/^\d/, "_$&");
|
|
32803
32398
|
const address = typeof source.address === "string" ? source.address : source.address?.[network] || DEFAULT_DEVNET_ADDRESS;
|
|
32804
32399
|
const { address: contractAddress, contractName } = address.includes(".") ? parseContractId(address) : { address, contractName: name };
|
|
32805
32400
|
return {
|
|
@@ -32880,12 +32475,12 @@ var exports_init = {};
|
|
|
32880
32475
|
__export(exports_init, {
|
|
32881
32476
|
init: () => init2
|
|
32882
32477
|
});
|
|
32883
|
-
import { promises as
|
|
32884
|
-
import
|
|
32478
|
+
import { promises as fs7 } from "fs";
|
|
32479
|
+
import path11 from "path";
|
|
32885
32480
|
async function init2() {
|
|
32886
|
-
const configPath =
|
|
32481
|
+
const configPath = path11.join(process.cwd(), "secondlayer.config.ts");
|
|
32887
32482
|
try {
|
|
32888
|
-
await
|
|
32483
|
+
await fs7.access(configPath);
|
|
32889
32484
|
console.log(source_default3.yellow("⚠ secondlayer.config.ts already exists"));
|
|
32890
32485
|
return;
|
|
32891
32486
|
} catch {}
|
|
@@ -32909,13 +32504,13 @@ export default defineConfig({
|
|
|
32909
32504
|
plugins: [],
|
|
32910
32505
|
});`;
|
|
32911
32506
|
}
|
|
32912
|
-
await
|
|
32507
|
+
await fs7.writeFile(configPath, config);
|
|
32913
32508
|
console.log(source_default3.green("✓ Created `secondlayer.config.ts`"));
|
|
32914
32509
|
console.log("\nRun `secondlayer generate` to generate type-safe interfaces, functions, and hooks!");
|
|
32915
32510
|
}
|
|
32916
32511
|
async function fileExists2(filePath) {
|
|
32917
32512
|
try {
|
|
32918
|
-
await
|
|
32513
|
+
await fs7.access(filePath);
|
|
32919
32514
|
return true;
|
|
32920
32515
|
} catch {
|
|
32921
32516
|
return false;
|
|
@@ -32943,8 +32538,8 @@ var {
|
|
|
32943
32538
|
// package.json
|
|
32944
32539
|
var package_default = {
|
|
32945
32540
|
name: "@secondlayer/cli",
|
|
32946
|
-
version: "1.
|
|
32947
|
-
description: "CLI for streams,
|
|
32541
|
+
version: "1.6.0",
|
|
32542
|
+
description: "CLI for streams, subgraphs, and real-time blockchain indexing on Stacks",
|
|
32948
32543
|
type: "module",
|
|
32949
32544
|
bin: {
|
|
32950
32545
|
secondlayer: "./dist/cli.js",
|
|
@@ -32984,10 +32579,10 @@ var package_default = {
|
|
|
32984
32579
|
license: "MIT",
|
|
32985
32580
|
dependencies: {
|
|
32986
32581
|
"@inquirer/prompts": "^8.2.0",
|
|
32987
|
-
"@secondlayer/sdk": "^0.
|
|
32988
|
-
"@secondlayer/shared": "^0.
|
|
32582
|
+
"@secondlayer/sdk": "^0.6.0",
|
|
32583
|
+
"@secondlayer/shared": "^0.5.0",
|
|
32989
32584
|
"@secondlayer/stacks": "^0.2.0",
|
|
32990
|
-
"@secondlayer/
|
|
32585
|
+
"@secondlayer/subgraphs": "^0.5.0",
|
|
32991
32586
|
"@biomejs/js-api": "^0.7.0",
|
|
32992
32587
|
"@biomejs/wasm-nodejs": "^1.9.0",
|
|
32993
32588
|
esbuild: "^0.19.0",
|
|
@@ -34566,11 +34161,11 @@ function printStatus(status) {
|
|
|
34566
34161
|
[" Error", status.streams.error > 0 ? red(status.streams.error.toString()) : "0"]
|
|
34567
34162
|
]));
|
|
34568
34163
|
console.log("");
|
|
34569
|
-
if (status.
|
|
34164
|
+
if (status.activeSubgraphs !== undefined || status.recentDeliveries !== undefined) {
|
|
34570
34165
|
console.log(blue("Activity"));
|
|
34571
34166
|
const pairs = [];
|
|
34572
|
-
if (status.
|
|
34573
|
-
pairs.push([" Active
|
|
34167
|
+
if (status.activeSubgraphs !== undefined)
|
|
34168
|
+
pairs.push([" Active Subgraphs", status.activeSubgraphs.toString()]);
|
|
34574
34169
|
if (status.recentDeliveries !== undefined)
|
|
34575
34170
|
pairs.push([" Deliveries (24h)", status.recentDeliveries.toString()]);
|
|
34576
34171
|
console.log(formatKeyValue(pairs));
|
|
@@ -35454,21 +35049,21 @@ async function generatePackageJson(dir, name) {
|
|
|
35454
35049
|
await Bun.write(join5(dir, "package.json"), JSON.stringify(content, null, 2) + `
|
|
35455
35050
|
`);
|
|
35456
35051
|
}
|
|
35457
|
-
// src/commands/
|
|
35052
|
+
// src/commands/subgraphs.ts
|
|
35458
35053
|
init_output();
|
|
35459
35054
|
import { resolve } from "node:path";
|
|
35460
35055
|
import { existsSync, mkdirSync, watch } from "node:fs";
|
|
35461
35056
|
|
|
35462
|
-
// src/templates/
|
|
35463
|
-
function
|
|
35464
|
-
return `import {
|
|
35057
|
+
// src/templates/subgraph.ts
|
|
35058
|
+
function generateSubgraphTemplate(name) {
|
|
35059
|
+
return `import { defineSubgraph } from "@secondlayer/subgraphs";
|
|
35465
35060
|
|
|
35466
|
-
export default
|
|
35061
|
+
export default defineSubgraph({
|
|
35467
35062
|
name: "${name}",
|
|
35468
35063
|
version: "1.0.0",
|
|
35469
|
-
description: "TODO: describe what this
|
|
35064
|
+
description: "TODO: describe what this subgraph tracks",
|
|
35470
35065
|
|
|
35471
|
-
// Sources define what blockchain data this
|
|
35066
|
+
// Sources define what blockchain data this subgraph processes.
|
|
35472
35067
|
// Each source filters transactions/events by contract, type, function, or event.
|
|
35473
35068
|
// Examples:
|
|
35474
35069
|
// { contract: "SP000...::my-contract" } — all txs to a contract
|
|
@@ -35479,7 +35074,7 @@ export default defineView({
|
|
|
35479
35074
|
{ contract: "SP000000000000000000002Q6VF78.pox-4" },
|
|
35480
35075
|
],
|
|
35481
35076
|
|
|
35482
|
-
// Schema defines the tables this
|
|
35077
|
+
// Schema defines the tables this subgraph creates.
|
|
35483
35078
|
// Each table gets auto-columns: _id, _block_height, _tx_id, _created_at.
|
|
35484
35079
|
// Column types: text, uint, int, principal, boolean, timestamp, jsonb
|
|
35485
35080
|
schema: {
|
|
@@ -35510,22 +35105,22 @@ export default defineView({
|
|
|
35510
35105
|
`;
|
|
35511
35106
|
}
|
|
35512
35107
|
|
|
35513
|
-
// src/commands/
|
|
35108
|
+
// src/commands/subgraphs.ts
|
|
35514
35109
|
init_api_client();
|
|
35515
35110
|
init_config();
|
|
35516
35111
|
init_fs();
|
|
35517
35112
|
|
|
35518
|
-
// src/generators/
|
|
35113
|
+
// src/generators/subgraph-scaffold.ts
|
|
35519
35114
|
init_format();
|
|
35520
35115
|
|
|
35521
|
-
// src/generators/clarity-to-
|
|
35116
|
+
// src/generators/clarity-to-subgraph.ts
|
|
35522
35117
|
import {
|
|
35523
35118
|
isAbiBuffer,
|
|
35524
35119
|
isAbiStringAscii,
|
|
35525
35120
|
isAbiStringUtf8,
|
|
35526
35121
|
isAbiOptional
|
|
35527
35122
|
} from "@secondlayer/stacks/clarity";
|
|
35528
|
-
function
|
|
35123
|
+
function clarityTypeToSubgraphColumn(abiType) {
|
|
35529
35124
|
return mapType(abiType, false);
|
|
35530
35125
|
}
|
|
35531
35126
|
function mapType(abiType, nullable) {
|
|
@@ -35565,19 +35160,19 @@ function mapType(abiType, nullable) {
|
|
|
35565
35160
|
return { type: "jsonb", nullable };
|
|
35566
35161
|
}
|
|
35567
35162
|
|
|
35568
|
-
// src/generators/
|
|
35569
|
-
async function
|
|
35163
|
+
// src/generators/subgraph-scaffold.ts
|
|
35164
|
+
async function generateSubgraphScaffold(input2) {
|
|
35570
35165
|
const { contractId, functions } = input2;
|
|
35571
35166
|
const contractParts = contractId.split(".");
|
|
35572
35167
|
const contractName = contractParts[contractParts.length - 1] ?? contractId;
|
|
35573
|
-
const
|
|
35168
|
+
const subgraphName = input2.subgraphName ?? contractName;
|
|
35574
35169
|
const publicFunctions = functions.filter((f) => f.access === "public");
|
|
35575
35170
|
if (publicFunctions.length === 0) {
|
|
35576
35171
|
throw new Error(`No public functions found in ${contractId}`);
|
|
35577
35172
|
}
|
|
35578
35173
|
const tables = publicFunctions.map((fn) => {
|
|
35579
35174
|
const columns = fn.args.map((arg) => {
|
|
35580
|
-
const mapped =
|
|
35175
|
+
const mapped = clarityTypeToSubgraphColumn(arg.type);
|
|
35581
35176
|
const nullable = mapped.nullable ? ", nullable: true" : "";
|
|
35582
35177
|
return ` ${arg.name.replace(/-/g, "_")}: { type: '${mapped.type}'${nullable} }`;
|
|
35583
35178
|
}).join(`,
|
|
@@ -35602,10 +35197,10 @@ ${columns || " _placeholder: { type: 'text' }"}
|
|
|
35602
35197
|
|
|
35603
35198
|
`);
|
|
35604
35199
|
const code = `
|
|
35605
|
-
import {
|
|
35200
|
+
import { defineSubgraph } from '@secondlayer/subgraphs';
|
|
35606
35201
|
|
|
35607
|
-
export default
|
|
35608
|
-
name: '${
|
|
35202
|
+
export default defineSubgraph({
|
|
35203
|
+
name: '${subgraphName}',
|
|
35609
35204
|
sources: [{ contract: '${contractId}' }],
|
|
35610
35205
|
schema: {
|
|
35611
35206
|
${schemaBlock}
|
|
@@ -35618,7 +35213,7 @@ ${handlersBlock}
|
|
|
35618
35213
|
return formatCode(code);
|
|
35619
35214
|
}
|
|
35620
35215
|
|
|
35621
|
-
// src/generators/
|
|
35216
|
+
// src/generators/subgraphs.ts
|
|
35622
35217
|
init_format();
|
|
35623
35218
|
|
|
35624
35219
|
// src/utils/case-conversion.ts
|
|
@@ -35630,13 +35225,13 @@ function toPascalCase(str) {
|
|
|
35630
35225
|
return capitalize(toCamelCase(str));
|
|
35631
35226
|
}
|
|
35632
35227
|
|
|
35633
|
-
// src/generators/
|
|
35634
|
-
async function
|
|
35228
|
+
// src/generators/subgraphs.ts
|
|
35229
|
+
async function generateSubgraphConsumer(subgraphName, detail) {
|
|
35635
35230
|
const tables = Object.entries(detail.tables);
|
|
35636
35231
|
const rowInterfaces = tables.map(([tableName, tableDef]) => {
|
|
35637
35232
|
const typeName = toPascalCase(tableName) + "Row";
|
|
35638
35233
|
const fields = Object.entries(tableDef.columns).map(([colName, colMeta]) => {
|
|
35639
|
-
const tsType =
|
|
35234
|
+
const tsType = subgraphTypeToTS(colMeta.type);
|
|
35640
35235
|
const optional = colMeta.nullable ? "?" : "";
|
|
35641
35236
|
return ` ${colName}${optional}: ${tsType};`;
|
|
35642
35237
|
}).join(`
|
|
@@ -35661,29 +35256,29 @@ ${cols}
|
|
|
35661
35256
|
`);
|
|
35662
35257
|
const code = `
|
|
35663
35258
|
// Auto-generated by secondlayer. Do not edit.
|
|
35664
|
-
import {
|
|
35665
|
-
import type {
|
|
35259
|
+
import { getSubgraph } from '@secondlayer/sdk';
|
|
35260
|
+
import type { InferSubgraphClient } from '@secondlayer/subgraphs';
|
|
35666
35261
|
|
|
35667
35262
|
${rowInterfaces.join(`
|
|
35668
35263
|
|
|
35669
35264
|
`)}
|
|
35670
35265
|
|
|
35671
35266
|
const _schema = {
|
|
35672
|
-
name: '${
|
|
35267
|
+
name: '${subgraphName}',
|
|
35673
35268
|
schema: {
|
|
35674
35269
|
${schemaBlock}
|
|
35675
35270
|
}
|
|
35676
35271
|
} as const;
|
|
35677
35272
|
|
|
35678
|
-
export type Client =
|
|
35273
|
+
export type Client = InferSubgraphClient<typeof _schema>;
|
|
35679
35274
|
|
|
35680
35275
|
export function createClient(options?: { apiKey?: string; baseUrl?: string }): Client {
|
|
35681
|
-
return
|
|
35276
|
+
return getSubgraph(_schema, options ?? {});
|
|
35682
35277
|
}
|
|
35683
35278
|
`.trimStart();
|
|
35684
35279
|
return formatCode(code);
|
|
35685
35280
|
}
|
|
35686
|
-
function
|
|
35281
|
+
function subgraphTypeToTS(type) {
|
|
35687
35282
|
switch (type) {
|
|
35688
35283
|
case "uint":
|
|
35689
35284
|
case "int":
|
|
@@ -35703,13 +35298,13 @@ function viewTypeToTS(type) {
|
|
|
35703
35298
|
}
|
|
35704
35299
|
}
|
|
35705
35300
|
|
|
35706
|
-
// src/commands/
|
|
35301
|
+
// src/commands/subgraphs.ts
|
|
35707
35302
|
init_api();
|
|
35708
35303
|
init_clarity();
|
|
35709
|
-
function
|
|
35710
|
-
const
|
|
35711
|
-
|
|
35712
|
-
const dir = resolve("
|
|
35304
|
+
function registerSubgraphsCommand(program2) {
|
|
35305
|
+
const subgraphs = program2.command("subgraphs").description("Manage materialized subgraphs");
|
|
35306
|
+
subgraphs.command("new <name>").description("Scaffold a new subgraph definition file").action(async (name) => {
|
|
35307
|
+
const dir = resolve("subgraphs");
|
|
35713
35308
|
const filePath = resolve(dir, `${name}.ts`);
|
|
35714
35309
|
if (existsSync(filePath)) {
|
|
35715
35310
|
error(`File already exists: ${filePath}`);
|
|
@@ -35718,12 +35313,12 @@ function registerViewsCommand(program2) {
|
|
|
35718
35313
|
if (!existsSync(dir)) {
|
|
35719
35314
|
mkdirSync(dir, { recursive: true });
|
|
35720
35315
|
}
|
|
35721
|
-
const content =
|
|
35316
|
+
const content = generateSubgraphTemplate(name);
|
|
35722
35317
|
await writeTextFile(filePath, content);
|
|
35723
35318
|
success(`Created ${filePath}`);
|
|
35724
|
-
info(`Next: sl
|
|
35319
|
+
info(`Next: sl subgraphs deploy subgraphs/${name}.ts`);
|
|
35725
35320
|
});
|
|
35726
|
-
|
|
35321
|
+
subgraphs.command("dev <file>").description("Watch a subgraph file and auto-redeploy on change").action(async (file) => {
|
|
35727
35322
|
await requireLocalNetwork();
|
|
35728
35323
|
const absPath = resolve(file);
|
|
35729
35324
|
if (!existsSync(absPath)) {
|
|
@@ -35733,27 +35328,27 @@ function registerViewsCommand(program2) {
|
|
|
35733
35328
|
info(`Watching ${absPath} for changes...`);
|
|
35734
35329
|
info(`Press Ctrl+C to stop
|
|
35735
35330
|
`);
|
|
35736
|
-
const
|
|
35331
|
+
const deploySubgraph = async () => {
|
|
35737
35332
|
try {
|
|
35738
35333
|
delete __require.cache[absPath];
|
|
35739
35334
|
const mod = await import(`${absPath}?t=${Date.now()}`);
|
|
35740
35335
|
const def = mod.default ?? mod;
|
|
35741
|
-
const {
|
|
35742
|
-
const { deploySchema } = await import("@secondlayer/
|
|
35336
|
+
const { validateSubgraphDefinition } = await import("@secondlayer/subgraphs/validate");
|
|
35337
|
+
const { deploySchema } = await import("@secondlayer/subgraphs");
|
|
35743
35338
|
const { getDb: getDb3 } = await import("@secondlayer/shared/db");
|
|
35744
|
-
|
|
35339
|
+
validateSubgraphDefinition(def);
|
|
35745
35340
|
const db = getDb3();
|
|
35746
35341
|
const result = await deploySchema(db, def, absPath, { forceReindex: false });
|
|
35747
35342
|
if (result.action === "unchanged") {
|
|
35748
35343
|
info(`[${new Date().toLocaleTimeString()}] No schema changes`);
|
|
35749
35344
|
} else if (result.action === "created") {
|
|
35750
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35345
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" created`);
|
|
35751
35346
|
} else if (result.action === "updated") {
|
|
35752
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35347
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" updated (additive)`);
|
|
35753
35348
|
} else if (result.action === "reindexed") {
|
|
35754
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35349
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" reindexed (breaking schema change)`);
|
|
35755
35350
|
} else {
|
|
35756
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35351
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" deployed (${result.action})`);
|
|
35757
35352
|
}
|
|
35758
35353
|
const handlerKeys = Object.keys(def.handlers);
|
|
35759
35354
|
info(` Handlers: ${handlerKeys.join(", ")}`);
|
|
@@ -35761,7 +35356,7 @@ function registerViewsCommand(program2) {
|
|
|
35761
35356
|
error(`[${new Date().toLocaleTimeString()}] ${err}`);
|
|
35762
35357
|
}
|
|
35763
35358
|
};
|
|
35764
|
-
await
|
|
35359
|
+
await deploySubgraph();
|
|
35765
35360
|
let timeout = null;
|
|
35766
35361
|
const watcher = watch(absPath, () => {
|
|
35767
35362
|
if (timeout)
|
|
@@ -35769,7 +35364,7 @@ function registerViewsCommand(program2) {
|
|
|
35769
35364
|
timeout = setTimeout(async () => {
|
|
35770
35365
|
console.log("");
|
|
35771
35366
|
info("File changed, redeploying...");
|
|
35772
|
-
await
|
|
35367
|
+
await deploySubgraph();
|
|
35773
35368
|
}, 300);
|
|
35774
35369
|
});
|
|
35775
35370
|
process.on("SIGINT", () => {
|
|
@@ -35782,15 +35377,15 @@ Stopped watching.`);
|
|
|
35782
35377
|
});
|
|
35783
35378
|
await new Promise(() => {});
|
|
35784
35379
|
});
|
|
35785
|
-
|
|
35380
|
+
subgraphs.command("deploy <file>").description("Deploy a subgraph definition file").option("--reindex", "Force reindex on breaking schema change (drops and rebuilds all data)").action(async (file, options2) => {
|
|
35786
35381
|
try {
|
|
35787
35382
|
const absPath = resolve(file);
|
|
35788
35383
|
const config = await loadConfig();
|
|
35789
|
-
info(`Loading
|
|
35384
|
+
info(`Loading subgraph from ${absPath}`);
|
|
35790
35385
|
const mod = await import(absPath);
|
|
35791
35386
|
const def = mod.default ?? mod;
|
|
35792
|
-
const {
|
|
35793
|
-
|
|
35387
|
+
const { validateSubgraphDefinition } = await import("@secondlayer/subgraphs/validate");
|
|
35388
|
+
validateSubgraphDefinition(def);
|
|
35794
35389
|
if (config.network !== "local") {
|
|
35795
35390
|
info(`Bundling for remote deploy (${config.network})...`);
|
|
35796
35391
|
const esbuild = await import("esbuild");
|
|
@@ -35799,11 +35394,11 @@ Stopped watching.`);
|
|
|
35799
35394
|
bundle: true,
|
|
35800
35395
|
platform: "node",
|
|
35801
35396
|
format: "esm",
|
|
35802
|
-
external: ["@secondlayer/
|
|
35397
|
+
external: ["@secondlayer/subgraphs"],
|
|
35803
35398
|
write: false
|
|
35804
35399
|
});
|
|
35805
35400
|
const handlerCode = new TextDecoder().decode(buildResult.outputFiles[0].contents);
|
|
35806
|
-
const result = await
|
|
35401
|
+
const result = await deploySubgraphApi({
|
|
35807
35402
|
name: def.name,
|
|
35808
35403
|
version: def.version,
|
|
35809
35404
|
description: def.description,
|
|
@@ -35813,41 +35408,41 @@ Stopped watching.`);
|
|
|
35813
35408
|
reindex: options2.reindex
|
|
35814
35409
|
});
|
|
35815
35410
|
if (result.action === "unchanged") {
|
|
35816
|
-
info(`
|
|
35411
|
+
info(`Subgraph "${def.name}" is up to date (no schema changes)`);
|
|
35817
35412
|
} else {
|
|
35818
|
-
success(`
|
|
35413
|
+
success(`Subgraph "${def.name}" ${result.action} (remote)`);
|
|
35819
35414
|
}
|
|
35820
35415
|
} else {
|
|
35821
|
-
const { deploySchema } = await import("@secondlayer/
|
|
35416
|
+
const { deploySchema } = await import("@secondlayer/subgraphs");
|
|
35822
35417
|
const { getDb: getDb3, closeDb } = await import("@secondlayer/shared/db");
|
|
35823
35418
|
const db = getDb3();
|
|
35824
35419
|
const result = await deploySchema(db, def, absPath, { forceReindex: options2.reindex });
|
|
35825
35420
|
if (result.action === "unchanged") {
|
|
35826
|
-
info(`
|
|
35421
|
+
info(`Subgraph "${def.name}" is up to date (no schema changes)`);
|
|
35827
35422
|
} else if (result.action === "created") {
|
|
35828
|
-
success(`
|
|
35423
|
+
success(`Subgraph "${def.name}" created (id: ${result.subgraphId.slice(0, 8)})`);
|
|
35829
35424
|
} else if (result.action === "reindexed") {
|
|
35830
|
-
success(`
|
|
35831
|
-
info(`Reindexing will begin when
|
|
35425
|
+
success(`Subgraph "${def.name}" schema rebuilt (id: ${result.subgraphId.slice(0, 8)})`);
|
|
35426
|
+
info(`Reindexing will begin when subgraph processor starts.`);
|
|
35832
35427
|
} else {
|
|
35833
|
-
success(`
|
|
35428
|
+
success(`Subgraph "${def.name}" updated (id: ${result.subgraphId.slice(0, 8)})`);
|
|
35834
35429
|
}
|
|
35835
35430
|
await closeDb();
|
|
35836
35431
|
}
|
|
35837
35432
|
} catch (err) {
|
|
35838
|
-
error(`Failed to deploy
|
|
35433
|
+
error(`Failed to deploy subgraph: ${err}`);
|
|
35839
35434
|
process.exit(1);
|
|
35840
35435
|
}
|
|
35841
35436
|
});
|
|
35842
|
-
|
|
35437
|
+
subgraphs.command("list").alias("ls").description("List all deployed subgraphs").option("--json", "Output as JSON").action(async (options2) => {
|
|
35843
35438
|
try {
|
|
35844
|
-
const { data } = await
|
|
35439
|
+
const { data } = await listSubgraphsApi();
|
|
35845
35440
|
if (options2.json) {
|
|
35846
35441
|
console.log(JSON.stringify(data, null, 2));
|
|
35847
35442
|
return;
|
|
35848
35443
|
}
|
|
35849
35444
|
if (data.length === 0) {
|
|
35850
|
-
console.log("No
|
|
35445
|
+
console.log("No subgraphs deployed");
|
|
35851
35446
|
return;
|
|
35852
35447
|
}
|
|
35853
35448
|
const tableRows = data.map((v) => {
|
|
@@ -35862,31 +35457,31 @@ Stopped watching.`);
|
|
|
35862
35457
|
});
|
|
35863
35458
|
console.log(formatTable(["Name", "Version", "Status", "Last Block", "Tables"], tableRows));
|
|
35864
35459
|
console.log(dim(`
|
|
35865
|
-
${data.length}
|
|
35460
|
+
${data.length} subgraph(s) total`));
|
|
35866
35461
|
} catch (err) {
|
|
35867
|
-
handleApiError(err, "list
|
|
35462
|
+
handleApiError(err, "list subgraphs");
|
|
35868
35463
|
}
|
|
35869
35464
|
});
|
|
35870
|
-
|
|
35465
|
+
subgraphs.command("status <name>").description("Show detailed subgraph status").action(async (name) => {
|
|
35871
35466
|
try {
|
|
35872
|
-
const
|
|
35873
|
-
const rowCounts = Object.entries(
|
|
35874
|
-
const errorRate =
|
|
35467
|
+
const subgraph = await getSubgraphApi(name);
|
|
35468
|
+
const rowCounts = Object.entries(subgraph.tables).map(([t, info2]) => `${t}: ${info2.rowCount}`).join(", ") || "N/A";
|
|
35469
|
+
const errorRate = subgraph.health.totalProcessed > 0 ? `${(subgraph.health.errorRate * 100).toFixed(2)}%` : "N/A";
|
|
35875
35470
|
console.log(formatKeyValue([
|
|
35876
|
-
["Name",
|
|
35877
|
-
["Version",
|
|
35878
|
-
["Status",
|
|
35879
|
-
["Last Block", String(
|
|
35471
|
+
["Name", subgraph.name],
|
|
35472
|
+
["Version", subgraph.version],
|
|
35473
|
+
["Status", subgraph.status],
|
|
35474
|
+
["Last Block", String(subgraph.lastProcessedBlock)],
|
|
35880
35475
|
["Row Count", rowCounts],
|
|
35881
|
-
["Total Processed", String(
|
|
35882
|
-
["Total Errors", String(
|
|
35476
|
+
["Total Processed", String(subgraph.health.totalProcessed)],
|
|
35477
|
+
["Total Errors", String(subgraph.health.totalErrors)],
|
|
35883
35478
|
["Error Rate", errorRate],
|
|
35884
|
-
["Last Error",
|
|
35885
|
-
["Last Error At",
|
|
35886
|
-
["Created",
|
|
35887
|
-
["Updated",
|
|
35479
|
+
["Last Error", subgraph.health.lastError ?? "none"],
|
|
35480
|
+
["Last Error At", subgraph.health.lastErrorAt ?? "N/A"],
|
|
35481
|
+
["Created", subgraph.createdAt],
|
|
35482
|
+
["Updated", subgraph.updatedAt]
|
|
35888
35483
|
]));
|
|
35889
|
-
const tableEntries = Object.entries(
|
|
35484
|
+
const tableEntries = Object.entries(subgraph.tables);
|
|
35890
35485
|
if (tableEntries.length > 0) {
|
|
35891
35486
|
console.log(dim(`
|
|
35892
35487
|
Table endpoints:`));
|
|
@@ -35895,23 +35490,23 @@ Table endpoints:`));
|
|
|
35895
35490
|
}
|
|
35896
35491
|
}
|
|
35897
35492
|
} catch (err) {
|
|
35898
|
-
handleApiError(err, "get
|
|
35493
|
+
handleApiError(err, "get subgraph status");
|
|
35899
35494
|
}
|
|
35900
35495
|
});
|
|
35901
|
-
|
|
35496
|
+
subgraphs.command("reindex <name>").description("Reindex a subgraph from historical blocks").option("--from <block>", "Start block height").option("--to <block>", "End block height").action(async (name, options2) => {
|
|
35902
35497
|
try {
|
|
35903
|
-
info(`Reindexing
|
|
35904
|
-
const result = await
|
|
35498
|
+
info(`Reindexing subgraph "${name}"...`);
|
|
35499
|
+
const result = await reindexSubgraphApi(name, {
|
|
35905
35500
|
fromBlock: options2.from ? parseInt(options2.from, 10) : undefined,
|
|
35906
35501
|
toBlock: options2.to ? parseInt(options2.to, 10) : undefined
|
|
35907
35502
|
});
|
|
35908
35503
|
success(result.message);
|
|
35909
35504
|
info(`From block ${result.fromBlock} to ${result.toBlock}`);
|
|
35910
35505
|
} catch (err) {
|
|
35911
|
-
handleApiError(err, "reindex
|
|
35506
|
+
handleApiError(err, "reindex subgraph");
|
|
35912
35507
|
}
|
|
35913
35508
|
});
|
|
35914
|
-
|
|
35509
|
+
subgraphs.command("query <name> <table>").description("Query a subgraph table").option("--sort <column>", "Sort by column").option("--order <dir>", "Sort direction (asc|desc)", "asc").option("--limit <n>", "Max rows to return", "20").option("--offset <n>", "Skip first N rows").option("--fields <cols>", "Comma-separated columns to include").option("--filter <kv...>", "Filter as key=value (supports .gte/.lte/.gt/.lt/.neq suffixes)").option("--count", "Return row count only").option("--json", "Output as JSON").action(async (name, table, options2) => {
|
|
35915
35510
|
try {
|
|
35916
35511
|
const filters = {};
|
|
35917
35512
|
if (options2.filter) {
|
|
@@ -35933,7 +35528,7 @@ Table endpoints:`));
|
|
|
35933
35528
|
filters: Object.keys(filters).length > 0 ? filters : undefined
|
|
35934
35529
|
};
|
|
35935
35530
|
if (options2.count) {
|
|
35936
|
-
const result = await
|
|
35531
|
+
const result = await querySubgraphTableCount(name, table, params);
|
|
35937
35532
|
if (options2.json) {
|
|
35938
35533
|
console.log(JSON.stringify(result, null, 2));
|
|
35939
35534
|
} else {
|
|
@@ -35941,7 +35536,7 @@ Table endpoints:`));
|
|
|
35941
35536
|
}
|
|
35942
35537
|
return;
|
|
35943
35538
|
}
|
|
35944
|
-
const rows = await
|
|
35539
|
+
const rows = await querySubgraphTable(name, table, params);
|
|
35945
35540
|
if (options2.json) {
|
|
35946
35541
|
console.log(JSON.stringify(rows, null, 2));
|
|
35947
35542
|
return;
|
|
@@ -35963,28 +35558,28 @@ Table endpoints:`));
|
|
|
35963
35558
|
console.log(dim(`
|
|
35964
35559
|
${rows.length} row(s)`));
|
|
35965
35560
|
} catch (err) {
|
|
35966
|
-
handleApiError(err, "query
|
|
35561
|
+
handleApiError(err, "query subgraph");
|
|
35967
35562
|
}
|
|
35968
35563
|
});
|
|
35969
|
-
|
|
35564
|
+
subgraphs.command("delete <name>").description("Delete a subgraph and its data").option("-y, --yes", "Skip confirmation").action(async (name, options2) => {
|
|
35970
35565
|
try {
|
|
35971
35566
|
if (!options2.yes) {
|
|
35972
35567
|
const { confirm: confirm6 } = await import("@inquirer/prompts");
|
|
35973
35568
|
const ok = await confirm6({
|
|
35974
|
-
message: `Delete
|
|
35569
|
+
message: `Delete subgraph "${name}" and all its data? This cannot be undone.`
|
|
35975
35570
|
});
|
|
35976
35571
|
if (!ok) {
|
|
35977
35572
|
info("Cancelled");
|
|
35978
35573
|
return;
|
|
35979
35574
|
}
|
|
35980
35575
|
}
|
|
35981
|
-
const result = await
|
|
35576
|
+
const result = await deleteSubgraphApi(name);
|
|
35982
35577
|
success(result.message);
|
|
35983
35578
|
} catch (err) {
|
|
35984
|
-
handleApiError(err, "delete
|
|
35579
|
+
handleApiError(err, "delete subgraph");
|
|
35985
35580
|
}
|
|
35986
35581
|
});
|
|
35987
|
-
|
|
35582
|
+
subgraphs.command("scaffold <contractAddress>").description("Scaffold a defineSubgraph() file from a contract ABI").option("-o, --output <path>", "Output file path (required)").option("--api-key <key>", "Hiro API key").action(async (contractAddress, options2) => {
|
|
35988
35583
|
try {
|
|
35989
35584
|
if (!options2.output) {
|
|
35990
35585
|
error("--output <path> is required");
|
|
@@ -35998,7 +35593,7 @@ ${rows.length} row(s)`));
|
|
|
35998
35593
|
const contractInfo = await client.getContractInfo(contractAddress);
|
|
35999
35594
|
const abi = parseApiResponse(contractInfo);
|
|
36000
35595
|
info(`Generating scaffold...`);
|
|
36001
|
-
const content = await
|
|
35596
|
+
const content = await generateSubgraphScaffold({
|
|
36002
35597
|
contractId: contractAddress,
|
|
36003
35598
|
functions: abi.functions
|
|
36004
35599
|
});
|
|
@@ -36007,30 +35602,30 @@ ${rows.length} row(s)`));
|
|
|
36007
35602
|
mkdirSync(dir, { recursive: true });
|
|
36008
35603
|
await writeTextFile(outPath, content);
|
|
36009
35604
|
success(`Created ${outPath}`);
|
|
36010
|
-
info(`Next: sl
|
|
35605
|
+
info(`Next: sl subgraphs deploy ${options2.output}`);
|
|
36011
35606
|
} catch (err) {
|
|
36012
|
-
error(`Failed to scaffold
|
|
35607
|
+
error(`Failed to scaffold subgraph: ${err}`);
|
|
36013
35608
|
process.exit(1);
|
|
36014
35609
|
}
|
|
36015
35610
|
});
|
|
36016
|
-
|
|
35611
|
+
subgraphs.command("generate <subgraphName>").description("Generate a typed client for a deployed subgraph").option("-o, --output <path>", "Output file path (required)").action(async (subgraphName, options2) => {
|
|
36017
35612
|
try {
|
|
36018
35613
|
if (!options2.output) {
|
|
36019
35614
|
error("--output <path> is required");
|
|
36020
35615
|
process.exit(1);
|
|
36021
35616
|
}
|
|
36022
35617
|
const outPath = resolve(options2.output);
|
|
36023
|
-
info(`Fetching
|
|
36024
|
-
const
|
|
35618
|
+
info(`Fetching subgraph metadata for "${subgraphName}"...`);
|
|
35619
|
+
const subgraphDetail = await getSubgraphApi(subgraphName);
|
|
36025
35620
|
info(`Generating typed client...`);
|
|
36026
|
-
const content = await
|
|
35621
|
+
const content = await generateSubgraphConsumer(subgraphName, subgraphDetail);
|
|
36027
35622
|
const dir = resolve(outPath, "..");
|
|
36028
35623
|
if (!existsSync(dir))
|
|
36029
35624
|
mkdirSync(dir, { recursive: true });
|
|
36030
35625
|
await writeTextFile(outPath, content);
|
|
36031
35626
|
success(`Created ${outPath}`);
|
|
36032
35627
|
} catch (err) {
|
|
36033
|
-
handleApiError(err, "generate
|
|
35628
|
+
handleApiError(err, "generate subgraph client");
|
|
36034
35629
|
}
|
|
36035
35630
|
});
|
|
36036
35631
|
}
|
|
@@ -36604,9 +36199,9 @@ function registerAuthCommand(program2) {
|
|
|
36604
36199
|
body: JSON.stringify({ email })
|
|
36605
36200
|
});
|
|
36606
36201
|
await assertOk(mlRes);
|
|
36607
|
-
console.log(dim("Check your email for a login
|
|
36202
|
+
console.log(dim("Check your email for a 6-digit login code."));
|
|
36608
36203
|
const token = await input2({
|
|
36609
|
-
message: "
|
|
36204
|
+
message: "Code:",
|
|
36610
36205
|
validate: (v) => v.trim().length > 0 || "Token is required"
|
|
36611
36206
|
});
|
|
36612
36207
|
const verifyRes = await fetch(`${apiUrl}/api/auth/verify`, {
|
|
@@ -36818,7 +36413,7 @@ init_config();
|
|
|
36818
36413
|
init_dev_state();
|
|
36819
36414
|
init_node_manager();
|
|
36820
36415
|
init_output();
|
|
36821
|
-
var DEV_SERVICES = ["api", "indexer", "worker", "webhook", "
|
|
36416
|
+
var DEV_SERVICES = ["api", "indexer", "worker", "webhook", "subgraphs"];
|
|
36822
36417
|
function registerLocalCommand(program2) {
|
|
36823
36418
|
const local = program2.command("local").description("Manage local development environment and Stacks node").hook("preAction", async (_thisCommand, actionCommand) => {
|
|
36824
36419
|
if (actionCommand.name() === "help")
|
|
@@ -36847,7 +36442,7 @@ function registerLocalCommand(program2) {
|
|
|
36847
36442
|
local.command("status").description("Show local environment status").action(async () => {
|
|
36848
36443
|
await showLocalStatus();
|
|
36849
36444
|
});
|
|
36850
|
-
local.command("logs").description("View local service logs (dev + node)").option("-s, --service <name>", "Filter by service (api, indexer, worker, webhook,
|
|
36445
|
+
local.command("logs").description("View local service logs (dev + node)").option("-s, --service <name>", "Filter by service (api, indexer, worker, webhook, subgraphs, node)").option("-f, --follow", "Follow log output").option("-n, --lines <n>", "Number of lines to show", "50").option("-q, --quiet", "Filter out common noise").option("-v, --verbose", "Show full payloads").action(async (options2) => {
|
|
36851
36446
|
await showLocalLogs(options2);
|
|
36852
36447
|
});
|
|
36853
36448
|
const node = local.command("node").description("Manage local Stacks node");
|
|
@@ -36923,7 +36518,7 @@ var serviceColors2 = {
|
|
|
36923
36518
|
api: blue,
|
|
36924
36519
|
indexer: cyan,
|
|
36925
36520
|
worker: yellow,
|
|
36926
|
-
|
|
36521
|
+
subgraphs: magenta,
|
|
36927
36522
|
webhook: green,
|
|
36928
36523
|
node: red
|
|
36929
36524
|
};
|
|
@@ -37137,7 +36732,7 @@ function registerWhoamiCommand(program2) {
|
|
|
37137
36732
|
}
|
|
37138
36733
|
// src/cli.ts
|
|
37139
36734
|
var { version } = package_default;
|
|
37140
|
-
program.name("secondlayer").alias("sl").description("SecondLayer CLI — streams,
|
|
36735
|
+
program.name("secondlayer").alias("sl").description("SecondLayer CLI — streams, subgraphs, and real-time indexing for Stacks").version(version).option("--network <network>", "Override network (local, testnet, mainnet)");
|
|
37141
36736
|
program.hook("preAction", (thisCommand) => {
|
|
37142
36737
|
const net3 = thisCommand.opts().network;
|
|
37143
36738
|
if (net3)
|
|
@@ -37159,7 +36754,7 @@ program.command("init").description("Initialize a new secondlayer.config.ts file
|
|
|
37159
36754
|
await init3();
|
|
37160
36755
|
});
|
|
37161
36756
|
registerStreamsCommand(program);
|
|
37162
|
-
|
|
36757
|
+
registerSubgraphsCommand(program);
|
|
37163
36758
|
registerStatusCommand(program);
|
|
37164
36759
|
registerLocalCommand(program);
|
|
37165
36760
|
registerStackCommand(program);
|
|
@@ -37173,5 +36768,5 @@ registerWhoamiCommand(program);
|
|
|
37173
36768
|
registerWebhookCommand(program);
|
|
37174
36769
|
program.parse();
|
|
37175
36770
|
|
|
37176
|
-
//# debugId=
|
|
36771
|
+
//# debugId=2320C06E5C8D182A64756E2164756E21
|
|
37177
36772
|
//# sourceMappingURL=cli.js.map
|