@forgeax/engine-pack 0.1.3 → 0.1.4
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 +51 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/owner-chain.integration.test.d.ts +2 -0
- package/dist/__tests__/owner-chain.integration.test.d.ts.map +1 -0
- package/dist/__tests__/package-finalizer.contract.test.d.ts +2 -0
- package/dist/__tests__/package-finalizer.contract.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.browser.test.d.ts +2 -0
- package/dist/__tests__/runtime.browser.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-inventory.contract.test.d.ts +2 -0
- package/dist/__tests__/scanner-inventory.contract.test.d.ts.map +1 -0
- package/dist/artifact-path.mjs +53 -0
- package/dist/artifact-path.mjs.map +1 -0
- package/dist/atlas/shelf-pack.d.ts.map +1 -1
- package/dist/build.d.ts +17 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.mjs +10168 -0
- package/dist/build.mjs.map +1 -0
- package/dist/builtin.d.ts +20 -0
- package/dist/builtin.d.ts.map +1 -1
- package/dist/builtin.mjs +141 -0
- package/dist/builtin.mjs.map +1 -0
- package/dist/catalog-builder.d.ts +43 -0
- package/dist/catalog-builder.d.ts.map +1 -0
- package/dist/catalog-delta.d.ts +11 -0
- package/dist/catalog-delta.d.ts.map +1 -0
- package/dist/catalog-projection.d.ts +91 -0
- package/dist/catalog-projection.d.ts.map +1 -0
- package/dist/cli-asset.mjs +231 -484
- package/dist/cli-asset.mjs.map +1 -1
- package/dist/index.mjs +83 -1
- package/dist/index.mjs.map +1 -1
- package/dist/material-cook.d.ts +2 -0
- package/dist/material-cook.d.ts.map +1 -0
- package/dist/material-cook.mjs +193 -0
- package/dist/material-cook.mjs.map +1 -0
- package/dist/mesh-bin-contract.mjs +96 -0
- package/dist/mesh-bin-contract.mjs.map +1 -0
- package/dist/native-cooker-registry.d.ts +19 -0
- package/dist/native-cooker-registry.d.ts.map +1 -1
- package/dist/native-cooker.mjs +37 -0
- package/dist/native-cooker.mjs.map +1 -1
- package/dist/package-finalizer.d.ts +121 -0
- package/dist/package-finalizer.d.ts.map +1 -0
- package/dist/resolve-asset-source.d.ts.map +1 -1
- package/dist/resolve-asset-source.mjs +16 -6
- package/dist/resolve-asset-source.mjs.map +1 -1
- package/dist/runtime-publication.d.ts +44 -0
- package/dist/runtime-publication.d.ts.map +1 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.mjs +7261 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/scanner.d.ts +87 -54
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.mjs +258 -454
- package/dist/scanner.mjs.map +1 -1
- package/dist/scriptable-pack-node.d.ts +3 -8
- package/dist/scriptable-pack-node.d.ts.map +1 -1
- package/dist/scriptable-pack-node.mjs +93 -9
- package/dist/scriptable-pack-node.mjs.map +1 -1
- package/dist/scriptable-pack-worker.mjs +1 -0
- package/dist/scriptable-pack-worker.mjs.map +1 -1
- package/dist/scriptable-pack.d.ts +33 -0
- package/dist/scriptable-pack.d.ts.map +1 -1
- package/dist/scriptable-pack.mjs +91 -2
- package/dist/scriptable-pack.mjs.map +1 -1
- package/dist/topology.d.ts +1 -1
- package/dist/topology.d.ts.map +1 -1
- package/package.json +27 -2
- package/src/__tests__/mesh-bin-consumer-surface.unit.test.ts +2 -1
- package/src/__tests__/owner-chain.integration.test.ts +78 -0
- package/src/__tests__/package-finalizer.contract.test.ts +105 -0
- package/src/__tests__/runtime.browser.test.ts +15 -0
- package/src/__tests__/scanner-inventory.contract.test.ts +167 -0
- package/src/__tests__/scanner-inventory.test.ts +16 -12
- package/src/__tests__/scriptable-pack.unit.test.ts +42 -0
- package/src/atlas/shelf-pack.ts +20 -24
- package/src/build.ts +137 -0
- package/src/builtin.ts +38 -0
- package/src/catalog-builder.ts +313 -0
- package/src/catalog-delta.ts +189 -0
- package/src/catalog-projection.ts +344 -0
- package/src/cli-asset.ts +1 -5
- package/src/index.ts +2 -2
- package/src/material-cook.ts +13 -0
- package/src/native-cooker-registry.ts +72 -0
- package/src/package-finalizer.ts +394 -0
- package/src/resolve-asset-source.ts +2 -7
- package/src/runtime-publication.ts +190 -0
- package/src/runtime.ts +23 -0
- package/src/scanner.ts +289 -290
- package/src/scriptable-pack-node.ts +27 -23
- package/src/scriptable-pack-worker.ts +2 -0
- package/src/scriptable-pack.ts +123 -1
- package/src/topology.ts +2 -1
package/README.md
CHANGED
|
@@ -70,6 +70,25 @@ source.
|
|
|
70
70
|
|
|
71
71
|
Pack or external source plus Meta owns author facts. DDC and Catalog are derived projections; they are not author databases or write authorities.
|
|
72
72
|
|
|
73
|
+
## Engine builtin mesh descriptors
|
|
74
|
+
|
|
75
|
+
The Engine-owned primitive mesh identities are published from one UUIDv5 table
|
|
76
|
+
(`@forgeax/engine-pack/builtin`). A standalone DevKit build materializes only
|
|
77
|
+
the missing rows as an ordinary Pack v2 tuple; Geometry then derives the mesh
|
|
78
|
+
payload from the `procedural-*` token at load time.
|
|
79
|
+
|
|
80
|
+
| Descriptor | GUID source | Geometry token |
|
|
81
|
+
|:--|:--|:--|
|
|
82
|
+
| Cube | `HANDLE_CUBE` | `procedural-cube` |
|
|
83
|
+
| Triangle | `HANDLE_TRIANGLE` | `procedural-triangle` |
|
|
84
|
+
| Quad | `HANDLE_QUAD` | `procedural-quad` |
|
|
85
|
+
| Sphere | `HANDLE_SPHERE` | `procedural-sphere` |
|
|
86
|
+
| Nine-slice quad | `HANDLE_NINESLICE_QUAD` | `procedural-nine-slice-quad` |
|
|
87
|
+
| Cylinder | `HANDLE_CYLINDER` | `procedural-cylinder` |
|
|
88
|
+
|
|
89
|
+
This keeps the runtime registry generic while ensuring a packaged game can
|
|
90
|
+
resolve legacy scene references without a second process-static asset owner.
|
|
91
|
+
|
|
73
92
|
> [!IMPORTANT]
|
|
74
93
|
> The pack contract has one material authoring shape: a `MaterialAsset` payload. The cook stage resolves inheritance, values, texture coordinates, module references, artifact bytes, and a receipt into one record. Runtime consumers use the GUID and catalog locator; they do not author a second shader resource.
|
|
75
94
|
|
|
@@ -115,14 +134,26 @@ by a demo-side mesh substitute.
|
|
|
115
134
|
|
|
116
135
|
Build-time importers write source meta and producer receipts; the Vite plugin publishes the locator. Runtime packages consume the resulting Pack v2 bytes and must not import this Node-only evidence adapter. See [`packages/types/src/asset-evidence.ts`](../types/src/asset-evidence.ts) for the exact schema and closed errors.
|
|
117
136
|
|
|
137
|
+
Browser runtime code uses the focused Pack subpaths instead of the Node-oriented
|
|
138
|
+
root barrel. The root entry remains the build-time scanner/evidence surface.
|
|
139
|
+
|
|
140
|
+
| Runtime need | Browser-safe entry |
|
|
141
|
+
|:--|:--|
|
|
142
|
+
| Pack v2 validation and parsing | `@forgeax/engine-pack/runtime` |
|
|
143
|
+
| Artifact locator validation | `@forgeax/engine-pack/artifact-path` |
|
|
144
|
+
| Cooked material records | `@forgeax/engine-pack/material-cook` |
|
|
145
|
+
| Mesh wire facts | `@forgeax/engine-pack/mesh-bin-contract` |
|
|
146
|
+
|
|
118
147
|
## Quick start
|
|
119
148
|
|
|
120
149
|
### ScriptablePack source
|
|
121
150
|
|
|
122
|
-
Use `@forgeax/engine-pack/source` when one trusted TypeScript source declares and builds a multi-asset package. The definition owns `packageId`, every output `guid`, `sourceKey`, `kind`,
|
|
151
|
+
Use `@forgeax/engine-pack/source` when one trusted TypeScript source declares and builds a multi-asset package. The definition owns `packageId`, every output `guid`, `sourceKey`, `kind`, optional display `name`, and the scene component schema needed to externalize scene refs. `build(reader)` returns ordinary typed Assets keyed by the same `sourceKey` set; it cannot publish, mutate Catalog, or mint identity.
|
|
123
152
|
|
|
124
153
|
```ts
|
|
125
154
|
import type { ScriptablePackDefinition } from '@forgeax/engine-pack/source';
|
|
155
|
+
import { Camera } from '@forgeax/engine-render';
|
|
156
|
+
import { Transform } from '@forgeax/engine-scene';
|
|
126
157
|
|
|
127
158
|
export default {
|
|
128
159
|
schemaVersion: '1.0.0',
|
|
@@ -131,11 +162,18 @@ export default {
|
|
|
131
162
|
mesh: { guid: meshGuid, kind: 'mesh', name: 'Generated Mesh' },
|
|
132
163
|
scene: { guid: sceneGuid, kind: 'scene', name: 'Generated Scene' },
|
|
133
164
|
},
|
|
165
|
+
sceneComponents: [Transform, Camera],
|
|
134
166
|
externalAssets: { material: materialGuid },
|
|
135
167
|
build: async (assets) => ({ ok: true, value: { mesh, scene } }),
|
|
136
168
|
} satisfies ScriptablePackDefinition;
|
|
137
169
|
```
|
|
138
170
|
|
|
171
|
+
`sceneComponents` is optional for packs that never produce a `scene`. When a
|
|
172
|
+
scene is produced, declare every component used by its entities in the same
|
|
173
|
+
definition; the isolated Pack worker projects the tokens to a neutral,
|
|
174
|
+
serializable schema. A scene component missing from that declaration is a
|
|
175
|
+
fail-closed producer error, not a lookup into a global World schema.
|
|
176
|
+
|
|
139
177
|
`forgeax-engine-remote-asset meta <source.pack.ts> --json` executes module initialization, validates the default export, and projects canonical Meta without calling `build`. `@forgeax/engine-pack/source-node` accepts a host executor with `load` and optional `dispose`; `timeoutMs` bounds module initialization and `buildTimeoutMs` bounds one `build(reader)` call. A build timeout returns one structured `pack-source-load-failed` Result with `detail.phase: 'build'`, the configured `timeoutMs`, and deterministic cleanup of the isolated worker and compile root.
|
|
140
178
|
|
|
141
179
|
The default worker executes the complete relative TypeScript module closure on the supported Node floor, including Node 22 hosts that do not load `.ts` files directly. It transpiles that closure into a disposable ESM directory, resolves bare imports through the source project's nearest `node_modules`, and removes the directory when the worker is disposed. Bulk producers use the internal `createScriptablePackModuleExecutorPool()` with two recyclable workers; a pooled lease is released after metadata projection or one build, so a generation never retains one live Worker-backed definition per source.
|
|
@@ -218,8 +256,7 @@ Two sidecar JSON files live next to each source file in an asset directory:
|
|
|
218
256
|
Both package schemas accept producer-owned `packageId`, `provenance`,
|
|
219
257
|
`revision`, and structured `diagnostics`. Asset/output rows may declare a
|
|
220
258
|
stable `sourceKey`; `sourceIndex` is positional evidence only. The runtime
|
|
221
|
-
function `diffTopology(previous, next)`
|
|
222
|
-
`calculateTopologyDiff`) preserves GUIDs by `sourceKey`, reports additions,
|
|
259
|
+
function `diffTopology(previous, next)` preserves GUIDs by `sourceKey`, reports additions,
|
|
223
260
|
removals, and kind changes, and marks multi-output source-index-only matching
|
|
224
261
|
as ambiguous.
|
|
225
262
|
|
|
@@ -358,6 +395,17 @@ wire-format oracles, never as a second layout table.
|
|
|
358
395
|
> owning build-time importer/native cooker and `lookup/verify --guid --project
|
|
359
396
|
> --catalog --json` before publishing the replacement.
|
|
360
397
|
|
|
398
|
+
## Owner product and inventory contract
|
|
399
|
+
|
|
400
|
+
`scanInventory(...)` is the Pack-owned source inventory boundary. It preserves
|
|
401
|
+
GUID identity, source revision, source key, and source index before importer
|
|
402
|
+
work begins.
|
|
403
|
+
|
|
404
|
+
`finalizePackageProduct(...)` accepts the terminal producer product, validates
|
|
405
|
+
one receipt per GUID, validates asset-local artifact paths and bytes, and emits
|
|
406
|
+
the deterministic package URL and digest. Producers provide policy through the
|
|
407
|
+
finalizer sink; Pack owns package serialization and publication facts.
|
|
408
|
+
|
|
361
409
|
## Entry subpaths
|
|
362
410
|
|
|
363
411
|
| Subpath | Exports |
|