@lwrjs/config 0.9.0-alpha.35 → 0.9.0-alpha.37
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.
|
@@ -26,12 +26,12 @@ __markAsModule(exports);
|
|
|
26
26
|
__export(exports, {
|
|
27
27
|
applySsrConfig: () => applySsrConfig,
|
|
28
28
|
applyStaticProviderConfig: () => applyStaticProviderConfig,
|
|
29
|
+
getLwrConfigFromFile: () => getLwrConfigFromFile,
|
|
29
30
|
loadConfig: () => loadConfig,
|
|
30
31
|
resolveGlobalConfig: () => resolveGlobalConfig
|
|
31
32
|
});
|
|
32
33
|
var import_fs = __toModule(require("fs"));
|
|
33
34
|
var import_path = __toModule(require("path"));
|
|
34
|
-
var import_resolve = __toModule(require("resolve"));
|
|
35
35
|
var import_jsonc_parser = __toModule(require("jsonc-parser"));
|
|
36
36
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
37
37
|
var import_defaults = __toModule(require("./defaults.cjs"));
|
|
@@ -134,11 +134,6 @@ function applySsrConfig(config) {
|
|
|
134
134
|
if (!hasSSR) {
|
|
135
135
|
return config;
|
|
136
136
|
}
|
|
137
|
-
try {
|
|
138
|
-
import_resolve.default.sync("@lwrjs/lwc-ssr/package.json");
|
|
139
|
-
} catch (e) {
|
|
140
|
-
throw new Error('The "@lwrjs/lwc-ssr" package must be installed when "bootstrap.ssr" is configured to true on any route.');
|
|
141
|
-
}
|
|
142
137
|
const hasSsrModuleProvider = config.moduleProviders.some(([m]) => m === import_defaults.SSR_MODULE_PROVIDER);
|
|
143
138
|
const hasSsrViewTransformer = config.viewTransformers.some(([v]) => v === import_defaults.SSR_VIEW_TRANSFORM_PLUGIN);
|
|
144
139
|
return {
|
package/build/cjs/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(exports, {
|
|
|
28
28
|
LWR_VERSION: () => import_package.version,
|
|
29
29
|
executeConfigHooks: () => import_hooks.executeConfigHooks,
|
|
30
30
|
executeStartHooks: () => import_hooks.executeStartHooks,
|
|
31
|
+
getLwrConfigFromFile: () => import_global_config.getLwrConfigFromFile,
|
|
31
32
|
getRuntimeEnvironment: () => import_runtime_config.getRuntimeEnvironment,
|
|
32
33
|
loadConfig: () => import_global_config.loadConfig,
|
|
33
34
|
normalizeConfig: () => import_global_config.resolveGlobalConfig,
|
|
@@ -9,6 +9,21 @@ export interface Configurations {
|
|
|
9
9
|
runtimeEnvironment: RuntimeEnvironment;
|
|
10
10
|
globalData: GlobalData;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Load and validate the global config file.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* By default, this file is expected to be named `lwr.config.json` and be located at the root directory.
|
|
17
|
+
* This default expectation can be override with the `lwrConfigFile` configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {LwrConfigValidationError} Validation errors will be swallowed when the
|
|
20
|
+
* `UNSAFE_IGNORE_CONFIG_VALIDATION` flag is set.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} lwrConfigPath - config file path override
|
|
23
|
+
* @param {string} rootDir - the directory used to resolve `$rootDir`
|
|
24
|
+
* @returns {LwrGlobalConfig | undefined} the validated config file contents if it exists
|
|
25
|
+
*/
|
|
26
|
+
export declare function getLwrConfigFromFile(rootDir: string, lwrConfigPath?: string): LwrGlobalConfig | undefined;
|
|
12
27
|
/**
|
|
13
28
|
* Add the SSR module provider and view transformer, if any route has `ssr` turned on.
|
|
14
29
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import resolve from 'resolve';
|
|
4
3
|
import { parse } from 'jsonc-parser';
|
|
5
4
|
import { readFile, normalizeDirectory, getFeatureFlags, logger, ASSETS_CACHE_DIR } from '@lwrjs/shared-utils';
|
|
6
5
|
import { SSR_MODULE_PROVIDER, SSR_VIEW_TRANSFORM_PLUGIN } from './defaults.js';
|
|
@@ -27,7 +26,7 @@ import { getGlobalData } from './utils/global-data.js';
|
|
|
27
26
|
* @param {string} rootDir - the directory used to resolve `$rootDir`
|
|
28
27
|
* @returns {LwrGlobalConfig | undefined} the validated config file contents if it exists
|
|
29
28
|
*/
|
|
30
|
-
function getLwrConfigFromFile(rootDir, lwrConfigPath = DEFAULT_LWR_CONFIG_JSON) {
|
|
29
|
+
export function getLwrConfigFromFile(rootDir, lwrConfigPath = DEFAULT_LWR_CONFIG_JSON) {
|
|
31
30
|
const resolvedLwrConfigPath = path.resolve(normalizeDirectory(lwrConfigPath, rootDir));
|
|
32
31
|
if (!fs.existsSync(resolvedLwrConfigPath)) {
|
|
33
32
|
logger.warn(`LWR Config not found on "${resolvedLwrConfigPath}"`);
|
|
@@ -180,14 +179,9 @@ export function applySsrConfig(config) {
|
|
|
180
179
|
if (!hasSSR) {
|
|
181
180
|
return config;
|
|
182
181
|
}
|
|
183
|
-
// ensure LWR's SSR package has been installed
|
|
184
|
-
try {
|
|
185
|
-
resolve.sync('@lwrjs/lwc-ssr/package.json');
|
|
186
|
-
}
|
|
187
|
-
catch (e) {
|
|
188
|
-
throw new Error('The "@lwrjs/lwc-ssr" package must be installed when "bootstrap.ssr" is configured to true on any route.');
|
|
189
|
-
}
|
|
190
182
|
// add the SSR configuration, if it's not already there
|
|
183
|
+
// note: this is a noop when called from an onStart hook of an LWR@MRT app,
|
|
184
|
+
// since the app has already been built / rolled up
|
|
191
185
|
const hasSsrModuleProvider = config.moduleProviders.some(([m]) => m === SSR_MODULE_PROVIDER);
|
|
192
186
|
const hasSsrViewTransformer = config.viewTransformers.some(([v]) => v === SSR_VIEW_TRANSFORM_PLUGIN);
|
|
193
187
|
return {
|
package/build/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { version as LWR_VERSION, lwcVersion as LWC_VERSION } from '@lwrjs/config/package';
|
|
2
|
-
export { loadConfig, resolveGlobalConfig as normalizeConfig } from './global-config.js';
|
|
2
|
+
export { loadConfig, resolveGlobalConfig as normalizeConfig, getLwrConfigFromFile } from './global-config.js';
|
|
3
3
|
export { getRuntimeEnvironment } from './runtime-config.js';
|
|
4
4
|
export { executeConfigHooks, executeStartHooks } from './hooks.js';
|
|
5
5
|
export { validateLwrAppConfig } from './validation/app-config.js';
|
package/build/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { version as LWR_VERSION, lwcVersion as LWC_VERSION } from '@lwrjs/config/package';
|
|
2
|
-
export { loadConfig, resolveGlobalConfig as normalizeConfig } from './global-config.js';
|
|
2
|
+
export { loadConfig, resolveGlobalConfig as normalizeConfig, getLwrConfigFromFile } from './global-config.js';
|
|
3
3
|
export { getRuntimeEnvironment } from './runtime-config.js';
|
|
4
4
|
export { executeConfigHooks, executeStartHooks } from './hooks.js';
|
|
5
5
|
export { validateLwrAppConfig } from './validation/app-config.js';
|
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.37",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -36,14 +36,13 @@
|
|
|
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.37",
|
|
40
|
+
"@lwrjs/shared-utils": "0.9.0-alpha.37",
|
|
41
41
|
"fs-extra": "^11.1.0",
|
|
42
|
-
"jsonc-parser": "^3.0.0"
|
|
43
|
-
"resolve": "^1.22.1"
|
|
42
|
+
"jsonc-parser": "^3.0.0"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
|
-
"@lwrjs/types": "0.9.0-alpha.
|
|
45
|
+
"@lwrjs/types": "0.9.0-alpha.37"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
48
|
"lwc": "2.x"
|
|
@@ -51,5 +50,5 @@
|
|
|
51
50
|
"engines": {
|
|
52
51
|
"node": ">=16.0.0 <20"
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "3e2fdc8beb6e6f9a108a674a8ebaaa30e2b498cb"
|
|
55
54
|
}
|