refactor: derive package entrypoints from src/*.ts - #93
Conversation
The public surface was described in seven synchronized places: nested barrels, the `entries` map in `tsdown.config.ts`, exact `#micro509/<domain>` aliases, generated npm and JSR exports, the Deno import map, and the docs. Adding an entrypoint meant touching all of them. The eight `src/<domain>/index.ts` barrels move to `src/<domain>.ts` with their contents unchanged. tsdown globs `entry: ['src/*.ts']`, and the JSR hook globs the same root files, so the filesystem is the only manifest. `package.json#imports` drops the exact domain aliases; `#micro509/*` now serves both `#micro509/x509` and `#micro509/x509/parse`. Package specifiers and every exported symbol are unchanged. Verified by comparing the export set of all nine entrypoints before and after, through source aliases, `dist/*.js`, and Node's resolution of `micro509/<domain>`. Root `src/*.ts` is now reserved for entrypoints, since a stray root file would publish a subpath, so `test/conventions.test.ts` pins the set.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
🚫 Excluded labels (none allowed) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
micro509 | 7bf2903 | Jul 25 2026, 02:40 AM |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The structure tree named one of the nine root entry files and waved at the rest; the src/ module map named three of eight. Both now list them. The jsr hook hand-rolled a glob behind a named constant and a helper so each could carry a comment. It reads the directory once, inline, on the same cwd assumption as the writeFile below it and as tsdown's own entry glob.
|
|
||
| `src/internal/` hosts reusable low-level spines consumed by all domains. | ||
| Public barrels should stay in domain folders. | ||
| Public barrels are the root `src/*.ts` files and never live here. |
There was a problem hiding this comment.
NO SHIT, THE DIRECTORY IS CALLED INTERNAL.
| Public domain entrypoints are one-level buckets, implementation details stay in | ||
| `src/internal/`. | ||
| Public entrypoints are the root `src/*.ts` files; domain implementation stays in | ||
| `src/<domain>/` and internals in `src/internal/`. | ||
|
|
||
| ## OVERVIEW | ||
|
|
||
| `src/` is the library boundary. High-level workflow ownership is in domain | ||
| barrels under `x509`, `verify`, `revocation`, `keys`, `pem`, `pkcs`, and | ||
| `result`. |
There was a problem hiding this comment.
Can you be any more verbose... wtf...
| | Area | File/dir | Notes | | ||
| | ------------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------------------- | | ||
| | Package root | `index.ts` | all stable package exports | | ||
| | Domain entrypoints | `der.ts`, `keys.ts`, `pem.ts`, `pkcs.ts`, `result.ts`, `revocation.ts`, `verify.ts`, `x509.ts` | re-export-only | |
There was a problem hiding this comment.
no need to enumerate all in a fucking table cell
`test/conventions.test.ts` regex-matched source text for two rules a linter can check properly. `style/noDefaultExport` covers one, scoped to `src/`, since tsdown.config.ts, the VitePress config and theme, and scripts/smoke-worker.mjs all need a default export. A GritQL plugin covers the other, and unlike the regex it sees class expressions and ignores a `class` line inside a template literal. The entrypoint test hardcoded the nine root stems that `package.json#exports` and `jsr.json#exports` already carry. It now asserts the three agree, so adding an entrypoint needs no edit here and the two maps cannot drift apart. The linter config moves to `preset: recommended` with the `types` domain on, which is what the site and pbes2 changes answer.
Closes #91.
What
The public surface was described in seven synchronized places: nested
index.tsbarrels, theentriesmap intsdown.config.ts, exact#micro509/<domain>aliases, generatedpackage.json#exports, generatedjsr.json#exports, the Deno import map, and the docs. Adding an entrypoint meant touching all of them.The eight
src/<domain>/index.tsbarrels move tosrc/<domain>.ts. Git records all eight as 100% renames, so no export list changed. tsdown takesentry: ['src/*.ts']and thebuild:doneJSR hook globs the same root files, making the filesystem the only manifest.package.json#importsdrops the eight exact domain aliases;#micro509/*already resolves both#micro509/x509and#micro509/x509/parse.Implementation modules stay where they are.
src/x509/parse.ts,src/pkcs/pfx.ts, and the rest are untouched.Surface parity
Package specifiers are unchanged. The export set of all nine entrypoints was captured before the change and compared after, three ways:
#micro509,#micro509/der, …)dist/*.js, imported directly)micro509,micro509/der, …)All three match the baseline exactly: 142 root symbols, 48 der, 53 keys, 7 pem, 13 pkcs, 9 result, 28 revocation, 13 verify, 48 x509.
package.json#exportsis byte-identical to before, still exactly.,./der,./keys,./pem,./pkcs,./result,./revocation,./verify,./x509,./package.json, each with itstypescondition.jsr.json#exportsnow points at the flat source paths. A second build produces no metadata diff.Guarding the root
Because tsdown globs
src/*.ts, a stray root file would silently become a published subpath.test/conventions.test.tsgains a test pinning the root entry set, and its barrel lookup moves from<domain>/index.tsto<domain>.ts.Deno import map
deno.import_map.jsonis gitignored and regenerated bydeno:importsmap. After regeneration it carries no#micro509/<domain>/indexaliases.#micro509/indexremains, as it did before: it is the wildcard resolving the root entry, which importmapify emits for every root file.Verification
typecheck, biome, dprint,
deno lint(all 125 files), 1483 tests, 249 PKITS, 76 OpenSSL differential, docs:lint, publint (All good!), attw--profile esm-only(green for every entrypoint), and the smoke suite across Bun, Node, Deno, browser, and workerd.No version bump; the entry is under
[Unreleased].