bumpp 9.4.1 → 9.5.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.
@@ -25,8 +25,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
25
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
26
26
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
27
27
  }) : x)(function(x) {
28
- if (typeof require !== "undefined")
29
- return require.apply(this, arguments);
28
+ if (typeof require !== "undefined") return require.apply(this, arguments);
30
29
  throw Error('Dynamic require of "' + x + '" is not supported');
31
30
  });
32
31
  var __objRest = (source, exclude) => {
@@ -61,50 +60,58 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
61
60
  mod
62
61
  ));
63
62
 
64
- // node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js
63
+ // node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
65
64
  var require_picocolors = __commonJS({
66
- "node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js"(exports, module) {
67
- var tty2 = __require("tty");
68
- 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);
65
+ "node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports, module) {
66
+ var argv = process.argv || [];
67
+ var env2 = process.env;
68
+ var isColorSupported = !("NO_COLOR" in env2 || argv.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv.includes("--color") || process.platform === "win32" || __require != null && __require("tty").isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
69
69
  var formatter = (open, close, replace = open) => (input) => {
70
70
  let string = "" + input;
71
71
  let index = string.indexOf(close, open.length);
72
72
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
73
73
  };
74
74
  var replaceClose = (string, close, replace, index) => {
75
- let start = string.substring(0, index) + replace;
76
- let end = string.substring(index + close.length);
77
- let nextIndex = end.indexOf(close);
78
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
75
+ let result = "";
76
+ let cursor = 0;
77
+ do {
78
+ result += string.substring(cursor, index) + replace;
79
+ cursor = index + close.length;
80
+ index = string.indexOf(close, cursor);
81
+ } while (~index);
82
+ return result + string.substring(cursor);
83
+ };
84
+ var createColors = (enabled = isColorSupported) => {
85
+ let init = enabled ? formatter : () => String;
86
+ return {
87
+ isColorSupported: enabled,
88
+ reset: init("\x1B[0m", "\x1B[0m"),
89
+ bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
90
+ dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
91
+ italic: init("\x1B[3m", "\x1B[23m"),
92
+ underline: init("\x1B[4m", "\x1B[24m"),
93
+ inverse: init("\x1B[7m", "\x1B[27m"),
94
+ hidden: init("\x1B[8m", "\x1B[28m"),
95
+ strikethrough: init("\x1B[9m", "\x1B[29m"),
96
+ black: init("\x1B[30m", "\x1B[39m"),
97
+ red: init("\x1B[31m", "\x1B[39m"),
98
+ green: init("\x1B[32m", "\x1B[39m"),
99
+ yellow: init("\x1B[33m", "\x1B[39m"),
100
+ blue: init("\x1B[34m", "\x1B[39m"),
101
+ magenta: init("\x1B[35m", "\x1B[39m"),
102
+ cyan: init("\x1B[36m", "\x1B[39m"),
103
+ white: init("\x1B[37m", "\x1B[39m"),
104
+ gray: init("\x1B[90m", "\x1B[39m"),
105
+ bgBlack: init("\x1B[40m", "\x1B[49m"),
106
+ bgRed: init("\x1B[41m", "\x1B[49m"),
107
+ bgGreen: init("\x1B[42m", "\x1B[49m"),
108
+ bgYellow: init("\x1B[43m", "\x1B[49m"),
109
+ bgBlue: init("\x1B[44m", "\x1B[49m"),
110
+ bgMagenta: init("\x1B[45m", "\x1B[49m"),
111
+ bgCyan: init("\x1B[46m", "\x1B[49m"),
112
+ bgWhite: init("\x1B[47m", "\x1B[49m")
113
+ };
79
114
  };
80
- var createColors = (enabled = isColorSupported) => ({
81
- isColorSupported: enabled,
82
- reset: enabled ? (s) => `\x1B[0m${s}\x1B[0m` : String,
83
- bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
84
- dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
85
- italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
86
- underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
87
- inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
88
- hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
89
- strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
90
- black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
91
- red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
92
- green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
93
- yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
94
- blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
95
- magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
96
- cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
97
- white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
98
- gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
99
- bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
100
- bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
101
- bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
102
- bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
103
- bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
104
- bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
105
- bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
106
- bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
107
- });
108
115
  module.exports = createColors();
109
116
  module.exports.createColors = createColors;
110
117
  }
@@ -689,9 +696,9 @@ function getNextVersion(currentVersion, bump) {
689
696
  }
690
697
  function getNextVersions(currentVersion, preid) {
691
698
  const next = {};
692
- const parse = semver.parse(currentVersion);
693
- if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
694
- preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
699
+ const parse2 = semver.parse(currentVersion);
700
+ if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
701
+ preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
695
702
  for (const type of releaseTypes)
696
703
  next[type] = getNextVersion(currentVersion, { type, preid });
697
704
  return next;
@@ -754,134 +761,20 @@ import { valid as isValidVersion2 } from "semver";
754
761
  // src/fs.ts
755
762
  import fs from "fs";
756
763
  import path from "path";
757
-
758
- // node_modules/.pnpm/detect-indent@7.0.1/node_modules/detect-indent/index.js
759
- var INDENT_REGEX = /^(?:( )+|\t+)/;
760
- var INDENT_TYPE_SPACE = "space";
761
- var INDENT_TYPE_TAB = "tab";
762
- function makeIndentsMap(string, ignoreSingleSpaces) {
763
- const indents = /* @__PURE__ */ new Map();
764
- let previousSize = 0;
765
- let previousIndentType;
766
- let key;
767
- for (const line of string.split(/\n/g)) {
768
- if (!line) {
769
- continue;
770
- }
771
- let indent;
772
- let indentType;
773
- let use;
774
- let weight;
775
- let entry;
776
- const matches = line.match(INDENT_REGEX);
777
- if (matches === null) {
778
- previousSize = 0;
779
- previousIndentType = "";
780
- } else {
781
- indent = matches[0].length;
782
- indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
783
- if (ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && indent === 1) {
784
- continue;
785
- }
786
- if (indentType !== previousIndentType) {
787
- previousSize = 0;
788
- }
789
- previousIndentType = indentType;
790
- use = 1;
791
- weight = 0;
792
- const indentDifference = indent - previousSize;
793
- previousSize = indent;
794
- if (indentDifference === 0) {
795
- use = 0;
796
- weight = 1;
797
- } else {
798
- const absoluteIndentDifference = indentDifference > 0 ? indentDifference : -indentDifference;
799
- key = encodeIndentsKey(indentType, absoluteIndentDifference);
800
- }
801
- entry = indents.get(key);
802
- entry = entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight];
803
- indents.set(key, entry);
804
- }
805
- }
806
- return indents;
807
- }
808
- function encodeIndentsKey(indentType, indentAmount) {
809
- const typeCharacter = indentType === INDENT_TYPE_SPACE ? "s" : "t";
810
- return typeCharacter + String(indentAmount);
811
- }
812
- function decodeIndentsKey(indentsKey) {
813
- const keyHasTypeSpace = indentsKey[0] === "s";
814
- const type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
815
- const amount = Number(indentsKey.slice(1));
816
- return { type, amount };
817
- }
818
- function getMostUsedKey(indents) {
819
- let result;
820
- let maxUsed = 0;
821
- let maxWeight = 0;
822
- for (const [key, [usedCount, weight]] of indents) {
823
- if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
824
- maxUsed = usedCount;
825
- maxWeight = weight;
826
- result = key;
827
- }
828
- }
829
- return result;
830
- }
831
- function makeIndentString(type, amount) {
832
- const indentCharacter = type === INDENT_TYPE_SPACE ? " " : " ";
833
- return indentCharacter.repeat(amount);
834
- }
835
- function detectIndent(string) {
836
- if (typeof string !== "string") {
837
- throw new TypeError("Expected a string");
838
- }
839
- let indents = makeIndentsMap(string, true);
840
- if (indents.size === 0) {
841
- indents = makeIndentsMap(string, false);
842
- }
843
- const keyOfMostUsedIndent = getMostUsedKey(indents);
844
- let type;
845
- let amount = 0;
846
- let indent = "";
847
- if (keyOfMostUsedIndent !== void 0) {
848
- ({ type, amount } = decodeIndentsKey(keyOfMostUsedIndent));
849
- indent = makeIndentString(type, amount);
850
- }
851
- return {
852
- amount,
853
- type,
854
- indent
855
- };
856
- }
857
-
858
- // node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
859
- function detectNewline(string) {
860
- if (typeof string !== "string") {
861
- throw new TypeError("Expected a string");
862
- }
863
- const newlines = string.match(/(?:\r?\n)/g) || [];
864
- if (newlines.length === 0) {
865
- return;
866
- }
867
- const crlf = newlines.filter((newline) => newline === "\r\n").length;
868
- const lf = newlines.length - crlf;
869
- return crlf > lf ? "\r\n" : "\n";
870
- }
871
-
872
- // src/fs.ts
873
- async function readJsonFile(name, cwd) {
764
+ import * as jsonc from "jsonc-parser";
765
+ async function readJsoncFile(name, cwd) {
874
766
  const file = await readTextFile(name, cwd);
875
- const data = JSON.parse(file.data);
876
- const indent = detectIndent(file.data).indent;
877
- const newline = detectNewline(file.data);
878
- return __spreadProps(__spreadValues({}, file), { data, indent, newline });
767
+ const data = jsonc.parse(file.data);
768
+ const modified = [];
769
+ return __spreadProps(__spreadValues({}, file), { data, modified, text: file.data });
879
770
  }
880
- async function writeJsonFile(file) {
881
- let json = JSON.stringify(file.data, void 0, file.indent);
882
- if (file.newline)
883
- json += file.newline;
884
- return writeTextFile(__spreadProps(__spreadValues({}, file), { data: json }));
771
+ async function writeJsoncFile(file) {
772
+ let newJSON = file.text;
773
+ for (const [key, value] of file.modified) {
774
+ const edit = jsonc.modify(file.text, key, value, {});
775
+ newJSON = jsonc.applyEdits(newJSON, edit);
776
+ }
777
+ return writeTextFile(__spreadProps(__spreadValues({}, file), { data: newJSON }));
885
778
  }
886
779
  function readTextFile(name, cwd) {
887
780
  return new Promise((resolve, reject) => {
@@ -930,6 +823,8 @@ async function getCurrentVersion(operation) {
930
823
  const filesToCheck = files.filter((file) => file.endsWith(".json"));
931
824
  if (!filesToCheck.includes("package.json"))
932
825
  filesToCheck.push("package.json");
826
+ if (!filesToCheck.includes("deno.json"))
827
+ filesToCheck.push("deno.json");
933
828
  for (const file of filesToCheck) {
934
829
  const version = await readVersion(file, cwd);
935
830
  if (version) {
@@ -945,12 +840,12 @@ async function getCurrentVersion(operation) {
945
840
  }
946
841
  async function readVersion(file, cwd) {
947
842
  try {
948
- const { data: manifest } = await readJsonFile(file, cwd);
843
+ const { data: manifest } = await readJsoncFile(file, cwd);
949
844
  if (isManifest(manifest)) {
950
845
  if (isValidVersion2(manifest.version))
951
846
  return manifest.version;
952
847
  }
953
- } catch (error) {
848
+ } catch (e) {
954
849
  return void 0;
955
850
  }
956
851
  }
@@ -1049,7 +944,9 @@ async function normalizeOptions(raw) {
1049
944
  "package-lock.json",
1050
945
  "packages/**/package.json",
1051
946
  "jsr.json",
1052
- "jsr.jsonc"
947
+ "jsr.jsonc",
948
+ "deno.json",
949
+ "deno.jsonc"
1053
950
  ];
1054
951
  if (fsSync.existsSync("pnpm-workspace.yaml")) {
1055
952
  const pnpmWorkspace = await fs2.readFile("pnpm-workspace.yaml", "utf8");
@@ -1062,7 +959,7 @@ async function normalizeOptions(raw) {
1062
959
  raw.files = raw.files.concat(withoutExcludedWorkspaces);
1063
960
  }
1064
961
  } else {
1065
- raw.files = ((_b = raw.files) == null ? void 0 : _b.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"];
962
+ raw.files = ((_b = raw.files) == null ? void 0 : _b.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc", "deno.json", "deno.jsonc"];
1066
963
  }
1067
964
  const files = await fg(
1068
965
  raw.files,
@@ -1173,7 +1070,7 @@ import * as ezSpawn2 from "@jsdevtools/ez-spawn";
1173
1070
  async function runNpmScript(script, operation) {
1174
1071
  const { cwd, ignoreScripts } = operation.options;
1175
1072
  if (!ignoreScripts) {
1176
- const { data: manifest } = await readJsonFile("package.json", cwd);
1073
+ const { data: manifest } = await readJsoncFile("package.json", cwd);
1177
1074
  if (isManifest(manifest) && hasScript(manifest, script)) {
1178
1075
  await ezSpawn2.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
1179
1076
  operation.update({ event: "npm script" /* NpmScript */, script });
@@ -1216,6 +1113,9 @@ async function updateFile(relPath, operation) {
1216
1113
  case "bower.json":
1217
1114
  case "component.json":
1218
1115
  case "jsr.json":
1116
+ case "jsr.jsonc":
1117
+ case "deno.json":
1118
+ case "deno.jsonc":
1219
1119
  return updateManifestFile(relPath, operation);
1220
1120
  default:
1221
1121
  return updateTextFile(relPath, operation);
@@ -1225,12 +1125,12 @@ async function updateManifestFile(relPath, operation) {
1225
1125
  const { cwd } = operation.options;
1226
1126
  const { newVersion } = operation.state;
1227
1127
  let modified = false;
1228
- const file = await readJsonFile(relPath, cwd);
1128
+ const file = await readJsoncFile(relPath, cwd);
1229
1129
  if (isManifest(file.data) && file.data.version !== newVersion) {
1230
- file.data.version = newVersion;
1130
+ file.modified.push([["version"], newVersion]);
1231
1131
  if (isPackageLockManifest(file.data))
1232
- file.data.packages[""].version = newVersion;
1233
- await writeJsonFile(file);
1132
+ file.modified.push([["packages", "", "version"], newVersion]);
1133
+ await writeJsoncFile(file);
1234
1134
  modified = true;
1235
1135
  }
1236
1136
  return modified;
@@ -1264,8 +1164,9 @@ async function versionBump(arg = {}) {
1264
1164
  type: "confirm",
1265
1165
  message: "Bump?",
1266
1166
  initial: true
1267
- }).then((r) => r.yes))
1167
+ }).then((r) => r.yes)) {
1268
1168
  process6.exit(1);
1169
+ }
1269
1170
  }
1270
1171
  await runNpmScript("preversion" /* PreVersion */, operation);
1271
1172
  await updateFiles(operation);
package/dist/cli/index.js CHANGED
@@ -58,50 +58,58 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
58
58
  ));
59
59
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
60
60
 
61
- // node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js
61
+ // node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
62
62
  var require_picocolors = __commonJS({
63
- "node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js"(exports2, module2) {
64
- var tty2 = require("tty");
65
- 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);
63
+ "node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports2, module2) {
64
+ var argv = process.argv || [];
65
+ var env2 = process.env;
66
+ var isColorSupported = !("NO_COLOR" in env2 || argv.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv.includes("--color") || process.platform === "win32" || require != null && require("tty").isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
66
67
  var formatter = (open, close, replace = open) => (input) => {
67
68
  let string = "" + input;
68
69
  let index = string.indexOf(close, open.length);
69
70
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
70
71
  };
71
72
  var replaceClose = (string, close, replace, index) => {
72
- let start = string.substring(0, index) + replace;
73
- let end = string.substring(index + close.length);
74
- let nextIndex = end.indexOf(close);
75
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
73
+ let result = "";
74
+ let cursor = 0;
75
+ do {
76
+ result += string.substring(cursor, index) + replace;
77
+ cursor = index + close.length;
78
+ index = string.indexOf(close, cursor);
79
+ } while (~index);
80
+ return result + string.substring(cursor);
81
+ };
82
+ var createColors = (enabled = isColorSupported) => {
83
+ let init = enabled ? formatter : () => String;
84
+ return {
85
+ isColorSupported: enabled,
86
+ reset: init("\x1B[0m", "\x1B[0m"),
87
+ bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
88
+ dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
89
+ italic: init("\x1B[3m", "\x1B[23m"),
90
+ underline: init("\x1B[4m", "\x1B[24m"),
91
+ inverse: init("\x1B[7m", "\x1B[27m"),
92
+ hidden: init("\x1B[8m", "\x1B[28m"),
93
+ strikethrough: init("\x1B[9m", "\x1B[29m"),
94
+ black: init("\x1B[30m", "\x1B[39m"),
95
+ red: init("\x1B[31m", "\x1B[39m"),
96
+ green: init("\x1B[32m", "\x1B[39m"),
97
+ yellow: init("\x1B[33m", "\x1B[39m"),
98
+ blue: init("\x1B[34m", "\x1B[39m"),
99
+ magenta: init("\x1B[35m", "\x1B[39m"),
100
+ cyan: init("\x1B[36m", "\x1B[39m"),
101
+ white: init("\x1B[37m", "\x1B[39m"),
102
+ gray: init("\x1B[90m", "\x1B[39m"),
103
+ bgBlack: init("\x1B[40m", "\x1B[49m"),
104
+ bgRed: init("\x1B[41m", "\x1B[49m"),
105
+ bgGreen: init("\x1B[42m", "\x1B[49m"),
106
+ bgYellow: init("\x1B[43m", "\x1B[49m"),
107
+ bgBlue: init("\x1B[44m", "\x1B[49m"),
108
+ bgMagenta: init("\x1B[45m", "\x1B[49m"),
109
+ bgCyan: init("\x1B[46m", "\x1B[49m"),
110
+ bgWhite: init("\x1B[47m", "\x1B[49m")
111
+ };
76
112
  };
77
- var createColors = (enabled = isColorSupported) => ({
78
- isColorSupported: enabled,
79
- reset: enabled ? (s) => `\x1B[0m${s}\x1B[0m` : String,
80
- bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
81
- dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
82
- italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
83
- underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
84
- inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
85
- hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
86
- strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
87
- black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
88
- red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
89
- green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
90
- yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
91
- blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
92
- magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
93
- cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
94
- white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
95
- gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
96
- bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
97
- bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
98
- bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
99
- bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
100
- bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
101
- bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
102
- bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
103
- bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
104
- });
105
113
  module2.exports = createColors();
106
114
  module2.exports.createColors = createColors;
107
115
  }
@@ -628,7 +636,7 @@ var logSymbols = isUnicodeSupported() ? main : fallback;
628
636
  var log_symbols_default = logSymbols;
629
637
 
630
638
  // package.json
631
- var version = "9.4.1";
639
+ var version = "9.5.0";
632
640
 
633
641
  // src/version-bump.ts
634
642
  var import_node_process5 = __toESM(require("process"));
@@ -682,9 +690,9 @@ function getNextVersion(currentVersion, bump) {
682
690
  }
683
691
  function getNextVersions(currentVersion, preid) {
684
692
  const next = {};
685
- const parse = import_semver.default.parse(currentVersion);
686
- if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
687
- preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
693
+ const parse2 = import_semver.default.parse(currentVersion);
694
+ if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
695
+ preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
688
696
  for (const type of releaseTypes)
689
697
  next[type] = getNextVersion(currentVersion, { type, preid });
690
698
  return next;
@@ -747,134 +755,20 @@ var import_semver2 = require("semver");
747
755
  // src/fs.ts
748
756
  var import_node_fs = __toESM(require("fs"));
749
757
  var import_node_path = __toESM(require("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.1/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) {
758
+ var jsonc = __toESM(require("jsonc-parser"));
759
+ async function readJsoncFile(name, cwd) {
867
760
  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 });
761
+ const data = jsonc.parse(file.data);
762
+ const modified = [];
763
+ return __spreadProps(__spreadValues({}, file), { data, modified, text: file.data });
872
764
  }
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 }));
765
+ async function writeJsoncFile(file) {
766
+ let newJSON = file.text;
767
+ for (const [key, value] of file.modified) {
768
+ const edit = jsonc.modify(file.text, key, value, {});
769
+ newJSON = jsonc.applyEdits(newJSON, edit);
770
+ }
771
+ return writeTextFile(__spreadProps(__spreadValues({}, file), { data: newJSON }));
878
772
  }
879
773
  function readTextFile(name, cwd) {
880
774
  return new Promise((resolve, reject) => {
@@ -923,6 +817,8 @@ async function getCurrentVersion(operation) {
923
817
  const filesToCheck = files.filter((file) => file.endsWith(".json"));
924
818
  if (!filesToCheck.includes("package.json"))
925
819
  filesToCheck.push("package.json");
820
+ if (!filesToCheck.includes("deno.json"))
821
+ filesToCheck.push("deno.json");
926
822
  for (const file of filesToCheck) {
927
823
  const version2 = await readVersion(file, cwd);
928
824
  if (version2) {
@@ -938,12 +834,12 @@ async function getCurrentVersion(operation) {
938
834
  }
939
835
  async function readVersion(file, cwd) {
940
836
  try {
941
- const { data: manifest } = await readJsonFile(file, cwd);
837
+ const { data: manifest } = await readJsoncFile(file, cwd);
942
838
  if (isManifest(manifest)) {
943
839
  if ((0, import_semver2.valid)(manifest.version))
944
840
  return manifest.version;
945
841
  }
946
- } catch (error) {
842
+ } catch (e) {
947
843
  return void 0;
948
844
  }
949
845
  }
@@ -1042,7 +938,9 @@ async function normalizeOptions(raw) {
1042
938
  "package-lock.json",
1043
939
  "packages/**/package.json",
1044
940
  "jsr.json",
1045
- "jsr.jsonc"
941
+ "jsr.jsonc",
942
+ "deno.json",
943
+ "deno.jsonc"
1046
944
  ];
1047
945
  if (import_node_fs2.default.existsSync("pnpm-workspace.yaml")) {
1048
946
  const pnpmWorkspace = await import_promises.default.readFile("pnpm-workspace.yaml", "utf8");
@@ -1055,7 +953,7 @@ async function normalizeOptions(raw) {
1055
953
  raw.files = raw.files.concat(withoutExcludedWorkspaces);
1056
954
  }
1057
955
  } else {
1058
- raw.files = ((_b = raw.files) == null ? void 0 : _b.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"];
956
+ raw.files = ((_b = raw.files) == null ? void 0 : _b.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc", "deno.json", "deno.jsonc"];
1059
957
  }
1060
958
  const files = await (0, import_fast_glob.default)(
1061
959
  raw.files,
@@ -1166,7 +1064,7 @@ var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
1166
1064
  async function runNpmScript(script, operation) {
1167
1065
  const { cwd, ignoreScripts } = operation.options;
1168
1066
  if (!ignoreScripts) {
1169
- const { data: manifest } = await readJsonFile("package.json", cwd);
1067
+ const { data: manifest } = await readJsoncFile("package.json", cwd);
1170
1068
  if (isManifest(manifest) && hasScript(manifest, script)) {
1171
1069
  await ezSpawn2.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
1172
1070
  operation.update({ event: "npm script" /* NpmScript */, script });
@@ -1209,6 +1107,9 @@ async function updateFile(relPath, operation) {
1209
1107
  case "bower.json":
1210
1108
  case "component.json":
1211
1109
  case "jsr.json":
1110
+ case "jsr.jsonc":
1111
+ case "deno.json":
1112
+ case "deno.jsonc":
1212
1113
  return updateManifestFile(relPath, operation);
1213
1114
  default:
1214
1115
  return updateTextFile(relPath, operation);
@@ -1218,12 +1119,12 @@ async function updateManifestFile(relPath, operation) {
1218
1119
  const { cwd } = operation.options;
1219
1120
  const { newVersion } = operation.state;
1220
1121
  let modified = false;
1221
- const file = await readJsonFile(relPath, cwd);
1122
+ const file = await readJsoncFile(relPath, cwd);
1222
1123
  if (isManifest(file.data) && file.data.version !== newVersion) {
1223
- file.data.version = newVersion;
1124
+ file.modified.push([["version"], newVersion]);
1224
1125
  if (isPackageLockManifest(file.data))
1225
- file.data.packages[""].version = newVersion;
1226
- await writeJsonFile(file);
1126
+ file.modified.push([["packages", "", "version"], newVersion]);
1127
+ await writeJsoncFile(file);
1227
1128
  modified = true;
1228
1129
  }
1229
1130
  return modified;
@@ -1257,8 +1158,9 @@ async function versionBump(arg = {}) {
1257
1158
  type: "confirm",
1258
1159
  message: "Bump?",
1259
1160
  initial: true
1260
- }).then((r) => r.yes))
1161
+ }).then((r) => r.yes)) {
1261
1162
  import_node_process5.default.exit(1);
1163
+ }
1262
1164
  }
1263
1165
  await runNpmScript("preversion" /* PreVersion */, operation);
1264
1166
  await updateFiles(operation);
@@ -1394,8 +1296,8 @@ function loadCliArgs(argv = import_node_process7.default.argv) {
1394
1296
  const result = cli.parse(argv);
1395
1297
  const rawArgs = cli.rawArgs;
1396
1298
  const args = result.options;
1397
- const COMMIT_REG = /(-c|--commit|--no-commit)(=.*|$)/;
1398
- const TAG_REG = /(-t|--tag|--no-tag)(=.*|$)/;
1299
+ const COMMIT_REG = /(?:-c|--commit|--no-commit)(?:=.*|$)/;
1300
+ const TAG_REG = /(?:-t|--tag|--no-tag)(?:=.*|$)/;
1399
1301
  const hasCommitFlag = rawArgs.some((arg) => COMMIT_REG.test(arg));
1400
1302
  const hasTagFlag = rawArgs.some((arg) => TAG_REG.test(arg));
1401
1303
  const _a = args, { tag, commit } = _a, rest = __objRest(_a, ["tag", "commit"]);
@@ -10,13 +10,13 @@ import {
10
10
  log_symbols_default,
11
11
  require_picocolors,
12
12
  versionBump
13
- } from "../chunk-ZH3O6GQ3.mjs";
13
+ } from "../chunk-BWAJDQ77.mjs";
14
14
 
15
15
  // src/cli/index.ts
16
16
  import process2 from "process";
17
17
 
18
18
  // package.json
19
- var version = "9.4.1";
19
+ var version = "9.5.0";
20
20
 
21
21
  // src/cli/parse-args.ts
22
22
  var import_picocolors = __toESM(require_picocolors());
@@ -66,8 +66,8 @@ function loadCliArgs(argv = process.argv) {
66
66
  const result = cli.parse(argv);
67
67
  const rawArgs = cli.rawArgs;
68
68
  const args = result.options;
69
- const COMMIT_REG = /(-c|--commit|--no-commit)(=.*|$)/;
70
- const TAG_REG = /(-t|--tag|--no-tag)(=.*|$)/;
69
+ const COMMIT_REG = /(?:-c|--commit|--no-commit)(?:=.*|$)/;
70
+ const TAG_REG = /(?:-t|--tag|--no-tag)(?:=.*|$)/;
71
71
  const hasCommitFlag = rawArgs.some((arg) => COMMIT_REG.test(arg));
72
72
  const hasTagFlag = rawArgs.some((arg) => TAG_REG.test(arg));
73
73
  const _a = args, { tag, commit } = _a, rest = __objRest(_a, ["tag", "commit"]);
package/dist/index.d.mts CHANGED
@@ -143,7 +143,7 @@ interface VersionBumpOptions {
143
143
  * (ReadMe files, config files, source code, etc.) it will simply do a global replacement
144
144
  * of the old version number with the new version number.
145
145
  *
146
- * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"]
146
+ * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc", "deno.json", "deno.jsonc"].
147
147
  */
148
148
  files?: string[];
149
149
  /**
package/dist/index.d.ts CHANGED
@@ -143,7 +143,7 @@ interface VersionBumpOptions {
143
143
  * (ReadMe files, config files, source code, etc.) it will simply do a global replacement
144
144
  * of the old version number with the new version number.
145
145
  *
146
- * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"]
146
+ * Defaults to ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc", "deno.json", "deno.jsonc"].
147
147
  */
148
148
  files?: string[];
149
149
  /**
package/dist/index.js CHANGED
@@ -58,50 +58,58 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
58
58
  ));
59
59
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
60
60
 
61
- // node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js
61
+ // node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
62
62
  var require_picocolors = __commonJS({
63
- "node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js"(exports2, module2) {
64
- var tty2 = require("tty");
65
- 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);
63
+ "node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports2, module2) {
64
+ var argv = process.argv || [];
65
+ var env2 = process.env;
66
+ var isColorSupported = !("NO_COLOR" in env2 || argv.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv.includes("--color") || process.platform === "win32" || require != null && require("tty").isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
66
67
  var formatter = (open, close, replace = open) => (input) => {
67
68
  let string = "" + input;
68
69
  let index = string.indexOf(close, open.length);
69
70
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
70
71
  };
71
72
  var replaceClose = (string, close, replace, index) => {
72
- let start = string.substring(0, index) + replace;
73
- let end = string.substring(index + close.length);
74
- let nextIndex = end.indexOf(close);
75
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
73
+ let result = "";
74
+ let cursor = 0;
75
+ do {
76
+ result += string.substring(cursor, index) + replace;
77
+ cursor = index + close.length;
78
+ index = string.indexOf(close, cursor);
79
+ } while (~index);
80
+ return result + string.substring(cursor);
81
+ };
82
+ var createColors = (enabled = isColorSupported) => {
83
+ let init = enabled ? formatter : () => String;
84
+ return {
85
+ isColorSupported: enabled,
86
+ reset: init("\x1B[0m", "\x1B[0m"),
87
+ bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
88
+ dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
89
+ italic: init("\x1B[3m", "\x1B[23m"),
90
+ underline: init("\x1B[4m", "\x1B[24m"),
91
+ inverse: init("\x1B[7m", "\x1B[27m"),
92
+ hidden: init("\x1B[8m", "\x1B[28m"),
93
+ strikethrough: init("\x1B[9m", "\x1B[29m"),
94
+ black: init("\x1B[30m", "\x1B[39m"),
95
+ red: init("\x1B[31m", "\x1B[39m"),
96
+ green: init("\x1B[32m", "\x1B[39m"),
97
+ yellow: init("\x1B[33m", "\x1B[39m"),
98
+ blue: init("\x1B[34m", "\x1B[39m"),
99
+ magenta: init("\x1B[35m", "\x1B[39m"),
100
+ cyan: init("\x1B[36m", "\x1B[39m"),
101
+ white: init("\x1B[37m", "\x1B[39m"),
102
+ gray: init("\x1B[90m", "\x1B[39m"),
103
+ bgBlack: init("\x1B[40m", "\x1B[49m"),
104
+ bgRed: init("\x1B[41m", "\x1B[49m"),
105
+ bgGreen: init("\x1B[42m", "\x1B[49m"),
106
+ bgYellow: init("\x1B[43m", "\x1B[49m"),
107
+ bgBlue: init("\x1B[44m", "\x1B[49m"),
108
+ bgMagenta: init("\x1B[45m", "\x1B[49m"),
109
+ bgCyan: init("\x1B[46m", "\x1B[49m"),
110
+ bgWhite: init("\x1B[47m", "\x1B[49m")
111
+ };
76
112
  };
77
- var createColors = (enabled = isColorSupported) => ({
78
- isColorSupported: enabled,
79
- reset: enabled ? (s) => `\x1B[0m${s}\x1B[0m` : String,
80
- bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
81
- dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
82
- italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
83
- underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
84
- inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
85
- hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
86
- strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
87
- black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
88
- red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
89
- green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
90
- yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
91
- blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
92
- magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
93
- cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
94
- white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
95
- gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
96
- bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
97
- bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
98
- bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
99
- bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
100
- bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
101
- bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
102
- bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
103
- bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
104
- });
105
113
  module2.exports = createColors();
106
114
  module2.exports.createColors = createColors;
107
115
  }
@@ -687,9 +695,9 @@ function getNextVersion(currentVersion, bump) {
687
695
  }
688
696
  function getNextVersions(currentVersion, preid) {
689
697
  const next = {};
690
- const parse = import_semver.default.parse(currentVersion);
691
- if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
692
- preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
698
+ const parse2 = import_semver.default.parse(currentVersion);
699
+ if (typeof (parse2 == null ? void 0 : parse2.prerelease[0]) === "string")
700
+ preid = (parse2 == null ? void 0 : parse2.prerelease[0]) || "preid";
693
701
  for (const type of releaseTypes)
694
702
  next[type] = getNextVersion(currentVersion, { type, preid });
695
703
  return next;
@@ -752,134 +760,20 @@ var import_semver2 = require("semver");
752
760
  // src/fs.ts
753
761
  var import_node_fs = __toESM(require("fs"));
754
762
  var import_node_path = __toESM(require("path"));
755
-
756
- // node_modules/.pnpm/detect-indent@7.0.1/node_modules/detect-indent/index.js
757
- var INDENT_REGEX = /^(?:( )+|\t+)/;
758
- var INDENT_TYPE_SPACE = "space";
759
- var INDENT_TYPE_TAB = "tab";
760
- function makeIndentsMap(string, ignoreSingleSpaces) {
761
- const indents = /* @__PURE__ */ new Map();
762
- let previousSize = 0;
763
- let previousIndentType;
764
- let key;
765
- for (const line of string.split(/\n/g)) {
766
- if (!line) {
767
- continue;
768
- }
769
- let indent;
770
- let indentType;
771
- let use;
772
- let weight;
773
- let entry;
774
- const matches = line.match(INDENT_REGEX);
775
- if (matches === null) {
776
- previousSize = 0;
777
- previousIndentType = "";
778
- } else {
779
- indent = matches[0].length;
780
- indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
781
- if (ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && indent === 1) {
782
- continue;
783
- }
784
- if (indentType !== previousIndentType) {
785
- previousSize = 0;
786
- }
787
- previousIndentType = indentType;
788
- use = 1;
789
- weight = 0;
790
- const indentDifference = indent - previousSize;
791
- previousSize = indent;
792
- if (indentDifference === 0) {
793
- use = 0;
794
- weight = 1;
795
- } else {
796
- const absoluteIndentDifference = indentDifference > 0 ? indentDifference : -indentDifference;
797
- key = encodeIndentsKey(indentType, absoluteIndentDifference);
798
- }
799
- entry = indents.get(key);
800
- entry = entry === void 0 ? [1, 0] : [entry[0] + use, entry[1] + weight];
801
- indents.set(key, entry);
802
- }
803
- }
804
- return indents;
805
- }
806
- function encodeIndentsKey(indentType, indentAmount) {
807
- const typeCharacter = indentType === INDENT_TYPE_SPACE ? "s" : "t";
808
- return typeCharacter + String(indentAmount);
809
- }
810
- function decodeIndentsKey(indentsKey) {
811
- const keyHasTypeSpace = indentsKey[0] === "s";
812
- const type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
813
- const amount = Number(indentsKey.slice(1));
814
- return { type, amount };
815
- }
816
- function getMostUsedKey(indents) {
817
- let result;
818
- let maxUsed = 0;
819
- let maxWeight = 0;
820
- for (const [key, [usedCount, weight]] of indents) {
821
- if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
822
- maxUsed = usedCount;
823
- maxWeight = weight;
824
- result = key;
825
- }
826
- }
827
- return result;
828
- }
829
- function makeIndentString(type, amount) {
830
- const indentCharacter = type === INDENT_TYPE_SPACE ? " " : " ";
831
- return indentCharacter.repeat(amount);
832
- }
833
- function detectIndent(string) {
834
- if (typeof string !== "string") {
835
- throw new TypeError("Expected a string");
836
- }
837
- let indents = makeIndentsMap(string, true);
838
- if (indents.size === 0) {
839
- indents = makeIndentsMap(string, false);
840
- }
841
- const keyOfMostUsedIndent = getMostUsedKey(indents);
842
- let type;
843
- let amount = 0;
844
- let indent = "";
845
- if (keyOfMostUsedIndent !== void 0) {
846
- ({ type, amount } = decodeIndentsKey(keyOfMostUsedIndent));
847
- indent = makeIndentString(type, amount);
848
- }
849
- return {
850
- amount,
851
- type,
852
- indent
853
- };
854
- }
855
-
856
- // node_modules/.pnpm/detect-newline@4.0.1/node_modules/detect-newline/index.js
857
- function detectNewline(string) {
858
- if (typeof string !== "string") {
859
- throw new TypeError("Expected a string");
860
- }
861
- const newlines = string.match(/(?:\r?\n)/g) || [];
862
- if (newlines.length === 0) {
863
- return;
864
- }
865
- const crlf = newlines.filter((newline) => newline === "\r\n").length;
866
- const lf = newlines.length - crlf;
867
- return crlf > lf ? "\r\n" : "\n";
868
- }
869
-
870
- // src/fs.ts
871
- async function readJsonFile(name, cwd) {
763
+ var jsonc = __toESM(require("jsonc-parser"));
764
+ async function readJsoncFile(name, cwd) {
872
765
  const file = await readTextFile(name, cwd);
873
- const data = JSON.parse(file.data);
874
- const indent = detectIndent(file.data).indent;
875
- const newline = detectNewline(file.data);
876
- return __spreadProps(__spreadValues({}, file), { data, indent, newline });
766
+ const data = jsonc.parse(file.data);
767
+ const modified = [];
768
+ return __spreadProps(__spreadValues({}, file), { data, modified, text: file.data });
877
769
  }
878
- async function writeJsonFile(file) {
879
- let json = JSON.stringify(file.data, void 0, file.indent);
880
- if (file.newline)
881
- json += file.newline;
882
- return writeTextFile(__spreadProps(__spreadValues({}, file), { data: json }));
770
+ async function writeJsoncFile(file) {
771
+ let newJSON = file.text;
772
+ for (const [key, value] of file.modified) {
773
+ const edit = jsonc.modify(file.text, key, value, {});
774
+ newJSON = jsonc.applyEdits(newJSON, edit);
775
+ }
776
+ return writeTextFile(__spreadProps(__spreadValues({}, file), { data: newJSON }));
883
777
  }
884
778
  function readTextFile(name, cwd) {
885
779
  return new Promise((resolve, reject) => {
@@ -928,6 +822,8 @@ async function getCurrentVersion(operation) {
928
822
  const filesToCheck = files.filter((file) => file.endsWith(".json"));
929
823
  if (!filesToCheck.includes("package.json"))
930
824
  filesToCheck.push("package.json");
825
+ if (!filesToCheck.includes("deno.json"))
826
+ filesToCheck.push("deno.json");
931
827
  for (const file of filesToCheck) {
932
828
  const version = await readVersion(file, cwd);
933
829
  if (version) {
@@ -943,12 +839,12 @@ async function getCurrentVersion(operation) {
943
839
  }
944
840
  async function readVersion(file, cwd) {
945
841
  try {
946
- const { data: manifest } = await readJsonFile(file, cwd);
842
+ const { data: manifest } = await readJsoncFile(file, cwd);
947
843
  if (isManifest(manifest)) {
948
844
  if ((0, import_semver2.valid)(manifest.version))
949
845
  return manifest.version;
950
846
  }
951
- } catch (error) {
847
+ } catch (e) {
952
848
  return void 0;
953
849
  }
954
850
  }
@@ -1066,7 +962,9 @@ async function normalizeOptions(raw) {
1066
962
  "package-lock.json",
1067
963
  "packages/**/package.json",
1068
964
  "jsr.json",
1069
- "jsr.jsonc"
965
+ "jsr.jsonc",
966
+ "deno.json",
967
+ "deno.jsonc"
1070
968
  ];
1071
969
  if (import_node_fs2.default.existsSync("pnpm-workspace.yaml")) {
1072
970
  const pnpmWorkspace = await import_promises.default.readFile("pnpm-workspace.yaml", "utf8");
@@ -1079,7 +977,7 @@ async function normalizeOptions(raw) {
1079
977
  raw.files = raw.files.concat(withoutExcludedWorkspaces);
1080
978
  }
1081
979
  } else {
1082
- raw.files = ((_b = raw.files) == null ? void 0 : _b.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"];
980
+ raw.files = ((_b = raw.files) == null ? void 0 : _b.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc", "deno.json", "deno.jsonc"];
1083
981
  }
1084
982
  const files = await (0, import_fast_glob.default)(
1085
983
  raw.files,
@@ -1190,7 +1088,7 @@ var ezSpawn2 = __toESM(require("@jsdevtools/ez-spawn"));
1190
1088
  async function runNpmScript(script, operation) {
1191
1089
  const { cwd, ignoreScripts } = operation.options;
1192
1090
  if (!ignoreScripts) {
1193
- const { data: manifest } = await readJsonFile("package.json", cwd);
1091
+ const { data: manifest } = await readJsoncFile("package.json", cwd);
1194
1092
  if (isManifest(manifest) && hasScript(manifest, script)) {
1195
1093
  await ezSpawn2.async("npm", ["run", script, "--silent"], { stdio: "inherit" });
1196
1094
  operation.update({ event: "npm script" /* NpmScript */, script });
@@ -1233,6 +1131,9 @@ async function updateFile(relPath, operation) {
1233
1131
  case "bower.json":
1234
1132
  case "component.json":
1235
1133
  case "jsr.json":
1134
+ case "jsr.jsonc":
1135
+ case "deno.json":
1136
+ case "deno.jsonc":
1236
1137
  return updateManifestFile(relPath, operation);
1237
1138
  default:
1238
1139
  return updateTextFile(relPath, operation);
@@ -1242,12 +1143,12 @@ async function updateManifestFile(relPath, operation) {
1242
1143
  const { cwd } = operation.options;
1243
1144
  const { newVersion } = operation.state;
1244
1145
  let modified = false;
1245
- const file = await readJsonFile(relPath, cwd);
1146
+ const file = await readJsoncFile(relPath, cwd);
1246
1147
  if (isManifest(file.data) && file.data.version !== newVersion) {
1247
- file.data.version = newVersion;
1148
+ file.modified.push([["version"], newVersion]);
1248
1149
  if (isPackageLockManifest(file.data))
1249
- file.data.packages[""].version = newVersion;
1250
- await writeJsonFile(file);
1150
+ file.modified.push([["packages", "", "version"], newVersion]);
1151
+ await writeJsoncFile(file);
1251
1152
  modified = true;
1252
1153
  }
1253
1154
  return modified;
@@ -1281,8 +1182,9 @@ async function versionBump(arg = {}) {
1281
1182
  type: "confirm",
1282
1183
  message: "Bump?",
1283
1184
  initial: true
1284
- }).then((r) => r.yes))
1185
+ }).then((r) => r.yes)) {
1285
1186
  import_node_process5.default.exit(1);
1187
+ }
1286
1188
  }
1287
1189
  await runNpmScript("preversion" /* PreVersion */, operation);
1288
1190
  await updateFiles(operation);
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadBumpConfig,
8
8
  versionBump,
9
9
  versionBumpInfo
10
- } from "./chunk-ZH3O6GQ3.mjs";
10
+ } from "./chunk-BWAJDQ77.mjs";
11
11
 
12
12
  // src/index.ts
13
13
  var src_default = versionBump;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bumpp",
3
- "version": "9.4.1",
4
- "packageManager": "pnpm@9.0.6",
3
+ "version": "9.5.0",
4
+ "packageManager": "pnpm@9.7.0",
5
5
  "description": "Bump version, commit changes, tag, and push to Git",
6
6
  "author": {
7
7
  "name": "James Messinger",
@@ -60,30 +60,29 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@jsdevtools/ez-spawn": "^3.0.4",
63
- "c12": "^1.10.0",
63
+ "c12": "^1.11.1",
64
64
  "cac": "^6.7.14",
65
65
  "escalade": "^3.1.2",
66
66
  "fast-glob": "^3.3.2",
67
67
  "js-yaml": "^4.1.0",
68
+ "jsonc-parser": "^3.3.1",
68
69
  "prompts": "^2.4.2",
69
- "semver": "^7.6.0"
70
+ "semver": "^7.6.3"
70
71
  },
71
72
  "devDependencies": {
72
- "@antfu/eslint-config": "^2.16.0",
73
+ "@antfu/eslint-config": "^2.25.1",
73
74
  "@types/js-yaml": "^4.0.9",
74
- "@types/node": "^20.12.7",
75
+ "@types/node": "^22.2.0",
75
76
  "@types/prompts": "^2.4.9",
76
77
  "@types/semver": "^7.5.8",
77
- "detect-indent": "^7.0.1",
78
- "detect-newline": "^4.0.1",
79
- "eslint": "^9.1.1",
78
+ "eslint": "^9.9.0",
80
79
  "esno": "^4.7.0",
81
80
  "log-symbols": "^6.0.0",
82
81
  "npm-check": "^6.0.1",
83
- "picocolors": "^1.0.0",
84
- "rimraf": "^5.0.5",
85
- "tsup": "^8.0.2",
86
- "typescript": "^5.4.5",
87
- "vitest": "^1.5.2"
82
+ "picocolors": "^1.0.1",
83
+ "rimraf": "^6.0.1",
84
+ "tsup": "^8.2.4",
85
+ "typescript": "^5.5.4",
86
+ "vitest": "^2.0.5"
88
87
  }
89
88
  }