Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[experiment] Drop CJS support, make it ESM-only #1218

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## [Unreleased]

- Drops CJS support in favor of ESM only

```tsx
// ❌ No longer supported
const { string } = require('decoders');

// ✅ Use import instead
import { string } from 'decoders';
```

## [2.6.0] - 2025-02-04

- Implement the [Standard Schema](https://standardschema.dev/) specification.
Expand Down
11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@
"url": "https://github.com/nvie/decoders/issues"
},
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.cts",
"main": "./dist/index.js",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"module": "./dist/index.js",
"default": "./dist/index.cjs"
}
}
},
Expand All @@ -40,7 +33,7 @@
"docs": "cog -cr docs/*.md",
"lint": "eslint --color --report-unused-disable-directives src/ test/ && prettier --list-different src/ test/ test-d/",
"lint:docs": "cog -c --check docs/*.md || (npm run docs; git diff; echo 'Error: docs not up-to-date, please re-run \"npm docs\" to update them.' && exit 1)",
"lint:package": "publint --strict && attw --pack",
"lint:package": "publint --strict && attw --pack --profile esm-only",
"format": "eslint --color --report-unused-disable-directives --fix src/ test/ ; prettier --write src/ test/ test-d/",
"test": "vitest run --coverage",
"test:completeness": "./bin/check.sh",
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export default defineConfig({
splitting: true,
clean: true,
// target: /* what tsconfig specifies */,
format: ['esm', 'cjs'],
format: ['esm'],
});