@lwrjs/module-bundler 0.10.0-alpha.16 → 0.10.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.
@@ -35,7 +35,7 @@ var AMD_DEFINE = "LWR.define";
35
35
  var groupieCodeCache = new Map();
36
36
  function includeIdFactory(graphSpecifier, external, exclude = [], requiredImports, groups) {
37
37
  return (moduleRef) => {
38
- if (external[moduleRef.specifier]) {
38
+ if (external[moduleRef.specifier] !== void 0) {
39
39
  return false;
40
40
  }
41
41
  const moduleRefIsGroupie = (0, import_shared_utils.isGroupie)(moduleRef.specifier, groups);
@@ -97,11 +97,6 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
97
97
  }
98
98
  const bundles = (await Promise.all(modules.reduce((filteredModules, specifier) => {
99
99
  const linkedDefinition = moduleGraphs.linkedDefinitions[specifier];
100
- if (visitedSpecifiers?.has(specifier)) {
101
- return filteredModules;
102
- } else {
103
- visitedSpecifiers?.set(specifier, true);
104
- }
105
100
  if (!linkedDefinition) {
106
101
  return filteredModules;
107
102
  }
@@ -117,13 +112,18 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
117
112
  return filteredModules;
118
113
  }, []).map((linkedDefinition) => {
119
114
  const id = (0, import_shared_utils.getSpecifier)(linkedDefinition);
115
+ if (visitedSpecifiers?.has(id)) {
116
+ return false;
117
+ } else {
118
+ visitedSpecifiers?.set(id, true);
119
+ }
120
120
  if (id !== rootModule) {
121
121
  includedModules.push(id);
122
122
  } else {
123
123
  bundleGroupsIncludedModules.push(id);
124
124
  }
125
125
  return bundle(id, moduleGraphs, minify, unVersionedAliases);
126
- }))).filter(Boolean);
126
+ }))).filter((x) => typeof x === "string");
127
127
  return bundles;
128
128
  }
129
129
  async function amdBundler(rootModuleId, moduleRegistry, minify = false, runtimeEnvironment, runtimeParams = {}, {bundleConfig}, bundleConfigOverrides) {
@@ -1,4 +1,4 @@
1
- import { AbstractModuleId, BundleConfigOverrides, BundleDefinition, BundleProvider, ProviderAppConfig, ProviderContext, PublicModuleRegistry, RuntimeEnvironment, RuntimeParams } from '@lwrjs/types';
1
+ import type { AbstractModuleId, BundleConfigOverrides, BundleDefinition, BundleProvider, ProviderAppConfig, ProviderContext, PublicModuleRegistry, RuntimeEnvironment, RuntimeParams } from '@lwrjs/types';
2
2
  export default class AmdBundlerProvider implements BundleProvider {
3
3
  name: string;
4
4
  config: ProviderAppConfig;
@@ -1,4 +1,4 @@
1
- import { AbstractModuleId, BundleConfigOverrides, BundleDefinition, BundleProvider, ProviderAppConfig, ProviderContext, PublicModuleRegistry, RuntimeEnvironment, RuntimeParams } from '@lwrjs/types';
1
+ import type { AbstractModuleId, BundleConfigOverrides, BundleDefinition, BundleProvider, ProviderAppConfig, ProviderContext, PublicModuleRegistry, RuntimeEnvironment, RuntimeParams } from '@lwrjs/types';
2
2
  export default class AmdBundlerProvider implements BundleProvider {
3
3
  name: string;
4
4
  config: ProviderAppConfig;
@@ -1,4 +1,4 @@
1
- import { AbstractModuleId, BundleConfig, BundleConfigOverrides, BundleDefinition, BundleProvider, LwrAppObserver, ModuleBundler, ModuleId, ModuleRegistry, NormalizedLwrGlobalConfig, PublicModuleBundler, RuntimeEnvironment, RuntimeParams, SourceMapRuntimeEnvironment, UriTransformPlugin } from '@lwrjs/types';
1
+ import type { AbstractModuleId, BundleConfig, BundleConfigOverrides, BundleDefinition, BundleProvider, LwrAppObserver, ModuleBundler, ModuleId, ModuleRegistry, NormalizedLwrGlobalConfig, PublicModuleBundler, RuntimeEnvironment, RuntimeParams, SourceMapRuntimeEnvironment, UriTransformPlugin } from '@lwrjs/types';
2
2
  interface LwrModuleBundlerConfig {
3
3
  moduleRegistry: ModuleRegistry;
4
4
  appObserver?: LwrAppObserver;
@@ -9,7 +9,7 @@ function includeIdFactory(graphSpecifier, external, exclude = [], requiredImport
9
9
  return (moduleRef) => {
10
10
  // Do not bundle externals, including the loader module, which is auto bundled
11
11
  // with the shim + loader combo
12
- if (external[moduleRef.specifier]) {
12
+ if (external[moduleRef.specifier] !== undefined) {
13
13
  // Do not include externals in the required imports but also return false to indicate it should not be in the bundle
14
14
  return false;
15
15
  }
@@ -86,12 +86,6 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
86
86
  const bundles = (await Promise.all(modules
87
87
  .reduce((filteredModules, specifier) => {
88
88
  const linkedDefinition = moduleGraphs.linkedDefinitions[specifier];
89
- if (visitedSpecifiers?.has(specifier)) {
90
- return filteredModules;
91
- }
92
- else {
93
- visitedSpecifiers?.set(specifier, true);
94
- }
95
89
  // skip modules that do not have a linked definition
96
90
  if (!linkedDefinition) {
97
91
  return filteredModules;
@@ -112,6 +106,12 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
112
106
  }, [])
113
107
  .map((linkedDefinition) => {
114
108
  const id = getSpecifier(linkedDefinition);
109
+ if (visitedSpecifiers?.has(id)) {
110
+ return false;
111
+ }
112
+ else {
113
+ visitedSpecifiers?.set(id, true);
114
+ }
115
115
  if (id !== rootModule) {
116
116
  includedModules.push(id);
117
117
  }
@@ -121,7 +121,7 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
121
121
  }
122
122
  // bundle all dependencies for the linked definition and convert to AMD
123
123
  return bundle(id, moduleGraphs, minify, unVersionedAliases);
124
- }))).filter(Boolean);
124
+ }))).filter((x) => typeof x === 'string');
125
125
  return bundles;
126
126
  }
127
127
  export async function amdBundler(rootModuleId, moduleRegistry, minify = false, runtimeEnvironment, runtimeParams = {}, { bundleConfig }, bundleConfigOverrides) {
@@ -1,5 +1,5 @@
1
- import { Plugin } from 'rollup';
2
- import { FlattenedModuleGraphs } from '@lwrjs/types';
1
+ import type { Plugin } from 'rollup';
2
+ import type { FlattenedModuleGraphs } from '@lwrjs/types';
3
3
  export interface RollupBundlePluginOptions {
4
4
  moduleGraphs: FlattenedModuleGraphs;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { LinkedModuleDefinition, RuntimeEnvironment, ModuleRegistry, RuntimeParams, BaseModuleReference, BaseDynamicModuleReference } from '@lwrjs/types';
2
- import { Plugin } from 'rollup';
1
+ import type { LinkedModuleDefinition, RuntimeEnvironment, ModuleRegistry, RuntimeParams, BaseModuleReference, BaseDynamicModuleReference } from '@lwrjs/types';
2
+ import type { Plugin } from 'rollup';
3
3
  export interface RollupBundlePluginOptions {
4
4
  rootModuleDef: LinkedModuleDefinition;
5
5
  runtimeEnvironment: RuntimeEnvironment;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.10.0-alpha.16",
7
+ "version": "0.10.0-alpha.18",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -48,15 +48,14 @@
48
48
  ],
49
49
  "dependencies": {
50
50
  "@lwc/features": "2.46.0",
51
- "@lwrjs/shared-utils": "0.10.0-alpha.16",
51
+ "@lwrjs/shared-utils": "0.10.0-alpha.18",
52
52
  "@rollup/plugin-replace": "^2.4.2",
53
53
  "rollup": "^2.78.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@lwrjs/types": "0.10.0-alpha.16",
56
+ "@lwrjs/types": "0.10.0-alpha.18",
57
57
  "jest": "^26.6.3",
58
- "ts-jest": "^26.5.6",
59
- "typescript": "~4.3.5"
58
+ "ts-jest": "^26.5.6"
60
59
  },
61
60
  "optionalDependencies": {
62
61
  "esbuild": "^0.9.7"
@@ -67,5 +66,5 @@
67
66
  "volta": {
68
67
  "extends": "../../../package.json"
69
68
  },
70
- "gitHead": "c5a13d471330c0f738d0c783fd1b69f456c544bd"
69
+ "gitHead": "15d09e9a17b6b070e162336234434d6800b2f32d"
71
70
  }