openxiangda 1.0.0 → 1.0.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.
@@ -1450,20 +1450,4 @@ var usePageProps = () => {
1450
1450
  var usePageRoute = () => {
1451
1451
  return usePageContext().route;
1452
1452
  };
1453
- // Annotate the CommonJS export names for ESM import in node:
1454
- 0 && (module.exports = {
1455
- PageProvider,
1456
- createPageSdk,
1457
- createReactPage,
1458
- useCurrentUser,
1459
- useDataSource,
1460
- useFormViewPermissions,
1461
- useMessage,
1462
- useModal,
1463
- useNavigation,
1464
- usePageContext,
1465
- usePageProps,
1466
- usePageRoute,
1467
- usePageSdk
1468
- });
1469
1453
  //# sourceMappingURL=index.cjs.map
@@ -53,8 +53,4 @@ var antdTheme = {
53
53
  }
54
54
  };
55
55
  var antd_theme_default = antdTheme;
56
- // Annotate the CommonJS export names for ESM import in node:
57
- 0 && (module.exports = {
58
- antdTheme
59
- });
60
56
  //# sourceMappingURL=antd-theme.cjs.map
@@ -237,6 +237,7 @@ import { App as AntdApp, ConfigProvider } from 'antd';
237
237
  import zhCN from 'antd/locale/zh_CN';
238
238
  import * as SyFormComponentsModule from 'openxiangda';
239
239
  import { antdTheme } from 'openxiangda/antd-theme';
240
+ import 'antd-mobile/es/global';
240
241
  import '../src/index.css';
241
242
 
242
243
  const runtimeVersion = '${runtimeVersionPlaceholder}';
@@ -751,9 +752,14 @@ async function main() {
751
752
  const startedAt = Date.now();
752
753
  console.log("[build] 构建表单页面");
753
754
  console.log("[build] 构建模式: shared runtime");
754
- const only = normalizeOnly(args.only).filter((item) => item.startsWith("forms/"));
755
- const filterForm = args.form || (only.length === 1 ? only[0].slice("forms/".length) : "");
756
- const forms = discoverForms(filterForm);
755
+ const onlyTargets = normalizeOnly(args.only);
756
+ const only = onlyTargets.filter((item) => item.startsWith("forms/"));
757
+ if (onlyTargets.length > 0 && only.length === 0) {
758
+ console.log("[build] forms: No form targets selected");
759
+ return;
760
+ }
761
+ const requested = args.form ? [`forms/${args.form}`] : only;
762
+ const forms = discoverForms("");
757
763
 
758
764
  if (forms.length === 0) {
759
765
  if (args.form) {
@@ -763,16 +769,24 @@ async function main() {
763
769
  }
764
770
  process.exit(1);
765
771
  }
772
+ const formKeys = new Set(forms.map((form) => form.key));
773
+ const missing = requested.filter((key) => !formKeys.has(key));
774
+ if (missing.length > 0) {
775
+ console.error(
776
+ `错误: 找不到表单 ${missing.map((key) => `"${key.slice("forms/".length)}"`).join(", ")}`,
777
+ );
778
+ process.exit(1);
779
+ }
766
780
 
767
781
  const plan = planIncrementalBuild(forms, {
768
782
  force: args.force,
769
- only: only.length ? only : undefined,
783
+ only: requested.length ? requested : undefined,
770
784
  });
771
785
  printPlan(plan, "forms");
772
786
  if (args.dryRun) return;
773
787
  if (plan.changed.length === 0) return;
774
788
 
775
- if (plan.fullRebuild && !args.form && only.length === 0 && fs.existsSync(distDir)) {
789
+ if (plan.fullRebuild && requested.length === 0 && fs.existsSync(distDir)) {
776
790
  fs.rmSync(distDir, { recursive: true, force: true });
777
791
  }
778
792
 
@@ -731,9 +731,14 @@ async function main() {
731
731
  return;
732
732
  }
733
733
 
734
- const only = normalizeOnly(args.only).filter((item) => item.startsWith("pages/"));
735
- const filterPage = args.page || (only.length === 1 ? only[0].slice("pages/".length) : "");
736
- const pages = (await discoverPages(filterPage)).map((page) => ({
734
+ const onlyTargets = normalizeOnly(args.only);
735
+ const only = onlyTargets.filter((item) => item.startsWith("pages/"));
736
+ if (onlyTargets.length > 0 && only.length === 0) {
737
+ console.log("[build] pages: No page targets selected");
738
+ return;
739
+ }
740
+ const requested = args.page ? [`pages/${args.page}`] : only;
741
+ const pages = (await discoverPages("")).map((page) => ({
737
742
  ...page,
738
743
  key: `pages/${page.dirName}`,
739
744
  dirPath: page.dirPath,
@@ -745,16 +750,23 @@ async function main() {
745
750
  console.log("未发现复杂代码页,跳过 pages 构建");
746
751
  return;
747
752
  }
753
+ const pageKeys = new Set(pages.map((page) => page.key));
754
+ const missing = requested.filter((key) => !pageKeys.has(key));
755
+ if (missing.length > 0) {
756
+ throw new Error(
757
+ `找不到代码页 ${missing.map((key) => `"${key.slice("pages/".length)}"`).join(", ")}`,
758
+ );
759
+ }
748
760
 
749
761
  const plan = planIncrementalBuild(pages, {
750
762
  force: args.force,
751
- only: only.length ? only : undefined,
763
+ only: requested.length ? requested : undefined,
752
764
  });
753
765
  printPlan(plan, "pages");
754
766
  if (args.dryRun) return;
755
767
  if (plan.changed.length === 0) return;
756
768
 
757
- if (plan.fullRebuild && !args.page && only.length === 0) {
769
+ if (plan.fullRebuild && requested.length === 0) {
758
770
  await fs.rm(path.join(distRoot, "pages"), { recursive: true, force: true });
759
771
  }
760
772
  await fs.mkdir(tmpDir, { recursive: true });
@@ -3,12 +3,14 @@ import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { rootDir } from "./utils/load-config.mjs";
6
+ import { normalizeOnly } from "./utils/incremental.mjs";
6
7
 
7
8
  const require = createRequire(import.meta.url);
8
9
  const scriptDir = path.dirname(fileURLToPath(import.meta.url));
9
10
  const tsxCli = require.resolve("tsx/cli");
10
11
  const args = process.argv.slice(2).filter((arg) => arg !== "--");
11
12
  const forwardedArgs = [];
13
+ const onlyValues = [];
12
14
 
13
15
  if (args.includes("--help") || args.includes("-h")) {
14
16
  console.log(`
@@ -35,13 +37,32 @@ for (let index = 0; index < args.length; index += 1) {
35
37
  }
36
38
  if (arg === "--only" && args[index + 1]) {
37
39
  forwardedArgs.push(arg, args[index + 1]);
40
+ onlyValues.push(args[index + 1]);
38
41
  index += 1;
39
42
  }
40
43
  if (arg.startsWith("--only=")) {
41
44
  forwardedArgs.push(arg);
45
+ onlyValues.push(arg.slice("--only=".length));
42
46
  }
43
47
  }
44
48
 
49
+ const onlyTargets = normalizeOnly(onlyValues);
50
+ const invalidOnlyTargets = onlyTargets.filter(
51
+ (item) => !item.startsWith("forms/") && !item.startsWith("pages/"),
52
+ );
53
+ if (invalidOnlyTargets.length > 0) {
54
+ console.error(
55
+ `[build] --only 目标必须以 forms/ 或 pages/ 开头: ${invalidOnlyTargets.join(", ")}`,
56
+ );
57
+ process.exit(1);
58
+ }
59
+
60
+ const hasOnlyTargets = onlyTargets.length > 0;
61
+ const shouldBuildForms =
62
+ !hasOnlyTargets || onlyTargets.some((item) => item.startsWith("forms/"));
63
+ const shouldBuildPages =
64
+ !hasOnlyTargets || onlyTargets.some((item) => item.startsWith("pages/"));
65
+
45
66
  const runScript = (scriptName, args) =>
46
67
  new Promise((resolve, reject) => {
47
68
  const child = spawn(process.execPath, [tsxCli, path.join(scriptDir, scriptName), ...args], {
@@ -60,5 +81,9 @@ const runScript = (scriptName, args) =>
60
81
  });
61
82
  });
62
83
 
63
- await runScript("build-forms.mjs", forwardedArgs);
64
- await runScript("build-pages.mjs", forwardedArgs);
84
+ if (shouldBuildForms) {
85
+ await runScript("build-forms.mjs", forwardedArgs);
86
+ }
87
+ if (shouldBuildPages) {
88
+ await runScript("build-pages.mjs", forwardedArgs);
89
+ }
@@ -172,6 +172,10 @@ export function commitIncrementalBuild(plan, builtModules) {
172
172
  const previous = loadBuildCache();
173
173
  const entries = { ...(previous?.entries || {}) };
174
174
  const now = new Date().toISOString();
175
+ const isPartialBuild = plan.selected.length !== plan.all.length;
176
+ const preserveGlobalSnapshot = Boolean(
177
+ previous && isPartialBuild && plan.fullRebuild,
178
+ );
175
179
  for (const item of builtModules) {
176
180
  entries[item.key] = {
177
181
  contentHash: plan.snapshot.moduleHashes[item.key],
@@ -185,9 +189,15 @@ export function commitIncrementalBuild(plan, builtModules) {
185
189
  `${JSON.stringify(
186
190
  {
187
191
  version: CACHE_VERSION,
188
- lockfileHash: plan.snapshot.lockfileHash,
189
- sharedHash: plan.snapshot.sharedHash,
190
- configHash: plan.snapshot.configHash,
192
+ lockfileHash: preserveGlobalSnapshot
193
+ ? previous.lockfileHash
194
+ : plan.snapshot.lockfileHash,
195
+ sharedHash: preserveGlobalSnapshot
196
+ ? previous.sharedHash
197
+ : plan.snapshot.sharedHash,
198
+ configHash: preserveGlobalSnapshot
199
+ ? previous.configHash
200
+ : plan.snapshot.configHash,
191
201
  entries,
192
202
  },
193
203
  null,
@@ -63,6 +63,34 @@ const ignoredDirs = new Set([
63
63
  const runtimePackages = ["openxiangda"];
64
64
  const runtimePackageRegistry =
65
65
  process.env.APP_WORKSPACE_NPM_REGISTRY || "https://registry.npmjs.org/";
66
+ const legacyTemplateTiptapOverrideVersion = "3.23.6";
67
+ const legacyTemplateTiptapOverrideKeys = new Set([
68
+ "@tiptap/core",
69
+ "@tiptap/pm",
70
+ "@tiptap/react",
71
+ "@tiptap/starter-kit",
72
+ "@tiptap/extensions",
73
+ "@tiptap/extension-list",
74
+ "@tiptap/extension-blockquote",
75
+ "@tiptap/extension-bold",
76
+ "@tiptap/extension-bubble-menu",
77
+ "@tiptap/extension-bullet-list",
78
+ "@tiptap/extension-character-count",
79
+ "@tiptap/extension-code",
80
+ "@tiptap/extension-document",
81
+ "@tiptap/extension-floating-menu",
82
+ "@tiptap/extension-hard-break",
83
+ "@tiptap/extension-heading",
84
+ "@tiptap/extension-horizontal-rule",
85
+ "@tiptap/extension-italic",
86
+ "@tiptap/extension-list-item",
87
+ "@tiptap/extension-list-keymap",
88
+ "@tiptap/extension-ordered-list",
89
+ "@tiptap/extension-paragraph",
90
+ "@tiptap/extension-placeholder",
91
+ "@tiptap/extension-strike",
92
+ "@tiptap/extension-text",
93
+ ]);
66
94
 
67
95
  function usage() {
68
96
  return `
@@ -150,6 +178,19 @@ function writeJson(path, value) {
150
178
  writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`, "utf-8");
151
179
  }
152
180
 
181
+ function getLegacyTemplateTiptapOverrideKeys(overrides = {}) {
182
+ const tiptapKeys = Object.keys(overrides).filter((key) =>
183
+ key.startsWith("@tiptap/"),
184
+ );
185
+ if (tiptapKeys.length === 0) return [];
186
+ const isLegacyTemplateSet = tiptapKeys.every(
187
+ (key) =>
188
+ legacyTemplateTiptapOverrideKeys.has(key) &&
189
+ overrides[key] === legacyTemplateTiptapOverrideVersion,
190
+ );
191
+ return isLegacyTemplateSet ? tiptapKeys : [];
192
+ }
193
+
153
194
  function escapeRegExp(value) {
154
195
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
155
196
  }
@@ -298,10 +339,8 @@ function updatePackageJson(workspaceRoot, channel) {
298
339
  }
299
340
  }
300
341
  if (pkg.pnpm?.overrides) {
301
- for (const key of Object.keys(pkg.pnpm.overrides)) {
302
- if (key.startsWith("@tiptap/")) {
303
- delete pkg.pnpm.overrides[key];
304
- }
342
+ for (const key of getLegacyTemplateTiptapOverrideKeys(pkg.pnpm.overrides)) {
343
+ delete pkg.pnpm.overrides[key];
305
344
  }
306
345
  if (Object.keys(pkg.pnpm.overrides).length === 0) {
307
346
  delete pkg.pnpm.overrides;