Skip to content

Commit 35d9f92

Browse files
committed
feat: add a new bun?: boolean option
1 parent ca17abb commit 35d9f92

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,13 @@ export const resolve = (
6060
resolver?: ResolverFactory | null,
6161
// eslint-disable-next-line sonarjs/cognitive-complexity
6262
): ResolvedResult => {
63+
options ||= {}
64+
6365
// don't worry about core node/bun modules
6466
if (
6567
module.isBuiltin(source) ||
66-
isBunModule(source, process.versions.bun as Version)
68+
((process.versions.bun || options.bun) &&
69+
isBunModule(source, process.versions.bun as Version))
6770
) {
6871
log('matched core:', source)
6972

@@ -84,8 +87,6 @@ export const resolve = (
8487

8588
source = removeQuerystring(source)
8689

87-
options ||= {}
88-
8990
if (!resolver) {
9091
const optionsHash = stableHash(options)
9192
const cwd = process.cwd()

src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ export interface TypeScriptResolverOptions extends NapiResolveOptions {
66
* @default true - whether to always try to resolve `@types` packages
77
*/
88
alwaysTryTypes?: boolean
9+
/**
10+
* Whether `bun` core modules should be accounted
11+
*/
12+
bun?: boolean
913
noWarnOnMultipleProjects?: boolean
1014
}

0 commit comments

Comments
 (0)