@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.
- package/.turbo/turbo-build.log +18 -8
- package/CHANGELOG.md +9 -0
- package/dist/browser.cjs +32 -0
- package/dist/browser.d.cts +6 -0
- package/dist/browser.d.ts +6 -0
- package/dist/index.esm.d.ts +81 -0
- package/package.json +24 -10
- package/tsup.config.ts +4 -2
- /package/dist/{index.d.ts → index.cjs.d.cts} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @cappa/plugin-storybook@0.4.
|
|
2
|
+
> @cappa/plugin-storybook@0.4.1 build /home/runner/work/cappa/cappa/packages/plugins/plugin-storybook
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.esm.ts"}
|
|
@@ -30,14 +30,24 @@
|
|
|
30
30
|
[34mESM[39m Build start
|
|
31
31
|
[34mCLI[39m Cleaning output folder
|
|
32
32
|
[34mESM[39m Build start
|
|
33
|
+
[34mCJS[39m Build start
|
|
33
34
|
[32mESM[39m [1mdist/browser.js [22m[32m138.00 B[39m
|
|
34
|
-
[32mESM[39m ⚡️ Build success in
|
|
35
|
+
[32mESM[39m ⚡️ Build success in 62ms
|
|
36
|
+
[32mCJS[39m [1mdist/browser.cjs [22m[32m1.12 KB[39m
|
|
37
|
+
[32mCJS[39m ⚡️ Build success in 65ms
|
|
35
38
|
[32mESM[39m [1mdist/preview.js [22m[32m1.58 KB[39m
|
|
36
|
-
[32mESM[39m ⚡️ Build success in
|
|
37
|
-
[32mESM[39m [1mdist/index.js [22m[32m12.35 KB[39m
|
|
38
|
-
[32mESM[39m ⚡️ Build success in 58ms
|
|
39
|
+
[32mESM[39m ⚡️ Build success in 74ms
|
|
39
40
|
[32mCJS[39m [1mdist/index.cjs [22m[32m14.08 KB[39m
|
|
40
|
-
[32mCJS[39m ⚡️ Build success in
|
|
41
|
+
[32mCJS[39m ⚡️ Build success in 86ms
|
|
42
|
+
[32mESM[39m [1mdist/index.js [22m[32m12.35 KB[39m
|
|
43
|
+
[32mESM[39m ⚡️ Build success in 94ms
|
|
44
|
+
[34mDTS[39m Build start
|
|
45
|
+
[34mDTS[39m Build start
|
|
41
46
|
[34mDTS[39m Build start
|
|
42
|
-
[32mDTS[39m ⚡️ Build success in
|
|
43
|
-
[32mDTS[39m [1mdist/
|
|
47
|
+
[32mDTS[39m ⚡️ Build success in 5054ms
|
|
48
|
+
[32mDTS[39m [1mdist/browser.d.ts [22m[32m117.00 B[39m
|
|
49
|
+
[32mDTS[39m [1mdist/browser.d.cts [22m[32m117.00 B[39m
|
|
50
|
+
[32mDTS[39m ⚡️ Build success in 6179ms
|
|
51
|
+
[32mDTS[39m [1mdist/index.esm.d.ts [22m[32m2.66 KB[39m
|
|
52
|
+
[32mDTS[39m ⚡️ Build success in 6343ms
|
|
53
|
+
[32mDTS[39m [1mdist/index.cjs.d.cts [22m[32m2.66 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/browser.cjs
ADDED
|
@@ -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,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.
|
|
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
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
"
|
|
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.
|
|
48
|
-
"@cappa/logger": "0.0.
|
|
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:
|
|
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
|