@bitmagic/cli 0.1.83-dev.6 → 0.1.83
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 +49 -7
- package/dist/bug-report/dev-view.d.ts +10 -0
- package/dist/bug-report/dev-view.js +35 -0
- package/dist/bug-report/dev-view.js.map +1 -0
- package/dist/bug-report/send.d.ts +54 -0
- package/dist/bug-report/send.js +143 -0
- package/dist/bug-report/send.js.map +1 -0
- package/dist/cli.d.ts +29 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/build.d.ts +4 -0
- package/dist/commands/build.js +20 -3
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/pages.d.ts +25 -0
- package/dist/commands/pages.js +87 -0
- package/dist/commands/pages.js.map +1 -0
- package/dist/commands/report-bug.d.ts +42 -0
- package/dist/commands/report-bug.js +98 -0
- package/dist/commands/report-bug.js.map +1 -0
- package/dist/commands/upgrade.d.ts +9 -2
- package/dist/commands/upgrade.js +27 -6
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/editor/bug-report-panel.d.ts +23 -0
- package/dist/editor/bug-report-panel.js +191 -0
- package/dist/editor/bug-report-panel.js.map +1 -0
- package/dist/editor/hud-replay-page.d.ts +9 -0
- package/dist/editor/hud-replay-page.js +11 -1
- package/dist/editor/hud-replay-page.js.map +1 -1
- package/dist/editor/server.js +54 -1
- package/dist/editor/server.js.map +1 -1
- package/dist/editor/shell-page.js +11 -0
- package/dist/editor/shell-page.js.map +1 -1
- package/dist/project/context.d.ts +7 -0
- package/dist/project/context.js.map +1 -1
- package/dist/publish/bundle.d.ts +43 -0
- package/dist/publish/bundle.js +133 -29
- package/dist/publish/bundle.js.map +1 -1
- package/dist/publish/source-zip.d.ts +6 -0
- package/dist/publish/source-zip.js +1 -1
- package/dist/publish/source-zip.js.map +1 -1
- package/dist/scaffold/engine-capabilities.d.ts +4 -0
- package/dist/scaffold/engine-capabilities.js.map +1 -1
- package/dist/scaffold/game-migration.d.ts +25 -63
- package/dist/scaffold/game-migration.js +30 -439
- package/dist/scaffold/game-migration.js.map +1 -1
- package/dist/scaffold/github-pages.d.ts +83 -0
- package/dist/scaffold/github-pages.js +200 -0
- package/dist/scaffold/github-pages.js.map +1 -0
- package/dist/scaffold/import-codemod.d.ts +4 -3
- package/dist/scaffold/import-codemod.js +16 -34
- package/dist/scaffold/import-codemod.js.map +1 -1
- package/dist/scaffold/project-files.d.ts +11 -0
- package/dist/scaffold/project-files.js +21 -8
- package/dist/scaffold/project-files.js.map +1 -1
- package/dist/scaffold/skill-files.js +34 -3
- package/dist/scaffold/skill-files.js.map +1 -1
- package/dist/vendor/hud-theme/engine/hud/fonts.js +6 -4
- package/package.json +6 -6
- package/dist/scaffold/legacy-game-baselines.d.ts +0 -14
- package/dist/scaffold/legacy-game-baselines.js +0 -218
- package/dist/scaffold/legacy-game-baselines.js.map +0 -1
|
@@ -30,6 +30,13 @@ export interface ProjectMetadata {
|
|
|
30
30
|
* `readRecordedAgents` does the narrowing, and reports what it dropped.
|
|
31
31
|
*/
|
|
32
32
|
agents?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Where a GitHub Pages build (`bitmagic build --pages`) loads the engine's own files from:
|
|
35
|
+
* `"bitmagic-cdn"` (the default when absent), `"github-pages"` (the open engine's asset site,
|
|
36
|
+
* useful only once that site exists), or a root URL of a self-hosted copy. Typed `unknown`
|
|
37
|
+
* because this file is hand-editable; `pagesAssetHostMeta` in scaffold/github-pages.ts parses it.
|
|
38
|
+
*/
|
|
39
|
+
pagesHosting?: unknown;
|
|
33
40
|
}
|
|
34
41
|
export interface ProjectContext {
|
|
35
42
|
root: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/project/context.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,gGAAgG;AAChG,4CAA4C;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,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|
stderr?: boolean;
|
|
92
92
|
}): BuildManifest;
|
|
93
|
+
/** Where `bitmagic build --pages` puts its page, and the scratch directory it builds it from. */
|
|
94
|
+
export declare function pagesBundlePaths(root: string): {
|
|
95
|
+
dir: string;
|
|
96
|
+
htmlPath: string;
|
|
97
|
+
sourceDir: string;
|
|
98
|
+
};
|
|
99
|
+
/** What `bitmagic build --pages` made. Not recorded anywhere: nothing reuses a Pages build. */
|
|
100
|
+
export interface PagesBuildResult {
|
|
101
|
+
htmlPath: string;
|
|
102
|
+
/** Whether three.js, Rapier and the other CDN packages are inlined (`--single-file`). */
|
|
103
|
+
singleFile: boolean;
|
|
104
|
+
/** The `bm:asset-host` meta the page carries, or null: the Bitmagic CDN through the platform. */
|
|
105
|
+
assetHost: string | null;
|
|
106
|
+
bytes: number;
|
|
107
|
+
sha256: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The Vite config a Pages build runs: the project's own vendored publish config, with the static
|
|
111
|
+
* page as its input instead of the project's `index.html`. Everything else (aliases, the CDN
|
|
112
|
+
* table, `__BUNDLED__`, the Rapier stub, the licence banner, single-file output) is the vendored
|
|
113
|
+
* config's, so a Pages page ships exactly what a publish ships around a different entry module.
|
|
114
|
+
*
|
|
115
|
+
* Generated next to the page for each build rather than vendored, so the vendored configs stay
|
|
116
|
+
* byte-identical in every project and a project on an older scaffold needs no upgrade for it. Vite
|
|
117
|
+
* bundles a config's relative imports, which is how this file reaches the vendored one.
|
|
118
|
+
*/
|
|
119
|
+
export declare function renderPagesViteConfig(baseConfigFile: string, inputHtml: string): string;
|
|
120
|
+
/**
|
|
121
|
+
* `bitmagic build --pages`: compile and bundle the project into `.bitmagic/pages/index.html`, the
|
|
122
|
+
* STATIC page the GitHub Pages workflow deploys (`scaffold/github-pages.ts`).
|
|
123
|
+
*
|
|
124
|
+
* The page differs from the publish bundle in its entry and its metas only: it boots
|
|
125
|
+
* `bitmagic/boot-static.js` (no platform services, so nothing calls api-server or game-server from
|
|
126
|
+
* a `*.github.io` origin) and declares `bm:platform` `bitmagic-static`, plus `bm:asset-host` for a
|
|
127
|
+
* non-default `pagesHosting`. It never touches `.bitmagic/build/`, whose manifest `publish` reuses.
|
|
128
|
+
*
|
|
129
|
+
* An engine without `staticPage` is refused before the compile, as is an unreadable `pagesHosting`.
|
|
130
|
+
*/
|
|
131
|
+
export declare function runPagesBuild(root: string, options?: {
|
|
132
|
+
singleFile?: boolean;
|
|
133
|
+
stderr?: boolean;
|
|
134
|
+
pagesHosting?: unknown;
|
|
135
|
+
}): PagesBuildResult;
|
package/dist/publish/bundle.js
CHANGED
|
@@ -7,6 +7,9 @@ import { projectBin } from '../project/context.js';
|
|
|
7
7
|
import { spawnBinSync } from '../project/spawn-bin.js';
|
|
8
8
|
import { computeFingerprint } from './fingerprint.js';
|
|
9
9
|
import { describeDevOnlyThreeUses, scanWorkForDevOnlyThree } from '../project/published-three.js';
|
|
10
|
+
import { readEngineCapabilities } from '../scaffold/engine-capabilities.js';
|
|
11
|
+
import { PAGES_OUTPUT_DIR, pagesAssetHostMeta, requireStaticPageEngine, } from '../scaffold/github-pages.js';
|
|
12
|
+
import { renderIndexHtml } from '../scaffold/project-files.js';
|
|
10
13
|
/**
|
|
11
14
|
* The configs the scaffold vendors alongside `engine/`, one per bundle mode.
|
|
12
15
|
*
|
|
@@ -103,38 +106,22 @@ export function isCurrentBundle(root, fingerprint, singleFile) {
|
|
|
103
106
|
return createHash('sha256').update(contents).digest('hex') === manifest.sha256;
|
|
104
107
|
}
|
|
105
108
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* same object to confirm the meta block, so there is nowhere for a second file to go. What the
|
|
110
|
-
* mode changes is what is INSIDE it: by default the engine, the game and its data are inlined
|
|
111
|
-
* while three.js, Rapier and the other CDN packages are fetched at runtime, matching what the
|
|
112
|
-
* Creator publishes; `singleFile` inlines those too, for a game that must run with no network.
|
|
113
|
-
*
|
|
114
|
-
* Exit code 1 on failure, matching the table in the spec: a build failure is the creator's own
|
|
115
|
-
* code, and the compiler's output has already been printed.
|
|
116
|
-
*
|
|
117
|
-
* The pre-flight below runs BEFORE `tsc`, not after: a project scaffolded before the config it
|
|
118
|
-
* needs existed has none for vite to load, and without this check the creator pays a full
|
|
119
|
-
* type-check and then reads a raw vite "config not found" that names no remedy. `bitmagic upgrade`
|
|
120
|
-
* is the remedy — it vendors the file without touching game code — so the error says so. It names
|
|
121
|
-
* the config for the mode actually asked for, since a project can easily have one and not the
|
|
122
|
-
* other: the standalone config was added later than the default one.
|
|
123
|
-
*/
|
|
124
|
-
export function runBuild(root, engineVersion,
|
|
125
|
-
/**
|
|
126
|
-
* `stderr: true` sends the compiler's and bundler's own chatter to stderr instead of inheriting
|
|
127
|
-
* stdout — a `--json` run must keep stdout clean for its single result document.
|
|
109
|
+
* The pre-flight every bundle mode shares. It runs BEFORE `tsc`, not after: a project scaffolded
|
|
110
|
+
* before the config it needs existed has none for vite to load, and without this check the creator
|
|
111
|
+
* pays a full type-check and then reads a raw vite "config not found" that names no remedy.
|
|
128
112
|
*/
|
|
129
|
-
|
|
130
|
-
const singleFile = options.singleFile === true;
|
|
131
|
-
const configFile = publishConfigFor(singleFile);
|
|
113
|
+
function requirePublishConfig(root, configFile) {
|
|
132
114
|
if (!fs.existsSync(path.join(root, configFile))) {
|
|
133
115
|
throw new CliError(`This project has no ${configFile}, which \`bitmagic build\` needs to bundle it. ` +
|
|
134
116
|
'It was added to the scaffold after this project was created — run `bitmagic upgrade` to ' +
|
|
135
117
|
'vendor it (your game code is not touched), then build again.', 1);
|
|
136
118
|
}
|
|
137
|
-
|
|
119
|
+
}
|
|
120
|
+
function buildStdio(options) {
|
|
121
|
+
return options.stderr === true ? ['ignore', 2, 2] : 'inherit';
|
|
122
|
+
}
|
|
123
|
+
/** `tsc`, then the dev-only three.js scan: what has to pass before anything is bundled. */
|
|
124
|
+
function compileForBundle(root, stdio) {
|
|
138
125
|
const tsc = projectBin(root, 'tsc');
|
|
139
126
|
const compile = spawnBinSync(tsc, [], { cwd: root, stdio });
|
|
140
127
|
if (compile.error)
|
|
@@ -146,8 +133,8 @@ options = {}) {
|
|
|
146
133
|
const devOnlyThree = scanWorkForDevOnlyThree(root);
|
|
147
134
|
if (devOnlyThree.length > 0)
|
|
148
135
|
throw new CliError(`Build failed. ${describeDevOnlyThreeUses(devOnlyThree)}`, 1);
|
|
149
|
-
|
|
150
|
-
|
|
136
|
+
}
|
|
137
|
+
function bundleWithVite(root, configFile, outDir, stdio) {
|
|
151
138
|
const vite = projectBin(root, 'vite');
|
|
152
139
|
// Covers `bitmagic build`, `bitmagic publish` and `bitmagic ios` in one
|
|
153
140
|
// place: the vendored configs read BUNDLE_RAPIER_FLAVOR and stub the Rapier
|
|
@@ -155,7 +142,7 @@ options = {}) {
|
|
|
155
142
|
// variable is OWNED here — an inherited value from the caller's shell never
|
|
156
143
|
// overrides the game's own physics mode.
|
|
157
144
|
const bundleEnv = { ...process.env, BUNDLE_RAPIER_FLAVOR: resolveRapierFlavor(root) };
|
|
158
|
-
const bundle = spawnBinSync(vite, ['build', '--config', configFile, '--outDir',
|
|
145
|
+
const bundle = spawnBinSync(vite, ['build', '--config', configFile, '--outDir', outDir, '--emptyOutDir'], {
|
|
159
146
|
cwd: root,
|
|
160
147
|
stdio,
|
|
161
148
|
env: bundleEnv,
|
|
@@ -164,6 +151,40 @@ options = {}) {
|
|
|
164
151
|
throw new CliError(`Could not run vite: ${bundle.error.message}`, 1);
|
|
165
152
|
if (bundle.status !== 0)
|
|
166
153
|
throw new CliError('Build failed: the bundle did not complete.', 1);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Compile and bundle the project into one HTML file, and record what was built.
|
|
157
|
+
*
|
|
158
|
+
* One file either way — `bitmagic publish` PUTs a single object and api-server range-reads that
|
|
159
|
+
* same object to confirm the meta block, so there is nowhere for a second file to go. What the
|
|
160
|
+
* mode changes is what is INSIDE it: by default the engine, the game and its data are inlined
|
|
161
|
+
* while three.js, Rapier and the other CDN packages are fetched at runtime, matching what the
|
|
162
|
+
* Creator publishes; `singleFile` inlines those too, for a game that must run with no network.
|
|
163
|
+
*
|
|
164
|
+
* Exit code 1 on failure, matching the table in the spec: a build failure is the creator's own
|
|
165
|
+
* code, and the compiler's output has already been printed.
|
|
166
|
+
*
|
|
167
|
+
* The pre-flight below runs BEFORE `tsc`, not after: a project scaffolded before the config it
|
|
168
|
+
* needs existed has none for vite to load, and without this check the creator pays a full
|
|
169
|
+
* type-check and then reads a raw vite "config not found" that names no remedy. `bitmagic upgrade`
|
|
170
|
+
* is the remedy — it vendors the file without touching game code — so the error says so. It names
|
|
171
|
+
* the config for the mode actually asked for, since a project can easily have one and not the
|
|
172
|
+
* other: the standalone config was added later than the default one.
|
|
173
|
+
*/
|
|
174
|
+
export function runBuild(root, engineVersion,
|
|
175
|
+
/**
|
|
176
|
+
* `stderr: true` sends the compiler's and bundler's own chatter to stderr instead of inheriting
|
|
177
|
+
* stdout — a `--json` run must keep stdout clean for its single result document.
|
|
178
|
+
*/
|
|
179
|
+
options = {}) {
|
|
180
|
+
const singleFile = options.singleFile === true;
|
|
181
|
+
const configFile = publishConfigFor(singleFile);
|
|
182
|
+
requirePublishConfig(root, configFile);
|
|
183
|
+
const stdio = buildStdio(options);
|
|
184
|
+
compileForBundle(root, stdio);
|
|
185
|
+
const { dir, htmlPath } = buildBundlePaths(root);
|
|
186
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
187
|
+
bundleWithVite(root, configFile, dir, stdio);
|
|
167
188
|
if (!fs.existsSync(htmlPath)) {
|
|
168
189
|
throw new CliError(`Build produced no ${path.relative(root, htmlPath)}. Check ${configFile}.`, 1);
|
|
169
190
|
}
|
|
@@ -179,4 +200,87 @@ options = {}) {
|
|
|
179
200
|
writeBuildManifest(root, manifest);
|
|
180
201
|
return manifest;
|
|
181
202
|
}
|
|
203
|
+
/** Where `bitmagic build --pages` puts its page, and the scratch directory it builds it from. */
|
|
204
|
+
export function pagesBundlePaths(root) {
|
|
205
|
+
const dir = path.join(root, PAGES_OUTPUT_DIR);
|
|
206
|
+
return { dir, htmlPath: path.join(dir, 'index.html'), sourceDir: path.join(root, '.bitmagic', 'pages-src') };
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The Vite config a Pages build runs: the project's own vendored publish config, with the static
|
|
210
|
+
* page as its input instead of the project's `index.html`. Everything else (aliases, the CDN
|
|
211
|
+
* table, `__BUNDLED__`, the Rapier stub, the licence banner, single-file output) is the vendored
|
|
212
|
+
* config's, so a Pages page ships exactly what a publish ships around a different entry module.
|
|
213
|
+
*
|
|
214
|
+
* Generated next to the page for each build rather than vendored, so the vendored configs stay
|
|
215
|
+
* byte-identical in every project and a project on an older scaffold needs no upgrade for it. Vite
|
|
216
|
+
* bundles a config's relative imports, which is how this file reaches the vendored one.
|
|
217
|
+
*/
|
|
218
|
+
export function renderPagesViteConfig(baseConfigFile, inputHtml) {
|
|
219
|
+
return `// Generated by \`bitmagic build --pages\` for one build; never edit it, it is rewritten every time.
|
|
220
|
+
// The project's vendored ${baseConfigFile}, with the static GitHub Pages page as the input.
|
|
221
|
+
import base from '../../${baseConfigFile}';
|
|
222
|
+
|
|
223
|
+
export default {
|
|
224
|
+
...base,
|
|
225
|
+
build: {
|
|
226
|
+
...base.build,
|
|
227
|
+
rollupOptions: {
|
|
228
|
+
...base.build.rollupOptions,
|
|
229
|
+
input: ${JSON.stringify(inputHtml)},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
`;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* `bitmagic build --pages`: compile and bundle the project into `.bitmagic/pages/index.html`, the
|
|
237
|
+
* STATIC page the GitHub Pages workflow deploys (`scaffold/github-pages.ts`).
|
|
238
|
+
*
|
|
239
|
+
* The page differs from the publish bundle in its entry and its metas only: it boots
|
|
240
|
+
* `bitmagic/boot-static.js` (no platform services, so nothing calls api-server or game-server from
|
|
241
|
+
* a `*.github.io` origin) and declares `bm:platform` `bitmagic-static`, plus `bm:asset-host` for a
|
|
242
|
+
* non-default `pagesHosting`. It never touches `.bitmagic/build/`, whose manifest `publish` reuses.
|
|
243
|
+
*
|
|
244
|
+
* An engine without `staticPage` is refused before the compile, as is an unreadable `pagesHosting`.
|
|
245
|
+
*/
|
|
246
|
+
export function runPagesBuild(root, options = {}) {
|
|
247
|
+
const capabilities = readEngineCapabilities(path.join(root, 'engine'));
|
|
248
|
+
requireStaticPageEngine(capabilities);
|
|
249
|
+
const assetHost = pagesAssetHostMeta(options.pagesHosting);
|
|
250
|
+
const singleFile = options.singleFile === true;
|
|
251
|
+
const configFile = publishConfigFor(singleFile);
|
|
252
|
+
requirePublishConfig(root, configFile);
|
|
253
|
+
const stdio = buildStdio(options);
|
|
254
|
+
compileForBundle(root, stdio);
|
|
255
|
+
const { dir, htmlPath, sourceDir } = pagesBundlePaths(root);
|
|
256
|
+
fs.rmSync(sourceDir, { recursive: true, force: true });
|
|
257
|
+
fs.mkdirSync(sourceDir, { recursive: true });
|
|
258
|
+
const inputHtml = path.join(sourceDir, 'index.html');
|
|
259
|
+
fs.writeFileSync(inputHtml, renderIndexHtml({ capabilities, staticPage: { assetHost } }));
|
|
260
|
+
const pagesConfig = path.join(sourceDir, 'vite.pages.config.mjs');
|
|
261
|
+
fs.writeFileSync(pagesConfig, renderPagesViteConfig(configFile, inputHtml));
|
|
262
|
+
try {
|
|
263
|
+
bundleWithVite(root, path.relative(root, pagesConfig), dir, stdio);
|
|
264
|
+
// Vite writes an HTML input under its path relative to the root, so the page lands at
|
|
265
|
+
// <outDir>/.bitmagic/pages-src/index.html; Pages serves the directory's own index.html.
|
|
266
|
+
const inputRelative = path.relative(root, inputHtml);
|
|
267
|
+
const emitted = path.join(dir, inputRelative);
|
|
268
|
+
if (!fs.existsSync(emitted)) {
|
|
269
|
+
throw new CliError(`Build produced no ${path.relative(root, emitted)}. Check ${configFile}.`, 1);
|
|
270
|
+
}
|
|
271
|
+
fs.renameSync(emitted, htmlPath);
|
|
272
|
+
fs.rmSync(path.join(dir, inputRelative.split(path.sep)[0]), { recursive: true, force: true });
|
|
273
|
+
}
|
|
274
|
+
finally {
|
|
275
|
+
fs.rmSync(sourceDir, { recursive: true, force: true });
|
|
276
|
+
}
|
|
277
|
+
const contents = fs.readFileSync(htmlPath);
|
|
278
|
+
return {
|
|
279
|
+
htmlPath,
|
|
280
|
+
singleFile,
|
|
281
|
+
assetHost,
|
|
282
|
+
bytes: contents.byteLength,
|
|
283
|
+
sha256: createHash('sha256').update(contents).digest('hex'),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
182
286
|
//# sourceMappingURL=bundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/publish/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/publish/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAq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CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -26,6 +26,12 @@ export interface BuildSourceArchiveOptions {
|
|
|
26
26
|
index: SourceIndex;
|
|
27
27
|
gameId: string;
|
|
28
28
|
engineVersion: string;
|
|
29
|
+
/**
|
|
30
|
+
* Where to write the archive. Defaults to {@link sourceArchivePath}; `report-bug` passes its own
|
|
31
|
+
* so a bug report never replaces the archive the last publish left behind. Keep it inside
|
|
32
|
+
* `.bitmagic/`, for the same fingerprint reason.
|
|
33
|
+
*/
|
|
34
|
+
filePath?: string;
|
|
29
35
|
/** Injected so tests get a stable manifest; production passes the real clock. */
|
|
30
36
|
now?: () => Date;
|
|
31
37
|
}
|
|
@@ -110,7 +110,7 @@ export async function buildSourceArchive(options) {
|
|
|
110
110
|
omitted,
|
|
111
111
|
engineHashes: Object.fromEntries(index.files.filter((f) => f.engineSha256 !== undefined).map((f) => [f.path, f.engineSha256])),
|
|
112
112
|
};
|
|
113
|
-
const filePath = sourceArchivePath(root);
|
|
113
|
+
const filePath = options.filePath ?? sourceArchivePath(root);
|
|
114
114
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
115
115
|
const hash = createHash('sha256');
|
|
116
116
|
let bytes = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-zip.js","sourceRoot":"","sources":["../../src/publish/source-zip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,GAKlB,MAAM,qCAAqC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AI,CAAC,CAAC,CAAC,CAAC;YAClE,CAAC;YAED,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;QACxB,MAAM,IAAI,QAAQ,CAAC,yCAAyC,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AACpH,CAAC"}
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
* URL tables (`loadAnimationAssets`) pass that preset explicitly instead of taking the engine's
|
|
22
22
|
* default, which stops being Bitmagic's. Without it they import the module's `animationAssets`
|
|
23
23
|
* as they always have.
|
|
24
|
+
* - `staticPage`: the engine carries `bitmagic/boot-static.js`, the entry of the static page
|
|
25
|
+
* `bitmagic build --pages` builds for GitHub Pages (no platform services, the engine's files
|
|
26
|
+
* on the Bitmagic CDN). Without it `bitmagic pages init` and `build --pages` refuse with an
|
|
27
|
+
* upgrade hint (`requireStaticPageEngine` in `github-pages.ts`).
|
|
24
28
|
*/
|
|
25
29
|
export interface EngineCapabilities {
|
|
26
30
|
readonly [name: string]: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-capabilities.js","sourceRoot":"","sources":["../../src/scaffold/engine-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"engine-capabilities.js","sourceRoot":"","sources":["../../src/scaffold/engine-capabilities.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1E,MAAM,UAAU,mBAAmB,CACjC,YAAgC,EAChC,IAAY,EACZ,OAAO,GAAG,CAAC;IAEX,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,OAAO,CAAC;AACjD,CAAC"}
|
|
@@ -1,73 +1,19 @@
|
|
|
1
1
|
import type * as TS from 'typescript';
|
|
2
|
-
import { type
|
|
2
|
+
import { type GameMigrationOutcome } from '@bitmagic/asset-core/game-migration';
|
|
3
3
|
/**
|
|
4
|
-
* `bitmagic upgrade --migrate-game`:
|
|
5
|
-
* `class VoxelGame implements GameModule`
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* It only rewrites what it can prove:
|
|
10
|
-
*
|
|
11
|
-
* - a member identical (token for token, comments and layout ignored) to the same member in any
|
|
12
|
-
* released baseline is the default, and is dropped;
|
|
13
|
-
* - `constructor`, `load`, `update` and `dispose` may additionally carry the creator's own
|
|
14
|
-
* statements, but only inserted at a point a VoxelGameBase hook runs at — after the world
|
|
15
|
-
* (`onWorldLoaded`), after the camera (`onCameraReady`), after the player controller
|
|
16
|
-
* (`onPlayerReady`), at the end of a frame (`updateCamera`), beside the vehicles' disposal
|
|
17
|
-
* (`disposeGameplay`), or at the very start or end of the method — and each default statement
|
|
18
|
-
* must still be there, in order;
|
|
19
|
-
* - a modified `setupCamera` or `setupVoxelLighting` stays as an override (both are hooks now);
|
|
20
|
-
* - anything the creator added (fields, methods, top-level code) is kept as it is, with
|
|
21
|
-
* `this.spawner` / `this.vehicleSpawner` read through `getSpawner()` / `getVehicleSpawner()`.
|
|
22
|
-
*
|
|
23
|
-
* Anything else — a default statement removed or edited, a statement added where no hook runs,
|
|
24
|
-
* a changed member VoxelGameBase also declares — leaves the file unchanged and says why. The
|
|
25
|
-
* result is then type-checked with the project's own compiler and put back if it does not
|
|
26
|
-
* compile, so a migration that runs is one that compiles.
|
|
4
|
+
* `bitmagic upgrade --migrate-game`: rewrite a project's old `src/work/Game.ts` — a whole
|
|
5
|
+
* `class VoxelGame implements GameModule` (`GenreGameInterface` on older engines) — into the small `class VoxelGame extends VoxelGameBase`
|
|
6
|
+
* every game is now, keeping only what the creator changed. The rewrite itself, and what it can
|
|
7
|
+
* prove, is `@bitmagic/asset-core/game-migration` (the Creator agent's migration runs the same);
|
|
8
|
+
* this file runs it on a project and keeps the result only while the project type-checks.
|
|
27
9
|
*/
|
|
10
|
+
export type { GameMigrationOutcome } from '@bitmagic/asset-core/game-migration';
|
|
28
11
|
export declare const GAME_FILE = "src/work/Game.ts";
|
|
29
12
|
export declare const BASE_FILE = "src/work/VoxelGameBase.ts";
|
|
13
|
+
/** The step-by-step rewrite for the project's agent, when `--migrate-game` cannot prove one (vendored from game/agent-docs). */
|
|
14
|
+
export declare const GAME_MIGRATION_GUIDE = "engine/agent-docs/migrating-game-to-voxelgamebase.md";
|
|
30
15
|
/** The new baseline, as the engine just vendored it. */
|
|
31
16
|
export declare const VENDORED_BASELINE_DIR = "engine/baseline";
|
|
32
|
-
/** The methods whose bodies may carry insertions, and the gaps they may sit in. */
|
|
33
|
-
export type SegmentedMethod = 'constructor' | 'load' | 'update' | 'dispose';
|
|
34
|
-
export declare const SEGMENTED_METHODS: readonly SegmentedMethod[];
|
|
35
|
-
/** A statement or member compared by its tokens alone, so comments and layout never matter. */
|
|
36
|
-
export declare function fingerprint(ts: typeof TS, node: TS.Node, sf: TS.SourceFile): string;
|
|
37
|
-
/** What one Game.ts version contributes to the known defaults (the generator's half). */
|
|
38
|
-
export interface LegacyGameShape {
|
|
39
|
-
members: Record<string, string>;
|
|
40
|
-
bodies: Partial<Record<SegmentedMethod, LegacyBody>>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* The fingerprints of a pre-VoxelGameBase Game.ts — every member, plus the statement list and
|
|
44
|
-
* hook gaps of each segmented method. Null when the file has no such class. Run over every
|
|
45
|
-
* released baseline by `scripts/gen-legacy-game-baselines.mjs` to produce the known defaults.
|
|
46
|
-
*/
|
|
47
|
-
export declare function describeLegacyGame(ts: typeof TS, text: string): LegacyGameShape | null;
|
|
48
|
-
export type GameMigrationOutcome = {
|
|
49
|
-
status: 'migrated';
|
|
50
|
-
kept: string[];
|
|
51
|
-
hooks: string[];
|
|
52
|
-
wroteBase: boolean;
|
|
53
|
-
} | {
|
|
54
|
-
status: 'already-migrated';
|
|
55
|
-
} | {
|
|
56
|
-
status: 'skipped';
|
|
57
|
-
reason: string;
|
|
58
|
-
};
|
|
59
|
-
export interface PlanResult {
|
|
60
|
-
outcome: GameMigrationOutcome;
|
|
61
|
-
/** The new Game.ts, when the outcome is `migrated`. */
|
|
62
|
-
gameText?: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Plan the rewrite of one Game.ts against the new baseline: pure, reads nothing but its inputs.
|
|
66
|
-
*
|
|
67
|
-
* `newBaselineGame` is the vendored `engine/baseline/Game.ts` (the file a game with nothing of
|
|
68
|
-
* its own becomes, verbatim), `newBaseText` the vendored `VoxelGameBase.ts`.
|
|
69
|
-
*/
|
|
70
|
-
export declare function planGameMigration(ts: typeof TS, oldText: string, newBaselineGame: string, newBaseText: string): PlanResult;
|
|
71
17
|
export interface TypeCheckResult {
|
|
72
18
|
ok: boolean;
|
|
73
19
|
/** The compiler's output, for the report when it failed. */
|
|
@@ -78,6 +24,14 @@ export interface MigrateGameOptions {
|
|
|
78
24
|
ts: typeof TS;
|
|
79
25
|
/** Runs the project's type-check; the migration is kept only when it passes before and after. */
|
|
80
26
|
typeCheck: () => TypeCheckResult;
|
|
27
|
+
/**
|
|
28
|
+
* The engine's templates (`<slug>/source/Game.ts`), unpacked beside the engine an upgrade just
|
|
29
|
+
* fetched, and the project's own template from bitmagic.json. A game started from a template
|
|
30
|
+
* carries that template's whole class, so it is compared with the template's history and
|
|
31
|
+
* rebuilt on the template's Game.ts today.
|
|
32
|
+
*/
|
|
33
|
+
templatesDir?: string;
|
|
34
|
+
template?: string;
|
|
81
35
|
}
|
|
82
36
|
/**
|
|
83
37
|
* Migrate `src/work/Game.ts` onto VoxelGameBase in place: plan it, write the new Game.ts and the
|
|
@@ -86,3 +40,11 @@ export interface MigrateGameOptions {
|
|
|
86
40
|
* a failure afterwards could not be told apart from one it already had.
|
|
87
41
|
*/
|
|
88
42
|
export declare function migrateGameFile(options: MigrateGameOptions): GameMigrationOutcome;
|
|
43
|
+
/**
|
|
44
|
+
* Whether src/work/Game.ts is still the old baseline's whole class, which logs the GameEngine
|
|
45
|
+
* `set*` deprecation warnings on every load. A cheap text check for the hint `upgrade` prints
|
|
46
|
+
* when `--migrate-game` was not passed; the migration itself parses the file.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isLegacyGameFile(root: string): boolean;
|
|
49
|
+
/** The guide's project-relative path, or null on an engine that predates it. */
|
|
50
|
+
export declare function gameMigrationGuide(root: string): string | null;
|