@happyvertical/smrt-vitest 0.57.46 → 0.57.48

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.
package/dist/index.d.ts CHANGED
@@ -6,7 +6,9 @@
6
6
  * external package classes aren't registered in the test manifest.
7
7
  *
8
8
  * Uses ManifestManager for unified manifest loading, which properly handles
9
- * the manifest priority order: .smrt/manifest.json (test) -> dist/manifest.json (production)
9
+ * the manifest priority order: this run's test manifest snapshot
10
+ * (`.smrt/test-runs/<run>/manifest.json`, #4128) -> .smrt/manifest.json ->
11
+ * dist/manifest.json
10
12
  *
11
13
  * @example
12
14
  * ```typescript
@@ -82,6 +84,35 @@ export declare function normalizeRootKey(root: string): string;
82
84
  * about the exact payload shape without duplicating the parse/merge logic.
83
85
  */
84
86
  export declare function setManifestRegistrationOptionsForRoot(root: string, options: SmrtVitestPluginOptions): void;
87
+ /**
88
+ * Environment variable carrying the active test manifest path per project
89
+ * root. Mirrors `SMRT_TEST_MANIFEST_PATHS_ENV_KEY` in
90
+ * `@happyvertical/smrt-core/manifest` (`test-artifacts.ts`), which owns the
91
+ * read side; kept as a literal here so {@link smrtVitestPlugin}'s `config()`
92
+ * hook can publish it synchronously, before Vitest forks any pool worker
93
+ * (see {@link SMRT_VITEST_SETUP_OPTIONS_ENV_KEY}). Parity with core is
94
+ * asserted in `src/__tests__/test-run-manifest-isolation.test.ts`.
95
+ */
96
+ export declare const SMRT_TEST_MANIFEST_PATHS_ENV_KEY = "__SMRT_TEST_MANIFEST_PATHS__";
97
+ /**
98
+ * Directory, relative to a project root, holding one subdirectory per test
99
+ * run's manifest snapshot (#4128).
100
+ */
101
+ export declare const SMRT_TEST_RUNS_DIR = ".smrt/test-runs";
102
+ /**
103
+ * The manifest snapshot path owned by this process's test run for `root`
104
+ * (#4128): `<root>/.smrt/test-runs/<pid>-<time>-<random>/manifest.json`.
105
+ *
106
+ * Test generation scans test-inclusive sources, so it must not share a path
107
+ * with production generation: `.smrt/manifest.json` is rewritten by every
108
+ * `smrtPlugin()` build (and by a typecheck whose Turbo graph rebuilds the
109
+ * package), which used to replace the test manifest while forked test
110
+ * workers were still reading it. Each run instead owns a directory nothing
111
+ * else writes; it is stable for the life of this process, so every plugin
112
+ * instance and config restart for the same root shares it, and removed when
113
+ * the process exits.
114
+ */
115
+ export declare function resolveTestRunManifestPath(root: string): string;
85
116
  /**
86
117
  * Configuration options for {@link smrtVitestPlugin} and
87
118
  * {@link setupSmrtManifests}.
@@ -190,7 +221,49 @@ export interface WorkspaceViteAliasOptions {
190
221
  */
191
222
  filter?: (entry: ViteAliasEntry) => boolean;
192
223
  }
224
+ /**
225
+ * Every exact (non-pattern) JavaScript subpath a workspace package exports,
226
+ * with the source file it is built from, or `null` when no source file can be
227
+ * derived. Read from the package's own `exports` map, so a newly exported
228
+ * subpath is covered without editing this file (#2954).
229
+ */
230
+ export declare function getWorkspaceExportSources(packageRoot: string): Array<{
231
+ subpath: string;
232
+ target: string;
233
+ source: string | null;
234
+ }>;
235
+ /**
236
+ * The concrete runtime target (`./dist/...`) a workspace package's exports
237
+ * map gives `subpath`, exact or pattern, or `null` when it exports none.
238
+ */
239
+ export declare function workspaceExportTarget(packageRoot: string, subpath: string): string | null;
240
+ /**
241
+ * Source file for the concrete `subpath` a consumer imports from a workspace
242
+ * package — exact or pattern export (`"./utils/*": "./dist/utils/*"`) — for
243
+ * the per-import resolution in {@link smrtVitestPlugin} (#2954). Exact
244
+ * subpaths are normally aliased statically; pattern subpaths can only be
245
+ * mapped per import. A JavaScript target maps like an exact export; another
246
+ * asset (CSS, JSON) maps to the same relative path under `src/` or
247
+ * `src/lib/`. Returns `null` when nothing is exported there or no source
248
+ * file exists.
249
+ */
250
+ export declare function resolveWorkspaceExportSource(packageRoot: string, subpath: string): string | null;
193
251
  export declare function getWorkspaceViteAliases(root?: string, options?: WorkspaceViteAliasOptions): WorkspaceViteAlias[];
252
+ /**
253
+ * Detects a workspace package specifier resolved to a sibling's BUILT output
254
+ * (#2954).
255
+ *
256
+ * Every exported subpath of a workspace package is aliased to source (see
257
+ * {@link getWorkspaceViteAliases}), so a module loaded from another
258
+ * package's `dist/` means a specifier escaped the aliases: the test would
259
+ * run the sibling's last build — stale, or missing in a fresh worktree — and
260
+ * could pass against code that no longer exists. Returns the failure message
261
+ * for such an id, or `null`. Exempt: the package under test (its own build
262
+ * output), and packages the consumer deliberately resolves to built entries,
263
+ * by dropping their generated aliases through `aliasFilter` or by aliasing
264
+ * one of their specifiers to a `dist/` file itself.
265
+ */
266
+ export declare function createWorkspaceDistGuard(root: string, exemptPackages?: ReadonlySet<string>): (id: string) => string | null;
194
267
  /**
195
268
  * Create the SMRT Vitest plugin
196
269
  *
@@ -278,6 +351,6 @@ export declare function smrtVitestPlugin(options?: SmrtVitestPluginOptions): Plu
278
351
  */
279
352
  export declare function setupSmrtManifests(options?: SmrtVitestPluginOptions): Promise<void>;
280
353
  export default smrtVitestPlugin;
281
- export { createIsolatedTestDb, createIsolatedTestDbFromManifest, createTestDb, getAdapterDisplayName, getInMemoryDbConfig, getTestAdapter, getTestDbConfig, type IsolatedTestDbOptions, type IsolatedTestDbResult, isPostgresAvailable, type ManifestTestDbOptions, type TestDbAdapter, type TestDbConfig, } from './test-db.js';
354
+ export { createIsolatedTestDb, createIsolatedTestDbFromManifest, createTestDb, getAdapterDisplayName, getInMemoryDbConfig, getTestAdapter, getTestDbConfig, getTestManifestPath, type IsolatedTestDbOptions, type IsolatedTestDbResult, isPostgresAvailable, type ManifestTestDbOptions, type TestDbAdapter, type TestDbConfig, } from './test-db.js';
282
355
  export type { TransactionHandle } from './types.js';
283
356
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAaH,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5D;;;;;;;;;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