@narumitw/pi-starship 0.49.2 → 0.49.3
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 +6 -4
- package/dist/chunks/chunk-CKNSOLSW.ts +10 -0
- package/dist/chunks/chunk-CKNSOLSW.ts.map +7 -0
- package/dist/chunks/chunk-G2GG2V6Q.ts +218 -0
- package/dist/chunks/chunk-G2GG2V6Q.ts.map +7 -0
- package/dist/chunks/chunk-Q6DLIM7H.ts +2492 -0
- package/dist/chunks/chunk-Q6DLIM7H.ts.map +7 -0
- package/dist/chunks/cloud-JBSZWTB6.ts +142 -0
- package/dist/chunks/cloud-JBSZWTB6.ts.map +7 -0
- package/dist/chunks/commands-BSQZ2R4M.ts +757 -0
- package/dist/chunks/commands-BSQZ2R4M.ts.map +7 -0
- package/dist/chunks/deployment-ZNYM4B6W.ts +172 -0
- package/dist/chunks/deployment-ZNYM4B6W.ts.map +7 -0
- package/dist/chunks/development-TNWZ5SRC.ts +132 -0
- package/dist/chunks/development-TNWZ5SRC.ts.map +7 -0
- package/dist/chunks/execution-QHAP4U33.ts +132 -0
- package/dist/chunks/execution-QHAP4U33.ts.map +7 -0
- package/dist/chunks/languages-DPWDCH6Q.ts +184 -0
- package/dist/chunks/languages-DPWDCH6Q.ts.map +7 -0
- package/dist/chunks/package-MXN2YFLX.ts +104 -0
- package/dist/chunks/package-MXN2YFLX.ts.map +7 -0
- package/dist/pi-starship.ts +1350 -0
- package/dist/pi-starship.ts.map +7 -0
- package/package.json +9 -5
- package/src/index.ts +1 -1
- package/src/command-contract.ts +0 -13
- package/src/command-inspector.ts +0 -198
- package/src/command-preview.ts +0 -206
- package/src/commands.ts +0 -575
- package/src/config.ts +0 -794
- package/src/format/formatter.ts +0 -275
- package/src/format/style.ts +0 -278
- package/src/modules/activity.ts +0 -38
- package/src/modules/brand.ts +0 -13
- package/src/modules/cache.ts +0 -23
- package/src/modules/catalog.ts +0 -124
- package/src/modules/cloud.ts +0 -74
- package/src/modules/context.ts +0 -33
- package/src/modules/cost.ts +0 -31
- package/src/modules/deployment.ts +0 -61
- package/src/modules/development.ts +0 -112
- package/src/modules/directory.ts +0 -151
- package/src/modules/display.ts +0 -14
- package/src/modules/execution.ts +0 -84
- package/src/modules/extension-status.ts +0 -93
- package/src/modules/fill.ts +0 -14
- package/src/modules/git/branch.ts +0 -31
- package/src/modules/git/commit.ts +0 -29
- package/src/modules/git/metrics.ts +0 -26
- package/src/modules/git/runtime.ts +0 -415
- package/src/modules/git/state.ts +0 -21
- package/src/modules/git/status.ts +0 -87
- package/src/modules/git/worktree.ts +0 -16
- package/src/modules/github-pr.ts +0 -24
- package/src/modules/helpers.ts +0 -5
- package/src/modules/index.ts +0 -31
- package/src/modules/inspection.ts +0 -138
- package/src/modules/languages.ts +0 -87
- package/src/modules/model.ts +0 -85
- package/src/modules/package.ts +0 -17
- package/src/modules/provider.ts +0 -13
- package/src/modules/render.ts +0 -166
- package/src/modules/terminal.ts +0 -60
- package/src/modules/thinking.ts +0 -13
- package/src/modules/time.ts +0 -20
- package/src/modules/tokens.ts +0 -18
- package/src/modules/truncation.ts +0 -37
- package/src/modules/turn.ts +0 -13
- package/src/modules/types.ts +0 -189
- package/src/modules/workspace-helpers.ts +0 -10
- package/src/pi-starship.ts +0 -609
- package/src/runtime/cloud.ts +0 -166
- package/src/runtime/command.ts +0 -123
- package/src/runtime/deployment.ts +0 -201
- package/src/runtime/development.ts +0 -153
- package/src/runtime/execution.ts +0 -151
- package/src/runtime/github-pr.ts +0 -332
- package/src/runtime/helpers.ts +0 -274
- package/src/runtime/languages.ts +0 -205
- package/src/runtime/package.ts +0 -112
- package/src/runtime/refresh-controller.ts +0 -107
- package/src/runtime/types.ts +0 -63
- package/src/runtime/workspace.ts +0 -147
- package/src/usage.ts +0 -53
package/README.md
CHANGED
|
@@ -26,10 +26,10 @@ A native Pi footer configured with Starship-style TOML. It parses and renders fo
|
|
|
26
26
|
pi install npm:@narumitw/pi-starship
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Try it from a checkout:
|
|
29
|
+
Try it from a checkout; the recipe prepares the generated runtime before loading it:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
|
|
32
|
+
just try starship
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Do not enable this together with `@narumitw/pi-statusline`: both own Pi's footer, and Pi does not arbitrate that conflict.
|
|
@@ -630,8 +630,10 @@ Keep `extension_status` last in the catalog so arbitrary third-party statuses fo
|
|
|
630
630
|
|
|
631
631
|
## 🗂️ Package layout
|
|
632
632
|
|
|
633
|
-
- `src/index.ts` — Pi package entrypoint.
|
|
634
|
-
- `
|
|
633
|
+
- `src/index.ts` — thin Pi package entrypoint forwarding to the generated runtime.
|
|
634
|
+
- `dist/` — generated split TypeScript runtime and source maps loaded through Pi's Jiti aliases.
|
|
635
|
+
- `scripts/build-runtime.mjs` — deterministic runtime bundler and eager-import boundary validator.
|
|
636
|
+
- `src/pi-starship.ts` — authoritative extension lifecycle, cached refresh binding, live preview, and footer.
|
|
635
637
|
- `src/usage.ts` — native-aligned session usage and cache aggregation.
|
|
636
638
|
- `src/command-contract.ts` — lightweight command routes and completions loaded at startup.
|
|
637
639
|
- `src/commands.ts` — lazily loaded menu, preview/confirmation flow, diagnostics, and compatibility routes.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
|
+
// @ts-nocheck -- generated JavaScript uses a .ts extension so Pi routes chunks through Jiti.
|
|
3
|
+
|
|
4
|
+
// src/runtime/types.ts
|
|
5
|
+
var PRIVATE_STYLE_SELECTOR = "__pi_style_selector";
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
PRIVATE_STYLE_SELECTOR
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=chunk-CKNSOLSW.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/runtime/types.ts"],
|
|
4
|
+
"sourcesContent": ["import type { StarshipConfig } from \"../config.js\";\nimport type { ModuleName } from \"../modules/catalog.js\";\nimport type { WorkspaceSnapshot } from \"../modules/types.js\";\n\nexport interface WorkspaceExecResult {\n\tstdout: string;\n\tstderr: string;\n\tcode: number;\n\tkilled: boolean;\n}\n\nexport type WorkspaceExec = (\n\tcommand: string,\n\targs: string[],\n\toptions: {\n\t\tcwd: string;\n\t\ttimeout: number;\n\t\tmaxOutputBytes: number;\n\t\tsignal?: AbortSignal;\n\t\tenvironment: Readonly<Record<string, string | undefined>>;\n\t},\n) => Promise<WorkspaceExecResult>;\n\nexport interface WorkspaceEntry {\n\tname: string;\n\tisFile: boolean;\n\tisDirectory: boolean;\n}\n\nexport interface WorkspaceFileSystem {\n\treadFile(path: string, maxBytes: number): Promise<string | undefined>;\n\treadDirectory(path: string): Promise<readonly WorkspaceEntry[]>;\n\tfileExists(path: string): Promise<boolean>;\n}\n\nexport interface WorkspaceRefreshInput {\n\tcwd: string;\n\tconfig: StarshipConfig;\n\tenvironment: Readonly<Record<string, string | undefined>>;\n\thomeDir: string;\n\tplatform: NodeJS.Platform;\n\thostname: string;\n\tusername: string;\n\texec: WorkspaceExec;\n\tfileSystem?: Partial<WorkspaceFileSystem>;\n\tfileExists?(path: string): Promise<boolean>;\n\treason?: \"initial\" | \"event\" | \"periodic\";\n\tprevious?: WorkspaceSnapshot;\n\tsignal?: AbortSignal;\n}\n\nexport interface CollectorContext {\n\tinput: WorkspaceRefreshInput;\n\tfs: WorkspaceFileSystem;\n\trequirements: ReadonlyMap<ModuleName, ReadonlySet<string>>;\n\tentries(): Promise<readonly WorkspaceEntry[]>;\n\toptions(name: ModuleName): Readonly<Record<string, unknown>>;\n\tneeds(name: ModuleName, variable?: string): boolean;\n}\n\nexport const PRIVATE_STYLE_SELECTOR = \"__pi_style_selector\";\n\nexport type MutableModuleSnapshot = Record<string, Record<string, string>>;\n"],
|
|
5
|
+
"mappings": ";;;;AA4DO,IAAM,yBAAyB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
|
+
// @ts-nocheck -- generated JavaScript uses a .ts extension so Pi routes chunks through Jiti.
|
|
3
|
+
|
|
4
|
+
// src/runtime/helpers.ts
|
|
5
|
+
import { open, opendir, stat } from "node:fs/promises";
|
|
6
|
+
import { basename, delimiter, dirname, extname, join, resolve } from "node:path";
|
|
7
|
+
var MAX_METADATA_FILE_BYTES = 64 * 1024;
|
|
8
|
+
var COMMAND_TIMEOUT_MS = 2e3;
|
|
9
|
+
var MAX_COMMAND_OUTPUT_BYTES = 64 * 1024;
|
|
10
|
+
var MAX_DIRECTORY_ENTRIES = 2048;
|
|
11
|
+
var MAX_LABEL_LENGTH = 160;
|
|
12
|
+
function createFileSystem(input) {
|
|
13
|
+
const defaults = {
|
|
14
|
+
async readFile(path, maxBytes) {
|
|
15
|
+
let handle;
|
|
16
|
+
try {
|
|
17
|
+
handle = await open(path, "r");
|
|
18
|
+
const info = await handle.stat();
|
|
19
|
+
if (!info.isFile() || info.size > maxBytes) return void 0;
|
|
20
|
+
const buffer = Buffer.alloc(Math.min(maxBytes + 1, Number(info.size) + 1));
|
|
21
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
22
|
+
if (bytesRead > maxBytes) return void 0;
|
|
23
|
+
return buffer.subarray(0, bytesRead).toString("utf8");
|
|
24
|
+
} catch {
|
|
25
|
+
return void 0;
|
|
26
|
+
} finally {
|
|
27
|
+
await handle?.close().catch(() => void 0);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
async readDirectory(path) {
|
|
31
|
+
const entries = [];
|
|
32
|
+
try {
|
|
33
|
+
const directory = await opendir(path);
|
|
34
|
+
for await (const entry of directory) {
|
|
35
|
+
entries.push({
|
|
36
|
+
name: entry.name,
|
|
37
|
+
isFile: entry.isFile(),
|
|
38
|
+
isDirectory: entry.isDirectory()
|
|
39
|
+
});
|
|
40
|
+
if (entries.length >= MAX_DIRECTORY_ENTRIES) break;
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
return entries;
|
|
46
|
+
},
|
|
47
|
+
async fileExists(path) {
|
|
48
|
+
try {
|
|
49
|
+
await stat(path);
|
|
50
|
+
return true;
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
...defaults,
|
|
58
|
+
...input.fileSystem,
|
|
59
|
+
...input.fileExists ? { fileExists: input.fileExists } : {}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function safeMetadata(value, maxLength = MAX_LABEL_LENGTH) {
|
|
63
|
+
if (typeof value !== "string") return void 0;
|
|
64
|
+
const sanitized = Array.from(value, (character) => {
|
|
65
|
+
const code = character.codePointAt(0) ?? 0;
|
|
66
|
+
return code <= 31 || code >= 127 && code <= 159 || code >= 55296 && code <= 57343 ? "" : character;
|
|
67
|
+
}).join("").trim();
|
|
68
|
+
if (!sanitized) return void 0;
|
|
69
|
+
return Array.from(sanitized).slice(0, maxLength).join("");
|
|
70
|
+
}
|
|
71
|
+
function isRecord(value) {
|
|
72
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
73
|
+
}
|
|
74
|
+
function setString(record, key, value) {
|
|
75
|
+
const safe = safeMetadata(value);
|
|
76
|
+
if (!safe) return;
|
|
77
|
+
Object.defineProperty(record, key, {
|
|
78
|
+
value: safe,
|
|
79
|
+
writable: true,
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function optionString(context, module, key) {
|
|
85
|
+
const value = context.options(module)[key];
|
|
86
|
+
return typeof value === "string" ? value : void 0;
|
|
87
|
+
}
|
|
88
|
+
function optionBoolean(context, module, key) {
|
|
89
|
+
return context.options(module)[key] === true;
|
|
90
|
+
}
|
|
91
|
+
function optionNumber(context, module, key) {
|
|
92
|
+
const value = context.options(module)[key];
|
|
93
|
+
return typeof value === "number" ? value : void 0;
|
|
94
|
+
}
|
|
95
|
+
function optionStrings(context, module, key) {
|
|
96
|
+
const value = context.options(module)[key];
|
|
97
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
|
|
98
|
+
}
|
|
99
|
+
function optionMap(context, module, key) {
|
|
100
|
+
const value = context.options(module)[key];
|
|
101
|
+
return isRecord(value) ? value : {};
|
|
102
|
+
}
|
|
103
|
+
function exactAlias(value, aliases) {
|
|
104
|
+
if (!value) return void 0;
|
|
105
|
+
return Object.hasOwn(aliases, value) ? safeMetadata(aliases[value]) : value;
|
|
106
|
+
}
|
|
107
|
+
function formatVersion(raw, format) {
|
|
108
|
+
return (format ?? "v$raw").replaceAll("$raw", raw.replace(/^v/u, ""));
|
|
109
|
+
}
|
|
110
|
+
async function runBounded(context, command, args) {
|
|
111
|
+
try {
|
|
112
|
+
const result = await context.input.exec(command, args, {
|
|
113
|
+
cwd: context.input.cwd,
|
|
114
|
+
timeout: COMMAND_TIMEOUT_MS,
|
|
115
|
+
maxOutputBytes: MAX_COMMAND_OUTPUT_BYTES,
|
|
116
|
+
signal: context.input.signal,
|
|
117
|
+
environment: context.input.environment
|
|
118
|
+
});
|
|
119
|
+
if (result.code !== 0 || result.killed) return void 0;
|
|
120
|
+
const selectedOutput = result.stdout || result.stderr;
|
|
121
|
+
const output = Buffer.from(selectedOutput).subarray(0, MAX_COMMAND_OUTPUT_BYTES + 1);
|
|
122
|
+
if (output.byteLength > MAX_COMMAND_OUTPUT_BYTES) return void 0;
|
|
123
|
+
return output.toString("utf8");
|
|
124
|
+
} catch {
|
|
125
|
+
return void 0;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function parseIni(source) {
|
|
129
|
+
const result = {};
|
|
130
|
+
let section = "";
|
|
131
|
+
for (const rawLine of source.split(/\r?\n/u)) {
|
|
132
|
+
const line = rawLine.trim();
|
|
133
|
+
if (!line || line.startsWith("#") || line.startsWith(";")) continue;
|
|
134
|
+
const sectionMatch = /^\[([^\]]+)\]$/u.exec(line);
|
|
135
|
+
if (sectionMatch?.[1]) {
|
|
136
|
+
section = sectionMatch[1].trim();
|
|
137
|
+
if (!Object.hasOwn(result, section)) setOwn(result, section, {});
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const separator = line.indexOf("=");
|
|
141
|
+
if (separator <= 0) continue;
|
|
142
|
+
const key = line.slice(0, separator).trim();
|
|
143
|
+
const value = safeMetadata(line.slice(separator + 1));
|
|
144
|
+
if (!value) continue;
|
|
145
|
+
if (!Object.hasOwn(result, section)) setOwn(result, section, {});
|
|
146
|
+
setOwn(result[section], key, value);
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
function directMatch(entries, files, extensions, folders) {
|
|
151
|
+
const positiveFiles = files.filter((value) => !value.startsWith("!"));
|
|
152
|
+
const negativeFiles = new Set(
|
|
153
|
+
files.filter((value) => value.startsWith("!")).map((v) => v.slice(1))
|
|
154
|
+
);
|
|
155
|
+
const positiveExtensions = extensions.filter((value) => !value.startsWith("!")).map((value) => value.replace(/^\./u, ""));
|
|
156
|
+
const negativeExtensions = new Set(
|
|
157
|
+
extensions.filter((value) => value.startsWith("!")).map((value) => value.slice(1).replace(/^\./u, ""))
|
|
158
|
+
);
|
|
159
|
+
const positiveFolders = folders.filter((value) => !value.startsWith("!"));
|
|
160
|
+
const negativeFolders = new Set(
|
|
161
|
+
folders.filter((value) => value.startsWith("!")).map((value) => value.slice(1))
|
|
162
|
+
);
|
|
163
|
+
if (entries.some(
|
|
164
|
+
(entry) => negativeFiles.has(entry.name) || entry.isFile && negativeExtensions.has(extname(entry.name).slice(1)) || entry.isDirectory && negativeFolders.has(entry.name)
|
|
165
|
+
)) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
return entries.some(
|
|
169
|
+
(entry) => positiveFiles.includes(entry.name) || entry.isFile && positiveExtensions.includes(extname(entry.name).slice(1)) || entry.isDirectory && positiveFolders.includes(entry.name)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
function parentDirectories(start, limit) {
|
|
173
|
+
const result = [];
|
|
174
|
+
let current = resolve(start);
|
|
175
|
+
for (let index = 0; index < limit; index += 1) {
|
|
176
|
+
const parent = dirname(current);
|
|
177
|
+
if (parent === current) break;
|
|
178
|
+
result.push(parent);
|
|
179
|
+
current = parent;
|
|
180
|
+
}
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
function pathName(path) {
|
|
184
|
+
return basename(path.replace(/[\\/]+$/u, "")) || path;
|
|
185
|
+
}
|
|
186
|
+
function joinHome(input, ...parts) {
|
|
187
|
+
return join(input.homeDir, ...parts);
|
|
188
|
+
}
|
|
189
|
+
function setOwn(record, key, value) {
|
|
190
|
+
Object.defineProperty(record, key, {
|
|
191
|
+
value,
|
|
192
|
+
writable: true,
|
|
193
|
+
enumerable: true,
|
|
194
|
+
configurable: true
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
MAX_METADATA_FILE_BYTES,
|
|
200
|
+
createFileSystem,
|
|
201
|
+
safeMetadata,
|
|
202
|
+
isRecord,
|
|
203
|
+
setString,
|
|
204
|
+
optionString,
|
|
205
|
+
optionBoolean,
|
|
206
|
+
optionNumber,
|
|
207
|
+
optionStrings,
|
|
208
|
+
optionMap,
|
|
209
|
+
exactAlias,
|
|
210
|
+
formatVersion,
|
|
211
|
+
runBounded,
|
|
212
|
+
parseIni,
|
|
213
|
+
directMatch,
|
|
214
|
+
parentDirectories,
|
|
215
|
+
pathName,
|
|
216
|
+
joinHome
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=chunk-G2GG2V6Q.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/runtime/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["import { type FileHandle, open, opendir, stat } from \"node:fs/promises\";\nimport { basename, delimiter, dirname, extname, join, resolve } from \"node:path\";\nimport type {\n\tCollectorContext,\n\tWorkspaceEntry,\n\tWorkspaceFileSystem,\n\tWorkspaceRefreshInput,\n} from \"./types.js\";\n\nexport const MAX_METADATA_FILE_BYTES = 64 * 1024;\nexport const COMMAND_TIMEOUT_MS = 2_000;\nexport const MAX_COMMAND_OUTPUT_BYTES = 64 * 1024;\nconst MAX_DIRECTORY_ENTRIES = 2_048;\nconst MAX_LABEL_LENGTH = 160;\n\nexport function createFileSystem(input: WorkspaceRefreshInput): WorkspaceFileSystem {\n\tconst defaults: WorkspaceFileSystem = {\n\t\tasync readFile(path, maxBytes) {\n\t\t\tlet handle: FileHandle | undefined;\n\t\t\ttry {\n\t\t\t\thandle = await open(path, \"r\");\n\t\t\t\tconst info = await handle.stat();\n\t\t\t\tif (!info.isFile() || info.size > maxBytes) return undefined;\n\t\t\t\tconst buffer = Buffer.alloc(Math.min(maxBytes + 1, Number(info.size) + 1));\n\t\t\t\tconst { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);\n\t\t\t\tif (bytesRead > maxBytes) return undefined;\n\t\t\t\treturn buffer.subarray(0, bytesRead).toString(\"utf8\");\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t} finally {\n\t\t\t\tawait handle?.close().catch(() => undefined);\n\t\t\t}\n\t\t},\n\t\tasync readDirectory(path) {\n\t\t\tconst entries: WorkspaceEntry[] = [];\n\t\t\ttry {\n\t\t\t\tconst directory = await opendir(path);\n\t\t\t\tfor await (const entry of directory) {\n\t\t\t\t\tentries.push({\n\t\t\t\t\t\tname: entry.name,\n\t\t\t\t\t\tisFile: entry.isFile(),\n\t\t\t\t\t\tisDirectory: entry.isDirectory(),\n\t\t\t\t\t});\n\t\t\t\t\tif (entries.length >= MAX_DIRECTORY_ENTRIES) break;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn entries;\n\t\t},\n\t\tasync fileExists(path) {\n\t\t\ttry {\n\t\t\t\tawait stat(path);\n\t\t\t\treturn true;\n\t\t\t} catch {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t};\n\treturn {\n\t\t...defaults,\n\t\t...input.fileSystem,\n\t\t...(input.fileExists ? { fileExists: input.fileExists } : {}),\n\t};\n}\n\nexport function safeMetadata(value: unknown, maxLength = MAX_LABEL_LENGTH): string | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\tconst sanitized = Array.from(value, (character) => {\n\t\tconst code = character.codePointAt(0) ?? 0;\n\t\treturn code <= 0x1f || (code >= 0x7f && code <= 0x9f) || (code >= 0xd800 && code <= 0xdfff)\n\t\t\t? \"\"\n\t\t\t: character;\n\t})\n\t\t.join(\"\")\n\t\t.trim();\n\tif (!sanitized) return undefined;\n\treturn Array.from(sanitized).slice(0, maxLength).join(\"\");\n}\n\nexport function ownString(record: unknown, key: string): string | undefined {\n\tif (!isRecord(record) || !Object.hasOwn(record, key)) return undefined;\n\treturn safeMetadata(record[key]);\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nexport function setString(record: Record<string, string>, key: string, value: unknown): void {\n\tconst safe = safeMetadata(value);\n\tif (!safe) return;\n\tObject.defineProperty(record, key, {\n\t\tvalue: safe,\n\t\twritable: true,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n}\n\nexport function optionString(\n\tcontext: CollectorContext,\n\tmodule: Parameters<CollectorContext[\"options\"]>[0],\n\tkey: string,\n): string | undefined {\n\tconst value = context.options(module)[key];\n\treturn typeof value === \"string\" ? value : undefined;\n}\n\nexport function optionBoolean(\n\tcontext: CollectorContext,\n\tmodule: Parameters<CollectorContext[\"options\"]>[0],\n\tkey: string,\n): boolean {\n\treturn context.options(module)[key] === true;\n}\n\nexport function optionNumber(\n\tcontext: CollectorContext,\n\tmodule: Parameters<CollectorContext[\"options\"]>[0],\n\tkey: string,\n): number | undefined {\n\tconst value = context.options(module)[key];\n\treturn typeof value === \"number\" ? value : undefined;\n}\n\nexport function optionStrings(\n\tcontext: CollectorContext,\n\tmodule: Parameters<CollectorContext[\"options\"]>[0],\n\tkey: string,\n): readonly string[] {\n\tconst value = context.options(module)[key];\n\treturn Array.isArray(value) && value.every((item) => typeof item === \"string\") ? value : [];\n}\n\nexport function optionMap(\n\tcontext: CollectorContext,\n\tmodule: Parameters<CollectorContext[\"options\"]>[0],\n\tkey: string,\n): Readonly<Record<string, string>> {\n\tconst value = context.options(module)[key];\n\treturn isRecord(value) ? (value as Record<string, string>) : {};\n}\n\nexport function exactAlias(value: string | undefined, aliases: Readonly<Record<string, string>>) {\n\tif (!value) return undefined;\n\treturn Object.hasOwn(aliases, value) ? safeMetadata(aliases[value]) : value;\n}\n\nexport function formatVersion(raw: string, format: string | undefined): string {\n\treturn (format ?? \"v$raw\").replaceAll(\"$raw\", raw.replace(/^v/u, \"\"));\n}\n\nexport async function runBounded(\n\tcontext: CollectorContext,\n\tcommand: string,\n\targs: string[],\n): Promise<string | undefined> {\n\ttry {\n\t\tconst result = await context.input.exec(command, args, {\n\t\t\tcwd: context.input.cwd,\n\t\t\ttimeout: COMMAND_TIMEOUT_MS,\n\t\t\tmaxOutputBytes: MAX_COMMAND_OUTPUT_BYTES,\n\t\t\tsignal: context.input.signal,\n\t\t\tenvironment: context.input.environment,\n\t\t});\n\t\tif (result.code !== 0 || result.killed) return undefined;\n\t\tconst selectedOutput = result.stdout || result.stderr;\n\t\tconst output = Buffer.from(selectedOutput).subarray(0, MAX_COMMAND_OUTPUT_BYTES + 1);\n\t\tif (output.byteLength > MAX_COMMAND_OUTPUT_BYTES) return undefined;\n\t\treturn output.toString(\"utf8\");\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport function parseIni(source: string): Record<string, Record<string, string>> {\n\tconst result: Record<string, Record<string, string>> = {};\n\tlet section = \"\";\n\tfor (const rawLine of source.split(/\\r?\\n/u)) {\n\t\tconst line = rawLine.trim();\n\t\tif (!line || line.startsWith(\"#\") || line.startsWith(\";\")) continue;\n\t\tconst sectionMatch = /^\\[([^\\]]+)\\]$/u.exec(line);\n\t\tif (sectionMatch?.[1]) {\n\t\t\tsection = sectionMatch[1].trim();\n\t\t\tif (!Object.hasOwn(result, section)) setOwn(result, section, {});\n\t\t\tcontinue;\n\t\t}\n\t\tconst separator = line.indexOf(\"=\");\n\t\tif (separator <= 0) continue;\n\t\tconst key = line.slice(0, separator).trim();\n\t\tconst value = safeMetadata(line.slice(separator + 1));\n\t\tif (!value) continue;\n\t\tif (!Object.hasOwn(result, section)) setOwn(result, section, {});\n\t\tsetOwn(result[section] as Record<string, string>, key, value);\n\t}\n\treturn result;\n}\n\nexport function envPathList(value: string | undefined): string[] {\n\treturn (value ?? \"\")\n\t\t.split(delimiter)\n\t\t.map((part) => part.trim())\n\t\t.filter(Boolean);\n}\n\nexport function directMatch(\n\tentries: readonly WorkspaceEntry[],\n\tfiles: readonly string[],\n\textensions: readonly string[],\n\tfolders: readonly string[],\n): boolean {\n\tconst positiveFiles = files.filter((value) => !value.startsWith(\"!\"));\n\tconst negativeFiles = new Set(\n\t\tfiles.filter((value) => value.startsWith(\"!\")).map((v) => v.slice(1)),\n\t);\n\tconst positiveExtensions = extensions\n\t\t.filter((value) => !value.startsWith(\"!\"))\n\t\t.map((value) => value.replace(/^\\./u, \"\"));\n\tconst negativeExtensions = new Set(\n\t\textensions\n\t\t\t.filter((value) => value.startsWith(\"!\"))\n\t\t\t.map((value) => value.slice(1).replace(/^\\./u, \"\")),\n\t);\n\tconst positiveFolders = folders.filter((value) => !value.startsWith(\"!\"));\n\tconst negativeFolders = new Set(\n\t\tfolders.filter((value) => value.startsWith(\"!\")).map((value) => value.slice(1)),\n\t);\n\tif (\n\t\tentries.some(\n\t\t\t(entry) =>\n\t\t\t\tnegativeFiles.has(entry.name) ||\n\t\t\t\t(entry.isFile && negativeExtensions.has(extname(entry.name).slice(1))) ||\n\t\t\t\t(entry.isDirectory && negativeFolders.has(entry.name)),\n\t\t)\n\t) {\n\t\treturn false;\n\t}\n\treturn entries.some(\n\t\t(entry) =>\n\t\t\tpositiveFiles.includes(entry.name) ||\n\t\t\t(entry.isFile && positiveExtensions.includes(extname(entry.name).slice(1))) ||\n\t\t\t(entry.isDirectory && positiveFolders.includes(entry.name)),\n\t);\n}\n\nexport function parentDirectories(start: string, limit: number): string[] {\n\tconst result: string[] = [];\n\tlet current = resolve(start);\n\tfor (let index = 0; index < limit; index += 1) {\n\t\tconst parent = dirname(current);\n\t\tif (parent === current) break;\n\t\tresult.push(parent);\n\t\tcurrent = parent;\n\t}\n\treturn result;\n}\n\nexport function pathName(path: string): string {\n\treturn basename(path.replace(/[\\\\/]+$/u, \"\")) || path;\n}\n\nexport function joinHome(input: WorkspaceRefreshInput, ...parts: string[]): string {\n\treturn join(input.homeDir, ...parts);\n}\n\nfunction setOwn<T>(record: Record<string, T>, key: string, value: T): void {\n\tObject.defineProperty(record, key, {\n\t\tvalue,\n\t\twritable: true,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAAA,SAA0B,MAAM,SAAS,YAAY;AACrD,SAAS,UAAU,WAAW,SAAS,SAAS,MAAM,eAAe;AAQ9D,IAAM,0BAA0B,KAAK;AACrC,IAAM,qBAAqB;AAC3B,IAAM,2BAA2B,KAAK;AAC7C,IAAM,wBAAwB;AAC9B,IAAM,mBAAmB;AAElB,SAAS,iBAAiB,OAAmD;AACnF,QAAM,WAAgC;AAAA,IACrC,MAAM,SAAS,MAAM,UAAU;AAC9B,UAAI;AACJ,UAAI;AACH,iBAAS,MAAM,KAAK,MAAM,GAAG;AAC7B,cAAM,OAAO,MAAM,OAAO,KAAK;AAC/B,YAAI,CAAC,KAAK,OAAO,KAA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