Skip to content

Commit

Permalink
[v 0.3.15]: new release of i18n-action
Browse files Browse the repository at this point in the history
  • Loading branch information
inlang-bot committed Jun 19, 2024
1 parent 71024af commit 57da5d4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -59750,10 +59750,17 @@ async function readModuleFromCache(moduleURI, projectPath, readFile) {
const filePath = projectPath + `/cache/modules/${moduleHash}`;
return await tryCatch(async () => await readFile(filePath, { encoding: "utf-8" }));
}
async function writeModuleToCache(moduleURI, moduleContent, projectPath, writeFile) {
async function writeModuleToCache(moduleURI, moduleContent, projectPath, writeFile, mkdir) {
const moduleHash = escape(moduleURI);
const filePath = projectPath + `/cache/modules/${moduleHash}`;
await writeFile(filePath, moduleContent);
try {
await writeFile(filePath, moduleContent);
} catch (e) {
if (!(e instanceof Error) || !e.message.includes("ENONET"))
return;
await mkdir(projectPath + `/cache/modules`, { recursive: true });
await writeFile(filePath, moduleContent);
}
}
function withCache(moduleLoader, projectPath, nodeishFs) {
return async (uri) => {
Expand All @@ -59767,7 +59774,7 @@ function withCache(moduleLoader, projectPath, nodeishFs) {
throw networkResult.error;
} else {
const moduleAsText = networkResult.data;
await writeModuleToCache(uri, moduleAsText, projectPath, nodeishFs.writeFile);
await writeModuleToCache(uri, moduleAsText, projectPath, nodeishFs.writeFile, nodeishFs.mkdir);
return moduleAsText;
}
};
Expand Down

0 comments on commit 57da5d4

Please sign in to comment.