@secondlayer/cli 1.4.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 +634 -1031
- package/dist/cli.js.map +26 -33
- package/dist/index.d.ts +6 -1
- package/dist/index.js +86 -120
- package/dist/index.js.map +8 -7
- package/dist/plugin-manager.d.ts +6 -1
- package/dist/plugin-manager.js +34 -53
- package/dist/plugin-manager.js.map +4 -4
- package/package.json +6 -6
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);
|
|
@@ -2202,8 +2220,8 @@ function migrateConfig(raw) {
|
|
|
2202
2220
|
if (typeof old.apiKey === "string") {
|
|
2203
2221
|
migrated.apiKey = old.apiKey;
|
|
2204
2222
|
}
|
|
2205
|
-
if (typeof old.sessionToken === "string") {
|
|
2206
|
-
|
|
2223
|
+
if (typeof old.sessionToken === "string" && !migrated.apiKey) {
|
|
2224
|
+
console.warn("Warning: config contains sessionToken but no apiKey. Run `sl auth login` to re-authenticate.");
|
|
2207
2225
|
}
|
|
2208
2226
|
if (typeof old.apiUrl === "string" && old.apiUrl !== "http://localhost:3800") {
|
|
2209
2227
|
migrated.apiUrl = old.apiUrl;
|
|
@@ -2268,9 +2286,6 @@ function applyEnvOverrides(config) {
|
|
|
2268
2286
|
if (process.env.SECONDLAYER_API_KEY) {
|
|
2269
2287
|
result.apiKey = process.env.SECONDLAYER_API_KEY;
|
|
2270
2288
|
}
|
|
2271
|
-
if (process.env.SECONDLAYER_SESSION_TOKEN) {
|
|
2272
|
-
result.sessionToken = process.env.SECONDLAYER_SESSION_TOKEN;
|
|
2273
|
-
}
|
|
2274
2289
|
if (process.env.SL_DATA_DIR) {
|
|
2275
2290
|
result.dataDir = process.env.SL_DATA_DIR;
|
|
2276
2291
|
}
|
|
@@ -2406,7 +2421,6 @@ var init_config = __esm(() => {
|
|
|
2406
2421
|
network: NetworkSchema.default("mainnet"),
|
|
2407
2422
|
apiUrl: z.string().url().optional(),
|
|
2408
2423
|
apiKey: z.string().optional(),
|
|
2409
|
-
sessionToken: z.string().optional(),
|
|
2410
2424
|
dataDir: z.string().default("~/.secondlayer/data"),
|
|
2411
2425
|
defaultWebhookUrl: z.string().url().optional(),
|
|
2412
2426
|
node: NodeSchema.optional(),
|
|
@@ -4533,27 +4547,42 @@ __export(exports_api_client, {
|
|
|
4533
4547
|
rotateSecret: () => rotateSecret,
|
|
4534
4548
|
resumeAllStreams: () => resumeAllStreams,
|
|
4535
4549
|
resolveStreamId: () => resolveStreamId,
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4550
|
+
reindexSubgraphApi: () => reindexSubgraphApi,
|
|
4551
|
+
querySubgraphTableCount: () => querySubgraphTableCount,
|
|
4552
|
+
querySubgraphTable: () => querySubgraphTable,
|
|
4539
4553
|
pauseAllStreams: () => pauseAllStreams,
|
|
4540
|
-
|
|
4554
|
+
listSubgraphsApi: () => listSubgraphsApi,
|
|
4541
4555
|
listStreams: () => listStreams,
|
|
4542
4556
|
handleApiError: () => handleApiError,
|
|
4543
|
-
|
|
4557
|
+
getSubgraphApi: () => getSubgraphApi,
|
|
4544
4558
|
getStream: () => getStream,
|
|
4545
4559
|
getQueueStats: () => getQueueStats,
|
|
4546
4560
|
enableStream: () => enableStream,
|
|
4547
4561
|
disableStream: () => disableStream,
|
|
4548
|
-
|
|
4549
|
-
|
|
4562
|
+
deploySubgraphApi: () => deploySubgraphApi,
|
|
4563
|
+
deleteSubgraphApi: () => deleteSubgraphApi,
|
|
4550
4564
|
deleteStream: () => deleteStream,
|
|
4551
4565
|
createStream: () => createStream,
|
|
4552
4566
|
authHeaders: () => authHeaders,
|
|
4567
|
+
assertOk: () => assertOk,
|
|
4553
4568
|
ApiError: () => ApiError
|
|
4554
4569
|
});
|
|
4555
4570
|
import { SecondLayer } from "@secondlayer/sdk";
|
|
4556
4571
|
import { ApiError } from "@secondlayer/sdk";
|
|
4572
|
+
async function assertOk(res) {
|
|
4573
|
+
if (res.ok)
|
|
4574
|
+
return;
|
|
4575
|
+
const body = await res.text();
|
|
4576
|
+
try {
|
|
4577
|
+
const parsed = JSON.parse(body);
|
|
4578
|
+
if (typeof parsed.error === "string" && parsed.error)
|
|
4579
|
+
throw new Error(parsed.error);
|
|
4580
|
+
} catch (e) {
|
|
4581
|
+
if (e instanceof Error && e.message !== body)
|
|
4582
|
+
throw e;
|
|
4583
|
+
}
|
|
4584
|
+
throw new Error(`HTTP ${res.status}`);
|
|
4585
|
+
}
|
|
4557
4586
|
function handleApiError(err, action) {
|
|
4558
4587
|
if (err instanceof ApiError && err.status === 401) {
|
|
4559
4588
|
console.error("Error: Authentication required. Run: sl auth login");
|
|
@@ -4565,10 +4594,10 @@ function handleApiError(err, action) {
|
|
|
4565
4594
|
async function getClient() {
|
|
4566
4595
|
const config = await loadConfig();
|
|
4567
4596
|
const baseUrl = resolveApiUrl(config);
|
|
4568
|
-
return new SecondLayer({ baseUrl, apiKey: config.
|
|
4597
|
+
return new SecondLayer({ baseUrl, apiKey: config.apiKey });
|
|
4569
4598
|
}
|
|
4570
4599
|
function authHeaders(config) {
|
|
4571
|
-
return SecondLayer.authHeaders(config.
|
|
4600
|
+
return SecondLayer.authHeaders(config.apiKey);
|
|
4572
4601
|
}
|
|
4573
4602
|
async function createStream(data) {
|
|
4574
4603
|
return (await getClient()).streams.create(data);
|
|
@@ -4609,26 +4638,26 @@ async function resumeAllStreams() {
|
|
|
4609
4638
|
async function getQueueStats() {
|
|
4610
4639
|
return (await getClient()).getQueueStats();
|
|
4611
4640
|
}
|
|
4612
|
-
async function
|
|
4613
|
-
return (await getClient()).
|
|
4641
|
+
async function listSubgraphsApi() {
|
|
4642
|
+
return (await getClient()).subgraphs.list();
|
|
4614
4643
|
}
|
|
4615
|
-
async function
|
|
4616
|
-
return (await getClient()).
|
|
4644
|
+
async function getSubgraphApi(name) {
|
|
4645
|
+
return (await getClient()).subgraphs.get(name);
|
|
4617
4646
|
}
|
|
4618
|
-
async function
|
|
4619
|
-
return (await getClient()).
|
|
4647
|
+
async function reindexSubgraphApi(name, options) {
|
|
4648
|
+
return (await getClient()).subgraphs.reindex(name, options);
|
|
4620
4649
|
}
|
|
4621
|
-
async function
|
|
4622
|
-
return (await getClient()).
|
|
4650
|
+
async function deleteSubgraphApi(name) {
|
|
4651
|
+
return (await getClient()).subgraphs.delete(name);
|
|
4623
4652
|
}
|
|
4624
|
-
async function
|
|
4625
|
-
return (await getClient()).
|
|
4653
|
+
async function deploySubgraphApi(data) {
|
|
4654
|
+
return (await getClient()).subgraphs.deploy(data);
|
|
4626
4655
|
}
|
|
4627
|
-
async function
|
|
4628
|
-
return (await getClient()).
|
|
4656
|
+
async function querySubgraphTable(name, table, params = {}) {
|
|
4657
|
+
return (await getClient()).subgraphs.queryTable(name, table, params);
|
|
4629
4658
|
}
|
|
4630
|
-
async function
|
|
4631
|
-
return (await getClient()).
|
|
4659
|
+
async function querySubgraphTableCount(name, table, params = {}) {
|
|
4660
|
+
return (await getClient()).subgraphs.queryTableCount(name, table, params);
|
|
4632
4661
|
}
|
|
4633
4662
|
var init_api_client = __esm(() => {
|
|
4634
4663
|
init_config();
|
|
@@ -6363,7 +6392,7 @@ var init_responselike = __esm(() => {
|
|
|
6363
6392
|
|
|
6364
6393
|
// ../../node_modules/json-buffer/index.js
|
|
6365
6394
|
var require_json_buffer = __commonJS((exports) => {
|
|
6366
|
-
exports.stringify = function
|
|
6395
|
+
exports.stringify = function stringify2(o) {
|
|
6367
6396
|
if (typeof o == "undefined")
|
|
6368
6397
|
return o;
|
|
6369
6398
|
if (o && Buffer.isBuffer(o))
|
|
@@ -6385,9 +6414,9 @@ var require_json_buffer = __commonJS((exports) => {
|
|
|
6385
6414
|
if (o[k] == undefined)
|
|
6386
6415
|
s += "null";
|
|
6387
6416
|
else
|
|
6388
|
-
s +=
|
|
6417
|
+
s += stringify2(o[k]);
|
|
6389
6418
|
} else if (o[k] !== undefined) {
|
|
6390
|
-
s +=
|
|
6419
|
+
s += stringify2(k) + ":" + stringify2(o[k]);
|
|
6391
6420
|
}
|
|
6392
6421
|
}
|
|
6393
6422
|
}
|
|
@@ -7331,7 +7360,7 @@ var init_FormDataEncoder = __esm(() => {
|
|
|
7331
7360
|
}
|
|
7332
7361
|
}
|
|
7333
7362
|
}
|
|
7334
|
-
[(_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) {
|
|
7335
7364
|
let header = "";
|
|
7336
7365
|
header += `${__classPrivateFieldGet(this, _FormDataEncoder_DASHES, "f")}${this.boundary}${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")}`;
|
|
7337
7366
|
header += `Content-Disposition: form-data; name="${escapeName(name)}"`;
|
|
@@ -7344,7 +7373,7 @@ var init_FormDataEncoder = __esm(() => {
|
|
|
7344
7373
|
header += `${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f")}Content-Length: ${isFile(value) ? value.size : value.byteLength}`;
|
|
7345
7374
|
}
|
|
7346
7375
|
return __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(`${header}${__classPrivateFieldGet(this, _FormDataEncoder_CRLF, "f").repeat(2)}`);
|
|
7347
|
-
}, _FormDataEncoder_getContentLength = function
|
|
7376
|
+
}, _FormDataEncoder_getContentLength = function _FormDataEncoder_getContentLength2() {
|
|
7348
7377
|
let length = 0;
|
|
7349
7378
|
for (const [name, raw] of __classPrivateFieldGet(this, _FormDataEncoder_form, "f")) {
|
|
7350
7379
|
const value = isFile(raw) ? raw : __classPrivateFieldGet(this, _FormDataEncoder_encoder, "f").encode(normalizeValue(raw));
|
|
@@ -13247,21 +13276,21 @@ var init_webhook_server = __esm(() => {
|
|
|
13247
13276
|
init_output();
|
|
13248
13277
|
});
|
|
13249
13278
|
|
|
13250
|
-
// src/services/
|
|
13279
|
+
// src/services/subgraph-processor.ts
|
|
13251
13280
|
import { resolve as resolve5, dirname as dirname4 } from "node:path";
|
|
13252
|
-
async function
|
|
13281
|
+
async function startSubgraphProcessor(options2) {
|
|
13253
13282
|
const rootDir = dirname4(dirname4(dirname4(dirname4(import.meta.dir))));
|
|
13254
|
-
const servicePath = resolve5(rootDir, "packages/
|
|
13283
|
+
const servicePath = resolve5(rootDir, "packages/subgraphs/src/service.ts");
|
|
13255
13284
|
await serviceManager.start(SERVICE_NAME4, ["bun", "run", "--watch", servicePath], {
|
|
13256
13285
|
env: {
|
|
13257
|
-
|
|
13286
|
+
SUBGRAPH_CONCURRENCY: String(options2.concurrency ?? 5)
|
|
13258
13287
|
},
|
|
13259
13288
|
onStdout: options2.onLog,
|
|
13260
13289
|
onStderr: options2.onLog
|
|
13261
13290
|
});
|
|
13262
13291
|
}
|
|
13263
|
-
var SERVICE_NAME4 = "
|
|
13264
|
-
var
|
|
13292
|
+
var SERVICE_NAME4 = "subgraph-processor";
|
|
13293
|
+
var init_subgraph_processor = __esm(() => {
|
|
13265
13294
|
init_manager();
|
|
13266
13295
|
});
|
|
13267
13296
|
|
|
@@ -13272,7 +13301,7 @@ var init_services = __esm(() => {
|
|
|
13272
13301
|
init_worker();
|
|
13273
13302
|
init_api2();
|
|
13274
13303
|
init_webhook_server();
|
|
13275
|
-
|
|
13304
|
+
init_subgraph_processor();
|
|
13276
13305
|
});
|
|
13277
13306
|
|
|
13278
13307
|
// src/commands/dev-impl.ts
|
|
@@ -13411,19 +13440,19 @@ async function runBackground(options2) {
|
|
|
13411
13440
|
console.log(green(" ✓ Worker"), dim("processing jobs"));
|
|
13412
13441
|
}
|
|
13413
13442
|
{
|
|
13414
|
-
const
|
|
13415
|
-
const
|
|
13443
|
+
const subgraphsLogFile = getLogFile("subgraphs");
|
|
13444
|
+
const subgraphsProc = Bun.spawn(["bun", "run", resolve6(packagesDir, "packages/subgraphs/src/service.ts")], {
|
|
13416
13445
|
env: { ...process.env, ...env },
|
|
13417
|
-
stdout: Bun.file(
|
|
13418
|
-
stderr: Bun.file(
|
|
13446
|
+
stdout: Bun.file(subgraphsLogFile),
|
|
13447
|
+
stderr: Bun.file(subgraphsLogFile)
|
|
13419
13448
|
});
|
|
13420
|
-
state.services.
|
|
13421
|
-
pid:
|
|
13449
|
+
state.services.subgraphs = {
|
|
13450
|
+
pid: subgraphsProc.pid,
|
|
13422
13451
|
port: null,
|
|
13423
13452
|
startedAt: new Date().toISOString(),
|
|
13424
|
-
logFile:
|
|
13453
|
+
logFile: subgraphsLogFile
|
|
13425
13454
|
};
|
|
13426
|
-
console.log(green(" ✓
|
|
13455
|
+
console.log(green(" ✓ Subgraph processor"), dim("processing subgraphs"));
|
|
13427
13456
|
}
|
|
13428
13457
|
if (options2.webhook) {
|
|
13429
13458
|
const webhookLogFile = getLogFile("webhook");
|
|
@@ -13556,8 +13585,8 @@ async function runForeground(options2) {
|
|
|
13556
13585
|
await startWorker({ onLog: (line) => logService("worker", line) });
|
|
13557
13586
|
console.log(green(" ✓ Worker"), dim("processing jobs"));
|
|
13558
13587
|
}
|
|
13559
|
-
await
|
|
13560
|
-
console.log(green(" ✓
|
|
13588
|
+
await startSubgraphProcessor({ onLog: (line) => logService("subgraphs", line) });
|
|
13589
|
+
console.log(green(" ✓ Subgraph processor"), dim("processing subgraphs"));
|
|
13561
13590
|
console.log("");
|
|
13562
13591
|
printUrls(indexerPort, apiPort, webhookPort, options2.webhook);
|
|
13563
13592
|
console.log("");
|
|
@@ -13825,20 +13854,20 @@ async function restartDev() {
|
|
|
13825
13854
|
};
|
|
13826
13855
|
console.log(green(" ✓ Webhook server"), dim(`http://localhost:${webhookPort}`));
|
|
13827
13856
|
}
|
|
13828
|
-
if (state.services.
|
|
13829
|
-
const
|
|
13830
|
-
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")], {
|
|
13831
13860
|
env: { ...process.env, ...env },
|
|
13832
|
-
stdout: Bun.file(
|
|
13833
|
-
stderr: Bun.file(
|
|
13861
|
+
stdout: Bun.file(subgraphsLogFile),
|
|
13862
|
+
stderr: Bun.file(subgraphsLogFile)
|
|
13834
13863
|
});
|
|
13835
|
-
newState.services.
|
|
13836
|
-
pid:
|
|
13864
|
+
newState.services.subgraphs = {
|
|
13865
|
+
pid: subgraphsProc.pid,
|
|
13837
13866
|
port: null,
|
|
13838
13867
|
startedAt: new Date().toISOString(),
|
|
13839
|
-
logFile:
|
|
13868
|
+
logFile: subgraphsLogFile
|
|
13840
13869
|
};
|
|
13841
|
-
console.log(green(" ✓
|
|
13870
|
+
console.log(green(" ✓ Subgraph processor"), dim("processing subgraphs"));
|
|
13842
13871
|
}
|
|
13843
13872
|
await Bun.sleep(500);
|
|
13844
13873
|
for (const [name, service] of Object.entries(newState.services)) {
|
|
@@ -13988,7 +14017,7 @@ var init_dev_impl = __esm(() => {
|
|
|
13988
14017
|
api: blue,
|
|
13989
14018
|
indexer: cyan,
|
|
13990
14019
|
worker: yellow,
|
|
13991
|
-
|
|
14020
|
+
subgraphs: magenta,
|
|
13992
14021
|
webhook: green
|
|
13993
14022
|
};
|
|
13994
14023
|
});
|
|
@@ -20157,6 +20186,8 @@ function isDirectFileContract(c) {
|
|
|
20157
20186
|
import { promises as fs3 } from "fs";
|
|
20158
20187
|
import path from "path";
|
|
20159
20188
|
import { isValidAddress as _validateStacksAddress } from "@secondlayer/stacks";
|
|
20189
|
+
import { getErrorMessage } from "@secondlayer/shared";
|
|
20190
|
+
import { toCamelCase as toCamelCase2 } from "@secondlayer/stacks/clarity";
|
|
20160
20191
|
|
|
20161
20192
|
class PluginManager {
|
|
20162
20193
|
plugins = [];
|
|
@@ -20199,12 +20230,11 @@ class PluginManager {
|
|
|
20199
20230
|
success: true
|
|
20200
20231
|
});
|
|
20201
20232
|
} catch (error2) {
|
|
20202
|
-
const err = error2;
|
|
20203
20233
|
this.recordHookResult(plugin.name, "transformConfig", {
|
|
20204
20234
|
success: false,
|
|
20205
|
-
error:
|
|
20235
|
+
error: error2 instanceof Error ? error2 : new Error(getErrorMessage(error2))
|
|
20206
20236
|
});
|
|
20207
|
-
throw new Error(`Plugin "${plugin.name}" failed during config transformation: ${
|
|
20237
|
+
throw new Error(`Plugin "${plugin.name}" failed during config transformation: ${getErrorMessage(error2)}`);
|
|
20208
20238
|
}
|
|
20209
20239
|
}
|
|
20210
20240
|
}
|
|
@@ -20218,31 +20248,11 @@ class PluginManager {
|
|
|
20218
20248
|
const processedContracts = [];
|
|
20219
20249
|
for (let contract of contracts) {
|
|
20220
20250
|
if (isClarinetContract(contract) && contract.abi) {
|
|
20221
|
-
|
|
20222
|
-
const parsed = parseContractId(address);
|
|
20223
|
-
const processed = {
|
|
20224
|
-
name: contract.name || parsed.contractName,
|
|
20225
|
-
address: parsed.address,
|
|
20226
|
-
contractName: parsed.contractName,
|
|
20227
|
-
abi: contract.abi,
|
|
20228
|
-
source: "local",
|
|
20229
|
-
metadata: { source: "clarinet" }
|
|
20230
|
-
};
|
|
20231
|
-
processedContracts.push(processed);
|
|
20251
|
+
processedContracts.push(this.contractToProcessed(contract, "clarinet"));
|
|
20232
20252
|
continue;
|
|
20233
20253
|
}
|
|
20234
20254
|
if (isDirectFileContract(contract) && contract.abi) {
|
|
20235
|
-
|
|
20236
|
-
const parsed = parseContractId(address);
|
|
20237
|
-
const processed = {
|
|
20238
|
-
name: contract.name || parsed.contractName,
|
|
20239
|
-
address: parsed.address,
|
|
20240
|
-
contractName: parsed.contractName,
|
|
20241
|
-
abi: contract.abi,
|
|
20242
|
-
source: "local",
|
|
20243
|
-
metadata: { source: "direct" }
|
|
20244
|
-
};
|
|
20245
|
-
processedContracts.push(processed);
|
|
20255
|
+
processedContracts.push(this.contractToProcessed(contract, "direct"));
|
|
20246
20256
|
continue;
|
|
20247
20257
|
}
|
|
20248
20258
|
for (const plugin of this.plugins) {
|
|
@@ -20254,27 +20264,16 @@ class PluginManager {
|
|
|
20254
20264
|
success: true
|
|
20255
20265
|
});
|
|
20256
20266
|
} catch (error2) {
|
|
20257
|
-
const err = error2;
|
|
20258
20267
|
this.recordHookResult(plugin.name, "transformContract", {
|
|
20259
20268
|
success: false,
|
|
20260
|
-
error:
|
|
20269
|
+
error: error2 instanceof Error ? error2 : new Error(getErrorMessage(error2))
|
|
20261
20270
|
});
|
|
20262
|
-
this.logger.warn(`Plugin "${plugin.name}" failed to transform contract: ${
|
|
20271
|
+
this.logger.warn(`Plugin "${plugin.name}" failed to transform contract: ${getErrorMessage(error2)}`);
|
|
20263
20272
|
}
|
|
20264
20273
|
}
|
|
20265
20274
|
}
|
|
20266
20275
|
if (contract.abi) {
|
|
20267
|
-
|
|
20268
|
-
const parsed = parseContractId(addressStr);
|
|
20269
|
-
const processed = {
|
|
20270
|
-
name: contract.name || parsed.contractName || "unknown",
|
|
20271
|
-
address: parsed.address || "unknown",
|
|
20272
|
-
contractName: parsed.contractName || contract.name || "unknown",
|
|
20273
|
-
abi: contract.abi,
|
|
20274
|
-
source: "api",
|
|
20275
|
-
metadata: contract.metadata
|
|
20276
|
-
};
|
|
20277
|
-
processedContracts.push(processed);
|
|
20276
|
+
processedContracts.push(this.contractToProcessed(contract, "api"));
|
|
20278
20277
|
}
|
|
20279
20278
|
}
|
|
20280
20279
|
return processedContracts;
|
|
@@ -20290,12 +20289,11 @@ class PluginManager {
|
|
|
20290
20289
|
success: true
|
|
20291
20290
|
});
|
|
20292
20291
|
} catch (error2) {
|
|
20293
|
-
const err = error2;
|
|
20294
20292
|
this.recordHookResult(plugin.name, hookName, {
|
|
20295
20293
|
success: false,
|
|
20296
|
-
error:
|
|
20294
|
+
error: error2 instanceof Error ? error2 : new Error(getErrorMessage(error2))
|
|
20297
20295
|
});
|
|
20298
|
-
this.logger.error(`Plugin "${plugin.name}" failed during ${hookName}: ${
|
|
20296
|
+
this.logger.error(`Plugin "${plugin.name}" failed during ${hookName}: ${getErrorMessage(error2)}`);
|
|
20299
20297
|
}
|
|
20300
20298
|
}
|
|
20301
20299
|
}
|
|
@@ -20335,12 +20333,11 @@ class PluginManager {
|
|
|
20335
20333
|
success: true
|
|
20336
20334
|
});
|
|
20337
20335
|
} catch (error2) {
|
|
20338
|
-
const err = error2;
|
|
20339
20336
|
this.recordHookResult(plugin.name, "transformOutput", {
|
|
20340
20337
|
success: false,
|
|
20341
|
-
error:
|
|
20338
|
+
error: error2 instanceof Error ? error2 : new Error(getErrorMessage(error2))
|
|
20342
20339
|
});
|
|
20343
|
-
this.logger.warn(`Plugin "${plugin.name}" failed to transform output: ${
|
|
20340
|
+
this.logger.warn(`Plugin "${plugin.name}" failed to transform output: ${getErrorMessage(error2)}`);
|
|
20344
20341
|
}
|
|
20345
20342
|
}
|
|
20346
20343
|
}
|
|
@@ -20358,15 +20355,26 @@ class PluginManager {
|
|
|
20358
20355
|
await this.utils.ensureDir(path.dirname(resolvedPath));
|
|
20359
20356
|
await this.utils.writeFile(resolvedPath, output.content);
|
|
20360
20357
|
} catch (error2) {
|
|
20361
|
-
|
|
20362
|
-
|
|
20363
|
-
throw err;
|
|
20358
|
+
this.logger.error(`Failed to write ${output.path}: ${getErrorMessage(error2)}`);
|
|
20359
|
+
throw error2;
|
|
20364
20360
|
}
|
|
20365
20361
|
}
|
|
20366
20362
|
}
|
|
20367
20363
|
getExecutionResults() {
|
|
20368
20364
|
return new Map(this.executionContext.results);
|
|
20369
20365
|
}
|
|
20366
|
+
contractToProcessed(contract, source) {
|
|
20367
|
+
const address = typeof contract.address === "string" ? contract.address : "";
|
|
20368
|
+
const parsed = parseContractId(address);
|
|
20369
|
+
return {
|
|
20370
|
+
name: contract.name || parsed.contractName || "unknown",
|
|
20371
|
+
address: parsed.address || "unknown",
|
|
20372
|
+
contractName: parsed.contractName || contract.name || "unknown",
|
|
20373
|
+
abi: contract.abi,
|
|
20374
|
+
source: source === "api" ? "api" : "local",
|
|
20375
|
+
metadata: contract.metadata ?? { source }
|
|
20376
|
+
};
|
|
20377
|
+
}
|
|
20370
20378
|
augmentOutput(outputs, outputKey, contractName, content) {
|
|
20371
20379
|
const existing = outputs.get(outputKey);
|
|
20372
20380
|
if (!existing) {
|
|
@@ -20403,9 +20411,7 @@ ${JSON.stringify(content, null, 2)}`;
|
|
|
20403
20411
|
}
|
|
20404
20412
|
createUtils() {
|
|
20405
20413
|
return {
|
|
20406
|
-
toCamelCase:
|
|
20407
|
-
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
20408
|
-
},
|
|
20414
|
+
toCamelCase: toCamelCase2,
|
|
20409
20415
|
toKebabCase: (str) => {
|
|
20410
20416
|
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
20411
20417
|
},
|
|
@@ -20554,7 +20560,7 @@ var init_config2 = __esm(() => {
|
|
|
20554
20560
|
|
|
20555
20561
|
// src/utils/type-mapping.ts
|
|
20556
20562
|
import {
|
|
20557
|
-
toCamelCase,
|
|
20563
|
+
toCamelCase as toCamelCase3,
|
|
20558
20564
|
isAbiList,
|
|
20559
20565
|
isAbiTuple,
|
|
20560
20566
|
isAbiOptional as isAbiOptional2,
|
|
@@ -20613,7 +20619,7 @@ function clarityTypeToTS(type) {
|
|
|
20613
20619
|
return `${innerType}[]`;
|
|
20614
20620
|
}
|
|
20615
20621
|
if (isAbiTuple(type)) {
|
|
20616
|
-
const fields = type.tuple.map((field) => `${
|
|
20622
|
+
const fields = type.tuple.map((field) => `${toCamelCase3(field.name)}: ${clarityTypeToTS(field.type)}`).join("; ");
|
|
20617
20623
|
return `{ ${fields} }`;
|
|
20618
20624
|
}
|
|
20619
20625
|
if (isAbiResponse(type)) {
|
|
@@ -20630,7 +20636,7 @@ var init_type_mapping = () => {};
|
|
|
20630
20636
|
|
|
20631
20637
|
// src/utils/clarity-conversion.ts
|
|
20632
20638
|
import {
|
|
20633
|
-
toCamelCase as
|
|
20639
|
+
toCamelCase as toCamelCase4,
|
|
20634
20640
|
isAbiStringAscii as isAbiStringAscii3,
|
|
20635
20641
|
isAbiStringUtf8 as isAbiStringUtf83,
|
|
20636
20642
|
isAbiBuffer as isAbiBuffer3,
|
|
@@ -20728,7 +20734,7 @@ function generateClarityConversion(argName, argType) {
|
|
|
20728
20734
|
const requiredFields = type.tuple.map((f) => f.name);
|
|
20729
20735
|
const fieldNames = JSON.stringify(requiredFields);
|
|
20730
20736
|
const fields = type.tuple.map((field) => {
|
|
20731
|
-
const camelFieldName =
|
|
20737
|
+
const camelFieldName = toCamelCase4(field.name);
|
|
20732
20738
|
const fieldConversion = generateClarityConversion(`tupleValue.${camelFieldName}`, { type: field.type });
|
|
20733
20739
|
return `"${field.name}": ${fieldConversion}`;
|
|
20734
20740
|
}).join(", ");
|
|
@@ -20769,11 +20775,11 @@ function generateClarityConversion(argName, argType) {
|
|
|
20769
20775
|
var init_clarity_conversion = () => {};
|
|
20770
20776
|
|
|
20771
20777
|
// src/utils/generator-helpers.ts
|
|
20772
|
-
import { toCamelCase as
|
|
20778
|
+
import { toCamelCase as toCamelCase5, isAbiTuple as isAbiTuple3 } from "@secondlayer/stacks/clarity";
|
|
20773
20779
|
function generateMapKeyConversion(keyType) {
|
|
20774
20780
|
if (isAbiTuple3(keyType)) {
|
|
20775
20781
|
const fields = keyType.tuple.map((field) => {
|
|
20776
|
-
const camelFieldName =
|
|
20782
|
+
const camelFieldName = toCamelCase5(field.name);
|
|
20777
20783
|
const fieldConversion = generateClarityConversion(`key.${camelFieldName}`, { type: field.type });
|
|
20778
20784
|
return `"${field.name}": ${fieldConversion}`;
|
|
20779
20785
|
}).join(", ");
|
|
@@ -20788,7 +20794,7 @@ var init_generator_helpers = __esm(() => {
|
|
|
20788
20794
|
|
|
20789
20795
|
// src/generators/contract.ts
|
|
20790
20796
|
import {
|
|
20791
|
-
toCamelCase as
|
|
20797
|
+
toCamelCase as toCamelCase6
|
|
20792
20798
|
} from "@secondlayer/stacks/clarity";
|
|
20793
20799
|
function generateNetworkUtils() {
|
|
20794
20800
|
return `/**
|
|
@@ -20880,7 +20886,7 @@ function generateAbiConstant(name, abi) {
|
|
|
20880
20886
|
return `export const ${name}Abi = ${abiJson} as const`;
|
|
20881
20887
|
}
|
|
20882
20888
|
function generateMethod(func, address, contractName) {
|
|
20883
|
-
const methodName =
|
|
20889
|
+
const methodName = toCamelCase6(func.name);
|
|
20884
20890
|
if (func.args.length === 0) {
|
|
20885
20891
|
return `${methodName}() {
|
|
20886
20892
|
return {
|
|
@@ -20893,7 +20899,7 @@ function generateMethod(func, address, contractName) {
|
|
|
20893
20899
|
}
|
|
20894
20900
|
if (func.args.length === 1) {
|
|
20895
20901
|
const originalArgName = func.args[0].name;
|
|
20896
|
-
const argName =
|
|
20902
|
+
const argName = toCamelCase6(originalArgName);
|
|
20897
20903
|
const argType = getTypeForArg(func.args[0]);
|
|
20898
20904
|
const clarityConversion = generateClarityConversion(argName, func.args[0]);
|
|
20899
20905
|
return `${methodName}(...args: [{ ${argName}: ${argType} }] | [${argType}]) {
|
|
@@ -20909,17 +20915,17 @@ function generateMethod(func, address, contractName) {
|
|
|
20909
20915
|
}
|
|
20910
20916
|
}`;
|
|
20911
20917
|
}
|
|
20912
|
-
const argsList = func.args.map((arg) =>
|
|
20918
|
+
const argsList = func.args.map((arg) => toCamelCase6(arg.name)).join(", ");
|
|
20913
20919
|
const argsTypes = func.args.map((arg) => {
|
|
20914
|
-
const camelName =
|
|
20920
|
+
const camelName = toCamelCase6(arg.name);
|
|
20915
20921
|
return `${camelName}: ${getTypeForArg(arg)}`;
|
|
20916
20922
|
}).join("; ");
|
|
20917
20923
|
const argsArray = func.args.map((arg) => {
|
|
20918
|
-
const argName =
|
|
20924
|
+
const argName = toCamelCase6(arg.name);
|
|
20919
20925
|
return generateClarityConversion(argName, arg);
|
|
20920
20926
|
}).join(", ");
|
|
20921
20927
|
const objectAccess = func.args.map((arg) => {
|
|
20922
|
-
const camelName =
|
|
20928
|
+
const camelName = toCamelCase6(arg.name);
|
|
20923
20929
|
return `args[0].${camelName}`;
|
|
20924
20930
|
}).join(", ");
|
|
20925
20931
|
const positionTypes = func.args.map((arg) => getTypeForArg(arg)).join(", ");
|
|
@@ -20941,7 +20947,7 @@ function generateMapsObject(maps, address, contractName) {
|
|
|
20941
20947
|
return "";
|
|
20942
20948
|
}
|
|
20943
20949
|
const mapMethods = maps.map((map) => {
|
|
20944
|
-
const methodName =
|
|
20950
|
+
const methodName = toCamelCase6(map.name);
|
|
20945
20951
|
const keyType = getTypeForArg({ type: map.key });
|
|
20946
20952
|
const valueType = getTypeForArg({ type: map.value });
|
|
20947
20953
|
const keyConversion = generateMapKeyConversion(map.key);
|
|
@@ -21002,7 +21008,7 @@ function generateVarsObject(variables, address, contractName) {
|
|
|
21002
21008
|
return "";
|
|
21003
21009
|
}
|
|
21004
21010
|
const varMethods = dataVars.map((variable) => {
|
|
21005
|
-
const methodName =
|
|
21011
|
+
const methodName = toCamelCase6(variable.name);
|
|
21006
21012
|
const valueType = getTypeForArg({ type: variable.type });
|
|
21007
21013
|
return `${methodName}: {
|
|
21008
21014
|
async get(options?: { network?: 'mainnet' | 'testnet' | 'devnet' }): Promise<${valueType}> {
|
|
@@ -21047,7 +21053,7 @@ function generateConstantsObject(variables, address, contractName) {
|
|
|
21047
21053
|
return "";
|
|
21048
21054
|
}
|
|
21049
21055
|
const constMethods = constants.map((constant) => {
|
|
21050
|
-
const methodName =
|
|
21056
|
+
const methodName = toCamelCase6(constant.name);
|
|
21051
21057
|
const valueType = getTypeForArg({ type: constant.type });
|
|
21052
21058
|
return `${methodName}: {
|
|
21053
21059
|
async get(options?: { network?: 'mainnet' | 'testnet' | 'devnet' }): Promise<${valueType}> {
|
|
@@ -21143,23 +21149,23 @@ var require_ansis = __commonJS((exports, module) => {
|
|
|
21143
21149
|
}, s2 = t2, c2 = l2;
|
|
21144
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;
|
|
21145
21151
|
};
|
|
21146
|
-
var w = new function
|
|
21147
|
-
let s2 = { Ansis:
|
|
21148
|
-
for (let t3 in
|
|
21149
|
-
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];
|
|
21150
21156
|
l2 === "s" ? (c2(t3, T(...p(r2))), c2(_(t3), v(...p(r2)))) : c2(t3, r2, l2 === "f");
|
|
21151
21157
|
}
|
|
21152
21158
|
return r = o({}, O), n(s2, r), s2;
|
|
21153
|
-
} }, c2 = (
|
|
21154
|
-
O[
|
|
21155
|
-
let n2 = r2 ? (...
|
|
21156
|
-
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;
|
|
21157
21163
|
} };
|
|
21158
|
-
}, a2 = t2 > 0, w2 = (
|
|
21159
|
-
t2 === 2 ? (T = x(C), v = x(E)) : t2 === 1 && (T = $(0, h), v = $(10, b2), C = (
|
|
21160
|
-
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) }, _ = (
|
|
21161
|
-
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map((
|
|
21162
|
-
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);
|
|
21163
21169
|
}), s2.extend(I);
|
|
21164
21170
|
};
|
|
21165
21171
|
module.exports = w, w.default = w;
|
|
@@ -21171,302 +21177,11 @@ var init_ansis = __esm(() => {
|
|
|
21171
21177
|
import__2 = __toESM(require_ansis(), 1);
|
|
21172
21178
|
});
|
|
21173
21179
|
|
|
21174
|
-
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/commands.mjs
|
|
21175
|
-
function dashDashArg(agent, agentCommand) {
|
|
21176
|
-
return (args) => {
|
|
21177
|
-
if (args.length > 1) {
|
|
21178
|
-
return [agent, agentCommand, args[0], "--", ...args.slice(1)];
|
|
21179
|
-
} else {
|
|
21180
|
-
return [agent, agentCommand, args[0]];
|
|
21181
|
-
}
|
|
21182
|
-
};
|
|
21183
|
-
}
|
|
21184
|
-
function denoExecute() {
|
|
21185
|
-
return (args) => {
|
|
21186
|
-
return ["deno", "run", `npm:${args[0]}`, ...args.slice(1)];
|
|
21187
|
-
};
|
|
21188
|
-
}
|
|
21189
|
-
var npm, yarn, yarnBerry, pnpm, bun, deno, COMMANDS;
|
|
21190
|
-
var init_commands = __esm(() => {
|
|
21191
|
-
npm = {
|
|
21192
|
-
agent: ["npm", 0],
|
|
21193
|
-
run: dashDashArg("npm", "run"),
|
|
21194
|
-
install: ["npm", "i", 0],
|
|
21195
|
-
frozen: ["npm", "ci", 0],
|
|
21196
|
-
global: ["npm", "i", "-g", 0],
|
|
21197
|
-
add: ["npm", "i", 0],
|
|
21198
|
-
upgrade: ["npm", "update", 0],
|
|
21199
|
-
"upgrade-interactive": null,
|
|
21200
|
-
dedupe: ["npm", "dedupe", 0],
|
|
21201
|
-
execute: ["npx", 0],
|
|
21202
|
-
"execute-local": ["npx", 0],
|
|
21203
|
-
uninstall: ["npm", "uninstall", 0],
|
|
21204
|
-
global_uninstall: ["npm", "uninstall", "-g", 0]
|
|
21205
|
-
};
|
|
21206
|
-
yarn = {
|
|
21207
|
-
agent: ["yarn", 0],
|
|
21208
|
-
run: ["yarn", "run", 0],
|
|
21209
|
-
install: ["yarn", "install", 0],
|
|
21210
|
-
frozen: ["yarn", "install", "--frozen-lockfile", 0],
|
|
21211
|
-
global: ["yarn", "global", "add", 0],
|
|
21212
|
-
add: ["yarn", "add", 0],
|
|
21213
|
-
upgrade: ["yarn", "upgrade", 0],
|
|
21214
|
-
"upgrade-interactive": ["yarn", "upgrade-interactive", 0],
|
|
21215
|
-
dedupe: null,
|
|
21216
|
-
execute: ["npx", 0],
|
|
21217
|
-
"execute-local": dashDashArg("yarn", "exec"),
|
|
21218
|
-
uninstall: ["yarn", "remove", 0],
|
|
21219
|
-
global_uninstall: ["yarn", "global", "remove", 0]
|
|
21220
|
-
};
|
|
21221
|
-
yarnBerry = {
|
|
21222
|
-
...yarn,
|
|
21223
|
-
frozen: ["yarn", "install", "--immutable", 0],
|
|
21224
|
-
upgrade: ["yarn", "up", 0],
|
|
21225
|
-
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
21226
|
-
dedupe: ["yarn", "dedupe", 0],
|
|
21227
|
-
execute: ["yarn", "dlx", 0],
|
|
21228
|
-
"execute-local": ["yarn", "exec", 0],
|
|
21229
|
-
global: ["npm", "i", "-g", 0],
|
|
21230
|
-
global_uninstall: ["npm", "uninstall", "-g", 0]
|
|
21231
|
-
};
|
|
21232
|
-
pnpm = {
|
|
21233
|
-
agent: ["pnpm", 0],
|
|
21234
|
-
run: ["pnpm", "run", 0],
|
|
21235
|
-
install: ["pnpm", "i", 0],
|
|
21236
|
-
frozen: ["pnpm", "i", "--frozen-lockfile", 0],
|
|
21237
|
-
global: ["pnpm", "add", "-g", 0],
|
|
21238
|
-
add: ["pnpm", "add", 0],
|
|
21239
|
-
upgrade: ["pnpm", "update", 0],
|
|
21240
|
-
"upgrade-interactive": ["pnpm", "update", "-i", 0],
|
|
21241
|
-
dedupe: ["pnpm", "dedupe", 0],
|
|
21242
|
-
execute: ["pnpm", "dlx", 0],
|
|
21243
|
-
"execute-local": ["pnpm", "exec", 0],
|
|
21244
|
-
uninstall: ["pnpm", "remove", 0],
|
|
21245
|
-
global_uninstall: ["pnpm", "remove", "--global", 0]
|
|
21246
|
-
};
|
|
21247
|
-
bun = {
|
|
21248
|
-
agent: ["bun", 0],
|
|
21249
|
-
run: ["bun", "run", 0],
|
|
21250
|
-
install: ["bun", "install", 0],
|
|
21251
|
-
frozen: ["bun", "install", "--frozen-lockfile", 0],
|
|
21252
|
-
global: ["bun", "add", "-g", 0],
|
|
21253
|
-
add: ["bun", "add", 0],
|
|
21254
|
-
upgrade: ["bun", "update", 0],
|
|
21255
|
-
"upgrade-interactive": ["bun", "update", "-i", 0],
|
|
21256
|
-
dedupe: null,
|
|
21257
|
-
execute: ["bun", "x", 0],
|
|
21258
|
-
"execute-local": ["bun", "x", 0],
|
|
21259
|
-
uninstall: ["bun", "remove", 0],
|
|
21260
|
-
global_uninstall: ["bun", "remove", "-g", 0]
|
|
21261
|
-
};
|
|
21262
|
-
deno = {
|
|
21263
|
-
agent: ["deno", 0],
|
|
21264
|
-
run: ["deno", "task", 0],
|
|
21265
|
-
install: ["deno", "install", 0],
|
|
21266
|
-
frozen: ["deno", "install", "--frozen", 0],
|
|
21267
|
-
global: ["deno", "install", "-g", 0],
|
|
21268
|
-
add: ["deno", "add", 0],
|
|
21269
|
-
upgrade: ["deno", "outdated", "--update", 0],
|
|
21270
|
-
"upgrade-interactive": ["deno", "outdated", "--update", 0],
|
|
21271
|
-
dedupe: null,
|
|
21272
|
-
execute: denoExecute(),
|
|
21273
|
-
"execute-local": ["deno", "task", "--eval", 0],
|
|
21274
|
-
uninstall: ["deno", "remove", 0],
|
|
21275
|
-
global_uninstall: ["deno", "uninstall", "-g", 0]
|
|
21276
|
-
};
|
|
21277
|
-
COMMANDS = {
|
|
21278
|
-
npm,
|
|
21279
|
-
yarn,
|
|
21280
|
-
"yarn@berry": yarnBerry,
|
|
21281
|
-
pnpm,
|
|
21282
|
-
"pnpm@6": {
|
|
21283
|
-
...pnpm,
|
|
21284
|
-
run: dashDashArg("pnpm", "run")
|
|
21285
|
-
},
|
|
21286
|
-
bun,
|
|
21287
|
-
deno
|
|
21288
|
-
};
|
|
21289
|
-
});
|
|
21290
|
-
|
|
21291
|
-
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/constants.mjs
|
|
21292
|
-
var AGENTS, LOCKS, INSTALL_METADATA, INSTALL_PAGE;
|
|
21293
|
-
var init_constants = __esm(() => {
|
|
21294
|
-
AGENTS = [
|
|
21295
|
-
"npm",
|
|
21296
|
-
"yarn",
|
|
21297
|
-
"yarn@berry",
|
|
21298
|
-
"pnpm",
|
|
21299
|
-
"pnpm@6",
|
|
21300
|
-
"bun",
|
|
21301
|
-
"deno"
|
|
21302
|
-
];
|
|
21303
|
-
LOCKS = {
|
|
21304
|
-
"bun.lock": "bun",
|
|
21305
|
-
"bun.lockb": "bun",
|
|
21306
|
-
"deno.lock": "deno",
|
|
21307
|
-
"pnpm-lock.yaml": "pnpm",
|
|
21308
|
-
"pnpm-workspace.yaml": "pnpm",
|
|
21309
|
-
"yarn.lock": "yarn",
|
|
21310
|
-
"package-lock.json": "npm",
|
|
21311
|
-
"npm-shrinkwrap.json": "npm"
|
|
21312
|
-
};
|
|
21313
|
-
INSTALL_METADATA = {
|
|
21314
|
-
"node_modules/.deno/": "deno",
|
|
21315
|
-
"node_modules/.pnpm/": "pnpm",
|
|
21316
|
-
"node_modules/.yarn-state.yml": "yarn",
|
|
21317
|
-
"node_modules/.yarn_integrity": "yarn",
|
|
21318
|
-
"node_modules/.package-lock.json": "npm",
|
|
21319
|
-
".pnp.cjs": "yarn",
|
|
21320
|
-
".pnp.js": "yarn",
|
|
21321
|
-
"bun.lock": "bun",
|
|
21322
|
-
"bun.lockb": "bun"
|
|
21323
|
-
};
|
|
21324
|
-
INSTALL_PAGE = {
|
|
21325
|
-
bun: "https://bun.sh",
|
|
21326
|
-
deno: "https://deno.com",
|
|
21327
|
-
pnpm: "https://pnpm.io/installation",
|
|
21328
|
-
"pnpm@6": "https://pnpm.io/6.x/installation",
|
|
21329
|
-
yarn: "https://classic.yarnpkg.com/en/docs/install",
|
|
21330
|
-
"yarn@berry": "https://yarnpkg.com/getting-started/install",
|
|
21331
|
-
npm: "https://docs.npmjs.com/cli/configuring-npm/install"
|
|
21332
|
-
};
|
|
21333
|
-
});
|
|
21334
|
-
|
|
21335
|
-
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/detect.mjs
|
|
21336
|
-
import fs5 from "node:fs/promises";
|
|
21337
|
-
import path3 from "node:path";
|
|
21338
|
-
import process5 from "node:process";
|
|
21339
|
-
async function pathExists(path22, type) {
|
|
21340
|
-
try {
|
|
21341
|
-
const stat2 = await fs5.stat(path22);
|
|
21342
|
-
return type === "file" ? stat2.isFile() : stat2.isDirectory();
|
|
21343
|
-
} catch {
|
|
21344
|
-
return false;
|
|
21345
|
-
}
|
|
21346
|
-
}
|
|
21347
|
-
function* lookup(cwd = process5.cwd()) {
|
|
21348
|
-
let directory = path3.resolve(cwd);
|
|
21349
|
-
const { root } = path3.parse(directory);
|
|
21350
|
-
while (directory && directory !== root) {
|
|
21351
|
-
yield directory;
|
|
21352
|
-
directory = path3.dirname(directory);
|
|
21353
|
-
}
|
|
21354
|
-
}
|
|
21355
|
-
async function parsePackageJson(filepath, options2) {
|
|
21356
|
-
if (!filepath || !await pathExists(filepath, "file"))
|
|
21357
|
-
return null;
|
|
21358
|
-
return await handlePackageManager(filepath, options2);
|
|
21359
|
-
}
|
|
21360
|
-
async function detect(options2 = {}) {
|
|
21361
|
-
const {
|
|
21362
|
-
cwd,
|
|
21363
|
-
strategies = ["lockfile", "packageManager-field", "devEngines-field"]
|
|
21364
|
-
} = options2;
|
|
21365
|
-
let stopDir;
|
|
21366
|
-
if (typeof options2.stopDir === "string") {
|
|
21367
|
-
const resolved = path3.resolve(options2.stopDir);
|
|
21368
|
-
stopDir = (dir) => dir === resolved;
|
|
21369
|
-
} else {
|
|
21370
|
-
stopDir = options2.stopDir;
|
|
21371
|
-
}
|
|
21372
|
-
for (const directory of lookup(cwd)) {
|
|
21373
|
-
for (const strategy of strategies) {
|
|
21374
|
-
switch (strategy) {
|
|
21375
|
-
case "lockfile": {
|
|
21376
|
-
for (const lock of Object.keys(LOCKS)) {
|
|
21377
|
-
if (await pathExists(path3.join(directory, lock), "file")) {
|
|
21378
|
-
const name = LOCKS[lock];
|
|
21379
|
-
const result = await parsePackageJson(path3.join(directory, "package.json"), options2);
|
|
21380
|
-
if (result)
|
|
21381
|
-
return result;
|
|
21382
|
-
else
|
|
21383
|
-
return { name, agent: name };
|
|
21384
|
-
}
|
|
21385
|
-
}
|
|
21386
|
-
break;
|
|
21387
|
-
}
|
|
21388
|
-
case "packageManager-field":
|
|
21389
|
-
case "devEngines-field": {
|
|
21390
|
-
const result = await parsePackageJson(path3.join(directory, "package.json"), options2);
|
|
21391
|
-
if (result)
|
|
21392
|
-
return result;
|
|
21393
|
-
break;
|
|
21394
|
-
}
|
|
21395
|
-
case "install-metadata": {
|
|
21396
|
-
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
21397
|
-
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
21398
|
-
if (await pathExists(path3.join(directory, metadata), fileOrDir)) {
|
|
21399
|
-
const name = INSTALL_METADATA[metadata];
|
|
21400
|
-
const agent = name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
|
|
21401
|
-
return { name, agent };
|
|
21402
|
-
}
|
|
21403
|
-
}
|
|
21404
|
-
break;
|
|
21405
|
-
}
|
|
21406
|
-
}
|
|
21407
|
-
}
|
|
21408
|
-
if (stopDir?.(directory))
|
|
21409
|
-
break;
|
|
21410
|
-
}
|
|
21411
|
-
return null;
|
|
21412
|
-
}
|
|
21413
|
-
function getNameAndVer(pkg) {
|
|
21414
|
-
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
21415
|
-
if (typeof pkg.packageManager === "string") {
|
|
21416
|
-
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
21417
|
-
return { name, ver: handelVer(ver) };
|
|
21418
|
-
}
|
|
21419
|
-
if (typeof pkg.devEngines?.packageManager?.name === "string") {
|
|
21420
|
-
return {
|
|
21421
|
-
name: pkg.devEngines.packageManager.name,
|
|
21422
|
-
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
21423
|
-
};
|
|
21424
|
-
}
|
|
21425
|
-
return;
|
|
21426
|
-
}
|
|
21427
|
-
async function handlePackageManager(filepath, options2) {
|
|
21428
|
-
try {
|
|
21429
|
-
const content = await fs5.readFile(filepath, "utf8");
|
|
21430
|
-
const pkg = options2.packageJsonParser ? await options2.packageJsonParser(content, filepath) : JSON.parse(content);
|
|
21431
|
-
let agent;
|
|
21432
|
-
const nameAndVer = getNameAndVer(pkg);
|
|
21433
|
-
if (nameAndVer) {
|
|
21434
|
-
const name = nameAndVer.name;
|
|
21435
|
-
const ver = nameAndVer.ver;
|
|
21436
|
-
let version = ver;
|
|
21437
|
-
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
21438
|
-
agent = "yarn@berry";
|
|
21439
|
-
version = "berry";
|
|
21440
|
-
return { name, agent, version };
|
|
21441
|
-
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
21442
|
-
agent = "pnpm@6";
|
|
21443
|
-
return { name, agent, version };
|
|
21444
|
-
} else if (AGENTS.includes(name)) {
|
|
21445
|
-
agent = name;
|
|
21446
|
-
return { name, agent, version };
|
|
21447
|
-
} else {
|
|
21448
|
-
return options2.onUnknown?.(pkg.packageManager) ?? null;
|
|
21449
|
-
}
|
|
21450
|
-
}
|
|
21451
|
-
} catch {}
|
|
21452
|
-
return null;
|
|
21453
|
-
}
|
|
21454
|
-
function isMetadataYarnClassic(metadataPath) {
|
|
21455
|
-
return metadataPath.endsWith(".yarn_integrity");
|
|
21456
|
-
}
|
|
21457
|
-
var init_detect = __esm(() => {
|
|
21458
|
-
init_constants();
|
|
21459
|
-
});
|
|
21460
|
-
|
|
21461
21180
|
// ../../node_modules/@antfu/ni/node_modules/package-manager-detector/dist/index.mjs
|
|
21462
21181
|
import"node:fs/promises";
|
|
21463
21182
|
import"node:path";
|
|
21464
21183
|
import"node:process";
|
|
21465
|
-
var init_dist3 =
|
|
21466
|
-
init_commands();
|
|
21467
|
-
init_constants();
|
|
21468
|
-
init_detect();
|
|
21469
|
-
});
|
|
21184
|
+
var init_dist3 = () => {};
|
|
21470
21185
|
|
|
21471
21186
|
// ../../node_modules/tinyexec/dist/main.js
|
|
21472
21187
|
import { createRequire as e } from "module";
|
|
@@ -22161,12 +21876,143 @@ var init_main = __esm(() => {
|
|
|
22161
21876
|
q = K;
|
|
22162
21877
|
});
|
|
22163
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
|
+
|
|
22164
22010
|
// ../../node_modules/@antfu/ni/dist/shared/ni.B5qNAuoI.mjs
|
|
22165
|
-
import
|
|
22011
|
+
import path3, { join as join7, dirname as dirname6, resolve as resolve7 } from "node:path";
|
|
22166
22012
|
import process$1 from "node:process";
|
|
22167
22013
|
import require$$0 from "readline";
|
|
22168
22014
|
import require$$2 from "events";
|
|
22169
|
-
import
|
|
22015
|
+
import fs5, { promises, existsSync as existsSync2 } from "node:fs";
|
|
22170
22016
|
import require$$0$1 from "os";
|
|
22171
22017
|
import require$$1 from "tty";
|
|
22172
22018
|
import os4 from "node:os";
|
|
@@ -25015,10 +24861,10 @@ function requirePosix() {
|
|
|
25015
24861
|
posix.sync = posix.isexe = undefined;
|
|
25016
24862
|
const fs_1 = require$$0$2;
|
|
25017
24863
|
const promises_1 = require$$1$1;
|
|
25018
|
-
const isexe = async (
|
|
24864
|
+
const isexe = async (path4, options2 = {}) => {
|
|
25019
24865
|
const { ignoreErrors = false } = options2;
|
|
25020
24866
|
try {
|
|
25021
|
-
return checkStat(await (0, promises_1.stat)(
|
|
24867
|
+
return checkStat(await (0, promises_1.stat)(path4), options2);
|
|
25022
24868
|
} catch (e2) {
|
|
25023
24869
|
const er = e2;
|
|
25024
24870
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25027,10 +24873,10 @@ function requirePosix() {
|
|
|
25027
24873
|
}
|
|
25028
24874
|
};
|
|
25029
24875
|
posix.isexe = isexe;
|
|
25030
|
-
const sync = (
|
|
24876
|
+
const sync = (path4, options2 = {}) => {
|
|
25031
24877
|
const { ignoreErrors = false } = options2;
|
|
25032
24878
|
try {
|
|
25033
|
-
return checkStat((0, fs_1.statSync)(
|
|
24879
|
+
return checkStat((0, fs_1.statSync)(path4), options2);
|
|
25034
24880
|
} catch (e2) {
|
|
25035
24881
|
const er = e2;
|
|
25036
24882
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25067,10 +24913,10 @@ function requireWin32() {
|
|
|
25067
24913
|
win32.sync = win32.isexe = undefined;
|
|
25068
24914
|
const fs_1 = require$$0$2;
|
|
25069
24915
|
const promises_1 = require$$1$1;
|
|
25070
|
-
const isexe = async (
|
|
24916
|
+
const isexe = async (path4, options2 = {}) => {
|
|
25071
24917
|
const { ignoreErrors = false } = options2;
|
|
25072
24918
|
try {
|
|
25073
|
-
return checkStat(await (0, promises_1.stat)(
|
|
24919
|
+
return checkStat(await (0, promises_1.stat)(path4), path4, options2);
|
|
25074
24920
|
} catch (e2) {
|
|
25075
24921
|
const er = e2;
|
|
25076
24922
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25079,10 +24925,10 @@ function requireWin32() {
|
|
|
25079
24925
|
}
|
|
25080
24926
|
};
|
|
25081
24927
|
win32.isexe = isexe;
|
|
25082
|
-
const sync = (
|
|
24928
|
+
const sync = (path4, options2 = {}) => {
|
|
25083
24929
|
const { ignoreErrors = false } = options2;
|
|
25084
24930
|
try {
|
|
25085
|
-
return checkStat((0, fs_1.statSync)(
|
|
24931
|
+
return checkStat((0, fs_1.statSync)(path4), path4, options2);
|
|
25086
24932
|
} catch (e2) {
|
|
25087
24933
|
const er = e2;
|
|
25088
24934
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -25091,7 +24937,7 @@ function requireWin32() {
|
|
|
25091
24937
|
}
|
|
25092
24938
|
};
|
|
25093
24939
|
win32.sync = sync;
|
|
25094
|
-
const checkPathExt = (
|
|
24940
|
+
const checkPathExt = (path4, options2) => {
|
|
25095
24941
|
const { pathExt = process.env.PATHEXT || "" } = options2;
|
|
25096
24942
|
const peSplit = pathExt.split(";");
|
|
25097
24943
|
if (peSplit.indexOf("") !== -1) {
|
|
@@ -25099,14 +24945,14 @@ function requireWin32() {
|
|
|
25099
24945
|
}
|
|
25100
24946
|
for (let i2 = 0;i2 < peSplit.length; i2++) {
|
|
25101
24947
|
const p2 = peSplit[i2].toLowerCase();
|
|
25102
|
-
const ext =
|
|
24948
|
+
const ext = path4.substring(path4.length - p2.length).toLowerCase();
|
|
25103
24949
|
if (p2 && ext === p2) {
|
|
25104
24950
|
return true;
|
|
25105
24951
|
}
|
|
25106
24952
|
}
|
|
25107
24953
|
return false;
|
|
25108
24954
|
};
|
|
25109
|
-
const checkStat = (stat2,
|
|
24955
|
+
const checkStat = (stat2, path4, options2) => stat2.isFile() && checkPathExt(path4, options2);
|
|
25110
24956
|
return win32;
|
|
25111
24957
|
}
|
|
25112
24958
|
function requireOptions() {
|
|
@@ -25281,7 +25127,7 @@ async function detect2({ autoInstall, programmatic, cwd } = {}) {
|
|
|
25281
25127
|
`);
|
|
25282
25128
|
if (process$1.env.CI)
|
|
25283
25129
|
process$1.exit(1);
|
|
25284
|
-
const link2 = terminalLink(name,
|
|
25130
|
+
const link2 = terminalLink(name, INSTALL_PAGE2[name]);
|
|
25285
25131
|
const { tryInstall } = await prompts({
|
|
25286
25132
|
name: "tryInstall",
|
|
25287
25133
|
type: "confirm",
|
|
@@ -25356,7 +25202,7 @@ var init_ni_B5qNAuoI = __esm(() => {
|
|
|
25356
25202
|
CLI_TEMP_DIR = join7(os4.tmpdir(), "antfu-ni");
|
|
25357
25203
|
customRcPath = process$1.env.NI_CONFIG_FILE;
|
|
25358
25204
|
home = process$1.platform === "win32" ? process$1.env.USERPROFILE : process$1.env.HOME;
|
|
25359
|
-
defaultRcPath =
|
|
25205
|
+
defaultRcPath = path3.join(home || "~/", ".nirc");
|
|
25360
25206
|
});
|
|
25361
25207
|
|
|
25362
25208
|
// ../../node_modules/@antfu/ni/dist/index.mjs
|
|
@@ -25564,10 +25410,10 @@ var init_template = __esm(() => {
|
|
|
25564
25410
|
});
|
|
25565
25411
|
|
|
25566
25412
|
// ../../node_modules/execa/lib/utils/standard-stream.js
|
|
25567
|
-
import
|
|
25413
|
+
import process5 from "node:process";
|
|
25568
25414
|
var isStandardStream = (stream2) => STANDARD_STREAMS.includes(stream2), STANDARD_STREAMS, STANDARD_STREAMS_ALIASES, getStreamName = (fdNumber) => STANDARD_STREAMS_ALIASES[fdNumber] ?? `stdio[${fdNumber}]`;
|
|
25569
25415
|
var init_standard_stream = __esm(() => {
|
|
25570
|
-
STANDARD_STREAMS = [
|
|
25416
|
+
STANDARD_STREAMS = [process5.stdin, process5.stdout, process5.stderr];
|
|
25571
25417
|
STANDARD_STREAMS_ALIASES = ["stdin", "stdout", "stderr"];
|
|
25572
25418
|
});
|
|
25573
25419
|
|
|
@@ -25689,11 +25535,11 @@ var init_escape = __esm(() => {
|
|
|
25689
25535
|
});
|
|
25690
25536
|
|
|
25691
25537
|
// ../../node_modules/is-unicode-supported/index.js
|
|
25692
|
-
import
|
|
25538
|
+
import process6 from "node:process";
|
|
25693
25539
|
function isUnicodeSupported() {
|
|
25694
|
-
const { env: env2 } =
|
|
25540
|
+
const { env: env2 } = process6;
|
|
25695
25541
|
const { TERM, TERM_PROGRAM } = env2;
|
|
25696
|
-
if (
|
|
25542
|
+
if (process6.platform !== "win32") {
|
|
25697
25543
|
return TERM !== "linux";
|
|
25698
25544
|
}
|
|
25699
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";
|
|
@@ -26055,7 +25901,6 @@ var init_base = __esm(() => {
|
|
|
26055
25901
|
// ../../node_modules/yoctocolors/index.js
|
|
26056
25902
|
var init_yoctocolors = __esm(() => {
|
|
26057
25903
|
init_base();
|
|
26058
|
-
init_base();
|
|
26059
25904
|
});
|
|
26060
25905
|
|
|
26061
25906
|
// ../../node_modules/execa/lib/verbose/default.js
|
|
@@ -26227,8 +26072,8 @@ var init_command = __esm(() => {
|
|
|
26227
26072
|
var require_windows = __commonJS((exports, module) => {
|
|
26228
26073
|
module.exports = isexe;
|
|
26229
26074
|
isexe.sync = sync;
|
|
26230
|
-
var
|
|
26231
|
-
function checkPathExt(
|
|
26075
|
+
var fs6 = __require("fs");
|
|
26076
|
+
function checkPathExt(path4, options3) {
|
|
26232
26077
|
var pathext = options3.pathExt !== undefined ? options3.pathExt : process.env.PATHEXT;
|
|
26233
26078
|
if (!pathext) {
|
|
26234
26079
|
return true;
|
|
@@ -26239,25 +26084,25 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
26239
26084
|
}
|
|
26240
26085
|
for (var i2 = 0;i2 < pathext.length; i2++) {
|
|
26241
26086
|
var p2 = pathext[i2].toLowerCase();
|
|
26242
|
-
if (p2 &&
|
|
26087
|
+
if (p2 && path4.substr(-p2.length).toLowerCase() === p2) {
|
|
26243
26088
|
return true;
|
|
26244
26089
|
}
|
|
26245
26090
|
}
|
|
26246
26091
|
return false;
|
|
26247
26092
|
}
|
|
26248
|
-
function checkStat(stat2,
|
|
26093
|
+
function checkStat(stat2, path4, options3) {
|
|
26249
26094
|
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
26250
26095
|
return false;
|
|
26251
26096
|
}
|
|
26252
|
-
return checkPathExt(
|
|
26097
|
+
return checkPathExt(path4, options3);
|
|
26253
26098
|
}
|
|
26254
|
-
function isexe(
|
|
26255
|
-
|
|
26256
|
-
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));
|
|
26257
26102
|
});
|
|
26258
26103
|
}
|
|
26259
|
-
function sync(
|
|
26260
|
-
return checkStat(
|
|
26104
|
+
function sync(path4, options3) {
|
|
26105
|
+
return checkStat(fs6.statSync(path4), path4, options3);
|
|
26261
26106
|
}
|
|
26262
26107
|
});
|
|
26263
26108
|
|
|
@@ -26265,14 +26110,14 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
26265
26110
|
var require_mode = __commonJS((exports, module) => {
|
|
26266
26111
|
module.exports = isexe;
|
|
26267
26112
|
isexe.sync = sync;
|
|
26268
|
-
var
|
|
26269
|
-
function isexe(
|
|
26270
|
-
|
|
26113
|
+
var fs6 = __require("fs");
|
|
26114
|
+
function isexe(path4, options3, cb) {
|
|
26115
|
+
fs6.stat(path4, function(er, stat2) {
|
|
26271
26116
|
cb(er, er ? false : checkStat(stat2, options3));
|
|
26272
26117
|
});
|
|
26273
26118
|
}
|
|
26274
|
-
function sync(
|
|
26275
|
-
return checkStat(
|
|
26119
|
+
function sync(path4, options3) {
|
|
26120
|
+
return checkStat(fs6.statSync(path4), options3);
|
|
26276
26121
|
}
|
|
26277
26122
|
function checkStat(stat2, options3) {
|
|
26278
26123
|
return stat2.isFile() && checkMode(stat2, options3);
|
|
@@ -26294,7 +26139,7 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
26294
26139
|
|
|
26295
26140
|
// ../../node_modules/isexe/index.js
|
|
26296
26141
|
var require_isexe = __commonJS((exports, module) => {
|
|
26297
|
-
var
|
|
26142
|
+
var fs6 = __require("fs");
|
|
26298
26143
|
var core2;
|
|
26299
26144
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
26300
26145
|
core2 = require_windows();
|
|
@@ -26303,7 +26148,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26303
26148
|
}
|
|
26304
26149
|
module.exports = isexe;
|
|
26305
26150
|
isexe.sync = sync;
|
|
26306
|
-
function isexe(
|
|
26151
|
+
function isexe(path4, options3, cb) {
|
|
26307
26152
|
if (typeof options3 === "function") {
|
|
26308
26153
|
cb = options3;
|
|
26309
26154
|
options3 = {};
|
|
@@ -26313,7 +26158,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26313
26158
|
throw new TypeError("callback not provided");
|
|
26314
26159
|
}
|
|
26315
26160
|
return new Promise(function(resolve8, reject) {
|
|
26316
|
-
isexe(
|
|
26161
|
+
isexe(path4, options3 || {}, function(er, is2) {
|
|
26317
26162
|
if (er) {
|
|
26318
26163
|
reject(er);
|
|
26319
26164
|
} else {
|
|
@@ -26322,7 +26167,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26322
26167
|
});
|
|
26323
26168
|
});
|
|
26324
26169
|
}
|
|
26325
|
-
core2(
|
|
26170
|
+
core2(path4, options3 || {}, function(er, is2) {
|
|
26326
26171
|
if (er) {
|
|
26327
26172
|
if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
|
|
26328
26173
|
er = null;
|
|
@@ -26332,9 +26177,9 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26332
26177
|
cb(er, is2);
|
|
26333
26178
|
});
|
|
26334
26179
|
}
|
|
26335
|
-
function sync(
|
|
26180
|
+
function sync(path4, options3) {
|
|
26336
26181
|
try {
|
|
26337
|
-
return core2.sync(
|
|
26182
|
+
return core2.sync(path4, options3 || {});
|
|
26338
26183
|
} catch (er) {
|
|
26339
26184
|
if (options3 && options3.ignoreErrors || er.code === "EACCES") {
|
|
26340
26185
|
return false;
|
|
@@ -26348,7 +26193,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
26348
26193
|
// ../../node_modules/which/which.js
|
|
26349
26194
|
var require_which = __commonJS((exports, module) => {
|
|
26350
26195
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
26351
|
-
var
|
|
26196
|
+
var path4 = __require("path");
|
|
26352
26197
|
var COLON = isWindows ? ";" : ":";
|
|
26353
26198
|
var isexe = require_isexe();
|
|
26354
26199
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -26384,7 +26229,7 @@ var require_which = __commonJS((exports, module) => {
|
|
|
26384
26229
|
return opt.all && found.length ? resolve8(found) : reject(getNotFoundError(cmd));
|
|
26385
26230
|
const ppRaw = pathEnv[i2];
|
|
26386
26231
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
26387
|
-
const pCmd =
|
|
26232
|
+
const pCmd = path4.join(pathPart, cmd);
|
|
26388
26233
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
26389
26234
|
resolve8(subStep(p2, i2, 0));
|
|
26390
26235
|
});
|
|
@@ -26411,7 +26256,7 @@ var require_which = __commonJS((exports, module) => {
|
|
|
26411
26256
|
for (let i2 = 0;i2 < pathEnv.length; i2++) {
|
|
26412
26257
|
const ppRaw = pathEnv[i2];
|
|
26413
26258
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
26414
|
-
const pCmd =
|
|
26259
|
+
const pCmd = path4.join(pathPart, cmd);
|
|
26415
26260
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
26416
26261
|
for (let j2 = 0;j2 < pathExt.length; j2++) {
|
|
26417
26262
|
const cur = p2 + pathExt[j2];
|
|
@@ -26452,7 +26297,7 @@ var require_path_key = __commonJS((exports, module) => {
|
|
|
26452
26297
|
|
|
26453
26298
|
// ../../node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
26454
26299
|
var require_resolveCommand = __commonJS((exports, module) => {
|
|
26455
|
-
var
|
|
26300
|
+
var path4 = __require("path");
|
|
26456
26301
|
var which2 = require_which();
|
|
26457
26302
|
var getPathKey = require_path_key();
|
|
26458
26303
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -26469,7 +26314,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
|
|
|
26469
26314
|
try {
|
|
26470
26315
|
resolved = which2.sync(parsed.command, {
|
|
26471
26316
|
path: env2[getPathKey({ env: env2 })],
|
|
26472
|
-
pathExt: withoutPathExt ?
|
|
26317
|
+
pathExt: withoutPathExt ? path4.delimiter : undefined
|
|
26473
26318
|
});
|
|
26474
26319
|
} catch (e2) {} finally {
|
|
26475
26320
|
if (shouldSwitchCwd) {
|
|
@@ -26477,7 +26322,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
|
|
|
26477
26322
|
}
|
|
26478
26323
|
}
|
|
26479
26324
|
if (resolved) {
|
|
26480
|
-
resolved =
|
|
26325
|
+
resolved = path4.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
26481
26326
|
}
|
|
26482
26327
|
return resolved;
|
|
26483
26328
|
}
|
|
@@ -26522,8 +26367,8 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
26522
26367
|
if (!match) {
|
|
26523
26368
|
return null;
|
|
26524
26369
|
}
|
|
26525
|
-
const [
|
|
26526
|
-
const binary =
|
|
26370
|
+
const [path4, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
26371
|
+
const binary = path4.split("/").pop();
|
|
26527
26372
|
if (binary === "env") {
|
|
26528
26373
|
return argument;
|
|
26529
26374
|
}
|
|
@@ -26533,16 +26378,16 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
26533
26378
|
|
|
26534
26379
|
// ../../node_modules/cross-spawn/lib/util/readShebang.js
|
|
26535
26380
|
var require_readShebang = __commonJS((exports, module) => {
|
|
26536
|
-
var
|
|
26381
|
+
var fs6 = __require("fs");
|
|
26537
26382
|
var shebangCommand = require_shebang_command();
|
|
26538
26383
|
function readShebang(command) {
|
|
26539
26384
|
const size2 = 150;
|
|
26540
26385
|
const buffer2 = Buffer.alloc(size2);
|
|
26541
26386
|
let fd;
|
|
26542
26387
|
try {
|
|
26543
|
-
fd =
|
|
26544
|
-
|
|
26545
|
-
|
|
26388
|
+
fd = fs6.openSync(command, "r");
|
|
26389
|
+
fs6.readSync(fd, buffer2, 0, size2, 0);
|
|
26390
|
+
fs6.closeSync(fd);
|
|
26546
26391
|
} catch (e2) {}
|
|
26547
26392
|
return shebangCommand(buffer2.toString());
|
|
26548
26393
|
}
|
|
@@ -26551,7 +26396,7 @@ var require_readShebang = __commonJS((exports, module) => {
|
|
|
26551
26396
|
|
|
26552
26397
|
// ../../node_modules/cross-spawn/lib/parse.js
|
|
26553
26398
|
var require_parse3 = __commonJS((exports, module) => {
|
|
26554
|
-
var
|
|
26399
|
+
var path4 = __require("path");
|
|
26555
26400
|
var resolveCommand2 = require_resolveCommand();
|
|
26556
26401
|
var escape2 = require_escape();
|
|
26557
26402
|
var readShebang = require_readShebang();
|
|
@@ -26576,7 +26421,7 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
26576
26421
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
26577
26422
|
if (parsed.options.forceShell || needsShell) {
|
|
26578
26423
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
26579
|
-
parsed.command =
|
|
26424
|
+
parsed.command = path4.normalize(parsed.command);
|
|
26580
26425
|
parsed.command = escape2.command(parsed.command);
|
|
26581
26426
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
26582
26427
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -26693,7 +26538,7 @@ function pathKey(options3 = {}) {
|
|
|
26693
26538
|
// ../../node_modules/unicorn-magic/node.js
|
|
26694
26539
|
import { promisify as promisify4 } from "node:util";
|
|
26695
26540
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
26696
|
-
import
|
|
26541
|
+
import path4 from "node:path";
|
|
26697
26542
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
26698
26543
|
function toPath(urlOrPath) {
|
|
26699
26544
|
return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
|
|
@@ -26701,12 +26546,12 @@ function toPath(urlOrPath) {
|
|
|
26701
26546
|
function traversePathUp(startPath) {
|
|
26702
26547
|
return {
|
|
26703
26548
|
*[Symbol.iterator]() {
|
|
26704
|
-
let currentPath =
|
|
26549
|
+
let currentPath = path4.resolve(toPath(startPath));
|
|
26705
26550
|
let previousPath;
|
|
26706
26551
|
while (previousPath !== currentPath) {
|
|
26707
26552
|
yield currentPath;
|
|
26708
26553
|
previousPath = currentPath;
|
|
26709
|
-
currentPath =
|
|
26554
|
+
currentPath = path4.resolve(currentPath, "..");
|
|
26710
26555
|
}
|
|
26711
26556
|
}
|
|
26712
26557
|
};
|
|
@@ -26718,38 +26563,38 @@ var init_node = __esm(() => {
|
|
|
26718
26563
|
});
|
|
26719
26564
|
|
|
26720
26565
|
// ../../node_modules/npm-run-path/index.js
|
|
26721
|
-
import
|
|
26722
|
-
import
|
|
26566
|
+
import process7 from "node:process";
|
|
26567
|
+
import path5 from "node:path";
|
|
26723
26568
|
var npmRunPath = ({
|
|
26724
|
-
cwd =
|
|
26725
|
-
path: pathOption =
|
|
26569
|
+
cwd = process7.cwd(),
|
|
26570
|
+
path: pathOption = process7.env[pathKey()],
|
|
26726
26571
|
preferLocal = true,
|
|
26727
|
-
execPath =
|
|
26572
|
+
execPath = process7.execPath,
|
|
26728
26573
|
addExecPath = true
|
|
26729
26574
|
} = {}) => {
|
|
26730
|
-
const cwdPath =
|
|
26575
|
+
const cwdPath = path5.resolve(toPath(cwd));
|
|
26731
26576
|
const result = [];
|
|
26732
|
-
const pathParts = pathOption.split(
|
|
26577
|
+
const pathParts = pathOption.split(path5.delimiter);
|
|
26733
26578
|
if (preferLocal) {
|
|
26734
26579
|
applyPreferLocal(result, pathParts, cwdPath);
|
|
26735
26580
|
}
|
|
26736
26581
|
if (addExecPath) {
|
|
26737
26582
|
applyExecPath(result, pathParts, execPath, cwdPath);
|
|
26738
26583
|
}
|
|
26739
|
-
return pathOption === "" || pathOption ===
|
|
26584
|
+
return pathOption === "" || pathOption === path5.delimiter ? `${result.join(path5.delimiter)}${pathOption}` : [...result, pathOption].join(path5.delimiter);
|
|
26740
26585
|
}, applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
26741
26586
|
for (const directory of traversePathUp(cwdPath)) {
|
|
26742
|
-
const pathPart =
|
|
26587
|
+
const pathPart = path5.join(directory, "node_modules/.bin");
|
|
26743
26588
|
if (!pathParts.includes(pathPart)) {
|
|
26744
26589
|
result.push(pathPart);
|
|
26745
26590
|
}
|
|
26746
26591
|
}
|
|
26747
26592
|
}, applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
26748
|
-
const pathPart =
|
|
26593
|
+
const pathPart = path5.resolve(cwdPath, toPath(execPath), "..");
|
|
26749
26594
|
if (!pathParts.includes(pathPart)) {
|
|
26750
26595
|
result.push(pathPart);
|
|
26751
26596
|
}
|
|
26752
|
-
}, npmRunPathEnv = ({ env: env2 =
|
|
26597
|
+
}, npmRunPathEnv = ({ env: env2 = process7.env, ...options3 } = {}) => {
|
|
26753
26598
|
env2 = { ...env2 };
|
|
26754
26599
|
const pathName = pathKey({ env: env2 });
|
|
26755
26600
|
options3.path = env2[pathName];
|
|
@@ -27855,7 +27700,7 @@ var init_timeout = __esm(() => {
|
|
|
27855
27700
|
|
|
27856
27701
|
// ../../node_modules/execa/lib/methods/node.js
|
|
27857
27702
|
import { execPath, execArgv } from "node:process";
|
|
27858
|
-
import
|
|
27703
|
+
import path6 from "node:path";
|
|
27859
27704
|
var mapNode = ({ options: options3 }) => {
|
|
27860
27705
|
if (options3.node === false) {
|
|
27861
27706
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -27873,7 +27718,7 @@ var mapNode = ({ options: options3 }) => {
|
|
|
27873
27718
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
27874
27719
|
}
|
|
27875
27720
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
|
|
27876
|
-
const resolvedNodePath =
|
|
27721
|
+
const resolvedNodePath = path6.resolve(cwd, normalizedNodePath);
|
|
27877
27722
|
const newOptions = {
|
|
27878
27723
|
...options3,
|
|
27879
27724
|
nodePath: resolvedNodePath,
|
|
@@ -27883,7 +27728,7 @@ var mapNode = ({ options: options3 }) => {
|
|
|
27883
27728
|
if (!shouldHandleNode) {
|
|
27884
27729
|
return [file, commandArguments, newOptions];
|
|
27885
27730
|
}
|
|
27886
|
-
if (
|
|
27731
|
+
if (path6.basename(file, ".exe") === "node") {
|
|
27887
27732
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
27888
27733
|
}
|
|
27889
27734
|
return [
|
|
@@ -27974,14 +27819,14 @@ var init_encoding_option = __esm(() => {
|
|
|
27974
27819
|
|
|
27975
27820
|
// ../../node_modules/execa/lib/arguments/cwd.js
|
|
27976
27821
|
import { statSync } from "node:fs";
|
|
27977
|
-
import
|
|
27978
|
-
import
|
|
27822
|
+
import path7 from "node:path";
|
|
27823
|
+
import process8 from "node:process";
|
|
27979
27824
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
27980
27825
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
27981
|
-
return
|
|
27826
|
+
return path7.resolve(cwdString);
|
|
27982
27827
|
}, getDefaultCwd = () => {
|
|
27983
27828
|
try {
|
|
27984
|
-
return
|
|
27829
|
+
return process8.cwd();
|
|
27985
27830
|
} catch (error2) {
|
|
27986
27831
|
error2.message = `The current directory does not exist.
|
|
27987
27832
|
${error2.message}`;
|
|
@@ -28010,8 +27855,8 @@ var init_cwd = __esm(() => {
|
|
|
28010
27855
|
});
|
|
28011
27856
|
|
|
28012
27857
|
// ../../node_modules/execa/lib/arguments/options.js
|
|
28013
|
-
import
|
|
28014
|
-
import
|
|
27858
|
+
import path8 from "node:path";
|
|
27859
|
+
import process9 from "node:process";
|
|
28015
27860
|
var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
28016
27861
|
rawOptions.cwd = normalizeCwd(rawOptions.cwd);
|
|
28017
27862
|
const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, rawOptions);
|
|
@@ -28028,7 +27873,7 @@ var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions)
|
|
|
28028
27873
|
options3.killSignal = normalizeKillSignal(options3.killSignal);
|
|
28029
27874
|
options3.forceKillAfterDelay = normalizeForceKillAfterDelay(options3.forceKillAfterDelay);
|
|
28030
27875
|
options3.lines = options3.lines.map((lines2, fdNumber) => lines2 && !BINARY_ENCODINGS.has(options3.encoding) && options3.buffer[fdNumber]);
|
|
28031
|
-
if (
|
|
27876
|
+
if (process9.platform === "win32" && path8.basename(file, ".exe") === "cmd") {
|
|
28032
27877
|
commandArguments.unshift("/q");
|
|
28033
27878
|
}
|
|
28034
27879
|
return { file, commandArguments, options: options3 };
|
|
@@ -28067,7 +27912,7 @@ var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions)
|
|
|
28067
27912
|
ipc,
|
|
28068
27913
|
serialization
|
|
28069
27914
|
}), getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
|
|
28070
|
-
const env2 = extendEnv ? { ...
|
|
27915
|
+
const env2 = extendEnv ? { ...process9.env, ...envOption } : envOption;
|
|
28071
27916
|
if (preferLocal || node) {
|
|
28072
27917
|
return npmRunPathEnv({
|
|
28073
27918
|
env: env2,
|
|
@@ -28185,10 +28030,6 @@ function i2() {
|
|
|
28185
28030
|
function o2(r2) {
|
|
28186
28031
|
return this[n2].return(r2);
|
|
28187
28032
|
}
|
|
28188
|
-
function h2({ preventCancel: r2 = false } = {}) {
|
|
28189
|
-
const e2 = this.getReader(), t2 = new c2(e2, r2), s2 = Object.create(u2);
|
|
28190
|
-
return s2[n2] = t2, s2;
|
|
28191
|
-
}
|
|
28192
28033
|
var a3, n2, u2;
|
|
28193
28034
|
var init_asyncIterator = __esm(() => {
|
|
28194
28035
|
a3 = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype);
|
|
@@ -28221,276 +28062,18 @@ var init_ponyfill = __esm(() => {
|
|
|
28221
28062
|
});
|
|
28222
28063
|
|
|
28223
28064
|
// ../../node_modules/get-stream/source/stream.js
|
|
28224
|
-
var
|
|
28225
|
-
if (isReadableStream(stream2, { checkOpen: false }) && nodeImports.on !== undefined) {
|
|
28226
|
-
return getStreamIterable(stream2);
|
|
28227
|
-
}
|
|
28228
|
-
if (typeof stream2?.[Symbol.asyncIterator] === "function") {
|
|
28229
|
-
return stream2;
|
|
28230
|
-
}
|
|
28231
|
-
if (toString2.call(stream2) === "[object ReadableStream]") {
|
|
28232
|
-
return h2.call(stream2);
|
|
28233
|
-
}
|
|
28234
|
-
throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
|
|
28235
|
-
}, toString2, getStreamIterable = async function* (stream2) {
|
|
28236
|
-
const controller = new AbortController;
|
|
28237
|
-
const state = {};
|
|
28238
|
-
handleStreamEnd(stream2, controller, state);
|
|
28239
|
-
try {
|
|
28240
|
-
for await (const [chunk] of nodeImports.on(stream2, "data", { signal: controller.signal })) {
|
|
28241
|
-
yield chunk;
|
|
28242
|
-
}
|
|
28243
|
-
} catch (error2) {
|
|
28244
|
-
if (state.error !== undefined) {
|
|
28245
|
-
throw state.error;
|
|
28246
|
-
} else if (!controller.signal.aborted) {
|
|
28247
|
-
throw error2;
|
|
28248
|
-
}
|
|
28249
|
-
} finally {
|
|
28250
|
-
stream2.destroy();
|
|
28251
|
-
}
|
|
28252
|
-
}, handleStreamEnd = async (stream2, controller, state) => {
|
|
28253
|
-
try {
|
|
28254
|
-
await nodeImports.finished(stream2, {
|
|
28255
|
-
cleanup: true,
|
|
28256
|
-
readable: true,
|
|
28257
|
-
writable: false,
|
|
28258
|
-
error: false
|
|
28259
|
-
});
|
|
28260
|
-
} catch (error2) {
|
|
28261
|
-
state.error = error2;
|
|
28262
|
-
} finally {
|
|
28263
|
-
controller.abort();
|
|
28264
|
-
}
|
|
28265
|
-
}, nodeImports;
|
|
28065
|
+
var toString2, nodeImports;
|
|
28266
28066
|
var init_stream = __esm(() => {
|
|
28267
28067
|
init_ponyfill();
|
|
28268
28068
|
({ toString: toString2 } = Object.prototype);
|
|
28269
28069
|
nodeImports = {};
|
|
28270
28070
|
});
|
|
28271
28071
|
|
|
28272
|
-
// ../../node_modules/get-stream/source/contents.js
|
|
28273
|
-
var getStreamContents = async (stream2, { init: init2, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
28274
|
-
const asyncIterable = getAsyncIterable(stream2);
|
|
28275
|
-
const state = init2();
|
|
28276
|
-
state.length = 0;
|
|
28277
|
-
try {
|
|
28278
|
-
for await (const chunk of asyncIterable) {
|
|
28279
|
-
const chunkType = getChunkType(chunk);
|
|
28280
|
-
const convertedChunk = convertChunk[chunkType](chunk, state);
|
|
28281
|
-
appendChunk({
|
|
28282
|
-
convertedChunk,
|
|
28283
|
-
state,
|
|
28284
|
-
getSize,
|
|
28285
|
-
truncateChunk,
|
|
28286
|
-
addChunk,
|
|
28287
|
-
maxBuffer
|
|
28288
|
-
});
|
|
28289
|
-
}
|
|
28290
|
-
appendFinalChunk({
|
|
28291
|
-
state,
|
|
28292
|
-
convertChunk,
|
|
28293
|
-
getSize,
|
|
28294
|
-
truncateChunk,
|
|
28295
|
-
addChunk,
|
|
28296
|
-
getFinalChunk,
|
|
28297
|
-
maxBuffer
|
|
28298
|
-
});
|
|
28299
|
-
return finalize(state);
|
|
28300
|
-
} catch (error2) {
|
|
28301
|
-
const normalizedError = typeof error2 === "object" && error2 !== null ? error2 : new Error(error2);
|
|
28302
|
-
normalizedError.bufferedData = finalize(state);
|
|
28303
|
-
throw normalizedError;
|
|
28304
|
-
}
|
|
28305
|
-
}, appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
|
|
28306
|
-
const convertedChunk = getFinalChunk(state);
|
|
28307
|
-
if (convertedChunk !== undefined) {
|
|
28308
|
-
appendChunk({
|
|
28309
|
-
convertedChunk,
|
|
28310
|
-
state,
|
|
28311
|
-
getSize,
|
|
28312
|
-
truncateChunk,
|
|
28313
|
-
addChunk,
|
|
28314
|
-
maxBuffer
|
|
28315
|
-
});
|
|
28316
|
-
}
|
|
28317
|
-
}, appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
|
|
28318
|
-
const chunkSize = getSize(convertedChunk);
|
|
28319
|
-
const newLength = state.length + chunkSize;
|
|
28320
|
-
if (newLength <= maxBuffer) {
|
|
28321
|
-
addNewChunk(convertedChunk, state, addChunk, newLength);
|
|
28322
|
-
return;
|
|
28323
|
-
}
|
|
28324
|
-
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
|
|
28325
|
-
if (truncatedChunk !== undefined) {
|
|
28326
|
-
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
|
|
28327
|
-
}
|
|
28328
|
-
throw new MaxBufferError;
|
|
28329
|
-
}, addNewChunk = (convertedChunk, state, addChunk, newLength) => {
|
|
28330
|
-
state.contents = addChunk(convertedChunk, state, newLength);
|
|
28331
|
-
state.length = newLength;
|
|
28332
|
-
}, getChunkType = (chunk) => {
|
|
28333
|
-
const typeOfChunk = typeof chunk;
|
|
28334
|
-
if (typeOfChunk === "string") {
|
|
28335
|
-
return "string";
|
|
28336
|
-
}
|
|
28337
|
-
if (typeOfChunk !== "object" || chunk === null) {
|
|
28338
|
-
return "others";
|
|
28339
|
-
}
|
|
28340
|
-
if (globalThis.Buffer?.isBuffer(chunk)) {
|
|
28341
|
-
return "buffer";
|
|
28342
|
-
}
|
|
28343
|
-
const prototypeName = objectToString2.call(chunk);
|
|
28344
|
-
if (prototypeName === "[object ArrayBuffer]") {
|
|
28345
|
-
return "arrayBuffer";
|
|
28346
|
-
}
|
|
28347
|
-
if (prototypeName === "[object DataView]") {
|
|
28348
|
-
return "dataView";
|
|
28349
|
-
}
|
|
28350
|
-
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString2.call(chunk.buffer) === "[object ArrayBuffer]") {
|
|
28351
|
-
return "typedArray";
|
|
28352
|
-
}
|
|
28353
|
-
return "others";
|
|
28354
|
-
}, objectToString2, MaxBufferError;
|
|
28355
|
-
var init_contents = __esm(() => {
|
|
28356
|
-
init_stream();
|
|
28357
|
-
({ toString: objectToString2 } = Object.prototype);
|
|
28358
|
-
MaxBufferError = class MaxBufferError extends Error {
|
|
28359
|
-
name = "MaxBufferError";
|
|
28360
|
-
constructor() {
|
|
28361
|
-
super("maxBuffer exceeded");
|
|
28362
|
-
}
|
|
28363
|
-
};
|
|
28364
|
-
});
|
|
28365
|
-
|
|
28366
|
-
// ../../node_modules/get-stream/source/utils.js
|
|
28367
|
-
var identity2 = (value) => value, noop5 = () => {
|
|
28368
|
-
return;
|
|
28369
|
-
}, getContentsProperty = ({ contents }) => contents, throwObjectStream = (chunk) => {
|
|
28370
|
-
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
28371
|
-
}, getLengthProperty = (convertedChunk) => convertedChunk.length;
|
|
28372
|
-
|
|
28373
|
-
// ../../node_modules/get-stream/source/array.js
|
|
28374
|
-
async function getStreamAsArray(stream2, options3) {
|
|
28375
|
-
return getStreamContents(stream2, arrayMethods, options3);
|
|
28376
|
-
}
|
|
28377
|
-
var initArray = () => ({ contents: [] }), increment = () => 1, addArrayChunk = (convertedChunk, { contents }) => {
|
|
28378
|
-
contents.push(convertedChunk);
|
|
28379
|
-
return contents;
|
|
28380
|
-
}, arrayMethods;
|
|
28381
|
-
var init_array = __esm(() => {
|
|
28382
|
-
init_contents();
|
|
28383
|
-
arrayMethods = {
|
|
28384
|
-
init: initArray,
|
|
28385
|
-
convertChunk: {
|
|
28386
|
-
string: identity2,
|
|
28387
|
-
buffer: identity2,
|
|
28388
|
-
arrayBuffer: identity2,
|
|
28389
|
-
dataView: identity2,
|
|
28390
|
-
typedArray: identity2,
|
|
28391
|
-
others: identity2
|
|
28392
|
-
},
|
|
28393
|
-
getSize: increment,
|
|
28394
|
-
truncateChunk: noop5,
|
|
28395
|
-
addChunk: addArrayChunk,
|
|
28396
|
-
getFinalChunk: noop5,
|
|
28397
|
-
finalize: getContentsProperty
|
|
28398
|
-
};
|
|
28399
|
-
});
|
|
28400
|
-
|
|
28401
|
-
// ../../node_modules/get-stream/source/array-buffer.js
|
|
28402
|
-
async function getStreamAsArrayBuffer(stream2, options3) {
|
|
28403
|
-
return getStreamContents(stream2, arrayBufferMethods, options3);
|
|
28404
|
-
}
|
|
28405
|
-
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) => {
|
|
28406
|
-
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
28407
|
-
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
28408
|
-
return newContents;
|
|
28409
|
-
}, resizeArrayBufferSlow = (contents, length) => {
|
|
28410
|
-
if (length <= contents.byteLength) {
|
|
28411
|
-
return contents;
|
|
28412
|
-
}
|
|
28413
|
-
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
28414
|
-
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
28415
|
-
return arrayBuffer;
|
|
28416
|
-
}, resizeArrayBuffer = (contents, length) => {
|
|
28417
|
-
if (length <= contents.maxByteLength) {
|
|
28418
|
-
contents.resize(length);
|
|
28419
|
-
return contents;
|
|
28420
|
-
}
|
|
28421
|
-
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
|
|
28422
|
-
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
28423
|
-
return arrayBuffer;
|
|
28424
|
-
}, 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;
|
|
28425
|
-
var init_array_buffer = __esm(() => {
|
|
28426
|
-
init_contents();
|
|
28427
|
-
textEncoder2 = new TextEncoder;
|
|
28428
|
-
arrayBufferMethods = {
|
|
28429
|
-
init: initArrayBuffer,
|
|
28430
|
-
convertChunk: {
|
|
28431
|
-
string: useTextEncoder,
|
|
28432
|
-
buffer: useUint8Array,
|
|
28433
|
-
arrayBuffer: useUint8Array,
|
|
28434
|
-
dataView: useUint8ArrayWithOffset,
|
|
28435
|
-
typedArray: useUint8ArrayWithOffset,
|
|
28436
|
-
others: throwObjectStream
|
|
28437
|
-
},
|
|
28438
|
-
getSize: getLengthProperty,
|
|
28439
|
-
truncateChunk: truncateArrayBufferChunk,
|
|
28440
|
-
addChunk: addArrayBufferChunk,
|
|
28441
|
-
getFinalChunk: noop5,
|
|
28442
|
-
finalize: finalizeArrayBuffer
|
|
28443
|
-
};
|
|
28444
|
-
});
|
|
28445
|
-
|
|
28446
|
-
// ../../node_modules/get-stream/source/buffer.js
|
|
28447
|
-
var init_buffer = __esm(() => {
|
|
28448
|
-
init_array_buffer();
|
|
28449
|
-
});
|
|
28450
|
-
|
|
28451
|
-
// ../../node_modules/get-stream/source/string.js
|
|
28452
|
-
async function getStreamAsString(stream2, options3) {
|
|
28453
|
-
return getStreamContents(stream2, stringMethods, options3);
|
|
28454
|
-
}
|
|
28455
|
-
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 }) => {
|
|
28456
|
-
const finalChunk = textDecoder2.decode();
|
|
28457
|
-
return finalChunk === "" ? undefined : finalChunk;
|
|
28458
|
-
}, stringMethods;
|
|
28459
|
-
var init_string = __esm(() => {
|
|
28460
|
-
init_contents();
|
|
28461
|
-
stringMethods = {
|
|
28462
|
-
init: initString,
|
|
28463
|
-
convertChunk: {
|
|
28464
|
-
string: identity2,
|
|
28465
|
-
buffer: useTextDecoder,
|
|
28466
|
-
arrayBuffer: useTextDecoder,
|
|
28467
|
-
dataView: useTextDecoder,
|
|
28468
|
-
typedArray: useTextDecoder,
|
|
28469
|
-
others: throwObjectStream
|
|
28470
|
-
},
|
|
28471
|
-
getSize: getLengthProperty,
|
|
28472
|
-
truncateChunk: truncateStringChunk,
|
|
28473
|
-
addChunk: addStringChunk,
|
|
28474
|
-
getFinalChunk: getFinalStringChunk,
|
|
28475
|
-
finalize: getContentsProperty
|
|
28476
|
-
};
|
|
28477
|
-
});
|
|
28478
|
-
|
|
28479
|
-
// ../../node_modules/get-stream/source/exports.js
|
|
28480
|
-
var init_exports = __esm(() => {
|
|
28481
|
-
init_array();
|
|
28482
|
-
init_array_buffer();
|
|
28483
|
-
init_buffer();
|
|
28484
|
-
init_string();
|
|
28485
|
-
init_contents();
|
|
28486
|
-
});
|
|
28487
|
-
|
|
28488
28072
|
// ../../node_modules/get-stream/source/index.js
|
|
28489
28073
|
import { on } from "node:events";
|
|
28490
28074
|
import { finished } from "node:stream/promises";
|
|
28491
28075
|
var init_source5 = __esm(() => {
|
|
28492
28076
|
init_stream();
|
|
28493
|
-
init_exports();
|
|
28494
28077
|
Object.assign(nodeImports, { on, finished });
|
|
28495
28078
|
});
|
|
28496
28079
|
|
|
@@ -29254,7 +28837,7 @@ var init_normalize = __esm(() => {
|
|
|
29254
28837
|
});
|
|
29255
28838
|
|
|
29256
28839
|
// ../../node_modules/execa/lib/stdio/direction.js
|
|
29257
|
-
import
|
|
28840
|
+
import process10 from "node:process";
|
|
29258
28841
|
var getStreamDirection = (stdioItems, fdNumber, optionName) => {
|
|
29259
28842
|
const directions = stdioItems.map((stdioItem) => getStdioItemDirection(stdioItem, fdNumber));
|
|
29260
28843
|
if (directions.includes("input") && directions.includes("output")) {
|
|
@@ -29264,10 +28847,10 @@ var getStreamDirection = (stdioItems, fdNumber, optionName) => {
|
|
|
29264
28847
|
}, getStdioItemDirection = ({ type, value }, fdNumber) => KNOWN_DIRECTIONS[fdNumber] ?? guessStreamDirection[type](value), KNOWN_DIRECTIONS, anyDirection = () => {
|
|
29265
28848
|
return;
|
|
29266
28849
|
}, alwaysInput = () => "input", guessStreamDirection, getStandardStreamDirection = (value) => {
|
|
29267
|
-
if ([0,
|
|
28850
|
+
if ([0, process10.stdin].includes(value)) {
|
|
29268
28851
|
return "input";
|
|
29269
28852
|
}
|
|
29270
|
-
if ([1, 2,
|
|
28853
|
+
if ([1, 2, process10.stdout, process10.stderr].includes(value)) {
|
|
29271
28854
|
return "output";
|
|
29272
28855
|
}
|
|
29273
28856
|
}, DEFAULT_DIRECTION = "output";
|
|
@@ -29846,11 +29429,11 @@ var getEncodingTransformGenerator = (binary, encoding, skipped) => {
|
|
|
29846
29429
|
transform: encodingStringGenerator.bind(undefined, stringDecoder),
|
|
29847
29430
|
final: encodingStringFinal.bind(undefined, stringDecoder)
|
|
29848
29431
|
};
|
|
29849
|
-
}, encodingUint8ArrayGenerator = function* (
|
|
29432
|
+
}, encodingUint8ArrayGenerator = function* (textEncoder2, chunk) {
|
|
29850
29433
|
if (Buffer5.isBuffer(chunk)) {
|
|
29851
29434
|
yield bufferToUint8Array(chunk);
|
|
29852
29435
|
} else if (typeof chunk === "string") {
|
|
29853
|
-
yield
|
|
29436
|
+
yield textEncoder2.encode(chunk);
|
|
29854
29437
|
} else {
|
|
29855
29438
|
yield chunk;
|
|
29856
29439
|
}
|
|
@@ -30160,13 +29743,13 @@ var transformOutputSync = ({ fileDescriptors, syncResult: { output }, options: o
|
|
|
30160
29743
|
state.error ??= error2;
|
|
30161
29744
|
}
|
|
30162
29745
|
}, writeToFiles = (serializedResult, stdioItems, outputFiles) => {
|
|
30163
|
-
for (const { path:
|
|
30164
|
-
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();
|
|
30165
29748
|
if (append || outputFiles.has(pathString)) {
|
|
30166
|
-
appendFileSync(
|
|
29749
|
+
appendFileSync(path9, serializedResult);
|
|
30167
29750
|
} else {
|
|
30168
29751
|
outputFiles.add(pathString);
|
|
30169
|
-
writeFileSync(
|
|
29752
|
+
writeFileSync(path9, serializedResult);
|
|
30170
29753
|
}
|
|
30171
29754
|
}
|
|
30172
29755
|
};
|
|
@@ -30532,13 +30115,13 @@ var init_get_each = __esm(() => {
|
|
|
30532
30115
|
});
|
|
30533
30116
|
|
|
30534
30117
|
// ../../node_modules/execa/lib/ipc/methods.js
|
|
30535
|
-
import
|
|
30118
|
+
import process11 from "node:process";
|
|
30536
30119
|
var addIpcMethods = (subprocess, { ipc }) => {
|
|
30537
30120
|
Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
|
|
30538
30121
|
}, getIpcExport = () => {
|
|
30539
|
-
const anyProcess =
|
|
30122
|
+
const anyProcess = process11;
|
|
30540
30123
|
const isSubprocess = true;
|
|
30541
|
-
const ipc =
|
|
30124
|
+
const ipc = process11.channel !== undefined;
|
|
30542
30125
|
return {
|
|
30543
30126
|
...getIpcMethods(anyProcess, isSubprocess, ipc),
|
|
30544
30127
|
getCancelSignal: getCancelSignal.bind(undefined, {
|
|
@@ -30820,13 +30403,13 @@ var getHighWaterMark = (streams, objectMode) => {
|
|
|
30820
30403
|
}
|
|
30821
30404
|
}, errorStream = (stream2, error2) => {
|
|
30822
30405
|
if (!stream2.destroyed) {
|
|
30823
|
-
stream2.once("error",
|
|
30406
|
+
stream2.once("error", noop5);
|
|
30824
30407
|
stream2.destroy(error2);
|
|
30825
30408
|
}
|
|
30826
|
-
},
|
|
30409
|
+
}, noop5 = () => {}, updateMaxListeners = (passThroughStream, increment) => {
|
|
30827
30410
|
const maxListeners = passThroughStream.getMaxListeners();
|
|
30828
30411
|
if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
|
|
30829
|
-
passThroughStream.setMaxListeners(maxListeners +
|
|
30412
|
+
passThroughStream.setMaxListeners(maxListeners + increment);
|
|
30830
30413
|
}
|
|
30831
30414
|
}, PASSTHROUGH_LISTENERS_COUNT = 2, PASSTHROUGH_LISTENERS_PER_STREAM = 1;
|
|
30832
30415
|
var init_merge_streams = __esm(() => {
|
|
@@ -31032,7 +30615,7 @@ class Emitter {
|
|
|
31032
30615
|
|
|
31033
30616
|
class SignalExitBase {
|
|
31034
30617
|
}
|
|
31035
|
-
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) => {
|
|
31036
30619
|
return {
|
|
31037
30620
|
onExit(cb, opts) {
|
|
31038
30621
|
return handler.onExit(cb, opts);
|
|
@@ -31044,7 +30627,7 @@ var processOk = (process13) => !!process13 && typeof process13 === "object" && t
|
|
|
31044
30627
|
return handler.unload();
|
|
31045
30628
|
}
|
|
31046
30629
|
};
|
|
31047
|
-
}, SignalExitFallback, SignalExit,
|
|
30630
|
+
}, SignalExitFallback, SignalExit, process12, onExit, load, unload;
|
|
31048
30631
|
var init_mjs = __esm(() => {
|
|
31049
30632
|
init_signals2();
|
|
31050
30633
|
kExitEmitter = Symbol.for("signal-exit emitter");
|
|
@@ -31058,22 +30641,22 @@ var init_mjs = __esm(() => {
|
|
|
31058
30641
|
unload() {}
|
|
31059
30642
|
};
|
|
31060
30643
|
SignalExit = class SignalExit extends SignalExitBase {
|
|
31061
|
-
#hupSig =
|
|
30644
|
+
#hupSig = process12.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
31062
30645
|
#emitter = new Emitter;
|
|
31063
30646
|
#process;
|
|
31064
30647
|
#originalProcessEmit;
|
|
31065
30648
|
#originalProcessReallyExit;
|
|
31066
30649
|
#sigListeners = {};
|
|
31067
30650
|
#loaded = false;
|
|
31068
|
-
constructor(
|
|
30651
|
+
constructor(process12) {
|
|
31069
30652
|
super();
|
|
31070
|
-
this.#process =
|
|
30653
|
+
this.#process = process12;
|
|
31071
30654
|
this.#sigListeners = {};
|
|
31072
30655
|
for (const sig of signals) {
|
|
31073
30656
|
this.#sigListeners[sig] = () => {
|
|
31074
30657
|
const listeners = this.#process.listeners(sig);
|
|
31075
30658
|
let { count: count2 } = this.#emitter;
|
|
31076
|
-
const p2 =
|
|
30659
|
+
const p2 = process12;
|
|
31077
30660
|
if (typeof p2.__signal_exit_emitter__ === "object" && typeof p2.__signal_exit_emitter__.count === "number") {
|
|
31078
30661
|
count2 += p2.__signal_exit_emitter__.count;
|
|
31079
30662
|
}
|
|
@@ -31082,12 +30665,12 @@ var init_mjs = __esm(() => {
|
|
|
31082
30665
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
31083
30666
|
const s2 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
31084
30667
|
if (!ret)
|
|
31085
|
-
|
|
30668
|
+
process12.kill(process12.pid, s2);
|
|
31086
30669
|
}
|
|
31087
30670
|
};
|
|
31088
30671
|
}
|
|
31089
|
-
this.#originalProcessReallyExit =
|
|
31090
|
-
this.#originalProcessEmit =
|
|
30672
|
+
this.#originalProcessReallyExit = process12.reallyExit;
|
|
30673
|
+
this.#originalProcessEmit = process12.emit;
|
|
31091
30674
|
}
|
|
31092
30675
|
onExit(cb, opts) {
|
|
31093
30676
|
if (!processOk(this.#process)) {
|
|
@@ -31165,12 +30748,12 @@ var init_mjs = __esm(() => {
|
|
|
31165
30748
|
}
|
|
31166
30749
|
}
|
|
31167
30750
|
};
|
|
31168
|
-
|
|
30751
|
+
process12 = globalThis.process;
|
|
31169
30752
|
({
|
|
31170
30753
|
onExit,
|
|
31171
30754
|
load,
|
|
31172
30755
|
unload
|
|
31173
|
-
} = signalExitWrap(processOk(
|
|
30756
|
+
} = signalExitWrap(processOk(process12) ? new SignalExit(process12) : new SignalExitFallback));
|
|
31174
30757
|
});
|
|
31175
30758
|
|
|
31176
30759
|
// ../../node_modules/execa/lib/terminate/cleanup.js
|
|
@@ -31556,7 +31139,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31556
31139
|
allMixed
|
|
31557
31140
|
});
|
|
31558
31141
|
const [output] = await Promise.all([
|
|
31559
|
-
|
|
31142
|
+
getStreamContents({
|
|
31560
31143
|
stream: stream2,
|
|
31561
31144
|
iterable,
|
|
31562
31145
|
fdNumber,
|
|
@@ -31590,7 +31173,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31590
31173
|
if (stream2.readableFlowing === null) {
|
|
31591
31174
|
stream2.resume();
|
|
31592
31175
|
}
|
|
31593
|
-
},
|
|
31176
|
+
}, getStreamContents = async ({ stream: stream2, stream: { readableObjectMode }, iterable, fdNumber, encoding, maxBuffer, lines: lines2 }) => {
|
|
31594
31177
|
try {
|
|
31595
31178
|
if (readableObjectMode || lines2) {
|
|
31596
31179
|
return await getStreamAsArray(iterable, { maxBuffer });
|
|
@@ -31598,7 +31181,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31598
31181
|
if (encoding === "buffer") {
|
|
31599
31182
|
return new Uint8Array(await getStreamAsArrayBuffer(iterable, { maxBuffer }));
|
|
31600
31183
|
}
|
|
31601
|
-
return await
|
|
31184
|
+
return await default4(iterable, { maxBuffer });
|
|
31602
31185
|
} catch (error2) {
|
|
31603
31186
|
return handleBufferedData(handleMaxBuffer({
|
|
31604
31187
|
error: error2,
|
|
@@ -31616,7 +31199,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
31616
31199
|
return handleBufferedData(error2);
|
|
31617
31200
|
}
|
|
31618
31201
|
}, handleBufferedData = ({ bufferedData }) => isArrayBuffer(bufferedData) ? new Uint8Array(bufferedData) : bufferedData;
|
|
31619
|
-
var
|
|
31202
|
+
var init_contents = __esm(() => {
|
|
31620
31203
|
init_source5();
|
|
31621
31204
|
init_uint_array();
|
|
31622
31205
|
init_output2();
|
|
@@ -31711,7 +31294,7 @@ var waitForStdioStreams = ({ subprocess, encoding, buffer: buffer2, maxBuffer, l
|
|
|
31711
31294
|
return output;
|
|
31712
31295
|
};
|
|
31713
31296
|
var init_stdio = __esm(() => {
|
|
31714
|
-
|
|
31297
|
+
init_contents();
|
|
31715
31298
|
init_wait_stream();
|
|
31716
31299
|
});
|
|
31717
31300
|
|
|
@@ -31921,7 +31504,7 @@ var init_wait_subprocess = __esm(() => {
|
|
|
31921
31504
|
init_graceful2();
|
|
31922
31505
|
init_standard_stream();
|
|
31923
31506
|
init_type();
|
|
31924
|
-
|
|
31507
|
+
init_contents();
|
|
31925
31508
|
init_buffer_messages();
|
|
31926
31509
|
init_ipc_input();
|
|
31927
31510
|
init_all_async();
|
|
@@ -32569,8 +32152,8 @@ var init_execa = __esm(() => {
|
|
|
32569
32152
|
});
|
|
32570
32153
|
|
|
32571
32154
|
// src/utils/dependencies.ts
|
|
32572
|
-
import { promises as
|
|
32573
|
-
import
|
|
32155
|
+
import { promises as fs6 } from "fs";
|
|
32156
|
+
import path9 from "path";
|
|
32574
32157
|
async function getPackageManager(targetDir) {
|
|
32575
32158
|
const packageManager = await detect2({ programmatic: true, cwd: targetDir });
|
|
32576
32159
|
if (packageManager === "yarn@berry")
|
|
@@ -32585,16 +32168,16 @@ async function getPackageManager(targetDir) {
|
|
|
32585
32168
|
}
|
|
32586
32169
|
async function hasPackageJson(targetDir) {
|
|
32587
32170
|
try {
|
|
32588
|
-
const packageJsonPath =
|
|
32589
|
-
await
|
|
32171
|
+
const packageJsonPath = path9.join(targetDir, "package.json");
|
|
32172
|
+
await fs6.access(packageJsonPath);
|
|
32590
32173
|
return true;
|
|
32591
32174
|
} catch {
|
|
32592
32175
|
return false;
|
|
32593
32176
|
}
|
|
32594
32177
|
}
|
|
32595
32178
|
async function readPackageJson(targetDir) {
|
|
32596
|
-
const packageJsonPath =
|
|
32597
|
-
const content = await
|
|
32179
|
+
const packageJsonPath = path9.join(targetDir, "package.json");
|
|
32180
|
+
const content = await fs6.readFile(packageJsonPath, "utf-8");
|
|
32598
32181
|
return JSON.parse(content);
|
|
32599
32182
|
}
|
|
32600
32183
|
async function getMissingDependenciesFor(targetDir, requiredDeps) {
|
|
@@ -32647,8 +32230,9 @@ __export(exports_generate, {
|
|
|
32647
32230
|
resolveContract: () => resolveContract,
|
|
32648
32231
|
generate: () => generate
|
|
32649
32232
|
});
|
|
32650
|
-
import
|
|
32651
|
-
import { toCamelCase as
|
|
32233
|
+
import path10 from "path";
|
|
32234
|
+
import { toCamelCase as toCamelCase7 } from "@secondlayer/stacks/clarity";
|
|
32235
|
+
import { getErrorMessage as getErrorMessage2 } from "@secondlayer/shared";
|
|
32652
32236
|
function isContractAddress(input4) {
|
|
32653
32237
|
const contractIdPattern = /^(SP|ST|SM|SN)[A-Z0-9]{38,}\.[a-zA-Z][a-zA-Z0-9-]*$/;
|
|
32654
32238
|
return contractIdPattern.test(input4);
|
|
@@ -32671,7 +32255,7 @@ async function parseInputs(inputs) {
|
|
|
32671
32255
|
continue;
|
|
32672
32256
|
}
|
|
32673
32257
|
if (input4.endsWith(".clar")) {
|
|
32674
|
-
const absolutePath =
|
|
32258
|
+
const absolutePath = path10.resolve(process.cwd(), input4);
|
|
32675
32259
|
files.push(absolutePath);
|
|
32676
32260
|
}
|
|
32677
32261
|
}
|
|
@@ -32681,7 +32265,7 @@ async function parseInputs(inputs) {
|
|
|
32681
32265
|
};
|
|
32682
32266
|
}
|
|
32683
32267
|
function deriveContractName(filePath) {
|
|
32684
|
-
const basename =
|
|
32268
|
+
const basename = path10.basename(filePath, ".clar");
|
|
32685
32269
|
return basename.replace(/[-_](.)/g, (_2, char) => char.toUpperCase()).replace(/^(.)/, (_2, char) => char.toLowerCase()).replace(/^\d/, "_$&");
|
|
32686
32270
|
}
|
|
32687
32271
|
async function buildConfigFromInputs(parsedInputs, outPath, apiKey, defaultAddress) {
|
|
@@ -32709,7 +32293,7 @@ async function buildConfigFromInputs(parsedInputs, outPath, apiKey, defaultAddre
|
|
|
32709
32293
|
const apiClient = new StacksApiClient(network, apiKey);
|
|
32710
32294
|
const contractInfo = await apiClient.getContractInfo(contractId);
|
|
32711
32295
|
const abi = parseApiResponse(contractInfo);
|
|
32712
|
-
const name =
|
|
32296
|
+
const name = toCamelCase7(contractName);
|
|
32713
32297
|
contracts.push({
|
|
32714
32298
|
name,
|
|
32715
32299
|
address: contractId,
|
|
@@ -32717,7 +32301,7 @@ async function buildConfigFromInputs(parsedInputs, outPath, apiKey, defaultAddre
|
|
|
32717
32301
|
_directFile: true
|
|
32718
32302
|
});
|
|
32719
32303
|
} catch (error2) {
|
|
32720
|
-
throw new Error(`Failed to fetch contract ${contractId}: ${error2
|
|
32304
|
+
throw new Error(`Failed to fetch contract ${contractId}: ${getErrorMessage2(error2)}`);
|
|
32721
32305
|
}
|
|
32722
32306
|
}
|
|
32723
32307
|
return {
|
|
@@ -32799,8 +32383,8 @@ To get started:`);
|
|
|
32799
32383
|
} catch (error2) {
|
|
32800
32384
|
console.error(source_default3.red("✗ Generation failed"));
|
|
32801
32385
|
console.error(source_default3.red(`
|
|
32802
|
-
${error2
|
|
32803
|
-
if (process.env.DEBUG) {
|
|
32386
|
+
${getErrorMessage2(error2)}`));
|
|
32387
|
+
if (process.env.DEBUG && error2 instanceof Error) {
|
|
32804
32388
|
console.error(error2.stack);
|
|
32805
32389
|
}
|
|
32806
32390
|
process.exit(1);
|
|
@@ -32808,9 +32392,9 @@ ${error2.message}`));
|
|
|
32808
32392
|
}
|
|
32809
32393
|
async function resolveContract(source, network, apiKey, apiUrl) {
|
|
32810
32394
|
if (source.source) {
|
|
32811
|
-
const filePath =
|
|
32395
|
+
const filePath = path10.resolve(process.cwd(), source.source);
|
|
32812
32396
|
const abi = await parseClarityFile(filePath);
|
|
32813
|
-
const name = source.name ||
|
|
32397
|
+
const name = source.name || path10.basename(source.source, ".clar").replace(/-/g, "_").replace(/^\d/, "_$&");
|
|
32814
32398
|
const address = typeof source.address === "string" ? source.address : source.address?.[network] || DEFAULT_DEVNET_ADDRESS;
|
|
32815
32399
|
const { address: contractAddress, contractName } = address.includes(".") ? parseContractId(address) : { address, contractName: name };
|
|
32816
32400
|
return {
|
|
@@ -32867,7 +32451,7 @@ async function resolveContracts(source, defaultNetwork, apiKey, apiUrl) {
|
|
|
32867
32451
|
source: "api"
|
|
32868
32452
|
});
|
|
32869
32453
|
} catch (error2) {
|
|
32870
|
-
console.warn(`Warning: Failed to resolve contract for ${network}: ${error2
|
|
32454
|
+
console.warn(`Warning: Failed to resolve contract for ${network}: ${getErrorMessage2(error2)}`);
|
|
32871
32455
|
}
|
|
32872
32456
|
}
|
|
32873
32457
|
return resolvedContracts;
|
|
@@ -32891,12 +32475,12 @@ var exports_init = {};
|
|
|
32891
32475
|
__export(exports_init, {
|
|
32892
32476
|
init: () => init2
|
|
32893
32477
|
});
|
|
32894
|
-
import { promises as
|
|
32895
|
-
import
|
|
32478
|
+
import { promises as fs7 } from "fs";
|
|
32479
|
+
import path11 from "path";
|
|
32896
32480
|
async function init2() {
|
|
32897
|
-
const configPath =
|
|
32481
|
+
const configPath = path11.join(process.cwd(), "secondlayer.config.ts");
|
|
32898
32482
|
try {
|
|
32899
|
-
await
|
|
32483
|
+
await fs7.access(configPath);
|
|
32900
32484
|
console.log(source_default3.yellow("⚠ secondlayer.config.ts already exists"));
|
|
32901
32485
|
return;
|
|
32902
32486
|
} catch {}
|
|
@@ -32920,13 +32504,13 @@ export default defineConfig({
|
|
|
32920
32504
|
plugins: [],
|
|
32921
32505
|
});`;
|
|
32922
32506
|
}
|
|
32923
|
-
await
|
|
32507
|
+
await fs7.writeFile(configPath, config);
|
|
32924
32508
|
console.log(source_default3.green("✓ Created `secondlayer.config.ts`"));
|
|
32925
32509
|
console.log("\nRun `secondlayer generate` to generate type-safe interfaces, functions, and hooks!");
|
|
32926
32510
|
}
|
|
32927
32511
|
async function fileExists2(filePath) {
|
|
32928
32512
|
try {
|
|
32929
|
-
await
|
|
32513
|
+
await fs7.access(filePath);
|
|
32930
32514
|
return true;
|
|
32931
32515
|
} catch {
|
|
32932
32516
|
return false;
|
|
@@ -32954,8 +32538,8 @@ var {
|
|
|
32954
32538
|
// package.json
|
|
32955
32539
|
var package_default = {
|
|
32956
32540
|
name: "@secondlayer/cli",
|
|
32957
|
-
version: "1.
|
|
32958
|
-
description: "CLI for streams,
|
|
32541
|
+
version: "1.6.0",
|
|
32542
|
+
description: "CLI for streams, subgraphs, and real-time blockchain indexing on Stacks",
|
|
32959
32543
|
type: "module",
|
|
32960
32544
|
bin: {
|
|
32961
32545
|
secondlayer: "./dist/cli.js",
|
|
@@ -32995,10 +32579,10 @@ var package_default = {
|
|
|
32995
32579
|
license: "MIT",
|
|
32996
32580
|
dependencies: {
|
|
32997
32581
|
"@inquirer/prompts": "^8.2.0",
|
|
32998
|
-
"@secondlayer/sdk": "^0.
|
|
32999
|
-
"@secondlayer/shared": "^0.
|
|
33000
|
-
"@secondlayer/stacks": "^0.
|
|
33001
|
-
"@secondlayer/
|
|
32582
|
+
"@secondlayer/sdk": "^0.6.0",
|
|
32583
|
+
"@secondlayer/shared": "^0.5.0",
|
|
32584
|
+
"@secondlayer/stacks": "^0.2.0",
|
|
32585
|
+
"@secondlayer/subgraphs": "^0.5.0",
|
|
33002
32586
|
"@biomejs/js-api": "^0.7.0",
|
|
33003
32587
|
"@biomejs/wasm-nodejs": "^1.9.0",
|
|
33004
32588
|
esbuild: "^0.19.0",
|
|
@@ -33387,6 +32971,7 @@ async function validateDatabaseConnection(url) {
|
|
|
33387
32971
|
}
|
|
33388
32972
|
// src/commands/setup.ts
|
|
33389
32973
|
init_output();
|
|
32974
|
+
init_api_client();
|
|
33390
32975
|
import { select as select2, input, confirm } from "@inquirer/prompts";
|
|
33391
32976
|
init_config();
|
|
33392
32977
|
var STREAMS_DIR = "streams";
|
|
@@ -33639,13 +33224,10 @@ async function hostedLogin(config) {
|
|
|
33639
33224
|
headers: { "Content-Type": "application/json" },
|
|
33640
33225
|
body: JSON.stringify({ email })
|
|
33641
33226
|
});
|
|
33642
|
-
|
|
33643
|
-
|
|
33644
|
-
|
|
33645
|
-
|
|
33646
|
-
msg = JSON.parse(body).error || msg;
|
|
33647
|
-
} catch {}
|
|
33648
|
-
error(`Failed to send magic link: ${msg}`);
|
|
33227
|
+
try {
|
|
33228
|
+
await assertOk(mlRes);
|
|
33229
|
+
} catch (e) {
|
|
33230
|
+
error(`Failed to send magic link: ${e instanceof Error ? e.message : e}`);
|
|
33649
33231
|
return false;
|
|
33650
33232
|
}
|
|
33651
33233
|
info("Check your email for a login token.");
|
|
@@ -33658,18 +33240,41 @@ async function hostedLogin(config) {
|
|
|
33658
33240
|
headers: { "Content-Type": "application/json" },
|
|
33659
33241
|
body: JSON.stringify({ token: token.trim() })
|
|
33660
33242
|
});
|
|
33661
|
-
|
|
33662
|
-
|
|
33663
|
-
|
|
33664
|
-
|
|
33665
|
-
msg = JSON.parse(body).error || msg;
|
|
33666
|
-
} catch {}
|
|
33667
|
-
error(`Verification failed: ${msg}`);
|
|
33243
|
+
try {
|
|
33244
|
+
await assertOk(verifyRes);
|
|
33245
|
+
} catch (e) {
|
|
33246
|
+
error(`Verification failed: ${e instanceof Error ? e.message : e}`);
|
|
33668
33247
|
return false;
|
|
33669
33248
|
}
|
|
33670
33249
|
const result = await verifyRes.json();
|
|
33671
|
-
|
|
33250
|
+
const { hostname } = await import("node:os");
|
|
33251
|
+
const sessionHeaders = { Authorization: `Bearer ${result.sessionToken}`, "Content-Type": "application/json" };
|
|
33252
|
+
const keyName = `cli-${hostname().toLowerCase()}`;
|
|
33253
|
+
const listRes = await fetch(`${apiUrl}/api/keys`, { headers: sessionHeaders });
|
|
33254
|
+
if (listRes.ok) {
|
|
33255
|
+
const { keys } = await listRes.json();
|
|
33256
|
+
const existing = keys.find((k) => k.name === keyName && k.status === "active");
|
|
33257
|
+
if (existing) {
|
|
33258
|
+
await fetch(`${apiUrl}/api/keys/${existing.id}`, { method: "DELETE", headers: sessionHeaders });
|
|
33259
|
+
}
|
|
33260
|
+
}
|
|
33261
|
+
const createRes = await fetch(`${apiUrl}/api/keys`, {
|
|
33262
|
+
method: "POST",
|
|
33263
|
+
headers: sessionHeaders,
|
|
33264
|
+
body: JSON.stringify({ name: keyName })
|
|
33265
|
+
});
|
|
33266
|
+
try {
|
|
33267
|
+
await assertOk(createRes);
|
|
33268
|
+
} catch (e) {
|
|
33269
|
+
error(`Failed to create API key: ${e instanceof Error ? e.message : e}`);
|
|
33270
|
+
return false;
|
|
33271
|
+
}
|
|
33272
|
+
const { key } = await createRes.json();
|
|
33273
|
+
config.apiKey = key;
|
|
33672
33274
|
await saveConfig(config);
|
|
33275
|
+
try {
|
|
33276
|
+
await fetch(`${apiUrl}/api/auth/logout`, { method: "POST", headers: sessionHeaders });
|
|
33277
|
+
} catch {}
|
|
33673
33278
|
const account = result.account;
|
|
33674
33279
|
console.log();
|
|
33675
33280
|
success(`Authenticated as ${account.email}!`);
|
|
@@ -34556,11 +34161,11 @@ function printStatus(status) {
|
|
|
34556
34161
|
[" Error", status.streams.error > 0 ? red(status.streams.error.toString()) : "0"]
|
|
34557
34162
|
]));
|
|
34558
34163
|
console.log("");
|
|
34559
|
-
if (status.
|
|
34164
|
+
if (status.activeSubgraphs !== undefined || status.recentDeliveries !== undefined) {
|
|
34560
34165
|
console.log(blue("Activity"));
|
|
34561
34166
|
const pairs = [];
|
|
34562
|
-
if (status.
|
|
34563
|
-
pairs.push([" Active
|
|
34167
|
+
if (status.activeSubgraphs !== undefined)
|
|
34168
|
+
pairs.push([" Active Subgraphs", status.activeSubgraphs.toString()]);
|
|
34564
34169
|
if (status.recentDeliveries !== undefined)
|
|
34565
34170
|
pairs.push([" Deliveries (24h)", status.recentDeliveries.toString()]);
|
|
34566
34171
|
console.log(formatKeyValue(pairs));
|
|
@@ -35444,21 +35049,21 @@ async function generatePackageJson(dir, name) {
|
|
|
35444
35049
|
await Bun.write(join5(dir, "package.json"), JSON.stringify(content, null, 2) + `
|
|
35445
35050
|
`);
|
|
35446
35051
|
}
|
|
35447
|
-
// src/commands/
|
|
35052
|
+
// src/commands/subgraphs.ts
|
|
35448
35053
|
init_output();
|
|
35449
35054
|
import { resolve } from "node:path";
|
|
35450
35055
|
import { existsSync, mkdirSync, watch } from "node:fs";
|
|
35451
35056
|
|
|
35452
|
-
// src/templates/
|
|
35453
|
-
function
|
|
35454
|
-
return `import {
|
|
35057
|
+
// src/templates/subgraph.ts
|
|
35058
|
+
function generateSubgraphTemplate(name) {
|
|
35059
|
+
return `import { defineSubgraph } from "@secondlayer/subgraphs";
|
|
35455
35060
|
|
|
35456
|
-
export default
|
|
35061
|
+
export default defineSubgraph({
|
|
35457
35062
|
name: "${name}",
|
|
35458
35063
|
version: "1.0.0",
|
|
35459
|
-
description: "TODO: describe what this
|
|
35064
|
+
description: "TODO: describe what this subgraph tracks",
|
|
35460
35065
|
|
|
35461
|
-
// Sources define what blockchain data this
|
|
35066
|
+
// Sources define what blockchain data this subgraph processes.
|
|
35462
35067
|
// Each source filters transactions/events by contract, type, function, or event.
|
|
35463
35068
|
// Examples:
|
|
35464
35069
|
// { contract: "SP000...::my-contract" } — all txs to a contract
|
|
@@ -35469,7 +35074,7 @@ export default defineView({
|
|
|
35469
35074
|
{ contract: "SP000000000000000000002Q6VF78.pox-4" },
|
|
35470
35075
|
],
|
|
35471
35076
|
|
|
35472
|
-
// Schema defines the tables this
|
|
35077
|
+
// Schema defines the tables this subgraph creates.
|
|
35473
35078
|
// Each table gets auto-columns: _id, _block_height, _tx_id, _created_at.
|
|
35474
35079
|
// Column types: text, uint, int, principal, boolean, timestamp, jsonb
|
|
35475
35080
|
schema: {
|
|
@@ -35500,22 +35105,22 @@ export default defineView({
|
|
|
35500
35105
|
`;
|
|
35501
35106
|
}
|
|
35502
35107
|
|
|
35503
|
-
// src/commands/
|
|
35108
|
+
// src/commands/subgraphs.ts
|
|
35504
35109
|
init_api_client();
|
|
35505
35110
|
init_config();
|
|
35506
35111
|
init_fs();
|
|
35507
35112
|
|
|
35508
|
-
// src/generators/
|
|
35113
|
+
// src/generators/subgraph-scaffold.ts
|
|
35509
35114
|
init_format();
|
|
35510
35115
|
|
|
35511
|
-
// src/generators/clarity-to-
|
|
35116
|
+
// src/generators/clarity-to-subgraph.ts
|
|
35512
35117
|
import {
|
|
35513
35118
|
isAbiBuffer,
|
|
35514
35119
|
isAbiStringAscii,
|
|
35515
35120
|
isAbiStringUtf8,
|
|
35516
35121
|
isAbiOptional
|
|
35517
35122
|
} from "@secondlayer/stacks/clarity";
|
|
35518
|
-
function
|
|
35123
|
+
function clarityTypeToSubgraphColumn(abiType) {
|
|
35519
35124
|
return mapType(abiType, false);
|
|
35520
35125
|
}
|
|
35521
35126
|
function mapType(abiType, nullable) {
|
|
@@ -35555,19 +35160,19 @@ function mapType(abiType, nullable) {
|
|
|
35555
35160
|
return { type: "jsonb", nullable };
|
|
35556
35161
|
}
|
|
35557
35162
|
|
|
35558
|
-
// src/generators/
|
|
35559
|
-
async function
|
|
35163
|
+
// src/generators/subgraph-scaffold.ts
|
|
35164
|
+
async function generateSubgraphScaffold(input2) {
|
|
35560
35165
|
const { contractId, functions } = input2;
|
|
35561
35166
|
const contractParts = contractId.split(".");
|
|
35562
35167
|
const contractName = contractParts[contractParts.length - 1] ?? contractId;
|
|
35563
|
-
const
|
|
35168
|
+
const subgraphName = input2.subgraphName ?? contractName;
|
|
35564
35169
|
const publicFunctions = functions.filter((f) => f.access === "public");
|
|
35565
35170
|
if (publicFunctions.length === 0) {
|
|
35566
35171
|
throw new Error(`No public functions found in ${contractId}`);
|
|
35567
35172
|
}
|
|
35568
35173
|
const tables = publicFunctions.map((fn) => {
|
|
35569
35174
|
const columns = fn.args.map((arg) => {
|
|
35570
|
-
const mapped =
|
|
35175
|
+
const mapped = clarityTypeToSubgraphColumn(arg.type);
|
|
35571
35176
|
const nullable = mapped.nullable ? ", nullable: true" : "";
|
|
35572
35177
|
return ` ${arg.name.replace(/-/g, "_")}: { type: '${mapped.type}'${nullable} }`;
|
|
35573
35178
|
}).join(`,
|
|
@@ -35592,10 +35197,10 @@ ${columns || " _placeholder: { type: 'text' }"}
|
|
|
35592
35197
|
|
|
35593
35198
|
`);
|
|
35594
35199
|
const code = `
|
|
35595
|
-
import {
|
|
35200
|
+
import { defineSubgraph } from '@secondlayer/subgraphs';
|
|
35596
35201
|
|
|
35597
|
-
export default
|
|
35598
|
-
name: '${
|
|
35202
|
+
export default defineSubgraph({
|
|
35203
|
+
name: '${subgraphName}',
|
|
35599
35204
|
sources: [{ contract: '${contractId}' }],
|
|
35600
35205
|
schema: {
|
|
35601
35206
|
${schemaBlock}
|
|
@@ -35608,14 +35213,25 @@ ${handlersBlock}
|
|
|
35608
35213
|
return formatCode(code);
|
|
35609
35214
|
}
|
|
35610
35215
|
|
|
35611
|
-
// src/generators/
|
|
35216
|
+
// src/generators/subgraphs.ts
|
|
35612
35217
|
init_format();
|
|
35613
|
-
|
|
35218
|
+
|
|
35219
|
+
// src/utils/case-conversion.ts
|
|
35220
|
+
import { toCamelCase } from "@secondlayer/stacks/clarity";
|
|
35221
|
+
function capitalize(str) {
|
|
35222
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
35223
|
+
}
|
|
35224
|
+
function toPascalCase(str) {
|
|
35225
|
+
return capitalize(toCamelCase(str));
|
|
35226
|
+
}
|
|
35227
|
+
|
|
35228
|
+
// src/generators/subgraphs.ts
|
|
35229
|
+
async function generateSubgraphConsumer(subgraphName, detail) {
|
|
35614
35230
|
const tables = Object.entries(detail.tables);
|
|
35615
35231
|
const rowInterfaces = tables.map(([tableName, tableDef]) => {
|
|
35616
35232
|
const typeName = toPascalCase(tableName) + "Row";
|
|
35617
35233
|
const fields = Object.entries(tableDef.columns).map(([colName, colMeta]) => {
|
|
35618
|
-
const tsType =
|
|
35234
|
+
const tsType = subgraphTypeToTS(colMeta.type);
|
|
35619
35235
|
const optional = colMeta.nullable ? "?" : "";
|
|
35620
35236
|
return ` ${colName}${optional}: ${tsType};`;
|
|
35621
35237
|
}).join(`
|
|
@@ -35640,32 +35256,29 @@ ${cols}
|
|
|
35640
35256
|
`);
|
|
35641
35257
|
const code = `
|
|
35642
35258
|
// Auto-generated by secondlayer. Do not edit.
|
|
35643
|
-
import {
|
|
35644
|
-
import type {
|
|
35259
|
+
import { getSubgraph } from '@secondlayer/sdk';
|
|
35260
|
+
import type { InferSubgraphClient } from '@secondlayer/subgraphs';
|
|
35645
35261
|
|
|
35646
35262
|
${rowInterfaces.join(`
|
|
35647
35263
|
|
|
35648
35264
|
`)}
|
|
35649
35265
|
|
|
35650
35266
|
const _schema = {
|
|
35651
|
-
name: '${
|
|
35267
|
+
name: '${subgraphName}',
|
|
35652
35268
|
schema: {
|
|
35653
35269
|
${schemaBlock}
|
|
35654
35270
|
}
|
|
35655
35271
|
} as const;
|
|
35656
35272
|
|
|
35657
|
-
export type Client =
|
|
35273
|
+
export type Client = InferSubgraphClient<typeof _schema>;
|
|
35658
35274
|
|
|
35659
35275
|
export function createClient(options?: { apiKey?: string; baseUrl?: string }): Client {
|
|
35660
|
-
return
|
|
35276
|
+
return getSubgraph(_schema, options ?? {});
|
|
35661
35277
|
}
|
|
35662
35278
|
`.trimStart();
|
|
35663
35279
|
return formatCode(code);
|
|
35664
35280
|
}
|
|
35665
|
-
function
|
|
35666
|
-
return str.split(/[-_]/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
35667
|
-
}
|
|
35668
|
-
function viewTypeToTS(type) {
|
|
35281
|
+
function subgraphTypeToTS(type) {
|
|
35669
35282
|
switch (type) {
|
|
35670
35283
|
case "uint":
|
|
35671
35284
|
case "int":
|
|
@@ -35685,13 +35298,13 @@ function viewTypeToTS(type) {
|
|
|
35685
35298
|
}
|
|
35686
35299
|
}
|
|
35687
35300
|
|
|
35688
|
-
// src/commands/
|
|
35301
|
+
// src/commands/subgraphs.ts
|
|
35689
35302
|
init_api();
|
|
35690
35303
|
init_clarity();
|
|
35691
|
-
function
|
|
35692
|
-
const
|
|
35693
|
-
|
|
35694
|
-
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");
|
|
35695
35308
|
const filePath = resolve(dir, `${name}.ts`);
|
|
35696
35309
|
if (existsSync(filePath)) {
|
|
35697
35310
|
error(`File already exists: ${filePath}`);
|
|
@@ -35700,12 +35313,12 @@ function registerViewsCommand(program2) {
|
|
|
35700
35313
|
if (!existsSync(dir)) {
|
|
35701
35314
|
mkdirSync(dir, { recursive: true });
|
|
35702
35315
|
}
|
|
35703
|
-
const content =
|
|
35316
|
+
const content = generateSubgraphTemplate(name);
|
|
35704
35317
|
await writeTextFile(filePath, content);
|
|
35705
35318
|
success(`Created ${filePath}`);
|
|
35706
|
-
info(`Next: sl
|
|
35319
|
+
info(`Next: sl subgraphs deploy subgraphs/${name}.ts`);
|
|
35707
35320
|
});
|
|
35708
|
-
|
|
35321
|
+
subgraphs.command("dev <file>").description("Watch a subgraph file and auto-redeploy on change").action(async (file) => {
|
|
35709
35322
|
await requireLocalNetwork();
|
|
35710
35323
|
const absPath = resolve(file);
|
|
35711
35324
|
if (!existsSync(absPath)) {
|
|
@@ -35715,27 +35328,27 @@ function registerViewsCommand(program2) {
|
|
|
35715
35328
|
info(`Watching ${absPath} for changes...`);
|
|
35716
35329
|
info(`Press Ctrl+C to stop
|
|
35717
35330
|
`);
|
|
35718
|
-
const
|
|
35331
|
+
const deploySubgraph = async () => {
|
|
35719
35332
|
try {
|
|
35720
35333
|
delete __require.cache[absPath];
|
|
35721
35334
|
const mod = await import(`${absPath}?t=${Date.now()}`);
|
|
35722
35335
|
const def = mod.default ?? mod;
|
|
35723
|
-
const {
|
|
35724
|
-
const { deploySchema } = await import("@secondlayer/
|
|
35336
|
+
const { validateSubgraphDefinition } = await import("@secondlayer/subgraphs/validate");
|
|
35337
|
+
const { deploySchema } = await import("@secondlayer/subgraphs");
|
|
35725
35338
|
const { getDb: getDb3 } = await import("@secondlayer/shared/db");
|
|
35726
|
-
|
|
35339
|
+
validateSubgraphDefinition(def);
|
|
35727
35340
|
const db = getDb3();
|
|
35728
35341
|
const result = await deploySchema(db, def, absPath, { forceReindex: false });
|
|
35729
35342
|
if (result.action === "unchanged") {
|
|
35730
35343
|
info(`[${new Date().toLocaleTimeString()}] No schema changes`);
|
|
35731
35344
|
} else if (result.action === "created") {
|
|
35732
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35345
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" created`);
|
|
35733
35346
|
} else if (result.action === "updated") {
|
|
35734
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35347
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" updated (additive)`);
|
|
35735
35348
|
} else if (result.action === "reindexed") {
|
|
35736
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35349
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" reindexed (breaking schema change)`);
|
|
35737
35350
|
} else {
|
|
35738
|
-
success(`[${new Date().toLocaleTimeString()}]
|
|
35351
|
+
success(`[${new Date().toLocaleTimeString()}] Subgraph "${def.name}" deployed (${result.action})`);
|
|
35739
35352
|
}
|
|
35740
35353
|
const handlerKeys = Object.keys(def.handlers);
|
|
35741
35354
|
info(` Handlers: ${handlerKeys.join(", ")}`);
|
|
@@ -35743,7 +35356,7 @@ function registerViewsCommand(program2) {
|
|
|
35743
35356
|
error(`[${new Date().toLocaleTimeString()}] ${err}`);
|
|
35744
35357
|
}
|
|
35745
35358
|
};
|
|
35746
|
-
await
|
|
35359
|
+
await deploySubgraph();
|
|
35747
35360
|
let timeout = null;
|
|
35748
35361
|
const watcher = watch(absPath, () => {
|
|
35749
35362
|
if (timeout)
|
|
@@ -35751,7 +35364,7 @@ function registerViewsCommand(program2) {
|
|
|
35751
35364
|
timeout = setTimeout(async () => {
|
|
35752
35365
|
console.log("");
|
|
35753
35366
|
info("File changed, redeploying...");
|
|
35754
|
-
await
|
|
35367
|
+
await deploySubgraph();
|
|
35755
35368
|
}, 300);
|
|
35756
35369
|
});
|
|
35757
35370
|
process.on("SIGINT", () => {
|
|
@@ -35764,15 +35377,15 @@ Stopped watching.`);
|
|
|
35764
35377
|
});
|
|
35765
35378
|
await new Promise(() => {});
|
|
35766
35379
|
});
|
|
35767
|
-
|
|
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) => {
|
|
35768
35381
|
try {
|
|
35769
35382
|
const absPath = resolve(file);
|
|
35770
35383
|
const config = await loadConfig();
|
|
35771
|
-
info(`Loading
|
|
35384
|
+
info(`Loading subgraph from ${absPath}`);
|
|
35772
35385
|
const mod = await import(absPath);
|
|
35773
35386
|
const def = mod.default ?? mod;
|
|
35774
|
-
const {
|
|
35775
|
-
|
|
35387
|
+
const { validateSubgraphDefinition } = await import("@secondlayer/subgraphs/validate");
|
|
35388
|
+
validateSubgraphDefinition(def);
|
|
35776
35389
|
if (config.network !== "local") {
|
|
35777
35390
|
info(`Bundling for remote deploy (${config.network})...`);
|
|
35778
35391
|
const esbuild = await import("esbuild");
|
|
@@ -35781,11 +35394,11 @@ Stopped watching.`);
|
|
|
35781
35394
|
bundle: true,
|
|
35782
35395
|
platform: "node",
|
|
35783
35396
|
format: "esm",
|
|
35784
|
-
external: ["@secondlayer/
|
|
35397
|
+
external: ["@secondlayer/subgraphs"],
|
|
35785
35398
|
write: false
|
|
35786
35399
|
});
|
|
35787
35400
|
const handlerCode = new TextDecoder().decode(buildResult.outputFiles[0].contents);
|
|
35788
|
-
const result = await
|
|
35401
|
+
const result = await deploySubgraphApi({
|
|
35789
35402
|
name: def.name,
|
|
35790
35403
|
version: def.version,
|
|
35791
35404
|
description: def.description,
|
|
@@ -35795,41 +35408,41 @@ Stopped watching.`);
|
|
|
35795
35408
|
reindex: options2.reindex
|
|
35796
35409
|
});
|
|
35797
35410
|
if (result.action === "unchanged") {
|
|
35798
|
-
info(`
|
|
35411
|
+
info(`Subgraph "${def.name}" is up to date (no schema changes)`);
|
|
35799
35412
|
} else {
|
|
35800
|
-
success(`
|
|
35413
|
+
success(`Subgraph "${def.name}" ${result.action} (remote)`);
|
|
35801
35414
|
}
|
|
35802
35415
|
} else {
|
|
35803
|
-
const { deploySchema } = await import("@secondlayer/
|
|
35416
|
+
const { deploySchema } = await import("@secondlayer/subgraphs");
|
|
35804
35417
|
const { getDb: getDb3, closeDb } = await import("@secondlayer/shared/db");
|
|
35805
35418
|
const db = getDb3();
|
|
35806
35419
|
const result = await deploySchema(db, def, absPath, { forceReindex: options2.reindex });
|
|
35807
35420
|
if (result.action === "unchanged") {
|
|
35808
|
-
info(`
|
|
35421
|
+
info(`Subgraph "${def.name}" is up to date (no schema changes)`);
|
|
35809
35422
|
} else if (result.action === "created") {
|
|
35810
|
-
success(`
|
|
35423
|
+
success(`Subgraph "${def.name}" created (id: ${result.subgraphId.slice(0, 8)})`);
|
|
35811
35424
|
} else if (result.action === "reindexed") {
|
|
35812
|
-
success(`
|
|
35813
|
-
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.`);
|
|
35814
35427
|
} else {
|
|
35815
|
-
success(`
|
|
35428
|
+
success(`Subgraph "${def.name}" updated (id: ${result.subgraphId.slice(0, 8)})`);
|
|
35816
35429
|
}
|
|
35817
35430
|
await closeDb();
|
|
35818
35431
|
}
|
|
35819
35432
|
} catch (err) {
|
|
35820
|
-
error(`Failed to deploy
|
|
35433
|
+
error(`Failed to deploy subgraph: ${err}`);
|
|
35821
35434
|
process.exit(1);
|
|
35822
35435
|
}
|
|
35823
35436
|
});
|
|
35824
|
-
|
|
35437
|
+
subgraphs.command("list").alias("ls").description("List all deployed subgraphs").option("--json", "Output as JSON").action(async (options2) => {
|
|
35825
35438
|
try {
|
|
35826
|
-
const { data } = await
|
|
35439
|
+
const { data } = await listSubgraphsApi();
|
|
35827
35440
|
if (options2.json) {
|
|
35828
35441
|
console.log(JSON.stringify(data, null, 2));
|
|
35829
35442
|
return;
|
|
35830
35443
|
}
|
|
35831
35444
|
if (data.length === 0) {
|
|
35832
|
-
console.log("No
|
|
35445
|
+
console.log("No subgraphs deployed");
|
|
35833
35446
|
return;
|
|
35834
35447
|
}
|
|
35835
35448
|
const tableRows = data.map((v) => {
|
|
@@ -35844,31 +35457,31 @@ Stopped watching.`);
|
|
|
35844
35457
|
});
|
|
35845
35458
|
console.log(formatTable(["Name", "Version", "Status", "Last Block", "Tables"], tableRows));
|
|
35846
35459
|
console.log(dim(`
|
|
35847
|
-
${data.length}
|
|
35460
|
+
${data.length} subgraph(s) total`));
|
|
35848
35461
|
} catch (err) {
|
|
35849
|
-
handleApiError(err, "list
|
|
35462
|
+
handleApiError(err, "list subgraphs");
|
|
35850
35463
|
}
|
|
35851
35464
|
});
|
|
35852
|
-
|
|
35465
|
+
subgraphs.command("status <name>").description("Show detailed subgraph status").action(async (name) => {
|
|
35853
35466
|
try {
|
|
35854
|
-
const
|
|
35855
|
-
const rowCounts = Object.entries(
|
|
35856
|
-
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";
|
|
35857
35470
|
console.log(formatKeyValue([
|
|
35858
|
-
["Name",
|
|
35859
|
-
["Version",
|
|
35860
|
-
["Status",
|
|
35861
|
-
["Last Block", String(
|
|
35471
|
+
["Name", subgraph.name],
|
|
35472
|
+
["Version", subgraph.version],
|
|
35473
|
+
["Status", subgraph.status],
|
|
35474
|
+
["Last Block", String(subgraph.lastProcessedBlock)],
|
|
35862
35475
|
["Row Count", rowCounts],
|
|
35863
|
-
["Total Processed", String(
|
|
35864
|
-
["Total Errors", String(
|
|
35476
|
+
["Total Processed", String(subgraph.health.totalProcessed)],
|
|
35477
|
+
["Total Errors", String(subgraph.health.totalErrors)],
|
|
35865
35478
|
["Error Rate", errorRate],
|
|
35866
|
-
["Last Error",
|
|
35867
|
-
["Last Error At",
|
|
35868
|
-
["Created",
|
|
35869
|
-
["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]
|
|
35870
35483
|
]));
|
|
35871
|
-
const tableEntries = Object.entries(
|
|
35484
|
+
const tableEntries = Object.entries(subgraph.tables);
|
|
35872
35485
|
if (tableEntries.length > 0) {
|
|
35873
35486
|
console.log(dim(`
|
|
35874
35487
|
Table endpoints:`));
|
|
@@ -35877,23 +35490,23 @@ Table endpoints:`));
|
|
|
35877
35490
|
}
|
|
35878
35491
|
}
|
|
35879
35492
|
} catch (err) {
|
|
35880
|
-
handleApiError(err, "get
|
|
35493
|
+
handleApiError(err, "get subgraph status");
|
|
35881
35494
|
}
|
|
35882
35495
|
});
|
|
35883
|
-
|
|
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) => {
|
|
35884
35497
|
try {
|
|
35885
|
-
info(`Reindexing
|
|
35886
|
-
const result = await
|
|
35498
|
+
info(`Reindexing subgraph "${name}"...`);
|
|
35499
|
+
const result = await reindexSubgraphApi(name, {
|
|
35887
35500
|
fromBlock: options2.from ? parseInt(options2.from, 10) : undefined,
|
|
35888
35501
|
toBlock: options2.to ? parseInt(options2.to, 10) : undefined
|
|
35889
35502
|
});
|
|
35890
35503
|
success(result.message);
|
|
35891
35504
|
info(`From block ${result.fromBlock} to ${result.toBlock}`);
|
|
35892
35505
|
} catch (err) {
|
|
35893
|
-
handleApiError(err, "reindex
|
|
35506
|
+
handleApiError(err, "reindex subgraph");
|
|
35894
35507
|
}
|
|
35895
35508
|
});
|
|
35896
|
-
|
|
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) => {
|
|
35897
35510
|
try {
|
|
35898
35511
|
const filters = {};
|
|
35899
35512
|
if (options2.filter) {
|
|
@@ -35915,7 +35528,7 @@ Table endpoints:`));
|
|
|
35915
35528
|
filters: Object.keys(filters).length > 0 ? filters : undefined
|
|
35916
35529
|
};
|
|
35917
35530
|
if (options2.count) {
|
|
35918
|
-
const result = await
|
|
35531
|
+
const result = await querySubgraphTableCount(name, table, params);
|
|
35919
35532
|
if (options2.json) {
|
|
35920
35533
|
console.log(JSON.stringify(result, null, 2));
|
|
35921
35534
|
} else {
|
|
@@ -35923,7 +35536,7 @@ Table endpoints:`));
|
|
|
35923
35536
|
}
|
|
35924
35537
|
return;
|
|
35925
35538
|
}
|
|
35926
|
-
const rows = await
|
|
35539
|
+
const rows = await querySubgraphTable(name, table, params);
|
|
35927
35540
|
if (options2.json) {
|
|
35928
35541
|
console.log(JSON.stringify(rows, null, 2));
|
|
35929
35542
|
return;
|
|
@@ -35945,28 +35558,28 @@ Table endpoints:`));
|
|
|
35945
35558
|
console.log(dim(`
|
|
35946
35559
|
${rows.length} row(s)`));
|
|
35947
35560
|
} catch (err) {
|
|
35948
|
-
handleApiError(err, "query
|
|
35561
|
+
handleApiError(err, "query subgraph");
|
|
35949
35562
|
}
|
|
35950
35563
|
});
|
|
35951
|
-
|
|
35564
|
+
subgraphs.command("delete <name>").description("Delete a subgraph and its data").option("-y, --yes", "Skip confirmation").action(async (name, options2) => {
|
|
35952
35565
|
try {
|
|
35953
35566
|
if (!options2.yes) {
|
|
35954
35567
|
const { confirm: confirm6 } = await import("@inquirer/prompts");
|
|
35955
35568
|
const ok = await confirm6({
|
|
35956
|
-
message: `Delete
|
|
35569
|
+
message: `Delete subgraph "${name}" and all its data? This cannot be undone.`
|
|
35957
35570
|
});
|
|
35958
35571
|
if (!ok) {
|
|
35959
35572
|
info("Cancelled");
|
|
35960
35573
|
return;
|
|
35961
35574
|
}
|
|
35962
35575
|
}
|
|
35963
|
-
const result = await
|
|
35576
|
+
const result = await deleteSubgraphApi(name);
|
|
35964
35577
|
success(result.message);
|
|
35965
35578
|
} catch (err) {
|
|
35966
|
-
handleApiError(err, "delete
|
|
35579
|
+
handleApiError(err, "delete subgraph");
|
|
35967
35580
|
}
|
|
35968
35581
|
});
|
|
35969
|
-
|
|
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) => {
|
|
35970
35583
|
try {
|
|
35971
35584
|
if (!options2.output) {
|
|
35972
35585
|
error("--output <path> is required");
|
|
@@ -35980,7 +35593,7 @@ ${rows.length} row(s)`));
|
|
|
35980
35593
|
const contractInfo = await client.getContractInfo(contractAddress);
|
|
35981
35594
|
const abi = parseApiResponse(contractInfo);
|
|
35982
35595
|
info(`Generating scaffold...`);
|
|
35983
|
-
const content = await
|
|
35596
|
+
const content = await generateSubgraphScaffold({
|
|
35984
35597
|
contractId: contractAddress,
|
|
35985
35598
|
functions: abi.functions
|
|
35986
35599
|
});
|
|
@@ -35989,30 +35602,30 @@ ${rows.length} row(s)`));
|
|
|
35989
35602
|
mkdirSync(dir, { recursive: true });
|
|
35990
35603
|
await writeTextFile(outPath, content);
|
|
35991
35604
|
success(`Created ${outPath}`);
|
|
35992
|
-
info(`Next: sl
|
|
35605
|
+
info(`Next: sl subgraphs deploy ${options2.output}`);
|
|
35993
35606
|
} catch (err) {
|
|
35994
|
-
error(`Failed to scaffold
|
|
35607
|
+
error(`Failed to scaffold subgraph: ${err}`);
|
|
35995
35608
|
process.exit(1);
|
|
35996
35609
|
}
|
|
35997
35610
|
});
|
|
35998
|
-
|
|
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) => {
|
|
35999
35612
|
try {
|
|
36000
35613
|
if (!options2.output) {
|
|
36001
35614
|
error("--output <path> is required");
|
|
36002
35615
|
process.exit(1);
|
|
36003
35616
|
}
|
|
36004
35617
|
const outPath = resolve(options2.output);
|
|
36005
|
-
info(`Fetching
|
|
36006
|
-
const
|
|
35618
|
+
info(`Fetching subgraph metadata for "${subgraphName}"...`);
|
|
35619
|
+
const subgraphDetail = await getSubgraphApi(subgraphName);
|
|
36007
35620
|
info(`Generating typed client...`);
|
|
36008
|
-
const content = await
|
|
35621
|
+
const content = await generateSubgraphConsumer(subgraphName, subgraphDetail);
|
|
36009
35622
|
const dir = resolve(outPath, "..");
|
|
36010
35623
|
if (!existsSync(dir))
|
|
36011
35624
|
mkdirSync(dir, { recursive: true });
|
|
36012
35625
|
await writeTextFile(outPath, content);
|
|
36013
35626
|
success(`Created ${outPath}`);
|
|
36014
35627
|
} catch (err) {
|
|
36015
|
-
handleApiError(err, "generate
|
|
35628
|
+
handleApiError(err, "generate subgraph client");
|
|
36016
35629
|
}
|
|
36017
35630
|
});
|
|
36018
35631
|
}
|
|
@@ -36564,6 +36177,7 @@ async function runLocalDoctor(jsonOutput) {
|
|
|
36564
36177
|
init_config();
|
|
36565
36178
|
init_api_client();
|
|
36566
36179
|
init_output();
|
|
36180
|
+
import { hostname } from "node:os";
|
|
36567
36181
|
import { input as input2 } from "@inquirer/prompts";
|
|
36568
36182
|
function registerAuthCommand(program2) {
|
|
36569
36183
|
const auth = program2.command("auth").description("Manage authentication and API keys");
|
|
@@ -36584,17 +36198,10 @@ function registerAuthCommand(program2) {
|
|
|
36584
36198
|
headers: { "Content-Type": "application/json" },
|
|
36585
36199
|
body: JSON.stringify({ email })
|
|
36586
36200
|
});
|
|
36587
|
-
|
|
36588
|
-
|
|
36589
|
-
let msg = `HTTP ${mlRes.status}`;
|
|
36590
|
-
try {
|
|
36591
|
-
msg = JSON.parse(body).error || msg;
|
|
36592
|
-
} catch {}
|
|
36593
|
-
throw new Error(msg);
|
|
36594
|
-
}
|
|
36595
|
-
console.log(dim("Check your email for a login token."));
|
|
36201
|
+
await assertOk(mlRes);
|
|
36202
|
+
console.log(dim("Check your email for a 6-digit login code."));
|
|
36596
36203
|
const token = await input2({
|
|
36597
|
-
message: "
|
|
36204
|
+
message: "Code:",
|
|
36598
36205
|
validate: (v) => v.trim().length > 0 || "Token is required"
|
|
36599
36206
|
});
|
|
36600
36207
|
const verifyRes = await fetch(`${apiUrl}/api/auth/verify`, {
|
|
@@ -36602,19 +36209,32 @@ function registerAuthCommand(program2) {
|
|
|
36602
36209
|
headers: { "Content-Type": "application/json" },
|
|
36603
36210
|
body: JSON.stringify({ token: token.trim() })
|
|
36604
36211
|
});
|
|
36605
|
-
|
|
36606
|
-
const body = await verifyRes.text();
|
|
36607
|
-
let msg = `HTTP ${verifyRes.status}`;
|
|
36608
|
-
try {
|
|
36609
|
-
msg = JSON.parse(body).error || msg;
|
|
36610
|
-
} catch {}
|
|
36611
|
-
throw new Error(msg);
|
|
36612
|
-
}
|
|
36212
|
+
await assertOk(verifyRes);
|
|
36613
36213
|
const result = await verifyRes.json();
|
|
36614
|
-
|
|
36214
|
+
const sessionHeaders = { Authorization: `Bearer ${result.sessionToken}`, "Content-Type": "application/json" };
|
|
36215
|
+
const keyName = `cli-${hostname().toLowerCase()}`;
|
|
36216
|
+
const listRes = await fetch(`${apiUrl}/api/keys`, { headers: sessionHeaders });
|
|
36217
|
+
if (listRes.ok) {
|
|
36218
|
+
const { keys: keys2 } = await listRes.json();
|
|
36219
|
+
const existing = keys2.find((k) => k.name === keyName && k.status === "active");
|
|
36220
|
+
if (existing) {
|
|
36221
|
+
await fetch(`${apiUrl}/api/keys/${existing.id}`, { method: "DELETE", headers: sessionHeaders });
|
|
36222
|
+
}
|
|
36223
|
+
}
|
|
36224
|
+
const createRes = await fetch(`${apiUrl}/api/keys`, {
|
|
36225
|
+
method: "POST",
|
|
36226
|
+
headers: sessionHeaders,
|
|
36227
|
+
body: JSON.stringify({ name: keyName })
|
|
36228
|
+
});
|
|
36229
|
+
await assertOk(createRes);
|
|
36230
|
+
const { key, prefix } = await createRes.json();
|
|
36231
|
+
config.apiKey = key;
|
|
36615
36232
|
await saveConfig(config);
|
|
36233
|
+
try {
|
|
36234
|
+
await fetch(`${apiUrl}/api/auth/logout`, { method: "POST", headers: sessionHeaders });
|
|
36235
|
+
} catch {}
|
|
36616
36236
|
success(`Authenticated as ${result.account.email}`);
|
|
36617
|
-
console.log(dim(`
|
|
36237
|
+
console.log(dim(`Key: ${prefix}...`));
|
|
36618
36238
|
console.log(dim(`Network: ${config.network}`));
|
|
36619
36239
|
console.log(dim(`API: ${apiUrl}`));
|
|
36620
36240
|
} catch (err) {
|
|
@@ -36622,37 +36242,41 @@ function registerAuthCommand(program2) {
|
|
|
36622
36242
|
process.exit(1);
|
|
36623
36243
|
}
|
|
36624
36244
|
});
|
|
36625
|
-
auth.command("logout").description("Revoke
|
|
36245
|
+
auth.command("logout").description("Revoke API key and remove from config").action(async () => {
|
|
36626
36246
|
const config = await loadConfig();
|
|
36627
36247
|
const apiUrl = resolveApiUrl(config);
|
|
36628
|
-
if (!config.
|
|
36248
|
+
if (!config.apiKey) {
|
|
36629
36249
|
error("Not logged in.");
|
|
36630
36250
|
process.exit(1);
|
|
36631
36251
|
}
|
|
36632
36252
|
try {
|
|
36633
|
-
|
|
36634
|
-
|
|
36635
|
-
|
|
36636
|
-
|
|
36253
|
+
const headers = authHeaders(config);
|
|
36254
|
+
const listRes = await fetch(`${apiUrl}/api/keys`, { headers });
|
|
36255
|
+
if (listRes.ok) {
|
|
36256
|
+
const { keys: keys2 } = await listRes.json();
|
|
36257
|
+
const currentPrefix = config.apiKey.slice(0, 14);
|
|
36258
|
+
const match = keys2.find((k) => currentPrefix.startsWith(k.prefix));
|
|
36259
|
+
if (match) {
|
|
36260
|
+
await fetch(`${apiUrl}/api/keys/${match.id}`, { method: "DELETE", headers });
|
|
36261
|
+
}
|
|
36262
|
+
}
|
|
36637
36263
|
} catch {}
|
|
36638
|
-
delete config.
|
|
36264
|
+
delete config.apiKey;
|
|
36639
36265
|
await saveConfig(config);
|
|
36640
|
-
success("Logged out.
|
|
36266
|
+
success("Logged out. API key revoked.");
|
|
36641
36267
|
});
|
|
36642
36268
|
auth.command("status").description("Show current auth status").action(async () => {
|
|
36643
36269
|
const config = await loadConfig();
|
|
36644
36270
|
const apiUrl = resolveApiUrl(config);
|
|
36645
|
-
const token = config.sessionToken ?? config.apiKey;
|
|
36646
36271
|
const pairs = [
|
|
36647
36272
|
["Network", config.network],
|
|
36648
36273
|
["API", apiUrl || "(not configured)"],
|
|
36649
|
-
["Session", config.sessionToken ? config.sessionToken.slice(0, 14) + "..." : "(none)"],
|
|
36650
36274
|
["API Key", config.apiKey ? config.apiKey.slice(0, 14) + "..." : "(none)"]
|
|
36651
36275
|
];
|
|
36652
|
-
if (
|
|
36276
|
+
if (config.apiKey && apiUrl) {
|
|
36653
36277
|
try {
|
|
36654
36278
|
const res = await fetch(`${apiUrl}/api/accounts/me`, {
|
|
36655
|
-
headers:
|
|
36279
|
+
headers: authHeaders(config)
|
|
36656
36280
|
});
|
|
36657
36281
|
if (res.ok) {
|
|
36658
36282
|
const data = await res.json();
|
|
@@ -36696,14 +36320,7 @@ function registerAuthCommand(program2) {
|
|
|
36696
36320
|
headers,
|
|
36697
36321
|
body: JSON.stringify({ name: options2.name })
|
|
36698
36322
|
});
|
|
36699
|
-
|
|
36700
|
-
const body = await res.text();
|
|
36701
|
-
let msg = `HTTP ${res.status}`;
|
|
36702
|
-
try {
|
|
36703
|
-
msg = JSON.parse(body).error || msg;
|
|
36704
|
-
} catch {}
|
|
36705
|
-
throw new Error(msg);
|
|
36706
|
-
}
|
|
36323
|
+
await assertOk(res);
|
|
36707
36324
|
const { key, prefix } = await res.json();
|
|
36708
36325
|
success(`Created API key: ${prefix}...`);
|
|
36709
36326
|
console.log();
|
|
@@ -36737,24 +36354,18 @@ function registerAuthCommand(program2) {
|
|
|
36737
36354
|
method: "DELETE",
|
|
36738
36355
|
headers
|
|
36739
36356
|
});
|
|
36740
|
-
|
|
36741
|
-
const body = await res.text();
|
|
36742
|
-
let msg = `HTTP ${res.status}`;
|
|
36743
|
-
try {
|
|
36744
|
-
msg = JSON.parse(body).error || msg;
|
|
36745
|
-
} catch {}
|
|
36746
|
-
throw new Error(msg);
|
|
36747
|
-
}
|
|
36357
|
+
await assertOk(res);
|
|
36748
36358
|
success(`Revoked key ${idOrPrefix}`);
|
|
36749
36359
|
} catch (err) {
|
|
36750
36360
|
error(`Failed to revoke key: ${err}`);
|
|
36751
36361
|
process.exit(1);
|
|
36752
36362
|
}
|
|
36753
36363
|
});
|
|
36754
|
-
|
|
36364
|
+
const defaultKeyName = `cli-${hostname().toLowerCase()}`;
|
|
36365
|
+
keys.command("rotate").description("Revoke current API key and create a new one").option("--name <name>", "Name for the new API key", defaultKeyName).action(async (options2) => {
|
|
36755
36366
|
await rotateKey(options2);
|
|
36756
36367
|
});
|
|
36757
|
-
auth.command("rotate").description("Revoke current API key and create a new one").option("--name <name>", "Name for the new API key",
|
|
36368
|
+
auth.command("rotate").description("Revoke current API key and create a new one").option("--name <name>", "Name for the new API key", defaultKeyName).action(async (options2) => {
|
|
36758
36369
|
await rotateKey(options2);
|
|
36759
36370
|
});
|
|
36760
36371
|
}
|
|
@@ -36762,7 +36373,7 @@ async function rotateKey(options2) {
|
|
|
36762
36373
|
const config = await loadConfig();
|
|
36763
36374
|
const apiUrl = resolveApiUrl(config);
|
|
36764
36375
|
const headers = authHeaders(config);
|
|
36765
|
-
if (!config.
|
|
36376
|
+
if (!config.apiKey) {
|
|
36766
36377
|
error("Not logged in. Run `sl auth login` first.");
|
|
36767
36378
|
process.exit(1);
|
|
36768
36379
|
}
|
|
@@ -36787,14 +36398,7 @@ async function rotateKey(options2) {
|
|
|
36787
36398
|
headers: { ...headers, "Content-Type": "application/json" },
|
|
36788
36399
|
body: JSON.stringify({ name: options2.name })
|
|
36789
36400
|
});
|
|
36790
|
-
|
|
36791
|
-
const body = await createRes.text();
|
|
36792
|
-
let msg = `HTTP ${createRes.status}`;
|
|
36793
|
-
try {
|
|
36794
|
-
msg = JSON.parse(body).error || msg;
|
|
36795
|
-
} catch {}
|
|
36796
|
-
throw new Error(msg);
|
|
36797
|
-
}
|
|
36401
|
+
await assertOk(createRes);
|
|
36798
36402
|
const { key, prefix } = await createRes.json();
|
|
36799
36403
|
config.apiKey = key;
|
|
36800
36404
|
await saveConfig(config);
|
|
@@ -36809,7 +36413,7 @@ init_config();
|
|
|
36809
36413
|
init_dev_state();
|
|
36810
36414
|
init_node_manager();
|
|
36811
36415
|
init_output();
|
|
36812
|
-
var DEV_SERVICES = ["api", "indexer", "worker", "webhook", "
|
|
36416
|
+
var DEV_SERVICES = ["api", "indexer", "worker", "webhook", "subgraphs"];
|
|
36813
36417
|
function registerLocalCommand(program2) {
|
|
36814
36418
|
const local = program2.command("local").description("Manage local development environment and Stacks node").hook("preAction", async (_thisCommand, actionCommand) => {
|
|
36815
36419
|
if (actionCommand.name() === "help")
|
|
@@ -36838,7 +36442,7 @@ function registerLocalCommand(program2) {
|
|
|
36838
36442
|
local.command("status").description("Show local environment status").action(async () => {
|
|
36839
36443
|
await showLocalStatus();
|
|
36840
36444
|
});
|
|
36841
|
-
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) => {
|
|
36842
36446
|
await showLocalLogs(options2);
|
|
36843
36447
|
});
|
|
36844
36448
|
const node = local.command("node").description("Manage local Stacks node");
|
|
@@ -36914,7 +36518,7 @@ var serviceColors2 = {
|
|
|
36914
36518
|
api: blue,
|
|
36915
36519
|
indexer: cyan,
|
|
36916
36520
|
worker: yellow,
|
|
36917
|
-
|
|
36521
|
+
subgraphs: magenta,
|
|
36918
36522
|
webhook: green,
|
|
36919
36523
|
node: red
|
|
36920
36524
|
};
|
|
@@ -37098,8 +36702,7 @@ function registerWhoamiCommand(program2) {
|
|
|
37098
36702
|
program2.command("whoami").description("Show current authenticated account").action(async () => {
|
|
37099
36703
|
const config = await loadConfig();
|
|
37100
36704
|
const apiUrl = resolveApiUrl(config);
|
|
37101
|
-
|
|
37102
|
-
if (!token) {
|
|
36705
|
+
if (!config.apiKey) {
|
|
37103
36706
|
error("Not authenticated. Run: sl auth login");
|
|
37104
36707
|
process.exit(1);
|
|
37105
36708
|
}
|
|
@@ -37129,7 +36732,7 @@ function registerWhoamiCommand(program2) {
|
|
|
37129
36732
|
}
|
|
37130
36733
|
// src/cli.ts
|
|
37131
36734
|
var { version } = package_default;
|
|
37132
|
-
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)");
|
|
37133
36736
|
program.hook("preAction", (thisCommand) => {
|
|
37134
36737
|
const net3 = thisCommand.opts().network;
|
|
37135
36738
|
if (net3)
|
|
@@ -37151,7 +36754,7 @@ program.command("init").description("Initialize a new secondlayer.config.ts file
|
|
|
37151
36754
|
await init3();
|
|
37152
36755
|
});
|
|
37153
36756
|
registerStreamsCommand(program);
|
|
37154
|
-
|
|
36757
|
+
registerSubgraphsCommand(program);
|
|
37155
36758
|
registerStatusCommand(program);
|
|
37156
36759
|
registerLocalCommand(program);
|
|
37157
36760
|
registerStackCommand(program);
|
|
@@ -37165,5 +36768,5 @@ registerWhoamiCommand(program);
|
|
|
37165
36768
|
registerWebhookCommand(program);
|
|
37166
36769
|
program.parse();
|
|
37167
36770
|
|
|
37168
|
-
//# debugId=
|
|
36771
|
+
//# debugId=2320C06E5C8D182A64756E2164756E21
|
|
37169
36772
|
//# sourceMappingURL=cli.js.map
|