@cappa/plugin-storybook 0.2.6 → 0.3.1

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.
@@ -1,38 +1,43 @@
1
1
 
2
- > @cappa/plugin-storybook@0.2.6 build /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook
2
+ > @cappa/plugin-storybook@0.3.1 build /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook
3
3
  > tsup
4
4
 
5
- CLI Building entry: src/index.ts
5
+ CLI Building entry: {"index":"src/index.esm.ts"}
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI Building entry: {"index":"src/index.cjs.ts"}
6
8
  CLI Using tsconfig: tsconfig.json
7
9
  CLI tsup v8.5.0
8
10
  CLI Using tsup config: /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook/tsup.config.ts
9
- CLI Building entry: src/storybook/addon/browser.ts
10
- CLI Using tsconfig: tsconfig.json
11
11
  CLI tsup v8.5.0
12
12
  CLI Using tsup config: /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook/tsup.config.ts
13
13
  CLI Building entry: src/storybook/addon/preview.ts
14
14
  CLI Using tsconfig: tsconfig.json
15
15
  CLI tsup v8.5.0
16
16
  CLI Using tsup config: /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook/tsup.config.ts
17
+ CLI Building entry: src/storybook/addon/browser.ts
18
+ CLI Using tsconfig: tsconfig.json
19
+ CLI tsup v8.5.0
20
+ CLI Using tsup config: /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook/tsup.config.ts
21
+ CLI Target: esnext
17
22
  CLI Target: esnext
18
- CLI Target: es2015
19
23
  CLI Target: node16
24
+ CLI Target: es2015
20
25
  CLI Cleaning output folder
21
- CJS Build start
22
26
  ESM Build start
23
27
  CLI Cleaning output folder
28
+ CJS Build start
29
+ CLI Cleaning output folder
24
30
  ESM Build start
25
31
  CLI Cleaning output folder
26
32
  ESM Build start
27
- ESM dist/browser.mjs 138.00 B
28
- ESM ⚡️ Build success in 50ms
29
- ESM dist/preview.mjs 1.41 KB
30
- ESM ⚡️ Build success in 46ms
31
- CJS dist/index.js 13.96 KB
32
- CJS ⚡️ Build success in 62ms
33
- ESM dist/index.mjs 12.52 KB
34
- ESM ⚡️ Build success in 63ms
33
+ ESM dist/preview.js 1.41 KB
34
+ ESM ⚡️ Build success in 36ms
35
+ ESM dist/browser.js 138.00 B
36
+ ESM ⚡️ Build success in 34ms
37
+ ESM dist/index.js 12.25 KB
38
+ ESM ⚡️ Build success in 42ms
39
+ CJS dist/index.cjs 13.98 KB
40
+ CJS ⚡️ Build success in 48ms
35
41
  DTS Build start
36
- DTS ⚡️ Build success in 3613ms
37
- DTS dist/index.d.ts 2.63 KB
38
- DTS dist/index.d.mts 2.63 KB
42
+ DTS ⚡️ Build success in 3692ms
43
+ DTS dist/index.d.ts 2.63 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @cappa/plugin-storybook
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fd97a08: fix: emitted types
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 78c4e4c: feat: support storybook 10
14
+
3
15
  ## 0.2.6
4
16
 
5
17
  ### Patch Changes
@@ -1,13 +1,43 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.cjs.ts
31
+ var index_cjs_exports = {};
32
+ __export(index_cjs_exports, {
33
+ cappaPluginStorybook: () => cappaPluginStorybook,
34
+ previewAnnotations: () => previewAnnotations
6
35
  });
36
+ module.exports = __toCommonJS(index_cjs_exports);
7
37
 
8
38
  // src/cappa/plugin.ts
9
- import { getLogger } from "@cappa/logger";
10
- import { minimatch } from "minimatch";
39
+ var import_logger = require("@cappa/logger");
40
+ var import_minimatch = require("minimatch");
11
41
 
12
42
  // src/cappa/storybook-url.ts
13
43
  function encodePairs(obj) {
@@ -121,7 +151,7 @@ var buildFilename = (story) => {
121
151
 
122
152
  // src/cappa/plugin.ts
123
153
  async function waitForPlayFunctionCompletion(page, storyName) {
124
- const logger = getLogger();
154
+ const logger = (0, import_logger.getLogger)();
125
155
  try {
126
156
  const hasPlayFunction = await page.evaluate(
127
157
  () => window.__cappa_has_play_function === true
@@ -149,17 +179,17 @@ async function waitForPlayFunctionCompletion(page, storyName) {
149
179
  }
150
180
  function matchesGlobPatterns(story, patterns) {
151
181
  return patterns.some((pattern) => {
152
- if (minimatch(story.id, pattern)) {
182
+ if ((0, import_minimatch.minimatch)(story.id, pattern)) {
153
183
  return true;
154
184
  }
155
- if (minimatch(story.title, pattern)) {
185
+ if ((0, import_minimatch.minimatch)(story.title, pattern)) {
156
186
  return true;
157
187
  }
158
- if (minimatch(story.name, pattern)) {
188
+ if ((0, import_minimatch.minimatch)(story.name, pattern)) {
159
189
  return true;
160
190
  }
161
191
  const fullPath = `${story.title}/${story.name}`;
162
- if (minimatch(fullPath, pattern)) {
192
+ if ((0, import_minimatch.minimatch)(fullPath, pattern)) {
163
193
  return true;
164
194
  }
165
195
  return false;
@@ -181,7 +211,7 @@ var cappaPluginStorybook = (options) => {
181
211
  if (!options.storybookUrl) {
182
212
  throw new Error("storybookUrl is required");
183
213
  }
184
- const logger = getLogger();
214
+ const logger = (0, import_logger.getLogger)();
185
215
  const {
186
216
  storybookUrl,
187
217
  includeStories = [],
@@ -239,7 +269,7 @@ var cappaPluginStorybook = (options) => {
239
269
  execute: async (task, page, screenshotTool, context) => {
240
270
  const { url, data } = task;
241
271
  const { story } = data;
242
- const logger = getLogger();
272
+ const logger = (0, import_logger.getLogger)();
243
273
  const { storybook: defaultStorybookOptions } = options || {};
244
274
  try {
245
275
  const currentLatch = createLatch();
@@ -375,9 +405,10 @@ var cappaPluginStorybook = (options) => {
375
405
  };
376
406
  };
377
407
 
378
- // src/index.ts
379
- var previewAnnotations = [__require.resolve("./preview.mjs")];
380
- export {
408
+ // src/index.cjs.ts
409
+ var previewAnnotations = [require.resolve("./preview.js")];
410
+ // Annotate the CommonJS export names for ESM import in node:
411
+ 0 && (module.exports = {
381
412
  cappaPluginStorybook,
382
413
  previewAnnotations
383
- };
414
+ });
package/dist/index.js CHANGED
@@ -1,43 +1,9 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- cappaPluginStorybook: () => cappaPluginStorybook,
34
- previewAnnotations: () => previewAnnotations
35
- });
36
- module.exports = __toCommonJS(index_exports);
1
+ // src/index.esm.ts
2
+ import { fileURLToPath } from "url";
37
3
 
38
4
  // src/cappa/plugin.ts
39
- var import_logger = require("@cappa/logger");
40
- var import_minimatch = require("minimatch");
5
+ import { getLogger } from "@cappa/logger";
6
+ import { minimatch } from "minimatch";
41
7
 
42
8
  // src/cappa/storybook-url.ts
43
9
  function encodePairs(obj) {
@@ -151,7 +117,7 @@ var buildFilename = (story) => {
151
117
 
152
118
  // src/cappa/plugin.ts
153
119
  async function waitForPlayFunctionCompletion(page, storyName) {
154
- const logger = (0, import_logger.getLogger)();
120
+ const logger = getLogger();
155
121
  try {
156
122
  const hasPlayFunction = await page.evaluate(
157
123
  () => window.__cappa_has_play_function === true
@@ -179,17 +145,17 @@ async function waitForPlayFunctionCompletion(page, storyName) {
179
145
  }
180
146
  function matchesGlobPatterns(story, patterns) {
181
147
  return patterns.some((pattern) => {
182
- if ((0, import_minimatch.minimatch)(story.id, pattern)) {
148
+ if (minimatch(story.id, pattern)) {
183
149
  return true;
184
150
  }
185
- if ((0, import_minimatch.minimatch)(story.title, pattern)) {
151
+ if (minimatch(story.title, pattern)) {
186
152
  return true;
187
153
  }
188
- if ((0, import_minimatch.minimatch)(story.name, pattern)) {
154
+ if (minimatch(story.name, pattern)) {
189
155
  return true;
190
156
  }
191
157
  const fullPath = `${story.title}/${story.name}`;
192
- if ((0, import_minimatch.minimatch)(fullPath, pattern)) {
158
+ if (minimatch(fullPath, pattern)) {
193
159
  return true;
194
160
  }
195
161
  return false;
@@ -211,7 +177,7 @@ var cappaPluginStorybook = (options) => {
211
177
  if (!options.storybookUrl) {
212
178
  throw new Error("storybookUrl is required");
213
179
  }
214
- const logger = (0, import_logger.getLogger)();
180
+ const logger = getLogger();
215
181
  const {
216
182
  storybookUrl,
217
183
  includeStories = [],
@@ -269,7 +235,7 @@ var cappaPluginStorybook = (options) => {
269
235
  execute: async (task, page, screenshotTool, context) => {
270
236
  const { url, data } = task;
271
237
  const { story } = data;
272
- const logger = (0, import_logger.getLogger)();
238
+ const logger = getLogger();
273
239
  const { storybook: defaultStorybookOptions } = options || {};
274
240
  try {
275
241
  const currentLatch = createLatch();
@@ -405,10 +371,11 @@ var cappaPluginStorybook = (options) => {
405
371
  };
406
372
  };
407
373
 
408
- // src/index.ts
409
- var previewAnnotations = [require.resolve("./preview.mjs")];
410
- // Annotate the CommonJS export names for ESM import in node:
411
- 0 && (module.exports = {
374
+ // src/index.esm.ts
375
+ var previewAnnotations = [
376
+ fileURLToPath(new URL("./preview.js", import.meta.url))
377
+ ];
378
+ export {
412
379
  cappaPluginStorybook,
413
380
  previewAnnotations
414
- });
381
+ };
package/package.json CHANGED
@@ -1,23 +1,24 @@
1
1
  {
2
2
  "name": "@cappa/plugin-storybook",
3
- "version": "0.2.6",
3
+ "version": "0.3.1",
4
4
  "description": "Storybook plugin for Cappa - takes screenshots of Storybook stories",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "main": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
- "module": "CommonJS",
11
8
  "license": "MIT",
12
9
  "author": "Tim Richter",
10
+ "type": "module",
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
13
14
  "exports": {
14
15
  ".": {
15
- "import": "./dist/index.js",
16
- "require": "./dist/index.js"
16
+ "types": "./dist/index.d.ts",
17
+ "require": "./dist/index.cjs",
18
+ "import": "./dist/index.js"
17
19
  },
18
20
  "./browser": {
19
- "import": "./dist/browser.mjs",
20
- "require": "./dist/browser.mjs"
21
+ "default": "./dist/browser.js"
21
22
  },
22
23
  "./package.json": "./package.json"
23
24
  },
@@ -27,21 +28,29 @@
27
28
  "storybook",
28
29
  "visual-testing"
29
30
  ],
31
+ "peerDependencies": {
32
+ "storybook": "^9 || ^10"
33
+ },
34
+ "peerDependenciesMeta": {
35
+ "storybook": {
36
+ "optional": false
37
+ }
38
+ },
30
39
  "dependencies": {
31
- "@swc/core": "^1.13.5",
40
+ "@swc/core": "^1.14.0",
32
41
  "chalk": "^5.6.2",
33
- "minimatch": "^10.0.3",
34
- "storybook": "^9.1.12",
42
+ "minimatch": "^10.1.1",
35
43
  "@cappa/core": "0.3.0",
36
44
  "@cappa/logger": "0.0.4"
37
45
  },
38
46
  "devDependencies": {
39
47
  "@vitest/coverage-v8": "3.2.4",
40
48
  "@vitest/ui": "3.2.4",
41
- "playwright-core": "^1.56.0",
49
+ "playwright-core": "^1.56.1",
42
50
  "tsup": "8.5.0",
43
51
  "typescript": "5.9.3",
44
- "vitest": "3.2.4"
52
+ "vitest": "3.2.4",
53
+ "storybook": "^10.0.2"
45
54
  },
46
55
  "scripts": {
47
56
  "test": "vitest",
@@ -1,5 +1,4 @@
1
- export { cappaPluginStorybook } from "./cappa/plugin";
2
-
3
- export const previewAnnotations = [require.resolve("./preview.mjs")];
1
+ export const previewAnnotations = [require.resolve("./preview.js")];
4
2
 
3
+ export { cappaPluginStorybook } from "./cappa/plugin";
5
4
  export type { ScreenshotOptionsStorybook as CappaStorybookOptions } from "./types";
@@ -0,0 +1,7 @@
1
+ import { fileURLToPath } from "node:url";
2
+ export const previewAnnotations = [
3
+ fileURLToPath(new URL("./preview.js", import.meta.url)),
4
+ ];
5
+
6
+ export { cappaPluginStorybook } from "./cappa/plugin";
7
+ export type { ScreenshotOptionsStorybook as CappaStorybookOptions } from "./types";
package/tsup.config.ts CHANGED
@@ -2,11 +2,19 @@ import { defineConfig } from "tsup";
2
2
 
3
3
  export default defineConfig([
4
4
  {
5
- entry: ["src/index.ts"],
6
- format: ["cjs", "esm"],
5
+ entry: { index: "src/index.esm.ts" },
6
+ format: ["esm"],
7
7
  dts: true,
8
8
  splitting: false,
9
- external: ["./preview.mjs"],
9
+ external: ["./preview.js"],
10
+ sourcemap: false,
11
+ clean: true,
12
+ },
13
+ {
14
+ entry: { index: "src/index.cjs.ts" },
15
+ format: ["cjs"],
16
+ splitting: false,
17
+ external: ["./preview.js"],
10
18
  sourcemap: false,
11
19
  clean: true,
12
20
  },
package/dist/index.d.mts DELETED
@@ -1,81 +0,0 @@
1
- import { Plugin } from '@cappa/core';
2
-
3
- interface StorybookRenderOptions {
4
- viewMode?: "story" | "docs";
5
- args?: Record<string, unknown>;
6
- globals?: Record<string, string | number | boolean>;
7
- query?: Record<string, string | number | boolean>;
8
- fullscreen?: boolean;
9
- singleStory?: boolean;
10
- }
11
- interface ScreenshotVariantOverrideStorybook {
12
- fullPage?: boolean;
13
- delay?: number;
14
- skip?: boolean;
15
- mask?: string[];
16
- omitBackground?: boolean;
17
- viewport?: {
18
- width: number;
19
- height: number;
20
- };
21
- args?: Record<string, unknown>;
22
- }
23
- interface ScreenshotVariantOptionsStorybook {
24
- id: string;
25
- label?: string;
26
- filename?: string;
27
- options?: ScreenshotVariantOverrideStorybook;
28
- }
29
- interface ScreenshotOptionsStorybook extends ScreenshotVariantOverrideStorybook {
30
- variants?: ScreenshotVariantOptionsStorybook[];
31
- }
32
-
33
- interface StorybookPluginOptions {
34
- storybookUrl: string;
35
- /**
36
- * Array of glob patterns to include stories. Stories matching any of these patterns will be included.
37
- * Patterns can match against:
38
- * - Story ID (e.g., "button--primary")
39
- * - Story title (e.g., "Button")
40
- * - Story name (e.g., "Primary")
41
- * - Full story path (e.g., "Button/Primary")
42
- *
43
- * Examples:
44
- * - ["button--*"] - Include all button stories
45
- * - ["*--primary"] - Include all primary stories
46
- * - ["Button/*"] - Include all stories under Button title
47
- * - ["*--*"] - Include all stories
48
- */
49
- includeStories?: string[];
50
- /**
51
- * Array of glob patterns to exclude stories. Stories matching any of these patterns will be excluded.
52
- * Patterns can match against:
53
- * - Story ID (e.g., "button--primary")
54
- * - Story title (e.g., "Button")
55
- * - Story name (e.g., "Primary")
56
- * - Full story path (e.g., "Button/Primary")
57
- *
58
- * Examples:
59
- * - ["button--*"] - Exclude all button stories
60
- * - ["*--secondary"] - Exclude all secondary stories
61
- * - ["Input/*"] - Exclude all stories under Input title
62
- */
63
- excludeStories?: string[];
64
- defaultViewport?: {
65
- width: number;
66
- height: number;
67
- };
68
- waitForSelector?: string;
69
- waitForTimeout?: number;
70
- storybook?: StorybookRenderOptions;
71
- }
72
- /**
73
- * Storybook Plugin for Cappa
74
- * Fetches stories from a running Storybook server and takes screenshots of each story.
75
- * Supports glob pattern matching for includeStories and excludeStories options.
76
- */
77
- declare const cappaPluginStorybook: Plugin<StorybookPluginOptions>;
78
-
79
- declare const previewAnnotations: string[];
80
-
81
- export { type ScreenshotOptionsStorybook as CappaStorybookOptions, cappaPluginStorybook, previewAnnotations };
File without changes
File without changes