@drewpayment/mink 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -1
- package/dashboard/out/404.html +1 -1
- package/dashboard/out/action-log.html +1 -1
- package/dashboard/out/action-log.txt +1 -1
- package/dashboard/out/activity.html +1 -1
- package/dashboard/out/activity.txt +1 -1
- package/dashboard/out/bugs.html +1 -1
- package/dashboard/out/bugs.txt +1 -1
- package/dashboard/out/capture.html +1 -1
- package/dashboard/out/capture.txt +1 -1
- package/dashboard/out/config.html +1 -1
- package/dashboard/out/config.txt +1 -1
- package/dashboard/out/daemon.html +1 -1
- package/dashboard/out/daemon.txt +1 -1
- package/dashboard/out/design.html +1 -1
- package/dashboard/out/design.txt +1 -1
- package/dashboard/out/discord.html +1 -1
- package/dashboard/out/discord.txt +1 -1
- package/dashboard/out/file-index.html +1 -1
- package/dashboard/out/file-index.txt +1 -1
- package/dashboard/out/index.html +1 -1
- package/dashboard/out/index.txt +1 -1
- package/dashboard/out/insights.html +1 -1
- package/dashboard/out/insights.txt +1 -1
- package/dashboard/out/learning.html +1 -1
- package/dashboard/out/learning.txt +1 -1
- package/dashboard/out/overview.html +1 -1
- package/dashboard/out/overview.txt +1 -1
- package/dashboard/out/scheduler.html +1 -1
- package/dashboard/out/scheduler.txt +1 -1
- package/dashboard/out/sync.html +1 -1
- package/dashboard/out/sync.txt +1 -1
- package/dashboard/out/tokens.html +1 -1
- package/dashboard/out/tokens.txt +1 -1
- package/dashboard/out/waste.html +1 -1
- package/dashboard/out/waste.txt +1 -1
- package/dashboard/out/wiki.html +1 -1
- package/dashboard/out/wiki.txt +1 -1
- package/dist/cli.js +988 -454
- package/package.json +1 -1
- package/src/cli.ts +9 -2
- package/src/commands/scan.ts +29 -6
- package/src/commands/upgrade.ts +128 -0
- package/src/commands/wiki.ts +19 -3
- package/src/core/note-index.ts +50 -1
- package/src/core/scanner.ts +19 -3
- package/src/core/self-update.ts +363 -0
- package/src/core/task-registry.ts +52 -2
- package/src/types/config.ts +24 -0
- package/src/types/note.ts +1 -0
- /package/dashboard/out/_next/static/{r7Xr9mrUpunsz4QtD3jh1 → e0QWU9rPMeSlJJLTwij89}/_buildManifest.js +0 -0
- /package/dashboard/out/_next/static/{r7Xr9mrUpunsz4QtD3jh1 → e0QWU9rPMeSlJJLTwij89}/_ssgManifest.js +0 -0
package/dist/cli.js
CHANGED
|
@@ -797,6 +797,27 @@ var init_config = __esm(() => {
|
|
|
797
797
|
envVar: "MINK_CHANNEL_SKIP_PERMISSIONS",
|
|
798
798
|
description: "Pass --dangerously-skip-permissions so the channel can run without terminal prompts",
|
|
799
799
|
scope: "shared"
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
key: "cli.auto-update",
|
|
803
|
+
default: "false",
|
|
804
|
+
envVar: "MINK_CLI_AUTO_UPDATE",
|
|
805
|
+
description: "Auto-upgrade the mink CLI on schedule via the background scheduler",
|
|
806
|
+
scope: "shared"
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
key: "cli.auto-update-schedule",
|
|
810
|
+
default: "0 4 * * *",
|
|
811
|
+
envVar: "MINK_CLI_AUTO_UPDATE_SCHEDULE",
|
|
812
|
+
description: "Cron expression governing the cli-self-update scheduled task",
|
|
813
|
+
scope: "shared"
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
key: "cli.auto-update-package-manager",
|
|
817
|
+
default: "auto",
|
|
818
|
+
envVar: "MINK_CLI_AUTO_UPDATE_PACKAGE_MANAGER",
|
|
819
|
+
description: "Force a package manager (auto|npm|bun) for self-upgrade installs",
|
|
820
|
+
scope: "local"
|
|
800
821
|
}
|
|
801
822
|
];
|
|
802
823
|
VALID_KEYS = new Set(CONFIG_KEYS.map((k) => k.key));
|
|
@@ -1112,6 +1133,7 @@ import { readFileSync as readFileSync4, readdirSync, statSync } from "fs";
|
|
|
1112
1133
|
function createEmptyVaultIndex() {
|
|
1113
1134
|
return {
|
|
1114
1135
|
lastScanTimestamp: "",
|
|
1136
|
+
lastFullScanTimestamp: "",
|
|
1115
1137
|
totalNotes: 0,
|
|
1116
1138
|
entries: {}
|
|
1117
1139
|
};
|
|
@@ -1245,7 +1267,9 @@ function rebuildVaultIndex() {
|
|
|
1245
1267
|
updateVaultEntry(index, entry);
|
|
1246
1268
|
} catch {}
|
|
1247
1269
|
}
|
|
1248
|
-
|
|
1270
|
+
const now = new Date().toISOString();
|
|
1271
|
+
index.lastScanTimestamp = now;
|
|
1272
|
+
index.lastFullScanTimestamp = now;
|
|
1249
1273
|
saveVaultIndex(index);
|
|
1250
1274
|
return index;
|
|
1251
1275
|
}
|
|
@@ -1258,6 +1282,40 @@ function getRecentNotes(n) {
|
|
|
1258
1282
|
const index = loadVaultIndex();
|
|
1259
1283
|
return Object.values(index.entries).sort((a, b) => b.lastModified.localeCompare(a.lastModified)).slice(0, n);
|
|
1260
1284
|
}
|
|
1285
|
+
function vaultIndexStaleness() {
|
|
1286
|
+
const index = loadVaultIndex();
|
|
1287
|
+
const root = resolveVaultPath();
|
|
1288
|
+
const diskCount = collectAllMarkdown(root).length;
|
|
1289
|
+
const indexCount = Object.keys(index.entries).length;
|
|
1290
|
+
const lastFullScan = index.lastFullScanTimestamp || null;
|
|
1291
|
+
if (!lastFullScan) {
|
|
1292
|
+
return {
|
|
1293
|
+
isStale: true,
|
|
1294
|
+
reason: "no full scan on record",
|
|
1295
|
+
diskCount,
|
|
1296
|
+
indexCount,
|
|
1297
|
+
lastFullScan: null
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
const delta = Math.abs(diskCount - indexCount);
|
|
1301
|
+
const threshold = Math.max(5, Math.floor(diskCount * 0.05));
|
|
1302
|
+
if (delta >= threshold) {
|
|
1303
|
+
return {
|
|
1304
|
+
isStale: true,
|
|
1305
|
+
reason: `${diskCount} files on disk but ${indexCount} in index`,
|
|
1306
|
+
diskCount,
|
|
1307
|
+
indexCount,
|
|
1308
|
+
lastFullScan
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
return {
|
|
1312
|
+
isStale: false,
|
|
1313
|
+
reason: null,
|
|
1314
|
+
diskCount,
|
|
1315
|
+
indexCount,
|
|
1316
|
+
lastFullScan
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1261
1319
|
function collectAllMarkdown(rootPath) {
|
|
1262
1320
|
const files = [];
|
|
1263
1321
|
function walk(dir) {
|
|
@@ -3226,11 +3284,16 @@ function loadConfig(configPath3) {
|
|
|
3226
3284
|
function getExcludes(config) {
|
|
3227
3285
|
return [...DEFAULT_EXCLUDES, ...config.excludePatterns ?? []];
|
|
3228
3286
|
}
|
|
3229
|
-
function
|
|
3287
|
+
function scanProjectWithStats(projectRoot, excludes, maxFiles = DEFAULT_MAX_FILES) {
|
|
3230
3288
|
const results = [];
|
|
3231
3289
|
walkDirectory(projectRoot, projectRoot, excludes, results);
|
|
3232
3290
|
results.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
3233
|
-
|
|
3291
|
+
const totalScanned = results.length;
|
|
3292
|
+
const files = results.slice(0, maxFiles);
|
|
3293
|
+
return { files, totalScanned, truncated: totalScanned - files.length };
|
|
3294
|
+
}
|
|
3295
|
+
function scanProject(projectRoot, excludes, maxFiles = DEFAULT_MAX_FILES) {
|
|
3296
|
+
return scanProjectWithStats(projectRoot, excludes, maxFiles).files;
|
|
3234
3297
|
}
|
|
3235
3298
|
var DEFAULT_EXCLUDES, DEFAULT_MAX_FILES = 500;
|
|
3236
3299
|
var init_scanner = __esm(() => {
|
|
@@ -3529,7 +3592,11 @@ __export(exports_scan, {
|
|
|
3529
3592
|
scan: () => scan
|
|
3530
3593
|
});
|
|
3531
3594
|
import { readFileSync as readFileSync11 } from "fs";
|
|
3532
|
-
import { join as join14 } from "path";
|
|
3595
|
+
import { join as join14, relative as relative2 } from "path";
|
|
3596
|
+
function configRelativePath(cfgPath, cwd) {
|
|
3597
|
+
const rel = relative2(cwd, cfgPath);
|
|
3598
|
+
return rel.startsWith("..") ? cfgPath : rel;
|
|
3599
|
+
}
|
|
3533
3600
|
function loadExistingIndex(indexPath) {
|
|
3534
3601
|
const raw = safeReadJson(indexPath);
|
|
3535
3602
|
if (isFileIndex(raw))
|
|
@@ -3574,7 +3641,8 @@ function scan(cwd, options) {
|
|
|
3574
3641
|
}
|
|
3575
3642
|
const start = Date.now();
|
|
3576
3643
|
const index = loadExistingIndex(idxPath);
|
|
3577
|
-
const
|
|
3644
|
+
const stats = scanProjectWithStats(cwd, excludes, maxFiles);
|
|
3645
|
+
const scanned = stats.files;
|
|
3578
3646
|
const newIndex = createEmptyIndex();
|
|
3579
3647
|
newIndex.header.lifetimeHits = index.header.lifetimeHits;
|
|
3580
3648
|
newIndex.header.lifetimeMisses = index.header.lifetimeMisses;
|
|
@@ -3598,7 +3666,13 @@ function scan(cwd, options) {
|
|
|
3598
3666
|
newIndex.header.lastScanTimestamp = new Date().toISOString();
|
|
3599
3667
|
atomicWriteJson(idxPath, newIndex);
|
|
3600
3668
|
const elapsed = Date.now() - start;
|
|
3601
|
-
|
|
3669
|
+
if (stats.truncated > 0) {
|
|
3670
|
+
console.log(`[mink] scanned ${stats.totalScanned} files; indexed ${newIndex.header.totalFiles} most recent in ${elapsed}ms`);
|
|
3671
|
+
console.log(` ${stats.truncated} files past maxFiles=${maxFiles} were not indexed`);
|
|
3672
|
+
console.log(` raise the cap by setting "maxFiles" in ${configRelativePath(cfgPath, cwd)}`);
|
|
3673
|
+
} else {
|
|
3674
|
+
console.log(`[mink] indexed ${newIndex.header.totalFiles} files in ${elapsed}ms`);
|
|
3675
|
+
}
|
|
3602
3676
|
}
|
|
3603
3677
|
var init_scan = __esm(() => {
|
|
3604
3678
|
init_paths();
|
|
@@ -4808,7 +4882,11 @@ __export(exports_scan2, {
|
|
|
4808
4882
|
scan: () => scan2
|
|
4809
4883
|
});
|
|
4810
4884
|
import { readFileSync as readFileSync16 } from "fs";
|
|
4811
|
-
import { join as join19 } from "path";
|
|
4885
|
+
import { join as join19, relative as relative3 } from "path";
|
|
4886
|
+
function configRelativePath2(cfgPath, cwd) {
|
|
4887
|
+
const rel = relative3(cwd, cfgPath);
|
|
4888
|
+
return rel.startsWith("..") ? cfgPath : rel;
|
|
4889
|
+
}
|
|
4812
4890
|
function loadExistingIndex2(indexPath) {
|
|
4813
4891
|
const raw = safeReadJson(indexPath);
|
|
4814
4892
|
if (isFileIndex(raw))
|
|
@@ -4853,7 +4931,8 @@ function scan2(cwd, options) {
|
|
|
4853
4931
|
}
|
|
4854
4932
|
const start = Date.now();
|
|
4855
4933
|
const index = loadExistingIndex2(idxPath);
|
|
4856
|
-
const
|
|
4934
|
+
const stats = scanProjectWithStats(cwd, excludes, maxFiles);
|
|
4935
|
+
const scanned = stats.files;
|
|
4857
4936
|
const newIndex = createEmptyIndex();
|
|
4858
4937
|
newIndex.header.lifetimeHits = index.header.lifetimeHits;
|
|
4859
4938
|
newIndex.header.lifetimeMisses = index.header.lifetimeMisses;
|
|
@@ -4877,7 +4956,13 @@ function scan2(cwd, options) {
|
|
|
4877
4956
|
newIndex.header.lastScanTimestamp = new Date().toISOString();
|
|
4878
4957
|
atomicWriteJson(idxPath, newIndex);
|
|
4879
4958
|
const elapsed = Date.now() - start;
|
|
4880
|
-
|
|
4959
|
+
if (stats.truncated > 0) {
|
|
4960
|
+
console.log(`[mink] scanned ${stats.totalScanned} files; indexed ${newIndex.header.totalFiles} most recent in ${elapsed}ms`);
|
|
4961
|
+
console.log(` ${stats.truncated} files past maxFiles=${maxFiles} were not indexed`);
|
|
4962
|
+
console.log(` raise the cap by setting "maxFiles" in ${configRelativePath2(cfgPath, cwd)}`);
|
|
4963
|
+
} else {
|
|
4964
|
+
console.log(`[mink] indexed ${newIndex.header.totalFiles} files in ${elapsed}ms`);
|
|
4965
|
+
}
|
|
4881
4966
|
}
|
|
4882
4967
|
var init_scan2 = __esm(() => {
|
|
4883
4968
|
init_paths();
|
|
@@ -4940,7 +5025,7 @@ __export(exports_pre_read, {
|
|
|
4940
5025
|
preRead: () => preRead,
|
|
4941
5026
|
analyzePreRead: () => analyzePreRead
|
|
4942
5027
|
});
|
|
4943
|
-
import { relative as
|
|
5028
|
+
import { relative as relative4 } from "path";
|
|
4944
5029
|
function analyzePreRead(filePath, state, index) {
|
|
4945
5030
|
const warnings = [];
|
|
4946
5031
|
let repeatedRead = false;
|
|
@@ -4982,7 +5067,7 @@ async function preRead(cwd) {
|
|
|
4982
5067
|
const absolutePath = input.tool_input.file_path;
|
|
4983
5068
|
if (!absolutePath)
|
|
4984
5069
|
return;
|
|
4985
|
-
const filePath =
|
|
5070
|
+
const filePath = relative4(cwd, absolutePath);
|
|
4986
5071
|
const rawState = safeReadJson(sessionPath(cwd));
|
|
4987
5072
|
const state = isSessionState(rawState) ? rawState : createSessionState();
|
|
4988
5073
|
const rawIndex = safeReadJson(fileIndexPath(cwd));
|
|
@@ -5018,7 +5103,7 @@ __export(exports_post_read, {
|
|
|
5018
5103
|
postRead: () => postRead,
|
|
5019
5104
|
analyzePostRead: () => analyzePostRead
|
|
5020
5105
|
});
|
|
5021
|
-
import { relative as
|
|
5106
|
+
import { relative as relative5 } from "path";
|
|
5022
5107
|
function analyzePostRead(filePath, content, index) {
|
|
5023
5108
|
if (isBinaryFile(filePath, content ?? undefined)) {
|
|
5024
5109
|
const entry = index ? lookupEntry(index, filePath) : null;
|
|
@@ -5073,7 +5158,7 @@ async function postRead(cwd) {
|
|
|
5073
5158
|
const absolutePath = input.tool_input.file_path;
|
|
5074
5159
|
if (!absolutePath)
|
|
5075
5160
|
return;
|
|
5076
|
-
const filePath =
|
|
5161
|
+
const filePath = relative5(cwd, absolutePath);
|
|
5077
5162
|
const rawState = safeReadJson(sessionPath(cwd));
|
|
5078
5163
|
const state = isSessionState(rawState) ? rawState : createSessionState();
|
|
5079
5164
|
const rawIndex = safeReadJson(fileIndexPath(cwd));
|
|
@@ -5184,7 +5269,7 @@ __export(exports_pre_write, {
|
|
|
5184
5269
|
preWrite: () => preWrite,
|
|
5185
5270
|
analyzePreWrite: () => analyzePreWrite
|
|
5186
5271
|
});
|
|
5187
|
-
import { relative as
|
|
5272
|
+
import { relative as relative6 } from "path";
|
|
5188
5273
|
function analyzePreWrite(filePath, writeContent, doNotRepeatEntries, bugMemory) {
|
|
5189
5274
|
const warnings = [];
|
|
5190
5275
|
const allMatches = [];
|
|
@@ -5234,7 +5319,7 @@ async function preWrite(cwd) {
|
|
|
5234
5319
|
const absolutePath = input.tool_input.file_path;
|
|
5235
5320
|
if (!absolutePath)
|
|
5236
5321
|
return;
|
|
5237
|
-
const filePath =
|
|
5322
|
+
const filePath = relative6(cwd, absolutePath);
|
|
5238
5323
|
const writeContent = extractWriteContent(input);
|
|
5239
5324
|
let doNotRepeatEntries = [];
|
|
5240
5325
|
try {
|
|
@@ -5294,7 +5379,7 @@ __export(exports_post_write, {
|
|
|
5294
5379
|
postWrite: () => postWrite,
|
|
5295
5380
|
analyzePostWrite: () => analyzePostWrite
|
|
5296
5381
|
});
|
|
5297
|
-
import { relative as
|
|
5382
|
+
import { relative as relative7 } from "path";
|
|
5298
5383
|
import { readFileSync as readFileSync17 } from "fs";
|
|
5299
5384
|
function analyzePostWrite(filePath, fileContent, index) {
|
|
5300
5385
|
if (isWriteExcluded(filePath)) {
|
|
@@ -5356,7 +5441,7 @@ async function postWrite(cwd) {
|
|
|
5356
5441
|
const absolutePath = input.tool_input.file_path;
|
|
5357
5442
|
if (!absolutePath)
|
|
5358
5443
|
return;
|
|
5359
|
-
const filePath =
|
|
5444
|
+
const filePath = relative7(cwd, absolutePath);
|
|
5360
5445
|
let fileContent = null;
|
|
5361
5446
|
try {
|
|
5362
5447
|
fileContent = readFileSync17(absolutePath, "utf-8");
|
|
@@ -5709,12 +5794,304 @@ var init_detect_waste2 = __esm(() => {
|
|
|
5709
5794
|
init_device();
|
|
5710
5795
|
});
|
|
5711
5796
|
|
|
5797
|
+
// src/core/self-update.ts
|
|
5798
|
+
var exports_self_update = {};
|
|
5799
|
+
__export(exports_self_update, {
|
|
5800
|
+
selfUpdateLogPath: () => selfUpdateLogPath,
|
|
5801
|
+
runSelfUpgrade: () => runSelfUpgrade,
|
|
5802
|
+
parseSemver: () => parseSemver,
|
|
5803
|
+
getInstallInfo: () => getInstallInfo,
|
|
5804
|
+
detectPackageManager: () => detectPackageManager,
|
|
5805
|
+
compareSemver: () => compareSemver,
|
|
5806
|
+
PACKAGE_NAME: () => PACKAGE_NAME
|
|
5807
|
+
});
|
|
5808
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
5809
|
+
import { existsSync as existsSync19, readFileSync as readFileSync18 } from "fs";
|
|
5810
|
+
import { dirname as dirname9 } from "path";
|
|
5811
|
+
import { join as join20 } from "path";
|
|
5812
|
+
function parseSemver(input) {
|
|
5813
|
+
const trimmed = input.trim().replace(/^v/, "");
|
|
5814
|
+
if (!trimmed)
|
|
5815
|
+
return null;
|
|
5816
|
+
const [versionPart, ...prereleaseParts] = trimmed.split("-");
|
|
5817
|
+
const numbers = versionPart.split(".").map((s) => Number.parseInt(s, 10));
|
|
5818
|
+
if (numbers.some((n) => Number.isNaN(n)))
|
|
5819
|
+
return null;
|
|
5820
|
+
return {
|
|
5821
|
+
numbers,
|
|
5822
|
+
prerelease: prereleaseParts.length ? prereleaseParts.join("-") : null
|
|
5823
|
+
};
|
|
5824
|
+
}
|
|
5825
|
+
function compareSemver(a, b) {
|
|
5826
|
+
const pa = parseSemver(a);
|
|
5827
|
+
const pb = parseSemver(b);
|
|
5828
|
+
if (!pa && !pb)
|
|
5829
|
+
return 0;
|
|
5830
|
+
if (!pa)
|
|
5831
|
+
return -1;
|
|
5832
|
+
if (!pb)
|
|
5833
|
+
return 1;
|
|
5834
|
+
const len = Math.max(pa.numbers.length, pb.numbers.length);
|
|
5835
|
+
for (let i = 0;i < len; i++) {
|
|
5836
|
+
const ai = pa.numbers[i] ?? 0;
|
|
5837
|
+
const bi = pb.numbers[i] ?? 0;
|
|
5838
|
+
if (ai > bi)
|
|
5839
|
+
return 1;
|
|
5840
|
+
if (ai < bi)
|
|
5841
|
+
return -1;
|
|
5842
|
+
}
|
|
5843
|
+
if (pa.prerelease === pb.prerelease)
|
|
5844
|
+
return 0;
|
|
5845
|
+
if (pa.prerelease === null)
|
|
5846
|
+
return 1;
|
|
5847
|
+
if (pb.prerelease === null)
|
|
5848
|
+
return -1;
|
|
5849
|
+
if (pa.prerelease > pb.prerelease)
|
|
5850
|
+
return 1;
|
|
5851
|
+
if (pa.prerelease < pb.prerelease)
|
|
5852
|
+
return -1;
|
|
5853
|
+
return 0;
|
|
5854
|
+
}
|
|
5855
|
+
function getInstallInfo() {
|
|
5856
|
+
const selfPath = new URL(import.meta.url).pathname;
|
|
5857
|
+
const isDevMode = selfPath.endsWith(".ts");
|
|
5858
|
+
let dir = dirname9(selfPath);
|
|
5859
|
+
let packageJsonPath = null;
|
|
5860
|
+
for (let i = 0;i < 10; i++) {
|
|
5861
|
+
const candidate = join20(dir, "package.json");
|
|
5862
|
+
if (existsSync19(candidate)) {
|
|
5863
|
+
packageJsonPath = candidate;
|
|
5864
|
+
break;
|
|
5865
|
+
}
|
|
5866
|
+
const parent = dirname9(dir);
|
|
5867
|
+
if (parent === dir)
|
|
5868
|
+
break;
|
|
5869
|
+
dir = parent;
|
|
5870
|
+
}
|
|
5871
|
+
if (!packageJsonPath) {
|
|
5872
|
+
throw new Error("Unable to locate package.json for the running mink CLI");
|
|
5873
|
+
}
|
|
5874
|
+
let currentVersion = "0.0.0";
|
|
5875
|
+
try {
|
|
5876
|
+
const pkg = JSON.parse(readFileSync18(packageJsonPath, "utf-8"));
|
|
5877
|
+
if (typeof pkg.version === "string")
|
|
5878
|
+
currentVersion = pkg.version;
|
|
5879
|
+
} catch {}
|
|
5880
|
+
return {
|
|
5881
|
+
cliPath: selfPath,
|
|
5882
|
+
packageJsonPath,
|
|
5883
|
+
currentVersion,
|
|
5884
|
+
isDevMode
|
|
5885
|
+
};
|
|
5886
|
+
}
|
|
5887
|
+
async function fetchLatestVersion(url, currentVersion) {
|
|
5888
|
+
const controller = new AbortController;
|
|
5889
|
+
const timer = setTimeout(() => controller.abort(), NETWORK_TIMEOUT_MS);
|
|
5890
|
+
try {
|
|
5891
|
+
const res = await fetch(url, {
|
|
5892
|
+
signal: controller.signal,
|
|
5893
|
+
headers: {
|
|
5894
|
+
"User-Agent": `mink-self-update/${currentVersion}`,
|
|
5895
|
+
Accept: "application/json"
|
|
5896
|
+
}
|
|
5897
|
+
});
|
|
5898
|
+
if (!res.ok) {
|
|
5899
|
+
throw new Error(`registry returned ${res.status}`);
|
|
5900
|
+
}
|
|
5901
|
+
const body = await res.json();
|
|
5902
|
+
if (typeof body.version !== "string") {
|
|
5903
|
+
throw new Error("registry response missing version field");
|
|
5904
|
+
}
|
|
5905
|
+
return body.version;
|
|
5906
|
+
} finally {
|
|
5907
|
+
clearTimeout(timer);
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
function isOnPath(bin) {
|
|
5911
|
+
const result = spawnSync2(bin, ["--version"], { stdio: "ignore" });
|
|
5912
|
+
return !result.error && result.status === 0;
|
|
5913
|
+
}
|
|
5914
|
+
function detectPackageManager(cliPath) {
|
|
5915
|
+
const configured = resolveConfigValue("cli.auto-update-package-manager").value;
|
|
5916
|
+
if (configured === "bun" && isOnPath("bun"))
|
|
5917
|
+
return "bun";
|
|
5918
|
+
if (configured === "npm" && isOnPath("npm"))
|
|
5919
|
+
return "npm";
|
|
5920
|
+
const looksLikeBun = /[\\/]\.bun[\\/]/.test(cliPath);
|
|
5921
|
+
if (looksLikeBun && isOnPath("bun"))
|
|
5922
|
+
return "bun";
|
|
5923
|
+
if (isOnPath("npm"))
|
|
5924
|
+
return "npm";
|
|
5925
|
+
if (isOnPath("bun"))
|
|
5926
|
+
return "bun";
|
|
5927
|
+
return null;
|
|
5928
|
+
}
|
|
5929
|
+
function buildInstallCommand(pm, version) {
|
|
5930
|
+
const ref = `${PACKAGE_NAME}@${version}`;
|
|
5931
|
+
if (pm === "bun")
|
|
5932
|
+
return ["bun", "add", "-g", ref];
|
|
5933
|
+
return ["npm", "install", "-g", ref];
|
|
5934
|
+
}
|
|
5935
|
+
function selfUpdateLogPath() {
|
|
5936
|
+
return join20(minkRoot(), "self-update.log");
|
|
5937
|
+
}
|
|
5938
|
+
function appendLogEntry(entry) {
|
|
5939
|
+
const path = selfUpdateLogPath();
|
|
5940
|
+
const line = JSON.stringify({ timestamp: new Date().toISOString(), ...entry }) + `
|
|
5941
|
+
`;
|
|
5942
|
+
try {
|
|
5943
|
+
safeAppendText(path, line);
|
|
5944
|
+
rotateLogIfNeeded(path);
|
|
5945
|
+
} catch {}
|
|
5946
|
+
}
|
|
5947
|
+
function rotateLogIfNeeded(path) {
|
|
5948
|
+
try {
|
|
5949
|
+
const content = readFileSync18(path, "utf-8");
|
|
5950
|
+
const lines = content.split(`
|
|
5951
|
+
`);
|
|
5952
|
+
if (lines.length <= LOG_MAX_LINES + 1)
|
|
5953
|
+
return;
|
|
5954
|
+
const trimmed = lines.slice(lines.length - LOG_MAX_LINES - 1).join(`
|
|
5955
|
+
`);
|
|
5956
|
+
atomicWriteText(path, trimmed);
|
|
5957
|
+
} catch {}
|
|
5958
|
+
}
|
|
5959
|
+
async function runSelfUpgrade(opts) {
|
|
5960
|
+
const result = await runSelfUpgradeInner(opts);
|
|
5961
|
+
appendLogEntry({ source: opts.source, ...result });
|
|
5962
|
+
return result;
|
|
5963
|
+
}
|
|
5964
|
+
async function runSelfUpgradeInner(opts) {
|
|
5965
|
+
if (process.env.MINK_DISABLE_AUTO_UPDATE === "1" && opts.source === "scheduler") {
|
|
5966
|
+
return { status: "skipped", reason: "MINK_DISABLE_AUTO_UPDATE=1" };
|
|
5967
|
+
}
|
|
5968
|
+
if (opts.source === "scheduler") {
|
|
5969
|
+
const enabled = resolveConfigValue("cli.auto-update").value;
|
|
5970
|
+
if (enabled !== "true") {
|
|
5971
|
+
return { status: "skipped", reason: "cli.auto-update is disabled" };
|
|
5972
|
+
}
|
|
5973
|
+
}
|
|
5974
|
+
let info;
|
|
5975
|
+
try {
|
|
5976
|
+
info = getInstallInfo();
|
|
5977
|
+
} catch (err) {
|
|
5978
|
+
return {
|
|
5979
|
+
status: "error",
|
|
5980
|
+
reason: err instanceof Error ? err.message : String(err),
|
|
5981
|
+
transient: false
|
|
5982
|
+
};
|
|
5983
|
+
}
|
|
5984
|
+
if (info.isDevMode) {
|
|
5985
|
+
return {
|
|
5986
|
+
status: "skipped",
|
|
5987
|
+
reason: "running from source tree; refuse to self-upgrade in dev mode"
|
|
5988
|
+
};
|
|
5989
|
+
}
|
|
5990
|
+
let latest;
|
|
5991
|
+
try {
|
|
5992
|
+
latest = await fetchLatestVersion(opts.registryUrlOverride ?? NPM_REGISTRY_URL, info.currentVersion);
|
|
5993
|
+
} catch (err) {
|
|
5994
|
+
return {
|
|
5995
|
+
status: "error",
|
|
5996
|
+
reason: "failed to fetch latest version: " + (err instanceof Error ? err.message : String(err)),
|
|
5997
|
+
transient: true
|
|
5998
|
+
};
|
|
5999
|
+
}
|
|
6000
|
+
const cmp = compareSemver(latest, info.currentVersion);
|
|
6001
|
+
if (cmp <= 0 && !opts.force) {
|
|
6002
|
+
return { status: "up-to-date", current: info.currentVersion, latest };
|
|
6003
|
+
}
|
|
6004
|
+
const pm = detectPackageManager(info.cliPath);
|
|
6005
|
+
if (!pm) {
|
|
6006
|
+
return {
|
|
6007
|
+
status: "error",
|
|
6008
|
+
reason: "no package manager (npm or bun) available on PATH",
|
|
6009
|
+
transient: false
|
|
6010
|
+
};
|
|
6011
|
+
}
|
|
6012
|
+
const cmd = buildInstallCommand(pm, latest);
|
|
6013
|
+
if (opts.checkOnly) {
|
|
6014
|
+
return {
|
|
6015
|
+
status: "update-available",
|
|
6016
|
+
current: info.currentVersion,
|
|
6017
|
+
latest,
|
|
6018
|
+
packageManager: pm
|
|
6019
|
+
};
|
|
6020
|
+
}
|
|
6021
|
+
if (opts.dryRun) {
|
|
6022
|
+
return {
|
|
6023
|
+
status: "would-upgrade",
|
|
6024
|
+
current: info.currentVersion,
|
|
6025
|
+
latest,
|
|
6026
|
+
packageManager: pm,
|
|
6027
|
+
command: cmd.join(" ")
|
|
6028
|
+
};
|
|
6029
|
+
}
|
|
6030
|
+
const stdio = opts.interactive ? "inherit" : "pipe";
|
|
6031
|
+
const spawned = spawnSync2(cmd[0], cmd.slice(1), {
|
|
6032
|
+
stdio,
|
|
6033
|
+
timeout: INSTALL_TIMEOUT_MS
|
|
6034
|
+
});
|
|
6035
|
+
if (spawned.error) {
|
|
6036
|
+
return {
|
|
6037
|
+
status: "error",
|
|
6038
|
+
reason: `install command failed to spawn: ${spawned.error.message}`,
|
|
6039
|
+
transient: true
|
|
6040
|
+
};
|
|
6041
|
+
}
|
|
6042
|
+
if (spawned.status !== 0) {
|
|
6043
|
+
const stderr = spawned.stderr ? spawned.stderr.toString().trim() : "";
|
|
6044
|
+
return {
|
|
6045
|
+
status: "error",
|
|
6046
|
+
reason: `${cmd.join(" ")} exited with code ${spawned.status}${stderr ? ": " + stderr.slice(0, 500) : ""}`,
|
|
6047
|
+
transient: true
|
|
6048
|
+
};
|
|
6049
|
+
}
|
|
6050
|
+
let verifiedVersion = latest;
|
|
6051
|
+
try {
|
|
6052
|
+
const pkg = JSON.parse(readFileSync18(info.packageJsonPath, "utf-8"));
|
|
6053
|
+
if (typeof pkg.version === "string")
|
|
6054
|
+
verifiedVersion = pkg.version;
|
|
6055
|
+
} catch {}
|
|
6056
|
+
return {
|
|
6057
|
+
status: "upgraded",
|
|
6058
|
+
from: info.currentVersion,
|
|
6059
|
+
to: verifiedVersion,
|
|
6060
|
+
packageManager: pm
|
|
6061
|
+
};
|
|
6062
|
+
}
|
|
6063
|
+
var PACKAGE_NAME = "@drewpayment/mink", NPM_REGISTRY_URL, NETWORK_TIMEOUT_MS = 5000, INSTALL_TIMEOUT_MS, LOG_MAX_LINES = 1000;
|
|
6064
|
+
var init_self_update = __esm(() => {
|
|
6065
|
+
init_global_config();
|
|
6066
|
+
init_paths();
|
|
6067
|
+
init_fs_utils();
|
|
6068
|
+
NPM_REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
6069
|
+
INSTALL_TIMEOUT_MS = 10 * 60000;
|
|
6070
|
+
});
|
|
6071
|
+
|
|
5712
6072
|
// src/core/task-registry.ts
|
|
6073
|
+
function resolveTaskSchedule(taskId, defaultSchedule) {
|
|
6074
|
+
if (taskId !== "cli-self-update")
|
|
6075
|
+
return defaultSchedule;
|
|
6076
|
+
try {
|
|
6077
|
+
const value = resolveConfigValue("cli.auto-update-schedule").value;
|
|
6078
|
+
parseCronExpression(value);
|
|
6079
|
+
return value;
|
|
6080
|
+
} catch {
|
|
6081
|
+
return defaultSchedule;
|
|
6082
|
+
}
|
|
6083
|
+
}
|
|
6084
|
+
function applyDynamicOverrides(task) {
|
|
6085
|
+
if (task.id !== "cli-self-update")
|
|
6086
|
+
return task;
|
|
6087
|
+
return { ...task, schedule: resolveTaskSchedule(task.id, task.schedule) };
|
|
6088
|
+
}
|
|
5713
6089
|
function getBuiltInTasks() {
|
|
5714
|
-
return BUILT_IN_TASKS;
|
|
6090
|
+
return BUILT_IN_TASKS.map(applyDynamicOverrides);
|
|
5715
6091
|
}
|
|
5716
6092
|
function getTaskById(id) {
|
|
5717
|
-
|
|
6093
|
+
const task = BUILT_IN_TASKS.find((t) => t.id === id);
|
|
6094
|
+
return task ? applyDynamicOverrides(task) : undefined;
|
|
5718
6095
|
}
|
|
5719
6096
|
async function executeAiCli(prompt, timeoutMs) {
|
|
5720
6097
|
const env = {};
|
|
@@ -5778,10 +6155,10 @@ async function executeTask(taskId, projectCwd) {
|
|
|
5778
6155
|
if (task.actionType === "ai-cli") {
|
|
5779
6156
|
try {
|
|
5780
6157
|
const { learningMemoryPath: learningMemoryPath5 } = await Promise.resolve().then(() => (init_paths(), exports_paths));
|
|
5781
|
-
const { readFileSync:
|
|
6158
|
+
const { readFileSync: readFileSync19 } = await import("fs");
|
|
5782
6159
|
let memoryContent;
|
|
5783
6160
|
try {
|
|
5784
|
-
memoryContent =
|
|
6161
|
+
memoryContent = readFileSync19(learningMemoryPath5(projectCwd), "utf-8");
|
|
5785
6162
|
} catch {
|
|
5786
6163
|
console.log("[mink] no learning memory found, skipping reflection");
|
|
5787
6164
|
return;
|
|
@@ -5803,12 +6180,29 @@ ${memoryContent}`;
|
|
|
5803
6180
|
console.log("[mink] project-suggestions: not yet implemented — skipping");
|
|
5804
6181
|
break;
|
|
5805
6182
|
}
|
|
6183
|
+
case "cli-self-update": {
|
|
6184
|
+
const { runSelfUpgrade: runSelfUpgrade2 } = await Promise.resolve().then(() => (init_self_update(), exports_self_update));
|
|
6185
|
+
const result = await runSelfUpgrade2({
|
|
6186
|
+
source: "scheduler",
|
|
6187
|
+
interactive: false
|
|
6188
|
+
});
|
|
6189
|
+
if (result.status === "error") {
|
|
6190
|
+
const err = new Error(result.reason);
|
|
6191
|
+
if (!result.transient) {
|
|
6192
|
+
err.message = `[non-transient] ${err.message}`;
|
|
6193
|
+
}
|
|
6194
|
+
throw err;
|
|
6195
|
+
}
|
|
6196
|
+
console.log(`[mink] cli-self-update: ${result.status}`);
|
|
6197
|
+
break;
|
|
6198
|
+
}
|
|
5806
6199
|
default:
|
|
5807
6200
|
throw new Error(`No executor defined for task: ${taskId}`);
|
|
5808
6201
|
}
|
|
5809
6202
|
}
|
|
5810
6203
|
var BUILT_IN_TASKS, API_KEY_ENV_VARS;
|
|
5811
6204
|
var init_task_registry = __esm(() => {
|
|
6205
|
+
init_global_config();
|
|
5812
6206
|
BUILT_IN_TASKS = [
|
|
5813
6207
|
{
|
|
5814
6208
|
id: "file-index-rescan",
|
|
@@ -5859,6 +6253,16 @@ var init_task_registry = __esm(() => {
|
|
|
5859
6253
|
enabled: true,
|
|
5860
6254
|
retryPolicy: { maxAttempts: 3, baseDelayMs: 60000 },
|
|
5861
6255
|
timeoutMs: 300000
|
|
6256
|
+
},
|
|
6257
|
+
{
|
|
6258
|
+
id: "cli-self-update",
|
|
6259
|
+
name: "CLI Self-Update",
|
|
6260
|
+
description: "Check npm for a newer mink release and install it (gated by cli.auto-update)",
|
|
6261
|
+
schedule: "0 4 * * *",
|
|
6262
|
+
actionType: "function",
|
|
6263
|
+
enabled: true,
|
|
6264
|
+
retryPolicy: { maxAttempts: 3, baseDelayMs: 60000 },
|
|
6265
|
+
timeoutMs: 10 * 60000
|
|
5862
6266
|
}
|
|
5863
6267
|
];
|
|
5864
6268
|
API_KEY_ENV_VARS = [
|
|
@@ -6318,22 +6722,22 @@ var init_cron = __esm(() => {
|
|
|
6318
6722
|
});
|
|
6319
6723
|
|
|
6320
6724
|
// src/core/vault-templates.ts
|
|
6321
|
-
import { join as
|
|
6322
|
-
import { existsSync as
|
|
6725
|
+
import { join as join21 } from "path";
|
|
6726
|
+
import { existsSync as existsSync20, writeFileSync as writeFileSync9, readFileSync as readFileSync19, mkdirSync as mkdirSync11 } from "fs";
|
|
6323
6727
|
function seedTemplates(templatesDir) {
|
|
6324
6728
|
mkdirSync11(templatesDir, { recursive: true });
|
|
6325
6729
|
for (const [name, content] of Object.entries(DEFAULT_TEMPLATES)) {
|
|
6326
|
-
const filePath =
|
|
6327
|
-
if (!
|
|
6730
|
+
const filePath = join21(templatesDir, `${name}.md`);
|
|
6731
|
+
if (!existsSync20(filePath)) {
|
|
6328
6732
|
writeFileSync9(filePath, content);
|
|
6329
6733
|
}
|
|
6330
6734
|
}
|
|
6331
6735
|
}
|
|
6332
6736
|
function loadTemplate(templatesDir, templateName, vars) {
|
|
6333
|
-
const filePath =
|
|
6737
|
+
const filePath = join21(templatesDir, `${templateName}.md`);
|
|
6334
6738
|
let content;
|
|
6335
|
-
if (
|
|
6336
|
-
content =
|
|
6739
|
+
if (existsSync20(filePath)) {
|
|
6740
|
+
content = readFileSync19(filePath, "utf-8");
|
|
6337
6741
|
} else if (DEFAULT_TEMPLATES[templateName]) {
|
|
6338
6742
|
content = DEFAULT_TEMPLATES[templateName];
|
|
6339
6743
|
} else {
|
|
@@ -6486,33 +6890,33 @@ category: resources
|
|
|
6486
6890
|
});
|
|
6487
6891
|
|
|
6488
6892
|
// src/core/note-writer.ts
|
|
6489
|
-
import { join as
|
|
6490
|
-
import { existsSync as
|
|
6893
|
+
import { join as join22 } from "path";
|
|
6894
|
+
import { existsSync as existsSync21, readFileSync as readFileSync20 } from "fs";
|
|
6491
6895
|
import { createHash as createHash2 } from "crypto";
|
|
6492
6896
|
function sha256(content) {
|
|
6493
6897
|
return createHash2("sha256").update(content).digest("hex");
|
|
6494
6898
|
}
|
|
6495
6899
|
function resolveUniqueNotePath(dir, baseSlug, content) {
|
|
6496
6900
|
const targetHash = sha256(content);
|
|
6497
|
-
const primary =
|
|
6498
|
-
if (!
|
|
6901
|
+
const primary = join22(dir, `${baseSlug}.md`);
|
|
6902
|
+
if (!existsSync21(primary))
|
|
6499
6903
|
return primary;
|
|
6500
6904
|
if (sameContent(primary, targetHash))
|
|
6501
6905
|
return primary;
|
|
6502
6906
|
const dev4 = getOrCreateDeviceId().replace(/-/g, "").slice(0, 4);
|
|
6503
6907
|
for (let i = 0;i < MAX_COLLISION_ATTEMPTS; i++) {
|
|
6504
6908
|
const suffix = i === 0 ? dev4 : `${dev4}-${i + 1}`;
|
|
6505
|
-
const candidate =
|
|
6506
|
-
if (!
|
|
6909
|
+
const candidate = join22(dir, `${baseSlug}-${suffix}.md`);
|
|
6910
|
+
if (!existsSync21(candidate))
|
|
6507
6911
|
return candidate;
|
|
6508
6912
|
if (sameContent(candidate, targetHash))
|
|
6509
6913
|
return candidate;
|
|
6510
6914
|
}
|
|
6511
|
-
return
|
|
6915
|
+
return join22(dir, `${baseSlug}-${Date.now()}.md`);
|
|
6512
6916
|
}
|
|
6513
6917
|
function sameContent(filePath, expectedHash) {
|
|
6514
6918
|
try {
|
|
6515
|
-
return sha256(
|
|
6919
|
+
return sha256(readFileSync20(filePath, "utf-8")) === expectedHash;
|
|
6516
6920
|
} catch {
|
|
6517
6921
|
return false;
|
|
6518
6922
|
}
|
|
@@ -6583,8 +6987,8 @@ ${meta.body}
|
|
|
6583
6987
|
}
|
|
6584
6988
|
function appendToDaily(date, content) {
|
|
6585
6989
|
const dir = vaultDailyDir();
|
|
6586
|
-
const filePath =
|
|
6587
|
-
if (
|
|
6990
|
+
const filePath = join22(dir, `${date}.md`);
|
|
6991
|
+
if (existsSync21(filePath)) {
|
|
6588
6992
|
const timestamp = new Date().toLocaleTimeString("en-US", {
|
|
6589
6993
|
hour: "2-digit",
|
|
6590
6994
|
minute: "2-digit",
|
|
@@ -6621,7 +7025,7 @@ ${content}
|
|
|
6621
7025
|
return filePath;
|
|
6622
7026
|
}
|
|
6623
7027
|
function ingestFile(sourcePath, meta) {
|
|
6624
|
-
const raw =
|
|
7028
|
+
const raw = readFileSync20(sourcePath, "utf-8");
|
|
6625
7029
|
const now = new Date().toISOString();
|
|
6626
7030
|
const headingMatch = raw.match(/^#\s+(.+)$/m);
|
|
6627
7031
|
const title = headingMatch?.[1] ?? sourcePath.split("/").pop().replace(/\.md$/, "");
|
|
@@ -6693,9 +7097,9 @@ var init_design_eval = __esm(() => {
|
|
|
6693
7097
|
});
|
|
6694
7098
|
|
|
6695
7099
|
// src/core/dashboard-api.ts
|
|
6696
|
-
import { existsSync as
|
|
7100
|
+
import { existsSync as existsSync22, readFileSync as readFileSync21 } from "fs";
|
|
6697
7101
|
import { readdirSync as readdirSync7, readFileSync as readFileSyncFS, existsSync as fsExistsSync } from "fs";
|
|
6698
|
-
import { join as
|
|
7102
|
+
import { join as join23, resolve as resolve5, normalize, sep } from "path";
|
|
6699
7103
|
import { execSync as execSync5 } from "child_process";
|
|
6700
7104
|
function isSecretKey(key) {
|
|
6701
7105
|
return SECRET_KEY_PATTERNS.some((re) => re.test(key));
|
|
@@ -6708,7 +7112,7 @@ function maskSecret(value, showLast = 4) {
|
|
|
6708
7112
|
return "••••" + value.slice(-showLast);
|
|
6709
7113
|
}
|
|
6710
7114
|
function checkJsonFile2(name, filePath, validator) {
|
|
6711
|
-
if (!
|
|
7115
|
+
if (!existsSync22(filePath))
|
|
6712
7116
|
return { name, status: "missing" };
|
|
6713
7117
|
const data = safeReadJson(filePath);
|
|
6714
7118
|
if (data === null)
|
|
@@ -6718,10 +7122,10 @@ function checkJsonFile2(name, filePath, validator) {
|
|
|
6718
7122
|
return { name, status: "ok" };
|
|
6719
7123
|
}
|
|
6720
7124
|
function checkTextFile2(name, filePath) {
|
|
6721
|
-
if (!
|
|
7125
|
+
if (!existsSync22(filePath))
|
|
6722
7126
|
return { name, status: "missing" };
|
|
6723
7127
|
try {
|
|
6724
|
-
|
|
7128
|
+
readFileSync21(filePath, "utf-8");
|
|
6725
7129
|
return { name, status: "ok" };
|
|
6726
7130
|
} catch {
|
|
6727
7131
|
return { name, status: "corrupt" };
|
|
@@ -6977,7 +7381,7 @@ function countMarkdownIn(dir) {
|
|
|
6977
7381
|
for (const entry of readdirSync7(dir, { withFileTypes: true })) {
|
|
6978
7382
|
if (WIKI_TREE_EXCLUDES.has(entry.name) || entry.name.startsWith("."))
|
|
6979
7383
|
continue;
|
|
6980
|
-
const fullPath =
|
|
7384
|
+
const fullPath = join23(dir, entry.name);
|
|
6981
7385
|
if (entry.isDirectory()) {
|
|
6982
7386
|
count += countMarkdownIn(fullPath);
|
|
6983
7387
|
} else if (entry.name.endsWith(".md") && !entry.name.startsWith("_")) {
|
|
@@ -7006,7 +7410,7 @@ function buildVaultTree(root) {
|
|
|
7006
7410
|
for (const entry of entries) {
|
|
7007
7411
|
if (!entry.isDir)
|
|
7008
7412
|
continue;
|
|
7009
|
-
const fullPath =
|
|
7413
|
+
const fullPath = join23(dir, entry.name);
|
|
7010
7414
|
const relPath = fullPath.slice(root.length + 1);
|
|
7011
7415
|
const count = countMarkdownIn(fullPath);
|
|
7012
7416
|
nodes.push({ name: entry.name, path: relPath, count, depth });
|
|
@@ -7091,7 +7495,7 @@ function resolveVaultRelativePath(relPath) {
|
|
|
7091
7495
|
if (!relPath || relPath.includes("\x00"))
|
|
7092
7496
|
return null;
|
|
7093
7497
|
const root = resolveVaultPath();
|
|
7094
|
-
const absolute =
|
|
7498
|
+
const absolute = resolve5(root, relPath);
|
|
7095
7499
|
const normalizedRoot = normalize(root) + sep;
|
|
7096
7500
|
if (!absolute.startsWith(normalizedRoot) && absolute !== normalize(root)) {
|
|
7097
7501
|
return null;
|
|
@@ -7429,7 +7833,7 @@ async function triggerIngestFile(sourcePath, category, tags, dedupKey) {
|
|
|
7429
7833
|
if (!isValidCategory(category)) {
|
|
7430
7834
|
return { success: false, error: `Invalid category: ${category}` };
|
|
7431
7835
|
}
|
|
7432
|
-
const expanded = sourcePath.startsWith("~/") ?
|
|
7836
|
+
const expanded = sourcePath.startsWith("~/") ? join23(process.env.HOME ?? "", sourcePath.slice(2)) : sourcePath;
|
|
7433
7837
|
if (!fsExistsSync(expanded)) {
|
|
7434
7838
|
return { success: false, error: `Source file not found: ${sourcePath}` };
|
|
7435
7839
|
}
|
|
@@ -7509,10 +7913,10 @@ var init_dashboard_api = __esm(() => {
|
|
|
7509
7913
|
});
|
|
7510
7914
|
|
|
7511
7915
|
// src/core/project-registry.ts
|
|
7512
|
-
import { readdirSync as readdirSync8, existsSync as
|
|
7513
|
-
import { join as
|
|
7916
|
+
import { readdirSync as readdirSync8, existsSync as existsSync23 } from "fs";
|
|
7917
|
+
import { join as join24 } from "path";
|
|
7514
7918
|
function getProjectMeta(projDir) {
|
|
7515
|
-
const metaPath =
|
|
7919
|
+
const metaPath = join24(projDir, "project-meta.json");
|
|
7516
7920
|
const raw = safeReadJson(metaPath);
|
|
7517
7921
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
7518
7922
|
return null;
|
|
@@ -7529,15 +7933,15 @@ function getProjectMeta(projDir) {
|
|
|
7529
7933
|
};
|
|
7530
7934
|
}
|
|
7531
7935
|
function listRegisteredProjects() {
|
|
7532
|
-
const projectsDir =
|
|
7533
|
-
if (!
|
|
7936
|
+
const projectsDir = join24(minkRoot(), "projects");
|
|
7937
|
+
if (!existsSync23(projectsDir))
|
|
7534
7938
|
return [];
|
|
7535
7939
|
const entries = readdirSync8(projectsDir, { withFileTypes: true });
|
|
7536
7940
|
const projects = [];
|
|
7537
7941
|
for (const entry of entries) {
|
|
7538
7942
|
if (!entry.isDirectory())
|
|
7539
7943
|
continue;
|
|
7540
|
-
const projDir =
|
|
7944
|
+
const projDir = join24(projectsDir, entry.name);
|
|
7541
7945
|
const meta = getProjectMeta(projDir);
|
|
7542
7946
|
if (meta) {
|
|
7543
7947
|
projects.push({
|
|
@@ -7561,8 +7965,8 @@ __export(exports_dashboard_server, {
|
|
|
7561
7965
|
startDashboardServer: () => startDashboardServer
|
|
7562
7966
|
});
|
|
7563
7967
|
import { watch } from "fs";
|
|
7564
|
-
import { existsSync as
|
|
7565
|
-
import { basename as basename7, dirname as
|
|
7968
|
+
import { existsSync as existsSync24 } from "fs";
|
|
7969
|
+
import { basename as basename7, dirname as dirname10, join as join25, extname as extname2 } from "path";
|
|
7566
7970
|
|
|
7567
7971
|
class SSEManager {
|
|
7568
7972
|
clients = new Map;
|
|
@@ -7735,15 +8139,15 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
7735
8139
|
timestamp: new Date().toISOString()
|
|
7736
8140
|
});
|
|
7737
8141
|
});
|
|
7738
|
-
const __dir =
|
|
8142
|
+
const __dir = dirname10(new URL(import.meta.url).pathname);
|
|
7739
8143
|
let pkgRoot = __dir;
|
|
7740
|
-
while (pkgRoot !==
|
|
7741
|
-
if (
|
|
8144
|
+
while (pkgRoot !== dirname10(pkgRoot)) {
|
|
8145
|
+
if (existsSync24(join25(pkgRoot, "package.json")))
|
|
7742
8146
|
break;
|
|
7743
|
-
pkgRoot =
|
|
8147
|
+
pkgRoot = dirname10(pkgRoot);
|
|
7744
8148
|
}
|
|
7745
|
-
const dashboardOutDir =
|
|
7746
|
-
const dashboardBuilt =
|
|
8149
|
+
const dashboardOutDir = join25(pkgRoot, "dashboard", "out");
|
|
8150
|
+
const dashboardBuilt = existsSync24(join25(dashboardOutDir, "index.html"));
|
|
7747
8151
|
let clientIdCounter = 0;
|
|
7748
8152
|
if (!dashboardBuilt) {
|
|
7749
8153
|
console.warn("[mink] dashboard not built. Run: cd dashboard && bun run build");
|
|
@@ -7773,9 +8177,9 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
7773
8177
|
} else {
|
|
7774
8178
|
let filePath;
|
|
7775
8179
|
if (pathname === "/") {
|
|
7776
|
-
filePath =
|
|
8180
|
+
filePath = join25(dashboardOutDir, "index.html");
|
|
7777
8181
|
} else {
|
|
7778
|
-
filePath =
|
|
8182
|
+
filePath = join25(dashboardOutDir, pathname);
|
|
7779
8183
|
}
|
|
7780
8184
|
if (!filePath.startsWith(dashboardOutDir)) {
|
|
7781
8185
|
return jsonResponse({ error: "Forbidden" }, 403);
|
|
@@ -7788,7 +8192,7 @@ async function startDashboardServer(cwd, options = {}) {
|
|
|
7788
8192
|
const htmlServed = await serveFile(filePath + ".html", "text/html; charset=utf-8");
|
|
7789
8193
|
if (htmlServed)
|
|
7790
8194
|
return htmlServed;
|
|
7791
|
-
const indexServed = await serveFile(
|
|
8195
|
+
const indexServed = await serveFile(join25(dashboardOutDir, "index.html"), "text/html; charset=utf-8");
|
|
7792
8196
|
if (indexServed)
|
|
7793
8197
|
return indexServed;
|
|
7794
8198
|
}
|
|
@@ -7897,7 +8301,7 @@ retry: 3000
|
|
|
7897
8301
|
if (!filename || filename.includes("..") || filename.includes("/")) {
|
|
7898
8302
|
return jsonResponse({ error: "Invalid filename" }, 400);
|
|
7899
8303
|
}
|
|
7900
|
-
const imgPath =
|
|
8304
|
+
const imgPath = join25(designCapturesDir(resolvedCwd), filename);
|
|
7901
8305
|
const served = await serveFile(imgPath, "image/jpeg");
|
|
7902
8306
|
if (served) {
|
|
7903
8307
|
served.headers.set("Cache-Control", "public, max-age=60");
|
|
@@ -8131,9 +8535,9 @@ var exports_dashboard = {};
|
|
|
8131
8535
|
__export(exports_dashboard, {
|
|
8132
8536
|
dashboard: () => dashboard
|
|
8133
8537
|
});
|
|
8134
|
-
import { existsSync as
|
|
8538
|
+
import { existsSync as existsSync25 } from "fs";
|
|
8135
8539
|
async function dashboard(cwd, args) {
|
|
8136
|
-
if (!
|
|
8540
|
+
if (!existsSync25(projectDir(cwd))) {
|
|
8137
8541
|
console.error("[mink] project not initialized. Run: mink init");
|
|
8138
8542
|
process.exit(1);
|
|
8139
8543
|
}
|
|
@@ -8151,19 +8555,19 @@ var init_dashboard = __esm(() => {
|
|
|
8151
8555
|
});
|
|
8152
8556
|
|
|
8153
8557
|
// src/commands/init.ts
|
|
8154
|
-
import { mkdirSync as mkdirSync12, existsSync as
|
|
8155
|
-
import { resolve as
|
|
8558
|
+
import { mkdirSync as mkdirSync12, existsSync as existsSync26 } from "fs";
|
|
8559
|
+
import { resolve as resolve6, dirname as dirname11, basename as basename8, join as join26 } from "path";
|
|
8156
8560
|
function resolveCliPath2() {
|
|
8157
8561
|
const selfPath = new URL(import.meta.url).pathname;
|
|
8158
|
-
const selfDir =
|
|
8562
|
+
const selfDir = dirname11(selfPath);
|
|
8159
8563
|
if (selfPath.endsWith("dist/cli.js")) {
|
|
8160
8564
|
return selfPath;
|
|
8161
8565
|
}
|
|
8162
|
-
const projectRoot =
|
|
8163
|
-
const distPath =
|
|
8164
|
-
if (
|
|
8566
|
+
const projectRoot = resolve6(selfDir, "../..");
|
|
8567
|
+
const distPath = join26(projectRoot, "dist", "cli.js");
|
|
8568
|
+
if (existsSync26(distPath))
|
|
8165
8569
|
return distPath;
|
|
8166
|
-
return
|
|
8570
|
+
return resolve6(selfDir, "../cli.ts");
|
|
8167
8571
|
}
|
|
8168
8572
|
function buildHooksConfig2(cliPath) {
|
|
8169
8573
|
const isTsSource = cliPath.endsWith(".ts");
|
|
@@ -8202,7 +8606,7 @@ function isMinkHook2(entry) {
|
|
|
8202
8606
|
return false;
|
|
8203
8607
|
}
|
|
8204
8608
|
function mergeHooksIntoSettings2(settingsPath, newHooks) {
|
|
8205
|
-
mkdirSync12(
|
|
8609
|
+
mkdirSync12(dirname11(settingsPath), { recursive: true });
|
|
8206
8610
|
const existing = safeReadJson(settingsPath) ?? {};
|
|
8207
8611
|
const existingHooks = existing.hooks ?? {};
|
|
8208
8612
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
@@ -8222,9 +8626,9 @@ var init_init2 = __esm(() => {
|
|
|
8222
8626
|
|
|
8223
8627
|
// src/core/daemon-service.ts
|
|
8224
8628
|
import { execSync as execSync6 } from "child_process";
|
|
8225
|
-
import { existsSync as
|
|
8629
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
|
|
8226
8630
|
import { homedir as homedir4 } from "os";
|
|
8227
|
-
import { dirname as
|
|
8631
|
+
import { dirname as dirname12, join as join27 } from "path";
|
|
8228
8632
|
function detectPlatform() {
|
|
8229
8633
|
if (process.platform === "linux")
|
|
8230
8634
|
return "systemd";
|
|
@@ -8234,11 +8638,11 @@ function detectPlatform() {
|
|
|
8234
8638
|
}
|
|
8235
8639
|
function resolveServiceInvocation() {
|
|
8236
8640
|
const entry = process.argv[1];
|
|
8237
|
-
if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) &&
|
|
8641
|
+
if (entry && !/\.(js|ts|mjs|cjs)$/.test(entry) && existsSync27(entry)) {
|
|
8238
8642
|
return {
|
|
8239
8643
|
executable: entry,
|
|
8240
8644
|
args: ["daemon", "start"],
|
|
8241
|
-
pathDir:
|
|
8645
|
+
pathDir: dirname12(entry)
|
|
8242
8646
|
};
|
|
8243
8647
|
}
|
|
8244
8648
|
const cliPath = resolveCliPath2();
|
|
@@ -8246,17 +8650,17 @@ function resolveServiceInvocation() {
|
|
|
8246
8650
|
return {
|
|
8247
8651
|
executable: interpreter,
|
|
8248
8652
|
args: [cliPath, "daemon", "start"],
|
|
8249
|
-
pathDir:
|
|
8653
|
+
pathDir: dirname12(interpreter)
|
|
8250
8654
|
};
|
|
8251
8655
|
}
|
|
8252
8656
|
function servicePaths(platform2) {
|
|
8253
8657
|
const home = homedir4();
|
|
8254
8658
|
if (platform2 === "systemd") {
|
|
8255
|
-
const unitDir2 =
|
|
8256
|
-
return { unitDir: unitDir2, unitFile:
|
|
8659
|
+
const unitDir2 = join27(home, ".config", "systemd", "user");
|
|
8660
|
+
return { unitDir: unitDir2, unitFile: join27(unitDir2, "mink-daemon.service") };
|
|
8257
8661
|
}
|
|
8258
|
-
const unitDir =
|
|
8259
|
-
return { unitDir, unitFile:
|
|
8662
|
+
const unitDir = join27(home, "Library", "LaunchAgents");
|
|
8663
|
+
return { unitDir, unitFile: join27(unitDir, "com.mink.daemon.plist") };
|
|
8260
8664
|
}
|
|
8261
8665
|
function renderSystemdUnit(inv) {
|
|
8262
8666
|
const execStart = [inv.executable, ...inv.args].join(" ");
|
|
@@ -8330,7 +8734,7 @@ function installService(options = {}) {
|
|
|
8330
8734
|
process.exit(1);
|
|
8331
8735
|
}
|
|
8332
8736
|
const paths = servicePaths(platform2);
|
|
8333
|
-
if (
|
|
8737
|
+
if (existsSync27(paths.unitFile) && !options.force) {
|
|
8334
8738
|
console.error(`[mink] unit file already exists: ${paths.unitFile}`);
|
|
8335
8739
|
console.error(" re-run with --force to overwrite, or run `mink daemon uninstall` first");
|
|
8336
8740
|
process.exit(1);
|
|
@@ -8363,7 +8767,7 @@ function uninstallService() {
|
|
|
8363
8767
|
process.exit(1);
|
|
8364
8768
|
}
|
|
8365
8769
|
const paths = servicePaths(platform2);
|
|
8366
|
-
if (!
|
|
8770
|
+
if (!existsSync27(paths.unitFile)) {
|
|
8367
8771
|
console.log(`[mink] no unit file at ${paths.unitFile} — nothing to uninstall`);
|
|
8368
8772
|
return;
|
|
8369
8773
|
}
|
|
@@ -8395,7 +8799,7 @@ var exports_daemon = {};
|
|
|
8395
8799
|
__export(exports_daemon, {
|
|
8396
8800
|
daemon: () => daemon
|
|
8397
8801
|
});
|
|
8398
|
-
import { readFileSync as
|
|
8802
|
+
import { readFileSync as readFileSync22, existsSync as existsSync28 } from "fs";
|
|
8399
8803
|
async function daemon(cwd, args) {
|
|
8400
8804
|
const subcommand = args[0];
|
|
8401
8805
|
switch (subcommand) {
|
|
@@ -8411,12 +8815,12 @@ async function daemon(cwd, args) {
|
|
|
8411
8815
|
break;
|
|
8412
8816
|
case "logs": {
|
|
8413
8817
|
const logPath = schedulerLogPath();
|
|
8414
|
-
if (!
|
|
8818
|
+
if (!existsSync28(logPath)) {
|
|
8415
8819
|
console.log("[mink] no log file found");
|
|
8416
8820
|
return;
|
|
8417
8821
|
}
|
|
8418
8822
|
try {
|
|
8419
|
-
const content =
|
|
8823
|
+
const content = readFileSync22(logPath, "utf-8");
|
|
8420
8824
|
const lines = content.split(`
|
|
8421
8825
|
`);
|
|
8422
8826
|
const tail = lines.slice(-50).join(`
|
|
@@ -8683,13 +9087,13 @@ function printValidKeys() {
|
|
|
8683
9087
|
}
|
|
8684
9088
|
}
|
|
8685
9089
|
function readLineFromStdin() {
|
|
8686
|
-
return new Promise((
|
|
9090
|
+
return new Promise((resolve8) => {
|
|
8687
9091
|
const chunks = [];
|
|
8688
9092
|
process.stdin.resume();
|
|
8689
9093
|
process.stdin.setEncoding("utf-8");
|
|
8690
9094
|
process.stdin.once("data", (data) => {
|
|
8691
9095
|
process.stdin.pause();
|
|
8692
|
-
|
|
9096
|
+
resolve8(String(data).trim());
|
|
8693
9097
|
});
|
|
8694
9098
|
});
|
|
8695
9099
|
}
|
|
@@ -8764,7 +9168,7 @@ var exports_update = {};
|
|
|
8764
9168
|
__export(exports_update, {
|
|
8765
9169
|
update: () => update
|
|
8766
9170
|
});
|
|
8767
|
-
import { resolve as
|
|
9171
|
+
import { resolve as resolve8 } from "path";
|
|
8768
9172
|
function parseArgs(args) {
|
|
8769
9173
|
let dryRun = false;
|
|
8770
9174
|
let project = null;
|
|
@@ -8822,7 +9226,7 @@ async function update(cwd, args) {
|
|
|
8822
9226
|
}
|
|
8823
9227
|
const backupName = createBackup(target.cwd);
|
|
8824
9228
|
console.log(` backup: ${backupName}`);
|
|
8825
|
-
const settingsPath =
|
|
9229
|
+
const settingsPath = resolve8(target.cwd, ".claude", "settings.json");
|
|
8826
9230
|
mergeHooksIntoSettings2(settingsPath, newHooks);
|
|
8827
9231
|
console.log(" hooks: updated");
|
|
8828
9232
|
const metaPath = projectMetaPath(target.cwd);
|
|
@@ -8847,6 +9251,123 @@ var init_update = __esm(() => {
|
|
|
8847
9251
|
init_init2();
|
|
8848
9252
|
});
|
|
8849
9253
|
|
|
9254
|
+
// src/commands/upgrade.ts
|
|
9255
|
+
var exports_upgrade = {};
|
|
9256
|
+
__export(exports_upgrade, {
|
|
9257
|
+
upgrade: () => upgrade
|
|
9258
|
+
});
|
|
9259
|
+
function parseArgs2(args) {
|
|
9260
|
+
const out = {
|
|
9261
|
+
check: false,
|
|
9262
|
+
dryRun: false,
|
|
9263
|
+
force: false,
|
|
9264
|
+
yes: false,
|
|
9265
|
+
help: false
|
|
9266
|
+
};
|
|
9267
|
+
for (const arg of args) {
|
|
9268
|
+
switch (arg) {
|
|
9269
|
+
case "--check":
|
|
9270
|
+
out.check = true;
|
|
9271
|
+
break;
|
|
9272
|
+
case "--dry-run":
|
|
9273
|
+
out.dryRun = true;
|
|
9274
|
+
break;
|
|
9275
|
+
case "--force":
|
|
9276
|
+
out.force = true;
|
|
9277
|
+
break;
|
|
9278
|
+
case "--yes":
|
|
9279
|
+
case "-y":
|
|
9280
|
+
out.yes = true;
|
|
9281
|
+
break;
|
|
9282
|
+
case "--help":
|
|
9283
|
+
case "-h":
|
|
9284
|
+
out.help = true;
|
|
9285
|
+
break;
|
|
9286
|
+
}
|
|
9287
|
+
}
|
|
9288
|
+
return out;
|
|
9289
|
+
}
|
|
9290
|
+
function printHelp() {
|
|
9291
|
+
console.log("Usage: mink upgrade [options]");
|
|
9292
|
+
console.log("");
|
|
9293
|
+
console.log("Check the npm registry for a newer mink release and install it.");
|
|
9294
|
+
console.log(`Tracks the 'latest' dist-tag of ${PACKAGE_NAME}.`);
|
|
9295
|
+
console.log("");
|
|
9296
|
+
console.log("Options:");
|
|
9297
|
+
console.log(" --check Report whether an upgrade is available; do not install");
|
|
9298
|
+
console.log(" --dry-run Resolve everything but do not run the install command");
|
|
9299
|
+
console.log(" --force Install the latest version even if it is not strictly newer");
|
|
9300
|
+
console.log(" --yes, -y Skip the interactive confirmation prompt");
|
|
9301
|
+
console.log(" --help, -h Show this help");
|
|
9302
|
+
console.log("");
|
|
9303
|
+
console.log("Auto-update on a schedule:");
|
|
9304
|
+
console.log(" mink config set cli.auto-update true");
|
|
9305
|
+
console.log(' mink config set cli.auto-update-schedule "0 4 * * *"');
|
|
9306
|
+
}
|
|
9307
|
+
function describeResult(r) {
|
|
9308
|
+
switch (r.status) {
|
|
9309
|
+
case "up-to-date":
|
|
9310
|
+
return `Already up-to-date — ${r.current} matches latest.`;
|
|
9311
|
+
case "update-available":
|
|
9312
|
+
return `Update available: ${r.current} → ${r.latest}` + (r.packageManager ? ` (would install via ${r.packageManager})` : "");
|
|
9313
|
+
case "would-upgrade":
|
|
9314
|
+
return `Would upgrade: ${r.current} → ${r.latest}
|
|
9315
|
+
command: ${r.command}`;
|
|
9316
|
+
case "upgraded":
|
|
9317
|
+
return `Upgraded ${r.from} → ${r.to} (via ${r.packageManager}).`;
|
|
9318
|
+
case "skipped":
|
|
9319
|
+
return `Skipped: ${r.reason}`;
|
|
9320
|
+
case "error":
|
|
9321
|
+
return `Error: ${r.reason}`;
|
|
9322
|
+
}
|
|
9323
|
+
}
|
|
9324
|
+
async function confirm(prompt) {
|
|
9325
|
+
if (!process.stdin.isTTY)
|
|
9326
|
+
return false;
|
|
9327
|
+
process.stdout.write(prompt);
|
|
9328
|
+
return new Promise((resolveConfirm) => {
|
|
9329
|
+
process.stdin.setEncoding("utf-8");
|
|
9330
|
+
process.stdin.once("data", (chunk) => {
|
|
9331
|
+
const answer = String(chunk).trim().toLowerCase();
|
|
9332
|
+
resolveConfirm(answer === "y" || answer === "yes");
|
|
9333
|
+
});
|
|
9334
|
+
});
|
|
9335
|
+
}
|
|
9336
|
+
async function upgrade(_cwd, args) {
|
|
9337
|
+
const parsed = parseArgs2(args);
|
|
9338
|
+
if (parsed.help) {
|
|
9339
|
+
printHelp();
|
|
9340
|
+
return;
|
|
9341
|
+
}
|
|
9342
|
+
const isCheckLike = parsed.check || parsed.dryRun;
|
|
9343
|
+
if (!isCheckLike && !parsed.yes && process.stdin.isTTY) {
|
|
9344
|
+
const probe = await runSelfUpgrade({ source: "manual", checkOnly: true, force: parsed.force });
|
|
9345
|
+
console.log(describeResult(probe));
|
|
9346
|
+
if (probe.status !== "update-available" && !parsed.force) {
|
|
9347
|
+
return;
|
|
9348
|
+
}
|
|
9349
|
+
const ok = await confirm("Proceed with install? [y/N] ");
|
|
9350
|
+
if (!ok) {
|
|
9351
|
+
console.log("Aborted.");
|
|
9352
|
+
return;
|
|
9353
|
+
}
|
|
9354
|
+
}
|
|
9355
|
+
const result = await runSelfUpgrade({
|
|
9356
|
+
source: "manual",
|
|
9357
|
+
checkOnly: parsed.check,
|
|
9358
|
+
dryRun: parsed.dryRun,
|
|
9359
|
+
force: parsed.force,
|
|
9360
|
+
interactive: true
|
|
9361
|
+
});
|
|
9362
|
+
console.log(describeResult(result));
|
|
9363
|
+
if (result.status === "error") {
|
|
9364
|
+
process.exit(1);
|
|
9365
|
+
}
|
|
9366
|
+
}
|
|
9367
|
+
var init_upgrade = __esm(() => {
|
|
9368
|
+
init_self_update();
|
|
9369
|
+
});
|
|
9370
|
+
|
|
8850
9371
|
// src/commands/restore.ts
|
|
8851
9372
|
var exports_restore = {};
|
|
8852
9373
|
__export(exports_restore, {
|
|
@@ -8880,8 +9401,8 @@ var init_restore = __esm(() => {
|
|
|
8880
9401
|
});
|
|
8881
9402
|
|
|
8882
9403
|
// src/core/design-eval/server-detect.ts
|
|
8883
|
-
import { readFileSync as
|
|
8884
|
-
import { join as
|
|
9404
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
9405
|
+
import { join as join28 } from "path";
|
|
8885
9406
|
async function probePort(port) {
|
|
8886
9407
|
try {
|
|
8887
9408
|
const controller = new AbortController;
|
|
@@ -8903,7 +9424,7 @@ async function findRunningServer(ports = DEFAULT_PROBE_PORTS) {
|
|
|
8903
9424
|
}
|
|
8904
9425
|
function detectDevCommand(cwd) {
|
|
8905
9426
|
try {
|
|
8906
|
-
const raw =
|
|
9427
|
+
const raw = readFileSync23(join28(cwd, "package.json"), "utf-8");
|
|
8907
9428
|
const pkg = JSON.parse(raw);
|
|
8908
9429
|
const scripts = pkg.scripts;
|
|
8909
9430
|
if (!scripts || typeof scripts !== "object")
|
|
@@ -8923,10 +9444,10 @@ var init_server_detect = __esm(() => {
|
|
|
8923
9444
|
});
|
|
8924
9445
|
|
|
8925
9446
|
// src/core/design-eval/route-detect.ts
|
|
8926
|
-
import { existsSync as
|
|
8927
|
-
import { join as
|
|
9447
|
+
import { existsSync as existsSync29, readdirSync as readdirSync9, statSync as statSync11 } from "fs";
|
|
9448
|
+
import { join as join29, relative as relative8, sep as sep2 } from "path";
|
|
8928
9449
|
function detectFramework(cwd) {
|
|
8929
|
-
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) =>
|
|
9450
|
+
const has = (name) => ["js", "mjs", "ts", "cjs"].some((ext) => existsSync29(join29(cwd, `${name}.${ext}`))) || existsSync29(join29(cwd, name));
|
|
8930
9451
|
if (has("next.config"))
|
|
8931
9452
|
return "nextjs";
|
|
8932
9453
|
if (has("svelte.config"))
|
|
@@ -8951,11 +9472,11 @@ function detectRoutes(cwd) {
|
|
|
8951
9472
|
}
|
|
8952
9473
|
function detectNextRoutes(cwd) {
|
|
8953
9474
|
const routes = [];
|
|
8954
|
-
const appDir =
|
|
8955
|
-
if (
|
|
9475
|
+
const appDir = join29(cwd, "app");
|
|
9476
|
+
if (existsSync29(appDir)) {
|
|
8956
9477
|
const pageFiles = findFiles(appDir, /^page\.(tsx?|jsx?)$/);
|
|
8957
9478
|
for (const file of pageFiles) {
|
|
8958
|
-
const rel =
|
|
9479
|
+
const rel = relative8(appDir, file);
|
|
8959
9480
|
const dir = rel.replace(/([/\\])?page\.(tsx?|jsx?)$/, "");
|
|
8960
9481
|
const route = dir === "" ? "/" : `/${dir.split(sep2).join("/")}`;
|
|
8961
9482
|
if (/\[|@|\(/.test(route))
|
|
@@ -8963,11 +9484,11 @@ function detectNextRoutes(cwd) {
|
|
|
8963
9484
|
routes.push(route);
|
|
8964
9485
|
}
|
|
8965
9486
|
}
|
|
8966
|
-
const pagesDir =
|
|
8967
|
-
if (
|
|
9487
|
+
const pagesDir = join29(cwd, "pages");
|
|
9488
|
+
if (existsSync29(pagesDir)) {
|
|
8968
9489
|
const pageFiles = findFiles(pagesDir, /\.(tsx?|jsx?)$/);
|
|
8969
9490
|
for (const file of pageFiles) {
|
|
8970
|
-
const rel =
|
|
9491
|
+
const rel = relative8(pagesDir, file);
|
|
8971
9492
|
const name = rel.replace(/\.(tsx?|jsx?)$/, "");
|
|
8972
9493
|
if (/^_(app|document|error)/.test(name))
|
|
8973
9494
|
continue;
|
|
@@ -8983,13 +9504,13 @@ function detectNextRoutes(cwd) {
|
|
|
8983
9504
|
return unique.length > 0 ? unique.sort() : ["/"];
|
|
8984
9505
|
}
|
|
8985
9506
|
function detectSvelteKitRoutes(cwd) {
|
|
8986
|
-
const routesDir =
|
|
8987
|
-
if (!
|
|
9507
|
+
const routesDir = join29(cwd, "src", "routes");
|
|
9508
|
+
if (!existsSync29(routesDir))
|
|
8988
9509
|
return ["/"];
|
|
8989
9510
|
const routes = [];
|
|
8990
9511
|
const pageFiles = findFiles(routesDir, /^\+page\.svelte$/);
|
|
8991
9512
|
for (const file of pageFiles) {
|
|
8992
|
-
const rel =
|
|
9513
|
+
const rel = relative8(routesDir, file);
|
|
8993
9514
|
const dir = rel.replace(/([/\\])?\+page\.svelte$/, "");
|
|
8994
9515
|
const route = dir === "" ? "/" : `/${dir.split(sep2).join("/")}`;
|
|
8995
9516
|
if (/\[|\(/.test(route))
|
|
@@ -8999,13 +9520,13 @@ function detectSvelteKitRoutes(cwd) {
|
|
|
8999
9520
|
return routes.length > 0 ? routes.sort() : ["/"];
|
|
9000
9521
|
}
|
|
9001
9522
|
function detectNuxtRoutes(cwd) {
|
|
9002
|
-
const pagesDir =
|
|
9003
|
-
if (!
|
|
9523
|
+
const pagesDir = join29(cwd, "pages");
|
|
9524
|
+
if (!existsSync29(pagesDir))
|
|
9004
9525
|
return ["/"];
|
|
9005
9526
|
const routes = [];
|
|
9006
9527
|
const vueFiles = findFiles(pagesDir, /\.vue$/);
|
|
9007
9528
|
for (const file of vueFiles) {
|
|
9008
|
-
const rel =
|
|
9529
|
+
const rel = relative8(pagesDir, file);
|
|
9009
9530
|
const name = rel.replace(/\.vue$/, "");
|
|
9010
9531
|
if (/\[/.test(name))
|
|
9011
9532
|
continue;
|
|
@@ -9026,7 +9547,7 @@ function findFiles(dir, pattern) {
|
|
|
9026
9547
|
for (const entry of entries) {
|
|
9027
9548
|
if (entry.startsWith(".") || entry === "node_modules")
|
|
9028
9549
|
continue;
|
|
9029
|
-
const full =
|
|
9550
|
+
const full = join29(current, entry);
|
|
9030
9551
|
try {
|
|
9031
9552
|
const stat2 = statSync11(full);
|
|
9032
9553
|
if (stat2.isDirectory()) {
|
|
@@ -9054,11 +9575,11 @@ function __extends(d, b) {
|
|
|
9054
9575
|
}
|
|
9055
9576
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
9056
9577
|
function adopt(value) {
|
|
9057
|
-
return value instanceof P ? value : new P(function(
|
|
9058
|
-
|
|
9578
|
+
return value instanceof P ? value : new P(function(resolve9) {
|
|
9579
|
+
resolve9(value);
|
|
9059
9580
|
});
|
|
9060
9581
|
}
|
|
9061
|
-
return new (P || (P = Promise))(function(
|
|
9582
|
+
return new (P || (P = Promise))(function(resolve9, reject) {
|
|
9062
9583
|
function fulfilled(value) {
|
|
9063
9584
|
try {
|
|
9064
9585
|
step(generator.next(value));
|
|
@@ -9074,7 +9595,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
9074
9595
|
}
|
|
9075
9596
|
}
|
|
9076
9597
|
function step(result) {
|
|
9077
|
-
result.done ?
|
|
9598
|
+
result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
9078
9599
|
}
|
|
9079
9600
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9080
9601
|
});
|
|
@@ -9257,14 +9778,14 @@ function __asyncValues(o) {
|
|
|
9257
9778
|
}, i);
|
|
9258
9779
|
function verb(n) {
|
|
9259
9780
|
i[n] = o[n] && function(v) {
|
|
9260
|
-
return new Promise(function(
|
|
9261
|
-
v = o[n](v), settle(
|
|
9781
|
+
return new Promise(function(resolve9, reject) {
|
|
9782
|
+
v = o[n](v), settle(resolve9, reject, v.done, v.value);
|
|
9262
9783
|
});
|
|
9263
9784
|
};
|
|
9264
9785
|
}
|
|
9265
|
-
function settle(
|
|
9786
|
+
function settle(resolve9, reject, d, v) {
|
|
9266
9787
|
Promise.resolve(v).then(function(v2) {
|
|
9267
|
-
|
|
9788
|
+
resolve9({ value: v2, done: d });
|
|
9268
9789
|
}, reject);
|
|
9269
9790
|
}
|
|
9270
9791
|
}
|
|
@@ -9795,7 +10316,7 @@ function of() {
|
|
|
9795
10316
|
}
|
|
9796
10317
|
function lastValueFrom(source, config22) {
|
|
9797
10318
|
var hasConfig = typeof config22 === "object";
|
|
9798
|
-
return new Promise(function(
|
|
10319
|
+
return new Promise(function(resolve9, reject) {
|
|
9799
10320
|
var _hasValue = false;
|
|
9800
10321
|
var _value;
|
|
9801
10322
|
source.subscribe({
|
|
@@ -9806,9 +10327,9 @@ function lastValueFrom(source, config22) {
|
|
|
9806
10327
|
error: reject,
|
|
9807
10328
|
complete: function() {
|
|
9808
10329
|
if (_hasValue) {
|
|
9809
|
-
|
|
10330
|
+
resolve9(_value);
|
|
9810
10331
|
} else if (hasConfig) {
|
|
9811
|
-
|
|
10332
|
+
resolve9(config22.defaultValue);
|
|
9812
10333
|
} else {
|
|
9813
10334
|
reject(new EmptyError);
|
|
9814
10335
|
}
|
|
@@ -9818,16 +10339,16 @@ function lastValueFrom(source, config22) {
|
|
|
9818
10339
|
}
|
|
9819
10340
|
function firstValueFrom(source, config22) {
|
|
9820
10341
|
var hasConfig = typeof config22 === "object";
|
|
9821
|
-
return new Promise(function(
|
|
10342
|
+
return new Promise(function(resolve9, reject) {
|
|
9822
10343
|
var subscriber = new SafeSubscriber({
|
|
9823
10344
|
next: function(value) {
|
|
9824
|
-
|
|
10345
|
+
resolve9(value);
|
|
9825
10346
|
subscriber.unsubscribe();
|
|
9826
10347
|
},
|
|
9827
10348
|
error: reject,
|
|
9828
10349
|
complete: function() {
|
|
9829
10350
|
if (hasConfig) {
|
|
9830
|
-
|
|
10351
|
+
resolve9(config22.defaultValue);
|
|
9831
10352
|
} else {
|
|
9832
10353
|
reject(new EmptyError);
|
|
9833
10354
|
}
|
|
@@ -10879,7 +11400,7 @@ var init_rxjs = __esm(() => {
|
|
|
10879
11400
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
10880
11401
|
var _this = this;
|
|
10881
11402
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
10882
|
-
return new promiseCtor(function(
|
|
11403
|
+
return new promiseCtor(function(resolve9, reject) {
|
|
10883
11404
|
var subscriber = new SafeSubscriber({
|
|
10884
11405
|
next: function(value) {
|
|
10885
11406
|
try {
|
|
@@ -10890,7 +11411,7 @@ var init_rxjs = __esm(() => {
|
|
|
10890
11411
|
}
|
|
10891
11412
|
},
|
|
10892
11413
|
error: reject,
|
|
10893
|
-
complete:
|
|
11414
|
+
complete: resolve9
|
|
10894
11415
|
});
|
|
10895
11416
|
_this.subscribe(subscriber);
|
|
10896
11417
|
});
|
|
@@ -10912,14 +11433,14 @@ var init_rxjs = __esm(() => {
|
|
|
10912
11433
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
10913
11434
|
var _this = this;
|
|
10914
11435
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
10915
|
-
return new promiseCtor(function(
|
|
11436
|
+
return new promiseCtor(function(resolve9, reject) {
|
|
10916
11437
|
var value;
|
|
10917
11438
|
_this.subscribe(function(x) {
|
|
10918
11439
|
return value = x;
|
|
10919
11440
|
}, function(err) {
|
|
10920
11441
|
return reject(err);
|
|
10921
11442
|
}, function() {
|
|
10922
|
-
return
|
|
11443
|
+
return resolve9(value);
|
|
10923
11444
|
});
|
|
10924
11445
|
});
|
|
10925
11446
|
};
|
|
@@ -12845,8 +13366,8 @@ class Deferred {
|
|
|
12845
13366
|
#isRejected = false;
|
|
12846
13367
|
#value;
|
|
12847
13368
|
#resolve;
|
|
12848
|
-
#taskPromise = new Promise((
|
|
12849
|
-
this.#resolve =
|
|
13369
|
+
#taskPromise = new Promise((resolve9) => {
|
|
13370
|
+
this.#resolve = resolve9;
|
|
12850
13371
|
});
|
|
12851
13372
|
#timeoutId;
|
|
12852
13373
|
#timeoutError;
|
|
@@ -12935,12 +13456,12 @@ var init_Mutex = __esm(() => {
|
|
|
12935
13456
|
return new Mutex.Guard(this, onRelease);
|
|
12936
13457
|
}
|
|
12937
13458
|
release() {
|
|
12938
|
-
const
|
|
12939
|
-
if (!
|
|
13459
|
+
const resolve9 = this.#acquirers.shift();
|
|
13460
|
+
if (!resolve9) {
|
|
12940
13461
|
this.#locked = false;
|
|
12941
13462
|
return;
|
|
12942
13463
|
}
|
|
12943
|
-
|
|
13464
|
+
resolve9();
|
|
12944
13465
|
}
|
|
12945
13466
|
};
|
|
12946
13467
|
});
|
|
@@ -14684,12 +15205,12 @@ var init_locators = __esm(() => {
|
|
|
14684
15205
|
}
|
|
14685
15206
|
return defer(() => {
|
|
14686
15207
|
return from(handle.evaluate((element) => {
|
|
14687
|
-
return new Promise((
|
|
15208
|
+
return new Promise((resolve9) => {
|
|
14688
15209
|
window.requestAnimationFrame(() => {
|
|
14689
15210
|
const rect1 = element.getBoundingClientRect();
|
|
14690
15211
|
window.requestAnimationFrame(() => {
|
|
14691
15212
|
const rect2 = element.getBoundingClientRect();
|
|
14692
|
-
|
|
15213
|
+
resolve9([
|
|
14693
15214
|
{
|
|
14694
15215
|
x: rect1.x,
|
|
14695
15216
|
y: rect1.y,
|
|
@@ -15980,9 +16501,9 @@ var init_ElementHandle = __esm(() => {
|
|
|
15980
16501
|
const handle = await this.#asSVGElementHandle();
|
|
15981
16502
|
const target = __addDisposableResource6(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
15982
16503
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
15983
|
-
const visibleRatio = await new Promise((
|
|
16504
|
+
const visibleRatio = await new Promise((resolve9) => {
|
|
15984
16505
|
const observer = new IntersectionObserver((entries) => {
|
|
15985
|
-
|
|
16506
|
+
resolve9(entries[0].intersectionRatio);
|
|
15986
16507
|
observer.disconnect();
|
|
15987
16508
|
});
|
|
15988
16509
|
observer.observe(element);
|
|
@@ -16376,7 +16897,7 @@ var init_Frame = __esm(() => {
|
|
|
16376
16897
|
}
|
|
16377
16898
|
type = type ?? "text/javascript";
|
|
16378
16899
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, id, type: type2, content: content2 }) => {
|
|
16379
|
-
return await new Promise((
|
|
16900
|
+
return await new Promise((resolve9, reject) => {
|
|
16380
16901
|
const script = document.createElement("script");
|
|
16381
16902
|
script.type = type2;
|
|
16382
16903
|
script.text = content2;
|
|
@@ -16389,12 +16910,12 @@ var init_Frame = __esm(() => {
|
|
|
16389
16910
|
if (url) {
|
|
16390
16911
|
script.src = url;
|
|
16391
16912
|
script.addEventListener("load", () => {
|
|
16392
|
-
|
|
16913
|
+
resolve9(script);
|
|
16393
16914
|
}, { once: true });
|
|
16394
16915
|
document.head.appendChild(script);
|
|
16395
16916
|
} else {
|
|
16396
16917
|
document.head.appendChild(script);
|
|
16397
|
-
|
|
16918
|
+
resolve9(script);
|
|
16398
16919
|
}
|
|
16399
16920
|
});
|
|
16400
16921
|
}, { ...options, type, content }));
|
|
@@ -16411,7 +16932,7 @@ var init_Frame = __esm(() => {
|
|
|
16411
16932
|
options.content = content;
|
|
16412
16933
|
}
|
|
16413
16934
|
return await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle(async ({ url, content: content2 }) => {
|
|
16414
|
-
return await new Promise((
|
|
16935
|
+
return await new Promise((resolve9, reject) => {
|
|
16415
16936
|
let element;
|
|
16416
16937
|
if (!url) {
|
|
16417
16938
|
element = document.createElement("style");
|
|
@@ -16423,7 +16944,7 @@ var init_Frame = __esm(() => {
|
|
|
16423
16944
|
element = link;
|
|
16424
16945
|
}
|
|
16425
16946
|
element.addEventListener("load", () => {
|
|
16426
|
-
|
|
16947
|
+
resolve9(element);
|
|
16427
16948
|
}, { once: true });
|
|
16428
16949
|
element.addEventListener("error", (event) => {
|
|
16429
16950
|
reject(new Error(event.message ?? "Could not load style"));
|
|
@@ -17277,9 +17798,9 @@ var init_Page = __esm(() => {
|
|
|
17277
17798
|
++this.#screencastSessionCount;
|
|
17278
17799
|
if (!this.#startScreencastPromise) {
|
|
17279
17800
|
this.#startScreencastPromise = this.mainFrame().client.send("Page.startScreencast", { format: "png" }).then(() => {
|
|
17280
|
-
return new Promise((
|
|
17801
|
+
return new Promise((resolve9) => {
|
|
17281
17802
|
return this.mainFrame().client.once("Page.screencastFrame", () => {
|
|
17282
|
-
return
|
|
17803
|
+
return resolve9();
|
|
17283
17804
|
});
|
|
17284
17805
|
});
|
|
17285
17806
|
});
|
|
@@ -19937,11 +20458,11 @@ function addPageBinding(type, name, prefix) {
|
|
|
19937
20458
|
return value instanceof Node;
|
|
19938
20459
|
})
|
|
19939
20460
|
}));
|
|
19940
|
-
return new Promise((
|
|
20461
|
+
return new Promise((resolve9, reject) => {
|
|
19941
20462
|
callPuppeteer.callbacks.set(seq, {
|
|
19942
20463
|
resolve(value) {
|
|
19943
20464
|
callPuppeteer.args.delete(seq);
|
|
19944
|
-
|
|
20465
|
+
resolve9(value);
|
|
19945
20466
|
},
|
|
19946
20467
|
reject(value) {
|
|
19947
20468
|
callPuppeteer.args.delete(seq);
|
|
@@ -23404,8 +23925,8 @@ var init_Input2 = __esm(() => {
|
|
|
23404
23925
|
if (typeof delay === "number") {
|
|
23405
23926
|
await Promise.all(actions);
|
|
23406
23927
|
actions.length = 0;
|
|
23407
|
-
await new Promise((
|
|
23408
|
-
setTimeout(
|
|
23928
|
+
await new Promise((resolve9) => {
|
|
23929
|
+
setTimeout(resolve9, delay);
|
|
23409
23930
|
});
|
|
23410
23931
|
}
|
|
23411
23932
|
actions.push(this.up({ ...options, clickCount }));
|
|
@@ -23425,9 +23946,9 @@ var init_Input2 = __esm(() => {
|
|
|
23425
23946
|
});
|
|
23426
23947
|
}
|
|
23427
23948
|
async drag(start, target) {
|
|
23428
|
-
const promise = new Promise((
|
|
23949
|
+
const promise = new Promise((resolve9) => {
|
|
23429
23950
|
this.#client.once("Input.dragIntercepted", (event) => {
|
|
23430
|
-
return
|
|
23951
|
+
return resolve9(event.data);
|
|
23431
23952
|
});
|
|
23432
23953
|
});
|
|
23433
23954
|
await this.move(start.x, start.y);
|
|
@@ -23468,8 +23989,8 @@ var init_Input2 = __esm(() => {
|
|
|
23468
23989
|
await this.dragEnter(target, data);
|
|
23469
23990
|
await this.dragOver(target, data);
|
|
23470
23991
|
if (delay) {
|
|
23471
|
-
await new Promise((
|
|
23472
|
-
return setTimeout(
|
|
23992
|
+
await new Promise((resolve9) => {
|
|
23993
|
+
return setTimeout(resolve9, delay);
|
|
23473
23994
|
});
|
|
23474
23995
|
}
|
|
23475
23996
|
await this.drop(target, data);
|
|
@@ -24281,9 +24802,9 @@ var init_Page2 = __esm(() => {
|
|
|
24281
24802
|
async captureHeapSnapshot(options) {
|
|
24282
24803
|
const { createWriteStream } = environment.value.fs;
|
|
24283
24804
|
const stream = createWriteStream(options.path);
|
|
24284
|
-
const streamPromise = new Promise((
|
|
24805
|
+
const streamPromise = new Promise((resolve9, reject) => {
|
|
24285
24806
|
stream.on("error", reject);
|
|
24286
|
-
stream.on("finish",
|
|
24807
|
+
stream.on("finish", resolve9);
|
|
24287
24808
|
});
|
|
24288
24809
|
const client = this.#primaryTargetClient;
|
|
24289
24810
|
await client.send("HeapProfiler.enable");
|
|
@@ -25796,10 +26317,10 @@ __export(exports_BrowserWebSocketTransport, {
|
|
|
25796
26317
|
|
|
25797
26318
|
class BrowserWebSocketTransport {
|
|
25798
26319
|
static create(url) {
|
|
25799
|
-
return new Promise((
|
|
26320
|
+
return new Promise((resolve9, reject) => {
|
|
25800
26321
|
const ws = new WebSocket(url);
|
|
25801
26322
|
ws.addEventListener("open", () => {
|
|
25802
|
-
return
|
|
26323
|
+
return resolve9(new BrowserWebSocketTransport(ws));
|
|
25803
26324
|
});
|
|
25804
26325
|
ws.addEventListener("error", reject);
|
|
25805
26326
|
});
|
|
@@ -28633,11 +29154,11 @@ var require_BrowsingContextProcessor = __commonJS((exports) => {
|
|
|
28633
29154
|
}
|
|
28634
29155
|
const parentCdpClient = context2.cdpTarget.parentCdpClient;
|
|
28635
29156
|
try {
|
|
28636
|
-
const detachedFromTargetPromise = new Promise((
|
|
29157
|
+
const detachedFromTargetPromise = new Promise((resolve9) => {
|
|
28637
29158
|
const onContextDestroyed = (event) => {
|
|
28638
29159
|
if (event.targetId === params.context) {
|
|
28639
29160
|
parentCdpClient.off("Target.detachedFromTarget", onContextDestroyed);
|
|
28640
|
-
|
|
29161
|
+
resolve9();
|
|
28641
29162
|
}
|
|
28642
29163
|
};
|
|
28643
29164
|
parentCdpClient.on("Target.detachedFromTarget", onContextDestroyed);
|
|
@@ -29957,7 +30478,7 @@ var require_ActionDispatcher = __commonJS((exports) => {
|
|
|
29957
30478
|
}
|
|
29958
30479
|
}
|
|
29959
30480
|
const promises = [
|
|
29960
|
-
new Promise((
|
|
30481
|
+
new Promise((resolve9) => setTimeout(resolve9, this.#tickDuration))
|
|
29961
30482
|
];
|
|
29962
30483
|
for (const option of options) {
|
|
29963
30484
|
promises.push(this.#dispatchAction(option));
|
|
@@ -30556,8 +31077,8 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
30556
31077
|
acquire() {
|
|
30557
31078
|
const state = { resolved: false };
|
|
30558
31079
|
if (this.#locked) {
|
|
30559
|
-
return new Promise((
|
|
30560
|
-
this.#acquirers.push(() =>
|
|
31080
|
+
return new Promise((resolve9) => {
|
|
31081
|
+
this.#acquirers.push(() => resolve9(this.#release.bind(this, state)));
|
|
30561
31082
|
});
|
|
30562
31083
|
}
|
|
30563
31084
|
this.#locked = true;
|
|
@@ -30568,12 +31089,12 @@ var require_Mutex = __commonJS((exports) => {
|
|
|
30568
31089
|
throw new Error("Cannot release more than once.");
|
|
30569
31090
|
}
|
|
30570
31091
|
state.resolved = true;
|
|
30571
|
-
const
|
|
30572
|
-
if (!
|
|
31092
|
+
const resolve9 = this.#acquirers.shift();
|
|
31093
|
+
if (!resolve9) {
|
|
30573
31094
|
this.#locked = false;
|
|
30574
31095
|
return;
|
|
30575
31096
|
}
|
|
30576
|
-
|
|
31097
|
+
resolve9();
|
|
30577
31098
|
}
|
|
30578
31099
|
async run(action) {
|
|
30579
31100
|
const release = await this.acquire();
|
|
@@ -31700,8 +32221,8 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
31700
32221
|
let queueNonEmptyResolver = null;
|
|
31701
32222
|
return {
|
|
31702
32223
|
async getMessage() {
|
|
31703
|
-
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((
|
|
31704
|
-
queueNonEmptyResolver =
|
|
32224
|
+
const onMessage = queue.length > 0 ? Promise.resolve() : new Promise((resolve9) => {
|
|
32225
|
+
queueNonEmptyResolver = resolve9;
|
|
31705
32226
|
});
|
|
31706
32227
|
await onMessage;
|
|
31707
32228
|
return queue.shift();
|
|
@@ -31787,7 +32308,7 @@ var require_ChannelProxy = __commonJS((exports) => {
|
|
|
31787
32308
|
functionDeclaration: String((id) => {
|
|
31788
32309
|
const w = window;
|
|
31789
32310
|
if (w[id] === undefined) {
|
|
31790
|
-
return new Promise((
|
|
32311
|
+
return new Promise((resolve9) => w[id] = resolve9);
|
|
31791
32312
|
}
|
|
31792
32313
|
const channelProxy = w[id];
|
|
31793
32314
|
delete w[id];
|
|
@@ -33138,8 +33659,8 @@ var require_Deferred = __commonJS((exports) => {
|
|
|
33138
33659
|
return this.#result;
|
|
33139
33660
|
}
|
|
33140
33661
|
constructor() {
|
|
33141
|
-
this.#promise = new Promise((
|
|
33142
|
-
this.#resolve =
|
|
33662
|
+
this.#promise = new Promise((resolve9, reject) => {
|
|
33663
|
+
this.#resolve = resolve9;
|
|
33143
33664
|
this.#reject = reject;
|
|
33144
33665
|
});
|
|
33145
33666
|
this.#promise.catch((_error) => {});
|
|
@@ -37464,11 +37985,11 @@ var require_BrowsingContextStorage = __commonJS((exports) => {
|
|
|
37464
37985
|
if (this.#contexts.has(browsingContextId)) {
|
|
37465
37986
|
return Promise.resolve(this.getContext(browsingContextId));
|
|
37466
37987
|
}
|
|
37467
|
-
return new Promise((
|
|
37988
|
+
return new Promise((resolve9) => {
|
|
37468
37989
|
const listener = (event) => {
|
|
37469
37990
|
if (event.browsingContext.id === browsingContextId) {
|
|
37470
37991
|
this.#eventEmitter.off("added", listener);
|
|
37471
|
-
|
|
37992
|
+
resolve9(event.browsingContext);
|
|
37472
37993
|
}
|
|
37473
37994
|
};
|
|
37474
37995
|
this.#eventEmitter.on("added", listener);
|
|
@@ -40964,8 +41485,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
40964
41485
|
const functionDeclaration = stringifyFunction(interpolateFunction((callback) => {
|
|
40965
41486
|
Object.assign(globalThis, {
|
|
40966
41487
|
[PLACEHOLDER("name")]: function(...args) {
|
|
40967
|
-
return new Promise((
|
|
40968
|
-
callback([
|
|
41488
|
+
return new Promise((resolve9, reject) => {
|
|
41489
|
+
callback([resolve9, reject, args]);
|
|
40969
41490
|
});
|
|
40970
41491
|
}
|
|
40971
41492
|
});
|
|
@@ -41053,8 +41574,8 @@ var init_ExposedFunction = __esm(() => {
|
|
|
41053
41574
|
return;
|
|
41054
41575
|
}
|
|
41055
41576
|
try {
|
|
41056
|
-
await dataHandle.evaluate(([
|
|
41057
|
-
|
|
41577
|
+
await dataHandle.evaluate(([resolve9], result2) => {
|
|
41578
|
+
resolve9(result2);
|
|
41058
41579
|
}, result);
|
|
41059
41580
|
} catch (error) {
|
|
41060
41581
|
debugError(error);
|
|
@@ -47645,8 +48166,8 @@ var require_websocket = __commonJS((exports, module) => {
|
|
|
47645
48166
|
if (websocket.readyState !== WebSocket2.CONNECTING)
|
|
47646
48167
|
return;
|
|
47647
48168
|
req = websocket._req = null;
|
|
47648
|
-
const
|
|
47649
|
-
if (
|
|
48169
|
+
const upgrade2 = res.headers.upgrade;
|
|
48170
|
+
if (upgrade2 === undefined || upgrade2.toLowerCase() !== "websocket") {
|
|
47650
48171
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
47651
48172
|
return;
|
|
47652
48173
|
}
|
|
@@ -48149,14 +48670,14 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
48149
48670
|
handleUpgrade(req, socket, head, cb) {
|
|
48150
48671
|
socket.on("error", socketOnError);
|
|
48151
48672
|
const key = req.headers["sec-websocket-key"];
|
|
48152
|
-
const
|
|
48673
|
+
const upgrade2 = req.headers.upgrade;
|
|
48153
48674
|
const version = +req.headers["sec-websocket-version"];
|
|
48154
48675
|
if (req.method !== "GET") {
|
|
48155
48676
|
const message = "Invalid HTTP method";
|
|
48156
48677
|
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
48157
48678
|
return;
|
|
48158
48679
|
}
|
|
48159
|
-
if (
|
|
48680
|
+
if (upgrade2 === undefined || upgrade2.toLowerCase() !== "websocket") {
|
|
48160
48681
|
const message = "Invalid Upgrade header";
|
|
48161
48682
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
48162
48683
|
return;
|
|
@@ -48346,7 +48867,7 @@ __export(exports_NodeWebSocketTransport, {
|
|
|
48346
48867
|
|
|
48347
48868
|
class NodeWebSocketTransport {
|
|
48348
48869
|
static create(url, headers) {
|
|
48349
|
-
return new Promise((
|
|
48870
|
+
return new Promise((resolve9, reject) => {
|
|
48350
48871
|
const ws = new wrapper_default(url, [], {
|
|
48351
48872
|
followRedirects: true,
|
|
48352
48873
|
perMessageDeflate: false,
|
|
@@ -48358,7 +48879,7 @@ class NodeWebSocketTransport {
|
|
|
48358
48879
|
}
|
|
48359
48880
|
});
|
|
48360
48881
|
ws.addEventListener("open", () => {
|
|
48361
|
-
return
|
|
48882
|
+
return resolve9(new NodeWebSocketTransport(ws));
|
|
48362
48883
|
});
|
|
48363
48884
|
ws.addEventListener("error", reject);
|
|
48364
48885
|
});
|
|
@@ -51250,8 +51771,8 @@ var require_helpers = __commonJS((exports) => {
|
|
|
51250
51771
|
function req(url, opts = {}) {
|
|
51251
51772
|
const href = typeof url === "string" ? url : url.href;
|
|
51252
51773
|
const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
|
|
51253
|
-
const promise = new Promise((
|
|
51254
|
-
req2.once("response",
|
|
51774
|
+
const promise = new Promise((resolve9, reject) => {
|
|
51775
|
+
req2.once("response", resolve9).once("error", reject).end();
|
|
51255
51776
|
});
|
|
51256
51777
|
req2.then = promise.then.bind(promise);
|
|
51257
51778
|
return req2;
|
|
@@ -51622,7 +52143,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
51622
52143
|
var debug_1 = __importDefault(require_src());
|
|
51623
52144
|
var debug2 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
51624
52145
|
function parseProxyResponse(socket) {
|
|
51625
|
-
return new Promise((
|
|
52146
|
+
return new Promise((resolve9, reject) => {
|
|
51626
52147
|
let buffersLength = 0;
|
|
51627
52148
|
const buffers = [];
|
|
51628
52149
|
function read() {
|
|
@@ -51691,7 +52212,7 @@ var require_parse_proxy_response = __commonJS((exports) => {
|
|
|
51691
52212
|
}
|
|
51692
52213
|
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
51693
52214
|
cleanup();
|
|
51694
|
-
|
|
52215
|
+
resolve9({
|
|
51695
52216
|
connect: {
|
|
51696
52217
|
statusCode,
|
|
51697
52218
|
statusText,
|
|
@@ -53795,11 +54316,11 @@ var require_receivebuffer = __commonJS((exports) => {
|
|
|
53795
54316
|
var require_socksclient = __commonJS((exports) => {
|
|
53796
54317
|
var __awaiter2 = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
53797
54318
|
function adopt(value) {
|
|
53798
|
-
return value instanceof P ? value : new P(function(
|
|
53799
|
-
|
|
54319
|
+
return value instanceof P ? value : new P(function(resolve9) {
|
|
54320
|
+
resolve9(value);
|
|
53800
54321
|
});
|
|
53801
54322
|
}
|
|
53802
|
-
return new (P || (P = Promise))(function(
|
|
54323
|
+
return new (P || (P = Promise))(function(resolve9, reject) {
|
|
53803
54324
|
function fulfilled(value) {
|
|
53804
54325
|
try {
|
|
53805
54326
|
step(generator.next(value));
|
|
@@ -53815,7 +54336,7 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53815
54336
|
}
|
|
53816
54337
|
}
|
|
53817
54338
|
function step(result) {
|
|
53818
|
-
result.done ?
|
|
54339
|
+
result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
53819
54340
|
}
|
|
53820
54341
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53821
54342
|
});
|
|
@@ -53842,13 +54363,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53842
54363
|
this.setState(constants_1.SocksClientState.Created);
|
|
53843
54364
|
}
|
|
53844
54365
|
static createConnection(options, callback) {
|
|
53845
|
-
return new Promise((
|
|
54366
|
+
return new Promise((resolve9, reject) => {
|
|
53846
54367
|
try {
|
|
53847
54368
|
(0, helpers_1.validateSocksClientOptions)(options, ["connect"]);
|
|
53848
54369
|
} catch (err) {
|
|
53849
54370
|
if (typeof callback === "function") {
|
|
53850
54371
|
callback(err);
|
|
53851
|
-
return
|
|
54372
|
+
return resolve9(err);
|
|
53852
54373
|
} else {
|
|
53853
54374
|
return reject(err);
|
|
53854
54375
|
}
|
|
@@ -53859,16 +54380,16 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53859
54380
|
client.removeAllListeners();
|
|
53860
54381
|
if (typeof callback === "function") {
|
|
53861
54382
|
callback(null, info);
|
|
53862
|
-
|
|
54383
|
+
resolve9(info);
|
|
53863
54384
|
} else {
|
|
53864
|
-
|
|
54385
|
+
resolve9(info);
|
|
53865
54386
|
}
|
|
53866
54387
|
});
|
|
53867
54388
|
client.once("error", (err) => {
|
|
53868
54389
|
client.removeAllListeners();
|
|
53869
54390
|
if (typeof callback === "function") {
|
|
53870
54391
|
callback(err);
|
|
53871
|
-
|
|
54392
|
+
resolve9(err);
|
|
53872
54393
|
} else {
|
|
53873
54394
|
reject(err);
|
|
53874
54395
|
}
|
|
@@ -53876,13 +54397,13 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53876
54397
|
});
|
|
53877
54398
|
}
|
|
53878
54399
|
static createConnectionChain(options, callback) {
|
|
53879
|
-
return new Promise((
|
|
54400
|
+
return new Promise((resolve9, reject) => __awaiter2(this, undefined, undefined, function* () {
|
|
53880
54401
|
try {
|
|
53881
54402
|
(0, helpers_1.validateSocksClientChainOptions)(options);
|
|
53882
54403
|
} catch (err) {
|
|
53883
54404
|
if (typeof callback === "function") {
|
|
53884
54405
|
callback(err);
|
|
53885
|
-
return
|
|
54406
|
+
return resolve9(err);
|
|
53886
54407
|
} else {
|
|
53887
54408
|
return reject(err);
|
|
53888
54409
|
}
|
|
@@ -53908,14 +54429,14 @@ var require_socksclient = __commonJS((exports) => {
|
|
|
53908
54429
|
}
|
|
53909
54430
|
if (typeof callback === "function") {
|
|
53910
54431
|
callback(null, { socket: sock });
|
|
53911
|
-
|
|
54432
|
+
resolve9({ socket: sock });
|
|
53912
54433
|
} else {
|
|
53913
|
-
|
|
54434
|
+
resolve9({ socket: sock });
|
|
53914
54435
|
}
|
|
53915
54436
|
} catch (err) {
|
|
53916
54437
|
if (typeof callback === "function") {
|
|
53917
54438
|
callback(err);
|
|
53918
|
-
|
|
54439
|
+
resolve9(err);
|
|
53919
54440
|
} else {
|
|
53920
54441
|
reject(err);
|
|
53921
54442
|
}
|
|
@@ -54515,12 +55036,12 @@ var require_dist4 = __commonJS((exports) => {
|
|
|
54515
55036
|
let { host } = opts;
|
|
54516
55037
|
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
54517
55038
|
if (shouldLookup) {
|
|
54518
|
-
host = await new Promise((
|
|
55039
|
+
host = await new Promise((resolve9, reject) => {
|
|
54519
55040
|
lookupFn(host, {}, (err, res) => {
|
|
54520
55041
|
if (err) {
|
|
54521
55042
|
reject(err);
|
|
54522
55043
|
} else {
|
|
54523
|
-
|
|
55044
|
+
resolve9(res);
|
|
54524
55045
|
}
|
|
54525
55046
|
});
|
|
54526
55047
|
});
|
|
@@ -55527,7 +56048,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
55527
56048
|
return `${socket.remoteAddress}:${socket.remotePort}`;
|
|
55528
56049
|
}
|
|
55529
56050
|
function upgradeSocket(socket, options) {
|
|
55530
|
-
return new Promise((
|
|
56051
|
+
return new Promise((resolve9, reject) => {
|
|
55531
56052
|
const tlsOptions = Object.assign({}, options, {
|
|
55532
56053
|
socket
|
|
55533
56054
|
});
|
|
@@ -55537,7 +56058,7 @@ var require_netUtils = __commonJS((exports) => {
|
|
|
55537
56058
|
reject(tlsSocket.authorizationError);
|
|
55538
56059
|
} else {
|
|
55539
56060
|
tlsSocket.removeAllListeners("error");
|
|
55540
|
-
|
|
56061
|
+
resolve9(tlsSocket);
|
|
55541
56062
|
}
|
|
55542
56063
|
}).once("error", (error) => {
|
|
55543
56064
|
reject(error);
|
|
@@ -55629,7 +56150,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
55629
56150
|
};
|
|
55630
56151
|
}
|
|
55631
56152
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
55632
|
-
return new Promise((
|
|
56153
|
+
return new Promise((resolve9, reject) => {
|
|
55633
56154
|
let socket = ftp._newSocket();
|
|
55634
56155
|
const handleConnErr = function(err) {
|
|
55635
56156
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
@@ -55652,7 +56173,7 @@ var require_transfer = __commonJS((exports) => {
|
|
|
55652
56173
|
socket.removeListener("error", handleConnErr);
|
|
55653
56174
|
socket.removeListener("timeout", handleTimeout);
|
|
55654
56175
|
ftp.dataSocket = socket;
|
|
55655
|
-
|
|
56176
|
+
resolve9();
|
|
55656
56177
|
});
|
|
55657
56178
|
});
|
|
55658
56179
|
}
|
|
@@ -57730,7 +58251,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
57730
58251
|
return path;
|
|
57731
58252
|
}
|
|
57732
58253
|
exports.normalize = normalize2;
|
|
57733
|
-
function
|
|
58254
|
+
function join30(aRoot, aPath) {
|
|
57734
58255
|
if (aRoot === "") {
|
|
57735
58256
|
aRoot = ".";
|
|
57736
58257
|
}
|
|
@@ -57762,11 +58283,11 @@ var require_util2 = __commonJS((exports) => {
|
|
|
57762
58283
|
}
|
|
57763
58284
|
return joined;
|
|
57764
58285
|
}
|
|
57765
|
-
exports.join =
|
|
58286
|
+
exports.join = join30;
|
|
57766
58287
|
exports.isAbsolute = function(aPath) {
|
|
57767
58288
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
57768
58289
|
};
|
|
57769
|
-
function
|
|
58290
|
+
function relative9(aRoot, aPath) {
|
|
57770
58291
|
if (aRoot === "") {
|
|
57771
58292
|
aRoot = ".";
|
|
57772
58293
|
}
|
|
@@ -57785,7 +58306,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
57785
58306
|
}
|
|
57786
58307
|
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
57787
58308
|
}
|
|
57788
|
-
exports.relative =
|
|
58309
|
+
exports.relative = relative9;
|
|
57789
58310
|
var supportsNullProto = function() {
|
|
57790
58311
|
var obj = Object.create(null);
|
|
57791
58312
|
return !("__proto__" in obj);
|
|
@@ -57935,7 +58456,7 @@ var require_util2 = __commonJS((exports) => {
|
|
|
57935
58456
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
57936
58457
|
}
|
|
57937
58458
|
}
|
|
57938
|
-
sourceURL =
|
|
58459
|
+
sourceURL = join30(urlGenerate(parsed), sourceURL);
|
|
57939
58460
|
}
|
|
57940
58461
|
return normalize2(sourceURL);
|
|
57941
58462
|
}
|
|
@@ -59667,7 +60188,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
59667
60188
|
function noEmptySpace() {
|
|
59668
60189
|
return space ? space : " ";
|
|
59669
60190
|
}
|
|
59670
|
-
function
|
|
60191
|
+
function join30(left, right) {
|
|
59671
60192
|
var leftSource, rightSource, leftCharCode, rightCharCode;
|
|
59672
60193
|
leftSource = toSourceNodeWhenNeeded(left).toString();
|
|
59673
60194
|
if (leftSource.length === 0) {
|
|
@@ -60008,8 +60529,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60008
60529
|
} else {
|
|
60009
60530
|
result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT));
|
|
60010
60531
|
}
|
|
60011
|
-
result =
|
|
60012
|
-
result = [
|
|
60532
|
+
result = join30(result, operator);
|
|
60533
|
+
result = [join30(result, that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)), ")"];
|
|
60013
60534
|
});
|
|
60014
60535
|
result.push(this.maybeBlock(stmt.body, flags));
|
|
60015
60536
|
return result;
|
|
@@ -60147,11 +60668,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60147
60668
|
var result, fragment;
|
|
60148
60669
|
result = ["class"];
|
|
60149
60670
|
if (stmt.id) {
|
|
60150
|
-
result =
|
|
60671
|
+
result = join30(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
|
|
60151
60672
|
}
|
|
60152
60673
|
if (stmt.superClass) {
|
|
60153
|
-
fragment =
|
|
60154
|
-
result =
|
|
60674
|
+
fragment = join30("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT));
|
|
60675
|
+
result = join30(result, fragment);
|
|
60155
60676
|
}
|
|
60156
60677
|
result.push(space);
|
|
60157
60678
|
result.push(this.generateStatement(stmt.body, S_TFFT));
|
|
@@ -60164,9 +60685,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60164
60685
|
return escapeDirective(stmt.directive) + this.semicolon(flags);
|
|
60165
60686
|
},
|
|
60166
60687
|
DoWhileStatement: function(stmt, flags) {
|
|
60167
|
-
var result =
|
|
60688
|
+
var result = join30("do", this.maybeBlock(stmt.body, S_TFFF));
|
|
60168
60689
|
result = this.maybeBlockSuffix(stmt.body, result);
|
|
60169
|
-
return
|
|
60690
|
+
return join30(result, [
|
|
60170
60691
|
"while" + space + "(",
|
|
60171
60692
|
this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
|
|
60172
60693
|
")" + this.semicolon(flags)
|
|
@@ -60202,11 +60723,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60202
60723
|
ExportDefaultDeclaration: function(stmt, flags) {
|
|
60203
60724
|
var result = ["export"], bodyFlags;
|
|
60204
60725
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
60205
|
-
result =
|
|
60726
|
+
result = join30(result, "default");
|
|
60206
60727
|
if (isStatement(stmt.declaration)) {
|
|
60207
|
-
result =
|
|
60728
|
+
result = join30(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
60208
60729
|
} else {
|
|
60209
|
-
result =
|
|
60730
|
+
result = join30(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags));
|
|
60210
60731
|
}
|
|
60211
60732
|
return result;
|
|
60212
60733
|
},
|
|
@@ -60214,15 +60735,15 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60214
60735
|
var result = ["export"], bodyFlags, that = this;
|
|
60215
60736
|
bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF;
|
|
60216
60737
|
if (stmt.declaration) {
|
|
60217
|
-
return
|
|
60738
|
+
return join30(result, this.generateStatement(stmt.declaration, bodyFlags));
|
|
60218
60739
|
}
|
|
60219
60740
|
if (stmt.specifiers) {
|
|
60220
60741
|
if (stmt.specifiers.length === 0) {
|
|
60221
|
-
result =
|
|
60742
|
+
result = join30(result, "{" + space + "}");
|
|
60222
60743
|
} else if (stmt.specifiers[0].type === Syntax.ExportBatchSpecifier) {
|
|
60223
|
-
result =
|
|
60744
|
+
result = join30(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT));
|
|
60224
60745
|
} else {
|
|
60225
|
-
result =
|
|
60746
|
+
result = join30(result, "{");
|
|
60226
60747
|
withIndent(function(indent2) {
|
|
60227
60748
|
var i, iz;
|
|
60228
60749
|
result.push(newline);
|
|
@@ -60240,7 +60761,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60240
60761
|
result.push(base + "}");
|
|
60241
60762
|
}
|
|
60242
60763
|
if (stmt.source) {
|
|
60243
|
-
result =
|
|
60764
|
+
result = join30(result, [
|
|
60244
60765
|
"from" + space,
|
|
60245
60766
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
60246
60767
|
this.semicolon(flags)
|
|
@@ -60324,7 +60845,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60324
60845
|
];
|
|
60325
60846
|
cursor = 0;
|
|
60326
60847
|
if (stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier) {
|
|
60327
|
-
result =
|
|
60848
|
+
result = join30(result, [
|
|
60328
60849
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
60329
60850
|
]);
|
|
60330
60851
|
++cursor;
|
|
@@ -60334,7 +60855,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60334
60855
|
result.push(",");
|
|
60335
60856
|
}
|
|
60336
60857
|
if (stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier) {
|
|
60337
|
-
result =
|
|
60858
|
+
result = join30(result, [
|
|
60338
60859
|
space,
|
|
60339
60860
|
this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
|
|
60340
60861
|
]);
|
|
@@ -60363,7 +60884,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60363
60884
|
}
|
|
60364
60885
|
}
|
|
60365
60886
|
}
|
|
60366
|
-
result =
|
|
60887
|
+
result = join30(result, [
|
|
60367
60888
|
"from" + space,
|
|
60368
60889
|
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
|
|
60369
60890
|
this.semicolon(flags)
|
|
@@ -60417,7 +60938,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60417
60938
|
return result;
|
|
60418
60939
|
},
|
|
60419
60940
|
ThrowStatement: function(stmt, flags) {
|
|
60420
|
-
return [
|
|
60941
|
+
return [join30("throw", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
60421
60942
|
},
|
|
60422
60943
|
TryStatement: function(stmt, flags) {
|
|
60423
60944
|
var result, i, iz, guardedHandlers;
|
|
@@ -60425,7 +60946,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60425
60946
|
result = this.maybeBlockSuffix(stmt.block, result);
|
|
60426
60947
|
if (stmt.handlers) {
|
|
60427
60948
|
for (i = 0, iz = stmt.handlers.length;i < iz; ++i) {
|
|
60428
|
-
result =
|
|
60949
|
+
result = join30(result, this.generateStatement(stmt.handlers[i], S_TFFF));
|
|
60429
60950
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
60430
60951
|
result = this.maybeBlockSuffix(stmt.handlers[i].body, result);
|
|
60431
60952
|
}
|
|
@@ -60433,7 +60954,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60433
60954
|
} else {
|
|
60434
60955
|
guardedHandlers = stmt.guardedHandlers || [];
|
|
60435
60956
|
for (i = 0, iz = guardedHandlers.length;i < iz; ++i) {
|
|
60436
|
-
result =
|
|
60957
|
+
result = join30(result, this.generateStatement(guardedHandlers[i], S_TFFF));
|
|
60437
60958
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
60438
60959
|
result = this.maybeBlockSuffix(guardedHandlers[i].body, result);
|
|
60439
60960
|
}
|
|
@@ -60441,13 +60962,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60441
60962
|
if (stmt.handler) {
|
|
60442
60963
|
if (Array.isArray(stmt.handler)) {
|
|
60443
60964
|
for (i = 0, iz = stmt.handler.length;i < iz; ++i) {
|
|
60444
|
-
result =
|
|
60965
|
+
result = join30(result, this.generateStatement(stmt.handler[i], S_TFFF));
|
|
60445
60966
|
if (stmt.finalizer || i + 1 !== iz) {
|
|
60446
60967
|
result = this.maybeBlockSuffix(stmt.handler[i].body, result);
|
|
60447
60968
|
}
|
|
60448
60969
|
}
|
|
60449
60970
|
} else {
|
|
60450
|
-
result =
|
|
60971
|
+
result = join30(result, this.generateStatement(stmt.handler, S_TFFF));
|
|
60451
60972
|
if (stmt.finalizer) {
|
|
60452
60973
|
result = this.maybeBlockSuffix(stmt.handler.body, result);
|
|
60453
60974
|
}
|
|
@@ -60455,7 +60976,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60455
60976
|
}
|
|
60456
60977
|
}
|
|
60457
60978
|
if (stmt.finalizer) {
|
|
60458
|
-
result =
|
|
60979
|
+
result = join30(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)]);
|
|
60459
60980
|
}
|
|
60460
60981
|
return result;
|
|
60461
60982
|
},
|
|
@@ -60489,7 +61010,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60489
61010
|
withIndent(function() {
|
|
60490
61011
|
if (stmt.test) {
|
|
60491
61012
|
result = [
|
|
60492
|
-
|
|
61013
|
+
join30("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
|
|
60493
61014
|
":"
|
|
60494
61015
|
];
|
|
60495
61016
|
} else {
|
|
@@ -60537,9 +61058,9 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60537
61058
|
result.push(this.maybeBlock(stmt.consequent, S_TFFF));
|
|
60538
61059
|
result = this.maybeBlockSuffix(stmt.consequent, result);
|
|
60539
61060
|
if (stmt.alternate.type === Syntax.IfStatement) {
|
|
60540
|
-
result =
|
|
61061
|
+
result = join30(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]);
|
|
60541
61062
|
} else {
|
|
60542
|
-
result =
|
|
61063
|
+
result = join30(result, join30("else", this.maybeBlock(stmt.alternate, bodyFlags)));
|
|
60543
61064
|
}
|
|
60544
61065
|
} else {
|
|
60545
61066
|
result.push(this.maybeBlock(stmt.consequent, bodyFlags));
|
|
@@ -60641,7 +61162,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60641
61162
|
},
|
|
60642
61163
|
ReturnStatement: function(stmt, flags) {
|
|
60643
61164
|
if (stmt.argument) {
|
|
60644
|
-
return [
|
|
61165
|
+
return [join30("return", this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)), this.semicolon(flags)];
|
|
60645
61166
|
}
|
|
60646
61167
|
return ["return" + this.semicolon(flags)];
|
|
60647
61168
|
},
|
|
@@ -60723,14 +61244,14 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60723
61244
|
if (leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0))) {
|
|
60724
61245
|
result = [fragment, noEmptySpace(), expr.operator];
|
|
60725
61246
|
} else {
|
|
60726
|
-
result =
|
|
61247
|
+
result = join30(fragment, expr.operator);
|
|
60727
61248
|
}
|
|
60728
61249
|
fragment = this.generateExpression(expr.right, rightPrecedence, flags);
|
|
60729
61250
|
if (expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--") {
|
|
60730
61251
|
result.push(noEmptySpace());
|
|
60731
61252
|
result.push(fragment);
|
|
60732
61253
|
} else {
|
|
60733
|
-
result =
|
|
61254
|
+
result = join30(result, fragment);
|
|
60734
61255
|
}
|
|
60735
61256
|
if (expr.operator === "in" && !(flags & F_ALLOW_IN)) {
|
|
60736
61257
|
return ["(", result, ")"];
|
|
@@ -60770,7 +61291,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60770
61291
|
var result, length, i, iz, itemFlags;
|
|
60771
61292
|
length = expr["arguments"].length;
|
|
60772
61293
|
itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF;
|
|
60773
|
-
result =
|
|
61294
|
+
result = join30("new", this.generateExpression(expr.callee, Precedence.New, itemFlags));
|
|
60774
61295
|
if (!(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
|
|
60775
61296
|
result.push("(");
|
|
60776
61297
|
for (i = 0, iz = length;i < iz; ++i) {
|
|
@@ -60817,11 +61338,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60817
61338
|
var result, fragment, rightCharCode, leftSource, leftCharCode;
|
|
60818
61339
|
fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT);
|
|
60819
61340
|
if (space === "") {
|
|
60820
|
-
result =
|
|
61341
|
+
result = join30(expr.operator, fragment);
|
|
60821
61342
|
} else {
|
|
60822
61343
|
result = [expr.operator];
|
|
60823
61344
|
if (expr.operator.length > 2) {
|
|
60824
|
-
result =
|
|
61345
|
+
result = join30(result, fragment);
|
|
60825
61346
|
} else {
|
|
60826
61347
|
leftSource = toSourceNodeWhenNeeded(result).toString();
|
|
60827
61348
|
leftCharCode = leftSource.charCodeAt(leftSource.length - 1);
|
|
@@ -60844,12 +61365,12 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60844
61365
|
result = "yield";
|
|
60845
61366
|
}
|
|
60846
61367
|
if (expr.argument) {
|
|
60847
|
-
result =
|
|
61368
|
+
result = join30(result, this.generateExpression(expr.argument, Precedence.Yield, E_TTT));
|
|
60848
61369
|
}
|
|
60849
61370
|
return parenthesize(result, Precedence.Yield, precedence);
|
|
60850
61371
|
},
|
|
60851
61372
|
AwaitExpression: function(expr, precedence, flags) {
|
|
60852
|
-
var result =
|
|
61373
|
+
var result = join30(expr.all ? "await*" : "await", this.generateExpression(expr.argument, Precedence.Await, E_TTT));
|
|
60853
61374
|
return parenthesize(result, Precedence.Await, precedence);
|
|
60854
61375
|
},
|
|
60855
61376
|
UpdateExpression: function(expr, precedence, flags) {
|
|
@@ -60921,11 +61442,11 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60921
61442
|
var result, fragment;
|
|
60922
61443
|
result = ["class"];
|
|
60923
61444
|
if (expr.id) {
|
|
60924
|
-
result =
|
|
61445
|
+
result = join30(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT));
|
|
60925
61446
|
}
|
|
60926
61447
|
if (expr.superClass) {
|
|
60927
|
-
fragment =
|
|
60928
|
-
result =
|
|
61448
|
+
fragment = join30("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT));
|
|
61449
|
+
result = join30(result, fragment);
|
|
60929
61450
|
}
|
|
60930
61451
|
result.push(space);
|
|
60931
61452
|
result.push(this.generateStatement(expr.body, S_TFFT));
|
|
@@ -60940,7 +61461,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60940
61461
|
}
|
|
60941
61462
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
60942
61463
|
fragment = [
|
|
60943
|
-
|
|
61464
|
+
join30(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
|
|
60944
61465
|
this.generateFunctionBody(expr.value)
|
|
60945
61466
|
];
|
|
60946
61467
|
} else {
|
|
@@ -60950,7 +61471,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
60950
61471
|
this.generateFunctionBody(expr.value)
|
|
60951
61472
|
];
|
|
60952
61473
|
}
|
|
60953
|
-
return
|
|
61474
|
+
return join30(result, fragment);
|
|
60954
61475
|
},
|
|
60955
61476
|
Property: function(expr, precedence, flags) {
|
|
60956
61477
|
if (expr.kind === "get" || expr.kind === "set") {
|
|
@@ -61144,7 +61665,7 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
61144
61665
|
for (i = 0, iz = expr.blocks.length;i < iz; ++i) {
|
|
61145
61666
|
fragment = that.generateExpression(expr.blocks[i], Precedence.Sequence, E_TTT);
|
|
61146
61667
|
if (i > 0 || extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
61147
|
-
result =
|
|
61668
|
+
result = join30(result, fragment);
|
|
61148
61669
|
} else {
|
|
61149
61670
|
result.push(fragment);
|
|
61150
61671
|
}
|
|
@@ -61152,13 +61673,13 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
61152
61673
|
});
|
|
61153
61674
|
}
|
|
61154
61675
|
if (expr.filter) {
|
|
61155
|
-
result =
|
|
61676
|
+
result = join30(result, "if" + space);
|
|
61156
61677
|
fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT);
|
|
61157
|
-
result =
|
|
61678
|
+
result = join30(result, ["(", fragment, ")"]);
|
|
61158
61679
|
}
|
|
61159
61680
|
if (!extra.moz.comprehensionExpressionStartsWithAssignment) {
|
|
61160
61681
|
fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT);
|
|
61161
|
-
result =
|
|
61682
|
+
result = join30(result, fragment);
|
|
61162
61683
|
}
|
|
61163
61684
|
result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]");
|
|
61164
61685
|
return result;
|
|
@@ -61174,8 +61695,8 @@ var require_escodegen = __commonJS((exports) => {
|
|
|
61174
61695
|
} else {
|
|
61175
61696
|
fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT);
|
|
61176
61697
|
}
|
|
61177
|
-
fragment =
|
|
61178
|
-
fragment =
|
|
61698
|
+
fragment = join30(fragment, expr.of ? "of" : "in");
|
|
61699
|
+
fragment = join30(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT));
|
|
61179
61700
|
return ["for" + space + "(", fragment, ")"];
|
|
61180
61701
|
},
|
|
61181
61702
|
SpreadElement: function(expr, precedence, flags) {
|
|
@@ -67663,11 +68184,11 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
67663
68184
|
};
|
|
67664
68185
|
__awaiter2 = function(thisArg, _arguments, P, generator) {
|
|
67665
68186
|
function adopt(value) {
|
|
67666
|
-
return value instanceof P ? value : new P(function(
|
|
67667
|
-
|
|
68187
|
+
return value instanceof P ? value : new P(function(resolve9) {
|
|
68188
|
+
resolve9(value);
|
|
67668
68189
|
});
|
|
67669
68190
|
}
|
|
67670
|
-
return new (P || (P = Promise))(function(
|
|
68191
|
+
return new (P || (P = Promise))(function(resolve9, reject) {
|
|
67671
68192
|
function fulfilled(value) {
|
|
67672
68193
|
try {
|
|
67673
68194
|
step(generator.next(value));
|
|
@@ -67683,7 +68204,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
67683
68204
|
}
|
|
67684
68205
|
}
|
|
67685
68206
|
function step(result) {
|
|
67686
|
-
result.done ?
|
|
68207
|
+
result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
67687
68208
|
}
|
|
67688
68209
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
67689
68210
|
});
|
|
@@ -67912,14 +68433,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
67912
68433
|
}, i);
|
|
67913
68434
|
function verb(n) {
|
|
67914
68435
|
i[n] = o[n] && function(v) {
|
|
67915
|
-
return new Promise(function(
|
|
67916
|
-
v = o[n](v), settle(
|
|
68436
|
+
return new Promise(function(resolve9, reject) {
|
|
68437
|
+
v = o[n](v), settle(resolve9, reject, v.done, v.value);
|
|
67917
68438
|
});
|
|
67918
68439
|
};
|
|
67919
68440
|
}
|
|
67920
|
-
function settle(
|
|
68441
|
+
function settle(resolve9, reject, d, v) {
|
|
67921
68442
|
Promise.resolve(v).then(function(v2) {
|
|
67922
|
-
|
|
68443
|
+
resolve9({ value: v2, done: d });
|
|
67923
68444
|
}, reject);
|
|
67924
68445
|
}
|
|
67925
68446
|
};
|
|
@@ -71158,12 +71679,12 @@ var require_util3 = __commonJS((exports) => {
|
|
|
71158
71679
|
exports.isGMT = exports.dnsLookup = undefined;
|
|
71159
71680
|
var dns_1 = __require("dns");
|
|
71160
71681
|
function dnsLookup(host, opts) {
|
|
71161
|
-
return new Promise((
|
|
71682
|
+
return new Promise((resolve9, reject) => {
|
|
71162
71683
|
(0, dns_1.lookup)(host, opts, (err, res) => {
|
|
71163
71684
|
if (err) {
|
|
71164
71685
|
reject(err);
|
|
71165
71686
|
} else {
|
|
71166
|
-
|
|
71687
|
+
resolve9(res);
|
|
71167
71688
|
}
|
|
71168
71689
|
});
|
|
71169
71690
|
});
|
|
@@ -71737,10 +72258,10 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
71737
72258
|
var ip_1 = require_ip();
|
|
71738
72259
|
var net_1 = __importDefault(__require("net"));
|
|
71739
72260
|
async function myIpAddress() {
|
|
71740
|
-
return new Promise((
|
|
72261
|
+
return new Promise((resolve9, reject) => {
|
|
71741
72262
|
const socket = net_1.default.connect({ host: "8.8.8.8", port: 53 });
|
|
71742
72263
|
const onError = () => {
|
|
71743
|
-
|
|
72264
|
+
resolve9(ip_1.ip.address());
|
|
71744
72265
|
};
|
|
71745
72266
|
socket.once("error", onError);
|
|
71746
72267
|
socket.once("connect", () => {
|
|
@@ -71748,9 +72269,9 @@ var require_myIpAddress = __commonJS((exports) => {
|
|
|
71748
72269
|
const addr = socket.address();
|
|
71749
72270
|
socket.destroy();
|
|
71750
72271
|
if (typeof addr === "string") {
|
|
71751
|
-
|
|
72272
|
+
resolve9(addr);
|
|
71752
72273
|
} else if (addr.address) {
|
|
71753
|
-
|
|
72274
|
+
resolve9(addr.address);
|
|
71754
72275
|
} else {
|
|
71755
72276
|
reject(new Error("Expected a `string`"));
|
|
71756
72277
|
}
|
|
@@ -72264,8 +72785,8 @@ var require_deferred_promise = __commonJS((exports) => {
|
|
|
72264
72785
|
this.context = args.context;
|
|
72265
72786
|
this.owner = args.context.runtime;
|
|
72266
72787
|
this.handle = args.promiseHandle;
|
|
72267
|
-
this.settled = new Promise((
|
|
72268
|
-
this.onSettled =
|
|
72788
|
+
this.settled = new Promise((resolve9) => {
|
|
72789
|
+
this.onSettled = resolve9;
|
|
72269
72790
|
});
|
|
72270
72791
|
this.resolveHandle = args.resolveHandle;
|
|
72271
72792
|
this.rejectHandle = args.rejectHandle;
|
|
@@ -72657,13 +73178,13 @@ var require_context = __commonJS((exports) => {
|
|
|
72657
73178
|
if (vmResolveResult.error) {
|
|
72658
73179
|
return Promise.resolve(vmResolveResult);
|
|
72659
73180
|
}
|
|
72660
|
-
return new Promise((
|
|
73181
|
+
return new Promise((resolve9) => {
|
|
72661
73182
|
lifetime_1.Scope.withScope((scope) => {
|
|
72662
73183
|
const resolveHandle = scope.manage(this.newFunction("resolve", (value) => {
|
|
72663
|
-
|
|
73184
|
+
resolve9({ value: value && value.dup() });
|
|
72664
73185
|
}));
|
|
72665
73186
|
const rejectHandle = scope.manage(this.newFunction("reject", (error) => {
|
|
72666
|
-
|
|
73187
|
+
resolve9({ error: error && error.dup() });
|
|
72667
73188
|
}));
|
|
72668
73189
|
const promiseHandle = scope.manage(vmResolveResult.value);
|
|
72669
73190
|
const promiseThenHandle = scope.manage(this.getProp(promiseHandle, "then"));
|
|
@@ -74777,13 +75298,13 @@ import * as http from "node:http";
|
|
|
74777
75298
|
import * as https from "node:https";
|
|
74778
75299
|
import { URL as URL2, urlToHttpOptions } from "node:url";
|
|
74779
75300
|
function headHttpRequest(url) {
|
|
74780
|
-
return new Promise((
|
|
75301
|
+
return new Promise((resolve9) => {
|
|
74781
75302
|
const request3 = httpRequest(url, "HEAD", (response) => {
|
|
74782
75303
|
response.resume();
|
|
74783
|
-
|
|
75304
|
+
resolve9(response.statusCode === 200);
|
|
74784
75305
|
}, false);
|
|
74785
75306
|
request3.on("error", () => {
|
|
74786
|
-
|
|
75307
|
+
resolve9(false);
|
|
74787
75308
|
});
|
|
74788
75309
|
});
|
|
74789
75310
|
}
|
|
@@ -74811,7 +75332,7 @@ function httpRequest(url, method, response, keepAlive = true) {
|
|
|
74811
75332
|
return request3;
|
|
74812
75333
|
}
|
|
74813
75334
|
function downloadFile(url, destinationPath, progressCallback) {
|
|
74814
|
-
return new Promise((
|
|
75335
|
+
return new Promise((resolve9, reject) => {
|
|
74815
75336
|
let downloadedBytes = 0;
|
|
74816
75337
|
let totalBytes = 0;
|
|
74817
75338
|
function onData(chunk) {
|
|
@@ -74827,7 +75348,7 @@ function downloadFile(url, destinationPath, progressCallback) {
|
|
|
74827
75348
|
}
|
|
74828
75349
|
const file = createWriteStream(destinationPath);
|
|
74829
75350
|
file.on("close", () => {
|
|
74830
|
-
return
|
|
75351
|
+
return resolve9();
|
|
74831
75352
|
});
|
|
74832
75353
|
file.on("error", (error) => {
|
|
74833
75354
|
return reject(error);
|
|
@@ -74852,7 +75373,7 @@ async function getJSON(url) {
|
|
|
74852
75373
|
}
|
|
74853
75374
|
}
|
|
74854
75375
|
function getText(url) {
|
|
74855
|
-
return new Promise((
|
|
75376
|
+
return new Promise((resolve9, reject) => {
|
|
74856
75377
|
const request3 = httpRequest(url, "GET", (response) => {
|
|
74857
75378
|
let data = "";
|
|
74858
75379
|
if (response.statusCode && response.statusCode >= 400) {
|
|
@@ -74863,7 +75384,7 @@ function getText(url) {
|
|
|
74863
75384
|
});
|
|
74864
75385
|
response.on("end", () => {
|
|
74865
75386
|
try {
|
|
74866
|
-
return
|
|
75387
|
+
return resolve9(String(data));
|
|
74867
75388
|
} catch {
|
|
74868
75389
|
return reject(new Error(`Failed to read text response from ${url}`));
|
|
74869
75390
|
}
|
|
@@ -76084,7 +76605,7 @@ class Process {
|
|
|
76084
76605
|
if (opts.onExit) {
|
|
76085
76606
|
this.#onExitHook = opts.onExit;
|
|
76086
76607
|
}
|
|
76087
|
-
this.#browserProcessExiting = new Promise((
|
|
76608
|
+
this.#browserProcessExiting = new Promise((resolve9, reject) => {
|
|
76088
76609
|
this.#browserProcess.once("exit", async () => {
|
|
76089
76610
|
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
|
76090
76611
|
this.#clearListeners();
|
|
@@ -76095,7 +76616,7 @@ class Process {
|
|
|
76095
76616
|
reject(err);
|
|
76096
76617
|
return;
|
|
76097
76618
|
}
|
|
76098
|
-
|
|
76619
|
+
resolve9();
|
|
76099
76620
|
});
|
|
76100
76621
|
});
|
|
76101
76622
|
}
|
|
@@ -76205,7 +76726,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
76205
76726
|
return [...this.#logs];
|
|
76206
76727
|
}
|
|
76207
76728
|
waitForLineOutput(regex, timeout2 = 0) {
|
|
76208
|
-
return new Promise((
|
|
76729
|
+
return new Promise((resolve9, reject) => {
|
|
76209
76730
|
const onClose = (errorOrCode) => {
|
|
76210
76731
|
cleanup();
|
|
76211
76732
|
reject(new Error([
|
|
@@ -76243,7 +76764,7 @@ Error cause: ${isErrorLike2(error) ? error.stack : error}`);
|
|
|
76243
76764
|
return;
|
|
76244
76765
|
}
|
|
76245
76766
|
cleanup();
|
|
76246
|
-
|
|
76767
|
+
resolve9(match[1]);
|
|
76247
76768
|
}
|
|
76248
76769
|
});
|
|
76249
76770
|
}
|
|
@@ -76773,7 +77294,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
76773
77294
|
};
|
|
76774
77295
|
const { maxBuffer } = options;
|
|
76775
77296
|
let stream;
|
|
76776
|
-
await new Promise((
|
|
77297
|
+
await new Promise((resolve9, reject) => {
|
|
76777
77298
|
const rejectPromise = (error) => {
|
|
76778
77299
|
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
76779
77300
|
error.bufferedData = stream.getBufferedValue();
|
|
@@ -76785,7 +77306,7 @@ var require_get_stream = __commonJS((exports, module) => {
|
|
|
76785
77306
|
rejectPromise(error);
|
|
76786
77307
|
return;
|
|
76787
77308
|
}
|
|
76788
|
-
|
|
77309
|
+
resolve9();
|
|
76789
77310
|
});
|
|
76790
77311
|
stream.on("data", () => {
|
|
76791
77312
|
if (stream.getBufferedLength() > maxBuffer) {
|
|
@@ -78146,7 +78667,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
78146
78667
|
debug4("opening", this.zipPath, "with opts", this.opts);
|
|
78147
78668
|
this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
|
|
78148
78669
|
this.canceled = false;
|
|
78149
|
-
return new Promise((
|
|
78670
|
+
return new Promise((resolve9, reject) => {
|
|
78150
78671
|
this.zipfile.on("error", (err) => {
|
|
78151
78672
|
this.canceled = true;
|
|
78152
78673
|
reject(err);
|
|
@@ -78155,7 +78676,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
78155
78676
|
this.zipfile.on("close", () => {
|
|
78156
78677
|
if (!this.canceled) {
|
|
78157
78678
|
debug4("zip extraction complete");
|
|
78158
|
-
|
|
78679
|
+
resolve9();
|
|
78159
78680
|
}
|
|
78160
78681
|
});
|
|
78161
78682
|
this.zipfile.on("entry", async (entry) => {
|
|
@@ -79497,8 +80018,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
79497
80018
|
return this;
|
|
79498
80019
|
},
|
|
79499
80020
|
next() {
|
|
79500
|
-
return new Promise(function(
|
|
79501
|
-
promiseResolve =
|
|
80021
|
+
return new Promise(function(resolve9, reject) {
|
|
80022
|
+
promiseResolve = resolve9;
|
|
79502
80023
|
promiseReject = reject;
|
|
79503
80024
|
const data = stream.read();
|
|
79504
80025
|
if (data !== null)
|
|
@@ -79535,14 +80056,14 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
79535
80056
|
}
|
|
79536
80057
|
function destroy(err) {
|
|
79537
80058
|
stream.destroy(err);
|
|
79538
|
-
return new Promise((
|
|
80059
|
+
return new Promise((resolve9, reject) => {
|
|
79539
80060
|
if (stream._duplexState & DESTROYED)
|
|
79540
|
-
return
|
|
80061
|
+
return resolve9({ value: undefined, done: true });
|
|
79541
80062
|
stream.once("close", function() {
|
|
79542
80063
|
if (err)
|
|
79543
80064
|
reject(err);
|
|
79544
80065
|
else
|
|
79545
|
-
|
|
80066
|
+
resolve9({ value: undefined, done: true });
|
|
79546
80067
|
});
|
|
79547
80068
|
});
|
|
79548
80069
|
}
|
|
@@ -79594,8 +80115,8 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
79594
80115
|
return Promise.resolve(true);
|
|
79595
80116
|
if (state.drains === null)
|
|
79596
80117
|
state.drains = [];
|
|
79597
|
-
return new Promise((
|
|
79598
|
-
state.drains.push({ writes, resolve:
|
|
80118
|
+
return new Promise((resolve9) => {
|
|
80119
|
+
state.drains.push({ writes, resolve: resolve9 });
|
|
79599
80120
|
});
|
|
79600
80121
|
}
|
|
79601
80122
|
write(data) {
|
|
@@ -79709,11 +80230,11 @@ var require_streamx = __commonJS((exports, module) => {
|
|
|
79709
80230
|
cb(null);
|
|
79710
80231
|
}
|
|
79711
80232
|
function pipelinePromise(...streams) {
|
|
79712
|
-
return new Promise((
|
|
80233
|
+
return new Promise((resolve9, reject) => {
|
|
79713
80234
|
return pipeline(...streams, (err) => {
|
|
79714
80235
|
if (err)
|
|
79715
80236
|
return reject(err);
|
|
79716
|
-
|
|
80237
|
+
resolve9();
|
|
79717
80238
|
});
|
|
79718
80239
|
});
|
|
79719
80240
|
}
|
|
@@ -80427,16 +80948,16 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
80427
80948
|
entryCallback = null;
|
|
80428
80949
|
cb(err);
|
|
80429
80950
|
}
|
|
80430
|
-
function onnext(
|
|
80951
|
+
function onnext(resolve9, reject) {
|
|
80431
80952
|
if (error) {
|
|
80432
80953
|
return reject(error);
|
|
80433
80954
|
}
|
|
80434
80955
|
if (entryStream) {
|
|
80435
|
-
|
|
80956
|
+
resolve9({ value: entryStream, done: false });
|
|
80436
80957
|
entryStream = null;
|
|
80437
80958
|
return;
|
|
80438
80959
|
}
|
|
80439
|
-
promiseResolve =
|
|
80960
|
+
promiseResolve = resolve9;
|
|
80440
80961
|
promiseReject = reject;
|
|
80441
80962
|
consumeCallback(null);
|
|
80442
80963
|
if (extract._finished && promiseResolve) {
|
|
@@ -80467,14 +80988,14 @@ var require_extract = __commonJS((exports, module) => {
|
|
|
80467
80988
|
function destroy(err) {
|
|
80468
80989
|
extract.destroy(err);
|
|
80469
80990
|
consumeCallback(err);
|
|
80470
|
-
return new Promise((
|
|
80991
|
+
return new Promise((resolve9, reject) => {
|
|
80471
80992
|
if (extract.destroyed)
|
|
80472
|
-
return
|
|
80993
|
+
return resolve9({ value: undefined, done: true });
|
|
80473
80994
|
extract.once("close", function() {
|
|
80474
80995
|
if (err)
|
|
80475
80996
|
reject(err);
|
|
80476
80997
|
else
|
|
80477
|
-
|
|
80998
|
+
resolve9({ value: undefined, done: true });
|
|
80478
80999
|
});
|
|
80479
81000
|
});
|
|
80480
81001
|
}
|
|
@@ -81142,7 +81663,7 @@ var require_tar_fs = __commonJS((exports) => {
|
|
|
81142
81663
|
});
|
|
81143
81664
|
|
|
81144
81665
|
// node_modules/@puppeteer/browsers/lib/esm/fileUtil.js
|
|
81145
|
-
import { spawnSync as
|
|
81666
|
+
import { spawnSync as spawnSync3, spawn } from "node:child_process";
|
|
81146
81667
|
import { createReadStream } from "node:fs";
|
|
81147
81668
|
import { mkdir, readdir } from "node:fs/promises";
|
|
81148
81669
|
import * as path7 from "node:path";
|
|
@@ -81160,7 +81681,7 @@ async function unpackArchive(archivePath, folderPath) {
|
|
|
81160
81681
|
await mkdir(folderPath);
|
|
81161
81682
|
await installDMG(archivePath, folderPath);
|
|
81162
81683
|
} else if (archivePath.endsWith(".exe")) {
|
|
81163
|
-
const result =
|
|
81684
|
+
const result = spawnSync3(archivePath, [`/ExtractDir=${folderPath}`], {
|
|
81164
81685
|
env: {
|
|
81165
81686
|
__compat_layer: "RunAsInvoker"
|
|
81166
81687
|
}
|
|
@@ -81234,7 +81755,7 @@ async function extractTar(tarPath, folderPath, decompressUtilityName) {
|
|
|
81234
81755
|
});
|
|
81235
81756
|
}
|
|
81236
81757
|
async function installDMG(dmgPath, folderPath) {
|
|
81237
|
-
const { stdout } =
|
|
81758
|
+
const { stdout } = spawnSync3(`hdiutil`, [
|
|
81238
81759
|
"attach",
|
|
81239
81760
|
"-nobrowse",
|
|
81240
81761
|
"-noautoopen",
|
|
@@ -81254,9 +81775,9 @@ async function installDMG(dmgPath, folderPath) {
|
|
|
81254
81775
|
throw new Error(`Cannot find app in ${mountPath}`);
|
|
81255
81776
|
}
|
|
81256
81777
|
const mountedPath = path7.join(mountPath, appName);
|
|
81257
|
-
|
|
81778
|
+
spawnSync3("cp", ["-R", mountedPath, folderPath]);
|
|
81258
81779
|
} finally {
|
|
81259
|
-
|
|
81780
|
+
spawnSync3("hdiutil", ["detach", mountPath, "-quiet"]);
|
|
81260
81781
|
}
|
|
81261
81782
|
}
|
|
81262
81783
|
var import_debug4, debugFileUtil, internalConstantsForTesting;
|
|
@@ -81271,8 +81792,8 @@ var init_fileUtil = __esm(() => {
|
|
|
81271
81792
|
|
|
81272
81793
|
// node_modules/@puppeteer/browsers/lib/esm/install.js
|
|
81273
81794
|
import assert2 from "node:assert";
|
|
81274
|
-
import { spawnSync as
|
|
81275
|
-
import { existsSync as
|
|
81795
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
81796
|
+
import { existsSync as existsSync30, readFileSync as readFileSync24 } from "node:fs";
|
|
81276
81797
|
import { mkdir as mkdir2, unlink } from "node:fs/promises";
|
|
81277
81798
|
import os5 from "node:os";
|
|
81278
81799
|
import path8 from "node:path";
|
|
@@ -81325,7 +81846,7 @@ async function installWithProviders(options) {
|
|
|
81325
81846
|
continue;
|
|
81326
81847
|
}
|
|
81327
81848
|
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
|
81328
|
-
if (!
|
|
81849
|
+
if (!existsSync30(browserRoot)) {
|
|
81329
81850
|
await mkdir2(browserRoot, { recursive: true });
|
|
81330
81851
|
}
|
|
81331
81852
|
return await installUrl(url, options, provider);
|
|
@@ -81358,21 +81879,21 @@ async function installDeps(installedBrowser) {
|
|
|
81358
81879
|
return;
|
|
81359
81880
|
}
|
|
81360
81881
|
const depsPath = path8.join(path8.dirname(installedBrowser.executablePath), "deb.deps");
|
|
81361
|
-
if (!
|
|
81882
|
+
if (!existsSync30(depsPath)) {
|
|
81362
81883
|
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
|
81363
81884
|
return;
|
|
81364
81885
|
}
|
|
81365
|
-
const data =
|
|
81886
|
+
const data = readFileSync24(depsPath, "utf-8").split(`
|
|
81366
81887
|
`).join(",");
|
|
81367
81888
|
if (process.getuid?.() !== 0) {
|
|
81368
81889
|
throw new Error("Installing system dependencies requires root privileges");
|
|
81369
81890
|
}
|
|
81370
|
-
let result =
|
|
81891
|
+
let result = spawnSync4("apt-get", ["-v"]);
|
|
81371
81892
|
if (result.status !== 0) {
|
|
81372
81893
|
throw new Error("Failed to install system dependencies: apt-get does not seem to be available");
|
|
81373
81894
|
}
|
|
81374
81895
|
debugInstall(`Trying to install dependencies: ${data}`);
|
|
81375
|
-
result =
|
|
81896
|
+
result = spawnSync4("apt-get", [
|
|
81376
81897
|
"satisfy",
|
|
81377
81898
|
"-y",
|
|
81378
81899
|
data,
|
|
@@ -81400,11 +81921,11 @@ async function installUrl(url, options, provider) {
|
|
|
81400
81921
|
const cache = new Cache(options.cacheDir);
|
|
81401
81922
|
const browserRoot = cache.browserRoot(options.browser);
|
|
81402
81923
|
const archivePath = path8.join(browserRoot, `${options.buildId}-${fileName}`);
|
|
81403
|
-
if (!
|
|
81924
|
+
if (!existsSync30(browserRoot)) {
|
|
81404
81925
|
await mkdir2(browserRoot, { recursive: true });
|
|
81405
81926
|
}
|
|
81406
81927
|
if (!options.unpack) {
|
|
81407
|
-
if (
|
|
81928
|
+
if (existsSync30(archivePath)) {
|
|
81408
81929
|
return archivePath;
|
|
81409
81930
|
}
|
|
81410
81931
|
debugInstall(`Downloading binary from ${url}`);
|
|
@@ -81425,8 +81946,8 @@ async function installUrl(url, options, provider) {
|
|
|
81425
81946
|
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath6);
|
|
81426
81947
|
}
|
|
81427
81948
|
try {
|
|
81428
|
-
if (
|
|
81429
|
-
if (!
|
|
81949
|
+
if (existsSync30(outputPath)) {
|
|
81950
|
+
if (!existsSync30(installedBrowser.executablePath)) {
|
|
81430
81951
|
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
|
81431
81952
|
}
|
|
81432
81953
|
await runSetup(installedBrowser);
|
|
@@ -81435,7 +81956,7 @@ async function installUrl(url, options, provider) {
|
|
|
81435
81956
|
}
|
|
81436
81957
|
return installedBrowser;
|
|
81437
81958
|
}
|
|
81438
|
-
if (!
|
|
81959
|
+
if (!existsSync30(archivePath)) {
|
|
81439
81960
|
debugInstall(`Downloading binary from ${url}`);
|
|
81440
81961
|
try {
|
|
81441
81962
|
debugTime("download");
|
|
@@ -81464,7 +81985,7 @@ async function installUrl(url, options, provider) {
|
|
|
81464
81985
|
}
|
|
81465
81986
|
return installedBrowser;
|
|
81466
81987
|
} finally {
|
|
81467
|
-
if (
|
|
81988
|
+
if (existsSync30(archivePath)) {
|
|
81468
81989
|
await unlink(archivePath);
|
|
81469
81990
|
}
|
|
81470
81991
|
}
|
|
@@ -81475,10 +81996,10 @@ async function runSetup(installedBrowser) {
|
|
|
81475
81996
|
debugTime("permissions");
|
|
81476
81997
|
const browserDir = path8.dirname(installedBrowser.executablePath);
|
|
81477
81998
|
const setupExePath = path8.join(browserDir, "setup.exe");
|
|
81478
|
-
if (!
|
|
81999
|
+
if (!existsSync30(setupExePath)) {
|
|
81479
82000
|
return;
|
|
81480
82001
|
}
|
|
81481
|
-
|
|
82002
|
+
spawnSync4(path8.join(browserDir, "setup.exe"), [`--configure-browser-in-directory=` + browserDir], {
|
|
81482
82003
|
shell: true
|
|
81483
82004
|
});
|
|
81484
82005
|
} finally {
|
|
@@ -81856,19 +82377,19 @@ var init_cliui = __esm(() => {
|
|
|
81856
82377
|
});
|
|
81857
82378
|
|
|
81858
82379
|
// node_modules/escalade/sync/index.mjs
|
|
81859
|
-
import { dirname as
|
|
82380
|
+
import { dirname as dirname13, resolve as resolve10 } from "path";
|
|
81860
82381
|
import { readdirSync as readdirSync10, statSync as statSync12 } from "fs";
|
|
81861
82382
|
function sync_default(start, callback) {
|
|
81862
|
-
let dir =
|
|
82383
|
+
let dir = resolve10(".", start);
|
|
81863
82384
|
let tmp, stats = statSync12(dir);
|
|
81864
82385
|
if (!stats.isDirectory()) {
|
|
81865
|
-
dir =
|
|
82386
|
+
dir = dirname13(dir);
|
|
81866
82387
|
}
|
|
81867
82388
|
while (true) {
|
|
81868
82389
|
tmp = callback(dir, readdirSync10(dir));
|
|
81869
82390
|
if (tmp)
|
|
81870
|
-
return
|
|
81871
|
-
dir =
|
|
82391
|
+
return resolve10(dir, tmp);
|
|
82392
|
+
dir = dirname13(tmp = dir);
|
|
81872
82393
|
if (tmp === dir)
|
|
81873
82394
|
break;
|
|
81874
82395
|
}
|
|
@@ -82814,7 +83335,7 @@ var init_yargs_parser = __esm(() => {
|
|
|
82814
83335
|
|
|
82815
83336
|
// node_modules/yargs-parser/build/lib/index.js
|
|
82816
83337
|
import { format } from "util";
|
|
82817
|
-
import { normalize as normalize2, resolve as
|
|
83338
|
+
import { normalize as normalize2, resolve as resolve11 } from "path";
|
|
82818
83339
|
var _a3, _b, _c, minNodeVersion, nodeVersion, env, parser, yargsParser = function Parser(args, opts) {
|
|
82819
83340
|
const result = parser.parse(args.slice(), opts);
|
|
82820
83341
|
return result.argv;
|
|
@@ -82837,12 +83358,11 @@ var init_lib2 = __esm(() => {
|
|
|
82837
83358
|
},
|
|
82838
83359
|
format,
|
|
82839
83360
|
normalize: normalize2,
|
|
82840
|
-
resolve:
|
|
83361
|
+
resolve: resolve11,
|
|
82841
83362
|
require: (path9) => {
|
|
82842
83363
|
if (true) {
|
|
82843
83364
|
return __require(path9);
|
|
82844
|
-
}
|
|
82845
|
-
;
|
|
83365
|
+
}
|
|
82846
83366
|
}
|
|
82847
83367
|
});
|
|
82848
83368
|
yargsParser.detailed = function(args, opts) {
|
|
@@ -82888,18 +83408,18 @@ var init_yerror = __esm(() => {
|
|
|
82888
83408
|
});
|
|
82889
83409
|
|
|
82890
83410
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
82891
|
-
import { readFileSync as
|
|
83411
|
+
import { readFileSync as readFileSync25, statSync as statSync13, writeFile } from "fs";
|
|
82892
83412
|
import { format as format2 } from "util";
|
|
82893
|
-
import { resolve as
|
|
83413
|
+
import { resolve as resolve12 } from "path";
|
|
82894
83414
|
var node_default;
|
|
82895
83415
|
var init_node = __esm(() => {
|
|
82896
83416
|
node_default = {
|
|
82897
83417
|
fs: {
|
|
82898
|
-
readFileSync:
|
|
83418
|
+
readFileSync: readFileSync25,
|
|
82899
83419
|
writeFile
|
|
82900
83420
|
},
|
|
82901
83421
|
format: format2,
|
|
82902
|
-
resolve:
|
|
83422
|
+
resolve: resolve12,
|
|
82903
83423
|
exists: (file) => {
|
|
82904
83424
|
try {
|
|
82905
83425
|
return statSync13(file).isFile();
|
|
@@ -83080,9 +83600,9 @@ var init_y18n = __esm(() => {
|
|
|
83080
83600
|
// node_modules/yargs/lib/platform-shims/esm.mjs
|
|
83081
83601
|
import { notStrictEqual, strictEqual } from "assert";
|
|
83082
83602
|
import { inspect } from "util";
|
|
83083
|
-
import { readFileSync as
|
|
83603
|
+
import { readFileSync as readFileSync26 } from "fs";
|
|
83084
83604
|
import { fileURLToPath } from "url";
|
|
83085
|
-
import { basename as basename9, dirname as
|
|
83605
|
+
import { basename as basename9, dirname as dirname14, extname as extname3, relative as relative9, resolve as resolve13 } from "path";
|
|
83086
83606
|
var REQUIRE_ERROR = "require is not supported by ESM", REQUIRE_DIRECTORY_ERROR = "loading a directory of commands is not supported yet for ESM", __dirname2, mainFilename, esm_default;
|
|
83087
83607
|
var init_esm = __esm(() => {
|
|
83088
83608
|
init_cliui();
|
|
@@ -83115,10 +83635,10 @@ var init_esm = __esm(() => {
|
|
|
83115
83635
|
Parser: lib_default,
|
|
83116
83636
|
path: {
|
|
83117
83637
|
basename: basename9,
|
|
83118
|
-
dirname:
|
|
83638
|
+
dirname: dirname14,
|
|
83119
83639
|
extname: extname3,
|
|
83120
|
-
relative:
|
|
83121
|
-
resolve:
|
|
83640
|
+
relative: relative9,
|
|
83641
|
+
resolve: resolve13
|
|
83122
83642
|
},
|
|
83123
83643
|
process: {
|
|
83124
83644
|
argv: () => process.argv,
|
|
@@ -83129,7 +83649,7 @@ var init_esm = __esm(() => {
|
|
|
83129
83649
|
nextTick: process.nextTick,
|
|
83130
83650
|
stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
|
|
83131
83651
|
},
|
|
83132
|
-
readFileSync:
|
|
83652
|
+
readFileSync: readFileSync26,
|
|
83133
83653
|
require: () => {
|
|
83134
83654
|
throw new YError(REQUIRE_ERROR);
|
|
83135
83655
|
},
|
|
@@ -83140,7 +83660,7 @@ var init_esm = __esm(() => {
|
|
|
83140
83660
|
return [...str].length;
|
|
83141
83661
|
},
|
|
83142
83662
|
y18n: y18n_default({
|
|
83143
|
-
directory:
|
|
83663
|
+
directory: resolve13(__dirname2, "../../../locales"),
|
|
83144
83664
|
updateFiles: false
|
|
83145
83665
|
})
|
|
83146
83666
|
};
|
|
@@ -83197,7 +83717,7 @@ function parseCommand(cmd) {
|
|
|
83197
83717
|
|
|
83198
83718
|
// node_modules/yargs/build/lib/argsert.js
|
|
83199
83719
|
function argsert(arg1, arg2, arg3) {
|
|
83200
|
-
function
|
|
83720
|
+
function parseArgs3() {
|
|
83201
83721
|
return typeof arg1 === "object" ? [{ demanded: [], optional: [] }, arg1, arg2] : [
|
|
83202
83722
|
parseCommand(`cmd ${arg1}`),
|
|
83203
83723
|
arg2,
|
|
@@ -83206,7 +83726,7 @@ function argsert(arg1, arg2, arg3) {
|
|
|
83206
83726
|
}
|
|
83207
83727
|
try {
|
|
83208
83728
|
let position = 0;
|
|
83209
|
-
const [parsed, callerArguments, _length] =
|
|
83729
|
+
const [parsed, callerArguments, _length] = parseArgs3();
|
|
83210
83730
|
const args = [].slice.call(callerArguments);
|
|
83211
83731
|
while (args.length && args[args.length - 1] === undefined)
|
|
83212
83732
|
args.pop();
|
|
@@ -85388,12 +85908,12 @@ var init_yargs_factory = __esm(() => {
|
|
|
85388
85908
|
async getCompletion(args, done) {
|
|
85389
85909
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
85390
85910
|
if (!done) {
|
|
85391
|
-
return new Promise((
|
|
85911
|
+
return new Promise((resolve14, reject) => {
|
|
85392
85912
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
85393
85913
|
if (err)
|
|
85394
85914
|
reject(err);
|
|
85395
85915
|
else
|
|
85396
|
-
|
|
85916
|
+
resolve14(completions);
|
|
85397
85917
|
});
|
|
85398
85918
|
});
|
|
85399
85919
|
} else {
|
|
@@ -86828,9 +87348,9 @@ async function getConnectionTransport(options) {
|
|
|
86828
87348
|
throw new Error("Could not detect required browser platform");
|
|
86829
87349
|
}
|
|
86830
87350
|
const { convertPuppeteerChannelToBrowsersChannel: convertPuppeteerChannelToBrowsersChannel2 } = await Promise.resolve().then(() => (init_LaunchOptions(), exports_LaunchOptions));
|
|
86831
|
-
const { join:
|
|
87351
|
+
const { join: join31 } = await import("node:path");
|
|
86832
87352
|
const userDataDir = resolveDefaultUserDataDir3(Browser7.CHROME, platform2, convertPuppeteerChannelToBrowsersChannel2(options.channel));
|
|
86833
|
-
const portPath =
|
|
87353
|
+
const portPath = join31(userDataDir, "DevToolsActivePort");
|
|
86834
87354
|
try {
|
|
86835
87355
|
const fileContent = await environment.value.fs.promises.readFile(portPath, "ascii");
|
|
86836
87356
|
const [rawPort, rawPath] = fileContent.split(`
|
|
@@ -87054,9 +87574,9 @@ var init_PipeTransport = __esm(() => {
|
|
|
87054
87574
|
});
|
|
87055
87575
|
|
|
87056
87576
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserLauncher.js
|
|
87057
|
-
import { existsSync as
|
|
87577
|
+
import { existsSync as existsSync31 } from "node:fs";
|
|
87058
87578
|
import { tmpdir } from "node:os";
|
|
87059
|
-
import { join as
|
|
87579
|
+
import { join as join31 } from "node:path";
|
|
87060
87580
|
|
|
87061
87581
|
class BrowserLauncher {
|
|
87062
87582
|
#browser;
|
|
@@ -87081,7 +87601,7 @@ class BrowserLauncher {
|
|
|
87081
87601
|
...options,
|
|
87082
87602
|
protocol
|
|
87083
87603
|
});
|
|
87084
|
-
if (!
|
|
87604
|
+
if (!existsSync31(launchArgs.executablePath)) {
|
|
87085
87605
|
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
87086
87606
|
}
|
|
87087
87607
|
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
@@ -87156,7 +87676,7 @@ class BrowserLauncher {
|
|
|
87156
87676
|
browserCloseCallback();
|
|
87157
87677
|
const logs = browserProcess.getRecentLogs().join(`
|
|
87158
87678
|
`);
|
|
87159
|
-
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" &&
|
|
87679
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || process.platform === "win32" && existsSync31(join31(launchArgs.userDataDir, "lockfile"))) {
|
|
87160
87680
|
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
87161
87681
|
}
|
|
87162
87682
|
if (logs.includes("Missing X server") && options.headless === false) {
|
|
@@ -87246,12 +87766,12 @@ class BrowserLauncher {
|
|
|
87246
87766
|
});
|
|
87247
87767
|
}
|
|
87248
87768
|
getProfilePath() {
|
|
87249
|
-
return
|
|
87769
|
+
return join31(this.puppeteer.configuration.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
87250
87770
|
}
|
|
87251
87771
|
resolveExecutablePath(headless, validatePath = true) {
|
|
87252
87772
|
let executablePath = this.puppeteer.configuration.executablePath;
|
|
87253
87773
|
if (executablePath) {
|
|
87254
|
-
if (validatePath && !
|
|
87774
|
+
if (validatePath && !existsSync31(executablePath)) {
|
|
87255
87775
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}), but no executable was found.`);
|
|
87256
87776
|
}
|
|
87257
87777
|
return executablePath;
|
|
@@ -87274,7 +87794,7 @@ class BrowserLauncher {
|
|
|
87274
87794
|
browser: browserType,
|
|
87275
87795
|
buildId: this.puppeteer.browserVersion
|
|
87276
87796
|
});
|
|
87277
|
-
if (validatePath && !
|
|
87797
|
+
if (validatePath && !existsSync31(executablePath)) {
|
|
87278
87798
|
const configVersion = this.puppeteer.configuration?.[this.browser]?.version;
|
|
87279
87799
|
if (configVersion) {
|
|
87280
87800
|
throw new Error(`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`);
|
|
@@ -87809,10 +88329,10 @@ var init_PuppeteerNode = __esm(() => {
|
|
|
87809
88329
|
});
|
|
87810
88330
|
|
|
87811
88331
|
// node_modules/puppeteer-core/lib/esm/puppeteer/node/ScreenRecorder.js
|
|
87812
|
-
import { spawn as spawn2, spawnSync as
|
|
88332
|
+
import { spawn as spawn2, spawnSync as spawnSync5 } from "node:child_process";
|
|
87813
88333
|
import fs5 from "node:fs";
|
|
87814
88334
|
import os8 from "node:os";
|
|
87815
|
-
import { dirname as
|
|
88335
|
+
import { dirname as dirname15 } from "node:path";
|
|
87816
88336
|
import { PassThrough } from "node:stream";
|
|
87817
88337
|
var import_debug6, __runInitializers22 = function(thisArg, initializers, value) {
|
|
87818
88338
|
var useValue = arguments.length > 2;
|
|
@@ -87886,8 +88406,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
87886
88406
|
static {
|
|
87887
88407
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : undefined;
|
|
87888
88408
|
__esDecorate22(this, _private_writeFrame_descriptor = { value: __setFunctionName5(async function(buffer) {
|
|
87889
|
-
const error = await new Promise((
|
|
87890
|
-
this.#process.stdin.write(buffer,
|
|
88409
|
+
const error = await new Promise((resolve14) => {
|
|
88410
|
+
this.#process.stdin.write(buffer, resolve14);
|
|
87891
88411
|
});
|
|
87892
88412
|
if (error) {
|
|
87893
88413
|
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
@@ -87913,7 +88433,7 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
87913
88433
|
colors ??= 256;
|
|
87914
88434
|
overwrite ??= true;
|
|
87915
88435
|
this.#fps = fps;
|
|
87916
|
-
const { error } =
|
|
88436
|
+
const { error } = spawnSync5(ffmpegPath);
|
|
87917
88437
|
if (error) {
|
|
87918
88438
|
throw error;
|
|
87919
88439
|
}
|
|
@@ -87936,7 +88456,7 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
87936
88456
|
filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
|
|
87937
88457
|
}
|
|
87938
88458
|
if (path11) {
|
|
87939
|
-
fs5.mkdirSync(
|
|
88459
|
+
fs5.mkdirSync(dirname15(path11), { recursive: overwrite });
|
|
87940
88460
|
}
|
|
87941
88461
|
this.#process = spawn2(ffmpegPath, [
|
|
87942
88462
|
["-loglevel", "error"],
|
|
@@ -88042,8 +88562,8 @@ var init_ScreenRecorder = __esm(() => {
|
|
|
88042
88562
|
const [buffer, timestamp] = await this.#lastFrame;
|
|
88043
88563
|
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1000))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
88044
88564
|
this.#process.stdin.end();
|
|
88045
|
-
await new Promise((
|
|
88046
|
-
this.#process.once("close",
|
|
88565
|
+
await new Promise((resolve14) => {
|
|
88566
|
+
this.#process.once("close", resolve14);
|
|
88047
88567
|
});
|
|
88048
88568
|
}
|
|
88049
88569
|
async[(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
@@ -88089,17 +88609,17 @@ var init_puppeteer_core = __esm(() => {
|
|
|
88089
88609
|
});
|
|
88090
88610
|
|
|
88091
88611
|
// src/core/design-eval/capture.ts
|
|
88092
|
-
import { mkdirSync as mkdirSync14, statSync as statSync14, existsSync as
|
|
88093
|
-
import { join as
|
|
88612
|
+
import { mkdirSync as mkdirSync14, statSync as statSync14, existsSync as existsSync32 } from "fs";
|
|
88613
|
+
import { join as join32 } from "path";
|
|
88094
88614
|
function findBrowser() {
|
|
88095
88615
|
const platform2 = process.platform;
|
|
88096
88616
|
const paths = CHROME_PATHS[platform2] ?? [];
|
|
88097
88617
|
for (const p of paths) {
|
|
88098
|
-
if (
|
|
88618
|
+
if (existsSync32(p))
|
|
88099
88619
|
return p;
|
|
88100
88620
|
}
|
|
88101
|
-
const minkBrowsers =
|
|
88102
|
-
if (
|
|
88621
|
+
const minkBrowsers = join32(minkRoot(), "browsers");
|
|
88622
|
+
if (existsSync32(minkBrowsers)) {
|
|
88103
88623
|
const found = findChromeInDir(minkBrowsers);
|
|
88104
88624
|
if (found)
|
|
88105
88625
|
return found;
|
|
@@ -88120,7 +88640,7 @@ function findChromeInDir(dir) {
|
|
|
88120
88640
|
try {
|
|
88121
88641
|
const entries = readdirSync11(dir);
|
|
88122
88642
|
for (const entry of entries) {
|
|
88123
|
-
const full =
|
|
88643
|
+
const full = join32(dir, entry);
|
|
88124
88644
|
try {
|
|
88125
88645
|
const stat2 = statSync15(full);
|
|
88126
88646
|
if (stat2.isDirectory()) {
|
|
@@ -88168,7 +88688,7 @@ async function captureRoute(page, route, baseUrl, viewport, options) {
|
|
|
88168
88688
|
const y = section * viewport.height;
|
|
88169
88689
|
const clipHeight = Math.min(viewport.height, pageHeight - y);
|
|
88170
88690
|
const fileName = `${prefix}-${viewport.name}-${section}.jpg`;
|
|
88171
|
-
const filePath =
|
|
88691
|
+
const filePath = join32(options.outputDir, fileName);
|
|
88172
88692
|
await page.screenshot({
|
|
88173
88693
|
path: filePath,
|
|
88174
88694
|
type: "jpeg",
|
|
@@ -89632,8 +90152,8 @@ var exports_wiki = {};
|
|
|
89632
90152
|
__export(exports_wiki, {
|
|
89633
90153
|
wiki: () => wiki
|
|
89634
90154
|
});
|
|
89635
|
-
import { existsSync as
|
|
89636
|
-
import { resolve as
|
|
90155
|
+
import { existsSync as existsSync33, statSync as statSync15 } from "fs";
|
|
90156
|
+
import { resolve as resolve14 } from "path";
|
|
89637
90157
|
import { homedir as homedir5 } from "os";
|
|
89638
90158
|
async function wiki(_cwd, args) {
|
|
89639
90159
|
const sub = args[0];
|
|
@@ -89645,6 +90165,7 @@ async function wiki(_cwd, args) {
|
|
|
89645
90165
|
wikiStatus();
|
|
89646
90166
|
break;
|
|
89647
90167
|
case "rebuild-index":
|
|
90168
|
+
case "scan":
|
|
89648
90169
|
wikiRebuildIndex();
|
|
89649
90170
|
break;
|
|
89650
90171
|
case "organize":
|
|
@@ -89664,7 +90185,8 @@ async function wiki(_cwd, args) {
|
|
|
89664
90185
|
console.log();
|
|
89665
90186
|
console.log(" init Initialize the notes/wiki vault");
|
|
89666
90187
|
console.log(" status Show vault statistics");
|
|
89667
|
-
console.log(" rebuild-index Full rescan and reindex of vault");
|
|
90188
|
+
console.log(" rebuild-index Full rescan and reindex of vault (alias: scan)");
|
|
90189
|
+
console.log(" scan Alias for rebuild-index");
|
|
89668
90190
|
console.log(" organize List inbox notes needing categorization");
|
|
89669
90191
|
console.log(" link <path> [name] Symlink external notes into the vault");
|
|
89670
90192
|
console.log(" unlink <name> Remove a symlinked directory from the vault");
|
|
@@ -89688,7 +90210,7 @@ async function wikiInit(args) {
|
|
|
89688
90210
|
console.log(`[mink] initializing vault at ${targetPath}`);
|
|
89689
90211
|
console.log(" (set a custom path with: mink wiki init /path/to/vault)");
|
|
89690
90212
|
}
|
|
89691
|
-
const isExisting =
|
|
90213
|
+
const isExisting = existsSync33(targetPath) && statSync15(targetPath).isDirectory();
|
|
89692
90214
|
setConfigValue("wiki.path", targetPath);
|
|
89693
90215
|
ensureVaultStructure();
|
|
89694
90216
|
seedTemplates(vaultTemplates());
|
|
@@ -89753,6 +90275,11 @@ function wikiStatus() {
|
|
|
89753
90275
|
return;
|
|
89754
90276
|
}
|
|
89755
90277
|
const vaultPath = resolveVaultPath();
|
|
90278
|
+
const staleness = vaultIndexStaleness();
|
|
90279
|
+
if (staleness.isStale) {
|
|
90280
|
+
console.log(`[mink] vault index is stale (${staleness.reason}) — rebuilding...`);
|
|
90281
|
+
rebuildVaultIndex();
|
|
90282
|
+
}
|
|
89756
90283
|
const index = loadVaultIndex();
|
|
89757
90284
|
const categoryCounts = {
|
|
89758
90285
|
inbox: 0,
|
|
@@ -89775,7 +90302,8 @@ function wikiStatus() {
|
|
|
89775
90302
|
console.log(` ${cat.padEnd(12)} ${count}`);
|
|
89776
90303
|
}
|
|
89777
90304
|
console.log();
|
|
89778
|
-
console.log(` last
|
|
90305
|
+
console.log(` last full scan: ${index.lastFullScanTimestamp || "never"}`);
|
|
90306
|
+
console.log(` last update: ${index.lastScanTimestamp || "never"}`);
|
|
89779
90307
|
const links = listLinks();
|
|
89780
90308
|
if (links.length > 0) {
|
|
89781
90309
|
console.log();
|
|
@@ -89892,9 +90420,9 @@ function wikiLinks() {
|
|
|
89892
90420
|
}
|
|
89893
90421
|
function expandPath(raw) {
|
|
89894
90422
|
if (raw.startsWith("~/")) {
|
|
89895
|
-
return
|
|
90423
|
+
return resolve14(homedir5(), raw.slice(2));
|
|
89896
90424
|
}
|
|
89897
|
-
return
|
|
90425
|
+
return resolve14(raw);
|
|
89898
90426
|
}
|
|
89899
90427
|
var init_wiki = __esm(() => {
|
|
89900
90428
|
init_vault();
|
|
@@ -89910,8 +90438,8 @@ var exports_note = {};
|
|
|
89910
90438
|
__export(exports_note, {
|
|
89911
90439
|
note: () => note
|
|
89912
90440
|
});
|
|
89913
|
-
import { resolve as
|
|
89914
|
-
import { existsSync as
|
|
90441
|
+
import { resolve as resolve15 } from "path";
|
|
90442
|
+
import { existsSync as existsSync34, readFileSync as readFileSync27 } from "fs";
|
|
89915
90443
|
async function note(cwd, args) {
|
|
89916
90444
|
if (!isWikiEnabled()) {
|
|
89917
90445
|
console.error("[mink] wiki feature is disabled");
|
|
@@ -89936,13 +90464,13 @@ async function note(cwd, args) {
|
|
|
89936
90464
|
const date = new Date().toISOString().split("T")[0];
|
|
89937
90465
|
const content = parsed.positional || parsed.body || "";
|
|
89938
90466
|
const filePath = appendToDaily(date, content);
|
|
89939
|
-
updateVaultIndexForFile(filePath,
|
|
90467
|
+
updateVaultIndexForFile(filePath, readFileSync27(filePath, "utf-8"));
|
|
89940
90468
|
console.log(`[mink] daily note: ${filePath}`);
|
|
89941
90469
|
return;
|
|
89942
90470
|
}
|
|
89943
90471
|
if (parsed.file) {
|
|
89944
|
-
const sourcePath =
|
|
89945
|
-
if (!
|
|
90472
|
+
const sourcePath = resolve15(cwd, parsed.file);
|
|
90473
|
+
if (!existsSync34(sourcePath)) {
|
|
89946
90474
|
console.error(`[mink] file not found: ${sourcePath}`);
|
|
89947
90475
|
process.exit(1);
|
|
89948
90476
|
}
|
|
@@ -90103,10 +90631,10 @@ var exports_skill = {};
|
|
|
90103
90631
|
__export(exports_skill, {
|
|
90104
90632
|
skill: () => skill
|
|
90105
90633
|
});
|
|
90106
|
-
import { join as
|
|
90634
|
+
import { join as join33, resolve as resolve16, dirname as dirname16 } from "path";
|
|
90107
90635
|
import { homedir as homedir6 } from "os";
|
|
90108
90636
|
import {
|
|
90109
|
-
existsSync as
|
|
90637
|
+
existsSync as existsSync35,
|
|
90110
90638
|
mkdirSync as mkdirSync15,
|
|
90111
90639
|
copyFileSync,
|
|
90112
90640
|
unlinkSync as unlinkSync6,
|
|
@@ -90116,26 +90644,26 @@ import {
|
|
|
90116
90644
|
lstatSync as lstatSync2
|
|
90117
90645
|
} from "fs";
|
|
90118
90646
|
function getSkillsSourceDir() {
|
|
90119
|
-
let dir =
|
|
90647
|
+
let dir = dirname16(new URL(import.meta.url).pathname);
|
|
90120
90648
|
while (true) {
|
|
90121
|
-
if (
|
|
90122
|
-
return
|
|
90649
|
+
if (existsSync35(join33(dir, "package.json")) && existsSync35(join33(dir, "skills"))) {
|
|
90650
|
+
return join33(dir, "skills");
|
|
90123
90651
|
}
|
|
90124
|
-
const parent =
|
|
90652
|
+
const parent = dirname16(dir);
|
|
90125
90653
|
if (parent === dir)
|
|
90126
90654
|
break;
|
|
90127
90655
|
dir = parent;
|
|
90128
90656
|
}
|
|
90129
|
-
return
|
|
90657
|
+
return resolve16(dirname16(new URL(import.meta.url).pathname), "../../skills");
|
|
90130
90658
|
}
|
|
90131
90659
|
function getAvailableSkills() {
|
|
90132
90660
|
const dir = getSkillsSourceDir();
|
|
90133
|
-
if (!
|
|
90661
|
+
if (!existsSync35(dir))
|
|
90134
90662
|
return [];
|
|
90135
|
-
return readdirSync11(dir, { withFileTypes: true }).filter((d) => d.isDirectory() &&
|
|
90663
|
+
return readdirSync11(dir, { withFileTypes: true }).filter((d) => d.isDirectory() && existsSync35(join33(dir, d.name, "SKILL.md"))).map((d) => d.name);
|
|
90136
90664
|
}
|
|
90137
90665
|
function isInstalled(skillName) {
|
|
90138
|
-
return
|
|
90666
|
+
return existsSync35(join33(AGENTS_SKILLS_DIR, skillName, "SKILL.md"));
|
|
90139
90667
|
}
|
|
90140
90668
|
async function skill(args) {
|
|
90141
90669
|
const sub = args[0];
|
|
@@ -90171,26 +90699,26 @@ function skillInstall(name) {
|
|
|
90171
90699
|
}
|
|
90172
90700
|
mkdirSync15(AGENTS_SKILLS_DIR, { recursive: true });
|
|
90173
90701
|
for (const skillName of skills) {
|
|
90174
|
-
const srcDir =
|
|
90175
|
-
const srcFile =
|
|
90176
|
-
const destDir =
|
|
90177
|
-
if (!
|
|
90702
|
+
const srcDir = join33(sourceDir, skillName);
|
|
90703
|
+
const srcFile = join33(srcDir, "SKILL.md");
|
|
90704
|
+
const destDir = join33(AGENTS_SKILLS_DIR, skillName);
|
|
90705
|
+
if (!existsSync35(srcFile)) {
|
|
90178
90706
|
console.error(`[mink] skill not found: ${skillName}`);
|
|
90179
90707
|
continue;
|
|
90180
90708
|
}
|
|
90181
90709
|
mkdirSync15(destDir, { recursive: true });
|
|
90182
90710
|
copyDirRecursive(srcDir, destDir);
|
|
90183
90711
|
mkdirSync15(CLAUDE_SKILLS_DIR, { recursive: true });
|
|
90184
|
-
const symlink =
|
|
90712
|
+
const symlink = join33(CLAUDE_SKILLS_DIR, skillName);
|
|
90185
90713
|
try {
|
|
90186
|
-
if (
|
|
90714
|
+
if (existsSync35(symlink)) {
|
|
90187
90715
|
if (lstatSync2(symlink).isSymbolicLink() || lstatSync2(symlink).isFile()) {
|
|
90188
90716
|
unlinkSync6(symlink);
|
|
90189
90717
|
} else {
|
|
90190
90718
|
rmSync(symlink, { recursive: true, force: true });
|
|
90191
90719
|
}
|
|
90192
90720
|
}
|
|
90193
|
-
const relativeTarget =
|
|
90721
|
+
const relativeTarget = join33("..", "..", ".agents", "skills", skillName);
|
|
90194
90722
|
symlinkSync2(relativeTarget, symlink);
|
|
90195
90723
|
} catch {}
|
|
90196
90724
|
console.log(`[mink] installed: ${skillName} -> ${destDir}`);
|
|
@@ -90201,15 +90729,15 @@ function skillInstall(name) {
|
|
|
90201
90729
|
function skillUninstall(name) {
|
|
90202
90730
|
const skills = name ? [name] : getAvailableSkills();
|
|
90203
90731
|
for (const skillName of skills) {
|
|
90204
|
-
const destDir =
|
|
90205
|
-
if (!
|
|
90732
|
+
const destDir = join33(AGENTS_SKILLS_DIR, skillName);
|
|
90733
|
+
if (!existsSync35(destDir)) {
|
|
90206
90734
|
console.log(`[mink] not installed: ${skillName}`);
|
|
90207
90735
|
continue;
|
|
90208
90736
|
}
|
|
90209
90737
|
rmSync(destDir, { recursive: true, force: true });
|
|
90210
|
-
const symlink =
|
|
90738
|
+
const symlink = join33(CLAUDE_SKILLS_DIR, skillName);
|
|
90211
90739
|
try {
|
|
90212
|
-
if (
|
|
90740
|
+
if (existsSync35(symlink))
|
|
90213
90741
|
unlinkSync6(symlink);
|
|
90214
90742
|
} catch {}
|
|
90215
90743
|
console.log(`[mink] uninstalled: ${skillName}`);
|
|
@@ -90224,7 +90752,7 @@ function skillList() {
|
|
|
90224
90752
|
if (installed.length > 0) {
|
|
90225
90753
|
console.log(" Installed:");
|
|
90226
90754
|
for (const s of installed) {
|
|
90227
|
-
console.log(` ${s} (${
|
|
90755
|
+
console.log(` ${s} (${join33(AGENTS_SKILLS_DIR, s)})`);
|
|
90228
90756
|
}
|
|
90229
90757
|
}
|
|
90230
90758
|
if (notInstalled.length > 0) {
|
|
@@ -90243,8 +90771,8 @@ function skillList() {
|
|
|
90243
90771
|
function copyDirRecursive(src, dest) {
|
|
90244
90772
|
const entries = readdirSync11(src, { withFileTypes: true });
|
|
90245
90773
|
for (const entry of entries) {
|
|
90246
|
-
const srcPath =
|
|
90247
|
-
const destPath =
|
|
90774
|
+
const srcPath = join33(src, entry.name);
|
|
90775
|
+
const destPath = join33(dest, entry.name);
|
|
90248
90776
|
if (entry.isDirectory()) {
|
|
90249
90777
|
mkdirSync15(destPath, { recursive: true });
|
|
90250
90778
|
copyDirRecursive(srcPath, destPath);
|
|
@@ -90255,8 +90783,8 @@ function copyDirRecursive(src, dest) {
|
|
|
90255
90783
|
}
|
|
90256
90784
|
var AGENTS_SKILLS_DIR, CLAUDE_SKILLS_DIR;
|
|
90257
90785
|
var init_skill = __esm(() => {
|
|
90258
|
-
AGENTS_SKILLS_DIR =
|
|
90259
|
-
CLAUDE_SKILLS_DIR =
|
|
90786
|
+
AGENTS_SKILLS_DIR = join33(homedir6(), ".agents", "skills");
|
|
90787
|
+
CLAUDE_SKILLS_DIR = join33(homedir6(), ".claude", "skills");
|
|
90260
90788
|
});
|
|
90261
90789
|
|
|
90262
90790
|
// src/commands/agent.ts
|
|
@@ -90264,41 +90792,41 @@ var exports_agent = {};
|
|
|
90264
90792
|
__export(exports_agent, {
|
|
90265
90793
|
agent: () => agent
|
|
90266
90794
|
});
|
|
90267
|
-
import { join as
|
|
90795
|
+
import { join as join34, resolve as resolve17, dirname as dirname17 } from "path";
|
|
90268
90796
|
import { homedir as homedir7 } from "os";
|
|
90269
90797
|
import {
|
|
90270
|
-
existsSync as
|
|
90798
|
+
existsSync as existsSync36,
|
|
90271
90799
|
mkdirSync as mkdirSync16,
|
|
90272
|
-
readFileSync as
|
|
90800
|
+
readFileSync as readFileSync28,
|
|
90273
90801
|
writeFileSync as writeFileSync11
|
|
90274
90802
|
} from "fs";
|
|
90275
90803
|
import { createHash as createHash3 } from "crypto";
|
|
90276
|
-
import { spawnSync as
|
|
90804
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
90277
90805
|
function getAgentTemplatePath() {
|
|
90278
|
-
let dir =
|
|
90806
|
+
let dir = dirname17(new URL(import.meta.url).pathname);
|
|
90279
90807
|
while (true) {
|
|
90280
|
-
if (
|
|
90281
|
-
return
|
|
90808
|
+
if (existsSync36(join34(dir, "package.json")) && existsSync36(join34(dir, "agents", TEMPLATE_FILE))) {
|
|
90809
|
+
return join34(dir, "agents", TEMPLATE_FILE);
|
|
90282
90810
|
}
|
|
90283
|
-
const parent =
|
|
90811
|
+
const parent = dirname17(dir);
|
|
90284
90812
|
if (parent === dir)
|
|
90285
90813
|
break;
|
|
90286
90814
|
dir = parent;
|
|
90287
90815
|
}
|
|
90288
|
-
return
|
|
90816
|
+
return resolve17(dirname17(new URL(import.meta.url).pathname), "../../agents", TEMPLATE_FILE);
|
|
90289
90817
|
}
|
|
90290
90818
|
function getMinkVersion() {
|
|
90291
|
-
let dir =
|
|
90819
|
+
let dir = dirname17(new URL(import.meta.url).pathname);
|
|
90292
90820
|
while (true) {
|
|
90293
|
-
const pkgPath =
|
|
90294
|
-
if (
|
|
90821
|
+
const pkgPath = join34(dir, "package.json");
|
|
90822
|
+
if (existsSync36(pkgPath)) {
|
|
90295
90823
|
try {
|
|
90296
|
-
const pkg = JSON.parse(
|
|
90824
|
+
const pkg = JSON.parse(readFileSync28(pkgPath, "utf-8"));
|
|
90297
90825
|
if (pkg.name && pkg.version)
|
|
90298
90826
|
return pkg.version;
|
|
90299
90827
|
} catch {}
|
|
90300
90828
|
}
|
|
90301
|
-
const parent =
|
|
90829
|
+
const parent = dirname17(dir);
|
|
90302
90830
|
if (parent === dir)
|
|
90303
90831
|
break;
|
|
90304
90832
|
dir = parent;
|
|
@@ -90316,30 +90844,30 @@ function sha2562(text) {
|
|
|
90316
90844
|
return createHash3("sha256").update(text).digest("hex");
|
|
90317
90845
|
}
|
|
90318
90846
|
function claudeAgentsDir() {
|
|
90319
|
-
return
|
|
90847
|
+
return join34(homedir7(), ".claude", "agents");
|
|
90320
90848
|
}
|
|
90321
90849
|
function installedAgentPath() {
|
|
90322
|
-
return
|
|
90850
|
+
return join34(claudeAgentsDir(), INSTALLED_FILE);
|
|
90323
90851
|
}
|
|
90324
90852
|
function installAgentDefinition(opts) {
|
|
90325
90853
|
const templatePath = getAgentTemplatePath();
|
|
90326
|
-
if (!
|
|
90854
|
+
if (!existsSync36(templatePath)) {
|
|
90327
90855
|
throw new Error(`[mink agent] bundled agent template not found at ${templatePath}
|
|
90328
90856
|
` + " This usually means the package was installed without bundled assets.");
|
|
90329
90857
|
}
|
|
90330
90858
|
const installed = installedAgentPath();
|
|
90331
|
-
if (opts.skip &&
|
|
90859
|
+
if (opts.skip && existsSync36(installed)) {
|
|
90332
90860
|
return { action: "skipped", path: installed };
|
|
90333
90861
|
}
|
|
90334
|
-
const template =
|
|
90862
|
+
const template = readFileSync28(templatePath, "utf-8");
|
|
90335
90863
|
const rendered = renderTemplate(template, {
|
|
90336
90864
|
MINK_ROOT: minkRoot(),
|
|
90337
90865
|
VAULT_PATH: resolveVaultPath(),
|
|
90338
90866
|
MINK_VERSION: getMinkVersion()
|
|
90339
90867
|
});
|
|
90340
|
-
const exists =
|
|
90868
|
+
const exists = existsSync36(installed);
|
|
90341
90869
|
if (!opts.force && exists) {
|
|
90342
|
-
const current =
|
|
90870
|
+
const current = readFileSync28(installed, "utf-8");
|
|
90343
90871
|
if (sha2562(current) === sha2562(rendered)) {
|
|
90344
90872
|
return { action: "unchanged", path: installed };
|
|
90345
90873
|
}
|
|
@@ -90352,12 +90880,12 @@ function installAgentDefinition(opts) {
|
|
|
90352
90880
|
};
|
|
90353
90881
|
}
|
|
90354
90882
|
function isClaudeOnPath() {
|
|
90355
|
-
const result =
|
|
90883
|
+
const result = spawnSync6("claude", ["--version"], {
|
|
90356
90884
|
stdio: "ignore"
|
|
90357
90885
|
});
|
|
90358
90886
|
return !result.error && result.status === 0;
|
|
90359
90887
|
}
|
|
90360
|
-
function
|
|
90888
|
+
function parseArgs3(args) {
|
|
90361
90889
|
const out = {
|
|
90362
90890
|
noUpdate: false,
|
|
90363
90891
|
reinstall: false,
|
|
@@ -90390,7 +90918,7 @@ function parseArgs2(args) {
|
|
|
90390
90918
|
}
|
|
90391
90919
|
return out;
|
|
90392
90920
|
}
|
|
90393
|
-
function
|
|
90921
|
+
function printHelp2() {
|
|
90394
90922
|
console.log("Usage: mink agent [options] [-- <claude args...>]");
|
|
90395
90923
|
console.log();
|
|
90396
90924
|
console.log("Open an interactive Claude Code session in your mink home with");
|
|
@@ -90408,14 +90936,14 @@ function printHelp() {
|
|
|
90408
90936
|
console.log("`mink config wiki.path` triggers a refresh on the next launch.");
|
|
90409
90937
|
}
|
|
90410
90938
|
async function agent(_cwd, rawArgs) {
|
|
90411
|
-
const args =
|
|
90939
|
+
const args = parseArgs3(rawArgs);
|
|
90412
90940
|
if (args.showHelp) {
|
|
90413
|
-
|
|
90941
|
+
printHelp2();
|
|
90414
90942
|
return;
|
|
90415
90943
|
}
|
|
90416
90944
|
const skipUpdate = args.noUpdate || process.env.MINK_AGENT_NO_UPDATE === "1";
|
|
90417
90945
|
const root = minkRoot();
|
|
90418
|
-
if (!
|
|
90946
|
+
if (!existsSync36(root)) {
|
|
90419
90947
|
mkdirSync16(root, { recursive: true });
|
|
90420
90948
|
}
|
|
90421
90949
|
let result;
|
|
@@ -90446,7 +90974,7 @@ async function agent(_cwd, rawArgs) {
|
|
|
90446
90974
|
process.exit(1);
|
|
90447
90975
|
}
|
|
90448
90976
|
const claudeArgs = ["--agent", AGENT_NAME, ...args.passthrough];
|
|
90449
|
-
const child =
|
|
90977
|
+
const child = spawnSync6("claude", claudeArgs, {
|
|
90450
90978
|
cwd: root,
|
|
90451
90979
|
stdio: "inherit"
|
|
90452
90980
|
});
|
|
@@ -90467,25 +90995,25 @@ var init_agent = __esm(() => {
|
|
|
90467
90995
|
});
|
|
90468
90996
|
|
|
90469
90997
|
// src/core/sync-merge-drivers.ts
|
|
90470
|
-
import { readFileSync as
|
|
90471
|
-
import { join as
|
|
90998
|
+
import { readFileSync as readFileSync29, writeFileSync as writeFileSync12, appendFileSync as appendFileSync2 } from "fs";
|
|
90999
|
+
import { join as join35 } from "path";
|
|
90472
91000
|
function logWarning(driver, args, err) {
|
|
90473
91001
|
try {
|
|
90474
91002
|
const line = `[${new Date().toISOString()}] ${driver} fallback for ${args.filePath}: ${err instanceof Error ? err.message : String(err)}
|
|
90475
91003
|
`;
|
|
90476
|
-
appendFileSync2(
|
|
91004
|
+
appendFileSync2(join35(minkRoot(), "sync-warnings.log"), line);
|
|
90477
91005
|
} catch {}
|
|
90478
91006
|
}
|
|
90479
91007
|
function readJsonOrNull(path12) {
|
|
90480
91008
|
try {
|
|
90481
|
-
return JSON.parse(
|
|
91009
|
+
return JSON.parse(readFileSync29(path12, "utf-8"));
|
|
90482
91010
|
} catch {
|
|
90483
91011
|
return null;
|
|
90484
91012
|
}
|
|
90485
91013
|
}
|
|
90486
91014
|
function readTextOrEmpty(path12) {
|
|
90487
91015
|
try {
|
|
90488
|
-
return
|
|
91016
|
+
return readFileSync29(path12, "utf-8");
|
|
90489
91017
|
} catch {
|
|
90490
91018
|
return "";
|
|
90491
91019
|
}
|
|
@@ -91167,6 +91695,11 @@ switch (command2) {
|
|
|
91167
91695
|
await update2(cwd, process.argv.slice(3));
|
|
91168
91696
|
break;
|
|
91169
91697
|
}
|
|
91698
|
+
case "upgrade": {
|
|
91699
|
+
const { upgrade: upgrade2 } = await Promise.resolve().then(() => (init_upgrade(), exports_upgrade));
|
|
91700
|
+
await upgrade2(cwd, process.argv.slice(3));
|
|
91701
|
+
break;
|
|
91702
|
+
}
|
|
91170
91703
|
case "restore": {
|
|
91171
91704
|
const { restore: restore2 } = await Promise.resolve().then(() => (init_restore(), exports_restore));
|
|
91172
91705
|
restore2(cwd, process.argv.slice(3));
|
|
@@ -91231,11 +91764,11 @@ switch (command2) {
|
|
|
91231
91764
|
case "version":
|
|
91232
91765
|
case "--version":
|
|
91233
91766
|
case "-v": {
|
|
91234
|
-
const { resolve:
|
|
91235
|
-
const cliPath =
|
|
91236
|
-
const { readFileSync:
|
|
91767
|
+
const { resolve: resolve18, dirname: dirname18 } = await import("path");
|
|
91768
|
+
const cliPath = resolve18(dirname18(new URL(import.meta.url).pathname));
|
|
91769
|
+
const { readFileSync: readFileSync30 } = await import("fs");
|
|
91237
91770
|
try {
|
|
91238
|
-
const pkg = JSON.parse(
|
|
91771
|
+
const pkg = JSON.parse(readFileSync30(resolve18(cliPath, "../package.json"), "utf-8"));
|
|
91239
91772
|
console.log(`mink ${pkg.version}`);
|
|
91240
91773
|
} catch {
|
|
91241
91774
|
console.log("mink (unknown version)");
|
|
@@ -91257,7 +91790,7 @@ switch (command2) {
|
|
|
91257
91790
|
console.log(" config [key] [value] Manage global user settings");
|
|
91258
91791
|
console.log();
|
|
91259
91792
|
console.log("Notes & Wiki:");
|
|
91260
|
-
console.log(" wiki <cmd> Manage the notes/wiki vault (init|status|link|unlink|links|rebuild-index|organize)");
|
|
91793
|
+
console.log(" wiki <cmd> Manage the notes/wiki vault (init|status|link|unlink|links|rebuild-index|scan|organize)");
|
|
91261
91794
|
console.log(' note "text" Capture a note to the vault');
|
|
91262
91795
|
console.log(" note --daily [text] Create or append to today's daily note");
|
|
91263
91796
|
console.log(" note list [filters] List notes (--category, --tag, --recent)");
|
|
@@ -91288,7 +91821,8 @@ switch (command2) {
|
|
|
91288
91821
|
console.log(" dashboard [--port=N] Open the real-time web dashboard");
|
|
91289
91822
|
console.log(" daemon <cmd> Manage the background daemon (start|stop|restart|logs|install|uninstall)");
|
|
91290
91823
|
console.log(" cron <cmd> [id] Manage scheduled tasks (list|run|retry)");
|
|
91291
|
-
console.log(" update [options] Update Mink across registered projects");
|
|
91824
|
+
console.log(" update [options] Update Mink hooks across registered projects");
|
|
91825
|
+
console.log(" upgrade [options] Self-upgrade the mink CLI from npm (--check|--dry-run|--force)");
|
|
91292
91826
|
console.log(" restore [backup] Restore state from a backup");
|
|
91293
91827
|
console.log(" bug search <term> Search the bug log");
|
|
91294
91828
|
console.log(" detect-waste Detect and flag wasteful patterns");
|