@nocobase/app 3.0.0-alpha.2 → 3.0.0-alpha.4
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/__tests__/browserChecker.test.ts +24 -40
- package/__tests__/clientDevProxy.test.ts +34 -0
- package/client/rsbuild.config.ts +4 -5
- package/client-v2/public/browser-checker.js +1 -49
- package/client-v2/rsbuild.config.ts +8 -6
- package/clientDevProxy.ts +32 -0
- package/dist/client/assets/{index-c94119b4.js → index-54849ef3.js} +256 -256
- package/dist/client/assets/{vendor-antd-b77deb8f.js → vendor-antd-f421fb70.js} +4 -4
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/settings/assets/{index-3da8ef5b.js → index-e8b81081.js} +158 -98
- package/dist/client/settings/browser-checker.js +1 -49
- package/dist/client/settings/index.html +1 -1
- package/dist/client/v/assets/{index-41529ca7.js → index-8ecef45a.js} +10 -10
- package/dist/client/v/browser-checker.js +1 -49
- package/dist/client/v/index.html +1 -1
- package/package.json +7 -7
- /package/dist/client/assets/{index-c94119b4.js.LICENSE.txt → index-54849ef3.js.LICENSE.txt} +0 -0
- /package/dist/client/settings/assets/{index-3da8ef5b.js.LICENSE.txt → index-e8b81081.js.LICENSE.txt} +0 -0
- /package/dist/client/v/assets/{index-41529ca7.js.LICENSE.txt → index-8ecef45a.js.LICENSE.txt} +0 -0
|
@@ -17,46 +17,6 @@ function normalizePublicPath(value) {
|
|
|
17
17
|
return ensureTrailingSlash(normalized);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function normalizePathname(value) {
|
|
21
|
-
const normalized = ensureLeadingSlash(String(value || '/').trim() || '/').replace(/\/{2,}/g, '/');
|
|
22
|
-
return normalized === '/' ? normalized : normalized.replace(/\/+$/g, '');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function resolveSettingsRootPath(publicPath, modernPrefix, pathname) {
|
|
26
|
-
const normalizedPublicPath = normalizePublicPath(publicPath);
|
|
27
|
-
const normalizedModernPrefix =
|
|
28
|
-
String(modernPrefix || 'v')
|
|
29
|
-
.trim()
|
|
30
|
-
.replace(/^\/+|\/+$/g, '') || 'v';
|
|
31
|
-
const modernPublicPathSuffix = `/${normalizedModernPrefix}/`;
|
|
32
|
-
if (!normalizedPublicPath.endsWith(modernPublicPathSuffix)) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const modernRootPath = normalizePathname(normalizedPublicPath);
|
|
37
|
-
const normalizedPathname = normalizePathname(pathname);
|
|
38
|
-
let relativePath = '';
|
|
39
|
-
if (normalizedPathname !== modernRootPath) {
|
|
40
|
-
if (!normalizedPathname.startsWith(`${modernRootPath}/`)) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
relativePath = normalizedPathname.slice(modernRootPath.length + 1);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
let appScope = '';
|
|
47
|
-
if (relativePath) {
|
|
48
|
-
const match = /^(apps|_app)\/([^/]+)$/.exec(relativePath);
|
|
49
|
-
if (!match) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
appScope = `/${match[1]}/${match[2]}`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const rootPublicPath = normalizedPublicPath.slice(0, -(normalizedModernPrefix.length + 1));
|
|
56
|
-
const rootPrefix = rootPublicPath === '/' ? '' : rootPublicPath.replace(/\/+$/g, '');
|
|
57
|
-
return `${rootPrefix}/settings${appScope}`;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
20
|
function isSettingsBrowserCheckerScript(script) {
|
|
61
21
|
const source = String((script && script.src) || '').split(/[?#]/)[0];
|
|
62
22
|
return source.endsWith('/settings/browser-checker.js');
|
|
@@ -81,19 +41,11 @@ function resolveScopedSettingsRootPath(publicPath, pathname) {
|
|
|
81
41
|
const basename = normalizePublicPath(window['__nocobase_public_path__'] || '/');
|
|
82
42
|
const currentPath = ensureLeadingSlash(String(window.location.pathname || '/').trim() || '/').replace(/\/{2,}/g, '/');
|
|
83
43
|
const basenameWithoutTrailingSlash = basename === '/' ? '/' : basename.replace(/\/+$/, '');
|
|
84
|
-
const appClientEntryMode = window['__nocobase_app_client_entry_mode__'];
|
|
85
|
-
const settingsRootPath =
|
|
86
|
-
appClientEntryMode === 'modern-only'
|
|
87
|
-
? resolveSettingsRootPath(basename, window['__nocobase_modern_client_prefix__'], currentPath)
|
|
88
|
-
: null;
|
|
89
44
|
const scopedSettingsRootPath = isSettingsBrowserCheckerScript(document.currentScript)
|
|
90
45
|
? resolveScopedSettingsRootPath(basename, currentPath)
|
|
91
46
|
: null;
|
|
92
47
|
|
|
93
|
-
if (
|
|
94
|
-
const newUrl = `${window.location.origin}${settingsRootPath}${window.location.search}${window.location.hash}`;
|
|
95
|
-
window.location.replace(newUrl);
|
|
96
|
-
} else if (scopedSettingsRootPath) {
|
|
48
|
+
if (scopedSettingsRootPath) {
|
|
97
49
|
const newUrl = `${window.location.origin}${scopedSettingsRootPath}${window.location.search}${window.location.hash}`;
|
|
98
50
|
window.location.replace(newUrl);
|
|
99
51
|
} else if (basename !== '/' && currentPath === basenameWithoutTrailingSlash) {
|
|
@@ -15,7 +15,7 @@ window['__nocobase_ws_url__'] = window['__nocobase_ws_url__'] ?? "";
|
|
|
15
15
|
window['__nocobase_ws_path__'] = window['__nocobase_ws_path__'] ?? "/ws";
|
|
16
16
|
window['__nocobase_app_dev__'] = window['__nocobase_app_dev__'] ?? false;
|
|
17
17
|
window['__esm_cdn_base_url__'] = window['__esm_cdn_base_url__'] ?? "https://esm.sh";
|
|
18
|
-
window['__esm_cdn_suffix__'] = window['__esm_cdn_suffix__'] ?? "";</script><script src="/settings/browser-checker.js?v=1"></script><script type="module" src="/settings/assets/runtime-6b2f3ebe.js"></script><script type="module" src="/settings/assets/7245-1058e96e.js"></script><script type="module" src="/settings/assets/index-
|
|
18
|
+
window['__esm_cdn_suffix__'] = window['__esm_cdn_suffix__'] ?? "";</script><script src="/settings/browser-checker.js?v=1"></script><script type="module" src="/settings/assets/runtime-6b2f3ebe.js"></script><script type="module" src="/settings/assets/7245-1058e96e.js"></script><script type="module" src="/settings/assets/index-e8b81081.js"></script><link href="/settings/assets/7245-db3cd5c2.css" rel="stylesheet"></head>
|
|
19
19
|
<body>
|
|
20
20
|
<div id="root"></div>
|
|
21
21
|
</body>
|