@lwrjs/shared-utils 0.15.0-alpha.2 → 0.15.0-alpha.20

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.
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, {get: all[name], enumerable: true});
6
+ };
7
+
8
+ // packages/@lwrjs/shared-utils/src/cookie.ts
9
+ __markAsModule(exports);
10
+ __export(exports, {
11
+ cookieStringToObject: () => cookieStringToObject
12
+ });
13
+ function cookieStringToObject(cookieString) {
14
+ return cookieString.split(";").reduce((cookies, cookie) => {
15
+ const [name, value] = cookie.trim().split("=");
16
+ if (name && value) {
17
+ cookies[name] = decodeURIComponent(value);
18
+ }
19
+ return cookies;
20
+ }, {});
21
+ }
package/build/cjs/env.cjs CHANGED
@@ -14,7 +14,7 @@ __export(exports, {
14
14
  getFeatureFlags: () => getFeatureFlags,
15
15
  isLambdaEnv: () => isLambdaEnv,
16
16
  isLocalDev: () => isLocalDev,
17
- parseRequestDepthHeader: () => parseRequestDepthHeader
17
+ parseRequestDepth: () => parseRequestDepth
18
18
  });
19
19
  if (getFeatureFlags().REEVALUATE_MODULES && !getFeatureFlags().LEGACY_LOADER) {
20
20
  throw new Error("REEVALUATE_MODULES is only supported with LEGACY_LOADER");
@@ -30,7 +30,8 @@ function getFeatureFlags() {
30
30
  ENABLE_NONCE: process.env.ENABLE_NONCE !== void 0 && process.env.ENABLE_NONCE.toLowerCase() === "true" ? true : false,
31
31
  SINGLE_RENDER_MODE: process.env.SINGLE_RENDER_MODE !== void 0 && process.env.SINGLE_RENDER_MODE.toLowerCase() === "true" ? true : false,
32
32
  REEVALUATE_MODULES: process.env.REEVALUATE_MODULES !== void 0 && process.env.REEVALUATE_MODULES.toLowerCase() === "true" ? true : false,
33
- MAX_VIEW_CACHE_TTL: process.env.MAX_VIEW_CACHE_TTL
33
+ MAX_VIEW_CACHE_TTL: process.env.MAX_VIEW_CACHE_TTL,
34
+ SSR_LOADER_PER_REQUEST: process.env.SSR_LOADER_PER_REQUEST !== void 0 && process.env.SSR_LOADER_PER_REQUEST.toLowerCase() === "true" ? true : false
34
35
  };
35
36
  }
36
37
  function isLambdaEnv() {
@@ -53,7 +54,7 @@ function buildEnvironmentContext(runtimeParams) {
53
54
  }
54
55
  var REQUEST_DEPTH_HEADER = "X-SFDC-Request-Depth";
55
56
  var REQUEST_DEPTH_KEY = REQUEST_DEPTH_HEADER.toLowerCase();
56
- function parseRequestDepthHeader(headers = {}) {
57
+ function parseRequestDepth(headers = {}, query = {}) {
57
58
  let maxDepth = 0;
58
59
  const value = headers && headers[REQUEST_DEPTH_KEY];
59
60
  if (value) {
@@ -73,5 +74,11 @@ function parseRequestDepthHeader(headers = {}) {
73
74
  }
74
75
  }
75
76
  }
77
+ if (query[REQUEST_DEPTH_KEY]) {
78
+ const queryValue = parseInt(query[REQUEST_DEPTH_KEY], 10);
79
+ if (!isNaN(queryValue) && queryValue > maxDepth) {
80
+ maxDepth = queryValue;
81
+ }
82
+ }
76
83
  return maxDepth;
77
84
  }
@@ -33,6 +33,7 @@ __export(exports, {
33
33
  IMMUTABLE_ASSET_PREFIX: () => IMMUTABLE_ASSET_PREFIX,
34
34
  LATEST_SIGNATURE: () => LATEST_SIGNATURE,
35
35
  LOCALE_SIGIL: () => LOCALE_SIGIL,
36
+ SSR_SIGIL: () => SSR_SIGIL,
36
37
  VERSION_NOT_PROVIDED: () => VERSION_NOT_PROVIDED,
37
38
  VERSION_PREFIX: () => VERSION_PREFIX,
38
39
  VERSION_SIGIL: () => VERSION_SIGIL,
@@ -69,6 +70,7 @@ var DEFAULT_TITLE = "LWR App";
69
70
  var IMMUTABLE_ASSET_PREFIX = "/_immutable/";
70
71
  var ASSETS_CACHE_DIR = "assetsCache";
71
72
  var VERSION_NOT_PROVIDED = "version-not-provided";
73
+ var SSR_SIGIL = "ssr";
72
74
  var DEFAULT_LOCKER_TRUSTED_CMP = ["@locker/*", "lwr/*", "@lwrjs/*", "lwc", "@lwc/*"];
73
75
  var DEFAULT_LWR_LOCKER_CONFIG = {
74
76
  enabled: false,
@@ -36,3 +36,4 @@ __exportStar(exports, __toModule(require("./lwr-app-observer.cjs")));
36
36
  __exportStar(exports, __toModule(require("./bundle.cjs")));
37
37
  __exportStar(exports, __toModule(require("./localization.cjs")));
38
38
  __exportStar(exports, __toModule(require("./launch.cjs")));
39
+ __exportStar(exports, __toModule(require("./cookie.cjs")));
@@ -0,0 +1,2 @@
1
+ export declare function cookieStringToObject(cookieString: string): Record<string, string>;
2
+ //# sourceMappingURL=cookie.d.ts.map
@@ -0,0 +1,10 @@
1
+ export function cookieStringToObject(cookieString) {
2
+ return cookieString.split(';').reduce((cookies, cookie) => {
3
+ const [name, value] = cookie.trim().split('=');
4
+ if (name && value) {
5
+ cookies[name] = decodeURIComponent(value);
6
+ }
7
+ return cookies;
8
+ }, {});
9
+ }
10
+ //# sourceMappingURL=cookie.js.map
package/build/es/env.d.ts CHANGED
@@ -18,5 +18,5 @@ export declare function isLocalDev(): boolean;
18
18
  export declare function buildEnvironmentContext(runtimeParams: RuntimeParams): EnvironmentContext;
19
19
  export declare const REQUEST_DEPTH_HEADER = "X-SFDC-Request-Depth";
20
20
  export declare const REQUEST_DEPTH_KEY: string;
21
- export declare function parseRequestDepthHeader(headers?: Headers): number;
21
+ export declare function parseRequestDepth(headers?: Headers, query?: Record<string, string>): number;
22
22
  //# sourceMappingURL=env.d.ts.map
package/build/es/env.js CHANGED
@@ -45,6 +45,11 @@ export function getFeatureFlags() {
45
45
  ? true
46
46
  : false,
47
47
  MAX_VIEW_CACHE_TTL: process.env.MAX_VIEW_CACHE_TTL,
48
+ // Create a new SSR Loader on every request
49
+ SSR_LOADER_PER_REQUEST: process.env.SSR_LOADER_PER_REQUEST !== undefined &&
50
+ process.env.SSR_LOADER_PER_REQUEST.toLowerCase() === 'true'
51
+ ? true
52
+ : false,
48
53
  };
49
54
  }
50
55
  /**
@@ -85,7 +90,7 @@ export function buildEnvironmentContext(runtimeParams) {
85
90
  }
86
91
  export const REQUEST_DEPTH_HEADER = 'X-SFDC-Request-Depth';
87
92
  export const REQUEST_DEPTH_KEY = REQUEST_DEPTH_HEADER.toLowerCase();
88
- export function parseRequestDepthHeader(headers = {}) {
93
+ export function parseRequestDepth(headers = {}, query = {}) {
89
94
  let maxDepth = 0;
90
95
  const value = headers && headers[REQUEST_DEPTH_KEY];
91
96
  if (value) {
@@ -106,6 +111,12 @@ export function parseRequestDepthHeader(headers = {}) {
106
111
  }
107
112
  }
108
113
  }
114
+ if (query[REQUEST_DEPTH_KEY]) {
115
+ const queryValue = parseInt(query[REQUEST_DEPTH_KEY], 10);
116
+ if (!isNaN(queryValue) && queryValue > maxDepth) {
117
+ maxDepth = queryValue;
118
+ }
119
+ }
109
120
  return maxDepth;
110
121
  }
111
122
  //# sourceMappingURL=env.js.map
@@ -10,6 +10,7 @@ export declare const DEFAULT_TITLE = "LWR App";
10
10
  export declare const IMMUTABLE_ASSET_PREFIX = "/_immutable/";
11
11
  export declare const ASSETS_CACHE_DIR = "assetsCache";
12
12
  export declare const VERSION_NOT_PROVIDED = "version-not-provided";
13
+ export declare const SSR_SIGIL = "ssr";
13
14
  export declare const DEFAULT_LOCKER_TRUSTED_CMP: string[];
14
15
  export declare const DEFAULT_LWR_LOCKER_CONFIG: {
15
16
  enabled: boolean;
@@ -10,6 +10,7 @@ export const DEFAULT_TITLE = 'LWR App';
10
10
  export const IMMUTABLE_ASSET_PREFIX = '/_immutable/';
11
11
  export const ASSETS_CACHE_DIR = 'assetsCache';
12
12
  export const VERSION_NOT_PROVIDED = 'version-not-provided';
13
+ export const SSR_SIGIL = 'ssr';
13
14
  // Locker trusted components
14
15
  export const DEFAULT_LOCKER_TRUSTED_CMP = ['@locker/*', 'lwr/*', '@lwrjs/*', 'lwc', '@lwc/*'];
15
16
  export const DEFAULT_LWR_LOCKER_CONFIG = {
@@ -15,4 +15,5 @@ export * from './lwr-app-observer.js';
15
15
  export * from './bundle.js';
16
16
  export * from './localization.js';
17
17
  export * from './launch.js';
18
+ export * from './cookie.js';
18
19
  //# sourceMappingURL=index.d.ts.map
package/build/es/index.js CHANGED
@@ -15,4 +15,5 @@ export * from './lwr-app-observer.js';
15
15
  export * from './bundle.js';
16
16
  export * from './localization.js';
17
17
  export * from './launch.js';
18
+ export * from './cookie.js';
18
19
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.15.0-alpha.2",
7
+ "version": "0.15.0-alpha.20",
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.15.0-alpha.2",
40
+ "@lwrjs/diagnostics": "0.15.0-alpha.20",
41
41
  "es-module-lexer": "^1.5.4",
42
42
  "fast-json-stable-stringify": "^2.1.0",
43
43
  "magic-string": "^0.30.9",
@@ -46,11 +46,11 @@
46
46
  "parse5-sax-parser": "^6.0.1",
47
47
  "path-to-regexp": "^6.2.2",
48
48
  "resolve": "^1.22.8",
49
- "rollup": "^2.78.0",
49
+ "rollup": "^2.79.2",
50
50
  "slugify": "^1.4.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@lwrjs/types": "0.15.0-alpha.2",
53
+ "@lwrjs/types": "0.15.0-alpha.20",
54
54
  "@types/mime-types": "2.1.4",
55
55
  "@types/path-to-regexp": "^1.7.0",
56
56
  "memfs": "^4.9.3"
@@ -58,5 +58,5 @@
58
58
  "engines": {
59
59
  "node": ">=18.0.0"
60
60
  },
61
- "gitHead": "58fda4341e2aa0f571a63d83f4aa59865e6a54bd"
61
+ "gitHead": "112ed1a3472b68a90c6884422137006a5dcf032c"
62
62
  }