@cappa/plugin-storybook 0.4.0 → 0.4.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,5 +1,5 @@
1
1
 
2
- > @cappa/plugin-storybook@0.4.0 build /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook
2
+ > @cappa/plugin-storybook@0.4.1 build /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: {"index":"src/index.esm.ts"}
@@ -30,14 +30,24 @@
30
30
  ESM Build start
31
31
  CLI Cleaning output folder
32
32
  ESM Build start
33
+ CJS Build start
33
34
  ESM dist/browser.js 138.00 B
34
- ESM ⚡️ Build success in 26ms
35
+ ESM ⚡️ Build success in 62ms
36
+ CJS dist/browser.cjs 1.12 KB
37
+ CJS ⚡️ Build success in 65ms
35
38
  ESM dist/preview.js 1.58 KB
36
- ESM ⚡️ Build success in 41ms
37
- ESM dist/index.js 12.35 KB
38
- ESM ⚡️ Build success in 58ms
39
+ ESM ⚡️ Build success in 74ms
39
40
  CJS dist/index.cjs 14.08 KB
40
- CJS ⚡️ Build success in 50ms
41
+ CJS ⚡️ Build success in 86ms
42
+ ESM dist/index.js 12.35 KB
43
+ ESM ⚡️ Build success in 94ms
44
+ DTS Build start
45
+ DTS Build start
41
46
  DTS Build start
42
- DTS ⚡️ Build success in 3847ms
43
- DTS dist/index.d.ts 2.66 KB
47
+ DTS ⚡️ Build success in 5054ms
48
+ DTS dist/browser.d.ts 117.00 B
49
+ DTS dist/browser.d.cts 117.00 B
50
+ DTS ⚡️ Build success in 6179ms
51
+ DTS dist/index.esm.d.ts 2.66 KB
52
+ DTS ⚡️ Build success in 6343ms
53
+ DTS dist/index.cjs.d.cts 2.66 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @cappa/plugin-storybook
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 298486b: fix: package export types
8
+ - Updated dependencies [298486b]
9
+ - @cappa/logger@0.0.6
10
+ - @cappa/core@0.4.1
11
+
3
12
  ## 0.4.0
4
13
 
5
14
  ### Minor Changes
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/storybook/addon/browser.ts
21
+ var browser_exports = {};
22
+ __export(browser_exports, {
23
+ isCappa: () => isCappa
24
+ });
25
+ module.exports = __toCommonJS(browser_exports);
26
+ var isCappa = () => {
27
+ return navigator.userAgent.includes("CappaStorybook");
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ isCappa
32
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if the current window is a cappa window
3
+ */
4
+ declare const isCappa: () => boolean;
5
+
6
+ export { isCappa };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if the current window is a cappa window
3
+ */
4
+ declare const isCappa: () => boolean;
5
+
6
+ export { isCappa };
@@ -0,0 +1,81 @@
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, type StorybookPluginOptions, cappaPluginStorybook, previewAnnotations };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cappa/plugin-storybook",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Storybook plugin for Cappa - takes screenshots of Storybook stories",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,15 +14,27 @@
14
14
  "type": "module",
15
15
  "main": "./dist/index.cjs",
16
16
  "module": "./dist/index.js",
17
- "types": "./dist/index.d.ts",
17
+ "types": "./dist/index.esm.d.ts",
18
18
  "exports": {
19
19
  ".": {
20
- "types": "./dist/index.d.ts",
21
- "require": "./dist/index.cjs",
22
- "import": "./dist/index.js"
20
+ "import": {
21
+ "types": "./dist/index.esm.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/index.cjs.d.cts",
26
+ "default": "./dist/index.cjs"
27
+ }
23
28
  },
24
29
  "./browser": {
25
- "default": "./dist/browser.js"
30
+ "import": {
31
+ "types": "./dist/browser.d.ts",
32
+ "default": "./dist/browser.js"
33
+ },
34
+ "require": {
35
+ "types": "./dist/browser.d.cts",
36
+ "default": "./dist/browser.cjs"
37
+ }
26
38
  },
27
39
  "./package.json": "./package.json"
28
40
  },
@@ -44,8 +56,8 @@
44
56
  "@swc/core": "^1.14.0",
45
57
  "chalk": "^5.6.2",
46
58
  "minimatch": "^10.1.1",
47
- "@cappa/core": "0.4.0",
48
- "@cappa/logger": "0.0.5"
59
+ "@cappa/core": "0.4.1",
60
+ "@cappa/logger": "0.0.6"
49
61
  },
50
62
  "devDependencies": {
51
63
  "@types/node": "24.9.2",
@@ -55,11 +67,13 @@
55
67
  "tsup": "8.5.0",
56
68
  "typescript": "5.9.3",
57
69
  "vitest": "4.0.6",
58
- "storybook": "^10.0.2"
70
+ "storybook": "^10.0.2",
71
+ "@arethetypeswrong/cli": "0.18.2"
59
72
  },
60
73
  "scripts": {
61
74
  "test": "vitest",
62
75
  "build": "tsup",
63
- "tsc": "tsc"
76
+ "tsc": "tsc",
77
+ "attw": "attw --pack --profile node16 ."
64
78
  }
65
79
  }
package/tsup.config.ts CHANGED
@@ -4,7 +4,7 @@ export default defineConfig([
4
4
  {
5
5
  entry: { index: "src/index.esm.ts" },
6
6
  format: ["esm"],
7
- dts: true,
7
+ dts: { entry: "src/index.esm.ts" },
8
8
  splitting: false,
9
9
  external: ["./preview.js"],
10
10
  sourcemap: false,
@@ -13,6 +13,7 @@ export default defineConfig([
13
13
  {
14
14
  entry: { index: "src/index.cjs.ts" },
15
15
  format: ["cjs"],
16
+ dts: { entry: "src/index.cjs.ts" },
16
17
  splitting: false,
17
18
  external: ["./preview.js"],
18
19
  sourcemap: false,
@@ -29,7 +30,8 @@ export default defineConfig([
29
30
  {
30
31
  entry: ["src/storybook/addon/browser.ts"],
31
32
  target: "es2015",
32
- format: ["esm"],
33
+ format: ["esm", "cjs"],
34
+ dts: true,
33
35
  splitting: false,
34
36
  sourcemap: false,
35
37
  clean: true,
File without changes