70bf21e064
Handle Changesets / Handle Changesets (push) Waiting to run
Semgrep OSS scan / semgrep-oss (push) Waiting to run
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
1.6 KiB
1.6 KiB
AGENTS.md — workers-utils
OVERVIEW
Shared utility package used across wrangler, miniflare, and others. Two main areas: config validation and test helpers.
STRUCTURE
src/config/— Configuration types, validation, normalizationvalidation.ts— The config normalizer (large file). Central to all wrangler config processing.environment.ts— Environment/config field definitions (many deprecated fields)config.ts— Config types
src/test-helpers/— Shared test utilities used across packagessrc/types.ts— Shared type definitions
KEY EXPORTS
Config
- Validation pipeline normalizes wrangler.json/toml into typed config objects
- Used by wrangler for all config loading
Test Helpers
runInTempDir()— Creates temp dir, chdir's into it, stubs HOME/XDG_CONFIG_HOME, cleans upseed(files)— WritesRecord<string, string>of path->content into temp dirwriteWranglerConfig()/readWranglerConfig()— Mock wrangler config files (TOML, JSON, JSONC)mockConsoleMethods()— Spies on console, returns normalized output with.debug,.out,.info,.err,.warnnormalizeString()— Multi-stage pipeline: strips timings, thin spaces, temp dirs, normalizes slashes/cwd/dates/tables/error markers/byte values
NOTES
validation.tsis the largest single file in the monorepo after generated code — changes here affect all config processing- Many deprecated fields in
environment.ts— check@deprecatedannotations before modifying - Test helpers imported as
@cloudflare/workers-utils/test-helpersacross packages