@lwrjs/module-registry 0.9.0-alpha.5 → 0.9.0-alpha.6

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.
@@ -27,9 +27,7 @@ __export(exports, {
27
27
  getBundleSignature: () => getBundleSignature
28
28
  });
29
29
  var import_crypto = __toModule(require("crypto"));
30
- var import_path = __toModule(require("path"));
31
- var import_process = __toModule(require("process"));
32
- var import_module = __toModule(require("module"));
30
+ var import_resolve = __toModule(require("resolve"));
33
31
  var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
34
32
  var LWC_VERSION = getLWCVersion();
35
33
  var ENABLED_FINGERPRINTS = !(0, import_shared_utils.getFeatureFlags)().LEGACY_LOADER;
@@ -65,18 +63,7 @@ async function getBundleSignature(moduleId, registry, excludes) {
65
63
  return hash.digest("hex");
66
64
  }
67
65
  function getLWCVersion() {
68
- let lwcVersion;
69
- try {
70
- if (LWR?.LWC_VERSION) {
71
- lwcVersion = LWR.LWC_VERSION;
72
- }
73
- } catch (err) {
74
- }
75
- if (!lwcVersion) {
76
- const require2 = (0, import_module.createRequire)(import_path.default.join((0, import_process.cwd)(), "./env-config.js"));
77
- const {version} = require2("lwc/package.json");
78
- lwcVersion = version;
79
- }
80
- import_shared_utils.logger.debug(`Signature LWC Version: ${lwcVersion}`);
81
- return lwcVersion;
66
+ const packageJsonPath = import_resolve.default.sync(`lwc/package.json`);
67
+ const {version} = JSON.parse((0, import_shared_utils.readFile)(packageJsonPath));
68
+ return version;
82
69
  }
@@ -1,4 +1,4 @@
1
- import { ModuleRegistry, ModuleId } from '@lwrjs/types';
1
+ import type { ModuleRegistry, ModuleId } from '@lwrjs/types';
2
2
  /**
3
3
  * Generate a bundle signature
4
4
  *
@@ -1,8 +1,6 @@
1
1
  import crypto from 'crypto';
2
- import path from 'path';
3
- import { cwd } from 'process';
4
- import { createRequire } from 'module';
5
- import { getFeatureFlags, getSpecifier, logger } from '@lwrjs/shared-utils';
2
+ import resolve from 'resolve';
3
+ import { getFeatureFlags, getSpecifier, readFile } from '@lwrjs/shared-utils';
6
4
  const LWC_VERSION = getLWCVersion();
7
5
  const ENABLED_FINGERPRINTS = !getFeatureFlags().LEGACY_LOADER;
8
6
  const ENV_KEY = `LWC:${LWC_VERSION},FINGERPRINTS:${ENABLED_FINGERPRINTS}`;
@@ -71,23 +69,8 @@ export async function getBundleSignature(moduleId, registry, excludes) {
71
69
  * Get the configured LWC version
72
70
  */
73
71
  function getLWCVersion() {
74
- let lwcVersion;
75
- try {
76
- // check if it is set on the global shim
77
- if (LWR?.LWC_VERSION) {
78
- lwcVersion = LWR.LWC_VERSION;
79
- }
80
- }
81
- catch (err) {
82
- // No-op throws an error in cli when LWR version not set in global
83
- }
84
- if (!lwcVersion) {
85
- const require = createRequire(path.join(cwd(), './env-config.js'));
86
- // eslint-disable-next-line @typescript-eslint/no-var-requires
87
- const { version } = require('lwc/package.json');
88
- lwcVersion = version;
89
- }
90
- logger.debug(`Signature LWC Version: ${lwcVersion}`);
91
- return lwcVersion;
72
+ const packageJsonPath = resolve.sync(`lwc/package.json`);
73
+ const { version } = JSON.parse(readFile(packageJsonPath));
74
+ return version;
92
75
  }
93
76
  //# sourceMappingURL=signature.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.9.0-alpha.5",
7
+ "version": "0.9.0-alpha.6",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -30,16 +30,16 @@
30
30
  "build/**/*.d.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@lwrjs/diagnostics": "0.9.0-alpha.5",
34
- "@lwrjs/shared-utils": "0.9.0-alpha.5",
33
+ "@lwrjs/diagnostics": "0.9.0-alpha.6",
34
+ "@lwrjs/shared-utils": "0.9.0-alpha.6",
35
35
  "es-module-lexer": "^0.3.18"
36
36
  },
37
37
  "devDependencies": {
38
- "@lwrjs/types": "0.9.0-alpha.5",
38
+ "@lwrjs/types": "0.9.0-alpha.6",
39
39
  "@types/es-module-lexer": "^0.3.0"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=14.15.4 <19"
43
43
  },
44
- "gitHead": "6974600380071123ff14c5427d50d9d74bc0805d"
44
+ "gitHead": "c58b9a1249e8fd3e19656be7d75020f005d3a3e6"
45
45
  }