@guideshot/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/index.d.ts +408 -0
- package/dist/index.js +1474 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GuideShot contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @guideshot/core
|
|
2
|
+
|
|
3
|
+
The portable GuideShot compiler: configuration contracts, recipe discovery, deterministic planning, resolution, diagnostics, hashing, and manifests.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @guideshot/core
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { parseRecipe } from '@guideshot/core';
|
|
11
|
+
|
|
12
|
+
const recipe = parseRecipe(source, { file: 'example.shot.json' });
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Browser drivers and annotation renderers are injected through `defineConfig`. Requires Node.js 20 or newer and is licensed under the MIT License.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { VariantValue, JsonObject, Annotation, Action, Expectation, Recipe, JsonValue, OutputFormat as OutputFormat$1, PublicManifest, LocalizedText } from '@guideshot/schema';
|
|
2
|
+
export { Accessibility, Action, Annotation, AnnotationPlacement, Expectation, Frame, JsonObject, JsonValue, LocalizedText, ManifestEntry, ManifestVariant, Matrix, Output, OutputFormat, PublicManifest, PublicManifestSchema, Recipe, RecipeSchema, SCHEMA_VERSION, VariantValue } from '@guideshot/schema';
|
|
3
|
+
|
|
4
|
+
declare function canonicalSerialize(value: unknown): string;
|
|
5
|
+
declare function sha256(value: string | Uint8Array): string;
|
|
6
|
+
declare function hashCanonical(value: unknown): string;
|
|
7
|
+
declare function createCaptureHash(intent: unknown): string;
|
|
8
|
+
declare function createCompositionHash(intent: unknown): string;
|
|
9
|
+
|
|
10
|
+
interface ExtensionInfo {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
apiVersion?: number;
|
|
14
|
+
}
|
|
15
|
+
interface Viewport {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}
|
|
19
|
+
interface CaptureProfile {
|
|
20
|
+
viewport: Viewport;
|
|
21
|
+
pixelRatio?: number;
|
|
22
|
+
locale?: string;
|
|
23
|
+
timezoneId?: string;
|
|
24
|
+
colorScheme?: 'light' | 'dark';
|
|
25
|
+
reducedMotion?: 'reduce' | 'no-preference';
|
|
26
|
+
}
|
|
27
|
+
interface BrowserCookie {
|
|
28
|
+
name: string;
|
|
29
|
+
value: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
domain?: string;
|
|
32
|
+
path?: string;
|
|
33
|
+
expires?: number;
|
|
34
|
+
httpOnly?: boolean;
|
|
35
|
+
secure?: boolean;
|
|
36
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
37
|
+
}
|
|
38
|
+
interface LocalStorageState {
|
|
39
|
+
origin: string;
|
|
40
|
+
values: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
interface BrowserStatePatch {
|
|
43
|
+
locale?: string;
|
|
44
|
+
timezoneId?: string;
|
|
45
|
+
colorScheme?: 'light' | 'dark';
|
|
46
|
+
reducedMotion?: 'reduce' | 'no-preference';
|
|
47
|
+
cookies?: readonly BrowserCookie[];
|
|
48
|
+
localStorage?: readonly LocalStorageState[];
|
|
49
|
+
extraHTTPHeaders?: Readonly<Record<string, string>>;
|
|
50
|
+
}
|
|
51
|
+
interface DimensionResolveContext {
|
|
52
|
+
dimension: string;
|
|
53
|
+
variants: Readonly<Record<string, VariantValue>>;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
interface DimensionDefinition<TValue extends VariantValue = VariantValue> extends ExtensionInfo {
|
|
57
|
+
values: readonly TValue[];
|
|
58
|
+
resolve(value: TValue, context: DimensionResolveContext): BrowserStatePatch | Promise<BrowserStatePatch>;
|
|
59
|
+
}
|
|
60
|
+
interface ScenarioContext {
|
|
61
|
+
baseUrl: URL;
|
|
62
|
+
recipeId: string;
|
|
63
|
+
variantKey: string;
|
|
64
|
+
variants: Readonly<Record<string, VariantValue>>;
|
|
65
|
+
fetch: typeof globalThis.fetch;
|
|
66
|
+
signal?: AbortSignal;
|
|
67
|
+
}
|
|
68
|
+
interface ScenarioResult {
|
|
69
|
+
variables?: JsonObject;
|
|
70
|
+
browser?: BrowserStatePatch;
|
|
71
|
+
cleanup?: () => void | Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
interface ScenarioDefinition<TInput extends JsonObject = JsonObject> extends ExtensionInfo {
|
|
74
|
+
schema: object;
|
|
75
|
+
datasetRevision?: string;
|
|
76
|
+
prepare(context: ScenarioContext, input: TInput): ScenarioResult | Promise<ScenarioResult>;
|
|
77
|
+
}
|
|
78
|
+
interface TranslationContext {
|
|
79
|
+
locale: string;
|
|
80
|
+
args: Readonly<Record<string, JsonValue>>;
|
|
81
|
+
variables: Readonly<JsonObject>;
|
|
82
|
+
}
|
|
83
|
+
interface TranslationProvider extends ExtensionInfo {
|
|
84
|
+
resolve(message: string, context: TranslationContext): string | Promise<string>;
|
|
85
|
+
}
|
|
86
|
+
interface ServerConfig {
|
|
87
|
+
url: string;
|
|
88
|
+
command?: string;
|
|
89
|
+
timeoutMs?: number;
|
|
90
|
+
}
|
|
91
|
+
interface SafetyConfig {
|
|
92
|
+
allowedOrigins?: readonly string[];
|
|
93
|
+
}
|
|
94
|
+
interface GuideShotConfig {
|
|
95
|
+
recipes: readonly string[];
|
|
96
|
+
outputDir: string;
|
|
97
|
+
cacheDir: string;
|
|
98
|
+
server: ServerConfig;
|
|
99
|
+
safety?: SafetyConfig;
|
|
100
|
+
targetAttribute?: `data-${string}`;
|
|
101
|
+
profiles: Readonly<Record<string, CaptureProfile>>;
|
|
102
|
+
dimensions?: Readonly<Record<string, DimensionDefinition>>;
|
|
103
|
+
scenarios?: Readonly<Record<string, ScenarioDefinition>>;
|
|
104
|
+
translations?: TranslationProvider;
|
|
105
|
+
driver: BrowserDriver;
|
|
106
|
+
renderer: AnnotationRenderer;
|
|
107
|
+
}
|
|
108
|
+
interface BrowserEnvironment {
|
|
109
|
+
driver: string;
|
|
110
|
+
driverVersion: string;
|
|
111
|
+
browser: string;
|
|
112
|
+
browserVersion: string;
|
|
113
|
+
platform?: string;
|
|
114
|
+
}
|
|
115
|
+
interface DriverRunOptions {
|
|
116
|
+
baseUrl: URL;
|
|
117
|
+
targetAttribute: `data-${string}`;
|
|
118
|
+
signal?: AbortSignal;
|
|
119
|
+
}
|
|
120
|
+
interface ResolvedCaptureJob {
|
|
121
|
+
key: string;
|
|
122
|
+
recipeId: string;
|
|
123
|
+
variantKey: string;
|
|
124
|
+
variants: Readonly<Record<string, VariantValue>>;
|
|
125
|
+
profile: CaptureProfile;
|
|
126
|
+
page: {
|
|
127
|
+
path: string;
|
|
128
|
+
};
|
|
129
|
+
prepare: readonly Action[];
|
|
130
|
+
ready: readonly Expectation[];
|
|
131
|
+
capture: NonNullable<Recipe['capture']> | Record<string, never>;
|
|
132
|
+
browser: BrowserStatePatch;
|
|
133
|
+
safeVariables: JsonObject;
|
|
134
|
+
}
|
|
135
|
+
interface CaptureRequest {
|
|
136
|
+
job: ResolvedCaptureJob;
|
|
137
|
+
captureKey: string;
|
|
138
|
+
}
|
|
139
|
+
interface BrowserDriver extends ExtensionInfo {
|
|
140
|
+
describeEnvironment(): Promise<BrowserEnvironment>;
|
|
141
|
+
open(options: DriverRunOptions): Promise<BrowserRun>;
|
|
142
|
+
}
|
|
143
|
+
interface BrowserRun {
|
|
144
|
+
capture(request: CaptureRequest): Promise<CaptureResult>;
|
|
145
|
+
close(): Promise<void>;
|
|
146
|
+
}
|
|
147
|
+
interface Rect {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
}
|
|
153
|
+
interface SceneTarget {
|
|
154
|
+
rect: Rect;
|
|
155
|
+
visible: boolean;
|
|
156
|
+
borderRadius?: number;
|
|
157
|
+
}
|
|
158
|
+
interface SceneViewport extends Viewport {
|
|
159
|
+
pixelRatio: number;
|
|
160
|
+
scrollX: number;
|
|
161
|
+
scrollY: number;
|
|
162
|
+
}
|
|
163
|
+
interface SceneBackground {
|
|
164
|
+
/**
|
|
165
|
+
* The image is already cropped to `frame`. Its dimensions are physical
|
|
166
|
+
* pixels; frame and target geometry use CSS pixels.
|
|
167
|
+
*/
|
|
168
|
+
file: string;
|
|
169
|
+
width: number;
|
|
170
|
+
height: number;
|
|
171
|
+
format: 'png';
|
|
172
|
+
sha256: string;
|
|
173
|
+
}
|
|
174
|
+
interface CapturedScene {
|
|
175
|
+
version: 1;
|
|
176
|
+
captureKey: string;
|
|
177
|
+
recipeId: string;
|
|
178
|
+
variantKey: string;
|
|
179
|
+
variants: Readonly<Record<string, VariantValue>>;
|
|
180
|
+
frame: Rect;
|
|
181
|
+
viewport: SceneViewport;
|
|
182
|
+
targets: Readonly<Record<string, SceneTarget>>;
|
|
183
|
+
locale: string;
|
|
184
|
+
direction: 'ltr' | 'rtl';
|
|
185
|
+
theme?: string;
|
|
186
|
+
safeVariables: JsonObject;
|
|
187
|
+
background: SceneBackground;
|
|
188
|
+
environment: BrowserEnvironment;
|
|
189
|
+
sanitized: true;
|
|
190
|
+
}
|
|
191
|
+
interface CaptureResult {
|
|
192
|
+
scene: CapturedScene;
|
|
193
|
+
background: Uint8Array;
|
|
194
|
+
}
|
|
195
|
+
interface ResolvedAnnotation {
|
|
196
|
+
definition: Annotation;
|
|
197
|
+
text?: string;
|
|
198
|
+
}
|
|
199
|
+
type OutputFormat = 'png' | 'webp';
|
|
200
|
+
interface CompositionOutput {
|
|
201
|
+
formats: readonly OutputFormat[];
|
|
202
|
+
quality?: number;
|
|
203
|
+
width?: number;
|
|
204
|
+
height?: number;
|
|
205
|
+
}
|
|
206
|
+
interface CompositionRequest {
|
|
207
|
+
scene: CapturedScene;
|
|
208
|
+
background: Uint8Array;
|
|
209
|
+
annotations: readonly ResolvedAnnotation[];
|
|
210
|
+
output: CompositionOutput;
|
|
211
|
+
theme?: string;
|
|
212
|
+
}
|
|
213
|
+
interface RenderedAsset {
|
|
214
|
+
format: OutputFormat;
|
|
215
|
+
mimeType: 'image/png' | 'image/webp';
|
|
216
|
+
bytes: Uint8Array;
|
|
217
|
+
width: number;
|
|
218
|
+
height: number;
|
|
219
|
+
}
|
|
220
|
+
interface AnnotationRenderer extends ExtensionInfo {
|
|
221
|
+
open(): Promise<RendererRun>;
|
|
222
|
+
}
|
|
223
|
+
interface RendererRun {
|
|
224
|
+
render(request: CompositionRequest): Promise<readonly RenderedAsset[]>;
|
|
225
|
+
close(): Promise<void>;
|
|
226
|
+
}
|
|
227
|
+
interface MatrixDefinition {
|
|
228
|
+
dimensions: Readonly<Record<string, readonly VariantValue[]>>;
|
|
229
|
+
include?: readonly Readonly<Record<string, VariantValue>>[];
|
|
230
|
+
exclude?: readonly Readonly<Record<string, VariantValue>>[];
|
|
231
|
+
}
|
|
232
|
+
interface VariantRow {
|
|
233
|
+
key: string;
|
|
234
|
+
values: Readonly<Record<string, VariantValue>>;
|
|
235
|
+
}
|
|
236
|
+
interface CaptureIntent {
|
|
237
|
+
recipeId: string;
|
|
238
|
+
profile: string;
|
|
239
|
+
serverUrl: string;
|
|
240
|
+
targetAttribute: `data-${string}`;
|
|
241
|
+
variants: Readonly<Record<string, VariantValue>>;
|
|
242
|
+
page: Recipe['page'];
|
|
243
|
+
scenario?: Recipe['scenario'];
|
|
244
|
+
prepare?: Recipe['prepare'];
|
|
245
|
+
ready?: Recipe['ready'];
|
|
246
|
+
capture?: Recipe['capture'];
|
|
247
|
+
profileConfig: CaptureProfile;
|
|
248
|
+
scenarioVersion?: string;
|
|
249
|
+
datasetRevision?: string;
|
|
250
|
+
dimensionVersions: Readonly<Record<string, string>>;
|
|
251
|
+
driver: Pick<BrowserDriver, 'name' | 'version'>;
|
|
252
|
+
translationVersion?: string;
|
|
253
|
+
}
|
|
254
|
+
interface CompositionIntent {
|
|
255
|
+
sceneHash: string;
|
|
256
|
+
annotations?: Recipe['annotations'];
|
|
257
|
+
accessibility: Recipe['accessibility'];
|
|
258
|
+
output?: Recipe['output'];
|
|
259
|
+
renderer: Pick<AnnotationRenderer, 'name' | 'version'>;
|
|
260
|
+
translationVersion?: string;
|
|
261
|
+
}
|
|
262
|
+
interface PlannedJob {
|
|
263
|
+
key: string;
|
|
264
|
+
recipeId: string;
|
|
265
|
+
recipeFile: string;
|
|
266
|
+
profile: string;
|
|
267
|
+
variantKey: string;
|
|
268
|
+
variants: Readonly<Record<string, VariantValue>>;
|
|
269
|
+
captureKey: string;
|
|
270
|
+
captureIntent: CaptureIntent;
|
|
271
|
+
compositionIntent: Omit<CompositionIntent, 'sceneHash'>;
|
|
272
|
+
recipe: Recipe;
|
|
273
|
+
}
|
|
274
|
+
interface RecipeSource {
|
|
275
|
+
file: string;
|
|
276
|
+
recipe: Recipe;
|
|
277
|
+
}
|
|
278
|
+
interface Plan {
|
|
279
|
+
jobs: readonly PlannedJob[];
|
|
280
|
+
recipes: readonly RecipeSource[];
|
|
281
|
+
}
|
|
282
|
+
declare function defineConfig<const TConfig extends GuideShotConfig>(config: TConfig): TConfig;
|
|
283
|
+
declare function defineDimension<const TValue extends VariantValue, const TDefinition extends DimensionDefinition<TValue>>(definition: TDefinition): TDefinition;
|
|
284
|
+
declare function defineScenario<const TInput extends JsonObject, const TDefinition extends ScenarioDefinition<TInput>>(definition: TDefinition): TDefinition;
|
|
285
|
+
|
|
286
|
+
declare const DIAGNOSTIC_CODES: readonly ["RECIPE_SCHEMA_INVALID", "EXTENSION_NOT_REGISTERED", "VARIABLE_UNRESOLVED", "SERVER_NOT_READY", "ORIGIN_NOT_ALLOWED", "SCENARIO_FAILED", "NAVIGATION_FAILED", "TARGET_NOT_FOUND", "TARGET_NOT_UNIQUE", "TARGET_NOT_VISIBLE", "EXPECTATION_FAILED", "LAYOUT_UNSTABLE", "ANNOTATION_LAYOUT_FAILED", "PRIVACY_POLICY_FAILED", "CAPTURE_FAILED", "COMPOSITION_FAILED", "OUTPUT_COLLISION", "MANIFEST_INVALID", "OUTPUT_STALE"];
|
|
287
|
+
type DiagnosticCode = (typeof DIAGNOSTIC_CODES)[number];
|
|
288
|
+
type DiagnosticSeverity = 'error' | 'warning';
|
|
289
|
+
interface DiagnosticLocation {
|
|
290
|
+
file?: string;
|
|
291
|
+
path?: string;
|
|
292
|
+
line?: number;
|
|
293
|
+
column?: number;
|
|
294
|
+
}
|
|
295
|
+
interface Diagnostic {
|
|
296
|
+
code: DiagnosticCode;
|
|
297
|
+
severity: DiagnosticSeverity;
|
|
298
|
+
message: string;
|
|
299
|
+
hint?: string;
|
|
300
|
+
recipeId?: string;
|
|
301
|
+
jobKey?: string;
|
|
302
|
+
location?: DiagnosticLocation;
|
|
303
|
+
details?: JsonObject;
|
|
304
|
+
}
|
|
305
|
+
interface GuideShotErrorOptions {
|
|
306
|
+
hint?: string;
|
|
307
|
+
recipeId?: string;
|
|
308
|
+
jobKey?: string;
|
|
309
|
+
location?: DiagnosticLocation;
|
|
310
|
+
details?: JsonObject;
|
|
311
|
+
cause?: unknown;
|
|
312
|
+
}
|
|
313
|
+
declare class GuideShotError extends Error {
|
|
314
|
+
readonly name = "GuideShotError";
|
|
315
|
+
readonly code: DiagnosticCode;
|
|
316
|
+
readonly hint: string | undefined;
|
|
317
|
+
readonly recipeId: string | undefined;
|
|
318
|
+
readonly jobKey: string | undefined;
|
|
319
|
+
readonly location: DiagnosticLocation | undefined;
|
|
320
|
+
readonly details: JsonObject | undefined;
|
|
321
|
+
constructor(code: DiagnosticCode, message: string, options?: GuideShotErrorOptions);
|
|
322
|
+
toDiagnostic(): Diagnostic;
|
|
323
|
+
}
|
|
324
|
+
declare function isGuideShotError(error: unknown): error is GuideShotError;
|
|
325
|
+
declare function diagnosticFromUnknown(error: unknown, fallbackCode: DiagnosticCode): Diagnostic;
|
|
326
|
+
|
|
327
|
+
declare function discoverRecipes(config: Pick<GuideShotConfig, 'recipes'>, projectRoot: string): Promise<RecipeSource[]>;
|
|
328
|
+
declare function assertUniqueRecipeIds(sources: readonly RecipeSource[]): void;
|
|
329
|
+
|
|
330
|
+
interface InterpolationContext {
|
|
331
|
+
scenario?: Readonly<JsonObject>;
|
|
332
|
+
variant: Readonly<Record<string, VariantValue>>;
|
|
333
|
+
}
|
|
334
|
+
declare function interpolate<T>(value: T, context: InterpolationContext): T;
|
|
335
|
+
declare function interpolateString(value: string, context: InterpolationContext): JsonValue;
|
|
336
|
+
|
|
337
|
+
interface ManifestAssetInput {
|
|
338
|
+
recipeId: string;
|
|
339
|
+
title?: string;
|
|
340
|
+
variantKey: string;
|
|
341
|
+
src: string;
|
|
342
|
+
width: number;
|
|
343
|
+
height: number;
|
|
344
|
+
format: OutputFormat$1;
|
|
345
|
+
hash: string;
|
|
346
|
+
alt: string;
|
|
347
|
+
}
|
|
348
|
+
declare function buildPublicManifest(assets: readonly ManifestAssetInput[]): PublicManifest;
|
|
349
|
+
declare function createAssetPath(recipeId: string, variantKey: string, hash: string, format: OutputFormat$1): string;
|
|
350
|
+
|
|
351
|
+
declare function expandMatrix(matrix?: MatrixDefinition): VariantRow[];
|
|
352
|
+
declare function createVariantKey(variants: Readonly<Record<string, VariantValue>>): string;
|
|
353
|
+
declare function matchesVariantFilter(variants: Readonly<Record<string, VariantValue>>, filter: Readonly<Record<string, VariantValue>>): boolean;
|
|
354
|
+
|
|
355
|
+
interface PlanOptions {
|
|
356
|
+
ids?: readonly string[];
|
|
357
|
+
tags?: readonly string[];
|
|
358
|
+
variants?: Readonly<Record<string, VariantValue>>;
|
|
359
|
+
}
|
|
360
|
+
declare function planProject(config: GuideShotConfig, projectRoot: string, options?: PlanOptions): Promise<Plan>;
|
|
361
|
+
declare function planRecipes(config: GuideShotConfig, sources: readonly RecipeSource[], options?: PlanOptions): Plan;
|
|
362
|
+
declare function createJobCompositionHash(job: Pick<PlannedJob, 'compositionIntent'>, sceneHash: string): string;
|
|
363
|
+
|
|
364
|
+
interface ResolveJobOptions {
|
|
365
|
+
baseUrl: URL;
|
|
366
|
+
signal?: AbortSignal;
|
|
367
|
+
fetch?: typeof globalThis.fetch;
|
|
368
|
+
}
|
|
369
|
+
interface ResolvedJob {
|
|
370
|
+
capture: ResolvedCaptureJob;
|
|
371
|
+
recipe: Recipe;
|
|
372
|
+
cleanup?: () => void | Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
declare function resolveJob(planned: PlannedJob, config: GuideShotConfig, options: ResolveJobOptions): Promise<ResolvedJob>;
|
|
375
|
+
declare function mergeBrowserState(...patches: readonly BrowserStatePatch[]): BrowserStatePatch;
|
|
376
|
+
|
|
377
|
+
declare function assertAllowedOrigin(value: string | URL, allowedOrigins?: readonly string[]): URL;
|
|
378
|
+
declare function resolvePageUrl(baseUrl: string | URL, pagePath: string): URL;
|
|
379
|
+
interface SafeProjectPaths {
|
|
380
|
+
outputDir: string;
|
|
381
|
+
cacheDir: string;
|
|
382
|
+
}
|
|
383
|
+
declare function resolveSafeProjectPaths(projectRoot: string, outputDir: string, cacheDir: string): SafeProjectPaths;
|
|
384
|
+
declare function resolveArtifactPath(outputDir: string, relativePath: string): string;
|
|
385
|
+
declare function sanitizeFileSegment(value: string): string;
|
|
386
|
+
|
|
387
|
+
interface ResolveTextContext {
|
|
388
|
+
locale: string;
|
|
389
|
+
variables: Readonly<JsonObject>;
|
|
390
|
+
variants: Readonly<Record<string, VariantValue>>;
|
|
391
|
+
}
|
|
392
|
+
declare function resolveLocalizedText(value: LocalizedText, provider: TranslationProvider | undefined, context: ResolveTextContext): Promise<string>;
|
|
393
|
+
declare function resolveRecipeText(recipe: Recipe, provider: TranslationProvider | undefined, context: ResolveTextContext): Promise<Recipe>;
|
|
394
|
+
declare function resolvedAnnotations(recipe: Recipe): ResolvedAnnotation[];
|
|
395
|
+
declare function resolvedAlt(recipe: Recipe): string;
|
|
396
|
+
|
|
397
|
+
interface ParseRecipeOptions {
|
|
398
|
+
file?: string;
|
|
399
|
+
format?: 'json' | 'jsonc';
|
|
400
|
+
}
|
|
401
|
+
declare function parseRecipe(source: string, options?: ParseRecipeOptions): Recipe;
|
|
402
|
+
declare function validateRecipe(value: unknown, file?: string): Recipe;
|
|
403
|
+
declare function validateManifest(value: unknown, file?: string): PublicManifest;
|
|
404
|
+
declare function validateConfig(config: GuideShotConfig): void;
|
|
405
|
+
declare function validateRecipeSemantics(source: RecipeSource, config: GuideShotConfig): void;
|
|
406
|
+
declare function defaultProfileName(config: GuideShotConfig): string;
|
|
407
|
+
|
|
408
|
+
export { type AnnotationRenderer, type BrowserCookie, type BrowserDriver, type BrowserEnvironment, type BrowserRun, type BrowserStatePatch, type CaptureIntent, type CaptureProfile, type CaptureRequest, type CaptureResult, type CapturedScene, type CompositionIntent, type CompositionOutput, type CompositionRequest, DIAGNOSTIC_CODES, type Diagnostic, type DiagnosticCode, type DiagnosticLocation, type DiagnosticSeverity, type DimensionDefinition, type DimensionResolveContext, type DriverRunOptions, type ExtensionInfo, type GuideShotConfig, GuideShotError, type GuideShotErrorOptions, type InterpolationContext, type LocalStorageState, type ManifestAssetInput, type MatrixDefinition, type ParseRecipeOptions, type Plan, type PlanOptions, type PlannedJob, type RecipeSource, type Rect, type RenderedAsset, type RendererRun, type ResolveJobOptions, type ResolveTextContext, type ResolvedAnnotation, type ResolvedCaptureJob, type ResolvedJob, type SafeProjectPaths, type SafetyConfig, type ScenarioContext, type ScenarioDefinition, type ScenarioResult, type SceneBackground, type SceneTarget, type SceneViewport, type ServerConfig, type TranslationContext, type TranslationProvider, type VariantRow, type Viewport, assertAllowedOrigin, assertUniqueRecipeIds, buildPublicManifest, canonicalSerialize, createAssetPath, createCaptureHash, createCompositionHash, createJobCompositionHash, createVariantKey, defaultProfileName, defineConfig, defineDimension, defineScenario, diagnosticFromUnknown, discoverRecipes, expandMatrix, hashCanonical, interpolate, interpolateString, isGuideShotError, matchesVariantFilter, mergeBrowserState, parseRecipe, planProject, planRecipes, resolveArtifactPath, resolveJob, resolveLocalizedText, resolvePageUrl, resolveRecipeText, resolveSafeProjectPaths, resolvedAlt, resolvedAnnotations, sanitizeFileSegment, sha256, validateConfig, validateManifest, validateRecipe, validateRecipeSemantics };
|