This commit is contained in:
Zef Hemel
2023-01-22 18:53:14 +01:00
parent 5ad804da1c
commit 53bf098579
18 changed files with 226 additions and 140 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ export async function bundle(
}
// Resolve path
filePath = path.join(rootPath, filePath);
def.code = await compile(
filePath,
jsFunctionName,
+4 -2
View File
@@ -51,8 +51,10 @@ export async function compile(
inFile,
`import {${functionName}} from "file://${
// Replacaing \ with / for Windows
path.resolve(filePath).replaceAll("\\", "\\\\")
}";export default ${functionName};`,
path.resolve(filePath).replaceAll(
"\\",
"\\\\",
)}";export default ${functionName};`,
);
}
-1
View File
@@ -135,7 +135,6 @@ import { urlToPathname } from "./util.ts";
const __dirname = urlToPathname(new URL(".", import.meta.url));
Deno.test("Preload dependencies", async () => {
const globalModules = await plugOsBundle(
`${__dirname}../plugs/global.plug.yaml`,
);
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -7,7 +7,9 @@ import { urlToPathname } from "../util.ts";
const fakeCtx = {} as any;
Deno.test("Test FS operations", async () => {
const thisFolder = path.resolve(path.dirname(urlToPathname(new URL(import.meta.url))));
const thisFolder = path.resolve(
path.dirname(urlToPathname(new URL(import.meta.url))),
);
const syscalls = fileSystemSyscalls(thisFolder);
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
fakeCtx,
+1 -1
View File
@@ -9,4 +9,4 @@ export function safeRun(fn: () => Promise<void>) {
export function urlToPathname(url: URL) {
// For Windows, remove prefix /
return url.pathname.replace(/^\/(\w:)/, "$1");
}
}