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.
Files changed (215) hide show
  1. package/README.md +82 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +20 -34
  3. package/dist/addon/index.cjs +22 -27
  4. package/dist/addon/index.d.cts +5 -5
  5. package/dist/addon/index.d.mts +5 -5
  6. package/dist/addon/index.mjs +18 -18
  7. package/dist/addon/preset.cjs +4 -3
  8. package/dist/addon/preset.d.cts +3 -3
  9. package/dist/addon/preset.d.mts +3 -3
  10. package/dist/addon/preset.mjs +3 -3
  11. package/dist/addon/vitePlugin.cjs +17 -22
  12. package/dist/addon/vitePlugin.cjs.map +1 -1
  13. package/dist/addon/vitePlugin.d.cts +6 -6
  14. package/dist/addon/vitePlugin.d.mts +6 -6
  15. package/dist/addon/vitePlugin.mjs +14 -17
  16. package/dist/addon/vitePlugin.mjs.map +1 -1
  17. package/dist/blocks/DependencyPreviews.cjs +66 -192
  18. package/dist/blocks/DependencyPreviews.cjs.map +1 -1
  19. package/dist/blocks/DependencyPreviews.d.cts +4 -4
  20. package/dist/blocks/DependencyPreviews.d.mts +4 -4
  21. package/dist/blocks/DependencyPreviews.mjs +63 -163
  22. package/dist/blocks/DependencyPreviews.mjs.map +1 -1
  23. package/dist/blocks/index.cjs +1 -1
  24. package/dist/blocks/index.d.cts +1 -1
  25. package/dist/blocks/index.d.mts +1 -1
  26. package/dist/blocks/index.mjs +1 -1
  27. package/dist/cli/sb-deps.cjs +499 -546
  28. package/dist/cli/sb-deps.cjs.map +1 -1
  29. package/dist/cli/sb-deps.d.cts +1 -1
  30. package/dist/cli/sb-deps.d.mts +1 -1
  31. package/dist/cli/sb-deps.mjs +491 -520
  32. package/dist/cli/sb-deps.mjs.map +1 -1
  33. package/dist/cli/scripts/depcruise.config.cjs +20 -19
  34. package/dist/cli/scripts/depcruise.config.d.cts +4 -4
  35. package/dist/cli/scripts/depcruise.config.d.mts +4 -4
  36. package/dist/cli/scripts/depcruise.config.mjs +19 -19
  37. package/dist/cli/scripts/postprocess.cjs +104 -124
  38. package/dist/cli/scripts/postprocess.cjs.map +1 -1
  39. package/dist/cli/scripts/postprocess.d.cts +1 -1
  40. package/dist/cli/scripts/postprocess.d.mts +1 -1
  41. package/dist/cli/scripts/postprocess.mjs +101 -115
  42. package/dist/cli/scripts/postprocess.mjs.map +1 -1
  43. package/dist/cli/setup/detect.cjs +78 -93
  44. package/dist/cli/setup/detect.cjs.map +1 -1
  45. package/dist/cli/setup/detect.d.cts +28 -43
  46. package/dist/cli/setup/detect.d.mts +28 -43
  47. package/dist/cli/setup/detect.mjs +74 -78
  48. package/dist/cli/setup/detect.mjs.map +1 -1
  49. package/dist/cli/setup/index.cjs +192 -233
  50. package/dist/cli/setup/index.cjs.map +1 -1
  51. package/dist/cli/setup/index.d.cts +3 -3
  52. package/dist/cli/setup/index.d.mts +3 -3
  53. package/dist/cli/setup/index.mjs +179 -203
  54. package/dist/cli/setup/index.mjs.map +1 -1
  55. package/dist/cli/setup/install.cjs +69 -59
  56. package/dist/cli/setup/install.cjs.map +1 -1
  57. package/dist/cli/setup/install.d.cts +25 -30
  58. package/dist/cli/setup/install.d.mts +25 -30
  59. package/dist/cli/setup/install.mjs +67 -57
  60. package/dist/cli/setup/install.mjs.map +1 -1
  61. package/dist/cli/setup/patchers/main.cjs +369 -132
  62. package/dist/cli/setup/patchers/main.cjs.map +1 -1
  63. package/dist/cli/setup/patchers/main.d.cts +27 -17
  64. package/dist/cli/setup/patchers/main.d.mts +27 -17
  65. package/dist/cli/setup/patchers/main.mjs +367 -122
  66. package/dist/cli/setup/patchers/main.mjs.map +1 -1
  67. package/dist/cli/setup/patchers/packageJson.cjs +67 -76
  68. package/dist/cli/setup/patchers/packageJson.d.cts +22 -31
  69. package/dist/cli/setup/patchers/packageJson.d.mts +22 -31
  70. package/dist/cli/setup/patchers/packageJson.mjs +63 -72
  71. package/dist/cli/setup/patchers/preview.cjs +247 -351
  72. package/dist/cli/setup/patchers/preview.cjs.map +1 -1
  73. package/dist/cli/setup/patchers/preview.d.cts +45 -51
  74. package/dist/cli/setup/patchers/preview.d.mts +45 -51
  75. package/dist/cli/setup/patchers/preview.mjs +244 -344
  76. package/dist/cli/setup/patchers/preview.mjs.map +1 -1
  77. package/dist/cli/setup/prompt.cjs +28 -28
  78. package/dist/cli/setup/prompt.d.cts +8 -14
  79. package/dist/cli/setup/prompt.d.mts +8 -14
  80. package/dist/cli/setup/prompt.mjs +24 -24
  81. package/dist/cli/setup/util.cjs +268 -274
  82. package/dist/cli/setup/util.d.cts +14 -28
  83. package/dist/cli/setup/util.d.mts +14 -28
  84. package/dist/cli/setup/util.mjs +262 -276
  85. package/dist/components/ComponentSourceLink.cjs +31 -53
  86. package/dist/components/ComponentSourceLink.cjs.map +1 -1
  87. package/dist/components/ComponentSourceLink.mjs +24 -34
  88. package/dist/components/ComponentSourceLink.mjs.map +1 -1
  89. package/dist/components/CopyButton.cjs +71 -98
  90. package/dist/components/CopyButton.cjs.map +1 -1
  91. package/dist/components/CopyButton.mjs +67 -90
  92. package/dist/components/CopyButton.mjs.map +1 -1
  93. package/dist/components/Expandable.cjs +28 -62
  94. package/dist/components/Expandable.cjs.map +1 -1
  95. package/dist/components/Expandable.mjs +25 -52
  96. package/dist/components/Expandable.mjs.map +1 -1
  97. package/dist/components/FullParityStory.cjs +29 -31
  98. package/dist/components/FullParityStory.cjs.map +1 -1
  99. package/dist/components/FullParityStory.mjs +26 -26
  100. package/dist/components/FullParityStory.mjs.map +1 -1
  101. package/dist/components/PathCopyMolecule.cjs +14 -42
  102. package/dist/components/PathCopyMolecule.cjs.map +1 -1
  103. package/dist/components/PathCopyMolecule.mjs +11 -28
  104. package/dist/components/PathCopyMolecule.mjs.map +1 -1
  105. package/dist/components/PrimaryPreview.cjs +17 -47
  106. package/dist/components/PrimaryPreview.cjs.map +1 -1
  107. package/dist/components/PrimaryPreview.mjs +15 -39
  108. package/dist/components/PrimaryPreview.mjs.map +1 -1
  109. package/dist/components/SbHeading.cjs +9 -21
  110. package/dist/components/SbHeading.cjs.map +1 -1
  111. package/dist/components/SbHeading.mjs +6 -10
  112. package/dist/components/SbHeading.mjs.map +1 -1
  113. package/dist/components/StoryLink.cjs +27 -48
  114. package/dist/components/StoryLink.cjs.map +1 -1
  115. package/dist/components/StoryLink.mjs +23 -37
  116. package/dist/components/StoryLink.mjs.map +1 -1
  117. package/dist/components/TooltipTrigger.cjs +63 -125
  118. package/dist/components/TooltipTrigger.cjs.map +1 -1
  119. package/dist/components/TooltipTrigger.mjs +59 -108
  120. package/dist/components/TooltipTrigger.mjs.map +1 -1
  121. package/dist/components/icons/ArrowToRectangleIcon.cjs +11 -15
  122. package/dist/components/icons/ArrowToRectangleIcon.cjs.map +1 -1
  123. package/dist/components/icons/ArrowToRectangleIcon.mjs +9 -13
  124. package/dist/components/icons/ArrowToRectangleIcon.mjs.map +1 -1
  125. package/dist/components/icons/BuildIcon.cjs +11 -15
  126. package/dist/components/icons/BuildIcon.cjs.map +1 -1
  127. package/dist/components/icons/BuildIcon.mjs +9 -13
  128. package/dist/components/icons/BuildIcon.mjs.map +1 -1
  129. package/dist/components/icons/CopyIcon.cjs +11 -15
  130. package/dist/components/icons/CopyIcon.cjs.map +1 -1
  131. package/dist/components/icons/CopyIcon.mjs +9 -13
  132. package/dist/components/icons/CopyIcon.mjs.map +1 -1
  133. package/dist/components/icons/CubeIcon.cjs +11 -15
  134. package/dist/components/icons/CubeIcon.cjs.map +1 -1
  135. package/dist/components/icons/CubeIcon.mjs +9 -13
  136. package/dist/components/icons/CubeIcon.mjs.map +1 -1
  137. package/dist/components/icons/DoubleChevronDown.cjs +11 -15
  138. package/dist/components/icons/DoubleChevronDown.cjs.map +1 -1
  139. package/dist/components/icons/DoubleChevronDown.mjs +9 -13
  140. package/dist/components/icons/DoubleChevronDown.mjs.map +1 -1
  141. package/dist/components/icons/ExternalLinkIcon.cjs +11 -15
  142. package/dist/components/icons/ExternalLinkIcon.cjs.map +1 -1
  143. package/dist/components/icons/ExternalLinkIcon.mjs +9 -13
  144. package/dist/components/icons/ExternalLinkIcon.mjs.map +1 -1
  145. package/dist/components/icons/EyeOpen.cjs +15 -20
  146. package/dist/components/icons/EyeOpen.cjs.map +1 -1
  147. package/dist/components/icons/EyeOpen.mjs +13 -18
  148. package/dist/components/icons/EyeOpen.mjs.map +1 -1
  149. package/dist/components/icons/LoadingRipples.cjs +67 -87
  150. package/dist/components/icons/LoadingRipples.cjs.map +1 -1
  151. package/dist/components/icons/LoadingRipples.mjs +65 -85
  152. package/dist/components/icons/LoadingRipples.mjs.map +1 -1
  153. package/dist/components/icons/SquaresPlus.cjs +11 -15
  154. package/dist/components/icons/SquaresPlus.cjs.map +1 -1
  155. package/dist/components/icons/SquaresPlus.mjs +9 -13
  156. package/dist/components/icons/SquaresPlus.mjs.map +1 -1
  157. package/dist/components/icons/Svg.cjs +23 -27
  158. package/dist/components/icons/Svg.cjs.map +1 -1
  159. package/dist/components/icons/Svg.mjs +21 -25
  160. package/dist/components/icons/Svg.mjs.map +1 -1
  161. package/dist/components/icons/X.cjs +11 -15
  162. package/dist/components/icons/X.cjs.map +1 -1
  163. package/dist/components/icons/X.mjs +9 -13
  164. package/dist/components/icons/X.mjs.map +1 -1
  165. package/dist/config.cjs +4 -3
  166. package/dist/config.cjs.map +1 -1
  167. package/dist/config.d.cts +101 -98
  168. package/dist/config.d.mts +101 -98
  169. package/dist/config.mjs +3 -3
  170. package/dist/config.mjs.map +1 -1
  171. package/dist/constants.cjs +6 -5
  172. package/dist/constants.mjs +4 -4
  173. package/dist/hooks/useDependencyGraph.cjs +39 -53
  174. package/dist/hooks/useDependencyGraph.cjs.map +1 -1
  175. package/dist/hooks/useDependencyGraph.mjs +35 -53
  176. package/dist/hooks/useDependencyGraph.mjs.map +1 -1
  177. package/dist/hooks/useDynamicStory.cjs +55 -80
  178. package/dist/hooks/useDynamicStory.cjs.map +1 -1
  179. package/dist/hooks/useDynamicStory.mjs +52 -77
  180. package/dist/hooks/useDynamicStory.mjs.map +1 -1
  181. package/dist/hooks/useStoryParams.cjs +10 -12
  182. package/dist/hooks/useStoryParams.mjs +8 -8
  183. package/dist/index.cjs +13 -16
  184. package/dist/index.d.cts +8 -45
  185. package/dist/index.d.mts +8 -45
  186. package/dist/index.mjs +8 -18
  187. package/dist/manager.cjs +15 -25
  188. package/dist/manager.cjs.map +1 -1
  189. package/dist/manager.d.cts +1 -1
  190. package/dist/manager.d.mts +1 -1
  191. package/dist/manager.mjs +11 -16
  192. package/dist/manager.mjs.map +1 -1
  193. package/dist/panels/DefaultAutoDocsLayout.cjs +22 -66
  194. package/dist/panels/DefaultAutoDocsLayout.cjs.map +1 -1
  195. package/dist/panels/DefaultAutoDocsLayout.d.cts +8 -8
  196. package/dist/panels/DefaultAutoDocsLayout.d.mts +8 -8
  197. package/dist/panels/DefaultAutoDocsLayout.mjs +17 -42
  198. package/dist/panels/DefaultAutoDocsLayout.mjs.map +1 -1
  199. package/dist/panels/GraphView.cjs +46 -146
  200. package/dist/panels/GraphView.cjs.map +1 -1
  201. package/dist/panels/GraphView.d.cts +4 -4
  202. package/dist/panels/GraphView.d.mts +4 -4
  203. package/dist/panels/GraphView.mjs +43 -135
  204. package/dist/panels/GraphView.mjs.map +1 -1
  205. package/dist/panels/index.cjs +3 -3
  206. package/dist/panels/index.d.cts +3 -6
  207. package/dist/panels/index.d.mts +3 -6
  208. package/dist/panels/index.mjs +3 -6
  209. package/dist/preview.cjs +15 -17
  210. package/dist/preview.d.cts +5 -5
  211. package/dist/preview.d.mts +6 -6
  212. package/dist/preview.mjs +13 -15
  213. package/dist/types.d.cts +110 -127
  214. package/dist/types.d.mts +110 -127
  215. 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 ((from && typeof from === 'object') || typeof from === 'function')
10
- for (
11
- var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
12
- i < n;
13
- i++
14
- ) {
15
- key = keys[i]
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, {
18
- get: ((k) => from[k]).bind(null, key),
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
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;
@@ -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('module')
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
- require('url').pathToFileURL(__filename).href,
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
- * Storybook addons that this addon depends on. Registering these here means
13
- * users only need to add `'storybook-addon-dependency-previews/addon'` to
14
- * their `main.ts` `addons` array — the docs/links addons are auto-registered.
15
- *
16
- * This must live on the same preset module that Storybook actually loads.
17
- * When users register us via the `/addon` subpath, Storybook loads this file
18
- * directly and ignores `package.json`'s `storybook-addon.preset` field, so
19
- * exporting `addons` only from `preset.ts` is not sufficient.
20
- */
21
- const addons = ['@storybook/addon-docs', '@storybook/addon-links']
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
- ...(config.plugins ?? []),
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
@@ -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
@@ -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
@@ -1,25 +1,25 @@
1
- import { sbDepsVitePlugin } from './vitePlugin.mjs'
2
- import { createRequire } from 'module'
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('../manager.mjs')]
5
+ const require = createRequire(import.meta.url);
6
+ const managerEntries = [require.resolve("../manager.mjs")];
7
7
  /**
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']
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 = [...(config.plugins ?? []), sbDepsVitePlugin()]
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
@@ -1,6 +1,7 @@
1
+
1
2
  //#region src/addon/preset.ts
2
- const addons = ['@storybook/addon-docs', '@storybook/addon-links']
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
@@ -1,5 +1,5 @@
1
1
  //#region src/addon/preset.d.ts
2
- declare const addons: Array<string>
2
+ declare const addons: Array<string>;
3
3
  //#endregion
4
- export { addons }
5
- //# sourceMappingURL=preset.d.cts.map
4
+ export { addons };
5
+ //# sourceMappingURL=preset.d.cts.map
@@ -1,5 +1,5 @@
1
1
  //#region src/addon/preset.d.ts
2
- declare const addons: Array<string>
2
+ declare const addons: Array<string>;
3
3
  //#endregion
4
- export { addons }
5
- //# sourceMappingURL=preset.d.mts.map
4
+ export { addons };
5
+ //# sourceMappingURL=preset.d.mts.map
@@ -1,6 +1,6 @@
1
1
  //#region src/addon/preset.ts
2
- const addons = ['@storybook/addon-docs', '@storybook/addon-links']
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('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)
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 = 'virtual:dependency-previews-json'
10
- const resolved = '\0' + virtId
9
+ const virtId = "virtual:dependency-previews-json";
10
+ const resolved = "\0" + virtId;
11
11
  return {
12
- name: 'sb-deps',
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
- process.cwd(),
20
- '.storybook/dependency-previews.json',
21
- )
22
- const json = (0, node_fs.existsSync)(jsonPath)
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)\n\t\t\t\t? readFileSync(jsonPath, 'utf8')\n\t\t\t\t: '{}'\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,6BACjB,UAAU,OAAO,GAC9B;AACH,UAAO,kBAAkB,KAAK;;EAE/B"}
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
- name: string
4
- resolveId(id: string): string | null
5
- load(id: string): string | null
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
- name: string
4
- resolveId(id: string): string | null
5
- load(id: string): string | null
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 'node:fs'
2
- import { resolve } from 'node:path'
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 = 'virtual:dependency-previews-json'
7
- const resolved = '\0' + virtId
6
+ const virtId = "virtual:dependency-previews-json";
7
+ const resolved = "\0" + virtId;
8
8
  return {
9
- name: 'sb-deps',
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
- process.cwd(),
17
- '.storybook/dependency-previews.json',
18
- )
19
- const json = existsSync(jsonPath) ? readFileSync(jsonPath, 'utf8') : '{}'
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)\n\t\t\t\t? readFileSync(jsonPath, 'utf8')\n\t\t\t\t: '{}'\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,GAC9B,aAAa,UAAU,OAAO,GAC9B;AACH,UAAO,kBAAkB,KAAK;;EAE/B"}
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"}