@neocompose/cli 0.87.0 → 0.87.2

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.
@@ -18457,7 +18457,7 @@ var init_registry = __esm({
18457
18457
  "../packages/manifest/schema-contract/registry.mjs"() {
18458
18458
  "use strict";
18459
18459
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
18460
- cliVersion: "0.87.0",
18460
+ cliVersion: "0.87.2",
18461
18461
  projectFileUploadBatchSize: 32,
18462
18462
  documentRecords: {
18463
18463
  member: {
@@ -46436,7 +46436,7 @@ function evaluateBaseConstructorArguments(record7, baseRecord, argumentValues, t
46436
46436
  argument2.name,
46437
46437
  executeCompiledFunction(
46438
46438
  getter,
46439
- { ...ctx, thisValue },
46439
+ bindThisValue(ctx, thisValue),
46440
46440
  argumentValues,
46441
46441
  false
46442
46442
  )
@@ -47985,7 +47985,10 @@ function constructDeclaredClassValueWithinFrame(descriptor, record7, info, scope
47985
47985
  const preparedArgumentScopes = prepareConstructorArgumentScopes(
47986
47986
  record7,
47987
47987
  argumentValues,
47988
- ctx
47988
+ {
47989
+ ...bindThisValue(ctx, null),
47990
+ __initializerGenericEnv: descriptor.instanceEnv
47991
+ }
47989
47992
  );
47990
47993
  const createdValues = [];
47991
47994
  const storageKeyDeclarations = /* @__PURE__ */ new Map();
@@ -52745,6 +52748,13 @@ function resolveVirtualInstanceGraph(args) {
52745
52748
  for (const location3 of locationsByPath.values()) {
52746
52749
  if (location3.materializedRow !== null) continue;
52747
52750
  const effective = rowsById.get(location3.id);
52751
+ if (isLiteralValueContent(effective) && effective.constructorArgs !== void 0) {
52752
+ effective.constructorArgs = materializedGraph.remapReferenceArguments(
52753
+ effective,
52754
+ replayedId,
52755
+ location3.member
52756
+ );
52757
+ }
52748
52758
  if (location3.member.kind === 25 /* NSDelegate */) {
52749
52759
  effective.value = remapMemberDelegateReceiver(
52750
52760
  effective.value,
@@ -112939,15 +112949,12 @@ function genericEnvironmentKey(env) {
112939
112949
  [...env].sort(([left], [right]) => left.localeCompare(right))
112940
112950
  );
112941
112951
  }
112942
- function createTypedValueNormalizer(reader, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo2, genericEnvironmentForRow, rowIdentities, readTracking) {
112952
+ function createTypedValueNormalizer(reader, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo2, genericEnvironmentForRow, rowIdentities, readTracking, referenceTargets, localizedTexts) {
112943
112953
  const visiting = /* @__PURE__ */ new Set();
112944
112954
  const completed = /* @__PURE__ */ new Map();
112945
112955
  const compare2 = createEffectiveValueComparator();
112946
112956
  let cycleCount = 0;
112947
112957
  const locale = document.localizationConfig?.mainLocale;
112948
- const localizedTexts = /* @__PURE__ */ new Map();
112949
- for (const text of document.localizedTexts ?? [])
112950
- localizedTexts.set(text.id, text);
112951
112958
  const normalizeLiteral = (value) => {
112952
112959
  if (Array.isArray(value)) return value.map(normalizeLiteral);
112953
112960
  if (value === null || typeof value !== "object") return value;
@@ -112957,6 +112964,15 @@ function createTypedValueNormalizer(reader, document, childrenByContainerId, par
112957
112964
  return result;
112958
112965
  };
112959
112966
  const normalizeTypedLiteral = (value, typeInfo) => {
112967
+ if (referenceTargets !== void 0 && typeInfo.type === 29 /* Reference */) {
112968
+ if (typeof value === "string") return referenceTargets(value);
112969
+ if (Array.isArray(value))
112970
+ return value.map((entry) => normalizeTypedLiteral(entry, typeInfo));
112971
+ }
112972
+ if (typeInfo.type === 9 /* Lookup */ && Array.isArray(value))
112973
+ return value.map(
112974
+ (entry) => normalizeTypedLiteral(entry, typeInfo.entryTypeInfo)
112975
+ );
112960
112976
  if (typeInfo.type === 25 /* NSDelegate */ && value !== null && typeof value === "object" && !Array.isArray(value) && typeof Reflect.get(value, "code") === "string") {
112961
112977
  const captures = Reflect.get(value, "captures");
112962
112978
  return {
@@ -113068,7 +113084,7 @@ function createTypedValueNormalizer(reader, document, childrenByContainerId, par
113068
113084
  }
113069
113085
  const normalized = {
113070
113086
  ...rowIdentities?.has(valueId) ? { id: valueId } : {},
113071
- ...typeof row.classId === "string" ? { classId: row.classId } : {},
113087
+ ...typeof row.classId === "string" && !(typeInfo.type === 7 /* Class */ && row.classId === typeInfo.classId) ? { classId: row.classId } : {},
113072
113088
  ...row.genericBindings === void 0 ? {} : { genericBindings: normalizeGenericBindings(row.genericBindings) },
113073
113089
  value,
113074
113090
  ...carriesSemanticConstructorArguments(row) ? {
@@ -113282,12 +113298,14 @@ var init_effective_value_reader = __esm({
113282
113298
  resolvedRoots = /* @__PURE__ */ new Set();
113283
113299
  normalizer;
113284
113300
  identityNormalizers = /* @__PURE__ */ new WeakMap();
113301
+ referenceNormalizers = /* @__PURE__ */ new WeakMap();
113302
+ localizedTextIndex;
113285
113303
  resolvedDocument;
113286
113304
  indexedDocument;
113287
113305
  materializedIndex;
113288
113306
  storedPlacements;
113289
113307
  graphCache;
113290
- createNormalizer(rowIdentities) {
113308
+ createNormalizer(rowIdentities, referenceTargets) {
113291
113309
  return createTypedValueNormalizer(
113292
113310
  this,
113293
113311
  this.document,
@@ -113297,7 +113315,15 @@ var init_effective_value_reader = __esm({
113297
113315
  (member, env) => this.graph.typeInfoForMember(member, env),
113298
113316
  (row) => this.graph.genericEnvironmentForRow(row, this.placementFor(row.id)),
113299
113317
  rowIdentities,
113300
- this.context.readTracking
113318
+ this.context.readTracking,
113319
+ referenceTargets,
113320
+ this.localizedTextsById()
113321
+ );
113322
+ }
113323
+ localizedTextsById() {
113324
+ if (this.base !== void 0) return this.root.localizedTextsById();
113325
+ return this.localizedTextIndex ??= new Map(
113326
+ (this.document.localizedTexts ?? []).map((text) => [text.id, text])
113301
113327
  );
113302
113328
  }
113303
113329
  /** The base document with this context's override rows spliced in. */
@@ -113567,6 +113593,14 @@ var init_effective_value_reader = __esm({
113567
113593
  this.classDefaultRows.set(valueId, projected);
113568
113594
  return projected;
113569
113595
  }
113596
+ /** Project all resolved graphs, including fields backed by declaration defaults. */
113597
+ rowsWithClassDefaults() {
113598
+ const rows = /* @__PURE__ */ new Map();
113599
+ for (const row of this.effectiveRows.values()) {
113600
+ rows.set(row.id, this.rowWithClassDefaults(row.id) ?? row);
113601
+ }
113602
+ return rows;
113603
+ }
113570
113604
  /** Resolve every owned descendant before a caller finalizes its read tracking. */
113571
113605
  resolveGraph(valueId, placement) {
113572
113606
  this.placements.set(valueId, placement);
@@ -113701,8 +113735,21 @@ var init_effective_value_reader = __esm({
113701
113735
  assertStoredConstructionStamp(root);
113702
113736
  return this.normalizer.normalizeConstructorArgs(args, root);
113703
113737
  }
113704
- normalizeTypedRow(valueId, typeInfo, placement, env, rowIdentities) {
113738
+ normalizeTypedRow(valueId, typeInfo, placement, env, rowIdentities, referenceTargets) {
113705
113739
  if (placement !== void 0) this.placements.set(valueId, placement);
113740
+ if (referenceTargets !== void 0) {
113741
+ let contexts = this.referenceNormalizers.get(referenceTargets);
113742
+ if (contexts === void 0) {
113743
+ contexts = /* @__PURE__ */ new Map();
113744
+ this.referenceNormalizers.set(referenceTargets, contexts);
113745
+ }
113746
+ let normalizer2 = contexts.get(rowIdentities);
113747
+ if (normalizer2 === void 0) {
113748
+ normalizer2 = this.createNormalizer(rowIdentities, referenceTargets);
113749
+ contexts.set(rowIdentities, normalizer2);
113750
+ }
113751
+ return normalizer2.normalizeTypedRow(valueId, typeInfo, placement, env);
113752
+ }
113706
113753
  let normalizer = this.normalizer;
113707
113754
  if (rowIdentities !== void 0) {
113708
113755
  const cached = this.identityNormalizers.get(rowIdentities);
@@ -126572,159 +126619,247 @@ var init_dialogue_lower = __esm({
126572
126619
  }
126573
126620
  });
126574
126621
 
126575
- // src/project-source/record-fields.ts
126576
- function nonVolatileFields(base) {
126577
- const known = authoredFields.get(base);
126578
- if (known !== void 0) return known;
126579
- const fields = { ...base };
126580
- delete fields.projectId;
126581
- delete fields.createdAt;
126582
- delete fields.updatedAt;
126583
- if (isFrozenJsonData(base)) {
126584
- freezeJsonData(fields);
126585
- authoredFields.set(base, fields);
126586
- storedRows.set(fields, base);
126622
+ // ../src/database/document-initializer-compiler.ts
126623
+ function initializerCompilerState(document, compilationProject) {
126624
+ const existing = documentInitializerCompilerStates.get(document);
126625
+ if (existing !== void 0) {
126626
+ if (compilationProject !== void 0) {
126627
+ existing.compilationProject = compilationProject;
126628
+ }
126629
+ return existing;
126587
126630
  }
126588
- return fields;
126631
+ const created = {
126632
+ compilationProject: compilationProject ?? null
126633
+ };
126634
+ documentInitializerCompilerStates.set(document, created);
126635
+ return created;
126589
126636
  }
126590
- function reuseAuthoredRecordFields(fields, base) {
126591
- if (!isObjectRecord(base) || !isFrozenJsonData(base)) return fields;
126592
- const stored = nonVolatileFields(base);
126593
- if (fields === stored) return stored;
126594
- const keys = Object.keys(fields);
126595
- if (keys.length !== Object.keys(stored).length) return fields;
126596
- for (const key of keys) {
126597
- if (!Object.hasOwn(stored, key)) return fields;
126598
- if (!Object.is(fields[key], stored[key])) return fields;
126637
+ function compilationProjectForDocument(document, state) {
126638
+ state.compilationProject ??= createNeoScriptCompilationProject({
126639
+ project: document.project,
126640
+ projectFiles: document.projectFiles,
126641
+ dialogueGroups: document.dialogueGroups,
126642
+ members: document.members,
126643
+ classes: document.classes,
126644
+ enums: document.enums,
126645
+ interfaces: document.interfaces,
126646
+ constructors: document.constructors ?? []
126647
+ });
126648
+ return state.compilationProject;
126649
+ }
126650
+ function documentMemberCompilationIndex(document) {
126651
+ const existing = documentMemberCompilationIndexes.get(document);
126652
+ if (existing !== void 0) return existing;
126653
+ const created = {
126654
+ membersById: new Map(
126655
+ document.members.map((member) => [member.id, member])
126656
+ ),
126657
+ ownerClassesByMemberId: new Map(
126658
+ document.classes.flatMap(
126659
+ (schemaClass2) => Object.values(schemaClass2.schema).map(
126660
+ (memberId) => [memberId, schemaClass2]
126661
+ )
126662
+ )
126663
+ )
126664
+ };
126665
+ documentMemberCompilationIndexes.set(document, created);
126666
+ return created;
126667
+ }
126668
+ function documentInitializerCompiler(document, compilationProject) {
126669
+ const state = initializerCompilerState(document, compilationProject);
126670
+ return (site) => {
126671
+ if (site.sourceValueId !== null) {
126672
+ compileValueInitializerDependency(
126673
+ document,
126674
+ site.sourceValueId,
126675
+ compilationProjectForDocument(document, state)
126676
+ );
126677
+ return;
126678
+ }
126679
+ if (site.memberId === null) return;
126680
+ compileMemberInitializerDependency(
126681
+ document,
126682
+ site.memberId,
126683
+ compilationProjectForDocument(document, state)
126684
+ );
126685
+ };
126686
+ }
126687
+ function valueInitializerCompilationSites(document) {
126688
+ const cached = documentValueInitializerCompilationSites.get(document);
126689
+ if (cached !== void 0) return cached;
126690
+ const rows = document.values.filter(isInitValueContent);
126691
+ const valuesById = new Map(
126692
+ document.values.map((value) => [value.id, value])
126693
+ );
126694
+ const ownershipTargetIds = valueIdsWithSourceChains(
126695
+ new Set(rows.map((row) => row.id)),
126696
+ valuesById
126697
+ );
126698
+ const rootOwners = /* @__PURE__ */ new Map();
126699
+ const owners = resolveOwnerMembersForValues(
126700
+ document,
126701
+ ownershipTargetIds,
126702
+ void 0,
126703
+ rootOwners
126704
+ );
126705
+ const sites = /* @__PURE__ */ new Map();
126706
+ for (const row of rows) {
126707
+ const member = owners.get(row.id);
126708
+ if (member === void 0) continue;
126709
+ const ownerContext = initializerOwnerContext(
126710
+ document,
126711
+ row.id,
126712
+ rootOwners,
126713
+ valuesById
126714
+ );
126715
+ sites.set(row.id, {
126716
+ row,
126717
+ member,
126718
+ ownerClass: ownerContext.declaringClass,
126719
+ lexicalThisClass: ownerContext.lexicalThisClass
126720
+ });
126599
126721
  }
126600
- return stored;
126722
+ documentValueInitializerCompilationSites.set(document, sites);
126723
+ return sites;
126601
126724
  }
126602
- function mergeMigrationServerFields(fileFields, baseData3) {
126603
- const original = storedRows.get(fileFields);
126604
- if (original !== void 0 && original === baseData3) return original;
126605
- const fullData = { ...fileFields };
126606
- if (!isObjectRecord(baseData3)) return fullData;
126607
- for (const field of MIGRATION_VOLATILE_FIELDS) {
126608
- if (baseData3[field] !== void 0) fullData[field] = baseData3[field];
126725
+ function compileValueInitializerDependency(document, valueId, compilationProject) {
126726
+ const site = valueInitializerCompilationSites(document).get(valueId);
126727
+ if (site === void 0) {
126728
+ throw new Error(
126729
+ "Cannot compile initializer dependency because its source value row is unresolved."
126730
+ );
126609
126731
  }
126610
- return fullData;
126732
+ compileValueRowInitializerBody({
126733
+ project: document.project,
126734
+ projectFiles: document.projectFiles,
126735
+ dialogueGroups: document.dialogueGroups,
126736
+ members: document.members,
126737
+ classes: document.classes,
126738
+ enums: document.enums,
126739
+ interfaces: document.interfaces,
126740
+ constructors: document.constructors ?? [],
126741
+ member: site.member,
126742
+ valueRow: { ...site.row },
126743
+ valueId: site.row.id,
126744
+ initializerOwnerClass: site.ownerClass,
126745
+ lexicalThisClass: site.lexicalThisClass,
126746
+ storedConstructionReplay: true,
126747
+ ...compilationProject === void 0 ? {} : { compilationProject }
126748
+ });
126611
126749
  }
126612
- function overlayAuthoredRecordFields(fileFields, base) {
126613
- return storedRows.get(fileFields) === base ? base : { ...base, ...fileFields };
126750
+ function compileMemberInitializerDependency(document, memberId, compilationProject) {
126751
+ const compileArgs = {
126752
+ project: document.project,
126753
+ projectFiles: document.projectFiles,
126754
+ dialogueGroups: document.dialogueGroups,
126755
+ members: document.members,
126756
+ classes: document.classes,
126757
+ enums: document.enums,
126758
+ interfaces: document.interfaces,
126759
+ constructors: document.constructors ?? []
126760
+ };
126761
+ const memberIndex = documentMemberCompilationIndex(document);
126762
+ const member = memberIndex.membersById.get(memberId);
126763
+ if (member === void 0) {
126764
+ throw new Error(
126765
+ `Cannot compile initializer dependency for missing member "${memberId}".`
126766
+ );
126767
+ }
126768
+ const thisClass = memberIndex.ownerClassesByMemberId.get(memberId) ?? null;
126769
+ compileMemberInitializerBody({
126770
+ ...compileArgs,
126771
+ member,
126772
+ thisClass,
126773
+ ...compilationProject === void 0 ? {} : { compilationProject }
126774
+ });
126614
126775
  }
126615
- var authoredFields, storedRows;
126616
- var init_record_fields = __esm({
126617
- "src/project-source/record-fields.ts"() {
126776
+ var documentInitializerCompilerStates, documentMemberCompilationIndexes, documentValueInitializerCompilationSites;
126777
+ var init_document_initializer_compiler = __esm({
126778
+ "../src/database/document-initializer-compiler.ts"() {
126618
126779
  "use strict";
126619
- init_value_comparison();
126620
- init_immutable_json3();
126621
- init_migration_files();
126622
- authoredFields = /* @__PURE__ */ new WeakMap();
126623
- storedRows = /* @__PURE__ */ new WeakMap();
126780
+ init_members();
126781
+ init_compile_ns_property();
126782
+ init_compiler_adapter();
126783
+ init_value_row_owner_members();
126784
+ documentInitializerCompilerStates = /* @__PURE__ */ new WeakMap();
126785
+ documentMemberCompilationIndexes = /* @__PURE__ */ new WeakMap();
126786
+ documentValueInitializerCompilationSites = /* @__PURE__ */ new WeakMap();
126624
126787
  }
126625
126788
  });
126626
126789
 
126627
- // src/project-source/schema-products.ts
126628
- function reuseSchemaProducts(base, manifest) {
126629
- if (!isFrozenJsonData(base)) return manifest;
126630
- const previous = previousManifests.get(base) ?? base;
126631
- function collection(entries, oldEntries) {
126632
- const byId = new Map(oldEntries.map((entry) => [entry.id, entry]));
126633
- const products = entries.map((entry) => {
126634
- const old = byId.get(entry.id);
126635
- return old !== void 0 && jsonDataEqual(entry, old) ? old : freezeJsonData(entry);
126636
- });
126637
- return products.length === oldEntries.length && products.every((entry, index) => entry === oldEntries[index]) ? oldEntries : products;
126638
- }
126639
- const result = freezeJsonData({
126640
- ...manifest,
126641
- classes: collection(manifest.classes, previous.classes),
126642
- constructors: collection(manifest.constructors, previous.constructors),
126643
- members: collection(manifest.members, previous.members),
126644
- interfaces: collection(manifest.interfaces, previous.interfaces),
126645
- enums: collection(manifest.enums, previous.enums),
126646
- variants: collection(manifest.variants, previous.variants),
126647
- variantFolders: collection(
126648
- manifest.variantFolders,
126649
- previous.variantFolders
126650
- ),
126651
- textureTemplates: collection(
126652
- manifest.textureTemplates,
126653
- previous.textureTemplates
126654
- ),
126655
- audioTemplates: collection(
126656
- manifest.audioTemplates,
126657
- previous.audioTemplates
126658
- ),
126659
- localizationStatuses: collection(
126660
- manifest.localizationStatuses,
126661
- previous.localizationStatuses
126662
- ),
126663
- internalRecordRelations: collection(
126664
- manifest.internalRecordRelations,
126665
- previous.internalRecordRelations
126666
- ),
126667
- localization: jsonDataEqual(manifest.localization, previous.localization) ? previous.localization : manifest.localization
126790
+ // ../packages/neoscript-runtime/src/materialize-values.ts
126791
+ function materializeInitializerValue2(args) {
126792
+ return materializeInitializerValue({
126793
+ ...args,
126794
+ evaluateInitializer: evaluateMemberInitializer
126668
126795
  });
126669
- const product = jsonDataEqual(previous, result) ? previous : result;
126670
- previousManifests.set(base, product);
126671
- return product;
126672
- }
126673
- function createSchemaDocumentMemo() {
126674
- const products = /* @__PURE__ */ new WeakMap();
126675
- return (base, documents, discriminator, compute) => {
126676
- if (!isFrozenJsonData(base) || !documents.every(isFrozenJsonData))
126677
- return compute();
126678
- const previous = products.get(base);
126679
- if (previous?.discriminator === discriminator && previous.documents.length === documents.length && documents.every(
126680
- (document, index) => document === previous.documents[index]
126681
- ))
126682
- return previous.result;
126683
- const result = compute();
126684
- products.set(base, { documents: [...documents], discriminator, result });
126685
- return result;
126686
- };
126687
- }
126688
- function reusePatchedSchemaDocument(document, data) {
126689
- if (!isFrozenJsonData(document)) return { ...document, data };
126690
- if (jsonDataEqual(document.data, data)) return document;
126691
- const previous = patchedDocuments.get(document);
126692
- if (previous !== void 0 && jsonDataEqual(previous.data, data))
126693
- return previous;
126694
- const result = freezeJsonData({ ...document, data });
126695
- patchedDocuments.set(document, result);
126696
- return result;
126697
126796
  }
126698
- var previousManifests, patchedDocuments;
126699
- var init_schema_products = __esm({
126700
- "src/project-source/schema-products.ts"() {
126797
+ var init_materialize_values = __esm({
126798
+ "../packages/neoscript-runtime/src/materialize-values.ts"() {
126701
126799
  "use strict";
126702
- init_immutable_json3();
126703
- previousManifests = /* @__PURE__ */ new WeakMap();
126704
- patchedDocuments = /* @__PURE__ */ new WeakMap();
126800
+ init_evaluateInitializer();
126801
+ init_initializer_materialization();
126705
126802
  }
126706
126803
  });
126707
126804
 
126708
- // src/project-source/source-base-cache.ts
126709
- function sourceBaseV4(records3, compute) {
126710
- const cached = bases.get(records3);
126711
- if (cached !== void 0) return cached;
126712
- const result = compute();
126713
- if (isFrozenJsonData(records3)) {
126714
- freezeJsonData(result.lowering.records);
126715
- freezeJsonData(result.documents);
126716
- freezeJsonData(result.manifest);
126717
- freezeJsonData(result.recoveries);
126718
- bases.set(records3, result);
126805
+ // ../packages/models/src/localization/localized-text-create-envelope.ts
126806
+ function completeLocalizedTextCreateEnvelope(data, config) {
126807
+ const text = asUnknownRecord(data);
126808
+ if (text === null) return data;
126809
+ const localeValues = asUnknownRecord(text.localeValues);
126810
+ const mainLocaleValue = localeValues === null ? null : asUnknownRecord(localeValues[config.mainLocale]);
126811
+ const completedMainLocaleValue = mainLocaleValue === null ? null : {
126812
+ ...mainLocaleValue,
126813
+ ...mainLocaleValue.statusId === void 0 ? { statusId: config.mainLocaleDefaultStatusId } : {},
126814
+ ...mainLocaleValue.updatedAt === void 0 && text.updatedAt !== void 0 ? { updatedAt: text.updatedAt } : {}
126815
+ };
126816
+ return {
126817
+ ...text,
126818
+ ...text.links === void 0 ? { links: [] } : {},
126819
+ ...localeValues === null || completedMainLocaleValue === null ? {} : {
126820
+ localeValues: {
126821
+ ...localeValues,
126822
+ [config.mainLocale]: completedMainLocaleValue
126823
+ }
126824
+ }
126825
+ };
126826
+ }
126827
+ function buildLocalizedTextCreateForLink(args) {
126828
+ const completed = completeLocalizedTextCreateEnvelope(
126829
+ {
126830
+ id: args.id,
126831
+ projectId: args.projectId,
126832
+ ...args.memberSource === void 0 ? {} : { memberSource: args.memberSource },
126833
+ sourceComment: null,
126834
+ links: args.memberSource === void 0 ? [args.link] : [],
126835
+ localeValues: {
126836
+ [args.config.mainLocale]: {
126837
+ value: args.value,
126838
+ localeComment: null
126839
+ }
126840
+ },
126841
+ createdAt: args.now,
126842
+ updatedAt: args.now
126843
+ },
126844
+ args.config
126845
+ );
126846
+ if (!isLocalizedText(completed)) {
126847
+ throw new Error(
126848
+ `Localized text "${args.id}" could not be completed into a valid create envelope.`
126849
+ );
126719
126850
  }
126720
- return result;
126851
+ return completed;
126721
126852
  }
126722
- var bases;
126723
- var init_source_base_cache = __esm({
126724
- "src/project-source/source-base-cache.ts"() {
126853
+ function asUnknownRecord(value) {
126854
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
126855
+ return null;
126856
+ }
126857
+ return value;
126858
+ }
126859
+ var init_localized_text_create_envelope = __esm({
126860
+ "../packages/models/src/localization/localized-text-create-envelope.ts"() {
126725
126861
  "use strict";
126726
- init_immutable_json3();
126727
- bases = /* @__PURE__ */ new WeakMap();
126862
+ init_localization_types();
126728
126863
  }
126729
126864
  });
126730
126865
 
@@ -127734,250 +127869,6 @@ var init_neo_script_recompile_scope = __esm({
127734
127869
  }
127735
127870
  });
127736
127871
 
127737
- // ../src/database/document-initializer-compiler.ts
127738
- function initializerCompilerState(document, compilationProject) {
127739
- const existing = documentInitializerCompilerStates.get(document);
127740
- if (existing !== void 0) {
127741
- if (compilationProject !== void 0) {
127742
- existing.compilationProject = compilationProject;
127743
- }
127744
- return existing;
127745
- }
127746
- const created = {
127747
- compilationProject: compilationProject ?? null
127748
- };
127749
- documentInitializerCompilerStates.set(document, created);
127750
- return created;
127751
- }
127752
- function compilationProjectForDocument(document, state) {
127753
- state.compilationProject ??= createNeoScriptCompilationProject({
127754
- project: document.project,
127755
- projectFiles: document.projectFiles,
127756
- dialogueGroups: document.dialogueGroups,
127757
- members: document.members,
127758
- classes: document.classes,
127759
- enums: document.enums,
127760
- interfaces: document.interfaces,
127761
- constructors: document.constructors ?? []
127762
- });
127763
- return state.compilationProject;
127764
- }
127765
- function documentMemberCompilationIndex(document) {
127766
- const existing = documentMemberCompilationIndexes.get(document);
127767
- if (existing !== void 0) return existing;
127768
- const created = {
127769
- membersById: new Map(
127770
- document.members.map((member) => [member.id, member])
127771
- ),
127772
- ownerClassesByMemberId: new Map(
127773
- document.classes.flatMap(
127774
- (schemaClass2) => Object.values(schemaClass2.schema).map(
127775
- (memberId) => [memberId, schemaClass2]
127776
- )
127777
- )
127778
- )
127779
- };
127780
- documentMemberCompilationIndexes.set(document, created);
127781
- return created;
127782
- }
127783
- function documentInitializerCompiler(document, compilationProject) {
127784
- const state = initializerCompilerState(document, compilationProject);
127785
- return (site) => {
127786
- if (site.sourceValueId !== null) {
127787
- compileValueInitializerDependency(
127788
- document,
127789
- site.sourceValueId,
127790
- compilationProjectForDocument(document, state)
127791
- );
127792
- return;
127793
- }
127794
- if (site.memberId === null) return;
127795
- compileMemberInitializerDependency(
127796
- document,
127797
- site.memberId,
127798
- compilationProjectForDocument(document, state)
127799
- );
127800
- };
127801
- }
127802
- function valueInitializerCompilationSites(document) {
127803
- const cached = documentValueInitializerCompilationSites.get(document);
127804
- if (cached !== void 0) return cached;
127805
- const rows = document.values.filter(isInitValueContent);
127806
- const valuesById = new Map(
127807
- document.values.map((value) => [value.id, value])
127808
- );
127809
- const ownershipTargetIds = valueIdsWithSourceChains(
127810
- new Set(rows.map((row) => row.id)),
127811
- valuesById
127812
- );
127813
- const rootOwners = /* @__PURE__ */ new Map();
127814
- const owners = resolveOwnerMembersForValues(
127815
- document,
127816
- ownershipTargetIds,
127817
- void 0,
127818
- rootOwners
127819
- );
127820
- const sites = /* @__PURE__ */ new Map();
127821
- for (const row of rows) {
127822
- const member = owners.get(row.id);
127823
- if (member === void 0) continue;
127824
- const ownerContext = initializerOwnerContext(
127825
- document,
127826
- row.id,
127827
- rootOwners,
127828
- valuesById
127829
- );
127830
- sites.set(row.id, {
127831
- row,
127832
- member,
127833
- ownerClass: ownerContext.declaringClass,
127834
- lexicalThisClass: ownerContext.lexicalThisClass
127835
- });
127836
- }
127837
- documentValueInitializerCompilationSites.set(document, sites);
127838
- return sites;
127839
- }
127840
- function compileValueInitializerDependency(document, valueId, compilationProject) {
127841
- const site = valueInitializerCompilationSites(document).get(valueId);
127842
- if (site === void 0) {
127843
- throw new Error(
127844
- "Cannot compile initializer dependency because its source value row is unresolved."
127845
- );
127846
- }
127847
- compileValueRowInitializerBody({
127848
- project: document.project,
127849
- projectFiles: document.projectFiles,
127850
- dialogueGroups: document.dialogueGroups,
127851
- members: document.members,
127852
- classes: document.classes,
127853
- enums: document.enums,
127854
- interfaces: document.interfaces,
127855
- constructors: document.constructors ?? [],
127856
- member: site.member,
127857
- valueRow: { ...site.row },
127858
- valueId: site.row.id,
127859
- initializerOwnerClass: site.ownerClass,
127860
- lexicalThisClass: site.lexicalThisClass,
127861
- storedConstructionReplay: true,
127862
- ...compilationProject === void 0 ? {} : { compilationProject }
127863
- });
127864
- }
127865
- function compileMemberInitializerDependency(document, memberId, compilationProject) {
127866
- const compileArgs = {
127867
- project: document.project,
127868
- projectFiles: document.projectFiles,
127869
- dialogueGroups: document.dialogueGroups,
127870
- members: document.members,
127871
- classes: document.classes,
127872
- enums: document.enums,
127873
- interfaces: document.interfaces,
127874
- constructors: document.constructors ?? []
127875
- };
127876
- const memberIndex = documentMemberCompilationIndex(document);
127877
- const member = memberIndex.membersById.get(memberId);
127878
- if (member === void 0) {
127879
- throw new Error(
127880
- `Cannot compile initializer dependency for missing member "${memberId}".`
127881
- );
127882
- }
127883
- const thisClass = memberIndex.ownerClassesByMemberId.get(memberId) ?? null;
127884
- compileMemberInitializerBody({
127885
- ...compileArgs,
127886
- member,
127887
- thisClass,
127888
- ...compilationProject === void 0 ? {} : { compilationProject }
127889
- });
127890
- }
127891
- var documentInitializerCompilerStates, documentMemberCompilationIndexes, documentValueInitializerCompilationSites;
127892
- var init_document_initializer_compiler = __esm({
127893
- "../src/database/document-initializer-compiler.ts"() {
127894
- "use strict";
127895
- init_members();
127896
- init_compile_ns_property();
127897
- init_compiler_adapter();
127898
- init_value_row_owner_members();
127899
- documentInitializerCompilerStates = /* @__PURE__ */ new WeakMap();
127900
- documentMemberCompilationIndexes = /* @__PURE__ */ new WeakMap();
127901
- documentValueInitializerCompilationSites = /* @__PURE__ */ new WeakMap();
127902
- }
127903
- });
127904
-
127905
- // ../packages/neoscript-runtime/src/materialize-values.ts
127906
- function materializeInitializerValue2(args) {
127907
- return materializeInitializerValue({
127908
- ...args,
127909
- evaluateInitializer: evaluateMemberInitializer
127910
- });
127911
- }
127912
- var init_materialize_values = __esm({
127913
- "../packages/neoscript-runtime/src/materialize-values.ts"() {
127914
- "use strict";
127915
- init_evaluateInitializer();
127916
- init_initializer_materialization();
127917
- }
127918
- });
127919
-
127920
- // ../packages/models/src/localization/localized-text-create-envelope.ts
127921
- function completeLocalizedTextCreateEnvelope(data, config) {
127922
- const text = asUnknownRecord(data);
127923
- if (text === null) return data;
127924
- const localeValues = asUnknownRecord(text.localeValues);
127925
- const mainLocaleValue = localeValues === null ? null : asUnknownRecord(localeValues[config.mainLocale]);
127926
- const completedMainLocaleValue = mainLocaleValue === null ? null : {
127927
- ...mainLocaleValue,
127928
- ...mainLocaleValue.statusId === void 0 ? { statusId: config.mainLocaleDefaultStatusId } : {},
127929
- ...mainLocaleValue.updatedAt === void 0 && text.updatedAt !== void 0 ? { updatedAt: text.updatedAt } : {}
127930
- };
127931
- return {
127932
- ...text,
127933
- ...text.links === void 0 ? { links: [] } : {},
127934
- ...localeValues === null || completedMainLocaleValue === null ? {} : {
127935
- localeValues: {
127936
- ...localeValues,
127937
- [config.mainLocale]: completedMainLocaleValue
127938
- }
127939
- }
127940
- };
127941
- }
127942
- function buildLocalizedTextCreateForLink(args) {
127943
- const completed = completeLocalizedTextCreateEnvelope(
127944
- {
127945
- id: args.id,
127946
- projectId: args.projectId,
127947
- ...args.memberSource === void 0 ? {} : { memberSource: args.memberSource },
127948
- sourceComment: null,
127949
- links: args.memberSource === void 0 ? [args.link] : [],
127950
- localeValues: {
127951
- [args.config.mainLocale]: {
127952
- value: args.value,
127953
- localeComment: null
127954
- }
127955
- },
127956
- createdAt: args.now,
127957
- updatedAt: args.now
127958
- },
127959
- args.config
127960
- );
127961
- if (!isLocalizedText(completed)) {
127962
- throw new Error(
127963
- `Localized text "${args.id}" could not be completed into a valid create envelope.`
127964
- );
127965
- }
127966
- return completed;
127967
- }
127968
- function asUnknownRecord(value) {
127969
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
127970
- return null;
127971
- }
127972
- return value;
127973
- }
127974
- var init_localized_text_create_envelope = __esm({
127975
- "../packages/models/src/localization/localized-text-create-envelope.ts"() {
127976
- "use strict";
127977
- init_localization_types();
127978
- }
127979
- });
127980
-
127981
127872
  // ../src/database/project-record-live-references.ts
127982
127873
  function projectRecordLiveReferenceIds(kind, data, targetIds) {
127983
127874
  const ids = /* @__PURE__ */ new Set();
@@ -148488,7 +148379,7 @@ function materializeDeclarationInitializersForAnimationValidation(document, scop
148488
148379
  (member) => isClassTypedMember(member) && animationFamilyClassIds.has(member.classId) && isInitValueContent(member.defaultValue) ? [member.id] : []
148489
148380
  )
148490
148381
  );
148491
- if (initializers.length === 0 && defaultInitializerMemberIds.size === 0) {
148382
+ if (initializers.length === 0 && !document.members.some((member) => isInitValueContent(member.defaultValue))) {
148492
148383
  return document;
148493
148384
  }
148494
148385
  const initializerRootOwners = /* @__PURE__ */ new Map();
@@ -148582,19 +148473,19 @@ function materializeDeclarationInitializersForAnimationValidation(document, scop
148582
148473
  document.members.map((entry) => [entry.id, entry])
148583
148474
  );
148584
148475
  const classNeedsExpansion = /* @__PURE__ */ new Map();
148585
- const memberHasParameterizedDefault = /* @__PURE__ */ new Map();
148586
- const reachesParameterizedDefault = (memberId) => {
148476
+ const memberHasInitializer = /* @__PURE__ */ new Map();
148477
+ const reachesInitializer = (memberId) => {
148587
148478
  const path = [];
148588
148479
  const visited = /* @__PURE__ */ new Set();
148589
148480
  let currentId = memberId;
148590
148481
  let result = false;
148591
148482
  while (currentId !== void 0 && !visited.has(currentId)) {
148592
- const cached = memberHasParameterizedDefault.get(currentId);
148483
+ const cached = memberHasInitializer.get(currentId);
148593
148484
  if (cached !== void 0) {
148594
148485
  result = cached;
148595
148486
  break;
148596
148487
  }
148597
- if (parameterizedDeclarationMemberIds.has(currentId)) {
148488
+ if (parameterizedDeclarationMemberIds.has(currentId) || isInitValueContent(membersById.get(currentId)?.defaultValue)) {
148598
148489
  result = true;
148599
148490
  break;
148600
148491
  }
@@ -148602,30 +148493,54 @@ function materializeDeclarationInitializersForAnimationValidation(document, scop
148602
148493
  path.push(currentId);
148603
148494
  currentId = membersById.get(currentId)?.extendsMemberId;
148604
148495
  }
148605
- for (const id2 of path) memberHasParameterizedDefault.set(id2, result);
148496
+ for (const id2 of path) memberHasInitializer.set(id2, result);
148606
148497
  return result;
148607
148498
  };
148608
- const inheritsParameterizedDefault = (classId) => {
148499
+ const inheritsInitializer = (classId) => {
148609
148500
  const cached = classNeedsExpansion.get(classId);
148610
148501
  if (cached !== void 0) return cached;
148611
148502
  const schemaClass2 = classesById.get(classId);
148612
148503
  if (schemaClass2 === void 0) return false;
148613
148504
  classNeedsExpansion.set(classId, false);
148614
148505
  for (const memberId of Object.values(schemaClass2.schema)) {
148615
- if (reachesParameterizedDefault(memberId)) {
148506
+ if (reachesInitializer(memberId)) {
148616
148507
  classNeedsExpansion.set(classId, true);
148617
148508
  return true;
148618
148509
  }
148619
148510
  }
148620
- const result = typeof schemaClass2.extendsClassId === "string" && inheritsParameterizedDefault(schemaClass2.extendsClassId);
148511
+ const result = typeof schemaClass2.extendsClassId === "string" && inheritsInitializer(schemaClass2.extendsClassId);
148621
148512
  classNeedsExpansion.set(classId, result);
148622
148513
  return result;
148623
148514
  };
148624
- const animationRoots = parameterizedDeclarationMemberIds.size === 0 ? [] : [...valuesById.values()].filter(
148625
- (row) => isLiteralValueContent(row) && isVirtualInstanceRootShape(row) && typeof row.classId === "string" && animationFamilyClassIds.has(row.classId) && inheritsParameterizedDefault(row.classId)
148515
+ const defaultRoots = /* @__PURE__ */ new Map();
148516
+ members2 = members2.map((member) => {
148517
+ if (scopeMemberIds !== void 0 && !scopeMemberIds.has(member.id))
148518
+ return member;
148519
+ if (!isClassTypedMember(member) || !animationFamilyClassIds.has(member.classId) || !inheritsInitializer(member.classId) || !isLiteralValueContent(member.defaultValue))
148520
+ return member;
148521
+ const content = member.defaultValue;
148522
+ if (content.value === null || typeof content.value !== "object" || Array.isArray(content.value))
148523
+ return member;
148524
+ const root = {
148525
+ ...content,
148526
+ id: `animation-validation-default:${member.id}`,
148527
+ classId: content.classId ?? member.classId,
148528
+ projectId: document.project.id,
148529
+ createdAt: 0,
148530
+ updatedAt: 0
148531
+ };
148532
+ defaultRoots.set(root.id, member);
148533
+ valuesById.set(root.id, root);
148534
+ materializationBatch.upsert([root]);
148535
+ const projected = { ...member, valueId: root.id };
148536
+ delete projected.defaultValue;
148537
+ return projected;
148538
+ });
148539
+ const animationRoots = [...valuesById.values()].filter(
148540
+ (row) => isLiteralValueContent(row) && typeof row.classId === "string" && animationFamilyClassIds.has(row.classId) && inheritsInitializer(row.classId)
148626
148541
  );
148627
148542
  const rootsToExpand = animationRootsInValidationScope({
148628
- document,
148543
+ document: { ...document, members: members2, values: [...valuesById.values()] },
148629
148544
  valuesById,
148630
148545
  animationFamilyClassIds,
148631
148546
  animationRoots,
@@ -148635,10 +148550,30 @@ function materializeDeclarationInitializersForAnimationValidation(document, scop
148635
148550
  const lookups = initializerEvaluatorLookups(
148636
148551
  materializationBatch.document()
148637
148552
  );
148553
+ const unstamped = rootsToExpand.filter(
148554
+ (root) => !isLiteralValueContent(root) || !isVirtualInstanceRootShape(root)
148555
+ );
148556
+ const placements = unstamped.length === 0 ? /* @__PURE__ */ new Map() : resolveSemanticOwnerMembersForValues(
148557
+ document,
148558
+ new Set(unstamped.map((row) => row.id))
148559
+ );
148560
+ const reader = unstamped.length === 0 ? void 0 : new EffectiveValueReader({
148561
+ ...document,
148562
+ values: [...valuesById.values()]
148563
+ });
148638
148564
  for (const root of rootsToExpand) {
148639
- for (const row of lookups.virtualInstanceRowsForValue(root.id)) {
148640
- expandedRows.set(row.id, row);
148565
+ if (isLiteralValueContent(root) && isVirtualInstanceRootShape(root)) {
148566
+ for (const row of lookups.virtualInstanceRowsForValue(root.id))
148567
+ expandedRows.set(row.id, row);
148568
+ continue;
148641
148569
  }
148570
+ const placement = defaultRoots.get(root.id) ?? placements.get(root.id);
148571
+ if (placement === void 0 || reader === void 0) continue;
148572
+ reader.resolveGraph(root.id, placement);
148573
+ }
148574
+ if (reader !== void 0) {
148575
+ for (const row of reader.rowsWithClassDefaults().values())
148576
+ expandedRows.set(row.id, row);
148642
148577
  }
148643
148578
  }
148644
148579
  if (deferred.size > 0) {
@@ -149693,6 +149628,7 @@ var KNOWN_TRANSACTION_OPERATIONS, assertPreparedInheritanceFlagsValid, assertPre
149693
149628
  var init_project_version_whole_graph_validation = __esm({
149694
149629
  "../src/database/project-version-whole-graph-validation.ts"() {
149695
149630
  "use strict";
149631
+ init_effective_value_reader();
149696
149632
  init_commit_preparation_pass_cache();
149697
149633
  init_member_kinds();
149698
149634
  init_project_schema_index();
@@ -151576,17 +151512,19 @@ function readPulledProjectDocumentUncachedV4(records3) {
151576
151512
  });
151577
151513
  return {
151578
151514
  ...document,
151579
- members: document.members.map(
151580
- (member) => isFrozenJsonData(member) && !hasUncompiledInitializer(Reflect.get(member, "defaultValue")) ? member : isolateMemberBodies(member)
151581
- ),
151515
+ members: document.members.map(isolateReplayMember),
151582
151516
  constructors: document.constructors?.map(
151583
151517
  (constructor2) => isFrozenJsonData(constructor2) && isNeoClassConstructor(constructor2) ? constructor2 : { ...constructor2 }
151584
151518
  ),
151585
- values: document.values.map(
151586
- (value) => isFrozenJsonData(value) && !hasUncompiledInitializer(value) ? value : isolateInitializerEnvelope(value)
151587
- )
151519
+ values: document.values.map(isolateReplayValue)
151588
151520
  };
151589
151521
  }
151522
+ function isolateReplayMember(member) {
151523
+ return isFrozenJsonData(member) && !hasUncompiledInitializer(Reflect.get(member, "defaultValue")) ? member : isolateMemberBodies(member);
151524
+ }
151525
+ function isolateReplayValue(value) {
151526
+ return isFrozenJsonData(value) && !hasUncompiledInitializer(value) ? value : isolateInitializerEnvelope(value);
151527
+ }
151590
151528
  function hasUncompiledInitializer(envelope) {
151591
151529
  if (!isObjectRecord(envelope)) return false;
151592
151530
  const init = envelope.init;
@@ -151746,6 +151684,162 @@ var init_initializer_replay = __esm({
151746
151684
  }
151747
151685
  });
151748
151686
 
151687
+ // src/project-source/record-fields.ts
151688
+ function nonVolatileFields(base) {
151689
+ const known = authoredFields.get(base);
151690
+ if (known !== void 0) return known;
151691
+ const fields = { ...base };
151692
+ delete fields.projectId;
151693
+ delete fields.createdAt;
151694
+ delete fields.updatedAt;
151695
+ if (isFrozenJsonData(base)) {
151696
+ freezeJsonData(fields);
151697
+ authoredFields.set(base, fields);
151698
+ storedRows.set(fields, base);
151699
+ }
151700
+ return fields;
151701
+ }
151702
+ function reuseAuthoredRecordFields(fields, base) {
151703
+ if (!isObjectRecord(base) || !isFrozenJsonData(base)) return fields;
151704
+ const stored = nonVolatileFields(base);
151705
+ if (fields === stored) return stored;
151706
+ const keys = Object.keys(fields);
151707
+ if (keys.length !== Object.keys(stored).length) return fields;
151708
+ for (const key of keys) {
151709
+ if (!Object.hasOwn(stored, key)) return fields;
151710
+ if (!Object.is(fields[key], stored[key])) return fields;
151711
+ }
151712
+ return stored;
151713
+ }
151714
+ function mergeMigrationServerFields(fileFields, baseData3) {
151715
+ const original = storedRows.get(fileFields);
151716
+ if (original !== void 0 && original === baseData3) return original;
151717
+ const fullData = { ...fileFields };
151718
+ if (!isObjectRecord(baseData3)) return fullData;
151719
+ for (const field of MIGRATION_VOLATILE_FIELDS) {
151720
+ if (baseData3[field] !== void 0) fullData[field] = baseData3[field];
151721
+ }
151722
+ return fullData;
151723
+ }
151724
+ function overlayAuthoredRecordFields(fileFields, base) {
151725
+ return storedRows.get(fileFields) === base ? base : { ...base, ...fileFields };
151726
+ }
151727
+ var authoredFields, storedRows;
151728
+ var init_record_fields = __esm({
151729
+ "src/project-source/record-fields.ts"() {
151730
+ "use strict";
151731
+ init_value_comparison();
151732
+ init_immutable_json3();
151733
+ init_migration_files();
151734
+ authoredFields = /* @__PURE__ */ new WeakMap();
151735
+ storedRows = /* @__PURE__ */ new WeakMap();
151736
+ }
151737
+ });
151738
+
151739
+ // src/project-source/schema-products.ts
151740
+ function reuseSchemaProducts(base, manifest) {
151741
+ if (!isFrozenJsonData(base)) return manifest;
151742
+ const previous = previousManifests.get(base) ?? base;
151743
+ function collection(entries, oldEntries) {
151744
+ const byId = new Map(oldEntries.map((entry) => [entry.id, entry]));
151745
+ const products = entries.map((entry) => {
151746
+ const old = byId.get(entry.id);
151747
+ return old !== void 0 && jsonDataEqual(entry, old) ? old : freezeJsonData(entry);
151748
+ });
151749
+ return products.length === oldEntries.length && products.every((entry, index) => entry === oldEntries[index]) ? oldEntries : products;
151750
+ }
151751
+ const result = freezeJsonData({
151752
+ ...manifest,
151753
+ classes: collection(manifest.classes, previous.classes),
151754
+ constructors: collection(manifest.constructors, previous.constructors),
151755
+ members: collection(manifest.members, previous.members),
151756
+ interfaces: collection(manifest.interfaces, previous.interfaces),
151757
+ enums: collection(manifest.enums, previous.enums),
151758
+ variants: collection(manifest.variants, previous.variants),
151759
+ variantFolders: collection(
151760
+ manifest.variantFolders,
151761
+ previous.variantFolders
151762
+ ),
151763
+ textureTemplates: collection(
151764
+ manifest.textureTemplates,
151765
+ previous.textureTemplates
151766
+ ),
151767
+ audioTemplates: collection(
151768
+ manifest.audioTemplates,
151769
+ previous.audioTemplates
151770
+ ),
151771
+ localizationStatuses: collection(
151772
+ manifest.localizationStatuses,
151773
+ previous.localizationStatuses
151774
+ ),
151775
+ internalRecordRelations: collection(
151776
+ manifest.internalRecordRelations,
151777
+ previous.internalRecordRelations
151778
+ ),
151779
+ localization: jsonDataEqual(manifest.localization, previous.localization) ? previous.localization : manifest.localization
151780
+ });
151781
+ const product = jsonDataEqual(previous, result) ? previous : result;
151782
+ previousManifests.set(base, product);
151783
+ return product;
151784
+ }
151785
+ function createSchemaDocumentMemo() {
151786
+ const products = /* @__PURE__ */ new WeakMap();
151787
+ return (base, documents, discriminator, compute) => {
151788
+ if (!isFrozenJsonData(base) || !documents.every(isFrozenJsonData))
151789
+ return compute();
151790
+ const previous = products.get(base);
151791
+ if (previous?.discriminator === discriminator && previous.documents.length === documents.length && documents.every(
151792
+ (document, index) => document === previous.documents[index]
151793
+ ))
151794
+ return previous.result;
151795
+ const result = compute();
151796
+ products.set(base, { documents: [...documents], discriminator, result });
151797
+ return result;
151798
+ };
151799
+ }
151800
+ function reusePatchedSchemaDocument(document, data) {
151801
+ if (!isFrozenJsonData(document)) return { ...document, data };
151802
+ if (jsonDataEqual(document.data, data)) return document;
151803
+ const previous = patchedDocuments.get(document);
151804
+ if (previous !== void 0 && jsonDataEqual(previous.data, data))
151805
+ return previous;
151806
+ const result = freezeJsonData({ ...document, data });
151807
+ patchedDocuments.set(document, result);
151808
+ return result;
151809
+ }
151810
+ var previousManifests, patchedDocuments;
151811
+ var init_schema_products = __esm({
151812
+ "src/project-source/schema-products.ts"() {
151813
+ "use strict";
151814
+ init_immutable_json3();
151815
+ previousManifests = /* @__PURE__ */ new WeakMap();
151816
+ patchedDocuments = /* @__PURE__ */ new WeakMap();
151817
+ }
151818
+ });
151819
+
151820
+ // src/project-source/source-base-cache.ts
151821
+ function sourceBaseV4(records3, compute) {
151822
+ const cached = bases.get(records3);
151823
+ if (cached !== void 0) return cached;
151824
+ const result = compute();
151825
+ if (isFrozenJsonData(records3)) {
151826
+ freezeJsonData(result.lowering.records);
151827
+ freezeJsonData(result.documents);
151828
+ freezeJsonData(result.manifest);
151829
+ freezeJsonData(result.recoveries);
151830
+ bases.set(records3, result);
151831
+ }
151832
+ return result;
151833
+ }
151834
+ var bases;
151835
+ var init_source_base_cache = __esm({
151836
+ "src/project-source/source-base-cache.ts"() {
151837
+ "use strict";
151838
+ init_immutable_json3();
151839
+ bases = /* @__PURE__ */ new WeakMap();
151840
+ }
151841
+ });
151842
+
151749
151843
  // src/project-source/listener-emission.ts
151750
151844
  function emitListenerPositions(args) {
151751
151845
  const root = args.rows.get(args.rootId);
@@ -160949,7 +161043,37 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
160949
161043
  ids.add(replayId);
160950
161044
  argumentIdsByStoredId.set(storedId, ids);
160951
161045
  }
160952
- return replay = { graph, body, argumentIdsByStoredId };
161046
+ let cachedReferenceTargets;
161047
+ const referenceTargets = (targetId) => {
161048
+ if (!replayRows?.has(targetId)) return targetId;
161049
+ if (cachedReferenceTargets !== void 0)
161050
+ return cachedReferenceTargets.get(targetId) ?? targetId;
161051
+ const targets = /* @__PURE__ */ new Map();
161052
+ if (graph !== null && typeof value.id === "string") {
161053
+ const placement = concreteClassMemberForReplay(
161054
+ context,
161055
+ member,
161056
+ environment
161057
+ );
161058
+ if (!isAnyMemberBase(placement))
161059
+ throw new Error(
161060
+ "Construction replay has an invalid member placement."
161061
+ );
161062
+ const currentPaths = constructionValuePaths(
161063
+ context.readEffectiveValues(),
161064
+ value.id,
161065
+ placement
161066
+ );
161067
+ const replayPaths = constructionValuePaths(graph, value.id, placement);
161068
+ for (const [path, replayId] of replayPaths) {
161069
+ const currentId = currentPaths.get(path);
161070
+ if (currentId !== void 0) targets.set(replayId, currentId);
161071
+ }
161072
+ }
161073
+ cachedReferenceTargets = targets;
161074
+ return targets.get(targetId) ?? targetId;
161075
+ };
161076
+ return replay = { graph, body, argumentIdsByStoredId, referenceTargets };
160953
161077
  };
160954
161078
  const order = Array.isArray(schemaClass2.schemaKeyOrder) ? schemaClass2.schemaKeyOrder.filter(
160955
161079
  (entry) => typeof entry === "string" && typeof schema[entry] === "string"
@@ -160999,7 +161123,8 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
160999
161123
  childId,
161000
161124
  replayChildId2,
161001
161125
  childMember,
161002
- environment
161126
+ environment,
161127
+ replay3.referenceTargets
161003
161128
  );
161004
161129
  if (!replaysBodyKey) {
161005
161130
  const type2 = schemaTypeForBindingMember(
@@ -161032,7 +161157,8 @@ function classValueBody(context, member, value, visited, targetTyped, outerEnvir
161032
161157
  childId,
161033
161158
  replayChildId,
161034
161159
  childMember,
161035
- environment
161160
+ environment,
161161
+ replay2.referenceTargets
161036
161162
  )) {
161037
161163
  continue;
161038
161164
  }
@@ -161292,7 +161418,34 @@ function storedLookupIdentityIds(values, reader) {
161292
161418
  }
161293
161419
  return identities;
161294
161420
  }
161295
- function materializedValueSubgraphsEqual(context, currentGraph, replayGraph, currentId, replayId, member, environment) {
161421
+ function constructionValuePaths(reader, rootId, member) {
161422
+ const rows = reader.resolveGraph(rootId, member);
161423
+ const paths = /* @__PURE__ */ new Map([[rootId, "$"]]);
161424
+ const visiting = /* @__PURE__ */ new Set();
161425
+ const pathFor = (id2) => {
161426
+ const cached = paths.get(id2);
161427
+ if (cached !== void 0) return cached;
161428
+ if (visiting.has(id2)) return null;
161429
+ const location3 = reader.location(id2);
161430
+ if (location3?.parentId == null || location3.parentSegment === null) {
161431
+ paths.set(id2, null);
161432
+ return null;
161433
+ }
161434
+ visiting.add(id2);
161435
+ const parent = pathFor(location3.parentId);
161436
+ visiting.delete(id2);
161437
+ const path = parent === null ? null : `${parent}/${JSON.stringify(location3.parentSegment)}`;
161438
+ paths.set(id2, path);
161439
+ return path;
161440
+ };
161441
+ const result = /* @__PURE__ */ new Map();
161442
+ for (const id2 of rows.keys()) {
161443
+ const path = pathFor(id2);
161444
+ if (path !== null) result.set(path, id2);
161445
+ }
161446
+ return result;
161447
+ }
161448
+ function materializedValueSubgraphsEqual(context, currentGraph, replayGraph, currentId, replayId, member, environment, referenceTargets) {
161296
161449
  const resolvedMember = resolveGenericValueMember(
161297
161450
  context,
161298
161451
  member,
@@ -161315,21 +161468,22 @@ function materializedValueSubgraphsEqual(context, currentGraph, replayGraph, cur
161315
161468
  `Stored member ${String(member.name ?? member.id)} has no declared type for materialized settle comparison.`
161316
161469
  );
161317
161470
  }
161318
- return context.compareEffectiveValues(
161319
- currentGraph.normalizeTypedRow(
161320
- currentId,
161321
- typeInfo,
161322
- resolvedMember,
161323
- genericEnv,
161324
- context.readStoredLookupIdentityIds()
161325
- ),
161326
- replayGraph.normalizeTypedRow(
161327
- replayId,
161328
- typeInfo,
161329
- resolvedMember,
161330
- genericEnv
161331
- )
161332
- ) === 0;
161471
+ const current = currentGraph.normalizeTypedRow(
161472
+ currentId,
161473
+ typeInfo,
161474
+ resolvedMember,
161475
+ genericEnv,
161476
+ context.readStoredLookupIdentityIds()
161477
+ );
161478
+ const replay = replayGraph.normalizeTypedRow(
161479
+ replayId,
161480
+ typeInfo,
161481
+ resolvedMember,
161482
+ genericEnv,
161483
+ void 0,
161484
+ referenceTargets
161485
+ );
161486
+ return context.compareEffectiveValues(current, replay) === 0;
161333
161487
  }
161334
161488
  function firstRequiredConstructorParameterKey(context, classId, environment) {
161335
161489
  const seen = /* @__PURE__ */ new Set();
@@ -172779,7 +172933,8 @@ function replayAnimationDeclarationInitializersV4(records3, document, fallbackVa
172779
172933
  const init = Reflect.get(row, "init");
172780
172934
  return isObjectRecord(init) && typeof init.code === "string" ? [{ row, code: init.code }] : [];
172781
172935
  });
172782
- if (initializers.length === 0) return document;
172936
+ if (initializers.length === 0 && !document.members.some((member) => isInitValueContent(member.defaultValue)))
172937
+ return document;
172783
172938
  const rootKinds = /* @__PURE__ */ new Map();
172784
172939
  const rootOwners = /* @__PURE__ */ new Map();
172785
172940
  const valuesById = new Map(
@@ -172825,7 +172980,12 @@ function replayAnimationDeclarationInitializersV4(records3, document, fallbackVa
172825
172980
  constructor2
172826
172981
  ])
172827
172982
  );
172828
- let documentBodiesCompiled = false;
172983
+ compilePulledProjectDocumentForEvaluationV4(
172984
+ replayDocument,
172985
+ compilationProject,
172986
+ recompileTargets?.(replayDocument)
172987
+ );
172988
+ assertPulledConstructorsCompiled(replayDocument);
172829
172989
  const values = new Map([
172830
172990
  ...fallbackValues,
172831
172991
  ...document.values.map((row) => [row.id, row])
@@ -172860,14 +173020,6 @@ function replayAnimationDeclarationInitializersV4(records3, document, fallbackVa
172860
173020
  );
172861
173021
  let replay;
172862
173022
  try {
172863
- if (!documentBodiesCompiled) {
172864
- compilePulledProjectDocumentForEvaluationV4(
172865
- replayDocument,
172866
- compilationProject,
172867
- recompileTargets?.(replayDocument)
172868
- );
172869
- documentBodiesCompiled = true;
172870
- }
172871
173023
  replay = replayStoredConstructionV4({
172872
173024
  records: pulled,
172873
173025
  document: replayDocument,
@@ -172906,7 +173058,13 @@ function replayAnimationDeclarationInitializersV4(records3, document, fallbackVa
172906
173058
  values.set(id2, value);
172907
173059
  }
172908
173060
  }
172909
- return { ...document, values: [...values.values()] };
173061
+ return {
173062
+ ...document,
173063
+ ...materializeDeclarationInitializersForAnimationValidation({
173064
+ ...replayDocument,
173065
+ values: [...values.values()]
173066
+ })
173067
+ };
172910
173068
  }
172911
173069
  function animationValidationInputsChanged(changes, seeds) {
172912
173070
  for (const seed of seeds.values()) {
@@ -172957,6 +173115,12 @@ function prospectiveAnimationDocumentV4(records3) {
172957
173115
  );
172958
173116
  let project;
172959
173117
  const constructors = [];
173118
+ const enums = [];
173119
+ const interfaceRecords = [];
173120
+ const projectFiles = [];
173121
+ const textureTemplates = [];
173122
+ const variants = [];
173123
+ const variantFolders = [];
172960
173124
  const classes = [];
172961
173125
  const interfaces = [];
172962
173126
  const memberData = [];
@@ -172985,6 +173149,17 @@ function prospectiveAnimationDocumentV4(records3) {
172985
173149
  );
172986
173150
  }
172987
173151
  interfaces.push(record7.data);
173152
+ interfaceRecords.push(record7.data);
173153
+ } else if (record7.recordKind === ProjectRecordKind.Enum) {
173154
+ enums.push(record7.data);
173155
+ } else if (record7.recordKind === ProjectRecordKind.ProjectFile) {
173156
+ projectFiles.push(record7.data);
173157
+ } else if (record7.recordKind === ProjectRecordKind.UnityTextureTemplate) {
173158
+ textureTemplates.push(record7.data);
173159
+ } else if (record7.recordKind === ProjectRecordKind.Variant) {
173160
+ variants.push(record7.data);
173161
+ } else if (record7.recordKind === ProjectRecordKind.VariantFolder) {
173162
+ variantFolders.push(record7.data);
172988
173163
  } else if (record7.recordKind === "member") {
172989
173164
  memberData.push(record7.data);
172990
173165
  } else if (record7.recordKind === "value") {
@@ -173050,6 +173225,14 @@ function prospectiveAnimationDocumentV4(records3) {
173050
173225
  interfaces,
173051
173226
  members: members2,
173052
173227
  values: expandProspectiveAnimationInstances({
173228
+ runtimeContext: {
173229
+ enums,
173230
+ interfaces: interfaceRecords,
173231
+ projectFiles,
173232
+ textureTemplates,
173233
+ variants,
173234
+ variantFolders
173235
+ },
173053
173236
  project,
173054
173237
  classes,
173055
173238
  classesById,
@@ -173067,6 +173250,11 @@ function withValidationClassId(value, classId) {
173067
173250
  validationRowsBySource.set(value, row);
173068
173251
  return row;
173069
173252
  }
173253
+ function animationRuntimeRecord(record7) {
173254
+ if (!isObjectRecord(record7))
173255
+ throw new Error("Animation runtime record must be a non-array object.");
173256
+ return record7;
173257
+ }
173070
173258
  function expandProspectiveAnimationInstances(document) {
173071
173259
  const animationRoots = document.values.filter(
173072
173260
  (row) => isLiteralValueContent(row) && isVirtualInstanceRootShape(row) && typeof row.classId === "string" && classBelongsToAnimationFamily(document.classesById, row.classId)
@@ -173074,11 +173262,16 @@ function expandProspectiveAnimationInstances(document) {
173074
173262
  if (animationRoots.length === 0) return [...document.values];
173075
173263
  const lookups = cliEvaluatorLookups(
173076
173264
  {
173077
- project: document.project,
173078
- classes: document.classes,
173265
+ ...document.runtimeContext,
173266
+ project: animationRuntimeRecord(document.project),
173267
+ classes: document.classes.map(animationRuntimeRecord),
173079
173268
  constructors: document.constructors,
173080
- members: document.members,
173081
- values: document.values
173269
+ members: document.members.map(
173270
+ (member) => animationRuntimeRecord(isolateReplayMember(member))
173271
+ ),
173272
+ values: document.values.map(
173273
+ (value) => animationRuntimeRecord(isolateReplayValue(value))
173274
+ )
173082
173275
  },
173083
173276
  { includeValueGraphIndexes: true }
173084
173277
  );
@@ -173933,6 +174126,8 @@ var sourceSchemaValidation, pulledAnimationValues, animationCompilationProject,
173933
174126
  var init_workspace_status_core = __esm({
173934
174127
  "src/project-source/workspace-status-core.ts"() {
173935
174128
  "use strict";
174129
+ init_initializer_replay();
174130
+ init_project_version_whole_graph_validation();
173936
174131
  init_record_fields();
173937
174132
  init_schema_products();
173938
174133
  init_source_base_cache();
@@ -174014,7 +174209,8 @@ var init_workspace_status_core = __esm({
174014
174209
  ProjectRecordKind.Class,
174015
174210
  ProjectRecordKind.Constructor,
174016
174211
  ProjectRecordKind.Member,
174017
- ProjectRecordKind.Value
174212
+ ProjectRecordKind.Value,
174213
+ ProjectRecordKind.UnityTextureTemplate
174018
174214
  ];
174019
174215
  ANIMATION_REPLAY_RECORD_KINDS = [
174020
174216
  ProjectRecordKind.Enum,
@@ -211668,7 +211864,11 @@ async function prepareLocalCandidateV4(workspace, options = {}) {
211668
211864
  );
211669
211865
  return {
211670
211866
  status,
211671
- document,
211867
+ document: {
211868
+ ...document,
211869
+ members: document.members.map(isolateReplayMember),
211870
+ values: document.values.map(isolateReplayValue)
211871
+ },
211672
211872
  sourceHash,
211673
211873
  preparedLocal
211674
211874
  };
@@ -228788,7 +228988,7 @@ var releaseWorkspaceLock = () => void 0;
228788
228988
  async function main() {
228789
228989
  const args = parseArgs(process.argv.slice(2));
228790
228990
  if (args.command === "--version") {
228791
- console.log("0.87.0");
228991
+ console.log("0.87.2");
228792
228992
  return;
228793
228993
  }
228794
228994
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {