vibedgames 0.9.0 → 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.
- package/README.md +3 -2
- package/assets/align-framing.py +242 -0
- package/assets/render-model.py +406 -0
- package/assets/tilemap-editor.html +630 -0
- package/dist/THIRD_PARTY_NOTICES.txt +2 -2
- package/dist/chunk-2KVQJKIZ.js +6495 -0
- package/dist/{chunk-56OY4TEP.js → chunk-2SBBKY5C.js} +1361 -4493
- package/dist/{chunk-FC233UKH.js → chunk-2ZKS7V72.js} +16 -16
- package/dist/{chunk-BMTHAVMS.js → chunk-3HGBIUM5.js} +22 -19
- package/dist/chunk-3UGGMFJJ.js +22 -0
- package/dist/{chunk-3HUWAJQH.js → chunk-42K3BJJH.js} +93 -76
- package/dist/{chunk-ST5FC2W3.js → chunk-43P4U7CB.js} +20 -11
- package/dist/chunk-4FJXCS3K.js +741 -0
- package/dist/{chunk-WSRIF6K4.js → chunk-4UU622RK.js} +5 -4
- package/dist/chunk-5YPLKGY3.js +87 -0
- package/dist/chunk-6KXXZXSO.js +475 -0
- package/dist/chunk-7RPLQWR2.js +91 -0
- package/dist/{chunk-ZCYWDKYP.js → chunk-A556KALN.js} +14 -13
- package/dist/{chunk-UFR6G6BL.js → chunk-ABTUEIRC.js} +554 -254
- package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
- package/dist/{chunk-HNRVSBRK.js → chunk-BN3Q7UEC.js} +20 -17
- package/dist/chunk-BZOMEG3X.js +412 -0
- package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
- package/dist/{chunk-KZBZNTM4.js → chunk-CTY2WZQK.js} +9 -13
- package/dist/chunk-DB7WVFS7.js +80 -0
- package/dist/chunk-DOOQUFPG.js +73 -0
- package/dist/{chunk-K2U7L4RU.js → chunk-E3FJUPLT.js} +15 -21
- package/dist/chunk-E7NDOZ27.js +428 -0
- package/dist/{chunk-TBQ5BU3Q.js → chunk-F42QKWBB.js} +18 -18
- package/dist/chunk-FXXVXDTW.js +168 -0
- package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
- package/dist/chunk-GLEW7VJQ.js +45 -0
- package/dist/{chunk-AXTLPJ2F.js → chunk-H2C4QUTG.js} +8 -7
- package/dist/{chunk-H3IPLBXQ.js → chunk-HRKVAXNN.js} +17 -14
- package/dist/{chunk-UXCWSWWX.js → chunk-HSMG6U7J.js} +8 -7
- package/dist/chunk-HX5Q63UA.js +48 -0
- package/dist/chunk-HYOXGNWS.js +53 -0
- package/dist/chunk-I5LELJSK.js +22 -0
- package/dist/{chunk-7CXMMC5S.js → chunk-JN4WZCR7.js} +5 -4
- package/dist/{chunk-7QZSDU52.js → chunk-K36EOII3.js} +5 -4
- package/dist/chunk-KAGVI3CE.js +62 -0
- package/dist/chunk-KJK5CB6E.js +58 -0
- package/dist/chunk-KLFBAFXD.js +25 -0
- package/dist/{chunk-355VG7EO.js → chunk-LONQWRTR.js} +107 -77
- package/dist/{chunk-Z5TFZQ5U.js → chunk-LORGE2NB.js} +68 -62
- package/dist/{chunk-LY2GQ32S.js → chunk-MEAO33XW.js} +22 -20
- package/dist/{chunk-OD2MNYXD.js → chunk-MR5KIFI7.js} +23 -22
- package/dist/{chunk-2VUUMXAQ.js → chunk-N2UHAQXC.js} +18 -11
- package/dist/chunk-NCX6LYNJ.js +117 -0
- package/dist/chunk-OGX4DKIS.js +215 -0
- package/dist/chunk-OPUCUUID.js +41 -0
- package/dist/chunk-Q2QC6KAZ.js +132 -0
- package/dist/{chunk-NDHXM4PL.js → chunk-Q3XQPNF6.js} +12 -12
- package/dist/{chunk-RXHTGX7C.js → chunk-Q5NZNXJE.js} +6 -10
- package/dist/chunk-QLCVLCPM.js +126 -0
- package/dist/chunk-R2WVORGD.js +91 -0
- package/dist/chunk-RKS7SI5L.js +64 -0
- package/dist/{chunk-US6QZICZ.js → chunk-RPJR3S5S.js} +32 -18
- package/dist/chunk-RPSUFZAG.js +3307 -0
- package/dist/chunk-RRI23NK2.js +40 -0
- package/dist/chunk-S7HYWITX.js +57 -0
- package/dist/chunk-SBXCK2I2.js +48 -0
- package/dist/chunk-SUSX3QIA.js +62 -0
- package/dist/{chunk-6EWHKL7Z.js → chunk-SXYQL4GK.js} +7 -6
- package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
- package/dist/chunk-TXOE5UY5.js +72 -0
- package/dist/chunk-U6DTE5IX.js +124 -0
- package/dist/{chunk-UZM6OSW5.js → chunk-UPHB5HWO.js} +15 -13
- package/dist/chunk-UQ7VO6B3.js +91 -0
- package/dist/chunk-VB4WLJR2.js +47 -0
- package/dist/{chunk-25BAMW5X.js → chunk-VIEKOGKG.js} +18 -2
- package/dist/{chunk-LXS3NJYD.js → chunk-VZEJ2ZHE.js} +14 -15
- package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
- package/dist/chunk-ZHLPE6LI.js +71 -0
- package/dist/index.js +39 -36
- package/package.json +31 -16
- package/templates/none/src/main.ts +4 -0
- package/templates/none/vite.config.ts +0 -2
- package/templates/phaser/src/main.ts +0 -1
- package/templates/phaser/src/scenes/game-scene.ts +10 -8
- package/templates/phaser/vite.config.ts +0 -2
- package/templates/react-r3f/src/app.tsx +3 -1
- package/templates/react-r3f/src/main.tsx +1 -0
- package/templates/react-r3f/vite.config.ts +0 -2
- package/templates/threejs/src/main.ts +10 -1
- package/templates/threejs/vite.config.ts +0 -2
- package/LICENSE +0 -21
- package/dist/chunk-J6PKNPI2.js +0 -26
|
@@ -14,24 +14,24 @@ import {
|
|
|
14
14
|
// src/lib/run.ts
|
|
15
15
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
16
16
|
var isMissingCommand = (result) => result.code !== 0 && /ENOENT|not found|not recognized/iu.test(result.output);
|
|
17
|
-
var run = (cmd, args, cwd) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
` })
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
var run = async (cmd, args, cwd) => {
|
|
18
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
19
|
+
const chunks = [];
|
|
20
|
+
const child = (0, import_cross_spawn.default)(cmd, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
21
|
+
const collect = (c) => {
|
|
22
|
+
chunks.push(c);
|
|
23
|
+
};
|
|
24
|
+
child.stdout?.on("data", collect);
|
|
25
|
+
child.stderr?.on("data", collect);
|
|
26
|
+
child.on("error", (err) => {
|
|
27
|
+
resolve({ code: 1, output: `${err.message}
|
|
28
|
+
` });
|
|
29
|
+
});
|
|
30
|
+
child.on("close", (code) => {
|
|
31
|
+
resolve({ code: code ?? 1, output: Buffer.concat(chunks).toString("utf-8") });
|
|
32
|
+
});
|
|
33
|
+
return await promise;
|
|
34
|
+
};
|
|
35
35
|
|
|
36
36
|
export {
|
|
37
37
|
isMissingCommand,
|
|
@@ -0,0 +1,168 @@
|
|
|
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
|
+
ASSETS_DIR
|
|
9
|
+
} from "./chunk-YNCYMWER.js";
|
|
10
|
+
import "./chunk-AWJNAGPE.js";
|
|
11
|
+
import "./chunk-RPSUFZAG.js";
|
|
12
|
+
import {
|
|
13
|
+
MANIFEST_JSON_CANDIDATES,
|
|
14
|
+
createTilemapEditor,
|
|
15
|
+
exportMapRender,
|
|
16
|
+
exportTilesetGrid,
|
|
17
|
+
fail,
|
|
18
|
+
getAll,
|
|
19
|
+
getFlag,
|
|
20
|
+
getInt,
|
|
21
|
+
getString,
|
|
22
|
+
isJsonObject,
|
|
23
|
+
isJsonString,
|
|
24
|
+
loadManifestJson,
|
|
25
|
+
main,
|
|
26
|
+
makeSelftestMap,
|
|
27
|
+
parseArgs,
|
|
28
|
+
parseColor,
|
|
29
|
+
parseJsonText,
|
|
30
|
+
sanitizeTilesets,
|
|
31
|
+
tilesetMetaFromManifest,
|
|
32
|
+
writeJsonFile
|
|
33
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
34
|
+
import "./chunk-2SBBKY5C.js";
|
|
35
|
+
import "./chunk-GKDUYJ7R.js";
|
|
36
|
+
|
|
37
|
+
// src/commands/asset/tilemap-editor.ts
|
|
38
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
39
|
+
import path from "node:path";
|
|
40
|
+
var firstTileset = (manifestPath, tilesets) => Object.keys(tilesets).toSorted()[0] ?? fail(`No tilesets in ${manifestPath}.`);
|
|
41
|
+
var resolveManifest = (explicit = "") => {
|
|
42
|
+
if (explicit === "") {
|
|
43
|
+
return MANIFEST_JSON_CANDIDATES.find((c) => existsSync(c)) ?? fail(
|
|
44
|
+
`Manifest not found. Pass --manifest or create one of: ${MANIFEST_JSON_CANDIDATES.join(", ")}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (existsSync(explicit) && statSync(explicit).isDirectory()) {
|
|
48
|
+
return ["assets_index.json", "asset_index.json"].map((n) => path.join(explicit, n)).find((c) => existsSync(c)) ?? fail(
|
|
49
|
+
`--manifest points at a directory (${explicit}), but no assets_index.json was found inside.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
if (!existsSync(explicit)) {
|
|
53
|
+
fail(`Manifest not found: ${explicit}`);
|
|
54
|
+
}
|
|
55
|
+
return explicit;
|
|
56
|
+
};
|
|
57
|
+
var run = (argv) => {
|
|
58
|
+
main(() => {
|
|
59
|
+
const args = parseArgs([...argv], {
|
|
60
|
+
booleans: ["edit", "label-ids", "trim"],
|
|
61
|
+
values: [
|
|
62
|
+
"bg",
|
|
63
|
+
"export-map-render",
|
|
64
|
+
"export-tileset-grid",
|
|
65
|
+
"fill-rect",
|
|
66
|
+
"host",
|
|
67
|
+
"make-selftest-map",
|
|
68
|
+
"manifest",
|
|
69
|
+
"map",
|
|
70
|
+
"port",
|
|
71
|
+
"scale",
|
|
72
|
+
"tileset",
|
|
73
|
+
"write-root"
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
const manifestPath = resolveManifest(getString(args, "manifest"));
|
|
77
|
+
const manifest = loadManifestJson(manifestPath);
|
|
78
|
+
const tilesets = sanitizeTilesets(manifest);
|
|
79
|
+
const name = getString(args, "tileset") ?? firstTileset(manifestPath, tilesets);
|
|
80
|
+
let meta = tilesetMetaFromManifest(manifestPath, manifest, name);
|
|
81
|
+
const scale = getInt(args, "scale", 4);
|
|
82
|
+
const trim = getFlag(args, "trim");
|
|
83
|
+
const gridOut = getString(args, "export-tileset-grid") ?? "";
|
|
84
|
+
const renderOut = getString(args, "export-map-render") ?? "";
|
|
85
|
+
const selftestOut = getString(args, "make-selftest-map") ?? "";
|
|
86
|
+
const startEditor = () => {
|
|
87
|
+
const html = readFileSync(path.join(ASSETS_DIR, "tilemap-editor.html"), "utf-8");
|
|
88
|
+
const host = getString(args, "host") ?? "127.0.0.1";
|
|
89
|
+
const port = getInt(args, "port", 0);
|
|
90
|
+
const editor = createTilemapEditor({
|
|
91
|
+
html,
|
|
92
|
+
manifestPath,
|
|
93
|
+
mapPath: getString(args, "map") ?? null,
|
|
94
|
+
tileset: name,
|
|
95
|
+
writeRoot: getString(args, "write-root") ?? process.cwd()
|
|
96
|
+
});
|
|
97
|
+
editor.server.on("error", (error) => {
|
|
98
|
+
fail(
|
|
99
|
+
"code" in error && error.code === "EADDRINUSE" ? `Port ${port} is already in use \u2014 pass a different --port, or omit it to get a free one.` : error.message
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
editor.server.listen(port, host, () => {
|
|
103
|
+
const address = editor.server.address();
|
|
104
|
+
const actual = address !== null && address instanceof Object ? address.port : port;
|
|
105
|
+
console.log(`Tilemap editor: ${editor.url(actual, host)}`);
|
|
106
|
+
console.log("Open that URL (the token is part of it). Ctrl-C to stop.");
|
|
107
|
+
});
|
|
108
|
+
process.on("SIGINT", () => {
|
|
109
|
+
editor.server.close();
|
|
110
|
+
process.exit(0);
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
if (getFlag(args, "edit")) {
|
|
114
|
+
startEditor();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (gridOut === "" && renderOut === "" && selftestOut === "") {
|
|
118
|
+
fail(
|
|
119
|
+
"Nothing to do. Pass --edit, --export-tileset-grid, --export-map-render or --make-selftest-map."
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
if (gridOut !== "") {
|
|
123
|
+
exportTilesetGrid(meta, gridOut, { labelIds: getFlag(args, "label-ids"), scale, trim });
|
|
124
|
+
console.log(`Wrote ${gridOut}`);
|
|
125
|
+
}
|
|
126
|
+
if (renderOut !== "") {
|
|
127
|
+
const mapPath = getString(args, "map") ?? "";
|
|
128
|
+
if (mapPath === "") {
|
|
129
|
+
fail("--export-map-render requires --map PATH");
|
|
130
|
+
}
|
|
131
|
+
const parsedMap = parseJsonText(readFileSync(mapPath, "utf-8"));
|
|
132
|
+
const mapPayload = isJsonObject(parsedMap) ? parsedMap : fail("Map JSON must be an object at top-level.");
|
|
133
|
+
const mapMeta = mapPayload.meta;
|
|
134
|
+
if (isJsonObject(mapMeta) && isJsonString(mapMeta.tileset) && mapMeta.tileset in tilesets) {
|
|
135
|
+
meta = tilesetMetaFromManifest(manifestPath, manifest, mapMeta.tileset);
|
|
136
|
+
}
|
|
137
|
+
const fills = getAll(args, "fill-rect").map((spec) => {
|
|
138
|
+
const parts = spec.split(",").map((p) => p.trim());
|
|
139
|
+
if (parts.length !== 5) {
|
|
140
|
+
fail("--fill-rect must be x,y,w,h,#RRGGBB[AA]");
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
color: parseColor(parts[4] ?? ""),
|
|
144
|
+
h: Number(parts[3]),
|
|
145
|
+
w: Number(parts[2]),
|
|
146
|
+
x: Number(parts[0]),
|
|
147
|
+
y: Number(parts[1])
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
const bg = getString(args, "bg") ?? "";
|
|
151
|
+
exportMapRender(meta, renderOut, {
|
|
152
|
+
background: bg === "" ? null : parseColor(bg),
|
|
153
|
+
fills,
|
|
154
|
+
mapPayload,
|
|
155
|
+
scale,
|
|
156
|
+
trim
|
|
157
|
+
});
|
|
158
|
+
console.log(`Wrote ${renderOut}`);
|
|
159
|
+
}
|
|
160
|
+
if (selftestOut !== "") {
|
|
161
|
+
writeJsonFile(selftestOut, makeSelftestMap(meta));
|
|
162
|
+
console.log(`Wrote ${selftestOut}`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
run
|
|
168
|
+
};
|
|
@@ -5,7 +5,7 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/tar@7.5.
|
|
8
|
+
// ../../node_modules/.pnpm/tar@7.5.23/node_modules/tar/dist/esm/index.min.js
|
|
9
9
|
import Qr from "events";
|
|
10
10
|
import I from "fs";
|
|
11
11
|
import { EventEmitter as Di } from "node:events";
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
exportManifest,
|
|
9
|
+
fail,
|
|
10
|
+
failUsage,
|
|
11
|
+
getFlag,
|
|
12
|
+
getString,
|
|
13
|
+
main,
|
|
14
|
+
parseArgs,
|
|
15
|
+
writeJsonFile
|
|
16
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
17
|
+
import "./chunk-2SBBKY5C.js";
|
|
18
|
+
import "./chunk-GKDUYJ7R.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/asset/manifest-export-json.ts
|
|
21
|
+
import { existsSync } from "node:fs";
|
|
22
|
+
var run = (argv) => {
|
|
23
|
+
main(() => {
|
|
24
|
+
const args = parseArgs([...argv], {
|
|
25
|
+
booleans: ["keep-paths"],
|
|
26
|
+
values: ["manifest", "out"]
|
|
27
|
+
});
|
|
28
|
+
const manifest = getString(args, "manifest") ?? "";
|
|
29
|
+
const out = getString(args, "out") ?? "";
|
|
30
|
+
if (manifest === "") {
|
|
31
|
+
failUsage("--manifest is required (path to assets_index.lua or .json)");
|
|
32
|
+
}
|
|
33
|
+
if (out === "") {
|
|
34
|
+
failUsage("--out is required (output JSON path)");
|
|
35
|
+
}
|
|
36
|
+
if (!existsSync(manifest)) {
|
|
37
|
+
fail(`Manifest not found: ${manifest}`);
|
|
38
|
+
}
|
|
39
|
+
writeJsonFile(out, exportManifest(manifest, !getFlag(args, "keep-paths"), out));
|
|
40
|
+
console.log(`Wrote ${out}`);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
run
|
|
45
|
+
};
|
|
@@ -7,15 +7,16 @@ var __dirname = __pathDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
initCommand,
|
|
9
9
|
reportSkills
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-TBQ5BU3Q.js";
|
|
14
|
-
import "./chunk-5535KDYI.js";
|
|
10
|
+
} from "./chunk-3HGBIUM5.js";
|
|
11
|
+
import "./chunk-F42QKWBB.js";
|
|
12
|
+
import "./chunk-G66HRVDW.js";
|
|
15
13
|
import "./chunk-RZ4DIJQW.js";
|
|
16
|
-
import "./chunk-D2RF35HJ.js";
|
|
17
|
-
import "./chunk-J6PKNPI2.js";
|
|
18
14
|
import "./chunk-MBXCVCC4.js";
|
|
15
|
+
import "./chunk-5535KDYI.js";
|
|
16
|
+
import "./chunk-D2RF35HJ.js";
|
|
17
|
+
import "./chunk-AWJNAGPE.js";
|
|
18
|
+
import "./chunk-RPSUFZAG.js";
|
|
19
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
20
|
import "./chunk-GKDUYJ7R.js";
|
|
20
21
|
export {
|
|
21
22
|
initCommand,
|
|
@@ -4,30 +4,31 @@ 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
|
+
assertKnownFlags
|
|
9
|
+
} from "./chunk-RZ4DIJQW.js";
|
|
7
10
|
import {
|
|
8
11
|
authErrorCode,
|
|
9
12
|
createClient
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-Z4Z24FWO.js";
|
|
13
|
-
import "./chunk-PEUP4MZR.js";
|
|
13
|
+
} from "./chunk-CTY2WZQK.js";
|
|
14
|
+
import "./chunk-E3FJUPLT.js";
|
|
14
15
|
import {
|
|
15
16
|
getToken
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Q5NZNXJE.js";
|
|
17
18
|
import {
|
|
18
19
|
outputArgs,
|
|
19
20
|
writeStructured
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-COSLGSVO.js";
|
|
21
22
|
import {
|
|
22
|
-
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
defineCommand
|
|
24
|
+
} from "./chunk-MBXCVCC4.js";
|
|
24
25
|
import {
|
|
25
26
|
consola
|
|
26
27
|
} from "./chunk-D2RF35HJ.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
import "./chunk-YNCYMWER.js";
|
|
29
|
+
import "./chunk-AWJNAGPE.js";
|
|
30
|
+
import "./chunk-RPSUFZAG.js";
|
|
31
|
+
import "./chunk-2SBBKY5C.js";
|
|
31
32
|
import "./chunk-GKDUYJ7R.js";
|
|
32
33
|
|
|
33
34
|
// src/commands/whoami.ts
|
|
@@ -41,7 +42,7 @@ var whoamiCommand = defineCommand({
|
|
|
41
42
|
run: async ({ args, rawArgs }) => {
|
|
42
43
|
assertKnownFlags(rawArgs, whoamiArgs);
|
|
43
44
|
const token = getToken();
|
|
44
|
-
if (
|
|
45
|
+
if (token === null || token === "") {
|
|
45
46
|
consola.warn("Not logged in. Run `vg login` to authenticate.");
|
|
46
47
|
process.exit(1);
|
|
47
48
|
}
|
|
@@ -51,7 +52,9 @@ var whoamiCommand = defineCommand({
|
|
|
51
52
|
if (writeStructured({ email: user.email, id: user.id, name: user.name }, args)) {
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
consola.log(
|
|
55
|
+
consola.log(
|
|
56
|
+
user.email !== null && user.email !== "" ? `${user.name} (${user.email})` : user.name
|
|
57
|
+
);
|
|
55
58
|
} catch (error) {
|
|
56
59
|
const code = authErrorCode(error);
|
|
57
60
|
if (code === "UNAUTHORIZED" || code === "FORBIDDEN") {
|
|
@@ -16,15 +16,16 @@ import {
|
|
|
16
16
|
resolveGameUrl,
|
|
17
17
|
runPlaytest,
|
|
18
18
|
withScopedSession
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-RPJR3S5S.js";
|
|
20
|
+
import "./chunk-N2UHAQXC.js";
|
|
21
|
+
import "./chunk-TMPBGXT4.js";
|
|
22
|
+
import "./chunk-JN4WZCR7.js";
|
|
23
|
+
import "./chunk-Q5NZNXJE.js";
|
|
24
|
+
import "./chunk-MBXCVCC4.js";
|
|
23
25
|
import "./chunk-5535KDYI.js";
|
|
24
|
-
import "./chunk-ZI6PKVXG.js";
|
|
25
26
|
import "./chunk-D2RF35HJ.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-RPSUFZAG.js";
|
|
28
|
+
import "./chunk-2SBBKY5C.js";
|
|
28
29
|
import "./chunk-GKDUYJ7R.js";
|
|
29
30
|
export {
|
|
30
31
|
bareTokens,
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
collectSizes,
|
|
9
|
+
defaultRoot,
|
|
10
|
+
fail,
|
|
11
|
+
getString,
|
|
12
|
+
main,
|
|
13
|
+
parseArgs,
|
|
14
|
+
sizesToCsv,
|
|
15
|
+
writeJsonFile,
|
|
16
|
+
writeTextFile
|
|
17
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
18
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
|
+
import "./chunk-GKDUYJ7R.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/asset/sizes.ts
|
|
22
|
+
import { existsSync } from "node:fs";
|
|
23
|
+
var run = (argv) => {
|
|
24
|
+
main(() => {
|
|
25
|
+
const args = parseArgs([...argv], {
|
|
26
|
+
values: ["csv", "json", "root"]
|
|
27
|
+
});
|
|
28
|
+
const root = defaultRoot(getString(args, "root"));
|
|
29
|
+
if (!existsSync(root)) {
|
|
30
|
+
fail(`Root not found: ${root}`);
|
|
31
|
+
}
|
|
32
|
+
const rows = collectSizes(root);
|
|
33
|
+
for (const row of rows) {
|
|
34
|
+
console.log(`${row.width}x${row.height} ${row.path}`);
|
|
35
|
+
}
|
|
36
|
+
const csv = getString(args, "csv") ?? "";
|
|
37
|
+
if (csv !== "") {
|
|
38
|
+
writeTextFile(csv, sizesToCsv(rows));
|
|
39
|
+
}
|
|
40
|
+
const json = getString(args, "json") ?? "";
|
|
41
|
+
if (json !== "") {
|
|
42
|
+
writeJsonFile(json, rows);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
run
|
|
48
|
+
};
|
|
@@ -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-2KVQJKIZ.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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
pythonScript
|
|
9
|
+
} from "./chunk-RRI23NK2.js";
|
|
10
|
+
import "./chunk-5535KDYI.js";
|
|
11
|
+
import "./chunk-D2RF35HJ.js";
|
|
12
|
+
import "./chunk-YNCYMWER.js";
|
|
13
|
+
import "./chunk-AWJNAGPE.js";
|
|
14
|
+
import "./chunk-RPSUFZAG.js";
|
|
15
|
+
import "./chunk-2SBBKY5C.js";
|
|
16
|
+
import "./chunk-GKDUYJ7R.js";
|
|
17
|
+
|
|
18
|
+
// src/commands/asset/render-model.ts
|
|
19
|
+
var run = pythonScript("render-model.py");
|
|
20
|
+
export {
|
|
21
|
+
run
|
|
22
|
+
};
|
|
@@ -6,11 +6,12 @@ var __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
getConfigDir
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Q5NZNXJE.js";
|
|
10
10
|
import {
|
|
11
11
|
isJsonObject,
|
|
12
|
-
isJsonString
|
|
13
|
-
|
|
12
|
+
isJsonString,
|
|
13
|
+
parseJson
|
|
14
|
+
} from "./chunk-RPSUFZAG.js";
|
|
14
15
|
|
|
15
16
|
// src/lib/settings.ts
|
|
16
17
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -43,7 +44,7 @@ var readFile = () => {
|
|
|
43
44
|
return {};
|
|
44
45
|
}
|
|
45
46
|
try {
|
|
46
|
-
const data =
|
|
47
|
+
const data = parseJson(readFileSync(file, "utf-8"));
|
|
47
48
|
return isJsonObject(data) ? data : {};
|
|
48
49
|
} catch {
|
|
49
50
|
return {};
|
|
@@ -10,12 +10,13 @@ import {
|
|
|
10
10
|
installedFactoryVersion,
|
|
11
11
|
runFactory,
|
|
12
12
|
updateFactory
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-A556KALN.js";
|
|
14
|
+
import "./chunk-F42QKWBB.js";
|
|
15
|
+
import "./chunk-MBXCVCC4.js";
|
|
15
16
|
import "./chunk-5535KDYI.js";
|
|
16
17
|
import "./chunk-D2RF35HJ.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-RPSUFZAG.js";
|
|
19
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
20
|
import "./chunk-GKDUYJ7R.js";
|
|
20
21
|
export {
|
|
21
22
|
FACTORY_PACKAGE,
|
|
@@ -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
|
+
MANIFEST_CANDIDATES,
|
|
9
|
+
autoDetectManifest,
|
|
10
|
+
checkManifest,
|
|
11
|
+
defaultRoot,
|
|
12
|
+
fail,
|
|
13
|
+
getFlag,
|
|
14
|
+
getString,
|
|
15
|
+
main,
|
|
16
|
+
parseArgs,
|
|
17
|
+
writeJsonFile
|
|
18
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
19
|
+
import "./chunk-2SBBKY5C.js";
|
|
20
|
+
import "./chunk-GKDUYJ7R.js";
|
|
21
|
+
|
|
22
|
+
// src/commands/asset/manifest-check.ts
|
|
23
|
+
import { existsSync } from "node:fs";
|
|
24
|
+
var run = (argv) => {
|
|
25
|
+
main(() => {
|
|
26
|
+
const args = parseArgs([...argv], {
|
|
27
|
+
booleans: ["strict"],
|
|
28
|
+
values: ["json", "manifest", "root"]
|
|
29
|
+
});
|
|
30
|
+
const root = defaultRoot(getString(args, "root"));
|
|
31
|
+
if (!existsSync(root)) {
|
|
32
|
+
fail(`Root not found: ${root}`);
|
|
33
|
+
}
|
|
34
|
+
const manifest = getString(args, "manifest") ?? autoDetectManifest() ?? "";
|
|
35
|
+
if (manifest === "" || !existsSync(manifest)) {
|
|
36
|
+
fail(
|
|
37
|
+
`Manifest not found. Pass --manifest or create one of: ${MANIFEST_CANDIDATES.join(", ")}`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
const report = checkManifest(manifest, root);
|
|
41
|
+
console.log(`manifest paths: ${report.manifest_paths}`);
|
|
42
|
+
console.log(`actual pngs: ${report.actual_pngs}`);
|
|
43
|
+
console.log(`missing: ${report.missing.length}`);
|
|
44
|
+
for (const path of report.missing) {
|
|
45
|
+
console.log(` MISSING ${path}`);
|
|
46
|
+
}
|
|
47
|
+
console.log(`extra: ${report.extra.length}`);
|
|
48
|
+
for (const path of report.extra) {
|
|
49
|
+
console.log(` EXTRA ${path}`);
|
|
50
|
+
}
|
|
51
|
+
const json = getString(args, "json") ?? "";
|
|
52
|
+
if (json !== "") {
|
|
53
|
+
writeJsonFile(json, report);
|
|
54
|
+
}
|
|
55
|
+
if (getFlag(args, "strict") && report.missing.length + report.extra.length > 0) {
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
run
|
|
62
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
getString,
|
|
11
|
+
main,
|
|
12
|
+
parseArgs,
|
|
13
|
+
parseFrame,
|
|
14
|
+
probeSheet,
|
|
15
|
+
resolveTargets,
|
|
16
|
+
writeJsonFile
|
|
17
|
+
} from "./chunk-2KVQJKIZ.js";
|
|
18
|
+
import "./chunk-2SBBKY5C.js";
|
|
19
|
+
import "./chunk-GKDUYJ7R.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/asset/sheet-probe.ts
|
|
22
|
+
var run = (argv) => {
|
|
23
|
+
main(() => {
|
|
24
|
+
const args = parseArgs([...argv], {
|
|
25
|
+
booleans: ["list", "show-empty"],
|
|
26
|
+
values: ["frame", "json"]
|
|
27
|
+
});
|
|
28
|
+
const [target = ""] = args.positionals;
|
|
29
|
+
if (target === "") {
|
|
30
|
+
failUsage("A PNG file or folder path is required.");
|
|
31
|
+
}
|
|
32
|
+
const frameSpec = getString(args, "frame") ?? "";
|
|
33
|
+
if (frameSpec === "") {
|
|
34
|
+
failUsage("--frame is required, e.g. --frame 32x32");
|
|
35
|
+
}
|
|
36
|
+
const frame = parseFrame(frameSpec);
|
|
37
|
+
const showEmpty = getFlag(args, "show-empty");
|
|
38
|
+
const results = resolveTargets(target).map((sheet) => probeSheet(sheet, frame, showEmpty));
|
|
39
|
+
for (const result of results) {
|
|
40
|
+
console.log(
|
|
41
|
+
`${result.path} grid=${result.grid.columns}x${result.grid.rows} non_empty=${result.non_empty.length} empty=${result.empty_count}`
|
|
42
|
+
);
|
|
43
|
+
if (getFlag(args, "list")) {
|
|
44
|
+
console.log(` non_empty=[${result.non_empty.map(([c, r]) => `(${c}, ${r})`).join(", ")}]`);
|
|
45
|
+
}
|
|
46
|
+
if (showEmpty) {
|
|
47
|
+
console.log(` empty=[${(result.empty ?? []).map(([c, r]) => `(${c}, ${r})`).join(", ")}]`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const json = getString(args, "json") ?? "";
|
|
51
|
+
if (json !== "") {
|
|
52
|
+
writeJsonFile(json, results);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
run
|
|
58
|
+
};
|