@neocompose/cli 0.58.0 → 0.58.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.
package/dist/neo.mjs CHANGED
@@ -3672,7 +3672,8 @@ var init_executable_parser = __esm({
3672
3672
  return {
3673
3673
  kind: "annotated",
3674
3674
  annotations,
3675
- expression: this.parsePostfix(),
3675
+ // Unary, so `@id("…") -3` annotates the negative entry.
3676
+ expression: this.parseUnary(),
3676
3677
  pos: at(t)
3677
3678
  };
3678
3679
  }
@@ -45372,17 +45373,12 @@ function lowerDictionaryKey(expression, keyEnum, path) {
45372
45373
  if (keyEnum === null) {
45373
45374
  throw new Error(`Dictionary ${path} requires string keys.`);
45374
45375
  }
45375
- let optionName;
45376
- if (expression.kind === "contextualEnum") {
45377
- optionName = expression.name;
45378
- } else if (expression.kind === "member" && expression.receiver.kind === "ident") {
45379
- if (expression.receiver.name !== keyEnum.name) {
45380
- throw new Error(
45381
- `Dictionary key at ${path} names enum ${JSON.stringify(expression.receiver.name)}, expected ${JSON.stringify(keyEnum.name)}.`
45382
- );
45383
- }
45384
- optionName = expression.name;
45385
- } else {
45376
+ const optionName = enumOptionSpelling(
45377
+ expression,
45378
+ keyEnum.name,
45379
+ `Dictionary key at ${path}`
45380
+ );
45381
+ if (optionName === null) {
45386
45382
  throw new Error(
45387
45383
  `Dictionary key at ${path} must be .Option, ${keyEnum.name}.Option, or a quoted option ID.`
45388
45384
  );
@@ -45395,6 +45391,17 @@ function lowerDictionaryKey(expression, keyEnum, path) {
45395
45391
  }
45396
45392
  return optionId;
45397
45393
  }
45394
+ function enumOptionSpelling(expression, enumName, subject) {
45395
+ if (expression.kind === "contextualEnum") return expression.name;
45396
+ if (expression.kind !== "member") return null;
45397
+ if (expression.receiver.kind !== "ident") return null;
45398
+ if (expression.receiver.name !== enumName) {
45399
+ throw new Error(
45400
+ `${subject} names enum ${JSON.stringify(expression.receiver.name)}, expected ${JSON.stringify(enumName)}.`
45401
+ );
45402
+ }
45403
+ return expression.name;
45404
+ }
45398
45405
  function emitDictionaryKey(key, options) {
45399
45406
  const name = options?.get(key)?.name;
45400
45407
  return name === void 0 ? quoteNeoString(key) : `.${name}`;
@@ -64310,9 +64317,9 @@ var init_dialogue_sources = __esm({
64310
64317
  if (typeof memberId !== "string") return null;
64311
64318
  const nameMember = this.members.get(memberId);
64312
64319
  if (nameMember?.kind !== 3) return null;
64313
- const childValueId = value.value[memberName];
64314
- if (typeof childValueId !== "string") return null;
64315
- const child = this.values.get(childValueId);
64320
+ const childValueId2 = value.value[memberName];
64321
+ if (typeof childValueId2 !== "string") return null;
64322
+ const child = this.values.get(childValueId2);
64316
64323
  if (typeof child?.value !== "string") return null;
64317
64324
  const localizedText = this.localizedTexts.get(child.value);
64318
64325
  const localeValues = isObjectRecord2(localizedText?.localeValues) ? localizedText.localeValues : null;
@@ -67652,13 +67659,13 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
67652
67659
  const env = overlayStamp(instanceEnv, body.genericBindings);
67653
67660
  for (const entry of merged) {
67654
67661
  if (entry.memberId === null) continue;
67655
- const childValueId = body.value[entry.schemaKey];
67656
- if (childValueId === void 0) continue;
67662
+ const childValueId2 = body.value[entry.schemaKey];
67663
+ if (childValueId2 === void 0) continue;
67657
67664
  const childMember = membersById.get(entry.memberId);
67658
67665
  if (childMember === void 0) continue;
67659
67666
  const substituted = trySubstituteMember(childMember, env);
67660
67667
  if (substituted === null) continue;
67661
- searchRow(substituted, childValueId, rootOwner, env, rootKind);
67668
+ searchRow(substituted, childValueId2, rootOwner, env, rootKind);
67662
67669
  }
67663
67670
  return;
67664
67671
  }
@@ -67669,8 +67676,8 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
67669
67676
  const entryEnv = overlayStamp(ambientEnv, body.genericBindings);
67670
67677
  const entryMember = trySubstituteMember(entryMemberRecord, entryEnv);
67671
67678
  if (entryMember === null) return;
67672
- for (const childValueId of Object.values(body.value)) {
67673
- searchRow(entryMember, childValueId, rootOwner, entryEnv, rootKind);
67679
+ for (const childValueId2 of Object.values(body.value)) {
67680
+ searchRow(entryMember, childValueId2, rootOwner, entryEnv, rootKind);
67674
67681
  }
67675
67682
  return;
67676
67683
  }
@@ -67688,9 +67695,9 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
67688
67695
  return;
67689
67696
  }
67690
67697
  if (!Array.isArray(body.value)) return;
67691
- for (const childValueId of body.value) {
67692
- if (typeof childValueId !== "string") continue;
67693
- searchRow(entryMember, childValueId, rootOwner, entryEnv, rootKind);
67698
+ for (const childValueId2 of body.value) {
67699
+ if (typeof childValueId2 !== "string") continue;
67700
+ searchRow(entryMember, childValueId2, rootOwner, entryEnv, rootKind);
67694
67701
  }
67695
67702
  return;
67696
67703
  }
@@ -67811,14 +67818,14 @@ function findOwningMembersForValues(document, valueIds, additionalRoots, travers
67811
67818
  args.genericBindings
67812
67819
  );
67813
67820
  for (const entry of merged) {
67814
- const childValueId = args.record[entry.schemaKey];
67815
- if (childValueId === void 0) continue;
67821
+ const childValueId2 = args.record[entry.schemaKey];
67822
+ if (childValueId2 === void 0) continue;
67816
67823
  const childMember = membersById.get(entry.memberId);
67817
67824
  if (childMember === void 0) continue;
67818
67825
  queue.push({
67819
67826
  member: substituteMember(childMember, env, document.members),
67820
67827
  memberRecordId: childMember.id,
67821
- id: childValueId,
67828
+ id: childValueId2,
67822
67829
  parentValueId: args.parentValueId,
67823
67830
  env,
67824
67831
  // Descending through `Overrides` opens an override graph, and every
@@ -67978,11 +67985,11 @@ function findOwningMembersForValues(document, valueIds, additionalRoots, travers
67978
67985
  env,
67979
67986
  document.members
67980
67987
  );
67981
- for (const childValueId of Object.values(storedValue.value)) {
67988
+ for (const childValueId2 of Object.values(storedValue.value)) {
67982
67989
  queue.push({
67983
67990
  member: entryMember,
67984
67991
  memberRecordId: entryMemberRecord.id,
67985
- id: childValueId,
67992
+ id: childValueId2,
67986
67993
  // An entry inherits its collection's position: a Dictionary is not
67987
67994
  // itself a way into an override graph.
67988
67995
  insideAnimationOverrideGraph: current.insideAnimationOverrideGraph,
@@ -68002,11 +68009,11 @@ function findOwningMembersForValues(document, valueIds, additionalRoots, travers
68002
68009
  document.members
68003
68010
  );
68004
68011
  const childValueIds = listKindOf(current.member) === 1 /* Unordered */ ? (rowsByContainerId.get(storedValue.id) ?? []).map((row) => row.id) : isStringListValue(storedValue.value) ? storedValue.value : [];
68005
- for (const childValueId of childValueIds) {
68012
+ for (const childValueId2 of childValueIds) {
68006
68013
  queue.push({
68007
68014
  member: entryMember,
68008
68015
  memberRecordId: entryMemberRecord.id,
68009
- id: childValueId,
68016
+ id: childValueId2,
68010
68017
  // An entry inherits its collection's position: a List is not itself
68011
68018
  // a way into an override graph.
68012
68019
  insideAnimationOverrideGraph: current.insideAnimationOverrideGraph,
@@ -81750,16 +81757,16 @@ function createStoredValuePlacementTraversal(args, trackReferences = false) {
81750
81757
  if (settled === null || Object.hasOwn(value.value, settled.schemaKey)) {
81751
81758
  continue;
81752
81759
  }
81753
- const childValueId = value.constructorArgs[constructorActionParameterId(constructor2, index)];
81754
- if (typeof childValueId === "string") {
81755
- settledChildrenBySchemaKey.set(settled.schemaKey, childValueId);
81760
+ const childValueId2 = value.constructorArgs[constructorActionParameterId(constructor2, index)];
81761
+ if (typeof childValueId2 === "string") {
81762
+ settledChildrenBySchemaKey.set(settled.schemaKey, childValueId2);
81756
81763
  }
81757
81764
  }
81758
81765
  }
81759
81766
  for (const entry of storedSchema(classId)) {
81760
81767
  const childMember = membersById.get(entry.memberId);
81761
- const childValueId = value.value[entry.schemaKey] ?? settledChildrenBySchemaKey.get(entry.schemaKey);
81762
- if (childMember === void 0 || typeof childValueId !== "string") {
81768
+ const childValueId2 = value.value[entry.schemaKey] ?? settledChildrenBySchemaKey.get(entry.schemaKey);
81769
+ if (childMember === void 0 || typeof childValueId2 !== "string") {
81763
81770
  continue;
81764
81771
  }
81765
81772
  if (memberAccessOf(childMember) !== 0 /* Public */) continue;
@@ -81767,7 +81774,7 @@ function createStoredValuePlacementTraversal(args, trackReferences = false) {
81767
81774
  memberId: childMember.id,
81768
81775
  parentValueId: value.id,
81769
81776
  source: { kind: "classField", schemaKey: entry.schemaKey },
81770
- valueId: childValueId
81777
+ valueId: childValueId2
81771
81778
  });
81772
81779
  }
81773
81780
  continue;
@@ -81779,16 +81786,16 @@ function createStoredValuePlacementTraversal(args, trackReferences = false) {
81779
81786
  if (entryMember === void 0) continue;
81780
81787
  if (isMemberDictionaryBase(member)) {
81781
81788
  if (!isStringRecord4(value.value)) continue;
81782
- for (const [key, childValueId] of Object.entries(value.value)) {
81789
+ for (const [key, childValueId2] of Object.entries(value.value)) {
81783
81790
  queue.push({
81784
81791
  memberId: entryMember.id,
81785
81792
  parentValueId: value.id,
81786
81793
  source: {
81787
81794
  kind: "collectionEntry",
81788
81795
  containerMemberId: storedMember.id,
81789
- entry: { kind: "dict", key, valueId: childValueId }
81796
+ entry: { kind: "dict", key, valueId: childValueId2 }
81790
81797
  },
81791
- valueId: childValueId
81798
+ valueId: childValueId2
81792
81799
  });
81793
81800
  }
81794
81801
  continue;
@@ -81796,9 +81803,9 @@ function createStoredValuePlacementTraversal(args, trackReferences = false) {
81796
81803
  const entries = listKindOf(member) === 1 /* Unordered */ ? args.indexedRows === void 0 ? unorderedEntriesByContainerId.get(value.id) ?? [] : args.indexedRows.unorderedListEntryIds(value.id).flatMap((id2) => {
81797
81804
  const row = valuesById.get(id2);
81798
81805
  return row === void 0 ? [] : [row];
81799
- }) : Array.isArray(value.value) ? value.value.flatMap((childValueId) => {
81800
- if (typeof childValueId !== "string") return [];
81801
- const childValue = valuesById.get(childValueId);
81806
+ }) : Array.isArray(value.value) ? value.value.flatMap((childValueId2) => {
81807
+ if (typeof childValueId2 !== "string") return [];
81808
+ const childValue = valuesById.get(childValueId2);
81802
81809
  return childValue === void 0 ? [] : [childValue];
81803
81810
  }) : [];
81804
81811
  for (const [index, childValue] of entries.entries()) {
@@ -92486,7 +92493,8 @@ function planCommitPreparationLoadedClosureScope(args) {
92486
92493
  if (rules.has("ancestor-paths") && record6.parentRecordKind !== null && record6.parentRecordKind !== void 0 && record6.parentRecordId !== null && record6.parentRecordId !== void 0) {
92487
92494
  rememberExact(record6.parentRecordKind, record6.parentRecordId);
92488
92495
  }
92489
- const canOwnStoredDescendants = record6.recordKind !== "value" || !isLiteralValueContent(record6.data) || !["string", "number", "boolean"].includes(typeof record6.data.value) || typeof record6.data.classId === "string" || isVirtualInstanceRootShape(record6.data);
92496
+ const memberWithoutStoredChildren = record6.recordKind === "member" && isMemberBase(record6.data) && getOptionalString(record6.data, "valueId") === void 0 && record6.data.defaultValue === void 0;
92497
+ const canOwnStoredDescendants = !memberWithoutStoredChildren && (record6.recordKind !== "value" || !isLiteralValueContent(record6.data) || !["string", "number", "boolean"].includes(typeof record6.data.value) || typeof record6.data.classId === "string" || isVirtualInstanceRootShape(record6.data));
92490
92498
  if (rules.has("descendants") && record6.includeDescendants !== false && canOwnStoredDescendants && (record6.recordKind === "member" || record6.recordKind === "value" || record6.recordKind === "class" || record6.recordKind === "variant")) {
92491
92499
  rememberRange({
92492
92500
  rangeKind: "children",
@@ -93979,8 +93987,8 @@ function findParentValues(valueId, values) {
93979
93987
  continue;
93980
93988
  }
93981
93989
  if (!isStringRecord6(value.value)) continue;
93982
- for (const [key, childValueId] of Object.entries(value.value)) {
93983
- if (childValueId === valueId) parents.push({ value, key });
93990
+ for (const [key, childValueId2] of Object.entries(value.value)) {
93991
+ if (childValueId2 === valueId) parents.push({ value, key });
93984
93992
  }
93985
93993
  }
93986
93994
  return parents;
@@ -96651,8 +96659,8 @@ function inspectClass(options, member) {
96651
96659
  options.index.members
96652
96660
  );
96653
96661
  if (!memberKindSupportsStorage(childMember.kind)) continue;
96654
- const childValueId = body[entry.schemaKey];
96655
- if (childValueId === void 0) {
96662
+ const childValueId2 = body[entry.schemaKey];
96663
+ if (childValueId2 === void 0) {
96656
96664
  if (isRequiredMember2(childMember) && !options.allowMissingRequiredClassFields) {
96657
96665
  fail(
96658
96666
  `${options.path} is missing required schema key "${entry.schemaKey}".`
@@ -96662,7 +96670,7 @@ function inspectClass(options, member) {
96662
96670
  }
96663
96671
  children.push({
96664
96672
  member: childMember,
96665
- valueId: childValueId,
96673
+ valueId: childValueId2,
96666
96674
  path: `${options.path}.${entry.schemaKey}`,
96667
96675
  genericEnv: environment,
96668
96676
  insideAnimationOverrideGraph: options.insideAnimationOverrideGraph || entersAnimationOverrideGraph(entry.memberId)
@@ -106731,10 +106739,10 @@ function repointedChildValueIds(document, change) {
106731
106739
  if (!isPlainRecord4(change.nextData)) return [];
106732
106740
  const after = change.nextData.value;
106733
106741
  if (!isPlainRecord4(after)) return [];
106734
- return Object.entries(before).flatMap(([schemaKey, childValueId]) => {
106735
- if (typeof childValueId !== "string") return [];
106736
- if (after[schemaKey] === childValueId) return [];
106737
- return [childValueId];
106742
+ return Object.entries(before).flatMap(([schemaKey, childValueId2]) => {
106743
+ if (typeof childValueId2 !== "string") return [];
106744
+ if (after[schemaKey] === childValueId2) return [];
106745
+ return [childValueId2];
106738
106746
  });
106739
106747
  }
106740
106748
  function authoredFieldsEqual(recordKind, base, next) {
@@ -115996,12 +116004,12 @@ function buildStoredValuePlacementIndexV4(records2) {
115996
116004
  const classId = typeof value.classId === "string" ? value.classId : null;
115997
116005
  const body = value.value;
115998
116006
  if (isObjectRecord2(body)) {
115999
- for (const [schemaKey, childValueId] of Object.entries(body)) {
116000
- if (typeof childValueId !== "string" || !values.has(childValueId)) {
116007
+ for (const [schemaKey, childValueId2] of Object.entries(body)) {
116008
+ if (typeof childValueId2 !== "string" || !values.has(childValueId2)) {
116001
116009
  continue;
116002
116010
  }
116003
116011
  add({
116004
- childValueId,
116012
+ childValueId: childValueId2,
116005
116013
  memberId: classId === null ? null : memberIdForSchemaKey(classId, schemaKey),
116006
116014
  parentValueId,
116007
116015
  schemaKey,
@@ -116029,8 +116037,8 @@ function buildStoredValuePlacementIndexV4(records2) {
116029
116037
  continue;
116030
116038
  }
116031
116039
  const parameterId = constructorActionParameterId(constructor2, index);
116032
- const childValueId = constructorArgs[parameterId];
116033
- if (typeof childValueId !== "string" || !values.has(childValueId) || !memberStoresAggregate(
116040
+ const childValueId2 = constructorArgs[parameterId];
116041
+ if (typeof childValueId2 !== "string" || !values.has(childValueId2) || !memberStoresAggregate(
116034
116042
  memberDataById.get(settled.memberId),
116035
116043
  value,
116036
116044
  memberDataById,
@@ -116041,7 +116049,7 @@ function buildStoredValuePlacementIndexV4(records2) {
116041
116049
  continue;
116042
116050
  }
116043
116051
  add({
116044
- childValueId,
116052
+ childValueId: childValueId2,
116045
116053
  memberId: settled.memberId,
116046
116054
  parentValueId,
116047
116055
  schemaKey: settled.schemaKey,
@@ -117766,16 +117774,7 @@ function computeWorkspaceStatus(workspace, options) {
117766
117774
  projectSources.push({ uri: relPath, source, kind: sourceKind });
117767
117775
  }
117768
117776
  if (conflictedFiles.length > 0) {
117769
- return {
117770
- changes: [],
117771
- conflictedFiles,
117772
- parseErrors,
117773
- parseWarnings,
117774
- reconstructed: /* @__PURE__ */ new Map(),
117775
- authoredValueSeeds: /* @__PURE__ */ new Map(),
117776
- binaryChanges: [],
117777
- binaryFiles: []
117778
- };
117777
+ return refusedStatus(conflictedFiles, parseErrors, parseWarnings);
117779
117778
  }
117780
117779
  const { records: loweringRecords, residency: packedResidency } = logicalValueBaseRecordsV4(loweringBaseRecords(workspace.state.records));
117781
117780
  const baseDocuments = schemaBaseDocuments(workspace);
@@ -117907,16 +117906,7 @@ function computeWorkspaceStatus(workspace, options) {
117907
117906
  1
117908
117907
  )
117909
117908
  );
117910
- return {
117911
- changes: [],
117912
- conflictedFiles,
117913
- parseErrors,
117914
- parseWarnings,
117915
- reconstructed: /* @__PURE__ */ new Map(),
117916
- authoredValueSeeds: /* @__PURE__ */ new Map(),
117917
- binaryChanges: [],
117918
- binaryFiles: []
117919
- };
117909
+ return refusedStatus(conflictedFiles, parseErrors, parseWarnings);
117920
117910
  }
117921
117911
  const sourceByKey = manifestRecordSources(manifest);
117922
117912
  const documents = projectSchemaManifestToDocuments(
@@ -118219,8 +118209,7 @@ function computeWorkspaceStatus(workspace, options) {
118219
118209
  if (reconstructed3.has(key)) continue;
118220
118210
  if (brokenFiles.has(recordFile)) continue;
118221
118211
  if (recordState.conflictServerHash === null) continue;
118222
- if (recordState.recordKind === "localized-text" && isLocalizedText(recordState.data) && recordState.data.memberSource !== void 0)
118223
- continue;
118212
+ if (isSharedMemberText(recordState)) continue;
118224
118213
  if (recordState.recordKind === "value") {
118225
118214
  deletedValueIds.add(recordState.recordId);
118226
118215
  }
@@ -118234,6 +118223,9 @@ function computeWorkspaceStatus(workspace, options) {
118234
118223
  casBaseHash: recordState.conflictServerHash !== void 0 ? recordState.conflictServerHash : recordState.contentHash
118235
118224
  });
118236
118225
  }
118226
+ const sourceTextByUri = new Map(
118227
+ sourceEntries.map((entry) => [entry.relPath, entry.source])
118228
+ );
118237
118229
  const referenceFailures = drainValueReferenceObligationsV4(
118238
118230
  prospectiveState,
118239
118231
  manifest,
@@ -118241,9 +118233,7 @@ function computeWorkspaceStatus(workspace, options) {
118241
118233
  registry: valueLowerRegistry,
118242
118234
  analysis: projectAnalysisV4,
118243
118235
  deletedValueIds,
118244
- sourceTextByUri: new Map(
118245
- sourceEntries.map((entry) => [entry.relPath, entry.source])
118246
- )
118236
+ sourceTextByUri
118247
118237
  }
118248
118238
  );
118249
118239
  for (const failure of referenceFailures) {
@@ -118260,16 +118250,7 @@ function computeWorkspaceStatus(workspace, options) {
118260
118250
  }
118261
118251
  reportPhase("record-diff-references", "Checking packed values\u2026");
118262
118252
  if (referenceFailures.length > 0) {
118263
- return {
118264
- changes: [],
118265
- conflictedFiles,
118266
- parseErrors,
118267
- parseWarnings,
118268
- reconstructed: /* @__PURE__ */ new Map(),
118269
- authoredValueSeeds: /* @__PURE__ */ new Map(),
118270
- binaryChanges: [],
118271
- binaryFiles: []
118272
- };
118253
+ return refusedStatus(conflictedFiles, parseErrors, parseWarnings);
118273
118254
  }
118274
118255
  const unanchoredValueDeletes = unanchoredValueDeleteIds({
118275
118256
  records: workspace.state.records,
@@ -118293,16 +118274,7 @@ function computeWorkspaceStatus(workspace, options) {
118293
118274
  "value-base-desync"
118294
118275
  )
118295
118276
  );
118296
- return {
118297
- changes: [],
118298
- conflictedFiles,
118299
- parseErrors,
118300
- parseWarnings,
118301
- reconstructed: /* @__PURE__ */ new Map(),
118302
- authoredValueSeeds: /* @__PURE__ */ new Map(),
118303
- binaryChanges: [],
118304
- binaryFiles: []
118305
- };
118277
+ return refusedStatus(conflictedFiles, parseErrors, parseWarnings);
118306
118278
  }
118307
118279
  parseWarnings.push(
118308
118280
  new SchemaSourceError(
@@ -118315,6 +118287,23 @@ function computeWorkspaceStatus(workspace, options) {
118315
118287
  )
118316
118288
  );
118317
118289
  }
118290
+ if (valueLowerRegistry.storedRowClaims.size > 0) {
118291
+ for (const claim of valueLowerRegistry.storedRowClaims.values()) {
118292
+ const position = composeReferenceSitePosition(
118293
+ claim.site,
118294
+ sourceTextByUri
118295
+ );
118296
+ parseErrors.push(
118297
+ new SchemaSourceError(
118298
+ claim.message,
118299
+ position.file,
118300
+ position.line,
118301
+ position.column
118302
+ )
118303
+ );
118304
+ }
118305
+ return refusedStatus(conflictedFiles, parseErrors, parseWarnings);
118306
+ }
118318
118307
  for (let index = changes.length - 1; index >= 0; index -= 1) {
118319
118308
  const change = changes[index];
118320
118309
  if (change === void 0 || change.kind !== "update") continue;
@@ -119501,6 +119490,21 @@ function summarizeFieldDiff(baseData3, nextData) {
119501
119490
  }
119502
119491
  return lines;
119503
119492
  }
119493
+ function isSharedMemberText(record6) {
119494
+ return record6.recordKind === "localized-text" && isLocalizedText(record6.data) && record6.data.memberSource !== void 0;
119495
+ }
119496
+ function refusedStatus(conflictedFiles, parseErrors, parseWarnings) {
119497
+ return {
119498
+ changes: [],
119499
+ conflictedFiles,
119500
+ parseErrors,
119501
+ parseWarnings,
119502
+ reconstructed: /* @__PURE__ */ new Map(),
119503
+ authoredValueSeeds: /* @__PURE__ */ new Map(),
119504
+ binaryChanges: [],
119505
+ binaryFiles: []
119506
+ };
119507
+ }
119504
119508
  var ANIMATION_DOCUMENT_RECORD_KINDS, ANIMATION_REPLAY_RECORD_KINDS, PROSPECTIVE_ANIMATION_RECORD_KINDS;
119505
119509
  var init_workspace_status_core = __esm({
119506
119510
  "src/project-source/workspace-status-core.ts"() {
@@ -121562,8 +121566,8 @@ function animationConstructorProjectionTargetValueIds(context, classId, value) {
121562
121566
  classId,
121563
121567
  projection.memberId
121564
121568
  );
121565
- const childValueId = schemaKey === null ? void 0 : value.value[schemaKey];
121566
- const childValue = typeof childValueId === "string" ? context.values.get(childValueId) : void 0;
121569
+ const childValueId2 = schemaKey === null ? void 0 : value.value[schemaKey];
121570
+ const childValue = typeof childValueId2 === "string" ? context.values.get(childValueId2) : void 0;
121567
121571
  const projectedMember = context.members.get(projection.memberId);
121568
121572
  if (childValue !== void 0 && projectedMember !== void 0 && numberField(projectedMember, "kind") === 9 /* Lookup */ && Array.isArray(childValue.value) && typeof childValue.value[0] === "string") {
121569
121573
  targetIds.push(childValue.value[0]);
@@ -121716,6 +121720,8 @@ function createValueLowerRegistryV4(options = {}) {
121716
121720
  referenceObligations: [],
121717
121721
  initAuthoredRowIds: /* @__PURE__ */ new Map(),
121718
121722
  loweringFailures: [],
121723
+ storedRowClaims: /* @__PURE__ */ new Map(),
121724
+ placedStoredRowIds: /* @__PURE__ */ new Set(),
121719
121725
  pendingValueIdentitySites: /* @__PURE__ */ new Map(),
121720
121726
  initializerReconciliations: /* @__PURE__ */ new Map()
121721
121727
  };
@@ -121848,6 +121854,8 @@ function buildValueLowerContext(state, manifest, options = {}) {
121848
121854
  ),
121849
121855
  referenceObligations: registry.referenceObligations,
121850
121856
  loweringFailures: registry.loweringFailures,
121857
+ storedRowClaims: registry.storedRowClaims,
121858
+ placedStoredRowIds: registry.placedStoredRowIds,
121851
121859
  pendingValueIdentitySites: registry.pendingValueIdentitySites,
121852
121860
  initializerReconciliations: registry.initializerReconciliations,
121853
121861
  materializedConstructorExpressions: registry.materializedConstructorExpressions,
@@ -121953,14 +121961,16 @@ function entrySliceRequiresEvaluation(entry, declaredConstructors2, entryClassNa
121953
121961
  }
121954
121962
  }
121955
121963
  function indexAuthoredRowIds(index, initSource, owner) {
121956
- const pattern = /@id\(\s*"((?:[^"\\]|\\.)*)"\s*\)/g;
121957
- let match = pattern.exec(initSource);
121958
- while (match !== null) {
121964
+ for (const authored of authoredRowIds(initSource)) {
121965
+ index.set(authored, owner);
121966
+ }
121967
+ }
121968
+ function* authoredRowIds(initSource) {
121969
+ for (const match of initSource.matchAll(
121970
+ /@id\(\s*"((?:[^"\\]|\\.)*)"\s*\)/g
121971
+ )) {
121959
121972
  const authored = match[1];
121960
- if (authored !== void 0 && authored.length > 0) {
121961
- index.set(authored, owner);
121962
- }
121963
- match = pattern.exec(initSource);
121973
+ if (authored !== void 0 && authored.length > 0) yield authored;
121964
121974
  }
121965
121975
  }
121966
121976
  function indexDeclaredInitializers(analysis) {
@@ -123537,7 +123547,8 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
123537
123547
  expressionPosition: {
123538
123548
  line: sourceExpression.pos.line,
123539
123549
  column: sourceExpression.pos.column
123540
- }
123550
+ },
123551
+ nestedListEntries: idlessNestedListEntries(context, expression)
123541
123552
  });
123542
123553
  }
123543
123554
  const code = initializerExpressionSlice(authoredSlice);
@@ -123653,9 +123664,9 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
123653
123664
  );
123654
123665
  }
123655
123666
  const childPath = `${path}.${schemaKey}`;
123656
- const childValueId = pendingNestedValueId(source, childPath);
123657
- if (rows.has(childValueId)) {
123658
- throw new Error(`Value construction reuses identity ${childValueId}.`);
123667
+ const childValueId2 = pendingNestedValueId(source, childPath);
123668
+ if (rows.has(childValueId2)) {
123669
+ throw new Error(`Value construction reuses identity ${childValueId2}.`);
123659
123670
  }
123660
123671
  if (projectedMember.kind === "lookup") {
123661
123672
  if (argument2.kind !== "litString") {
@@ -123853,6 +123864,13 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
123853
123864
  registerSeedRow(context, rows, row, source, sourceExpression);
123854
123865
  return row;
123855
123866
  }
123867
+ function* storedRowIdsRecreatedBy(context, row) {
123868
+ if (context.state[`value:${row.id}`] !== void 0) yield row.id;
123869
+ if (row.nodeType !== "initializer") return;
123870
+ for (const authored of authoredRowIds(row.code)) {
123871
+ if (context.state[`value:${authored}`] !== void 0) yield authored;
123872
+ }
123873
+ }
123856
123874
  function registerSeedRow(context, rows, row, source, expression) {
123857
123875
  if (rows.has(row.id)) {
123858
123876
  throw new Error(`Value construction reuses identity ${row.id}.`);
@@ -123865,6 +123883,15 @@ function registerSeedRow(context, rows, row, source, expression) {
123865
123883
  rows.set(row.id, row);
123866
123884
  return;
123867
123885
  }
123886
+ if (!context.structuralConstruction) {
123887
+ for (const storedId of storedRowIdsRecreatedBy(context, row)) {
123888
+ if (context.storedRowClaims.has(storedId)) continue;
123889
+ context.storedRowClaims.set(storedId, {
123890
+ message: `Value ${source.label} names existing row @id(${JSON.stringify(storedId)}) inside a new row. A row keeps its parent: drop the @id to create a new row.`,
123891
+ site: referenceSite(source, expression)
123892
+ });
123893
+ }
123894
+ }
123868
123895
  rows.set(row.id, row);
123869
123896
  context.pendingValues.set(row.id, row);
123870
123897
  if (row.containerId !== void 0) {
@@ -124781,8 +124808,8 @@ function lowerConstructorProjections(context, schemaClass2, expression, base, ba
124781
124808
  argument: argument2,
124782
124809
  argumentIndex
124783
124810
  } of resolved) {
124784
- const childValueId = baseBody[schemaKey];
124785
- if (typeof childValueId !== "string") {
124811
+ const childValueId2 = baseBody[schemaKey];
124812
+ if (typeof childValueId2 !== "string") {
124786
124813
  throw new Error(
124787
124814
  `Class value ${String(base.id)}.${schemaKey} has no existing structural row.`
124788
124815
  );
@@ -124793,27 +124820,27 @@ function lowerConstructorProjections(context, schemaClass2, expression, base, ba
124793
124820
  `Class value ${String(base.id)}.${schemaKey} requires a value-row id string literal.`
124794
124821
  );
124795
124822
  }
124796
- const projectedBase = valueBase(context, childValueId);
124823
+ const projectedBase = valueBase(context, childValueId2);
124797
124824
  addReconstructed(
124798
124825
  context,
124799
124826
  "value",
124800
- childValueId,
124827
+ childValueId2,
124801
124828
  { ...valueFileFields(projectedBase), value: [argument2.value] },
124802
124829
  source.source
124803
124830
  );
124804
- body[schemaKey] = childValueId;
124831
+ body[schemaKey] = childValueId2;
124805
124832
  continue;
124806
124833
  }
124807
124834
  lowerValueRow(
124808
124835
  context,
124809
124836
  projectedMember,
124810
124837
  argument2,
124811
- childValueId,
124838
+ childValueId2,
124812
124839
  source,
124813
124840
  environment,
124814
124841
  argumentSlices[argumentIndex]
124815
124842
  );
124816
- body[schemaKey] = childValueId;
124843
+ body[schemaKey] = childValueId2;
124817
124844
  }
124818
124845
  }
124819
124846
  function classInheritanceChain(classes, classId) {
@@ -125324,6 +125351,12 @@ function lowerListValue(context, member, expression, base, source, inheritedEnvi
125324
125351
  );
125325
125352
  continue;
125326
125353
  }
125354
+ recordRepeatedRow(
125355
+ context,
125356
+ itemId,
125357
+ `List ${member.name}`,
125358
+ referenceSite(source, element)
125359
+ );
125327
125360
  const child = valueBase(context, itemId);
125328
125361
  if (member.listKind === "unordered" && child.containerId !== base.id) {
125329
125362
  throw new Error(
@@ -125347,6 +125380,16 @@ function lowerListValue(context, member, expression, base, source, inheritedEnvi
125347
125380
  value: member.listKind === "unordered" ? [] : ids
125348
125381
  };
125349
125382
  }
125383
+ function recordRepeatedRow(context, rowId, collection, site) {
125384
+ if (!context.placedStoredRowIds.has(rowId)) {
125385
+ context.placedStoredRowIds.add(rowId);
125386
+ return;
125387
+ }
125388
+ context.loweringFailures.push({
125389
+ message: `${collection} places existing row @id(${JSON.stringify(rowId)}), which source already places elsewhere. A row has one position: drop the @id on the copy to create a new row.`,
125390
+ site
125391
+ });
125392
+ }
125350
125393
  function lowerPendingListItem(context, member, expression, source, path, containerId, environment, authoredSlice) {
125351
125394
  const rows = /* @__PURE__ */ new Map();
125352
125395
  const localizedTexts = /* @__PURE__ */ new Map();
@@ -125414,6 +125457,12 @@ function lowerDictionaryValue(context, member, expression, base, source, inherit
125414
125457
  `Dictionary ${member.name}[${JSON.stringify(key)}] has no existing row. New dictionary entries are not implemented by this slice.`
125415
125458
  );
125416
125459
  }
125460
+ recordRepeatedRow(
125461
+ context,
125462
+ valueId,
125463
+ `Dictionary ${member.name}`,
125464
+ referenceSite(source, entry.value)
125465
+ );
125417
125466
  body[key] = lowerValueRow(
125418
125467
  context,
125419
125468
  entryMember,
@@ -125485,14 +125534,20 @@ function lowerEnum2(context, member, expression) {
125485
125534
  throw new Error(`Enum member ${member.name} requires [...].`);
125486
125535
  const options = context.enumOptions.get(member.enumId);
125487
125536
  if (options === void 0) throw new Error(`Unknown enum ${member.enumId}.`);
125537
+ const enumName = context.enumNames.get(member.enumId);
125538
+ if (enumName === void 0) {
125539
+ throw new Error(`Enum ${member.enumId} has no manifest name.`);
125540
+ }
125541
+ const subject = `Enum member ${member.name}`;
125488
125542
  return elements.map((entry) => {
125489
- if (entry.kind !== "contextualEnum") {
125543
+ const optionName = enumOptionSpelling(entry, enumName, subject);
125544
+ if (optionName === null) {
125490
125545
  throw new Error(
125491
- `Enum member ${member.name} requires contextual .Option values.`
125546
+ `${subject} requires .Option or ${enumName}.Option values.`
125492
125547
  );
125493
125548
  }
125494
- const id2 = options.get(entry.name);
125495
- if (id2 === void 0) throw new Error(`Enum has no option ${entry.name}.`);
125549
+ const id2 = options.get(optionName);
125550
+ if (id2 === void 0) throw new Error(`Enum has no option ${optionName}.`);
125496
125551
  return id2;
125497
125552
  });
125498
125553
  }
@@ -126078,17 +126133,17 @@ function indexValuePlacements(state, options = {}) {
126078
126133
  }
126079
126134
  const body = isObjectRecord2(row.body) ? row.body : null;
126080
126135
  if (body === null) continue;
126081
- for (const [memberName, childValueId] of Object.entries(body)) {
126082
- if (typeof childValueId !== "string") continue;
126083
- const placementKey = `${memberName}:${childValueId}`;
126136
+ for (const [memberName, childValueId2] of Object.entries(body)) {
126137
+ if (typeof childValueId2 !== "string") continue;
126138
+ const placementKey = `${memberName}:${childValueId2}`;
126084
126139
  if (!containerBodyByPlacement.has(placementKey)) {
126085
126140
  containerBodyByPlacement.set(placementKey, body);
126086
126141
  }
126087
126142
  const placed = mutablePlacedValueIds.get(memberName) ?? /* @__PURE__ */ new Set();
126088
- placed.add(childValueId);
126143
+ placed.add(childValueId2);
126089
126144
  mutablePlacedValueIds.set(memberName, placed);
126090
126145
  const placement = {
126091
- valueId: childValueId,
126146
+ valueId: childValueId2,
126092
126147
  schemaKey: memberName,
126093
126148
  containerValueId: row.id,
126094
126149
  containerClassId: row.classId
@@ -126096,9 +126151,9 @@ function indexValuePlacements(state, options = {}) {
126096
126151
  const byKey = placementsBySchemaKey.get(memberName) ?? [];
126097
126152
  byKey.push(placement);
126098
126153
  placementsBySchemaKey.set(memberName, byKey);
126099
- const byValue = placementsByValueId.get(childValueId) ?? [];
126154
+ const byValue = placementsByValueId.get(childValueId2) ?? [];
126100
126155
  byValue.push(placement);
126101
- placementsByValueId.set(childValueId, byValue);
126156
+ placementsByValueId.set(childValueId2, byValue);
126102
126157
  }
126103
126158
  }
126104
126159
  const valueIdByMemberId = /* @__PURE__ */ new Map();
@@ -126569,6 +126624,68 @@ function fileTargetId(context, expression, registry) {
126569
126624
  }
126570
126625
  return null;
126571
126626
  }
126627
+ function idlessNestedListEntries(context, expression) {
126628
+ const entries = [];
126629
+ let spellable = true;
126630
+ const visit = (node, path) => {
126631
+ const { expression: unwrapped } = annotatedValue(node);
126632
+ if (unwrapped.kind === "new") {
126633
+ for (const field of unwrapped.initializer ?? []) {
126634
+ visit(field.value, [...path, field.name]);
126635
+ }
126636
+ return;
126637
+ }
126638
+ if (unwrapped.kind === "litDict") {
126639
+ for (const entry of unwrapped.entries) {
126640
+ if (entry.key.kind === "litString") {
126641
+ visit(entry.value, [...path, entry.key.value]);
126642
+ continue;
126643
+ }
126644
+ const before = entries.length;
126645
+ visit(entry.value, path);
126646
+ if (entries.length > before) spellable = false;
126647
+ }
126648
+ return;
126649
+ }
126650
+ if (unwrapped.kind !== "litList") return;
126651
+ unwrapped.elements.forEach((element, index) => {
126652
+ const entryPath = [...path, index];
126653
+ if (annotatedValue(element).id === null && sourceValueSymbol(context, element) === null) {
126654
+ const start = stampableEntryStart(element);
126655
+ if (start === null) spellable = false;
126656
+ else {
126657
+ entries.push({
126658
+ path: entryPath,
126659
+ expressionPosition: { line: start.line, column: start.column }
126660
+ });
126661
+ }
126662
+ }
126663
+ visit(element, entryPath);
126664
+ });
126665
+ };
126666
+ visit(expression, []);
126667
+ return spellable ? entries : null;
126668
+ }
126669
+ function stampableEntryStart(expression) {
126670
+ switch (expression.kind) {
126671
+ case "member":
126672
+ case "index":
126673
+ return stampableEntryStart(expression.receiver);
126674
+ case "call":
126675
+ return stampableEntryStart(expression.callee);
126676
+ case "force":
126677
+ return stampableEntryStart(expression.operand);
126678
+ case "binary":
126679
+ case "coalesce":
126680
+ case "conditional":
126681
+ case "is":
126682
+ case "lambda":
126683
+ case "annotated":
126684
+ return null;
126685
+ default:
126686
+ return expression.pos;
126687
+ }
126688
+ }
126572
126689
  function memberPath2(expression) {
126573
126690
  if (expression.kind === "ident") return expression.name;
126574
126691
  if (expression.kind !== "member") return null;
@@ -128005,10 +128122,10 @@ function constructorProjectionSource(context, classId, body, visited, environmen
128005
128122
  classId,
128006
128123
  projection.memberId
128007
128124
  );
128008
- const childValueId = schemaKey === null ? void 0 : body[schemaKey];
128009
- const childValue = typeof childValueId === "string" ? context.values.get(childValueId) : void 0;
128125
+ const childValueId2 = schemaKey === null ? void 0 : body[schemaKey];
128126
+ const childValue = typeof childValueId2 === "string" ? context.values.get(childValueId2) : void 0;
128010
128127
  const projectedMember = context.members.get(projection.memberId);
128011
- if (schemaKey === null || typeof childValueId !== "string" || childValue === void 0 || projectedMember === void 0) {
128128
+ if (schemaKey === null || typeof childValueId2 !== "string" || childValue === void 0 || projectedMember === void 0) {
128012
128129
  throw new Error(
128013
128130
  `Class ${context.manifestClasses.get(classId)?.name ?? classId} constructor projection ${projection.parameterName} has no stored projected value.`
128014
128131
  );
@@ -128023,7 +128140,7 @@ function constructorProjectionSource(context, classId, body, visited, environmen
128023
128140
  `Class ${context.manifestClasses.get(classId)?.name ?? classId} constructor projection ${projection.parameterName} requires exactly one referenced value.`
128024
128141
  );
128025
128142
  }
128026
- visited.add(childValueId);
128143
+ visited.add(childValueId2);
128027
128144
  targetValueIds.push(targetIds[0]);
128028
128145
  argumentsValue.push(
128029
128146
  `${projection.parameterName}: ${quote5(targetIds[0])}`
@@ -128034,7 +128151,7 @@ function constructorProjectionSource(context, classId, body, visited, environmen
128034
128151
  `${projection.parameterName}: ${emitValue(
128035
128152
  context,
128036
128153
  projectedMember,
128037
- childValueId,
128154
+ childValueId2,
128038
128155
  {
128039
128156
  definitionSite: true,
128040
128157
  writeIdentity: false,
@@ -130949,6 +131066,35 @@ var init_push_hook = __esm({
130949
131066
  }
130950
131067
  });
130951
131068
 
131069
+ // src/concurrency.ts
131070
+ async function mapWithConcurrency(values, concurrency, run) {
131071
+ let nextIndex = 0;
131072
+ let failure;
131073
+ const results = new Array(values.length);
131074
+ const worker = async () => {
131075
+ while (failure === void 0) {
131076
+ const index = nextIndex;
131077
+ nextIndex += 1;
131078
+ if (index >= values.length) return;
131079
+ try {
131080
+ results[index] = await run(values[index], index);
131081
+ } catch (error) {
131082
+ failure ??= { error };
131083
+ }
131084
+ }
131085
+ };
131086
+ await Promise.all(
131087
+ Array.from({ length: Math.min(concurrency, values.length) }, worker)
131088
+ );
131089
+ if (failure !== void 0) throw failure.error;
131090
+ return results;
131091
+ }
131092
+ var init_concurrency = __esm({
131093
+ "src/concurrency.ts"() {
131094
+ "use strict";
131095
+ }
131096
+ });
131097
+
130952
131098
  // src/project-source/project-file-push.ts
130953
131099
  import { basename as basename2, join as join9 } from "node:path";
130954
131100
  import { readFileSync as readFileSync11 } from "node:fs";
@@ -131377,28 +131523,6 @@ async function waitForRetry(attempt, signal) {
131377
131523
  signal.addEventListener("abort", abort, { once: true });
131378
131524
  });
131379
131525
  }
131380
- async function mapWithConcurrency(values, concurrency, run) {
131381
- let nextIndex = 0;
131382
- let firstError;
131383
- const results = new Array(values.length);
131384
- const worker = async () => {
131385
- while (firstError === void 0) {
131386
- const index = nextIndex;
131387
- nextIndex += 1;
131388
- if (index >= values.length) return;
131389
- try {
131390
- results[index] = await run(values[index]);
131391
- } catch (error) {
131392
- firstError ??= error;
131393
- }
131394
- }
131395
- };
131396
- await Promise.all(
131397
- Array.from({ length: Math.min(concurrency, values.length) }, worker)
131398
- );
131399
- if (firstError !== void 0) throw firstError;
131400
- return results;
131401
- }
131402
131526
  function combineSignals(...signals) {
131403
131527
  const defined = signals.filter(
131404
131528
  (signal) => signal !== void 0
@@ -131429,6 +131553,7 @@ var UPLOAD_CONCURRENCY, PRESIGN_BATCH_SIZE, MULTIPART_PART_CONCURRENCY, PRESIGN_
131429
131553
  var init_project_file_push = __esm({
131430
131554
  "src/project-source/project-file-push.ts"() {
131431
131555
  "use strict";
131556
+ init_concurrency();
131432
131557
  init_project_files();
131433
131558
  init_projection();
131434
131559
  init_src();
@@ -133949,7 +134074,10 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
133949
134074
  workspace,
133950
134075
  replacements.exact,
133951
134076
  localStatus.pendingValueIdentitySites,
133952
- { sourceSnapshot: localStatus.sourceSnapshot }
134077
+ {
134078
+ sourceSnapshot: localStatus.sourceSnapshot,
134079
+ committedValueAtPath: committedValueAtPathReader(nextRecords)
134080
+ }
133953
134081
  );
133954
134082
  const localRecords = rewriteReconstructedRecords(
133955
134083
  localStatus.reconstructed,
@@ -133977,7 +134105,8 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
133977
134105
  for (const [key, state] of Object.entries(nextRecords)) {
133978
134106
  const prior = previousRecords[key];
133979
134107
  const local = localRecords.get(key);
133980
- if (local === void 0 && prior?.file !== void 0) continue;
134108
+ if (local === void 0 && prior?.file !== void 0 && !isSharedMemberText(state))
134109
+ continue;
133981
134110
  const submitted = submittedByKey.get(key);
133982
134111
  const emitData = local === void 0 ? state.data : changedKeys.has(key) && submitted !== void 0 ? mergeCommittedRecordWithLaterLocalEdits(
133983
134112
  state.recordKind,
@@ -134516,12 +134645,10 @@ function materializeAssignedSchemaIdsInAuthoredSource(workspace, replacements, p
134516
134645
  entry.identity.source.range.start.line,
134517
134646
  entry.identity.source.range.start.character
134518
134647
  );
134519
- const indentation = sourceIndentationAt(source, start);
134520
- const newline = source.includes("\r\n") ? "\r\n" : "\n";
134521
134648
  edits.push({
134522
134649
  start,
134523
134650
  end: start,
134524
- text: `@id(${JSON.stringify(assignedId)})${newline}${indentation}`
134651
+ text: idStampText(source, start, assignedId)
134525
134652
  });
134526
134653
  } else {
134527
134654
  const quotedPendingId = JSON.stringify(pendingId2);
@@ -134559,15 +134686,18 @@ function materializeAssignedSchemaIdsInAuthoredSource(workspace, replacements, p
134559
134686
  site.expressionPosition.column
134560
134687
  );
134561
134688
  if (expressionOffset === null) continue;
134562
- const insertion = initializerOffset + expressionOffset;
134563
- const indentation = sourceIndentationAt(source, insertion);
134564
- const newline = source.includes("\r\n") ? "\r\n" : "\n";
134565
- const edits = editsByUri.get(site.uri) ?? [];
134566
- edits.push({
134567
- start: insertion,
134568
- end: insertion,
134569
- text: `@id(${JSON.stringify(assignedId)})${newline}${indentation}`
134689
+ const stamp = (offset, id2) => ({
134690
+ start: offset,
134691
+ end: offset,
134692
+ text: idStampText(source, offset, id2)
134570
134693
  });
134694
+ const entryStamps = options.committedValueAtPath === void 0 ? [] : nestedListEntryStamps(site, assignedId, options.committedValueAtPath);
134695
+ if (entryStamps === null) continue;
134696
+ const edits = editsByUri.get(site.uri) ?? [];
134697
+ edits.push(stamp(initializerOffset + expressionOffset, assignedId));
134698
+ for (const entry of entryStamps) {
134699
+ edits.push(stamp(initializerOffset + entry.offset, entry.id));
134700
+ }
134571
134701
  editsByUri.set(site.uri, edits);
134572
134702
  const handled = handledByUri.get(site.uri) ?? /* @__PURE__ */ new Set();
134573
134703
  handled.add(pendingId2);
@@ -134601,6 +134731,49 @@ function materializeAssignedSchemaIdsInAuthoredSource(workspace, replacements, p
134601
134731
  }
134602
134732
  return preserved;
134603
134733
  }
134734
+ function nestedListEntryStamps(site, rowId, committedValueAtPath) {
134735
+ if (site.nestedListEntries === null) return null;
134736
+ const stamps = [];
134737
+ for (const entry of site.nestedListEntries) {
134738
+ const id2 = committedValueAtPath(rowId, entry.path);
134739
+ if (id2 === null) return null;
134740
+ const offset = sourceOffsetInsideInitializer(
134741
+ site.initializer,
134742
+ entry.expressionPosition.line,
134743
+ entry.expressionPosition.column
134744
+ );
134745
+ if (offset === null) return null;
134746
+ if (precedingNonWhitespace(site.initializer, offset) === "(") return null;
134747
+ stamps.push({ offset, id: id2 });
134748
+ }
134749
+ return stamps;
134750
+ }
134751
+ function precedingNonWhitespace(text, offset) {
134752
+ let index = offset - 1;
134753
+ while (index >= 0 && /\s/u.test(text[index] ?? "")) index -= 1;
134754
+ return text[index];
134755
+ }
134756
+ function committedValueAtPathReader(records2) {
134757
+ let rows;
134758
+ return (rootId, path) => {
134759
+ rows ??= storedValueRowsByIdV4(Object.values(records2));
134760
+ let id2 = rootId;
134761
+ for (const key of path) {
134762
+ const next = childValueId(rows.get(id2)?.value, key);
134763
+ if (next === null) return null;
134764
+ id2 = next;
134765
+ }
134766
+ return id2;
134767
+ };
134768
+ }
134769
+ function childValueId(body, key) {
134770
+ if (typeof key === "number") {
134771
+ const entry = Array.isArray(body) ? body[key] : void 0;
134772
+ return typeof entry === "string" ? entry : null;
134773
+ }
134774
+ const child = isObjectRecord2(body) ? body[key] : void 0;
134775
+ return typeof child === "string" ? child : null;
134776
+ }
134604
134777
  function sourceOffsetInsideInitializer(source, oneBasedLine, oneBasedColumn) {
134605
134778
  if (oneBasedLine < 1 || oneBasedColumn < 1) return null;
134606
134779
  let offset = 0;
@@ -134630,9 +134803,13 @@ function sourceOffsetAt2(source, line, character) {
134630
134803
  }
134631
134804
  return Math.min(offset + character, source.length);
134632
134805
  }
134633
- function sourceIndentationAt(source, offset) {
134806
+ function idStampText(source, offset, id2) {
134807
+ const annotation2 = `@id(${JSON.stringify(id2)})`;
134634
134808
  const lineStart = source.lastIndexOf("\n", Math.max(0, offset - 1)) + 1;
134635
- return /^[\t ]*/u.exec(source.slice(lineStart, offset))?.[0] ?? "";
134809
+ const prefix = source.slice(lineStart, offset);
134810
+ if (!/^[\t ]*$/u.test(prefix)) return `${annotation2} `;
134811
+ const newline = source.includes("\r\n") ? "\r\n" : "\n";
134812
+ return `${annotation2}${newline}${prefix}`;
134636
134813
  }
134637
134814
  async function buildPostPushCompileSchema(workspace, status) {
134638
134815
  const byKind = /* @__PURE__ */ new Map();
@@ -136077,11 +136254,19 @@ var init_reset = __esm({
136077
136254
  });
136078
136255
 
136079
136256
  // src/project-source/project-file-pull.ts
136080
- import { existsSync as existsSync11, rmSync as rmSync7 } from "node:fs";
136257
+ import {
136258
+ existsSync as existsSync11,
136259
+ mkdtempSync,
136260
+ readFileSync as readFileSync15,
136261
+ rmSync as rmSync7,
136262
+ writeFileSync as writeFileSync10
136263
+ } from "node:fs";
136264
+ import { tmpdir } from "node:os";
136081
136265
  import { join as join13 } from "node:path";
136082
136266
  async function pullProjectBinariesV4(args) {
136083
136267
  const resolvePath = createWorkspaceSourcePathResolver(args.workspace.root);
136084
- let client = args.client ?? null;
136268
+ const plans = /* @__PURE__ */ new Map();
136269
+ const downloads = [];
136085
136270
  const localById = new Map(
136086
136271
  (args.localBinaries ?? []).map((binary) => [binary.fileId, binary])
136087
136272
  );
@@ -136095,7 +136280,14 @@ async function pullProjectBinariesV4(args) {
136095
136280
  throw new Error(`project-file:${record6.recordId} must be an object.`);
136096
136281
  }
136097
136282
  if (record6.data.status !== "uploaded") continue;
136098
- client ??= NeoApiClient.forBaseUrl(args.workspace.config.apiBaseUrl);
136283
+ const existing = plans.get(record6.recordId);
136284
+ if (existing !== void 0) {
136285
+ if (existing.contentHash !== record6.contentHash)
136286
+ throw new Error(
136287
+ `Project file ${record6.recordId} appears with conflicting content hashes in the pulled document.`
136288
+ );
136289
+ continue;
136290
+ }
136099
136291
  const key = `project-file:${record6.recordId}`;
136100
136292
  const previous = args.previousRecords[key];
136101
136293
  const localStatus = localById.get(record6.recordId);
@@ -136108,7 +136300,6 @@ async function pullProjectBinariesV4(args) {
136108
136300
  record6.data,
136109
136301
  `project-file:${record6.recordId} metadata`
136110
136302
  );
136111
- let remoteBytes = null;
136112
136303
  let action = planBinaryMergeV4({
136113
136304
  baseDigest,
136114
136305
  localDigest,
@@ -136119,98 +136310,142 @@ async function pullProjectBinariesV4(args) {
136119
136310
  if (args.destructive === true) {
136120
136311
  action = localDigest === remoteDigest ? "unchanged" : "download";
136121
136312
  }
136122
- if (action === "download" || action === "conflict") {
136123
- if (remoteBytes === null) {
136124
- const response = await download(
136125
- record6.data,
136126
- record6.recordId,
136127
- client,
136128
- args.workspace
136129
- );
136130
- remoteBytes = response.bytes;
136131
- if (response.sha256 !== remoteDigest) {
136313
+ const plan = {
136314
+ key,
136315
+ fileId: record6.recordId,
136316
+ contentHash: record6.contentHash,
136317
+ data: record6.data,
136318
+ previous,
136319
+ path,
136320
+ baseDigest,
136321
+ remoteDigest,
136322
+ action
136323
+ };
136324
+ plans.set(record6.recordId, plan);
136325
+ if (action === "download" || action === "conflict") downloads.push(plan);
136326
+ }
136327
+ let stagingDirectory;
136328
+ try {
136329
+ const stagedPaths = /* @__PURE__ */ new Map();
136330
+ if (downloads.length > 0) {
136331
+ stagingDirectory = mkdtempSync(join13(tmpdir(), "neo-pull-files-"));
136332
+ const directory = stagingDirectory;
136333
+ const client = args.client ?? NeoApiClient.forBaseUrl(args.workspace.config.apiBaseUrl);
136334
+ await mapWithConcurrency(
136335
+ downloads,
136336
+ DOWNLOAD_CONCURRENCY,
136337
+ async (plan, index) => {
136338
+ const response = await download(
136339
+ plan.data,
136340
+ plan.fileId,
136341
+ client,
136342
+ args.workspace
136343
+ );
136344
+ if (response.sha256 !== plan.remoteDigest) {
136345
+ throw new Error(
136346
+ `Project file ${plan.fileId} content changed while pull was in progress (${plan.remoteDigest} -> ${response.sha256}). Pull again against a stable version head.`
136347
+ );
136348
+ }
136349
+ const stagedPath = join13(directory, String(index));
136350
+ writeFileSync10(stagedPath, response.bytes);
136351
+ stagedPaths.set(plan.fileId, stagedPath);
136352
+ }
136353
+ );
136354
+ }
136355
+ for (const plan of plans.values()) {
136356
+ const {
136357
+ key,
136358
+ fileId,
136359
+ data,
136360
+ previous,
136361
+ path,
136362
+ baseDigest,
136363
+ remoteDigest,
136364
+ action
136365
+ } = plan;
136366
+ const absolute = resolvePath(path);
136367
+ const stagedPath = stagedPaths.get(fileId);
136368
+ const remoteBytes = stagedPath === void 0 ? null : readFileSync15(stagedPath);
136369
+ if (action === "download") {
136370
+ if (remoteBytes === null) {
136132
136371
  throw new Error(
136133
- `Project file ${record6.recordId} content changed while pull was in progress (${remoteDigest} -> ${response.sha256}). Pull again against a stable version head.`
136372
+ `Project file ${fileId} download plan has no verified remote bytes.`
136134
136373
  );
136135
136374
  }
136375
+ writeVerifiedBinaryDownloadV4(absolute, remoteBytes, remoteDigest);
136376
+ downloaded += 1;
136377
+ states.set(key, binaryState(path, remoteDigest, data));
136378
+ continue;
136136
136379
  }
136137
- }
136138
- if (action === "download") {
136139
- if (remoteBytes === null) {
136140
- throw new Error(
136141
- `Project file ${record6.recordId} download plan has no verified remote bytes.`
136142
- );
136380
+ if (action === "conflict") {
136381
+ if (remoteBytes === null) {
136382
+ throw new Error(
136383
+ `Project file ${fileId} conflict plan has no verified remote bytes.`
136384
+ );
136385
+ }
136386
+ const artifactPath = writeBinaryConflictArtifactV4(
136387
+ args.workspace.root,
136388
+ fileId,
136389
+ fileName(data),
136390
+ remoteBytes,
136391
+ remoteDigest
136392
+ );
136393
+ const state = binaryState(path, baseDigest, data);
136394
+ states.set(key, {
136395
+ ...state,
136396
+ conflict: {
136397
+ action: "conflict",
136398
+ remoteSha256: remoteDigest,
136399
+ artifactPath
136400
+ }
136401
+ });
136402
+ conflicts.push(path);
136403
+ conflicted += 1;
136404
+ continue;
136143
136405
  }
136144
- writeVerifiedBinaryDownloadV4(absolute, remoteBytes, remoteDigest);
136145
- downloaded += 1;
136146
- states.set(key, binaryState(path, remoteDigest, record6.data));
136147
- continue;
136148
- }
136149
- if (action === "conflict") {
136150
- if (remoteBytes === null) {
136151
- throw new Error(
136152
- `Project file ${record6.recordId} conflict plan has no verified remote bytes.`
136153
- );
136406
+ if (action === "converged" || action === "unchanged") {
136407
+ states.set(key, binaryState(path, remoteDigest, data));
136408
+ removePreviousConflict(args.workspace.root, previous?.projectBinary);
136409
+ continue;
136154
136410
  }
136155
- const artifactPath = writeBinaryConflictArtifactV4(
136156
- args.workspace.root,
136157
- record6.recordId,
136158
- fileName(record6.data),
136159
- remoteBytes,
136160
- remoteDigest
136161
- );
136162
- const state = binaryState(path, baseDigest, record6.data);
136163
- states.set(key, {
136164
- ...state,
136165
- conflict: {
136166
- action: "conflict",
136167
- remoteSha256: remoteDigest,
136168
- artifactPath
136169
- }
136170
- });
136171
- conflicts.push(path);
136172
- conflicted += 1;
136173
- continue;
136174
- }
136175
- if (action === "converged" || action === "unchanged") {
136176
- states.set(key, binaryState(path, remoteDigest, record6.data));
136177
- removePreviousConflict(args.workspace.root, previous?.projectBinary);
136178
- continue;
136179
- }
136180
- states.set(key, binaryState(path, baseDigest, record6.data));
136181
- }
136182
- for (const [key, previous] of Object.entries(args.previousRecords)) {
136183
- if (previous.recordKind !== "project-file") continue;
136184
- if (args.document.records.has(key)) continue;
136185
- const localStatus = localById.get(previous.recordId);
136186
- const path = localStatus?.path ?? previous.projectBinary?.path ?? canonicalProjectBinaryPathV42(previous.data);
136187
- const absolute = resolvePath(path);
136188
- const localDigest = existsSync11(absolute) ? sha256File(absolute) : null;
136189
- const baseDigest = previous.projectBinary?.sha256 ?? readSha256(previous.data) ?? null;
136190
- const action = planBinaryMergeV4({
136191
- baseDigest,
136192
- localDigest,
136193
- remoteDigest: null,
136194
- declarationPresent: localStatus !== void 0,
136195
- hadLocalBytes: previous.projectBinary !== void 0
136196
- });
136197
- if (action === "delete-modify") {
136198
- const data = isObjectRecord2(previous.data) ? previous.data : {};
136199
- states.set(key, {
136200
- ...binaryState(path, baseDigest, data),
136201
- conflict: {
136202
- action: "delete-modify",
136203
- remoteSha256: null
136204
- }
136411
+ states.set(key, binaryState(path, baseDigest, data));
136412
+ }
136413
+ for (const [key, previous] of Object.entries(args.previousRecords)) {
136414
+ if (previous.recordKind !== "project-file") continue;
136415
+ if (args.document.records.has(key)) continue;
136416
+ const localStatus = localById.get(previous.recordId);
136417
+ const path = localStatus?.path ?? previous.projectBinary?.path ?? canonicalProjectBinaryPathV42(previous.data);
136418
+ const absolute = resolvePath(path);
136419
+ const localDigest = existsSync11(absolute) ? sha256File(absolute) : null;
136420
+ const baseDigest = previous.projectBinary?.sha256 ?? readSha256(previous.data) ?? null;
136421
+ const action = planBinaryMergeV4({
136422
+ baseDigest,
136423
+ localDigest,
136424
+ remoteDigest: null,
136425
+ declarationPresent: localStatus !== void 0,
136426
+ hadLocalBytes: previous.projectBinary !== void 0
136205
136427
  });
136206
- conflicts.push(path);
136207
- conflicted += 1;
136208
- continue;
136428
+ if (action === "delete-modify") {
136429
+ const data = isObjectRecord2(previous.data) ? previous.data : {};
136430
+ states.set(key, {
136431
+ ...binaryState(path, baseDigest, data),
136432
+ conflict: {
136433
+ action: "delete-modify",
136434
+ remoteSha256: null
136435
+ }
136436
+ });
136437
+ conflicts.push(path);
136438
+ conflicted += 1;
136439
+ continue;
136440
+ }
136441
+ rmSync7(absolute, { force: true });
136442
+ removePreviousConflict(args.workspace.root, previous.projectBinary);
136209
136443
  }
136210
- rmSync7(absolute, { force: true });
136211
- removePreviousConflict(args.workspace.root, previous.projectBinary);
136444
+ return { states, downloaded, conflicted, conflicts };
136445
+ } finally {
136446
+ if (stagingDirectory !== void 0)
136447
+ rmSync7(stagingDirectory, { recursive: true, force: true });
136212
136448
  }
136213
- return { states, downloaded, conflicted, conflicts };
136214
136449
  }
136215
136450
  async function download(data, fileId, client, workspace) {
136216
136451
  const version = typeof data.storageETag === "string" ? `?v=${encodeURIComponent(data.storageETag)}` : "";
@@ -136279,13 +136514,16 @@ function removePreviousConflict(root, state) {
136279
136514
  if (state?.conflict?.artifactPath === void 0) return;
136280
136515
  rmSync7(join13(root, state.conflict.artifactPath), { force: true });
136281
136516
  }
136517
+ var DOWNLOAD_CONCURRENCY;
136282
136518
  var init_project_file_pull = __esm({
136283
136519
  "src/project-source/project-file-pull.ts"() {
136284
136520
  "use strict";
136285
136521
  init_workspace_source_path();
136522
+ init_concurrency();
136286
136523
  init_http();
136287
136524
  init_projection();
136288
136525
  init_project_files();
136526
+ DOWNLOAD_CONCURRENCY = 8;
136289
136527
  }
136290
136528
  });
136291
136529
 
@@ -136410,10 +136648,10 @@ __export(pull_exports, {
136410
136648
  });
136411
136649
  import {
136412
136650
  mkdirSync as mkdirSync10,
136413
- writeFileSync as writeFileSync10,
136651
+ writeFileSync as writeFileSync11,
136414
136652
  rmSync as rmSync8,
136415
136653
  existsSync as existsSync12,
136416
- readFileSync as readFileSync15
136654
+ readFileSync as readFileSync16
136417
136655
  } from "node:fs";
136418
136656
  import { dirname as dirname9 } from "node:path";
136419
136657
  async function runPull(workspace, options, progress = spinner("Checking local workspace\u2026")) {
@@ -136574,8 +136812,7 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
136574
136812
  baseState.data,
136575
136813
  mainLocale
136576
136814
  );
136577
- const locallyDeleted = hasBaseline && baseState.file !== void 0 && local === void 0 && // Member-owned texts survive losing their last inline source reference.
136578
- !(serverRecord.recordKind === "localized-text" && isLocalizedText(baseState.data) && baseState.data.memberSource !== void 0);
136815
+ const locallyDeleted = hasBaseline && baseState.file !== void 0 && local === void 0 && !isSharedMemberText(baseState);
136579
136816
  if (!serverChanged) {
136580
136817
  plans.set(key, {
136581
136818
  emitData: locallyDeleted ? void 0 : local === void 0 ? serverRecord.data : mergeProjectDocumentRecord(
@@ -136881,7 +137118,7 @@ async function finishFormat4Pull(args) {
136881
137118
  let written = 0;
136882
137119
  for (const path of emittedPaths) {
136883
137120
  const absolute = resolveSourcePath(path);
136884
- const existing = existsSync12(absolute) ? readFileSync15(absolute, "utf8") : null;
137121
+ const existing = existsSync12(absolute) ? readFileSync16(absolute, "utf8") : null;
136885
137122
  const unprojectedConflictKeys = authoredLocalConflictKeysByPath.get(path) ?? [];
136886
137123
  if (unprojectedConflictKeys.length > 0 && existing === null) {
136887
137124
  throw new Error(
@@ -136903,7 +137140,7 @@ async function finishFormat4Pull(args) {
136903
137140
  mkdirSync10(dirname9(absolute), { recursive: true });
136904
137141
  if (existing !== null && !marked && !rewritePaths.has(path)) continue;
136905
137142
  if (existing !== content) {
136906
- writeFileSync10(absolute, content, "utf8");
137143
+ writeFileSync11(absolute, content, "utf8");
136907
137144
  written += 1;
136908
137145
  }
136909
137146
  }
@@ -137303,7 +137540,6 @@ var init_pull = __esm({
137303
137540
  "src/commands/pull.ts"() {
137304
137541
  "use strict";
137305
137542
  init_push();
137306
- init_localization2();
137307
137543
  init_source_layout();
137308
137544
  init_project_read_base();
137309
137545
  init_document();
@@ -137338,7 +137574,7 @@ var init_exports = {};
137338
137574
  __export(init_exports, {
137339
137575
  runInit: () => runInit
137340
137576
  });
137341
- import { existsSync as existsSync13, mkdirSync as mkdirSync11, readFileSync as readFileSync16, writeFileSync as writeFileSync11 } from "node:fs";
137577
+ import { existsSync as existsSync13, mkdirSync as mkdirSync11, readFileSync as readFileSync17, writeFileSync as writeFileSync12 } from "node:fs";
137342
137578
  import { join as join14, resolve as resolve3 } from "node:path";
137343
137579
  async function runInit(options) {
137344
137580
  let projectId = options.projectId;
@@ -137463,13 +137699,13 @@ async function runInit(options) {
137463
137699
  }
137464
137700
  function ensurePrivateStateIgnored(root) {
137465
137701
  const path = join14(root, ".gitignore");
137466
- const existing = existsSync13(path) ? readFileSync16(path, "utf8") : "";
137702
+ const existing = existsSync13(path) ? readFileSync17(path, "utf8") : "";
137467
137703
  if (existing.split(/\r?\n/u).some((line) => line.trim() === ".neo/" || line.trim() === ".neo")) {
137468
137704
  return;
137469
137705
  }
137470
137706
  const prefix = existing.length === 0 || existing.endsWith("\n") ? existing : `${existing}
137471
137707
  `;
137472
- writeFileSync11(path, `${prefix}.neo/
137708
+ writeFileSync12(path, `${prefix}.neo/
137473
137709
  `, "utf8");
137474
137710
  }
137475
137711
  var init_init = __esm({
@@ -138873,7 +139109,7 @@ __export(script_exports, {
138873
139109
  readDocumentArrays: () => readDocumentArrays,
138874
139110
  runScript: () => runScript
138875
139111
  });
138876
- import { readFileSync as readFileSync17 } from "node:fs";
139112
+ import { readFileSync as readFileSync18 } from "node:fs";
138877
139113
  function readDocumentArrays(raw) {
138878
139114
  const arrayOf2 = (field) => {
138879
139115
  const value = raw[field];
@@ -139393,9 +139629,9 @@ function buildRootValue(document, lookups) {
139393
139629
  }
139394
139630
  function readSource(options, fallback) {
139395
139631
  if (options.source !== null) return options.source;
139396
- if (options.file !== null) return readFileSync17(options.file, "utf8");
139632
+ if (options.file !== null) return readFileSync18(options.file, "utf8");
139397
139633
  if (fallback !== void 0) return fallback;
139398
- const stdin = readFileSync17(0, "utf8");
139634
+ const stdin = readFileSync18(0, "utf8");
139399
139635
  if (stdin.trim().length === 0) {
139400
139636
  throw new Error(
139401
139637
  "Provide NeoScript source as an argument, --file, or stdin."
@@ -140444,7 +140680,7 @@ var init_registry2 = __esm({
140444
140680
  "schema-contract/registry.mjs"() {
140445
140681
  "use strict";
140446
140682
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
140447
- cliVersion: "0.58.0",
140683
+ cliVersion: "0.58.2",
140448
140684
  projectFileUploadBatchSize: 32,
140449
140685
  documentRecords: {
140450
140686
  member: {
@@ -141872,12 +142108,12 @@ import {
141872
142108
  existsSync as existsSync14,
141873
142109
  mkdirSync as mkdirSync12,
141874
142110
  readdirSync as readdirSync4,
141875
- readFileSync as readFileSync18,
142111
+ readFileSync as readFileSync19,
141876
142112
  realpathSync as realpathSync2,
141877
142113
  renameSync as renameSync7,
141878
142114
  rmSync as rmSync9,
141879
142115
  statSync as statSync2,
141880
- writeFileSync as writeFileSync12
142116
+ writeFileSync as writeFileSync13
141881
142117
  } from "node:fs";
141882
142118
  import {
141883
142119
  basename as basename3,
@@ -142091,7 +142327,7 @@ function preparedHookCandidate(workspace) {
142091
142327
  );
142092
142328
  }
142093
142329
  const parsed = JSON.parse(
142094
- readFileSync18(join15(directory, "candidate.json"), "utf8")
142330
+ readFileSync19(join15(directory, "candidate.json"), "utf8")
142095
142331
  );
142096
142332
  if (!isRecord10(parsed)) {
142097
142333
  throw new NeoTestPreparedCandidateError(
@@ -142161,7 +142397,7 @@ function testCandidateCachePath(workspace, inputFingerprint) {
142161
142397
  function cachedTestCandidate(workspace, inputFingerprint) {
142162
142398
  try {
142163
142399
  const candidatePath = testCandidateCachePath(workspace, inputFingerprint);
142164
- const parsed = JSON.parse(readFileSync18(candidatePath, "utf8"));
142400
+ const parsed = JSON.parse(readFileSync19(candidatePath, "utf8"));
142165
142401
  if (!isRecord10(parsed)) return null;
142166
142402
  if (parsed.version !== 1) return null;
142167
142403
  if (parsed.candidateRevision !== TEST_CANDIDATE_CACHE_REVISION) return null;
@@ -142172,7 +142408,7 @@ function cachedTestCandidate(workspace, inputFingerprint) {
142172
142408
  return null;
142173
142409
  }
142174
142410
  if (typeof parsed.documentSha256 !== "string") return null;
142175
- const documentJson = readFileSync18(
142411
+ const documentJson = readFileSync19(
142176
142412
  join15(dirname10(candidatePath), "document.json"),
142177
142413
  "utf8"
142178
142414
  );
@@ -142212,7 +142448,7 @@ function cacheTestCandidate(workspace, inputFingerprint, candidate) {
142212
142448
  function compileSpec(workspace, document, absolutePath, projectCompilationHash2) {
142213
142449
  const scriptDocument = readDocumentArrays(document);
142214
142450
  const path = relative8(workspace.root, absolutePath).split(sep8).join("/");
142215
- const source = readFileSync18(absolutePath, "utf8");
142451
+ const source = readFileSync19(absolutePath, "utf8");
142216
142452
  const sourceHash = createHash11("sha256").update(source).digest("hex");
142217
142453
  const artifactPath = join15(
142218
142454
  workspace.root,
@@ -142223,7 +142459,7 @@ function compileSpec(workspace, document, absolutePath, projectCompilationHash2)
142223
142459
  `${sourceHash}.json`
142224
142460
  );
142225
142461
  try {
142226
- const cached = JSON.parse(readFileSync18(artifactPath, "utf8"));
142462
+ const cached = JSON.parse(readFileSync19(artifactPath, "utf8"));
142227
142463
  if (isRecord10(cached) && cached.version === 1 && cached.compilerRevision === NEOSCRIPT_COMPILER_REVISION && cached.projectCompilationHash === projectCompilationHash2 && cached.sourceHash === sourceHash && isRecord10(cached.action) && typeof cached.artifactSha256 === "string" && createHash11("sha256").update(JSON.stringify(cached.action)).digest("hex") === cached.artifactSha256 && cached.action.compilerRevision === NEOSCRIPT_COMPILER_REVISION && Array.isArray(cached.action.parameters) && Array.isArray(cached.action.instructions) && isRecord10(cached.action.typeInfo)) {
142228
142464
  return {
142229
142465
  path,
@@ -143040,7 +143276,7 @@ async function executeRegisteredSpec(registered, document, selected, timeoutMs,
143040
143276
  function atomicWrite(path, content) {
143041
143277
  mkdirSync12(dirname10(path), { recursive: true });
143042
143278
  const temporary = `${path}.tmp-${String(process.pid)}-${randomUUID6()}`;
143043
- writeFileSync12(temporary, content, "utf8");
143279
+ writeFileSync13(temporary, content, "utf8");
143044
143280
  renameSync7(temporary, path);
143045
143281
  }
143046
143282
  function testBuildFiles(root) {
@@ -143586,7 +143822,7 @@ import {
143586
143822
  constants as fsConstants,
143587
143823
  accessSync,
143588
143824
  existsSync as existsSync15,
143589
- readFileSync as readFileSync19
143825
+ readFileSync as readFileSync20
143590
143826
  } from "node:fs";
143591
143827
  import { extname as extname2, isAbsolute as isAbsolute4, join as join16, relative as relative9, sep as sep9 } from "node:path";
143592
143828
  function inspectNeoDoctor(workspace) {
@@ -143671,7 +143907,7 @@ function inspectSourceContract(workspace) {
143671
143907
  );
143672
143908
  try {
143673
143909
  const inputs = files.map((file, index) => {
143674
- const text = readFileSync19(file, "utf8");
143910
+ const text = readFileSync20(file, "utf8");
143675
143911
  return {
143676
143912
  uri: relativeFiles[index],
143677
143913
  kind: requiredProjectSourceKindV4(relativeFiles[index], text),
@@ -143719,7 +143955,7 @@ function inspectExtensionContract(root) {
143719
143955
  };
143720
143956
  }
143721
143957
  try {
143722
- const value = JSON.parse(readFileSync19(cachePath, "utf8"));
143958
+ const value = JSON.parse(readFileSync20(cachePath, "utf8"));
143723
143959
  assertProjectSourceAnalysisV4(value);
143724
143960
  return {
143725
143961
  id: NEO_VSCODE_EXTENSION_ID,
@@ -144065,7 +144301,7 @@ __export(migrate_exports, {
144065
144301
  runMigrate: () => runMigrate
144066
144302
  });
144067
144303
  import { randomUUID as randomUUID7 } from "node:crypto";
144068
- import { existsSync as existsSync16, mkdirSync as mkdirSync13, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "node:fs";
144304
+ import { existsSync as existsSync16, mkdirSync as mkdirSync13, readFileSync as readFileSync21, writeFileSync as writeFileSync14 } from "node:fs";
144069
144305
  import { join as join17, relative as relative10 } from "node:path";
144070
144306
  async function runMigrate(workspace, subcommand, positional, targetRef, json, dependencies = {}) {
144071
144307
  if (subcommand === "new") {
@@ -144079,7 +144315,7 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
144079
144315
  mkdirSync13(migrationsDir, { recursive: true });
144080
144316
  let nextOrder = 1;
144081
144317
  for (const path of listProjectSourceFilesV4(workspace.root)) {
144082
- const source = readFileSync20(path, "utf8");
144318
+ const source = readFileSync21(path, "utf8");
144083
144319
  if (neoProjectSourceKind(path, source) !== "migration") continue;
144084
144320
  const migration = parseMigrationFile(
144085
144321
  source,
@@ -144102,7 +144338,7 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
144102
144338
  target === "project" ? "// Runs once with root context. Write the NeoScript action below." : `// Runs once per ${target} value; \`this\` is the instance.`,
144103
144339
  ""
144104
144340
  ].join("\n");
144105
- writeFileSync13(absolute, template, "utf8");
144341
+ writeFileSync14(absolute, template, "utf8");
144106
144342
  console.log(`Created ${relPath} \u2014 edit the action body, then "neo push".`);
144107
144343
  console.log("(The id is assigned at push, same as schema creates.)");
144108
144344
  return;
@@ -144977,8 +145213,8 @@ function collectClassInstances(document, targetClassId, memberById2, valueById,
144977
145213
  const schema = schemaClass2 !== void 0 && isObjectRecord2(schemaClass2.schema) ? schemaClass2.schema : {};
144978
145214
  const instanceValue = valueRecord.value;
144979
145215
  if (isObjectRecord2(instanceValue)) {
144980
- for (const [key, childValueId] of Object.entries(instanceValue)) {
144981
- walk(schema[key], childValueId);
145216
+ for (const [key, childValueId2] of Object.entries(instanceValue)) {
145217
+ walk(schema[key], childValueId2);
144982
145218
  }
144983
145219
  }
144984
145220
  return;
@@ -144986,8 +145222,8 @@ function collectClassInstances(document, targetClassId, memberById2, valueById,
144986
145222
  if (memberKind === 6) {
144987
145223
  const entries = valueRecord.value;
144988
145224
  if (Array.isArray(entries)) {
144989
- for (const childValueId of entries) {
144990
- walk(member.entryMemberId, childValueId);
145225
+ for (const childValueId2 of entries) {
145226
+ walk(member.entryMemberId, childValueId2);
144991
145227
  }
144992
145228
  }
144993
145229
  return;
@@ -144995,8 +145231,8 @@ function collectClassInstances(document, targetClassId, memberById2, valueById,
144995
145231
  if (memberKind === 5) {
144996
145232
  const entries = valueRecord.value;
144997
145233
  if (isObjectRecord2(entries)) {
144998
- for (const childValueId of Object.values(entries)) {
144999
- walk(member.entryMemberId, childValueId);
145234
+ for (const childValueId2 of Object.values(entries)) {
145235
+ walk(member.entryMemberId, childValueId2);
145000
145236
  }
145001
145237
  }
145002
145238
  }
@@ -146265,7 +146501,7 @@ __export(content_exports, {
146265
146501
  makeContentContext: () => makeContentContext,
146266
146502
  runLoc: () => runLoc
146267
146503
  });
146268
- import { readFileSync as readFileSync21 } from "node:fs";
146504
+ import { readFileSync as readFileSync22 } from "node:fs";
146269
146505
  import { randomUUID as randomUUID8 } from "node:crypto";
146270
146506
  function versionPath2(workspace, suffix) {
146271
146507
  return `/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/${suffix}`;
@@ -146273,9 +146509,9 @@ function versionPath2(workspace, suffix) {
146273
146509
  function readBatch(file) {
146274
146510
  let raw = null;
146275
146511
  if (file !== null) {
146276
- raw = readFileSync21(file, "utf8");
146512
+ raw = readFileSync22(file, "utf8");
146277
146513
  } else if (!process.stdin.isTTY) {
146278
- raw = readFileSync21(0, "utf8");
146514
+ raw = readFileSync22(0, "utf8");
146279
146515
  if (raw.trim().length === 0) raw = null;
146280
146516
  }
146281
146517
  if (raw === null) return null;
@@ -147012,10 +147248,10 @@ function dryrunOwnership(document, valueById, saveBindings = /* @__PURE__ */ new
147012
147248
  const childMemberByKey = new Map(
147013
147249
  storageResolver.mergedSchema(classId).map((entry) => [entry.schemaKey, entry.memberId])
147014
147250
  );
147015
- for (const [key, childValueId] of Object.entries(value.value)) {
147251
+ for (const [key, childValueId2] of Object.entries(value.value)) {
147016
147252
  const childMemberId = childMemberByKey.get(key);
147017
- if (childMemberId !== void 0 && typeof childValueId === "string") {
147018
- walkOwnedGraph([...memberPath3, childMemberId], childValueId);
147253
+ if (childMemberId !== void 0 && typeof childValueId2 === "string") {
147254
+ walkOwnedGraph([...memberPath3, childMemberId], childValueId2);
147019
147255
  }
147020
147256
  }
147021
147257
  return;
@@ -147024,9 +147260,9 @@ function dryrunOwnership(document, valueById, saveBindings = /* @__PURE__ */ new
147024
147260
  if (unorderedList && (Array.isArray(value.value) || includeHistoricalNullLists && membership.has(valueId))) {
147025
147261
  const entryMemberId = storageResolver.resolvedEntryMemberId(memberId);
147026
147262
  if (entryMemberId === void 0) return;
147027
- for (const childValueId of membership.get(valueId) ?? []) {
147028
- if (typeof childValueId === "string") {
147029
- walkOwnedGraph([...memberPath3, entryMemberId], childValueId);
147263
+ for (const childValueId2 of membership.get(valueId) ?? []) {
147264
+ if (typeof childValueId2 === "string") {
147265
+ walkOwnedGraph([...memberPath3, entryMemberId], childValueId2);
147030
147266
  }
147031
147267
  }
147032
147268
  return;
@@ -147035,9 +147271,9 @@ function dryrunOwnership(document, valueById, saveBindings = /* @__PURE__ */ new
147035
147271
  const entryMemberId = storageResolver.resolvedEntryMemberId(memberId);
147036
147272
  if (entryMemberId === void 0) return;
147037
147273
  const childIds = Array.isArray(value.value) ? value.value : Object.values(value.value);
147038
- for (const childValueId of childIds) {
147039
- if (typeof childValueId === "string") {
147040
- walkOwnedGraph([...memberPath3, entryMemberId], childValueId);
147274
+ for (const childValueId2 of childIds) {
147275
+ if (typeof childValueId2 === "string") {
147276
+ walkOwnedGraph([...memberPath3, entryMemberId], childValueId2);
147041
147277
  }
147042
147278
  }
147043
147279
  }
@@ -147523,9 +147759,9 @@ import { createHash as createHash12 } from "node:crypto";
147523
147759
  import {
147524
147760
  existsSync as existsSync17,
147525
147761
  mkdirSync as mkdirSync14,
147526
- readFileSync as readFileSync22,
147762
+ readFileSync as readFileSync23,
147527
147763
  unlinkSync,
147528
- writeFileSync as writeFileSync14
147764
+ writeFileSync as writeFileSync15
147529
147765
  } from "node:fs";
147530
147766
  import { dirname as dirname11, join as join18 } from "node:path";
147531
147767
  function validatePath(path) {
@@ -147536,7 +147772,7 @@ function validatePath(path) {
147536
147772
  }
147537
147773
  function readManifest(path) {
147538
147774
  if (!existsSync17(path)) return null;
147539
- const data = JSON.parse(readFileSync22(path, "utf8"));
147775
+ const data = JSON.parse(readFileSync23(path, "utf8"));
147540
147776
  if (data === null || typeof data !== "object" || !("schemaVersion" in data) || data.schemaVersion !== 1)
147541
147777
  throw new Error(`Invalid generated-file manifest version: ${path}`);
147542
147778
  if (!("files" in data) || !Array.isArray(data.files) || data.files.length === 0)
@@ -147616,7 +147852,7 @@ function writeUnityGeneratedFiles(directory, projectId, files) {
147616
147852
  const meta = join18(directory, old.path + ".meta");
147617
147853
  operations.push([
147618
147854
  path + ".meta",
147619
- existsSync17(meta) ? readFileSync22(meta, "utf8") : null
147855
+ existsSync17(meta) ? readFileSync23(meta, "utf8") : null
147620
147856
  ]);
147621
147857
  }
147622
147858
  operations.push([path, file.content]);
@@ -147643,7 +147879,7 @@ function writeUnityGeneratedFiles(directory, projectId, files) {
147643
147879
  if (!previous.has(key))
147644
147880
  previous.set(key, {
147645
147881
  path,
147646
- content: existsSync17(path) ? readFileSync22(path, "utf8") : null
147882
+ content: existsSync17(path) ? readFileSync23(path, "utf8") : null
147647
147883
  });
147648
147884
  }
147649
147885
  const write = (path, content) => {
@@ -147651,13 +147887,13 @@ function writeUnityGeneratedFiles(directory, projectId, files) {
147651
147887
  if (existsSync17(path)) unlinkSync(path);
147652
147888
  } else {
147653
147889
  mkdirSync14(dirname11(path), { recursive: true });
147654
- writeFileSync14(path, content);
147890
+ writeFileSync15(path, content);
147655
147891
  }
147656
147892
  };
147657
147893
  const changed = [];
147658
147894
  try {
147659
147895
  for (const [path, content] of operations) {
147660
- const current = existsSync17(path) ? readFileSync22(path, "utf8") : null;
147896
+ const current = existsSync17(path) ? readFileSync23(path, "utf8") : null;
147661
147897
  if (current === content) continue;
147662
147898
  changed.push(path);
147663
147899
  write(path, content);
@@ -147670,7 +147906,7 @@ function writeUnityGeneratedFiles(directory, projectId, files) {
147670
147906
  restored.add(key);
147671
147907
  const original = previous.get(key);
147672
147908
  if (original.path !== path && existsSync17(path)) unlinkSync(path);
147673
- const current = existsSync17(original.path) ? readFileSync22(original.path, "utf8") : null;
147909
+ const current = existsSync17(original.path) ? readFileSync23(original.path, "utf8") : null;
147674
147910
  if (current !== original.content) write(original.path, original.content);
147675
147911
  }
147676
147912
  throw error;
@@ -147687,7 +147923,7 @@ var export_exports = {};
147687
147923
  __export(export_exports, {
147688
147924
  runExportUnity: () => runExportUnity
147689
147925
  });
147690
- import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync15 } from "node:fs";
147926
+ import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync16 } from "node:fs";
147691
147927
  import { join as join19 } from "node:path";
147692
147928
  async function runExportUnity(workspace, outDir) {
147693
147929
  if (outDir === null) {
@@ -147710,9 +147946,9 @@ async function runExportUnity(workspace, outDir) {
147710
147946
  response.projectId,
147711
147947
  response.generatedFiles
147712
147948
  );
147713
- writeFileSync15(join19(resourcesDir, "project.json"), response.projectJson);
147949
+ writeFileSync16(join19(resourcesDir, "project.json"), response.projectJson);
147714
147950
  for (const file of response.localizationFiles ?? []) {
147715
- writeFileSync15(join19(localizationDir, file.fileName), file.content);
147951
+ writeFileSync16(join19(localizationDir, file.fileName), file.content);
147716
147952
  }
147717
147953
  console.log(`wrote ${join19(resourcesDir, "project.json")}`);
147718
147954
  console.log(`synchronized generated files in ${scriptsDir}`);
@@ -147911,7 +148147,7 @@ __export(resolve_exports, {
147911
148147
  resolveMarkers: () => resolveMarkers,
147912
148148
  runResolve: () => runResolve
147913
148149
  });
147914
- import { readFileSync as readFileSync23, rmSync as rmSync10, writeFileSync as writeFileSync16 } from "node:fs";
148150
+ import { readFileSync as readFileSync24, rmSync as rmSync10, writeFileSync as writeFileSync17 } from "node:fs";
147915
148151
  import { join as join21, relative as relative11 } from "node:path";
147916
148152
  function runResolve(workspace, side) {
147917
148153
  const marked = readMarkedProjectSourcesV4(workspace.root);
@@ -147922,7 +148158,7 @@ function runResolve(workspace, side) {
147922
148158
  const resolvedRecords = adoptServerConflictBases(workspace);
147923
148159
  let resolvedFiles = 0;
147924
148160
  for (const file of marked) {
147925
- writeFileSync16(file.absolutePath, resolveMarkers(file.source, side), "utf8");
148161
+ writeFileSync17(file.absolutePath, resolveMarkers(file.source, side), "utf8");
147926
148162
  resolvedFiles += 1;
147927
148163
  }
147928
148164
  let resolvedBinaries = 0;
@@ -147935,7 +148171,7 @@ function runResolve(workspace, side) {
147935
148171
  if (conflict2.remoteSha256 !== null && conflict2.artifactPath !== void 0) {
147936
148172
  writeVerifiedBinaryDownloadV4(
147937
148173
  destination,
147938
- readFileSync23(join21(workspace.root, conflict2.artifactPath)),
148174
+ readFileSync24(join21(workspace.root, conflict2.artifactPath)),
147939
148175
  conflict2.remoteSha256
147940
148176
  );
147941
148177
  binary.sha256 = conflict2.remoteSha256;
@@ -147964,7 +148200,7 @@ function runResolve(workspace, side) {
147964
148200
  function readMarkedProjectSourcesV4(root) {
147965
148201
  const files = [];
147966
148202
  for (const absolutePath of listProjectSourceFilesV4(root)) {
147967
- const source = readFileSync23(absolutePath, "utf8");
148203
+ const source = readFileSync24(absolutePath, "utf8");
147968
148204
  if (detectConflictMarkers(source) === null) continue;
147969
148205
  files.push({
147970
148206
  path: normalizeWorkspaceSourcePath(relative11(root, absolutePath)),
@@ -148265,7 +148501,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
148265
148501
  async function main() {
148266
148502
  const args = parseArgs(process.argv.slice(2));
148267
148503
  if (args.command === "--version") {
148268
- console.log("0.58.0");
148504
+ console.log("0.58.2");
148269
148505
  return;
148270
148506
  }
148271
148507
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {