Skip to content

Commit c2cc1e9

Browse files
committedSep 25, 2024·
refactor: update to jiti 2.0.0
1 parent 24e8c47 commit c2cc1e9

File tree

3 files changed

+48
-44
lines changed

3 files changed

+48
-44
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"defu": "^6.1.4",
4242
"dotenv": "^16.4.5",
4343
"giget": "^1.2.3",
44-
"jiti": "2.0.0-beta.3",
44+
"jiti": "^2.0.0",
4545
"mlly": "^1.7.1",
4646
"ohash": "^1.1.4",
4747
"pathe": "^1.1.2",

‎pnpm-lock.yaml

+44-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/loader.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { readFile, rm } from "node:fs/promises";
33
import { homedir } from "node:os";
44
import { resolve, extname, dirname, basename, join } from "pathe";
55
import { createJiti } from "jiti";
6+
import { fileURLToPath } from "mlly";
67
import * as rc9 from "rc9";
78
import { defu } from "defu";
89
import { hash } from "ohash";
@@ -344,11 +345,8 @@ async function resolveConfig<
344345

345346
// Util to try resolving a module
346347
const tryResolve = (id: string) => {
347-
try {
348-
return options.jiti!.esmResolve(id, { try: true });
349-
} catch {
350-
// Ignore errors
351-
}
348+
const resolved = options.jiti!.esmResolve(id, { try: true });
349+
return resolved ? fileURLToPath(resolved) : undefined;
352350
};
353351

354352
// Try resolving as npm package

0 commit comments

Comments
 (0)