vlt 0.0.0-0.1739501577334 → 0.0.0-0.1740089535501

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.
Files changed (123) hide show
  1. package/cache-unzip-src-unzip.js +7896 -0
  2. package/cache-unzip-src-unzip.js.map +7 -0
  3. package/chunk-3HXIYJS2.js +54 -0
  4. package/chunk-3HXIYJS2.js.map +7 -0
  5. package/chunk-4FAZJMPH.js +41 -0
  6. package/chunk-4FAZJMPH.js.map +7 -0
  7. package/chunk-5GF452XW.js +82 -0
  8. package/chunk-5GF452XW.js.map +7 -0
  9. package/chunk-5JBOG5Q6.js +83 -0
  10. package/chunk-5JBOG5Q6.js.map +7 -0
  11. package/chunk-5PCKCPD5.js +1137 -0
  12. package/chunk-5PCKCPD5.js.map +7 -0
  13. package/chunk-6CEDBCAO.js +37 -0
  14. package/chunk-6CEDBCAO.js.map +7 -0
  15. package/chunk-A4J3Q5Q5.js +9799 -0
  16. package/chunk-A4J3Q5Q5.js.map +7 -0
  17. package/chunk-BE4I27TH.js +11837 -0
  18. package/chunk-BE4I27TH.js.map +7 -0
  19. package/chunk-E6NPLFBW.js +73 -0
  20. package/chunk-E6NPLFBW.js.map +7 -0
  21. package/chunk-FTPQIXAY.js +19823 -0
  22. package/chunk-FTPQIXAY.js.map +7 -0
  23. package/chunk-GCGGOGOB.js +1833 -0
  24. package/chunk-GCGGOGOB.js.map +7 -0
  25. package/chunk-GPWWWN7B.js +152 -0
  26. package/chunk-GPWWWN7B.js.map +7 -0
  27. package/chunk-I6DIIGH5.js +5234 -0
  28. package/chunk-I6DIIGH5.js.map +7 -0
  29. package/chunk-IBPF4FEQ.js +8525 -0
  30. package/chunk-IBPF4FEQ.js.map +7 -0
  31. package/chunk-KCUUTVXO.js +512 -0
  32. package/chunk-KCUUTVXO.js.map +7 -0
  33. package/chunk-NLHKAPUX.js +969 -0
  34. package/chunk-NLHKAPUX.js.map +7 -0
  35. package/chunk-NLYHRND5.js +62 -0
  36. package/chunk-NLYHRND5.js.map +7 -0
  37. package/chunk-RUHVDQJO.js +1183 -0
  38. package/chunk-RUHVDQJO.js.map +7 -0
  39. package/chunk-S5T2ANVM.js +35 -0
  40. package/chunk-S5T2ANVM.js.map +7 -0
  41. package/chunk-SPFQ7UKJ.js +44 -0
  42. package/chunk-SPFQ7UKJ.js.map +7 -0
  43. package/chunk-SSXXXTGH.js +44 -0
  44. package/chunk-SSXXXTGH.js.map +7 -0
  45. package/chunk-U3AZW4GY.js +4456 -0
  46. package/chunk-U3AZW4GY.js.map +7 -0
  47. package/chunk-WTR3IN76.js +1379 -0
  48. package/chunk-WTR3IN76.js.map +7 -0
  49. package/chunk-X6YRGXUH.js +74 -0
  50. package/chunk-X6YRGXUH.js.map +7 -0
  51. package/chunk-XEMTNGLP.js +46 -0
  52. package/chunk-XEMTNGLP.js.map +7 -0
  53. package/chunk-Y2VHVDFQ.js +481 -0
  54. package/chunk-Y2VHVDFQ.js.map +7 -0
  55. package/chunk-Z4D6OOPT.js +1105 -0
  56. package/chunk-Z4D6OOPT.js.map +7 -0
  57. package/chunk-Z6OI5OS3.js +2071 -0
  58. package/chunk-Z6OI5OS3.js.map +7 -0
  59. package/cli-package.json +128 -0
  60. package/config-TDISERAE.js +179 -0
  61. package/config-TDISERAE.js.map +7 -0
  62. package/devtools-SGK32I5X.js +16682 -0
  63. package/devtools-SGK32I5X.js.map +7 -0
  64. package/exec-MORNET35.js +50 -0
  65. package/exec-MORNET35.js.map +7 -0
  66. package/gui-IS6VDVIF.js +48 -0
  67. package/gui-IS6VDVIF.js.map +7 -0
  68. package/gui-assets/favicon.ico +0 -0
  69. package/gui-assets/fonts/geist-mono.ttf +0 -0
  70. package/gui-assets/fonts/inter.ttf +0 -0
  71. package/gui-assets/index.html +34 -0
  72. package/gui-assets/index.js +564 -0
  73. package/gui-assets/index.js.map +7 -0
  74. package/gui-assets/main.css +1 -0
  75. package/help-7WIX3H76.js +25 -0
  76. package/help-7WIX3H76.js.map +7 -0
  77. package/init-I76RCFI2.js +27 -0
  78. package/init-I76RCFI2.js.map +7 -0
  79. package/install-UKPXZJLO.js +57 -0
  80. package/install-UKPXZJLO.js.map +7 -0
  81. package/install-exec-NFPKF3U3.js +28 -0
  82. package/install-exec-NFPKF3U3.js.map +7 -0
  83. package/list-FWTGAOEP.js +131 -0
  84. package/list-FWTGAOEP.js.map +7 -0
  85. package/login-KH3PDEN4.js +36 -0
  86. package/login-KH3PDEN4.js.map +7 -0
  87. package/logout-SC4MAN4J.js +36 -0
  88. package/logout-SC4MAN4J.js.map +7 -0
  89. package/package.json +9 -12
  90. package/pkg-DMGHE6YE.js +366 -0
  91. package/pkg-DMGHE6YE.js.map +7 -0
  92. package/query-UML2U5EL.js +119 -0
  93. package/query-UML2U5EL.js.map +7 -0
  94. package/registry-client-package.json +85 -0
  95. package/reporter-TCTQDWPH.js +18 -0
  96. package/reporter-TCTQDWPH.js.map +7 -0
  97. package/rollback-remove-src-remove.js +7398 -0
  98. package/rollback-remove-src-remove.js.map +7 -0
  99. package/run-QX7M5BLH.js +68 -0
  100. package/run-QX7M5BLH.js.map +7 -0
  101. package/run-exec-4PHASL4Q.js +41 -0
  102. package/run-exec-4PHASL4Q.js.map +7 -0
  103. package/source-M7VNOG6F.js +33 -0
  104. package/source-M7VNOG6F.js.map +7 -0
  105. package/token-ZEA4NKEX.js +86 -0
  106. package/token-ZEA4NKEX.js.map +7 -0
  107. package/uninstall-GRUVHPMA.js +46 -0
  108. package/uninstall-GRUVHPMA.js.map +7 -0
  109. package/vlix.js +25 -0
  110. package/vlix.js.map +7 -0
  111. package/vlr.js +25 -0
  112. package/vlr.js.map +7 -0
  113. package/vlrx.js +25 -0
  114. package/vlrx.js.map +7 -0
  115. package/vlt.js +24 -0
  116. package/vlt.js.map +7 -0
  117. package/vlx.js +25 -0
  118. package/vlx.js.map +7 -0
  119. package/whoami-LLOORW6C.js +46 -0
  120. package/whoami-LLOORW6C.js.map +7 -0
  121. package/yoga.wasm +0 -0
  122. package/postinstall.js +0 -51
  123. package/vlt +0 -27
@@ -0,0 +1,481 @@
1
+ var global = globalThis;
2
+ import {Buffer} from "node:buffer";
3
+ import {setImmediate, clearImmediate} from "node:timers";
4
+ import {createRequire as _vlt_createRequire} from 'node:module';
5
+ var require = _vlt_createRequire(import.meta.filename);
6
+ import {
7
+ Monorepo,
8
+ walkUp
9
+ } from "./chunk-NLHKAPUX.js";
10
+ import {
11
+ PathScurry
12
+ } from "./chunk-I6DIIGH5.js";
13
+ import {
14
+ PackageJson,
15
+ kIndent,
16
+ kNewline,
17
+ parse,
18
+ stringify
19
+ } from "./chunk-GCGGOGOB.js";
20
+ import {
21
+ error
22
+ } from "./chunk-6CEDBCAO.js";
23
+ import {
24
+ XDG,
25
+ commands,
26
+ definition,
27
+ getCommand,
28
+ isRecordField,
29
+ recordFields
30
+ } from "./chunk-Z6OI5OS3.js";
31
+
32
+ // src/vlt/src/config/index.ts
33
+ import { readFileSync, rmSync, writeFileSync } from "node:fs";
34
+ import { lstat, mkdir, readFile, writeFile } from "node:fs/promises";
35
+ import { homedir } from "node:os";
36
+ import { dirname, resolve } from "node:path";
37
+
38
+ // src/vlt/src/config/merge.ts
39
+ var merge = (base, add) => Object.fromEntries(
40
+ Object.entries(base).map(([k, v]) => [
41
+ k,
42
+ add[k] === void 0 ? v : Array.isArray(v) && Array.isArray(add[k]) ? [.../* @__PURE__ */ new Set([...v, ...add[k]])] : Array.isArray(v) || Array.isArray(add[k]) ? add[k] : !!v && typeof v === "object" && !!add[k] && typeof add[k] === "object" ? merge(v, add[k]) : add[k]
43
+ ]).concat(
44
+ // already merged together if existing, so just get new additions
45
+ Object.entries(add).filter(([k]) => base[k] === void 0)
46
+ )
47
+ );
48
+
49
+ // src/vlt/src/config/index.ts
50
+ var reducePairs = (pairs) => {
51
+ const record = {};
52
+ for (const kv of pairs) {
53
+ const eq = kv.indexOf("=");
54
+ if (eq === -1) record[kv] = "";
55
+ else {
56
+ const key = kv.substring(0, eq);
57
+ const val = kv.substring(eq + 1);
58
+ record[key] = val;
59
+ }
60
+ }
61
+ return record;
62
+ };
63
+ var isRecordFieldValue = (k, v) => Array.isArray(v) && recordFields.includes(k);
64
+ var pairsToRecords = (obj) => {
65
+ return Object.fromEntries(
66
+ Object.entries(obj).map(([k, v]) => [
67
+ k,
68
+ k === "command" && v && typeof v === "object" ? Object.fromEntries(
69
+ Object.entries(v).map(([k2, v2]) => [
70
+ k2,
71
+ pairsToRecords(v2)
72
+ ])
73
+ ) : isRecordFieldValue(k, v) ? reducePairs(v) : v
74
+ ])
75
+ // hard cast because TS can't see through the entries/fromEntries
76
+ );
77
+ };
78
+ var recordsToPairs = (obj) => {
79
+ return Object.fromEntries(
80
+ Object.entries(obj).filter(
81
+ ([k]) => !(k === "scurry" || k === "packageJson" || k === "monorepo" || k === "projectRoot")
82
+ ).map(([k, v]) => [
83
+ k,
84
+ k === "command" && v && typeof v === "object" ? recordsToPairs(v) : !v || typeof v !== "object" || Array.isArray(v) || !isRecordField(k) ? v : Object.entries(v).map(([k2, v2]) => `${k2}=${v2}`)
85
+ ])
86
+ );
87
+ };
88
+ var kRecord = Symbol("parsed key=value record");
89
+ var exists = (f) => lstat(f).then(
90
+ () => true,
91
+ () => false
92
+ );
93
+ var home = homedir();
94
+ var xdg = new XDG("vlt");
95
+ var Config = class _Config {
96
+ /**
97
+ * The {@link https://npmjs.com/jackspeak | JackSpeak} object
98
+ * representing vlt's configuration
99
+ */
100
+ jack;
101
+ stringifyOptions = { [kIndent]: " ", [kNewline]: "\n" };
102
+ configFiles = {};
103
+ /**
104
+ * Parsed values in effect
105
+ */
106
+ values;
107
+ /**
108
+ * Command-specific config values
109
+ */
110
+ commandValues = {};
111
+ /**
112
+ * A flattened object of the parsed configuration
113
+ */
114
+ get options() {
115
+ if (this.#options) return this.#options;
116
+ const scurry = new PathScurry(this.projectRoot);
117
+ const packageJson = new PackageJson();
118
+ this.#options = Object.assign(
119
+ pairsToRecords(this.parse().values),
120
+ {
121
+ projectRoot: this.projectRoot,
122
+ scurry,
123
+ packageJson,
124
+ monorepo: Monorepo.maybeLoad(this.projectRoot, {
125
+ scurry,
126
+ packageJson
127
+ })
128
+ }
129
+ );
130
+ return this.#options;
131
+ }
132
+ /**
133
+ * Reset the options value, optionally setting a new project root
134
+ * to recalculate the options.
135
+ */
136
+ resetOptions(projectRoot = process.cwd()) {
137
+ this.projectRoot = projectRoot;
138
+ this.#options = void 0;
139
+ }
140
+ // memoized options() getter value
141
+ #options;
142
+ /**
143
+ * positional arguments to the vlt process
144
+ */
145
+ positionals;
146
+ /**
147
+ * The root of the project where a vlt.json, vlt-workspaces.json,
148
+ * package.json, or .git was found. Not necessarily the `process.cwd()`,
149
+ * though that is the default location.
150
+ *
151
+ * Never walks up as far as `$HOME`. So for example, if a project is in
152
+ * `~/projects/xyz`, then the highest dir it will check is `~/projects`
153
+ */
154
+ projectRoot;
155
+ /**
156
+ * `Record<alias, canonical name>` to dereference command aliases.
157
+ */
158
+ commands;
159
+ /**
160
+ * Which command name to use for overriding with command-specific values,
161
+ * determined from the argv when parse() is called.
162
+ */
163
+ command;
164
+ constructor(jack = definition, projectRoot = process.cwd()) {
165
+ this.projectRoot = projectRoot;
166
+ this.commands = commands;
167
+ this.jack = jack;
168
+ }
169
+ /**
170
+ * Parse the arguments and set configuration and positionals accordingly.
171
+ */
172
+ parse(args = process.argv) {
173
+ if (isParsed(this)) return this;
174
+ this.jack.loadEnvDefaults();
175
+ const p = this.jack.parseRaw(args);
176
+ const fallback = getCommand(p.values["fallback-command"]);
177
+ this.command = getCommand(p.positionals[0]);
178
+ const cmdOrFallback = this.command ?? fallback;
179
+ const cmdSpecific = cmdOrFallback && this.commandValues[cmdOrFallback];
180
+ if (cmdSpecific) {
181
+ this.jack.setConfigValues(recordsToPairs(cmdSpecific));
182
+ }
183
+ this.jack.applyDefaults(p);
184
+ this.jack.writeEnv(p);
185
+ if (this.command) p.positionals.shift();
186
+ else this.command = getCommand(p.values["fallback-command"]);
187
+ Object.assign(this, p);
188
+ if (!isParsed(this)) throw error("failed to parse config");
189
+ return this;
190
+ }
191
+ /**
192
+ * Get a `key=value` list option value as an object.
193
+ *
194
+ * For example, a list option with a vlaue of `['key=value', 'xyz=as=df' ]`
195
+ * would be returned as `{key: 'value', xyz: 'as=df'}`
196
+ *
197
+ * Results are memoized, so subsequent calls for the same key will return the
198
+ * same object. If new strings are added to the list, then the memoized value
199
+ * is *not* updated, so only use once configurations have been fully loaded.
200
+ *
201
+ * If the config value is not set at all, an empty object is returned.
202
+ */
203
+ getRecord(k) {
204
+ const pairs = this.get(k);
205
+ if (!pairs) return {};
206
+ if (pairs[kRecord]) return pairs[kRecord];
207
+ const kv = pairs.reduce((kv2, pair) => {
208
+ const eq = pair.indexOf("=");
209
+ if (eq === -1) return kv2;
210
+ const key = pair.substring(0, eq);
211
+ const val = pair.substring(eq + 1);
212
+ kv2[key] = val;
213
+ return kv2;
214
+ }, {});
215
+ Object.assign(pairs, { [kRecord]: kv });
216
+ return kv;
217
+ }
218
+ /**
219
+ * Get a configuration value.
220
+ *
221
+ * Note: `key=value` pair configs are returned as a string array. To get them
222
+ * as an object, use {@link Config#getRecord}.
223
+ */
224
+ get(k) {
225
+ return (this.values ?? this.parse().values)[k];
226
+ }
227
+ /**
228
+ * Write the config values to the user or project config file.
229
+ */
230
+ async writeConfigFile(which, values) {
231
+ const f = this.getFilename(which);
232
+ await mkdir(dirname(f), { recursive: true });
233
+ const vals = Object.assign(
234
+ pairsToRecords(values),
235
+ this.stringifyOptions
236
+ );
237
+ await writeFile(f, stringify(vals));
238
+ this.configFiles[f] = vals;
239
+ return values;
240
+ }
241
+ /**
242
+ * Fold in the provided fields with the existing properties
243
+ * in the config file.
244
+ */
245
+ async addConfigToFile(which, values) {
246
+ const f = this.getFilename(which);
247
+ return this.writeConfigFile(
248
+ which,
249
+ merge(await this.#maybeLoadConfigFile(f) ?? {}, values)
250
+ );
251
+ }
252
+ /**
253
+ * if the file exists, parse and load it. returns object if data was
254
+ * loaded, or undefined if not.
255
+ */
256
+ async #maybeLoadConfigFile(file) {
257
+ const result = await this.#readConfigFile(file);
258
+ if (result) {
259
+ try {
260
+ const { command, ...values } = recordsToPairs(result);
261
+ if (command) {
262
+ for (const [c, opts] of Object.entries(command)) {
263
+ const cmd = getCommand(c);
264
+ if (cmd) {
265
+ this.commandValues[cmd] = merge(
266
+ this.commandValues[cmd] ?? {},
267
+ opts
268
+ );
269
+ }
270
+ }
271
+ }
272
+ this.jack.setConfigValues(values, file);
273
+ return result;
274
+ } catch (er) {
275
+ throw error("failed to load config values from file", {
276
+ path: file,
277
+ cause: er
278
+ });
279
+ }
280
+ }
281
+ }
282
+ async #readConfigFile(file) {
283
+ if (this.configFiles[file]) return this.configFiles[file];
284
+ const data = await readFile(file, "utf8").catch(() => {
285
+ });
286
+ if (!data) return void 0;
287
+ let result;
288
+ try {
289
+ result = parse(data);
290
+ if (result && typeof result === "object") {
291
+ if (result[kIndent] !== void 0)
292
+ this.stringifyOptions[kIndent] = result[kIndent];
293
+ if (result[kNewline] !== void 0)
294
+ this.stringifyOptions[kNewline] = result[kNewline];
295
+ }
296
+ } catch (er) {
297
+ throw error("failed to parse vlt config file", {
298
+ path: file,
299
+ cause: er
300
+ });
301
+ }
302
+ this.configFiles[file] = result;
303
+ return result;
304
+ }
305
+ getFilename(which = "project") {
306
+ return which === "user" ? xdg.config("vlt.json") : resolve(this.projectRoot, "vlt.json");
307
+ }
308
+ async deleteConfigKeys(which, fields) {
309
+ const file = this.getFilename(which);
310
+ const data = await this.#maybeLoadConfigFile(file);
311
+ if (!data) {
312
+ rmSync(file, { force: true });
313
+ return false;
314
+ }
315
+ let didSomething = false;
316
+ for (const f of fields) {
317
+ const [key, ...sk] = f.split(".");
318
+ const subs = sk.join(".");
319
+ const k = key;
320
+ const v = data[k];
321
+ if (v === void 0) continue;
322
+ if (subs && v && typeof v === "object") {
323
+ if (Array.isArray(v)) {
324
+ const i = v.findIndex(
325
+ (subvalue) => subvalue.startsWith(`${subs}=`)
326
+ );
327
+ if (i !== -1) {
328
+ v.splice(i, 1);
329
+ if (v.length === 0) delete data[k];
330
+ didSomething = true;
331
+ }
332
+ } else {
333
+ if (v[subs] !== void 0) {
334
+ delete v[subs];
335
+ if (Object.keys(v).length === 0) delete data[k];
336
+ didSomething = true;
337
+ }
338
+ }
339
+ } else {
340
+ didSomething = true;
341
+ delete data[k];
342
+ }
343
+ }
344
+ const d = stringify(data);
345
+ if (d.trim() === "{}") {
346
+ rmSync(file, { force: true });
347
+ } else {
348
+ writeFileSync(file, stringify(data));
349
+ }
350
+ return didSomething;
351
+ }
352
+ /**
353
+ * Edit the user or project configuration file.
354
+ *
355
+ * If the file isn't present, then it starts with `{}` so the user has
356
+ * something to work with.
357
+ *
358
+ * If the result is not valid, or no config settings are contained in the
359
+ * file after editing, then it's restored to what it was before, which might
360
+ * mean deleting the file.
361
+ */
362
+ async editConfigFile(which, edit) {
363
+ const file = this.getFilename(which);
364
+ const backup = this.configFiles[file];
365
+ if (!backup) {
366
+ writeFileSync(file, "{\n\n}\n");
367
+ }
368
+ let valid = false;
369
+ try {
370
+ await edit(file);
371
+ const res = parse(readFileSync(file, "utf8"));
372
+ if (!res || typeof res !== "object" || Array.isArray(res)) {
373
+ throw error("Invalid configuration, expected object", {
374
+ path: file,
375
+ found: res
376
+ });
377
+ }
378
+ if (Object.keys(res).length === 0) {
379
+ delete this.configFiles[file];
380
+ rmSync(file, { force: true });
381
+ } else {
382
+ this.jack.setConfigValues(recordsToPairs(res));
383
+ this.configFiles[file] = res;
384
+ }
385
+ valid = true;
386
+ } finally {
387
+ if (!valid) {
388
+ if (backup) {
389
+ writeFileSync(file, stringify(backup));
390
+ } else {
391
+ rmSync(file, { force: true });
392
+ }
393
+ }
394
+ }
395
+ }
396
+ /**
397
+ * Find the local config file and load both it and the user-level config in
398
+ * the XDG config home.
399
+ *
400
+ * Note: if working in a workspaces monorepo, then the vlt.json file MUST
401
+ * be in the same folder as the vlt-workspaces.json file, because we stop
402
+ * looking when we find either one.
403
+ */
404
+ async loadConfigFile() {
405
+ const userConfig = xdg.config("vlt.json");
406
+ await this.#maybeLoadConfigFile(userConfig);
407
+ let lastKnownRoot = resolve(this.projectRoot);
408
+ for (const dir of walkUp(this.projectRoot)) {
409
+ if (dir === home) break;
410
+ const projectConfig = resolve(dir, "vlt.json");
411
+ if (projectConfig === userConfig) break;
412
+ if (await exists(projectConfig) && await this.#maybeLoadConfigFile(projectConfig)) {
413
+ lastKnownRoot = dir;
414
+ break;
415
+ }
416
+ const [hasPackage, hasModules, hasWorkspaces, hasGit] = await Promise.all([
417
+ exists(resolve(dir, "package.json")),
418
+ exists(resolve(dir, "node_modules")),
419
+ exists(resolve(dir, "vlt-workspaces.json")),
420
+ exists(resolve(dir, ".git"))
421
+ ]);
422
+ if (hasPackage || hasModules || hasWorkspaces) {
423
+ lastKnownRoot = dir;
424
+ }
425
+ if (hasWorkspaces || hasGit) {
426
+ break;
427
+ }
428
+ }
429
+ this.projectRoot = lastKnownRoot;
430
+ return this;
431
+ }
432
+ /**
433
+ * Determine whether we should use colors in the output. Update
434
+ * chalk appropriately.
435
+ *
436
+ * Implicitly calls this.parse() if it not parsed already.
437
+ */
438
+ async loadColor() {
439
+ const c = this.get("color");
440
+ const chalk = (await import("./source-M7VNOG6F.js")).default;
441
+ let color;
442
+ if (process.env.NO_COLOR !== "1" && (c === true || c === void 0 && chalk.level > 0)) {
443
+ color = true;
444
+ chalk.level = Math.max(chalk.level, 1);
445
+ process.env.FORCE_COLOR = String(chalk.level);
446
+ delete process.env.NO_COLOR;
447
+ } else {
448
+ color = false;
449
+ chalk.level = 0;
450
+ process.env.FORCE_COLOR = "0";
451
+ process.env.NO_COLOR = "1";
452
+ }
453
+ const { values = this.parse().values } = this;
454
+ values.color = color;
455
+ return this;
456
+ }
457
+ /**
458
+ * cache of the loaded config
459
+ */
460
+ static #loaded;
461
+ /**
462
+ * Load the configuration and return a Promise to a
463
+ * {@link Config} object
464
+ */
465
+ static async load(projectRoot = process.cwd(), argv = process.argv, reload = false) {
466
+ if (this.#loaded && !reload) return this.#loaded;
467
+ const a = new _Config(definition, projectRoot);
468
+ const b = await a.loadConfigFile();
469
+ const c = await b.parse(argv).loadColor();
470
+ this.#loaded = c;
471
+ return this.#loaded;
472
+ }
473
+ };
474
+ var isParsed = (c) => !!(c.values && c.positionals && c.command);
475
+
476
+ export {
477
+ pairsToRecords,
478
+ recordsToPairs,
479
+ Config
480
+ };
481
+ //# sourceMappingURL=chunk-Y2VHVDFQ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/vlt/src/config/index.ts", "../../src/vlt/src/config/merge.ts"],
4
+ "sourcesContent": ["/**\n * Module that handles all vlt configuration needs\n *\n * Project-level configs are set in a `vlt.json` file in the local project\n * if present. This will override the user-level configs in the appropriate\n * XDG config path.\n *\n * Command-specific configuration can be specified by putting options in a\n * field in the `command` object. For example:\n *\n * ```json\n * {\n * \"registry\": \"https://registry.npmjs.org/\",\n * \"command\": {\n * \"publish\": {\n * \"registry\": \"http://registry.internal\"\n * }\n * }\n * }\n * ```\n * @module\n */\n\nimport { error } from '@vltpkg/error-cause'\nimport { PackageJson } from '@vltpkg/package-json'\nimport { Monorepo } from '@vltpkg/workspaces'\nimport { XDG } from '@vltpkg/xdg'\nimport { readFileSync, rmSync, writeFileSync } from 'fs'\nimport { lstat, mkdir, readFile, writeFile } from 'fs/promises'\nimport type { Jack, OptionsResults, Unwrap } from 'jackspeak'\nimport { homedir } from 'os'\nimport { dirname, resolve } from 'path'\nimport { PathScurry } from 'path-scurry'\nimport {\n kIndent,\n kNewline,\n parse as jsonParse,\n stringify as jsonStringify,\n} from 'polite-json'\nimport type { JSONResult } from 'polite-json'\nimport { walkUp } from 'walk-up-path'\nimport {\n commands,\n definition,\n getCommand,\n isRecordField,\n recordFields,\n} from './definition.ts'\nimport type { Commands, RecordField } from './definition.ts'\nimport { merge } from './merge.ts'\nexport { recordFields, isRecordField }\nexport { definition, commands, type Commands }\n\nexport type RecordPairs = Record<string, unknown>\nexport type RecordString = Record<string, string>\nexport type ConfigFiles = Record<string, ConfigFileData>\n\n// turn a set of pairs into a Record object.\n// if a kv pair doesn't have a = character, set to `''`\nconst reducePairs = <T extends string[]>(\n pairs: T,\n): RecordString | T => {\n const record: RecordString = {}\n for (const kv of pairs) {\n const eq = kv.indexOf('=')\n if (eq === -1) record[kv] = ''\n else {\n const key = kv.substring(0, eq)\n const val = kv.substring(eq + 1)\n record[key] = val\n }\n }\n return record\n}\n\nconst isRecordFieldValue = (k: string, v: unknown): v is string[] =>\n Array.isArray(v) &&\n recordFields.includes(k as (typeof recordFields)[number])\n\nexport type PairsAsRecords = Omit<\n ConfigOptions,\n 'projectRoot' | 'scurry' | 'packageJson' | 'monorepo'\n> & {\n command?: Record<string, ConfigOptions>\n}\n\nexport const pairsToRecords = (\n obj: ConfigFileData,\n): PairsAsRecords => {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => [\n k,\n k === 'command' && v && typeof v === 'object' ?\n Object.fromEntries(\n Object.entries(v).map(([k, v]) => [\n k,\n pairsToRecords(v as ConfigFileData),\n ]),\n )\n : isRecordFieldValue(k, v) ? reducePairs(v)\n : v,\n ]),\n // hard cast because TS can't see through the entries/fromEntries\n ) as unknown as PairsAsRecords\n}\n\nexport const recordsToPairs = (obj: RecordPairs): RecordPairs => {\n return Object.fromEntries(\n Object.entries(obj)\n .filter(\n ([k]) =>\n !(\n k === 'scurry' ||\n k === 'packageJson' ||\n k === 'monorepo' ||\n k === 'projectRoot'\n ),\n )\n .map(([k, v]) => [\n k,\n k === 'command' && v && typeof v === 'object' ?\n recordsToPairs(v as RecordPairs)\n : (\n !v ||\n typeof v !== 'object' ||\n Array.isArray(v) ||\n !isRecordField(k)\n ) ?\n v\n : Object.entries(v).map(([k, v]) => `${k}=${v}`),\n ]),\n )\n}\n\nconst kRecord = Symbol('parsed key=value record')\nconst exists = (f: string) =>\n lstat(f).then(\n () => true,\n () => false,\n )\n\nconst home = homedir()\nconst xdg = new XDG('vlt')\n\n/**\n * Config data can be any options, and also a 'command' field which\n * contains command names and override options for that command.\n */\nexport type ConfigData = OptionsResults<ConfigDefinitions> & {\n command?: Record<string, OptionsResults<ConfigDefinitions>>\n}\n\n/**\n * Config data as it appears in config files, with kv pair lists\n * stored as `Record<string, string>`.\n */\nexport type ConfigFileData = {\n [k in keyof ConfigData]?: k extends OptListKeys<ConfigData> ?\n RecordString | string[]\n : k extends 'command' ? ConfigFiles\n : ConfigData[k]\n}\n\nexport type ConfigOptions = {\n [k in keyof ConfigData]: k extends RecordField ? RecordString\n : k extends 'command' ? never\n : ConfigData[k]\n} & {\n packageJson: PackageJson\n scurry: PathScurry\n projectRoot: string\n monorepo?: Monorepo\n}\n\n/**\n * The base config definition set as a type\n */\nexport type ConfigDefinitions = Unwrap<typeof definition>\n\nexport type StringListKeys<O> = {\n [k in keyof O]: O[k] extends string[] | undefined ? k : never\n}\nexport type OptListKeys<O> = Exclude<\n StringListKeys<O>[keyof StringListKeys<O>],\n undefined\n>\n\n/**\n * Class that handles configuration for vlt.\n *\n * Call {@link Config.load} to get one of these.\n */\nexport class Config {\n /**\n * The {@link https://npmjs.com/jackspeak | JackSpeak} object\n * representing vlt's configuration\n */\n jack: Jack<ConfigDefinitions>\n\n stringifyOptions: {\n [kIndent]: string\n [kNewline]: string\n } = { [kIndent]: ' ', [kNewline]: '\\n' }\n\n configFiles: ConfigFiles = {}\n\n /**\n * Parsed values in effect\n */\n values?: OptionsResults<ConfigDefinitions>\n\n /**\n * Command-specific config values\n */\n commandValues: {\n [cmd in Commands[keyof Commands]]?: ConfigData\n } = {}\n\n /**\n * A flattened object of the parsed configuration\n */\n get options(): ConfigOptions {\n if (this.#options) return this.#options\n const scurry = new PathScurry(this.projectRoot)\n const packageJson = new PackageJson()\n this.#options = Object.assign(\n pairsToRecords(this.parse().values),\n {\n projectRoot: this.projectRoot,\n scurry,\n packageJson,\n monorepo: Monorepo.maybeLoad(this.projectRoot, {\n scurry,\n packageJson,\n }),\n },\n )\n\n return this.#options\n }\n\n /**\n * Reset the options value, optionally setting a new project root\n * to recalculate the options.\n */\n resetOptions(projectRoot: string = process.cwd()) {\n this.projectRoot = projectRoot\n this.#options = undefined\n }\n\n // memoized options() getter value\n #options?: ConfigOptions\n\n /**\n * positional arguments to the vlt process\n */\n positionals?: string[]\n\n /**\n * The root of the project where a vlt.json, vlt-workspaces.json,\n * package.json, or .git was found. Not necessarily the `process.cwd()`,\n * though that is the default location.\n *\n * Never walks up as far as `$HOME`. So for example, if a project is in\n * `~/projects/xyz`, then the highest dir it will check is `~/projects`\n */\n projectRoot: string\n\n /**\n * `Record<alias, canonical name>` to dereference command aliases.\n */\n commands: Commands\n\n /**\n * Which command name to use for overriding with command-specific values,\n * determined from the argv when parse() is called.\n */\n command?: Commands[keyof Commands]\n\n constructor(\n jack: Jack<ConfigDefinitions> = definition,\n projectRoot = process.cwd(),\n ) {\n this.projectRoot = projectRoot\n this.commands = commands\n this.jack = jack\n }\n\n /**\n * Parse the arguments and set configuration and positionals accordingly.\n */\n parse(args: string[] = process.argv): this & ParsedConfig {\n if (isParsed(this)) return this\n\n this.jack.loadEnvDefaults()\n const p = this.jack.parseRaw(args)\n\n const fallback = getCommand(p.values['fallback-command'])\n this.command = getCommand(p.positionals[0])\n\n const cmdOrFallback = this.command ?? fallback\n const cmdSpecific =\n cmdOrFallback && this.commandValues[cmdOrFallback]\n if (cmdSpecific) {\n this.jack.setConfigValues(recordsToPairs(cmdSpecific))\n }\n\n // ok, applied cmd-specific defaults, do rest of the parse\n this.jack.applyDefaults(p)\n this.jack.writeEnv(p)\n\n if (this.command) p.positionals.shift()\n else this.command = getCommand(p.values['fallback-command'])\n\n Object.assign(this, p)\n\n /* c8 ignore start - unpossible */\n if (!isParsed(this)) throw error('failed to parse config')\n /* c8 ignore stop */\n\n return this\n }\n\n /**\n * Get a `key=value` list option value as an object.\n *\n * For example, a list option with a vlaue of `['key=value', 'xyz=as=df' ]`\n * would be returned as `{key: 'value', xyz: 'as=df'}`\n *\n * Results are memoized, so subsequent calls for the same key will return the\n * same object. If new strings are added to the list, then the memoized value\n * is *not* updated, so only use once configurations have been fully loaded.\n *\n * If the config value is not set at all, an empty object is returned.\n */\n getRecord(k: OptListKeys<ConfigData>): RecordString {\n const pairs = this.get(k) as\n | (string[] & { [kRecord]?: RecordString })\n | undefined\n if (!pairs) return {}\n if (pairs[kRecord]) return pairs[kRecord]\n const kv = pairs.reduce((kv: RecordString, pair) => {\n const eq = pair.indexOf('=')\n if (eq === -1) return kv\n const key = pair.substring(0, eq)\n const val = pair.substring(eq + 1)\n kv[key] = val\n return kv\n }, {})\n Object.assign(pairs, { [kRecord]: kv })\n return kv\n }\n\n /**\n * Get a configuration value.\n *\n * Note: `key=value` pair configs are returned as a string array. To get them\n * as an object, use {@link Config#getRecord}.\n */\n get<K extends keyof OptionsResults<ConfigDefinitions>>(\n k: K,\n ): OptionsResults<ConfigDefinitions>[K] {\n /* c8 ignore next -- impossible but TS doesn't know that */\n return (this.values ?? this.parse().values)[k]\n }\n\n /**\n * Write the config values to the user or project config file.\n */\n async writeConfigFile(\n which: 'project' | 'user',\n values: ConfigFileData,\n ) {\n const f = this.getFilename(which)\n await mkdir(dirname(f), { recursive: true })\n const vals = Object.assign(\n pairsToRecords(values),\n this.stringifyOptions,\n )\n await writeFile(f, jsonStringify(vals))\n this.configFiles[f] = vals\n return values\n }\n\n /**\n * Fold in the provided fields with the existing properties\n * in the config file.\n */\n async addConfigToFile(\n which: 'project' | 'user',\n values: ConfigFileData,\n ) {\n const f = this.getFilename(which)\n return this.writeConfigFile(\n which,\n merge((await this.#maybeLoadConfigFile(f)) ?? {}, values),\n )\n }\n\n /**\n * if the file exists, parse and load it. returns object if data was\n * loaded, or undefined if not.\n */\n async #maybeLoadConfigFile(\n file: string,\n ): Promise<ConfigFileData | undefined> {\n const result = await this.#readConfigFile(file)\n\n if (result) {\n try {\n const { command, ...values } = recordsToPairs(result)\n if (command) {\n for (const [c, opts] of Object.entries(command)) {\n const cmd = getCommand(c)\n if (cmd) {\n this.commandValues[cmd] = merge<ConfigData>(\n this.commandValues[cmd] ?? ({} as ConfigData),\n opts as ConfigData,\n )\n }\n }\n }\n this.jack.setConfigValues(values, file)\n return result\n } catch (er) {\n throw error('failed to load config values from file', {\n path: file,\n cause: er,\n })\n }\n }\n }\n\n async #readConfigFile(\n file: string,\n ): Promise<ConfigFileData | undefined> {\n if (this.configFiles[file]) return this.configFiles[file]\n const data = await readFile(file, 'utf8').catch(() => {})\n if (!data) return undefined\n let result: JSONResult\n try {\n result = jsonParse(data)\n if (result && typeof result === 'object') {\n if (result[kIndent] !== undefined)\n this.stringifyOptions[kIndent] = result[kIndent]\n if (result[kNewline] !== undefined)\n this.stringifyOptions[kNewline] = result[kNewline]\n }\n } catch (er) {\n throw error('failed to parse vlt config file', {\n path: file,\n cause: er,\n })\n }\n this.configFiles[file] = result as ConfigFileData\n return result as ConfigFileData\n }\n\n getFilename(which: 'project' | 'user' = 'project'): string {\n return which === 'user' ?\n xdg.config('vlt.json')\n : resolve(this.projectRoot, 'vlt.json')\n }\n\n async deleteConfigKeys(\n which: 'project' | 'user',\n fields: string[],\n ) {\n const file = this.getFilename(which)\n const data = await this.#maybeLoadConfigFile(file)\n if (!data) {\n rmSync(file, { force: true })\n return false\n }\n let didSomething = false\n for (const f of fields) {\n const [key, ...sk] = f.split('.') as [\n h: string,\n ...rest: string[],\n ]\n const subs = sk.join('.')\n const k = key as keyof ConfigDefinitions\n const v = data[k]\n if (v === undefined) continue\n if (subs && v && typeof v === 'object') {\n if (Array.isArray(v)) {\n const i = v.findIndex(subvalue =>\n subvalue.startsWith(`${subs}=`),\n )\n if (i !== -1) {\n v.splice(i, 1)\n if (v.length === 0) delete data[k]\n didSomething = true\n }\n } else {\n if (v[subs] !== undefined) {\n delete v[subs]\n if (Object.keys(v).length === 0) delete data[k]\n didSomething = true\n }\n }\n } else {\n didSomething = true\n delete data[k]\n }\n }\n const d = jsonStringify(data)\n if (d.trim() === '{}') {\n rmSync(file, { force: true })\n } else {\n writeFileSync(file, jsonStringify(data))\n }\n return didSomething\n }\n\n /**\n * Edit the user or project configuration file.\n *\n * If the file isn't present, then it starts with `{}` so the user has\n * something to work with.\n *\n * If the result is not valid, or no config settings are contained in the\n * file after editing, then it's restored to what it was before, which might\n * mean deleting the file.\n */\n async editConfigFile(\n which: 'project' | 'user',\n edit: (file: string) => Promise<void> | void,\n ) {\n const file = this.getFilename(which)\n const backup = this.configFiles[file]\n if (!backup) {\n writeFileSync(file, '{\\n\\n}\\n')\n }\n let valid = false\n try {\n await edit(file)\n const res = jsonParse(readFileSync(file, 'utf8'))\n if (!res || typeof res !== 'object' || Array.isArray(res)) {\n throw error('Invalid configuration, expected object', {\n path: file,\n found: res,\n })\n }\n if (Object.keys(res).length === 0) {\n // nothing there, remove file\n delete this.configFiles[file]\n rmSync(file, { force: true })\n } else {\n this.jack.setConfigValues(recordsToPairs(res))\n this.configFiles[file] = res as ConfigFileData\n }\n valid = true\n } finally {\n if (!valid) {\n if (backup) {\n writeFileSync(file, jsonStringify(backup))\n } else {\n rmSync(file, { force: true })\n }\n }\n }\n }\n\n /**\n * Find the local config file and load both it and the user-level config in\n * the XDG config home.\n *\n * Note: if working in a workspaces monorepo, then the vlt.json file MUST\n * be in the same folder as the vlt-workspaces.json file, because we stop\n * looking when we find either one.\n */\n async loadConfigFile(): Promise<this> {\n const userConfig = xdg.config('vlt.json')\n await this.#maybeLoadConfigFile(userConfig)\n\n let lastKnownRoot = resolve(this.projectRoot)\n for (const dir of walkUp(this.projectRoot)) {\n // don't look in ~\n if (dir === home) break\n\n // finding a project config file stops the search\n const projectConfig = resolve(dir, 'vlt.json')\n if (projectConfig === userConfig) break\n if (\n (await exists(projectConfig)) &&\n (await this.#maybeLoadConfigFile(projectConfig))\n ) {\n lastKnownRoot = dir\n break\n }\n\n // stat existence of these files\n const [hasPackage, hasModules, hasWorkspaces, hasGit] =\n await Promise.all([\n exists(resolve(dir, 'package.json')),\n exists(resolve(dir, 'node_modules')),\n exists(resolve(dir, 'vlt-workspaces.json')),\n exists(resolve(dir, '.git')),\n ])\n\n // treat these as potential roots\n if (hasPackage || hasModules || hasWorkspaces) {\n lastKnownRoot = dir\n }\n\n // define backstops\n if (hasWorkspaces || hasGit) {\n break\n }\n }\n this.projectRoot = lastKnownRoot\n return this\n }\n\n /**\n * Determine whether we should use colors in the output. Update\n * chalk appropriately.\n *\n * Implicitly calls this.parse() if it not parsed already.\n */\n async loadColor(): Promise<this & LoadedConfig> {\n const c = this.get('color')\n const chalk = (await import('chalk')).default\n let color: boolean\n if (\n process.env.NO_COLOR !== '1' &&\n (c === true || (c === undefined && chalk.level > 0))\n ) {\n color = true\n chalk.level = Math.max(chalk.level, 1) as 0 | 1 | 2 | 3\n process.env.FORCE_COLOR = String(chalk.level)\n delete process.env.NO_COLOR\n } else {\n color = false\n chalk.level = 0\n process.env.FORCE_COLOR = '0'\n process.env.NO_COLOR = '1'\n }\n const { values = this.parse().values } = this\n ;(values as ConfigData & { color: boolean }).color = color\n return this as this & LoadedConfig\n }\n\n /**\n * cache of the loaded config\n */\n static #loaded: LoadedConfig | undefined\n\n /**\n * Load the configuration and return a Promise to a\n * {@link Config} object\n */\n static async load(\n projectRoot = process.cwd(),\n argv = process.argv,\n /**\n * only used in tests, resets the memoization\n * @internal\n */\n reload = false,\n ): Promise<LoadedConfig> {\n if (this.#loaded && !reload) return this.#loaded\n const a = new Config(definition, projectRoot)\n const b = await a.loadConfigFile()\n const c = await b.parse(argv).loadColor()\n this.#loaded = c as LoadedConfig\n return this.#loaded\n }\n}\n\nconst isParsed = (c: Config): c is ParsedConfig =>\n !!(c.values && c.positionals && c.command)\n\nexport type ParsedConfig = Config & {\n command: NonNullable<Config['command']>\n values: OptionsResults<ConfigDefinitions>\n positionals: string[]\n}\n\n/**\n * A fully loaded {@link Config} object\n */\nexport type LoadedConfig = ParsedConfig & {\n get(k: 'color'): boolean\n}\n", "/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n\n// deep merge 2 objects\n// scalars are overwritten, objects are folded in together\n// if nothing to be added, then return the base object.\nexport const merge = <T extends Record<string, any>>(\n base: T,\n add: T,\n): T =>\n Object.fromEntries(\n Object.entries(base)\n .map(([k, v]) => [\n k,\n add[k] === undefined ? v\n : Array.isArray(v) && Array.isArray(add[k]) ?\n [...new Set([...v, ...add[k]])]\n : Array.isArray(v) || Array.isArray(add[k]) ? add[k]\n : (\n !!v &&\n typeof v === 'object' &&\n !!add[k] &&\n typeof add[k] === 'object'\n ) ?\n merge(v, add[k])\n : add[k],\n ])\n .concat(\n // already merged together if existing, so just get new additions\n Object.entries(add).filter(([k]) => base[k] === undefined),\n ),\n ) as T\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,cAAc,QAAQ,qBAAqB;AACpD,SAAS,OAAO,OAAO,UAAU,iBAAiB;AAElD,SAAS,eAAe;AACxB,SAAS,SAAS,eAAe;;;ACzB1B,IAAM,QAAQ,CACnB,MACA,QAEA,OAAO;AAAA,EACL,OAAO,QAAQ,IAAI,EAChB,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM;AAAA,IACf;AAAA,IACA,IAAI,CAAC,MAAM,SAAY,IACrB,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,IAAI,CAAC,CAAC,IACxC,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAC9B,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAEjD,CAAC,CAAC,KACF,OAAO,MAAM,YACb,CAAC,CAAC,IAAI,CAAC,KACP,OAAO,IAAI,CAAC,MAAM,WAElB,MAAM,GAAG,IAAI,CAAC,CAAC,IACf,IAAI,CAAC;AAAA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