diff --git a/www/lib/package/node.ts b/www/lib/package/node.ts index 0861adf0b..8704867e4 100644 --- a/www/lib/package/node.ts +++ b/www/lib/package/node.ts @@ -91,7 +91,7 @@ function normalizeExports( let result: Record = {}; for (let [key, value] of Object.entries(exports)) { let resolved = resolveExportValue(value); - if (resolved) { + if (resolved && isDocumentable(resolved)) { result[key] = resolved; } } @@ -99,6 +99,14 @@ function normalizeExports( return Object.keys(result).length > 0 ? result : { ".": "./src/index.ts" }; } +/** + * Check if an export path points to a documentable source file. + * Filters out binary artifacts like .wasm files that can't be parsed as TypeScript/JavaScript. + */ +function isDocumentable(path: string): boolean { + return !path.endsWith(".wasm"); +} + /** * Sanitize a semver version range for use in npm: specifiers. * Handles cases like "^3 || ^4" by taking the first valid part.