@nocobase/app 2.0.22 → 2.1.0-alpha.10
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/client-v2/index.html +25 -0
- package/client-v2/rsbuild.config.ts +242 -0
- package/client-v2/src/env.d.ts +24 -0
- package/client-v2/src/main.tsx +105 -0
- package/client-v2/src/plugins/AppInfoDemoPlugin.ts +40 -0
- package/client-v2/src/routes/AppInfoDemoRoute.tsx +14 -0
- package/client-v2/src/routes/DemoHomepageRoute.tsx +28 -0
- package/client-v2/src/routes/FlowSettingsComponentLoaderDemoRoute.tsx +40 -0
- package/client-v2/src/settings/DemoFlowSettingsLazyField.tsx +14 -0
- package/client-v2/tsconfig.json +19 -0
- package/dist/client/1708.645e826c.async.js +60 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/npm._at_ant-design.23432018.async.js +141 -0
- package/dist/client/{npm._at_formily.7785699b.async.js → npm._at_formily.d2e75ebc.async.js} +2 -2
- package/dist/client/npm._at_rc-component.882fb176.async.js +8 -0
- package/dist/client/{npm.antd-mobile-icons.4b133b6b.async.js → npm.antd-mobile-icons.d1cd785e.async.js} +1 -1
- package/dist/client/npm.antd-mobile.90e3a954.async.js +3 -0
- package/dist/client/npm.antd.279f521c.async.js +464 -0
- package/dist/client/npm.buffer.bc3fb79b.async.js +1 -0
- package/dist/client/{npm.dayjs.549164ec.async.js → npm.dayjs.e8fa5a58.async.js} +1 -1
- package/dist/client/{npm.entities.536e25f7.async.js → npm.entities.8159ac3e.async.js} +1 -1
- package/dist/client/{npm.highlight.js.763ebb2d.async.js → npm.highlight.js.2aa47f4d.async.js} +2 -2
- package/dist/client/{npm.htmlparser2.013ed004.async.js → npm.htmlparser2.41be4fb8.async.js} +1 -1
- package/dist/client/npm.lodash-es.bc38ad36.async.js +1 -0
- package/dist/client/{npm.markdown-it.9eced26c.async.js → npm.markdown-it.5b35f93d.async.js} +1 -1
- package/dist/client/{npm.rc-cascader.641db835.async.js → npm.rc-cascader.38b39dff.async.js} +4 -4
- package/dist/client/npm.rc-image.d550fa79.async.js +1 -0
- package/dist/client/npm.rc-menu.da4ef0ce.async.js +1 -0
- package/dist/client/npm.rc-picker.57ac3e84.async.js +22 -0
- package/dist/client/npm.rc-select.44fb85b4.async.js +3 -0
- package/dist/client/npm.rc-slider.d2d511ab.async.js +1 -0
- package/dist/client/npm.rc-table.b46ac936.async.js +22 -0
- package/dist/client/npm.rc-tree-select.9547da7a.async.js +5 -0
- package/dist/client/npm.rc-tree.49888c60.async.js +1 -0
- package/dist/client/npm.rc-util.cdb6a045.async.js +18 -0
- package/dist/client/npm.unknown.8f4a423f.chunk.css +26 -0
- package/dist/client/p__index.ce72fd4e.async.js +2738 -0
- package/dist/client/umi.daa4a9d2.js +63 -0
- package/dist/client/v2/assets/1020-0212416d.js +2 -0
- package/dist/client/v2/assets/1020-0212416d.js.LICENSE.txt +7 -0
- package/dist/client/v2/assets/1222-49e8dadb.css +1 -0
- package/dist/client/v2/assets/1222-c8810ac8.js +2 -0
- package/dist/client/v2/assets/1222-c8810ac8.js.LICENSE.txt +9 -0
- package/dist/client/v2/assets/1310-fbaee3cb.js +59 -0
- package/dist/client/v2/assets/1425-0d0cc788.js +42 -0
- package/dist/client/v2/assets/1507-3a78eb3b.js +7 -0
- package/dist/client/v2/assets/158-9800497f.js +23 -0
- package/dist/client/v2/assets/1676-5db7433e.js +9 -0
- package/dist/client/v2/assets/1725-6bb35fdf.js +83 -0
- package/dist/client/v2/assets/1786-8fd8cc53.js +16 -0
- package/dist/client/v2/assets/1951-3af0a41f.js +55 -0
- package/dist/client/v2/assets/2017-7bc3cc87.js +26 -0
- package/dist/client/v2/assets/212-30d011b4.js +18 -0
- package/dist/client/v2/assets/2131-a150fed4.js +1 -0
- package/dist/client/v2/assets/22-9d12a303.js +1 -0
- package/dist/client/v2/assets/2203-9aa79271.js +4 -0
- package/dist/client/v2/assets/2335-40fc71a2.js +22 -0
- package/dist/client/v2/assets/2555-0744d7fe.js +31 -0
- package/dist/client/v2/assets/2702-2f40d8de.js +5 -0
- package/dist/client/v2/assets/2710-ddca03eb.js +36 -0
- package/dist/client/v2/assets/2726-927c9cfb.js +23 -0
- package/dist/client/v2/assets/2861-da0bb151.js +3 -0
- package/dist/client/v2/assets/2898-cf256b0e.js +17 -0
- package/dist/client/v2/assets/2958-e4b6ff73.js +27 -0
- package/dist/client/v2/assets/3018-fc630932.js +3 -0
- package/dist/client/v2/assets/3117-54ef67b5.js +33 -0
- package/dist/client/v2/assets/3279-1f24fe26.js +1 -0
- package/dist/client/v2/assets/338-3d2099ef.js +3 -0
- package/dist/client/v2/assets/3475-d92f065a.js +1 -0
- package/dist/client/v2/assets/3660-c7fcb199.js +6 -0
- package/dist/client/v2/assets/3662-b25a5e70.js +28 -0
- package/dist/client/v2/assets/3690-3dd94e4c.js +12 -0
- package/dist/client/v2/assets/3727-da97de5f.js +44 -0
- package/dist/client/v2/assets/3916-250bcfe2.js +6 -0
- package/dist/client/v2/assets/3937-af967d62.js +3 -0
- package/dist/client/v2/assets/3989-f2860cc7.js +27 -0
- package/dist/client/v2/assets/4222-29a8147d.js +5 -0
- package/dist/client/v2/assets/4313-afee0e7e.js +28 -0
- package/dist/client/v2/assets/465-1cb2158a.js +1 -0
- package/dist/client/v2/assets/5064-2ca0d32b.js +10 -0
- package/dist/client/v2/assets/5366-53bf100a.js +1 -0
- package/dist/client/v2/assets/5501-a146926a.js +17 -0
- package/dist/client/v2/assets/5721-b76fecc5.js +18 -0
- package/dist/client/v2/assets/5759-11ca4d36.js +47 -0
- package/dist/client/v2/assets/5761-5b4fcc0f.js +28 -0
- package/dist/client/v2/assets/6269-1fd42a11.js +1 -0
- package/dist/client/v2/assets/6373-9d047c6b.js +13 -0
- package/dist/client/v2/assets/6437-18d1e044.js +12 -0
- package/dist/client/v2/assets/6581-4874c6dc.js +21 -0
- package/dist/client/v2/assets/6738-06ce7af7.js +20 -0
- package/dist/client/v2/assets/6830-d23120a0.js +1 -0
- package/dist/client/v2/assets/700-8f6e9747.js +15 -0
- package/dist/client/v2/assets/7021-32b49ced.js +45 -0
- package/dist/client/v2/assets/7201-2049816a.js +14 -0
- package/dist/client/v2/assets/7211-b8c71ed2.js +9 -0
- package/dist/client/v2/assets/7482-c3d402ea.js +1 -0
- package/dist/client/v2/assets/754-41b763b9.js +17 -0
- package/dist/client/v2/assets/7761-637067c6.js +123 -0
- package/dist/client/v2/assets/7876-673cbc3c.js +6 -0
- package/dist/client/v2/assets/7928-c2116323.js +1 -0
- package/dist/client/v2/assets/7946-09b77e08.js +13 -0
- package/dist/client/v2/assets/7959-f9145d32.js +40 -0
- package/dist/client/v2/assets/8138-f2234325.js +24 -0
- package/dist/client/v2/assets/8262-09946e21.js +9 -0
- package/dist/client/v2/assets/8434-7296f545.js +25 -0
- package/dist/client/v2/assets/8438-55cc74f0.js +37 -0
- package/dist/client/v2/assets/8562-022da9fa.js +17 -0
- package/dist/client/v2/assets/9261-5b0e2178.js +2 -0
- package/dist/client/v2/assets/9261-5b0e2178.js.LICENSE.txt +229 -0
- package/dist/client/v2/assets/9811-52d18c3d.js +1 -0
- package/dist/client/v2/assets/9836-65eadc90.js +22 -0
- package/dist/client/v2/assets/index-df3f23f2.js +236 -0
- package/dist/client/v2/assets/index-df3f23f2.js.LICENSE.txt +1 -0
- package/dist/client/v2/assets/runtime-9ee03ea7.js +1 -0
- package/dist/client/v2/assets/vendor-antd-05d1c710.js +451 -0
- package/dist/client/v2/assets/vendor-antd-ecosystem-3072b8fa.js +2 -0
- package/dist/client/v2/assets/vendor-antd-ecosystem-3072b8fa.js.LICENSE.txt +1 -0
- package/dist/client/v2/assets/vendor-antd-icons-b7d99c50.js +2 -0
- package/dist/client/v2/assets/vendor-antd-icons-b7d99c50.js.LICENSE.txt +1621 -0
- package/dist/client/v2/assets/vendor-lodash-831bd1b8.js +2 -0
- package/dist/client/v2/assets/vendor-lodash-831bd1b8.js.LICENSE.txt +8 -0
- package/dist/client/v2/assets/vendor-moment-84b317dc.js +2 -0
- package/dist/client/v2/assets/vendor-moment-84b317dc.js.LICENSE.txt +631 -0
- package/dist/client/v2/assets/vendor-ses-b7bccbcd.js +23 -0
- package/dist/client/v2/index.html +25 -0
- package/package.json +6 -6
- package/dist/client/958.c4d4681a.async.js +0 -62
- package/dist/client/npm._at_ant-design.4fb666c7.async.js +0 -141
- package/dist/client/npm._at_rc-component.fcc6d966.async.js +0 -8
- package/dist/client/npm.antd-mobile.55661292.async.js +0 -2
- package/dist/client/npm.antd.d7898d85.async.js +0 -935
- package/dist/client/npm.babel-runtime.eed49798.async.js +0 -1
- package/dist/client/npm.lodash-es.9fd92a41.async.js +0 -1
- package/dist/client/npm.rc-image.500705f3.async.js +0 -1
- package/dist/client/npm.rc-menu.623f9c7e.async.js +0 -1
- package/dist/client/npm.rc-picker.95a28587.async.js +0 -22
- package/dist/client/npm.rc-select.34fc277e.async.js +0 -3
- package/dist/client/npm.rc-slider.a10210c6.async.js +0 -1
- package/dist/client/npm.rc-table.ffbc8feb.async.js +0 -22
- package/dist/client/npm.rc-tree-select.866d1acb.async.js +0 -5
- package/dist/client/npm.rc-tree.c1d5eac5.async.js +0 -1
- package/dist/client/npm.rc-util.4aa445e4.async.js +0 -35
- package/dist/client/npm.unknown.d9b587d9.chunk.css +0 -26
- package/dist/client/p__index.6adf828a.async.js +0 -2738
- package/dist/client/umi.cce00dcd.js +0 -63
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>NocoBase v2</title>
|
|
7
|
+
<script>
|
|
8
|
+
window.__nocobase_public_path__ = window.__nocobase_public_path__ || '<%= BASE_URL %>';
|
|
9
|
+
window.__nocobase_api_base_url__ = window.__nocobase_api_base_url__ || '<%= API_BASE_URL %>';
|
|
10
|
+
window.__nocobase_api_client_storage_prefix__ =
|
|
11
|
+
window.__nocobase_api_client_storage_prefix__ || '<%= API_CLIENT_STORAGE_PREFIX %>';
|
|
12
|
+
window.__nocobase_api_client_storage_type__ =
|
|
13
|
+
window.__nocobase_api_client_storage_type__ || '<%= API_CLIENT_STORAGE_TYPE %>';
|
|
14
|
+
window.__nocobase_api_client_share_token__ =
|
|
15
|
+
window.__nocobase_api_client_share_token__ || '<%= API_CLIENT_SHARE_TOKEN %>';
|
|
16
|
+
window.__nocobase_ws_url__ = window.__nocobase_ws_url__ || '<%= WS_URL %>';
|
|
17
|
+
window.__nocobase_ws_path__ = window.__nocobase_ws_path__ || '<%= WS_PATH %>';
|
|
18
|
+
window.__esm_cdn_base_url__ = window.__esm_cdn_base_url__ || '<%= ESM_CDN_BASE_URL %>';
|
|
19
|
+
window.__esm_cdn_suffix__ = window.__esm_cdn_suffix__ || '<%= ESM_CDN_SUFFIX %>';
|
|
20
|
+
</script>
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<div id="root"></div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import { defineConfig } from '@rsbuild/core';
|
|
13
|
+
import { pluginLess } from '@rsbuild/plugin-less';
|
|
14
|
+
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
|
|
15
|
+
import { pluginReact } from '@rsbuild/plugin-react';
|
|
16
|
+
import { getRsbuildAlias } from '../../devtools/rsbuildConfig';
|
|
17
|
+
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = path.dirname(__filename);
|
|
20
|
+
|
|
21
|
+
function ensurePublicPath(value: string) {
|
|
22
|
+
let normalized = value || '/v2/';
|
|
23
|
+
if (!normalized.startsWith('/')) {
|
|
24
|
+
normalized = `/${normalized}`;
|
|
25
|
+
}
|
|
26
|
+
if (!normalized.endsWith('/')) {
|
|
27
|
+
normalized = `${normalized}/`;
|
|
28
|
+
}
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function toNumber(value: string | undefined, fallback: number) {
|
|
33
|
+
const parsed = Number(value);
|
|
34
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function createDefineValues(v2PublicPath: string) {
|
|
38
|
+
return {
|
|
39
|
+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
|
|
40
|
+
'import.meta.env.BASE_URL': JSON.stringify(v2PublicPath),
|
|
41
|
+
'import.meta.env.API_BASE_URL': JSON.stringify(process.env.API_BASE_URL || process.env.API_BASE_PATH || ''),
|
|
42
|
+
'import.meta.env.API_CLIENT_STORAGE_PREFIX': JSON.stringify(process.env.API_CLIENT_STORAGE_PREFIX || ''),
|
|
43
|
+
'import.meta.env.API_CLIENT_STORAGE_TYPE': JSON.stringify(process.env.API_CLIENT_STORAGE_TYPE || ''),
|
|
44
|
+
'import.meta.env.API_CLIENT_SHARE_TOKEN': JSON.stringify(process.env.API_CLIENT_SHARE_TOKEN || 'false'),
|
|
45
|
+
'import.meta.env.WS_URL': JSON.stringify(process.env.WEBSOCKET_URL || ''),
|
|
46
|
+
'import.meta.env.WS_PATH': JSON.stringify(process.env.WS_PATH || ''),
|
|
47
|
+
'import.meta.env.ESM_CDN_BASE_URL': JSON.stringify(process.env.ESM_CDN_BASE_URL || 'https://esm.sh'),
|
|
48
|
+
'import.meta.env.ESM_CDN_SUFFIX': JSON.stringify(process.env.ESM_CDN_SUFFIX || ''),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function createTemplateParameters(v2PublicPath: string) {
|
|
53
|
+
return {
|
|
54
|
+
BASE_URL: v2PublicPath,
|
|
55
|
+
API_BASE_URL: process.env.API_BASE_URL || process.env.API_BASE_PATH || '',
|
|
56
|
+
API_CLIENT_STORAGE_PREFIX: process.env.API_CLIENT_STORAGE_PREFIX || '',
|
|
57
|
+
API_CLIENT_STORAGE_TYPE: process.env.API_CLIENT_STORAGE_TYPE || '',
|
|
58
|
+
API_CLIENT_SHARE_TOKEN: process.env.API_CLIENT_SHARE_TOKEN || 'false',
|
|
59
|
+
WS_URL: process.env.WEBSOCKET_URL || '',
|
|
60
|
+
WS_PATH: process.env.WS_PATH || '',
|
|
61
|
+
ESM_CDN_BASE_URL: process.env.ESM_CDN_BASE_URL || 'https://esm.sh',
|
|
62
|
+
ESM_CDN_SUFFIX: process.env.ESM_CDN_SUFFIX || '',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default defineConfig(({ command }) => {
|
|
67
|
+
const isBuild = command === 'build';
|
|
68
|
+
const appPublicPath = ensurePublicPath(process.env.APP_PUBLIC_PATH || '/');
|
|
69
|
+
const apiBasePath = ensurePublicPath(process.env.API_BASE_PATH || '/api/');
|
|
70
|
+
const v2PublicPath = ensurePublicPath(`${appPublicPath.replace(/\/$/, '')}/v2/`);
|
|
71
|
+
const hmrPath = `${v2PublicPath.replace(/\/$/, '')}/__rspack_hmr`;
|
|
72
|
+
const v2Port = toNumber(process.env.APP_V2_PORT, 13002);
|
|
73
|
+
const hmrClientHost = process.env.RSPACK_HMR_CLIENT_HOST || 'localhost';
|
|
74
|
+
const hmrClientPort = toNumber(process.env.RSPACK_HMR_CLIENT_PORT || process.env.APP_PORT, v2Port);
|
|
75
|
+
const proxyTargetUrl = process.env.PROXY_TARGET_URL || `http://127.0.0.1:${process.env.APP_PORT || 13001}`;
|
|
76
|
+
const workspaceAliases = getRsbuildAlias();
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
plugins: [pluginReact(), pluginLess(), pluginNodePolyfill()],
|
|
80
|
+
resolve: {
|
|
81
|
+
alias: workspaceAliases,
|
|
82
|
+
},
|
|
83
|
+
source: {
|
|
84
|
+
entry: {
|
|
85
|
+
index: path.resolve(__dirname, 'src/main.tsx'),
|
|
86
|
+
},
|
|
87
|
+
tsconfigPath: path.resolve(__dirname, 'tsconfig.json'),
|
|
88
|
+
define: createDefineValues(v2PublicPath),
|
|
89
|
+
},
|
|
90
|
+
html: {
|
|
91
|
+
template: path.resolve(__dirname, 'index.html'),
|
|
92
|
+
scriptLoading: isBuild ? 'module' : 'defer',
|
|
93
|
+
templateParameters: createTemplateParameters(v2PublicPath),
|
|
94
|
+
},
|
|
95
|
+
output: {
|
|
96
|
+
target: 'web',
|
|
97
|
+
distPath: {
|
|
98
|
+
root: path.resolve(__dirname, '../dist/client/v2'),
|
|
99
|
+
js: 'assets',
|
|
100
|
+
jsAsync: 'assets',
|
|
101
|
+
css: 'assets',
|
|
102
|
+
cssAsync: 'assets',
|
|
103
|
+
svg: 'assets',
|
|
104
|
+
font: 'assets',
|
|
105
|
+
image: 'assets',
|
|
106
|
+
media: 'assets',
|
|
107
|
+
},
|
|
108
|
+
filename: {
|
|
109
|
+
js: '[name]-[contenthash:8].js',
|
|
110
|
+
css: '[name]-[contenthash:8].css',
|
|
111
|
+
svg: '[name]-[contenthash:8][ext][query]',
|
|
112
|
+
font: '[name]-[contenthash:8][ext][query]',
|
|
113
|
+
image: '[name]-[contenthash:8][ext][query]',
|
|
114
|
+
media: '[name]-[contenthash:8][ext][query]',
|
|
115
|
+
},
|
|
116
|
+
assetPrefix: v2PublicPath,
|
|
117
|
+
cleanDistPath: true,
|
|
118
|
+
sourceMap: {
|
|
119
|
+
js: isBuild ? false : 'eval-cheap-module-source-map',
|
|
120
|
+
css: false,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
server: {
|
|
124
|
+
base: v2PublicPath,
|
|
125
|
+
host: '0.0.0.0',
|
|
126
|
+
port: v2Port,
|
|
127
|
+
compress: true,
|
|
128
|
+
publicDir: false,
|
|
129
|
+
proxy: {
|
|
130
|
+
[apiBasePath]: {
|
|
131
|
+
target: proxyTargetUrl,
|
|
132
|
+
changeOrigin: true,
|
|
133
|
+
ws: true,
|
|
134
|
+
xfwd: true, // 这里会处理 X-Forwarded-For 头,添加客户端 IP 地址
|
|
135
|
+
pathRewrite: {
|
|
136
|
+
[`^${apiBasePath}`]: apiBasePath,
|
|
137
|
+
},
|
|
138
|
+
onProxyRes(proxyRes, req, res) {
|
|
139
|
+
if (req.headers.accept === 'text/event-stream') {
|
|
140
|
+
res.writeHead(res.statusCode, {
|
|
141
|
+
'Content-Type': 'text/event-stream',
|
|
142
|
+
'Cache-Control': 'no-transform',
|
|
143
|
+
Connection: 'keep-alive',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
historyApiFallback: {
|
|
150
|
+
disableDotRule: true,
|
|
151
|
+
index: `${v2PublicPath}index.html`,
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
dev: {
|
|
155
|
+
assetPrefix: v2PublicPath,
|
|
156
|
+
lazyCompilation: false,
|
|
157
|
+
client: {
|
|
158
|
+
overlay: false,
|
|
159
|
+
protocol: 'ws',
|
|
160
|
+
host: hmrClientHost,
|
|
161
|
+
port: hmrClientPort,
|
|
162
|
+
path: hmrPath,
|
|
163
|
+
},
|
|
164
|
+
progressBar: true,
|
|
165
|
+
},
|
|
166
|
+
tools: {
|
|
167
|
+
rspack(config) {
|
|
168
|
+
config.target = ['web', 'es2020'];
|
|
169
|
+
config.output.module = isBuild;
|
|
170
|
+
config.output.chunkFormat = isBuild ? 'module' : 'array-push';
|
|
171
|
+
config.experiments = {
|
|
172
|
+
...config.experiments,
|
|
173
|
+
outputModule: isBuild,
|
|
174
|
+
};
|
|
175
|
+
config.module.rules.push({
|
|
176
|
+
test: /\.svg$/i,
|
|
177
|
+
issuer: /\.[jt]sx?$/,
|
|
178
|
+
use: ['@svgr/webpack'],
|
|
179
|
+
});
|
|
180
|
+
config.optimization = {
|
|
181
|
+
...config.optimization,
|
|
182
|
+
runtimeChunk: 'single',
|
|
183
|
+
splitChunks: {
|
|
184
|
+
chunks: 'all',
|
|
185
|
+
cacheGroups: {
|
|
186
|
+
antdEcosystem: {
|
|
187
|
+
test: /[\\/]node_modules[\\/](?:rc-[^\\/]+|@rc-component[\\/][^\\/]+|@ant-design[\\/](?!(?:icons|icons-svg)[\\/])[^\\/]+)[\\/]/,
|
|
188
|
+
name: 'vendor-antd-ecosystem',
|
|
189
|
+
chunks: 'all',
|
|
190
|
+
priority: 45,
|
|
191
|
+
enforce: true,
|
|
192
|
+
minSize: 0,
|
|
193
|
+
},
|
|
194
|
+
momentLocales: {
|
|
195
|
+
test: /[\\/]node_modules[\\/]moment[\\/](?:locale[\\/]|moment\.js$)/,
|
|
196
|
+
name: 'vendor-moment',
|
|
197
|
+
chunks: 'all',
|
|
198
|
+
priority: 44,
|
|
199
|
+
enforce: true,
|
|
200
|
+
minSize: 0,
|
|
201
|
+
},
|
|
202
|
+
lodashCjs: {
|
|
203
|
+
test: /[\\/]node_modules[\\/]lodash[\\/]lodash\.js$/,
|
|
204
|
+
name: 'vendor-lodash',
|
|
205
|
+
chunks: 'all',
|
|
206
|
+
priority: 43,
|
|
207
|
+
enforce: true,
|
|
208
|
+
minSize: 0,
|
|
209
|
+
},
|
|
210
|
+
ses: {
|
|
211
|
+
test: /[\\/]node_modules[\\/]ses[\\/]/,
|
|
212
|
+
name: 'vendor-ses',
|
|
213
|
+
chunks: 'all',
|
|
214
|
+
priority: 42,
|
|
215
|
+
enforce: true,
|
|
216
|
+
minSize: 0,
|
|
217
|
+
},
|
|
218
|
+
antdIcons: {
|
|
219
|
+
test: /[\\/]node_modules[\\/]@ant-design[\\/](?:icons|icons-svg)[\\/]/,
|
|
220
|
+
name: 'vendor-antd-icons',
|
|
221
|
+
chunks: 'all',
|
|
222
|
+
priority: 40,
|
|
223
|
+
enforce: true,
|
|
224
|
+
minSize: 0,
|
|
225
|
+
},
|
|
226
|
+
antd: {
|
|
227
|
+
test: /[\\/]node_modules[\\/]antd[\\/]/,
|
|
228
|
+
name: 'vendor-antd',
|
|
229
|
+
chunks: 'all',
|
|
230
|
+
priority: 30,
|
|
231
|
+
enforce: true,
|
|
232
|
+
minSize: 0,
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
config.performance = false;
|
|
238
|
+
config.stats = 'errors-warnings';
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface ImportMetaEnv {
|
|
11
|
+
readonly BASE_URL?: string;
|
|
12
|
+
readonly API_BASE_URL?: string;
|
|
13
|
+
readonly API_CLIENT_STORAGE_PREFIX?: string;
|
|
14
|
+
readonly API_CLIENT_STORAGE_TYPE?: string;
|
|
15
|
+
readonly API_CLIENT_SHARE_TOKEN?: string;
|
|
16
|
+
readonly WS_URL?: string;
|
|
17
|
+
readonly WS_PATH?: string;
|
|
18
|
+
readonly ESM_CDN_BASE_URL?: string;
|
|
19
|
+
readonly ESM_CDN_SUFFIX?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ImportMeta {
|
|
23
|
+
readonly env: ImportMetaEnv;
|
|
24
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Application } from '@nocobase/client-v2';
|
|
11
|
+
import { AppInfoDemoPlugin } from './plugins/AppInfoDemoPlugin';
|
|
12
|
+
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
__nocobase_public_path__?: string;
|
|
16
|
+
__nocobase_api_base_url__?: string;
|
|
17
|
+
__nocobase_api_client_storage_prefix__?: string;
|
|
18
|
+
__nocobase_api_client_storage_type__?: string;
|
|
19
|
+
__nocobase_api_client_share_token__?: boolean | string;
|
|
20
|
+
__nocobase_ws_url__?: string;
|
|
21
|
+
__nocobase_ws_path__?: string;
|
|
22
|
+
__nocobase_v2_app__?: Application;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ensureSlash(pathname: string, fallback: string) {
|
|
27
|
+
if (!pathname) {
|
|
28
|
+
return fallback;
|
|
29
|
+
}
|
|
30
|
+
let normalized = pathname.trim();
|
|
31
|
+
if (!normalized.startsWith('/')) {
|
|
32
|
+
normalized = `/${normalized}`;
|
|
33
|
+
}
|
|
34
|
+
if (!normalized.endsWith('/')) {
|
|
35
|
+
normalized = `${normalized}/`;
|
|
36
|
+
}
|
|
37
|
+
return normalized;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function inferRootPublicPathFromLocation() {
|
|
41
|
+
const marker = '/v2/';
|
|
42
|
+
const pathname = window.location.pathname;
|
|
43
|
+
const index = pathname.indexOf(marker);
|
|
44
|
+
if (index >= 0) {
|
|
45
|
+
return ensureSlash(pathname.slice(0, index), '/');
|
|
46
|
+
}
|
|
47
|
+
return '/';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getRootPublicPath() {
|
|
51
|
+
const fromWindow = window.__nocobase_public_path__;
|
|
52
|
+
if (fromWindow) {
|
|
53
|
+
return ensureSlash(fromWindow.replace(/\/v2\/$/, '/'), '/');
|
|
54
|
+
}
|
|
55
|
+
const fromBase = import.meta.env.BASE_URL;
|
|
56
|
+
if (fromBase) {
|
|
57
|
+
return ensureSlash(fromBase.replace(/\/v2\/$/, '/'), '/');
|
|
58
|
+
}
|
|
59
|
+
return inferRootPublicPathFromLocation();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getV2PublicPath() {
|
|
63
|
+
return ensureSlash(`${getRootPublicPath().replace(/\/$/, '')}/v2/`, '/v2/');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseShareToken(value: boolean | string | undefined) {
|
|
67
|
+
if (typeof value === 'boolean') {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
return String(value || '').toLowerCase() === 'true';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type ClientStorageType = 'localStorage' | 'sessionStorage' | 'memory';
|
|
74
|
+
|
|
75
|
+
function parseStorageType(value: string | undefined): ClientStorageType {
|
|
76
|
+
if (value === 'sessionStorage' || value === 'memory' || value === 'localStorage') {
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
return 'localStorage';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const rootPublicPath = getRootPublicPath();
|
|
83
|
+
const v2PublicPath = getV2PublicPath();
|
|
84
|
+
|
|
85
|
+
const app = new Application({
|
|
86
|
+
publicPath: v2PublicPath,
|
|
87
|
+
apiClient: {
|
|
88
|
+
shareToken: parseShareToken(window.__nocobase_api_client_share_token__ || import.meta.env.API_CLIENT_SHARE_TOKEN),
|
|
89
|
+
storageType: parseStorageType(
|
|
90
|
+
window.__nocobase_api_client_storage_type__ || import.meta.env.API_CLIENT_STORAGE_TYPE,
|
|
91
|
+
),
|
|
92
|
+
storagePrefix:
|
|
93
|
+
window.__nocobase_api_client_storage_prefix__ || import.meta.env.API_CLIENT_STORAGE_PREFIX || 'NOCOBASE_',
|
|
94
|
+
baseURL: window.__nocobase_api_base_url__ || import.meta.env.API_BASE_URL || `${rootPublicPath}api/`,
|
|
95
|
+
},
|
|
96
|
+
ws: {
|
|
97
|
+
url: window.__nocobase_ws_url__ || import.meta.env.WS_URL || '',
|
|
98
|
+
basename: window.__nocobase_ws_path__ || import.meta.env.WS_PATH || `${rootPublicPath}ws`,
|
|
99
|
+
},
|
|
100
|
+
plugins: [AppInfoDemoPlugin],
|
|
101
|
+
loadRemotePlugins: false,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
window.__nocobase_v2_app__ = app;
|
|
105
|
+
app.mount('#root');
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from '@nocobase/client-v2';
|
|
11
|
+
|
|
12
|
+
export class AppInfoDemoPlugin extends Plugin {
|
|
13
|
+
async load() {
|
|
14
|
+
this.flowEngine.flowSettings.registerComponentLoaders({
|
|
15
|
+
DemoFlowSettingsLazyField: () => import('../settings/DemoFlowSettingsLazyField'),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
this.router.add('demo.homepage', {
|
|
19
|
+
path: '/',
|
|
20
|
+
componentLoader: () => import('../routes/DemoHomepageRoute'),
|
|
21
|
+
});
|
|
22
|
+
this.router.add('demo.app-info', {
|
|
23
|
+
path: '/demo/app-info',
|
|
24
|
+
componentLoader: () => import('../routes/AppInfoDemoRoute'),
|
|
25
|
+
});
|
|
26
|
+
this.router.add('demo.flow-settings-component-loader', {
|
|
27
|
+
path: '/demo/flow-settings-component-loader',
|
|
28
|
+
componentLoader: () => import('../routes/FlowSettingsComponentLoaderDemoRoute'),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const response = await this.app.apiClient.request({
|
|
33
|
+
url: 'app:getInfo',
|
|
34
|
+
});
|
|
35
|
+
console.log('[client-v2 demo plugin] /api/app:getInfo', response?.data);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('[client-v2 demo plugin] failed to request /api/app:getInfo', error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
|
|
12
|
+
export default function AppInfoDemoRoute() {
|
|
13
|
+
return <div>App Info Demo Route</div>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { Button } from 'antd';
|
|
12
|
+
import { useNavigate } from 'react-router-dom';
|
|
13
|
+
|
|
14
|
+
export default function DemoHomepageRoute() {
|
|
15
|
+
const navigate = useNavigate();
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<div>
|
|
19
|
+
Demo Homepage Route
|
|
20
|
+
<Button onClick={() => navigate('/demo/app-info')}>Go to demo route</Button>
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
Demo flow settings page
|
|
24
|
+
<Button onClick={() => navigate('/demo/flow-settings-component-loader')}>Go to demo route</Button>
|
|
25
|
+
</div>
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { createForm } from '@formily/core';
|
|
11
|
+
import { createSchemaField, FormProvider } from '@formily/react';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { useApp } from '../../../../client-v2/src/hooks/useApp';
|
|
14
|
+
|
|
15
|
+
const SchemaField = createSchemaField();
|
|
16
|
+
|
|
17
|
+
export default function FlowSettingsComponentLoaderDemoRoute() {
|
|
18
|
+
const app = useApp();
|
|
19
|
+
const form = React.useMemo(() => createForm(), []);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div>
|
|
23
|
+
<div>Flow Settings Component Loader Demo Route</div>
|
|
24
|
+
<FormProvider form={form}>
|
|
25
|
+
<SchemaField
|
|
26
|
+
schema={{
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
demo: {
|
|
30
|
+
type: 'void',
|
|
31
|
+
'x-component': 'DemoFlowSettingsLazyField',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
}}
|
|
35
|
+
components={app.flowEngine.flowSettings.components}
|
|
36
|
+
/>
|
|
37
|
+
</FormProvider>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
|
|
12
|
+
export default function DemoFlowSettingsLazyField() {
|
|
13
|
+
return <div>Demo Flow Settings Lazy Field Loaded</div>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "esnext",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"importHelpers": true,
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"baseUrl": "../../../../",
|
|
13
|
+
"strict": true,
|
|
14
|
+
"allowSyntheticDefaultImports": true,
|
|
15
|
+
"noEmit": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*"],
|
|
18
|
+
"exclude": ["node_modules", "dist"]
|
|
19
|
+
}
|