@lwrjs/shared-utils 0.15.5 → 0.15.6
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/index.cjs +1 -0
- package/build/cjs/mrt-utils.cjs +42 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +1 -0
- package/build/es/mrt-utils.d.ts +15 -0
- package/build/es/mrt-utils.js +21 -0
- package/package.json +4 -4
package/build/cjs/index.cjs
CHANGED
|
@@ -38,3 +38,4 @@ __exportStar(exports, __toModule(require("./localization.cjs")));
|
|
|
38
38
|
__exportStar(exports, __toModule(require("./launch.cjs")));
|
|
39
39
|
__exportStar(exports, __toModule(require("./cookie.cjs")));
|
|
40
40
|
__exportStar(exports, __toModule(require("./headers.cjs")));
|
|
41
|
+
__exportStar(exports, __toModule(require("./mrt-utils.cjs")));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, {get: all[name], enumerable: true});
|
|
11
|
+
};
|
|
12
|
+
var __exportStar = (target, module2, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
16
|
+
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toModule = (module2) => {
|
|
21
|
+
return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// packages/@lwrjs/shared-utils/src/mrt-utils.ts
|
|
25
|
+
__markAsModule(exports);
|
|
26
|
+
__export(exports, {
|
|
27
|
+
getMrtArtifactUrl: () => getMrtArtifactUrl,
|
|
28
|
+
getMrtSsgRoot: () => getMrtSsgRoot,
|
|
29
|
+
getSsgAppRelativePath: () => getSsgAppRelativePath
|
|
30
|
+
});
|
|
31
|
+
var import_path = __toModule(require("path"));
|
|
32
|
+
var MRT_BASE_URL = `/mobify/bundle/${process.env.BUNDLE_ID || "development"}/`;
|
|
33
|
+
var DEFAULT_SSG_ROOT = "site";
|
|
34
|
+
function getSsgAppRelativePath(staticSiteGenerator) {
|
|
35
|
+
return staticSiteGenerator?.outputDir || DEFAULT_SSG_ROOT;
|
|
36
|
+
}
|
|
37
|
+
function getMrtArtifactUrl(basePath, ssgRoot, artifactPath = "") {
|
|
38
|
+
return import_path.default.join(basePath, MRT_BASE_URL, ssgRoot, artifactPath);
|
|
39
|
+
}
|
|
40
|
+
function getMrtSsgRoot(staticSiteGenerator) {
|
|
41
|
+
return import_path.default.join(getSsgAppRelativePath(staticSiteGenerator));
|
|
42
|
+
}
|
package/build/es/index.d.ts
CHANGED
package/build/es/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Try to add any code that is mrt specific here so that we can isolate details that would have to be refactored to run lambdas
|
|
3
|
+
* on a different platform
|
|
4
|
+
*/
|
|
5
|
+
import type { StaticSiteGenerator } from '@lwrjs/types';
|
|
6
|
+
export declare function getSsgAppRelativePath(staticSiteGenerator?: StaticSiteGenerator): string;
|
|
7
|
+
/**
|
|
8
|
+
* Get the URL for a artifact given the configured SSG root and the path to the artifact
|
|
9
|
+
*/
|
|
10
|
+
export declare function getMrtArtifactUrl(basePath: string, ssgRoot: string, artifactPath?: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the root directory of the static config in the mrt lambda
|
|
13
|
+
*/
|
|
14
|
+
export declare function getMrtSsgRoot(staticSiteGenerator?: StaticSiteGenerator): string;
|
|
15
|
+
//# sourceMappingURL=mrt-utils.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
// MRT has a specific URL to fetch associated artifacts from the deployed MRT bundle
|
|
3
|
+
const MRT_BASE_URL = `/mobify/bundle/${process.env.BUNDLE_ID || 'development'}/`;
|
|
4
|
+
// Default generated site root if not set in the config
|
|
5
|
+
const DEFAULT_SSG_ROOT = 'site';
|
|
6
|
+
export function getSsgAppRelativePath(staticSiteGenerator) {
|
|
7
|
+
return staticSiteGenerator?.outputDir || DEFAULT_SSG_ROOT;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get the URL for a artifact given the configured SSG root and the path to the artifact
|
|
11
|
+
*/
|
|
12
|
+
export function getMrtArtifactUrl(basePath, ssgRoot, artifactPath = '') {
|
|
13
|
+
return path.join(basePath, MRT_BASE_URL, ssgRoot, artifactPath);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get the root directory of the static config in the mrt lambda
|
|
17
|
+
*/
|
|
18
|
+
export function getMrtSsgRoot(staticSiteGenerator) {
|
|
19
|
+
return path.join(getSsgAppRelativePath(staticSiteGenerator));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=mrt-utils.js.map
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.15.
|
|
7
|
+
"version": "0.15.6",
|
|
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.
|
|
40
|
+
"@lwrjs/diagnostics": "0.15.6",
|
|
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.15.
|
|
53
|
+
"@lwrjs/types": "0.15.6",
|
|
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": "149a9606a77347eb0ba326497f8fcde5c855d5f8"
|
|
62
62
|
}
|