@lwrjs/config 0.9.0-alpha.18 → 0.9.0-alpha.19
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/build/cjs/defaults.cjs +21 -4
- package/build/cjs/utils/merge.cjs +6 -2
- package/build/es/defaults.d.ts +2 -2
- package/build/es/defaults.js +24 -3
- package/build/es/utils/merge.js +10 -2
- package/package.json +5 -5
package/build/cjs/defaults.cjs
CHANGED
|
@@ -26,7 +26,6 @@ __markAsModule(exports);
|
|
|
26
26
|
__export(exports, {
|
|
27
27
|
DEFAULT_AMD_LOADER: () => DEFAULT_AMD_LOADER,
|
|
28
28
|
DEFAULT_AMD_LOADER_LEGACY: () => DEFAULT_AMD_LOADER_LEGACY,
|
|
29
|
-
DEFAULT_BUNDLE_EXCLUSIONS: () => DEFAULT_BUNDLE_EXCLUSIONS,
|
|
30
29
|
DEFAULT_ESM_LOADER: () => DEFAULT_ESM_LOADER,
|
|
31
30
|
DEFAULT_GENERATOR_CONFIG: () => DEFAULT_GENERATOR_CONFIG,
|
|
32
31
|
DEFAULT_LWR_CONFIG: () => DEFAULT_LWR_CONFIG,
|
|
@@ -34,10 +33,12 @@ __export(exports, {
|
|
|
34
33
|
DEFAULT_LWR_MODULES: () => DEFAULT_LWR_MODULES,
|
|
35
34
|
DEFAULT_ROOT_DIR: () => DEFAULT_ROOT_DIR,
|
|
36
35
|
DEFAULT_SERVICE_PACKAGE_NAME: () => DEFAULT_SERVICE_PACKAGE_NAME,
|
|
37
|
-
LWR_VERSION: () => LWR_VERSION
|
|
36
|
+
LWR_VERSION: () => LWR_VERSION,
|
|
37
|
+
getDefaultBundleConfig: () => getDefaultBundleConfig
|
|
38
38
|
});
|
|
39
39
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
40
40
|
var import_package = __toModule(require("@lwrjs/config/package"));
|
|
41
|
+
var import_runtime_config = __toModule(require("./runtime-config.cjs"));
|
|
41
42
|
var PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3e3;
|
|
42
43
|
var MODE = process.env.MODE || "dev";
|
|
43
44
|
var DEFAULT_BASE_PATH = "";
|
|
@@ -86,13 +87,29 @@ var DEFAULT_LWR_MODULES = [
|
|
|
86
87
|
{npm: "@lwrjs/router"},
|
|
87
88
|
{npm: "@lwc/synthetic-shadow"}
|
|
88
89
|
];
|
|
89
|
-
var
|
|
90
|
+
var DEFAULT_ESM_BUNDLE_EXCLUSIONS = [
|
|
90
91
|
"lwc",
|
|
91
92
|
"@lwc/synthetic-shadow",
|
|
92
93
|
"lwr/navigation",
|
|
93
94
|
"lwr/esmLoader",
|
|
94
95
|
"lwr/profiler"
|
|
95
96
|
];
|
|
97
|
+
var DEFAULT_AMD_BUNDLE_EXCLUSIONS = ["lwc", "@lwc/synthetic-shadow", "lwr/navigation", "lwr/profiler"];
|
|
98
|
+
var DEFAULT_ESM_BUNDLE_EXTERNALS = {};
|
|
99
|
+
var DEFAULT_AMD_BUNDLE_EXTERNALS = {
|
|
100
|
+
"lwr/loader": "lwr-loader-shim.bundle.min.js"
|
|
101
|
+
};
|
|
102
|
+
var DEFAULT_AMD_LEGACY_BUNDLE_EXTERNALS = {
|
|
103
|
+
"lwr/loaderLegacy": "lwr-loader-shim-legacy.bundle.min.js"
|
|
104
|
+
};
|
|
105
|
+
function getDefaultBundleConfig(mode) {
|
|
106
|
+
const format = (0, import_runtime_config.getServerModeConfig)(mode || MODE).format;
|
|
107
|
+
const loaderLegacy = (0, import_shared_utils.getFeatureFlags)().LEGACY_LOADER;
|
|
108
|
+
return {
|
|
109
|
+
exclude: format === "esm" ? DEFAULT_ESM_BUNDLE_EXCLUSIONS : DEFAULT_AMD_BUNDLE_EXCLUSIONS,
|
|
110
|
+
external: format === "esm" ? DEFAULT_ESM_BUNDLE_EXTERNALS : loaderLegacy ? DEFAULT_AMD_LEGACY_BUNDLE_EXTERNALS : DEFAULT_AMD_BUNDLE_EXTERNALS
|
|
111
|
+
};
|
|
112
|
+
}
|
|
96
113
|
var DEFAULT_LWR_CONFIG = {
|
|
97
114
|
port: PORT,
|
|
98
115
|
ignoreLwrConfigFile: false,
|
|
@@ -120,7 +137,7 @@ var DEFAULT_LWR_CONFIG = {
|
|
|
120
137
|
routes: [],
|
|
121
138
|
errorRoutes: [],
|
|
122
139
|
routeHandlers: {},
|
|
123
|
-
bundleConfig:
|
|
140
|
+
bundleConfig: getDefaultBundleConfig(MODE),
|
|
124
141
|
serverType: DEFAULT_SERVER_TYPE,
|
|
125
142
|
locker: import_shared_utils.DEFAULT_LWR_LOCKER_CONFIG
|
|
126
143
|
};
|
|
@@ -59,12 +59,16 @@ function mergeLwcConfig(config1, config2) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
function mergeBundleConfig(config1, config2) {
|
|
62
|
-
const
|
|
62
|
+
const mode = config2?.serverMode || config1?.serverMode;
|
|
63
|
+
const DEFAULT_BUNDLE_CONFIG = (0, import_defaults.getDefaultBundleConfig)(mode);
|
|
64
|
+
const defaultExclusions = config2?.bundleConfig?.UNSAFE_lwrDefaultExclude || config1?.bundleConfig?.UNSAFE_lwrDefaultExclude || DEFAULT_BUNDLE_CONFIG.exclude || [];
|
|
63
65
|
const configExclusions = config2?.bundleConfig?.exclude || config1?.bundleConfig?.exclude || [];
|
|
66
|
+
const configExternals = config2?.bundleConfig?.external || config1?.bundleConfig?.external || DEFAULT_BUNDLE_CONFIG.external || {};
|
|
64
67
|
return {
|
|
65
68
|
...config1?.bundleConfig,
|
|
66
69
|
...config2?.bundleConfig,
|
|
67
|
-
exclude: [...new Set([...defaultExclusions, ...configExclusions])]
|
|
70
|
+
exclude: [...new Set([...defaultExclusions, ...configExclusions])],
|
|
71
|
+
external: {...configExternals}
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
74
|
function mergeLockerConfig(jsonConfig, config) {
|
package/build/es/defaults.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LwrGlobalConfig } from '@lwrjs/types';
|
|
1
|
+
import type { BundleConfig, LwrGlobalConfig } from '@lwrjs/types';
|
|
2
2
|
export declare const LWR_VERSION: string;
|
|
3
3
|
export declare const DEFAULT_LWR_CONFIG_JSON = "$rootDir/lwr.config.json";
|
|
4
4
|
export declare const DEFAULT_GENERATOR_CONFIG: {
|
|
@@ -16,6 +16,6 @@ export declare const DEFAULT_SERVICE_PACKAGE_NAME: RegExp;
|
|
|
16
16
|
export declare const DEFAULT_LWR_MODULES: {
|
|
17
17
|
npm: string;
|
|
18
18
|
}[];
|
|
19
|
-
export declare
|
|
19
|
+
export declare function getDefaultBundleConfig(mode?: string): BundleConfig;
|
|
20
20
|
export declare const DEFAULT_LWR_CONFIG: Required<LwrGlobalConfig>;
|
|
21
21
|
//# sourceMappingURL=defaults.d.ts.map
|
package/build/es/defaults.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DEFAULT_LWR_LOCKER_CONFIG } from '@lwrjs/shared-utils';
|
|
1
|
+
import { DEFAULT_LWR_LOCKER_CONFIG, getFeatureFlags } from '@lwrjs/shared-utils';
|
|
2
2
|
import { version } from '@lwrjs/config/package';
|
|
3
|
+
import { getServerModeConfig } from './runtime-config.js';
|
|
3
4
|
const PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
|
|
4
5
|
const MODE = process.env.MODE || 'dev';
|
|
5
6
|
const DEFAULT_BASE_PATH = '';
|
|
@@ -50,13 +51,33 @@ export const DEFAULT_LWR_MODULES = [
|
|
|
50
51
|
{ npm: '@lwrjs/router' },
|
|
51
52
|
{ npm: '@lwc/synthetic-shadow' },
|
|
52
53
|
];
|
|
53
|
-
|
|
54
|
+
const DEFAULT_ESM_BUNDLE_EXCLUSIONS = [
|
|
54
55
|
'lwc',
|
|
55
56
|
'@lwc/synthetic-shadow',
|
|
56
57
|
'lwr/navigation',
|
|
57
58
|
'lwr/esmLoader',
|
|
58
59
|
'lwr/profiler',
|
|
59
60
|
];
|
|
61
|
+
const DEFAULT_AMD_BUNDLE_EXCLUSIONS = ['lwc', '@lwc/synthetic-shadow', 'lwr/navigation', 'lwr/profiler'];
|
|
62
|
+
const DEFAULT_ESM_BUNDLE_EXTERNALS = {};
|
|
63
|
+
const DEFAULT_AMD_BUNDLE_EXTERNALS = {
|
|
64
|
+
'lwr/loader': 'lwr-loader-shim.bundle.min.js',
|
|
65
|
+
};
|
|
66
|
+
const DEFAULT_AMD_LEGACY_BUNDLE_EXTERNALS = {
|
|
67
|
+
'lwr/loaderLegacy': 'lwr-loader-shim-legacy.bundle.min.js',
|
|
68
|
+
};
|
|
69
|
+
export function getDefaultBundleConfig(mode) {
|
|
70
|
+
const format = getServerModeConfig(mode || MODE).format;
|
|
71
|
+
const loaderLegacy = getFeatureFlags().LEGACY_LOADER;
|
|
72
|
+
return {
|
|
73
|
+
exclude: format === 'esm' ? DEFAULT_ESM_BUNDLE_EXCLUSIONS : DEFAULT_AMD_BUNDLE_EXCLUSIONS,
|
|
74
|
+
external: format === 'esm'
|
|
75
|
+
? DEFAULT_ESM_BUNDLE_EXTERNALS
|
|
76
|
+
: loaderLegacy
|
|
77
|
+
? DEFAULT_AMD_LEGACY_BUNDLE_EXTERNALS
|
|
78
|
+
: DEFAULT_AMD_BUNDLE_EXTERNALS,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
60
81
|
export const DEFAULT_LWR_CONFIG = {
|
|
61
82
|
port: PORT,
|
|
62
83
|
ignoreLwrConfigFile: false,
|
|
@@ -84,7 +105,7 @@ export const DEFAULT_LWR_CONFIG = {
|
|
|
84
105
|
routes: [],
|
|
85
106
|
errorRoutes: [],
|
|
86
107
|
routeHandlers: {},
|
|
87
|
-
bundleConfig:
|
|
108
|
+
bundleConfig: getDefaultBundleConfig(MODE),
|
|
88
109
|
serverType: DEFAULT_SERVER_TYPE,
|
|
89
110
|
locker: DEFAULT_LWR_LOCKER_CONFIG,
|
|
90
111
|
};
|
package/build/es/utils/merge.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_LOCKER_TRUSTED_CMP, DEFAULT_LWR_LOCKER_CONFIG } from '@lwrjs/shared-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { getDefaultBundleConfig, DEFAULT_GENERATOR_CONFIG, DEFAULT_LWR_MODULES } from '../defaults.js';
|
|
3
3
|
function isNormalizedLwrGlobalConfig(config) {
|
|
4
4
|
return config?.lwrVersion !== undefined;
|
|
5
5
|
}
|
|
@@ -34,14 +34,22 @@ export function mergeLwcConfig(config1, config2) {
|
|
|
34
34
|
}
|
|
35
35
|
// merge default bundle exclusions with any bundle exclusions specified in config
|
|
36
36
|
export function mergeBundleConfig(config1, config2) {
|
|
37
|
+
const mode = config2?.serverMode || config1?.serverMode;
|
|
38
|
+
const DEFAULT_BUNDLE_CONFIG = getDefaultBundleConfig(mode);
|
|
37
39
|
const defaultExclusions = config2?.bundleConfig?.UNSAFE_lwrDefaultExclude ||
|
|
38
40
|
config1?.bundleConfig?.UNSAFE_lwrDefaultExclude ||
|
|
39
|
-
|
|
41
|
+
DEFAULT_BUNDLE_CONFIG.exclude ||
|
|
42
|
+
[];
|
|
40
43
|
const configExclusions = config2?.bundleConfig?.exclude || config1?.bundleConfig?.exclude || [];
|
|
44
|
+
const configExternals = config2?.bundleConfig?.external ||
|
|
45
|
+
config1?.bundleConfig?.external ||
|
|
46
|
+
DEFAULT_BUNDLE_CONFIG.external ||
|
|
47
|
+
{};
|
|
41
48
|
return {
|
|
42
49
|
...config1?.bundleConfig,
|
|
43
50
|
...config2?.bundleConfig,
|
|
44
51
|
exclude: [...new Set([...defaultExclusions, ...configExclusions])],
|
|
52
|
+
external: { ...configExternals },
|
|
45
53
|
};
|
|
46
54
|
}
|
|
47
55
|
// merge default locker trusted namespaces/cmps with any trusted namespaces/cmps specified in config
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.9.0-alpha.
|
|
7
|
+
"version": "0.9.0-alpha.19",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"package.cjs"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@lwrjs/diagnostics": "0.9.0-alpha.
|
|
40
|
-
"@lwrjs/shared-utils": "0.9.0-alpha.
|
|
39
|
+
"@lwrjs/diagnostics": "0.9.0-alpha.19",
|
|
40
|
+
"@lwrjs/shared-utils": "0.9.0-alpha.19",
|
|
41
41
|
"fs-extra": "^10.1.0",
|
|
42
42
|
"jsonc-parser": "^3.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@lwrjs/types": "0.9.0-alpha.
|
|
45
|
+
"@lwrjs/types": "0.9.0-alpha.19"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=14.15.4 <19"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "65623ff6f03a217321d7d342df391fb05c90eb19"
|
|
51
51
|
}
|