@neocompose/cli 0.2.2 → 0.2.3
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 +61 -17
- package/dist/tooling/NeoCompose.Schema.Tooling.dll +0 -0
- package/dist/tooling/NeoCompose.Schema.Tooling.pdb +0 -0
- package/dist/tooling/NeoCompose.Schema.dll +0 -0
- package/dist/tooling/NeoCompose.Schema.pdb +0 -0
- package/dist/tooling/NeoCompose.SchemaCompiler.dll +0 -0
- package/dist/tooling/NeoCompose.SchemaCompiler.pdb +0 -0
- package/dist/tooling/schema-contract.json +1 -1
- package/package.json +1 -1
package/dist/neo.mjs
CHANGED
|
@@ -1612,7 +1612,7 @@ var init_source_protocol = __esm({
|
|
|
1612
1612
|
SCHEMA_SOURCE_MANIFEST_NAME = "neo-schema-manifest-v2";
|
|
1613
1613
|
SCHEMA_COMPILER_PROTOCOL_VERSION = 3;
|
|
1614
1614
|
SCHEMA_SDK_VERSION = "2.1.0";
|
|
1615
|
-
SCHEMA_CLI_VERSION = "0.2.
|
|
1615
|
+
SCHEMA_CLI_VERSION = "0.2.3";
|
|
1616
1616
|
SCHEMA_API_TARGET = "netstandard2.1";
|
|
1617
1617
|
SCHEMA_REFERENCE_ASSEMBLY_SET = "NETStandard.Library.Ref/2.1.0";
|
|
1618
1618
|
SCHEMA_REQUIRED_TOOLING_FILES = [
|
|
@@ -10104,9 +10104,13 @@ function formatNeoScript(text, options = {}) {
|
|
|
10104
10104
|
lines.join("\n"),
|
|
10105
10105
|
options.kind ?? inferDocumentKind(text)
|
|
10106
10106
|
);
|
|
10107
|
-
const
|
|
10108
|
-
|
|
10109
|
-
|
|
10107
|
+
const delimiterTokensByLine = /* @__PURE__ */ new Map();
|
|
10108
|
+
for (const token of syntax.lexed.tokens) {
|
|
10109
|
+
if (token.kind !== "punctuation" || !isDelimiter(token.text)) continue;
|
|
10110
|
+
const lineTokens = delimiterTokensByLine.get(token.range.start.line) ?? [];
|
|
10111
|
+
lineTokens.push(token);
|
|
10112
|
+
delimiterTokensByLine.set(token.range.start.line, lineTokens);
|
|
10113
|
+
}
|
|
10110
10114
|
const formatted = [];
|
|
10111
10115
|
let depth = 0;
|
|
10112
10116
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
@@ -10118,22 +10122,16 @@ function formatNeoScript(text, options = {}) {
|
|
|
10118
10122
|
continue;
|
|
10119
10123
|
}
|
|
10120
10124
|
const firstContentCharacter = trimmedEnd.length - content.length;
|
|
10121
|
-
const lineTokens =
|
|
10122
|
-
(token) => token.range.start.line === lineIndex
|
|
10123
|
-
);
|
|
10125
|
+
const lineTokens = delimiterTokensByLine.get(lineIndex) ?? [];
|
|
10124
10126
|
const leadingClosers = countLeadingClosers(
|
|
10125
10127
|
lineTokens,
|
|
10126
10128
|
firstContentCharacter
|
|
10127
10129
|
);
|
|
10128
10130
|
const lineDepth = Math.max(0, depth - leadingClosers);
|
|
10129
10131
|
formatted.push(`${indentUnit.repeat(lineDepth)}${content}`);
|
|
10130
|
-
|
|
10131
|
-
0,
|
|
10132
|
-
|
|
10133
|
-
(delta, token) => delta + (token.text === "{" ? 1 : -1),
|
|
10134
|
-
0
|
|
10135
|
-
)
|
|
10136
|
-
);
|
|
10132
|
+
for (const token of lineTokens) {
|
|
10133
|
+
depth = isOpeningDelimiter(token.text) ? depth + 1 : Math.max(0, depth - 1);
|
|
10134
|
+
}
|
|
10137
10135
|
}
|
|
10138
10136
|
while (formatted.length > 1 && formatted[formatted.length - 1] === "") {
|
|
10139
10137
|
formatted.pop();
|
|
@@ -10152,12 +10150,21 @@ function countLeadingClosers(lineTokens, firstContentCharacter) {
|
|
|
10152
10150
|
let expectedCharacter = firstContentCharacter;
|
|
10153
10151
|
for (const token of lineTokens) {
|
|
10154
10152
|
if (token.range.start.character !== expectedCharacter) break;
|
|
10155
|
-
if (token.text
|
|
10153
|
+
if (!isClosingDelimiter(token.text)) break;
|
|
10156
10154
|
count++;
|
|
10157
10155
|
expectedCharacter++;
|
|
10158
10156
|
}
|
|
10159
10157
|
return count;
|
|
10160
10158
|
}
|
|
10159
|
+
function isDelimiter(value) {
|
|
10160
|
+
return isOpeningDelimiter(value) || isClosingDelimiter(value);
|
|
10161
|
+
}
|
|
10162
|
+
function isOpeningDelimiter(value) {
|
|
10163
|
+
return value === "{" || value === "(" || value === "[";
|
|
10164
|
+
}
|
|
10165
|
+
function isClosingDelimiter(value) {
|
|
10166
|
+
return value === "}" || value === ")" || value === "]";
|
|
10167
|
+
}
|
|
10161
10168
|
function inferDocumentKind(text) {
|
|
10162
10169
|
return /(^|\n)\s*(get|set)\s*\{/.test(text) ? "property" : "function";
|
|
10163
10170
|
}
|
|
@@ -43450,7 +43457,7 @@ import {
|
|
|
43450
43457
|
readFileSync as readFileSync14
|
|
43451
43458
|
} from "node:fs";
|
|
43452
43459
|
import { dirname as dirname7, join as join16 } from "node:path";
|
|
43453
|
-
function assignPendingIds(changes, staticValueSeeds) {
|
|
43460
|
+
function assignPendingIds(changes, staticValueSeeds, reconstructed) {
|
|
43454
43461
|
const assigned = /* @__PURE__ */ new Map();
|
|
43455
43462
|
const assign = (pendingId2) => {
|
|
43456
43463
|
const existing = assigned.get(pendingId2);
|
|
@@ -43501,6 +43508,42 @@ function assignPendingIds(changes, staticValueSeeds) {
|
|
|
43501
43508
|
typeId: typeof rewrittenSeed.typeId === "string" ? rewrittenSeed.typeId : null
|
|
43502
43509
|
});
|
|
43503
43510
|
}
|
|
43511
|
+
if (reconstructed !== void 0) {
|
|
43512
|
+
const rewrittenRecords = /* @__PURE__ */ new Map();
|
|
43513
|
+
for (const record2 of reconstructed.values()) {
|
|
43514
|
+
const rewrittenRecordId = rewrite(record2.recordId);
|
|
43515
|
+
if (typeof rewrittenRecordId !== "string") {
|
|
43516
|
+
throw new Error(
|
|
43517
|
+
`Reconstructed ${record2.recordKind} id ${JSON.stringify(record2.recordId)} did not rewrite to a string id.`
|
|
43518
|
+
);
|
|
43519
|
+
}
|
|
43520
|
+
const rewrittenFileFields = rewrite(record2.fileFields);
|
|
43521
|
+
if (!isObjectRecord3(rewrittenFileFields)) {
|
|
43522
|
+
throw new Error(
|
|
43523
|
+
`Reconstructed ${record2.recordKind} "${rewrittenRecordId}" file fields did not rewrite to an object.`
|
|
43524
|
+
);
|
|
43525
|
+
}
|
|
43526
|
+
const rewrittenFullData = rewrite(record2.fullData);
|
|
43527
|
+
if (!isObjectRecord3(rewrittenFullData)) {
|
|
43528
|
+
throw new Error(
|
|
43529
|
+
`Reconstructed ${record2.recordKind} "${rewrittenRecordId}" full data did not rewrite to an object.`
|
|
43530
|
+
);
|
|
43531
|
+
}
|
|
43532
|
+
rewrittenRecords.set(
|
|
43533
|
+
recordStateKey(record2.recordKind, rewrittenRecordId),
|
|
43534
|
+
{
|
|
43535
|
+
...record2,
|
|
43536
|
+
recordId: rewrittenRecordId,
|
|
43537
|
+
fileFields: rewrittenFileFields,
|
|
43538
|
+
fullData: rewrittenFullData
|
|
43539
|
+
}
|
|
43540
|
+
);
|
|
43541
|
+
}
|
|
43542
|
+
reconstructed.clear();
|
|
43543
|
+
for (const [key, record2] of rewrittenRecords) {
|
|
43544
|
+
reconstructed.set(key, record2);
|
|
43545
|
+
}
|
|
43546
|
+
}
|
|
43504
43547
|
return { assigned, staticValueSeeds: rewrittenSeeds };
|
|
43505
43548
|
}
|
|
43506
43549
|
async function runPush(workspace, options) {
|
|
@@ -43524,7 +43567,8 @@ ${status.parseErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
43524
43567
|
prepareNSFunctionBodyChanges(workspace, status);
|
|
43525
43568
|
const pendingAssignment = assignPendingIds(
|
|
43526
43569
|
status.changes,
|
|
43527
|
-
status.staticValueSeeds
|
|
43570
|
+
status.staticValueSeeds,
|
|
43571
|
+
status.reconstructed
|
|
43528
43572
|
);
|
|
43529
43573
|
const needsNeoScriptCompilation = status.changes.some(
|
|
43530
43574
|
(change) => change.recordKind === "attribute" || change.recordKind === "type" || change.recordKind === "enum" || change.recordKind === "interface" || change.nextData !== void 0 && change.recordKind === "migration" && typeof change.nextData.code === "string" && change.nextData.code.trim().length > 0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|