From c205e75811c729efe4d7a0b659507fdf2f3bb445 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Tue, 25 Aug 2026 10:21:22 +0100 Subject: [PATCH] docs: say where the Worker-isomorphism ban is actually defined The Conventions entry described the ban as enforced per-package via an ESLint rule, which reads as though each package declares it. Each package opts in with one flag instead, and the rule itself lives once in eslint.shared.ts, deriving its module list from node:module's builtinModules. The distinction matters to anyone adding a package: writing the rule by hand looks equivalent and is not, since flat config replaces a same-key rule rather than merging it, so a second no-restricted-imports switches the ban off while still reporting itself as working. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 426377de..0eb18392 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Individual packages set their own build and test configuration, but as a family - TypeScript with Zod 4 for schema definition and validation. - MIT licensing. - Hand-written, dependency-minimal codecs over pulling in heavyweight format libraries — see each package's own README for what it deliberately avoids depending on. -- The foundation and format-codec packages (`byte-codec`, `document-schema.js`, `document-outline.js`, `archive-codec`, `document-compute.js`, `ooxml.js`, `odf.js`, `markdown-codec`, `pdf-codec`, `documents.js`) are Worker-isomorphic: their published `src/` must not import `node:*`/bare Node builtins or use the Node-only `Buffer` global, enforced per-package via an ESLint `no-restricted-imports`/`no-restricted-globals` rule and proven at runtime by a workerd test suite. The interface packages (`document-cli`, `document-mcp`, `documents`) are not held to this, since they legitimately run under Node or a browser rather than needing Worker portability. +- The foundation and format-codec packages (`byte-codec`, `document-schema.js`, `document-outline.js`, `archive-codec`, `document-compute.js`, `ooxml.js`, `odf.js`, `markdown-codec`, `pdf-codec`, `documents.js`) are Worker-isomorphic: their published `src/` must not import `node:*`/bare Node builtins or use the Node-only `Buffer` global. The `no-restricted-imports`/`no-restricted-globals` ban enforcing that is defined once in the root's `eslint.shared.ts`, which derives the module list from `node:module`'s own `builtinModules` rather than restating it; a package opts in by passing `isomorphic: true` to `packageLintConfig` rather than declaring the rule itself, and a workerd test suite proves it at runtime. The interface packages (`document-cli`, `document-mcp`, `documents`) are not held to this, since they legitimately run under Node or a browser rather than needing Worker portability. ## Working in the workspace