@lwrjs/module-bundler 0.15.0-alpha.16 → 0.15.0-alpha.18

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.
@@ -45,12 +45,14 @@ var AmdBundlerProvider = class {
45
45
  env: {NODE_ENV: envMode} = {NODE_ENV: "production"}
46
46
  } = runtimeEnvironment;
47
47
  const minified = !!minify && !debug;
48
+ let bundleCode;
48
49
  if (minified) {
49
- bundle.code = await (0, import_esbuild_utils.minifyJavascript)(bundle.code);
50
+ bundleCode = await (0, import_esbuild_utils.minifyJavascript)(await bundle.getCode());
50
51
  } else {
51
- bundle.code = await (0, import_esbuild_utils.parseJavascript)(bundle.code, {envMode});
52
+ bundleCode = await (0, import_esbuild_utils.parseJavascript)(await bundle.getCode(), {envMode});
52
53
  }
53
- bundle.integrity = (0, import_shared_utils.createIntegrityHash)(bundle.code);
54
+ bundle.integrity = (0, import_shared_utils.createIntegrityHash)(bundleCode);
55
+ bundle.getCode = () => Promise.resolve(bundleCode);
54
56
  return bundle;
55
57
  }
56
58
  }
@@ -41,7 +41,7 @@ var AmdBundlerProvider = class {
41
41
  const minified = minify && !debug;
42
42
  const bundle = await (0, import_amd_common.amdBundler)(moduleId, moduleRegistry, minified, runtimeEnvironment, runtimeParams, config, bundleConfigOverrides);
43
43
  if (bundle) {
44
- bundle.integrity = (0, import_shared_utils.createIntegrityHash)(bundle.code);
44
+ bundle.integrity = (0, import_shared_utils.createIntegrityHash)(await bundle.getCode());
45
45
  }
46
46
  return bundle;
47
47
  }
@@ -102,7 +102,7 @@ async function esmBundler(moduleId, moduleRegistry, runtimeEnvironment, runtimeP
102
102
  namespace,
103
103
  name,
104
104
  version,
105
- code,
105
+ getCode: () => Promise.resolve(code),
106
106
  config: {external, exclude},
107
107
  map: bundleMap,
108
108
  integrity: (0, import_shared_utils.createIntegrityHash)(code),
@@ -37,7 +37,7 @@ var LwrModuleBundler = class {
37
37
  this.cache = new import_lru_cache.LRUCache({
38
38
  max: parseInt(process.env.BUNDLE_CACHE_SIZE ?? "500", 10),
39
39
  dispose: (_value, key) => {
40
- import_diagnostics.logger.info(`Bundle evicted from cache: "${key}"`);
40
+ import_diagnostics.logger.verbose(`Bundle evicted from cache: "${key}"`);
41
41
  }
42
42
  });
43
43
  this.providers = [];
@@ -210,13 +210,14 @@ async function amdBundler(rootModuleId, moduleRegistry, minify = false, runtimeE
210
210
  includedModules = cachedBundleGroupCode.includedModules;
211
211
  }
212
212
  const {id, name, namespace, version, specifier} = moduleGraphs.linkedDefinitions[rootModule.specifier];
213
+ const getCode = () => Promise.resolve(bundleCode);
213
214
  return {
214
215
  id,
215
216
  name,
216
217
  namespace,
217
218
  version,
218
219
  specifier,
219
- code: bundleCode,
220
+ getCode,
220
221
  config: {external, exclude},
221
222
  bundleRecord: {
222
223
  imports: Array.from(requiredImports.values()),
@@ -15,13 +15,16 @@ export default class AmdBundlerProvider {
15
15
  // Minification via esbuild for performance
16
16
  const { minify, debug, env: { NODE_ENV: envMode } = { NODE_ENV: 'production' }, } = runtimeEnvironment;
17
17
  const minified = !!minify && !debug;
18
+ let bundleCode;
18
19
  if (minified) {
19
- bundle.code = await minifyJavascript(bundle.code);
20
+ // TODO convert to getCode()
21
+ bundleCode = await minifyJavascript((await bundle.getCode()));
20
22
  }
21
23
  else {
22
- bundle.code = await parseJavascript(bundle.code, { envMode });
24
+ bundleCode = await parseJavascript((await bundle.getCode()), { envMode });
23
25
  }
24
- bundle.integrity = createIntegrityHash(bundle.code);
26
+ bundle.integrity = createIntegrityHash(bundleCode);
27
+ bundle.getCode = () => Promise.resolve(bundleCode);
25
28
  return bundle;
26
29
  }
27
30
  }
@@ -14,7 +14,7 @@ export default class AmdBundlerProvider {
14
14
  const bundle = await amdBundler(moduleId, moduleRegistry, minified, // will minify using rollup/terser if true - MRT runtime friendly
15
15
  runtimeEnvironment, runtimeParams, config, bundleConfigOverrides);
16
16
  if (bundle) {
17
- bundle.integrity = createIntegrityHash(bundle.code);
17
+ bundle.integrity = createIntegrityHash((await bundle.getCode()));
18
18
  }
19
19
  return bundle;
20
20
  }
@@ -76,7 +76,7 @@ async function esmBundler(moduleId, moduleRegistry, runtimeEnvironment, runtimeP
76
76
  namespace,
77
77
  name,
78
78
  version,
79
- code,
79
+ getCode: () => Promise.resolve(code),
80
80
  config: { external, exclude },
81
81
  map: bundleMap,
82
82
  integrity: createIntegrityHash(code),
package/build/es/index.js CHANGED
@@ -9,7 +9,7 @@ export class LwrModuleBundler {
9
9
  this.cache = new LRUCache({
10
10
  max: parseInt(process.env.BUNDLE_CACHE_SIZE ?? '500', 10),
11
11
  dispose: (_value, key) => {
12
- logger.info(`Bundle evicted from cache: "${key}"`);
12
+ logger.verbose(`Bundle evicted from cache: "${key}"`);
13
13
  },
14
14
  });
15
15
  this.providers = [];
@@ -225,13 +225,14 @@ export async function amdBundler(rootModuleId, moduleRegistry, minify = false, r
225
225
  includedModules = cachedBundleGroupCode.includedModules;
226
226
  }
227
227
  const { id, name, namespace, version, specifier } = moduleGraphs.linkedDefinitions[rootModule.specifier];
228
+ const getCode = () => Promise.resolve(bundleCode);
228
229
  return {
229
230
  id,
230
231
  name,
231
232
  namespace,
232
233
  version,
233
234
  specifier,
234
- code: bundleCode,
235
+ getCode,
235
236
  config: { external, exclude },
236
237
  bundleRecord: {
237
238
  imports: Array.from(requiredImports.values()),
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.16",
7
+ "version": "0.15.0-alpha.18",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -47,15 +47,15 @@
47
47
  "build/**/*.d.ts"
48
48
  ],
49
49
  "dependencies": {
50
- "@lwrjs/diagnostics": "0.15.0-alpha.16",
51
- "@lwrjs/instrumentation": "0.15.0-alpha.16",
52
- "@lwrjs/shared-utils": "0.15.0-alpha.16",
50
+ "@lwrjs/diagnostics": "0.15.0-alpha.18",
51
+ "@lwrjs/instrumentation": "0.15.0-alpha.18",
52
+ "@lwrjs/shared-utils": "0.15.0-alpha.18",
53
53
  "@rollup/plugin-replace": "^5.0.7",
54
54
  "lru-cache": "^10.4.3",
55
- "rollup": "^2.78.0"
55
+ "rollup": "^2.79.2"
56
56
  },
57
57
  "devDependencies": {
58
- "@lwrjs/types": "0.15.0-alpha.16",
58
+ "@lwrjs/types": "0.15.0-alpha.18",
59
59
  "jest": "^26.6.3",
60
60
  "ts-jest": "^26.5.6"
61
61
  },
@@ -68,5 +68,5 @@
68
68
  "volta": {
69
69
  "extends": "../../../package.json"
70
70
  },
71
- "gitHead": "7aed7f695758ebce4869f0f3d42c54b057fc4d76"
71
+ "gitHead": "fefc639770948be769b1ace03b7759e7b8906cae"
72
72
  }