@w5s/configurator-core 1.21.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.cjs +146 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -25
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +32 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +146 -59
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/block.ts +62 -12
- package/src/directory.ts +7 -7
- package/src/file.ts +7 -7
- package/src/index.ts +1 -0
- package/src/{__exists.ts → internal/fileExists.ts} +1 -1
- package/src/{__existsSync.ts → internal/fileExistsSync.ts} +1 -1
- package/src/internal/resolveCommentStyle.ts +57 -0
- package/src/{__toMode.ts → internal/toMode.ts} +2 -2
- package/src/isConfigPresent.ts +6 -6
- package/src/toolVersions.ts +54 -0
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,16 +20,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let node_fs = require("node:fs");
|
|
25
24
|
let node_fs_promises = require("node:fs/promises");
|
|
26
25
|
let node_path = require("node:path");
|
|
27
|
-
node_path = __toESM(node_path, 1);
|
|
28
26
|
let yaml = require("yaml");
|
|
29
|
-
yaml = __toESM(yaml, 1);
|
|
30
27
|
let node_child_process = require("node:child_process");
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
node_path = __toESM(node_path, 1);
|
|
29
|
+
yaml = __toESM(yaml, 1);
|
|
30
|
+
// src/internal/fileExists.ts
|
|
31
|
+
async function fileExists(path) {
|
|
33
32
|
try {
|
|
34
33
|
await (0, node_fs_promises.access)(path, node_fs.constants.F_OK);
|
|
35
34
|
return true;
|
|
@@ -37,9 +36,8 @@ async function __exists(path) {
|
|
|
37
36
|
return false;
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function __existsSync(path) {
|
|
39
|
+
// src/internal/fileExistsSync.ts
|
|
40
|
+
function fileExistsSync(path) {
|
|
43
41
|
try {
|
|
44
42
|
(0, node_fs.accessSync)(path, node_fs.constants.F_OK);
|
|
45
43
|
return true;
|
|
@@ -47,16 +45,14 @@ function __existsSync(path) {
|
|
|
47
45
|
return false;
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function __toMode(mode) {
|
|
48
|
+
// src/internal/toMode.ts
|
|
49
|
+
function toMode(mode) {
|
|
53
50
|
return mode == null ? mode : toModeFlag(mode.owner, 256, 128, 64) | toModeFlag(mode.group, 32, 16, 8) | toModeFlag(mode.other, 4, 2, 1);
|
|
54
51
|
}
|
|
55
52
|
function toModeFlag(permissionSet, read, write, execute) {
|
|
56
53
|
return (permissionSet?.read === true ? read : 0) | (permissionSet?.write === true ? write : 0) | (permissionSet?.execute === true ? execute : 0);
|
|
57
54
|
}
|
|
58
|
-
|
|
59
|
-
//#region src/file.ts
|
|
55
|
+
// src/file.ts
|
|
60
56
|
/**
|
|
61
57
|
* Ensure file is present/absent with content initialized or modified with `update
|
|
62
58
|
*
|
|
@@ -79,10 +75,10 @@ function toModeFlag(permissionSet, read, write, execute) {
|
|
|
79
75
|
async function file(options) {
|
|
80
76
|
const { encoding = "utf8", mode, path, state, update } = options;
|
|
81
77
|
if (state === "present") {
|
|
82
|
-
const isPresent = await
|
|
78
|
+
const isPresent = await fileExists(path);
|
|
83
79
|
const previousContent = isPresent ? await (0, node_fs_promises.readFile)(path, encoding) : "";
|
|
84
80
|
const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
|
|
85
|
-
const newMode =
|
|
81
|
+
const newMode = toMode(mode);
|
|
86
82
|
if (newContent != null) await (0, node_fs_promises.writeFile)(path, newContent, {
|
|
87
83
|
encoding,
|
|
88
84
|
mode: newMode
|
|
@@ -112,10 +108,10 @@ async function file(options) {
|
|
|
112
108
|
function fileSync(options) {
|
|
113
109
|
const { encoding = "utf8", mode, path, state, update } = options;
|
|
114
110
|
if (state === "present") {
|
|
115
|
-
const isPresent =
|
|
111
|
+
const isPresent = fileExistsSync(path);
|
|
116
112
|
const previousContent = isPresent ? (0, node_fs.readFileSync)(path, encoding) : "";
|
|
117
113
|
const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
|
|
118
|
-
const newMode =
|
|
114
|
+
const newMode = toMode(mode);
|
|
119
115
|
if (newContent != null) (0, node_fs.writeFileSync)(path, newContent, {
|
|
120
116
|
encoding,
|
|
121
117
|
mode: newMode
|
|
@@ -123,10 +119,65 @@ function fileSync(options) {
|
|
|
123
119
|
if (newMode != null && (isPresent || newContent != null)) (0, node_fs.chmodSync)(path, newMode);
|
|
124
120
|
} else (0, node_fs.rmSync)(path, { force: true });
|
|
125
121
|
}
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
// src/internal/resolveCommentStyle.ts
|
|
123
|
+
const HASH_BASENAMES = /* @__PURE__ */ new Set([
|
|
124
|
+
"containerfile",
|
|
125
|
+
"dockerfile",
|
|
126
|
+
"gemfile",
|
|
127
|
+
"makefile"
|
|
128
|
+
]);
|
|
129
|
+
const HTML_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
130
|
+
"htm",
|
|
131
|
+
"html",
|
|
132
|
+
"md",
|
|
133
|
+
"mdx",
|
|
134
|
+
"svg",
|
|
135
|
+
"xml"
|
|
136
|
+
]);
|
|
137
|
+
const LINE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
138
|
+
"c",
|
|
139
|
+
"cjs",
|
|
140
|
+
"cpp",
|
|
141
|
+
"cs",
|
|
142
|
+
"cts",
|
|
143
|
+
"go",
|
|
144
|
+
"h",
|
|
145
|
+
"java",
|
|
146
|
+
"js",
|
|
147
|
+
"jsx",
|
|
148
|
+
"kt",
|
|
149
|
+
"mjs",
|
|
150
|
+
"mts",
|
|
151
|
+
"rs",
|
|
152
|
+
"swift",
|
|
153
|
+
"ts",
|
|
154
|
+
"tsx"
|
|
155
|
+
]);
|
|
156
|
+
const BLOCK_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
157
|
+
"css",
|
|
158
|
+
"less",
|
|
159
|
+
"sass",
|
|
160
|
+
"scss"
|
|
161
|
+
]);
|
|
162
|
+
/**
|
|
163
|
+
* Resolve comment style from the file path when `commentStyle` is `'auto'`.
|
|
164
|
+
*
|
|
165
|
+
* @param path File path used to infer the comment style.
|
|
166
|
+
*/
|
|
167
|
+
function resolveCommentStyle(path) {
|
|
168
|
+
const basename = node_path.default.basename(path);
|
|
169
|
+
const basenameLower = basename.toLowerCase();
|
|
170
|
+
if (basename.startsWith(".") || HASH_BASENAMES.has(basenameLower)) return "#";
|
|
171
|
+
const extension = node_path.default.extname(basename).slice(1).toLowerCase();
|
|
172
|
+
if (HTML_EXTENSIONS.has(extension)) return "<!--";
|
|
173
|
+
if (LINE_EXTENSIONS.has(extension)) return "//";
|
|
174
|
+
if (BLOCK_EXTENSIONS.has(extension)) return "/*";
|
|
175
|
+
return "#";
|
|
176
|
+
}
|
|
177
|
+
// src/block.ts
|
|
128
178
|
const EOF = "EndOfFile";
|
|
129
179
|
const BOF = "BeginningOfFile";
|
|
180
|
+
const DEFAULT_TOPIC = "managed-block";
|
|
130
181
|
const insertAt = (str, index, toInsert) => str.slice(0, index) + toInsert + str.slice(index);
|
|
131
182
|
const matchLast = (string, regexp) => {
|
|
132
183
|
const matcher = new RegExp(regexp.source, `${regexp.flags}g`);
|
|
@@ -168,11 +219,22 @@ function block(options) {
|
|
|
168
219
|
function blockSync(options) {
|
|
169
220
|
return fileSync(toFileOptions(options));
|
|
170
221
|
}
|
|
222
|
+
function formatMarker(style, mark, topic) {
|
|
223
|
+
const inner = `${mark.toUpperCase()}:${topic}`;
|
|
224
|
+
switch (style) {
|
|
225
|
+
case "#": return `# ${inner}`;
|
|
226
|
+
case "/*": return `/* ${inner} */`;
|
|
227
|
+
case "//": return `// ${inner}`;
|
|
228
|
+
case "<!--": return `<!-- ${inner} -->`;
|
|
229
|
+
default: throw new Error(`Unsupported comment style ${String(style)}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
171
232
|
function toFileOptions(options) {
|
|
172
|
-
const { block: blockName, insertPosition = ["after", EOF], marker
|
|
233
|
+
const { block: blockName, insertPosition = ["after", EOF], marker, path, state = "present" } = options;
|
|
173
234
|
const EOL = "\n";
|
|
174
|
-
const
|
|
175
|
-
const
|
|
235
|
+
const markerFn = toMarkerFn(marker, path);
|
|
236
|
+
const beginBlock = markerFn("Begin");
|
|
237
|
+
const endBlock = markerFn("End");
|
|
176
238
|
/**
|
|
177
239
|
* @param content
|
|
178
240
|
*/
|
|
@@ -214,8 +276,14 @@ function toFileOptions(options) {
|
|
|
214
276
|
update: (sourceContent) => apply(sourceContent, blockName)
|
|
215
277
|
};
|
|
216
278
|
}
|
|
217
|
-
|
|
218
|
-
|
|
279
|
+
function toMarkerFn(marker, path) {
|
|
280
|
+
if (typeof marker === "function") return marker;
|
|
281
|
+
const commentStyle = marker?.commentStyle ?? "auto";
|
|
282
|
+
const topic = marker?.topic ?? DEFAULT_TOPIC;
|
|
283
|
+
const resolvedStyle = commentStyle === "auto" ? resolveCommentStyle(path) : commentStyle;
|
|
284
|
+
return (mark) => formatMarker(resolvedStyle, mark, topic);
|
|
285
|
+
}
|
|
286
|
+
// src/directory.ts
|
|
219
287
|
/**
|
|
220
288
|
* Ensure directory is present/absent
|
|
221
289
|
*
|
|
@@ -236,9 +304,9 @@ function toFileOptions(options) {
|
|
|
236
304
|
*/
|
|
237
305
|
async function directory(options) {
|
|
238
306
|
const { mode, path, state } = options;
|
|
239
|
-
const isPresent = await
|
|
307
|
+
const isPresent = await fileExists(path);
|
|
240
308
|
if (state === "present") {
|
|
241
|
-
const newMode =
|
|
309
|
+
const newMode = toMode(mode);
|
|
242
310
|
if (!isPresent) await (0, node_fs_promises.mkdir)(path, {
|
|
243
311
|
mode: newMode,
|
|
244
312
|
recursive: true
|
|
@@ -266,9 +334,9 @@ async function directory(options) {
|
|
|
266
334
|
*/
|
|
267
335
|
function directorySync(options) {
|
|
268
336
|
const { mode, path, state } = options;
|
|
269
|
-
const isPresent =
|
|
337
|
+
const isPresent = fileExistsSync(path);
|
|
270
338
|
if (state === "present") {
|
|
271
|
-
const newMode =
|
|
339
|
+
const newMode = toMode(mode);
|
|
272
340
|
if (!isPresent) (0, node_fs.mkdirSync)(path, {
|
|
273
341
|
mode: newMode,
|
|
274
342
|
recursive: true
|
|
@@ -276,8 +344,7 @@ function directorySync(options) {
|
|
|
276
344
|
if (newMode != null && isPresent) (0, node_fs.chmodSync)(path, newMode);
|
|
277
345
|
} else if (isPresent) (0, node_fs.rmSync)(path, { recursive: true });
|
|
278
346
|
}
|
|
279
|
-
|
|
280
|
-
//#region src/ignoreFile.ts
|
|
347
|
+
// src/ignoreFile.ts
|
|
281
348
|
/**
|
|
282
349
|
* Ensure file is present/absent asynchronously with content initialized or modified by line.
|
|
283
350
|
*
|
|
@@ -291,7 +358,7 @@ function directorySync(options) {
|
|
|
291
358
|
* @param options File target options.
|
|
292
359
|
*/
|
|
293
360
|
async function ignoreFile(options) {
|
|
294
|
-
return file(toFileOption$
|
|
361
|
+
return file(toFileOption$3(options));
|
|
295
362
|
}
|
|
296
363
|
/**
|
|
297
364
|
* Ensure file is present/absent synchronously with content initialized or modified by line.
|
|
@@ -306,9 +373,9 @@ async function ignoreFile(options) {
|
|
|
306
373
|
* @param options File target options.
|
|
307
374
|
*/
|
|
308
375
|
function ignoreFileSync(options) {
|
|
309
|
-
return fileSync(toFileOption$
|
|
376
|
+
return fileSync(toFileOption$3(options));
|
|
310
377
|
}
|
|
311
|
-
function toFileOption$
|
|
378
|
+
function toFileOption$3({ update, ...otherOptions }) {
|
|
312
379
|
return {
|
|
313
380
|
...otherOptions,
|
|
314
381
|
update: update == null ? update : (content) => {
|
|
@@ -318,8 +385,7 @@ function toFileOption$2({ update, ...otherOptions }) {
|
|
|
318
385
|
}
|
|
319
386
|
};
|
|
320
387
|
}
|
|
321
|
-
|
|
322
|
-
//#region src/isConfigPresent.ts
|
|
388
|
+
// src/isConfigPresent.ts
|
|
323
389
|
const defaultExtensions = [
|
|
324
390
|
".json",
|
|
325
391
|
".yaml",
|
|
@@ -346,8 +412,8 @@ async function isConfigPresent(options) {
|
|
|
346
412
|
}
|
|
347
413
|
function isConfigPresentSync(options) {
|
|
348
414
|
const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);
|
|
349
|
-
for (const candidatePath of candidatePaths) if (
|
|
350
|
-
if (
|
|
415
|
+
for (const candidatePath of candidatePaths) if (fileExistsSync(candidatePath)) return true;
|
|
416
|
+
if (fileExistsSync(packageJsonPath)) try {
|
|
351
417
|
return hasPackageConfigKey((0, node_fs.readFileSync)(packageJsonPath, "utf8"), packageConfig);
|
|
352
418
|
} catch {
|
|
353
419
|
return false;
|
|
@@ -355,10 +421,10 @@ function isConfigPresentSync(options) {
|
|
|
355
421
|
return false;
|
|
356
422
|
}
|
|
357
423
|
async function hasAnyFile(paths) {
|
|
358
|
-
return (await Promise.all(paths.map((candidatePath) =>
|
|
424
|
+
return (await Promise.all(paths.map((candidatePath) => fileExists(candidatePath)))).some(Boolean);
|
|
359
425
|
}
|
|
360
426
|
async function hasPackageConfigFile(packageJsonPath, packageConfig) {
|
|
361
|
-
if (!await
|
|
427
|
+
if (!await fileExists(packageJsonPath)) return false;
|
|
362
428
|
try {
|
|
363
429
|
return hasPackageConfigKey(await (0, node_fs_promises.readFile)(packageJsonPath, "utf8"), packageConfig);
|
|
364
430
|
} catch {
|
|
@@ -378,15 +444,14 @@ function toCandidates({ app, cwd = process.cwd(), extensions = defaultExtensions
|
|
|
378
444
|
packageJsonPath: node_path.default.join(cwd, "package.json")
|
|
379
445
|
};
|
|
380
446
|
}
|
|
381
|
-
|
|
382
|
-
//#region src/json.ts
|
|
447
|
+
// src/json.ts
|
|
383
448
|
/**
|
|
384
449
|
* Ensure file is present/absent asynchronously with content value initialized or modified with `update`
|
|
385
450
|
*
|
|
386
451
|
* @param options
|
|
387
452
|
*/
|
|
388
453
|
async function json(options) {
|
|
389
|
-
return file(toFileOption$
|
|
454
|
+
return file(toFileOption$2(options));
|
|
390
455
|
}
|
|
391
456
|
/**
|
|
392
457
|
* Ensure file is present/absent synchronously with content value initialized or modified with `update`
|
|
@@ -394,9 +459,9 @@ async function json(options) {
|
|
|
394
459
|
* @param options
|
|
395
460
|
*/
|
|
396
461
|
function jsonSync(options) {
|
|
397
|
-
return fileSync(toFileOption$
|
|
462
|
+
return fileSync(toFileOption$2(options));
|
|
398
463
|
}
|
|
399
|
-
function toFileOption$
|
|
464
|
+
function toFileOption$2({ update, ...otherOptions }) {
|
|
400
465
|
return {
|
|
401
466
|
...otherOptions,
|
|
402
467
|
update: update == null ? update : (content) => {
|
|
@@ -405,15 +470,40 @@ function toFileOption$1({ update, ...otherOptions }) {
|
|
|
405
470
|
}
|
|
406
471
|
};
|
|
407
472
|
}
|
|
408
|
-
|
|
409
|
-
//#region src/meta.ts
|
|
473
|
+
// src/meta.ts
|
|
410
474
|
const meta = Object.freeze({
|
|
411
|
-
buildNumber:
|
|
475
|
+
buildNumber: 0x6b04cca5,
|
|
412
476
|
name: "@w5s/configurator-core",
|
|
413
|
-
version: "1.
|
|
477
|
+
version: "1.23.0"
|
|
414
478
|
});
|
|
415
|
-
|
|
416
|
-
|
|
479
|
+
// src/toolVersions.ts
|
|
480
|
+
const reToolVersion = /\s+/;
|
|
481
|
+
function toolVersions(options) {
|
|
482
|
+
return file(toFileOption$1(options));
|
|
483
|
+
}
|
|
484
|
+
function toolVersionsSync(options) {
|
|
485
|
+
return fileSync(toFileOption$1(options));
|
|
486
|
+
}
|
|
487
|
+
function toFileOption$1({ update, ...otherOptions }) {
|
|
488
|
+
return {
|
|
489
|
+
...otherOptions,
|
|
490
|
+
path: otherOptions.path ?? ".tool-versions",
|
|
491
|
+
update: update == null ? update : (content) => {
|
|
492
|
+
const eol = "\n";
|
|
493
|
+
const lines = content.split(eol);
|
|
494
|
+
const parsed = Object.fromEntries(function* () {
|
|
495
|
+
for (const line of lines) {
|
|
496
|
+
const [tool, value] = line.split(reToolVersion, 2);
|
|
497
|
+
if (tool) yield [tool, value ?? ""];
|
|
498
|
+
}
|
|
499
|
+
}());
|
|
500
|
+
const updated = update ? update(parsed) : parsed;
|
|
501
|
+
if (updated === void 0) return updated;
|
|
502
|
+
return Object.entries(updated).map(([tool, value]) => `${tool} ${value}`).join(eol);
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
// src/yaml.ts
|
|
417
507
|
/**
|
|
418
508
|
* Ensure file is present/absent asynchronously with content value initialized or modified with `update`
|
|
419
509
|
*
|
|
@@ -439,8 +529,7 @@ function toFileOption({ update, ...otherOptions }) {
|
|
|
439
529
|
}
|
|
440
530
|
};
|
|
441
531
|
}
|
|
442
|
-
|
|
443
|
-
//#region src/exec.ts
|
|
532
|
+
// src/exec.ts
|
|
444
533
|
/**
|
|
445
534
|
* Runs a command in a shell and returns a promise that resolves with an object
|
|
446
535
|
* containing the stdout and stderr strings.
|
|
@@ -487,8 +576,7 @@ function execSync(command, args, options) {
|
|
|
487
576
|
stdout: result.stdout.toString(encoding)
|
|
488
577
|
};
|
|
489
578
|
}
|
|
490
|
-
|
|
491
|
-
//#region src/yarnConfig.ts
|
|
579
|
+
// src/yarnConfig.ts
|
|
492
580
|
/**
|
|
493
581
|
* Set/Unset yarn configuration value
|
|
494
582
|
*
|
|
@@ -551,8 +639,7 @@ function yarnConfigSync(options) {
|
|
|
551
639
|
key
|
|
552
640
|
]);
|
|
553
641
|
}
|
|
554
|
-
|
|
555
|
-
//#region src/yarnVersion.ts
|
|
642
|
+
// src/yarnVersion.ts
|
|
556
643
|
/**
|
|
557
644
|
* Set/Unset yarn configuration value
|
|
558
645
|
*
|
|
@@ -591,7 +678,6 @@ function yarnVersionSync(options) {
|
|
|
591
678
|
]);
|
|
592
679
|
else throw new Error("Not implemented");
|
|
593
680
|
}
|
|
594
|
-
//#endregion
|
|
595
681
|
exports.block = block;
|
|
596
682
|
exports.blockSync = blockSync;
|
|
597
683
|
exports.directory = directory;
|
|
@@ -605,6 +691,8 @@ exports.isConfigPresentSync = isConfigPresentSync;
|
|
|
605
691
|
exports.json = json;
|
|
606
692
|
exports.jsonSync = jsonSync;
|
|
607
693
|
exports.meta = meta;
|
|
694
|
+
exports.toolVersions = toolVersions;
|
|
695
|
+
exports.toolVersionsSync = toolVersionsSync;
|
|
608
696
|
exports.yaml = yaml$1;
|
|
609
697
|
exports.yamlSync = yamlSync;
|
|
610
698
|
exports.yarnConfig = yarnConfig;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["access","constants","constants","readFile","writeFile","chmod","rm","readFileSync","mkdir","chmod","rm","toFileOption","readFileSync","readFile","path","toFileOption","yaml","YAML","spawn","spawnSync"],"sources":["../src/__exists.ts","../src/__existsSync.ts","../src/__toMode.ts","../src/file.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 { file, type FileOptions, fileSync } from './file.js';\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 * The marker builder function that will take either `markerBegin` or `markerEnd`\n *\n * @default '# ${mark} MANAGED BLOCK'\n */\n marker?: (mark: 'Begin' | 'End') => string;\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 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 toFileOptions(options: BlockOptions): FileOptions {\n const {\n block: blockName,\n insertPosition = ['after', EOF],\n marker = (mark) => `# ${mark.toUpperCase()} MANAGED BLOCK`,\n path,\n state = 'present',\n } = options;\n\n const EOL = '\\n';\n const beginBlock = marker('Begin');\n const endBlock = marker('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","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,OAAA,GAAMA,iBAAAA,OAAAA,CAAO,MAAMC,QAAAA,UAAU,IAAI;EACjC,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;ACRA,SAAgB,aAAa,MAAc;CACzC,IAAI;EACF,CAAA,GAAA,QAAA,WAAA,CAAW,MAAMC,QAAAA,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,MACxC,eAAe,YAAY,OAAO,UAAU;AAEnD;;;;;;;;;;;;;;;;;;;;;;ACsCA,eAAsB,KAAK,SAAqC;CAC9D,MAAM,EAAE,WAAW,QAAQ,MAAM,MAAM,OAAO,WAAW;CACzD,IAAI,UAAU,WAAW;EACvB,MAAM,YAAY,MAAM,SAAS,IAAI;EACrC,MAAM,kBAAkB,YAAY,OAAA,GAAMC,iBAAAA,SAAAA,CAAS,MAAM,QAAQ,IAA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,OAAO,WAAW;CAC/B,IAAI,UAAU,WAAW;EACvB,MAAM,EAAE,WAAW,MAAM,KAAK,QAAQ;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.cjs","names":["access","constants","accessSync","constants","readFile","writeFile","chmod","rm","readFileSync","writeFileSync","chmodSync","rmSync","nodePath","mkdir","chmod","rm","mkdirSync","chmodSync","rmSync","toFileOption","readFileSync","readFile","path","toFileOption","toFileOption","yaml","YAML","spawn","spawnSync"],"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,OAAA,GAAMA,iBAAAA,OAAAA,CAAO,MAAMC,QAAAA,UAAU,IAAI;EACjC,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;ACRA,SAAgB,eAAe,MAAc;CAC3C,IAAI;EACFC,CAAAA,GAAAA,QAAAA,WAAAA,CAAW,MAAMC,QAAAA,UAAU,IAAI;EAC/B,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;ACPA,SAAgB,OAAO,MAAgD;CACrE,OAAO,QAAQ,OACX,OAEE,WAAW,KAA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