@sentry/craft 2.21.2 → 2.21.4

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/craft +905 -527
  2. package/package.json +2 -1
package/dist/craft CHANGED
@@ -55567,6 +55567,155 @@ var init_dryRun = __esm({
55567
55567
  }
55568
55568
  });
55569
55569
 
55570
+ // node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.js
55571
+ var require_mod = __commonJS({
55572
+ "node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.js"(exports2) {
55573
+ "use strict";
55574
+ init_import_meta_url();
55575
+ exports2.__esModule = true;
55576
+ exports2.distance = exports2.closest = void 0;
55577
+ var peq = new Uint32Array(65536);
55578
+ var myers_32 = function(a4, b5) {
55579
+ var n4 = a4.length;
55580
+ var m5 = b5.length;
55581
+ var lst = 1 << n4 - 1;
55582
+ var pv = -1;
55583
+ var mv = 0;
55584
+ var sc = n4;
55585
+ var i4 = n4;
55586
+ while (i4--) {
55587
+ peq[a4.charCodeAt(i4)] |= 1 << i4;
55588
+ }
55589
+ for (i4 = 0; i4 < m5; i4++) {
55590
+ var eq = peq[b5.charCodeAt(i4)];
55591
+ var xv = eq | mv;
55592
+ eq |= (eq & pv) + pv ^ pv;
55593
+ mv |= ~(eq | pv);
55594
+ pv &= eq;
55595
+ if (mv & lst) {
55596
+ sc++;
55597
+ }
55598
+ if (pv & lst) {
55599
+ sc--;
55600
+ }
55601
+ mv = mv << 1 | 1;
55602
+ pv = pv << 1 | ~(xv | mv);
55603
+ mv &= xv;
55604
+ }
55605
+ i4 = n4;
55606
+ while (i4--) {
55607
+ peq[a4.charCodeAt(i4)] = 0;
55608
+ }
55609
+ return sc;
55610
+ };
55611
+ var myers_x = function(b5, a4) {
55612
+ var n4 = a4.length;
55613
+ var m5 = b5.length;
55614
+ var mhc = [];
55615
+ var phc = [];
55616
+ var hsize = Math.ceil(n4 / 32);
55617
+ var vsize = Math.ceil(m5 / 32);
55618
+ for (var i4 = 0; i4 < hsize; i4++) {
55619
+ phc[i4] = -1;
55620
+ mhc[i4] = 0;
55621
+ }
55622
+ var j5 = 0;
55623
+ for (; j5 < vsize - 1; j5++) {
55624
+ var mv_1 = 0;
55625
+ var pv_1 = -1;
55626
+ var start_1 = j5 * 32;
55627
+ var vlen_1 = Math.min(32, m5) + start_1;
55628
+ for (var k5 = start_1; k5 < vlen_1; k5++) {
55629
+ peq[b5.charCodeAt(k5)] |= 1 << k5;
55630
+ }
55631
+ for (var i4 = 0; i4 < n4; i4++) {
55632
+ var eq = peq[a4.charCodeAt(i4)];
55633
+ var pb = phc[i4 / 32 | 0] >>> i4 & 1;
55634
+ var mb = mhc[i4 / 32 | 0] >>> i4 & 1;
55635
+ var xv = eq | mv_1;
55636
+ var xh = ((eq | mb) & pv_1) + pv_1 ^ pv_1 | eq | mb;
55637
+ var ph = mv_1 | ~(xh | pv_1);
55638
+ var mh = pv_1 & xh;
55639
+ if (ph >>> 31 ^ pb) {
55640
+ phc[i4 / 32 | 0] ^= 1 << i4;
55641
+ }
55642
+ if (mh >>> 31 ^ mb) {
55643
+ mhc[i4 / 32 | 0] ^= 1 << i4;
55644
+ }
55645
+ ph = ph << 1 | pb;
55646
+ mh = mh << 1 | mb;
55647
+ pv_1 = mh | ~(xv | ph);
55648
+ mv_1 = ph & xv;
55649
+ }
55650
+ for (var k5 = start_1; k5 < vlen_1; k5++) {
55651
+ peq[b5.charCodeAt(k5)] = 0;
55652
+ }
55653
+ }
55654
+ var mv = 0;
55655
+ var pv = -1;
55656
+ var start = j5 * 32;
55657
+ var vlen = Math.min(32, m5 - start) + start;
55658
+ for (var k5 = start; k5 < vlen; k5++) {
55659
+ peq[b5.charCodeAt(k5)] |= 1 << k5;
55660
+ }
55661
+ var score = m5;
55662
+ for (var i4 = 0; i4 < n4; i4++) {
55663
+ var eq = peq[a4.charCodeAt(i4)];
55664
+ var pb = phc[i4 / 32 | 0] >>> i4 & 1;
55665
+ var mb = mhc[i4 / 32 | 0] >>> i4 & 1;
55666
+ var xv = eq | mv;
55667
+ var xh = ((eq | mb) & pv) + pv ^ pv | eq | mb;
55668
+ var ph = mv | ~(xh | pv);
55669
+ var mh = pv & xh;
55670
+ score += ph >>> m5 - 1 & 1;
55671
+ score -= mh >>> m5 - 1 & 1;
55672
+ if (ph >>> 31 ^ pb) {
55673
+ phc[i4 / 32 | 0] ^= 1 << i4;
55674
+ }
55675
+ if (mh >>> 31 ^ mb) {
55676
+ mhc[i4 / 32 | 0] ^= 1 << i4;
55677
+ }
55678
+ ph = ph << 1 | pb;
55679
+ mh = mh << 1 | mb;
55680
+ pv = mh | ~(xv | ph);
55681
+ mv = ph & xv;
55682
+ }
55683
+ for (var k5 = start; k5 < vlen; k5++) {
55684
+ peq[b5.charCodeAt(k5)] = 0;
55685
+ }
55686
+ return score;
55687
+ };
55688
+ var distance = function(a4, b5) {
55689
+ if (a4.length < b5.length) {
55690
+ var tmp2 = b5;
55691
+ b5 = a4;
55692
+ a4 = tmp2;
55693
+ }
55694
+ if (b5.length === 0) {
55695
+ return a4.length;
55696
+ }
55697
+ if (a4.length <= 32) {
55698
+ return myers_32(a4, b5);
55699
+ }
55700
+ return myers_x(a4, b5);
55701
+ };
55702
+ exports2.distance = distance;
55703
+ var closest = function(str2, arr) {
55704
+ var min_distance = Infinity;
55705
+ var min_index = 0;
55706
+ for (var i4 = 0; i4 < arr.length; i4++) {
55707
+ var dist = distance(str2, arr[i4]);
55708
+ if (dist < min_distance) {
55709
+ min_distance = dist;
55710
+ min_index = i4;
55711
+ }
55712
+ }
55713
+ return arr[min_index];
55714
+ };
55715
+ exports2.closest = closest;
55716
+ }
55717
+ });
55718
+
55570
55719
  // src/utils/git.ts
55571
55720
  async function getDefaultBranch(git, remoteName) {
55572
55721
  return stripRemoteName(
@@ -55645,7 +55794,45 @@ async function cloneRepo(url2, targetDirectory, options) {
55645
55794
  function isRepoDirty(repoStatus) {
55646
55795
  return !!(repoStatus.conflicted.length || repoStatus.created.length || repoStatus.deleted.length || repoStatus.modified.length || repoStatus.renamed.length || repoStatus.staged.length);
55647
55796
  }
55648
- var PRExtractor;
55797
+ function parseGitBranchOutput(output) {
55798
+ return output.split("\n").map((line) => line.trim()).filter((line) => line && !line.includes("->"));
55799
+ }
55800
+ async function findReleaseBranches(git, prefix, limit = 10) {
55801
+ const MAX_EDIT_DISTANCE = 3;
55802
+ try {
55803
+ await git.fetch();
55804
+ } catch (_err) {
55805
+ logger.debug("Failed to fetch from remote, using locally cached refs");
55806
+ }
55807
+ let allBranches;
55808
+ try {
55809
+ const output = await git.raw("branch", "-r");
55810
+ allBranches = parseGitBranchOutput(output);
55811
+ } catch (_err) {
55812
+ logger.debug("Failed to list remote branches");
55813
+ return { exactMatches: [], fuzzyMatches: [] };
55814
+ }
55815
+ const exactMatches = [];
55816
+ const fuzzyMatches = [];
55817
+ for (const branch of allBranches) {
55818
+ const withoutRemote = branch.replace(/^[^/]+\//, "");
55819
+ const slashIndex = withoutRemote.indexOf("/");
55820
+ const branchPrefix = slashIndex >= 0 ? withoutRemote.slice(0, slashIndex) : withoutRemote;
55821
+ if (!branchPrefix) {
55822
+ continue;
55823
+ }
55824
+ if (branchPrefix === prefix) {
55825
+ exactMatches.push(branch);
55826
+ } else if ((0, import_fastest_levenshtein.distance)(branchPrefix, prefix) <= MAX_EDIT_DISTANCE) {
55827
+ fuzzyMatches.push(branch);
55828
+ }
55829
+ }
55830
+ return {
55831
+ exactMatches: exactMatches.slice(-limit).reverse(),
55832
+ fuzzyMatches: fuzzyMatches.slice(-limit).reverse()
55833
+ };
55834
+ }
55835
+ var import_fastest_levenshtein, PRExtractor;
55649
55836
  var init_git = __esm({
55650
55837
  "src/utils/git.ts"() {
55651
55838
  init_import_meta_url();
@@ -55654,6 +55841,7 @@ var init_git = __esm({
55654
55841
  init_errors2();
55655
55842
  init_dryRun();
55656
55843
  init_logger2();
55844
+ import_fastest_levenshtein = __toESM(require_mod());
55657
55845
  PRExtractor = /(?<=\(#)\d+(?=\)$)/;
55658
55846
  }
55659
55847
  });
@@ -71284,10 +71472,29 @@ function stringToRegexp(str2) {
71284
71472
  function escapeRegex(str2) {
71285
71473
  return str2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
71286
71474
  }
71475
+ function hasGlobChars(str2) {
71476
+ return /[*?]/.test(str2);
71477
+ }
71478
+ function globToRegex(pattern) {
71479
+ let result = "";
71480
+ for (const char of pattern) {
71481
+ if (char === "*") {
71482
+ result += ".*";
71483
+ } else if (char === "?") {
71484
+ result += ".";
71485
+ } else {
71486
+ result += escapeRegex(char);
71487
+ }
71488
+ }
71489
+ return result;
71490
+ }
71287
71491
  function patternToRegexp(pattern) {
71288
71492
  if (pattern.startsWith("/") && pattern.lastIndexOf("/") > 0) {
71289
71493
  return stringToRegexp(pattern);
71290
71494
  }
71495
+ if (hasGlobChars(pattern)) {
71496
+ return new RegExp(`^${globToRegex(pattern)}$`);
71497
+ }
71291
71498
  return new RegExp(`^${escapeRegex(pattern)}$`);
71292
71499
  }
71293
71500
  var init_filters = __esm({
@@ -80384,6 +80591,487 @@ var init_files = __esm({
80384
80591
  }
80385
80592
  });
80386
80593
 
80594
+ // node_modules/.pnpm/mustache@3.0.1/node_modules/mustache/mustache.js
80595
+ var require_mustache = __commonJS({
80596
+ "node_modules/.pnpm/mustache@3.0.1/node_modules/mustache/mustache.js"(exports2) {
80597
+ init_import_meta_url();
80598
+ (function defineMustache(global2, factory) {
80599
+ if (typeof exports2 === "object" && exports2 && typeof exports2.nodeName !== "string") {
80600
+ factory(exports2);
80601
+ } else if (typeof define === "function" && define.amd) {
80602
+ define(["exports"], factory);
80603
+ } else {
80604
+ global2.Mustache = {};
80605
+ factory(global2.Mustache);
80606
+ }
80607
+ })(exports2, function mustacheFactory(mustache2) {
80608
+ var objectToString3 = Object.prototype.toString;
80609
+ var isArray = Array.isArray || function isArrayPolyfill(object) {
80610
+ return objectToString3.call(object) === "[object Array]";
80611
+ };
80612
+ function isFunction2(object) {
80613
+ return typeof object === "function";
80614
+ }
80615
+ function typeStr(obj) {
80616
+ return isArray(obj) ? "array" : typeof obj;
80617
+ }
80618
+ function escapeRegExp(string) {
80619
+ return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
80620
+ }
80621
+ function hasProperty(obj, propName2) {
80622
+ return obj != null && typeof obj === "object" && propName2 in obj;
80623
+ }
80624
+ function primitiveHasOwnProperty(primitive, propName2) {
80625
+ return primitive != null && typeof primitive !== "object" && primitive.hasOwnProperty && primitive.hasOwnProperty(propName2);
80626
+ }
80627
+ var regExpTest = RegExp.prototype.test;
80628
+ function testRegExp(re3, string) {
80629
+ return regExpTest.call(re3, string);
80630
+ }
80631
+ var nonSpaceRe = /\S/;
80632
+ function isWhitespace2(string) {
80633
+ return !testRegExp(nonSpaceRe, string);
80634
+ }
80635
+ var entityMap = {
80636
+ "&": "&amp;",
80637
+ "<": "&lt;",
80638
+ ">": "&gt;",
80639
+ '"': "&quot;",
80640
+ "'": "&#39;",
80641
+ "/": "&#x2F;",
80642
+ "`": "&#x60;",
80643
+ "=": "&#x3D;"
80644
+ };
80645
+ function escapeHtml(string) {
80646
+ return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s4) {
80647
+ return entityMap[s4];
80648
+ });
80649
+ }
80650
+ var whiteRe = /\s*/;
80651
+ var spaceRe = /\s+/;
80652
+ var equalsRe = /\s*=/;
80653
+ var curlyRe = /\s*\}/;
80654
+ var tagRe = /#|\^|\/|>|\{|&|=|!/;
80655
+ function parseTemplate(template, tags) {
80656
+ if (!template)
80657
+ return [];
80658
+ var sections = [];
80659
+ var tokens = [];
80660
+ var spaces = [];
80661
+ var hasTag = false;
80662
+ var nonSpace = false;
80663
+ function stripSpace() {
80664
+ if (hasTag && !nonSpace) {
80665
+ while (spaces.length)
80666
+ delete tokens[spaces.pop()];
80667
+ } else {
80668
+ spaces = [];
80669
+ }
80670
+ hasTag = false;
80671
+ nonSpace = false;
80672
+ }
80673
+ var openingTagRe, closingTagRe, closingCurlyRe;
80674
+ function compileTags(tagsToCompile) {
80675
+ if (typeof tagsToCompile === "string")
80676
+ tagsToCompile = tagsToCompile.split(spaceRe, 2);
80677
+ if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
80678
+ throw new Error("Invalid tags: " + tagsToCompile);
80679
+ openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + "\\s*");
80680
+ closingTagRe = new RegExp("\\s*" + escapeRegExp(tagsToCompile[1]));
80681
+ closingCurlyRe = new RegExp("\\s*" + escapeRegExp("}" + tagsToCompile[1]));
80682
+ }
80683
+ compileTags(tags || mustache2.tags);
80684
+ var scanner = new Scanner(template);
80685
+ var start, type2, value, chr, token, openSection;
80686
+ while (!scanner.eos()) {
80687
+ start = scanner.pos;
80688
+ value = scanner.scanUntil(openingTagRe);
80689
+ if (value) {
80690
+ for (var i4 = 0, valueLength = value.length; i4 < valueLength; ++i4) {
80691
+ chr = value.charAt(i4);
80692
+ if (isWhitespace2(chr)) {
80693
+ spaces.push(tokens.length);
80694
+ } else {
80695
+ nonSpace = true;
80696
+ }
80697
+ tokens.push(["text", chr, start, start + 1]);
80698
+ start += 1;
80699
+ if (chr === "\n")
80700
+ stripSpace();
80701
+ }
80702
+ }
80703
+ if (!scanner.scan(openingTagRe))
80704
+ break;
80705
+ hasTag = true;
80706
+ type2 = scanner.scan(tagRe) || "name";
80707
+ scanner.scan(whiteRe);
80708
+ if (type2 === "=") {
80709
+ value = scanner.scanUntil(equalsRe);
80710
+ scanner.scan(equalsRe);
80711
+ scanner.scanUntil(closingTagRe);
80712
+ } else if (type2 === "{") {
80713
+ value = scanner.scanUntil(closingCurlyRe);
80714
+ scanner.scan(curlyRe);
80715
+ scanner.scanUntil(closingTagRe);
80716
+ type2 = "&";
80717
+ } else {
80718
+ value = scanner.scanUntil(closingTagRe);
80719
+ }
80720
+ if (!scanner.scan(closingTagRe))
80721
+ throw new Error("Unclosed tag at " + scanner.pos);
80722
+ token = [type2, value, start, scanner.pos];
80723
+ tokens.push(token);
80724
+ if (type2 === "#" || type2 === "^") {
80725
+ sections.push(token);
80726
+ } else if (type2 === "/") {
80727
+ openSection = sections.pop();
80728
+ if (!openSection)
80729
+ throw new Error('Unopened section "' + value + '" at ' + start);
80730
+ if (openSection[1] !== value)
80731
+ throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
80732
+ } else if (type2 === "name" || type2 === "{" || type2 === "&") {
80733
+ nonSpace = true;
80734
+ } else if (type2 === "=") {
80735
+ compileTags(value);
80736
+ }
80737
+ }
80738
+ openSection = sections.pop();
80739
+ if (openSection)
80740
+ throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
80741
+ return nestTokens(squashTokens(tokens));
80742
+ }
80743
+ function squashTokens(tokens) {
80744
+ var squashedTokens = [];
80745
+ var token, lastToken;
80746
+ for (var i4 = 0, numTokens = tokens.length; i4 < numTokens; ++i4) {
80747
+ token = tokens[i4];
80748
+ if (token) {
80749
+ if (token[0] === "text" && lastToken && lastToken[0] === "text") {
80750
+ lastToken[1] += token[1];
80751
+ lastToken[3] = token[3];
80752
+ } else {
80753
+ squashedTokens.push(token);
80754
+ lastToken = token;
80755
+ }
80756
+ }
80757
+ }
80758
+ return squashedTokens;
80759
+ }
80760
+ function nestTokens(tokens) {
80761
+ var nestedTokens = [];
80762
+ var collector = nestedTokens;
80763
+ var sections = [];
80764
+ var token, section;
80765
+ for (var i4 = 0, numTokens = tokens.length; i4 < numTokens; ++i4) {
80766
+ token = tokens[i4];
80767
+ switch (token[0]) {
80768
+ case "#":
80769
+ case "^":
80770
+ collector.push(token);
80771
+ sections.push(token);
80772
+ collector = token[4] = [];
80773
+ break;
80774
+ case "/":
80775
+ section = sections.pop();
80776
+ section[5] = token[2];
80777
+ collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
80778
+ break;
80779
+ default:
80780
+ collector.push(token);
80781
+ }
80782
+ }
80783
+ return nestedTokens;
80784
+ }
80785
+ function Scanner(string) {
80786
+ this.string = string;
80787
+ this.tail = string;
80788
+ this.pos = 0;
80789
+ }
80790
+ Scanner.prototype.eos = function eos() {
80791
+ return this.tail === "";
80792
+ };
80793
+ Scanner.prototype.scan = function scan2(re3) {
80794
+ var match3 = this.tail.match(re3);
80795
+ if (!match3 || match3.index !== 0)
80796
+ return "";
80797
+ var string = match3[0];
80798
+ this.tail = this.tail.substring(string.length);
80799
+ this.pos += string.length;
80800
+ return string;
80801
+ };
80802
+ Scanner.prototype.scanUntil = function scanUntil(re3) {
80803
+ var index = this.tail.search(re3), match3;
80804
+ switch (index) {
80805
+ case -1:
80806
+ match3 = this.tail;
80807
+ this.tail = "";
80808
+ break;
80809
+ case 0:
80810
+ match3 = "";
80811
+ break;
80812
+ default:
80813
+ match3 = this.tail.substring(0, index);
80814
+ this.tail = this.tail.substring(index);
80815
+ }
80816
+ this.pos += match3.length;
80817
+ return match3;
80818
+ };
80819
+ function Context2(view, parentContext) {
80820
+ this.view = view;
80821
+ this.cache = { ".": this.view };
80822
+ this.parent = parentContext;
80823
+ }
80824
+ Context2.prototype.push = function push2(view) {
80825
+ return new Context2(view, this);
80826
+ };
80827
+ Context2.prototype.lookup = function lookup(name2) {
80828
+ var cache6 = this.cache;
80829
+ var value;
80830
+ if (cache6.hasOwnProperty(name2)) {
80831
+ value = cache6[name2];
80832
+ } else {
80833
+ var context2 = this, intermediateValue, names, index, lookupHit = false;
80834
+ while (context2) {
80835
+ if (name2.indexOf(".") > 0) {
80836
+ intermediateValue = context2.view;
80837
+ names = name2.split(".");
80838
+ index = 0;
80839
+ while (intermediateValue != null && index < names.length) {
80840
+ if (index === names.length - 1)
80841
+ lookupHit = hasProperty(intermediateValue, names[index]) || primitiveHasOwnProperty(intermediateValue, names[index]);
80842
+ intermediateValue = intermediateValue[names[index++]];
80843
+ }
80844
+ } else {
80845
+ intermediateValue = context2.view[name2];
80846
+ lookupHit = hasProperty(context2.view, name2);
80847
+ }
80848
+ if (lookupHit) {
80849
+ value = intermediateValue;
80850
+ break;
80851
+ }
80852
+ context2 = context2.parent;
80853
+ }
80854
+ cache6[name2] = value;
80855
+ }
80856
+ if (isFunction2(value))
80857
+ value = value.call(this.view);
80858
+ return value;
80859
+ };
80860
+ function Writer() {
80861
+ this.cache = {};
80862
+ }
80863
+ Writer.prototype.clearCache = function clearCache() {
80864
+ this.cache = {};
80865
+ };
80866
+ Writer.prototype.parse = function parse8(template, tags) {
80867
+ var cache6 = this.cache;
80868
+ var cacheKey = template + ":" + (tags || mustache2.tags).join(":");
80869
+ var tokens = cache6[cacheKey];
80870
+ if (tokens == null)
80871
+ tokens = cache6[cacheKey] = parseTemplate(template, tags);
80872
+ return tokens;
80873
+ };
80874
+ Writer.prototype.render = function render2(template, view, partials, tags) {
80875
+ var tokens = this.parse(template, tags);
80876
+ var context2 = view instanceof Context2 ? view : new Context2(view);
80877
+ return this.renderTokens(tokens, context2, partials, template, tags);
80878
+ };
80879
+ Writer.prototype.renderTokens = function renderTokens(tokens, context2, partials, originalTemplate, tags) {
80880
+ var buffer = "";
80881
+ var token, symbol, value;
80882
+ for (var i4 = 0, numTokens = tokens.length; i4 < numTokens; ++i4) {
80883
+ value = void 0;
80884
+ token = tokens[i4];
80885
+ symbol = token[0];
80886
+ if (symbol === "#") value = this.renderSection(token, context2, partials, originalTemplate);
80887
+ else if (symbol === "^") value = this.renderInverted(token, context2, partials, originalTemplate);
80888
+ else if (symbol === ">") value = this.renderPartial(token, context2, partials, tags);
80889
+ else if (symbol === "&") value = this.unescapedValue(token, context2);
80890
+ else if (symbol === "name") value = this.escapedValue(token, context2);
80891
+ else if (symbol === "text") value = this.rawValue(token);
80892
+ if (value !== void 0)
80893
+ buffer += value;
80894
+ }
80895
+ return buffer;
80896
+ };
80897
+ Writer.prototype.renderSection = function renderSection(token, context2, partials, originalTemplate) {
80898
+ var self2 = this;
80899
+ var buffer = "";
80900
+ var value = context2.lookup(token[1]);
80901
+ function subRender(template) {
80902
+ return self2.render(template, context2, partials);
80903
+ }
80904
+ if (!value) return;
80905
+ if (isArray(value)) {
80906
+ for (var j5 = 0, valueLength = value.length; j5 < valueLength; ++j5) {
80907
+ buffer += this.renderTokens(token[4], context2.push(value[j5]), partials, originalTemplate);
80908
+ }
80909
+ } else if (typeof value === "object" || typeof value === "string" || typeof value === "number") {
80910
+ buffer += this.renderTokens(token[4], context2.push(value), partials, originalTemplate);
80911
+ } else if (isFunction2(value)) {
80912
+ if (typeof originalTemplate !== "string")
80913
+ throw new Error("Cannot use higher-order sections without the original template");
80914
+ value = value.call(context2.view, originalTemplate.slice(token[3], token[5]), subRender);
80915
+ if (value != null)
80916
+ buffer += value;
80917
+ } else {
80918
+ buffer += this.renderTokens(token[4], context2, partials, originalTemplate);
80919
+ }
80920
+ return buffer;
80921
+ };
80922
+ Writer.prototype.renderInverted = function renderInverted(token, context2, partials, originalTemplate) {
80923
+ var value = context2.lookup(token[1]);
80924
+ if (!value || isArray(value) && value.length === 0)
80925
+ return this.renderTokens(token[4], context2, partials, originalTemplate);
80926
+ };
80927
+ Writer.prototype.renderPartial = function renderPartial(token, context2, partials, tags) {
80928
+ if (!partials) return;
80929
+ var value = isFunction2(partials) ? partials(token[1]) : partials[token[1]];
80930
+ if (value != null)
80931
+ return this.renderTokens(this.parse(value, tags), context2, partials, value);
80932
+ };
80933
+ Writer.prototype.unescapedValue = function unescapedValue(token, context2) {
80934
+ var value = context2.lookup(token[1]);
80935
+ if (value != null)
80936
+ return value;
80937
+ };
80938
+ Writer.prototype.escapedValue = function escapedValue(token, context2) {
80939
+ var value = context2.lookup(token[1]);
80940
+ if (value != null)
80941
+ return mustache2.escape(value);
80942
+ };
80943
+ Writer.prototype.rawValue = function rawValue(token) {
80944
+ return token[1];
80945
+ };
80946
+ mustache2.name = "mustache.js";
80947
+ mustache2.version = "3.0.1";
80948
+ mustache2.tags = ["{{", "}}"];
80949
+ var defaultWriter = new Writer();
80950
+ mustache2.clearCache = function clearCache() {
80951
+ return defaultWriter.clearCache();
80952
+ };
80953
+ mustache2.parse = function parse8(template, tags) {
80954
+ return defaultWriter.parse(template, tags);
80955
+ };
80956
+ mustache2.render = function render2(template, view, partials, tags) {
80957
+ if (typeof template !== "string") {
80958
+ throw new TypeError('Invalid template! Template should be a "string" but "' + typeStr(template) + '" was given as the first argument for mustache#render(template, view, partials)');
80959
+ }
80960
+ return defaultWriter.render(template, view, partials, tags);
80961
+ };
80962
+ mustache2.to_html = function to_html(template, view, partials, send) {
80963
+ var result = mustache2.render(template, view, partials);
80964
+ if (isFunction2(send)) {
80965
+ send(result);
80966
+ } else {
80967
+ return result;
80968
+ }
80969
+ };
80970
+ mustache2.escape = escapeHtml;
80971
+ mustache2.Scanner = Scanner;
80972
+ mustache2.Context = Context2;
80973
+ mustache2.Writer = Writer;
80974
+ return mustache2;
80975
+ });
80976
+ }
80977
+ });
80978
+
80979
+ // src/utils/strings.ts
80980
+ function sanitizeObject(obj) {
80981
+ if (typeof obj !== "object" || obj === null) {
80982
+ throw new Error(`Cannot normalize value: ${obj}`);
80983
+ }
80984
+ const result = {};
80985
+ for (const key of Object.keys(obj)) {
80986
+ const value = obj[key];
80987
+ const valueType = typeof value;
80988
+ let newValue;
80989
+ if (["boolean", "string", "number", "undefined"].indexOf(valueType) > -1) {
80990
+ newValue = value;
80991
+ } else if (value === null) {
80992
+ newValue = void 0;
80993
+ } else if (valueType === "object") {
80994
+ newValue = sanitizeObject(value);
80995
+ } else {
80996
+ continue;
80997
+ }
80998
+ result[key] = newValue;
80999
+ const normalizedKey = key.replace(/\./g, "__");
81000
+ if (key !== normalizedKey) {
81001
+ result[normalizedKey] = newValue;
81002
+ }
81003
+ }
81004
+ return result;
81005
+ }
81006
+ function renderTemplateSafe(template, context2) {
81007
+ const sanitizedContext = sanitizeObject(context2);
81008
+ const unknownVars = [];
81009
+ mustache.Context.prototype.lookup = function(name2) {
81010
+ const value = originalLookup.call(this, name2);
81011
+ if (value === void 0) {
81012
+ unknownVars.push(name2);
81013
+ }
81014
+ return value;
81015
+ };
81016
+ try {
81017
+ const result = mustache.render(template, sanitizedContext);
81018
+ if (unknownVars.length > 0) {
81019
+ const availableVars = Object.keys(sanitizedContext).join(", ");
81020
+ const unknownList = [...new Set(unknownVars)].join(", ");
81021
+ throw new ConfigurationError(
81022
+ `Unknown template variable(s): ${unknownList}. Available variables: ${availableVars}`
81023
+ );
81024
+ }
81025
+ return result;
81026
+ } finally {
81027
+ mustache.Context.prototype.lookup = originalLookup;
81028
+ }
81029
+ }
81030
+ function formatSize(size) {
81031
+ if (size < 1024) {
81032
+ return `${size} B`;
81033
+ }
81034
+ const kilobytes = size / 1024;
81035
+ if (kilobytes < 1024) {
81036
+ return `${kilobytes.toFixed(1)} kB`;
81037
+ } else {
81038
+ const megabytes = kilobytes / 1024;
81039
+ return `${megabytes.toFixed(2)} MB`;
81040
+ }
81041
+ }
81042
+ function formatJson(obj) {
81043
+ const result = JSON.stringify(obj, null, 4);
81044
+ if (obj instanceof Error && result === "{}") {
81045
+ return util4.format(obj);
81046
+ } else {
81047
+ return result;
81048
+ }
81049
+ }
81050
+ function formatArtifactConfigForError(artifactsConfig) {
81051
+ if (!artifactsConfig) {
81052
+ return "";
81053
+ }
81054
+ const yamlSnippet = dump(
81055
+ { artifacts: artifactsConfig },
81056
+ { indent: 2, flowLevel: 3 }
81057
+ ).trimEnd();
81058
+ return `
81059
+
81060
+ Your .craft.yml artifact configuration:
81061
+ ${yamlSnippet}`;
81062
+ }
81063
+ var mustache, util4, originalLookup;
81064
+ var init_strings = __esm({
81065
+ "src/utils/strings.ts"() {
81066
+ init_import_meta_url();
81067
+ init_js_yaml();
81068
+ mustache = __toESM(require_mustache());
81069
+ util4 = __toESM(require("util"));
81070
+ init_errors2();
81071
+ originalLookup = mustache.Context.prototype.lookup;
81072
+ }
81073
+ });
81074
+
80387
81075
  // src/artifact_providers/github.ts
80388
81076
  function normalizeArtifactPatterns(patterns) {
80389
81077
  if (!patterns) {
@@ -80397,10 +81085,14 @@ function normalizeArtifactsConfig(config3) {
80397
81085
  return [];
80398
81086
  }
80399
81087
  if (typeof config3 === "string") {
80400
- return [{ workflow: void 0, artifacts: normalizeArtifactPatterns(config3) }];
81088
+ return [
81089
+ { workflow: void 0, artifacts: normalizeArtifactPatterns(config3) }
81090
+ ];
80401
81091
  }
80402
81092
  if (Array.isArray(config3)) {
80403
- return [{ workflow: void 0, artifacts: normalizeArtifactPatterns(config3) }];
81093
+ return [
81094
+ { workflow: void 0, artifacts: normalizeArtifactPatterns(config3) }
81095
+ ];
80404
81096
  }
80405
81097
  const filters = [];
80406
81098
  for (const [workflowPattern, artifactPatterns] of Object.entries(config3)) {
@@ -80434,6 +81126,7 @@ var init_github = __esm({
80434
81126
  init_system();
80435
81127
  init_async();
80436
81128
  init_filters();
81129
+ init_strings();
80437
81130
  MAX_TRIES = 3;
80438
81131
  MILLISECONDS = 1e3;
80439
81132
  ARTIFACTS_POLLING_INTERVAL = 10 * MILLISECONDS;
@@ -80618,12 +81311,17 @@ var init_github = __esm({
80618
81311
  return patterns;
80619
81312
  }
80620
81313
  /**
80621
- * Gets artifacts from workflow runs and filters them by patterns
81314
+ * Gets artifacts from workflow runs and filters them by patterns.
81315
+ *
81316
+ * Returns both the matching artifacts and all artifact names seen
81317
+ * (regardless of whether they matched). The allNames list is used
81318
+ * in error messages to help users identify naming mismatches.
80622
81319
  */
80623
81320
  async getArtifactsFromWorkflowRuns(runs, filters) {
80624
81321
  const { repoName: repo, repoOwner: owner } = this.config;
80625
81322
  const matchingArtifacts = [];
80626
81323
  const seenArtifactIds = /* @__PURE__ */ new Set();
81324
+ const allArtifactNames = /* @__PURE__ */ new Set();
80627
81325
  for (const run of runs) {
80628
81326
  const workflowName = run.name ?? "";
80629
81327
  const patterns = this.getApplicablePatterns(workflowName, filters);
@@ -80643,6 +81341,7 @@ var init_github = __esm({
80643
81341
  page
80644
81342
  });
80645
81343
  for (const artifact of response.data.artifacts) {
81344
+ allArtifactNames.add(artifact.name);
80646
81345
  if (seenArtifactIds.has(artifact.id)) {
80647
81346
  continue;
80648
81347
  }
@@ -80661,7 +81360,7 @@ var init_github = __esm({
80661
81360
  }
80662
81361
  }
80663
81362
  this.logger.debug(`Found ${matchingArtifacts.length} matching artifacts`);
80664
- return matchingArtifacts;
81363
+ return { matching: matchingArtifacts, allNames: [...allArtifactNames] };
80665
81364
  }
80666
81365
  /**
80667
81366
  * Downloads an artifact to a temp file
@@ -80741,10 +81440,15 @@ var init_github = __esm({
80741
81440
  try {
80742
81441
  if (fs14.existsSync(tempFile)) {
80743
81442
  fs14.unlinkSync(tempFile);
80744
- this.logger.debug(`Cleaned up temp file after failed unpack: ${tempFile}`);
81443
+ this.logger.debug(
81444
+ `Cleaned up temp file after failed unpack: ${tempFile}`
81445
+ );
80745
81446
  }
80746
81447
  } catch (cleanupError) {
80747
- this.logger.warn(`Failed to clean up temp file ${tempFile}:`, cleanupError);
81448
+ this.logger.warn(
81449
+ `Failed to clean up temp file ${tempFile}:`,
81450
+ cleanupError
81451
+ );
80748
81452
  }
80749
81453
  }
80750
81454
  }
@@ -80756,6 +81460,57 @@ var init_github = __esm({
80756
81460
  }
80757
81461
  return allArtifacts;
80758
81462
  }
81463
+ /**
81464
+ * Validates that every configured workflow pattern matched at least one
81465
+ * workflow run, and every artifact pattern matched at least one artifact.
81466
+ *
81467
+ * This catches configuration issues early with clear error messages instead
81468
+ * of letting them surface as confusing per-target failures later.
81469
+ *
81470
+ * @param filters Normalized artifact filters from config
81471
+ * @param allRuns All workflow runs found for the commit
81472
+ * @param matchingArtifacts Artifacts that matched at least one pattern
81473
+ */
81474
+ validateAllPatternsMatched(filters, allRuns, matchingArtifacts) {
81475
+ const errors = [];
81476
+ for (const filter3 of filters) {
81477
+ if (filter3.workflow) {
81478
+ const hasMatchingRun = allRuns.some(
81479
+ (run) => filter3.workflow.test(run.name ?? "")
81480
+ );
81481
+ if (!hasMatchingRun) {
81482
+ const availableNames = allRuns.map((r4) => r4.name ?? "(unnamed)").join(", ");
81483
+ errors.push(
81484
+ `Workflow pattern ${filter3.workflow} did not match any workflow runs. Available workflows: ${availableNames || "(none)"}`
81485
+ );
81486
+ continue;
81487
+ }
81488
+ }
81489
+ const scopedArtifacts = filter3.workflow ? matchingArtifacts.filter((a4) => {
81490
+ const runName = allRuns.find((r4) => r4.id === a4.workflow_run?.id)?.name ?? "";
81491
+ return filter3.workflow.test(runName);
81492
+ }) : matchingArtifacts;
81493
+ for (const artifactPattern of filter3.artifacts) {
81494
+ const matched = scopedArtifacts.some((a4) => artifactPattern.test(a4.name));
81495
+ if (!matched) {
81496
+ const availableNames = scopedArtifacts.map((a4) => a4.name).join(", ");
81497
+ const workflowDesc = filter3.workflow ? ` (from workflow ${filter3.workflow})` : "";
81498
+ errors.push(
81499
+ `Artifact pattern ${artifactPattern}${workflowDesc} did not match any artifacts. Available artifact names: ${availableNames || "(none)"}`
81500
+ );
81501
+ }
81502
+ }
81503
+ }
81504
+ return errors;
81505
+ }
81506
+ /**
81507
+ * Formats the artifact provider config from .craft.yml as a YAML snippet
81508
+ * for inclusion in error messages. Returns an empty string if no artifact
81509
+ * config is defined.
81510
+ */
81511
+ formatArtifactConfigForError() {
81512
+ return formatArtifactConfigForError(this.config.artifacts);
81513
+ }
80759
81514
  /**
80760
81515
  * Fetches artifacts using the new workflow-based approach
80761
81516
  *
@@ -80764,6 +81519,7 @@ var init_github = __esm({
80764
81519
  * @returns Array of remote artifacts
80765
81520
  */
80766
81521
  async doListArtifactsWithFilters(revision, filters) {
81522
+ const configHint = this.formatArtifactConfigForError();
80767
81523
  for (let tries = 0; tries < MAX_TRIES; tries++) {
80768
81524
  this.logger.info(
80769
81525
  `Fetching GitHub artifacts for revision ${revision} using artifact filters (attempt ${tries + 1} of ${MAX_TRIES})`
@@ -80779,17 +81535,18 @@ var init_github = __esm({
80779
81535
  continue;
80780
81536
  }
80781
81537
  throw new Error(
80782
- `No workflow runs found for revision "${revision}" (tries: ${MAX_TRIES})`
81538
+ `No workflow runs found for revision "${revision}" after ${MAX_TRIES} attempts.
81539
+
81540
+ Check that:
81541
+ 1. Your CI workflow has completed successfully for this commit
81542
+ 2. The workflow names in .craft.yml match your actual GitHub Actions workflow names` + configHint
80783
81543
  );
80784
81544
  }
80785
81545
  const filteredRuns = this.filterWorkflowRuns(allRuns, filters);
80786
81546
  this.logger.debug(
80787
81547
  `${filteredRuns.length} of ${allRuns.length} workflow runs match filters`
80788
81548
  );
80789
- const matchingArtifacts = await this.getArtifactsFromWorkflowRuns(
80790
- filteredRuns,
80791
- filters
80792
- );
81549
+ const { matching: matchingArtifacts, allNames: allArtifactNames } = await this.getArtifactsFromWorkflowRuns(filteredRuns, filters);
80793
81550
  if (matchingArtifacts.length === 0) {
80794
81551
  this.logger.debug(`No matching artifacts found`);
80795
81552
  if (tries + 1 < MAX_TRIES) {
@@ -80799,8 +81556,36 @@ var init_github = __esm({
80799
81556
  await sleep(ARTIFACTS_POLLING_INTERVAL);
80800
81557
  continue;
80801
81558
  }
81559
+ const availableNames = allArtifactNames.length > 0 ? allArtifactNames.join(", ") : "(none)";
80802
81560
  throw new Error(
80803
- `No artifacts matching filters found for revision "${revision}" (tries: ${MAX_TRIES})`
81561
+ `No artifacts matching your configured patterns were found for revision "${revision}" after ${MAX_TRIES} attempts.
81562
+
81563
+ Found ${filteredRuns.length} workflow run(s), but none of their artifacts matched.
81564
+ Available artifact names from matching runs: ${availableNames}
81565
+
81566
+ Check that:
81567
+ 1. Your CI workflow is uploading artifacts with the expected names
81568
+ 2. The artifact names in .craft.yml match what your CI actually produces` + configHint
81569
+ );
81570
+ }
81571
+ const validationErrors = this.validateAllPatternsMatched(
81572
+ filters,
81573
+ allRuns,
81574
+ matchingArtifacts
81575
+ );
81576
+ if (validationErrors.length > 0) {
81577
+ if (tries + 1 < MAX_TRIES) {
81578
+ this.logger.info(
81579
+ `Not all patterns matched yet (${validationErrors.length} unmatched). Waiting ${ARTIFACTS_POLLING_INTERVAL / MILLISECONDS} seconds before retrying...`
81580
+ );
81581
+ await sleep(ARTIFACTS_POLLING_INTERVAL);
81582
+ continue;
81583
+ }
81584
+ throw new Error(
81585
+ `Not all configured artifact patterns were satisfied:
81586
+ - ${validationErrors.join("\n - ")}
81587
+
81588
+ Check that your workflow names and artifact names in .craft.yml match what your CI actually produces.` + configHint
80804
81589
  );
80805
81590
  }
80806
81591
  this.logger.debug(
@@ -96096,7 +96881,7 @@ var require_duplexify = __commonJS({
96096
96881
  });
96097
96882
 
96098
96883
  // node_modules/.pnpm/@google-cloud+storage@7.18.0/node_modules/@google-cloud/storage/build/esm/src/nodejs-common/util.js
96099
- var import_projectify, import_google_auth_library, import_retry_request, import_stream2, import_teeny_request, import_duplexify, import_package_json_helper2, packageJson, GCCL_GCS_CMD_KEY, requestDefaults, AUTO_RETRY_DEFAULT, MAX_RETRY_DEFAULT, ApiError, PartialFailureError, Util, ProgressStream, util4;
96884
+ var import_projectify, import_google_auth_library, import_retry_request, import_stream2, import_teeny_request, import_duplexify, import_package_json_helper2, packageJson, GCCL_GCS_CMD_KEY, requestDefaults, AUTO_RETRY_DEFAULT, MAX_RETRY_DEFAULT, ApiError, PartialFailureError, Util, ProgressStream, util5;
96100
96885
  var init_util4 = __esm({
96101
96886
  "node_modules/.pnpm/@google-cloud+storage@7.18.0/node_modules/@google-cloud/storage/build/esm/src/nodejs-common/util.js"() {
96102
96887
  init_import_meta_url();
@@ -96207,11 +96992,11 @@ var init_util4 = __esm({
96207
96992
  * @param {function} callback - The callback function.
96208
96993
  */
96209
96994
  handleResp(err, resp, body, callback) {
96210
- callback = callback || util4.noop;
96995
+ callback = callback || util5.noop;
96211
96996
  const parsedResp = {
96212
96997
  err: err || null,
96213
- ...resp && util4.parseHttpRespMessage(resp),
96214
- ...body && util4.parseHttpRespBody(body)
96998
+ ...resp && util5.parseHttpRespMessage(resp),
96999
+ ...body && util5.parseHttpRespBody(body)
96215
97000
  };
96216
97001
  if (!parsedResp.err && resp && typeof parsedResp.body === "object") {
96217
97002
  parsedResp.resp.body = parsedResp.body;
@@ -96285,7 +97070,7 @@ var init_util4 = __esm({
96285
97070
  */
96286
97071
  makeWritableStream(dup, options, onComplete) {
96287
97072
  var _a4;
96288
- onComplete = onComplete || util4.noop;
97073
+ onComplete = onComplete || util5.noop;
96289
97074
  const writeStream = new ProgressStream();
96290
97075
  writeStream.on("progress", (evt) => dup.emit("progress", evt));
96291
97076
  dup.setWritable(writeStream);
@@ -96322,10 +97107,10 @@ var init_util4 = __esm({
96322
97107
  dup.destroy(err);
96323
97108
  return;
96324
97109
  }
96325
- requestDefaults.headers = util4._getDefaultHeaders(reqOpts[GCCL_GCS_CMD_KEY]);
97110
+ requestDefaults.headers = util5._getDefaultHeaders(reqOpts[GCCL_GCS_CMD_KEY]);
96326
97111
  const request3 = import_teeny_request.teenyRequest.defaults(requestDefaults);
96327
97112
  request3(authenticatedReqOpts, (err2, resp, body) => {
96328
- util4.handleResp(err2, resp, body, (err3, data2) => {
97113
+ util5.handleResp(err2, resp, body, (err3, data2) => {
96329
97114
  if (err3) {
96330
97115
  dup.destroy(err3);
96331
97116
  return;
@@ -96420,13 +97205,13 @@ var init_util4 = __esm({
96420
97205
  }
96421
97206
  if (!err || autoAuthFailed) {
96422
97207
  try {
96423
- authenticatedReqOpts = util4.decorateRequest(authenticatedReqOpts, projectId);
97208
+ authenticatedReqOpts = util5.decorateRequest(authenticatedReqOpts, projectId);
96424
97209
  err = null;
96425
97210
  } catch (e4) {
96426
97211
  if (e4 instanceof import_projectify.MissingProjectIdError) {
96427
97212
  try {
96428
97213
  await setProjectId();
96429
- authenticatedReqOpts = util4.decorateRequest(authenticatedReqOpts, projectId);
97214
+ authenticatedReqOpts = util5.decorateRequest(authenticatedReqOpts, projectId);
96430
97215
  err = null;
96431
97216
  } catch (e5) {
96432
97217
  err = err || e5;
@@ -96448,7 +97233,7 @@ var init_util4 = __esm({
96448
97233
  if (options && options.onAuthenticated) {
96449
97234
  options.onAuthenticated(null, authenticatedReqOpts);
96450
97235
  } else {
96451
- activeRequest_ = util4.makeRequest(authenticatedReqOpts, reqConfig, (apiResponseError, ...params) => {
97236
+ activeRequest_ = util5.makeRequest(authenticatedReqOpts, reqConfig, (apiResponseError, ...params) => {
96452
97237
  if (apiResponseError && apiResponseError.code === 401 && authLibraryError) {
96453
97238
  apiResponseError = authLibraryError;
96454
97239
  }
@@ -96542,11 +97327,11 @@ var init_util4 = __esm({
96542
97327
  noResponseRetries: autoRetryValue !== false ? maxRetryValue : 0,
96543
97328
  shouldRetryFn(httpRespMessage) {
96544
97329
  var _a5, _b3;
96545
- const err = util4.parseHttpRespMessage(httpRespMessage).err;
97330
+ const err = util5.parseHttpRespMessage(httpRespMessage).err;
96546
97331
  if ((_a5 = config3.retryOptions) === null || _a5 === void 0 ? void 0 : _a5.retryableErrorFn) {
96547
97332
  return err && ((_b3 = config3.retryOptions) === null || _b3 === void 0 ? void 0 : _b3.retryableErrorFn(err));
96548
97333
  }
96549
- return err && util4.shouldRetryRequest(err);
97334
+ return err && util5.shouldRetryRequest(err);
96550
97335
  },
96551
97336
  maxRetryDelay: (_c5 = config3.retryOptions) === null || _c5 === void 0 ? void 0 : _c5.maxRetryDelay,
96552
97337
  retryDelayMultiplier: (_d = config3.retryOptions) === null || _d === void 0 ? void 0 : _d.retryDelayMultiplier,
@@ -96562,7 +97347,7 @@ var init_util4 = __esm({
96562
97347
  options,
96563
97348
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
96564
97349
  (err, response, body) => {
96565
- util4.handleResp(err, response, body, callback);
97350
+ util5.handleResp(err, response, body, callback);
96566
97351
  }
96567
97352
  );
96568
97353
  }
@@ -96665,7 +97450,7 @@ var init_util4 = __esm({
96665
97450
  callback();
96666
97451
  }
96667
97452
  };
96668
- util4 = new Util();
97453
+ util5 = new Util();
96669
97454
  }
96670
97455
  });
96671
97456
 
@@ -96708,7 +97493,7 @@ var init_service = __esm({
96708
97493
  this.universeDomain = options.universeDomain || import_google_auth_library2.DEFAULT_UNIVERSE;
96709
97494
  this.customEndpoint = config3.customEndpoint || false;
96710
97495
  this.useAuthWithCustomEndpoint = config3.useAuthWithCustomEndpoint;
96711
- this.makeAuthenticatedRequest = util4.makeAuthenticatedRequestFactory({
97496
+ this.makeAuthenticatedRequest = util5.makeAuthenticatedRequestFactory({
96712
97497
  ...config3,
96713
97498
  projectIdRequired: this.projectIdRequired,
96714
97499
  projectId: this.projectId,
@@ -97010,7 +97795,7 @@ var init_service_object = __esm({
97010
97795
  }
97011
97796
  delete(optionsOrCallback, cb) {
97012
97797
  var _a4;
97013
- const [options, callback] = util4.maybeOptionsOrCallback(optionsOrCallback, cb);
97798
+ const [options, callback] = util5.maybeOptionsOrCallback(optionsOrCallback, cb);
97014
97799
  const ignoreNotFound = options.ignoreNotFound;
97015
97800
  delete options.ignoreNotFound;
97016
97801
  const methodConfig = typeof this.methods.delete === "object" && this.methods.delete || {};
@@ -97033,7 +97818,7 @@ var init_service_object = __esm({
97033
97818
  });
97034
97819
  }
97035
97820
  exists(optionsOrCallback, cb) {
97036
- const [options, callback] = util4.maybeOptionsOrCallback(optionsOrCallback, cb);
97821
+ const [options, callback] = util5.maybeOptionsOrCallback(optionsOrCallback, cb);
97037
97822
  this.get(options, (err) => {
97038
97823
  if (err) {
97039
97824
  if (err.code === 404) {
@@ -97048,7 +97833,7 @@ var init_service_object = __esm({
97048
97833
  }
97049
97834
  get(optionsOrCallback, cb) {
97050
97835
  const self2 = this;
97051
- const [opts, callback] = util4.maybeOptionsOrCallback(optionsOrCallback, cb);
97836
+ const [opts, callback] = util5.maybeOptionsOrCallback(optionsOrCallback, cb);
97052
97837
  const options = Object.assign({}, opts);
97053
97838
  const autoCreate = options.autoCreate && typeof this.create === "function";
97054
97839
  delete options.autoCreate;
@@ -97082,7 +97867,7 @@ var init_service_object = __esm({
97082
97867
  }
97083
97868
  getMetadata(optionsOrCallback, cb) {
97084
97869
  var _a4;
97085
- const [options, callback] = util4.maybeOptionsOrCallback(optionsOrCallback, cb);
97870
+ const [options, callback] = util5.maybeOptionsOrCallback(optionsOrCallback, cb);
97086
97871
  const methodConfig = typeof this.methods.getMetadata === "object" && this.methods.getMetadata || {};
97087
97872
  const reqOpts = {
97088
97873
  uri: "",
@@ -97106,7 +97891,7 @@ var init_service_object = __esm({
97106
97891
  }
97107
97892
  setMetadata(metadata, optionsOrCallback, cb) {
97108
97893
  var _a4, _b2;
97109
- const [options, callback] = util4.maybeOptionsOrCallback(optionsOrCallback, cb);
97894
+ const [options, callback] = util5.maybeOptionsOrCallback(optionsOrCallback, cb);
97110
97895
  const methodConfig = typeof this.methods.setMetadata === "object" && this.methods.setMetadata || {};
97111
97896
  const reqOpts = {
97112
97897
  method: "PATCH",
@@ -101286,7 +102071,7 @@ var init_file = __esm({
101286
102071
  } else if (optionsOrCallback) {
101287
102072
  options = { ...optionsOrCallback };
101288
102073
  }
101289
- callback = callback || util4.noop;
102074
+ callback = callback || util5.noop;
101290
102075
  let destBucket;
101291
102076
  let destName;
101292
102077
  let newFile;
@@ -101578,7 +102363,7 @@ var init_file = __esm({
101578
102363
  throughStream.destroy(err);
101579
102364
  }).on("response", (res) => {
101580
102365
  throughStream.emit("response", res);
101581
- util4.handleResp(null, res, null, onResponse);
102366
+ util5.handleResp(null, res, null, onResponse);
101582
102367
  }).resume();
101583
102368
  };
101584
102369
  throughStream.on("reading", makeRequest);
@@ -102840,7 +103625,7 @@ var init_file = __esm({
102840
103625
  Object.assign(acc, currentHeaders.headers);
102841
103626
  return acc;
102842
103627
  }, {});
102843
- util4.makeRequest({
103628
+ util5.makeRequest({
102844
103629
  method: "GET",
102845
103630
  uri: `${this.storage.apiEndpoint}/${this.bucket.name}/${encodeURIComponent(this.name)}`,
102846
103631
  headers
@@ -102971,7 +103756,7 @@ var init_file = __esm({
102971
103756
  * Another example:
102972
103757
  */
102973
103758
  makePublic(callback) {
102974
- callback = callback || util4.noop;
103759
+ callback = callback || util5.noop;
102975
103760
  this.acl.add({
102976
103761
  entity: "allUsers",
102977
103762
  role: "READER"
@@ -103106,7 +103891,7 @@ var init_file = __esm({
103106
103891
  } else if (optionsOrCallback) {
103107
103892
  options = { ...optionsOrCallback };
103108
103893
  }
103109
- callback = callback || util4.noop;
103894
+ callback = callback || util5.noop;
103110
103895
  let destName;
103111
103896
  let newFile;
103112
103897
  if (typeof destination === "string") {
@@ -103282,7 +104067,7 @@ var init_file = __esm({
103282
104067
  move(destination, optionsOrCallback, callback) {
103283
104068
  const options = typeof optionsOrCallback === "object" ? optionsOrCallback : {};
103284
104069
  callback = typeof optionsOrCallback === "function" ? optionsOrCallback : callback;
103285
- callback = callback || util4.noop;
104070
+ callback = callback || util5.noop;
103286
104071
  this.copy(destination, options, (err, destinationFile, copyApiResponse) => {
103287
104072
  if (err) {
103288
104073
  err.message = "file#copy failed with an error - " + err.message;
@@ -103390,7 +104175,7 @@ var init_file = __esm({
103390
104175
  rename(destinationFile, optionsOrCallback, callback) {
103391
104176
  const options = typeof optionsOrCallback === "object" ? optionsOrCallback : {};
103392
104177
  callback = typeof optionsOrCallback === "function" ? optionsOrCallback : callback;
103393
- callback = callback || util4.noop;
104178
+ callback = callback || util5.noop;
103394
104179
  this.move(destinationFile, options, callback);
103395
104180
  }
103396
104181
  /**
@@ -103787,7 +104572,7 @@ var init_file = __esm({
103787
104572
  reqOpts.qs.predefinedAcl = "publicRead";
103788
104573
  }
103789
104574
  Object.assign(reqOpts.qs, this.instancePreconditionOpts, options.preconditionOpts);
103790
- util4.makeWritableStream(dup, {
104575
+ util5.makeWritableStream(dup, {
103791
104576
  makeAuthenticatedRequest: (reqOpts2) => {
103792
104577
  this.request(reqOpts2, (err, body, resp) => {
103793
104578
  if (err) {
@@ -105117,7 +105902,7 @@ var init_bucket = __esm({
105117
105902
  };
105118
105903
  sources = sources.map(convertToFile);
105119
105904
  const destinationFile = convertToFile(destination);
105120
- callback = callback || util4.noop;
105905
+ callback = callback || util5.noop;
105121
105906
  if (!destinationFile.metadata.contentType) {
105122
105907
  const destinationContentType = import_mime2.default.getType(destinationFile.name) || void 0;
105123
105908
  if (destinationContentType) {
@@ -105392,7 +106177,7 @@ var init_bucket = __esm({
105392
106177
  options = optionsOrCallback;
105393
106178
  }
105394
106179
  const topicIsObject = topic !== null && typeof topic === "object";
105395
- if (topicIsObject && util4.isCustomType(topic, "pubsub/topic")) {
106180
+ if (topicIsObject && util5.isCustomType(topic, "pubsub/topic")) {
105396
106181
  topic = topic.name;
105397
106182
  }
105398
106183
  if (typeof topic !== "string") {
@@ -106862,7 +107647,7 @@ var init_bucket = __esm({
106862
107647
  setLabels(labels, optionsOrCallback, callback) {
106863
107648
  const options = typeof optionsOrCallback === "object" ? optionsOrCallback : {};
106864
107649
  callback = typeof optionsOrCallback === "function" ? optionsOrCallback : callback;
106865
- callback = callback || util4.noop;
107650
+ callback = callback || util5.noop;
106866
107651
  this.setMetadata({ labels }, options, callback);
106867
107652
  }
106868
107653
  setMetadata(metadata, optionsOrCallback, cb) {
@@ -107537,7 +108322,7 @@ var init_channel = __esm({
107537
108322
  * ```
107538
108323
  */
107539
108324
  stop(callback) {
107540
- callback = callback || util4.noop;
108325
+ callback = callback || util5.noop;
107541
108326
  this.request({
107542
108327
  method: "POST",
107543
108328
  uri: "/stop",
@@ -110374,473 +111159,6 @@ var init_src = __esm({
110374
111159
  }
110375
111160
  });
110376
111161
 
110377
- // node_modules/.pnpm/mustache@3.0.1/node_modules/mustache/mustache.js
110378
- var require_mustache = __commonJS({
110379
- "node_modules/.pnpm/mustache@3.0.1/node_modules/mustache/mustache.js"(exports2) {
110380
- init_import_meta_url();
110381
- (function defineMustache(global2, factory) {
110382
- if (typeof exports2 === "object" && exports2 && typeof exports2.nodeName !== "string") {
110383
- factory(exports2);
110384
- } else if (typeof define === "function" && define.amd) {
110385
- define(["exports"], factory);
110386
- } else {
110387
- global2.Mustache = {};
110388
- factory(global2.Mustache);
110389
- }
110390
- })(exports2, function mustacheFactory(mustache2) {
110391
- var objectToString3 = Object.prototype.toString;
110392
- var isArray = Array.isArray || function isArrayPolyfill(object) {
110393
- return objectToString3.call(object) === "[object Array]";
110394
- };
110395
- function isFunction2(object) {
110396
- return typeof object === "function";
110397
- }
110398
- function typeStr(obj) {
110399
- return isArray(obj) ? "array" : typeof obj;
110400
- }
110401
- function escapeRegExp(string) {
110402
- return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
110403
- }
110404
- function hasProperty(obj, propName2) {
110405
- return obj != null && typeof obj === "object" && propName2 in obj;
110406
- }
110407
- function primitiveHasOwnProperty(primitive, propName2) {
110408
- return primitive != null && typeof primitive !== "object" && primitive.hasOwnProperty && primitive.hasOwnProperty(propName2);
110409
- }
110410
- var regExpTest = RegExp.prototype.test;
110411
- function testRegExp(re3, string) {
110412
- return regExpTest.call(re3, string);
110413
- }
110414
- var nonSpaceRe = /\S/;
110415
- function isWhitespace2(string) {
110416
- return !testRegExp(nonSpaceRe, string);
110417
- }
110418
- var entityMap = {
110419
- "&": "&amp;",
110420
- "<": "&lt;",
110421
- ">": "&gt;",
110422
- '"': "&quot;",
110423
- "'": "&#39;",
110424
- "/": "&#x2F;",
110425
- "`": "&#x60;",
110426
- "=": "&#x3D;"
110427
- };
110428
- function escapeHtml(string) {
110429
- return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s4) {
110430
- return entityMap[s4];
110431
- });
110432
- }
110433
- var whiteRe = /\s*/;
110434
- var spaceRe = /\s+/;
110435
- var equalsRe = /\s*=/;
110436
- var curlyRe = /\s*\}/;
110437
- var tagRe = /#|\^|\/|>|\{|&|=|!/;
110438
- function parseTemplate(template, tags) {
110439
- if (!template)
110440
- return [];
110441
- var sections = [];
110442
- var tokens = [];
110443
- var spaces = [];
110444
- var hasTag = false;
110445
- var nonSpace = false;
110446
- function stripSpace() {
110447
- if (hasTag && !nonSpace) {
110448
- while (spaces.length)
110449
- delete tokens[spaces.pop()];
110450
- } else {
110451
- spaces = [];
110452
- }
110453
- hasTag = false;
110454
- nonSpace = false;
110455
- }
110456
- var openingTagRe, closingTagRe, closingCurlyRe;
110457
- function compileTags(tagsToCompile) {
110458
- if (typeof tagsToCompile === "string")
110459
- tagsToCompile = tagsToCompile.split(spaceRe, 2);
110460
- if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)
110461
- throw new Error("Invalid tags: " + tagsToCompile);
110462
- openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + "\\s*");
110463
- closingTagRe = new RegExp("\\s*" + escapeRegExp(tagsToCompile[1]));
110464
- closingCurlyRe = new RegExp("\\s*" + escapeRegExp("}" + tagsToCompile[1]));
110465
- }
110466
- compileTags(tags || mustache2.tags);
110467
- var scanner = new Scanner(template);
110468
- var start, type2, value, chr, token, openSection;
110469
- while (!scanner.eos()) {
110470
- start = scanner.pos;
110471
- value = scanner.scanUntil(openingTagRe);
110472
- if (value) {
110473
- for (var i4 = 0, valueLength = value.length; i4 < valueLength; ++i4) {
110474
- chr = value.charAt(i4);
110475
- if (isWhitespace2(chr)) {
110476
- spaces.push(tokens.length);
110477
- } else {
110478
- nonSpace = true;
110479
- }
110480
- tokens.push(["text", chr, start, start + 1]);
110481
- start += 1;
110482
- if (chr === "\n")
110483
- stripSpace();
110484
- }
110485
- }
110486
- if (!scanner.scan(openingTagRe))
110487
- break;
110488
- hasTag = true;
110489
- type2 = scanner.scan(tagRe) || "name";
110490
- scanner.scan(whiteRe);
110491
- if (type2 === "=") {
110492
- value = scanner.scanUntil(equalsRe);
110493
- scanner.scan(equalsRe);
110494
- scanner.scanUntil(closingTagRe);
110495
- } else if (type2 === "{") {
110496
- value = scanner.scanUntil(closingCurlyRe);
110497
- scanner.scan(curlyRe);
110498
- scanner.scanUntil(closingTagRe);
110499
- type2 = "&";
110500
- } else {
110501
- value = scanner.scanUntil(closingTagRe);
110502
- }
110503
- if (!scanner.scan(closingTagRe))
110504
- throw new Error("Unclosed tag at " + scanner.pos);
110505
- token = [type2, value, start, scanner.pos];
110506
- tokens.push(token);
110507
- if (type2 === "#" || type2 === "^") {
110508
- sections.push(token);
110509
- } else if (type2 === "/") {
110510
- openSection = sections.pop();
110511
- if (!openSection)
110512
- throw new Error('Unopened section "' + value + '" at ' + start);
110513
- if (openSection[1] !== value)
110514
- throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
110515
- } else if (type2 === "name" || type2 === "{" || type2 === "&") {
110516
- nonSpace = true;
110517
- } else if (type2 === "=") {
110518
- compileTags(value);
110519
- }
110520
- }
110521
- openSection = sections.pop();
110522
- if (openSection)
110523
- throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
110524
- return nestTokens(squashTokens(tokens));
110525
- }
110526
- function squashTokens(tokens) {
110527
- var squashedTokens = [];
110528
- var token, lastToken;
110529
- for (var i4 = 0, numTokens = tokens.length; i4 < numTokens; ++i4) {
110530
- token = tokens[i4];
110531
- if (token) {
110532
- if (token[0] === "text" && lastToken && lastToken[0] === "text") {
110533
- lastToken[1] += token[1];
110534
- lastToken[3] = token[3];
110535
- } else {
110536
- squashedTokens.push(token);
110537
- lastToken = token;
110538
- }
110539
- }
110540
- }
110541
- return squashedTokens;
110542
- }
110543
- function nestTokens(tokens) {
110544
- var nestedTokens = [];
110545
- var collector = nestedTokens;
110546
- var sections = [];
110547
- var token, section;
110548
- for (var i4 = 0, numTokens = tokens.length; i4 < numTokens; ++i4) {
110549
- token = tokens[i4];
110550
- switch (token[0]) {
110551
- case "#":
110552
- case "^":
110553
- collector.push(token);
110554
- sections.push(token);
110555
- collector = token[4] = [];
110556
- break;
110557
- case "/":
110558
- section = sections.pop();
110559
- section[5] = token[2];
110560
- collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
110561
- break;
110562
- default:
110563
- collector.push(token);
110564
- }
110565
- }
110566
- return nestedTokens;
110567
- }
110568
- function Scanner(string) {
110569
- this.string = string;
110570
- this.tail = string;
110571
- this.pos = 0;
110572
- }
110573
- Scanner.prototype.eos = function eos() {
110574
- return this.tail === "";
110575
- };
110576
- Scanner.prototype.scan = function scan2(re3) {
110577
- var match3 = this.tail.match(re3);
110578
- if (!match3 || match3.index !== 0)
110579
- return "";
110580
- var string = match3[0];
110581
- this.tail = this.tail.substring(string.length);
110582
- this.pos += string.length;
110583
- return string;
110584
- };
110585
- Scanner.prototype.scanUntil = function scanUntil(re3) {
110586
- var index = this.tail.search(re3), match3;
110587
- switch (index) {
110588
- case -1:
110589
- match3 = this.tail;
110590
- this.tail = "";
110591
- break;
110592
- case 0:
110593
- match3 = "";
110594
- break;
110595
- default:
110596
- match3 = this.tail.substring(0, index);
110597
- this.tail = this.tail.substring(index);
110598
- }
110599
- this.pos += match3.length;
110600
- return match3;
110601
- };
110602
- function Context2(view, parentContext) {
110603
- this.view = view;
110604
- this.cache = { ".": this.view };
110605
- this.parent = parentContext;
110606
- }
110607
- Context2.prototype.push = function push2(view) {
110608
- return new Context2(view, this);
110609
- };
110610
- Context2.prototype.lookup = function lookup(name2) {
110611
- var cache6 = this.cache;
110612
- var value;
110613
- if (cache6.hasOwnProperty(name2)) {
110614
- value = cache6[name2];
110615
- } else {
110616
- var context2 = this, intermediateValue, names, index, lookupHit = false;
110617
- while (context2) {
110618
- if (name2.indexOf(".") > 0) {
110619
- intermediateValue = context2.view;
110620
- names = name2.split(".");
110621
- index = 0;
110622
- while (intermediateValue != null && index < names.length) {
110623
- if (index === names.length - 1)
110624
- lookupHit = hasProperty(intermediateValue, names[index]) || primitiveHasOwnProperty(intermediateValue, names[index]);
110625
- intermediateValue = intermediateValue[names[index++]];
110626
- }
110627
- } else {
110628
- intermediateValue = context2.view[name2];
110629
- lookupHit = hasProperty(context2.view, name2);
110630
- }
110631
- if (lookupHit) {
110632
- value = intermediateValue;
110633
- break;
110634
- }
110635
- context2 = context2.parent;
110636
- }
110637
- cache6[name2] = value;
110638
- }
110639
- if (isFunction2(value))
110640
- value = value.call(this.view);
110641
- return value;
110642
- };
110643
- function Writer() {
110644
- this.cache = {};
110645
- }
110646
- Writer.prototype.clearCache = function clearCache() {
110647
- this.cache = {};
110648
- };
110649
- Writer.prototype.parse = function parse8(template, tags) {
110650
- var cache6 = this.cache;
110651
- var cacheKey = template + ":" + (tags || mustache2.tags).join(":");
110652
- var tokens = cache6[cacheKey];
110653
- if (tokens == null)
110654
- tokens = cache6[cacheKey] = parseTemplate(template, tags);
110655
- return tokens;
110656
- };
110657
- Writer.prototype.render = function render2(template, view, partials, tags) {
110658
- var tokens = this.parse(template, tags);
110659
- var context2 = view instanceof Context2 ? view : new Context2(view);
110660
- return this.renderTokens(tokens, context2, partials, template, tags);
110661
- };
110662
- Writer.prototype.renderTokens = function renderTokens(tokens, context2, partials, originalTemplate, tags) {
110663
- var buffer = "";
110664
- var token, symbol, value;
110665
- for (var i4 = 0, numTokens = tokens.length; i4 < numTokens; ++i4) {
110666
- value = void 0;
110667
- token = tokens[i4];
110668
- symbol = token[0];
110669
- if (symbol === "#") value = this.renderSection(token, context2, partials, originalTemplate);
110670
- else if (symbol === "^") value = this.renderInverted(token, context2, partials, originalTemplate);
110671
- else if (symbol === ">") value = this.renderPartial(token, context2, partials, tags);
110672
- else if (symbol === "&") value = this.unescapedValue(token, context2);
110673
- else if (symbol === "name") value = this.escapedValue(token, context2);
110674
- else if (symbol === "text") value = this.rawValue(token);
110675
- if (value !== void 0)
110676
- buffer += value;
110677
- }
110678
- return buffer;
110679
- };
110680
- Writer.prototype.renderSection = function renderSection(token, context2, partials, originalTemplate) {
110681
- var self2 = this;
110682
- var buffer = "";
110683
- var value = context2.lookup(token[1]);
110684
- function subRender(template) {
110685
- return self2.render(template, context2, partials);
110686
- }
110687
- if (!value) return;
110688
- if (isArray(value)) {
110689
- for (var j5 = 0, valueLength = value.length; j5 < valueLength; ++j5) {
110690
- buffer += this.renderTokens(token[4], context2.push(value[j5]), partials, originalTemplate);
110691
- }
110692
- } else if (typeof value === "object" || typeof value === "string" || typeof value === "number") {
110693
- buffer += this.renderTokens(token[4], context2.push(value), partials, originalTemplate);
110694
- } else if (isFunction2(value)) {
110695
- if (typeof originalTemplate !== "string")
110696
- throw new Error("Cannot use higher-order sections without the original template");
110697
- value = value.call(context2.view, originalTemplate.slice(token[3], token[5]), subRender);
110698
- if (value != null)
110699
- buffer += value;
110700
- } else {
110701
- buffer += this.renderTokens(token[4], context2, partials, originalTemplate);
110702
- }
110703
- return buffer;
110704
- };
110705
- Writer.prototype.renderInverted = function renderInverted(token, context2, partials, originalTemplate) {
110706
- var value = context2.lookup(token[1]);
110707
- if (!value || isArray(value) && value.length === 0)
110708
- return this.renderTokens(token[4], context2, partials, originalTemplate);
110709
- };
110710
- Writer.prototype.renderPartial = function renderPartial(token, context2, partials, tags) {
110711
- if (!partials) return;
110712
- var value = isFunction2(partials) ? partials(token[1]) : partials[token[1]];
110713
- if (value != null)
110714
- return this.renderTokens(this.parse(value, tags), context2, partials, value);
110715
- };
110716
- Writer.prototype.unescapedValue = function unescapedValue(token, context2) {
110717
- var value = context2.lookup(token[1]);
110718
- if (value != null)
110719
- return value;
110720
- };
110721
- Writer.prototype.escapedValue = function escapedValue(token, context2) {
110722
- var value = context2.lookup(token[1]);
110723
- if (value != null)
110724
- return mustache2.escape(value);
110725
- };
110726
- Writer.prototype.rawValue = function rawValue(token) {
110727
- return token[1];
110728
- };
110729
- mustache2.name = "mustache.js";
110730
- mustache2.version = "3.0.1";
110731
- mustache2.tags = ["{{", "}}"];
110732
- var defaultWriter = new Writer();
110733
- mustache2.clearCache = function clearCache() {
110734
- return defaultWriter.clearCache();
110735
- };
110736
- mustache2.parse = function parse8(template, tags) {
110737
- return defaultWriter.parse(template, tags);
110738
- };
110739
- mustache2.render = function render2(template, view, partials, tags) {
110740
- if (typeof template !== "string") {
110741
- throw new TypeError('Invalid template! Template should be a "string" but "' + typeStr(template) + '" was given as the first argument for mustache#render(template, view, partials)');
110742
- }
110743
- return defaultWriter.render(template, view, partials, tags);
110744
- };
110745
- mustache2.to_html = function to_html(template, view, partials, send) {
110746
- var result = mustache2.render(template, view, partials);
110747
- if (isFunction2(send)) {
110748
- send(result);
110749
- } else {
110750
- return result;
110751
- }
110752
- };
110753
- mustache2.escape = escapeHtml;
110754
- mustache2.Scanner = Scanner;
110755
- mustache2.Context = Context2;
110756
- mustache2.Writer = Writer;
110757
- return mustache2;
110758
- });
110759
- }
110760
- });
110761
-
110762
- // src/utils/strings.ts
110763
- function sanitizeObject(obj) {
110764
- if (typeof obj !== "object" || obj === null) {
110765
- throw new Error(`Cannot normalize value: ${obj}`);
110766
- }
110767
- const result = {};
110768
- for (const key of Object.keys(obj)) {
110769
- const value = obj[key];
110770
- const valueType = typeof value;
110771
- let newValue;
110772
- if (["boolean", "string", "number", "undefined"].indexOf(valueType) > -1) {
110773
- newValue = value;
110774
- } else if (value === null) {
110775
- newValue = void 0;
110776
- } else if (valueType === "object") {
110777
- newValue = sanitizeObject(value);
110778
- } else {
110779
- continue;
110780
- }
110781
- result[key] = newValue;
110782
- const normalizedKey = key.replace(/\./g, "__");
110783
- if (key !== normalizedKey) {
110784
- result[normalizedKey] = newValue;
110785
- }
110786
- }
110787
- return result;
110788
- }
110789
- function renderTemplateSafe(template, context2) {
110790
- const sanitizedContext = sanitizeObject(context2);
110791
- const unknownVars = [];
110792
- mustache.Context.prototype.lookup = function(name2) {
110793
- const value = originalLookup.call(this, name2);
110794
- if (value === void 0) {
110795
- unknownVars.push(name2);
110796
- }
110797
- return value;
110798
- };
110799
- try {
110800
- const result = mustache.render(template, sanitizedContext);
110801
- if (unknownVars.length > 0) {
110802
- const availableVars = Object.keys(sanitizedContext).join(", ");
110803
- const unknownList = [...new Set(unknownVars)].join(", ");
110804
- throw new ConfigurationError(
110805
- `Unknown template variable(s): ${unknownList}. Available variables: ${availableVars}`
110806
- );
110807
- }
110808
- return result;
110809
- } finally {
110810
- mustache.Context.prototype.lookup = originalLookup;
110811
- }
110812
- }
110813
- function formatSize(size) {
110814
- if (size < 1024) {
110815
- return `${size} B`;
110816
- }
110817
- const kilobytes = size / 1024;
110818
- if (kilobytes < 1024) {
110819
- return `${kilobytes.toFixed(1)} kB`;
110820
- } else {
110821
- const megabytes = kilobytes / 1024;
110822
- return `${megabytes.toFixed(2)} MB`;
110823
- }
110824
- }
110825
- function formatJson(obj) {
110826
- const result = JSON.stringify(obj, null, 4);
110827
- if (obj instanceof Error && result === "{}") {
110828
- return util5.format(obj);
110829
- } else {
110830
- return result;
110831
- }
110832
- }
110833
- var mustache, util5, originalLookup;
110834
- var init_strings = __esm({
110835
- "src/utils/strings.ts"() {
110836
- init_import_meta_url();
110837
- mustache = __toESM(require_mustache());
110838
- util5 = __toESM(require("util"));
110839
- init_errors2();
110840
- originalLookup = mustache.Context.prototype.lookup;
110841
- }
110842
- });
110843
-
110844
111162
  // src/utils/gcsApi.ts
110845
111163
  function getGCSCredsFromEnv(jsonVar, filepathVar) {
110846
111164
  const gcsCredsJson = process.env[jsonVar.name];
@@ -162346,7 +162664,7 @@ var require_package6 = __commonJS({
162346
162664
  "package.json"(exports2, module2) {
162347
162665
  module2.exports = {
162348
162666
  name: "@sentry/craft",
162349
- version: "2.21.2",
162667
+ version: "2.21.4",
162350
162668
  description: "The universal sentry workflow CLI",
162351
162669
  main: "dist/craft",
162352
162670
  repository: "https://github.com/getsentry/craft",
@@ -162442,6 +162760,7 @@ var require_package6 = __commonJS({
162442
162760
  pnpm: "10.27.0"
162443
162761
  },
162444
162762
  dependencies: {
162763
+ "fastest-levenshtein": "^1.0.16",
162445
162764
  ignore: "^7.0.5",
162446
162765
  marked: "^17.0.1",
162447
162766
  "p-limit": "^6.2.0",
@@ -162515,7 +162834,7 @@ function getPackage() {
162515
162834
  }
162516
162835
  function getPackageVersion() {
162517
162836
  const { version: version2 } = getPackage();
162518
- const buildInfo = "63d1636bead951f6e034ed62c2a3610965fef010";
162837
+ const buildInfo = "906009a1b771956757e521555b561379307eb667";
162519
162838
  return buildInfo ? `${version2} (${buildInfo})` : version2;
162520
162839
  }
162521
162840
  function semVerToString(s4) {
@@ -168549,7 +168868,7 @@ init_import_meta_url();
168549
168868
 
168550
168869
  // node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/build/lib/utils/levenshtein.js
168551
168870
  init_import_meta_url();
168552
- function levenshtein(a4, b5) {
168871
+ function levenshtein2(a4, b5) {
168553
168872
  if (a4.length === 0)
168554
168873
  return b5.length;
168555
168874
  if (b5.length === 0)
@@ -168819,7 +169138,7 @@ ${customMsgs.join("\n")}` : "";
168819
169138
  let recommended = null;
168820
169139
  let bestDistance = Infinity;
168821
169140
  for (let i4 = 0, candidate; (candidate = potentialCommands[i4]) !== void 0; i4++) {
168822
- const d5 = levenshtein(cmd, candidate);
169141
+ const d5 = levenshtein2(cmd, candidate);
168823
169142
  if (d5 <= threshold && d5 < bestDistance) {
168824
169143
  bestDistance = d5;
168825
169144
  recommended = candidate;
@@ -170727,7 +171046,20 @@ async function printRevisionSummary(artifactProvider, revision) {
170727
171046
  ${table.toString()}
170728
171047
  `);
170729
171048
  } else {
170730
- logger.warn("No artifacts found for the revision.");
171049
+ const config3 = getConfiguration();
171050
+ const artifactsConfig = config3?.artifactProvider?.config?.artifacts;
171051
+ if (artifactsConfig) {
171052
+ const configSnippet = formatArtifactConfigForError(artifactsConfig);
171053
+ reportError(
171054
+ `No artifacts found for the revision, but your .craft.yml defines artifact patterns.
171055
+
171056
+ Check that:
171057
+ 1. Your CI workflow has completed successfully for this commit
171058
+ 2. The artifact names in your CI match your .craft.yml configuration` + configSnippet
171059
+ );
171060
+ } else {
171061
+ logger.warn("No artifacts found for the revision.");
171062
+ }
170731
171063
  }
170732
171064
  }
170733
171065
  async function getTargetList(targetConfigList, artifactProvider) {
@@ -170868,6 +171200,7 @@ async function publishMain(argv) {
170868
171200
  );
170869
171201
  }
170870
171202
  }
171203
+ const branchPrefix = config3.releaseBranchPrefix || DEFAULT_RELEASE_BRANCH_NAME;
170871
171204
  const rev = argv.rev;
170872
171205
  let checkoutTarget;
170873
171206
  let branchName;
@@ -170875,13 +171208,47 @@ async function publishMain(argv) {
170875
171208
  logger.debug(`Trying to get branch name for provided revision: "${rev}"`);
170876
171209
  branchName = (await git.raw("name-rev", "--name-only", "--no-undefined", rev)).trim();
170877
171210
  checkoutTarget = branchName || rev;
171211
+ logger.debug("Checking out revision", checkoutTarget);
171212
+ await git.checkout(checkoutTarget);
170878
171213
  } else {
170879
- const branchPrefix = config3.releaseBranchPrefix || DEFAULT_RELEASE_BRANCH_NAME;
170880
171214
  branchName = `${branchPrefix}/${newVersion}`;
170881
171215
  checkoutTarget = branchName;
171216
+ try {
171217
+ logger.debug("Checking out release branch", branchName);
171218
+ await git.checkout(checkoutTarget);
171219
+ } catch (err) {
171220
+ const { exactMatches, fuzzyMatches } = await findReleaseBranches(
171221
+ git,
171222
+ branchPrefix
171223
+ );
171224
+ let message = `Could not find the release branch "${branchName}".
171225
+
171226
+ Have you run \`craft prepare\` for version ${newVersion}?
171227
+
171228
+ Release branch prefix: "${branchPrefix}"` + (config3.releaseBranchPrefix ? "" : " (default)");
171229
+ if (exactMatches.length > 0) {
171230
+ message += `
171231
+
171232
+ Existing release branches:
171233
+ ` + exactMatches.map((b5) => ` - ${b5}`).join("\n");
171234
+ }
171235
+ if (fuzzyMatches.length > 0) {
171236
+ message += `
171237
+
171238
+ Did you mean one of these? (similar branch prefix):
171239
+ ` + fuzzyMatches.map((b5) => ` - ${b5}`).join("\n");
171240
+ }
171241
+ if (exactMatches.length === 0 && fuzzyMatches.length === 0) {
171242
+ message += `
171243
+
171244
+ No release branches found on the remote.`;
171245
+ }
171246
+ message += `
171247
+
171248
+ Original error: ${err instanceof Error ? err.message : String(err)}`;
171249
+ throw new ConfigurationError(message);
171250
+ }
170882
171251
  }
170883
- logger.debug("Checking out release branch", branchName);
170884
- await git.checkout(checkoutTarget);
170885
171252
  const revision = await git.revparse("HEAD");
170886
171253
  logger.debug("Revision to publish: ", revision);
170887
171254
  const statusProvider = await getStatusProviderFromConfig();
@@ -171678,6 +172045,7 @@ __export(changelog_exports, {
171678
172045
  });
171679
172046
  init_import_meta_url();
171680
172047
  init_logger2();
172048
+ init_config2();
171681
172049
  init_git();
171682
172050
  init_changelog();
171683
172051
  init_errors2();
@@ -171705,14 +172073,24 @@ async function changelogMain(argv) {
171705
172073
  if (since) {
171706
172074
  logger.debug(`Using latest tag as base revision: ${since}`);
171707
172075
  } else {
171708
- logger.debug("No tags found, generating changelog from beginning of history");
172076
+ logger.debug(
172077
+ "No tags found, generating changelog from beginning of history"
172078
+ );
171709
172079
  }
171710
172080
  }
171711
172081
  const result = argv.pr ? await generateChangelogWithHighlight(git, since, argv.pr) : await generateChangesetFromGit(git, since);
171712
172082
  if (argv.format === "json") {
172083
+ let versioningPolicy = "auto";
172084
+ try {
172085
+ if (findConfigFile()) {
172086
+ versioningPolicy = getVersioningPolicy();
172087
+ }
172088
+ } catch {
172089
+ }
171713
172090
  const output = {
171714
172091
  changelog: result.changelog || "",
171715
172092
  bumpType: result.bumpType,
172093
+ versioningPolicy,
171716
172094
  totalCommits: result.totalCommits,
171717
172095
  matchedCommitsWithSemver: result.matchedCommitsWithSemver,
171718
172096
  prSkipped: result.prSkipped ?? false
@@ -171805,6 +172183,12 @@ tmp/lib/tmp.js:
171805
172183
  * MIT Licensed
171806
172184
  *)
171807
172185
 
172186
+ mustache/mustache.js:
172187
+ (*!
172188
+ * mustache.js - Logic-less {{mustache}} templates with JavaScript
172189
+ * http://github.com/janl/mustache.js
172190
+ *)
172191
+
171808
172192
  safe-buffer/index.js:
171809
172193
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
171810
172194
 
@@ -171997,12 +172381,6 @@ teeny-request/build/src/index.js:
171997
172381
  * that a callback is omitted.
171998
172382
  *)
171999
172383
 
172000
- mustache/mustache.js:
172001
- (*!
172002
- * mustache.js - Logic-less {{mustache}} templates with JavaScript
172003
- * http://github.com/janl/mustache.js
172004
- *)
172005
-
172006
172384
  yargs-parser/build/lib/string-utils.js:
172007
172385
  yargs-parser/build/lib/tokenize-arg-string.js:
172008
172386
  yargs-parser/build/lib/yargs-parser-types.js: