@rexezuge/tooling 1.13.0 → 1.14.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 (79) hide show
  1. package/README.md +25 -4
  2. package/dist/eslint-options.d.ts +54 -0
  3. package/dist/eslint-options.d.ts.map +1 -0
  4. package/dist/eslint-options.js +0 -0
  5. package/dist/eslint-options.js.map +7 -0
  6. package/dist/eslint.d.ts +2 -53
  7. package/dist/eslint.d.ts.map +1 -1
  8. package/dist/eslint.js.map +2 -2
  9. package/dist/pages-proxy.d.ts +2 -0
  10. package/dist/pages-proxy.d.ts.map +1 -0
  11. package/dist/pages-proxy.js +1 -0
  12. package/dist/pages-proxy.js.map +7 -0
  13. package/dist/plugin-option.d.ts +15 -0
  14. package/dist/plugin-option.d.ts.map +1 -0
  15. package/dist/plugin-option.js +1 -0
  16. package/dist/plugin-option.js.map +7 -0
  17. package/dist/scripts/ensure-spa-shell-stub.d.ts +4 -2
  18. package/dist/scripts/ensure-spa-shell-stub.d.ts.map +1 -1
  19. package/dist/scripts/ensure-spa-shell-stub.js +1 -2
  20. package/dist/scripts/ensure-spa-shell-stub.js.map +3 -3
  21. package/dist/scripts/init-secrets.d.ts +1 -2
  22. package/dist/scripts/init-secrets.d.ts.map +1 -1
  23. package/dist/scripts/init-secrets.js +2 -3
  24. package/dist/scripts/init-secrets.js.map +3 -3
  25. package/dist/scripts/migrations-lock.d.ts +6 -2
  26. package/dist/scripts/migrations-lock.d.ts.map +1 -1
  27. package/dist/scripts/migrations-lock.js +1 -2
  28. package/dist/scripts/migrations-lock.js.map +3 -3
  29. package/dist/scripts/prepare-wrangler-config.d.ts +6 -2
  30. package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
  31. package/dist/scripts/prepare-wrangler-config.js +1 -2
  32. package/dist/scripts/prepare-wrangler-config.js.map +3 -3
  33. package/dist/scripts/validate-locales.d.ts +20 -2
  34. package/dist/scripts/validate-locales.d.ts.map +1 -1
  35. package/dist/scripts/validate-locales.js +5 -5
  36. package/dist/scripts/validate-locales.js.map +3 -3
  37. package/dist/scripts/verify-spa-shell.d.ts +7 -2
  38. package/dist/scripts/verify-spa-shell.d.ts.map +1 -1
  39. package/dist/scripts/verify-spa-shell.js +1 -2
  40. package/dist/scripts/verify-spa-shell.js.map +3 -3
  41. package/dist/vite.d.ts +2 -1
  42. package/dist/vite.d.ts.map +1 -1
  43. package/dist/vite.js +3 -3
  44. package/dist/vite.js.map +3 -3
  45. package/dist/vitest-integration.d.ts +3 -2
  46. package/dist/vitest-integration.d.ts.map +1 -1
  47. package/dist/vitest-integration.js +1 -1
  48. package/dist/vitest-integration.js.map +3 -3
  49. package/dist/vitest-repo.d.ts +3 -2
  50. package/dist/vitest-repo.d.ts.map +1 -1
  51. package/dist/vitest-repo.js +1 -1
  52. package/dist/vitest-repo.js.map +3 -3
  53. package/dist/vitest-web.d.ts +3 -2
  54. package/dist/vitest-web.d.ts.map +1 -1
  55. package/dist/vitest-web.js +1 -1
  56. package/dist/vitest-web.js.map +3 -3
  57. package/dist/vitest.d.ts +3 -2
  58. package/dist/vitest.d.ts.map +1 -1
  59. package/dist/vitest.js +1 -1
  60. package/dist/vitest.js.map +3 -3
  61. package/package.json +3 -3
  62. package/src/eslint-options.ts +54 -0
  63. package/src/eslint.ts +2 -53
  64. package/src/pages-proxy.test.ts +8 -0
  65. package/src/pages-proxy.ts +13 -0
  66. package/src/plugin-option.test.ts +13 -0
  67. package/src/plugin-option.ts +18 -0
  68. package/src/scripts/ensure-spa-shell-stub.ts +18 -10
  69. package/src/scripts/entrypoints.test.ts +55 -0
  70. package/src/scripts/init-secrets.ts +8 -6
  71. package/src/scripts/migrations-lock.ts +22 -17
  72. package/src/scripts/prepare-wrangler-config.ts +26 -14
  73. package/src/scripts/validate-locales.ts +39 -17
  74. package/src/scripts/verify-spa-shell.ts +21 -20
  75. package/src/vite.ts +5 -3
  76. package/src/vitest-integration.ts +5 -3
  77. package/src/vitest-repo.ts +5 -3
  78. package/src/vitest-web.ts +5 -3
  79. package/src/vitest.ts +5 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/vitest-integration.ts"],
4
- "sourcesContent": ["/**\n * The integration-suite Vitest config.\n *\n * Provenance: the eight `test/integration/vitest.config.mts` workerd suites\n * plus CalDAV-Bridge's `node:sqlite` suite. Every one hand-writes the same\n * `@scope/* → src` workspace table (8–20 entries) beside its own harness\n * wiring; this factory generates that table from `scope` so the two cannot\n * drift apart — a suite resolving a workspace import differently from the unit\n * suite fails in a way that looks like a product bug.\n *\n * What the factory does not do, deliberately: the workerd suites' `plugins`\n * (`@cloudflare/vitest-pool-workers`), `pool` and migration-SQL `define` are\n * harness wiring that belongs to the repo, and importing the workerd plugin\n * here would make the tooling package undownloadable for a consumer without\n * it. The factory takes them as opaque pass-through and returns them\n * untouched. CalDAV-Bridge's suite passes none of them (plain `node` +\n * `node:sqlite`, no coverage); the workerd suites pass all three.\n */\n\nimport { defineConfig, type Plugin } from 'vitest/config';\nimport type { Pool } from 'vitest/node';\nimport { DEFAULT_WORKSPACE_PACKAGES, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\n\n/**\n * What `defineIntegrationVitestConfig` accepts.\n */\nexport interface IntegrationVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`.\n */\n readonly scope: string;\n /**\n * Workspace package directory names. Defaults to the family superset.\n */\n readonly packages?: readonly string[];\n /**\n * The repo root, as a file URL.\n */\n readonly root?: string;\n /**\n * Extra resolver entries, applied after the workspace table (e.g. the\n * `hono` dedupe two repos carry).\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * Which suites to collect. Workerd suites use\n * `test/integration/​**​/*.int.test.ts`; CalDAV-Bridge's sqlite suite uses\n * `test/integration/​**​/*.test.ts`.\n */\n readonly include?: readonly string[];\n /**\n * The Vitest plugins (the workerd `cloudflareTest()` plugin). Typed as the\n * runner's own plugin so a workerd plugin is accepted and nothing new is\n * imported — this package stays dependency-free.\n */\n readonly plugins?: readonly Plugin[];\n /**\n * The pool (the workerd `cloudflarePool()`). The runner's own `Pool` type,\n * so a custom pool is accepted without importing its provider.\n */\n readonly pool?: Pool;\n /**\n * Compile-time defines (the migration SQL/SQLite bundle each suite injects).\n * Opaque, passed through.\n */\n readonly define?: Readonly<Record<string, string>>;\n /**\n * SSR `noExternal` (workerd suites list `hono`, `chanfana` and their scope).\n * Passed through untouched.\n */\n readonly ssrNoExternal?: readonly string[];\n}\n\n/**\n * Build the integration-suite config.\n *\n * ```ts\n * // test/integration/vitest.config.mts — workerd suite\n * import { cloudflareTest, cloudflarePool } from '@cloudflare/vitest-pool-workers';\n * import { defineIntegrationVitestConfig } from '@rexezuge/tooling/vitest-integration';\n * export default defineIntegrationVitestConfig({\n * scope: '@myapp',\n * define: { __INTEGRATION_MIGRATION_SQL__: JSON.stringify(migrationSql) },\n * plugins: [cloudflareTest({ wrangler: { configPath: './test/integration/wrangler.test.jsonc' } })],\n * pool: cloudflarePool({ wrangler: { configPath: './test/integration/wrangler.test.jsonc' } }),\n * });\n * ```\n *\n * ```ts\n * // test/integration/vitest.config.mts — sqlite suite (no workerd)\n * import { defineIntegrationVitestConfig } from '@rexezuge/tooling/vitest-integration';\n * export default defineIntegrationVitestConfig({\n * scope: '@myapp',\n * include: ['test/integration/**​/*.test.ts'],\n * });\n * ```\n */\nexport function defineIntegrationVitestConfig(options: IntegrationVitestConfigOptions): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const aliases = [\n ...workspaceAliases({ scope: options.scope, root, packages: options.packages ?? DEFAULT_WORKSPACE_PACKAGES, mocks: [] }),\n ...(options.aliases ?? []),\n ];\n\n return defineConfig({\n ...(options.define !== undefined && { define: { ...options.define } }),\n ...(options.plugins !== undefined && { plugins: [...options.plugins] }),\n resolve: { alias: aliases },\n test: {\n globals: true,\n environment: 'node',\n include: [...(options.include ?? ['test/integration/**/*.int.test.ts'])],\n ...(options.pool !== undefined && { pool: options.pool }),\n },\n ...(options.ssrNoExternal !== undefined && { ssr: { noExternal: [...options.ssrNoExternal] } }),\n });\n}\n"],
5
- "mappings": "+EAmBA,OAAS,gBAAAA,MAAiC,gBAE1C,OAAS,8BAAAC,EAA4B,oBAAAC,MAAwB,sBA6EvD,SAAUC,EAA8BC,EAAuC,CACnF,MAAMC,EAAOD,EAAQ,MAAQ,IAAI,IAAI,IAAK,YAAY,GAAG,EAAE,KACrDE,EAAU,CACd,GAAGJ,EAAiB,CAAE,MAAOE,EAAQ,MAAO,KAAAC,EAAM,SAAUD,EAAQ,UAAYH,EAA4B,MAAO,CAAA,CAAE,CAAE,EACvH,GAAIG,EAAQ,SAAW,CAAA,GAGzB,OAAOJ,EAAa,CAClB,GAAII,EAAQ,SAAW,QAAa,CAAE,OAAQ,CAAE,GAAGA,EAAQ,MAAM,CAAE,EACnE,GAAIA,EAAQ,UAAY,QAAa,CAAE,QAAS,CAAC,GAAGA,EAAQ,OAAO,CAAC,EACpE,QAAS,CAAE,MAAOE,CAAO,EACzB,KAAM,CACJ,QAAS,GACT,YAAa,OACb,QAAS,CAAC,GAAIF,EAAQ,SAAW,CAAC,mCAAmC,CAAE,EACvE,GAAIA,EAAQ,OAAS,QAAa,CAAE,KAAMA,EAAQ,IAAI,GAExD,GAAIA,EAAQ,gBAAkB,QAAa,CAAE,IAAK,CAAE,WAAY,CAAC,GAAGA,EAAQ,aAAa,CAAC,CAAE,EAC7F,CACH,CAnBgBG,EAAAJ,EAAA",
6
- "names": ["defineConfig", "DEFAULT_WORKSPACE_PACKAGES", "workspaceAliases", "defineIntegrationVitestConfig", "options", "root", "aliases", "__name"]
4
+ "sourcesContent": ["/**\n * The integration-suite Vitest config.\n *\n * Provenance: the eight `test/integration/vitest.config.mts` workerd suites\n * plus CalDAV-Bridge's `node:sqlite` suite. Every one hand-writes the same\n * `@scope/* → src` workspace table (8–20 entries) beside its own harness\n * wiring; this factory generates that table from `scope` so the two cannot\n * drift apart — a suite resolving a workspace import differently from the unit\n * suite fails in a way that looks like a product bug.\n *\n * What the factory does not do, deliberately: the workerd suites' `plugins`\n * (`@cloudflare/vitest-pool-workers`), `pool` and migration-SQL `define` are\n * harness wiring that belongs to the repo, and importing the workerd plugin\n * here would make the tooling package undownloadable for a consumer without\n * it. The factory takes them as opaque pass-through and returns them\n * untouched. CalDAV-Bridge's suite passes none of them (plain `node` +\n * `node:sqlite`, no coverage); the workerd suites pass all three.\n */\n\nimport { defineConfig } from 'vitest/config';\nimport { asVitePlugins } from './plugin-option.ts';\nimport type { PluginOption } from './plugin-option.ts';\nimport type { Pool } from 'vitest/node';\nimport { DEFAULT_WORKSPACE_PACKAGES, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\n\n/**\n * What `defineIntegrationVitestConfig` accepts.\n */\nexport interface IntegrationVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`.\n */\n readonly scope: string;\n /**\n * Workspace package directory names. Defaults to the family superset.\n */\n readonly packages?: readonly string[];\n /**\n * The repo root, as a file URL.\n */\n readonly root?: string;\n /**\n * Extra resolver entries, applied after the workspace table (e.g. the\n * `hono` dedupe two repos carry).\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * Which suites to collect. Workerd suites use\n * `test/integration/​**​/*.int.test.ts`; CalDAV-Bridge's sqlite suite uses\n * `test/integration/​**​/*.test.ts`.\n */\n readonly include?: readonly string[];\n /**\n * The Vitest plugins (the workerd `cloudflareTest()` plugin). Typed as the\n * runner's own plugin so a workerd plugin is accepted and nothing new is\n * imported — this package stays dependency-free.\n */\n readonly plugins?: readonly PluginOption[];\n /**\n * The pool (the workerd `cloudflarePool()`). The runner's own `Pool` type,\n * so a custom pool is accepted without importing its provider.\n */\n readonly pool?: Pool;\n /**\n * Compile-time defines (the migration SQL/SQLite bundle each suite injects).\n * Opaque, passed through.\n */\n readonly define?: Readonly<Record<string, string>>;\n /**\n * SSR `noExternal` (workerd suites list `hono`, `chanfana` and their scope).\n * Passed through untouched.\n */\n readonly ssrNoExternal?: readonly string[];\n}\n\n/**\n * Build the integration-suite config.\n *\n * ```ts\n * // test/integration/vitest.config.mts — workerd suite\n * import { cloudflareTest, cloudflarePool } from '@cloudflare/vitest-pool-workers';\n * import { defineIntegrationVitestConfig } from '@rexezuge/tooling/vitest-integration';\n * export default defineIntegrationVitestConfig({\n * scope: '@myapp',\n * define: { __INTEGRATION_MIGRATION_SQL__: JSON.stringify(migrationSql) },\n * plugins: [cloudflareTest({ wrangler: { configPath: './test/integration/wrangler.test.jsonc' } })],\n * pool: cloudflarePool({ wrangler: { configPath: './test/integration/wrangler.test.jsonc' } }),\n * });\n * ```\n *\n * ```ts\n * // test/integration/vitest.config.mts — sqlite suite (no workerd)\n * import { defineIntegrationVitestConfig } from '@rexezuge/tooling/vitest-integration';\n * export default defineIntegrationVitestConfig({\n * scope: '@myapp',\n * include: ['test/integration/**​/*.test.ts'],\n * });\n * ```\n */\nexport function defineIntegrationVitestConfig(options: IntegrationVitestConfigOptions): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const aliases = [\n ...workspaceAliases({ scope: options.scope, root, packages: options.packages ?? DEFAULT_WORKSPACE_PACKAGES, mocks: [] }),\n ...(options.aliases ?? []),\n ];\n\n return defineConfig({\n ...(options.define !== undefined && { define: { ...options.define } }),\n ...(options.plugins !== undefined && { plugins: asVitePlugins(options.plugins) }),\n resolve: { alias: aliases },\n test: {\n globals: true,\n environment: 'node',\n include: [...(options.include ?? ['test/integration/**/*.int.test.ts'])],\n ...(options.pool !== undefined && { pool: options.pool }),\n },\n ...(options.ssrNoExternal !== undefined && { ssr: { noExternal: [...options.ssrNoExternal] } }),\n });\n}\n"],
5
+ "mappings": "+EAmBA,OAAS,gBAAAA,MAAoB,gBAC7B,OAAS,iBAAAC,MAAqB,qBAG9B,OAAS,8BAAAC,EAA4B,oBAAAC,MAAwB,sBA6EvD,SAAUC,EAA8BC,EAAuC,CACnF,MAAMC,EAAOD,EAAQ,MAAQ,IAAI,IAAI,IAAK,YAAY,GAAG,EAAE,KACrDE,EAAU,CACd,GAAGJ,EAAiB,CAAE,MAAOE,EAAQ,MAAO,KAAAC,EAAM,SAAUD,EAAQ,UAAYH,EAA4B,MAAO,CAAA,CAAE,CAAE,EACvH,GAAIG,EAAQ,SAAW,CAAA,GAGzB,OAAOL,EAAa,CAClB,GAAIK,EAAQ,SAAW,QAAa,CAAE,OAAQ,CAAE,GAAGA,EAAQ,MAAM,CAAE,EACnE,GAAIA,EAAQ,UAAY,QAAa,CAAE,QAASJ,EAAcI,EAAQ,OAAO,CAAC,EAC9E,QAAS,CAAE,MAAOE,CAAO,EACzB,KAAM,CACJ,QAAS,GACT,YAAa,OACb,QAAS,CAAC,GAAIF,EAAQ,SAAW,CAAC,mCAAmC,CAAE,EACvE,GAAIA,EAAQ,OAAS,QAAa,CAAE,KAAMA,EAAQ,IAAI,GAExD,GAAIA,EAAQ,gBAAkB,QAAa,CAAE,IAAK,CAAE,WAAY,CAAC,GAAGA,EAAQ,aAAa,CAAC,CAAE,EAC7F,CACH,CAnBgBG,EAAAJ,EAAA",
6
+ "names": ["defineConfig", "asVitePlugins", "DEFAULT_WORKSPACE_PACKAGES", "workspaceAliases", "defineIntegrationVitestConfig", "options", "root", "aliases", "__name"]
7
7
  }
@@ -22,7 +22,8 @@
22
22
  * `defineWebVitestConfig()`; the backend project keeps `environment:
23
23
  * 'node'` and `server.deps.inline` from `defineUnitVitestConfig()`.
24
24
  */
25
- import { defineConfig, type Plugin } from 'vitest/config';
25
+ import { defineConfig } from 'vitest/config';
26
+ import type { PluginOption } from './plugin-option.ts';
26
27
  import type { VitestAlias } from './vitest-aliases.ts';
27
28
  import type { CoverageThresholds } from './vitest.ts';
28
29
  /**
@@ -75,7 +76,7 @@ export interface RepoWebOptions {
75
76
  /**
76
77
  * Vite plugins the SPA needs (`react()` for JSX).
77
78
  */
78
- readonly plugins?: readonly Plugin[];
79
+ readonly plugins?: readonly PluginOption[];
79
80
  /**
80
81
  * Extra resolver entries for the web project only.
81
82
  */
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-repo.d.ts","sourceRoot":"","sources":["../src/vitest-repo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAI1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;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,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACnD;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AA4CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CA4ExG"}
@@ -1 +1 @@
1
- var f=Object.defineProperty;var o=(e,t)=>f(e,"name",{value:t,configurable:!0});import{defineConfig as x}from"vitest/config";import{fileURLToPath as g}from"node:url";import{manifestCoverageThresholds as b}from"./manifest.js";import{DEFAULT_CLOUDFLARE_MOCKS as v,DEFAULT_WORKSPACE_PACKAGES as w,KIT_NO_EXTERNAL as A,workspaceAliases as p}from"./vitest-aliases.js";const C=["**/node_modules/**","**/dist/**","test/integration/**","test/web/**","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],L=["test/web/**/*.test.{ts,tsx}","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],u=["scripts/**","**/*.test.ts","**/*.test.tsx","**/*.d.ts","**/index.ts","**/types.d.ts","**/types.ts","**/model/**","**/generated/**","**/D1Types.ts","**/ServiceEnv.ts","**/env.d.ts"],_="**/index.ts";function F(e){const t=e.root??new URL(".",import.meta.url).href,c=e.thresholds??b(t),l=e.packages??w,a=e.mocks??v,d=[...A,...e.noExternal??[]],r=e.backend??{},s=e.web??{},m=[...p({scope:e.scope,root:t,packages:l,mocks:a}),...e.aliases??[],...r.aliases??[]],i=g(new URL("apps/web/src",t)),E=[{find:/^@\//,replacement:`${i}/`},{find:/^~\//,replacement:`${i}/`},...p({scope:e.scope,root:t,packages:l,mocks:a}).filter(n=>typeof n.find=="string"),...e.aliases??[],...s.aliases??[]];return x({test:{projects:[{resolve:{alias:m,noExternal:d},test:{name:"backend",globals:!0,environment:"node",include:[...r.include??["test/**/*.test.{ts,tsx}"]],exclude:[...r.exclude??C],...r.setupFiles!==void 0&&{setupFiles:[...r.setupFiles]},server:{deps:{inline:[...r.serverDepsInline??["dofs"]]}}}},{...s.plugins!==void 0&&{plugins:[...s.plugins]},resolve:{alias:E,noExternal:d},test:{name:"web",globals:!0,environment:s.environment??"jsdom",include:[...s.include??L],exclude:[...s.exclude??["**/node_modules/**","**/dist/**","test/integration/**"]],pool:"threads",...s.setupFiles!==void 0&&{setupFiles:[...s.setupFiles]}}}],coverage:{provider:"v8",reporter:["text","lcov","html"],reportsDirectory:e.reportsDirectory??"./coverage",include:[...e.coverageInclude??["apps/api/src/**/*.ts","apps/background/src/**/*.ts","apps/web/src/**/*.{ts,tsx}","packages/**/src/**/*.ts"]],exclude:e.includeIndexBarrels?[...u.filter(n=>n!==_),...e.coverageExclude??[]]:[...u,...e.coverageExclude??[]],...c!==void 0&&{thresholds:{...c}}}}})}o(F,"defineRepoVitestConfig");export{F as defineRepoVitestConfig};
1
+ var f=Object.defineProperty;var o=(e,t)=>f(e,"name",{value:t,configurable:!0});import{defineConfig as g}from"vitest/config";import{asVitePlugins as x}from"./plugin-option.js";import{fileURLToPath as b}from"node:url";import{manifestCoverageThresholds as v}from"./manifest.js";import{DEFAULT_CLOUDFLARE_MOCKS as w,DEFAULT_WORKSPACE_PACKAGES as A,KIT_NO_EXTERNAL as C,workspaceAliases as p}from"./vitest-aliases.js";const L=["**/node_modules/**","**/dist/**","test/integration/**","test/web/**","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],_=["test/web/**/*.test.{ts,tsx}","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],u=["scripts/**","**/*.test.ts","**/*.test.tsx","**/*.d.ts","**/index.ts","**/types.d.ts","**/types.ts","**/model/**","**/generated/**","**/D1Types.ts","**/ServiceEnv.ts","**/env.d.ts"],D="**/index.ts";function N(e){const t=e.root??new URL(".",import.meta.url).href,c=e.thresholds??v(t),l=e.packages??A,a=e.mocks??w,d=[...C,...e.noExternal??[]],r=e.backend??{},s=e.web??{},m=[...p({scope:e.scope,root:t,packages:l,mocks:a}),...e.aliases??[],...r.aliases??[]],i=b(new URL("apps/web/src",t)),E=[{find:/^@\//,replacement:`${i}/`},{find:/^~\//,replacement:`${i}/`},...p({scope:e.scope,root:t,packages:l,mocks:a}).filter(n=>typeof n.find=="string"),...e.aliases??[],...s.aliases??[]];return g({test:{projects:[{resolve:{alias:m,noExternal:d},test:{name:"backend",globals:!0,environment:"node",include:[...r.include??["test/**/*.test.{ts,tsx}"]],exclude:[...r.exclude??L],...r.setupFiles!==void 0&&{setupFiles:[...r.setupFiles]},server:{deps:{inline:[...r.serverDepsInline??["dofs"]]}}}},{...s.plugins!==void 0&&{plugins:x(s.plugins)},resolve:{alias:E,noExternal:d},test:{name:"web",globals:!0,environment:s.environment??"jsdom",include:[...s.include??_],exclude:[...s.exclude??["**/node_modules/**","**/dist/**","test/integration/**"]],pool:"threads",...s.setupFiles!==void 0&&{setupFiles:[...s.setupFiles]}}}],coverage:{provider:"v8",reporter:["text","lcov","html"],reportsDirectory:e.reportsDirectory??"./coverage",include:[...e.coverageInclude??["apps/api/src/**/*.ts","apps/background/src/**/*.ts","apps/web/src/**/*.{ts,tsx}","packages/**/src/**/*.ts"]],exclude:e.includeIndexBarrels?[...u.filter(n=>n!==D),...e.coverageExclude??[]]:[...u,...e.coverageExclude??[]],...c!==void 0&&{thresholds:{...c}}}}})}o(N,"defineRepoVitestConfig");export{N as defineRepoVitestConfig};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/vitest-repo.ts"],
4
- "sourcesContent": ["/**\n * The single-file `projects` composition: backend (`node`) plus SPA (DOM).\n *\n * Provenance: AWS-AccessBridge (split by `.ts`/`.tsx` extension),\n * Mail-Meow (split by `test/web/**` directory, with per-project `setupFiles`\n * and the React plugin on the web project), CalDAV-Bridge (split by directory\n * with `happy-dom`). The two-file repos (Durable-DAV-Router, Mail-Otter) keep\n * `defineUnitVitestConfig()` + `defineWebVitestConfig()`; this factory is the\n * same two halves as `projects` entries in one file, sharing one root coverage\n * gate.\n *\n * Canonical decisions (all three sources agree):\n *\n * 1. **Coverage lives at the root**, not per project: one floor for the whole\n * unit suite. (Durable-DAV-Router's warning about a shared floor stands for\n * the two-file split; within one file the three sources all gate once.)\n * 2. **Each project repeats the alias table.** Vitest projects do not inherit\n * the root `resolve` (Mail-Meow), so a suite resolving `@scope/*`\n * differently from its sibling fails like a product bug. Both entries carry\n * the full table — backend with `@/` → API, web with `@/` + `~/` → SPA.\n * 3. **The web project keeps `pool: 'threads'`** and its DOM from\n * `defineWebVitestConfig()`; the backend project keeps `environment:\n * 'node'` and `server.deps.inline` from `defineUnitVitestConfig()`.\n */\n\nimport { defineConfig, type Plugin } from 'vitest/config';\nimport { fileURLToPath } from 'node:url';\nimport { manifestCoverageThresholds } from './manifest.ts';\nimport { DEFAULT_CLOUDFLARE_MOCKS, DEFAULT_WORKSPACE_PACKAGES, KIT_NO_EXTERNAL, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\nimport type { CoverageThresholds } from './vitest.ts';\n\n/**\n * The backend half of the `projects` pair.\n */\nexport interface RepoBackendOptions {\n /**\n * Which suites to collect. Defaults to the whole unit suite minus SPA and\n * integration shapes.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default.\n */\n readonly exclude?: readonly string[];\n /**\n * Setup files run before each backend test file.\n */\n readonly setupFiles?: readonly string[];\n /**\n * `node_modules` specifiers to inline through Vite. Defaults to `['dofs']`.\n */\n readonly serverDepsInline?: readonly string[];\n /**\n * Extra resolver entries for the backend project only.\n */\n readonly aliases?: readonly VitestAlias[];\n}\n\n/**\n * The SPA half of the `projects` pair.\n */\nexport interface RepoWebOptions {\n /**\n * The DOM implementation. `jsdom` is the family default; `happy-dom` is\n * CalDAV-Bridge's.\n */\n readonly environment?: 'jsdom' | 'happy-dom';\n /**\n * Which suites to collect. Defaults to every SPA shape the family uses.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default.\n */\n readonly exclude?: readonly string[];\n /**\n * Setup files run before each SPA test file.\n */\n readonly setupFiles?: readonly string[];\n /**\n * Vite plugins the SPA needs (`react()` for JSX).\n */\n readonly plugins?: readonly Plugin[];\n /**\n * Extra resolver entries for the web project only.\n */\n readonly aliases?: readonly VitestAlias[];\n}\n\n/**\n * What `defineRepoVitestConfig` accepts.\n */\nexport interface RepoVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`.\n */\n readonly scope: string;\n /**\n * Workspace package directory names. Defaults to the family superset.\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to workers/sockets/workflows.\n */\n readonly mocks?: readonly string[];\n /**\n * The repo root, as a file URL.\n */\n readonly root?: string;\n /**\n * Extra resolver entries applied to *both* projects (e.g. the `hono`\n * dedupe). Per-project extras go on `backend.aliases` / `web.aliases`.\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * Resolver `noExternal` patterns, merged after {@link KIT_NO_EXTERNAL}.\n */\n readonly noExternal?: readonly (string | RegExp)[];\n /**\n * The backend half. Omitted fields take the `defineUnitVitestConfig`\n * defaults.\n */\n readonly backend?: RepoBackendOptions;\n /**\n * The SPA half. Omitted fields take the `defineWebVitestConfig` defaults.\n */\n readonly web?: RepoWebOptions;\n /**\n * Coverage `include` globs. Defaults to the worker, the SPA and every\n * workspace package's `src`.\n */\n readonly coverageInclude?: readonly string[];\n /**\n * Coverage `exclude` globs, merged with the canonical set.\n */\n readonly coverageExclude?: readonly string[];\n /**\n * Report coverage for `index.ts` re-export barrels. See\n * `defineUnitVitestConfig`'s option of the same name.\n */\n readonly includeIndexBarrels?: boolean;\n /**\n * Coverage floors. Defaults to the manifest's `quality.coverage` (`.rexezuge.jsonc`\n * at `root`); without one, no floor.\n */\n readonly thresholds?: CoverageThresholds;\n /**\n * Where the coverage report is written.\n */\n readonly reportsDirectory?: string;\n}\n\n/**\n * Backend suites excluded from the backend project: the SPA shapes live in the\n * web project, and integration is its own config.\n */\nconst BACKEND_EXCLUDE: readonly string[] = [\n '**/node_modules/**',\n '**/dist/**',\n 'test/integration/**',\n 'test/web/**',\n 'test/**/web-*.test.{ts,tsx}',\n 'apps/web/**/*.test.{ts,tsx}',\n];\n\n/**\n * SPA suite shapes collected by the web project.\n */\nconst WEB_INCLUDE: readonly string[] = ['test/web/**/*.test.{ts,tsx}', 'test/**/web-*.test.{ts,tsx}', 'apps/web/**/*.test.{ts,tsx}'];\n\n/**\n * Coverage `exclude`: the union of the unit and web halves' canonical sets.\n */\nconst CANONICAL_COVERAGE_EXCLUDE: readonly string[] = [\n 'scripts/**',\n '**/*.test.ts',\n '**/*.test.tsx',\n '**/*.d.ts',\n '**/index.ts',\n '**/types.d.ts',\n '**/types.ts',\n '**/model/**',\n '**/generated/**',\n '**/D1Types.ts',\n '**/ServiceEnv.ts',\n '**/env.d.ts',\n];\n\n/**\n * The barrel exclusion, named so `includeIndexBarrels` can lift it. See the\n * unit factory's option for why a consumer might want it.\n */\nconst INDEX_BARREL_EXCLUDE = '**/index.ts';\n\n/**\n * Build the single-file `projects` config.\n *\n * ```ts\n * // vitest.config.mts\n * import { defineRepoVitestConfig } from '@rexezuge/tooling/vitest-repo';\n * export default defineRepoVitestConfig({\n * scope: '@myapp',\n * web: { environment: 'happy-dom' },\n * thresholds: { statements: 87, branches: 77, functions: 88, lines: 90 },\n * });\n * ```\n */\nexport function defineRepoVitestConfig(options: RepoVitestConfigOptions): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const thresholds = options.thresholds ?? manifestCoverageThresholds(root);\n const packages = options.packages ?? DEFAULT_WORKSPACE_PACKAGES;\n const mocks = options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS;\n const noExternal = [...KIT_NO_EXTERNAL, ...(options.noExternal ?? [])];\n const backend = options.backend ?? {};\n const web = options.web ?? {};\n\n const backendAliases = [\n ...workspaceAliases({ scope: options.scope, root, packages, mocks }),\n ...(options.aliases ?? []),\n ...(backend.aliases ?? []),\n ];\n // `@/` means the SPA in the web project (Mail-Otter's SPA source imports\n // through it); the workspace table's `@/` → API entry is dropped and the\n // SPA's own prepended. `~/` → SPA either way.\n const webSrc = fileURLToPath(new URL('apps/web/src', root));\n const webAliases: VitestAlias[] = [\n { find: /^@\\//, replacement: `${webSrc}/` },\n { find: /^~\\//, replacement: `${webSrc}/` },\n // Drop the workspace table's `@/`/`~/` (RegExp) entries — the SPA's own\n // prepended above win — and keep the `@scope/*` + `cloudflare:*` strings.\n ...workspaceAliases({ scope: options.scope, root, packages, mocks }).filter((alias) => typeof alias.find === 'string'),\n ...(options.aliases ?? []),\n ...(web.aliases ?? []),\n ];\n\n return defineConfig({\n test: {\n projects: [\n {\n resolve: { alias: backendAliases, noExternal },\n test: {\n name: 'backend',\n globals: true,\n environment: 'node',\n include: [...(backend.include ?? ['test/**/*.test.{ts,tsx}'])],\n exclude: [...(backend.exclude ?? BACKEND_EXCLUDE)],\n ...(backend.setupFiles !== undefined && { setupFiles: [...backend.setupFiles] }),\n server: { deps: { inline: [...(backend.serverDepsInline ?? ['dofs'])] } },\n },\n },\n {\n ...(web.plugins !== undefined && { plugins: [...web.plugins] }),\n resolve: { alias: webAliases, noExternal },\n test: {\n name: 'web',\n globals: true,\n environment: web.environment ?? 'jsdom',\n include: [...(web.include ?? WEB_INCLUDE)],\n exclude: [...(web.exclude ?? ['**/node_modules/**', '**/dist/**', 'test/integration/**'])],\n pool: 'threads',\n ...(web.setupFiles !== undefined && { setupFiles: [...web.setupFiles] }),\n },\n },\n ],\n coverage: {\n provider: 'v8',\n reporter: ['text', 'lcov', 'html'],\n reportsDirectory: options.reportsDirectory ?? './coverage',\n include: [\n ...(options.coverageInclude ?? [\n 'apps/api/src/**/*.ts',\n 'apps/background/src/**/*.ts',\n 'apps/web/src/**/*.{ts,tsx}',\n 'packages/**/src/**/*.ts',\n ]),\n ],\n exclude: options.includeIndexBarrels\n ? [...CANONICAL_COVERAGE_EXCLUDE.filter((glob) => glob !== INDEX_BARREL_EXCLUDE), ...(options.coverageExclude ?? [])]\n : [...CANONICAL_COVERAGE_EXCLUDE, ...(options.coverageExclude ?? [])],\n ...(thresholds !== undefined && { thresholds: { ...thresholds } }),\n },\n },\n });\n}\n"],
5
- "mappings": "+EAyBA,OAAS,gBAAAA,MAAiC,gBAC1C,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,8BAAAC,MAAkC,gBAC3C,OAAS,4BAAAC,EAA0B,8BAAAC,EAA4B,mBAAAC,EAAiB,oBAAAC,MAAwB,sBAiIxG,MAAMC,EAAqC,CACzC,qBACA,aACA,sBACA,cACA,8BACA,+BAMIC,EAAiC,CAAC,8BAA+B,8BAA+B,6BA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gB,EACjD,GAAIW,EAAQ,aAAe,QAAa,CAAE,WAAY,CAAC,GAAGA,EAAQ,UAAU,CAAC,EAC7E,OAAQ,CAAE,KAAM,CAAE,OAAQ,CAAC,GAAIA,EAAQ,kBAAoB,CAAC,MAAM,CAAE,CAAC,CAAE,IAG3E,CACE,GAAIC,EAAI,UAAY,QAAa,CAAE,QAAS,CAAC,GAAGA,EAAI,OAAO,CAAC,EAC5D,QAAS,CAAE,MAAOG,EAAY,WAAAL,CAAU,EACxC,KAAM,CACJ,KAAM,MACN,QAAS,GACT,YAAaE,EAAI,aAAe,QAChC,QAAS,CAAC,GAAIA,EAAI,SAAWX,CAAY,EACzC,QAAS,CAAC,GAAIW,EAAI,SAAW,CAAC,qBAAsB,aAAc,qBAAqB,CAAE,EACzF,KAAM,UACN,GAAIA,EAAI,aAAe,QAAa,CAAE,WAAY,CAAC,GAAGA,EAAI,UAAU,CAAC,KAI3E,SAAU,CACR,SAAU,KACV,SAAU,CAAC,OAAQ,OAAQ,MAAM,EACjC,iBAAkBP,EAAQ,kBAAoB,aAC9C,QAAS,CACP,GAAIA,EAAQ,iBAAmB,CAC7B,uBACA,8BACA,6BACA,4BAGJ,QAASA,EAAQ,oBACb,CAAC,GAAGH,EAA2B,OAAQe,GAASA,IAASd,CAAoB,EAAG,GAAIE,EAAQ,iBAAmB,CAAA,CAAG,EAClH,CAAC,GAAGH,EAA4B,GAAIG,EAAQ,iBAAmB,CAAA,CAAG,EACtE,GAAIE,IAAe,QAAa,CAAE,WAAY,CAAE,GAAGA,CAAU,CAAE,IAGpE,CACH,CA5EgBW,EAAAd,EAAA",
6
- "names": ["defineConfig", "fileURLToPath", "manifestCoverageThresholds", "DEFAULT_CLOUDFLARE_MOCKS", "DEFAULT_WORKSPACE_PACKAGES", "KIT_NO_EXTERNAL", "workspaceAliases", "BACKEND_EXCLUDE", "WEB_INCLUDE", "CANONICAL_COVERAGE_EXCLUDE", "INDEX_BARREL_EXCLUDE", "defineRepoVitestConfig", "options", "root", "thresholds", "packages", "mocks", "noExternal", "backend", "web", "backendAliases", "webSrc", "webAliases", "alias", "glob", "__name"]
4
+ "sourcesContent": ["/**\n * The single-file `projects` composition: backend (`node`) plus SPA (DOM).\n *\n * Provenance: AWS-AccessBridge (split by `.ts`/`.tsx` extension),\n * Mail-Meow (split by `test/web/**` directory, with per-project `setupFiles`\n * and the React plugin on the web project), CalDAV-Bridge (split by directory\n * with `happy-dom`). The two-file repos (Durable-DAV-Router, Mail-Otter) keep\n * `defineUnitVitestConfig()` + `defineWebVitestConfig()`; this factory is the\n * same two halves as `projects` entries in one file, sharing one root coverage\n * gate.\n *\n * Canonical decisions (all three sources agree):\n *\n * 1. **Coverage lives at the root**, not per project: one floor for the whole\n * unit suite. (Durable-DAV-Router's warning about a shared floor stands for\n * the two-file split; within one file the three sources all gate once.)\n * 2. **Each project repeats the alias table.** Vitest projects do not inherit\n * the root `resolve` (Mail-Meow), so a suite resolving `@scope/*`\n * differently from its sibling fails like a product bug. Both entries carry\n * the full table — backend with `@/` → API, web with `@/` + `~/` → SPA.\n * 3. **The web project keeps `pool: 'threads'`** and its DOM from\n * `defineWebVitestConfig()`; the backend project keeps `environment:\n * 'node'` and `server.deps.inline` from `defineUnitVitestConfig()`.\n */\n\nimport { defineConfig } from 'vitest/config';\nimport { asVitePlugins } from './plugin-option.ts';\nimport type { PluginOption } from './plugin-option.ts';\nimport { fileURLToPath } from 'node:url';\nimport { manifestCoverageThresholds } from './manifest.ts';\nimport { DEFAULT_CLOUDFLARE_MOCKS, DEFAULT_WORKSPACE_PACKAGES, KIT_NO_EXTERNAL, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\nimport type { CoverageThresholds } from './vitest.ts';\n\n/**\n * The backend half of the `projects` pair.\n */\nexport interface RepoBackendOptions {\n /**\n * Which suites to collect. Defaults to the whole unit suite minus SPA and\n * integration shapes.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default.\n */\n readonly exclude?: readonly string[];\n /**\n * Setup files run before each backend test file.\n */\n readonly setupFiles?: readonly string[];\n /**\n * `node_modules` specifiers to inline through Vite. Defaults to `['dofs']`.\n */\n readonly serverDepsInline?: readonly string[];\n /**\n * Extra resolver entries for the backend project only.\n */\n readonly aliases?: readonly VitestAlias[];\n}\n\n/**\n * The SPA half of the `projects` pair.\n */\nexport interface RepoWebOptions {\n /**\n * The DOM implementation. `jsdom` is the family default; `happy-dom` is\n * CalDAV-Bridge's.\n */\n readonly environment?: 'jsdom' | 'happy-dom';\n /**\n * Which suites to collect. Defaults to every SPA shape the family uses.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default.\n */\n readonly exclude?: readonly string[];\n /**\n * Setup files run before each SPA test file.\n */\n readonly setupFiles?: readonly string[];\n /**\n * Vite plugins the SPA needs (`react()` for JSX).\n */\n readonly plugins?: readonly PluginOption[];\n /**\n * Extra resolver entries for the web project only.\n */\n readonly aliases?: readonly VitestAlias[];\n}\n\n/**\n * What `defineRepoVitestConfig` accepts.\n */\nexport interface RepoVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`.\n */\n readonly scope: string;\n /**\n * Workspace package directory names. Defaults to the family superset.\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to workers/sockets/workflows.\n */\n readonly mocks?: readonly string[];\n /**\n * The repo root, as a file URL.\n */\n readonly root?: string;\n /**\n * Extra resolver entries applied to *both* projects (e.g. the `hono`\n * dedupe). Per-project extras go on `backend.aliases` / `web.aliases`.\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * Resolver `noExternal` patterns, merged after {@link KIT_NO_EXTERNAL}.\n */\n readonly noExternal?: readonly (string | RegExp)[];\n /**\n * The backend half. Omitted fields take the `defineUnitVitestConfig`\n * defaults.\n */\n readonly backend?: RepoBackendOptions;\n /**\n * The SPA half. Omitted fields take the `defineWebVitestConfig` defaults.\n */\n readonly web?: RepoWebOptions;\n /**\n * Coverage `include` globs. Defaults to the worker, the SPA and every\n * workspace package's `src`.\n */\n readonly coverageInclude?: readonly string[];\n /**\n * Coverage `exclude` globs, merged with the canonical set.\n */\n readonly coverageExclude?: readonly string[];\n /**\n * Report coverage for `index.ts` re-export barrels. See\n * `defineUnitVitestConfig`'s option of the same name.\n */\n readonly includeIndexBarrels?: boolean;\n /**\n * Coverage floors. Defaults to the manifest's `quality.coverage` (`.rexezuge.jsonc`\n * at `root`); without one, no floor.\n */\n readonly thresholds?: CoverageThresholds;\n /**\n * Where the coverage report is written.\n */\n readonly reportsDirectory?: string;\n}\n\n/**\n * Backend suites excluded from the backend project: the SPA shapes live in the\n * web project, and integration is its own config.\n */\nconst BACKEND_EXCLUDE: readonly string[] = [\n '**/node_modules/**',\n '**/dist/**',\n 'test/integration/**',\n 'test/web/**',\n 'test/**/web-*.test.{ts,tsx}',\n 'apps/web/**/*.test.{ts,tsx}',\n];\n\n/**\n * SPA suite shapes collected by the web project.\n */\nconst WEB_INCLUDE: readonly string[] = ['test/web/**/*.test.{ts,tsx}', 'test/**/web-*.test.{ts,tsx}', 'apps/web/**/*.test.{ts,tsx}'];\n\n/**\n * Coverage `exclude`: the union of the unit and web halves' canonical sets.\n */\nconst CANONICAL_COVERAGE_EXCLUDE: readonly string[] = [\n 'scripts/**',\n '**/*.test.ts',\n '**/*.test.tsx',\n '**/*.d.ts',\n '**/index.ts',\n '**/types.d.ts',\n '**/types.ts',\n '**/model/**',\n '**/generated/**',\n '**/D1Types.ts',\n '**/ServiceEnv.ts',\n '**/env.d.ts',\n];\n\n/**\n * The barrel exclusion, named so `includeIndexBarrels` can lift it. See the\n * unit factory's option for why a consumer might want it.\n */\nconst INDEX_BARREL_EXCLUDE = '**/index.ts';\n\n/**\n * Build the single-file `projects` config.\n *\n * ```ts\n * // vitest.config.mts\n * import { defineRepoVitestConfig } from '@rexezuge/tooling/vitest-repo';\n * export default defineRepoVitestConfig({\n * scope: '@myapp',\n * web: { environment: 'happy-dom' },\n * thresholds: { statements: 87, branches: 77, functions: 88, lines: 90 },\n * });\n * ```\n */\nexport function defineRepoVitestConfig(options: RepoVitestConfigOptions): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const thresholds = options.thresholds ?? manifestCoverageThresholds(root);\n const packages = options.packages ?? DEFAULT_WORKSPACE_PACKAGES;\n const mocks = options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS;\n const noExternal = [...KIT_NO_EXTERNAL, ...(options.noExternal ?? [])];\n const backend = options.backend ?? {};\n const web = options.web ?? {};\n\n const backendAliases = [\n ...workspaceAliases({ scope: options.scope, root, packages, mocks }),\n ...(options.aliases ?? []),\n ...(backend.aliases ?? []),\n ];\n // `@/` means the SPA in the web project (Mail-Otter's SPA source imports\n // through it); the workspace table's `@/` → API entry is dropped and the\n // SPA's own prepended. `~/` → SPA either way.\n const webSrc = fileURLToPath(new URL('apps/web/src', root));\n const webAliases: VitestAlias[] = [\n { find: /^@\\//, replacement: `${webSrc}/` },\n { find: /^~\\//, replacement: `${webSrc}/` },\n // Drop the workspace table's `@/`/`~/` (RegExp) entries — the SPA's own\n // prepended above win — and keep the `@scope/*` + `cloudflare:*` strings.\n ...workspaceAliases({ scope: options.scope, root, packages, mocks }).filter((alias) => typeof alias.find === 'string'),\n ...(options.aliases ?? []),\n ...(web.aliases ?? []),\n ];\n\n return defineConfig({\n test: {\n projects: [\n {\n resolve: { alias: backendAliases, noExternal },\n test: {\n name: 'backend',\n globals: true,\n environment: 'node',\n include: [...(backend.include ?? ['test/**/*.test.{ts,tsx}'])],\n exclude: [...(backend.exclude ?? BACKEND_EXCLUDE)],\n ...(backend.setupFiles !== undefined && { setupFiles: [...backend.setupFiles] }),\n server: { deps: { inline: [...(backend.serverDepsInline ?? ['dofs'])] } },\n },\n },\n {\n ...(web.plugins !== undefined && { plugins: asVitePlugins(web.plugins) }),\n resolve: { alias: webAliases, noExternal },\n test: {\n name: 'web',\n globals: true,\n environment: web.environment ?? 'jsdom',\n include: [...(web.include ?? WEB_INCLUDE)],\n exclude: [...(web.exclude ?? ['**/node_modules/**', '**/dist/**', 'test/integration/**'])],\n pool: 'threads',\n ...(web.setupFiles !== undefined && { setupFiles: [...web.setupFiles] }),\n },\n },\n ],\n coverage: {\n provider: 'v8',\n reporter: ['text', 'lcov', 'html'],\n reportsDirectory: options.reportsDirectory ?? './coverage',\n include: [\n ...(options.coverageInclude ?? [\n 'apps/api/src/**/*.ts',\n 'apps/background/src/**/*.ts',\n 'apps/web/src/**/*.{ts,tsx}',\n 'packages/**/src/**/*.ts',\n ]),\n ],\n exclude: options.includeIndexBarrels\n ? [...CANONICAL_COVERAGE_EXCLUDE.filter((glob) => glob !== INDEX_BARREL_EXCLUDE), ...(options.coverageExclude ?? [])]\n : [...CANONICAL_COVERAGE_EXCLUDE, ...(options.coverageExclude ?? [])],\n ...(thresholds !== undefined && { thresholds: { ...thresholds } }),\n },\n },\n });\n}\n"],
5
+ "mappings": "+EAyBA,OAAS,gBAAAA,MAAoB,gBAC7B,OAAS,iBAAAC,MAAqB,qBAE9B,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,8BAAAC,MAAkC,gBAC3C,OAAS,4BAAAC,EAA0B,8BAAAC,EAA4B,mBAAAC,EAAiB,oBAAAC,MAAwB,sBAiIxG,MAAMC,EAAqC,CACzC,qBACA,aACA,sBACA,cACA,8BACA,+BAMIC,EAAiC,CAAC,8BAA+B,8BAA+B,6BAA6B,EAK7HC,EAAgD,CACpD,aACA,eACA,gBACA,YACA,cACA,gBACA,cACA,cACA,kBACA,gBACA,mBACA,eAOIC,EAAuB,cAevB,SAAUC,EAAuBC,EAAgC,CACrE,MAAMC,EAAOD,EAAQ,MAAQ,IAAI,IAAI,IAAK,YAAY,GAAG,EAAE,KACrDE,EAAaF,EAAQ,YAAcV,EAA2BW,CAAI,EAClEE,EAAWH,EAAQ,UAAYR,EAC/BY,EAAQJ,EAAQ,OAAST,EACzBc,EAAa,CAAC,GAAGZ,EAAiB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GACT,YAAaE,EAAI,aAAe,QAChC,QAAS,CAAC,GAAIA,EAAI,SAAWX,CAAY,EACzC,QAAS,CAAC,GAAIW,EAAI,SAAW,CAAC,qBAAsB,aAAc,qBAAqB,CAAE,EACzF,KAAM,UACN,GAAIA,EAAI,aAAe,QAAa,CAAE,WAAY,CAAC,GAAGA,EAAI,UAAU,CAAC,KAI3E,SAAU,CACR,SAAU,KACV,SAAU,CAAC,OAAQ,OAAQ,MAAM,EACjC,iBAAkBP,EAAQ,kBAAoB,aAC9C,QAAS,CACP,GAAIA,EAAQ,iBAAmB,CAC7B,uBACA,8BACA,6BACA,4BAGJ,QAASA,EAAQ,oBACb,CAAC,GAAGH,EAA2B,OAAQe,GAASA,IAASd,CAAoB,EAAG,GAAIE,EAAQ,iBAAmB,CAAA,CAAG,EAClH,CAAC,GAAGH,EAA4B,GAAIG,EAAQ,iBAAmB,CAAA,CAAG,EACtE,GAAIE,IAAe,QAAa,CAAE,WAAY,CAAE,GAAGA,CAAU,CAAE,IAGpE,CACH,CA5EgBW,EAAAd,EAAA",
6
+ "names": ["defineConfig", "asVitePlugins", "fileURLToPath", "manifestCoverageThresholds", "DEFAULT_CLOUDFLARE_MOCKS", "DEFAULT_WORKSPACE_PACKAGES", "KIT_NO_EXTERNAL", "workspaceAliases", "BACKEND_EXCLUDE", "WEB_INCLUDE", "CANONICAL_COVERAGE_EXCLUDE", "INDEX_BARREL_EXCLUDE", "defineRepoVitestConfig", "options", "root", "thresholds", "packages", "mocks", "noExternal", "backend", "web", "backendAliases", "webSrc", "webAliases", "alias", "glob", "__name"]
7
7
  }
@@ -38,7 +38,8 @@
38
38
  * `apps/web/src`. Workspace `@scope/*` imports still resolve to the
39
39
  * packages, so web tests reach shared logic the same way backend tests do.
40
40
  */
41
- import { defineConfig, type Plugin } from 'vitest/config';
41
+ import { defineConfig } from 'vitest/config';
42
+ import type { PluginOption } from './plugin-option.ts';
42
43
  import type { VitestAlias } from './vitest-aliases.ts';
43
44
  import type { CoverageThresholds } from './vitest.ts';
44
45
  /**
@@ -64,7 +65,7 @@ export interface WebVitestConfigOptions {
64
65
  * by the consumer rather than imported here, because the kit must stay
65
66
  * zero-dependency and the plugin belongs to the app, not the harness.
66
67
  */
67
- readonly plugins?: readonly Plugin[];
68
+ readonly plugins?: readonly PluginOption[];
68
69
  /**
69
70
  * Extra resolver entries, applied after the canonical ones.
70
71
  */
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-web.d.ts","sourceRoot":"","sources":["../src/vitest-web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAA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}from"node:url";import{DEFAULT_CLOUDFLARE_MOCKS as u,DEFAULT_WORKSPACE_PACKAGES as f,KIT_NO_EXTERNAL as o,workspaceAliases as p}from"./vitest-aliases.js";const g=["test/web/**/*.test.{ts,tsx}","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],m=["**/*.test.{ts,tsx}","**/*.d.ts","**/types.ts","**/generated/**"];function L(e={}){const s=e.root??new URL(".",import.meta.url).href,r=a(new URL("apps/web/src",s)),d=p({scope:e.scope??"@unused",root:s,packages:e.packages??f,mocks:e.mocks??u}).filter(t=>typeof t.find=="string"&&!t.find.startsWith("@unused")),l=[{find:/^@\//,replacement:`${r}/`},{find:/^~\//,replacement:`${r}/`},...d.filter(t=>typeof t.find=="string"&&(t.find.startsWith("cloudflare:")||e.scope!==void 0)),...e.aliases??[]];return i({...e.plugins!==void 0&&{plugins:[...e.plugins]},resolve:{alias:l,noExternal:[...o,...e.noExternal??[]]},test:{globals:!0,environment:e.environment??"jsdom",include:[...e.include??g],pool:"threads",exclude:[...e.exclude??["**/node_modules/**","**/dist/**","test/integration/**"]],...e.setupFiles!==void 0&&{setupFiles:[...e.setupFiles]},...e.serverDepsInline!==void 0&&{server:{deps:{inline:[...e.serverDepsInline]}}},coverage:{provider:"v8",reporter:["text","lcov"],reportsDirectory:e.reportsDirectory??"./coverage-spa",include:[...e.coverageInclude??["apps/web/src/**/*.{ts,tsx}"]],exclude:[...m,...e.coverageExclude??[]],...e.thresholds!==void 0&&{thresholds:{...e.thresholds}}}}})}n(L,"defineWebVitestConfig");export{L as defineWebVitestConfig};
1
+ var c=Object.defineProperty;var n=(e,s)=>c(e,"name",{value:s,configurable:!0});import{defineConfig as i}from"vitest/config";import{asVitePlugins as a}from"./plugin-option.js";import{fileURLToPath as u}from"node:url";import{DEFAULT_CLOUDFLARE_MOCKS as f,DEFAULT_WORKSPACE_PACKAGES as o,KIT_NO_EXTERNAL as p,workspaceAliases as m}from"./vitest-aliases.js";const g=["test/web/**/*.test.{ts,tsx}","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],E=["**/*.test.{ts,tsx}","**/*.d.ts","**/types.ts","**/generated/**"];function C(e={}){const s=e.root??new URL(".",import.meta.url).href,r=u(new URL("apps/web/src",s)),d=m({scope:e.scope??"@unused",root:s,packages:e.packages??o,mocks:e.mocks??f}).filter(t=>typeof t.find=="string"&&!t.find.startsWith("@unused")),l=[{find:/^@\//,replacement:`${r}/`},{find:/^~\//,replacement:`${r}/`},...d.filter(t=>typeof t.find=="string"&&(t.find.startsWith("cloudflare:")||e.scope!==void 0)),...e.aliases??[]];return i({...e.plugins!==void 0&&{plugins:a(e.plugins)},resolve:{alias:l,noExternal:[...p,...e.noExternal??[]]},test:{globals:!0,environment:e.environment??"jsdom",include:[...e.include??g],pool:"threads",exclude:[...e.exclude??["**/node_modules/**","**/dist/**","test/integration/**"]],...e.setupFiles!==void 0&&{setupFiles:[...e.setupFiles]},...e.serverDepsInline!==void 0&&{server:{deps:{inline:[...e.serverDepsInline]}}},coverage:{provider:"v8",reporter:["text","lcov"],reportsDirectory:e.reportsDirectory??"./coverage-spa",include:[...e.coverageInclude??["apps/web/src/**/*.{ts,tsx}"]],exclude:[...E,...e.coverageExclude??[]],...e.thresholds!==void 0&&{thresholds:{...e.thresholds}}}}})}n(C,"defineWebVitestConfig");export{C as defineWebVitestConfig};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/vitest-web.ts"],
4
- "sourcesContent": ["/**\n * The SPA's test and coverage gate.\n *\n * Provenance: converged from all nine repos' SPA suites — Durable-DAV-Router's\n * and Mail-Otter's `vitest.web.config.mts` (the two repos that gave the frontend\n * its own file), Mail-Meow's and CalDAV-Bridge's `projects` entries (the two\n * that keep backend and SPA in one file), and AWS-AccessBridge's\n * extension-split `dom` project. Durable-DAV-Router's file is the canonical\n * shape — it is the one that records *why* the split exists; Mail-Otter's\n * contributes the React plugin and the `apps/web/**` include; CalDAV-Bridge\n * contributes `happy-dom` and the `test/web/**` directory convention;\n * Mail-Meow contributes `setupFiles` and the note that projects do not inherit\n * the root `resolve`.\n *\n * Canonical decisions:\n *\n * 1. **A DOM for every file here**, rather than a `@vitest-environment` pragma\n * per file: these are the tests that need a DOM, and the pragma is one more\n * place to forget. `jsdom` is the family default (seven repos);\n * `happy-dom` is CalDAV-Bridge's, and is one option away.\n * 2. **`pool: 'threads'`, bounded, rather than one forked worker per file.** Each\n * jsdom document is a whole browser environment; a fork per file exhausts\n * memory on a constrained machine, and when it does the run dies partway with\n * a bare \"Worker exited unexpectedly\" and no test reports a failure — which\n * reads as a flaky suite rather than as an out-of-memory kill.\n * 3. **`include` covers every shape the family uses** — the `test/web/**`\n * directory convention, the root-suite `web-*` naming convention, and suites\n * bundled under `apps/web` — and the same globs are what\n * `defineUnitVitestConfig()` excludes, so a file is collected by exactly one\n * config.\n * 4. **Projects do not inherit the root `resolve`** (Mail-Meow): a\n * single-file `projects` composition must repeat the alias table per\n * project. `defineRepoVitestConfig()` does that; two-file repos get it from\n * these factories directly.\n * 5. **`@/` means the SPA here, not the API worker.** The unit config maps\n * `@/` to `apps/api/src`; this config maps both `@/` (Mail-Otter's SPA\n * source) and `~/` (Mail-Meow's and CalDAV-Bridge's SPA tests) to\n * `apps/web/src`. Workspace `@scope/*` imports still resolve to the\n * packages, so web tests reach shared logic the same way backend tests do.\n */\n\nimport { defineConfig, type Plugin } from 'vitest/config';\nimport { fileURLToPath } from 'node:url';\nimport { DEFAULT_CLOUDFLARE_MOCKS, DEFAULT_WORKSPACE_PACKAGES, KIT_NO_EXTERNAL, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\nimport type { CoverageThresholds } from './vitest.ts';\n\n/**\n * What `defineWebVitestConfig` accepts.\n */\nexport interface WebVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. When supplied, `@scope/*`\n * workspace aliases are generated so web tests reach shared logic; when\n * omitted, only the `cloudflare:*`, `@/` and `~/` aliases apply.\n */\n readonly scope?: string;\n /**\n * Workspace package directory names. Defaults to the family superset.\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to workers/sockets/workflows.\n */\n readonly mocks?: readonly string[];\n /**\n * Vite plugins the SPA needs — `@vitejs/plugin-react` for a React app. Passed\n * by the consumer rather than imported here, because the kit must stay\n * zero-dependency and the plugin belongs to the app, not the harness.\n */\n readonly plugins?: readonly Plugin[];\n /**\n * Extra resolver entries, applied after the canonical ones.\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * The repo root, as a file URL.\n */\n readonly root?: string;\n /**\n * The DOM implementation. `jsdom` is the family default; `happy-dom` is\n * CalDAV-Bridge's (lighter, and sufficient for its hook/service suites).\n */\n readonly environment?: 'jsdom' | 'happy-dom';\n /**\n * Which suites to collect. Defaults to every shape the family uses.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default.\n */\n readonly exclude?: readonly string[];\n /**\n * Setup files run before each test file.\n */\n readonly setupFiles?: readonly string[];\n /**\n * `node_modules` specifiers to inline through Vite rather than externalize.\n */\n readonly serverDepsInline?: readonly string[];\n /**\n * Resolver `noExternal` patterns, merged after {@link KIT_NO_EXTERNAL}.\n */\n readonly noExternal?: readonly (string | RegExp)[];\n /**\n * Coverage `include` globs. Defaults to the SPA source.\n */\n readonly coverageInclude?: readonly string[];\n /**\n * Coverage `exclude` globs, merged with the canonical set.\n */\n readonly coverageExclude?: readonly string[];\n /**\n * Coverage floors. Omitted by default; see `defineUnitVitestConfig`.\n */\n readonly thresholds?: CoverageThresholds;\n /**\n * Where the coverage report is written. Separate from the unit config's, so\n * the two gates never overwrite each other's report.\n */\n readonly reportsDirectory?: string;\n}\n\n/**\n * The default suite globs: every shape the family uses — the `test/web/**`\n * directory convention, the root-suite `web-*` convention, and the\n * bundled-under-`apps/web` convention — so any layout works unchanged.\n */\nconst DEFAULT_INCLUDE: readonly string[] = ['test/web/**/*.test.{ts,tsx}', 'test/**/web-*.test.{ts,tsx}', 'apps/web/**/*.test.{ts,tsx}'];\n\n/**\n * Coverage `exclude` globs for the SPA half.\n */\nconst CANONICAL_COVERAGE_EXCLUDE: readonly string[] = ['**/*.test.{ts,tsx}', '**/*.d.ts', '**/types.ts', '**/generated/**'];\n\n/**\n * Build the SPA's test config.\n *\n * ```ts\n * // vitest.web.config.mts\n * import react from '@vitejs/plugin-react';\n * import { defineWebVitestConfig } from '@rexezuge/tooling/vitest-web';\n * export default defineWebVitestConfig({ scope: '@myapp', plugins: [react()] });\n * ```\n */\nexport function defineWebVitestConfig(options: WebVitestConfigOptions = {}): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const webSrc = fileURLToPath(new URL('apps/web/src', root));\n // The workspace table maps `@/` to the API worker; here `@/` means the SPA,\n // so drop its `@/`/`~/` entries and prepend the SPA's own. String finds\n // (`@scope/*`, `cloudflare:*`) survive; a placeholder scope contributes none.\n const scopePart = workspaceAliases({\n scope: options.scope ?? '@unused',\n root,\n packages: options.packages ?? DEFAULT_WORKSPACE_PACKAGES,\n mocks: options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS,\n }).filter((alias) => typeof alias.find === 'string' && !alias.find.startsWith('@unused'));\n const aliases: VitestAlias[] = [\n { find: /^@\\//, replacement: `${webSrc}/` },\n { find: /^~\\//, replacement: `${webSrc}/` },\n ...scopePart.filter((alias) => typeof alias.find === 'string' && (alias.find.startsWith('cloudflare:') || options.scope !== undefined)),\n ...(options.aliases ?? []),\n ];\n\n return defineConfig({\n ...(options.plugins !== undefined && { plugins: [...options.plugins] }),\n resolve: { alias: aliases, noExternal: [...KIT_NO_EXTERNAL, ...(options.noExternal ?? [])] },\n test: {\n globals: true,\n environment: options.environment ?? 'jsdom',\n include: [...(options.include ?? DEFAULT_INCLUDE)],\n // Threads, bounded, rather than one forked worker per file — see the\n // header. A custom `exclude` replaces Vitest's defaults, so `node_modules`\n // must be re-listed.\n pool: 'threads',\n exclude: [...(options.exclude ?? ['**/node_modules/**', '**/dist/**', 'test/integration/**'])],\n ...(options.setupFiles !== undefined && { setupFiles: [...options.setupFiles] }),\n ...(options.serverDepsInline !== undefined && {\n server: { deps: { inline: [...options.serverDepsInline] } },\n }),\n coverage: {\n provider: 'v8',\n reporter: ['text', 'lcov'],\n reportsDirectory: options.reportsDirectory ?? './coverage-spa',\n include: [...(options.coverageInclude ?? ['apps/web/src/**/*.{ts,tsx}'])],\n exclude: [...CANONICAL_COVERAGE_EXCLUDE, ...(options.coverageExclude ?? [])],\n ...(options.thresholds !== undefined && { thresholds: { ...options.thresholds } }),\n },\n },\n });\n}\n"],
5
- "mappings": "+EAyCA,OAAS,gBAAAA,MAAiC,gBAC1C,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,4BAAAC,EAA0B,8BAAAC,EAA4B,mBAAAC,EAAiB,oBAAAC,MAAwB,sBAqFxG,MAAMC,EAAqC,CAAC,8BAA+B,8BAA+B,6BAA6B,EAKjIC,EAAgD,CAAC,qBAAsB,YAAa,cAAe,iBAAiB,EAYpH,SAAUC,EAAsBC,EAAkC,CAAA,EAAE,CACxE,MAAMC,EAAOD,EAAQ,MAAQ,IAAI,IAAI,IAAK,YAAY,GAAG,EAAE,KACrDE,EAASV,EAAc,IAAI,IAAI,eAAgBS,CAAI,CAAC,EAIpDE,EAAYP,EAAiB,CACjC,MAAOI,EAAQ,OAAS,UACxB,KAAAC,EACA,SAAUD,EAAQ,UAAYN,EAC9B,MAAOM,EAAQ,OAASP,EACzB,EAAE,OAAQW,GAAU,OAAOA,EAAM,MAAS,UAAY,CAACA,EAAM,KAAK,WAAW,SAAS,CAAC,EAClFC,EAAyB,CAC7B,CAAE,KAAM,OAAQ,YAAa,GAAGH,CAAM,GAAG,EACzC,CAAE,KAAM,OAAQ,YAAa,GAAGA,CAAM,GAAG,EACzC,GAAGC,EAAU,OAAQC,GAAU,OAAOA,EAAM,MAAS,WAAaA,EAAM,KAAK,WAAW,aAAa,GAAKJ,EAAQ,QAAU,OAAU,EACtI,GAAIA,EAAQ,SAAW,CAAA,GAGzB,OAAOT,EAAa,CAClB,GAAIS,EAAQ,UAAY,QAAa,CAAE,QAAS,CAAC,GAAGA,EAAQ,OAAO,CAAC,EACpE,QAAS,CAAE,MAAOK,EAAS,WAAY,CAAC,GAAGV,EAAiB,GAAIK,EAAQ,YAAc,CAAA,CAAG,CAAC,EAC1F,KAAM,CACJ,QAAS,GACT,YAAaA,EAAQ,aAAe,QACpC,QAAS,CAAC,GAAIA,EAAQ,SAAWH,CAAgB,EAIjD,KAAM,UACN,QAAS,CAAC,GAAIG,EAAQ,SAAW,CAAC,qBAAsB,aAAc,qBAAqB,CAAE,EAC7F,GAAIA,EAAQ,aAAe,QAAa,CAAE,WAAY,CAAC,GAAGA,EAAQ,UAAU,CAAC,EAC7E,GAAIA,EAAQ,mBAAqB,QAAa,CAC5C,OAAQ,CAAE,KAAM,CAAE,OAAQ,CAAC,GAAGA,EAAQ,gBAAgB,CAAC,CAAE,GAE3D,SAAU,CACR,SAAU,KACV,SAAU,CAAC,OAAQ,MAAM,EACzB,iBAAkBA,EAAQ,kBAAoB,iBAC9C,QAAS,CAAC,GAAIA,EAAQ,iBAAmB,CAAC,4BAA4B,CAAE,EACxE,QAAS,CAAC,GAAGF,EAA4B,GAAIE,EAAQ,iBAAmB,CAAA,CAAG,EAC3E,GAAIA,EAAQ,aAAe,QAAa,CAAE,WAAY,CAAE,GAAGA,EAAQ,UAAU,CAAE,IAGpF,CACH,CA7CgBM,EAAAP,EAAA",
6
- "names": ["defineConfig", "fileURLToPath", "DEFAULT_CLOUDFLARE_MOCKS", "DEFAULT_WORKSPACE_PACKAGES", "KIT_NO_EXTERNAL", "workspaceAliases", "DEFAULT_INCLUDE", "CANONICAL_COVERAGE_EXCLUDE", "defineWebVitestConfig", "options", "root", "webSrc", "scopePart", "alias", "aliases", "__name"]
4
+ "sourcesContent": ["/**\n * The SPA's test and coverage gate.\n *\n * Provenance: converged from all nine repos' SPA suites — Durable-DAV-Router's\n * and Mail-Otter's `vitest.web.config.mts` (the two repos that gave the frontend\n * its own file), Mail-Meow's and CalDAV-Bridge's `projects` entries (the two\n * that keep backend and SPA in one file), and AWS-AccessBridge's\n * extension-split `dom` project. Durable-DAV-Router's file is the canonical\n * shape — it is the one that records *why* the split exists; Mail-Otter's\n * contributes the React plugin and the `apps/web/**` include; CalDAV-Bridge\n * contributes `happy-dom` and the `test/web/**` directory convention;\n * Mail-Meow contributes `setupFiles` and the note that projects do not inherit\n * the root `resolve`.\n *\n * Canonical decisions:\n *\n * 1. **A DOM for every file here**, rather than a `@vitest-environment` pragma\n * per file: these are the tests that need a DOM, and the pragma is one more\n * place to forget. `jsdom` is the family default (seven repos);\n * `happy-dom` is CalDAV-Bridge's, and is one option away.\n * 2. **`pool: 'threads'`, bounded, rather than one forked worker per file.** Each\n * jsdom document is a whole browser environment; a fork per file exhausts\n * memory on a constrained machine, and when it does the run dies partway with\n * a bare \"Worker exited unexpectedly\" and no test reports a failure — which\n * reads as a flaky suite rather than as an out-of-memory kill.\n * 3. **`include` covers every shape the family uses** — the `test/web/**`\n * directory convention, the root-suite `web-*` naming convention, and suites\n * bundled under `apps/web` — and the same globs are what\n * `defineUnitVitestConfig()` excludes, so a file is collected by exactly one\n * config.\n * 4. **Projects do not inherit the root `resolve`** (Mail-Meow): a\n * single-file `projects` composition must repeat the alias table per\n * project. `defineRepoVitestConfig()` does that; two-file repos get it from\n * these factories directly.\n * 5. **`@/` means the SPA here, not the API worker.** The unit config maps\n * `@/` to `apps/api/src`; this config maps both `@/` (Mail-Otter's SPA\n * source) and `~/` (Mail-Meow's and CalDAV-Bridge's SPA tests) to\n * `apps/web/src`. Workspace `@scope/*` imports still resolve to the\n * packages, so web tests reach shared logic the same way backend tests do.\n */\n\nimport { defineConfig } from 'vitest/config';\nimport { asVitePlugins } from './plugin-option.ts';\nimport type { PluginOption } from './plugin-option.ts';\nimport { fileURLToPath } from 'node:url';\nimport { DEFAULT_CLOUDFLARE_MOCKS, DEFAULT_WORKSPACE_PACKAGES, KIT_NO_EXTERNAL, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\nimport type { CoverageThresholds } from './vitest.ts';\n\n/**\n * What `defineWebVitestConfig` accepts.\n */\nexport interface WebVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. When supplied, `@scope/*`\n * workspace aliases are generated so web tests reach shared logic; when\n * omitted, only the `cloudflare:*`, `@/` and `~/` aliases apply.\n */\n readonly scope?: string;\n /**\n * Workspace package directory names. Defaults to the family superset.\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to workers/sockets/workflows.\n */\n readonly mocks?: readonly string[];\n /**\n * Vite plugins the SPA needs — `@vitejs/plugin-react` for a React app. Passed\n * by the consumer rather than imported here, because the kit must stay\n * zero-dependency and the plugin belongs to the app, not the harness.\n */\n readonly plugins?: readonly PluginOption[];\n /**\n * Extra resolver entries, applied after the canonical ones.\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * The repo root, as a file URL.\n */\n readonly root?: string;\n /**\n * The DOM implementation. `jsdom` is the family default; `happy-dom` is\n * CalDAV-Bridge's (lighter, and sufficient for its hook/service suites).\n */\n readonly environment?: 'jsdom' | 'happy-dom';\n /**\n * Which suites to collect. Defaults to every shape the family uses.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default.\n */\n readonly exclude?: readonly string[];\n /**\n * Setup files run before each test file.\n */\n readonly setupFiles?: readonly string[];\n /**\n * `node_modules` specifiers to inline through Vite rather than externalize.\n */\n readonly serverDepsInline?: readonly string[];\n /**\n * Resolver `noExternal` patterns, merged after {@link KIT_NO_EXTERNAL}.\n */\n readonly noExternal?: readonly (string | RegExp)[];\n /**\n * Coverage `include` globs. Defaults to the SPA source.\n */\n readonly coverageInclude?: readonly string[];\n /**\n * Coverage `exclude` globs, merged with the canonical set.\n */\n readonly coverageExclude?: readonly string[];\n /**\n * Coverage floors. Omitted by default; see `defineUnitVitestConfig`.\n */\n readonly thresholds?: CoverageThresholds;\n /**\n * Where the coverage report is written. Separate from the unit config's, so\n * the two gates never overwrite each other's report.\n */\n readonly reportsDirectory?: string;\n}\n\n/**\n * The default suite globs: every shape the family uses — the `test/web/**`\n * directory convention, the root-suite `web-*` convention, and the\n * bundled-under-`apps/web` convention — so any layout works unchanged.\n */\nconst DEFAULT_INCLUDE: readonly string[] = ['test/web/**/*.test.{ts,tsx}', 'test/**/web-*.test.{ts,tsx}', 'apps/web/**/*.test.{ts,tsx}'];\n\n/**\n * Coverage `exclude` globs for the SPA half.\n */\nconst CANONICAL_COVERAGE_EXCLUDE: readonly string[] = ['**/*.test.{ts,tsx}', '**/*.d.ts', '**/types.ts', '**/generated/**'];\n\n/**\n * Build the SPA's test config.\n *\n * ```ts\n * // vitest.web.config.mts\n * import react from '@vitejs/plugin-react';\n * import { defineWebVitestConfig } from '@rexezuge/tooling/vitest-web';\n * export default defineWebVitestConfig({ scope: '@myapp', plugins: [react()] });\n * ```\n */\nexport function defineWebVitestConfig(options: WebVitestConfigOptions = {}): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const webSrc = fileURLToPath(new URL('apps/web/src', root));\n // The workspace table maps `@/` to the API worker; here `@/` means the SPA,\n // so drop its `@/`/`~/` entries and prepend the SPA's own. String finds\n // (`@scope/*`, `cloudflare:*`) survive; a placeholder scope contributes none.\n const scopePart = workspaceAliases({\n scope: options.scope ?? '@unused',\n root,\n packages: options.packages ?? DEFAULT_WORKSPACE_PACKAGES,\n mocks: options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS,\n }).filter((alias) => typeof alias.find === 'string' && !alias.find.startsWith('@unused'));\n const aliases: VitestAlias[] = [\n { find: /^@\\//, replacement: `${webSrc}/` },\n { find: /^~\\//, replacement: `${webSrc}/` },\n ...scopePart.filter((alias) => typeof alias.find === 'string' && (alias.find.startsWith('cloudflare:') || options.scope !== undefined)),\n ...(options.aliases ?? []),\n ];\n\n return defineConfig({\n ...(options.plugins !== undefined && { plugins: asVitePlugins(options.plugins) }),\n resolve: { alias: aliases, noExternal: [...KIT_NO_EXTERNAL, ...(options.noExternal ?? [])] },\n test: {\n globals: true,\n environment: options.environment ?? 'jsdom',\n include: [...(options.include ?? DEFAULT_INCLUDE)],\n // Threads, bounded, rather than one forked worker per file — see the\n // header. A custom `exclude` replaces Vitest's defaults, so `node_modules`\n // must be re-listed.\n pool: 'threads',\n exclude: [...(options.exclude ?? ['**/node_modules/**', '**/dist/**', 'test/integration/**'])],\n ...(options.setupFiles !== undefined && { setupFiles: [...options.setupFiles] }),\n ...(options.serverDepsInline !== undefined && {\n server: { deps: { inline: [...options.serverDepsInline] } },\n }),\n coverage: {\n provider: 'v8',\n reporter: ['text', 'lcov'],\n reportsDirectory: options.reportsDirectory ?? './coverage-spa',\n include: [...(options.coverageInclude ?? ['apps/web/src/**/*.{ts,tsx}'])],\n exclude: [...CANONICAL_COVERAGE_EXCLUDE, ...(options.coverageExclude ?? [])],\n ...(options.thresholds !== undefined && { thresholds: { ...options.thresholds } }),\n },\n },\n });\n}\n"],
5
+ "mappings": "+EAyCA,OAAS,gBAAAA,MAAoB,gBAC7B,OAAS,iBAAAC,MAAqB,qBAE9B,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,4BAAAC,EAA0B,8BAAAC,EAA4B,mBAAAC,EAAiB,oBAAAC,MAAwB,sBAqFxG,MAAMC,EAAqC,CAAC,8BAA+B,8BAA+B,6BAA6B,EAKjIC,EAAgD,CAAC,qBAAsB,YAAa,cAAe,iBAAiB,EAYpH,SAAUC,EAAsBC,EAAkC,CAAA,EAAE,CACxE,MAAMC,EAAOD,EAAQ,MAAQ,IAAI,IAAI,IAAK,YAAY,GAAG,EAAE,KACrDE,EAASV,EAAc,IAAI,IAAI,eAAgBS,CAAI,CAAC,EAIpDE,EAAYP,EAAiB,CACjC,MAAOI,EAAQ,O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Aa,CAAE,WAAY,CAAE,GAAGA,EAAQ,UAAU,CAAE,IAGpF,CACH,CA7CgBM,EAAAP,EAAA",
6
+ "names": ["defineConfig", "asVitePlugins", "fileURLToPath", "DEFAULT_CLOUDFLARE_MOCKS", "DEFAULT_WORKSPACE_PACKAGES", "KIT_NO_EXTERNAL", "workspaceAliases", "DEFAULT_INCLUDE", "CANONICAL_COVERAGE_EXCLUDE", "defineWebVitestConfig", "options", "root", "webSrc", "scopePart", "alias", "aliases", "__name"]
7
7
  }
package/dist/vitest.d.ts CHANGED
@@ -32,7 +32,8 @@
32
32
  * resolver refuses, so the kit stays inside Vite's pipeline (the same
33
33
  * resolver that bundles the worker).
34
34
  */
35
- import { defineConfig, type Plugin } from 'vitest/config';
35
+ import { defineConfig } from 'vitest/config';
36
+ import type { PluginOption } from './plugin-option.ts';
36
37
  import type { VitestAlias } from './vitest-aliases.ts';
37
38
  export type { VitestAlias } from './vitest-aliases.ts';
38
39
  export { KIT_DEDUPE, KIT_NO_EXTERNAL } from './vitest-aliases.ts';
@@ -104,7 +105,7 @@ export interface UnitVitestConfigOptions {
104
105
  * Vite plugins for the suite (rare on the backend half; the SPA half passes
105
106
  * `react()` here).
106
107
  */
107
- readonly plugins?: readonly Plugin[];
108
+ readonly plugins?: readonly PluginOption[];
108
109
  /**
109
110
  * Setup files run before each test file (e.g. AWS's floci guard, Meow's
110
111
  * backend/web setups).
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../src/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qB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urable:!0});import{defineConfig as u}from"vitest/config";import{manifestCoverageThresholds as o}from"./manifest.js";import{DEFAULT_CLOUDFLARE_MOCKS as E,DEFAULT_WORKSPACE_PACKAGES as f,KIT_DEDUPE as g,KIT_NO_EXTERNAL as p,workspaceAliases as v}from"./vitest-aliases.js";import{KIT_DEDUPE as F,KIT_NO_EXTERNAL as R}from"./vitest-aliases.js";const x=["test/web/**","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],n=["scripts/**","**/*.test.ts","**/*.test.tsx","**/*.d.ts","**/index.ts","**/types.d.ts","**/model/**","**/generated/**","**/D1Types.ts","**/ServiceEnv.ts","**/env.d.ts"],m="**/index.ts";function A(e){return[...e.includeIndexBarrels?n.filter(t=>t!==m):n,...e.coverageExclude??[]]}r(A,"coverageExcludeFor");function I(e={}){const s=e.root??new URL(".",import.meta.url).href,t=e.thresholds??o(s),d=e.coverageInclude??["apps/api/src/**/*.ts","apps/background/src/**/*.ts","packages/**/src/**/*.ts"],l=A(e),a=[...v({scope:e.scope??"@unused",root:s,packages:e.scope===void 0?[]:e.packages??f,mocks:e.mocks??E}).filter(c=>typeof c.find!="string"||!c.find.startsWith("@unused")),...e.aliases??[]];return u({...e.plugins!==void 0&&{plugins:[...e.plugins]},resolve:{alias:a,noExternal:[...p,...e.noExternal??[]],dedupe:[...g]},test:{globals:!0,environment:"node",include:[...e.include??["test/**/*.test.{ts,tsx}"]],exclude:[...e.exclude??["**/node_modules/**","**/dist/**","test/integration/**",...x]],...e.setupFiles!==void 0&&{setupFiles:[...e.setupFiles]},server:{deps:{inline:[...e.serverDepsInline??["dofs"]]}},coverage:{provider:"v8",reporter:["text","lcov","html"],reportsDirectory:e.reportsDirectory??"./coverage",include:[...d],exclude:l,...t!==void 0&&{thresholds:{...t}}}}})}r(I,"defineUnitVitestConfig");export{F as KIT_DEDUPE,R as KIT_NO_EXTERNAL,I as defineUnitVitestConfig};
1
+ var i=Object.defineProperty;var r=(e,s)=>i(e,"name",{value:s,configurable:!0});import{defineConfig as u}from"vitest/config";import{asVitePlugins as o}from"./plugin-option.js";import{manifestCoverageThresholds as E}from"./manifest.js";import{DEFAULT_CLOUDFLARE_MOCKS as f,DEFAULT_WORKSPACE_PACKAGES as g,KIT_DEDUPE as p,KIT_NO_EXTERNAL as m,workspaceAliases as v}from"./vitest-aliases.js";import{KIT_DEDUPE as b,KIT_NO_EXTERNAL as k}from"./vitest-aliases.js";const x=["test/web/**","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],c=["scripts/**","**/*.test.ts","**/*.test.tsx","**/*.d.ts","**/index.ts","**/types.d.ts","**/model/**","**/generated/**","**/D1Types.ts","**/ServiceEnv.ts","**/env.d.ts"],A="**/index.ts";function _(e){return[...e.includeIndexBarrels?c.filter(t=>t!==A):c,...e.coverageExclude??[]]}r(_,"coverageExcludeFor");function U(e={}){const s=e.root??new URL(".",import.meta.url).href,t=e.thresholds??E(s),d=e.coverageInclude??["apps/api/src/**/*.ts","apps/background/src/**/*.ts","packages/**/src/**/*.ts"],l=_(e),a=[...v({scope:e.scope??"@unused",root:s,packages:e.scope===void 0?[]:e.packages??g,mocks:e.mocks??f}).filter(n=>typeof n.find!="string"||!n.find.startsWith("@unused")),...e.aliases??[]];return u({...e.plugins!==void 0&&{plugins:o(e.plugins)},resolve:{alias:a,noExternal:[...m,...e.noExternal??[]],dedupe:[...p]},test:{globals:!0,environment:"node",include:[...e.include??["test/**/*.test.{ts,tsx}"]],exclude:[...e.exclude??["**/node_modules/**","**/dist/**","test/integration/**",...x]],...e.setupFiles!==void 0&&{setupFiles:[...e.setupFiles]},server:{deps:{inline:[...e.serverDepsInline??["dofs"]]}},coverage:{provider:"v8",reporter:["text","lcov","html"],reportsDirectory:e.reportsDirectory??"./coverage",include:[...d],exclude:l,...t!==void 0&&{thresholds:{...t}}}}})}r(U,"defineUnitVitestConfig");export{b as KIT_DEDUPE,k as KIT_NO_EXTERNAL,U as defineUnitVitestConfig};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/vitest.ts"],
4
- "sourcesContent": ["/**\n * The unit-test Vitest config for the worker-and-packages half of the suite.\n *\n * Provenance: converged from all nine repos' `vitest.config.mts`. The coverage\n * block is Durable-DAV-Router's (the most complete: v8 provider, explicit\n * include/exclude patterns, thresholds with the reasoning for why they sit just\n * under the measured value); the alias block is the union of Durable-DAV's\n * `cloudflare:*` mocks, every repo's `@scope/* → src` workspace table, and the\n * shared `@/` + `~/` prefixes — see {@link ./vitest-aliases.js}.\n *\n * Canonical decisions:\n *\n * 1. **Every file matching `include` is reported** — Vitest 4 removed\n * `coverage.all`, and an explicit `include` now covers files no test\n * imported. That is the behaviour the source repos configured `all: true` for,\n * and the reason it mattered: without it a brand-new module with no test is\n * invisible rather than counted as zero, which is the exact regression this\n * gate exists to catch.\n * 2. **The SPA is excluded here**, so this config and `defineWebVitestConfig()`\n * partition the suite rather than each running all of it. The default covers\n * every suite shape the family uses (`test/web/**`, `test/**​/web-*`,\n * `apps/web/**`); see `defineRepoVitestConfig()` for the single-file\n * `projects` composition the AWS/Mail-Meow/CalDAV repos use.\n * 3. **A custom `exclude` re-lists `node_modules`** — `test/` is a workspace\n * project and therefore has its own, so without the re-list the glob reaches\n * into `test/node_modules` and tries to run other packages' suites.\n * 4. **Thresholds are a consumer argument**, not a kit default. A floor is a\n * per-repo ratchet measured against that repo's suite; the kit cannot know a\n * number, and guessing one is how floors get lowered.\n * 5. **`@rexezuge/*` is never externalized** — see `KIT_NO_EXTERNAL`: the kit\n * ships ESM `dist/` with bundler-style extensionless imports, which Node's\n * resolver refuses, so the kit stays inside Vite's pipeline (the same\n * resolver that bundles the worker).\n */\n\nimport { defineConfig, type Plugin } from 'vitest/config';\nimport { manifestCoverageThresholds } from './manifest.ts';\nimport { DEFAULT_CLOUDFLARE_MOCKS, DEFAULT_WORKSPACE_PACKAGES, KIT_DEDUPE, KIT_NO_EXTERNAL, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\n\nexport type { VitestAlias } from './vitest-aliases.ts';\n// Re-exported from this sub-barrel as well as the root, because a consumer\n// configuring **Vite** reaches for this path to find the same constants the vitest\n// factory applies — `KIT_DEDUPE` first, to keep one React between the app and the\n// kit's components. Exporting it only from the root meant that import failed with\n// `does not provide an export named 'KIT_DEDUPE'` at config-load time, which is a\n// build failure before any test runs and no error that names the install.\nexport { KIT_DEDUPE, KIT_NO_EXTERNAL } from './vitest-aliases.ts';\n\n/**\n * Coverage thresholds, in the four figures Vitest gates on.\n */\nexport interface CoverageThresholds {\n readonly statements?: number;\n readonly branches?: number;\n readonly functions?: number;\n readonly lines?: number;\n}\n\n/**\n * What `defineUnitVitestConfig` accepts. Every field is optional: the defaults\n * cover the canonical monorepo layout, and a consumer overrides only what its\n * tree actually differs in.\n */\nexport interface UnitVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. When supplied, `@scope/*`\n * workspace aliases are generated from `packages` (plus `background` under\n * `apps/`); when omitted, only the `cloudflare:*`, `@/` and `~/` aliases\n * apply and `aliases` carries the workspace table by hand.\n */\n readonly scope?: string;\n /**\n * Workspace package directory names. Defaults to the family superset; a repo\n * without a domain package keeps the default harmlessly (its alias never\n * matches).\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to workers/sockets/workflows.\n */\n readonly mocks?: readonly string[];\n /**\n * Extra resolver entries, applied after the canonical ones (e.g. the `hono`\n * dedupe two repos carry, or an `/index.ts` exact entry).\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * Where the repo root is, as a file URL. Defaults to the directory this\n * factory is *called* from, which is the repo root's `vitest.config.mts`.\n * Pass `new URL('.', import.meta.url).href` explicitly from the caller —\n * never rely on this module's own URL, which points into `node_modules`.\n */\n readonly root?: string;\n /**\n * Which suites to collect. Defaults to the whole unit suite.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default. Defaults re-list\n * `node_modules`/`dist`/`integration` plus every SPA shape.\n */\n readonly exclude?: readonly string[];\n /**\n * `node_modules` specifiers to inline through Vite rather than externalize.\n * Defaults to `['dofs']` (Durable-DAV: `dofs` imports `cloudflare:workers`,\n * which Node rejects before `resolve.alias` is consulted).\n */\n readonly serverDepsInline?: readonly string[];\n /**\n * Resolver `noExternal` patterns. Defaults to keeping `@rexezuge/*` inside\n * Vite's pipeline; see `KIT_NO_EXTERNAL`.\n */\n readonly noExternal?: readonly (string | RegExp)[];\n /**\n * Vite plugins for the suite (rare on the backend half; the SPA half passes\n * `react()` here).\n */\n readonly plugins?: readonly Plugin[];\n /**\n * Setup files run before each test file (e.g. AWS's floci guard, Meow's\n * backend/web setups).\n */\n readonly setupFiles?: readonly string[];\n /**\n * Coverage `include` globs. Defaults to the worker plus every workspace\n * package's `src`.\n */\n readonly coverageInclude?: readonly string[];\n /**\n * Coverage `exclude` globs, merged with the canonical set.\n */\n readonly coverageExclude?: readonly string[];\n /**\n * Report coverage for `index.ts` re-export barrels.\n *\n * The canonical set excludes them because a barrel carries no logic of its\n * own. Two repos in the family read that differently and deliberately keep\n * them in: a barrel with no importer shows up as an uncovered file, which is\n * the point — it is the only signal that the barrel is dead. Excluding them\n * is what let four entirely unused root barrels sit in the tree unnoticed, one\n * per repo that carried the habit.\n *\n * `coverageExclude` cannot express this, because it is merged with the\n * canonical set rather than replacing it, so a consumer could not opt back in.\n * Hence a named flag. Default `false`: today’s behaviour, unchanged for the\n * seven repos that never asked.\n */\n readonly includeIndexBarrels?: boolean;\n /**\n * Coverage floors. Defaults to the manifest's `quality.coverage` (`.rexezuge.jsonc`\n * at `root`); without one, no floor.\n */\n readonly thresholds?: CoverageThresholds;\n /**\n * Where the coverage report is written.\n */\n readonly reportsDirectory?: string;\n}\n\n/**\n * The SPA's suites, excluded here so the two configs partition the suite.\n *\n * Every shape the family uses: the `test/web/**` directory convention\n * (CalDAV-Bridge, Mail-Meow), the root-suite `web-*` naming convention\n * (Durable-DAV-Router), and suites bundled under `apps/web` (Mail-Otter).\n * `defineWebVitestConfig()` includes the same globs, so a file is collected by\n * exactly one config.\n */\nconst SPA_FILES: readonly string[] = ['test/web/**', 'test/**/web-*.test.{ts,tsx}', 'apps/web/**/*.test.{ts,tsx}'];\n\n/**\n * Coverage `exclude` globs converged from the source repos.\n *\n * The categories: build and test tooling (`scripts/` grows with project surface,\n * not complexity, and the god-file guard excludes it for the same reason), test\n * files, declarations, re-export barrels (`index.ts` carries no logic of its\n * own), model records, generated files (the SPA shell is a one-line HTML blob\n * with no logic to exercise), and type-only modules.\n */\nconst CANONICAL_COVERAGE_EXCLUDE: readonly string[] = [\n 'scripts/**',\n '**/*.test.ts',\n '**/*.test.tsx',\n '**/*.d.ts',\n '**/index.ts',\n '**/types.d.ts',\n '**/model/**',\n '**/generated/**',\n '**/D1Types.ts',\n '**/ServiceEnv.ts',\n '**/env.d.ts',\n];\n\n/**\n * The barrel exclusion, named so `includeIndexBarrels` can lift it.\n */\nconst INDEX_BARREL_EXCLUDE = '**/index.ts';\n\n/**\n * The canonical exclude set, with the barrel entry lifted for a caller that\n * asked to keep barrels in their coverage report.\n */\nfunction coverageExcludeFor(options: { coverageExclude?: readonly string[]; includeIndexBarrels?: boolean }): string[] {\n const canonical = options.includeIndexBarrels\n ? CANONICAL_COVERAGE_EXCLUDE.filter((glob) => glob !== INDEX_BARREL_EXCLUDE)\n : CANONICAL_COVERAGE_EXCLUDE;\n return [...canonical, ...(options.coverageExclude ?? [])];\n}\n\n/**\n * Build the unit-test config.\n *\n * ```ts\n * // vitest.config.mts\n * import { defineUnitVitestConfig } from '@rexezuge/tooling/vitest';\n * export default defineUnitVitestConfig({\n * scope: '@myapp',\n * thresholds: { statements: 60, branches: 55, functions: 65, lines: 60 },\n * });\n * ```\n */\nexport function defineUnitVitestConfig(options: UnitVitestConfigOptions = {}): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const thresholds = options.thresholds ?? manifestCoverageThresholds(root);\n const coverageInclude = options.coverageInclude ?? ['apps/api/src/**/*.ts', 'apps/background/src/**/*.ts', 'packages/**/src/**/*.ts'];\n const coverageExclude = coverageExcludeFor(options);\n const baseAliases = workspaceAliases({\n scope: options.scope ?? '@unused',\n root,\n packages: options.scope === undefined ? [] : (options.packages ?? DEFAULT_WORKSPACE_PACKAGES),\n mocks: options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS,\n });\n // A placeholder scope contributes no `@unused/*` entries; the mocks plus\n // `@/`/`~/` survive either way.\n const aliases = [\n ...baseAliases.filter((alias) => typeof alias.find !== 'string' || !alias.find.startsWith('@unused')),\n ...(options.aliases ?? []),\n ];\n\n return defineConfig({\n ...(options.plugins !== undefined && { plugins: [...options.plugins] }),\n resolve: {\n alias: aliases,\n noExternal: [...KIT_NO_EXTERNAL, ...(options.noExternal ?? [])],\n // The peer runtime a consumer and the kit must agree on. `@rexezuge/web`\n // declares `react`, `react-dom` and `lucide-react` as peers, which under a\n // registry install means neither package carries its own copy. Under the\n // `link:` workflow this repo's own README recommends, the symlinked\n // directory **does** have one — so the kit resolves its own React and the\n // consumer resolves theirs, and every hook in a kit component throws\n // `Cannot read properties of null (reading 'useState')`. Dedupe points the\n // bare specifier at one copy for both.\n dedupe: [...KIT_DEDUPE],\n },\n test: {\n globals: true,\n environment: 'node',\n include: [...(options.include ?? ['test/**/*.test.{ts,tsx}'])],\n // `test` is a workspace project and therefore has its own node_modules;\n // without the re-list, the glob reaches into it.\n exclude: [...(options.exclude ?? ['**/node_modules/**', '**/dist/**', 'test/integration/**', ...SPA_FILES])],\n ...(options.setupFiles !== undefined && { setupFiles: [...options.setupFiles] }),\n server: {\n deps: {\n // A `node_modules` dependency is externalized by default, so Node's\n // own ESM loader resolves a `cloudflare:workers` specifier and rejects\n // the scheme before `resolve.alias` is ever consulted. Inlining routes\n // it back through Vite, where the alias applies.\n inline: [...(options.serverDepsInline ?? ['dofs'])],\n },\n },\n coverage: {\n provider: 'v8',\n // Vitest 4 removed `coverage.all`; an explicit `include` now reports\n // every matching file whether or not a test imported it, which is the\n // behaviour the source repos' `all: true` was there to get: a brand-new\n // module with no test is counted as zero rather than being invisible,\n // which is the exact regression this gate exists to catch.\n reporter: ['text', 'lcov', 'html'],\n reportsDirectory: options.reportsDirectory ?? './coverage',\n include: [...coverageInclude],\n exclude: coverageExclude,\n ...(thresholds !== undefined && { thresholds: { ...thresholds } }),\n },\n },\n });\n}\n"],
5
- "mappings": "+EAmCA,OAAS,gBAAAA,MAAiC,gBAC1C,OAAS,8BAAAC,MAAkC,gBAC3C,OAAS,4BAAAC,EAA0B,8BAAAC,EAA4B,cAAAC,EAAY,mBAAAC,EAAiB,oBAAAC,MAAwB,sBAUpH,OAAS,cAAAF,EAAY,mBAAAC,MAAuB,sBA0H5C,MAAME,EAA+B,CAAC,cAAe,8BAA+B,6BAA6B,EAW3GC,EAAgD,CACpD,aACA,eACA,gBACA,YACA,cACA,gBACA,cACA,kBACA,gBACA,mBACA,eAMIC,EAAuB,cAM7B,SAASC,EAAmBC,EAA+E,CAIzG,MAAO,CAAC,GAHUA,EAAQ,oBACtBH,EAA2B,OAAQI,GAASA,IAASH,CAAoB,EACzED,EACkB,GAAIG,EAAQ,iBAAmB,CAAA,CAAG,CAC1D,CALSE,EAAAH,EAAA,sBAmBH,SAAUI,EAAuBH,EAAmC,CAAA,EAAE,CAC1E,MAAMI,EAAOJ,EAAQ,MAAQ,IAAI,IAAI,IAAK,YAAY,GAAG,EAAE,KACrDK,EAAaL,EAAQ,YAAcV,EAA2Bc,CAAI,EAClEE,EAAkBN,EAAQ,iBAAmB,CAAC,uBAAwB,8BAA+B,yBAAyB,EAC9HO,EAAkBR,EAAmBC,CAAO,EAS5CQ,EAAU,CACd,GATkBb,EAAiB,CACnC,MAAOK,EAAQ,OAAS,UACxB,KAAAI,EACA,SAAUJ,EAAQ,QAAU,OAAY,CAAA,EAAMA,EAAQ,UAAYR,EAClE,MAAOQ,EAAQ,OAAST,EACzB,EAIgB,OAAQkB,GAAU,OAAOA,EAAM,MAAS,UAAY,CAACA,EAAM,KAAK,WAAW,SAAS,CAAC,EACpG,GAAIT,EAAQ,SAAW,CAAA,GAGzB,OAAOX,EAAa,CAClB,GAAIW,EAAQ,UAAY,QAAa,CAAE,QAAS,CAAC,GAAGA,EAAQ,OAAO,CAAC,EACpE,QAAS,CACP,MAAOQ,EACP,WAAY,CAAC,GAAGd,EAAiB,GAAIM,EAAQ,YAAc,CAAA,CAAG,EAS9D,OAAQ,CAAC,GAAGP,CAAU,GAExB,KAAM,CACJ,QAAS,GACT,YAAa,OACb,QAAS,CAAC,GAAIO,EAAQ,SAAW,CAAC,yBAAyB,CAAE,EAG7D,QAAS,CAAC,GAAIA,EAAQ,SAAW,CAAC,qBAAsB,aAAc,sBAAuB,GAAGJ,CAAS,CAAE,EAC3G,GAAII,EAAQ,aAAe,QAAa,CAAE,WAAY,CAAC,GAAGA,EAAQ,UAAU,CAAC,EAC7E,OAAQ,CACN,KAAM,CAKJ,OAAQ,CAAC,GAAIA,EAAQ,kBAAoB,CAAC,MAAM,CAAE,IAGtD,SAAU,CACR,SAAU,KAMV,SAAU,CAAC,OAAQ,OAAQ,MAAM,EACjC,iBAAkBA,EAAQ,kBAAoB,aAC9C,QAAS,CAAC,GAAGM,CAAe,EAC5B,QAASC,EACT,GAAIF,IAAe,QAAa,CAAE,WAAY,CAAE,GAAGA,CAAU,CAAE,IAGpE,CACH,CAjEgBH,EAAAC,EAAA",
6
- "names": ["defineConfig", "manifestCoverageThresholds", "DEFAULT_CLOUDFLARE_MOCKS", "DEFAULT_WORKSPACE_PACKAGES", "KIT_DEDUPE", "KIT_NO_EXTERNAL", "workspaceAliases", "SPA_FILES", "CANONICAL_COVERAGE_EXCLUDE", "INDEX_BARREL_EXCLUDE", "coverageExcludeFor", "options", "glob", "__name", "defineUnitVitestConfig", "root", "thresholds", "coverageInclude", "coverageExclude", "aliases", "alias"]
4
+ "sourcesContent": ["/**\n * The unit-test Vitest config for the worker-and-packages half of the suite.\n *\n * Provenance: converged from all nine repos' `vitest.config.mts`. The coverage\n * block is Durable-DAV-Router's (the most complete: v8 provider, explicit\n * include/exclude patterns, thresholds with the reasoning for why they sit just\n * under the measured value); the alias block is the union of Durable-DAV's\n * `cloudflare:*` mocks, every repo's `@scope/* → src` workspace table, and the\n * shared `@/` + `~/` prefixes — see {@link ./vitest-aliases.js}.\n *\n * Canonical decisions:\n *\n * 1. **Every file matching `include` is reported** — Vitest 4 removed\n * `coverage.all`, and an explicit `include` now covers files no test\n * imported. That is the behaviour the source repos configured `all: true` for,\n * and the reason it mattered: without it a brand-new module with no test is\n * invisible rather than counted as zero, which is the exact regression this\n * gate exists to catch.\n * 2. **The SPA is excluded here**, so this config and `defineWebVitestConfig()`\n * partition the suite rather than each running all of it. The default covers\n * every suite shape the family uses (`test/web/**`, `test/**​/web-*`,\n * `apps/web/**`); see `defineRepoVitestConfig()` for the single-file\n * `projects` composition the AWS/Mail-Meow/CalDAV repos use.\n * 3. **A custom `exclude` re-lists `node_modules`** — `test/` is a workspace\n * project and therefore has its own, so without the re-list the glob reaches\n * into `test/node_modules` and tries to run other packages' suites.\n * 4. **Thresholds are a consumer argument**, not a kit default. A floor is a\n * per-repo ratchet measured against that repo's suite; the kit cannot know a\n * number, and guessing one is how floors get lowered.\n * 5. **`@rexezuge/*` is never externalized** — see `KIT_NO_EXTERNAL`: the kit\n * ships ESM `dist/` with bundler-style extensionless imports, which Node's\n * resolver refuses, so the kit stays inside Vite's pipeline (the same\n * resolver that bundles the worker).\n */\n\nimport { defineConfig } from 'vitest/config';\nimport { asVitePlugins } from './plugin-option.ts';\nimport type { PluginOption } from './plugin-option.ts';\nimport { manifestCoverageThresholds } from './manifest.ts';\nimport { DEFAULT_CLOUDFLARE_MOCKS, DEFAULT_WORKSPACE_PACKAGES, KIT_DEDUPE, KIT_NO_EXTERNAL, workspaceAliases } from './vitest-aliases.ts';\nimport type { VitestAlias } from './vitest-aliases.ts';\n\nexport type { VitestAlias } from './vitest-aliases.ts';\n// Re-exported from this sub-barrel as well as the root, because a consumer\n// configuring **Vite** reaches for this path to find the same constants the vitest\n// factory applies — `KIT_DEDUPE` first, to keep one React between the app and the\n// kit's components. Exporting it only from the root meant that import failed with\n// `does not provide an export named 'KIT_DEDUPE'` at config-load time, which is a\n// build failure before any test runs and no error that names the install.\nexport { KIT_DEDUPE, KIT_NO_EXTERNAL } from './vitest-aliases.ts';\n\n/**\n * Coverage thresholds, in the four figures Vitest gates on.\n */\nexport interface CoverageThresholds {\n readonly statements?: number;\n readonly branches?: number;\n readonly functions?: number;\n readonly lines?: number;\n}\n\n/**\n * What `defineUnitVitestConfig` accepts. Every field is optional: the defaults\n * cover the canonical monorepo layout, and a consumer overrides only what its\n * tree actually differs in.\n */\nexport interface UnitVitestConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. When supplied, `@scope/*`\n * workspace aliases are generated from `packages` (plus `background` under\n * `apps/`); when omitted, only the `cloudflare:*`, `@/` and `~/` aliases\n * apply and `aliases` carries the workspace table by hand.\n */\n readonly scope?: string;\n /**\n * Workspace package directory names. Defaults to the family superset; a repo\n * without a domain package keeps the default harmlessly (its alias never\n * matches).\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to workers/sockets/workflows.\n */\n readonly mocks?: readonly string[];\n /**\n * Extra resolver entries, applied after the canonical ones (e.g. the `hono`\n * dedupe two repos carry, or an `/index.ts` exact entry).\n */\n readonly aliases?: readonly VitestAlias[];\n /**\n * Where the repo root is, as a file URL. Defaults to the directory this\n * factory is *called* from, which is the repo root's `vitest.config.mts`.\n * Pass `new URL('.', import.meta.url).href` explicitly from the caller —\n * never rely on this module's own URL, which points into `node_modules`.\n */\n readonly root?: string;\n /**\n * Which suites to collect. Defaults to the whole unit suite.\n */\n readonly include?: readonly string[];\n /**\n * Suite paths to skip, replacing the default. Defaults re-list\n * `node_modules`/`dist`/`integration` plus every SPA shape.\n */\n readonly exclude?: readonly string[];\n /**\n * `node_modules` specifiers to inline through Vite rather than externalize.\n * Defaults to `['dofs']` (Durable-DAV: `dofs` imports `cloudflare:workers`,\n * which Node rejects before `resolve.alias` is consulted).\n */\n readonly serverDepsInline?: readonly string[];\n /**\n * Resolver `noExternal` patterns. Defaults to keeping `@rexezuge/*` inside\n * Vite's pipeline; see `KIT_NO_EXTERNAL`.\n */\n readonly noExternal?: readonly (string | RegExp)[];\n /**\n * Vite plugins for the suite (rare on the backend half; the SPA half passes\n * `react()` here).\n */\n readonly plugins?: readonly PluginOption[];\n /**\n * Setup files run before each test file (e.g. AWS's floci guard, Meow's\n * backend/web setups).\n */\n readonly setupFiles?: readonly string[];\n /**\n * Coverage `include` globs. Defaults to the worker plus every workspace\n * package's `src`.\n */\n readonly coverageInclude?: readonly string[];\n /**\n * Coverage `exclude` globs, merged with the canonical set.\n */\n readonly coverageExclude?: readonly string[];\n /**\n * Report coverage for `index.ts` re-export barrels.\n *\n * The canonical set excludes them because a barrel carries no logic of its\n * own. Two repos in the family read that differently and deliberately keep\n * them in: a barrel with no importer shows up as an uncovered file, which is\n * the point — it is the only signal that the barrel is dead. Excluding them\n * is what let four entirely unused root barrels sit in the tree unnoticed, one\n * per repo that carried the habit.\n *\n * `coverageExclude` cannot express this, because it is merged with the\n * canonical set rather than replacing it, so a consumer could not opt back in.\n * Hence a named flag. Default `false`: today’s behaviour, unchanged for the\n * seven repos that never asked.\n */\n readonly includeIndexBarrels?: boolean;\n /**\n * Coverage floors. Defaults to the manifest's `quality.coverage` (`.rexezuge.jsonc`\n * at `root`); without one, no floor.\n */\n readonly thresholds?: CoverageThresholds;\n /**\n * Where the coverage report is written.\n */\n readonly reportsDirectory?: string;\n}\n\n/**\n * The SPA's suites, excluded here so the two configs partition the suite.\n *\n * Every shape the family uses: the `test/web/**` directory convention\n * (CalDAV-Bridge, Mail-Meow), the root-suite `web-*` naming convention\n * (Durable-DAV-Router), and suites bundled under `apps/web` (Mail-Otter).\n * `defineWebVitestConfig()` includes the same globs, so a file is collected by\n * exactly one config.\n */\nconst SPA_FILES: readonly string[] = ['test/web/**', 'test/**/web-*.test.{ts,tsx}', 'apps/web/**/*.test.{ts,tsx}'];\n\n/**\n * Coverage `exclude` globs converged from the source repos.\n *\n * The categories: build and test tooling (`scripts/` grows with project surface,\n * not complexity, and the god-file guard excludes it for the same reason), test\n * files, declarations, re-export barrels (`index.ts` carries no logic of its\n * own), model records, generated files (the SPA shell is a one-line HTML blob\n * with no logic to exercise), and type-only modules.\n */\nconst CANONICAL_COVERAGE_EXCLUDE: readonly string[] = [\n 'scripts/**',\n '**/*.test.ts',\n '**/*.test.tsx',\n '**/*.d.ts',\n '**/index.ts',\n '**/types.d.ts',\n '**/model/**',\n '**/generated/**',\n '**/D1Types.ts',\n '**/ServiceEnv.ts',\n '**/env.d.ts',\n];\n\n/**\n * The barrel exclusion, named so `includeIndexBarrels` can lift it.\n */\nconst INDEX_BARREL_EXCLUDE = '**/index.ts';\n\n/**\n * The canonical exclude set, with the barrel entry lifted for a caller that\n * asked to keep barrels in their coverage report.\n */\nfunction coverageExcludeFor(options: { coverageExclude?: readonly string[]; includeIndexBarrels?: boolean }): string[] {\n const canonical = options.includeIndexBarrels\n ? CANONICAL_COVERAGE_EXCLUDE.filter((glob) => glob !== INDEX_BARREL_EXCLUDE)\n : CANONICAL_COVERAGE_EXCLUDE;\n return [...canonical, ...(options.coverageExclude ?? [])];\n}\n\n/**\n * Build the unit-test config.\n *\n * ```ts\n * // vitest.config.mts\n * import { defineUnitVitestConfig } from '@rexezuge/tooling/vitest';\n * export default defineUnitVitestConfig({\n * scope: '@myapp',\n * thresholds: { statements: 60, branches: 55, functions: 65, lines: 60 },\n * });\n * ```\n */\nexport function defineUnitVitestConfig(options: UnitVitestConfigOptions = {}): ReturnType<typeof defineConfig> {\n const root = options.root ?? new URL('.', import.meta.url).href;\n const thresholds = options.thresholds ?? manifestCoverageThresholds(root);\n const coverageInclude = options.coverageInclude ?? ['apps/api/src/**/*.ts', 'apps/background/src/**/*.ts', 'packages/**/src/**/*.ts'];\n const coverageExclude = coverageExcludeFor(options);\n const baseAliases = workspaceAliases({\n scope: options.scope ?? '@unused',\n root,\n packages: options.scope === undefined ? [] : (options.packages ?? DEFAULT_WORKSPACE_PACKAGES),\n mocks: options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS,\n });\n // A placeholder scope contributes no `@unused/*` entries; the mocks plus\n // `@/`/`~/` survive either way.\n const aliases = [\n ...baseAliases.filter((alias) => typeof alias.find !== 'string' || !alias.find.startsWith('@unused')),\n ...(options.aliases ?? []),\n ];\n\n return defineConfig({\n ...(options.plugins !== undefined && { plugins: asVitePlugins(options.plugins) }),\n resolve: {\n alias: aliases,\n noExternal: [...KIT_NO_EXTERNAL, ...(options.noExternal ?? [])],\n // The peer runtime a consumer and the kit must agree on. `@rexezuge/web`\n // declares `react`, `react-dom` and `lucide-react` as peers, which under a\n // registry install means neither package carries its own copy. Under the\n // `link:` workflow this repo's own README recommends, the symlinked\n // directory **does** have one — so the kit resolves its own React and the\n // consumer resolves theirs, and every hook in a kit component throws\n // `Cannot read properties of null (reading 'useState')`. Dedupe points the\n // bare specifier at one copy for both.\n dedupe: [...KIT_DEDUPE],\n },\n test: {\n globals: true,\n environment: 'node',\n include: [...(options.include ?? ['test/**/*.test.{ts,tsx}'])],\n // `test` is a workspace project and therefore has its own node_modules;\n // without the re-list, the glob reaches into it.\n exclude: [...(options.exclude ?? ['**/node_modules/**', '**/dist/**', 'test/integration/**', ...SPA_FILES])],\n ...(options.setupFiles !== undefined && { setupFiles: [...options.setupFiles] }),\n server: {\n deps: {\n // A `node_modules` dependency is externalized by default, so Node's\n // own ESM loader resolves a `cloudflare:workers` specifier and rejects\n // the scheme before `resolve.alias` is ever consulted. Inlining routes\n // it back through Vite, where the alias applies.\n inline: [...(options.serverDepsInline ?? ['dofs'])],\n },\n },\n coverage: {\n provider: 'v8',\n // Vitest 4 removed `coverage.all`; an explicit `include` now reports\n // every matching file whether or not a test imported it, which is the\n // behaviour the source repos' `all: true` was there to get: a brand-new\n // module with no test is counted as zero rather than being invisible,\n // which is the exact regression this gate exists to catch.\n reporter: ['text', 'lcov', 'html'],\n reportsDirectory: options.reportsDirectory ?? './coverage',\n include: [...coverageInclude],\n exclude: coverageExclude,\n ...(thresholds !== undefined && { thresholds: { ...thresholds } }),\n },\n },\n });\n}\n"],
5
+ "mappings": "+EAmCA,OAAS,gBAAAA,MAAoB,gBAC7B,OAAS,iBAAAC,MAAqB,qBAE9B,OAAS,8BAAAC,MAAkC,gBAC3C,OAAS,4BAAAC,EAA0B,8BAAAC,EAA4B,cAAAC,EAAY,mBAAAC,EAAiB,oBAAAC,MAAwB,sBAUpH,OAAS,cAAAF,EAAY,mBAAAC,MAAuB,sBA0H5C,MAAME,EAA+B,CAAC,cAAe,8BAA+B,6BAA6B,EAW3GC,EAAgD,CACpD,aACA,eACA,gBACA,YACA,cACA,gBACA,cACA,kBACA,gBACA,mBACA,eAMIC,EAAuB,cAM7B,SAASC,EAAmBC,EAA+E,CAIzG,MAAO,CAAC,GAHUA,EAAQ,oBACtBH,EAA2B,OAAQI,GAASA,IAASH,CAAoB,EACzED,EACkB,GAAIG,EAAQ,iBAAmB,CAAA,CAAG,CAC1D,CALSE,EAAAH,EAAA,sBAmBH,SAAUI,EAAuBH,EAAmC,CAAA,EAAE,CAC1E,MAAMI,EAAOJ,EAAQ,MAAQ,IAAI,IAAI,IAAK,YAAY,GAAG,EAAE,KACrDK,EAAaL,EAAQ,YAAcV,EAA2Bc,CAAI,EAClEE,EAAkBN,EAAQ,iBAAmB,CAAC,uBAAwB,8BAA+B,yBAAyB,EAC9HO,EAAkBR,EAAmBC,CAAO,EAS5CQ,EAAU,CACd,GATkBb,EAAiB,CACnC,MAAOK,EAAQ,OAAS,UACxB,KAAAI,EACA,SAAUJ,EAAQ,QAAU,OAAY,CAAA,EAAMA,EAAQ,UAAYR,EAClE,MAAOQ,EAAQ,OAAST,EACzB,EAIgB,OAAQkB,GAAU,OAAOA,EAAM,MAAS,UAAY,CAACA,EAAM,KAAK,WAAW,SAAS,CAAC,EACpG,GAAIT,EAAQ,SAAW,CAAA,GAGzB,OAAOZ,EAAa,CAClB,GAAIY,EAAQ,UAAY,QAAa,CAAE,QAASX,EAAcW,EAAQ,OAAO,CAAC,EAC9E,QAAS,CACP,MAAOQ,EACP,WAAY,CAAC,GAAGd,EAAiB,GAAIM,EAAQ,YAAc,CAAA,CAAG,EAS9D,OAAQ,CAAC,GAAGP,CAAU,GAExB,KAAM,CACJ,QAAS,GACT,YAAa,OACb,QAAS,CAAC,GAAIO,EAAQ,SAAW,CAAC,yBAAyB,CAAE,EAG7D,QAAS,CAAC,GAAIA,EAAQ,SAAW,CAAC,qBAAsB,aAAc,sBAAuB,GAAGJ,CAAS,CAAE,EAC3G,GAAII,EAAQ,aAAe,QAAa,CAAE,WAAY,CAAC,GAAGA,EAAQ,UAAU,CAAC,EAC7E,OAAQ,CACN,KAAM,CAKJ,OAAQ,CAAC,GAAIA,EAAQ,kBAAoB,CAAC,MAAM,CAAE,IAGtD,SAAU,CACR,SAAU,KAMV,SAAU,CAAC,OAAQ,OAAQ,MAAM,EACjC,iBAAkBA,EAAQ,kBAAoB,aAC9C,QAAS,CAAC,GAAGM,CAAe,EAC5B,QAASC,EACT,GAAIF,IAAe,QAAa,CAAE,WAAY,CAAE,GAAGA,CAAU,CAAE,IAGpE,CACH,CAjEgBH,EAAAC,EAAA",
6
+ "names": ["defineConfig", "asVitePlugins", "manifestCoverageThresholds", "DEFAULT_CLOUDFLARE_MOCKS", "DEFAULT_WORKSPACE_PACKAGES", "KIT_DEDUPE", "KIT_NO_EXTERNAL", "workspaceAliases", "SPA_FILES", "CANONICAL_COVERAGE_EXCLUDE", "INDEX_BARREL_EXCLUDE", "coverageExcludeFor", "options", "glob", "__name", "defineUnitVitestConfig", "root", "thresholds", "coverageInclude", "coverageExclude", "aliases", "alias"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexezuge/tooling",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -48,8 +48,8 @@
48
48
  "presets"
49
49
  ],
50
50
  "dependencies": {
51
- "@rexezuge/d1": "1.13.0",
52
- "@rexezuge/testing": "1.13.0"
51
+ "@rexezuge/d1": "1.14.0",
52
+ "@rexezuge/testing": "1.14.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "eslint": "^10.0.0",
@@ -0,0 +1,54 @@
1
+ import type { LayerBan } from './eslint-boundaries.ts';
2
+ import type { FamilyManifest } from './manifest.ts';
3
+
4
+ /**
5
+ * What `defineRepoLintConfig` accepts.
6
+ */
7
+ export interface RepoLintConfigOptions {
8
+ /**
9
+ * The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`
10
+ * pattern in the boundary rules is derived from it, so the same factory serves
11
+ * all nine repos.
12
+ */
13
+ readonly scope?: string;
14
+ /**
15
+ * The family manifest. Omitted: `<tsconfigRootDir or cwd>/.rexezuge.jsonc` is
16
+ * loaded when it exists. Pass `false` to ignore the file. A manifest supplies
17
+ * `scope` (unless given here), replaces the canonical layer table with its own
18
+ * `layers` (when it declares any), and names the http and browser directories
19
+ * the strict rules exempt.
20
+ */
21
+ readonly manifest?: FamilyManifest | false;
22
+ /**
23
+ * Extra http-layer directories (may import `hono`/`chanfana`, hand-build the
24
+ * error envelope), beside `apps/api` and the manifest's `http: true` layers.
25
+ */
26
+ readonly httpDirs?: readonly string[];
27
+ /**
28
+ * The workspace directories the legacy canonical layer table is scoped to, as
29
+ * repo-relative globs. Only used when no manifest declares `layers`.
30
+ *
31
+ * @deprecated Declare `layers` in `.rexezuge.jsonc` instead: the canonical
32
+ * table encodes consumer package names.
33
+ */
34
+ readonly projectDirs?: readonly string[];
35
+ /**
36
+ * Extra ignore globs, merged with the canonical set.
37
+ */
38
+ readonly extraIgnores?: readonly string[];
39
+ /**
40
+ * Where `projectService` resolves the tsconfig from. Defaults to the directory
41
+ * ESLint is invoked in, which is the repo root in every CI job.
42
+ */
43
+ readonly tsconfigRootDir?: string;
44
+ /**
45
+ * Extra boundary layers, appended to the canonical table.
46
+ *
47
+ * The escape valve for a repo whose layout has a boundary the canonical table
48
+ * does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule ("route
49
+ * classes must not import DAOs directly") and its `aws4fetch` ban are the shape.
50
+ * Same {@link LayerBan} form, so `extraLayers` flows through the
51
+ * `no-restricted-imports` and the `no-restricted-syntax` guard alike.
52
+ */
53
+ readonly extraLayers?: readonly LayerBan[];
54
+ }
package/src/eslint.ts CHANGED
@@ -59,64 +59,13 @@ import eslintConfigPrettier from 'eslint-config-prettier';
59
59
  import prettier from 'eslint-plugin-prettier';
60
60
  import type { FlatConfig } from 'typescript-eslint';
61
61
  import { DEFAULT_PROJECT_DIRS, layerBans, restrictedDynamicImports, restrictedImports } from './eslint-boundaries.ts';
62
- import type { LayerBan } from './eslint-boundaries.ts';
62
+ import type { RepoLintConfigOptions } from './eslint-options.ts';
63
63
  import { manifestBrowserDirs, manifestHttpDirs, manifestLayerBans } from './eslint-manifest.ts';
64
64
  import { strictConfigs } from './eslint-strict.ts';
65
65
  import { loadManifest } from './manifest.ts';
66
- import type { FamilyManifest } from './manifest.ts';
67
66
  import { SONARJS_RULES, TEST_RULES, TYPESCRIPT_RULES, UNICORN_RULES } from './eslint-rules.ts';
68
67
 
69
- /**
70
- * What `defineRepoLintConfig` accepts.
71
- */
72
- export interface RepoLintConfigOptions {
73
- /**
74
- * The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`
75
- * pattern in the boundary rules is derived from it, so the same factory serves
76
- * all nine repos.
77
- */
78
- readonly scope?: string;
79
- /**
80
- * The family manifest. Omitted: `<tsconfigRootDir or cwd>/.rexezuge.jsonc` is
81
- * loaded when it exists. Pass `false` to ignore the file. A manifest supplies
82
- * `scope` (unless given here), replaces the canonical layer table with its own
83
- * `layers` (when it declares any), and names the http and browser directories
84
- * the strict rules exempt.
85
- */
86
- readonly manifest?: FamilyManifest | false;
87
- /**
88
- * Extra http-layer directories (may import `hono`/`chanfana`, hand-build the
89
- * error envelope), beside `apps/api` and the manifest's `http: true` layers.
90
- */
91
- readonly httpDirs?: readonly string[];
92
- /**
93
- * The workspace directories the legacy canonical layer table is scoped to, as
94
- * repo-relative globs. Only used when no manifest declares `layers`.
95
- *
96
- * @deprecated Declare `layers` in `.rexezuge.jsonc` instead: the canonical
97
- * table encodes consumer package names.
98
- */
99
- readonly projectDirs?: readonly string[];
100
- /**
101
- * Extra ignore globs, merged with the canonical set.
102
- */
103
- readonly extraIgnores?: readonly string[];
104
- /**
105
- * Where `projectService` resolves the tsconfig from. Defaults to the directory
106
- * ESLint is invoked in, which is the repo root in every CI job.
107
- */
108
- readonly tsconfigRootDir?: string;
109
- /**
110
- * Extra boundary layers, appended to the canonical table.
111
- *
112
- * The escape valve for a repo whose layout has a boundary the canonical table
113
- * does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule ("route
114
- * classes must not import DAOs directly") and its `aws4fetch` ban are the shape.
115
- * Same {@link LayerBan} form, so `extraLayers` flows through the
116
- * `no-restricted-imports` and the `no-restricted-syntax` guard alike.
117
- */
118
- readonly extraLayers?: readonly LayerBan[];
119
- }
68
+ export type { RepoLintConfigOptions } from './eslint-options.ts';
120
69
 
121
70
  /**
122
71
  * One argument to `tseslint.config()`.
@@ -0,0 +1,8 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { onRequest } from './pages-proxy.ts';
3
+
4
+ describe('pages-proxy re-export', () => {
5
+ it('is the default proxy handler', () => {
6
+ expect(typeof onRequest).toBe('function');
7
+ });
8
+ });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The whole `functions/[[path]].ts` of a Pages project that proxies to `API_WORKER`, as a re-export:
3
+ *
4
+ * ```ts
5
+ * export { onRequest } from '@rexezuge/tooling/pages-proxy';
6
+ * ```
7
+ *
8
+ * The default `createPagesProxy()`. A repo that needs an option (`forwardClientIp: false`) keeps
9
+ * the two-line `createPagesProxy({ ... })` form from `@rexezuge/tooling/functions/pages-proxy`.
10
+ */
11
+ import { createPagesProxy } from './functions/pages-proxy.ts';
12
+
13
+ export const onRequest = createPagesProxy();
@@ -0,0 +1,13 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { asVitePlugins } from './plugin-option.ts';
3
+ import type { PluginOption } from './plugin-option.ts';
4
+
5
+ describe('asVitePlugins', () => {
6
+ it('passes plugins, nested arrays and falsy placeholders through in order, as a copy', () => {
7
+ const plugin = { name: 'p' };
8
+ const input: PluginOption[] = [plugin, [{ name: 'q' }], false, null, undefined];
9
+ const output = asVitePlugins(input);
10
+ expect(output).toEqual(input);
11
+ expect(output).not.toBe(input);
12
+ });
13
+ });