@nocobase/cli 2.2.0-alpha.10 → 2.2.0-alpha.11
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/dist/lib/env-proxy.js +10 -0
- package/package.json +2 -2
package/dist/lib/env-proxy.js
CHANGED
|
@@ -20,6 +20,8 @@ const DEFAULT_API_BASE_PATH = '/api/';
|
|
|
20
20
|
const DEFAULT_WS_PATH = '/ws';
|
|
21
21
|
const DEFAULT_PLUGIN_STATICS_PATH = '/static/plugins/';
|
|
22
22
|
const DEFAULT_MODERN_CLIENT_PREFIX = 'v';
|
|
23
|
+
const DEFAULT_APP_CLIENT_ENTRY_MODE = 'legacy-default';
|
|
24
|
+
const APP_CLIENT_ENTRY_MODES = new Set(['legacy-default', 'modern-default', 'modern-only']);
|
|
23
25
|
const DEFAULT_API_CLIENT_STORAGE_PREFIX = 'NOCOBASE_';
|
|
24
26
|
const DEFAULT_API_CLIENT_STORAGE_TYPE = 'localStorage';
|
|
25
27
|
const DEFAULT_ESM_CDN_BASE_URL = 'https://esm.sh';
|
|
@@ -69,6 +71,10 @@ function normalizeModernClientPrefix(value) {
|
|
|
69
71
|
.replace(/^\/+|\/+$/g, '');
|
|
70
72
|
return segment || DEFAULT_MODERN_CLIENT_PREFIX;
|
|
71
73
|
}
|
|
74
|
+
function normalizeAppClientEntryMode(value) {
|
|
75
|
+
const normalized = String(value || '').trim();
|
|
76
|
+
return APP_CLIENT_ENTRY_MODES.has(normalized) ? normalized : DEFAULT_APP_CLIENT_ENTRY_MODE;
|
|
77
|
+
}
|
|
72
78
|
function normalizeApiBasePath(value = DEFAULT_API_BASE_PATH) {
|
|
73
79
|
return resolveAppPublicPath(value);
|
|
74
80
|
}
|
|
@@ -275,6 +281,7 @@ export async function loadEnvProxySettings(runtime, options) {
|
|
|
275
281
|
wsPath: prefixRuntimePath(appPublicPath, envValues.WS_PATH || DEFAULT_WS_PATH),
|
|
276
282
|
pluginStaticsPath: prefixRuntimePath(appPublicPath, envValues.PLUGIN_STATICS_PATH || DEFAULT_PLUGIN_STATICS_PATH, { trailingSlash: true }),
|
|
277
283
|
modernClientPrefix: normalizeModernClientPrefix(envValues.APP_MODERN_CLIENT_PREFIX),
|
|
284
|
+
appClientEntryMode: normalizeAppClientEntryMode(envValues.APP_CLIENT_ENTRY_MODE),
|
|
278
285
|
cdnBaseUrl: trimValue(options?.cdnBaseUrl) ??
|
|
279
286
|
trimValue(runtime.env.envVars?.CDN_BASE_URL) ??
|
|
280
287
|
trimValue(envValues.CDN_BASE_URL),
|
|
@@ -300,6 +307,7 @@ function createManualProxyEnvSettings(input) {
|
|
|
300
307
|
trailingSlash: true,
|
|
301
308
|
}),
|
|
302
309
|
modernClientPrefix: DEFAULT_MODERN_CLIENT_PREFIX,
|
|
310
|
+
appClientEntryMode: normalizeAppClientEntryMode(process.env.APP_CLIENT_ENTRY_MODE),
|
|
303
311
|
cdnBaseUrl: trimValue(input.cdnBaseUrl),
|
|
304
312
|
apiClientStoragePrefix: DEFAULT_API_CLIENT_STORAGE_PREFIX,
|
|
305
313
|
apiClientStorageType: DEFAULT_API_CLIENT_STORAGE_TYPE,
|
|
@@ -642,6 +650,7 @@ function buildNginxRuntimeConfig(context, variant) {
|
|
|
642
650
|
__webpack_public_path__: context.cdnBaseUrl,
|
|
643
651
|
__nocobase_public_path__: variant === 'v1' ? context.appPublicPath : context.v2PublicPath,
|
|
644
652
|
...(variant === 'v2' ? { __nocobase_modern_client_prefix__: context.modernClientPrefix } : {}),
|
|
653
|
+
__nocobase_app_client_entry_mode__: context.appClientEntryMode,
|
|
645
654
|
__nocobase_api_base_url__: context.apiBasePath,
|
|
646
655
|
__nocobase_api_client_storage_prefix__: context.apiClientStoragePrefix,
|
|
647
656
|
__nocobase_api_client_storage_type__: context.apiClientStorageType,
|
|
@@ -693,6 +702,7 @@ async function buildEnvProxyNginxRenderContext(source, options) {
|
|
|
693
702
|
indexV1Path: await mapProxyPathFromCliRoot(resolveEnvProxyNginxIndexOutputPath(source.envName, 'v1', { scope: options?.scope }), options),
|
|
694
703
|
indexV2Path: await mapProxyPathFromCliRoot(resolveEnvProxyNginxIndexOutputPath(source.envName, 'v2', { scope: options?.scope }), options),
|
|
695
704
|
modernClientPrefix: source.settings.modernClientPrefix,
|
|
705
|
+
appClientEntryMode: source.settings.appClientEntryMode,
|
|
696
706
|
proxyHost,
|
|
697
707
|
snippetsDir: mappedSnippetsDir,
|
|
698
708
|
storageDir: mappedStorageDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/cli",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.11",
|
|
4
4
|
"description": "NocoBase Command Line Tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/generated/command-registry.js",
|
|
@@ -147,5 +147,5 @@
|
|
|
147
147
|
"type": "git",
|
|
148
148
|
"url": "git+https://github.com/nocobase/nocobase.git"
|
|
149
149
|
},
|
|
150
|
-
"gitHead": "
|
|
150
|
+
"gitHead": "c9ff1f51e5c33bc6437b64eb779212be71b78f58"
|
|
151
151
|
}
|