@rexezuge/tooling 1.12.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 (130) hide show
  1. package/README.md +149 -18
  2. package/dist/eslint-manifest.d.ts +25 -0
  3. package/dist/eslint-manifest.d.ts.map +1 -0
  4. package/dist/eslint-manifest.js +1 -0
  5. package/dist/eslint-manifest.js.map +7 -0
  6. package/dist/eslint-options.d.ts +54 -0
  7. package/dist/eslint-options.d.ts.map +1 -0
  8. package/dist/eslint-options.js +0 -0
  9. package/dist/eslint-options.js.map +7 -0
  10. package/dist/eslint-strict.d.ts +45 -0
  11. package/dist/eslint-strict.d.ts.map +1 -0
  12. package/dist/eslint-strict.js +1 -0
  13. package/dist/eslint-strict.js.map +7 -0
  14. package/dist/eslint.d.ts +2 -36
  15. package/dist/eslint.d.ts.map +1 -1
  16. package/dist/eslint.js +1 -1
  17. package/dist/eslint.js.map +3 -3
  18. package/dist/index.d.ts +5 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/index.js.map +3 -3
  22. package/dist/manifest-validate.d.ts +14 -0
  23. package/dist/manifest-validate.d.ts.map +1 -0
  24. package/dist/manifest-validate.js +1 -0
  25. package/dist/manifest-validate.js.map +7 -0
  26. package/dist/manifest.d.ts +159 -0
  27. package/dist/manifest.d.ts.map +1 -0
  28. package/dist/manifest.js +3 -0
  29. package/dist/manifest.js.map +7 -0
  30. package/dist/pages-proxy.d.ts +2 -0
  31. package/dist/pages-proxy.d.ts.map +1 -0
  32. package/dist/pages-proxy.js +1 -0
  33. package/dist/pages-proxy.js.map +7 -0
  34. package/dist/plugin-option.d.ts +15 -0
  35. package/dist/plugin-option.d.ts.map +1 -0
  36. package/dist/plugin-option.js +1 -0
  37. package/dist/plugin-option.js.map +7 -0
  38. package/dist/scripts/check-god-files.d.ts.map +1 -1
  39. package/dist/scripts/check-god-files.js +2 -2
  40. package/dist/scripts/check-god-files.js.map +3 -3
  41. package/dist/scripts/ensure-spa-shell-stub.d.ts +4 -2
  42. package/dist/scripts/ensure-spa-shell-stub.d.ts.map +1 -1
  43. package/dist/scripts/ensure-spa-shell-stub.js +1 -2
  44. package/dist/scripts/ensure-spa-shell-stub.js.map +3 -3
  45. package/dist/scripts/init-secrets.d.ts +1 -2
  46. package/dist/scripts/init-secrets.d.ts.map +1 -1
  47. package/dist/scripts/init-secrets.js +2 -3
  48. package/dist/scripts/init-secrets.js.map +3 -3
  49. package/dist/scripts/migrations-lock.d.ts +6 -2
  50. package/dist/scripts/migrations-lock.d.ts.map +1 -1
  51. package/dist/scripts/migrations-lock.js +1 -2
  52. package/dist/scripts/migrations-lock.js.map +3 -3
  53. package/dist/scripts/prepare-wrangler-config.d.ts +6 -2
  54. package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
  55. package/dist/scripts/prepare-wrangler-config.js +1 -2
  56. package/dist/scripts/prepare-wrangler-config.js.map +3 -3
  57. package/dist/scripts/validate-locales.d.ts +20 -2
  58. package/dist/scripts/validate-locales.d.ts.map +1 -1
  59. package/dist/scripts/validate-locales.js +5 -5
  60. package/dist/scripts/validate-locales.js.map +3 -3
  61. package/dist/scripts/verify-spa-shell.d.ts +7 -2
  62. package/dist/scripts/verify-spa-shell.d.ts.map +1 -1
  63. package/dist/scripts/verify-spa-shell.js +1 -2
  64. package/dist/scripts/verify-spa-shell.js.map +3 -3
  65. package/dist/test/mocks/cloudflare-workers.d.ts +6 -103
  66. package/dist/test/mocks/cloudflare-workers.d.ts.map +1 -1
  67. package/dist/test/mocks/cloudflare-workers.js +1 -1
  68. package/dist/test/mocks/cloudflare-workers.js.map +3 -3
  69. package/dist/vite.d.ts +2 -1
  70. package/dist/vite.d.ts.map +1 -1
  71. package/dist/vite.js +3 -3
  72. package/dist/vite.js.map +3 -3
  73. package/dist/vitest-aliases.d.ts +3 -0
  74. package/dist/vitest-aliases.d.ts.map +1 -1
  75. package/dist/vitest-aliases.js +1 -1
  76. package/dist/vitest-aliases.js.map +3 -3
  77. package/dist/vitest-integration.d.ts +3 -2
  78. package/dist/vitest-integration.d.ts.map +1 -1
  79. package/dist/vitest-integration.js +1 -1
  80. package/dist/vitest-integration.js.map +3 -3
  81. package/dist/vitest-repo.d.ts +5 -3
  82. package/dist/vitest-repo.d.ts.map +1 -1
  83. package/dist/vitest-repo.js +1 -1
  84. package/dist/vitest-repo.js.map +3 -3
  85. package/dist/vitest-web.d.ts +3 -2
  86. package/dist/vitest-web.d.ts.map +1 -1
  87. package/dist/vitest-web.js +1 -1
  88. package/dist/vitest-web.js.map +3 -3
  89. package/dist/vitest.d.ts +5 -3
  90. package/dist/vitest.d.ts.map +1 -1
  91. package/dist/vitest.js +1 -1
  92. package/dist/vitest.js.map +3 -3
  93. package/package.json +14 -3
  94. package/presets/prettier.d.mts +4 -0
  95. package/presets/prettier.mjs +16 -0
  96. package/presets/tsconfig/base.json +19 -0
  97. package/presets/tsconfig/web.json +10 -0
  98. package/presets/tsconfig/worker.json +9 -0
  99. package/schema/manifest.schema.json +105 -0
  100. package/src/eslint-manifest.ts +71 -0
  101. package/src/eslint-options.ts +54 -0
  102. package/src/eslint-strict.test.ts +106 -0
  103. package/src/eslint-strict.ts +191 -0
  104. package/src/eslint.ts +18 -41
  105. package/src/index.ts +15 -2
  106. package/src/manifest-validate.ts +202 -0
  107. package/src/manifest.test.ts +228 -0
  108. package/src/manifest.ts +194 -0
  109. package/src/pages-proxy.test.ts +8 -0
  110. package/src/pages-proxy.ts +13 -0
  111. package/src/plugin-option.test.ts +13 -0
  112. package/src/plugin-option.ts +18 -0
  113. package/src/presets.test.ts +63 -0
  114. package/src/scripts/check-god-files.ts +3 -0
  115. package/src/scripts/ensure-spa-shell-stub.ts +18 -10
  116. package/src/scripts/entrypoints.test.ts +55 -0
  117. package/src/scripts/init-secrets.ts +8 -6
  118. package/src/scripts/migrations-lock.ts +22 -17
  119. package/src/scripts/prepare-wrangler-config.ts +26 -14
  120. package/src/scripts/validate-locales.ts +39 -17
  121. package/src/scripts/verify-spa-shell.ts +21 -20
  122. package/src/test/mocks/cloudflare-workers.ts +6 -113
  123. package/src/vite.ts +6 -3
  124. package/src/vitest-aliases.test.ts +23 -0
  125. package/src/vitest-aliases.ts +22 -1
  126. package/src/vitest-factories.test.ts +30 -1
  127. package/src/vitest-integration.ts +5 -3
  128. package/src/vitest-repo.ts +10 -5
  129. package/src/vitest-web.ts +5 -3
  130. package/src/vitest.ts +10 -5
@@ -1,2 +1 @@
1
- #!/usr/bin/env tsx
2
- import e from"node:path";import{fileURLToPath as l}from"node:url";import{verifySpaShell as t}from"./spa-shell.js";const p=e.resolve(e.dirname(l(import.meta.url)),".."),o=process.argv[2]===void 0?p:e.resolve(process.argv[2]),{problems:r}=t({root:o});if(r.length>0){console.error("SPA shell check failed:");for(const s of r)console.error(` - ${s}`);process.exit(1)}console.log(`SPA shell check passed (${e.join(o,"apps/api/src/generated/spa-shell.ts")} matches ${e.join(o,"apps/web/dist")}).`);
1
+ var p=Object.defineProperty;var i=(e,r)=>p(e,"name",{value:r,configurable:!0});import o from"node:path";import{fileURLToPath as n}from"node:url";import{isEntrypoint as c}from"./lib/entrypoint.js";import{verifySpaShell as m}from"./spa-shell.js";function a(e=process.argv.slice(2)){const r=o.resolve(o.dirname(n(import.meta.url)),".."),t=e[0]===void 0?r:o.resolve(e[0]),{problems:s}=m({root:t});if(s.length>0){console.error("SPA shell check failed:");for(const l of s)console.error(` - ${l}`);return 1}return console.log(`SPA shell check passed (${o.join(t,"apps/api/src/generated/spa-shell.ts")} matches ${o.join(t,"apps/web/dist")}).`),0}i(a,"main"),c(import.meta.url)&&process.exit(a());export{a as main};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/scripts/verify-spa-shell.ts"],
4
- "sourcesContent": ["#!/usr/bin/env tsx\n/**\n * Fail when the SPA shell the API worker serves is missing or self-inconsistent.\n *\n * Provenance: Durable-DAV's and Durable-DAV-Router's `scripts/verify-spa-shell.mjs`\n * and Edge-Sonic's typed `scripts/build/verify-spa-shell.ts`. The rules — which of\n * the ways a shell can be wrong to look for — live in `spa-shell.ts`, so they are\n * unit tested without a build on disk; this file is the entrypoint that turns the\n * verdict into an exit code.\n *\n * What it catches:\n *\n * - the `postinstall` stub, or no build at all, still in place;\n * - `spa-shell.ts` referencing `/assets/...` bundles that were not emitted (a\n * partially cleaned or half-copied `dist/`, which serves a shell whose JS 404s\n * and therefore renders no operator UI at all);\n * - `spa-shell.ts` and `apps/web/dist/index.html` disagreeing, i.e. only one of\n * the two halves of the build was refreshed.\n *\n * **The build is a precondition of this check, not a convenience.** Both paths are\n * gitignored and `postinstall` writes a deliberately empty stub, so verifying\n * without building cannot pass — and it fails with precisely the message above,\n * which is the check working rather than the check being wrong.\n *\n * Usage, from the repo root:\n *\n * ```bash\n * pnpm exec tsx scripts/verify-spa-shell.ts # defaults to ./ as root\n * pnpm exec tsx scripts/verify-spa-shell.ts --root /path/to/repo\n * ```\n */\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { verifySpaShell } from './spa-shell.ts';\n\n/**\n * The repository root, derived from this file rather than from `process.cwd()`.\n *\n * Two levels up, because this file sits in `scripts/`. Deriving it means the gate\n * reads the same tree whatever directory it is invoked from — which is the\n * difference between a gate and a gate that passes because nobody ran it from the\n * right place.\n */\nconst REPOSITORY_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');\n\nconst root = process.argv[2] === undefined ? REPOSITORY_ROOT : path.resolve(process.argv[2]);\n\nconst { problems } = verifySpaShell({ root });\n\nif (problems.length > 0) {\n console.error('SPA shell check failed:');\n for (const problem of problems) console.error(` - ${problem}`);\n process.exit(1);\n}\n\nconsole.log(\n `SPA shell check passed (${path.join(root, 'apps/api/src/generated/spa-shell.ts')} matches ${path.join(root, 'apps/web/dist')}).`,\n);\n"],
5
- "mappings": ";AA+BA,OAAOA,MAAU,YACjB,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,kBAAAC,MAAsB,iBAU/B,MAAMC,EAAkBH,EAAK,QAAQA,EAAK,QAAQC,EAAc,YAAY,GAAG,CAAC,EAAG,IAAI,EAEjFG,EAAO,QAAQ,KAAK,CAAC,IAAM,OAAYD,EAAkBH,EAAK,QAAQ,QAAQ,KAAK,CAAC,CAAC,EAErF,CAAE,SAAAK,CAAQ,EAAKH,EAAe,CAAE,KAAAE,CAAI,CAAE,EAE5C,GAAIC,EAAS,OAAS,EAAG,CACvB,QAAQ,MAAM,yBAAyB,EACvC,UAAWC,KAAWD,EAAU,QAAQ,MAAM,OAAOC,CAAO,EAAE,EAC9D,QAAQ,KAAK,CAAC,CAChB,CAEA,QAAQ,IACN,2BAA2BN,EAAK,KAAKI,EAAM,qCAAqC,CAAC,YAAYJ,EAAK,KAAKI,EAAM,eAAe,CAAC,IAAI",
6
- "names": ["path", "fileURLToPath", "verifySpaShell", "REPOSITORY_ROOT", "root", "problems", "problem"]
4
+ "sourcesContent": ["/**\n * Fail when the SPA shell the API worker serves is missing or self-inconsistent.\n *\n * Provenance: Durable-DAV's and Durable-DAV-Router's `scripts/verify-spa-shell.mjs`\n * and Edge-Sonic's typed `scripts/build/verify-spa-shell.ts`. The rules — which of\n * the ways a shell can be wrong to look for — live in `spa-shell.ts`, so they are\n * unit tested without a build on disk; this file is the entrypoint that turns the\n * verdict into an exit code.\n *\n * What it catches:\n *\n * - the `postinstall` stub, or no build at all, still in place;\n * - `spa-shell.ts` referencing `/assets/...` bundles that were not emitted (a\n * partially cleaned or half-copied `dist/`, which serves a shell whose JS 404s\n * and therefore renders no operator UI at all);\n * - `spa-shell.ts` and `apps/web/dist/index.html` disagreeing, i.e. only one of\n * the two halves of the build was refreshed.\n *\n * **The build is a precondition of this check, not a convenience.** Both paths are\n * gitignored and `postinstall` writes a deliberately empty stub, so verifying\n * without building cannot pass — and it fails with precisely the message above,\n * which is the check working rather than the check being wrong.\n *\n * Usage, from the repo root:\n *\n * ```bash\n * pnpm exec tsx scripts/verify-spa-shell.ts # defaults to ./ as root\n * pnpm exec tsx scripts/verify-spa-shell.ts --root /path/to/repo\n * ```\n */\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isEntrypoint } from './lib/entrypoint.ts';\nimport { verifySpaShell } from './spa-shell.ts';\n\n/**\n * Verify the shell. `args[0]` is the repo root, derived from this file when absent\n * rather than from `process.cwd()`: the gate reads the same tree whatever directory\n * it is invoked from, which is the difference between a gate and a gate that passes\n * because nobody ran it from the right place. Returns the exit code.\n */\nexport function main(args: readonly string[] = process.argv.slice(2)): number {\n const repositoryRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');\n const root = args[0] === undefined ? repositoryRoot : path.resolve(args[0]);\n const { problems } = verifySpaShell({ root });\n if (problems.length > 0) {\n console.error('SPA shell check failed:');\n for (const problem of problems) console.error(` - ${problem}`);\n return 1;\n }\n console.log(\n `SPA shell check passed (${path.join(root, 'apps/api/src/generated/spa-shell.ts')} matches ${path.join(root, 'apps/web/dist')}).`,\n );\n return 0;\n}\n\nif (isEntrypoint(import.meta.url)) {\n process.exit(main());\n}\n"],
5
+ "mappings": "+EA8BA,OAAOA,MAAU,YACjB,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,gBAAAC,MAAoB,sBAC7B,OAAS,kBAAAC,MAAsB,iBAQzB,SAAUC,EAAKC,EAA0B,QAAQ,KAAK,MAAM,CAAC,EAAC,CAClE,MAAMC,EAAiBN,EAAK,QAAQA,EAAK,QAAQC,EAAc,YAAY,GAAG,CAAC,EAAG,IAAI,EAChFM,EAAOF,EAAK,CAAC,IAAM,OAAYC,EAAiBN,EAAK,QAAQK,EAAK,CAAC,CAAC,EACpE,CAAE,SAAAG,CAAQ,EAAKL,EAAe,CAAE,KAAAI,CAAI,CAAE,EAC5C,GAAIC,EAAS,OAAS,EAAG,CACvB,QAAQ,MAAM,yBAAyB,EACvC,UAAWC,KAAWD,EAAU,QAAQ,MAAM,OAAOC,CAAO,EAAE,EAC9D,MAAO,EACT,CACA,eAAQ,IACN,2BAA2BT,EAAK,KAAKO,EAAM,qCAAqC,CAAC,YAAYP,EAAK,KAAKO,EAAM,eAAe,CAAC,IAAI,EAE5H,CACT,CAbgBG,EAAAN,EAAA,QAeZF,EAAa,YAAY,GAAG,GAC9B,QAAQ,KAAKE,EAAI,CAAE",
6
+ "names": ["path", "fileURLToPath", "isEntrypoint", "verifySpaShell", "main", "args", "repositoryRoot", "root", "problems", "problem", "__name"]
7
7
  }
@@ -1,106 +1,9 @@
1
1
  /**
2
- * Stand-in for the `cloudflare:workers` module, which has no Node equivalent.
3
- *
4
- * Provenance: converged from the eight copies at `test/mocks/cloudflare-workers.ts`
5
- * (AWS-AccessBridge, CalDAV-Bridge, ChordDHT-Tracker, Durable-DAV, Edge-Git,
6
- * Edge-Sonic, Mail-Meow, Mail-Otter). All eight are the same twenty lines; the
7
- * union is three base classes and the union exists because each repo discovered a
8
- * missing one the hard way.
9
- *
10
- * ### What each source contributes
11
- *
12
- * - **DurableObject** — every copy. Stores `ctx` and `env` so a real DO class can
13
- * be constructed and its lifecycle RPCs driven directly, without Miniflare.
14
- * - **`RpcTarget`** — Durable-DAV's, and the reason is load-bearing rather than
15
- * tidy: `dofs`' `Fs` class `extends RpcTarget`, so the module fails to evaluate
16
- * with *"Class extends value undefined"* when the base is missing. That is a
17
- * module-load error, not a test failure, so it surfaces as an unimportable
18
- * `dav-store` barrel and no unit test can reach `DavRepository`. Deliberately
19
- * empty: on the platform it marks which methods are callable across an RPC
20
- * boundary, and nothing in a Node suite calls those through RPC. An empty base
21
- * keeps the fake honest instead of pretending to implement dispatch.
22
- * - **`WorkflowEntrypoint`** — Edge-Git, Edge-Sonic, Mail-Meow, Mail-Otter. A
23
- * Workflow class extends it, so the mock must provide it or the module fails the
24
- * same way — a **startup** error, which therefore takes down every suite that
25
- * reaches `apps/background` for an unrelated reason. Edge-Sonic's is the shape
26
- * kept: it stores `ctx` as well as `env`, because the failure policy under test
27
- * in `runWorkflow` lives in a plain function precisely so it can be exercised
28
- * without workerd, and that policy reads the execution context.
29
- *
30
- * ### Why the ambient types are declared here rather than imported
31
- *
32
- * The source repos name `DurableObjectState`, `ExecutionContext` and `Env`
33
- * unqualified, which resolves only because `worker-configuration.d.ts` and
34
- * `@cloudflare/workers-types` are ambient inside a Wrangler project. This copy is
35
- * imported by the kit's own typecheck, where neither exists, so the two state
36
- * shapes are declared locally and `TEnv` defaults to `unknown` instead of `Env`
37
- * (Edge-Sonic's form). A local declaration shadows the ambient one inside this
38
- * file only, so a consumer's copy typechecks against their generated types
39
- * exactly as the original did.
40
- *
41
- * ### Usage in a consumer
42
- *
43
- * Copy this file to `<repo>/test/mocks/cloudflare-workers.ts` and alias the
44
- * specifier in the Vitest config — `defineUnitVitestConfig()` already does:
45
- *
46
- * ```jsonc
47
- * // wrangler.jsonc / vitest alias
48
- * "cloudflare:workers": "test/mocks/cloudflare-workers.ts"
49
- * ```
50
- *
51
- * Only what a test actually imports is exported. A symbol here that nothing
52
- * imports is not a safety net; it is a claim that something depends on it.
2
+ * @deprecated Moved to `@rexezuge/testing/cloudflare-workers`. This module stays
3
+ * as a re-export so `@rexezuge/tooling/test/mocks/cloudflare-workers` (the shim
4
+ * path consumers copied) keeps resolving; delete the shim and let the Vitest
5
+ * factories alias the kit's mock instead.
53
6
  */
54
- /**
55
- * The subset of `DurableObjectState` a Node test reaches.
56
- *
57
- * Declared structurally rather than imported: `id`, `storage` and `waitUntil` are
58
- * the three a hand-driven lifecycle touches, and nothing here needs the rest.
59
- */
60
- export interface DurableObjectState {
61
- readonly id: {
62
- toString(): string;
63
- readonly name?: string;
64
- };
65
- }
66
- /**
67
- * The subset of `ExecutionContext` a Node test reaches.
68
- *
69
- * `waitUntil` is present because a Workflow's `run()` is driven through it, and
70
- * `passThroughOnException` is absent on purpose — nothing in a Node suite wires a
71
- * request through it.
72
- */
73
- export interface ExecutionContext {
74
- waitUntil(promise: Promise<unknown>): void;
75
- }
76
- /**
77
- * The base class every Durable Object extends.
78
- *
79
- * `protected`, exactly as on the platform: a DO subclass reads `this.env` and
80
- * `this.ctx`, and nothing outside it may.
81
- */
82
- declare class DurableObject<TEnv = unknown> {
83
- protected ctx: DurableObjectState;
84
- protected env: TEnv;
85
- constructor(ctx: DurableObjectState, env: TEnv);
86
- }
87
- /**
88
- * The base class `dofs`' `Fs` extends. See the header: an empty body is the
89
- * whole point, and a missing class is a module-load failure.
90
- */
91
- declare class RpcTarget {
92
- }
93
- /**
94
- * The base class every Workflow extends.
95
- *
96
- * `ctx` is `ExecutionContext` rather than `unknown` (Mail-Meow/Mail-Otter's
97
- * form) because a Workflow's step code reads it; `void ctx` to silence the unused
98
- * warning would be a lie about which of the two a subclass uses.
99
- */
100
- declare class WorkflowEntrypoint<TEnv = unknown> {
101
- protected ctx: ExecutionContext;
102
- protected env: TEnv;
103
- constructor(ctx: ExecutionContext, env: TEnv);
104
- }
105
- export { DurableObject, RpcTarget, WorkflowEntrypoint };
7
+ export { DurableObject, RpcTarget, WorkflowEntrypoint } from '@rexezuge/testing/cloudflare-workers';
8
+ export type { DurableObjectState, ExecutionContext } from '@rexezuge/testing/cloudflare-workers';
106
9
  //# sourceMappingURL=cloudflare-workers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudflare-workers.d.ts","sourceRoot":"","sources":["../../../src/test/mocks/cloudflare-workers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE;QAAE,QAAQ,IAAI,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CAC5C;AAED;;;;;GAKG;AACH,cAAM,aAAa,CAAC,IAAI,GAAG,OAAO;IAChC,SAAS,CAAC,GAAG,EAAE,kBAAkB,CAAC;IAClC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;gBAER,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,IAAI;CAI/C;AAED;;;GAGG;AACH,cAAM,SAAS;CAAG;AAElB;;;;;;GAMG;AACH,cAAM,kBAAkB,CAAC,IAAI,GAAG,OAAO;IACrC,SAAS,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAChC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;gBAER,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI;CAI7C;AAED,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"cloudflare-workers.d.ts","sourceRoot":"","sources":["../../../src/test/mocks/cloudflare-workers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AACpG,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC"}
@@ -1 +1 @@
1
- var e=Object.defineProperty;var s=(c,t)=>e(c,"name",{value:t,configurable:!0});class n{static{s(this,"DurableObject")}ctx;env;constructor(t,r){this.ctx=t,this.env=r}}class o{static{s(this,"RpcTarget")}}class a{static{s(this,"WorkflowEntrypoint")}ctx;env;constructor(t,r){this.ctx=t,this.env=r}}export{n as DurableObject,o as RpcTarget,a as WorkflowEntrypoint};
1
+ import{DurableObject as t,RpcTarget as e,WorkflowEntrypoint as p}from"@rexezuge/testing/cloudflare-workers";export{t as DurableObject,e as RpcTarget,p as WorkflowEntrypoint};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/test/mocks/cloudflare-workers.ts"],
4
- "sourcesContent": ["/**\n * Stand-in for the `cloudflare:workers` module, which has no Node equivalent.\n *\n * Provenance: converged from the eight copies at `test/mocks/cloudflare-workers.ts`\n * (AWS-AccessBridge, CalDAV-Bridge, ChordDHT-Tracker, Durable-DAV, Edge-Git,\n * Edge-Sonic, Mail-Meow, Mail-Otter). All eight are the same twenty lines; the\n * union is three base classes and the union exists because each repo discovered a\n * missing one the hard way.\n *\n * ### What each source contributes\n *\n * - **DurableObject** — every copy. Stores `ctx` and `env` so a real DO class can\n * be constructed and its lifecycle RPCs driven directly, without Miniflare.\n * - **`RpcTarget`** — Durable-DAV's, and the reason is load-bearing rather than\n * tidy: `dofs`' `Fs` class `extends RpcTarget`, so the module fails to evaluate\n * with *\"Class extends value undefined\"* when the base is missing. That is a\n * module-load error, not a test failure, so it surfaces as an unimportable\n * `dav-store` barrel and no unit test can reach `DavRepository`. Deliberately\n * empty: on the platform it marks which methods are callable across an RPC\n * boundary, and nothing in a Node suite calls those through RPC. An empty base\n * keeps the fake honest instead of pretending to implement dispatch.\n * - **`WorkflowEntrypoint`** — Edge-Git, Edge-Sonic, Mail-Meow, Mail-Otter. A\n * Workflow class extends it, so the mock must provide it or the module fails the\n * same way — a **startup** error, which therefore takes down every suite that\n * reaches `apps/background` for an unrelated reason. Edge-Sonic's is the shape\n * kept: it stores `ctx` as well as `env`, because the failure policy under test\n * in `runWorkflow` lives in a plain function precisely so it can be exercised\n * without workerd, and that policy reads the execution context.\n *\n * ### Why the ambient types are declared here rather than imported\n *\n * The source repos name `DurableObjectState`, `ExecutionContext` and `Env`\n * unqualified, which resolves only because `worker-configuration.d.ts` and\n * `@cloudflare/workers-types` are ambient inside a Wrangler project. This copy is\n * imported by the kit's own typecheck, where neither exists, so the two state\n * shapes are declared locally and `TEnv` defaults to `unknown` instead of `Env`\n * (Edge-Sonic's form). A local declaration shadows the ambient one inside this\n * file only, so a consumer's copy typechecks against their generated types\n * exactly as the original did.\n *\n * ### Usage in a consumer\n *\n * Copy this file to `<repo>/test/mocks/cloudflare-workers.ts` and alias the\n * specifier in the Vitest config — `defineUnitVitestConfig()` already does:\n *\n * ```jsonc\n * // wrangler.jsonc / vitest alias\n * \"cloudflare:workers\": \"test/mocks/cloudflare-workers.ts\"\n * ```\n *\n * Only what a test actually imports is exported. A symbol here that nothing\n * imports is not a safety net; it is a claim that something depends on it.\n */\n\n/**\n * The subset of `DurableObjectState` a Node test reaches.\n *\n * Declared structurally rather than imported: `id`, `storage` and `waitUntil` are\n * the three a hand-driven lifecycle touches, and nothing here needs the rest.\n */\nexport interface DurableObjectState {\n readonly id: { toString(): string; readonly name?: string };\n}\n\n/**\n * The subset of `ExecutionContext` a Node test reaches.\n *\n * `waitUntil` is present because a Workflow's `run()` is driven through it, and\n * `passThroughOnException` is absent on purpose — nothing in a Node suite wires a\n * request through it.\n */\nexport interface ExecutionContext {\n waitUntil(promise: Promise<unknown>): void;\n}\n\n/**\n * The base class every Durable Object extends.\n *\n * `protected`, exactly as on the platform: a DO subclass reads `this.env` and\n * `this.ctx`, and nothing outside it may.\n */\nclass DurableObject<TEnv = unknown> {\n protected ctx: DurableObjectState;\n protected env: TEnv;\n\n constructor(ctx: DurableObjectState, env: TEnv) {\n this.ctx = ctx;\n this.env = env;\n }\n}\n\n/**\n * The base class `dofs`' `Fs` extends. See the header: an empty body is the\n * whole point, and a missing class is a module-load failure.\n */\nclass RpcTarget {}\n\n/**\n * The base class every Workflow extends.\n *\n * `ctx` is `ExecutionContext` rather than `unknown` (Mail-Meow/Mail-Otter's\n * form) because a Workflow's step code reads it; `void ctx` to silence the unused\n * warning would be a lie about which of the two a subclass uses.\n */\nclass WorkflowEntrypoint<TEnv = unknown> {\n protected ctx: ExecutionContext;\n protected env: TEnv;\n\n constructor(ctx: ExecutionContext, env: TEnv) {\n this.ctx = ctx;\n this.env = env;\n }\n}\n\nexport { DurableObject, RpcTarget, WorkflowEntrypoint };\n"],
5
- "mappings": "+EAiFA,MAAMA,CAAa,CAjFnB,MAiFmB,CAAAC,EAAA,sBACP,IACA,IAEV,YAAYC,EAAyBC,EAAS,CAC5C,KAAK,IAAMD,EACX,KAAK,IAAMC,CACb,EAOF,MAAMC,CAAS,CA/Ff,MA+Fe,CAAAH,EAAA,mBASf,MAAMI,CAAkB,CAxGxB,MAwGwB,CAAAJ,EAAA,2BACZ,IACA,IAEV,YAAYC,EAAuBC,EAAS,CAC1C,KAAK,IAAMD,EACX,KAAK,IAAMC,CACb",
6
- "names": ["DurableObject", "__name", "ctx", "env", "RpcTarget", "WorkflowEntrypoint"]
4
+ "sourcesContent": ["/**\n * @deprecated Moved to `@rexezuge/testing/cloudflare-workers`. This module stays\n * as a re-export so `@rexezuge/tooling/test/mocks/cloudflare-workers` (the shim\n * path consumers copied) keeps resolving; delete the shim and let the Vitest\n * factories alias the kit's mock instead.\n */\nexport { DurableObject, RpcTarget, WorkflowEntrypoint } from '@rexezuge/testing/cloudflare-workers';\nexport type { DurableObjectState, ExecutionContext } from '@rexezuge/testing/cloudflare-workers';\n"],
5
+ "mappings": "AAMA,OAAS,iBAAAA,EAAe,aAAAC,EAAW,sBAAAC,MAA0B",
6
+ "names": ["DurableObject", "RpcTarget", "WorkflowEntrypoint"]
7
7
  }
package/dist/vite.d.ts CHANGED
@@ -29,6 +29,7 @@
29
29
  * README.
30
30
  */
31
31
  import { type Plugin, type ViteUserConfig } from 'vitest/config';
32
+ import type { PluginOption } from './plugin-option.ts';
32
33
  /**
33
34
  * One dev-server proxy entry, as Vite's `server.proxy` accepts it.
34
35
  */
@@ -99,7 +100,7 @@ export interface WebViteConfigOptions {
99
100
  * needs. Applied before the spa-shell plugin so the shell is written after the
100
101
  * bundle exists.
101
102
  */
102
- readonly plugins?: readonly Plugin[];
103
+ readonly plugins?: readonly PluginOption[];
103
104
  /**
104
105
  * Dev-server proxy entries. Keyed by path prefix.
105
106
  */
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AA4DD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG;IAAE,WAAW,EAAE,MAAM,IAAI,CAAA;CAAE,CAoChG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,cAAc,CActF"}
package/dist/vite.js CHANGED
@@ -1,3 +1,3 @@
1
- var f=Object.defineProperty;var t=(e,n)=>f(e,"name",{value:n,configurable:!0});import{existsSync as l,mkdirSync as p,readFileSync as c,writeFileSync as h}from"node:fs";import m from"node:path";import{fileURLToPath as i,pathToFileURL as x}from"node:url";import{defineConfig as y}from"vitest/config";function d(e){return e instanceof URL?e:e.startsWith("file:")?new URL(e):x(e)}t(d,"toUrl");function a(e){const n=d(e);return n.href.endsWith("/")?n:new URL(`${n.href}/`)}t(a,"toDirUrl");function U(e){return{name:"spa-shell-embed",closeBundle(){const n=a(e.root??process.cwd()),r=i(new URL(e.path,n)),o=e.distIndex===void 0?i(new URL("dist/index.html",n)):i(typeof e.distIndex=="string"&&!/^[a-z][a-z\d+\-.]*:/i.test(e.distIndex)?new URL(e.distIndex,n):d(e.distIndex));if(!l(o)){console.warn("spa-shell-embed: dist/index.html not found, skipping");return}const s=c(o,"utf8"),u=`// Auto-generated by Vite build plugin - DO NOT EDIT.
2
- export const SPA_HTML: string = ${JSON.stringify(s)};
3
- `;p(m.dirname(r),{recursive:!0}),h(r,u)}}}t(U,"spaShellEmbedPlugin");function g(e={}){const n=[...e.plugins??[]];return e.spaShell!==void 0&&n.push(U(e.spaShell)),y({...n.length>0&&{plugins:n},...e.proxy!==void 0&&{server:{proxy:{...e.proxy}}},build:{outDir:e.outDir??"dist",emptyOutDir:!0}})}t(g,"defineWebViteConfig");export{g as defineWebViteConfig,U as spaShellEmbedPlugin};
1
+ var l=Object.defineProperty;var t=(n,e)=>l(n,"name",{value:e,configurable:!0});import{existsSync as f,mkdirSync as p,readFileSync as c,writeFileSync as h}from"node:fs";import m from"node:path";import{fileURLToPath as i,pathToFileURL as x}from"node:url";import{defineConfig as a}from"vitest/config";import{asVitePlugins as y}from"./plugin-option.js";function s(n){return n instanceof URL?n:n.startsWith("file:")?new URL(n):x(n)}t(s,"toUrl");function U(n){const e=s(n);return e.href.endsWith("/")?e:new URL(`${e.href}/`)}t(U,"toDirUrl");function L(n){return{name:"spa-shell-embed",closeBundle(){const e=U(n.root??process.cwd()),r=i(new URL(n.path,e)),o=n.distIndex===void 0?i(new URL("dist/index.html",e)):i(typeof n.distIndex=="string"&&!/^[a-z][a-z\d+\-.]*:/i.test(n.distIndex)?new URL(n.distIndex,e):s(n.distIndex));if(!f(o)){console.warn("spa-shell-embed: dist/index.html not found, skipping");return}const d=c(o,"utf8"),u=`// Auto-generated by Vite build plugin - DO NOT EDIT.
2
+ export const SPA_HTML: string = ${JSON.stringify(d)};
3
+ `;p(m.dirname(r),{recursive:!0}),h(r,u)}}}t(L,"spaShellEmbedPlugin");function I(n={}){const e=[...n.plugins??[]];return n.spaShell!==void 0&&e.push(L(n.spaShell)),a({...e.length>0&&{plugins:y(e)},...n.proxy!==void 0&&{server:{proxy:{...n.proxy}}},build:{outDir:n.outDir??"dist",emptyOutDir:!0}})}t(I,"defineWebViteConfig");export{I as defineWebViteConfig,L as spaShellEmbedPlugin};
package/dist/vite.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/vite.ts"],
4
- "sourcesContent": ["/**\n * The SPA's Vite config.\n *\n * Provenance: converged from the `apps/web/vite.config.ts` of the eight repos\n * that build a Vite SPA. They are one file with three variables: the plugin list\n * (`@vitejs/plugin-react` + `@tailwindcss/vite`), the dev-server proxy target,\n * and the `spa-shell-embed` plugin that copies `dist/index.html` into\n * `apps/api/src/generated/spa-shell.ts`.\n *\n * Canonical decisions:\n *\n * 1. **The plugins are passed in, not imported.** The kit stays zero-dependency:\n * `react`, `@vitejs/plugin-react` and `@tailwindcss/vite` belong to the app\n * that uses them, and importing them here would make the tooling package\n * undownloadable for a consumer without a React SPA.\n * 2. **The `spa-shell-embed` hook stays per-repo, and is passed in.** It is the\n * one genuinely repo-specific piece: each repo names its own worker and its\n * own generated-module path. What the kit provides is the *contract* — see\n * `spaShellEmbedPlugin`, which is the converged body of all eight copies.\n * 3. **`server.proxy` is data, not code.** The paths differ per repo\n * (`/user` + `/rest` in Edge-Sonic, `/api` in CalDAV-Bridge, `/tracker` in\n * ChordDHT-Tracker) but the shape never does, so it is an option with a\n * default.\n * 4. **`build.emptyOutDir: true`** is the default, because a stale asset in\n * `dist/` is served as a live bundle — the same half-refreshed build\n * `scripts/verify-spa-shell.ts` rejects.\n *\n * The consumer's `apps/web/vite.config.ts` becomes a handful of lines — see the\n * README.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { defineConfig, type Plugin, type ViteUserConfig } from 'vitest/config';\n\n/**\n * One dev-server proxy entry, as Vite's `server.proxy` accepts it.\n */\nexport interface ProxyEntry {\n readonly target: string;\n readonly changeOrigin?: boolean;\n readonly bypass?: (request: { headers: Record<string, string | string[] | undefined> }) => string | undefined;\n /**\n * Proxy WebSocket upgrades on this path.\n *\n * Vite's `server.proxy` needs `ws: true` for an entry that carries a\n * WebSocket, and the entry has no other way to say so: without it the\n * handshake is proxied as an ordinary request and the socket never opens.\n * A consumer with a live-update or realtime endpoint therefore could not\n * express its dev proxy through this table at all.\n */\n readonly ws?: boolean;\n}\n\n/**\n * Where the SPA's built `index.html` is copied to, and under what module name.\n */\nexport interface SpaShellTarget {\n /**\n * Path of the generated module, relative to the repository root.\n *\n * `apps/api/src/generated/spa-shell.ts` in every repo that embeds a shell; the\n * parameter exists because the path is the one thing that genuinely differs.\n */\n readonly path: string;\n /**\n * The repository root the path is resolved against, as a file URL or a path.\n *\n * Defaults to the directory the build runs in (`process.cwd()`), which is the\n * repo root when the build is `pnpm --filter @scope/web build`. Passed in by the\n * Vite config, not derived from `import.meta.url`: this plugin object is created\n * inside the kit's own module, so a URL relative to it points into\n * `node_modules/@rexezuge/tooling` and writes the shell somewhere no compiler\n * will ever look.\n */\n readonly root?: string | URL;\n /**\n * The built `index.html`, as a path or file URL.\n *\n * Defaults to `dist/index.html` under the same root. Vite's `closeBundle` runs\n * after the bundle is written, so this is the file the build just produced.\n *\n * A **relative** path resolves against {@link SpaShellTarget.root}, exactly as\n * {@link SpaShellTarget.path} does. It used to resolve against the process's\n * working directory, which under `pnpm --filter … build` is the *package*\n * directory rather than the repository root — so a consumer naming the file\n * relative to the root it had just been given wrote nowhere, and the plugin\n * reported \"dist/index.html not found, skipping\". That message is also what a\n * genuinely fresh checkout prints on its first build, so the two are\n * indistinguishable in the log, and the worker keeps serving the *previous*\n * shell: the SPA ships yesterday's JavaScript with nothing in the build log\n * to explain it.\n */\n readonly distIndex?: string | URL;\n}\n\n/**\n * What `defineWebViteConfig` accepts.\n */\nexport interface WebViteConfigOptions {\n /**\n * The SPA's plugins — `react()`, `tailwindcss()`, and anything else the app\n * needs. Applied before the spa-shell plugin so the shell is written after the\n * bundle exists.\n */\n readonly plugins?: readonly Plugin[];\n /**\n * Dev-server proxy entries. Keyed by path prefix.\n */\n readonly proxy?: Readonly<Record<string, ProxyEntry>>;\n /**\n * Where the built shell is embedded. Omit to skip the embedding entirely.\n */\n readonly spaShell?: SpaShellTarget;\n /**\n * The build output directory.\n */\n readonly outDir?: string;\n /**\n * The directory this config is resolved from, as a file URL. Defaults to the\n * caller's location.\n */\n readonly root?: string;\n}\n\n/**\n * The `spa-shell-embed` plugin, converged from all eight copies.\n *\n * It exists because the API worker serves `SPA_HTML` from a module in its own\n * source tree, and both that module and `dist/` are gitignored — so a fresh\n * clone gets an empty stub from `postinstall` and every `GET /` returns a blank\n * page until someone runs a build. This plugin is what makes the build write the\n * real artefact, and `scripts/verify-spa-shell.ts` is what refuses to deploy\n * without it.\n *\n * Written as a factory rather than inlined so the exit conditions are in one\n * place: the `closeBundle` hook runs on every build, including the ones where\n * `dist/index.html` was never produced, and a plugin that throws there fails\n * builds that legitimately emit nothing.\n */\n/**\n * Normalise a path-or-URL option to a URL, so `new URL(...)` can be used on it.\n *\n * Small, and here because two options accept either form: a path is what a consumer\n * naturally writes in a config, and a URL is what `import.meta.url` hands them.\n * Accepting both is one line and saves a `fileURLToPath` at every call site.\n */\n/**\n * Normalise `string | URL` to a `URL`.\n *\n * A string that is **already a file URL** must be parsed, not converted:\n * `pathToFileURL('file:///srv/app')` treats its argument as a filesystem path\n * and produces `file:///<cwd>/file:/srv/app`, so every path built on top of it\n * silently resolves into a directory named after the scheme.\n *\n * The failure this prevented is not loud. `spaShellEmbedPlugin` then reports\n * \"dist/index.html not found, skipping\" — which is also what a genuinely fresh\n * checkout prints on its first build — and the consumer's worker keeps serving\n * the *previous* shell, so the SPA ships yesterday's JavaScript with no error\n * anywhere in the build log. Both `root` and `distIndex` are documented as\n * \"a file URL or a path\", and `new URL('.', import.meta.url).href` — the shape\n * every config file reaches for first — is a file-URL string, so this is the\n * path most callers take.\n */\nfunction toUrl(value: string | URL): URL {\n if (value instanceof URL) return value;\n return value.startsWith('file:') ? new URL(value) : pathToFileURL(value);\n}\n\n/**\n * The same, as a **directory** URL — with the trailing separator `new URL(rel, base)`\n * needs.\n *\n * `new URL('apps/api/x.ts', 'file:///repo')` resolves to `/apps/api/x.ts`, silently\n * dropping the base. The base has to end in a separator, and a path from\n * `process.cwd()` never does, so this is where the plugin would otherwise write the\n * shell into the filesystem root.\n */\nfunction toDirUrl(value: string | URL): URL {\n const url = toUrl(value);\n return url.href.endsWith('/') ? url : new URL(`${url.href}/`);\n}\n\nexport function spaShellEmbedPlugin(target: SpaShellTarget): Plugin & { closeBundle: () => void } {\n return {\n name: 'spa-shell-embed',\n closeBundle() {\n // Resolved from the directory the build runs in, never from this module's own\n // URL: the plugin object is created here but executes in the consumer's Vite\n // process, and `new URL(path, import.meta.url)` would resolve against\n // `node_modules/@rexezuge/tooling`. `process.cwd()` is the repo root for\n // `pnpm --filter @scope/web build`, which is how every consumer runs it.\n const root = toDirUrl(target.root ?? process.cwd());\n const outputPath = fileURLToPath(new URL(target.path, root));\n // A relative `distIndex` resolves against the root, like `path` does —\n // not against the process's working directory, which under\n // `pnpm --filter … build` is the package directory.\n const indexPath =\n target.distIndex === undefined\n ? fileURLToPath(new URL('dist/index.html', root))\n : fileURLToPath(\n typeof target.distIndex === 'string' && !/^[a-z][a-z\\d+\\-.]*:/i.test(target.distIndex)\n ? new URL(target.distIndex, root)\n : toUrl(target.distIndex),\n );\n\n if (!existsSync(indexPath)) {\n console.warn('spa-shell-embed: dist/index.html not found, skipping');\n return;\n }\n\n const html = readFileSync(indexPath, 'utf8');\n const output = `// Auto-generated by Vite build plugin - DO NOT EDIT.\\nexport const SPA_HTML: string = ${JSON.stringify(html)};\\n`;\n\n mkdirSync(path.dirname(outputPath), { recursive: true });\n writeFileSync(outputPath, output);\n },\n };\n}\n\n/**\n * Build the SPA's Vite config.\n *\n * ```ts\n * // apps/web/vite.config.ts\n * import react from '@vitejs/plugin-react';\n * import { defineWebViteConfig, spaShellEmbedPlugin } from '@rexezuge/tooling/vite';\n *\n * export default defineWebViteConfig({\n * plugins: [react()],\n * proxy: { '/user': { target: 'http://localhost:8787', changeOrigin: true } },\n * spaShell: { path: '../../apps/api/src/generated/spa-shell.ts' },\n * });\n * ```\n */\nexport function defineWebViteConfig(options: WebViteConfigOptions = {}): ViteUserConfig {\n const plugins: Plugin[] = [...(options.plugins ?? [])];\n if (options.spaShell !== undefined) {\n plugins.push(spaShellEmbedPlugin(options.spaShell));\n }\n\n return defineConfig({\n ...(plugins.length > 0 && { plugins }),\n ...(options.proxy !== undefined && { server: { proxy: { ...options.proxy } } }),\n build: {\n outDir: options.outDir ?? 'dist',\n emptyOutDir: true,\n },\n });\n}\n"],
5
- "mappings": "+EA+BA,OAAS,cAAAA,EAAY,aAAAC,EAAW,gBAAAC,EAAc,iBAAAC,MAAqB,UACnE,OAAOC,MAAU,YACjB,OAAS,iBAAAC,EAAe,iBAAAC,MAAqB,WAC7C,OAAS,gBAAAC,MAAsD,gBAmI/D,SAASC,EAAMC,EAAmB,CAChC,OAAIA,aAAiB,IAAYA,EAC1BA,EAAM,WAAW,OAAO,EAAI,IAAI,IAAIA,CAAK,EAAIH,EAAcG,CAAK,CACzE,CAHSC,EAAAF,EAAA,SAcT,SAASG,EAASF,EAAmB,CACnC,MAAMG,EAAMJ,EAAMC,CAAK,EACvB,OAAOG,EAAI,KAAK,SAAS,GAAG,EAAIA,EAAM,IAAI,IAAI,GAAGA,EAAI,IAAI,GAAG,CAC9D,CAHSF,EAAAC,EAAA,YAKH,SAAUE,EAAoBC,EAAsB,CACxD,MAAO,CACL,KAAM,kBACN,aAAW,CAMT,MAAMC,EAAOJ,EAASG,EAAO,MAAQ,QAAQ,IAAG,CAAE,EAC5CE,EAAaX,EAAc,IAAI,IAAIS,EAAO,KAAMC,CAAI,CAAC,EAIrDE,EACJH,EAAO,YAAc,OACjBT,EAAc,IAAI,IAAI,kBAAmBU,CAAI,CAAC,EAC9CV,EACE,OAAOS,EAAO,WAAc,UAAY,CAAC,uBAAuB,KAAKA,EAAO,SAAS,EACjF,IAAI,IAAIA,EAAO,UAAWC,CAAI,EAC9BP,EAAMM,EAAO,SAAS,CAAC,EAGnC,GAAI,CAACd,EAAWiB,CAAS,EAAG,CAC1B,QAAQ,KAAK,sDAAsD,EACnE,MACF,CAEA,MAAMC,EAAOhB,EAAae,EAAW,MAAM,EACrCE,EAAS;kCAA0F,KAAK,UAAUD,CAAI,CAAC;EAE7HjB,EAAUG,EAAK,QAAQY,CAAU,EAAG,CAAE,UAAW,EAAI,CAAE,EACvDb,EAAca,EAAYG,CAAM,CAClC,EAEJ,CAnCgBT,EAAAG,EAAA,uBAoDV,SAAUO,EAAoBC,EAAgC,CAAA,EAAE,CACpE,MAAMC,EAAoB,CAAC,GAAID,EAAQ,SAAW,CAAA,CAAG,EACrD,OAAIA,EAAQ,WAAa,QACvBC,EAAQ,KAAKT,EAAoBQ,EAAQ,QAAQ,CAAC,EAG7Cd,EAAa,CAClB,GAAIe,EAAQ,OAAS,GAAK,CAAE,QAAAA,CAAO,EACnC,GAAID,EAAQ,QAAU,QAAa,CAAE,OAAQ,CAAE,MAAO,CAAE,GAAGA,EAAQ,KAAK,CAAE,CAAE,EAC5E,MAAO,CACL,OAAQA,EAAQ,QAAU,OAC1B,YAAa,IAEhB,CACH,CAdgBX,EAAAU,EAAA",
6
- "names": ["existsSync", "mkdirSync", "readFileSync", "writeFileSync", "path", "fileURLToPath", "pathToFileURL", "defineConfig", "toUrl", "value", "__name", "toDirUrl", "url", "spaShellEmbedPlugin", "target", "root", "outputPath", "indexPath", "html", "output", "defineWebViteConfig", "options", "plugins"]
4
+ "sourcesContent": ["/**\n * The SPA's Vite config.\n *\n * Provenance: converged from the `apps/web/vite.config.ts` of the eight repos\n * that build a Vite SPA. They are one file with three variables: the plugin list\n * (`@vitejs/plugin-react` + `@tailwindcss/vite`), the dev-server proxy target,\n * and the `spa-shell-embed` plugin that copies `dist/index.html` into\n * `apps/api/src/generated/spa-shell.ts`.\n *\n * Canonical decisions:\n *\n * 1. **The plugins are passed in, not imported.** The kit stays zero-dependency:\n * `react`, `@vitejs/plugin-react` and `@tailwindcss/vite` belong to the app\n * that uses them, and importing them here would make the tooling package\n * undownloadable for a consumer without a React SPA.\n * 2. **The `spa-shell-embed` hook stays per-repo, and is passed in.** It is the\n * one genuinely repo-specific piece: each repo names its own worker and its\n * own generated-module path. What the kit provides is the *contract* — see\n * `spaShellEmbedPlugin`, which is the converged body of all eight copies.\n * 3. **`server.proxy` is data, not code.** The paths differ per repo\n * (`/user` + `/rest` in Edge-Sonic, `/api` in CalDAV-Bridge, `/tracker` in\n * ChordDHT-Tracker) but the shape never does, so it is an option with a\n * default.\n * 4. **`build.emptyOutDir: true`** is the default, because a stale asset in\n * `dist/` is served as a live bundle — the same half-refreshed build\n * `scripts/verify-spa-shell.ts` rejects.\n *\n * The consumer's `apps/web/vite.config.ts` becomes a handful of lines — see the\n * README.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { defineConfig, type Plugin, type ViteUserConfig } from 'vitest/config';\nimport { asVitePlugins } from './plugin-option.ts';\nimport type { PluginOption } from './plugin-option.ts';\n\n/**\n * One dev-server proxy entry, as Vite's `server.proxy` accepts it.\n */\nexport interface ProxyEntry {\n readonly target: string;\n readonly changeOrigin?: boolean;\n readonly bypass?: (request: { headers: Record<string, string | string[] | undefined> }) => string | undefined;\n /**\n * Proxy WebSocket upgrades on this path.\n *\n * Vite's `server.proxy` needs `ws: true` for an entry that carries a\n * WebSocket, and the entry has no other way to say so: without it the\n * handshake is proxied as an ordinary request and the socket never opens.\n * A consumer with a live-update or realtime endpoint therefore could not\n * express its dev proxy through this table at all.\n */\n readonly ws?: boolean;\n}\n\n/**\n * Where the SPA's built `index.html` is copied to, and under what module name.\n */\nexport interface SpaShellTarget {\n /**\n * Path of the generated module, relative to the repository root.\n *\n * `apps/api/src/generated/spa-shell.ts` in every repo that embeds a shell; the\n * parameter exists because the path is the one thing that genuinely differs.\n */\n readonly path: string;\n /**\n * The repository root the path is resolved against, as a file URL or a path.\n *\n * Defaults to the directory the build runs in (`process.cwd()`), which is the\n * repo root when the build is `pnpm --filter @scope/web build`. Passed in by the\n * Vite config, not derived from `import.meta.url`: this plugin object is created\n * inside the kit's own module, so a URL relative to it points into\n * `node_modules/@rexezuge/tooling` and writes the shell somewhere no compiler\n * will ever look.\n */\n readonly root?: string | URL;\n /**\n * The built `index.html`, as a path or file URL.\n *\n * Defaults to `dist/index.html` under the same root. Vite's `closeBundle` runs\n * after the bundle is written, so this is the file the build just produced.\n *\n * A **relative** path resolves against {@link SpaShellTarget.root}, exactly as\n * {@link SpaShellTarget.path} does. It used to resolve against the process's\n * working directory, which under `pnpm --filter … build` is the *package*\n * directory rather than the repository root — so a consumer naming the file\n * relative to the root it had just been given wrote nowhere, and the plugin\n * reported \"dist/index.html not found, skipping\". That message is also what a\n * genuinely fresh checkout prints on its first build, so the two are\n * indistinguishable in the log, and the worker keeps serving the *previous*\n * shell: the SPA ships yesterday's JavaScript with nothing in the build log\n * to explain it.\n */\n readonly distIndex?: string | URL;\n}\n\n/**\n * What `defineWebViteConfig` accepts.\n */\nexport interface WebViteConfigOptions {\n /**\n * The SPA's plugins — `react()`, `tailwindcss()`, and anything else the app\n * needs. Applied before the spa-shell plugin so the shell is written after the\n * bundle exists.\n */\n readonly plugins?: readonly PluginOption[];\n /**\n * Dev-server proxy entries. Keyed by path prefix.\n */\n readonly proxy?: Readonly<Record<string, ProxyEntry>>;\n /**\n * Where the built shell is embedded. Omit to skip the embedding entirely.\n */\n readonly spaShell?: SpaShellTarget;\n /**\n * The build output directory.\n */\n readonly outDir?: string;\n /**\n * The directory this config is resolved from, as a file URL. Defaults to the\n * caller's location.\n */\n readonly root?: string;\n}\n\n/**\n * The `spa-shell-embed` plugin, converged from all eight copies.\n *\n * It exists because the API worker serves `SPA_HTML` from a module in its own\n * source tree, and both that module and `dist/` are gitignored — so a fresh\n * clone gets an empty stub from `postinstall` and every `GET /` returns a blank\n * page until someone runs a build. This plugin is what makes the build write the\n * real artefact, and `scripts/verify-spa-shell.ts` is what refuses to deploy\n * without it.\n *\n * Written as a factory rather than inlined so the exit conditions are in one\n * place: the `closeBundle` hook runs on every build, including the ones where\n * `dist/index.html` was never produced, and a plugin that throws there fails\n * builds that legitimately emit nothing.\n */\n/**\n * Normalise a path-or-URL option to a URL, so `new URL(...)` can be used on it.\n *\n * Small, and here because two options accept either form: a path is what a consumer\n * naturally writes in a config, and a URL is what `import.meta.url` hands them.\n * Accepting both is one line and saves a `fileURLToPath` at every call site.\n */\n/**\n * Normalise `string | URL` to a `URL`.\n *\n * A string that is **already a file URL** must be parsed, not converted:\n * `pathToFileURL('file:///srv/app')` treats its argument as a filesystem path\n * and produces `file:///<cwd>/file:/srv/app`, so every path built on top of it\n * silently resolves into a directory named after the scheme.\n *\n * The failure this prevented is not loud. `spaShellEmbedPlugin` then reports\n * \"dist/index.html not found, skipping\" — which is also what a genuinely fresh\n * checkout prints on its first build — and the consumer's worker keeps serving\n * the *previous* shell, so the SPA ships yesterday's JavaScript with no error\n * anywhere in the build log. Both `root` and `distIndex` are documented as\n * \"a file URL or a path\", and `new URL('.', import.meta.url).href` — the shape\n * every config file reaches for first — is a file-URL string, so this is the\n * path most callers take.\n */\nfunction toUrl(value: string | URL): URL {\n if (value instanceof URL) return value;\n return value.startsWith('file:') ? new URL(value) : pathToFileURL(value);\n}\n\n/**\n * The same, as a **directory** URL — with the trailing separator `new URL(rel, base)`\n * needs.\n *\n * `new URL('apps/api/x.ts', 'file:///repo')` resolves to `/apps/api/x.ts`, silently\n * dropping the base. The base has to end in a separator, and a path from\n * `process.cwd()` never does, so this is where the plugin would otherwise write the\n * shell into the filesystem root.\n */\nfunction toDirUrl(value: string | URL): URL {\n const url = toUrl(value);\n return url.href.endsWith('/') ? url : new URL(`${url.href}/`);\n}\n\nexport function spaShellEmbedPlugin(target: SpaShellTarget): Plugin & { closeBundle: () => void } {\n return {\n name: 'spa-shell-embed',\n closeBundle() {\n // Resolved from the directory the build runs in, never from this module's own\n // URL: the plugin object is created here but executes in the consumer's Vite\n // process, and `new URL(path, import.meta.url)` would resolve against\n // `node_modules/@rexezuge/tooling`. `process.cwd()` is the repo root for\n // `pnpm --filter @scope/web build`, which is how every consumer runs it.\n const root = toDirUrl(target.root ?? process.cwd());\n const outputPath = fileURLToPath(new URL(target.path, root));\n // A relative `distIndex` resolves against the root, like `path` does —\n // not against the process's working directory, which under\n // `pnpm --filter … build` is the package directory.\n const indexPath =\n target.distIndex === undefined\n ? fileURLToPath(new URL('dist/index.html', root))\n : fileURLToPath(\n typeof target.distIndex === 'string' && !/^[a-z][a-z\\d+\\-.]*:/i.test(target.distIndex)\n ? new URL(target.distIndex, root)\n : toUrl(target.distIndex),\n );\n\n if (!existsSync(indexPath)) {\n // eslint-disable-next-line no-restricted-globals -- build-time Vite plugin, not worker code: there is no logger to inject\n console.warn('spa-shell-embed: dist/index.html not found, skipping');\n return;\n }\n\n const html = readFileSync(indexPath, 'utf8');\n const output = `// Auto-generated by Vite build plugin - DO NOT EDIT.\\nexport const SPA_HTML: string = ${JSON.stringify(html)};\\n`;\n\n mkdirSync(path.dirname(outputPath), { recursive: true });\n writeFileSync(outputPath, output);\n },\n };\n}\n\n/**\n * Build the SPA's Vite config.\n *\n * ```ts\n * // apps/web/vite.config.ts\n * import react from '@vitejs/plugin-react';\n * import { defineWebViteConfig, spaShellEmbedPlugin } from '@rexezuge/tooling/vite';\n *\n * export default defineWebViteConfig({\n * plugins: [react()],\n * proxy: { '/user': { target: 'http://localhost:8787', changeOrigin: true } },\n * spaShell: { path: '../../apps/api/src/generated/spa-shell.ts' },\n * });\n * ```\n */\nexport function defineWebViteConfig(options: WebViteConfigOptions = {}): ViteUserConfig {\n const plugins: PluginOption[] = [...(options.plugins ?? [])];\n if (options.spaShell !== undefined) {\n plugins.push(spaShellEmbedPlugin(options.spaShell));\n }\n\n return defineConfig({\n ...(plugins.length > 0 && { plugins: asVitePlugins(plugins) }),\n ...(options.proxy !== undefined && { server: { proxy: { ...options.proxy } } }),\n build: {\n outDir: options.outDir ?? 'dist',\n emptyOutDir: true,\n },\n });\n}\n"],
5
+ "mappings": "+EA+BA,OAAS,cAAAA,EAAY,aAAAC,EAAW,gBAAAC,EAAc,iBAAAC,MAAqB,UACnE,OAAOC,MAAU,YACjB,OAAS,i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IA,EAAQ,WAAa,QACvBC,EAAQ,KAAKT,EAAoBQ,EAAQ,QAAQ,CAAC,EAG7Cf,EAAa,CAClB,GAAIgB,EAAQ,OAAS,GAAK,CAAE,QAASf,EAAce,CAAO,CAAC,EAC3D,GAAID,EAAQ,QAAU,QAAa,CAAE,OAAQ,CAAE,MAAO,CAAE,GAAGA,EAAQ,KAAK,CAAE,CAAE,EAC5E,MAAO,CACL,OAAQA,EAAQ,QAAU,OAC1B,YAAa,IAEhB,CACH,CAdgBX,EAAAU,EAAA",
6
+ "names": ["existsSync", "mkdirSync", "readFileSync", "writeFileSync", "path", "fileURLToPath", "pathToFileURL", "defineConfig", "asVitePlugins", "toUrl", "value", "__name", "toDirUrl", "url", "spaShellEmbedPlugin", "target", "root", "outputPath", "indexPath", "html", "output", "defineWebViteConfig", "options", "plugins"]
7
7
  }
@@ -96,6 +96,9 @@ export interface WorkspaceAliasesOptions {
96
96
  /**
97
97
  * Build the workspace alias table for a consumer repo.
98
98
  *
99
+ * `cloudflare:workers` resolves to `<root>/test/mocks/cloudflare-workers.ts` when
100
+ * that file exists, and otherwise to `@rexezuge/testing/cloudflare-workers`.
101
+ *
99
102
  * Aliases point at source rather than at built output, so a test exercises the
100
103
  * code the worker would run without a build step. `background` resolves under
101
104
  * `apps/`; every other package under `packages/`. `@/` maps to the API worker
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-aliases.d.ts","sourceRoot":"","sources":["../src/vitest-aliases.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAYvD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAwC,CAAC;AA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C;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;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,YAAY,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAChD;AAcD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,WAAW,EAAE,CAqBhF"}
@@ -1 +1 @@
1
- var l=Object.defineProperty;var t=(c,o)=>l(c,"name",{value:o,configurable:!0});import{fileURLToPath as f}from"node:url";const m=["shared","backend-errors","backend-runtime","backend-data","provider-clients","webdav","dav-store","git-protocol","git-service","backend-services","background"],u=["workers","sockets","workflows"],A=[/(^|[/\\])@rexezuge\//],E=["react","react-dom","react/jsx-runtime","lucide-react"];function w(c){const{scope:o,root:a}=c,n=c.packages??m,p=c.mocks??u,r=t(e=>f(new URL(e,a)),"at"),s=[];for(const e of n){const k=e==="background"?"apps/background/src":`packages/${e}/src`;s.push({find:`${o}/${e}`,replacement:r(k)})}for(const e of p)s.push({find:`cloudflare:${e}`,replacement:r(`test/mocks/cloudflare-${e}.ts`)});const d=r("apps/api/src"),i=r("apps/web/src");return s.push({find:/^@\//,replacement:`${d}/`},{find:/^~\//,replacement:`${i}/`},...c.extraAliases??[]),s}t(w,"workspaceAliases");export{u as DEFAULT_CLOUDFLARE_MOCKS,m as DEFAULT_WORKSPACE_PACKAGES,E as KIT_DEDUPE,A as KIT_NO_EXTERNAL,w as workspaceAliases};
1
+ var d=Object.defineProperty;var s=(r,a)=>d(r,"name",{value:a,configurable:!0});import{existsSync as m}from"node:fs";import{createRequire as f}from"node:module";import{fileURLToPath as g}from"node:url";const b=["shared","backend-errors","backend-runtime","backend-data","provider-clients","webdav","dav-store","git-protocol","git-service","backend-services","background"],w=["workers","sockets","workflows"],$=[/(^|[/\\])@rexezuge\//],h=["react","react-dom","react/jsx-runtime","lucide-react"];function x(){try{return f(import.meta.url).resolve("@rexezuge/testing/cloudflare-workers")}catch{return null}}s(x,"kitWorkersMock");function v(r){const{scope:a,root:n}=r,i=r.packages??b,p=r.mocks??w,c=s(e=>g(new URL(e,n)),"at"),o=[];for(const e of i){const t=e==="background"?"apps/background/src":`packages/${e}/src`;o.push({find:`${a}/${e}`,replacement:c(t)})}for(const e of p){const t=c(`test/mocks/cloudflare-${e}.ts`),u=e==="workers"&&!m(t)?x():null;o.push({find:`cloudflare:${e}`,replacement:u??t})}const l=c("apps/api/src"),k=c("apps/web/src");return o.push({find:/^@\//,replacement:`${l}/`},{find:/^~\//,replacement:`${k}/`},...r.extraAliases??[]),o}s(v,"workspaceAliases");export{w as DEFAULT_CLOUDFLARE_MOCKS,b as DEFAULT_WORKSPACE_PACKAGES,h as KIT_DEDUPE,$ as KIT_NO_EXTERNAL,v as workspaceAliases};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/vitest-aliases.ts"],
4
- "sourcesContent": ["import { fileURLToPath } from 'node:url';\n\n/**\n * One `{ find, replacement }` pair for Vitest's resolver.\n *\n * A `string` find is a prefix match in Vite; a `RegExp` find is tested against\n * the specifier. Workspace scopes use plain strings (`'@scope/name'` matches\n * `'@scope/name'` and `'@scope/name/sub'` alike); `@/` and `~/` use regexps so\n * the trailing slash is part of the match.\n */\nexport interface VitestAlias {\n readonly find: string | RegExp;\n readonly replacement: string;\n}\n\n/**\n * Every workspace package the family has converged on, as directory names under\n * `packages/`.\n *\n * The union across all nine repos: the universal core (`shared`,\n * `backend-errors`, `backend-runtime`, `backend-data`, `backend-services`) plus\n * the domain packages (`provider-clients`, `webdav`, `dav-store`,\n * `git-protocol`, `git-service`). `media-tags`/`subsonic` (Edge-Sonic) are\n * unconstrained utility leaves with no boundary block and no alias in their\n * source repo, so they are not listed — a repo that needs them passes\n * `packages` explicitly or appends `aliases`.\n *\n * A superset is safe: an alias for a package the consumer does not have never\n * matches a specifier, and Vite only resolves the replacement when something\n * imports it.\n */\nexport const DEFAULT_WORKSPACE_PACKAGES: readonly string[] = [\n 'shared',\n 'backend-errors',\n 'backend-runtime',\n 'backend-data',\n 'provider-clients',\n 'webdav',\n 'dav-store',\n 'git-protocol',\n 'git-service',\n 'backend-services',\n 'background',\n];\n\n/**\n * The Cloudflare runtime mocks the unit suite aliases.\n *\n * `workers` exists in every repo; `sockets` in five; `workflows` in four. All\n * three are listed by default: an alias whose mock file is absent never fires\n * unless a test imports the specifier, and then the missing file is the correct\n * error rather than Node's `ERR_UNKNOWN_SCHEME` for `cloudflare:*`.\n */\nexport const DEFAULT_CLOUDFLARE_MOCKS: readonly string[] = ['workers', 'sockets', 'workflows'];\n\n/**\n * Keep the kit's own `dist/` inside Vite's pipeline.\n *\n * The kit ships ESM `dist/` with bundler-style extensionless relative imports\n * (its tsconfig is `moduleResolution: Bundler`), which Node's ESM resolver\n * refuses. Vitest externalizes `node_modules` deps by default and would import\n * that dist with Node; `noExternal` routes `@rexezuge/*` back through Vite —\n * the same resolver that bundles the worker — so a test loads the very dist\n * the worker ships. Without this, the run dies on `./BaseDAO` inside\n * `@rexezuge/d1`'s `dist/index.js`.\n */\nexport const KIT_NO_EXTERNAL: readonly RegExp[] = [/(^|[/\\\\])@rexezuge\\//];\n\n/**\n * Bare specifiers the kit and its consumer must resolve to **one** copy.\n *\n * Every entry is a peer of a kit package rather than a dependency, which is\n * exactly why it is needed: a peer is not installed twice under a registry\n * install, so the two sides already agree. A `link:` install breaks that\n * agreement — the symlinked package directory carries its own `node_modules`, and\n * with `@rexezuge/*` inlined into Vite's pipeline (see {@link KIT_NO_EXTERNAL})\n * the kit's copy wins for its own imports while the consumer's wins for the app's.\n *\n * Two Reacts is not a warning: `useState` is read off a module-level hook\n * dispatcher that only one of them initialises, so every hook inside a kit\n * component throws `Cannot read properties of null (reading 'useState')`. The\n * failure names the kit, and the cause is the install layout.\n */\nexport const KIT_DEDUPE: readonly string[] = ['react', 'react-dom', 'react/jsx-runtime', 'lucide-react'];\n\n/**\n * What `workspaceAliases` accepts.\n */\nexport interface WorkspaceAliasesOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. Every `@scope/*` alias is\n * derived from it, so the same factory serves all nine repos.\n */\n readonly scope: string;\n /**\n * The repo root, as a file URL. Pass `new URL('.', import.meta.url).href`\n * from the calling config — never `import.meta.url` of this module, which\n * points inside `node_modules/@rexezuge/tooling`.\n */\n readonly root: string;\n /**\n * Workspace package directory names under `packages/` plus `background`\n * (which lives under `apps/`). Defaults to {@link DEFAULT_WORKSPACE_PACKAGES}.\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to {@link DEFAULT_CLOUDFLARE_MOCKS}.\n */\n readonly mocks?: readonly string[];\n /**\n * Extra resolver entries, applied after the canonical ones.\n */\n readonly extraAliases?: readonly VitestAlias[];\n}\n\n/**\n * Build the workspace alias table for a consumer repo.\n *\n * Aliases point at source rather than at built output, so a test exercises the\n * code the worker would run without a build step. `background` resolves under\n * `apps/`; every other package under `packages/`. `@/` maps to the API worker\n * source and `~/` to the SPA source, matching the two `tsconfig` path prefixes\n * every repo shares.\n */\nexport function workspaceAliases(options: WorkspaceAliasesOptions): VitestAlias[] {\n const { scope, root } = options;\n const packages = options.packages ?? DEFAULT_WORKSPACE_PACKAGES;\n const mocks = options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS;\n const at = (relative: string): string => fileURLToPath(new URL(relative, root));\n const aliases: VitestAlias[] = [];\n for (const name of packages) {\n const dir = name === 'background' ? 'apps/background/src' : `packages/${name}/src`;\n aliases.push({ find: `${scope}/${name}`, replacement: at(dir) });\n }\n for (const mock of mocks) {\n aliases.push({ find: `cloudflare:${mock}`, replacement: at(`test/mocks/cloudflare-${mock}.ts`) });\n }\n const apiSrc = at('apps/api/src');\n const webSrc = at('apps/web/src');\n aliases.push({ find: /^@\\//, replacement: `${apiSrc}/` }, { find: /^~\\//, replacement: `${webSrc}/` }, ...(options.extraAliases ?? []));\n return aliases;\n}\n"],
5
- "mappings": "+EAAA,OAAS,iBAAAA,MAAqB,WA+BvB,MAAMC,EAAgD,CAC3D,SACA,iBACA,kBACA,eACA,mBACA,SACA,YACA,eACA,cACA,mBACA,cAWWC,EAA8C,CAAC,UAAW,UAAW,WAAW,EAahFC,EAAqC,CAAC,sBAAsB,EAiB5DC,EAAgC,CAAC,QAAS,YAAa,oBAAqB,cAAc,EAyCjG,SAAUC,EAAiBC,EAAgC,CAC/D,KAAM,CAAE,MAAAC,EAAO,KAAAC,CAAI,EAAKF,EAClBG,EAAWH,EAAQ,UAAYL,EAC/BS,EAAQJ,EAAQ,OAASJ,EACzBS,EAAKC,EAACC,GAA6Bb,EAAc,IAAI,IAAIa,EAAUL,CAAI,CAAC,EAAnE,MACLM,EAAyB,CAAA,EAC/B,UAAWC,KAAQN,EAAU,CAC3B,MAAMO,EAAMD,IAAS,aAAe,sBAAwB,YAAYA,CAAI,OAC5ED,EAAQ,KAAK,CAAE,KAAM,GAAGP,CAAK,IAAIQ,CAAI,GAAI,YAAaJ,EAAGK,CAAG,CAAC,CAAE,CACjE,CACA,UAAWC,KAAQP,EACjBI,EAAQ,KAAK,CAAE,KAAM,cAAcG,CAAI,GAAI,YAAaN,EAAG,yBAAyBM,CAAI,KAAK,CAAC,CAAE,EAElG,MAAMC,EAASP,EAAG,cAAc,EAC1BQ,EAASR,EAAG,cAAc,EAChC,OAAAG,EAAQ,KAAK,CAAE,KAAM,OAAQ,YAAa,GAAGI,CAAM,GAAG,EAAI,CAAE,KAAM,OAAQ,YAAa,GAAGC,CAAM,GAAG,EAAI,GAAIb,EAAQ,cAAgB,CAAA,CAAG,EAC/HQ,CACT,CAjBgBF,EAAAP,EAAA",
6
- "names": ["fileURLToPath", "DEFAULT_WORKSPACE_PACKAGES", "DEFAULT_CLOUDFLARE_MOCKS", "KIT_NO_EXTERNAL", "KIT_DEDUPE", "workspaceAliases", "options", "scope", "root", "packages", "mocks", "at", "__name", "relative", "aliases", "name", "dir", "mock", "apiSrc", "webSrc"]
4
+ "sourcesContent": ["import { existsSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * One `{ find, replacement }` pair for Vitest's resolver.\n *\n * A `string` find is a prefix match in Vite; a `RegExp` find is tested against\n * the specifier. Workspace scopes use plain strings (`'@scope/name'` matches\n * `'@scope/name'` and `'@scope/name/sub'` alike); `@/` and `~/` use regexps so\n * the trailing slash is part of the match.\n */\nexport interface VitestAlias {\n readonly find: string | RegExp;\n readonly replacement: string;\n}\n\n/**\n * Every workspace package the family has converged on, as directory names under\n * `packages/`.\n *\n * The union across all nine repos: the universal core (`shared`,\n * `backend-errors`, `backend-runtime`, `backend-data`, `backend-services`) plus\n * the domain packages (`provider-clients`, `webdav`, `dav-store`,\n * `git-protocol`, `git-service`). `media-tags`/`subsonic` (Edge-Sonic) are\n * unconstrained utility leaves with no boundary block and no alias in their\n * source repo, so they are not listed — a repo that needs them passes\n * `packages` explicitly or appends `aliases`.\n *\n * A superset is safe: an alias for a package the consumer does not have never\n * matches a specifier, and Vite only resolves the replacement when something\n * imports it.\n */\nexport const DEFAULT_WORKSPACE_PACKAGES: readonly string[] = [\n 'shared',\n 'backend-errors',\n 'backend-runtime',\n 'backend-data',\n 'provider-clients',\n 'webdav',\n 'dav-store',\n 'git-protocol',\n 'git-service',\n 'backend-services',\n 'background',\n];\n\n/**\n * The Cloudflare runtime mocks the unit suite aliases.\n *\n * `workers` exists in every repo; `sockets` in five; `workflows` in four. All\n * three are listed by default: an alias whose mock file is absent never fires\n * unless a test imports the specifier, and then the missing file is the correct\n * error rather than Node's `ERR_UNKNOWN_SCHEME` for `cloudflare:*`.\n */\nexport const DEFAULT_CLOUDFLARE_MOCKS: readonly string[] = ['workers', 'sockets', 'workflows'];\n\n/**\n * Keep the kit's own `dist/` inside Vite's pipeline.\n *\n * The kit ships ESM `dist/` with bundler-style extensionless relative imports\n * (its tsconfig is `moduleResolution: Bundler`), which Node's ESM resolver\n * refuses. Vitest externalizes `node_modules` deps by default and would import\n * that dist with Node; `noExternal` routes `@rexezuge/*` back through Vite —\n * the same resolver that bundles the worker — so a test loads the very dist\n * the worker ships. Without this, the run dies on `./BaseDAO` inside\n * `@rexezuge/d1`'s `dist/index.js`.\n */\nexport const KIT_NO_EXTERNAL: readonly RegExp[] = [/(^|[/\\\\])@rexezuge\\//];\n\n/**\n * Bare specifiers the kit and its consumer must resolve to **one** copy.\n *\n * Every entry is a peer of a kit package rather than a dependency, which is\n * exactly why it is needed: a peer is not installed twice under a registry\n * install, so the two sides already agree. A `link:` install breaks that\n * agreement — the symlinked package directory carries its own `node_modules`, and\n * with `@rexezuge/*` inlined into Vite's pipeline (see {@link KIT_NO_EXTERNAL})\n * the kit's copy wins for its own imports while the consumer's wins for the app's.\n *\n * Two Reacts is not a warning: `useState` is read off a module-level hook\n * dispatcher that only one of them initialises, so every hook inside a kit\n * component throws `Cannot read properties of null (reading 'useState')`. The\n * failure names the kit, and the cause is the install layout.\n */\nexport const KIT_DEDUPE: readonly string[] = ['react', 'react-dom', 'react/jsx-runtime', 'lucide-react'];\n\n/**\n * What `workspaceAliases` accepts.\n */\nexport interface WorkspaceAliasesOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. Every `@scope/*` alias is\n * derived from it, so the same factory serves all nine repos.\n */\n readonly scope: string;\n /**\n * The repo root, as a file URL. Pass `new URL('.', import.meta.url).href`\n * from the calling config — never `import.meta.url` of this module, which\n * points inside `node_modules/@rexezuge/tooling`.\n */\n readonly root: string;\n /**\n * Workspace package directory names under `packages/` plus `background`\n * (which lives under `apps/`). Defaults to {@link DEFAULT_WORKSPACE_PACKAGES}.\n */\n readonly packages?: readonly string[];\n /**\n * Which `cloudflare:*` mocks to alias. Defaults to {@link DEFAULT_CLOUDFLARE_MOCKS}.\n */\n readonly mocks?: readonly string[];\n /**\n * Extra resolver entries, applied after the canonical ones.\n */\n readonly extraAliases?: readonly VitestAlias[];\n}\n\n/**\n * Where the kit's own `cloudflare:workers` mock lives, or `null` when\n * `@rexezuge/testing` is not resolvable from here.\n */\nfunction kitWorkersMock(): string | null {\n try {\n return createRequire(import.meta.url).resolve('@rexezuge/testing/cloudflare-workers');\n } catch {\n return null;\n }\n}\n\n/**\n * Build the workspace alias table for a consumer repo.\n *\n * `cloudflare:workers` resolves to `<root>/test/mocks/cloudflare-workers.ts` when\n * that file exists, and otherwise to `@rexezuge/testing/cloudflare-workers`.\n *\n * Aliases point at source rather than at built output, so a test exercises the\n * code the worker would run without a build step. `background` resolves under\n * `apps/`; every other package under `packages/`. `@/` maps to the API worker\n * source and `~/` to the SPA source, matching the two `tsconfig` path prefixes\n * every repo shares.\n */\nexport function workspaceAliases(options: WorkspaceAliasesOptions): VitestAlias[] {\n const { scope, root } = options;\n const packages = options.packages ?? DEFAULT_WORKSPACE_PACKAGES;\n const mocks = options.mocks ?? DEFAULT_CLOUDFLARE_MOCKS;\n const at = (relative: string): string => fileURLToPath(new URL(relative, root));\n const aliases: VitestAlias[] = [];\n for (const name of packages) {\n const dir = name === 'background' ? 'apps/background/src' : `packages/${name}/src`;\n aliases.push({ find: `${scope}/${name}`, replacement: at(dir) });\n }\n for (const mock of mocks) {\n const local = at(`test/mocks/cloudflare-${mock}.ts`);\n // A repo with no copy of its own gets the kit's: the `workers` mock is a\n // superset of the thirteen family copies, so deleting yours is safe.\n const kit = mock === 'workers' && !existsSync(local) ? kitWorkersMock() : null;\n aliases.push({ find: `cloudflare:${mock}`, replacement: kit ?? local });\n }\n const apiSrc = at('apps/api/src');\n const webSrc = at('apps/web/src');\n aliases.push({ find: /^@\\//, replacement: `${apiSrc}/` }, { find: /^~\\//, replacement: `${webSrc}/` }, ...(options.extraAliases ?? []));\n return aliases;\n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,KAAM,OAAQ,YAAa,GAAGC,CAAM,GAAG,EAAI,GAAId,EAAQ,cAAgB,CAAA,CAAG,EAC/HO,CACT,CArBgBT,EAAAC,EAAA",
6
+ "names": ["existsSync", "createRequire", "fileURLToPath", "DEFAULT_WORKSPACE_PACKAGES", "DEFAULT_CLOUDFLARE_MOCKS", "KIT_NO_EXTERNAL", "KIT_DEDUPE", "kitWorkersMock", "__name", "workspaceAliases", "options", "scope", "root", "packages", "mocks", "at", "relative", "aliases", "name", "dir", "mock", "local", "kit", "apiSrc", "webSrc"]
7
7
  }
@@ -16,7 +16,8 @@
16
16
  * untouched. CalDAV-Bridge's suite passes none of them (plain `node` +
17
17
  * `node:sqlite`, no coverage); the workerd suites pass all three.
18
18
  */
19
- import { defineConfig, type Plugin } from 'vitest/config';
19
+ import { defineConfig } from 'vitest/config';
20
+ import type { PluginOption } from './plugin-option.ts';
20
21
  import type { Pool } from 'vitest/node';
21
22
  import type { VitestAlias } from './vitest-aliases.ts';
22
23
  /**
@@ -51,7 +52,7 @@ export interface IntegrationVitestConfigOptions {
51
52
  * runner's own plugin so a workerd plugin is accepted and nothing new is
52
53
  * imported — this package stays dependency-free.
53
54
  */
54
- readonly plugins?: readonly Plugin[];
55
+ readonly plugins?: readonly PluginOption[];
55
56
  /**
56
57
  * The pool (the workerd `cloudflarePool()`). The runner's own `Pool` type,
57
58
  * so a custom pool is accepted without importing its provider.
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-integration.d.ts","sourceRoot":"","sources":["../src/vitest-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,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AAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,8BAA8B,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAmBtH"}
@@ -1 +1 @@
1
- var l=Object.defineProperty;var r=(e,n)=>l(e,"name",{value:n,configurable:!0});import{defineConfig as s}from"vitest/config";import{DEFAULT_WORKSPACE_PACKAGES as i,workspaceAliases as t}from"./vitest-aliases.js";function c(e){const n=e.root??new URL(".",import.meta.url).href,a=[...t({scope:e.scope,root:n,packages:e.packages??i,mocks:[]}),...e.aliases??[]];return s({...e.define!==void 0&&{define:{...e.define}},...e.plugins!==void 0&&{plugins:[...e.plugins]},resolve:{alias:a},test:{globals:!0,environment:"node",include:[...e.include??["test/integration/**/*.int.test.ts"]],...e.pool!==void 0&&{pool:e.pool}},...e.ssrNoExternal!==void 0&&{ssr:{noExternal:[...e.ssrNoExternal]}}})}r(c,"defineIntegrationVitestConfig");export{c as defineIntegrationVitestConfig};
1
+ var s=Object.defineProperty;var r=(e,n)=>s(e,"name",{value:n,configurable:!0});import{defineConfig as a}from"vitest/config";import{asVitePlugins as l}from"./plugin-option.js";import{DEFAULT_WORKSPACE_PACKAGES as t,workspaceAliases as d}from"./vitest-aliases.js";function g(e){const n=e.root??new URL(".",import.meta.url).href,i=[...d({scope:e.scope,root:n,packages:e.packages??t,mocks:[]}),...e.aliases??[]];return a({...e.define!==void 0&&{define:{...e.define}},...e.plugins!==void 0&&{plugins:l(e.plugins)},resolve:{alias:i},test:{globals:!0,environment:"node",include:[...e.include??["test/integration/**/*.int.test.ts"]],...e.pool!==void 0&&{pool:e.pool}},...e.ssrNoExternal!==void 0&&{ssr:{noExternal:[...e.ssrNoExternal]}}})}r(g,"defineIntegrationVitestConfig");export{g as defineIntegrationVitestConfig};
@@ -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
  */
@@ -134,7 +135,8 @@ export interface RepoVitestConfigOptions {
134
135
  */
135
136
  readonly includeIndexBarrels?: boolean;
136
137
  /**
137
- * Coverage floors. Omitted by default; a repo that wants them sets them.
138
+ * Coverage floors. Defaults to the manifest's `quality.coverage` (`.rexezuge.jsonc`
139
+ * at `root`); without one, no floor.
138
140
  */
139
141
  readonly thresholds?: CoverageThresholds;
140
142
  /**
@@ -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;AAG1D,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,OA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AAQ,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 m=Object.defineProperty;var i=(e,r)=>m(e,"name",{value:r,configurable:!0});import{defineConfig as x}from"vitest/config";import{fileURLToPath as f}from"node:url";import{DEFAULT_CLOUDFLARE_MOCKS as b,DEFAULT_WORKSPACE_PACKAGES as g,KIT_NO_EXTERNAL as v,workspaceAliases as o}from"./vitest-aliases.js";const w=["**/node_modules/**","**/dist/**","test/integration/**","test/web/**","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],A=["test/web/**/*.test.{ts,tsx}","test/**/web-*.test.{ts,tsx}","apps/web/**/*.test.{ts,tsx}"],p=["scripts/**","**/*.test.ts","**/*.test.tsx","**/*.d.ts","**/index.ts","**/types.d.ts","**/types.ts","**/model/**","**/generated/**","**/D1Types.ts","**/ServiceEnv.ts","**/env.d.ts"],C="**/index.ts";function h(e){const r=e.root??new URL(".",import.meta.url).href,c=e.packages??g,l=e.mocks??b,d=[...v,...e.noExternal??[]],t=e.backend??{},s=e.web??{},u=[...o({scope:e.scope,root:r,packages:c,mocks:l}),...e.aliases??[],...t.aliases??[]],a=f(new URL("apps/web/src",r)),E=[{find:/^@\//,replacement:`${a}/`},{find:/^~\//,replacement:`${a}/`},...o({scope:e.scope,root:r,packages:c,mocks:l}).filter(n=>typeof n.find=="string"),...e.aliases??[],...s.aliases??[]];return x({test:{projects:[{resolve:{alias:u,noExternal:d},test:{name:"backend",globals:!0,environment:"node",include:[...t.include??["test/**/*.test.{ts,tsx}"]],exclude:[...t.exclude??w],...t.setupFiles!==void 0&&{setupFiles:[...t.setupFiles]},server:{deps:{inline:[...t.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??A],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?[...p.filter(n=>n!==C),...e.coverageExclude??[]]:[...p,...e.coverageExclude??[]],...e.thresholds!==void 0&&{thresholds:{...e.thresholds}}}}})}i(h,"defineRepoVitestConfig");export{h 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};