@lwrjs/module-bundler 0.13.0-alpha.1 → 0.13.0-alpha.10
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.
|
@@ -93,7 +93,7 @@ async function bundle(id, moduleGraphs, minify = false, unVersionedAliases = fal
|
|
|
93
93
|
async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGroupsIncludedModules, dynamicImports, minify, unVersionedAliases, includeId, moduleRegistry, runtimeEnvironment, runtimeParams, visitedSpecifiers) {
|
|
94
94
|
const modules = [rootModule, ...moduleGraphs.graphs[0].static];
|
|
95
95
|
const {moduleRecord} = await moduleRegistry.getModule((0, import_shared_utils.explodeSpecifier)(rootModule), runtimeParams);
|
|
96
|
-
if (moduleRecord.importMeta &&
|
|
96
|
+
if (moduleRecord.importMeta && !(0, import_shared_utils.isLocalDev)()) {
|
|
97
97
|
for (const specifier of modules) {
|
|
98
98
|
const linkedDefinition = moduleGraphs.linkedDefinitions[specifier];
|
|
99
99
|
const imports = linkedDefinition?.linkedModuleRecord.imports || [];
|
|
@@ -116,7 +116,12 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
|
|
|
116
116
|
}
|
|
117
117
|
linkedDefinition.linkedModuleRecord.dynamicImports?.forEach((dynamicImport) => {
|
|
118
118
|
if (dynamicImport.moduleNameType !== "unresolved") {
|
|
119
|
-
|
|
119
|
+
const moduleId = (0, import_shared_utils.explodeSpecifier)(dynamicImport.specifier);
|
|
120
|
+
const importReference = {
|
|
121
|
+
...dynamicImport,
|
|
122
|
+
specifier: moduleId.specifier
|
|
123
|
+
};
|
|
124
|
+
dynamicImports.set((0, import_shared_utils.getSpecifier)(importReference), importReference);
|
|
120
125
|
}
|
|
121
126
|
});
|
|
122
127
|
if (specifier.includes("#")) {
|
|
@@ -167,7 +172,8 @@ async function amdBundler(rootModuleId, moduleRegistry, minify = false, runtimeE
|
|
|
167
172
|
};
|
|
168
173
|
return (0, import_shared_utils.getModuleGraphs)(graphSpecifier, graphOptions, moduleRegistry, moduleRegistry, runtimeEnvironment, runtimeParams);
|
|
169
174
|
};
|
|
170
|
-
const
|
|
175
|
+
const versionedSpecifier = (0, import_shared_utils.getSpecifier)(rootModuleId);
|
|
176
|
+
const moduleGraphs = await getModuleGraphsWrapper(versionedSpecifier);
|
|
171
177
|
const rootModule = moduleGraphs.graphs[0];
|
|
172
178
|
const groupModuleGraphsMap = new Map();
|
|
173
179
|
if (!cachedGroupieCode && groupies && groupies.length) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphDepth, createAmdAlias, explodeSpecifier, getModuleGraphs, getSpecifier, getGroupName, isGroupie, getCacheKeyFromJson, VERSION_NOT_PROVIDED, isExternalSpecifier, PROTOCOL_FILE, } from '@lwrjs/shared-utils';
|
|
1
|
+
import { GraphDepth, createAmdAlias, explodeSpecifier, getModuleGraphs, getSpecifier, getGroupName, isGroupie, getCacheKeyFromJson, VERSION_NOT_PROVIDED, isExternalSpecifier, PROTOCOL_FILE, isLocalDev, } from '@lwrjs/shared-utils';
|
|
2
2
|
import { rollup } from 'rollup';
|
|
3
3
|
import replace from '@rollup/plugin-replace';
|
|
4
4
|
import { BundleSpan, getTracer } from '@lwrjs/instrumentation';
|
|
@@ -81,7 +81,7 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
|
|
|
81
81
|
const { moduleRecord } = await moduleRegistry.getModule(explodeSpecifier(rootModule), runtimeParams);
|
|
82
82
|
// add static imports from the LinkedModuleDefinitions added during module linking
|
|
83
83
|
// they're not in the ModuleGraph imports b/c those are based on raw module source
|
|
84
|
-
if (moduleRecord.importMeta &&
|
|
84
|
+
if (moduleRecord.importMeta && !isLocalDev()) {
|
|
85
85
|
// the only use case for this is "lwr/environment", so skip the logic when it's not needed
|
|
86
86
|
for (const specifier of modules) {
|
|
87
87
|
const linkedDefinition = moduleGraphs.linkedDefinitions[specifier];
|
|
@@ -109,7 +109,13 @@ async function getBundleCode(rootModule, moduleGraphs, includedModules, bundleGr
|
|
|
109
109
|
// add any dynamic imports from each of the linked definitions in the module graph
|
|
110
110
|
linkedDefinition.linkedModuleRecord.dynamicImports?.forEach((dynamicImport) => {
|
|
111
111
|
if (dynamicImport.moduleNameType !== 'unresolved') {
|
|
112
|
-
|
|
112
|
+
// Linked specifiers add a version to them We do not want this in the bundle record specifier
|
|
113
|
+
const moduleId = explodeSpecifier(dynamicImport.specifier);
|
|
114
|
+
const importReference = {
|
|
115
|
+
...dynamicImport,
|
|
116
|
+
specifier: moduleId.specifier,
|
|
117
|
+
};
|
|
118
|
+
dynamicImports.set(getSpecifier(importReference), importReference);
|
|
113
119
|
}
|
|
114
120
|
});
|
|
115
121
|
// skip relative dependencies
|
|
@@ -175,7 +181,8 @@ export async function amdBundler(rootModuleId, moduleRegistry, minify = false, r
|
|
|
175
181
|
};
|
|
176
182
|
return getModuleGraphs(graphSpecifier, graphOptions, moduleRegistry, moduleRegistry, runtimeEnvironment, runtimeParams);
|
|
177
183
|
};
|
|
178
|
-
const
|
|
184
|
+
const versionedSpecifier = getSpecifier(rootModuleId);
|
|
185
|
+
const moduleGraphs = await getModuleGraphsWrapper(versionedSpecifier);
|
|
179
186
|
const rootModule = moduleGraphs.graphs[0];
|
|
180
187
|
// we also need to get moduleGraphs for any group members this module belongs to
|
|
181
188
|
const groupModuleGraphsMap = new Map();
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.13.0-alpha.
|
|
7
|
+
"version": "0.13.0-alpha.10",
|
|
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.
|
|
51
|
-
"@lwrjs/instrumentation": "0.13.0-alpha.
|
|
52
|
-
"@lwrjs/shared-utils": "0.13.0-alpha.
|
|
53
|
-
"@rollup/plugin-replace": "^
|
|
50
|
+
"@lwrjs/diagnostics": "0.13.0-alpha.10",
|
|
51
|
+
"@lwrjs/instrumentation": "0.13.0-alpha.10",
|
|
52
|
+
"@lwrjs/shared-utils": "0.13.0-alpha.10",
|
|
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.
|
|
57
|
+
"@lwrjs/types": "0.13.0-alpha.10",
|
|
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": "
|
|
73
|
+
"gitHead": "53e2a825868b4c9b1662419b531c80be13afd779"
|
|
74
74
|
}
|