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
@@ -6,35 +6,37 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  extractSource
9
- } from "./chunk-3HUWAJQH.js";
10
- import "./chunk-VFFOT7KD.js";
11
- import {
12
- createClient
13
- } from "./chunk-KZBZNTM4.js";
14
- import "./chunk-K2U7L4RU.js";
15
- import "./chunk-Z4Z24FWO.js";
16
- import "./chunk-PEUP4MZR.js";
17
- import "./chunk-RXHTGX7C.js";
9
+ } from "./chunk-42K3BJJH.js";
10
+ import "./chunk-G66HRVDW.js";
18
11
  import {
19
12
  SLUG_RE
20
- } from "./chunk-ZI6PKVXG.js";
13
+ } from "./chunk-TMPBGXT4.js";
14
+ import {
15
+ assertKnownFlags
16
+ } from "./chunk-RZ4DIJQW.js";
17
+ import {
18
+ createClient
19
+ } from "./chunk-CTY2WZQK.js";
20
+ import "./chunk-E3FJUPLT.js";
21
+ import "./chunk-Q5NZNXJE.js";
21
22
  import {
22
23
  isJsonOutput,
23
24
  outputArgs,
24
25
  writeStructured
25
- } from "./chunk-ZYCSYJWX.js";
26
+ } from "./chunk-COSLGSVO.js";
26
27
  import {
27
- assertKnownFlags
28
- } from "./chunk-RZ4DIJQW.js";
28
+ defineCommand
29
+ } from "./chunk-MBXCVCC4.js";
29
30
  import {
30
31
  consola
31
32
  } from "./chunk-D2RF35HJ.js";
33
+ import "./chunk-YNCYMWER.js";
34
+ import "./chunk-AWJNAGPE.js";
32
35
  import {
33
- isJsonObject
34
- } from "./chunk-J6PKNPI2.js";
35
- import {
36
- defineCommand
37
- } from "./chunk-MBXCVCC4.js";
36
+ isJsonObject,
37
+ parseJson
38
+ } from "./chunk-RPSUFZAG.js";
39
+ import "./chunk-2SBBKY5C.js";
38
40
  import "./chunk-GKDUYJ7R.js";
39
41
 
40
42
  // src/commands/fork.ts
@@ -69,7 +71,7 @@ var rewritePackageName = (dir, slug) => {
69
71
  return;
70
72
  }
71
73
  try {
72
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
74
+ const pkg = parseJson(readFileSync(pkgPath, "utf-8"));
73
75
  if (!isJsonObject(pkg)) {
74
76
  throw new Error("package.json is not a JSON object");
75
77
  }
@@ -110,7 +112,7 @@ var forkCommand = defineCommand({
110
112
  rmSync(dir, { force: true, recursive: true });
111
113
  }
112
114
  const client = createClient();
113
- if (!isJsonOutput(args) && !args.field) {
115
+ if (!isJsonOutput(args) && (args.field === void 0 || args.field === "")) {
114
116
  consola.start(`Forking ${source}`);
115
117
  }
116
118
  let src;
@@ -4,47 +4,48 @@ import { fileURLToPath as __fileURLToPath } from "node:url";
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import {
8
- FACTORY_PACKAGE,
9
- installedFactoryVersion,
10
- updateFactory
11
- } from "./chunk-ZCYWDKYP.js";
12
7
  import {
13
8
  findInstall,
14
9
  reportSkills,
15
10
  settleSync,
16
11
  syncSkills
17
- } from "./chunk-BMTHAVMS.js";
12
+ } from "./chunk-3HGBIUM5.js";
18
13
  import {
19
14
  fetchLatestVersion,
20
15
  isNewerVersion
21
- } from "./chunk-2VUUMXAQ.js";
22
- import "./chunk-7CXMMC5S.js";
23
- import "./chunk-VFFOT7KD.js";
24
- import {
25
- PACKAGE_VERSION
26
- } from "./chunk-Z4Z24FWO.js";
16
+ } from "./chunk-N2UHAQXC.js";
27
17
  import {
28
- detectPackageManager,
29
- globalInstallArgs,
30
- globalInstallCommand
31
- } from "./chunk-PEUP4MZR.js";
32
- import "./chunk-RXHTGX7C.js";
18
+ FACTORY_PACKAGE,
19
+ installedFactoryVersion,
20
+ updateFactory
21
+ } from "./chunk-A556KALN.js";
33
22
  import {
34
23
  isMissingCommand,
35
24
  run
36
- } from "./chunk-TBQ5BU3Q.js";
37
- import "./chunk-5535KDYI.js";
25
+ } from "./chunk-F42QKWBB.js";
26
+ import "./chunk-G66HRVDW.js";
38
27
  import {
39
28
  assertKnownFlags
40
29
  } from "./chunk-RZ4DIJQW.js";
30
+ import "./chunk-JN4WZCR7.js";
31
+ import "./chunk-Q5NZNXJE.js";
32
+ import {
33
+ defineCommand
34
+ } from "./chunk-MBXCVCC4.js";
35
+ import "./chunk-5535KDYI.js";
41
36
  import {
42
37
  consola
43
38
  } from "./chunk-D2RF35HJ.js";
44
- import "./chunk-J6PKNPI2.js";
45
39
  import {
46
- defineCommand
47
- } from "./chunk-MBXCVCC4.js";
40
+ PACKAGE_VERSION
41
+ } from "./chunk-YNCYMWER.js";
42
+ import {
43
+ detectPackageManager,
44
+ globalInstallArgs,
45
+ globalInstallCommand
46
+ } from "./chunk-AWJNAGPE.js";
47
+ import "./chunk-RPSUFZAG.js";
48
+ import "./chunk-2SBBKY5C.js";
48
49
  import "./chunk-GKDUYJ7R.js";
49
50
 
50
51
  // src/commands/update.ts
@@ -6,15 +6,16 @@ var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
7
  import {
8
8
  resolveSetting
9
- } from "./chunk-7CXMMC5S.js";
9
+ } from "./chunk-JN4WZCR7.js";
10
10
  import {
11
11
  getConfigDir
12
- } from "./chunk-RXHTGX7C.js";
12
+ } from "./chunk-Q5NZNXJE.js";
13
13
  import {
14
14
  isJsonNumber,
15
15
  isJsonObject,
16
- isJsonString
17
- } from "./chunk-J6PKNPI2.js";
16
+ isJsonString,
17
+ parseJson
18
+ } from "./chunk-RPSUFZAG.js";
18
19
 
19
20
  // src/lib/update.ts
20
21
  import { spawn } from "node:child_process";
@@ -29,7 +30,7 @@ var getLastCheckedAt = () => {
29
30
  return 0;
30
31
  }
31
32
  try {
32
- const data = JSON.parse(readFileSync(cache, "utf-8"));
33
+ const data = parseJson(readFileSync(cache, "utf-8"));
33
34
  if (isJsonObject(data)) {
34
35
  const ts = data.lastCheckedAt;
35
36
  if (isJsonNumber(ts)) {
@@ -37,6 +38,7 @@ var getLastCheckedAt = () => {
37
38
  }
38
39
  }
39
40
  } catch {
41
+ return 0;
40
42
  }
41
43
  return 0;
42
44
  };
@@ -47,7 +49,9 @@ var markUpdateChecked = () => {
47
49
  mkdirSync(dir, { mode: 448, recursive: true });
48
50
  }
49
51
  writeFileSync(getCachePath(), JSON.stringify({ lastCheckedAt: Date.now() }, null, 2));
52
+ return true;
50
53
  } catch {
54
+ return false;
51
55
  }
52
56
  };
53
57
  var isNewerVersion = (latest, current) => {
@@ -77,7 +81,7 @@ var fetchLatestVersion = async (packageName) => {
77
81
  if (!res.ok) {
78
82
  return null;
79
83
  }
80
- const data = await res.json();
84
+ const data = parseJson(await res.text());
81
85
  if (isJsonObject(data)) {
82
86
  const { version } = data;
83
87
  if (isJsonString(version)) {
@@ -85,19 +89,20 @@ var fetchLatestVersion = async (packageName) => {
85
89
  }
86
90
  }
87
91
  } catch {
92
+ return null;
88
93
  }
89
94
  return null;
90
95
  };
91
96
  var maybeScheduleAutoUpdate = () => {
92
- if (process.env.CI || resolveSetting("update.auto").value === "false") {
93
- return;
97
+ if (process.env.CI !== void 0 && process.env.CI !== "" || resolveSetting("update.auto").value === "false") {
98
+ return false;
94
99
  }
95
100
  const [, script] = process.argv;
96
- if (!script) {
97
- return;
101
+ if (script === void 0 || script === "") {
102
+ return false;
98
103
  }
99
104
  if (Date.now() - getLastCheckedAt() < CHECK_INTERVAL_MS) {
100
- return;
105
+ return false;
101
106
  }
102
107
  markUpdateChecked();
103
108
  try {
@@ -106,7 +111,9 @@ var maybeScheduleAutoUpdate = () => {
106
111
  stdio: "ignore"
107
112
  });
108
113
  child.unref();
114
+ return true;
109
115
  } catch {
116
+ return false;
110
117
  }
111
118
  };
112
119
 
@@ -0,0 +1,91 @@
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
+ fail,
10
+ failUsage,
11
+ getInt,
12
+ getString,
13
+ main,
14
+ parseArgs,
15
+ readImageSize
16
+ } from "./chunk-OFJIG4K3.js";
17
+ import "./chunk-2SBBKY5C.js";
18
+ import "./chunk-GKDUYJ7R.js";
19
+
20
+ // src/commands/asset/image-util.ts
21
+ var parseSize = (text = "") => {
22
+ const match = /^(?<w>\d+)\s*x\s*(?<h>\d+)$/iu.exec(text.trim());
23
+ if (!match) {
24
+ failUsage(`--size must be WxH, e.g. 128x128 (got "${text}")`);
25
+ }
26
+ const width = Number(match?.groups?.w);
27
+ const height = Number(match?.groups?.h);
28
+ if (width < 1 || height < 1) {
29
+ failUsage(`--size must be at least 1x1 (got "${text}")`);
30
+ }
31
+ return { height, width };
32
+ };
33
+ var run = (argv) => {
34
+ main(() => {
35
+ const args = parseArgs([...argv], {
36
+ values: ["factor", "size"]
37
+ });
38
+ const resize = () => {
39
+ const [, input = "", output = ""] = args.positionals;
40
+ if (input === "" || output === "") {
41
+ failUsage("Usage: vg asset image-util resize <in.png> <out.png> --size WxH");
42
+ }
43
+ const spec = getString(args, "size") ?? "";
44
+ if (spec === "") {
45
+ failUsage("--size is required, e.g. --size 128x128");
46
+ }
47
+ const { width, height } = parseSize(spec);
48
+ Bitmap.fromFile(input).resize(width, height, "lanczos").toFile(output);
49
+ console.log(`${input} -> ${output} (${width}x${height}, lanczos)`);
50
+ };
51
+ const size = () => {
52
+ const paths = args.positionals.slice(1);
53
+ if (paths.length === 0) {
54
+ failUsage("Usage: vg asset image-util size <file.png> [...]");
55
+ }
56
+ for (const path of paths) {
57
+ const dims = readImageSize(path) ?? fail(`could not read image dimensions: ${path}`);
58
+ console.log(
59
+ paths.length === 1 ? `${dims.width}x${dims.height}` : `${dims.width}x${dims.height} ${path}`
60
+ );
61
+ }
62
+ };
63
+ const upscale = () => {
64
+ const [, input = "", output = ""] = args.positionals;
65
+ if (input === "" || output === "") {
66
+ failUsage("Usage: vg asset image-util upscale <in.png> <out.png> --factor 8");
67
+ }
68
+ const factor = getInt(args, "factor", 8);
69
+ if (!Number.isInteger(factor) || factor < 1) {
70
+ fail("--factor must be a positive integer");
71
+ }
72
+ const image = Bitmap.fromFile(input);
73
+ image.resize(image.width * factor, image.height * factor, "nearest").toFile(output);
74
+ console.log(
75
+ `${input} -> ${output} (${image.width * factor}x${image.height * factor}, x${factor} nearest)`
76
+ );
77
+ };
78
+ const mode = (/* @__PURE__ */ new Map([
79
+ ["resize", resize],
80
+ ["size", size],
81
+ ["upscale", upscale]
82
+ ])).get(args.positionals[0] ?? "");
83
+ if (mode === void 0) {
84
+ failUsage("Usage: vg asset image-util <size|upscale|resize> ...");
85
+ }
86
+ mode?.();
87
+ });
88
+ };
89
+ export {
90
+ run
91
+ };