This file provides guidance to the AI agent when working with code in this repository.
Tests run against compiled output in dist/, not source. Always build before testing:
npm run build # tsup → dist/index.js + dist/index.cjs
npm test # NODE_ENV=test ava (runs test/*.js, excludes test/*test.js)CI pipeline: npx eslint && npm run build && npm test
- ava with nock for HTTP mocking. No real network calls.
- Test files are plain
.js(not.ts) and import from../dist/index.js. - Ava config excludes
test/*test.js— new test files should NOT use the.test.jssuffix (e.g.callback.js, notcallback.test.js). - Tests use a custom
testCbwrapper fromtest/lib/avaTestCb.jsfor callback-based async. Callt.end()to signal completion. - Default test timeout is 20s.
- TypeScript strict mode, ESM throughout (
"type": "module"). - ESLint enforced on
src/**/*.ts: double quotes, semicolons required,no-consoleis an error, unused vars prefixed with_are allowed. - Target: ES2020. Module resolution: bundler.
gotis lazy-loaded on first use via dynamicimport("got")— do not add a top-level static import for it.cheeriois the default HTML parser (exposed asres.$). jsdom is not supported.- Rate limiter uses a cluster of independent limiters.
rateLimitis global-only — modify per-limiter viacrawler.setLimiter(), not per-request options. - The
callbackpattern requires callingdone()to signal task completion and release the slot.