@lwrjs/shared-utils 0.13.1 → 0.13.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/urls.cjs +9 -0
- package/build/es/urls.d.ts +1 -0
- package/build/es/urls.js +11 -0
- package/package.json +4 -4
package/build/cjs/urls.cjs
CHANGED
|
@@ -24,6 +24,7 @@ var __toModule = (module2) => {
|
|
|
24
24
|
// packages/@lwrjs/shared-utils/src/urls.ts
|
|
25
25
|
__markAsModule(exports);
|
|
26
26
|
__export(exports, {
|
|
27
|
+
crossEnvFileURL: () => crossEnvFileURL,
|
|
27
28
|
decodeViewPath: () => decodeViewPath,
|
|
28
29
|
extractRequestParams: () => extractRequestParams,
|
|
29
30
|
getClientBootstrapConfigurationRoutes: () => getClientBootstrapConfigurationRoutes,
|
|
@@ -36,6 +37,8 @@ __export(exports, {
|
|
|
36
37
|
});
|
|
37
38
|
var import_path_to_regexp = __toModule(require("path-to-regexp"));
|
|
38
39
|
var import_path = __toModule(require("path"));
|
|
40
|
+
var import_os = __toModule(require("os"));
|
|
41
|
+
var import_url = __toModule(require("url"));
|
|
39
42
|
var CONFIG_SUFFIX = "/config.js";
|
|
40
43
|
var SIGNATURE_SIGIL = "s";
|
|
41
44
|
function getClientBootstrapConfigurationUri(routeInfo, runtimeEnvironment, runtimeParams, signature) {
|
|
@@ -129,3 +132,9 @@ function sortedQueryParamString(query) {
|
|
|
129
132
|
const sortedKeys = keys.sort();
|
|
130
133
|
return "?" + sortedKeys.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`).join("&");
|
|
131
134
|
}
|
|
135
|
+
function crossEnvFileURL(url) {
|
|
136
|
+
if (import_os.default.platform() === "win32" && !url.startsWith("@")) {
|
|
137
|
+
return (0, import_url.pathToFileURL)(url).href;
|
|
138
|
+
}
|
|
139
|
+
return url;
|
|
140
|
+
}
|
package/build/es/urls.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ export declare function getViewUri(routePath: string, basePath: string, locale:
|
|
|
37
37
|
* Returns true is the URI starts with http:// or https://
|
|
38
38
|
*/
|
|
39
39
|
export declare function isURL(uri: string): boolean;
|
|
40
|
+
export declare function crossEnvFileURL(url: string): string;
|
|
40
41
|
//# sourceMappingURL=urls.d.ts.map
|
package/build/es/urls.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { pathToRegexp } from 'path-to-regexp';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import { pathToFileURL } from 'url';
|
|
3
5
|
const CONFIG_SUFFIX = '/config.js';
|
|
4
6
|
const SIGNATURE_SIGIL = 's';
|
|
5
7
|
export function getClientBootstrapConfigurationUri(routeInfo, runtimeEnvironment, runtimeParams, signature) {
|
|
@@ -128,4 +130,13 @@ function sortedQueryParamString(query) {
|
|
|
128
130
|
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)
|
|
129
131
|
.join('&'));
|
|
130
132
|
}
|
|
133
|
+
// Only URLs with a scheme in: file, data, and node are supported by the default ESM loader
|
|
134
|
+
// On Windows, absolute paths must be valid file:// URLs.
|
|
135
|
+
// Without this code for windows, dynamic imports will fail
|
|
136
|
+
export function crossEnvFileURL(url) {
|
|
137
|
+
if (os.platform() === 'win32' && !url.startsWith('@')) {
|
|
138
|
+
return pathToFileURL(url).href;
|
|
139
|
+
}
|
|
140
|
+
return url;
|
|
141
|
+
}
|
|
131
142
|
//# sourceMappingURL=urls.js.map
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.13.
|
|
7
|
+
"version": "0.13.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.13.
|
|
40
|
+
"@lwrjs/diagnostics": "0.13.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,12 +50,12 @@
|
|
|
50
50
|
"slugify": "^1.4.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@lwrjs/types": "0.13.
|
|
53
|
+
"@lwrjs/types": "0.13.3",
|
|
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": "
|
|
60
|
+
"gitHead": "adaedf286df20aed374d9eb07eaf74668084073c"
|
|
61
61
|
}
|