Skip to content
This repository was archived by the owner on Jun 14, 2025. It is now read-only.

Commit 073d86b

Browse files
committed
feat(bun): remove mjs path resolution
1 parent 79a4c8f commit 073d86b

File tree

1 file changed

+2
-19
lines changed
  • packages/unplugin-typia/src

1 file changed

+2
-19
lines changed

packages/unplugin-typia/src/bun.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@ import { type ID, type Source, wrap } from './core/types.js';
1414
/**
1515
* Options for bun plugin
1616
*/
17-
export type BunOptions = {
18-
/**
19-
* Convert path of typia to mjs
20-
* even though typia provides mjs, bun cannot handle it (because typia's package.json has "type": "commonjs").
21-
* @default true
22-
*/
23-
forceImportTypiaMjs?: boolean;
24-
} & Options;
17+
export type BunOptions = Options;
2518

2619
if (!isBun()) {
2720
throw new Error('You must use this plugin with bun');
@@ -110,7 +103,7 @@ function bunTypiaPlugin(
110103
const bunPlugin = ({
111104
name: 'unplugin-typia',
112105
async setup(build) {
113-
const { forceImportTypiaMjs = true, ...options } = bunOptions ?? {};
106+
const { ...options } = bunOptions ?? {};
114107
const resolvedOptions = resolveOptions(options ?? {});
115108
const { include } = resolvedOptions;
116109

@@ -149,16 +142,6 @@ function bunTypiaPlugin(
149142
return { contents: code ?? source };
150143
});
151144
}
152-
153-
/** if input is ./node_modules/typia/lib/*, convert js to mjs */
154-
if (forceImportTypiaMjs) {
155-
build.onLoad({ filter: /.+\/node_modules\/typia\/lib\/.*\.js$/ }, async (args) => {
156-
const { path } = args;
157-
const mjsPath = path.replace(/\.js$/, '.mjs');
158-
159-
return { contents: await Bun.file(mjsPath).text() };
160-
});
161-
}
162145
},
163146
}) as const satisfies BunPlugin;
164147

0 commit comments

Comments
 (0)