@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.
@@ -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
- if (typeof process === "undefined") {
129
- return null;
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
- const { tempDirectoryExists, readFile, getEmptyMarkup } = await Promise.resolve().then(() => __importStar(require("./nodeUtils")));
132
- if (!(await tempDirectoryExists())) {
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
- if (typeof process === "undefined") {
99
- return null;
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
- const { tempDirectoryExists, readFile, getEmptyMarkup } = await import("./nodeUtils");
102
- if (!(await tempDirectoryExists())) {
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jam-comments/server-utilities",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "Various JavaScript utilities for JamComments.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",