@lwrjs/config 0.22.8 → 0.22.9
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 +1 -0
- package/build/cjs/global-config.cjs +5 -4
- package/build/cjs/utils/lwc.cjs +2 -2
- package/build/cjs/utils/routes.cjs +4 -4
- package/build/cjs/utils/services.cjs +1 -1
- package/build/es/defaults.js +1 -0
- package/build/es/global-config.js +6 -5
- package/build/es/utils/lwc.js +3 -3
- package/build/es/utils/routes.js +5 -5
- package/build/es/utils/services.js +2 -2
- package/package.json +6 -6
package/build/cjs/defaults.cjs
CHANGED
|
@@ -67,6 +67,7 @@ var DEFAULT_LAYOUTS_DIR = "$rootDir/src/layouts";
|
|
|
67
67
|
var DEFAULT_DATA_DIR = "$rootDir/src/data";
|
|
68
68
|
var DEFAULT_MODULE_PROVIDERS = [
|
|
69
69
|
"@lwrjs/app-service/moduleProvider",
|
|
70
|
+
"@lwrjs/gate-module-provider",
|
|
70
71
|
"@lwrjs/router/module-provider",
|
|
71
72
|
"@lwrjs/lwc-module-provider",
|
|
72
73
|
"@lwrjs/npm-module-provider",
|
|
@@ -46,7 +46,7 @@ var import_runtime_config = __toModule(require("./runtime-config.cjs"));
|
|
|
46
46
|
var import_global_data = __toModule(require("./utils/global-data.cjs"));
|
|
47
47
|
var import_instrumentation = __toModule(require("@lwrjs/instrumentation"));
|
|
48
48
|
function getLwrConfigFromFile(rootDir, lwrConfigPath = import_defaults.DEFAULT_LWR_CONFIG_JSON) {
|
|
49
|
-
const resolvedLwrConfigPath = import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(lwrConfigPath, rootDir));
|
|
49
|
+
const resolvedLwrConfigPath = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(lwrConfigPath, rootDir)));
|
|
50
50
|
if (!import_fs.default.existsSync(resolvedLwrConfigPath)) {
|
|
51
51
|
import_diagnostics.logger.warn({label: `config`, message: `LWR Config not found on "${resolvedLwrConfigPath}"`});
|
|
52
52
|
return void 0;
|
|
@@ -61,8 +61,8 @@ function getLwrConfigFromFile(rootDir, lwrConfigPath = import_defaults.DEFAULT_L
|
|
|
61
61
|
}
|
|
62
62
|
function createCacheFolder(cache, rootDir) {
|
|
63
63
|
const cacheDir = (0, import_shared_utils.normalizeDirectory)(cache, rootDir);
|
|
64
|
-
const absPath = import_path.default.resolve(cacheDir);
|
|
65
|
-
import_fs.default.mkdirSync(import_path.default.join(absPath, import_shared_utils.ASSETS_CACHE_DIR), {recursive: true});
|
|
64
|
+
const absPath = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve(cacheDir));
|
|
65
|
+
import_fs.default.mkdirSync((0, import_shared_utils.toForwardSlash)(import_path.default.join(absPath, import_shared_utils.ASSETS_CACHE_DIR)), {recursive: true});
|
|
66
66
|
return absPath;
|
|
67
67
|
}
|
|
68
68
|
function mergeConfig(configArg) {
|
|
@@ -70,7 +70,8 @@ function mergeConfig(configArg) {
|
|
|
70
70
|
configArg = (0, import_merge.trimLwrConfig)(configArg);
|
|
71
71
|
(0, import_app_config.validateLwrAppConfig)(configArg, "pre");
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const rawRootDir = configArg?.rootDir || import_defaults.DEFAULT_ROOT_DIR;
|
|
74
|
+
const rootDir = import_path.default.isAbsolute(rawRootDir) ? (0, import_shared_utils.toForwardSlash)(rawRootDir) : (0, import_shared_utils.toForwardSlash)(import_path.default.resolve(rawRootDir));
|
|
74
75
|
const configFile = !configArg?.ignoreLwrConfigFile ? getLwrConfigFromFile(rootDir, configArg?.lwrConfigFile) : void 0;
|
|
75
76
|
if (configFile) {
|
|
76
77
|
configFile.routes = [...import_defaults.DEFAULT_LWR_CONFIG.routes, ...configFile?.routes ?? []];
|
package/build/cjs/utils/lwc.cjs
CHANGED
|
@@ -39,11 +39,11 @@ function normalizeModulePaths(modules, rootDir) {
|
|
|
39
39
|
return modules.map((m) => {
|
|
40
40
|
const dirRecord = m;
|
|
41
41
|
if (dirRecord.dir) {
|
|
42
|
-
dirRecord.dir = import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(dirRecord.dir, rootDir));
|
|
42
|
+
dirRecord.dir = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(dirRecord.dir, rootDir)));
|
|
43
43
|
}
|
|
44
44
|
const aliasRecord = m;
|
|
45
45
|
if (aliasRecord.path) {
|
|
46
|
-
aliasRecord.path = import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(aliasRecord.path, rootDir));
|
|
46
|
+
aliasRecord.path = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(aliasRecord.path, rootDir)));
|
|
47
47
|
}
|
|
48
48
|
return m;
|
|
49
49
|
});
|
|
@@ -65,13 +65,13 @@ function normalizeRoutePaths(routes = [], resourcePaths) {
|
|
|
65
65
|
return routes.map((route) => {
|
|
66
66
|
const {contentTemplate, layoutTemplate, subRoutes} = route;
|
|
67
67
|
if (contentTemplate) {
|
|
68
|
-
route.contentTemplate = typeof contentTemplate === "string" ? import_path.default.resolve((0, import_shared_utils.normalizeResourcePath)(contentTemplate, resourcePaths)) : contentTemplate;
|
|
68
|
+
route.contentTemplate = typeof contentTemplate === "string" ? (0, import_shared_utils.toForwardSlash)(import_path.default.resolve((0, import_shared_utils.normalizeResourcePath)(contentTemplate, resourcePaths))) : contentTemplate;
|
|
69
69
|
}
|
|
70
70
|
if (layoutTemplate) {
|
|
71
|
-
route.layoutTemplate = import_path.default.resolve((0, import_shared_utils.normalizeResourcePath)(layoutTemplate, resourcePaths));
|
|
71
|
+
route.layoutTemplate = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve((0, import_shared_utils.normalizeResourcePath)(layoutTemplate, resourcePaths)));
|
|
72
72
|
}
|
|
73
73
|
if (subRoutes) {
|
|
74
|
-
route.subRoutes = import_path.default.resolve((0, import_shared_utils.normalizeResourcePath)(subRoutes, resourcePaths));
|
|
74
|
+
route.subRoutes = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve((0, import_shared_utils.normalizeResourcePath)(subRoutes, resourcePaths)));
|
|
75
75
|
}
|
|
76
76
|
return route;
|
|
77
77
|
});
|
|
@@ -86,7 +86,7 @@ function normalizeRouteHandlers(routeHandlers) {
|
|
|
86
86
|
}
|
|
87
87
|
function normalizeRouteHandlerPaths(routeHandlers, resourcePaths) {
|
|
88
88
|
for (const [id, handler] of Object.entries(routeHandlers)) {
|
|
89
|
-
const normalizedPath = import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(handler || id, resourcePaths.rootDir));
|
|
89
|
+
const normalizedPath = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve((0, import_shared_utils.normalizeDirectory)(handler || id, resourcePaths.rootDir)));
|
|
90
90
|
if (import_fs.default.existsSync(normalizedPath)) {
|
|
91
91
|
routeHandlers[id] = normalizedPath;
|
|
92
92
|
}
|
|
@@ -38,7 +38,7 @@ function normalizeServicePaths(services, rootDir) {
|
|
|
38
38
|
const [rawServiceName, serviceConfig = void 0] = service;
|
|
39
39
|
let serviceName = (0, import_shared_utils.normalizeDirectory)(rawServiceName, rootDir);
|
|
40
40
|
if (!rawServiceName.startsWith("@") && !import_defaults.DEFAULT_SERVICE_PACKAGE_NAME.test(rawServiceName)) {
|
|
41
|
-
serviceName = import_path.default.resolve(serviceName);
|
|
41
|
+
serviceName = (0, import_shared_utils.toForwardSlash)(import_path.default.resolve(serviceName));
|
|
42
42
|
}
|
|
43
43
|
return [serviceName, serviceConfig];
|
|
44
44
|
});
|
package/build/es/defaults.js
CHANGED
|
@@ -38,6 +38,7 @@ const DEFAULT_DATA_DIR = '$rootDir/src/data';
|
|
|
38
38
|
// Providers
|
|
39
39
|
const DEFAULT_MODULE_PROVIDERS = [
|
|
40
40
|
'@lwrjs/app-service/moduleProvider',
|
|
41
|
+
'@lwrjs/gate-module-provider',
|
|
41
42
|
'@lwrjs/router/module-provider',
|
|
42
43
|
'@lwrjs/lwc-module-provider',
|
|
43
44
|
'@lwrjs/npm-module-provider',
|
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { parse } from 'jsonc-parser';
|
|
4
4
|
import { logger } from '@lwrjs/diagnostics';
|
|
5
|
-
import { readFile, normalizeDirectory, getFeatureFlags, ASSETS_CACHE_DIR, isLocalPath, normalizeToFileUrl } from '@lwrjs/shared-utils';
|
|
5
|
+
import { readFile, normalizeDirectory, getFeatureFlags, ASSETS_CACHE_DIR, isLocalPath, normalizeToFileUrl, toForwardSlash } from '@lwrjs/shared-utils';
|
|
6
6
|
import { DEFAULT_AMD_LOADER, DEFAULT_AMD_LOADER_LEGACY, DEFAULT_ESM_LOADER, DEFAULT_LWR_CONFIG, DEFAULT_LWR_CONFIG_JSON, DEFAULT_ROOT_DIR, } from './defaults.js';
|
|
7
7
|
import { lwrVersion as LWR_VERSION } from '@lwrjs/config/package';
|
|
8
8
|
import { validateLwrAppConfig } from './validation/app-config.js';
|
|
@@ -29,7 +29,7 @@ import { getTracer, ConfigSpan } from '@lwrjs/instrumentation';
|
|
|
29
29
|
* @returns {LwrGlobalConfig | undefined} the validated config file contents if it exists
|
|
30
30
|
*/
|
|
31
31
|
export function getLwrConfigFromFile(rootDir, lwrConfigPath = DEFAULT_LWR_CONFIG_JSON) {
|
|
32
|
-
const resolvedLwrConfigPath = path.resolve(normalizeDirectory(lwrConfigPath, rootDir));
|
|
32
|
+
const resolvedLwrConfigPath = toForwardSlash(path.resolve(normalizeDirectory(lwrConfigPath, rootDir)));
|
|
33
33
|
if (!fs.existsSync(resolvedLwrConfigPath)) {
|
|
34
34
|
logger.warn({ label: `config`, message: `LWR Config not found on "${resolvedLwrConfigPath}"` });
|
|
35
35
|
return undefined;
|
|
@@ -51,8 +51,8 @@ export function getLwrConfigFromFile(rootDir, lwrConfigPath = DEFAULT_LWR_CONFIG
|
|
|
51
51
|
*/
|
|
52
52
|
function createCacheFolder(cache, rootDir) {
|
|
53
53
|
const cacheDir = normalizeDirectory(cache, rootDir);
|
|
54
|
-
const absPath = path.resolve(cacheDir);
|
|
55
|
-
fs.mkdirSync(path.join(absPath, ASSETS_CACHE_DIR), { recursive: true });
|
|
54
|
+
const absPath = toForwardSlash(path.resolve(cacheDir));
|
|
55
|
+
fs.mkdirSync(toForwardSlash(path.join(absPath, ASSETS_CACHE_DIR)), { recursive: true });
|
|
56
56
|
return absPath;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -77,7 +77,8 @@ function mergeConfig(configArg) {
|
|
|
77
77
|
validateLwrAppConfig(configArg, 'pre');
|
|
78
78
|
}
|
|
79
79
|
// resolve the current root dir
|
|
80
|
-
const
|
|
80
|
+
const rawRootDir = configArg?.rootDir || DEFAULT_ROOT_DIR;
|
|
81
|
+
const rootDir = path.isAbsolute(rawRootDir) ? toForwardSlash(rawRootDir) : toForwardSlash(path.resolve(rawRootDir));
|
|
81
82
|
// attempt to load the config file if it isn't ignored
|
|
82
83
|
const configFile = !configArg?.ignoreLwrConfigFile
|
|
83
84
|
? getLwrConfigFromFile(rootDir, configArg?.lwrConfigFile)
|
package/build/es/utils/lwc.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { normalizeDirectory, normalizeInterchangeableModuleConfig } from '@lwrjs/shared-utils';
|
|
2
|
+
import { normalizeDirectory, normalizeInterchangeableModuleConfig, toForwardSlash } from '@lwrjs/shared-utils';
|
|
3
3
|
export function normalizeLwcConfig(config) {
|
|
4
4
|
return {
|
|
5
5
|
...config,
|
|
@@ -12,11 +12,11 @@ export function normalizeModulePaths(modules, rootDir) {
|
|
|
12
12
|
return modules.map((m) => {
|
|
13
13
|
const dirRecord = m;
|
|
14
14
|
if (dirRecord.dir) {
|
|
15
|
-
dirRecord.dir = path.resolve(normalizeDirectory(dirRecord.dir, rootDir));
|
|
15
|
+
dirRecord.dir = toForwardSlash(path.resolve(normalizeDirectory(dirRecord.dir, rootDir)));
|
|
16
16
|
}
|
|
17
17
|
const aliasRecord = m;
|
|
18
18
|
if (aliasRecord.path) {
|
|
19
|
-
aliasRecord.path = path.resolve(normalizeDirectory(aliasRecord.path, rootDir));
|
|
19
|
+
aliasRecord.path = toForwardSlash(path.resolve(normalizeDirectory(aliasRecord.path, rootDir)));
|
|
20
20
|
}
|
|
21
21
|
return m;
|
|
22
22
|
});
|
package/build/es/utils/routes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { normalizeDirectory, normalizeResourcePath } from '@lwrjs/shared-utils';
|
|
3
|
+
import { normalizeDirectory, normalizeResourcePath, toForwardSlash } from '@lwrjs/shared-utils';
|
|
4
4
|
import { DEFAULT_LWR_BOOTSTRAP_CONFIG } from '../defaults.js';
|
|
5
5
|
export function normalizeRoutes(routes, routeHandlers) {
|
|
6
6
|
return routes.map((route) => {
|
|
@@ -46,14 +46,14 @@ export function normalizeRoutePaths(routes = [], resourcePaths) {
|
|
|
46
46
|
if (contentTemplate) {
|
|
47
47
|
route.contentTemplate =
|
|
48
48
|
typeof contentTemplate === 'string'
|
|
49
|
-
? path.resolve(normalizeResourcePath(contentTemplate, resourcePaths))
|
|
49
|
+
? toForwardSlash(path.resolve(normalizeResourcePath(contentTemplate, resourcePaths)))
|
|
50
50
|
: contentTemplate;
|
|
51
51
|
}
|
|
52
52
|
if (layoutTemplate) {
|
|
53
|
-
route.layoutTemplate = path.resolve(normalizeResourcePath(layoutTemplate, resourcePaths));
|
|
53
|
+
route.layoutTemplate = toForwardSlash(path.resolve(normalizeResourcePath(layoutTemplate, resourcePaths)));
|
|
54
54
|
}
|
|
55
55
|
if (subRoutes) {
|
|
56
|
-
route.subRoutes = path.resolve(normalizeResourcePath(subRoutes, resourcePaths));
|
|
56
|
+
route.subRoutes = toForwardSlash(path.resolve(normalizeResourcePath(subRoutes, resourcePaths)));
|
|
57
57
|
}
|
|
58
58
|
return route;
|
|
59
59
|
});
|
|
@@ -68,7 +68,7 @@ export function normalizeRouteHandlers(routeHandlers) {
|
|
|
68
68
|
}
|
|
69
69
|
export function normalizeRouteHandlerPaths(routeHandlers, resourcePaths) {
|
|
70
70
|
for (const [id, handler] of Object.entries(routeHandlers)) {
|
|
71
|
-
const normalizedPath = path.resolve(normalizeDirectory(handler || id, resourcePaths.rootDir));
|
|
71
|
+
const normalizedPath = toForwardSlash(path.resolve(normalizeDirectory(handler || id, resourcePaths.rootDir)));
|
|
72
72
|
// use the normalized path if it exists; otherwise the handler is module specifier
|
|
73
73
|
if (fs.existsSync(normalizedPath)) {
|
|
74
74
|
routeHandlers[id] = normalizedPath;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { normalizeDirectory } from '@lwrjs/shared-utils';
|
|
2
|
+
import { normalizeDirectory, toForwardSlash } from '@lwrjs/shared-utils';
|
|
3
3
|
import { DEFAULT_SERVICE_PACKAGE_NAME } from '../defaults.js';
|
|
4
4
|
export function normalizeServices(services = []) {
|
|
5
5
|
return services.map((service) => (Array.isArray(service) ? service : [service, undefined]));
|
|
@@ -11,7 +11,7 @@ export function normalizeServicePaths(services, rootDir) {
|
|
|
11
11
|
// We consider it an npm module if it starts with @ or if is of the form lwr-[servicename]-service
|
|
12
12
|
// Otherwise resolve it as a relative path
|
|
13
13
|
if (!rawServiceName.startsWith('@') && !DEFAULT_SERVICE_PACKAGE_NAME.test(rawServiceName)) {
|
|
14
|
-
serviceName = path.resolve(serviceName);
|
|
14
|
+
serviceName = toForwardSlash(path.resolve(serviceName));
|
|
15
15
|
}
|
|
16
16
|
return [serviceName, serviceConfig];
|
|
17
17
|
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.22.
|
|
7
|
+
"version": "0.22.9",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"test": "jest"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@lwrjs/diagnostics": "0.22.
|
|
46
|
-
"@lwrjs/instrumentation": "0.22.
|
|
47
|
-
"@lwrjs/shared-utils": "0.22.
|
|
45
|
+
"@lwrjs/diagnostics": "0.22.9",
|
|
46
|
+
"@lwrjs/instrumentation": "0.22.9",
|
|
47
|
+
"@lwrjs/shared-utils": "0.22.9",
|
|
48
48
|
"fs-extra": "^11.2.0",
|
|
49
49
|
"jsonc-parser": "^3.3.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@lwrjs/types": "0.22.
|
|
52
|
+
"@lwrjs/types": "0.22.9",
|
|
53
53
|
"jest": "29.7.0",
|
|
54
54
|
"memfs": "^4.13.0",
|
|
55
55
|
"ts-jest": "^29.2.6"
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"volta": {
|
|
72
72
|
"extends": "../../../package.json"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "d0c112cd7b6eb940d6e554d0bbd93fb535465fdc"
|
|
75
75
|
}
|