@lwrjs/shared-utils 0.16.2 → 0.16.3
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 +8 -0
- package/build/cjs/launch.cjs +1 -1
- package/build/es/env.d.ts +12 -0
- package/build/es/env.js +16 -0
- package/build/es/launch.js +1 -1
- package/package.json +4 -4
package/build/cjs/env.cjs
CHANGED
|
@@ -13,7 +13,9 @@ __export(exports, {
|
|
|
13
13
|
buildEnvironmentContext: () => buildEnvironmentContext,
|
|
14
14
|
getFeatureFlags: () => getFeatureFlags,
|
|
15
15
|
isLambdaEnv: () => isLambdaEnv,
|
|
16
|
+
isLocalAuthEnabled: () => isLocalAuthEnabled,
|
|
16
17
|
isLocalDev: () => isLocalDev,
|
|
18
|
+
isLocalPreview: () => isLocalPreview,
|
|
17
19
|
parseRequestDepth: () => parseRequestDepth
|
|
18
20
|
});
|
|
19
21
|
if (getFeatureFlags().REEVALUATE_MODULES && !getFeatureFlags().LEGACY_LOADER) {
|
|
@@ -53,6 +55,12 @@ function isLambdaEnv() {
|
|
|
53
55
|
function isLocalDev() {
|
|
54
56
|
return process.env.MRT_HMR === "true";
|
|
55
57
|
}
|
|
58
|
+
function isLocalPreview() {
|
|
59
|
+
return process.env.LOCAL_PREVIEW_MODE === "true";
|
|
60
|
+
}
|
|
61
|
+
function isLocalAuthEnabled() {
|
|
62
|
+
return process.env.AUTH_TOKEN !== void 0;
|
|
63
|
+
}
|
|
56
64
|
function buildEnvironmentContext(runtimeParams) {
|
|
57
65
|
const basePath = runtimeParams.basePath;
|
|
58
66
|
const locale = runtimeParams.locale;
|
package/build/cjs/launch.cjs
CHANGED
|
@@ -41,7 +41,7 @@ async function launch(port, https, path) {
|
|
|
41
41
|
}
|
|
42
42
|
const finalPath = path ? path.startsWith("/") ? path : `/${path}` : "";
|
|
43
43
|
const protocol = https ? "https" : "http";
|
|
44
|
-
const url = `${protocol}://localhost:${port}${finalPath}
|
|
44
|
+
const url = `${protocol}://localhost:${port}${finalPath}/`;
|
|
45
45
|
exec(`${cmd} ${url}`);
|
|
46
46
|
return url;
|
|
47
47
|
}
|
package/build/es/env.d.ts
CHANGED
|
@@ -12,6 +12,18 @@ export declare function isLambdaEnv(): boolean;
|
|
|
12
12
|
* @returns true if running in localdev mode
|
|
13
13
|
*/
|
|
14
14
|
export declare function isLocalDev(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* This function is used to determine if lwr is running in the context of local preview.
|
|
17
|
+
*
|
|
18
|
+
* @returns true if running in preview mode
|
|
19
|
+
*/
|
|
20
|
+
export declare function isLocalPreview(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* This function is used to determine if lwr is running with an authenticated context locally
|
|
23
|
+
*
|
|
24
|
+
* @returns true if local dev/preview authentication is enabled
|
|
25
|
+
*/
|
|
26
|
+
export declare function isLocalAuthEnabled(): boolean;
|
|
15
27
|
/**
|
|
16
28
|
* Create a serializable context for user-land exposed environment variables
|
|
17
29
|
*/
|
package/build/es/env.js
CHANGED
|
@@ -72,6 +72,22 @@ export function isLocalDev() {
|
|
|
72
72
|
// TODO still need to formalize environment variable names
|
|
73
73
|
return process.env.MRT_HMR === 'true';
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* This function is used to determine if lwr is running in the context of local preview.
|
|
77
|
+
*
|
|
78
|
+
* @returns true if running in preview mode
|
|
79
|
+
*/
|
|
80
|
+
export function isLocalPreview() {
|
|
81
|
+
return process.env.LOCAL_PREVIEW_MODE === 'true';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* This function is used to determine if lwr is running with an authenticated context locally
|
|
85
|
+
*
|
|
86
|
+
* @returns true if local dev/preview authentication is enabled
|
|
87
|
+
*/
|
|
88
|
+
export function isLocalAuthEnabled() {
|
|
89
|
+
return process.env.AUTH_TOKEN !== undefined;
|
|
90
|
+
}
|
|
75
91
|
/**
|
|
76
92
|
* Create a serializable context for user-land exposed environment variables
|
|
77
93
|
*/
|
package/build/es/launch.js
CHANGED
|
@@ -22,7 +22,7 @@ export async function launch(port, https, path) {
|
|
|
22
22
|
// Ensure the path begins with '/' if provided
|
|
23
23
|
const finalPath = path ? (path.startsWith('/') ? path : `/${path}`) : '';
|
|
24
24
|
const protocol = https ? 'https' : 'http';
|
|
25
|
-
const url = `${protocol}://localhost:${port}${finalPath}
|
|
25
|
+
const url = `${protocol}://localhost:${port}${finalPath}/`;
|
|
26
26
|
exec(`${cmd} ${url}`);
|
|
27
27
|
return url;
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.16.
|
|
7
|
+
"version": "0.16.3",
|
|
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.16.
|
|
40
|
+
"@lwrjs/diagnostics": "0.16.3",
|
|
41
41
|
"es-module-lexer": "^1.5.4",
|
|
42
42
|
"fast-json-stable-stringify": "^2.1.0",
|
|
43
43
|
"magic-string": "^0.30.9",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"slugify": "^1.4.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@lwrjs/types": "0.16.
|
|
53
|
+
"@lwrjs/types": "0.16.3",
|
|
54
54
|
"@types/mime-types": "2.1.4",
|
|
55
55
|
"@types/path-to-regexp": "^1.7.0",
|
|
56
56
|
"memfs": "^4.13.0"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=18.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "91bc46c88ff7201851f02fc4a3d38d39e81885c6"
|
|
62
62
|
}
|