@lwrjs/config 0.12.0-alpha.20 → 0.12.0-alpha.22

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.
@@ -67,7 +67,8 @@ var DEFAULT_MODULE_PROVIDERS = [
67
67
  "@lwrjs/router/module-provider",
68
68
  "@lwrjs/lwc-module-provider",
69
69
  "@lwrjs/lwc-ssr/moduleProvider",
70
- "@lwrjs/npm-module-provider"
70
+ "@lwrjs/npm-module-provider",
71
+ "@lwrjs/module-registry/externals-module-provider"
71
72
  ];
72
73
  var DEFAULT_RESOURCE_PROVIDERS = ["@lwrjs/loader"];
73
74
  var DEFAULT_VIEW_PROVIDERS = [
@@ -111,12 +112,12 @@ var DEFAULT_ESM_BUNDLE_EXCLUSIONS = [
111
112
  var DEFAULT_AMD_BUNDLE_EXCLUSIONS = ["lwc", "lwr/navigation"];
112
113
  var DEFAULT_ESM_BUNDLE_EXTERNALS = {};
113
114
  var DEFAULT_AMD_BUNDLE_EXTERNALS = {
114
- "lwr/loader": "lwr-loader-shim.bundle.min.js",
115
- "lwr/profiler": "lwr-loader-shim.bundle.min.js"
115
+ "lwr/loader": `${import_shared_utils.PROTOCOL_LWR}lwr-loader-shim.bundle.min.js`,
116
+ "lwr/profiler": `${import_shared_utils.PROTOCOL_LWR}lwr-loader-shim.bundle.min.js`
116
117
  };
117
118
  var DEFAULT_AMD_LEGACY_BUNDLE_EXTERNALS = {
118
- "lwr/loaderLegacy": "lwr-loader-shim-legacy.bundle.min.js",
119
- "lwr/profiler": "lwr-loader-shim-legacy.bundle.min.js"
119
+ "lwr/loaderLegacy": `${import_shared_utils.PROTOCOL_LWR}lwr-loader-shim-legacy.bundle.min.js`,
120
+ "lwr/profiler": `${import_shared_utils.PROTOCOL_LWR}lwr-loader-shim-legacy.bundle.min.js`
120
121
  };
121
122
  function getDefaultBundleConfig(mode) {
122
123
  const format = (0, import_runtime_config.getServerModeConfig)(mode || MODE).format;
@@ -70,12 +70,21 @@ function mergeConfig(configArg) {
70
70
  if (configFile) {
71
71
  configFile.routes = (configFile?.routes ?? []).concat(import_defaults.DEFAULT_LWR_CONFIG.routes);
72
72
  }
73
+ const bundleConfig = (0, import_merge.mergeBundleConfig)(configFile, configArg);
74
+ if (bundleConfig.external) {
75
+ for (const key of Object.keys(bundleConfig.external)) {
76
+ const path2 = bundleConfig.external[key];
77
+ if ((0, import_shared_utils.isLocalPath)(path2)) {
78
+ bundleConfig.external[key] = (0, import_shared_utils.normalizeToFileUrl)(path2, rootDir);
79
+ }
80
+ }
81
+ }
73
82
  return {
74
83
  ...import_defaults.DEFAULT_LWR_CONFIG,
75
84
  ...configFile,
76
85
  ...configArg,
77
86
  lwc: (0, import_merge.mergeLwcConfig)(configFile, configArg),
78
- bundleConfig: (0, import_merge.mergeBundleConfig)(configFile, configArg),
87
+ bundleConfig,
79
88
  locker: (0, import_merge.mergeLockerConfig)(configFile, configArg),
80
89
  staticSiteGenerator: (0, import_merge.mergeStaticGenerationConfig)(configFile, configArg),
81
90
  rootDir
@@ -143,7 +152,8 @@ function applyStaticProviderConfig(config) {
143
152
  resourceProviders: [["@lwrjs/static/resource-provider", {}]],
144
153
  moduleProviders: [
145
154
  ["@lwrjs/static/module-provider", void 0],
146
- ["@lwrjs/lwc-ssr/moduleProvider", void 0]
155
+ ["@lwrjs/lwc-ssr/moduleProvider", void 0],
156
+ ["@lwrjs/module-registry/externals-module-provider", void 0]
147
157
  ],
148
158
  bundleProviders: [
149
159
  ["@lwrjs/static/bundle-provider", void 0],
@@ -1,4 +1,4 @@
1
- import { DEFAULT_LWR_LOCKER_CONFIG, getFeatureFlags } from '@lwrjs/shared-utils';
1
+ import { DEFAULT_LWR_LOCKER_CONFIG, PROTOCOL_LWR, getFeatureFlags } from '@lwrjs/shared-utils';
2
2
  import { lwrVersion } from '@lwrjs/config/package';
3
3
  import { DEFAULT_I18N_CONFIG, getServerModeConfig } from './runtime-config.js';
4
4
  const PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
@@ -29,6 +29,7 @@ const DEFAULT_MODULE_PROVIDERS = [
29
29
  '@lwrjs/lwc-module-provider',
30
30
  '@lwrjs/lwc-ssr/moduleProvider',
31
31
  '@lwrjs/npm-module-provider',
32
+ '@lwrjs/module-registry/externals-module-provider',
32
33
  ];
33
34
  const DEFAULT_RESOURCE_PROVIDERS = ['@lwrjs/loader'];
34
35
  const DEFAULT_VIEW_PROVIDERS = [
@@ -72,12 +73,12 @@ export const DEFAULT_ESM_BUNDLE_EXCLUSIONS = [
72
73
  export const DEFAULT_AMD_BUNDLE_EXCLUSIONS = ['lwc', 'lwr/navigation'];
73
74
  const DEFAULT_ESM_BUNDLE_EXTERNALS = {};
74
75
  const DEFAULT_AMD_BUNDLE_EXTERNALS = {
75
- 'lwr/loader': 'lwr-loader-shim.bundle.min.js',
76
- 'lwr/profiler': 'lwr-loader-shim.bundle.min.js',
76
+ 'lwr/loader': `${PROTOCOL_LWR}lwr-loader-shim.bundle.min.js`,
77
+ 'lwr/profiler': `${PROTOCOL_LWR}lwr-loader-shim.bundle.min.js`,
77
78
  };
78
79
  const DEFAULT_AMD_LEGACY_BUNDLE_EXTERNALS = {
79
- 'lwr/loaderLegacy': 'lwr-loader-shim-legacy.bundle.min.js',
80
- 'lwr/profiler': 'lwr-loader-shim-legacy.bundle.min.js',
80
+ 'lwr/loaderLegacy': `${PROTOCOL_LWR}lwr-loader-shim-legacy.bundle.min.js`,
81
+ 'lwr/profiler': `${PROTOCOL_LWR}lwr-loader-shim-legacy.bundle.min.js`,
81
82
  };
82
83
  export function getDefaultBundleConfig(mode) {
83
84
  const format = getServerModeConfig(mode || MODE).format;
@@ -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 } from '@lwrjs/shared-utils';
5
+ import { readFile, normalizeDirectory, getFeatureFlags, ASSETS_CACHE_DIR, isLocalPath, normalizeToFileUrl } 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, LWR_VERSION, } from './defaults.js';
7
7
  import { validateLwrAppConfig } from './validation/app-config.js';
8
8
  import { normalizeAssetPaths, normalizeAssets } from './utils/assets.js';
@@ -81,6 +81,17 @@ function mergeConfig(configArg) {
81
81
  if (configFile) {
82
82
  configFile.routes = (configFile?.routes ?? []).concat(DEFAULT_LWR_CONFIG.routes);
83
83
  }
84
+ // Merge the bundle configs
85
+ const bundleConfig = mergeBundleConfig(configFile, configArg);
86
+ // Normalize external file paths to absolute file URLs
87
+ if (bundleConfig.external) {
88
+ for (const key of Object.keys(bundleConfig.external)) {
89
+ const path = bundleConfig.external[key];
90
+ if (isLocalPath(path)) {
91
+ bundleConfig.external[key] = normalizeToFileUrl(path, rootDir);
92
+ }
93
+ }
94
+ }
84
95
  // merge the various configs in order of priority
85
96
  return {
86
97
  ...DEFAULT_LWR_CONFIG,
@@ -88,7 +99,7 @@ function mergeConfig(configArg) {
88
99
  ...configArg,
89
100
  // merge nested configurations
90
101
  lwc: mergeLwcConfig(configFile, configArg),
91
- bundleConfig: mergeBundleConfig(configFile, configArg),
102
+ bundleConfig,
92
103
  locker: mergeLockerConfig(configFile, configArg),
93
104
  staticSiteGenerator: mergeStaticGenerationConfig(configFile, configArg),
94
105
  // root dir set by the config file will be ignored
@@ -190,6 +201,7 @@ export function applyStaticProviderConfig(config) {
190
201
  moduleProviders: [
191
202
  ['@lwrjs/static/module-provider', undefined],
192
203
  ['@lwrjs/lwc-ssr/moduleProvider', undefined],
204
+ ['@lwrjs/module-registry/externals-module-provider', undefined],
193
205
  ],
194
206
  bundleProviders: [
195
207
  ['@lwrjs/static/bundle-provider', undefined],
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.12.0-alpha.20",
7
+ "version": "0.12.0-alpha.22",
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.12.0-alpha.20",
46
- "@lwrjs/instrumentation": "0.12.0-alpha.20",
47
- "@lwrjs/shared-utils": "0.12.0-alpha.20",
45
+ "@lwrjs/diagnostics": "0.12.0-alpha.22",
46
+ "@lwrjs/instrumentation": "0.12.0-alpha.22",
47
+ "@lwrjs/shared-utils": "0.12.0-alpha.22",
48
48
  "fs-extra": "^11.2.0",
49
49
  "jsonc-parser": "^3.0.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@lwrjs/types": "0.12.0-alpha.20",
52
+ "@lwrjs/types": "0.12.0-alpha.22",
53
53
  "jest": "^26.6.3",
54
54
  "ts-jest": "^26.5.6"
55
55
  },
@@ -70,5 +70,5 @@
70
70
  "volta": {
71
71
  "extends": "../../../package.json"
72
72
  },
73
- "gitHead": "ae1793e34eaf4e9b97996d7aea9031908b23a13a"
73
+ "gitHead": "6eb804007e93e513d4eb60fd321c088bad3c698e"
74
74
  }