This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a monorepo for CDN cache control libraries using pnpm workspaces:
- Root: Workspace configuration and shared tooling
- packages/: Individual library packages
cdn-cache-control: Easy, opinionated CDN cache header handling (TypeScript class-based API)cache-handlers: Modern CDN cache primitives using web-standard middleware (functional API)
pnpm build- Build all packagespnpm test- Run tests for all packages (includes Deno, Node.js, and Workerd tests)pnpm check- Run type checking and linting for all packagespnpm lint- Run linting for all packagespnpm format- Format code using Prettier
pnpm build- Build the package using tsdown (ESM + DTS output)pnpm dev- Watch mode for developmentpnpm test- Run tests (specific to each package's test setup)pnpm check- Run publint and @arethetypeswrong/cli checks
pnpm test:deno- Run Deno tests from repository rootpnpm test:node- Run Node.js tests via Vitestpnpm test:workerd- Run Cloudflare Workers tests via Vitest
- Uses pnpm as package manager
- tsdown for building TypeScript packages with ESM output and declaration files
- deno for testing
- publint and @arethetypeswrong/cli for package validation
- Prettier for code formatting (configured to use tabs in
.prettierrc)
- API Style: Class-based (
CacheHeadersextendsHeaders) - Target: Simple cache header management with CDN-specific optimizations
- Testing: Node.js only via
node --test - Build: ESM + CommonJS outputs
- API Style: Functional middleware approach
- Target: Web standard cache primitives for modern applications
- Key Features:
- Factory functions (
createCacheHandlers,createReadHandler, etc.) - HTTP conditional requests (ETag, Last-Modified, 304 responses)
- Cache invalidation by tags and paths
- Multi-runtime support (Deno, Node.js, Cloudflare Workers)
- Factory functions (
- Testing: Multi-runtime (Deno tests, Node.js via Vitest, Workerd via Vitest)
- Build: ESM-only output
Each package follows this structure:
src/index.ts- Main entry point with comprehensive exportstest/- Test files (runtime-specific subdirectories for cache-handlers)dist/- Built output (ESM + .d.ts files)- Package exports configured for proper TypeScript declarations
Uses strict TypeScript configuration with:
- Target: ES2022
- Module: preserve (for bundler compatibility)
- Strict mode with additional safety checks (
noUncheckedIndexedAccess,noImplicitOverride) - Library-focused settings (declaration files, declaration maps)