@forgeax/engine-pack 0.1.3 → 0.1.6
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 +52 -4
- 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 +19 -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 +139 -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/dist/index.mjs
CHANGED
|
@@ -7448,6 +7448,22 @@ var SCRIPTABLE_PACK_ASSET_KINDS = [
|
|
|
7448
7448
|
function isScriptablePackAssetKind(value) {
|
|
7449
7449
|
return SCRIPTABLE_PACK_ASSET_KINDS.includes(value);
|
|
7450
7450
|
}
|
|
7451
|
+
function sceneComponentFieldType(value) {
|
|
7452
|
+
if (typeof value === "string") return value;
|
|
7453
|
+
if (isRecord2(value) && typeof value.type === "string") return value.type;
|
|
7454
|
+
return void 0;
|
|
7455
|
+
}
|
|
7456
|
+
function projectScriptablePackSceneComponents(components) {
|
|
7457
|
+
return (components ?? []).map((component) => ({
|
|
7458
|
+
name: component.name,
|
|
7459
|
+
fields: Object.fromEntries(
|
|
7460
|
+
Object.entries(component.fields).map(([fieldName, field]) => [
|
|
7461
|
+
fieldName,
|
|
7462
|
+
sceneComponentFieldType(field)
|
|
7463
|
+
])
|
|
7464
|
+
)
|
|
7465
|
+
}));
|
|
7466
|
+
}
|
|
7451
7467
|
var SCRIPTABLE_PACK_REQUEST_ID_SCHEMA = {
|
|
7452
7468
|
type: "string",
|
|
7453
7469
|
minLength: 1,
|
|
@@ -7673,11 +7689,20 @@ function freezeDefinition(definition) {
|
|
|
7673
7689
|
guid.slice()
|
|
7674
7690
|
])
|
|
7675
7691
|
);
|
|
7692
|
+
const sceneComponents = definition.sceneComponents === void 0 ? void 0 : Object.freeze(
|
|
7693
|
+
projectScriptablePackSceneComponents(definition.sceneComponents).map(
|
|
7694
|
+
(component) => Object.freeze({
|
|
7695
|
+
...component,
|
|
7696
|
+
fields: Object.freeze({ ...component.fields })
|
|
7697
|
+
})
|
|
7698
|
+
)
|
|
7699
|
+
);
|
|
7676
7700
|
return Object.freeze({
|
|
7677
7701
|
...definition,
|
|
7678
7702
|
packageId: definition.packageId.slice(),
|
|
7679
7703
|
assets: Object.freeze(assets),
|
|
7680
|
-
externalAssets: Object.freeze(externalAssets)
|
|
7704
|
+
externalAssets: Object.freeze(externalAssets),
|
|
7705
|
+
...sceneComponents === void 0 ? {} : { sceneComponents }
|
|
7681
7706
|
});
|
|
7682
7707
|
}
|
|
7683
7708
|
function validateScriptablePackDefinition(value, sourcePath) {
|
|
@@ -7708,6 +7733,63 @@ function validateScriptablePackDefinition(value, sourcePath) {
|
|
|
7708
7733
|
sourcePath
|
|
7709
7734
|
);
|
|
7710
7735
|
}
|
|
7736
|
+
if (value.sceneComponents !== void 0) {
|
|
7737
|
+
if (!Array.isArray(value.sceneComponents)) {
|
|
7738
|
+
return invalid2(
|
|
7739
|
+
"$.sceneComponents",
|
|
7740
|
+
"an array of component tokens or neutral schema rows when present",
|
|
7741
|
+
value.sceneComponents,
|
|
7742
|
+
sourcePath
|
|
7743
|
+
);
|
|
7744
|
+
}
|
|
7745
|
+
const componentNames = /* @__PURE__ */ new Set();
|
|
7746
|
+
for (const [componentIndex, component] of value.sceneComponents.entries()) {
|
|
7747
|
+
if (!isRecord2(component)) {
|
|
7748
|
+
return invalid2(
|
|
7749
|
+
`$.sceneComponents[${componentIndex}]`,
|
|
7750
|
+
"a component token or neutral schema row",
|
|
7751
|
+
component,
|
|
7752
|
+
sourcePath
|
|
7753
|
+
);
|
|
7754
|
+
}
|
|
7755
|
+
if (typeof component.name !== "string" || component.name.trim().length === 0) {
|
|
7756
|
+
return invalid2(
|
|
7757
|
+
`$.sceneComponents[${componentIndex}].name`,
|
|
7758
|
+
"a non-empty component name",
|
|
7759
|
+
component.name,
|
|
7760
|
+
sourcePath
|
|
7761
|
+
);
|
|
7762
|
+
}
|
|
7763
|
+
if (componentNames.has(component.name)) {
|
|
7764
|
+
return invalid2(
|
|
7765
|
+
`$.sceneComponents[${componentIndex}].name`,
|
|
7766
|
+
"component names to be unique within one ScriptablePack",
|
|
7767
|
+
component.name,
|
|
7768
|
+
sourcePath
|
|
7769
|
+
);
|
|
7770
|
+
}
|
|
7771
|
+
componentNames.add(component.name);
|
|
7772
|
+
if (!isRecord2(component.fields)) {
|
|
7773
|
+
return invalid2(
|
|
7774
|
+
`$.sceneComponents[${componentIndex}].fields`,
|
|
7775
|
+
"a field-name to schema-type object",
|
|
7776
|
+
component.fields,
|
|
7777
|
+
sourcePath
|
|
7778
|
+
);
|
|
7779
|
+
}
|
|
7780
|
+
for (const [fieldName, field] of Object.entries(component.fields)) {
|
|
7781
|
+
const type = sceneComponentFieldType(field);
|
|
7782
|
+
if (fieldName.trim().length === 0 || type === void 0 || type.trim().length === 0) {
|
|
7783
|
+
return invalid2(
|
|
7784
|
+
`$.sceneComponents[${componentIndex}].fields`,
|
|
7785
|
+
"field names with non-empty string schema types",
|
|
7786
|
+
field,
|
|
7787
|
+
sourcePath
|
|
7788
|
+
);
|
|
7789
|
+
}
|
|
7790
|
+
}
|
|
7791
|
+
}
|
|
7792
|
+
}
|
|
7711
7793
|
if (typeof value.build !== "function") {
|
|
7712
7794
|
return invalid2("$.build", "a build(assetReader) function", value.build, sourcePath);
|
|
7713
7795
|
}
|