@lwrjs/module-registry 0.10.0-alpha.12 → 0.10.0-alpha.14

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.
@@ -81,8 +81,13 @@ var LwrModuleRegistry = class {
81
81
  }
82
82
  const {bundle, format} = runtimeEnvironment;
83
83
  if (bundle) {
84
+ let bundleId;
85
+ if (format === "amd") {
86
+ const bundleGroups = this.globalConfig?.bundleConfig?.groups;
87
+ bundleId = bundleGroups && (0, import_shared_utils.getGroupName)(moduleId.specifier, bundleGroups);
88
+ }
84
89
  return new Promise((resolve, reject) => {
85
- (0, import_signature.getBundleSignature)(moduleId, this, this.globalConfig?.bundleConfig?.exclude).then((bundleSignature) => resolve((0, import_esm_strategy.default)(moduleId, runtimeEnvironment, runtimeParams, bundleSignature))).catch(reject);
90
+ (0, import_signature.getBundleSignature)(moduleId, this, this.globalConfig?.bundleConfig?.exclude).then((bundleSignature) => resolve((0, import_esm_strategy.default)(moduleId, runtimeEnvironment, runtimeParams, bundleSignature, bundleId))).catch(reject);
86
91
  });
87
92
  } else {
88
93
  return new Promise((resolve, reject) => {
@@ -29,15 +29,15 @@ __export(exports, {
29
29
  var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
30
30
  var SIGNATURE_SIGIL = "s";
31
31
  var LATEST_SIG = "latest";
32
- function linkEsm(moduleId, environment, params = {}, signature) {
32
+ function linkEsm(moduleId, environment, params = {}, signature, bundleId) {
33
33
  const {bundle, debug} = environment;
34
34
  const {specifier, version} = moduleId;
35
- const uriPrefix = (0, import_shared_utils.getModuleUriPrefix)(environment, params);
35
+ const uriPrefix = (0, import_shared_utils.getModuleUriPrefix)(environment, params, bundleId);
36
36
  const vSpecifier = (0, import_shared_utils.getSpecifier)({specifier, version: (0, import_shared_utils.normalizeVersionToUri)(version)});
37
37
  const encodedVSpecifier = encodeURIComponent(vSpecifier);
38
38
  const latestSignature = signature === void 0 || signature === LATEST_SIG;
39
39
  const sigilSignature = latestSignature ? LATEST_SIG : `${SIGNATURE_SIGIL}/${signature}`;
40
- const prettyUrl = (bundle ? "bundle_" : "") + (0, import_shared_utils.prettyModuleUriSuffix)(specifier);
40
+ const prettyUrl = (bundle ? "bundle_" : "") + (0, import_shared_utils.prettyModuleUriSuffix)(bundleId || specifier);
41
41
  const debugModifier = debug ? "?debug=true" : "";
42
42
  return `${uriPrefix}${encodedVSpecifier}/${sigilSignature}/${prettyUrl}.js${debugModifier}`;
43
43
  }
package/build/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LwrUnresolvableError, createSingleDiagnosticError, descriptions } from '@lwrjs/diagnostics';
2
- import { discoverInterchangeableModules, getCacheKeyFromJson, InflightTasks, LATEST_SIGNATURE, ModuleNameType, } from '@lwrjs/shared-utils';
2
+ import { discoverInterchangeableModules, getCacheKeyFromJson, InflightTasks, LATEST_SIGNATURE, ModuleNameType, getGroupName, } from '@lwrjs/shared-utils';
3
3
  // dependencies @locker/compiler and rollup are in this package.json is to satisfy the shared-utils/compiler optional dependencies
4
4
  import { convertToAmd, lockerize } from '@lwrjs/shared-utils/compiler';
5
5
  import { link } from './linker/linker.js';
@@ -60,9 +60,15 @@ export class LwrModuleRegistry {
60
60
  // Else compute the URL from source
61
61
  const { bundle, format } = runtimeEnvironment;
62
62
  if (bundle) {
63
+ let bundleId;
64
+ if (format === 'amd') {
65
+ // bundling groups is only supported in AMD for now
66
+ const bundleGroups = this.globalConfig?.bundleConfig?.groups;
67
+ bundleId = bundleGroups && getGroupName(moduleId.specifier, bundleGroups);
68
+ }
63
69
  return new Promise((resolve, reject) => {
64
70
  getBundleSignature(moduleId, this, this.globalConfig?.bundleConfig?.exclude)
65
- .then((bundleSignature) => resolve(esmLinkingStrategy(moduleId, runtimeEnvironment, runtimeParams, bundleSignature)))
71
+ .then((bundleSignature) => resolve(esmLinkingStrategy(moduleId, runtimeEnvironment, runtimeParams, bundleSignature, bundleId)))
66
72
  .catch(reject);
67
73
  });
68
74
  // For individual files we return a module URL
@@ -12,7 +12,7 @@ interface AmdLinkerConfig {
12
12
  interface EsmLinkerConfig {
13
13
  esmLoaderModule: ModuleEntry;
14
14
  }
15
- export type LinkerConfig = AmdLinkerConfig | EsmLinkerConfig;
15
+ export declare type LinkerConfig = AmdLinkerConfig | EsmLinkerConfig;
16
16
  export interface ModuleLinkResult {
17
17
  id: string;
18
18
  code: string;
@@ -2,5 +2,5 @@ import { RuntimeEnvironment, RuntimeParams, Specifier } from '@lwrjs/types';
2
2
  export default function linkEsm(moduleId: {
3
3
  specifier: Specifier;
4
4
  version: string;
5
- }, environment: RuntimeEnvironment, params?: RuntimeParams, signature?: string): string;
5
+ }, environment: RuntimeEnvironment, params?: RuntimeParams, signature?: string, bundleId?: string): string;
6
6
  //# sourceMappingURL=esm-strategy.d.ts.map
@@ -1,15 +1,15 @@
1
1
  import { getModuleUriPrefix, getSpecifier, normalizeVersionToUri, prettyModuleUriSuffix, } from '@lwrjs/shared-utils';
2
2
  const SIGNATURE_SIGIL = 's';
3
3
  const LATEST_SIG = 'latest';
4
- export default function linkEsm(moduleId, environment, params = {}, signature) {
4
+ export default function linkEsm(moduleId, environment, params = {}, signature, bundleId) {
5
5
  const { bundle, debug } = environment;
6
6
  const { specifier, version } = moduleId;
7
- const uriPrefix = getModuleUriPrefix(environment, params);
7
+ const uriPrefix = getModuleUriPrefix(environment, params, bundleId);
8
8
  const vSpecifier = getSpecifier({ specifier, version: normalizeVersionToUri(version) });
9
9
  const encodedVSpecifier = encodeURIComponent(vSpecifier);
10
10
  const latestSignature = signature === undefined || signature === LATEST_SIG;
11
11
  const sigilSignature = latestSignature ? LATEST_SIG : `${SIGNATURE_SIGIL}/${signature}`;
12
- const prettyUrl = (bundle ? 'bundle_' : '') + prettyModuleUriSuffix(specifier);
12
+ const prettyUrl = (bundle ? 'bundle_' : '') + prettyModuleUriSuffix(bundleId || specifier);
13
13
  const debugModifier = debug ? '?debug=true' : '';
14
14
  return `${uriPrefix}${encodedVSpecifier}/${sigilSignature}/${prettyUrl}.js${debugModifier}`;
15
15
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.10.0-alpha.12",
7
+ "version": "0.10.0-alpha.14",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,18 +30,16 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@locker/compiler": "0.19.0",
34
- "@lwrjs/diagnostics": "0.10.0-alpha.12",
35
- "@lwrjs/shared-utils": "0.10.0-alpha.12",
36
- "es-module-lexer": "^0.3.18",
33
+ "@locker/compiler": "0.19.5",
34
+ "@lwrjs/diagnostics": "0.10.0-alpha.14",
35
+ "@lwrjs/shared-utils": "0.10.0-alpha.14",
37
36
  "rollup": "^2.78.0"
38
37
  },
39
38
  "devDependencies": {
40
- "@lwrjs/types": "0.10.0-alpha.12",
41
- "@types/es-module-lexer": "^0.3.0"
39
+ "@lwrjs/types": "0.10.0-alpha.14"
42
40
  },
43
41
  "engines": {
44
42
  "node": ">=16.0.0 <20"
45
43
  },
46
- "gitHead": "c280f6e4914d67a58cb18a52d2320824c8ed4a7b"
44
+ "gitHead": "f80dc1c18719b77c183f339027313be11d69f9dc"
47
45
  }