@lwrjs/static 0.12.0-alpha.21 → 0.12.0-alpha.23
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.
|
@@ -63,8 +63,8 @@ var StaticBundleProvider = class {
|
|
|
63
63
|
return void 0;
|
|
64
64
|
}
|
|
65
65
|
const bundlePath = import_path.default.join(this.siteRootDir, metadata.path);
|
|
66
|
-
const
|
|
67
|
-
const code =
|
|
66
|
+
const isLambda = process.env.AWS_LAMBDA_FUNCTION_NAME !== void 0;
|
|
67
|
+
const code = debug && isLambda ? 'throw new Error("Unexpected code reference");' : (await import_fs_extra.default.readFile(bundlePath)).toString("utf-8");
|
|
68
68
|
const imports = metadata.imports.map((specifier2) => {
|
|
69
69
|
const importModule = (0, import_shared_utils.explodeSpecifier)(specifier2);
|
|
70
70
|
if (!importModule.version) {
|
|
@@ -54,7 +54,8 @@ var StaticResourceProvider = class {
|
|
|
54
54
|
}
|
|
55
55
|
const resourcePath = import_path.default.join(this.siteRootDir, metadata.path);
|
|
56
56
|
const debugResourcePath = debugMetadata ? import_path.default.join(this.siteRootDir, debugMetadata.path) : void 0;
|
|
57
|
-
const
|
|
57
|
+
const isLambda = process.env.AWS_LAMBDA_FUNCTION_NAME !== void 0;
|
|
58
|
+
const useDebug = debug && !isLambda && debugResourcePath;
|
|
58
59
|
const type = metadata.mimeType || (0, import_shared_utils.mimeLookup)(resourcePath) || "application/javascript";
|
|
59
60
|
return {
|
|
60
61
|
type,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from '@lwrjs/diagnostics';
|
|
2
|
-
import { explodeSpecifier, getSpecifier
|
|
2
|
+
import { explodeSpecifier, getSpecifier } 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';
|
|
@@ -34,12 +34,9 @@ export default class StaticBundleProvider {
|
|
|
34
34
|
}
|
|
35
35
|
// Have to make the bundle code available for SSR
|
|
36
36
|
const bundlePath = path.join(this.siteRootDir, metadata.path);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// TODO: remove once SSR_DEBUG is migrated to dev CLI
|
|
41
|
-
!process.env.SSR_DEBUG;
|
|
42
|
-
const code = skipDebugModeCode
|
|
37
|
+
const isLambda = process.env.AWS_LAMBDA_FUNCTION_NAME !== undefined;
|
|
38
|
+
// debug bundles don't exist for SSR when deployed to MRT, so skip them
|
|
39
|
+
const code = debug && isLambda
|
|
43
40
|
? 'throw new Error("Unexpected code reference");'
|
|
44
41
|
: (await fs.readFile(bundlePath)).toString('utf-8');
|
|
45
42
|
const imports = metadata.imports.map((specifier) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from '@lwrjs/diagnostics';
|
|
2
|
-
import { mimeLookup
|
|
2
|
+
import { mimeLookup } from '@lwrjs/shared-utils';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
export default class StaticResourceProvider {
|
|
@@ -28,7 +28,8 @@ export default class StaticResourceProvider {
|
|
|
28
28
|
}
|
|
29
29
|
const resourcePath = path.join(this.siteRootDir, metadata.path);
|
|
30
30
|
const debugResourcePath = debugMetadata ? path.join(this.siteRootDir, debugMetadata.path) : undefined;
|
|
31
|
-
const
|
|
31
|
+
const isLambda = process.env.AWS_LAMBDA_FUNCTION_NAME !== undefined;
|
|
32
|
+
const useDebug = debug && !isLambda && debugResourcePath;
|
|
32
33
|
// Figure out mime type
|
|
33
34
|
const type = metadata.mimeType || mimeLookup(resourcePath) || 'application/javascript';
|
|
34
35
|
return {
|
|
@@ -42,7 +43,7 @@ export default class StaticResourceProvider {
|
|
|
42
43
|
if (useDebug) {
|
|
43
44
|
// use the debug resource if:
|
|
44
45
|
// - debug mode is ON
|
|
45
|
-
// -
|
|
46
|
+
// - isLambda is false
|
|
46
47
|
// - the debug version of the resource exists
|
|
47
48
|
return fs.createReadStream(debugResourcePath);
|
|
48
49
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.12.0-alpha.
|
|
7
|
+
"version": "0.12.0-alpha.23",
|
|
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.12.0-alpha.
|
|
52
|
-
"@lwrjs/shared-utils": "0.12.0-alpha.
|
|
51
|
+
"@lwrjs/diagnostics": "0.12.0-alpha.23",
|
|
52
|
+
"@lwrjs/shared-utils": "0.12.0-alpha.23"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@lwrjs/types": "0.12.0-alpha.
|
|
55
|
+
"@lwrjs/types": "0.12.0-alpha.23",
|
|
56
56
|
"@types/express": "^4.17.21",
|
|
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": "4e300b1ead129a143fd817a7e7a57f14be447754"
|
|
69
69
|
}
|