@vgai/engine 0.5.20 → 0.5.21

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.
@@ -10,6 +10,29 @@ export interface IngestGame2D {
10
10
  /** How long to wait for the game's first captured frame before failing. */
11
11
  captureTimeoutMs?: number;
12
12
  }
13
+ /**
14
+ * The game's own modules failed to load or run — a DIFFERENT defect from
15
+ * "loaded, but the host's pixi never saw a frame", and named so a caller can
16
+ * tell them apart.
17
+ *
18
+ * Both used to arrive as a bare `Error`, so `mount-canvas-ingest-root.ts`'s
19
+ * one catch reported a module that 404'd, threw, or failed to transform in
20
+ * the capture trap's words — "the host's pixi captured no frame ... or it
21
+ * bundles its own (un-shared) copy of pixi.js". That sentence sends the
22
+ * reader to the wrong file: it describes a module-identity problem, and the
23
+ * measured cause was a JSX-bearing `.js` module the packaged host had no
24
+ * transform for.
25
+ *
26
+ * Classified by `name` ({@link INGEST_GAME_2D_LOAD_ERROR_NAME}) rather than
27
+ * `instanceof` — under the packaged runtime the editor shell and the project
28
+ * graph can hold different instances of a module, and this whole lane exists
29
+ * because of that; a discriminator that silently flips when the class object
30
+ * differs is the wrong tool for saying which failure happened.
31
+ */
32
+ export declare const INGEST_GAME_2D_LOAD_ERROR_NAME = "IngestGame2DLoadError";
33
+ export declare class IngestGame2DLoadError extends Error {
34
+ constructor(gameId: string, cause: unknown);
35
+ }
13
36
  export interface IngestMount2D {
14
37
  /** The captured live stage Container. */
15
38
  stage: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/pixi/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AAEzB,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;I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G;AACH,eAAO,MAAM,8BAA8B,0BAA0B,CAAC;AAEtE,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAI3C;AAED,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE;IACJ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,KAAK,IAAI,CAAC;IACrD,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC;CACpD,GACL,OAAO,CAAC,aAAa,CAAC,CA6BxB"}
@@ -1,4 +1,30 @@
1
1
  import { installSceneCapture2D, } from './scene-capture';
2
+ /**
3
+ * The game's own modules failed to load or run — a DIFFERENT defect from
4
+ * "loaded, but the host's pixi never saw a frame", and named so a caller can
5
+ * tell them apart.
6
+ *
7
+ * Both used to arrive as a bare `Error`, so `mount-canvas-ingest-root.ts`'s
8
+ * one catch reported a module that 404'd, threw, or failed to transform in
9
+ * the capture trap's words — "the host's pixi captured no frame ... or it
10
+ * bundles its own (un-shared) copy of pixi.js". That sentence sends the
11
+ * reader to the wrong file: it describes a module-identity problem, and the
12
+ * measured cause was a JSX-bearing `.js` module the packaged host had no
13
+ * transform for.
14
+ *
15
+ * Classified by `name` ({@link INGEST_GAME_2D_LOAD_ERROR_NAME}) rather than
16
+ * `instanceof` — under the packaged runtime the editor shell and the project
17
+ * graph can hold different instances of a module, and this whole lane exists
18
+ * because of that; a discriminator that silently flips when the class object
19
+ * differs is the wrong tool for saying which failure happened.
20
+ */
21
+ export const INGEST_GAME_2D_LOAD_ERROR_NAME = 'IngestGame2DLoadError';
22
+ export class IngestGame2DLoadError extends Error {
23
+ constructor(gameId, cause) {
24
+ super(`pixi ingest: game "${gameId}" failed to load: ${cause}`, { cause });
25
+ this.name = INGEST_GAME_2D_LOAD_ERROR_NAME;
26
+ }
27
+ }
2
28
  /**
3
29
  * Mount an UNMODIFIED PixiJS game via the shared-instance capture path — the 2D
4
30
  * analog of `mountIngestGame`. Installs the render trap on the host's pixi
@@ -21,7 +47,7 @@ export async function mountIngestGame2D(pixiNamespace, game, opts = {}) {
21
47
  }
22
48
  catch (err) {
23
49
  capture.uninstall();
24
- throw new Error(`pixi ingest: game "${game.id}" failed to load: ${err}`);
50
+ throw new IngestGame2DLoadError(game.id, err);
25
51
  }
26
52
  const timeout = opts.captureTimeoutMs ?? game.captureTimeoutMs ?? 8000;
27
53
  try {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vgai/engine",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.5.20",
5
+ "version": "0.5.21",
6
6
  "description": "Readable TypeScript game engine and universal host for Three.js, PixiJS, and React games.",
7
7
  "keywords": [
8
8
  "game-engine",
@@ -16,6 +16,34 @@ export interface IngestGame2D {
16
16
  captureTimeoutMs?: number;
17
17
  }
18
18
 
19
+ /**
20
+ * The game's own modules failed to load or run — a DIFFERENT defect from
21
+ * "loaded, but the host's pixi never saw a frame", and named so a caller can
22
+ * tell them apart.
23
+ *
24
+ * Both used to arrive as a bare `Error`, so `mount-canvas-ingest-root.ts`'s
25
+ * one catch reported a module that 404'd, threw, or failed to transform in
26
+ * the capture trap's words — "the host's pixi captured no frame ... or it
27
+ * bundles its own (un-shared) copy of pixi.js". That sentence sends the
28
+ * reader to the wrong file: it describes a module-identity problem, and the
29
+ * measured cause was a JSX-bearing `.js` module the packaged host had no
30
+ * transform for.
31
+ *
32
+ * Classified by `name` ({@link INGEST_GAME_2D_LOAD_ERROR_NAME}) rather than
33
+ * `instanceof` — under the packaged runtime the editor shell and the project
34
+ * graph can hold different instances of a module, and this whole lane exists
35
+ * because of that; a discriminator that silently flips when the class object
36
+ * differs is the wrong tool for saying which failure happened.
37
+ */
38
+ export const INGEST_GAME_2D_LOAD_ERROR_NAME = 'IngestGame2DLoadError';
39
+
40
+ export class IngestGame2DLoadError extends Error {
41
+ constructor(gameId: string, cause: unknown) {
42
+ super(`pixi ingest: game "${gameId}" failed to load: ${cause}`, { cause });
43
+ this.name = INGEST_GAME_2D_LOAD_ERROR_NAME;
44
+ }
45
+ }
46
+
19
47
  export interface IngestMount2D {
20
48
  /** The captured live stage Container. */
21
49
  stage: unknown;
@@ -53,7 +81,7 @@ export async function mountIngestGame2D(
53
81
  await game.load();
54
82
  } catch (err) {
55
83
  capture.uninstall();
56
- throw new Error(`pixi ingest: game "${game.id}" failed to load: ${err}`);
84
+ throw new IngestGame2DLoadError(game.id, err);
57
85
  }
58
86
 
59
87
  const timeout = opts.captureTimeoutMs ?? game.captureTimeoutMs ?? 8000;