vscode-behavior3 2.3.3 → 2.5.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/build.d.ts +30 -21
- package/dist/build-cli.js +351 -113
- package/dist/extension.js +607 -135
- package/dist/webview/assets/editor-BPxOdZMY.js +8 -0
- package/dist/webview/assets/editor-CPHgtP2i.css +1 -0
- package/dist/webview/assets/vendor-ZD6A8unu.js +62 -0
- package/dist/webview/index.html +3 -3
- package/package.json +2 -2
- package/webview/shared/b3build-model.d.ts +189 -16
- package/dist/webview/assets/editor-CTBBjkkm.css +0 -1
- package/dist/webview/assets/editor-DuZsOgps.js +0 -8
- package/dist/webview/assets/vendor-Ctok02TG.js +0 -61
package/dist/extension.js
CHANGED
|
@@ -212530,6 +212530,12 @@ var Node = class _Node {
|
|
|
212530
212530
|
info(msg) {
|
|
212531
212531
|
console.info(`${this.cfg.tree.name}->${this.name}#${this.id}: ${msg}`);
|
|
212532
212532
|
}
|
|
212533
|
+
/**
|
|
212534
|
+
* use console.log to print log message
|
|
212535
|
+
*/
|
|
212536
|
+
log(msg) {
|
|
212537
|
+
console.log(`${this.cfg.tree.name}->${this.name}#${this.id}: ${msg}`);
|
|
212538
|
+
}
|
|
212533
212539
|
_checkOneof(inputIndex, argValue, defaultValue) {
|
|
212534
212540
|
const inputValue = this.input[inputIndex];
|
|
212535
212541
|
const inputName = this.cfg.input[inputIndex];
|
|
@@ -212768,17 +212774,24 @@ var Context = class {
|
|
|
212768
212774
|
return Node.create(this, treeCfg.root);
|
|
212769
212775
|
}
|
|
212770
212776
|
};
|
|
212771
|
-
var
|
|
212777
|
+
var StackSlice = class {
|
|
212772
212778
|
_nodes = [];
|
|
212773
|
-
_tree;
|
|
212774
|
-
constructor(tree) {
|
|
212775
|
-
this._tree = tree;
|
|
212776
|
-
}
|
|
212777
212779
|
get length() {
|
|
212778
212780
|
return this._nodes.length;
|
|
212779
212781
|
}
|
|
212780
|
-
|
|
212781
|
-
|
|
212782
|
+
move(dest, start) {
|
|
212783
|
+
const count = this._nodes.length - start;
|
|
212784
|
+
dest._nodes.push(...this._nodes.splice(start, count));
|
|
212785
|
+
}
|
|
212786
|
+
clear() {
|
|
212787
|
+
this._nodes.length = 0;
|
|
212788
|
+
}
|
|
212789
|
+
};
|
|
212790
|
+
var Stack = class extends StackSlice {
|
|
212791
|
+
_tree;
|
|
212792
|
+
constructor(tree) {
|
|
212793
|
+
super();
|
|
212794
|
+
this._tree = tree;
|
|
212782
212795
|
}
|
|
212783
212796
|
top() {
|
|
212784
212797
|
const nodes = this._nodes;
|
|
@@ -212799,9 +212812,6 @@ var Stack = class {
|
|
|
212799
212812
|
this.pop();
|
|
212800
212813
|
}
|
|
212801
212814
|
}
|
|
212802
|
-
move(dest, start, count) {
|
|
212803
|
-
dest._nodes.push(...this._nodes.splice(start, count));
|
|
212804
|
-
}
|
|
212805
212815
|
clear() {
|
|
212806
212816
|
this.popTo(0);
|
|
212807
212817
|
}
|
|
@@ -213710,7 +213720,7 @@ var Parallel = class extends (_a17 = Node) {
|
|
|
213710
213720
|
if (childStack === void 0) {
|
|
213711
213721
|
status = children[i].tick(tree);
|
|
213712
213722
|
} else if (childStack.length > 0) {
|
|
213713
|
-
childStack.move(stack, 0
|
|
213723
|
+
childStack.move(stack, 0);
|
|
213714
213724
|
while (stack.length > level) {
|
|
213715
213725
|
status = stack.top().tick(tree);
|
|
213716
213726
|
if (status === "running") {
|
|
@@ -213722,9 +213732,9 @@ var Parallel = class extends (_a17 = Node) {
|
|
|
213722
213732
|
}
|
|
213723
213733
|
if (status === "running") {
|
|
213724
213734
|
if (childStack === void 0) {
|
|
213725
|
-
childStack = new
|
|
213735
|
+
childStack = new StackSlice();
|
|
213726
213736
|
}
|
|
213727
|
-
stack.move(childStack, level
|
|
213737
|
+
stack.move(childStack, level);
|
|
213728
213738
|
} else {
|
|
213729
213739
|
count++;
|
|
213730
213740
|
childStack = EMPTY_STACK$1;
|
|
@@ -213770,7 +213780,7 @@ var Race = class extends (_a18 = Node) {
|
|
|
213770
213780
|
if (childStack === void 0) {
|
|
213771
213781
|
status = children[i].tick(tree);
|
|
213772
213782
|
} else if (childStack.length > 0) {
|
|
213773
|
-
childStack.move(stack, 0
|
|
213783
|
+
childStack.move(stack, 0);
|
|
213774
213784
|
while (stack.length > level) {
|
|
213775
213785
|
status = stack.top().tick(tree);
|
|
213776
213786
|
if (status === "running") {
|
|
@@ -213780,9 +213790,9 @@ var Race = class extends (_a18 = Node) {
|
|
|
213780
213790
|
}
|
|
213781
213791
|
if (status === "running") {
|
|
213782
213792
|
if (childStack === void 0) {
|
|
213783
|
-
childStack = new
|
|
213793
|
+
childStack = new StackSlice();
|
|
213784
213794
|
}
|
|
213785
|
-
stack.move(childStack, level
|
|
213795
|
+
stack.move(childStack, level);
|
|
213786
213796
|
} else if (status === "success") {
|
|
213787
213797
|
last.forEach((v) => v !== EMPTY_STACK && v.clear());
|
|
213788
213798
|
return "success";
|
|
@@ -214018,7 +214028,7 @@ var Watchdog = class extends (_a23 = Node) {
|
|
|
214018
214028
|
} else if (last === void 0) {
|
|
214019
214029
|
status = this.children[1].tick(tree);
|
|
214020
214030
|
} else {
|
|
214021
|
-
last.move(tree.stack, 0
|
|
214031
|
+
last.move(tree.stack, 0);
|
|
214022
214032
|
while (tree.stack.length > level) {
|
|
214023
214033
|
const child = tree.stack.top();
|
|
214024
214034
|
status = child.tick(tree);
|
|
@@ -214029,9 +214039,9 @@ var Watchdog = class extends (_a23 = Node) {
|
|
|
214029
214039
|
}
|
|
214030
214040
|
if (status === "running") {
|
|
214031
214041
|
if (last === void 0) {
|
|
214032
|
-
last = new
|
|
214042
|
+
last = new StackSlice();
|
|
214033
214043
|
}
|
|
214034
|
-
tree.stack.move(last, level
|
|
214044
|
+
tree.stack.move(last, level);
|
|
214035
214045
|
return tree.yield(this, last);
|
|
214036
214046
|
} else {
|
|
214037
214047
|
return status;
|
|
@@ -214857,7 +214867,7 @@ var Timeout = class extends (_a41 = Node) {
|
|
|
214857
214867
|
last.stack.clear();
|
|
214858
214868
|
return "failure";
|
|
214859
214869
|
} else {
|
|
214860
|
-
last.stack.move(stack, 0
|
|
214870
|
+
last.stack.move(stack, 0);
|
|
214861
214871
|
while (stack.length > level) {
|
|
214862
214872
|
const child = stack.top();
|
|
214863
214873
|
status = child.tick(tree);
|
|
@@ -214870,11 +214880,11 @@ var Timeout = class extends (_a41 = Node) {
|
|
|
214870
214880
|
if (last === void 0) {
|
|
214871
214881
|
const time = this._checkOneof(0, this.args.time, 0);
|
|
214872
214882
|
last = {
|
|
214873
|
-
stack: new
|
|
214883
|
+
stack: new StackSlice(),
|
|
214874
214884
|
expired: context.time + time
|
|
214875
214885
|
};
|
|
214876
214886
|
}
|
|
214877
|
-
stack.move(last.stack, level
|
|
214887
|
+
stack.move(last.stack, level);
|
|
214878
214888
|
return tree.yield(this, last);
|
|
214879
214889
|
} else {
|
|
214880
214890
|
return status;
|
|
@@ -214897,6 +214907,7 @@ var Timeout = class extends (_a41 = Node) {
|
|
|
214897
214907
|
}
|
|
214898
214908
|
],
|
|
214899
214909
|
doc: `
|
|
214910
|
+
+ \u5728\u9650\u5B9A\u65F6\u95F4\u5185\u6267\u884C\u5B50\u8282\u70B9\uFF0C\u8D85\u65F6\u5219\u5931\u8D25
|
|
214900
214911
|
+ \u53EA\u80FD\u6709\u4E00\u4E2A\u5B50\u8282\u70B9\uFF0C\u591A\u4E2A\u4EC5\u6267\u884C\u7B2C\u4E00\u4E2A
|
|
214901
214912
|
+ \u5F53\u5B50\u8282\u70B9\u6267\u884C\u8D85\u65F6\u6216\u8FD4\u56DE \`failure\` \u65F6\uFF0C\u8FD4\u56DE \`failure\`
|
|
214902
214913
|
+ \u5176\u4F59\u60C5\u51B5\u8FD4\u56DE\u5B50\u8282\u70B9\u7684\u6267\u884C\u72B6\u6001
|
|
@@ -215392,6 +215403,34 @@ var asStringArray = (value, label) => {
|
|
|
215392
215403
|
return entry;
|
|
215393
215404
|
});
|
|
215394
215405
|
};
|
|
215406
|
+
var normalizeNodeLabel = (label, record) => {
|
|
215407
|
+
const rawNodeName = record.name;
|
|
215408
|
+
if (typeof rawNodeName !== "string" || !rawNodeName.trim()) {
|
|
215409
|
+
return label;
|
|
215410
|
+
}
|
|
215411
|
+
return `${label}(${rawNodeName.trim()})`;
|
|
215412
|
+
};
|
|
215413
|
+
var normalizeNodeSlotEntry = (value, label) => {
|
|
215414
|
+
if (typeof value === "string") {
|
|
215415
|
+
return asRequiredString(value, label);
|
|
215416
|
+
}
|
|
215417
|
+
const record = expectPlainRecord(value, label);
|
|
215418
|
+
return {
|
|
215419
|
+
name: asRequiredString(record.name, `${label}.name`),
|
|
215420
|
+
checker: asOptionalNonEmptyString(record.checker, `${label}.checker`),
|
|
215421
|
+
visible: asOptionalNonEmptyString(record.visible, `${label}.visible`)
|
|
215422
|
+
};
|
|
215423
|
+
};
|
|
215424
|
+
var normalizeNodeSlots = (value, label) => {
|
|
215425
|
+
if (value === void 0) {
|
|
215426
|
+
return void 0;
|
|
215427
|
+
}
|
|
215428
|
+
if (!Array.isArray(value)) {
|
|
215429
|
+
throw new Error(`${label} must be an array`);
|
|
215430
|
+
}
|
|
215431
|
+
const slots = value.map((entry, index) => normalizeNodeSlotEntry(entry, `${label}[${index}]`));
|
|
215432
|
+
return slots.length > 0 ? slots : void 0;
|
|
215433
|
+
};
|
|
215395
215434
|
var asWorkdirRelativeJsonPathArray = (value, label) => {
|
|
215396
215435
|
const entries = asStringArray(value, label);
|
|
215397
215436
|
return entries.map((entry, index) => {
|
|
@@ -215502,44 +215541,43 @@ var normalizeNodeArgs = (value, label) => {
|
|
|
215502
215541
|
oneof: asOptionalString(record.oneof),
|
|
215503
215542
|
default: record.default,
|
|
215504
215543
|
options: normalizeNodeArgOptions(record.options, `${label}[${index}].options`),
|
|
215505
|
-
checker: asOptionalNonEmptyString(record.checker, `${label}[${index}].checker`)
|
|
215544
|
+
checker: asOptionalNonEmptyString(record.checker, `${label}[${index}].checker`),
|
|
215545
|
+
visible: asOptionalNonEmptyString(record.visible, `${label}[${index}].visible`)
|
|
215506
215546
|
};
|
|
215507
215547
|
});
|
|
215508
215548
|
};
|
|
215509
215549
|
var normalizeNodeDef = (value, label) => {
|
|
215510
215550
|
const record = expectPlainRecord(value, label);
|
|
215511
|
-
const
|
|
215551
|
+
const nodeLabel = normalizeNodeLabel(label, record);
|
|
215552
|
+
const name = asRequiredString(record.name, `${nodeLabel}.name`);
|
|
215553
|
+
const type = asRequiredString(record.type, `${nodeLabel}.type`);
|
|
215512
215554
|
if (!NODE_DEF_TYPES.has(type)) {
|
|
215513
|
-
throw new Error(
|
|
215555
|
+
throw new Error(
|
|
215556
|
+
`${nodeLabel}.type must be one of ${Array.from(NODE_DEF_TYPES).join(", ")}`
|
|
215557
|
+
);
|
|
215514
215558
|
}
|
|
215515
215559
|
const groupValue = record.group;
|
|
215516
215560
|
const group = groupValue === void 0 ? void 0 : Array.isArray(groupValue) ? groupValue.map(
|
|
215517
|
-
(entry, index) => asRequiredString(entry, `${
|
|
215518
|
-
) : [asRequiredString(groupValue, `${
|
|
215561
|
+
(entry, index) => asRequiredString(entry, `${nodeLabel}.group[${index}]`)
|
|
215562
|
+
) : [asRequiredString(groupValue, `${nodeLabel}.group`)];
|
|
215519
215563
|
const childrenValue = record.children;
|
|
215520
215564
|
if (childrenValue !== void 0 && !CHILDREN_ARITIES.has(childrenValue)) {
|
|
215521
|
-
throw new Error(`${
|
|
215565
|
+
throw new Error(`${nodeLabel}.children must be one of -1, 0, 1, 2, 3`);
|
|
215522
215566
|
}
|
|
215523
215567
|
const statusValue = record.status;
|
|
215524
|
-
const status = statusValue === void 0 ? void 0 : asStringArray(statusValue, `${
|
|
215568
|
+
const status = statusValue === void 0 ? void 0 : asStringArray(statusValue, `${nodeLabel}.status`).map((entry) => {
|
|
215525
215569
|
if (!NODE_STATUS_VALUES.has(entry)) {
|
|
215526
|
-
throw new Error(`${
|
|
215570
|
+
throw new Error(`${nodeLabel}.status contains unsupported value: ${entry}`);
|
|
215527
215571
|
}
|
|
215528
215572
|
return entry;
|
|
215529
215573
|
});
|
|
215530
215574
|
return {
|
|
215531
|
-
name
|
|
215575
|
+
name,
|
|
215532
215576
|
type,
|
|
215533
215577
|
desc: asOptionalString(record.desc) ?? "",
|
|
215534
|
-
input: (
|
|
215535
|
-
|
|
215536
|
-
|
|
215537
|
-
})(),
|
|
215538
|
-
output: (() => {
|
|
215539
|
-
const output = asStringArray(record.output, `${label}.output`);
|
|
215540
|
-
return output.length > 0 ? output : void 0;
|
|
215541
|
-
})(),
|
|
215542
|
-
args: normalizeNodeArgs(record.args, `${label}.args`),
|
|
215578
|
+
input: normalizeNodeSlots(record.input, `${nodeLabel}.input`),
|
|
215579
|
+
output: normalizeNodeSlots(record.output, `${nodeLabel}.output`),
|
|
215580
|
+
args: normalizeNodeArgs(record.args, `${nodeLabel}.args`),
|
|
215543
215581
|
doc: asOptionalString(record.doc),
|
|
215544
215582
|
icon: asOptionalString(record.icon),
|
|
215545
215583
|
color: asOptionalString(record.color),
|
|
@@ -216146,16 +216184,22 @@ var findNodeDef = (nodeDefMap, nodeName) => {
|
|
|
216146
216184
|
return nodeDefMap.get(nodeName) ?? null;
|
|
216147
216185
|
};
|
|
216148
216186
|
var cleanSlotLabel = (value) => value.replace(/\.\.\.$/, "").replace(/\?/g, "");
|
|
216187
|
+
var isStructuredSlotDefinition = (slot) => Boolean(slot && typeof slot === "object" && !Array.isArray(slot));
|
|
216149
216188
|
var parseSlotDefinition = (slot, slotDefs, index) => {
|
|
216150
|
-
const raw = slot ?? "";
|
|
216189
|
+
const raw = typeof slot === "string" ? slot : slot?.name ?? "";
|
|
216151
216190
|
const hasOptionalMarker = raw.includes("?");
|
|
216152
216191
|
const hasVariadicMarker = raw.endsWith("...");
|
|
216153
216192
|
const variadic = hasVariadicMarker && (slotDefs && index !== void 0 ? index === slotDefs.length - 1 : true);
|
|
216193
|
+
const checker = isStructuredSlotDefinition(slot) ? slot.checker?.trim() || void 0 : void 0;
|
|
216194
|
+
const visible = isStructuredSlotDefinition(slot) ? slot.visible?.trim() || void 0 : void 0;
|
|
216154
216195
|
return {
|
|
216155
216196
|
raw,
|
|
216197
|
+
name: cleanSlotLabel(raw),
|
|
216156
216198
|
label: cleanSlotLabel(raw),
|
|
216157
216199
|
required: !hasOptionalMarker,
|
|
216158
|
-
variadic
|
|
216200
|
+
variadic,
|
|
216201
|
+
checker,
|
|
216202
|
+
visible
|
|
216159
216203
|
};
|
|
216160
216204
|
};
|
|
216161
216205
|
var getNodeArgRawType = (arg) => {
|
|
@@ -216478,6 +216522,8 @@ var BUILD_HOOK_MARKER = "__behavior3BuildHook";
|
|
|
216478
216522
|
var BATCH_HOOK_MARKER = "__behavior3BatchHook";
|
|
216479
216523
|
var CHECK_HOOK_MARKER = "__behavior3CheckHook";
|
|
216480
216524
|
var CHECK_HOOK_NAME = "__behavior3CheckName";
|
|
216525
|
+
var VISIBLE_HOOK_MARKER = "__behavior3VisibleHook";
|
|
216526
|
+
var VISIBLE_HOOK_NAME = "__behavior3VisibleName";
|
|
216481
216527
|
var markBuildHook = (ctor) => {
|
|
216482
216528
|
Object.defineProperty(ctor, BUILD_HOOK_MARKER, {
|
|
216483
216529
|
value: true,
|
|
@@ -216504,15 +216550,34 @@ var markCheckCtor = (ctor, explicitName) => {
|
|
|
216504
216550
|
});
|
|
216505
216551
|
return ctor;
|
|
216506
216552
|
};
|
|
216553
|
+
var markVisibleCtor = (ctor, explicitName) => {
|
|
216554
|
+
const name = explicitName?.trim() || ctor.name;
|
|
216555
|
+
Object.defineProperty(ctor, VISIBLE_HOOK_MARKER, {
|
|
216556
|
+
value: true,
|
|
216557
|
+
configurable: false
|
|
216558
|
+
});
|
|
216559
|
+
Object.defineProperty(ctor, VISIBLE_HOOK_NAME, {
|
|
216560
|
+
value: name,
|
|
216561
|
+
configurable: false
|
|
216562
|
+
});
|
|
216563
|
+
return ctor;
|
|
216564
|
+
};
|
|
216507
216565
|
var markCheckHook = (nameOrCtor, _context) => {
|
|
216508
216566
|
if (typeof nameOrCtor === "function") {
|
|
216509
216567
|
return markCheckCtor(nameOrCtor);
|
|
216510
216568
|
}
|
|
216511
216569
|
return (ctor) => markCheckCtor(ctor, nameOrCtor);
|
|
216512
216570
|
};
|
|
216571
|
+
var markVisibleHook = (nameOrCtor, _context) => {
|
|
216572
|
+
if (typeof nameOrCtor === "function") {
|
|
216573
|
+
return markVisibleCtor(nameOrCtor);
|
|
216574
|
+
}
|
|
216575
|
+
return (ctor) => markVisibleCtor(ctor, nameOrCtor);
|
|
216576
|
+
};
|
|
216513
216577
|
var isDecoratedBuildHookCtor = (value) => typeof value === "function" && value[BUILD_HOOK_MARKER] === true;
|
|
216514
216578
|
var isDecoratedBatchHookCtor = (value) => typeof value === "function" && value[BATCH_HOOK_MARKER] === true;
|
|
216515
216579
|
var isDecoratedCheckCtor = (value) => typeof value === "function" && value[CHECK_HOOK_MARKER] === true;
|
|
216580
|
+
var isDecoratedVisibleCtor = (value) => typeof value === "function" && value[VISIBLE_HOOK_MARKER] === true;
|
|
216516
216581
|
var findDecoratedBuildHookCtor = (moduleRecord) => {
|
|
216517
216582
|
const decorated = Array.from(new Set(Object.values(moduleRecord))).filter(
|
|
216518
216583
|
isDecoratedBuildHookCtor
|
|
@@ -216544,6 +216609,7 @@ var findDecoratedBatchHookCtor = (moduleRecord) => {
|
|
|
216544
216609
|
return legacyDecorated[0];
|
|
216545
216610
|
};
|
|
216546
216611
|
var findDecoratedCheckCtors = (moduleRecord) => Array.from(new Set(Object.values(moduleRecord))).filter(isDecoratedCheckCtor);
|
|
216612
|
+
var findDecoratedVisibleCtors = (moduleRecord) => Array.from(new Set(Object.values(moduleRecord))).filter(isDecoratedVisibleCtor);
|
|
216547
216613
|
var createBuildHooks = (moduleExports, env2, reportMissing = true) => {
|
|
216548
216614
|
if (!moduleExports || typeof moduleExports !== "object") {
|
|
216549
216615
|
return void 0;
|
|
@@ -216594,7 +216660,7 @@ var createBatchHooks = (moduleExports, env2, reportMissing = true) => {
|
|
|
216594
216660
|
}
|
|
216595
216661
|
return void 0;
|
|
216596
216662
|
};
|
|
216597
|
-
var
|
|
216663
|
+
var createNodeFieldCheckers = (moduleExports, env2) => {
|
|
216598
216664
|
const checkers = /* @__PURE__ */ new Map();
|
|
216599
216665
|
let hasError = false;
|
|
216600
216666
|
if (!moduleExports || typeof moduleExports !== "object") {
|
|
@@ -216629,10 +216695,70 @@ var createNodeArgCheckers = (moduleExports, env2) => {
|
|
|
216629
216695
|
}
|
|
216630
216696
|
return { checkers, hasError, hasCheckers: decorated.length > 0 };
|
|
216631
216697
|
};
|
|
216698
|
+
var normalizeNodeFieldVisibleResult = (result) => result !== false;
|
|
216699
|
+
var createNodeFieldVisibles = (moduleExports, env2) => {
|
|
216700
|
+
const visibles = /* @__PURE__ */ new Map();
|
|
216701
|
+
let hasError = false;
|
|
216702
|
+
if (!moduleExports || typeof moduleExports !== "object") {
|
|
216703
|
+
return { visibles, hasError, hasVisibles: false };
|
|
216704
|
+
}
|
|
216705
|
+
const moduleRecord = moduleExports;
|
|
216706
|
+
const decorated = findDecoratedVisibleCtors(moduleRecord);
|
|
216707
|
+
for (const ctor of decorated) {
|
|
216708
|
+
const name = ctor[VISIBLE_HOOK_NAME]?.trim() || ctor.name;
|
|
216709
|
+
if (!name) {
|
|
216710
|
+
logger.error("visible class must have a non-empty @behavior3.visible name");
|
|
216711
|
+
hasError = true;
|
|
216712
|
+
continue;
|
|
216713
|
+
}
|
|
216714
|
+
if (visibles.has(name)) {
|
|
216715
|
+
logger.error(`duplicate @behavior3.visible registration: ${name}`);
|
|
216716
|
+
hasError = true;
|
|
216717
|
+
continue;
|
|
216718
|
+
}
|
|
216719
|
+
try {
|
|
216720
|
+
const instance = new ctor(env2);
|
|
216721
|
+
if (typeof instance.visible !== "function") {
|
|
216722
|
+
logger.error(`visible '${name}' must provide a visible(value, ctx) method`);
|
|
216723
|
+
hasError = true;
|
|
216724
|
+
continue;
|
|
216725
|
+
}
|
|
216726
|
+
visibles.set(name, instance);
|
|
216727
|
+
} catch (error) {
|
|
216728
|
+
logger.error(`failed to instantiate visible '${name}'`, error);
|
|
216729
|
+
hasError = true;
|
|
216730
|
+
}
|
|
216731
|
+
}
|
|
216732
|
+
return { visibles, hasError, hasVisibles: decorated.length > 0 };
|
|
216733
|
+
};
|
|
216734
|
+
var createNodeFieldVisibleRuntimeWithCheckModules = (buildScriptModule, checkScriptModules, env2) => {
|
|
216735
|
+
const nodeFieldVisibles = /* @__PURE__ */ new Map();
|
|
216736
|
+
let hasError = false;
|
|
216737
|
+
const mergeModuleVisibles = (moduleExports) => {
|
|
216738
|
+
const visibleResult = createNodeFieldVisibles(moduleExports, env2);
|
|
216739
|
+
hasError = hasError || visibleResult.hasError;
|
|
216740
|
+
for (const [name, visible] of visibleResult.visibles) {
|
|
216741
|
+
if (nodeFieldVisibles.has(name)) {
|
|
216742
|
+
logger.error(`duplicate @behavior3.visible registration: ${name}`);
|
|
216743
|
+
hasError = true;
|
|
216744
|
+
continue;
|
|
216745
|
+
}
|
|
216746
|
+
nodeFieldVisibles.set(name, visible);
|
|
216747
|
+
}
|
|
216748
|
+
};
|
|
216749
|
+
mergeModuleVisibles(buildScriptModule);
|
|
216750
|
+
for (const checkScript of checkScriptModules) {
|
|
216751
|
+
mergeModuleVisibles(checkScript.moduleExports);
|
|
216752
|
+
}
|
|
216753
|
+
return {
|
|
216754
|
+
nodeFieldVisibles,
|
|
216755
|
+
hasError
|
|
216756
|
+
};
|
|
216757
|
+
};
|
|
216632
216758
|
var createBuildScriptRuntime = (moduleExports, env2) => {
|
|
216633
216759
|
if (!moduleExports || typeof moduleExports !== "object") {
|
|
216634
216760
|
return {
|
|
216635
|
-
|
|
216761
|
+
nodeFieldCheckers: /* @__PURE__ */ new Map(),
|
|
216636
216762
|
hasError: false,
|
|
216637
216763
|
hasEntries: false
|
|
216638
216764
|
};
|
|
@@ -216640,7 +216766,7 @@ var createBuildScriptRuntime = (moduleExports, env2) => {
|
|
|
216640
216766
|
const moduleRecord = moduleExports;
|
|
216641
216767
|
const hasBuildHookCandidate = typeof moduleRecord.BuildHook === "function" || typeof moduleRecord.Hook === "function" || Object.values(moduleRecord).some(isDecoratedBuildHookCtor) || typeof moduleRecord.default === "function" && !isDecoratedCheckCtor(moduleRecord.default) && !isDecoratedBatchHookCtor(moduleRecord.default);
|
|
216642
216768
|
const buildScript = createBuildHooks(moduleExports, env2, false);
|
|
216643
|
-
const checkerResult =
|
|
216769
|
+
const checkerResult = createNodeFieldCheckers(moduleExports, env2);
|
|
216644
216770
|
const hasEntries = Boolean(buildScript) || checkerResult.hasCheckers;
|
|
216645
216771
|
if (!hasEntries) {
|
|
216646
216772
|
logger.error(
|
|
@@ -216649,39 +216775,35 @@ var createBuildScriptRuntime = (moduleExports, env2) => {
|
|
|
216649
216775
|
}
|
|
216650
216776
|
return {
|
|
216651
216777
|
buildScript,
|
|
216652
|
-
|
|
216778
|
+
nodeFieldCheckers: checkerResult.checkers,
|
|
216653
216779
|
hasError: checkerResult.hasError || !hasEntries || hasBuildHookCandidate && !buildScript,
|
|
216654
216780
|
hasEntries
|
|
216655
216781
|
};
|
|
216656
216782
|
};
|
|
216657
216783
|
var createBuildScriptRuntimeWithCheckModules = (buildScriptModule, checkScriptModules, env2) => {
|
|
216658
216784
|
const runtime = createBuildScriptRuntime(buildScriptModule, env2);
|
|
216659
|
-
const
|
|
216785
|
+
const nodeFieldCheckers = new Map(runtime.nodeFieldCheckers);
|
|
216660
216786
|
let hasError = runtime.hasError;
|
|
216661
216787
|
let hasCheckEntries = false;
|
|
216662
216788
|
for (const checkScript of checkScriptModules) {
|
|
216663
|
-
const checkerResult =
|
|
216789
|
+
const checkerResult = createNodeFieldCheckers(checkScript.moduleExports, env2);
|
|
216664
216790
|
if (!checkerResult.hasCheckers) {
|
|
216665
|
-
logger.error(
|
|
216666
|
-
`check script must export at least one @behavior3.check class: ${checkScript.path}`
|
|
216667
|
-
);
|
|
216668
|
-
hasError = true;
|
|
216669
216791
|
continue;
|
|
216670
216792
|
}
|
|
216671
216793
|
hasCheckEntries = true;
|
|
216672
216794
|
hasError = hasError || checkerResult.hasError;
|
|
216673
216795
|
for (const [name, checker] of checkerResult.checkers) {
|
|
216674
|
-
if (
|
|
216796
|
+
if (nodeFieldCheckers.has(name)) {
|
|
216675
216797
|
logger.error(`duplicate @behavior3.check registration: ${name}`);
|
|
216676
216798
|
hasError = true;
|
|
216677
216799
|
continue;
|
|
216678
216800
|
}
|
|
216679
|
-
|
|
216801
|
+
nodeFieldCheckers.set(name, checker);
|
|
216680
216802
|
}
|
|
216681
216803
|
}
|
|
216682
216804
|
return {
|
|
216683
216805
|
...runtime,
|
|
216684
|
-
|
|
216806
|
+
nodeFieldCheckers,
|
|
216685
216807
|
hasError,
|
|
216686
216808
|
hasEntries: runtime.hasEntries || hasCheckEntries
|
|
216687
216809
|
};
|
|
@@ -216827,7 +216949,12 @@ var processBatchTree = (tree, treePath, batch, errors) => {
|
|
|
216827
216949
|
}
|
|
216828
216950
|
return tree;
|
|
216829
216951
|
};
|
|
216830
|
-
var
|
|
216952
|
+
var createEmptyNodeFieldVisibilityState = () => ({
|
|
216953
|
+
args: {},
|
|
216954
|
+
input: {},
|
|
216955
|
+
output: {}
|
|
216956
|
+
});
|
|
216957
|
+
var normalizeNodeFieldCheckResult = (result) => {
|
|
216831
216958
|
if (Array.isArray(result)) {
|
|
216832
216959
|
return result.filter((entry) => typeof entry === "string" && entry.trim());
|
|
216833
216960
|
}
|
|
@@ -216845,7 +216972,105 @@ var walkTreeNodes = (node, visit) => {
|
|
|
216845
216972
|
walkTreeNodes(child, visit);
|
|
216846
216973
|
}
|
|
216847
216974
|
};
|
|
216848
|
-
var
|
|
216975
|
+
var buildNodeSlotField = (slot, slotDefs, index) => {
|
|
216976
|
+
const parsed = parseSlotDefinition(slot, slotDefs, index);
|
|
216977
|
+
return {
|
|
216978
|
+
name: parsed.name,
|
|
216979
|
+
label: parsed.label,
|
|
216980
|
+
required: parsed.required,
|
|
216981
|
+
variadic: parsed.variadic,
|
|
216982
|
+
checker: parsed.checker,
|
|
216983
|
+
visible: parsed.visible
|
|
216984
|
+
};
|
|
216985
|
+
};
|
|
216986
|
+
var getSlotValue = (values, slotDefs, index) => {
|
|
216987
|
+
const slotField = parseSlotDefinition(slotDefs?.[index] ?? "", slotDefs, index);
|
|
216988
|
+
return slotField.variadic ? values?.slice(index) ?? [] : values?.[index];
|
|
216989
|
+
};
|
|
216990
|
+
var formatFieldLocator = (node, fieldKind, fieldName, fieldIndex) => {
|
|
216991
|
+
if (fieldKind === "arg") {
|
|
216992
|
+
return `${node.id}|${node.name}.${fieldName}`;
|
|
216993
|
+
}
|
|
216994
|
+
return `${node.id}|${node.name}.${fieldKind}[${fieldIndex ?? 0}:${fieldName}]`;
|
|
216995
|
+
};
|
|
216996
|
+
var getNodeSlotContext = (params) => {
|
|
216997
|
+
if (!isStructuredSlotDefinition(params.slot)) {
|
|
216998
|
+
return null;
|
|
216999
|
+
}
|
|
217000
|
+
return {
|
|
217001
|
+
node: params.node,
|
|
217002
|
+
tree: params.tree,
|
|
217003
|
+
nodeDef: params.nodeDef,
|
|
217004
|
+
fieldKind: params.fieldKind,
|
|
217005
|
+
fieldName: buildNodeSlotField(params.slot, params.slotDefs, params.index).name,
|
|
217006
|
+
fieldIndex: params.index,
|
|
217007
|
+
slot: params.fieldKind === "input" ? params.slot : params.slot,
|
|
217008
|
+
slotField: buildNodeSlotField(params.slot, params.slotDefs, params.index),
|
|
217009
|
+
treePath: params.treePath,
|
|
217010
|
+
env: params.env
|
|
217011
|
+
};
|
|
217012
|
+
};
|
|
217013
|
+
var visitCustomNodeFields = (params) => {
|
|
217014
|
+
for (const arg of params.nodeDef.args ?? []) {
|
|
217015
|
+
const checkerName = arg.checker?.trim() || void 0;
|
|
217016
|
+
const visibleName = arg.visible?.trim() || void 0;
|
|
217017
|
+
if (!(checkerName || visibleName)) {
|
|
217018
|
+
continue;
|
|
217019
|
+
}
|
|
217020
|
+
const ctx = {
|
|
217021
|
+
node: params.node,
|
|
217022
|
+
tree: params.tree,
|
|
217023
|
+
nodeDef: params.nodeDef,
|
|
217024
|
+
fieldKind: "arg",
|
|
217025
|
+
fieldName: arg.name,
|
|
217026
|
+
arg,
|
|
217027
|
+
treePath: params.treePath,
|
|
217028
|
+
env: params.env
|
|
217029
|
+
};
|
|
217030
|
+
params.onArg?.({
|
|
217031
|
+
fieldName: arg.name,
|
|
217032
|
+
checkerName,
|
|
217033
|
+
visibleName,
|
|
217034
|
+
value: params.node.args?.[arg.name],
|
|
217035
|
+
ctx
|
|
217036
|
+
});
|
|
217037
|
+
}
|
|
217038
|
+
for (const [fieldKind, slotDefs, values, visitor] of [
|
|
217039
|
+
["input", params.nodeDef.input, params.node.input, params.onInput],
|
|
217040
|
+
["output", params.nodeDef.output, params.node.output, params.onOutput]
|
|
217041
|
+
]) {
|
|
217042
|
+
for (let index = 0; index < (slotDefs?.length ?? 0); index += 1) {
|
|
217043
|
+
const slot = slotDefs?.[index] ?? "";
|
|
217044
|
+
const slotField = buildNodeSlotField(slot, slotDefs, index);
|
|
217045
|
+
if (!(slotField.checker || slotField.visible)) {
|
|
217046
|
+
continue;
|
|
217047
|
+
}
|
|
217048
|
+
const ctx = getNodeSlotContext({
|
|
217049
|
+
fieldKind,
|
|
217050
|
+
node: params.node,
|
|
217051
|
+
tree: params.tree,
|
|
217052
|
+
nodeDef: params.nodeDef,
|
|
217053
|
+
slotDefs,
|
|
217054
|
+
slot,
|
|
217055
|
+
index,
|
|
217056
|
+
treePath: params.treePath,
|
|
217057
|
+
env: params.env
|
|
217058
|
+
});
|
|
217059
|
+
if (!ctx) {
|
|
217060
|
+
continue;
|
|
217061
|
+
}
|
|
217062
|
+
visitor?.({
|
|
217063
|
+
fieldName: slotField.name,
|
|
217064
|
+
fieldIndex: index,
|
|
217065
|
+
checkerName: slotField.checker,
|
|
217066
|
+
visibleName: slotField.visible,
|
|
217067
|
+
value: getSlotValue(values, slotDefs, index),
|
|
217068
|
+
ctx
|
|
217069
|
+
});
|
|
217070
|
+
}
|
|
217071
|
+
}
|
|
217072
|
+
};
|
|
217073
|
+
var collectNodeFieldCheckDiagnostics = (params) => {
|
|
216849
217074
|
const diagnostics = [];
|
|
216850
217075
|
const targets = params.targets ?? [];
|
|
216851
217076
|
const entries = targets.length ? targets : (() => {
|
|
@@ -216859,47 +217084,182 @@ var collectNodeArgCheckDiagnostics = (params) => {
|
|
|
216859
217084
|
if (!nodeDef) {
|
|
216860
217085
|
continue;
|
|
216861
217086
|
}
|
|
216862
|
-
|
|
216863
|
-
|
|
216864
|
-
|
|
216865
|
-
|
|
217087
|
+
visitCustomNodeFields({
|
|
217088
|
+
node,
|
|
217089
|
+
tree: params.tree,
|
|
217090
|
+
nodeDef,
|
|
217091
|
+
treePath: target.treePath ?? params.treePath,
|
|
217092
|
+
env: params.env,
|
|
217093
|
+
onArg: ({ fieldName, checkerName, value, ctx }) => {
|
|
217094
|
+
if (!checkerName) {
|
|
217095
|
+
return;
|
|
217096
|
+
}
|
|
217097
|
+
const pushDiagnostic = (message) => {
|
|
217098
|
+
diagnostics.push({
|
|
217099
|
+
instanceKey: target.instanceKey,
|
|
217100
|
+
nodeId: node.id,
|
|
217101
|
+
nodeName: node.name,
|
|
217102
|
+
fieldKind: "arg",
|
|
217103
|
+
fieldName,
|
|
217104
|
+
checker: checkerName,
|
|
217105
|
+
message
|
|
217106
|
+
});
|
|
217107
|
+
};
|
|
217108
|
+
const checker = params.checkers.get(checkerName);
|
|
217109
|
+
if (!checker) {
|
|
217110
|
+
pushDiagnostic(`checker '${checkerName}' is not registered`);
|
|
217111
|
+
return;
|
|
217112
|
+
}
|
|
217113
|
+
try {
|
|
217114
|
+
const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
|
|
217115
|
+
messages.forEach(pushDiagnostic);
|
|
217116
|
+
} catch (error) {
|
|
217117
|
+
pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
|
|
217118
|
+
}
|
|
217119
|
+
},
|
|
217120
|
+
onInput: ({ fieldName, fieldIndex, checkerName, value, ctx }) => {
|
|
217121
|
+
if (!checkerName) {
|
|
217122
|
+
return;
|
|
217123
|
+
}
|
|
217124
|
+
const pushDiagnostic = (message) => {
|
|
217125
|
+
diagnostics.push({
|
|
217126
|
+
instanceKey: target.instanceKey,
|
|
217127
|
+
nodeId: node.id,
|
|
217128
|
+
nodeName: node.name,
|
|
217129
|
+
fieldKind: "input",
|
|
217130
|
+
fieldName,
|
|
217131
|
+
fieldIndex,
|
|
217132
|
+
checker: checkerName,
|
|
217133
|
+
message
|
|
217134
|
+
});
|
|
217135
|
+
};
|
|
217136
|
+
const checker = params.checkers.get(checkerName);
|
|
217137
|
+
if (!checker) {
|
|
217138
|
+
pushDiagnostic(`checker '${checkerName}' is not registered`);
|
|
217139
|
+
return;
|
|
217140
|
+
}
|
|
217141
|
+
try {
|
|
217142
|
+
const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
|
|
217143
|
+
messages.forEach(pushDiagnostic);
|
|
217144
|
+
} catch (error) {
|
|
217145
|
+
pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
|
|
217146
|
+
}
|
|
217147
|
+
},
|
|
217148
|
+
onOutput: ({ fieldName, fieldIndex, checkerName, value, ctx }) => {
|
|
217149
|
+
if (!checkerName) {
|
|
217150
|
+
return;
|
|
217151
|
+
}
|
|
217152
|
+
const pushDiagnostic = (message) => {
|
|
217153
|
+
diagnostics.push({
|
|
217154
|
+
instanceKey: target.instanceKey,
|
|
217155
|
+
nodeId: node.id,
|
|
217156
|
+
nodeName: node.name,
|
|
217157
|
+
fieldKind: "output",
|
|
217158
|
+
fieldName,
|
|
217159
|
+
fieldIndex,
|
|
217160
|
+
checker: checkerName,
|
|
217161
|
+
message
|
|
217162
|
+
});
|
|
217163
|
+
};
|
|
217164
|
+
const checker = params.checkers.get(checkerName);
|
|
217165
|
+
if (!checker) {
|
|
217166
|
+
pushDiagnostic(`checker '${checkerName}' is not registered`);
|
|
217167
|
+
return;
|
|
217168
|
+
}
|
|
217169
|
+
try {
|
|
217170
|
+
const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
|
|
217171
|
+
messages.forEach(pushDiagnostic);
|
|
217172
|
+
} catch (error) {
|
|
217173
|
+
pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
|
|
217174
|
+
}
|
|
216866
217175
|
}
|
|
216867
|
-
|
|
216868
|
-
|
|
216869
|
-
|
|
216870
|
-
|
|
216871
|
-
|
|
216872
|
-
|
|
216873
|
-
|
|
216874
|
-
|
|
216875
|
-
|
|
216876
|
-
|
|
216877
|
-
|
|
216878
|
-
|
|
216879
|
-
|
|
216880
|
-
|
|
217176
|
+
});
|
|
217177
|
+
}
|
|
217178
|
+
return diagnostics;
|
|
217179
|
+
};
|
|
217180
|
+
var resolveNodeFieldVisibility = (params) => {
|
|
217181
|
+
const visibility = createEmptyNodeFieldVisibilityState();
|
|
217182
|
+
const node = params.target;
|
|
217183
|
+
const nodeDef = params.env.nodeDefs.get(node.name);
|
|
217184
|
+
if (!nodeDef) {
|
|
217185
|
+
return visibility;
|
|
217186
|
+
}
|
|
217187
|
+
visitCustomNodeFields({
|
|
217188
|
+
node,
|
|
217189
|
+
tree: params.tree,
|
|
217190
|
+
nodeDef,
|
|
217191
|
+
treePath: params.targetTreePath ?? params.treePath,
|
|
217192
|
+
env: params.env,
|
|
217193
|
+
onArg: ({ fieldName, visibleName, value, ctx }) => {
|
|
217194
|
+
if (!visibleName) {
|
|
217195
|
+
return;
|
|
217196
|
+
}
|
|
217197
|
+
const visible = params.visibles.get(visibleName);
|
|
217198
|
+
if (!visible) {
|
|
217199
|
+
params.env.logger.warn(
|
|
217200
|
+
`visible '${visibleName}' is not registered for ${formatFieldLocator(node, "arg", fieldName)}`
|
|
217201
|
+
);
|
|
217202
|
+
return;
|
|
216881
217203
|
}
|
|
216882
217204
|
try {
|
|
216883
|
-
|
|
216884
|
-
|
|
216885
|
-
|
|
216886
|
-
|
|
216887
|
-
|
|
216888
|
-
|
|
216889
|
-
|
|
216890
|
-
|
|
216891
|
-
|
|
216892
|
-
|
|
217205
|
+
visibility.args[fieldName] = normalizeNodeFieldVisibleResult(
|
|
217206
|
+
visible.visible(value, ctx)
|
|
217207
|
+
);
|
|
217208
|
+
} catch (error) {
|
|
217209
|
+
params.env.logger.warn(
|
|
217210
|
+
`visible '${visibleName}' failed for ${formatFieldLocator(node, "arg", fieldName)}: ${formatRuntimeError(error)}`
|
|
217211
|
+
);
|
|
217212
|
+
visibility.args[fieldName] = true;
|
|
217213
|
+
}
|
|
217214
|
+
},
|
|
217215
|
+
onInput: ({ fieldName, fieldIndex, visibleName, value, ctx }) => {
|
|
217216
|
+
if (!visibleName) {
|
|
217217
|
+
return;
|
|
217218
|
+
}
|
|
217219
|
+
const visible = params.visibles.get(visibleName);
|
|
217220
|
+
if (!visible) {
|
|
217221
|
+
params.env.logger.warn(
|
|
217222
|
+
`visible '${visibleName}' is not registered for ${formatFieldLocator(node, "input", fieldName, fieldIndex)}`
|
|
217223
|
+
);
|
|
217224
|
+
return;
|
|
217225
|
+
}
|
|
217226
|
+
try {
|
|
217227
|
+
visibility.input[fieldIndex] = normalizeNodeFieldVisibleResult(
|
|
217228
|
+
visible.visible(value, ctx)
|
|
217229
|
+
);
|
|
217230
|
+
} catch (error) {
|
|
217231
|
+
params.env.logger.warn(
|
|
217232
|
+
`visible '${visibleName}' failed for ${formatFieldLocator(node, "input", fieldName, fieldIndex)}: ${formatRuntimeError(error)}`
|
|
217233
|
+
);
|
|
217234
|
+
visibility.input[fieldIndex] = true;
|
|
217235
|
+
}
|
|
217236
|
+
},
|
|
217237
|
+
onOutput: ({ fieldName, fieldIndex, visibleName, value, ctx }) => {
|
|
217238
|
+
if (!visibleName) {
|
|
217239
|
+
return;
|
|
217240
|
+
}
|
|
217241
|
+
const visible = params.visibles.get(visibleName);
|
|
217242
|
+
if (!visible) {
|
|
217243
|
+
params.env.logger.warn(
|
|
217244
|
+
`visible '${visibleName}' is not registered for ${formatFieldLocator(node, "output", fieldName, fieldIndex)}`
|
|
217245
|
+
);
|
|
217246
|
+
return;
|
|
217247
|
+
}
|
|
217248
|
+
try {
|
|
217249
|
+
visibility.output[fieldIndex] = normalizeNodeFieldVisibleResult(
|
|
217250
|
+
visible.visible(value, ctx)
|
|
216893
217251
|
);
|
|
216894
|
-
messages.forEach(pushDiagnostic);
|
|
216895
217252
|
} catch (error) {
|
|
216896
|
-
|
|
217253
|
+
params.env.logger.warn(
|
|
217254
|
+
`visible '${visibleName}' failed for ${formatFieldLocator(node, "output", fieldName, fieldIndex)}: ${formatRuntimeError(error)}`
|
|
217255
|
+
);
|
|
217256
|
+
visibility.output[fieldIndex] = true;
|
|
216897
217257
|
}
|
|
216898
217258
|
}
|
|
216899
|
-
}
|
|
216900
|
-
return
|
|
217259
|
+
});
|
|
217260
|
+
return visibility;
|
|
216901
217261
|
};
|
|
216902
|
-
var
|
|
217262
|
+
var formatNodeFieldCheckBuildDiagnostic = (diagnostic) => diagnostic.fieldKind === "arg" ? `check ${diagnostic.nodeId}|${diagnostic.nodeName}: ${diagnostic.fieldName}: ${diagnostic.message}` : `check ${diagnostic.nodeId}|${diagnostic.nodeName}: ${diagnostic.fieldKind}[${diagnostic.fieldIndex ?? 0}:${diagnostic.fieldName}]: ${diagnostic.message}`;
|
|
216903
217263
|
var syncFilesFromDiskWithContext = (files, parsedVarDecl, workdir) => {
|
|
216904
217264
|
if (!hasFs()) {
|
|
216905
217265
|
return;
|
|
@@ -217066,7 +217426,8 @@ var applyBehavior3DecoratorGlobal = () => {
|
|
|
217066
217426
|
...decoratorGlobalState.previousBehavior3 && typeof decoratorGlobalState.previousBehavior3 === "object" ? decoratorGlobalState.previousBehavior3 : {},
|
|
217067
217427
|
build: markBuildHook,
|
|
217068
217428
|
batch: markBatchHook,
|
|
217069
|
-
check: markCheckHook
|
|
217429
|
+
check: markCheckHook,
|
|
217430
|
+
visible: markVisibleHook
|
|
217070
217431
|
};
|
|
217071
217432
|
};
|
|
217072
217433
|
var restoreBehavior3DecoratorGlobal = () => {
|
|
@@ -217376,16 +217737,16 @@ var buildProjectWithContext = async (project, buildDir, context) => {
|
|
|
217376
217737
|
if (!context.checkNodeData(tree.root, (message) => errors.push(message))) {
|
|
217377
217738
|
hasError = true;
|
|
217378
217739
|
}
|
|
217379
|
-
const checkDiagnostics =
|
|
217740
|
+
const checkDiagnostics = collectNodeFieldCheckDiagnostics({
|
|
217380
217741
|
tree,
|
|
217381
217742
|
treePath: candidatePath,
|
|
217382
217743
|
env: scriptEnv,
|
|
217383
|
-
checkers: buildRuntime.
|
|
217744
|
+
checkers: buildRuntime.nodeFieldCheckers
|
|
217384
217745
|
});
|
|
217385
217746
|
if (checkDiagnostics.length) {
|
|
217386
217747
|
hasError = true;
|
|
217387
217748
|
checkDiagnostics.forEach(
|
|
217388
|
-
(diagnostic) => errors.push(
|
|
217749
|
+
(diagnostic) => errors.push(formatNodeFieldCheckBuildDiagnostic(diagnostic))
|
|
217389
217750
|
);
|
|
217390
217751
|
}
|
|
217391
217752
|
if (errors.length) {
|
|
@@ -217918,6 +218279,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217918
218279
|
let hasVaridicInput = false;
|
|
217919
218280
|
if (conf.input) {
|
|
217920
218281
|
for (let i = 0; i < conf.input.length; i++) {
|
|
218282
|
+
const slotDefinition = parseSlotDefinition(conf.input[i] ?? "", conf.input, i);
|
|
217921
218283
|
if (!data.input) {
|
|
217922
218284
|
data.input = [];
|
|
217923
218285
|
}
|
|
@@ -217925,7 +218287,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217925
218287
|
data.input[i] = "";
|
|
217926
218288
|
}
|
|
217927
218289
|
if (!isValidInputOrOutput(conf.input, data.input, i)) {
|
|
217928
|
-
error(`intput field '${
|
|
218290
|
+
error(`intput field '${slotDefinition.label}' is required`);
|
|
217929
218291
|
hasError = true;
|
|
217930
218292
|
}
|
|
217931
218293
|
if (i === conf.input.length - 1 && isVariadic(conf.input, -1)) {
|
|
@@ -217939,6 +218301,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217939
218301
|
let hasVaridicOutput = false;
|
|
217940
218302
|
if (conf.output) {
|
|
217941
218303
|
for (let i = 0; i < conf.output.length; i++) {
|
|
218304
|
+
const slotDefinition = parseSlotDefinition(conf.output[i] ?? "", conf.output, i);
|
|
217942
218305
|
if (!data.output) {
|
|
217943
218306
|
data.output = [];
|
|
217944
218307
|
}
|
|
@@ -217946,7 +218309,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217946
218309
|
data.output[i] = "";
|
|
217947
218310
|
}
|
|
217948
218311
|
if (!isValidInputOrOutput(conf.output, data.output, i)) {
|
|
217949
|
-
error(`output field '${
|
|
218312
|
+
error(`output field '${slotDefinition.label}' is required`);
|
|
217950
218313
|
hasError = true;
|
|
217951
218314
|
}
|
|
217952
218315
|
if (i === conf.output.length - 1 && isVariadic(conf.output, -1)) {
|
|
@@ -218173,6 +218536,13 @@ var isValidInputOrOutput = (def, data, index) => {
|
|
|
218173
218536
|
// src/project-path-discovery.ts
|
|
218174
218537
|
var fs = __toESM(require("fs"));
|
|
218175
218538
|
var path = __toESM(require("path"));
|
|
218539
|
+
var resolveExistingPath = (inputPath) => {
|
|
218540
|
+
const resolved = path.resolve(inputPath);
|
|
218541
|
+
if (!fs.existsSync(resolved)) {
|
|
218542
|
+
return resolved;
|
|
218543
|
+
}
|
|
218544
|
+
return fs.realpathSync.native(resolved);
|
|
218545
|
+
};
|
|
218176
218546
|
var isWithinRoot = (rootDir, candidateDir) => {
|
|
218177
218547
|
const relative7 = path.relative(rootDir, candidateDir);
|
|
218178
218548
|
return relative7 === "" || !relative7.startsWith("..") && !path.isAbsolute(relative7);
|
|
@@ -218182,12 +218552,13 @@ var toSearchDirectory = (inputPath) => {
|
|
|
218182
218552
|
if (!fs.existsSync(resolved)) {
|
|
218183
218553
|
return path.extname(resolved) ? path.dirname(resolved) : resolved;
|
|
218184
218554
|
}
|
|
218185
|
-
const
|
|
218186
|
-
|
|
218555
|
+
const canonical = resolveExistingPath(resolved);
|
|
218556
|
+
const stat = fs.statSync(canonical);
|
|
218557
|
+
return stat.isDirectory() ? canonical : path.dirname(canonical);
|
|
218187
218558
|
};
|
|
218188
218559
|
var findNearestFileUpward = (searchFrom, suffix, rootDir) => {
|
|
218189
|
-
let dir =
|
|
218190
|
-
const boundary = rootDir ?
|
|
218560
|
+
let dir = resolveExistingPath(searchFrom);
|
|
218561
|
+
const boundary = rootDir ? resolveExistingPath(rootDir) : void 0;
|
|
218191
218562
|
while (true) {
|
|
218192
218563
|
if (boundary && !isWithinRoot(boundary, dir)) {
|
|
218193
218564
|
break;
|
|
@@ -218196,7 +218567,7 @@ var findNearestFileUpward = (searchFrom, suffix, rootDir) => {
|
|
|
218196
218567
|
const names = fs.readdirSync(dir);
|
|
218197
218568
|
const hit = names.filter((name) => name.endsWith(suffix)).sort()[0];
|
|
218198
218569
|
if (hit) {
|
|
218199
|
-
return path.join(dir, hit);
|
|
218570
|
+
return resolveExistingPath(path.join(dir, hit));
|
|
218200
218571
|
}
|
|
218201
218572
|
} catch {
|
|
218202
218573
|
}
|
|
@@ -218214,14 +218585,14 @@ var findNearestFileUpward = (searchFrom, suffix, rootDir) => {
|
|
|
218214
218585
|
var findBehaviorWorkspaceFileSync = (searchPath, opts) => {
|
|
218215
218586
|
const resolved = path.resolve(searchPath);
|
|
218216
218587
|
if (resolved.endsWith(".b3-workspace") && fs.existsSync(resolved)) {
|
|
218217
|
-
return resolved;
|
|
218588
|
+
return resolveExistingPath(resolved);
|
|
218218
218589
|
}
|
|
218219
218590
|
return findNearestFileUpward(toSearchDirectory(resolved), ".b3-workspace", opts?.rootDir);
|
|
218220
218591
|
};
|
|
218221
218592
|
var findBehaviorSettingFileSync = (searchPath, opts) => {
|
|
218222
218593
|
const resolved = path.resolve(searchPath);
|
|
218223
218594
|
if (resolved.endsWith(".b3-setting") && fs.existsSync(resolved)) {
|
|
218224
|
-
return resolved;
|
|
218595
|
+
return resolveExistingPath(resolved);
|
|
218225
218596
|
}
|
|
218226
218597
|
return findNearestFileUpward(toSearchDirectory(resolved), ".b3-setting", opts?.rootDir);
|
|
218227
218598
|
};
|
|
@@ -218229,6 +218600,25 @@ var findBehaviorSettingFileSync = (searchPath, opts) => {
|
|
|
218229
218600
|
// src/build/build-cli.ts
|
|
218230
218601
|
setFs(fs2);
|
|
218231
218602
|
var normalizePosixPath = (filePath) => filePath.replace(/\\/g, "/");
|
|
218603
|
+
var resolveExistingPath2 = (filePath) => {
|
|
218604
|
+
const resolved = path2.resolve(filePath);
|
|
218605
|
+
if (!fs2.existsSync(resolved)) {
|
|
218606
|
+
return resolved;
|
|
218607
|
+
}
|
|
218608
|
+
return fs2.realpathSync.native(resolved);
|
|
218609
|
+
};
|
|
218610
|
+
async function withProcessCwd(cwd, run) {
|
|
218611
|
+
const previousCwd = process.cwd();
|
|
218612
|
+
if (previousCwd === cwd) {
|
|
218613
|
+
return run();
|
|
218614
|
+
}
|
|
218615
|
+
process.chdir(cwd);
|
|
218616
|
+
try {
|
|
218617
|
+
return await run();
|
|
218618
|
+
} finally {
|
|
218619
|
+
process.chdir(previousCwd);
|
|
218620
|
+
}
|
|
218621
|
+
}
|
|
218232
218622
|
var ensureExistingFile = (filePath, suffix, label) => {
|
|
218233
218623
|
const resolved = path2.resolve(filePath);
|
|
218234
218624
|
if (!resolved.endsWith(suffix)) {
|
|
@@ -218237,7 +218627,7 @@ var ensureExistingFile = (filePath, suffix, label) => {
|
|
|
218237
218627
|
if (!fs2.existsSync(resolved) || !fs2.statSync(resolved).isFile()) {
|
|
218238
218628
|
throw new Error(`${label} does not exist: ${resolved}`);
|
|
218239
218629
|
}
|
|
218240
|
-
return resolved;
|
|
218630
|
+
return resolveExistingPath2(resolved);
|
|
218241
218631
|
};
|
|
218242
218632
|
var ensureExistingScriptFile = (filePath, label) => {
|
|
218243
218633
|
const resolved = path2.resolve(filePath);
|
|
@@ -218248,7 +218638,7 @@ var ensureExistingScriptFile = (filePath, label) => {
|
|
|
218248
218638
|
if (!fs2.existsSync(resolved) || !fs2.statSync(resolved).isFile()) {
|
|
218249
218639
|
throw new Error(`${label} does not exist: ${resolved}`);
|
|
218250
218640
|
}
|
|
218251
|
-
return resolved;
|
|
218641
|
+
return resolveExistingPath2(resolved);
|
|
218252
218642
|
};
|
|
218253
218643
|
var resolveBehaviorProjectPaths = (options) => {
|
|
218254
218644
|
const projectPath = path2.resolve(options.projectPath ?? process.cwd());
|
|
@@ -218296,10 +218686,13 @@ var buildBehaviorProject = async (options) => {
|
|
|
218296
218686
|
alertError: () => {
|
|
218297
218687
|
}
|
|
218298
218688
|
});
|
|
218299
|
-
const hasError = await
|
|
218300
|
-
|
|
218301
|
-
|
|
218302
|
-
|
|
218689
|
+
const hasError = await withProcessCwd(
|
|
218690
|
+
paths.workdir,
|
|
218691
|
+
async () => buildProjectWithContext(
|
|
218692
|
+
normalizePosixPath(paths.workspaceFile),
|
|
218693
|
+
normalizePosixPath(paths.outputDir),
|
|
218694
|
+
buildContext
|
|
218695
|
+
)
|
|
218303
218696
|
);
|
|
218304
218697
|
return {
|
|
218305
218698
|
hasError,
|
|
@@ -220586,6 +220979,37 @@ var computeNodeOverride = (original, edited, def) => {
|
|
|
220586
220979
|
}
|
|
220587
220980
|
return hasDiff ? diff : null;
|
|
220588
220981
|
};
|
|
220982
|
+
var pruneNodeArgsByDefinition = (args, nodeDef) => {
|
|
220983
|
+
if (!args || !nodeDef) {
|
|
220984
|
+
return args;
|
|
220985
|
+
}
|
|
220986
|
+
const argDefs = nodeDef.args ?? [];
|
|
220987
|
+
if (argDefs.length === 0) {
|
|
220988
|
+
return void 0;
|
|
220989
|
+
}
|
|
220990
|
+
const declaredNames = new Set(argDefs.map((arg) => arg.name));
|
|
220991
|
+
const nextEntries = Object.entries(args).filter(([argName]) => declaredNames.has(argName));
|
|
220992
|
+
if (nextEntries.length === Object.keys(args).length) {
|
|
220993
|
+
return args;
|
|
220994
|
+
}
|
|
220995
|
+
return nextEntries.length > 0 ? Object.fromEntries(nextEntries) : void 0;
|
|
220996
|
+
};
|
|
220997
|
+
var pruneNodeSlotsByDefinition = (slots, slotDefs) => {
|
|
220998
|
+
if (!slots) {
|
|
220999
|
+
return slots;
|
|
221000
|
+
}
|
|
221001
|
+
if (!slotDefs?.length) {
|
|
221002
|
+
return void 0;
|
|
221003
|
+
}
|
|
221004
|
+
const lastIndex = slotDefs.length - 1;
|
|
221005
|
+
const keepVariadicTail = parseSlotDefinition(
|
|
221006
|
+
slotDefs[lastIndex] ?? "",
|
|
221007
|
+
slotDefs,
|
|
221008
|
+
lastIndex
|
|
221009
|
+
).variadic;
|
|
221010
|
+
const nextSlots = keepVariadicTail ? slots.slice(0) : slots.slice(0, slotDefs.length);
|
|
221011
|
+
return isJsonEqual(nextSlots, slots) ? slots : nextSlots;
|
|
221012
|
+
};
|
|
220589
221013
|
var matchesSelectedNodeTarget = (selectedNode, payload) => {
|
|
220590
221014
|
return selectedNode.ref.structuralStableId === payload.target.structuralStableId && selectedNode.ref.sourceStableId === payload.target.sourceStableId && selectedNode.ref.sourceTreePath === payload.target.sourceTreePath;
|
|
220591
221015
|
};
|
|
@@ -220679,9 +221103,9 @@ var reduceUpdateNode = (mutation, context) => {
|
|
|
220679
221103
|
}
|
|
220680
221104
|
const nextDebug = payload.data.debug ? true : void 0;
|
|
220681
221105
|
const nextDisabled = payload.data.disabled ? true : void 0;
|
|
220682
|
-
const nextInput = payload.data.input;
|
|
220683
|
-
const nextOutput = payload.data.output;
|
|
220684
|
-
const nextArgs = payload.data.args;
|
|
221106
|
+
const nextInput = pruneNodeSlotsByDefinition(payload.data.input, nextNodeDef?.input);
|
|
221107
|
+
const nextOutput = pruneNodeSlotsByDefinition(payload.data.output, nextNodeDef?.output);
|
|
221108
|
+
const nextArgs = pruneNodeArgsByDefinition(payload.data.args, nextNodeDef);
|
|
220685
221109
|
if (nextName === selectedNode.data.name && nextDesc === selectedNode.data.desc && nextPath === selectedNode.data.path && nextDebug === selectedNode.data.debug && nextDisabled === selectedNode.data.disabled && isJsonEqual(nextInput ?? [], selectedNode.data.input ?? []) && isJsonEqual(nextOutput ?? [], selectedNode.data.output ?? []) && isJsonEqual(nextArgs ?? {}, selectedNode.data.args ?? {})) {
|
|
220686
221110
|
return { status: "noop" };
|
|
220687
221111
|
}
|
|
@@ -221311,7 +221735,8 @@ function createSessionDispatcher({
|
|
|
221311
221735
|
handleSaveDocumentMessage,
|
|
221312
221736
|
handleRevertDocumentMessage,
|
|
221313
221737
|
refreshSettings,
|
|
221314
|
-
|
|
221738
|
+
handleValidateNodeFieldsMessage,
|
|
221739
|
+
handleResolveNodeFieldVisibilityMessage,
|
|
221315
221740
|
fileRequestHandlers
|
|
221316
221741
|
}) {
|
|
221317
221742
|
const dispatchEditorMessage = async (msg, reply = postMessage, source = "editor") => {
|
|
@@ -221359,8 +221784,11 @@ function createSessionDispatcher({
|
|
|
221359
221784
|
case "runInspectorCommand":
|
|
221360
221785
|
void vscode14.commands.executeCommand(msg.command).then(void 0, logAsyncRuntimeError(`command:${msg.command}`));
|
|
221361
221786
|
return;
|
|
221362
|
-
case "
|
|
221363
|
-
await
|
|
221787
|
+
case "validateNodeFields":
|
|
221788
|
+
await handleValidateNodeFieldsMessage(msg, reply);
|
|
221789
|
+
return;
|
|
221790
|
+
case "resolveNodeFieldVisibility":
|
|
221791
|
+
await handleResolveNodeFieldVisibilityMessage(msg, reply);
|
|
221364
221792
|
return;
|
|
221365
221793
|
case "webviewLog":
|
|
221366
221794
|
writeWebviewLogMessage(msg);
|
|
@@ -221572,6 +222000,7 @@ async function createSessionNodeCheckRuntime({
|
|
|
221572
222000
|
null,
|
|
221573
222001
|
createSessionBuildScriptEnv(workspaceFolderUri.fsPath, nodeDefs)
|
|
221574
222002
|
),
|
|
222003
|
+
nodeFieldVisibleHandlers: /* @__PURE__ */ new Map(),
|
|
221575
222004
|
treePath: workspaceFolderUri.fsPath
|
|
221576
222005
|
};
|
|
221577
222006
|
}
|
|
@@ -221608,11 +222037,17 @@ async function createSessionNodeCheckRuntime({
|
|
|
221608
222037
|
checkScriptModules,
|
|
221609
222038
|
env2
|
|
221610
222039
|
);
|
|
222040
|
+
const visibleRuntime = createNodeFieldVisibleRuntimeWithCheckModules(
|
|
222041
|
+
buildScriptModule,
|
|
222042
|
+
checkScriptModules,
|
|
222043
|
+
env2
|
|
222044
|
+
);
|
|
221611
222045
|
return {
|
|
221612
222046
|
buildScriptRuntime: {
|
|
221613
222047
|
...buildScriptRuntime,
|
|
221614
222048
|
hasError: buildScriptRuntime.hasError || hasRuntimeLoadError
|
|
221615
222049
|
},
|
|
222050
|
+
nodeFieldVisibleHandlers: visibleRuntime.nodeFieldVisibles,
|
|
221616
222051
|
treePath: workdir
|
|
221617
222052
|
};
|
|
221618
222053
|
}
|
|
@@ -221629,15 +222064,15 @@ function createSessionNodeChecks(context) {
|
|
|
221629
222064
|
readWorkspaceFileContent
|
|
221630
222065
|
});
|
|
221631
222066
|
};
|
|
221632
|
-
const
|
|
222067
|
+
const handleValidateNodeFieldsMessage = async (msg, reply = postMessage) => {
|
|
221633
222068
|
try {
|
|
221634
222069
|
const runtimeResult = await createNodeCheckRuntime();
|
|
221635
222070
|
const tree = JSON.parse(msg.content);
|
|
221636
|
-
const diagnostics =
|
|
222071
|
+
const diagnostics = collectNodeFieldCheckDiagnostics({
|
|
221637
222072
|
tree,
|
|
221638
222073
|
treePath: msg.treePath || runtimeResult.treePath,
|
|
221639
222074
|
env: createSessionBuildScriptEnv(runtimeResult.treePath, state.nodeDefs),
|
|
221640
|
-
checkers: runtimeResult.buildScriptRuntime.
|
|
222075
|
+
checkers: runtimeResult.buildScriptRuntime.nodeFieldCheckers,
|
|
221641
222076
|
targets: msg.nodes.map((entry) => ({
|
|
221642
222077
|
instanceKey: entry.instanceKey,
|
|
221643
222078
|
treePath: entry.treePath,
|
|
@@ -221645,13 +222080,15 @@ function createSessionNodeChecks(context) {
|
|
|
221645
222080
|
}))
|
|
221646
222081
|
});
|
|
221647
222082
|
await reply({
|
|
221648
|
-
type: "
|
|
222083
|
+
type: "validateNodeFieldsResult",
|
|
221649
222084
|
requestId: msg.requestId,
|
|
221650
222085
|
diagnostics: diagnostics.filter(
|
|
221651
222086
|
(diagnostic) => typeof diagnostic.instanceKey === "string"
|
|
221652
222087
|
).map((diagnostic) => ({
|
|
221653
222088
|
instanceKey: diagnostic.instanceKey,
|
|
221654
|
-
|
|
222089
|
+
fieldKind: diagnostic.fieldKind,
|
|
222090
|
+
fieldName: diagnostic.fieldName,
|
|
222091
|
+
fieldIndex: diagnostic.fieldIndex,
|
|
221655
222092
|
checker: diagnostic.checker,
|
|
221656
222093
|
message: diagnostic.message
|
|
221657
222094
|
})),
|
|
@@ -221662,15 +222099,42 @@ function createSessionNodeChecks(context) {
|
|
|
221662
222099
|
});
|
|
221663
222100
|
} catch (error) {
|
|
221664
222101
|
await reply({
|
|
221665
|
-
type: "
|
|
222102
|
+
type: "validateNodeFieldsResult",
|
|
221666
222103
|
requestId: msg.requestId,
|
|
221667
222104
|
diagnostics: [],
|
|
221668
222105
|
error: String(error)
|
|
221669
222106
|
});
|
|
221670
222107
|
}
|
|
221671
222108
|
};
|
|
222109
|
+
const handleResolveNodeFieldVisibilityMessage = async (msg, reply = postMessage) => {
|
|
222110
|
+
try {
|
|
222111
|
+
const runtimeResult = await createNodeCheckRuntime();
|
|
222112
|
+
const tree = JSON.parse(msg.content);
|
|
222113
|
+
const visibility = resolveNodeFieldVisibility({
|
|
222114
|
+
tree,
|
|
222115
|
+
treePath: msg.treePath || runtimeResult.treePath,
|
|
222116
|
+
env: createSessionBuildScriptEnv(runtimeResult.treePath, state.nodeDefs),
|
|
222117
|
+
visibles: runtimeResult.nodeFieldVisibleHandlers,
|
|
222118
|
+
target: toNodeData(msg.target.node),
|
|
222119
|
+
targetTreePath: msg.target.treePath
|
|
222120
|
+
});
|
|
222121
|
+
await reply({
|
|
222122
|
+
type: "resolveNodeFieldVisibilityResult",
|
|
222123
|
+
requestId: msg.requestId,
|
|
222124
|
+
visibility
|
|
222125
|
+
});
|
|
222126
|
+
} catch (error) {
|
|
222127
|
+
await reply({
|
|
222128
|
+
type: "resolveNodeFieldVisibilityResult",
|
|
222129
|
+
requestId: msg.requestId,
|
|
222130
|
+
visibility: { args: {}, input: {}, output: {} },
|
|
222131
|
+
error: String(error)
|
|
222132
|
+
});
|
|
222133
|
+
}
|
|
222134
|
+
};
|
|
221672
222135
|
return {
|
|
221673
|
-
|
|
222136
|
+
handleValidateNodeFieldsMessage,
|
|
222137
|
+
handleResolveNodeFieldVisibilityMessage
|
|
221674
222138
|
};
|
|
221675
222139
|
}
|
|
221676
222140
|
|
|
@@ -222002,10 +222466,7 @@ async function resolveTreeEditorSession(params) {
|
|
|
222002
222466
|
const inspectorSync = createSessionInspectorSync(context);
|
|
222003
222467
|
const subtreeTracking = createSessionSubtreeTracking(context, inspectorSync);
|
|
222004
222468
|
const fileVersionGuard = createFileVersionGuard(context);
|
|
222005
|
-
const {
|
|
222006
|
-
getActiveNewerFileEditMessage,
|
|
222007
|
-
getExistingNewerFileEditMessage
|
|
222008
|
-
} = fileVersionGuard;
|
|
222469
|
+
const { getActiveNewerFileEditMessage, getExistingNewerFileEditMessage } = fileVersionGuard;
|
|
222009
222470
|
const { refreshSettings } = createSessionSettingsSync(context, inspectorSync);
|
|
222010
222471
|
const selectionSync = createSessionSelectionSync(context, inspectorSync);
|
|
222011
222472
|
const { handleSelectTreeMessage, handleSelectNodeMessage } = selectionSync;
|
|
@@ -222021,7 +222482,7 @@ async function resolveTreeEditorSession(params) {
|
|
|
222021
222482
|
handleRevertDocumentMessage,
|
|
222022
222483
|
handleMainDocumentFileChange
|
|
222023
222484
|
} = createSessionDocumentLifecycle(context, inspectorSync, subtreeTracking, fileVersionGuard);
|
|
222024
|
-
const {
|
|
222485
|
+
const { handleValidateNodeFieldsMessage, handleResolveNodeFieldVisibilityMessage } = createSessionNodeChecks(context);
|
|
222025
222486
|
const fileRequestHandlers = createSessionFileRequestHandlers({
|
|
222026
222487
|
projectRootUri,
|
|
222027
222488
|
viewType,
|
|
@@ -222048,7 +222509,8 @@ async function resolveTreeEditorSession(params) {
|
|
|
222048
222509
|
handleSaveDocumentMessage,
|
|
222049
222510
|
handleRevertDocumentMessage,
|
|
222050
222511
|
refreshSettings,
|
|
222051
|
-
|
|
222512
|
+
handleValidateNodeFieldsMessage,
|
|
222513
|
+
handleResolveNodeFieldVisibilityMessage,
|
|
222052
222514
|
fileRequestHandlers
|
|
222053
222515
|
});
|
|
222054
222516
|
const activeWebviewEntry = {
|
|
@@ -222467,7 +222929,7 @@ async function startBuildScriptDebugSession(params) {
|
|
|
222467
222929
|
request: "launch",
|
|
222468
222930
|
name: "Debug Behavior3 Build Script",
|
|
222469
222931
|
program,
|
|
222470
|
-
cwd: params.
|
|
222932
|
+
cwd: params.projectDir,
|
|
222471
222933
|
console: "integratedTerminal",
|
|
222472
222934
|
sourceMaps: true,
|
|
222473
222935
|
smartStep: true,
|
|
@@ -222604,6 +223066,7 @@ async function runBuild(context, options = {}) {
|
|
|
222604
223066
|
}
|
|
222605
223067
|
const outputDirFs = picked[0].fsPath;
|
|
222606
223068
|
const outputDirPosix = outputDirFs.replace(/\\/g, "/");
|
|
223069
|
+
const projectDir = path12.dirname(workspaceFile);
|
|
222607
223070
|
await saveLastBuildOutput(context, folder.uri, outputDirFs);
|
|
222608
223071
|
const config = vscode20.workspace.getConfiguration("behavior3");
|
|
222609
223072
|
const checkExpr = config.get("checkExpr", true);
|
|
@@ -222616,6 +223079,7 @@ async function runBuild(context, options = {}) {
|
|
|
222616
223079
|
const started = await startBuildScriptDebugSession({
|
|
222617
223080
|
context,
|
|
222618
223081
|
folder,
|
|
223082
|
+
projectDir,
|
|
222619
223083
|
projectPath: treeUri?.fsPath ?? workspaceFile,
|
|
222620
223084
|
workspaceFile,
|
|
222621
223085
|
settingPath,
|
|
@@ -223012,14 +223476,22 @@ var InspectorSidebarCoordinator = class {
|
|
|
223012
223476
|
error
|
|
223013
223477
|
});
|
|
223014
223478
|
return;
|
|
223015
|
-
case "
|
|
223479
|
+
case "validateNodeFields":
|
|
223016
223480
|
await reply({
|
|
223017
|
-
type: "
|
|
223481
|
+
type: "validateNodeFieldsResult",
|
|
223018
223482
|
requestId: message.requestId,
|
|
223019
223483
|
diagnostics: [],
|
|
223020
223484
|
error
|
|
223021
223485
|
});
|
|
223022
223486
|
return;
|
|
223487
|
+
case "resolveNodeFieldVisibility":
|
|
223488
|
+
await reply({
|
|
223489
|
+
type: "resolveNodeFieldVisibilityResult",
|
|
223490
|
+
requestId: message.requestId,
|
|
223491
|
+
visibility: { args: {}, input: {}, output: {} },
|
|
223492
|
+
error
|
|
223493
|
+
});
|
|
223494
|
+
return;
|
|
223023
223495
|
case "ready":
|
|
223024
223496
|
case "undo":
|
|
223025
223497
|
case "redo":
|
|
@@ -223166,19 +223638,19 @@ function createCheckerScriptContent(baseName) {
|
|
|
223166
223638
|
const className = ensureSuffix(toPascalIdentifier(baseName), "Checker");
|
|
223167
223639
|
const checkerName = toCheckerRegistrationName(baseName);
|
|
223168
223640
|
return [
|
|
223169
|
-
'import type {
|
|
223641
|
+
'import type { NodeFieldCheckContext } from "vscode-behavior3/build";',
|
|
223170
223642
|
"",
|
|
223171
223643
|
`@behavior3.check("${checkerName}")`,
|
|
223172
223644
|
`export class ${className} {`,
|
|
223173
|
-
" validate(value: unknown, ctx:
|
|
223645
|
+
" validate(value: unknown, ctx: NodeFieldCheckContext) {",
|
|
223174
223646
|
' if (value === undefined || value === null || value === "") {',
|
|
223175
223647
|
" return;",
|
|
223176
223648
|
" }",
|
|
223177
223649
|
' if (typeof value !== "number") {',
|
|
223178
|
-
" return `${ctx.
|
|
223650
|
+
" return `${ctx.fieldName} must be a number`;",
|
|
223179
223651
|
" }",
|
|
223180
223652
|
" if (value <= 0) {",
|
|
223181
|
-
" return `${ctx.
|
|
223653
|
+
" return `${ctx.fieldName} must be greater than 0`;",
|
|
223182
223654
|
" }",
|
|
223183
223655
|
" }",
|
|
223184
223656
|
"}",
|