@lwrjs/static 0.11.0-alpha.13 → 0.11.0-alpha.15
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.
|
@@ -46,7 +46,10 @@ var StaticBundleProvider = class {
|
|
|
46
46
|
}
|
|
47
47
|
async bundle(moduleId, runtimeEnvironment, runtimeParams) {
|
|
48
48
|
const {specifier, name, namespace, version} = moduleId;
|
|
49
|
-
const {
|
|
49
|
+
const {
|
|
50
|
+
debug,
|
|
51
|
+
i18n: {defaultLocale}
|
|
52
|
+
} = runtimeEnvironment;
|
|
50
53
|
const localeId = runtimeParams?.locale || defaultLocale;
|
|
51
54
|
const siteBundles = debug && this.debugSiteBundles ? this.debugSiteBundles : this.siteBundles;
|
|
52
55
|
const metadata = await (0, import_static_utils.getLocalizedBundle)(specifier, siteBundles, localeId, this.i18n);
|
|
@@ -57,7 +60,8 @@ var StaticBundleProvider = class {
|
|
|
57
60
|
return void 0;
|
|
58
61
|
}
|
|
59
62
|
const bundlePath = import_path.default.join(this.siteRootDir, metadata.path);
|
|
60
|
-
const
|
|
63
|
+
const skipDebugModeCode = debug && (0, import_shared_utils.getFeatureFlags)().SSR_STATIC_BUNDLES;
|
|
64
|
+
const code = skipDebugModeCode ? 'throw new Error("Unexpected code reference");' : (await import_fs_extra.default.readFile(bundlePath)).toString("utf-8");
|
|
61
65
|
const imports = metadata.imports.map((specifier2) => {
|
|
62
66
|
const importModule = (0, import_shared_utils.explodeSpecifier)(specifier2);
|
|
63
67
|
if (!importModule.version) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from '@lwrjs/diagnostics';
|
|
2
|
-
import { explodeSpecifier, getSpecifier } from '@lwrjs/shared-utils';
|
|
2
|
+
import { explodeSpecifier, getSpecifier, getFeatureFlags } from '@lwrjs/shared-utils';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import { getLocalizedBundle, resolveStaticBundleVersion } from '../utils/static-utils.js';
|
|
@@ -18,7 +18,7 @@ export default class StaticBundleProvider {
|
|
|
18
18
|
}
|
|
19
19
|
async bundle(moduleId, runtimeEnvironment, runtimeParams) {
|
|
20
20
|
const { specifier, name, namespace, version } = moduleId;
|
|
21
|
-
const { debug, defaultLocale } = runtimeEnvironment;
|
|
21
|
+
const { debug, i18n: { defaultLocale }, } = runtimeEnvironment;
|
|
22
22
|
const localeId = (runtimeParams?.locale || defaultLocale);
|
|
23
23
|
const siteBundles = debug && this.debugSiteBundles ? this.debugSiteBundles : this.siteBundles;
|
|
24
24
|
const metadata = await getLocalizedBundle(specifier, siteBundles, localeId, this.i18n);
|
|
@@ -31,7 +31,11 @@ export default class StaticBundleProvider {
|
|
|
31
31
|
}
|
|
32
32
|
// Have to make the bundle code available for SSR
|
|
33
33
|
const bundlePath = path.join(this.siteRootDir, metadata.path);
|
|
34
|
-
|
|
34
|
+
// workaround: debug bundles don't exist for SSR in this scenario since it's never actually used
|
|
35
|
+
const skipDebugModeCode = debug && getFeatureFlags().SSR_STATIC_BUNDLES;
|
|
36
|
+
const code = skipDebugModeCode
|
|
37
|
+
? 'throw new Error("Unexpected code reference");'
|
|
38
|
+
: (await fs.readFile(bundlePath)).toString('utf-8');
|
|
35
39
|
const imports = metadata.imports.map((specifier) => {
|
|
36
40
|
const importModule = explodeSpecifier(specifier);
|
|
37
41
|
if (!importModule.version) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.11.0-alpha.
|
|
7
|
+
"version": "0.11.0-alpha.15",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"build/**/*.d.ts"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@lwrjs/diagnostics": "0.11.0-alpha.
|
|
52
|
-
"@lwrjs/shared-utils": "0.11.0-alpha.
|
|
51
|
+
"@lwrjs/diagnostics": "0.11.0-alpha.15",
|
|
52
|
+
"@lwrjs/shared-utils": "0.11.0-alpha.15"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@lwrjs/types": "0.11.0-alpha.
|
|
55
|
+
"@lwrjs/types": "0.11.0-alpha.15",
|
|
56
56
|
"@types/express": "^4.17.17",
|
|
57
57
|
"jest": "^26.6.3",
|
|
58
58
|
"jest-express": "^1.12.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"volta": {
|
|
66
66
|
"extends": "../../../package.json"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "3c6c6d17b2f57a5b67d32e40a1e574abb7d9afea"
|
|
69
69
|
}
|