@rexezuge/tooling 1.14.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +42 -30
  2. package/dist/eslint-rules.d.ts.map +1 -1
  3. package/dist/eslint-rules.js +1 -1
  4. package/dist/eslint-rules.js.map +2 -2
  5. package/dist/eslint-strict.d.ts +2 -1
  6. package/dist/eslint-strict.d.ts.map +1 -1
  7. package/dist/eslint-strict.js +2 -1
  8. package/dist/eslint-strict.js.map +3 -3
  9. package/dist/manifest-validate.d.ts.map +1 -1
  10. package/dist/manifest-validate.js +1 -1
  11. package/dist/manifest-validate.js.map +3 -3
  12. package/dist/manifest.d.ts +21 -0
  13. package/dist/manifest.d.ts.map +1 -1
  14. package/dist/manifest.js.map +2 -2
  15. package/dist/scripts/backup/destinations.d.ts +40 -0
  16. package/dist/scripts/backup/destinations.d.ts.map +1 -0
  17. package/dist/scripts/backup/destinations.js +1 -0
  18. package/dist/scripts/backup/destinations.js.map +7 -0
  19. package/dist/scripts/backup/encrypt-backup.d.ts +5 -2
  20. package/dist/scripts/backup/encrypt-backup.d.ts.map +1 -1
  21. package/dist/scripts/backup/encrypt-backup.js +2 -3
  22. package/dist/scripts/backup/encrypt-backup.js.map +3 -3
  23. package/dist/scripts/backup/naming.d.ts +1 -1
  24. package/dist/scripts/backup/naming.d.ts.map +1 -1
  25. package/dist/scripts/backup/naming.js +1 -1
  26. package/dist/scripts/backup/naming.js.map +3 -3
  27. package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
  28. package/dist/scripts/prepare-wrangler-config.js +1 -1
  29. package/dist/scripts/prepare-wrangler-config.js.map +3 -3
  30. package/dist/scripts/wrangler-config/resources.d.ts +11 -2
  31. package/dist/scripts/wrangler-config/resources.d.ts.map +1 -1
  32. package/dist/scripts/wrangler-config/resources.js +1 -1
  33. package/dist/scripts/wrangler-config/resources.js.map +3 -3
  34. package/dist/vitest-aliases.d.ts +7 -1
  35. package/dist/vitest-aliases.d.ts.map +1 -1
  36. package/dist/vitest-aliases.js +1 -1
  37. package/dist/vitest-aliases.js.map +3 -3
  38. package/dist/vitest-integration.d.ts.map +1 -1
  39. package/dist/vitest-integration.js +1 -1
  40. package/dist/vitest-integration.js.map +3 -3
  41. package/dist/vitest-repo.js +1 -1
  42. package/dist/vitest-repo.js.map +3 -3
  43. package/dist/vitest-web.js +1 -1
  44. package/dist/vitest-web.js.map +3 -3
  45. package/dist/vitest.d.ts +1 -1
  46. package/dist/vitest.d.ts.map +1 -1
  47. package/dist/vitest.js +1 -1
  48. package/dist/vitest.js.map +3 -3
  49. package/package.json +3 -3
  50. package/presets/tsconfig/web.json +2 -2
  51. package/schema/manifest.schema.json +28 -1
  52. package/src/eslint-rules.ts +4 -0
  53. package/src/eslint-strict.test.ts +29 -0
  54. package/src/eslint-strict.ts +36 -4
  55. package/src/github/dependabot.yml +14 -4
  56. package/src/github/workflows/backup-d1.yml +15 -0
  57. package/src/github/workflows/backup-main.yml +9 -126
  58. package/src/github/workflows/continuous-deployment.yml +11 -180
  59. package/src/github/workflows/continuous-integration.yml +9 -249
  60. package/src/github/workflows/scheduled-version-update.yml +8 -31
  61. package/src/github/workflows/upstream-sync.yml +8 -49
  62. package/src/manifest-validate.ts +31 -2
  63. package/src/manifest.test.ts +22 -0
  64. package/src/manifest.ts +22 -0
  65. package/src/presets.test.ts +5 -1
  66. package/src/scripts/backup/backup-rules.test.ts +22 -0
  67. package/src/scripts/backup/destinations.ts +59 -0
  68. package/src/scripts/backup/encrypt-backup.ts +58 -48
  69. package/src/scripts/backup/naming.ts +2 -2
  70. package/src/scripts/prepare-wrangler-config.ts +9 -1
  71. package/src/scripts/wrangler-config/resources.test.ts +10 -0
  72. package/src/scripts/wrangler-config/resources.ts +21 -4
  73. package/src/vitest-aliases.test.ts +33 -0
  74. package/src/vitest-aliases.ts +37 -7
  75. package/src/vitest-integration.ts +2 -5
  76. package/src/vitest-repo.ts +2 -2
  77. package/src/vitest-web.ts +2 -2
  78. package/src/vitest.ts +3 -3
  79. package/src/github/actions/retry-step/action.yml +0 -55
  80. package/src/github/actions/setup-env/action.yml +0 -20
package/README.md CHANGED
@@ -111,14 +111,20 @@ repo's layout stays out of its lint config.
111
111
  }
112
112
  ```
113
113
 
114
- | Field | Meaning |
115
- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
116
- | `name`, `scope` | Required. `scope` is the npm scope with its `@`; `defineRepoLintConfig` takes it from here when `scope` is not passed. |
117
- | `features` | `d1 {binding, database, migrationsDir?}`, `web {pages, spaShell}`, `background`, `backupD1`, `durableObjects[]`, `queues[]`, `workflows[]`, `email`, `android`. Declarative today; scripts and templates key off it. |
118
- | `layers[]` | `name`, `dir` (no globs), `mayImport[]` (layer names; `[]` isolates the layer from the whole scope), optional `typeOnly[]`, `package`, `forbid[]` + `forbidMessage`, `http`, `browser`. Replaces the canonical layer table. |
119
- | `quality.coverage` | `{lines, branches, functions, statements}`. The default `thresholds` of `defineUnitVitestConfig` / `defineRepoVitestConfig` (an explicit `thresholds` option wins). |
120
- | `quality.godFiles` | `{soft, hard}`, read by `check-god-files`. **May only be lowered**: the validator refuses a value above the family 300 / 400. |
121
- | `extensions` | The open side. One object per owner namespace, free-form, never read by the kit. |
114
+ | Field | Meaning |
115
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
116
+ | `name`, `scope` | Required. `scope` is the npm scope with its `@`; `defineRepoLintConfig` takes it from here when `scope` is not passed. |
117
+ | `features` | `d1 {binding, database, migrationsDir?}`, `kv {bindings[], namespaceNames?}`, `web {pages, spaShell, buildScript?, pagesProject?}`, `background`, `backupD1`, `durableObjects[]`, `queues[]`, `workflows[]`, `email`, `android`. Declarative today; scripts and templates key off it. |
118
+ | `layers[]` | `name`, `dir` (no globs), `mayImport[]` (layer names; `[]` isolates the layer from the whole scope), optional `typeOnly[]`, `package`, `forbid[]` + `forbidMessage`, `http`, `browser`. Replaces the canonical layer table. |
119
+ | `quality.coverage` | `{lines, branches, functions, statements}`. The default `thresholds` of `defineUnitVitestConfig` / `defineRepoVitestConfig` (an explicit `thresholds` option wins). |
120
+ | `quality.godFiles` | `{soft, hard}`, read by `check-god-files`. **May only be lowered**: the validator refuses a value above the family 300 / 400. |
121
+ | `extensions` | The open side. One object per owner namespace, free-form, never read by the kit. |
122
+
123
+ `features.kv` drives `prepare-wrangler`'s KV provisioning: it adds the listed bindings a hand-written config lacks and creates their namespaces
124
+ (`<worker>-<binding lower-cased>`, or the name `namespaceNames` gives for a namespace that predates that convention). **No `features.kv`, no KV binding and no
125
+ namespace**: a repo without a cache no longer gets a phantom `CACHE`. A placeholder KV id the config itself carries is still resolved. `features.web.buildScript`
126
+ names a **root** `package.json` script that builds the SPA (a wrapper such as `verify:tailwind && build`); CI and CD run `pnpm run <script>` instead of
127
+ `pnpm --filter <scope>/web run build`. `features.web.pagesProject` names the Pages project (else the `CLOUDFLARE_PAGES_PROJECT_NAME` variable, else `<name>-web`).
122
128
 
123
129
  The schema is closed: an unknown key is an error with its path (`features.d1.binding: "db" is invalid (an UPPER_SNAKE binding name)`), because a
124
130
  typo that is silently ignored is a gate that never ran. Every problem is reported at once.
@@ -160,6 +166,12 @@ not `no-restricted-imports` / `no-restricted-syntax`, because flat config _repla
160
166
  | `rexezuge/restricted-import` | `jose` | `accessAuth` / `authenticateAccess` from `@rexezuge/http` (`forgeAccessJwt` in tests) | `http: true` layers, `httpDirs`, tests |
161
167
  | `rexezuge/restricted-import` | `uuid`, `nanoid` | `UUIDUtil` / `CryptoIdGenerator` from `@rexezuge/shared` (inject an `IdGenerator`) | `http: true` layers, `httpDirs`, tests |
162
168
  | `rexezuge/no-hand-built-envelope` | an object literal `{ Exception: { Type, … } }` | throw a typed error from `@rexezuge/errors`; the `@rexezuge/http` error mapper builds the envelope | `http: true` layers, `httpDirs`, tests |
169
+ | `rexezuge/todo-format` | a `TODO` / `FIXME` comment line without a scope or a description | `TODO(<scope>): <text>`, e.g. `// TODO(sdk): replace with the kit helper` | none |
170
+
171
+ **Task markers.** `rexezuge/todo-format` replaces `sonarjs/todo-tag` and `sonarjs/fixme-tag` (both switched off in the repo config), which flagged even a scoped
172
+ marker and made every tracked gap an error. A marker is a comment line that starts with `TODO` or `FIXME`: `TODO(<scope>): <text>` passes (the scope names who or what
173
+ it waits on, and the text what is to be done); a bare `TODO`, `TODO:`, `FIXME fix it` or `TODO(sdk)` with no text is an error. Prose that merely mentions the word
174
+ ("the TODO list") is not a marker. A repo can no longer need `eslint-disable sonarjs/todo-tag` to track an SDK gap.
163
175
 
164
176
  `description`-required disable comments (`eslint-comments/require-description`) are not enforced: no comments plugin is part of the kit's peer set.
165
177
  Pass `httpDirs: ['packages/http']` for an http package in a repo without a manifest.
@@ -185,7 +197,8 @@ The family carried thirteen identical root `tsconfig.json` copies, near-identica
185
197
 
186
198
  - `base.json`: ES2022, `module: ES2022`, `moduleResolution: Bundler`, `strict`, `isolatedModules`, `noEmit`, `resolveJsonModule`, `skipLibCheck`.
187
199
  - `worker.json`: base, `lib: [ES2022, DOM]`. The Workers types come from the repo's generated `worker-configuration.d.ts`, which the repo adds to `include` (the preset cannot know its path).
188
- - `web.json`: base with ES2020, `lib: [ES2020, DOM, DOM.Iterable]` and `jsx: react-jsx`.
200
+ - `web.json`: base with `lib: [ES2022, DOM, DOM.Iterable]` (never behind the base: the SPA type-checks the shared `contracts` package) and `jsx: react-jsx`.
201
+ - `sync --write` sets `extends` (as the first key), and drops `compilerOptions` entries exactly equal to what the preset sets; a differing value is never touched.
189
202
  - Prettier: `"prettier": "@rexezuge/tooling/prettier"` in `package.json` (140 columns, single quotes, semicolons, spaces), then delete `.prettierrc`.
190
203
  A package that needs a tweak imports the config and spreads it from a `prettier.config.mjs`.
191
204
 
@@ -204,8 +217,9 @@ export default defineUnitVitestConfig({
204
217
  ```
205
218
 
206
219
  v8 coverage with the converged include/exclude patterns (scripts, tests, barrels,
207
- generated files, type-only modules), the `@scope/* → src` workspace table (the
208
- family superset — a repo without a domain package keeps the default harmlessly),
220
+ generated files, type-only modules), the `@scope/* → src` workspace table (when the
221
+ manifest declares `layers`, one alias per layer: `<scope>/<package or basename of dir>` to `<dir>/src`; otherwise the family superset `DEFAULT_WORKSPACE_PACKAGES`,
222
+ which includes `contracts` and is exported from `@rexezuge/tooling/vitest`; an explicit `packages` always wins),
209
223
  `cloudflare:workers` / `cloudflare:sockets` / `cloudflare:workflows` aliased to
210
224
  the bundled Node stand-ins, `@rexezuge/*` kept inside Vite's pipeline
211
225
  (`noExternal` — the kit ships bundler-style extensionless imports that Node's
@@ -447,35 +461,33 @@ two places) and owns the retention window — `requireRetentionDays` rejects a b
447
461
  `BACKUP_RETENTION_DAYS` rather than defaulting one — and
448
462
  `encrypt-backup.ts` does the crypto in-process with the kit's own AES-GCM.
449
463
 
450
- **Left local, deliberately:** `s3-prune.ts`, `upload-s3.ts`, `upload-webdav.ts`,
451
- `webdav-target.ts` (destination-specific: S3 credentials, rclone, and a WebDAV
452
- client are per-repo configuration rather than shared rules), `compare-reference.ts`
453
- and `change-email.ts` (business logic and personal-data operations, respectively —
454
- neither is tooling).
464
+ `destinations.ts` holds the pure half of the upload step (the `<name>/production` prefix, the `aws s3 ls` row parser, the rule that a prune only
465
+ ever deletes backup artifacts older than the cutoff, the WebDAV target). `rexezuge backup d1 upload s3|webdav` in `@rexezuge/cli` runs `aws` and
466
+ `rclone` with them, so the backup workflow carries no repo-local scripts.
467
+
468
+ **Left local, deliberately:** `compare-reference.ts` and `change-email.ts` (business logic and personal-data operations, respectively; neither is tooling).
455
469
 
456
470
  ---
457
471
 
458
472
  ## 5. GitHub templates
459
473
 
460
- `src/github/` holds the converged family workflows and composite actions:
474
+ `src/github/` holds what a repo copies, and it is small on purpose: the pipelines are the SDK's **reusable workflows**
475
+ (`.github/workflows/*.yml` in the SDK repository, `on: workflow_call`, tagged `v1`; see [`docs/workflows.md`](../../docs/workflows.md)).
461
476
 
462
477
  ```
463
478
  src/github/
464
- workflows/continuous-integration.yml # the superset of nine repos' CI jobs
465
- workflows/continuous-deployment.yml # workflow_run-gated deploy, worker + pages
466
- workflows/scheduled-version-update.yml # .github/.version bump
467
- workflows/backup-main.yml # secret-gated mirrors to Azure DevOps / GitLab
468
- workflows/upstream-sync.yml # a fork's weekly pull from its upstream, then CI dispatch
469
- actions/setup-env/action.yml # pnpm + node store cache
470
- actions/retry-step/action.yml # retry a bash command, annotate the attempts
471
- dependabot.yml # weekly, with the @rexezuge/* group
479
+ workflows/continuous-integration.yml # caller of worker-ci.yml
480
+ workflows/continuous-deployment.yml # caller of worker-cd.yml (workflow_run after CI)
481
+ workflows/scheduled-version-update.yml # caller of version-update.yml
482
+ workflows/backup-d1.yml # caller of backup-d1.yml (manifest features.backupD1)
483
+ workflows/backup-main.yml # caller of backup-main.yml (mirrors to Azure DevOps / GitLab)
484
+ workflows/upstream-sync.yml # caller of upstream-sync.yml (a fork's weekly pull)
485
+ dependabot.yml # weekly; groups kit, toolchain, cloudflare; updates the pnpm catalog
472
486
  ```
473
487
 
474
- Copy the tree to the repo root. Placeholders are marked `REPLACE` and listed at the
475
- top of each file; the one that must change for the workflows to run at all is the
476
- `pnpm --filter @<scope>/web build` invocation in `continuous-integration.yml` and
477
- `continuous-deployment.yml`. `upstream-sync.yml` needs its `REPLACE_ME_ORG/REPLACE_ME_REPO`
478
- upstream; `backup-main.yml` has no placeholders (every value is a secret).
488
+ Each caller is about a dozen lines: its triggers, the permissions the called jobs need, one `uses:` at `@v1` and `secrets: inherit`.
489
+ `rexezuge sync --write` writes them (replacing a repo's full copy of the same workflow) and a test keeps these files identical to what it writes.
490
+ The composite actions (`setup-env`, `retry-step`) are no longer copied: the reusable workflows call them from the SDK at `@v1`.
479
491
 
480
492
  ---
481
493
 
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-rules.d.ts","sourceRoot":"","sources":["../src/eslint-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsB9D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsI3D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB3D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwDxD,CAAC"}
1
+ {"version":3,"file":"eslint-rules.d.ts","sourceRoot":"","sources":["../src/eslint-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsB9D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsI3D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwB3D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwDxD,CAAC"}
@@ -1 +1 @@
1
- const n={"@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"@typescript-eslint/no-floating-promises":["error",{ignoreVoid:!0}],"@typescript-eslint/no-explicit-any":"warn","@typescript-eslint/no-unsafe-assignment":"warn","@typescript-eslint/no-unsafe-member-access":"warn","@typescript-eslint/no-unsafe-call":"warn","@typescript-eslint/no-unsafe-return":"warn","@typescript-eslint/no-unsafe-argument":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1,properties:!1}}],"@typescript-eslint/require-await":"off","@typescript-eslint/await-thenable":"off"},r={"unicorn/prevent-abbreviations":"off","unicorn/no-null":"off","unicorn/prefer-module":"off","unicorn/prefer-top-level-await":"off","unicorn/custom-error-definition":"off","unicorn/no-process-exit":"off","unicorn/no-array-reduce":"off","unicorn/prefer-number-properties":["error",{checkInfinity:!1}],"unicorn/no-nested-ternary":"off","unicorn/prefer-spread":"off","unicorn/filename-case":"off","unicorn/name-replacements":"off","unicorn/max-nested-calls":"off","unicorn/prefer-import-meta-properties":"off","unicorn/catch-error-name":"off","unicorn/consistent-boolean-name":"off","unicorn/prefer-uint8array-base64":"off","unicorn/consistent-class-member-order":"off","unicorn/no-non-function-verb-prefix":"off","unicorn/no-for-each":"off","unicorn/prefer-await":"warn","unicorn/no-array-callback-reference":"warn","unicorn/no-array-sort":"warn","unicorn/prefer-ternary":"off","unicorn/no-await-expression-member":"off","unicorn/prefer-number-coercion":"off","unicorn/prefer-code-point":"off","unicorn/prefer-simple-condition-first":"off","unicorn/no-top-level-assignment-in-function":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-computed-property-existence-check":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-this-outside-of-class":"off","unicorn/class-reference-in-static-methods":"off","unicorn/no-global-object-property-assignment":"off","unicorn/prefer-logical-operator-over-ternary":"off","unicorn/better-dom-traversing":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-array-method-this-argument":"off","unicorn/consistent-function-scoping":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/use-type-alias":"off","sonarjs/redundant-type-aliases":"off","sonarjs/no-nested-assignment":"off","unicorn/prefer-number-is-safe-integer":"off","unicorn/prefer-unicode-code-point-escapes":"off","unicorn/no-this-assignment":"off","unicorn/no-top-level-side-effects":"off","sonarjs/no-all-duplicated-branches":"off","unicorn/prefer-else-if":"off","unicorn/prefer-minimal-ternary":"off","sonarjs/void-use":"off","sonarjs/different-types-comparison":"off","unicorn/prefer-array-from-async":"off"},o={"sonarjs/no-duplicate-string":["warn",{threshold:5}],"sonarjs/cognitive-complexity":["warn",20],"sonarjs/no-hardcoded-passwords":"off","sonarjs/deprecation":"warn","sonarjs/no-nested-conditional":"warn","sonarjs/prefer-read-only-props":"warn","sonarjs/public-static-readonly":"warn","sonarjs/no-nested-template-literals":"warn"},e={"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{arguments:!1,attributes:!1}}],"@typescript-eslint/unbound-method":"off","@typescript-eslint/require-await":"off","@typescript-eslint/no-redundant-type-constituents":"off","@typescript-eslint/no-unnecessary-type-assertion":"off","unicorn/prefer-promise-with-resolvers":"off","unicorn/consistent-function-scoping":"off","unicorn/no-return-array-push":"off","unicorn/require-array-sort-compare":"off","unicorn/prefer-iterator-helpers":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-unsafe-string-replacement":"off","unicorn/no-await-expression-member":"off","sonarjs/void-use":"off","sonarjs/no-clear-text-protocols":"off","sonarjs/no-hardcoded-ip":"off","unicorn/prefer-https":"off","sonarjs/assertions-in-tests":"off","sonarjs/no-extra-arguments":"off","sonarjs/use-type-alias":"off","sonarjs/no-alphabetical-sort":"off","sonarjs/no-duplicate-string":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-array-sort":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-useless-template-literals":"off","unicorn/no-declarations-before-early-exit":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/prefer-specific-assertions":"off","sonarjs/no-inverted-boolean-check":"off"};export{o as SONARJS_RULES,e as TEST_RULES,n as TYPESCRIPT_RULES,r as UNICORN_RULES};
1
+ const n={"@typescript-eslint/no-unused-vars":["error",{argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"@typescript-eslint/no-floating-promises":["error",{ignoreVoid:!0}],"@typescript-eslint/no-explicit-any":"warn","@typescript-eslint/no-unsafe-assignment":"warn","@typescript-eslint/no-unsafe-member-access":"warn","@typescript-eslint/no-unsafe-call":"warn","@typescript-eslint/no-unsafe-return":"warn","@typescript-eslint/no-unsafe-argument":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1,properties:!1}}],"@typescript-eslint/require-await":"off","@typescript-eslint/await-thenable":"off"},r={"unicorn/prevent-abbreviations":"off","unicorn/no-null":"off","unicorn/prefer-module":"off","unicorn/prefer-top-level-await":"off","unicorn/custom-error-definition":"off","unicorn/no-process-exit":"off","unicorn/no-array-reduce":"off","unicorn/prefer-number-properties":["error",{checkInfinity:!1}],"unicorn/no-nested-ternary":"off","unicorn/prefer-spread":"off","unicorn/filename-case":"off","unicorn/name-replacements":"off","unicorn/max-nested-calls":"off","unicorn/prefer-import-meta-properties":"off","unicorn/catch-error-name":"off","unicorn/consistent-boolean-name":"off","unicorn/prefer-uint8array-base64":"off","unicorn/consistent-class-member-order":"off","unicorn/no-non-function-verb-prefix":"off","unicorn/no-for-each":"off","unicorn/prefer-await":"warn","unicorn/no-array-callback-reference":"warn","unicorn/no-array-sort":"warn","unicorn/prefer-ternary":"off","unicorn/no-await-expression-member":"off","unicorn/prefer-number-coercion":"off","unicorn/prefer-code-point":"off","unicorn/prefer-simple-condition-first":"off","unicorn/no-top-level-assignment-in-function":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-computed-property-existence-check":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-this-outside-of-class":"off","unicorn/class-reference-in-static-methods":"off","unicorn/no-global-object-property-assignment":"off","unicorn/prefer-logical-operator-over-ternary":"off","unicorn/better-dom-traversing":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-array-method-this-argument":"off","unicorn/consistent-function-scoping":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/use-type-alias":"off","sonarjs/redundant-type-aliases":"off","sonarjs/no-nested-assignment":"off","unicorn/prefer-number-is-safe-integer":"off","unicorn/prefer-unicode-code-point-escapes":"off","unicorn/no-this-assignment":"off","unicorn/no-top-level-side-effects":"off","sonarjs/no-all-duplicated-branches":"off","unicorn/prefer-else-if":"off","unicorn/prefer-minimal-ternary":"off","sonarjs/void-use":"off","sonarjs/different-types-comparison":"off","unicorn/prefer-array-from-async":"off"},o={"sonarjs/no-duplicate-string":["warn",{threshold:5}],"sonarjs/cognitive-complexity":["warn",20],"sonarjs/no-hardcoded-passwords":"off","sonarjs/todo-tag":"off","sonarjs/fixme-tag":"off","sonarjs/deprecation":"warn","sonarjs/no-nested-conditional":"warn","sonarjs/prefer-read-only-props":"warn","sonarjs/public-static-readonly":"warn","sonarjs/no-nested-template-literals":"warn"},e={"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{arguments:!1,attributes:!1}}],"@typescript-eslint/unbound-method":"off","@typescript-eslint/require-await":"off","@typescript-eslint/no-redundant-type-constituents":"off","@typescript-eslint/no-unnecessary-type-assertion":"off","unicorn/prefer-promise-with-resolvers":"off","unicorn/consistent-function-scoping":"off","unicorn/no-return-array-push":"off","unicorn/require-array-sort-compare":"off","unicorn/prefer-iterator-helpers":"off","unicorn/prefer-iterator-to-array":"off","unicorn/no-unsafe-string-replacement":"off","unicorn/no-await-expression-member":"off","sonarjs/void-use":"off","sonarjs/no-clear-text-protocols":"off","sonarjs/no-hardcoded-ip":"off","unicorn/prefer-https":"off","sonarjs/assertions-in-tests":"off","sonarjs/no-extra-arguments":"off","sonarjs/use-type-alias":"off","sonarjs/no-alphabetical-sort":"off","sonarjs/no-duplicate-string":"off","unicorn/no-break-in-nested-loop":"off","unicorn/no-array-sort":"off","unicorn/no-unreadable-for-of-expression":"off","unicorn/no-useless-template-literals":"off","unicorn/no-declarations-before-early-exit":"off","unicorn/prefer-includes-over-repeated-comparisons":"off","sonarjs/prefer-specific-assertions":"off","sonarjs/no-inverted-boolean-check":"off"};export{o as SONARJS_RULES,e as TEST_RULES,n as TYPESCRIPT_RULES,r as UNICORN_RULES};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/eslint-rules.ts"],
4
- "sourcesContent": ["/**\n * The rule-override blocks of the repo lint config.\n *\n * Extracted from `eslint.ts` with the boundary rules: each block is a plain\n * rules object with the provenance comment that says *why* it is set to this\n * value, because a per-rule decision with no reason attached is a decision the\n * next reader re-litigates. `eslint.ts` composes these; this file is where a\n * rule's story lives.\n */\n\n/**\n * TypeScript rules, identical in all four source stacks.\n */\nexport const TYPESCRIPT_RULES: Readonly<Record<string, unknown>> = {\n '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],\n // Allow `void expr` for intentional fire-and-forget in Workers.\n '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],\n // Relax the unsafe-any rules to warn: the external API boundaries (Cloudflare\n // bindings, provider SDKs) are typed `any` upstream, and the alternative is a\n // config that cannot be adopted.\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/no-unsafe-assignment': 'warn',\n '@typescript-eslint/no-unsafe-member-access': 'warn',\n '@typescript-eslint/no-unsafe-call': 'warn',\n '@typescript-eslint/no-unsafe-return': 'warn',\n '@typescript-eslint/no-unsafe-argument': 'warn',\n // JSX event handlers and hook callback objects commonly use async functions\n // where void is expected.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { attributes: false, properties: false } }],\n // An `async` function with no `await`: every handler and DAO method is\n // `async` by shape so a future `await` does not change its signature.\n '@typescript-eslint/require-await': 'off',\n // `await` on a value the types say is not thenable, where the value is a\n // `PromiseLike` from an interface declared that way.\n '@typescript-eslint/await-thenable': 'off',\n};\n\n/**\n * Unicorn and SonarJS rules carried from the source repos, each off for a\n * stated reason.\n *\n * This is the family's \"deliberately does not follow\" block: every entry is\n * off because complying would make the code worse for what the project is,\n * and each is listed rather than dropped so the decision stays reviewable.\n */\nexport const UNICORN_RULES: Readonly<Record<string, unknown>> = {\n // Codebase uses ctx, req, res, env, err, util, db, dao, etc. — too invasive\n // to rename.\n 'unicorn/prevent-abbreviations': 'off',\n // D1/DAO layer returns null; disabling this avoids mass rewrites.\n 'unicorn/no-null': 'off',\n // Monorepo uses CommonJS-compatible module style in some configs.\n 'unicorn/prefer-module': 'off',\n // Top-level await not available in all Workers entry points.\n 'unicorn/prefer-top-level-await': 'off',\n // Error subclassing via `new MyError()` is intentional in backend-errors.\n 'unicorn/custom-error-definition': 'off',\n // Allow process.exit in build/script files.\n 'unicorn/no-process-exit': 'off',\n // Array reduce is used intentionally in analytics/data transformation.\n 'unicorn/no-array-reduce': 'off',\n // Allow Number() — parseInt/parseFloat are used in some cases intentionally.\n 'unicorn/prefer-number-properties': ['error', { checkInfinity: false }],\n // Allow nested ternaries in JSX (React render patterns).\n 'unicorn/no-nested-ternary': 'off',\n // Allow Array.from — codebase uses it for iterables.\n 'unicorn/prefer-spread': 'off',\n // Entire codebase uses PascalCase for TS files; kebab-case would require\n // mass renames.\n 'unicorn/filename-case': 'off',\n // Established names should not be force-renamed.\n 'unicorn/name-replacements': 'off',\n // Zod schema builder chains and other deep method chains are intentional.\n 'unicorn/max-nested-calls': 'off',\n // import.meta.dirname is not available in all test environments.\n 'unicorn/prefer-import-meta-properties': 'off',\n // Codebase uses `err` as catch parameter name throughout.\n 'unicorn/catch-error-name': 'off',\n // Established boolean param names (retryable, enabled, etc.).\n 'unicorn/consistent-boolean-name': 'off',\n // Uint8Array#toBase64 / fromBase64 are not in all Workers runtime versions.\n 'unicorn/prefer-uint8array-base64': 'off',\n // Class member ordering would require extensive restructuring.\n 'unicorn/consistent-class-member-order': 'off',\n // API response fields use verb prefixes by convention.\n 'unicorn/no-non-function-verb-prefix': 'off',\n // forEach is used intentionally throughout the provider and utility layers.\n 'unicorn/no-for-each': 'off',\n // .then() chains in DAO and provider layers are often intentional.\n 'unicorn/prefer-await': 'warn',\n // Callback references (e.g. .map(Number)) are sometimes intentional.\n 'unicorn/no-array-callback-reference': 'warn',\n // toSorted() is ES2023 and may not be in all tsconfig lib targets.\n 'unicorn/no-array-sort': 'warn',\n // Early-return guard clauses are the established style; the rule only\n // rewrites the final guard of a ladder, which yields asymmetric mixed style\n // and long inline ternaries. Off in Mail-Meow and Edge-Sonic; canonical here\n // because it is the family's established style.\n 'unicorn/prefer-ternary': 'off',\n // `(await x).y` -> a named intermediate. Fires constantly in the tests,\n // where destructuring beside the assertion it serves is clearer.\n 'unicorn/no-await-expression-member': 'off',\n // `Number(x)` over `+x`: the `+` form is used where an explicit typeof check\n // has already narrowed the operand.\n 'unicorn/prefer-number-coercion': 'off',\n // Code-point iteration: the byte-level readers index deliberately, because\n // the offset *is* what they are reading.\n 'unicorn/prefer-code-point': 'off',\n // `if (!x) return;` over a compound condition: one guard per line, each with\n // its own comment, is what keeps endpoint guards readable.\n 'unicorn/prefer-simple-condition-first': 'off',\n // Module-scope `let` assigned from `beforeEach` in the test harnesses.\n 'unicorn/no-top-level-assignment-in-function': 'off',\n // Sequential `for...of` with `await` in the DAOs — D1's subrequest budget is\n // the scarce resource.\n 'unicorn/no-unreadable-for-of-expression': 'off',\n // `Object.hasOwn` over `in`: used where a prototype-chain hit is harmless.\n 'unicorn/no-computed-property-existence-check': 'off',\n // A labeled `break` out of two loops.\n 'unicorn/no-break-in-nested-loop': 'off',\n // `this` outside a class body: the module-level cache singletons document\n // their `this` contract in prose.\n 'unicorn/no-this-outside-of-class': 'off',\n // A class named inside its own static method.\n 'unicorn/class-reference-in-static-methods': 'off',\n // Assigning `globalThis.fetch` in a test — the only way to intercept the\n // ambient fetch in Node without a module mock.\n 'unicorn/no-global-object-property-assignment': 'off',\n // `(a ? b : c) && d`: written longhand so each precedence decision is\n // visible.\n 'unicorn/prefer-logical-operator-over-ternary': 'off',\n // `children[0]` in the XML helpers, which index a child list positionally.\n 'unicorn/better-dom-traversing': 'off',\n // `entries()` -> `keys()`/`values()`: the full entry is destructured.\n 'unicorn/prefer-iterator-to-array': 'off',\n // `.map(fn, thisArg)`: rejected on purpose.\n 'unicorn/no-array-method-this-argument': 'off',\n // A module-scope function that closes over nothing.\n 'unicorn/consistent-function-scoping': 'off',\n // `foo[0] === 'a' || foo[0] === 'b'` written longhand where the\n // alternatives are not adjacent.\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n // A `type` alias over an inline union, where the name is what makes the\n // signature and its doc comment readable.\n 'sonarjs/use-type-alias': 'off',\n // A short local alias for a type imported from a protocol package.\n 'sonarjs/redundant-type-aliases': 'off',\n // `type: value` narrowing the other way, where both spellings appear in the\n // same schema and the code follows whichever the spec uses there.\n 'sonarjs/no-nested-assignment': 'off',\n // `Number.isInteger` plus a separate range check, where the bounds come from\n // the caller's own options in one place.\n 'unicorn/prefer-number-is-safe-integer': 'off',\n // `\\u{...}` over a `\\xNN` escape: the table is written in the byte form the\n // spec prints.\n 'unicorn/prefer-unicode-code-point-escapes': 'off',\n // `self.x = this.x` in an entry model: the alias makes the verbatim\n // round-trip explicit.\n 'unicorn/no-this-assignment': 'off',\n // Building a `Set` at module scope from a constant list, for O(1) membership\n // on a path that runs per parameter.\n 'unicorn/no-top-level-side-effects': 'off',\n // A conditional whose branches are identical, kept where the two branches\n // are named separately to document that they are meant to diverge.\n 'sonarjs/no-all-duplicated-branches': 'off',\n // An `else` after a `return`: the flat form keeps the remaining cases at one\n // indent level in the dispatch tables.\n 'unicorn/prefer-else-if': 'off',\n // A nested ternary in a sort comparator, where the three-way order is the\n // point.\n 'unicorn/prefer-minimal-ternary': 'off',\n // `void promise` where initiating the call is the point and the rejection is\n // handled at a named site elsewhere.\n 'sonarjs/void-use': 'off',\n // `x === undefined` reported as always-true/false. With\n // `noUncheckedIndexedAccess` on, the guard is exactly right.\n 'sonarjs/different-types-comparison': 'off',\n // An accumulating loop with a sequential `await` in it, over D1 writes.\n 'unicorn/prefer-array-from-async': 'off',\n};\n\n/**\n * SonarJS rules the sources turned from errors into advisories, with the\n * threshold raised to a value that has actually held.\n */\nexport const SONARJS_RULES: Readonly<Record<string, unknown>> = {\n // Raise duplicate-string threshold to avoid flagging intentional repeated\n // literals like provider IDs.\n 'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],\n // Cognitive complexity — warn rather than error, so the ratchet can move\n // without a red build. Raise the number only as files are decomposed.\n 'sonarjs/cognitive-complexity': ['warn', 20],\n // False positives: connection method names like 'imap-password' and field\n // names like 'password_hash'.\n 'sonarjs/no-hardcoded-passwords': 'off',\n // Third-party deprecations are warnings, not errors.\n 'sonarjs/deprecation': 'warn',\n // Nested ternaries in complex data-mapping code.\n 'sonarjs/no-nested-conditional': 'warn',\n // React component props are commonly not marked Readonly<>.\n 'sonarjs/prefer-read-only-props': 'warn',\n // Static readonly properties require invasive refactoring.\n 'sonarjs/public-static-readonly': 'warn',\n // Nested template literals in SQL queries and prompt construction.\n 'sonarjs/no-nested-template-literals': 'warn',\n};\n\n/**\n * Test-suite overrides.\n *\n * `test/**` is deliberately *not* in the config's ignores list. Durable-DAV,\n * AWS and Mail-Meow all ignored it, and ~200 KB of test code had accumulated\n * violations that nothing reported. This block puts the suite back under the\n * same rules as the rest of the workspace and switches off only the handful\n * whose findings are structural artefacts of test code rather than defects.\n * It does not disable correctness rules: the unused-variable, dead-store,\n * regex and sorting findings in the suite are real and are fixed, not\n * suppressed.\n */\nexport const TEST_RULES: Readonly<Record<string, unknown>> = {\n // `it('…', async () => …)` is the Vitest idiom.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { arguments: false, attributes: false } }],\n // Unbound method is a common false positive in mock assertions like\n // expect(fn).toHaveBeenCalledWith(...).\n '@typescript-eslint/unbound-method': 'off',\n // Test helpers and stubs routinely use async functions without await.\n '@typescript-eslint/require-await': 'off',\n // Redundant type constituents appear in typed mock stubs.\n '@typescript-eslint/no-redundant-type-constituents': 'off',\n // `as never` casts are the standard fake-DB double pattern in tests.\n '@typescript-eslint/no-unnecessary-type-assertion': 'off',\n // Promise.withResolvers() and function-scoping refactors are cosmetic.\n 'unicorn/prefer-promise-with-resolvers': 'off',\n 'unicorn/consistent-function-scoping': 'off',\n // Fake-DB builders push-then-return and sort without comparators.\n 'unicorn/no-return-array-push': 'off',\n 'unicorn/require-array-sort-compare': 'off',\n // Iterator-helper rewrites churn test fakes with no runtime benefit.\n 'unicorn/prefer-iterator-helpers': 'off',\n 'unicorn/prefer-iterator-to-array': 'off',\n // String replacement with test-driven values is intentional in assertions.\n 'unicorn/no-unsafe-string-replacement': 'off',\n // Fake-D1 doubles await a DAO thunk and call straight onto the result.\n 'unicorn/no-await-expression-member': 'off',\n // `void promise` marks a deliberately unawaited promise in a test.\n 'sonarjs/void-use': 'off',\n // A test asserting request routing has to name `http://` hosts, and a proxy\n // test has to name a loopback upstream. Both are the subject matter, not\n // leaked configuration. `unicorn/prefer-https` must stay off here and this\n // is not a style preference: it rewrites `http://` to `https://` *inside\n // string literals*, and `--fix` applies it silently.\n 'sonarjs/no-clear-text-protocols': 'off',\n 'sonarjs/no-hardcoded-ip': 'off',\n 'unicorn/prefer-https': 'off',\n // sonarjs/assertions-in-tests fires false positives when test helpers handle\n // assertions indirectly.\n 'sonarjs/assertions-in-tests': 'off',\n // sonarjs/no-extra-arguments fires incorrectly on Vitest mock overloads.\n 'sonarjs/no-extra-arguments': 'off',\n // Union/inline types in test fakes are more readable than aliases.\n 'sonarjs/use-type-alias': 'off',\n // Alphabetical-sort rule fights deterministic fixture ordering.\n 'sonarjs/no-alphabetical-sort': 'off',\n // Repeated string literals in fixtures/assertions are clearer inline.\n 'sonarjs/no-duplicate-string': 'off',\n // Fake-D1 doubles break out of a nested loop to model a statement miss.\n 'unicorn/no-break-in-nested-loop': 'off',\n // Fixtures are naturally built with sort()/for…of over composed expressions.\n 'unicorn/no-array-sort': 'off',\n 'unicorn/no-unreadable-for-of-expression': 'off',\n 'unicorn/no-useless-template-literals': 'off',\n 'unicorn/no-declarations-before-early-exit': 'off',\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n 'sonarjs/prefer-specific-assertions': 'off',\n 'sonarjs/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MAGlC,mBAAoB,MAGpB,qCAAsC,MAEtC,kCAAmC,OAOxBC,EAAmD,CAG9D,8BAA+B,CAAC,OAAQ,CAAE,UAAW,CAAC,CAAE,EAGxD,+BAAgC,CAAC,OAAQ,EAAE,EAG3C,iCAAkC,MAElC,sBAAuB,OAEvB,gCAAiC,OAEjC,iCAAkC,OAElC,iCAAkC,OAElC,sCAAuC,QAe5BC,EAAgD,CAE3D,yCAA0C,CAAC,QAAS,CAAE,iBAAkB,CAAE,UAAW,GAAO,WAAY,EAAK,CAAE,CAAE,EAGjH,oCAAqC,MAErC,mCAAoC,MAEpC,oDAAqD,MAErD,mDAAoD,MAEpD,wCAAyC,MACzC,sCAAuC,MAEvC,+BAAgC,MAChC,qCAAsC,MAEtC,kCAAmC,MACnC,mCAAoC,MAEpC,uCAAwC,MAExC,qCAAsC,MAEtC,mBAAoB,MAMpB,kCAAmC,MACnC,0BAA2B,MAC3B,uBAAwB,MAGxB,8BAA+B,MAE/B,6BAA8B,MAE9B,yBAA0B,MAE1B,+BAAgC,MAEhC,8BAA+B,MAE/B,kCAAmC,MAEnC,wBAAyB,MACzB,0CAA2C,MAC3C,uCAAwC,MACxC,4CAA6C,MAC7C,oDAAqD,MACrD,qCAAsC,MACtC,oCAAqC",
4
+ "sourcesContent": ["/**\n * The rule-override blocks of the repo lint config.\n *\n * Extracted from `eslint.ts` with the boundary rules: each block is a plain\n * rules object with the provenance comment that says *why* it is set to this\n * value, because a per-rule decision with no reason attached is a decision the\n * next reader re-litigates. `eslint.ts` composes these; this file is where a\n * rule's story lives.\n */\n\n/**\n * TypeScript rules, identical in all four source stacks.\n */\nexport const TYPESCRIPT_RULES: Readonly<Record<string, unknown>> = {\n '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],\n // Allow `void expr` for intentional fire-and-forget in Workers.\n '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],\n // Relax the unsafe-any rules to warn: the external API boundaries (Cloudflare\n // bindings, provider SDKs) are typed `any` upstream, and the alternative is a\n // config that cannot be adopted.\n '@typescript-eslint/no-explicit-any': 'warn',\n '@typescript-eslint/no-unsafe-assignment': 'warn',\n '@typescript-eslint/no-unsafe-member-access': 'warn',\n '@typescript-eslint/no-unsafe-call': 'warn',\n '@typescript-eslint/no-unsafe-return': 'warn',\n '@typescript-eslint/no-unsafe-argument': 'warn',\n // JSX event handlers and hook callback objects commonly use async functions\n // where void is expected.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { attributes: false, properties: false } }],\n // An `async` function with no `await`: every handler and DAO method is\n // `async` by shape so a future `await` does not change its signature.\n '@typescript-eslint/require-await': 'off',\n // `await` on a value the types say is not thenable, where the value is a\n // `PromiseLike` from an interface declared that way.\n '@typescript-eslint/await-thenable': 'off',\n};\n\n/**\n * Unicorn and SonarJS rules carried from the source repos, each off for a\n * stated reason.\n *\n * This is the family's \"deliberately does not follow\" block: every entry is\n * off because complying would make the code worse for what the project is,\n * and each is listed rather than dropped so the decision stays reviewable.\n */\nexport const UNICORN_RULES: Readonly<Record<string, unknown>> = {\n // Codebase uses ctx, req, res, env, err, util, db, dao, etc. — too invasive\n // to rename.\n 'unicorn/prevent-abbreviations': 'off',\n // D1/DAO layer returns null; disabling this avoids mass rewrites.\n 'unicorn/no-null': 'off',\n // Monorepo uses CommonJS-compatible module style in some configs.\n 'unicorn/prefer-module': 'off',\n // Top-level await not available in all Workers entry points.\n 'unicorn/prefer-top-level-await': 'off',\n // Error subclassing via `new MyError()` is intentional in backend-errors.\n 'unicorn/custom-error-definition': 'off',\n // Allow process.exit in build/script files.\n 'unicorn/no-process-exit': 'off',\n // Array reduce is used intentionally in analytics/data transformation.\n 'unicorn/no-array-reduce': 'off',\n // Allow Number() — parseInt/parseFloat are used in some cases intentionally.\n 'unicorn/prefer-number-properties': ['error', { checkInfinity: false }],\n // Allow nested ternaries in JSX (React render patterns).\n 'unicorn/no-nested-ternary': 'off',\n // Allow Array.from — codebase uses it for iterables.\n 'unicorn/prefer-spread': 'off',\n // Entire codebase uses PascalCase for TS files; kebab-case would require\n // mass renames.\n 'unicorn/filename-case': 'off',\n // Established names should not be force-renamed.\n 'unicorn/name-replacements': 'off',\n // Zod schema builder chains and other deep method chains are intentional.\n 'unicorn/max-nested-calls': 'off',\n // import.meta.dirname is not available in all test environments.\n 'unicorn/prefer-import-meta-properties': 'off',\n // Codebase uses `err` as catch parameter name throughout.\n 'unicorn/catch-error-name': 'off',\n // Established boolean param names (retryable, enabled, etc.).\n 'unicorn/consistent-boolean-name': 'off',\n // Uint8Array#toBase64 / fromBase64 are not in all Workers runtime versions.\n 'unicorn/prefer-uint8array-base64': 'off',\n // Class member ordering would require extensive restructuring.\n 'unicorn/consistent-class-member-order': 'off',\n // API response fields use verb prefixes by convention.\n 'unicorn/no-non-function-verb-prefix': 'off',\n // forEach is used intentionally throughout the provider and utility layers.\n 'unicorn/no-for-each': 'off',\n // .then() chains in DAO and provider layers are often intentional.\n 'unicorn/prefer-await': 'warn',\n // Callback references (e.g. .map(Number)) are sometimes intentional.\n 'unicorn/no-array-callback-reference': 'warn',\n // toSorted() is ES2023 and may not be in all tsconfig lib targets.\n 'unicorn/no-array-sort': 'warn',\n // Early-return guard clauses are the established style; the rule only\n // rewrites the final guard of a ladder, which yields asymmetric mixed style\n // and long inline ternaries. Off in Mail-Meow and Edge-Sonic; canonical here\n // because it is the family's established style.\n 'unicorn/prefer-ternary': 'off',\n // `(await x).y` -> a named intermediate. Fires constantly in the tests,\n // where destructuring beside the assertion it serves is clearer.\n 'unicorn/no-await-expression-member': 'off',\n // `Number(x)` over `+x`: the `+` form is used where an explicit typeof check\n // has already narrowed the operand.\n 'unicorn/prefer-number-coercion': 'off',\n // Code-point iteration: the byte-level readers index deliberately, because\n // the offset *is* what they are reading.\n 'unicorn/prefer-code-point': 'off',\n // `if (!x) return;` over a compound condition: one guard per line, each with\n // its own comment, is what keeps endpoint guards readable.\n 'unicorn/prefer-simple-condition-first': 'off',\n // Module-scope `let` assigned from `beforeEach` in the test harnesses.\n 'unicorn/no-top-level-assignment-in-function': 'off',\n // Sequential `for...of` with `await` in the DAOs — D1's subrequest budget is\n // the scarce resource.\n 'unicorn/no-unreadable-for-of-expression': 'off',\n // `Object.hasOwn` over `in`: used where a prototype-chain hit is harmless.\n 'unicorn/no-computed-property-existence-check': 'off',\n // A labeled `break` out of two loops.\n 'unicorn/no-break-in-nested-loop': 'off',\n // `this` outside a class body: the module-level cache singletons document\n // their `this` contract in prose.\n 'unicorn/no-this-outside-of-class': 'off',\n // A class named inside its own static method.\n 'unicorn/class-reference-in-static-methods': 'off',\n // Assigning `globalThis.fetch` in a test — the only way to intercept the\n // ambient fetch in Node without a module mock.\n 'unicorn/no-global-object-property-assignment': 'off',\n // `(a ? b : c) && d`: written longhand so each precedence decision is\n // visible.\n 'unicorn/prefer-logical-operator-over-ternary': 'off',\n // `children[0]` in the XML helpers, which index a child list positionally.\n 'unicorn/better-dom-traversing': 'off',\n // `entries()` -> `keys()`/`values()`: the full entry is destructured.\n 'unicorn/prefer-iterator-to-array': 'off',\n // `.map(fn, thisArg)`: rejected on purpose.\n 'unicorn/no-array-method-this-argument': 'off',\n // A module-scope function that closes over nothing.\n 'unicorn/consistent-function-scoping': 'off',\n // `foo[0] === 'a' || foo[0] === 'b'` written longhand where the\n // alternatives are not adjacent.\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n // A `type` alias over an inline union, where the name is what makes the\n // signature and its doc comment readable.\n 'sonarjs/use-type-alias': 'off',\n // A short local alias for a type imported from a protocol package.\n 'sonarjs/redundant-type-aliases': 'off',\n // `type: value` narrowing the other way, where both spellings appear in the\n // same schema and the code follows whichever the spec uses there.\n 'sonarjs/no-nested-assignment': 'off',\n // `Number.isInteger` plus a separate range check, where the bounds come from\n // the caller's own options in one place.\n 'unicorn/prefer-number-is-safe-integer': 'off',\n // `\\u{...}` over a `\\xNN` escape: the table is written in the byte form the\n // spec prints.\n 'unicorn/prefer-unicode-code-point-escapes': 'off',\n // `self.x = this.x` in an entry model: the alias makes the verbatim\n // round-trip explicit.\n 'unicorn/no-this-assignment': 'off',\n // Building a `Set` at module scope from a constant list, for O(1) membership\n // on a path that runs per parameter.\n 'unicorn/no-top-level-side-effects': 'off',\n // A conditional whose branches are identical, kept where the two branches\n // are named separately to document that they are meant to diverge.\n 'sonarjs/no-all-duplicated-branches': 'off',\n // An `else` after a `return`: the flat form keeps the remaining cases at one\n // indent level in the dispatch tables.\n 'unicorn/prefer-else-if': 'off',\n // A nested ternary in a sort comparator, where the three-way order is the\n // point.\n 'unicorn/prefer-minimal-ternary': 'off',\n // `void promise` where initiating the call is the point and the rejection is\n // handled at a named site elsewhere.\n 'sonarjs/void-use': 'off',\n // `x === undefined` reported as always-true/false. With\n // `noUncheckedIndexedAccess` on, the guard is exactly right.\n 'sonarjs/different-types-comparison': 'off',\n // An accumulating loop with a sequential `await` in it, over D1 writes.\n 'unicorn/prefer-array-from-async': 'off',\n};\n\n/**\n * SonarJS rules the sources turned from errors into advisories, with the\n * threshold raised to a value that has actually held.\n */\nexport const SONARJS_RULES: Readonly<Record<string, unknown>> = {\n // Raise duplicate-string threshold to avoid flagging intentional repeated\n // literals like provider IDs.\n 'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],\n // Cognitive complexity — warn rather than error, so the ratchet can move\n // without a red build. Raise the number only as files are decomposed.\n 'sonarjs/cognitive-complexity': ['warn', 20],\n // False positives: connection method names like 'imap-password' and field\n // names like 'password_hash'.\n 'sonarjs/no-hardcoded-passwords': 'off',\n // Task markers are governed by `rexezuge/todo-format` (`TODO(<scope>): <text>` is the family form);\n // the stock tags flag even the scoped form, so every tracked gap became an error.\n 'sonarjs/todo-tag': 'off',\n 'sonarjs/fixme-tag': 'off',\n // Third-party deprecations are warnings, not errors.\n 'sonarjs/deprecation': 'warn',\n // Nested ternaries in complex data-mapping code.\n 'sonarjs/no-nested-conditional': 'warn',\n // React component props are commonly not marked Readonly<>.\n 'sonarjs/prefer-read-only-props': 'warn',\n // Static readonly properties require invasive refactoring.\n 'sonarjs/public-static-readonly': 'warn',\n // Nested template literals in SQL queries and prompt construction.\n 'sonarjs/no-nested-template-literals': 'warn',\n};\n\n/**\n * Test-suite overrides.\n *\n * `test/**` is deliberately *not* in the config's ignores list. Durable-DAV,\n * AWS and Mail-Meow all ignored it, and ~200 KB of test code had accumulated\n * violations that nothing reported. This block puts the suite back under the\n * same rules as the rest of the workspace and switches off only the handful\n * whose findings are structural artefacts of test code rather than defects.\n * It does not disable correctness rules: the unused-variable, dead-store,\n * regex and sorting findings in the suite are real and are fixed, not\n * suppressed.\n */\nexport const TEST_RULES: Readonly<Record<string, unknown>> = {\n // `it('…', async () => …)` is the Vitest idiom.\n '@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: { arguments: false, attributes: false } }],\n // Unbound method is a common false positive in mock assertions like\n // expect(fn).toHaveBeenCalledWith(...).\n '@typescript-eslint/unbound-method': 'off',\n // Test helpers and stubs routinely use async functions without await.\n '@typescript-eslint/require-await': 'off',\n // Redundant type constituents appear in typed mock stubs.\n '@typescript-eslint/no-redundant-type-constituents': 'off',\n // `as never` casts are the standard fake-DB double pattern in tests.\n '@typescript-eslint/no-unnecessary-type-assertion': 'off',\n // Promise.withResolvers() and function-scoping refactors are cosmetic.\n 'unicorn/prefer-promise-with-resolvers': 'off',\n 'unicorn/consistent-function-scoping': 'off',\n // Fake-DB builders push-then-return and sort without comparators.\n 'unicorn/no-return-array-push': 'off',\n 'unicorn/require-array-sort-compare': 'off',\n // Iterator-helper rewrites churn test fakes with no runtime benefit.\n 'unicorn/prefer-iterator-helpers': 'off',\n 'unicorn/prefer-iterator-to-array': 'off',\n // String replacement with test-driven values is intentional in assertions.\n 'unicorn/no-unsafe-string-replacement': 'off',\n // Fake-D1 doubles await a DAO thunk and call straight onto the result.\n 'unicorn/no-await-expression-member': 'off',\n // `void promise` marks a deliberately unawaited promise in a test.\n 'sonarjs/void-use': 'off',\n // A test asserting request routing has to name `http://` hosts, and a proxy\n // test has to name a loopback upstream. Both are the subject matter, not\n // leaked configuration. `unicorn/prefer-https` must stay off here and this\n // is not a style preference: it rewrites `http://` to `https://` *inside\n // string literals*, and `--fix` applies it silently.\n 'sonarjs/no-clear-text-protocols': 'off',\n 'sonarjs/no-hardcoded-ip': 'off',\n 'unicorn/prefer-https': 'off',\n // sonarjs/assertions-in-tests fires false positives when test helpers handle\n // assertions indirectly.\n 'sonarjs/assertions-in-tests': 'off',\n // sonarjs/no-extra-arguments fires incorrectly on Vitest mock overloads.\n 'sonarjs/no-extra-arguments': 'off',\n // Union/inline types in test fakes are more readable than aliases.\n 'sonarjs/use-type-alias': 'off',\n // Alphabetical-sort rule fights deterministic fixture ordering.\n 'sonarjs/no-alphabetical-sort': 'off',\n // Repeated string literals in fixtures/assertions are clearer inline.\n 'sonarjs/no-duplicate-string': 'off',\n // Fake-D1 doubles break out of a nested loop to model a statement miss.\n 'unicorn/no-break-in-nested-loop': 'off',\n // Fixtures are naturally built with sort()/for…of over composed expressions.\n 'unicorn/no-array-sort': 'off',\n 'unicorn/no-unreadable-for-of-expression': 'off',\n 'unicorn/no-useless-template-literals': 'off',\n 'unicorn/no-declarations-before-early-exit': 'off',\n 'unicorn/prefer-includes-over-repeated-comparisons': 'off',\n 'sonarjs/prefer-specific-assertions': 'off',\n 'sonarjs/no-inverted-boolean-check': 'off',\n};\n"],
5
+ "mappings": "AAaO,MAAMA,EAAsD,CACjE,oCAAqC,CAAC,QAAS,CAAE,kBAAmB,KAAM,kBAAmB,IAAI,CAAE,EAEnG,0CAA2C,CAAC,QAAS,CAAE,WAAY,EAAI,CAAE,EAIzE,qCAAsC,OACtC,0CAA2C,OAC3C,6CAA8C,OAC9C,oCAAqC,OACrC,sCAAuC,OACvC,wCAAyC,OAGzC,yCAA0C,CAAC,QAAS,CAAE,iBAAkB,CAAE,WAAY,GAAO,WAAY,EAAK,CAAE,CAAE,EAGlH,mCAAoC,MAGpC,oCAAqC,OAW1BC,EAAm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C,MAEpC,oDAAqD,MAErD,mDAAoD,MAEpD,wCAAyC,MACzC,sCAAuC,MAEvC,+BAAgC,MAChC,qCAAsC,MAEtC,kCAAmC,MACnC,mCAAoC,MAEpC,uCAAwC,MAExC,qCAAsC,MAEtC,mBAAoB,MAMpB,kCAAmC,MACnC,0BAA2B,MAC3B,uBAAwB,MAGxB,8BAA+B,MAE/B,6BAA8B,MAE9B,yBAA0B,MAE1B,+BAAgC,MAEhC,8BAA+B,MAE/B,kCAAmC,MAEnC,wBAAyB,MACzB,0CAA2C,MAC3C,uCAAwC,MACxC,4CAA6C,MAC7C,oDAAqD,MACrD,qCAAsC,MACtC,oCAAqC",
6
6
  "names": ["TYPESCRIPT_RULES", "UNICORN_RULES", "SONARJS_RULES", "TEST_RULES"]
7
7
  }
@@ -6,7 +6,7 @@ import type tseslint from 'typescript-eslint';
6
6
  *
7
7
  * Every rule here exists because a family repo once re-implemented something the
8
8
  * kit now owns; each message names the kit API to use instead. They use two
9
- * kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`)
9
+ * kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`, `rexezuge/todo-format`)
10
10
  * and `no-restricted-globals` rather than `no-restricted-imports` /
11
11
  * `no-restricted-syntax`: flat config replaces a rule's options per file instead
12
12
  * of merging them, so a strict entry in those two would silently erase the layer
@@ -21,6 +21,7 @@ export declare const REXEZUGE_PLUGIN: {
21
21
  rules: {
22
22
  'restricted-import': Rule.RuleModule;
23
23
  'no-hand-built-envelope': Rule.RuleModule;
24
+ 'todo-format': Rule.RuleModule;
24
25
  };
25
26
  };
26
27
  export declare const STRICT_IMPORT_BANS: readonly ImportBan[];
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-strict.d.ts","sourceRoot":"","sources":["../src/eslint-strict.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,mBAAm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AAa;IAC5B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;MAEE;IACF,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,EAAE,CAgDnE"}
@@ -1 +1,2 @@
1
- var y=Object.defineProperty;var s=(t,r)=>y(t,"name",{value:r,configurable:!0});const i=s(t=>typeof t=="object"&&t!==null?t:null,"asRecord");function g(t){const r=i(t.key);return r===null?null:r.type==="Identifier"&&typeof r.name=="string"?r.name:r.type==="Literal"&&typeof r.value=="string"?r.value:null}s(g,"keyName");const x={meta:{type:"problem",schema:[{type:"object",properties:{bans:{type:"array"}},additionalProperties:!1}],messages:{banned:"`{{specifier}}` is not allowed here. {{message}}"}},create(t){const r=t.options[0]?.bans??[],a=s((e,o)=>{if(typeof o!="string")return;const u=r.find(h=>h.names.some(m=>o===m||o.startsWith(`${m}/`)));u&&t.report({node:e,messageId:"banned",data:{specifier:o,message:u.message}})},"check"),n=s(e=>i(e)?.value,"literal");return{ImportDeclaration:s(e=>a(e,n(e.source)),"ImportDeclaration"),ExportAllDeclaration:s(e=>a(e,n(e.source)),"ExportAllDeclaration"),ExportNamedDeclaration:s(e=>a(e,n(e.source)),"ExportNamedDeclaration"),ImportExpression:s(e=>a(e,n(e.source)),"ImportExpression"),CallExpression:s(e=>{const o=i(e.callee);o?.type==="Identifier"&&o.name==="require"&&a(e,n(e.arguments[0]))},"CallExpression")}}},b={meta:{type:"problem",schema:[],messages:{handBuilt:"Do not hand-build the `{ Exception: { Type, Message } }` envelope. Throw a typed error from @rexezuge/errors and let the @rexezuge/http error mapper (createErrorHandler / ErrorMapper) produce it."}},create(t){return{Property(r){const a=r,n=i(a.value);if(g(a)!=="Exception"||n?.type!=="ObjectExpression")return;(Array.isArray(n.properties)?n.properties:[]).some(o=>o.type==="Property"&&g(o)==="Type")&&t.report({node:r,messageId:"handBuilt"})}}}},E={rules:{"restricted-import":x,"no-hand-built-envelope":b}},l=["**/*.{ts,mts,cts,tsx}"],I=["**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}"],c=["test/**","**/test/**","**/*.test.*","**/*.spec.*"],p=s(t=>t.map(r=>`${r}/**`),"under"),d=[{names:["jose"],message:"Verify Cloudflare Access tokens with accessAuth from @rexezuge/http (and forgeAccessJwt from @rexezuge/testing in tests)."},{names:["uuid","nanoid"],message:"Use UUIDUtil / CryptoIdGenerator from @rexezuge/shared (inject an IdGenerator so tests can fix it)."}],f={names:["hono","chanfana"],message:"The server framework lives in @rexezuge/http/hono and apps/api. Build the app with createApiApp; keep framework types out of other layers."};function v(t){const r=["apps/api",...t.httpDirs];return[{files:I,ignores:[...p(t.browserDirs),...c,"**/scripts/**"],rules:{"no-restricted-globals":["error",{name:"console",message:"Log through createLogger from @rexezuge/runtime: it redacts, levels and correlates. console.* is for apps/web and scripts only."}]}},{files:l,plugins:{rexezuge:E},rules:{}},{files:l,ignores:p(r),rules:{"rexezuge/restricted-import":["error",{bans:[f]}]}},{files:l,ignores:[...p(r),...c],rules:{"rexezuge/restricted-import":["error",{bans:[f,...d]}],"rexezuge/no-hand-built-envelope":"error"}},{files:["apps/api/**/*.{ts,mts,cts,tsx}"],ignores:[...p(t.httpDirs),...c],rules:{"rexezuge/restricted-import":["error",{bans:d}],"rexezuge/no-hand-built-envelope":"error"}}]}s(v,"strictConfigs");export{f as FRAMEWORK_BAN,E as REXEZUGE_PLUGIN,d as STRICT_IMPORT_BANS,v as strictConfigs};
1
+ var x=Object.defineProperty;var o=(r,e)=>x(r,"name",{value:e,configurable:!0});const i=o(r=>typeof r=="object"&&r!==null?r:null,"asRecord");function m(r){const e=i(r.key);return e===null?null:e.type==="Identifier"&&typeof e.name=="string"?e.name:e.type==="Literal"&&typeof e.value=="string"?e.value:null}o(m,"keyName");const b={meta:{type:"problem",schema:[{type:"object",properties:{bans:{type:"array"}},additionalProperties:!1}],messages:{banned:"`{{specifier}}` is not allowed here. {{message}}"}},create(r){const e=r.options[0]?.bans??[],n=o((t,a)=>{if(typeof a!="string")return;const l=e.find(y=>y.names.some(u=>a===u||a.startsWith(`${u}/`)));l&&r.report({node:t,messageId:"banned",data:{specifier:a,message:l.message}})},"check"),s=o(t=>i(t)?.value,"literal");return{ImportDeclaration:o(t=>n(t,s(t.source)),"ImportDeclaration"),ExportAllDeclaration:o(t=>n(t,s(t.source)),"ExportAllDeclaration"),ExportNamedDeclaration:o(t=>n(t,s(t.source)),"ExportNamedDeclaration"),ImportExpression:o(t=>n(t,s(t.source)),"ImportExpression"),CallExpression:o(t=>{const a=i(t.callee);a?.type==="Identifier"&&a.name==="require"&&n(t,s(t.arguments[0]))},"CallExpression")}}},E={meta:{type:"problem",schema:[],messages:{handBuilt:"Do not hand-build the `{ Exception: { Type, Message } }` envelope. Throw a typed error from @rexezuge/errors and let the @rexezuge/http error mapper (createErrorHandler / ErrorMapper) produce it."}},create(r){return{Property(e){const n=e,s=i(n.value);if(m(n)!=="Exception"||s?.type!=="ObjectExpression")return;(Array.isArray(s.properties)?s.properties:[]).some(a=>a.type==="Property"&&m(a)==="Type")&&r.report({node:e,messageId:"handBuilt"})}}}},I=/^[\s*/]*(TODO|FIXME)\b(.*)$/,T=/^\([^()\s]+\):\s*\S/,z={meta:{type:"suggestion",schema:[],messages:{bare:"`{{tag}}` needs a scope and a description: `{{tag}}(<scope>): <what is to be done>`."}},create(r){return{Program(){for(const e of r.sourceCode.getAllComments())for(const n of e.value.split(`
2
+ `)){const s=I.exec(n);s===null||T.test(s[2]??"")||r.report({loc:e.loc??{line:1,column:0},messageId:"bare",data:{tag:s[1]??"TODO"}})}}}}},A={rules:{"restricted-import":b,"no-hand-built-envelope":E,"todo-format":z}},g=["**/*.{ts,mts,cts,tsx}"],d=["**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}"],c=["test/**","**/test/**","**/*.test.*","**/*.spec.*"],p=o(r=>r.map(e=>`${e}/**`),"under"),f=[{names:["jose"],message:"Verify Cloudflare Access tokens with accessAuth from @rexezuge/http (and forgeAccessJwt from @rexezuge/testing in tests)."},{names:["uuid","nanoid"],message:"Use UUIDUtil / CryptoIdGenerator from @rexezuge/shared (inject an IdGenerator so tests can fix it)."}],h={names:["hono","chanfana"],message:"The server framework lives in @rexezuge/http/hono and apps/api. Build the app with createApiApp; keep framework types out of other layers."};function v(r){const e=["apps/api",...r.httpDirs];return[{files:d,ignores:[...p(r.browserDirs),...c,"**/scripts/**"],rules:{"no-restricted-globals":["error",{name:"console",message:"Log through createLogger from @rexezuge/runtime: it redacts, levels and correlates. console.* is for apps/web and scripts only."}]}},{files:d,plugins:{rexezuge:A},rules:{"rexezuge/todo-format":"error"}},{files:g,ignores:p(e),rules:{"rexezuge/restricted-import":["error",{bans:[h]}]}},{files:g,ignores:[...p(e),...c],rules:{"rexezuge/restricted-import":["error",{bans:[h,...f]}],"rexezuge/no-hand-built-envelope":"error"}},{files:["apps/api/**/*.{ts,mts,cts,tsx}"],ignores:[...p(r.httpDirs),...c],rules:{"rexezuge/restricted-import":["error",{bans:f}],"rexezuge/no-hand-built-envelope":"error"}}]}o(v,"strictConfigs");export{h as FRAMEWORK_BAN,A as REXEZUGE_PLUGIN,f as STRICT_IMPORT_BANS,v as strictConfigs};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/eslint-strict.ts"],
4
- "sourcesContent": ["import type { Rule } from 'eslint';\nimport type tseslint from 'typescript-eslint';\n\n/**\n * The family's **strict side** of the lint config: rules a repo cannot switch\n * off wholesale, only waive per file with an `eslint-disable` comment.\n *\n * Every rule here exists because a family repo once re-implemented something the\n * kit now owns; each message names the kit API to use instead. They use two\n * kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`)\n * and `no-restricted-globals` rather than `no-restricted-imports` /\n * `no-restricted-syntax`: flat config replaces a rule's options per file instead\n * of merging them, so a strict entry in those two would silently erase the layer\n * boundaries (or be erased by them) wherever the globs overlap.\n */\n\ntype ConfigInput = Parameters<typeof tseslint.config>[number];\n\ninterface ImportBan {\n readonly names: readonly string[];\n readonly message: string;\n}\n\ninterface Node {\n readonly type: string;\n readonly [key: string]: unknown;\n}\n\nconst asRecord = (value: unknown): Record<string, unknown> | null =>\n typeof value === 'object' && value !== null ? (value as Record<string, unknown>) : null;\n\nfunction keyName(property: Record<string, unknown>): string | null {\n const key = asRecord(property.key);\n if (key === null) return null;\n if (key.type === 'Identifier' && typeof key.name === 'string') return key.name;\n return key.type === 'Literal' && typeof key.value === 'string' ? key.value : null;\n}\n\n/**\n * Flags a module specifier (static, re-export, dynamic `import()` or `require`)\n * that equals, or is a subpath of, a banned name. Type-only imports are flagged\n * too: a framework type leaking across a layer is the failure being prevented.\n */\nconst restrictedImport: Rule.RuleModule = {\n meta: {\n type: 'problem',\n schema: [{ type: 'object', properties: { bans: { type: 'array' } }, additionalProperties: false }],\n messages: { banned: '`{{specifier}}` is not allowed here. {{message}}' },\n },\n create(context) {\n const bans = ((context.options[0] as { bans?: ImportBan[] } | undefined)?.bans ?? []) as readonly ImportBan[];\n const check = (node: Rule.Node, specifier: unknown): void => {\n if (typeof specifier !== 'string') return;\n const hit = bans.find((ban) => ban.names.some((name) => specifier === name || specifier.startsWith(`${name}/`)));\n if (hit) context.report({ node, messageId: 'banned', data: { specifier, message: hit.message } });\n };\n const literal = (source: unknown): unknown => asRecord(source)?.value;\n return {\n ImportDeclaration: (node) => check(node, literal(node.source)),\n ExportAllDeclaration: (node) => check(node, literal(node.source)),\n ExportNamedDeclaration: (node) => check(node, literal(node.source)),\n ImportExpression: (node) => check(node, literal(node.source)),\n CallExpression: (node) => {\n const callee = asRecord(node.callee);\n if (callee?.type === 'Identifier' && callee.name === 'require') check(node, literal(node.arguments[0]));\n },\n };\n },\n};\n\n/**\n * Flags an object literal shaped `{ Exception: { Type, … } }`: the family error\n * envelope, built by hand. The envelope is produced by the kit's error mapper\n * from a thrown typed error, so a hand-built one skips redaction and the\n * status/type mapping.\n */\nconst noHandBuiltEnvelope: Rule.RuleModule = {\n meta: {\n type: 'problem',\n schema: [],\n messages: {\n handBuilt:\n 'Do not hand-build the `{ Exception: { Type, Message } }` envelope. Throw a typed error from @rexezuge/errors and let the @rexezuge/http error mapper (createErrorHandler / ErrorMapper) produce it.',\n },\n },\n create(context) {\n return {\n Property(node) {\n const property = node as unknown as Record<string, unknown>;\n const value = asRecord(property.value);\n if (keyName(property) !== 'Exception' || value?.type !== 'ObjectExpression') return;\n const inner = Array.isArray(value.properties) ? (value.properties as Node[]) : [];\n if (inner.some((entry) => entry.type === 'Property' && keyName(entry) === 'Type')) context.report({ node, messageId: 'handBuilt' });\n },\n };\n },\n};\n\nexport const REXEZUGE_PLUGIN = { rules: { 'restricted-import': restrictedImport, 'no-hand-built-envelope': noHandBuiltEnvelope } };\n\nconst TS_FILES = ['**/*.{ts,mts,cts,tsx}'];\nconst SOURCE_FILES = ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'];\n/**\nTests, mocks and fixtures: they may spy on `console`, sign tokens, assert the envelope.\n*/\nconst TEST_GLOBS = ['test/**', '**/test/**', '**/*.test.*', '**/*.spec.*'];\n\nconst under = (dirs: readonly string[]): string[] => dirs.map((dir) => `${dir}/**`);\n\nexport const STRICT_IMPORT_BANS: readonly ImportBan[] = [\n {\n names: ['jose'],\n message: 'Verify Cloudflare Access tokens with accessAuth from @rexezuge/http (and forgeAccessJwt from @rexezuge/testing in tests).',\n },\n {\n names: ['uuid', 'nanoid'],\n message: 'Use UUIDUtil / CryptoIdGenerator from @rexezuge/shared (inject an IdGenerator so tests can fix it).',\n },\n];\n\nexport const FRAMEWORK_BAN: ImportBan = {\n names: ['hono', 'chanfana'],\n message:\n 'The server framework lives in @rexezuge/http/hono and apps/api. Build the app with createApiApp; keep framework types out of other layers.',\n};\n\nexport interface StrictOptions {\n /**\n * Directories that are the http layer: they may import hono/chanfana, jose and build envelopes\n * themselves. `apps/api` may import the framework too, but never the rest: it uses the kit.\n */\n readonly httpDirs: readonly string[];\n /**\n Directories where `console` is allowed.\n */\n readonly browserDirs: readonly string[];\n}\n\n/**\n * The strict rule blocks. Appended after the layer rules; a consumer's own later\n * blocks (and per-file `eslint-disable` comments) are the only way to waive them.\n */\nexport function strictConfigs(options: StrictOptions): ConfigInput[] {\n const http = ['apps/api', ...options.httpDirs];\n return [\n {\n files: SOURCE_FILES,\n ignores: [...under(options.browserDirs), ...TEST_GLOBS, '**/scripts/**'],\n rules: {\n 'no-restricted-globals': [\n 'error',\n {\n name: 'console',\n message:\n 'Log through createLogger from @rexezuge/runtime: it redacts, levels and correlates. console.* is for apps/web and scripts only.',\n },\n ],\n },\n },\n {\n files: TS_FILES,\n plugins: { rexezuge: REXEZUGE_PLUGIN },\n rules: {},\n },\n // Rules of one name replace each other per file, so each region states its\n // whole ban list: framework + kit outside the http layer and apps/api (the\n // framework is allowed there), kit only inside apps/api, framework only in\n // tests.\n {\n files: TS_FILES,\n ignores: under(http),\n rules: { 'rexezuge/restricted-import': ['error', { bans: [FRAMEWORK_BAN] }] },\n },\n {\n files: TS_FILES,\n ignores: [...under(http), ...TEST_GLOBS],\n rules: {\n 'rexezuge/restricted-import': ['error', { bans: [FRAMEWORK_BAN, ...STRICT_IMPORT_BANS] }],\n 'rexezuge/no-hand-built-envelope': 'error',\n },\n },\n {\n files: ['apps/api/**/*.{ts,mts,cts,tsx}'],\n ignores: [...under(options.httpDirs), ...TEST_GLOBS],\n rules: {\n 'rexezuge/restricted-import': ['error', { bans: STRICT_IMPORT_BANS }],\n 'rexezuge/no-hand-built-envelope': 'error',\n },\n },\n ];\n}\n"],
5
- "mappings": "+EA4BA,MAAMA,EAAWC,EAACC,GAChB,OAAOA,GAAU,UAAYA,IAAU,KAAQA,EAAoC,KADpE,YAGjB,SAASC,EAAQC,EAAiC,CAChD,MAAMC,EAAML,EAASI,EAAS,GAAG,EACjC,OAAIC,IAAQ,KAAa,KACr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ACE,MAAOC,EACP,QAASG,EAAMO,CAAI,EACnB,MAAO,CAAE,6BAA8B,CAAC,QAAS,CAAE,KAAM,CAACH,CAAa,CAAC,CAAE,CAAC,GAE7E,CACE,MAAOP,EACP,QAAS,CAAC,GAAGG,EAAMO,CAAI,EAAG,GAAGR,CAAU,EACvC,MAAO,CACL,6BAA8B,CAAC,QAAS,CAAE,KAAM,CAACK,EAAe,GAAGD,CAAkB,CAAC,CAAE,EACxF,kCAAmC,UAGvC,CACE,MAAO,CAAC,gCAAgC,EACxC,QAAS,CAAC,GAAGH,EAAMM,EAAQ,QAAQ,EAAG,GAAGP,CAAU,EACnD,MAAO,CACL,6BAA8B,CAAC,QAAS,CAAE,KAAMI,CAAkB,CAAE,EACpE,kCAAmC,UAI3C,CAhDgB1B,EAAA4B,EAAA",
6
- "names": ["asRecord", "__name", "value", "keyName", "property", "key", "restrictedImport", "context", "bans", "check", "node", "specifier", "hit", "ban", "name", "literal", "source", "callee", "noHandBuiltEnvelope", "entry", "REXEZUGE_PLUGIN", "TS_FILES", "SOURCE_FILES", "TEST_GLOBS", "under", "dirs", "dir", "STRICT_IMPORT_BANS", "FRAMEWORK_BAN", "strictConfigs", "options", "http"]
4
+ "sourcesContent": ["import type { Rule } from 'eslint';\nimport type tseslint from 'typescript-eslint';\n\n/**\n * The family's **strict side** of the lint config: rules a repo cannot switch\n * off wholesale, only waive per file with an `eslint-disable` comment.\n *\n * Every rule here exists because a family repo once re-implemented something the\n * kit now owns; each message names the kit API to use instead. They use two\n * kit-local rules (`rexezuge/restricted-import`, `rexezuge/no-hand-built-envelope`, `rexezuge/todo-format`)\n * and `no-restricted-globals` rather than `no-restricted-imports` /\n * `no-restricted-syntax`: flat config replaces a rule's options per file instead\n * of merging them, so a strict entry in those two would silently erase the layer\n * boundaries (or be erased by them) wherever the globs overlap.\n */\n\ntype ConfigInput = Parameters<typeof tseslint.config>[number];\n\ninterface ImportBan {\n readonly names: readonly string[];\n readonly message: string;\n}\n\ninterface Node {\n readonly type: string;\n readonly [key: string]: unknown;\n}\n\nconst asRecord = (value: unknown): Record<string, unknown> | null =>\n typeof value === 'object' && value !== null ? (value as Record<string, unknown>) : null;\n\nfunction keyName(property: Record<string, unknown>): string | null {\n const key = asRecord(property.key);\n if (key === null) return null;\n if (key.type === 'Identifier' && typeof key.name === 'string') return key.name;\n return key.type === 'Literal' && typeof key.value === 'string' ? key.value : null;\n}\n\n/**\n * Flags a module specifier (static, re-export, dynamic `import()` or `require`)\n * that equals, or is a subpath of, a banned name. Type-only imports are flagged\n * too: a framework type leaking across a layer is the failure being prevented.\n */\nconst restrictedImport: Rule.RuleModule = {\n meta: {\n type: 'problem',\n schema: [{ type: 'object', properties: { bans: { type: 'array' } }, additionalProperties: false }],\n messages: { banned: '`{{specifier}}` is not allowed here. {{message}}' },\n },\n create(context) {\n const bans = ((context.options[0] as { bans?: ImportBan[] } | undefined)?.bans ?? []) as readonly ImportBan[];\n const check = (node: Rule.Node, specifier: unknown): void => {\n if (typeof specifier !== 'string') return;\n const hit = bans.find((ban) => ban.names.some((name) => specifier === name || specifier.startsWith(`${name}/`)));\n if (hit) context.report({ node, messageId: 'banned', data: { specifier, message: hit.message } });\n };\n const literal = (source: unknown): unknown => asRecord(source)?.value;\n return {\n ImportDeclaration: (node) => check(node, literal(node.source)),\n ExportAllDeclaration: (node) => check(node, literal(node.source)),\n ExportNamedDeclaration: (node) => check(node, literal(node.source)),\n ImportExpression: (node) => check(node, literal(node.source)),\n CallExpression: (node) => {\n const callee = asRecord(node.callee);\n if (callee?.type === 'Identifier' && callee.name === 'require') check(node, literal(node.arguments[0]));\n },\n };\n },\n};\n\n/**\n * Flags an object literal shaped `{ Exception: { Type, … } }`: the family error\n * envelope, built by hand. The envelope is produced by the kit's error mapper\n * from a thrown typed error, so a hand-built one skips redaction and the\n * status/type mapping.\n */\nconst noHandBuiltEnvelope: Rule.RuleModule = {\n meta: {\n type: 'problem',\n schema: [],\n messages: {\n handBuilt:\n 'Do not hand-build the `{ Exception: { Type, Message } }` envelope. Throw a typed error from @rexezuge/errors and let the @rexezuge/http error mapper (createErrorHandler / ErrorMapper) produce it.',\n },\n },\n create(context) {\n return {\n Property(node) {\n const property = node as unknown as Record<string, unknown>;\n const value = asRecord(property.value);\n if (keyName(property) !== 'Exception' || value?.type !== 'ObjectExpression') return;\n const inner = Array.isArray(value.properties) ? (value.properties as Node[]) : [];\n if (inner.some((entry) => entry.type === 'Property' && keyName(entry) === 'Type')) context.report({ node, messageId: 'handBuilt' });\n },\n };\n },\n};\n\n/**\n * A task marker is `TODO(<scope>): <text>` (or `FIXME(...)`): who or what it waits on, and what is to be done.\n * A bare `TODO`, `TODO:` or `TODO(sdk)` with no text is a note nobody can act on, so it is an error.\n * Only a marker that starts a comment line is a marker, so prose that mentions the word is left alone.\n * This replaces `sonarjs/todo-tag` and `sonarjs/fixme-tag`, which flagged the scoped form too.\n */\nconst TODO_MARKER = /^[\\s*/]*(TODO|FIXME)\\b(.*)$/;\nconst TODO_FORMAT = /^\\([^()\\s]+\\):\\s*\\S/;\n\nconst todoFormat: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n schema: [],\n messages: { bare: '`{{tag}}` needs a scope and a description: `{{tag}}(<scope>): <what is to be done>`.' },\n },\n create(context) {\n return {\n Program() {\n for (const comment of context.sourceCode.getAllComments()) {\n for (const line of comment.value.split('\\n')) {\n const match = TODO_MARKER.exec(line);\n if (match === null || TODO_FORMAT.test(match[2] ?? '')) continue;\n context.report({ loc: comment.loc ?? { line: 1, column: 0 }, messageId: 'bare', data: { tag: match[1] ?? 'TODO' } });\n }\n }\n },\n };\n },\n};\n\nexport const REXEZUGE_PLUGIN = {\n rules: { 'restricted-import': restrictedImport, 'no-hand-built-envelope': noHandBuiltEnvelope, 'todo-format': todoFormat },\n};\n\nconst TS_FILES = ['**/*.{ts,mts,cts,tsx}'];\nconst SOURCE_FILES = ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'];\n/**\nTests, mocks and fixtures: they may spy on `console`, sign tokens, assert the envelope.\n*/\nconst TEST_GLOBS = ['test/**', '**/test/**', '**/*.test.*', '**/*.spec.*'];\n\nconst under = (dirs: readonly string[]): string[] => dirs.map((dir) => `${dir}/**`);\n\nexport const STRICT_IMPORT_BANS: readonly ImportBan[] = [\n {\n names: ['jose'],\n message: 'Verify Cloudflare Access tokens with accessAuth from @rexezuge/http (and forgeAccessJwt from @rexezuge/testing in tests).',\n },\n {\n names: ['uuid', 'nanoid'],\n message: 'Use UUIDUtil / CryptoIdGenerator from @rexezuge/shared (inject an IdGenerator so tests can fix it).',\n },\n];\n\nexport const FRAMEWORK_BAN: ImportBan = {\n names: ['hono', 'chanfana'],\n message:\n 'The server framework lives in @rexezuge/http/hono and apps/api. Build the app with createApiApp; keep framework types out of other layers.',\n};\n\nexport interface StrictOptions {\n /**\n * Directories that are the http layer: they may import hono/chanfana, jose and build envelopes\n * themselves. `apps/api` may import the framework too, but never the rest: it uses the kit.\n */\n readonly httpDirs: readonly string[];\n /**\n Directories where `console` is allowed.\n */\n readonly browserDirs: readonly string[];\n}\n\n/**\n * The strict rule blocks. Appended after the layer rules; a consumer's own later\n * blocks (and per-file `eslint-disable` comments) are the only way to waive them.\n */\nexport function strictConfigs(options: StrictOptions): ConfigInput[] {\n const http = ['apps/api', ...options.httpDirs];\n return [\n {\n files: SOURCE_FILES,\n ignores: [...under(options.browserDirs), ...TEST_GLOBS, '**/scripts/**'],\n rules: {\n 'no-restricted-globals': [\n 'error',\n {\n name: 'console',\n message:\n 'Log through createLogger from @rexezuge/runtime: it redacts, levels and correlates. console.* is for apps/web and scripts only.',\n },\n ],\n },\n },\n {\n files: SOURCE_FILES,\n plugins: { rexezuge: REXEZUGE_PLUGIN },\n rules: { 'rexezuge/todo-format': 'error' },\n },\n // Rules of one name replace each other per file, so each region states its\n // whole ban list: framework + kit outside the http layer and apps/api (the\n // framework is allowed there), kit only inside apps/api, framework only in\n // tests.\n {\n files: TS_FILES,\n ignores: under(http),\n rules: { 'rexezuge/restricted-import': ['error', { bans: [FRAMEWORK_BAN] }] },\n },\n {\n files: TS_FILES,\n ignores: [...under(http), ...TEST_GLOBS],\n rules: {\n 'rexezuge/restricted-import': ['error', { bans: [FRAMEWORK_BAN, ...STRICT_IMPORT_BANS] }],\n 'rexezuge/no-hand-built-envelope': 'error',\n },\n },\n {\n files: ['apps/api/**/*.{ts,mts,cts,tsx}'],\n ignores: [...under(options.httpDirs), ...TEST_GLOBS],\n rules: {\n 'rexezuge/restricted-import': ['error', { bans: STRICT_IMPORT_BANS }],\n 'rexezuge/no-hand-built-envelope': 'error',\n },\n },\n ];\n}\n"],
5
+ "mappings": "+EA4BA,MAAMA,EAAWC,EAACC,GAChB,OAAOA,GAAU,UAAYA,IAAU,KAAQA,EAAoC,KADpE,YAGjB,SAASC,EAAQC,EAAiC,CAChD,MAAMC,EAAML,EAASI,EAAS,GAAG,EACjC,OAAIC,IAAQ,KAAa,KACrBA,EAAI,OAAS,cAAgB,OAAOA,EAAI,MAAS,SAAiBA,EAAI,KACnEA,EAAI,OAAS,WAAa,OAAOA,EAAI,OAAU,SAAWA,EAAI,MAAQ,IAC/E,CALSJ,EAAAE,EAAA,WAYT,MAAMG,EAAoC,CACxC,KAAM,CACJ,KAAM,UACN,OAAQ,CAAC,CAAE,KAAM,SAAU,WAAY,CAAE,KAAM,CAAE,KAAM,OAAO,CAAE,EAAI,qBAAsB,EAAK,CAAE,EACjG,SAAU,CAAE,OAAQ,kDAAkD,GAExE,OAAOC,EAAO,CACZ,MAAMC,EAASD,EAAQ,QAAQ,CAAC,GAA0C,MAAQ,CAAA,EAC5EE,EAAQR,EAAA,CAACS,EAAiBC,IAA4B,CAC1D,GAAI,OAAOA,GAAc,SAAU,OACnC,MAAMC,EAAMJ,EAAK,KAAMK,GAAQA,EAAI,MAAM,KAAMC,GAASH,IAAcG,GAAQH,EAAU,WAAW,GAAGG,CAAI,GAAG,CAAC,CAAC,EAC3GF,GAAKL,EAAQ,OAAO,CAAE,KAA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,CAAC,CAAE,CAAC,GAE7E,CACE,MAAOP,EACP,QAAS,CAAC,GAAGG,EAAMO,CAAI,EAAG,GAAGR,CAAU,EACvC,MAAO,CACL,6BAA8B,CAAC,QAAS,CAAE,KAAM,CAACK,EAAe,GAAGD,CAAkB,CAAC,CAAE,EACxF,kCAAmC,UAGvC,CACE,MAAO,CAAC,gCAAgC,EACxC,QAAS,CAAC,GAAGH,EAAMM,EAAQ,QAAQ,EAAG,GAAGP,CAAU,EACnD,MAAO,CACL,6BAA8B,CAAC,QAAS,CAAE,KAAMI,CAAkB,CAAE,EACpE,kCAAmC,UAI3C,CAhDgBhC,EAAAkC,EAAA",
6
+ "names": ["asRecord", "__name", "value", "keyName", "property", "key", "restrictedImport", "context", "bans", "check", "node", "specifier", "hit", "ban", "name", "literal", "source", "callee", "noHandBuiltEnvelope", "entry", "TODO_MARKER", "TODO_FORMAT", "todoFormat", "comment", "line", "match", "REXEZUGE_PLUGIN", "TS_FILES", "SOURCE_FILES", "TEST_GLOBS", "under", "dirs", "dir", "STRICT_IMPORT_BANS", "FRAMEWORK_BAN", "strictConfigs", "options", "http"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-validate.d.ts","sourceRoot":"","sources":["../src/manifest-validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExE;;EAEE;AACF,eAAO,MAAM,sBAAsB;;;CAAoC,CAAC;AAkLxE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAcnE"}
1
+ {"version":3,"file":"manifest-validate.d.ts","sourceRoot":"","sources":["../src/manifest-validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExE;;EAEE;AACF,eAAO,MAAM,sBAAsB;;;CAAoC,CAAC;AA+MxE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAcnE"}
@@ -1 +1 @@
1
- var b=Object.defineProperty;var o=(s,t)=>b(s,"name",{value:t,configurable:!0});const m={soft:300,hard:400},u=o(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"isObj"),c=/^@[a-z0-9][a-z0-9-]*$/,l=/^[a-z][a-z0-9-]*$/,y=["lines","branches","functions","statements"];class g{static{o(this,"Check")}errors=[];fail(t,e){this.errors.push(`${t}: ${e}`)}keys(t,e,i){for(const r of Object.keys(e))i.includes(r)||this.fail(`${t}.${r}`,`unknown key (allowed: ${i.join(", ")})`)}obj(t,e){return u(e)?e:(this.fail(t,"must be an object"),null)}str(t,e,i,r){return typeof e!="string"||e===""?(this.fail(t,"must be a non-empty string"),!1):i&&!i.test(e)?(this.fail(t,`${JSON.stringify(e)} is invalid${r?` (${r})`:""}`),!1):!0}bool(t,e){typeof e!="boolean"&&this.fail(t,"must be a boolean")}strings(t,e){return!Array.isArray(e)||e.some(i=>typeof i!="string"||i==="")?(this.fail(t,"must be an array of non-empty strings"),!1):!0}}function p(s,t){const e=s.obj("features",t);if(e){if(s.keys("features",e,["d1","web","background","backupD1","durableObjects","queues","workflows","email","android"]),e.d1!==void 0){const i=s.obj("features.d1",e.d1);i&&(s.keys("features.d1",i,["binding","database","migrationsDir"]),s.str("features.d1.binding",i.binding,/^[A-Z][A-Z0-9_]*$/,"an UPPER_SNAKE binding name"),s.str("features.d1.database",i.database),i.migrationsDir!==void 0&&s.str("features.d1.migrationsDir",i.migrationsDir))}if(e.web!==void 0){const i=s.obj("features.web",e.web);i&&(s.keys("features.web",i,["pages","spaShell"]),s.bool("features.web.pages",i.pages),s.bool("features.web.spaShell",i.spaShell))}for(const i of["background","backupD1","email","android"])e[i]!==void 0&&s.bool(`features.${i}`,e[i]);for(const i of["durableObjects","queues","workflows"])e[i]!==void 0&&s.strings(`features.${i}`,e[i])}}o(p,"checkFeatures");function h(s,t,e){s.keys(t,e,["name","dir","package","mayImport","typeOnly","forbid","forbidMessage","http","browser"]),s.str(`${t}.name`,e.name,l,"lower-case letters, digits and hyphens"),s.str(`${t}.dir`,e.dir)&&(/[*?{}]/.test(e.dir)||e.dir.startsWith("/")||e.dir.split("/").includes(".."))&&s.fail(`${t}.dir`,`${JSON.stringify(e.dir)} must be a repo-relative directory without globs`),e.package!==void 0&&s.str(`${t}.package`,e.package),e.forbidMessage!==void 0&&s.str(`${t}.forbidMessage`,e.forbidMessage);for(const i of["mayImport","typeOnly","forbid"])(e[i]!==void 0||i==="mayImport")&&s.strings(`${t}.${i}`,e[i]);for(const i of["http","browser"])e[i]!==void 0&&s.bool(`${t}.${i}`,e[i])}o(h,"checkLayer");function $(s,t){if(!Array.isArray(t)){s.fail("layers","must be an array of layers");return}const e=new Set,i=new Set;t.forEach((r,f)=>{const a=`layers[${f}]`,n=s.obj(a,r);n&&(h(s,a,n),typeof n.name=="string"&&(e.has(n.name)&&s.fail(`${a}.name`,`duplicate layer name ${JSON.stringify(n.name)}`),e.add(n.name)),typeof n.dir=="string"&&(i.has(n.dir)&&s.fail(`${a}.dir`,`duplicate layer dir ${JSON.stringify(n.dir)}`),i.add(n.dir)))}),t.forEach((r,f)=>{if(u(r))for(const a of["mayImport","typeOnly"]){const n=r[a];if(Array.isArray(n))for(const d of n)typeof d=="string"&&!e.has(d)&&s.fail(`layers[${f}].${a}`,`unknown layer ${JSON.stringify(d)}`),a==="typeOnly"&&Array.isArray(r.mayImport)&&r.mayImport.includes(d)&&s.fail(`layers[${f}].typeOnly`,`${JSON.stringify(d)} is already in mayImport`)}})}o($,"checkLayers");function k(s,t){const e=s.obj("quality",t);e&&(s.keys("quality",e,["coverage","godFiles"]),e.coverage!==void 0&&j(s,e.coverage),e.godFiles!==void 0&&w(s,e.godFiles))}o(k,"checkQuality");function w(s,t){const e=s.obj("quality.godFiles",t);if(e){s.keys("quality.godFiles",e,["soft","hard"]);for(const i of["soft","hard"]){const r=e[i],f=m[i];!Number.isInteger(r)||r<1?s.fail(`quality.godFiles.${i}`,"must be a positive integer"):r>f&&s.fail(`quality.godFiles.${i}`,`${String(r)} is above the family limit ${f}: god-file limits may only be lowered`)}typeof e.soft=="number"&&typeof e.hard=="number"&&e.soft>e.hard&&s.fail("quality.godFiles.soft","must not exceed quality.godFiles.hard")}}o(w,"checkGodFiles");function j(s,t){const e=s.obj("quality.coverage",t);if(e){s.keys("quality.coverage",e,y);for(const i of y){const r=e[i];(typeof r!="number"||!(r>=0&&r<=100))&&s.fail(`quality.coverage.${i}`,"must be a number from 0 to 100")}}}o(j,"checkCoverage");function O(s,t){const e=s.obj("extensions",t);if(e)for(const[i,r]of Object.entries(e))l.test(i)||s.fail(`extensions.${i}`,"namespace must be lower-case letters, digits and hyphens"),u(r)||s.fail(`extensions.${i}`,"must be an object (extensions are namespaced: one object per owner)")}o(O,"checkExtensions");function A(s){const t=new g,e=t.obj("manifest",s);return e&&(t.keys("manifest",e,["$schema","name","scope","features","layers","quality","extensions"]),e.$schema!==void 0&&t.str("$schema",e.$schema),t.str("name",e.name),t.str("scope",e.scope,c,'an npm scope such as "@mail-meow"'),e.features!==void 0&&p(t,e.features),e.layers!==void 0&&$(t,e.layers),e.quality!==void 0&&k(t,e.quality),e.extensions!==void 0&&O(t,e.extensions)),t.errors.length>0?{ok:!1,errors:t.errors}:{ok:!0,manifest:s}}o(A,"validateManifest");export{m as FAMILY_GOD_FILE_LIMITS,A as validateManifest};
1
+ var c=Object.defineProperty;var o=(s,t)=>c(s,"name",{value:t,configurable:!0});const m={soft:300,hard:400},u=o(s=>typeof s=="object"&&s!==null&&!Array.isArray(s),"isObj"),y=/^@[a-z0-9][a-z0-9-]*$/,l=/^[a-z][a-z0-9-]*$/,b=["lines","branches","functions","statements"];class g{static{o(this,"Check")}errors=[];fail(t,e){this.errors.push(`${t}: ${e}`)}keys(t,e,i){for(const n of Object.keys(e))i.includes(n)||this.fail(`${t}.${n}`,`unknown key (allowed: ${i.join(", ")})`)}obj(t,e){return u(e)?e:(this.fail(t,"must be an object"),null)}str(t,e,i,n){return typeof e!="string"||e===""?(this.fail(t,"must be a non-empty string"),!1):i&&!i.test(e)?(this.fail(t,`${JSON.stringify(e)} is invalid${n?` (${n})`:""}`),!1):!0}bool(t,e){typeof e!="boolean"&&this.fail(t,"must be a boolean")}strings(t,e){return!Array.isArray(e)||e.some(i=>typeof i!="string"||i==="")?(this.fail(t,"must be an array of non-empty strings"),!1):!0}}const p=/^[A-Z][A-Z0-9_]*$/;function k(s,t){const e=s.obj("features.kv",t);if(!e)return;s.keys("features.kv",e,["bindings","namespaceNames"]);const i=s.strings("features.kv.bindings",e.bindings)?e.bindings:[];for(const a of i)s.str("features.kv.bindings",a,p,"an UPPER_SNAKE binding name");if(e.namespaceNames===void 0)return;const n=s.obj("features.kv.namespaceNames",e.namespaceNames);if(n)for(const[a,f]of Object.entries(n)){const r=`features.kv.namespaceNames.${a}`;i.includes(a)||s.fail(r,"is not listed in features.kv.bindings"),s.str(r,f)}}o(k,"checkKv");function h(s,t){const e=s.obj("features",t);if(e){if(s.keys("features",e,["d1","kv","web","background","backupD1","durableObjects","queues","workflows","email","android"]),e.d1!==void 0){const i=s.obj("features.d1",e.d1);i&&(s.keys("features.d1",i,["binding","database","migrationsDir"]),s.str("features.d1.binding",i.binding,/^[A-Z][A-Z0-9_]*$/,"an UPPER_SNAKE binding name"),s.str("features.d1.database",i.database),i.migrationsDir!==void 0&&s.str("features.d1.migrationsDir",i.migrationsDir))}if(e.kv!==void 0&&k(s,e.kv),e.web!==void 0){const i=s.obj("features.web",e.web);i&&(s.keys("features.web",i,["pages","spaShell","buildScript","pagesProject"]),s.bool("features.web.pages",i.pages),s.bool("features.web.spaShell",i.spaShell),i.buildScript!==void 0&&s.str("features.web.buildScript",i.buildScript,/^[\w:.-]+$/,"a root package.json script name"),i.pagesProject!==void 0&&s.str("features.web.pagesProject",i.pagesProject,/^[a-z0-9][a-z0-9-]{0,57}$/,"lower-case letters, digits and hyphens, at most 58"))}for(const i of["background","backupD1","email","android"])e[i]!==void 0&&s.bool(`features.${i}`,e[i]);for(const i of["durableObjects","queues","workflows"])e[i]!==void 0&&s.strings(`features.${i}`,e[i])}}o(h,"checkFeatures");function $(s,t,e){s.keys(t,e,["name","dir","package","mayImport","typeOnly","forbid","forbidMessage","http","browser"]),s.str(`${t}.name`,e.name,l,"lower-case letters, digits and hyphens"),s.str(`${t}.dir`,e.dir)&&(/[*?{}]/.test(e.dir)||e.dir.startsWith("/")||e.dir.split("/").includes(".."))&&s.fail(`${t}.dir`,`${JSON.stringify(e.dir)} must be a repo-relative directory without globs`),e.package!==void 0&&s.str(`${t}.package`,e.package),e.forbidMessage!==void 0&&s.str(`${t}.forbidMessage`,e.forbidMessage);for(const i of["mayImport","typeOnly","forbid"])(e[i]!==void 0||i==="mayImport")&&s.strings(`${t}.${i}`,e[i]);for(const i of["http","browser"])e[i]!==void 0&&s.bool(`${t}.${i}`,e[i])}o($,"checkLayer");function w(s,t){if(!Array.isArray(t)){s.fail("layers","must be an array of layers");return}const e=new Set,i=new Set;t.forEach((n,a)=>{const f=`layers[${a}]`,r=s.obj(f,n);r&&($(s,f,r),typeof r.name=="string"&&(e.has(r.name)&&s.fail(`${f}.name`,`duplicate layer name ${JSON.stringify(r.name)}`),e.add(r.name)),typeof r.dir=="string"&&(i.has(r.dir)&&s.fail(`${f}.dir`,`duplicate layer dir ${JSON.stringify(r.dir)}`),i.add(r.dir)))}),t.forEach((n,a)=>{if(u(n))for(const f of["mayImport","typeOnly"]){const r=n[f];if(Array.isArray(r))for(const d of r)typeof d=="string"&&!e.has(d)&&s.fail(`layers[${a}].${f}`,`unknown layer ${JSON.stringify(d)}`),f==="typeOnly"&&Array.isArray(n.mayImport)&&n.mayImport.includes(d)&&s.fail(`layers[${a}].typeOnly`,`${JSON.stringify(d)} is already in mayImport`)}})}o(w,"checkLayers");function j(s,t){const e=s.obj("quality",t);e&&(s.keys("quality",e,["coverage","godFiles"]),e.coverage!==void 0&&O(s,e.coverage),e.godFiles!==void 0&&S(s,e.godFiles))}o(j,"checkQuality");function S(s,t){const e=s.obj("quality.godFiles",t);if(e){s.keys("quality.godFiles",e,["soft","hard"]);for(const i of["soft","hard"]){const n=e[i],a=m[i];!Number.isInteger(n)||n<1?s.fail(`quality.godFiles.${i}`,"must be a positive integer"):n>a&&s.fail(`quality.godFiles.${i}`,`${String(n)} is above the family limit ${a}: god-file limits may only be lowered`)}typeof e.soft=="number"&&typeof e.hard=="number"&&e.soft>e.hard&&s.fail("quality.godFiles.soft","must not exceed quality.godFiles.hard")}}o(S,"checkGodFiles");function O(s,t){const e=s.obj("quality.coverage",t);if(e){s.keys("quality.coverage",e,b);for(const i of b){const n=e[i];(typeof n!="number"||!(n>=0&&n<=100))&&s.fail(`quality.coverage.${i}`,"must be a number from 0 to 100")}}}o(O,"checkCoverage");function A(s,t){const e=s.obj("extensions",t);if(e)for(const[i,n]of Object.entries(e))l.test(i)||s.fail(`extensions.${i}`,"namespace must be lower-case letters, digits and hyphens"),u(n)||s.fail(`extensions.${i}`,"must be an object (extensions are namespaced: one object per owner)")}o(A,"checkExtensions");function N(s){const t=new g,e=t.obj("manifest",s);return e&&(t.keys("manifest",e,["$schema","name","scope","features","layers","quality","extensions"]),e.$schema!==void 0&&t.str("$schema",e.$schema),t.str("name",e.name),t.str("scope",e.scope,y,'an npm scope such as "@mail-meow"'),e.features!==void 0&&h(t,e.features),e.layers!==void 0&&w(t,e.layers),e.quality!==void 0&&j(t,e.quality),e.extensions!==void 0&&A(t,e.extensions)),t.errors.length>0?{ok:!1,errors:t.errors}:{ok:!0,manifest:s}}o(N,"validateManifest");export{m as FAMILY_GOD_FILE_LIMITS,N as validateManifest};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/manifest-validate.ts"],
4
- "sourcesContent": ["import type { FamilyManifest, ManifestValidation } from './manifest.ts';\n\n/**\nFamily default god-file limits: a manifest may only lower them.\n*/\nexport const FAMILY_GOD_FILE_LIMITS = { soft: 300, hard: 400 } as const;\n\ntype Obj = Record<string, unknown>;\n\nconst isObj = (value: unknown): value is Obj => typeof value === 'object' && value !== null && !Array.isArray(value);\nconst SCOPE_RE = /^@[a-z0-9][a-z0-9-]*$/;\nconst NAME_RE = /^[a-z][a-z0-9-]*$/;\nconst COVERAGE_KEYS = ['lines', 'branches', 'functions', 'statements'] as const;\n\n/**\nCollects errors under a dotted path so every message names its field.\n*/\nclass Check {\n readonly errors: string[] = [];\n fail(at: string, message: string): void {\n this.errors.push(`${at}: ${message}`);\n }\n /**\n Refuse unknown keys: the closed side.\n */\n keys(at: string, value: Obj, allowed: readonly string[]): void {\n for (const key of Object.keys(value)) {\n if (!allowed.includes(key)) this.fail(`${at}.${key}`, `unknown key (allowed: ${allowed.join(', ')})`);\n }\n }\n obj(at: string, value: unknown): Obj | null {\n if (isObj(value)) return value;\n this.fail(at, 'must be an object');\n return null;\n }\n str(at: string, value: unknown, pattern?: RegExp, hint?: string): value is string {\n if (typeof value !== 'string' || value === '') {\n this.fail(at, 'must be a non-empty string');\n return false;\n }\n if (pattern && !pattern.test(value)) {\n this.fail(at, `${JSON.stringify(value)} is invalid${hint ? ` (${hint})` : ''}`);\n return false;\n }\n return true;\n }\n bool(at: string, value: unknown): void {\n if (typeof value !== 'boolean') this.fail(at, 'must be a boolean');\n }\n strings(at: string, value: unknown): value is string[] {\n if (!Array.isArray(value) || value.some((item) => typeof item !== 'string' || item === '')) {\n this.fail(at, 'must be an array of non-empty strings');\n return false;\n }\n return true;\n }\n}\n\nfunction checkFeatures(c: Check, value: unknown): void {\n const features = c.obj('features', value);\n if (!features) return;\n c.keys('features', features, ['d1', 'web', 'background', 'backupD1', 'durableObjects', 'queues', 'workflows', 'email', 'android']);\n if (features.d1 !== undefined) {\n const d1 = c.obj('features.d1', features.d1);\n if (d1) {\n c.keys('features.d1', d1, ['binding', 'database', 'migrationsDir']);\n c.str('features.d1.binding', d1.binding, /^[A-Z][A-Z0-9_]*$/, 'an UPPER_SNAKE binding name');\n c.str('features.d1.database', d1.database);\n if (d1.migrationsDir !== undefined) c.str('features.d1.migrationsDir', d1.migrationsDir);\n }\n }\n if (features.web !== undefined) {\n const web = c.obj('features.web', features.web);\n if (web) {\n c.keys('features.web', web, ['pages', 'spaShell']);\n c.bool('features.web.pages', web.pages);\n c.bool('features.web.spaShell', web.spaShell);\n }\n }\n for (const flag of ['background', 'backupD1', 'email', 'android'] as const) {\n if (features[flag] !== undefined) c.bool(`features.${flag}`, features[flag]);\n }\n for (const list of ['durableObjects', 'queues', 'workflows'] as const) {\n if (features[list] !== undefined) c.strings(`features.${list}`, features[list]);\n }\n}\n\nfunction checkLayer(c: Check, at: string, layer: Obj): void {\n c.keys(at, layer, ['name', 'dir', 'package', 'mayImport', 'typeOnly', 'forbid', 'forbidMessage', 'http', 'browser']);\n c.str(`${at}.name`, layer.name, NAME_RE, 'lower-case letters, digits and hyphens');\n if (c.str(`${at}.dir`, layer.dir) && (/[*?{}]/.test(layer.dir) || layer.dir.startsWith('/') || layer.dir.split('/').includes('..'))) {\n c.fail(`${at}.dir`, `${JSON.stringify(layer.dir)} must be a repo-relative directory without globs`);\n }\n if (layer.package !== undefined) c.str(`${at}.package`, layer.package);\n if (layer.forbidMessage !== undefined) c.str(`${at}.forbidMessage`, layer.forbidMessage);\n for (const list of ['mayImport', 'typeOnly', 'forbid'] as const) {\n if (layer[list] !== undefined || list === 'mayImport') c.strings(`${at}.${list}`, layer[list]);\n }\n for (const flag of ['http', 'browser'] as const) if (layer[flag] !== undefined) c.bool(`${at}.${flag}`, layer[flag]);\n}\n\nfunction checkLayers(c: Check, value: unknown): void {\n if (!Array.isArray(value)) {\n c.fail('layers', 'must be an array of layers');\n return;\n }\n const names = new Set<string>();\n const dirs = new Set<string>();\n value.forEach((entry: unknown, index) => {\n const at = `layers[${index}]`;\n const layer = c.obj(at, entry);\n if (!layer) return;\n checkLayer(c, at, layer);\n if (typeof layer.name === 'string') {\n if (names.has(layer.name)) c.fail(`${at}.name`, `duplicate layer name ${JSON.stringify(layer.name)}`);\n names.add(layer.name);\n }\n if (typeof layer.dir !== 'string') {\n return;\n }\n\n if (dirs.has(layer.dir)) c.fail(`${at}.dir`, `duplicate layer dir ${JSON.stringify(layer.dir)}`);\n dirs.add(layer.dir);\n });\n value.forEach((entry: unknown, index) => {\n if (!isObj(entry)) return;\n for (const list of ['mayImport', 'typeOnly'] as const) {\n const refs = entry[list];\n if (!Array.isArray(refs)) continue;\n for (const ref of refs) {\n if (typeof ref === 'string' && !names.has(ref)) c.fail(`layers[${index}].${list}`, `unknown layer ${JSON.stringify(ref)}`);\n if (list === 'typeOnly' && Array.isArray(entry.mayImport) && entry.mayImport.includes(ref)) {\n c.fail(`layers[${index}].typeOnly`, `${JSON.stringify(ref)} is already in mayImport`);\n }\n }\n }\n });\n}\n\nfunction checkQuality(c: Check, value: unknown): void {\n const quality = c.obj('quality', value);\n if (!quality) return;\n c.keys('quality', quality, ['coverage', 'godFiles']);\n if (quality.coverage !== undefined) checkCoverage(c, quality.coverage);\n if (quality.godFiles !== undefined) checkGodFiles(c, quality.godFiles);\n}\n\nfunction checkGodFiles(c: Check, value: unknown): void {\n const god = c.obj('quality.godFiles', value);\n if (!god) return;\n c.keys('quality.godFiles', god, ['soft', 'hard']);\n for (const key of ['soft', 'hard'] as const) {\n const limit = god[key];\n const ceiling = FAMILY_GOD_FILE_LIMITS[key];\n if (!Number.isInteger(limit) || (limit as number) < 1) c.fail(`quality.godFiles.${key}`, 'must be a positive integer');\n else if ((limit as number) > ceiling) {\n c.fail(`quality.godFiles.${key}`, `${String(limit)} is above the family limit ${ceiling}: god-file limits may only be lowered`);\n }\n }\n if (typeof god.soft === 'number' && typeof god.hard === 'number' && god.soft > god.hard) {\n c.fail('quality.godFiles.soft', 'must not exceed quality.godFiles.hard');\n }\n}\n\nfunction checkCoverage(c: Check, value: unknown): void {\n const coverage = c.obj('quality.coverage', value);\n if (!coverage) return;\n c.keys('quality.coverage', coverage, COVERAGE_KEYS);\n for (const key of COVERAGE_KEYS) {\n const figure = coverage[key];\n if (typeof figure !== 'number' || !(figure >= 0 && figure <= 100)) c.fail(`quality.coverage.${key}`, 'must be a number from 0 to 100');\n }\n}\n\nfunction checkExtensions(c: Check, value: unknown): void {\n const extensions = c.obj('extensions', value);\n if (!extensions) return;\n for (const [key, entry] of Object.entries(extensions)) {\n if (!NAME_RE.test(key)) c.fail(`extensions.${key}`, 'namespace must be lower-case letters, digits and hyphens');\n if (!isObj(entry)) c.fail(`extensions.${key}`, 'must be an object (extensions are namespaced: one object per owner)');\n }\n}\n\n/**\n * Validate an already-parsed value. Returns every problem found, not just the\n * first, so one edit can fix them all.\n */\nexport function validateManifest(input: unknown): ManifestValidation {\n const c = new Check();\n const root = c.obj('manifest', input);\n if (root) {\n c.keys('manifest', root, ['$schema', 'name', 'scope', 'features', 'layers', 'quality', 'extensions']);\n if (root.$schema !== undefined) c.str('$schema', root.$schema);\n c.str('name', root.name);\n c.str('scope', root.scope, SCOPE_RE, 'an npm scope such as \"@mail-meow\"');\n if (root.features !== undefined) checkFeatures(c, root.features);\n if (root.layers !== undefined) checkLayers(c, root.layers);\n if (root.quality !== undefined) checkQuality(c, root.quality);\n if (root.extensions !== undefined) checkExtensions(c, root.extensions);\n }\n return c.errors.length > 0 ? { ok: false, errors: c.errors } : { ok: true, manifest: input as FamilyManifest };\n}\n"],
5
- "mappings": "+EAKO,MAAMA,EAAyB,CAAE,KAAM,IAAK,KAAM,GAAG,EAItDC,EAAQC,EAACC,GAAiC,OAAOA,GAAU,UAAYA,IAAU,MAAQ,CAAC,MAAM,QAAQA,CAAK,EAArG,SACRC,EAAW,wBACXC,EAAU,oBACVC,EAAgB,CAAC,QAAS,WAAY,YAAa,YAAY,EAKrE,MAAMC,CAAK,CAfX,MAeW,CAAAL,EAAA,cACA,OAAmB,CAAA,EAC5B,KAAKM,EAAYC,EAAe,CAC9B,KAAK,OAAO,KAAK,GAAGD,CAAE,KAAKC,CAAO,EAAE,CACtC,CAIA,KAAKD,E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EAAK,UAAY,QAAWb,EAAaf,EAAG4B,EAAK,OAAO,EACxDA,EAAK,aAAe,QAAWJ,EAAgBxB,EAAG4B,EAAK,UAAU,GAEhE5B,EAAE,OAAO,OAAS,EAAI,CAAE,GAAI,GAAO,OAAQA,EAAE,MAAM,EAAK,CAAE,GAAI,GAAM,SAAU2B,CAAuB,CAC9G,CAdgBzC,EAAAwC,EAAA",
6
- "names": ["FAMILY_GOD_FILE_LIMITS", "isObj", "__name", "value", "SCOPE_RE", "NAME_RE", "COVERAGE_KEYS", "Check", "at", "message", "allowed", "key", "pattern", "hint", "item", "checkFeatures", "c", "features", "d1", "web", "flag", "list", "checkLayer", "layer", "checkLayers", "names", "dirs", "entry", "index", "refs", "ref", "checkQuality", "quality", "checkCoverage", "checkGodFiles", "god", "limit", "ceiling", "coverage", "figure", "checkExtensions", "extensions", "validateManifest", "input", "root"]
4
+ "sourcesContent": ["import type { FamilyManifest, ManifestValidation } from './manifest.ts';\n\n/**\nFamily default god-file limits: a manifest may only lower them.\n*/\nexport const FAMILY_GOD_FILE_LIMITS = { soft: 300, hard: 400 } as const;\n\ntype Obj = Record<string, unknown>;\n\nconst isObj = (value: unknown): value is Obj => typeof value === 'object' && value !== null && !Array.isArray(value);\nconst SCOPE_RE = /^@[a-z0-9][a-z0-9-]*$/;\nconst NAME_RE = /^[a-z][a-z0-9-]*$/;\nconst COVERAGE_KEYS = ['lines', 'branches', 'functions', 'statements'] as const;\n\n/**\nCollects errors under a dotted path so every message names its field.\n*/\nclass Check {\n readonly errors: string[] = [];\n fail(at: string, message: string): void {\n this.errors.push(`${at}: ${message}`);\n }\n /**\n Refuse unknown keys: the closed side.\n */\n keys(at: string, value: Obj, allowed: readonly string[]): void {\n for (const key of Object.keys(value)) {\n if (!allowed.includes(key)) this.fail(`${at}.${key}`, `unknown key (allowed: ${allowed.join(', ')})`);\n }\n }\n obj(at: string, value: unknown): Obj | null {\n if (isObj(value)) return value;\n this.fail(at, 'must be an object');\n return null;\n }\n str(at: string, value: unknown, pattern?: RegExp, hint?: string): value is string {\n if (typeof value !== 'string' || value === '') {\n this.fail(at, 'must be a non-empty string');\n return false;\n }\n if (pattern && !pattern.test(value)) {\n this.fail(at, `${JSON.stringify(value)} is invalid${hint ? ` (${hint})` : ''}`);\n return false;\n }\n return true;\n }\n bool(at: string, value: unknown): void {\n if (typeof value !== 'boolean') this.fail(at, 'must be a boolean');\n }\n strings(at: string, value: unknown): value is string[] {\n if (!Array.isArray(value) || value.some((item) => typeof item !== 'string' || item === '')) {\n this.fail(at, 'must be an array of non-empty strings');\n return false;\n }\n return true;\n }\n}\n\nconst BINDING_RE = /^[A-Z][A-Z0-9_]*$/;\n\nfunction checkKv(c: Check, value: unknown): void {\n const kv = c.obj('features.kv', value);\n if (!kv) return;\n c.keys('features.kv', kv, ['bindings', 'namespaceNames']);\n const bindings = c.strings('features.kv.bindings', kv.bindings) ? kv.bindings : [];\n for (const binding of bindings) c.str('features.kv.bindings', binding, BINDING_RE, 'an UPPER_SNAKE binding name');\n if (kv.namespaceNames === undefined) return;\n const names = c.obj('features.kv.namespaceNames', kv.namespaceNames);\n if (!names) return;\n for (const [binding, name] of Object.entries(names)) {\n const at = `features.kv.namespaceNames.${binding}`;\n if (!bindings.includes(binding)) c.fail(at, 'is not listed in features.kv.bindings');\n c.str(at, name);\n }\n}\n\nfunction checkFeatures(c: Check, value: unknown): void {\n const features = c.obj('features', value);\n if (!features) return;\n c.keys('features', features, ['d1', 'kv', 'web', 'background', 'backupD1', 'durableObjects', 'queues', 'workflows', 'email', 'android']);\n if (features.d1 !== undefined) {\n const d1 = c.obj('features.d1', features.d1);\n if (d1) {\n c.keys('features.d1', d1, ['binding', 'database', 'migrationsDir']);\n c.str('features.d1.binding', d1.binding, /^[A-Z][A-Z0-9_]*$/, 'an UPPER_SNAKE binding name');\n c.str('features.d1.database', d1.database);\n if (d1.migrationsDir !== undefined) c.str('features.d1.migrationsDir', d1.migrationsDir);\n }\n }\n if (features.kv !== undefined) checkKv(c, features.kv);\n if (features.web !== undefined) {\n const web = c.obj('features.web', features.web);\n if (web) {\n c.keys('features.web', web, ['pages', 'spaShell', 'buildScript', 'pagesProject']);\n c.bool('features.web.pages', web.pages);\n c.bool('features.web.spaShell', web.spaShell);\n if (web.buildScript !== undefined)\n c.str('features.web.buildScript', web.buildScript, /^[\\w:.-]+$/, 'a root package.json script name');\n if (web.pagesProject !== undefined) {\n c.str(\n 'features.web.pagesProject',\n web.pagesProject,\n /^[a-z0-9][a-z0-9-]{0,57}$/,\n 'lower-case letters, digits and hyphens, at most 58',\n );\n }\n }\n }\n for (const flag of ['background', 'backupD1', 'email', 'android'] as const) {\n if (features[flag] !== undefined) c.bool(`features.${flag}`, features[flag]);\n }\n for (const list of ['durableObjects', 'queues', 'workflows'] as const) {\n if (features[list] !== undefined) c.strings(`features.${list}`, features[list]);\n }\n}\n\nfunction checkLayer(c: Check, at: string, layer: Obj): void {\n c.keys(at, layer, ['name', 'dir', 'package', 'mayImport', 'typeOnly', 'forbid', 'forbidMessage', 'http', 'browser']);\n c.str(`${at}.name`, layer.name, NAME_RE, 'lower-case letters, digits and hyphens');\n if (c.str(`${at}.dir`, layer.dir) && (/[*?{}]/.test(layer.dir) || layer.dir.startsWith('/') || layer.dir.split('/').includes('..'))) {\n c.fail(`${at}.dir`, `${JSON.stringify(layer.dir)} must be a repo-relative directory without globs`);\n }\n if (layer.package !== undefined) c.str(`${at}.package`, layer.package);\n if (layer.forbidMessage !== undefined) c.str(`${at}.forbidMessage`, layer.forbidMessage);\n for (const list of ['mayImport', 'typeOnly', 'forbid'] as const) {\n if (layer[list] !== undefined || list === 'mayImport') c.strings(`${at}.${list}`, layer[list]);\n }\n for (const flag of ['http', 'browser'] as const) if (layer[flag] !== undefined) c.bool(`${at}.${flag}`, layer[flag]);\n}\n\nfunction checkLayers(c: Check, value: unknown): void {\n if (!Array.isArray(value)) {\n c.fail('layers', 'must be an array of layers');\n return;\n }\n const names = new Set<string>();\n const dirs = new Set<string>();\n value.forEach((entry: unknown, index) => {\n const at = `layers[${index}]`;\n const layer = c.obj(at, entry);\n if (!layer) return;\n checkLayer(c, at, layer);\n if (typeof layer.name === 'string') {\n if (names.has(layer.name)) c.fail(`${at}.name`, `duplicate layer name ${JSON.stringify(layer.name)}`);\n names.add(layer.name);\n }\n if (typeof layer.dir !== 'string') {\n return;\n }\n\n if (dirs.has(layer.dir)) c.fail(`${at}.dir`, `duplicate layer dir ${JSON.stringify(layer.dir)}`);\n dirs.add(layer.dir);\n });\n value.forEach((entry: unknown, index) => {\n if (!isObj(entry)) return;\n for (const list of ['mayImport', 'typeOnly'] as const) {\n const refs = entry[list];\n if (!Array.isArray(refs)) continue;\n for (const ref of refs) {\n if (typeof ref === 'string' && !names.has(ref)) c.fail(`layers[${index}].${list}`, `unknown layer ${JSON.stringify(ref)}`);\n if (list === 'typeOnly' && Array.isArray(entry.mayImport) && entry.mayImport.includes(ref)) {\n c.fail(`layers[${index}].typeOnly`, `${JSON.stringify(ref)} is already in mayImport`);\n }\n }\n }\n });\n}\n\nfunction checkQuality(c: Check, value: unknown): void {\n const quality = c.obj('quality', value);\n if (!quality) return;\n c.keys('quality', quality, ['coverage', 'godFiles']);\n if (quality.coverage !== undefined) checkCoverage(c, quality.coverage);\n if (quality.godFiles !== undefined) checkGodFiles(c, quality.godFiles);\n}\n\nfunction checkGodFiles(c: Check, value: unknown): void {\n const god = c.obj('quality.godFiles', value);\n if (!god) return;\n c.keys('quality.godFiles', god, ['soft', 'hard']);\n for (const key of ['soft', 'hard'] as const) {\n const limit = god[key];\n const ceiling = FAMILY_GOD_FILE_LIMITS[key];\n if (!Number.isInteger(limit) || (limit as number) < 1) c.fail(`quality.godFiles.${key}`, 'must be a positive integer');\n else if ((limit as number) > ceiling) {\n c.fail(`quality.godFiles.${key}`, `${String(limit)} is above the family limit ${ceiling}: god-file limits may only be lowered`);\n }\n }\n if (typeof god.soft === 'number' && typeof god.hard === 'number' && god.soft > god.hard) {\n c.fail('quality.godFiles.soft', 'must not exceed quality.godFiles.hard');\n }\n}\n\nfunction checkCoverage(c: Check, value: unknown): void {\n const coverage = c.obj('quality.coverage', value);\n if (!coverage) return;\n c.keys('quality.coverage', coverage, COVERAGE_KEYS);\n for (const key of COVERAGE_KEYS) {\n const figure = coverage[key];\n if (typeof figure !== 'number' || !(figure >= 0 && figure <= 100)) c.fail(`quality.coverage.${key}`, 'must be a number from 0 to 100');\n }\n}\n\nfunction checkExtensions(c: Check, value: unknown): void {\n const extensions = c.obj('extensions', value);\n if (!extensions) return;\n for (const [key, entry] of Object.entries(extensions)) {\n if (!NAME_RE.test(key)) c.fail(`extensions.${key}`, 'namespace must be lower-case letters, digits and hyphens');\n if (!isObj(entry)) c.fail(`extensions.${key}`, 'must be an object (extensions are namespaced: one object per owner)');\n }\n}\n\n/**\n * Validate an already-parsed value. Returns every problem found, not just the\n * first, so one edit can fix them all.\n */\nexport function validateManifest(input: unknown): ManifestValidation {\n const c = new Check();\n const root = c.obj('manifest', input);\n if (root) {\n c.keys('manifest', root, ['$schema', 'name', 'scope', 'features', 'layers', 'quality', 'extensions']);\n if (root.$schema !== undefined) c.str('$schema', root.$schema);\n c.str('name', root.name);\n c.str('scope', root.scope, SCOPE_RE, 'an npm scope such as \"@mail-meow\"');\n if (root.features !== undefined) checkFeatures(c, root.features);\n if (root.layers !== undefined) checkLayers(c, root.layers);\n if (root.quality !== undefined) checkQuality(c, root.quality);\n if (root.extensions !== undefined) checkExtensions(c, root.extensions);\n }\n return c.errors.length > 0 ? { ok: false, errors: c.errors } : { ok: true, manifest: input as FamilyManifest };\n}\n"],
5
+ "mappings": "+EAKO,MAAMA,EAAyB,CAAE,KAAM,IAAK,KAAM,GAAG,EAItDC,EAAQC,EAACC,GAAiC,OAAOA,GAAU,UAAYA,IAAU,MAAQ,CAAC,MAAM,QAAQA,CAAK,EAArG,SACRC,EAAW,wBACXC,EAAU,oBACVC,EAAgB,CAAC,QAAS,WAAY,YAAa,YAAY,EAKrE,MAAMC,CAA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CAAE,GAAI,GAAM,SAAUgC,CAAuB,CAC9G,CAdgB/C,EAAA8C,EAAA",
6
+ "names": ["FAMILY_GOD_FILE_LIMITS", "isObj", "__name", "value", "SCOPE_RE", "NAME_RE", "COVERAGE_KEYS", "Check", "at", "message", "allowed", "key", "pattern", "hint", "item", "BINDING_RE", "checkKv", "c", "kv", "bindings", "binding", "names", "name", "checkFeatures", "features", "d1", "web", "flag", "list", "checkLayer", "layer", "checkLayers", "dirs", "entry", "index", "refs", "ref", "checkQuality", "quality", "checkCoverage", "checkGodFiles", "god", "limit", "ceiling", "coverage", "figure", "checkExtensions", "extensions", "validateManifest", "input", "root"]
7
7
  }
@@ -26,6 +26,17 @@ export interface ManifestD1 {
26
26
  readonly database: string;
27
27
  readonly migrationsDir?: string;
28
28
  }
29
+ export interface ManifestKv {
30
+ /**
31
+ KV binding names the deployment needs (UPPER_SNAKE). `prepare-wrangler` adds any a hand-written config lacks and provisions
32
+ their namespaces; a repo that declares none gets no KV binding and no namespace.
33
+ */
34
+ readonly bindings: readonly string[];
35
+ /**
36
+ Binding to namespace name, for a namespace that predates the kit's `<worker>-<binding>` convention. Keys must be listed in `bindings`.
37
+ */
38
+ readonly namespaceNames?: Readonly<Record<string, string>>;
39
+ }
29
40
  export interface ManifestWeb {
30
41
  /**
31
42
  The SPA is served by Cloudflare Pages.
@@ -35,9 +46,19 @@ export interface ManifestWeb {
35
46
  The SPA shell is embedded into the worker (`spa-shell` scripts).
36
47
  */
37
48
  readonly spaShell: boolean;
49
+ /**
50
+ A **root** `package.json` script that builds the SPA, for a repo whose build has wrappers (`verify:tailwind && build`).
51
+ CI and CD run `pnpm run <script>` instead of `pnpm --filter <scope>/web run build`.
52
+ */
53
+ readonly buildScript?: string;
54
+ /**
55
+ The Cloudflare Pages project, when it is not `<name>-web`. Wins over the `CLOUDFLARE_PAGES_PROJECT_NAME` variable.
56
+ */
57
+ readonly pagesProject?: string;
38
58
  }
39
59
  export interface ManifestFeatures {
40
60
  readonly d1?: ManifestD1;
61
+ readonly kv?: ManifestKv;
41
62
  readonly web?: ManifestWeb;
42
63
  readonly background?: boolean;
43
64
  readonly backupD1?: boolean;