From 26174ab9f9d5719d0f09ff8e4c781f235a7c2b3f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 20 Sep 2024 13:02:42 +0100 Subject: [PATCH 1/2] fix: handle global URL instance mismatch --- lib/jiti-native.mjs | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jiti-native.mjs b/lib/jiti-native.mjs index 6113be24..8e21c375 100644 --- a/lib/jiti-native.mjs +++ b/lib/jiti-native.mjs @@ -111,7 +111,7 @@ function normalizeParentURL(input) { if (!input) { return "file:///"; } - if (input instanceof URL || input.startsWith("file://")) { + if (typeof filename !== 'string' || input.startsWith("file://")) { return input; } if (input.endsWith("/")) { diff --git a/src/utils.ts b/src/utils.ts index ca398a16..27ec8fc8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -8,7 +8,7 @@ import type { Context } from "./types"; import { gray, green, blue, yellow, cyan, red } from "yoctocolors"; export function isDir(filename: string | URL): boolean { - if (filename instanceof URL || filename.startsWith("file://")) { + if (typeof filename !== 'string' || filename.startsWith("file://")) { return false; } try { From ada86a36cfab190fe176792dbac3f56c0184d5c8 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 12:22:37 +0000 Subject: [PATCH 2/2] chore: apply automated lint fixes --- lib/jiti-native.mjs | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jiti-native.mjs b/lib/jiti-native.mjs index 8e21c375..f8e16468 100644 --- a/lib/jiti-native.mjs +++ b/lib/jiti-native.mjs @@ -111,7 +111,7 @@ function normalizeParentURL(input) { if (!input) { return "file:///"; } - if (typeof filename !== 'string' || input.startsWith("file://")) { + if (typeof filename !== "string" || input.startsWith("file://")) { return input; } if (input.endsWith("/")) { diff --git a/src/utils.ts b/src/utils.ts index 27ec8fc8..6acc8f21 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -8,7 +8,7 @@ import type { Context } from "./types"; import { gray, green, blue, yellow, cyan, red } from "yoctocolors"; export function isDir(filename: string | URL): boolean { - if (typeof filename !== 'string' || filename.startsWith("file://")) { + if (typeof filename !== "string" || filename.startsWith("file://")) { return false; } try {