Public API surface maps
Each *.api.md file in this folder is a generated map of the public, type-level
interface of one publishable @crawlee/* package — every exported class, method,
property, function, and type, with full signatures. These reports define where we
promise backwards compatibility.
They are produced by API Extractor from the built
dist/index.d.ts of each package.
Workflow
-
After changing any package's public surface, regenerate the reports and commit them:
pnpm build # the reports are generated from dist/pnpm api:extract -
CI runs
pnpm api:check, which fails if a committed report is out of date. A failing check means you changed the public API: either that change is intentional (commit the updated report — reviewers will see the surface diff) or it was accidental (fix it). -
api:checkalso fails if a report ends up referencing a symbol it never declares, which leaves the committed map describing a type nothing in it defines. Regenerating cannot fix that; it has to be fixed in the source. In practice it means a@publicsymbol's signature references an@internal/@ignore-d one, so the referenced type is trimmed out from under it. Either drop the referenced type's tag (it is reachable from the public API, so users can already depend on it) or keep it out of the public signature. An untagged symbol is implicitly public, which is the convention here — the codebase does not use explicit@publictags.A symbol that is merely missing from the package's exports does not need fixing: see the note on forgotten exports below.
Notes
-
The reports are generated as API Extractor's
publicvariant, so symbols tagged@internal(@alpha/@betatoo) are excluded — only@publicsurface is tracked. The legacy@ignoretag counts as@internalhere; the generator rewrites it before extraction, so an@ignore-d symbol is excluded too and cannot be referenced from a@publicsignature. The generator stages the variant as<name>.public.api.mdundertemp/and promotes it onto the committed<name>.api.md, so the tracked filenames stay stable. -
API Extractor builds the import list before it trims the non-
@publicdeclarations and never revisits it, so a type reachable only from an@internalmember would linger as a bare import and read as public surface. There is no config option for this, so the generator post-processes each report: it parses the fenced TypeScript and drops imports whose binding is referenced by no declaration that survived the trim. -
Forgotten exports — types the public API references but the entry point never exports — are included in the report via
includeForgottenExportsand carry an explicit banner:// Not exported by the entry point; reachable only as a referenced type.// @public (undocumented)interface SitemapUrlData {Their shape is part of the surface we promise not to break, but their name is not importable, so they are emitted without
export. API Extractor labels them@public (undocumented)like anything else, which is indistinguishable from a real export at a glance, hence the added banner. The alternative was exporting every such type from its package — ~38 new public exports, committing us to names we never meant to publish. If you want one importable, export it deliberately and the report will show it withexport. -
Because API Extractor decides both of the above before the
@publictrim, it also offers declarations for symbols reachable only from members that never reach the report. The generator drops those the same way it drops dead imports, so the report carries nothing it does not refer to. Only symbols flaggedae-forgotten-exportare eligible, which is what keeps genuinely reachable declarations (e.g. thesocialnamespace in@crawlee/utils, whose members are exposed through adeclare namespaceblock) from being pruned. -
docs/public-api/temp/holds intermediate reports (including the staged.public.api.mdfiles) and is git-ignored. -
@crawlee/cliand@crawlee/templatesare deliberately excluded — they are tooling (a CLI binary and project scaffolding), not an importable API where we promise BC. The exclude list lives inscripts/api-extractor/run.ts. -
The generator lives in
scripts/api-extractor/. It temporarily strips the build's injected// @ts-ignorecomment lines from the.d.tsfiles (restoring them afterwards) because API Extractor's AST walker trips over some of them; a small number of packages additionally need a sanitized-mirror fallback. See the comments inscripts/api-extractor/run.tsfor details. -
These reports now cover only the
@publicsurface. Further shrinking them — genuinely hiding class internals (untaggedprotected/_-prefixed members) rather than merely tagging them — is the goal tracked in issue #3109.