Skip to content

Commit bcc5b7e

Browse files
committed
toFileUrl -> pathToFileURL
1 parent 21ac0e6 commit bcc5b7e

File tree

5 files changed

+13
-64
lines changed

5 files changed

+13
-64
lines changed

deno.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
},
2121
"imports": {
2222
"@std/media-types": "jsr:@std/media-types@^1.1.0",
23-
"@std/cli/parse-args": "jsr:@std/cli@^1.0.21/parse-args",
24-
"@std/path": "jsr:@std/path@^1.1.1",
2523
"@std/http": "jsr:@std/http@^1.0.19",
2624
"@maverick-js/signals": "npm:@maverick-js/[email protected]",
2725
"ts-blank-space": "npm:[email protected]"

deno.lock

Lines changed: 7 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/fs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const vscodeExtensionFs = typeof document === "object"
1111
/**
1212
* Path separator: `\` on Windows, `/` everywhere else.
1313
*/
14-
export const sep: "/" | "\\" = typeof document === "object" ? "/" : (await import("@std/path")).SEPARATOR;
14+
export const sep: "/" | "\\" = typeof document === "object" ? "/" : (await import("node:path")).sep;
1515

1616
/**
1717
* Read the directory on the local file system and return its files,

src/generator.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ interface GenerateConfig {
2727
*/
2828
export const generate = async (config?: GenerateConfig): Promise<void> => {
2929
const fs = await import("node:fs/promises");
30-
const { dirname, toFileUrl } = await import("@std/path");
30+
const { dirname } = await import("node:path");
31+
const { pathToFileURL } = await import("node:url");
3132

3233
const { outFolder = "generated", pregenerateOnly = false } = config || {};
3334
const pregenerateAll = !pregenerateOnly;
3435

3536
fs.rm(outFolder, { force: true, recursive: true });
3637
try {
3738
for (const route of routes) {
38-
const module = await import(toFileUrl(process.cwd() + route.filePath).toString());
39+
const module = await import(pathToFileURL(process.cwd() + route.filePath).toString());
3940

4041
if (pregenerateAll || module.pregenerate) {
4142
for (const file of await generatePagesForRoute(route, module)) {

src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import process from "node:process";
10-
import { toFileUrl } from "@std/path";
10+
import { pathToFileURL } from "node:url";
1111
import { matchRoute } from "./core/router.ts";
1212

1313
const importRegex = /^import .*\.ts("|')(;)?$/gm;
@@ -58,7 +58,7 @@ const fetch = async (req: Request): Promise<Response> => {
5858
const modulePath = process.cwd() + route.filePath;
5959
const method = req.method.toUpperCase();
6060
console.info(`${method} ${req.url}, loading ${modulePath}`);
61-
const module = await import(toFileUrl(modulePath).toString());
61+
const module = await import(pathToFileURL(modulePath).toString());
6262
const handler = module[method];
6363
if (!handler) {
6464
return new Response(`No function ${method} exported by ${modulePath}`, {

0 commit comments

Comments
 (0)