@forgeax/engine-import 0.1.33 → 0.1.35

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 CHANGED
@@ -28,7 +28,7 @@ The output is the same Pack v2 durable payload used by ordinary importers. The
28
28
  Producer or dependency failures return `code`, `expected`, `hint`, and
29
29
  `detail`; inspect the owning evidence, rebuild or cold-cook, and retry.
30
30
 
31
- The import contract is [`asset-authority.schema.json`](../../asset-authority.schema.json). `ImporterRegistry` and `runImport` are the build-time owner for external source plus Meta; every writable multi-output declaration uses a stable `sourceKey`, while `sourceIndex` remains diagnostic evidence only.
31
+ The import contract is [`schemas/asset-authority.schema.json`](../../schemas/asset-authority.schema.json). `ImporterRegistry` and `runImport` are the build-time owner for external source plus Meta; every writable multi-output declaration uses a stable `sourceKey`, while `sourceIndex` remains diagnostic evidence only.
32
32
 
33
33
  | Need | Entry | Boundary |
34
34
  |:--|:--|:--|
@@ -76,6 +76,15 @@ the engine's import/load split.
76
76
  > (AC-06). `@forgeax/engine-runtime` and `@forgeax/engine-app` do not depend on
77
77
  > it. Its consumers are build tooling (the Vite pack plugin, the asset CLI).
78
78
 
79
+ ### Source-package failure propagation
80
+
81
+ `produceSourcePackage` preserves the original `ImportError` for module loading,
82
+ source reads and conversion failures. GUID closure errors describe an actual
83
+ missing, extra or duplicate output; they must not replace a failed importer with
84
+ an empty output list. The build adapter carries `code`, `expected`, `hint` and
85
+ `detail` into both the thrown error and its printable diagnostic. In particular,
86
+ `detail.loadError` names a missing module/WASM carrier before any Pack is emitted.
87
+
79
88
  ## The DIP (dependency-inversion principle) shape
80
89
 
81
90
  This is the engine's **third DIP instance** after RHI and Console. The engine
package/dist/index.mjs CHANGED
@@ -1859,7 +1859,8 @@ async function buildScriptablePack(options) {
1859
1859
  source: asset,
1860
1860
  sourceKey,
1861
1861
  sourcePath: options.sourcePath,
1862
- refs: product2.refs.map((reference) => reference.guid)
1862
+ refs: product2.refs.map((reference) => reference.guid),
1863
+ ...options.publicationGeneration === void 0 ? {} : { cookGeneration: options.publicationGeneration }
1863
1864
  });
1864
1865
  if (!cooked.ok) return err(cooked.error);
1865
1866
  if (cooked.value.guid.toLowerCase() !== normalizedGuid) {
@@ -2059,6 +2060,7 @@ async function buildScriptablePackWorklist(options) {
2059
2060
  ...subject.values === void 0 ? {} : { values: subject.values },
2060
2061
  ...subject.inheritedValues === void 0 ? {} : { inheritedValues: subject.inheritedValues },
2061
2062
  ...subject.sourceClosure === void 0 ? {} : { sourceClosure: subject.sourceClosure },
2063
+ ...subject.publicationGeneration === void 0 ? {} : { publicationGeneration: subject.publicationGeneration },
2062
2064
  outputs: options.outputs,
2063
2065
  ...options.cookers === void 0 ? {} : { cookers: options.cookers },
2064
2066
  assetSource: stagedSource(staged, options.assetSource),
@@ -2197,6 +2199,8 @@ async function produceSourcePackage(input) {
2197
2199
  const declaredGuids = input.meta.subAssets.map((asset) => asset.guid);
2198
2200
  const result = await runImport(input.meta, input.registry, input.fs);
2199
2201
  if (!result.ok) {
2202
+ if (result.error.code !== "guid-mismatch" && result.error.code !== "import-produced-no-assets" && result.error.code !== "source-validation-failed")
2203
+ return result;
2200
2204
  const producedGuids2 = producedGuidsFromImportFailure(declaredGuids, result.error.detail);
2201
2205
  return {
2202
2206
  ok: false,
@@ -2862,7 +2866,8 @@ async function produceScriptablePackProducts(options) {
2862
2866
  ...source.subjectPackageId === void 0 ? {} : { subjectPackageId: source.subjectPackageId },
2863
2867
  ...source.values === void 0 ? {} : { values: source.values },
2864
2868
  ...source.inheritedValues === void 0 ? {} : { inheritedValues: source.inheritedValues },
2865
- sourceClosure: source.sourceClosure
2869
+ sourceClosure: source.sourceClosure,
2870
+ publicationGeneration: source.publicationGeneration
2866
2871
  }));
2867
2872
  const worklist = await buildScriptablePackWorklist({
2868
2873
  subjects: workItems,