bumpp 8.2.1 → 9.0.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.
@@ -0,0 +1,1259 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
25
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
26
+ }) : x)(function(x) {
27
+ if (typeof require !== "undefined")
28
+ return require.apply(this, arguments);
29
+ throw new Error('Dynamic require of "' + x + '" is not supported');
30
+ });
31
+ var __objRest = (source, exclude) => {
32
+ var target = {};
33
+ for (var prop in source)
34
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
35
+ target[prop] = source[prop];
36
+ if (source != null && __getOwnPropSymbols)
37
+ for (var prop of __getOwnPropSymbols(source)) {
38
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
39
+ target[prop] = source[prop];
40
+ }
41
+ return target;
42
+ };
43
+ var __commonJS = (cb, mod) => function __require2() {
44
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
45
+ };
46
+ var __copyProps = (to, from, except, desc) => {
47
+ if (from && typeof from === "object" || typeof from === "function") {
48
+ for (let key of __getOwnPropNames(from))
49
+ if (!__hasOwnProp.call(to, key) && key !== except)
50
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
51
+ }
52
+ return to;
53
+ };
54
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
55
+ // If the importer is in node compatibility mode or this is not an ESM
56
+ // file that has been converted to a CommonJS file using a Babel-
57
+ // compatible transform (i.e. "__esModule" has not been set), then set
58
+ // "default" to the CommonJS "module.exports" for node compatibility.
59
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
60
+ mod
61
+ ));
62
+
63
+ // node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js
64
+ var require_picocolors = __commonJS({
65
+ "node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js"(exports, module) {
66
+ var tty2 = __require("tty");
67
+ var isColorSupported = !("NO_COLOR" in process.env || process.argv.includes("--no-color")) && ("FORCE_COLOR" in process.env || process.argv.includes("--color") || process.platform === "win32" || tty2.isatty(1) && process.env.TERM !== "dumb" || "CI" in process.env);
68
+ var formatter = (open, close, replace = open) => (input) => {
69
+ let string = "" + input;
70
+ let index = string.indexOf(close, open.length);
71
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
72
+ };
73
+ var replaceClose = (string, close, replace, index) => {
74
+ let start = string.substring(0, index) + replace;
75
+ let end = string.substring(index + close.length);
76
+ let nextIndex = end.indexOf(close);
77
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
78
+ };
79
+ var createColors = (enabled = isColorSupported) => ({
80
+ isColorSupported: enabled,
81
+ reset: enabled ? (s) => `\x1B[0m${s}\x1B[0m` : String,
82
+ bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
83
+ dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
84
+ italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
85
+ underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
86
+ inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
87
+ hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
88
+ strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
89
+ black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
90
+ red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
91
+ green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
92
+ yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
93
+ blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
94
+ magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
95
+ cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
96
+ white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
97
+ gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
98
+ bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
99
+ bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
100
+ bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
101
+ bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
102
+ bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
103
+ bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
104
+ bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
105
+ bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
106
+ });
107
+ module.exports = createColors();
108
+ module.exports.createColors = createColors;
109
+ }
110
+ });
111
+
112
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
113
+ var ANSI_BACKGROUND_OFFSET = 10;
114
+ var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
115
+ var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
116
+ var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
117
+ var styles = {
118
+ modifier: {
119
+ reset: [0, 0],
120
+ // 21 isn't widely supported and 22 does the same thing
121
+ bold: [1, 22],
122
+ dim: [2, 22],
123
+ italic: [3, 23],
124
+ underline: [4, 24],
125
+ overline: [53, 55],
126
+ inverse: [7, 27],
127
+ hidden: [8, 28],
128
+ strikethrough: [9, 29]
129
+ },
130
+ color: {
131
+ black: [30, 39],
132
+ red: [31, 39],
133
+ green: [32, 39],
134
+ yellow: [33, 39],
135
+ blue: [34, 39],
136
+ magenta: [35, 39],
137
+ cyan: [36, 39],
138
+ white: [37, 39],
139
+ // Bright color
140
+ blackBright: [90, 39],
141
+ gray: [90, 39],
142
+ // Alias of `blackBright`
143
+ grey: [90, 39],
144
+ // Alias of `blackBright`
145
+ redBright: [91, 39],
146
+ greenBright: [92, 39],
147
+ yellowBright: [93, 39],
148
+ blueBright: [94, 39],
149
+ magentaBright: [95, 39],
150
+ cyanBright: [96, 39],
151
+ whiteBright: [97, 39]
152
+ },
153
+ bgColor: {
154
+ bgBlack: [40, 49],
155
+ bgRed: [41, 49],
156
+ bgGreen: [42, 49],
157
+ bgYellow: [43, 49],
158
+ bgBlue: [44, 49],
159
+ bgMagenta: [45, 49],
160
+ bgCyan: [46, 49],
161
+ bgWhite: [47, 49],
162
+ // Bright color
163
+ bgBlackBright: [100, 49],
164
+ bgGray: [100, 49],
165
+ // Alias of `bgBlackBright`
166
+ bgGrey: [100, 49],
167
+ // Alias of `bgBlackBright`
168
+ bgRedBright: [101, 49],
169
+ bgGreenBright: [102, 49],
170
+ bgYellowBright: [103, 49],
171
+ bgBlueBright: [104, 49],
172
+ bgMagentaBright: [105, 49],
173
+ bgCyanBright: [106, 49],
174
+ bgWhiteBright: [107, 49]
175
+ }
176
+ };
177
+ var modifierNames = Object.keys(styles.modifier);
178
+ var foregroundColorNames = Object.keys(styles.color);
179
+ var backgroundColorNames = Object.keys(styles.bgColor);
180
+ var colorNames = [...foregroundColorNames, ...backgroundColorNames];
181
+ function assembleStyles() {
182
+ const codes = /* @__PURE__ */ new Map();
183
+ for (const [groupName, group] of Object.entries(styles)) {
184
+ for (const [styleName, style] of Object.entries(group)) {
185
+ styles[styleName] = {
186
+ open: `\x1B[${style[0]}m`,
187
+ close: `\x1B[${style[1]}m`
188
+ };
189
+ group[styleName] = styles[styleName];
190
+ codes.set(style[0], style[1]);
191
+ }
192
+ Object.defineProperty(styles, groupName, {
193
+ value: group,
194
+ enumerable: false
195
+ });
196
+ }
197
+ Object.defineProperty(styles, "codes", {
198
+ value: codes,
199
+ enumerable: false
200
+ });
201
+ styles.color.close = "\x1B[39m";
202
+ styles.bgColor.close = "\x1B[49m";
203
+ styles.color.ansi = wrapAnsi16();
204
+ styles.color.ansi256 = wrapAnsi256();
205
+ styles.color.ansi16m = wrapAnsi16m();
206
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
207
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
208
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
209
+ Object.defineProperties(styles, {
210
+ rgbToAnsi256: {
211
+ value(red, green, blue) {
212
+ if (red === green && green === blue) {
213
+ if (red < 8) {
214
+ return 16;
215
+ }
216
+ if (red > 248) {
217
+ return 231;
218
+ }
219
+ return Math.round((red - 8) / 247 * 24) + 232;
220
+ }
221
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
222
+ },
223
+ enumerable: false
224
+ },
225
+ hexToRgb: {
226
+ value(hex) {
227
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
228
+ if (!matches) {
229
+ return [0, 0, 0];
230
+ }
231
+ let [colorString] = matches;
232
+ if (colorString.length === 3) {
233
+ colorString = [...colorString].map((character) => character + character).join("");
234
+ }
235
+ const integer = Number.parseInt(colorString, 16);
236
+ return [
237
+ /* eslint-disable no-bitwise */
238
+ integer >> 16 & 255,
239
+ integer >> 8 & 255,
240
+ integer & 255
241
+ /* eslint-enable no-bitwise */
242
+ ];
243
+ },
244
+ enumerable: false
245
+ },
246
+ hexToAnsi256: {
247
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
248
+ enumerable: false
249
+ },
250
+ ansi256ToAnsi: {
251
+ value(code) {
252
+ if (code < 8) {
253
+ return 30 + code;
254
+ }
255
+ if (code < 16) {
256
+ return 90 + (code - 8);
257
+ }
258
+ let red;
259
+ let green;
260
+ let blue;
261
+ if (code >= 232) {
262
+ red = ((code - 232) * 10 + 8) / 255;
263
+ green = red;
264
+ blue = red;
265
+ } else {
266
+ code -= 16;
267
+ const remainder = code % 36;
268
+ red = Math.floor(code / 36) / 5;
269
+ green = Math.floor(remainder / 6) / 5;
270
+ blue = remainder % 6 / 5;
271
+ }
272
+ const value = Math.max(red, green, blue) * 2;
273
+ if (value === 0) {
274
+ return 30;
275
+ }
276
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
277
+ if (value === 2) {
278
+ result += 60;
279
+ }
280
+ return result;
281
+ },
282
+ enumerable: false
283
+ },
284
+ rgbToAnsi: {
285
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
286
+ enumerable: false
287
+ },
288
+ hexToAnsi: {
289
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
290
+ enumerable: false
291
+ }
292
+ });
293
+ return styles;
294
+ }
295
+ var ansiStyles = assembleStyles();
296
+ var ansi_styles_default = ansiStyles;
297
+
298
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
299
+ import process2 from "process";
300
+ import os from "os";
301
+ import tty from "tty";
302
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
303
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
304
+ const position = argv.indexOf(prefix + flag);
305
+ const terminatorPosition = argv.indexOf("--");
306
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
307
+ }
308
+ var { env } = process2;
309
+ var flagForceColor;
310
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
311
+ flagForceColor = 0;
312
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
313
+ flagForceColor = 1;
314
+ }
315
+ function envForceColor() {
316
+ if ("FORCE_COLOR" in env) {
317
+ if (env.FORCE_COLOR === "true") {
318
+ return 1;
319
+ }
320
+ if (env.FORCE_COLOR === "false") {
321
+ return 0;
322
+ }
323
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
324
+ }
325
+ }
326
+ function translateLevel(level) {
327
+ if (level === 0) {
328
+ return false;
329
+ }
330
+ return {
331
+ level,
332
+ hasBasic: true,
333
+ has256: level >= 2,
334
+ has16m: level >= 3
335
+ };
336
+ }
337
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
338
+ const noFlagForceColor = envForceColor();
339
+ if (noFlagForceColor !== void 0) {
340
+ flagForceColor = noFlagForceColor;
341
+ }
342
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
343
+ if (forceColor === 0) {
344
+ return 0;
345
+ }
346
+ if (sniffFlags) {
347
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
348
+ return 3;
349
+ }
350
+ if (hasFlag("color=256")) {
351
+ return 2;
352
+ }
353
+ }
354
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
355
+ return 1;
356
+ }
357
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
358
+ return 0;
359
+ }
360
+ const min = forceColor || 0;
361
+ if (env.TERM === "dumb") {
362
+ return min;
363
+ }
364
+ if (process2.platform === "win32") {
365
+ const osRelease = os.release().split(".");
366
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
367
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
368
+ }
369
+ return 1;
370
+ }
371
+ if ("CI" in env) {
372
+ if ("GITHUB_ACTIONS" in env) {
373
+ return 3;
374
+ }
375
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
376
+ return 1;
377
+ }
378
+ return min;
379
+ }
380
+ if ("TEAMCITY_VERSION" in env) {
381
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
382
+ }
383
+ if (env.COLORTERM === "truecolor") {
384
+ return 3;
385
+ }
386
+ if (env.TERM === "xterm-kitty") {
387
+ return 3;
388
+ }
389
+ if ("TERM_PROGRAM" in env) {
390
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
391
+ switch (env.TERM_PROGRAM) {
392
+ case "iTerm.app": {
393
+ return version >= 3 ? 3 : 2;
394
+ }
395
+ case "Apple_Terminal": {
396
+ return 2;
397
+ }
398
+ }
399
+ }
400
+ if (/-256(color)?$/i.test(env.TERM)) {
401
+ return 2;
402
+ }
403
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
404
+ return 1;
405
+ }
406
+ if ("COLORTERM" in env) {
407
+ return 1;
408
+ }
409
+ return min;
410
+ }
411
+ function createSupportsColor(stream, options = {}) {
412
+ const level = _supportsColor(stream, __spreadValues({
413
+ streamIsTTY: stream && stream.isTTY
414
+ }, options));
415
+ return translateLevel(level);
416
+ }
417
+ var supportsColor = {
418
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
419
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
420
+ };
421
+ var supports_color_default = supportsColor;
422
+
423
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
424
+ function stringReplaceAll(string, substring, replacer) {
425
+ let index = string.indexOf(substring);
426
+ if (index === -1) {
427
+ return string;
428
+ }
429
+ const substringLength = substring.length;
430
+ let endIndex = 0;
431
+ let returnValue = "";
432
+ do {
433
+ returnValue += string.slice(endIndex, index) + substring + replacer;
434
+ endIndex = index + substringLength;
435
+ index = string.indexOf(substring, endIndex);
436
+ } while (index !== -1);
437
+ returnValue += string.slice(endIndex);
438
+ return returnValue;
439
+ }
440
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
441
+ let endIndex = 0;
442
+ let returnValue = "";
443
+ do {
444
+ const gotCR = string[index - 1] === "\r";
445
+ returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
446
+ endIndex = index + 1;
447
+ index = string.indexOf("\n", endIndex);
448
+ } while (index !== -1);
449
+ returnValue += string.slice(endIndex);
450
+ return returnValue;
451
+ }
452
+
453
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
454
+ var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
455
+ var GENERATOR = Symbol("GENERATOR");
456
+ var STYLER = Symbol("STYLER");
457
+ var IS_EMPTY = Symbol("IS_EMPTY");
458
+ var levelMapping = [
459
+ "ansi",
460
+ "ansi",
461
+ "ansi256",
462
+ "ansi16m"
463
+ ];
464
+ var styles2 = /* @__PURE__ */ Object.create(null);
465
+ var applyOptions = (object, options = {}) => {
466
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
467
+ throw new Error("The `level` option should be an integer from 0 to 3");
468
+ }
469
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
470
+ object.level = options.level === void 0 ? colorLevel : options.level;
471
+ };
472
+ var chalkFactory = (options) => {
473
+ const chalk2 = (...strings) => strings.join(" ");
474
+ applyOptions(chalk2, options);
475
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
476
+ return chalk2;
477
+ };
478
+ function createChalk(options) {
479
+ return chalkFactory(options);
480
+ }
481
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
482
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
483
+ styles2[styleName] = {
484
+ get() {
485
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
486
+ Object.defineProperty(this, styleName, { value: builder });
487
+ return builder;
488
+ }
489
+ };
490
+ }
491
+ styles2.visible = {
492
+ get() {
493
+ const builder = createBuilder(this, this[STYLER], true);
494
+ Object.defineProperty(this, "visible", { value: builder });
495
+ return builder;
496
+ }
497
+ };
498
+ var getModelAnsi = (model, level, type, ...arguments_) => {
499
+ if (model === "rgb") {
500
+ if (level === "ansi16m") {
501
+ return ansi_styles_default[type].ansi16m(...arguments_);
502
+ }
503
+ if (level === "ansi256") {
504
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
505
+ }
506
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
507
+ }
508
+ if (model === "hex") {
509
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
510
+ }
511
+ return ansi_styles_default[type][model](...arguments_);
512
+ };
513
+ var usedModels = ["rgb", "hex", "ansi256"];
514
+ for (const model of usedModels) {
515
+ styles2[model] = {
516
+ get() {
517
+ const { level } = this;
518
+ return function(...arguments_) {
519
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
520
+ return createBuilder(this, styler, this[IS_EMPTY]);
521
+ };
522
+ }
523
+ };
524
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
525
+ styles2[bgModel] = {
526
+ get() {
527
+ const { level } = this;
528
+ return function(...arguments_) {
529
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
530
+ return createBuilder(this, styler, this[IS_EMPTY]);
531
+ };
532
+ }
533
+ };
534
+ }
535
+ var proto = Object.defineProperties(() => {
536
+ }, __spreadProps(__spreadValues({}, styles2), {
537
+ level: {
538
+ enumerable: true,
539
+ get() {
540
+ return this[GENERATOR].level;
541
+ },
542
+ set(level) {
543
+ this[GENERATOR].level = level;
544
+ }
545
+ }
546
+ }));
547
+ var createStyler = (open, close, parent) => {
548
+ let openAll;
549
+ let closeAll;
550
+ if (parent === void 0) {
551
+ openAll = open;
552
+ closeAll = close;
553
+ } else {
554
+ openAll = parent.openAll + open;
555
+ closeAll = close + parent.closeAll;
556
+ }
557
+ return {
558
+ open,
559
+ close,
560
+ openAll,
561
+ closeAll,
562
+ parent
563
+ };
564
+ };
565
+ var createBuilder = (self, _styler, _isEmpty) => {
566
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
567
+ Object.setPrototypeOf(builder, proto);
568
+ builder[GENERATOR] = self;
569
+ builder[STYLER] = _styler;
570
+ builder[IS_EMPTY] = _isEmpty;
571
+ return builder;
572
+ };
573
+ var applyStyle = (self, string) => {
574
+ if (self.level <= 0 || !string) {
575
+ return self[IS_EMPTY] ? "" : string;
576
+ }
577
+ let styler = self[STYLER];
578
+ if (styler === void 0) {
579
+ return string;
580
+ }
581
+ const { openAll, closeAll } = styler;
582
+ if (string.includes("\x1B")) {
583
+ while (styler !== void 0) {
584
+ string = stringReplaceAll(string, styler.close, styler.open);
585
+ styler = styler.parent;
586
+ }
587
+ }
588
+ const lfIndex = string.indexOf("\n");
589
+ if (lfIndex !== -1) {
590
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
591
+ }
592
+ return openAll + string + closeAll;
593
+ };
594
+ Object.defineProperties(createChalk.prototype, styles2);
595
+ var chalk = createChalk();
596
+ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
597
+ var source_default = chalk;
598
+
599
+ // node_modules/.pnpm/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js
600
+ import process3 from "process";
601
+ function isUnicodeSupported() {
602
+ if (process3.platform !== "win32") {
603
+ return process3.env.TERM !== "linux";
604
+ }
605
+ return Boolean(process3.env.CI) || Boolean(process3.env.WT_SESSION) || Boolean(process3.env.TERMINUS_SUBLIME) || process3.env.ConEmuTask === "{cmd::Cmder}" || process3.env.TERM_PROGRAM === "Terminus-Sublime" || process3.env.TERM_PROGRAM === "vscode" || process3.env.TERM === "xterm-256color" || process3.env.TERM === "alacritty" || process3.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
606
+ }
607
+
608
+ // node_modules/.pnpm/log-symbols@5.1.0/node_modules/log-symbols/index.js
609
+ var main = {
610
+ info: source_default.blue("\u2139"),
611
+ success: source_default.green("\u2714"),
612
+ warning: source_default.yellow("\u26A0"),
613
+ error: source_default.red("\u2716")
614
+ };
615
+ var fallback = {
616
+ info: source_default.blue("i"),
617
+ success: source_default.green("\u221A"),
618
+ warning: source_default.yellow("\u203C"),
619
+ error: source_default.red("\xD7")
620
+ };
621
+ var logSymbols = isUnicodeSupported() ? main : fallback;
622
+ var log_symbols_default = logSymbols;
623
+
624
+ // src/release-type.ts
625
+ import { ReleaseType } from "semver";
626
+ var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
627
+ var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
628
+ function isPrerelease(value) {
629
+ return prereleaseTypes.includes(value);
630
+ }
631
+ function isReleaseType(value) {
632
+ return releaseTypes.includes(value);
633
+ }
634
+
635
+ // src/types/version-bump-progress.ts
636
+ var ProgressEvent = /* @__PURE__ */ ((ProgressEvent2) => {
637
+ ProgressEvent2["FileUpdated"] = "file updated";
638
+ ProgressEvent2["FileSkipped"] = "file skipped";
639
+ ProgressEvent2["GitCommit"] = "git commit";
640
+ ProgressEvent2["GitTag"] = "git tag";
641
+ ProgressEvent2["GitPush"] = "git push";
642
+ ProgressEvent2["NpmScript"] = "npm script";
643
+ return ProgressEvent2;
644
+ })(ProgressEvent || {});
645
+ var NpmScript = /* @__PURE__ */ ((NpmScript2) => {
646
+ NpmScript2["PreVersion"] = "preversion";
647
+ NpmScript2["Version"] = "version";
648
+ NpmScript2["PostVersion"] = "postversion";
649
+ return NpmScript2;
650
+ })(NpmScript || {});
651
+
652
+ // src/version-bump.ts
653
+ var import_picocolors2 = __toESM(require_picocolors());
654
+ import * as ezSpawn3 from "@jsdevtools/ez-spawn";
655
+ import prompts2 from "prompts";
656
+
657
+ // src/get-new-version.ts
658
+ var import_picocolors = __toESM(require_picocolors());
659
+ import prompts from "prompts";
660
+ import semver, { SemVer, clean as cleanVersion, valid as isValidVersion } from "semver";
661
+ async function getNewVersion(operation) {
662
+ const { release } = operation.options;
663
+ const { oldVersion } = operation.state;
664
+ switch (release.type) {
665
+ case "prompt":
666
+ return promptForNewVersion(operation);
667
+ case "version":
668
+ return operation.update({
669
+ newVersion: new SemVer(release.version, true).version
670
+ });
671
+ default:
672
+ return operation.update({
673
+ release: release.type,
674
+ newVersion: getNextVersion(oldVersion, release)
675
+ });
676
+ }
677
+ }
678
+ function getNextVersion(oldVersion, bump) {
679
+ const oldSemVer = new SemVer(oldVersion);
680
+ const newSemVer = oldSemVer.inc(bump.type, bump.preid);
681
+ if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
682
+ newSemVer.prerelease[1] = "1";
683
+ newSemVer.format();
684
+ }
685
+ return newSemVer.version;
686
+ }
687
+ function getNextVersions(oldVersion, preid) {
688
+ var _a;
689
+ const next = {};
690
+ const parse = semver.parse(oldVersion);
691
+ if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
692
+ preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
693
+ for (const type of releaseTypes)
694
+ next[type] = semver.inc(oldVersion, type, preid);
695
+ next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? semver.inc(oldVersion, "prerelease", preid) : semver.inc(oldVersion, "patch");
696
+ return next;
697
+ }
698
+ async function promptForNewVersion(operation) {
699
+ const { oldVersion } = operation.state;
700
+ const release = operation.options.release;
701
+ const next = getNextVersions(oldVersion, release.preid);
702
+ const PADDING = 13;
703
+ const answers = await prompts([
704
+ {
705
+ type: "autocomplete",
706
+ name: "release",
707
+ message: `Current version ${import_picocolors.default.green(oldVersion)}`,
708
+ initial: "next",
709
+ choices: [
710
+ { value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
711
+ { value: "minor", title: `${"minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.minor)}` },
712
+ { value: "patch", title: `${"patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.patch)}` },
713
+ { value: "next", title: `${"next".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.next)}` },
714
+ { value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
715
+ { value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
716
+ { value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
717
+ { value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors.default.bold(oldVersion)}` },
718
+ { value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
719
+ ]
720
+ },
721
+ {
722
+ type: (prev) => prev === "custom" ? "text" : null,
723
+ name: "custom",
724
+ message: "Enter the new version number:",
725
+ initial: oldVersion,
726
+ validate: (custom) => {
727
+ return isValidVersion(custom) ? true : "That's not a valid version number";
728
+ }
729
+ }
730
+ ]);
731
+ const newVersion = answers.release === "none" ? oldVersion : answers.release === "custom" ? cleanVersion(answers.custom) : next[answers.release];
732
+ if (!newVersion)
733
+ process.exit(1);
734
+ switch (answers.release) {
735
+ case "custom":
736
+ case "next":
737
+ case "none":
738
+ return operation.update({ newVersion });
739
+ default:
740
+ return operation.update({ release: answers.release, newVersion });
741
+ }
742
+ }
743
+
744
+ // src/get-old-version.ts
745
+ import { valid as isValidVersion2 } from "semver";
746
+
747
+ // src/fs.ts
748
+ import fs from "fs";
749
+ import path from "path";
750
+
751
+ // node_modules/.pnpm/detect-indent@7.0.1/node_modules/detect-indent/index.js
752
+ var INDENT_REGEX = /^(?:( )+|\t+)/;
753
+ var INDENT_TYPE_SPACE = "space";
754
+ var INDENT_TYPE_TAB = "tab";
755
+ function makeIndentsMap(string, ignoreSingleSpaces) {
756
+ const indents = /* @__PURE__ */ new Map();
757
+ let previousSize = 0;
758
+ let previousIndentType;
759
+ let key;
760
+ for (const line of string.split(/\n/g)) {
761
+ if (!line) {
762
+ continue;
763
+ }
764
+ let indent;
765
+ let indentType;
766
+ let use;
767
+ let weight;
768
+ let entry;
769
+ const matches = line.match(INDENT_REGEX);
770
+ if (matches === null) {
771
+ previousSize = 0;
772
+ previousIndentType = "";
773
+ } else {
774
+ indent = matches[0].length;
775
+ indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
776
+ if (ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && indent === 1) {
777
+ continue;
778
+ }
779
+ if (indentType !== previousIndentType) {
780
+ previousSize = 0;
781
+ }
782
+ previousIndentType = indentType;
783
+ use = 1;
784
+ weight = 0;
785
+ const indentDifference = indent - previousSize;
786
+ previousSize = indent;
787
+ if (indentDifference === 0) {
788
+ use = 0;
789
+ weight = 1;
790
+ } else {
791
+ const absoluteIndentDifference = indentDifference > 0 ? indentDifference : -indentDifference;
792
+ key = encodeIndentsKey(indentType, absoluteIndentDifference);
793
+ }
794
+ entry = indents.get(key);
795
+ entry = entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight];
796
+ indents.set(key, entry);
797
+ }
798
+ }
799
+ return indents;
800
+ }
801
+ function encodeIndentsKey(indentType, indentAmount) {
802
+ const typeCharacter = indentType === INDENT_TYPE_SPACE ? "s" : "t";
803
+ return typeCharacter + String(indentAmount);
804
+ }
805
+ function decodeIndentsKey(indentsKey) {
806
+ const keyHasTypeSpace = indentsKey[0] === "s";
807
+ const type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
808
+ const amount = Number(indentsKey.slice(1));
809
+ return { type, amount };
810
+ }
811
+ function getMostUsedKey(indents) {
812
+ let result;
813
+ let maxUsed = 0;
814
+ let maxWeight = 0;
815
+ for (const [key, [usedCount, weight]] of indents) {
816
+ if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
817
+ maxUsed = usedCount;
818
+ maxWeight = weight;
819
+ result = key;
820
+ }
821
+ }
822
+ return result;
823
+ }
824
+ function makeIndentString(type, amount) {
825
+ const indentCharacter = type === INDENT_TYPE_SPACE ? " " : " ";
826
+ return indentCharacter.repeat(amount);
827
+ }
828
+ function detectIndent(string) {
829
+ if (typeof string !== "string") {
830
+ throw new TypeError("Expected a string");
831
+ }
832
+ let indents = makeIndentsMap(string, true);
833
+ if (indents.size === 0) {
834
+ indents = makeIndentsMap(string, false);
835
+ }
836
+ const keyOfMostUsedIndent = getMostUsedKey(indents);
837
+ let type;
838
+ let amount = 0;
839
+ let indent = "";
840
+ if (keyOfMostUsedIndent !== void 0) {
841
+ ({ type, amount } = decodeIndentsKey(keyOfMostUsedIndent));
842
+ indent = makeIndentString(type, amount);
843
+ }
844
+ return {
845
+ amount,
846
+ type,
847
+ indent
848
+ };
849
+ }
850
+
851
+ // node_modules/.pnpm/detect-newline@4.0.0/node_modules/detect-newline/index.js
852
+ function detectNewline(string) {
853
+ if (typeof string !== "string") {
854
+ throw new TypeError("Expected a string");
855
+ }
856
+ const newlines = string.match(/(?:\r?\n)/g) || [];
857
+ if (newlines.length === 0) {
858
+ return;
859
+ }
860
+ const crlf = newlines.filter((newline) => newline === "\r\n").length;
861
+ const lf = newlines.length - crlf;
862
+ return crlf > lf ? "\r\n" : "\n";
863
+ }
864
+
865
+ // src/fs.ts
866
+ async function readJsonFile(name, cwd) {
867
+ const file = await readTextFile(name, cwd);
868
+ const data = JSON.parse(file.data);
869
+ const indent = detectIndent(file.data).indent;
870
+ const newline = detectNewline(file.data);
871
+ return __spreadProps(__spreadValues({}, file), { data, indent, newline });
872
+ }
873
+ async function writeJsonFile(file) {
874
+ let json = JSON.stringify(file.data, void 0, file.indent);
875
+ if (file.newline)
876
+ json += file.newline;
877
+ return writeTextFile(__spreadProps(__spreadValues({}, file), { data: json }));
878
+ }
879
+ function readTextFile(name, cwd) {
880
+ return new Promise((resolve, reject) => {
881
+ const filePath = path.join(cwd, name);
882
+ fs.readFile(filePath, "utf8", (err, text) => {
883
+ if (err) {
884
+ reject(err);
885
+ } else {
886
+ resolve({
887
+ path: filePath,
888
+ data: text
889
+ });
890
+ }
891
+ });
892
+ });
893
+ }
894
+ function writeTextFile(file) {
895
+ return new Promise((resolve, reject) => {
896
+ fs.writeFile(file.path, file.data, (err) => {
897
+ if (err)
898
+ reject(err);
899
+ else
900
+ resolve();
901
+ });
902
+ });
903
+ }
904
+
905
+ // src/manifest.ts
906
+ function isManifest(obj) {
907
+ return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
908
+ }
909
+ function isOptionalString(value) {
910
+ const type = typeof value;
911
+ return value === null || type === "undefined" || type === "string";
912
+ }
913
+
914
+ // src/get-old-version.ts
915
+ async function getOldVersion(operation) {
916
+ const { cwd, files } = operation.options;
917
+ const filesToCheck = files.filter((file) => file.endsWith(".json"));
918
+ if (!filesToCheck.includes("package.json"))
919
+ filesToCheck.push("package.json");
920
+ for (const file of filesToCheck) {
921
+ const version = await readVersion(file, cwd);
922
+ if (version) {
923
+ return operation.update({
924
+ oldVersionSource: file,
925
+ oldVersion: version
926
+ });
927
+ }
928
+ }
929
+ throw new Error(
930
+ `Unable to determine the current version number. Checked ${filesToCheck.join(", ")}.`
931
+ );
932
+ }
933
+ async function readVersion(file, cwd) {
934
+ try {
935
+ const { data: manifest } = await readJsonFile(file, cwd);
936
+ if (isManifest(manifest)) {
937
+ if (isValidVersion2(manifest.version))
938
+ return manifest.version;
939
+ }
940
+ } catch (error) {
941
+ return void 0;
942
+ }
943
+ }
944
+
945
+ // src/git.ts
946
+ import * as ezSpawn from "@jsdevtools/ez-spawn";
947
+ async function gitCommit(operation) {
948
+ if (!operation.options.commit)
949
+ return operation;
950
+ const { all, noVerify, message } = operation.options.commit;
951
+ const { updatedFiles, newVersion } = operation.state;
952
+ let args = [];
953
+ if (all) {
954
+ args.push("--all");
955
+ }
956
+ if (noVerify) {
957
+ args.push("--no-verify");
958
+ }
959
+ const commitMessage = formatVersionString(message, newVersion);
960
+ args.push("--message", commitMessage);
961
+ if (!all)
962
+ args = args.concat(updatedFiles);
963
+ await ezSpawn.async("git", ["commit", ...args]);
964
+ return operation.update({ event: "git commit" /* GitCommit */, commitMessage });
965
+ }
966
+ async function gitTag(operation) {
967
+ if (!operation.options.tag)
968
+ return operation;
969
+ const { commit, tag } = operation.options;
970
+ const { newVersion } = operation.state;
971
+ const args = [
972
+ // Create an annotated tag, which is recommended for releases.
973
+ // See https://git-scm.com/docs/git-tag
974
+ "--annotate",
975
+ // Use the same commit message for the tag
976
+ "--message",
977
+ formatVersionString(commit.message, newVersion)
978
+ ];
979
+ const tagName = formatVersionString(tag.name, newVersion);
980
+ args.push(tagName);
981
+ await ezSpawn.async("git", ["tag", ...args]);
982
+ return operation.update({ event: "git tag" /* GitTag */, tagName });
983
+ }
984
+ async function gitPush(operation) {
985
+ if (!operation.options.push)
986
+ return operation;
987
+ await ezSpawn.async("git", "push");
988
+ if (operation.options.tag) {
989
+ await ezSpawn.async("git", ["push", "--tags"]);
990
+ }
991
+ return operation.update({ event: "git push" /* GitPush */ });
992
+ }
993
+ function formatVersionString(template, newVersion) {
994
+ if (template.includes("%s"))
995
+ return template.replace(/%s/g, newVersion);
996
+ else
997
+ return template + newVersion;
998
+ }
999
+
1000
+ // src/normalize-options.ts
1001
+ import fg from "fast-glob";
1002
+ async function normalizeOptions(raw) {
1003
+ var _a;
1004
+ const preid = typeof raw.preid === "string" ? raw.preid : "beta";
1005
+ const push = Boolean(raw.push);
1006
+ const all = Boolean(raw.all);
1007
+ const noVerify = Boolean(raw.noVerify);
1008
+ const cwd = raw.cwd || process.cwd();
1009
+ const ignoreScripts = Boolean(raw.ignoreScripts);
1010
+ const execute = raw.execute;
1011
+ let release;
1012
+ if (!raw.release || raw.release === "prompt")
1013
+ release = { type: "prompt", preid };
1014
+ else if (isReleaseType(raw.release))
1015
+ release = { type: raw.release, preid };
1016
+ else
1017
+ release = { type: "version", version: raw.release };
1018
+ let tag;
1019
+ if (typeof raw.tag === "string")
1020
+ tag = { name: raw.tag };
1021
+ else if (raw.tag)
1022
+ tag = { name: "v" };
1023
+ let commit;
1024
+ if (typeof raw.commit === "string")
1025
+ commit = { all, noVerify, message: raw.commit };
1026
+ else if (raw.commit || tag || push)
1027
+ commit = { all, noVerify, message: "chore: release v" };
1028
+ const files = await fg(
1029
+ ((_a = raw.files) == null ? void 0 : _a.length) ? raw.files : ["package.json", "package-lock.json"],
1030
+ {
1031
+ cwd,
1032
+ onlyFiles: true,
1033
+ ignore: [
1034
+ "**/{.git,node_modules,bower_components,__tests__,fixtures,fixture}/**"
1035
+ ]
1036
+ }
1037
+ );
1038
+ let ui;
1039
+ if (raw.interface === false) {
1040
+ ui = { input: false, output: false };
1041
+ } else if (raw.interface === true || !raw.interface) {
1042
+ ui = { input: process.stdin, output: process.stdout };
1043
+ } else {
1044
+ let _b = raw.interface, { input, output } = _b, other = __objRest(_b, ["input", "output"]);
1045
+ if (input === true || input !== false && !input)
1046
+ input = process.stdin;
1047
+ if (output === true || output !== false && !output)
1048
+ output = process.stdout;
1049
+ ui = __spreadValues({ input, output }, other);
1050
+ }
1051
+ if (release.type === "prompt" && !(ui.input && ui.output))
1052
+ throw new Error("Cannot prompt for the version number because input or output has been disabled.");
1053
+ return { release, commit, tag, push, files, cwd, interface: ui, ignoreScripts, execute };
1054
+ }
1055
+
1056
+ // src/operation.ts
1057
+ var Operation = class {
1058
+ /**
1059
+ * Private constructor. Use the `Operation.start()` static method instead.
1060
+ */
1061
+ constructor(options, progress) {
1062
+ /**
1063
+ * The current state of the operation.
1064
+ */
1065
+ this.state = {
1066
+ release: void 0,
1067
+ oldVersion: "",
1068
+ oldVersionSource: "",
1069
+ newVersion: "",
1070
+ commitMessage: "",
1071
+ tagName: "",
1072
+ updatedFiles: [],
1073
+ skippedFiles: []
1074
+ };
1075
+ this.options = options;
1076
+ this._progress = progress;
1077
+ }
1078
+ /**
1079
+ * The results of the operation.
1080
+ */
1081
+ get results() {
1082
+ const options = this.options;
1083
+ const state = this.state;
1084
+ return {
1085
+ release: state.release,
1086
+ oldVersion: state.oldVersion,
1087
+ newVersion: state.newVersion,
1088
+ commit: options.commit ? state.commitMessage : false,
1089
+ tag: options.tag ? state.tagName : false,
1090
+ updatedFiles: state.updatedFiles.slice(),
1091
+ skippedFiles: state.skippedFiles.slice()
1092
+ };
1093
+ }
1094
+ /**
1095
+ * Starts a new `versionBump()` operation.
1096
+ */
1097
+ static async start(input) {
1098
+ const options = await normalizeOptions(input);
1099
+ return new Operation(options, input.progress);
1100
+ }
1101
+ /**
1102
+ * Updates the operation state and results, and reports the updated progress to the user.
1103
+ */
1104
+ update(_a) {
1105
+ var _b = _a, { event, script } = _b, newState = __objRest(_b, ["event", "script"]);
1106
+ Object.assign(this.state, newState);
1107
+ if (event && this._progress) {
1108
+ this._progress(__spreadValues({ event, script }, this.results));
1109
+ }
1110
+ return this;
1111
+ }
1112
+ };
1113
+
1114
+ // src/run-npm-script.ts
1115
+ import * as ezSpawn2 from "@jsdevtools/ez-spawn";
1116
+ async function runNpmScript(script, operation) {
1117
+ const { cwd, ignoreScripts } = operation.options;
1118
+ if (!ignoreScripts) {
1119
+ const { data: manifest } = await readJsonFile("package.json", cwd);
1120
+ if (isManifest(manifest) && hasScript(manifest, script)) {
1121
+ await ezSpawn2.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
1122
+ operation.update({ event: "npm script" /* NpmScript */, script });
1123
+ }
1124
+ }
1125
+ return operation;
1126
+ }
1127
+ function hasScript(manifest, script) {
1128
+ const scripts = manifest.scripts;
1129
+ if (scripts && typeof scripts === "object")
1130
+ return Boolean(scripts[script]);
1131
+ return false;
1132
+ }
1133
+
1134
+ // src/update-files.ts
1135
+ import * as path2 from "path";
1136
+ async function updateFiles(operation) {
1137
+ const { files } = operation.options;
1138
+ for (const relPath of files) {
1139
+ const modified = await updateFile(relPath, operation);
1140
+ if (modified) {
1141
+ operation.update({
1142
+ event: "file updated" /* FileUpdated */,
1143
+ updatedFiles: operation.state.updatedFiles.concat(relPath)
1144
+ });
1145
+ } else {
1146
+ operation.update({
1147
+ event: "file skipped" /* FileSkipped */,
1148
+ skippedFiles: operation.state.skippedFiles.concat(relPath)
1149
+ });
1150
+ }
1151
+ }
1152
+ return operation;
1153
+ }
1154
+ async function updateFile(relPath, operation) {
1155
+ const name = path2.basename(relPath).trim().toLowerCase();
1156
+ switch (name) {
1157
+ case "package.json":
1158
+ case "package-lock.json":
1159
+ case "bower.json":
1160
+ case "component.json":
1161
+ return updateManifestFile(relPath, operation);
1162
+ default:
1163
+ return updateTextFile(relPath, operation);
1164
+ }
1165
+ }
1166
+ async function updateManifestFile(relPath, operation) {
1167
+ const { cwd } = operation.options;
1168
+ const { newVersion } = operation.state;
1169
+ let modified = false;
1170
+ const file = await readJsonFile(relPath, cwd);
1171
+ if (isManifest(file.data) && file.data.version !== newVersion) {
1172
+ file.data.version = newVersion;
1173
+ await writeJsonFile(file);
1174
+ modified = true;
1175
+ }
1176
+ return modified;
1177
+ }
1178
+ async function updateTextFile(relPath, operation) {
1179
+ const { cwd } = operation.options;
1180
+ const { oldVersion, newVersion } = operation.state;
1181
+ const modified = false;
1182
+ const file = await readTextFile(relPath, cwd);
1183
+ if (file.data.includes(oldVersion)) {
1184
+ const sanitizedVersion = oldVersion.replace(/(\W)/g, "\\$1");
1185
+ const replacePattern = new RegExp(`(\\b|v)${sanitizedVersion}\\b`, "g");
1186
+ file.data = file.data.replace(replacePattern, `$1${newVersion}`);
1187
+ await writeTextFile(file);
1188
+ return true;
1189
+ }
1190
+ return modified;
1191
+ }
1192
+
1193
+ // src/version-bump.ts
1194
+ async function versionBump(arg = {}) {
1195
+ if (typeof arg === "string")
1196
+ arg = { release: arg };
1197
+ const operation = await Operation.start(arg);
1198
+ await getOldVersion(operation);
1199
+ await getNewVersion(operation);
1200
+ if (arg.confirm) {
1201
+ printSummary(operation);
1202
+ if (!await prompts2({
1203
+ name: "yes",
1204
+ type: "confirm",
1205
+ message: "Bump?",
1206
+ initial: true
1207
+ }).then((r) => r.yes))
1208
+ process.exit(1);
1209
+ }
1210
+ await runNpmScript("preversion" /* PreVersion */, operation);
1211
+ await updateFiles(operation);
1212
+ if (operation.options.execute) {
1213
+ console.log(log_symbols_default.info, "Executing script", operation.options.execute);
1214
+ await ezSpawn3.async(operation.options.execute, { stdio: "inherit" });
1215
+ console.log(log_symbols_default.success, "Script finished");
1216
+ }
1217
+ await runNpmScript("version" /* Version */, operation);
1218
+ await gitCommit(operation);
1219
+ await gitTag(operation);
1220
+ await runNpmScript("postversion" /* PostVersion */, operation);
1221
+ await gitPush(operation);
1222
+ return operation.results;
1223
+ }
1224
+ function printSummary(operation) {
1225
+ console.log();
1226
+ console.log(` files ${operation.options.files.map((i) => import_picocolors2.default.bold(i)).join("\n ")}`);
1227
+ if (operation.options.commit)
1228
+ console.log(` commit ${import_picocolors2.default.bold(formatVersionString(operation.options.commit.message, operation.state.newVersion))}`);
1229
+ if (operation.options.tag)
1230
+ console.log(` tag ${import_picocolors2.default.bold(formatVersionString(operation.options.tag.name, operation.state.newVersion))}`);
1231
+ if (operation.options.execute)
1232
+ console.log(` execute ${import_picocolors2.default.bold(operation.options.execute)}`);
1233
+ if (operation.options.push)
1234
+ console.log(` push ${import_picocolors2.default.cyan(import_picocolors2.default.bold("yes"))}`);
1235
+ console.log();
1236
+ console.log(` from ${import_picocolors2.default.bold(operation.state.oldVersion)}`);
1237
+ console.log(` to ${import_picocolors2.default.green(import_picocolors2.default.bold(operation.state.newVersion))}`);
1238
+ console.log();
1239
+ }
1240
+ async function versionBumpInfo(arg = {}) {
1241
+ if (typeof arg === "string")
1242
+ arg = { release: arg };
1243
+ const operation = await Operation.start(arg);
1244
+ await getOldVersion(operation);
1245
+ await getNewVersion(operation);
1246
+ return operation;
1247
+ }
1248
+
1249
+ export {
1250
+ __toESM,
1251
+ require_picocolors,
1252
+ log_symbols_default,
1253
+ ReleaseType,
1254
+ isReleaseType,
1255
+ ProgressEvent,
1256
+ NpmScript,
1257
+ versionBump,
1258
+ versionBumpInfo
1259
+ };