@lwrjs/module-bundler 0.4.4 → 0.5.0
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.
- package/LICENSE +10 -0
- package/build/cjs/index.cjs +9 -4
- package/build/es/amd/amd-bundler.js +2 -2
- package/build/es/esm/rollup-esm-bundler-plugin.js +1 -0
- package/build/es/index.js +10 -5
- package/package.json +5 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
MIT LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
|
+
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/build/cjs/index.cjs
CHANGED
|
@@ -49,9 +49,12 @@ var LwrModuleBundler = class {
|
|
|
49
49
|
minify,
|
|
50
50
|
debug
|
|
51
51
|
})}`;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const cacheDisabled = process.env.NOCACHE === "true";
|
|
53
|
+
if (cacheDisabled === false) {
|
|
54
|
+
if (this.cache.has(cacheKey)) {
|
|
55
|
+
const bundleDef2 = this.cache.get(cacheKey);
|
|
56
|
+
return bundleDef2;
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
if (this.inflightBundleDefinitions.has(cacheKey)) {
|
|
57
60
|
return this.inflightBundleDefinitions.get(cacheKey);
|
|
@@ -59,7 +62,9 @@ var LwrModuleBundler = class {
|
|
|
59
62
|
const bundleDefPromise = format === "amd" ? (0, import_amd_bundler.amdBundler)(moduleId, moduleRegistry, runtimeEnvironment, runtimeParams, this.config) : (0, import_esm_bundler.esmBundler)(moduleId, moduleRegistry, runtimeEnvironment, runtimeParams, this.config.bundleConfig);
|
|
60
63
|
this.inflightBundleDefinitions.set(cacheKey, bundleDefPromise);
|
|
61
64
|
const bundleDef = await bundleDefPromise;
|
|
62
|
-
|
|
65
|
+
if (cacheDisabled === false) {
|
|
66
|
+
this.cache.set(cacheKey, bundleDef);
|
|
67
|
+
}
|
|
63
68
|
this.inflightBundleDefinitions.delete(cacheKey);
|
|
64
69
|
return bundleDef;
|
|
65
70
|
}
|
|
@@ -21,7 +21,7 @@ export async function amdBundler(moduleId, moduleRegistry, runtimeEnvironment, r
|
|
|
21
21
|
},
|
|
22
22
|
}, moduleRegistry, moduleRegistry, runtimeEnvironment, runtimeParams, visited);
|
|
23
23
|
const rootModule = moduleGraphs.graphs[0];
|
|
24
|
-
// type cast to LinkedModuleDefinition
|
|
24
|
+
// type cast to LinkedModuleDefinition because only the moduleRegistry is used
|
|
25
25
|
const rootModuleDef = moduleGraphs.linkedDefinitions[rootModule.specifier];
|
|
26
26
|
const { id, name, namespace, version, specifier } = rootModuleDef;
|
|
27
27
|
// Collect dynamic imports
|
|
@@ -33,7 +33,7 @@ export async function amdBundler(moduleId, moduleRegistry, runtimeEnvironment, r
|
|
|
33
33
|
});
|
|
34
34
|
// Add any dynamic imports from each of the linked static imports in the moduleGraph
|
|
35
35
|
moduleGraphs.graphs[0].static.forEach((m) => {
|
|
36
|
-
// type cast to LinkedModuleDefinition
|
|
36
|
+
// type cast to LinkedModuleDefinition because only the moduleRegistry is used
|
|
37
37
|
const d = moduleGraphs.linkedDefinitions[m];
|
|
38
38
|
// D would be null if excluded from the bundle
|
|
39
39
|
d?.linkedModuleRecord.dynamicImports?.forEach((e) => {
|
|
@@ -63,6 +63,7 @@ export function bundleDefinitions(options) {
|
|
|
63
63
|
// so we take the original instead
|
|
64
64
|
const { namespace, name, version, scope } = refImport;
|
|
65
65
|
const specifier = getSpecifier({ namespace, name });
|
|
66
|
+
// eslint-disable-next-line no-await-in-loop
|
|
66
67
|
refModuleDef = await moduleRegistry.getLinkedModule({
|
|
67
68
|
specifier,
|
|
68
69
|
namespace,
|
package/build/es/index.js
CHANGED
|
@@ -26,10 +26,13 @@ export class LwrModuleBundler {
|
|
|
26
26
|
minify,
|
|
27
27
|
debug,
|
|
28
28
|
})}`;
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const cacheDisabled = process.env.NOCACHE === 'true';
|
|
30
|
+
if (cacheDisabled === false) {
|
|
31
|
+
// Return the cached bundle definition
|
|
32
|
+
if (this.cache.has(cacheKey)) {
|
|
33
|
+
const bundleDef = this.cache.get(cacheKey);
|
|
34
|
+
return bundleDef;
|
|
35
|
+
}
|
|
33
36
|
}
|
|
34
37
|
// Return the inflight bundle definition
|
|
35
38
|
if (this.inflightBundleDefinitions.has(cacheKey)) {
|
|
@@ -41,7 +44,9 @@ export class LwrModuleBundler {
|
|
|
41
44
|
: esmBundler(moduleId, moduleRegistry, runtimeEnvironment, runtimeParams, this.config.bundleConfig);
|
|
42
45
|
this.inflightBundleDefinitions.set(cacheKey, bundleDefPromise);
|
|
43
46
|
const bundleDef = await bundleDefPromise;
|
|
44
|
-
|
|
47
|
+
if (cacheDisabled === false) {
|
|
48
|
+
this.cache.set(cacheKey, bundleDef);
|
|
49
|
+
}
|
|
45
50
|
this.inflightBundleDefinitions.delete(cacheKey);
|
|
46
51
|
return bundleDef;
|
|
47
52
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.5.0",
|
|
8
8
|
"homepage": "https://lwr.dev/",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/shared-utils": "0.
|
|
33
|
+
"@lwrjs/shared-utils": "0.5.0",
|
|
34
34
|
"rollup": "~2.45.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@lwrjs/types": "0.
|
|
37
|
+
"@lwrjs/types": "0.5.0"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=14.15.4 <15"
|
|
41
|
-
}
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "8b46ed1d391c744926ad65b442e5a9f9969d832e"
|
|
42
43
|
}
|