@forgeax/engine-import 0.1.23 → 0.1.25
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 +5 -5
- package/dist/__tests__/scriptable-pack-build.unit.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-build.unit.test.d.ts.map +1 -0
- package/dist/build-production.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +284 -60
- package/dist/index.mjs.map +1 -1
- package/dist/{parameterized-scriptable-pack.d.ts → scriptable-pack-build.d.ts} +20 -15
- package/dist/scriptable-pack-build.d.ts.map +1 -0
- package/dist/scriptable-pack-host.d.ts +15 -13
- package/dist/scriptable-pack-host.d.ts.map +1 -1
- package/dist/scriptable-pack.d.ts +2 -1
- package/dist/scriptable-pack.d.ts.map +1 -1
- package/dist/source-package-publication.d.ts +7 -0
- package/dist/source-package-publication.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/{parameterized-scriptable-pack.unit.test.ts → scriptable-pack-build.unit.test.ts} +11 -14
- package/src/__tests__/scriptable-pack-host.unit.test.ts +53 -5
- package/src/__tests__/scriptable-pack-output-producers.unit.test.ts +4 -5
- package/src/__tests__/source-package-publication.integration.test.ts +141 -0
- package/src/build-production.ts +45 -50
- package/src/index.ts +17 -16
- package/src/{parameterized-scriptable-pack.ts → scriptable-pack-build.ts} +91 -27
- package/src/scriptable-pack-host.ts +48 -40
- package/src/scriptable-pack.ts +2 -1
- package/src/source-package-publication.ts +242 -10
- package/dist/__tests__/parameterized-scriptable-pack.unit.test.d.ts +0 -2
- package/dist/__tests__/parameterized-scriptable-pack.unit.test.d.ts.map +0 -1
- package/dist/parameterized-scriptable-pack.d.ts.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
1
2
|
import { mkdtemp, readdir, readFile, rm } from 'node:fs/promises';
|
|
2
3
|
import { tmpdir } from 'node:os';
|
|
3
4
|
import { join } from 'node:path';
|
|
5
|
+
import { DdcEntryStore } from '@forgeax/engine-ddc';
|
|
4
6
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
5
7
|
import {
|
|
6
8
|
commitImportPublication,
|
|
@@ -11,6 +13,40 @@ import {
|
|
|
11
13
|
|
|
12
14
|
const GUID = '019e3969-1d48-7c3b-ac24-6d68f457065f';
|
|
13
15
|
const KEY = 'a'.repeat(64);
|
|
16
|
+
const ARTIFACT_PATH = `${GUID}/body.bin`;
|
|
17
|
+
const ARTIFACT_BYTES = new Uint8Array([9, 8, 7]);
|
|
18
|
+
const ARTIFACT_DIGEST = `sha256:${createHash('sha256').update(ARTIFACT_BYTES).digest('hex')}`;
|
|
19
|
+
|
|
20
|
+
const validArtifact = {
|
|
21
|
+
path: ARTIFACT_PATH,
|
|
22
|
+
mediaType: 'application/octet-stream',
|
|
23
|
+
bytes: ARTIFACT_BYTES,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const validDescriptor = {
|
|
27
|
+
path: ARTIFACT_PATH,
|
|
28
|
+
mediaType: validArtifact.mediaType,
|
|
29
|
+
byteLength: ARTIFACT_BYTES.byteLength,
|
|
30
|
+
integrity: { algorithm: 'sha256' as const, digest: ARTIFACT_DIGEST },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function closurePack(
|
|
34
|
+
artifacts: Readonly<Record<string, unknown>> = { body: validDescriptor },
|
|
35
|
+
): Record<string, unknown> {
|
|
36
|
+
return {
|
|
37
|
+
schemaVersion: '2.0.0',
|
|
38
|
+
kind: 'internal-text-package',
|
|
39
|
+
assets: [
|
|
40
|
+
{
|
|
41
|
+
guid: GUID,
|
|
42
|
+
kind: 'fixture',
|
|
43
|
+
payload: { value: 'same' },
|
|
44
|
+
refs: [],
|
|
45
|
+
artifacts,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
14
50
|
|
|
15
51
|
function input(root: string, desiredKey = KEY): ImportPublicationInput {
|
|
16
52
|
return {
|
|
@@ -97,4 +133,109 @@ describe('source package publication concurrency', () => {
|
|
|
97
133
|
false,
|
|
98
134
|
);
|
|
99
135
|
});
|
|
136
|
+
|
|
137
|
+
it('publishes the complete transport artifact closure into the DDC entry', async () => {
|
|
138
|
+
const root = await mkdtemp(join(tmpdir(), 'forgeax-source-publication-'));
|
|
139
|
+
roots.push(root);
|
|
140
|
+
const pack = closurePack();
|
|
141
|
+
const publicationInput = {
|
|
142
|
+
...input(root),
|
|
143
|
+
pack,
|
|
144
|
+
transport: {
|
|
145
|
+
path: join(root, 'runtime', `${GUID}.pack.json`),
|
|
146
|
+
body: JSON.stringify(pack),
|
|
147
|
+
artifacts: [validArtifact],
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const staged = await stageImportPublication(publicationInput);
|
|
152
|
+
expect(staged.ok).toBe(true);
|
|
153
|
+
if (!staged.ok) return;
|
|
154
|
+
await expect(commitImportPublication(staged.candidate)).resolves.toMatchObject({ ok: true });
|
|
155
|
+
|
|
156
|
+
const entry = await new DdcEntryStore(root).read(KEY);
|
|
157
|
+
expect(entry?.artifacts[ARTIFACT_PATH]).toMatchObject({
|
|
158
|
+
mediaType: validArtifact.mediaType,
|
|
159
|
+
bytes: validArtifact.bytes,
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it.each([
|
|
164
|
+
{
|
|
165
|
+
label: 'missing body',
|
|
166
|
+
pack: closurePack(),
|
|
167
|
+
artifacts: [],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
label: 'media type mismatch',
|
|
171
|
+
pack: closurePack(),
|
|
172
|
+
artifacts: [{ ...validArtifact, mediaType: 'application/x-wrong' }],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
label: 'byte length mismatch',
|
|
176
|
+
pack: closurePack(),
|
|
177
|
+
artifacts: [{ ...validArtifact, bytes: new Uint8Array([9, 8]) }],
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
label: 'sha256 mismatch',
|
|
181
|
+
pack: closurePack({
|
|
182
|
+
body: {
|
|
183
|
+
...validDescriptor,
|
|
184
|
+
integrity: { algorithm: 'sha256' as const, digest: 'sha256:bad' },
|
|
185
|
+
},
|
|
186
|
+
}),
|
|
187
|
+
artifacts: [validArtifact],
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: 'duplicate transport path',
|
|
191
|
+
pack: closurePack(),
|
|
192
|
+
artifacts: [validArtifact, validArtifact],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
label: 'duplicate descriptor path',
|
|
196
|
+
pack: closurePack({ body: validDescriptor, alias: { ...validDescriptor } }),
|
|
197
|
+
artifacts: [validArtifact],
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: 'unexpected transport body',
|
|
201
|
+
pack: closurePack(),
|
|
202
|
+
artifacts: [
|
|
203
|
+
validArtifact,
|
|
204
|
+
{
|
|
205
|
+
path: `${GUID}/extra.bin`,
|
|
206
|
+
mediaType: 'application/octet-stream',
|
|
207
|
+
bytes: new Uint8Array([1]),
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
label: 'transport body mismatch',
|
|
213
|
+
pack: closurePack(),
|
|
214
|
+
body: JSON.stringify({ schemaVersion: '2.0.0', kind: 'internal-text-package', assets: [] }),
|
|
215
|
+
artifacts: [validArtifact],
|
|
216
|
+
},
|
|
217
|
+
] as const)('rejects $label before advancing the DDC head', async ({ pack, artifacts, body }) => {
|
|
218
|
+
const root = await mkdtemp(join(tmpdir(), 'forgeax-source-publication-'));
|
|
219
|
+
roots.push(root);
|
|
220
|
+
const publicationInput: ImportPublicationInput = {
|
|
221
|
+
...input(root),
|
|
222
|
+
pack,
|
|
223
|
+
transport: {
|
|
224
|
+
path: join(root, 'runtime', `${GUID}.pack.json`),
|
|
225
|
+
body: body ?? JSON.stringify(pack),
|
|
226
|
+
artifacts,
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const staged = await stageImportPublication(publicationInput);
|
|
231
|
+
|
|
232
|
+
expect(staged).toMatchObject({
|
|
233
|
+
ok: false,
|
|
234
|
+
error: {
|
|
235
|
+
code: 'source-package-publication-invalid',
|
|
236
|
+
},
|
|
237
|
+
head: { state: 'missing' },
|
|
238
|
+
});
|
|
239
|
+
expect(await new DdcEntryStore(root).listKeys()).toEqual([]);
|
|
240
|
+
});
|
|
100
241
|
});
|
package/src/build-production.ts
CHANGED
|
@@ -11,11 +11,11 @@ import type { NativeCooker } from '@forgeax/engine-pack/native-cooker';
|
|
|
11
11
|
import type { LegacyPackInventoryDocument } from '@forgeax/engine-pack/scanner';
|
|
12
12
|
import {
|
|
13
13
|
PackageId,
|
|
14
|
-
|
|
14
|
+
parsePackSourceJson,
|
|
15
15
|
projectDirectPackJson,
|
|
16
16
|
resolvePackParameterInheritance,
|
|
17
17
|
} from '@forgeax/engine-pack/source';
|
|
18
|
-
import {
|
|
18
|
+
import { loadScriptablePack } from '@forgeax/engine-pack/source-node';
|
|
19
19
|
import type {
|
|
20
20
|
AssetPublicationEnvelope,
|
|
21
21
|
AssetPublicationOutput,
|
|
@@ -30,11 +30,11 @@ import { projectImportProductForBuild } from './pack-projection.js';
|
|
|
30
30
|
import {
|
|
31
31
|
canonicalScriptableSourcePath,
|
|
32
32
|
declaredPackExternalOutputs,
|
|
33
|
-
type
|
|
34
|
-
type PreparedParameterizedScriptablePack,
|
|
33
|
+
type PreparedScriptablePack,
|
|
35
34
|
prepareDirectPackTransport,
|
|
36
35
|
prepareLegacyPackTransport,
|
|
37
|
-
|
|
36
|
+
produceScriptablePackProducts,
|
|
37
|
+
type ScriptablePackInput,
|
|
38
38
|
} from './scriptable-pack-host.js';
|
|
39
39
|
import {
|
|
40
40
|
finalizeSourcePackage,
|
|
@@ -133,21 +133,21 @@ function sourceKeysFor(
|
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
interface
|
|
137
|
-
readonly input:
|
|
138
|
-
readonly prepared:
|
|
136
|
+
interface PackBuildBundle {
|
|
137
|
+
readonly input: ScriptablePackInput;
|
|
138
|
+
readonly prepared: PreparedScriptablePack;
|
|
139
139
|
readonly entries: readonly PackIndexEntry[];
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
type
|
|
142
|
+
type PackSourceSubject = {
|
|
143
143
|
readonly kind: 'source';
|
|
144
144
|
readonly packageId: PackageId;
|
|
145
145
|
readonly sourcePath: string;
|
|
146
|
-
readonly definition: import('@forgeax/engine-pack/source').
|
|
146
|
+
readonly definition: import('@forgeax/engine-pack/source').AnyScriptablePackDefinition;
|
|
147
147
|
readonly sourceClosure: readonly import('@forgeax/engine-pack/source').ScriptablePackSourceClosureEntry[];
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
type
|
|
150
|
+
type PackInstanceSubject = {
|
|
151
151
|
readonly kind: 'instance';
|
|
152
152
|
readonly packageId: PackageId;
|
|
153
153
|
readonly parent: PackageId;
|
|
@@ -155,16 +155,13 @@ type ParameterizedInstanceSubject = {
|
|
|
155
155
|
readonly sourcePath: string;
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
type
|
|
158
|
+
type PackDirectSubject = {
|
|
159
159
|
readonly kind: 'direct';
|
|
160
160
|
readonly packageId: PackageId;
|
|
161
161
|
readonly sourcePath: string;
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
type
|
|
165
|
-
| ParameterizedSourceSubject
|
|
166
|
-
| ParameterizedInstanceSubject
|
|
167
|
-
| ParameterizedDirectSubject;
|
|
164
|
+
type PackSourceIndexSubject = PackSourceSubject | PackInstanceSubject | PackDirectSubject;
|
|
168
165
|
|
|
169
166
|
function dynamicFailure(context: BuildProductionOptions, value: unknown): never {
|
|
170
167
|
const candidate = value !== null && typeof value === 'object' ? value : {};
|
|
@@ -175,23 +172,20 @@ function dynamicFailure(context: BuildProductionOptions, value: unknown): never
|
|
|
175
172
|
readonly detail?: unknown;
|
|
176
173
|
};
|
|
177
174
|
throw context.fail({
|
|
178
|
-
code: typeof error.code === 'string' ? error.code : '
|
|
175
|
+
code: typeof error.code === 'string' ? error.code : 'pack-build-failed',
|
|
179
176
|
expected:
|
|
180
177
|
typeof error.expected === 'string'
|
|
181
178
|
? error.expected
|
|
182
|
-
: 'the
|
|
179
|
+
: 'the Pack source generation to produce a valid terminal result',
|
|
183
180
|
hint:
|
|
184
181
|
typeof error.hint === 'string'
|
|
185
182
|
? error.hint
|
|
186
|
-
: 'inspect the
|
|
183
|
+
: 'inspect the Pack source subject and rebuild the current generation',
|
|
187
184
|
...(error.detail === undefined ? {} : { detail: error.detail }),
|
|
188
185
|
});
|
|
189
186
|
}
|
|
190
187
|
|
|
191
|
-
function
|
|
192
|
-
context: BuildProductionOptions,
|
|
193
|
-
sourcePath: string,
|
|
194
|
-
): string {
|
|
188
|
+
function packCatalogSourcePath(context: BuildProductionOptions, sourcePath: string): string {
|
|
195
189
|
const projected = context.fsForImport.sourceIdentityFor?.(sourcePath);
|
|
196
190
|
const logical =
|
|
197
191
|
projected === undefined || isAbsolute(projected)
|
|
@@ -200,13 +194,13 @@ function parameterizedCatalogSourcePath(
|
|
|
200
194
|
return canonicalScriptableSourcePath(logical).replaceAll('\\', '/');
|
|
201
195
|
}
|
|
202
196
|
|
|
203
|
-
/** Build
|
|
204
|
-
async function
|
|
197
|
+
/** Build ScriptablePack roots and Pack JSON instances before normal emission. */
|
|
198
|
+
async function buildPackSources(
|
|
205
199
|
context: BuildProductionOptions,
|
|
206
|
-
): Promise<readonly
|
|
207
|
-
const subjects = new Map<string,
|
|
200
|
+
): Promise<readonly PackBuildBundle[]> {
|
|
201
|
+
const subjects = new Map<string, PackSourceIndexSubject>();
|
|
208
202
|
for (const [sourcePath, declaration] of context.inventory.sourceDeclarations) {
|
|
209
|
-
if (declaration.format === 'pack.ts
|
|
203
|
+
if (declaration.format === 'pack.ts') {
|
|
210
204
|
const key = PackageId.format(declaration.definition.packageId).toLowerCase();
|
|
211
205
|
subjects.set(key, {
|
|
212
206
|
kind: 'source',
|
|
@@ -220,7 +214,7 @@ async function buildParameterizedPackages(
|
|
|
220
214
|
if (declaration.format !== 'pack.json' || declaration.value.schemaVersion !== '3.0.0') {
|
|
221
215
|
continue;
|
|
222
216
|
}
|
|
223
|
-
const parsed =
|
|
217
|
+
const parsed = parsePackSourceJson(declaration.value);
|
|
224
218
|
if (!parsed.ok) dynamicFailure(context, parsed.error);
|
|
225
219
|
if (parsed.value.format === 'direct') {
|
|
226
220
|
subjects.set(PackageId.format(parsed.value.packageId).toLowerCase(), {
|
|
@@ -238,7 +232,7 @@ async function buildParameterizedPackages(
|
|
|
238
232
|
});
|
|
239
233
|
}
|
|
240
234
|
}
|
|
241
|
-
const sourceSubject = (packageId: PackageId):
|
|
235
|
+
const sourceSubject = (packageId: PackageId): PackSourceSubject | undefined => {
|
|
242
236
|
const subject = subjects.get(PackageId.format(packageId).toLowerCase());
|
|
243
237
|
return subject?.kind === 'source' ? subject : undefined;
|
|
244
238
|
};
|
|
@@ -269,16 +263,16 @@ async function buildParameterizedPackages(
|
|
|
269
263
|
const orderedSubjects = [...subjects.values()].sort((left, right) =>
|
|
270
264
|
left.sourcePath.localeCompare(right.sourcePath),
|
|
271
265
|
);
|
|
272
|
-
const inputs:
|
|
266
|
+
const inputs: ScriptablePackInput[] = [];
|
|
273
267
|
for (const subject of orderedSubjects) {
|
|
274
268
|
if (subject.kind === 'source') {
|
|
275
269
|
const packageId = PackageId.format(subject.packageId);
|
|
276
|
-
const loaded = await
|
|
270
|
+
const loaded = await loadScriptablePack(subject.sourcePath);
|
|
277
271
|
if (!loaded.ok) dynamicFailure(context, loaded.error);
|
|
278
272
|
if (PackageId.format(loaded.value.packageId) !== packageId) {
|
|
279
273
|
dynamicFailure(context, {
|
|
280
274
|
code: 'pack-source-revision-conflict',
|
|
281
|
-
expected: 'the
|
|
275
|
+
expected: 'the ScriptablePack source packageId to remain fixed during production',
|
|
282
276
|
hint: 'retry after source writes settle and rebuild the current generation',
|
|
283
277
|
detail: {
|
|
284
278
|
sourcePath: subject.sourcePath,
|
|
@@ -289,7 +283,7 @@ async function buildParameterizedPackages(
|
|
|
289
283
|
}
|
|
290
284
|
inputs.push({
|
|
291
285
|
sourcePath: subject.sourcePath,
|
|
292
|
-
displaySourcePath:
|
|
286
|
+
displaySourcePath: packCatalogSourcePath(context, subject.sourcePath),
|
|
293
287
|
definition: loaded.value,
|
|
294
288
|
sourceClosure: subject.sourceClosure,
|
|
295
289
|
publicationGeneration: context.generation,
|
|
@@ -316,18 +310,18 @@ async function buildParameterizedPackages(
|
|
|
316
310
|
const root = sourceSubject(resolved.value.rootPackageId);
|
|
317
311
|
if (root === undefined) {
|
|
318
312
|
dynamicFailure(context, {
|
|
319
|
-
code: 'pack-parent-
|
|
320
|
-
expected: 'the instance parent chain to terminate at a
|
|
321
|
-
hint: 'point the instance at a
|
|
313
|
+
code: 'pack-parent-has-no-parameters',
|
|
314
|
+
expected: 'the instance parent chain to terminate at a ScriptablePack source',
|
|
315
|
+
hint: 'point the instance at a ScriptablePack *.pack.ts source with parameters',
|
|
322
316
|
detail: { packageId: PackageId.format(subject.packageId) },
|
|
323
317
|
});
|
|
324
318
|
}
|
|
325
|
-
const loaded = await
|
|
319
|
+
const loaded = await loadScriptablePack(root.sourcePath);
|
|
326
320
|
if (!loaded.ok) dynamicFailure(context, loaded.error);
|
|
327
321
|
if (PackageId.format(loaded.value.packageId) !== PackageId.format(root.packageId)) {
|
|
328
322
|
dynamicFailure(context, {
|
|
329
323
|
code: 'pack-source-revision-conflict',
|
|
330
|
-
expected: 'the
|
|
324
|
+
expected: 'the ScriptablePack parent packageId to remain fixed during production',
|
|
331
325
|
hint: 'retry after source writes settle and rebuild the current generation',
|
|
332
326
|
detail: {
|
|
333
327
|
sourcePath: root.sourcePath,
|
|
@@ -339,7 +333,7 @@ async function buildParameterizedPackages(
|
|
|
339
333
|
const packageId = PackageId.format(subject.packageId);
|
|
340
334
|
inputs.push({
|
|
341
335
|
sourcePath: subject.sourcePath,
|
|
342
|
-
displaySourcePath:
|
|
336
|
+
displaySourcePath: packCatalogSourcePath(context, subject.sourcePath),
|
|
343
337
|
definition: loaded.value,
|
|
344
338
|
sourceClosure: root.sourceClosure,
|
|
345
339
|
subjectPackageId: subject.packageId,
|
|
@@ -369,21 +363,22 @@ async function buildParameterizedPackages(
|
|
|
369
363
|
},
|
|
370
364
|
);
|
|
371
365
|
const availableGuids = new Set(requiredGuids.map((guid) => AssetGuid.format(guid).toLowerCase()));
|
|
372
|
-
const built = await
|
|
366
|
+
const built = await produceScriptablePackProducts({
|
|
373
367
|
sources: inputs,
|
|
374
368
|
declaredExternalOutputs: externalOutputs,
|
|
369
|
+
cookers: context.cookers,
|
|
375
370
|
availableGuids,
|
|
376
371
|
});
|
|
377
372
|
if (!built.ok) dynamicFailure(context, built.error);
|
|
378
373
|
|
|
379
|
-
const bundles:
|
|
374
|
+
const bundles: PackBuildBundle[] = [];
|
|
380
375
|
for (const input of inputs) {
|
|
381
376
|
const prepared = built.value.get(input.displaySourcePath);
|
|
382
377
|
if (prepared === undefined) {
|
|
383
378
|
dynamicFailure(context, {
|
|
384
|
-
code: '
|
|
379
|
+
code: 'pack-build-failed',
|
|
385
380
|
expected: 'the worklist to return one prepared result per source subject',
|
|
386
|
-
hint: 'rerun
|
|
381
|
+
hint: 'rerun Pack source generation from a clean inventory',
|
|
387
382
|
detail: { sourcePath: input.sourcePath },
|
|
388
383
|
});
|
|
389
384
|
}
|
|
@@ -544,13 +539,13 @@ async function emitAuthoredPack(
|
|
|
544
539
|
});
|
|
545
540
|
}
|
|
546
541
|
if (declaration.value.schemaVersion === '3.0.0') {
|
|
547
|
-
const parsed =
|
|
542
|
+
const parsed = parsePackSourceJson(declaration.value);
|
|
548
543
|
if (!parsed.ok) dynamicFailure(work.context, parsed.error);
|
|
549
544
|
if (parsed.value.format !== 'direct') {
|
|
550
545
|
dynamicFailure(work.context, {
|
|
551
546
|
code: 'catalog-declaration-missing',
|
|
552
547
|
expected: 'a direct v3 Pack declaration for an indexed authored output',
|
|
553
|
-
hint: 'instances are built from their
|
|
548
|
+
hint: 'instances are built from their ScriptablePack parent and do not have direct Catalog rows',
|
|
554
549
|
detail: { stage: 'scan', sourcePath: packPath },
|
|
555
550
|
});
|
|
556
551
|
}
|
|
@@ -659,10 +654,10 @@ async function emitAuthoredPack(
|
|
|
659
654
|
}
|
|
660
655
|
}
|
|
661
656
|
|
|
662
|
-
async function
|
|
657
|
+
async function emitScriptablePack(
|
|
663
658
|
work: BuildEmissionWork,
|
|
664
659
|
guidSeen: Set<string>,
|
|
665
|
-
bundle:
|
|
660
|
+
bundle: PackBuildBundle,
|
|
666
661
|
): Promise<void> {
|
|
667
662
|
const { input, prepared } = bundle;
|
|
668
663
|
const packageId = PackageId.format(input.subjectPackageId ?? input.definition.packageId);
|
|
@@ -854,7 +849,7 @@ async function emitBuildEntry(
|
|
|
854
849
|
export async function produceBuildAssets(
|
|
855
850
|
context: BuildProductionOptions,
|
|
856
851
|
): Promise<PackIndexEntry[]> {
|
|
857
|
-
const dynamicBundles = await
|
|
852
|
+
const dynamicBundles = await buildPackSources(context);
|
|
858
853
|
const entries = [
|
|
859
854
|
...context.inventory.entries,
|
|
860
855
|
...dynamicBundles.flatMap((bundle) => bundle.entries),
|
|
@@ -864,7 +859,7 @@ export async function produceBuildAssets(
|
|
|
864
859
|
const guidSeen = new Set<string>();
|
|
865
860
|
const work: BuildEmissionWork = { importedEntries, context };
|
|
866
861
|
for (const bundle of dynamicBundles) {
|
|
867
|
-
await
|
|
862
|
+
await emitScriptablePack(work, guidSeen, bundle);
|
|
868
863
|
}
|
|
869
864
|
for (const entry of importedEntries) {
|
|
870
865
|
if (!guidSeen.has(entry.guid.toLowerCase()))
|
package/src/index.ts
CHANGED
|
@@ -106,31 +106,31 @@ export {
|
|
|
106
106
|
validateMeshLodContract,
|
|
107
107
|
} from './mesh-lod.js';
|
|
108
108
|
export { projectImportProductForBuild } from './pack-projection.js';
|
|
109
|
-
export {
|
|
110
|
-
buildParameterizedScriptablePack,
|
|
111
|
-
buildParameterizedScriptablePackWorklist,
|
|
112
|
-
type ParameterizedScriptablePackBuildOptions,
|
|
113
|
-
type ParameterizedScriptablePackBuildProduct,
|
|
114
|
-
type ParameterizedScriptablePackBuildResult,
|
|
115
|
-
type ParameterizedScriptablePackWorkItem,
|
|
116
|
-
type ParameterizedScriptablePackWorklistOptions,
|
|
117
|
-
type ParameterizedScriptablePackWorklistProduct,
|
|
118
|
-
} from './parameterized-scriptable-pack.js';
|
|
119
109
|
export {
|
|
120
110
|
type AssetOutputInput,
|
|
121
111
|
type AssetOutputPayload,
|
|
122
112
|
type AssetOutputProducer,
|
|
123
113
|
AssetOutputProducerRegistry,
|
|
124
114
|
type AssetOutputProduct,
|
|
115
|
+
type PackBuildProduct,
|
|
125
116
|
type ScriptablePackAssetSnapshot,
|
|
126
117
|
type ScriptablePackAssetSnapshotSource,
|
|
127
|
-
type ScriptablePackBuildProduct,
|
|
128
118
|
type ScriptablePackDomainError,
|
|
129
119
|
type ScriptablePackExternalEvidence,
|
|
130
120
|
type ScriptablePackExternalUsage,
|
|
131
121
|
type ScriptablePackSourceClosureEntry,
|
|
132
122
|
type ScriptablePackStagedOutput,
|
|
133
123
|
} from './scriptable-pack.js';
|
|
124
|
+
export {
|
|
125
|
+
buildScriptablePack,
|
|
126
|
+
buildScriptablePackWorklist,
|
|
127
|
+
type ScriptablePackBuildOptions,
|
|
128
|
+
type ScriptablePackBuildProduct,
|
|
129
|
+
type ScriptablePackBuildResult,
|
|
130
|
+
type ScriptablePackBuildWorkItem,
|
|
131
|
+
type ScriptablePackBuildWorklistOptions,
|
|
132
|
+
type ScriptablePackBuildWorklistProduct,
|
|
133
|
+
} from './scriptable-pack-build.js';
|
|
134
134
|
export {
|
|
135
135
|
createScriptablePackFileAssetSnapshotSource,
|
|
136
136
|
type ScriptablePackFileAssetSnapshotError,
|
|
@@ -142,15 +142,15 @@ export {
|
|
|
142
142
|
type DirectPackTransportInput,
|
|
143
143
|
declaredPackExternalOutputs,
|
|
144
144
|
type LegacyPackTransport,
|
|
145
|
-
|
|
146
|
-
type
|
|
147
|
-
type ParameterizedScriptablePackProductionOptions,
|
|
148
|
-
type PreparedParameterizedScriptablePack,
|
|
145
|
+
materializePreparedScriptablePack,
|
|
146
|
+
type PreparedScriptablePack,
|
|
149
147
|
prepareDirectPackTransport,
|
|
150
148
|
prepareLegacyPackTransport,
|
|
151
|
-
|
|
149
|
+
produceScriptablePackProducts,
|
|
152
150
|
readCookedAuthoredPack,
|
|
153
151
|
type ScriptablePackExternalImportOptions,
|
|
152
|
+
type ScriptablePackInput,
|
|
153
|
+
type ScriptablePackProductionOptions,
|
|
154
154
|
type ScriptablePackPublicationFacts,
|
|
155
155
|
type ScriptablePackTransportPaths,
|
|
156
156
|
type ScriptablePackTransportSink,
|
|
@@ -196,6 +196,7 @@ export {
|
|
|
196
196
|
export {
|
|
197
197
|
commitImportPublication,
|
|
198
198
|
discardImportPublication,
|
|
199
|
+
type ImportPublicationArtifact,
|
|
199
200
|
type ImportPublicationError,
|
|
200
201
|
type ImportPublicationInput,
|
|
201
202
|
type ImportPublicationResult,
|