@neocompose/cli 0.66.0 → 0.67.1
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/CHANGELOG.md +15 -0
- package/dist/neo.mjs +336 -147
- package/dist/test-worker.mjs +127 -48
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/commands-and-sync.md +8 -6
- package/skills/neocompose-cli/references/neoscript.md +8 -0
package/dist/neo.mjs
CHANGED
|
@@ -16371,7 +16371,7 @@ var NEOSCRIPT_COMPILER_REVISION;
|
|
|
16371
16371
|
var init_strict_ir = __esm({
|
|
16372
16372
|
"../packages/neoscript-language/src/strict-ir.ts"() {
|
|
16373
16373
|
"use strict";
|
|
16374
|
-
NEOSCRIPT_COMPILER_REVISION =
|
|
16374
|
+
NEOSCRIPT_COMPILER_REVISION = 17;
|
|
16375
16375
|
}
|
|
16376
16376
|
});
|
|
16377
16377
|
|
|
@@ -20116,7 +20116,10 @@ var init_strict_resolver = __esm({
|
|
|
20116
20116
|
canonicalDecimal(expression.raw, expression.pos)
|
|
20117
20117
|
);
|
|
20118
20118
|
}
|
|
20119
|
-
return literal(
|
|
20119
|
+
return literal(
|
|
20120
|
+
{ kind: "primitive", name: "float" },
|
|
20121
|
+
Math.fround(expression.value)
|
|
20122
|
+
);
|
|
20120
20123
|
}
|
|
20121
20124
|
case "litString":
|
|
20122
20125
|
return literal({ kind: "primitive", name: "string" }, expression.value);
|
|
@@ -24750,7 +24753,9 @@ var init_strict_resolver = __esm({
|
|
|
24750
24753
|
arithmetic: {
|
|
24751
24754
|
type: operator,
|
|
24752
24755
|
pointers: [left.pointer, right.pointer],
|
|
24753
|
-
...isPrimitive(result, "decimal") ? { decimal: true } : {}
|
|
24756
|
+
...isPrimitive(result, "decimal") ? { decimal: true } : {},
|
|
24757
|
+
...isPrimitive(result, "int") ? { numeric: "int" } : {},
|
|
24758
|
+
...isPrimitive(result, "float") ? { numeric: "float" } : {}
|
|
24754
24759
|
}
|
|
24755
24760
|
}
|
|
24756
24761
|
},
|
|
@@ -30109,7 +30114,7 @@ var init_registry = __esm({
|
|
|
30109
30114
|
"../packages/manifest/schema-contract/registry.mjs"() {
|
|
30110
30115
|
"use strict";
|
|
30111
30116
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
30112
|
-
cliVersion: "0.
|
|
30117
|
+
cliVersion: "0.67.1",
|
|
30113
30118
|
projectFileUploadBatchSize: 32,
|
|
30114
30119
|
documentRecords: {
|
|
30115
30120
|
member: {
|
|
@@ -39430,6 +39435,47 @@ var init_project_manifest = __esm({
|
|
|
39430
39435
|
}
|
|
39431
39436
|
});
|
|
39432
39437
|
|
|
39438
|
+
// ../src/models/members/float32.ts
|
|
39439
|
+
function isFloat32(value) {
|
|
39440
|
+
return typeof value === "number" && Number.isFinite(value) && Math.fround(value) === value;
|
|
39441
|
+
}
|
|
39442
|
+
function unroundedFloatPath(data, path = "") {
|
|
39443
|
+
if (typeof data === "number") {
|
|
39444
|
+
if (Number.isInteger(data)) return null;
|
|
39445
|
+
return isFloat32(data) ? null : path;
|
|
39446
|
+
}
|
|
39447
|
+
if (typeof data !== "object" || data === null) return null;
|
|
39448
|
+
if (Array.isArray(data)) {
|
|
39449
|
+
for (let index = 0; index < data.length; index++) {
|
|
39450
|
+
const found = unroundedFloatPath(data[index], `${path}[${index}]`);
|
|
39451
|
+
if (found !== null) return found;
|
|
39452
|
+
}
|
|
39453
|
+
return null;
|
|
39454
|
+
}
|
|
39455
|
+
for (const [key, value] of Object.entries(data)) {
|
|
39456
|
+
const found = unroundedFloatPath(
|
|
39457
|
+
value,
|
|
39458
|
+
path === "" ? key : `${path}.${key}`
|
|
39459
|
+
);
|
|
39460
|
+
if (found !== null) return found;
|
|
39461
|
+
}
|
|
39462
|
+
return null;
|
|
39463
|
+
}
|
|
39464
|
+
function float32Text(value) {
|
|
39465
|
+
if (Number.isInteger(value)) return String(value);
|
|
39466
|
+
if (Math.fround(value) !== value) return String(value);
|
|
39467
|
+
for (let precision = 1; precision <= 9; precision++) {
|
|
39468
|
+
const text = String(Number(value.toPrecision(precision)));
|
|
39469
|
+
if (Math.fround(Number(text)) === value) return text;
|
|
39470
|
+
}
|
|
39471
|
+
return String(value);
|
|
39472
|
+
}
|
|
39473
|
+
var init_float32 = __esm({
|
|
39474
|
+
"../src/models/members/float32.ts"() {
|
|
39475
|
+
"use strict";
|
|
39476
|
+
}
|
|
39477
|
+
});
|
|
39478
|
+
|
|
39433
39479
|
// src/project-source/source-format.ts
|
|
39434
39480
|
function quoteNeoString(value) {
|
|
39435
39481
|
return JSON.stringify(value);
|
|
@@ -39450,7 +39496,7 @@ function formatNeoNumber(value) {
|
|
|
39450
39496
|
if (!Number.isFinite(value)) {
|
|
39451
39497
|
throw new Error(`Cannot emit non-finite Neo number ${String(value)}.`);
|
|
39452
39498
|
}
|
|
39453
|
-
const source =
|
|
39499
|
+
const source = float32Text(value);
|
|
39454
39500
|
const match = /^(?<sign>-?)(?<integer>\d+)(?:\.(?<fraction>\d+))?[eE](?<exponent>[+-]?\d+)$/u.exec(
|
|
39455
39501
|
source
|
|
39456
39502
|
);
|
|
@@ -39474,6 +39520,7 @@ function invariantCaseKey(value) {
|
|
|
39474
39520
|
var init_source_format = __esm({
|
|
39475
39521
|
"src/project-source/source-format.ts"() {
|
|
39476
39522
|
"use strict";
|
|
39523
|
+
init_float32();
|
|
39477
39524
|
init_machine_strings();
|
|
39478
39525
|
}
|
|
39479
39526
|
});
|
|
@@ -40444,6 +40491,31 @@ function collectNeoScriptCompiledBodyStamps(record6) {
|
|
|
40444
40491
|
visit(record6, "");
|
|
40445
40492
|
return stamps;
|
|
40446
40493
|
}
|
|
40494
|
+
function firstRejectedNeoScriptCompiledBody(node, rollout = ACTIVE_NEOSCRIPT_COMPILER_REVISION_ROLLOUT) {
|
|
40495
|
+
if (Array.isArray(node)) {
|
|
40496
|
+
for (let index = 0; index < node.length; index += 1) {
|
|
40497
|
+
const found = firstRejectedNeoScriptCompiledBody(node[index], rollout);
|
|
40498
|
+
if (found !== null) {
|
|
40499
|
+
return { ...found, path: prefixPath(`[${String(index)}]`, found.path) };
|
|
40500
|
+
}
|
|
40501
|
+
}
|
|
40502
|
+
return null;
|
|
40503
|
+
}
|
|
40504
|
+
if (typeof node !== "object" || node === null) return null;
|
|
40505
|
+
const object2 = node;
|
|
40506
|
+
if (isCompiledBodyShape(object2) && !isAcceptedNeoScriptCompilerRevision(object2.compilerRevision, rollout)) {
|
|
40507
|
+
return { path: "", stamp: object2.compilerRevision };
|
|
40508
|
+
}
|
|
40509
|
+
for (const key of Object.keys(object2)) {
|
|
40510
|
+
const found = firstRejectedNeoScriptCompiledBody(object2[key], rollout);
|
|
40511
|
+
if (found === null) continue;
|
|
40512
|
+
return { ...found, path: prefixPath(key, found.path) };
|
|
40513
|
+
}
|
|
40514
|
+
return null;
|
|
40515
|
+
}
|
|
40516
|
+
function prefixPath(head, rest) {
|
|
40517
|
+
return rest === "" || rest.startsWith("[") ? head + rest : `${head}.${rest}`;
|
|
40518
|
+
}
|
|
40447
40519
|
function isCompiledBodyShape(object2) {
|
|
40448
40520
|
if (!Array.isArray(object2.parameters)) return false;
|
|
40449
40521
|
if (!Array.isArray(object2.instructions)) return false;
|
|
@@ -40701,7 +40773,7 @@ function hasValidParameterDefault(value) {
|
|
|
40701
40773
|
case 2 /* Int */:
|
|
40702
40774
|
return typeof payload === "number" && Number.isInteger(payload);
|
|
40703
40775
|
case 4 /* Float */:
|
|
40704
|
-
return
|
|
40776
|
+
return isFloat32(payload);
|
|
40705
40777
|
case 20 /* Decimal */:
|
|
40706
40778
|
case 3 /* String */:
|
|
40707
40779
|
case 8 /* Enum */:
|
|
@@ -40987,6 +41059,9 @@ function isNSArithmeticOperationInfo(value) {
|
|
|
40987
41059
|
const v = value;
|
|
40988
41060
|
if (typeof v !== "object" || v === null) return false;
|
|
40989
41061
|
if (!isNSArithmeticOperationType(v.type)) return false;
|
|
41062
|
+
if (v.numeric !== void 0 && v.numeric !== "int" && v.numeric !== "float") {
|
|
41063
|
+
return false;
|
|
41064
|
+
}
|
|
40990
41065
|
return isNSPointers(v.pointers);
|
|
40991
41066
|
}
|
|
40992
41067
|
function isNSArithmeticOperation(value) {
|
|
@@ -41557,6 +41632,7 @@ var init_neoscript_guards = __esm({
|
|
|
41557
41632
|
"use strict";
|
|
41558
41633
|
init_neoscript_compiler_revision();
|
|
41559
41634
|
init_member_kind_enum();
|
|
41635
|
+
init_float32();
|
|
41560
41636
|
init_structural_narrow();
|
|
41561
41637
|
init_core_types();
|
|
41562
41638
|
init_neoscript_types();
|
|
@@ -41953,10 +42029,14 @@ function isStructuredLeafFieldValue(type, value) {
|
|
|
41953
42029
|
return typeof value === "string" && value.length > 0;
|
|
41954
42030
|
}
|
|
41955
42031
|
if (typeof value !== "number" || !Number.isFinite(value)) return false;
|
|
41956
|
-
if (type === "float") return
|
|
42032
|
+
if (type === "float") return isFloat32(value);
|
|
41957
42033
|
if (type === "int") return Number.isInteger(value);
|
|
41958
42034
|
if (type === "sliceIndex") return Number.isInteger(value) && value >= 0;
|
|
41959
|
-
return value >= 0 && value <= 1;
|
|
42035
|
+
return isFloat32(value) && value >= 0 && value <= 1;
|
|
42036
|
+
}
|
|
42037
|
+
function storedStructuredLeafFieldNumber(type, value) {
|
|
42038
|
+
const float = type === "float" || type === "unitFloat";
|
|
42039
|
+
return float ? Math.fround(value) : value;
|
|
41960
42040
|
}
|
|
41961
42041
|
function isStructuredLeafPartialValue(value) {
|
|
41962
42042
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -41975,22 +42055,43 @@ function structuredLeafPartialViolation(kind, value, legalKeysLabel) {
|
|
|
41975
42055
|
return `has no field "${key}"; ${legalKeysLabel} accepts ${structuredLeafFieldKeys(kind).join(", ")}`;
|
|
41976
42056
|
}
|
|
41977
42057
|
if (isStructuredLeafFieldValue(field.type, fieldValue)) continue;
|
|
41978
|
-
return `field "${key}" ${structuredLeafFieldViolation(field.type)}`;
|
|
42058
|
+
return `field "${key}" ${structuredLeafFieldViolation(field.type, fieldValue)}`;
|
|
41979
42059
|
}
|
|
41980
42060
|
return null;
|
|
41981
42061
|
}
|
|
41982
|
-
function
|
|
42062
|
+
function structuredLeafRecordFieldViolation(kind, value) {
|
|
42063
|
+
if (typeof value !== "object" || value === null) return null;
|
|
42064
|
+
if (Array.isArray(value)) return null;
|
|
42065
|
+
const entries = Object.entries(value);
|
|
42066
|
+
if (entries.length !== structuredLeafFields(kind).length) return null;
|
|
42067
|
+
let found = null;
|
|
42068
|
+
for (const [key, fieldValue] of entries) {
|
|
42069
|
+
const field = structuredLeafField(kind, key);
|
|
42070
|
+
if (field === null) return null;
|
|
42071
|
+
if (typeof fieldValue !== "number") return null;
|
|
42072
|
+
if (found !== null) continue;
|
|
42073
|
+
if (isStructuredLeafFieldValue(field.type, fieldValue)) continue;
|
|
42074
|
+
found = {
|
|
42075
|
+
key,
|
|
42076
|
+
value: fieldValue,
|
|
42077
|
+
violation: structuredLeafFieldViolation(field.type, fieldValue)
|
|
42078
|
+
};
|
|
42079
|
+
}
|
|
42080
|
+
return found;
|
|
42081
|
+
}
|
|
42082
|
+
function structuredLeafFieldViolation(type, value) {
|
|
41983
42083
|
if (type === "fileId") return "must be a non-empty file id";
|
|
41984
|
-
if (type === "float") return "must be a finite number";
|
|
41985
42084
|
if (type === "int") return "must be a whole number";
|
|
41986
42085
|
if (type === "sliceIndex") return "must be a whole number 0 or greater";
|
|
41987
|
-
return "must be a
|
|
42086
|
+
if (!isFloat32(value)) return "must be a 32-bit float";
|
|
42087
|
+
return "must be between 0 and 1";
|
|
41988
42088
|
}
|
|
41989
42089
|
var STRUCTURED_LEAF_FIELDS, STRUCTURED_LEAF_PARTIAL_KEY;
|
|
41990
42090
|
var init_structured_leaf_fields = __esm({
|
|
41991
42091
|
"../src/models/members/structured-leaf-fields.ts"() {
|
|
41992
42092
|
"use strict";
|
|
41993
42093
|
init_member_kind_enum();
|
|
42094
|
+
init_float32();
|
|
41994
42095
|
STRUCTURED_LEAF_FIELDS = {
|
|
41995
42096
|
[11 /* Sprite */]: [
|
|
41996
42097
|
{ name: "FileId", key: "fileId", type: "fileId" },
|
|
@@ -42143,9 +42244,9 @@ function isMemberString(value) {
|
|
|
42143
42244
|
function isMemberFloatBase(value) {
|
|
42144
42245
|
const v = asMemberBaseForKind(value, 4 /* Float */);
|
|
42145
42246
|
if (v === null) return false;
|
|
42146
|
-
if (v.minValue !== void 0 && v.minValue !== null &&
|
|
42247
|
+
if (v.minValue !== void 0 && v.minValue !== null && !isFloat32(v.minValue))
|
|
42147
42248
|
return false;
|
|
42148
|
-
if (v.maxValue !== void 0 && v.maxValue !== null &&
|
|
42249
|
+
if (v.maxValue !== void 0 && v.maxValue !== null && !isFloat32(v.maxValue))
|
|
42149
42250
|
return false;
|
|
42150
42251
|
return v.decimalPoints === void 0 || v.decimalPoints === null || typeof v.decimalPoints === "number";
|
|
42151
42252
|
}
|
|
@@ -42154,12 +42255,8 @@ function hasExactKeys(value, keys) {
|
|
|
42154
42255
|
if (actual.length !== keys.length) return false;
|
|
42155
42256
|
return keys.every((key) => Object.prototype.hasOwnProperty.call(value, key));
|
|
42156
42257
|
}
|
|
42157
|
-
function isFiniteNumberValue(value) {
|
|
42158
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
42159
|
-
}
|
|
42160
42258
|
function isVectorComponentValue(value, integer3) {
|
|
42161
|
-
if (!
|
|
42162
|
-
if (!integer3) return true;
|
|
42259
|
+
if (!integer3) return isFloat32(value);
|
|
42163
42260
|
return Number.isInteger(value);
|
|
42164
42261
|
}
|
|
42165
42262
|
function isVector2ValueWithComponents(value, integer3) {
|
|
@@ -42193,7 +42290,7 @@ function isVector3IntValue(value) {
|
|
|
42193
42290
|
return isVector3ValueWithComponents(value, true);
|
|
42194
42291
|
}
|
|
42195
42292
|
function isColorComponentValue(value) {
|
|
42196
|
-
if (!
|
|
42293
|
+
if (!isFloat32(value)) return false;
|
|
42197
42294
|
return value >= 0 && value <= 1;
|
|
42198
42295
|
}
|
|
42199
42296
|
function isColorValue(value) {
|
|
@@ -43159,6 +43256,7 @@ var init_member_kinds = __esm({
|
|
|
43159
43256
|
init_structural_narrow();
|
|
43160
43257
|
init_core_types();
|
|
43161
43258
|
init_docs_text2();
|
|
43259
|
+
init_float32();
|
|
43162
43260
|
init_schema_identifiers();
|
|
43163
43261
|
init_neoscript_guards();
|
|
43164
43262
|
init_neoscript_types();
|
|
@@ -49673,6 +49771,8 @@ function structuredLeafPartialMemberViolation(member, value, position) {
|
|
|
49673
49771
|
return structuredLeafPartialViolation(kind, value, MemberKind[kind]);
|
|
49674
49772
|
}
|
|
49675
49773
|
function storedLeafShapeIssueMessage(issue, style) {
|
|
49774
|
+
if (issue.kind === "float") return "must store a 32-bit float.";
|
|
49775
|
+
if (issue.kind === "field") return storedLeafFieldIssueMessage(issue);
|
|
49676
49776
|
if (issue.kind === "sprite" || issue.kind === "audio") {
|
|
49677
49777
|
return `must store a valid ${issue.kind === "sprite" ? "Sprite" : "Audio"} value.`;
|
|
49678
49778
|
}
|
|
@@ -49683,12 +49783,15 @@ function storedLeafShapeIssueMessage(issue, style) {
|
|
|
49683
49783
|
}
|
|
49684
49784
|
return issue.kind === "decimal" ? `${issue.violation}.` : `must store ${issue.kind === "color" ? "color " : ""}${shape}.`;
|
|
49685
49785
|
}
|
|
49786
|
+
function storedLeafFieldIssueMessage(issue) {
|
|
49787
|
+
return `${MemberKind[issue.leaf]} field "${issue.key}" ${issue.violation}, not ${issue.value}.`;
|
|
49788
|
+
}
|
|
49686
49789
|
function storedLeafExpectation(kind) {
|
|
49687
|
-
if (kind === "vector2") return "{ x:
|
|
49790
|
+
if (kind === "vector2") return "{ x: float, y: float }";
|
|
49688
49791
|
if (kind === "vector2Int") return "{ x: integer, y: integer }";
|
|
49689
|
-
if (kind === "vector3") return "{ x:
|
|
49792
|
+
if (kind === "vector3") return "{ x: float, y: float, z: float }";
|
|
49690
49793
|
if (kind === "vector3Int") return "{ x: integer, y: integer, z: integer }";
|
|
49691
|
-
if (kind === "color") return "{ r, g, b, a } in [0, 1]";
|
|
49794
|
+
if (kind === "color") return "{ r, g, b, a } 32-bit floats in [0, 1]";
|
|
49692
49795
|
return "canonical decimal string";
|
|
49693
49796
|
}
|
|
49694
49797
|
function* storedValueChildReferences(args) {
|
|
@@ -49734,16 +49837,19 @@ function* storedValueChildEntries(args) {
|
|
|
49734
49837
|
}
|
|
49735
49838
|
function storedLeafShapeIssue(member, value) {
|
|
49736
49839
|
switch (member.kind) {
|
|
49840
|
+
// Null is an optional Float's absent value.
|
|
49841
|
+
case 4 /* Float */:
|
|
49842
|
+
return value === null || isFloat32(value) ? null : { kind: "float" };
|
|
49737
49843
|
case 14 /* Vector2 */:
|
|
49738
|
-
return isVector2Value(value) ? null :
|
|
49844
|
+
return isVector2Value(value) ? null : leafIssue(member.kind, "vector2", value);
|
|
49739
49845
|
case 15 /* Vector2Int */:
|
|
49740
|
-
return isVector2IntValue(value) ? null :
|
|
49846
|
+
return isVector2IntValue(value) ? null : leafIssue(member.kind, "vector2Int", value);
|
|
49741
49847
|
case 16 /* Vector3 */:
|
|
49742
|
-
return isVector3Value(value) ? null :
|
|
49848
|
+
return isVector3Value(value) ? null : leafIssue(member.kind, "vector3", value);
|
|
49743
49849
|
case 17 /* Vector3Int */:
|
|
49744
|
-
return isVector3IntValue(value) ? null :
|
|
49850
|
+
return isVector3IntValue(value) ? null : leafIssue(member.kind, "vector3Int", value);
|
|
49745
49851
|
case 19 /* Color */:
|
|
49746
|
-
return isColorValue(value) ? null :
|
|
49852
|
+
return isColorValue(value) ? null : leafIssue(member.kind, "color", value);
|
|
49747
49853
|
case 20 /* Decimal */: {
|
|
49748
49854
|
const violation = getDecimalStringViolation(value);
|
|
49749
49855
|
return violation === null ? null : { kind: "decimal", violation };
|
|
@@ -49756,12 +49862,17 @@ function storedLeafShapeIssue(member, value) {
|
|
|
49756
49862
|
return null;
|
|
49757
49863
|
}
|
|
49758
49864
|
}
|
|
49865
|
+
function leafIssue(leaf, shape, value) {
|
|
49866
|
+
const field = structuredLeafRecordFieldViolation(leaf, value);
|
|
49867
|
+
return field === null ? { kind: shape } : { kind: "field", leaf, ...field };
|
|
49868
|
+
}
|
|
49759
49869
|
var ANIMATION_OVERRIDE_GRAPH_MEMBER_IDS;
|
|
49760
49870
|
var init_stored_value_shape = __esm({
|
|
49761
49871
|
"../src/models/members/stored-value-shape.ts"() {
|
|
49762
49872
|
"use strict";
|
|
49763
49873
|
init_world_system_classes();
|
|
49764
49874
|
init_member_kinds();
|
|
49875
|
+
init_float32();
|
|
49765
49876
|
init_structured_leaf_fields();
|
|
49766
49877
|
ANIMATION_OVERRIDE_GRAPH_MEMBER_IDS = /* @__PURE__ */ new Set([
|
|
49767
49878
|
WORLD_ANIMATION_FRAME_OVERRIDES_MEMBER_ID,
|
|
@@ -50846,16 +50957,24 @@ function validateProjectDocumentFileMemberValue(document, member, body, position
|
|
|
50846
50957
|
return;
|
|
50847
50958
|
}
|
|
50848
50959
|
const shapeIssue = storedLeafShapeIssue(member, body.value);
|
|
50960
|
+
if (shapeIssue?.kind === "float") {
|
|
50961
|
+
throw new Error(
|
|
50962
|
+
`Float value for member "${member.name}" must be a 32-bit float, not ${String(body.value)}.`
|
|
50963
|
+
);
|
|
50964
|
+
}
|
|
50965
|
+
if (shapeIssue?.kind === "field") {
|
|
50966
|
+
throw new Error(
|
|
50967
|
+
`Member "${member.name}" ${storedLeafFieldIssueMessage(shapeIssue)}`
|
|
50968
|
+
);
|
|
50969
|
+
}
|
|
50849
50970
|
if (shapeIssue?.kind === "vector2") {
|
|
50850
|
-
throw new Error("Vector2 value must be { x:
|
|
50971
|
+
throw new Error("Vector2 value must be { x: float, y: float }.");
|
|
50851
50972
|
}
|
|
50852
50973
|
if (shapeIssue?.kind === "vector2Int") {
|
|
50853
50974
|
throw new Error("Vector2Int value must be { x: integer, y: integer }.");
|
|
50854
50975
|
}
|
|
50855
50976
|
if (shapeIssue?.kind === "vector3") {
|
|
50856
|
-
throw new Error(
|
|
50857
|
-
"Vector3 value must be { x: number, y: number, z: number }."
|
|
50858
|
-
);
|
|
50977
|
+
throw new Error("Vector3 value must be { x: float, y: float, z: float }.");
|
|
50859
50978
|
}
|
|
50860
50979
|
if (shapeIssue?.kind === "vector3Int") {
|
|
50861
50980
|
throw new Error(
|
|
@@ -50864,7 +50983,7 @@ function validateProjectDocumentFileMemberValue(document, member, body, position
|
|
|
50864
50983
|
}
|
|
50865
50984
|
if (shapeIssue?.kind === "color") {
|
|
50866
50985
|
throw new Error(
|
|
50867
|
-
"Color value must be { r, g, b, a } with each component in [0, 1]."
|
|
50986
|
+
"Color value must be { r, g, b, a } with each component a 32-bit float in [0, 1]."
|
|
50868
50987
|
);
|
|
50869
50988
|
}
|
|
50870
50989
|
if (shapeIssue?.kind === "decimal") {
|
|
@@ -51695,10 +51814,13 @@ function lowerStructuredLeafFieldValue(kind, label, field, expression, lowering)
|
|
|
51695
51814
|
if (field.type === "fileId") {
|
|
51696
51815
|
return lowerStructuredLeafFileId(kind, label, field, expression, lowering);
|
|
51697
51816
|
}
|
|
51698
|
-
const value =
|
|
51817
|
+
const value = storedStructuredLeafFieldNumber(
|
|
51818
|
+
field.type,
|
|
51819
|
+
lowering.number(expression)
|
|
51820
|
+
);
|
|
51699
51821
|
if (isStructuredLeafFieldValue(field.type, value)) return value;
|
|
51700
51822
|
throw new Error(
|
|
51701
|
-
`${label} field ${JSON.stringify(field.name)} ${
|
|
51823
|
+
`${label} field ${JSON.stringify(field.name)} ${structuredLeafFieldViolation(field.type, value)}, not ${value}.`
|
|
51702
51824
|
);
|
|
51703
51825
|
}
|
|
51704
51826
|
function lowerStructuredLeafFileId(kind, label, field, expression, lowering) {
|
|
@@ -51745,10 +51867,13 @@ function lowerStructuredLeafComponents(kind, label, expression, lowering) {
|
|
|
51745
51867
|
if (argument2 === void 0) {
|
|
51746
51868
|
throw new Error(`${label} is missing component ${field.name}.`);
|
|
51747
51869
|
}
|
|
51748
|
-
const component =
|
|
51870
|
+
const component = storedStructuredLeafFieldNumber(
|
|
51871
|
+
field.type,
|
|
51872
|
+
lowering.number(argument2)
|
|
51873
|
+
);
|
|
51749
51874
|
if (!isStructuredLeafFieldValue(field.type, component)) {
|
|
51750
51875
|
throw new Error(
|
|
51751
|
-
`${label} component ${field.name} ${
|
|
51876
|
+
`${label} component ${field.name} ${structuredLeafFieldViolation(field.type, component)}, not ${component}.`
|
|
51752
51877
|
);
|
|
51753
51878
|
}
|
|
51754
51879
|
value[field.key] = component;
|
|
@@ -51778,7 +51903,7 @@ function structuredLeafPartialAssignments(kind, label, value, emit) {
|
|
|
51778
51903
|
function structuredLeafFieldSource(label, field, value, emit) {
|
|
51779
51904
|
if (!isStructuredLeafFieldValue(field.type, value)) {
|
|
51780
51905
|
throw new Error(
|
|
51781
|
-
`${label} stores field ${JSON.stringify(field.name)} as ${JSON.stringify(value)}, which ${
|
|
51906
|
+
`${label} stores field ${JSON.stringify(field.name)} as ${JSON.stringify(value)}, which ${structuredLeafFieldViolation(field.type, value)}.`
|
|
51782
51907
|
);
|
|
51783
51908
|
}
|
|
51784
51909
|
if (typeof value === "string") return emit.fileId(value);
|
|
@@ -51787,13 +51912,6 @@ function structuredLeafFieldSource(label, field, value, emit) {
|
|
|
51787
51912
|
`${label} stores field ${JSON.stringify(field.name)} as ${JSON.stringify(value)}, which is neither a number nor a file id.`
|
|
51788
51913
|
);
|
|
51789
51914
|
}
|
|
51790
|
-
function structuredLeafFieldRequirement(type) {
|
|
51791
|
-
if (type === "fileId") return "must be a non-empty file id";
|
|
51792
|
-
if (type === "float") return "must be a finite number";
|
|
51793
|
-
if (type === "int") return "must be a whole number";
|
|
51794
|
-
if (type === "sliceIndex") return "must be a whole number 0 or greater";
|
|
51795
|
-
return "must be a number between 0 and 1";
|
|
51796
|
-
}
|
|
51797
51915
|
var STRUCTURED_LEAF_SOURCE_FORMS, STRUCTURED_LEAF_SOURCE_ENTRIES;
|
|
51798
51916
|
var init_structured_leaf_source = __esm({
|
|
51799
51917
|
"src/project-source/structured-leaf-source.ts"() {
|
|
@@ -54508,7 +54626,7 @@ function lowerParameterDefaultValue(context, expression, type, path) {
|
|
|
54508
54626
|
`Parameter ${path} defaults to a number literal, but its type is ${type.kind}.`
|
|
54509
54627
|
);
|
|
54510
54628
|
}
|
|
54511
|
-
return expression.value;
|
|
54629
|
+
return type.kind === "float" ? Math.fround(expression.value) : expression.value;
|
|
54512
54630
|
case "litFloat":
|
|
54513
54631
|
if (type.kind === "decimal") return expression.raw;
|
|
54514
54632
|
if (type.kind !== "float") {
|
|
@@ -54516,7 +54634,7 @@ function lowerParameterDefaultValue(context, expression, type, path) {
|
|
|
54516
54634
|
`Parameter ${path} defaults to a fractional literal, but its type is ${type.kind}.`
|
|
54517
54635
|
);
|
|
54518
54636
|
}
|
|
54519
|
-
return expression.value;
|
|
54637
|
+
return Math.fround(expression.value);
|
|
54520
54638
|
case "unary": {
|
|
54521
54639
|
if (expression.op !== "-") {
|
|
54522
54640
|
throw new Error(
|
|
@@ -55655,8 +55773,8 @@ function lowerFieldMember(context, ownerClass, declaration, id2, commonInput, ba
|
|
|
55655
55773
|
};
|
|
55656
55774
|
}
|
|
55657
55775
|
const inheritedFloat = inherited?.kind === "float" ? inherited : void 0;
|
|
55658
|
-
const numericMin = min === null ? null : Number(min);
|
|
55659
|
-
const numericMax = max === null ? null : Number(max);
|
|
55776
|
+
const numericMin = min === null ? null : Math.fround(Number(min));
|
|
55777
|
+
const numericMax = max === null ? null : Math.fround(Number(max));
|
|
55660
55778
|
return {
|
|
55661
55779
|
...common,
|
|
55662
55780
|
kind: "float",
|
|
@@ -56615,9 +56733,8 @@ function lowerExpressionValue(context, expression, declaredExpected, ownerClass,
|
|
|
56615
56733
|
case "litString":
|
|
56616
56734
|
return expression.value;
|
|
56617
56735
|
case "litInt":
|
|
56618
|
-
return expected.name === "decimal" ? expression.raw : expression.value;
|
|
56619
56736
|
case "litFloat":
|
|
56620
|
-
return
|
|
56737
|
+
return numberLiteralValue(expression, expected);
|
|
56621
56738
|
case "unary": {
|
|
56622
56739
|
if (expression.op !== "-") {
|
|
56623
56740
|
throw new Error(
|
|
@@ -57474,6 +57591,11 @@ function positionalContextualEnumArgument(value) {
|
|
|
57474
57591
|
const expression = parseAnnotationExpression(positional.expression);
|
|
57475
57592
|
return expression.kind === "contextualEnum" ? expression.name : null;
|
|
57476
57593
|
}
|
|
57594
|
+
function numberLiteralValue(expression, expected) {
|
|
57595
|
+
if (expected.name === "decimal") return expression.raw;
|
|
57596
|
+
if (expected.name === "float") return Math.fround(expression.value);
|
|
57597
|
+
return expression.value;
|
|
57598
|
+
}
|
|
57477
57599
|
function numberTextArgument(value, name) {
|
|
57478
57600
|
const raw = argument(value, name);
|
|
57479
57601
|
if (raw === null) return null;
|
|
@@ -72485,7 +72607,8 @@ function evalPointer(pointer, scope, ctx, resultUsage = "value") {
|
|
|
72485
72607
|
callSiteId: pointer.callSiteId,
|
|
72486
72608
|
invokeDelegate: (delegate, delegateArgs = []) => invokeDelegateValue(delegate, delegateArgs, ctx, pointer.callSiteId)
|
|
72487
72609
|
});
|
|
72488
|
-
if (intercepted?.handled === true)
|
|
72610
|
+
if (intercepted?.handled === true)
|
|
72611
|
+
return hostCallResult(member, intercepted.value, ctx);
|
|
72489
72612
|
if (member === null) {
|
|
72490
72613
|
if (pointer.missingMemberFallback === "valueEquality") {
|
|
72491
72614
|
return jsEqual(innerThis, suppliedArgs[0]);
|
|
@@ -72521,7 +72644,8 @@ function evalPointer(pointer, scope, ctx, resultUsage = "value") {
|
|
|
72521
72644
|
pointer.callSiteId
|
|
72522
72645
|
)
|
|
72523
72646
|
});
|
|
72524
|
-
if (hosted?.handled === true)
|
|
72647
|
+
if (hosted?.handled === true)
|
|
72648
|
+
return hostCallResult(member, hosted.value, ctx);
|
|
72525
72649
|
const receiverId = trackedRowForValueReference(innerThis, ctx)?.id;
|
|
72526
72650
|
throw new NativeFunctionDelegateUnavailableError(
|
|
72527
72651
|
`No native delegate handled Function '${member.name}' (member id '${member.id}'${nativeReceiverDescription(member, innerThis, receiverId)}). Web preview and other non-native evaluator hosts must configure a native handler or call interceptor before evaluation.`,
|
|
@@ -72812,7 +72936,8 @@ function invokeDelegateValue(value, args, ctx, callSiteId, ownerReceiver, result
|
|
|
72812
72936
|
callSiteId,
|
|
72813
72937
|
invokeDelegate: (delegate, delegateArgs = []) => invokeDelegateValue(delegate, delegateArgs, ctx, callSiteId)
|
|
72814
72938
|
});
|
|
72815
|
-
if (intercepted?.handled === true)
|
|
72939
|
+
if (intercepted?.handled === true)
|
|
72940
|
+
return hostCallResult(member, intercepted.value, ctx);
|
|
72816
72941
|
state.delegateStack.push(frame);
|
|
72817
72942
|
try {
|
|
72818
72943
|
if (member.kind === 13 /* Function */) {
|
|
@@ -72827,7 +72952,8 @@ function invokeDelegateValue(value, args, ctx, callSiteId, ownerReceiver, result
|
|
|
72827
72952
|
callSiteId,
|
|
72828
72953
|
invokeDelegate: (delegate, delegateArgs = []) => invokeDelegateValue(delegate, delegateArgs, ctx, callSiteId)
|
|
72829
72954
|
});
|
|
72830
|
-
if (hosted?.handled === true)
|
|
72955
|
+
if (hosted?.handled === true)
|
|
72956
|
+
return hostCallResult(member, hosted.value, ctx);
|
|
72831
72957
|
const receiverId = trackedRowForValueReference(receiver, ctx)?.id;
|
|
72832
72958
|
throw new NativeFunctionDelegateUnavailableError(
|
|
72833
72959
|
`No native delegate handled Function '${member.name}' (member id '${member.id}'${nativeReceiverDescription(member, receiver, receiverId)}). Web preview and other non-native evaluator hosts must configure a native handler or call interceptor before evaluation.`,
|
|
@@ -73696,13 +73822,14 @@ function runtimeCollectionEntryMatchesType(value, typeInfo, ctx, seenCollections
|
|
|
73696
73822
|
return resolved !== value && runtimeValueMatchesType(resolved, typeInfo, ctx, seenCollections);
|
|
73697
73823
|
}
|
|
73698
73824
|
function evalVectorConstructor(vectorType, componentPointers, scope, ctx) {
|
|
73699
|
-
const
|
|
73700
|
-
|
|
73825
|
+
const integer3 = vectorType === 15 /* Vector2Int */ || vectorType === 17 /* Vector3Int */;
|
|
73826
|
+
const values = componentPointers.map((pointer) => {
|
|
73827
|
+
const value = finiteNumberArg(
|
|
73701
73828
|
evalPointer(pointer, scope, ctx),
|
|
73702
73829
|
`${MemberKind[vectorType]} component`
|
|
73703
|
-
)
|
|
73704
|
-
|
|
73705
|
-
|
|
73830
|
+
);
|
|
73831
|
+
return integer3 ? value : Math.fround(value);
|
|
73832
|
+
});
|
|
73706
73833
|
if (integer3 && values.some((value) => !Number.isInteger(value))) {
|
|
73707
73834
|
throw new NSGetterRuntimeError(
|
|
73708
73835
|
`${MemberKind[vectorType]} components must be integers`
|
|
@@ -74593,11 +74720,17 @@ function evalOperation(operation, scope, ctx) {
|
|
|
74593
74720
|
if (operation.type === "arithmetic" /* arithmetic */) {
|
|
74594
74721
|
const op = operation.arithmetic;
|
|
74595
74722
|
const operands = op.pointers.map((p) => evalPointer(p, scope, ctx));
|
|
74596
|
-
return applyArithmetic(
|
|
74723
|
+
return applyArithmetic(
|
|
74724
|
+
op.type,
|
|
74725
|
+
operands,
|
|
74726
|
+
op.decimal === true,
|
|
74727
|
+
ctx,
|
|
74728
|
+
op.numeric
|
|
74729
|
+
);
|
|
74597
74730
|
}
|
|
74598
74731
|
return evalBooleanExpression(operation.expression, scope, ctx);
|
|
74599
74732
|
}
|
|
74600
|
-
function applyArithmetic(op, operands, decimal2, ctx) {
|
|
74733
|
+
function applyArithmetic(op, operands, decimal2, ctx, numeric) {
|
|
74601
74734
|
if (operands.length === 0) {
|
|
74602
74735
|
throw new NSGetterRuntimeError("Arithmetic operation with no operands");
|
|
74603
74736
|
}
|
|
@@ -74630,31 +74763,43 @@ function applyArithmetic(op, operands, decimal2, ctx) {
|
|
|
74630
74763
|
`Arithmetic operand is not numeric: ${typeof o}`
|
|
74631
74764
|
);
|
|
74632
74765
|
});
|
|
74766
|
+
const round = numeric === "float" ? Math.fround : (value) => value;
|
|
74633
74767
|
switch (op) {
|
|
74634
74768
|
case "+" /* addition */:
|
|
74635
|
-
return numbers.reduce((a, b) => a + b, 0);
|
|
74769
|
+
return numbers.reduce((a, b) => round(a + b), 0);
|
|
74636
74770
|
case "-" /* subtraction */:
|
|
74637
|
-
return numbers.reduce((a, b, i2) => i2 === 0 ? b : a - b);
|
|
74771
|
+
return numbers.reduce((a, b, i2) => i2 === 0 ? b : round(a - b));
|
|
74638
74772
|
case "*" /* multiplication */:
|
|
74639
|
-
return numbers.reduce((a, b) => a * b, 1);
|
|
74773
|
+
return numbers.reduce((a, b) => round(a * b), 1);
|
|
74640
74774
|
case "/" /* division */:
|
|
74641
74775
|
return numbers.reduce((a, b, i2) => {
|
|
74642
74776
|
if (i2 === 0) return b;
|
|
74643
74777
|
if (b === 0) throw new NSGetterRuntimeError("Division by zero");
|
|
74644
|
-
return a / b;
|
|
74778
|
+
return numeric === "int" ? Math.trunc(a / b) : round(a / b);
|
|
74645
74779
|
});
|
|
74646
74780
|
case "%" /* remainder */:
|
|
74647
74781
|
return numbers.reduce((a, b, i2) => {
|
|
74648
74782
|
if (i2 === 0) return b;
|
|
74649
74783
|
if (b === 0) throw new NSGetterRuntimeError("Modulo by zero");
|
|
74650
|
-
return a % b;
|
|
74784
|
+
return round(a % b);
|
|
74651
74785
|
});
|
|
74652
74786
|
}
|
|
74653
74787
|
}
|
|
74788
|
+
function hostCallResult(member, value, ctx) {
|
|
74789
|
+
if (typeof value !== "number" || member === null) return value;
|
|
74790
|
+
if (member.kind !== 13 /* Function */ && member.kind !== 23 /* NSFunction */) {
|
|
74791
|
+
return value;
|
|
74792
|
+
}
|
|
74793
|
+
const signature = resolveCallableSignature(member.id, member.kind, ctx);
|
|
74794
|
+
return signature?.returnTypeInfo.type === 4 /* Float */ ? Math.fround(value) : value;
|
|
74795
|
+
}
|
|
74654
74796
|
function coerceAssignmentValue(value, targetTypeInfo, context) {
|
|
74655
74797
|
if (targetTypeInfo.type === 8 /* Enum */ && typeof value === "string") {
|
|
74656
74798
|
return [value];
|
|
74657
74799
|
}
|
|
74800
|
+
if (targetTypeInfo.type === 4 /* Float */ && typeof value === "number") {
|
|
74801
|
+
return Math.fround(value);
|
|
74802
|
+
}
|
|
74658
74803
|
return targetTypeInfo.type === 20 /* Decimal */ && typeof value === "number" ? coerceDecimalOperand(value, context) : value;
|
|
74659
74804
|
}
|
|
74660
74805
|
function coerceDecimalOperand(value, context) {
|
|
@@ -74804,7 +74949,7 @@ function evalMathOp(info, scope, ctx) {
|
|
|
74804
74949
|
if (value < 0) return -1;
|
|
74805
74950
|
return 0;
|
|
74806
74951
|
case "sqrt":
|
|
74807
|
-
return Math.sqrt(value);
|
|
74952
|
+
return Math.fround(Math.sqrt(value));
|
|
74808
74953
|
}
|
|
74809
74954
|
}
|
|
74810
74955
|
function evalDecimalMathOp(info, fn, scope, ctx) {
|
|
@@ -75445,8 +75590,10 @@ function evalFunction(fn, scope, ctx) {
|
|
|
75445
75590
|
);
|
|
75446
75591
|
}
|
|
75447
75592
|
case "toFloat":
|
|
75448
|
-
return
|
|
75449
|
-
|
|
75593
|
+
return Math.fround(
|
|
75594
|
+
floatFromDecimalString(
|
|
75595
|
+
coerceDecimalOperand(receiverRaw, "ToFloat")
|
|
75596
|
+
)
|
|
75450
75597
|
);
|
|
75451
75598
|
case "toDecimal": {
|
|
75452
75599
|
if (typeof receiverRaw !== "number") {
|
|
@@ -75954,6 +76101,9 @@ function evaluateConstructorFields(descriptor, scope, ctx) {
|
|
|
75954
76101
|
`constructor field '${validated.schemaKey}'`
|
|
75955
76102
|
);
|
|
75956
76103
|
}
|
|
76104
|
+
if (typeof value === "number" && validated.typeInfo.type === 4 /* Float */) {
|
|
76105
|
+
value = Math.fround(value);
|
|
76106
|
+
}
|
|
75957
76107
|
if (value === null || value === void 0) {
|
|
75958
76108
|
if (validated.requiredWithoutDefault) {
|
|
75959
76109
|
throw new NSGetterRuntimeError(
|
|
@@ -76574,8 +76724,9 @@ function evaluateDeclaredConstructorArguments(info, record6, scope, ctx) {
|
|
|
76574
76724
|
);
|
|
76575
76725
|
}
|
|
76576
76726
|
const value = byName.get(parameter4.name);
|
|
76577
|
-
if (parameter4.type !== 20 /* Decimal */) return value;
|
|
76578
76727
|
if (typeof value !== "number") return value;
|
|
76728
|
+
if (parameter4.type === 4 /* Float */) return Math.fround(value);
|
|
76729
|
+
if (parameter4.type !== 20 /* Decimal */) return value;
|
|
76579
76730
|
return coerceDecimalOperand(
|
|
76580
76731
|
value,
|
|
76581
76732
|
`constructor argument '${parameter4.name}'`
|
|
@@ -89277,6 +89428,13 @@ function validateProjectRecordByKind(recordKind, data, options = {}) {
|
|
|
89277
89428
|
if (recordKind === ProjectRecordKind.Member) {
|
|
89278
89429
|
const memberGuard = options.members === "authored-or-compiled" ? isAnyMemberAuthoredOrCompiled : isAnyMember;
|
|
89279
89430
|
if (memberGuard(data)) return;
|
|
89431
|
+
const unrounded = unroundedFloatPath(data);
|
|
89432
|
+
if (unrounded !== null) {
|
|
89433
|
+
const id2 = typeof data === "object" && data !== null && "id" in data ? String(data.id) : "";
|
|
89434
|
+
throw new Error(
|
|
89435
|
+
`Member "${id2}" field "${unrounded}" must be a 32-bit float.`
|
|
89436
|
+
);
|
|
89437
|
+
}
|
|
89280
89438
|
}
|
|
89281
89439
|
if (recordKind === ProjectRecordKind.Value) {
|
|
89282
89440
|
if (isMemberValue(data)) {
|
|
@@ -89372,6 +89530,7 @@ var init_project_record_validation = __esm({
|
|
|
89372
89530
|
init_localization_types();
|
|
89373
89531
|
init_unity_import_settings();
|
|
89374
89532
|
init_project_file_authoring_identifiers();
|
|
89533
|
+
init_float32();
|
|
89375
89534
|
}
|
|
89376
89535
|
});
|
|
89377
89536
|
|
|
@@ -97503,15 +97662,13 @@ function inspectStoredValueNodeInternal(options) {
|
|
|
97503
97662
|
return terminal();
|
|
97504
97663
|
}
|
|
97505
97664
|
if (member.kind === 4 /* Float */) {
|
|
97506
|
-
if (
|
|
97507
|
-
fail(`${path} must store a finite number.`);
|
|
97508
|
-
}
|
|
97665
|
+
if (!isFloat32(row.value)) fail(`${path} must store a 32-bit float.`);
|
|
97509
97666
|
assertNumberRange(member, row.value, path);
|
|
97510
97667
|
return terminal();
|
|
97511
97668
|
}
|
|
97512
|
-
const
|
|
97513
|
-
if (
|
|
97514
|
-
fail(`${path} ${storedLeafShapeIssueMessage(
|
|
97669
|
+
const leafIssue2 = storedLeafShapeIssue(member, row.value);
|
|
97670
|
+
if (leafIssue2 !== null) {
|
|
97671
|
+
fail(`${path} ${storedLeafShapeIssueMessage(leafIssue2, "graph")}`);
|
|
97515
97672
|
}
|
|
97516
97673
|
if (isMemberStringBase(member)) {
|
|
97517
97674
|
if (typeof row.value !== "string") fail(`${path} must store a string.`);
|
|
@@ -97873,6 +98030,7 @@ var init_stored_value_graph_semantics = __esm({
|
|
|
97873
98030
|
init_inheritance();
|
|
97874
98031
|
init_generics();
|
|
97875
98032
|
init_classes();
|
|
98033
|
+
init_float32();
|
|
97876
98034
|
StoredValueSemanticError = class extends Error {
|
|
97877
98035
|
name = "StoredValueSemanticError";
|
|
97878
98036
|
};
|
|
@@ -104917,9 +105075,7 @@ function hasValidOpaqueParameterDefault(value) {
|
|
|
104917
105075
|
if (value.type === 2) {
|
|
104918
105076
|
return typeof payload === "number" && Number.isInteger(payload);
|
|
104919
105077
|
}
|
|
104920
|
-
if (value.type === 4)
|
|
104921
|
-
return typeof payload === "number" && Number.isFinite(payload);
|
|
104922
|
-
}
|
|
105078
|
+
if (value.type === 4) return isFloat32(payload);
|
|
104923
105079
|
if (value.type === 3 || value.type === 8 || value.type === 20) {
|
|
104924
105080
|
return typeof payload === "string";
|
|
104925
105081
|
}
|
|
@@ -106849,6 +107005,7 @@ var init_projectInterfaceValidation = __esm({
|
|
|
106849
107005
|
init_classes();
|
|
106850
107006
|
init_interface_types();
|
|
106851
107007
|
init_member_kinds();
|
|
107008
|
+
init_float32();
|
|
106852
107009
|
init_stored_value_shape();
|
|
106853
107010
|
init_member_storage();
|
|
106854
107011
|
NEO_OBJECT_WORLD_KIND = "object";
|
|
@@ -108267,7 +108424,7 @@ function csharpValueType(ctx, member, saved = false, env, genericBindingSaved =
|
|
|
108267
108424
|
return isRequiredMember2(member) ? "bool" : "bool?";
|
|
108268
108425
|
if (isMemberIntBase(member)) return isRequiredMember2(member) ? "int" : "int?";
|
|
108269
108426
|
if (isMemberFloatBase(member))
|
|
108270
|
-
return isRequiredMember2(member) ? "
|
|
108427
|
+
return isRequiredMember2(member) ? "float" : "float?";
|
|
108271
108428
|
if (isMemberDecimalBase(member)) {
|
|
108272
108429
|
return isRequiredMember2(member) ? "decimal" : "decimal?";
|
|
108273
108430
|
}
|
|
@@ -108482,7 +108639,7 @@ function csharpTypeInfoValueType(ctx, typeInfo, saved, genericEnv, genericBindin
|
|
|
108482
108639
|
case 2 /* Int */:
|
|
108483
108640
|
return optional2 ? "int?" : "int";
|
|
108484
108641
|
case 4 /* Float */:
|
|
108485
|
-
return optional2 ? "
|
|
108642
|
+
return optional2 ? "float?" : "float";
|
|
108486
108643
|
case 20 /* Decimal */:
|
|
108487
108644
|
return optional2 ? "decimal?" : "decimal";
|
|
108488
108645
|
case 3 /* String */:
|
|
@@ -112107,6 +112264,62 @@ var init_schema_source_validation = __esm({
|
|
|
112107
112264
|
}
|
|
112108
112265
|
});
|
|
112109
112266
|
|
|
112267
|
+
// src/project-sync/compiler-metadata.ts
|
|
112268
|
+
function compilerOnlyChanges(previous, document, changedKeys) {
|
|
112269
|
+
const keys = changedKeys ?? /* @__PURE__ */ new Set([...Object.keys(previous), ...document.records.keys()]);
|
|
112270
|
+
const refreshed = /* @__PURE__ */ new Set();
|
|
112271
|
+
let complete2 = true;
|
|
112272
|
+
for (const key of keys) {
|
|
112273
|
+
const before = previous[key];
|
|
112274
|
+
const after = document.records.get(key);
|
|
112275
|
+
if (before !== void 0 && after !== void 0 && !after.deleted && before.contentHash === after.contentHash)
|
|
112276
|
+
continue;
|
|
112277
|
+
if (before === void 0 || after === void 0 || after.deleted || before.recordId !== after.recordId || before.recordKind !== after.recordKind || !isProjectRecordKind(after.recordKind) || !isObjectRecord2(before.data) || !isObjectRecord2(after.data) || !canonicallyEqual(
|
|
112278
|
+
authoredCompilerInput(after.recordKind, before.data),
|
|
112279
|
+
authoredCompilerInput(after.recordKind, after.data)
|
|
112280
|
+
)) {
|
|
112281
|
+
complete2 = false;
|
|
112282
|
+
continue;
|
|
112283
|
+
}
|
|
112284
|
+
refreshed.add(key);
|
|
112285
|
+
}
|
|
112286
|
+
return { keys: refreshed, complete: complete2 };
|
|
112287
|
+
}
|
|
112288
|
+
function authoredCompilerInput(kind, data) {
|
|
112289
|
+
const result = stripClientDerivedBodies(kind, data);
|
|
112290
|
+
stampUILogicBodies(kind, result);
|
|
112291
|
+
if (isObjectRecord2(result)) delete result.updatedAt;
|
|
112292
|
+
return result;
|
|
112293
|
+
}
|
|
112294
|
+
function assertCurrentBaseline(records2) {
|
|
112295
|
+
for (const [key, record6] of Object.entries(records2)) {
|
|
112296
|
+
if (!isProjectRecordKind(record6.recordKind)) continue;
|
|
112297
|
+
const rejected = firstRejectedNeoScriptCompiledBody(record6.data);
|
|
112298
|
+
if (rejected === null) continue;
|
|
112299
|
+
try {
|
|
112300
|
+
validateProjectRecordByKind(record6.recordKind, record6.data, {
|
|
112301
|
+
members: "authored-or-compiled"
|
|
112302
|
+
});
|
|
112303
|
+
continue;
|
|
112304
|
+
} catch {
|
|
112305
|
+
}
|
|
112306
|
+
const carried = rejected.stamp === void 0 ? "has no compiler revision stamp" : `carries compiler revision ${JSON.stringify(rejected.stamp)}`;
|
|
112307
|
+
throw new Error(
|
|
112308
|
+
`The pull baseline in .neo/state.json predates this CLI: ${key} ${rejected.path} ${carried}. Run \`neo pull\` to refresh it. If pull reports this again, commit or back up your local edits, run \`neo pull --force\`, then restore them.`
|
|
112309
|
+
);
|
|
112310
|
+
}
|
|
112311
|
+
}
|
|
112312
|
+
var init_compiler_metadata = __esm({
|
|
112313
|
+
"src/project-sync/compiler-metadata.ts"() {
|
|
112314
|
+
"use strict";
|
|
112315
|
+
init_project2();
|
|
112316
|
+
init_neo_script_derived_bodies();
|
|
112317
|
+
init_neoscript_compiler_revision();
|
|
112318
|
+
init_project_record_validation();
|
|
112319
|
+
init_value_comparison();
|
|
112320
|
+
}
|
|
112321
|
+
});
|
|
112322
|
+
|
|
112110
112323
|
// src/project-sync/value-record-comparison.ts
|
|
112111
112324
|
function valueRecordComparisonBody(value) {
|
|
112112
112325
|
if (!isObjectRecord2(value)) return value;
|
|
@@ -118290,6 +118503,7 @@ function materializeWorkspaceStatusInitializers(workspace, status, forceRecompil
|
|
|
118290
118503
|
});
|
|
118291
118504
|
}
|
|
118292
118505
|
function computeWorkspaceStatus(workspace, options) {
|
|
118506
|
+
assertCurrentBaseline(workspace.state.records);
|
|
118293
118507
|
let phaseStarted = performance.now();
|
|
118294
118508
|
options.onPhase?.("Reading project schema\u2026");
|
|
118295
118509
|
const reportPhase = (phase, nextLabel) => {
|
|
@@ -120264,6 +120478,7 @@ var init_workspace_status_core = __esm({
|
|
|
120264
120478
|
init_key_reference_spelling();
|
|
120265
120479
|
init_workspace();
|
|
120266
120480
|
init_source_diagnostics();
|
|
120481
|
+
init_compiler_metadata();
|
|
120267
120482
|
init_migration_files();
|
|
120268
120483
|
init_value_comparison();
|
|
120269
120484
|
init_projection();
|
|
@@ -124748,8 +124963,9 @@ function lowerValueBody(context, member, expression, base, source, environment,
|
|
|
124748
124963
|
case "bool":
|
|
124749
124964
|
return { ...next, value: requiredBoolean(expression) };
|
|
124750
124965
|
case "int":
|
|
124751
|
-
case "float":
|
|
124752
124966
|
return { ...next, value: requiredNumber2(expression) };
|
|
124967
|
+
case "float":
|
|
124968
|
+
return { ...next, value: Math.fround(requiredNumber2(expression)) };
|
|
124753
124969
|
case "decimal":
|
|
124754
124970
|
return { ...next, value: requiredDecimal(expression) };
|
|
124755
124971
|
case "string":
|
|
@@ -137759,40 +137975,6 @@ var init_static_value_seed_records = __esm({
|
|
|
137759
137975
|
}
|
|
137760
137976
|
});
|
|
137761
137977
|
|
|
137762
|
-
// src/project-sync/compiler-metadata.ts
|
|
137763
|
-
function compilerMetadataChangedKeys(previous, document, changedKeys) {
|
|
137764
|
-
const keys = changedKeys ?? /* @__PURE__ */ new Set([...Object.keys(previous), ...document.records.keys()]);
|
|
137765
|
-
const refreshed = /* @__PURE__ */ new Set();
|
|
137766
|
-
for (const key of keys) {
|
|
137767
|
-
const before = previous[key];
|
|
137768
|
-
const after = document.records.get(key);
|
|
137769
|
-
if (before === void 0 || after === void 0 || after.deleted || before.recordId !== after.recordId || before.recordKind !== after.recordKind || !isProjectRecordKind(after.recordKind))
|
|
137770
|
-
return null;
|
|
137771
|
-
if (before.contentHash === after.contentHash) continue;
|
|
137772
|
-
if (!isObjectRecord2(before.data) || !isObjectRecord2(after.data) || !canonicallyEqual(
|
|
137773
|
-
authoredCompilerInput(after.recordKind, before.data),
|
|
137774
|
-
authoredCompilerInput(after.recordKind, after.data)
|
|
137775
|
-
))
|
|
137776
|
-
return null;
|
|
137777
|
-
refreshed.add(key);
|
|
137778
|
-
}
|
|
137779
|
-
return refreshed.size === 0 ? null : refreshed;
|
|
137780
|
-
}
|
|
137781
|
-
function authoredCompilerInput(kind, data) {
|
|
137782
|
-
const result = stripClientDerivedBodies(kind, data);
|
|
137783
|
-
stampUILogicBodies(kind, result);
|
|
137784
|
-
if (isObjectRecord2(result)) delete result.updatedAt;
|
|
137785
|
-
return result;
|
|
137786
|
-
}
|
|
137787
|
-
var init_compiler_metadata = __esm({
|
|
137788
|
-
"src/project-sync/compiler-metadata.ts"() {
|
|
137789
|
-
"use strict";
|
|
137790
|
-
init_project2();
|
|
137791
|
-
init_neo_script_derived_bodies();
|
|
137792
|
-
init_value_comparison();
|
|
137793
|
-
}
|
|
137794
|
-
});
|
|
137795
|
-
|
|
137796
137978
|
// src/commands/pull.ts
|
|
137797
137979
|
var pull_exports = {};
|
|
137798
137980
|
__export(pull_exports, {
|
|
@@ -137881,20 +138063,23 @@ async function runNormalPull(workspace, options, progress) {
|
|
|
137881
138063
|
document = await fetchProjectDocument(workspace);
|
|
137882
138064
|
nextCursor = document.revision === void 0 ? null : cursorFromRevision(document.revision);
|
|
137883
138065
|
}
|
|
137884
|
-
|
|
137885
|
-
|
|
137886
|
-
|
|
137887
|
-
changedRecordKeys
|
|
137888
|
-
) : null;
|
|
137889
|
-
if (compilerRefreshKeys !== null) {
|
|
137890
|
-
finishRecordOnlyDeltaPull({
|
|
137891
|
-
workspace,
|
|
138066
|
+
if (!destructive && hasBaseline && !hadConflicts) {
|
|
138067
|
+
const compilerOnly = compilerOnlyChanges(
|
|
138068
|
+
workspace.state.records,
|
|
137892
138069
|
document,
|
|
137893
|
-
changedRecordKeys
|
|
137894
|
-
|
|
137895
|
-
|
|
137896
|
-
|
|
137897
|
-
|
|
138070
|
+
changedRecordKeys
|
|
138071
|
+
);
|
|
138072
|
+
if (compilerOnly.complete && compilerOnly.keys.size > 0 && !options.regenerateSourceNames) {
|
|
138073
|
+
finishRecordOnlyDeltaPull({
|
|
138074
|
+
workspace,
|
|
138075
|
+
document,
|
|
138076
|
+
changedRecordKeys: compilerOnly.keys,
|
|
138077
|
+
nextCursor,
|
|
138078
|
+
progress
|
|
138079
|
+
});
|
|
138080
|
+
return;
|
|
138081
|
+
}
|
|
138082
|
+
adoptServerRecords(workspace, document, compilerOnly.keys);
|
|
137898
138083
|
}
|
|
137899
138084
|
let localByKey = /* @__PURE__ */ new Map();
|
|
137900
138085
|
let localStatus = null;
|
|
@@ -138483,9 +138668,25 @@ function deltaRequiresSourceProjectionV4(args) {
|
|
|
138483
138668
|
return false;
|
|
138484
138669
|
}
|
|
138485
138670
|
function finishRecordOnlyDeltaPull(args) {
|
|
138486
|
-
|
|
138487
|
-
|
|
138488
|
-
|
|
138671
|
+
adoptServerRecords(args.workspace, args.document, args.changedRecordKeys);
|
|
138672
|
+
if (args.nextCursor !== null) {
|
|
138673
|
+
args.workspace.state.documentRevisionCursor = mutableCursor(
|
|
138674
|
+
args.nextCursor
|
|
138675
|
+
);
|
|
138676
|
+
}
|
|
138677
|
+
args.workspace.state.headTransactionHash = pulledHeadTransactionHash(
|
|
138678
|
+
args.document
|
|
138679
|
+
);
|
|
138680
|
+
writeWorkspaceState(args.workspace.root, args.workspace.state);
|
|
138681
|
+
args.progress.succeed(
|
|
138682
|
+
`Pulled ${args.changedRecordKeys.size} changed record(s) \u2014 0 file(s) updated \u2014 0 removed.`
|
|
138683
|
+
);
|
|
138684
|
+
}
|
|
138685
|
+
function adoptServerRecords(workspace, document, keys) {
|
|
138686
|
+
if (keys.size === 0) return;
|
|
138687
|
+
const records2 = { ...workspace.state.records };
|
|
138688
|
+
for (const key of keys) {
|
|
138689
|
+
const server = document.records.get(key);
|
|
138489
138690
|
if (server === void 0) {
|
|
138490
138691
|
delete records2[key];
|
|
138491
138692
|
continue;
|
|
@@ -138500,19 +138701,7 @@ function finishRecordOnlyDeltaPull(args) {
|
|
|
138500
138701
|
...previous?.projectBinary === void 0 ? {} : { projectBinary: previous.projectBinary }
|
|
138501
138702
|
};
|
|
138502
138703
|
}
|
|
138503
|
-
|
|
138504
|
-
if (args.nextCursor !== null) {
|
|
138505
|
-
args.workspace.state.documentRevisionCursor = mutableCursor(
|
|
138506
|
-
args.nextCursor
|
|
138507
|
-
);
|
|
138508
|
-
}
|
|
138509
|
-
args.workspace.state.headTransactionHash = pulledHeadTransactionHash(
|
|
138510
|
-
args.document
|
|
138511
|
-
);
|
|
138512
|
-
writeWorkspaceState(args.workspace.root, args.workspace.state);
|
|
138513
|
-
args.progress.succeed(
|
|
138514
|
-
`Pulled ${args.changedRecordKeys.size} changed record(s) \u2014 0 file(s) updated \u2014 0 removed.`
|
|
138515
|
-
);
|
|
138704
|
+
workspace.state.records = records2;
|
|
138516
138705
|
}
|
|
138517
138706
|
function pulledHeadTransactionHash(document) {
|
|
138518
138707
|
return document.revision?.headTransactionHash ?? null;
|
|
@@ -156644,7 +156833,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
156644
156833
|
async function main() {
|
|
156645
156834
|
const args = parseArgs(process.argv.slice(2));
|
|
156646
156835
|
if (args.command === "--version") {
|
|
156647
|
-
console.log("0.
|
|
156836
|
+
console.log("0.67.1");
|
|
156648
156837
|
return;
|
|
156649
156838
|
}
|
|
156650
156839
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|