Skip to content

1.0.0: TypeScript rewrite with dual CJS/ESM output#17

Merged
Wozacosta merged 4 commits intomasterfrom
feature/typescript-migration
Mar 29, 2026
Merged

1.0.0: TypeScript rewrite with dual CJS/ESM output#17
Wozacosta merged 4 commits intomasterfrom
feature/typescript-migration

Conversation

@Wozacosta
Copy link
Copy Markdown
Owner

  • Convert source to TypeScript with full exported types (NaivebayesOptions, CategorizeResult, Likelihood, InfluentialToken, etc.)
  • ES6 class-based implementation, same public API preserved
  • Dual CJS/ESM output via tsup (esbuild-based)
  • Type declarations (.d.ts) included for TypeScript consumers
  • Migrate tests from Mocha+assert to Vitest+expect (109 tests)
  • CI: Node 18/20/22 with typecheck + build + test steps
  • Minimum Node version raised to 18.0.0

- Convert source to TypeScript with full exported types
  (NaivebayesOptions, CategorizeResult, Likelihood, InfluentialToken, etc.)
- ES6 class-based implementation, same public API preserved
- Dual CJS/ESM output via tsup (esbuild-based)
- Type declarations (.d.ts) included for TypeScript consumers
- Migrate tests from Mocha+assert to Vitest+expect (109 tests)
- CI: Node 18/20/22 with typecheck + build + test steps
- Minimum Node version raised to 18.0.0
- Add "type": "module" to package.json (required by Vite/Vitest)
- Update export paths: .cjs/.js instead of .js/.mjs
- Fix CRITICAL: tsup footer injected module.exports into ESM output,
  breaking all ESM imports. Now patches only the CJS file via onSuccess.
- Add 12 dist output tests verifying CJS require, ESM import, named
  exports, serialization round-trip, and .d.ts type declarations.
- Document all exported TypeScript types in README.
@Wozacosta Wozacosta merged commit a2d237d into master Mar 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant