vibedgames 0.6.3 → 0.8.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 +14 -9
- package/dist/THIRD_PARTY_NOTICES.txt +383 -0
- package/dist/chunk-2QBYTIMH.js +511 -0
- package/dist/chunk-6FZPPUQH.js +107 -0
- package/dist/chunk-AZGENOOR.js +22 -0
- package/dist/chunk-CAKBGDCY.js +47 -0
- package/dist/chunk-CU7UY5YJ.js +1108 -0
- package/dist/chunk-CZPKN32Z.js +257 -0
- package/dist/chunk-FL6IFBUF.js +22 -0
- package/dist/chunk-FNYBZNW2.js +165 -0
- package/dist/chunk-GUF6ADBF.js +273 -0
- package/dist/chunk-H4NBRFBY.js +79 -0
- package/dist/chunk-HASKWB6B.js +111 -0
- package/dist/chunk-I6O4HIDY.js +1063 -0
- package/dist/chunk-IO6OM6WM.js +466 -0
- package/dist/chunk-J6PKNPI2.js +26 -0
- package/dist/chunk-JT2AU24K.js +759 -0
- package/dist/chunk-K5SC6SXO.js +172 -0
- package/dist/chunk-MBXCVCC4.js +478 -0
- package/dist/chunk-PEUP4MZR.js +59 -0
- package/dist/chunk-PQDBCZRT.js +2017 -0
- package/dist/chunk-RIGKOLNN.js +1360 -0
- package/dist/chunk-RNBUX5VF.js +68 -0
- package/dist/chunk-RYFO3ZPO.js +71 -0
- package/dist/chunk-RZ4DIJQW.js +68 -0
- package/dist/chunk-SAANBZ25.js +118 -0
- package/dist/chunk-TMK6V5FV.js +395 -0
- package/dist/chunk-TYVYWBY6.js +69 -0
- package/dist/chunk-VFFOT7KD.js +2980 -0
- package/dist/chunk-W5XP4ZVU.js +159 -0
- package/dist/chunk-X4ZABSCN.js +415 -0
- package/dist/chunk-XDC7QGOF.js +32 -0
- package/dist/chunk-XK5RZQMX.js +1780 -0
- package/dist/chunk-Y552BNFZ.js +41 -0
- package/dist/chunk-Z4Z24FWO.js +39 -0
- package/dist/chunk-ZI6PKVXG.js +64 -0
- package/dist/chunk-ZYCSYJWX.js +87 -0
- package/dist/index.js +67 -60
- package/package.json +13 -16
- package/templates/none/_gitignore +3 -0
- package/templates/none/index.html +29 -0
- package/templates/none/package.json +16 -0
- package/templates/none/src/main.ts +16 -0
- package/templates/none/tsconfig.json +18 -0
- package/templates/none/vite.config.ts +8 -0
- package/templates/phaser/_gitignore +3 -0
- package/templates/phaser/index.html +24 -0
- package/templates/phaser/package.json +19 -0
- package/templates/phaser/src/main.ts +16 -0
- package/templates/phaser/src/scenes/game-scene.ts +65 -0
- package/templates/phaser/tsconfig.json +18 -0
- package/templates/phaser/vite.config.ts +8 -0
- package/templates/react-r3f/_gitignore +3 -0
- package/templates/react-r3f/index.html +24 -0
- package/templates/react-r3f/package.json +27 -0
- package/templates/react-r3f/src/app.tsx +33 -0
- package/templates/react-r3f/src/main.tsx +15 -0
- package/templates/react-r3f/tsconfig.json +19 -0
- package/templates/react-r3f/vite.config.ts +10 -0
- package/templates/threejs/_gitignore +3 -0
- package/templates/threejs/index.html +36 -0
- package/templates/threejs/package.json +20 -0
- package/templates/threejs/src/main.ts +44 -0
- package/templates/threejs/tsconfig.json +18 -0
- package/templates/threejs/vite.config.ts +8 -0
- package/dist/commands/completions.d.ts +0 -7
- package/dist/commands/completions.js +0 -145
- package/dist/commands/credits.d.ts +0 -10
- package/dist/commands/credits.js +0 -136
- package/dist/commands/deploy.d.ts +0 -26
- package/dist/commands/deploy.js +0 -257
- package/dist/commands/factory.d.ts +0 -3
- package/dist/commands/factory.js +0 -73
- package/dist/commands/fork.d.ts +0 -29
- package/dist/commands/fork.js +0 -124
- package/dist/commands/generate.d.ts +0 -1
- package/dist/commands/generate.js +0 -565
- package/dist/commands/init.d.ts +0 -20
- package/dist/commands/init.js +0 -105
- package/dist/commands/login.d.ts +0 -1
- package/dist/commands/login.js +0 -45
- package/dist/commands/logout.d.ts +0 -1
- package/dist/commands/logout.js +0 -13
- package/dist/commands/new.d.ts +0 -26
- package/dist/commands/new.js +0 -318
- package/dist/commands/playtest-run.d.ts +0 -66
- package/dist/commands/playtest-run.js +0 -268
- package/dist/commands/playtest.d.ts +0 -76
- package/dist/commands/playtest.js +0 -372
- package/dist/commands/update.d.ts +0 -13
- package/dist/commands/update.js +0 -82
- package/dist/commands/whoami.d.ts +0 -10
- package/dist/commands/whoami.js +0 -44
- package/dist/index.d.ts +0 -2
- package/dist/lib/api.d.ts +0 -18
- package/dist/lib/api.js +0 -27
- package/dist/lib/archive.d.ts +0 -17
- package/dist/lib/archive.js +0 -228
- package/dist/lib/codex.d.ts +0 -117
- package/dist/lib/codex.js +0 -426
- package/dist/lib/config-file.d.ts +0 -16
- package/dist/lib/config-file.js +0 -54
- package/dist/lib/config.d.ts +0 -11
- package/dist/lib/config.js +0 -54
- package/dist/lib/manifest.d.ts +0 -10
- package/dist/lib/manifest.js +0 -91
- package/dist/lib/media-args.d.ts +0 -30
- package/dist/lib/media-args.js +0 -219
- package/dist/lib/media-download.d.ts +0 -37
- package/dist/lib/media-download.js +0 -268
- package/dist/lib/media-poll.d.ts +0 -18
- package/dist/lib/media-poll.js +0 -86
- package/dist/lib/media-upload.d.ts +0 -12
- package/dist/lib/media-upload.js +0 -52
- package/dist/lib/output.d.ts +0 -68
- package/dist/lib/output.js +0 -102
- package/dist/lib/package-manager.d.ts +0 -25
- package/dist/lib/package-manager.js +0 -77
- package/dist/lib/playtest/agent.d.ts +0 -192
- package/dist/lib/playtest/agent.js +0 -652
- package/dist/lib/playtest/browser.d.ts +0 -109
- package/dist/lib/playtest/browser.js +0 -219
- package/dist/lib/playtest/controls.d.ts +0 -47
- package/dist/lib/playtest/controls.js +0 -218
- package/dist/lib/playtest/errors.d.ts +0 -9
- package/dist/lib/playtest/errors.js +0 -12
- package/dist/lib/playtest/keys.d.ts +0 -41
- package/dist/lib/playtest/keys.js +0 -157
- package/dist/lib/playtest/run.d.ts +0 -195
- package/dist/lib/playtest/run.js +0 -409
- package/dist/lib/run.d.ts +0 -19
- package/dist/lib/run.js +0 -23
- package/dist/lib/strict-args.d.ts +0 -27
- package/dist/lib/strict-args.js +0 -78
- package/dist/lib/types.d.ts +0 -16
- package/dist/lib/types.js +0 -10
- package/dist/lib/update.d.ts +0 -10
- package/dist/lib/update.js +0 -110
- package/dist/lib/upload.d.ts +0 -16
- package/dist/lib/upload.js +0 -41
package/dist/lib/update.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { getConfigDir } from "./config.js";
|
|
4
|
-
import { isJsonNumber, isJsonObject, isJsonString } from "./types.js";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
7
|
-
const VERSION_RE = /^\d+\.\d+\.\d+$/u;
|
|
8
|
-
const getCachePath = () => path.join(getConfigDir(), "update-check.json");
|
|
9
|
-
const getLastCheckedAt = () => {
|
|
10
|
-
const cache = getCachePath();
|
|
11
|
-
if (!existsSync(cache)) {
|
|
12
|
-
return 0;
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const data = JSON.parse(readFileSync(cache, "utf-8"));
|
|
16
|
-
if (isJsonObject(data)) {
|
|
17
|
-
const ts = data.lastCheckedAt;
|
|
18
|
-
if (isJsonNumber(ts)) {
|
|
19
|
-
return ts;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
// corrupt cache — treat as never checked
|
|
25
|
-
}
|
|
26
|
-
return 0;
|
|
27
|
-
};
|
|
28
|
-
export const markUpdateChecked = () => {
|
|
29
|
-
const dir = getConfigDir();
|
|
30
|
-
try {
|
|
31
|
-
if (!existsSync(dir)) {
|
|
32
|
-
mkdirSync(dir, { mode: 0o700, recursive: true });
|
|
33
|
-
}
|
|
34
|
-
writeFileSync(getCachePath(), JSON.stringify({ lastCheckedAt: Date.now() }, null, 2));
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
// best-effort; worst case we check again next run
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
export const isNewerVersion = (latest, current) => {
|
|
41
|
-
if (!VERSION_RE.test(latest) || !VERSION_RE.test(current)) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
const a = latest.split(".").map(Number);
|
|
45
|
-
const b = current.split(".").map(Number);
|
|
46
|
-
for (let i = 0; i < 3; i += 1) {
|
|
47
|
-
const left = a[i] ?? 0;
|
|
48
|
-
const right = b[i] ?? 0;
|
|
49
|
-
if (left > right) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
if (left < right) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
};
|
|
58
|
-
export const fetchLatestVersion = async () => {
|
|
59
|
-
const registry = process.env.VG_REGISTRY_URL ?? "https://registry.npmjs.org";
|
|
60
|
-
try {
|
|
61
|
-
const res = await fetch(`${registry}/vibedgames/latest`, {
|
|
62
|
-
signal: AbortSignal.timeout(5000),
|
|
63
|
-
});
|
|
64
|
-
if (!res.ok) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
// SAFETY: res.json() is JSON.parse of the response body, which is
|
|
68
|
-
// structurally JsonValue.
|
|
69
|
-
const data = (await res.json());
|
|
70
|
-
if (isJsonObject(data)) {
|
|
71
|
-
const { version } = data;
|
|
72
|
-
if (isJsonString(version)) {
|
|
73
|
-
return version;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
// offline or registry down — skip this round
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Fire-and-forget background update: at most once per day (and never in CI
|
|
84
|
-
* or with VG_NO_AUTO_UPDATE set), re-invoke this CLI as a detached
|
|
85
|
-
* `vg update --auto`, which only applies anything when npm has a newer
|
|
86
|
-
* version. The foreground command pays no latency and prints nothing.
|
|
87
|
-
*/
|
|
88
|
-
export const maybeScheduleAutoUpdate = () => {
|
|
89
|
-
if (process.env.VG_NO_AUTO_UPDATE || process.env.CI) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const [, script] = process.argv;
|
|
93
|
-
if (!script) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (Date.now() - getLastCheckedAt() < CHECK_INTERVAL_MS) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
markUpdateChecked();
|
|
100
|
-
try {
|
|
101
|
-
const child = spawn(process.execPath, [script, "update", "--auto"], {
|
|
102
|
-
detached: true,
|
|
103
|
-
stdio: "ignore",
|
|
104
|
-
});
|
|
105
|
-
child.unref();
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
// best-effort; worst case we try again next run
|
|
109
|
-
}
|
|
110
|
-
};
|
package/dist/lib/upload.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ManifestFile } from "./manifest.js";
|
|
2
|
-
export interface UploadTarget {
|
|
3
|
-
path: string;
|
|
4
|
-
url: string;
|
|
5
|
-
headers: Record<string, string>;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Upload all files to their presigned PUT URLs with bounded concurrency.
|
|
9
|
-
* Throws on the first non-2xx response.
|
|
10
|
-
*/
|
|
11
|
-
export declare const uploadAll: ({ files, uploads, concurrency, onProgress, }: {
|
|
12
|
-
files: ManifestFile[];
|
|
13
|
-
uploads: UploadTarget[];
|
|
14
|
-
concurrency?: number;
|
|
15
|
-
onProgress?: (done: number, total: number) => void;
|
|
16
|
-
}) => Promise<void>;
|
package/dist/lib/upload.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
/**
|
|
3
|
-
* Upload all files to their presigned PUT URLs with bounded concurrency.
|
|
4
|
-
* Throws on the first non-2xx response.
|
|
5
|
-
*/
|
|
6
|
-
export const uploadAll = async ({ files, uploads, concurrency = 6, onProgress, }) => {
|
|
7
|
-
const byPath = new Map(files.map((f) => [f.path, f]));
|
|
8
|
-
let done = 0;
|
|
9
|
-
let cursor = 0;
|
|
10
|
-
const worker = async () => {
|
|
11
|
-
while (true) {
|
|
12
|
-
const idx = cursor;
|
|
13
|
-
cursor += 1;
|
|
14
|
-
if (idx >= uploads.length) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const upload = uploads[idx];
|
|
18
|
-
if (!upload) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const file = byPath.get(upload.path);
|
|
22
|
-
if (!file) {
|
|
23
|
-
throw new Error(`Missing file for upload target: ${upload.path}`);
|
|
24
|
-
}
|
|
25
|
-
const body = readFileSync(file.absolutePath);
|
|
26
|
-
const res = await fetch(upload.url, {
|
|
27
|
-
body,
|
|
28
|
-
headers: upload.headers,
|
|
29
|
-
method: "PUT",
|
|
30
|
-
});
|
|
31
|
-
if (!res.ok) {
|
|
32
|
-
const text = await res.text().catch(() => "");
|
|
33
|
-
throw new Error(`Upload failed for ${upload.path}: ${res.status} ${res.statusText} ${text}`);
|
|
34
|
-
}
|
|
35
|
-
done += 1;
|
|
36
|
-
onProgress?.(done, uploads.length);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const workers = Array.from({ length: Math.min(concurrency, uploads.length) }, () => worker());
|
|
40
|
-
await Promise.all(workers);
|
|
41
|
-
};
|