Skip to content

AI Draft

CapabilityAPI
PasswordWeb Crypto PBKDF2 — two-format parser supporting legacy hashes
SQLiteStub — throws EdgeUnsupportedError
ServerStub — throws EdgeUnsupportedError
FilesystemRead-only via fileStore (fetch-based) — three-layer cap enforcement
GlobStub — throws EdgeUnsupportedError
KV ISRkv-isr.ts — Cloudflare Workers KV-backed ISR adapter

edgeRuntime(opts?) returns SlingshotRuntime (frozen). Unsupported capabilities throw descriptive EdgeUnsupportedError rather than failing silently. runtimeCapabilities() provides programmatic introspection.

  • readFile() enforces size caps at three layers: declared size, streaming accumulation, post-buffer
  • File store timeout uses AbortController for proper cancellation
  • Password verification uses constant-time comparison
  • EdgePasswordConfigError thrown eagerly when only one of hashPassword/verifyPassword is provided
  • KvNamespace is structurally typed — @cloudflare/workers-types is not a dependency
  • KV ISR: concurrency-limited fan-out, per-tag serialization locks, bounded memory
  • src/index.tsedgeRuntime() factory, all capability implementations
  • src/kv-isr.ts — KV-backed ISR cache adapter
  • src/errors.tsEdgeRuntimeError, EdgeUnsupportedError, EdgeFileReadError, EdgeFileSizeExceededError, EdgePasswordConfigError
  • src/lib/withAbortTimeout.ts — AbortController-based timeout utility
  • src/testing.tsTEST_EDGE_TIMEOUT_MS, TEST_MAX_FILE_BYTES