semantic-release-lerna 2.17.2 → 2.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +554 -165
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -402,7 +402,7 @@ var require_parse = __commonJS({
402
402
  "use strict";
403
403
  var path26 = __require("path");
404
404
  var resolveCommand = require_resolveCommand();
405
- var escape2 = require_escape();
405
+ var escape3 = require_escape();
406
406
  var readShebang = require_readShebang();
407
407
  var isWin = process.platform === "win32";
408
408
  var isExecutableRegExp = /\.(?:com|exe)$/i;
@@ -426,8 +426,8 @@ var require_parse = __commonJS({
426
426
  if (parsed.options.forceShell || needsShell) {
427
427
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
428
428
  parsed.command = path26.normalize(parsed.command);
429
- parsed.command = escape2.command(parsed.command);
430
- parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
429
+ parsed.command = escape3.command(parsed.command);
430
+ parsed.args = parsed.args.map((arg) => escape3.argument(arg, needsDoubleEscapeMetaChars));
431
431
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
432
432
  parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
433
433
  parsed.command = process.env.comspec || "cmd.exe";
@@ -15324,25 +15324,25 @@ Please follow the [npm guideline](https://docs.npmjs.com/getting-started/creatin
15324
15324
  }
15325
15325
 
15326
15326
  // src/get-error.js
15327
- function get_error_default(code, ctx = {}) {
15327
+ function getError(code, ctx = {}) {
15328
15328
  const { message, details } = errors_exports[code](ctx);
15329
15329
  return new SemanticReleaseError(message, code, details);
15330
15330
  }
15331
15331
 
15332
15332
  // src/get-pkg.js
15333
- async function get_pkg_default({ pkgRoot }, { cwd }) {
15333
+ async function getPkg({ pkgRoot }, { cwd }) {
15334
15334
  try {
15335
15335
  const rootDir = pkgRoot ? path.resolve(cwd, String(pkgRoot)) : cwd;
15336
15336
  const filePath = path.join(rootDir, "package.json");
15337
15337
  const content = await fs.readFile(filePath, "utf-8");
15338
15338
  const pkg = JSON.parse(content);
15339
15339
  if (!pkg.name) {
15340
- throw get_error_default("ENOPKGNAME");
15340
+ throw getError("ENOPKGNAME");
15341
15341
  }
15342
15342
  return pkg;
15343
15343
  } catch (error) {
15344
15344
  if (error.code === "ENOENT") {
15345
- throw new AggregateError2([get_error_default("ENOPKG")]);
15345
+ throw new AggregateError2([getError("ENOPKG")]);
15346
15346
  }
15347
15347
  throw new AggregateError2([error]);
15348
15348
  }
@@ -22190,6 +22190,7 @@ var PackageGraph = class extends Map {
22190
22190
  * Pass "dependencies" to create a graph of only dependencies,
22191
22191
  * excluding the devDependencies that would normally be included.
22192
22192
  */
22193
+ /* eslint-disable-next-line complexity -- inherited technical debt */
22193
22194
  constructor(packages, graphType = "allDependencies") {
22194
22195
  super(packages.map((pkg) => [pkg.name, new PackageGraphNode(pkg)]));
22195
22196
  if (packages.length !== this.size) {
@@ -22209,16 +22210,16 @@ var PackageGraph = class extends Map {
22209
22210
  }
22210
22211
  }
22211
22212
  }
22212
- this.forEach((currentNode, currentName) => {
22213
+ for (const [currentName, currentNode] of this.entries()) {
22213
22214
  const graphDependencies = graphType === "dependencies" ? { ...currentNode.pkg.optionalDependencies, ...currentNode.pkg.dependencies } : {
22214
22215
  ...currentNode.pkg.devDependencies,
22215
22216
  ...currentNode.pkg.optionalDependencies,
22216
22217
  ...currentNode.pkg.dependencies
22217
22218
  };
22218
- Object.keys(graphDependencies).forEach((depName) => {
22219
+ for (const depName of Object.keys(graphDependencies)) {
22219
22220
  const depNode = this.get(depName);
22220
22221
  let spec = graphDependencies[depName].replace(/^link:/, "file:");
22221
- const isWorkspaceSpec = /^workspace:/.test(spec);
22222
+ const isWorkspaceSpec = spec.startsWith("workspace:");
22222
22223
  let fullWorkspaceSpec;
22223
22224
  let workspaceAlias;
22224
22225
  if (isWorkspaceSpec) {
@@ -22239,7 +22240,7 @@ var PackageGraph = class extends Map {
22239
22240
  resolved.workspaceSpec = fullWorkspaceSpec;
22240
22241
  resolved.workspaceAlias = workspaceAlias;
22241
22242
  if (!depNode) {
22242
- return;
22243
+ continue;
22243
22244
  }
22244
22245
  if (resolved.fetchSpec === depNode.location || depNode.satisfies(resolved)) {
22245
22246
  depNode.localDependents.set(currentName, currentNode);
@@ -22248,8 +22249,8 @@ var PackageGraph = class extends Map {
22248
22249
  `Package specification "${depName}@${spec}" could not be resolved within the workspace. To reference a non-matching, remote version of a local dependency, remove the 'workspace:' prefix.`
22249
22250
  );
22250
22251
  }
22251
- });
22252
- });
22252
+ }
22253
+ }
22253
22254
  }
22254
22255
  get rawPackageList() {
22255
22256
  return Array.from(this.values(), (node) => node.pkg);
@@ -22747,9 +22748,9 @@ var shouldExpandGlobstarDirectory = (pattern) => {
22747
22748
  if (!match2) {
22748
22749
  return false;
22749
22750
  }
22750
- const dirname2 = match2[1];
22751
- const hasWildcards = /[*?[\]{}]/.test(dirname2);
22752
- const hasExtension = nodePath.extname(dirname2) && !dirname2.startsWith(".");
22751
+ const dirname = match2[1];
22752
+ const hasWildcards = /[*?[\]{}]/.test(dirname);
22753
+ const hasExtension = nodePath.extname(dirname) && !dirname.startsWith(".");
22753
22754
  return !hasWildcards && !hasExtension;
22754
22755
  };
22755
22756
  var getDirectoryGlob = ({ directoryPath, files, extensions }) => {
@@ -25734,9 +25735,9 @@ var pMapSkip = /* @__PURE__ */ Symbol("skip");
25734
25735
  // src/utils/collect-dependents.js
25735
25736
  function collectDependents(nodes) {
25736
25737
  const collected = /* @__PURE__ */ new Set();
25737
- nodes.forEach((currentNode) => {
25738
+ for (const currentNode of nodes) {
25738
25739
  if (currentNode.localDependents.size === 0) {
25739
- return;
25740
+ continue;
25740
25741
  }
25741
25742
  const queue = [currentNode];
25742
25743
  const seen = /* @__PURE__ */ new Set();
@@ -25751,34 +25752,36 @@ function collectDependents(nodes) {
25751
25752
  collected.add(dependentNode);
25752
25753
  queue.push(dependentNode);
25753
25754
  };
25754
- while (queue.length) {
25755
+ while (queue.length > 0) {
25755
25756
  const node = queue.shift();
25756
25757
  node.localDependents.forEach(visit);
25757
25758
  }
25758
- });
25759
+ }
25759
25760
  return collected;
25760
25761
  }
25761
25762
 
25762
25763
  // src/utils/collect-packages.js
25763
25764
  function collectPackages(packages, { isCandidate = () => true, onInclude, excludeDependents } = {}) {
25764
25765
  const candidates = /* @__PURE__ */ new Set();
25765
- packages.forEach((node, name) => {
25766
+ for (const [name, node] of packages.entries()) {
25766
25767
  if (isCandidate(node, name)) {
25767
25768
  candidates.add(node);
25768
25769
  }
25769
- });
25770
+ }
25770
25771
  if (!excludeDependents) {
25771
- collectDependents(candidates).forEach((node) => candidates.add(node));
25772
+ for (const node of collectDependents(candidates)) {
25773
+ candidates.add(node);
25774
+ }
25772
25775
  }
25773
25776
  const updates = [];
25774
- packages.forEach((node, name) => {
25777
+ for (const [name, node] of packages.entries()) {
25775
25778
  if (candidates.has(node)) {
25776
25779
  if (onInclude) {
25777
25780
  onInclude(name);
25778
25781
  }
25779
25782
  updates.push(node);
25780
25783
  }
25781
- });
25784
+ }
25782
25785
  return updates;
25783
25786
  }
25784
25787
 
@@ -26139,8 +26142,56 @@ var unescape2 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {})
26139
26142
  };
26140
26143
 
26141
26144
  // node_modules/minimatch/dist/esm/ast.js
26145
+ var _a;
26142
26146
  var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
26143
26147
  var isExtglobType = (c3) => types.has(c3);
26148
+ var isExtglobAST = (c3) => isExtglobType(c3.type);
26149
+ var adoptionMap = /* @__PURE__ */ new Map([
26150
+ ["!", ["@"]],
26151
+ ["?", ["?", "@"]],
26152
+ ["@", ["@"]],
26153
+ ["*", ["*", "+", "?", "@"]],
26154
+ ["+", ["+", "@"]]
26155
+ ]);
26156
+ var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
26157
+ ["!", ["?"]],
26158
+ ["@", ["?"]],
26159
+ ["+", ["?", "*"]]
26160
+ ]);
26161
+ var adoptionAnyMap = /* @__PURE__ */ new Map([
26162
+ ["!", ["?", "@"]],
26163
+ ["?", ["?", "@"]],
26164
+ ["@", ["?", "@"]],
26165
+ ["*", ["*", "+", "?", "@"]],
26166
+ ["+", ["+", "@", "?", "*"]]
26167
+ ]);
26168
+ var usurpMap = /* @__PURE__ */ new Map([
26169
+ ["!", /* @__PURE__ */ new Map([["!", "@"]])],
26170
+ [
26171
+ "?",
26172
+ /* @__PURE__ */ new Map([
26173
+ ["*", "*"],
26174
+ ["+", "*"]
26175
+ ])
26176
+ ],
26177
+ [
26178
+ "@",
26179
+ /* @__PURE__ */ new Map([
26180
+ ["!", "!"],
26181
+ ["?", "?"],
26182
+ ["@", "@"],
26183
+ ["*", "*"],
26184
+ ["+", "+"]
26185
+ ])
26186
+ ],
26187
+ [
26188
+ "+",
26189
+ /* @__PURE__ */ new Map([
26190
+ ["?", "*"],
26191
+ ["*", "*"]
26192
+ ])
26193
+ ]
26194
+ ]);
26144
26195
  var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
26145
26196
  var startNoDot = "(?!\\.)";
26146
26197
  var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
@@ -26150,7 +26201,8 @@ var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
26150
26201
  var qmark = "[^/]";
26151
26202
  var star = qmark + "*?";
26152
26203
  var starNoEmpty = qmark + "+?";
26153
- var AST = class _AST {
26204
+ var ID = 0;
26205
+ var AST = class {
26154
26206
  type;
26155
26207
  #root;
26156
26208
  #hasMagic;
@@ -26165,6 +26217,22 @@ var AST = class _AST {
26165
26217
  // set to true if it's an extglob with no children
26166
26218
  // (which really means one child of '')
26167
26219
  #emptyExt = false;
26220
+ id = ++ID;
26221
+ get depth() {
26222
+ return (this.#parent?.depth ?? -1) + 1;
26223
+ }
26224
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
26225
+ return {
26226
+ "@@type": "AST",
26227
+ id: this.id,
26228
+ type: this.type,
26229
+ root: this.#root.id,
26230
+ parent: this.#parent?.id,
26231
+ depth: this.depth,
26232
+ partsLength: this.#parts.length,
26233
+ parts: this.#parts
26234
+ };
26235
+ }
26168
26236
  constructor(type2, parent, options = {}) {
26169
26237
  this.type = type2;
26170
26238
  if (type2)
@@ -26230,7 +26298,7 @@ var AST = class _AST {
26230
26298
  for (const p of parts) {
26231
26299
  if (p === "")
26232
26300
  continue;
26233
- if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
26301
+ if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
26234
26302
  throw new Error("invalid part: " + p);
26235
26303
  }
26236
26304
  this.#parts.push(p);
@@ -26255,7 +26323,7 @@ var AST = class _AST {
26255
26323
  const p = this.#parent;
26256
26324
  for (let i2 = 0; i2 < this.#parentIndex; i2++) {
26257
26325
  const pp = p.#parts[i2];
26258
- if (!(pp instanceof _AST && pp.type === "!")) {
26326
+ if (!(pp instanceof _a && pp.type === "!")) {
26259
26327
  return false;
26260
26328
  }
26261
26329
  }
@@ -26280,13 +26348,14 @@ var AST = class _AST {
26280
26348
  this.push(part.clone(this));
26281
26349
  }
26282
26350
  clone(parent) {
26283
- const c3 = new _AST(this.type, parent);
26351
+ const c3 = new _a(this.type, parent);
26284
26352
  for (const p of this.#parts) {
26285
26353
  c3.copyIn(p);
26286
26354
  }
26287
26355
  return c3;
26288
26356
  }
26289
- static #parseAST(str2, ast, pos, opt) {
26357
+ static #parseAST(str2, ast, pos, opt, extDepth) {
26358
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
26290
26359
  let escaping = false;
26291
26360
  let inBrace = false;
26292
26361
  let braceStart = -1;
@@ -26318,11 +26387,12 @@ var AST = class _AST {
26318
26387
  acc2 += c3;
26319
26388
  continue;
26320
26389
  }
26321
- if (!opt.noext && isExtglobType(c3) && str2.charAt(i3) === "(") {
26390
+ const doRecurse = !opt.noext && isExtglobType(c3) && str2.charAt(i3) === "(" && extDepth <= maxDepth;
26391
+ if (doRecurse) {
26322
26392
  ast.push(acc2);
26323
26393
  acc2 = "";
26324
- const ext2 = new _AST(c3, ast);
26325
- i3 = _AST.#parseAST(str2, ext2, i3, opt);
26394
+ const ext2 = new _a(c3, ast);
26395
+ i3 = _a.#parseAST(str2, ext2, i3, opt, extDepth + 1);
26326
26396
  ast.push(ext2);
26327
26397
  continue;
26328
26398
  }
@@ -26332,7 +26402,7 @@ var AST = class _AST {
26332
26402
  return i3;
26333
26403
  }
26334
26404
  let i2 = pos + 1;
26335
- let part = new _AST(null, ast);
26405
+ let part = new _a(null, ast);
26336
26406
  const parts = [];
26337
26407
  let acc = "";
26338
26408
  while (i2 < str2.length) {
@@ -26359,19 +26429,22 @@ var AST = class _AST {
26359
26429
  acc += c3;
26360
26430
  continue;
26361
26431
  }
26362
- if (isExtglobType(c3) && str2.charAt(i2) === "(") {
26432
+ const doRecurse = !opt.noext && isExtglobType(c3) && str2.charAt(i2) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
26433
+ (extDepth <= maxDepth || ast && ast.#canAdoptType(c3));
26434
+ if (doRecurse) {
26435
+ const depthAdd = ast && ast.#canAdoptType(c3) ? 0 : 1;
26363
26436
  part.push(acc);
26364
26437
  acc = "";
26365
- const ext2 = new _AST(c3, part);
26438
+ const ext2 = new _a(c3, part);
26366
26439
  part.push(ext2);
26367
- i2 = _AST.#parseAST(str2, ext2, i2, opt);
26440
+ i2 = _a.#parseAST(str2, ext2, i2, opt, extDepth + depthAdd);
26368
26441
  continue;
26369
26442
  }
26370
26443
  if (c3 === "|") {
26371
26444
  part.push(acc);
26372
26445
  acc = "";
26373
26446
  parts.push(part);
26374
- part = new _AST(null, ast);
26447
+ part = new _a(null, ast);
26375
26448
  continue;
26376
26449
  }
26377
26450
  if (c3 === ")") {
@@ -26390,9 +26463,71 @@ var AST = class _AST {
26390
26463
  ast.#parts = [str2.substring(pos - 1)];
26391
26464
  return i2;
26392
26465
  }
26466
+ #canAdoptWithSpace(child) {
26467
+ return this.#canAdopt(child, adoptionWithSpaceMap);
26468
+ }
26469
+ #canAdopt(child, map2 = adoptionMap) {
26470
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
26471
+ return false;
26472
+ }
26473
+ const gc = child.#parts[0];
26474
+ if (!gc || typeof gc !== "object" || gc.type === null) {
26475
+ return false;
26476
+ }
26477
+ return this.#canAdoptType(gc.type, map2);
26478
+ }
26479
+ #canAdoptType(c3, map2 = adoptionAnyMap) {
26480
+ return !!map2.get(this.type)?.includes(c3);
26481
+ }
26482
+ #adoptWithSpace(child, index) {
26483
+ const gc = child.#parts[0];
26484
+ const blank = new _a(null, gc, this.options);
26485
+ blank.#parts.push("");
26486
+ gc.push(blank);
26487
+ this.#adopt(child, index);
26488
+ }
26489
+ #adopt(child, index) {
26490
+ const gc = child.#parts[0];
26491
+ this.#parts.splice(index, 1, ...gc.#parts);
26492
+ for (const p of gc.#parts) {
26493
+ if (typeof p === "object")
26494
+ p.#parent = this;
26495
+ }
26496
+ this.#toString = void 0;
26497
+ }
26498
+ #canUsurpType(c3) {
26499
+ const m = usurpMap.get(this.type);
26500
+ return !!m?.has(c3);
26501
+ }
26502
+ #canUsurp(child) {
26503
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
26504
+ return false;
26505
+ }
26506
+ const gc = child.#parts[0];
26507
+ if (!gc || typeof gc !== "object" || gc.type === null) {
26508
+ return false;
26509
+ }
26510
+ return this.#canUsurpType(gc.type);
26511
+ }
26512
+ #usurp(child) {
26513
+ const m = usurpMap.get(this.type);
26514
+ const gc = child.#parts[0];
26515
+ const nt = m?.get(gc.type);
26516
+ if (!nt)
26517
+ return false;
26518
+ this.#parts = gc.#parts;
26519
+ for (const p of this.#parts) {
26520
+ if (typeof p === "object") {
26521
+ p.#parent = this;
26522
+ }
26523
+ }
26524
+ this.type = nt;
26525
+ this.#toString = void 0;
26526
+ this.#emptyExt = false;
26527
+ }
26393
26528
  static fromGlob(pattern, options = {}) {
26394
- const ast = new _AST(null, void 0, options);
26395
- _AST.#parseAST(pattern, ast, 0, options);
26529
+ const ast = new _a(null, void 0, options);
26530
+ _a.#parseAST(pattern, ast, 0, options, 0);
26396
26531
  return ast;
26397
26532
  }
26398
26533
  // returns the regular expression if there's magic, or the unescaped
@@ -26486,12 +26621,14 @@ var AST = class _AST {
26486
26621
  // or start or whatever) and prepend ^ or / at the Regexp construction.
26487
26622
  toRegExpSource(allowDot) {
26488
26623
  const dot = allowDot ?? !!this.#options.dot;
26489
- if (this.#root === this)
26624
+ if (this.#root === this) {
26625
+ this.#flatten();
26490
26626
  this.#fillNegs();
26491
- if (!this.type) {
26627
+ }
26628
+ if (!isExtglobAST(this)) {
26492
26629
  const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
26493
26630
  const src = this.#parts.map((p) => {
26494
- const [re, _, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
26631
+ const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
26495
26632
  this.#hasMagic = this.#hasMagic || hasMagic;
26496
26633
  this.#uflag = this.#uflag || uflag;
26497
26634
  return re;
@@ -26530,9 +26667,10 @@ var AST = class _AST {
26530
26667
  let body = this.#partsToRegExp(dot);
26531
26668
  if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
26532
26669
  const s = this.toString();
26533
- this.#parts = [s];
26534
- this.type = null;
26535
- this.#hasMagic = void 0;
26670
+ const me = this;
26671
+ me.#parts = [s];
26672
+ me.type = null;
26673
+ me.#hasMagic = void 0;
26536
26674
  return [s, unescape2(this.toString()), false, false];
26537
26675
  }
26538
26676
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
@@ -26559,6 +26697,38 @@ var AST = class _AST {
26559
26697
  this.#uflag
26560
26698
  ];
26561
26699
  }
26700
+ #flatten() {
26701
+ if (!isExtglobAST(this)) {
26702
+ for (const p of this.#parts) {
26703
+ if (typeof p === "object") {
26704
+ p.#flatten();
26705
+ }
26706
+ }
26707
+ } else {
26708
+ let iterations = 0;
26709
+ let done = false;
26710
+ do {
26711
+ done = true;
26712
+ for (let i2 = 0; i2 < this.#parts.length; i2++) {
26713
+ const c3 = this.#parts[i2];
26714
+ if (typeof c3 === "object") {
26715
+ c3.#flatten();
26716
+ if (this.#canAdopt(c3)) {
26717
+ done = false;
26718
+ this.#adopt(c3, i2);
26719
+ } else if (this.#canAdoptWithSpace(c3)) {
26720
+ done = false;
26721
+ this.#adoptWithSpace(c3, i2);
26722
+ } else if (this.#canUsurp(c3)) {
26723
+ done = false;
26724
+ this.#usurp(c3);
26725
+ }
26726
+ }
26727
+ }
26728
+ } while (!done && ++iterations < 10);
26729
+ }
26730
+ this.#toString = void 0;
26731
+ }
26562
26732
  #partsToRegExp(dot) {
26563
26733
  return this.#parts.map((p) => {
26564
26734
  if (typeof p === "string") {
@@ -26619,6 +26789,7 @@ var AST = class _AST {
26619
26789
  return [re, unescape2(glob), !!hasMagic, uflag];
26620
26790
  }
26621
26791
  };
26792
+ _a = AST;
26622
26793
 
26623
26794
  // node_modules/minimatch/dist/esm/escape.js
26624
26795
  var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
@@ -26777,11 +26948,13 @@ var Minimatch = class {
26777
26948
  isWindows;
26778
26949
  platform;
26779
26950
  windowsNoMagicRoot;
26951
+ maxGlobstarRecursion;
26780
26952
  regexp;
26781
26953
  constructor(pattern, options = {}) {
26782
26954
  assertValidPattern(pattern);
26783
26955
  options = options || {};
26784
26956
  this.options = options;
26957
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
26785
26958
  this.pattern = pattern;
26786
26959
  this.platform = options.platform || defaultPlatform;
26787
26960
  this.isWindows = this.platform === "win32";
@@ -27118,7 +27291,8 @@ var Minimatch = class {
27118
27291
  // out of pattern, then that's fine, as long as all
27119
27292
  // the parts match.
27120
27293
  matchOne(file, pattern, partial = false) {
27121
- const options = this.options;
27294
+ let fileStartIndex = 0;
27295
+ let patternStartIndex = 0;
27122
27296
  if (this.isWindows) {
27123
27297
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
27124
27298
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
@@ -27133,11 +27307,8 @@ var Minimatch = class {
27133
27307
  ];
27134
27308
  if (fd.toLowerCase() === pd.toLowerCase()) {
27135
27309
  pattern[pdi] = fd;
27136
- if (pdi > fdi) {
27137
- pattern = pattern.slice(pdi);
27138
- } else if (fdi > pdi) {
27139
- file = file.slice(fdi);
27140
- }
27310
+ patternStartIndex = pdi;
27311
+ fileStartIndex = fdi;
27141
27312
  }
27142
27313
  }
27143
27314
  }
@@ -27145,49 +27316,123 @@ var Minimatch = class {
27145
27316
  if (optimizationLevel >= 2) {
27146
27317
  file = this.levelTwoFileOptimize(file);
27147
27318
  }
27148
- this.debug("matchOne", this, { file, pattern });
27149
- this.debug("matchOne", file.length, pattern.length);
27150
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
27151
- this.debug("matchOne loop");
27152
- var p = pattern[pi];
27153
- var f = file[fi];
27154
- this.debug(pattern, p, f);
27155
- if (p === false) {
27319
+ if (pattern.includes(GLOBSTAR)) {
27320
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
27321
+ }
27322
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
27323
+ }
27324
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
27325
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
27326
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
27327
+ const [head2, body, tail] = partial ? [
27328
+ pattern.slice(patternIndex, firstgs),
27329
+ pattern.slice(firstgs + 1),
27330
+ []
27331
+ ] : [
27332
+ pattern.slice(patternIndex, firstgs),
27333
+ pattern.slice(firstgs + 1, lastgs),
27334
+ pattern.slice(lastgs + 1)
27335
+ ];
27336
+ if (head2.length) {
27337
+ const fileHead = file.slice(fileIndex, fileIndex + head2.length);
27338
+ if (!this.#matchOne(fileHead, head2, partial, 0, 0)) {
27156
27339
  return false;
27157
27340
  }
27158
- if (p === GLOBSTAR) {
27159
- this.debug("GLOBSTAR", [pattern, p, f]);
27160
- var fr = fi;
27161
- var pr = pi + 1;
27162
- if (pr === pl) {
27163
- this.debug("** at the end");
27164
- for (; fi < fl; fi++) {
27165
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
27166
- return false;
27167
- }
27168
- return true;
27341
+ fileIndex += head2.length;
27342
+ patternIndex += head2.length;
27343
+ }
27344
+ let fileTailMatch = 0;
27345
+ if (tail.length) {
27346
+ if (tail.length + fileIndex > file.length)
27347
+ return false;
27348
+ let tailStart = file.length - tail.length;
27349
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
27350
+ fileTailMatch = tail.length;
27351
+ } else {
27352
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
27353
+ return false;
27169
27354
  }
27170
- while (fr < fl) {
27171
- var swallowee = file[fr];
27172
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
27173
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
27174
- this.debug("globstar found match!", fr, fl, swallowee);
27175
- return true;
27176
- } else {
27177
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
27178
- this.debug("dot detected!", file, fr, pattern, pr);
27179
- break;
27180
- }
27181
- this.debug("globstar swallow a segment, and continue");
27182
- fr++;
27183
- }
27355
+ tailStart--;
27356
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
27357
+ return false;
27184
27358
  }
27185
- if (partial) {
27186
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
27187
- if (fr === fl) {
27188
- return true;
27189
- }
27359
+ fileTailMatch = tail.length + 1;
27360
+ }
27361
+ }
27362
+ if (!body.length) {
27363
+ let sawSome = !!fileTailMatch;
27364
+ for (let i3 = fileIndex; i3 < file.length - fileTailMatch; i3++) {
27365
+ const f = String(file[i3]);
27366
+ sawSome = true;
27367
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
27368
+ return false;
27190
27369
  }
27370
+ }
27371
+ return partial || sawSome;
27372
+ }
27373
+ const bodySegments = [[[], 0]];
27374
+ let currentBody = bodySegments[0];
27375
+ let nonGsParts = 0;
27376
+ const nonGsPartsSums = [0];
27377
+ for (const b of body) {
27378
+ if (b === GLOBSTAR) {
27379
+ nonGsPartsSums.push(nonGsParts);
27380
+ currentBody = [[], 0];
27381
+ bodySegments.push(currentBody);
27382
+ } else {
27383
+ currentBody[0].push(b);
27384
+ nonGsParts++;
27385
+ }
27386
+ }
27387
+ let i2 = bodySegments.length - 1;
27388
+ const fileLength = file.length - fileTailMatch;
27389
+ for (const b of bodySegments) {
27390
+ b[1] = fileLength - (nonGsPartsSums[i2--] + b[0].length);
27391
+ }
27392
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
27393
+ }
27394
+ // return false for "nope, not matching"
27395
+ // return null for "not matching, cannot keep trying"
27396
+ #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
27397
+ const bs = bodySegments[bodyIndex];
27398
+ if (!bs) {
27399
+ for (let i2 = fileIndex; i2 < file.length; i2++) {
27400
+ sawTail = true;
27401
+ const f = file[i2];
27402
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
27403
+ return false;
27404
+ }
27405
+ }
27406
+ return sawTail;
27407
+ }
27408
+ const [body, after] = bs;
27409
+ while (fileIndex <= after) {
27410
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
27411
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
27412
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
27413
+ if (sub !== false) {
27414
+ return sub;
27415
+ }
27416
+ }
27417
+ const f = file[fileIndex];
27418
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
27419
+ return false;
27420
+ }
27421
+ fileIndex++;
27422
+ }
27423
+ return partial || null;
27424
+ }
27425
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
27426
+ let fi;
27427
+ let pi;
27428
+ let pl;
27429
+ let fl;
27430
+ for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
27431
+ this.debug("matchOne loop");
27432
+ let p = pattern[pi];
27433
+ let f = file[fi];
27434
+ this.debug(pattern, p, f);
27435
+ if (p === false || p === GLOBSTAR) {
27191
27436
  return false;
27192
27437
  }
27193
27438
  let hit;
@@ -27376,7 +27621,7 @@ function makeDiffPredicate(committish, execOpts, context) {
27376
27621
  })
27377
27622
  )
27378
27623
  );
27379
- if (ignoreFilters.size) {
27624
+ if (ignoreFilters.size > 0) {
27380
27625
  logger.log("ignoring diff in paths matching", ignoreChanges);
27381
27626
  }
27382
27627
  return function hasDiffSinceThatIsntIgnored(node) {
@@ -27385,12 +27630,12 @@ function makeDiffPredicate(committish, execOpts, context) {
27385
27630
  return false;
27386
27631
  }
27387
27632
  let changedFiles = diff.split("\n");
27388
- if (ignoreFilters.size) {
27633
+ if (ignoreFilters.size > 0) {
27389
27634
  for (const ignored of ignoreFilters) {
27390
27635
  changedFiles = changedFiles.filter(ignored);
27391
27636
  }
27392
27637
  }
27393
- if (changedFiles.length) {
27638
+ if (changedFiles.length > 0) {
27394
27639
  logger.log("filtered diff", changedFiles);
27395
27640
  } else {
27396
27641
  logger.log("", "no diff found in %s (after filtering)", node.name);
@@ -27628,8 +27873,8 @@ function getGlobOpts(rootPath, packageConfigs) {
27628
27873
  expandDirectories: false,
27629
27874
  followSymbolicLinks: false
27630
27875
  };
27631
- if (packageConfigs.some((cfg) => cfg.indexOf("**") > -1)) {
27632
- if (packageConfigs.some((cfg) => cfg.indexOf("node_modules") > -1)) {
27876
+ if (packageConfigs.some((cfg) => cfg.includes("**"))) {
27877
+ if (packageConfigs.some((cfg) => cfg.includes("node_modules"))) {
27633
27878
  throw new Error("An explicit node_modules package path does not allow globstars (**)");
27634
27879
  }
27635
27880
  globOpts.ignore = [
@@ -27645,6 +27890,7 @@ function makeFileFinder(rootPath, packageConfigs) {
27645
27890
  return (fileName, fileMapper, customGlobOpts) => {
27646
27891
  const options = { ...customGlobOpts, ...globOpts };
27647
27892
  const promise = pMap(
27893
+ /* eslint-disable-next-line unicorn/no-array-sort -- technical debt */
27648
27894
  Array.from(packageConfigs).sort(),
27649
27895
  (globPath) => {
27650
27896
  let chain = globby(path13.posix.join(globPath, fileName), options);
@@ -27657,7 +27903,7 @@ function makeFileFinder(rootPath, packageConfigs) {
27657
27903
  },
27658
27904
  { concurrency: 4 }
27659
27905
  );
27660
- return promise.then((results) => results.reduce((acc, result) => acc.concat(result), []));
27906
+ return promise.then((results) => results.flat());
27661
27907
  };
27662
27908
  }
27663
27909
  var Project = class {
@@ -27989,7 +28235,7 @@ async function getCurrentVersion(pkg) {
27989
28235
  const pkgData = await readJson(pkg.manifestLocation);
27990
28236
  return [pkgData.name, pkgData.version];
27991
28237
  }
27992
- async function prepare_default(npmrc2, pluginConfig, context) {
28238
+ async function prepare(npmrc2, pluginConfig, context) {
27993
28239
  const {
27994
28240
  cwd,
27995
28241
  nextRelease: { version },
@@ -28026,7 +28272,7 @@ async function prepare_default(npmrc2, pluginConfig, context) {
28026
28272
 
28027
28273
  // src/get-channel.js
28028
28274
  var import_valid = __toESM(require_valid2(), 1);
28029
- function get_channel_default(channel) {
28275
+ function getChannel(channel) {
28030
28276
  if (channel) {
28031
28277
  return (0, import_valid.default)(channel) ? `release-${channel}` : channel;
28032
28278
  } else {
@@ -28045,7 +28291,7 @@ var GITHUB_ACTIONS_PROVIDER_NAME = "GitHub Actions";
28045
28291
  var GITLAB_PIPELINES_PROVIDER_NAME = "GitLab CI/CD";
28046
28292
 
28047
28293
  // src/get-registry.js
28048
- function get_registry_default({ publishConfig: { registry } = {}, name }, { cwd, env }) {
28294
+ function getRegistry({ publishConfig: { registry } = {}, name }, { cwd, env }) {
28049
28295
  return registry || env.NPM_CONFIG_REGISTRY || getRegistryUrl(
28050
28296
  name.split("/")[0],
28051
28297
  (0, import_rc.default)(
@@ -28059,19 +28305,137 @@ function get_registry_default({ publishConfig: { registry } = {}, name }, { cwd,
28059
28305
  // node_modules/normalize-url/index.js
28060
28306
  var DATA_URL_DEFAULT_MIME_TYPE = "text/plain";
28061
28307
  var DATA_URL_DEFAULT_CHARSET = "us-ascii";
28062
- var testParameter = (name, filters) => filters.some((filter2) => filter2 instanceof RegExp ? filter2.test(name) : filter2 === name);
28308
+ var encodedReservedCharactersPattern = "%(?:3A|2F|3F|23|5B|5D|40|21|24|26|27|28|29|2A|2B|2C|3B|3D)";
28309
+ var temporaryEncodedReservedTokenBase = "__normalize_url_encoded_reserved__";
28310
+ var temporaryEncodedReservedTokenPattern = /__normalize_url_encoded_reserved__(\d+)__/g;
28311
+ var hasEncodedReservedCharactersRegex = new RegExp(encodedReservedCharactersPattern, "i");
28312
+ var encodedReservedCharactersRegex = new RegExp(encodedReservedCharactersPattern, "gi");
28313
+ var testParameter = (name, filters) => Array.isArray(filters) && filters.some((filter2) => {
28314
+ if (filter2 instanceof RegExp) {
28315
+ if (filter2.flags.includes("g") || filter2.flags.includes("y")) {
28316
+ return new RegExp(filter2.source, filter2.flags.replaceAll(/[gy]/g, "")).test(name);
28317
+ }
28318
+ return filter2.test(name);
28319
+ }
28320
+ return filter2 === name;
28321
+ });
28063
28322
  var supportedProtocols = /* @__PURE__ */ new Set([
28064
28323
  "https:",
28065
28324
  "http:",
28066
28325
  "file:"
28067
28326
  ]);
28068
- var hasCustomProtocol = (urlString) => {
28327
+ var normalizeCustomProtocolOption = (protocol) => {
28328
+ if (typeof protocol !== "string") {
28329
+ return void 0;
28330
+ }
28331
+ const normalizedProtocol = protocol.trim().toLowerCase().replace(/:$/, "");
28332
+ return normalizedProtocol === "" ? void 0 : `${normalizedProtocol}:`;
28333
+ };
28334
+ var getCustomProtocol = (urlString) => {
28069
28335
  try {
28070
28336
  const { protocol } = new URL(urlString);
28071
- return protocol.endsWith(":") && !protocol.includes(".") && !supportedProtocols.has(protocol);
28337
+ const hasAuthority = urlString.slice(0, protocol.length + 2).toLowerCase() === `${protocol}//`;
28338
+ if (protocol.endsWith(":") && (!protocol.includes(".") || hasAuthority) && !supportedProtocols.has(protocol)) {
28339
+ return protocol;
28340
+ }
28072
28341
  } catch {
28073
- return false;
28074
28342
  }
28343
+ return void 0;
28344
+ };
28345
+ var decodeQueryKey = (value) => {
28346
+ try {
28347
+ return decodeURIComponent(value.replaceAll("+", "%20"));
28348
+ } catch {
28349
+ return new URLSearchParams(`${value}=`).keys().next().value;
28350
+ }
28351
+ };
28352
+ var getKeysWithoutEquals = (search) => {
28353
+ const keys = /* @__PURE__ */ new Set();
28354
+ if (!search) {
28355
+ return keys;
28356
+ }
28357
+ for (const part of search.slice(1).split("&")) {
28358
+ if (part && !part.includes("=")) {
28359
+ keys.add(decodeQueryKey(part));
28360
+ }
28361
+ }
28362
+ return keys;
28363
+ };
28364
+ var getTemporaryEncodedReservedTokenPrefix = (search) => {
28365
+ let decodedSearch = search;
28366
+ try {
28367
+ decodedSearch = decodeURIComponent(search);
28368
+ } catch {
28369
+ decodedSearch = new URLSearchParams(search).toString();
28370
+ }
28371
+ const getUsedTokenIndexes = (value) => {
28372
+ const indexes = /* @__PURE__ */ new Set();
28373
+ for (const match2 of value.matchAll(temporaryEncodedReservedTokenPattern)) {
28374
+ indexes.add(Number.parseInt(match2[1], 10));
28375
+ }
28376
+ return indexes;
28377
+ };
28378
+ const usedTokenIndexes = getUsedTokenIndexes(search);
28379
+ for (const tokenIndex2 of getUsedTokenIndexes(decodedSearch)) {
28380
+ usedTokenIndexes.add(tokenIndex2);
28381
+ }
28382
+ let tokenIndex = 0;
28383
+ while (usedTokenIndexes.has(tokenIndex)) {
28384
+ tokenIndex++;
28385
+ }
28386
+ return `${temporaryEncodedReservedTokenBase}${tokenIndex}__`;
28387
+ };
28388
+ var sortSearchParameters = (searchParameters, encodedReservedTokenRegex) => {
28389
+ if (!encodedReservedTokenRegex) {
28390
+ searchParameters.sort();
28391
+ return searchParameters.toString();
28392
+ }
28393
+ const getSortableKey = (key) => key.replace(encodedReservedTokenRegex, (_, hexCode) => String.fromCodePoint(Number.parseInt(hexCode, 16)));
28394
+ const entries = [...searchParameters.entries()];
28395
+ entries.sort(([leftKey], [rightKey]) => {
28396
+ const left = getSortableKey(leftKey);
28397
+ const right = getSortableKey(rightKey);
28398
+ return left < right ? -1 : left > right ? 1 : 0;
28399
+ });
28400
+ return new URLSearchParams(entries).toString();
28401
+ };
28402
+ var decodeReservedTokens = (value, encodedReservedTokenRegex) => {
28403
+ if (!encodedReservedTokenRegex) {
28404
+ return value;
28405
+ }
28406
+ return value.replace(encodedReservedTokenRegex, (_, hexCode) => String.fromCodePoint(Number.parseInt(hexCode, 16)));
28407
+ };
28408
+ var normalizeEmptyQueryParameters = (search, emptyQueryValue, originalSearch) => {
28409
+ const isAlways = emptyQueryValue === "always";
28410
+ const isNever = emptyQueryValue === "never";
28411
+ const keysWithoutEquals = isAlways || isNever ? void 0 : getKeysWithoutEquals(originalSearch);
28412
+ const normalizeKey = (key) => key.replaceAll("+", "%20");
28413
+ const formatEmptyValue = (normalizedKey) => {
28414
+ if (isAlways) {
28415
+ return `${normalizedKey}=`;
28416
+ }
28417
+ if (isNever) {
28418
+ return normalizedKey;
28419
+ }
28420
+ return keysWithoutEquals.has(decodeQueryKey(normalizedKey)) ? normalizedKey : `${normalizedKey}=`;
28421
+ };
28422
+ const normalizeParameter = (parameter) => {
28423
+ const equalIndex = parameter.indexOf("=");
28424
+ if (equalIndex === -1) {
28425
+ return formatEmptyValue(normalizeKey(parameter));
28426
+ }
28427
+ const key = parameter.slice(0, equalIndex);
28428
+ const value = parameter.slice(equalIndex + 1);
28429
+ if (value === "") {
28430
+ if (key === "") {
28431
+ return "=";
28432
+ }
28433
+ return formatEmptyValue(normalizeKey(key));
28434
+ }
28435
+ return `${normalizeKey(key)}=${value}`;
28436
+ };
28437
+ const parameters = search.slice(1).split("&").filter(Boolean);
28438
+ return parameters.length === 0 ? "" : `?${parameters.map((x) => normalizeParameter(x)).join("&")}`;
28075
28439
  };
28076
28440
  var normalizeDataURL = (urlString, { stripHash }) => {
28077
28441
  const match2 = /^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(urlString);
@@ -28084,7 +28448,7 @@ var normalizeDataURL = (urlString, { stripHash }) => {
28084
28448
  if (isBase64) {
28085
28449
  mediaType.pop();
28086
28450
  }
28087
- const mimeType = mediaType.shift()?.toLowerCase() ?? "";
28451
+ const mimeType = mediaType.shift().toLowerCase();
28088
28452
  const attributes = mediaType.map((attribute) => {
28089
28453
  let [key, value = ""] = attribute.split("=").map((string) => string.trim());
28090
28454
  if (key === "charset") {
@@ -28123,6 +28487,7 @@ function normalizeUrl(urlString, options) {
28123
28487
  sortQueryParameters: true,
28124
28488
  removePath: false,
28125
28489
  transformPath: false,
28490
+ emptyQueryValue: "preserve",
28126
28491
  ...options
28127
28492
  };
28128
28493
  if (typeof options.defaultProtocol === "string" && !options.defaultProtocol.endsWith(":")) {
@@ -28132,12 +28497,15 @@ function normalizeUrl(urlString, options) {
28132
28497
  if (/^data:/i.test(urlString)) {
28133
28498
  return normalizeDataURL(urlString, options);
28134
28499
  }
28135
- if (hasCustomProtocol(urlString)) {
28500
+ const customProtocols = Array.isArray(options.customProtocols) ? options.customProtocols : [];
28501
+ const normalizedCustomProtocols = new Set(customProtocols.map((protocol) => normalizeCustomProtocolOption(protocol)).filter(Boolean));
28502
+ const customProtocol = getCustomProtocol(urlString);
28503
+ if (customProtocol && !normalizedCustomProtocols.has(customProtocol)) {
28136
28504
  return urlString;
28137
28505
  }
28138
28506
  const hasRelativeProtocol = urlString.startsWith("//");
28139
28507
  const isRelativeUrl = !hasRelativeProtocol && /^\.*\//.test(urlString);
28140
- if (!isRelativeUrl) {
28508
+ if (!isRelativeUrl && !customProtocol) {
28141
28509
  urlString = urlString.replace(/^(?!(?:\w+:)?\/\/)|^\/\//, options.defaultProtocol);
28142
28510
  }
28143
28511
  const urlObject = new URL(urlString);
@@ -28171,17 +28539,17 @@ function normalizeUrl(urlString, options) {
28171
28539
  const protocol = match2[0];
28172
28540
  const protocolAtIndex = match2.index;
28173
28541
  const intermediate = urlObject.pathname.slice(lastIndex, protocolAtIndex);
28174
- result += intermediate.replace(/\/{2,}/g, "/");
28542
+ result += intermediate.replaceAll(/\/{2,}/g, "/");
28175
28543
  result += protocol;
28176
28544
  lastIndex = protocolAtIndex + protocol.length;
28177
28545
  }
28178
- const remnant = urlObject.pathname.slice(lastIndex, urlObject.pathname.length);
28179
- result += remnant.replace(/\/{2,}/g, "/");
28546
+ const remnant = urlObject.pathname.slice(lastIndex);
28547
+ result += remnant.replaceAll(/\/{2,}/g, "/");
28180
28548
  urlObject.pathname = result;
28181
28549
  }
28182
28550
  if (urlObject.pathname) {
28183
28551
  try {
28184
- urlObject.pathname = decodeURI(urlObject.pathname).replace(/\\/g, "%5C");
28552
+ urlObject.pathname = decodeURI(urlObject.pathname).replaceAll("\\", "%5C");
28185
28553
  } catch {
28186
28554
  }
28187
28555
  }
@@ -28210,36 +28578,42 @@ function normalizeUrl(urlString, options) {
28210
28578
  urlObject.hostname = urlObject.hostname.replace(/^www\./, "");
28211
28579
  }
28212
28580
  }
28213
- if (Array.isArray(options.removeQueryParameters)) {
28214
- for (const key of [...urlObject.searchParams.keys()]) {
28215
- if (testParameter(key, options.removeQueryParameters)) {
28216
- urlObject.searchParams.delete(key);
28581
+ const originalSearch = urlObject.search;
28582
+ let encodedReservedTokenRegex;
28583
+ if (options.sortQueryParameters && hasEncodedReservedCharactersRegex.test(originalSearch)) {
28584
+ const encodedReservedTokenPrefix = getTemporaryEncodedReservedTokenPrefix(originalSearch);
28585
+ urlObject.search = originalSearch.replaceAll(encodedReservedCharactersRegex, (match2) => `${encodedReservedTokenPrefix}${match2.slice(1).toUpperCase()}`);
28586
+ encodedReservedTokenRegex = new RegExp(`${encodedReservedTokenPrefix}([0-9A-F]{2})`, "g");
28587
+ }
28588
+ const hasKeepQueryParameters = Array.isArray(options.keepQueryParameters);
28589
+ const { searchParams } = urlObject;
28590
+ if (!hasKeepQueryParameters && Array.isArray(options.removeQueryParameters) && options.removeQueryParameters.length > 0) {
28591
+ for (const key of [...searchParams.keys()]) {
28592
+ if (testParameter(decodeReservedTokens(key, encodedReservedTokenRegex), options.removeQueryParameters)) {
28593
+ searchParams.delete(key);
28217
28594
  }
28218
28595
  }
28219
28596
  }
28220
- if (!Array.isArray(options.keepQueryParameters) && options.removeQueryParameters === true) {
28597
+ if (!hasKeepQueryParameters && options.removeQueryParameters === true) {
28221
28598
  urlObject.search = "";
28222
28599
  }
28223
- if (Array.isArray(options.keepQueryParameters) && options.keepQueryParameters.length > 0) {
28224
- for (const key of [...urlObject.searchParams.keys()]) {
28225
- if (!testParameter(key, options.keepQueryParameters)) {
28226
- urlObject.searchParams.delete(key);
28600
+ if (hasKeepQueryParameters && options.keepQueryParameters.length > 0) {
28601
+ for (const key of [...searchParams.keys()]) {
28602
+ if (!testParameter(decodeReservedTokens(key, encodedReservedTokenRegex), options.keepQueryParameters)) {
28603
+ searchParams.delete(key);
28227
28604
  }
28228
28605
  }
28606
+ } else if (hasKeepQueryParameters) {
28607
+ urlObject.search = "";
28229
28608
  }
28230
28609
  if (options.sortQueryParameters) {
28231
- const originalSearch = urlObject.search;
28232
- urlObject.searchParams.sort();
28233
- try {
28234
- urlObject.search = decodeURIComponent(urlObject.search);
28235
- } catch {
28236
- }
28237
- const partsWithoutEquals = originalSearch.slice(1).split("&").filter((p) => p && !p.includes("="));
28238
- for (const part of partsWithoutEquals) {
28239
- const decoded = decodeURIComponent(part);
28240
- urlObject.search = urlObject.search.replace(`?${decoded}=`, `?${decoded}`).replace(`&${decoded}=`, `&${decoded}`);
28610
+ urlObject.search = sortSearchParameters(urlObject.searchParams, encodedReservedTokenRegex);
28611
+ urlObject.search = decodeURIComponent(urlObject.search.replaceAll(/%(?:26|23|3f|25|2b)/gi, (match2) => `%25${match2.slice(1)}`));
28612
+ if (encodedReservedTokenRegex) {
28613
+ urlObject.search = urlObject.search.replace(encodedReservedTokenRegex, "%$1");
28241
28614
  }
28242
28615
  }
28616
+ urlObject.search = normalizeEmptyQueryParameters(urlObject.search, options.emptyQueryValue, originalSearch);
28243
28617
  if (options.removeTrailingSlash) {
28244
28618
  urlObject.pathname = urlObject.pathname.replace(/\/$/, "");
28245
28619
  }
@@ -28264,7 +28638,7 @@ function normalizeUrl(urlString, options) {
28264
28638
  }
28265
28639
 
28266
28640
  // src/get-release-info.js
28267
- function get_release_info_default({ name }, { env: { DEFAULT_NPM_REGISTRY = OFFICIAL_REGISTRY }, nextRelease: { version } }, distTag, registry) {
28641
+ function getReleaseInfo({ name }, { env: { DEFAULT_NPM_REGISTRY = OFFICIAL_REGISTRY }, nextRelease: { version } }, distTag, registry) {
28268
28642
  return {
28269
28643
  name: `npm package (@${distTag} dist-tag)`,
28270
28644
  url: normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY) ? `https://www.npmjs.com/package/${name}/v/${version}` : void 0,
@@ -28273,7 +28647,7 @@ function get_release_info_default({ name }, { env: { DEFAULT_NPM_REGISTRY = OFFI
28273
28647
  }
28274
28648
 
28275
28649
  // src/publish.js
28276
- async function publish_default(npmrc2, config, pkg, context) {
28650
+ async function publish(npmrc2, config, pkg, context) {
28277
28651
  const { npmPublish } = config;
28278
28652
  const {
28279
28653
  cwd,
@@ -28284,8 +28658,8 @@ async function publish_default(npmrc2, config, pkg, context) {
28284
28658
  logger
28285
28659
  } = context;
28286
28660
  if (npmPublish !== false) {
28287
- const registry = get_registry_default(pkg, context);
28288
- const distTag = get_channel_default(channel);
28661
+ const registry = getRegistry(pkg, context);
28662
+ const distTag = getChannel(channel);
28289
28663
  logger.log("Publishing version %s to npm registry", version);
28290
28664
  const lerna = __require.resolve("lerna/cli");
28291
28665
  const result = execa(
@@ -28320,7 +28694,7 @@ async function publish_default(npmrc2, config, pkg, context) {
28320
28694
  result.stdout.pipe(stdout, { end: false });
28321
28695
  result.stderr.pipe(stderr, { end: false });
28322
28696
  await result;
28323
- return get_release_info_default(pkg, context, distTag, registry);
28697
+ return getReleaseInfo(pkg, context, distTag, registry);
28324
28698
  }
28325
28699
  logger.log(`Skip publishing to npm registry as npmPublish false`);
28326
28700
  return false;
@@ -28332,7 +28706,7 @@ import path17 from "node:path";
28332
28706
  var import_nerf_dart = __toESM(require_nerf_dart(), 1);
28333
28707
  var import_rc2 = __toESM(require_rc(), 1);
28334
28708
  import getAuthToken from "registry-auth-token";
28335
- async function set_npmrc_auth_default(npmrc2, registry, { cwd, env: { NPM_TOKEN, NPM_CONFIG_USERCONFIG }, logger }) {
28709
+ async function setNpmrcAuth(npmrc2, registry, { cwd, env: { NPM_TOKEN, NPM_CONFIG_USERCONFIG }, logger }) {
28336
28710
  logger.log("Verify authentication for registry %s", registry);
28337
28711
  const { configs, config, ...rcConfig } = (0, import_rc2.default)(
28338
28712
  "npm",
@@ -28342,7 +28716,10 @@ async function set_npmrc_auth_default(npmrc2, registry, { cwd, env: { NPM_TOKEN,
28342
28716
  if (configs) {
28343
28717
  logger.log("Reading npm config from %s", configs.join(", "));
28344
28718
  }
28345
- const currentConfig = configs ? (await Promise.all(configs.map((config2) => fs8.readFile(config2)))).join("\n") : "";
28719
+ const currentConfig = configs ? (
28720
+ /* eslint-disable-next-line unicorn/no-await-expression-member -- technical debt */
28721
+ (await Promise.all(configs.map((config2) => fs8.readFile(config2)))).join("\n")
28722
+ ) : "";
28346
28723
  if (getAuthToken(registry, { npmrc: rcConfig })) {
28347
28724
  await fs8.mkdir(path17.dirname(npmrc2), { recursive: true });
28348
28725
  await fs8.writeFile(npmrc2, currentConfig);
@@ -28356,7 +28733,7 @@ async function set_npmrc_auth_default(npmrc2, registry, { cwd, env: { NPM_TOKEN,
28356
28733
  await fs8.writeFile(npmrc2, `${oldConfig}${newConfig}`);
28357
28734
  logger.log(`Wrote NPM_TOKEN to ${npmrc2}`);
28358
28735
  } else {
28359
- throw new AggregateError2([get_error_default("ENONPMTOKEN", { registry })]);
28736
+ throw new AggregateError2([getError("ENONPMTOKEN", { registry })]);
28360
28737
  }
28361
28738
  }
28362
28739
 
@@ -30642,7 +31019,7 @@ async function verifyAuthContextAgainstRegistry(npmrc2, registry, context) {
30642
31019
  whoamiResult.stderr.pipe(stderr, { end: false });
30643
31020
  await whoamiResult;
30644
31021
  } catch {
30645
- throw new AggregateError2([get_error_default("EINVALIDNPMTOKEN", { registry })]);
31022
+ throw new AggregateError2([getError("EINVALIDNPMTOKEN", { registry })]);
30646
31023
  }
30647
31024
  }
30648
31025
  async function verifyTokenAuth(registry, npmrc2, context) {
@@ -30653,15 +31030,16 @@ async function verifyTokenAuth(registry, npmrc2, context) {
30653
31030
  await verifyAuthContextAgainstRegistry(npmrc2, registry, context);
30654
31031
  }
30655
31032
  }
30656
- async function verify_auth_default(npmrc2, pkg, context) {
31033
+ async function verifyAuth(npmrc2, pkg, context) {
30657
31034
  const { cwd, logger } = context;
30658
- const registry = get_registry_default(pkg, context);
31035
+ const registry = getRegistry(pkg, context);
30659
31036
  const project = new Project(cwd, logger);
30660
- const packages = (await project.getPackages()).filter((pkg2) => !pkg2.private);
31037
+ const allPackages = await project.getPackages();
31038
+ const packages = allPackages.filter((pkg2) => !pkg2.private);
30661
31039
  if (await oidcContextEstablished(registry, packages, context)) {
30662
31040
  return;
30663
31041
  }
30664
- await set_npmrc_auth_default(npmrc2, registry, context);
31042
+ await setNpmrcAuth(npmrc2, registry, context);
30665
31043
  await verifyTokenAuth(registry, npmrc2, context);
30666
31044
  }
30667
31045
 
@@ -30675,9 +31053,9 @@ var VALIDATORS = {
30675
31053
  tarballDir: isNonEmptyString,
30676
31054
  pkgRoot: isNonEmptyString
30677
31055
  };
30678
- function verify_config_default({ npmPublish, tarballDir, pkgRoot }) {
31056
+ function verifyConfig({ npmPublish, tarballDir, pkgRoot }) {
30679
31057
  return Object.entries({ npmPublish, tarballDir, pkgRoot }).reduce(
30680
- (errors, [option, value]) => !isNil(value) && !VALIDATORS[option](value) ? [...errors, get_error_default(`EINVALID${option.toUpperCase()}`, { [option]: value })] : errors,
31058
+ (errors, [option, value]) => !isNil(value) && !VALIDATORS[option](value) ? [...errors, getError(`EINVALID${option.toUpperCase()}`, { [option]: value })] : errors,
30681
31059
  []
30682
31060
  );
30683
31061
  }
@@ -30699,12 +31077,11 @@ async function verifyGit(context) {
30699
31077
  return [name, details];
30700
31078
  })
30701
31079
  );
30702
- return result.filter(([, details]) => details).map(([name, details]) => get_error_default(`E${name.toUpperCase()}`, details));
31080
+ return result.filter(([, details]) => details).map(([name, details]) => getError(`E${name.toUpperCase()}`, details));
30703
31081
  }
30704
31082
 
30705
31083
  // src/generate-notes.js
30706
- import { dirname } from "node:path";
30707
- import { fileURLToPath as fileURLToPath11, format as format5 } from "node:url";
31084
+ import { format as format5 } from "node:url";
30708
31085
  import conventionalChangelogAngular from "conventional-changelog-angular";
30709
31086
  import * as writerModule from "conventional-changelog-writer";
30710
31087
 
@@ -30796,8 +31173,11 @@ function* filterRevertedCommitsSync(commits) {
30796
31173
 
30797
31174
  // node_modules/conventional-commits-parser/dist/regex.js
30798
31175
  var nomatchRegex = /(?!.*)/;
31176
+ function escape2(string) {
31177
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31178
+ }
30799
31179
  function join(parts, joiner) {
30800
- return parts.map((val) => val.trim()).filter(Boolean).join(joiner);
31180
+ return parts.map((val) => escape2(val.trim())).filter(Boolean).join(joiner);
30801
31181
  }
30802
31182
  function getNotesRegex(noteKeywords, notesPattern) {
30803
31183
  if (!noteKeywords) {
@@ -30897,7 +31277,7 @@ var defaultOptions = {
30897
31277
  "scope",
30898
31278
  "subject"
30899
31279
  ],
30900
- revertPattern: /^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\./,
31280
+ revertPattern: /^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\.?/,
30901
31281
  revertCorrespondence: ["header", "hash"],
30902
31282
  fieldPattern: /^-(.*?)-$/
30903
31283
  };
@@ -31155,6 +31535,15 @@ var CommitParser = class {
31155
31535
  commit.notes.forEach((note) => {
31156
31536
  note.text = trimNewLines(note.text);
31157
31537
  });
31538
+ const referencesSet = /* @__PURE__ */ new Set();
31539
+ commit.references = commit.references.filter((reference) => {
31540
+ const uid = `${reference.action} ${reference.raw}`.toLocaleLowerCase();
31541
+ const ok = !referencesSet.has(uid);
31542
+ if (ok) {
31543
+ referencesSet.add(uid);
31544
+ }
31545
+ return ok;
31546
+ });
31158
31547
  }
31159
31548
  /**
31160
31549
  * Parse commit message string into an object.
@@ -32871,7 +33260,7 @@ async function loadChangelogConfig(pluginConfig, context) {
32871
33260
  const { preset, config, parserOpts, writerOpts, presetConfig } = pluginConfig;
32872
33261
  const { cwd } = context;
32873
33262
  let loadedConfig;
32874
- const __dirname = dirname(fileURLToPath11(import.meta.url));
33263
+ const __dirname = import.meta.dirname;
32875
33264
  if (preset) {
32876
33265
  const presetPackage = `conventional-changelog-${preset.toLowerCase()}`;
32877
33266
  loadedConfig = await (await import_from_esm_default.silent(__dirname, presetPackage) || await import_from_esm_default(cwd, presetPackage))(presetConfig);
@@ -32994,11 +33383,11 @@ async function verifyConditions(pluginConfig, context) {
32994
33383
  pluginConfig.npmPublish = defaultTo(pluginConfig.npmPublish, defaultConfig.npmPublish);
32995
33384
  pluginConfig.tarballDir = defaultTo(pluginConfig.tarballDir, defaultConfig.tarballDir);
32996
33385
  pluginConfig.pkgRoot = defaultTo(pluginConfig.pkgRoot, defaultConfig.pkgRoot);
32997
- const errors = [...verify_config_default(pluginConfig), ...await verifyGit(context)];
33386
+ const errors = [...verifyConfig(pluginConfig), ...await verifyGit(context)];
32998
33387
  try {
32999
33388
  if (pluginConfig.npmVerifyAuth) {
33000
- const pkg = await get_pkg_default(pluginConfig, context);
33001
- await verify_auth_default(npmrc, pkg, context);
33389
+ const pkg = await getPkg(pluginConfig, context);
33390
+ await verifyAuth(npmrc, pkg, context);
33002
33391
  }
33003
33392
  } catch (error) {
33004
33393
  if (Array.isArray(error.errors)) {
@@ -33012,13 +33401,13 @@ async function verifyConditions(pluginConfig, context) {
33012
33401
  }
33013
33402
  verified = true;
33014
33403
  }
33015
- async function prepare(pluginConfig, context) {
33404
+ async function prepare2(pluginConfig, context) {
33016
33405
  pluginConfig.latch = defaultTo(pluginConfig.latch, defaultConfig.latch);
33017
- const errors = verified ? [] : verify_config_default(pluginConfig);
33406
+ const errors = verified ? [] : verifyConfig(pluginConfig);
33018
33407
  try {
33019
33408
  if (pluginConfig.npmVerifyAuth) {
33020
- const pkg = await get_pkg_default(pluginConfig, context);
33021
- await verify_auth_default(npmrc, pkg, context);
33409
+ const pkg = await getPkg(pluginConfig, context);
33410
+ await verifyAuth(npmrc, pkg, context);
33022
33411
  }
33023
33412
  } catch (error) {
33024
33413
  if (Array.isArray(error.errors)) {
@@ -33030,15 +33419,15 @@ async function prepare(pluginConfig, context) {
33030
33419
  if (errors.length > 0) {
33031
33420
  throw new AggregateError2(errors);
33032
33421
  }
33033
- await prepare_default(npmrc, pluginConfig, context);
33422
+ await prepare(npmrc, pluginConfig, context);
33034
33423
  }
33035
- async function publish(pluginConfig, context) {
33424
+ async function publish2(pluginConfig, context) {
33036
33425
  let pkg;
33037
- const errors = verified ? [] : verify_config_default(pluginConfig);
33426
+ const errors = verified ? [] : verifyConfig(pluginConfig);
33038
33427
  try {
33039
- pkg = await get_pkg_default(pluginConfig, context);
33428
+ pkg = await getPkg(pluginConfig, context);
33040
33429
  if (!verified && pluginConfig.npmPublish !== false && pkg.private !== true) {
33041
- await verify_auth_default(npmrc, pkg, context);
33430
+ await verifyAuth(npmrc, pkg, context);
33042
33431
  }
33043
33432
  } catch (error) {
33044
33433
  if (Array.isArray(error.errors)) {
@@ -33050,12 +33439,12 @@ async function publish(pluginConfig, context) {
33050
33439
  if (errors.length > 0) {
33051
33440
  throw new AggregateError2(errors);
33052
33441
  }
33053
- return publish_default(npmrc, pluginConfig, pkg, context);
33442
+ return publish(npmrc, pluginConfig, pkg, context);
33054
33443
  }
33055
33444
  export {
33056
33445
  generateNotes,
33057
- prepare,
33058
- publish,
33446
+ prepare2 as prepare,
33447
+ publish2 as publish,
33059
33448
  verifyConditions
33060
33449
  };
33061
33450
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semantic-release-lerna",
3
- "version": "2.17.2",
3
+ "version": "2.18.1",
4
4
  "description": "semantic-release plugin to publish lerna monorepo packages to npm",
5
5
  "keywords": [
6
6
  "npm",
@@ -41,7 +41,7 @@
41
41
  "@semantic-release/error": "^4.0.0",
42
42
  "conventional-changelog-angular": "^7.0.0 || ^8.0.0",
43
43
  "conventional-changelog-writer": "^7.0.0 || ^8.0.0",
44
- "cosmiconfig": "^9.0.0",
44
+ "cosmiconfig": "^9.0.1",
45
45
  "libnpmversion": "^8.0.3",
46
46
  "registry-auth-token": "^5.1.1"
47
47
  },
@@ -50,7 +50,7 @@
50
50
  "semantic-release": "^22.0.0 || ^23.0.0 || ^24.0.0 || ^25.0.0"
51
51
  },
52
52
  "engines": {
53
- "node": "^20.17 || >= 22.9"
53
+ "node": "^20.17 || >= 22.16"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public",