@jam-comments/server-utilities 5.6.0 → 5.7.0
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/dist/cjs/markupFetcher.js +11 -5
- package/dist/esm/markupFetcher.js +11 -5
- package/package.json +1 -1
|
@@ -125,14 +125,20 @@ function markupFetcher(platform, fetchImplementation = fetch) {
|
|
|
125
125
|
return async ({ tz = undefined, path, domain, apiKey, schema, dateFormat, baseUrl = BASE_URL, environment = (0, utils_1.getEnvironment)(), copy = {}, }) => {
|
|
126
126
|
path = path || "/";
|
|
127
127
|
const savedFile = await (async () => {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
try {
|
|
129
|
+
if (typeof process === "undefined") {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const { tempDirectoryExists, readFile, getEmptyMarkup } = await Promise.resolve().then(() => __importStar(require("./nodeUtils")));
|
|
133
|
+
if (!(await tempDirectoryExists())) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return (await readFile(path)) || getEmptyMarkup();
|
|
130
137
|
}
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
catch (e) {
|
|
139
|
+
console.error(e);
|
|
133
140
|
return null;
|
|
134
141
|
}
|
|
135
|
-
return (await readFile(path)) || getEmptyMarkup();
|
|
136
142
|
})();
|
|
137
143
|
const markup = savedFile
|
|
138
144
|
? savedFile
|
|
@@ -95,14 +95,20 @@ export function markupFetcher(platform, fetchImplementation = fetch) {
|
|
|
95
95
|
return async ({ tz = undefined, path, domain, apiKey, schema, dateFormat, baseUrl = BASE_URL, environment = getEnvironment(), copy = {}, }) => {
|
|
96
96
|
path = path || "/";
|
|
97
97
|
const savedFile = await (async () => {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
try {
|
|
99
|
+
if (typeof process === "undefined") {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const { tempDirectoryExists, readFile, getEmptyMarkup } = await import("./nodeUtils");
|
|
103
|
+
if (!(await tempDirectoryExists())) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return (await readFile(path)) || getEmptyMarkup();
|
|
100
107
|
}
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
catch (e) {
|
|
109
|
+
console.error(e);
|
|
103
110
|
return null;
|
|
104
111
|
}
|
|
105
|
-
return (await readFile(path)) || getEmptyMarkup();
|
|
106
112
|
})();
|
|
107
113
|
const markup = savedFile
|
|
108
114
|
? savedFile
|