@lwrjs/module-registry 0.8.0-alpha.4 → 0.8.0-alpha.7

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.
@@ -60,7 +60,18 @@ async function getBundleSignature(moduleId, registry, exclude) {
60
60
  return hash.digest("hex");
61
61
  }
62
62
  function getLWCVersion() {
63
- const require2 = (0, import_module.createRequire)(import_path.default.join((0, import_process.cwd)(), "./env-config.js"));
64
- const {version} = require2("lwc/package.json");
65
- return version;
63
+ let lwcVersion;
64
+ try {
65
+ if (LWR?.LWC_VERSION) {
66
+ lwcVersion = LWR.LWC_VERSION;
67
+ }
68
+ } catch (err) {
69
+ }
70
+ if (!lwcVersion) {
71
+ const require2 = (0, import_module.createRequire)(import_path.default.join((0, import_process.cwd)(), "./env-config.js"));
72
+ const {version} = require2("lwc/package.json");
73
+ lwcVersion = version;
74
+ }
75
+ import_shared_utils.logger.debug(`Signature LWC Version: ${lwcVersion}`);
76
+ return lwcVersion;
66
77
  }
@@ -2,7 +2,7 @@ import crypto from 'crypto';
2
2
  import path from 'path';
3
3
  import { cwd } from 'process';
4
4
  import { createRequire } from 'module';
5
- import { getFeatureFlags, getSpecifier } from '@lwrjs/shared-utils';
5
+ import { getFeatureFlags, getSpecifier, logger } from '@lwrjs/shared-utils';
6
6
  const LWC_VERSION = getLWCVersion();
7
7
  const ENABLED_FINGERPRINTS = !getFeatureFlags().LEGACY_LOADER;
8
8
  const ENV_KEY = `LWC:${LWC_VERSION},FINGERPRINTS:${ENABLED_FINGERPRINTS}`;
@@ -60,9 +60,23 @@ export async function getBundleSignature(moduleId, registry, exclude) {
60
60
  * Get the configured LWC version
61
61
  */
62
62
  function getLWCVersion() {
63
- const require = createRequire(path.join(cwd(), './env-config.js'));
64
- // eslint-disable-next-line @typescript-eslint/no-var-requires
65
- const { version } = require('lwc/package.json');
66
- return version;
63
+ let lwcVersion;
64
+ try {
65
+ // check if it is set on the global shim
66
+ if (LWR?.LWC_VERSION) {
67
+ lwcVersion = LWR.LWC_VERSION;
68
+ }
69
+ }
70
+ catch (err) {
71
+ // No-op throws an error in cli when LWR versison not set in global
72
+ }
73
+ if (!lwcVersion) {
74
+ const require = createRequire(path.join(cwd(), './env-config.js'));
75
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
76
+ const { version } = require('lwc/package.json');
77
+ lwcVersion = version;
78
+ }
79
+ logger.debug(`Signature LWC Version: ${lwcVersion}`);
80
+ return lwcVersion;
67
81
  }
68
82
  //# sourceMappingURL=signature.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.8.0-alpha.4",
7
+ "version": "0.8.0-alpha.7",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,18 +30,18 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@lwrjs/diagnostics": "0.8.0-alpha.4",
34
- "@lwrjs/shared-utils": "0.8.0-alpha.4",
33
+ "@lwrjs/diagnostics": "0.8.0-alpha.7",
34
+ "@lwrjs/shared-utils": "0.8.0-alpha.7",
35
35
  "es-module-lexer": "^0.3.18",
36
36
  "ws": "^7.2.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@lwrjs/types": "0.8.0-alpha.4",
39
+ "@lwrjs/types": "0.8.0-alpha.7",
40
40
  "@types/es-module-lexer": "^0.3.0",
41
41
  "@types/ws": "^7.2.4"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=14.15.4 <19"
45
45
  },
46
- "gitHead": "a0cca59d2ab1e7596f03812d00180f898217ce4d"
46
+ "gitHead": "5ce7bdfff149ccdb761e11e6caab11abfffe2c0b"
47
47
  }