vibedgames 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +3 -2
  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 +2 -2
  6. package/dist/{chunk-56OY4TEP.js → chunk-2SBBKY5C.js} +1361 -4493
  7. package/dist/{chunk-FC233UKH.js → chunk-2ZKS7V72.js} +16 -16
  8. package/dist/chunk-37LLKM73.js +124 -0
  9. package/dist/{chunk-BMTHAVMS.js → chunk-3HGBIUM5.js} +22 -19
  10. package/dist/chunk-3UGGMFJJ.js +22 -0
  11. package/dist/{chunk-3HUWAJQH.js → chunk-42K3BJJH.js} +93 -76
  12. package/dist/{chunk-ST5FC2W3.js → chunk-43P4U7CB.js} +20 -11
  13. package/dist/chunk-4RYTTD4D.js +53 -0
  14. package/dist/{chunk-WSRIF6K4.js → chunk-4UU622RK.js} +5 -4
  15. package/dist/chunk-52E6EKZV.js +72 -0
  16. package/dist/chunk-6IUFHPMV.js +62 -0
  17. package/dist/chunk-6KXXZXSO.js +475 -0
  18. package/dist/chunk-72KHWZMN.js +87 -0
  19. package/dist/{chunk-ZCYWDKYP.js → chunk-A556KALN.js} +14 -13
  20. package/dist/{chunk-UFR6G6BL.js → chunk-ABTUEIRC.js} +554 -254
  21. package/dist/chunk-ALPTHSUT.js +132 -0
  22. package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
  23. package/dist/chunk-BJAN3RMY.js +48 -0
  24. package/dist/{chunk-HNRVSBRK.js → chunk-BN3Q7UEC.js} +20 -17
  25. package/dist/chunk-BZOMEG3X.js +412 -0
  26. package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
  27. package/dist/{chunk-KZBZNTM4.js → chunk-CTY2WZQK.js} +9 -13
  28. package/dist/chunk-DH6WPL3X.js +47 -0
  29. package/dist/chunk-DPLFCKXP.js +80 -0
  30. package/dist/{chunk-K2U7L4RU.js → chunk-E3FJUPLT.js} +15 -21
  31. package/dist/chunk-E7NDOZ27.js +428 -0
  32. package/dist/{chunk-TBQ5BU3Q.js → chunk-F42QKWBB.js} +18 -18
  33. package/dist/chunk-F4J6XCHT.js +73 -0
  34. package/dist/chunk-FB3UDZAV.js +168 -0
  35. package/dist/chunk-FJXPMA63.js +48 -0
  36. package/dist/chunk-FNJL6Z5C.js +71 -0
  37. package/dist/chunk-G63MXDX2.js +45 -0
  38. package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
  39. package/dist/{chunk-AXTLPJ2F.js → chunk-H2C4QUTG.js} +8 -7
  40. package/dist/{chunk-H3IPLBXQ.js → chunk-HRKVAXNN.js} +17 -14
  41. package/dist/chunk-HSCTPDEU.js +126 -0
  42. package/dist/{chunk-UXCWSWWX.js → chunk-HSMG6U7J.js} +8 -7
  43. package/dist/chunk-I5LELJSK.js +22 -0
  44. package/dist/{chunk-7CXMMC5S.js → chunk-JN4WZCR7.js} +5 -4
  45. package/dist/{chunk-7QZSDU52.js → chunk-K36EOII3.js} +5 -4
  46. package/dist/chunk-KLFBAFXD.js +25 -0
  47. package/dist/{chunk-355VG7EO.js → chunk-LONQWRTR.js} +107 -77
  48. package/dist/{chunk-Z5TFZQ5U.js → chunk-LORGE2NB.js} +68 -62
  49. package/dist/{chunk-LY2GQ32S.js → chunk-MEAO33XW.js} +22 -20
  50. package/dist/{chunk-OD2MNYXD.js → chunk-MR5KIFI7.js} +23 -22
  51. package/dist/{chunk-2VUUMXAQ.js → chunk-N2UHAQXC.js} +18 -11
  52. package/dist/chunk-NG2X3SMF.js +91 -0
  53. package/dist/chunk-OFJIG4K3.js +6482 -0
  54. package/dist/chunk-P74GTK23.js +91 -0
  55. package/dist/chunk-PKM3JOKQ.js +62 -0
  56. package/dist/{chunk-NDHXM4PL.js → chunk-Q3XQPNF6.js} +12 -12
  57. package/dist/{chunk-RXHTGX7C.js → chunk-Q5NZNXJE.js} +6 -10
  58. package/dist/chunk-QEKVZ7BX.js +57 -0
  59. package/dist/chunk-QNWCBPVO.js +215 -0
  60. package/dist/{chunk-US6QZICZ.js → chunk-RPJR3S5S.js} +32 -18
  61. package/dist/chunk-RPSUFZAG.js +3307 -0
  62. package/dist/chunk-RRI23NK2.js +40 -0
  63. package/dist/{chunk-6EWHKL7Z.js → chunk-SXYQL4GK.js} +7 -6
  64. package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
  65. package/dist/{chunk-UZM6OSW5.js → chunk-UPHB5HWO.js} +15 -13
  66. package/dist/chunk-UTSSDFQL.js +64 -0
  67. package/dist/chunk-V5ADM3WC.js +741 -0
  68. package/dist/{chunk-25BAMW5X.js → chunk-VIEKOGKG.js} +18 -2
  69. package/dist/chunk-VUV5U4J5.js +117 -0
  70. package/dist/{chunk-LXS3NJYD.js → chunk-VZEJ2ZHE.js} +14 -15
  71. package/dist/chunk-W2QPNAZ3.js +58 -0
  72. package/dist/chunk-YLUB6252.js +45 -0
  73. package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
  74. package/dist/chunk-YXOGRERG.js +91 -0
  75. package/dist/index.js +39 -36
  76. package/package.json +31 -16
  77. package/templates/none/src/main.ts +4 -0
  78. package/templates/none/vite.config.ts +0 -2
  79. package/templates/phaser/src/main.ts +0 -1
  80. package/templates/phaser/src/scenes/game-scene.ts +10 -8
  81. package/templates/phaser/vite.config.ts +0 -2
  82. package/templates/react-r3f/src/app.tsx +3 -1
  83. package/templates/react-r3f/src/main.tsx +1 -0
  84. package/templates/react-r3f/vite.config.ts +0 -2
  85. package/templates/threejs/src/main.ts +10 -1
  86. package/templates/threejs/vite.config.ts +0 -2
  87. package/LICENSE +0 -21
  88. package/dist/chunk-J6PKNPI2.js +0 -26
@@ -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
19
  } from "./chunk-GKDUYJ7R.js";
19
20
 
20
- // ../../node_modules/.pnpm/ignore@7.0.14/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.14/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,6 @@ 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
33
  var REGEX_ANCHORED_GLOBSTAR = /^\/\*{2,}$/;
34
34
  var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
35
35
  var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
@@ -91,13 +91,9 @@ var require_ignore = __commonJS({
91
91
  return null;
92
92
  }
93
93
  if (char === ESCAPE) {
94
- const escaped = pattern[index + 1];
95
- if (escaped === UNDEFINED) {
96
- return null;
97
- }
94
+ const escaped = pattern[++index];
98
95
  body += escapeMember(escaped);
99
96
  prev = escaped;
100
- index++;
101
97
  } else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
102
98
  index++;
103
99
  let to = pattern[index];
@@ -162,7 +158,7 @@ var require_ignore = __commonJS({
162
158
  const char = pattern[index];
163
159
  if (char === ESCAPE) {
164
160
  const escaped = pattern[index + 1];
165
- if (escaped === UNDEFINED || escaped === SLASH && index + 2 === length) {
161
+ if (escaped === SLASH && index + 2 === length) {
166
162
  out += hold(NEVER_MATCH);
167
163
  } else if (escaped === "*" || escaped === "[" || escaped === SPACE) {
168
164
  out += pattern.slice(index, index + 2);
@@ -196,6 +192,7 @@ var require_ignore = __commonJS({
196
192
  };
197
193
  var DIRECT = null;
198
194
  var REGEX_INNER_SLASH = /\/(?!$)/;
195
+ var WILDCARD = "[^\\/]*";
199
196
  var REPLACERS = [
200
197
  // Replace (\ ) with ' '
201
198
  // Only a space: an escaped tab or other whitespace is already a literal by
@@ -276,7 +273,7 @@ var require_ignore = __commonJS({
276
273
  // Notice that the '*'s have been replaced as '\\*'
277
274
  /^\^*(?:\\\*\\\*\\\/)+/,
278
275
  // '**/foo' <-> 'foo'
279
- () => "^(?:.*\\/)?",
276
+ () => "(?:^|\\/)",
280
277
  "*"
281
278
  ],
282
279
  // starting
@@ -286,7 +283,7 @@ var require_ignore = __commonJS({
286
283
  // If starts with '**', adding a '^' to the regular expression also works
287
284
  DIRECT,
288
285
  (source, pattern) => {
289
- if (!source || source[0] === "^") {
286
+ if (!source || source[0] === "^" || source[0] === "(") {
290
287
  return source;
291
288
  }
292
289
  const anchor = !REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^";
@@ -310,13 +307,13 @@ var require_ignore = __commonJS({
310
307
  // 'abc.*/' -> go
311
308
  // 'abc.*' -> skip this rule,
312
309
  // coz trailing single wildcard will be handed by [trailing wildcard]
313
- /(^|[^\\]+)(\\\*)+(?=.+)/g,
310
+ /(^|[^\\])(?:\\\*)+(?!$)/g,
314
311
  // '*.js' matches '.js'
315
312
  // '*.js' doesn't match 'abc'
316
- (_, p1, p2) => {
317
- const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
318
- return p1 + unescaped;
319
- },
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,
320
317
  "*"
321
318
  ],
322
319
  // trailing wildcard, held apart from a literal star
@@ -393,8 +390,7 @@ var require_ignore = __commonJS({
393
390
  return `${prefix}(?=$|\\/$)`;
394
391
  };
395
392
  var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
396
- var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
397
- var WILDCARD = "[^\\/]*";
393
+ var replaceTrailingDoublestar = () => "[\\s\\S]";
398
394
  var separatorAfter = (run, at) => {
399
395
  let separator = EMPTY;
400
396
  for (let index = at + 1; index < run.length && !run[index].wildcard; index++) {
@@ -518,7 +514,7 @@ var require_ignore = __commonJS({
518
514
  }
519
515
  const head = prefix.slice(0, -1);
520
516
  const last = prefix[prefix.length - 1];
521
- return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
517
+ return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? head : NEVER_MATCH;
522
518
  };
523
519
  var matchesBasename = (body) => {
524
520
  const index = body.indexOf(SLASH);
@@ -546,8 +542,8 @@ var require_ignore = __commonJS({
546
542
  return cut < 0 ? EMPTY : path2.slice(0, cut + 1);
547
543
  };
548
544
  var isString = (subject) => typeof subject === "string";
549
- var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
550
- 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);
551
547
  var IgnoreRule = class {
552
548
  constructor(pattern, mark, body, ignoreCase, negative, prefix) {
553
549
  this.pattern = pattern;
@@ -587,30 +583,40 @@ var require_ignore = __commonJS({
587
583
  return define(this, key, regex);
588
584
  }
589
585
  };
590
- var isLineEnd = (char) => char === "\r" || char === "\n";
591
- var trimEnd = (body) => {
592
- let end = body.length;
593
- while (end && isLineEnd(body[end - 1])) {
594
- end--;
586
+ var hasTrailingBackslash = (str) => {
587
+ let count = 0;
588
+ while (str[str.length - count - 1] === ESCAPE) {
589
+ count++;
595
590
  }
596
- const lineEnd = end;
597
- while (end && body[end - 1] === SPACE) {
598
- 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;
599
608
  }
600
609
  if (end === lineEnd) {
601
- return body.slice(0, end);
610
+ return body.slice(0, lineEnd);
602
611
  }
603
612
  let backslashes = 0;
604
- while (backslashes < end && body[end - backslashes - 1] === ESCAPE) {
613
+ while (body[end - backslashes - 1] === ESCAPE) {
605
614
  backslashes++;
606
615
  }
607
616
  return backslashes % 2 ? body.slice(0, end - 1) + SPACE : body.slice(0, end);
608
617
  };
609
- var createRule = ({
610
- pattern,
611
- mark
612
- }, ignoreCase) => {
613
- 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;
614
620
  if (body[0] === "#") {
615
621
  return;
616
622
  }
@@ -620,10 +626,10 @@ var require_ignore = __commonJS({
620
626
  body = body.slice(1);
621
627
  }
622
628
  const last = body[body.length - 1];
623
- if (last === SPACE || last === "\r" || last === "\n") {
624
- body = trimEnd(body);
629
+ if (last === SPACE || stripLineEnd && (last === "\r" || last === "\n")) {
630
+ body = trimEnd(body, stripLineEnd);
625
631
  }
626
- if (!body) {
632
+ if (!body || hasTrailingBackslash(body)) {
627
633
  return;
628
634
  }
629
635
  body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
@@ -643,19 +649,22 @@ var require_ignore = __commonJS({
643
649
  this._rules = [];
644
650
  this._basenameCount = 0;
645
651
  }
646
- _add(pattern) {
652
+ _add(pattern, index) {
647
653
  if (pattern && pattern[KEY_IGNORE]) {
648
654
  this._rules = this._rules.concat(pattern._rules._rules);
649
655
  this._basenameCount += pattern._rules._basenameCount;
650
656
  this._added = true;
651
657
  return;
652
658
  }
653
- if (isString(pattern)) {
654
- pattern = {
655
- pattern
656
- };
657
- }
658
- 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
+ );
659
668
  if (rule) {
660
669
  this._added = true;
661
670
  this._rules.push(rule);
@@ -667,8 +676,10 @@ var require_ignore = __commonJS({
667
676
  // @param {Array<string> | string | Ignore} pattern
668
677
  add(pattern) {
669
678
  this._added = false;
679
+ this._split = isString(pattern);
680
+ this._stripBOM = !this._split || pattern[0] === BOM;
670
681
  makeArray(
671
- isString(pattern) ? splitPattern(pattern) : pattern
682
+ this._split ? splitPattern(pattern) : pattern
672
683
  ).forEach(this._add, this);
673
684
  if (this._added) {
674
685
  this._literalRules = UNDEFINED;
@@ -778,6 +789,7 @@ var require_ignore = __commonJS({
778
789
  };
779
790
  checkPath.isNotRelative = isNotRelative;
780
791
  checkPath.convert = (p) => p;
792
+ var convertPath = (target) => isString(target) && checkPath.convert(target);
781
793
  var Ignore = class {
782
794
  constructor({
783
795
  ignorecase = true,
@@ -804,18 +816,21 @@ var require_ignore = __commonJS({
804
816
  return this.add(pattern);
805
817
  }
806
818
  // @returns {TestResult}
807
- _test(originalPath, cache) {
808
- const path2 = originalPath && checkPath.convert(originalPath);
819
+ _test(originalPath, cache, path2) {
809
820
  checkPath(
810
821
  path2,
811
822
  originalPath,
812
823
  this._strictPathCheck ? throwError : RETURN_FALSE
813
824
  );
814
- return this._t(path2, cache);
825
+ return path2 ? this._t(path2, cache) : {
826
+ ignored: false,
827
+ unignored: false
828
+ };
815
829
  }
816
- checkIgnore(path2) {
817
- if (path2.charCodeAt(path2.length - 1) !== SLASH_CODE) {
818
- 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);
819
834
  }
820
835
  const dir = this._t(path2, this._testCache);
821
836
  if (dir.ignored) {
@@ -833,7 +848,7 @@ var require_ignore = __commonJS({
833
848
  return cache[path2] = parent && parent.ignored ? parent : this._rules.test(path2, MODE_IGNORE);
834
849
  }
835
850
  ignores(path2) {
836
- return this._test(path2, this._ignoreCache).ignored;
851
+ return this._test(path2, this._ignoreCache, convertPath(path2)).ignored;
837
852
  }
838
853
  createFilter() {
839
854
  return (path2) => !this.ignores(path2);
@@ -843,11 +858,11 @@ var require_ignore = __commonJS({
843
858
  }
844
859
  // @returns {TestResult}
845
860
  test(path2) {
846
- return this._test(path2, this._testCache);
861
+ return this._test(path2, this._testCache, convertPath(path2));
847
862
  }
848
863
  };
849
864
  var factory = (options) => new Ignore(options);
850
- var isPathValid = (path2) => checkPath(path2 && checkPath.convert(path2), path2, RETURN_FALSE);
865
+ var isPathValid = (path2) => checkPath(convertPath(path2), path2, RETURN_FALSE);
851
866
  var setupWindows = () => {
852
867
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
853
868
  checkPath.convert = makePosix;
@@ -895,7 +910,7 @@ var HARD_EXCLUDES = [
895
910
  "coverage",
896
911
  ".DS_Store",
897
912
  "*.log",
898
- // secrets — never ship these
913
+ // WARNING: secrets below must never ship in an archive.
899
914
  ".env",
900
915
  ".env.*",
901
916
  "*.pem",
@@ -908,7 +923,6 @@ var HARD_EXCLUDES = [
908
923
  "id_ed25519",
909
924
  ".npmrc",
910
925
  ".git-credentials",
911
- // archives (avoid bundling our own output)
912
926
  "*.tgz",
913
927
  "*.tar.gz"
914
928
  ];
@@ -948,19 +962,22 @@ var collectFiles = (root, ignored) => {
948
962
  walk(root);
949
963
  return out.toSorted();
950
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
+ };
951
974
  var installedVersion = (root, name) => {
952
975
  let dir = root;
953
976
  while (true) {
954
977
  const p = path.join(dir, "node_modules", name, "package.json");
955
- if (existsSync(p)) {
956
- try {
957
- const pkg = JSON.parse(readFileSync(p, "utf-8"));
958
- const v = isJsonObject(pkg) ? pkg.version : void 0;
959
- if (isJsonString(v)) {
960
- return v;
961
- }
962
- } catch {
963
- }
978
+ const v = existsSync(p) ? packageVersion(p) : null;
979
+ if (v !== null) {
980
+ return v;
964
981
  }
965
982
  const parent = path.dirname(dir);
966
983
  if (parent === dir) {
@@ -976,7 +993,7 @@ var resolveSpec = (root, name, spec) => {
976
993
  return range;
977
994
  }
978
995
  const v2 = installedVersion(root, name);
979
- if (!v2) {
996
+ if (v2 === null || v2 === "") {
980
997
  return null;
981
998
  }
982
999
  if (range === "~") {
@@ -988,13 +1005,13 @@ var resolveSpec = (root, name, spec) => {
988
1005
  return `^${v2}`;
989
1006
  }
990
1007
  const v = installedVersion(root, name);
991
- return v ? `^${v}` : null;
1008
+ return v !== null && v !== "" ? `^${v}` : null;
992
1009
  };
993
1010
  var DEP_FIELDS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
994
1011
  var rewriteWorkspaceProtocols = (root) => {
995
1012
  let pkg;
996
1013
  try {
997
- pkg = JSON.parse(readFileSync(path.join(root, "package.json"), "utf-8"));
1014
+ pkg = parseJson(readFileSync(path.join(root, "package.json"), "utf-8"));
998
1015
  } catch {
999
1016
  return null;
1000
1017
  }
@@ -1015,7 +1032,7 @@ var rewriteWorkspaceProtocols = (root) => {
1015
1032
  continue;
1016
1033
  }
1017
1034
  const resolved = resolveSpec(root, name, spec);
1018
- if (resolved && resolved !== spec) {
1035
+ if (resolved !== null && resolved !== "" && resolved !== spec) {
1019
1036
  deps[name] = resolved;
1020
1037
  changed = true;
1021
1038
  }
@@ -1034,7 +1051,7 @@ var packSource = async (root, tmpDir) => {
1034
1051
  const rewritten = files.includes("package.json") ? rewriteWorkspaceProtocols(root) : null;
1035
1052
  let cwd = root;
1036
1053
  let stage = null;
1037
- if (rewritten) {
1054
+ if (rewritten !== null && rewritten !== "") {
1038
1055
  stage = mkdtempSync(path.join(tmpDir, "stage-"));
1039
1056
  for (const f of files) {
1040
1057
  const dest = path.join(stage, f);
@@ -1048,7 +1065,7 @@ var packSource = async (root, tmpDir) => {
1048
1065
  try {
1049
1066
  await Qn({ cwd, file: tarball, gzip: true, portable: true }, files);
1050
1067
  } finally {
1051
- if (stage) {
1068
+ if (stage !== null && stage !== "") {
1052
1069
  rmSync(stage, { force: true, recursive: true });
1053
1070
  }
1054
1071
  }
@@ -8,18 +8,19 @@ import {
8
8
  OAuthError,
9
9
  pollDeviceToken,
10
10
  requestDeviceCode
11
- } from "./chunk-K2U7L4RU.js";
11
+ } from "./chunk-E3FJUPLT.js";
12
12
  import {
13
13
  getBaseUrl,
14
14
  saveConfig
15
- } from "./chunk-RXHTGX7C.js";
16
- import {
17
- consola
18
- } from "./chunk-D2RF35HJ.js";
19
- import "./chunk-J6PKNPI2.js";
15
+ } from "./chunk-Q5NZNXJE.js";
20
16
  import {
21
17
  defineCommand
22
18
  } from "./chunk-MBXCVCC4.js";
19
+ import {
20
+ consola
21
+ } from "./chunk-D2RF35HJ.js";
22
+ import "./chunk-RPSUFZAG.js";
23
+ import "./chunk-2SBBKY5C.js";
23
24
  import "./chunk-GKDUYJ7R.js";
24
25
 
25
26
  // src/commands/login.ts
@@ -43,6 +44,7 @@ var openBrowser = (url, baseUrl) => {
43
44
  const [cmd, args] = openers[process.platform] ?? ["xdg-open", [target.href]];
44
45
  const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
45
46
  child.on("error", () => {
47
+ consola.debug("could not open a browser");
46
48
  });
47
49
  child.unref();
48
50
  };
@@ -64,28 +66,35 @@ var loginCommand = defineCommand({
64
66
  );
65
67
  openBrowser(device.verificationUriComplete, baseUrl);
66
68
  consola.start("Waiting for approval...");
67
- let intervalMs = device.interval * 1e3;
68
69
  const deadline = Date.now() + device.expiresIn * 1e3;
69
- while (Date.now() < deadline) {
70
+ const poll = async (intervalMs) => {
71
+ if (Date.now() >= deadline) {
72
+ return false;
73
+ }
70
74
  await sleep(intervalMs);
71
75
  try {
72
76
  saveConfig(await pollDeviceToken(baseUrl, device.deviceCode));
73
77
  consola.success("Logged in successfully");
74
- return;
78
+ return true;
75
79
  } catch (error) {
76
80
  if (!(error instanceof OAuthError)) {
77
81
  throw error;
78
82
  }
79
83
  if (error.code === "slow_down") {
80
- intervalMs += SLOW_DOWN_STEP_MS;
81
- } else if (error.code === "access_denied") {
84
+ return await poll(intervalMs + SLOW_DOWN_STEP_MS);
85
+ }
86
+ if (error.code === "access_denied") {
82
87
  fail("Login was denied in the browser.");
83
88
  } else if (error.code === "expired_token") {
84
89
  fail("Code expired. Run `vg login` to try again.");
85
90
  } else if (error.code !== "authorization_pending") {
86
91
  throw error;
87
92
  }
93
+ return await poll(intervalMs);
88
94
  }
95
+ };
96
+ if (await poll(device.interval * 1e3)) {
97
+ return;
89
98
  }
90
99
  fail("Timed out waiting for approval. Run `vg login` to try again.");
91
100
  }
@@ -0,0 +1,53 @@
1
+ import { createRequire as __createRequire } from "node:module";
2
+ import { dirname as __pathDirname } from "node:path";
3
+ import { fileURLToPath as __fileURLToPath } from "node:url";
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import {
8
+ Bitmap,
9
+ DEFAULT_SNAP_CONFIG,
10
+ fail,
11
+ failUsage,
12
+ getFlag,
13
+ getInt,
14
+ main,
15
+ parseArgs,
16
+ snapImage,
17
+ snapWarning
18
+ } from "./chunk-OFJIG4K3.js";
19
+ import "./chunk-2SBBKY5C.js";
20
+ import "./chunk-GKDUYJ7R.js";
21
+
22
+ // src/commands/asset/pixel-snapper.ts
23
+ var run = (argv) => {
24
+ main(() => {
25
+ const args = parseArgs([...argv], {
26
+ booleans: ["strict"],
27
+ values: ["k-colors", "seed"]
28
+ });
29
+ const usage = "Usage: vg asset pixel-snapper input.png output.png [--k-colors N] [--seed N]";
30
+ const [input = "", output = ""] = args.positionals;
31
+ if (input === "" || output === "") {
32
+ failUsage(usage);
33
+ }
34
+ const kColors = getInt(args, "k-colors", 16);
35
+ if (kColors <= 0) {
36
+ fail("--k-colors must be a positive integer");
37
+ }
38
+ const config = { ...DEFAULT_SNAP_CONFIG, kColors, kSeed: getInt(args, "seed", 42) };
39
+ const snapped = snapImage(input, config);
40
+ snapped.toFile(output);
41
+ console.log(`Snapped ${input} -> ${output} (${snapped.width}x${snapped.height})`);
42
+ const warning = snapWarning(Bitmap.fromFile(input), snapped, config);
43
+ if (warning !== null && warning !== "") {
44
+ console.error(`[pixel_snapper] warning: ${warning}`);
45
+ if (getFlag(args, "strict")) {
46
+ process.exit(1);
47
+ }
48
+ }
49
+ });
50
+ };
51
+ export {
52
+ run
53
+ };
@@ -9,10 +9,11 @@ import {
9
9
  isNewerVersion,
10
10
  markUpdateChecked,
11
11
  maybeScheduleAutoUpdate
12
- } from "./chunk-2VUUMXAQ.js";
13
- import "./chunk-7CXMMC5S.js";
14
- import "./chunk-RXHTGX7C.js";
15
- import "./chunk-J6PKNPI2.js";
12
+ } from "./chunk-N2UHAQXC.js";
13
+ import "./chunk-JN4WZCR7.js";
14
+ import "./chunk-Q5NZNXJE.js";
15
+ import "./chunk-RPSUFZAG.js";
16
+ import "./chunk-2SBBKY5C.js";
16
17
  import "./chunk-GKDUYJ7R.js";
17
18
  export {
18
19
  fetchLatestVersion,
@@ -0,0 +1,72 @@
1
+ import { createRequire as __createRequire } from "node:module";
2
+ import { dirname as __pathDirname } from "node:path";
3
+ import { fileURLToPath as __fileURLToPath } from "node:url";
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import {
8
+ fail,
9
+ failUsage,
10
+ getFlag,
11
+ getInt,
12
+ getNumber,
13
+ getString,
14
+ main,
15
+ normalizeCanvas,
16
+ parseArgs
17
+ } from "./chunk-OFJIG4K3.js";
18
+ import "./chunk-2SBBKY5C.js";
19
+ import "./chunk-GKDUYJ7R.js";
20
+
21
+ // src/commands/asset/normalize-canvas.ts
22
+ var parseSize = (text = "256x256") => {
23
+ const match = /^(?<w>\d+)\s*x\s*(?<h>\d+)$/iu.exec(text.trim());
24
+ if (!match) {
25
+ fail(`--canvas must be WxH, e.g. 256x256 (got "${text}")`);
26
+ }
27
+ const width = Number(match?.groups?.w);
28
+ const height = Number(match?.groups?.h);
29
+ if (width <= 0 || height <= 0) {
30
+ fail(`--canvas dimensions must be positive, got: "${text}"`);
31
+ }
32
+ return { height, width };
33
+ };
34
+ var run = (argv) => {
35
+ main(() => {
36
+ const args = parseArgs([...argv], {
37
+ booleans: ["no-upscale"],
38
+ values: ["canvas", "char-fill", "glob", "input-dir", "out-dir", "pad", "target-height"]
39
+ });
40
+ const inputDir = getString(args, "input-dir") ?? "";
41
+ const outDir = getString(args, "out-dir") ?? "";
42
+ if (inputDir === "" || outDir === "") {
43
+ failUsage("--input-dir and --out-dir are required");
44
+ }
45
+ const pad = getInt(args, "pad", 6);
46
+ if (pad < 0) {
47
+ fail("--pad must be >= 0");
48
+ }
49
+ const charFill = getNumber(args, "char-fill", 0.5);
50
+ if (!(charFill > 0 && charFill <= 1)) {
51
+ fail("--char-fill must be in (0, 1]");
52
+ }
53
+ const targetHeightSpec = getString(args, "target-height");
54
+ const targetHeight = targetHeightSpec === void 0 ? null : getInt(args, "target-height", 0);
55
+ if (targetHeight !== null && targetHeight <= 0) {
56
+ fail("--target-height must be a positive integer");
57
+ }
58
+ const written = normalizeCanvas(inputDir, outDir, {
59
+ allowUpscale: !getFlag(args, "no-upscale"),
60
+ canvas: parseSize(getString(args, "canvas")),
61
+ charFill,
62
+ glob: getString(args, "glob") ?? "frame-*.png",
63
+ pad,
64
+ targetHeight
65
+ });
66
+ console.log(outDir);
67
+ console.log(`${written.length} frames`);
68
+ });
69
+ };
70
+ export {
71
+ run
72
+ };
@@ -0,0 +1,62 @@
1
+ import { createRequire as __createRequire } from "node:module";
2
+ import { dirname as __pathDirname } from "node:path";
3
+ import { fileURLToPath as __fileURLToPath } from "node:url";
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import {
8
+ failUsage,
9
+ getFlag,
10
+ getInt,
11
+ getString,
12
+ main,
13
+ parseArgs,
14
+ runQc,
15
+ toPythonJson
16
+ } from "./chunk-OFJIG4K3.js";
17
+ import "./chunk-2SBBKY5C.js";
18
+ import "./chunk-GKDUYJ7R.js";
19
+
20
+ // src/commands/asset/sheet-qc.ts
21
+ var run = (argv) => {
22
+ main(() => {
23
+ const args = parseArgs([...argv], {
24
+ booleans: ["fail-on-hints", "json", "strict"],
25
+ values: ["frame-height", "frame-width"]
26
+ });
27
+ const [sheet = ""] = args.positionals;
28
+ if (sheet === "") {
29
+ failUsage("a spritesheet path is required");
30
+ }
31
+ const frameWidth = getString(args, "frame-width") === void 0 ? null : getInt(args, "frame-width", 0);
32
+ const frameHeight = getString(args, "frame-height") === void 0 ? null : getInt(args, "frame-height", 0);
33
+ const report = runQc(sheet, frameWidth, frameHeight);
34
+ if (getFlag(args, "json")) {
35
+ console.log(toPythonJson(report));
36
+ } else {
37
+ console.log(
38
+ `[${report.verdict.toUpperCase()}] ${report.sheet} (${report.frameCount} frames ${report.frameWidth}x${report.frameHeight})`
39
+ );
40
+ for (const check of report.checks) {
41
+ const marker = check.severity === "warn" ? "!" : "?";
42
+ console.log(
43
+ ` ${marker} ${check.check}: frames [${check.frames.join(", ")}] \u2014 ${check.detail}`
44
+ );
45
+ }
46
+ if (report.checks.length === 0) {
47
+ console.log(
48
+ " no issues: sizes consistent, facing consistent, no clipping or empty cells."
49
+ );
50
+ }
51
+ }
52
+ if (getFlag(args, "fail-on-hints") && report.verdict !== "clean") {
53
+ process.exit(1);
54
+ }
55
+ if (getFlag(args, "strict") && report.verdict === "warn") {
56
+ process.exit(1);
57
+ }
58
+ });
59
+ };
60
+ export {
61
+ run
62
+ };