@lwrjs/shared-utils 0.13.0-alpha.7 → 0.13.0-alpha.9

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/env.cjs CHANGED
@@ -12,6 +12,8 @@ __export(exports, {
12
12
  REQUEST_DEPTH_KEY: () => REQUEST_DEPTH_KEY,
13
13
  buildEnvironmentContext: () => buildEnvironmentContext,
14
14
  getFeatureFlags: () => getFeatureFlags,
15
+ isLambdaEnv: () => isLambdaEnv,
16
+ isLocalDev: () => isLocalDev,
15
17
  parseRequestDepthHeader: () => parseRequestDepthHeader
16
18
  });
17
19
  function getFeatureFlags() {
@@ -24,6 +26,12 @@ function getFeatureFlags() {
24
26
  LWR_TRACING: process.env.LWR_TRACING !== void 0 && process.env.LWR_TRACING.toLowerCase() !== "off" ? process.env.LWR_TRACING : false
25
27
  };
26
28
  }
29
+ function isLambdaEnv() {
30
+ return process.env.AWS_LAMBDA_FUNCTION_NAME !== void 0;
31
+ }
32
+ function isLocalDev() {
33
+ return process.env.MRT_HMR === "true";
34
+ }
27
35
  function buildEnvironmentContext(runtimeParams) {
28
36
  const basePath = runtimeParams.basePath;
29
37
  const locale = runtimeParams.locale;
package/build/es/env.d.ts CHANGED
@@ -1,5 +1,17 @@
1
1
  import type { EnvironmentContext, FeatureFlags, Headers, RuntimeParams } from '@lwrjs/types';
2
2
  export declare function getFeatureFlags(): FeatureFlags;
3
+ /**
4
+ * This function is used to determine if the current environment is a lambda.
5
+ *
6
+ * @returns true if process is running in lambda environment
7
+ */
8
+ export declare function isLambdaEnv(): boolean;
9
+ /**
10
+ * This function is used to determine if lwr is running in the context of local development.
11
+ *
12
+ * @returns true if running in localdev mode
13
+ */
14
+ export declare function isLocalDev(): boolean;
3
15
  /**
4
16
  * Create a serializable context for the lwr/environment variable
5
17
  */
package/build/es/env.js CHANGED
@@ -30,6 +30,23 @@ export function getFeatureFlags() {
30
30
  : false,
31
31
  };
32
32
  }
33
+ /**
34
+ * This function is used to determine if the current environment is a lambda.
35
+ *
36
+ * @returns true if process is running in lambda environment
37
+ */
38
+ export function isLambdaEnv() {
39
+ return process.env.AWS_LAMBDA_FUNCTION_NAME !== undefined;
40
+ }
41
+ /**
42
+ * This function is used to determine if lwr is running in the context of local development.
43
+ *
44
+ * @returns true if running in localdev mode
45
+ */
46
+ export function isLocalDev() {
47
+ // TODO still need to formalize environment variable names
48
+ return process.env.MRT_HMR === 'true';
49
+ }
33
50
  /**
34
51
  * Create a serializable context for the lwr/environment variable
35
52
  */
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.13.0-alpha.7",
7
+ "version": "0.13.0-alpha.9",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "build/**/*.d.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@lwrjs/diagnostics": "0.13.0-alpha.7",
40
+ "@lwrjs/diagnostics": "0.13.0-alpha.9",
41
41
  "es-module-lexer": "^1.5.2",
42
42
  "fast-json-stable-stringify": "^2.1.0",
43
43
  "magic-string": "^0.30.9",
@@ -50,12 +50,12 @@
50
50
  "slugify": "^1.4.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@lwrjs/types": "0.13.0-alpha.7",
53
+ "@lwrjs/types": "0.13.0-alpha.9",
54
54
  "@types/mime-types": "2.1.4",
55
55
  "@types/path-to-regexp": "^1.7.0"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=18.0.0"
59
59
  },
60
- "gitHead": "4b77dea6ac8d473a4113ad7b345b3a37b0b8a3f8"
60
+ "gitHead": "a2a9e1dbf39a7b04c7a43433e004895b6f4c51a3"
61
61
  }