@lwrjs/static 0.15.0-alpha.26 → 0.15.0-alpha.28
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/build/cjs/providers/static-bundle-provider.cjs +2 -12
- package/build/es/providers/static-bundle-provider.d.ts +2 -0
- package/build/es/providers/static-bundle-provider.js +4 -17
- package/build/es/site-metadata.d.ts +1 -1
- package/build/es/site-metadata.js +1 -1
- package/build/es/utils/decision-tree.d.ts +1 -0
- package/build/es/utils/decision-tree.js +4 -0
- package/package.json +5 -5
|
@@ -60,12 +60,12 @@ var StaticBundleProvider = class {
|
|
|
60
60
|
i18n: {defaultLocale}
|
|
61
61
|
} = runtimeEnvironment;
|
|
62
62
|
const localeId = runtimeParams?.locale || defaultLocale;
|
|
63
|
-
const
|
|
63
|
+
const ssr = runtimeParams?.ssr;
|
|
64
|
+
const metadata = this.getBundleMetadata({moduleId, localeId, debug, ssr});
|
|
64
65
|
if (!metadata) {
|
|
65
66
|
return void 0;
|
|
66
67
|
}
|
|
67
68
|
const bundlePath = import_path.default.join(this.siteRootDir, metadata.path);
|
|
68
|
-
const ssr = runtimeParams?.ssr;
|
|
69
69
|
const resolvedBundlePath = this.getCodePath(bundlePath, debug, specifier, version, localeId, ssr);
|
|
70
70
|
const codePromiser = this.getCodePromiser(resolvedBundlePath, specifier);
|
|
71
71
|
const imports = metadata.imports.map((importSpecifier) => this.getModuleReference(importSpecifier, localeId, debug, false));
|
|
@@ -166,16 +166,6 @@ var StaticBundleProvider = class {
|
|
|
166
166
|
return BUNDLE_SOURCE_NOT_FOUND;
|
|
167
167
|
}
|
|
168
168
|
bundleSourcePath = import_path.default.join(this.siteRootDir, metadata.path);
|
|
169
|
-
} else if (ssr) {
|
|
170
|
-
const metadata = this.getBundleMetadata({
|
|
171
|
-
moduleId: {specifier, version},
|
|
172
|
-
localeId,
|
|
173
|
-
debug,
|
|
174
|
-
ssr
|
|
175
|
-
});
|
|
176
|
-
if (metadata) {
|
|
177
|
-
bundleSourcePath = import_path.default.join(this.siteRootDir, metadata.path);
|
|
178
|
-
}
|
|
179
169
|
}
|
|
180
170
|
return bundleSourcePath;
|
|
181
171
|
}
|
|
@@ -30,7 +30,9 @@ export default class StaticBundleProvider implements BundleProvider {
|
|
|
30
30
|
* @param bundlePath The default path for the bundle for prod read from .metadata/bundle-metadata.json, for debug .metadata/bundle-metadata-debug.json
|
|
31
31
|
* @param debug Is the request in debug mode?
|
|
32
32
|
* @param specifier Root specifier for the requested bundle
|
|
33
|
+
* @param version Root specifier version
|
|
33
34
|
* @param localeId Locale id (e.g. en-US) for the current request
|
|
35
|
+
* @param ssr True if this is a server bundle
|
|
34
36
|
*/
|
|
35
37
|
getCodePath(bundlePath: string, debug: boolean, specifier: string, version: string | undefined, localeId: string, ssr: boolean): string;
|
|
36
38
|
}
|
|
@@ -29,16 +29,14 @@ export default class StaticBundleProvider {
|
|
|
29
29
|
const { specifier, name, namespace, version } = moduleId;
|
|
30
30
|
const { debug, i18n: { defaultLocale }, } = runtimeEnvironment;
|
|
31
31
|
const localeId = (runtimeParams?.locale || defaultLocale);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const metadata = this.getBundleMetadata({ moduleId, localeId, debug, ssr: false });
|
|
32
|
+
const ssr = runtimeParams?.ssr;
|
|
33
|
+
const metadata = this.getBundleMetadata({ moduleId, localeId, debug, ssr });
|
|
35
34
|
if (!metadata) {
|
|
36
35
|
return undefined;
|
|
37
36
|
}
|
|
38
37
|
// Default bundle source path
|
|
39
38
|
const bundlePath = path.join(this.siteRootDir, metadata.path);
|
|
40
39
|
// Get the associated bundle source code
|
|
41
|
-
const ssr = runtimeParams?.ssr;
|
|
42
40
|
const resolvedBundlePath = this.getCodePath(bundlePath, debug, specifier, version, localeId, ssr);
|
|
43
41
|
const codePromiser = this.getCodePromiser(resolvedBundlePath, specifier);
|
|
44
42
|
const imports = metadata.imports.map((importSpecifier) => this.getModuleReference(importSpecifier, localeId, debug, false));
|
|
@@ -135,7 +133,9 @@ export default class StaticBundleProvider {
|
|
|
135
133
|
* @param bundlePath The default path for the bundle for prod read from .metadata/bundle-metadata.json, for debug .metadata/bundle-metadata-debug.json
|
|
136
134
|
* @param debug Is the request in debug mode?
|
|
137
135
|
* @param specifier Root specifier for the requested bundle
|
|
136
|
+
* @param version Root specifier version
|
|
138
137
|
* @param localeId Locale id (e.g. en-US) for the current request
|
|
138
|
+
* @param ssr True if this is a server bundle
|
|
139
139
|
*/
|
|
140
140
|
getCodePath(bundlePath, debug, specifier, version, localeId, ssr) {
|
|
141
141
|
// Flag is used to indicate that we are running on a lambda
|
|
@@ -162,19 +162,6 @@ export default class StaticBundleProvider {
|
|
|
162
162
|
// Overwrite the default source code path the prod source code path
|
|
163
163
|
bundleSourcePath = path.join(this.siteRootDir, metadata.path);
|
|
164
164
|
}
|
|
165
|
-
else if (ssr) {
|
|
166
|
-
// If this is an ssr request get the code preferring bifurcated ssr modules
|
|
167
|
-
const metadata = this.getBundleMetadata({
|
|
168
|
-
moduleId: { specifier, version },
|
|
169
|
-
localeId,
|
|
170
|
-
debug,
|
|
171
|
-
ssr,
|
|
172
|
-
});
|
|
173
|
-
if (metadata) {
|
|
174
|
-
// Overwrite the default source code path the ssr source code path
|
|
175
|
-
bundleSourcePath = path.join(this.siteRootDir, metadata.path);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
165
|
return bundleSourcePath;
|
|
179
166
|
}
|
|
180
167
|
}
|
|
@@ -65,7 +65,7 @@ export declare function parseSiteId(input: string): SiteArtifactId;
|
|
|
65
65
|
*
|
|
66
66
|
* @param moduleId - Root Module Id
|
|
67
67
|
* @param locale - Current locale
|
|
68
|
-
* @param ssr - Component variant is
|
|
68
|
+
* @param ssr - Component variant is required for SSR
|
|
69
69
|
* @returns Site Bundle Identifier
|
|
70
70
|
*/
|
|
71
71
|
export declare function getSiteBundleId({ specifier, namespace, name, version }: Partial<AbstractModuleId>, locale?: string, ssr?: boolean, i18n?: I18NConfig): string;
|
|
@@ -213,7 +213,7 @@ export function parseSiteId(input) {
|
|
|
213
213
|
*
|
|
214
214
|
* @param moduleId - Root Module Id
|
|
215
215
|
* @param locale - Current locale
|
|
216
|
-
* @param ssr - Component variant is
|
|
216
|
+
* @param ssr - Component variant is required for SSR
|
|
217
217
|
* @returns Site Bundle Identifier
|
|
218
218
|
*/
|
|
219
219
|
export function getSiteBundleId({ specifier, namespace, name = '', version }, locale, ssr, i18n) {
|
|
@@ -22,6 +22,7 @@ export default class DecisionTreeImpl<Artifact extends SiteArtifact> implements
|
|
|
22
22
|
* @param version known version or will add the choice ''
|
|
23
23
|
* @param localeId preferred bundle locale or will add '' for default locale
|
|
24
24
|
* @param debug flag if debug bundle is preferred
|
|
25
|
+
* @param ssr flag if server bundle is requested
|
|
25
26
|
*/
|
|
26
27
|
private createArtifactChoices;
|
|
27
28
|
/**
|
|
@@ -127,6 +127,7 @@ export default class DecisionTreeImpl {
|
|
|
127
127
|
* @param version known version or will add the choice ''
|
|
128
128
|
* @param localeId preferred bundle locale or will add '' for default locale
|
|
129
129
|
* @param debug flag if debug bundle is preferred
|
|
130
|
+
* @param ssr flag if server bundle is requested
|
|
130
131
|
*/
|
|
131
132
|
createArtifactChoices({ specifier, version, localeId, debug, ssr }) {
|
|
132
133
|
const envChoice = debug ? CHOICE_DEBUG : CHOICE_PROD;
|
|
@@ -162,6 +163,9 @@ export default class DecisionTreeImpl {
|
|
|
162
163
|
// If there is an ssr sigil always prefer it during SSR
|
|
163
164
|
const ssrChoice = match.variants[SSR_SIGIL] || CHOICE_EMPTY;
|
|
164
165
|
const ssr = ssrChoice ? [ssrChoice, CHOICE_WILDCARD] : [CHOICE_WILDCARD];
|
|
166
|
+
// UPDATE WHEN FULL SERVER BUNDLE METADATA IS AVAILABLE
|
|
167
|
+
// delete the line above and enable the line below
|
|
168
|
+
// const ssr = [ssrChoice];
|
|
165
169
|
const localeChoice = match.variants[LOCALE_SIGIL];
|
|
166
170
|
// If there are no fallbacks, or localeChoice is not in fallbacks use the ['*'] wildcard choice
|
|
167
171
|
const localeId = localeFallbacks?.[localeChoice] ?? [CHOICE_WILDCARD];
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.15.0-alpha.
|
|
7
|
+
"version": "0.15.0-alpha.28",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"build/**/*.d.ts"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@lwrjs/diagnostics": "0.15.0-alpha.
|
|
56
|
-
"@lwrjs/shared-utils": "0.15.0-alpha.
|
|
55
|
+
"@lwrjs/diagnostics": "0.15.0-alpha.28",
|
|
56
|
+
"@lwrjs/shared-utils": "0.15.0-alpha.28",
|
|
57
57
|
"lru-cache": "^10.4.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@lwrjs/types": "0.15.0-alpha.
|
|
60
|
+
"@lwrjs/types": "0.15.0-alpha.28",
|
|
61
61
|
"@types/express": "^4.17.21",
|
|
62
62
|
"jest": "^26.6.3",
|
|
63
63
|
"jest-express": "^1.12.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"volta": {
|
|
72
72
|
"extends": "../../../package.json"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "b14e7aab8eee6aa8f1b2a05cad098f9ef65e9ef4"
|
|
75
75
|
}
|