vscode-behavior3 2.3.3 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.d.ts +30 -21
- package/dist/build-cli.js +308 -100
- package/dist/extension.js +561 -121
- 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 +62 -11
- 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/build-cli.js
CHANGED
|
@@ -212364,16 +212364,22 @@ var hasArgOptions = (arg) => arg.options !== void 0;
|
|
|
212364
212364
|
// webview/shared/node-utils.ts
|
|
212365
212365
|
var createNodeDefMap = (nodeDefs) => new Map(nodeDefs.map((nodeDef) => [nodeDef.name, nodeDef]));
|
|
212366
212366
|
var cleanSlotLabel = (value) => value.replace(/\.\.\.$/, "").replace(/\?/g, "");
|
|
212367
|
+
var isStructuredSlotDefinition = (slot) => Boolean(slot && typeof slot === "object" && !Array.isArray(slot));
|
|
212367
212368
|
var parseSlotDefinition = (slot, slotDefs, index) => {
|
|
212368
|
-
const raw = slot ?? "";
|
|
212369
|
+
const raw = typeof slot === "string" ? slot : slot?.name ?? "";
|
|
212369
212370
|
const hasOptionalMarker = raw.includes("?");
|
|
212370
212371
|
const hasVariadicMarker = raw.endsWith("...");
|
|
212371
212372
|
const variadic = hasVariadicMarker && (slotDefs && index !== void 0 ? index === slotDefs.length - 1 : true);
|
|
212373
|
+
const checker = isStructuredSlotDefinition(slot) ? slot.checker?.trim() || void 0 : void 0;
|
|
212374
|
+
const visible = isStructuredSlotDefinition(slot) ? slot.visible?.trim() || void 0 : void 0;
|
|
212372
212375
|
return {
|
|
212373
212376
|
raw,
|
|
212377
|
+
name: cleanSlotLabel(raw),
|
|
212374
212378
|
label: cleanSlotLabel(raw),
|
|
212375
212379
|
required: !hasOptionalMarker,
|
|
212376
|
-
variadic
|
|
212380
|
+
variadic,
|
|
212381
|
+
checker,
|
|
212382
|
+
visible
|
|
212377
212383
|
};
|
|
212378
212384
|
};
|
|
212379
212385
|
var getNodeArgRawType = (arg) => {
|
|
@@ -212576,6 +212582,34 @@ var asStringArray = (value, label) => {
|
|
|
212576
212582
|
return entry;
|
|
212577
212583
|
});
|
|
212578
212584
|
};
|
|
212585
|
+
var normalizeNodeLabel = (label, record) => {
|
|
212586
|
+
const rawNodeName = record.name;
|
|
212587
|
+
if (typeof rawNodeName !== "string" || !rawNodeName.trim()) {
|
|
212588
|
+
return label;
|
|
212589
|
+
}
|
|
212590
|
+
return `${label}(${rawNodeName.trim()})`;
|
|
212591
|
+
};
|
|
212592
|
+
var normalizeNodeSlotEntry = (value, label) => {
|
|
212593
|
+
if (typeof value === "string") {
|
|
212594
|
+
return asRequiredString(value, label);
|
|
212595
|
+
}
|
|
212596
|
+
const record = expectPlainRecord(value, label);
|
|
212597
|
+
return {
|
|
212598
|
+
name: asRequiredString(record.name, `${label}.name`),
|
|
212599
|
+
checker: asOptionalNonEmptyString(record.checker, `${label}.checker`),
|
|
212600
|
+
visible: asOptionalNonEmptyString(record.visible, `${label}.visible`)
|
|
212601
|
+
};
|
|
212602
|
+
};
|
|
212603
|
+
var normalizeNodeSlots = (value, label) => {
|
|
212604
|
+
if (value === void 0) {
|
|
212605
|
+
return void 0;
|
|
212606
|
+
}
|
|
212607
|
+
if (!Array.isArray(value)) {
|
|
212608
|
+
throw new Error(`${label} must be an array`);
|
|
212609
|
+
}
|
|
212610
|
+
const slots = value.map((entry, index) => normalizeNodeSlotEntry(entry, `${label}[${index}]`));
|
|
212611
|
+
return slots.length > 0 ? slots : void 0;
|
|
212612
|
+
};
|
|
212579
212613
|
var asWorkdirRelativeJsonPathArray = (value, label) => {
|
|
212580
212614
|
const entries = asStringArray(value, label);
|
|
212581
212615
|
return entries.map((entry, index) => {
|
|
@@ -212686,44 +212720,43 @@ var normalizeNodeArgs = (value, label) => {
|
|
|
212686
212720
|
oneof: asOptionalString(record.oneof),
|
|
212687
212721
|
default: record.default,
|
|
212688
212722
|
options: normalizeNodeArgOptions(record.options, `${label}[${index}].options`),
|
|
212689
|
-
checker: asOptionalNonEmptyString(record.checker, `${label}[${index}].checker`)
|
|
212723
|
+
checker: asOptionalNonEmptyString(record.checker, `${label}[${index}].checker`),
|
|
212724
|
+
visible: asOptionalNonEmptyString(record.visible, `${label}[${index}].visible`)
|
|
212690
212725
|
};
|
|
212691
212726
|
});
|
|
212692
212727
|
};
|
|
212693
212728
|
var normalizeNodeDef = (value, label) => {
|
|
212694
212729
|
const record = expectPlainRecord(value, label);
|
|
212695
|
-
const
|
|
212730
|
+
const nodeLabel = normalizeNodeLabel(label, record);
|
|
212731
|
+
const name = asRequiredString(record.name, `${nodeLabel}.name`);
|
|
212732
|
+
const type = asRequiredString(record.type, `${nodeLabel}.type`);
|
|
212696
212733
|
if (!NODE_DEF_TYPES.has(type)) {
|
|
212697
|
-
throw new Error(
|
|
212734
|
+
throw new Error(
|
|
212735
|
+
`${nodeLabel}.type must be one of ${Array.from(NODE_DEF_TYPES).join(", ")}`
|
|
212736
|
+
);
|
|
212698
212737
|
}
|
|
212699
212738
|
const groupValue = record.group;
|
|
212700
212739
|
const group = groupValue === void 0 ? void 0 : Array.isArray(groupValue) ? groupValue.map(
|
|
212701
|
-
(entry, index) => asRequiredString(entry, `${
|
|
212702
|
-
) : [asRequiredString(groupValue, `${
|
|
212740
|
+
(entry, index) => asRequiredString(entry, `${nodeLabel}.group[${index}]`)
|
|
212741
|
+
) : [asRequiredString(groupValue, `${nodeLabel}.group`)];
|
|
212703
212742
|
const childrenValue = record.children;
|
|
212704
212743
|
if (childrenValue !== void 0 && !CHILDREN_ARITIES.has(childrenValue)) {
|
|
212705
|
-
throw new Error(`${
|
|
212744
|
+
throw new Error(`${nodeLabel}.children must be one of -1, 0, 1, 2, 3`);
|
|
212706
212745
|
}
|
|
212707
212746
|
const statusValue = record.status;
|
|
212708
|
-
const status = statusValue === void 0 ? void 0 : asStringArray(statusValue, `${
|
|
212747
|
+
const status = statusValue === void 0 ? void 0 : asStringArray(statusValue, `${nodeLabel}.status`).map((entry) => {
|
|
212709
212748
|
if (!NODE_STATUS_VALUES.has(entry)) {
|
|
212710
|
-
throw new Error(`${
|
|
212749
|
+
throw new Error(`${nodeLabel}.status contains unsupported value: ${entry}`);
|
|
212711
212750
|
}
|
|
212712
212751
|
return entry;
|
|
212713
212752
|
});
|
|
212714
212753
|
return {
|
|
212715
|
-
name
|
|
212754
|
+
name,
|
|
212716
212755
|
type,
|
|
212717
212756
|
desc: asOptionalString(record.desc) ?? "",
|
|
212718
|
-
input: (
|
|
212719
|
-
|
|
212720
|
-
|
|
212721
|
-
})(),
|
|
212722
|
-
output: (() => {
|
|
212723
|
-
const output = asStringArray(record.output, `${label}.output`);
|
|
212724
|
-
return output.length > 0 ? output : void 0;
|
|
212725
|
-
})(),
|
|
212726
|
-
args: normalizeNodeArgs(record.args, `${label}.args`),
|
|
212757
|
+
input: normalizeNodeSlots(record.input, `${nodeLabel}.input`),
|
|
212758
|
+
output: normalizeNodeSlots(record.output, `${nodeLabel}.output`),
|
|
212759
|
+
args: normalizeNodeArgs(record.args, `${nodeLabel}.args`),
|
|
212727
212760
|
doc: asOptionalString(record.doc),
|
|
212728
212761
|
icon: asOptionalString(record.icon),
|
|
212729
212762
|
color: asOptionalString(record.color),
|
|
@@ -213361,6 +213394,8 @@ var BUILD_HOOK_MARKER = "__behavior3BuildHook";
|
|
|
213361
213394
|
var BATCH_HOOK_MARKER = "__behavior3BatchHook";
|
|
213362
213395
|
var CHECK_HOOK_MARKER = "__behavior3CheckHook";
|
|
213363
213396
|
var CHECK_HOOK_NAME = "__behavior3CheckName";
|
|
213397
|
+
var VISIBLE_HOOK_MARKER = "__behavior3VisibleHook";
|
|
213398
|
+
var VISIBLE_HOOK_NAME = "__behavior3VisibleName";
|
|
213364
213399
|
var markBuildHook = (ctor) => {
|
|
213365
213400
|
Object.defineProperty(ctor, BUILD_HOOK_MARKER, {
|
|
213366
213401
|
value: true,
|
|
@@ -213387,12 +213422,30 @@ var markCheckCtor = (ctor, explicitName) => {
|
|
|
213387
213422
|
});
|
|
213388
213423
|
return ctor;
|
|
213389
213424
|
};
|
|
213425
|
+
var markVisibleCtor = (ctor, explicitName) => {
|
|
213426
|
+
const name = explicitName?.trim() || ctor.name;
|
|
213427
|
+
Object.defineProperty(ctor, VISIBLE_HOOK_MARKER, {
|
|
213428
|
+
value: true,
|
|
213429
|
+
configurable: false
|
|
213430
|
+
});
|
|
213431
|
+
Object.defineProperty(ctor, VISIBLE_HOOK_NAME, {
|
|
213432
|
+
value: name,
|
|
213433
|
+
configurable: false
|
|
213434
|
+
});
|
|
213435
|
+
return ctor;
|
|
213436
|
+
};
|
|
213390
213437
|
var markCheckHook = (nameOrCtor, _context) => {
|
|
213391
213438
|
if (typeof nameOrCtor === "function") {
|
|
213392
213439
|
return markCheckCtor(nameOrCtor);
|
|
213393
213440
|
}
|
|
213394
213441
|
return (ctor) => markCheckCtor(ctor, nameOrCtor);
|
|
213395
213442
|
};
|
|
213443
|
+
var markVisibleHook = (nameOrCtor, _context) => {
|
|
213444
|
+
if (typeof nameOrCtor === "function") {
|
|
213445
|
+
return markVisibleCtor(nameOrCtor);
|
|
213446
|
+
}
|
|
213447
|
+
return (ctor) => markVisibleCtor(ctor, nameOrCtor);
|
|
213448
|
+
};
|
|
213396
213449
|
var isDecoratedBuildHookCtor = (value) => typeof value === "function" && value[BUILD_HOOK_MARKER] === true;
|
|
213397
213450
|
var isDecoratedBatchHookCtor = (value) => typeof value === "function" && value[BATCH_HOOK_MARKER] === true;
|
|
213398
213451
|
var isDecoratedCheckCtor = (value) => typeof value === "function" && value[CHECK_HOOK_MARKER] === true;
|
|
@@ -213477,7 +213530,7 @@ var createBatchHooks = (moduleExports, env, reportMissing = true) => {
|
|
|
213477
213530
|
}
|
|
213478
213531
|
return void 0;
|
|
213479
213532
|
};
|
|
213480
|
-
var
|
|
213533
|
+
var createNodeFieldCheckers = (moduleExports, env) => {
|
|
213481
213534
|
const checkers = /* @__PURE__ */ new Map();
|
|
213482
213535
|
let hasError = false;
|
|
213483
213536
|
if (!moduleExports || typeof moduleExports !== "object") {
|
|
@@ -213515,7 +213568,7 @@ var createNodeArgCheckers = (moduleExports, env) => {
|
|
|
213515
213568
|
var createBuildScriptRuntime = (moduleExports, env) => {
|
|
213516
213569
|
if (!moduleExports || typeof moduleExports !== "object") {
|
|
213517
213570
|
return {
|
|
213518
|
-
|
|
213571
|
+
nodeFieldCheckers: /* @__PURE__ */ new Map(),
|
|
213519
213572
|
hasError: false,
|
|
213520
213573
|
hasEntries: false
|
|
213521
213574
|
};
|
|
@@ -213523,7 +213576,7 @@ var createBuildScriptRuntime = (moduleExports, env) => {
|
|
|
213523
213576
|
const moduleRecord = moduleExports;
|
|
213524
213577
|
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);
|
|
213525
213578
|
const buildScript = createBuildHooks(moduleExports, env, false);
|
|
213526
|
-
const checkerResult =
|
|
213579
|
+
const checkerResult = createNodeFieldCheckers(moduleExports, env);
|
|
213527
213580
|
const hasEntries = Boolean(buildScript) || checkerResult.hasCheckers;
|
|
213528
213581
|
if (!hasEntries) {
|
|
213529
213582
|
logger.error(
|
|
@@ -213532,39 +213585,35 @@ var createBuildScriptRuntime = (moduleExports, env) => {
|
|
|
213532
213585
|
}
|
|
213533
213586
|
return {
|
|
213534
213587
|
buildScript,
|
|
213535
|
-
|
|
213588
|
+
nodeFieldCheckers: checkerResult.checkers,
|
|
213536
213589
|
hasError: checkerResult.hasError || !hasEntries || hasBuildHookCandidate && !buildScript,
|
|
213537
213590
|
hasEntries
|
|
213538
213591
|
};
|
|
213539
213592
|
};
|
|
213540
213593
|
var createBuildScriptRuntimeWithCheckModules = (buildScriptModule, checkScriptModules, env) => {
|
|
213541
213594
|
const runtime = createBuildScriptRuntime(buildScriptModule, env);
|
|
213542
|
-
const
|
|
213595
|
+
const nodeFieldCheckers = new Map(runtime.nodeFieldCheckers);
|
|
213543
213596
|
let hasError = runtime.hasError;
|
|
213544
213597
|
let hasCheckEntries = false;
|
|
213545
213598
|
for (const checkScript of checkScriptModules) {
|
|
213546
|
-
const checkerResult =
|
|
213599
|
+
const checkerResult = createNodeFieldCheckers(checkScript.moduleExports, env);
|
|
213547
213600
|
if (!checkerResult.hasCheckers) {
|
|
213548
|
-
logger.error(
|
|
213549
|
-
`check script must export at least one @behavior3.check class: ${checkScript.path}`
|
|
213550
|
-
);
|
|
213551
|
-
hasError = true;
|
|
213552
213601
|
continue;
|
|
213553
213602
|
}
|
|
213554
213603
|
hasCheckEntries = true;
|
|
213555
213604
|
hasError = hasError || checkerResult.hasError;
|
|
213556
213605
|
for (const [name, checker] of checkerResult.checkers) {
|
|
213557
|
-
if (
|
|
213606
|
+
if (nodeFieldCheckers.has(name)) {
|
|
213558
213607
|
logger.error(`duplicate @behavior3.check registration: ${name}`);
|
|
213559
213608
|
hasError = true;
|
|
213560
213609
|
continue;
|
|
213561
213610
|
}
|
|
213562
|
-
|
|
213611
|
+
nodeFieldCheckers.set(name, checker);
|
|
213563
213612
|
}
|
|
213564
213613
|
}
|
|
213565
213614
|
return {
|
|
213566
213615
|
...runtime,
|
|
213567
|
-
|
|
213616
|
+
nodeFieldCheckers,
|
|
213568
213617
|
hasError,
|
|
213569
213618
|
hasEntries: runtime.hasEntries || hasCheckEntries
|
|
213570
213619
|
};
|
|
@@ -213710,7 +213759,7 @@ var processBatchTree = (tree, treePath, batch, errors) => {
|
|
|
213710
213759
|
}
|
|
213711
213760
|
return tree;
|
|
213712
213761
|
};
|
|
213713
|
-
var
|
|
213762
|
+
var normalizeNodeFieldCheckResult = (result) => {
|
|
213714
213763
|
if (Array.isArray(result)) {
|
|
213715
213764
|
return result.filter((entry) => typeof entry === "string" && entry.trim());
|
|
213716
213765
|
}
|
|
@@ -213728,7 +213777,99 @@ var walkTreeNodes = (node, visit) => {
|
|
|
213728
213777
|
walkTreeNodes(child, visit);
|
|
213729
213778
|
}
|
|
213730
213779
|
};
|
|
213731
|
-
var
|
|
213780
|
+
var buildNodeSlotField = (slot, slotDefs, index) => {
|
|
213781
|
+
const parsed = parseSlotDefinition(slot, slotDefs, index);
|
|
213782
|
+
return {
|
|
213783
|
+
name: parsed.name,
|
|
213784
|
+
label: parsed.label,
|
|
213785
|
+
required: parsed.required,
|
|
213786
|
+
variadic: parsed.variadic,
|
|
213787
|
+
checker: parsed.checker,
|
|
213788
|
+
visible: parsed.visible
|
|
213789
|
+
};
|
|
213790
|
+
};
|
|
213791
|
+
var getSlotValue = (values, slotDefs, index) => {
|
|
213792
|
+
const slotField = parseSlotDefinition(slotDefs?.[index] ?? "", slotDefs, index);
|
|
213793
|
+
return slotField.variadic ? values?.slice(index) ?? [] : values?.[index];
|
|
213794
|
+
};
|
|
213795
|
+
var getNodeSlotContext = (params) => {
|
|
213796
|
+
if (!isStructuredSlotDefinition(params.slot)) {
|
|
213797
|
+
return null;
|
|
213798
|
+
}
|
|
213799
|
+
return {
|
|
213800
|
+
node: params.node,
|
|
213801
|
+
tree: params.tree,
|
|
213802
|
+
nodeDef: params.nodeDef,
|
|
213803
|
+
fieldKind: params.fieldKind,
|
|
213804
|
+
fieldName: buildNodeSlotField(params.slot, params.slotDefs, params.index).name,
|
|
213805
|
+
fieldIndex: params.index,
|
|
213806
|
+
slot: params.fieldKind === "input" ? params.slot : params.slot,
|
|
213807
|
+
slotField: buildNodeSlotField(params.slot, params.slotDefs, params.index),
|
|
213808
|
+
treePath: params.treePath,
|
|
213809
|
+
env: params.env
|
|
213810
|
+
};
|
|
213811
|
+
};
|
|
213812
|
+
var visitCustomNodeFields = (params) => {
|
|
213813
|
+
for (const arg of params.nodeDef.args ?? []) {
|
|
213814
|
+
const checkerName = arg.checker?.trim() || void 0;
|
|
213815
|
+
const visibleName = arg.visible?.trim() || void 0;
|
|
213816
|
+
if (!(checkerName || visibleName)) {
|
|
213817
|
+
continue;
|
|
213818
|
+
}
|
|
213819
|
+
const ctx = {
|
|
213820
|
+
node: params.node,
|
|
213821
|
+
tree: params.tree,
|
|
213822
|
+
nodeDef: params.nodeDef,
|
|
213823
|
+
fieldKind: "arg",
|
|
213824
|
+
fieldName: arg.name,
|
|
213825
|
+
arg,
|
|
213826
|
+
treePath: params.treePath,
|
|
213827
|
+
env: params.env
|
|
213828
|
+
};
|
|
213829
|
+
params.onArg?.({
|
|
213830
|
+
fieldName: arg.name,
|
|
213831
|
+
checkerName,
|
|
213832
|
+
visibleName,
|
|
213833
|
+
value: params.node.args?.[arg.name],
|
|
213834
|
+
ctx
|
|
213835
|
+
});
|
|
213836
|
+
}
|
|
213837
|
+
for (const [fieldKind, slotDefs, values, visitor] of [
|
|
213838
|
+
["input", params.nodeDef.input, params.node.input, params.onInput],
|
|
213839
|
+
["output", params.nodeDef.output, params.node.output, params.onOutput]
|
|
213840
|
+
]) {
|
|
213841
|
+
for (let index = 0; index < (slotDefs?.length ?? 0); index += 1) {
|
|
213842
|
+
const slot = slotDefs?.[index] ?? "";
|
|
213843
|
+
const slotField = buildNodeSlotField(slot, slotDefs, index);
|
|
213844
|
+
if (!(slotField.checker || slotField.visible)) {
|
|
213845
|
+
continue;
|
|
213846
|
+
}
|
|
213847
|
+
const ctx = getNodeSlotContext({
|
|
213848
|
+
fieldKind,
|
|
213849
|
+
node: params.node,
|
|
213850
|
+
tree: params.tree,
|
|
213851
|
+
nodeDef: params.nodeDef,
|
|
213852
|
+
slotDefs,
|
|
213853
|
+
slot,
|
|
213854
|
+
index,
|
|
213855
|
+
treePath: params.treePath,
|
|
213856
|
+
env: params.env
|
|
213857
|
+
});
|
|
213858
|
+
if (!ctx) {
|
|
213859
|
+
continue;
|
|
213860
|
+
}
|
|
213861
|
+
visitor?.({
|
|
213862
|
+
fieldName: slotField.name,
|
|
213863
|
+
fieldIndex: index,
|
|
213864
|
+
checkerName: slotField.checker,
|
|
213865
|
+
visibleName: slotField.visible,
|
|
213866
|
+
value: getSlotValue(values, slotDefs, index),
|
|
213867
|
+
ctx
|
|
213868
|
+
});
|
|
213869
|
+
}
|
|
213870
|
+
}
|
|
213871
|
+
};
|
|
213872
|
+
var collectNodeFieldCheckDiagnostics = (params) => {
|
|
213732
213873
|
const diagnostics = [];
|
|
213733
213874
|
const targets = params.targets ?? [];
|
|
213734
213875
|
const entries = targets.length ? targets : (() => {
|
|
@@ -213742,47 +213883,100 @@ var collectNodeArgCheckDiagnostics = (params) => {
|
|
|
213742
213883
|
if (!nodeDef) {
|
|
213743
213884
|
continue;
|
|
213744
213885
|
}
|
|
213745
|
-
|
|
213746
|
-
|
|
213747
|
-
|
|
213748
|
-
|
|
213749
|
-
|
|
213750
|
-
|
|
213751
|
-
|
|
213752
|
-
|
|
213753
|
-
|
|
213754
|
-
|
|
213755
|
-
|
|
213756
|
-
|
|
213757
|
-
|
|
213758
|
-
|
|
213759
|
-
|
|
213760
|
-
|
|
213761
|
-
|
|
213762
|
-
|
|
213763
|
-
|
|
213764
|
-
|
|
213765
|
-
|
|
213766
|
-
const
|
|
213767
|
-
|
|
213768
|
-
|
|
213769
|
-
|
|
213770
|
-
|
|
213771
|
-
|
|
213772
|
-
|
|
213773
|
-
|
|
213774
|
-
|
|
213775
|
-
})
|
|
213776
|
-
|
|
213777
|
-
|
|
213778
|
-
|
|
213779
|
-
|
|
213886
|
+
visitCustomNodeFields({
|
|
213887
|
+
node,
|
|
213888
|
+
tree: params.tree,
|
|
213889
|
+
nodeDef,
|
|
213890
|
+
treePath: target.treePath ?? params.treePath,
|
|
213891
|
+
env: params.env,
|
|
213892
|
+
onArg: ({ fieldName, checkerName, value, ctx }) => {
|
|
213893
|
+
if (!checkerName) {
|
|
213894
|
+
return;
|
|
213895
|
+
}
|
|
213896
|
+
const pushDiagnostic = (message) => {
|
|
213897
|
+
diagnostics.push({
|
|
213898
|
+
instanceKey: target.instanceKey,
|
|
213899
|
+
nodeId: node.id,
|
|
213900
|
+
nodeName: node.name,
|
|
213901
|
+
fieldKind: "arg",
|
|
213902
|
+
fieldName,
|
|
213903
|
+
checker: checkerName,
|
|
213904
|
+
message
|
|
213905
|
+
});
|
|
213906
|
+
};
|
|
213907
|
+
const checker = params.checkers.get(checkerName);
|
|
213908
|
+
if (!checker) {
|
|
213909
|
+
pushDiagnostic(`checker '${checkerName}' is not registered`);
|
|
213910
|
+
return;
|
|
213911
|
+
}
|
|
213912
|
+
try {
|
|
213913
|
+
const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
|
|
213914
|
+
messages.forEach(pushDiagnostic);
|
|
213915
|
+
} catch (error) {
|
|
213916
|
+
pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
|
|
213917
|
+
}
|
|
213918
|
+
},
|
|
213919
|
+
onInput: ({ fieldName, fieldIndex, checkerName, value, ctx }) => {
|
|
213920
|
+
if (!checkerName) {
|
|
213921
|
+
return;
|
|
213922
|
+
}
|
|
213923
|
+
const pushDiagnostic = (message) => {
|
|
213924
|
+
diagnostics.push({
|
|
213925
|
+
instanceKey: target.instanceKey,
|
|
213926
|
+
nodeId: node.id,
|
|
213927
|
+
nodeName: node.name,
|
|
213928
|
+
fieldKind: "input",
|
|
213929
|
+
fieldName,
|
|
213930
|
+
fieldIndex,
|
|
213931
|
+
checker: checkerName,
|
|
213932
|
+
message
|
|
213933
|
+
});
|
|
213934
|
+
};
|
|
213935
|
+
const checker = params.checkers.get(checkerName);
|
|
213936
|
+
if (!checker) {
|
|
213937
|
+
pushDiagnostic(`checker '${checkerName}' is not registered`);
|
|
213938
|
+
return;
|
|
213939
|
+
}
|
|
213940
|
+
try {
|
|
213941
|
+
const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
|
|
213942
|
+
messages.forEach(pushDiagnostic);
|
|
213943
|
+
} catch (error) {
|
|
213944
|
+
pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
|
|
213945
|
+
}
|
|
213946
|
+
},
|
|
213947
|
+
onOutput: ({ fieldName, fieldIndex, checkerName, value, ctx }) => {
|
|
213948
|
+
if (!checkerName) {
|
|
213949
|
+
return;
|
|
213950
|
+
}
|
|
213951
|
+
const pushDiagnostic = (message) => {
|
|
213952
|
+
diagnostics.push({
|
|
213953
|
+
instanceKey: target.instanceKey,
|
|
213954
|
+
nodeId: node.id,
|
|
213955
|
+
nodeName: node.name,
|
|
213956
|
+
fieldKind: "output",
|
|
213957
|
+
fieldName,
|
|
213958
|
+
fieldIndex,
|
|
213959
|
+
checker: checkerName,
|
|
213960
|
+
message
|
|
213961
|
+
});
|
|
213962
|
+
};
|
|
213963
|
+
const checker = params.checkers.get(checkerName);
|
|
213964
|
+
if (!checker) {
|
|
213965
|
+
pushDiagnostic(`checker '${checkerName}' is not registered`);
|
|
213966
|
+
return;
|
|
213967
|
+
}
|
|
213968
|
+
try {
|
|
213969
|
+
const messages = normalizeNodeFieldCheckResult(checker.validate(value, ctx));
|
|
213970
|
+
messages.forEach(pushDiagnostic);
|
|
213971
|
+
} catch (error) {
|
|
213972
|
+
pushDiagnostic(`checker '${checkerName}' failed: ${formatRuntimeError(error)}`);
|
|
213973
|
+
}
|
|
213780
213974
|
}
|
|
213781
|
-
}
|
|
213975
|
+
});
|
|
213782
213976
|
}
|
|
213783
213977
|
return diagnostics;
|
|
213784
213978
|
};
|
|
213785
|
-
var
|
|
213979
|
+
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}`;
|
|
213786
213980
|
var syncFilesFromDiskWithContext = (files, parsedVarDecl, workdir) => {
|
|
213787
213981
|
if (!hasFs()) {
|
|
213788
213982
|
return;
|
|
@@ -213949,7 +214143,8 @@ var applyBehavior3DecoratorGlobal = () => {
|
|
|
213949
214143
|
...decoratorGlobalState.previousBehavior3 && typeof decoratorGlobalState.previousBehavior3 === "object" ? decoratorGlobalState.previousBehavior3 : {},
|
|
213950
214144
|
build: markBuildHook,
|
|
213951
214145
|
batch: markBatchHook,
|
|
213952
|
-
check: markCheckHook
|
|
214146
|
+
check: markCheckHook,
|
|
214147
|
+
visible: markVisibleHook
|
|
213953
214148
|
};
|
|
213954
214149
|
};
|
|
213955
214150
|
var restoreBehavior3DecoratorGlobal = () => {
|
|
@@ -214259,16 +214454,16 @@ var buildProjectWithContext = async (project, buildDir, context) => {
|
|
|
214259
214454
|
if (!context.checkNodeData(tree.root, (message) => errors.push(message))) {
|
|
214260
214455
|
hasError = true;
|
|
214261
214456
|
}
|
|
214262
|
-
const checkDiagnostics =
|
|
214457
|
+
const checkDiagnostics = collectNodeFieldCheckDiagnostics({
|
|
214263
214458
|
tree,
|
|
214264
214459
|
treePath: candidatePath,
|
|
214265
214460
|
env: scriptEnv,
|
|
214266
|
-
checkers: buildRuntime.
|
|
214461
|
+
checkers: buildRuntime.nodeFieldCheckers
|
|
214267
214462
|
});
|
|
214268
214463
|
if (checkDiagnostics.length) {
|
|
214269
214464
|
hasError = true;
|
|
214270
214465
|
checkDiagnostics.forEach(
|
|
214271
|
-
(diagnostic) => errors.push(
|
|
214466
|
+
(diagnostic) => errors.push(formatNodeFieldCheckBuildDiagnostic(diagnostic))
|
|
214272
214467
|
);
|
|
214273
214468
|
}
|
|
214274
214469
|
if (errors.length) {
|
|
@@ -214991,6 +215186,12 @@ var Node = class _Node {
|
|
|
214991
215186
|
info(msg) {
|
|
214992
215187
|
console.info(`${this.cfg.tree.name}->${this.name}#${this.id}: ${msg}`);
|
|
214993
215188
|
}
|
|
215189
|
+
/**
|
|
215190
|
+
* use console.log to print log message
|
|
215191
|
+
*/
|
|
215192
|
+
log(msg) {
|
|
215193
|
+
console.log(`${this.cfg.tree.name}->${this.name}#${this.id}: ${msg}`);
|
|
215194
|
+
}
|
|
214994
215195
|
_checkOneof(inputIndex, argValue, defaultValue) {
|
|
214995
215196
|
const inputValue = this.input[inputIndex];
|
|
214996
215197
|
const inputName = this.cfg.input[inputIndex];
|
|
@@ -215051,17 +215252,24 @@ function registerNode(cls) {
|
|
|
215051
215252
|
descriptor
|
|
215052
215253
|
});
|
|
215053
215254
|
}
|
|
215054
|
-
var
|
|
215255
|
+
var StackSlice = class {
|
|
215055
215256
|
_nodes = [];
|
|
215056
|
-
_tree;
|
|
215057
|
-
constructor(tree) {
|
|
215058
|
-
this._tree = tree;
|
|
215059
|
-
}
|
|
215060
215257
|
get length() {
|
|
215061
215258
|
return this._nodes.length;
|
|
215062
215259
|
}
|
|
215063
|
-
|
|
215064
|
-
|
|
215260
|
+
move(dest, start) {
|
|
215261
|
+
const count = this._nodes.length - start;
|
|
215262
|
+
dest._nodes.push(...this._nodes.splice(start, count));
|
|
215263
|
+
}
|
|
215264
|
+
clear() {
|
|
215265
|
+
this._nodes.length = 0;
|
|
215266
|
+
}
|
|
215267
|
+
};
|
|
215268
|
+
var Stack = class extends StackSlice {
|
|
215269
|
+
_tree;
|
|
215270
|
+
constructor(tree) {
|
|
215271
|
+
super();
|
|
215272
|
+
this._tree = tree;
|
|
215065
215273
|
}
|
|
215066
215274
|
top() {
|
|
215067
215275
|
const nodes = this._nodes;
|
|
@@ -215082,9 +215290,6 @@ var Stack = class {
|
|
|
215082
215290
|
this.pop();
|
|
215083
215291
|
}
|
|
215084
215292
|
}
|
|
215085
|
-
move(dest, start, count) {
|
|
215086
|
-
dest._nodes.push(...this._nodes.splice(start, count));
|
|
215087
|
-
}
|
|
215088
215293
|
clear() {
|
|
215089
215294
|
this.popTo(0);
|
|
215090
215295
|
}
|
|
@@ -215993,7 +216198,7 @@ var Parallel = class extends (_a17 = Node) {
|
|
|
215993
216198
|
if (childStack === void 0) {
|
|
215994
216199
|
status = children[i].tick(tree);
|
|
215995
216200
|
} else if (childStack.length > 0) {
|
|
215996
|
-
childStack.move(stack, 0
|
|
216201
|
+
childStack.move(stack, 0);
|
|
215997
216202
|
while (stack.length > level) {
|
|
215998
216203
|
status = stack.top().tick(tree);
|
|
215999
216204
|
if (status === "running") {
|
|
@@ -216005,9 +216210,9 @@ var Parallel = class extends (_a17 = Node) {
|
|
|
216005
216210
|
}
|
|
216006
216211
|
if (status === "running") {
|
|
216007
216212
|
if (childStack === void 0) {
|
|
216008
|
-
childStack = new
|
|
216213
|
+
childStack = new StackSlice();
|
|
216009
216214
|
}
|
|
216010
|
-
stack.move(childStack, level
|
|
216215
|
+
stack.move(childStack, level);
|
|
216011
216216
|
} else {
|
|
216012
216217
|
count++;
|
|
216013
216218
|
childStack = EMPTY_STACK$1;
|
|
@@ -216053,7 +216258,7 @@ var Race = class extends (_a18 = Node) {
|
|
|
216053
216258
|
if (childStack === void 0) {
|
|
216054
216259
|
status = children[i].tick(tree);
|
|
216055
216260
|
} else if (childStack.length > 0) {
|
|
216056
|
-
childStack.move(stack, 0
|
|
216261
|
+
childStack.move(stack, 0);
|
|
216057
216262
|
while (stack.length > level) {
|
|
216058
216263
|
status = stack.top().tick(tree);
|
|
216059
216264
|
if (status === "running") {
|
|
@@ -216063,9 +216268,9 @@ var Race = class extends (_a18 = Node) {
|
|
|
216063
216268
|
}
|
|
216064
216269
|
if (status === "running") {
|
|
216065
216270
|
if (childStack === void 0) {
|
|
216066
|
-
childStack = new
|
|
216271
|
+
childStack = new StackSlice();
|
|
216067
216272
|
}
|
|
216068
|
-
stack.move(childStack, level
|
|
216273
|
+
stack.move(childStack, level);
|
|
216069
216274
|
} else if (status === "success") {
|
|
216070
216275
|
last.forEach((v) => v !== EMPTY_STACK && v.clear());
|
|
216071
216276
|
return "success";
|
|
@@ -216301,7 +216506,7 @@ var Watchdog = class extends (_a23 = Node) {
|
|
|
216301
216506
|
} else if (last === void 0) {
|
|
216302
216507
|
status = this.children[1].tick(tree);
|
|
216303
216508
|
} else {
|
|
216304
|
-
last.move(tree.stack, 0
|
|
216509
|
+
last.move(tree.stack, 0);
|
|
216305
216510
|
while (tree.stack.length > level) {
|
|
216306
216511
|
const child = tree.stack.top();
|
|
216307
216512
|
status = child.tick(tree);
|
|
@@ -216312,9 +216517,9 @@ var Watchdog = class extends (_a23 = Node) {
|
|
|
216312
216517
|
}
|
|
216313
216518
|
if (status === "running") {
|
|
216314
216519
|
if (last === void 0) {
|
|
216315
|
-
last = new
|
|
216520
|
+
last = new StackSlice();
|
|
216316
216521
|
}
|
|
216317
|
-
tree.stack.move(last, level
|
|
216522
|
+
tree.stack.move(last, level);
|
|
216318
216523
|
return tree.yield(this, last);
|
|
216319
216524
|
} else {
|
|
216320
216525
|
return status;
|
|
@@ -217140,7 +217345,7 @@ var Timeout = class extends (_a41 = Node) {
|
|
|
217140
217345
|
last.stack.clear();
|
|
217141
217346
|
return "failure";
|
|
217142
217347
|
} else {
|
|
217143
|
-
last.stack.move(stack, 0
|
|
217348
|
+
last.stack.move(stack, 0);
|
|
217144
217349
|
while (stack.length > level) {
|
|
217145
217350
|
const child = stack.top();
|
|
217146
217351
|
status = child.tick(tree);
|
|
@@ -217153,11 +217358,11 @@ var Timeout = class extends (_a41 = Node) {
|
|
|
217153
217358
|
if (last === void 0) {
|
|
217154
217359
|
const time = this._checkOneof(0, this.args.time, 0);
|
|
217155
217360
|
last = {
|
|
217156
|
-
stack: new
|
|
217361
|
+
stack: new StackSlice(),
|
|
217157
217362
|
expired: context.time + time
|
|
217158
217363
|
};
|
|
217159
217364
|
}
|
|
217160
|
-
stack.move(last.stack, level
|
|
217365
|
+
stack.move(last.stack, level);
|
|
217161
217366
|
return tree.yield(this, last);
|
|
217162
217367
|
} else {
|
|
217163
217368
|
return status;
|
|
@@ -217180,6 +217385,7 @@ var Timeout = class extends (_a41 = Node) {
|
|
|
217180
217385
|
}
|
|
217181
217386
|
],
|
|
217182
217387
|
doc: `
|
|
217388
|
+
+ \u5728\u9650\u5B9A\u65F6\u95F4\u5185\u6267\u884C\u5B50\u8282\u70B9\uFF0C\u8D85\u65F6\u5219\u5931\u8D25
|
|
217183
217389
|
+ \u53EA\u80FD\u6709\u4E00\u4E2A\u5B50\u8282\u70B9\uFF0C\u591A\u4E2A\u4EC5\u6267\u884C\u7B2C\u4E00\u4E2A
|
|
217184
217390
|
+ \u5F53\u5B50\u8282\u70B9\u6267\u884C\u8D85\u65F6\u6216\u8FD4\u56DE \`failure\` \u65F6\uFF0C\u8FD4\u56DE \`failure\`
|
|
217185
217391
|
+ \u5176\u4F59\u60C5\u51B5\u8FD4\u56DE\u5B50\u8282\u70B9\u7684\u6267\u884C\u72B6\u6001
|
|
@@ -217589,6 +217795,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217589
217795
|
let hasVaridicInput = false;
|
|
217590
217796
|
if (conf.input) {
|
|
217591
217797
|
for (let i = 0; i < conf.input.length; i++) {
|
|
217798
|
+
const slotDefinition = parseSlotDefinition(conf.input[i] ?? "", conf.input, i);
|
|
217592
217799
|
if (!data.input) {
|
|
217593
217800
|
data.input = [];
|
|
217594
217801
|
}
|
|
@@ -217596,7 +217803,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217596
217803
|
data.input[i] = "";
|
|
217597
217804
|
}
|
|
217598
217805
|
if (!isValidInputOrOutput(conf.input, data.input, i)) {
|
|
217599
|
-
error(`intput field '${
|
|
217806
|
+
error(`intput field '${slotDefinition.label}' is required`);
|
|
217600
217807
|
hasError = true;
|
|
217601
217808
|
}
|
|
217602
217809
|
if (i === conf.input.length - 1 && isVariadic(conf.input, -1)) {
|
|
@@ -217610,6 +217817,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217610
217817
|
let hasVaridicOutput = false;
|
|
217611
217818
|
if (conf.output) {
|
|
217612
217819
|
for (let i = 0; i < conf.output.length; i++) {
|
|
217820
|
+
const slotDefinition = parseSlotDefinition(conf.output[i] ?? "", conf.output, i);
|
|
217613
217821
|
if (!data.output) {
|
|
217614
217822
|
data.output = [];
|
|
217615
217823
|
}
|
|
@@ -217617,7 +217825,7 @@ var checkNodeDataWithState = (data, printer, state) => {
|
|
|
217617
217825
|
data.output[i] = "";
|
|
217618
217826
|
}
|
|
217619
217827
|
if (!isValidInputOrOutput(conf.output, data.output, i)) {
|
|
217620
|
-
error(`output field '${
|
|
217828
|
+
error(`output field '${slotDefinition.label}' is required`);
|
|
217621
217829
|
hasError = true;
|
|
217622
217830
|
}
|
|
217623
217831
|
if (i === conf.output.length - 1 && isVariadic(conf.output, -1)) {
|