@lwrjs/core 0.12.0-alpha.26 → 0.12.0-alpha.28

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.
@@ -163,11 +163,11 @@ var SiteGenerator = class {
163
163
  async handleJavascriptResource(url, context, siteConfig, dispatcher) {
164
164
  const {outputDir} = siteConfig;
165
165
  const moduleDefinition = context.fs?.metadata?.moduleDefinition;
166
- const externals = moduleDefinition?.config?.external || {};
166
+ const bundleConfig = moduleDefinition?.config || {};
167
167
  const siteBundles = siteConfig?.siteMetadata?.getSiteBundles()?.bundles;
168
168
  const specifier = moduleDefinition?.specifier;
169
- if (externals && siteBundles && externals[specifier]) {
170
- this.handleExternalBundle(specifier, siteBundles, externals, outputDir);
169
+ if ((0, import_shared_utils.isExternalSpecifier)(specifier, bundleConfig)) {
170
+ this.handleExternalBundle(specifier, siteBundles, bundleConfig.external, outputDir);
171
171
  return;
172
172
  }
173
173
  const normalizedUrl = decodeURIComponent(url);
@@ -185,21 +185,21 @@ var SiteGenerator = class {
185
185
  if (moduleDefinition) {
186
186
  const imports = moduleDefinition.linkedModuleRecord?.imports || moduleDefinition.bundleRecord?.imports || [];
187
187
  for (const importModule of imports) {
188
- const specifier2 = importModule.specifier;
189
- if (externals[specifier2]) {
190
- this.handleExternalBundle(specifier2, siteBundles, externals, outputDir);
188
+ const importSpecifier = importModule.specifier;
189
+ if ((0, import_shared_utils.isExternalSpecifier)(importSpecifier, bundleConfig)) {
190
+ this.handleExternalBundle(importSpecifier, siteBundles, bundleConfig.external, outputDir);
191
191
  } else {
192
- const jsUri = specifier2.startsWith("/") ? specifier2 : (0, import_shared_utils.getSpecifier)(importModule);
192
+ const jsUri = importSpecifier.startsWith("/") ? importSpecifier : (0, import_shared_utils.getSpecifier)(importModule);
193
193
  dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
194
194
  }
195
195
  }
196
196
  const dynamicImports = moduleDefinition.linkedModuleRecord?.dynamicImports || moduleDefinition.bundleRecord?.dynamicImports || [];
197
197
  for (const importModule of dynamicImports) {
198
- const specifier2 = importModule.specifier;
199
- if (externals[specifier2]) {
200
- this.handleExternalBundle(specifier2, siteBundles, externals, outputDir);
198
+ const importSpecifier = importModule.specifier;
199
+ if ((0, import_shared_utils.isExternalSpecifier)(importSpecifier, bundleConfig)) {
200
+ this.handleExternalBundle(importSpecifier, siteBundles, bundleConfig.external, outputDir);
201
201
  } else {
202
- const jsUri = specifier2.startsWith("/") ? specifier2 : (0, import_shared_utils.getSpecifier)(importModule);
202
+ const jsUri = importSpecifier.startsWith("/") ? importSpecifier : (0, import_shared_utils.getSpecifier)(importModule);
203
203
  dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
204
204
  }
205
205
  }
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'perf_hooks';
2
2
  import { logger } from '@lwrjs/diagnostics';
3
- import { getSpecifier, getFeatureFlags, hashContent, isSelfUrl, getModuleUriPrefix, getMappingUriPrefix, isExternalUrl, mimeLookup, getViewUri, sortLocalesByFallback, VERSION_NOT_PROVIDED, PROTOCOL_FILE, normalizeFromFileURL, } from '@lwrjs/shared-utils';
3
+ import { getSpecifier, getFeatureFlags, hashContent, isSelfUrl, getModuleUriPrefix, getMappingUriPrefix, isExternalUrl, mimeLookup, getViewUri, sortLocalesByFallback, VERSION_NOT_PROVIDED, PROTOCOL_FILE, normalizeFromFileURL, isExternalSpecifier, } from '@lwrjs/shared-utils';
4
4
  import { SiteMetadataImpl } from '@lwrjs/static/site-metadata';
5
5
  import { join, dirname, extname, normalize } from 'path';
6
6
  import fs from 'fs-extra';
@@ -200,11 +200,11 @@ export default class SiteGenerator {
200
200
  async handleJavascriptResource(url, context, siteConfig, dispatcher) {
201
201
  const { outputDir } = siteConfig;
202
202
  const moduleDefinition = context.fs?.metadata?.moduleDefinition; // LinkedModuleDefinition | BundleDefinition
203
- const externals = moduleDefinition?.config?.external || {};
203
+ const bundleConfig = moduleDefinition?.config || {};
204
204
  const siteBundles = siteConfig?.siteMetadata?.getSiteBundles()?.bundles;
205
205
  const specifier = moduleDefinition?.specifier;
206
- if (externals && siteBundles && externals[specifier]) {
207
- this.handleExternalBundle(specifier, siteBundles, externals, outputDir);
206
+ if (isExternalSpecifier(specifier, bundleConfig)) {
207
+ this.handleExternalBundle(specifier, siteBundles, bundleConfig.external, outputDir);
208
208
  return;
209
209
  }
210
210
  const normalizedUrl = decodeURIComponent(url);
@@ -237,12 +237,14 @@ export default class SiteGenerator {
237
237
  const imports = moduleDefinition.linkedModuleRecord?.imports || moduleDefinition.bundleRecord?.imports || [];
238
238
  // /1/module/esm/0/l/en-US/mi/lwc
239
239
  for (const importModule of imports) {
240
- const specifier = importModule.specifier;
241
- if (externals[specifier]) {
242
- this.handleExternalBundle(specifier, siteBundles, externals, outputDir);
240
+ const importSpecifier = importModule.specifier;
241
+ if (isExternalSpecifier(importSpecifier, bundleConfig)) {
242
+ this.handleExternalBundle(importSpecifier, siteBundles, bundleConfig.external, outputDir);
243
243
  }
244
244
  else {
245
- const jsUri = specifier.startsWith('/') ? specifier : getSpecifier(importModule);
245
+ const jsUri = importSpecifier.startsWith('/')
246
+ ? importSpecifier
247
+ : getSpecifier(importModule);
246
248
  dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
247
249
  }
248
250
  }
@@ -251,12 +253,14 @@ export default class SiteGenerator {
251
253
  moduleDefinition.bundleRecord?.dynamicImports ||
252
254
  [];
253
255
  for (const importModule of dynamicImports) {
254
- const specifier = importModule.specifier;
255
- if (externals[specifier]) {
256
- this.handleExternalBundle(specifier, siteBundles, externals, outputDir);
256
+ const importSpecifier = importModule.specifier;
257
+ if (isExternalSpecifier(importSpecifier, bundleConfig)) {
258
+ this.handleExternalBundle(importSpecifier, siteBundles, bundleConfig.external, outputDir);
257
259
  }
258
260
  else {
259
- const jsUri = specifier.startsWith('/') ? specifier : getSpecifier(importModule);
261
+ const jsUri = importSpecifier.startsWith('/')
262
+ ? importSpecifier
263
+ : getSpecifier(importModule);
260
264
  dispatchRequests.push(this.dispatchJSResourceRecursive(jsUri, dispatcher, siteConfig));
261
265
  }
262
266
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.12.0-alpha.26",
7
+ "version": "0.12.0-alpha.28",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -43,34 +43,34 @@
43
43
  "build": "tsc -b"
44
44
  },
45
45
  "dependencies": {
46
- "@lwrjs/app-service": "0.12.0-alpha.26",
47
- "@lwrjs/asset-registry": "0.12.0-alpha.26",
48
- "@lwrjs/asset-transformer": "0.12.0-alpha.26",
49
- "@lwrjs/base-view-provider": "0.12.0-alpha.26",
50
- "@lwrjs/base-view-transformer": "0.12.0-alpha.26",
51
- "@lwrjs/client-modules": "0.12.0-alpha.26",
52
- "@lwrjs/config": "0.12.0-alpha.26",
53
- "@lwrjs/diagnostics": "0.12.0-alpha.26",
54
- "@lwrjs/esbuild": "0.12.0-alpha.26",
55
- "@lwrjs/fs-asset-provider": "0.12.0-alpha.26",
56
- "@lwrjs/fs-watch": "0.12.0-alpha.26",
57
- "@lwrjs/html-view-provider": "0.12.0-alpha.26",
58
- "@lwrjs/instrumentation": "0.12.0-alpha.26",
59
- "@lwrjs/loader": "0.12.0-alpha.26",
60
- "@lwrjs/lwc-module-provider": "0.12.0-alpha.26",
61
- "@lwrjs/lwc-ssr": "0.12.0-alpha.26",
62
- "@lwrjs/markdown-view-provider": "0.12.0-alpha.26",
63
- "@lwrjs/module-bundler": "0.12.0-alpha.26",
64
- "@lwrjs/module-registry": "0.12.0-alpha.26",
65
- "@lwrjs/npm-module-provider": "0.12.0-alpha.26",
66
- "@lwrjs/nunjucks-view-provider": "0.12.0-alpha.26",
67
- "@lwrjs/o11y": "0.12.0-alpha.26",
68
- "@lwrjs/resource-registry": "0.12.0-alpha.26",
69
- "@lwrjs/router": "0.12.0-alpha.26",
70
- "@lwrjs/server": "0.12.0-alpha.26",
71
- "@lwrjs/shared-utils": "0.12.0-alpha.26",
72
- "@lwrjs/static": "0.12.0-alpha.26",
73
- "@lwrjs/view-registry": "0.12.0-alpha.26",
46
+ "@lwrjs/app-service": "0.12.0-alpha.28",
47
+ "@lwrjs/asset-registry": "0.12.0-alpha.28",
48
+ "@lwrjs/asset-transformer": "0.12.0-alpha.28",
49
+ "@lwrjs/base-view-provider": "0.12.0-alpha.28",
50
+ "@lwrjs/base-view-transformer": "0.12.0-alpha.28",
51
+ "@lwrjs/client-modules": "0.12.0-alpha.28",
52
+ "@lwrjs/config": "0.12.0-alpha.28",
53
+ "@lwrjs/diagnostics": "0.12.0-alpha.28",
54
+ "@lwrjs/esbuild": "0.12.0-alpha.28",
55
+ "@lwrjs/fs-asset-provider": "0.12.0-alpha.28",
56
+ "@lwrjs/fs-watch": "0.12.0-alpha.28",
57
+ "@lwrjs/html-view-provider": "0.12.0-alpha.28",
58
+ "@lwrjs/instrumentation": "0.12.0-alpha.28",
59
+ "@lwrjs/loader": "0.12.0-alpha.28",
60
+ "@lwrjs/lwc-module-provider": "0.12.0-alpha.28",
61
+ "@lwrjs/lwc-ssr": "0.12.0-alpha.28",
62
+ "@lwrjs/markdown-view-provider": "0.12.0-alpha.28",
63
+ "@lwrjs/module-bundler": "0.12.0-alpha.28",
64
+ "@lwrjs/module-registry": "0.12.0-alpha.28",
65
+ "@lwrjs/npm-module-provider": "0.12.0-alpha.28",
66
+ "@lwrjs/nunjucks-view-provider": "0.12.0-alpha.28",
67
+ "@lwrjs/o11y": "0.12.0-alpha.28",
68
+ "@lwrjs/resource-registry": "0.12.0-alpha.28",
69
+ "@lwrjs/router": "0.12.0-alpha.28",
70
+ "@lwrjs/server": "0.12.0-alpha.28",
71
+ "@lwrjs/shared-utils": "0.12.0-alpha.28",
72
+ "@lwrjs/static": "0.12.0-alpha.28",
73
+ "@lwrjs/view-registry": "0.12.0-alpha.28",
74
74
  "chokidar": "^3.6.0",
75
75
  "esbuild": "^0.9.7",
76
76
  "fs-extra": "^11.2.0",
@@ -80,7 +80,7 @@
80
80
  "ws": "^8.16.0"
81
81
  },
82
82
  "devDependencies": {
83
- "@lwrjs/types": "0.12.0-alpha.26",
83
+ "@lwrjs/types": "0.12.0-alpha.28",
84
84
  "@types/ws": "^8.5.10",
85
85
  "mock-fs": "^5.2.0"
86
86
  },
@@ -93,5 +93,5 @@
93
93
  "volta": {
94
94
  "extends": "../../../package.json"
95
95
  },
96
- "gitHead": "56d2243c9149f1b70f106c43de0c574dcf02734c"
96
+ "gitHead": "5228219171bb2d28a4c7b32f1f6238e396ac3cbd"
97
97
  }