@lwrjs/static 0.12.0-alpha.20 → 0.12.0-alpha.22

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 skipDebugModeCode = debug && (0, import_shared_utils.getFeatureFlags)().SSR_STATIC_BUNDLES;
67
- const code = skipDebugModeCode ? 'throw new Error("Unexpected code reference");' : (await import_fs_extra.default.readFile(bundlePath)).toString("utf-8");
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 useDebug = debug && !(0, import_shared_utils.getFeatureFlags)().SSR_STATIC_BUNDLES && debugResourcePath;
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, getFeatureFlags } from '@lwrjs/shared-utils';
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,9 +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
- // workaround: debug bundles don't exist for SSR in this scenario since it's never actually used
38
- const skipDebugModeCode = debug && getFeatureFlags().SSR_STATIC_BUNDLES;
39
- 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
40
40
  ? 'throw new Error("Unexpected code reference");'
41
41
  : (await fs.readFile(bundlePath)).toString('utf-8');
42
42
  const imports = metadata.imports.map((specifier) => {
@@ -1,5 +1,5 @@
1
1
  import { logger } from '@lwrjs/diagnostics';
2
- import { mimeLookup, getFeatureFlags } from '@lwrjs/shared-utils';
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 useDebug = debug && !getFeatureFlags().SSR_STATIC_BUNDLES && debugResourcePath;
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
- // - SSR_STATIC_BUNDLES is OFF
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.20",
7
+ "version": "0.12.0-alpha.22",
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.20",
52
- "@lwrjs/shared-utils": "0.12.0-alpha.20"
51
+ "@lwrjs/diagnostics": "0.12.0-alpha.22",
52
+ "@lwrjs/shared-utils": "0.12.0-alpha.22"
53
53
  },
54
54
  "devDependencies": {
55
- "@lwrjs/types": "0.12.0-alpha.20",
55
+ "@lwrjs/types": "0.12.0-alpha.22",
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": "ae1793e34eaf4e9b97996d7aea9031908b23a13a"
68
+ "gitHead": "6eb804007e93e513d4eb60fd321c088bad3c698e"
69
69
  }