@lwrjs/module-bundler 0.13.0-alpha.14 → 0.13.0-alpha.16

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.
@@ -28,6 +28,7 @@ __export(exports, {
28
28
  });
29
29
  var import_amd_common = __toModule(require("./utils/amd-common.cjs"));
30
30
  var import_esbuild_utils = __toModule(require("./utils/esbuild-utils.cjs"));
31
+ var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
31
32
  var AmdBundlerProvider = class {
32
33
  constructor(options, {config, moduleRegistry}) {
33
34
  this.name = "amd-bundle-provider";
@@ -49,6 +50,7 @@ var AmdBundlerProvider = class {
49
50
  } else {
50
51
  bundle.code = await (0, import_esbuild_utils.parseJavascript)(bundle.code, {envMode});
51
52
  }
53
+ bundle.integrity = (0, import_shared_utils.createIntegrityHash)(bundle.code);
52
54
  return bundle;
53
55
  }
54
56
  }
@@ -27,6 +27,7 @@ __export(exports, {
27
27
  default: () => amd_runtime_bundle_provider_default
28
28
  });
29
29
  var import_amd_common = __toModule(require("./utils/amd-common.cjs"));
30
+ var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
30
31
  var AmdBundlerProvider = class {
31
32
  constructor(options, {config, moduleRegistry}) {
32
33
  this.name = "amd-runtime-bundle-provider";
@@ -38,7 +39,11 @@ var AmdBundlerProvider = class {
38
39
  const {moduleRegistry, config} = this;
39
40
  const {minify, debug} = runtimeEnvironment;
40
41
  const minified = minify && !debug;
41
- return await (0, import_amd_common.amdBundler)(moduleId, moduleRegistry, minified, runtimeEnvironment, runtimeParams, config, bundleConfigOverrides);
42
+ const bundle = await (0, import_amd_common.amdBundler)(moduleId, moduleRegistry, minified, runtimeEnvironment, runtimeParams, config, bundleConfigOverrides);
43
+ if (bundle) {
44
+ bundle.integrity = (0, import_shared_utils.createIntegrityHash)(bundle.code);
45
+ }
46
+ return bundle;
42
47
  }
43
48
  }
44
49
  };
@@ -105,6 +105,7 @@ async function esmBundler(moduleId, moduleRegistry, runtimeEnvironment, runtimeP
105
105
  code,
106
106
  config: {external, exclude},
107
107
  map: bundleMap,
108
+ integrity: (0, import_shared_utils.createIntegrityHash)(code),
108
109
  bundleRecord: {
109
110
  imports: Array.from(requiredImports.values()),
110
111
  dynamicImports: Array.from(dynamicImports.values()),
@@ -1,5 +1,6 @@
1
1
  import { amdBundler } from './utils/amd-common.js';
2
2
  import { minifyJavascript, parseJavascript } from './utils/esbuild-utils.js';
3
+ import { createIntegrityHash } from '@lwrjs/shared-utils';
3
4
  export default class AmdBundlerProvider {
4
5
  constructor(options, { config, moduleRegistry }) {
5
6
  this.name = 'amd-bundle-provider';
@@ -20,6 +21,7 @@ export default class AmdBundlerProvider {
20
21
  else {
21
22
  bundle.code = await parseJavascript(bundle.code, { envMode });
22
23
  }
24
+ bundle.integrity = createIntegrityHash(bundle.code);
23
25
  return bundle;
24
26
  }
25
27
  }
@@ -1,4 +1,5 @@
1
1
  import { amdBundler } from './utils/amd-common.js';
2
+ import { createIntegrityHash } from '@lwrjs/shared-utils';
2
3
  export default class AmdBundlerProvider {
3
4
  constructor(options, { config, moduleRegistry }) {
4
5
  this.name = 'amd-runtime-bundle-provider';
@@ -10,8 +11,12 @@ export default class AmdBundlerProvider {
10
11
  const { moduleRegistry, config } = this;
11
12
  const { minify, debug } = runtimeEnvironment;
12
13
  const minified = minify && !debug;
13
- return await amdBundler(moduleId, moduleRegistry, minified, // will minify using rollup/terser if true - MRT runtime friendly
14
+ const bundle = await amdBundler(moduleId, moduleRegistry, minified, // will minify using rollup/terser if true - MRT runtime friendly
14
15
  runtimeEnvironment, runtimeParams, config, bundleConfigOverrides);
16
+ if (bundle) {
17
+ bundle.integrity = createIntegrityHash(bundle.code);
18
+ }
19
+ return bundle;
15
20
  }
16
21
  }
17
22
  }
@@ -3,7 +3,7 @@ import { BundleSpan, getTracer } from '@lwrjs/instrumentation';
3
3
  import { bundleDefinitions } from './utils/rollup-esm-bundler-plugin.js';
4
4
  import { minifyJavascript } from './utils/esbuild-utils.js';
5
5
  import { overrideBundleConfig } from './utils/bundle-common.js';
6
- import { PROTOCOL_HTTP, PROTOCOL_HTTPS } from '@lwrjs/shared-utils';
6
+ import { PROTOCOL_HTTP, PROTOCOL_HTTPS, createIntegrityHash } from '@lwrjs/shared-utils';
7
7
  export default class EsmBundlerProvider {
8
8
  constructor(_options, { config, moduleRegistry }) {
9
9
  this.name = 'esm-bundle-provider';
@@ -79,6 +79,7 @@ async function esmBundler(moduleId, moduleRegistry, runtimeEnvironment, runtimeP
79
79
  code,
80
80
  config: { external, exclude },
81
81
  map: bundleMap,
82
+ integrity: createIntegrityHash(code),
82
83
  bundleRecord: {
83
84
  imports: Array.from(requiredImports.values()),
84
85
  dynamicImports: Array.from(dynamicImports.values()),
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.13.0-alpha.14",
7
+ "version": "0.13.0-alpha.16",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -47,14 +47,14 @@
47
47
  "build/**/*.d.ts"
48
48
  ],
49
49
  "dependencies": {
50
- "@lwrjs/diagnostics": "0.13.0-alpha.14",
51
- "@lwrjs/instrumentation": "0.13.0-alpha.14",
52
- "@lwrjs/shared-utils": "0.13.0-alpha.14",
50
+ "@lwrjs/diagnostics": "0.13.0-alpha.16",
51
+ "@lwrjs/instrumentation": "0.13.0-alpha.16",
52
+ "@lwrjs/shared-utils": "0.13.0-alpha.16",
53
53
  "@rollup/plugin-replace": "^5.0.5",
54
54
  "rollup": "^2.78.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@lwrjs/types": "0.13.0-alpha.14",
57
+ "@lwrjs/types": "0.13.0-alpha.16",
58
58
  "jest": "^26.6.3",
59
59
  "ts-jest": "^26.5.6"
60
60
  },
@@ -70,5 +70,5 @@
70
70
  "volta": {
71
71
  "extends": "../../../package.json"
72
72
  },
73
- "gitHead": "7276973cd522d9117256026fbd35ca12a9032304"
73
+ "gitHead": "5aabb958d70a4a962b207da21e852d7a801d7d44"
74
74
  }