@w5s/configurator-core 1.22.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/block.d.ts
2
1
  export type BlockCommentStyle = '#' | '/*' | '//' | '<!--' | 'auto';
3
2
  export interface BlockMarkerOptions {
4
3
  /**
@@ -59,8 +58,6 @@ export declare function block(options: BlockOptions): Promise<void>;
59
58
  * @param options
60
59
  */
61
60
  export declare function blockSync(options: BlockOptions): void;
62
- //#endregion
63
- //#region src/FileMode.d.ts
64
61
  interface FileMode {
65
62
  /**
66
63
  * Group permissions
@@ -89,8 +86,6 @@ interface FilePermissionSet {
89
86
  */
90
87
  readonly write?: boolean;
91
88
  }
92
- //#endregion
93
- //#region src/directory.d.ts
94
89
  export interface DirectoryOptions {
95
90
  /**
96
91
  * File permissions
@@ -143,8 +138,6 @@ export declare function directory(options: DirectoryOptions): Promise<void>;
143
138
  * @param options
144
139
  */
145
140
  export declare function directorySync(options: DirectoryOptions): void;
146
- //#endregion
147
- //#region src/file.d.ts
148
141
  export interface FileOptions {
149
142
  /**
150
143
  * File encoding
@@ -208,8 +201,6 @@ export declare function file(options: FileOptions): Promise<void>;
208
201
  * @param options
209
202
  */
210
203
  export declare function fileSync(options: FileOptions): void;
211
- //#endregion
212
- //#region src/ignoreFile.d.ts
213
204
  export interface IgnoreFileOptions extends Omit<FileOptions, 'update'> {
214
205
  /**
215
206
  * File content mapping function where content is represented as lines.
@@ -243,8 +234,6 @@ export declare function ignoreFile(options: IgnoreFileOptions): Promise<void>;
243
234
  * @param options File target options.
244
235
  */
245
236
  export declare function ignoreFileSync(options: IgnoreFileOptions): void;
246
- //#endregion
247
- //#region src/isConfigPresent.d.ts
248
237
  export interface IsConfigPresentOptions {
249
238
  /**
250
239
  * The name of the application.
@@ -273,8 +262,6 @@ export interface IsConfigPresentOptions {
273
262
  */
274
263
  export declare function isConfigPresent(options: IsConfigPresentOptions): Promise<boolean>;
275
264
  export declare function isConfigPresentSync(options: IsConfigPresentOptions): boolean;
276
- //#endregion
277
- //#region src/json.d.ts
278
265
  export interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {
279
266
  /**
280
267
  * File content mapping function
@@ -296,15 +283,23 @@ export declare function json<Value>(options: JSONOption<Value>): Promise<void>;
296
283
  * @param options
297
284
  */
298
285
  export declare function jsonSync<Value>(options: JSONOption<Value>): void;
299
- //#endregion
300
- //#region src/meta.d.ts
301
286
  export declare const meta: Readonly<{
302
287
  buildNumber: number;
303
288
  name: string;
304
289
  version: string;
305
290
  }>;
306
- //#endregion
307
- //#region src/yaml.d.ts
291
+ /**
292
+ * Regular expression to split tool and version
293
+ */
294
+ export type ToolVersions = Record<string, string>;
295
+ export interface ToolVersionsOption extends Omit<FileOptions, 'path' | 'update'>, Partial<Pick<FileOptions, 'path'>> {
296
+ /**
297
+ * File content mapping function
298
+ */
299
+ readonly update?: ((content: ToolVersions | undefined) => ToolVersions | undefined) | undefined;
300
+ }
301
+ export declare function toolVersions(options: ToolVersionsOption): Promise<void>;
302
+ export declare function toolVersionsSync(options: ToolVersionsOption): void;
308
303
  export interface YAMLOption<V = YAMLValue> extends Omit<FileOptions, 'update'> {
309
304
  /**
310
305
  * File content mapping function
@@ -326,8 +321,6 @@ export declare function yaml<Value>(options: YAMLOption<Value>): Promise<void>;
326
321
  * @param options
327
322
  */
328
323
  export declare function yamlSync<Value>(options: YAMLOption<Value>): void;
329
- //#endregion
330
- //#region src/yarnConfig.d.ts
331
324
  export interface YarnConfigOptions {
332
325
  /**
333
326
  * Configuration key
@@ -367,8 +360,6 @@ export declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
367
360
  * })
368
361
  */
369
362
  export declare function yarnConfigSync(options: YarnConfigOptions): void;
370
- //#endregion
371
- //#region src/yarnVersion.d.ts
372
363
  export type YarnVersionKind = 'berry' | 'classic';
373
364
  export interface YarnVersionOptions {
374
365
  /**
@@ -403,6 +394,5 @@ export declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
403
394
  * })
404
395
  */
405
396
  export declare function yarnVersionSync(options: YarnVersionOptions): void;
406
- //#endregion
407
397
  export {};
408
398
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/block.ts","../src/FileMode.ts","../src/directory.ts","../src/file.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/yaml.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"mappings":";YAGY;iBAEK;;;;;;;EAOf,eAAe;;;;;;EAOf;;iBAGe;;;;EAIf;;;;EAKA,yCAAyC,yCAAyC;;;;;;EAOlF,WAAW,oCAAoC;;;;EAK/C;;;;EAKA;;;;;;;;;;;wBAkCc,MAAM,SAAS,eAAY;;;;;;;;;;wBAa3B,UAAU,SAAS;;;UC/FlB;;;;WAIN,QAAQ;;;;WAKR,QAAQ;;;;WAKR,QAAQ;;UAGF;;;;WAIN;;;;WAKA;;;;WAKA;;;;iBCtBM;;;;WAIN,OAAO;;;;WAKP;;;;WAKA;;;;;;;;;;;;;;;;;;;;wBAqBW,UAAU,SAAS,mBAAmB;;;;;;;;;;;;;;;;;;;wBAkC5C,cAAc,SAAS;;;iBCrEtB;;;;WAIN,WAAW;;;;WAKX,OAAO;;;;WAKP;;;;WAKA;;;;;WAMA,WAAW;;;;;;;;;;;;;;;;;;;;;wBAsBA,KAAK,SAAS,cAAc;;;;;;;;;;;;;;;;;;;;wBAqClC,SAAS,SAAS;;;iBC3FjB,0BAA0B,KAAK;;;;;WAKrC,WAAW,SAAS,8BAA8B;;;;;;;;;;;;;;wBAevC,WAAW,SAAS,oBAAoB;;;;;;;;;;;;;wBAgB9C,eAAe,SAAS;;;iBC7BvB;;;;EAIf;;;;EAKA;;;;EAKA,aAAa;;;;EAKb;;;;;;;;;;wBAWoB,gBAAgB,SAAS,yBAAyB;wBAWxD,oBAAoB,SAAS;;;iBChD5B,WAAW,IAAI,mBAAmB,KAAK;;;;WAI7C,WAAW,qBAAqB,kBAAkB;;YAGjD,YAAY,MAAM;GAAmD,cAAc;;;;;;;wBAOzE,KAAK,OAAO,SAAS,WAAW,SAAS;;;;;;wBAS/C,SAAS,OAAO,SAAS,WAAW;;;qBCzBvC,MAAI;EAEkF;EAEtB;EAES;;;;iBCFrE,WAAW,IAAI,mBAAmB,KAAK;;;;WAI7C,WAAW,qBAAqB,kBAAkB;;YAGjD,YAAY,MAAM;GAAmD,cAAc;;;;;;;wBAOzE,KAAK,OAAO,SAAS,WAAW,SAAS;;;;;;wBAS/C,SAAS,OAAO,SAAS,WAAW;;;iBCzBnC;;;;WAIN;;;;WAKA;;;;;WAMA,WAAW;;;;;;;;;;;;;wBAcA,WAAW,SAAS,oBAAoB;;;;;;;;;;;;wBAqB9C,eAAe,SAAS;;;YClD5B;iBAEK;;;;WAIN;;;;;WAMA,4BAA4B;;;;;;;;;;;;wBAajB,YAAY,SAAS,qBAAqB;;;;;;;;;;;wBAoBhD,gBAAgB,SAAS"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/block.ts","../src/FileMode.ts","../src/directory.ts","../src/file.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/toolVersions.ts","../src/yaml.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"mappings":"A,YAGY;iBAEK;;;;;;;EAOf,eAAe;;;;;;EAOf;;iBAGe;;;;EAIf;;;;EAKA,yCAAyC,yCAAyC;;;;;;EAOlF,WAAW,oCAAoC;;;;EAK/C;;;;EAKA;;;;;;;;;;;wBAkCc,MAAM,SAAS,eAAY;;;;;;;;;;wBAa3B,UAAU,SAAS;UC/FlB;;;;WAIN,QAAQ;;;;WAKR,QAAQ;;;;WAKR,QAAQ;;UAGF;;;;WAIN;;;;WAKA;;;;WAKA;;iBCtBM;;;;WAIN,OAAO;;;;WAKP;;;;WAKA;;;;;;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B;;;;;;;;;;;;wBAajB,YAAY,SAAS,qBAAqB;;;;;;;;;;;wBAoBhD,gBAAgB,SAAS"}
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import { access, chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises"
3
3
  import nodePath from "node:path";
4
4
  import YAML from "yaml";
5
5
  import { spawn, spawnSync } from "node:child_process";
6
- //#region src/__exists.ts
7
- async function __exists(path) {
6
+ // src/internal/fileExists.ts
7
+ async function fileExists(path) {
8
8
  try {
9
9
  await access(path, constants.F_OK);
10
10
  return true;
@@ -12,9 +12,8 @@ async function __exists(path) {
12
12
  return false;
13
13
  }
14
14
  }
15
- //#endregion
16
- //#region src/__existsSync.ts
17
- function __existsSync(path) {
15
+ // src/internal/fileExistsSync.ts
16
+ function fileExistsSync(path) {
18
17
  try {
19
18
  accessSync(path, constants.F_OK);
20
19
  return true;
@@ -22,16 +21,14 @@ function __existsSync(path) {
22
21
  return false;
23
22
  }
24
23
  }
25
- //#endregion
26
- //#region src/__toMode.ts
27
- function __toMode(mode) {
24
+ // src/internal/toMode.ts
25
+ function toMode(mode) {
28
26
  return mode == null ? mode : toModeFlag(mode.owner, 256, 128, 64) | toModeFlag(mode.group, 32, 16, 8) | toModeFlag(mode.other, 4, 2, 1);
29
27
  }
30
28
  function toModeFlag(permissionSet, read, write, execute) {
31
29
  return (permissionSet?.read === true ? read : 0) | (permissionSet?.write === true ? write : 0) | (permissionSet?.execute === true ? execute : 0);
32
30
  }
33
- //#endregion
34
- //#region src/file.ts
31
+ // src/file.ts
35
32
  /**
36
33
  * Ensure file is present/absent with content initialized or modified with `update
37
34
  *
@@ -54,10 +51,10 @@ function toModeFlag(permissionSet, read, write, execute) {
54
51
  async function file(options) {
55
52
  const { encoding = "utf8", mode, path, state, update } = options;
56
53
  if (state === "present") {
57
- const isPresent = await __exists(path);
54
+ const isPresent = await fileExists(path);
58
55
  const previousContent = isPresent ? await readFile(path, encoding) : "";
59
56
  const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
60
- const newMode = __toMode(mode);
57
+ const newMode = toMode(mode);
61
58
  if (newContent != null) await writeFile(path, newContent, {
62
59
  encoding,
63
60
  mode: newMode
@@ -87,10 +84,10 @@ async function file(options) {
87
84
  function fileSync(options) {
88
85
  const { encoding = "utf8", mode, path, state, update } = options;
89
86
  if (state === "present") {
90
- const isPresent = __existsSync(path);
87
+ const isPresent = fileExistsSync(path);
91
88
  const previousContent = isPresent ? readFileSync(path, encoding) : "";
92
89
  const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
93
- const newMode = __toMode(mode);
90
+ const newMode = toMode(mode);
94
91
  if (newContent != null) writeFileSync(path, newContent, {
95
92
  encoding,
96
93
  mode: newMode
@@ -98,8 +95,7 @@ function fileSync(options) {
98
95
  if (newMode != null && (isPresent || newContent != null)) chmodSync(path, newMode);
99
96
  } else rmSync(path, { force: true });
100
97
  }
101
- //#endregion
102
- //#region src/internal/resolveCommentStyle.ts
98
+ // src/internal/resolveCommentStyle.ts
103
99
  const HASH_BASENAMES = /* @__PURE__ */ new Set([
104
100
  "containerfile",
105
101
  "dockerfile",
@@ -154,8 +150,7 @@ function resolveCommentStyle(path) {
154
150
  if (BLOCK_EXTENSIONS.has(extension)) return "/*";
155
151
  return "#";
156
152
  }
157
- //#endregion
158
- //#region src/block.ts
153
+ // src/block.ts
159
154
  const EOF = "EndOfFile";
160
155
  const BOF = "BeginningOfFile";
161
156
  const DEFAULT_TOPIC = "managed-block";
@@ -264,8 +259,7 @@ function toMarkerFn(marker, path) {
264
259
  const resolvedStyle = commentStyle === "auto" ? resolveCommentStyle(path) : commentStyle;
265
260
  return (mark) => formatMarker(resolvedStyle, mark, topic);
266
261
  }
267
- //#endregion
268
- //#region src/directory.ts
262
+ // src/directory.ts
269
263
  /**
270
264
  * Ensure directory is present/absent
271
265
  *
@@ -286,9 +280,9 @@ function toMarkerFn(marker, path) {
286
280
  */
287
281
  async function directory(options) {
288
282
  const { mode, path, state } = options;
289
- const isPresent = await __exists(path);
283
+ const isPresent = await fileExists(path);
290
284
  if (state === "present") {
291
- const newMode = __toMode(mode);
285
+ const newMode = toMode(mode);
292
286
  if (!isPresent) await mkdir(path, {
293
287
  mode: newMode,
294
288
  recursive: true
@@ -316,9 +310,9 @@ async function directory(options) {
316
310
  */
317
311
  function directorySync(options) {
318
312
  const { mode, path, state } = options;
319
- const isPresent = __existsSync(path);
313
+ const isPresent = fileExistsSync(path);
320
314
  if (state === "present") {
321
- const newMode = __toMode(mode);
315
+ const newMode = toMode(mode);
322
316
  if (!isPresent) mkdirSync(path, {
323
317
  mode: newMode,
324
318
  recursive: true
@@ -326,8 +320,7 @@ function directorySync(options) {
326
320
  if (newMode != null && isPresent) chmodSync(path, newMode);
327
321
  } else if (isPresent) rmSync(path, { recursive: true });
328
322
  }
329
- //#endregion
330
- //#region src/ignoreFile.ts
323
+ // src/ignoreFile.ts
331
324
  /**
332
325
  * Ensure file is present/absent asynchronously with content initialized or modified by line.
333
326
  *
@@ -341,7 +334,7 @@ function directorySync(options) {
341
334
  * @param options File target options.
342
335
  */
343
336
  async function ignoreFile(options) {
344
- return file(toFileOption$2(options));
337
+ return file(toFileOption$3(options));
345
338
  }
346
339
  /**
347
340
  * Ensure file is present/absent synchronously with content initialized or modified by line.
@@ -356,9 +349,9 @@ async function ignoreFile(options) {
356
349
  * @param options File target options.
357
350
  */
358
351
  function ignoreFileSync(options) {
359
- return fileSync(toFileOption$2(options));
352
+ return fileSync(toFileOption$3(options));
360
353
  }
361
- function toFileOption$2({ update, ...otherOptions }) {
354
+ function toFileOption$3({ update, ...otherOptions }) {
362
355
  return {
363
356
  ...otherOptions,
364
357
  update: update == null ? update : (content) => {
@@ -368,8 +361,7 @@ function toFileOption$2({ update, ...otherOptions }) {
368
361
  }
369
362
  };
370
363
  }
371
- //#endregion
372
- //#region src/isConfigPresent.ts
364
+ // src/isConfigPresent.ts
373
365
  const defaultExtensions = [
374
366
  ".json",
375
367
  ".yaml",
@@ -396,8 +388,8 @@ async function isConfigPresent(options) {
396
388
  }
397
389
  function isConfigPresentSync(options) {
398
390
  const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);
399
- for (const candidatePath of candidatePaths) if (__existsSync(candidatePath)) return true;
400
- if (__existsSync(packageJsonPath)) try {
391
+ for (const candidatePath of candidatePaths) if (fileExistsSync(candidatePath)) return true;
392
+ if (fileExistsSync(packageJsonPath)) try {
401
393
  return hasPackageConfigKey(readFileSync(packageJsonPath, "utf8"), packageConfig);
402
394
  } catch {
403
395
  return false;
@@ -405,10 +397,10 @@ function isConfigPresentSync(options) {
405
397
  return false;
406
398
  }
407
399
  async function hasAnyFile(paths) {
408
- return (await Promise.all(paths.map((candidatePath) => __exists(candidatePath)))).some(Boolean);
400
+ return (await Promise.all(paths.map((candidatePath) => fileExists(candidatePath)))).some(Boolean);
409
401
  }
410
402
  async function hasPackageConfigFile(packageJsonPath, packageConfig) {
411
- if (!await __exists(packageJsonPath)) return false;
403
+ if (!await fileExists(packageJsonPath)) return false;
412
404
  try {
413
405
  return hasPackageConfigKey(await readFile(packageJsonPath, "utf8"), packageConfig);
414
406
  } catch {
@@ -428,15 +420,14 @@ function toCandidates({ app, cwd = process.cwd(), extensions = defaultExtensions
428
420
  packageJsonPath: nodePath.join(cwd, "package.json")
429
421
  };
430
422
  }
431
- //#endregion
432
- //#region src/json.ts
423
+ // src/json.ts
433
424
  /**
434
425
  * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
435
426
  *
436
427
  * @param options
437
428
  */
438
429
  async function json(options) {
439
- return file(toFileOption$1(options));
430
+ return file(toFileOption$2(options));
440
431
  }
441
432
  /**
442
433
  * Ensure file is present/absent synchronously with content value initialized or modified with `update`
@@ -444,9 +435,9 @@ async function json(options) {
444
435
  * @param options
445
436
  */
446
437
  function jsonSync(options) {
447
- return fileSync(toFileOption$1(options));
438
+ return fileSync(toFileOption$2(options));
448
439
  }
449
- function toFileOption$1({ update, ...otherOptions }) {
440
+ function toFileOption$2({ update, ...otherOptions }) {
450
441
  return {
451
442
  ...otherOptions,
452
443
  update: update == null ? update : (content) => {
@@ -455,15 +446,40 @@ function toFileOption$1({ update, ...otherOptions }) {
455
446
  }
456
447
  };
457
448
  }
458
- //#endregion
459
- //#region src/meta.ts
449
+ // src/meta.ts
460
450
  const meta = Object.freeze({
461
- buildNumber: 1791883988,
451
+ buildNumber: 0x6b04cca5,
462
452
  name: "@w5s/configurator-core",
463
- version: "1.22.0"
453
+ version: "1.23.0"
464
454
  });
465
- //#endregion
466
- //#region src/yaml.ts
455
+ // src/toolVersions.ts
456
+ const reToolVersion = /\s+/;
457
+ function toolVersions(options) {
458
+ return file(toFileOption$1(options));
459
+ }
460
+ function toolVersionsSync(options) {
461
+ return fileSync(toFileOption$1(options));
462
+ }
463
+ function toFileOption$1({ update, ...otherOptions }) {
464
+ return {
465
+ ...otherOptions,
466
+ path: otherOptions.path ?? ".tool-versions",
467
+ update: update == null ? update : (content) => {
468
+ const eol = "\n";
469
+ const lines = content.split(eol);
470
+ const parsed = Object.fromEntries(function* () {
471
+ for (const line of lines) {
472
+ const [tool, value] = line.split(reToolVersion, 2);
473
+ if (tool) yield [tool, value ?? ""];
474
+ }
475
+ }());
476
+ const updated = update ? update(parsed) : parsed;
477
+ if (updated === void 0) return updated;
478
+ return Object.entries(updated).map(([tool, value]) => `${tool} ${value}`).join(eol);
479
+ }
480
+ };
481
+ }
482
+ // src/yaml.ts
467
483
  /**
468
484
  * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
469
485
  *
@@ -489,8 +505,7 @@ function toFileOption({ update, ...otherOptions }) {
489
505
  }
490
506
  };
491
507
  }
492
- //#endregion
493
- //#region src/exec.ts
508
+ // src/exec.ts
494
509
  /**
495
510
  * Runs a command in a shell and returns a promise that resolves with an object
496
511
  * containing the stdout and stderr strings.
@@ -537,8 +552,7 @@ function execSync(command, args, options) {
537
552
  stdout: result.stdout.toString(encoding)
538
553
  };
539
554
  }
540
- //#endregion
541
- //#region src/yarnConfig.ts
555
+ // src/yarnConfig.ts
542
556
  /**
543
557
  * Set/Unset yarn configuration value
544
558
  *
@@ -601,8 +615,7 @@ function yarnConfigSync(options) {
601
615
  key
602
616
  ]);
603
617
  }
604
- //#endregion
605
- //#region src/yarnVersion.ts
618
+ // src/yarnVersion.ts
606
619
  /**
607
620
  * Set/Unset yarn configuration value
608
621
  *
@@ -641,7 +654,6 @@ function yarnVersionSync(options) {
641
654
  ]);
642
655
  else throw new Error("Not implemented");
643
656
  }
644
- //#endregion
645
- export { block, blockSync, directory, directorySync, file, fileSync, ignoreFile, ignoreFileSync, isConfigPresent, isConfigPresentSync, json, jsonSync, meta, yaml, yamlSync, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
657
+ export { block, blockSync, directory, directorySync, file, fileSync, ignoreFile, ignoreFileSync, isConfigPresent, isConfigPresentSync, json, jsonSync, meta, toolVersions, toolVersionsSync, yaml, yamlSync, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
646
658
 
647
659
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["toFileOption","path","toFileOption"],"sources":["../src/__exists.ts","../src/__existsSync.ts","../src/__toMode.ts","../src/file.ts","../src/internal/resolveCommentStyle.ts","../src/block.ts","../src/directory.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/yaml.ts","../src/exec.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"sourcesContent":["import { constants } from 'node:fs';\nimport { access } from 'node:fs/promises';\n\nexport async function __exists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import { accessSync, constants } from 'node:fs';\n\nexport function __existsSync(path: string) {\n try {\n accessSync(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import type { FileMode, FilePermissionSet } from './FileMode.js';\n\nexport function __toMode(mode: FileMode | undefined): number | undefined {\n return mode == null\n ? mode\n : (\n toModeFlag(mode.owner, 0o400, 0o200, 0o100)\n | toModeFlag(mode.group, 0o040, 0o020, 0o010)\n | toModeFlag(mode.other, 0o004, 0o002, 0o001)\n );\n}\n\nfunction toModeFlag(permissionSet: FilePermissionSet | undefined, read: number, write: number, execute: number): number {\n return (\n (permissionSet?.read === true ? read : 0)\n | (permissionSet?.write === true ? write : 0)\n | (permissionSet?.execute === true ? execute : 0)\n );\n}\n","import { chmodSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { chmod, readFile, rm, writeFile } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { __exists } from './__exists.js';\nimport { __existsSync } from './__existsSync.js';\nimport { __toMode } from './__toMode.js';\n\nexport interface FileOptions {\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * File path\n */\n readonly path: string;\n\n /**\n * File target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * await file({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function file(options: FileOptions): Promise<void> {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = await __exists(path);\n const previousContent = isPresent ? await readFile(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = __toMode(mode);\n if (newContent != null) {\n await writeFile(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n await chmod(path, newMode);\n }\n } else {\n await rm(path, { force: true });\n }\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * fileSync({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function fileSync(options: FileOptions): void {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = __existsSync(path);\n const previousContent = isPresent ? readFileSync(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = __toMode(mode);\n if (newContent != null) {\n writeFileSync(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n chmodSync(path, newMode);\n }\n } else {\n rmSync(path, { force: true });\n }\n}\n","import nodePath from 'node:path';\n\nexport type ResolvedCommentStyle = '#' | '/*' | '//' | '<!--';\n\n/* cspell:ignore containerfile */\nconst HASH_BASENAMES = new Set(['containerfile', 'dockerfile', 'gemfile', 'makefile']);\n\nconst HTML_EXTENSIONS = new Set(['htm', 'html', 'md', 'mdx', 'svg', 'xml']);\nconst LINE_EXTENSIONS = new Set([\n 'c',\n 'cjs',\n 'cpp',\n 'cs',\n 'cts',\n 'go',\n 'h',\n 'java',\n 'js',\n 'jsx',\n 'kt',\n 'mjs',\n 'mts',\n 'rs',\n 'swift',\n 'ts',\n 'tsx',\n]);\nconst BLOCK_EXTENSIONS = new Set(['css', 'less', 'sass', 'scss']);\n\n/**\n * Resolve comment style from the file path when `commentStyle` is `'auto'`.\n *\n * @param path File path used to infer the comment style.\n */\nexport function resolveCommentStyle(path: string): ResolvedCommentStyle {\n const basename = nodePath.basename(path);\n const basenameLower = basename.toLowerCase();\n\n if (basename.startsWith('.') || HASH_BASENAMES.has(basenameLower)) {\n return '#';\n }\n\n const extension = nodePath.extname(basename).slice(1).toLowerCase();\n if (HTML_EXTENSIONS.has(extension)) {\n return '<!--';\n }\n if (LINE_EXTENSIONS.has(extension)) {\n return '//';\n }\n if (BLOCK_EXTENSIONS.has(extension)) {\n return '/*';\n }\n\n // py, rb, sh, toml, yaml, yml, json, no extension, and unknown → #\n return '#';\n}\n","import { file, type FileOptions, fileSync } from './file.js';\nimport { resolveCommentStyle, type ResolvedCommentStyle } from './internal/resolveCommentStyle.js';\n\nexport type BlockCommentStyle = '#' | '/*' | '//' | '<!--' | 'auto';\n\nexport interface BlockMarkerOptions {\n /**\n * Comment opener used for the marker lines: `'auto'` (from file name),\n * `'#'`, `'//'`, slash-star, or `'<!--'`.\n *\n * @default 'auto'\n */\n commentStyle?: BlockCommentStyle;\n\n /**\n * Identity after `BEGIN:` / `END:`, so multiple blocks in one file do not collide.\n *\n * @default 'managed-block'\n */\n topic?: string;\n}\n\nexport interface BlockOptions {\n /**\n * Block content to insert\n */\n block: string;\n\n /**\n * Insert position\n */\n insertPosition?: ['after', 'EndOfFile' | RegExp] | ['before', 'BeginningOfFile' | RegExp];\n\n /**\n * Marker configuration, or a function that returns the full marker line.\n *\n * @default `{ commentStyle: 'auto', topic: 'managed-block' }`\n */\n marker?: ((mark: 'Begin' | 'End') => string) | BlockMarkerOptions;\n\n /**\n * File path\n */\n path: string;\n\n /**\n * Block target state\n */\n state?: 'absent' | 'present';\n}\n\nconst EOF = 'EndOfFile';\nconst BOF = 'BeginningOfFile';\nconst DEFAULT_TOPIC = 'managed-block';\n\nconst insertAt = (str: string, index: number, toInsert: string) => str.slice(0, index) + toInsert + str.slice(index);\nconst matchLast = (string: string, regexp: RegExp) => {\n const matcher = new RegExp(regexp.source, `${regexp.flags}g`);\n let firstIndex = -1;\n let lastIndex = -1;\n let matches;\n\n while (true) {\n matches = matcher.exec(string);\n if (matches == null) {\n break;\n }\n firstIndex = matches.index;\n lastIndex = matcher.lastIndex;\n }\n return { firstIndex, lastIndex };\n};\n\n/**\n * Replace asynchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function block(options: BlockOptions) {\n return file(toFileOptions(options));\n}\n\n/**\n * Replace synchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function blockSync(options: BlockOptions) {\n return fileSync(toFileOptions(options));\n}\n\nfunction formatMarker(style: ResolvedCommentStyle, mark: 'Begin' | 'End', topic: string): string {\n const inner = `${mark.toUpperCase()}:${topic}`;\n switch (style) {\n case '#': {\n return `# ${inner}`;\n }\n case '/*': {\n return `/* ${inner} */`;\n }\n case '//': {\n return `// ${inner}`;\n }\n case '<!--': {\n return `<!-- ${inner} -->`;\n }\n default: {\n throw new Error(`Unsupported comment style ${String(style)}`);\n }\n }\n}\n\nfunction toFileOptions(options: BlockOptions): FileOptions {\n const { block: blockName, insertPosition = ['after', EOF], marker, path, state = 'present' } = options;\n\n const EOL = '\\n';\n const markerFn = toMarkerFn(marker, path);\n const beginBlock = markerFn('Begin');\n const endBlock = markerFn('End');\n\n /**\n * @param content\n */\n function findBlock(content: string) {\n const startIndex = content.indexOf(beginBlock);\n const endIndex = content.indexOf(endBlock) + endBlock.length;\n\n return {\n endIndex,\n exists: startIndex !== -1 && endIndex >= 0,\n startIndex,\n };\n }\n\n function apply(fullContent: string, blockContent: string) {\n const found = findBlock(fullContent);\n const remove = state === 'absent';\n const replaceBlock = remove ? '' : beginBlock + EOL + blockContent + EOL + endBlock;\n const [positionDirection, positionAnchor] = insertPosition;\n\n if (found.exists) {\n return fullContent.slice(0, found.startIndex) + replaceBlock + fullContent.slice(found.endIndex);\n }\n if (remove) {\n return fullContent;\n }\n switch (positionDirection) {\n case 'after': {\n // insert\n if (positionAnchor !== EOF) {\n const { lastIndex } = matchLast(fullContent, positionAnchor);\n if (lastIndex >= 0) {\n return insertAt(fullContent, lastIndex, EOL + replaceBlock);\n }\n }\n\n // end of file\n return fullContent + EOL + replaceBlock;\n }\n case 'before': {\n if (positionAnchor !== BOF) {\n const { firstIndex } = matchLast(fullContent, positionAnchor);\n if (firstIndex >= 0) {\n return insertAt(fullContent, firstIndex, replaceBlock + EOL);\n }\n }\n\n // Beginning of file\n return replaceBlock + EOL + fullContent;\n }\n\n default: {\n throw new Error(`Unsupported position ${String(positionDirection)}`);\n }\n }\n }\n\n return {\n path,\n state: 'present',\n update: (sourceContent) => apply(sourceContent, blockName),\n };\n}\n\nfunction toMarkerFn(marker: BlockOptions['marker'], path: string): (mark: 'Begin' | 'End') => string {\n if (typeof marker === 'function') {\n return marker;\n }\n\n const commentStyle = marker?.commentStyle ?? 'auto';\n const topic = marker?.topic ?? DEFAULT_TOPIC;\n const resolvedStyle = commentStyle === 'auto' ? resolveCommentStyle(path) : commentStyle;\n\n return (mark) => formatMarker(resolvedStyle, mark, topic);\n}\n","import { chmodSync, mkdirSync, rmSync } from 'node:fs';\nimport { chmod, mkdir, rm } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { __exists } from './__exists.js';\nimport { __existsSync } from './__existsSync.js';\nimport { __toMode } from './__toMode.js';\n\nexport interface DirectoryOptions {\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * Directory path\n */\n readonly path: string;\n\n /**\n * Directory target state\n */\n readonly state: 'absent' | 'present';\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * await directory({\n * path: 'foo/bar',\n * state: 'present',\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function directory(options: DirectoryOptions): Promise<void> {\n const { mode, path, state } = options;\n const isPresent = await __exists(path);\n if (state === 'present') {\n const newMode = __toMode(mode);\n if (!isPresent) {\n await mkdir(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n await chmod(path, newMode);\n }\n } else if (isPresent) {\n await rm(path, { recursive: true });\n }\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * directorySync({\n * path: 'foo/bar',\n * state: 'present',\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function directorySync(options: DirectoryOptions): void {\n const { mode, path, state } = options;\n const isPresent = __existsSync(path);\n if (state === 'present') {\n const newMode = __toMode(mode);\n if (!isPresent) {\n mkdirSync(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n chmodSync(path, newMode);\n }\n } else if (isPresent) {\n rmSync(path, { recursive: true });\n }\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface IgnoreFileOptions extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function where content is represented as lines.\n * When the file does not yet exist, the callback receives `undefined`.\n */\n readonly update?: ((content: Array<string> | undefined) => Array<string> | undefined) | undefined;\n}\n\n/**\n * Ensure file is present/absent asynchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * await ignoreFile({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport async function ignoreFile(options: IgnoreFileOptions): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * ignoreFileSync({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport function ignoreFileSync(options: IgnoreFileOptions): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption({ update, ...otherOptions }: IgnoreFileOptions): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const eol = content.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const lines = content === '' ? undefined : content.split(eol);\n const updatedLines = update(lines);\n\n return updatedLines == null ? undefined : updatedLines.join(eol);\n },\n };\n}\n","import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { __exists } from './__exists.js';\nimport { __existsSync } from './__existsSync.js';\n\nconst defaultExtensions: Array<string> = ['.json', '.yaml', '.yml', '.js', '.cjs', '.mjs', '.ts', '.cts', '.mts'];\n\nexport interface IsConfigPresentOptions {\n /**\n * The name of the application.\n */\n app: string;\n\n /**\n * The directory to look into. Defaults to `process.cwd()`.\n */\n cwd?: string | undefined;\n\n /**\n * The list of extensions to check for.\n */\n extensions?: Array<string> | undefined;\n\n /**\n * The name of the package configuration. Defaults to `app`.\n */\n packageConfig?: string | undefined;\n}\n\n/**\n * Return whether tool configuration exists at `cwd` (cosmiconfig-style).\n *\n * Looks for `.{app}rc`, `.{app}rc.{ext}`, `{app}.config.{ext}` and a matching\n * `package.json` key.\n *\n * @param options\n */\nexport async function isConfigPresent(options: IsConfigPresentOptions): Promise<boolean> {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n const [hasConfigFile, hasPackageConfig] = await Promise.all([\n hasAnyFile(candidatePaths),\n hasPackageConfigFile(packageJsonPath, packageConfig),\n ]);\n\n return hasConfigFile || hasPackageConfig;\n}\n\nexport function isConfigPresentSync(options: IsConfigPresentOptions): boolean {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n for (const candidatePath of candidatePaths) {\n if (__existsSync(candidatePath)) {\n return true;\n }\n }\n\n if (__existsSync(packageJsonPath)) {\n try {\n return hasPackageConfigKey(readFileSync(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n }\n\n return false;\n}\n\nasync function hasAnyFile(paths: Array<string>): Promise<boolean> {\n const results = await Promise.all(paths.map((candidatePath) => __exists(candidatePath)));\n\n return results.some(Boolean);\n}\n\nasync function hasPackageConfigFile(packageJsonPath: string, packageConfig: string): Promise<boolean> {\n if (!(await __exists(packageJsonPath))) {\n return false;\n }\n\n try {\n return hasPackageConfigKey(await readFile(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n}\n\nfunction hasPackageConfigKey(packageJsonContent: string, packageConfig: string): boolean {\n const packageJson = JSON.parse(packageJsonContent) as Record<string, unknown>;\n const value = packageJson[packageConfig];\n\n return value !== undefined && value !== null && value !== false;\n}\n\nfunction toCandidates({ app, cwd = process.cwd(), extensions = defaultExtensions, packageConfig = app }: IsConfigPresentOptions) {\n const candidatePaths = [path.join(cwd, `.${app}rc`)];\n for (const extension of extensions) {\n candidatePaths.push(path.join(cwd, `.${app}rc${extension}`), path.join(cwd, `${app}.config${extension}`));\n }\n\n return {\n candidatePaths,\n packageConfig,\n packageJsonPath: path.join(cwd, 'package.json'),\n };\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type JSONValue = Array<JSONValue> | boolean | null | number | string | { [key: string]: JSONValue };\n\n/**\n * Ensure file is present/absent asynchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport async function json<Value>(options: JSONOption<Value>): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport function jsonSync<Value>(options: JSONOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: JSONOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const jsonValue = content === '' ? undefined : (JSON.parse(content) as Value);\n\n return JSON.stringify(update(jsonValue));\n },\n };\n}\n","export const meta = Object.freeze({\n // @ts-ignore - these variables are injected at build time\n buildNumber: (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,\n // @ts-ignore - these variables are injected at build time\n name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,\n // @ts-ignore - these variables are injected at build time\n version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,\n});\n","import YAML from 'yaml';\n\nimport { file, type FileOptions, fileSync } from './file.js';\n\nexport interface YAMLOption<V = YAMLValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type YAMLValue = Array<YAMLValue> | boolean | null | number | string | { [key: string]: YAMLValue };\n\n/**\n * Ensure file is present/absent asynchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport async function yaml<Value>(options: YAMLOption<Value>): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport function yamlSync<Value>(options: YAMLOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: YAMLOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const yamlValue = content === '' ? undefined : (YAML.parse(content) as Value);\n\n return YAML.stringify(update(yamlValue));\n },\n };\n}\n","import { spawn, spawnSync } from 'node:child_process';\n\nexport interface ExecOptions {\n /**\n * Current working directory\n */\n cwd?: string;\n\n /**\n * Stdio options\n */\n stdio?: 'ignore' | 'inherit' | 'pipe';\n}\n\n/**\n * Runs a command in a shell and returns a promise that resolves with an object\n * containing the stdout and stderr strings.\n *\n * @param command The command to run\n * @param args The arguments to pass to the command\n * @param options\n */\nexport async function exec(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): Promise<{ stderr: string; stdout: string }> {\n return new Promise((resolve, reject) => {\n const encoding = 'utf8';\n const child = spawn(command, args, { ...options });\n let stdout = '';\n let stderr = '';\n\n // Capture the stdout and stderr streams\n if (child.stdout != null) {\n child.stdout.on('data', (data) => {\n // eslint-disable-next-line ts/no-unsafe-call, ts/no-unsafe-member-access\n stdout += data.toString(encoding);\n });\n }\n if (child.stderr != null) {\n child.stderr.on('data', (data) => {\n // eslint-disable-next-line ts/no-unsafe-call, ts/no-unsafe-member-access\n stderr += data.toString(encoding);\n });\n }\n // Handle process exit\n child.on('close', (_code) => {\n resolve({ stderr, stdout });\n });\n\n // Handle errors\n child.on('error', reject);\n });\n}\n\n/**\n * Runs a command in a shell and returns a promise that resolves with an object\n * containing the stdout and stderr strings.\n *\n * @param command The command to run\n * @param args The arguments to pass to the command\n * @param options\n * @returns A promise that resolves with an object like `{ stdout: string, stderr: string }`\n */\nexport function execSync(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): { stderr: string; stdout: string } {\n const result = spawnSync(command, args, { ...options });\n const encoding = 'utf8';\n\n return { stderr: result.stderr.toString(encoding), stdout: result.stdout.toString(encoding) };\n}\n","import { exec, execSync } from './exec.js';\n\nexport interface YarnConfigOptions {\n /**\n * Configuration key\n */\n readonly key: string;\n\n /**\n * Option target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\n * @example\n * await yarnConfig({\n * key: 'nodeLinker',\n * state: 'present',\n * update: (content) => content.replace('node-modules', 'hoisted'),\n * })\n */\nexport async function yarnConfig(options: YarnConfigOptions): Promise<void> {\n const { key, state, update } = options;\n if (state === 'present') {\n const { stdout } = await exec('yarn', ['config', 'get', key]);\n await exec('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n await exec('yarn', ['config', 'unset', key]);\n }\n}\n\n/**\n * Synchronous version of {@link yarnConfig}\n *\n * @param options\n * @example\n * yarnConfigSync({\n * key: 'nodeLinker',\n * state: 'present',\n * update: (content) => content.replace('node-modules', 'hoisted'),\n * })\n */\nexport function yarnConfigSync(options: YarnConfigOptions) {\n const { key, state, update } = options;\n if (state === 'present') {\n const { stdout } = execSync('yarn', ['config', 'get', key]);\n execSync('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n execSync('yarn', ['config', 'unset', key]);\n }\n}\n","import { exec, execSync } from './exec.js';\n\nexport type YarnVersionKind = 'berry' | 'classic';\n\nexport interface YarnVersionOptions {\n /**\n * Option target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * Version mapping function\n *\n */\n readonly update?: (() => undefined | YarnVersionKind) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\n * @example\n * await yarnVersion({\n * state: 'present',\n * update: () => 'berry', // or 'classic'\n * })\n */\nexport async function yarnVersion(options: YarnVersionOptions): Promise<void> {\n const { state, update } = options;\n if (state === 'present') {\n await exec('yarn', ['set', 'version', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n\n/**\n * Synchronous version of {@link yarnVersion}\n *\n * @param options\n * @example\n * yarnVersionSync({\n * state: 'present',\n * update: () => 'berry', // or 'classic'\n * })\n */\nexport function yarnVersionSync(options: YarnVersionOptions) {\n const { state, update } = options;\n if (state === 'present') {\n execSync('yarn', ['set', 'version', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n"],"mappings":";;;;;;AAGA,eAAsB,SAAS,MAAc;CAC3C,IAAI;EACF,MAAM,OAAO,MAAM,UAAU,IAAI;EACjC,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;ACRA,SAAgB,aAAa,MAAc;CACzC,IAAI;EACF,WAAW,MAAM,UAAU,IAAI;EAC/B,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;ACPA,SAAgB,SAAS,MAAgD;CACvE,OAAO,QAAQ,OACX,OAEE,WAAW,KAAK,OAAO,KAAO,KAAO,EAAK,IACxC,WAAW,KAAK,OAAO,IAAO,IAAO,CAAK,IAC1C,WAAW,KAAK,OAAO,GAAO,GAAO,CAAK;AAEpD;AAEA,SAAS,WAAW,eAA8C,MAAc,OAAe,SAAyB;CACtH,QACG,eAAe,SAAS,OAAO,OAAO,MACpC,eAAe,UAAU,OAAO,QAAQ,M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Q;GAAC;GAAU;GAAO;EAAG,CAAC;EAC5D,MAAM,KAAK,QAAQ;GAAC;GAAU;GAAO;GAAK,OAAO,UAAU,OAAO,KAAK,OAAO,MAAM,CAAC;EAAC,CAAC;CACzF,OACE,MAAM,KAAK,QAAQ;EAAC;EAAU;EAAS;CAAG,CAAC;AAE/C;;;;;;;;;;;;AAaA,SAAgB,eAAe,SAA4B;CACzD,MAAM,EAAE,KAAK,OAAO,WAAW;CAC/B,IAAI,UAAU,WAAW;EACvB,MAAM,EAAE,WAAW,SAAS,QAAQ;GAAC;GAAU;GAAO;EAAG,CAAC;EAC1D,SAAS,QAAQ;GAAC;GAAU;GAAO;GAAK,OAAO,UAAU,OAAO,KAAK,OAAO,MAAM,CAAC;EAAC,CAAC;CACvF,OACE,SAAS,QAAQ;EAAC;EAAU;EAAS;CAAG,CAAC;AAE7C;;;;;;;;;;;;;ACjCA,eAAsB,YAAY,SAA4C;CAC5E,MAAM,EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,MAAM,KAAK,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGlF,MAAM,IAAI,MAAM,iBAAiB;AAErC;;;;;;;;;;;AAYA,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,SAAS,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGhF,MAAM,IAAI,MAAM,iBAAiB;AAErC"}
1
+ {"version":3,"file":"index.js","names":["toFileOption","path","toFileOption","toFileOption"],"sources":["../src/internal/fileExists.ts","../src/internal/fileExistsSync.ts","../src/internal/toMode.ts","../src/file.ts","../src/internal/resolveCommentStyle.ts","../src/block.ts","../src/directory.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/toolVersions.ts","../src/yaml.ts","../src/exec.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"sourcesContent":["import { constants } from 'node:fs';\nimport { access } from 'node:fs/promises';\n\nexport async function fileExists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import { accessSync, constants } from 'node:fs';\n\nexport function fileExistsSync(path: string) {\n try {\n accessSync(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import type { FileMode, FilePermissionSet } from '../FileMode.js';\n\nexport function toMode(mode: FileMode | undefined): number | undefined {\n return mode == null\n ? mode\n : (\n toModeFlag(mode.owner, 0o400, 0o200, 0o100)\n | toModeFlag(mode.group, 0o040, 0o020, 0o010)\n | toModeFlag(mode.other, 0o004, 0o002, 0o001)\n );\n}\n\nfunction toModeFlag(permissionSet: FilePermissionSet | undefined, read: number, write: number, execute: number): number {\n return (\n (permissionSet?.read === true ? read : 0)\n | (permissionSet?.write === true ? write : 0)\n | (permissionSet?.execute === true ? execute : 0)\n );\n}\n","import { chmodSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { chmod, readFile, rm, writeFile } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { fileExists } from './internal/fileExists.js';\nimport { fileExistsSync } from './internal/fileExistsSync.js';\nimport { toMode } from './internal/toMode.js';\n\nexport interface FileOptions {\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * File path\n */\n readonly path: string;\n\n /**\n * File target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * await file({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function file(options: FileOptions): Promise<void> {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = await fileExists(path);\n const previousContent = isPresent ? await readFile(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = toMode(mode);\n if (newContent != null) {\n await writeFile(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n await chmod(path, newMode);\n }\n } else {\n await rm(path, { force: true });\n }\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * fileSync({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function fileSync(options: FileOptions): void {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = fileExistsSync(path);\n const previousContent = isPresent ? readFileSync(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = toMode(mode);\n if (newContent != null) {\n writeFileSync(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n chmodSync(path, newMode);\n }\n } else {\n rmSync(path, { force: true });\n }\n}\n","import nodePath from 'node:path';\n\nexport type ResolvedCommentStyle = '#' | '/*' | '//' | '<!--';\n\n/* cspell:ignore containerfile */\nconst HASH_BASENAMES = new Set(['containerfile', 'dockerfile', 'gemfile', 'makefile']);\n\nconst HTML_EXTENSIONS = new Set(['htm', 'html', 'md', 'mdx', 'svg', 'xml']);\nconst LINE_EXTENSIONS = new Set([\n 'c',\n 'cjs',\n 'cpp',\n 'cs',\n 'cts',\n 'go',\n 'h',\n 'java',\n 'js',\n 'jsx',\n 'kt',\n 'mjs',\n 'mts',\n 'rs',\n 'swift',\n 'ts',\n 'tsx',\n]);\nconst BLOCK_EXTENSIONS = new Set(['css', 'less', 'sass', 'scss']);\n\n/**\n * Resolve comment style from the file path when `commentStyle` is `'auto'`.\n *\n * @param path File path used to infer the comment style.\n */\nexport function resolveCommentStyle(path: string): ResolvedCommentStyle {\n const basename = nodePath.basename(path);\n const basenameLower = basename.toLowerCase();\n\n if (basename.startsWith('.') || HASH_BASENAMES.has(basenameLower)) {\n return '#';\n }\n\n const extension = nodePath.extname(basename).slice(1).toLowerCase();\n if (HTML_EXTENSIONS.has(extension)) {\n return '<!--';\n }\n if (LINE_EXTENSIONS.has(extension)) {\n return '//';\n }\n\n if (BLOCK_EXTENSIONS.has(extension)) {\n return '/*';\n }\n\n // py, rb, sh, toml, yaml, yml, json, no extension, and unknown → #\n return '#';\n}\n","import { file, type FileOptions, fileSync } from './file.js';\nimport { resolveCommentStyle, type ResolvedCommentStyle } from './internal/resolveCommentStyle.js';\n\nexport type BlockCommentStyle = '#' | '/*' | '//' | '<!--' | 'auto';\n\nexport interface BlockMarkerOptions {\n /**\n * Comment opener used for the marker lines: `'auto'` (from file name),\n * `'#'`, `'//'`, slash-star, or `'<!--'`.\n *\n * @default 'auto'\n */\n commentStyle?: BlockCommentStyle;\n\n /**\n * Identity after `BEGIN:` / `END:`, so multiple blocks in one file do not collide.\n *\n * @default 'managed-block'\n */\n topic?: string;\n}\n\nexport interface BlockOptions {\n /**\n * Block content to insert\n */\n block: string;\n\n /**\n * Insert position\n */\n insertPosition?: ['after', 'EndOfFile' | RegExp] | ['before', 'BeginningOfFile' | RegExp];\n\n /**\n * Marker configuration, or a function that returns the full marker line.\n *\n * @default `{ commentStyle: 'auto', topic: 'managed-block' }`\n */\n marker?: ((mark: 'Begin' | 'End') => string) | BlockMarkerOptions;\n\n /**\n * File path\n */\n path: string;\n\n /**\n * Block target state\n */\n state?: 'absent' | 'present';\n}\n\nconst EOF = 'EndOfFile';\nconst BOF = 'BeginningOfFile';\nconst DEFAULT_TOPIC = 'managed-block';\n\nconst insertAt = (str: string, index: number, toInsert: string) => str.slice(0, index) + toInsert + str.slice(index);\nconst matchLast = (string: string, regexp: RegExp) => {\n const matcher = new RegExp(regexp.source, `${regexp.flags}g`);\n let firstIndex = -1;\n let lastIndex = -1;\n let matches;\n\n while (true) {\n matches = matcher.exec(string);\n if (matches == null) {\n break;\n }\n firstIndex = matches.index;\n lastIndex = matcher.lastIndex;\n }\n return { firstIndex, lastIndex };\n};\n\n/**\n * Replace asynchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function block(options: BlockOptions) {\n return file(toFileOptions(options));\n}\n\n/**\n * Replace synchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function blockSync(options: BlockOptions) {\n return fileSync(toFileOptions(options));\n}\n\nfunction formatMarker(style: ResolvedCommentStyle, mark: 'Begin' | 'End', topic: string): string {\n const inner = `${mark.toUpperCase()}:${topic}`;\n switch (style) {\n case '#': {\n return `# ${inner}`;\n }\n case '/*': {\n return `/* ${inner} */`;\n }\n case '//': {\n return `// ${inner}`;\n }\n case '<!--': {\n return `<!-- ${inner} -->`;\n }\n default: {\n throw new Error(`Unsupported comment style ${String(style)}`);\n }\n }\n}\n\nfunction toFileOptions(options: BlockOptions): FileOptions {\n const { block: blockName, insertPosition = ['after', EOF], marker, path, state = 'present' } = options;\n\n const EOL = '\\n';\n const markerFn = toMarkerFn(marker, path);\n const beginBlock = markerFn('Begin');\n const endBlock = markerFn('End');\n\n /**\n * @param content\n */\n function findBlock(content: string) {\n const startIndex = content.indexOf(beginBlock);\n const endIndex = content.indexOf(endBlock) + endBlock.length;\n\n return {\n endIndex,\n exists: startIndex !== -1 && endIndex >= 0,\n startIndex,\n };\n }\n\n function apply(fullContent: string, blockContent: string) {\n const found = findBlock(fullContent);\n const remove = state === 'absent';\n const replaceBlock = remove ? '' : beginBlock + EOL + blockContent + EOL + endBlock;\n const [positionDirection, positionAnchor] = insertPosition;\n\n if (found.exists) {\n return fullContent.slice(0, found.startIndex) + replaceBlock + fullContent.slice(found.endIndex);\n }\n if (remove) {\n return fullContent;\n }\n switch (positionDirection) {\n case 'after': {\n // insert\n if (positionAnchor !== EOF) {\n const { lastIndex } = matchLast(fullContent, positionAnchor);\n if (lastIndex >= 0) {\n return insertAt(fullContent, lastIndex, EOL + replaceBlock);\n }\n }\n\n // end of file\n return fullContent + EOL + replaceBlock;\n }\n case 'before': {\n if (positionAnchor !== BOF) {\n const { firstIndex } = matchLast(fullContent, positionAnchor);\n if (firstIndex >= 0) {\n return insertAt(fullContent, firstIndex, replaceBlock + EOL);\n }\n }\n\n // Beginning of file\n return replaceBlock + EOL + fullContent;\n }\n\n default: {\n throw new Error(`Unsupported position ${String(positionDirection)}`);\n }\n }\n }\n\n return {\n path,\n state: 'present',\n update: (sourceContent) => apply(sourceContent, blockName),\n };\n}\n\nfunction toMarkerFn(marker: BlockOptions['marker'], path: string): (mark: 'Begin' | 'End') => string {\n if (typeof marker === 'function') {\n return marker;\n }\n\n const commentStyle = marker?.commentStyle ?? 'auto';\n const topic = marker?.topic ?? DEFAULT_TOPIC;\n const resolvedStyle = commentStyle === 'auto' ? resolveCommentStyle(path) : commentStyle;\n\n return (mark) => formatMarker(resolvedStyle, mark, topic);\n}\n","import { chmodSync, mkdirSync, rmSync } from 'node:fs';\nimport { chmod, mkdir, rm } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { fileExists } from './internal/fileExists.js';\nimport { fileExistsSync } from './internal/fileExistsSync.js';\nimport { toMode } from './internal/toMode.js';\n\nexport interface DirectoryOptions {\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * Directory path\n */\n readonly path: string;\n\n /**\n * Directory target state\n */\n readonly state: 'absent' | 'present';\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * await directory({\n * path: 'foo/bar',\n * state: 'present',\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function directory(options: DirectoryOptions): Promise<void> {\n const { mode, path, state } = options;\n const isPresent = await fileExists(path);\n if (state === 'present') {\n const newMode = toMode(mode);\n if (!isPresent) {\n await mkdir(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n await chmod(path, newMode);\n }\n } else if (isPresent) {\n await rm(path, { recursive: true });\n }\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * directorySync({\n * path: 'foo/bar',\n * state: 'present',\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function directorySync(options: DirectoryOptions): void {\n const { mode, path, state } = options;\n const isPresent = fileExistsSync(path);\n if (state === 'present') {\n const newMode = toMode(mode);\n if (!isPresent) {\n mkdirSync(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n chmodSync(path, newMode);\n }\n } else if (isPresent) {\n rmSync(path, { recursive: true });\n }\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface IgnoreFileOptions extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function where content is represented as lines.\n * When the file does not yet exist, the callback receives `undefined`.\n */\n readonly update?: ((content: Array<string> | undefined) => Array<string> | undefined) | undefined;\n}\n\n/**\n * Ensure file is present/absent asynchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * await ignoreFile({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport async function ignoreFile(options: IgnoreFileOptions): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * ignoreFileSync({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport function ignoreFileSync(options: IgnoreFileOptions): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption({ update, ...otherOptions }: IgnoreFileOptions): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const eol = content.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const lines = content === '' ? undefined : content.split(eol);\n const updatedLines = update(lines);\n\n return updatedLines == null ? undefined : updatedLines.join(eol);\n },\n };\n}\n","import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { fileExists } from './internal/fileExists.js';\nimport { fileExistsSync } from './internal/fileExistsSync.js';\n\nconst defaultExtensions: Array<string> = ['.json', '.yaml', '.yml', '.js', '.cjs', '.mjs', '.ts', '.cts', '.mts'];\n\nexport interface IsConfigPresentOptions {\n /**\n * The name of the application.\n */\n app: string;\n\n /**\n * The directory to look into. Defaults to `process.cwd()`.\n */\n cwd?: string | undefined;\n\n /**\n * The list of extensions to check for.\n */\n extensions?: Array<string> | undefined;\n\n /**\n * The name of the package configuration. Defaults to `app`.\n */\n packageConfig?: string | undefined;\n}\n\n/**\n * Return whether tool configuration exists at `cwd` (cosmiconfig-style).\n *\n * Looks for `.{app}rc`, `.{app}rc.{ext}`, `{app}.config.{ext}` and a matching\n * `package.json` key.\n *\n * @param options\n */\nexport async function isConfigPresent(options: IsConfigPresentOptions): Promise<boolean> {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n const [hasConfigFile, hasPackageConfig] = await Promise.all([\n hasAnyFile(candidatePaths),\n hasPackageConfigFile(packageJsonPath, packageConfig),\n ]);\n\n return hasConfigFile || hasPackageConfig;\n}\n\nexport function isConfigPresentSync(options: IsConfigPresentOptions): boolean {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n for (const candidatePath of candidatePaths) {\n if (fileExistsSync(candidatePath)) {\n return true;\n }\n }\n\n if (fileExistsSync(packageJsonPath)) {\n try {\n return hasPackageConfigKey(readFileSync(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n }\n\n return false;\n}\n\nasync function hasAnyFile(paths: Array<string>): Promise<boolean> {\n const results = await Promise.all(paths.map((candidatePath) => fileExists(candidatePath)));\n\n return results.some(Boolean);\n}\n\nasync function hasPackageConfigFile(packageJsonPath: string, packageConfig: string): Promise<boolean> {\n if (!(await fileExists(packageJsonPath))) {\n return false;\n }\n\n try {\n return hasPackageConfigKey(await readFile(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n}\n\nfunction hasPackageConfigKey(packageJsonContent: string, packageConfig: string): boolean {\n const packageJson = JSON.parse(packageJsonContent) as Record<string, unknown>;\n const value = packageJson[packageConfig];\n\n return value !== undefined && value !== null && value !== false;\n}\n\nfunction toCandidates({ app, cwd = process.cwd(), extensions = defaultExtensions, packageConfig = app }: IsConfigPresentOptions) {\n const candidatePaths = [path.join(cwd, `.${app}rc`)];\n for (const extension of extensions) {\n candidatePaths.push(path.join(cwd, `.${app}rc${extension}`), path.join(cwd, `${app}.config${extension}`));\n }\n\n return {\n candidatePaths,\n packageConfig,\n packageJsonPath: path.join(cwd, 'package.json'),\n };\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type JSONValue = Array<JSONValue> | boolean | null | number | string | { [key: string]: JSONValue };\n\n/**\n * Ensure file is present/absent asynchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport async function json<Value>(options: JSONOption<Value>): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport function jsonSync<Value>(options: JSONOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: JSONOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const jsonValue = content === '' ? undefined : (JSON.parse(content) as Value);\n\n return JSON.stringify(update(jsonValue));\n },\n };\n}\n","export const meta = Object.freeze({\n // @ts-ignore - these variables are injected at build time\n buildNumber: (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,\n // @ts-ignore - these variables are injected at build time\n name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,\n // @ts-ignore - these variables are injected at build time\n version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,\n});\n","import { file, type FileOptions, fileSync } from './file.js';\n\nconst reToolVersion = /\\s+/;\n\n/**\n * Regular expression to split tool and version\n */\nexport type ToolVersions = Record<string, string>;\n\nexport interface ToolVersionsOption extends Omit<FileOptions, 'path' | 'update'>, Partial<Pick<FileOptions, 'path'>> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: ToolVersions | undefined) => ToolVersions | undefined) | undefined;\n}\n\nexport function toolVersions(options: ToolVersionsOption) {\n return file(toFileOption(options));\n}\n\nexport function toolVersionsSync(options: ToolVersionsOption) {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption({ update, ...otherOptions }: ToolVersionsOption): FileOptions {\n return {\n ...otherOptions,\n path: otherOptions.path ?? '.tool-versions',\n update:\n update == null\n ? update\n : (content) => {\n const eol = '\\n';\n const lines = content.split(eol);\n const parsed = Object.fromEntries(\n (function* () {\n for (const line of lines) {\n const [tool, value] = line.split(reToolVersion, 2);\n if (tool) {\n yield [tool, value ?? ''];\n }\n }\n }()),\n );\n const updated = update ? update(parsed) : parsed;\n if (updated === undefined) return updated;\n\n const formatted = Object.entries(updated)\n .map(([tool, value]) => `${tool} ${value}`)\n .join(eol);\n return formatted;\n },\n };\n}\n","import YAML from 'yaml';\n\nimport { file, type FileOptions, fileSync } from './file.js';\n\nexport interface YAMLOption<V = YAMLValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type YAMLValue = Array<YAMLValue> | boolean | null | number | string | { [key: string]: YAMLValue };\n\n/**\n * Ensure file is present/absent asynchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport async function yaml<Value>(options: YAMLOption<Value>): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport function yamlSync<Value>(options: YAMLOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: YAMLOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const yamlValue = content === '' ? undefined : (YAML.parse(content) as Value);\n\n return YAML.stringify(update(yamlValue));\n },\n };\n}\n","import { spawn, spawnSync } from 'node:child_process';\n\nexport interface ExecOptions {\n /**\n * Current working directory\n */\n cwd?: string;\n\n /**\n * Stdio options\n */\n stdio?: 'ignore' | 'inherit' | 'pipe';\n}\n\n/**\n * Runs a command in a shell and returns a promise that resolves with an object\n * containing the stdout and stderr strings.\n *\n * @param command The command to run\n * @param args The arguments to pass to the command\n * @param options\n */\nexport async function exec(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): Promise<{ stderr: string; stdout: string }> {\n return new Promise((resolve, reject) => {\n const encoding = 'utf8';\n const child = spawn(command, args, { ...options });\n let stdout = '';\n let stderr = '';\n\n // Capture the stdout and stderr streams\n if (child.stdout != null) {\n child.stdout.on('data', (data) => {\n // eslint-disable-next-line ts/no-unsafe-call, ts/no-unsafe-member-access\n stdout += data.toString(encoding);\n });\n }\n if (child.stderr != null) {\n child.stderr.on('data', (data) => {\n // eslint-disable-next-line ts/no-unsafe-call, ts/no-unsafe-member-access\n stderr += data.toString(encoding);\n });\n }\n // Handle process exit\n child.on('close', (_code) => {\n resolve({ stderr, stdout });\n });\n\n // Handle errors\n child.on('error', reject);\n });\n}\n\n/**\n * Runs a command in a shell and returns a promise that resolves with an object\n * containing the stdout and stderr strings.\n *\n * @param command The command to run\n * @param args The arguments to pass to the command\n * @param options\n * @returns A promise that resolves with an object like `{ stdout: string, stderr: string }`\n */\nexport function execSync(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): { stderr: string; stdout: string } {\n const result = spawnSync(command, args, { ...options });\n const encoding = 'utf8';\n\n return { stderr: result.stderr.toString(encoding), stdout: result.stdout.toString(encoding) };\n}\n","import { exec, execSync } from './exec.js';\n\nexport interface YarnConfigOptions {\n /**\n * Configuration key\n */\n readonly key: string;\n\n /**\n * Option target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\n * @example\n * await yarnConfig({\n * key: 'nodeLinker',\n * state: 'present',\n * update: (content) => content.replace('node-modules', 'hoisted'),\n * })\n */\nexport async function yarnConfig(options: YarnConfigOptions): Promise<void> {\n const { key, state, update } = options;\n if (state === 'present') {\n const { stdout } = await exec('yarn', ['config', 'get', key]);\n await exec('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n await exec('yarn', ['config', 'unset', key]);\n }\n}\n\n/**\n * Synchronous version of {@link yarnConfig}\n *\n * @param options\n * @example\n * yarnConfigSync({\n * key: 'nodeLinker',\n * state: 'present',\n * update: (content) => content.replace('node-modules', 'hoisted'),\n * })\n */\nexport function yarnConfigSync(options: YarnConfigOptions) {\n const { key, state, update } = options;\n if (state === 'present') {\n const { stdout } = execSync('yarn', ['config', 'get', key]);\n execSync('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n execSync('yarn', ['config', 'unset', key]);\n }\n}\n","import { exec, execSync } from './exec.js';\n\nexport type YarnVersionKind = 'berry' | 'classic';\n\nexport interface YarnVersionOptions {\n /**\n * Option target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * Version mapping function\n *\n */\n readonly update?: (() => undefined | YarnVersionKind) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\n * @example\n * await yarnVersion({\n * state: 'present',\n * update: () => 'berry', // or 'classic'\n * })\n */\nexport async function yarnVersion(options: YarnVersionOptions): Promise<void> {\n const { state, update } = options;\n if (state === 'present') {\n await exec('yarn', ['set', 'version', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n\n/**\n * Synchronous version of {@link yarnVersion}\n *\n * @param options\n * @example\n * yarnVersionSync({\n * state: 'present',\n * update: () => 'berry', // or 'classic'\n * })\n */\nexport function yarnVersionSync(options: YarnVersionOptions) {\n const { state, update } = options;\n if (state === 'present') {\n execSync('yarn', ['set', 'version', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n"],"mappings":";;;;;;AAGA,eAAsB,WAAW,MAAc;CAC7C,IAAI;EACF,MAAM,OAAO,MAAM,UAAU,IAAI;EACjC,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;ACRA,SAAgB,eAAe,MAAc;CAC3C,IAAI;EACF,WAAW,MAAM,UAAU,IAAI;EAC/B,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;ACPA,SAAgB,OAAO,MAAgD;CACrE,OAAO,QAAQ,OACX,OAEE,WAAW,KAAK,OAAO,KAAO,KAAO,EAAK,IACxC,WAAW,KAAK,OAAO,IAAO,IAAO,CAAK,IAC1C,WAAW,KAAK,OAAO,GAAO,GAAO,CAAK;AAEpD;AAEA,SAAS,WAAW,eAA8C,MAAc,OAAe,SAAyB;CACtH,QACG,eAAe,SAAS,OAAO,OAAO,MACpC,eAAe,UAAU,OAAO,QAAQ,MACxC,eAAe,YAAY,OAAO,UAAU;AAEnD;;;;;;;;;;;;;;;;;;;;;ACsCA,eAAsB,KAAK,SAAqC;CAC9D,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EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,MAAM,KAAK,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGlF,MAAM,IAAI,MAAM,iBAAiB;AAErC;;;;;;;;;;;AAYA,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,SAAS,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGhF,MAAM,IAAI,MAAM,iBAAiB;AAErC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w5s/configurator-core",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "Core library for @w5s/configurator-core",
5
5
  "keywords": [
6
6
  "config",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "d39c8e42e2e9cb34d05ea9e23c757383dd30795a"
49
+ "gitHead": "8c839f967fbc4477af3e767c4ecfa2d8a693eda0"
50
50
  }