@neocompose/cli 0.18.0 → 0.19.0
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 +678 -208
- package/package.json +1 -1
package/dist/neo.mjs
CHANGED
|
@@ -8664,6 +8664,7 @@ var init_strict_resolver = __esm({
|
|
|
8664
8664
|
branchExitNarrowings.push(new Map(noBranchScope.narrowedPaths));
|
|
8665
8665
|
branchExitOwnershipScopes.push(noBranchScope);
|
|
8666
8666
|
}
|
|
8667
|
+
mergeBranchInvalidations(scope, branchExitOwnershipScopes);
|
|
8667
8668
|
if (branchExitNarrowings.length > 0) {
|
|
8668
8669
|
for (const [path, narrowed] of mergeNarrowingMaps(
|
|
8669
8670
|
branchExitNarrowings
|
|
@@ -8674,7 +8675,6 @@ var init_strict_resolver = __esm({
|
|
|
8674
8675
|
}
|
|
8675
8676
|
}
|
|
8676
8677
|
}
|
|
8677
|
-
mergeBranchInvalidations(scope, branchExitOwnershipScopes);
|
|
8678
8678
|
mergeBranchOwnership(scope, branchExitOwnershipScopes);
|
|
8679
8679
|
return {
|
|
8680
8680
|
type: "if" /* If */,
|
|
@@ -9386,7 +9386,13 @@ var init_strict_resolver = __esm({
|
|
|
9386
9386
|
);
|
|
9387
9387
|
}
|
|
9388
9388
|
const resolvedTarget = this.resolveExpression(statement.target, scope);
|
|
9389
|
-
const
|
|
9389
|
+
const storageType = this.assignmentStorageType(
|
|
9390
|
+
statement.target,
|
|
9391
|
+
resolvedTarget,
|
|
9392
|
+
local,
|
|
9393
|
+
scope
|
|
9394
|
+
);
|
|
9395
|
+
const target = statement.op === "=" ? { ...resolvedTarget, type: storageType } : resolvedTarget;
|
|
9390
9396
|
const writability = local?.writability ?? target.writability;
|
|
9391
9397
|
if (target.symbol?.computed === true && target.symbol.writable !== true) {
|
|
9392
9398
|
throw new CompileError(
|
|
@@ -9441,7 +9447,15 @@ var init_strict_resolver = __esm({
|
|
|
9441
9447
|
const assignedPath = canonicalPath(statement.target);
|
|
9442
9448
|
if (assignedPath) {
|
|
9443
9449
|
const rootEntry = scope.lookup(pathRoot(assignedPath));
|
|
9444
|
-
if (rootEntry)
|
|
9450
|
+
if (rootEntry) {
|
|
9451
|
+
scope.invalidate(rootEntry);
|
|
9452
|
+
if (statement.op === "=" && !isNullable(value.type)) {
|
|
9453
|
+
scope.narrow(assignedPath, rootEntry, {
|
|
9454
|
+
...target.type,
|
|
9455
|
+
nullable: false
|
|
9456
|
+
});
|
|
9457
|
+
}
|
|
9458
|
+
}
|
|
9445
9459
|
}
|
|
9446
9460
|
return {
|
|
9447
9461
|
type: "assign" /* Assign */,
|
|
@@ -9454,6 +9468,23 @@ var init_strict_resolver = __esm({
|
|
|
9454
9468
|
pointer: value.pointer
|
|
9455
9469
|
};
|
|
9456
9470
|
}
|
|
9471
|
+
/**
|
|
9472
|
+
* The declared type of an assignment target, with any flow narrowing on the
|
|
9473
|
+
* path stripped back off. Locals carry their declaration on the scope entry;
|
|
9474
|
+
* a member re-resolves through `resolveMemberNatural`, which is the same
|
|
9475
|
+
* lookup `resolveMember` performs before it overlays a narrowed type.
|
|
9476
|
+
*/
|
|
9477
|
+
assignmentStorageType(targetAst, resolvedTarget, local, scope) {
|
|
9478
|
+
if (targetAst.kind === "ident") return local?.type ?? resolvedTarget.type;
|
|
9479
|
+
if (targetAst.kind !== "member") return resolvedTarget.type;
|
|
9480
|
+
return this.resolveMemberNatural(
|
|
9481
|
+
targetAst.receiver,
|
|
9482
|
+
targetAst.name,
|
|
9483
|
+
scope,
|
|
9484
|
+
targetAst.pos,
|
|
9485
|
+
targetAst.optional === true
|
|
9486
|
+
).type;
|
|
9487
|
+
}
|
|
9457
9488
|
resolveCompoundAssignment(operation, valueAst, target, scope, pos) {
|
|
9458
9489
|
const binaryOperation = operation === "++" ? "+" : operation === "--" ? "-" : operation.slice(0, 1);
|
|
9459
9490
|
const right = operation === "++" || operation === "--" ? literal({ kind: "primitive", name: "int" }, 1) : valueAst ? this.resolveExpression(valueAst, scope, target.type) : null;
|
|
@@ -10085,6 +10116,12 @@ var init_strict_resolver = __esm({
|
|
|
10085
10116
|
pos
|
|
10086
10117
|
);
|
|
10087
10118
|
}
|
|
10119
|
+
if (!optional && isNullable(receiver.type)) {
|
|
10120
|
+
throw new CompileError(
|
|
10121
|
+
`Member '${name}' is read on ${this.describe(receiver.type)}, which may be null. Handle null before reading through it \u2014 use \`!\` if it is always set, or \`?.\`, \`??\`, or a null check that narrows it.`,
|
|
10122
|
+
pos
|
|
10123
|
+
);
|
|
10124
|
+
}
|
|
10088
10125
|
if (receiver.staticType?.kind === "enum") {
|
|
10089
10126
|
if (optional) {
|
|
10090
10127
|
throw new CompileError(
|
|
@@ -17909,7 +17946,8 @@ function parseProjectRootInitializer(source) {
|
|
|
17909
17946
|
name: name.text,
|
|
17910
17947
|
type: type.text,
|
|
17911
17948
|
storage: storage.text,
|
|
17912
|
-
initializer
|
|
17949
|
+
initializer,
|
|
17950
|
+
start: expressionStart.pos
|
|
17913
17951
|
});
|
|
17914
17952
|
}
|
|
17915
17953
|
take("}");
|
|
@@ -18398,10 +18436,20 @@ function validateProjectRootGlobal(uri, declaration, environment, diagnostics) {
|
|
|
18398
18436
|
scope,
|
|
18399
18437
|
environment,
|
|
18400
18438
|
declaration.initializer.range,
|
|
18401
|
-
diagnostics
|
|
18439
|
+
diagnostics,
|
|
18440
|
+
{
|
|
18441
|
+
text: actual.initializer,
|
|
18442
|
+
start: slotPosition(declaration.initializer.range.start, actual.start)
|
|
18443
|
+
}
|
|
18402
18444
|
);
|
|
18403
18445
|
}
|
|
18404
18446
|
}
|
|
18447
|
+
function slotPosition(start, pos) {
|
|
18448
|
+
if (pos.line === 1) {
|
|
18449
|
+
return { line: start.line, character: start.character + pos.column - 1 };
|
|
18450
|
+
}
|
|
18451
|
+
return { line: start.line + pos.line - 1, character: pos.column - 1 };
|
|
18452
|
+
}
|
|
18405
18453
|
function validateMember(uri, member, documentKind, ownerScope, environment, diagnostics) {
|
|
18406
18454
|
const memberType2 = semanticType(member.type);
|
|
18407
18455
|
validateAnnotations(
|
|
@@ -19452,7 +19500,11 @@ function constructionSiteRange(expression, target, fallback, anchor) {
|
|
|
19452
19500
|
if (!entry) return fallback;
|
|
19453
19501
|
return anchorSpan(anchor, entry.pos, entry.name.length);
|
|
19454
19502
|
}
|
|
19455
|
-
return
|
|
19503
|
+
return anchorSpan(
|
|
19504
|
+
anchor,
|
|
19505
|
+
expression.pos,
|
|
19506
|
+
NEOSCRIPT_CONSTRUCTOR_KEYWORD.length
|
|
19507
|
+
);
|
|
19456
19508
|
}
|
|
19457
19509
|
function namedArgumentRange(anchor, valuePos, name) {
|
|
19458
19510
|
const prefix = anchor.text.slice(0, anchorOffset(anchor, valuePos));
|
|
@@ -20015,6 +20067,7 @@ var primitiveType, IDENTIFIER_PATTERN2, LIST_COLUMN_INHERITANCE_KEY;
|
|
|
20015
20067
|
var init_project_source_semantics = __esm({
|
|
20016
20068
|
"../packages/neoscript-language/src/project-source-semantics.ts"() {
|
|
20017
20069
|
"use strict";
|
|
20070
|
+
init_language_spec();
|
|
20018
20071
|
init_project_schema_contract_generated();
|
|
20019
20072
|
init_strict_compile_error();
|
|
20020
20073
|
init_strict_parser();
|
|
@@ -26667,7 +26720,9 @@ function memberType(member, environment, visiting, field) {
|
|
|
26667
26720
|
string2(member.collectionMemberId, `${field}.collectionMemberId`)
|
|
26668
26721
|
);
|
|
26669
26722
|
const collectionType = collection ? memberType(collection, environment, next, `${field}.collection`) : unknownType();
|
|
26670
|
-
const
|
|
26723
|
+
const declared = optionalRecord(member.declaredType);
|
|
26724
|
+
const declaredType = declared ? manifestType2(declared, environment, `${field}.declaredType`) : null;
|
|
26725
|
+
const entryType = declaredType && !isUnknownType2(declaredType) ? declaredType : collectionElementType2(collectionType) ?? unknownType();
|
|
26671
26726
|
return member.multiselect === true ? { kind: "set", elementType: entryType, nullable } : { ...entryType, nullable };
|
|
26672
26727
|
}
|
|
26673
26728
|
if (kind === "dialogueLookup") {
|
|
@@ -26995,6 +27050,9 @@ function primitive(name, nullable) {
|
|
|
26995
27050
|
function unknownType() {
|
|
26996
27051
|
return { kind: "primitive", name: "unknown" };
|
|
26997
27052
|
}
|
|
27053
|
+
function isUnknownType2(type) {
|
|
27054
|
+
return type.kind === "primitive" && type.name === "unknown";
|
|
27055
|
+
}
|
|
26998
27056
|
function indexById(values, field) {
|
|
26999
27057
|
const result = /* @__PURE__ */ new Map();
|
|
27000
27058
|
values.forEach((value, index) => {
|
|
@@ -50841,6 +50899,7 @@ function drainValueReferenceObligationsV4(state, manifest, options) {
|
|
|
50841
50899
|
for (const recorded of options.registry.loweringFailures) {
|
|
50842
50900
|
failures.push({
|
|
50843
50901
|
message: recorded.message,
|
|
50902
|
+
...recorded.code === void 0 ? {} : { code: recorded.code },
|
|
50844
50903
|
...composeReferenceSitePosition(recorded.site, options.sourceTextByUri)
|
|
50845
50904
|
});
|
|
50846
50905
|
}
|
|
@@ -52276,59 +52335,96 @@ function resolveConstructorProjectionArguments(context, schemaClass2, expression
|
|
|
52276
52335
|
context.classes,
|
|
52277
52336
|
schemaClass2.id
|
|
52278
52337
|
);
|
|
52338
|
+
const signature = describeProjectedConstructor(schemaClass2.name, projections);
|
|
52279
52339
|
if (projections.length === 0) {
|
|
52280
52340
|
if (expression.args.length > 0) {
|
|
52281
|
-
|
|
52282
|
-
`Class ${schemaClass2.name}
|
|
52283
|
-
|
|
52341
|
+
context.loweringFailures.push({
|
|
52342
|
+
message: `Class '${schemaClass2.name}' projects no constructor parameters, so '${schemaClass2.name}()' takes no arguments \u2014 this call passes ${expression.args.length}.`,
|
|
52343
|
+
code: "unbound-constructor-argument",
|
|
52344
|
+
site: referenceSite(source, expression)
|
|
52345
|
+
});
|
|
52284
52346
|
}
|
|
52285
52347
|
return [];
|
|
52286
52348
|
}
|
|
52287
52349
|
const names = expression.argumentNames ?? [];
|
|
52288
|
-
if (expression.args.length !== projections.length
|
|
52289
|
-
|
|
52290
|
-
`
|
|
52291
|
-
|
|
52350
|
+
if (expression.args.length !== projections.length) {
|
|
52351
|
+
context.loweringFailures.push({
|
|
52352
|
+
message: `Constructor '${signature}' takes ${projections.length} argument${projections.length === 1 ? "" : "s"}, but this call passes ${expression.args.length} \u2014 parameters: ${describeQuotedNames(projections.map((entry) => entry.parameterName))}.`,
|
|
52353
|
+
code: "missing-constructor-argument",
|
|
52354
|
+
site: referenceSite(source, expression)
|
|
52355
|
+
});
|
|
52356
|
+
return [];
|
|
52357
|
+
}
|
|
52358
|
+
if (names.length !== projections.length) {
|
|
52359
|
+
context.loweringFailures.push({
|
|
52360
|
+
message: `Constructor '${signature}' takes named arguments only, so this call must name all ${projections.length} of them and names ${names.length} \u2014 parameters: ${describeQuotedNames(projections.map((entry) => entry.parameterName))}.`,
|
|
52361
|
+
code: "unbound-constructor-argument",
|
|
52362
|
+
site: referenceSite(source, expression)
|
|
52363
|
+
});
|
|
52364
|
+
return [];
|
|
52292
52365
|
}
|
|
52293
52366
|
const seen = /* @__PURE__ */ new Set();
|
|
52294
52367
|
const resolved = [];
|
|
52295
52368
|
for (let index = 0; index < expression.args.length; index++) {
|
|
52369
|
+
const argument2 = expression.args[index];
|
|
52296
52370
|
const parameterName = names[index];
|
|
52297
52371
|
if (parameterName === null || parameterName === void 0) {
|
|
52298
|
-
|
|
52299
|
-
`
|
|
52300
|
-
|
|
52372
|
+
context.loweringFailures.push({
|
|
52373
|
+
message: `Constructor '${signature}' takes named arguments only, so the argument at position ${index + 1} binds to no parameter \u2014 candidates: ${describeQuotedNames(projections.map((entry) => entry.parameterName))}.`,
|
|
52374
|
+
code: "unbound-constructor-argument",
|
|
52375
|
+
site: referenceSite(source, argument2)
|
|
52376
|
+
});
|
|
52377
|
+
continue;
|
|
52301
52378
|
}
|
|
52302
52379
|
if (seen.has(parameterName)) {
|
|
52303
|
-
|
|
52304
|
-
`
|
|
52305
|
-
|
|
52380
|
+
context.loweringFailures.push({
|
|
52381
|
+
message: `Constructor '${signature}' is passed '${parameterName}' more than once, and each parameter binds exactly one argument.`,
|
|
52382
|
+
code: "duplicate-constructor-argument",
|
|
52383
|
+
site: namedArgumentSite(source, argument2, parameterName)
|
|
52384
|
+
});
|
|
52385
|
+
continue;
|
|
52306
52386
|
}
|
|
52307
52387
|
seen.add(parameterName);
|
|
52308
52388
|
const projection = projections.find(
|
|
52309
52389
|
(candidate) => candidate.parameterName === parameterName
|
|
52310
52390
|
);
|
|
52311
52391
|
if (projection === void 0) {
|
|
52312
|
-
|
|
52313
|
-
`
|
|
52314
|
-
|
|
52392
|
+
context.loweringFailures.push({
|
|
52393
|
+
message: `Constructor '${signature}' has no parameter '${parameterName}' \u2014 candidates: ${describeQuotedNames(projections.map((entry) => entry.parameterName))}.`,
|
|
52394
|
+
code: "unknown-constructor-argument",
|
|
52395
|
+
site: namedArgumentSite(source, argument2, parameterName)
|
|
52396
|
+
});
|
|
52397
|
+
continue;
|
|
52315
52398
|
}
|
|
52316
|
-
const argument2 = expression.args[index];
|
|
52317
52399
|
if (argument2.kind !== "litString") {
|
|
52318
|
-
|
|
52319
|
-
`
|
|
52320
|
-
|
|
52400
|
+
context.loweringFailures.push({
|
|
52401
|
+
message: `Constructor '${signature}' parameter '${parameterName}' projects a row identity, so its argument must be a value-row id string literal.`,
|
|
52402
|
+
code: "non-literal-constructor-argument",
|
|
52403
|
+
site: referenceSite(source, argument2)
|
|
52404
|
+
});
|
|
52405
|
+
continue;
|
|
52321
52406
|
}
|
|
52322
52407
|
const schemaKey = inheritedProjectionSchemaKey(
|
|
52323
52408
|
context.classes,
|
|
52324
52409
|
schemaClass2.id,
|
|
52325
52410
|
projection.memberId
|
|
52326
52411
|
);
|
|
52412
|
+
if (schemaKey === null) {
|
|
52413
|
+
context.loweringFailures.push({
|
|
52414
|
+
message: `Constructor '${signature}' parameter '${parameterName}' projects member ${projection.memberId}, which no class in '${schemaClass2.name}'s inheritance chain declares under a schema key.`,
|
|
52415
|
+
code: "unprojectable-constructor-argument",
|
|
52416
|
+
site: referenceSite(source, argument2)
|
|
52417
|
+
});
|
|
52418
|
+
continue;
|
|
52419
|
+
}
|
|
52327
52420
|
const projectedMember = context.members.get(projection.memberId);
|
|
52328
|
-
if (
|
|
52329
|
-
|
|
52330
|
-
`
|
|
52331
|
-
|
|
52421
|
+
if (projectedMember?.kind !== "lookup") {
|
|
52422
|
+
context.loweringFailures.push({
|
|
52423
|
+
message: `Constructor '${signature}' parameter '${parameterName}' projects member ${projection.memberId}, which is ${projectedMember === void 0 ? "in no member of this project" : `a ${projectedMember.kind} member`} and not the Lookup field a projection writes.`,
|
|
52424
|
+
code: "unprojectable-constructor-argument",
|
|
52425
|
+
site: referenceSite(source, argument2)
|
|
52426
|
+
});
|
|
52427
|
+
continue;
|
|
52332
52428
|
}
|
|
52333
52429
|
context.referenceObligations.push({
|
|
52334
52430
|
kind: "constructorProjection",
|
|
@@ -52349,6 +52445,14 @@ function resolveConstructorProjectionArguments(context, schemaClass2, expression
|
|
|
52349
52445
|
}
|
|
52350
52446
|
return resolved;
|
|
52351
52447
|
}
|
|
52448
|
+
function describeProjectedConstructor(className, projections) {
|
|
52449
|
+
return `${className}(${projections.map((entry) => entry.parameterName).join(", ")})`;
|
|
52450
|
+
}
|
|
52451
|
+
function describeQuotedNames(names) {
|
|
52452
|
+
const quoted = names.map((name) => `'${name}'`);
|
|
52453
|
+
if (quoted.length <= 1) return quoted.join("") || "none";
|
|
52454
|
+
return `${quoted.slice(0, -1).join(", ")} and ${quoted.at(-1)}`;
|
|
52455
|
+
}
|
|
52352
52456
|
function validateAnimationProjectionBinding(context, schemaClass2, environment, targetValueId) {
|
|
52353
52457
|
if (schemaClass2.system?.worldKind !== "animationChildOverride") return;
|
|
52354
52458
|
const parameter3 = schemaClass2.genericParameters[0];
|
|
@@ -52783,16 +52887,42 @@ function lowerReferences(context, member, expression, ownerValueId, source) {
|
|
|
52783
52887
|
return ids;
|
|
52784
52888
|
}
|
|
52785
52889
|
function referenceSite(source, expression) {
|
|
52890
|
+
return referenceSiteAt(source, expressionAnchorPos(expression));
|
|
52891
|
+
}
|
|
52892
|
+
function referenceSiteAt(source, pos) {
|
|
52786
52893
|
return {
|
|
52787
52894
|
uri: source.source.uri,
|
|
52788
52895
|
declarationStart: source.source.range.start,
|
|
52789
|
-
expression: {
|
|
52790
|
-
initializer: source.initializer,
|
|
52791
|
-
pos: expressionAnchorPos(expression)
|
|
52792
|
-
},
|
|
52896
|
+
expression: { initializer: source.initializer, pos },
|
|
52793
52897
|
label: source.label
|
|
52794
52898
|
};
|
|
52795
52899
|
}
|
|
52900
|
+
function namedArgumentSite(source, argument2, name) {
|
|
52901
|
+
const value = expressionAnchorPos(argument2);
|
|
52902
|
+
const text = source.initializer;
|
|
52903
|
+
const prefix = text.slice(0, initializerOffsetAtPos(text, value));
|
|
52904
|
+
const colon = prefix.lastIndexOf(":");
|
|
52905
|
+
if (colon < 0) return referenceSiteAt(source, value);
|
|
52906
|
+
if (prefix.slice(colon + 1).trim().length > 0) {
|
|
52907
|
+
return referenceSiteAt(source, value);
|
|
52908
|
+
}
|
|
52909
|
+
const beforeColon = prefix.slice(0, colon).trimEnd();
|
|
52910
|
+
if (!beforeColon.endsWith(name)) return referenceSiteAt(source, value);
|
|
52911
|
+
const start = sourcePositionAtOffset(text, beforeColon.length - name.length);
|
|
52912
|
+
return referenceSiteAt(source, {
|
|
52913
|
+
line: start.line + 1,
|
|
52914
|
+
column: start.character + 1
|
|
52915
|
+
});
|
|
52916
|
+
}
|
|
52917
|
+
function initializerOffsetAtPos(text, pos) {
|
|
52918
|
+
let offset = 0;
|
|
52919
|
+
for (let line = 1; line < pos.line; line += 1) {
|
|
52920
|
+
const next = text.indexOf("\n", offset);
|
|
52921
|
+
if (next < 0) return text.length;
|
|
52922
|
+
offset = next + 1;
|
|
52923
|
+
}
|
|
52924
|
+
return Math.min(offset + pos.column - 1, text.length);
|
|
52925
|
+
}
|
|
52796
52926
|
function expressionAnchorPos(expression) {
|
|
52797
52927
|
if (expression.kind === "annotated") {
|
|
52798
52928
|
return expressionAnchorPos(expression.expression);
|
|
@@ -53004,7 +53134,14 @@ function validateReferenceContract(context, member, target, ownerValueId) {
|
|
|
53004
53134
|
const actualClassId = targetData && typeof targetData.classId === "string" ? targetData.classId : null;
|
|
53005
53135
|
if (expectedClassId && actualClassId && !classAssignableToClass(context, actualClassId, expectedClassId)) {
|
|
53006
53136
|
throw new Error(
|
|
53007
|
-
`Lookup member ${member.name} target ${target.id} is ${context
|
|
53137
|
+
`Lookup member ${member.name} target ${target.id} is ${classDisplayName(context, actualClassId)}, but collection ${collectionMemberName(context, member)} holds ${classDisplayName(context, expectedClassId)}.`
|
|
53138
|
+
);
|
|
53139
|
+
}
|
|
53140
|
+
const declaredClassId = lookupDeclaredClassId(context, member);
|
|
53141
|
+
if (declaredClassId && actualClassId && !classAssignableToClass(context, actualClassId, declaredClassId)) {
|
|
53142
|
+
const narrowedFrom = expectedClassId === null ? `the collection ${collectionMemberName(context, member)}` : `the collection ${collectionMemberName(context, member)} holds ${classDisplayName(context, expectedClassId)}`;
|
|
53143
|
+
throw new Error(
|
|
53144
|
+
`Lookup member ${member.name} target ${target.id} is ${classDisplayName(context, actualClassId)}, but the member declares ${classDisplayName(context, declaredClassId)} \u2014 ${narrowedFrom} and this member narrows it. Point it at a ${classDisplayName(context, declaredClassId)} row.`
|
|
53008
53145
|
);
|
|
53009
53146
|
}
|
|
53010
53147
|
if (target.genericTypeName && expectedTypeName && !referenceTypeNameAssignable(
|
|
@@ -53031,6 +53168,15 @@ function validateReferenceContract(context, member, target, ownerValueId) {
|
|
|
53031
53168
|
}
|
|
53032
53169
|
validateDialogueEligibility(context, member, target.id);
|
|
53033
53170
|
}
|
|
53171
|
+
function lookupDeclaredClassId(context, member) {
|
|
53172
|
+
const declared = member.declaredType;
|
|
53173
|
+
if (declared === null) return null;
|
|
53174
|
+
if (declared.kind !== "class") return null;
|
|
53175
|
+
return context.classes.has(declared.classId) ? declared.classId : null;
|
|
53176
|
+
}
|
|
53177
|
+
function classDisplayName(context, classId) {
|
|
53178
|
+
return context.classes.get(classId)?.name ?? classId;
|
|
53179
|
+
}
|
|
53034
53180
|
function lookupEntryTypeName(context, member) {
|
|
53035
53181
|
const collection = context.members.get(member.collectionMemberId);
|
|
53036
53182
|
const entry = collection?.kind === "list" || collection?.kind === "dictionary" ? context.members.get(collection.entryMemberId) : null;
|
|
@@ -58886,12 +59032,14 @@ function computeWorkspaceStatus(workspace, options = {}) {
|
|
|
58886
59032
|
}
|
|
58887
59033
|
);
|
|
58888
59034
|
for (const failure of referenceFailures) {
|
|
59035
|
+
const message = failure.code === void 0 ? failure.message : `${failure.code}: ${failure.message}`;
|
|
58889
59036
|
parseErrors.push(
|
|
58890
59037
|
new SchemaSourceError(
|
|
58891
|
-
|
|
59038
|
+
message,
|
|
58892
59039
|
failure.file,
|
|
58893
59040
|
failure.line,
|
|
58894
|
-
failure.column
|
|
59041
|
+
failure.column,
|
|
59042
|
+
failure.code
|
|
58895
59043
|
)
|
|
58896
59044
|
);
|
|
58897
59045
|
}
|
|
@@ -64643,6 +64791,20 @@ function memberToSymbol(record3, schemaKey, containingClass2, ownerClassId2, ind
|
|
|
64643
64791
|
writability: writable ? "setter" : "readOnly"
|
|
64644
64792
|
};
|
|
64645
64793
|
}
|
|
64794
|
+
if (isMemberNSPropertyContractBase(resolved)) {
|
|
64795
|
+
return {
|
|
64796
|
+
...common,
|
|
64797
|
+
kind: "property",
|
|
64798
|
+
type: toLanguageType(
|
|
64799
|
+
resolved.returnTypeInfo,
|
|
64800
|
+
context,
|
|
64801
|
+
genericEnvironment
|
|
64802
|
+
),
|
|
64803
|
+
writable: false,
|
|
64804
|
+
computed: true,
|
|
64805
|
+
writability: "readOnly"
|
|
64806
|
+
};
|
|
64807
|
+
}
|
|
64646
64808
|
if (isMemberLookupBase(resolved)) {
|
|
64647
64809
|
const collectionWritability = uniqueEffectiveWritability(
|
|
64648
64810
|
resolved.collectionMemberId,
|
|
@@ -64991,27 +65153,26 @@ function memberRuntimeType(record3, context, seen = /* @__PURE__ */ new Set(), g
|
|
|
64991
65153
|
}
|
|
64992
65154
|
case 9 /* Lookup */: {
|
|
64993
65155
|
if (!isMemberLookupBase(member)) return UNKNOWN_TYPE2;
|
|
64994
|
-
const
|
|
64995
|
-
|
|
64996
|
-
|
|
64997
|
-
|
|
64998
|
-
if (!collection) return UNKNOWN_TYPE2;
|
|
64999
|
-
const collectionType = memberRuntimeType(
|
|
65000
|
-
collection,
|
|
65156
|
+
const declared = member.declaredTypeInfo ? toLanguageType(member.declaredTypeInfo, context, genericEnvironment) : null;
|
|
65157
|
+
const narrowed = declared && !isUnknownType3(declared) ? declared : null;
|
|
65158
|
+
const entry = narrowed ?? lookupCollectionEntryType(
|
|
65159
|
+
member.collectionMemberId,
|
|
65001
65160
|
context,
|
|
65002
65161
|
nextSeen,
|
|
65003
65162
|
genericEnvironment
|
|
65004
65163
|
);
|
|
65005
|
-
const entry = collectionEntryType(collectionType);
|
|
65006
65164
|
if (!entry) return UNKNOWN_TYPE2;
|
|
65007
65165
|
return member.multiselect ? {
|
|
65008
65166
|
kind: "set",
|
|
65009
65167
|
elementType: requiredType(entry),
|
|
65010
65168
|
nullable: !required2
|
|
65011
|
-
} : { ...entry, nullable:
|
|
65169
|
+
} : { ...entry, nullable: !required2 };
|
|
65012
65170
|
}
|
|
65013
65171
|
case 10 /* NSProperty */:
|
|
65014
|
-
|
|
65172
|
+
if (isMemberNSPropertyBase(member) || isMemberNSPropertyContractBase(member)) {
|
|
65173
|
+
return toLanguageType(member.returnTypeInfo, context);
|
|
65174
|
+
}
|
|
65175
|
+
return UNKNOWN_TYPE2;
|
|
65015
65176
|
case 13 /* Function */:
|
|
65016
65177
|
case 23 /* NSFunction */:
|
|
65017
65178
|
return primitive2("void", true);
|
|
@@ -65262,6 +65423,16 @@ function collectionEntryType(type) {
|
|
|
65262
65423
|
if (type.kind === "dictionary") return type.valueType;
|
|
65263
65424
|
return null;
|
|
65264
65425
|
}
|
|
65426
|
+
function lookupCollectionEntryType(collectionMemberId, context, seen, genericEnvironment) {
|
|
65427
|
+
const collection = analyzerMemberById(context.vm, collectionMemberId);
|
|
65428
|
+
if (!collection) return null;
|
|
65429
|
+
return collectionEntryType(
|
|
65430
|
+
memberRuntimeType(collection, context, new Set(seen), genericEnvironment)
|
|
65431
|
+
);
|
|
65432
|
+
}
|
|
65433
|
+
function isUnknownType3(type) {
|
|
65434
|
+
return type.kind === "primitive" && type.name === "unknown";
|
|
65435
|
+
}
|
|
65265
65436
|
function projectLanguageVersion(context) {
|
|
65266
65437
|
const records2 = [
|
|
65267
65438
|
...context.vm.classes,
|
|
@@ -65625,6 +65796,165 @@ var init_compiler_adapter = __esm({
|
|
|
65625
65796
|
}
|
|
65626
65797
|
});
|
|
65627
65798
|
|
|
65799
|
+
// src/commands/push-body-diagnostics.ts
|
|
65800
|
+
import { existsSync as existsSync11, readFileSync as readFileSync10 } from "node:fs";
|
|
65801
|
+
import { join as join12 } from "node:path";
|
|
65802
|
+
function createNeoScriptBodySourceLocator(workspace, status) {
|
|
65803
|
+
const textByFile = /* @__PURE__ */ new Map();
|
|
65804
|
+
return {
|
|
65805
|
+
originOf(site) {
|
|
65806
|
+
if (site.recordKind === "script") return null;
|
|
65807
|
+
const record3 = status.reconstructed.get(
|
|
65808
|
+
recordStateKey(site.recordKind, site.recordId)
|
|
65809
|
+
);
|
|
65810
|
+
if (record3 === void 0) return null;
|
|
65811
|
+
const span2 = record3.sourceSpan;
|
|
65812
|
+
if (span2 === void 0) {
|
|
65813
|
+
return {
|
|
65814
|
+
file: record3.file,
|
|
65815
|
+
declarationStart: { line: record3.line - 1, character: 0 }
|
|
65816
|
+
};
|
|
65817
|
+
}
|
|
65818
|
+
return { file: span2.path, declarationStart: span2.start };
|
|
65819
|
+
},
|
|
65820
|
+
textOf(file) {
|
|
65821
|
+
const cached = textByFile.get(file);
|
|
65822
|
+
if (cached !== void 0) return cached;
|
|
65823
|
+
const path = join12(workspace.root, file);
|
|
65824
|
+
const text = existsSync11(path) ? readFileSync10(path, "utf8") : null;
|
|
65825
|
+
textByFile.set(file, text);
|
|
65826
|
+
return text;
|
|
65827
|
+
}
|
|
65828
|
+
};
|
|
65829
|
+
}
|
|
65830
|
+
function compileNeoScriptBodyOrThrow(compile, site, locator) {
|
|
65831
|
+
try {
|
|
65832
|
+
return compile();
|
|
65833
|
+
} catch (error) {
|
|
65834
|
+
if (!(error instanceof CompileError)) throw error;
|
|
65835
|
+
throw positionNeoScriptBodyCompileError(error, site, locator);
|
|
65836
|
+
}
|
|
65837
|
+
}
|
|
65838
|
+
function describeBodySite(site) {
|
|
65839
|
+
if (site.recordKind === "script") {
|
|
65840
|
+
return `${unitLabel(site.unit)} compiled from ${site.origin}`;
|
|
65841
|
+
}
|
|
65842
|
+
if (site.recordKind === "migration") {
|
|
65843
|
+
if (site.ownerName === null) return `Migration '${site.memberName}'`;
|
|
65844
|
+
return `Migration '${site.memberName}' (target ${site.ownerName})`;
|
|
65845
|
+
}
|
|
65846
|
+
const unit = unitLabel(site.unit);
|
|
65847
|
+
if (site.ownerName === null) {
|
|
65848
|
+
return `${unit} '${site.memberName}' (member ${site.recordId}, whose declaring class is not in this push's schema)`;
|
|
65849
|
+
}
|
|
65850
|
+
return `${unit} '${site.ownerName}.${site.memberName}'`;
|
|
65851
|
+
}
|
|
65852
|
+
function unitLabel(unit) {
|
|
65853
|
+
return `${unit.charAt(0).toUpperCase()}${unit.slice(1)}`;
|
|
65854
|
+
}
|
|
65855
|
+
function positionNeoScriptBodyCompileError(error, site, locator) {
|
|
65856
|
+
const subject = describeBodySite(site);
|
|
65857
|
+
const message = error.message.replace(`${error.line}:${error.column}: `, "");
|
|
65858
|
+
const inBody = `at ${error.line}:${error.column} in the compiled body`;
|
|
65859
|
+
if (site.recordKind === "script") {
|
|
65860
|
+
return new NeoScriptBodyCompileError(
|
|
65861
|
+
`${subject}: ${message} (${inBody}; this body was handed to the CLI directly, so no declaring file exists to map it to)`,
|
|
65862
|
+
error.line,
|
|
65863
|
+
error.column
|
|
65864
|
+
);
|
|
65865
|
+
}
|
|
65866
|
+
if (locator === null) {
|
|
65867
|
+
return new NeoScriptBodyCompileError(
|
|
65868
|
+
`${subject}: ${message} (${inBody}; no workspace source locator was supplied for this compile, so it could not be mapped to a file)`,
|
|
65869
|
+
error.line,
|
|
65870
|
+
error.column
|
|
65871
|
+
);
|
|
65872
|
+
}
|
|
65873
|
+
const origin = locator.originOf(site);
|
|
65874
|
+
if (origin === null) {
|
|
65875
|
+
return new NeoScriptBodyCompileError(
|
|
65876
|
+
`${subject}: ${message} (${inBody}; this body has no reconstructed source record in the workspace, so it could not be mapped to a file)`,
|
|
65877
|
+
error.line,
|
|
65878
|
+
error.column
|
|
65879
|
+
);
|
|
65880
|
+
}
|
|
65881
|
+
const text = locator.textOf(origin.file);
|
|
65882
|
+
if (text === null) {
|
|
65883
|
+
return new SchemaSourceError(
|
|
65884
|
+
`${subject}: ${message} (${inBody}; ${origin.file} could not be read, so the position is the declaration's)`,
|
|
65885
|
+
origin.file,
|
|
65886
|
+
origin.declarationStart.line + 1,
|
|
65887
|
+
origin.declarationStart.character + 1
|
|
65888
|
+
);
|
|
65889
|
+
}
|
|
65890
|
+
const composed = composeBodyPosition(text, origin, site.code, error);
|
|
65891
|
+
if (composed === null) {
|
|
65892
|
+
return new SchemaSourceError(
|
|
65893
|
+
`${subject}: ${message} (${inBody}; the authored body text was not found in ${origin.file}, so the position is the declaration's)`,
|
|
65894
|
+
origin.file,
|
|
65895
|
+
origin.declarationStart.line + 1,
|
|
65896
|
+
origin.declarationStart.character + 1
|
|
65897
|
+
);
|
|
65898
|
+
}
|
|
65899
|
+
return new SchemaSourceError(
|
|
65900
|
+
`${subject}: ${message}`,
|
|
65901
|
+
origin.file,
|
|
65902
|
+
composed.line,
|
|
65903
|
+
composed.column
|
|
65904
|
+
);
|
|
65905
|
+
}
|
|
65906
|
+
function composeBodyPosition(text, origin, code, error) {
|
|
65907
|
+
const declarationOffset = offsetAtPosition(text, origin.declarationStart);
|
|
65908
|
+
if (declarationOffset === null) return null;
|
|
65909
|
+
const codeOffset = text.indexOf(code, declarationOffset);
|
|
65910
|
+
if (codeOffset < 0) return null;
|
|
65911
|
+
const start = positionAtOffset(text, codeOffset);
|
|
65912
|
+
if (error.line === 1) {
|
|
65913
|
+
return { line: start.line + 1, column: start.character + error.column };
|
|
65914
|
+
}
|
|
65915
|
+
return { line: start.line + error.line, column: error.column };
|
|
65916
|
+
}
|
|
65917
|
+
function offsetAtPosition(text, position) {
|
|
65918
|
+
let offset = 0;
|
|
65919
|
+
for (let line = 0; line < position.line; line += 1) {
|
|
65920
|
+
const next = text.indexOf("\n", offset);
|
|
65921
|
+
if (next < 0) return null;
|
|
65922
|
+
offset = next + 1;
|
|
65923
|
+
}
|
|
65924
|
+
const candidate = offset + position.character;
|
|
65925
|
+
return candidate > text.length ? null : candidate;
|
|
65926
|
+
}
|
|
65927
|
+
function positionAtOffset(text, offset) {
|
|
65928
|
+
let line = 0;
|
|
65929
|
+
let lineStart = 0;
|
|
65930
|
+
for (let cursor = 0; cursor < offset; cursor += 1) {
|
|
65931
|
+
if (text[cursor] === "\n") {
|
|
65932
|
+
line += 1;
|
|
65933
|
+
lineStart = cursor + 1;
|
|
65934
|
+
}
|
|
65935
|
+
}
|
|
65936
|
+
return { line, character: offset - lineStart };
|
|
65937
|
+
}
|
|
65938
|
+
var NeoScriptBodyCompileError;
|
|
65939
|
+
var init_push_body_diagnostics = __esm({
|
|
65940
|
+
"src/commands/push-body-diagnostics.ts"() {
|
|
65941
|
+
"use strict";
|
|
65942
|
+
init_compile_error();
|
|
65943
|
+
init_source_diagnostics();
|
|
65944
|
+
init_workspace();
|
|
65945
|
+
NeoScriptBodyCompileError = class extends Error {
|
|
65946
|
+
constructor(message, line, column) {
|
|
65947
|
+
super(message);
|
|
65948
|
+
this.line = line;
|
|
65949
|
+
this.column = column;
|
|
65950
|
+
this.name = "NeoScriptBodyCompileError";
|
|
65951
|
+
}
|
|
65952
|
+
line;
|
|
65953
|
+
column;
|
|
65954
|
+
};
|
|
65955
|
+
}
|
|
65956
|
+
});
|
|
65957
|
+
|
|
65628
65958
|
// ../src/view-models/neoscript-evaluator/NSGetterRuntimeError.ts
|
|
65629
65959
|
var NSGetterRuntimeError;
|
|
65630
65960
|
var init_NSGetterRuntimeError = __esm({
|
|
@@ -72525,7 +72855,7 @@ __export(script_exports, {
|
|
|
72525
72855
|
readDocumentArrays: () => readDocumentArrays,
|
|
72526
72856
|
runScript: () => runScript
|
|
72527
72857
|
});
|
|
72528
|
-
import { readFileSync as
|
|
72858
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
72529
72859
|
function readDocumentArrays(raw) {
|
|
72530
72860
|
const arrayOf2 = (field) => {
|
|
72531
72861
|
const value = raw[field];
|
|
@@ -73037,9 +73367,9 @@ function buildRootValue(document) {
|
|
|
73037
73367
|
}
|
|
73038
73368
|
function readSource(options, fallback) {
|
|
73039
73369
|
if (options.source !== null) return options.source;
|
|
73040
|
-
if (options.file !== null) return
|
|
73370
|
+
if (options.file !== null) return readFileSync11(options.file, "utf8");
|
|
73041
73371
|
if (fallback !== void 0) return fallback;
|
|
73042
|
-
const stdin =
|
|
73372
|
+
const stdin = readFileSync11(0, "utf8");
|
|
73043
73373
|
if (stdin.trim().length === 0) {
|
|
73044
73374
|
throw new Error(
|
|
73045
73375
|
"Provide NeoScript source as an argument, --file, or stdin."
|
|
@@ -73047,6 +73377,20 @@ function readSource(options, fallback) {
|
|
|
73047
73377
|
}
|
|
73048
73378
|
return stdin;
|
|
73049
73379
|
}
|
|
73380
|
+
function describeScriptBodyOrigin(options, storedBodyMemberLabel) {
|
|
73381
|
+
if (options.source !== null) return "the inline source argument";
|
|
73382
|
+
if (options.file !== null) return `--file ${options.file}`;
|
|
73383
|
+
if (storedBodyMemberLabel !== null) {
|
|
73384
|
+
return `the stored body of ${storedBodyMemberLabel}`;
|
|
73385
|
+
}
|
|
73386
|
+
return "stdin";
|
|
73387
|
+
}
|
|
73388
|
+
function qualifiedMemberLabel(thisClass, member) {
|
|
73389
|
+
const memberName = String(member.name ?? member.id);
|
|
73390
|
+
if (thisClass === null) return `'${memberName}'`;
|
|
73391
|
+
if (typeof thisClass.name !== "string") return `'${memberName}'`;
|
|
73392
|
+
return `'${thisClass.name}.${memberName}'`;
|
|
73393
|
+
}
|
|
73050
73394
|
function analyzeWorkspaceProjectManifestV4(workspace) {
|
|
73051
73395
|
const status = computeWorkspaceStatus(workspace, {
|
|
73052
73396
|
skipProjectBinaryInspection: true
|
|
@@ -73129,6 +73473,14 @@ async function runScript(workspace, command, options, dependencies = {}) {
|
|
|
73129
73473
|
);
|
|
73130
73474
|
}
|
|
73131
73475
|
const thisClass = setterMember !== null ? resolveMemberContainingClass(setterMember, document) : nsFunctionTarget !== null ? nsFunctionMember?.isStatic === true ? null : nsFunctionTarget.receiverClass : resolveThisClass(options.thisRef, document);
|
|
73476
|
+
const storedBodyMemberLabel = nsFunctionDefinition === null || nsFunctionMember === null ? null : qualifiedMemberLabel(thisClass, nsFunctionMember);
|
|
73477
|
+
const bodyOrigin = describeScriptBodyOrigin(options, storedBodyMemberLabel);
|
|
73478
|
+
const bodySite = (unit) => ({
|
|
73479
|
+
recordKind: "script",
|
|
73480
|
+
origin: bodyOrigin,
|
|
73481
|
+
unit,
|
|
73482
|
+
code: source
|
|
73483
|
+
});
|
|
73132
73484
|
const compileContext = {
|
|
73133
73485
|
project: document.project,
|
|
73134
73486
|
members: document.members,
|
|
@@ -73162,53 +73514,76 @@ async function runScript(workspace, command, options, dependencies = {}) {
|
|
|
73162
73514
|
source,
|
|
73163
73515
|
sharedContext
|
|
73164
73516
|
);
|
|
73165
|
-
|
|
73166
|
-
(
|
|
73517
|
+
compileNeoScriptBodyOrThrow(
|
|
73518
|
+
() => {
|
|
73519
|
+
const diagnostic = diagnostics.find(
|
|
73520
|
+
(candidate) => candidate.severity === "error"
|
|
73521
|
+
);
|
|
73522
|
+
if (diagnostic === void 0) return;
|
|
73523
|
+
throw new CompileError(diagnostic.message, {
|
|
73524
|
+
line: diagnostic.range.start.line + 1,
|
|
73525
|
+
column: diagnostic.range.start.character + 1
|
|
73526
|
+
});
|
|
73527
|
+
},
|
|
73528
|
+
bodySite(sharedKind),
|
|
73529
|
+
null
|
|
73167
73530
|
);
|
|
73168
|
-
if (error !== void 0) {
|
|
73169
|
-
throw new CompileError(error.message, {
|
|
73170
|
-
line: error.range.start.line + 1,
|
|
73171
|
-
column: error.range.start.character + 1
|
|
73172
|
-
});
|
|
73173
|
-
}
|
|
73174
73531
|
}
|
|
73175
73532
|
if (options.mode === "nsfunction") {
|
|
73176
73533
|
if (nsFunctionMember === null || nsFunctionDefinition === null) {
|
|
73177
73534
|
throw new Error("NSFunction mode requires a function target.");
|
|
73178
73535
|
}
|
|
73179
|
-
compiled =
|
|
73180
|
-
|
|
73181
|
-
|
|
73182
|
-
|
|
73183
|
-
|
|
73184
|
-
|
|
73185
|
-
|
|
73186
|
-
|
|
73187
|
-
|
|
73188
|
-
|
|
73189
|
-
|
|
73190
|
-
|
|
73536
|
+
compiled = compileNeoScriptBodyOrThrow(
|
|
73537
|
+
() => compileNSFunction(source, {
|
|
73538
|
+
project: document.project,
|
|
73539
|
+
members: document.members,
|
|
73540
|
+
classes: document.classes,
|
|
73541
|
+
enums: document.enums,
|
|
73542
|
+
interfaces: document.interfaces,
|
|
73543
|
+
thisClass,
|
|
73544
|
+
returnTypeInfo: nsFunctionDefinition.returnTypeInfo,
|
|
73545
|
+
argumentTypes: nsFunctionDefinition.argumentTypes,
|
|
73546
|
+
deferred: nsFunctionDefinition.deferred,
|
|
73547
|
+
functionName: String(nsFunctionMember.name ?? nsFunctionMember.id)
|
|
73548
|
+
}),
|
|
73549
|
+
bodySite("function"),
|
|
73550
|
+
null
|
|
73551
|
+
);
|
|
73191
73552
|
} else if (options.mode === "setter") {
|
|
73192
73553
|
if (setterMember === null) {
|
|
73193
73554
|
throw new Error("Setter mode requires an NSProperty member target.");
|
|
73194
73555
|
}
|
|
73195
|
-
compiled =
|
|
73196
|
-
|
|
73197
|
-
|
|
73198
|
-
|
|
73199
|
-
|
|
73200
|
-
|
|
73201
|
-
|
|
73202
|
-
|
|
73203
|
-
|
|
73204
|
-
|
|
73205
|
-
|
|
73206
|
-
|
|
73556
|
+
compiled = compileNeoScriptBodyOrThrow(
|
|
73557
|
+
() => compileNSSetter(source, {
|
|
73558
|
+
project: document.project,
|
|
73559
|
+
members: document.members,
|
|
73560
|
+
classes: document.classes,
|
|
73561
|
+
enums: document.enums,
|
|
73562
|
+
interfaces: document.interfaces,
|
|
73563
|
+
thisClass,
|
|
73564
|
+
valueTypeInfo: resolveScriptPropertyReturnTypeInfo(
|
|
73565
|
+
setterMember,
|
|
73566
|
+
document.members
|
|
73567
|
+
)
|
|
73568
|
+
}),
|
|
73569
|
+
bodySite("setter"),
|
|
73570
|
+
null
|
|
73571
|
+
);
|
|
73572
|
+
} else if (command === "apply" || options.mode === "action") {
|
|
73573
|
+
compiled = compileNeoScriptBodyOrThrow(
|
|
73574
|
+
() => compileNSAction(source, compileContext),
|
|
73575
|
+
bodySite("action"),
|
|
73576
|
+
null
|
|
73577
|
+
);
|
|
73207
73578
|
} else {
|
|
73208
|
-
compiled =
|
|
73579
|
+
compiled = compileNeoScriptBodyOrThrow(
|
|
73580
|
+
() => compileNSGetter(source, compileContext),
|
|
73581
|
+
bodySite("getter"),
|
|
73582
|
+
null
|
|
73583
|
+
);
|
|
73209
73584
|
}
|
|
73210
73585
|
} catch (error) {
|
|
73211
|
-
if (error instanceof
|
|
73586
|
+
if (error instanceof NeoScriptBodyCompileError) {
|
|
73212
73587
|
const report2 = {
|
|
73213
73588
|
ok: false,
|
|
73214
73589
|
error: error.message,
|
|
@@ -73220,7 +73595,7 @@ async function runScript(workspace, command, options, dependencies = {}) {
|
|
|
73220
73595
|
};
|
|
73221
73596
|
const hint = options.returns === null && error.message.includes("not assignable to declared return type") ? '\n(eval defaults to an unknown return type \u2014 pass --returns, e.g. --returns "string[]")' : "";
|
|
73222
73597
|
console.log(
|
|
73223
|
-
options.json ? JSON.stringify(report2, null, 2) : `Compile error
|
|
73598
|
+
options.json ? JSON.stringify(report2, null, 2) : `Compile error \u2014 ${error.message}${hint}`
|
|
73224
73599
|
);
|
|
73225
73600
|
process.exitCode = 1;
|
|
73226
73601
|
return;
|
|
@@ -74079,6 +74454,7 @@ var init_script = __esm({
|
|
|
74079
74454
|
init_workspace_status();
|
|
74080
74455
|
init_source_diagnostics();
|
|
74081
74456
|
init_project_documents();
|
|
74457
|
+
init_push_body_diagnostics();
|
|
74082
74458
|
RETURN_SHORTHANDS = {
|
|
74083
74459
|
// MemberKind numerics: Bool=1, Int=2, String=3, Float=4.
|
|
74084
74460
|
bool: { type: 1, required: true },
|
|
@@ -74100,8 +74476,8 @@ __export(migrate_exports, {
|
|
|
74100
74476
|
runMigrate: () => runMigrate
|
|
74101
74477
|
});
|
|
74102
74478
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
74103
|
-
import { existsSync as
|
|
74104
|
-
import { join as
|
|
74479
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync9, readdirSync as readdirSync5, writeFileSync as writeFileSync9 } from "node:fs";
|
|
74480
|
+
import { join as join13 } from "node:path";
|
|
74105
74481
|
async function runMigrate(workspace, subcommand, positional, targetRef, json, dependencies = {}) {
|
|
74106
74482
|
if (subcommand === "new") {
|
|
74107
74483
|
const name = positional[0];
|
|
@@ -74110,10 +74486,10 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
74110
74486
|
"Usage: neo migrate new <name> [--target <ClassName|project>]"
|
|
74111
74487
|
);
|
|
74112
74488
|
}
|
|
74113
|
-
const migrationsDir =
|
|
74489
|
+
const migrationsDir = join13(workspace.root, "Migrations");
|
|
74114
74490
|
mkdirSync9(migrationsDir, { recursive: true });
|
|
74115
74491
|
let nextOrder = 1;
|
|
74116
|
-
if (
|
|
74492
|
+
if (existsSync12(migrationsDir)) {
|
|
74117
74493
|
for (const entry of readdirSync5(migrationsDir)) {
|
|
74118
74494
|
const match = /^(\d+)-/.exec(entry);
|
|
74119
74495
|
if (match !== null) {
|
|
@@ -74122,8 +74498,8 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
74122
74498
|
}
|
|
74123
74499
|
}
|
|
74124
74500
|
const relPath = migrationFileName(nextOrder, name);
|
|
74125
|
-
const absolute =
|
|
74126
|
-
if (
|
|
74501
|
+
const absolute = join13(workspace.root, relPath);
|
|
74502
|
+
if (existsSync12(absolute)) {
|
|
74127
74503
|
throw new Error(`"${relPath}" already exists.`);
|
|
74128
74504
|
}
|
|
74129
74505
|
const target = targetRef ?? "project";
|
|
@@ -74170,12 +74546,17 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
74170
74546
|
assertMigrationCheckWorkspaceIsValid(status);
|
|
74171
74547
|
const candidate = localMigrationCheckCandidate(status);
|
|
74172
74548
|
const compileAction = dependencies.compileAction ?? compileNSAction;
|
|
74549
|
+
const bodySourceLocator = createNeoScriptBodySourceLocator(
|
|
74550
|
+
workspace,
|
|
74551
|
+
status
|
|
74552
|
+
);
|
|
74173
74553
|
let failures = 0;
|
|
74174
74554
|
const results = [];
|
|
74175
|
-
for (const { data: migration, file } of candidate.migrations) {
|
|
74555
|
+
for (const { data: migration, file, recordId } of candidate.migrations) {
|
|
74176
74556
|
if (typeof migration.code !== "string" || migration.code.trim().length === 0) {
|
|
74177
74557
|
continue;
|
|
74178
74558
|
}
|
|
74559
|
+
const code = migration.code;
|
|
74179
74560
|
const thisClass = typeof migration.targetClassId === "string" ? candidate.classes.find(
|
|
74180
74561
|
(schemaClass2) => schemaClass2.id === migration.targetClassId
|
|
74181
74562
|
) ?? null : null;
|
|
@@ -74185,16 +74566,27 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
74185
74566
|
`Migration targets unknown local class "${migration.targetClassId}". Fix its @target directive or restore the class declaration.`
|
|
74186
74567
|
);
|
|
74187
74568
|
}
|
|
74188
|
-
|
|
74189
|
-
|
|
74190
|
-
|
|
74191
|
-
|
|
74192
|
-
|
|
74193
|
-
|
|
74194
|
-
|
|
74195
|
-
|
|
74196
|
-
|
|
74197
|
-
|
|
74569
|
+
compileNeoScriptBodyOrThrow(
|
|
74570
|
+
() => compileAction(code, {
|
|
74571
|
+
project: raw.project,
|
|
74572
|
+
members: candidate.members,
|
|
74573
|
+
classes: candidate.classes,
|
|
74574
|
+
enums: candidate.enums,
|
|
74575
|
+
interfaces: candidate.interfaces,
|
|
74576
|
+
thisClass,
|
|
74577
|
+
dialogueContext: null,
|
|
74578
|
+
migrationContext: true
|
|
74579
|
+
}),
|
|
74580
|
+
{
|
|
74581
|
+
recordKind: "migration",
|
|
74582
|
+
recordId,
|
|
74583
|
+
ownerName: migrationTargetClassName(thisClass),
|
|
74584
|
+
memberName: String(migration.name ?? recordId),
|
|
74585
|
+
unit: "migration",
|
|
74586
|
+
code
|
|
74587
|
+
},
|
|
74588
|
+
bodySourceLocator
|
|
74589
|
+
);
|
|
74198
74590
|
results.push({
|
|
74199
74591
|
id: migration.id,
|
|
74200
74592
|
name: migration.name,
|
|
@@ -74203,7 +74595,7 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
74203
74595
|
});
|
|
74204
74596
|
} catch (error) {
|
|
74205
74597
|
failures += 1;
|
|
74206
|
-
const message = error instanceof
|
|
74598
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
74207
74599
|
results.push({
|
|
74208
74600
|
id: migration.id,
|
|
74209
74601
|
name: migration.name,
|
|
@@ -74305,7 +74697,11 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
|
|
|
74305
74697
|
}
|
|
74306
74698
|
function localMigrationCheckCandidate(status) {
|
|
74307
74699
|
const byKind = (kind) => [...status.reconstructed.values()].filter((record3) => record3.recordKind === kind).map((record3) => record3.fullData);
|
|
74308
|
-
const migrations = [...status.reconstructed.values()].filter((record3) => record3.recordKind === "migration").map((record3) => ({
|
|
74700
|
+
const migrations = [...status.reconstructed.values()].filter((record3) => record3.recordKind === "migration").map((record3) => ({
|
|
74701
|
+
data: record3.fullData,
|
|
74702
|
+
file: record3.file,
|
|
74703
|
+
recordId: record3.recordId
|
|
74704
|
+
})).sort(
|
|
74309
74705
|
(left, right) => Number(left.data.order ?? 0) - Number(right.data.order ?? 0)
|
|
74310
74706
|
);
|
|
74311
74707
|
return {
|
|
@@ -74493,6 +74889,11 @@ function resolveAssignTarget(write, instanceValue, migrationName) {
|
|
|
74493
74889
|
}
|
|
74494
74890
|
return { childKey };
|
|
74495
74891
|
}
|
|
74892
|
+
function migrationTargetClassName(thisClass) {
|
|
74893
|
+
if (thisClass === null) return null;
|
|
74894
|
+
if (typeof thisClass.name !== "string") return null;
|
|
74895
|
+
return thisClass.name;
|
|
74896
|
+
}
|
|
74496
74897
|
async function runPendingMigrations(workspace, client, raw, migrations, onlyRef, dryRunFlagUnused) {
|
|
74497
74898
|
void dryRunFlagUnused;
|
|
74498
74899
|
const dryRun = process.argv.includes("--dry-run");
|
|
@@ -74553,16 +74954,28 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
|
|
|
74553
74954
|
);
|
|
74554
74955
|
}
|
|
74555
74956
|
const pinned = migration.action;
|
|
74556
|
-
const
|
|
74557
|
-
|
|
74558
|
-
|
|
74559
|
-
|
|
74560
|
-
|
|
74561
|
-
|
|
74562
|
-
|
|
74563
|
-
|
|
74564
|
-
|
|
74565
|
-
|
|
74957
|
+
const migrationCode = migration.code;
|
|
74958
|
+
const compiled = pinned !== void 0 && pinned !== null ? pinned : compileNeoScriptBodyOrThrow(
|
|
74959
|
+
() => compileNSAction(migrationCode, {
|
|
74960
|
+
project: document.project,
|
|
74961
|
+
members: document.members,
|
|
74962
|
+
classes: document.classes,
|
|
74963
|
+
enums: document.enums,
|
|
74964
|
+
interfaces: document.interfaces,
|
|
74965
|
+
thisClass,
|
|
74966
|
+
dialogueContext: null,
|
|
74967
|
+
migrationContext: true
|
|
74968
|
+
}),
|
|
74969
|
+
{
|
|
74970
|
+
recordKind: "migration",
|
|
74971
|
+
recordId: String(migration.id),
|
|
74972
|
+
ownerName: migrationTargetClassName(thisClass),
|
|
74973
|
+
memberName: migrationName,
|
|
74974
|
+
unit: "migration",
|
|
74975
|
+
code: migrationCode
|
|
74976
|
+
},
|
|
74977
|
+
null
|
|
74978
|
+
);
|
|
74566
74979
|
const instances = targetClassId === null ? [null] : collectClassInstances(document, targetClassId, memberById, valueById);
|
|
74567
74980
|
let instanceEditCount = 0;
|
|
74568
74981
|
for (const instance of instances) {
|
|
@@ -75109,6 +75522,7 @@ var init_migrate = __esm({
|
|
|
75109
75522
|
init_workspace_status();
|
|
75110
75523
|
init_source_diagnostics();
|
|
75111
75524
|
init_compiler_adapter();
|
|
75525
|
+
init_push_body_diagnostics();
|
|
75112
75526
|
init_neoscript_evaluator();
|
|
75113
75527
|
init_script();
|
|
75114
75528
|
init_project_migration_created_values();
|
|
@@ -76525,7 +76939,7 @@ __export(content_exports, {
|
|
|
76525
76939
|
runRecords: () => runRecords,
|
|
76526
76940
|
runValues: () => runValues
|
|
76527
76941
|
});
|
|
76528
|
-
import { readFileSync as
|
|
76942
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
76529
76943
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
76530
76944
|
function versionPath(workspace, suffix) {
|
|
76531
76945
|
return `/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/${suffix}`;
|
|
@@ -76533,9 +76947,9 @@ function versionPath(workspace, suffix) {
|
|
|
76533
76947
|
function readBatch(file) {
|
|
76534
76948
|
let raw = null;
|
|
76535
76949
|
if (file !== null) {
|
|
76536
|
-
raw =
|
|
76950
|
+
raw = readFileSync12(file, "utf8");
|
|
76537
76951
|
} else if (!process.stdin.isTTY) {
|
|
76538
|
-
raw =
|
|
76952
|
+
raw = readFileSync12(0, "utf8");
|
|
76539
76953
|
if (raw.trim().length === 0) raw = null;
|
|
76540
76954
|
}
|
|
76541
76955
|
if (raw === null) return null;
|
|
@@ -77692,7 +78106,7 @@ async function runFiles(context, subcommand, positional) {
|
|
|
77692
78106
|
"Usage: neo files texture-settings <fileId> --file <settings.json>"
|
|
77693
78107
|
);
|
|
77694
78108
|
}
|
|
77695
|
-
const payload = JSON.parse(
|
|
78109
|
+
const payload = JSON.parse(readFileSync12(payloadPath, "utf8"));
|
|
77696
78110
|
const result = await context.client.post(
|
|
77697
78111
|
versionPath(context.workspace, `files/${fileId}/unity-texture-settings`),
|
|
77698
78112
|
payload
|
|
@@ -77721,7 +78135,7 @@ __export(export_exports, {
|
|
|
77721
78135
|
runExportUnity: () => runExportUnity
|
|
77722
78136
|
});
|
|
77723
78137
|
import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync10 } from "node:fs";
|
|
77724
|
-
import { join as
|
|
78138
|
+
import { join as join14 } from "node:path";
|
|
77725
78139
|
async function runExportUnity(workspace, outDir) {
|
|
77726
78140
|
if (outDir === null) {
|
|
77727
78141
|
throw new Error(
|
|
@@ -77733,23 +78147,23 @@ async function runExportUnity(workspace, outDir) {
|
|
|
77733
78147
|
`/api/projects/${workspace.config.projectId}/export`,
|
|
77734
78148
|
{ versionId: workspace.config.versionId }
|
|
77735
78149
|
);
|
|
77736
|
-
const resourcesDir =
|
|
77737
|
-
const localizationDir =
|
|
77738
|
-
const scriptsDir =
|
|
78150
|
+
const resourcesDir = join14(outDir, "Resources", "Neo");
|
|
78151
|
+
const localizationDir = join14(resourcesDir, "Localization");
|
|
78152
|
+
const scriptsDir = join14(outDir, "Scripts", "Neo");
|
|
77739
78153
|
mkdirSync10(localizationDir, { recursive: true });
|
|
77740
78154
|
mkdirSync10(scriptsDir, { recursive: true });
|
|
77741
|
-
writeFileSync10(
|
|
78155
|
+
writeFileSync10(join14(resourcesDir, "project.json"), response.projectJson);
|
|
77742
78156
|
writeFileSync10(
|
|
77743
|
-
|
|
78157
|
+
join14(scriptsDir, "NeoGeneratedTypes.cs"),
|
|
77744
78158
|
response.generatedTypes
|
|
77745
78159
|
);
|
|
77746
78160
|
for (const file of response.localizationFiles ?? []) {
|
|
77747
|
-
writeFileSync10(
|
|
78161
|
+
writeFileSync10(join14(localizationDir, file.fileName), file.content);
|
|
77748
78162
|
}
|
|
77749
|
-
console.log(`wrote ${
|
|
77750
|
-
console.log(`wrote ${
|
|
78163
|
+
console.log(`wrote ${join14(resourcesDir, "project.json")}`);
|
|
78164
|
+
console.log(`wrote ${join14(scriptsDir, "NeoGeneratedTypes.cs")}`);
|
|
77751
78165
|
for (const file of response.localizationFiles ?? []) {
|
|
77752
|
-
console.log(`wrote ${
|
|
78166
|
+
console.log(`wrote ${join14(localizationDir, file.fileName)}`);
|
|
77753
78167
|
}
|
|
77754
78168
|
const diagnostics = response.diagnostics ?? [];
|
|
77755
78169
|
for (const diagnostic of diagnostics) {
|
|
@@ -77895,8 +78309,8 @@ var init_project_source_bundle = __esm({
|
|
|
77895
78309
|
});
|
|
77896
78310
|
|
|
77897
78311
|
// src/project-source/project-file-push.ts
|
|
77898
|
-
import { basename as basename2, join as
|
|
77899
|
-
import { readFileSync as
|
|
78312
|
+
import { basename as basename2, join as join15 } from "node:path";
|
|
78313
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
77900
78314
|
function ensureProjectFileBinaryChangesV4(args) {
|
|
77901
78315
|
for (const binary of args.binaryChanges) {
|
|
77902
78316
|
if (binary.action !== "upload") continue;
|
|
@@ -77941,8 +78355,8 @@ function prepareProjectFilePushesV4(args) {
|
|
|
77941
78355
|
`Project file ${recordId} has upload bytes but its source change has no record data.`
|
|
77942
78356
|
);
|
|
77943
78357
|
}
|
|
77944
|
-
const absolute =
|
|
77945
|
-
const bytes = new Uint8Array(
|
|
78358
|
+
const absolute = join15(args.workspace.root, binary.path);
|
|
78359
|
+
const bytes = new Uint8Array(readFileSync13(absolute));
|
|
77946
78360
|
const digest = sha256Bytes(bytes);
|
|
77947
78361
|
if (binary.localSha256 !== null && digest !== binary.localSha256) {
|
|
77948
78362
|
throw new Error(
|
|
@@ -78274,9 +78688,9 @@ var init_project_file_push = __esm({
|
|
|
78274
78688
|
// src/project-source/trusted-commit-verification.ts
|
|
78275
78689
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
78276
78690
|
import { tmpdir } from "node:os";
|
|
78277
|
-
import { join as
|
|
78691
|
+
import { join as join16 } from "node:path";
|
|
78278
78692
|
function verifyProjectSourceCommitAgainstStateV4(args) {
|
|
78279
|
-
const root =
|
|
78693
|
+
const root = join16(tmpdir(), `neo-source-verify-virtual-${randomUUID5()}`);
|
|
78280
78694
|
const workspace = {
|
|
78281
78695
|
root,
|
|
78282
78696
|
config: {
|
|
@@ -78763,10 +79177,10 @@ import {
|
|
|
78763
79177
|
mkdirSync as mkdirSync11,
|
|
78764
79178
|
writeFileSync as writeFileSync11,
|
|
78765
79179
|
rmSync as rmSync6,
|
|
78766
|
-
existsSync as
|
|
78767
|
-
readFileSync as
|
|
79180
|
+
existsSync as existsSync13,
|
|
79181
|
+
readFileSync as readFileSync14
|
|
78768
79182
|
} from "node:fs";
|
|
78769
|
-
import { dirname as dirname7, join as
|
|
79183
|
+
import { dirname as dirname7, join as join17, relative as relative5, sep as sep5 } from "node:path";
|
|
78770
79184
|
function assignPendingIds(changes, staticValueSeeds, reconstructed3) {
|
|
78771
79185
|
const assigned = /* @__PURE__ */ new Map();
|
|
78772
79186
|
const assign = (pendingId2) => {
|
|
@@ -79331,9 +79745,11 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
79331
79745
|
(change) => change.recordKind === "member" || change.recordKind === "class" || change.recordKind === "enum" || change.recordKind === "interface" || change.nextData !== void 0 && change.recordKind === "migration" && typeof change.nextData.code === "string" && change.nextData.code.trim().length > 0
|
|
79332
79746
|
);
|
|
79333
79747
|
const compileSchema = needsNeoScriptCompilation ? await buildPostPushCompileSchema(workspace, status) : null;
|
|
79748
|
+
const bodySourceLocator = createNeoScriptBodySourceLocator(workspace, status);
|
|
79334
79749
|
if (compileSchema !== null) {
|
|
79335
79750
|
prepareCompleteNeoScriptBodyChanges(workspace, status, compileSchema, {
|
|
79336
|
-
completeSweep: workspaceChangesRequireCompleteBodySweep(status.changes)
|
|
79751
|
+
completeSweep: workspaceChangesRequireCompleteBodySweep(status.changes),
|
|
79752
|
+
bodySourceLocator
|
|
79337
79753
|
});
|
|
79338
79754
|
}
|
|
79339
79755
|
const now = Date.now();
|
|
@@ -79342,19 +79758,25 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
79342
79758
|
if (change.recordKind === "migration" && typeof change.nextData.code === "string" && change.nextData.code.trim().length > 0) {
|
|
79343
79759
|
change.nextData = {
|
|
79344
79760
|
...change.nextData,
|
|
79345
|
-
action: compileMigrationAction(
|
|
79761
|
+
action: compileMigrationAction(
|
|
79762
|
+
compileSchema,
|
|
79763
|
+
change.nextData,
|
|
79764
|
+
bodySourceLocator
|
|
79765
|
+
)
|
|
79346
79766
|
};
|
|
79347
79767
|
}
|
|
79348
79768
|
if (change.recordKind === "member" && change.nextData.kind === 10) {
|
|
79349
79769
|
change.nextData = compileNSPropertyChange(
|
|
79350
79770
|
compileSchema,
|
|
79351
|
-
change.nextData
|
|
79771
|
+
change.nextData,
|
|
79772
|
+
bodySourceLocator
|
|
79352
79773
|
);
|
|
79353
79774
|
}
|
|
79354
79775
|
if (change.recordKind === "member" && change.nextData.kind === 23) {
|
|
79355
79776
|
change.nextData = compileNSFunctionChange(
|
|
79356
79777
|
compileSchema,
|
|
79357
|
-
change.nextData
|
|
79778
|
+
change.nextData,
|
|
79779
|
+
bodySourceLocator
|
|
79358
79780
|
);
|
|
79359
79781
|
}
|
|
79360
79782
|
if (change.kind === "create") {
|
|
@@ -80269,13 +80691,13 @@ ${finalErrors.map(
|
|
|
80269
80691
|
for (const recordState of Object.values(workspace.state.records)) {
|
|
80270
80692
|
const previousPath = recordState.file;
|
|
80271
80693
|
if (previousPath === void 0 || emittedPaths.has(previousPath)) continue;
|
|
80272
|
-
const absolute =
|
|
80273
|
-
if (
|
|
80694
|
+
const absolute = join17(workspace.root, previousPath);
|
|
80695
|
+
if (existsSync13(absolute)) rmSync6(absolute);
|
|
80274
80696
|
}
|
|
80275
80697
|
for (const file of files) {
|
|
80276
|
-
const absolute =
|
|
80698
|
+
const absolute = join17(workspace.root, file.path);
|
|
80277
80699
|
mkdirSync11(dirname7(absolute), { recursive: true });
|
|
80278
|
-
const existing =
|
|
80700
|
+
const existing = existsSync13(absolute) ? readFileSync14(absolute, "utf8") : null;
|
|
80279
80701
|
if (existing !== file.content)
|
|
80280
80702
|
writeFileSync11(absolute, file.content, "utf8");
|
|
80281
80703
|
}
|
|
@@ -80312,7 +80734,7 @@ function materializeAssignedSchemaIdsInAuthoredSource(workspace, replacements) {
|
|
|
80312
80734
|
return {
|
|
80313
80735
|
uri,
|
|
80314
80736
|
kind,
|
|
80315
|
-
text:
|
|
80737
|
+
text: readFileSync14(absolutePath, "utf8")
|
|
80316
80738
|
};
|
|
80317
80739
|
}
|
|
80318
80740
|
);
|
|
@@ -80502,72 +80924,107 @@ function containingClass(schema, memberId) {
|
|
|
80502
80924
|
return isObjectRecord2(classSchema) && Object.values(classSchema).includes(memberId);
|
|
80503
80925
|
}) ?? null;
|
|
80504
80926
|
}
|
|
80505
|
-
function
|
|
80927
|
+
function bodyOwnerName(thisClass) {
|
|
80928
|
+
if (thisClass === null) return null;
|
|
80929
|
+
if (typeof thisClass.name !== "string") return null;
|
|
80930
|
+
return thisClass.name;
|
|
80931
|
+
}
|
|
80932
|
+
function compileNSPropertyChange(schema, memberData, locator) {
|
|
80506
80933
|
const memberId = memberData.id;
|
|
80507
80934
|
const thisClass = containingClass(schema, memberId);
|
|
80508
80935
|
const returnTypeInfo = resolveNSPropertyReturnTypeInfo(
|
|
80509
80936
|
memberData,
|
|
80510
80937
|
schema.members
|
|
80511
80938
|
);
|
|
80939
|
+
const bodyIdentity = {
|
|
80940
|
+
recordKind: "member",
|
|
80941
|
+
recordId: String(memberId),
|
|
80942
|
+
ownerName: bodyOwnerName(thisClass),
|
|
80943
|
+
memberName: String(memberData.name ?? memberId)
|
|
80944
|
+
};
|
|
80512
80945
|
const next = { ...memberData };
|
|
80513
80946
|
if (typeof memberData.code === "string") {
|
|
80514
|
-
|
|
80515
|
-
|
|
80516
|
-
|
|
80517
|
-
|
|
80518
|
-
|
|
80519
|
-
|
|
80520
|
-
|
|
80521
|
-
|
|
80522
|
-
|
|
80523
|
-
|
|
80524
|
-
|
|
80525
|
-
|
|
80947
|
+
const code = memberData.code;
|
|
80948
|
+
next.getter = compileNeoScriptBodyOrThrow(
|
|
80949
|
+
() => compileNSGetter2(code, {
|
|
80950
|
+
project: schema.project,
|
|
80951
|
+
members: schema.members,
|
|
80952
|
+
classes: schema.classes,
|
|
80953
|
+
enums: schema.enums,
|
|
80954
|
+
interfaces: schema.interfaces,
|
|
80955
|
+
thisClass,
|
|
80956
|
+
returnTypeInfo,
|
|
80957
|
+
dialogueContext: null,
|
|
80958
|
+
implicitMemberAccess: true,
|
|
80959
|
+
staticMember: memberData.isStatic === true
|
|
80960
|
+
}),
|
|
80961
|
+
{ ...bodyIdentity, unit: "getter", code },
|
|
80962
|
+
locator
|
|
80963
|
+
);
|
|
80526
80964
|
} else {
|
|
80527
80965
|
delete next.getter;
|
|
80528
80966
|
}
|
|
80529
80967
|
if (typeof memberData.setterCode === "string") {
|
|
80530
|
-
|
|
80531
|
-
|
|
80532
|
-
|
|
80533
|
-
|
|
80534
|
-
|
|
80535
|
-
|
|
80536
|
-
|
|
80537
|
-
|
|
80538
|
-
|
|
80539
|
-
|
|
80540
|
-
|
|
80968
|
+
const setterCode = memberData.setterCode;
|
|
80969
|
+
next.setter = compileNeoScriptBodyOrThrow(
|
|
80970
|
+
() => compileNSSetter2(setterCode, {
|
|
80971
|
+
project: schema.project,
|
|
80972
|
+
members: schema.members,
|
|
80973
|
+
classes: schema.classes,
|
|
80974
|
+
enums: schema.enums,
|
|
80975
|
+
interfaces: schema.interfaces,
|
|
80976
|
+
thisClass,
|
|
80977
|
+
valueTypeInfo: returnTypeInfo,
|
|
80978
|
+
implicitMemberAccess: true,
|
|
80979
|
+
staticMember: memberData.isStatic === true
|
|
80980
|
+
}),
|
|
80981
|
+
{ ...bodyIdentity, unit: "setter", code: setterCode },
|
|
80982
|
+
locator
|
|
80983
|
+
);
|
|
80541
80984
|
} else {
|
|
80542
80985
|
delete next.setter;
|
|
80543
80986
|
}
|
|
80544
80987
|
return next;
|
|
80545
80988
|
}
|
|
80546
|
-
function compileNSFunctionChange(schema, memberData) {
|
|
80989
|
+
function compileNSFunctionChange(schema, memberData, locator) {
|
|
80547
80990
|
const next = { ...memberData };
|
|
80548
80991
|
if (typeof memberData.code !== "string") {
|
|
80549
80992
|
delete next.action;
|
|
80550
80993
|
return next;
|
|
80551
80994
|
}
|
|
80995
|
+
const code = memberData.code;
|
|
80552
80996
|
const contract = resolveNSFunctionContract(memberData, schema.members);
|
|
80553
|
-
|
|
80554
|
-
|
|
80555
|
-
|
|
80556
|
-
|
|
80557
|
-
|
|
80558
|
-
|
|
80559
|
-
|
|
80560
|
-
|
|
80561
|
-
|
|
80562
|
-
|
|
80563
|
-
|
|
80564
|
-
|
|
80565
|
-
|
|
80566
|
-
|
|
80997
|
+
const thisClass = containingClass(schema, memberData.id);
|
|
80998
|
+
next.action = compileNeoScriptBodyOrThrow(
|
|
80999
|
+
() => compileNSFunction2(code, {
|
|
81000
|
+
project: schema.project,
|
|
81001
|
+
members: schema.members,
|
|
81002
|
+
classes: schema.classes,
|
|
81003
|
+
enums: schema.enums,
|
|
81004
|
+
interfaces: schema.interfaces,
|
|
81005
|
+
thisClass,
|
|
81006
|
+
returnTypeInfo: contract.returnTypeInfo,
|
|
81007
|
+
argumentTypes: contract.argumentTypes,
|
|
81008
|
+
deferred: contract.deferred,
|
|
81009
|
+
functionName: String(memberData.name ?? memberData.id),
|
|
81010
|
+
implicitMemberAccess: true,
|
|
81011
|
+
staticMember: memberData.isStatic === true
|
|
81012
|
+
}),
|
|
81013
|
+
{
|
|
81014
|
+
recordKind: "member",
|
|
81015
|
+
recordId: String(memberData.id),
|
|
81016
|
+
ownerName: bodyOwnerName(thisClass),
|
|
81017
|
+
memberName: String(memberData.name ?? memberData.id),
|
|
81018
|
+
unit: "function",
|
|
81019
|
+
code
|
|
81020
|
+
},
|
|
81021
|
+
locator
|
|
81022
|
+
);
|
|
80567
81023
|
return next;
|
|
80568
81024
|
}
|
|
80569
81025
|
function prepareCompleteNeoScriptBodyChanges(workspace, status, schema, options = {}) {
|
|
80570
81026
|
const completeSweep = options.completeSweep ?? true;
|
|
81027
|
+
const locator = options.bodySourceLocator ?? createNeoScriptBodySourceLocator(workspace, status);
|
|
80571
81028
|
const changesById = new Map(
|
|
80572
81029
|
status.changes.filter((change) => change.recordKind === "member").map((change) => [change.recordId, change])
|
|
80573
81030
|
);
|
|
@@ -80577,10 +81034,10 @@ function prepareCompleteNeoScriptBodyChanges(workspace, status, schema, options
|
|
|
80577
81034
|
return member;
|
|
80578
81035
|
}
|
|
80579
81036
|
if (member.kind === 10) {
|
|
80580
|
-
return compileNSPropertyChange(schema, member);
|
|
81037
|
+
return compileNSPropertyChange(schema, member, locator);
|
|
80581
81038
|
}
|
|
80582
81039
|
if (member.kind === 23) {
|
|
80583
|
-
return compileNSFunctionChange(schema, member);
|
|
81040
|
+
return compileNSFunctionChange(schema, member, locator);
|
|
80584
81041
|
}
|
|
80585
81042
|
return member;
|
|
80586
81043
|
});
|
|
@@ -80919,21 +81376,33 @@ function resolveNSFunctionContract(member, members) {
|
|
|
80919
81376
|
}
|
|
80920
81377
|
return { returnTypeInfo, argumentTypes, deferred };
|
|
80921
81378
|
}
|
|
80922
|
-
function compileMigrationAction(schema, migrationData) {
|
|
81379
|
+
function compileMigrationAction(schema, migrationData, locator) {
|
|
80923
81380
|
const targetClassId = migrationData.targetClassId;
|
|
80924
81381
|
const thisClass = typeof targetClassId === "string" ? schema.classes.find(
|
|
80925
81382
|
(schemaClass2) => schemaClass2.id === targetClassId
|
|
80926
81383
|
) ?? null : null;
|
|
80927
|
-
|
|
80928
|
-
|
|
80929
|
-
|
|
80930
|
-
|
|
80931
|
-
|
|
80932
|
-
|
|
80933
|
-
|
|
80934
|
-
|
|
80935
|
-
|
|
80936
|
-
|
|
81384
|
+
const code = String(migrationData.code);
|
|
81385
|
+
return compileNeoScriptBodyOrThrow(
|
|
81386
|
+
() => compileNSAction2(code, {
|
|
81387
|
+
project: schema.project,
|
|
81388
|
+
members: schema.members,
|
|
81389
|
+
classes: schema.classes,
|
|
81390
|
+
enums: schema.enums,
|
|
81391
|
+
interfaces: schema.interfaces,
|
|
81392
|
+
thisClass,
|
|
81393
|
+
dialogueContext: null,
|
|
81394
|
+
migrationContext: true
|
|
81395
|
+
}),
|
|
81396
|
+
{
|
|
81397
|
+
recordKind: "migration",
|
|
81398
|
+
recordId: String(migrationData.id),
|
|
81399
|
+
ownerName: bodyOwnerName(thisClass),
|
|
81400
|
+
memberName: String(migrationData.name ?? migrationData.id),
|
|
81401
|
+
unit: "migration",
|
|
81402
|
+
code
|
|
81403
|
+
},
|
|
81404
|
+
locator
|
|
81405
|
+
);
|
|
80937
81406
|
}
|
|
80938
81407
|
var compileNSAction2, compileNSFunction2, compileNSGetter2, compileNSSetter2, ProjectTransactionInterruptedError, ProjectTransactionFailedError, PROJECT_TRANSACTION_POLL_DELAYS_MS;
|
|
80939
81408
|
var init_push = __esm({
|
|
@@ -80962,6 +81431,7 @@ var init_push = __esm({
|
|
|
80962
81431
|
init_project_manifest();
|
|
80963
81432
|
init_merge();
|
|
80964
81433
|
init_push_change_intent();
|
|
81434
|
+
init_push_body_diagnostics();
|
|
80965
81435
|
({ compileNSAction: compileNSAction2, compileNSFunction: compileNSFunction2, compileNSGetter: compileNSGetter2, compileNSSetter: compileNSSetter2 } = compiler_adapter_exports);
|
|
80966
81436
|
ProjectTransactionInterruptedError = class extends Error {
|
|
80967
81437
|
constructor(transactionId) {
|
|
@@ -81000,7 +81470,7 @@ __export(dev_exports, {
|
|
|
81000
81470
|
runDev: () => runDev
|
|
81001
81471
|
});
|
|
81002
81472
|
import { watch } from "node:fs";
|
|
81003
|
-
import { join as
|
|
81473
|
+
import { join as join18 } from "node:path";
|
|
81004
81474
|
import { emitKeypressEvents } from "node:readline";
|
|
81005
81475
|
import { ConvexClient } from "convex/browser";
|
|
81006
81476
|
function isSchemaSignal(value) {
|
|
@@ -81110,7 +81580,7 @@ async function runDev(workspace, options) {
|
|
|
81110
81580
|
};
|
|
81111
81581
|
for (const dir of ["Classes", "Enums"]) {
|
|
81112
81582
|
try {
|
|
81113
|
-
watch(
|
|
81583
|
+
watch(join18(workspace.root, dir), { persistent: true }, onFileChange);
|
|
81114
81584
|
} catch {
|
|
81115
81585
|
}
|
|
81116
81586
|
}
|
|
@@ -81165,12 +81635,12 @@ __export(resolve_exports, {
|
|
|
81165
81635
|
runResolve: () => runResolve,
|
|
81166
81636
|
workspaceFilePath: () => workspaceFilePath
|
|
81167
81637
|
});
|
|
81168
|
-
import { readFileSync as
|
|
81169
|
-
import { join as
|
|
81638
|
+
import { readFileSync as readFileSync15, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
|
|
81639
|
+
import { join as join19 } from "node:path";
|
|
81170
81640
|
function runResolve(workspace, side) {
|
|
81171
81641
|
let resolvedFiles = 0;
|
|
81172
81642
|
for (const filePath of listProjectSourceFilesV4(workspace.root)) {
|
|
81173
|
-
const source =
|
|
81643
|
+
const source = readFileSync15(filePath, "utf8");
|
|
81174
81644
|
if (detectConflictMarkers(source) === null) continue;
|
|
81175
81645
|
const resolved = resolveMarkers(source, side);
|
|
81176
81646
|
writeFileSync12(filePath, resolved, "utf8");
|
|
@@ -81181,12 +81651,12 @@ function runResolve(workspace, side) {
|
|
|
81181
81651
|
const binary = state.projectBinary;
|
|
81182
81652
|
const conflict2 = binary?.conflict;
|
|
81183
81653
|
if (binary === void 0 || conflict2 === void 0) continue;
|
|
81184
|
-
const destination =
|
|
81654
|
+
const destination = join19(workspace.root, binary.path);
|
|
81185
81655
|
if (side === "theirs") {
|
|
81186
81656
|
if (conflict2.remoteSha256 !== null && conflict2.artifactPath !== void 0) {
|
|
81187
81657
|
writeVerifiedBinaryDownloadV4(
|
|
81188
81658
|
destination,
|
|
81189
|
-
|
|
81659
|
+
readFileSync15(join19(workspace.root, conflict2.artifactPath)),
|
|
81190
81660
|
conflict2.remoteSha256
|
|
81191
81661
|
);
|
|
81192
81662
|
binary.sha256 = conflict2.remoteSha256;
|
|
@@ -81196,7 +81666,7 @@ function runResolve(workspace, side) {
|
|
|
81196
81666
|
}
|
|
81197
81667
|
}
|
|
81198
81668
|
if (conflict2.artifactPath !== void 0) {
|
|
81199
|
-
rmSync7(
|
|
81669
|
+
rmSync7(join19(workspace.root, conflict2.artifactPath), { force: true });
|
|
81200
81670
|
}
|
|
81201
81671
|
delete binary.conflict;
|
|
81202
81672
|
resolvedBinaries += 1;
|
|
@@ -81249,7 +81719,7 @@ function resolveMarkers(source, side) {
|
|
|
81249
81719
|
return output.join("\n");
|
|
81250
81720
|
}
|
|
81251
81721
|
function workspaceFilePath(workspace, file) {
|
|
81252
|
-
return
|
|
81722
|
+
return join19(workspace.root, file);
|
|
81253
81723
|
}
|
|
81254
81724
|
var init_resolve = __esm({
|
|
81255
81725
|
"src/commands/resolve.ts"() {
|