|
| 1 | +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. |
| 2 | +// |
| 3 | +// Import this at module top in a test file whose cases make a served `view` |
| 4 | +// read or an object publish, so the file pays the first load of the |
| 5 | +// `@objectstack/lint` package ROOT during collection, never inside a clocked |
| 6 | +// case. Test-only: no product module imports it. |
| 7 | +// |
| 8 | +// The protocol loads the lint root lazily, on first use, in two places: a |
| 9 | +// served `view` read decorates its `_diagnostics` with the form-layout |
| 10 | +// warnings (`loadFormLayoutLint`, metadata-diagnostics.ts), and an object |
| 11 | +// publish runs its build probes (`runBuildProbes`, build-probes.ts). The lazy |
| 12 | +// shape is product design: the kernel boot path never reaches the root. |
| 13 | +// Under vitest the first such load in a file is a cold transform of the lint |
| 14 | +// module graph, paid inside whichever case gets there first. A module-top |
| 15 | +// import is paid during collection, which neither `testTimeout` nor |
| 16 | +// `hookTimeout` clocks, and the protocol's later `import()` gets the same |
| 17 | +// module instance back (AGENTS.md § Build & Test, the clocked-window rule). |
| 18 | +// |
| 19 | +// Here the root resolves to `lint/dist/index.js`: this package's row in |
| 20 | +// `check:test-source-alias` lists `@objectstack/lint` as still read from |
| 21 | +// `dist/`. |
| 22 | +// |
| 23 | +// Who imports it: every test file in which a traced run of the whole suite |
| 24 | +// saw that first load inside a case. A new file whose cases reach a view read |
| 25 | +// or an object publish imports it too. It is not a `setupFiles` entry, |
| 26 | +// because then every test file in the package pays the load, including the |
| 27 | +// many that never reach it: measured, that added about 200 s of worker time |
| 28 | +// and about a third to the suite's wall time. |
| 29 | +import '@objectstack/lint'; |
0 commit comments