Skip to content

Commit 7f5bd74

Browse files
committed
feat: add wasm detection
1 parent cdec07a commit 7f5bd74

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shared/utils/package-analysis.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Package analysis utilities for detecting module format and TypeScript support
33
*/
44

5-
export type ModuleFormat = 'esm' | 'cjs' | 'dual' | 'unknown'
5+
export type ModuleFormat = 'esm' | 'cjs' | 'dual' | 'wasm' | 'unknown'
66

77
export type TypesStatus =
88
| { kind: 'included' }
@@ -87,6 +87,11 @@ export function detectModuleFormat(pkg: ExtendedPackageJson): ModuleFormat {
8787

8888
return mainIsCJS ? 'dual' : 'esm'
8989
}
90+
91+
const mainIsWASM = pkg.main?.endsWith('.wasm')
92+
if (mainIsWASM) {
93+
return 'wasm'
94+
}
9095

9196
if (hasModule || isTypeModule) {
9297
return 'esm'

0 commit comments

Comments
 (0)