vibedgames 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +17 -8
  2. package/assets/align-framing.py +242 -0
  3. package/assets/render-model.py +406 -0
  4. package/assets/tilemap-editor.html +630 -0
  5. package/dist/THIRD_PARTY_NOTICES.txt +59 -7
  6. package/dist/chunk-2KVQJKIZ.js +6495 -0
  7. package/dist/chunk-2SBBKY5C.js +16993 -0
  8. package/dist/chunk-2ZKS7V72.js +170 -0
  9. package/dist/{chunk-RAUJA3OY.js → chunk-3HGBIUM5.js} +21 -18
  10. package/dist/chunk-3UGGMFJJ.js +22 -0
  11. package/dist/{chunk-I6O4HIDY.js → chunk-42K3BJJH.js} +163 -131
  12. package/dist/chunk-43P4U7CB.js +104 -0
  13. package/dist/chunk-4FJXCS3K.js +741 -0
  14. package/dist/{chunk-NC5XCGYU.js → chunk-4UU622RK.js} +6 -5
  15. package/dist/{chunk-2QBYTIMH.js → chunk-5535KDYI.js} +1 -1
  16. package/dist/chunk-5YPLKGY3.js +87 -0
  17. package/dist/chunk-6KXXZXSO.js +475 -0
  18. package/dist/chunk-7RPLQWR2.js +91 -0
  19. package/dist/{chunk-C2IRIRAA.js → chunk-A556KALN.js} +15 -14
  20. package/dist/{chunk-N3XAUFKH.js → chunk-ABTUEIRC.js} +576 -301
  21. package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
  22. package/dist/{chunk-QGEITHUP.js → chunk-BN3Q7UEC.js} +22 -19
  23. package/dist/chunk-BZOMEG3X.js +412 -0
  24. package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
  25. package/dist/{chunk-PQDBCZRT.js → chunk-CTY2WZQK.js} +204 -158
  26. package/dist/{chunk-CU7UY5YJ.js → chunk-D2RF35HJ.js} +1 -1
  27. package/dist/chunk-DB7WVFS7.js +80 -0
  28. package/dist/chunk-DOOQUFPG.js +73 -0
  29. package/dist/chunk-E3FJUPLT.js +177 -0
  30. package/dist/chunk-E7NDOZ27.js +428 -0
  31. package/dist/chunk-F42QKWBB.js +39 -0
  32. package/dist/chunk-FXXVXDTW.js +168 -0
  33. package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
  34. package/dist/{chunk-CAKBGDCY.js → chunk-GKDUYJ7R.js} +5 -0
  35. package/dist/chunk-GLEW7VJQ.js +45 -0
  36. package/dist/{chunk-MGIASPED.js → chunk-H2C4QUTG.js} +9 -8
  37. package/dist/{chunk-HCMTSR7E.js → chunk-HRKVAXNN.js} +21 -17
  38. package/dist/{chunk-TLRL6FHW.js → chunk-HSMG6U7J.js} +10 -9
  39. package/dist/chunk-HX5Q63UA.js +48 -0
  40. package/dist/chunk-HYOXGNWS.js +53 -0
  41. package/dist/chunk-I5LELJSK.js +22 -0
  42. package/dist/{chunk-6FZPPUQH.js → chunk-JN4WZCR7.js} +5 -4
  43. package/dist/{chunk-QJZ72MSY.js → chunk-K36EOII3.js} +7 -6
  44. package/dist/chunk-KAGVI3CE.js +62 -0
  45. package/dist/chunk-KJK5CB6E.js +58 -0
  46. package/dist/chunk-KLFBAFXD.js +25 -0
  47. package/dist/{chunk-7MKUR7Y3.js → chunk-LONQWRTR.js} +112 -81
  48. package/dist/chunk-LORGE2NB.js +2484 -0
  49. package/dist/{chunk-HKA5LBYW.js → chunk-MEAO33XW.js} +22 -19
  50. package/dist/{chunk-PM5UOIKR.js → chunk-MR5KIFI7.js} +22 -21
  51. package/dist/{chunk-GCX5KQ6A.js → chunk-N2UHAQXC.js} +18 -11
  52. package/dist/chunk-NCX6LYNJ.js +117 -0
  53. package/dist/chunk-OGX4DKIS.js +215 -0
  54. package/dist/chunk-OPUCUUID.js +41 -0
  55. package/dist/chunk-Q2QC6KAZ.js +132 -0
  56. package/dist/{chunk-2GL2WJZX.js → chunk-Q3XQPNF6.js} +14 -14
  57. package/dist/{chunk-RYFO3ZPO.js → chunk-Q5NZNXJE.js} +15 -12
  58. package/dist/{chunk-JT2AU24K.js → chunk-QARXJGI5.js} +1 -1
  59. package/dist/chunk-QLCVLCPM.js +126 -0
  60. package/dist/chunk-R2WVORGD.js +91 -0
  61. package/dist/chunk-RKS7SI5L.js +64 -0
  62. package/dist/{chunk-4BGCA3W7.js → chunk-RPJR3S5S.js} +32 -18
  63. package/dist/chunk-RPSUFZAG.js +3307 -0
  64. package/dist/chunk-RRI23NK2.js +40 -0
  65. package/dist/chunk-S7HYWITX.js +57 -0
  66. package/dist/chunk-SBXCK2I2.js +48 -0
  67. package/dist/chunk-SUSX3QIA.js +62 -0
  68. package/dist/{chunk-PHEDW6C7.js → chunk-SXYQL4GK.js} +16 -7
  69. package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
  70. package/dist/chunk-TXOE5UY5.js +72 -0
  71. package/dist/chunk-U6DTE5IX.js +124 -0
  72. package/dist/chunk-UPHB5HWO.js +115 -0
  73. package/dist/chunk-UQ7VO6B3.js +91 -0
  74. package/dist/chunk-VB4WLJR2.js +47 -0
  75. package/dist/{chunk-FNYBZNW2.js → chunk-VIEKOGKG.js} +21 -3
  76. package/dist/{chunk-QIVCBUYD.js → chunk-VZEJ2ZHE.js} +18 -18
  77. package/dist/chunk-X75Y7LUW.js +126 -0
  78. package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
  79. package/dist/chunk-ZHLPE6LI.js +71 -0
  80. package/dist/index.js +48 -34
  81. package/package.json +32 -16
  82. package/templates/none/src/main.ts +4 -0
  83. package/templates/none/vite.config.ts +0 -2
  84. package/templates/phaser/src/main.ts +0 -1
  85. package/templates/phaser/src/scenes/game-scene.ts +10 -8
  86. package/templates/phaser/vite.config.ts +0 -2
  87. package/templates/react-r3f/src/app.tsx +3 -1
  88. package/templates/react-r3f/src/main.tsx +1 -0
  89. package/templates/react-r3f/vite.config.ts +0 -2
  90. package/templates/threejs/src/main.ts +10 -1
  91. package/templates/threejs/vite.config.ts +0 -2
  92. package/LICENSE +0 -21
  93. package/dist/chunk-AYJQVZXY.js +0 -39
  94. package/dist/chunk-J6PKNPI2.js +0 -26
  95. package/dist/chunk-MJQSHP3Y.js +0 -415
  96. package/dist/chunk-MYFLYNPO.js +0 -68
@@ -7,19 +7,20 @@ var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  Qn,
9
9
  So
10
- } from "./chunk-VFFOT7KD.js";
10
+ } from "./chunk-G66HRVDW.js";
11
11
  import {
12
12
  isJsonObject,
13
- isJsonString
14
- } from "./chunk-J6PKNPI2.js";
13
+ isJsonString,
14
+ parseJson
15
+ } from "./chunk-RPSUFZAG.js";
15
16
  import {
16
17
  __commonJS,
17
18
  __toESM
18
- } from "./chunk-CAKBGDCY.js";
19
+ } from "./chunk-GKDUYJ7R.js";
19
20
 
20
- // ../../node_modules/.pnpm/ignore@7.0.12/node_modules/ignore/index.js
21
+ // ../../node_modules/.pnpm/ignore@7.0.16/node_modules/ignore/index.js
21
22
  var require_ignore = __commonJS({
22
- "../../node_modules/.pnpm/ignore@7.0.12/node_modules/ignore/index.js"(exports, module) {
23
+ "../../node_modules/.pnpm/ignore@7.0.16/node_modules/ignore/index.js"(exports, module) {
23
24
  function makeArray(subject) {
24
25
  return Array.isArray(subject) ? subject : [subject];
25
26
  }
@@ -29,7 +30,7 @@ var require_ignore = __commonJS({
29
30
  var ESCAPE = "\\";
30
31
  var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
31
32
  var BOM = "\uFEFF";
32
- var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
33
+ var REGEX_ANCHORED_GLOBSTAR = /^\/\*{2,}$/;
33
34
  var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
34
35
  var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
35
36
  var REGEX_SPLITALL_CRLF = /\r?\n/g;
@@ -47,10 +48,6 @@ var require_ignore = __commonJS({
47
48
  return value;
48
49
  };
49
50
  var RETURN_FALSE = () => false;
50
- var cleanRangeBackSlash = (slashes) => {
51
- const { length } = slashes;
52
- return slashes.slice(0, length - length % 2);
53
- };
54
51
  var POSIX_CLASSES = {
55
52
  alnum: "0-9A-Za-z",
56
53
  alpha: "A-Za-z",
@@ -94,13 +91,9 @@ var require_ignore = __commonJS({
94
91
  return null;
95
92
  }
96
93
  if (char === ESCAPE) {
97
- const escaped = pattern[index + 1];
98
- if (escaped === UNDEFINED) {
99
- return null;
100
- }
94
+ const escaped = pattern[++index];
101
95
  body += escapeMember(escaped);
102
96
  prev = escaped;
103
- index++;
104
97
  } else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
105
98
  index++;
106
99
  let to = pattern[index];
@@ -121,11 +114,11 @@ var require_ignore = __commonJS({
121
114
  return null;
122
115
  }
123
116
  if (end > nameStart && pattern[end - 1] === ":") {
124
- const expanded = POSIX_CLASSES[pattern.slice(nameStart, end - 1)];
125
- if (expanded === UNDEFINED) {
117
+ const name = pattern.slice(nameStart, end - 1);
118
+ if (!Object.prototype.hasOwnProperty.call(POSIX_CLASSES, name)) {
126
119
  return null;
127
120
  }
128
- body += expanded;
121
+ body += POSIX_CLASSES[name];
129
122
  prev = EMPTY;
130
123
  index = end;
131
124
  } else {
@@ -154,6 +147,7 @@ var require_ignore = __commonJS({
154
147
  );
155
148
  var TRAILING_WILDCARD = "\uE000";
156
149
  var TRAILING_DOUBLESTAR = "\uE001";
150
+ var isReserved = (char) => char === PLACEHOLDER || char === TRAILING_WILDCARD || char === TRAILING_DOUBLESTAR;
157
151
  var extractBrackets = (pattern) => {
158
152
  const sources = [];
159
153
  const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
@@ -164,18 +158,18 @@ var require_ignore = __commonJS({
164
158
  const char = pattern[index];
165
159
  if (char === ESCAPE) {
166
160
  const escaped = pattern[index + 1];
167
- if (escaped === UNDEFINED || escaped === SLASH && index + 2 === length) {
161
+ if (escaped === SLASH && index + 2 === length) {
168
162
  out += hold(NEVER_MATCH);
169
- } else if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
163
+ } else if (escaped === "*" || escaped === "[" || escaped === SPACE) {
170
164
  out += pattern.slice(index, index + 2);
171
165
  } else {
172
166
  out += hold(
173
- REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : escaped
167
+ REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : isReserved(escaped) ? `[${escaped}]` : escaped
174
168
  );
175
169
  }
176
170
  index += 2;
177
- } else if (char === PLACEHOLDER) {
178
- out += hold(`[${PLACEHOLDER}]`);
171
+ } else if (isReserved(char)) {
172
+ out += hold(`[${char}]`);
179
173
  index++;
180
174
  } else if (char === "[") {
181
175
  const scanned = scanBracket(pattern, index);
@@ -198,6 +192,7 @@ var require_ignore = __commonJS({
198
192
  };
199
193
  var DIRECT = null;
200
194
  var REGEX_INNER_SLASH = /\/(?!$)/;
195
+ var WILDCARD = "[^\\/]*";
201
196
  var REPLACERS = [
202
197
  // Replace (\ ) with ' '
203
198
  // Only a space: an escaped tab or other whitespace is already a literal by
@@ -214,6 +209,20 @@ var require_ignore = __commonJS({
214
209
  (_, run, space) => space ? run.slice(0, run.length - run.length % 2) + SPACE : run,
215
210
  ESCAPE + SPACE
216
211
  ],
212
+ // git's wildmatch() reads a run of two or more asterisks as one globstar
213
+ // whenever the run fills a path segment: it starts the pattern or follows
214
+ // a `/`, and it ends the pattern or comes before a `/`. A run of two is
215
+ // already `**`; a longer one is folded into `**` here, so the steps
216
+ // below only ever have to know `**`.
217
+ // `***/foo` -> `**/foo`, `a/***/b` -> `a/**/b`, `a/***` -> `a/**`
218
+ // git also takes a run beside a literal prefix (`a***/b`) or beside an
219
+ // escaped slash (`***\/b`) as a globstar, and this does not; the README
220
+ // lists both, under "A run of asterisks".
221
+ [
222
+ /(^|\/)\*{3,}(?=\/|$)/g,
223
+ (_, start) => `${start}**`,
224
+ "*"
225
+ ],
217
226
  // Escape metacharacters
218
227
  // which is written down by users but means special for regular expressions.
219
228
  // > There are 12 characters with special meanings:
@@ -264,7 +273,7 @@ var require_ignore = __commonJS({
264
273
  // Notice that the '*'s have been replaced as '\\*'
265
274
  /^\^*(?:\\\*\\\*\\\/)+/,
266
275
  // '**/foo' <-> 'foo'
267
- () => "^(?:.*\\/)?",
276
+ () => "(?:^|\\/)",
268
277
  "*"
269
278
  ],
270
279
  // starting
@@ -274,7 +283,7 @@ var require_ignore = __commonJS({
274
283
  // If starts with '**', adding a '^' to the regular expression also works
275
284
  DIRECT,
276
285
  (source, pattern) => {
277
- if (!source || source[0] === "^") {
286
+ if (!source || source[0] === "^" || source[0] === "(") {
278
287
  return source;
279
288
  }
280
289
  const anchor = !REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^";
@@ -298,31 +307,29 @@ var require_ignore = __commonJS({
298
307
  // 'abc.*/' -> go
299
308
  // 'abc.*' -> skip this rule,
300
309
  // coz trailing single wildcard will be handed by [trailing wildcard]
301
- /(^|[^\\]+)(\\\*)+(?=.+)/g,
310
+ /(^|[^\\])(?:\\\*)+(?!$)/g,
302
311
  // '*.js' matches '.js'
303
312
  // '*.js' doesn't match 'abc'
304
- (_, p1, p2) => {
305
- const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
306
- return p1 + unescaped;
307
- },
313
+ // 1. An asterisk "*" matches anything except a slash.
314
+ // 2. Other consecutive asterisks are considered regular asterisks
315
+ // and collapse into one non-slash wildcard run.
316
+ (_, p1) => p1 + WILDCARD,
308
317
  "*"
309
318
  ],
310
319
  // trailing wildcard, held apart from a literal star
311
320
  [
312
321
  // The step above leaves a trailing `*` alone, so a single `\*` is all that
313
- // can be left at the end here. Whether it is a wildcard or a literal
314
- // turns on the backslashes the user put in front of it: the escaper has
315
- // since doubled every one, so what stands here is those `2N` doubled
316
- // backslashes and then the star's own escape. An even number of the
317
- // original `N` leaves the star unescaped -- a wildcard -- and an odd
318
- // number escapes it -- a literal. This runs while the two are still
319
- // distinct, before the unescape steps below collapse the literal onto
320
- // the very `\*` a wildcard leaves behind.
322
+ // can be left at the end here, and what stands in front of it says which
323
+ // kind it is. A wildcard arrives as the escaper wrote it, `\*` with
324
+ // nothing before it; a literal arrives as the user's own escape, which
325
+ // the escaper doubled, and then the star's own -- `\\` and then `\*`.
326
+ // There is no third case: every backslash still reaching the chain is
327
+ // one `\*`, `\[` or `\ ` carries itself, and each is followed by its
328
+ // own character, so a longer run can never form. This runs while the
329
+ // two are still distinct, before the unescape steps below collapse the
330
+ // literal onto the very `\*` a wildcard leaves behind.
321
331
  /(^|[^\\])((?:\\\\)*)\\\*$/,
322
- (match, p1, p2) => (
323
- // `p2` holds the doubled user backslashes; half of them is `N`.
324
- p2.length / 2 % 2 === 0 ? p1 + p2 + TRAILING_WILDCARD : match
325
- ),
332
+ (match, p1, p2) => p2 === EMPTY ? p1 + TRAILING_WILDCARD : match,
326
333
  "*"
327
334
  ],
328
335
  [
@@ -343,10 +350,11 @@ var require_ignore = __commonJS({
343
350
  // Every real bracket expression -- POSIX classes included -- has already
344
351
  // been held aside by `extractBrackets`, so the only `[` left in the
345
352
  // pattern is an escaped, literal one.
346
- // `\` is escaped by step 3
347
- /\\\[([^\]/]*?)(\\*)($|\])/g,
348
- // '\\[bar]' -> '\\\\[bar\\]'
349
- (match, range, endEscape, close) => `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`,
353
+ // A backslash could only stand at the end of the range if it quoted the
354
+ // `]`, and `\]` is held aside long before this.
355
+ /\\\[([^\]/]*?)($|\])/g,
356
+ // '\\[bar]' -> '\\\\[bar]'
357
+ (match, range, close) => `\\[${range}${close}`,
350
358
  "["
351
359
  ],
352
360
  // ending
@@ -382,8 +390,7 @@ var require_ignore = __commonJS({
382
390
  return `${prefix}(?=$|\\/$)`;
383
391
  };
384
392
  var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
385
- var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
386
- var WILDCARD = "[^\\/]*";
393
+ var replaceTrailingDoublestar = () => "[\\s\\S]";
387
394
  var separatorAfter = (run, at) => {
388
395
  let separator = EMPTY;
389
396
  for (let index = at + 1; index < run.length && !run[index].wildcard; index++) {
@@ -476,6 +483,9 @@ var require_ignore = __commonJS({
476
483
  return out;
477
484
  };
478
485
  var makeRegexPrefix = (pattern) => {
486
+ if (REGEX_ANCHORED_GLOBSTAR.test(pattern)) {
487
+ pattern = "**";
488
+ }
479
489
  const { source, sources } = extractBrackets(pattern);
480
490
  const replaced = REPLACERS.reduce(
481
491
  // A pass whose matcher finds nothing hands back the very string it was
@@ -504,7 +514,7 @@ var require_ignore = __commonJS({
504
514
  }
505
515
  const head = prefix.slice(0, -1);
506
516
  const last = prefix[prefix.length - 1];
507
- return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
517
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? head : NEVER_MATCH;
508
518
  };
509
519
  var matchesBasename = (body) => {
510
520
  const index = body.indexOf(SLASH);
@@ -532,8 +542,8 @@ var require_ignore = __commonJS({
532
542
  return cut < 0 ? EMPTY : path2.slice(0, cut + 1);
533
543
  };
534
544
  var isString = (subject) => typeof subject === "string";
535
- var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
536
- var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
545
+ var checkPattern = (pattern) => pattern && isString(pattern);
546
+ var splitPattern = (pattern) => (pattern[pattern.length - 1] === "\r" ? pattern.slice(0, -1) : pattern).split(REGEX_SPLITALL_CRLF).filter(Boolean);
537
547
  var IgnoreRule = class {
538
548
  constructor(pattern, mark, body, ignoreCase, negative, prefix) {
539
549
  this.pattern = pattern;
@@ -573,30 +583,40 @@ var require_ignore = __commonJS({
573
583
  return define(this, key, regex);
574
584
  }
575
585
  };
576
- var isLineEnd = (char) => char === "\r" || char === "\n";
577
- var trimEnd = (body) => {
578
- let end = body.length;
579
- while (end && isLineEnd(body[end - 1])) {
580
- end--;
586
+ var hasTrailingBackslash = (str) => {
587
+ let count = 0;
588
+ while (str[str.length - count - 1] === ESCAPE) {
589
+ count++;
581
590
  }
582
- const lineEnd = end;
583
- while (end && body[end - 1] === SPACE) {
584
- end--;
591
+ return count % 2 === 1;
592
+ };
593
+ var trimEnd = (body, stripLineEnd) => {
594
+ let lineEnd = body.length;
595
+ let end;
596
+ for (; ; ) {
597
+ if (stripLineEnd && body[lineEnd - 1] === "\r") {
598
+ lineEnd--;
599
+ }
600
+ end = lineEnd;
601
+ while (body[end - 1] === SPACE) {
602
+ end--;
603
+ }
604
+ if (!stripLineEnd || body[end - 1] !== "\n") {
605
+ break;
606
+ }
607
+ lineEnd = end - 1;
585
608
  }
586
609
  if (end === lineEnd) {
587
- return body.slice(0, end);
610
+ return body.slice(0, lineEnd);
588
611
  }
589
612
  let backslashes = 0;
590
- while (backslashes < end && body[end - backslashes - 1] === ESCAPE) {
613
+ while (body[end - backslashes - 1] === ESCAPE) {
591
614
  backslashes++;
592
615
  }
593
616
  return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
594
617
  };
595
- var createRule = ({
596
- pattern,
597
- mark
598
- }, ignoreCase) => {
599
- let body = pattern[0] === BOM ? pattern.slice(1) : pattern;
618
+ var createRule = (pattern, mark, ignoreCase, stripLineEnd, stripBOM) => {
619
+ let body = stripBOM && pattern[0] === BOM ? pattern.slice(1) : pattern;
600
620
  if (body[0] === "#") {
601
621
  return;
602
622
  }
@@ -606,10 +626,10 @@ var require_ignore = __commonJS({
606
626
  body = body.slice(1);
607
627
  }
608
628
  const last = body[body.length - 1];
609
- if (last === SPACE || last === "\r" || last === "\n") {
610
- body = trimEnd(body);
629
+ if (last === SPACE || stripLineEnd && (last === "\r" || last === "\n")) {
630
+ body = trimEnd(body, stripLineEnd);
611
631
  }
612
- if (!body) {
632
+ if (!body || hasTrailingBackslash(body)) {
613
633
  return;
614
634
  }
615
635
  body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
@@ -629,19 +649,22 @@ var require_ignore = __commonJS({
629
649
  this._rules = [];
630
650
  this._basenameCount = 0;
631
651
  }
632
- _add(pattern) {
652
+ _add(pattern, index) {
633
653
  if (pattern && pattern[KEY_IGNORE]) {
634
654
  this._rules = this._rules.concat(pattern._rules._rules);
635
655
  this._basenameCount += pattern._rules._basenameCount;
636
656
  this._added = true;
637
657
  return;
638
658
  }
639
- if (isString(pattern)) {
640
- pattern = {
641
- pattern
642
- };
643
- }
644
- const rule = checkPattern(pattern.pattern) && createRule(pattern, this._ignoreCase);
659
+ const isStr = isString(pattern);
660
+ const raw = isStr ? pattern : pattern.pattern;
661
+ const rule = checkPattern(raw) && createRule(
662
+ raw,
663
+ isStr ? UNDEFINED : pattern.mark,
664
+ this._ignoreCase,
665
+ !this._split,
666
+ this._stripBOM && !index
667
+ );
645
668
  if (rule) {
646
669
  this._added = true;
647
670
  this._rules.push(rule);
@@ -653,8 +676,10 @@ var require_ignore = __commonJS({
653
676
  // @param {Array<string> | string | Ignore} pattern
654
677
  add(pattern) {
655
678
  this._added = false;
679
+ this._split = isString(pattern);
680
+ this._stripBOM = !this._split || pattern[0] === BOM;
656
681
  makeArray(
657
- isString(pattern) ? splitPattern(pattern) : pattern
682
+ this._split ? splitPattern(pattern) : pattern
658
683
  ).forEach(this._add, this);
659
684
  if (this._added) {
660
685
  this._literalRules = UNDEFINED;
@@ -691,39 +716,33 @@ var require_ignore = __commonJS({
691
716
  }
692
717
  // Test one single path without recursively checking parent directories
693
718
  //
694
- // - checkUnignored `boolean` whether should check if the path is unignored,
695
- // setting `checkUnignored` to `false` could reduce additional
696
- // path matching.
697
- // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
698
- // @returns {TestResult} true if a file is ignored
699
- test(path2, checkUnignored, mode) {
700
- let ignored = false;
701
- let unignored = false;
702
- let matchedRule;
719
+ // - mode `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
720
+ // @returns {TestResult}
721
+ test(path2, mode) {
703
722
  const rules = this._rules;
704
723
  const { length } = rules;
705
724
  const shortcut = this._basenameCount * 2 >= length;
706
725
  const basename = shortcut ? basenameOf(path2) : path2;
707
- for (let index = 0; index < length; index++) {
726
+ for (let index = length - 1; index >= 0; index--) {
708
727
  const rule = rules[index];
709
- const { negative } = rule;
710
- const skip = unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored;
711
- if (!skip && rule[mode].test(
728
+ if (rule[mode].test(
712
729
  shortcut && rule._basenameOnly ? basename : path2
713
730
  )) {
714
- ignored = !negative;
715
- unignored = negative;
716
- matchedRule = negative ? UNDEFINED : rule;
731
+ const { negative } = rule;
732
+ const ret = {
733
+ ignored: !negative,
734
+ unignored: negative
735
+ };
736
+ if (!negative) {
737
+ ret.rule = rule;
738
+ }
739
+ return ret;
717
740
  }
718
741
  }
719
- const ret = {
720
- ignored,
721
- unignored
742
+ return {
743
+ ignored: false,
744
+ unignored: false
722
745
  };
723
- if (matchedRule) {
724
- ret.rule = matchedRule;
725
- }
726
- return ret;
727
746
  }
728
747
  };
729
748
  var throwError = (message, Ctor) => {
@@ -770,6 +789,7 @@ var require_ignore = __commonJS({
770
789
  };
771
790
  checkPath.isNotRelative = isNotRelative;
772
791
  checkPath.convert = (p) => p;
792
+ var convertPath = (target) => isString(target) && checkPath.convert(target);
773
793
  var Ignore = class {
774
794
  constructor({
775
795
  ignorecase = true,
@@ -796,36 +816,39 @@ var require_ignore = __commonJS({
796
816
  return this.add(pattern);
797
817
  }
798
818
  // @returns {TestResult}
799
- _test(originalPath, cache, checkUnignored) {
800
- const path2 = originalPath && checkPath.convert(originalPath);
819
+ _test(originalPath, cache, path2) {
801
820
  checkPath(
802
821
  path2,
803
822
  originalPath,
804
823
  this._strictPathCheck ? throwError : RETURN_FALSE
805
824
  );
806
- return this._t(path2, cache, checkUnignored);
825
+ return path2 ? this._t(path2, cache) : {
826
+ ignored: false,
827
+ unignored: false
828
+ };
807
829
  }
808
- checkIgnore(path2) {
809
- if (path2.charCodeAt(path2.length - 1) !== SLASH_CODE) {
810
- return this.test(path2);
830
+ checkIgnore(target) {
831
+ const path2 = convertPath(target);
832
+ if (!path2 || path2.charCodeAt(path2.length - 1) !== SLASH_CODE) {
833
+ return this._test(target, this._testCache, path2);
811
834
  }
812
- const dir = this._t(path2, this._testCache, true);
835
+ const dir = this._t(path2, this._testCache);
813
836
  if (dir.ignored) {
814
837
  return dir;
815
838
  }
816
839
  const literal = this._rules.testLiteral(path2);
817
840
  return literal.ignored || literal.unignored ? literal : dir;
818
841
  }
819
- _t(path2, cache, checkUnignored) {
842
+ _t(path2, cache) {
820
843
  if (path2 in cache) {
821
844
  return cache[path2];
822
845
  }
823
846
  const parentPath = parentOf(path2);
824
- const parent = parentPath ? this._t(parentPath, cache, checkUnignored) : UNDEFINED;
825
- return cache[path2] = parent && parent.ignored ? parent : this._rules.test(path2, checkUnignored, MODE_IGNORE);
847
+ const parent = parentPath ? this._t(parentPath, cache) : UNDEFINED;
848
+ return cache[path2] = parent && parent.ignored ? parent : this._rules.test(path2, MODE_IGNORE);
826
849
  }
827
850
  ignores(path2) {
828
- return this._test(path2, this._ignoreCache, false).ignored;
851
+ return this._test(path2, this._ignoreCache, convertPath(path2)).ignored;
829
852
  }
830
853
  createFilter() {
831
854
  return (path2) => !this.ignores(path2);
@@ -835,11 +858,11 @@ var require_ignore = __commonJS({
835
858
  }
836
859
  // @returns {TestResult}
837
860
  test(path2) {
838
- return this._test(path2, this._testCache, true);
861
+ return this._test(path2, this._testCache, convertPath(path2));
839
862
  }
840
863
  };
841
864
  var factory = (options) => new Ignore(options);
842
- var isPathValid = (path2) => checkPath(path2 && checkPath.convert(path2), path2, RETURN_FALSE);
865
+ var isPathValid = (path2) => checkPath(convertPath(path2), path2, RETURN_FALSE);
843
866
  var setupWindows = () => {
844
867
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
845
868
  checkPath.convert = makePosix;
@@ -887,7 +910,7 @@ var HARD_EXCLUDES = [
887
910
  "coverage",
888
911
  ".DS_Store",
889
912
  "*.log",
890
- // secrets — never ship these
913
+ // WARNING: secrets below must never ship in an archive.
891
914
  ".env",
892
915
  ".env.*",
893
916
  "*.pem",
@@ -900,7 +923,6 @@ var HARD_EXCLUDES = [
900
923
  "id_ed25519",
901
924
  ".npmrc",
902
925
  ".git-credentials",
903
- // archives (avoid bundling our own output)
904
926
  "*.tgz",
905
927
  "*.tar.gz"
906
928
  ];
@@ -940,19 +962,22 @@ var collectFiles = (root, ignored) => {
940
962
  walk(root);
941
963
  return out.toSorted();
942
964
  };
965
+ var packageVersion = (manifest) => {
966
+ try {
967
+ const pkg = parseJson(readFileSync(manifest, "utf-8"));
968
+ const v = isJsonObject(pkg) ? pkg.version : void 0;
969
+ return isJsonString(v) ? v : null;
970
+ } catch {
971
+ return null;
972
+ }
973
+ };
943
974
  var installedVersion = (root, name) => {
944
975
  let dir = root;
945
976
  while (true) {
946
977
  const p = path.join(dir, "node_modules", name, "package.json");
947
- if (existsSync(p)) {
948
- try {
949
- const pkg = JSON.parse(readFileSync(p, "utf-8"));
950
- const v = isJsonObject(pkg) ? pkg.version : void 0;
951
- if (isJsonString(v)) {
952
- return v;
953
- }
954
- } catch {
955
- }
978
+ const v = existsSync(p) ? packageVersion(p) : null;
979
+ if (v !== null) {
980
+ return v;
956
981
  }
957
982
  const parent = path.dirname(dir);
958
983
  if (parent === dir) {
@@ -968,7 +993,7 @@ var resolveSpec = (root, name, spec) => {
968
993
  return range;
969
994
  }
970
995
  const v2 = installedVersion(root, name);
971
- if (!v2) {
996
+ if (v2 === null || v2 === "") {
972
997
  return null;
973
998
  }
974
999
  if (range === "~") {
@@ -980,13 +1005,13 @@ var resolveSpec = (root, name, spec) => {
980
1005
  return `^${v2}`;
981
1006
  }
982
1007
  const v = installedVersion(root, name);
983
- return v ? `^${v}` : null;
1008
+ return v !== null && v !== "" ? `^${v}` : null;
984
1009
  };
985
1010
  var DEP_FIELDS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
986
1011
  var rewriteWorkspaceProtocols = (root) => {
987
1012
  let pkg;
988
1013
  try {
989
- pkg = JSON.parse(readFileSync(path.join(root, "package.json"), "utf-8"));
1014
+ pkg = parseJson(readFileSync(path.join(root, "package.json"), "utf-8"));
990
1015
  } catch {
991
1016
  return null;
992
1017
  }
@@ -1007,7 +1032,7 @@ var rewriteWorkspaceProtocols = (root) => {
1007
1032
  continue;
1008
1033
  }
1009
1034
  const resolved = resolveSpec(root, name, spec);
1010
- if (resolved && resolved !== spec) {
1035
+ if (resolved !== null && resolved !== "" && resolved !== spec) {
1011
1036
  deps[name] = resolved;
1012
1037
  changed = true;
1013
1038
  }
@@ -1026,7 +1051,7 @@ var packSource = async (root, tmpDir) => {
1026
1051
  const rewritten = files.includes("package.json") ? rewriteWorkspaceProtocols(root) : null;
1027
1052
  let cwd = root;
1028
1053
  let stage = null;
1029
- if (rewritten) {
1054
+ if (rewritten !== null && rewritten !== "") {
1030
1055
  stage = mkdtempSync(path.join(tmpDir, "stage-"));
1031
1056
  for (const f of files) {
1032
1057
  const dest = path.join(stage, f);
@@ -1040,7 +1065,7 @@ var packSource = async (root, tmpDir) => {
1040
1065
  try {
1041
1066
  await Qn({ cwd, file: tarball, gzip: true, portable: true }, files);
1042
1067
  } finally {
1043
- if (stage) {
1068
+ if (stage !== null && stage !== "") {
1044
1069
  rmSync(stage, { force: true, recursive: true });
1045
1070
  }
1046
1071
  }
@@ -1052,6 +1077,12 @@ var packSource = async (root, tmpDir) => {
1052
1077
  sha256: createHash("sha256").update(buf).digest("hex")
1053
1078
  };
1054
1079
  };
1080
+ var packBuild = async (dir, files, tmpDir) => {
1081
+ mkdirSync(tmpDir, { recursive: true });
1082
+ const tarball = path.join(tmpDir, `vg-build-${process.pid}-${files.length}.tgz`);
1083
+ await Qn({ cwd: dir, file: tarball, gzip: true, portable: true }, files);
1084
+ return { bytes: statSync(tarball).size, path: tarball };
1085
+ };
1055
1086
  var extractSource = async (archivePath, destDir) => {
1056
1087
  mkdirSync(destDir, { recursive: true });
1057
1088
  await So({ cwd: destDir, file: archivePath });
@@ -1059,5 +1090,6 @@ var extractSource = async (archivePath, destDir) => {
1059
1090
 
1060
1091
  export {
1061
1092
  packSource,
1093
+ packBuild,
1062
1094
  extractSource
1063
1095
  };