@storybook/preact-vite 0.0.0-pr-23609-sha-f47ef339

Sign up to get free protection for your applications and to get access to all the features.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Storybook for Preact <!-- omit in toc -->
2
+
3
+ ## Requirements
4
+
5
+ - [Preact](https://preactjs.com/) >= 10.x
6
+ - [Storybook](https://storybook.js.org/) >= 7.x
7
+
8
+ ## Getting Started
9
+
10
+ ### In a project without Storybook
11
+
12
+ Follow the prompts after running this command in your Preact project's root directory:
13
+
14
+ ```bash
15
+ npx storybook@latest init
16
+ ```
17
+
18
+ [More on getting started with Storybook](https://storybook.js.org/docs/preact/get-started/install)
19
+
20
+ ### In a project with Storybook
21
+
22
+ This framework is designed to work with Storybook 7. If you’re not already using v7, upgrade with this command:
23
+
24
+ ```bash
25
+ npx storybook@latest upgrade --prerelease
26
+ ```
27
+
28
+ #### Manual migration
29
+
30
+ Install the framework:
31
+
32
+ ```bash
33
+ yarn add --dev @storybook/preact-vite
34
+ ```
35
+
36
+ Update your `main.js` to change the framework property:
37
+
38
+ ```js
39
+ // .storybook/main.js
40
+ export default {
41
+ // ...
42
+ framework: {
43
+ name: '@storybook/preact-vite', // <- Change this
44
+ options: {},
45
+ },
46
+ };
47
+ ```
@@ -0,0 +1,1092 @@
1
+ import { FileSystemCache } from 'file-system-cache';
2
+ import { TransformOptions } from '@babel/core';
3
+ import { Server } from 'http';
4
+ import { BuilderOptions as BuilderOptions$1, StorybookConfigVite } from '@storybook/builder-vite';
5
+
6
+ /**
7
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
8
+
9
+ @category Type
10
+ */
11
+ type Primitive =
12
+ | null
13
+ | undefined
14
+ | string
15
+ | number
16
+ | boolean
17
+ | symbol
18
+ | bigint;
19
+
20
+ declare global {
21
+ interface SymbolConstructor {
22
+ readonly observable: symbol;
23
+ }
24
+ }
25
+
26
+ /**
27
+ Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
28
+
29
+ Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
30
+
31
+ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
32
+
33
+ @example
34
+ ```
35
+ import type {LiteralUnion} from 'type-fest';
36
+
37
+ // Before
38
+
39
+ type Pet = 'dog' | 'cat' | string;
40
+
41
+ const pet: Pet = '';
42
+ // Start typing in your TypeScript-enabled IDE.
43
+ // You **will not** get auto-completion for `dog` and `cat` literals.
44
+
45
+ // After
46
+
47
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
48
+
49
+ const pet: Pet2 = '';
50
+ // You **will** get auto-completion for `dog` and `cat` literals.
51
+ ```
52
+
53
+ @category Type
54
+ */
55
+ type LiteralUnion<
56
+ LiteralType,
57
+ BaseType extends Primitive,
58
+ > = LiteralType | (BaseType & Record<never, never>);
59
+
60
+ declare namespace PackageJson$1 {
61
+ /**
62
+ A person who has been involved in creating or maintaining the package.
63
+ */
64
+ export type Person =
65
+ | string
66
+ | {
67
+ name: string;
68
+ url?: string;
69
+ email?: string;
70
+ };
71
+
72
+ export type BugsLocation =
73
+ | string
74
+ | {
75
+ /**
76
+ The URL to the package's issue tracker.
77
+ */
78
+ url?: string;
79
+
80
+ /**
81
+ The email address to which issues should be reported.
82
+ */
83
+ email?: string;
84
+ };
85
+
86
+ export interface DirectoryLocations {
87
+ [directoryType: string]: unknown;
88
+
89
+ /**
90
+ Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
91
+ */
92
+ bin?: string;
93
+
94
+ /**
95
+ Location for Markdown files.
96
+ */
97
+ doc?: string;
98
+
99
+ /**
100
+ Location for example scripts.
101
+ */
102
+ example?: string;
103
+
104
+ /**
105
+ Location for the bulk of the library.
106
+ */
107
+ lib?: string;
108
+
109
+ /**
110
+ Location for man pages. Sugar to generate a `man` array by walking the folder.
111
+ */
112
+ man?: string;
113
+
114
+ /**
115
+ Location for test files.
116
+ */
117
+ test?: string;
118
+ }
119
+
120
+ export type Scripts = {
121
+ /**
122
+ Run **before** the package is published (Also run on local `npm install` without any arguments).
123
+ */
124
+ prepublish?: string;
125
+
126
+ /**
127
+ Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
128
+ */
129
+ prepare?: string;
130
+
131
+ /**
132
+ Run **before** the package is prepared and packed, **only** on `npm publish`.
133
+ */
134
+ prepublishOnly?: string;
135
+
136
+ /**
137
+ Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
138
+ */
139
+ prepack?: string;
140
+
141
+ /**
142
+ Run **after** the tarball has been generated and moved to its final destination.
143
+ */
144
+ postpack?: string;
145
+
146
+ /**
147
+ Run **after** the package is published.
148
+ */
149
+ publish?: string;
150
+
151
+ /**
152
+ Run **after** the package is published.
153
+ */
154
+ postpublish?: string;
155
+
156
+ /**
157
+ Run **before** the package is installed.
158
+ */
159
+ preinstall?: string;
160
+
161
+ /**
162
+ Run **after** the package is installed.
163
+ */
164
+ install?: string;
165
+
166
+ /**
167
+ Run **after** the package is installed and after `install`.
168
+ */
169
+ postinstall?: string;
170
+
171
+ /**
172
+ Run **before** the package is uninstalled and before `uninstall`.
173
+ */
174
+ preuninstall?: string;
175
+
176
+ /**
177
+ Run **before** the package is uninstalled.
178
+ */
179
+ uninstall?: string;
180
+
181
+ /**
182
+ Run **after** the package is uninstalled.
183
+ */
184
+ postuninstall?: string;
185
+
186
+ /**
187
+ Run **before** bump the package version and before `version`.
188
+ */
189
+ preversion?: string;
190
+
191
+ /**
192
+ Run **before** bump the package version.
193
+ */
194
+ version?: string;
195
+
196
+ /**
197
+ Run **after** bump the package version.
198
+ */
199
+ postversion?: string;
200
+
201
+ /**
202
+ Run with the `npm test` command, before `test`.
203
+ */
204
+ pretest?: string;
205
+
206
+ /**
207
+ Run with the `npm test` command.
208
+ */
209
+ test?: string;
210
+
211
+ /**
212
+ Run with the `npm test` command, after `test`.
213
+ */
214
+ posttest?: string;
215
+
216
+ /**
217
+ Run with the `npm stop` command, before `stop`.
218
+ */
219
+ prestop?: string;
220
+
221
+ /**
222
+ Run with the `npm stop` command.
223
+ */
224
+ stop?: string;
225
+
226
+ /**
227
+ Run with the `npm stop` command, after `stop`.
228
+ */
229
+ poststop?: string;
230
+
231
+ /**
232
+ Run with the `npm start` command, before `start`.
233
+ */
234
+ prestart?: string;
235
+
236
+ /**
237
+ Run with the `npm start` command.
238
+ */
239
+ start?: string;
240
+
241
+ /**
242
+ Run with the `npm start` command, after `start`.
243
+ */
244
+ poststart?: string;
245
+
246
+ /**
247
+ Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
248
+ */
249
+ prerestart?: string;
250
+
251
+ /**
252
+ Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
253
+ */
254
+ restart?: string;
255
+
256
+ /**
257
+ Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
258
+ */
259
+ postrestart?: string;
260
+ } & Partial<Record<string, string>>;
261
+
262
+ /**
263
+ Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
264
+ */
265
+ export type Dependency = Partial<Record<string, string>>;
266
+
267
+ /**
268
+ Conditions which provide a way to resolve a package entry point based on the environment.
269
+ */
270
+ export type ExportCondition = LiteralUnion<
271
+ | 'import'
272
+ | 'require'
273
+ | 'node'
274
+ | 'node-addons'
275
+ | 'deno'
276
+ | 'browser'
277
+ | 'electron'
278
+ | 'react-native'
279
+ | 'default',
280
+ string
281
+ >;
282
+
283
+ type ExportConditions = {[condition in ExportCondition]: Exports};
284
+
285
+ /**
286
+ Entry points of a module, optionally with conditions and subpath exports.
287
+ */
288
+ export type Exports =
289
+ | null
290
+ | string
291
+ | Array<string | ExportConditions>
292
+ | ExportConditions
293
+ | {[path: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
294
+
295
+ /**
296
+ Import map entries of a module, optionally with conditions.
297
+ */
298
+ export type Imports = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
299
+ [key: string]: string | {[key in ExportCondition]: Exports};
300
+ };
301
+
302
+ export interface NonStandardEntryPoints {
303
+ /**
304
+ An ECMAScript module ID that is the primary entry point to the program.
305
+ */
306
+ module?: string;
307
+
308
+ /**
309
+ A module ID with untranspiled code that is the primary entry point to the program.
310
+ */
311
+ esnext?:
312
+ | string
313
+ | {
314
+ [moduleName: string]: string | undefined;
315
+ main?: string;
316
+ browser?: string;
317
+ };
318
+
319
+ /**
320
+ A hint to JavaScript bundlers or component tools when packaging modules for client side use.
321
+ */
322
+ browser?:
323
+ | string
324
+ | Partial<Record<string, string | false>>;
325
+
326
+ /**
327
+ Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
328
+
329
+ [Read more.](https://webpack.js.org/guides/tree-shaking/)
330
+ */
331
+ sideEffects?: boolean | string[];
332
+ }
333
+
334
+ export interface TypeScriptConfiguration {
335
+ /**
336
+ Location of the bundled TypeScript declaration file.
337
+ */
338
+ types?: string;
339
+
340
+ /**
341
+ Version selection map of TypeScript.
342
+ */
343
+ typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;
344
+
345
+ /**
346
+ Location of the bundled TypeScript declaration file. Alias of `types`.
347
+ */
348
+ typings?: string;
349
+ }
350
+
351
+ /**
352
+ An alternative configuration for Yarn workspaces.
353
+ */
354
+ export interface WorkspaceConfig {
355
+ /**
356
+ An array of workspace pattern strings which contain the workspace packages.
357
+ */
358
+ packages?: WorkspacePattern[];
359
+
360
+ /**
361
+ Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.
362
+
363
+ [Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
364
+ */
365
+ nohoist?: WorkspacePattern[];
366
+ }
367
+
368
+ /**
369
+ A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
370
+
371
+ The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
372
+
373
+ @example
374
+ `docs` → Include the docs directory and install its dependencies.
375
+ `packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
376
+ */
377
+ type WorkspacePattern = string;
378
+
379
+ export interface YarnConfiguration {
380
+ /**
381
+ Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
382
+
383
+ Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass.
384
+
385
+ Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
386
+ */
387
+ workspaces?: WorkspacePattern[] | WorkspaceConfig;
388
+
389
+ /**
390
+ If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.
391
+
392
+ Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
393
+ */
394
+ flat?: boolean;
395
+
396
+ /**
397
+ Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
398
+ */
399
+ resolutions?: Dependency;
400
+ }
401
+
402
+ export interface JSPMConfiguration {
403
+ /**
404
+ JSPM configuration.
405
+ */
406
+ jspm?: PackageJson$1;
407
+ }
408
+
409
+ /**
410
+ Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
411
+ */
412
+ export interface PackageJsonStandard {
413
+ /**
414
+ The name of the package.
415
+ */
416
+ name?: string;
417
+
418
+ /**
419
+ Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
420
+ */
421
+ version?: string;
422
+
423
+ /**
424
+ Package description, listed in `npm search`.
425
+ */
426
+ description?: string;
427
+
428
+ /**
429
+ Keywords associated with package, listed in `npm search`.
430
+ */
431
+ keywords?: string[];
432
+
433
+ /**
434
+ The URL to the package's homepage.
435
+ */
436
+ homepage?: LiteralUnion<'.', string>;
437
+
438
+ /**
439
+ The URL to the package's issue tracker and/or the email address to which issues should be reported.
440
+ */
441
+ bugs?: BugsLocation;
442
+
443
+ /**
444
+ The license for the package.
445
+ */
446
+ license?: string;
447
+
448
+ /**
449
+ The licenses for the package.
450
+ */
451
+ licenses?: Array<{
452
+ type?: string;
453
+ url?: string;
454
+ }>;
455
+
456
+ author?: Person;
457
+
458
+ /**
459
+ A list of people who contributed to the package.
460
+ */
461
+ contributors?: Person[];
462
+
463
+ /**
464
+ A list of people who maintain the package.
465
+ */
466
+ maintainers?: Person[];
467
+
468
+ /**
469
+ The files included in the package.
470
+ */
471
+ files?: string[];
472
+
473
+ /**
474
+ Resolution algorithm for importing ".js" files from the package's scope.
475
+
476
+ [Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field)
477
+ */
478
+ type?: 'module' | 'commonjs';
479
+
480
+ /**
481
+ The module ID that is the primary entry point to the program.
482
+ */
483
+ main?: string;
484
+
485
+ /**
486
+ Subpath exports to define entry points of the package.
487
+
488
+ [Read more.](https://nodejs.org/api/packages.html#subpath-exports)
489
+ */
490
+ exports?: Exports;
491
+
492
+ /**
493
+ Subpath imports to define internal package import maps that only apply to import specifiers from within the package itself.
494
+
495
+ [Read more.](https://nodejs.org/api/packages.html#subpath-imports)
496
+ */
497
+ imports?: Imports;
498
+
499
+ /**
500
+ The executable files that should be installed into the `PATH`.
501
+ */
502
+ bin?:
503
+ | string
504
+ | Partial<Record<string, string>>;
505
+
506
+ /**
507
+ Filenames to put in place for the `man` program to find.
508
+ */
509
+ man?: string | string[];
510
+
511
+ /**
512
+ Indicates the structure of the package.
513
+ */
514
+ directories?: DirectoryLocations;
515
+
516
+ /**
517
+ Location for the code repository.
518
+ */
519
+ repository?:
520
+ | string
521
+ | {
522
+ type: string;
523
+ url: string;
524
+
525
+ /**
526
+ Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
527
+
528
+ [Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
529
+ */
530
+ directory?: string;
531
+ };
532
+
533
+ /**
534
+ Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
535
+ */
536
+ scripts?: Scripts;
537
+
538
+ /**
539
+ Is used to set configuration parameters used in package scripts that persist across upgrades.
540
+ */
541
+ config?: Record<string, unknown>;
542
+
543
+ /**
544
+ The dependencies of the package.
545
+ */
546
+ dependencies?: Dependency;
547
+
548
+ /**
549
+ Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
550
+ */
551
+ devDependencies?: Dependency;
552
+
553
+ /**
554
+ Dependencies that are skipped if they fail to install.
555
+ */
556
+ optionalDependencies?: Dependency;
557
+
558
+ /**
559
+ Dependencies that will usually be required by the package user directly or via another dependency.
560
+ */
561
+ peerDependencies?: Dependency;
562
+
563
+ /**
564
+ Indicate peer dependencies that are optional.
565
+ */
566
+ peerDependenciesMeta?: Partial<Record<string, {optional: true}>>;
567
+
568
+ /**
569
+ Package names that are bundled when the package is published.
570
+ */
571
+ bundledDependencies?: string[];
572
+
573
+ /**
574
+ Alias of `bundledDependencies`.
575
+ */
576
+ bundleDependencies?: string[];
577
+
578
+ /**
579
+ Engines that this package runs on.
580
+ */
581
+ engines?: {
582
+ [EngineName in 'npm' | 'node' | string]?: string;
583
+ };
584
+
585
+ /**
586
+ @deprecated
587
+ */
588
+ engineStrict?: boolean;
589
+
590
+ /**
591
+ Operating systems the module runs on.
592
+ */
593
+ os?: Array<LiteralUnion<
594
+ | 'aix'
595
+ | 'darwin'
596
+ | 'freebsd'
597
+ | 'linux'
598
+ | 'openbsd'
599
+ | 'sunos'
600
+ | 'win32'
601
+ | '!aix'
602
+ | '!darwin'
603
+ | '!freebsd'
604
+ | '!linux'
605
+ | '!openbsd'
606
+ | '!sunos'
607
+ | '!win32',
608
+ string
609
+ >>;
610
+
611
+ /**
612
+ CPU architectures the module runs on.
613
+ */
614
+ cpu?: Array<LiteralUnion<
615
+ | 'arm'
616
+ | 'arm64'
617
+ | 'ia32'
618
+ | 'mips'
619
+ | 'mipsel'
620
+ | 'ppc'
621
+ | 'ppc64'
622
+ | 's390'
623
+ | 's390x'
624
+ | 'x32'
625
+ | 'x64'
626
+ | '!arm'
627
+ | '!arm64'
628
+ | '!ia32'
629
+ | '!mips'
630
+ | '!mipsel'
631
+ | '!ppc'
632
+ | '!ppc64'
633
+ | '!s390'
634
+ | '!s390x'
635
+ | '!x32'
636
+ | '!x64',
637
+ string
638
+ >>;
639
+
640
+ /**
641
+ If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
642
+
643
+ @deprecated
644
+ */
645
+ preferGlobal?: boolean;
646
+
647
+ /**
648
+ If set to `true`, then npm will refuse to publish it.
649
+ */
650
+ private?: boolean;
651
+
652
+ /**
653
+ A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
654
+ */
655
+ publishConfig?: PublishConfig;
656
+
657
+ /**
658
+ Describes and notifies consumers of a package's monetary support information.
659
+
660
+ [Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md)
661
+ */
662
+ funding?: string | {
663
+ /**
664
+ The type of funding.
665
+ */
666
+ type?: LiteralUnion<
667
+ | 'github'
668
+ | 'opencollective'
669
+ | 'patreon'
670
+ | 'individual'
671
+ | 'foundation'
672
+ | 'corporation',
673
+ string
674
+ >;
675
+
676
+ /**
677
+ The URL to the funding page.
678
+ */
679
+ url: string;
680
+ };
681
+ }
682
+
683
+ export interface PublishConfig {
684
+ /**
685
+ Additional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig).
686
+ */
687
+ [additionalProperties: string]: unknown;
688
+
689
+ /**
690
+ When publishing scoped packages, the access level defaults to restricted. If you want your scoped package to be publicly viewable (and installable) set `--access=public`. The only valid values for access are public and restricted. Unscoped packages always have an access level of public.
691
+ */
692
+ access?: 'public' | 'restricted';
693
+
694
+ /**
695
+ The base URL of the npm registry.
696
+
697
+ Default: `'https://registry.npmjs.org/'`
698
+ */
699
+ registry?: string;
700
+
701
+ /**
702
+ The tag to publish the package under.
703
+
704
+ Default: `'latest'`
705
+ */
706
+ tag?: string;
707
+ }
708
+ }
709
+
710
+ /**
711
+ Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
712
+
713
+ @category File
714
+ */
715
+ type PackageJson$1 =
716
+ PackageJson$1.PackageJsonStandard &
717
+ PackageJson$1.NonStandardEntryPoints &
718
+ PackageJson$1.TypeScriptConfiguration &
719
+ PackageJson$1.YarnConfiguration &
720
+ PackageJson$1.JSPMConfiguration;
721
+ type Tag = string;
722
+ interface Parameters {
723
+ [name: string]: any;
724
+ }
725
+
726
+ interface StoriesSpecifier {
727
+ /**
728
+ * When auto-titling, what to prefix all generated titles with (default: '')
729
+ */
730
+ titlePrefix?: string;
731
+ /**
732
+ * Where to start looking for story files
733
+ */
734
+ directory: string;
735
+ /**
736
+ * What does the filename of a story file look like?
737
+ * (a glob, relative to directory, no leading `./`)
738
+ * If unset, we use `** / *.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))` (no spaces)
739
+ */
740
+ files?: string;
741
+ }
742
+ type StoriesEntry = string | StoriesSpecifier;
743
+ interface IndexerOptions {
744
+ makeTitle: (userTitle?: string) => string;
745
+ }
746
+ interface IndexedStory {
747
+ id: string;
748
+ name: string;
749
+ tags?: Tag[];
750
+ parameters?: Parameters;
751
+ }
752
+ interface IndexedCSFFile {
753
+ meta: {
754
+ title?: string;
755
+ tags?: Tag[];
756
+ };
757
+ stories: IndexedStory[];
758
+ }
759
+ interface StoryIndexer {
760
+ test: RegExp;
761
+ indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>;
762
+ }
763
+
764
+ interface Options$1 {
765
+ allowRegExp: boolean;
766
+ allowFunction: boolean;
767
+ allowSymbol: boolean;
768
+ allowDate: boolean;
769
+ allowUndefined: boolean;
770
+ allowClass: boolean;
771
+ maxDepth: number;
772
+ space: number | undefined;
773
+ lazyEval: boolean;
774
+ }
775
+
776
+ /**
777
+ * ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
778
+ */
779
+ type BuilderName$1 = 'webpack5' | '@storybook/builder-webpack5' | string;
780
+ type RendererName = string;
781
+ interface CoreConfig {
782
+ builder?: BuilderName$1 | {
783
+ name: BuilderName$1;
784
+ options?: Record<string, any>;
785
+ };
786
+ renderer?: RendererName;
787
+ disableWebpackDefaults?: boolean;
788
+ channelOptions?: Partial<Options$1>;
789
+ /**
790
+ * Disables the generation of project.json, a file containing Storybook metadata
791
+ */
792
+ disableProjectJson?: boolean;
793
+ /**
794
+ * Disables Storybook telemetry
795
+ * @see https://storybook.js.org/telemetry
796
+ */
797
+ disableTelemetry?: boolean;
798
+ /**
799
+ * Disables notifications for Storybook updates.
800
+ */
801
+ disableWhatsNewNotifications?: boolean;
802
+ /**
803
+ * Enable crash reports to be sent to Storybook telemetry
804
+ * @see https://storybook.js.org/telemetry
805
+ */
806
+ enableCrashReports?: boolean;
807
+ /**
808
+ * enable CORS headings to run document in a "secure context"
809
+ * see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
810
+ * This enables these headers in development-mode:
811
+ * Cross-Origin-Opener-Policy: same-origin
812
+ * Cross-Origin-Embedder-Policy: require-corp
813
+ */
814
+ crossOriginIsolated?: boolean;
815
+ }
816
+ interface DirectoryMapping {
817
+ from: string;
818
+ to: string;
819
+ }
820
+ interface Presets {
821
+ apply(extension: 'typescript', config: TypescriptOptions, args?: Options): Promise<TypescriptOptions>;
822
+ apply(extension: 'framework', config?: {}, args?: any): Promise<Preset>;
823
+ apply(extension: 'babel', config?: {}, args?: any): Promise<TransformOptions>;
824
+ apply(extension: 'entries', config?: [], args?: any): Promise<unknown>;
825
+ apply(extension: 'stories', config?: [], args?: any): Promise<StoriesEntry[]>;
826
+ apply(extension: 'managerEntries', config: [], args?: any): Promise<string[]>;
827
+ apply(extension: 'refs', config?: [], args?: any): Promise<unknown>;
828
+ apply(extension: 'core', config?: {}, args?: any): Promise<CoreConfig>;
829
+ apply<T>(extension: string, config?: T, args?: unknown): Promise<T>;
830
+ }
831
+ interface LoadedPreset {
832
+ name: string;
833
+ preset: any;
834
+ options: any;
835
+ }
836
+ interface VersionCheck {
837
+ success: boolean;
838
+ cached: boolean;
839
+ data?: any;
840
+ error?: any;
841
+ time: number;
842
+ }
843
+ type PackageJson = PackageJson$1 & Record<string, any>;
844
+ interface LoadOptions {
845
+ packageJson: PackageJson;
846
+ outputDir?: string;
847
+ configDir?: string;
848
+ ignorePreview?: boolean;
849
+ extendServer?: (server: Server) => void;
850
+ }
851
+ interface CLIOptions {
852
+ port?: number;
853
+ ignorePreview?: boolean;
854
+ previewUrl?: string;
855
+ forceBuildPreview?: boolean;
856
+ disableTelemetry?: boolean;
857
+ enableCrashReports?: boolean;
858
+ host?: string;
859
+ initialPath?: string;
860
+ /**
861
+ * @deprecated Use 'staticDirs' Storybook Configuration option instead
862
+ */
863
+ staticDir?: string[];
864
+ configDir?: string;
865
+ https?: boolean;
866
+ sslCa?: string[];
867
+ sslCert?: string;
868
+ sslKey?: string;
869
+ smokeTest?: boolean;
870
+ managerCache?: boolean;
871
+ open?: boolean;
872
+ ci?: boolean;
873
+ loglevel?: string;
874
+ quiet?: boolean;
875
+ versionUpdates?: boolean;
876
+ docs?: boolean;
877
+ debugWebpack?: boolean;
878
+ webpackStatsJson?: string | boolean;
879
+ outputDir?: string;
880
+ }
881
+ interface BuilderOptions {
882
+ configType?: 'DEVELOPMENT' | 'PRODUCTION';
883
+ ignorePreview?: boolean;
884
+ cache?: FileSystemCache;
885
+ configDir: string;
886
+ docsMode?: boolean;
887
+ features?: StorybookConfig$1['features'];
888
+ versionCheck?: VersionCheck;
889
+ disableWebpackDefaults?: boolean;
890
+ serverChannelUrl?: string;
891
+ }
892
+ interface StorybookConfigOptions {
893
+ presets: Presets;
894
+ presetsList?: LoadedPreset[];
895
+ }
896
+ type Options = LoadOptions & StorybookConfigOptions & CLIOptions & BuilderOptions;
897
+ /**
898
+ * Options for TypeScript usage within Storybook.
899
+ */
900
+ interface TypescriptOptions {
901
+ /**
902
+ * Enables type checking within Storybook.
903
+ *
904
+ * @default `false`
905
+ */
906
+ check: boolean;
907
+ /**
908
+ * Disable parsing typescript files through babel.
909
+ *
910
+ * @default `false`
911
+ */
912
+ skipBabel: boolean;
913
+ }
914
+ type Preset = string | {
915
+ name: string;
916
+ options?: any;
917
+ };
918
+ /**
919
+ * An additional script that gets injected into the
920
+ * preview or the manager,
921
+ */
922
+ type Entry = string;
923
+ type CoreCommon_StorybookRefs = Record<string, {
924
+ title: string;
925
+ url: string;
926
+ } | {
927
+ disable: boolean;
928
+ expanded?: boolean;
929
+ }>;
930
+ type DocsOptions = {
931
+ /**
932
+ * What should we call the generated docs entries?
933
+ */
934
+ defaultName?: string;
935
+ /**
936
+ * Should we generate a docs entry per CSF file?
937
+ * Set to 'tag' (the default) to generate an entry for every CSF file with the
938
+ * 'autodocs' tag.
939
+ */
940
+ autodocs?: boolean | 'tag';
941
+ /**
942
+ * Only show doc entries in the side bar (usually set with the `--docs` CLI flag)
943
+ */
944
+ docsMode?: boolean;
945
+ };
946
+ /**
947
+ * The interface for Storybook configuration in `main.ts` files.
948
+ */
949
+ interface StorybookConfig$1 {
950
+ /**
951
+ * Sets the addons you want to use with Storybook.
952
+ *
953
+ * @example `['@storybook/addon-essentials']` or `[{ name: '@storybook/addon-essentials', options: { backgrounds: false } }]`
954
+ */
955
+ addons?: Preset[];
956
+ core?: CoreConfig;
957
+ /**
958
+ * Sets a list of directories of static files to be loaded by Storybook server
959
+ *
960
+ * @example `['./public']` or `[{from: './public', 'to': '/assets'}]`
961
+ */
962
+ staticDirs?: (DirectoryMapping | string)[];
963
+ logLevel?: string;
964
+ features?: {
965
+ /**
966
+ * Build stories.json automatically on start/build
967
+ */
968
+ buildStoriesJson?: boolean;
969
+ /**
970
+ * Activate on demand story store
971
+ */
972
+ storyStoreV7?: boolean;
973
+ /**
974
+ * Do not throw errors if using `.mdx` files in SSv7
975
+ * (for internal use in sandboxes)
976
+ */
977
+ storyStoreV7MdxErrors?: boolean;
978
+ /**
979
+ * Filter args with a "target" on the type from the render function (EXPERIMENTAL)
980
+ */
981
+ argTypeTargetsV7?: boolean;
982
+ /**
983
+ * Warn when there is a pre-6.0 hierarchy separator ('.' / '|') in the story title.
984
+ * Will be removed in 7.0.
985
+ */
986
+ warnOnLegacyHierarchySeparator?: boolean;
987
+ /**
988
+ * Use legacy MDX1, to help smooth migration to 7.0
989
+ */
990
+ legacyMdx1?: boolean;
991
+ /**
992
+ * Apply decorators from preview.js before decorators from addons or frameworks
993
+ */
994
+ legacyDecoratorFileOrder?: boolean;
995
+ };
996
+ /**
997
+ * Tells Storybook where to find stories.
998
+ *
999
+ * @example `['./src/*.stories.@(j|t)sx?']`
1000
+ */
1001
+ stories: StoriesEntry[];
1002
+ /**
1003
+ * Framework, e.g. '@storybook/react-vite', required in v7
1004
+ */
1005
+ framework?: Preset;
1006
+ /**
1007
+ * Controls how Storybook handles TypeScript files.
1008
+ */
1009
+ typescript?: Partial<TypescriptOptions>;
1010
+ /**
1011
+ * References external Storybooks
1012
+ */
1013
+ refs?: PresetValue<CoreCommon_StorybookRefs>;
1014
+ /**
1015
+ * Modify or return babel config.
1016
+ */
1017
+ babel?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
1018
+ /**
1019
+ * Modify or return env config.
1020
+ */
1021
+ env?: PresetValue<Record<string, string>>;
1022
+ /**
1023
+ * Modify or return babel config.
1024
+ */
1025
+ babelDefault?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
1026
+ /**
1027
+ * Add additional scripts to run in the preview a la `.storybook/preview.js`
1028
+ *
1029
+ * @deprecated use `previewAnnotations` or `/preview.js` file instead
1030
+ */
1031
+ config?: PresetValue<Entry[]>;
1032
+ /**
1033
+ * Add additional scripts to run in the preview a la `.storybook/preview.js`
1034
+ */
1035
+ previewAnnotations?: PresetValue<Entry[]>;
1036
+ /**
1037
+ * Process CSF files for the story index.
1038
+ */
1039
+ storyIndexers?: PresetValue<StoryIndexer[]>;
1040
+ /**
1041
+ * Docs related features in index generation
1042
+ */
1043
+ docs?: DocsOptions;
1044
+ /**
1045
+ * Programmatically modify the preview head/body HTML.
1046
+ * The previewHead and previewBody functions accept a string,
1047
+ * which is the existing head/body, and return a modified string.
1048
+ */
1049
+ previewHead?: PresetValue<string>;
1050
+ previewBody?: PresetValue<string>;
1051
+ /**
1052
+ * Programmatically override the preview's main page template.
1053
+ * This should return a reference to a file containing an `.ejs` template
1054
+ * that will be interpolated with environment variables.
1055
+ *
1056
+ * @example '.storybook/index.ejs'
1057
+ */
1058
+ previewMainTemplate?: string;
1059
+ /**
1060
+ * Programmatically modify the preview head/body HTML.
1061
+ * The managerHead function accept a string,
1062
+ * which is the existing head content, and return a modified string.
1063
+ */
1064
+ managerHead?: PresetValue<string>;
1065
+ }
1066
+ type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
1067
+ type PresetProperty<K, TStorybookConfig = StorybookConfig$1> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
1068
+ type PresetPropertyFn<K, TStorybookConfig = StorybookConfig$1, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
1069
+
1070
+ type FrameworkName = '@storybook/preact-vite';
1071
+ type BuilderName = '@storybook/builder-vite';
1072
+ type FrameworkOptions = {
1073
+ builder?: BuilderOptions$1;
1074
+ };
1075
+ type StorybookConfigFramework = {
1076
+ framework: FrameworkName | {
1077
+ name: FrameworkName;
1078
+ options: FrameworkOptions;
1079
+ };
1080
+ core?: StorybookConfig$1['core'] & {
1081
+ builder?: BuilderName | {
1082
+ name: BuilderName;
1083
+ options: BuilderOptions$1;
1084
+ };
1085
+ };
1086
+ };
1087
+ /**
1088
+ * The interface for Storybook configuration in `main.ts` files.
1089
+ */
1090
+ type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigVite | keyof StorybookConfigFramework> & StorybookConfigVite & StorybookConfigFramework;
1091
+
1092
+ export { FrameworkOptions as F, PresetProperty as P, StorybookConfig as S };
@@ -0,0 +1,5 @@
1
+ export { F as FrameworkOptions, S as StorybookConfig } from './index-035d931b.js';
2
+ import 'file-system-cache';
3
+ import '@babel/core';
4
+ import 'http';
5
+ import '@storybook/builder-vite';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};module.exports=__toCommonJS(src_exports);
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,10 @@
1
+ import { P as PresetProperty, S as StorybookConfig } from './index-035d931b.js';
2
+ import 'file-system-cache';
3
+ import '@babel/core';
4
+ import 'http';
5
+ import '@storybook/builder-vite';
6
+
7
+ declare const core: PresetProperty<'core', StorybookConfig>;
8
+ declare const viteFinal: StorybookConfig['viteFinal'];
9
+
10
+ export { core, viteFinal };
package/dist/preset.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{core:()=>core,viteFinal:()=>viteFinal});module.exports=__toCommonJS(preset_exports);var import_builder_vite=require("@storybook/builder-vite"),import_preset_vite=__toESM(require("@preact/preset-vite")),import_path=require("path"),getAbsolutePath=input=>(0,import_path.dirname)(require.resolve((0,import_path.join)(input,"package.json"))),core={builder:getAbsolutePath("@storybook/builder-vite"),renderer:getAbsolutePath("@storybook/preact")},viteFinal=async config=>{let{plugins=[]}=config;return await(0,import_builder_vite.hasVitePlugins)(plugins,["vite:preact-jsx"])||plugins.push((0,import_preset_vite.default)()),config};0&&(module.exports={core,viteFinal});
package/jest.config.js ADDED
@@ -0,0 +1,7 @@
1
+ const path = require('path');
2
+ const baseConfig = require('../../jest.config.node');
3
+
4
+ module.exports = {
5
+ ...baseConfig,
6
+ displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep),
7
+ };
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@storybook/preact-vite",
3
+ "version": "0.0.0-pr-23609-sha-f47ef339",
4
+ "description": "Storybook for Preact and Vite: Develop Preact components in isolation with Hot Reloading.",
5
+ "keywords": [
6
+ "storybook"
7
+ ],
8
+ "homepage": "https://github.com/storybookjs/storybook/tree/next/code/frameworks/preact-vite",
9
+ "bugs": {
10
+ "url": "https://github.com/storybookjs/storybook/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/storybookjs/storybook.git",
15
+ "directory": "code/frameworks/preact-vite"
16
+ },
17
+ "funding": {
18
+ "type": "opencollective",
19
+ "url": "https://opencollective.com/storybook"
20
+ },
21
+ "license": "MIT",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "require": "./dist/index.js",
26
+ "import": "./dist/index.mjs"
27
+ },
28
+ "./preset": {
29
+ "types": "./dist/preset.d.ts",
30
+ "require": "./dist/preset.js"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "main": "dist/index.js",
35
+ "module": "dist/index.mjs",
36
+ "types": "dist/index.d.ts",
37
+ "files": [
38
+ "dist/**/*",
39
+ "types/**/*",
40
+ "README.md",
41
+ "*.js",
42
+ "*.d.ts"
43
+ ],
44
+ "scripts": {
45
+ "check": "../../../scripts/prepare/check.ts",
46
+ "prep": "../../../scripts/prepare/bundle.ts"
47
+ },
48
+ "dependencies": {
49
+ "@preact/preset-vite": "^2.0.0",
50
+ "@storybook/builder-vite": "0.0.0-pr-23609-sha-f47ef339",
51
+ "@storybook/preact": "0.0.0-pr-23609-sha-f47ef339"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^16.0.0",
55
+ "typescript": "~4.9.3",
56
+ "vite": "^4.0.0"
57
+ },
58
+ "peerDependencies": {
59
+ "preact": ">=10",
60
+ "vite": "^3.0.0 || ^4.0.0"
61
+ },
62
+ "engines": {
63
+ "node": ">=16"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "bundler": {
69
+ "entries": [
70
+ "./src/index.ts",
71
+ "./src/preset.ts"
72
+ ],
73
+ "platform": "node"
74
+ },
75
+ "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae17"
76
+ }
package/preset.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/preset');