@lark-apaas/fullstack-cli 1.1.71-alpha.20261105073806 → 1.1.71-alpha.20261105083242

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5744,14 +5744,11 @@ async function listAll(summary) {
5744
5744
 
5745
5745
  // src/commands/capability/template-refs.ts
5746
5746
  var INPUT_REF_REGEX = /\{\{\s*input\.([a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*\s*\}\}/g;
5747
- var BLOCK_SYNTAX_REGEX = /\{\{\s*(#if|#each|#unless|\/if|\/each|\/unless|else)\b[^}]*\}\}/;
5748
5747
  var TemplateIssueCode = {
5749
5748
  /** 表单值引用了 paramsSchema 没声明的变量 */
5750
5749
  UNDEFINED_INPUT_REF: "UNDEFINED_INPUT_REF",
5751
- /** paramsSchema 声明的变量表单值里没有引用 */
5752
- UNUSED_INPUT_PARAM: "UNUSED_INPUT_PARAM",
5753
- /** 用了模板引擎不支持的块语法 */
5754
- UNSUPPORTED_TEMPLATE_SYNTAX: "UNSUPPORTED_TEMPLATE_SYNTAX"
5750
+ /** paramsSchema 声明的变量表单值里没有引用(提醒,不阻塞) */
5751
+ UNUSED_INPUT_PARAM: "UNUSED_INPUT_PARAM"
5755
5752
  };
5756
5753
  function toJsonPointer(path28) {
5757
5754
  if (path28.length === 0) {
@@ -5784,24 +5781,17 @@ function declaredParams(paramsSchema) {
5784
5781
  return Object.keys(properties);
5785
5782
  }
5786
5783
  function checkTemplateRefs(formValue, paramsSchema) {
5787
- const issues = [];
5784
+ const errors = [];
5785
+ const reminders = [];
5788
5786
  const declared = new Set(declaredParams(paramsSchema));
5789
5787
  const referenced = /* @__PURE__ */ new Set();
5790
5788
  forEachString(formValue, [], (str, path28) => {
5791
5789
  const pointer = toJsonPointer(path28);
5792
- const block = str.match(BLOCK_SYNTAX_REGEX);
5793
- if (block) {
5794
- issues.push({
5795
- code: TemplateIssueCode.UNSUPPORTED_TEMPLATE_SYNTAX,
5796
- path: pointer,
5797
- message: `Template block syntax ${block[0]} is not supported; only {{input.x}} references are replaced at runtime`
5798
- });
5799
- }
5800
5790
  for (const match of str.matchAll(INPUT_REF_REGEX)) {
5801
5791
  const name = match[1];
5802
5792
  referenced.add(name);
5803
5793
  if (!declared.has(name)) {
5804
- issues.push({
5794
+ errors.push({
5805
5795
  code: TemplateIssueCode.UNDEFINED_INPUT_REF,
5806
5796
  path: pointer,
5807
5797
  message: `{{input.${name}}} is not declared in paramsSchema.properties`
@@ -5811,13 +5801,13 @@ function checkTemplateRefs(formValue, paramsSchema) {
5811
5801
  });
5812
5802
  for (const name of declared) {
5813
5803
  if (!referenced.has(name)) {
5814
- issues.push({
5804
+ reminders.push({
5815
5805
  code: TemplateIssueCode.UNUSED_INPUT_PARAM,
5816
5806
  message: `paramsSchema declares "${name}" but the form value never references {{input.${name}}}, so the value passed for it would be dropped`
5817
5807
  });
5818
5808
  }
5819
5809
  }
5820
- return issues;
5810
+ return { errors, reminders };
5821
5811
  }
5822
5812
 
5823
5813
  // src/commands/capability/validate.handler.ts
@@ -5911,20 +5901,22 @@ async function runValidate(options, resolvedParamsSchema) {
5911
5901
  normalizedFormValue = parsed.data;
5912
5902
  }
5913
5903
  }
5904
+ let templateReminders = [];
5914
5905
  if (manifest.form?.refType !== "config") {
5915
5906
  const paramsSchema = explicitParamsSchema ?? instance?.paramsSchema ?? {};
5916
- const issues = checkTemplateRefs(next, paramsSchema);
5917
- if (issues.length > 0) {
5907
+ const { errors, reminders } = checkTemplateRefs(next, paramsSchema);
5908
+ if (errors.length > 0) {
5918
5909
  return {
5919
5910
  ok: false,
5920
5911
  code: FormCliErrorCode.INVALID_INPUT,
5921
- message: `form value templates do not match paramsSchema (${issues.length} issue(s))`,
5922
- hint: "Declare every {{input.x}} used in the form value under paramsSchema.properties (pass it with --params-schema), reference every declared param, and use no block syntax such as {{#if}}; then run again.",
5923
- issues,
5912
+ message: `form value references params not declared in paramsSchema (${errors.length} issue(s))`,
5913
+ hint: "Declare every {{input.x}} used in the form value under paramsSchema.properties (pass it with --params-schema), or remove the reference; then run again.",
5914
+ issues: [...errors, ...reminders],
5924
5915
  validated: false,
5925
5916
  pluginVersion
5926
5917
  };
5927
5918
  }
5919
+ templateReminders = reminders;
5928
5920
  }
5929
5921
  const manifestClaims = manifest.hasValidateForm === true;
5930
5922
  const sdkReady = hasFormActionSdk(module);
@@ -5955,7 +5947,7 @@ async function runValidate(options, resolvedParamsSchema) {
5955
5947
  if (!pluginHas) {
5956
5948
  return {
5957
5949
  ok: true,
5958
- issues: [],
5950
+ issues: templateReminders,
5959
5951
  validated: false,
5960
5952
  pluginVersion,
5961
5953
  normalizedFormValue
@@ -5993,7 +5985,7 @@ async function runValidate(options, resolvedParamsSchema) {
5993
5985
  }
5994
5986
  const output = {
5995
5987
  ok: checked.success,
5996
- issues: checked.issues,
5988
+ issues: [...checked.issues, ...templateReminders],
5997
5989
  validated: true,
5998
5990
  pluginVersion,
5999
5991
  normalizedFormValue
@@ -6298,8 +6290,8 @@ Output: {ok, validated, pluginVersion, issues, normalizedFormValue} (exit 0); wh
6298
6290
  ok: false with code VALIDATION_FAILED or INVALID_INPUT, plus issues and hint (exit 1).
6299
6291
  validated: false means the plugin has no validateForm, so only the schema check ran.
6300
6292
  For action plugins (form.refType is not config) the schema check is replaced by a template check:
6301
- every {{input.x}} in the form value must be declared in paramsSchema.properties and every declared
6302
- param must be referenced; block syntax such as {{#if}} is rejected.
6293
+ every {{input.x}} in the form value must be declared in paramsSchema.properties (otherwise
6294
+ INVALID_INPUT); a declared param that is never referenced only adds a reminder to issues.
6303
6295
  Requires MIAODA_AUTHN_CODE only when the plugin defines validateForm.
6304
6296
 
6305
6297
  Examples:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.71-alpha.20261105073806",
3
+ "version": "1.1.71-alpha.20261105083242",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",