@hublo/sentinel 1.7.0-alpha.2 → 1.7.0-alpha.21

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 (57) hide show
  1. package/README.md +1 -0
  2. package/dist/bin/sentinel.js +45 -84
  3. package/dist/{chunk-THTXP2QU.js → chunk-BBNABWZ6.js} +5 -6
  4. package/dist/chunk-BBNABWZ6.js.map +1 -0
  5. package/dist/{chunk-DLGBRLUU.js → chunk-EESVRILJ.js} +3 -16
  6. package/dist/chunk-EESVRILJ.js.map +1 -0
  7. package/dist/{chunk-4YQXLPJ5.js → chunk-J2RMARWP.js} +2 -2
  8. package/dist/chunk-PXTU5MPW.js +9 -0
  9. package/dist/chunk-PXTU5MPW.js.map +1 -0
  10. package/dist/{chunk-EETHWJBF.js → chunk-RI7R3S3T.js} +6835 -5310
  11. package/dist/{chunk-LNFGVGLE.js → chunk-SWWQ7X7B.js} +11 -23
  12. package/dist/{chunk-LNFGVGLE.js.map → chunk-SWWQ7X7B.js.map} +1 -1
  13. package/dist/{chunk-Z3JI7ZWX.js → chunk-UVXXEAHU.js} +231 -196
  14. package/dist/{chunk-ZNANJEMK.js → chunk-XTBHIKFG.js} +30 -16
  15. package/dist/chunk-XTBHIKFG.js.map +1 -0
  16. package/dist/chunk-XYOIXC6A.js +126 -0
  17. package/dist/chunk-XYOIXC6A.js.map +1 -0
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +6 -6
  20. package/dist/roles/build/nest/toolchain.d.ts +1 -1
  21. package/dist/roles/build/nest/toolchain.js +2 -6
  22. package/dist/roles/build/nest/toolchain.js.map +1 -1
  23. package/dist/roles/code-churn/config.d.ts +92 -0
  24. package/dist/roles/code-churn/config.js +10 -0
  25. package/dist/roles/code-churn/config.js.map +1 -0
  26. package/dist/roles/static-analysis/config.js +2 -1
  27. package/dist/roles/test/nest/toolchain.d.ts +1 -1
  28. package/dist/roles/test/nest/toolchain.js +2 -3
  29. package/dist/roles/test/nest/toolchain.js.map +1 -1
  30. package/dist/roles/test/react/toolchain.js +2 -3
  31. package/dist/roles/test/react/toolchain.js.map +1 -1
  32. package/dist/roles/test/setup/jest-parity.js +2 -2
  33. package/dist/roles/test/setup/workspace-entry.js +2 -2
  34. package/dist/roles/test/shared-test-config.d.ts +1 -1
  35. package/dist/roles/test/shared-test-config.js +2 -3
  36. package/dist/tsconfig/nest.json +1 -10
  37. package/dist/tsconfig/node.json +1 -11
  38. package/dist/tsconfig/react.json +0 -3
  39. package/dist/{tsconfig-aliases-C_PxuZni.d.ts → tsconfig-aliases-Ce6axdJ4.d.ts} +2 -17
  40. package/dist/{validate-LRHF63AW.js → validate-YCTNTNFT.js} +2 -4
  41. package/docs/build-adoption.md +0 -7
  42. package/docs/code-churn-adoption.md +237 -0
  43. package/docs/static-analysis-adoption.md +1 -1
  44. package/docs/static-analysis-study.md +49 -10
  45. package/docs/test-adoption.md +1 -8
  46. package/docs/typescript-adoption.md +13 -52
  47. package/docs/typescript-traces.md +215 -3
  48. package/package.json +5 -4
  49. package/dist/chunk-4UUL4SEW.js +0 -50
  50. package/dist/chunk-DLGBRLUU.js.map +0 -1
  51. package/dist/chunk-H4HAFJFZ.js +0 -79
  52. package/dist/chunk-H4HAFJFZ.js.map +0 -1
  53. package/dist/chunk-THTXP2QU.js.map +0 -1
  54. package/dist/chunk-ZNANJEMK.js.map +0 -1
  55. package/dist/migrate-NI33SXZD.js +0 -517
  56. package/dist/tsconfig/legacy.json +0 -21
  57. /package/dist/{chunk-4YQXLPJ5.js.map → chunk-J2RMARWP.js.map} +0 -0
@@ -0,0 +1,92 @@
1
+ interface CodeChurnDefaults {
2
+ /** The two durations the figure is made of, in days. */
3
+ window: {
4
+ /**
5
+ * How long after a line is written a change to it counts as rework. 21 days, the window
6
+ * Sourcegraph uses ("code rewritten or deleted within three weeks of being written"); DevStats
7
+ * gives 14 to 21. A change after it is maintenance, not rework, and is not counted.
8
+ */
9
+ reworkDays: number;
10
+ /**
11
+ * How far back the lines that are measured were written, in days, ending `reworkDays` before
12
+ * the newest commit read. The period stops there so every line it holds has had its full
13
+ * window: a line written yesterday cannot have been rewritten yet, and counting it would lower
14
+ * the figure for a reason that has nothing to do with the code.
15
+ */
16
+ periodDays: number;
17
+ };
18
+ /**
19
+ * A commit that touches more files than this IN THE MODULE is a sweep, a formatter run or a
20
+ * rename sweep, and its lines are not counted. Counted in the module and not in the repository,
21
+ * which was measured: see `churn.ts`, "What is not counted".
22
+ */
23
+ maxFilesPerCommit: number;
24
+ /**
25
+ * Where a module's figure stands, in percent, and below how many added lines it has none.
26
+ *
27
+ * Calibrated on hublo/monorepo `main` f12da701121 (2026-07-28 to 2026-10-26): of the 113 sentinel
28
+ * modules, 33 added no line and 44 fewer than 500 (26 in the median), where one rewrite moves the
29
+ * figure by points; over the 36 others, the 25th, 75th and 90th percentiles are 3.1, 11.4 and
30
+ * 15.9%, rounded DOWN to 3, 11 and 16. They say where a module stands among those modules, never
31
+ * whether its code is good, and are recalibrated by a sweep at each stable release.
32
+ */
33
+ levels: {
34
+ /** Below this many lines added in the period, the module is `quiet`: no percentage stated. */
35
+ minimumAdded: number;
36
+ /** Under this, `low`. */
37
+ low: number;
38
+ /** Over this, `above`. Between `low` and it, `usual`. */
39
+ above: number;
40
+ /** Over this, `watch`. */
41
+ watch: number;
42
+ };
43
+ /** The files whose lines are measured, as globs relative to the module. */
44
+ include: string[];
45
+ /**
46
+ * Measure the tests too. OFF by default: the figure is about the product code, and a test
47
+ * rewritten with the code it checks is the expected case, not rework. A module that decides
48
+ * otherwise sets it to true, and the report says so.
49
+ */
50
+ includeTests: boolean;
51
+ /** What counts as a test, by path. The list the sql role measured, extended to JavaScript. */
52
+ tests: string[];
53
+ /**
54
+ * Files never measured, whatever `include` says: generated and built output. `*.gen.*` is
55
+ * TanStack Router's `routeTree.gen.ts`, regenerated on every route change (career, console and
56
+ * host-admin on hublo/monorepo): measured, it was one of host-admin's most changed files.
57
+ */
58
+ ignore: string[];
59
+ /** How many files the report lists, highest churn first. */
60
+ listed: number;
61
+ }
62
+
63
+ type DeepPartial<T> = {
64
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
65
+ };
66
+ /** What a module's config file passes. Everything is optional, including the file itself. */
67
+ interface CodeChurnInput {
68
+ /** The module's own directory, normally `import.meta.dirname`. */
69
+ root?: string;
70
+ /** The seam. Replaces whatever it names, and every path it sets lands in `moved`. */
71
+ overrides?: DeepPartial<CodeChurnDefaults>;
72
+ }
73
+ interface ResolvedCodeChurnConfig extends CodeChurnDefaults {
74
+ /** The module's directory, or null when its config file did not say. */
75
+ root: string | null;
76
+ /** Dotted paths the module set through `overrides`, sorted so two runs print the same report. */
77
+ moved: string[];
78
+ }
79
+ /** Resolve a module's declaration against this role's defaults. */
80
+ declare function defineCodeChurn(input?: CodeChurnInput): ResolvedCodeChurnConfig;
81
+ /**
82
+ * The settings of a resolved config that cannot be measured with, one sentence each naming the
83
+ * setting and the value. Empty when the config is usable.
84
+ *
85
+ * ⛔ Checked rather than trusted: a negative window runs the period into the future, a `listed` of
86
+ * -1 drops the last file through `slice(0, -1)`, a cap of 0 makes every commit a sweep, an empty
87
+ * `include` measures nothing, levels that do not rise put every module in two bands at once, and
88
+ * none of them says so. Each one is a figure that looks right.
89
+ */
90
+ declare function invalidSettings(config: CodeChurnDefaults): string[];
91
+
92
+ export { type CodeChurnInput, type ResolvedCodeChurnConfig, defineCodeChurn, invalidSettings };
@@ -0,0 +1,10 @@
1
+ import {
2
+ defineCodeChurn,
3
+ invalidSettings
4
+ } from "../../chunk-XYOIXC6A.js";
5
+ import "../../chunk-PXTU5MPW.js";
6
+ export {
7
+ defineCodeChurn,
8
+ invalidSettings
9
+ };
10
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  defineStaticAnalysis
3
- } from "../../chunk-THTXP2QU.js";
3
+ } from "../../chunk-BBNABWZ6.js";
4
+ import "../../chunk-PXTU5MPW.js";
4
5
  export {
5
6
  defineStaticAnalysis
6
7
  };
@@ -2,7 +2,7 @@ import { ViteUserConfig } from 'vitest/config';
2
2
  export { ConfigEnv, TestUserConfig, ViteUserConfig, defineConfig, mergeConfig } from 'vitest/config';
3
3
  export { loadEnv } from 'vite';
4
4
  import { SharedTestOptions } from '../shared-test-config.js';
5
- export { A as Alias, D as DecoratorMetadataOptions, d as decoratorMetadata, t as tsconfigAliases } from '../../../tsconfig-aliases-C_PxuZni.js';
5
+ export { A as Alias, D as DecoratorMetadataOptions, d as decoratorMetadata, t as tsconfigAliases } from '../../../tsconfig-aliases-Ce6axdJ4.js';
6
6
 
7
7
  declare function nestTestConfig(options: SharedTestOptions): ViteUserConfig;
8
8
 
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  sharedTestConfig
3
- } from "../../../chunk-DLGBRLUU.js";
3
+ } from "../../../chunk-EESVRILJ.js";
4
4
  import {
5
5
  decoratorMetadata,
6
6
  tsconfigAliases
7
- } from "../../../chunk-LNFGVGLE.js";
8
- import "../../../chunk-H4HAFJFZ.js";
7
+ } from "../../../chunk-SWWQ7X7B.js";
9
8
  import "../../../chunk-QXFCZON7.js";
10
9
 
11
10
  // src/roles/test/nest/toolchain.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/roles/test/nest/toolchain.ts","../../../../src/roles/test/nest/nest-test-config.ts"],"sourcesContent":["/**\n * What `@hublo/sentinel/test/nest` gives an adopted module.\n *\n * Its own entry point, like the build ones, so importing it from a config never drags the CLI and\n * its adapters into a test run.\n *\n * It differs from `test/react` in one way that matters, and the difference is not decoration.\n * React modules already had a Vitest config carrying decisions their owners made and justified, so\n * that preset is a pure re-export surface and moves nothing. Nest modules have NO Vitest config:\n * one has to be written, and four of its lines are load-bearing in ways nobody would guess from a\n * migration guide. Those four live in `nestTestConfig` rather than in 133 copies.\n */\n\n/**\n * From `vitest/config`, and NOT from `vite`, which also exports a `defineConfig`.\n *\n * They are different functions: `vitest/config`'s knows the `test` key, vite's does not. A config\n * built with vite's would load and quietly drop its entire test block, which is the kind of\n * failure that reads as \"vitest found no tests\" and sends someone hunting through globs.\n *\n * The BUILD role's nest entry point re-exports vite's, correctly for its purpose. Importing that\n * one here would be the exact mistake this comment exists to prevent.\n */\nexport { defineConfig, mergeConfig } from 'vitest/config'\n\n/**\n * From `vite`, because `vitest/config` does not export it. Two of the six already-Vitest configs\n * build their test env with it, and Nest services read their env the same way.\n *\n * Re-exported rather than claimed: the `vite` package belongs to the build role, and a module\n * adopting only this one keeps its own.\n */\nexport { loadEnv } from 'vite'\n\n/** The whole config, as one call. See `nest-test-config.ts` for why each line is there. */\nexport { nestTestConfig, type NestTestOptions } from './nest-test-config.js'\n\n/**\n * Re-exported so a module that needs to compose rather than override can reach them without\n * importing the BUILD role's entry point from a test config, which would pull vite's\n * `defineConfig` into scope beside vitest's and invite the mistake above.\n */\nexport {\n decoratorMetadata,\n type DecoratorMetadataOptions,\n} from '../../build/nest/decorator-metadata.js'\nexport { tsconfigAliases, type Alias } from '../../build/nest/tsconfig-aliases.js'\n\nexport type { ConfigEnv, TestUserConfig, ViteUserConfig } from 'vitest/config'\n","import type { ViteUserConfig } from 'vitest/config'\n\n/**\n * The Vitest config a NEST module gets: the shared one, plus the three things that are not shared.\n *\n * Everything load-bearing lives in `shared-test-config.ts`, because almost everything IS shared.\n * Measured across this repo before splitting, so the line falls where the code does and not where\n * the names suggest:\n *\n * jest-mock-extended front 21 nest 2542 shared\n * msw front 848 nest 517 shared\n * axios front 692 nest 863 shared\n * @prisma/ front 0 nest 1186 NEST ONLY\n *\n * So the nest side is three things: the generated Prisma client's runtime alias, `isolate` (a Nest\n * module registers metadata as an import side effect, so a shared module registry lets one suite\n * see what another registered), and the decorator plugin for the one module that needs it.\n */\nimport { sharedTestConfig, type SharedTestOptions } from '../shared-test-config.js'\n\nexport type { SharedTestOptions as NestTestOptions }\n\nexport function nestTestConfig(options: SharedTestOptions): ViteUserConfig {\n return sharedTestConfig({ ...options, flavour: 'nest' })\n}\n"],"mappings":";;;;;;;;;;;AAuBA,SAAS,cAAc,mBAAmB;AAS1C,SAAS,eAAe;;;ACVjB,SAAS,eAAe,SAA4C;AACzE,SAAO,iBAAiB,EAAE,GAAG,SAAS,SAAS,OAAO,CAAC;AACzD;","names":[]}
1
+ {"version":3,"sources":["../../../../src/roles/test/nest/toolchain.ts","../../../../src/roles/test/nest/nest-test-config.ts"],"sourcesContent":["/**\n * What `@hublo/sentinel/test/nest` gives an adopted module.\n *\n * Its own entry point, like the build ones, so importing it from a config never drags the CLI and\n * its adapters into a test run.\n *\n * It differs from `test/react` in one way that matters, and the difference is not decoration.\n * React modules already had a Vitest config carrying decisions their owners made and justified, so\n * that preset is a pure re-export surface and moves nothing. Nest modules have NO Vitest config:\n * one has to be written, and four of its lines are load-bearing in ways nobody would guess from a\n * migration guide. Those four live in `nestTestConfig` rather than in 133 copies.\n */\n\n/**\n * From `vitest/config`, and NOT from `vite`, which also exports a `defineConfig`.\n *\n * They are different functions: `vitest/config`'s knows the `test` key, vite's does not. A config\n * built with vite's would load and quietly drop its entire test block, which is the kind of\n * failure that reads as \"vitest found no tests\" and sends someone hunting through globs.\n *\n * The BUILD role's nest entry point re-exports vite's, correctly for its purpose. Importing that\n * one here would be the exact mistake this comment exists to prevent.\n */\nexport { defineConfig, mergeConfig } from 'vitest/config'\n\n/**\n * From `vite`, because `vitest/config` does not export it. Two of the six already-Vitest configs\n * build their test env with it, and Nest services read their env the same way.\n *\n * Re-exported rather than claimed: the `vite` package belongs to the build role, and a module\n * adopting only this one keeps its own.\n */\nexport { loadEnv } from 'vite'\n\n/** The whole config, as one call. See `nest-test-config.ts` for why each line is there. */\nexport { nestTestConfig, type NestTestOptions } from './nest-test-config.js'\n\n/**\n * Re-exported so a module that needs to compose rather than override can reach them without\n * importing the BUILD role's entry point from a test config, which would pull vite's\n * `defineConfig` into scope beside vitest's and invite the mistake above.\n */\nexport {\n decoratorMetadata,\n type DecoratorMetadataOptions,\n} from '../../build/nest/decorator-metadata.js'\nexport { tsconfigAliases, type Alias } from '../../build/nest/tsconfig-aliases.js'\n\nexport type { ConfigEnv, TestUserConfig, ViteUserConfig } from 'vitest/config'\n","import type { ViteUserConfig } from 'vitest/config'\n\n/**\n * The Vitest config a NEST module gets: the shared one, plus the three things that are not shared.\n *\n * Everything load-bearing lives in `shared-test-config.ts`, because almost everything IS shared.\n * Measured across this repo before splitting, so the line falls where the code does and not where\n * the names suggest:\n *\n * jest-mock-extended front 21 nest 2542 shared\n * msw front 848 nest 517 shared\n * axios front 692 nest 863 shared\n * @prisma/ front 0 nest 1186 NEST ONLY\n *\n * So the nest side is three things: the generated Prisma client's runtime alias, `isolate` (a Nest\n * module registers metadata as an import side effect, so a shared module registry lets one suite\n * see what another registered), and the decorator plugin for the one module that needs it.\n */\nimport { sharedTestConfig, type SharedTestOptions } from '../shared-test-config.js'\n\nexport type { SharedTestOptions as NestTestOptions }\n\nexport function nestTestConfig(options: SharedTestOptions): ViteUserConfig {\n return sharedTestConfig({ ...options, flavour: 'nest' })\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAS,cAAc,mBAAmB;AAS1C,SAAS,eAAe;;;ACVjB,SAAS,eAAe,SAA4C;AACzE,SAAO,iBAAiB,EAAE,GAAG,SAAS,SAAS,OAAO,CAAC;AACzD;","names":[]}
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  jestExportConditions,
3
3
  sharedTestConfig
4
- } from "../../../chunk-DLGBRLUU.js";
5
- import "../../../chunk-LNFGVGLE.js";
6
- import "../../../chunk-H4HAFJFZ.js";
4
+ } from "../../../chunk-EESVRILJ.js";
5
+ import "../../../chunk-SWWQ7X7B.js";
7
6
  import "../../../chunk-QXFCZON7.js";
8
7
 
9
8
  // src/roles/test/react/toolchain.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/roles/test/react/toolchain.ts","../../../../src/roles/test/react/react-test-config.ts"],"sourcesContent":["/**\n * What `@hublo/sentinel/test/react` gives an adopted module.\n *\n * A re-export surface, not a shape, and that is the measured answer rather than a preference.\n * The six configs already on Vitest fall into two groups: three React apps that converge on one\n * skeleton, and three modules of twelve to twenty lines that share almost nothing. A shared form\n * would serve half of them.\n *\n * More decisive: those configs carry decisions their owners made and justified in comments, a\n * `pool: 'threads'` measured on 1100 test files, an `experimental.fsModuleCache` measured against\n * transform and import time. Moving them is not a tooling migration, so the role moves the\n * imports and leaves every line of judgement where it is.\n *\n * Its own entry point, like the build ones, so importing it from a config never drags the CLI\n * and its adapters into a test run.\n */\n\n/**\n * From `vitest/config`, and NOT from `vite`, which also exports a `defineConfig`.\n *\n * They are different functions: measured, `vitest/config`'s `defineConfig` is not the same object\n * as vite's, and only it knows the `test` key. A config built with vite's would load and quietly\n * drop its entire test block. `mergeConfig` IS the same function in both, so its source does not\n * matter and it is taken from here for consistency.\n */\nexport { defineConfig, mergeConfig } from 'vitest/config'\n\n/**\n * From `vite`, because `vitest/config` does not export it. Measured, not assumed.\n *\n * Two of the six configs build their test env with it. Re-exported rather than claimed: the\n * `vite` package belongs to the build role, and a module adopting only this one keeps its own.\n */\nexport { loadEnv } from 'vite'\n\n/**\n * The names `vitest/config` actually exports, checked against its own declarations rather than\n * guessed: vite's `UserConfig` is re-exported there AS `ViteUserConfig`, and the test-side one is\n * `TestUserConfig`. Importing `UserConfig` from it compiles nowhere.\n */\nexport type { ConfigEnv, TestUserConfig, ViteUserConfig } from 'vitest/config'\n\n/**\n * The one thing this surface ADDS rather than re-exports, and only because a module cannot write\n * it for itself: Vite appends its own export conditions back over anything a config declares, so\n * restoring jest's resolution takes a plugin. Its own file carries the measurement.\n */\nexport { jestExportConditions } from './jest-export-conditions.js'\n\n/**\n * The config a MIGRATED React module gets, written by `--init --test`.\n *\n * Added on 23/09, because until then a front module being migrated received `nestTestConfig` while\n * the report announced `preset=react`. The re-export surface above is for the six modules that\n * already had a Vitest config and keep their own decisions; this is for the ones that had none and\n * need one written.\n */\nexport { reactTestConfig, type ReactTestOptions } from './react-test-config.js'\n","import type { ViteUserConfig } from 'vitest/config'\n\n/**\n * The Vitest config a REACT module gets: the shared one, without the Nest-only parts.\n *\n * ⚠️ This exists because a front module was being migrated with `nestTestConfig`, and the report\n * then said `preset=react` while the file it had just written imported `test/nest`. A tool that\n * contradicts itself in the same run is worse than one that is simply incomplete.\n *\n * What it does NOT carry, each measured rather than assumed: the `@prisma/*` runtime alias (1186\n * files mention it under nest, ZERO under front) and `isolate` (Nest registers metadata as an\n * import side effect; React has no such catalog, and isolation is not free).\n *\n * What it DOES carry is everything else, which is most of it: the workspace tsconfig path aliases,\n * jest's export conditions, the four test-file extensions, the concurrency this repo runs with, and\n * the msw, axios and jest-mock-extended aliases, all three of which the front uses heavily.\n *\n * Deliberately NOT here: a React plugin. Vite's own transform handles JSX in a test run, and the\n * front suites pass without one, so adding it would be paying for something nothing asked for.\n */\nimport { sharedTestConfig, type SharedTestOptions } from '../shared-test-config.js'\n\nexport type { SharedTestOptions as ReactTestOptions }\n\nexport function reactTestConfig(options: SharedTestOptions): ViteUserConfig {\n return sharedTestConfig({ ...options, flavour: 'react' })\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAS,cAAc,mBAAmB;AAQ1C,SAAS,eAAe;;;ACTjB,SAAS,gBAAgB,SAA4C;AAC1E,SAAO,iBAAiB,EAAE,GAAG,SAAS,SAAS,QAAQ,CAAC;AAC1D;","names":[]}
1
+ {"version":3,"sources":["../../../../src/roles/test/react/toolchain.ts","../../../../src/roles/test/react/react-test-config.ts"],"sourcesContent":["/**\n * What `@hublo/sentinel/test/react` gives an adopted module.\n *\n * A re-export surface, not a shape, and that is the measured answer rather than a preference.\n * The six configs already on Vitest fall into two groups: three React apps that converge on one\n * skeleton, and three modules of twelve to twenty lines that share almost nothing. A shared form\n * would serve half of them.\n *\n * More decisive: those configs carry decisions their owners made and justified in comments, a\n * `pool: 'threads'` measured on 1100 test files, an `experimental.fsModuleCache` measured against\n * transform and import time. Moving them is not a tooling migration, so the role moves the\n * imports and leaves every line of judgement where it is.\n *\n * Its own entry point, like the build ones, so importing it from a config never drags the CLI\n * and its adapters into a test run.\n */\n\n/**\n * From `vitest/config`, and NOT from `vite`, which also exports a `defineConfig`.\n *\n * They are different functions: measured, `vitest/config`'s `defineConfig` is not the same object\n * as vite's, and only it knows the `test` key. A config built with vite's would load and quietly\n * drop its entire test block. `mergeConfig` IS the same function in both, so its source does not\n * matter and it is taken from here for consistency.\n */\nexport { defineConfig, mergeConfig } from 'vitest/config'\n\n/**\n * From `vite`, because `vitest/config` does not export it. Measured, not assumed.\n *\n * Two of the six configs build their test env with it. Re-exported rather than claimed: the\n * `vite` package belongs to the build role, and a module adopting only this one keeps its own.\n */\nexport { loadEnv } from 'vite'\n\n/**\n * The names `vitest/config` actually exports, checked against its own declarations rather than\n * guessed: vite's `UserConfig` is re-exported there AS `ViteUserConfig`, and the test-side one is\n * `TestUserConfig`. Importing `UserConfig` from it compiles nowhere.\n */\nexport type { ConfigEnv, TestUserConfig, ViteUserConfig } from 'vitest/config'\n\n/**\n * The one thing this surface ADDS rather than re-exports, and only because a module cannot write\n * it for itself: Vite appends its own export conditions back over anything a config declares, so\n * restoring jest's resolution takes a plugin. Its own file carries the measurement.\n */\nexport { jestExportConditions } from './jest-export-conditions.js'\n\n/**\n * The config a MIGRATED React module gets, written by `--init --test`.\n *\n * Added on 23/09, because until then a front module being migrated received `nestTestConfig` while\n * the report announced `preset=react`. The re-export surface above is for the six modules that\n * already had a Vitest config and keep their own decisions; this is for the ones that had none and\n * need one written.\n */\nexport { reactTestConfig, type ReactTestOptions } from './react-test-config.js'\n","import type { ViteUserConfig } from 'vitest/config'\n\n/**\n * The Vitest config a REACT module gets: the shared one, without the Nest-only parts.\n *\n * ⚠️ This exists because a front module was being migrated with `nestTestConfig`, and the report\n * then said `preset=react` while the file it had just written imported `test/nest`. A tool that\n * contradicts itself in the same run is worse than one that is simply incomplete.\n *\n * What it does NOT carry, each measured rather than assumed: the `@prisma/*` runtime alias (1186\n * files mention it under nest, ZERO under front) and `isolate` (Nest registers metadata as an\n * import side effect; React has no such catalog, and isolation is not free).\n *\n * What it DOES carry is everything else, which is most of it: the workspace tsconfig path aliases,\n * jest's export conditions, the four test-file extensions, the concurrency this repo runs with, and\n * the msw, axios and jest-mock-extended aliases, all three of which the front uses heavily.\n *\n * Deliberately NOT here: a React plugin. Vite's own transform handles JSX in a test run, and the\n * front suites pass without one, so adding it would be paying for something nothing asked for.\n */\nimport { sharedTestConfig, type SharedTestOptions } from '../shared-test-config.js'\n\nexport type { SharedTestOptions as ReactTestOptions }\n\nexport function reactTestConfig(options: SharedTestOptions): ViteUserConfig {\n return sharedTestConfig({ ...options, flavour: 'react' })\n}\n"],"mappings":";;;;;;;;AAyBA,SAAS,cAAc,mBAAmB;AAQ1C,SAAS,eAAe;;;ACTjB,SAAS,gBAAgB,SAA4C;AAC1E,SAAO,iBAAiB,EAAE,GAAG,SAAS,SAAS,QAAQ,CAAC;AAC1D;","names":[]}
@@ -7,9 +7,9 @@ import {
7
7
  } from "../../../chunk-NUOQXAYR.js";
8
8
  import {
9
9
  installWorkspaceSetup
10
- } from "../../../chunk-4YQXLPJ5.js";
10
+ } from "../../../chunk-J2RMARWP.js";
11
11
  import "../../../chunk-ELZHIN6E.js";
12
- import "../../../chunk-ZNANJEMK.js";
12
+ import "../../../chunk-XTBHIKFG.js";
13
13
 
14
14
  // src/roles/test/setup/jest-parity.ts
15
15
  import { expect, vi } from "vitest";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  pinWorkspaceTimezone
3
- } from "../../../chunk-4YQXLPJ5.js";
3
+ } from "../../../chunk-J2RMARWP.js";
4
4
  import "../../../chunk-ELZHIN6E.js";
5
- import "../../../chunk-ZNANJEMK.js";
5
+ import "../../../chunk-XTBHIKFG.js";
6
6
 
7
7
  // src/roles/test/setup/workspace-entry.ts
8
8
  await pinWorkspaceTimezone();
@@ -7,7 +7,7 @@ interface SharedTestOptions {
7
7
  flavour?: TestFlavour;
8
8
  /** The module's own directory: where its specs live and what its config is relative to. */
9
9
  root: string;
10
- /** The workspace root: where `tsconfig.base.json` is, the aliases' fallback for a module without `paths`. */
10
+ /** The workspace root, which is where `tsconfig.base.json` and its path aliases are. */
11
11
  workspaceRoot: string;
12
12
  /**
13
13
  * Lower decorators with TypeScript before oxc sees them, for a module that needs it.
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  sharedTestConfig
3
- } from "../../chunk-DLGBRLUU.js";
4
- import "../../chunk-LNFGVGLE.js";
5
- import "../../chunk-H4HAFJFZ.js";
3
+ } from "../../chunk-EESVRILJ.js";
4
+ import "../../chunk-SWWQ7X7B.js";
6
5
  import "../../chunk-QXFCZON7.js";
7
6
  export {
8
7
  sharedTestConfig
@@ -6,9 +6,6 @@
6
6
  "forceConsistentCasingInFileNames": true,
7
7
  "esModuleInterop": true,
8
8
  "skipLibCheck": true,
9
- "verbatimModuleSyntax": true,
10
- "resolveJsonModule": true,
11
- "skipDefaultLibCheck": true,
12
9
  "module": "esnext",
13
10
  "moduleResolution": "bundler",
14
11
  "types": [
@@ -17,12 +14,6 @@
17
14
  "experimentalDecorators": true,
18
15
  "emitDecoratorMetadata": true,
19
16
  "declaration": true,
20
- "sourceMap": true,
21
- "importHelpers": true,
22
- "target": "es2021",
23
- "lib": [
24
- "es2023",
25
- "dom"
26
- ]
17
+ "sourceMap": true
27
18
  }
28
19
  }
@@ -6,21 +6,11 @@
6
6
  "forceConsistentCasingInFileNames": true,
7
7
  "esModuleInterop": true,
8
8
  "skipLibCheck": true,
9
- "verbatimModuleSyntax": true,
10
- "resolveJsonModule": true,
11
- "skipDefaultLibCheck": true,
12
9
  "module": "esnext",
13
10
  "moduleResolution": "bundler",
14
11
  "types": [
15
12
  "node"
16
13
  ],
17
- "declaration": true,
18
- "importHelpers": true,
19
- "target": "es2021",
20
- "lib": [
21
- "es2023",
22
- "dom"
23
- ],
24
- "sourceMap": true
14
+ "declaration": true
25
15
  }
26
16
  }
@@ -6,9 +6,6 @@
6
6
  "forceConsistentCasingInFileNames": true,
7
7
  "esModuleInterop": true,
8
8
  "skipLibCheck": true,
9
- "verbatimModuleSyntax": true,
10
- "resolveJsonModule": true,
11
- "skipDefaultLibCheck": true,
12
9
  "target": "ES2023",
13
10
  "lib": [
14
11
  "ES2023",
@@ -25,27 +25,12 @@ interface Alias {
25
25
  find: RegExp;
26
26
  replacement: string;
27
27
  }
28
- /** Read the module's own chain rather than one workspace file. */
29
- interface ModuleAliasSource {
30
- /** The module's directory, where its tsconfig lives. */
31
- moduleRoot: string;
32
- /** Its tsconfig names to try, most specific first, relative to `moduleRoot`. */
33
- candidates?: readonly (string | undefined)[];
34
- }
35
28
  /**
36
- * The aliases a module resolves through.
29
+ * Read the mappings from the workspace's base tsconfig.
37
30
  *
38
31
  * Longest pattern first, because Vite takes the first alias that matches and the mappings
39
32
  * overlap by design: `@front/theme/node` must not be swallowed by `@front/theme`.
40
- *
41
- * Two ways to call it, and the first is kept for what it always did:
42
- * - `tsconfigAliases(workspaceRoot)` or with a file name: that one workspace file, read on its
43
- * own, its targets relative to `workspaceRoot`. Unchanged, because it is exported from the
44
- * `build/nest` and `test/nest` toolchains and a module's config may call it.
45
- * - `tsconfigAliases(workspaceRoot, { moduleRoot })`: the module's own chain, the way tsc reads
46
- * it, falling back to the workspace base when the chain declares no `paths`. See
47
- * `shared/tsconfig-paths.ts` for the rules and why the fallback is a transition.
48
33
  */
49
- declare function tsconfigAliases(workspaceRoot: string, source?: string | ModuleAliasSource): Alias[];
34
+ declare const tsconfigAliases: (workspaceRoot: string, file?: string) => Alias[];
50
35
 
51
36
  export { type Alias as A, type DecoratorMetadataOptions as D, decoratorMetadata as d, tsconfigAliases as t };
@@ -7,11 +7,9 @@ import {
7
7
  readTestAdoption,
8
8
  resolveVitest,
9
9
  suiteOf
10
- } from "./chunk-Z3JI7ZWX.js";
11
- import "./chunk-4UUL4SEW.js";
12
- import "./chunk-ZNANJEMK.js";
10
+ } from "./chunk-UVXXEAHU.js";
11
+ import "./chunk-XTBHIKFG.js";
13
12
  import "./chunk-O7REVMOC.js";
14
- import "./chunk-H4HAFJFZ.js";
15
13
  import "./chunk-QXFCZON7.js";
16
14
 
17
15
  // src/roles/test/validate.ts
@@ -466,13 +466,6 @@ export default nestService({
466
466
  Or drop to the pieces, which the same entry point exports individually: `decoratorMetadata`,
467
467
  `nodeManifest`, `tsconfigAliases`, plus Vite's `defineConfig`, `loadEnv` and `mergeConfig`.
468
468
 
469
- **Which aliases a service is bundled with.** `nestService` reads the module's own tsconfig chain
470
- (`tsconfig`, then `tsconfig.app.json`, then `tsconfig.json`), the way tsc reads it, so a service
471
- that declares its own `paths` is bundled with the aliases it type-checks with. When the chain
472
- declares no `paths`, it falls back to `tsconfig.base.json`, which is what it always read: a service
473
- that still extends the base sees no change. The fallback is a transition, not the end state.
474
- `tsconfigAliases(workspaceRoot)` called on its own still reads that one workspace file. One difference with tsc 7 is deliberate: a `baseUrl` in the chain is honoured, as ts-jest, Vite and TypeScript 5 and 6 read it, so a chain whose `baseUrl` is not the directory of the file declaring `paths` resolves differently at runtime than in the typecheck. None exists in the monorepo today.
475
-
476
469
  # Both families
477
470
 
478
471
  ## Svelte modules, and what they need first