storybook-addon-dependency-previews 0.4.0 → 0.5.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 +82 -0
- package/dist/_virtual/rolldown_runtime.cjs +20 -34
- package/dist/addon/index.cjs +22 -27
- package/dist/addon/index.d.cts +5 -5
- package/dist/addon/index.d.mts +5 -5
- package/dist/addon/index.mjs +18 -18
- package/dist/addon/preset.cjs +4 -3
- package/dist/addon/preset.d.cts +3 -3
- package/dist/addon/preset.d.mts +3 -3
- package/dist/addon/preset.mjs +3 -3
- package/dist/addon/vitePlugin.cjs +17 -22
- package/dist/addon/vitePlugin.cjs.map +1 -1
- package/dist/addon/vitePlugin.d.cts +6 -6
- package/dist/addon/vitePlugin.d.mts +6 -6
- package/dist/addon/vitePlugin.mjs +14 -17
- package/dist/addon/vitePlugin.mjs.map +1 -1
- package/dist/blocks/DependencyPreviews.cjs +66 -192
- package/dist/blocks/DependencyPreviews.cjs.map +1 -1
- package/dist/blocks/DependencyPreviews.d.cts +4 -4
- package/dist/blocks/DependencyPreviews.d.mts +4 -4
- package/dist/blocks/DependencyPreviews.mjs +63 -163
- package/dist/blocks/DependencyPreviews.mjs.map +1 -1
- package/dist/blocks/index.cjs +1 -1
- package/dist/blocks/index.d.cts +1 -1
- package/dist/blocks/index.d.mts +1 -1
- package/dist/blocks/index.mjs +1 -1
- package/dist/cli/sb-deps.cjs +499 -546
- package/dist/cli/sb-deps.cjs.map +1 -1
- package/dist/cli/sb-deps.d.cts +1 -1
- package/dist/cli/sb-deps.d.mts +1 -1
- package/dist/cli/sb-deps.mjs +491 -520
- package/dist/cli/sb-deps.mjs.map +1 -1
- package/dist/cli/scripts/depcruise.config.cjs +20 -19
- package/dist/cli/scripts/depcruise.config.d.cts +4 -4
- package/dist/cli/scripts/depcruise.config.d.mts +4 -4
- package/dist/cli/scripts/depcruise.config.mjs +19 -19
- package/dist/cli/scripts/postprocess.cjs +104 -124
- package/dist/cli/scripts/postprocess.cjs.map +1 -1
- package/dist/cli/scripts/postprocess.d.cts +1 -1
- package/dist/cli/scripts/postprocess.d.mts +1 -1
- package/dist/cli/scripts/postprocess.mjs +101 -115
- package/dist/cli/scripts/postprocess.mjs.map +1 -1
- package/dist/cli/setup/detect.cjs +78 -93
- package/dist/cli/setup/detect.cjs.map +1 -1
- package/dist/cli/setup/detect.d.cts +28 -43
- package/dist/cli/setup/detect.d.mts +28 -43
- package/dist/cli/setup/detect.mjs +74 -78
- package/dist/cli/setup/detect.mjs.map +1 -1
- package/dist/cli/setup/index.cjs +192 -233
- package/dist/cli/setup/index.cjs.map +1 -1
- package/dist/cli/setup/index.d.cts +3 -3
- package/dist/cli/setup/index.d.mts +3 -3
- package/dist/cli/setup/index.mjs +179 -203
- package/dist/cli/setup/index.mjs.map +1 -1
- package/dist/cli/setup/install.cjs +69 -59
- package/dist/cli/setup/install.cjs.map +1 -1
- package/dist/cli/setup/install.d.cts +25 -30
- package/dist/cli/setup/install.d.mts +25 -30
- package/dist/cli/setup/install.mjs +67 -57
- package/dist/cli/setup/install.mjs.map +1 -1
- package/dist/cli/setup/patchers/main.cjs +369 -132
- package/dist/cli/setup/patchers/main.cjs.map +1 -1
- package/dist/cli/setup/patchers/main.d.cts +27 -17
- package/dist/cli/setup/patchers/main.d.mts +27 -17
- package/dist/cli/setup/patchers/main.mjs +367 -122
- package/dist/cli/setup/patchers/main.mjs.map +1 -1
- package/dist/cli/setup/patchers/packageJson.cjs +67 -76
- package/dist/cli/setup/patchers/packageJson.d.cts +22 -31
- package/dist/cli/setup/patchers/packageJson.d.mts +22 -31
- package/dist/cli/setup/patchers/packageJson.mjs +63 -72
- package/dist/cli/setup/patchers/preview.cjs +247 -351
- package/dist/cli/setup/patchers/preview.cjs.map +1 -1
- package/dist/cli/setup/patchers/preview.d.cts +45 -51
- package/dist/cli/setup/patchers/preview.d.mts +45 -51
- package/dist/cli/setup/patchers/preview.mjs +244 -344
- package/dist/cli/setup/patchers/preview.mjs.map +1 -1
- package/dist/cli/setup/prompt.cjs +28 -28
- package/dist/cli/setup/prompt.d.cts +8 -14
- package/dist/cli/setup/prompt.d.mts +8 -14
- package/dist/cli/setup/prompt.mjs +24 -24
- package/dist/cli/setup/util.cjs +268 -274
- package/dist/cli/setup/util.d.cts +14 -28
- package/dist/cli/setup/util.d.mts +14 -28
- package/dist/cli/setup/util.mjs +262 -276
- package/dist/components/ComponentSourceLink.cjs +31 -53
- package/dist/components/ComponentSourceLink.cjs.map +1 -1
- package/dist/components/ComponentSourceLink.mjs +24 -34
- package/dist/components/ComponentSourceLink.mjs.map +1 -1
- package/dist/components/CopyButton.cjs +71 -98
- package/dist/components/CopyButton.cjs.map +1 -1
- package/dist/components/CopyButton.mjs +67 -90
- package/dist/components/CopyButton.mjs.map +1 -1
- package/dist/components/Expandable.cjs +28 -62
- package/dist/components/Expandable.cjs.map +1 -1
- package/dist/components/Expandable.mjs +25 -52
- package/dist/components/Expandable.mjs.map +1 -1
- package/dist/components/FullParityStory.cjs +29 -31
- package/dist/components/FullParityStory.cjs.map +1 -1
- package/dist/components/FullParityStory.mjs +26 -26
- package/dist/components/FullParityStory.mjs.map +1 -1
- package/dist/components/PathCopyMolecule.cjs +14 -42
- package/dist/components/PathCopyMolecule.cjs.map +1 -1
- package/dist/components/PathCopyMolecule.mjs +11 -28
- package/dist/components/PathCopyMolecule.mjs.map +1 -1
- package/dist/components/PrimaryPreview.cjs +17 -47
- package/dist/components/PrimaryPreview.cjs.map +1 -1
- package/dist/components/PrimaryPreview.mjs +15 -39
- package/dist/components/PrimaryPreview.mjs.map +1 -1
- package/dist/components/SbHeading.cjs +9 -21
- package/dist/components/SbHeading.cjs.map +1 -1
- package/dist/components/SbHeading.mjs +6 -10
- package/dist/components/SbHeading.mjs.map +1 -1
- package/dist/components/StoryLink.cjs +27 -48
- package/dist/components/StoryLink.cjs.map +1 -1
- package/dist/components/StoryLink.mjs +23 -37
- package/dist/components/StoryLink.mjs.map +1 -1
- package/dist/components/TooltipTrigger.cjs +63 -125
- package/dist/components/TooltipTrigger.cjs.map +1 -1
- package/dist/components/TooltipTrigger.mjs +59 -108
- package/dist/components/TooltipTrigger.mjs.map +1 -1
- package/dist/components/icons/ArrowToRectangleIcon.cjs +11 -15
- package/dist/components/icons/ArrowToRectangleIcon.cjs.map +1 -1
- package/dist/components/icons/ArrowToRectangleIcon.mjs +9 -13
- package/dist/components/icons/ArrowToRectangleIcon.mjs.map +1 -1
- package/dist/components/icons/BuildIcon.cjs +11 -15
- package/dist/components/icons/BuildIcon.cjs.map +1 -1
- package/dist/components/icons/BuildIcon.mjs +9 -13
- package/dist/components/icons/BuildIcon.mjs.map +1 -1
- package/dist/components/icons/CopyIcon.cjs +11 -15
- package/dist/components/icons/CopyIcon.cjs.map +1 -1
- package/dist/components/icons/CopyIcon.mjs +9 -13
- package/dist/components/icons/CopyIcon.mjs.map +1 -1
- package/dist/components/icons/CubeIcon.cjs +11 -15
- package/dist/components/icons/CubeIcon.cjs.map +1 -1
- package/dist/components/icons/CubeIcon.mjs +9 -13
- package/dist/components/icons/CubeIcon.mjs.map +1 -1
- package/dist/components/icons/DoubleChevronDown.cjs +11 -15
- package/dist/components/icons/DoubleChevronDown.cjs.map +1 -1
- package/dist/components/icons/DoubleChevronDown.mjs +9 -13
- package/dist/components/icons/DoubleChevronDown.mjs.map +1 -1
- package/dist/components/icons/ExternalLinkIcon.cjs +11 -15
- package/dist/components/icons/ExternalLinkIcon.cjs.map +1 -1
- package/dist/components/icons/ExternalLinkIcon.mjs +9 -13
- package/dist/components/icons/ExternalLinkIcon.mjs.map +1 -1
- package/dist/components/icons/EyeOpen.cjs +15 -20
- package/dist/components/icons/EyeOpen.cjs.map +1 -1
- package/dist/components/icons/EyeOpen.mjs +13 -18
- package/dist/components/icons/EyeOpen.mjs.map +1 -1
- package/dist/components/icons/LoadingRipples.cjs +67 -87
- package/dist/components/icons/LoadingRipples.cjs.map +1 -1
- package/dist/components/icons/LoadingRipples.mjs +65 -85
- package/dist/components/icons/LoadingRipples.mjs.map +1 -1
- package/dist/components/icons/SquaresPlus.cjs +11 -15
- package/dist/components/icons/SquaresPlus.cjs.map +1 -1
- package/dist/components/icons/SquaresPlus.mjs +9 -13
- package/dist/components/icons/SquaresPlus.mjs.map +1 -1
- package/dist/components/icons/Svg.cjs +23 -27
- package/dist/components/icons/Svg.cjs.map +1 -1
- package/dist/components/icons/Svg.mjs +21 -25
- package/dist/components/icons/Svg.mjs.map +1 -1
- package/dist/components/icons/X.cjs +11 -15
- package/dist/components/icons/X.cjs.map +1 -1
- package/dist/components/icons/X.mjs +9 -13
- package/dist/components/icons/X.mjs.map +1 -1
- package/dist/config.cjs +4 -3
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +101 -98
- package/dist/config.d.mts +101 -98
- package/dist/config.mjs +3 -3
- package/dist/config.mjs.map +1 -1
- package/dist/constants.cjs +6 -5
- package/dist/constants.mjs +4 -4
- package/dist/hooks/useDependencyGraph.cjs +39 -53
- package/dist/hooks/useDependencyGraph.cjs.map +1 -1
- package/dist/hooks/useDependencyGraph.mjs +35 -53
- package/dist/hooks/useDependencyGraph.mjs.map +1 -1
- package/dist/hooks/useDynamicStory.cjs +55 -80
- package/dist/hooks/useDynamicStory.cjs.map +1 -1
- package/dist/hooks/useDynamicStory.mjs +52 -77
- package/dist/hooks/useDynamicStory.mjs.map +1 -1
- package/dist/hooks/useStoryParams.cjs +10 -12
- package/dist/hooks/useStoryParams.mjs +8 -8
- package/dist/index.cjs +13 -16
- package/dist/index.d.cts +8 -45
- package/dist/index.d.mts +8 -45
- package/dist/index.mjs +8 -18
- package/dist/manager.cjs +15 -25
- package/dist/manager.cjs.map +1 -1
- package/dist/manager.d.cts +1 -1
- package/dist/manager.d.mts +1 -1
- package/dist/manager.mjs +11 -16
- package/dist/manager.mjs.map +1 -1
- package/dist/panels/DefaultAutoDocsLayout.cjs +22 -66
- package/dist/panels/DefaultAutoDocsLayout.cjs.map +1 -1
- package/dist/panels/DefaultAutoDocsLayout.d.cts +8 -8
- package/dist/panels/DefaultAutoDocsLayout.d.mts +8 -8
- package/dist/panels/DefaultAutoDocsLayout.mjs +17 -42
- package/dist/panels/DefaultAutoDocsLayout.mjs.map +1 -1
- package/dist/panels/GraphView.cjs +46 -146
- package/dist/panels/GraphView.cjs.map +1 -1
- package/dist/panels/GraphView.d.cts +4 -4
- package/dist/panels/GraphView.d.mts +4 -4
- package/dist/panels/GraphView.mjs +43 -135
- package/dist/panels/GraphView.mjs.map +1 -1
- package/dist/panels/index.cjs +3 -3
- package/dist/panels/index.d.cts +3 -6
- package/dist/panels/index.d.mts +3 -6
- package/dist/panels/index.mjs +3 -6
- package/dist/preview.cjs +15 -17
- package/dist/preview.d.cts +5 -5
- package/dist/preview.d.mts +6 -6
- package/dist/preview.mjs +13 -15
- package/dist/types.d.cts +110 -127
- package/dist/types.d.mts +110 -127
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -148,6 +148,8 @@ export function ${componentName}({}: ${propsName}) {
|
|
|
148
148
|
svelte: {
|
|
149
149
|
/** Customize the generated .svelte component file */
|
|
150
150
|
component: ({ componentName }) => '...',
|
|
151
|
+
/** Customize the generated .decorator.svelte file */
|
|
152
|
+
decorator: ({ componentName }) => '...',
|
|
151
153
|
/** Customize the generated .stories.svelte file */
|
|
152
154
|
story: ({ componentName, title, tags }) => '...',
|
|
153
155
|
},
|
|
@@ -170,3 +172,83 @@ export function ${componentName}({}: ${propsName}) {
|
|
|
170
172
|
```
|
|
171
173
|
|
|
172
174
|
All scaffold options are optional — omit any key to keep the default template for that file type.
|
|
175
|
+
|
|
176
|
+
### Svelte decorators
|
|
177
|
+
|
|
178
|
+
Storybook decorators in Svelte are cleanest when written as their own `.svelte` file rather than inline in a story. `sb-deps` recognises decorator files by the `.decorator.svelte` suffix and treats them specially: it scaffolds them with a decorator-shaped template (importing and rendering the wrapped sibling component) and **does not** generate a `.stories.svelte` for them.
|
|
179
|
+
|
|
180
|
+
#### Recommended pattern: one shared decorator per component
|
|
181
|
+
|
|
182
|
+
Name the file `ComponentName.decorator.svelte` and use **props** to vary behaviour between stories. This is the preferred approach because it avoids near-duplicate decorator files for each story.
|
|
183
|
+
|
|
184
|
+
```svelte
|
|
185
|
+
<!-- ContactFormOrganism.decorator.svelte -->
|
|
186
|
+
<script lang="ts">
|
|
187
|
+
import type { ValidationMode } from '@formisch/svelte';
|
|
188
|
+
import FormDataMolecule from '../../zz-meta-components/FormDataPreview/FormDataMolecule.svelte';
|
|
189
|
+
import ContactFormOrganism from './ContactFormOrganism.svelte';
|
|
190
|
+
import { createContactForm, onContactFormSubmit } from './createContactForm';
|
|
191
|
+
|
|
192
|
+
interface DecoratorProps {
|
|
193
|
+
validate?: ValidationMode;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const { validate }: DecoratorProps = $props();
|
|
197
|
+
|
|
198
|
+
const form = $derived(createContactForm(validate));
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<!--
|
|
202
|
+
Decorator files are useful for adding extra wrapper
|
|
203
|
+
components as additional context to stories
|
|
204
|
+
-->
|
|
205
|
+
<FormDataMolecule {form}>
|
|
206
|
+
<ContactFormOrganism {form} onSubmit={onContactFormSubmit} />
|
|
207
|
+
</FormDataMolecule>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
```svelte
|
|
211
|
+
<!-- ContactFormOrganism.stories.svelte (excerpt) -->
|
|
212
|
+
<Story name="Primary">
|
|
213
|
+
{#snippet template()}
|
|
214
|
+
<ContactFormOrganismDecorator validate="submit" />
|
|
215
|
+
{/snippet}
|
|
216
|
+
</Story>
|
|
217
|
+
|
|
218
|
+
<Story name="Error State">
|
|
219
|
+
{#snippet template()}
|
|
220
|
+
<ContactFormOrganismDecorator validate="initial" />
|
|
221
|
+
{/snippet}
|
|
222
|
+
</Story>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Fallback pattern: per-story decorator files
|
|
226
|
+
|
|
227
|
+
If a particular story needs a decorator with a structurally different shape that can't reasonably be expressed via props, name the file `ComponentName.StoryName.decorator.svelte`. The wrapped component name is always the segment before the first `.` in the filename.
|
|
228
|
+
|
|
229
|
+
| Filename | Wrapped component | When to use |
|
|
230
|
+
| --------------------------------- | ----------------- | --------------------------------------------------------------------------------- |
|
|
231
|
+
| `Button.decorator.svelte` | `Button` | Default — single decorator for all stories, drive variants via props |
|
|
232
|
+
| `Button.Primary.decorator.svelte` | `Button` | Fallback — only when the `Primary` story needs a structurally different decorator |
|
|
233
|
+
| `Button.Error.decorator.svelte` | `Button` | Fallback — only when the `Error` story needs a structurally different decorator |
|
|
234
|
+
|
|
235
|
+
#### Default scaffold
|
|
236
|
+
|
|
237
|
+
When `sb-deps` detects a new empty `*.decorator.svelte` file, it fills it with:
|
|
238
|
+
|
|
239
|
+
```svelte
|
|
240
|
+
<script lang="ts">
|
|
241
|
+
import Button from "./Button.svelte";
|
|
242
|
+
|
|
243
|
+
interface DecoratorProps {
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const { }: DecoratorProps = $props();
|
|
247
|
+
</script>
|
|
248
|
+
|
|
249
|
+
<div class="decorator">
|
|
250
|
+
<Button />
|
|
251
|
+
</div>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The wrapper `<div class="decorator">` is a hint, not a requirement — replace it with whatever the decorator actually needs to wrap around the component (a form provider, a router, a theme context, …). Customise the whole template via [`scaffold.svelte.decorator`](#scaffold) in your `sb-deps.config.{js,mjs,ts}`.
|
|
@@ -1,39 +1,25 @@
|
|
|
1
1
|
//#region rolldown:runtime
|
|
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
|
|
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
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return to
|
|
23
|
-
}
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (
|
|
25
|
-
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
26
|
-
__copyProps(
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule
|
|
28
|
-
? __defProp(target, 'default', {
|
|
29
|
-
value: mod,
|
|
30
|
-
enumerable: true,
|
|
31
|
-
})
|
|
32
|
-
: target,
|
|
33
|
-
mod,
|
|
34
|
-
)
|
|
35
|
-
)
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
36
22
|
|
|
37
23
|
//#endregion
|
|
38
24
|
|
|
39
|
-
exports.__toESM = __toESM
|
|
25
|
+
exports.__toESM = __toESM;
|
package/dist/addon/index.cjs
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs')
|
|
2
|
-
const require_addon_vitePlugin = require('./vitePlugin.cjs')
|
|
3
|
-
let module$1 = require(
|
|
4
|
-
module$1 = require_rolldown_runtime.__toESM(module$1)
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_addon_vitePlugin = require('./vitePlugin.cjs');
|
|
3
|
+
let module$1 = require("module");
|
|
4
|
+
module$1 = require_rolldown_runtime.__toESM(module$1);
|
|
5
5
|
|
|
6
6
|
//#region src/addon/index.ts
|
|
7
|
-
const require$1 = (0, module$1.createRequire)(
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
const managerEntries = [require$1.resolve('../manager.mjs')]
|
|
7
|
+
const require$1 = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
8
|
+
const managerEntries = [require$1.resolve("../manager.mjs")];
|
|
11
9
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const addons = [
|
|
10
|
+
* Storybook addons that this addon depends on. Registering these here means
|
|
11
|
+
* users only need to add `'storybook-addon-dependency-previews/addon'` to
|
|
12
|
+
* their `main.ts` `addons` array — the docs/links addons are auto-registered.
|
|
13
|
+
*
|
|
14
|
+
* This must live on the same preset module that Storybook actually loads.
|
|
15
|
+
* When users register us via the `/addon` subpath, Storybook loads this file
|
|
16
|
+
* directly and ignores `package.json`'s `storybook-addon.preset` field, so
|
|
17
|
+
* exporting `addons` only from `preset.ts` is not sufficient.
|
|
18
|
+
*/
|
|
19
|
+
const addons = ["@storybook/addon-docs", "@storybook/addon-links"];
|
|
22
20
|
async function viteFinal(config) {
|
|
23
|
-
config.plugins = [
|
|
24
|
-
|
|
25
|
-
require_addon_vitePlugin.sbDepsVitePlugin(),
|
|
26
|
-
]
|
|
27
|
-
return config
|
|
21
|
+
config.plugins = [...config.plugins ?? [], require_addon_vitePlugin.sbDepsVitePlugin()];
|
|
22
|
+
return config;
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
//#endregion
|
|
31
|
-
exports.addons = addons
|
|
32
|
-
exports.managerEntries = managerEntries
|
|
33
|
-
exports.viteFinal = viteFinal
|
|
34
|
-
//# sourceMappingURL=index.cjs.map
|
|
26
|
+
exports.addons = addons;
|
|
27
|
+
exports.managerEntries = managerEntries;
|
|
28
|
+
exports.viteFinal = viteFinal;
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/addon/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/addon/index.d.ts
|
|
2
|
-
declare const managerEntries: string[]
|
|
2
|
+
declare const managerEntries: string[];
|
|
3
3
|
/**
|
|
4
4
|
* Storybook addons that this addon depends on. Registering these here means
|
|
5
5
|
* users only need to add `'storybook-addon-dependency-previews/addon'` to
|
|
@@ -10,8 +10,8 @@ declare const managerEntries: string[]
|
|
|
10
10
|
* directly and ignores `package.json`'s `storybook-addon.preset` field, so
|
|
11
11
|
* exporting `addons` only from `preset.ts` is not sufficient.
|
|
12
12
|
*/
|
|
13
|
-
declare const addons: string[]
|
|
14
|
-
declare function viteFinal(config: any): Promise<any
|
|
13
|
+
declare const addons: string[];
|
|
14
|
+
declare function viteFinal(config: any): Promise<any>;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { addons, managerEntries, viteFinal }
|
|
17
|
-
//# sourceMappingURL=index.d.cts.map
|
|
16
|
+
export { addons, managerEntries, viteFinal };
|
|
17
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/addon/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/addon/index.d.ts
|
|
2
|
-
declare const managerEntries: string[]
|
|
2
|
+
declare const managerEntries: string[];
|
|
3
3
|
/**
|
|
4
4
|
* Storybook addons that this addon depends on. Registering these here means
|
|
5
5
|
* users only need to add `'storybook-addon-dependency-previews/addon'` to
|
|
@@ -10,8 +10,8 @@ declare const managerEntries: string[]
|
|
|
10
10
|
* directly and ignores `package.json`'s `storybook-addon.preset` field, so
|
|
11
11
|
* exporting `addons` only from `preset.ts` is not sufficient.
|
|
12
12
|
*/
|
|
13
|
-
declare const addons: string[]
|
|
14
|
-
declare function viteFinal(config: any): Promise<any
|
|
13
|
+
declare const addons: string[];
|
|
14
|
+
declare function viteFinal(config: any): Promise<any>;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { addons, managerEntries, viteFinal }
|
|
17
|
-
//# sourceMappingURL=index.d.mts.map
|
|
16
|
+
export { addons, managerEntries, viteFinal };
|
|
17
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/addon/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { sbDepsVitePlugin } from
|
|
2
|
-
import { createRequire } from
|
|
1
|
+
import { sbDepsVitePlugin } from "./vitePlugin.mjs";
|
|
2
|
+
import { createRequire } from "module";
|
|
3
3
|
|
|
4
4
|
//#region src/addon/index.ts
|
|
5
|
-
const require = createRequire(import.meta.url)
|
|
6
|
-
const managerEntries = [require.resolve(
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const managerEntries = [require.resolve("../manager.mjs")];
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const addons = [
|
|
8
|
+
* Storybook addons that this addon depends on. Registering these here means
|
|
9
|
+
* users only need to add `'storybook-addon-dependency-previews/addon'` to
|
|
10
|
+
* their `main.ts` `addons` array — the docs/links addons are auto-registered.
|
|
11
|
+
*
|
|
12
|
+
* This must live on the same preset module that Storybook actually loads.
|
|
13
|
+
* When users register us via the `/addon` subpath, Storybook loads this file
|
|
14
|
+
* directly and ignores `package.json`'s `storybook-addon.preset` field, so
|
|
15
|
+
* exporting `addons` only from `preset.ts` is not sufficient.
|
|
16
|
+
*/
|
|
17
|
+
const addons = ["@storybook/addon-docs", "@storybook/addon-links"];
|
|
18
18
|
async function viteFinal(config) {
|
|
19
|
-
config.plugins = [...
|
|
20
|
-
return config
|
|
19
|
+
config.plugins = [...config.plugins ?? [], sbDepsVitePlugin()];
|
|
20
|
+
return config;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
-
export { addons, managerEntries, viteFinal }
|
|
25
|
-
//# sourceMappingURL=index.mjs.map
|
|
24
|
+
export { addons, managerEntries, viteFinal };
|
|
25
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/addon/preset.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
//#region src/addon/preset.ts
|
|
2
|
-
const addons = [
|
|
3
|
+
const addons = ["@storybook/addon-docs", "@storybook/addon-links"];
|
|
3
4
|
|
|
4
5
|
//#endregion
|
|
5
|
-
exports.addons = addons
|
|
6
|
-
//# sourceMappingURL=preset.cjs.map
|
|
6
|
+
exports.addons = addons;
|
|
7
|
+
//# sourceMappingURL=preset.cjs.map
|
package/dist/addon/preset.d.cts
CHANGED
package/dist/addon/preset.d.mts
CHANGED
package/dist/addon/preset.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/addon/preset.ts
|
|
2
|
-
const addons = [
|
|
2
|
+
const addons = ["@storybook/addon-docs", "@storybook/addon-links"];
|
|
3
3
|
|
|
4
4
|
//#endregion
|
|
5
|
-
export { addons }
|
|
6
|
-
//# sourceMappingURL=preset.mjs.map
|
|
5
|
+
export { addons };
|
|
6
|
+
//# sourceMappingURL=preset.mjs.map
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs')
|
|
2
|
-
let node_fs = require(
|
|
3
|
-
node_fs = require_rolldown_runtime.__toESM(node_fs)
|
|
4
|
-
let node_path = require(
|
|
5
|
-
node_path = require_rolldown_runtime.__toESM(node_path)
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
6
6
|
|
|
7
7
|
//#region src/addon/vitePlugin.ts
|
|
8
8
|
function sbDepsVitePlugin() {
|
|
9
|
-
const virtId =
|
|
10
|
-
const resolved =
|
|
9
|
+
const virtId = "virtual:dependency-previews-json";
|
|
10
|
+
const resolved = "\0" + virtId;
|
|
11
11
|
return {
|
|
12
|
-
name:
|
|
12
|
+
name: "sb-deps",
|
|
13
13
|
resolveId(id) {
|
|
14
|
-
return id === virtId ? resolved : null
|
|
14
|
+
return id === virtId ? resolved : null;
|
|
15
15
|
},
|
|
16
16
|
load(id) {
|
|
17
|
-
if (id !== resolved) return null
|
|
18
|
-
const jsonPath = (0, node_path.resolve)(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
? (0, node_fs.readFileSync)(jsonPath, 'utf8')
|
|
24
|
-
: '{}'
|
|
25
|
-
return `export default ${json};`
|
|
26
|
-
},
|
|
27
|
-
}
|
|
17
|
+
if (id !== resolved) return null;
|
|
18
|
+
const jsonPath = (0, node_path.resolve)(process.cwd(), ".storybook/dependency-previews.json");
|
|
19
|
+
const json = (0, node_fs.existsSync)(jsonPath) ? (0, node_fs.readFileSync)(jsonPath, "utf8") : "{}";
|
|
20
|
+
return `export default ${json};`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
//#endregion
|
|
31
|
-
exports.sbDepsVitePlugin = sbDepsVitePlugin
|
|
32
|
-
//# sourceMappingURL=vitePlugin.cjs.map
|
|
26
|
+
exports.sbDepsVitePlugin = sbDepsVitePlugin;
|
|
27
|
+
//# sourceMappingURL=vitePlugin.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitePlugin.cjs","names":[],"sources":["../../src/addon/vitePlugin.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function sbDepsVitePlugin() {\n\tconst virtId = 'virtual:dependency-previews-json'\n\tconst resolved = '\\0' + virtId\n\treturn {\n\t\tname: 'sb-deps',\n\t\tresolveId(id: string) {\n\t\t\treturn id === virtId ? resolved : null\n\t\t},\n\t\tload(id: string) {\n\t\t\tif (id !== resolved) return null\n\t\t\tconst jsonPath = resolve(\n\t\t\t\tprocess.cwd(),\n\t\t\t\t'.storybook/dependency-previews.json',\n\t\t\t)\n\t\t\tconst json = existsSync(jsonPath)
|
|
1
|
+
{"version":3,"file":"vitePlugin.cjs","names":[],"sources":["../../src/addon/vitePlugin.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function sbDepsVitePlugin() {\n\tconst virtId = 'virtual:dependency-previews-json'\n\tconst resolved = '\\0' + virtId\n\treturn {\n\t\tname: 'sb-deps',\n\t\tresolveId(id: string) {\n\t\t\treturn id === virtId ? resolved : null\n\t\t},\n\t\tload(id: string) {\n\t\t\tif (id !== resolved) return null\n\t\t\tconst jsonPath = resolve(\n\t\t\t\tprocess.cwd(),\n\t\t\t\t'.storybook/dependency-previews.json',\n\t\t\t)\n\t\t\tconst json = existsSync(jsonPath) ? readFileSync(jsonPath, 'utf8') : '{}'\n\t\t\treturn `export default ${json};`\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;AAGA,SAAgB,mBAAmB;CAClC,MAAM,SAAS;CACf,MAAM,WAAW,OAAO;AACxB,QAAO;EACN,MAAM;EACN,UAAU,IAAY;AACrB,UAAO,OAAO,SAAS,WAAW;;EAEnC,KAAK,IAAY;AAChB,OAAI,OAAO,SAAU,QAAO;GAC5B,MAAM,kCACL,QAAQ,KAAK,EACb,sCACA;GACD,MAAM,+BAAkB,SAAS,6BAAgB,UAAU,OAAO,GAAG;AACrE,UAAO,kBAAkB,KAAK;;EAE/B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/addon/vitePlugin.d.ts
|
|
2
2
|
declare function sbDepsVitePlugin(): {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
name: string;
|
|
4
|
+
resolveId(id: string): string | null;
|
|
5
|
+
load(id: string): string | null;
|
|
6
|
+
};
|
|
7
7
|
//#endregion
|
|
8
|
-
export { sbDepsVitePlugin }
|
|
9
|
-
//# sourceMappingURL=vitePlugin.d.cts.map
|
|
8
|
+
export { sbDepsVitePlugin };
|
|
9
|
+
//# sourceMappingURL=vitePlugin.d.cts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//#region src/addon/vitePlugin.d.ts
|
|
2
2
|
declare function sbDepsVitePlugin(): {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
name: string;
|
|
4
|
+
resolveId(id: string): string | null;
|
|
5
|
+
load(id: string): string | null;
|
|
6
|
+
};
|
|
7
7
|
//#endregion
|
|
8
|
-
export { sbDepsVitePlugin }
|
|
9
|
-
//# sourceMappingURL=vitePlugin.d.mts.map
|
|
8
|
+
export { sbDepsVitePlugin };
|
|
9
|
+
//# sourceMappingURL=vitePlugin.d.mts.map
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from
|
|
2
|
-
import { resolve } from
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
3
|
|
|
4
4
|
//#region src/addon/vitePlugin.ts
|
|
5
5
|
function sbDepsVitePlugin() {
|
|
6
|
-
const virtId =
|
|
7
|
-
const resolved =
|
|
6
|
+
const virtId = "virtual:dependency-previews-json";
|
|
7
|
+
const resolved = "\0" + virtId;
|
|
8
8
|
return {
|
|
9
|
-
name:
|
|
9
|
+
name: "sb-deps",
|
|
10
10
|
resolveId(id) {
|
|
11
|
-
return id === virtId ? resolved : null
|
|
11
|
+
return id === virtId ? resolved : null;
|
|
12
12
|
},
|
|
13
13
|
load(id) {
|
|
14
|
-
if (id !== resolved) return null
|
|
15
|
-
const jsonPath = resolve(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return `export default ${json};`
|
|
21
|
-
},
|
|
22
|
-
}
|
|
14
|
+
if (id !== resolved) return null;
|
|
15
|
+
const jsonPath = resolve(process.cwd(), ".storybook/dependency-previews.json");
|
|
16
|
+
const json = existsSync(jsonPath) ? readFileSync(jsonPath, "utf8") : "{}";
|
|
17
|
+
return `export default ${json};`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
//#endregion
|
|
26
|
-
export { sbDepsVitePlugin }
|
|
27
|
-
//# sourceMappingURL=vitePlugin.mjs.map
|
|
23
|
+
export { sbDepsVitePlugin };
|
|
24
|
+
//# sourceMappingURL=vitePlugin.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitePlugin.mjs","names":[],"sources":["../../src/addon/vitePlugin.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function sbDepsVitePlugin() {\n\tconst virtId = 'virtual:dependency-previews-json'\n\tconst resolved = '\\0' + virtId\n\treturn {\n\t\tname: 'sb-deps',\n\t\tresolveId(id: string) {\n\t\t\treturn id === virtId ? resolved : null\n\t\t},\n\t\tload(id: string) {\n\t\t\tif (id !== resolved) return null\n\t\t\tconst jsonPath = resolve(\n\t\t\t\tprocess.cwd(),\n\t\t\t\t'.storybook/dependency-previews.json',\n\t\t\t)\n\t\t\tconst json = existsSync(jsonPath)
|
|
1
|
+
{"version":3,"file":"vitePlugin.mjs","names":[],"sources":["../../src/addon/vitePlugin.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function sbDepsVitePlugin() {\n\tconst virtId = 'virtual:dependency-previews-json'\n\tconst resolved = '\\0' + virtId\n\treturn {\n\t\tname: 'sb-deps',\n\t\tresolveId(id: string) {\n\t\t\treturn id === virtId ? resolved : null\n\t\t},\n\t\tload(id: string) {\n\t\t\tif (id !== resolved) return null\n\t\t\tconst jsonPath = resolve(\n\t\t\t\tprocess.cwd(),\n\t\t\t\t'.storybook/dependency-previews.json',\n\t\t\t)\n\t\t\tconst json = existsSync(jsonPath) ? readFileSync(jsonPath, 'utf8') : '{}'\n\t\t\treturn `export default ${json};`\n\t\t},\n\t}\n}\n"],"mappings":";;;;AAGA,SAAgB,mBAAmB;CAClC,MAAM,SAAS;CACf,MAAM,WAAW,OAAO;AACxB,QAAO;EACN,MAAM;EACN,UAAU,IAAY;AACrB,UAAO,OAAO,SAAS,WAAW;;EAEnC,KAAK,IAAY;AAChB,OAAI,OAAO,SAAU,QAAO;GAC5B,MAAM,WAAW,QAChB,QAAQ,KAAK,EACb,sCACA;GACD,MAAM,OAAO,WAAW,SAAS,GAAG,aAAa,UAAU,OAAO,GAAG;AACrE,UAAO,kBAAkB,KAAK;;EAE/B"}
|