@lwrjs/config 0.15.0-alpha.28 → 0.15.0-alpha.29

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.
@@ -30,6 +30,7 @@ __export(exports, {
30
30
  executeStartHooks: () => executeStartHooks
31
31
  });
32
32
  var import_routes = __toModule(require("./utils/routes.cjs"));
33
+ var import_assets = __toModule(require("./utils/assets.cjs"));
33
34
  var import_app_config = __toModule(require("./validation/app-config.cjs"));
34
35
  var import_instrumentation = __toModule(require("@lwrjs/instrumentation"));
35
36
  var import_defaults = __toModule(require("./defaults.cjs"));
@@ -94,11 +95,13 @@ function executeStartHooks(hooks, globalConfig, runtimeEnvironment, skipValidate
94
95
  coreProxy: globalConfig.coreProxy,
95
96
  i18n: globalConfig.i18n,
96
97
  routes: globalConfig.routes,
98
+ assets: globalConfig.assets,
97
99
  errorRoutes: globalConfig.errorRoutes
98
100
  };
99
101
  hook.onStart(onStartConfig);
100
102
  runtimeEnvironment.basePath = globalConfig.basePath = onStartConfig.basePath || "";
101
103
  runtimeEnvironment.i18n = globalConfig.i18n = onStartConfig.i18n;
104
+ globalConfig.assets = (0, import_assets.normalizeAssetPaths)((0, import_assets.normalizeAssets)(onStartConfig.assets), globalConfig.rootDir);
102
105
  globalConfig._isSsrCompilerEnabled = onStartConfig._isSsrCompilerEnabled;
103
106
  globalConfig.coreProxy = onStartConfig.coreProxy;
104
107
  globalConfig.routes = onStartConfig.routes || [];
@@ -37,7 +37,8 @@ var DEFAULT_I18N_CONFIG = {
37
37
  {
38
38
  id: "en-US"
39
39
  }
40
- ]
40
+ ],
41
+ defaultRedirectParams: {}
41
42
  };
42
43
  var RUNTIME_CONFIGS = {
43
44
  dev: {
@@ -89,7 +89,7 @@ var ROOT_ATTRIBUTE_KEYS = createKeys("root", [
89
89
  var ASSET_DIR_ATTRIBUTE_KEYS = createKeys("assetDir", ["alias", "dir", "urlPath", "root"]);
90
90
  var ASSET_FILE_ATTRIBUTE_KEYS = createKeys("assetFile", ["alias", "file", "urlPath"]);
91
91
  var LOCKER_ATTRIBUTE_KEYS = createKeys("locker", ["enabled", "trustedComponents"]);
92
- var I18N_ATTRIBUTE_KEYS = createKeys("i18n", ["defaultLocale", "locales", "uriPattern"]);
92
+ var I18N_ATTRIBUTE_KEYS = createKeys("i18n", ["defaultLocale", "locales", "uriPattern", "defaultRedirectParams"]);
93
93
  var CORE_PROXY_ATTRIBUTE_KEYS = createKeys("coreProxy", ["origin", "host", "servername"]);
94
94
  var STATIC_SITE_GENERATOR_ATTRIBUTE_KEYS = createKeys("staticSiteGenerator", [
95
95
  "outputDir",
@@ -117,6 +117,8 @@ function validateI18NConfig(node, validationContext, preMerge) {
117
117
  validationContext.assertNotEmptyString(defaultLocale, "i18n.defaultLocale");
118
118
  const localeIds = locales?.children?.map((n) => (0, import_jsonc_parser.findNodeAtLocation)(n, ["id"])?.value) || [];
119
119
  validationContext.assertDefaultInLocales(node, defaultLocale?.value, localeIds);
120
+ const defaultRedirectParams = (0, import_jsonc_parser.findNodeAtLocation)(node, ["defaultRedirectParams"]);
121
+ validationContext.assertIsObject(defaultRedirectParams, "i18n.defaultRedirectParams");
120
122
  }
121
123
  }
122
124
  function validateStaticSiteGeneratorConfig(node, validationContext) {
@@ -9,7 +9,8 @@ export declare function executeConfigHooks(hooks: HooksPlugin[], globalConfig: N
9
9
  * @privateRemarks
10
10
  * Changes to configurations are made by reference.
11
11
  *
12
- * These hooks can only modify the `routes` property in the global config.
12
+ * These hooks can modify the following global config properties:
13
+ * routes, errorRoutes, assets, i18n, basePath, coreProxy, _isSsrCompilerEnabled
13
14
  *
14
15
  * @param hooks - hooks plugins
15
16
  * @param globalConfig - global configuration
package/build/es/hooks.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { normalizeRoutes } from './utils/routes.js';
2
+ import { normalizeAssets, normalizeAssetPaths } from './utils/assets.js';
2
3
  import { validateLwrAppConfig } from './validation/app-config.js';
3
4
  import { getTracer, ConfigSpan } from '@lwrjs/instrumentation';
4
5
  import { LWR_INFO_ROUTE } from './defaults.js';
@@ -74,7 +75,8 @@ export async function executeConfigHooks(hooks, globalConfig, runtimeEnvironment
74
75
  * @privateRemarks
75
76
  * Changes to configurations are made by reference.
76
77
  *
77
- * These hooks can only modify the `routes` property in the global config.
78
+ * These hooks can modify the following global config properties:
79
+ * routes, errorRoutes, assets, i18n, basePath, coreProxy, _isSsrCompilerEnabled
78
80
  *
79
81
  * @param hooks - hooks plugins
80
82
  * @param globalConfig - global configuration
@@ -95,12 +97,14 @@ export function executeStartHooks(hooks, globalConfig, runtimeEnvironment, skipV
95
97
  coreProxy: globalConfig.coreProxy,
96
98
  i18n: globalConfig.i18n,
97
99
  routes: globalConfig.routes,
100
+ assets: globalConfig.assets,
98
101
  errorRoutes: globalConfig.errorRoutes,
99
102
  };
100
103
  hook.onStart(onStartConfig);
101
104
  // copy updated values back to the globalConfig
102
105
  runtimeEnvironment.basePath = globalConfig.basePath = onStartConfig.basePath || '';
103
106
  runtimeEnvironment.i18n = globalConfig.i18n = onStartConfig.i18n;
107
+ globalConfig.assets = normalizeAssetPaths(normalizeAssets(onStartConfig.assets), globalConfig.rootDir);
104
108
  globalConfig._isSsrCompilerEnabled = onStartConfig._isSsrCompilerEnabled;
105
109
  globalConfig.coreProxy = onStartConfig.coreProxy;
106
110
  globalConfig.routes = (onStartConfig.routes || []);
@@ -7,6 +7,7 @@ export const DEFAULT_I18N_CONFIG = {
7
7
  id: 'en-US',
8
8
  },
9
9
  ],
10
+ defaultRedirectParams: {}
10
11
  };
11
12
  export const RUNTIME_CONFIGS = {
12
13
  dev: {
@@ -31,7 +31,7 @@ export declare const ROOT_ATTRIBUTE_KEYS: ["amdLoader", "apiVersion", "assets",
31
31
  export declare const ASSET_DIR_ATTRIBUTE_KEYS: ["alias", "dir", "urlPath", "root"];
32
32
  export declare const ASSET_FILE_ATTRIBUTE_KEYS: ["alias", "file", "urlPath"];
33
33
  export declare const LOCKER_ATTRIBUTE_KEYS: ["enabled", "trustedComponents"];
34
- export declare const I18N_ATTRIBUTE_KEYS: ["defaultLocale", "locales", "uriPattern"];
34
+ export declare const I18N_ATTRIBUTE_KEYS: ["defaultLocale", "locales", "uriPattern", "defaultRedirectParams"];
35
35
  export declare const CORE_PROXY_ATTRIBUTE_KEYS: ["origin", "host", "servername"];
36
36
  export declare const STATIC_SITE_GENERATOR_ATTRIBUTE_KEYS: ["outputDir", "skipBaseDocumentGeneration", "skipCleanOutputDir", "_additionalModules", "_additionalRoutePaths"];
37
37
  export declare const ROUTE_ATTRIBUTE_KEYS: ["bootstrap", "subRoutes", "contentTemplate", "id", "cache", "layoutTemplate", "method", "path", "rootComponent", "routeHandler", "properties"];
@@ -52,7 +52,7 @@ export const ROOT_ATTRIBUTE_KEYS = createKeys('root', [
52
52
  export const ASSET_DIR_ATTRIBUTE_KEYS = createKeys('assetDir', ['alias', 'dir', 'urlPath', 'root']);
53
53
  export const ASSET_FILE_ATTRIBUTE_KEYS = createKeys('assetFile', ['alias', 'file', 'urlPath']);
54
54
  export const LOCKER_ATTRIBUTE_KEYS = createKeys('locker', ['enabled', 'trustedComponents']);
55
- export const I18N_ATTRIBUTE_KEYS = createKeys('i18n', ['defaultLocale', 'locales', 'uriPattern']);
55
+ export const I18N_ATTRIBUTE_KEYS = createKeys('i18n', ['defaultLocale', 'locales', 'uriPattern', 'defaultRedirectParams']);
56
56
  export const CORE_PROXY_ATTRIBUTE_KEYS = createKeys('coreProxy', ['origin', 'host', 'servername']);
57
57
  export const STATIC_SITE_GENERATOR_ATTRIBUTE_KEYS = createKeys('staticSiteGenerator', [
58
58
  'outputDir',
@@ -131,6 +131,8 @@ function validateI18NConfig(node, validationContext, preMerge) {
131
131
  validationContext.assertNotEmptyString(defaultLocale, 'i18n.defaultLocale');
132
132
  const localeIds = locales?.children?.map((n) => findNode(n, ['id'])?.value) || [];
133
133
  validationContext.assertDefaultInLocales(node, defaultLocale?.value, localeIds);
134
+ const defaultRedirectParams = findNode(node, ['defaultRedirectParams']);
135
+ validationContext.assertIsObject(defaultRedirectParams, 'i18n.defaultRedirectParams');
134
136
  }
135
137
  }
136
138
  function validateStaticSiteGeneratorConfig(node, validationContext) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.28",
7
+ "version": "0.15.0-alpha.29",
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.15.0-alpha.28",
46
- "@lwrjs/instrumentation": "0.15.0-alpha.28",
47
- "@lwrjs/shared-utils": "0.15.0-alpha.28",
45
+ "@lwrjs/diagnostics": "0.15.0-alpha.29",
46
+ "@lwrjs/instrumentation": "0.15.0-alpha.29",
47
+ "@lwrjs/shared-utils": "0.15.0-alpha.29",
48
48
  "fs-extra": "^11.2.0",
49
49
  "jsonc-parser": "^3.3.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@lwrjs/types": "0.15.0-alpha.28",
52
+ "@lwrjs/types": "0.15.0-alpha.29",
53
53
  "jest": "^26.6.3",
54
54
  "memfs": "^4.13.0",
55
55
  "ts-jest": "^26.5.6"
@@ -71,5 +71,5 @@
71
71
  "volta": {
72
72
  "extends": "../../../package.json"
73
73
  },
74
- "gitHead": "b14e7aab8eee6aa8f1b2a05cad098f9ef65e9ef4"
74
+ "gitHead": "69be18491fa9b68311835d5a957165daf415ea30"
75
75
  }