@untestutils/core 0.5.1 → 0.5.3
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/drivers/cli-framework.d.mts +15 -1
- package/dist/drivers/cli-framework.d.ts +16 -1
- package/dist/drivers/cli-framework.d.ts.map +1 -1
- package/dist/drivers/cli-framework.mjs +23 -3
- package/dist/drivers/command.d.mts +1 -1
- package/dist/drivers/command.d.ts +1 -1
- package/dist/drivers/command.d.ts.map +1 -1
- package/dist/drivers/command.mjs +4 -1
- package/dist/drivers/config-override.d.mts +61 -0
- package/dist/drivers/config-override.d.ts +62 -0
- package/dist/drivers/config-override.d.ts.map +1 -0
- package/dist/drivers/config-override.mjs +149 -0
- package/dist/drivers/define-driver.d.mts +5 -1
- package/dist/drivers/define-driver.d.ts +5 -1
- package/dist/drivers/define-driver.d.ts.map +1 -1
- package/dist/drivers/define-driver.mjs +26 -1
- package/dist/drivers/host.d.mts +1 -1
- package/dist/drivers/host.d.ts +1 -1
- package/dist/drivers/host.d.ts.map +1 -1
- package/dist/drivers/host.mjs +3 -1
- package/dist/drivers/index.d.mts +3 -0
- package/dist/drivers/index.d.ts +3 -0
- package/dist/drivers/index.d.ts.map +1 -1
- package/dist/drivers/index.mjs +2 -0
- package/dist/drivers/matrix.d.mts +34 -0
- package/dist/drivers/matrix.d.ts +35 -0
- package/dist/drivers/matrix.d.ts.map +1 -0
- package/dist/drivers/matrix.mjs +76 -0
- package/dist/drivers/node-entry.d.mts +1 -1
- package/dist/drivers/node-entry.d.ts +1 -1
- package/dist/drivers/node-entry.d.ts.map +1 -1
- package/dist/drivers/node-entry.mjs +4 -1
- package/dist/drivers/static-dir.d.mts +1 -1
- package/dist/drivers/static-dir.d.ts +1 -1
- package/dist/drivers/static-dir.d.ts.map +1 -1
- package/dist/drivers/static-dir.mjs +3 -1
- package/dist/harness.d.mts +15 -1
- package/dist/harness.d.ts +15 -1
- package/dist/harness.d.ts.map +1 -1
- package/dist/harness.mjs +31 -3
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/ports.d.ts.map +1 -1
- package/dist/session.d.mts +12 -0
- package/dist/session.d.ts +13 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.mjs +19 -0
- package/dist/types.d.mts +3 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Recipe, PrepareCtx, StartCtx, SharePolicy } from "../types.mjs";
|
|
2
2
|
export interface ResolveBinOptions {
|
|
3
3
|
roots: string[];
|
|
4
4
|
packageJsonIds?: string[];
|
|
@@ -8,6 +8,9 @@ export interface ResolveBinOptions {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Resolve a CLI entry from the app under test (or cwd).
|
|
11
|
+
*
|
|
12
|
+
* Prefer filesystem paths under `node_modules/` first — packages with tight
|
|
13
|
+
* `exports` (e.g. vinxi) reject `require.resolve('pkg/bin/…')` / `pkg/package.json`.
|
|
11
14
|
*/
|
|
12
15
|
export declare function resolveBin(opts: ResolveBinOptions): string;
|
|
13
16
|
export type SpawnSpec = {
|
|
@@ -25,6 +28,8 @@ export interface CliFrameworkRecipeOptions {
|
|
|
25
28
|
hashInputs?: string[];
|
|
26
29
|
readyPath?: string;
|
|
27
30
|
readyTimeoutMs?: number;
|
|
31
|
+
/** See {@link FrameworkBaseOptions.workspaceDeps}. */
|
|
32
|
+
workspaceDeps?: boolean | "auto";
|
|
28
33
|
prepare?: (ctx: PrepareCtx & {
|
|
29
34
|
root: string;
|
|
30
35
|
}) => Promise<SpawnSpec | void> | SpawnSpec | void;
|
|
@@ -34,6 +39,8 @@ export interface CliFrameworkRecipeOptions {
|
|
|
34
39
|
verifyAfterPrepare?: (ctx: PrepareCtx & {
|
|
35
40
|
root: string;
|
|
36
41
|
}) => Promise<void>;
|
|
42
|
+
/** Called after the managed process stops (e.g. restore ephemeral next.config). */
|
|
43
|
+
afterStop?: () => Promise<void> | void;
|
|
37
44
|
}
|
|
38
45
|
export type FrameworkBaseOptions = {
|
|
39
46
|
id?: string;
|
|
@@ -42,6 +49,13 @@ export type FrameworkBaseOptions = {
|
|
|
42
49
|
hashInputs?: string[];
|
|
43
50
|
readyPath?: string;
|
|
44
51
|
readyTimeoutMs?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Include monorepo package src dirs in prepare hash.
|
|
54
|
+
* - true — always
|
|
55
|
+
* - auto — when a pnpm workspace is detected above root
|
|
56
|
+
* - omit / false — off (default for CLI adapters)
|
|
57
|
+
*/
|
|
58
|
+
workspaceDeps?: boolean | "auto";
|
|
45
59
|
};
|
|
46
60
|
export declare function frameworkRoots(root: string): string[];
|
|
47
61
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { runCommand
|
|
1
|
+
import { runCommand } from '../process';
|
|
2
|
+
import type { Recipe, PrepareCtx, StartCtx, SharePolicy } from '../types';
|
|
2
3
|
export interface ResolveBinOptions {
|
|
3
4
|
roots: string[];
|
|
4
5
|
packageJsonIds?: string[];
|
|
@@ -8,6 +9,9 @@ export interface ResolveBinOptions {
|
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Resolve a CLI entry from the app under test (or cwd).
|
|
12
|
+
*
|
|
13
|
+
* Prefer filesystem paths under `node_modules/` first — packages with tight
|
|
14
|
+
* `exports` (e.g. vinxi) reject `require.resolve('pkg/bin/…')` / `pkg/package.json`.
|
|
11
15
|
*/
|
|
12
16
|
export declare function resolveBin(opts: ResolveBinOptions): string;
|
|
13
17
|
export type SpawnSpec = {
|
|
@@ -25,6 +29,8 @@ export interface CliFrameworkRecipeOptions {
|
|
|
25
29
|
hashInputs?: string[];
|
|
26
30
|
readyPath?: string;
|
|
27
31
|
readyTimeoutMs?: number;
|
|
32
|
+
/** See {@link FrameworkBaseOptions.workspaceDeps}. */
|
|
33
|
+
workspaceDeps?: boolean | 'auto';
|
|
28
34
|
prepare?: (ctx: PrepareCtx & {
|
|
29
35
|
root: string;
|
|
30
36
|
}) => Promise<SpawnSpec | void> | SpawnSpec | void;
|
|
@@ -34,6 +40,8 @@ export interface CliFrameworkRecipeOptions {
|
|
|
34
40
|
verifyAfterPrepare?: (ctx: PrepareCtx & {
|
|
35
41
|
root: string;
|
|
36
42
|
}) => Promise<void>;
|
|
43
|
+
/** Called after the managed process stops (e.g. restore ephemeral next.config). */
|
|
44
|
+
afterStop?: () => Promise<void> | void;
|
|
37
45
|
}
|
|
38
46
|
export type FrameworkBaseOptions = {
|
|
39
47
|
id?: string;
|
|
@@ -42,6 +50,13 @@ export type FrameworkBaseOptions = {
|
|
|
42
50
|
hashInputs?: string[];
|
|
43
51
|
readyPath?: string;
|
|
44
52
|
readyTimeoutMs?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Include monorepo package src dirs in prepare hash.
|
|
55
|
+
* - true — always
|
|
56
|
+
* - auto — when a pnpm workspace is detected above root
|
|
57
|
+
* - omit / false — off (default for CLI adapters)
|
|
58
|
+
*/
|
|
59
|
+
workspaceDeps?: boolean | 'auto';
|
|
45
60
|
};
|
|
46
61
|
export declare function frameworkRoots(root: string): string[];
|
|
47
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-framework.d.ts","sourceRoot":"","sources":["../../src/drivers/cli-framework.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-framework.d.ts","sourceRoot":"","sources":["../../src/drivers/cli-framework.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,UAAU,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,CAAC,E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AC,IAAI,CAAC,CAAC;IAC3E,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAClC,CAAC;AAEF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAErD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1C,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,GAAG,MAAM,CA2E1E;AAED,gBAAgB;AAChB,eAAO,MAAM,aAAa,EAAE;IAC1B,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,aAAa,EAAE,OAAO,aAAa,CAAC;CACO,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve } from "pathe";
|
|
4
|
-
import { defineRecipe
|
|
4
|
+
import { defineRecipe } from "../recipes.mjs";
|
|
5
|
+
import { loopbackUrl } from "../paths.mjs";
|
|
6
|
+
import { waitForHttpReady } from "../ready.mjs";
|
|
7
|
+
import { spawnManaged, runCommand } from "../process.mjs";
|
|
8
|
+
import { appendWorkspaceHashInputs } from "./matrix.mjs";
|
|
5
9
|
|
|
6
10
|
export function resolveBin(opts) {
|
|
7
11
|
const seen = new Set();
|
|
@@ -11,6 +15,18 @@ export function resolveBin(opts) {
|
|
|
11
15
|
seen.add(key);
|
|
12
16
|
const pkgPath = join(key, "package.json");
|
|
13
17
|
if (!existsSync(pkgPath)) continue;
|
|
18
|
+
for (const id of opts.directIds ?? []) {
|
|
19
|
+
const fsPath = join(key, "node_modules", id);
|
|
20
|
+
if (existsSync(fsPath)) return fsPath;
|
|
21
|
+
}
|
|
22
|
+
for (const pkgId of opts.packageJsonIds ?? []) {
|
|
23
|
+
const pkgName = pkgId.replace(/\/package\.json$/, "");
|
|
24
|
+
const pkgRoot = join(key, "node_modules", pkgName);
|
|
25
|
+
for (const rel of opts.binRelative ?? []) {
|
|
26
|
+
const bin = join(pkgRoot, rel);
|
|
27
|
+
if (existsSync(bin)) return bin;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
14
30
|
let req;
|
|
15
31
|
try {
|
|
16
32
|
req = createRequire(pkgPath);
|
|
@@ -60,10 +76,11 @@ export function cliFrameworkRecipe(opts) {
|
|
|
60
76
|
id: opts.id,
|
|
61
77
|
share: opts.share ?? (opts.prepare ? "always" : "never"),
|
|
62
78
|
hashInputs: async () => {
|
|
63
|
-
|
|
79
|
+
let inputs = [...opts.hashInputs ?? [root]];
|
|
64
80
|
if (opts.env && Object.keys(opts.env).length) {
|
|
65
81
|
inputs.push(`env:${JSON.stringify(opts.env)}`);
|
|
66
82
|
}
|
|
83
|
+
inputs = await appendWorkspaceHashInputs(inputs, root, opts.workspaceDeps);
|
|
67
84
|
return inputs;
|
|
68
85
|
},
|
|
69
86
|
ready: async () => {},
|
|
@@ -122,7 +139,10 @@ export function cliFrameworkRecipe(opts) {
|
|
|
122
139
|
kind: "url+dir",
|
|
123
140
|
url,
|
|
124
141
|
dir: ctx.outDir,
|
|
125
|
-
stop:
|
|
142
|
+
stop: async () => {
|
|
143
|
+
await managed.stop();
|
|
144
|
+
if (opts.afterStop) await opts.afterStop();
|
|
145
|
+
},
|
|
126
146
|
pid: managed.pid
|
|
127
147
|
};
|
|
128
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/drivers/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/drivers/command.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CA6DpD;AAED,eAAe,OAAO,CAAC"}
|
package/dist/drivers/command.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { resolve } from "pathe";
|
|
2
|
-
import { defineRecipe
|
|
2
|
+
import { defineRecipe } from "../recipes.mjs";
|
|
3
|
+
import { loopbackUrl } from "../paths.mjs";
|
|
4
|
+
import { waitForHttpReady } from "../ready.mjs";
|
|
5
|
+
import { spawnManaged } from "../process.mjs";
|
|
3
6
|
export function command(opts) {
|
|
4
7
|
const cwd = opts.cwd ? resolve(opts.cwd) : undefined;
|
|
5
8
|
const recipe = defineRecipe({
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write `contents` to `path` (backing up any existing file). Returns `restore`
|
|
3
|
+
* that puts the previous contents back (or deletes the path if it was new).
|
|
4
|
+
* Use when the file must stay for a long-running process; prefer
|
|
5
|
+
* {@link withEphemeralFile} when the whole critical section is one async fn.
|
|
6
|
+
*/
|
|
7
|
+
export declare function installEphemeralFile(path: string, contents: string | Buffer): Promise<() => Promise<void>>;
|
|
8
|
+
/**
|
|
9
|
+
* Write `contents` to `path`, run `fn`, then restore the previous file (or delete
|
|
10
|
+
* if it did not exist). Safe for tools that only load config from a fixed name
|
|
11
|
+
* (e.g. Next.js `next.config.*`).
|
|
12
|
+
*/
|
|
13
|
+
export declare function withEphemeralFile<T>(path: string, contents: string | Buffer, fn: () => Promise<T>): Promise<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Replace `configPath` with an ESM module that merges the previous file + `overrides`,
|
|
16
|
+
* then restore. The previous file is copied to a sibling with a real extension so
|
|
17
|
+
* bundlers (vinxi/esbuild, Next) can import it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withMergedConfigOverride<T>(configPath: string, overrides: Record<string, unknown>, fn: () => Promise<T>): Promise<T>;
|
|
20
|
+
/** Like {@link withMergedConfigOverride} but restore is deferred (long-running processes). */
|
|
21
|
+
export declare function installMergedConfigOverride(configPath: string, overrides: Record<string, unknown>): Promise<() => Promise<void>>;
|
|
22
|
+
/** Write a file (creating parents). Does not restore — for outDir ephemeral configs. */
|
|
23
|
+
export declare function writeEphemeralConfig(path: string, contents: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Serialize a JSON-compatible object as `export default <json>`.
|
|
26
|
+
* Suitable for plain config overrides (no functions).
|
|
27
|
+
*/
|
|
28
|
+
export declare function serializeDefaultExport(value: unknown): string;
|
|
29
|
+
/**
|
|
30
|
+
* Build an ESM module that default-exports merge of `baseImportSpecifier` and overrides.
|
|
31
|
+
* `baseImportSpecifier` must be a valid import path string (absolute file URL or relative).
|
|
32
|
+
*/
|
|
33
|
+
export declare function serializeMergedDefaultExport(opts: {
|
|
34
|
+
baseImportSpecifier: string;
|
|
35
|
+
overrides: Record<string, unknown>;
|
|
36
|
+
/** Variable name for the base module default export. */
|
|
37
|
+
baseName?: string;
|
|
38
|
+
}): string;
|
|
39
|
+
/** Common config filenames to probe under a project root. */
|
|
40
|
+
export declare function findFirstExistingConfig(root: string, basenames: string[]): string | undefined;
|
|
41
|
+
export declare function readTextIfExists(path: string): Promise<string | undefined>;
|
|
42
|
+
/** Append a stable hash fragment for config overrides. */
|
|
43
|
+
export declare function configOverrideHashInput(key: string, value: unknown): string;
|
|
44
|
+
/**
|
|
45
|
+
* ESM module for `vite --config`: load the app's vite config from `appRoot`,
|
|
46
|
+
* then mergeConfig with JSON-serializable overrides.
|
|
47
|
+
*/
|
|
48
|
+
export declare function serializeViteMergeConfigModule(opts: {
|
|
49
|
+
appRoot: string;
|
|
50
|
+
overrides: Record<string, unknown>;
|
|
51
|
+
}): string;
|
|
52
|
+
/**
|
|
53
|
+
* ESM module for Astro `--config`: merge user config import with overrides.
|
|
54
|
+
* `baseImportSpecifier` should be an absolute file URL to the user's astro config.
|
|
55
|
+
*/
|
|
56
|
+
export declare function serializeAstroMergeConfigModule(opts: {
|
|
57
|
+
baseImportSpecifier: string;
|
|
58
|
+
overrides: Record<string, unknown>;
|
|
59
|
+
}): string;
|
|
60
|
+
/** Shallow-aware deep merge for plain JSON-like config objects (no class instances). */
|
|
61
|
+
export declare function deepMergePlain<T extends Record<string, unknown>>(base: T, patch: Partial<T> | Record<string, unknown>): T;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write `contents` to `path` (backing up any existing file). Returns `restore`
|
|
3
|
+
* that puts the previous contents back (or deletes the path if it was new).
|
|
4
|
+
* Use when the file must stay for a long-running process; prefer
|
|
5
|
+
* {@link withEphemeralFile} when the whole critical section is one async fn.
|
|
6
|
+
*/
|
|
7
|
+
export declare function installEphemeralFile(path: string, contents: string | Buffer): Promise<() => Promise<void>>;
|
|
8
|
+
/**
|
|
9
|
+
* Write `contents` to `path`, run `fn`, then restore the previous file (or delete
|
|
10
|
+
* if it did not exist). Safe for tools that only load config from a fixed name
|
|
11
|
+
* (e.g. Next.js `next.config.*`).
|
|
12
|
+
*/
|
|
13
|
+
export declare function withEphemeralFile<T>(path: string, contents: string | Buffer, fn: () => Promise<T>): Promise<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Replace `configPath` with an ESM module that merges the previous file + `overrides`,
|
|
16
|
+
* then restore. The previous file is copied to a sibling with a real extension so
|
|
17
|
+
* bundlers (vinxi/esbuild, Next) can import it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withMergedConfigOverride<T>(configPath: string, overrides: Record<string, unknown>, fn: () => Promise<T>): Promise<T>;
|
|
20
|
+
/** Like {@link withMergedConfigOverride} but restore is deferred (long-running processes). */
|
|
21
|
+
export declare function installMergedConfigOverride(configPath: string, overrides: Record<string, unknown>): Promise<() => Promise<void>>;
|
|
22
|
+
/** Write a file (creating parents). Does not restore — for outDir ephemeral configs. */
|
|
23
|
+
export declare function writeEphemeralConfig(path: string, contents: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Serialize a JSON-compatible object as `export default <json>`.
|
|
26
|
+
* Suitable for plain config overrides (no functions).
|
|
27
|
+
*/
|
|
28
|
+
export declare function serializeDefaultExport(value: unknown): string;
|
|
29
|
+
/**
|
|
30
|
+
* Build an ESM module that default-exports merge of `baseImportSpecifier` and overrides.
|
|
31
|
+
* `baseImportSpecifier` must be a valid import path string (absolute file URL or relative).
|
|
32
|
+
*/
|
|
33
|
+
export declare function serializeMergedDefaultExport(opts: {
|
|
34
|
+
baseImportSpecifier: string;
|
|
35
|
+
overrides: Record<string, unknown>;
|
|
36
|
+
/** Variable name for the base module default export. */
|
|
37
|
+
baseName?: string;
|
|
38
|
+
}): string;
|
|
39
|
+
/** Common config filenames to probe under a project root. */
|
|
40
|
+
export declare function findFirstExistingConfig(root: string, basenames: string[]): string | undefined;
|
|
41
|
+
export declare function readTextIfExists(path: string): Promise<string | undefined>;
|
|
42
|
+
/** Append a stable hash fragment for config overrides. */
|
|
43
|
+
export declare function configOverrideHashInput(key: string, value: unknown): string;
|
|
44
|
+
/**
|
|
45
|
+
* ESM module for `vite --config`: load the app's vite config from `appRoot`,
|
|
46
|
+
* then mergeConfig with JSON-serializable overrides.
|
|
47
|
+
*/
|
|
48
|
+
export declare function serializeViteMergeConfigModule(opts: {
|
|
49
|
+
appRoot: string;
|
|
50
|
+
overrides: Record<string, unknown>;
|
|
51
|
+
}): string;
|
|
52
|
+
/**
|
|
53
|
+
* ESM module for Astro `--config`: merge user config import with overrides.
|
|
54
|
+
* `baseImportSpecifier` should be an absolute file URL to the user's astro config.
|
|
55
|
+
*/
|
|
56
|
+
export declare function serializeAstroMergeConfigModule(opts: {
|
|
57
|
+
baseImportSpecifier: string;
|
|
58
|
+
overrides: Record<string, unknown>;
|
|
59
|
+
}): string;
|
|
60
|
+
/** Shallow-aware deep merge for plain JSON-like config objects (no class instances). */
|
|
61
|
+
export declare function deepMergePlain<T extends Record<string, unknown>>(base: T, patch: Partial<T> | Record<string, unknown>): T;
|
|
62
|
+
//# sourceMappingURL=config-override.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-override.d.ts","sourceRoot":"","sources":["../../src/drivers/config-override.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,GACxB,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAkC9B;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC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OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,MAAM,CAWT;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,MAAM,CAST;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1C,CAAC,CAmBH"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { copyFile, mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import { dirname, join } from "pathe";
|
|
5
|
+
|
|
6
|
+
export async function installEphemeralFile(path, contents) {
|
|
7
|
+
const dir = dirname(path);
|
|
8
|
+
await mkdir(dir, { recursive: true });
|
|
9
|
+
const backup = `${path}.untestutils-bak`;
|
|
10
|
+
const hadFile = existsSync(path);
|
|
11
|
+
if (hadFile) {
|
|
12
|
+
await copyFile(path, backup);
|
|
13
|
+
}
|
|
14
|
+
await writeFile(path, contents);
|
|
15
|
+
return async () => {
|
|
16
|
+
try {
|
|
17
|
+
await unlink(path);
|
|
18
|
+
} catch {}
|
|
19
|
+
if (hadFile) {
|
|
20
|
+
try {
|
|
21
|
+
await rename(backup, path);
|
|
22
|
+
} catch {
|
|
23
|
+
try {
|
|
24
|
+
await copyFile(backup, path);
|
|
25
|
+
await unlink(backup);
|
|
26
|
+
} catch {}
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
try {
|
|
30
|
+
await unlink(backup);
|
|
31
|
+
} catch {}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function withEphemeralFile(path, contents, fn) {
|
|
37
|
+
const restore = await installEphemeralFile(path, contents);
|
|
38
|
+
try {
|
|
39
|
+
return await fn();
|
|
40
|
+
} finally {
|
|
41
|
+
await restore();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function withMergedConfigOverride(configPath, overrides, fn) {
|
|
46
|
+
const restore = await installMergedConfigOverride(configPath, overrides);
|
|
47
|
+
try {
|
|
48
|
+
return await fn();
|
|
49
|
+
} finally {
|
|
50
|
+
await restore();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function installMergedConfigOverride(configPath, overrides) {
|
|
55
|
+
const dir = dirname(configPath);
|
|
56
|
+
await mkdir(dir, { recursive: true });
|
|
57
|
+
const base = configPath.match(/^(.*?)(\.[cm]?[jt]s)$/);
|
|
58
|
+
const basePath = base ? `${base[1]}.untestutils-base${base[2]}` : `${configPath}.untestutils-base.mjs`;
|
|
59
|
+
const hadFile = existsSync(configPath);
|
|
60
|
+
if (hadFile) {
|
|
61
|
+
await copyFile(configPath, basePath);
|
|
62
|
+
}
|
|
63
|
+
const contents = hadFile ? serializeMergedDefaultExport({
|
|
64
|
+
baseImportSpecifier: pathToFileURL(basePath).href,
|
|
65
|
+
overrides
|
|
66
|
+
}) : serializeDefaultExport(overrides);
|
|
67
|
+
const restoreFile = await installEphemeralFile(configPath, contents);
|
|
68
|
+
return async () => {
|
|
69
|
+
await restoreFile();
|
|
70
|
+
try {
|
|
71
|
+
await unlink(basePath);
|
|
72
|
+
} catch {}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function writeEphemeralConfig(path, contents) {
|
|
77
|
+
await mkdir(dirname(path), { recursive: true });
|
|
78
|
+
await writeFile(path, contents, "utf8");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function serializeDefaultExport(value) {
|
|
82
|
+
return `export default ${JSON.stringify(value, null, 2)};\n`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function serializeMergedDefaultExport(opts) {
|
|
86
|
+
const baseName = opts.baseName ?? "base";
|
|
87
|
+
const overridesJson = JSON.stringify(opts.overrides, null, 2);
|
|
88
|
+
return [
|
|
89
|
+
`import ${baseName}Mod from ${JSON.stringify(opts.baseImportSpecifier)};`,
|
|
90
|
+
`const ${baseName} = ${baseName}Mod?.default ?? ${baseName}Mod;`,
|
|
91
|
+
`const overrides = ${overridesJson};`,
|
|
92
|
+
`export default { ...(${baseName} && typeof ${baseName} === 'object' ? ${baseName} : {}), ...overrides };`,
|
|
93
|
+
""
|
|
94
|
+
].join("\n");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function findFirstExistingConfig(root, basenames) {
|
|
98
|
+
for (const name of basenames) {
|
|
99
|
+
const p = join(root, name);
|
|
100
|
+
if (existsSync(p)) return p;
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
export async function readTextIfExists(path) {
|
|
105
|
+
if (!existsSync(path)) return undefined;
|
|
106
|
+
return readFile(path, "utf8");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function configOverrideHashInput(key, value) {
|
|
110
|
+
return `${key}:${JSON.stringify(value)}`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function serializeViteMergeConfigModule(opts) {
|
|
114
|
+
return [
|
|
115
|
+
`import { mergeConfig, loadConfigFromFile, defineConfig } from "vite";`,
|
|
116
|
+
`const overrides = ${JSON.stringify(opts.overrides)};`,
|
|
117
|
+
`const appRoot = ${JSON.stringify(opts.appRoot)};`,
|
|
118
|
+
`export default defineConfig(async (env) => {`,
|
|
119
|
+
` const loaded = await loadConfigFromFile(env, undefined, appRoot);`,
|
|
120
|
+
` return mergeConfig(loaded?.config ?? {}, overrides);`,
|
|
121
|
+
`});`,
|
|
122
|
+
""
|
|
123
|
+
].join("\n");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function serializeAstroMergeConfigModule(opts) {
|
|
127
|
+
return [
|
|
128
|
+
`import { mergeConfig } from "astro/config";`,
|
|
129
|
+
`import userMod from ${JSON.stringify(opts.baseImportSpecifier)};`,
|
|
130
|
+
`const user = userMod?.default ?? userMod;`,
|
|
131
|
+
`const overrides = ${JSON.stringify(opts.overrides)};`,
|
|
132
|
+
`export default mergeConfig(user && typeof user === "object" ? user : {}, overrides);`,
|
|
133
|
+
""
|
|
134
|
+
].join("\n");
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function deepMergePlain(base, patch) {
|
|
138
|
+
const out = { ...base };
|
|
139
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
140
|
+
if (v === undefined) continue;
|
|
141
|
+
const prev = out[k];
|
|
142
|
+
if (v && typeof v === "object" && !Array.isArray(v) && prev && typeof prev === "object" && !Array.isArray(prev)) {
|
|
143
|
+
out[k] = deepMergePlain(prev, v);
|
|
144
|
+
} else {
|
|
145
|
+
out[k] = v;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { Recipe } from "../
|
|
1
|
+
import type { Recipe } from "../types.mjs";
|
|
2
2
|
/** Framework/app adapter → Recipe. Core never imports frameworks. */
|
|
3
3
|
export type Driver<Opts = unknown> = (opts: Opts) => Recipe;
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a driver so every produced recipe has a non-empty `id` and a valid `share`.
|
|
6
|
+
* Missing `share` defaults to `always` (same as most built-in drivers).
|
|
7
|
+
*/
|
|
4
8
|
export declare function defineDriver<Opts>(impl: Driver<Opts>): Driver<Opts>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type { Recipe } from '
|
|
1
|
+
import type { Recipe } from '../types';
|
|
2
2
|
/** Framework/app adapter → Recipe. Core never imports frameworks. */
|
|
3
3
|
export type Driver<Opts = unknown> = (opts: Opts) => Recipe;
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a driver so every produced recipe has a non-empty `id` and a valid `share`.
|
|
6
|
+
* Missing `share` defaults to `always` (same as most built-in drivers).
|
|
7
|
+
*/
|
|
4
8
|
export declare function defineDriver<Opts>(impl: Driver<Opts>): Driver<Opts>;
|
|
5
9
|
//# sourceMappingURL=define-driver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-driver.d.ts","sourceRoot":"","sources":["../../src/drivers/define-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"define-driver.d.ts","sourceRoot":"","sources":["../../src/drivers/define-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,UAAU,CAAC;AAEpD,qEAAqE;AACrE,MAAM,MAAM,MAAM,CAAC,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;AAI5D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAmBnE"}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
const SHARE_POLICIES = new Set([
|
|
2
|
+
"always",
|
|
3
|
+
"never",
|
|
4
|
+
"prepare-only"
|
|
5
|
+
]);
|
|
6
|
+
|
|
1
7
|
export function defineDriver(impl) {
|
|
2
|
-
return
|
|
8
|
+
return (opts) => {
|
|
9
|
+
const recipe = impl(opts);
|
|
10
|
+
if (!recipe || typeof recipe !== "object") {
|
|
11
|
+
throw new Error("[untestutils] defineDriver: driver must return a Recipe");
|
|
12
|
+
}
|
|
13
|
+
const id = typeof recipe.id === "string" ? recipe.id.trim() : "";
|
|
14
|
+
if (!id) {
|
|
15
|
+
throw new Error("[untestutils] defineDriver: recipe.id is required");
|
|
16
|
+
}
|
|
17
|
+
const share = recipe.share ?? "always";
|
|
18
|
+
if (!SHARE_POLICIES.has(share)) {
|
|
19
|
+
throw new Error(`[untestutils] defineDriver: invalid share "${String(recipe.share)}" (use always|never|prepare-only)`);
|
|
20
|
+
}
|
|
21
|
+
if (recipe.id === id && recipe.share === share) return recipe;
|
|
22
|
+
return {
|
|
23
|
+
...recipe,
|
|
24
|
+
id,
|
|
25
|
+
share
|
|
26
|
+
};
|
|
27
|
+
};
|
|
3
28
|
}
|
package/dist/drivers/host.d.mts
CHANGED
package/dist/drivers/host.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/drivers/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/drivers/host.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,WAAW,CA0BnC,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
package/dist/drivers/host.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { defineRecipe
|
|
1
|
+
import { defineRecipe } from "../recipes.mjs";
|
|
2
|
+
import { normalizeBaseUrl } from "../paths.mjs";
|
|
3
|
+
import { waitForHttpReady } from "../ready.mjs";
|
|
2
4
|
import { defineDriver } from "./define-driver.mjs";
|
|
3
5
|
|
|
4
6
|
export const host = defineDriver((opts) => {
|
package/dist/drivers/index.d.mts
CHANGED
|
@@ -10,3 +10,6 @@ export { host } from "./host.mjs";
|
|
|
10
10
|
export type { HostOptions } from "./host.mjs";
|
|
11
11
|
export { resolveBin, assertAppRoot, cliFrameworkRecipe, frameworkRoots, _cliInternals } from "./cli-framework.mjs";
|
|
12
12
|
export type { ResolveBinOptions, SpawnSpec, CliFrameworkRecipeOptions, FrameworkBaseOptions } from "./cli-framework.mjs";
|
|
13
|
+
export { matrixRecipe, findWorkspaceRoot, workspacePackageSrcDirs, shouldIncludeWorkspaceDeps, appendWorkspaceHashInputs } from "./matrix.mjs";
|
|
14
|
+
export type { MatrixCapableOptions, MatrixRecipeOptions } from "./matrix.mjs";
|
|
15
|
+
export { installEphemeralFile, withEphemeralFile, withMergedConfigOverride, installMergedConfigOverride, writeEphemeralConfig, serializeDefaultExport, serializeMergedDefaultExport, serializeViteMergeConfigModule, serializeAstroMergeConfigModule, findFirstExistingConfig, readTextIfExists, configOverrideHashInput, deepMergePlain } from "./config-override.mjs";
|
package/dist/drivers/index.d.ts
CHANGED
|
@@ -10,4 +10,7 @@ export { host } from './host';
|
|
|
10
10
|
export type { HostOptions } from './host';
|
|
11
11
|
export { resolveBin, assertAppRoot, cliFrameworkRecipe, frameworkRoots, _cliInternals, } from './cli-framework';
|
|
12
12
|
export type { ResolveBinOptions, SpawnSpec, CliFrameworkRecipeOptions, FrameworkBaseOptions, } from './cli-framework';
|
|
13
|
+
export { matrixRecipe, findWorkspaceRoot, workspacePackageSrcDirs, shouldIncludeWorkspaceDeps, appendWorkspaceHashInputs, } from './matrix';
|
|
14
|
+
export type { MatrixCapableOptions, MatrixRecipeOptions } from './matrix';
|
|
15
|
+
export { installEphemeralFile, withEphemeralFile, withMergedConfigOverride, installMergedConfigOverride, writeEphemeralConfig, serializeDefaultExport, serializeMergedDefaultExport, serializeViteMergeConfigModule, serializeAstroMergeConfigModule, findFirstExistingConfig, readTextIfExists, configOverrideHashInput, deepMergePlain, } from './config-override';
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drivers/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,iBAAiB,EACjB,SAAS,EACT,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drivers/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,iBAAiB,EACjB,SAAS,EACT,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,GACf,MAAM,mBAAmB,CAAC"}
|
package/dist/drivers/index.mjs
CHANGED
|
@@ -4,3 +4,5 @@ export { staticDir } from "./static-dir.mjs";
|
|
|
4
4
|
export { nodeEntry } from "./node-entry.mjs";
|
|
5
5
|
export { host } from "./host.mjs";
|
|
6
6
|
export { resolveBin, assertAppRoot, cliFrameworkRecipe, frameworkRoots, _cliInternals } from "./cli-framework.mjs";
|
|
7
|
+
export { matrixRecipe, findWorkspaceRoot, workspacePackageSrcDirs, shouldIncludeWorkspaceDeps, appendWorkspaceHashInputs } from "./matrix.mjs";
|
|
8
|
+
export { installEphemeralFile, withEphemeralFile, withMergedConfigOverride, installMergedConfigOverride, writeEphemeralConfig, serializeDefaultExport, serializeMergedDefaultExport, serializeViteMergeConfigModule, serializeAstroMergeConfigModule, findFirstExistingConfig, readTextIfExists, configOverrideHashInput, deepMergePlain } from "./config-override.mjs";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Recipe } from "../types.mjs";
|
|
2
|
+
/** Minimal options every framework matrix can merge. */
|
|
3
|
+
export type MatrixCapableOptions = {
|
|
4
|
+
id?: string;
|
|
5
|
+
root: string;
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
hashInputs?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type MatrixRecipeOptions<Opts extends MatrixCapableOptions> = {
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Custom merge of base + variant patch. Default: shallow spread, deep `env`,
|
|
13
|
+
* concat `hashInputs` + `variant:${name}`.
|
|
14
|
+
*/
|
|
15
|
+
merge?: (base: Opts, patch: Partial<Opts>, id: string, variantName: string) => Opts;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Expand one recipe base into many recipes with distinct ids / identity.
|
|
19
|
+
* Variant key `default` keeps `base.id`; other keys become `${baseId}__${key}`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function matrixRecipe<Opts extends MatrixCapableOptions>(factory: (opts: Opts) => Recipe, base: Opts, variants: Record<string, Partial<Opts>>, options: MatrixRecipeOptions<Opts>): Record<string, Recipe>;
|
|
22
|
+
/** Walk up from `from` looking for `pnpm-workspace.yaml` / `.yml`. */
|
|
23
|
+
export declare function findWorkspaceRoot(from: string): string | undefined;
|
|
24
|
+
/** Collect packages/NAME/src dirs under the workspace root (for prepare hash). */
|
|
25
|
+
export declare function workspacePackageSrcDirs(from: string): Promise<string[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to include workspace package src dirs in hash inputs.
|
|
28
|
+
* - true: always
|
|
29
|
+
* - auto: when a pnpm workspace root is found
|
|
30
|
+
* - false / undefined: never (CLI adapters default off; Nuxt keeps its own default)
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldIncludeWorkspaceDeps(workspaceDeps: boolean | "auto" | undefined, root: string): boolean;
|
|
33
|
+
/** Append workspace src dirs to hash inputs when enabled. */
|
|
34
|
+
export declare function appendWorkspaceHashInputs(inputs: string[], root: string, workspaceDeps: boolean | "auto" | undefined): Promise<string[]>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Recipe } from '../types';
|
|
2
|
+
/** Minimal options every framework matrix can merge. */
|
|
3
|
+
export type MatrixCapableOptions = {
|
|
4
|
+
id?: string;
|
|
5
|
+
root: string;
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
hashInputs?: string[];
|
|
8
|
+
};
|
|
9
|
+
export type MatrixRecipeOptions<Opts extends MatrixCapableOptions> = {
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Custom merge of base + variant patch. Default: shallow spread, deep `env`,
|
|
13
|
+
* concat `hashInputs` + `variant:${name}`.
|
|
14
|
+
*/
|
|
15
|
+
merge?: (base: Opts, patch: Partial<Opts>, id: string, variantName: string) => Opts;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Expand one recipe base into many recipes with distinct ids / identity.
|
|
19
|
+
* Variant key `default` keeps `base.id`; other keys become `${baseId}__${key}`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function matrixRecipe<Opts extends MatrixCapableOptions>(factory: (opts: Opts) => Recipe, base: Opts, variants: Record<string, Partial<Opts>>, options: MatrixRecipeOptions<Opts>): Record<string, Recipe>;
|
|
22
|
+
/** Walk up from `from` looking for `pnpm-workspace.yaml` / `.yml`. */
|
|
23
|
+
export declare function findWorkspaceRoot(from: string): string | undefined;
|
|
24
|
+
/** Collect packages/NAME/src dirs under the workspace root (for prepare hash). */
|
|
25
|
+
export declare function workspacePackageSrcDirs(from: string): Promise<string[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to include workspace package src dirs in hash inputs.
|
|
28
|
+
* - true: always
|
|
29
|
+
* - auto: when a pnpm workspace root is found
|
|
30
|
+
* - false / undefined: never (CLI adapters default off; Nuxt keeps its own default)
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldIncludeWorkspaceDeps(workspaceDeps: boolean | 'auto' | undefined, root: string): boolean;
|
|
33
|
+
/** Append workspace src dirs to hash inputs when enabled. */
|
|
34
|
+
export declare function appendWorkspaceHashInputs(inputs: string[], root: string, workspaceDeps: boolean | 'auto' | undefined): Promise<string[]>;
|
|
35
|
+
//# sourceMappingURL=matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../src/drivers/matrix.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wDAAwD;AACxD,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,IAAI,SAAS,oBAAoB,IAAI;IACnE,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACrF,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,oBAAoB,EAC5D,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,EAC/B,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EACvC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiCxB;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAclE;AAED,kFAAkF;AAClF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa7E;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,EAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAIT;AAED,6DAA6D;AAC7D,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,EAAE,EAChB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAC1C,OAAO,CAAC,MAAM,EAAE,CAAC,CAGnB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readdir } from "node:fs/promises";
|
|
3
|
+
import { dirname, join, resolve } from "pathe";
|
|
4
|
+
|
|
5
|
+
export function matrixRecipe(factory, base, variants, options) {
|
|
6
|
+
if (!base.root) {
|
|
7
|
+
throw new Error(`[untestutils/${options.label}] matrix() requires base.root`);
|
|
8
|
+
}
|
|
9
|
+
const baseId = base.id ?? `${options.label}-default`;
|
|
10
|
+
const out = {};
|
|
11
|
+
const merge = options.merge ?? ((b, patch, id, variantName) => ({
|
|
12
|
+
...b,
|
|
13
|
+
...patch,
|
|
14
|
+
id,
|
|
15
|
+
env: {
|
|
16
|
+
...b.env ?? {},
|
|
17
|
+
...patch.env ?? {}
|
|
18
|
+
},
|
|
19
|
+
hashInputs: [
|
|
20
|
+
...b.hashInputs ?? [b.root],
|
|
21
|
+
...patch.hashInputs ?? [],
|
|
22
|
+
`variant:${variantName}`
|
|
23
|
+
]
|
|
24
|
+
}));
|
|
25
|
+
for (const [name, patch] of Object.entries(variants)) {
|
|
26
|
+
const id = name === "default" ? baseId : `${baseId}__${name}`;
|
|
27
|
+
if (out[id]) {
|
|
28
|
+
throw new Error(`[untestutils/${options.label}] matrix() duplicate id "${id}"`);
|
|
29
|
+
}
|
|
30
|
+
const recipe = factory(merge(base, patch, id, name));
|
|
31
|
+
if (Object.values(out).some((r) => r.id === recipe.id)) {
|
|
32
|
+
throw new Error(`[untestutils/${options.label}] matrix() duplicate id "${recipe.id}"`);
|
|
33
|
+
}
|
|
34
|
+
out[id] = recipe;
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function findWorkspaceRoot(from) {
|
|
40
|
+
let dir = resolve(from);
|
|
41
|
+
for (let i = 0; i < 12; i++) {
|
|
42
|
+
if (existsSync(join(dir, "pnpm-workspace.yaml")) || existsSync(join(dir, "pnpm-workspace.yml"))) {
|
|
43
|
+
return dir;
|
|
44
|
+
}
|
|
45
|
+
const parent = dirname(dir);
|
|
46
|
+
if (parent === dir) break;
|
|
47
|
+
dir = parent;
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function workspacePackageSrcDirs(from) {
|
|
53
|
+
const ws = findWorkspaceRoot(from);
|
|
54
|
+
if (!ws) return [];
|
|
55
|
+
const packagesDir = join(ws, "packages");
|
|
56
|
+
if (!existsSync(packagesDir)) return [];
|
|
57
|
+
const names = await readdir(packagesDir, { withFileTypes: true }).catch(() => []);
|
|
58
|
+
const out = [];
|
|
59
|
+
for (const e of names) {
|
|
60
|
+
if (!e.isDirectory()) continue;
|
|
61
|
+
const src = join(packagesDir, e.name, "src");
|
|
62
|
+
if (existsSync(src)) out.push(src);
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function shouldIncludeWorkspaceDeps(workspaceDeps, root) {
|
|
68
|
+
if (workspaceDeps === true) return true;
|
|
69
|
+
if (workspaceDeps === "auto") return Boolean(findWorkspaceRoot(root));
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function appendWorkspaceHashInputs(inputs, root, workspaceDeps) {
|
|
74
|
+
if (!shouldIncludeWorkspaceDeps(workspaceDeps, root)) return inputs;
|
|
75
|
+
return [...inputs, ...await workspacePackageSrcDirs(root)];
|
|
76
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-entry.d.ts","sourceRoot":"","sources":["../../src/drivers/node-entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-entry.d.ts","sourceRoot":"","sources":["../../src/drivers/node-entry.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAoDxD;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { resolve } from "pathe";
|
|
3
|
-
import { defineRecipe
|
|
3
|
+
import { defineRecipe } from "../recipes.mjs";
|
|
4
|
+
import { loopbackUrl } from "../paths.mjs";
|
|
5
|
+
import { waitForHttpReady } from "../ready.mjs";
|
|
6
|
+
import { spawnManaged } from "../process.mjs";
|
|
4
7
|
export function nodeEntry(opts) {
|
|
5
8
|
const entry = resolve(opts.entry);
|
|
6
9
|
const cwd = opts.cwd ? resolve(opts.cwd) : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-dir.d.ts","sourceRoot":"","sources":["../../src/drivers/static-dir.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"static-dir.d.ts","sourceRoot":"","sources":["../../src/drivers/static-dir.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAgBvC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CA8ExD;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -2,7 +2,9 @@ import { createServer } from "node:http";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { readFile, stat } from "node:fs/promises";
|
|
4
4
|
import { extname, join, normalize, resolve, sep } from "pathe";
|
|
5
|
-
import { defineRecipe
|
|
5
|
+
import { defineRecipe } from "../recipes.mjs";
|
|
6
|
+
import { loopbackUrl } from "../paths.mjs";
|
|
7
|
+
import { waitForHttpReady } from "../ready.mjs";
|
|
6
8
|
const MIME = {
|
|
7
9
|
".html": "text/html; charset=utf-8",
|
|
8
10
|
".js": "text/javascript; charset=utf-8",
|
package/dist/harness.d.mts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import type { HarnessHandle, Recipe, UseHarnessOptions } from "./types.mjs";
|
|
2
|
-
|
|
2
|
+
import { type OrchestratorOptions, type PreparedTarget } from "./orchestrator.mjs";
|
|
3
|
+
export type LeaseOptions = OrchestratorOptions & UseHarnessOptions;
|
|
4
|
+
export interface LeasedTarget extends HarnessHandle {
|
|
5
|
+
/** Drop this process's handle bookkeeping. Does not stop shared recipe servers. */
|
|
6
|
+
release: () => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare function prepareOnce(recipe: string | Recipe, opts?: LeaseOptions): Promise<PreparedTarget>;
|
|
9
|
+
/**
|
|
10
|
+
* Prepare/start a recipe and return a handle with explicit `release`.
|
|
11
|
+
* Prefer this over `useHarness` when you need RAII-style cleanup bookkeeping.
|
|
12
|
+
*/
|
|
13
|
+
export declare function leaseTarget(recipe: string | Recipe, opts?: LeaseOptions): Promise<LeasedTarget>;
|
|
14
|
+
/** Lease a target, run `fn`, always `release` afterward. */
|
|
15
|
+
export declare function withHarness<T>(recipe: string | Recipe, fn: (handle: HarnessHandle) => Promise<T>, opts?: LeaseOptions): Promise<T>;
|
|
16
|
+
export declare function useHarness(recipe: string | Recipe, opts?: UseHarnessOptions): Promise<HarnessHandle>;
|
|
3
17
|
export declare function getCurrentHarness(): HarnessHandle | undefined;
|
|
4
18
|
export declare function getHarness(id: string): HarnessHandle | undefined;
|
package/dist/harness.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import type { HarnessHandle, Recipe, UseHarnessOptions } from './types';
|
|
2
|
-
|
|
2
|
+
import { type OrchestratorOptions, type PreparedTarget } from './orchestrator';
|
|
3
|
+
export type LeaseOptions = OrchestratorOptions & UseHarnessOptions;
|
|
4
|
+
export interface LeasedTarget extends HarnessHandle {
|
|
5
|
+
/** Drop this process's handle bookkeeping. Does not stop shared recipe servers. */
|
|
6
|
+
release: () => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare function prepareOnce(recipe: string | Recipe, opts?: LeaseOptions): Promise<PreparedTarget>;
|
|
9
|
+
/**
|
|
10
|
+
* Prepare/start a recipe and return a handle with explicit `release`.
|
|
11
|
+
* Prefer this over `useHarness` when you need RAII-style cleanup bookkeeping.
|
|
12
|
+
*/
|
|
13
|
+
export declare function leaseTarget(recipe: string | Recipe, opts?: LeaseOptions): Promise<LeasedTarget>;
|
|
14
|
+
/** Lease a target, run `fn`, always `release` afterward. */
|
|
15
|
+
export declare function withHarness<T>(recipe: string | Recipe, fn: (handle: HarnessHandle) => Promise<T>, opts?: LeaseOptions): Promise<T>;
|
|
16
|
+
export declare function useHarness(recipe: string | Recipe, opts?: UseHarnessOptions): Promise<HarnessHandle>;
|
|
3
17
|
export declare function getCurrentHarness(): HarnessHandle | undefined;
|
|
4
18
|
export declare function getHarness(id: string): HarnessHandle | undefined;
|
|
5
19
|
//# sourceMappingURL=harness.d.ts.map
|
package/dist/harness.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAEnE,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,mFAAmF;IACnF,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAMD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,cAAc,CAAC,CAKzB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,YAAY,CAAC,CAWvB;AAED,4DAA4D;AAC5D,wBAAsB,WAAW,CAAC,CAAC,EACjC,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,EAAE,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC,CAAC,CAAC,CAOZ;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED,wBAAgB,iBAAiB,IAAI,aAAa,GAAG,SAAS,CAE7D;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEhE"}
|
package/dist/harness.mjs
CHANGED
|
@@ -3,12 +3,40 @@ import { createHarnessHandle, ensurePrepared } from "./orchestrator.mjs";
|
|
|
3
3
|
import { resolveArtifactsRoot } from "./paths.mjs";
|
|
4
4
|
const storage = new AsyncLocalStorage();
|
|
5
5
|
const handles = new Map();
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
function artifactsFrom(opts) {
|
|
7
|
+
return opts.artifactsRoot ?? resolveArtifactsRoot(opts.cwd);
|
|
8
|
+
}
|
|
9
|
+
export async function prepareOnce(recipe, opts = {}) {
|
|
10
|
+
return ensurePrepared(recipe, {
|
|
11
|
+
artifactsRoot: artifactsFrom(opts),
|
|
12
|
+
cwd: opts.cwd
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function leaseTarget(recipe, opts = {}) {
|
|
17
|
+
const prepared = await prepareOnce(recipe, opts);
|
|
8
18
|
const handle = createHarnessHandle(prepared);
|
|
9
19
|
handles.set(handle.id, handle);
|
|
10
20
|
storage.enterWith(handle);
|
|
11
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
...handle,
|
|
23
|
+
release: async () => {
|
|
24
|
+
handles.delete(handle.id);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function withHarness(recipe, fn, opts = {}) {
|
|
30
|
+
const leased = await leaseTarget(recipe, opts);
|
|
31
|
+
try {
|
|
32
|
+
return await fn(leased);
|
|
33
|
+
} finally {
|
|
34
|
+
await leased.release();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export async function useHarness(recipe, opts = {}) {
|
|
38
|
+
const leased = await leaseTarget(recipe, opts);
|
|
39
|
+
return leased;
|
|
12
40
|
}
|
|
13
41
|
export function getCurrentHarness() {
|
|
14
42
|
return storage.getStore();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type { Recipe, RecipeFactory, RecipeRegistry, Running, HarnessHandle, SharePolicy, PrepareCtx, StartCtx, HashCtx, UseHarnessOptions } from "./types.mjs";
|
|
2
2
|
export { SCHEMA_VERSION } from "./types.mjs";
|
|
3
3
|
export { defineRecipe, defineRecipes, ensureRecipes, getRegisteredRecipe, getRecipesModulePath, listRegisteredRecipes, clearRegisteredRecipes } from "./recipes.mjs";
|
|
4
|
-
export { useHarness, getCurrentHarness, getHarness } from "./harness.mjs";
|
|
4
|
+
export { useHarness, getCurrentHarness, getHarness, leaseTarget, prepareOnce, withHarness } from "./harness.mjs";
|
|
5
|
+
export type { LeaseOptions, LeasedTarget } from "./harness.mjs";
|
|
6
|
+
export { sanitizeSession, resolveSessionArtifactsRoot } from "./session.mjs";
|
|
5
7
|
export { ensurePrepared, stopAllTargets, reclaimStaleTargets, resolveRecipe, detachLiveTargetsForTests } from "./orchestrator.mjs";
|
|
6
8
|
export { TargetRegistry, envKey, envDirKey } from "./target-registry.mjs";
|
|
7
9
|
export { ArtifactStore } from "./artifact-store.mjs";
|
|
@@ -27,3 +29,6 @@ export { host } from "./drivers/host.mjs";
|
|
|
27
29
|
export type { HostOptions } from "./drivers/host.mjs";
|
|
28
30
|
export { resolveBin, assertAppRoot, cliFrameworkRecipe, frameworkRoots, _cliInternals } from "./drivers/cli-framework.mjs";
|
|
29
31
|
export type { ResolveBinOptions, SpawnSpec, CliFrameworkRecipeOptions, FrameworkBaseOptions } from "./drivers/cli-framework.mjs";
|
|
32
|
+
export { matrixRecipe, findWorkspaceRoot, workspacePackageSrcDirs, shouldIncludeWorkspaceDeps, appendWorkspaceHashInputs } from "./drivers/matrix.mjs";
|
|
33
|
+
export type { MatrixCapableOptions, MatrixRecipeOptions } from "./drivers/matrix.mjs";
|
|
34
|
+
export { installEphemeralFile, withEphemeralFile, withMergedConfigOverride, installMergedConfigOverride, writeEphemeralConfig, serializeDefaultExport, serializeMergedDefaultExport, serializeViteMergeConfigModule, serializeAstroMergeConfigModule, findFirstExistingConfig, readTextIfExists, configOverrideHashInput, deepMergePlain } from "./drivers/config-override.mjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type { Recipe, RecipeFactory, RecipeRegistry, Running, HarnessHandle, SharePolicy, PrepareCtx, StartCtx, HashCtx, UseHarnessOptions, } from './types';
|
|
2
2
|
export { SCHEMA_VERSION } from './types';
|
|
3
3
|
export { defineRecipe, defineRecipes, ensureRecipes, getRegisteredRecipe, getRecipesModulePath, listRegisteredRecipes, clearRegisteredRecipes, } from './recipes';
|
|
4
|
-
export { useHarness, getCurrentHarness, getHarness } from './harness';
|
|
4
|
+
export { useHarness, getCurrentHarness, getHarness, leaseTarget, prepareOnce, withHarness, } from './harness';
|
|
5
|
+
export type { LeaseOptions, LeasedTarget } from './harness';
|
|
6
|
+
export { sanitizeSession, resolveSessionArtifactsRoot } from './session';
|
|
5
7
|
export { ensurePrepared, stopAllTargets, reclaimStaleTargets, resolveRecipe, detachLiveTargetsForTests, } from './orchestrator';
|
|
6
8
|
export { TargetRegistry, envKey, envDirKey } from './target-registry';
|
|
7
9
|
export { ArtifactStore } from './artifact-store';
|
|
@@ -27,4 +29,7 @@ export { host } from './drivers/host';
|
|
|
27
29
|
export type { HostOptions } from './drivers/host';
|
|
28
30
|
export { resolveBin, assertAppRoot, cliFrameworkRecipe, frameworkRoots, _cliInternals, } from './drivers/cli-framework';
|
|
29
31
|
export type { ResolveBinOptions, SpawnSpec, CliFrameworkRecipeOptions, FrameworkBaseOptions, } from './drivers/cli-framework';
|
|
32
|
+
export { matrixRecipe, findWorkspaceRoot, workspacePackageSrcDirs, shouldIncludeWorkspaceDeps, appendWorkspaceHashInputs, } from './drivers/matrix';
|
|
33
|
+
export type { MatrixCapableOptions, MatrixRecipeOptions } from './drivers/matrix';
|
|
34
|
+
export { installEphemeralFile, withEphemeralFile, withMergedConfigOverride, installMergedConfigOverride, writeEphemeralConfig, serializeDefaultExport, serializeMergedDefaultExport, serializeViteMergeConfigModule, serializeAstroMergeConfigModule, findFirstExistingConfig, readTextIfExists, configOverrideHashInput, deepMergePlain, } from './drivers/config-override';
|
|
30
35
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,MAAM,EACN,aAAa,EACb,cAAc,EACd,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,MAAM,EACN,aAAa,EACb,cAAc,EACd,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EA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C9B,+BAA+B,EAC/B,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,GACf,MAAM,2BAA2B,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { SCHEMA_VERSION } from "./types.mjs";
|
|
2
2
|
export { defineRecipe, defineRecipes, ensureRecipes, getRegisteredRecipe, getRecipesModulePath, listRegisteredRecipes, clearRegisteredRecipes } from "./recipes.mjs";
|
|
3
|
-
export { useHarness, getCurrentHarness, getHarness } from "./harness.mjs";
|
|
3
|
+
export { useHarness, getCurrentHarness, getHarness, leaseTarget, prepareOnce, withHarness } from "./harness.mjs";
|
|
4
|
+
export { sanitizeSession, resolveSessionArtifactsRoot } from "./session.mjs";
|
|
4
5
|
export { ensurePrepared, stopAllTargets, reclaimStaleTargets, resolveRecipe, detachLiveTargetsForTests } from "./orchestrator.mjs";
|
|
5
6
|
export { TargetRegistry, envKey, envDirKey } from "./target-registry.mjs";
|
|
6
7
|
export { ArtifactStore } from "./artifact-store.mjs";
|
|
@@ -20,3 +21,5 @@ export { staticDir } from "./drivers/static-dir.mjs";
|
|
|
20
21
|
export { nodeEntry } from "./drivers/node-entry.mjs";
|
|
21
22
|
export { host } from "./drivers/host.mjs";
|
|
22
23
|
export { resolveBin, assertAppRoot, cliFrameworkRecipe, frameworkRoots, _cliInternals } from "./drivers/cli-framework.mjs";
|
|
24
|
+
export { matrixRecipe, findWorkspaceRoot, workspacePackageSrcDirs, shouldIncludeWorkspaceDeps, appendWorkspaceHashInputs } from "./drivers/matrix.mjs";
|
|
25
|
+
export { installEphemeralFile, withEphemeralFile, withMergedConfigOverride, installMergedConfigOverride, writeEphemeralConfig, serializeDefaultExport, serializeMergedDefaultExport, serializeViteMergeConfigModule, serializeAstroMergeConfigModule, findFirstExistingConfig, readTextIfExists, configOverrideHashInput, deepMergePlain } from "./drivers/config-override.mjs";
|
package/dist/ports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAG3B,0DAA0D;AAC1D,eAAO,MAAM,OAAO,EAAE;IACpB,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../src/ports.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAG3B,0DAA0D;AAC1D,eAAO,MAAM,OAAO,EAAE;IACpB,YAAY,EAAE,CACZ,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC,YAAY,CAAC,KACzC,UAAU,CAAC,OAAO,GAAG,CAAC,YAAY,CAAC,CAAC;CAK1C,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAezE;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAsB,EAC5B,SAAS,GAAE,MAAe,GACzB,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Sanitize session segment for filesystem / env use. */
|
|
2
|
+
export declare function sanitizeSession(session: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve artifacts root with optional session isolation.
|
|
5
|
+
* Explicit `artifactsRoot` wins; otherwise `session` / `UNTESTUTILS_SESSION`
|
|
6
|
+
* nests under `.untestutils/sessions/<session>/`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveSessionArtifactsRoot(opts?: {
|
|
9
|
+
artifactsRoot?: string;
|
|
10
|
+
session?: string;
|
|
11
|
+
cwd?: string;
|
|
12
|
+
}): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Sanitize session segment for filesystem / env use. */
|
|
2
|
+
export declare function sanitizeSession(session: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve artifacts root with optional session isolation.
|
|
5
|
+
* Explicit `artifactsRoot` wins; otherwise `session` / `UNTESTUTILS_SESSION`
|
|
6
|
+
* nests under `.untestutils/sessions/<session>/`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveSessionArtifactsRoot(opts?: {
|
|
9
|
+
artifactsRoot?: string;
|
|
10
|
+
session?: string;
|
|
11
|
+
cwd?: string;
|
|
12
|
+
}): string;
|
|
13
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAGA,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,GAAE;IACJ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACT,GACL,MAAM,CAOR"}
|
package/dist/session.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { join, resolve } from "pathe";
|
|
2
|
+
import { resolveArtifactsRoot } from "./paths.mjs";
|
|
3
|
+
|
|
4
|
+
export function sanitizeSession(session) {
|
|
5
|
+
const s = session.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
6
|
+
if (!s) {
|
|
7
|
+
throw new Error("[untestutils] session must be a non-empty identifier");
|
|
8
|
+
}
|
|
9
|
+
return s;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function resolveSessionArtifactsRoot(opts = {}) {
|
|
13
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
14
|
+
if (opts.artifactsRoot) return resolve(cwd, opts.artifactsRoot);
|
|
15
|
+
const base = resolveArtifactsRoot(cwd);
|
|
16
|
+
const session = opts.session ?? process.env.UNTESTUTILS_SESSION;
|
|
17
|
+
if (session) return join(base, "sessions", sanitizeSession(session));
|
|
18
|
+
return base;
|
|
19
|
+
}
|
package/dist/types.d.mts
CHANGED
|
@@ -86,7 +86,9 @@ export interface HarnessHandle {
|
|
|
86
86
|
};
|
|
87
87
|
dispose?: () => Promise<void>;
|
|
88
88
|
}
|
|
89
|
+
/** Options for `useHarness` / `leaseTarget` (orchestrator path). */
|
|
89
90
|
export interface UseHarnessOptions {
|
|
90
|
-
|
|
91
|
+
artifactsRoot?: string;
|
|
92
|
+
cwd?: string;
|
|
91
93
|
}
|
|
92
94
|
export declare const SCHEMA_VERSION: 1;
|
package/dist/types.d.ts
CHANGED
|
@@ -86,8 +86,10 @@ export interface HarnessHandle {
|
|
|
86
86
|
};
|
|
87
87
|
dispose?: () => Promise<void>;
|
|
88
88
|
}
|
|
89
|
+
/** Options for `useHarness` / `leaseTarget` (orchestrator path). */
|
|
89
90
|
export interface UseHarnessOptions {
|
|
90
|
-
|
|
91
|
+
artifactsRoot?: string;
|
|
92
|
+
cwd?: string;
|
|
91
93
|
}
|
|
92
94
|
export declare const SCHEMA_VERSION: 1;
|
|
93
95
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,IAAI,EAAE,KAAK,CAAC;IACZ,GAA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CAAC;CAC/B;AAED,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,cAAc,EAAG,CAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@untestutils/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Recipe harness core — locks, registry, orchestrator, drivers",
|
|
5
|
-
"license": "MIT",
|
|
6
5
|
"homepage": "https://s00d.github.io/untestutils/",
|
|
6
|
+
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/s00d/untestutils.git",
|