@forgeax/engine-import 0.1.6 → 0.1.19
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/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/source-package-errors.unit.test.d.ts +2 -0
- package/dist/__tests__/source-package-errors.unit.test.d.ts.map +1 -0
- package/dist/__tests__/source-package-publication.integration.test.d.ts +2 -0
- package/dist/__tests__/source-package-publication.integration.test.d.ts.map +1 -0
- package/dist/browser.mjs +5 -2
- package/dist/browser.mjs.map +1 -1
- package/dist/build-production.d.ts.map +1 -1
- package/dist/catalog-inventory.d.ts +1 -1
- package/dist/catalog-inventory.d.ts.map +1 -1
- package/dist/import-runner.d.ts +9 -0
- package/dist/import-runner.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +118 -28
- package/dist/index.mjs.map +1 -1
- package/dist/scriptable-pack-host.d.ts +1 -1
- package/dist/scriptable-pack-host.d.ts.map +1 -1
- package/dist/source-package-errors.d.ts +2 -0
- package/dist/source-package-errors.d.ts.map +1 -1
- package/dist/source-package-publication.d.ts.map +1 -1
- package/dist/source-path.d.ts +12 -0
- package/dist/source-path.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/__tests__/import-dependencies.test.ts +34 -0
- package/src/__tests__/source-package-errors.unit.test.ts +62 -0
- package/src/__tests__/source-package-publication.integration.test.ts +75 -0
- package/src/build-production.ts +38 -14
- package/src/catalog-inventory.ts +2 -0
- package/src/import-runner.ts +15 -2
- package/src/index.ts +5 -0
- package/src/scriptable-pack-host.ts +6 -2
- package/src/source-package-errors.ts +37 -0
- package/src/source-package-publication.ts +31 -0
- package/src/source-path.ts +36 -0
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ok, validateSourceOverrideMap, ImportError, IMPORT_ERROR_HINTS, canonicalizeSourceOverrides, err, AssetError, MATERIAL_TEXTURE_SLOTS } from '@forgeax/engine-types';
|
|
2
2
|
export { IMPORT_ERROR_HINTS, ImportError } from '@forgeax/engine-types';
|
|
3
|
-
import { resolve, dirname } from 'path';
|
|
4
|
-
import { upgradeLegacyAuthoredPack, loadAssetConfig, resolveAssetSource, finalizePackageTransportSource, projectCookedPackageEntry, buildCatalogProjection, createRuntimePackPublication, metaPathForGuid } from '@forgeax/engine-pack/build';
|
|
3
|
+
import { resolve, isAbsolute, relative, dirname } from 'path';
|
|
4
|
+
import { upgradeLegacyAuthoredPack, loadAssetConfig, resolveAssetSource, finalizePackageTransportSource, catalogSourcePathFor, projectCookedPackageEntry, buildCatalogProjection, createRuntimePackPublication, metaPathForGuid } from '@forgeax/engine-pack/build';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
6
|
import { stat, mkdir, writeFile, rename, rm } from 'fs/promises';
|
|
7
7
|
import { createAcceptedPublication, ddcOutputDigest, DdcGenerationSession, DdcLifecycle } from '@forgeax/engine-ddc';
|
|
@@ -178,6 +178,9 @@ function normalizeDependencyPath(path) {
|
|
|
178
178
|
}
|
|
179
179
|
return parts.join("/");
|
|
180
180
|
}
|
|
181
|
+
function dependencyIdentity(fs, sourcePath) {
|
|
182
|
+
return normalizeDependencyPath(fs.sourceIdentityFor?.(sourcePath) ?? sourcePath);
|
|
183
|
+
}
|
|
181
184
|
function errResult(error) {
|
|
182
185
|
return { ok: false, error };
|
|
183
186
|
}
|
|
@@ -315,7 +318,7 @@ async function runImport(meta, registry, fs) {
|
|
|
315
318
|
}
|
|
316
319
|
const dependencies = /* @__PURE__ */ new Set();
|
|
317
320
|
const readSource = async (sourcePath) => {
|
|
318
|
-
dependencies.add(
|
|
321
|
+
dependencies.add(dependencyIdentity(fs, sourcePath));
|
|
319
322
|
try {
|
|
320
323
|
return await fs.readSource(sourcePath);
|
|
321
324
|
} catch (error) {
|
|
@@ -326,7 +329,7 @@ async function runImport(meta, registry, fs) {
|
|
|
326
329
|
let inner;
|
|
327
330
|
try {
|
|
328
331
|
if (fs.readSibling) {
|
|
329
|
-
dependencies.add(
|
|
332
|
+
dependencies.add(dependencyIdentity(fs, joinSiblingPath(meta.source, uri)));
|
|
330
333
|
inner = await fs.readSibling(meta.source, uri);
|
|
331
334
|
} else {
|
|
332
335
|
inner = await readSource(joinSiblingPath(meta.source, uri));
|
|
@@ -1740,11 +1743,13 @@ function canonicalScriptableSourcePath(sourcePath) {
|
|
|
1740
1743
|
const markerIndex = normalized.indexOf(marker);
|
|
1741
1744
|
return markerIndex < 0 ? normalized : normalized.slice(markerIndex + 1);
|
|
1742
1745
|
}
|
|
1743
|
-
function scriptablePackInputs(sourcePaths, declarations, cwd, generationFor, policyFor) {
|
|
1746
|
+
function scriptablePackInputs(sourcePaths, declarations, cwd, generationFor, policyFor, sourceIdentityFor) {
|
|
1744
1747
|
return sourcePaths.flatMap((sourcePath) => {
|
|
1745
1748
|
const declaration = declarations.get(resolve(cwd, sourcePath));
|
|
1746
1749
|
if (declaration?.format !== "pack.ts") return [];
|
|
1747
|
-
const
|
|
1750
|
+
const projected = sourceIdentityFor?.(sourcePath);
|
|
1751
|
+
const catalogSourcePath = projected === void 0 || isAbsolute(projected) ? relative(cwd, sourcePath) : projected;
|
|
1752
|
+
const displaySourcePath = canonicalScriptableSourcePath(catalogSourcePath);
|
|
1748
1753
|
return [
|
|
1749
1754
|
{
|
|
1750
1755
|
sourcePath: resolve(cwd, sourcePath),
|
|
@@ -2097,6 +2102,22 @@ async function produceScriptablePackProducts(sources, declaredExternalOutputs =
|
|
|
2097
2102
|
}
|
|
2098
2103
|
return ok(prepared);
|
|
2099
2104
|
}
|
|
2105
|
+
function normalizeCatalogPath(path) {
|
|
2106
|
+
return path.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
2107
|
+
}
|
|
2108
|
+
function sourceDeclarationForCatalogPath(sourcePath, declarations, sourceIdentityFor, cwd = process.cwd()) {
|
|
2109
|
+
const normalized = normalizeCatalogPath(sourcePath);
|
|
2110
|
+
const direct = declarations.get(resolve(cwd, sourcePath));
|
|
2111
|
+
if (direct !== void 0) {
|
|
2112
|
+
return { sourcePath: resolve(cwd, sourcePath), declaration: direct };
|
|
2113
|
+
}
|
|
2114
|
+
for (const [physicalPath, declaration] of declarations) {
|
|
2115
|
+
if (catalogSourcePathFor(cwd, physicalPath, sourceIdentityFor) === normalized) {
|
|
2116
|
+
return { sourcePath: physicalPath, declaration };
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
return void 0;
|
|
2120
|
+
}
|
|
2100
2121
|
|
|
2101
2122
|
// src/build-production.ts
|
|
2102
2123
|
function scriptableArtifactPath(guid, key) {
|
|
@@ -2114,11 +2135,7 @@ function runtimePublicationFor(context, input) {
|
|
|
2114
2135
|
});
|
|
2115
2136
|
}
|
|
2116
2137
|
async function buildAuthoredPackages(context) {
|
|
2117
|
-
const scriptableSources = [
|
|
2118
|
-
...new Set(
|
|
2119
|
-
context.inventory.entries.filter((entry) => entry.sourcePath.endsWith(".pack.ts")).map((entry) => entry.sourcePath)
|
|
2120
|
-
)
|
|
2121
|
-
];
|
|
2138
|
+
const scriptableSources = [...context.inventory.sourceDeclarations.entries()].filter(([, declaration]) => declaration.format === "pack.ts").map(([sourcePath]) => sourcePath);
|
|
2122
2139
|
if (scriptableSources.length === 0) return /* @__PURE__ */ new Map();
|
|
2123
2140
|
const inputs = scriptablePackInputs(
|
|
2124
2141
|
scriptableSources,
|
|
@@ -2129,7 +2146,8 @@ async function buildAuthoredPackages(context) {
|
|
|
2129
2146
|
base: context.basePrefix === "" ? "/" : context.basePrefix,
|
|
2130
2147
|
packagePath: `assets/${product.anchorGuid}.pack.json`,
|
|
2131
2148
|
artifactPath: scriptableArtifactPath
|
|
2132
|
-
})
|
|
2149
|
+
}),
|
|
2150
|
+
context.fsForImport.sourceIdentityFor
|
|
2133
2151
|
);
|
|
2134
2152
|
const preparedResult = await produceScriptablePackProducts(
|
|
2135
2153
|
inputs,
|
|
@@ -2207,7 +2225,7 @@ async function buildAuthoredPackages(context) {
|
|
|
2207
2225
|
}
|
|
2208
2226
|
return result;
|
|
2209
2227
|
}
|
|
2210
|
-
function updateImportedEntries(entries, guids, packageUrl, projection = {}, refsByGuid, publication) {
|
|
2228
|
+
function updateImportedEntries(entries, guids, packageUrl, projection = {}, refsByGuid, publication, sourcePath) {
|
|
2211
2229
|
const selected = new Set(guids.map((guid) => guid.toLowerCase()));
|
|
2212
2230
|
for (let index = 0; index < entries.length; index += 1) {
|
|
2213
2231
|
const entry = entries[index];
|
|
@@ -2217,6 +2235,7 @@ function updateImportedEntries(entries, guids, packageUrl, projection = {}, refs
|
|
|
2217
2235
|
...entry,
|
|
2218
2236
|
packageUrl,
|
|
2219
2237
|
...projection,
|
|
2238
|
+
...sourcePath === void 0 ? {} : { sourcePath },
|
|
2220
2239
|
...publication === void 0 ? {} : { publication },
|
|
2221
2240
|
...refs === void 0 ? {} : { refs }
|
|
2222
2241
|
};
|
|
@@ -2243,13 +2262,20 @@ async function emitPackDocument(work, options) {
|
|
|
2243
2262
|
packageUrl,
|
|
2244
2263
|
options.projection,
|
|
2245
2264
|
options.refsByGuid,
|
|
2246
|
-
options.publication
|
|
2265
|
+
options.publication,
|
|
2266
|
+
options.sourcePath
|
|
2247
2267
|
);
|
|
2248
2268
|
return packageUrl;
|
|
2249
2269
|
}
|
|
2250
2270
|
async function emitAuthoredPack(work, guidSeen, entry) {
|
|
2251
|
-
const
|
|
2252
|
-
|
|
2271
|
+
const sourceDeclaration = sourceDeclarationForCatalogPath(
|
|
2272
|
+
entry.sourcePath,
|
|
2273
|
+
work.context.inventory.sourceDeclarations,
|
|
2274
|
+
work.context.fsForImport.sourceIdentityFor,
|
|
2275
|
+
work.context.cwd
|
|
2276
|
+
);
|
|
2277
|
+
const packPath = sourceDeclaration?.sourcePath ?? resolve(work.context.cwd, entry.sourcePath);
|
|
2278
|
+
const declaration = sourceDeclaration?.declaration;
|
|
2253
2279
|
if (declaration?.format !== "pack.json") {
|
|
2254
2280
|
throw work.context.fail({
|
|
2255
2281
|
code: "catalog-declaration-missing",
|
|
@@ -2272,8 +2298,8 @@ async function emitAuthoredPack(work, guidSeen, entry) {
|
|
|
2272
2298
|
const authoredPack = prepared.finalized?.pack ?? prepared.pack;
|
|
2273
2299
|
const runtimePublication = authoredPack.assets === void 0 || authoredPack.assets.length === 0 ? void 0 : runtimePublicationFor(work.context, {
|
|
2274
2300
|
pack: { assets: authoredPack.assets },
|
|
2275
|
-
sourcePath:
|
|
2276
|
-
sourceRevision:
|
|
2301
|
+
sourcePath: entry.sourcePath,
|
|
2302
|
+
sourceRevision: declaration.sourceRevision,
|
|
2277
2303
|
packageUrl: prepared.finalized?.packageUrl ?? `${work.context.basePrefix === "/" ? "" : work.context.basePrefix}/assets/${outputGuid}.pack.json`,
|
|
2278
2304
|
...prepared.finalized?.digest === void 0 ? {} : { digest: prepared.finalized.digest }
|
|
2279
2305
|
});
|
|
@@ -2291,7 +2317,7 @@ async function emitAuthoredPack(work, guidSeen, entry) {
|
|
|
2291
2317
|
guidSeen.add(guid.toLowerCase());
|
|
2292
2318
|
}
|
|
2293
2319
|
}
|
|
2294
|
-
async function emitFinalizedOwner(work, metaPath, subAssets, sourcePackage, ownerFinalizer) {
|
|
2320
|
+
async function emitFinalizedOwner(work, metaPath, sourcePath, subAssets, sourcePackage, ownerFinalizer) {
|
|
2295
2321
|
const ownerGuid = subAssets[0]?.guid;
|
|
2296
2322
|
if (ownerGuid === void 0) return;
|
|
2297
2323
|
const artifactPaths = /* @__PURE__ */ new Map();
|
|
@@ -2334,7 +2360,10 @@ async function emitFinalizedOwner(work, metaPath, subAssets, sourcePackage, owne
|
|
|
2334
2360
|
);
|
|
2335
2361
|
const runtimePublication = runtimePublicationFor(work.context, {
|
|
2336
2362
|
pack: { assets: ownerPackage.pack.assets },
|
|
2337
|
-
|
|
2363
|
+
// The Catalog entry identifies the imported source, while metaPath is the
|
|
2364
|
+
// sidecar declaration that drove the import. Keep publication fences on
|
|
2365
|
+
// the Catalog identity in production just as the dev importer does.
|
|
2366
|
+
sourcePath,
|
|
2338
2367
|
sourceRevision: ownerPackage.sourceRevision,
|
|
2339
2368
|
packageUrl: ownerPackage.packageUrl,
|
|
2340
2369
|
digest: ownerPackage.digest
|
|
@@ -2352,7 +2381,8 @@ async function emitFinalizedOwner(work, metaPath, subAssets, sourcePackage, owne
|
|
|
2352
2381
|
asset.refs.map((ref2) => ref2.guid)
|
|
2353
2382
|
])
|
|
2354
2383
|
),
|
|
2355
|
-
publication: runtimePublication.publication
|
|
2384
|
+
publication: runtimePublication.publication,
|
|
2385
|
+
sourcePath
|
|
2356
2386
|
});
|
|
2357
2387
|
}
|
|
2358
2388
|
async function emitBuildEntry(work, guidSeen, entry) {
|
|
@@ -2383,7 +2413,14 @@ async function emitBuildEntry(work, guidSeen, entry) {
|
|
|
2383
2413
|
if (!sourcePackage.ok) throw work.context.fail(sourcePackage.error);
|
|
2384
2414
|
const ownerFinalizer = work.context.importerRegistry.get(runMeta.importer)?.finalize;
|
|
2385
2415
|
if (ownerFinalizer !== void 0) {
|
|
2386
|
-
await emitFinalizedOwner(
|
|
2416
|
+
await emitFinalizedOwner(
|
|
2417
|
+
work,
|
|
2418
|
+
metaPath,
|
|
2419
|
+
canonicalScriptableSourcePath(entry.sourcePath),
|
|
2420
|
+
subAssets,
|
|
2421
|
+
sourcePackage.value,
|
|
2422
|
+
ownerFinalizer
|
|
2423
|
+
);
|
|
2387
2424
|
return;
|
|
2388
2425
|
}
|
|
2389
2426
|
const finalized = await finalizePackageTransportSource(
|
|
@@ -2397,9 +2434,12 @@ async function emitBuildEntry(work, guidSeen, entry) {
|
|
|
2397
2434
|
}
|
|
2398
2435
|
);
|
|
2399
2436
|
const productByGuid = sourcePackageAssetsByGuid(sourcePackage.value);
|
|
2437
|
+
const canonicalSourcePath = canonicalScriptableSourcePath(entry.sourcePath);
|
|
2400
2438
|
const runtimePublication = runtimePublicationFor(work.context, {
|
|
2401
2439
|
pack: { assets: finalized.pack.assets },
|
|
2402
|
-
|
|
2440
|
+
// See emitFinalizedOwner: the sidecar path is an import driver, not the
|
|
2441
|
+
// stable source identity carried by the Catalog row.
|
|
2442
|
+
sourcePath: canonicalSourcePath,
|
|
2403
2443
|
sourceRevision: finalized.sourceRevision,
|
|
2404
2444
|
packageUrl: finalized.packageUrl,
|
|
2405
2445
|
digest: finalized.digest
|
|
@@ -2414,7 +2454,8 @@ async function emitBuildEntry(work, guidSeen, entry) {
|
|
|
2414
2454
|
refsByGuid: new Map(
|
|
2415
2455
|
[...productByGuid].map(([guid2, asset]) => [guid2, asset.refs.map((ref2) => ref2.guid)])
|
|
2416
2456
|
),
|
|
2417
|
-
publication: runtimePublication.publication
|
|
2457
|
+
publication: runtimePublication.publication,
|
|
2458
|
+
sourcePath: canonicalSourcePath
|
|
2418
2459
|
});
|
|
2419
2460
|
}
|
|
2420
2461
|
async function produceBuildAssets(context) {
|
|
@@ -2481,12 +2522,13 @@ function catalogImporterPolicy(importer, hostImporterKeys) {
|
|
|
2481
2522
|
hint: "wire the provider through the host importer registry before building the Catalog"
|
|
2482
2523
|
};
|
|
2483
2524
|
}
|
|
2484
|
-
async function buildCatalogResult(roots, base = "/", registeredImporterKeys = /* @__PURE__ */ new Set(), scanOptions = {}, catalogVisibility = () => true) {
|
|
2525
|
+
async function buildCatalogResult(roots, base = "/", registeredImporterKeys = /* @__PURE__ */ new Set(), scanOptions = {}, catalogVisibility = () => true, sourceIdentityFor) {
|
|
2485
2526
|
const options = {
|
|
2486
2527
|
base,
|
|
2487
2528
|
scanOptions,
|
|
2488
2529
|
importerPolicy: (importer) => catalogImporterPolicy(importer, registeredImporterKeys),
|
|
2489
|
-
visibility: catalogVisibility
|
|
2530
|
+
visibility: catalogVisibility,
|
|
2531
|
+
...sourceIdentityFor === void 0 ? {} : { sourceIdentityFor }
|
|
2490
2532
|
};
|
|
2491
2533
|
return buildCatalogProjection(roots, options);
|
|
2492
2534
|
}
|
|
@@ -2615,7 +2657,38 @@ function importFailureCode(error) {
|
|
|
2615
2657
|
return "source-package-conversion-failed";
|
|
2616
2658
|
}
|
|
2617
2659
|
}
|
|
2660
|
+
var IMPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
2661
|
+
"importer-not-registered",
|
|
2662
|
+
"source-read-failed",
|
|
2663
|
+
"import-produced-no-assets",
|
|
2664
|
+
"guid-mismatch",
|
|
2665
|
+
"mesh-material-slot-topology-change",
|
|
2666
|
+
"import-internal-error",
|
|
2667
|
+
"source-validation-failed",
|
|
2668
|
+
"unknown-source-key",
|
|
2669
|
+
"duplicate-source-key",
|
|
2670
|
+
"invalid-source-overrides",
|
|
2671
|
+
"invalid-source-override-payload"
|
|
2672
|
+
]);
|
|
2673
|
+
function findNormalizableCause(error, seen = /* @__PURE__ */ new Set()) {
|
|
2674
|
+
if (error === null || typeof error !== "object" || seen.has(error)) return void 0;
|
|
2675
|
+
seen.add(error);
|
|
2676
|
+
if (isSourcePackageError(error) || isScriptablePackFailure(error) || isImportError(error)) {
|
|
2677
|
+
return error;
|
|
2678
|
+
}
|
|
2679
|
+
const cause = error.cause;
|
|
2680
|
+
return cause === void 0 ? void 0 : findNormalizableCause(cause, seen);
|
|
2681
|
+
}
|
|
2682
|
+
function containsSourcePackageError(error, seen = /* @__PURE__ */ new Set()) {
|
|
2683
|
+
if (error === null || typeof error !== "object" || seen.has(error)) return false;
|
|
2684
|
+
seen.add(error);
|
|
2685
|
+
if (isSourcePackageError(error) || isImportError(error)) return true;
|
|
2686
|
+
const cause = error.cause;
|
|
2687
|
+
return cause !== void 0 && containsSourcePackageError(cause, seen);
|
|
2688
|
+
}
|
|
2618
2689
|
function normalizeSourcePackageError(error, context) {
|
|
2690
|
+
const cause = findNormalizableCause(error);
|
|
2691
|
+
if (cause !== void 0 && cause !== error) return normalizeSourcePackageError(cause, context);
|
|
2619
2692
|
if (isSourcePackageError(error)) return error;
|
|
2620
2693
|
if (isScriptablePackFailure(error)) {
|
|
2621
2694
|
return sourcePackageError("source-package-conversion-failed", context, {
|
|
@@ -2644,7 +2717,7 @@ function contextErrorStage(error) {
|
|
|
2644
2717
|
return error instanceof SyntaxError ? "source-package-meta-invalid" : "source-package-conversion-failed";
|
|
2645
2718
|
}
|
|
2646
2719
|
function isImportError(error) {
|
|
2647
|
-
return error !== null && typeof error === "object" && "code" in error && "expected" in error && "hint" in error && "detail" in error;
|
|
2720
|
+
return error !== null && typeof error === "object" && "code" in error && typeof error.code === "string" && IMPORT_ERROR_CODES.has(error.code) && "expected" in error && "hint" in error && "detail" in error;
|
|
2648
2721
|
}
|
|
2649
2722
|
function isScriptablePackFailure(error) {
|
|
2650
2723
|
return error !== null && typeof error === "object" && "code" in error && typeof error.code === "string" && error.code.startsWith("pack-source-") && "expected" in error && typeof error.expected === "string" && "hint" in error && typeof error.hint === "string" && "detail" in error;
|
|
@@ -2652,6 +2725,19 @@ function isScriptablePackFailure(error) {
|
|
|
2652
2725
|
function inspectHead(root, guid, desiredKey) {
|
|
2653
2726
|
return new DdcLifecycle(root).inspect(guid, desiredKey);
|
|
2654
2727
|
}
|
|
2728
|
+
var PUBLICATION_SETTLE_TIMEOUT_MS = 5e3;
|
|
2729
|
+
var PUBLICATION_SETTLE_POLL_MS = 10;
|
|
2730
|
+
async function inspectAfterSupersededCommit(candidate) {
|
|
2731
|
+
let head = await inspectHead(candidate.root, candidate.lease.guid, candidate.lease.desiredKey);
|
|
2732
|
+
if (head.state === "current" && head.currentKey === candidate.lease.desiredKey) return head;
|
|
2733
|
+
const deadline = Date.now() + PUBLICATION_SETTLE_TIMEOUT_MS;
|
|
2734
|
+
while (Date.now() < deadline && head.activeLease !== void 0 && head.activeLease.attempt !== candidate.lease.attempt && head.activeLease.desiredKey === candidate.lease.desiredKey) {
|
|
2735
|
+
await new Promise((resolve4) => setTimeout(resolve4, PUBLICATION_SETTLE_POLL_MS));
|
|
2736
|
+
head = await inspectHead(candidate.root, candidate.lease.guid, candidate.lease.desiredKey);
|
|
2737
|
+
if (head.state === "current" && head.currentKey === candidate.lease.desiredKey) return head;
|
|
2738
|
+
}
|
|
2739
|
+
return head;
|
|
2740
|
+
}
|
|
2655
2741
|
async function stageSourcePackageDdc(input) {
|
|
2656
2742
|
const session = new DdcGenerationSession(input.root, { generation: 1 });
|
|
2657
2743
|
try {
|
|
@@ -2670,6 +2756,10 @@ async function commitSourcePackageDdc(candidate) {
|
|
|
2670
2756
|
try {
|
|
2671
2757
|
const commit = await candidate.session.commitEntry(candidate, candidate.lease.desiredKey);
|
|
2672
2758
|
if (commit.result !== "current") {
|
|
2759
|
+
const head = await inspectAfterSupersededCommit(candidate);
|
|
2760
|
+
if (head.state === "current" && head.currentKey === candidate.lease.desiredKey) {
|
|
2761
|
+
return ok(head);
|
|
2762
|
+
}
|
|
2673
2763
|
return err(
|
|
2674
2764
|
sourcePackageError("source-package-ddc-failed", candidate.context, {
|
|
2675
2765
|
stage: "ddc",
|
|
@@ -2827,6 +2917,6 @@ async function restoreImportPublication(candidate) {
|
|
|
2827
2917
|
await candidate.ddc.session.restoreEntry(candidate.ddc);
|
|
2828
2918
|
}
|
|
2829
2919
|
|
|
2830
|
-
export { AssetOutputProducerRegistry, DEFAULT_CATALOG_IMPORTER_KEYS, ImporterRegistry, SHADER_RESERVED_IMPORTER_KEY, buildCatalogResult, buildScriptablePack, canonicalScriptableSourcePath, catalogImporterPolicy, commitImportPublication, createImportProduct, createSceneAssetOutputProducer, createScriptablePackStagedAssetSnapshotSource, createStandardAssetOutputProducerRegistry, declaredPackExternalOutputs, discardImportPublication, finalizeImportProducts, finalizeSourcePackage, materialAssetOutputProducer, materializePreparedScriptablePack, meshAssetOutputProducer, normaliseForPack, normalizeSourcePackageError, packMeshBinV4, parseProducerReadiness, prepareAuthoredPackTransport, produceBuildAssets, produceScriptablePackProducts, produceScriptableSourcePackage, produceSourcePackage, projectImportProductForBuild, projectScriptablePackPublication, publishImportPublication, readCookedAuthoredPack, restoreImportPublication, runImport, scriptablePackInputs, sourcePackageAssetsByGuid, sourcePackageError, stageImportPublication };
|
|
2920
|
+
export { AssetOutputProducerRegistry, DEFAULT_CATALOG_IMPORTER_KEYS, ImporterRegistry, SHADER_RESERVED_IMPORTER_KEY, buildCatalogResult, buildScriptablePack, canonicalScriptableSourcePath, catalogImporterPolicy, commitImportPublication, containsSourcePackageError, createImportProduct, createSceneAssetOutputProducer, createScriptablePackStagedAssetSnapshotSource, createStandardAssetOutputProducerRegistry, declaredPackExternalOutputs, discardImportPublication, finalizeImportProducts, finalizeSourcePackage, materialAssetOutputProducer, materializePreparedScriptablePack, meshAssetOutputProducer, normaliseForPack, normalizeSourcePackageError, packMeshBinV4, parseProducerReadiness, prepareAuthoredPackTransport, produceBuildAssets, produceScriptablePackProducts, produceScriptableSourcePackage, produceSourcePackage, projectImportProductForBuild, projectScriptablePackPublication, publishImportPublication, readCookedAuthoredPack, restoreImportPublication, runImport, scriptablePackInputs, sourceDeclarationForCatalogPath, sourcePackageAssetsByGuid, sourcePackageError, stageImportPublication };
|
|
2831
2921
|
//# sourceMappingURL=index.mjs.map
|
|
2832
2922
|
//# sourceMappingURL=index.mjs.map
|