@secondlayer/cli 5.10.0 → 6.0.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 +819 -581
- package/dist/cli.js.map +27 -27
- package/dist/core/plugin-manager.js +1 -2
- package/dist/core/plugin-manager.js.map +3 -3
- package/dist/index.js +1 -2
- package/dist/index.js.map +3 -3
- package/dist/plugins/index.js +1 -2
- package/dist/plugins/index.js.map +3 -3
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -100,7 +100,6 @@ async function getBiome() {
|
|
|
100
100
|
enabled: true
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
biome.registerProjectFolder();
|
|
104
103
|
}
|
|
105
104
|
return biome;
|
|
106
105
|
}
|
|
@@ -2519,11 +2518,17 @@ var init_session = __esm(() => {
|
|
|
2519
2518
|
});
|
|
2520
2519
|
|
|
2521
2520
|
// src/lib/resolve-auth.ts
|
|
2521
|
+
function resolveApiUrl() {
|
|
2522
|
+
return process.env.SL_API_URL ?? process.env.SL_PLATFORM_API_URL ?? DEFAULT_API_URL;
|
|
2523
|
+
}
|
|
2524
|
+
function resolveEnvKey() {
|
|
2525
|
+
return process.env.SL_API_KEY ?? process.env.SL_SERVICE_KEY ?? process.env.SL_STREAMS_API_KEY;
|
|
2526
|
+
}
|
|
2522
2527
|
async function resolveAuth() {
|
|
2523
|
-
const
|
|
2524
|
-
const envKey =
|
|
2525
|
-
if (
|
|
2526
|
-
return { apiUrl
|
|
2528
|
+
const apiUrl = resolveApiUrl();
|
|
2529
|
+
const envKey = resolveEnvKey();
|
|
2530
|
+
if (envKey) {
|
|
2531
|
+
return { apiUrl, ephemeralKey: envKey, fromEnv: true };
|
|
2527
2532
|
}
|
|
2528
2533
|
const session = await readSession();
|
|
2529
2534
|
if (!session) {
|
|
@@ -2531,55 +2536,72 @@ async function resolveAuth() {
|
|
|
2531
2536
|
err.code = "SESSION_EXPIRED";
|
|
2532
2537
|
throw err;
|
|
2533
2538
|
}
|
|
2534
|
-
return {
|
|
2535
|
-
apiUrl: PLATFORM_API_URL2,
|
|
2536
|
-
ephemeralKey: session.token,
|
|
2537
|
-
fromEnv: false
|
|
2538
|
-
};
|
|
2539
|
+
return { apiUrl, ephemeralKey: session.token, fromEnv: false };
|
|
2539
2540
|
}
|
|
2540
|
-
var
|
|
2541
|
+
var DEFAULT_API_URL = "https://api.secondlayer.tools";
|
|
2541
2542
|
var init_resolve_auth = __esm(() => {
|
|
2542
2543
|
init_session();
|
|
2543
|
-
PLATFORM_API_URL2 = process.env.SL_PLATFORM_API_URL ?? "https://api.secondlayer.tools";
|
|
2544
2544
|
});
|
|
2545
2545
|
|
|
2546
2546
|
// src/lib/output.ts
|
|
2547
|
+
function paint(code, text) {
|
|
2548
|
+
return colorEnabled ? `${code}${text}${colors.reset}` : text;
|
|
2549
|
+
}
|
|
2547
2550
|
function red(text) {
|
|
2548
|
-
return
|
|
2551
|
+
return paint(colors.red, text);
|
|
2549
2552
|
}
|
|
2550
2553
|
function green(text) {
|
|
2551
|
-
return
|
|
2554
|
+
return paint(colors.green, text);
|
|
2552
2555
|
}
|
|
2553
2556
|
function yellow(text) {
|
|
2554
|
-
return
|
|
2557
|
+
return paint(colors.yellow, text);
|
|
2555
2558
|
}
|
|
2556
2559
|
function blue(text) {
|
|
2557
|
-
return
|
|
2560
|
+
return paint(colors.blue, text);
|
|
2558
2561
|
}
|
|
2559
2562
|
function magenta(text) {
|
|
2560
|
-
return
|
|
2563
|
+
return paint(colors.magenta, text);
|
|
2561
2564
|
}
|
|
2562
2565
|
function cyan(text) {
|
|
2563
|
-
return
|
|
2566
|
+
return paint(colors.cyan, text);
|
|
2564
2567
|
}
|
|
2565
2568
|
function dim(text) {
|
|
2566
|
-
return
|
|
2569
|
+
return paint(colors.dim, text);
|
|
2567
2570
|
}
|
|
2568
2571
|
function bold(text) {
|
|
2569
|
-
return
|
|
2572
|
+
return paint(colors.bold, text);
|
|
2570
2573
|
}
|
|
2571
2574
|
function success(message) {
|
|
2572
|
-
console.
|
|
2575
|
+
console.error(green(`✓ ${message}`));
|
|
2573
2576
|
}
|
|
2574
2577
|
function error(message) {
|
|
2575
2578
|
const text = message.trim() || "Command failed.";
|
|
2576
2579
|
console.error(red(`✗ ${text}`));
|
|
2577
2580
|
}
|
|
2578
2581
|
function warn(message) {
|
|
2579
|
-
console.
|
|
2582
|
+
console.error(yellow(`⚠ ${message}`));
|
|
2580
2583
|
}
|
|
2581
2584
|
function info(message) {
|
|
2582
|
-
console.
|
|
2585
|
+
console.error(blue(`ℹ ${message}`));
|
|
2586
|
+
}
|
|
2587
|
+
function note(message) {
|
|
2588
|
+
console.error(dim(message));
|
|
2589
|
+
}
|
|
2590
|
+
function printError(message, opts) {
|
|
2591
|
+
error(message);
|
|
2592
|
+
if (opts?.hint)
|
|
2593
|
+
console.error(dim(` → ${opts.hint}`));
|
|
2594
|
+
}
|
|
2595
|
+
function writeData(value) {
|
|
2596
|
+
process.stdout.write(`${value}
|
|
2597
|
+
`);
|
|
2598
|
+
}
|
|
2599
|
+
function output(opts) {
|
|
2600
|
+
if (opts.json) {
|
|
2601
|
+
writeData(JSON.stringify(opts.data, null, 2));
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
opts.human();
|
|
2583
2605
|
}
|
|
2584
2606
|
function stripAnsi(text) {
|
|
2585
2607
|
return text.replace(ANSI_ESCAPE_PATTERN, "");
|
|
@@ -2604,8 +2626,16 @@ function formatKeyValue(pairs) {
|
|
|
2604
2626
|
return pairs.map(([key, value]) => `${dim(key.padEnd(maxKeyLen))} ${value}`).join(`
|
|
2605
2627
|
`);
|
|
2606
2628
|
}
|
|
2607
|
-
var colors, ANSI_ESCAPE_PATTERN;
|
|
2629
|
+
var colorEnabled, colors, ANSI_ESCAPE_PATTERN;
|
|
2608
2630
|
var init_output = __esm(() => {
|
|
2631
|
+
colorEnabled = (() => {
|
|
2632
|
+
const { FORCE_COLOR, NO_COLOR } = process.env;
|
|
2633
|
+
if (FORCE_COLOR !== undefined && FORCE_COLOR !== "0")
|
|
2634
|
+
return true;
|
|
2635
|
+
if (NO_COLOR !== undefined && NO_COLOR !== "")
|
|
2636
|
+
return false;
|
|
2637
|
+
return Boolean(process.stdout.isTTY);
|
|
2638
|
+
})();
|
|
2609
2639
|
colors = {
|
|
2610
2640
|
reset: "\x1B[0m",
|
|
2611
2641
|
red: "\x1B[31m",
|
|
@@ -13175,15 +13205,15 @@ async function getNodeLogs(options2 = {}) {
|
|
|
13175
13205
|
continue;
|
|
13176
13206
|
if (options2.quiet && shouldFilterLine(line))
|
|
13177
13207
|
continue;
|
|
13178
|
-
const
|
|
13179
|
-
if (
|
|
13180
|
-
yield
|
|
13208
|
+
const output2 = options2.format ? formatLogLine(line) : line;
|
|
13209
|
+
if (output2)
|
|
13210
|
+
yield output2;
|
|
13181
13211
|
}
|
|
13182
13212
|
}
|
|
13183
13213
|
if (buffer2) {
|
|
13184
|
-
const
|
|
13185
|
-
if (
|
|
13186
|
-
yield
|
|
13214
|
+
const output2 = options2.format ? formatLogLine(buffer2) : buffer2;
|
|
13215
|
+
if (output2)
|
|
13216
|
+
yield output2;
|
|
13187
13217
|
}
|
|
13188
13218
|
} finally {
|
|
13189
13219
|
reader.releaseLock();
|
|
@@ -14972,6 +15002,56 @@ var init_source4 = __esm(() => {
|
|
|
14972
15002
|
source_default3 = chalk;
|
|
14973
15003
|
});
|
|
14974
15004
|
|
|
15005
|
+
// src/commands/init.ts
|
|
15006
|
+
var exports_init = {};
|
|
15007
|
+
__export(exports_init, {
|
|
15008
|
+
init: () => init2
|
|
15009
|
+
});
|
|
15010
|
+
import { promises as fs4 } from "node:fs";
|
|
15011
|
+
import path2 from "node:path";
|
|
15012
|
+
async function init2() {
|
|
15013
|
+
const configPath = path2.join(process.cwd(), "secondlayer.config.ts");
|
|
15014
|
+
try {
|
|
15015
|
+
await fs4.access(configPath);
|
|
15016
|
+
console.log(source_default3.yellow("⚠ secondlayer.config.ts already exists"));
|
|
15017
|
+
return;
|
|
15018
|
+
} catch {}
|
|
15019
|
+
const hasClarinetProject = await fileExists2("./Clarinet.toml");
|
|
15020
|
+
let config;
|
|
15021
|
+
if (hasClarinetProject) {
|
|
15022
|
+
config = `import { defineConfig } from '@secondlayer/cli';
|
|
15023
|
+
import { clarinet } from '@secondlayer/cli/plugins';
|
|
15024
|
+
|
|
15025
|
+
export default defineConfig({
|
|
15026
|
+
out: './src/generated/contracts.ts',
|
|
15027
|
+
plugins: [
|
|
15028
|
+
clarinet() // Found Clarinet.toml in current directory
|
|
15029
|
+
]
|
|
15030
|
+
});`;
|
|
15031
|
+
} else {
|
|
15032
|
+
config = `import { defineConfig } from '@secondlayer/cli';
|
|
15033
|
+
|
|
15034
|
+
export default defineConfig({
|
|
15035
|
+
out: './src/generated/contracts.ts',
|
|
15036
|
+
plugins: [],
|
|
15037
|
+
});`;
|
|
15038
|
+
}
|
|
15039
|
+
await fs4.writeFile(configPath, config);
|
|
15040
|
+
console.log(source_default3.green("✓ Created `secondlayer.config.ts`"));
|
|
15041
|
+
console.log("\nRun `secondlayer generate` to generate type-safe interfaces, functions, and hooks!");
|
|
15042
|
+
}
|
|
15043
|
+
async function fileExists2(filePath) {
|
|
15044
|
+
try {
|
|
15045
|
+
await fs4.access(filePath);
|
|
15046
|
+
return true;
|
|
15047
|
+
} catch {
|
|
15048
|
+
return false;
|
|
15049
|
+
}
|
|
15050
|
+
}
|
|
15051
|
+
var init_init = __esm(() => {
|
|
15052
|
+
init_source4();
|
|
15053
|
+
});
|
|
15054
|
+
|
|
14975
15055
|
// ../../node_modules/fast-glob/out/utils/array.js
|
|
14976
15056
|
var require_array = __commonJS((exports) => {
|
|
14977
15057
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -15034,7 +15114,7 @@ var require_path = __commonJS((exports) => {
|
|
|
15034
15114
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15035
15115
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = undefined;
|
|
15036
15116
|
var os4 = __require("os");
|
|
15037
|
-
var
|
|
15117
|
+
var path3 = __require("path");
|
|
15038
15118
|
var IS_WINDOWS_PLATFORM = os4.platform() === "win32";
|
|
15039
15119
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
15040
15120
|
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
@@ -15046,7 +15126,7 @@ var require_path = __commonJS((exports) => {
|
|
|
15046
15126
|
}
|
|
15047
15127
|
exports.unixify = unixify;
|
|
15048
15128
|
function makeAbsolute(cwd, filepath) {
|
|
15049
|
-
return
|
|
15129
|
+
return path3.resolve(cwd, filepath);
|
|
15050
15130
|
}
|
|
15051
15131
|
exports.makeAbsolute = makeAbsolute;
|
|
15052
15132
|
function removeLeadingDotSegment(entry) {
|
|
@@ -15356,7 +15436,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
15356
15436
|
const stringify2 = (node, parent = {}) => {
|
|
15357
15437
|
const invalidBlock = options2.escapeInvalid && utils.isInvalidBrace(parent);
|
|
15358
15438
|
const invalidNode = node.invalid === true && options2.escapeInvalid === true;
|
|
15359
|
-
let
|
|
15439
|
+
let output2 = "";
|
|
15360
15440
|
if (node.value) {
|
|
15361
15441
|
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
|
15362
15442
|
return "\\" + node.value;
|
|
@@ -15368,10 +15448,10 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
15368
15448
|
}
|
|
15369
15449
|
if (node.nodes) {
|
|
15370
15450
|
for (const child of node.nodes) {
|
|
15371
|
-
|
|
15451
|
+
output2 += stringify2(child);
|
|
15372
15452
|
}
|
|
15373
15453
|
}
|
|
15374
|
-
return
|
|
15454
|
+
return output2;
|
|
15375
15455
|
};
|
|
15376
15456
|
return stringify2(ast);
|
|
15377
15457
|
};
|
|
@@ -15830,7 +15910,7 @@ var require_compile = __commonJS((exports, module) => {
|
|
|
15830
15910
|
const invalidNode = node.invalid === true && options2.escapeInvalid === true;
|
|
15831
15911
|
const invalid = invalidBlock === true || invalidNode === true;
|
|
15832
15912
|
const prefix = options2.escapeInvalid === true ? "\\" : "";
|
|
15833
|
-
let
|
|
15913
|
+
let output2 = "";
|
|
15834
15914
|
if (node.isOpen === true) {
|
|
15835
15915
|
return prefix + node.value;
|
|
15836
15916
|
}
|
|
@@ -15859,10 +15939,10 @@ var require_compile = __commonJS((exports, module) => {
|
|
|
15859
15939
|
}
|
|
15860
15940
|
if (node.nodes) {
|
|
15861
15941
|
for (const child of node.nodes) {
|
|
15862
|
-
|
|
15942
|
+
output2 += walk(child, node);
|
|
15863
15943
|
}
|
|
15864
15944
|
}
|
|
15865
|
-
return
|
|
15945
|
+
return output2;
|
|
15866
15946
|
};
|
|
15867
15947
|
return walk(ast);
|
|
15868
15948
|
};
|
|
@@ -16249,23 +16329,23 @@ var require_braces = __commonJS((exports, module) => {
|
|
|
16249
16329
|
var expand = require_expand();
|
|
16250
16330
|
var parse2 = require_parse();
|
|
16251
16331
|
var braces = (input5, options2 = {}) => {
|
|
16252
|
-
let
|
|
16332
|
+
let output2 = [];
|
|
16253
16333
|
if (Array.isArray(input5)) {
|
|
16254
16334
|
for (const pattern of input5) {
|
|
16255
16335
|
const result = braces.create(pattern, options2);
|
|
16256
16336
|
if (Array.isArray(result)) {
|
|
16257
|
-
|
|
16337
|
+
output2.push(...result);
|
|
16258
16338
|
} else {
|
|
16259
|
-
|
|
16339
|
+
output2.push(result);
|
|
16260
16340
|
}
|
|
16261
16341
|
}
|
|
16262
16342
|
} else {
|
|
16263
|
-
|
|
16343
|
+
output2 = [].concat(braces.create(input5, options2));
|
|
16264
16344
|
}
|
|
16265
16345
|
if (options2 && options2.expand === true && options2.nodupes === true) {
|
|
16266
|
-
|
|
16346
|
+
output2 = [...new Set(output2)];
|
|
16267
16347
|
}
|
|
16268
|
-
return
|
|
16348
|
+
return output2;
|
|
16269
16349
|
};
|
|
16270
16350
|
braces.parse = (input5, options2 = {}) => parse2(input5, options2);
|
|
16271
16351
|
braces.stringify = (input5, options2 = {}) => {
|
|
@@ -16304,7 +16384,7 @@ var require_braces = __commonJS((exports, module) => {
|
|
|
16304
16384
|
|
|
16305
16385
|
// ../../node_modules/picomatch/lib/constants.js
|
|
16306
16386
|
var require_constants2 = __commonJS((exports, module) => {
|
|
16307
|
-
var
|
|
16387
|
+
var path3 = __require("path");
|
|
16308
16388
|
var WIN_SLASH = "\\\\/";
|
|
16309
16389
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
16310
16390
|
var DOT_LITERAL = "\\.";
|
|
@@ -16426,7 +16506,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
16426
16506
|
CHAR_UNDERSCORE: 95,
|
|
16427
16507
|
CHAR_VERTICAL_LINE: 124,
|
|
16428
16508
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
16429
|
-
SEP:
|
|
16509
|
+
SEP: path3.sep,
|
|
16430
16510
|
extglobChars(chars) {
|
|
16431
16511
|
return {
|
|
16432
16512
|
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
@@ -16444,7 +16524,7 @@ var require_constants2 = __commonJS((exports, module) => {
|
|
|
16444
16524
|
|
|
16445
16525
|
// ../../node_modules/picomatch/lib/utils.js
|
|
16446
16526
|
var require_utils2 = __commonJS((exports) => {
|
|
16447
|
-
var
|
|
16527
|
+
var path3 = __require("path");
|
|
16448
16528
|
var win32 = process.platform === "win32";
|
|
16449
16529
|
var {
|
|
16450
16530
|
REGEX_BACKSLASH,
|
|
@@ -16473,7 +16553,7 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
16473
16553
|
if (options2 && typeof options2.windows === "boolean") {
|
|
16474
16554
|
return options2.windows;
|
|
16475
16555
|
}
|
|
16476
|
-
return win32 === true ||
|
|
16556
|
+
return win32 === true || path3.sep === "\\";
|
|
16477
16557
|
};
|
|
16478
16558
|
exports.escapeLast = (input5, char, lastIdx) => {
|
|
16479
16559
|
const idx = input5.lastIndexOf(char, lastIdx);
|
|
@@ -16484,21 +16564,21 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
16484
16564
|
return `${input5.slice(0, idx)}\\${input5.slice(idx)}`;
|
|
16485
16565
|
};
|
|
16486
16566
|
exports.removePrefix = (input5, state = {}) => {
|
|
16487
|
-
let
|
|
16488
|
-
if (
|
|
16489
|
-
|
|
16567
|
+
let output2 = input5;
|
|
16568
|
+
if (output2.startsWith("./")) {
|
|
16569
|
+
output2 = output2.slice(2);
|
|
16490
16570
|
state.prefix = "./";
|
|
16491
16571
|
}
|
|
16492
|
-
return
|
|
16572
|
+
return output2;
|
|
16493
16573
|
};
|
|
16494
16574
|
exports.wrapOutput = (input5, state = {}, options2 = {}) => {
|
|
16495
16575
|
const prepend = options2.contains ? "" : "^";
|
|
16496
16576
|
const append = options2.contains ? "" : "$";
|
|
16497
|
-
let
|
|
16577
|
+
let output2 = `${prepend}(?:${input5})${append}`;
|
|
16498
16578
|
if (state.negated === true) {
|
|
16499
|
-
|
|
16579
|
+
output2 = `(?:^(?!${output2}).*$)`;
|
|
16500
16580
|
}
|
|
16501
|
-
return
|
|
16581
|
+
return output2;
|
|
16502
16582
|
};
|
|
16503
16583
|
});
|
|
16504
16584
|
|
|
@@ -16976,14 +17056,14 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
16976
17056
|
token.prev = prev;
|
|
16977
17057
|
token.parens = state.parens;
|
|
16978
17058
|
token.output = state.output;
|
|
16979
|
-
const
|
|
17059
|
+
const output2 = (opts.capture ? "(" : "") + token.open;
|
|
16980
17060
|
increment("parens");
|
|
16981
17061
|
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
16982
|
-
push({ type: "paren", extglob: true, value: advance(), output });
|
|
17062
|
+
push({ type: "paren", extglob: true, value: advance(), output: output2 });
|
|
16983
17063
|
extglobs.push(token);
|
|
16984
17064
|
};
|
|
16985
17065
|
const extglobClose = (token) => {
|
|
16986
|
-
let
|
|
17066
|
+
let output2 = token.close + (opts.capture ? ")" : "");
|
|
16987
17067
|
let rest;
|
|
16988
17068
|
if (token.type === "negate") {
|
|
16989
17069
|
let extglobStar = star;
|
|
@@ -16991,22 +17071,22 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
16991
17071
|
extglobStar = globstar(opts);
|
|
16992
17072
|
}
|
|
16993
17073
|
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
16994
|
-
|
|
17074
|
+
output2 = token.close = `)$))${extglobStar}`;
|
|
16995
17075
|
}
|
|
16996
17076
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
16997
17077
|
const expression = parse2(rest, { ...options2, fastpaths: false }).output;
|
|
16998
|
-
|
|
17078
|
+
output2 = token.close = `)${expression})${extglobStar})`;
|
|
16999
17079
|
}
|
|
17000
17080
|
if (token.prev.type === "bos") {
|
|
17001
17081
|
state.negatedExtglob = true;
|
|
17002
17082
|
}
|
|
17003
17083
|
}
|
|
17004
|
-
push({ type: "paren", extglob: true, value, output });
|
|
17084
|
+
push({ type: "paren", extglob: true, value, output: output2 });
|
|
17005
17085
|
decrement("parens");
|
|
17006
17086
|
};
|
|
17007
17087
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input5)) {
|
|
17008
17088
|
let backslashes = false;
|
|
17009
|
-
let
|
|
17089
|
+
let output2 = input5.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
17010
17090
|
if (first === "\\") {
|
|
17011
17091
|
backslashes = true;
|
|
17012
17092
|
return m;
|
|
@@ -17033,18 +17113,18 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
17033
17113
|
});
|
|
17034
17114
|
if (backslashes === true) {
|
|
17035
17115
|
if (opts.unescape === true) {
|
|
17036
|
-
|
|
17116
|
+
output2 = output2.replace(/\\/g, "");
|
|
17037
17117
|
} else {
|
|
17038
|
-
|
|
17118
|
+
output2 = output2.replace(/\\+/g, (m) => {
|
|
17039
17119
|
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
17040
17120
|
});
|
|
17041
17121
|
}
|
|
17042
17122
|
}
|
|
17043
|
-
if (
|
|
17123
|
+
if (output2 === input5 && opts.contains === true) {
|
|
17044
17124
|
state.output = input5;
|
|
17045
17125
|
return state;
|
|
17046
17126
|
}
|
|
17047
|
-
state.output = utils.wrapOutput(
|
|
17127
|
+
state.output = utils.wrapOutput(output2, state, options2);
|
|
17048
17128
|
return state;
|
|
17049
17129
|
}
|
|
17050
17130
|
while (!eos()) {
|
|
@@ -17214,7 +17294,7 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
17214
17294
|
push({ type: "text", value, output: value });
|
|
17215
17295
|
continue;
|
|
17216
17296
|
}
|
|
17217
|
-
let
|
|
17297
|
+
let output2 = ")";
|
|
17218
17298
|
if (brace.dots === true) {
|
|
17219
17299
|
const arr = tokens.slice();
|
|
17220
17300
|
const range = [];
|
|
@@ -17227,20 +17307,20 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
17227
17307
|
range.unshift(arr[i].value);
|
|
17228
17308
|
}
|
|
17229
17309
|
}
|
|
17230
|
-
|
|
17310
|
+
output2 = expandRange(range, opts);
|
|
17231
17311
|
state.backtrack = true;
|
|
17232
17312
|
}
|
|
17233
17313
|
if (brace.comma !== true && brace.dots !== true) {
|
|
17234
17314
|
const out = state.output.slice(0, brace.outputIndex);
|
|
17235
17315
|
const toks = state.tokens.slice(brace.tokensIndex);
|
|
17236
17316
|
brace.value = brace.output = "\\{";
|
|
17237
|
-
value =
|
|
17317
|
+
value = output2 = "\\}";
|
|
17238
17318
|
state.output = out;
|
|
17239
17319
|
for (const t of toks) {
|
|
17240
17320
|
state.output += t.output || t.value;
|
|
17241
17321
|
}
|
|
17242
17322
|
}
|
|
17243
|
-
push({ type: "brace", value, output });
|
|
17323
|
+
push({ type: "brace", value, output: output2 });
|
|
17244
17324
|
decrement("braces");
|
|
17245
17325
|
braces.pop();
|
|
17246
17326
|
continue;
|
|
@@ -17253,13 +17333,13 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
17253
17333
|
continue;
|
|
17254
17334
|
}
|
|
17255
17335
|
if (value === ",") {
|
|
17256
|
-
let
|
|
17336
|
+
let output2 = value;
|
|
17257
17337
|
const brace = braces[braces.length - 1];
|
|
17258
17338
|
if (brace && stack[stack.length - 1] === "braces") {
|
|
17259
17339
|
brace.comma = true;
|
|
17260
|
-
|
|
17340
|
+
output2 = "|";
|
|
17261
17341
|
}
|
|
17262
|
-
push({ type: "comma", value, output });
|
|
17342
|
+
push({ type: "comma", value, output: output2 });
|
|
17263
17343
|
continue;
|
|
17264
17344
|
}
|
|
17265
17345
|
if (value === "/") {
|
|
@@ -17300,14 +17380,14 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
17300
17380
|
}
|
|
17301
17381
|
if (prev && prev.type === "paren") {
|
|
17302
17382
|
const next = peek();
|
|
17303
|
-
let
|
|
17383
|
+
let output2 = value;
|
|
17304
17384
|
if (next === "<" && !utils.supportsLookbehinds()) {
|
|
17305
17385
|
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
17306
17386
|
}
|
|
17307
17387
|
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
17308
|
-
|
|
17388
|
+
output2 = `\\${value}`;
|
|
17309
17389
|
}
|
|
17310
|
-
push({ type: "text", value, output });
|
|
17390
|
+
push({ type: "text", value, output: output2 });
|
|
17311
17391
|
continue;
|
|
17312
17392
|
}
|
|
17313
17393
|
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
@@ -17585,8 +17665,8 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
17585
17665
|
}
|
|
17586
17666
|
}
|
|
17587
17667
|
};
|
|
17588
|
-
const
|
|
17589
|
-
let source = create2(
|
|
17668
|
+
const output2 = utils.removePrefix(input5, state);
|
|
17669
|
+
let source = create2(output2);
|
|
17590
17670
|
if (source && opts.strictSlashes !== true) {
|
|
17591
17671
|
source += `${SLASH_LITERAL}?`;
|
|
17592
17672
|
}
|
|
@@ -17597,7 +17677,7 @@ var require_parse2 = __commonJS((exports, module) => {
|
|
|
17597
17677
|
|
|
17598
17678
|
// ../../node_modules/picomatch/lib/picomatch.js
|
|
17599
17679
|
var require_picomatch = __commonJS((exports, module) => {
|
|
17600
|
-
var
|
|
17680
|
+
var path3 = __require("path");
|
|
17601
17681
|
var scan = require_scan();
|
|
17602
17682
|
var parse2 = require_parse2();
|
|
17603
17683
|
var utils = require_utils2();
|
|
@@ -17631,8 +17711,8 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
17631
17711
|
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
17632
17712
|
}
|
|
17633
17713
|
const matcher = (input5, returnObject = false) => {
|
|
17634
|
-
const { isMatch, match, output } = picomatch.test(input5, regex, options2, { glob, posix });
|
|
17635
|
-
const result = { glob, state, regex, posix, input: input5, output, match, isMatch };
|
|
17714
|
+
const { isMatch, match, output: output2 } = picomatch.test(input5, regex, options2, { glob, posix });
|
|
17715
|
+
const result = { glob, state, regex, posix, input: input5, output: output2, match, isMatch };
|
|
17636
17716
|
if (typeof opts.onResult === "function") {
|
|
17637
17717
|
opts.onResult(result);
|
|
17638
17718
|
}
|
|
@@ -17667,23 +17747,23 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
17667
17747
|
const opts = options2 || {};
|
|
17668
17748
|
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
17669
17749
|
let match = input5 === glob;
|
|
17670
|
-
let
|
|
17750
|
+
let output2 = match && format ? format(input5) : input5;
|
|
17671
17751
|
if (match === false) {
|
|
17672
|
-
|
|
17673
|
-
match =
|
|
17752
|
+
output2 = format ? format(input5) : input5;
|
|
17753
|
+
match = output2 === glob;
|
|
17674
17754
|
}
|
|
17675
17755
|
if (match === false || opts.capture === true) {
|
|
17676
17756
|
if (opts.matchBase === true || opts.basename === true) {
|
|
17677
17757
|
match = picomatch.matchBase(input5, regex, options2, posix);
|
|
17678
17758
|
} else {
|
|
17679
|
-
match = regex.exec(
|
|
17759
|
+
match = regex.exec(output2);
|
|
17680
17760
|
}
|
|
17681
17761
|
}
|
|
17682
|
-
return { isMatch: Boolean(match), match, output };
|
|
17762
|
+
return { isMatch: Boolean(match), match, output: output2 };
|
|
17683
17763
|
};
|
|
17684
17764
|
picomatch.matchBase = (input5, glob, options2, posix = utils.isWindows(options2)) => {
|
|
17685
17765
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options2);
|
|
17686
|
-
return regex.test(
|
|
17766
|
+
return regex.test(path3.basename(input5));
|
|
17687
17767
|
};
|
|
17688
17768
|
picomatch.isMatch = (str, patterns, options2) => picomatch(patterns, options2)(str);
|
|
17689
17769
|
picomatch.parse = (pattern, options2) => {
|
|
@@ -17904,7 +17984,7 @@ var require_micromatch = __commonJS((exports, module) => {
|
|
|
17904
17984
|
var require_pattern = __commonJS((exports) => {
|
|
17905
17985
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17906
17986
|
exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = undefined;
|
|
17907
|
-
var
|
|
17987
|
+
var path3 = __require("path");
|
|
17908
17988
|
var globParent = require_glob_parent();
|
|
17909
17989
|
var micromatch = require_micromatch();
|
|
17910
17990
|
var GLOBSTAR = "**";
|
|
@@ -17999,7 +18079,7 @@ var require_pattern = __commonJS((exports) => {
|
|
|
17999
18079
|
}
|
|
18000
18080
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
18001
18081
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
18002
|
-
const basename =
|
|
18082
|
+
const basename = path3.basename(pattern);
|
|
18003
18083
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
18004
18084
|
}
|
|
18005
18085
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -18057,7 +18137,7 @@ var require_pattern = __commonJS((exports) => {
|
|
|
18057
18137
|
}
|
|
18058
18138
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
18059
18139
|
function isAbsolute(pattern) {
|
|
18060
|
-
return
|
|
18140
|
+
return path3.isAbsolute(pattern);
|
|
18061
18141
|
}
|
|
18062
18142
|
exports.isAbsolute = isAbsolute;
|
|
18063
18143
|
});
|
|
@@ -18220,10 +18300,10 @@ var require_utils3 = __commonJS((exports) => {
|
|
|
18220
18300
|
exports.array = array;
|
|
18221
18301
|
var errno = require_errno();
|
|
18222
18302
|
exports.errno = errno;
|
|
18223
|
-
var
|
|
18224
|
-
exports.fs =
|
|
18225
|
-
var
|
|
18226
|
-
exports.path =
|
|
18303
|
+
var fs5 = require_fs();
|
|
18304
|
+
exports.fs = fs5;
|
|
18305
|
+
var path3 = require_path();
|
|
18306
|
+
exports.path = path3;
|
|
18227
18307
|
var pattern = require_pattern();
|
|
18228
18308
|
exports.pattern = pattern;
|
|
18229
18309
|
var stream2 = require_stream();
|
|
@@ -18319,8 +18399,8 @@ var require_tasks = __commonJS((exports) => {
|
|
|
18319
18399
|
var require_async = __commonJS((exports) => {
|
|
18320
18400
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18321
18401
|
exports.read = undefined;
|
|
18322
|
-
function read(
|
|
18323
|
-
settings.fs.lstat(
|
|
18402
|
+
function read(path3, settings, callback) {
|
|
18403
|
+
settings.fs.lstat(path3, (lstatError, lstat) => {
|
|
18324
18404
|
if (lstatError !== null) {
|
|
18325
18405
|
callFailureCallback(callback, lstatError);
|
|
18326
18406
|
return;
|
|
@@ -18329,7 +18409,7 @@ var require_async = __commonJS((exports) => {
|
|
|
18329
18409
|
callSuccessCallback(callback, lstat);
|
|
18330
18410
|
return;
|
|
18331
18411
|
}
|
|
18332
|
-
settings.fs.stat(
|
|
18412
|
+
settings.fs.stat(path3, (statError, stat2) => {
|
|
18333
18413
|
if (statError !== null) {
|
|
18334
18414
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
18335
18415
|
callFailureCallback(callback, statError);
|
|
@@ -18358,13 +18438,13 @@ var require_async = __commonJS((exports) => {
|
|
|
18358
18438
|
var require_sync = __commonJS((exports) => {
|
|
18359
18439
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18360
18440
|
exports.read = undefined;
|
|
18361
|
-
function read(
|
|
18362
|
-
const lstat = settings.fs.lstatSync(
|
|
18441
|
+
function read(path3, settings) {
|
|
18442
|
+
const lstat = settings.fs.lstatSync(path3);
|
|
18363
18443
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
18364
18444
|
return lstat;
|
|
18365
18445
|
}
|
|
18366
18446
|
try {
|
|
18367
|
-
const stat2 = settings.fs.statSync(
|
|
18447
|
+
const stat2 = settings.fs.statSync(path3);
|
|
18368
18448
|
if (settings.markSymbolicLink) {
|
|
18369
18449
|
stat2.isSymbolicLink = () => true;
|
|
18370
18450
|
}
|
|
@@ -18383,12 +18463,12 @@ var require_sync = __commonJS((exports) => {
|
|
|
18383
18463
|
var require_fs2 = __commonJS((exports) => {
|
|
18384
18464
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18385
18465
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = undefined;
|
|
18386
|
-
var
|
|
18466
|
+
var fs5 = __require("fs");
|
|
18387
18467
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
18388
|
-
lstat:
|
|
18389
|
-
stat:
|
|
18390
|
-
lstatSync:
|
|
18391
|
-
statSync:
|
|
18468
|
+
lstat: fs5.lstat,
|
|
18469
|
+
stat: fs5.stat,
|
|
18470
|
+
lstatSync: fs5.lstatSync,
|
|
18471
|
+
statSync: fs5.statSync
|
|
18392
18472
|
};
|
|
18393
18473
|
function createFileSystemAdapter(fsMethods) {
|
|
18394
18474
|
if (fsMethods === undefined) {
|
|
@@ -18402,13 +18482,13 @@ var require_fs2 = __commonJS((exports) => {
|
|
|
18402
18482
|
// ../../node_modules/@nodelib/fs.stat/out/settings.js
|
|
18403
18483
|
var require_settings = __commonJS((exports) => {
|
|
18404
18484
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18405
|
-
var
|
|
18485
|
+
var fs5 = require_fs2();
|
|
18406
18486
|
|
|
18407
18487
|
class Settings {
|
|
18408
18488
|
constructor(_options = {}) {
|
|
18409
18489
|
this._options = _options;
|
|
18410
18490
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
18411
|
-
this.fs =
|
|
18491
|
+
this.fs = fs5.createFileSystemAdapter(this._options.fs);
|
|
18412
18492
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
18413
18493
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
18414
18494
|
}
|
|
@@ -18427,17 +18507,17 @@ var require_out = __commonJS((exports) => {
|
|
|
18427
18507
|
var sync = require_sync();
|
|
18428
18508
|
var settings_1 = require_settings();
|
|
18429
18509
|
exports.Settings = settings_1.default;
|
|
18430
|
-
function stat2(
|
|
18510
|
+
function stat2(path3, optionsOrSettingsOrCallback, callback) {
|
|
18431
18511
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
18432
|
-
async.read(
|
|
18512
|
+
async.read(path3, getSettings(), optionsOrSettingsOrCallback);
|
|
18433
18513
|
return;
|
|
18434
18514
|
}
|
|
18435
|
-
async.read(
|
|
18515
|
+
async.read(path3, getSettings(optionsOrSettingsOrCallback), callback);
|
|
18436
18516
|
}
|
|
18437
18517
|
exports.stat = stat2;
|
|
18438
|
-
function statSync2(
|
|
18518
|
+
function statSync2(path3, optionsOrSettings) {
|
|
18439
18519
|
const settings = getSettings(optionsOrSettings);
|
|
18440
|
-
return sync.read(
|
|
18520
|
+
return sync.read(path3, settings);
|
|
18441
18521
|
}
|
|
18442
18522
|
exports.statSync = statSync2;
|
|
18443
18523
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -18553,8 +18633,8 @@ var require_fs3 = __commonJS((exports) => {
|
|
|
18553
18633
|
var require_utils4 = __commonJS((exports) => {
|
|
18554
18634
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18555
18635
|
exports.fs = undefined;
|
|
18556
|
-
var
|
|
18557
|
-
exports.fs =
|
|
18636
|
+
var fs5 = require_fs3();
|
|
18637
|
+
exports.fs = fs5;
|
|
18558
18638
|
});
|
|
18559
18639
|
|
|
18560
18640
|
// ../../node_modules/@nodelib/fs.scandir/out/providers/common.js
|
|
@@ -18640,16 +18720,16 @@ var require_async2 = __commonJS((exports) => {
|
|
|
18640
18720
|
return;
|
|
18641
18721
|
}
|
|
18642
18722
|
const tasks = names.map((name) => {
|
|
18643
|
-
const
|
|
18723
|
+
const path3 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
18644
18724
|
return (done) => {
|
|
18645
|
-
fsStat.stat(
|
|
18725
|
+
fsStat.stat(path3, settings.fsStatSettings, (error2, stats) => {
|
|
18646
18726
|
if (error2 !== null) {
|
|
18647
18727
|
done(error2);
|
|
18648
18728
|
return;
|
|
18649
18729
|
}
|
|
18650
18730
|
const entry = {
|
|
18651
18731
|
name,
|
|
18652
|
-
path:
|
|
18732
|
+
path: path3,
|
|
18653
18733
|
dirent: utils.fs.createDirentFromStats(name, stats)
|
|
18654
18734
|
};
|
|
18655
18735
|
if (settings.stats) {
|
|
@@ -18737,14 +18817,14 @@ var require_sync2 = __commonJS((exports) => {
|
|
|
18737
18817
|
var require_fs4 = __commonJS((exports) => {
|
|
18738
18818
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18739
18819
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = undefined;
|
|
18740
|
-
var
|
|
18820
|
+
var fs5 = __require("fs");
|
|
18741
18821
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
18742
|
-
lstat:
|
|
18743
|
-
stat:
|
|
18744
|
-
lstatSync:
|
|
18745
|
-
statSync:
|
|
18746
|
-
readdir:
|
|
18747
|
-
readdirSync:
|
|
18822
|
+
lstat: fs5.lstat,
|
|
18823
|
+
stat: fs5.stat,
|
|
18824
|
+
lstatSync: fs5.lstatSync,
|
|
18825
|
+
statSync: fs5.statSync,
|
|
18826
|
+
readdir: fs5.readdir,
|
|
18827
|
+
readdirSync: fs5.readdirSync
|
|
18748
18828
|
};
|
|
18749
18829
|
function createFileSystemAdapter(fsMethods) {
|
|
18750
18830
|
if (fsMethods === undefined) {
|
|
@@ -18758,16 +18838,16 @@ var require_fs4 = __commonJS((exports) => {
|
|
|
18758
18838
|
// ../../node_modules/@nodelib/fs.scandir/out/settings.js
|
|
18759
18839
|
var require_settings2 = __commonJS((exports) => {
|
|
18760
18840
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18761
|
-
var
|
|
18841
|
+
var path3 = __require("path");
|
|
18762
18842
|
var fsStat = require_out();
|
|
18763
|
-
var
|
|
18843
|
+
var fs5 = require_fs4();
|
|
18764
18844
|
|
|
18765
18845
|
class Settings {
|
|
18766
18846
|
constructor(_options = {}) {
|
|
18767
18847
|
this._options = _options;
|
|
18768
18848
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
18769
|
-
this.fs =
|
|
18770
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
18849
|
+
this.fs = fs5.createFileSystemAdapter(this._options.fs);
|
|
18850
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path3.sep);
|
|
18771
18851
|
this.stats = this._getValue(this._options.stats, false);
|
|
18772
18852
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
18773
18853
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -18791,17 +18871,17 @@ var require_out2 = __commonJS((exports) => {
|
|
|
18791
18871
|
var sync = require_sync2();
|
|
18792
18872
|
var settings_1 = require_settings2();
|
|
18793
18873
|
exports.Settings = settings_1.default;
|
|
18794
|
-
function scandir(
|
|
18874
|
+
function scandir(path3, optionsOrSettingsOrCallback, callback) {
|
|
18795
18875
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
18796
|
-
async.read(
|
|
18876
|
+
async.read(path3, getSettings(), optionsOrSettingsOrCallback);
|
|
18797
18877
|
return;
|
|
18798
18878
|
}
|
|
18799
|
-
async.read(
|
|
18879
|
+
async.read(path3, getSettings(optionsOrSettingsOrCallback), callback);
|
|
18800
18880
|
}
|
|
18801
18881
|
exports.scandir = scandir;
|
|
18802
|
-
function scandirSync(
|
|
18882
|
+
function scandirSync(path3, optionsOrSettings) {
|
|
18803
18883
|
const settings = getSettings(optionsOrSettings);
|
|
18804
|
-
return sync.read(
|
|
18884
|
+
return sync.read(path3, settings);
|
|
18805
18885
|
}
|
|
18806
18886
|
exports.scandirSync = scandirSync;
|
|
18807
18887
|
function getSettings(settingsOrOptions = {}) {
|
|
@@ -19402,7 +19482,7 @@ var require_sync4 = __commonJS((exports) => {
|
|
|
19402
19482
|
// ../../node_modules/@nodelib/fs.walk/out/settings.js
|
|
19403
19483
|
var require_settings3 = __commonJS((exports) => {
|
|
19404
19484
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19405
|
-
var
|
|
19485
|
+
var path3 = __require("path");
|
|
19406
19486
|
var fsScandir = require_out2();
|
|
19407
19487
|
|
|
19408
19488
|
class Settings {
|
|
@@ -19413,7 +19493,7 @@ var require_settings3 = __commonJS((exports) => {
|
|
|
19413
19493
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
19414
19494
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
19415
19495
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
19416
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator,
|
|
19496
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path3.sep);
|
|
19417
19497
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
19418
19498
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
19419
19499
|
fs: this._options.fs,
|
|
@@ -19469,7 +19549,7 @@ var require_out3 = __commonJS((exports) => {
|
|
|
19469
19549
|
// ../../node_modules/fast-glob/out/readers/reader.js
|
|
19470
19550
|
var require_reader2 = __commonJS((exports) => {
|
|
19471
19551
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19472
|
-
var
|
|
19552
|
+
var path3 = __require("path");
|
|
19473
19553
|
var fsStat = require_out();
|
|
19474
19554
|
var utils = require_utils3();
|
|
19475
19555
|
|
|
@@ -19483,7 +19563,7 @@ var require_reader2 = __commonJS((exports) => {
|
|
|
19483
19563
|
});
|
|
19484
19564
|
}
|
|
19485
19565
|
_getFullEntryPath(filepath) {
|
|
19486
|
-
return
|
|
19566
|
+
return path3.resolve(this._settings.cwd, filepath);
|
|
19487
19567
|
}
|
|
19488
19568
|
_makeEntry(stats, pattern) {
|
|
19489
19569
|
const entry = {
|
|
@@ -19880,7 +19960,7 @@ var require_entry2 = __commonJS((exports) => {
|
|
|
19880
19960
|
// ../../node_modules/fast-glob/out/providers/provider.js
|
|
19881
19961
|
var require_provider = __commonJS((exports) => {
|
|
19882
19962
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19883
|
-
var
|
|
19963
|
+
var path3 = __require("path");
|
|
19884
19964
|
var deep_1 = require_deep();
|
|
19885
19965
|
var entry_1 = require_entry();
|
|
19886
19966
|
var error_1 = require_error2();
|
|
@@ -19895,7 +19975,7 @@ var require_provider = __commonJS((exports) => {
|
|
|
19895
19975
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
19896
19976
|
}
|
|
19897
19977
|
_getRootDirectory(task) {
|
|
19898
|
-
return
|
|
19978
|
+
return path3.resolve(this._settings.cwd, task.base);
|
|
19899
19979
|
}
|
|
19900
19980
|
_getReaderOptions(task) {
|
|
19901
19981
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -20064,16 +20144,16 @@ var require_sync6 = __commonJS((exports) => {
|
|
|
20064
20144
|
var require_settings4 = __commonJS((exports) => {
|
|
20065
20145
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20066
20146
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = undefined;
|
|
20067
|
-
var
|
|
20147
|
+
var fs5 = __require("fs");
|
|
20068
20148
|
var os4 = __require("os");
|
|
20069
20149
|
var CPU_COUNT = Math.max(os4.cpus().length, 1);
|
|
20070
20150
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
20071
|
-
lstat:
|
|
20072
|
-
lstatSync:
|
|
20073
|
-
stat:
|
|
20074
|
-
statSync:
|
|
20075
|
-
readdir:
|
|
20076
|
-
readdirSync:
|
|
20151
|
+
lstat: fs5.lstat,
|
|
20152
|
+
lstatSync: fs5.lstatSync,
|
|
20153
|
+
stat: fs5.stat,
|
|
20154
|
+
statSync: fs5.statSync,
|
|
20155
|
+
readdir: fs5.readdir,
|
|
20156
|
+
readdirSync: fs5.readdirSync
|
|
20077
20157
|
};
|
|
20078
20158
|
|
|
20079
20159
|
class Settings {
|
|
@@ -20776,16 +20856,16 @@ var init_contract = __esm(() => {
|
|
|
20776
20856
|
|
|
20777
20857
|
// src/utils/config.ts
|
|
20778
20858
|
import { randomBytes } from "node:crypto";
|
|
20779
|
-
import { promises as
|
|
20859
|
+
import { promises as fs5 } from "node:fs";
|
|
20780
20860
|
import { createRequire as createRequire2 } from "node:module";
|
|
20781
20861
|
import { tmpdir } from "node:os";
|
|
20782
|
-
import
|
|
20862
|
+
import path3 from "node:path";
|
|
20783
20863
|
import { pathToFileURL } from "node:url";
|
|
20784
20864
|
async function findConfigFile(cwd) {
|
|
20785
20865
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
20786
|
-
const filePath =
|
|
20866
|
+
const filePath = path3.join(cwd, fileName);
|
|
20787
20867
|
try {
|
|
20788
|
-
await
|
|
20868
|
+
await fs5.access(filePath);
|
|
20789
20869
|
return filePath;
|
|
20790
20870
|
} catch {}
|
|
20791
20871
|
}
|
|
@@ -20793,21 +20873,21 @@ async function findConfigFile(cwd) {
|
|
|
20793
20873
|
}
|
|
20794
20874
|
async function loadConfig2(configPath) {
|
|
20795
20875
|
const cwd = process.cwd();
|
|
20796
|
-
const resolvedPath = configPath ?
|
|
20876
|
+
const resolvedPath = configPath ? path3.resolve(cwd, configPath) : await findConfigFile(cwd);
|
|
20797
20877
|
if (!resolvedPath) {
|
|
20798
20878
|
throw new Error("No config file found. Create a secondlayer.config.ts file or specify a path with --config");
|
|
20799
20879
|
}
|
|
20800
20880
|
let config;
|
|
20801
20881
|
if (resolvedPath.endsWith(".ts")) {
|
|
20802
|
-
const code = await
|
|
20882
|
+
const code = await fs5.readFile(resolvedPath, "utf-8");
|
|
20803
20883
|
let replacementPath;
|
|
20804
20884
|
try {
|
|
20805
20885
|
const require2 = createRequire2(import.meta.url);
|
|
20806
20886
|
const packagePath = require2.resolve("@secondlayer/cli");
|
|
20807
20887
|
replacementPath = pathToFileURL(packagePath).href;
|
|
20808
20888
|
} catch {
|
|
20809
|
-
const currentModuleDir =
|
|
20810
|
-
const indexPath =
|
|
20889
|
+
const currentModuleDir = path3.dirname(new URL(import.meta.url).pathname);
|
|
20890
|
+
const indexPath = path3.resolve(currentModuleDir, "../index");
|
|
20811
20891
|
replacementPath = pathToFileURL(indexPath).href;
|
|
20812
20892
|
}
|
|
20813
20893
|
const transformedCode = code.replace(/from\s+["']@secondlayer\/cli["']/g, `from '${replacementPath}'`);
|
|
@@ -20817,14 +20897,14 @@ async function loadConfig2(configPath) {
|
|
|
20817
20897
|
target: "node18",
|
|
20818
20898
|
loader: "ts"
|
|
20819
20899
|
});
|
|
20820
|
-
const tempPath =
|
|
20821
|
-
await
|
|
20900
|
+
const tempPath = path3.join(tmpdir(), `secondlayer-config-${randomBytes(4).toString("hex")}.mjs`);
|
|
20901
|
+
await fs5.writeFile(tempPath, result.code);
|
|
20822
20902
|
try {
|
|
20823
20903
|
const fileUrl = pathToFileURL(tempPath).href;
|
|
20824
20904
|
const module = await import(fileUrl);
|
|
20825
20905
|
config = module.default;
|
|
20826
20906
|
} finally {
|
|
20827
|
-
await
|
|
20907
|
+
await fs5.unlink(tempPath).catch(() => {});
|
|
20828
20908
|
}
|
|
20829
20909
|
} else {
|
|
20830
20910
|
const fileUrl = pathToFileURL(resolvedPath).href;
|
|
@@ -21794,11 +21874,11 @@ var init_commands = __esm(() => {
|
|
|
21794
21874
|
});
|
|
21795
21875
|
|
|
21796
21876
|
// ../../node_modules/@antfu/ni/dist/shared/ni.B5qNAuoI.mjs
|
|
21797
|
-
import
|
|
21877
|
+
import path4, { join as join11, dirname as dirname12, resolve as resolve9 } from "node:path";
|
|
21798
21878
|
import process$1 from "node:process";
|
|
21799
21879
|
import require$$0 from "readline";
|
|
21800
21880
|
import require$$2 from "events";
|
|
21801
|
-
import
|
|
21881
|
+
import fs6, { promises, existsSync as existsSync6 } from "node:fs";
|
|
21802
21882
|
import require$$0$1 from "os";
|
|
21803
21883
|
import require$$1 from "tty";
|
|
21804
21884
|
import os4 from "node:os";
|
|
@@ -22030,32 +22110,32 @@ function requireKleur() {
|
|
|
22030
22110
|
}
|
|
22031
22111
|
const $ = {
|
|
22032
22112
|
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY),
|
|
22033
|
-
reset:
|
|
22034
|
-
bold:
|
|
22035
|
-
dim:
|
|
22036
|
-
italic:
|
|
22037
|
-
underline:
|
|
22038
|
-
inverse:
|
|
22039
|
-
hidden:
|
|
22040
|
-
strikethrough:
|
|
22041
|
-
black:
|
|
22042
|
-
red:
|
|
22043
|
-
green:
|
|
22044
|
-
yellow:
|
|
22045
|
-
blue:
|
|
22046
|
-
magenta:
|
|
22047
|
-
cyan:
|
|
22048
|
-
white:
|
|
22049
|
-
gray:
|
|
22050
|
-
grey:
|
|
22051
|
-
bgBlack:
|
|
22052
|
-
bgRed:
|
|
22053
|
-
bgGreen:
|
|
22054
|
-
bgYellow:
|
|
22055
|
-
bgBlue:
|
|
22056
|
-
bgMagenta:
|
|
22057
|
-
bgCyan:
|
|
22058
|
-
bgWhite:
|
|
22113
|
+
reset: init3(0, 0),
|
|
22114
|
+
bold: init3(1, 22),
|
|
22115
|
+
dim: init3(2, 22),
|
|
22116
|
+
italic: init3(3, 23),
|
|
22117
|
+
underline: init3(4, 24),
|
|
22118
|
+
inverse: init3(7, 27),
|
|
22119
|
+
hidden: init3(8, 28),
|
|
22120
|
+
strikethrough: init3(9, 29),
|
|
22121
|
+
black: init3(30, 39),
|
|
22122
|
+
red: init3(31, 39),
|
|
22123
|
+
green: init3(32, 39),
|
|
22124
|
+
yellow: init3(33, 39),
|
|
22125
|
+
blue: init3(34, 39),
|
|
22126
|
+
magenta: init3(35, 39),
|
|
22127
|
+
cyan: init3(36, 39),
|
|
22128
|
+
white: init3(37, 39),
|
|
22129
|
+
gray: init3(90, 39),
|
|
22130
|
+
grey: init3(90, 39),
|
|
22131
|
+
bgBlack: init3(40, 49),
|
|
22132
|
+
bgRed: init3(41, 49),
|
|
22133
|
+
bgGreen: init3(42, 49),
|
|
22134
|
+
bgYellow: init3(43, 49),
|
|
22135
|
+
bgBlue: init3(44, 49),
|
|
22136
|
+
bgMagenta: init3(45, 49),
|
|
22137
|
+
bgCyan: init3(46, 49),
|
|
22138
|
+
bgWhite: init3(47, 49)
|
|
22059
22139
|
};
|
|
22060
22140
|
function run(arr, str) {
|
|
22061
22141
|
let i2 = 0, tmp, beg = "", end = "";
|
|
@@ -22099,7 +22179,7 @@ function requireKleur() {
|
|
|
22099
22179
|
ctx.bgWhite = $.bgWhite.bind(ctx);
|
|
22100
22180
|
return ctx;
|
|
22101
22181
|
}
|
|
22102
|
-
function
|
|
22182
|
+
function init3(open, close) {
|
|
22103
22183
|
let blk = {
|
|
22104
22184
|
open: `\x1B[${open}m`,
|
|
22105
22185
|
close: `\x1B[${close}m`,
|
|
@@ -23754,11 +23834,11 @@ Instructions:
|
|
|
23754
23834
|
if (this.done) {
|
|
23755
23835
|
return this.value.filter((e2) => e2.selected).map((v2) => v2.title).join(", ");
|
|
23756
23836
|
}
|
|
23757
|
-
const
|
|
23837
|
+
const output2 = [color.gray(this.hint), this.renderInstructions()];
|
|
23758
23838
|
if (this.value[this.cursor].disabled) {
|
|
23759
|
-
|
|
23839
|
+
output2.push(color.yellow(this.warn));
|
|
23760
23840
|
}
|
|
23761
|
-
return
|
|
23841
|
+
return output2.join(" ");
|
|
23762
23842
|
}
|
|
23763
23843
|
render() {
|
|
23764
23844
|
if (this.closed)
|
|
@@ -24146,11 +24226,11 @@ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter so
|
|
|
24146
24226
|
if (this.done) {
|
|
24147
24227
|
return this.value.filter((e2) => e2.selected).map((v2) => v2.title).join(", ");
|
|
24148
24228
|
}
|
|
24149
|
-
const
|
|
24229
|
+
const output2 = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
|
|
24150
24230
|
if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
|
|
24151
|
-
|
|
24231
|
+
output2.push(color.yellow(this.warn));
|
|
24152
24232
|
}
|
|
24153
|
-
return
|
|
24233
|
+
return output2.join(" ");
|
|
24154
24234
|
}
|
|
24155
24235
|
render() {
|
|
24156
24236
|
if (this.closed)
|
|
@@ -24647,10 +24727,10 @@ function requirePosix() {
|
|
|
24647
24727
|
posix.sync = posix.isexe = undefined;
|
|
24648
24728
|
const fs_1 = require$$0$2;
|
|
24649
24729
|
const promises_1 = require$$1$1;
|
|
24650
|
-
const isexe = async (
|
|
24730
|
+
const isexe = async (path5, options2 = {}) => {
|
|
24651
24731
|
const { ignoreErrors = false } = options2;
|
|
24652
24732
|
try {
|
|
24653
|
-
return checkStat(await (0, promises_1.stat)(
|
|
24733
|
+
return checkStat(await (0, promises_1.stat)(path5), options2);
|
|
24654
24734
|
} catch (e2) {
|
|
24655
24735
|
const er = e2;
|
|
24656
24736
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -24659,10 +24739,10 @@ function requirePosix() {
|
|
|
24659
24739
|
}
|
|
24660
24740
|
};
|
|
24661
24741
|
posix.isexe = isexe;
|
|
24662
|
-
const sync = (
|
|
24742
|
+
const sync = (path5, options2 = {}) => {
|
|
24663
24743
|
const { ignoreErrors = false } = options2;
|
|
24664
24744
|
try {
|
|
24665
|
-
return checkStat((0, fs_1.statSync)(
|
|
24745
|
+
return checkStat((0, fs_1.statSync)(path5), options2);
|
|
24666
24746
|
} catch (e2) {
|
|
24667
24747
|
const er = e2;
|
|
24668
24748
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -24699,10 +24779,10 @@ function requireWin32() {
|
|
|
24699
24779
|
win32.sync = win32.isexe = undefined;
|
|
24700
24780
|
const fs_1 = require$$0$2;
|
|
24701
24781
|
const promises_1 = require$$1$1;
|
|
24702
|
-
const isexe = async (
|
|
24782
|
+
const isexe = async (path5, options2 = {}) => {
|
|
24703
24783
|
const { ignoreErrors = false } = options2;
|
|
24704
24784
|
try {
|
|
24705
|
-
return checkStat(await (0, promises_1.stat)(
|
|
24785
|
+
return checkStat(await (0, promises_1.stat)(path5), path5, options2);
|
|
24706
24786
|
} catch (e2) {
|
|
24707
24787
|
const er = e2;
|
|
24708
24788
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -24711,10 +24791,10 @@ function requireWin32() {
|
|
|
24711
24791
|
}
|
|
24712
24792
|
};
|
|
24713
24793
|
win32.isexe = isexe;
|
|
24714
|
-
const sync = (
|
|
24794
|
+
const sync = (path5, options2 = {}) => {
|
|
24715
24795
|
const { ignoreErrors = false } = options2;
|
|
24716
24796
|
try {
|
|
24717
|
-
return checkStat((0, fs_1.statSync)(
|
|
24797
|
+
return checkStat((0, fs_1.statSync)(path5), path5, options2);
|
|
24718
24798
|
} catch (e2) {
|
|
24719
24799
|
const er = e2;
|
|
24720
24800
|
if (ignoreErrors || er.code === "EACCES")
|
|
@@ -24723,7 +24803,7 @@ function requireWin32() {
|
|
|
24723
24803
|
}
|
|
24724
24804
|
};
|
|
24725
24805
|
win32.sync = sync;
|
|
24726
|
-
const checkPathExt = (
|
|
24806
|
+
const checkPathExt = (path5, options2) => {
|
|
24727
24807
|
const { pathExt = process.env.PATHEXT || "" } = options2;
|
|
24728
24808
|
const peSplit = pathExt.split(";");
|
|
24729
24809
|
if (peSplit.indexOf("") !== -1) {
|
|
@@ -24731,14 +24811,14 @@ function requireWin32() {
|
|
|
24731
24811
|
}
|
|
24732
24812
|
for (let i2 = 0;i2 < peSplit.length; i2++) {
|
|
24733
24813
|
const p2 = peSplit[i2].toLowerCase();
|
|
24734
|
-
const ext =
|
|
24814
|
+
const ext = path5.substring(path5.length - p2.length).toLowerCase();
|
|
24735
24815
|
if (p2 && ext === p2) {
|
|
24736
24816
|
return true;
|
|
24737
24817
|
}
|
|
24738
24818
|
}
|
|
24739
24819
|
return false;
|
|
24740
24820
|
};
|
|
24741
|
-
const checkStat = (stat2,
|
|
24821
|
+
const checkStat = (stat2, path5, options2) => stat2.isFile() && checkPathExt(path5, options2);
|
|
24742
24822
|
return win32;
|
|
24743
24823
|
}
|
|
24744
24824
|
function requireOptions() {
|
|
@@ -24988,7 +25068,7 @@ var init_ni_B5qNAuoI = __esm(() => {
|
|
|
24988
25068
|
CLI_TEMP_DIR = join11(os4.tmpdir(), "antfu-ni");
|
|
24989
25069
|
customRcPath = process$1.env.NI_CONFIG_FILE;
|
|
24990
25070
|
home = process$1.platform === "win32" ? process$1.env.USERPROFILE : process$1.env.HOME;
|
|
24991
|
-
defaultRcPath =
|
|
25071
|
+
defaultRcPath = path4.join(home || "~/", ".nirc");
|
|
24992
25072
|
});
|
|
24993
25073
|
|
|
24994
25074
|
// ../../node_modules/@antfu/ni/dist/index.mjs
|
|
@@ -25858,8 +25938,8 @@ var init_command = __esm(() => {
|
|
|
25858
25938
|
var require_windows = __commonJS((exports, module) => {
|
|
25859
25939
|
module.exports = isexe;
|
|
25860
25940
|
isexe.sync = sync;
|
|
25861
|
-
var
|
|
25862
|
-
function checkPathExt(
|
|
25941
|
+
var fs7 = __require("fs");
|
|
25942
|
+
function checkPathExt(path5, options3) {
|
|
25863
25943
|
var pathext = options3.pathExt !== undefined ? options3.pathExt : process.env.PATHEXT;
|
|
25864
25944
|
if (!pathext) {
|
|
25865
25945
|
return true;
|
|
@@ -25870,25 +25950,25 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
25870
25950
|
}
|
|
25871
25951
|
for (var i2 = 0;i2 < pathext.length; i2++) {
|
|
25872
25952
|
var p2 = pathext[i2].toLowerCase();
|
|
25873
|
-
if (p2 &&
|
|
25953
|
+
if (p2 && path5.substr(-p2.length).toLowerCase() === p2) {
|
|
25874
25954
|
return true;
|
|
25875
25955
|
}
|
|
25876
25956
|
}
|
|
25877
25957
|
return false;
|
|
25878
25958
|
}
|
|
25879
|
-
function checkStat(stat2,
|
|
25959
|
+
function checkStat(stat2, path5, options3) {
|
|
25880
25960
|
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
25881
25961
|
return false;
|
|
25882
25962
|
}
|
|
25883
|
-
return checkPathExt(
|
|
25963
|
+
return checkPathExt(path5, options3);
|
|
25884
25964
|
}
|
|
25885
|
-
function isexe(
|
|
25886
|
-
|
|
25887
|
-
cb(er, er ? false : checkStat(stat2,
|
|
25965
|
+
function isexe(path5, options3, cb) {
|
|
25966
|
+
fs7.stat(path5, function(er, stat2) {
|
|
25967
|
+
cb(er, er ? false : checkStat(stat2, path5, options3));
|
|
25888
25968
|
});
|
|
25889
25969
|
}
|
|
25890
|
-
function sync(
|
|
25891
|
-
return checkStat(
|
|
25970
|
+
function sync(path5, options3) {
|
|
25971
|
+
return checkStat(fs7.statSync(path5), path5, options3);
|
|
25892
25972
|
}
|
|
25893
25973
|
});
|
|
25894
25974
|
|
|
@@ -25896,14 +25976,14 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
25896
25976
|
var require_mode = __commonJS((exports, module) => {
|
|
25897
25977
|
module.exports = isexe;
|
|
25898
25978
|
isexe.sync = sync;
|
|
25899
|
-
var
|
|
25900
|
-
function isexe(
|
|
25901
|
-
|
|
25979
|
+
var fs7 = __require("fs");
|
|
25980
|
+
function isexe(path5, options3, cb) {
|
|
25981
|
+
fs7.stat(path5, function(er, stat2) {
|
|
25902
25982
|
cb(er, er ? false : checkStat(stat2, options3));
|
|
25903
25983
|
});
|
|
25904
25984
|
}
|
|
25905
|
-
function sync(
|
|
25906
|
-
return checkStat(
|
|
25985
|
+
function sync(path5, options3) {
|
|
25986
|
+
return checkStat(fs7.statSync(path5), options3);
|
|
25907
25987
|
}
|
|
25908
25988
|
function checkStat(stat2, options3) {
|
|
25909
25989
|
return stat2.isFile() && checkMode(stat2, options3);
|
|
@@ -25925,7 +26005,7 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
25925
26005
|
|
|
25926
26006
|
// ../../node_modules/isexe/index.js
|
|
25927
26007
|
var require_isexe = __commonJS((exports, module) => {
|
|
25928
|
-
var
|
|
26008
|
+
var fs7 = __require("fs");
|
|
25929
26009
|
var core2;
|
|
25930
26010
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
25931
26011
|
core2 = require_windows();
|
|
@@ -25934,7 +26014,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
25934
26014
|
}
|
|
25935
26015
|
module.exports = isexe;
|
|
25936
26016
|
isexe.sync = sync;
|
|
25937
|
-
function isexe(
|
|
26017
|
+
function isexe(path5, options3, cb) {
|
|
25938
26018
|
if (typeof options3 === "function") {
|
|
25939
26019
|
cb = options3;
|
|
25940
26020
|
options3 = {};
|
|
@@ -25944,7 +26024,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
25944
26024
|
throw new TypeError("callback not provided");
|
|
25945
26025
|
}
|
|
25946
26026
|
return new Promise(function(resolve10, reject) {
|
|
25947
|
-
isexe(
|
|
26027
|
+
isexe(path5, options3 || {}, function(er, is2) {
|
|
25948
26028
|
if (er) {
|
|
25949
26029
|
reject(er);
|
|
25950
26030
|
} else {
|
|
@@ -25953,7 +26033,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
25953
26033
|
});
|
|
25954
26034
|
});
|
|
25955
26035
|
}
|
|
25956
|
-
core2(
|
|
26036
|
+
core2(path5, options3 || {}, function(er, is2) {
|
|
25957
26037
|
if (er) {
|
|
25958
26038
|
if (er.code === "EACCES" || options3 && options3.ignoreErrors) {
|
|
25959
26039
|
er = null;
|
|
@@ -25963,9 +26043,9 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
25963
26043
|
cb(er, is2);
|
|
25964
26044
|
});
|
|
25965
26045
|
}
|
|
25966
|
-
function sync(
|
|
26046
|
+
function sync(path5, options3) {
|
|
25967
26047
|
try {
|
|
25968
|
-
return core2.sync(
|
|
26048
|
+
return core2.sync(path5, options3 || {});
|
|
25969
26049
|
} catch (er) {
|
|
25970
26050
|
if (options3 && options3.ignoreErrors || er.code === "EACCES") {
|
|
25971
26051
|
return false;
|
|
@@ -25979,7 +26059,7 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
25979
26059
|
// ../../node_modules/which/which.js
|
|
25980
26060
|
var require_which = __commonJS((exports, module) => {
|
|
25981
26061
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
25982
|
-
var
|
|
26062
|
+
var path5 = __require("path");
|
|
25983
26063
|
var COLON = isWindows ? ";" : ":";
|
|
25984
26064
|
var isexe = require_isexe();
|
|
25985
26065
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -26015,7 +26095,7 @@ var require_which = __commonJS((exports, module) => {
|
|
|
26015
26095
|
return opt.all && found.length ? resolve10(found) : reject(getNotFoundError(cmd));
|
|
26016
26096
|
const ppRaw = pathEnv[i2];
|
|
26017
26097
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
26018
|
-
const pCmd =
|
|
26098
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
26019
26099
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
26020
26100
|
resolve10(subStep(p2, i2, 0));
|
|
26021
26101
|
});
|
|
@@ -26042,7 +26122,7 @@ var require_which = __commonJS((exports, module) => {
|
|
|
26042
26122
|
for (let i2 = 0;i2 < pathEnv.length; i2++) {
|
|
26043
26123
|
const ppRaw = pathEnv[i2];
|
|
26044
26124
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
26045
|
-
const pCmd =
|
|
26125
|
+
const pCmd = path5.join(pathPart, cmd);
|
|
26046
26126
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
26047
26127
|
for (let j2 = 0;j2 < pathExt.length; j2++) {
|
|
26048
26128
|
const cur = p2 + pathExt[j2];
|
|
@@ -26083,7 +26163,7 @@ var require_path_key = __commonJS((exports, module) => {
|
|
|
26083
26163
|
|
|
26084
26164
|
// ../../node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
26085
26165
|
var require_resolveCommand = __commonJS((exports, module) => {
|
|
26086
|
-
var
|
|
26166
|
+
var path5 = __require("path");
|
|
26087
26167
|
var which2 = require_which();
|
|
26088
26168
|
var getPathKey = require_path_key();
|
|
26089
26169
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -26100,7 +26180,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
|
|
|
26100
26180
|
try {
|
|
26101
26181
|
resolved = which2.sync(parsed.command, {
|
|
26102
26182
|
path: env2[getPathKey({ env: env2 })],
|
|
26103
|
-
pathExt: withoutPathExt ?
|
|
26183
|
+
pathExt: withoutPathExt ? path5.delimiter : undefined
|
|
26104
26184
|
});
|
|
26105
26185
|
} catch (e2) {} finally {
|
|
26106
26186
|
if (shouldSwitchCwd) {
|
|
@@ -26108,7 +26188,7 @@ var require_resolveCommand = __commonJS((exports, module) => {
|
|
|
26108
26188
|
}
|
|
26109
26189
|
}
|
|
26110
26190
|
if (resolved) {
|
|
26111
|
-
resolved =
|
|
26191
|
+
resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
26112
26192
|
}
|
|
26113
26193
|
return resolved;
|
|
26114
26194
|
}
|
|
@@ -26153,8 +26233,8 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
26153
26233
|
if (!match) {
|
|
26154
26234
|
return null;
|
|
26155
26235
|
}
|
|
26156
|
-
const [
|
|
26157
|
-
const binary =
|
|
26236
|
+
const [path5, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
26237
|
+
const binary = path5.split("/").pop();
|
|
26158
26238
|
if (binary === "env") {
|
|
26159
26239
|
return argument;
|
|
26160
26240
|
}
|
|
@@ -26164,16 +26244,16 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
26164
26244
|
|
|
26165
26245
|
// ../../node_modules/cross-spawn/lib/util/readShebang.js
|
|
26166
26246
|
var require_readShebang = __commonJS((exports, module) => {
|
|
26167
|
-
var
|
|
26247
|
+
var fs7 = __require("fs");
|
|
26168
26248
|
var shebangCommand = require_shebang_command();
|
|
26169
26249
|
function readShebang(command) {
|
|
26170
26250
|
const size2 = 150;
|
|
26171
26251
|
const buffer2 = Buffer.alloc(size2);
|
|
26172
26252
|
let fd;
|
|
26173
26253
|
try {
|
|
26174
|
-
fd =
|
|
26175
|
-
|
|
26176
|
-
|
|
26254
|
+
fd = fs7.openSync(command, "r");
|
|
26255
|
+
fs7.readSync(fd, buffer2, 0, size2, 0);
|
|
26256
|
+
fs7.closeSync(fd);
|
|
26177
26257
|
} catch (e2) {}
|
|
26178
26258
|
return shebangCommand(buffer2.toString());
|
|
26179
26259
|
}
|
|
@@ -26182,7 +26262,7 @@ var require_readShebang = __commonJS((exports, module) => {
|
|
|
26182
26262
|
|
|
26183
26263
|
// ../../node_modules/cross-spawn/lib/parse.js
|
|
26184
26264
|
var require_parse3 = __commonJS((exports, module) => {
|
|
26185
|
-
var
|
|
26265
|
+
var path5 = __require("path");
|
|
26186
26266
|
var resolveCommand2 = require_resolveCommand();
|
|
26187
26267
|
var escape2 = require_escape();
|
|
26188
26268
|
var readShebang = require_readShebang();
|
|
@@ -26207,7 +26287,7 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
26207
26287
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
26208
26288
|
if (parsed.options.forceShell || needsShell) {
|
|
26209
26289
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
26210
|
-
parsed.command =
|
|
26290
|
+
parsed.command = path5.normalize(parsed.command);
|
|
26211
26291
|
parsed.command = escape2.command(parsed.command);
|
|
26212
26292
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
26213
26293
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -26324,7 +26404,7 @@ function pathKey(options3 = {}) {
|
|
|
26324
26404
|
// ../../node_modules/unicorn-magic/node.js
|
|
26325
26405
|
import { promisify as promisify4 } from "node:util";
|
|
26326
26406
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
26327
|
-
import
|
|
26407
|
+
import path5 from "node:path";
|
|
26328
26408
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
26329
26409
|
function toPath(urlOrPath) {
|
|
26330
26410
|
return urlOrPath instanceof URL ? fileURLToPath4(urlOrPath) : urlOrPath;
|
|
@@ -26332,12 +26412,12 @@ function toPath(urlOrPath) {
|
|
|
26332
26412
|
function traversePathUp(startPath) {
|
|
26333
26413
|
return {
|
|
26334
26414
|
*[Symbol.iterator]() {
|
|
26335
|
-
let currentPath =
|
|
26415
|
+
let currentPath = path5.resolve(toPath(startPath));
|
|
26336
26416
|
let previousPath;
|
|
26337
26417
|
while (previousPath !== currentPath) {
|
|
26338
26418
|
yield currentPath;
|
|
26339
26419
|
previousPath = currentPath;
|
|
26340
|
-
currentPath =
|
|
26420
|
+
currentPath = path5.resolve(currentPath, "..");
|
|
26341
26421
|
}
|
|
26342
26422
|
}
|
|
26343
26423
|
};
|
|
@@ -26350,7 +26430,7 @@ var init_node = __esm(() => {
|
|
|
26350
26430
|
|
|
26351
26431
|
// ../../node_modules/npm-run-path/index.js
|
|
26352
26432
|
import process7 from "node:process";
|
|
26353
|
-
import
|
|
26433
|
+
import path6 from "node:path";
|
|
26354
26434
|
var npmRunPath = ({
|
|
26355
26435
|
cwd = process7.cwd(),
|
|
26356
26436
|
path: pathOption = process7.env[pathKey()],
|
|
@@ -26358,25 +26438,25 @@ var npmRunPath = ({
|
|
|
26358
26438
|
execPath = process7.execPath,
|
|
26359
26439
|
addExecPath = true
|
|
26360
26440
|
} = {}) => {
|
|
26361
|
-
const cwdPath =
|
|
26441
|
+
const cwdPath = path6.resolve(toPath(cwd));
|
|
26362
26442
|
const result = [];
|
|
26363
|
-
const pathParts = pathOption.split(
|
|
26443
|
+
const pathParts = pathOption.split(path6.delimiter);
|
|
26364
26444
|
if (preferLocal) {
|
|
26365
26445
|
applyPreferLocal(result, pathParts, cwdPath);
|
|
26366
26446
|
}
|
|
26367
26447
|
if (addExecPath) {
|
|
26368
26448
|
applyExecPath(result, pathParts, execPath, cwdPath);
|
|
26369
26449
|
}
|
|
26370
|
-
return pathOption === "" || pathOption ===
|
|
26450
|
+
return pathOption === "" || pathOption === path6.delimiter ? `${result.join(path6.delimiter)}${pathOption}` : [...result, pathOption].join(path6.delimiter);
|
|
26371
26451
|
}, applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
26372
26452
|
for (const directory of traversePathUp(cwdPath)) {
|
|
26373
|
-
const pathPart =
|
|
26453
|
+
const pathPart = path6.join(directory, "node_modules/.bin");
|
|
26374
26454
|
if (!pathParts.includes(pathPart)) {
|
|
26375
26455
|
result.push(pathPart);
|
|
26376
26456
|
}
|
|
26377
26457
|
}
|
|
26378
26458
|
}, applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
26379
|
-
const pathPart =
|
|
26459
|
+
const pathPart = path6.resolve(cwdPath, toPath(execPath), "..");
|
|
26380
26460
|
if (!pathParts.includes(pathPart)) {
|
|
26381
26461
|
result.push(pathPart);
|
|
26382
26462
|
}
|
|
@@ -27486,7 +27566,7 @@ var init_timeout = __esm(() => {
|
|
|
27486
27566
|
|
|
27487
27567
|
// ../../node_modules/execa/lib/methods/node.js
|
|
27488
27568
|
import { execPath, execArgv } from "node:process";
|
|
27489
|
-
import
|
|
27569
|
+
import path7 from "node:path";
|
|
27490
27570
|
var mapNode = ({ options: options3 }) => {
|
|
27491
27571
|
if (options3.node === false) {
|
|
27492
27572
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -27504,7 +27584,7 @@ var mapNode = ({ options: options3 }) => {
|
|
|
27504
27584
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
27505
27585
|
}
|
|
27506
27586
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
|
|
27507
|
-
const resolvedNodePath =
|
|
27587
|
+
const resolvedNodePath = path7.resolve(cwd, normalizedNodePath);
|
|
27508
27588
|
const newOptions = {
|
|
27509
27589
|
...options3,
|
|
27510
27590
|
nodePath: resolvedNodePath,
|
|
@@ -27514,7 +27594,7 @@ var mapNode = ({ options: options3 }) => {
|
|
|
27514
27594
|
if (!shouldHandleNode) {
|
|
27515
27595
|
return [file, commandArguments, newOptions];
|
|
27516
27596
|
}
|
|
27517
|
-
if (
|
|
27597
|
+
if (path7.basename(file, ".exe") === "node") {
|
|
27518
27598
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
27519
27599
|
}
|
|
27520
27600
|
return [
|
|
@@ -27605,11 +27685,11 @@ var init_encoding_option = __esm(() => {
|
|
|
27605
27685
|
|
|
27606
27686
|
// ../../node_modules/execa/lib/arguments/cwd.js
|
|
27607
27687
|
import { statSync as statSync2 } from "node:fs";
|
|
27608
|
-
import
|
|
27688
|
+
import path8 from "node:path";
|
|
27609
27689
|
import process8 from "node:process";
|
|
27610
27690
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
27611
27691
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
27612
|
-
return
|
|
27692
|
+
return path8.resolve(cwdString);
|
|
27613
27693
|
}, getDefaultCwd = () => {
|
|
27614
27694
|
try {
|
|
27615
27695
|
return process8.cwd();
|
|
@@ -27641,7 +27721,7 @@ var init_cwd = __esm(() => {
|
|
|
27641
27721
|
});
|
|
27642
27722
|
|
|
27643
27723
|
// ../../node_modules/execa/lib/arguments/options.js
|
|
27644
|
-
import
|
|
27724
|
+
import path9 from "node:path";
|
|
27645
27725
|
import process9 from "node:process";
|
|
27646
27726
|
var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
27647
27727
|
rawOptions.cwd = normalizeCwd(rawOptions.cwd);
|
|
@@ -27659,7 +27739,7 @@ var import_cross_spawn, normalizeOptions = (filePath, rawArguments, rawOptions)
|
|
|
27659
27739
|
options3.killSignal = normalizeKillSignal(options3.killSignal);
|
|
27660
27740
|
options3.forceKillAfterDelay = normalizeForceKillAfterDelay(options3.forceKillAfterDelay);
|
|
27661
27741
|
options3.lines = options3.lines.map((lines2, fdNumber) => lines2 && !BINARY_ENCODINGS.has(options3.encoding) && options3.buffer[fdNumber]);
|
|
27662
|
-
if (process9.platform === "win32" &&
|
|
27742
|
+
if (process9.platform === "win32" && path9.basename(file, ".exe") === "cmd") {
|
|
27663
27743
|
commandArguments.unshift("/q");
|
|
27664
27744
|
}
|
|
27665
27745
|
return { file, commandArguments, options: options3 };
|
|
@@ -27907,7 +27987,7 @@ var handleMaxBuffer = ({ error: error2, stream: stream2, readableObjectMode, lin
|
|
|
27907
27987
|
return { streamName: "IPC output", threshold, unit: "messages" };
|
|
27908
27988
|
}
|
|
27909
27989
|
return { streamName: getStreamName(fdNumber), threshold, unit };
|
|
27910
|
-
}, isMaxBufferSync = (resultError,
|
|
27990
|
+
}, isMaxBufferSync = (resultError, output2, maxBuffer) => resultError?.code === "ENOBUFS" && output2 !== null && output2.some((result) => result !== null && result.length > getMaxBufferSync(maxBuffer)), truncateMaxBufferSync = (result, isMaxBuffer, maxBuffer) => {
|
|
27911
27991
|
if (!isMaxBuffer) {
|
|
27912
27992
|
return result;
|
|
27913
27993
|
}
|
|
@@ -29443,13 +29523,13 @@ var init_output2 = __esm(() => {
|
|
|
29443
29523
|
|
|
29444
29524
|
// ../../node_modules/execa/lib/io/output-sync.js
|
|
29445
29525
|
import { writeFileSync as writeFileSync5, appendFileSync } from "node:fs";
|
|
29446
|
-
var transformOutputSync = ({ fileDescriptors, syncResult: { output }, options: options3, isMaxBuffer, verboseInfo }) => {
|
|
29447
|
-
if (
|
|
29526
|
+
var transformOutputSync = ({ fileDescriptors, syncResult: { output: output2 }, options: options3, isMaxBuffer, verboseInfo }) => {
|
|
29527
|
+
if (output2 === null) {
|
|
29448
29528
|
return { output: Array.from({ length: 3 }) };
|
|
29449
29529
|
}
|
|
29450
29530
|
const state = {};
|
|
29451
29531
|
const outputFiles = new Set([]);
|
|
29452
|
-
const transformedOutput =
|
|
29532
|
+
const transformedOutput = output2.map((result, fdNumber) => transformOutputResultSync({
|
|
29453
29533
|
result,
|
|
29454
29534
|
fileDescriptors,
|
|
29455
29535
|
fdNumber,
|
|
@@ -29529,13 +29609,13 @@ var transformOutputSync = ({ fileDescriptors, syncResult: { output }, options: o
|
|
|
29529
29609
|
state.error ??= error2;
|
|
29530
29610
|
}
|
|
29531
29611
|
}, writeToFiles = (serializedResult, stdioItems, outputFiles) => {
|
|
29532
|
-
for (const { path:
|
|
29533
|
-
const pathString = typeof
|
|
29612
|
+
for (const { path: path10, append } of stdioItems.filter(({ type }) => FILE_TYPES.has(type))) {
|
|
29613
|
+
const pathString = typeof path10 === "string" ? path10 : path10.toString();
|
|
29534
29614
|
if (append || outputFiles.has(pathString)) {
|
|
29535
|
-
appendFileSync(
|
|
29615
|
+
appendFileSync(path10, serializedResult);
|
|
29536
29616
|
} else {
|
|
29537
29617
|
outputFiles.add(pathString);
|
|
29538
|
-
writeFileSync5(
|
|
29618
|
+
writeFileSync5(path10, serializedResult);
|
|
29539
29619
|
}
|
|
29540
29620
|
}
|
|
29541
29621
|
};
|
|
@@ -29608,10 +29688,10 @@ var init_exit_async = __esm(() => {
|
|
|
29608
29688
|
});
|
|
29609
29689
|
|
|
29610
29690
|
// ../../node_modules/execa/lib/resolve/exit-sync.js
|
|
29611
|
-
var getExitResultSync = ({ error: error2, status: exitCode, signal, output }, { maxBuffer }) => {
|
|
29691
|
+
var getExitResultSync = ({ error: error2, status: exitCode, signal, output: output2 }, { maxBuffer }) => {
|
|
29612
29692
|
const resultError = getResultError(error2, exitCode, signal);
|
|
29613
29693
|
const timedOut2 = resultError?.code === "ETIMEDOUT";
|
|
29614
|
-
const isMaxBuffer = isMaxBufferSync(resultError,
|
|
29694
|
+
const isMaxBuffer = isMaxBufferSync(resultError, output2, maxBuffer);
|
|
29615
29695
|
return {
|
|
29616
29696
|
resultError,
|
|
29617
29697
|
exitCode,
|
|
@@ -29691,15 +29771,15 @@ var execaCoreSync = (rawFile, rawArguments, rawOptions) => {
|
|
|
29691
29771
|
return syncResult;
|
|
29692
29772
|
}
|
|
29693
29773
|
const { resultError, exitCode, signal, timedOut: timedOut2, isMaxBuffer } = getExitResultSync(syncResult, options3);
|
|
29694
|
-
const { output, error: error2 = resultError } = transformOutputSync({
|
|
29774
|
+
const { output: output2, error: error2 = resultError } = transformOutputSync({
|
|
29695
29775
|
fileDescriptors,
|
|
29696
29776
|
syncResult,
|
|
29697
29777
|
options: options3,
|
|
29698
29778
|
isMaxBuffer,
|
|
29699
29779
|
verboseInfo
|
|
29700
29780
|
});
|
|
29701
|
-
const stdio =
|
|
29702
|
-
const all2 = stripNewline(getAllSync(
|
|
29781
|
+
const stdio = output2.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options3, fdNumber));
|
|
29782
|
+
const all2 = stripNewline(getAllSync(output2, options3), options3, "all");
|
|
29703
29783
|
return getSyncResult({
|
|
29704
29784
|
error: error2,
|
|
29705
29785
|
exitCode,
|
|
@@ -30924,7 +31004,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
30924
31004
|
stripFinalNewline: stripFinalNewlineValue,
|
|
30925
31005
|
allMixed
|
|
30926
31006
|
});
|
|
30927
|
-
const [
|
|
31007
|
+
const [output2] = await Promise.all([
|
|
30928
31008
|
getStreamContents({
|
|
30929
31009
|
stream: stream2,
|
|
30930
31010
|
iterable,
|
|
@@ -30935,7 +31015,7 @@ var getStreamOutput = async ({ stream: stream2, onStreamEnd, fdNumber, encoding,
|
|
|
30935
31015
|
}),
|
|
30936
31016
|
logPromise
|
|
30937
31017
|
]);
|
|
30938
|
-
return
|
|
31018
|
+
return output2;
|
|
30939
31019
|
}, logOutputAsync = async ({ stream: stream2, onStreamEnd, fdNumber, encoding, allMixed, verboseInfo, streamInfo: { fileDescriptors } }) => {
|
|
30940
31020
|
if (!shouldLogOutput({
|
|
30941
31021
|
stdioItems: fileDescriptors[fdNumber]?.stdioItems,
|
|
@@ -31061,7 +31141,7 @@ var waitForStdioStreams = ({ subprocess, encoding, buffer: buffer2, maxBuffer, l
|
|
|
31061
31141
|
await onStreamEnd;
|
|
31062
31142
|
return;
|
|
31063
31143
|
}
|
|
31064
|
-
const [
|
|
31144
|
+
const [output2] = await Promise.all([
|
|
31065
31145
|
getStreamOutput({
|
|
31066
31146
|
stream: stream2,
|
|
31067
31147
|
onStreamEnd,
|
|
@@ -31077,7 +31157,7 @@ var waitForStdioStreams = ({ subprocess, encoding, buffer: buffer2, maxBuffer, l
|
|
|
31077
31157
|
}),
|
|
31078
31158
|
onStreamEnd
|
|
31079
31159
|
]);
|
|
31080
|
-
return
|
|
31160
|
+
return output2;
|
|
31081
31161
|
};
|
|
31082
31162
|
var init_stdio = __esm(() => {
|
|
31083
31163
|
init_contents();
|
|
@@ -31938,8 +32018,8 @@ var init_execa = __esm(() => {
|
|
|
31938
32018
|
});
|
|
31939
32019
|
|
|
31940
32020
|
// src/utils/dependencies.ts
|
|
31941
|
-
import { promises as
|
|
31942
|
-
import
|
|
32021
|
+
import { promises as fs7 } from "node:fs";
|
|
32022
|
+
import path10 from "node:path";
|
|
31943
32023
|
async function getPackageManager(targetDir) {
|
|
31944
32024
|
const packageManager = await detect2({ programmatic: true, cwd: targetDir });
|
|
31945
32025
|
if (packageManager === "yarn@berry")
|
|
@@ -31954,16 +32034,16 @@ async function getPackageManager(targetDir) {
|
|
|
31954
32034
|
}
|
|
31955
32035
|
async function hasPackageJson(targetDir) {
|
|
31956
32036
|
try {
|
|
31957
|
-
const packageJsonPath =
|
|
31958
|
-
await
|
|
32037
|
+
const packageJsonPath = path10.join(targetDir, "package.json");
|
|
32038
|
+
await fs7.access(packageJsonPath);
|
|
31959
32039
|
return true;
|
|
31960
32040
|
} catch {
|
|
31961
32041
|
return false;
|
|
31962
32042
|
}
|
|
31963
32043
|
}
|
|
31964
32044
|
async function readPackageJson(targetDir) {
|
|
31965
|
-
const packageJsonPath =
|
|
31966
|
-
const content = await
|
|
32045
|
+
const packageJsonPath = path10.join(targetDir, "package.json");
|
|
32046
|
+
const content = await fs7.readFile(packageJsonPath, "utf-8");
|
|
31967
32047
|
return JSON.parse(content);
|
|
31968
32048
|
}
|
|
31969
32049
|
async function getMissingDependenciesFor(targetDir, requiredDeps) {
|
|
@@ -32016,7 +32096,7 @@ __export(exports_generate, {
|
|
|
32016
32096
|
resolveContract: () => resolveContract,
|
|
32017
32097
|
generate: () => generate
|
|
32018
32098
|
});
|
|
32019
|
-
import
|
|
32099
|
+
import path11 from "node:path";
|
|
32020
32100
|
import { getErrorMessage as getErrorMessage2 } from "@secondlayer/shared";
|
|
32021
32101
|
import { toCamelCase as toCamelCase8 } from "@secondlayer/stacks/clarity";
|
|
32022
32102
|
function isContractAddress(input5) {
|
|
@@ -32041,7 +32121,7 @@ async function parseInputs(inputs) {
|
|
|
32041
32121
|
continue;
|
|
32042
32122
|
}
|
|
32043
32123
|
if (input5.endsWith(".clar")) {
|
|
32044
|
-
const absolutePath =
|
|
32124
|
+
const absolutePath = path11.resolve(process.cwd(), input5);
|
|
32045
32125
|
files.push(absolutePath);
|
|
32046
32126
|
}
|
|
32047
32127
|
}
|
|
@@ -32051,7 +32131,7 @@ async function parseInputs(inputs) {
|
|
|
32051
32131
|
};
|
|
32052
32132
|
}
|
|
32053
32133
|
function deriveContractName(filePath) {
|
|
32054
|
-
const basename =
|
|
32134
|
+
const basename = path11.basename(filePath, ".clar");
|
|
32055
32135
|
return basename.replace(/[-_](.)/g, (_2, char) => char.toUpperCase()).replace(/^(.)/, (_2, char) => char.toLowerCase()).replace(/^\d/, "_$&");
|
|
32056
32136
|
}
|
|
32057
32137
|
async function buildConfigFromInputs(parsedInputs, outPath, apiKey, defaultAddress) {
|
|
@@ -32178,9 +32258,9 @@ ${getErrorMessage2(error2)}`));
|
|
|
32178
32258
|
}
|
|
32179
32259
|
async function resolveContract(source, network, apiKey, apiUrl) {
|
|
32180
32260
|
if (source.source) {
|
|
32181
|
-
const filePath =
|
|
32261
|
+
const filePath = path11.resolve(process.cwd(), source.source);
|
|
32182
32262
|
const abi = await parseClarityFile(filePath);
|
|
32183
|
-
const name = source.name ||
|
|
32263
|
+
const name = source.name || path11.basename(source.source, ".clar").replace(/-/g, "_").replace(/^\d/, "_$&");
|
|
32184
32264
|
const address = typeof source.address === "string" ? source.address : source.address?.[network] || DEFAULT_DEVNET_ADDRESS;
|
|
32185
32265
|
const { address: contractAddress, contractName } = address.includes(".") ? parseContractId(address) : { address, contractName: name };
|
|
32186
32266
|
return {
|
|
@@ -32256,56 +32336,6 @@ var init_generate = __esm(() => {
|
|
|
32256
32336
|
import_fast_glob = __toESM(require_out4(), 1);
|
|
32257
32337
|
});
|
|
32258
32338
|
|
|
32259
|
-
// src/commands/init.ts
|
|
32260
|
-
var exports_init = {};
|
|
32261
|
-
__export(exports_init, {
|
|
32262
|
-
init: () => init2
|
|
32263
|
-
});
|
|
32264
|
-
import { promises as fs7 } from "node:fs";
|
|
32265
|
-
import path11 from "node:path";
|
|
32266
|
-
async function init2() {
|
|
32267
|
-
const configPath = path11.join(process.cwd(), "secondlayer.config.ts");
|
|
32268
|
-
try {
|
|
32269
|
-
await fs7.access(configPath);
|
|
32270
|
-
console.log(source_default3.yellow("⚠ secondlayer.config.ts already exists"));
|
|
32271
|
-
return;
|
|
32272
|
-
} catch {}
|
|
32273
|
-
const hasClarinetProject = await fileExists2("./Clarinet.toml");
|
|
32274
|
-
let config;
|
|
32275
|
-
if (hasClarinetProject) {
|
|
32276
|
-
config = `import { defineConfig } from '@secondlayer/cli';
|
|
32277
|
-
import { clarinet } from '@secondlayer/cli/plugins';
|
|
32278
|
-
|
|
32279
|
-
export default defineConfig({
|
|
32280
|
-
out: './src/generated/contracts.ts',
|
|
32281
|
-
plugins: [
|
|
32282
|
-
clarinet() // Found Clarinet.toml in current directory
|
|
32283
|
-
]
|
|
32284
|
-
});`;
|
|
32285
|
-
} else {
|
|
32286
|
-
config = `import { defineConfig } from '@secondlayer/cli';
|
|
32287
|
-
|
|
32288
|
-
export default defineConfig({
|
|
32289
|
-
out: './src/generated/contracts.ts',
|
|
32290
|
-
plugins: [],
|
|
32291
|
-
});`;
|
|
32292
|
-
}
|
|
32293
|
-
await fs7.writeFile(configPath, config);
|
|
32294
|
-
console.log(source_default3.green("✓ Created `secondlayer.config.ts`"));
|
|
32295
|
-
console.log("\nRun `secondlayer generate` to generate type-safe interfaces, functions, and hooks!");
|
|
32296
|
-
}
|
|
32297
|
-
async function fileExists2(filePath) {
|
|
32298
|
-
try {
|
|
32299
|
-
await fs7.access(filePath);
|
|
32300
|
-
return true;
|
|
32301
|
-
} catch {
|
|
32302
|
-
return false;
|
|
32303
|
-
}
|
|
32304
|
-
}
|
|
32305
|
-
var init_init = __esm(() => {
|
|
32306
|
-
init_source4();
|
|
32307
|
-
});
|
|
32308
|
-
|
|
32309
32339
|
// ../../node_modules/commander/esm.mjs
|
|
32310
32340
|
var import__ = __toESM(require_commander(), 1);
|
|
32311
32341
|
var {
|
|
@@ -32324,7 +32354,7 @@ var {
|
|
|
32324
32354
|
// package.json
|
|
32325
32355
|
var package_default = {
|
|
32326
32356
|
name: "@secondlayer/cli",
|
|
32327
|
-
version: "
|
|
32357
|
+
version: "6.0.0",
|
|
32328
32358
|
repository: {
|
|
32329
32359
|
type: "git",
|
|
32330
32360
|
url: "git+https://github.com/ryanwaits/secondlayer.git",
|
|
@@ -32373,10 +32403,10 @@ var package_default = {
|
|
|
32373
32403
|
dependencies: {
|
|
32374
32404
|
"@inquirer/prompts": "^8.2.0",
|
|
32375
32405
|
"@secondlayer/bundler": "^0.3.7",
|
|
32376
|
-
"@secondlayer/sdk": "^5.
|
|
32406
|
+
"@secondlayer/sdk": "^5.8.0",
|
|
32377
32407
|
"@secondlayer/shared": "^6.10.0",
|
|
32378
32408
|
"@secondlayer/stacks": "^2.3.0",
|
|
32379
|
-
"@secondlayer/subgraphs": "^3.
|
|
32409
|
+
"@secondlayer/subgraphs": "^3.5.0",
|
|
32380
32410
|
"@biomejs/js-api": "^0.7.0",
|
|
32381
32411
|
"@biomejs/wasm-nodejs": "^1.9.0",
|
|
32382
32412
|
esbuild: "^0.19.0",
|
|
@@ -32402,7 +32432,7 @@ var package_default = {
|
|
|
32402
32432
|
import { ApiError, SecondLayer } from "@secondlayer/sdk";
|
|
32403
32433
|
|
|
32404
32434
|
// src/lib/http.ts
|
|
32405
|
-
|
|
32435
|
+
init_resolve_auth();
|
|
32406
32436
|
|
|
32407
32437
|
class CliHttpError extends Error {
|
|
32408
32438
|
status;
|
|
@@ -32416,7 +32446,6 @@ class CliHttpError extends Error {
|
|
|
32416
32446
|
this.body = body;
|
|
32417
32447
|
}
|
|
32418
32448
|
}
|
|
32419
|
-
var PLATFORM_API_URL = process.env.SL_PLATFORM_API_URL ?? "https://api.secondlayer.tools";
|
|
32420
32449
|
var REQUEST_TIMEOUT_MS = 30000;
|
|
32421
32450
|
async function request(url, opts) {
|
|
32422
32451
|
const headers = {
|
|
@@ -32447,33 +32476,49 @@ async function request(url, opts) {
|
|
|
32447
32476
|
return await res.json();
|
|
32448
32477
|
}
|
|
32449
32478
|
async function httpPlatform(path2, opts = {}) {
|
|
32450
|
-
|
|
32451
|
-
|
|
32479
|
+
let auth;
|
|
32480
|
+
try {
|
|
32481
|
+
auth = await resolveAuth();
|
|
32482
|
+
} catch {
|
|
32452
32483
|
throw new CliHttpError(401, "SESSION_EXPIRED", { error: "Not logged in" }, "Not logged in — run `sl login`");
|
|
32453
32484
|
}
|
|
32454
|
-
return request(`${
|
|
32485
|
+
return request(`${auth.apiUrl}${path2}`, {
|
|
32455
32486
|
...opts,
|
|
32456
|
-
bearer:
|
|
32487
|
+
bearer: auth.ephemeralKey
|
|
32457
32488
|
});
|
|
32458
32489
|
}
|
|
32459
32490
|
async function httpPlatformAnon(path2, opts = {}) {
|
|
32460
|
-
return request(`${
|
|
32491
|
+
return request(`${resolveApiUrl()}${path2}`, opts);
|
|
32461
32492
|
}
|
|
32462
32493
|
|
|
32463
32494
|
// src/lib/api-client.ts
|
|
32495
|
+
init_output();
|
|
32464
32496
|
init_resolve_auth();
|
|
32497
|
+
function nextStepHint(status) {
|
|
32498
|
+
if (status === undefined)
|
|
32499
|
+
return;
|
|
32500
|
+
if (status === 403)
|
|
32501
|
+
return "You may not have access — check your active project with `sl whoami`.";
|
|
32502
|
+
if (status === 404)
|
|
32503
|
+
return "Check the name/slug — run the matching `list` command to see what exists.";
|
|
32504
|
+
if (status === 400 || status === 422)
|
|
32505
|
+
return "Check the command arguments and flags — see `--help` for the expected format.";
|
|
32506
|
+
if (status === 429)
|
|
32507
|
+
return "Rate limited — wait a moment and retry.";
|
|
32508
|
+
if (status >= 500)
|
|
32509
|
+
return "Server error — retry shortly, or check `sl status`.";
|
|
32510
|
+
return;
|
|
32511
|
+
}
|
|
32465
32512
|
function handleApiError(err, action) {
|
|
32466
|
-
|
|
32467
|
-
|
|
32468
|
-
|
|
32469
|
-
|
|
32470
|
-
}
|
|
32471
|
-
}
|
|
32472
|
-
if (err instanceof ApiError && err.status === 401) {
|
|
32473
|
-
console.error("Authentication required. Run: sl login");
|
|
32513
|
+
const status = err instanceof ApiError || err instanceof CliHttpError ? err.status : undefined;
|
|
32514
|
+
if (err instanceof CliHttpError && err.code === "SESSION_EXPIRED" || status === 401) {
|
|
32515
|
+
printError("Authentication required.", {
|
|
32516
|
+
hint: "Run `sl login` to re-authenticate."
|
|
32517
|
+
});
|
|
32474
32518
|
process.exit(1);
|
|
32475
32519
|
}
|
|
32476
|
-
|
|
32520
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
32521
|
+
printError(`Failed to ${action}: ${detail}`, { hint: nextStepHint(status) });
|
|
32477
32522
|
process.exit(1);
|
|
32478
32523
|
}
|
|
32479
32524
|
function withErrorHandling(fn, options) {
|
|
@@ -32541,105 +32586,127 @@ async function updateAccountProfile(data) {
|
|
|
32541
32586
|
|
|
32542
32587
|
// src/commands/account.ts
|
|
32543
32588
|
init_output();
|
|
32544
|
-
|
|
32545
|
-
|
|
32546
|
-
|
|
32547
|
-
|
|
32548
|
-
|
|
32549
|
-
|
|
32550
|
-
|
|
32551
|
-
|
|
32552
|
-
|
|
32553
|
-
|
|
32554
|
-
|
|
32555
|
-
data.slug = options.slug;
|
|
32556
|
-
const updated = await updateAccountProfile(data);
|
|
32557
|
-
if (options.json) {
|
|
32558
|
-
console.log(JSON.stringify(updated, null, 2));
|
|
32559
|
-
return;
|
|
32560
|
-
}
|
|
32561
|
-
success("Profile updated");
|
|
32562
|
-
console.log(formatKeyValue([
|
|
32563
|
-
["Display Name", updated.displayName ?? dim("—")],
|
|
32564
|
-
["Bio", updated.bio ?? dim("—")],
|
|
32565
|
-
["Slug", updated.slug ?? dim("—")]
|
|
32566
|
-
]));
|
|
32567
|
-
return;
|
|
32568
|
-
}
|
|
32569
|
-
const profile = await getAccountProfile();
|
|
32570
|
-
if (options.json) {
|
|
32571
|
-
console.log(JSON.stringify(profile, null, 2));
|
|
32572
|
-
return;
|
|
32589
|
+
|
|
32590
|
+
// src/commands/billing.ts
|
|
32591
|
+
init_output();
|
|
32592
|
+
async function runBillingStatus(json) {
|
|
32593
|
+
let res;
|
|
32594
|
+
try {
|
|
32595
|
+
res = await httpPlatform("/api/billing/status");
|
|
32596
|
+
} catch (err) {
|
|
32597
|
+
if (err instanceof CliHttpError) {
|
|
32598
|
+
error(err.message);
|
|
32599
|
+
process.exit(1);
|
|
32573
32600
|
}
|
|
32601
|
+
throw err;
|
|
32602
|
+
}
|
|
32603
|
+
output({ json, data: res, human: () => renderBillingStatus(res) });
|
|
32604
|
+
}
|
|
32605
|
+
function addBillingCommand(parent) {
|
|
32606
|
+
parent.command("billing").description("Show your plan, Stripe subscription, trial, and discounts").option("--json", "Output as JSON").action((options) => runBillingStatus(options.json));
|
|
32607
|
+
}
|
|
32608
|
+
function registerBillingCommand(program2) {
|
|
32609
|
+
const billing = program2.command("billing").description("Deprecated: use `account billing`");
|
|
32610
|
+
billing.command("status").description("Show your current plan, Stripe subscription, trial, and discounts").option("--json", "Output as JSON").action((options) => runBillingStatus(options.json));
|
|
32611
|
+
}
|
|
32612
|
+
function renderBillingStatus(res) {
|
|
32613
|
+
if (!res.subscription) {
|
|
32574
32614
|
console.log(formatKeyValue([
|
|
32615
|
+
["Plan", "Free during open beta"],
|
|
32616
|
+
["Cost", dim("$0 — no limits, no charges")],
|
|
32617
|
+
["Paid plans", dim("coming after beta")]
|
|
32618
|
+
]));
|
|
32619
|
+
return;
|
|
32620
|
+
}
|
|
32621
|
+
const rows = [];
|
|
32622
|
+
rows.push(["Plan", res.plan]);
|
|
32623
|
+
rows.push([
|
|
32624
|
+
"Customer",
|
|
32625
|
+
res.stripeCustomerId ?? dim("(none — no subscription yet)")
|
|
32626
|
+
]);
|
|
32627
|
+
const sub = res.subscription;
|
|
32628
|
+
rows.push(["Subscription", `${sub.id} (${sub.status})`]);
|
|
32629
|
+
if (sub.tier)
|
|
32630
|
+
rows.push(["Tier", sub.tier]);
|
|
32631
|
+
if (sub.amountCents !== null && sub.interval) {
|
|
32632
|
+
const dollars = (sub.amountCents / 100).toFixed(2);
|
|
32633
|
+
rows.push(["Price", `$${dollars} / ${sub.interval}`]);
|
|
32634
|
+
}
|
|
32635
|
+
if (sub.trialEnd) {
|
|
32636
|
+
const days = Math.max(0, Math.round((new Date(sub.trialEnd).getTime() - Date.now()) / 86400000));
|
|
32637
|
+
rows.push([
|
|
32638
|
+
"Trial ends",
|
|
32639
|
+
`${formatDate(sub.trialEnd)} (${days}d remaining)`
|
|
32640
|
+
]);
|
|
32641
|
+
}
|
|
32642
|
+
if (sub.currentPeriodEnd) {
|
|
32643
|
+
rows.push(["Renews", formatDate(sub.currentPeriodEnd)]);
|
|
32644
|
+
}
|
|
32645
|
+
if (sub.cancelAtPeriodEnd) {
|
|
32646
|
+
rows.push(["Cancels at period end", "yes"]);
|
|
32647
|
+
}
|
|
32648
|
+
if (sub.discount) {
|
|
32649
|
+
const off = sub.discount.percentOff !== null ? `${sub.discount.percentOff}% off` : sub.discount.amountOff !== null ? `$${(sub.discount.amountOff / 100).toFixed(2)} off` : "discount";
|
|
32650
|
+
const label = sub.discount.code ? `${sub.discount.code} (${sub.discount.name ?? "coupon"})` : sub.discount.name ?? "applied";
|
|
32651
|
+
rows.push(["Discount", `${label} — ${off}, ${sub.discount.duration}`]);
|
|
32652
|
+
}
|
|
32653
|
+
console.log(formatKeyValue(rows));
|
|
32654
|
+
}
|
|
32655
|
+
function formatDate(iso) {
|
|
32656
|
+
return new Date(iso).toISOString().slice(0, 10);
|
|
32657
|
+
}
|
|
32658
|
+
|
|
32659
|
+
// src/commands/account.ts
|
|
32660
|
+
async function showProfile(json) {
|
|
32661
|
+
const profile = await getAccountProfile();
|
|
32662
|
+
output({
|
|
32663
|
+
json,
|
|
32664
|
+
data: profile,
|
|
32665
|
+
human: () => console.log(formatKeyValue([
|
|
32575
32666
|
["Email", profile.email],
|
|
32576
32667
|
["Plan", profile.plan],
|
|
32577
32668
|
["Display Name", profile.displayName ?? dim("—")],
|
|
32578
32669
|
["Bio", profile.bio ?? dim("—")],
|
|
32579
32670
|
["Slug", profile.slug ?? dim("—")]
|
|
32580
|
-
]))
|
|
32581
|
-
}
|
|
32671
|
+
]))
|
|
32672
|
+
});
|
|
32582
32673
|
}
|
|
32583
|
-
|
|
32584
|
-
|
|
32585
|
-
|
|
32586
|
-
|
|
32587
|
-
|
|
32588
|
-
|
|
32589
|
-
|
|
32590
|
-
|
|
32591
|
-
|
|
32592
|
-
|
|
32593
|
-
|
|
32594
|
-
|
|
32595
|
-
|
|
32596
|
-
|
|
32597
|
-
}
|
|
32598
|
-
if (!res.subscription) {
|
|
32674
|
+
async function applyProfileUpdate(options) {
|
|
32675
|
+
const data = {};
|
|
32676
|
+
if (options.name)
|
|
32677
|
+
data.display_name = options.name;
|
|
32678
|
+
if (options.bio)
|
|
32679
|
+
data.bio = options.bio;
|
|
32680
|
+
if (options.slug)
|
|
32681
|
+
data.slug = options.slug;
|
|
32682
|
+
const updated = await updateAccountProfile(data);
|
|
32683
|
+
output({
|
|
32684
|
+
json: options.json,
|
|
32685
|
+
data: updated,
|
|
32686
|
+
human: () => {
|
|
32687
|
+
success("Profile updated");
|
|
32599
32688
|
console.log(formatKeyValue([
|
|
32600
|
-
["
|
|
32601
|
-
["
|
|
32602
|
-
["
|
|
32689
|
+
["Display Name", updated.displayName ?? dim("—")],
|
|
32690
|
+
["Bio", updated.bio ?? dim("—")],
|
|
32691
|
+
["Slug", updated.slug ?? dim("—")]
|
|
32603
32692
|
]));
|
|
32604
|
-
return;
|
|
32605
|
-
}
|
|
32606
|
-
const rows = [];
|
|
32607
|
-
rows.push(["Plan", res.plan]);
|
|
32608
|
-
rows.push([
|
|
32609
|
-
"Customer",
|
|
32610
|
-
res.stripeCustomerId ?? dim("(none — no subscription yet)")
|
|
32611
|
-
]);
|
|
32612
|
-
const sub = res.subscription;
|
|
32613
|
-
rows.push(["Subscription", `${sub.id} (${sub.status})`]);
|
|
32614
|
-
if (sub.tier)
|
|
32615
|
-
rows.push(["Tier", sub.tier]);
|
|
32616
|
-
if (sub.amountCents !== null && sub.interval) {
|
|
32617
|
-
const dollars = (sub.amountCents / 100).toFixed(2);
|
|
32618
|
-
rows.push(["Price", `$${dollars} / ${sub.interval}`]);
|
|
32619
|
-
}
|
|
32620
|
-
if (sub.trialEnd) {
|
|
32621
|
-
const days = Math.max(0, Math.round((new Date(sub.trialEnd).getTime() - Date.now()) / 86400000));
|
|
32622
|
-
rows.push([
|
|
32623
|
-
"Trial ends",
|
|
32624
|
-
`${formatDate(sub.trialEnd)} (${days}d remaining)`
|
|
32625
|
-
]);
|
|
32626
32693
|
}
|
|
32627
|
-
if (sub.currentPeriodEnd) {
|
|
32628
|
-
rows.push(["Renews", formatDate(sub.currentPeriodEnd)]);
|
|
32629
|
-
}
|
|
32630
|
-
if (sub.cancelAtPeriodEnd) {
|
|
32631
|
-
rows.push(["Cancels at period end", "yes"]);
|
|
32632
|
-
}
|
|
32633
|
-
if (sub.discount) {
|
|
32634
|
-
const off = sub.discount.percentOff !== null ? `${sub.discount.percentOff}% off` : sub.discount.amountOff !== null ? `$${(sub.discount.amountOff / 100).toFixed(2)} off` : "discount";
|
|
32635
|
-
const label = sub.discount.code ? `${sub.discount.code} (${sub.discount.name ?? "coupon"})` : sub.discount.name ?? "applied";
|
|
32636
|
-
rows.push(["Discount", `${label} — ${off}, ${sub.discount.duration}`]);
|
|
32637
|
-
}
|
|
32638
|
-
console.log(formatKeyValue(rows));
|
|
32639
32694
|
});
|
|
32640
32695
|
}
|
|
32641
|
-
function
|
|
32642
|
-
|
|
32696
|
+
function registerAccountCommand(program2) {
|
|
32697
|
+
const account = program2.command("account").description("Manage your account profile");
|
|
32698
|
+
addBillingCommand(account);
|
|
32699
|
+
account.command("get").description("Show your account profile").option("--json", "Output as JSON").action(withErrorHandling(async (options) => showProfile(options.json), { action: "show profile" }));
|
|
32700
|
+
account.command("update").description("Update your public profile").option("--name <name>", "Set display name").option("--bio <bio>", "Set bio").option("--slug <slug>", "Set public URL slug").option("--json", "Output as JSON").action(withErrorHandling(async (options) => applyProfileUpdate(options), {
|
|
32701
|
+
action: "update profile"
|
|
32702
|
+
}));
|
|
32703
|
+
account.command("profile").description("Deprecated: use `account get` / `account update`").option("--name <name>", "Set display name").option("--bio <bio>", "Set bio").option("--slug <slug>", "Set public URL slug").option("--json", "Output as JSON").action(withErrorHandling(async (options) => {
|
|
32704
|
+
if (options.name || options.bio || options.slug) {
|
|
32705
|
+
await applyProfileUpdate(options);
|
|
32706
|
+
} else {
|
|
32707
|
+
await showProfile(options.json);
|
|
32708
|
+
}
|
|
32709
|
+
}, { action: "manage profile" }));
|
|
32643
32710
|
}
|
|
32644
32711
|
// src/commands/config.ts
|
|
32645
32712
|
init_config();
|
|
@@ -32885,10 +32952,14 @@ async function detectStacksNodes() {
|
|
|
32885
32952
|
init_output();
|
|
32886
32953
|
function registerConfigCommand(program2) {
|
|
32887
32954
|
const config = program2.command("config").description("Manage CLI configuration");
|
|
32888
|
-
config.command("show").description("Show current configuration").action(async () => {
|
|
32955
|
+
config.command("get").alias("show").description("Show current configuration").option("--json", "Output as JSON").action(async (options) => {
|
|
32889
32956
|
try {
|
|
32890
32957
|
const cfg = await loadConfig();
|
|
32891
|
-
|
|
32958
|
+
if (options.json) {
|
|
32959
|
+
writeData(JSON.stringify(cfg, null, 2));
|
|
32960
|
+
return;
|
|
32961
|
+
}
|
|
32962
|
+
note(`Config file: ${getConfigPath()}`);
|
|
32892
32963
|
console.log("");
|
|
32893
32964
|
await printConfigTree(cfg);
|
|
32894
32965
|
} catch (err) {
|
|
@@ -32896,7 +32967,11 @@ function registerConfigCommand(program2) {
|
|
|
32896
32967
|
process.exit(1);
|
|
32897
32968
|
}
|
|
32898
32969
|
});
|
|
32899
|
-
config.command("set <key> <value>").description("Set a configuration value (supports dot notation: ports.api)").option("--no-validate", "Skip connection validation for database/redis URLs").
|
|
32970
|
+
config.command("set <key> <value>").description("Set a configuration value (supports dot notation: ports.api)").option("--no-validate", "Skip connection validation for database/redis URLs").addHelpText("after", `
|
|
32971
|
+
Examples:
|
|
32972
|
+
$ sl config set network local
|
|
32973
|
+
$ sl config set ports.api 3800
|
|
32974
|
+
$ sl config set database.url postgres://localhost:5432/secondlayer_dev`).action(async (key, value, options) => {
|
|
32900
32975
|
try {
|
|
32901
32976
|
await setConfigValue(key, value);
|
|
32902
32977
|
success(`Set ${key} = ${value}`);
|
|
@@ -32926,7 +33001,7 @@ function registerConfigCommand(program2) {
|
|
|
32926
33001
|
process.exit(1);
|
|
32927
33002
|
}
|
|
32928
33003
|
});
|
|
32929
|
-
config.command("clear").description("
|
|
33004
|
+
config.command("delete").alias("clear").description("Delete all configuration (remove the config file)").option("-y, --yes", "Skip confirmation").action(async (opts) => {
|
|
32930
33005
|
try {
|
|
32931
33006
|
if (!opts.yes && !await confirmDestructive("Delete the config file?")) {
|
|
32932
33007
|
return;
|
|
@@ -33364,12 +33439,27 @@ async function getSubscriptionClient(opts) {
|
|
|
33364
33439
|
apiKey: resolvedConfig.apiKey
|
|
33365
33440
|
});
|
|
33366
33441
|
}
|
|
33367
|
-
function
|
|
33368
|
-
|
|
33369
|
-
|
|
33442
|
+
function addSubscriptionScaffold(parent, commandSpec, opts) {
|
|
33443
|
+
parent.command(commandSpec).description(opts.description).option("-r, --runtime <runtime>", "inngest | trigger | cloudflare | node").option("-s, --subgraph <name>", "Subgraph to subscribe to").option("-t, --table <name>", "Table to subscribe to").option("-u, --url <url>", "Webhook URL").option("--auth-token <token>", "Bearer token for receiver API auth").option("--filter <kv...>", "Filter as key=value (supports .eq/.neq/.gt/.gte/.lt/.lte suffixes)").option("--service-key <key>", "SL_SERVICE_KEY override").option("--base-url <url>", "SL_API_URL override").option("--skip-api", "Copy template only, don't call the API").option("--no-scaffold", "Skip the local runtime template directory (webhook-only setups)").addHelpText("after", `
|
|
33444
|
+
Examples:
|
|
33445
|
+
$ ${opts.examplePrefix} my-sub -s my-graph -t transfers -u https://example.com/webhook
|
|
33446
|
+
$ ${opts.examplePrefix} my-sub -s my-graph -t balances -r inngest --filter amount.gte=1000`).action(async (name, options) => {
|
|
33370
33447
|
await createSubscription(name, options);
|
|
33371
33448
|
});
|
|
33372
33449
|
}
|
|
33450
|
+
function addSubscriptionsCreateCommand(subscriptions) {
|
|
33451
|
+
addSubscriptionScaffold(subscriptions, "create <name>", {
|
|
33452
|
+
description: "Create a subscription receiver for a runtime",
|
|
33453
|
+
examplePrefix: "sl subscriptions create"
|
|
33454
|
+
});
|
|
33455
|
+
}
|
|
33456
|
+
function registerCreateCommand(program2) {
|
|
33457
|
+
const create = program2.command("create").description("Deprecated: use `sl subscriptions create`");
|
|
33458
|
+
addSubscriptionScaffold(create, "subscription <name>", {
|
|
33459
|
+
description: "Deprecated: use `sl subscriptions create`",
|
|
33460
|
+
examplePrefix: "sl create subscription"
|
|
33461
|
+
});
|
|
33462
|
+
}
|
|
33373
33463
|
// src/commands/status.ts
|
|
33374
33464
|
init_config();
|
|
33375
33465
|
init_output();
|
|
@@ -33378,11 +33468,11 @@ function registerStatusCommand(program2) {
|
|
|
33378
33468
|
const config = await loadConfig();
|
|
33379
33469
|
try {
|
|
33380
33470
|
const status = await httpPlatform("/status");
|
|
33381
|
-
|
|
33382
|
-
|
|
33383
|
-
|
|
33384
|
-
|
|
33385
|
-
|
|
33471
|
+
output({
|
|
33472
|
+
json: options.json,
|
|
33473
|
+
data: status,
|
|
33474
|
+
human: () => printStatus(status)
|
|
33475
|
+
});
|
|
33386
33476
|
} catch (err) {
|
|
33387
33477
|
if (err instanceof CliHttpError && err.code === "SESSION_EXPIRED") {
|
|
33388
33478
|
console.error("Not logged in. Run: sl login");
|
|
@@ -33818,6 +33908,7 @@ async function confirmOrExit(message, yes) {
|
|
|
33818
33908
|
}
|
|
33819
33909
|
function registerSubscriptionsCommand(program2) {
|
|
33820
33910
|
const subscriptions = commonOptions(program2.command("subscriptions").alias("subs").description("Manage subgraph table subscriptions"));
|
|
33911
|
+
addSubscriptionsCreateCommand(subscriptions);
|
|
33821
33912
|
commonOptions(subscriptions.command("list").alias("ls").description("List subscriptions").option("--json", "Output as JSON")).action(async (options) => {
|
|
33822
33913
|
try {
|
|
33823
33914
|
const client = await getSubscriptionClient(options);
|
|
@@ -33856,7 +33947,11 @@ ${data.length} subscription(s) total`));
|
|
|
33856
33947
|
handleApiError(err, "get subscription");
|
|
33857
33948
|
}
|
|
33858
33949
|
});
|
|
33859
|
-
commonOptions(subscriptions.command("update <idOrName>").description("Update subscription config").option("--name <name>", "Rename subscription").option("--url <url>", "Webhook URL").option("--auth-token <token>", "Set bearer token auth config").option("--format <format>", "standard-webhooks | inngest | trigger | cloudflare | cloudevents | raw").option("--runtime <runtime>", "inngest | trigger | cloudflare | node | none").option("--filter <kv...>", "Filter as key=value (supports .eq/.neq/.gt/.gte/.lt/.lte suffixes)").option("--clear-filter", "Replace filter with {}").option("--max-retries <n>", "Maximum delivery retries").option("--timeout-ms <n>", "Delivery timeout in milliseconds").option("--concurrency <n>", "Per-subscription delivery concurrency").option("--json", "Output as JSON")
|
|
33950
|
+
commonOptions(subscriptions.command("update <idOrName>").description("Update subscription config").option("--name <name>", "Rename subscription").option("--url <url>", "Webhook URL").option("--auth-token <token>", "Set bearer token auth config").option("--format <format>", "standard-webhooks | inngest | trigger | cloudflare | cloudevents | raw").option("--runtime <runtime>", "inngest | trigger | cloudflare | node | none").option("--filter <kv...>", "Filter as key=value (supports .eq/.neq/.gt/.gte/.lt/.lte suffixes)").option("--clear-filter", "Replace filter with {}").option("--max-retries <n>", "Maximum delivery retries").option("--timeout-ms <n>", "Delivery timeout in milliseconds").option("--concurrency <n>", "Per-subscription delivery concurrency").option("--json", "Output as JSON").addHelpText("after", `
|
|
33951
|
+
Examples:
|
|
33952
|
+
$ sl subscriptions update my-sub --url https://example.com/hook
|
|
33953
|
+
$ sl subscriptions update my-sub --filter amount.gte=1000 --max-retries 5
|
|
33954
|
+
$ sl subscriptions update my-sub --clear-filter`)).action(async (idOrName, options) => {
|
|
33860
33955
|
try {
|
|
33861
33956
|
const client = await getSubscriptionClient(options);
|
|
33862
33957
|
const patch = buildUpdatePatch(options);
|
|
@@ -33892,7 +33987,7 @@ ${data.length} subscription(s) total`));
|
|
|
33892
33987
|
}
|
|
33893
33988
|
});
|
|
33894
33989
|
}
|
|
33895
|
-
commonOptions(subscriptions.command("delete <idOrName>").description("Delete a subscription").option("-y, --yes", "Skip confirmation").option("--json", "Output as JSON")).action(async (idOrName, options) => {
|
|
33990
|
+
commonOptions(subscriptions.command("delete <idOrName>").alias("rm").description("Delete a subscription").option("-y, --yes", "Skip confirmation").option("--json", "Output as JSON")).action(async (idOrName, options) => {
|
|
33896
33991
|
try {
|
|
33897
33992
|
const client = await getSubscriptionClient(options);
|
|
33898
33993
|
let resolved = null;
|
|
@@ -33983,7 +34078,9 @@ ${data.length} subscription(s) total`));
|
|
|
33983
34078
|
handleApiError(err, "requeue dead-letter row");
|
|
33984
34079
|
}
|
|
33985
34080
|
});
|
|
33986
|
-
commonOptions(subscriptions.command("replay <idOrName>").description("Replay a block range").requiredOption("--from-block <n>", "Start block height").requiredOption("--to-block <n>", "End block height").option("-y, --yes", "Skip confirmation").option("--json", "Output as JSON")
|
|
34081
|
+
commonOptions(subscriptions.command("replay <idOrName>").description("Replay a block range").requiredOption("--from-block <n>", "Start block height").requiredOption("--to-block <n>", "End block height").option("-y, --yes", "Skip confirmation").option("--json", "Output as JSON").addHelpText("after", `
|
|
34082
|
+
Examples:
|
|
34083
|
+
$ sl subscriptions replay my-sub --from-block 150000 --to-block 160000 -y`)).action(async (idOrName, options) => {
|
|
33987
34084
|
try {
|
|
33988
34085
|
const fromBlock = requireIntegerOption(options.fromBlock, "--from-block");
|
|
33989
34086
|
const toBlock = requireIntegerOption(options.toBlock, "--to-block");
|
|
@@ -34093,34 +34190,46 @@ import {
|
|
|
34093
34190
|
import { StacksNodeClient } from "@secondlayer/shared/node";
|
|
34094
34191
|
var DEV_DATABASE_URL = "postgres://postgres:postgres@localhost:5432/secondlayer_dev";
|
|
34095
34192
|
function registerDbCommand(program2) {
|
|
34096
|
-
|
|
34193
|
+
addDbCommand(program2, { deprecated: true });
|
|
34194
|
+
}
|
|
34195
|
+
function addDbCommand(parent, opts) {
|
|
34196
|
+
const dbCmd = parent.command("db").description(opts?.deprecated ? "Deprecated: use `sl local db`" : "Inspect indexer database tables").addHelpText("after", `
|
|
34197
|
+
Subcommands:
|
|
34198
|
+
blocks Show recent blocks
|
|
34199
|
+
txs Show recent transactions
|
|
34200
|
+
events Show recent events
|
|
34201
|
+
gaps Show gaps in indexed block data
|
|
34202
|
+
truncate Truncate all indexed data
|
|
34203
|
+
resync Reset database and restart indexer
|
|
34204
|
+
|
|
34205
|
+
Run \`sl db\` with no subcommand to print an overview.`).hook("preAction", async () => {
|
|
34097
34206
|
await requireLocalNetwork();
|
|
34098
34207
|
}).action(async () => {
|
|
34099
34208
|
await showOverview(10);
|
|
34100
34209
|
});
|
|
34101
34210
|
dbCmd.command("blocks").description("Show recent blocks").option("--limit <n>", "Number of rows", "10").option("--json", "Output as JSON").action(async function() {
|
|
34102
|
-
const
|
|
34103
|
-
await showBlocks(Number.parseInt(
|
|
34211
|
+
const opts2 = this.opts();
|
|
34212
|
+
await showBlocks(Number.parseInt(opts2.limit), opts2.json);
|
|
34104
34213
|
});
|
|
34105
34214
|
dbCmd.command("txs").description("Show recent transactions").option("--limit <n>", "Number of rows", "10").option("--json", "Output as JSON").action(async function() {
|
|
34106
|
-
const
|
|
34107
|
-
await showTransactions(Number.parseInt(
|
|
34215
|
+
const opts2 = this.opts();
|
|
34216
|
+
await showTransactions(Number.parseInt(opts2.limit), opts2.json);
|
|
34108
34217
|
});
|
|
34109
34218
|
dbCmd.command("events").description("Show recent events").option("--limit <n>", "Number of rows", "10").option("--json", "Output as JSON").action(async function() {
|
|
34110
|
-
const
|
|
34111
|
-
await showEvents(Number.parseInt(
|
|
34219
|
+
const opts2 = this.opts();
|
|
34220
|
+
await showEvents(Number.parseInt(opts2.limit), opts2.json);
|
|
34112
34221
|
});
|
|
34113
34222
|
dbCmd.command("gaps").description("Show gaps in indexed block data").option("--limit <n>", "Number of gaps to show", "50").option("--json", "Output as JSON").action(async function() {
|
|
34114
|
-
const
|
|
34115
|
-
await showGaps(Number.parseInt(
|
|
34223
|
+
const opts2 = this.opts();
|
|
34224
|
+
await showGaps(Number.parseInt(opts2.limit), opts2.json);
|
|
34116
34225
|
});
|
|
34117
|
-
dbCmd.command("reset").description("Truncate all indexed data (blocks, txs, events)").option("-y, --yes", "Skip confirmation prompt").action(async function() {
|
|
34118
|
-
const
|
|
34119
|
-
await resetDatabase(
|
|
34226
|
+
dbCmd.command("truncate").alias("reset").description("Truncate all indexed data (blocks, txs, events)").option("-y, --yes", "Skip confirmation prompt").action(async function() {
|
|
34227
|
+
const opts2 = this.opts();
|
|
34228
|
+
await resetDatabase(opts2.yes);
|
|
34120
34229
|
});
|
|
34121
34230
|
dbCmd.command("resync").description("Reset database and restart indexer for fresh sync").option("-y, --yes", "Skip confirmation prompt").option("--backfill", "After reset, fetch all blocks from node").action(async function() {
|
|
34122
|
-
const
|
|
34123
|
-
await resyncDatabase(
|
|
34231
|
+
const opts2 = this.opts();
|
|
34232
|
+
await resyncDatabase(opts2.yes, opts2.backfill);
|
|
34124
34233
|
});
|
|
34125
34234
|
}
|
|
34126
34235
|
function ensureDb() {
|
|
@@ -34449,6 +34558,7 @@ function buildDevnetCompose(opts = {}) {
|
|
|
34449
34558
|
const apiImage = `ghcr.io/${owner}/secondlayer-api:${tag}`;
|
|
34450
34559
|
const indexerImage = `ghcr.io/${owner}/secondlayer-indexer:${tag}`;
|
|
34451
34560
|
const dbUrl = "postgres://secondlayer:secondlayer@postgres:5432/secondlayer";
|
|
34561
|
+
const DEV_SECRETS_KEY = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
|
|
34452
34562
|
return `# Generated by \`sl devnet connect\` — do not edit by hand.
|
|
34453
34563
|
# Secondlayer app services for local clarinet devnet development.
|
|
34454
34564
|
name: secondlayer-devnet
|
|
@@ -34487,6 +34597,11 @@ services:
|
|
|
34487
34597
|
PORT: 3800
|
|
34488
34598
|
NODE_ENV: production
|
|
34489
34599
|
DATA_DIR: /data
|
|
34600
|
+
# Shared across api + subgraph-processor so the secret the api encrypts
|
|
34601
|
+
# (e.g. a subscription's signing secret) can be decrypted by the emitter.
|
|
34602
|
+
# OSS auto-generates a per-process key when unset — that splits them.
|
|
34603
|
+
# Local-dev fixed value; not a production secret.
|
|
34604
|
+
SECONDLAYER_SECRETS_KEY: ${DEV_SECRETS_KEY}
|
|
34490
34605
|
ports:
|
|
34491
34606
|
- "${apiPort}:3800"
|
|
34492
34607
|
volumes:
|
|
@@ -34549,6 +34664,11 @@ services:
|
|
|
34549
34664
|
# index_progress under NETWORK.
|
|
34550
34665
|
NETWORK: testnet
|
|
34551
34666
|
STACKS_NETWORK: testnet
|
|
34667
|
+
# The emitter blocks webhook delivery to private/loopback IPs by default.
|
|
34668
|
+
# On a local devnet you deliver to your own localhost receiver, so allow it.
|
|
34669
|
+
SECONDLAYER_ALLOW_PRIVATE_EGRESS: "true"
|
|
34670
|
+
# Must match the api's key so the emitter can decrypt signing secrets.
|
|
34671
|
+
SECONDLAYER_SECRETS_KEY: ${DEV_SECRETS_KEY}
|
|
34552
34672
|
volumes:
|
|
34553
34673
|
- subgraphs_data:/data/subgraphs
|
|
34554
34674
|
depends_on:
|
|
@@ -34657,10 +34777,10 @@ function registerDevnetCommand(program2) {
|
|
|
34657
34777
|
devnet.command("down").description("Stop the local Secondlayer stack started by `sl devnet connect`").option("--project <dir>", "Clarinet project directory").option("--purge", "Also remove volumes (wipes the local index)").action(async (options) => {
|
|
34658
34778
|
await down(options);
|
|
34659
34779
|
});
|
|
34660
|
-
devnet.command("status").description("Snapshot of the local stack: ingest, subgraphs, and recent activity").option("-w, --watch", "Refresh every 2s until Ctrl-C").option("
|
|
34780
|
+
devnet.command("status").description("Snapshot of the local stack: ingest, subgraphs, and recent activity").option("-w, --watch", "Refresh every 2s until Ctrl-C").option("--limit <n>", "Recent activity rows to show", "12").action(async (options) => {
|
|
34661
34781
|
await status(options);
|
|
34662
34782
|
});
|
|
34663
|
-
devnet.command("logs [service]").description("Tail stack logs — all services, or one of: indexer, api, subgraph-processor, postgres").option("--project <dir>", "Clarinet project directory").option("-f, --follow", "Follow log output").option("-n, --
|
|
34783
|
+
devnet.command("logs [service]").description("Tail stack logs — all services, or one of: indexer, api, subgraph-processor, postgres").option("--project <dir>", "Clarinet project directory").option("-f, --follow", "Follow log output").option("-n, --lines <n>", "Lines to show from the end of each log").option("--tail <n>", "Deprecated alias for --lines").action(async (service, options) => {
|
|
34664
34784
|
await logs(service, options);
|
|
34665
34785
|
});
|
|
34666
34786
|
}
|
|
@@ -34747,7 +34867,7 @@ async function logs(service, options) {
|
|
|
34747
34867
|
process.exit(1);
|
|
34748
34868
|
}
|
|
34749
34869
|
ensureDocker();
|
|
34750
|
-
const args = ["logs", "--tail", options.tail];
|
|
34870
|
+
const args = ["logs", "--tail", options.lines ?? options.tail ?? "200"];
|
|
34751
34871
|
if (options.follow)
|
|
34752
34872
|
args.push("-f");
|
|
34753
34873
|
if (service)
|
|
@@ -35132,6 +35252,37 @@ init_output();
|
|
|
35132
35252
|
import { confirm as confirm3, input as input2 } from "@inquirer/prompts";
|
|
35133
35253
|
init_output();
|
|
35134
35254
|
init_session();
|
|
35255
|
+
function sessionExpiry() {
|
|
35256
|
+
return new Date(Date.now() + 90 * 24 * 60 * 60 * 1000).toISOString();
|
|
35257
|
+
}
|
|
35258
|
+
async function readStdin() {
|
|
35259
|
+
const chunks = [];
|
|
35260
|
+
for await (const chunk of process.stdin)
|
|
35261
|
+
chunks.push(chunk);
|
|
35262
|
+
return Buffer.concat(chunks).toString("utf8").trim();
|
|
35263
|
+
}
|
|
35264
|
+
async function runTokenLogin() {
|
|
35265
|
+
const token = await readStdin();
|
|
35266
|
+
if (!token) {
|
|
35267
|
+
error('No token on stdin. Usage: echo "$KEY" | sl login --with-token');
|
|
35268
|
+
process.exit(1);
|
|
35269
|
+
}
|
|
35270
|
+
process.env.SL_API_KEY = token;
|
|
35271
|
+
let account;
|
|
35272
|
+
try {
|
|
35273
|
+
account = await httpPlatform("/api/accounts/me");
|
|
35274
|
+
} catch (err) {
|
|
35275
|
+
error(err instanceof CliHttpError ? `Token rejected: ${err.message}` : err instanceof Error ? err.message : String(err));
|
|
35276
|
+
process.exit(1);
|
|
35277
|
+
}
|
|
35278
|
+
await writeSession({
|
|
35279
|
+
token,
|
|
35280
|
+
email: account.email,
|
|
35281
|
+
accountId: account.id,
|
|
35282
|
+
expiresAt: sessionExpiry()
|
|
35283
|
+
});
|
|
35284
|
+
success(`Logged in as ${account.email}`);
|
|
35285
|
+
}
|
|
35135
35286
|
async function runLoginFlow(options = {}) {
|
|
35136
35287
|
if (!options.force) {
|
|
35137
35288
|
const existing = await readSession();
|
|
@@ -35186,12 +35337,11 @@ async function runLoginFlow(options = {}) {
|
|
|
35186
35337
|
method: "POST",
|
|
35187
35338
|
body: { email, code }
|
|
35188
35339
|
});
|
|
35189
|
-
const expiresAt = new Date(Date.now() + 90 * 24 * 60 * 60 * 1000).toISOString();
|
|
35190
35340
|
await writeSession({
|
|
35191
35341
|
token: verified.sessionToken,
|
|
35192
35342
|
email: verified.account.email,
|
|
35193
35343
|
accountId: verified.account.id,
|
|
35194
|
-
expiresAt
|
|
35344
|
+
expiresAt: sessionExpiry()
|
|
35195
35345
|
});
|
|
35196
35346
|
success(`Logged in as ${verified.account.email}`);
|
|
35197
35347
|
info(dim("Run 'sl whoami' to see your account status."));
|
|
@@ -35205,7 +35355,10 @@ async function runLoginFlow(options = {}) {
|
|
|
35205
35355
|
}
|
|
35206
35356
|
}
|
|
35207
35357
|
function registerLoginCommand(program2) {
|
|
35208
|
-
program2.command("login").description("Log in to Secondlayer (magic-link email)").option("
|
|
35358
|
+
program2.command("login").description("Log in to Secondlayer (magic-link email)").option("--force", "Skip the already-logged-in check and re-run the flow").option("--with-token", "Read an API key from stdin (non-interactive)").addHelpText("after", `
|
|
35359
|
+
Examples:
|
|
35360
|
+
$ sl login
|
|
35361
|
+
$ echo "$SL_API_KEY" | sl login --with-token`).action((opts) => opts.withToken ? runTokenLogin() : runLoginFlow({ force: opts.force }));
|
|
35209
35362
|
}
|
|
35210
35363
|
|
|
35211
35364
|
// src/lib/require-auth.ts
|
|
@@ -35667,13 +35820,13 @@ function formatSubgraphSpecOutput(spec, format) {
|
|
|
35667
35820
|
return `${JSON.stringify(spec, null, 2)}
|
|
35668
35821
|
`;
|
|
35669
35822
|
}
|
|
35670
|
-
async function writeOrPrintSubgraphSpec(spec, format,
|
|
35823
|
+
async function writeOrPrintSubgraphSpec(spec, format, output2) {
|
|
35671
35824
|
const text = formatSubgraphSpecOutput(spec, format);
|
|
35672
|
-
if (!
|
|
35825
|
+
if (!output2) {
|
|
35673
35826
|
process.stdout.write(text);
|
|
35674
35827
|
return;
|
|
35675
35828
|
}
|
|
35676
|
-
const outPath = resolve2(
|
|
35829
|
+
const outPath = resolve2(output2);
|
|
35677
35830
|
const dir = resolve2(outPath, "..");
|
|
35678
35831
|
if (!existsSync4(dir))
|
|
35679
35832
|
mkdirSync3(dir, { recursive: true });
|
|
@@ -35872,7 +36025,10 @@ function formatSubgraphSync(sync) {
|
|
|
35872
36025
|
}
|
|
35873
36026
|
function registerSubgraphsCommand(program2) {
|
|
35874
36027
|
const subgraphs = program2.command("subgraphs").description("Manage materialized subgraphs");
|
|
35875
|
-
subgraphs.command("
|
|
36028
|
+
subgraphs.command("create <name>").alias("new").description("Create a new subgraph definition file").option("--template <slug>", `Foundation Dataset starter (one of: ${SUBGRAPH_TEMPLATE_SLUGS.join(", ")})`).addHelpText("after", `
|
|
36029
|
+
Examples:
|
|
36030
|
+
$ sl subgraphs new my-graph
|
|
36031
|
+
$ sl subgraphs new token-balances --template sip-010-balances`).action(async (name, opts) => {
|
|
35876
36032
|
const slug = opts.template ?? "basic";
|
|
35877
36033
|
if (!SUBGRAPH_TEMPLATE_SLUGS.includes(slug)) {
|
|
35878
36034
|
error(`Unknown template "${opts.template}". Available templates:
|
|
@@ -35958,7 +36114,7 @@ Stopped watching.`);
|
|
|
35958
36114
|
});
|
|
35959
36115
|
await new Promise(() => {});
|
|
35960
36116
|
});
|
|
35961
|
-
subgraphs.command("deploy <file>").description("Deploy a subgraph definition file").option("--start-block <n>", "Override the subgraph definition startBlock for this deploy").option("--dry-run", "Validate and preview deploy without writing changes").option("--preview", "
|
|
36117
|
+
subgraphs.command("deploy <file>").description("Deploy a subgraph definition file").option("--start-block <n>", "Override the subgraph definition startBlock for this deploy").option("--dry-run", "Validate and preview deploy without writing changes").option("--preview", "Deprecated alias for --dry-run").option("-y, --yes", "Skip the reindex confirmation prompt").option("--force", "Deprecated alias for --yes").option("--database-url <url>", "BYO data plane: write the subgraph's schema/rows to your own Postgres. With --dry-run, prints the DDL + grant script and verifies the connection.").option("--strict", "Run `tsc --noEmit` against the handler before deploy (slower; catches TS type errors)").action(async (file, options2) => {
|
|
35962
36118
|
try {
|
|
35963
36119
|
const absPath = resolve2(file);
|
|
35964
36120
|
const config = await loadConfig();
|
|
@@ -36048,7 +36204,7 @@ Stopped watching.`);
|
|
|
36048
36204
|
info(` + columns: ${t}.${cols.join(", ")}`);
|
|
36049
36205
|
}
|
|
36050
36206
|
}
|
|
36051
|
-
const confirmed = options2.force || await confirm4({
|
|
36207
|
+
const confirmed = options2.yes || options2.force || await confirm4({
|
|
36052
36208
|
message: "⚠ This will drop all data and reindex from scratch. Continue?"
|
|
36053
36209
|
});
|
|
36054
36210
|
if (!confirmed) {
|
|
@@ -36134,7 +36290,7 @@ ${data.length} subgraph(s) total`));
|
|
|
36134
36290
|
handleApiError(err, "list subgraphs");
|
|
36135
36291
|
}
|
|
36136
36292
|
});
|
|
36137
|
-
subgraphs.command("status <name>").description("Show detailed subgraph status").option("-w, --watch", "Refresh every 2s until synced or Ctrl-C").action(async (name, options2) => {
|
|
36293
|
+
subgraphs.command("status <name>").alias("get").description("Show detailed subgraph status").option("-w, --watch", "Refresh every 2s until synced or Ctrl-C").action(async (name, options2) => {
|
|
36138
36294
|
const renderOnce = async () => {
|
|
36139
36295
|
const subgraph = await getSubgraphApi(name);
|
|
36140
36296
|
const rowCounts = Object.entries(subgraph.tables).map(([t, info2]) => `${t}: ${info2.rowCount}`).join(", ") || "N/A";
|
|
@@ -36301,10 +36457,15 @@ Synced — exiting watch.`));
|
|
|
36301
36457
|
process.exit(1);
|
|
36302
36458
|
}
|
|
36303
36459
|
});
|
|
36304
|
-
subgraphs.command("reindex <name>").description("Reindex a subgraph from historical blocks (drops + reprocesses)").option("--from <
|
|
36460
|
+
subgraphs.command("reindex <name>").description("Reindex a subgraph from historical blocks (drops + reprocesses)").option("--from-block <n>", "Start block height").option("--to-block <n>", "End block height").option("--from <n>", "Deprecated alias for --from-block").option("--to <n>", "Deprecated alias for --to-block").option("-y, --yes", "Skip confirmation").addHelpText("after", `
|
|
36461
|
+
Examples:
|
|
36462
|
+
$ sl subgraphs reindex my-graph -y
|
|
36463
|
+
$ sl subgraphs reindex my-graph --from-block 150000 --to-block 160000 -y`).action(async (name, options2) => {
|
|
36305
36464
|
try {
|
|
36306
|
-
const
|
|
36307
|
-
const
|
|
36465
|
+
const fromRaw = options2.fromBlock ?? options2.from;
|
|
36466
|
+
const toRaw = options2.toBlock ?? options2.to;
|
|
36467
|
+
const fromBlock = fromRaw ? Number.parseInt(fromRaw, 10) : undefined;
|
|
36468
|
+
const toBlock = toRaw ? Number.parseInt(toRaw, 10) : undefined;
|
|
36308
36469
|
if (!options2.yes) {
|
|
36309
36470
|
if (!process.stdin.isTTY) {
|
|
36310
36471
|
error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
|
|
@@ -36342,23 +36503,34 @@ Synced — exiting watch.`));
|
|
|
36342
36503
|
handleApiError(err, "reindex subgraph");
|
|
36343
36504
|
}
|
|
36344
36505
|
});
|
|
36345
|
-
subgraphs.command("backfill <name>").description("Backfill a block range without dropping existing data").
|
|
36506
|
+
subgraphs.command("backfill <name>").description("Backfill a block range without dropping existing data").option("--from-block <n>", "Start block height").option("--to-block <n>", "End block height").option("--from <n>", "Deprecated alias for --from-block").option("--to <n>", "Deprecated alias for --to-block").addHelpText("after", `
|
|
36507
|
+
Examples:
|
|
36508
|
+
$ sl subgraphs backfill my-graph --from-block 150000 --to-block 160000`).action(async (name, options2) => {
|
|
36346
36509
|
try {
|
|
36347
|
-
const
|
|
36348
|
-
const
|
|
36510
|
+
const fromRaw = options2.fromBlock ?? options2.from;
|
|
36511
|
+
const toRaw = options2.toBlock ?? options2.to;
|
|
36512
|
+
if (!fromRaw || !toRaw) {
|
|
36513
|
+
error("--from-block and --to-block are required");
|
|
36514
|
+
process.exit(1);
|
|
36515
|
+
}
|
|
36516
|
+
const fromBlock = Number.parseInt(fromRaw, 10);
|
|
36517
|
+
const toBlock = Number.parseInt(toRaw, 10);
|
|
36349
36518
|
if (Number.isNaN(fromBlock) || Number.isNaN(toBlock)) {
|
|
36350
|
-
error("--from and --to must be valid block numbers");
|
|
36519
|
+
error("--from-block and --to-block must be valid block numbers");
|
|
36351
36520
|
process.exit(1);
|
|
36352
36521
|
}
|
|
36353
36522
|
info(`Backfilling subgraph "${name}" from block ${fromBlock} to ${toBlock}...`);
|
|
36354
|
-
const result = await backfillSubgraphApi(name, {
|
|
36523
|
+
const result = await backfillSubgraphApi(name, {
|
|
36524
|
+
fromBlock,
|
|
36525
|
+
toBlock
|
|
36526
|
+
});
|
|
36355
36527
|
success(result.message);
|
|
36356
36528
|
info(`From block ${result.fromBlock} to ${result.toBlock}`);
|
|
36357
36529
|
} catch (err) {
|
|
36358
36530
|
handleApiError(err, "backfill subgraph");
|
|
36359
36531
|
}
|
|
36360
36532
|
});
|
|
36361
|
-
subgraphs.command("
|
|
36533
|
+
subgraphs.command("cancel <name>").alias("stop").description("Cancel a running reindex or backfill operation").action(async (name) => {
|
|
36362
36534
|
try {
|
|
36363
36535
|
info(`Stopping operation for subgraph "${name}"...`);
|
|
36364
36536
|
const result = await stopSubgraphApi(name);
|
|
@@ -36396,7 +36568,11 @@ ${result.meta.total} gap(s), ${result.meta.totalMissingBlocks} total missing blo
|
|
|
36396
36568
|
handleApiError(err, "get subgraph gaps");
|
|
36397
36569
|
}
|
|
36398
36570
|
});
|
|
36399
|
-
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").
|
|
36571
|
+
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").addHelpText("after", `
|
|
36572
|
+
Examples:
|
|
36573
|
+
$ sl subgraphs query my-graph balances --filter holder=SP2J6ZY... --limit 50
|
|
36574
|
+
$ sl subgraphs query my-graph transfers --filter amount.gte=1000 --sort _block_height --order desc
|
|
36575
|
+
$ sl subgraphs query my-graph balances --count`).action(async (name, table, options2) => {
|
|
36400
36576
|
try {
|
|
36401
36577
|
let filters;
|
|
36402
36578
|
try {
|
|
@@ -36450,7 +36626,7 @@ ${rows.length} row(s)`));
|
|
|
36450
36626
|
handleApiError(err, "query subgraph");
|
|
36451
36627
|
}
|
|
36452
36628
|
});
|
|
36453
|
-
subgraphs.command("delete <name>").description("Delete a subgraph and its data").option("-y, --yes", "Skip confirmation").option("--force", "Cancel active operations and force delete").action(async (name, options2) => {
|
|
36629
|
+
subgraphs.command("delete <name>").alias("rm").description("Delete a subgraph and its data").option("-y, --yes", "Skip confirmation").option("--force", "Cancel active operations and force delete").action(async (name, options2) => {
|
|
36454
36630
|
try {
|
|
36455
36631
|
if (!options2.yes && !options2.force) {
|
|
36456
36632
|
if (!process.stdin.isTTY) {
|
|
@@ -36494,7 +36670,11 @@ ${rows.length} row(s)`));
|
|
|
36494
36670
|
handleApiError(err, "delete subgraph");
|
|
36495
36671
|
}
|
|
36496
36672
|
});
|
|
36497
|
-
subgraphs.command("scaffold [contractAddress]").description("Scaffold a defineSubgraph() file
|
|
36673
|
+
subgraphs.command("scaffold [contractAddress]").description("Scaffold a defineSubgraph() file from a contract or trait").option("-o, --output <path>", "Output file path (required)").option("-k, --api-key <key>", "Stacks node API key for direct RPC URLs").option("--functions <names>", "Comma-separated public functions to index as typed contract_call tables").option("--trait <std>", "Scaffold a trait-scoped source (sip-009|sip-010|sip-013) — no contract needed").option("--no-install", "Skip bun install after writing package.json").addHelpText("after", `
|
|
36674
|
+
Examples:
|
|
36675
|
+
$ sl subgraphs scaffold SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.megapont-ape-club-nft -o subgraphs/apes.ts
|
|
36676
|
+
$ sl subgraphs scaffold SP00...token --functions transfer,mint -o subgraphs/token.ts
|
|
36677
|
+
$ sl subgraphs scaffold --trait sip-010 -o subgraphs/all-ft.ts`).action(async (contractAddress, options2) => {
|
|
36498
36678
|
try {
|
|
36499
36679
|
if (!options2.output) {
|
|
36500
36680
|
error("--output <path> is required");
|
|
@@ -36553,7 +36733,7 @@ ${rows.length} row(s)`));
|
|
|
36553
36733
|
process.exit(1);
|
|
36554
36734
|
}
|
|
36555
36735
|
});
|
|
36556
|
-
subgraphs.command("client <subgraphName>").
|
|
36736
|
+
subgraphs.command("client <subgraphName>").description("Generate a typed query client for a deployed subgraph").option("-o, --output <path>", "Output file path (required)").action(async (subgraphName, options2) => {
|
|
36557
36737
|
try {
|
|
36558
36738
|
if (!options2.output) {
|
|
36559
36739
|
error("--output <path> is required");
|
|
@@ -36583,7 +36763,7 @@ init_node_manager();
|
|
|
36583
36763
|
init_output();
|
|
36584
36764
|
function registerStackCommand(program2) {
|
|
36585
36765
|
const stack = program2.command("stack").description("Manage the full stack");
|
|
36586
|
-
stack.command("start").description("Start the full stack (node + dev services)").option("--no-node", "Skip starting the Stacks node").option("--no-dev", "Skip starting dev services").
|
|
36766
|
+
stack.command("start").description("Start the full stack (node + dev services)").option("--no-node", "Skip starting the Stacks node").option("--no-dev", "Skip starting dev services").hook("preAction", async () => {
|
|
36587
36767
|
await requireLocalNetwork();
|
|
36588
36768
|
}).action(async (options2) => {
|
|
36589
36769
|
await stackStart(options2);
|
|
@@ -36611,7 +36791,7 @@ async function stackStart(options2) {
|
|
|
36611
36791
|
}
|
|
36612
36792
|
throw err;
|
|
36613
36793
|
}
|
|
36614
|
-
const network =
|
|
36794
|
+
const network = process.env.STACKS_NETWORK ?? config.node?.network ?? "mainnet";
|
|
36615
36795
|
const validation = await validateNetworkConsistency(config);
|
|
36616
36796
|
if (!validation.valid) {
|
|
36617
36797
|
error("Network mismatch detected:");
|
|
@@ -36755,6 +36935,7 @@ async function stackStop(options2) {
|
|
|
36755
36935
|
}
|
|
36756
36936
|
// src/commands/streams.ts
|
|
36757
36937
|
init_output();
|
|
36938
|
+
init_resolve_auth();
|
|
36758
36939
|
import { createStreamsClient } from "@secondlayer/sdk";
|
|
36759
36940
|
var DEFAULT_BASE_URL = "https://api.secondlayer.tools";
|
|
36760
36941
|
var VALID_TYPES = [
|
|
@@ -36771,9 +36952,9 @@ var VALID_TYPES = [
|
|
|
36771
36952
|
"print"
|
|
36772
36953
|
];
|
|
36773
36954
|
function readApiKey() {
|
|
36774
|
-
const key =
|
|
36955
|
+
const key = resolveEnvKey();
|
|
36775
36956
|
if (!key) {
|
|
36776
|
-
error("
|
|
36957
|
+
error("No API key set. Export SL_API_KEY (issue one at https://www.secondlayer.tools/platform/api-keys).");
|
|
36777
36958
|
process.exit(1);
|
|
36778
36959
|
}
|
|
36779
36960
|
return key;
|
|
@@ -36814,40 +36995,45 @@ function parseHeight(value, name) {
|
|
|
36814
36995
|
return n;
|
|
36815
36996
|
}
|
|
36816
36997
|
function registerStreamsCommand(program2) {
|
|
36817
|
-
const streams = program2.command("streams").description("Read raw chain events from Streams (requires
|
|
36998
|
+
const streams = program2.command("streams").description("Read raw chain events from Streams (requires SL_API_KEY)");
|
|
36818
36999
|
streams.command("tip").description("Print current canonical tip").action(async () => {
|
|
36819
37000
|
try {
|
|
36820
37001
|
const tip = await client().tip();
|
|
36821
|
-
|
|
36822
|
-
`);
|
|
37002
|
+
writeData(JSON.stringify(tip, null, 2));
|
|
36823
37003
|
} catch (err) {
|
|
36824
37004
|
error(err instanceof Error ? err.message : String(err));
|
|
36825
37005
|
process.exit(1);
|
|
36826
37006
|
}
|
|
36827
37007
|
});
|
|
36828
|
-
streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--contract-id <id>", "filter to a single contract identifier").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--from-
|
|
37008
|
+
streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--contract-id <id>", "filter to a single contract identifier").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--from-block <n>", "filter to blocks >= n").option("--to-block <n>", "filter to blocks <= n").option("--from-height <n>", "Deprecated alias for --from-block").option("--to-height <n>", "Deprecated alias for --to-block").option("--limit <n>", "page size (1-1000, default 100)", "100").addHelpText("after", `
|
|
37009
|
+
Examples:
|
|
37010
|
+
$ sl streams events --types stx_transfer,print --limit 50
|
|
37011
|
+
$ sl streams events --contract-id SP00....token --from-block 150000 --to-block 160000
|
|
37012
|
+
$ sl streams events --cursor 150000:3`).action(async (options2) => {
|
|
36829
37013
|
try {
|
|
36830
37014
|
const envelope = await client().events.list({
|
|
36831
37015
|
types: parseTypes(options2.types),
|
|
36832
37016
|
contractId: options2.contractId,
|
|
36833
37017
|
cursor: options2.cursor,
|
|
36834
|
-
fromHeight: parseHeight(options2.fromHeight, "--from-
|
|
36835
|
-
toHeight: parseHeight(options2.toHeight, "--to-
|
|
37018
|
+
fromHeight: parseHeight(options2.fromBlock ?? options2.fromHeight, "--from-block"),
|
|
37019
|
+
toHeight: parseHeight(options2.toBlock ?? options2.toHeight, "--to-block"),
|
|
36836
37020
|
limit: parseLimit(options2.limit)
|
|
36837
37021
|
});
|
|
36838
|
-
|
|
36839
|
-
`);
|
|
37022
|
+
writeData(JSON.stringify(envelope, null, 2));
|
|
36840
37023
|
} catch (err) {
|
|
36841
37024
|
error(err instanceof Error ? err.message : String(err));
|
|
36842
37025
|
process.exit(1);
|
|
36843
37026
|
}
|
|
36844
37027
|
});
|
|
36845
|
-
streams.command("consume").description("Long-running pull from a cursor; emits one event per line (jsonl) until SIGINT or --max-pages").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--contract-id <id>", "filter to a single contract identifier").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--batch-size <n>", "events per batch (1-1000, default 100)", "100").option("--max-pages <n>", "stop after N pages (default: run until SIGINT)").
|
|
37028
|
+
streams.command("consume").description("Long-running pull from a cursor; emits one event per line (jsonl) until SIGINT or --max-pages").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--contract-id <id>", "filter to a single contract identifier").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--batch-size <n>", "events per batch (1-1000, default 100)", "100").option("--max-pages <n>", "stop after N pages (default: run until SIGINT)").addHelpText("after", `
|
|
37029
|
+
Examples:
|
|
37030
|
+
$ sl streams consume --types print --cursor 150000:0
|
|
37031
|
+
$ sl streams consume --types stx_transfer --batch-size 500 --max-pages 10`).action(async (options2) => {
|
|
36846
37032
|
try {
|
|
36847
37033
|
const types6 = parseTypes(options2.types);
|
|
36848
37034
|
const batchSize = parseLimit(options2.batchSize) ?? 100;
|
|
36849
37035
|
const maxPages = options2.maxPages ? Number.parseInt(options2.maxPages, 10) : undefined;
|
|
36850
|
-
|
|
37036
|
+
note("# streaming events to stdout (jsonl); next_cursor printed to stderr");
|
|
36851
37037
|
await client().events.consume({
|
|
36852
37038
|
fromCursor: options2.cursor,
|
|
36853
37039
|
types: types6,
|
|
@@ -36878,8 +37064,7 @@ function registerStreamsCommand(program2) {
|
|
|
36878
37064
|
since: options2.since,
|
|
36879
37065
|
limit: parseLimit(options2.limit)
|
|
36880
37066
|
});
|
|
36881
|
-
|
|
36882
|
-
`);
|
|
37067
|
+
writeData(JSON.stringify(envelope, null, 2));
|
|
36883
37068
|
} catch (err) {
|
|
36884
37069
|
error(err instanceof Error ? err.message : String(err));
|
|
36885
37070
|
process.exit(1);
|
|
@@ -36891,8 +37076,7 @@ function registerStreamsCommand(program2) {
|
|
|
36891
37076
|
if (height === undefined)
|
|
36892
37077
|
throw new Error("<height> is required");
|
|
36893
37078
|
const block = await client().canonical(height);
|
|
36894
|
-
|
|
36895
|
-
`);
|
|
37079
|
+
writeData(JSON.stringify(block, null, 2));
|
|
36896
37080
|
} catch (err) {
|
|
36897
37081
|
error(err instanceof Error ? err.message : String(err));
|
|
36898
37082
|
process.exit(1);
|
|
@@ -36922,14 +37106,17 @@ function registerDatasetsCommand(program2) {
|
|
|
36922
37106
|
datasets.command("list").description("List the dataset catalog + freshness").action(async () => {
|
|
36923
37107
|
try {
|
|
36924
37108
|
const catalog = await client2().listDatasets();
|
|
36925
|
-
|
|
36926
|
-
`);
|
|
37109
|
+
writeData(JSON.stringify(catalog, null, 2));
|
|
36927
37110
|
} catch (err) {
|
|
36928
37111
|
error(`Failed to list datasets: ${err}`);
|
|
36929
37112
|
process.exit(1);
|
|
36930
37113
|
}
|
|
36931
37114
|
});
|
|
36932
|
-
datasets.command("query <dataset>").description(`Query a cursor-paginated dataset (${Object.keys(CURSOR_SLUGS).join(", ")})`).option("--filter <key=value...>", "Filter as key=value (e.g. --filter stacker=SP… --filter address=SP…)").option("--limit <n>", "Rows per page").option("--cursor <cursor>", "Resume token from a previous next_cursor").option("--json", "Print the full envelope as JSON").
|
|
37115
|
+
datasets.command("query <dataset>").description(`Query a cursor-paginated dataset (${Object.keys(CURSOR_SLUGS).join(", ")})`).option("--filter <key=value...>", "Filter as key=value (e.g. --filter stacker=SP… --filter address=SP…)").option("--limit <n>", "Rows per page").option("--cursor <cursor>", "Resume token from a previous next_cursor").option("--json", "Print the full envelope as JSON").addHelpText("after", `
|
|
37116
|
+
Examples:
|
|
37117
|
+
$ sl datasets query stx-transfers --filter sender=SP2J6ZY... --limit 100
|
|
37118
|
+
$ sl datasets query sbtc-events --filter amount.gte=1000
|
|
37119
|
+
$ sl datasets query bns-events --cursor 150000:3 --json`).action(async (dataset, options2) => {
|
|
36933
37120
|
try {
|
|
36934
37121
|
const params = parseFilters(options2.filter);
|
|
36935
37122
|
if (options2.limit)
|
|
@@ -36937,16 +37124,15 @@ function registerDatasetsCommand(program2) {
|
|
|
36937
37124
|
if (options2.cursor)
|
|
36938
37125
|
params.cursor = options2.cursor;
|
|
36939
37126
|
const env = await client2().query(dataset, params);
|
|
36940
|
-
|
|
36941
|
-
|
|
36942
|
-
|
|
36943
|
-
|
|
36944
|
-
|
|
36945
|
-
|
|
36946
|
-
|
|
36947
|
-
info(`next_cursor: ${env.next_cursor}`);
|
|
37127
|
+
output({
|
|
37128
|
+
json: options2.json,
|
|
37129
|
+
data: env,
|
|
37130
|
+
human: () => {
|
|
37131
|
+
writeData(JSON.stringify(env.rows, null, 2));
|
|
37132
|
+
if (env.next_cursor)
|
|
37133
|
+
note(`next_cursor: ${env.next_cursor}`);
|
|
36948
37134
|
}
|
|
36949
|
-
}
|
|
37135
|
+
});
|
|
36950
37136
|
} catch (err) {
|
|
36951
37137
|
error(`Failed to query dataset: ${err}`);
|
|
36952
37138
|
process.exit(1);
|
|
@@ -37314,7 +37500,7 @@ function registerLocalCommand(program2) {
|
|
|
37314
37500
|
return;
|
|
37315
37501
|
await requireLocalNetwork();
|
|
37316
37502
|
});
|
|
37317
|
-
local.command("start").description("Start all local dev services (API, indexer, worker)").option("--indexer-port <port>", "Indexer port", "3700").option("--api-port <port>", "API port", "3800").option("--no-worker", "Skip worker service").option("--stacks-node", "Use port 3701 for indexer (avoids conflict with stacks-blockchain-api)").option("
|
|
37503
|
+
local.command("start").description("Start all local dev services (API, indexer, worker)").option("--indexer-port <port>", "Indexer port", "3700").option("--api-port <port>", "API port", "3800").option("--no-worker", "Skip worker service").option("--stacks-node", "Use port 3701 for indexer (avoids conflict with stacks-blockchain-api)").option("--foreground", "Run in foreground (blocking)").action(async (options2) => {
|
|
37318
37504
|
const { runBackground: runBackground2, runForeground: runForeground2, isDevAlreadyRunning: isDevAlreadyRunning2 } = await Promise.resolve().then(() => (init_dev_impl(), exports_dev_impl));
|
|
37319
37505
|
if (await isDevAlreadyRunning2()) {
|
|
37320
37506
|
return;
|
|
@@ -37339,6 +37525,7 @@ function registerLocalCommand(program2) {
|
|
|
37339
37525
|
local.command("logs").description("View local service logs (dev + node)").option("-s, --service <name>", "Filter by service (api, indexer, worker, 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").action(async (options2) => {
|
|
37340
37526
|
await showLocalLogs(options2);
|
|
37341
37527
|
});
|
|
37528
|
+
addDbCommand(local);
|
|
37342
37529
|
const node = local.command("node").description("Manage local Stacks node");
|
|
37343
37530
|
node.command("setup").description("Interactive setup wizard for Stacks node").action(async () => {
|
|
37344
37531
|
const { runSetupWizard: runSetupWizard2 } = await Promise.resolve().then(() => (init_node_impl(), exports_node_impl));
|
|
@@ -37348,13 +37535,13 @@ function registerLocalCommand(program2) {
|
|
|
37348
37535
|
const { startNode: startNode2 } = await Promise.resolve().then(() => (init_node_impl(), exports_node_impl));
|
|
37349
37536
|
await startNode2(options2.path, options2.withIndexer);
|
|
37350
37537
|
});
|
|
37351
|
-
node.command("stop").description("Stop the Stacks node").option("-p, --path <path>", "Path to stacks-blockchain-docker (overrides config)").option("-
|
|
37538
|
+
node.command("stop").description("Stop the Stacks node").option("-p, --path <path>", "Path to stacks-blockchain-docker (overrides config)").option("-y, --yes", "Skip confirmation").option("--force", "Deprecated alias for --yes").option("--wait", "Wait for in-flight work to drain first").action(async (options2) => {
|
|
37352
37539
|
const { stopNode: stopNode2 } = await Promise.resolve().then(() => (init_node_impl(), exports_node_impl));
|
|
37353
|
-
await stopNode2(options2.path, options2.force, options2.wait);
|
|
37540
|
+
await stopNode2(options2.path, options2.yes ?? options2.force, options2.wait);
|
|
37354
37541
|
});
|
|
37355
|
-
node.command("restart").description("Restart the Stacks node (stop then start)").option("-p, --path <path>", "Path to stacks-blockchain-docker (overrides config)").option("-
|
|
37542
|
+
node.command("restart").description("Restart the Stacks node (stop then start)").option("-p, --path <path>", "Path to stacks-blockchain-docker (overrides config)").option("-y, --yes", "Skip confirmation").option("--force", "Deprecated alias for --yes").option("--wait", "Wait for in-flight work to drain before stopping").action(async (options2) => {
|
|
37356
37543
|
const { restartNode: restartNode2 } = await Promise.resolve().then(() => (init_node_impl(), exports_node_impl));
|
|
37357
|
-
await restartNode2(options2.path, options2.force, options2.wait);
|
|
37544
|
+
await restartNode2(options2.path, options2.yes ?? options2.force, options2.wait);
|
|
37358
37545
|
});
|
|
37359
37546
|
node.command("status").description("Show Stacks node status").option("-p, --path <path>", "Path to stacks-blockchain-docker (overrides config)").option("--json", "Output as JSON").action(async (options2) => {
|
|
37360
37547
|
const { showStatus: showStatus2 } = await Promise.resolve().then(() => (init_node_impl(), exports_node_impl));
|
|
@@ -37628,19 +37815,19 @@ async function writeActiveProject(slug, cwd) {
|
|
|
37628
37815
|
}
|
|
37629
37816
|
|
|
37630
37817
|
// src/commands/whoami.ts
|
|
37631
|
-
|
|
37818
|
+
init_resolve_auth();
|
|
37632
37819
|
function registerWhoamiCommand(program2) {
|
|
37633
|
-
program2.command("whoami").description("Show
|
|
37634
|
-
|
|
37635
|
-
|
|
37820
|
+
program2.command("whoami").description("Show the active account, credential source, and project").option("--json", "Output as JSON").action(async (options2) => {
|
|
37821
|
+
let auth;
|
|
37822
|
+
try {
|
|
37823
|
+
auth = await resolveAuth();
|
|
37824
|
+
} catch {
|
|
37636
37825
|
error("Not logged in. Run: sl login");
|
|
37637
|
-
process.exit(
|
|
37826
|
+
process.exit(1);
|
|
37638
37827
|
}
|
|
37639
|
-
|
|
37640
|
-
rows.push(["Email", session.email]);
|
|
37828
|
+
let account;
|
|
37641
37829
|
try {
|
|
37642
|
-
|
|
37643
|
-
rows.push(["Plan", account.plan]);
|
|
37830
|
+
account = await httpPlatform("/api/accounts/me");
|
|
37644
37831
|
} catch (err) {
|
|
37645
37832
|
if (err instanceof CliHttpError && err.code === "SESSION_EXPIRED") {
|
|
37646
37833
|
error("Session expired. Run: sl login");
|
|
@@ -37650,13 +37837,34 @@ function registerWhoamiCommand(program2) {
|
|
|
37650
37837
|
}
|
|
37651
37838
|
const config = await loadConfig();
|
|
37652
37839
|
const active = await readActiveProject(process.cwd(), config.defaultProject);
|
|
37653
|
-
|
|
37654
|
-
|
|
37655
|
-
|
|
37656
|
-
|
|
37657
|
-
|
|
37658
|
-
|
|
37659
|
-
|
|
37840
|
+
const authSource = auth.fromEnv ? "API key (env)" : "session";
|
|
37841
|
+
output({
|
|
37842
|
+
json: options2.json,
|
|
37843
|
+
data: {
|
|
37844
|
+
email: account.email,
|
|
37845
|
+
plan: account.plan,
|
|
37846
|
+
apiUrl: auth.apiUrl,
|
|
37847
|
+
authSource,
|
|
37848
|
+
project: active ? { slug: active.slug, source: active.resolvedFrom } : null
|
|
37849
|
+
},
|
|
37850
|
+
human: () => {
|
|
37851
|
+
const rows = [];
|
|
37852
|
+
rows.push(["Email", account.email]);
|
|
37853
|
+
rows.push(["Plan", account.plan]);
|
|
37854
|
+
rows.push(["API URL", auth.apiUrl]);
|
|
37855
|
+
rows.push(["Auth", dim(authSource)]);
|
|
37856
|
+
if (active) {
|
|
37857
|
+
rows.push(["Project", active.slug]);
|
|
37858
|
+
rows.push(["Project source", dim(active.resolvedFrom)]);
|
|
37859
|
+
} else {
|
|
37860
|
+
rows.push([
|
|
37861
|
+
"Project",
|
|
37862
|
+
dim("(none — run `sl project create <name>`)")
|
|
37863
|
+
]);
|
|
37864
|
+
}
|
|
37865
|
+
console.log(formatKeyValue(rows));
|
|
37866
|
+
}
|
|
37867
|
+
});
|
|
37660
37868
|
});
|
|
37661
37869
|
}
|
|
37662
37870
|
// src/commands/logout.ts
|
|
@@ -37685,7 +37893,7 @@ init_config();
|
|
|
37685
37893
|
import { input as input4 } from "@inquirer/prompts";
|
|
37686
37894
|
init_output();
|
|
37687
37895
|
function registerProjectCommand(program2) {
|
|
37688
|
-
const project = program2.command("project").description("Manage Secondlayer projects");
|
|
37896
|
+
const project = program2.command("projects").alias("project").description("Manage Secondlayer projects");
|
|
37689
37897
|
project.command("create [name]").description("Create a new project").option("--slug <slug>", "Project URL identifier").action(async (nameArg, options2 = {}) => {
|
|
37690
37898
|
const name = nameArg ?? await input4({
|
|
37691
37899
|
message: "Project name",
|
|
@@ -37715,24 +37923,30 @@ function registerProjectCommand(program2) {
|
|
|
37715
37923
|
handleProjectError(err);
|
|
37716
37924
|
}
|
|
37717
37925
|
});
|
|
37718
|
-
project.command("list").description("List projects in your account").action(async () => {
|
|
37926
|
+
project.command("list").alias("ls").description("List projects in your account").option("--json", "Output as JSON").action(async (options2) => {
|
|
37719
37927
|
try {
|
|
37720
37928
|
const res = await httpPlatform("/api/projects");
|
|
37721
|
-
if (res.projects.length === 0) {
|
|
37722
|
-
info("No projects yet — run `sl project create <name>` to start.");
|
|
37723
|
-
return;
|
|
37724
|
-
}
|
|
37725
37929
|
const active = await readActiveProject(process.cwd(), (await loadConfig()).defaultProject);
|
|
37726
|
-
|
|
37727
|
-
|
|
37728
|
-
|
|
37729
|
-
|
|
37730
|
-
|
|
37731
|
-
|
|
37732
|
-
|
|
37733
|
-
|
|
37734
|
-
|
|
37735
|
-
|
|
37930
|
+
output({
|
|
37931
|
+
json: options2.json,
|
|
37932
|
+
data: { projects: res.projects, active: active?.slug ?? null },
|
|
37933
|
+
human: () => {
|
|
37934
|
+
if (res.projects.length === 0) {
|
|
37935
|
+
info("No projects yet — run `sl project create <name>` to start.");
|
|
37936
|
+
return;
|
|
37937
|
+
}
|
|
37938
|
+
const rows = res.projects.map((p) => [
|
|
37939
|
+
p.slug === active?.slug ? `* ${p.slug}` : ` ${p.slug}`,
|
|
37940
|
+
p.name,
|
|
37941
|
+
p.network,
|
|
37942
|
+
new Date(p.createdAt).toLocaleDateString()
|
|
37943
|
+
]);
|
|
37944
|
+
console.log(formatTable(["", "Name", "Network", "Created"], rows));
|
|
37945
|
+
if (active) {
|
|
37946
|
+
console.log(dim(`Active: ${active.slug} (from ${active.resolvedFrom})`));
|
|
37947
|
+
}
|
|
37948
|
+
}
|
|
37949
|
+
});
|
|
37736
37950
|
} catch (err) {
|
|
37737
37951
|
handleProjectError(err);
|
|
37738
37952
|
}
|
|
@@ -37752,16 +37966,22 @@ function registerProjectCommand(program2) {
|
|
|
37752
37966
|
info(dim(`Written to ${path2}`));
|
|
37753
37967
|
info(dim("Tip: add `.secondlayer/` to .gitignore — it's account-personal."));
|
|
37754
37968
|
});
|
|
37755
|
-
project.command("current").description("Show the active project for this directory").action(async () => {
|
|
37969
|
+
project.command("get").alias("current").description("Show the active project for this directory").option("--json", "Output as JSON").action(async (options2) => {
|
|
37756
37970
|
const config = await loadConfig();
|
|
37757
37971
|
const active = await readActiveProject(process.cwd(), config.defaultProject);
|
|
37758
|
-
|
|
37759
|
-
|
|
37760
|
-
|
|
37761
|
-
|
|
37762
|
-
|
|
37763
|
-
|
|
37764
|
-
|
|
37972
|
+
output({
|
|
37973
|
+
json: options2.json,
|
|
37974
|
+
data: active ? { slug: active.slug, source: active.resolvedFrom } : null,
|
|
37975
|
+
human: () => {
|
|
37976
|
+
if (!active) {
|
|
37977
|
+
info("No active project.");
|
|
37978
|
+
info(dim("Run 'sl project create <name>' or 'sl project use <slug>'."));
|
|
37979
|
+
return;
|
|
37980
|
+
}
|
|
37981
|
+
console.log(active.slug);
|
|
37982
|
+
console.log(dim(`(from ${active.resolvedFrom})`));
|
|
37983
|
+
}
|
|
37984
|
+
});
|
|
37765
37985
|
});
|
|
37766
37986
|
}
|
|
37767
37987
|
function handleProjectError(err) {
|
|
@@ -37790,11 +38010,15 @@ function validateProjectSlug(slug) {
|
|
|
37790
38010
|
}
|
|
37791
38011
|
// src/cli.ts
|
|
37792
38012
|
var { version } = package_default;
|
|
37793
|
-
program.name("secondlayer").alias("sl").description("SecondLayer CLI — dedicated Stacks indexing + real-time subgraphs").version(version).option("--network <network>", "Override network (local, testnet, mainnet)");
|
|
38013
|
+
program.name("secondlayer").alias("sl").description("SecondLayer CLI — dedicated Stacks indexing + real-time subgraphs").version(version).option("--network <network>", "Override network (local, testnet, mainnet)").option("--api-key <key>", "API credential (overrides SL_API_KEY)").option("--api-url <url>", "API endpoint (overrides SL_API_URL)").showSuggestionAfterError(true).showHelpAfterError("(run `sl --help` to see available commands)");
|
|
37794
38014
|
program.hook("preAction", (thisCommand) => {
|
|
37795
|
-
const
|
|
37796
|
-
if (
|
|
37797
|
-
process.env.STACKS_NETWORK =
|
|
38015
|
+
const { network, apiKey, apiUrl } = thisCommand.opts();
|
|
38016
|
+
if (network)
|
|
38017
|
+
process.env.STACKS_NETWORK = network;
|
|
38018
|
+
if (apiKey)
|
|
38019
|
+
process.env.SL_API_KEY = apiKey;
|
|
38020
|
+
if (apiUrl)
|
|
38021
|
+
process.env.SL_API_URL = apiUrl;
|
|
37798
38022
|
});
|
|
37799
38023
|
program.addHelpText("after", `
|
|
37800
38024
|
Quickstart:
|
|
@@ -37803,10 +38027,7 @@ Quickstart:
|
|
|
37803
38027
|
$ sl subgraphs deploy subgraphs/my-watcher.ts
|
|
37804
38028
|
$ sl subgraphs status my-watcher
|
|
37805
38029
|
`);
|
|
37806
|
-
program.
|
|
37807
|
-
const { generate: generate2 } = await Promise.resolve().then(() => (init_generate(), exports_generate));
|
|
37808
|
-
await generate2(files, options3);
|
|
37809
|
-
});
|
|
38030
|
+
program.commandsGroup("Getting started:");
|
|
37810
38031
|
program.command("init").description("Initialize a new secondlayer.config.ts file").action(async () => {
|
|
37811
38032
|
const { init: init3 } = await Promise.resolve().then(() => (init_init(), exports_init));
|
|
37812
38033
|
await init3();
|
|
@@ -37814,22 +38035,39 @@ program.command("init").description("Initialize a new secondlayer.config.ts file
|
|
|
37814
38035
|
registerLoginCommand(program);
|
|
37815
38036
|
registerLogoutCommand(program);
|
|
37816
38037
|
registerWhoamiCommand(program);
|
|
37817
|
-
|
|
38038
|
+
program.commandsGroup("Data products:");
|
|
37818
38039
|
registerSubgraphsCommand(program);
|
|
37819
38040
|
registerCreateCommand(program);
|
|
37820
38041
|
registerSubscriptionsCommand(program);
|
|
37821
38042
|
registerStreamsCommand(program);
|
|
37822
38043
|
registerDatasetsCommand(program);
|
|
37823
|
-
|
|
38044
|
+
program.commandsGroup("Project & codegen:");
|
|
38045
|
+
registerProjectCommand(program);
|
|
38046
|
+
var configureGenerate = (cmd) => cmd.option("-c, --config <path>", "Path to config file").option("-o, --output <path>", "Output file path (required when using direct files)").option("--out <path>", "Deprecated alias for --output").option("-k, --api-key <key>", "Stacks node API key for direct RPC URLs").option("-w, --watch", "Watch for changes").action(async (files, options3) => {
|
|
38047
|
+
options3.out = options3.output ?? options3.out;
|
|
38048
|
+
const { generate: generate2 } = await Promise.resolve().then(() => (init_generate(), exports_generate));
|
|
38049
|
+
await generate2(files, options3);
|
|
38050
|
+
});
|
|
38051
|
+
var contracts = program.command("contracts").description("Work with Clarity contracts");
|
|
38052
|
+
configureGenerate(contracts.command("generate [files...]").aliases(["gen"]).description("Generate TypeScript interfaces from Clarity contracts")).addHelpText("after", `
|
|
38053
|
+
Examples:
|
|
38054
|
+
$ sl contracts generate
|
|
38055
|
+
$ sl contracts generate ./contracts/pool.clar -o ./src/generated.ts
|
|
38056
|
+
$ sl contracts generate --config secondlayer.config.ts --watch`);
|
|
38057
|
+
configureGenerate(program.command("generate [files...]").aliases(["gen"]).description("Deprecated: use `sl contracts generate`"));
|
|
38058
|
+
program.commandsGroup("Local development:");
|
|
38059
|
+
registerLocalCommand(program);
|
|
38060
|
+
registerDevnetCommand(program);
|
|
37824
38061
|
registerStackCommand(program);
|
|
37825
38062
|
registerDbCommand(program);
|
|
38063
|
+
program.commandsGroup("Diagnostics:");
|
|
38064
|
+
registerStatusCommand(program);
|
|
37826
38065
|
registerDoctorCommand(program);
|
|
37827
38066
|
registerConfigCommand(program);
|
|
37828
|
-
|
|
37829
|
-
registerDevnetCommand(program);
|
|
38067
|
+
program.commandsGroup("Account:");
|
|
37830
38068
|
registerAccountCommand(program);
|
|
37831
38069
|
registerBillingCommand(program);
|
|
37832
38070
|
program.parse();
|
|
37833
38071
|
|
|
37834
|
-
//# debugId=
|
|
38072
|
+
//# debugId=14BF0C548ABB243864756E2164756E21
|
|
37835
38073
|
//# sourceMappingURL=cli.js.map
|