@guideshot/core 0.2.0 → 0.3.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/README.md CHANGED
@@ -13,3 +13,5 @@ const recipe = parseRecipe(source, { file: 'example.shot.json' });
13
13
  ```
14
14
 
15
15
  Browser drivers and annotation renderers are injected through `defineConfig`. Requires Node.js 20 or newer and is licensed under the MIT License.
16
+
17
+ Scenario definitions remain isolated per job by default. Deterministic, read-only adapters may set `reusePreparedState: true`; shared mutable adapters should use `concurrencyKey` instead.
package/dist/index.d.ts CHANGED
@@ -74,6 +74,7 @@ interface ScenarioDefinition<TInput extends JsonObject = JsonObject> extends Ext
74
74
  schema: object;
75
75
  datasetRevision?: string;
76
76
  concurrencyKey?: string;
77
+ reusePreparedState?: boolean;
77
78
  prepare(context: ScenarioContext, input: TInput): ScenarioResult | Promise<ScenarioResult>;
78
79
  }
79
80
  interface TranslationContext {
@@ -147,6 +148,7 @@ interface BrowserDriver extends ExtensionInfo {
147
148
  }
148
149
  interface BrowserRun {
149
150
  capture(request: CaptureRequest): Promise<CaptureResult>;
151
+ captureMany?(requests: readonly CaptureRequest[]): Promise<readonly CaptureResult[]>;
150
152
  close(): Promise<void>;
151
153
  }
152
154
  interface Rect {
package/dist/index.js CHANGED
@@ -259,6 +259,12 @@ function validateConfig(config) {
259
259
  "Scenario concurrency keys cannot be empty."
260
260
  );
261
261
  }
262
+ if (scenario.reusePreparedState !== void 0 && typeof scenario.reusePreparedState !== "boolean") {
263
+ throw new GuideShotError(
264
+ "RECIPE_SCHEMA_INVALID",
265
+ "Scenario prepared-state reuse must be a boolean."
266
+ );
267
+ }
262
268
  }
263
269
  for (const [name, profile] of Object.entries(config.profiles)) {
264
270
  if (!Number.isInteger(profile.viewport.width) || profile.viewport.width <= 0 || !Number.isInteger(profile.viewport.height) || profile.viewport.height <= 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guideshot/core",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Portable compiler and contracts for GuideShot.",
5
5
  "license": "MIT",
6
6
  "keywords": [