@narumitw/pi-starship 0.55.1 → 0.55.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{chunk-UX6PBXVK.js → chunk-JO5PH6FN.js} +28 -110
- package/dist/chunks/chunk-JO5PH6FN.js.map +7 -0
- package/dist/chunks/{chunk-P4XMFSQW.js → chunk-YWY5RIDQ.js} +3 -7
- package/dist/chunks/chunk-YWY5RIDQ.js.map +7 -0
- package/dist/chunks/{chunk-EOGXAMTA.js → chunk-ZQZSXXPI.js} +1 -1
- package/dist/chunks/chunk-ZQZSXXPI.js.map +7 -0
- package/dist/chunks/{cloud-BKHYWCTA.js → cloud-C4VU3TX3.js} +7 -14
- package/dist/chunks/cloud-C4VU3TX3.js.map +7 -0
- package/dist/chunks/{commands-53ZO2JUK.js → commands-ATILSUVK.js} +13 -42
- package/dist/chunks/commands-ATILSUVK.js.map +7 -0
- package/dist/chunks/{deployment-RKKOEQQ2.js → deployment-FMNTYRBW.js} +6 -21
- package/dist/chunks/deployment-FMNTYRBW.js.map +7 -0
- package/dist/chunks/{development-BERD42HW.js → development-OUYXDPBS.js} +4 -8
- package/dist/chunks/development-OUYXDPBS.js.map +7 -0
- package/dist/chunks/{execution-42JTEY3N.js → execution-HJOGLMWD.js} +3 -3
- package/dist/chunks/execution-HJOGLMWD.js.map +7 -0
- package/dist/chunks/{languages-RMP6DW7H.js → languages-WXMF4GOF.js} +6 -22
- package/dist/chunks/languages-WXMF4GOF.js.map +7 -0
- package/dist/chunks/{package-LG5H7BBM.js → package-YXRZQAOV.js} +5 -14
- package/dist/chunks/package-YXRZQAOV.js.map +7 -0
- package/dist/index.ts +20 -55
- package/dist/index.ts.map +2 -2
- package/package.json +60 -61
- package/skills/configuring-pi-starship/scripts/apply.mjs +43 -47
- package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
- package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
- package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
- package/src/command-configuration.ts +267 -286
- package/src/command-contract.ts +6 -6
- package/src/command-inspector.ts +27 -27
- package/src/command-preset-picker.ts +45 -50
- package/src/command-preview.ts +153 -166
- package/src/commands.ts +588 -618
- package/src/config.ts +580 -660
- package/src/effective-config.ts +46 -48
- package/src/format/formatter.ts +211 -227
- package/src/format/style.ts +205 -216
- package/src/modules/activity.ts +74 -74
- package/src/modules/brand.ts +9 -9
- package/src/modules/cache.ts +18 -18
- package/src/modules/catalog.ts +79 -83
- package/src/modules/cloud.ts +54 -54
- package/src/modules/context.ts +27 -27
- package/src/modules/cost.ts +23 -23
- package/src/modules/deployment.ts +45 -45
- package/src/modules/development.ts +80 -81
- package/src/modules/directory.ts +89 -113
- package/src/modules/display.ts +9 -9
- package/src/modules/execution.ts +62 -69
- package/src/modules/extension-status.ts +59 -64
- package/src/modules/fill.ts +10 -10
- package/src/modules/git/branch.ts +26 -26
- package/src/modules/git/commit.ts +21 -23
- package/src/modules/git/metrics.ts +22 -22
- package/src/modules/git/runtime.ts +299 -334
- package/src/modules/git/state.ts +17 -17
- package/src/modules/git/status.ts +77 -79
- package/src/modules/git/worktree.ts +10 -12
- package/src/modules/github-pr.ts +20 -20
- package/src/modules/helpers.ts +3 -3
- package/src/modules/index.ts +21 -21
- package/src/modules/inspection.ts +101 -108
- package/src/modules/languages.ts +52 -59
- package/src/modules/model.ts +57 -67
- package/src/modules/package.ts +12 -12
- package/src/modules/provider.ts +22 -24
- package/src/modules/render.ts +124 -140
- package/src/modules/thinking.ts +27 -26
- package/src/modules/time.ts +10 -13
- package/src/modules/tokens.ts +13 -13
- package/src/modules/truncation.ts +14 -17
- package/src/modules/turn.ts +9 -9
- package/src/modules/types.ts +125 -132
- package/src/modules/workspace-helpers.ts +4 -7
- package/src/pi-starship.ts +567 -603
- package/src/presets/catalog.ts +113 -113
- package/src/runtime/cloud.ts +122 -150
- package/src/runtime/command.ts +106 -108
- package/src/runtime/deployment.ts +150 -179
- package/src/runtime/development.ts +107 -124
- package/src/runtime/execution.ts +110 -124
- package/src/runtime/github-pr.ts +223 -252
- package/src/runtime/helpers.ts +186 -199
- package/src/runtime/languages.ts +149 -180
- package/src/runtime/package.ts +74 -87
- package/src/runtime/refresh-controller.ts +82 -86
- package/src/runtime/types.ts +38 -38
- package/src/runtime/workspace.ts +108 -116
- package/src/usage.ts +40 -40
- package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
- package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
- package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
- package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
- package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
- package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
- package/dist/chunks/development-BERD42HW.js.map +0 -7
- package/dist/chunks/execution-42JTEY3N.js.map +0 -7
- package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
- package/dist/chunks/package-LG5H7BBM.js.map +0 -7
package/src/runtime/helpers.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { type FileHandle, open, opendir, stat } from "node:fs/promises";
|
|
2
2
|
import { basename, delimiter, dirname, extname, join, resolve } from "node:path";
|
|
3
|
-
import type {
|
|
4
|
-
CollectorContext,
|
|
5
|
-
WorkspaceEntry,
|
|
6
|
-
WorkspaceFileSystem,
|
|
7
|
-
WorkspaceRefreshInput,
|
|
8
|
-
} from "./types.js";
|
|
3
|
+
import type { CollectorContext, WorkspaceEntry, WorkspaceFileSystem, WorkspaceRefreshInput } from "./types.js";
|
|
9
4
|
|
|
10
5
|
export const MAX_METADATA_FILE_BYTES = 64 * 1024;
|
|
11
6
|
export const COMMAND_TIMEOUT_MS = 2_000;
|
|
@@ -14,261 +9,253 @@ const MAX_DIRECTORY_ENTRIES = 2_048;
|
|
|
14
9
|
const MAX_LABEL_LENGTH = 160;
|
|
15
10
|
|
|
16
11
|
export function createFileSystem(input: WorkspaceRefreshInput): WorkspaceFileSystem {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
12
|
+
const defaults: WorkspaceFileSystem = {
|
|
13
|
+
async readFile(path, maxBytes) {
|
|
14
|
+
let handle: FileHandle | undefined;
|
|
15
|
+
try {
|
|
16
|
+
handle = await open(path, "r");
|
|
17
|
+
const info = await handle.stat();
|
|
18
|
+
if (!info.isFile() || info.size > maxBytes) return undefined;
|
|
19
|
+
const buffer = Buffer.alloc(Math.min(maxBytes + 1, Number(info.size) + 1));
|
|
20
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
21
|
+
if (bytesRead > maxBytes) return undefined;
|
|
22
|
+
return buffer.subarray(0, bytesRead).toString("utf8");
|
|
23
|
+
} catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
} finally {
|
|
26
|
+
await handle?.close().catch(() => undefined);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
async readDirectory(path) {
|
|
30
|
+
const entries: WorkspaceEntry[] = [];
|
|
31
|
+
try {
|
|
32
|
+
const directory = await opendir(path);
|
|
33
|
+
for await (const entry of directory) {
|
|
34
|
+
entries.push({
|
|
35
|
+
name: entry.name,
|
|
36
|
+
isFile: entry.isFile(),
|
|
37
|
+
isDirectory: entry.isDirectory(),
|
|
38
|
+
});
|
|
39
|
+
if (entries.length >= MAX_DIRECTORY_ENTRIES) break;
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
return entries;
|
|
45
|
+
},
|
|
46
|
+
async fileExists(path) {
|
|
47
|
+
try {
|
|
48
|
+
await stat(path);
|
|
49
|
+
return true;
|
|
50
|
+
} catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
...defaults,
|
|
57
|
+
...input.fileSystem,
|
|
58
|
+
...(input.fileExists ? { fileExists: input.fileExists } : {}),
|
|
59
|
+
};
|
|
65
60
|
}
|
|
66
61
|
|
|
67
62
|
export function safeMetadata(value: unknown, maxLength = MAX_LABEL_LENGTH): string | undefined {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (!sanitized) return undefined;
|
|
78
|
-
return Array.from(sanitized).slice(0, maxLength).join("");
|
|
63
|
+
if (typeof value !== "string") return undefined;
|
|
64
|
+
const sanitized = Array.from(value, (character) => {
|
|
65
|
+
const code = character.codePointAt(0) ?? 0;
|
|
66
|
+
return code <= 0x1f || (code >= 0x7f && code <= 0x9f) || (code >= 0xd800 && code <= 0xdfff) ? "" : character;
|
|
67
|
+
})
|
|
68
|
+
.join("")
|
|
69
|
+
.trim();
|
|
70
|
+
if (!sanitized) return undefined;
|
|
71
|
+
return Array.from(sanitized).slice(0, maxLength).join("");
|
|
79
72
|
}
|
|
80
73
|
|
|
81
74
|
export function ownString(record: unknown, key: string): string | undefined {
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
if (!isRecord(record) || !Object.hasOwn(record, key)) return undefined;
|
|
76
|
+
return safeMetadata(record[key]);
|
|
84
77
|
}
|
|
85
78
|
|
|
86
79
|
export function isRecord(value: unknown): value is Record<string, unknown> {
|
|
87
|
-
|
|
80
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
88
81
|
}
|
|
89
82
|
|
|
90
83
|
export function setString(record: Record<string, string>, key: string, value: unknown): void {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
const safe = safeMetadata(value);
|
|
85
|
+
if (!safe) return;
|
|
86
|
+
Object.defineProperty(record, key, {
|
|
87
|
+
value: safe,
|
|
88
|
+
writable: true,
|
|
89
|
+
enumerable: true,
|
|
90
|
+
configurable: true,
|
|
91
|
+
});
|
|
99
92
|
}
|
|
100
93
|
|
|
101
94
|
export function optionString(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
context: CollectorContext,
|
|
96
|
+
module: Parameters<CollectorContext["options"]>[0],
|
|
97
|
+
key: string,
|
|
105
98
|
): string | undefined {
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
const value = context.options(module)[key];
|
|
100
|
+
return typeof value === "string" ? value : undefined;
|
|
108
101
|
}
|
|
109
102
|
|
|
110
103
|
export function optionBoolean(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
context: CollectorContext,
|
|
105
|
+
module: Parameters<CollectorContext["options"]>[0],
|
|
106
|
+
key: string,
|
|
114
107
|
): boolean {
|
|
115
|
-
|
|
108
|
+
return context.options(module)[key] === true;
|
|
116
109
|
}
|
|
117
110
|
|
|
118
111
|
export function optionNumber(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
context: CollectorContext,
|
|
113
|
+
module: Parameters<CollectorContext["options"]>[0],
|
|
114
|
+
key: string,
|
|
122
115
|
): number | undefined {
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
const value = context.options(module)[key];
|
|
117
|
+
return typeof value === "number" ? value : undefined;
|
|
125
118
|
}
|
|
126
119
|
|
|
127
120
|
export function optionStrings(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
context: CollectorContext,
|
|
122
|
+
module: Parameters<CollectorContext["options"]>[0],
|
|
123
|
+
key: string,
|
|
131
124
|
): readonly string[] {
|
|
132
|
-
|
|
133
|
-
|
|
125
|
+
const value = context.options(module)[key];
|
|
126
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
|
|
134
127
|
}
|
|
135
128
|
|
|
136
129
|
export function optionMap(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
context: CollectorContext,
|
|
131
|
+
module: Parameters<CollectorContext["options"]>[0],
|
|
132
|
+
key: string,
|
|
140
133
|
): Readonly<Record<string, string>> {
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
const value = context.options(module)[key];
|
|
135
|
+
return isRecord(value) ? (value as Record<string, string>) : {};
|
|
143
136
|
}
|
|
144
137
|
|
|
145
138
|
export function exactAlias(value: string | undefined, aliases: Readonly<Record<string, string>>) {
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
if (!value) return undefined;
|
|
140
|
+
return Object.hasOwn(aliases, value) ? safeMetadata(aliases[value]) : value;
|
|
148
141
|
}
|
|
149
142
|
|
|
150
143
|
export function formatVersion(raw: string, format: string | undefined): string {
|
|
151
|
-
|
|
144
|
+
return (format ?? "v$raw").replaceAll("$raw", raw.replace(/^v/u, ""));
|
|
152
145
|
}
|
|
153
146
|
|
|
154
147
|
export async function runBounded(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
148
|
+
context: CollectorContext,
|
|
149
|
+
command: string,
|
|
150
|
+
args: string[],
|
|
158
151
|
): Promise<string | undefined> {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
152
|
+
try {
|
|
153
|
+
const result = await context.input.exec(command, args, {
|
|
154
|
+
cwd: context.input.cwd,
|
|
155
|
+
timeout: COMMAND_TIMEOUT_MS,
|
|
156
|
+
maxOutputBytes: MAX_COMMAND_OUTPUT_BYTES,
|
|
157
|
+
signal: context.input.signal,
|
|
158
|
+
environment: context.input.environment,
|
|
159
|
+
});
|
|
160
|
+
if (result.code !== 0 || result.killed) return undefined;
|
|
161
|
+
const selectedOutput = result.stdout || result.stderr;
|
|
162
|
+
const output = Buffer.from(selectedOutput).subarray(0, MAX_COMMAND_OUTPUT_BYTES + 1);
|
|
163
|
+
if (output.byteLength > MAX_COMMAND_OUTPUT_BYTES) return undefined;
|
|
164
|
+
return output.toString("utf8");
|
|
165
|
+
} catch {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
175
168
|
}
|
|
176
169
|
|
|
177
170
|
export function parseIni(source: string): Record<string, Record<string, string>> {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
171
|
+
const result: Record<string, Record<string, string>> = {};
|
|
172
|
+
let section = "";
|
|
173
|
+
for (const rawLine of source.split(/\r?\n/u)) {
|
|
174
|
+
const line = rawLine.trim();
|
|
175
|
+
if (!line || line.startsWith("#") || line.startsWith(";")) continue;
|
|
176
|
+
const sectionMatch = /^\[([^\]]+)\]$/u.exec(line);
|
|
177
|
+
if (sectionMatch?.[1]) {
|
|
178
|
+
section = sectionMatch[1].trim();
|
|
179
|
+
if (!Object.hasOwn(result, section)) setOwn(result, section, {});
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const separator = line.indexOf("=");
|
|
183
|
+
if (separator <= 0) continue;
|
|
184
|
+
const key = line.slice(0, separator).trim();
|
|
185
|
+
const value = safeMetadata(line.slice(separator + 1));
|
|
186
|
+
if (!value) continue;
|
|
187
|
+
if (!Object.hasOwn(result, section)) setOwn(result, section, {});
|
|
188
|
+
setOwn(result[section] as Record<string, string>, key, value);
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
198
191
|
}
|
|
199
192
|
|
|
200
193
|
export function envPathList(value: string | undefined): string[] {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
194
|
+
return (value ?? "")
|
|
195
|
+
.split(delimiter)
|
|
196
|
+
.map((part) => part.trim())
|
|
197
|
+
.filter(Boolean);
|
|
205
198
|
}
|
|
206
199
|
|
|
207
200
|
export function directMatch(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
201
|
+
entries: readonly WorkspaceEntry[],
|
|
202
|
+
files: readonly string[],
|
|
203
|
+
extensions: readonly string[],
|
|
204
|
+
folders: readonly string[],
|
|
212
205
|
): boolean {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return entries.some(
|
|
240
|
-
(entry) =>
|
|
241
|
-
positiveFiles.includes(entry.name) ||
|
|
242
|
-
(entry.isFile && positiveExtensions.includes(extname(entry.name).slice(1))) ||
|
|
243
|
-
(entry.isDirectory && positiveFolders.includes(entry.name)),
|
|
244
|
-
);
|
|
206
|
+
const positiveFiles = files.filter((value) => !value.startsWith("!"));
|
|
207
|
+
const negativeFiles = new Set(files.filter((value) => value.startsWith("!")).map((v) => v.slice(1)));
|
|
208
|
+
const positiveExtensions = extensions
|
|
209
|
+
.filter((value) => !value.startsWith("!"))
|
|
210
|
+
.map((value) => value.replace(/^\./u, ""));
|
|
211
|
+
const negativeExtensions = new Set(
|
|
212
|
+
extensions.filter((value) => value.startsWith("!")).map((value) => value.slice(1).replace(/^\./u, "")),
|
|
213
|
+
);
|
|
214
|
+
const positiveFolders = folders.filter((value) => !value.startsWith("!"));
|
|
215
|
+
const negativeFolders = new Set(folders.filter((value) => value.startsWith("!")).map((value) => value.slice(1)));
|
|
216
|
+
if (
|
|
217
|
+
entries.some(
|
|
218
|
+
(entry) =>
|
|
219
|
+
negativeFiles.has(entry.name) ||
|
|
220
|
+
(entry.isFile && negativeExtensions.has(extname(entry.name).slice(1))) ||
|
|
221
|
+
(entry.isDirectory && negativeFolders.has(entry.name)),
|
|
222
|
+
)
|
|
223
|
+
) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
return entries.some(
|
|
227
|
+
(entry) =>
|
|
228
|
+
positiveFiles.includes(entry.name) ||
|
|
229
|
+
(entry.isFile && positiveExtensions.includes(extname(entry.name).slice(1))) ||
|
|
230
|
+
(entry.isDirectory && positiveFolders.includes(entry.name)),
|
|
231
|
+
);
|
|
245
232
|
}
|
|
246
233
|
|
|
247
234
|
export function parentDirectories(start: string, limit: number): string[] {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
235
|
+
const result: string[] = [];
|
|
236
|
+
let current = resolve(start);
|
|
237
|
+
for (let index = 0; index < limit; index += 1) {
|
|
238
|
+
const parent = dirname(current);
|
|
239
|
+
if (parent === current) break;
|
|
240
|
+
result.push(parent);
|
|
241
|
+
current = parent;
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
257
244
|
}
|
|
258
245
|
|
|
259
246
|
export function pathName(path: string): string {
|
|
260
|
-
|
|
247
|
+
return basename(path.replace(/[\\/]+$/u, "")) || path;
|
|
261
248
|
}
|
|
262
249
|
|
|
263
250
|
export function joinHome(input: WorkspaceRefreshInput, ...parts: string[]): string {
|
|
264
|
-
|
|
251
|
+
return join(input.homeDir, ...parts);
|
|
265
252
|
}
|
|
266
253
|
|
|
267
254
|
function setOwn<T>(record: Record<string, T>, key: string, value: T): void {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
255
|
+
Object.defineProperty(record, key, {
|
|
256
|
+
value,
|
|
257
|
+
writable: true,
|
|
258
|
+
enumerable: true,
|
|
259
|
+
configurable: true,
|
|
260
|
+
});
|
|
274
261
|
}
|