openxiangda 1.0.41 → 1.0.43

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.
@@ -0,0 +1,8 @@
1
+ import type { BuiltinRouteOverrides } from "openxiangda/runtime";
2
+
3
+ export const runtimeRouteOverrides: BuiltinRouteOverrides = {
4
+ "form-submit": {},
5
+ "form-detail": {},
6
+ "process-detail": {},
7
+ "data-manage-list": {},
8
+ };
@@ -17,7 +17,23 @@
17
17
  "jsx": "react-jsx",
18
18
  "baseUrl": ".",
19
19
  "paths": {
20
- "@/*": ["src/*"]
20
+ "@/*": ["src/*"],
21
+ "openxiangda": [
22
+ "../../packages/sdk/src/components/index.ts",
23
+ "node_modules/openxiangda"
24
+ ],
25
+ "openxiangda/runtime": [
26
+ "../../packages/sdk/src/runtime/index.ts",
27
+ "node_modules/openxiangda/runtime"
28
+ ],
29
+ "openxiangda/build": [
30
+ "../../packages/sdk/src/build/index.ts",
31
+ "node_modules/openxiangda/build"
32
+ ],
33
+ "openxiangda/antd-theme": [
34
+ "../../packages/sdk/src/styles/antd-theme.ts",
35
+ "node_modules/openxiangda/antd-theme"
36
+ ]
21
37
  }
22
38
  },
23
39
  "include": ["src", "app-workspace.config.ts", "vite.config.ts"]
@@ -1,32 +1,85 @@
1
1
  import react from "@vitejs/plugin-react";
2
2
  import { fileURLToPath } from "node:url";
3
- import { defineConfig } from "vite";
3
+ import { defineConfig, loadEnv } from "vite";
4
4
 
5
- export default defineConfig({
6
- define: {
7
- "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || "development"),
8
- },
9
- plugins: [react()],
10
- resolve: {
11
- alias: [
12
- {
13
- find: "@",
14
- replacement: fileURLToPath(new URL("./src", import.meta.url)),
15
- },
16
- ],
17
- dedupe: [
18
- "react",
19
- "react-dom",
20
- "antd",
21
- "@ant-design/cssinjs",
22
- "@ant-design/icons",
23
- ],
24
- },
25
- optimizeDeps: {
26
- include: ["antd", "@ant-design/cssinjs", "@ant-design/icons", "antd-mobile"],
27
- },
28
- server: {
29
- host: "127.0.0.1",
30
- port: 5174,
31
- },
5
+ const resolveProxyTarget = (value?: string) => {
6
+ const normalized = String(value || "").trim();
7
+ if (!normalized) return "";
8
+ try {
9
+ const url = new URL(normalized);
10
+ return url.origin;
11
+ } catch {
12
+ return "";
13
+ }
14
+ };
15
+
16
+ const toPort = (value?: string) => {
17
+ const port = Number(value || 5174);
18
+ return Number.isFinite(port) && port > 0 ? port : 5174;
19
+ };
20
+
21
+ export default defineConfig(({ mode }) => {
22
+ const env = loadEnv(mode, process.cwd(), "");
23
+ const serviceTarget = resolveProxyTarget(
24
+ env.OPENXIANGDA_BASE_URL || env.APP_PLATFORM_URL,
25
+ );
26
+ const servicePrefix = env.APP_SERVICE_PREFIX || "/service";
27
+
28
+ return {
29
+ define: {
30
+ "process.env.NODE_ENV": JSON.stringify(
31
+ process.env.NODE_ENV || "development",
32
+ ),
33
+ "process.env.OPENXIANGDA_APP_TYPE": JSON.stringify(
34
+ env.OPENXIANGDA_APP_TYPE || env.APP_TYPE || "",
35
+ ),
36
+ "process.env.APP_TYPE": JSON.stringify(
37
+ env.APP_TYPE || env.OPENXIANGDA_APP_TYPE || "",
38
+ ),
39
+ "process.env.OPENXIANGDA_BASE_URL": JSON.stringify(
40
+ env.OPENXIANGDA_BASE_URL || env.APP_PLATFORM_URL || "",
41
+ ),
42
+ "process.env.APP_PLATFORM_URL": JSON.stringify(
43
+ env.APP_PLATFORM_URL || env.OPENXIANGDA_BASE_URL || "",
44
+ ),
45
+ "process.env.APP_SERVICE_PREFIX": JSON.stringify(servicePrefix),
46
+ },
47
+ plugins: [react()],
48
+ resolve: {
49
+ alias: [
50
+ {
51
+ find: "@",
52
+ replacement: fileURLToPath(new URL("./src", import.meta.url)),
53
+ },
54
+ ],
55
+ dedupe: [
56
+ "react",
57
+ "react-dom",
58
+ "antd",
59
+ "@ant-design/cssinjs",
60
+ "@ant-design/icons",
61
+ ],
62
+ },
63
+ optimizeDeps: {
64
+ include: ["antd", "@ant-design/cssinjs", "@ant-design/icons", "antd-mobile"],
65
+ },
66
+ server: {
67
+ host: env.OPENXIANGDA_DEV_HOST || "127.0.0.1",
68
+ port: toPort(env.OPENXIANGDA_DEV_PORT),
69
+ proxy: serviceTarget
70
+ ? {
71
+ [servicePrefix]: {
72
+ target: serviceTarget,
73
+ changeOrigin: true,
74
+ secure: false,
75
+ cookieDomainRewrite: "",
76
+ cookiePathRewrite: "/",
77
+ headers: {
78
+ "x-openxiangda-dev-proxy": "1",
79
+ },
80
+ },
81
+ }
82
+ : undefined,
83
+ },
84
+ };
32
85
  });