@epic-web/workshop-app 4.28.4 → 4.28.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/server/index.js +18 -10
- package/build/server/index.js.map +1 -1
- package/dist/server/index.js +4 -2
- package/package.json +3 -3
package/build/server/index.js
CHANGED
|
@@ -961,16 +961,24 @@ async function compileMdx(file, { request, forceFresh } = {}) {
|
|
|
961
961
|
key: cacheLocation
|
|
962
962
|
});
|
|
963
963
|
if (!requireFresh && await checkFileExists$1(cacheLocation)) {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
964
|
+
try {
|
|
965
|
+
const cached = JSON.parse(
|
|
966
|
+
await fs$1.promises.readFile(cacheLocation, "utf-8")
|
|
967
|
+
);
|
|
968
|
+
cachedEmbeddedFiles = new Map(
|
|
969
|
+
Object.entries(cached.value.embeddedFiles ?? {})
|
|
970
|
+
);
|
|
971
|
+
const compiledTime = cached.value.compiledTime ?? 0;
|
|
972
|
+
const warningCancled = process.env.NODE_ENV === "development" ? ((_a2 = cached == null ? void 0 : cached.value) == null ? void 0 : _a2.warningCancled) ?? false : false;
|
|
973
|
+
if (compiledTime > stat.mtimeMs && !warningCancled && await validateEmbeddedFiles(
|
|
974
|
+
cachedEmbeddedFiles.values(),
|
|
975
|
+
compiledTime
|
|
976
|
+
)) {
|
|
977
|
+
return cached.value;
|
|
978
|
+
}
|
|
979
|
+
} catch (error) {
|
|
980
|
+
console.error(`Error reading cached file: ${cacheLocation}`, error);
|
|
981
|
+
void fs$1.promises.unlink(cacheLocation);
|
|
974
982
|
}
|
|
975
983
|
}
|
|
976
984
|
let title = null;
|