You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(repo): use explicit '.' export mapping in ESM-only playbook\n\n- Update exports snippet to nest under '.' for better tooling compatibility\n- Adjust verification jq command to match the new exports shape\n\nRefs #1934
- Prefer a tsc-only build for packages that do not need bundling:
36
35
- In `$PKG/package.json`, set scripts:
37
36
```json
@@ -44,9 +43,7 @@ Upgrade a single plugin under `packages/<name>` to publish ESM-only output with
44
43
- If this package still needs bundling for tests/examples, keep its Rollup config but point inputs at the TypeScript output in `dist/` instead of sources.
45
44
46
45
4. TypeScript config: emit ESM to `dist/`
47
-
48
46
- Create or update `$PKG/tsconfig.json` to extend the shared plugin config and emit declarations:
49
-
50
47
```json
51
48
{
52
49
"extends": "../../.config/tsconfig.base.json",
@@ -60,18 +57,15 @@ Upgrade a single plugin under `packages/<name>` to publish ESM-only output with
60
57
"include": ["src/**/*"]
61
58
}
62
59
```
63
-
64
60
- Delete any package-local `rollup` build scripts that produced CJS, and remove any `types/` folder if declarations were hand-authored (they will now be generated).
65
61
66
62
5. Source: convert to pure ESM and modern Node APIs
67
-
68
63
- Replace `require`, `module.exports`, and `__dirname` patterns with ESM equivalents.
69
64
- Use `node:` specifiers for built-ins (e.g., `import path from 'node:path'`).
70
65
- Prefer URL utilities where needed (`fileURLToPath(new URL('.', import.meta.url))`).
71
66
- Inline and export public types from `src/index.ts`; avoid separate `types/` unless unavoidable.
72
67
73
68
6. Tests: drop CJS branches; ESM everywhere
74
-
75
69
- Remove CJS-specific branches/assertions from tests.
76
70
- Keep the existing runner (AVA) if it already handles ESM in Node 20. If the package already uses Vitest in this repo, keep that pattern.
77
71
- Ensure Rollup bundles created in tests are `await bundle.close()`-d to avoid leaks.
@@ -90,7 +84,7 @@ Upgrade a single plugin under `packages/<name>` to publish ESM-only output with
0 commit comments