@lwrjs/static 0.17.2-alpha.29 → 0.17.2-alpha.30
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.
|
@@ -60,7 +60,7 @@ var StaticBundleProvider = class {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
async bundle(moduleId, runtimeEnvironment, runtimeParams) {
|
|
63
|
-
const {specifier,
|
|
63
|
+
const {specifier, version} = moduleId;
|
|
64
64
|
const {
|
|
65
65
|
i18n: {defaultLocale}
|
|
66
66
|
} = runtimeEnvironment;
|
|
@@ -73,6 +73,16 @@ var StaticBundleProvider = class {
|
|
|
73
73
|
if (metadata)
|
|
74
74
|
debug = false;
|
|
75
75
|
}
|
|
76
|
+
if (!metadata && (0, import_shared_utils.isExternalSpecifier)(moduleId.specifier, this.bundleConfig)) {
|
|
77
|
+
const {specifier: unversionedSepcifier} = (0, import_shared_utils.explodeSpecifier)(moduleId.specifier);
|
|
78
|
+
metadata = {
|
|
79
|
+
path: this.bundleConfig?.external?.[unversionedSepcifier],
|
|
80
|
+
imports: [],
|
|
81
|
+
dynamicImports: [],
|
|
82
|
+
version: moduleId.version
|
|
83
|
+
};
|
|
84
|
+
return this.createBundleDefinition(moduleId, metadata, localeId, debug, ssr, async () => "", (0, import_shared_utils.normalizeFromFileURL)(metadata.path, this.siteRootDir) ?? metadata.path);
|
|
85
|
+
}
|
|
76
86
|
if (!metadata) {
|
|
77
87
|
this.logBundleError(moduleId, localeId, debug, ssr);
|
|
78
88
|
return void 0;
|
|
@@ -85,6 +95,10 @@ var StaticBundleProvider = class {
|
|
|
85
95
|
ssr,
|
|
86
96
|
debug
|
|
87
97
|
});
|
|
98
|
+
return this.createBundleDefinition(moduleId, metadata, localeId, debug, ssr, codePromiser, bundlePath);
|
|
99
|
+
}
|
|
100
|
+
async createBundleDefinition(moduleId, metadata, localeId, debug, ssr, codePromiser, bundlePath) {
|
|
101
|
+
const {specifier, name, namespace, version} = moduleId;
|
|
88
102
|
const imports = metadata.imports.map((importSpecifier) => this.getModuleReference(importSpecifier, localeId, debug, false));
|
|
89
103
|
const dynamicImports = metadata.dynamicImports?.map((importSpecifier) => this.getModuleReference(importSpecifier, localeId, debug, false));
|
|
90
104
|
const id = (0, import_shared_utils.getSpecifier)(moduleId);
|
|
@@ -191,9 +205,9 @@ var StaticBundleProvider = class {
|
|
|
191
205
|
const siteDebugBundles = this.siteMetadata.getDebugSiteBundles()?.bundles || {};
|
|
192
206
|
const runtimeBundles = Object.keys(siteBundles).filter((key) => key.startsWith(moduleSpecifier));
|
|
193
207
|
const debugBundles = Object.keys(siteDebugBundles).filter((key) => key.startsWith(moduleSpecifier));
|
|
194
|
-
import_diagnostics.logger.
|
|
195
|
-
message:
|
|
196
|
-
|
|
208
|
+
import_diagnostics.logger.error({
|
|
209
|
+
message: JSON.stringify({
|
|
210
|
+
message: "Failed to find static bundle",
|
|
197
211
|
moduleId,
|
|
198
212
|
localeId,
|
|
199
213
|
debug,
|
|
@@ -204,7 +218,7 @@ var StaticBundleProvider = class {
|
|
|
204
218
|
runtimeBundles,
|
|
205
219
|
totalBundlesCount: Object.keys(siteBundles).length,
|
|
206
220
|
totalDebugBundlesCount: Object.keys(siteDebugBundles).length
|
|
207
|
-
},
|
|
221
|
+
}),
|
|
208
222
|
label: "static-bundle-provider"
|
|
209
223
|
});
|
|
210
224
|
}
|
|
@@ -12,6 +12,7 @@ export default class StaticBundleProvider implements BundleProvider {
|
|
|
12
12
|
bundleCacheSize?: number;
|
|
13
13
|
}, context: ProviderContext);
|
|
14
14
|
bundle<BundleIdentifier extends AbstractModuleId, RE extends RuntimeEnvironment>(moduleId: BundleIdentifier, runtimeEnvironment: RE, runtimeParams: RuntimeParams): Promise<BundleDefinition | undefined>;
|
|
15
|
+
private createBundleDefinition;
|
|
15
16
|
getBundleMetadata({ moduleId, localeId, debug, ssr, }: {
|
|
16
17
|
moduleId: Partial<AbstractModuleId>;
|
|
17
18
|
localeId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from '@lwrjs/diagnostics';
|
|
2
|
-
import { VERSION_SIGIL, explodeSpecifier, getSpecifier, isLambdaEnv } from '@lwrjs/shared-utils';
|
|
2
|
+
import { VERSION_SIGIL, explodeSpecifier, getSpecifier, isExternalSpecifier, isLambdaEnv, normalizeFromFileURL, } from '@lwrjs/shared-utils';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import { LRUCache } from 'lru-cache';
|
|
@@ -34,7 +34,7 @@ export default class StaticBundleProvider {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
async bundle(moduleId, runtimeEnvironment, runtimeParams) {
|
|
37
|
-
const { specifier,
|
|
37
|
+
const { specifier, version } = moduleId;
|
|
38
38
|
const { i18n: { defaultLocale }, } = runtimeEnvironment;
|
|
39
39
|
const localeId = (runtimeParams?.locale || defaultLocale);
|
|
40
40
|
const ssr = runtimeParams?.ssr;
|
|
@@ -48,6 +48,16 @@ export default class StaticBundleProvider {
|
|
|
48
48
|
if (metadata)
|
|
49
49
|
debug = false;
|
|
50
50
|
}
|
|
51
|
+
if (!metadata && isExternalSpecifier(moduleId.specifier, this.bundleConfig)) {
|
|
52
|
+
const { specifier: unversionedSepcifier } = explodeSpecifier(moduleId.specifier);
|
|
53
|
+
metadata = {
|
|
54
|
+
path: this.bundleConfig?.external?.[unversionedSepcifier],
|
|
55
|
+
imports: [],
|
|
56
|
+
dynamicImports: [],
|
|
57
|
+
version: moduleId.version,
|
|
58
|
+
};
|
|
59
|
+
return this.createBundleDefinition(moduleId, metadata, localeId, debug, ssr, async () => '', normalizeFromFileURL(metadata.path, this.siteRootDir) ?? metadata.path);
|
|
60
|
+
}
|
|
51
61
|
if (!metadata) {
|
|
52
62
|
this.logBundleError(moduleId, localeId, debug, ssr);
|
|
53
63
|
return undefined;
|
|
@@ -62,6 +72,10 @@ export default class StaticBundleProvider {
|
|
|
62
72
|
ssr,
|
|
63
73
|
debug,
|
|
64
74
|
});
|
|
75
|
+
return this.createBundleDefinition(moduleId, metadata, localeId, debug, ssr, codePromiser, bundlePath);
|
|
76
|
+
}
|
|
77
|
+
async createBundleDefinition(moduleId, metadata, localeId, debug, ssr, codePromiser, bundlePath) {
|
|
78
|
+
const { specifier, name, namespace, version } = moduleId;
|
|
65
79
|
const imports = metadata.imports.map((importSpecifier) => this.getModuleReference(importSpecifier, localeId, debug, false));
|
|
66
80
|
const dynamicImports = metadata.dynamicImports?.map((importSpecifier) => this.getModuleReference(importSpecifier, localeId, debug, false));
|
|
67
81
|
const id = getSpecifier(moduleId);
|
|
@@ -186,9 +200,9 @@ export default class StaticBundleProvider {
|
|
|
186
200
|
// Extract keys and filter bundles by module specifier
|
|
187
201
|
const runtimeBundles = Object.keys(siteBundles).filter((key) => key.startsWith(moduleSpecifier));
|
|
188
202
|
const debugBundles = Object.keys(siteDebugBundles).filter((key) => key.startsWith(moduleSpecifier));
|
|
189
|
-
logger.
|
|
190
|
-
message:
|
|
191
|
-
|
|
203
|
+
logger.error({
|
|
204
|
+
message: JSON.stringify({
|
|
205
|
+
message: 'Failed to find static bundle',
|
|
192
206
|
moduleId,
|
|
193
207
|
localeId,
|
|
194
208
|
debug,
|
|
@@ -199,7 +213,7 @@ export default class StaticBundleProvider {
|
|
|
199
213
|
runtimeBundles,
|
|
200
214
|
totalBundlesCount: Object.keys(siteBundles).length,
|
|
201
215
|
totalDebugBundlesCount: Object.keys(siteDebugBundles).length,
|
|
202
|
-
},
|
|
216
|
+
}),
|
|
203
217
|
label: 'static-bundle-provider',
|
|
204
218
|
});
|
|
205
219
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.17.2-alpha.
|
|
7
|
+
"version": "0.17.2-alpha.30",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"build/**/*.d.ts"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@lwrjs/diagnostics": "0.17.2-alpha.
|
|
60
|
-
"@lwrjs/instrumentation": "0.17.2-alpha.
|
|
61
|
-
"@lwrjs/shared-utils": "0.17.2-alpha.
|
|
59
|
+
"@lwrjs/diagnostics": "0.17.2-alpha.30",
|
|
60
|
+
"@lwrjs/instrumentation": "0.17.2-alpha.30",
|
|
61
|
+
"@lwrjs/shared-utils": "0.17.2-alpha.30",
|
|
62
62
|
"lru-cache": "^10.4.3"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@lwrjs/types": "0.17.2-alpha.
|
|
65
|
+
"@lwrjs/types": "0.17.2-alpha.30",
|
|
66
66
|
"@types/express": "^4.17.21",
|
|
67
67
|
"jest": "29.7.0",
|
|
68
68
|
"jest-express": "^1.12.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"volta": {
|
|
77
77
|
"extends": "../../../package.json"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "818bbb13d2d4b14d128c4c4f23229c9ce7458a23"
|
|
80
80
|
}
|