@neocompose/cli 0.81.1 → 0.81.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.
@@ -2339,6 +2339,16 @@ function neoScriptRegistryEntryType(typeName) {
2339
2339
  }
2340
2340
  return REGISTRY_ENTRY_TYPES[typeName] ?? null;
2341
2341
  }
2342
+ function typeArgumentArityMessage(typeName, expected, provided) {
2343
+ return `Type '${typeName}' expects ${expected} type argument${expected === 1 ? "" : "s"}, but ${provided} ${provided === 1 ? "was" : "were"} provided.`;
2344
+ }
2345
+ function genericParameterArgumentsMessage(name) {
2346
+ return `Generic parameter '${name}' cannot receive type arguments.`;
2347
+ }
2348
+ var NEOSCRIPT_DELEGATE_MAX_PARAMETERS = 16;
2349
+ function delegateArityMessage(provided) {
2350
+ return `Type 'NeoDelegate' expects a return type followed by up to ${NEOSCRIPT_DELEGATE_MAX_PARAMETERS} parameter types, but ${provided} type arguments were provided.`;
2351
+ }
2342
2352
  function neoScriptRegistryReferenceType(entryTypeName) {
2343
2353
  for (const definition of Object.values(REGISTRY_ENTRY_TYPES)) {
2344
2354
  if (definition.entryType === entryTypeName) return definition.refType;
@@ -20010,15 +20020,9 @@ function evalActionListenerInstruction(ins, scope, ctx, options) {
20010
20020
  }
20011
20021
  let destination;
20012
20022
  const target = ins.target.pointer;
20013
- const currentValue = target.type === "keyOf" /* keyOf */ ? evalKeyOf(
20014
- target.keyOf,
20015
- scope,
20016
- ctx,
20017
- target.optional === true,
20018
- (resolved) => {
20019
- destination = resolved;
20020
- }
20021
- ) : evalPointer(target, scope, ctx);
20023
+ const currentValue = target.type === "keyOf" /* keyOf */ ? evalKeyOf(target, scope, ctx, (resolved) => {
20024
+ destination = resolved;
20025
+ }) : evalPointer(target, scope, ctx);
20022
20026
  const current = actionListenersOf(currentValue, () => `'${operator}' target`);
20023
20027
  const identity = nsActionListenerIdentity(listener);
20024
20028
  const present = current.some(
@@ -20089,38 +20093,26 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
20089
20093
  );
20090
20094
  }
20091
20095
  receiver[index] = referenceValueId;
20092
- setCollectionReferenceProvenance(receiver, index, true, ctx);
20096
+ recordWrittenEntry(receiver, index, true, ctx);
20093
20097
  invalidateEvaluatorIndexes(ctx, receiver);
20094
20098
  return;
20095
20099
  }
20096
- if (ctx.__unorderedListProjections?.referenceEntryIndexesByArray.has(
20097
- receiver
20098
- ) === true) {
20099
- receiver[index] = value;
20100
- setCollectionReferenceProvenance(receiver, index, false, ctx);
20101
- invalidateEvaluatorIndexes(ctx, receiver);
20100
+ if (collectionReferences(receiver, ctx) === 0 /* RowIds */ && replaceEntryRowValue(
20101
+ receiver,
20102
+ receiver[index],
20103
+ value,
20104
+ targetTypeInfo,
20105
+ ctx
20106
+ ))
20102
20107
  return;
20103
- }
20104
- const existing2 = receiver[index];
20105
- if (typeof existing2 === "string") {
20106
- const row = evalValueById(
20107
- ctx,
20108
- existing2,
20109
- ctx.__runtimeSessionValues,
20110
- ctx.__valueOverlay
20111
- );
20112
- if (row !== null) {
20113
- replaceRowValue(row, value, receiver, ctx);
20114
- updateUnorderedListProjectionAfterAssignment(row, value, ctx);
20115
- return;
20116
- }
20117
- }
20118
20108
  receiver[index] = value;
20109
+ recordWrittenEntry(receiver, index, false, ctx);
20119
20110
  invalidateEvaluatorIndexes(ctx, receiver);
20120
20111
  return;
20121
20112
  }
20122
20113
  const object = objectArg(receiver, "Assignment target");
20123
20114
  const stringKey = String(key);
20115
+ const field = target.memberId !== void 0;
20124
20116
  if (referenceValueId !== null) {
20125
20117
  const parentId = findKnownRowIdByValueReference(receiver, ctx);
20126
20118
  if (parentId !== null) {
@@ -20135,26 +20127,41 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
20135
20127
  );
20136
20128
  }
20137
20129
  object[stringKey] = referenceValueId;
20130
+ if (!field) recordWrittenEntry(object, stringKey, true, ctx);
20138
20131
  invalidateEvaluatorIndexes(ctx, receiver);
20139
20132
  return;
20140
20133
  }
20141
- const existing = object[stringKey];
20142
- if (typeof existing === "string") {
20143
- const row = evalValueById(
20144
- ctx,
20145
- existing,
20146
- ctx.__runtimeSessionValues,
20147
- ctx.__valueOverlay
20148
- );
20149
- if (row !== null) {
20150
- replaceRowValue(row, value, receiver, ctx);
20151
- updateUnorderedListProjectionAfterAssignment(row, value, ctx);
20152
- return;
20153
- }
20154
- }
20134
+ if (collectionReferences(object, ctx) === 0 /* RowIds */ && replaceEntryRowValue(object, object[stringKey], value, targetTypeInfo, ctx))
20135
+ return;
20155
20136
  object[stringKey] = value;
20137
+ if (!field) recordWrittenEntry(object, stringKey, false, ctx);
20156
20138
  invalidateEvaluatorIndexes(ctx, receiver);
20157
20139
  }
20140
+ function replaceEntryRowValue(receiver, existing, value, targetTypeInfo, ctx) {
20141
+ if (typeof existing !== "string") return false;
20142
+ const row = evalValueById(
20143
+ ctx,
20144
+ existing,
20145
+ ctx.__runtimeSessionValues,
20146
+ ctx.__valueOverlay
20147
+ );
20148
+ if (row === null) return false;
20149
+ keepAssignedCollectionValues(value, targetTypeInfo, ctx);
20150
+ replaceRowValue(row, value, receiver, ctx);
20151
+ updateUnorderedListProjectionAfterAssignment(row, value, ctx);
20152
+ return true;
20153
+ }
20154
+ function keepAssignedCollectionValues(value, targetTypeInfo, ctx) {
20155
+ const cache = unorderedListProjectionCache(ctx);
20156
+ if (Array.isArray(value) && (targetTypeInfo.type === 6 /* List */ || targetTypeInfo.type === 28 /* Set */)) {
20157
+ if (!cache.referenceEntryIndexesByArray.has(value))
20158
+ cache.referenceEntryIndexesByArray.set(value, /* @__PURE__ */ new Set());
20159
+ return;
20160
+ }
20161
+ if (targetTypeInfo.type === 5 /* Dictionary */ && typeof value === "object" && value !== null && !cache.referenceEntryKeysByRecord.has(value)) {
20162
+ cache.referenceEntryKeysByRecord.set(value, /* @__PURE__ */ new Set());
20163
+ }
20164
+ }
20158
20165
  function replaceRowValue(row, value, receiver, ctx) {
20159
20166
  const indexes3 = ctx.__indexes;
20160
20167
  if (indexes3 === void 0 || ctx.__runtimeSessionValues?.get(row.id) !== row || !indexes3.indexedRowIds.has(row.id)) {
@@ -20592,9 +20599,11 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
20592
20599
  );
20593
20600
  }
20594
20601
  const unorderedEntriesBeforeMutation = unorderedContainerValueId === null || !Array.isArray(targetValue) || ins.mutation === "Add" /* Add */ ? null : [...targetValue];
20595
- if ((ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && !isLookupSet) {
20602
+ const writesEntry = (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && !isLookupSet;
20603
+ let attachedValueId = null;
20604
+ if (writesEntry) {
20596
20605
  const attachedValue = isArrayCollection(targetValue) && ins.mutation !== "Insert" /* Insert */ ? args[0] : args[1];
20597
- const attachedValueId = findKnownRowIdByValueReference(attachedValue, ctx);
20606
+ attachedValueId = findKnownRowIdByValueReference(attachedValue, ctx);
20598
20607
  const parentId = findKnownRowIdByValueReference(targetValue, ctx);
20599
20608
  if (attachedValueId !== null && parentId !== null) {
20600
20609
  ctx.assertCollectionEntryAttachable?.(
@@ -20631,6 +20640,23 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
20631
20640
  removedIndex,
20632
20641
  ctx
20633
20642
  );
20643
+ if (writesEntry && !(targetValue instanceof RuntimeSet)) {
20644
+ const writtenAsRowId = attachedValueId !== null || unorderedContainerValueId !== null;
20645
+ if (Array.isArray(targetValue))
20646
+ recordWrittenEntry(
20647
+ targetValue,
20648
+ removedIndex ?? targetValue.length - 1,
20649
+ writtenAsRowId,
20650
+ ctx
20651
+ );
20652
+ else
20653
+ recordWrittenEntry(
20654
+ objectArg(targetValue, "Dictionary Add target"),
20655
+ String(args[0]),
20656
+ writtenAsRowId,
20657
+ ctx
20658
+ );
20659
+ }
20634
20660
  if (unorderedEntriesBeforeMutation !== null && Array.isArray(targetValue)) {
20635
20661
  detachRemovedUnorderedScalarEntries(
20636
20662
  unorderedEntriesBeforeMutation,
@@ -20832,9 +20858,10 @@ function runtimeSet(array2, reference, enumEntries, ctx) {
20832
20858
  const existing = sets.get(array2);
20833
20859
  if (existing !== void 0) return existing;
20834
20860
  const set = new RuntimeSet(array2, reference, enumEntries);
20861
+ const references = collectionReferences(array2, ctx);
20835
20862
  for (let index = 0; index < array2.length; index++) {
20836
20863
  const raw = array2[index];
20837
- const resolves = collectionEntryUsesReferenceResolution(array2, index, ctx);
20864
+ const resolves = isReferenceEntry(references, index);
20838
20865
  const value = resolves ? resolveValueIfId(raw, ctx) : raw;
20839
20866
  const key = runtimeSetKey(value, set, ctx);
20840
20867
  set.add(key, enumEntries ? key : raw, !enumEntries && resolves);
@@ -20843,9 +20870,9 @@ function runtimeSet(array2, reference, enumEntries, ctx) {
20843
20870
  (ctx.__dirtyRuntimeSets ??= /* @__PURE__ */ new Set()).add(set);
20844
20871
  return set;
20845
20872
  }
20846
- function storedSetEntryMatch(raw, entryMember, ctx) {
20873
+ function storedSetEntryMatch(raw, reference, entryMember, ctx) {
20847
20874
  const byIdentity = entryMember.kind === 7 /* Class */;
20848
- const row = byIdentity || typeof raw !== "string" ? null : evalValueById(ctx, raw, ctx.__runtimeSessionValues, ctx.__valueOverlay);
20875
+ const row = byIdentity || !reference || typeof raw !== "string" ? null : evalValueById(ctx, raw, ctx.__runtimeSessionValues, ctx.__valueOverlay);
20849
20876
  const valueId = byIdentity && typeof raw === "string" ? raw : row?.id ?? null;
20850
20877
  const entry = row === null ? { id: "", value: raw } : { id: row.id, value: row.value };
20851
20878
  const key = byIdentity ? valueId ?? referenceIdOf(raw, ctx) : setEntryKey(entryMember, entry);
@@ -20856,8 +20883,14 @@ function storedSetEntries(set, entryMember, ctx) {
20856
20883
  const existing = indexes3.get(set);
20857
20884
  if (existing !== void 0) return existing;
20858
20885
  const entries = /* @__PURE__ */ new Map();
20859
- for (const raw of set) {
20860
- const match = storedSetEntryMatch(raw, entryMember, ctx);
20886
+ const references = collectionReferences(set, ctx);
20887
+ for (let index = 0; index < set.length; index++) {
20888
+ const match = storedSetEntryMatch(
20889
+ set[index],
20890
+ isReferenceEntry(references, index),
20891
+ entryMember,
20892
+ ctx
20893
+ );
20861
20894
  if (match !== null && !entries.has(match.key)) {
20862
20895
  entries.set(match.key, match);
20863
20896
  }
@@ -20869,7 +20902,13 @@ function syncStoredSetEntries(set, mutation, removed, entryMember, ctx) {
20869
20902
  const entries = ctx.__setEntryIndexes?.get(set);
20870
20903
  if (entries === void 0) return;
20871
20904
  if (entryMember !== null && mutation === "Add" /* Add */) {
20872
- const added = storedSetEntryMatch(set[set.length - 1], entryMember, ctx);
20905
+ const index = set.length - 1;
20906
+ const added = storedSetEntryMatch(
20907
+ set[index],
20908
+ isReferenceEntry(collectionReferences(set, ctx), index),
20909
+ entryMember,
20910
+ ctx
20911
+ );
20873
20912
  if (added !== null) entries.set(added.key, added);
20874
20913
  return;
20875
20914
  }
@@ -20935,6 +20974,7 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
20935
20974
  return null;
20936
20975
  case "Remove" /* Remove */:
20937
20976
  if (Array.isArray(targetValue)) {
20977
+ const references = resolveRemovalEntries ? collectionReferences(targetValue, ctx) : recordedReferenceEntries(targetValue, ctx) ?? 1 /* Values */;
20938
20978
  let index = -1;
20939
20979
  for (let candidate = 0; candidate < targetValue.length; candidate += 1) {
20940
20980
  const entry = targetValue[candidate];
@@ -20945,9 +20985,8 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
20945
20985
  }
20946
20986
  continue;
20947
20987
  }
20948
- const referenceEntry = ctx.__unorderedListProjections?.referenceEntryIndexesByArray.get(targetValue)?.has(candidate) === true;
20949
20988
  if (jsEqual(
20950
- resolveRemovalEntries || referenceEntry ? resolveCollectionEntry(targetValue, entry, candidate, ctx) : entry,
20989
+ typeof entry === "string" && isReferenceEntry(references, candidate) ? resolveValueIfId(entry, ctx) : entry,
20951
20990
  args[0]
20952
20991
  )) {
20953
20992
  index = candidate;
@@ -20980,13 +21019,6 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
20980
21019
  return null;
20981
21020
  }
20982
21021
  }
20983
- function setCollectionReferenceProvenance(targetValue, index, reference, ctx) {
20984
- const cache = ctx.__unorderedListProjections;
20985
- const indexes3 = cache?.referenceEntryIndexesByArray.get(targetValue);
20986
- if (cache === void 0 || indexes3 === void 0) return;
20987
- if (reference) indexes3.add(index);
20988
- else indexes3.delete(index);
20989
- }
20990
21022
  function updateCollectionReferenceProvenance(targetValue, mutation, removedIndex, ctx) {
20991
21023
  if (!Array.isArray(targetValue)) return;
20992
21024
  const cache = ctx.__unorderedListProjections;
@@ -21260,7 +21292,7 @@ function evalPointerCore(pointer, scope, ctx, resultUsage = "value") {
21260
21292
  case "staticMember" /* staticMember */:
21261
21293
  return evalStaticMember(pointer.memberId, ctx);
21262
21294
  case "keyOf" /* keyOf */:
21263
- return evalKeyOf(pointer.keyOf, scope, ctx, pointer.optional === true);
21295
+ return evalKeyOf(pointer, scope, ctx);
21264
21296
  case "operation" /* operation */:
21265
21297
  return evalOperation(pointer.operation, scope, ctx);
21266
21298
  case "function" /* function */:
@@ -21910,15 +21942,9 @@ function readActionWithOwner(pointer, scope, ctx) {
21910
21942
  return { action: evalPointer(pointer, scope, ctx), owner: null };
21911
21943
  }
21912
21944
  let owner = null;
21913
- const action = evalKeyOf(
21914
- pointer.keyOf,
21915
- scope,
21916
- ctx,
21917
- pointer.optional === true,
21918
- (destination) => {
21919
- owner = destination.receiver;
21920
- }
21921
- );
21945
+ const action = evalKeyOf(pointer, scope, ctx, (destination) => {
21946
+ owner = destination.receiver;
21947
+ });
21922
21948
  return { action, owner };
21923
21949
  }
21924
21950
  function actionPointerLabel(pointer, ctx) {
@@ -22836,7 +22862,9 @@ function isRuntimeSpriteValue(value) {
22836
22862
  const sliceIndex = value.sliceIndex;
22837
22863
  return typeof sliceIndex === "number" && Number.isInteger(sliceIndex) && sliceIndex >= 0;
22838
22864
  }
22839
- function evalKeyOf(keyOf, scope, ctx, optional2 = false, onDestination) {
22865
+ function evalKeyOf(pointer, scope, ctx, onDestination) {
22866
+ const { keyOf } = pointer;
22867
+ const optional2 = pointer.optional === true;
22840
22868
  const receiver = evalPointer(keyOf.pointer, scope, ctx);
22841
22869
  if (optional2 && (receiver === null || receiver === void 0)) {
22842
22870
  return null;
@@ -22897,7 +22925,7 @@ function evalKeyOf(keyOf, scope, ctx, optional2 = false, onDestination) {
22897
22925
  if (dispatched.kind === "ok") return dispatched.value;
22898
22926
  if (Object.prototype.hasOwnProperty.call(receiver, k)) {
22899
22927
  const at2 = receiver[k];
22900
- return resolveValueIfId(at2, ctx);
22928
+ return typeof at2 === "string" && (pointer.memberId !== void 0 || isReferenceEntry(collectionReferences(receiver, ctx), k)) ? resolveValueIfId(at2, ctx) : at2;
22901
22929
  }
22902
22930
  const expanded = virtualExpandedRecordForReceiver(receiver, ctx);
22903
22931
  if (expanded !== null && Object.prototype.hasOwnProperty.call(expanded, k)) {
@@ -23630,7 +23658,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
23630
23658
  shift,
23631
23659
  accepts
23632
23660
  );
23633
- return { handled: true, value };
23661
+ return { handled: true, value: referenceEntryList(value, ctx) };
23634
23662
  }
23635
23663
  if (memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetTiles) {
23636
23664
  const value = index.tiles(
@@ -23640,7 +23668,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
23640
23668
  shift,
23641
23669
  accepts
23642
23670
  );
23643
- return { handled: true, value };
23671
+ return { handled: true, value: referenceEntryList(value, ctx) };
23644
23672
  }
23645
23673
  const tile = index.tile(
23646
23674
  placement,
@@ -24262,7 +24290,17 @@ function evalDeclaredListIndex(info, scope, ctx) {
24262
24290
  collectionIndexes.set(cacheKey, index);
24263
24291
  }
24264
24292
  if (info.keyPointer === void 0) {
24265
- return Object.fromEntries(index);
24293
+ const view = Object.fromEntries(index);
24294
+ if (info.unique) {
24295
+ unorderedListProjectionCache(ctx).referenceEntryKeysByRecord.set(
24296
+ view,
24297
+ new Set(index.keys())
24298
+ );
24299
+ } else {
24300
+ for (const bucket of index.values())
24301
+ if (Array.isArray(bucket)) referenceEntryList(bucket, ctx);
24302
+ }
24303
+ return view;
24266
24304
  }
24267
24305
  const key = evalPointer(info.keyPointer, scope, ctx);
24268
24306
  if (typeof key !== "string") {
@@ -24274,7 +24312,12 @@ function evalDeclaredListIndex(info, scope, ctx) {
24274
24312
  if (info.unique) {
24275
24313
  return typeof hit === "string" ? resolveValueIfId(hit, ctx) : null;
24276
24314
  }
24277
- return Array.isArray(hit) ? [...hit] : [];
24315
+ return referenceEntryList(Array.isArray(hit) ? [...hit] : [], ctx);
24316
+ }
24317
+ function referenceEntryList(list, ctx) {
24318
+ const indexes3 = unorderedListProjectionCache(ctx).referenceEntryIndexesByArray;
24319
+ if (!indexes3.has(list)) indexes3.set(list, new Set(list.keys()));
24320
+ return list;
24278
24321
  }
24279
24322
  function prepareCollectionCallback(callback, parentScope, ctx, isList, returnContract, onPredicateMatch) {
24280
24323
  const metrics = ctx.__collectionCallbackPreparationMetrics;
@@ -24838,7 +24881,7 @@ function evalFunction(fn, scope, ctx) {
24838
24881
  if (fn.info.reference === true) {
24839
24882
  return referenceIndexOf(c, target, ctx) !== null;
24840
24883
  }
24841
- const targetReferenceId = typeof target === "string" ? target : findKnownRowIdByValueReference(target, ctx);
24884
+ const targetReferenceId = typeof target === "string" ? null : findKnownRowIdByValueReference(target, ctx);
24842
24885
  let containsResolvedEntry = false;
24843
24886
  iterateCollection(c, ctx, (entry, _key, valueId) => {
24844
24887
  if (valueId !== null && valueId === targetReferenceId || jsEqual(entry, target)) {
@@ -24859,7 +24902,7 @@ function evalFunction(fn, scope, ctx) {
24859
24902
  const index = referenceIndexOf(collection, target, ctx);
24860
24903
  return index === null ? -1 : numberArg(index, "IndexOf index");
24861
24904
  }
24862
- const targetReferenceId = typeof target === "string" ? target : findKnownRowIdByValueReference(target, ctx);
24905
+ const targetReferenceId = typeof target === "string" ? null : findKnownRowIdByValueReference(target, ctx);
24863
24906
  let found = -1;
24864
24907
  iterateCollection(collection, ctx, (entry, key, valueId) => {
24865
24908
  if (valueId !== null && valueId === targetReferenceId || jsEqual(entry, target)) {
@@ -26002,6 +26045,8 @@ function evaluateDeclaredConstructorArguments(info, record4, scope, ctx) {
26002
26045
  );
26003
26046
  }
26004
26047
  const value = byName.get(parameter3.name);
26048
+ if (parameter3.type === 9 /* Lookup */ && Array.isArray(value))
26049
+ return referenceEntryList(value, ctx);
26005
26050
  if (typeof value !== "number") return value;
26006
26051
  if (parameter3.type === 4 /* Float */) return Math.fround(value);
26007
26052
  if (parameter3.type !== 20 /* Decimal */) return value;
@@ -28956,14 +29001,10 @@ function collectionLength(c) {
28956
29001
  }
28957
29002
  function snapshotCollectionMembership(collection, ctx) {
28958
29003
  const membership = [];
28959
- const valid = forEachRawCollectionEntry(collection, (entry) => {
29004
+ const valid = forEachRawCollectionEntry(collection, ctx, (entry) => {
28960
29005
  membership.push({
28961
29006
  raw: entry.raw,
28962
- resolveAsReference: collectionEntryUsesReferenceResolution(
28963
- collection,
28964
- entry.key,
28965
- ctx
28966
- )
29007
+ resolveAsReference: entry.valueId !== null
28967
29008
  });
28968
29009
  return 0 /* Continue */;
28969
29010
  });
@@ -28972,7 +29013,7 @@ function snapshotCollectionMembership(collection, ctx) {
28972
29013
  "NeoScript foreach requires a present collection."
28973
29014
  );
28974
29015
  }
28975
- function forEachRawCollectionEntry(c, callback) {
29016
+ function forEachRawCollectionEntry(c, ctx, callback) {
28976
29017
  if (c instanceof RuntimeSet) {
28977
29018
  for (const [key, entry] of c.membership().entries()) {
28978
29019
  if (callback({
@@ -28984,35 +29025,34 @@ function forEachRawCollectionEntry(c, callback) {
28984
29025
  }
28985
29026
  return true;
28986
29027
  }
29028
+ if (typeof c !== "object" || c === null) return false;
29029
+ const references = collectionReferences(c, ctx);
28987
29030
  if (Array.isArray(c)) {
28988
29031
  for (let key = 0; key < c.length; key += 1) {
28989
29032
  const raw = c[key];
28990
29033
  const control = callback({
28991
29034
  raw,
28992
29035
  key,
28993
- valueId: typeof raw === "string" ? raw : null
29036
+ valueId: typeof raw === "string" && isReferenceEntry(references, key) ? raw : null
28994
29037
  });
28995
29038
  if (control === 1 /* Break */) break;
28996
29039
  }
28997
29040
  return true;
28998
29041
  }
28999
- if (typeof c === "object" && c !== null) {
29000
- for (const [key, raw] of Object.entries(c)) {
29001
- const control = callback({
29002
- raw,
29003
- key,
29004
- valueId: typeof raw === "string" ? raw : null
29005
- });
29006
- if (control === 1 /* Break */) break;
29007
- }
29008
- return true;
29042
+ for (const [key, raw] of Object.entries(c)) {
29043
+ const control = callback({
29044
+ raw,
29045
+ key,
29046
+ valueId: typeof raw === "string" && isReferenceEntry(references, key) ? raw : null
29047
+ });
29048
+ if (control === 1 /* Break */) break;
29009
29049
  }
29010
- return false;
29050
+ return true;
29011
29051
  }
29012
29052
  function collectionEntries(c, ctx) {
29013
29053
  const entries = [];
29014
- forEachRawCollectionEntry(c, ({ raw, key }) => {
29015
- entries.push(resolveCollectionEntry(c, raw, key, ctx));
29054
+ forEachRawCollectionEntry(c, ctx, ({ raw, valueId }) => {
29055
+ entries.push(valueId === null ? raw : resolveValueIfId(valueId, ctx));
29016
29056
  return 0 /* Continue */;
29017
29057
  });
29018
29058
  return entries;
@@ -29020,7 +29060,7 @@ function collectionEntries(c, ctx) {
29020
29060
  function referenceIndexOf(c, target, ctx) {
29021
29061
  const targetId = target === null || target === void 0 ? null : referenceIdOf(target, ctx);
29022
29062
  let found = null;
29023
- forEachRawCollectionEntry(c, ({ raw, key }) => {
29063
+ forEachRawCollectionEntry(c, ctx, ({ raw, key }) => {
29024
29064
  if (raw === target || targetId !== null && raw !== null && raw !== void 0 && referenceIdOf(raw, ctx) === targetId) {
29025
29065
  found = key;
29026
29066
  return 1 /* Break */;
@@ -29030,26 +29070,61 @@ function referenceIndexOf(c, target, ctx) {
29030
29070
  return found;
29031
29071
  }
29032
29072
  function iterateCollection(c, ctx, callback) {
29033
- forEachRawCollectionEntry(c, ({ raw, key, valueId }) => {
29034
- const effectiveValueId = collectionEntryUsesReferenceResolution(c, key, ctx) ? valueId : null;
29035
- return callback(
29036
- resolveCollectionEntry(c, raw, key, ctx),
29073
+ forEachRawCollectionEntry(
29074
+ c,
29075
+ ctx,
29076
+ ({ raw, key, valueId }) => callback(
29077
+ valueId === null ? raw : resolveValueIfId(valueId, ctx),
29037
29078
  key,
29038
- effectiveValueId
29039
- );
29040
- });
29079
+ valueId
29080
+ )
29081
+ );
29041
29082
  }
29042
29083
  function resolveCollectionEntry(collection, raw, key, ctx) {
29043
- return collectionEntryUsesReferenceResolution(collection, key, ctx) ? resolveValueIfId(raw, ctx) : raw;
29084
+ return typeof raw === "string" && isReferenceEntry(collectionReferences(collection, ctx), key) ? resolveValueIfId(raw, ctx) : raw;
29044
29085
  }
29045
- function collectionEntryUsesReferenceResolution(collection, key, ctx) {
29046
- if (collection instanceof RuntimeSet && typeof key === "number")
29047
- return collection.membership()[key]?.reference === true;
29048
- if (!Array.isArray(collection) || typeof key !== "number") return true;
29049
- const referenceIndexes = ctx.__unorderedListProjections?.referenceEntryIndexesByArray.get(
29050
- collection
29051
- );
29052
- return referenceIndexes === void 0 || referenceIndexes.has(key);
29086
+ function recordedReferenceEntries(collection, ctx) {
29087
+ const cache = ctx.__unorderedListProjections;
29088
+ if (Array.isArray(collection))
29089
+ return cache?.referenceEntryIndexesByArray.get(collection);
29090
+ if (typeof collection === "object" && collection !== null)
29091
+ return cache?.referenceEntryKeysByRecord.get(collection);
29092
+ return void 0;
29093
+ }
29094
+ function collectionReferences(collection, ctx) {
29095
+ return recordedReferenceEntries(collection, ctx) ?? (findKnownRowIdByValueReference(collection, ctx) === null ? 1 /* Values */ : 0 /* RowIds */);
29096
+ }
29097
+ function isReferenceEntry(references, key) {
29098
+ if (references === 0 /* RowIds */) return true;
29099
+ if (references === 1 /* Values */) return false;
29100
+ return references.has(key);
29101
+ }
29102
+ function recordWrittenEntry(collection, key, reference, ctx) {
29103
+ const references = collectionReferences(collection, ctx);
29104
+ if (typeof references !== "object") {
29105
+ if (reference === (references === 0 /* RowIds */)) return;
29106
+ const written = Array.isArray(collection) ? collection[Number(key)] : collection[String(key)];
29107
+ if (!reference && typeof written !== "string") return;
29108
+ }
29109
+ const rowIds = references === 0 /* RowIds */;
29110
+ const cache = unorderedListProjectionCache(ctx);
29111
+ if (Array.isArray(collection)) {
29112
+ let indexes3 = cache.referenceEntryIndexesByArray.get(collection);
29113
+ if (indexes3 === void 0) {
29114
+ indexes3 = new Set(rowIds ? collection.keys() : []);
29115
+ cache.referenceEntryIndexesByArray.set(collection, indexes3);
29116
+ }
29117
+ if (reference) indexes3.add(Number(key));
29118
+ else indexes3.delete(Number(key));
29119
+ return;
29120
+ }
29121
+ let keys = cache.referenceEntryKeysByRecord.get(collection);
29122
+ if (keys === void 0) {
29123
+ keys = new Set(rowIds ? Object.keys(collection) : []);
29124
+ cache.referenceEntryKeysByRecord.set(collection, keys);
29125
+ }
29126
+ if (reference) keys.add(String(key));
29127
+ else keys.delete(String(key));
29053
29128
  }
29054
29129
 
29055
29130
  // ../packages/neoscript-runtime/src/declaration-default-source.ts
@@ -43110,13 +43185,12 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
43110
43185
  const typeArguments = expression.typeArguments?.map(
43111
43186
  (argument2) => this.resolveType(argument2)
43112
43187
  );
43113
- if (typeArguments !== void 0 && typeArguments.length !== (schemaClass2.typeParameters?.length ?? 0)) {
43114
- throw new CompileError(
43115
- `Class '${schemaClass2.name}' expects ${schemaClass2.typeParameters?.length ?? 0} type argument${schemaClass2.typeParameters?.length === 1 ? "" : "s"} but got ${typeArguments.length}.`,
43188
+ if (typeArguments !== void 0) {
43189
+ assertTypeArgumentCount(
43190
+ schemaClass2,
43191
+ typeArguments.length,
43116
43192
  expression.pos
43117
43193
  );
43118
- }
43119
- if (typeArguments !== void 0) {
43120
43194
  const target = {
43121
43195
  kind: "named",
43122
43196
  typeId: schemaClass2.id,
@@ -47443,21 +47517,34 @@ function resolveNeoScriptType(type, context, project) {
47443
47517
  const declaringType = declaringTypeRef?.kind === "named" ? project.typeById.get(declaringTypeRef.typeId) : void 0;
47444
47518
  const byName = (candidate) => candidate.name === type.name;
47445
47519
  const typeParameter2 = context.typeParameters?.find(byName) ?? declaringType?.typeParameters?.find(byName);
47520
+ const written = type.typeArguments?.length ?? 0;
47446
47521
  if (typeParameter2?.type.kind === "typeParameter") {
47522
+ if (written > 0)
47523
+ throw new CompileError(
47524
+ genericParameterArgumentsMessage(type.name),
47525
+ type.pos
47526
+ );
47447
47527
  resolved = typeParameter2.type;
47448
47528
  break;
47449
47529
  }
47450
47530
  const builtin = namedPrimitive(type.name);
47531
+ const registryReference = builtin ? null : neoScriptRegistryReferenceType(type.name);
47532
+ if ((builtin || registryReference) && written > 0)
47533
+ throw new CompileError(
47534
+ typeArgumentArityMessage(type.name, 0, written),
47535
+ type.pos
47536
+ );
47451
47537
  if (builtin) {
47452
47538
  resolved = { kind: "primitive", name: builtin };
47453
47539
  break;
47454
47540
  }
47455
- const registryReference = neoScriptRegistryReferenceType(type.name);
47456
47541
  if (registryReference) {
47457
47542
  resolved = registryReference;
47458
47543
  break;
47459
47544
  }
47460
47545
  if (type.name === "NeoDelegate") {
47546
+ if (written > NEOSCRIPT_DELEGATE_MAX_PARAMETERS + 1)
47547
+ throw new CompileError(delegateArityMessage(written), type.pos);
47461
47548
  const [returnType, ...parameterTypes] = (type.typeArguments ?? []).map(
47462
47549
  (argument2) => resolveNeoScriptType(argument2, context, project)
47463
47550
  );
@@ -47475,6 +47562,7 @@ function resolveNeoScriptType(type, context, project) {
47475
47562
  renamedDialogueTypeMessage(type.name, "value") ?? `Unknown type '${type.name}'`,
47476
47563
  type.pos
47477
47564
  );
47565
+ if (written > 0) assertTypeArgumentCount(named, written, type.pos);
47478
47566
  resolved = {
47479
47567
  kind: "named",
47480
47568
  typeId: named.id,
@@ -47543,6 +47631,14 @@ function assertDirectTypeParameterArguments(target, pos, project) {
47543
47631
  const message = wrappedTypeParameterMessage(target, project);
47544
47632
  if (message !== null) throw new CompileError(message, pos);
47545
47633
  }
47634
+ function assertTypeArgumentCount(declaring, count, pos) {
47635
+ const expected = declaring.typeParameters?.length ?? 0;
47636
+ if (count === expected) return;
47637
+ throw new CompileError(
47638
+ typeArgumentArityMessage(declaring.name, expected, count),
47639
+ pos
47640
+ );
47641
+ }
47546
47642
  function assertTypeArgumentConstraints(declaring, type, pos, project) {
47547
47643
  declaring.typeParameters?.forEach((parameter3, index) => {
47548
47644
  const argument2 = type.typeArguments?.[index];
@@ -59463,7 +59559,7 @@ var INITIALIZER_KEY_PLACEHOLDER = new RegExp(
59463
59559
 
59464
59560
  // ../packages/manifest/schema-contract/registry.mjs
59465
59561
  var PROJECT_SCHEMA_CONTRACT = Object.freeze({
59466
- cliVersion: "0.81.1",
59562
+ cliVersion: "0.81.2",
59467
59563
  projectFileUploadBatchSize: 32,
59468
59564
  documentRecords: {
59469
59565
  member: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neocompose/cli",
3
- "version": "0.81.1",
3
+ "version": "0.81.2",
4
4
  "description": "Neo Compose native project-source CLI with bidirectional sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ description: >-
9
9
  `@neocompose/cli` or `node cli/bin/neo.mjs` in the neo-compose repository.
10
10
  ---
11
11
 
12
- <!-- reviewed-through-cli: 0.81.1 -->
12
+ <!-- reviewed-through-cli: 0.81.2 -->
13
13
 
14
14
  # Neo Compose CLI
15
15
 
@@ -129,7 +129,7 @@ wrappers.
129
129
  The marker near the top of `SKILL.md` must exactly match the package version:
130
130
 
131
131
  ```html
132
- <!-- reviewed-through-cli: 0.81.1 -->
132
+ <!-- reviewed-through-cli: 0.81.2 -->
133
133
  ```
134
134
 
135
135
  The quoted version above is checked too, so this instruction cannot go stale
@@ -222,7 +222,10 @@ the class's own parameter, such as `public Bag<T> B = new Bag<T>();`. Such an
222
222
  initializer with fields or entries, like `new Bag<T> { N = 3 }`, runs per
223
223
  instance, since each instance closes `T` differently. A type
224
224
  argument that wraps the parameter, such as `new Bag<List<T>>()`, is rejected.
225
- Type arguments must satisfy `extends` constraints in bodies too.
225
+ Type arguments must satisfy `extends` constraints in bodies too. A written
226
+ type argument list names every parameter, so `item is Tool<Asset>` is rejected
227
+ when `Tool` declares two. A bare generic name, such as `item is Tool`, stays
228
+ allowed.
226
229
  A type argument may be a delegate, such as `Box<NeoDelegate<int, int>>`, but
227
230
  not a `NeoAction`, which is never a value.
228
231