@forgeax/engine-pack 0.1.25 → 0.1.26

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.
@@ -11,16 +11,25 @@ export interface MaterialCookArtifact {
11
11
  readonly digest: string;
12
12
  readonly bytes: Uint8Array;
13
13
  }
14
- /** Backend capability projection for one immutable cooked material artifact. */
15
- export interface MaterialCookVariantContext {
14
+ /** Domain-owned inputs used to compile and select a material program. */
15
+ export interface MaterialCookProgramContext {
16
16
  readonly backend: 'webgpu' | 'webgl2' | 'wgpu-native';
17
17
  readonly capability: 'storage-buffer' | 'uniform-fallback';
18
+ readonly pipeline: 'forward' | 'deferred';
19
+ readonly geometry: 'mesh' | 'skinned' | 'sprite';
20
+ readonly pass: 'forward' | 'shadow' | 'depth';
21
+ readonly profile: 'forgeax-material-wgsl-v1';
22
+ readonly toolchain: 'naga-oil';
23
+ readonly instrumentation: 'none' | 'validation';
18
24
  }
19
- /** Additional backend artifact published with one material generation. */
20
- export interface MaterialCookVariant {
21
- readonly context: MaterialCookVariantContext;
25
+ /** Programs are derived artifacts, never independently authored assets. */
26
+ export interface MaterialCookProgram {
22
27
  readonly specializationKey: string;
23
28
  readonly artifact: MaterialCookArtifact;
29
+ readonly selections: readonly {
30
+ readonly pass: string;
31
+ readonly context: MaterialCookProgramContext;
32
+ }[];
24
33
  }
25
34
  export interface MaterialCookWasmProvenance {
26
35
  readonly sourceContentKey: string;
@@ -45,7 +54,7 @@ export interface MaterialCookIdentity {
45
54
  }
46
55
  export type MaterialCookIdentityInput = Omit<MaterialCookIdentity, 'cookIdentity'>;
47
56
  export interface MaterialCookReceipt {
48
- readonly schemaVersion: 'material-cook/3';
57
+ readonly schemaVersion: 'material-cook/4';
49
58
  readonly sourceClosure: readonly string[];
50
59
  readonly profile: string;
51
60
  readonly compilerVersion: string;
@@ -61,16 +70,14 @@ export interface MaterialParameterContract {
61
70
  readonly values: Readonly<Record<string, MaterialValue | null>>;
62
71
  }
63
72
  export interface CookedMaterialRecord {
64
- readonly schemaVersion: 'material-cook/3';
73
+ readonly schemaVersion: 'material-cook/4';
65
74
  readonly guid: string;
66
75
  readonly authored?: MaterialAsset;
67
76
  readonly materialGuid?: string;
68
77
  readonly publicationGeneration?: number;
69
78
  readonly specializationKey?: string;
70
- /** Compiler context used by the primary `artifact` entry. */
71
- readonly variantContext?: MaterialCookVariantContext;
72
- /** Additional immutable artifacts for other backend capability lanes. */
73
- readonly variants?: readonly MaterialCookVariant[];
79
+ readonly programs: readonly MaterialCookProgram[];
80
+ /** Digest of the complete program/Pass/context manifest. */
74
81
  readonly artifactDigest?: string;
75
82
  readonly sourceClosure?: readonly string[];
76
83
  readonly parameterContract?: MaterialParameterContract;
@@ -80,7 +87,6 @@ export interface CookedMaterialRecord {
80
87
  readonly values: Readonly<Record<string, MaterialValue | null>>;
81
88
  };
82
89
  readonly refs: MaterialCookRefs;
83
- readonly artifact: MaterialCookArtifact;
84
90
  readonly receipt: MaterialCookReceipt;
85
91
  }
86
92
  export interface MaterialCookRecordError {
@@ -115,4 +121,9 @@ export declare function serializeMaterialCookReceipt(receipt: MaterialCookReceip
115
121
  export declare function validateMaterialCookReceipt(value: unknown, expected?: MaterialCookIdentityExpectation): Result<MaterialCookReceipt, MaterialCookRecordError>;
116
122
  export declare function validateCookedMaterialRecord(value: unknown): Result<CookedMaterialRecord, MaterialCookRecordError>;
117
123
  export declare function projectCookedMaterialRecord(record: CookedMaterialRecord): Omit<CookedMaterialRecord, 'guid' | 'authored'>;
124
+ /** Canonical context key shared by publication validation and runtime selection. */
125
+ export declare function materialProgramContextKey(context: MaterialCookProgramContext): string;
126
+ export declare function validateMaterialCookProgramContext(value: unknown): Result<MaterialCookProgramContext, MaterialCookRecordError>;
127
+ /** Covers every selection and artifact while excluding transport copies of the bytes. */
128
+ export declare function createMaterialProgramSetDigest(programs: readonly MaterialCookProgram[], passes: readonly MaterialPass[]): string;
118
129
  //# sourceMappingURL=material-cook.d.ts.map
@@ -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B,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,gBAAgB,CA6B1F;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEtE;AAgBD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,yBAAyB,GAAG,oBAAoB,CAmBjG;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAElF;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAEjF;AAsED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,QAAQ,GAAE,+BAAoC,GAC7C,MAAM,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAkEtD;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,CAgKvD;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,oBAAoB,GAC3B,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,UAAU,CAAC,CAQjD;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,MAAM,CAErF;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,0BAA0B,EAAE,uBAAuB,CAAC,CAsB7D;AAED,yFAAyF;AACzF,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,SAAS,mBAAmB,EAAE,EACxC,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,MAAM,CAoBR"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type CookedMaterialRecord, collectMaterialCookRefs, createMaterialArtifactDigest, createMaterialCookIdentity, isStandardMaterialRecord, isStandardRootModule, type MaterialCookArtifact, type MaterialCookIdentity, type MaterialCookIdentityExpectation, type MaterialCookIdentityInput, type MaterialCookReceipt, type MaterialCookRecordError, type MaterialCookRefs, type MaterialCookVariant, type MaterialCookVariantContext, type MaterialCookWasmProvenance, materialLayerPlanIdentity, projectCookedMaterialRecord, serializeCookedMaterialRecord, serializeMaterialCookReceipt, validateCookedMaterialRecord, validateMaterialCookReceipt, } from './evidence/material-cook.js';
1
+ export { type CookedMaterialRecord, collectMaterialCookRefs, createMaterialArtifactDigest, createMaterialCookIdentity, createMaterialProgramSetDigest, isStandardMaterialRecord, isStandardRootModule, type MaterialCookArtifact, type MaterialCookIdentity, type MaterialCookIdentityExpectation, type MaterialCookIdentityInput, type MaterialCookProgram, type MaterialCookProgramContext, type MaterialCookReceipt, type MaterialCookRecordError, type MaterialCookRefs, type MaterialCookWasmProvenance, materialLayerPlanIdentity, materialProgramContextKey, projectCookedMaterialRecord, serializeCookedMaterialRecord, serializeMaterialCookReceipt, validateCookedMaterialRecord, validateMaterialCookProgramContext, validateMaterialCookReceipt, } from './evidence/material-cook.js';
2
2
  export { buildOfflineAssetEvidence, packageVerification } from './evidence/offline-evidence.js';
3
3
  export { AssetGuid, isValidAssetGuidString, isValidPackSourceKey, PACK_SOURCE_KEY_RE, PackageId, } from './guid.js';
4
4
  export { decodeMeshBinHeader, MESH_BIN_DIGEST_BYTES, MESH_BIN_HEADER_V4_BYTES, MESH_BIN_PROJECTION_VERSION, MESH_BIN_VERSION, type MeshBinContractError, type MeshBinHeaderResult, type MeshBinHeaderV4, writeMeshBinHeader, } from './mesh-bin-contract.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK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AAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAWvE"}
package/dist/index.mjs CHANGED
@@ -6819,8 +6819,7 @@ var STANDARD_ROOT_MODULES = /* @__PURE__ */ new Set([
6819
6819
  "forgeax::default-standard-pbr",
6820
6820
  "forgeax::pbr-skin",
6821
6821
  "forgeax_material::standard",
6822
- "forgeax_material::pbr-skin",
6823
- "forgeax::default-shadow-caster"
6822
+ "forgeax_material::pbr-skin"
6824
6823
  ]);
6825
6824
  function isStandardRootModule(module) {
6826
6825
  return STANDARD_ROOT_MODULES.has(module);
@@ -6919,7 +6918,7 @@ function serializeMaterialCookReceipt(receipt) {
6919
6918
  function invalid(field, actual) {
6920
6919
  return err({
6921
6920
  code: "material-cook-record-invalid",
6922
- expected: "a complete material-cook/3 record with layered identity and provenance",
6921
+ expected: "a complete material-cook/4 record with layered identity and provenance",
6923
6922
  hint: "re-cook the material and publish its record, artifact, references, and receipt together",
6924
6923
  detail: {
6925
6924
  field,
@@ -6980,7 +6979,7 @@ function validateIdentity(value) {
6980
6979
  function validateMaterialCookReceipt(value, expected = {}) {
6981
6980
  if (value === null || typeof value !== "object") return invalid("receipt");
6982
6981
  const candidate = value;
6983
- if (candidate.schemaVersion !== "material-cook/3")
6982
+ if (candidate.schemaVersion !== "material-cook/4")
6984
6983
  return invalid("receipt.schemaVersion", candidate.schemaVersion);
6985
6984
  const identityResult = validateIdentity(candidate.identity);
6986
6985
  if (!identityResult.ok) return identityResult;
@@ -7018,7 +7017,7 @@ function validateMaterialCookReceipt(value, expected = {}) {
7018
7017
  return invalid("receipt.identity.cookIdentity", identity.cookIdentity);
7019
7018
  }
7020
7019
  return ok({
7021
- schemaVersion: "material-cook/3",
7020
+ schemaVersion: "material-cook/4",
7022
7021
  sourceClosure: candidate.sourceClosure,
7023
7022
  profile: candidate.profile,
7024
7023
  compilerVersion: candidate.compilerVersion,
@@ -7032,7 +7031,7 @@ function validateMaterialCookReceipt(value, expected = {}) {
7032
7031
  function validateCookedMaterialRecord(value) {
7033
7032
  if (value === null || typeof value !== "object") return invalid("record");
7034
7033
  const candidate = value;
7035
- if (candidate.schemaVersion !== "material-cook/3")
7034
+ if (candidate.schemaVersion !== "material-cook/4")
7036
7035
  return invalid("schemaVersion", candidate.schemaVersion);
7037
7036
  if (typeof candidate.guid !== "string" || !candidate.guid) return invalid("guid");
7038
7037
  if (candidate.materialGuid !== void 0 && typeof candidate.materialGuid !== "string")
@@ -7041,33 +7040,8 @@ function validateCookedMaterialRecord(value) {
7041
7040
  return invalid("publicationGeneration", candidate.publicationGeneration);
7042
7041
  if (candidate.specializationKey !== void 0 && typeof candidate.specializationKey !== "string")
7043
7042
  return invalid("specializationKey");
7044
- if (candidate.variantContext !== void 0) {
7045
- if (candidate.variantContext === null || typeof candidate.variantContext !== "object")
7046
- return invalid("variantContext");
7047
- const context = candidate.variantContext;
7048
- if (context.backend !== "webgpu" && context.backend !== "webgl2" && context.backend !== "wgpu-native" || context.capability !== "storage-buffer" && context.capability !== "uniform-fallback")
7049
- return invalid("variantContext", candidate.variantContext);
7050
- }
7051
- if (candidate.variants !== void 0) {
7052
- if (!Array.isArray(candidate.variants)) return invalid("variants");
7053
- for (const [index, value2] of candidate.variants.entries()) {
7054
- if (value2 === null || typeof value2 !== "object") return invalid(`variants[${index}]`);
7055
- const variant = value2;
7056
- const context = variant.context;
7057
- if (context === null || typeof context !== "object")
7058
- return invalid(`variants[${index}].context`);
7059
- const contextRecord = context;
7060
- if (contextRecord.backend !== "webgpu" && contextRecord.backend !== "webgl2" && contextRecord.backend !== "wgpu-native" || contextRecord.capability !== "storage-buffer" && contextRecord.capability !== "uniform-fallback")
7061
- return invalid(`variants[${index}].context`, context);
7062
- if (typeof variant.specializationKey !== "string" || variant.specializationKey.length === 0)
7063
- return invalid(`variants[${index}].specializationKey`);
7064
- if (variant.artifact === null || typeof variant.artifact !== "object")
7065
- return invalid(`variants[${index}].artifact`);
7066
- const variantArtifact = variant.artifact;
7067
- if (typeof variantArtifact.mediaType !== "string" || typeof variantArtifact.path !== "string" || typeof variantArtifact.digest !== "string" || normalizeArtifactBytes(variantArtifact.bytes) === void 0)
7068
- return invalid(`variants[${index}].artifact`);
7069
- }
7070
- }
7043
+ if ("artifact" in candidate || "variants" in candidate || "variantContext" in candidate)
7044
+ return invalid("programs", "legacy single-artifact publication");
7071
7045
  if (candidate.artifactDigest !== void 0 && typeof candidate.artifactDigest !== "string")
7072
7046
  return invalid("artifactDigest");
7073
7047
  if (candidate.sourceClosure !== void 0 && (!Array.isArray(candidate.sourceClosure) || candidate.sourceClosure.some((path) => typeof path !== "string")))
@@ -7084,24 +7058,72 @@ function validateCookedMaterialRecord(value) {
7084
7058
  if (candidate.resolved === null || typeof candidate.resolved !== "object")
7085
7059
  return invalid("resolved");
7086
7060
  if (candidate.refs === null || typeof candidate.refs !== "object") return invalid("refs");
7087
- if (candidate.artifact === null || typeof candidate.artifact !== "object")
7088
- return invalid("artifact");
7089
7061
  if (candidate.receipt === null || typeof candidate.receipt !== "object")
7090
7062
  return invalid("receipt");
7091
- const artifact = candidate.artifact;
7092
- if (typeof artifact.digest !== "string" || !Array.isArray(artifact.bytes) && !ArrayBuffer.isView(artifact.bytes)) {
7093
- return invalid("artifact");
7094
- }
7095
- const receiptResult = validateMaterialCookReceipt(candidate.receipt, {
7096
- artifactDigest: artifact.digest
7097
- });
7098
- if (!receiptResult.ok) return receiptResult;
7099
7063
  const resolved = candidate.resolved;
7100
7064
  if (!Array.isArray(resolved.passes)) return invalid("resolved.passes", resolved.passes);
7101
7065
  if (!Array.isArray(resolved.parameters))
7102
7066
  return invalid("resolved.parameters", resolved.parameters);
7103
7067
  if (resolved.values === null || typeof resolved.values !== "object" || Array.isArray(resolved.values))
7104
7068
  return invalid("resolved.values", resolved.values);
7069
+ const passes = resolved.passes;
7070
+ const passNames = /* @__PURE__ */ new Set();
7071
+ for (const [index, pass] of passes.entries()) {
7072
+ if (pass === null || typeof pass !== "object" || typeof pass.name !== "string" || !pass.name || passNames.has(pass.name) || pass.program === null || typeof pass.program !== "object" || typeof pass.program.module !== "string")
7073
+ return invalid(`resolved.passes[${index}]`);
7074
+ passNames.add(pass.name);
7075
+ }
7076
+ if (!Array.isArray(candidate.programs) || candidate.programs.length === 0)
7077
+ return invalid("programs");
7078
+ const programs = [];
7079
+ const programKeys = /* @__PURE__ */ new Set();
7080
+ const selections = /* @__PURE__ */ new Set();
7081
+ const selectedPasses = /* @__PURE__ */ new Set();
7082
+ for (const [index, entry] of candidate.programs.entries()) {
7083
+ const field = `programs[${index}]`;
7084
+ if (entry === null || typeof entry !== "object") return invalid(field);
7085
+ const program = entry;
7086
+ if (typeof program.specializationKey !== "string" || !program.specializationKey || programKeys.has(program.specializationKey))
7087
+ return invalid(`${field}.specializationKey`);
7088
+ programKeys.add(program.specializationKey);
7089
+ if (program.artifact === null || typeof program.artifact !== "object")
7090
+ return invalid(`${field}.artifact`);
7091
+ const artifact = program.artifact;
7092
+ const bytes = normalizeArtifactBytes(artifact.bytes);
7093
+ if (artifact.mediaType !== "text/wgsl" || typeof artifact.path !== "string" || !artifact.path || typeof artifact.digest !== "string" || !artifact.digest || bytes === void 0)
7094
+ return invalid(`${field}.artifact`);
7095
+ if (!Array.isArray(program.selections) || program.selections.length === 0)
7096
+ return invalid(`${field}.selections`);
7097
+ const programSelections = [];
7098
+ for (const [selectionIndex, selection] of program.selections.entries()) {
7099
+ const selectionField = `${field}.selections[${selectionIndex}]`;
7100
+ if (selection === null || typeof selection !== "object" || !passNames.has(selection.pass))
7101
+ return invalid(selectionField);
7102
+ const context = validateMaterialCookProgramContext(selection.context);
7103
+ if (!context.ok)
7104
+ return invalid(
7105
+ `${selectionField}.${context.error.detail.field}`,
7106
+ context.error.detail.actual
7107
+ );
7108
+ const key = JSON.stringify([selection.pass, materialProgramContextKey(context.value)]);
7109
+ if (selections.has(key)) return invalid(selectionField, "ambiguous Pass/context selection");
7110
+ selections.add(key);
7111
+ selectedPasses.add(selection.pass);
7112
+ programSelections.push({ pass: selection.pass, context: context.value });
7113
+ }
7114
+ programs.push({
7115
+ specializationKey: program.specializationKey,
7116
+ artifact: { mediaType: "text/wgsl", path: artifact.path, digest: artifact.digest, bytes },
7117
+ selections: programSelections
7118
+ });
7119
+ }
7120
+ if ([...passNames].some((pass) => !selectedPasses.has(pass)))
7121
+ return invalid("programs.selections", "unpublished Pass");
7122
+ const manifestDigest = createMaterialProgramSetDigest(programs, passes);
7123
+ const receiptResult = validateMaterialCookReceipt(candidate.receipt, {
7124
+ artifactDigest: manifestDigest
7125
+ });
7126
+ if (!receiptResult.ok) return receiptResult;
7105
7127
  let expectedLayerPlanIdentity;
7106
7128
  try {
7107
7129
  expectedLayerPlanIdentity = materialLayerPlanIdentity({
@@ -7116,44 +7138,70 @@ function validateCookedMaterialRecord(value) {
7116
7138
  receiptResult.value.derivedInterface.layerPlanIdentity
7117
7139
  );
7118
7140
  }
7119
- if (candidate.artifactDigest !== void 0 && candidate.artifactDigest !== artifact.digest)
7141
+ if (candidate.artifactDigest !== void 0 && candidate.artifactDigest !== manifestDigest)
7120
7142
  return invalid("artifactDigest", candidate.artifactDigest);
7121
7143
  if (candidate.publicationGeneration !== void 0 && receiptResult.value.identity.cookGeneration !== candidate.publicationGeneration)
7122
7144
  return invalid("receipt.identity.cookGeneration", receiptResult.value.identity.cookGeneration);
7123
- const normalized = {
7145
+ return ok({
7124
7146
  ...candidate,
7125
- artifact: {
7126
- ...artifact,
7127
- bytes: normalizeArtifactBytes(artifact.bytes)
7128
- },
7129
- ...Array.isArray(candidate.variants) ? {
7130
- variants: candidate.variants.map((value2) => {
7131
- const variant = value2;
7132
- const variantArtifact = variant.artifact;
7133
- return {
7134
- ...variant,
7135
- artifact: {
7136
- ...variantArtifact,
7137
- bytes: normalizeArtifactBytes(variantArtifact.bytes)
7138
- }
7139
- };
7140
- })
7141
- } : {},
7147
+ programs,
7142
7148
  receipt: receiptResult.value
7143
- };
7144
- return ok(normalized);
7149
+ });
7145
7150
  }
7146
7151
  function projectCookedMaterialRecord(record) {
7147
7152
  return {
7148
7153
  resolved: record.resolved,
7149
7154
  refs: record.refs,
7150
- artifact: record.artifact,
7151
- ...record.variantContext === void 0 ? {} : { variantContext: record.variantContext },
7152
- ...record.variants === void 0 ? {} : { variants: record.variants },
7155
+ programs: record.programs,
7153
7156
  receipt: record.receipt,
7154
7157
  schemaVersion: record.schemaVersion
7155
7158
  };
7156
7159
  }
7160
+ function materialProgramContextKey(context) {
7161
+ return JSON.stringify(jsonValue(context));
7162
+ }
7163
+ function validateMaterialCookProgramContext(value) {
7164
+ if (value === null || typeof value !== "object" || Array.isArray(value))
7165
+ return invalid("context", value);
7166
+ const context = value;
7167
+ const fields = {
7168
+ backend: ["webgpu", "webgl2", "wgpu-native"],
7169
+ capability: ["storage-buffer", "uniform-fallback"],
7170
+ pipeline: ["forward", "deferred"],
7171
+ geometry: ["mesh", "skinned", "sprite"],
7172
+ pass: ["forward", "shadow", "depth"],
7173
+ profile: ["forgeax-material-wgsl-v1"],
7174
+ toolchain: ["naga-oil"],
7175
+ instrumentation: ["none", "validation"]
7176
+ };
7177
+ for (const field of Object.keys(context)) {
7178
+ if (!(field in fields)) return invalid(`context.${field}`, context[field]);
7179
+ }
7180
+ for (const [field, allowed] of Object.entries(fields)) {
7181
+ if (!allowed.includes(context[field]))
7182
+ return invalid(`context.${field}`, context[field]);
7183
+ }
7184
+ return ok({ ...context });
7185
+ }
7186
+ function createMaterialProgramSetDigest(programs, passes) {
7187
+ const manifest = {
7188
+ passes,
7189
+ programs: programs.map((program) => ({
7190
+ specializationKey: program.specializationKey,
7191
+ artifact: {
7192
+ path: program.artifact.path,
7193
+ mediaType: program.artifact.mediaType,
7194
+ digest: program.artifact.digest
7195
+ },
7196
+ selections: [...program.selections].sort(
7197
+ (a, b) => JSON.stringify(jsonValue(a)).localeCompare(JSON.stringify(jsonValue(b)))
7198
+ )
7199
+ })).sort((a, b) => a.specializationKey.localeCompare(b.specializationKey))
7200
+ };
7201
+ return createMaterialArtifactDigest(
7202
+ new TextEncoder().encode(JSON.stringify(jsonValue(manifest)))
7203
+ );
7204
+ }
7157
7205
  function packageEvidence(input) {
7158
7206
  return {
7159
7207
  guid: input.guid,
@@ -9395,6 +9443,6 @@ function parsePackV2(value) {
9395
9443
  return ok(value);
9396
9444
  }
9397
9445
 
9398
- export { AssetGuid, MESH_BIN_DIGEST_BYTES, MESH_BIN_HEADER_V4_BYTES, MESH_BIN_PROJECTION_VERSION, MESH_BIN_VERSION, PACK_AUTHORING_OPERATION_DESCRIPTORS, PACK_AUTHORING_OPERATION_IDS, PACK_PARAMETER_TYPES, PACK_SOURCE_KEY_RE, PackageId, SCRIPTABLE_PACK_ASSET_KINDS, buildOfflineAssetEvidence, calculateTopologyDiff, collectMaterialCookRefs, createMaterialArtifactDigest, createMaterialCookIdentity, createPackAuthoringGateway, decodeMeshBinHeader, definePack, definePackageId, diffTopology, hasPackParameters, isScriptablePackAssetKind, isStandardMaterialRecord, isStandardRootModule, isValidAssetGuidString, isValidPackSourceKey, materialLayerPlanIdentity, packageVerification, parsePackSourceJson, parsePackV2, projectCookedMaterialRecord, projectDirectPackJson, projectRuntimePack, projectScriptablePackMeta, projectScriptablePackSceneComponents, resolvePackInheritance, resolvePackParameterInheritance, resolvePackParameterValues, serializeCookedMaterialRecord, serializeMaterialCookReceipt, validateArtifactPath, validateCookedMaterialRecord, validateMaterialCookReceipt, validateMeta, validatePack, validatePackDefinition, validatePackV2, validateProducerContract, validateProducerOutputs, writeMaterialArtifact, writeMeshBinHeader };
9446
+ export { AssetGuid, MESH_BIN_DIGEST_BYTES, MESH_BIN_HEADER_V4_BYTES, MESH_BIN_PROJECTION_VERSION, MESH_BIN_VERSION, PACK_AUTHORING_OPERATION_DESCRIPTORS, PACK_AUTHORING_OPERATION_IDS, PACK_PARAMETER_TYPES, PACK_SOURCE_KEY_RE, PackageId, SCRIPTABLE_PACK_ASSET_KINDS, buildOfflineAssetEvidence, calculateTopologyDiff, collectMaterialCookRefs, createMaterialArtifactDigest, createMaterialCookIdentity, createMaterialProgramSetDigest, createPackAuthoringGateway, decodeMeshBinHeader, definePack, definePackageId, diffTopology, hasPackParameters, isScriptablePackAssetKind, isStandardMaterialRecord, isStandardRootModule, isValidAssetGuidString, isValidPackSourceKey, materialLayerPlanIdentity, materialProgramContextKey, packageVerification, parsePackSourceJson, parsePackV2, projectCookedMaterialRecord, projectDirectPackJson, projectRuntimePack, projectScriptablePackMeta, projectScriptablePackSceneComponents, resolvePackInheritance, resolvePackParameterInheritance, resolvePackParameterValues, serializeCookedMaterialRecord, serializeMaterialCookReceipt, validateArtifactPath, validateCookedMaterialRecord, validateMaterialCookProgramContext, validateMaterialCookReceipt, validateMeta, validatePack, validatePackDefinition, validatePackV2, validateProducerContract, validateProducerOutputs, writeMaterialArtifact, writeMeshBinHeader };
9399
9447
  //# sourceMappingURL=index.mjs.map
9400
9448
  //# sourceMappingURL=index.mjs.map