@neocompose/cli 0.38.3 → 0.38.5
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
|
@@ -936,7 +936,7 @@ var init_login = __esm({
|
|
|
936
936
|
"project:release-channel:write",
|
|
937
937
|
"project:release-channel:publish"
|
|
938
938
|
];
|
|
939
|
-
sleep = (ms) => new Promise((
|
|
939
|
+
sleep = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
940
940
|
}
|
|
941
941
|
});
|
|
942
942
|
|
|
@@ -9133,19 +9133,6 @@ function bindConstructorArgumentNames(className, declared, argumentNames, pos) {
|
|
|
9133
9133
|
return parameter4.name;
|
|
9134
9134
|
});
|
|
9135
9135
|
}
|
|
9136
|
-
function callMatchesDeclaredOverloadNames(declared, expression) {
|
|
9137
|
-
if (declared.length === 0) return false;
|
|
9138
|
-
if (callHasPositionalArguments(expression)) return false;
|
|
9139
|
-
const names = expression.args.map(
|
|
9140
|
-
(_, index) => expression.argumentNames?.[index] ?? ""
|
|
9141
|
-
);
|
|
9142
|
-
const callKey = neoScriptArgumentNameSetKey(names);
|
|
9143
|
-
return declared.some(
|
|
9144
|
-
(candidate) => neoScriptArgumentNameSetKey(
|
|
9145
|
-
candidate.parameters.map((parameter4) => parameter4.name)
|
|
9146
|
-
) === callKey
|
|
9147
|
-
);
|
|
9148
|
-
}
|
|
9149
9136
|
function scopeVariable(name, value, sourceType, writability, ownership, writeRoot, readonlyBinding) {
|
|
9150
9137
|
return {
|
|
9151
9138
|
name,
|
|
@@ -11827,11 +11814,8 @@ var init_strict_resolver = __esm({
|
|
|
11827
11814
|
const declaredTarget = this.project.typeByName.get(className);
|
|
11828
11815
|
const declared = declaredTarget?.declaredConstructors ?? [];
|
|
11829
11816
|
const requiredConstructor = neoScriptRequiredConstructor(declaredTarget);
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
}
|
|
11833
|
-
const projectionCall = requiredConstructor === null && declaredTarget?.constructorSignature !== void 0 && (expression.argumentNames === void 0 && callHasPositionalArguments(expression) || expression.argumentNames !== void 0 && declaredTarget.constructorSignature.namedProjections !== void 0);
|
|
11834
|
-
if (declared.length > 0 && !projectionCall) {
|
|
11817
|
+
const generatedPositionalCall = requiredConstructor === null && declaredTarget?.constructorSignature !== void 0 && expression.argumentNames === void 0 && callHasPositionalArguments(expression);
|
|
11818
|
+
if (declared.length > 0 && !generatedPositionalCall) {
|
|
11835
11819
|
return this.resolveDeclaredConstructor(
|
|
11836
11820
|
className,
|
|
11837
11821
|
expression,
|
|
@@ -11840,13 +11824,13 @@ var init_strict_resolver = __esm({
|
|
|
11840
11824
|
expected
|
|
11841
11825
|
);
|
|
11842
11826
|
}
|
|
11843
|
-
if (expression.argumentNames && !
|
|
11827
|
+
if (expression.argumentNames && !generatedPositionalCall) {
|
|
11844
11828
|
throw new CompileError(
|
|
11845
11829
|
"Named constructor arguments require a declaration-aware project source context.",
|
|
11846
11830
|
expression.pos
|
|
11847
11831
|
);
|
|
11848
11832
|
}
|
|
11849
|
-
if (expression.initializer && expression.initializer.length > 0 && !
|
|
11833
|
+
if (expression.initializer && expression.initializer.length > 0 && !generatedPositionalCall && this.context.storedConstructionReplay !== true) {
|
|
11850
11834
|
throw new CompileError(
|
|
11851
11835
|
"Object initializers are available to project source construction and are not executable NeoScript constructors.",
|
|
11852
11836
|
expression.pos
|
|
@@ -14089,26 +14073,11 @@ var init_strict_resolver = __esm({
|
|
|
14089
14073
|
)
|
|
14090
14074
|
}));
|
|
14091
14075
|
const argumentsList2 = expression.args;
|
|
14092
|
-
const namedProjections = signature.namedProjections;
|
|
14093
14076
|
if (expression.argumentNames !== void 0) {
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
);
|
|
14099
|
-
}
|
|
14100
|
-
if (argumentsList2.length !== namedProjections.length) {
|
|
14101
|
-
throw new CompileError(
|
|
14102
|
-
`${className} constructor requires ${namedProjections.length} named argument${namedProjections.length === 1 ? "" : "s"} but got ${argumentsList2.length}.`,
|
|
14103
|
-
pos
|
|
14104
|
-
);
|
|
14105
|
-
}
|
|
14106
|
-
if (expression.argumentNames.length !== argumentsList2.length) {
|
|
14107
|
-
throw new CompileError(
|
|
14108
|
-
`${className} constructor projection requires every argument to be named.`,
|
|
14109
|
-
pos
|
|
14110
|
-
);
|
|
14111
|
-
}
|
|
14077
|
+
throw new CompileError(
|
|
14078
|
+
"Named constructor arguments require a declaration-aware project source context.",
|
|
14079
|
+
pos
|
|
14080
|
+
);
|
|
14112
14081
|
}
|
|
14113
14082
|
const requiredCount = signature.parameters.filter(
|
|
14114
14083
|
(parameter4) => parameter4.required
|
|
@@ -14126,30 +14095,10 @@ var init_strict_resolver = __esm({
|
|
|
14126
14095
|
);
|
|
14127
14096
|
}
|
|
14128
14097
|
const fields = argumentsList2.map((argument2, index) => {
|
|
14129
|
-
const
|
|
14130
|
-
const projection = projectionName === void 0 ? void 0 : namedProjections?.find(
|
|
14131
|
-
(candidate) => candidate.name === projectionName
|
|
14132
|
-
);
|
|
14133
|
-
if (projectionName !== void 0 && projection === void 0) {
|
|
14134
|
-
throw new CompileError(
|
|
14135
|
-
`Class '${className}' has no constructor projection named '${projectionName}'.`,
|
|
14136
|
-
argument2.pos
|
|
14137
|
-
);
|
|
14138
|
-
}
|
|
14139
|
-
if (projection !== void 0 && expression.argumentNames?.findIndex(
|
|
14140
|
-
(candidate) => candidate === projection.name
|
|
14141
|
-
) !== index) {
|
|
14142
|
-
throw new CompileError(
|
|
14143
|
-
`Constructor argument '${projection.name}' is supplied more than once.`,
|
|
14144
|
-
argument2.pos
|
|
14145
|
-
);
|
|
14146
|
-
}
|
|
14147
|
-
const parameter4 = projection === void 0 ? parameters[index] : parameters.find(
|
|
14148
|
-
(candidate) => candidate.memberId === projection.memberId
|
|
14149
|
-
);
|
|
14098
|
+
const parameter4 = parameters[index];
|
|
14150
14099
|
if (!parameter4) {
|
|
14151
14100
|
throw new Error(
|
|
14152
|
-
|
|
14101
|
+
`NeoScript constructor ${className} lost parameter ${index + 1} after argument-count validation.`
|
|
14153
14102
|
);
|
|
14154
14103
|
}
|
|
14155
14104
|
const value = this.resolveExpression(
|
|
@@ -14169,16 +14118,6 @@ var init_strict_resolver = __esm({
|
|
|
14169
14118
|
valuePointer: value.pointer
|
|
14170
14119
|
};
|
|
14171
14120
|
});
|
|
14172
|
-
if (namedProjections !== void 0 && expression.argumentNames !== void 0) {
|
|
14173
|
-
for (const projection of namedProjections) {
|
|
14174
|
-
if (!expression.argumentNames.includes(projection.name)) {
|
|
14175
|
-
throw new CompileError(
|
|
14176
|
-
`${className} constructor is missing named argument '${projection.name}'.`,
|
|
14177
|
-
pos
|
|
14178
|
-
);
|
|
14179
|
-
}
|
|
14180
|
-
}
|
|
14181
|
-
}
|
|
14182
14121
|
fields.push(
|
|
14183
14122
|
...this.resolveCallSiteInitializerFields(schemaClass2, expression, scope)
|
|
14184
14123
|
);
|
|
@@ -14225,22 +14164,6 @@ var init_strict_resolver = __esm({
|
|
|
14225
14164
|
typeId: schemaClass2.id
|
|
14226
14165
|
};
|
|
14227
14166
|
}
|
|
14228
|
-
/**
|
|
14229
|
-
* P43 §7.1. P29's `new T(id: "…")` projection names a class-default row,
|
|
14230
|
-
* which is exactly the wrong identity inside a construction body: member
|
|
14231
|
-
* initializers have already run, so the body holds its own rows.
|
|
14232
|
-
*/
|
|
14233
|
-
rejectConstructorProjectionInConstructionBody(expression) {
|
|
14234
|
-
if (!isNeoScriptConstructionDocumentKind(this.context.kind)) return;
|
|
14235
|
-
const idIndex = (expression.argumentNames ?? []).findIndex(
|
|
14236
|
-
(name) => name === "id"
|
|
14237
|
-
);
|
|
14238
|
-
if (idIndex < 0) return;
|
|
14239
|
-
throw new CompileError(
|
|
14240
|
-
`A constructor projection \`new(id: \u2026)\` names a class-default row, so it cannot be used in a ${this.context.kind} body. Bind the resolved value instead, for example \`Child = iris\`.`,
|
|
14241
|
-
expression.pos
|
|
14242
|
-
);
|
|
14243
|
-
}
|
|
14244
14167
|
/**
|
|
14245
14168
|
* P43 §6.1. Construction through the class's author-declared constructors.
|
|
14246
14169
|
* Arguments are named (§6.1.1 resolves overloads by name set first), and
|
|
@@ -19518,7 +19441,7 @@ var init_project_schema_contract_generated = __esm({
|
|
|
19518
19441
|
"../packages/neoscript-language/src/project-schema-contract.generated.ts"() {
|
|
19519
19442
|
"use strict";
|
|
19520
19443
|
PROJECT_SCHEMA_MANIFEST_FORMAT_VERSION = 3;
|
|
19521
|
-
PROJECT_SCHEMA_MANIFEST_CONTRACT_VERSION = "3.
|
|
19444
|
+
PROJECT_SCHEMA_MANIFEST_CONTRACT_VERSION = "3.15";
|
|
19522
19445
|
PROJECT_FILE_UPLOAD_BATCH_SIZE = 32;
|
|
19523
19446
|
NEO_PROJECT_SOURCE_RECORD_CONTRACT = {
|
|
19524
19447
|
"recordFields": {
|
|
@@ -19588,7 +19511,6 @@ var init_project_schema_contract_generated = __esm({
|
|
|
19588
19511
|
"allowedStorageKeys",
|
|
19589
19512
|
"genericParams",
|
|
19590
19513
|
"extendsGenericBindings",
|
|
19591
|
-
"constructorProjections",
|
|
19592
19514
|
"constructorIds",
|
|
19593
19515
|
"requiredConstructorId",
|
|
19594
19516
|
"targetMemberId"
|
|
@@ -22779,7 +22701,7 @@ function resolveInvokedConstructor(declaration, call, diagnostics) {
|
|
|
22779
22701
|
return true;
|
|
22780
22702
|
}
|
|
22781
22703
|
if (declaration.constructors.length === 0) {
|
|
22782
|
-
return
|
|
22704
|
+
return false;
|
|
22783
22705
|
}
|
|
22784
22706
|
if (call.argumentNames.length === 0) {
|
|
22785
22707
|
return declaration.constructors.some(
|
|
@@ -35831,7 +35753,6 @@ var init_document_contracts = __esm({
|
|
|
35831
35753
|
"allowedStorageKeys",
|
|
35832
35754
|
"genericParams",
|
|
35833
35755
|
"extendsGenericBindings",
|
|
35834
|
-
"constructorProjections",
|
|
35835
35756
|
"constructorIds",
|
|
35836
35757
|
"requiredConstructorId",
|
|
35837
35758
|
"targetMemberId"
|
|
@@ -35849,7 +35770,6 @@ var init_document_contracts = __esm({
|
|
|
35849
35770
|
allowedStorageKeys: "nullIsAbsent",
|
|
35850
35771
|
genericParams: "nullOrEmptyArrayIsAbsent",
|
|
35851
35772
|
extendsGenericBindings: "nullOrEmptyObjectIsAbsent",
|
|
35852
|
-
constructorProjections: "nullOrEmptyArrayIsAbsent",
|
|
35853
35773
|
constructorIds: "nullOrEmptyArrayIsAbsent",
|
|
35854
35774
|
requiredConstructorId: "nullIsAbsent"
|
|
35855
35775
|
}
|
|
@@ -38739,27 +38659,6 @@ function schemaClassFromDocument(record3, context) {
|
|
|
38739
38659
|
selectionSpan: source.selectionSpan
|
|
38740
38660
|
};
|
|
38741
38661
|
});
|
|
38742
|
-
const constructorProjections = optionalArray(data.constructorProjections).map(
|
|
38743
|
-
(entry, index) => {
|
|
38744
|
-
const projection = requireRecordValue(
|
|
38745
|
-
entry,
|
|
38746
|
-
record3,
|
|
38747
|
-
`constructorProjections[${index}]`
|
|
38748
|
-
);
|
|
38749
|
-
return {
|
|
38750
|
-
parameterName: requiredStringValue(
|
|
38751
|
-
projection.parameterName,
|
|
38752
|
-
record3,
|
|
38753
|
-
`constructorProjections[${index}].parameterName`
|
|
38754
|
-
),
|
|
38755
|
-
memberId: requiredStringValue(
|
|
38756
|
-
projection.memberId,
|
|
38757
|
-
record3,
|
|
38758
|
-
`constructorProjections[${index}].memberId`
|
|
38759
|
-
)
|
|
38760
|
-
};
|
|
38761
|
-
}
|
|
38762
|
-
);
|
|
38763
38662
|
const constructorIds = optionalStringArray(data.constructorIds);
|
|
38764
38663
|
const requiredConstructorId2 = optionalStringOrNull(
|
|
38765
38664
|
data.requiredConstructorId
|
|
@@ -38790,7 +38689,6 @@ function schemaClassFromDocument(record3, context) {
|
|
|
38790
38689
|
"extendsGenericBindings"
|
|
38791
38690
|
),
|
|
38792
38691
|
targetMemberId: optionalStringOrNull(data.targetMemberId),
|
|
38793
|
-
...constructorProjections.length === 0 ? {} : { constructorProjections },
|
|
38794
38692
|
...constructorIds.length === 0 ? {} : { constructorIds },
|
|
38795
38693
|
...requiredConstructorId2 === null ? {} : { requiredConstructorId: requiredConstructorId2 }
|
|
38796
38694
|
};
|
|
@@ -38821,7 +38719,6 @@ function schemaClassToDocument(schemaClass2) {
|
|
|
38821
38719
|
...parameter4.constraint === null ? {} : { constraint: parameter4.constraint }
|
|
38822
38720
|
})),
|
|
38823
38721
|
extendsGenericBindings: schemaClass2.extendsGenericBindings,
|
|
38824
|
-
constructorProjections: schemaClass2.constructorProjections,
|
|
38825
38722
|
constructorIds: schemaClass2.constructorIds,
|
|
38826
38723
|
requiredConstructorId: schemaClass2.requiredConstructorId,
|
|
38827
38724
|
targetMemberId: schemaClass2.targetMemberId
|
|
@@ -40256,7 +40153,6 @@ function assertNeoSchemaClass(value, path) {
|
|
|
40256
40153
|
[
|
|
40257
40154
|
"docsText",
|
|
40258
40155
|
"isSealed",
|
|
40259
|
-
"constructorProjections",
|
|
40260
40156
|
"constructorIds",
|
|
40261
40157
|
"requiredConstructorId",
|
|
40262
40158
|
"allowedStorageKeys"
|
|
@@ -40296,18 +40192,6 @@ function assertNeoSchemaClass(value, path) {
|
|
|
40296
40192
|
if (type.requiredConstructorId !== void 0) {
|
|
40297
40193
|
nonEmptyString(type.requiredConstructorId, `${path}.requiredConstructorId`);
|
|
40298
40194
|
}
|
|
40299
|
-
if (type.constructorProjections !== void 0) {
|
|
40300
|
-
arrayOf(
|
|
40301
|
-
type.constructorProjections,
|
|
40302
|
-
`${path}.constructorProjections`,
|
|
40303
|
-
assertClassConstructorProjection
|
|
40304
|
-
);
|
|
40305
|
-
}
|
|
40306
|
-
}
|
|
40307
|
-
function assertClassConstructorProjection(value, path) {
|
|
40308
|
-
const projection = objectAt(value, path, ["parameterName", "memberId"]);
|
|
40309
|
-
nonEmptyString(projection.parameterName, `${path}.parameterName`);
|
|
40310
|
-
nonEmptyString(projection.memberId, `${path}.memberId`);
|
|
40311
40195
|
}
|
|
40312
40196
|
function assertGenericParameter(value, path) {
|
|
40313
40197
|
const parameter4 = objectAt(value, path, [
|
|
@@ -44226,6 +44110,18 @@ var init_neoscript = __esm({
|
|
|
44226
44110
|
}
|
|
44227
44111
|
});
|
|
44228
44112
|
|
|
44113
|
+
// ../src/common/collections.ts
|
|
44114
|
+
function indexById2(records2) {
|
|
44115
|
+
const indexed = /* @__PURE__ */ new Map();
|
|
44116
|
+
for (const record3 of records2) indexed.set(record3.id, record3);
|
|
44117
|
+
return indexed;
|
|
44118
|
+
}
|
|
44119
|
+
var init_collections = __esm({
|
|
44120
|
+
"../src/common/collections.ts"() {
|
|
44121
|
+
"use strict";
|
|
44122
|
+
}
|
|
44123
|
+
});
|
|
44124
|
+
|
|
44229
44125
|
// ../src/models/classes/classes.ts
|
|
44230
44126
|
function isGenericParamConstraint(value) {
|
|
44231
44127
|
const v = value;
|
|
@@ -44275,23 +44171,20 @@ function isGenericBindingsRecord(value) {
|
|
|
44275
44171
|
if (Array.isArray(value)) return false;
|
|
44276
44172
|
return Object.values(value).every(isGenericBinding);
|
|
44277
44173
|
}
|
|
44174
|
+
function hasRetiredConstructorProjectionsTombstone(value) {
|
|
44175
|
+
return value !== null && typeof value === "object" && Object.hasOwn(value, RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD);
|
|
44176
|
+
}
|
|
44278
44177
|
function isNeoSchemaClassBase(value) {
|
|
44178
|
+
if (hasRetiredConstructorProjectionsTombstone(value)) {
|
|
44179
|
+
return false;
|
|
44180
|
+
}
|
|
44279
44181
|
const v = value;
|
|
44280
44182
|
return typeof v?.name === "string" && isValidDocsText(v.docsText) && isClassSchema(v?.schema) && isOptionalSchemaKeyOrder(v?.schemaKeyOrder) && (v.implementsInterfaceIds === void 0 || v.implementsInterfaceIds === null || Array.isArray(v.implementsInterfaceIds) && v.implementsInterfaceIds.every(
|
|
44281
44183
|
(interfaceId) => typeof interfaceId === "string" && interfaceId.length > 0
|
|
44282
|
-
)) && typeof v?.hiddenInMemberSelector === "boolean" && typeof v?.isAbstract === "boolean" && (v.isSealed === void 0 || typeof v.isSealed === "boolean") && (v.allowedStorage === void 0 || v.allowedStorage === null || isEffectiveMemberStorage(v.allowedStorage)) && (v.allowedStorageKeys === void 0 || v.allowedStorageKeys === null || Array.isArray(v.allowedStorageKeys) && v.allowedStorageKeys.every((key) => typeof key === "string")) && (v.genericParams === void 0 || v.genericParams === null || Array.isArray(v.genericParams) && v.genericParams.every(isGenericParamDeclaration)) && (v.extendsGenericBindings === void 0 || v.extendsGenericBindings === null || isGenericBindingsRecord(v.extendsGenericBindings)) && (v.
|
|
44184
|
+
)) && typeof v?.hiddenInMemberSelector === "boolean" && typeof v?.isAbstract === "boolean" && (v.isSealed === void 0 || typeof v.isSealed === "boolean") && (v.allowedStorage === void 0 || v.allowedStorage === null || isEffectiveMemberStorage(v.allowedStorage)) && (v.allowedStorageKeys === void 0 || v.allowedStorageKeys === null || Array.isArray(v.allowedStorageKeys) && v.allowedStorageKeys.every((key) => typeof key === "string")) && (v.genericParams === void 0 || v.genericParams === null || Array.isArray(v.genericParams) && v.genericParams.every(isGenericParamDeclaration)) && (v.extendsGenericBindings === void 0 || v.extendsGenericBindings === null || isGenericBindingsRecord(v.extendsGenericBindings)) && (v.constructorIds === void 0 || v.constructorIds === null || Array.isArray(v.constructorIds) && v.constructorIds.every(
|
|
44283
44185
|
(constructorId) => typeof constructorId === "string" && constructorId.length > 0
|
|
44284
44186
|
) && new Set(v.constructorIds).size === v.constructorIds.length) && (v.requiredConstructorId === void 0 || v.requiredConstructorId === null || typeof v.requiredConstructorId === "string" && v.requiredConstructorId.length > 0 && (v.constructorIds ?? []).length === 0) && (v.targetMemberId === void 0 || v.targetMemberId === null || typeof v.targetMemberId === "string" && v.targetMemberId.length > 0) && (v.system === void 0 || v.system === null || isSystemMetadata(v.system));
|
|
44285
44187
|
}
|
|
44286
|
-
function isNeoClassConstructorProjection(value) {
|
|
44287
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
44288
|
-
return false;
|
|
44289
|
-
}
|
|
44290
|
-
const projection = value;
|
|
44291
|
-
return Object.keys(projection).every(
|
|
44292
|
-
(key) => key === "parameterName" || key === "memberId"
|
|
44293
|
-
) && typeof projection.parameterName === "string" && projection.parameterName.length > 0 && typeof projection.memberId === "string" && projection.memberId.length > 0;
|
|
44294
|
-
}
|
|
44295
44188
|
function resolveAllowedStorage(classId, classes, draft) {
|
|
44296
44189
|
const visited = /* @__PURE__ */ new Set();
|
|
44297
44190
|
const lookup = (id2) => draft && draft.id === id2 ? draft : classes.find((candidate) => candidate.id === id2);
|
|
@@ -44360,12 +44253,15 @@ function isNeoSchemaClassProps(value) {
|
|
|
44360
44253
|
function isNeoSchemaClass(value) {
|
|
44361
44254
|
return isNeoSchemaClassProps(value);
|
|
44362
44255
|
}
|
|
44256
|
+
var RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD;
|
|
44363
44257
|
var init_classes = __esm({
|
|
44364
44258
|
"../src/models/classes/classes.ts"() {
|
|
44365
44259
|
"use strict";
|
|
44260
|
+
init_collections();
|
|
44366
44261
|
init_core();
|
|
44367
44262
|
init_docs_text2();
|
|
44368
44263
|
init_member_storage();
|
|
44264
|
+
RETIRED_CONSTRUCTOR_PROJECTIONS_FIELD = "constructorProjections";
|
|
44369
44265
|
}
|
|
44370
44266
|
});
|
|
44371
44267
|
|
|
@@ -45549,6 +45445,9 @@ function membersById(members) {
|
|
|
45549
45445
|
});
|
|
45550
45446
|
return byId;
|
|
45551
45447
|
}
|
|
45448
|
+
function classIndexFor(classes) {
|
|
45449
|
+
return classesById(classes);
|
|
45450
|
+
}
|
|
45552
45451
|
function createMergeMemo() {
|
|
45553
45452
|
const byClasses = /* @__PURE__ */ new WeakMap();
|
|
45554
45453
|
return (classId, classIndex, memberIndex, compute) => {
|
|
@@ -45691,8 +45590,9 @@ function findNearestAncestorSchemaPlacement(ownerClass, schemaKey, classesById2)
|
|
|
45691
45590
|
function walkExtendsMemberChain(startId, members, pick, options) {
|
|
45692
45591
|
const requireKind = options?.requireKind;
|
|
45693
45592
|
const maxHops = options?.maxHops ?? 16;
|
|
45694
|
-
const byId = membersById(members);
|
|
45695
|
-
|
|
45593
|
+
const byId = options?.memberById === void 0 ? membersById(members) : null;
|
|
45594
|
+
const getMember = (id2) => options?.memberById?.(id2) ?? byId?.get(id2) ?? null;
|
|
45595
|
+
let cursor = getMember(startId);
|
|
45696
45596
|
for (let i = 0; cursor && i < maxHops; i++) {
|
|
45697
45597
|
if (requireKind !== void 0 && cursor.kind !== requireKind) {
|
|
45698
45598
|
return void 0;
|
|
@@ -45701,7 +45601,7 @@ function walkExtendsMemberChain(startId, members, pick, options) {
|
|
|
45701
45601
|
if (v !== void 0) return v;
|
|
45702
45602
|
const nextId = getOptionalString(cursor, "extendsMemberId");
|
|
45703
45603
|
if (nextId === void 0) return void 0;
|
|
45704
|
-
cursor =
|
|
45604
|
+
cursor = getMember(nextId);
|
|
45705
45605
|
}
|
|
45706
45606
|
return void 0;
|
|
45707
45607
|
}
|
|
@@ -48337,6 +48237,14 @@ var init_generics = __esm({
|
|
|
48337
48237
|
});
|
|
48338
48238
|
|
|
48339
48239
|
// ../src/models/members/instance-provenance.ts
|
|
48240
|
+
function overlayLiteralValueContent(base, override) {
|
|
48241
|
+
const merged = { ...base, ...override };
|
|
48242
|
+
if (!("value" in override) || override.value !== null) return merged;
|
|
48243
|
+
for (const field of LITERAL_INSTANCE_IDENTITY_FIELDS) {
|
|
48244
|
+
if (!Object.hasOwn(override, field)) Reflect.deleteProperty(merged, field);
|
|
48245
|
+
}
|
|
48246
|
+
return merged;
|
|
48247
|
+
}
|
|
48340
48248
|
function pickInstanceProvenance(source) {
|
|
48341
48249
|
return {
|
|
48342
48250
|
...source.constructorArgs === void 0 ? {} : { constructorArgs: source.constructorArgs },
|
|
@@ -48355,10 +48263,19 @@ function carriesCompleteConstructionRecipe(value) {
|
|
|
48355
48263
|
if (typeof value.instanceVariantId === "string") return true;
|
|
48356
48264
|
return value.constructorArgs !== void 0;
|
|
48357
48265
|
}
|
|
48266
|
+
var LITERAL_INSTANCE_IDENTITY_FIELDS;
|
|
48358
48267
|
var init_instance_provenance = __esm({
|
|
48359
48268
|
"../src/models/members/instance-provenance.ts"() {
|
|
48360
48269
|
"use strict";
|
|
48361
48270
|
init_member_kinds();
|
|
48271
|
+
LITERAL_INSTANCE_IDENTITY_FIELDS = [
|
|
48272
|
+
"classId",
|
|
48273
|
+
"constructorArgs",
|
|
48274
|
+
"instanceConstructorId",
|
|
48275
|
+
"instanceVariantId",
|
|
48276
|
+
"instanceVariantRowValueId",
|
|
48277
|
+
"genericBindings"
|
|
48278
|
+
];
|
|
48362
48279
|
}
|
|
48363
48280
|
});
|
|
48364
48281
|
|
|
@@ -50268,6 +50185,85 @@ function recordStorageKeyDeclaration(sink, valueId, member) {
|
|
|
50268
50185
|
if (declaration === STORAGE_KEY_INHERIT) return;
|
|
50269
50186
|
sink.set(valueId, declaration);
|
|
50270
50187
|
}
|
|
50188
|
+
function createDefaultValueResolutionCache() {
|
|
50189
|
+
return {
|
|
50190
|
+
memberByIdIndex: null,
|
|
50191
|
+
instanceEnvironmentByKey: /* @__PURE__ */ new Map(),
|
|
50192
|
+
materializationPlanByClassAndEnvironment: /* @__PURE__ */ new Map(),
|
|
50193
|
+
resolvedMemberById: /* @__PURE__ */ new Map(),
|
|
50194
|
+
storedSchemaByClassId: /* @__PURE__ */ new Map(),
|
|
50195
|
+
validatedInitializerContainers: /* @__PURE__ */ new WeakSet()
|
|
50196
|
+
};
|
|
50197
|
+
}
|
|
50198
|
+
function withIndexedDefaultValueDocument(document, options = {}) {
|
|
50199
|
+
const cache = options.cache ?? createDefaultValueResolutionCache();
|
|
50200
|
+
if (cache.memberByIdIndex === null && options.memberById === void 0 && document.memberById === void 0) {
|
|
50201
|
+
cache.memberByIdIndex = new Map(
|
|
50202
|
+
document.members.map((member) => [member.id, member])
|
|
50203
|
+
);
|
|
50204
|
+
}
|
|
50205
|
+
const indexed = {
|
|
50206
|
+
...document,
|
|
50207
|
+
memberById: (id2) => options.memberById?.(id2) ?? document.memberById?.(id2) ?? cache.memberByIdIndex?.get(id2) ?? null,
|
|
50208
|
+
resolvedMember: (member) => {
|
|
50209
|
+
const memberId = "id" in member ? member.id : void 0;
|
|
50210
|
+
if (typeof memberId !== "string") {
|
|
50211
|
+
return resolveMember2(member, document.members);
|
|
50212
|
+
}
|
|
50213
|
+
const cached = cache.resolvedMemberById.get(memberId);
|
|
50214
|
+
if (cached !== void 0) return cached;
|
|
50215
|
+
const resolved = resolveMember2(member, document.members);
|
|
50216
|
+
cache.resolvedMemberById.set(memberId, resolved);
|
|
50217
|
+
return resolved;
|
|
50218
|
+
},
|
|
50219
|
+
storedInstanceSchema: (classId) => {
|
|
50220
|
+
const cached = cache.storedSchemaByClassId.get(classId);
|
|
50221
|
+
if (cached !== void 0) return cached;
|
|
50222
|
+
const schema = mergeStoredInstanceSchema(
|
|
50223
|
+
classId,
|
|
50224
|
+
document.classes,
|
|
50225
|
+
document.members
|
|
50226
|
+
);
|
|
50227
|
+
cache.storedSchemaByClassId.set(classId, schema);
|
|
50228
|
+
return schema;
|
|
50229
|
+
},
|
|
50230
|
+
instanceEnv: (classId, classArguments2) => {
|
|
50231
|
+
const key = `${classId}:${JSON.stringify(classArguments2 ?? null)}`;
|
|
50232
|
+
const cached = cache.instanceEnvironmentByKey.get(key);
|
|
50233
|
+
if (cached !== void 0) return cached;
|
|
50234
|
+
const environment = resolveInstanceEnv(
|
|
50235
|
+
classId,
|
|
50236
|
+
classArguments2,
|
|
50237
|
+
document.classes
|
|
50238
|
+
);
|
|
50239
|
+
cache.instanceEnvironmentByKey.set(key, environment);
|
|
50240
|
+
return environment;
|
|
50241
|
+
},
|
|
50242
|
+
isInitValueContent: (value) => {
|
|
50243
|
+
if (typeof value !== "object" || value === null) return false;
|
|
50244
|
+
if (cache.validatedInitializerContainers.has(value)) return true;
|
|
50245
|
+
if (!isInitValueContent(value)) return false;
|
|
50246
|
+
cache.validatedInitializerContainers.add(value);
|
|
50247
|
+
return true;
|
|
50248
|
+
},
|
|
50249
|
+
createValueRow: options.createValueRow ?? document.createValueRow
|
|
50250
|
+
};
|
|
50251
|
+
indexed.storedInstanceMaterializationPlan = (classId, environment) => {
|
|
50252
|
+
let byEnvironment = cache.materializationPlanByClassAndEnvironment.get(classId);
|
|
50253
|
+
const cached = byEnvironment?.get(environment);
|
|
50254
|
+
if (cached !== void 0) return cached;
|
|
50255
|
+
const plan = buildDefaultClassMaterializationPlan(
|
|
50256
|
+
indexed,
|
|
50257
|
+
classId,
|
|
50258
|
+
environment
|
|
50259
|
+
);
|
|
50260
|
+
byEnvironment ??= /* @__PURE__ */ new WeakMap();
|
|
50261
|
+
byEnvironment.set(environment, plan);
|
|
50262
|
+
cache.materializationPlanByClassAndEnvironment.set(classId, byEnvironment);
|
|
50263
|
+
return plan;
|
|
50264
|
+
};
|
|
50265
|
+
return indexed;
|
|
50266
|
+
}
|
|
50271
50267
|
function documentHasInitValueContent(document, value) {
|
|
50272
50268
|
return document.isInitValueContent?.(value) ?? isInitValueContent(value);
|
|
50273
50269
|
}
|
|
@@ -56778,6 +56774,7 @@ var init_common = __esm({
|
|
|
56778
56774
|
"../src/common/index.ts"() {
|
|
56779
56775
|
"use strict";
|
|
56780
56776
|
init_benchmark();
|
|
56777
|
+
init_collections();
|
|
56781
56778
|
init_error_message();
|
|
56782
56779
|
init_retree_input_diagnostics();
|
|
56783
56780
|
}
|
|
@@ -59713,7 +59710,6 @@ function lowerClass(context, declaration) {
|
|
|
59713
59710
|
extendsClassId,
|
|
59714
59711
|
declaration.baseTypes[0].arguments
|
|
59715
59712
|
) : base?.extendsGenericBindings ?? {},
|
|
59716
|
-
...base?.constructorProjections === void 0 ? {} : { constructorProjections: base.constructorProjections },
|
|
59717
59713
|
// P43 §6.3/§6.4: declaration order is the only ordering state, and a
|
|
59718
59714
|
// constructor carries no schema key, so it never enters schemaKeyOrder.
|
|
59719
59715
|
...declaration.constructors.length === 0 ? {} : {
|
|
@@ -63260,8 +63256,7 @@ function classToLanguageType(schemaClass2, context) {
|
|
|
63260
63256
|
}
|
|
63261
63257
|
function constructorSignature(schemaClass2, members, context, genericEnvironment) {
|
|
63262
63258
|
if (schemaClass2.isAbstract) return {};
|
|
63263
|
-
|
|
63264
|
-
if (projections.length === 0 && !isClosedClass(schemaClass2.id, context.vm.classes)) {
|
|
63259
|
+
if (!isClosedClass(schemaClass2.id, context.vm.classes)) {
|
|
63265
63260
|
return {};
|
|
63266
63261
|
}
|
|
63267
63262
|
if (resolveAllowedStorage(schemaClass2.id, context.vm.classes) === "immutable" /* Immutable */) {
|
|
@@ -63282,9 +63277,7 @@ function constructorSignature(schemaClass2, members, context, genericEnvironment
|
|
|
63282
63277
|
defaultValue: "defaultValue" in resolved ? resolved.defaultValue : void 0
|
|
63283
63278
|
};
|
|
63284
63279
|
} catch {
|
|
63285
|
-
return
|
|
63286
|
-
(projection) => projection.memberId === memberId
|
|
63287
|
-
) ? { required: true } : null;
|
|
63280
|
+
return null;
|
|
63288
63281
|
}
|
|
63289
63282
|
}
|
|
63290
63283
|
);
|
|
@@ -63310,43 +63303,11 @@ function constructorSignature(schemaClass2, members, context, genericEnvironment
|
|
|
63310
63303
|
defaultValue: "defaultValue" in resolved ? resolved.defaultValue : void 0
|
|
63311
63304
|
};
|
|
63312
63305
|
} catch {
|
|
63313
|
-
if (projections.some((projection) => projection.memberId === memberId)) {
|
|
63314
|
-
return { required: true };
|
|
63315
|
-
}
|
|
63316
63306
|
return null;
|
|
63317
63307
|
}
|
|
63318
63308
|
}
|
|
63319
63309
|
);
|
|
63320
|
-
return {
|
|
63321
|
-
constructorSignature: {
|
|
63322
|
-
...signature,
|
|
63323
|
-
...projections.length === 0 ? {} : {
|
|
63324
|
-
namedProjections: projections.map((projection) => ({
|
|
63325
|
-
name: projection.parameterName,
|
|
63326
|
-
memberId: projection.memberId
|
|
63327
|
-
}))
|
|
63328
|
-
}
|
|
63329
|
-
}
|
|
63330
|
-
};
|
|
63331
|
-
}
|
|
63332
|
-
function inheritedConstructorProjections(schemaClass2, context) {
|
|
63333
|
-
const classesById2 = new Map(
|
|
63334
|
-
context.vm.classes.map((candidate) => [candidate.id, candidate])
|
|
63335
|
-
);
|
|
63336
|
-
const projections = [];
|
|
63337
|
-
const claimed = /* @__PURE__ */ new Set();
|
|
63338
|
-
const visited = /* @__PURE__ */ new Set();
|
|
63339
|
-
let current = schemaClass2;
|
|
63340
|
-
while (current !== void 0 && !visited.has(current.id)) {
|
|
63341
|
-
visited.add(current.id);
|
|
63342
|
-
for (const projection of current.constructorProjections ?? []) {
|
|
63343
|
-
if (claimed.has(projection.parameterName)) continue;
|
|
63344
|
-
claimed.add(projection.parameterName);
|
|
63345
|
-
projections.push(projection);
|
|
63346
|
-
}
|
|
63347
|
-
current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
|
|
63348
|
-
}
|
|
63349
|
-
return projections;
|
|
63310
|
+
return { constructorSignature: signature };
|
|
63350
63311
|
}
|
|
63351
63312
|
function declaredConstructors(schemaClass2, context) {
|
|
63352
63313
|
const requiredConstructorId2 = schemaClass2.requiredConstructorId;
|
|
@@ -64467,7 +64428,7 @@ var init_neoscript_language_context_adapter = __esm({
|
|
|
64467
64428
|
init_project_root_members();
|
|
64468
64429
|
init_project_file_registry();
|
|
64469
64430
|
init_analyzer_types();
|
|
64470
|
-
NEOSCRIPT_COMPILER_ADAPTER_REVISION =
|
|
64431
|
+
NEOSCRIPT_COMPILER_ADAPTER_REVISION = 3;
|
|
64471
64432
|
UNKNOWN_TYPE2 = {
|
|
64472
64433
|
kind: "primitive",
|
|
64473
64434
|
name: "unknown"
|
|
@@ -65932,7 +65893,11 @@ function resolveSemanticOwnerMembersForValues(document, targetValueIds, addition
|
|
|
65932
65893
|
}
|
|
65933
65894
|
return result;
|
|
65934
65895
|
}
|
|
65935
|
-
const graph = new MaterializedValueGraphContext(
|
|
65896
|
+
const graph = new MaterializedValueGraphContext(
|
|
65897
|
+
document,
|
|
65898
|
+
new Map(document.values.map((value) => [value.id, value])),
|
|
65899
|
+
new Map((additionalRoots ?? []).map((root) => [root.valueId, root.member]))
|
|
65900
|
+
);
|
|
65936
65901
|
const allValueIds = new Set(graph.valuesById.keys());
|
|
65937
65902
|
const semanticRoots = [
|
|
65938
65903
|
...additionalRoots ?? []
|
|
@@ -65994,7 +65959,7 @@ function resolveSemanticOwnerMembersForValues(document, targetValueIds, addition
|
|
|
65994
65959
|
}
|
|
65995
65960
|
return result;
|
|
65996
65961
|
}
|
|
65997
|
-
function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo) {
|
|
65962
|
+
function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo, genericEnvironmentForRow) {
|
|
65998
65963
|
const visiting = /* @__PURE__ */ new Set();
|
|
65999
65964
|
const normalizeLiteral = (value) => {
|
|
66000
65965
|
if (Array.isArray(value)) return value.map(normalizeLiteral);
|
|
@@ -66047,7 +66012,7 @@ function createTypedValueNormalizer(rows, document, childrenByContainerId, param
|
|
|
66047
66012
|
...typeof row.classId === "string" ? { classId: row.classId } : {},
|
|
66048
66013
|
...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
|
|
66049
66014
|
value,
|
|
66050
|
-
...
|
|
66015
|
+
...carriesSemanticConstructorArguments(row) ? {
|
|
66051
66016
|
constructorArgs: normalizeConstructorArgs(row.constructorArgs, row)
|
|
66052
66017
|
} : {}
|
|
66053
66018
|
};
|
|
@@ -66067,18 +66032,24 @@ function createTypedValueNormalizer(rows, document, childrenByContainerId, param
|
|
|
66067
66032
|
// the row's payload. Keep those strings literal instead of guessing
|
|
66068
66033
|
// that UUID-shaped values are further row references.
|
|
66069
66034
|
value: normalizeLiteral(row.value),
|
|
66070
|
-
...
|
|
66035
|
+
...carriesSemanticConstructorArguments(row) ? {
|
|
66071
66036
|
constructorArgs: normalizeConstructorArgs(row.constructorArgs, row)
|
|
66072
66037
|
} : {}
|
|
66073
66038
|
};
|
|
66074
66039
|
visiting.delete(valueId);
|
|
66075
66040
|
return normalized;
|
|
66076
66041
|
};
|
|
66042
|
+
function carriesSemanticConstructorArguments(row) {
|
|
66043
|
+
if (!isLiteralValueContent(row)) return false;
|
|
66044
|
+
const constructorArgs = row.constructorArgs;
|
|
66045
|
+
if (constructorArgs === void 0 || constructorArgs === null) return false;
|
|
66046
|
+
return typeof row.instanceConstructorId === "string" || Object.keys(constructorArgs).length > 0;
|
|
66047
|
+
}
|
|
66077
66048
|
const normalizeClassValue = (row, typeInfo) => {
|
|
66078
66049
|
if (!isStringRecord4(row.value)) return normalizeLiteral(row.value);
|
|
66079
66050
|
const effectiveClassId = row.classId ?? (typeInfo.type === 7 /* Class */ ? typeInfo.classId : void 0);
|
|
66080
66051
|
if (effectiveClassId === void 0) return normalizeLiteral(row.value);
|
|
66081
|
-
const env =
|
|
66052
|
+
const env = genericEnvironmentForRow(row);
|
|
66082
66053
|
const merged = mergeStoredInstanceSchema(
|
|
66083
66054
|
effectiveClassId,
|
|
66084
66055
|
document.classes,
|
|
@@ -66213,8 +66184,12 @@ function collectSoftOwnedConstructorArgumentValueIds(index, ownerValueId, preser
|
|
|
66213
66184
|
}
|
|
66214
66185
|
return collected;
|
|
66215
66186
|
}
|
|
66216
|
-
function rowGenericEnvironment(document, row) {
|
|
66217
|
-
const env = typeof row.classId === "string" ? resolveInstanceEnv(
|
|
66187
|
+
function rowGenericEnvironment(document, row, contextualRootMember) {
|
|
66188
|
+
const env = typeof row.classId === "string" ? resolveInstanceEnv(
|
|
66189
|
+
row.classId,
|
|
66190
|
+
contextualRootMember !== void 0 && isMemberClassBase(contextualRootMember) ? contextualRootMember.classArguments : void 0,
|
|
66191
|
+
document.classes
|
|
66192
|
+
) : /* @__PURE__ */ new Map();
|
|
66218
66193
|
for (const [paramId, binding] of envFromStamp(row.genericBindings)) {
|
|
66219
66194
|
env.set(paramId, binding);
|
|
66220
66195
|
}
|
|
@@ -66299,6 +66274,7 @@ var init_constructor_argument_ownership = __esm({
|
|
|
66299
66274
|
classesById;
|
|
66300
66275
|
membersById;
|
|
66301
66276
|
constructorsById;
|
|
66277
|
+
contextualRootMembersByValueId;
|
|
66302
66278
|
parameterTypesByValueId = /* @__PURE__ */ new Map();
|
|
66303
66279
|
settleConstructorParameter;
|
|
66304
66280
|
aggregateTypeByTargetValueId = /* @__PURE__ */ new Map();
|
|
@@ -66306,9 +66282,10 @@ var init_constructor_argument_ownership = __esm({
|
|
|
66306
66282
|
ownership;
|
|
66307
66283
|
constructor(document, rows = new Map(
|
|
66308
66284
|
document.values.map((value) => [value.id, value])
|
|
66309
|
-
)) {
|
|
66285
|
+
), contextualRootMembersByValueId = /* @__PURE__ */ new Map()) {
|
|
66310
66286
|
this.valuesById = rows;
|
|
66311
66287
|
this.document = { ...document, values: [...rows.values()] };
|
|
66288
|
+
this.contextualRootMembersByValueId = contextualRootMembersByValueId;
|
|
66312
66289
|
this.classesById = new Map(
|
|
66313
66290
|
document.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
66314
66291
|
);
|
|
@@ -66367,7 +66344,7 @@ var init_constructor_argument_ownership = __esm({
|
|
|
66367
66344
|
if (constructor2 === void 0 || constructor2.classId !== root.classId) {
|
|
66368
66345
|
return result;
|
|
66369
66346
|
}
|
|
66370
|
-
const env =
|
|
66347
|
+
const env = this.genericEnvironmentForRow(root);
|
|
66371
66348
|
for (let index = 0; index < constructor2.argumentTypes.length; index += 1) {
|
|
66372
66349
|
const parameterId = constructorActionParameterId(constructor2, index);
|
|
66373
66350
|
const rawTypeInfo = constructor2.argumentTypes[index];
|
|
@@ -66427,7 +66404,7 @@ var init_constructor_argument_ownership = __esm({
|
|
|
66427
66404
|
...settled,
|
|
66428
66405
|
member: substituteMember(
|
|
66429
66406
|
member,
|
|
66430
|
-
|
|
66407
|
+
this.genericEnvironmentForRow(owner),
|
|
66431
66408
|
this.document.members
|
|
66432
66409
|
)
|
|
66433
66410
|
};
|
|
@@ -66487,7 +66464,8 @@ var init_constructor_argument_ownership = __esm({
|
|
|
66487
66464
|
return resolved;
|
|
66488
66465
|
},
|
|
66489
66466
|
(memberId) => this.membersById.get(memberId),
|
|
66490
|
-
(member, env) => this.memberTypeInfo(member, env)
|
|
66467
|
+
(member, env) => this.memberTypeInfo(member, env),
|
|
66468
|
+
(row) => this.genericEnvironmentForRow(row)
|
|
66491
66469
|
);
|
|
66492
66470
|
}
|
|
66493
66471
|
ownerForValue(valueId) {
|
|
@@ -66577,7 +66555,8 @@ var init_constructor_argument_ownership = __esm({
|
|
|
66577
66555
|
this.childrenByContainerId,
|
|
66578
66556
|
(row) => this.constructorParameterTypes(row),
|
|
66579
66557
|
(memberId) => this.membersById.get(memberId),
|
|
66580
|
-
(member, env) => this.memberTypeInfo(member, env)
|
|
66558
|
+
(member, env) => this.memberTypeInfo(member, env),
|
|
66559
|
+
(row) => this.genericEnvironmentForRow(row)
|
|
66581
66560
|
);
|
|
66582
66561
|
return this.typedNormalizer;
|
|
66583
66562
|
}
|
|
@@ -66599,6 +66578,13 @@ var init_constructor_argument_ownership = __esm({
|
|
|
66599
66578
|
}
|
|
66600
66579
|
return rawTypeInfo;
|
|
66601
66580
|
}
|
|
66581
|
+
genericEnvironmentForRow(row) {
|
|
66582
|
+
return rowGenericEnvironment(
|
|
66583
|
+
this.document,
|
|
66584
|
+
row,
|
|
66585
|
+
this.contextualRootMembersByValueId.get(row.id)
|
|
66586
|
+
);
|
|
66587
|
+
}
|
|
66602
66588
|
memberTypeInfo(rawMember, env) {
|
|
66603
66589
|
try {
|
|
66604
66590
|
const member = substituteMember(rawMember, env, this.document.members);
|
|
@@ -67280,7 +67266,121 @@ function validateInternalRecordRelations(args) {
|
|
|
67280
67266
|
});
|
|
67281
67267
|
}
|
|
67282
67268
|
function resolveEffectiveClassRelations(args) {
|
|
67283
|
-
|
|
67269
|
+
return createEffectiveClassRelationResolver({
|
|
67270
|
+
classes: args.classes,
|
|
67271
|
+
relations: args.relations,
|
|
67272
|
+
contracts: args.contracts
|
|
67273
|
+
}).resolve(args.relationKind, args.sourceClassId);
|
|
67274
|
+
}
|
|
67275
|
+
function createEffectiveClassRelationResolver(args) {
|
|
67276
|
+
const contracts = args.contracts ?? INTERNAL_RECORD_RELATION_KIND_CONTRACTS;
|
|
67277
|
+
const contractsByKind = /* @__PURE__ */ new Map();
|
|
67278
|
+
for (const contract of contracts) {
|
|
67279
|
+
contractsByKind.set(contract.relationKind, contract);
|
|
67280
|
+
}
|
|
67281
|
+
const classesById2 = args.classesById ?? classIndexFor(args.classes);
|
|
67282
|
+
const classRelationsByKind = /* @__PURE__ */ new Map();
|
|
67283
|
+
const relationsByIdByKind = /* @__PURE__ */ new Map();
|
|
67284
|
+
const directByKindAndSource = /* @__PURE__ */ new Map();
|
|
67285
|
+
for (const relation of args.relations) {
|
|
67286
|
+
if (relation.sourceRecordKind !== "class" || relation.targetRecordKind !== "class") {
|
|
67287
|
+
continue;
|
|
67288
|
+
}
|
|
67289
|
+
const relations = classRelationsByKind.get(relation.relationKind);
|
|
67290
|
+
if (relations === void 0) {
|
|
67291
|
+
classRelationsByKind.set(relation.relationKind, [relation]);
|
|
67292
|
+
} else relations.push(relation);
|
|
67293
|
+
}
|
|
67294
|
+
const relationById = (relationKind, id2) => {
|
|
67295
|
+
let byId = relationsByIdByKind.get(relationKind);
|
|
67296
|
+
if (byId === void 0) {
|
|
67297
|
+
byId = indexById2(classRelationsByKind.get(relationKind) ?? []);
|
|
67298
|
+
relationsByIdByKind.set(relationKind, byId);
|
|
67299
|
+
}
|
|
67300
|
+
return byId.get(id2);
|
|
67301
|
+
};
|
|
67302
|
+
const ancestryByClassId = /* @__PURE__ */ new Map();
|
|
67303
|
+
const concreteDescendantsByClassId = /* @__PURE__ */ new Map();
|
|
67304
|
+
const childrenByClassId = /* @__PURE__ */ new Map();
|
|
67305
|
+
for (const schemaClass2 of args.classes) {
|
|
67306
|
+
if (schemaClass2.extendsClassId === void 0) continue;
|
|
67307
|
+
const children = childrenByClassId.get(schemaClass2.extendsClassId);
|
|
67308
|
+
if (children === void 0) {
|
|
67309
|
+
childrenByClassId.set(schemaClass2.extendsClassId, [schemaClass2.id]);
|
|
67310
|
+
} else {
|
|
67311
|
+
children.push(schemaClass2.id);
|
|
67312
|
+
}
|
|
67313
|
+
}
|
|
67314
|
+
const ancestry = (classId) => {
|
|
67315
|
+
const cached = ancestryByClassId.get(classId);
|
|
67316
|
+
if (cached !== void 0) return cached;
|
|
67317
|
+
const resolved = classAncestry(classId, classesById2);
|
|
67318
|
+
ancestryByClassId.set(classId, resolved);
|
|
67319
|
+
return resolved;
|
|
67320
|
+
};
|
|
67321
|
+
const concreteDescendants = (classId) => {
|
|
67322
|
+
const cached = concreteDescendantsByClassId.get(classId);
|
|
67323
|
+
if (cached !== void 0) return cached;
|
|
67324
|
+
if (!classesById2.has(classId)) return [];
|
|
67325
|
+
const result = [];
|
|
67326
|
+
const pending = [classId];
|
|
67327
|
+
const visited = /* @__PURE__ */ new Set();
|
|
67328
|
+
while (pending.length > 0) {
|
|
67329
|
+
const candidateId = pending.pop();
|
|
67330
|
+
if (visited.has(candidateId)) {
|
|
67331
|
+
throw new Error(
|
|
67332
|
+
`Class inheritance contains a cycle at "${candidateId}".`
|
|
67333
|
+
);
|
|
67334
|
+
}
|
|
67335
|
+
visited.add(candidateId);
|
|
67336
|
+
const candidate = classesById2.get(candidateId);
|
|
67337
|
+
if (candidate !== void 0 && !candidate.isAbstract) {
|
|
67338
|
+
result.push(candidate.id);
|
|
67339
|
+
}
|
|
67340
|
+
for (const childId of childrenByClassId.get(candidateId) ?? []) {
|
|
67341
|
+
pending.push(childId);
|
|
67342
|
+
}
|
|
67343
|
+
}
|
|
67344
|
+
result.sort((left, right) => left.localeCompare(right));
|
|
67345
|
+
concreteDescendantsByClassId.set(classId, result);
|
|
67346
|
+
return result;
|
|
67347
|
+
};
|
|
67348
|
+
const directClassRelations = (relationKind, sourceClassId) => {
|
|
67349
|
+
let bySource = directByKindAndSource.get(relationKind);
|
|
67350
|
+
if (bySource === void 0) {
|
|
67351
|
+
bySource = /* @__PURE__ */ new Map();
|
|
67352
|
+
for (const relation of classRelationsByKind.get(relationKind) ?? []) {
|
|
67353
|
+
const declarations = bySource.get(relation.sourceRecordId);
|
|
67354
|
+
if (declarations === void 0) {
|
|
67355
|
+
bySource.set(relation.sourceRecordId, [relation]);
|
|
67356
|
+
} else declarations.push(relation);
|
|
67357
|
+
}
|
|
67358
|
+
directByKindAndSource.set(relationKind, bySource);
|
|
67359
|
+
}
|
|
67360
|
+
return bySource.get(sourceClassId) ?? [];
|
|
67361
|
+
};
|
|
67362
|
+
const resolve5 = (relationKind, sourceClassId) => {
|
|
67363
|
+
const contract = contractsByKind.get(relationKind);
|
|
67364
|
+
return resolveEffectiveClassRelationsFromIndex({
|
|
67365
|
+
relationKind,
|
|
67366
|
+
sourceClassId,
|
|
67367
|
+
contract,
|
|
67368
|
+
ancestry,
|
|
67369
|
+
concreteDescendants,
|
|
67370
|
+
directClassRelations
|
|
67371
|
+
});
|
|
67372
|
+
};
|
|
67373
|
+
return {
|
|
67374
|
+
classesById: classesById2,
|
|
67375
|
+
relationById,
|
|
67376
|
+
directClassRelations,
|
|
67377
|
+
classAncestry: ancestry,
|
|
67378
|
+
concreteClassDescendants: concreteDescendants,
|
|
67379
|
+
resolve: resolve5
|
|
67380
|
+
};
|
|
67381
|
+
}
|
|
67382
|
+
function resolveEffectiveClassRelationsFromIndex(args) {
|
|
67383
|
+
const contract = args.contract;
|
|
67284
67384
|
if (contract === void 0) {
|
|
67285
67385
|
throw new Error(`Unknown internal relation kind "${args.relationKind}".`);
|
|
67286
67386
|
}
|
|
@@ -67292,15 +67392,12 @@ function resolveEffectiveClassRelations(args) {
|
|
|
67292
67392
|
`Internal relation kind "${args.relationKind}" is not class-to-class.`
|
|
67293
67393
|
);
|
|
67294
67394
|
}
|
|
67295
|
-
const
|
|
67296
|
-
args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
67297
|
-
);
|
|
67298
|
-
const sourceIds = contract.sourceClassPolicy === "include-descendants" ? classAncestry(args.sourceClassId, classesById2) : [args.sourceClassId];
|
|
67395
|
+
const sourceIds = contract.sourceClassPolicy === "include-descendants" ? args.ancestry(args.sourceClassId) : [args.sourceClassId];
|
|
67299
67396
|
const sourceDepth = new Map(
|
|
67300
67397
|
sourceIds.map((sourceId3, index) => [sourceId3, index])
|
|
67301
67398
|
);
|
|
67302
|
-
const declarations =
|
|
67303
|
-
(
|
|
67399
|
+
const declarations = sourceIds.flatMap(
|
|
67400
|
+
(sourceId3) => args.directClassRelations(args.relationKind, sourceId3)
|
|
67304
67401
|
);
|
|
67305
67402
|
if (contract.merge === "nearest-single") {
|
|
67306
67403
|
const sorted = declarations.sort(
|
|
@@ -67322,11 +67419,7 @@ function resolveEffectiveClassRelations(args) {
|
|
|
67322
67419
|
const byTarget = /* @__PURE__ */ new Map();
|
|
67323
67420
|
for (const declaration of declarations) {
|
|
67324
67421
|
const declarationDepth = sourceDepth.get(declaration.sourceRecordId) ?? 0;
|
|
67325
|
-
const targetIds = contract.targetClassPolicy === "include-descendants" ?
|
|
67326
|
-
declaration.targetRecordId,
|
|
67327
|
-
args.classes,
|
|
67328
|
-
classesById2
|
|
67329
|
-
) : [declaration.targetRecordId];
|
|
67422
|
+
const targetIds = contract.targetClassPolicy === "include-descendants" ? args.concreteDescendants(declaration.targetRecordId) : [declaration.targetRecordId];
|
|
67330
67423
|
for (const targetId of targetIds) {
|
|
67331
67424
|
const current = byTarget.get(targetId);
|
|
67332
67425
|
if (current === void 0) {
|
|
@@ -67523,12 +67616,6 @@ function classAncestry(classId, classesById2) {
|
|
|
67523
67616
|
}
|
|
67524
67617
|
return result;
|
|
67525
67618
|
}
|
|
67526
|
-
function concreteClassDescendants(classId, classes, classesById2) {
|
|
67527
|
-
if (!classesById2.has(classId)) return [];
|
|
67528
|
-
return classes.filter(
|
|
67529
|
-
(candidate) => !candidate.isAbstract && classAncestry(candidate.id, classesById2).includes(classId)
|
|
67530
|
-
).map((candidate) => candidate.id).sort((left, right) => left.localeCompare(right));
|
|
67531
|
-
}
|
|
67532
67619
|
function effectiveRelation(relation, targetRecordId, sourceAncestryDepth) {
|
|
67533
67620
|
return {
|
|
67534
67621
|
relationKind: relation.relationKind,
|
|
@@ -67560,7 +67647,9 @@ var InternalRecordRelationKind, INTERNAL_RECORD_RELATION_KIND_CONTRACTS;
|
|
|
67560
67647
|
var init_internal_record_relations = __esm({
|
|
67561
67648
|
"../src/models/project/internal-record-relations.ts"() {
|
|
67562
67649
|
"use strict";
|
|
67650
|
+
init_collections();
|
|
67563
67651
|
init_classes();
|
|
67652
|
+
init_inheritance();
|
|
67564
67653
|
init_core();
|
|
67565
67654
|
init_project_version_types();
|
|
67566
67655
|
InternalRecordRelationKind = {
|
|
@@ -67716,6 +67805,7 @@ function makeEvaluatorLookups(members, values, options = {}) {
|
|
|
67716
67805
|
const lookups = {
|
|
67717
67806
|
memberById: (id2) => attrMap.get(id2) ?? null,
|
|
67718
67807
|
valueById: (id2) => valMap.get(id2) ?? null,
|
|
67808
|
+
hasStoredValueId: (id2) => valMap.has(id2),
|
|
67719
67809
|
unorderedListEntryIds: (containerValueId) => unorderedListMembership.get(containerValueId) ?? [],
|
|
67720
67810
|
// An index over a plain row set has no virtual expansion: every row it
|
|
67721
67811
|
// can answer with is already in `values`.
|
|
@@ -67747,9 +67837,20 @@ function evalMemberById(vm, id2) {
|
|
|
67747
67837
|
function evalValueById(ctx, id2, runtimeValues, overlayValues) {
|
|
67748
67838
|
const vm = ctx.vm;
|
|
67749
67839
|
const runtime = runtimeValues?.get(id2);
|
|
67750
|
-
if (runtime !== void 0)
|
|
67840
|
+
if (runtime !== void 0) {
|
|
67841
|
+
if (vm.databaseVM?.hasStoredValueId?.(id2) ?? true) {
|
|
67842
|
+
ctx.valueDependencies?.add(id2);
|
|
67843
|
+
}
|
|
67844
|
+
return runtime;
|
|
67845
|
+
}
|
|
67751
67846
|
const overlay = overlayValues?.get(id2);
|
|
67752
|
-
if (overlay !== void 0)
|
|
67847
|
+
if (overlay !== void 0) {
|
|
67848
|
+
if (vm.databaseVM?.hasStoredValueId?.(id2) ?? true) {
|
|
67849
|
+
ctx.valueDependencies?.add(id2);
|
|
67850
|
+
}
|
|
67851
|
+
return overlay;
|
|
67852
|
+
}
|
|
67853
|
+
ctx.valueDependencies?.add(id2);
|
|
67753
67854
|
if (vm.databaseVM?.valueById) return vm.databaseVM.valueById(id2);
|
|
67754
67855
|
return vm.values.find((v) => v.id === id2) ?? null;
|
|
67755
67856
|
}
|
|
@@ -68159,6 +68260,9 @@ function resolveRuntimeReferenceRow(sourceValueId, ctx, withProvenance) {
|
|
|
68159
68260
|
if (!withProvenance) return direct;
|
|
68160
68261
|
const receiver = trackedRowForValueReference(ctx.thisValue, ctx);
|
|
68161
68262
|
if (receiver === null) return direct;
|
|
68263
|
+
ctx.onUnattributableValueRead?.(
|
|
68264
|
+
`runtime-reference-provenance:${sourceValueId}`
|
|
68265
|
+
);
|
|
68162
68266
|
const indexes = evaluatorIndexes(ctx);
|
|
68163
68267
|
const virtualRows = ctx.vm.databaseVM?.virtualInstanceRowsForValue(receiver.id) ?? [];
|
|
68164
68268
|
if (virtualRows.length > 0) {
|
|
@@ -68265,12 +68369,8 @@ function evaluatorResolutionCache(ctx) {
|
|
|
68265
68369
|
compiledFunctionByMemberId: /* @__PURE__ */ new Map(),
|
|
68266
68370
|
compiledGetterByMemberId: /* @__PURE__ */ new Map(),
|
|
68267
68371
|
compiledSetterByMemberId: /* @__PURE__ */ new Map(),
|
|
68268
|
-
|
|
68269
|
-
storedInstanceSchemaByClassId: /* @__PURE__ */ new Map(),
|
|
68270
|
-
instanceEnvByKey: /* @__PURE__ */ new Map(),
|
|
68372
|
+
defaultValueResolutionCache: createDefaultValueResolutionCache(),
|
|
68271
68373
|
validatedConstructorDescriptorByInfo: /* @__PURE__ */ new WeakMap(),
|
|
68272
|
-
validatedInitValueContents: /* @__PURE__ */ new WeakSet(),
|
|
68273
|
-
storedInstanceMaterializationPlanByClassAndEnv: /* @__PURE__ */ new Map(),
|
|
68274
68374
|
effectiveStorageResolver: void 0
|
|
68275
68375
|
};
|
|
68276
68376
|
resolutionCacheByMembers.set(members, {
|
|
@@ -68283,37 +68383,31 @@ function evaluatorResolutionCache(ctx) {
|
|
|
68283
68383
|
return cache;
|
|
68284
68384
|
}
|
|
68285
68385
|
function cachedResolvedMember(member, ctx) {
|
|
68286
|
-
|
|
68287
|
-
if (typeof memberId !== "string") {
|
|
68288
|
-
return resolveMember2(member, ctx.vm.members);
|
|
68289
|
-
}
|
|
68290
|
-
const cache = evaluatorResolutionCache(ctx).resolvedMemberById;
|
|
68291
|
-
const cached = cache.get(memberId);
|
|
68292
|
-
if (cached !== void 0) return cached;
|
|
68293
|
-
const resolved = resolveMember2(member, ctx.vm.members);
|
|
68294
|
-
cache.set(memberId, resolved);
|
|
68295
|
-
return resolved;
|
|
68386
|
+
return evaluatorDefaultValueDocument(ctx).resolvedMember(member);
|
|
68296
68387
|
}
|
|
68297
68388
|
function cachedStoredInstanceSchema(classId, ctx) {
|
|
68298
|
-
|
|
68299
|
-
|
|
68300
|
-
|
|
68301
|
-
|
|
68389
|
+
return evaluatorDefaultValueDocument(ctx).storedInstanceSchema(classId);
|
|
68390
|
+
}
|
|
68391
|
+
function cachedStoredInstanceMaterializationPlan(classId, instanceEnv, ctx) {
|
|
68392
|
+
return evaluatorDefaultValueDocument(ctx).storedInstanceMaterializationPlan(
|
|
68302
68393
|
classId,
|
|
68303
|
-
|
|
68304
|
-
ctx.vm.members
|
|
68394
|
+
instanceEnv
|
|
68305
68395
|
);
|
|
68306
|
-
cache.set(classId, merged);
|
|
68307
|
-
return merged;
|
|
68308
68396
|
}
|
|
68309
|
-
function
|
|
68310
|
-
|
|
68311
|
-
|
|
68312
|
-
|
|
68313
|
-
|
|
68314
|
-
|
|
68315
|
-
|
|
68316
|
-
|
|
68397
|
+
function cachedInstanceEnv(classId, classArguments2, ctx) {
|
|
68398
|
+
return evaluatorDefaultValueDocument(ctx).instanceEnv(
|
|
68399
|
+
classId,
|
|
68400
|
+
classArguments2
|
|
68401
|
+
);
|
|
68402
|
+
}
|
|
68403
|
+
function cachedIsInitValueContent(value, ctx) {
|
|
68404
|
+
return evaluatorDefaultValueDocument(ctx).isInitValueContent(value);
|
|
68405
|
+
}
|
|
68406
|
+
function evaluatorDefaultValueDocument(ctx) {
|
|
68407
|
+
if (ctx.__defaultValueDocument !== void 0) {
|
|
68408
|
+
return ctx.__defaultValueDocument;
|
|
68409
|
+
}
|
|
68410
|
+
const document = withIndexedDefaultValueDocument(
|
|
68317
68411
|
{
|
|
68318
68412
|
project: ctx.vm.project,
|
|
68319
68413
|
members: ctx.vm.members,
|
|
@@ -68322,37 +68416,13 @@ function cachedStoredInstanceMaterializationPlan(classId, instanceEnv, ctx) {
|
|
|
68322
68416
|
values: ctx.vm.values,
|
|
68323
68417
|
memberById: ctx.vm.databaseVM?.memberById,
|
|
68324
68418
|
valueById: ctx.vm.databaseVM?.valueById,
|
|
68325
|
-
resolvedMember: (member) => cachedResolvedMember(member, ctx),
|
|
68326
|
-
storedInstanceSchema: (nestedClassId) => cachedStoredInstanceSchema(nestedClassId, ctx),
|
|
68327
|
-
instanceEnv: (nestedClassId, classArguments2) => cachedInstanceEnv(nestedClassId, classArguments2, ctx),
|
|
68328
|
-
isInitValueContent: (value) => cachedIsInitValueContent(value, ctx),
|
|
68329
68419
|
projectFiles: ctx.vm.projectFiles ?? [],
|
|
68330
68420
|
textureTemplates: ctx.vm.textureTemplates ?? []
|
|
68331
68421
|
},
|
|
68332
|
-
|
|
68333
|
-
instanceEnv
|
|
68422
|
+
{ cache: evaluatorResolutionCache(ctx).defaultValueResolutionCache }
|
|
68334
68423
|
);
|
|
68335
|
-
|
|
68336
|
-
|
|
68337
|
-
cache.set(classId, byEnvironment);
|
|
68338
|
-
return plan;
|
|
68339
|
-
}
|
|
68340
|
-
function cachedInstanceEnv(classId, classArguments2, ctx) {
|
|
68341
|
-
const key = `${classId}:${JSON.stringify(classArguments2 ?? null)}`;
|
|
68342
|
-
const cache = evaluatorResolutionCache(ctx).instanceEnvByKey;
|
|
68343
|
-
const cached = cache.get(key);
|
|
68344
|
-
if (cached !== void 0) return cached;
|
|
68345
|
-
const resolved = resolveInstanceEnv(classId, classArguments2, ctx.vm.classes);
|
|
68346
|
-
cache.set(key, resolved);
|
|
68347
|
-
return resolved;
|
|
68348
|
-
}
|
|
68349
|
-
function cachedIsInitValueContent(value, ctx) {
|
|
68350
|
-
if (typeof value !== "object" || value === null) return false;
|
|
68351
|
-
const cache = evaluatorResolutionCache(ctx).validatedInitValueContents;
|
|
68352
|
-
if (cache.has(value)) return true;
|
|
68353
|
-
if (!isInitValueContent(value)) return false;
|
|
68354
|
-
cache.add(value);
|
|
68355
|
-
return true;
|
|
68424
|
+
ctx.__defaultValueDocument = document;
|
|
68425
|
+
return document;
|
|
68356
68426
|
}
|
|
68357
68427
|
function sessionCreationCheckpoint(ctx) {
|
|
68358
68428
|
if (ctx.__sessionCreationStrategy === "snapshot") {
|
|
@@ -68799,6 +68869,9 @@ function finalizeConstructorAllocations(ctx, returnValue, ownsInvocationState, r
|
|
|
68799
68869
|
}
|
|
68800
68870
|
}
|
|
68801
68871
|
}
|
|
68872
|
+
ctx.onUnattributableValueRead?.(
|
|
68873
|
+
`constructor-argument-list:${argumentId}`
|
|
68874
|
+
);
|
|
68802
68875
|
for (const candidate of evaluatorValues(ctx)) {
|
|
68803
68876
|
if (candidate.containerId === argumentId) {
|
|
68804
68877
|
scanCreationDataRow({
|
|
@@ -68856,6 +68929,7 @@ function finalizeConstructorAllocations(ctx, returnValue, ownsInvocationState, r
|
|
|
68856
68929
|
if (member !== null && isMemberListBase(member)) {
|
|
68857
68930
|
const entryMember = evalMemberById(ctx.vm, member.entryMemberId);
|
|
68858
68931
|
if (member.listKind === "unordered") {
|
|
68932
|
+
ctx.onUnattributableValueRead?.(`constructed-unordered-list:${row.id}`);
|
|
68859
68933
|
for (const candidate of evaluatorValues(ctx)) {
|
|
68860
68934
|
if (candidate.containerId === row.id) {
|
|
68861
68935
|
scanOwnedRow(candidate.id, entryMember);
|
|
@@ -69150,6 +69224,11 @@ function parameterDefaultsAsFullArguments(argumentTypes, subject) {
|
|
|
69150
69224
|
if (!argumentTypes.every(parameterHasDefault)) return null;
|
|
69151
69225
|
return fillTrailingParameterDefaults([], argumentTypes, subject);
|
|
69152
69226
|
}
|
|
69227
|
+
function declarationInitializerArgumentValues(argumentTypes, subject, readsConstructorParameter) {
|
|
69228
|
+
const defaults = parameterDefaultsAsFullArguments(argumentTypes, subject);
|
|
69229
|
+
if (defaults !== null) return defaults;
|
|
69230
|
+
return readsConstructorParameter ? [] : argumentTypes.map(() => null);
|
|
69231
|
+
}
|
|
69153
69232
|
function fillCallableCallSiteArguments(args, member, ctx) {
|
|
69154
69233
|
if (member === null) return args;
|
|
69155
69234
|
if (member.kind !== 13 /* Function */ && member.kind !== 23 /* NSFunction */) {
|
|
@@ -70302,6 +70381,7 @@ function staticBindingTargetId(member, ctx) {
|
|
|
70302
70381
|
`Member '${member.name}' is not a static member.`
|
|
70303
70382
|
);
|
|
70304
70383
|
}
|
|
70384
|
+
ctx.staticMemberDependencies?.add(member.id);
|
|
70305
70385
|
const storage = effectiveStaticStorage(member.id, ctx);
|
|
70306
70386
|
const bindings = storage === "save" /* Save */ ? ctx.__saveStaticBindings : storage === "session" /* Session */ ? ctx.__sessionStaticBindings : void 0;
|
|
70307
70387
|
if (bindings?.has(member.id)) return bindings.get(member.id) ?? null;
|
|
@@ -70349,7 +70429,6 @@ function evalStaticMember(memberId, ctx) {
|
|
|
70349
70429
|
`Static member '${member.name}' is bound to missing value '${targetId}'.`
|
|
70350
70430
|
);
|
|
70351
70431
|
}
|
|
70352
|
-
ctx.valueDependencies?.add(row.id);
|
|
70353
70432
|
return row.value;
|
|
70354
70433
|
}
|
|
70355
70434
|
function evalPointer(pointer, scope, ctx) {
|
|
@@ -70958,6 +71037,7 @@ function delegateClosureLexicalThis(closure, ctx) {
|
|
|
70958
71037
|
"Stored NeoDelegate closure has no resolvable value row; lexical this cannot be reconstructed from ownership."
|
|
70959
71038
|
);
|
|
70960
71039
|
}
|
|
71040
|
+
ctx.onUnattributableValueRead?.(`delegate-owner-resolution:${closureRow.id}`);
|
|
70961
71041
|
const owners = [];
|
|
70962
71042
|
const indexes = evaluatorIndexes(ctx);
|
|
70963
71043
|
for (const [ancestorId, distance] of evaluatorOwnershipDistances(
|
|
@@ -71118,6 +71198,7 @@ function runtimeGenericEnvForValueRow(row, ctx, visited) {
|
|
|
71118
71198
|
}
|
|
71119
71199
|
function runtimeParentGenericEnv(row, ctx, visited) {
|
|
71120
71200
|
const result = /* @__PURE__ */ new Map();
|
|
71201
|
+
ctx.onUnattributableValueRead?.(`generic-parent-resolution:${row.id}`);
|
|
71121
71202
|
for (const link of evaluatorParentLinks(evaluatorIndexes(ctx), row.id)) {
|
|
71122
71203
|
const parent = evalValueById(
|
|
71123
71204
|
ctx,
|
|
@@ -71691,7 +71772,7 @@ function evalKeyOf(keyOf, scope, ctx, optional = false, memberId, onReceiver) {
|
|
|
71691
71772
|
if (dispatched.kind === "ok") return dispatched.value;
|
|
71692
71773
|
if (!dispatched.matchedMember && memberId !== void 0) {
|
|
71693
71774
|
const member = evalMemberById(ctx.vm, memberId);
|
|
71694
|
-
const defaultValue = readOnlyDeclarationDefault(member,
|
|
71775
|
+
const defaultValue = readOnlyDeclarationDefault(member, ctx);
|
|
71695
71776
|
if (defaultValue.matched) return defaultValue.value;
|
|
71696
71777
|
}
|
|
71697
71778
|
if (Object.prototype.hasOwnProperty.call(receiver, k)) {
|
|
@@ -71714,8 +71795,6 @@ function dispatchSchemaMember(receiver, schemaKey, ctx) {
|
|
|
71714
71795
|
}
|
|
71715
71796
|
const member = resolveRuntimeSchemaMember(receiver, schemaKey, ctx);
|
|
71716
71797
|
if (!member) return { kind: "no-info", matchedMember: false };
|
|
71717
|
-
const defaultValue = readOnlyDeclarationDefault(member, member.id, ctx);
|
|
71718
|
-
if (defaultValue.matched) return { kind: "ok", value: defaultValue.value };
|
|
71719
71798
|
if (member.kind === 10 /* NSProperty */) {
|
|
71720
71799
|
if (!resolveCompiledGetter(member.id, ctx)) {
|
|
71721
71800
|
return { kind: "no-info", matchedMember: true };
|
|
@@ -71725,6 +71804,8 @@ function dispatchSchemaMember(receiver, schemaKey, ctx) {
|
|
|
71725
71804
|
value: dispatchNSGetterById(member.id, receiver, ctx)
|
|
71726
71805
|
};
|
|
71727
71806
|
}
|
|
71807
|
+
const defaultValue = readOnlyDeclarationDefault(member, ctx);
|
|
71808
|
+
if (defaultValue.matched) return { kind: "ok", value: defaultValue.value };
|
|
71728
71809
|
if (!Object.prototype.hasOwnProperty.call(receiver, schemaKey)) {
|
|
71729
71810
|
const expanded = virtualExpandedRecordForReceiver(receiver, ctx);
|
|
71730
71811
|
if (expanded !== null && Object.prototype.hasOwnProperty.call(expanded, schemaKey)) {
|
|
@@ -71756,13 +71837,11 @@ function virtualExpandedRecordForReceiver(receiver, ctx) {
|
|
|
71756
71837
|
}
|
|
71757
71838
|
return record3;
|
|
71758
71839
|
}
|
|
71759
|
-
function readOnlyDeclarationDefault(member,
|
|
71840
|
+
function readOnlyDeclarationDefault(member, ctx) {
|
|
71760
71841
|
const readOnly = member?.isReadOnly;
|
|
71761
71842
|
if (readOnly !== true) return { matched: false };
|
|
71762
71843
|
if (member?.defaultValue === void 0 || member.defaultValue === null) {
|
|
71763
|
-
|
|
71764
|
-
`Read-only member '${member?.name ?? memberId}' has no declaration default.`
|
|
71765
|
-
);
|
|
71844
|
+
return { matched: false };
|
|
71766
71845
|
}
|
|
71767
71846
|
let value = member.defaultValue.value;
|
|
71768
71847
|
if (isMemberString(member) && member.localizable !== false && typeof value === "string") {
|
|
@@ -71833,7 +71912,6 @@ function resolveValueIfId(at, ctx) {
|
|
|
71833
71912
|
ctx.__valueOverlay
|
|
71834
71913
|
);
|
|
71835
71914
|
if (!row) return at;
|
|
71836
|
-
ctx.valueDependencies?.add(row.id);
|
|
71837
71915
|
const member = memberForValueRow(row, ctx);
|
|
71838
71916
|
if (member !== null && isMemberListBase(member) && member.listKind === "unordered" && Array.isArray(row.value)) {
|
|
71839
71917
|
return evaluatorUnorderedListEntryIds(row.id, ctx);
|
|
@@ -71850,7 +71928,6 @@ function resolveValueIfIdForMember(at, member, ctx) {
|
|
|
71850
71928
|
ctx.__valueOverlay
|
|
71851
71929
|
);
|
|
71852
71930
|
if (!row) return at;
|
|
71853
|
-
ctx.valueDependencies?.add(row.id);
|
|
71854
71931
|
if (isMemberListBase(member) && member.listKind === "unordered" && Array.isArray(row.value)) {
|
|
71855
71932
|
return evaluatorUnorderedListEntryIds(row.id, ctx);
|
|
71856
71933
|
}
|
|
@@ -71858,6 +71935,7 @@ function resolveValueIfIdForMember(at, member, ctx) {
|
|
|
71858
71935
|
return shouldUnwrapSingleLookupValue(member) ? unwrapSingleLookupValue(value, ctx) : value;
|
|
71859
71936
|
}
|
|
71860
71937
|
function evaluatorUnorderedListEntryIds(containerValueId, ctx) {
|
|
71938
|
+
ctx.containerDependencies?.add(containerValueId);
|
|
71861
71939
|
const runtimeRows = [...ctx.__runtimeSessionValues?.values() ?? []];
|
|
71862
71940
|
const overlayRows = [...ctx.__valueOverlay?.values() ?? []];
|
|
71863
71941
|
const localRows = [...runtimeRows, ...overlayRows];
|
|
@@ -71883,7 +71961,6 @@ function unwrapSingleLookupValue(value, ctx) {
|
|
|
71883
71961
|
ctx.__valueOverlay
|
|
71884
71962
|
);
|
|
71885
71963
|
if (next) {
|
|
71886
|
-
ctx.valueDependencies?.add(next.id);
|
|
71887
71964
|
return next.value;
|
|
71888
71965
|
}
|
|
71889
71966
|
}
|
|
@@ -71924,6 +72001,7 @@ function resolveMemberForValueRow(row, ctx, visited) {
|
|
|
71924
72001
|
if (syntheticMemberId !== null) {
|
|
71925
72002
|
return evalMemberById(ctx.vm, syntheticMemberId);
|
|
71926
72003
|
}
|
|
72004
|
+
ctx.onUnattributableValueRead?.(`member-owner-resolution:${row.id}`);
|
|
71927
72005
|
for (const link of evaluatorParentLinks(indexes, row.id)) {
|
|
71928
72006
|
const parent = evalValueById(
|
|
71929
72007
|
ctx,
|
|
@@ -71988,13 +72066,11 @@ function memberIdFromSyntheticDefaultValueId(valueId) {
|
|
|
71988
72066
|
return valueId.slice(prefix.length, -suffix.length);
|
|
71989
72067
|
}
|
|
71990
72068
|
function resolveLocalizedTextId(value, ctx) {
|
|
72069
|
+
ctx.localizedTextDependencies?.add(value);
|
|
71991
72070
|
const mainLocale = ctx.vm.localizationConfig?.mainLocale;
|
|
71992
72071
|
if (mainLocale === void 0) return value;
|
|
71993
|
-
const text = ctx.vm.localizedTexts?.find(
|
|
71994
|
-
|
|
71995
|
-
);
|
|
71996
|
-
if (text === void 0) return value;
|
|
71997
|
-
ctx.localizedTextDependencies?.add(text.id);
|
|
72072
|
+
const text = ctx.vm.databaseVM?.localizedTextById?.(value) ?? ctx.vm.localizedTexts?.find((candidate) => candidate.id === value) ?? null;
|
|
72073
|
+
if (text === null) return value;
|
|
71998
72074
|
return text.localeValues[mainLocale]?.value ?? "";
|
|
71999
72075
|
}
|
|
72000
72076
|
function evalOperation(operation, scope, ctx) {
|
|
@@ -73435,6 +73511,7 @@ function bindConstructedDelegateTargets(createdValues, ctx) {
|
|
|
73435
73511
|
`NeoDelegate method target '${target.name}' has no declaring Class placement.`
|
|
73436
73512
|
);
|
|
73437
73513
|
}
|
|
73514
|
+
ctx.onUnattributableValueRead?.(`constructed-delegate-owner:${row.id}`);
|
|
73438
73515
|
const matches = [];
|
|
73439
73516
|
for (const [ancestorId, distance] of evaluatorOwnershipDistances(
|
|
73440
73517
|
row.id,
|
|
@@ -74113,7 +74190,7 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
|
|
|
74113
74190
|
return (member, init, sourceValueId) => {
|
|
74114
74191
|
const memberId = Reflect.get(member, "id");
|
|
74115
74192
|
const effectiveMemberId = typeof memberId === "string" ? memberId : null;
|
|
74116
|
-
const scopeMemberId = indexes.initializerScopeMemberIds.get(init) ?? effectiveMemberId;
|
|
74193
|
+
const scopeMemberId = indexes.initializerScopeMemberIds.get(init) ?? (typeof sourceValueId !== "string" ? void 0 : indexes.initializerScopeMemberIdsByValueId.get(sourceValueId)) ?? effectiveMemberId;
|
|
74117
74194
|
const compiled = ensureInitializerCompiled({
|
|
74118
74195
|
init,
|
|
74119
74196
|
member,
|
|
@@ -74182,8 +74259,20 @@ function constructorInitializerIndexes(ctx) {
|
|
|
74182
74259
|
ctx.__constructorInitializerIndexes = built;
|
|
74183
74260
|
return built;
|
|
74184
74261
|
}
|
|
74262
|
+
function constructorById(constructorId, ctx) {
|
|
74263
|
+
if (ctx.__constructorById === void 0) {
|
|
74264
|
+
ctx.__constructorById = new Map(
|
|
74265
|
+
(ctx.vm.constructors ?? []).map((constructor2) => [
|
|
74266
|
+
constructor2.id,
|
|
74267
|
+
constructor2
|
|
74268
|
+
])
|
|
74269
|
+
);
|
|
74270
|
+
}
|
|
74271
|
+
return ctx.__constructorById.get(constructorId);
|
|
74272
|
+
}
|
|
74185
74273
|
function buildConstructorInitializerIndexes(vm) {
|
|
74186
74274
|
const initializerScopeMemberIds = /* @__PURE__ */ new WeakMap();
|
|
74275
|
+
const initializerScopeMemberIdsByValueId = /* @__PURE__ */ new Map();
|
|
74187
74276
|
const initializerByValueId = /* @__PURE__ */ new Map();
|
|
74188
74277
|
for (const row of vm.values) {
|
|
74189
74278
|
const initializer = Reflect.get(row, "init");
|
|
@@ -74214,8 +74303,12 @@ function buildConstructorInitializerIndexes(vm) {
|
|
|
74214
74303
|
);
|
|
74215
74304
|
if (typeof rootOwnerId === "string") {
|
|
74216
74305
|
initializerScopeMemberIds.set(initializer, rootOwnerId);
|
|
74306
|
+
initializerScopeMemberIdsByValueId.set(valueId, rootOwnerId);
|
|
74217
74307
|
}
|
|
74218
74308
|
}
|
|
74309
|
+
const classById = new Map(
|
|
74310
|
+
vm.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
74311
|
+
);
|
|
74219
74312
|
const declaringClassIdsByMemberId = /* @__PURE__ */ new Map();
|
|
74220
74313
|
for (const schemaClass2 of vm.classes) {
|
|
74221
74314
|
for (const memberId of Object.values(schemaClass2.schema)) {
|
|
@@ -74233,6 +74326,8 @@ function buildConstructorInitializerIndexes(vm) {
|
|
|
74233
74326
|
}
|
|
74234
74327
|
return {
|
|
74235
74328
|
initializerScopeMemberIds,
|
|
74329
|
+
initializerScopeMemberIdsByValueId,
|
|
74330
|
+
classById,
|
|
74236
74331
|
declaringClassIdsByMemberId,
|
|
74237
74332
|
memberById: memberById2,
|
|
74238
74333
|
containerMemberIdByEntryId
|
|
@@ -74460,6 +74555,12 @@ function recordConstructorGroupDependency(valueId, destination, ctx) {
|
|
|
74460
74555
|
}
|
|
74461
74556
|
function encodeRequiredConstructorArgument(args) {
|
|
74462
74557
|
const trackedId = findKnownRowIdByValueReference(args.value, args.ctx);
|
|
74558
|
+
const replayedAggregateId = trackedId === null && args.ctx.storedConstructionReplay === true && typeof args.value === "string" && evalValueById(
|
|
74559
|
+
args.ctx,
|
|
74560
|
+
args.value,
|
|
74561
|
+
args.ctx.__runtimeSessionValues,
|
|
74562
|
+
args.ctx.__valueOverlay
|
|
74563
|
+
) !== null ? args.value : null;
|
|
74463
74564
|
const adoptTracked = (id2, suffix) => {
|
|
74464
74565
|
if (constructorGroupForRow(id2, args.ctx) !== null) {
|
|
74465
74566
|
assertOwnedValueAttachable(
|
|
@@ -74482,18 +74583,20 @@ function encodeRequiredConstructorArgument(args) {
|
|
|
74482
74583
|
}
|
|
74483
74584
|
if (args.typeInfo.type === 7 /* Class */ || args.typeInfo.type === 22 /* Interface */) {
|
|
74484
74585
|
if (args.value === null || args.value === void 0) return null;
|
|
74485
|
-
|
|
74586
|
+
const aggregateId2 = trackedId ?? replayedAggregateId;
|
|
74587
|
+
if (aggregateId2 === null) {
|
|
74486
74588
|
throw new NSGetterRuntimeError(
|
|
74487
74589
|
`Constructor aggregate argument '${args.parameterId}' has no backing value row.`
|
|
74488
74590
|
);
|
|
74489
74591
|
}
|
|
74490
|
-
return adoptTracked(
|
|
74592
|
+
return adoptTracked(aggregateId2, "root");
|
|
74491
74593
|
}
|
|
74492
74594
|
if (args.typeInfo.type !== 6 /* List */ && args.typeInfo.type !== 5 /* Dictionary */) {
|
|
74493
74595
|
return cloneConstructorLiteralValue(args.value);
|
|
74494
74596
|
}
|
|
74495
74597
|
if (args.value === null || args.value === void 0) return null;
|
|
74496
|
-
|
|
74598
|
+
const aggregateId = trackedId ?? replayedAggregateId;
|
|
74599
|
+
if (aggregateId !== null) return adoptTracked(aggregateId, "root");
|
|
74497
74600
|
const collectionType = args.typeInfo;
|
|
74498
74601
|
const registerRow = (value, containerId) => {
|
|
74499
74602
|
const row2 = buildNewValue(args.ctx.vm.project.id, { value });
|
|
@@ -74601,10 +74704,9 @@ function resolveVariantGraph(selection2, ctx) {
|
|
|
74601
74704
|
"Base variant selection has no variant graph."
|
|
74602
74705
|
);
|
|
74603
74706
|
}
|
|
74604
|
-
|
|
74605
|
-
|
|
74606
|
-
)
|
|
74607
|
-
if (record3 === void 0) {
|
|
74707
|
+
ctx.variantDependencies?.add(variantId);
|
|
74708
|
+
const record3 = ctx.vm.databaseVM?.variantById?.(variantId) ?? (ctx.vm.variants ?? []).find((candidate) => candidate.id === variantId) ?? null;
|
|
74709
|
+
if (record3 === null) {
|
|
74608
74710
|
throw new NSGetterRuntimeError(
|
|
74609
74711
|
`Variant '${variantId}' does not exist in this project.`
|
|
74610
74712
|
);
|
|
@@ -75121,10 +75223,10 @@ function evalVariantApply(info, scope, ctx) {
|
|
|
75121
75223
|
graph,
|
|
75122
75224
|
ctx
|
|
75123
75225
|
);
|
|
75124
|
-
const
|
|
75125
|
-
if (
|
|
75226
|
+
const applyValue = graph.root.Apply;
|
|
75227
|
+
if (applyValue !== void 0 && applyValue !== null) {
|
|
75126
75228
|
invokeVariantClosure({
|
|
75127
|
-
closureValueId:
|
|
75229
|
+
closureValueId: applyValue,
|
|
75128
75230
|
ctx,
|
|
75129
75231
|
label: `Variant '${graph.name}' Apply`,
|
|
75130
75232
|
lexicalThis: null,
|
|
@@ -75469,6 +75571,7 @@ function currentOwnedValueAttachments(valueId, ctx) {
|
|
|
75469
75571
|
});
|
|
75470
75572
|
}
|
|
75471
75573
|
}
|
|
75574
|
+
ctx.onUnattributableValueRead?.(`owned-value-parents:${valueId}`);
|
|
75472
75575
|
const parentIds = new Set(
|
|
75473
75576
|
evaluatorParentLinks(indexes, valueId).map((link) => link.parentId)
|
|
75474
75577
|
);
|
|
@@ -75745,6 +75848,9 @@ function cloneConstructorArgumentGraph(args) {
|
|
|
75745
75848
|
if (member.listKind === "unordered") {
|
|
75746
75849
|
clone.value = [];
|
|
75747
75850
|
const entryEnv2 = envFromStamp(clone.genericBindings);
|
|
75851
|
+
args.ctx.onUnattributableValueRead?.(
|
|
75852
|
+
`constructor-import-list:${source.id}`
|
|
75853
|
+
);
|
|
75748
75854
|
const entries = evaluatorValues(args.ctx).filter((row) => row.containerId === source.id).sort((left, right) => left.id.localeCompare(right.id));
|
|
75749
75855
|
for (const entry of entries) {
|
|
75750
75856
|
cloneRow2(entry, entryMember, entryEnv2, clone.id);
|
|
@@ -75875,7 +75981,19 @@ function materializeConstructorArgumentValue(args) {
|
|
|
75875
75981
|
args.ctx.vm.members
|
|
75876
75982
|
);
|
|
75877
75983
|
const row = registerConstructorArgumentRow(args, []);
|
|
75878
|
-
|
|
75984
|
+
let sourceEntries = args.value;
|
|
75985
|
+
if (args.member.listKind === "unordered" && trackedValueId !== null) {
|
|
75986
|
+
args.ctx.onUnattributableValueRead?.(
|
|
75987
|
+
`constructor-argument-list:${trackedValueId}`
|
|
75988
|
+
);
|
|
75989
|
+
const rows = [];
|
|
75990
|
+
for (const entry of evaluatorValues(args.ctx)) {
|
|
75991
|
+
if (entry.containerId === trackedValueId) rows.push(entry);
|
|
75992
|
+
}
|
|
75993
|
+
rows.sort((left, right) => left.id.localeCompare(right.id));
|
|
75994
|
+
sourceEntries = [];
|
|
75995
|
+
for (const entry of rows) sourceEntries.push(entry.value);
|
|
75996
|
+
}
|
|
75879
75997
|
const ids = [];
|
|
75880
75998
|
for (const [index, rawEntry] of sourceEntries.entries()) {
|
|
75881
75999
|
const entryValue = constructorCollectionEntryValue(
|
|
@@ -76072,6 +76190,7 @@ function cloneClassValueGraph(receiver, expectedClassId, ctx) {
|
|
|
76072
76190
|
const active = /* @__PURE__ */ new Set();
|
|
76073
76191
|
const clonedBySourceId = /* @__PURE__ */ new Map();
|
|
76074
76192
|
const constructorArgumentReferenceCounts = /* @__PURE__ */ new Map();
|
|
76193
|
+
ctx.onUnattributableValueRead?.(`class-clone:${sourceId3}`);
|
|
76075
76194
|
for (const candidate of evaluatorValues(ctx)) {
|
|
76076
76195
|
for (const argument2 of ownedConstructorArgumentValues(candidate, ctx)) {
|
|
76077
76196
|
constructorArgumentReferenceCounts.set(
|
|
@@ -76080,7 +76199,95 @@ function cloneClassValueGraph(receiver, expectedClassId, ctx) {
|
|
|
76080
76199
|
);
|
|
76081
76200
|
}
|
|
76082
76201
|
}
|
|
76083
|
-
|
|
76202
|
+
function cloneInitializerRow(sourceRow, sourceMember, id2, clonedContainerId, sourceTypeInfo) {
|
|
76203
|
+
if (sourceMember === null) {
|
|
76204
|
+
throw new NSGetterRuntimeError(
|
|
76205
|
+
`Class.Clone cannot evaluate initializer-backed value '${sourceRow.id}' because its owning member could not be resolved.`
|
|
76206
|
+
);
|
|
76207
|
+
}
|
|
76208
|
+
const indexes = constructorInitializerIndexes(ctx);
|
|
76209
|
+
const runtimeMemberId = Reflect.get(sourceMember, "id");
|
|
76210
|
+
const compileMemberId = indexes.initializerScopeMemberIds.get(sourceRow.init) ?? indexes.initializerScopeMemberIdsByValueId.get(sourceRow.id) ?? (typeof runtimeMemberId === "string" ? runtimeMemberId : null);
|
|
76211
|
+
const compiled = ensureInitializerCompiled({
|
|
76212
|
+
init: sourceRow.init,
|
|
76213
|
+
member: sourceMember,
|
|
76214
|
+
initializerCompiler: ctx.vm.initializerCompiler,
|
|
76215
|
+
sourceValueId: sourceRow.id,
|
|
76216
|
+
compileMemberId
|
|
76217
|
+
});
|
|
76218
|
+
const declaringClassId = compileMemberId === null ? void 0 : indexes.declaringClassIdsByMemberId.get(compileMemberId)?.values().next().value;
|
|
76219
|
+
const ownerClass = declaringClassId === void 0 ? void 0 : indexes.classById.get(declaringClassId);
|
|
76220
|
+
const constructorId = ownerClass?.requiredConstructorId;
|
|
76221
|
+
const constructor2 = typeof constructorId === "string" ? constructorById(constructorId, ctx) : void 0;
|
|
76222
|
+
const argumentValues = constructor2 === void 0 ? [] : declarationInitializerArgumentValues(
|
|
76223
|
+
constructor2.argumentTypes,
|
|
76224
|
+
`Class.Clone initializer on '${ownerClass?.name ?? sourceMember.name}'`,
|
|
76225
|
+
compiled.parameters.slice(2).some(
|
|
76226
|
+
(parameter4) => runtimeValueReferencesVariable(
|
|
76227
|
+
compiled.instructions,
|
|
76228
|
+
parameter4.id
|
|
76229
|
+
)
|
|
76230
|
+
)
|
|
76231
|
+
);
|
|
76232
|
+
const initializerCreatedValues = [];
|
|
76233
|
+
const evaluated = evaluateInitializerInContext(
|
|
76234
|
+
sourceRow.init,
|
|
76235
|
+
sourceMember,
|
|
76236
|
+
ctx,
|
|
76237
|
+
initializerCreatedValues,
|
|
76238
|
+
argumentValues,
|
|
76239
|
+
sourceRow.id,
|
|
76240
|
+
compileMemberId
|
|
76241
|
+
);
|
|
76242
|
+
if (evaluated.existingValueRow !== void 0) {
|
|
76243
|
+
const adoptedClone = cloneRow2(
|
|
76244
|
+
evaluated.existingValueRow,
|
|
76245
|
+
sourceMember,
|
|
76246
|
+
clonedContainerId,
|
|
76247
|
+
sourceTypeInfo
|
|
76248
|
+
);
|
|
76249
|
+
clonedBySourceId.set(sourceRow.id, adoptedClone);
|
|
76250
|
+
active.delete(sourceRow.id);
|
|
76251
|
+
return adoptedClone;
|
|
76252
|
+
}
|
|
76253
|
+
const {
|
|
76254
|
+
init: _init,
|
|
76255
|
+
value: _value,
|
|
76256
|
+
classId: _classId,
|
|
76257
|
+
...sourceEnvelope
|
|
76258
|
+
} = sourceRow;
|
|
76259
|
+
void _init;
|
|
76260
|
+
void _value;
|
|
76261
|
+
void _classId;
|
|
76262
|
+
const clone = {
|
|
76263
|
+
...sourceEnvelope,
|
|
76264
|
+
id: id2,
|
|
76265
|
+
value: evaluated.value,
|
|
76266
|
+
...evaluated.classId === null ? {} : { classId: evaluated.classId },
|
|
76267
|
+
...evaluated.genericBindings === void 0 ? {} : { genericBindings: { ...evaluated.genericBindings } },
|
|
76268
|
+
...deepClonePlainData(pickInstanceProvenance(evaluated)),
|
|
76269
|
+
containerId: clonedContainerId ?? null
|
|
76270
|
+
};
|
|
76271
|
+
if (evaluated.provisionalRootId !== void 0) {
|
|
76272
|
+
retargetDelegateReceiverValueIds(
|
|
76273
|
+
[clone, ...initializerCreatedValues],
|
|
76274
|
+
evaluated.provisionalRootId,
|
|
76275
|
+
clone.id
|
|
76276
|
+
);
|
|
76277
|
+
}
|
|
76278
|
+
registerRuntimeSessionValue(ctx, clone);
|
|
76279
|
+
clonedBySourceId.set(sourceRow.id, clone);
|
|
76280
|
+
if (typeof clone.value === "object" && clone.value !== null) {
|
|
76281
|
+
ctx.__cloneSourceRowIds ??= /* @__PURE__ */ new WeakMap();
|
|
76282
|
+
ctx.__cloneSourceRowIds.set(clone.value, sourceRow.id);
|
|
76283
|
+
}
|
|
76284
|
+
active.delete(sourceRow.id);
|
|
76285
|
+
if (ctx.__indexes !== void 0) {
|
|
76286
|
+
indexEvaluatorRow(ctx.__indexes, clone);
|
|
76287
|
+
}
|
|
76288
|
+
return clone;
|
|
76289
|
+
}
|
|
76290
|
+
function cloneRow2(sourceRow, sourceMember, clonedContainerId, sourceTypeInfo) {
|
|
76084
76291
|
if (active.has(sourceRow.id)) {
|
|
76085
76292
|
throw new NSGetterRuntimeError(
|
|
76086
76293
|
`Class.Clone found a cycle through owned value '${sourceRow.id}'.`
|
|
@@ -76090,6 +76297,15 @@ function cloneClassValueGraph(receiver, expectedClassId, ctx) {
|
|
|
76090
76297
|
if (prior !== void 0) return prior;
|
|
76091
76298
|
active.add(sourceRow.id);
|
|
76092
76299
|
const id2 = freshCloneValueId();
|
|
76300
|
+
if (isInitValueContent(sourceRow)) {
|
|
76301
|
+
return cloneInitializerRow(
|
|
76302
|
+
sourceRow,
|
|
76303
|
+
sourceMember,
|
|
76304
|
+
id2,
|
|
76305
|
+
clonedContainerId,
|
|
76306
|
+
sourceTypeInfo
|
|
76307
|
+
);
|
|
76308
|
+
}
|
|
76093
76309
|
const clone = {
|
|
76094
76310
|
...sourceRow,
|
|
76095
76311
|
id: id2,
|
|
@@ -76144,6 +76360,9 @@ function cloneClassValueGraph(receiver, expectedClassId, ctx) {
|
|
|
76144
76360
|
entryTypeInfo
|
|
76145
76361
|
).id;
|
|
76146
76362
|
});
|
|
76363
|
+
ctx.onUnattributableValueRead?.(
|
|
76364
|
+
`class-clone-unordered-list:${sourceRow.id}`
|
|
76365
|
+
);
|
|
76147
76366
|
for (const child of evaluatorValues(ctx)) {
|
|
76148
76367
|
if (child.containerId !== sourceRow.id) continue;
|
|
76149
76368
|
cloneRow2(child, entryMember, id2, entryTypeInfo);
|
|
@@ -76190,7 +76409,7 @@ function cloneClassValueGraph(receiver, expectedClassId, ctx) {
|
|
|
76190
76409
|
indexEvaluatorRow(ctx.__indexes, clone);
|
|
76191
76410
|
}
|
|
76192
76411
|
return clone;
|
|
76193
|
-
}
|
|
76412
|
+
}
|
|
76194
76413
|
const rootMember = memberForValueRow(source, ctx);
|
|
76195
76414
|
const typedSource = source.classId === void 0 ? { ...source, classId: runtimeClassId } : source;
|
|
76196
76415
|
const clonedRoot = cloneRow2(typedSource, rootMember);
|
|
@@ -76442,6 +76661,12 @@ var init_evaluateNSGetter = __esm({
|
|
|
76442
76661
|
if (existing !== void 0) return existing;
|
|
76443
76662
|
const source = this.sourceRowById(id2);
|
|
76444
76663
|
if (source === void 0) return void 0;
|
|
76664
|
+
if (isInitValueContent(source)) {
|
|
76665
|
+
const clone2 = { ...source, init: { ...source.init } };
|
|
76666
|
+
super.set(id2, clone2);
|
|
76667
|
+
this.materializedRows.push(clone2);
|
|
76668
|
+
return clone2;
|
|
76669
|
+
}
|
|
76445
76670
|
let value = source.value;
|
|
76446
76671
|
if (Array.isArray(value)) value = [...value];
|
|
76447
76672
|
else if (typeof value === "object" && value !== null) value = { ...value };
|
|
@@ -76739,26 +76964,31 @@ var init_stored_value_placement_index = __esm({
|
|
|
76739
76964
|
});
|
|
76740
76965
|
|
|
76741
76966
|
// ../src/database/virtual-instance-values.ts
|
|
76742
|
-
function
|
|
76743
|
-
|
|
76744
|
-
|
|
76745
|
-
|
|
76746
|
-
|
|
76747
|
-
|
|
76748
|
-
|
|
76749
|
-
|
|
76750
|
-
|
|
76751
|
-
|
|
76752
|
-
|
|
76753
|
-
|
|
76754
|
-
|
|
76755
|
-
|
|
76756
|
-
|
|
76757
|
-
|
|
76758
|
-
|
|
76759
|
-
|
|
76760
|
-
|
|
76761
|
-
|
|
76967
|
+
function buildVirtualInstanceMaterializedIndex(args) {
|
|
76968
|
+
const rowsById = new Map(
|
|
76969
|
+
(args.materializedRows ?? args.document.values).map((row) => [row.id, row])
|
|
76970
|
+
);
|
|
76971
|
+
const rows = [...rowsById.values()];
|
|
76972
|
+
return {
|
|
76973
|
+
rows,
|
|
76974
|
+
rowsById,
|
|
76975
|
+
graph: new MaterializedValueGraphContext(
|
|
76976
|
+
{ ...args.document, values: rows },
|
|
76977
|
+
rowsById
|
|
76978
|
+
),
|
|
76979
|
+
unorderedEntryIdsByContainerId: buildUnorderedListMembershipIndex(rows),
|
|
76980
|
+
constructorsById: new Map(
|
|
76981
|
+
(args.document.constructors ?? []).map((constructor2) => [
|
|
76982
|
+
constructor2.id,
|
|
76983
|
+
constructor2
|
|
76984
|
+
])
|
|
76985
|
+
),
|
|
76986
|
+
resolveConstructorSettlement: createConstructorSettlementResolver({
|
|
76987
|
+
classes: args.document.classes,
|
|
76988
|
+
constructors: args.document.constructors ?? [],
|
|
76989
|
+
members: args.document.members
|
|
76990
|
+
})
|
|
76991
|
+
};
|
|
76762
76992
|
}
|
|
76763
76993
|
function withoutInitializerConstructionFields(init) {
|
|
76764
76994
|
if (init.compiled === void 0) return init;
|
|
@@ -76817,6 +77047,31 @@ function claimVirtualIdentity(args) {
|
|
|
76817
77047
|
}
|
|
76818
77048
|
function expandStoredInstance(args) {
|
|
76819
77049
|
const recorder = args.readRecorder ?? null;
|
|
77050
|
+
const readTracking = recorder === null ? void 0 : new InitializerReadSet();
|
|
77051
|
+
const trackMaterialization = readTracking === void 0 ? (materialize) => materialize() : (materialize) => {
|
|
77052
|
+
try {
|
|
77053
|
+
return materialize();
|
|
77054
|
+
} finally {
|
|
77055
|
+
for (const valueId of readTracking.valueIds) {
|
|
77056
|
+
recorder?.recordValueRead(valueId);
|
|
77057
|
+
}
|
|
77058
|
+
for (const textId of readTracking.localizedTextIds) {
|
|
77059
|
+
recorder?.recordLocalizedTextRead(textId);
|
|
77060
|
+
}
|
|
77061
|
+
for (const variantId of readTracking.variantIds) {
|
|
77062
|
+
recorder?.recordVariantRead(variantId);
|
|
77063
|
+
}
|
|
77064
|
+
for (const memberId of readTracking.staticMemberIds) {
|
|
77065
|
+
recorder?.recordStaticMemberRead(memberId);
|
|
77066
|
+
}
|
|
77067
|
+
for (const containerId of readTracking.containerIds) {
|
|
77068
|
+
recorder?.recordContainerMembershipRead(containerId);
|
|
77069
|
+
}
|
|
77070
|
+
if (readTracking.hasUnattributableValueRead) {
|
|
77071
|
+
recorder?.recordGlobalRead("initializer-runtime");
|
|
77072
|
+
}
|
|
77073
|
+
}
|
|
77074
|
+
};
|
|
76820
77075
|
recorder?.recordValueRead(args.instanceRoot.id);
|
|
76821
77076
|
const rootMember = resolveMember2(args.rootMember, args.document.members);
|
|
76822
77077
|
if (!isMemberClassBase(rootMember)) {
|
|
@@ -76855,25 +77110,6 @@ function expandStoredInstance(args) {
|
|
|
76855
77110
|
`Virtual expansion root "${args.instanceRoot.id}" has no durable overload identity for class "${classId}"; keep this historical graph materialized.`
|
|
76856
77111
|
);
|
|
76857
77112
|
}
|
|
76858
|
-
if (recorder !== null && requiredConstructor !== null) {
|
|
76859
|
-
if (!constructorBodyIsCorpusFree(requiredConstructor)) {
|
|
76860
|
-
recorder.recordGlobalRead(
|
|
76861
|
-
`authored-constructor-body:${requiredConstructor.id}`
|
|
76862
|
-
);
|
|
76863
|
-
}
|
|
76864
|
-
for (const typeInfo of requiredConstructor.argumentTypes) {
|
|
76865
|
-
if (firstListInParameterType(typeInfo) === null) continue;
|
|
76866
|
-
recorder.recordGlobalRead(
|
|
76867
|
-
`constructor-argument-list:${requiredConstructor.id}`
|
|
76868
|
-
);
|
|
76869
|
-
break;
|
|
76870
|
-
}
|
|
76871
|
-
}
|
|
76872
|
-
if (recorder !== null && typeof instanceRoot.instanceVariantId === "string") {
|
|
76873
|
-
recorder.recordGlobalRead(
|
|
76874
|
-
`variant-initialize:${instanceRoot.instanceVariantId}`
|
|
76875
|
-
);
|
|
76876
|
-
}
|
|
76877
77113
|
const storedArgs = instanceRoot.constructorArgs ?? {};
|
|
76878
77114
|
if (requiredConstructor !== null && instanceRoot.constructorArgs == null) {
|
|
76879
77115
|
throw new VirtualExpansionUnsupportedError(
|
|
@@ -76971,22 +77207,32 @@ function expandStoredInstance(args) {
|
|
|
76971
77207
|
code: `virtual-replay:${args.instanceRoot.id}`,
|
|
76972
77208
|
compiled
|
|
76973
77209
|
};
|
|
76974
|
-
return
|
|
76975
|
-
|
|
76976
|
-
|
|
76977
|
-
|
|
76978
|
-
|
|
76979
|
-
|
|
76980
|
-
|
|
77210
|
+
return trackMaterialization(
|
|
77211
|
+
() => materializeInitializerValue({
|
|
77212
|
+
document: args.document,
|
|
77213
|
+
member: replayMember,
|
|
77214
|
+
row: { ...envelope, init },
|
|
77215
|
+
storedConstructionReplay: true,
|
|
77216
|
+
constructionBaselineReplay: fields.length === 0,
|
|
77217
|
+
...readTracking === void 0 ? {} : { readTracking },
|
|
77218
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
77219
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
77220
|
+
})
|
|
77221
|
+
);
|
|
76981
77222
|
};
|
|
76982
77223
|
const replayDeclaredDefault = () => {
|
|
76983
77224
|
const stampEnv = instanceRoot.genericBindings == null || Object.keys(instanceRoot.genericBindings).length === 0 ? null : envFromStamp(instanceRoot.genericBindings);
|
|
76984
|
-
const built =
|
|
76985
|
-
|
|
76986
|
-
|
|
76987
|
-
|
|
76988
|
-
|
|
76989
|
-
|
|
77225
|
+
const built = trackMaterialization(
|
|
77226
|
+
() => materializeMemberDefaultValue({
|
|
77227
|
+
document: args.document,
|
|
77228
|
+
member: replayMember,
|
|
77229
|
+
envelope,
|
|
77230
|
+
...stampEnv === null ? {} : { genericEnv: stampEnv },
|
|
77231
|
+
...readTracking === void 0 ? {} : { readTracking },
|
|
77232
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
77233
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
77234
|
+
})
|
|
77235
|
+
);
|
|
76990
77236
|
return {
|
|
76991
77237
|
...built,
|
|
76992
77238
|
root: {
|
|
@@ -77018,21 +77264,26 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
77018
77264
|
const unattributable = firstUnattributableExpansionMember(expansion);
|
|
77019
77265
|
if (unattributable !== null) recorder.recordGlobalRead(unattributable);
|
|
77020
77266
|
}
|
|
77021
|
-
const materializedById = new Map(
|
|
77022
|
-
(args.materializedRows ?? args.document.values).map((row) => [
|
|
77267
|
+
const materializedById = args.materializedIndex?.rowsById ?? new Map(
|
|
77268
|
+
(args.materializedRows ?? args.document.values).map((row) => [
|
|
77269
|
+
row.id,
|
|
77270
|
+
row
|
|
77271
|
+
])
|
|
77023
77272
|
);
|
|
77024
|
-
const materializedRows = [
|
|
77025
|
-
|
|
77026
|
-
|
|
77273
|
+
const materializedRows = args.materializedIndex?.rows ?? [
|
|
77274
|
+
...materializedById.values()
|
|
77275
|
+
];
|
|
77276
|
+
const materializedGraph = args.materializedGraph ?? args.materializedIndex?.graph ?? new MaterializedValueGraphContext(
|
|
77277
|
+
{ ...args.document, values: [...materializedRows] },
|
|
77027
77278
|
materializedById
|
|
77028
77279
|
);
|
|
77029
|
-
const constructorsById = new Map(
|
|
77280
|
+
const constructorsById = args.materializedIndex?.constructorsById ?? new Map(
|
|
77030
77281
|
(args.document.constructors ?? []).map((constructor2) => [
|
|
77031
77282
|
constructor2.id,
|
|
77032
77283
|
constructor2
|
|
77033
77284
|
])
|
|
77034
77285
|
);
|
|
77035
|
-
const resolveConstructorSettlement = createConstructorSettlementResolver({
|
|
77286
|
+
const resolveConstructorSettlement = args.materializedIndex?.resolveConstructorSettlement ?? createConstructorSettlementResolver({
|
|
77036
77287
|
classes: args.document.classes,
|
|
77037
77288
|
constructors: args.document.constructors ?? [],
|
|
77038
77289
|
members: args.document.members
|
|
@@ -77062,7 +77313,7 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
77062
77313
|
}
|
|
77063
77314
|
return result;
|
|
77064
77315
|
};
|
|
77065
|
-
const materializedUnorderedEntryIdsByContainerId = buildUnorderedListMembershipIndex(materializedRows);
|
|
77316
|
+
const materializedUnorderedEntryIdsByContainerId = args.materializedIndex?.unorderedEntryIdsByContainerId ?? buildUnorderedListMembershipIndex(materializedRows);
|
|
77066
77317
|
const readMaterializedRow = (valueId) => {
|
|
77067
77318
|
recorder?.recordValueRead(valueId);
|
|
77068
77319
|
return materializedById.get(valueId) ?? null;
|
|
@@ -77092,8 +77343,7 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
77092
77343
|
const materialized = effectiveMaterializedId === null ? null : readMaterializedRow(effectiveMaterializedId);
|
|
77093
77344
|
const effectiveId = materialized?.id ?? indexed.virtualId;
|
|
77094
77345
|
const effective = {
|
|
77095
|
-
...
|
|
77096
|
-
...materialized === null ? {} : cloneRow(materialized),
|
|
77346
|
+
...mergeExpandedAndMaterializedRow(indexed.expandedRow, materialized),
|
|
77097
77347
|
id: effectiveId,
|
|
77098
77348
|
// Virtual rows inherit partition and timestamps from the root. Real rows
|
|
77099
77349
|
// retain their own envelope through the spread above.
|
|
@@ -77136,7 +77386,7 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
77136
77386
|
const listMember = indexed.member;
|
|
77137
77387
|
effective.value = [];
|
|
77138
77388
|
const childPaths = expansion.childPathsByParentPath.get(pathKey) ?? [];
|
|
77139
|
-
recorder?.
|
|
77389
|
+
recorder?.recordContainerMembershipRead(effectiveId);
|
|
77140
77390
|
const storedEntryIds = materializedUnorderedEntryIdsByContainerId.get(effectiveId) ?? [];
|
|
77141
77391
|
const storedEntries = storedEntryIds.flatMap((storedEntryId) => {
|
|
77142
77392
|
const entry = readMaterializedRow(storedEntryId);
|
|
@@ -77309,19 +77559,18 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
77309
77559
|
root: rootLocation
|
|
77310
77560
|
};
|
|
77311
77561
|
}
|
|
77562
|
+
function mergeExpandedAndMaterializedRow(expanded, materialized) {
|
|
77563
|
+
const expandedClone = cloneRow(expanded);
|
|
77564
|
+
if (materialized === null) return expandedClone;
|
|
77565
|
+
const materializedClone = cloneRow(materialized);
|
|
77566
|
+
return isLiteralValueContent(materialized) ? overlayLiteralValueContent(expandedClone, materializedClone) : { ...expandedClone, ...materializedClone };
|
|
77567
|
+
}
|
|
77312
77568
|
function firstUnattributableExpansionMember(expansion) {
|
|
77313
77569
|
for (const node of expansion.nodesByPath.values()) {
|
|
77314
77570
|
const member = node.member;
|
|
77315
|
-
if (isMemberListBase(member) && listKindOf(member) === "unordered") {
|
|
77316
|
-
return `unordered-list-member:${node.memberId}`;
|
|
77317
|
-
}
|
|
77318
77571
|
if (CORPUS_SCANNING_MEMBER_KINDS.has(member.kind)) {
|
|
77319
77572
|
return `corpus-scanning-member-kind:${node.memberId}`;
|
|
77320
77573
|
}
|
|
77321
|
-
const declaredDefault = member.defaultValue;
|
|
77322
|
-
if (declaredDefault !== void 0 && declaredDefault !== null && "init" in declaredDefault && declaredDefault.init !== void 0 && declaredDefault.init !== null) {
|
|
77323
|
-
return `authored-initializer-member:${node.memberId}`;
|
|
77324
|
-
}
|
|
77325
77574
|
}
|
|
77326
77575
|
return null;
|
|
77327
77576
|
}
|
|
@@ -77348,6 +77597,9 @@ function reportFrameResolutionDisagreement(args) {
|
|
|
77348
77597
|
}
|
|
77349
77598
|
function resolvedStoredInstanceRows(args) {
|
|
77350
77599
|
const rows = new Map(args.document.values.map((row) => [row.id, row]));
|
|
77600
|
+
const materializedIndex = buildVirtualInstanceMaterializedIndex({
|
|
77601
|
+
document: args.document
|
|
77602
|
+
});
|
|
77351
77603
|
const queue = [{ root: args.instanceRoot, member: args.rootMember }];
|
|
77352
77604
|
const resolvedRootIds = /* @__PURE__ */ new Set();
|
|
77353
77605
|
const resolvedFrameByValueId = /* @__PURE__ */ new Map();
|
|
@@ -77366,7 +77618,7 @@ function resolvedStoredInstanceRows(args) {
|
|
|
77366
77618
|
rootMember: next.member,
|
|
77367
77619
|
expandedRoot: expanded.root,
|
|
77368
77620
|
expandedRows: expanded.rows,
|
|
77369
|
-
|
|
77621
|
+
materializedIndex
|
|
77370
77622
|
});
|
|
77371
77623
|
for (const [id2, row] of graph.rowsById) {
|
|
77372
77624
|
const priorFrame = resolvedFrameByValueId.get(id2);
|
|
@@ -77940,7 +78192,9 @@ function sparsifyConstructedInstance(args) {
|
|
|
77940
78192
|
values: materializedRows
|
|
77941
78193
|
};
|
|
77942
78194
|
const materializedGraph = new MaterializedValueGraphContext(
|
|
77943
|
-
constructionDocument
|
|
78195
|
+
constructionDocument,
|
|
78196
|
+
new Map(materializedRows.map((row) => [row.id, row])),
|
|
78197
|
+
/* @__PURE__ */ new Map([[args.constructed.root.id, args.rootMember]])
|
|
77944
78198
|
);
|
|
77945
78199
|
const graph = resolveVirtualInstanceGraph({
|
|
77946
78200
|
document: args.document,
|
|
@@ -78706,7 +78960,8 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
78706
78960
|
const priorExpanded = expandStoredInstance({
|
|
78707
78961
|
document,
|
|
78708
78962
|
instanceRoot: args.priorInstanceRoot,
|
|
78709
|
-
rootMember
|
|
78963
|
+
rootMember,
|
|
78964
|
+
readRecorder: args.readRecorder
|
|
78710
78965
|
});
|
|
78711
78966
|
const priorGraph = resolveVirtualInstanceGraph({
|
|
78712
78967
|
document,
|
|
@@ -78714,7 +78969,8 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
78714
78969
|
rootMember,
|
|
78715
78970
|
expandedRoot: priorExpanded.root,
|
|
78716
78971
|
expandedRows: priorExpanded.rows,
|
|
78717
|
-
materializedRows: [...materializedById.values()]
|
|
78972
|
+
materializedRows: [...materializedById.values()],
|
|
78973
|
+
readRecorder: args.readRecorder
|
|
78718
78974
|
});
|
|
78719
78975
|
for (const valueId of args.answeredValueIds) {
|
|
78720
78976
|
if (!priorGraph.locationsById.has(valueId)) {
|
|
@@ -78742,7 +78998,8 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
78742
78998
|
const nextExpanded = expandStoredInstance({
|
|
78743
78999
|
document,
|
|
78744
79000
|
instanceRoot: args.nextInstanceRoot,
|
|
78745
|
-
rootMember
|
|
79001
|
+
rootMember,
|
|
79002
|
+
readRecorder: args.readRecorder
|
|
78746
79003
|
});
|
|
78747
79004
|
const nextGraph = resolveVirtualInstanceGraph({
|
|
78748
79005
|
document,
|
|
@@ -78750,7 +79007,8 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
78750
79007
|
rootMember,
|
|
78751
79008
|
expandedRoot: nextExpanded.root,
|
|
78752
79009
|
expandedRows: nextExpanded.rows,
|
|
78753
|
-
materializedRows: [...materializedById.values()]
|
|
79010
|
+
materializedRows: [...materializedById.values()],
|
|
79011
|
+
readRecorder: args.readRecorder
|
|
78754
79012
|
});
|
|
78755
79013
|
const root = nextGraph.rowsById.get(args.nextInstanceRoot.id);
|
|
78756
79014
|
if (root === void 0) {
|
|
@@ -78788,7 +79046,12 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
78788
79046
|
values: document.values
|
|
78789
79047
|
}).placementByValueId;
|
|
78790
79048
|
const rawById = new Map(document.values.map((row) => [row.id, row]));
|
|
78791
|
-
|
|
79049
|
+
let resolverDocumentCache = null;
|
|
79050
|
+
const resolverDocumentOnce = () => resolverDocumentCache ??= composeResolverDocument(
|
|
79051
|
+
document,
|
|
79052
|
+
args.resolverLookups()
|
|
79053
|
+
);
|
|
79054
|
+
let materializedIndex = null;
|
|
78792
79055
|
const graphRowsByRootId = /* @__PURE__ */ new Map();
|
|
78793
79056
|
const graphByValueId = /* @__PURE__ */ new Map();
|
|
78794
79057
|
const failedRootIds = /* @__PURE__ */ new Set();
|
|
@@ -78813,10 +79076,15 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
78813
79076
|
}
|
|
78814
79077
|
try {
|
|
78815
79078
|
const resolverDocument = resolverDocumentOnce();
|
|
79079
|
+
materializedIndex ??= buildVirtualInstanceMaterializedIndex({
|
|
79080
|
+
document: resolverDocument,
|
|
79081
|
+
materializedRows: document.values
|
|
79082
|
+
});
|
|
78816
79083
|
const expanded = expandStoredInstance({
|
|
78817
79084
|
document: resolverDocument,
|
|
78818
79085
|
instanceRoot,
|
|
78819
|
-
rootMember: member
|
|
79086
|
+
rootMember: member,
|
|
79087
|
+
readRecorder: args.readRecorder
|
|
78820
79088
|
});
|
|
78821
79089
|
const graph = resolveVirtualInstanceGraph({
|
|
78822
79090
|
document: resolverDocument,
|
|
@@ -78824,7 +79092,8 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
78824
79092
|
rootMember: member,
|
|
78825
79093
|
expandedRoot: expanded.root,
|
|
78826
79094
|
expandedRows: expanded.rows,
|
|
78827
|
-
|
|
79095
|
+
materializedIndex,
|
|
79096
|
+
readRecorder: args.readRecorder
|
|
78828
79097
|
});
|
|
78829
79098
|
graphRowsByRootId.set(rootId, graph.rowsById);
|
|
78830
79099
|
for (const [id2, row] of graph.rowsById) {
|
|
@@ -78845,8 +79114,11 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
78845
79114
|
}
|
|
78846
79115
|
};
|
|
78847
79116
|
const virtualInstanceRowsForValue = (receiverValueId) => {
|
|
79117
|
+
args.readRecorder?.recordValuePlacementRead();
|
|
79118
|
+
args.readRecorder?.recordValueRead(receiverValueId);
|
|
78848
79119
|
let placement = placements().get(receiverValueId) ?? null;
|
|
78849
79120
|
while (placement !== null) {
|
|
79121
|
+
args.readRecorder?.recordValueRead(placement.valueId);
|
|
78850
79122
|
const raw = rawById.get(placement.valueId);
|
|
78851
79123
|
if (raw !== void 0 && isLiteralValueContent(raw) && isVirtualInstanceRootShape(raw)) {
|
|
78852
79124
|
return [...expandRoot(placement.valueId, placement.memberId).values()];
|
|
@@ -78867,7 +79139,7 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
78867
79139
|
}
|
|
78868
79140
|
};
|
|
78869
79141
|
}
|
|
78870
|
-
var KEPT_ROW_SAMPLE_LIMIT, CORPUS_SCANNING_MEMBER_KINDS,
|
|
79142
|
+
var KEPT_ROW_SAMPLE_LIMIT, CORPUS_SCANNING_MEMBER_KINDS, VirtualExpansionUnsupportedError, ROOT_PATH, SYNTHETIC_LINEAGE_PREFIXES, resolverDocumentsByDocument;
|
|
78871
79143
|
var init_virtual_instance_values = __esm({
|
|
78872
79144
|
"../src/database/virtual-instance-values.ts"() {
|
|
78873
79145
|
"use strict";
|
|
@@ -78881,6 +79153,7 @@ var init_virtual_instance_values = __esm({
|
|
|
78881
79153
|
init_instance_provenance();
|
|
78882
79154
|
init_unordered_list_membership();
|
|
78883
79155
|
init_neoscript();
|
|
79156
|
+
init_evaluateInitializer();
|
|
78884
79157
|
init_init_backed_value_materialization();
|
|
78885
79158
|
init_constructor_argument_ownership();
|
|
78886
79159
|
init_constructors2();
|
|
@@ -78888,15 +79161,8 @@ var init_virtual_instance_values = __esm({
|
|
|
78888
79161
|
KEPT_ROW_SAMPLE_LIMIT = 12;
|
|
78889
79162
|
CORPUS_SCANNING_MEMBER_KINDS = /* @__PURE__ */ new Set([
|
|
78890
79163
|
9 /* Lookup */,
|
|
78891
|
-
18 /* DialogueLookup
|
|
78892
|
-
10 /* NSProperty */,
|
|
78893
|
-
23 /* NSFunction */,
|
|
78894
|
-
13 /* Function */,
|
|
78895
|
-
24 /* FunctionRef */,
|
|
78896
|
-
25 /* NSDelegate */,
|
|
78897
|
-
26 /* NSAction */
|
|
79164
|
+
18 /* DialogueLookup */
|
|
78898
79165
|
]);
|
|
78899
|
-
CONSTRUCTOR_TYPE_WALK_DEPTH_LIMIT = 8;
|
|
78900
79166
|
VirtualExpansionUnsupportedError = class extends Error {
|
|
78901
79167
|
constructor(message) {
|
|
78902
79168
|
super(message);
|
|
@@ -78910,24 +79176,74 @@ var init_virtual_instance_values = __esm({
|
|
|
78910
79176
|
});
|
|
78911
79177
|
|
|
78912
79178
|
// ../src/view-models/neoscript-evaluator/evaluateInitializer.ts
|
|
78913
|
-
function
|
|
78914
|
-
|
|
78915
|
-
|
|
78916
|
-
|
|
78917
|
-
|
|
79179
|
+
function initializerEvaluatorCacheKey(document) {
|
|
79180
|
+
return document.evaluatorCache?.key ?? document;
|
|
79181
|
+
}
|
|
79182
|
+
function initializerEvaluatorCacheRevision(document) {
|
|
79183
|
+
return document.evaluatorCache?.revision;
|
|
79184
|
+
}
|
|
79185
|
+
function initializerEvaluatorLookups(document, readTracking) {
|
|
79186
|
+
const trackedHeadless = readTracking !== void 0 && document.databaseVM === void 0;
|
|
79187
|
+
const indexKey = initializerEvaluatorCacheKey(document);
|
|
79188
|
+
const lookupKey = document.databaseVM ?? indexKey;
|
|
79189
|
+
const revision = initializerEvaluatorCacheRevision(document);
|
|
79190
|
+
const cached = evaluatorLookupsByDocument.get(lookupKey);
|
|
79191
|
+
if (!trackedHeadless && cached !== void 0 && (revision === void 0 ? cached.members === document.members && cached.values === document.values : cached.revision === revision)) {
|
|
78918
79192
|
return cached.lookups;
|
|
78919
79193
|
}
|
|
78920
|
-
|
|
78921
|
-
document.
|
|
78922
|
-
|
|
78923
|
-
|
|
78924
|
-
|
|
78925
|
-
|
|
78926
|
-
|
|
79194
|
+
if (document.databaseVM !== void 0) {
|
|
79195
|
+
const databaseVM = document.databaseVM;
|
|
79196
|
+
const lookups2 = {
|
|
79197
|
+
memberById: (id2) => databaseVM.memberById(id2),
|
|
79198
|
+
valueById: (id2) => databaseVM.valueById(id2),
|
|
79199
|
+
localizedTextById: (id2) => databaseVM.localizedTextById?.(id2) ?? null,
|
|
79200
|
+
...databaseVM.hasStoredValueId === void 0 ? {} : {
|
|
79201
|
+
hasStoredValueId: (id2) => databaseVM.hasStoredValueId?.(id2) ?? false
|
|
79202
|
+
},
|
|
79203
|
+
variantById: (id2) => databaseVM.variantById?.(id2) ?? null,
|
|
79204
|
+
storedValuePlacementForValueId: (id2) => databaseVM.storedValuePlacementForValueId?.(id2) ?? null,
|
|
79205
|
+
unorderedListEntryIds: (containerValueId) => {
|
|
79206
|
+
const resolved = databaseVM.unorderedListEntryIds?.(containerValueId);
|
|
79207
|
+
if (resolved === void 0) {
|
|
79208
|
+
throw new Error(
|
|
79209
|
+
`Evaluator database resolves no unordered-list membership for container "${containerValueId}".`
|
|
79210
|
+
);
|
|
79211
|
+
}
|
|
79212
|
+
return resolved;
|
|
79213
|
+
},
|
|
79214
|
+
virtualInstanceRowsForValue: (receiverValueId) => databaseVM.virtualInstanceRowsForValue(receiverValueId),
|
|
79215
|
+
rowForValueReference: (value) => databaseVM.rowForValueReference?.(value) ?? null,
|
|
79216
|
+
resolveVariantInstanceGraph: (args) => {
|
|
79217
|
+
const resolver = databaseVM.resolveVariantInstanceGraph;
|
|
79218
|
+
if (resolver === void 0) {
|
|
79219
|
+
throw new Error(
|
|
79220
|
+
"Evaluator database has no virtual variant resolver."
|
|
79221
|
+
);
|
|
79222
|
+
}
|
|
79223
|
+
return resolver.call(databaseVM, args);
|
|
79224
|
+
},
|
|
79225
|
+
...databaseVM.evaluatorIndexes === void 0 ? {} : { evaluatorIndexes: databaseVM.evaluatorIndexes },
|
|
79226
|
+
...databaseVM.constructorInitializerIndexes === void 0 ? {} : {
|
|
79227
|
+
constructorInitializerIndexes: databaseVM.constructorInitializerIndexes
|
|
79228
|
+
}
|
|
79229
|
+
};
|
|
79230
|
+
evaluatorLookupsByDocument.set(lookupKey, {
|
|
79231
|
+
members: document.members,
|
|
79232
|
+
values: document.values,
|
|
79233
|
+
revision,
|
|
79234
|
+
lookups: lookups2
|
|
79235
|
+
});
|
|
79236
|
+
return lookups2;
|
|
79237
|
+
}
|
|
79238
|
+
const indexedLookups = indexedInitializerEvaluatorLookups(
|
|
79239
|
+
document,
|
|
79240
|
+
indexKey,
|
|
79241
|
+
revision
|
|
78927
79242
|
);
|
|
78928
79243
|
const headlessVirtualResolver = document.databaseVM === void 0 ? createHeadlessVirtualInstanceResolver({
|
|
78929
79244
|
document,
|
|
78930
|
-
resolverLookups: () => lookups
|
|
79245
|
+
resolverLookups: () => lookups,
|
|
79246
|
+
...readTracking === void 0 ? {} : { readRecorder: virtualReadRecorder(readTracking) }
|
|
78931
79247
|
}) : null;
|
|
78932
79248
|
const lookups = {
|
|
78933
79249
|
...indexedLookups,
|
|
@@ -78945,11 +79261,13 @@ function initializerEvaluatorLookups(document) {
|
|
|
78945
79261
|
resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
|
|
78946
79262
|
document,
|
|
78947
79263
|
resolverLookups: lookups,
|
|
79264
|
+
...readTracking === void 0 ? {} : { readRecorder: virtualReadRecorder(readTracking) },
|
|
78948
79265
|
...args
|
|
78949
79266
|
})
|
|
78950
79267
|
} : {
|
|
78951
79268
|
memberById: (id2) => document.databaseVM?.memberById(id2) ?? null,
|
|
78952
79269
|
valueById: (id2) => document.databaseVM?.valueById(id2) ?? null,
|
|
79270
|
+
variantById: (id2) => document.databaseVM?.variantById?.(id2) ?? null,
|
|
78953
79271
|
// The VM's `valueById` answers EXPANDED-first: a collapse-stamped
|
|
78954
79272
|
// root resolves to a record the VM minted, an object the raw value
|
|
78955
79273
|
// index has never seen. Reference-identity dispatch (`.Id`, `is`,
|
|
@@ -78983,7 +79301,26 @@ function initializerEvaluatorLookups(document) {
|
|
|
78983
79301
|
}
|
|
78984
79302
|
}
|
|
78985
79303
|
};
|
|
78986
|
-
|
|
79304
|
+
if (!trackedHeadless) {
|
|
79305
|
+
evaluatorLookupsByDocument.set(lookupKey, {
|
|
79306
|
+
members: document.members,
|
|
79307
|
+
values: document.values,
|
|
79308
|
+
revision,
|
|
79309
|
+
lookups
|
|
79310
|
+
});
|
|
79311
|
+
}
|
|
79312
|
+
return lookups;
|
|
79313
|
+
}
|
|
79314
|
+
function indexedInitializerEvaluatorLookups(document, key, revision) {
|
|
79315
|
+
const cached = indexedEvaluatorLookupsByDocument.get(key);
|
|
79316
|
+
if (cached !== void 0 && (revision === void 0 ? cached.members === document.members && cached.values === document.values : cached.revision === revision)) {
|
|
79317
|
+
return cached.lookups;
|
|
79318
|
+
}
|
|
79319
|
+
const lookups = makeEvaluatorLookups(document.members, document.values, {
|
|
79320
|
+
includeValueGraphIndexes: true,
|
|
79321
|
+
constructorInitializerDocument: document
|
|
79322
|
+
});
|
|
79323
|
+
indexedEvaluatorLookupsByDocument.set(key, {
|
|
78987
79324
|
members: document.members,
|
|
78988
79325
|
values: document.values,
|
|
78989
79326
|
revision,
|
|
@@ -78991,25 +79328,65 @@ function initializerEvaluatorLookups(document) {
|
|
|
78991
79328
|
});
|
|
78992
79329
|
return lookups;
|
|
78993
79330
|
}
|
|
78994
|
-
function buildInitializerRootValueWithLookups(document, lookups) {
|
|
79331
|
+
function buildInitializerRootValueWithLookups(document, lookups, tracking) {
|
|
78995
79332
|
const rootValue = {};
|
|
78996
79333
|
for (const { root, memberId } of projectRootMembersInDisplayOrder(
|
|
78997
79334
|
document.project
|
|
78998
79335
|
)) {
|
|
78999
79336
|
const member = lookups.memberById(memberId);
|
|
79000
|
-
if (member === null
|
|
79337
|
+
if (member === null) {
|
|
79338
|
+
rootValue[root.key] = null;
|
|
79339
|
+
continue;
|
|
79340
|
+
}
|
|
79341
|
+
tracking?.staticMemberDependencies?.add(member.id);
|
|
79342
|
+
const bindings = root.storage === "save" /* Save */ ? tracking?.saveStaticBindings : root.storage === "session" /* Session */ ? tracking?.sessionStaticBindings : void 0;
|
|
79343
|
+
const boundTarget = staticBindingEntry(bindings, member.id);
|
|
79344
|
+
const targetId = boundTarget.present ? boundTarget.value : member.valueId;
|
|
79345
|
+
if (typeof targetId !== "string") {
|
|
79001
79346
|
rootValue[root.key] = null;
|
|
79002
79347
|
continue;
|
|
79003
79348
|
}
|
|
79004
|
-
|
|
79349
|
+
tracking?.valueDependencies?.add(targetId);
|
|
79350
|
+
rootValue[root.key] = lookups.valueById(targetId)?.value ?? null;
|
|
79005
79351
|
}
|
|
79006
79352
|
return rootValue;
|
|
79007
79353
|
}
|
|
79354
|
+
function staticBindingEntry(bindings, memberId) {
|
|
79355
|
+
if (bindings === void 0) return { present: false, value: null };
|
|
79356
|
+
if (isStaticBindingMap(bindings)) {
|
|
79357
|
+
return {
|
|
79358
|
+
present: bindings.has(memberId),
|
|
79359
|
+
value: bindings.get(memberId) ?? null
|
|
79360
|
+
};
|
|
79361
|
+
}
|
|
79362
|
+
return {
|
|
79363
|
+
present: Object.hasOwn(bindings, memberId),
|
|
79364
|
+
value: bindings[memberId] ?? null
|
|
79365
|
+
};
|
|
79366
|
+
}
|
|
79367
|
+
function isStaticBindingMap(bindings) {
|
|
79368
|
+
return "get" in bindings && typeof bindings.get === "function" && "has" in bindings && typeof bindings.has === "function";
|
|
79369
|
+
}
|
|
79370
|
+
function virtualReadRecorder(reads) {
|
|
79371
|
+
return {
|
|
79372
|
+
recordValueRead: (id2) => reads.valueIds.add(id2),
|
|
79373
|
+
recordLocalizedTextRead: (id2) => reads.localizedTextIds.add(id2),
|
|
79374
|
+
recordVariantRead: (id2) => reads.variantIds.add(id2),
|
|
79375
|
+
recordStaticMemberRead: (id2) => reads.staticMemberIds.add(id2),
|
|
79376
|
+
recordContainerMembershipRead: (id2) => reads.containerIds.add(id2),
|
|
79377
|
+
recordValuePlacementRead: reads.recordValuePlacementRead,
|
|
79378
|
+
recordGlobalRead: reads.recordUnattributableValueRead
|
|
79379
|
+
};
|
|
79380
|
+
}
|
|
79008
79381
|
function evaluateMemberInitializer(args) {
|
|
79009
|
-
const databaseVM = initializerEvaluatorLookups(
|
|
79010
|
-
|
|
79011
|
-
args.
|
|
79382
|
+
const databaseVM = initializerEvaluatorLookups(
|
|
79383
|
+
args.document,
|
|
79384
|
+
args.readTracking
|
|
79012
79385
|
);
|
|
79386
|
+
const initializerIndexes = databaseVM.constructorInitializerIndexes;
|
|
79387
|
+
const compileMemberId = initializerIndexes?.initializerScopeMemberIds.get(args.init) ?? (args.sourceValueId === null || args.sourceValueId === void 0 ? void 0 : initializerIndexes?.initializerScopeMemberIdsByValueId.get(
|
|
79388
|
+
args.sourceValueId
|
|
79389
|
+
));
|
|
79013
79390
|
const compiled = ensureInitializerCompiled({
|
|
79014
79391
|
init: args.init,
|
|
79015
79392
|
member: args.member,
|
|
@@ -79041,7 +79418,18 @@ function evaluateMemberInitializer(args) {
|
|
|
79041
79418
|
initializerCompiler: args.document.initializerCompiler
|
|
79042
79419
|
},
|
|
79043
79420
|
thisValue: null,
|
|
79044
|
-
rootValue: buildInitializerRootValueWithLookups(args.document, databaseVM
|
|
79421
|
+
rootValue: buildInitializerRootValueWithLookups(args.document, databaseVM, {
|
|
79422
|
+
valueDependencies: args.readTracking?.valueIds,
|
|
79423
|
+
staticMemberDependencies: args.readTracking?.staticMemberIds,
|
|
79424
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
79425
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
79426
|
+
}),
|
|
79427
|
+
valueDependencies: args.readTracking?.valueIds,
|
|
79428
|
+
localizedTextDependencies: args.readTracking?.localizedTextIds,
|
|
79429
|
+
variantDependencies: args.readTracking?.variantIds,
|
|
79430
|
+
containerDependencies: args.readTracking?.containerIds,
|
|
79431
|
+
staticMemberDependencies: args.readTracking?.staticMemberIds,
|
|
79432
|
+
onUnattributableValueRead: args.readTracking?.recordUnattributableValueRead,
|
|
79045
79433
|
saveStaticBindings: args.saveStaticBindings,
|
|
79046
79434
|
sessionStaticBindings: args.sessionStaticBindings,
|
|
79047
79435
|
...args.storedConstructionReplay === true ? {
|
|
@@ -79104,7 +79492,7 @@ function evaluateMemberInitializer(args) {
|
|
|
79104
79492
|
}
|
|
79105
79493
|
};
|
|
79106
79494
|
}
|
|
79107
|
-
var evaluatorLookupsByDocument;
|
|
79495
|
+
var evaluatorLookupsByDocument, indexedEvaluatorLookupsByDocument, InitializerReadSet;
|
|
79108
79496
|
var init_evaluateInitializer = __esm({
|
|
79109
79497
|
"../src/view-models/neoscript-evaluator/evaluateInitializer.ts"() {
|
|
79110
79498
|
"use strict";
|
|
@@ -79115,6 +79503,23 @@ var init_evaluateInitializer = __esm({
|
|
|
79115
79503
|
init_evaluateNSGetter();
|
|
79116
79504
|
init_virtual_instance_values();
|
|
79117
79505
|
evaluatorLookupsByDocument = /* @__PURE__ */ new WeakMap();
|
|
79506
|
+
indexedEvaluatorLookupsByDocument = /* @__PURE__ */ new WeakMap();
|
|
79507
|
+
InitializerReadSet = class {
|
|
79508
|
+
valueIds = /* @__PURE__ */ new Set();
|
|
79509
|
+
localizedTextIds = /* @__PURE__ */ new Set();
|
|
79510
|
+
variantIds = /* @__PURE__ */ new Set();
|
|
79511
|
+
containerIds = /* @__PURE__ */ new Set();
|
|
79512
|
+
staticMemberIds = /* @__PURE__ */ new Set();
|
|
79513
|
+
hasValuePlacementRead = false;
|
|
79514
|
+
hasUnattributableValueRead = false;
|
|
79515
|
+
recordUnattributableValueRead = (_reason) => {
|
|
79516
|
+
void _reason;
|
|
79517
|
+
this.hasUnattributableValueRead = true;
|
|
79518
|
+
};
|
|
79519
|
+
recordValuePlacementRead = () => {
|
|
79520
|
+
this.hasValuePlacementRead = true;
|
|
79521
|
+
};
|
|
79522
|
+
};
|
|
79118
79523
|
}
|
|
79119
79524
|
});
|
|
79120
79525
|
|
|
@@ -79130,8 +79535,12 @@ var init_neoscript_evaluator = __esm({
|
|
|
79130
79535
|
|
|
79131
79536
|
// ../src/database/init-backed-value-materialization.ts
|
|
79132
79537
|
function declarationInitializerContext(document) {
|
|
79133
|
-
const
|
|
79134
|
-
|
|
79538
|
+
const key = initializerEvaluatorCacheKey(document);
|
|
79539
|
+
const revision = initializerEvaluatorCacheRevision(document);
|
|
79540
|
+
const cached = declarationInitializerContextByDocument.get(key);
|
|
79541
|
+
if (cached !== void 0 && (revision === void 0 ? cached.members === document.members && cached.values === document.values : cached.revision === revision)) {
|
|
79542
|
+
return cached.context;
|
|
79543
|
+
}
|
|
79135
79544
|
const initializerValueIds = new Set(
|
|
79136
79545
|
document.values.filter(isInitValueContent).map((value) => value.id)
|
|
79137
79546
|
);
|
|
@@ -79146,7 +79555,12 @@ function declarationInitializerContext(document) {
|
|
|
79146
79555
|
rootOwners
|
|
79147
79556
|
);
|
|
79148
79557
|
const created = { valuesById, rootOwners };
|
|
79149
|
-
declarationInitializerContextByDocument.set(
|
|
79558
|
+
declarationInitializerContextByDocument.set(key, {
|
|
79559
|
+
members: document.members,
|
|
79560
|
+
values: document.values,
|
|
79561
|
+
revision,
|
|
79562
|
+
context: created
|
|
79563
|
+
});
|
|
79150
79564
|
return created;
|
|
79151
79565
|
}
|
|
79152
79566
|
function evaluateInitializerMaterialization(args) {
|
|
@@ -79161,7 +79575,10 @@ function evaluateInitializerMaterialization(args) {
|
|
|
79161
79575
|
...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
|
|
79162
79576
|
...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
|
|
79163
79577
|
...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
|
|
79164
|
-
sourceValueId: args.sourceValueId ?? null
|
|
79578
|
+
sourceValueId: args.sourceValueId ?? null,
|
|
79579
|
+
readTracking: args.readTracking,
|
|
79580
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
79581
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
79165
79582
|
});
|
|
79166
79583
|
return { evaluated, createdValues, storageKeyDeclarations };
|
|
79167
79584
|
}
|
|
@@ -79197,7 +79614,10 @@ function materializeInitializerValue(args) {
|
|
|
79197
79614
|
...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {},
|
|
79198
79615
|
...args.constructionBaselineReplay === true ? { constructionBaselineReplay: true } : {},
|
|
79199
79616
|
...args.argumentValues === void 0 ? {} : { argumentValues: args.argumentValues },
|
|
79200
|
-
sourceValueId: args.row.id
|
|
79617
|
+
sourceValueId: args.row.id,
|
|
79618
|
+
readTracking: args.readTracking,
|
|
79619
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
79620
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
79201
79621
|
});
|
|
79202
79622
|
const {
|
|
79203
79623
|
init: _init,
|
|
@@ -79205,6 +79625,9 @@ function materializeInitializerValue(args) {
|
|
|
79205
79625
|
classId: _classId,
|
|
79206
79626
|
...envelope
|
|
79207
79627
|
} = args.row;
|
|
79628
|
+
void _init;
|
|
79629
|
+
void _value;
|
|
79630
|
+
void _classId;
|
|
79208
79631
|
const root = {
|
|
79209
79632
|
...envelope,
|
|
79210
79633
|
value: evaluated.value,
|
|
@@ -79240,6 +79663,9 @@ function materializeInitializerValue(args) {
|
|
|
79240
79663
|
function materializeMemberDefaultValue(args) {
|
|
79241
79664
|
const createdValues = [];
|
|
79242
79665
|
const storageKeyDeclarations = /* @__PURE__ */ new Map();
|
|
79666
|
+
args.readTracking?.recordUnattributableValueRead(
|
|
79667
|
+
`declaration-owner-resolution:${args.envelope.id}`
|
|
79668
|
+
);
|
|
79243
79669
|
const { valuesById, rootOwners } = declarationInitializerContext(
|
|
79244
79670
|
args.document
|
|
79245
79671
|
);
|
|
@@ -79260,15 +79686,14 @@ function materializeMemberDefaultValue(args) {
|
|
|
79260
79686
|
(candidate) => candidate.id === constructorId
|
|
79261
79687
|
);
|
|
79262
79688
|
if (constructor2 === void 0) return [];
|
|
79263
|
-
const defaults = parameterDefaultsAsFullArguments(
|
|
79264
|
-
constructor2.argumentTypes,
|
|
79265
|
-
`Declaration template on '${ownerClass.name}'`
|
|
79266
|
-
);
|
|
79267
|
-
if (defaults !== null) return defaults;
|
|
79268
79689
|
const parameterNames = new Set(
|
|
79269
79690
|
constructor2.argumentTypes.map((argument2) => argument2.name)
|
|
79270
79691
|
);
|
|
79271
|
-
return
|
|
79692
|
+
return declarationInitializerArgumentValues(
|
|
79693
|
+
constructor2.argumentTypes,
|
|
79694
|
+
`Declaration template on '${ownerClass.name}'`,
|
|
79695
|
+
initializerReferencesAnyIdentifier(init.code, parameterNames)
|
|
79696
|
+
);
|
|
79272
79697
|
};
|
|
79273
79698
|
const built = buildDefaultMemberValue({
|
|
79274
79699
|
document: args.document,
|
|
@@ -79290,7 +79715,10 @@ function materializeMemberDefaultValue(args) {
|
|
|
79290
79715
|
init,
|
|
79291
79716
|
sourceValueId ?? null
|
|
79292
79717
|
),
|
|
79293
|
-
sourceValueId: sourceValueId ?? null
|
|
79718
|
+
sourceValueId: sourceValueId ?? null,
|
|
79719
|
+
readTracking: args.readTracking,
|
|
79720
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
79721
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
79294
79722
|
})
|
|
79295
79723
|
});
|
|
79296
79724
|
const interior = createdValues.filter((created) => created.id !== built.id);
|
|
@@ -79320,6 +79748,7 @@ var init_init_backed_value_materialization = __esm({
|
|
|
79320
79748
|
init_inheritance();
|
|
79321
79749
|
init_neoscript_evaluator();
|
|
79322
79750
|
init_evaluateNSGetter();
|
|
79751
|
+
init_evaluateInitializer();
|
|
79323
79752
|
init_value_row_owner_members();
|
|
79324
79753
|
init_compile_ns_property();
|
|
79325
79754
|
declarationInitializerContextByDocument = /* @__PURE__ */ new WeakMap();
|
|
@@ -84439,7 +84868,6 @@ function isWorldAnimationStructuralMember(memberId, members) {
|
|
|
84439
84868
|
}
|
|
84440
84869
|
function assertAnimationClipDocumentValid(document) {
|
|
84441
84870
|
const context = new AnimationValidationContext(document);
|
|
84442
|
-
context.validateConstructorProjections();
|
|
84443
84871
|
context.validateSegments();
|
|
84444
84872
|
for (const member of document.members) {
|
|
84445
84873
|
if (!isMemberClass(member)) continue;
|
|
@@ -84458,7 +84886,6 @@ var init_animation_clips = __esm({
|
|
|
84458
84886
|
init_inheritance();
|
|
84459
84887
|
init_generics();
|
|
84460
84888
|
init_world_system_classes();
|
|
84461
|
-
init_core_types();
|
|
84462
84889
|
init_member_kinds();
|
|
84463
84890
|
init_structured_leaf_fields();
|
|
84464
84891
|
init_effective_storage();
|
|
@@ -84501,60 +84928,6 @@ var init_animation_clips = __esm({
|
|
|
84501
84928
|
memberById;
|
|
84502
84929
|
valueById;
|
|
84503
84930
|
storage;
|
|
84504
|
-
validateConstructorProjections() {
|
|
84505
|
-
for (const schemaClass2 of this.document.classes) {
|
|
84506
|
-
const projections = schemaClass2.constructorProjections ?? [];
|
|
84507
|
-
if (projections.length === 0) continue;
|
|
84508
|
-
if (schemaClass2.system?.kind !== SystemProtectionKind.WorldAuthoring) {
|
|
84509
|
-
throw new Error(
|
|
84510
|
-
`Class "${schemaClass2.name}" can declare constructor projections only when it is a locked world system class.`
|
|
84511
|
-
);
|
|
84512
|
-
}
|
|
84513
|
-
const parameterNames = /* @__PURE__ */ new Set();
|
|
84514
|
-
const memberIds = /* @__PURE__ */ new Set();
|
|
84515
|
-
const effectiveMemberIds = this.effectiveSchemaMemberIds(schemaClass2);
|
|
84516
|
-
for (const projection of projections) {
|
|
84517
|
-
if (parameterNames.has(projection.parameterName)) {
|
|
84518
|
-
throw new Error(
|
|
84519
|
-
`Class "${schemaClass2.name}" has duplicate constructor parameter "${projection.parameterName}".`
|
|
84520
|
-
);
|
|
84521
|
-
}
|
|
84522
|
-
if (memberIds.has(projection.memberId)) {
|
|
84523
|
-
throw new Error(
|
|
84524
|
-
`Class "${schemaClass2.name}" projects multiple constructor parameters onto member "${projection.memberId}".`
|
|
84525
|
-
);
|
|
84526
|
-
}
|
|
84527
|
-
if (!effectiveMemberIds.has(projection.memberId)) {
|
|
84528
|
-
throw new Error(
|
|
84529
|
-
`Class "${schemaClass2.name}" constructor parameter "${projection.parameterName}" references member "${projection.memberId}", which is neither in its schema nor inherited.`
|
|
84530
|
-
);
|
|
84531
|
-
}
|
|
84532
|
-
parameterNames.add(projection.parameterName);
|
|
84533
|
-
memberIds.add(projection.memberId);
|
|
84534
|
-
}
|
|
84535
|
-
}
|
|
84536
|
-
}
|
|
84537
|
-
/**
|
|
84538
|
-
* Every member id a class resolves under a schema key — its own, then each
|
|
84539
|
-
* ancestor's.
|
|
84540
|
-
*
|
|
84541
|
-
* A projection may name an inherited member: P48 §2.1 moved `Child` onto
|
|
84542
|
-
* `NeoAnimationTrackBase`, and `new NeoAnimationChildTrack(id: "…")` still
|
|
84543
|
-
* projects onto that one member from a class that no longer declares it.
|
|
84544
|
-
*/
|
|
84545
|
-
effectiveSchemaMemberIds(schemaClass2) {
|
|
84546
|
-
const memberIds = /* @__PURE__ */ new Set();
|
|
84547
|
-
const visited = /* @__PURE__ */ new Set();
|
|
84548
|
-
let current = schemaClass2;
|
|
84549
|
-
while (current !== void 0 && !visited.has(current.id)) {
|
|
84550
|
-
visited.add(current.id);
|
|
84551
|
-
for (const memberId of Object.values(current.schema)) {
|
|
84552
|
-
memberIds.add(memberId);
|
|
84553
|
-
}
|
|
84554
|
-
current = current.extendsClassId === void 0 ? void 0 : this.classById.get(current.extendsClassId);
|
|
84555
|
-
}
|
|
84556
|
-
return memberIds;
|
|
84557
|
-
}
|
|
84558
84931
|
classHasWorldKind(classId, worldKind) {
|
|
84559
84932
|
const visited = /* @__PURE__ */ new Set();
|
|
84560
84933
|
let current = this.classById.get(classId);
|
|
@@ -86031,17 +86404,26 @@ function syntheticMember(fields) {
|
|
|
86031
86404
|
function variantOwnershipRoots(args) {
|
|
86032
86405
|
const empty = { roots: [], bindingMembers: [] };
|
|
86033
86406
|
if (args.variants.length === 0) return empty;
|
|
86034
|
-
const
|
|
86035
|
-
(schemaClass2) => schemaClass2.
|
|
86407
|
+
const classById = new Map(
|
|
86408
|
+
args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
86409
|
+
);
|
|
86410
|
+
const classByVariantKind = /* @__PURE__ */ new Map();
|
|
86411
|
+
for (const schemaClass2 of args.classes) {
|
|
86412
|
+
const worldKind = schemaClass2.system?.worldKind;
|
|
86413
|
+
if (worldKind !== NeoWorldSystemClassKind.Variant && worldKind !== NeoWorldSystemClassKind.LookupVariant) {
|
|
86414
|
+
continue;
|
|
86415
|
+
}
|
|
86416
|
+
classByVariantKind.set(worldKind, schemaClass2);
|
|
86417
|
+
}
|
|
86418
|
+
const plainVariantClass = classByVariantKind.get(
|
|
86419
|
+
NeoWorldSystemClassKind.Variant
|
|
86036
86420
|
);
|
|
86037
86421
|
if (plainVariantClass === void 0) return empty;
|
|
86038
86422
|
const valueById = new Map(args.values.map((value) => [value.id, value]));
|
|
86039
86423
|
const folderById = new Map(
|
|
86040
86424
|
(args.variantFolders ?? []).map((folder) => [folder.id, folder])
|
|
86041
86425
|
);
|
|
86042
|
-
|
|
86043
|
-
(args.members ?? []).map((member) => [member.id, member])
|
|
86044
|
-
);
|
|
86426
|
+
let memberById2 = null;
|
|
86045
86427
|
const roots = [];
|
|
86046
86428
|
const bindingMembers = [];
|
|
86047
86429
|
for (const variant of args.variants) {
|
|
@@ -86049,11 +86431,9 @@ function variantOwnershipRoots(args) {
|
|
|
86049
86431
|
if (root === void 0) continue;
|
|
86050
86432
|
const lookupFolder = variant.folderId == null ? void 0 : folderById.get(variant.folderId);
|
|
86051
86433
|
const inferredVariantKind = lookupFolder?.binding == null ? NeoWorldSystemClassKind.Variant : NeoWorldSystemClassKind.LookupVariant;
|
|
86052
|
-
const
|
|
86053
|
-
|
|
86054
|
-
) ??
|
|
86055
|
-
(schemaClass2) => schemaClass2.system?.worldKind === inferredVariantKind
|
|
86056
|
-
) ?? plainVariantClass;
|
|
86434
|
+
const stampedClass = typeof root.classId === "string" ? classById.get(root.classId) : void 0;
|
|
86435
|
+
const stampedKind = stampedClass?.system?.worldKind;
|
|
86436
|
+
const variantClass = (stampedKind === NeoWorldSystemClassKind.Variant || stampedKind === NeoWorldSystemClassKind.LookupVariant ? stampedClass : void 0) ?? classByVariantKind.get(inferredVariantKind) ?? plainVariantClass;
|
|
86057
86437
|
const parameterId = variantClass.genericParams?.[0]?.id;
|
|
86058
86438
|
if (parameterId === void 0) continue;
|
|
86059
86439
|
const stampedTargetMemberId = readStampedTargetMemberId(root, parameterId);
|
|
@@ -86080,7 +86460,12 @@ function variantOwnershipRoots(args) {
|
|
|
86080
86460
|
})
|
|
86081
86461
|
);
|
|
86082
86462
|
const lookupParameterId = variantClass.genericParams?.[1]?.id;
|
|
86083
|
-
|
|
86463
|
+
if (lookupFolder?.binding != null && memberById2 === null) {
|
|
86464
|
+
memberById2 = new Map(
|
|
86465
|
+
(args.members ?? []).map((member) => [member.id, member])
|
|
86466
|
+
);
|
|
86467
|
+
}
|
|
86468
|
+
const lookupCollection = lookupFolder?.binding == null ? void 0 : memberById2?.get(lookupFolder.binding.collectionMemberId);
|
|
86084
86469
|
const lookupBinding = lookupParameterId !== void 0 && isMemberListBase(lookupCollection) ? {
|
|
86085
86470
|
[lookupParameterId]: {
|
|
86086
86471
|
kind: "member",
|
|
@@ -86118,15 +86503,38 @@ function withVariantOwnershipRoots(document, variants) {
|
|
|
86118
86503
|
classes: document.classes,
|
|
86119
86504
|
members: document.members
|
|
86120
86505
|
});
|
|
86121
|
-
|
|
86506
|
+
const rootMembersByValueId = new Map(
|
|
86507
|
+
roots.map((root) => [root.valueId, root.member])
|
|
86508
|
+
);
|
|
86509
|
+
if (bindingMembers.length === 0) {
|
|
86510
|
+
return { document, roots, rootMembersByValueId };
|
|
86511
|
+
}
|
|
86122
86512
|
return {
|
|
86123
86513
|
document: {
|
|
86124
86514
|
...document,
|
|
86125
86515
|
members: [...document.members, ...bindingMembers]
|
|
86126
86516
|
},
|
|
86127
|
-
roots
|
|
86517
|
+
roots,
|
|
86518
|
+
rootMembersByValueId
|
|
86128
86519
|
};
|
|
86129
86520
|
}
|
|
86521
|
+
function createVariantMaterializedValueGraphContext(document, variants, rows = new Map(
|
|
86522
|
+
document.values.map((value) => [value.id, value])
|
|
86523
|
+
)) {
|
|
86524
|
+
const scopedDocument = {
|
|
86525
|
+
...document,
|
|
86526
|
+
values: [...rows.values()]
|
|
86527
|
+
};
|
|
86528
|
+
const scope = withVariantOwnershipRoots(
|
|
86529
|
+
scopedDocument,
|
|
86530
|
+
variants.filter((variant) => rows.has(variant.valueId))
|
|
86531
|
+
);
|
|
86532
|
+
return new MaterializedValueGraphContext(
|
|
86533
|
+
scope.document,
|
|
86534
|
+
rows,
|
|
86535
|
+
scope.rootMembersByValueId
|
|
86536
|
+
);
|
|
86537
|
+
}
|
|
86130
86538
|
function collectVariantGraphValueIds(args) {
|
|
86131
86539
|
const collected = /* @__PURE__ */ new Set();
|
|
86132
86540
|
if (args.variantIds.size === 0) return collected;
|
|
@@ -87860,7 +88268,11 @@ function validateWorldLayerLinkClassTargets(args) {
|
|
|
87860
88268
|
}
|
|
87861
88269
|
}
|
|
87862
88270
|
function worldLayerLinkTargetDescriptorForClass(classId, classes) {
|
|
87863
|
-
|
|
88271
|
+
return worldLayerLinkTargetDescriptor(
|
|
88272
|
+
resolveWorldSystemClassKind(classId, classes)
|
|
88273
|
+
);
|
|
88274
|
+
}
|
|
88275
|
+
function worldLayerLinkTargetDescriptor(worldKind) {
|
|
87864
88276
|
if (worldKind === NeoWorldSystemClassKind.TileLayerLink) {
|
|
87865
88277
|
return {
|
|
87866
88278
|
relationKind: InternalRecordRelationKind.WorldTileLayerLinkTarget,
|
|
@@ -87882,9 +88294,11 @@ function worldLayerLinkTargetRelations(classId, descriptor, relations) {
|
|
|
87882
88294
|
}
|
|
87883
88295
|
function resolveWorldLayerLinkTarget(args) {
|
|
87884
88296
|
const label = args.linkLabel ?? `Layer-link class "${args.sourceClassId}"`;
|
|
87885
|
-
const
|
|
87886
|
-
|
|
87887
|
-
|
|
88297
|
+
const relationResolver = args.relationResolver ?? createEffectiveClassRelationResolver({
|
|
88298
|
+
classes: args.classes,
|
|
88299
|
+
relations: args.relations
|
|
88300
|
+
});
|
|
88301
|
+
const sourceClass = relationResolver.classesById.get(args.sourceClassId);
|
|
87888
88302
|
if (sourceClass === void 0) {
|
|
87889
88303
|
throw new Error(
|
|
87890
88304
|
`${label} references missing class "${args.sourceClassId}".`
|
|
@@ -87895,21 +88309,18 @@ function resolveWorldLayerLinkTarget(args) {
|
|
|
87895
88309
|
`${label} cannot instantiate abstract class "${args.sourceClassId}".`
|
|
87896
88310
|
);
|
|
87897
88311
|
}
|
|
87898
|
-
const descriptor = worldLayerLinkTargetDescriptorForClass(
|
|
87899
|
-
args.sourceClassId
|
|
87900
|
-
args.classes
|
|
88312
|
+
const descriptor = args.worldKindsByClassId === void 0 ? worldLayerLinkTargetDescriptorForClass(args.sourceClassId, args.classes) : worldLayerLinkTargetDescriptor(
|
|
88313
|
+
args.worldKindsByClassId.get(args.sourceClassId) ?? null
|
|
87901
88314
|
);
|
|
87902
88315
|
if (descriptor === null) {
|
|
87903
88316
|
throw new Error(
|
|
87904
88317
|
`${label} class "${args.sourceClassId}" is not a tile/object layer-link class.`
|
|
87905
88318
|
);
|
|
87906
88319
|
}
|
|
87907
|
-
const effective =
|
|
87908
|
-
|
|
87909
|
-
|
|
87910
|
-
|
|
87911
|
-
classes: args.classes
|
|
87912
|
-
});
|
|
88320
|
+
const effective = relationResolver.resolve(
|
|
88321
|
+
descriptor.relationKind,
|
|
88322
|
+
args.sourceClassId
|
|
88323
|
+
);
|
|
87913
88324
|
if (effective.length > 1) {
|
|
87914
88325
|
throw new Error(
|
|
87915
88326
|
`${label} class "${args.sourceClassId}" resolves more than one effective target for relation kind "${descriptor.relationKind}".`
|
|
@@ -87917,8 +88328,8 @@ function resolveWorldLayerLinkTarget(args) {
|
|
|
87917
88328
|
}
|
|
87918
88329
|
const relationTarget = effective[0] ?? null;
|
|
87919
88330
|
if (relationTarget !== null) {
|
|
87920
|
-
const declarationClass =
|
|
87921
|
-
|
|
88331
|
+
const declarationClass = relationResolver.classesById.get(
|
|
88332
|
+
relationTarget.declaredSourceRecordId
|
|
87922
88333
|
);
|
|
87923
88334
|
if (declarationClass?.system?.worldKind === NeoWorldSystemClassKind.TileLayerLink || declarationClass?.system?.worldKind === NeoWorldSystemClassKind.ObjectLayerLink) {
|
|
87924
88335
|
throw new Error(
|
|
@@ -87932,9 +88343,7 @@ function resolveWorldLayerLinkTarget(args) {
|
|
|
87932
88343
|
);
|
|
87933
88344
|
}
|
|
87934
88345
|
const targetClassId = relationTarget.targetRecordId;
|
|
87935
|
-
const targetClass =
|
|
87936
|
-
(candidate) => candidate.id === targetClassId
|
|
87937
|
-
);
|
|
88346
|
+
const targetClass = relationResolver.classesById.get(targetClassId);
|
|
87938
88347
|
if (targetClass === void 0) {
|
|
87939
88348
|
throw new Error(`${label} targets missing layer class "${targetClassId}".`);
|
|
87940
88349
|
}
|
|
@@ -87943,10 +88352,7 @@ function resolveWorldLayerLinkTarget(args) {
|
|
|
87943
88352
|
`${label} targets abstract layer class "${targetClassId}".`
|
|
87944
88353
|
);
|
|
87945
88354
|
}
|
|
87946
|
-
const targetWorldKind = resolveWorldSystemClassKind(
|
|
87947
|
-
targetClass.id,
|
|
87948
|
-
args.classes
|
|
87949
|
-
);
|
|
88355
|
+
const targetWorldKind = args.worldKindsByClassId?.get(targetClass.id) ?? resolveWorldSystemClassKind(targetClass.id, args.classes);
|
|
87950
88356
|
if (targetWorldKind !== descriptor.targetWorldKind) {
|
|
87951
88357
|
throw new Error(
|
|
87952
88358
|
`${label} targets class "${targetClassId}" of world kind "${String(targetWorldKind)}"; expected "${descriptor.targetWorldKind}".`
|
|
@@ -88956,6 +89362,11 @@ function readMember(value) {
|
|
|
88956
89362
|
function readClass(value) {
|
|
88957
89363
|
if (!isRecord6(value)) throw new Error("Class record is not an object.");
|
|
88958
89364
|
if (typeof value.id !== "string") throw new Error("Class id is invalid.");
|
|
89365
|
+
if (hasRetiredConstructorProjectionsTombstone(value)) {
|
|
89366
|
+
throw new Error(
|
|
89367
|
+
`Class "${value.id}" cannot declare retired field "constructorProjections".`
|
|
89368
|
+
);
|
|
89369
|
+
}
|
|
88959
89370
|
if (typeof value.name !== "string") {
|
|
88960
89371
|
throw new Error(`Class "${value.id}" name is invalid.`);
|
|
88961
89372
|
}
|
|
@@ -90725,26 +91136,6 @@ function assertOpaqueConstructorValid(declaredConstructor) {
|
|
|
90725
91136
|
assertOpaqueConstructorBaseClauseValid(declaredConstructor);
|
|
90726
91137
|
return argumentTypes;
|
|
90727
91138
|
}
|
|
90728
|
-
function assertOpaqueConstructorProjectionsDisjoint(declaredConstructor, owner) {
|
|
90729
|
-
const projections = owner.constructorProjections;
|
|
90730
|
-
if (projections === void 0 || projections === null) return;
|
|
90731
|
-
if (!Array.isArray(projections)) {
|
|
90732
|
-
throw new Error(`Class "${owner.id}" constructorProjections are invalid.`);
|
|
90733
|
-
}
|
|
90734
|
-
const projected = new Set(
|
|
90735
|
-
projections.filter(
|
|
90736
|
-
(projection) => isRecord6(projection) && typeof projection.parameterName === "string"
|
|
90737
|
-
).map((projection) => projection.parameterName.toLowerCase())
|
|
90738
|
-
);
|
|
90739
|
-
if (projected.size === 0) return;
|
|
90740
|
-
for (const argument2 of declaredConstructor.argumentTypes) {
|
|
90741
|
-
if (!isRecord6(argument2) || typeof argument2.name !== "string") continue;
|
|
90742
|
-
if (!projected.has(argument2.name.toLowerCase())) continue;
|
|
90743
|
-
throw new Error(
|
|
90744
|
-
`Constructor "${declaredConstructor.id}" declares parameter "${argument2.name}", which is also a constructor projection argument on class "${owner.id}"; a call site could not tell the two apart.`
|
|
90745
|
-
);
|
|
90746
|
-
}
|
|
90747
|
-
}
|
|
90748
91139
|
function assertOpaqueRequiredConstructorValid(schemaClass2, constructorsById) {
|
|
90749
91140
|
const requiredConstructorId2 = schemaClass2.requiredConstructorId;
|
|
90750
91141
|
if (requiredConstructorId2 === void 0 || requiredConstructorId2 === null) {
|
|
@@ -90813,7 +91204,6 @@ function assertOpaqueConstructorsValid(constructors, classesById2) {
|
|
|
90813
91204
|
`Class "${owner.id}" names constructor "${declaredConstructor.id}" as its required constructor and also lists it in constructorIds; the required constructor is not a declared member.`
|
|
90814
91205
|
);
|
|
90815
91206
|
}
|
|
90816
|
-
assertOpaqueConstructorProjectionsDisjoint(declaredConstructor, owner);
|
|
90817
91207
|
const siblings = constructorsByClassId.get(declaredConstructor.classId) ?? [];
|
|
90818
91208
|
siblings.push(declaredConstructor);
|
|
90819
91209
|
constructorsByClassId.set(declaredConstructor.classId, siblings);
|
|
@@ -91075,6 +91465,7 @@ var init_projectInterfaceValidation = __esm({
|
|
|
91075
91465
|
"use strict";
|
|
91076
91466
|
init_projectVariantValidation();
|
|
91077
91467
|
init_src();
|
|
91468
|
+
init_classes();
|
|
91078
91469
|
NEO_OBJECT_WORLD_KIND = "object";
|
|
91079
91470
|
READ_ONLY_SYNTHETIC_VALUE_ID_PREFIX2 = "__neo_readonly_default:";
|
|
91080
91471
|
REJECTED_OPAQUE_CONSTRUCTOR_KEYS = [
|
|
@@ -94939,7 +95330,10 @@ function attachPreparedValuePlacements(prepared, document) {
|
|
|
94939
95330
|
(change) => change.recordKind === "value" && change.operation === "create"
|
|
94940
95331
|
);
|
|
94941
95332
|
if (creates.length === 0) return;
|
|
94942
|
-
const materializedGraph =
|
|
95333
|
+
const materializedGraph = createVariantMaterializedValueGraphContext(
|
|
95334
|
+
document,
|
|
95335
|
+
document.variants ?? []
|
|
95336
|
+
);
|
|
94943
95337
|
const constructorEdges = [];
|
|
94944
95338
|
for (const edges of materializedGraph.edgesByOwnerValueId.values()) {
|
|
94945
95339
|
for (const edge of edges) {
|
|
@@ -95010,7 +95404,11 @@ function attachPreparedConstructorAggregateEdges(prepared, document) {
|
|
|
95010
95404
|
}
|
|
95011
95405
|
}
|
|
95012
95406
|
}
|
|
95013
|
-
const graph = needsGraph ?
|
|
95407
|
+
const graph = !needsGraph ? null : createVariantMaterializedValueGraphContext(
|
|
95408
|
+
document,
|
|
95409
|
+
document.variants ?? [],
|
|
95410
|
+
changedValueRows
|
|
95411
|
+
);
|
|
95014
95412
|
for (const change of valueChanges) {
|
|
95015
95413
|
change.constructorAggregateEdges = [
|
|
95016
95414
|
...graph?.edgesByOwnerValueId.get(change.recordId) ?? []
|
|
@@ -95066,13 +95464,16 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
95066
95464
|
const existingValueById = new Map(
|
|
95067
95465
|
args.document.values.map((value) => [value.id, value])
|
|
95068
95466
|
);
|
|
95069
|
-
let currentGraph = null;
|
|
95070
|
-
const requireCurrentGraph = () => currentGraph ??= new MaterializedValueGraphContext(args.document);
|
|
95071
95467
|
const rootKinds = /* @__PURE__ */ new Map();
|
|
95072
95468
|
const materializationScope = withVariantOwnershipRoots(
|
|
95073
95469
|
compiledDocument,
|
|
95074
95470
|
compiledDocument.variants ?? []
|
|
95075
95471
|
);
|
|
95472
|
+
let currentGraph = null;
|
|
95473
|
+
const requireCurrentGraph = () => currentGraph ??= createVariantMaterializedValueGraphContext(
|
|
95474
|
+
materializationScope.document,
|
|
95475
|
+
materializationScope.document.variants ?? []
|
|
95476
|
+
);
|
|
95076
95477
|
const owners = resolveSemanticOwnerMembersForValues(
|
|
95077
95478
|
materializationScope.document,
|
|
95078
95479
|
new Set(sites.keys()),
|
|
@@ -95106,7 +95507,11 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
95106
95507
|
});
|
|
95107
95508
|
if (existingConstructedRoot) {
|
|
95108
95509
|
if (!isLiteralValueContent(materialized.root) || existingRoot.classId !== materialized.root.classId || !replayedCreationDataMatches({
|
|
95109
|
-
|
|
95510
|
+
// The synthetic variant binding members are part of the ownership
|
|
95511
|
+
// scope that compiled and evaluated this initializer. Stored replay
|
|
95512
|
+
// closes its generic slot from the same ephemeral member id, so its
|
|
95513
|
+
// expansion must read that scoped document too.
|
|
95514
|
+
currentDocument: materializationScope.document,
|
|
95110
95515
|
currentGraph: requireCurrentGraph(),
|
|
95111
95516
|
currentRoot: existingRoot,
|
|
95112
95517
|
rootMember: member,
|
|
@@ -95253,7 +95658,10 @@ function reconcileInitializerMaterializationTransport(args) {
|
|
|
95253
95658
|
allServerIds.add(change.recordId);
|
|
95254
95659
|
}
|
|
95255
95660
|
}
|
|
95256
|
-
const graph =
|
|
95661
|
+
const graph = createVariantMaterializedValueGraphContext(
|
|
95662
|
+
args.document,
|
|
95663
|
+
args.document.variants ?? []
|
|
95664
|
+
);
|
|
95257
95665
|
const serverOwners = graph.ownersForValues(allServerIds);
|
|
95258
95666
|
for (const sourceValueId of serverRootIds) {
|
|
95259
95667
|
const local = roots.get(sourceValueId);
|
|
@@ -95346,12 +95754,14 @@ function constructorArgumentsSemanticallyEqual(args) {
|
|
|
95346
95754
|
const replayRows = new Map(args.currentGraph.valuesById);
|
|
95347
95755
|
replayRows.set(args.replayRoot.id, args.replayRoot);
|
|
95348
95756
|
for (const row of args.replayCreated) replayRows.set(row.id, row);
|
|
95349
|
-
const currentNormalized =
|
|
95757
|
+
const currentNormalized = createVariantMaterializedValueGraphContext(
|
|
95350
95758
|
args.currentDocument,
|
|
95759
|
+
args.currentDocument.variants ?? [],
|
|
95351
95760
|
currentRows
|
|
95352
95761
|
).normalizeConstructorArguments(args.current, args.currentRoot);
|
|
95353
|
-
const replayNormalized =
|
|
95762
|
+
const replayNormalized = createVariantMaterializedValueGraphContext(
|
|
95354
95763
|
args.currentDocument,
|
|
95764
|
+
args.currentDocument.variants ?? [],
|
|
95355
95765
|
replayRows
|
|
95356
95766
|
).normalizeConstructorArguments(args.replay, args.replayRoot);
|
|
95357
95767
|
return canonicallyEqual2(currentNormalized, replayNormalized);
|
|
@@ -98322,7 +98732,7 @@ function reconcileVariantConstructorArgs(args) {
|
|
|
98322
98732
|
const valueById = indexRecordsById(postDocument.values);
|
|
98323
98733
|
const classById = indexRecordsById(postDocument.classes);
|
|
98324
98734
|
const memberById2 = indexRecordsById(postDocument.members);
|
|
98325
|
-
const
|
|
98735
|
+
const constructorById2 = indexRecordsById(postDocument.constructors ?? []);
|
|
98326
98736
|
let baseHashByValueId = null;
|
|
98327
98737
|
for (const variant of variants) {
|
|
98328
98738
|
const root = valueById.get(variant.valueId);
|
|
@@ -98335,7 +98745,7 @@ function reconcileVariantConstructorArgs(args) {
|
|
|
98335
98745
|
if (schemaClass2 === void 0) continue;
|
|
98336
98746
|
const constructorId = schemaClass2.requiredConstructorId;
|
|
98337
98747
|
if (typeof constructorId !== "string") continue;
|
|
98338
|
-
const constructorRecord =
|
|
98748
|
+
const constructorRecord = constructorById2.get(constructorId);
|
|
98339
98749
|
if (constructorRecord === void 0) continue;
|
|
98340
98750
|
if (typeof root.value !== "object" || root.value === null) continue;
|
|
98341
98751
|
if (Array.isArray(root.value)) continue;
|
|
@@ -99508,7 +99918,7 @@ function animationFamilyClasses(document) {
|
|
|
99508
99918
|
const classes = new Map(document.classes.map((entry) => [entry.id, entry]));
|
|
99509
99919
|
const animationKinds = new Set(WORLD_SYSTEM_ANIMATION_KINDS);
|
|
99510
99920
|
const result = /* @__PURE__ */ new Map();
|
|
99511
|
-
const
|
|
99921
|
+
const resolve5 = (classId, visiting) => {
|
|
99512
99922
|
const cached = result.get(classId);
|
|
99513
99923
|
if (cached !== void 0) return cached;
|
|
99514
99924
|
if (visiting.has(classId)) return false;
|
|
@@ -99520,11 +99930,11 @@ function animationFamilyClasses(document) {
|
|
|
99520
99930
|
return true;
|
|
99521
99931
|
}
|
|
99522
99932
|
const nextVisiting = new Set(visiting).add(classId);
|
|
99523
|
-
const belongs = typeof schemaClass2.extendsClassId === "string" &&
|
|
99933
|
+
const belongs = typeof schemaClass2.extendsClassId === "string" && resolve5(schemaClass2.extendsClassId, nextVisiting);
|
|
99524
99934
|
result.set(classId, belongs);
|
|
99525
99935
|
return belongs;
|
|
99526
99936
|
};
|
|
99527
|
-
for (const classId of classes.keys())
|
|
99937
|
+
for (const classId of classes.keys()) resolve5(classId, /* @__PURE__ */ new Set());
|
|
99528
99938
|
return new Set(
|
|
99529
99939
|
[...result].flatMap(([classId, belongs]) => belongs ? [classId] : [])
|
|
99530
99940
|
);
|
|
@@ -101351,7 +101761,7 @@ function classBelongsToAnimationFamily(classes, classId) {
|
|
|
101351
101761
|
function prospectiveAnimationDocumentV4(records2) {
|
|
101352
101762
|
const candidates = [...records2];
|
|
101353
101763
|
const hasAnimationSchema = candidates.some(
|
|
101354
|
-
(record3) => record3.recordKind === "class" &&
|
|
101764
|
+
(record3) => record3.recordKind === "class" && declaresAnimationWorldKind(record3.data.system)
|
|
101355
101765
|
);
|
|
101356
101766
|
if (!hasAnimationSchema) return null;
|
|
101357
101767
|
const memberRecords = new Map(
|
|
@@ -104998,14 +105408,6 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
|
|
|
104998
105408
|
const assignmentSlices = objectInitializerSlices(binding.initializer);
|
|
104999
105409
|
for (const assignment of expression.initializer ?? []) {
|
|
105000
105410
|
const childMember = classMemberByName(context, classId, assignment.name);
|
|
105001
|
-
if (inheritedLegacyConstructorProjections(
|
|
105002
|
-
context.classes,
|
|
105003
|
-
schemaClass2.id
|
|
105004
|
-
).some((projection) => projection.memberId === childMember.id)) {
|
|
105005
|
-
throw new Error(
|
|
105006
|
-
`Default value ${binding.label}.${assignment.name} is constructor-projected and must be set through its named constructor argument.`
|
|
105007
|
-
);
|
|
105008
|
-
}
|
|
105009
105411
|
const childValueMember = recursivePartialMember(member, childMember);
|
|
105010
105412
|
const childSlice = assignmentSlices.get(assignment.name);
|
|
105011
105413
|
const existingId = isObjectRecord2(baseBody) ? baseBody[assignment.name] : void 0;
|
|
@@ -105645,14 +106047,6 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
|
|
|
105645
106047
|
effectiveClass.id,
|
|
105646
106048
|
assignment.name
|
|
105647
106049
|
);
|
|
105648
|
-
if (!partial && inheritedLegacyConstructorProjections(
|
|
105649
|
-
context.classes,
|
|
105650
|
-
effectiveClass.id
|
|
105651
|
-
).some((projection) => projection.memberId === childMember.id)) {
|
|
105652
|
-
throw new Error(
|
|
105653
|
-
`Class value ${path}.${assignment.name} is constructor-projected and must be set through its named constructor argument.`
|
|
105654
|
-
);
|
|
105655
|
-
}
|
|
105656
106050
|
const childPath = `${path}.${assignment.name}`;
|
|
105657
106051
|
const childId = lowerSeedChild(
|
|
105658
106052
|
context,
|
|
@@ -106417,14 +106811,6 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
|
|
|
106417
106811
|
}
|
|
106418
106812
|
for (const assignment of expression.initializer ?? []) {
|
|
106419
106813
|
const childMember = classMemberByName(context, classId, assignment.name);
|
|
106420
|
-
if (!partial && inheritedLegacyConstructorProjections(
|
|
106421
|
-
context.classes,
|
|
106422
|
-
schemaClass2.id
|
|
106423
|
-
).some((projection) => projection.memberId === childMember.id)) {
|
|
106424
|
-
throw new Error(
|
|
106425
|
-
`Class value ${String(base.id)}.${assignment.name} is constructor-projected and must be set through its named constructor argument.`
|
|
106426
|
-
);
|
|
106427
|
-
}
|
|
106428
106814
|
const childId = baseBody[assignment.name];
|
|
106429
106815
|
if (typeof childId !== "string") {
|
|
106430
106816
|
const symbolId2 = sourceValueSymbol(context, assignment.value);
|
|
@@ -106750,24 +107136,10 @@ function classInheritanceChain(classes, classId) {
|
|
|
106750
107136
|
}
|
|
106751
107137
|
return chain;
|
|
106752
107138
|
}
|
|
106753
|
-
function inheritedLegacyConstructorProjections(classes, classId) {
|
|
106754
|
-
const resolved = [];
|
|
106755
|
-
const claimed = /* @__PURE__ */ new Set();
|
|
106756
|
-
for (const schemaClass2 of classInheritanceChain(classes, classId)) {
|
|
106757
|
-
for (const projection of schemaClass2.constructorProjections ?? []) {
|
|
106758
|
-
if (claimed.has(projection.parameterName)) continue;
|
|
106759
|
-
claimed.add(projection.parameterName);
|
|
106760
|
-
resolved.push(projection);
|
|
106761
|
-
}
|
|
106762
|
-
}
|
|
106763
|
-
return resolved;
|
|
106764
|
-
}
|
|
106765
107139
|
function effectiveConstructorProjections(classes, constructors, members, classId) {
|
|
106766
107140
|
const schemaClass2 = classes.get(classId);
|
|
106767
107141
|
const requiredId = schemaClass2?.requiredConstructorId;
|
|
106768
|
-
if (schemaClass2 === void 0 || requiredId === void 0)
|
|
106769
|
-
return inheritedLegacyConstructorProjections(classes, classId);
|
|
106770
|
-
}
|
|
107142
|
+
if (schemaClass2 === void 0 || requiredId === void 0) return [];
|
|
106771
107143
|
const required2 = constructors.get(requiredId);
|
|
106772
107144
|
if (required2 === void 0) return [];
|
|
106773
107145
|
const projected = requiredConstructorProjectionMap(
|
|
@@ -107015,7 +107387,10 @@ function inferAnimationChildOverrideLowerEnvironment(context, schemaClass2, expr
|
|
|
107015
107387
|
return inherited;
|
|
107016
107388
|
}
|
|
107017
107389
|
const parameter4 = schemaClass2.genericParameters[0];
|
|
107018
|
-
const parameterName =
|
|
107390
|
+
const parameterName = requiredConstructorFirstParameterName(
|
|
107391
|
+
context,
|
|
107392
|
+
schemaClass2
|
|
107393
|
+
);
|
|
107019
107394
|
if (parameter4 === void 0 || parameterName === null) return inherited;
|
|
107020
107395
|
const argumentIndex = expression.argumentNames?.findIndex(
|
|
107021
107396
|
(name) => name === parameterName
|
|
@@ -110386,8 +110761,157 @@ var init_value_sources = __esm({
|
|
|
110386
110761
|
}
|
|
110387
110762
|
});
|
|
110388
110763
|
|
|
110764
|
+
// src/project-source/workspace-source-path.ts
|
|
110765
|
+
import { existsSync as existsSync3, lstatSync, realpathSync } from "node:fs";
|
|
110766
|
+
import { dirname as dirname4, isAbsolute as isAbsolute2, relative, resolve as resolve2, sep } from "node:path";
|
|
110767
|
+
function normalizeWorkspaceSourcePath(path) {
|
|
110768
|
+
const normalized = path.replaceAll("\\", "/");
|
|
110769
|
+
if (normalized.length === 0) {
|
|
110770
|
+
throw new Error("Project source path is empty.");
|
|
110771
|
+
}
|
|
110772
|
+
if (normalized.includes("\0")) {
|
|
110773
|
+
throw new Error(
|
|
110774
|
+
`Project source path ${JSON.stringify(path)} contains a null byte.`
|
|
110775
|
+
);
|
|
110776
|
+
}
|
|
110777
|
+
if (isAbsolute2(normalized)) {
|
|
110778
|
+
throw new Error(`Project source path ${JSON.stringify(path)} is absolute.`);
|
|
110779
|
+
}
|
|
110780
|
+
if (/^[A-Za-z]:\//u.test(normalized)) {
|
|
110781
|
+
throw new Error(
|
|
110782
|
+
`Project source path ${JSON.stringify(path)} is a Windows absolute path.`
|
|
110783
|
+
);
|
|
110784
|
+
}
|
|
110785
|
+
const parts = normalized.split("/");
|
|
110786
|
+
for (const part of parts) {
|
|
110787
|
+
if (part === "") {
|
|
110788
|
+
throw new Error(
|
|
110789
|
+
`Project source path ${JSON.stringify(path)} contains an empty segment.`
|
|
110790
|
+
);
|
|
110791
|
+
}
|
|
110792
|
+
if (part === ".") {
|
|
110793
|
+
throw new Error(
|
|
110794
|
+
`Project source path ${JSON.stringify(path)} contains a current-directory segment.`
|
|
110795
|
+
);
|
|
110796
|
+
}
|
|
110797
|
+
if (part === "..") {
|
|
110798
|
+
throw new Error(
|
|
110799
|
+
`Project source path ${JSON.stringify(path)} contains a parent-directory segment.`
|
|
110800
|
+
);
|
|
110801
|
+
}
|
|
110802
|
+
}
|
|
110803
|
+
return normalized;
|
|
110804
|
+
}
|
|
110805
|
+
function createWorkspaceSourcePathResolver(root) {
|
|
110806
|
+
const rootAbsolute = resolve2(root);
|
|
110807
|
+
const rootReal = realpathSync(rootAbsolute);
|
|
110808
|
+
return (path) => {
|
|
110809
|
+
const normalized = normalizeWorkspaceSourcePath(path);
|
|
110810
|
+
const absolute = resolve2(rootAbsolute, normalized);
|
|
110811
|
+
if (!containsPath(rootAbsolute, absolute)) {
|
|
110812
|
+
throw new Error(
|
|
110813
|
+
`Project source path ${JSON.stringify(path)} escapes the workspace.`
|
|
110814
|
+
);
|
|
110815
|
+
}
|
|
110816
|
+
const target = lstatSync(absolute, { throwIfNoEntry: false });
|
|
110817
|
+
if (target?.isSymbolicLink()) {
|
|
110818
|
+
throw new Error(
|
|
110819
|
+
`Project source path ${JSON.stringify(path)} targets a symbolic link.`
|
|
110820
|
+
);
|
|
110821
|
+
}
|
|
110822
|
+
let existing = target === void 0 ? dirname4(absolute) : absolute;
|
|
110823
|
+
while (!existsSync3(existing)) existing = dirname4(existing);
|
|
110824
|
+
if (!containsPath(rootReal, realpathSync(existing))) {
|
|
110825
|
+
throw new Error(
|
|
110826
|
+
`Project source path ${JSON.stringify(path)} traverses outside the workspace.`
|
|
110827
|
+
);
|
|
110828
|
+
}
|
|
110829
|
+
return absolute;
|
|
110830
|
+
};
|
|
110831
|
+
}
|
|
110832
|
+
function containsPath(parent, candidate) {
|
|
110833
|
+
const fromParent = relative(parent, candidate);
|
|
110834
|
+
return fromParent === "" || !isAbsolute2(fromParent) && fromParent !== ".." && !fromParent.startsWith(`..${sep}`);
|
|
110835
|
+
}
|
|
110836
|
+
var init_workspace_source_path = __esm({
|
|
110837
|
+
"src/project-source/workspace-source-path.ts"() {
|
|
110838
|
+
"use strict";
|
|
110839
|
+
}
|
|
110840
|
+
});
|
|
110841
|
+
|
|
110389
110842
|
// src/project-source/project-documents.ts
|
|
110390
|
-
function
|
|
110843
|
+
function projectRecordFilesV4(...collections) {
|
|
110844
|
+
const files = /* @__PURE__ */ new Map();
|
|
110845
|
+
for (const records2 of collections) {
|
|
110846
|
+
for (const record3 of records2) {
|
|
110847
|
+
if (record3.file === void 0 || record3.file === null) continue;
|
|
110848
|
+
files.set(`${record3.recordKind}:${record3.recordId}`, record3.file);
|
|
110849
|
+
}
|
|
110850
|
+
}
|
|
110851
|
+
return files;
|
|
110852
|
+
}
|
|
110853
|
+
function authoredDefinitionPathV4(file, recordFiles) {
|
|
110854
|
+
let path = null;
|
|
110855
|
+
for (const key of file.recordKeys) {
|
|
110856
|
+
const candidate = recordFiles.get(key);
|
|
110857
|
+
if (candidate === void 0) continue;
|
|
110858
|
+
const normalizedCandidate = normalizeWorkspaceSourcePath(candidate);
|
|
110859
|
+
if (neoProjectSourceKind(normalizedCandidate) !== "definition") continue;
|
|
110860
|
+
if (path !== null && path !== normalizedCandidate) return null;
|
|
110861
|
+
path = normalizedCandidate;
|
|
110862
|
+
}
|
|
110863
|
+
return path;
|
|
110864
|
+
}
|
|
110865
|
+
function retainAuthoredDefinitionGroupingV4(files, recordFiles) {
|
|
110866
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
110867
|
+
const paths = /* @__PURE__ */ new Map();
|
|
110868
|
+
for (const file of files) {
|
|
110869
|
+
const authoredPath = authoredDefinitionPathV4(file, recordFiles);
|
|
110870
|
+
const path = authoredPath ?? file.path;
|
|
110871
|
+
const folded = invariantCaseKey(path);
|
|
110872
|
+
const prior = grouped.get(folded);
|
|
110873
|
+
paths.set(file.path, path);
|
|
110874
|
+
if (prior === void 0) {
|
|
110875
|
+
grouped.set(folded, {
|
|
110876
|
+
path,
|
|
110877
|
+
content: [file.content],
|
|
110878
|
+
recordKeys: file.recordKeys.slice(),
|
|
110879
|
+
authored: authoredPath !== null
|
|
110880
|
+
});
|
|
110881
|
+
continue;
|
|
110882
|
+
}
|
|
110883
|
+
if (prior.path !== path) {
|
|
110884
|
+
if (prior.authored && authoredPath !== null) {
|
|
110885
|
+
throw new Error(
|
|
110886
|
+
`Authored record placements have a case-insensitive project source path collision between ${JSON.stringify(prior.path)} and ${JSON.stringify(path)}.`
|
|
110887
|
+
);
|
|
110888
|
+
}
|
|
110889
|
+
if (authoredPath !== null) prior.path = path;
|
|
110890
|
+
else if (!prior.authored) {
|
|
110891
|
+
throw new Error(
|
|
110892
|
+
`Canonical emission has a case-insensitive project source path collision between ${JSON.stringify(prior.path)} and ${JSON.stringify(path)}.`
|
|
110893
|
+
);
|
|
110894
|
+
}
|
|
110895
|
+
}
|
|
110896
|
+
prior.content.push(file.content);
|
|
110897
|
+
for (const key of file.recordKeys) prior.recordKeys.push(key);
|
|
110898
|
+
prior.authored ||= authoredPath !== null;
|
|
110899
|
+
paths.set(file.path, prior.path);
|
|
110900
|
+
}
|
|
110901
|
+
for (const [canonicalPath2, targetPath] of paths) {
|
|
110902
|
+
const finalPath = grouped.get(invariantCaseKey(targetPath))?.path;
|
|
110903
|
+
if (finalPath !== void 0) paths.set(canonicalPath2, finalPath);
|
|
110904
|
+
}
|
|
110905
|
+
return {
|
|
110906
|
+
files: grouped.values().map((file) => ({
|
|
110907
|
+
path: file.path,
|
|
110908
|
+
content: file.content.join("\n"),
|
|
110909
|
+
recordKeys: file.recordKeys
|
|
110910
|
+
})).toArray().sort((left, right) => compareCodePoints(left.path, right.path)),
|
|
110911
|
+
paths
|
|
110912
|
+
};
|
|
110913
|
+
}
|
|
110914
|
+
function emitProjectDocumentFilesV4(records2, options = {}) {
|
|
110391
110915
|
const schemaRecords = [];
|
|
110392
110916
|
for (const record3 of records2.values()) {
|
|
110393
110917
|
if (record3.deleted || !isSchemaRecordKindV4(record3.recordKind)) continue;
|
|
@@ -110417,69 +110941,79 @@ function emitProjectDocumentFilesV4(records2) {
|
|
|
110417
110941
|
collectionValuePaths: rootValuePathsByValueId(records2.values()),
|
|
110418
110942
|
variantInitializers: variantValues.initializers
|
|
110419
110943
|
});
|
|
110944
|
+
const sourceFiles = baseSource.files.map((file) => {
|
|
110945
|
+
const ownedKeys = [];
|
|
110946
|
+
for (const key of file.recordKeys) {
|
|
110947
|
+
if (key.startsWith("variant:")) {
|
|
110948
|
+
for (const ownedKey of variantValues.recordKeysByVariant.get(
|
|
110949
|
+
key.slice(8)
|
|
110950
|
+
) ?? []) {
|
|
110951
|
+
ownedKeys.push(ownedKey);
|
|
110952
|
+
}
|
|
110953
|
+
continue;
|
|
110954
|
+
}
|
|
110955
|
+
if (!key.startsWith("member:")) continue;
|
|
110956
|
+
const memberId = key.slice(7);
|
|
110957
|
+
for (const ownedKey of staticValues.recordKeysByMember.get(memberId) ?? []) {
|
|
110958
|
+
ownedKeys.push(ownedKey);
|
|
110959
|
+
}
|
|
110960
|
+
for (const ownedKey of memberDefaults.recordKeysByMember.get(memberId) ?? []) {
|
|
110961
|
+
ownedKeys.push(ownedKey);
|
|
110962
|
+
}
|
|
110963
|
+
}
|
|
110964
|
+
return ownedKeys.length === 0 ? file : { ...file, recordKeys: file.recordKeys.concat(ownedKeys) };
|
|
110965
|
+
});
|
|
110420
110966
|
const source = {
|
|
110421
110967
|
...baseSource,
|
|
110422
|
-
files:
|
|
110423
|
-
const ownedKeys = file.recordKeys.flatMap((key) => {
|
|
110424
|
-
if (key.startsWith("variant:")) {
|
|
110425
|
-
return [
|
|
110426
|
-
...variantValues.recordKeysByVariant.get(key.slice(8)) ?? []
|
|
110427
|
-
];
|
|
110428
|
-
}
|
|
110429
|
-
if (!key.startsWith("member:")) return [];
|
|
110430
|
-
const memberId = key.slice(7);
|
|
110431
|
-
return [
|
|
110432
|
-
...staticValues.recordKeysByMember.get(memberId) ?? [],
|
|
110433
|
-
...memberDefaults.recordKeysByMember.get(memberId) ?? []
|
|
110434
|
-
];
|
|
110435
|
-
});
|
|
110436
|
-
return ownedKeys.length === 0 ? file : { ...file, recordKeys: [...file.recordKeys, ...ownedKeys] };
|
|
110437
|
-
})
|
|
110968
|
+
files: sourceFiles
|
|
110438
110969
|
};
|
|
110439
110970
|
const classNames = new IdentifierTable();
|
|
110440
110971
|
for (const schemaClass2 of manifest.classes) {
|
|
110441
110972
|
classNames.assign(schemaClass2.id, schemaClass2.name);
|
|
110442
110973
|
}
|
|
110443
|
-
const migrationFiles =
|
|
110974
|
+
const migrationFiles = records2.values().filter((record3) => !record3.deleted && record3.recordKind === "migration").map((record3) => {
|
|
110444
110975
|
const emitted = emitMigrationFile(record3, classNames);
|
|
110445
110976
|
return {
|
|
110446
110977
|
path: emitted.path,
|
|
110447
110978
|
content: emitted.content,
|
|
110448
110979
|
recordKeys: emitted.recordKeys
|
|
110449
110980
|
};
|
|
110450
|
-
});
|
|
110981
|
+
}).toArray();
|
|
110451
110982
|
const supplementalFiles = emitSupplementalProjectSourcesV4(records2);
|
|
110452
|
-
const materializedConstructors = new Map(
|
|
110453
|
-
|
|
110454
|
-
|
|
110455
|
-
])
|
|
110456
|
-
|
|
110457
|
-
|
|
110458
|
-
|
|
110459
|
-
|
|
110983
|
+
const materializedConstructors = new Map(
|
|
110984
|
+
staticValues.materializedConstructors
|
|
110985
|
+
);
|
|
110986
|
+
for (const [key, value] of memberDefaults.materializedConstructors) {
|
|
110987
|
+
materializedConstructors.set(key, value);
|
|
110988
|
+
}
|
|
110989
|
+
const materializedConstructorOverrideKeys = new Map(
|
|
110990
|
+
staticValues.materializedConstructorOverrideKeys
|
|
110991
|
+
);
|
|
110992
|
+
for (const [
|
|
110993
|
+
key,
|
|
110994
|
+
value
|
|
110995
|
+
] of memberDefaults.materializedConstructorOverrideKeys) {
|
|
110996
|
+
materializedConstructorOverrideKeys.set(key, value);
|
|
110997
|
+
}
|
|
110460
110998
|
const rootFile = emitProjectRootSourceV4(
|
|
110461
110999
|
records2,
|
|
110462
111000
|
manifest,
|
|
110463
111001
|
materializedConstructors
|
|
110464
111002
|
);
|
|
110465
111003
|
const dialogueFiles = emitDialogueProjectSourcesV4(records2);
|
|
110466
|
-
const
|
|
110467
|
-
|
|
110468
|
-
|
|
110469
|
-
|
|
110470
|
-
|
|
110471
|
-
|
|
110472
|
-
|
|
110473
|
-
|
|
110474
|
-
|
|
110475
|
-
|
|
110476
|
-
|
|
110477
|
-
|
|
110478
|
-
|
|
110479
|
-
...supplementalFiles,
|
|
110480
|
-
...dialogueFiles,
|
|
110481
|
-
...migrationFiles
|
|
110482
|
-
]) {
|
|
111004
|
+
const grouped = retainAuthoredDefinitionGroupingV4(
|
|
111005
|
+
[
|
|
111006
|
+
source.files,
|
|
111007
|
+
rootFile === null ? [] : [rootFile],
|
|
111008
|
+
supplementalFiles,
|
|
111009
|
+
dialogueFiles,
|
|
111010
|
+
migrationFiles
|
|
111011
|
+
].values().flatMap((files2) => files2.values()),
|
|
111012
|
+
options.recordFiles ?? /* @__PURE__ */ new Map()
|
|
111013
|
+
);
|
|
111014
|
+
const files = grouped.files;
|
|
111015
|
+
const recordFiles = /* @__PURE__ */ new Map();
|
|
111016
|
+
for (const file of files) {
|
|
110483
111017
|
for (const key of file.recordKeys) recordFiles.set(key, file.path);
|
|
110484
111018
|
}
|
|
110485
111019
|
for (const recovery of staticMemberOwnershipRecoveries) {
|
|
@@ -110517,7 +111051,10 @@ ${errors.map(
|
|
|
110517
111051
|
analysis,
|
|
110518
111052
|
materializedConstructors,
|
|
110519
111053
|
materializedConstructorOverrideKeys,
|
|
110520
|
-
formAlternates: source.formAlternates
|
|
111054
|
+
formAlternates: source.formAlternates.map((alternate) => ({
|
|
111055
|
+
...alternate,
|
|
111056
|
+
path: grouped.paths.get(alternate.path) ?? alternate.path
|
|
111057
|
+
})),
|
|
110521
111058
|
staticMemberOwnershipRecoveries
|
|
110522
111059
|
};
|
|
110523
111060
|
}
|
|
@@ -110572,6 +111109,7 @@ var init_project_documents = __esm({
|
|
|
110572
111109
|
init_source_diagnostics();
|
|
110573
111110
|
init_source_format();
|
|
110574
111111
|
init_static_member_ownership_recovery();
|
|
111112
|
+
init_workspace_source_path();
|
|
110575
111113
|
PROJECT_SOURCE_ANALYSIS_V4_CACHE_PATH = ".neo/project-source-analysis-v4.json";
|
|
110576
111114
|
SCHEMA_RECORD_KINDS2 = /* @__PURE__ */ new Set([
|
|
110577
111115
|
"class",
|
|
@@ -110593,7 +111131,7 @@ var init_project_documents = __esm({
|
|
|
110593
111131
|
// src/project-source/project-document-cache.ts
|
|
110594
111132
|
import { mkdirSync as mkdirSync5, readFileSync as readFileSync5, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
110595
111133
|
import { createHash as createHash6 } from "node:crypto";
|
|
110596
|
-
import { dirname as
|
|
111134
|
+
import { dirname as dirname5, join as join5 } from "node:path";
|
|
110597
111135
|
function readProjectSourceAnalysisBuildCacheV4(root, sources) {
|
|
110598
111136
|
try {
|
|
110599
111137
|
const parsed = JSON.parse(
|
|
@@ -110612,12 +111150,12 @@ function readProjectSourceAnalysisBuildCacheV4(root, sources) {
|
|
|
110612
111150
|
}
|
|
110613
111151
|
function writeProjectSourceAnalysisCacheV4(root, analysis, sources) {
|
|
110614
111152
|
const file = join5(root, PROJECT_SOURCE_ANALYSIS_V4_CACHE_PATH);
|
|
110615
|
-
mkdirSync5(
|
|
111153
|
+
mkdirSync5(dirname5(file), { recursive: true });
|
|
110616
111154
|
writeFileSync5(file, `${JSON.stringify(analysis, null, 2)}
|
|
110617
111155
|
`, "utf8");
|
|
110618
111156
|
if (sources === void 0) return;
|
|
110619
111157
|
const buildFile = join5(root, PROJECT_SOURCE_BUILD_CACHE_PATH);
|
|
110620
|
-
mkdirSync5(
|
|
111158
|
+
mkdirSync5(dirname5(buildFile), { recursive: true });
|
|
110621
111159
|
const temporary = `${buildFile}.${process.pid}.tmp`;
|
|
110622
111160
|
writeFileSync5(
|
|
110623
111161
|
temporary,
|
|
@@ -110688,7 +111226,7 @@ function readProjectSourceDocumentBuildCacheV1(root, sources) {
|
|
|
110688
111226
|
}
|
|
110689
111227
|
function writeProjectSourceDocumentBuildCacheV1(root, sources, documents) {
|
|
110690
111228
|
const file = join5(root, PROJECT_SOURCE_DOCUMENT_BUILD_CACHE_PATH);
|
|
110691
|
-
mkdirSync5(
|
|
111229
|
+
mkdirSync5(dirname5(file), { recursive: true });
|
|
110692
111230
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
110693
111231
|
writeFileSync5(
|
|
110694
111232
|
temporary,
|
|
@@ -110754,7 +111292,7 @@ var init_project_document_cache = __esm({
|
|
|
110754
111292
|
// src/project-source/project-files.ts
|
|
110755
111293
|
import { createHash as createHash7 } from "node:crypto";
|
|
110756
111294
|
import {
|
|
110757
|
-
existsSync as
|
|
111295
|
+
existsSync as existsSync4,
|
|
110758
111296
|
mkdirSync as mkdirSync6,
|
|
110759
111297
|
readFileSync as readFileSync6,
|
|
110760
111298
|
readdirSync,
|
|
@@ -110762,7 +111300,7 @@ import {
|
|
|
110762
111300
|
rmSync as rmSync2,
|
|
110763
111301
|
writeFileSync as writeFileSync6
|
|
110764
111302
|
} from "node:fs";
|
|
110765
|
-
import { basename, dirname as
|
|
111303
|
+
import { basename, dirname as dirname6, extname, join as join6, relative as relative2, sep as sep2 } from "node:path";
|
|
110766
111304
|
function lowerProjectFileRegistrySourcesV4(root, state, analysis, options = {}) {
|
|
110767
111305
|
const templateIds = fileTemplateIdsByName2(analysis);
|
|
110768
111306
|
const declarations = analysis.files.registries.flatMap(
|
|
@@ -110797,12 +111335,12 @@ function lowerProjectFileRegistrySourcesV4(root, state, analysis, options = {})
|
|
|
110797
111335
|
const trustedPending = options.trustedPendingFiles?.get(
|
|
110798
111336
|
declaration.recordId
|
|
110799
111337
|
);
|
|
110800
|
-
if (base === null && !
|
|
111338
|
+
if (base === null && !existsSync4(absolute) && trustedPending === void 0) {
|
|
110801
111339
|
throw new Error(
|
|
110802
111340
|
`Pending project file ${declaration.symbol} is missing bytes at ${normalizedPath}.`
|
|
110803
111341
|
);
|
|
110804
111342
|
}
|
|
110805
|
-
const binary =
|
|
111343
|
+
const binary = existsSync4(absolute) ? inspectBinaryFile(absolute, normalizedPath) : trustedPending === void 0 ? null : {
|
|
110806
111344
|
path: normalizedPath,
|
|
110807
111345
|
kind: declaration.kind,
|
|
110808
111346
|
mimeType: trustedPending.mimeType,
|
|
@@ -110904,7 +111442,7 @@ function inspectProjectBinaryStatusV4(root, state, analysis) {
|
|
|
110904
111442
|
const baseState = state[`project-file:${declaration.recordId}`];
|
|
110905
111443
|
const data = isObjectRecord2(baseState?.data) ? baseState.data : {};
|
|
110906
111444
|
const absolute = join6(root, declaration.path);
|
|
110907
|
-
const local =
|
|
111445
|
+
const local = existsSync4(absolute) ? inspectBinaryFile(absolute, declaration.path) : null;
|
|
110908
111446
|
const baseSha256 = baseState?.projectBinary?.sha256 ?? normalizeSha256V4(
|
|
110909
111447
|
data.contentSha256,
|
|
110910
111448
|
`project-file:${declaration.recordId} metadata`
|
|
@@ -110976,9 +111514,9 @@ function discoverProjectBinariesV4(root, explicit, ignoredPaths = []) {
|
|
|
110976
111514
|
const candidates = [];
|
|
110977
111515
|
for (const directory of ["Files/Images", "Files/AudioClips"]) {
|
|
110978
111516
|
const absoluteDirectory = join6(root, directory);
|
|
110979
|
-
if (!
|
|
111517
|
+
if (!existsSync4(absoluteDirectory)) continue;
|
|
110980
111518
|
visitBinaryFiles(absoluteDirectory, (absolute) => {
|
|
110981
|
-
const path = normalizeSlash2(
|
|
111519
|
+
const path = normalizeSlash2(relative2(root, absolute));
|
|
110982
111520
|
if (!explicitPaths.has(path.toLowerCase())) {
|
|
110983
111521
|
candidates.push({ stableId: path, path, absolute });
|
|
110984
111522
|
}
|
|
@@ -111026,7 +111564,7 @@ function writeVerifiedBinaryDownloadV4(destination, bytes, expectedSha256) {
|
|
|
111026
111564
|
`Downloaded project file checksum ${actual} did not match expected SHA-256 ${expectedSha256}.`
|
|
111027
111565
|
);
|
|
111028
111566
|
}
|
|
111029
|
-
mkdirSync6(
|
|
111567
|
+
mkdirSync6(dirname6(destination), { recursive: true });
|
|
111030
111568
|
const temporary = `${destination}.neo-download-${process.pid}`;
|
|
111031
111569
|
try {
|
|
111032
111570
|
writeFileSync6(temporary, bytes);
|
|
@@ -111045,7 +111583,7 @@ function writeBinaryConflictArtifactV4(root, fileId, fileName2, bytes, expectedS
|
|
|
111045
111583
|
safeFileName2(fileName2)
|
|
111046
111584
|
);
|
|
111047
111585
|
writeVerifiedBinaryDownloadV4(destination, bytes, expectedSha256);
|
|
111048
|
-
return normalizeSlash2(
|
|
111586
|
+
return normalizeSlash2(relative2(root, destination));
|
|
111049
111587
|
}
|
|
111050
111588
|
function fileTemplateIdsByName2(analysis) {
|
|
111051
111589
|
const templateIds = /* @__PURE__ */ new Map();
|
|
@@ -111234,7 +111772,7 @@ function safePathSegment2(value) {
|
|
|
111234
111772
|
return value.replace(/[^A-Za-z0-9._-]/g, "_") || "file";
|
|
111235
111773
|
}
|
|
111236
111774
|
function normalizeSlash2(value) {
|
|
111237
|
-
return value.split(
|
|
111775
|
+
return value.split(sep2).join("/").replaceAll("\\", "/");
|
|
111238
111776
|
}
|
|
111239
111777
|
var SUPPORTED_BINARY_TYPES, REGISTRY_ENTRY2, assignDeterministicFileSymbols2;
|
|
111240
111778
|
var init_project_files = __esm({
|
|
@@ -111277,12 +111815,12 @@ var init_supplemental_records_file_system = __esm({
|
|
|
111277
111815
|
});
|
|
111278
111816
|
|
|
111279
111817
|
// src/project-source/workspace-status.ts
|
|
111280
|
-
import { existsSync as
|
|
111281
|
-
import { join as join7, relative as
|
|
111818
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7, readdirSync as readdirSync2 } from "node:fs";
|
|
111819
|
+
import { join as join7, relative as relative3, sep as sep3 } from "node:path";
|
|
111282
111820
|
function isGitIgnored(scopes, absolutePath, directory) {
|
|
111283
111821
|
return isNeoGitIgnored(
|
|
111284
111822
|
scopes.map((scope) => ({
|
|
111285
|
-
relativePath:
|
|
111823
|
+
relativePath: relative3(scope.root, absolutePath),
|
|
111286
111824
|
matcher: scope.matcher
|
|
111287
111825
|
})),
|
|
111288
111826
|
directory
|
|
@@ -111290,7 +111828,7 @@ function isGitIgnored(scopes, absolutePath, directory) {
|
|
|
111290
111828
|
}
|
|
111291
111829
|
function addGitIgnoreScope(directory, inherited) {
|
|
111292
111830
|
const path = join7(directory, ".gitignore");
|
|
111293
|
-
if (!
|
|
111831
|
+
if (!existsSync5(path)) return inherited;
|
|
111294
111832
|
return [
|
|
111295
111833
|
...inherited,
|
|
111296
111834
|
{ root: directory, matcher: (0, import_ignore.default)().add(readFileSync7(path, "utf8")) }
|
|
@@ -111300,7 +111838,7 @@ function listNeoWorkspaceFilesV1(root) {
|
|
|
111300
111838
|
const production = [];
|
|
111301
111839
|
const specs = [];
|
|
111302
111840
|
const visit = (directory, inheritedScopes) => {
|
|
111303
|
-
if (!
|
|
111841
|
+
if (!existsSync5(directory)) return;
|
|
111304
111842
|
const scopes = addGitIgnoreScope(directory, inheritedScopes);
|
|
111305
111843
|
for (const entry of readdirSync2(directory, { withFileTypes: true })) {
|
|
111306
111844
|
if (entry.isSymbolicLink()) continue;
|
|
@@ -111312,7 +111850,7 @@ function listNeoWorkspaceFilesV1(root) {
|
|
|
111312
111850
|
continue;
|
|
111313
111851
|
}
|
|
111314
111852
|
if (!entry.isFile() || isGitIgnored(scopes, path, false)) continue;
|
|
111315
|
-
const relativePath =
|
|
111853
|
+
const relativePath = relative3(root, path).split(sep3).join("/");
|
|
111316
111854
|
const kind = neoProjectSourceKind(relativePath);
|
|
111317
111855
|
if (kind === null) continue;
|
|
111318
111856
|
if (kind === "spec") specs.push(path);
|
|
@@ -111332,7 +111870,7 @@ function listProjectTestFilesV1(root) {
|
|
|
111332
111870
|
}
|
|
111333
111871
|
function computeWorkspaceStatus2(workspace, options = {}) {
|
|
111334
111872
|
const virtualSourceFiles = options.virtualSourceFiles ?? listProjectSourceFilesV4(workspace.root).map((path) => ({
|
|
111335
|
-
path:
|
|
111873
|
+
path: relative3(workspace.root, path).split(sep3).join("/"),
|
|
111336
111874
|
content: readFileSync7(path, "utf8")
|
|
111337
111875
|
}));
|
|
111338
111876
|
return computeWorkspaceStatus(workspace, {
|
|
@@ -112344,7 +112882,7 @@ var init_source_record_comparison = __esm({
|
|
|
112344
112882
|
|
|
112345
112883
|
// src/project-source/reset.ts
|
|
112346
112884
|
import {
|
|
112347
|
-
existsSync as
|
|
112885
|
+
existsSync as existsSync6,
|
|
112348
112886
|
mkdirSync as mkdirSync7,
|
|
112349
112887
|
readFileSync as readFileSync8,
|
|
112350
112888
|
readdirSync as readdirSync3,
|
|
@@ -112352,12 +112890,20 @@ import {
|
|
|
112352
112890
|
writeFileSync as writeFileSync7,
|
|
112353
112891
|
statSync
|
|
112354
112892
|
} from "node:fs";
|
|
112355
|
-
import { dirname as
|
|
112893
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
112356
112894
|
function resetWorkspaceToProjectSourcesV4(workspace, document, options = {}) {
|
|
112357
112895
|
const emissionRecords = options.regenerateSourceNames ? regenerateDialogueSourceNamesV4(document.records) : document.records;
|
|
112358
|
-
const emitted = emitProjectDocumentFilesV4(emissionRecords
|
|
112896
|
+
const emitted = emitProjectDocumentFilesV4(emissionRecords, {
|
|
112897
|
+
recordFiles: projectRecordFilesV4(Object.values(workspace.state.records))
|
|
112898
|
+
});
|
|
112359
112899
|
assertUniqueEmittedPaths2(emitted.files);
|
|
112360
|
-
const
|
|
112900
|
+
const resolveSourcePath = createWorkspaceSourcePathResolver(workspace.root);
|
|
112901
|
+
const trackedSources = trackedProductionSourcesBeforeReset(
|
|
112902
|
+
workspace,
|
|
112903
|
+
resolveSourcePath
|
|
112904
|
+
);
|
|
112905
|
+
const previous = new Set(managedFilesBeforeReset(workspace.root));
|
|
112906
|
+
for (const path of trackedSources) previous.add(path);
|
|
112361
112907
|
const preservedSpecs = preserveManagedSpecs(workspace.root);
|
|
112362
112908
|
for (const directory of FORMAT_4_MANAGED_DIRECTORIES) {
|
|
112363
112909
|
rmSync3(join8(workspace.root, directory), { recursive: true, force: true });
|
|
@@ -112369,15 +112915,18 @@ function resetWorkspaceToProjectSourcesV4(workspace, document, options = {}) {
|
|
|
112369
112915
|
for (const privatePath of LEGACY_PRIVATE_PATHS) {
|
|
112370
112916
|
rmSync3(join8(workspace.root, privatePath), { recursive: true, force: true });
|
|
112371
112917
|
}
|
|
112918
|
+
for (const path of trackedSources) {
|
|
112919
|
+
rmSync3(resolveSourcePath(path), { force: true });
|
|
112920
|
+
}
|
|
112372
112921
|
for (const [path, bytes] of preservedSpecs) {
|
|
112373
112922
|
const absolute = join8(workspace.root, path);
|
|
112374
|
-
mkdirSync7(
|
|
112923
|
+
mkdirSync7(dirname7(absolute), { recursive: true });
|
|
112375
112924
|
writeFileSync7(absolute, bytes);
|
|
112376
112925
|
}
|
|
112377
112926
|
for (const file of emitted.files) {
|
|
112378
|
-
const absolute =
|
|
112379
|
-
mkdirSync7(
|
|
112380
|
-
if (
|
|
112927
|
+
const absolute = resolveSourcePath(file.path);
|
|
112928
|
+
mkdirSync7(dirname7(absolute), { recursive: true });
|
|
112929
|
+
if (existsSync6(absolute) && readFileSync8(absolute, "utf8") === file.content) {
|
|
112381
112930
|
continue;
|
|
112382
112931
|
}
|
|
112383
112932
|
writeFileSync7(absolute, file.content, "utf8");
|
|
@@ -112404,7 +112953,7 @@ function resetWorkspaceToProjectSourcesV4(workspace, document, options = {}) {
|
|
|
112404
112953
|
workspace.config = { ...workspace.config, formatVersion: 4 };
|
|
112405
112954
|
writeWorkspaceConfig(workspace.root, workspace.config);
|
|
112406
112955
|
const removed = [...previous].filter(
|
|
112407
|
-
(file) => !
|
|
112956
|
+
(file) => !existsSync6(join8(workspace.root, file))
|
|
112408
112957
|
).length;
|
|
112409
112958
|
return {
|
|
112410
112959
|
written: emitted.files.length,
|
|
@@ -112417,7 +112966,7 @@ function preserveManagedSpecs(root) {
|
|
|
112417
112966
|
const specs = /* @__PURE__ */ new Map();
|
|
112418
112967
|
const visit = (path) => {
|
|
112419
112968
|
const absolute = join8(root, path);
|
|
112420
|
-
if (!
|
|
112969
|
+
if (!existsSync6(absolute)) return;
|
|
112421
112970
|
const entries = readdirSync3(absolute, { withFileTypes: true });
|
|
112422
112971
|
for (const entry of entries) {
|
|
112423
112972
|
if (entry.isSymbolicLink()) continue;
|
|
@@ -112432,6 +112981,20 @@ function preserveManagedSpecs(root) {
|
|
|
112432
112981
|
for (const directory of FORMAT_4_MANAGED_DIRECTORIES) visit(directory);
|
|
112433
112982
|
return specs;
|
|
112434
112983
|
}
|
|
112984
|
+
function trackedProductionSourcesBeforeReset(workspace, resolveSourcePath) {
|
|
112985
|
+
const paths = /* @__PURE__ */ new Set();
|
|
112986
|
+
for (const record3 of Object.values(workspace.state.records)) {
|
|
112987
|
+
if (record3.file === void 0) continue;
|
|
112988
|
+
const path = normalizeWorkspaceSourcePath(record3.file);
|
|
112989
|
+
const kind = neoProjectSourceKind(path);
|
|
112990
|
+
if (kind === null || !isNeoProjectProductionSourceKind(kind)) {
|
|
112991
|
+
continue;
|
|
112992
|
+
}
|
|
112993
|
+
const absolute = resolveSourcePath(path);
|
|
112994
|
+
if (existsSync6(absolute)) paths.add(path);
|
|
112995
|
+
}
|
|
112996
|
+
return paths;
|
|
112997
|
+
}
|
|
112435
112998
|
function assertUniqueEmittedPaths2(files) {
|
|
112436
112999
|
const seen = /* @__PURE__ */ new Map();
|
|
112437
113000
|
for (const file of files) {
|
|
@@ -112451,7 +113014,7 @@ function managedFilesBeforeReset(root) {
|
|
|
112451
113014
|
collectFiles(root, directory, files);
|
|
112452
113015
|
}
|
|
112453
113016
|
for (const file of LEGACY_ROOT_FILES) {
|
|
112454
|
-
if (
|
|
113017
|
+
if (existsSync6(join8(root, file))) files.add(file);
|
|
112455
113018
|
}
|
|
112456
113019
|
for (const privatePath of LEGACY_PRIVATE_PATHS) {
|
|
112457
113020
|
collectFiles(root, privatePath, files);
|
|
@@ -112460,7 +113023,7 @@ function managedFilesBeforeReset(root) {
|
|
|
112460
113023
|
}
|
|
112461
113024
|
function collectFiles(root, path, files) {
|
|
112462
113025
|
const absolute = join8(root, path);
|
|
112463
|
-
if (!
|
|
113026
|
+
if (!existsSync6(absolute)) return;
|
|
112464
113027
|
if (statSync(absolute).isFile()) {
|
|
112465
113028
|
files.add(path);
|
|
112466
113029
|
return;
|
|
@@ -112479,11 +113042,13 @@ var FORMAT_4_MANAGED_DIRECTORIES, LEGACY_ROOT_FILES, LEGACY_PRIVATE_PATHS;
|
|
|
112479
113042
|
var init_reset = __esm({
|
|
112480
113043
|
"src/project-source/reset.ts"() {
|
|
112481
113044
|
"use strict";
|
|
113045
|
+
init_src();
|
|
112482
113046
|
init_workspace();
|
|
112483
113047
|
init_project_documents();
|
|
112484
113048
|
init_project_document_cache();
|
|
112485
113049
|
init_materialized_construction_cache();
|
|
112486
113050
|
init_dialogue_sources();
|
|
113051
|
+
init_workspace_source_path();
|
|
112487
113052
|
FORMAT_4_MANAGED_DIRECTORIES = [
|
|
112488
113053
|
"Classes",
|
|
112489
113054
|
"Interfaces",
|
|
@@ -112624,7 +113189,7 @@ var init_http = __esm({
|
|
|
112624
113189
|
});
|
|
112625
113190
|
|
|
112626
113191
|
// src/project-source/project-file-pull.ts
|
|
112627
|
-
import { existsSync as
|
|
113192
|
+
import { existsSync as existsSync7, rmSync as rmSync4 } from "node:fs";
|
|
112628
113193
|
import { join as join9 } from "node:path";
|
|
112629
113194
|
async function pullProjectBinariesV4(args) {
|
|
112630
113195
|
let client = args.client ?? null;
|
|
@@ -112648,7 +113213,7 @@ async function pullProjectBinariesV4(args) {
|
|
|
112648
113213
|
const declarationPresent = args.destructive === true || args.localBinaries === void 0 || previous === void 0 || localStatus !== void 0;
|
|
112649
113214
|
const path = localStatus?.path ?? previous?.projectBinary?.path ?? canonicalProjectBinaryPathV42(record3.data);
|
|
112650
113215
|
const absolute = join9(args.workspace.root, path);
|
|
112651
|
-
const localDigest =
|
|
113216
|
+
const localDigest = existsSync7(absolute) ? sha256File(absolute) : null;
|
|
112652
113217
|
const baseDigest = previous?.projectBinary?.sha256 ?? readSha256(previous?.data) ?? null;
|
|
112653
113218
|
const remoteDigest = requiredSha256(
|
|
112654
113219
|
record3.data,
|
|
@@ -112731,7 +113296,7 @@ async function pullProjectBinariesV4(args) {
|
|
|
112731
113296
|
const localStatus = localById.get(previous.recordId);
|
|
112732
113297
|
const path = localStatus?.path ?? previous.projectBinary?.path ?? canonicalProjectBinaryPathV42(previous.data);
|
|
112733
113298
|
const absolute = join9(args.workspace.root, path);
|
|
112734
|
-
const localDigest =
|
|
113299
|
+
const localDigest = existsSync7(absolute) ? sha256File(absolute) : null;
|
|
112735
113300
|
const baseDigest = previous.projectBinary?.sha256 ?? readSha256(previous.data) ?? null;
|
|
112736
113301
|
const action = planBinaryMergeV4({
|
|
112737
113302
|
baseDigest,
|
|
@@ -112916,10 +113481,10 @@ import {
|
|
|
112916
113481
|
mkdirSync as mkdirSync8,
|
|
112917
113482
|
writeFileSync as writeFileSync8,
|
|
112918
113483
|
rmSync as rmSync5,
|
|
112919
|
-
existsSync as
|
|
113484
|
+
existsSync as existsSync8,
|
|
112920
113485
|
readFileSync as readFileSync9
|
|
112921
113486
|
} from "node:fs";
|
|
112922
|
-
import { dirname as
|
|
113487
|
+
import { dirname as dirname8 } from "node:path";
|
|
112923
113488
|
async function runPull(workspace, options) {
|
|
112924
113489
|
if (options.reset) {
|
|
112925
113490
|
await runResetPull(workspace);
|
|
@@ -113241,12 +113806,19 @@ async function finishFormat4Pull(args) {
|
|
|
113241
113806
|
([key, record3]) => localRecords.get(key) === record3 ? [] : [key]
|
|
113242
113807
|
)
|
|
113243
113808
|
);
|
|
113244
|
-
const
|
|
113809
|
+
const recordFiles = projectRecordFilesV4(
|
|
113810
|
+
Object.values(workspace.state.records),
|
|
113811
|
+
localStatus?.reconstructed.values() ?? []
|
|
113812
|
+
);
|
|
113813
|
+
const localResult = emitProjectDocumentFilesV4(localRecords, {
|
|
113814
|
+
recordFiles
|
|
113815
|
+
});
|
|
113245
113816
|
for (const recovery of localResult.staticMemberOwnershipRecoveries ?? []) {
|
|
113246
113817
|
warn(staticMemberOwnershipRecoveryMessage(recovery));
|
|
113247
113818
|
}
|
|
113248
113819
|
const serverResult = conflictCount === 0 ? null : emitProjectDocumentFilesV4(
|
|
113249
|
-
buildEmitRecordSet(document, plans, "server")
|
|
113820
|
+
buildEmitRecordSet(document, plans, "server"),
|
|
113821
|
+
{ recordFiles }
|
|
113250
113822
|
);
|
|
113251
113823
|
const binaries = await pullProjectBinariesV4({
|
|
113252
113824
|
workspace,
|
|
@@ -113285,6 +113857,7 @@ async function finishFormat4Pull(args) {
|
|
|
113285
113857
|
const path = localResult.recordFiles.get(key);
|
|
113286
113858
|
if (path !== void 0) rewritePaths.add(path);
|
|
113287
113859
|
}
|
|
113860
|
+
const resolveSourcePath = createWorkspaceSourcePathResolver(workspace.root);
|
|
113288
113861
|
let written = 0;
|
|
113289
113862
|
for (const path of emittedPaths) {
|
|
113290
113863
|
const local = localByPath.get(path)?.content;
|
|
@@ -113295,9 +113868,9 @@ async function finishFormat4Pull(args) {
|
|
|
113295
113868
|
versionId: workspace.config.versionId
|
|
113296
113869
|
}) : local;
|
|
113297
113870
|
if (content === void 0) continue;
|
|
113298
|
-
const absolute =
|
|
113299
|
-
mkdirSync8(
|
|
113300
|
-
const existing =
|
|
113871
|
+
const absolute = resolveSourcePath(path);
|
|
113872
|
+
mkdirSync8(dirname8(absolute), { recursive: true });
|
|
113873
|
+
const existing = existsSync8(absolute) ? readFileSync9(absolute, "utf8") : null;
|
|
113301
113874
|
if (existing !== null && !rewritePaths.has(path)) continue;
|
|
113302
113875
|
if (existing !== content) {
|
|
113303
113876
|
writeFileSync8(absolute, content, "utf8");
|
|
@@ -113307,9 +113880,13 @@ async function finishFormat4Pull(args) {
|
|
|
113307
113880
|
let removed = 0;
|
|
113308
113881
|
for (const recordState of Object.values(workspace.state.records)) {
|
|
113309
113882
|
const previousPath = recordState.file;
|
|
113310
|
-
if (previousPath === void 0
|
|
113311
|
-
const
|
|
113312
|
-
if (
|
|
113883
|
+
if (previousPath === void 0) continue;
|
|
113884
|
+
const normalizedPreviousPath = normalizeWorkspaceSourcePath(previousPath);
|
|
113885
|
+
if (emittedPaths.has(normalizedPreviousPath)) {
|
|
113886
|
+
continue;
|
|
113887
|
+
}
|
|
113888
|
+
const absolute = resolveSourcePath(previousPath);
|
|
113889
|
+
if (existsSync8(absolute)) {
|
|
113313
113890
|
rmSync5(absolute);
|
|
113314
113891
|
removed += 1;
|
|
113315
113892
|
}
|
|
@@ -113601,6 +114178,7 @@ var init_pull = __esm({
|
|
|
113601
114178
|
init_project_documents();
|
|
113602
114179
|
init_project_document_cache();
|
|
113603
114180
|
init_materialized_construction_cache();
|
|
114181
|
+
init_workspace_source_path();
|
|
113604
114182
|
init_project_manifest();
|
|
113605
114183
|
init_project_documents();
|
|
113606
114184
|
init_project_file_pull();
|
|
@@ -113615,8 +114193,8 @@ var init_exports = {};
|
|
|
113615
114193
|
__export(init_exports, {
|
|
113616
114194
|
runInit: () => runInit
|
|
113617
114195
|
});
|
|
113618
|
-
import { existsSync as
|
|
113619
|
-
import { join as join11, resolve as
|
|
114196
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync9, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "node:fs";
|
|
114197
|
+
import { join as join11, resolve as resolve3 } from "node:path";
|
|
113620
114198
|
async function runInit(options) {
|
|
113621
114199
|
let projectId = options.projectId;
|
|
113622
114200
|
let projects = [];
|
|
@@ -113712,8 +114290,8 @@ async function runInit(options) {
|
|
|
113712
114290
|
validate: (value) => value.trim().length > 0 ? true : "Directory must not be empty."
|
|
113713
114291
|
}) : "neo";
|
|
113714
114292
|
}
|
|
113715
|
-
const root =
|
|
113716
|
-
if (
|
|
114293
|
+
const root = resolve3(directory);
|
|
114294
|
+
if (existsSync9(join11(root, NEO_CONFIG_FILE))) {
|
|
113717
114295
|
throw new Error(`"${join11(root, NEO_CONFIG_FILE)}" already exists.`);
|
|
113718
114296
|
}
|
|
113719
114297
|
mkdirSync9(root, { recursive: true });
|
|
@@ -113740,7 +114318,7 @@ async function runInit(options) {
|
|
|
113740
114318
|
}
|
|
113741
114319
|
function ensurePrivateStateIgnored(root) {
|
|
113742
114320
|
const path = join11(root, ".gitignore");
|
|
113743
|
-
const existing =
|
|
114321
|
+
const existing = existsSync9(path) ? readFileSync10(path, "utf8") : "";
|
|
113744
114322
|
if (existing.split(/\r?\n/u).some((line) => line.trim() === ".neo/" || line.trim() === ".neo")) {
|
|
113745
114323
|
return;
|
|
113746
114324
|
}
|
|
@@ -114146,7 +114724,7 @@ async function waitForPlan(convex, planId) {
|
|
|
114146
114724
|
`History plan "${plan.id}" failed: ${plan.error ?? "unknown error"}`
|
|
114147
114725
|
);
|
|
114148
114726
|
}
|
|
114149
|
-
await new Promise((
|
|
114727
|
+
await new Promise((resolve5) => setTimeout(resolve5, 500));
|
|
114150
114728
|
}
|
|
114151
114729
|
}
|
|
114152
114730
|
async function printVersionLog(convex, scope) {
|
|
@@ -115145,7 +115723,7 @@ var init_save_overlay_resolution = __esm({
|
|
|
115145
115723
|
});
|
|
115146
115724
|
|
|
115147
115725
|
// src/commands/push-body-diagnostics.ts
|
|
115148
|
-
import { existsSync as
|
|
115726
|
+
import { existsSync as existsSync10, readFileSync as readFileSync11 } from "node:fs";
|
|
115149
115727
|
import { join as join12 } from "node:path";
|
|
115150
115728
|
function createNeoScriptBodySourceLocator(workspace, status) {
|
|
115151
115729
|
const textByFile = /* @__PURE__ */ new Map();
|
|
@@ -115169,7 +115747,7 @@ function createNeoScriptBodySourceLocator(workspace, status) {
|
|
|
115169
115747
|
const cached = textByFile.get(file);
|
|
115170
115748
|
if (cached !== void 0) return cached;
|
|
115171
115749
|
const path = join12(workspace.root, file);
|
|
115172
|
-
const text =
|
|
115750
|
+
const text = existsSync10(path) ? readFileSync11(path, "utf8") : null;
|
|
115173
115751
|
textByFile.set(file, text);
|
|
115174
115752
|
return text;
|
|
115175
115753
|
}
|
|
@@ -116971,8 +117549,8 @@ var init_project_source_identity = __esm({
|
|
|
116971
117549
|
// src/push-hook.ts
|
|
116972
117550
|
import { spawn } from "node:child_process";
|
|
116973
117551
|
import { createHash as createHash9 } from "node:crypto";
|
|
116974
|
-
import { existsSync as
|
|
116975
|
-
import { join as join13, relative as
|
|
117552
|
+
import { existsSync as existsSync11, readFileSync as readFileSync13, readdirSync as readdirSync4 } from "node:fs";
|
|
117553
|
+
import { join as join13, relative as relative4, sep as sep4 } from "node:path";
|
|
116976
117554
|
function fingerprintPushInputs(workspace, options = {}) {
|
|
116977
117555
|
const paths = /* @__PURE__ */ new Set([
|
|
116978
117556
|
join13(workspace.root, "neo.json"),
|
|
@@ -116981,7 +117559,7 @@ function fingerprintPushInputs(workspace, options = {}) {
|
|
|
116981
117559
|
...workspace.config.unityConfigPath === void 0 ? [] : [join13(workspace.root, workspace.config.unityConfigPath)]
|
|
116982
117560
|
]);
|
|
116983
117561
|
const visitManaged = (directory) => {
|
|
116984
|
-
if (!
|
|
117562
|
+
if (!existsSync11(directory)) return;
|
|
116985
117563
|
for (const entry of readdirSync4(directory, { withFileTypes: true })) {
|
|
116986
117564
|
if (entry.isSymbolicLink()) continue;
|
|
116987
117565
|
const path = join13(directory, entry.name);
|
|
@@ -116993,7 +117571,7 @@ function fingerprintPushInputs(workspace, options = {}) {
|
|
|
116993
117571
|
visitManaged(join13(workspace.root, "Files", "AudioClips"));
|
|
116994
117572
|
const hash = createHash9("sha256");
|
|
116995
117573
|
for (const path of [...paths].sort()) {
|
|
116996
|
-
const name =
|
|
117574
|
+
const name = relative4(workspace.root, path).split(sep4).join("/");
|
|
116997
117575
|
hash.update(name);
|
|
116998
117576
|
hash.update("\0");
|
|
116999
117577
|
try {
|
|
@@ -117420,7 +117998,7 @@ function isRetryableRequestError(error) {
|
|
|
117420
117998
|
return RETRYABLE_NETWORK_ERROR_CODES.has(error.cause.code);
|
|
117421
117999
|
}
|
|
117422
118000
|
async function waitForRetry(attempt, signal) {
|
|
117423
|
-
await new Promise((
|
|
118001
|
+
await new Promise((resolve5, reject) => {
|
|
117424
118002
|
const abort = () => {
|
|
117425
118003
|
clearTimeout(timeout);
|
|
117426
118004
|
reject(signal.reason);
|
|
@@ -117428,7 +118006,7 @@ async function waitForRetry(attempt, signal) {
|
|
|
117428
118006
|
const timeout = setTimeout(
|
|
117429
118007
|
() => {
|
|
117430
118008
|
signal.removeEventListener("abort", abort);
|
|
117431
|
-
|
|
118009
|
+
resolve5();
|
|
117432
118010
|
},
|
|
117433
118011
|
200 * 2 ** (attempt - 1)
|
|
117434
118012
|
);
|
|
@@ -117661,11 +118239,11 @@ import {
|
|
|
117661
118239
|
mkdirSync as mkdirSync10,
|
|
117662
118240
|
writeFileSync as writeFileSync10,
|
|
117663
118241
|
rmSync as rmSync6,
|
|
117664
|
-
existsSync as
|
|
118242
|
+
existsSync as existsSync12,
|
|
117665
118243
|
readFileSync as readFileSync15,
|
|
117666
118244
|
statSync as statSync2
|
|
117667
118245
|
} from "node:fs";
|
|
117668
|
-
import { dirname as
|
|
118246
|
+
import { dirname as dirname9, join as join15, relative as relative5, sep as sep5 } from "node:path";
|
|
117669
118247
|
function assignPendingIds(changes, authoredValueSeeds, reconstructed3, localInitializerMaterialization) {
|
|
117670
118248
|
const assigned = /* @__PURE__ */ new Map();
|
|
117671
118249
|
const assign = (pendingId2) => {
|
|
@@ -118206,14 +118784,14 @@ async function waitForPollDelay(delayMs, signal) {
|
|
|
118206
118784
|
if (signal.aborted) {
|
|
118207
118785
|
throw new Error("Project transaction polling was interrupted.");
|
|
118208
118786
|
}
|
|
118209
|
-
await new Promise((
|
|
118787
|
+
await new Promise((resolve5, reject) => {
|
|
118210
118788
|
const aborted = () => {
|
|
118211
118789
|
clearTimeout(timer);
|
|
118212
118790
|
reject(new Error("Project transaction polling was interrupted."));
|
|
118213
118791
|
};
|
|
118214
118792
|
const timer = setTimeout(() => {
|
|
118215
118793
|
signal.removeEventListener("abort", aborted);
|
|
118216
|
-
|
|
118794
|
+
resolve5();
|
|
118217
118795
|
}, delayMs);
|
|
118218
118796
|
signal.addEventListener("abort", aborted, { once: true });
|
|
118219
118797
|
});
|
|
@@ -118965,7 +119543,7 @@ async function prepareLocalCandidateV4(workspace, options = {}) {
|
|
|
118965
119543
|
} else {
|
|
118966
119544
|
const files = listProjectSourceFilesV4(workspace.root).map(
|
|
118967
119545
|
(absolutePath) => {
|
|
118968
|
-
const path =
|
|
119546
|
+
const path = relative5(workspace.root, absolutePath).split(sep5).join("/");
|
|
118969
119547
|
const kind = neoProjectSourceKind(path);
|
|
118970
119548
|
if (kind === null || !isNeoProjectProductionSourceKind(kind)) {
|
|
118971
119549
|
throw new Error(
|
|
@@ -119284,7 +119862,12 @@ function createPendingProjectSourceIdentityV4(workspace, status, authoredValueSe
|
|
|
119284
119862
|
});
|
|
119285
119863
|
}
|
|
119286
119864
|
}
|
|
119287
|
-
const emission = emitProjectDocumentFilesV4(records2
|
|
119865
|
+
const emission = emitProjectDocumentFilesV4(records2, {
|
|
119866
|
+
recordFiles: projectRecordFilesV4(
|
|
119867
|
+
Object.values(workspace.state.records),
|
|
119868
|
+
status.reconstructed.values()
|
|
119869
|
+
)
|
|
119870
|
+
});
|
|
119288
119871
|
const files = emission.files.map((file) => {
|
|
119289
119872
|
const kind = neoProjectSourceKind(file.path);
|
|
119290
119873
|
if (kind === null || !isNeoProjectProductionSourceKind(kind)) {
|
|
@@ -119490,7 +120073,12 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
119490
120073
|
const previousState = workspace.state;
|
|
119491
120074
|
workspace.state = { ...previousState, records: nextRecords };
|
|
119492
120075
|
try {
|
|
119493
|
-
rewriteFilesFromState(
|
|
120076
|
+
rewriteFilesFromState(
|
|
120077
|
+
workspace,
|
|
120078
|
+
emitRecords,
|
|
120079
|
+
preservedSourceFiles,
|
|
120080
|
+
projectRecordFilesV4(localRecords.values())
|
|
120081
|
+
);
|
|
119494
120082
|
writeWorkspaceState(workspace.root, workspace.state);
|
|
119495
120083
|
} catch (error) {
|
|
119496
120084
|
workspace.state = previousState;
|
|
@@ -119676,16 +120264,30 @@ function applyPushResult(workspace, result, pendingIdAssignments = /* @__PURE__
|
|
|
119676
120264
|
if (!isObjectRecord2(result) || !Array.isArray(result.changedRecords)) {
|
|
119677
120265
|
throw new Error("Transaction response is missing changedRecords.");
|
|
119678
120266
|
}
|
|
120267
|
+
const localStatus = computeWorkspaceStatus2(workspace);
|
|
119679
120268
|
const preservedSourceFiles = materializeAssignedSchemaIdsInAuthoredSource(
|
|
119680
120269
|
workspace,
|
|
119681
120270
|
pendingIdAssignments,
|
|
119682
|
-
|
|
120271
|
+
localStatus.pendingValueIdentitySites
|
|
120272
|
+
);
|
|
120273
|
+
const replacements = {
|
|
120274
|
+
exact: pendingIdAssignments,
|
|
120275
|
+
embedded: pendingIdAssignments.entries().toArray().sort(([left], [right]) => right.length - left.length)
|
|
120276
|
+
};
|
|
120277
|
+
const localRecords = rewriteReconstructedRecords(
|
|
120278
|
+
localStatus.reconstructed,
|
|
120279
|
+
replacements
|
|
119683
120280
|
);
|
|
119684
120281
|
workspace.state.records = foldChangedRecords(
|
|
119685
120282
|
workspace.state.records,
|
|
119686
120283
|
result.changedRecords
|
|
119687
120284
|
);
|
|
119688
|
-
rewriteFilesFromState(
|
|
120285
|
+
rewriteFilesFromState(
|
|
120286
|
+
workspace,
|
|
120287
|
+
void 0,
|
|
120288
|
+
preservedSourceFiles,
|
|
120289
|
+
projectRecordFilesV4(localRecords.values())
|
|
120290
|
+
);
|
|
119689
120291
|
writeWorkspaceState(workspace.root, workspace.state);
|
|
119690
120292
|
}
|
|
119691
120293
|
function authoredMemberFormsByFile(root, alternates) {
|
|
@@ -119695,7 +120297,7 @@ function authoredMemberFormsByFile(root, alternates) {
|
|
|
119695
120297
|
let existing = contents.get(alternate.path);
|
|
119696
120298
|
if (existing === void 0) {
|
|
119697
120299
|
const absolute = join15(root, alternate.path);
|
|
119698
|
-
existing =
|
|
120300
|
+
existing = existsSync12(absolute) ? readFileSync15(absolute, "utf8") : null;
|
|
119699
120301
|
contents.set(alternate.path, existing);
|
|
119700
120302
|
}
|
|
119701
120303
|
if (existing === null || !existing.includes(alternate.block)) continue;
|
|
@@ -119733,14 +120335,14 @@ function fileSystemEntryKey(absolute) {
|
|
|
119733
120335
|
if (!hasInode) return `path:${absolute.toLowerCase()}`;
|
|
119734
120336
|
return `inode:${stats.dev}:${stats.ino}`;
|
|
119735
120337
|
}
|
|
119736
|
-
function deleteSupersededAuthoredFiles(
|
|
120338
|
+
function deleteSupersededAuthoredFiles(resolveSourcePath, authoredPaths, emitted) {
|
|
119737
120339
|
const emittedEntries = /* @__PURE__ */ new Set();
|
|
119738
120340
|
for (const file of emitted) {
|
|
119739
|
-
emittedEntries.add(fileSystemEntryKey(
|
|
120341
|
+
emittedEntries.add(fileSystemEntryKey(resolveSourcePath(file.path)));
|
|
119740
120342
|
}
|
|
119741
120343
|
for (const authoredPath of authoredPaths) {
|
|
119742
|
-
const absolute =
|
|
119743
|
-
if (!
|
|
120344
|
+
const absolute = resolveSourcePath(authoredPath);
|
|
120345
|
+
if (!existsSync12(absolute)) continue;
|
|
119744
120346
|
if (emittedEntries.has(fileSystemEntryKey(absolute))) continue;
|
|
119745
120347
|
rmSync6(absolute);
|
|
119746
120348
|
}
|
|
@@ -119756,8 +120358,8 @@ function rewriteFilesFromState(workspace, records2 = new Map(
|
|
|
119756
120358
|
data: recordState.data
|
|
119757
120359
|
}
|
|
119758
120360
|
])
|
|
119759
|
-
), preservedSourceFiles = /* @__PURE__ */ new Map()) {
|
|
119760
|
-
const result = emitProjectDocumentFilesV4(records2);
|
|
120361
|
+
), preservedSourceFiles = /* @__PURE__ */ new Map(), recordFiles = /* @__PURE__ */ new Map()) {
|
|
120362
|
+
const result = emitProjectDocumentFilesV4(records2, { recordFiles });
|
|
119761
120363
|
const authoredForms = authoredMemberFormsByFile(
|
|
119762
120364
|
workspace.root,
|
|
119763
120365
|
result.formAlternates
|
|
@@ -119788,22 +120390,27 @@ function rewriteFilesFromState(workspace, records2 = new Map(
|
|
|
119788
120390
|
);
|
|
119789
120391
|
assertAssignedIdSourceRewriteValid(finalAnalysis);
|
|
119790
120392
|
writeProjectSourceAnalysisCacheV4(workspace.root, finalAnalysis);
|
|
120393
|
+
const resolveSourcePath = createWorkspaceSourcePathResolver(workspace.root);
|
|
119791
120394
|
const emittedPaths = new Set(files.map((file) => file.path));
|
|
119792
120395
|
for (const recordState of Object.values(workspace.state.records)) {
|
|
119793
120396
|
const previousPath = recordState.file;
|
|
119794
|
-
if (previousPath === void 0
|
|
119795
|
-
const
|
|
119796
|
-
if (
|
|
120397
|
+
if (previousPath === void 0) continue;
|
|
120398
|
+
const normalizedPreviousPath = normalizeWorkspaceSourcePath(previousPath);
|
|
120399
|
+
if (emittedPaths.has(normalizedPreviousPath)) {
|
|
120400
|
+
continue;
|
|
120401
|
+
}
|
|
120402
|
+
const absolute = resolveSourcePath(previousPath);
|
|
120403
|
+
if (existsSync12(absolute)) rmSync6(absolute);
|
|
119797
120404
|
}
|
|
119798
120405
|
for (const file of files) {
|
|
119799
|
-
const absolute =
|
|
119800
|
-
mkdirSync10(
|
|
119801
|
-
const existing =
|
|
120406
|
+
const absolute = resolveSourcePath(file.path);
|
|
120407
|
+
mkdirSync10(dirname9(absolute), { recursive: true });
|
|
120408
|
+
const existing = existsSync12(absolute) ? readFileSync15(absolute, "utf8") : null;
|
|
119802
120409
|
if (existing !== file.content)
|
|
119803
120410
|
writeFileSync10(absolute, file.content, "utf8");
|
|
119804
120411
|
}
|
|
119805
120412
|
deleteSupersededAuthoredFiles(
|
|
119806
|
-
|
|
120413
|
+
resolveSourcePath,
|
|
119807
120414
|
preservedSourceFiles.keys(),
|
|
119808
120415
|
files
|
|
119809
120416
|
);
|
|
@@ -119843,7 +120450,7 @@ function materializeAssignedSchemaIdsInAuthoredSource(workspace, replacements, p
|
|
|
119843
120450
|
if (pendingIdsByUri.size === 0) return /* @__PURE__ */ new Map();
|
|
119844
120451
|
const inputs = listProjectSourceFilesV4(workspace.root).map(
|
|
119845
120452
|
(absolutePath) => {
|
|
119846
|
-
const uri =
|
|
120453
|
+
const uri = relative5(workspace.root, absolutePath).split(sep5).join("/");
|
|
119847
120454
|
const kind = neoProjectSourceKind(uri);
|
|
119848
120455
|
if (kind === null || !isNeoProjectProductionSourceKind(kind)) {
|
|
119849
120456
|
throw new Error(
|
|
@@ -120547,6 +121154,7 @@ var init_push = __esm({
|
|
|
120547
121154
|
init_src();
|
|
120548
121155
|
init_compiler_adapter();
|
|
120549
121156
|
init_project_source_identity();
|
|
121157
|
+
init_workspace_source_path();
|
|
120550
121158
|
init_convex();
|
|
120551
121159
|
init_http();
|
|
120552
121160
|
init_ui();
|
|
@@ -120632,8 +121240,8 @@ var init_registry2 = __esm({
|
|
|
120632
121240
|
"use strict";
|
|
120633
121241
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
120634
121242
|
formatVersion: 3,
|
|
120635
|
-
contractVersion: "3.
|
|
120636
|
-
cliVersion: "0.38.
|
|
121243
|
+
contractVersion: "3.15",
|
|
121244
|
+
cliVersion: "0.38.5",
|
|
120637
121245
|
projectFileUploadBatchSize: 32,
|
|
120638
121246
|
documentRecords: {
|
|
120639
121247
|
member: {
|
|
@@ -120739,7 +121347,6 @@ var init_registry2 = __esm({
|
|
|
120739
121347
|
"allowedStorageKeys",
|
|
120740
121348
|
"genericParams",
|
|
120741
121349
|
"extendsGenericBindings",
|
|
120742
|
-
"constructorProjections",
|
|
120743
121350
|
"constructorIds",
|
|
120744
121351
|
"requiredConstructorId",
|
|
120745
121352
|
"targetMemberId"
|
|
@@ -120757,7 +121364,6 @@ var init_registry2 = __esm({
|
|
|
120757
121364
|
allowedStorageKeys: "nullIsAbsent",
|
|
120758
121365
|
genericParams: "nullOrEmptyArrayIsAbsent",
|
|
120759
121366
|
extendsGenericBindings: "nullOrEmptyObjectIsAbsent",
|
|
120760
|
-
constructorProjections: "nullOrEmptyArrayIsAbsent",
|
|
120761
121367
|
constructorIds: "nullOrEmptyArrayIsAbsent",
|
|
120762
121368
|
requiredConstructorId: "nullIsAbsent"
|
|
120763
121369
|
}
|
|
@@ -121958,11 +122564,11 @@ __export(test_exports, {
|
|
|
121958
122564
|
});
|
|
121959
122565
|
import { createHash as createHash11, randomUUID as randomUUID3 } from "node:crypto";
|
|
121960
122566
|
import {
|
|
121961
|
-
existsSync as
|
|
122567
|
+
existsSync as existsSync13,
|
|
121962
122568
|
mkdirSync as mkdirSync11,
|
|
121963
122569
|
readdirSync as readdirSync5,
|
|
121964
122570
|
readFileSync as readFileSync16,
|
|
121965
|
-
realpathSync,
|
|
122571
|
+
realpathSync as realpathSync2,
|
|
121966
122572
|
renameSync as renameSync5,
|
|
121967
122573
|
rmSync as rmSync7,
|
|
121968
122574
|
statSync as statSync3,
|
|
@@ -121970,12 +122576,12 @@ import {
|
|
|
121970
122576
|
} from "node:fs";
|
|
121971
122577
|
import {
|
|
121972
122578
|
basename as basename3,
|
|
121973
|
-
dirname as
|
|
121974
|
-
isAbsolute as
|
|
122579
|
+
dirname as dirname10,
|
|
122580
|
+
isAbsolute as isAbsolute3,
|
|
121975
122581
|
join as join16,
|
|
121976
|
-
relative as
|
|
121977
|
-
resolve as
|
|
121978
|
-
sep as
|
|
122582
|
+
relative as relative6,
|
|
122583
|
+
resolve as resolve4,
|
|
122584
|
+
sep as sep6
|
|
121979
122585
|
} from "node:path";
|
|
121980
122586
|
import { isDeepStrictEqual } from "node:util";
|
|
121981
122587
|
function isRecord10(value) {
|
|
@@ -122161,19 +122767,19 @@ function preparedHookCandidate(workspace) {
|
|
|
122161
122767
|
return null;
|
|
122162
122768
|
}
|
|
122163
122769
|
try {
|
|
122164
|
-
const directory =
|
|
122165
|
-
const cacheRoot =
|
|
122166
|
-
|
|
122770
|
+
const directory = realpathSync2(configuredDirectory);
|
|
122771
|
+
const cacheRoot = resolve4(
|
|
122772
|
+
realpathSync2(workspace.root),
|
|
122167
122773
|
".neo",
|
|
122168
122774
|
"test-build"
|
|
122169
122775
|
);
|
|
122170
|
-
const pathFromRoot =
|
|
122171
|
-
if (
|
|
122776
|
+
const pathFromRoot = relative6(cacheRoot, directory);
|
|
122777
|
+
if (isAbsolute3(pathFromRoot)) {
|
|
122172
122778
|
throw new NeoTestPreparedCandidateError(
|
|
122173
122779
|
"NEO_PREPARED_BUILD_DIR must not resolve to an absolute path outside this workspace's .neo/test-build directory."
|
|
122174
122780
|
);
|
|
122175
122781
|
}
|
|
122176
|
-
if (pathFromRoot === ".." || pathFromRoot.startsWith(`..${
|
|
122782
|
+
if (pathFromRoot === ".." || pathFromRoot.startsWith(`..${sep6}`)) {
|
|
122177
122783
|
throw new NeoTestPreparedCandidateError(
|
|
122178
122784
|
"NEO_PREPARED_BUILD_DIR must resolve inside this workspace's .neo/test-build directory."
|
|
122179
122785
|
);
|
|
@@ -122261,7 +122867,7 @@ function cachedTestCandidate(workspace, inputFingerprint) {
|
|
|
122261
122867
|
}
|
|
122262
122868
|
if (typeof parsed.documentSha256 !== "string") return null;
|
|
122263
122869
|
const documentJson = readFileSync16(
|
|
122264
|
-
join16(
|
|
122870
|
+
join16(dirname10(candidatePath), "document.json"),
|
|
122265
122871
|
"utf8"
|
|
122266
122872
|
);
|
|
122267
122873
|
if (createHash11("sha256").update(documentJson).digest("hex") !== parsed.documentSha256) {
|
|
@@ -122282,7 +122888,7 @@ function cacheTestCandidate(workspace, inputFingerprint, candidate) {
|
|
|
122282
122888
|
const documentJson = JSON.stringify(candidate.document);
|
|
122283
122889
|
const documentSha256 = createHash11("sha256").update(documentJson).digest("hex");
|
|
122284
122890
|
const candidatePath = testCandidateCachePath(workspace, inputFingerprint);
|
|
122285
|
-
atomicWrite(join16(
|
|
122891
|
+
atomicWrite(join16(dirname10(candidatePath), "document.json"), documentJson);
|
|
122286
122892
|
atomicWrite(
|
|
122287
122893
|
candidatePath,
|
|
122288
122894
|
JSON.stringify({
|
|
@@ -122299,7 +122905,7 @@ function cacheTestCandidate(workspace, inputFingerprint, candidate) {
|
|
|
122299
122905
|
}
|
|
122300
122906
|
function compileSpec(workspace, document, absolutePath, projectCompilationHash2) {
|
|
122301
122907
|
const scriptDocument = readDocumentArrays(document);
|
|
122302
|
-
const path =
|
|
122908
|
+
const path = relative6(workspace.root, absolutePath).split(sep6).join("/");
|
|
122303
122909
|
const source = readFileSync16(absolutePath, "utf8");
|
|
122304
122910
|
const sourceHash = createHash11("sha256").update(source).digest("hex");
|
|
122305
122911
|
const artifactPath = join16(
|
|
@@ -122360,7 +122966,7 @@ function selectedSpecPaths(workspace, selectors) {
|
|
|
122360
122966
|
const relativePaths = new Map(
|
|
122361
122967
|
all.map((absolutePath) => [
|
|
122362
122968
|
absolutePath,
|
|
122363
|
-
|
|
122969
|
+
relative6(workspace.root, absolutePath).split(sep6).join("/")
|
|
122364
122970
|
])
|
|
122365
122971
|
);
|
|
122366
122972
|
const normalizedSelectors = selectors.map(
|
|
@@ -122368,22 +122974,22 @@ function selectedSpecPaths(workspace, selectors) {
|
|
|
122368
122974
|
);
|
|
122369
122975
|
for (const selector of normalizedSelectors) {
|
|
122370
122976
|
if (/[*?]/u.test(selector)) continue;
|
|
122371
|
-
if (
|
|
122977
|
+
if (isAbsolute3(selector)) {
|
|
122372
122978
|
throw new Error(
|
|
122373
122979
|
`Spec selector ${JSON.stringify(selector)} must be workspace-relative.`
|
|
122374
122980
|
);
|
|
122375
122981
|
}
|
|
122376
|
-
const absolute =
|
|
122377
|
-
const workspaceRelative =
|
|
122378
|
-
if (workspaceRelative === ".." || workspaceRelative.startsWith(`..${
|
|
122982
|
+
const absolute = resolve4(workspace.root, selector);
|
|
122983
|
+
const workspaceRelative = relative6(workspace.root, absolute);
|
|
122984
|
+
if (workspaceRelative === ".." || workspaceRelative.startsWith(`..${sep6}`)) {
|
|
122379
122985
|
throw new Error(
|
|
122380
122986
|
`Spec selector ${JSON.stringify(selector)} is outside the workspace.`
|
|
122381
122987
|
);
|
|
122382
122988
|
}
|
|
122383
|
-
if (!
|
|
122384
|
-
const real =
|
|
122385
|
-
const realRelative =
|
|
122386
|
-
if (realRelative === ".." || realRelative.startsWith(`..${
|
|
122989
|
+
if (!existsSync13(absolute)) continue;
|
|
122990
|
+
const real = realpathSync2(absolute);
|
|
122991
|
+
const realRelative = relative6(workspace.root, real);
|
|
122992
|
+
if (realRelative === ".." || realRelative.startsWith(`..${sep6}`)) {
|
|
122387
122993
|
throw new Error(
|
|
122388
122994
|
`Spec selector ${JSON.stringify(selector)} resolves outside the workspace through a symlink.`
|
|
122389
122995
|
);
|
|
@@ -122393,7 +122999,7 @@ function selectedSpecPaths(workspace, selectors) {
|
|
|
122393
122999
|
`Spec selector ${JSON.stringify(selector)} is ignored, private, symlinked, or is not a .spec.neo file.`
|
|
122394
123000
|
);
|
|
122395
123001
|
}
|
|
122396
|
-
if (statSync3(absolute).isDirectory() && !all.some((path) => path.startsWith(`${absolute}${
|
|
123002
|
+
if (statSync3(absolute).isDirectory() && !all.some((path) => path.startsWith(`${absolute}${sep6}`))) {
|
|
122397
123003
|
throw new Error(
|
|
122398
123004
|
`Spec selector ${JSON.stringify(selector)} is ignored, private, or contains no eligible .spec.neo files.`
|
|
122399
123005
|
);
|
|
@@ -123126,13 +123732,13 @@ async function executeRegisteredSpec(registered, document, selected, timeoutMs,
|
|
|
123126
123732
|
return { tests: results, failures: fileFailures, testDurationMs };
|
|
123127
123733
|
}
|
|
123128
123734
|
function atomicWrite(path, content) {
|
|
123129
|
-
mkdirSync11(
|
|
123735
|
+
mkdirSync11(dirname10(path), { recursive: true });
|
|
123130
123736
|
const temporary = `${path}.tmp-${String(process.pid)}-${randomUUID3()}`;
|
|
123131
123737
|
writeFileSync11(temporary, content, "utf8");
|
|
123132
123738
|
renameSync5(temporary, path);
|
|
123133
123739
|
}
|
|
123134
123740
|
function testBuildFiles(root) {
|
|
123135
|
-
if (!
|
|
123741
|
+
if (!existsSync13(root)) return [];
|
|
123136
123742
|
const files = [];
|
|
123137
123743
|
const visit = (directory) => {
|
|
123138
123744
|
for (const entry of readdirSync5(directory, { withFileTypes: true })) {
|
|
@@ -123149,16 +123755,16 @@ function testBuildFiles(root) {
|
|
|
123149
123755
|
return files;
|
|
123150
123756
|
}
|
|
123151
123757
|
function maintainNeoTestBuildCache(root, maxBytes = TEST_BUILD_CACHE_LIMIT_BYTES, now = Date.now(), protectedDirectory = process.env.NEO_PREPARED_BUILD_DIR) {
|
|
123152
|
-
const resolvedRoot =
|
|
123153
|
-
const resolvedProtected = protectedDirectory === void 0 ? null :
|
|
123758
|
+
const resolvedRoot = resolve4(root);
|
|
123759
|
+
const resolvedProtected = protectedDirectory === void 0 ? null : resolve4(protectedDirectory);
|
|
123154
123760
|
const protectedInsideRoot = resolvedProtected !== null && (() => {
|
|
123155
|
-
const fromRoot =
|
|
123156
|
-
return fromRoot === "" || !fromRoot.startsWith(`..${
|
|
123761
|
+
const fromRoot = relative6(resolvedRoot, resolvedProtected);
|
|
123762
|
+
return fromRoot === "" || !fromRoot.startsWith(`..${sep6}`) && fromRoot !== ".." && !isAbsolute3(fromRoot);
|
|
123157
123763
|
})();
|
|
123158
123764
|
const isProtected = (path) => {
|
|
123159
123765
|
if (!protectedInsideRoot || resolvedProtected === null) return false;
|
|
123160
|
-
const fromProtected =
|
|
123161
|
-
return fromProtected === "" || !fromProtected.startsWith(`..${
|
|
123766
|
+
const fromProtected = relative6(resolvedProtected, resolve4(path));
|
|
123767
|
+
return fromProtected === "" || !fromProtected.startsWith(`..${sep6}`) && fromProtected !== ".." && !isAbsolute3(fromProtected);
|
|
123162
123768
|
};
|
|
123163
123769
|
for (const file of testBuildFiles(root)) {
|
|
123164
123770
|
if (!isProtected(file.path) && basename3(file.path).includes(".tmp-") && now - file.modifiedMs >= ABANDONED_TEMP_MAX_AGE_MS) {
|
|
@@ -123302,7 +123908,7 @@ async function runTest(workspace, options, dependencies = {}) {
|
|
|
123302
123908
|
throw new NeoTestUsageError(errorMessage2(error));
|
|
123303
123909
|
}
|
|
123304
123910
|
selectedFiles = selectedPaths.map(
|
|
123305
|
-
(path) =>
|
|
123911
|
+
(path) => relative6(workspace.root, path).split(sep6).join("/")
|
|
123306
123912
|
);
|
|
123307
123913
|
if (selectedPaths.length === 0 && options.passWithNoTests !== true) {
|
|
123308
123914
|
throw new NeoTestNoTestsError(
|
|
@@ -123466,7 +124072,7 @@ async function runTest(workspace, options, dependencies = {}) {
|
|
|
123466
124072
|
if (options.outputFile !== null) {
|
|
123467
124073
|
try {
|
|
123468
124074
|
atomicWrite(
|
|
123469
|
-
|
|
124075
|
+
isAbsolute3(options.outputFile) ? options.outputFile : join16(workspace.root, options.outputFile),
|
|
123470
124076
|
serialized
|
|
123471
124077
|
);
|
|
123472
124078
|
} catch (error) {
|
|
@@ -123550,7 +124156,7 @@ async function inspectNeoTestCompilation(workspace, dependencies = {}) {
|
|
|
123550
124156
|
if (candidate.document === null) {
|
|
123551
124157
|
return {
|
|
123552
124158
|
files: selectedPaths.map(
|
|
123553
|
-
(path) =>
|
|
124159
|
+
(path) => relative6(workspace.root, path).split(sep6).join("/")
|
|
123554
124160
|
),
|
|
123555
124161
|
errors: [
|
|
123556
124162
|
{
|
|
@@ -123571,14 +124177,14 @@ async function inspectNeoTestCompilation(workspace, dependencies = {}) {
|
|
|
123571
124177
|
compileSpec(workspace, document, path, compilationHash);
|
|
123572
124178
|
} catch (error) {
|
|
123573
124179
|
errors.push({
|
|
123574
|
-
file:
|
|
124180
|
+
file: relative6(workspace.root, path).split(sep6).join("/"),
|
|
123575
124181
|
message: errorMessage2(error)
|
|
123576
124182
|
});
|
|
123577
124183
|
}
|
|
123578
124184
|
}
|
|
123579
124185
|
return {
|
|
123580
124186
|
files: selectedPaths.map(
|
|
123581
|
-
(path) =>
|
|
124187
|
+
(path) => relative6(workspace.root, path).split(sep6).join("/")
|
|
123582
124188
|
),
|
|
123583
124189
|
errors
|
|
123584
124190
|
};
|
|
@@ -123677,10 +124283,10 @@ __export(doctor_exports, {
|
|
|
123677
124283
|
import {
|
|
123678
124284
|
constants as fsConstants,
|
|
123679
124285
|
accessSync,
|
|
123680
|
-
existsSync as
|
|
124286
|
+
existsSync as existsSync14,
|
|
123681
124287
|
readFileSync as readFileSync17
|
|
123682
124288
|
} from "node:fs";
|
|
123683
|
-
import { extname as extname2, isAbsolute as
|
|
124289
|
+
import { extname as extname2, isAbsolute as isAbsolute4, join as join17, relative as relative7, sep as sep7 } from "node:path";
|
|
123684
124290
|
function inspectNeoDoctor(workspace) {
|
|
123685
124291
|
const formatCompatible = workspace.config.formatVersion === CURRENT_FORMAT_VERSION;
|
|
123686
124292
|
const compiler = inspectCompilerContract();
|
|
@@ -123797,7 +124403,7 @@ function inspectSourceContract(workspace) {
|
|
|
123797
124403
|
}
|
|
123798
124404
|
function inspectExtensionContract(root) {
|
|
123799
124405
|
const cachePath = join17(root, PROJECT_SOURCE_ANALYSIS_V4_CACHE_PATH);
|
|
123800
|
-
if (!
|
|
124406
|
+
if (!existsSync14(cachePath)) {
|
|
123801
124407
|
return {
|
|
123802
124408
|
id: NEO_VSCODE_EXTENSION_ID,
|
|
123803
124409
|
contractVersion: NEO_VSCODE_EXTENSION_CONTRACT_VERSION,
|
|
@@ -123860,7 +124466,7 @@ function inspectTrackedBinary(root, record3, errors) {
|
|
|
123860
124466
|
const binary = record3.projectBinary;
|
|
123861
124467
|
if (!binary) return;
|
|
123862
124468
|
const path = binary.path.replaceAll("\\", "/");
|
|
123863
|
-
if (
|
|
124469
|
+
if (isAbsolute4(path) || path.split("/").includes("..")) {
|
|
123864
124470
|
errors.push(
|
|
123865
124471
|
`Project file ${record3.recordId} has unsafe tracked path ${JSON.stringify(binary.path)}.`
|
|
123866
124472
|
);
|
|
@@ -123881,7 +124487,7 @@ function inspectTrackedBinary(root, record3, errors) {
|
|
|
123881
124487
|
);
|
|
123882
124488
|
}
|
|
123883
124489
|
const absolute = join17(root, path);
|
|
123884
|
-
if (
|
|
124490
|
+
if (existsSync14(absolute) && !canAccess(absolute, fsConstants.R_OK)) {
|
|
123885
124491
|
errors.push(`Tracked project file ${path} is not readable.`);
|
|
123886
124492
|
}
|
|
123887
124493
|
}
|
|
@@ -123906,7 +124512,7 @@ function canAccess(path, mode) {
|
|
|
123906
124512
|
}
|
|
123907
124513
|
}
|
|
123908
124514
|
function workspacePath(root, path) {
|
|
123909
|
-
return
|
|
124515
|
+
return relative7(root, path).split(sep7).join("/");
|
|
123910
124516
|
}
|
|
123911
124517
|
function errorMessage3(error) {
|
|
123912
124518
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -124022,7 +124628,7 @@ __export(migrate_exports, {
|
|
|
124022
124628
|
runMigrate: () => runMigrate
|
|
124023
124629
|
});
|
|
124024
124630
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
124025
|
-
import { existsSync as
|
|
124631
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync12, readdirSync as readdirSync6, writeFileSync as writeFileSync12 } from "node:fs";
|
|
124026
124632
|
import { join as join18 } from "node:path";
|
|
124027
124633
|
async function runMigrate(workspace, subcommand, positional, targetRef, json, dependencies = {}) {
|
|
124028
124634
|
if (subcommand === "new") {
|
|
@@ -124035,7 +124641,7 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
124035
124641
|
const migrationsDir = join18(workspace.root, "Migrations");
|
|
124036
124642
|
mkdirSync12(migrationsDir, { recursive: true });
|
|
124037
124643
|
let nextOrder = 1;
|
|
124038
|
-
if (
|
|
124644
|
+
if (existsSync15(migrationsDir)) {
|
|
124039
124645
|
for (const entry of readdirSync6(migrationsDir)) {
|
|
124040
124646
|
const match = /^(\d+)-/.exec(entry);
|
|
124041
124647
|
if (match !== null) {
|
|
@@ -124045,7 +124651,7 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
124045
124651
|
}
|
|
124046
124652
|
const relPath = migrationFileName(nextOrder, name);
|
|
124047
124653
|
const absolute = join18(workspace.root, relPath);
|
|
124048
|
-
if (
|
|
124654
|
+
if (existsSync15(absolute)) {
|
|
124049
124655
|
throw new Error(`"${relPath}" already exists.`);
|
|
124050
124656
|
}
|
|
124051
124657
|
const target = targetRef ?? "project";
|
|
@@ -125616,7 +126222,7 @@ async function waitForMergeTransaction(args) {
|
|
|
125616
126222
|
status = readMergeTransactionStatus(response, status.transactionId);
|
|
125617
126223
|
if (status.commitStatus === "committed") continue;
|
|
125618
126224
|
if (status.commitStatus === "failed") continue;
|
|
125619
|
-
await new Promise((
|
|
126225
|
+
await new Promise((resolve5) => setTimeout(resolve5, delayMs));
|
|
125620
126226
|
delayMs = Math.min(delayMs * 2, 5e3);
|
|
125621
126227
|
}
|
|
125622
126228
|
}
|
|
@@ -127360,7 +127966,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
127360
127966
|
async function main() {
|
|
127361
127967
|
const args = parseArgs(process.argv.slice(2));
|
|
127362
127968
|
if (args.command === "--version") {
|
|
127363
|
-
console.log("0.38.
|
|
127969
|
+
console.log("0.38.5");
|
|
127364
127970
|
return;
|
|
127365
127971
|
}
|
|
127366
127972
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|