@stencil/storybook-plugin 0.0.7 → 0.0.9

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.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Extra type definitions for rollup/parseAst in cases the Rollup version between
3
+ * `@stencil/storybook-plugin` and `unplugin-stencil` is different. This may cause
4
+ * the following type error:
5
+ *
6
+ * ```
7
+ * [ ERROR ] TypeScript: node_modules/vite/dist/node/index.d.ts:5:41
8
+ * Cannot find module 'rollup/parseAst' or its corresponding type
9
+ * declarations.
10
+ *
11
+ * L4: export { rollup as Rollup };
12
+ * L5: export { parseAst, parseAstAsync } from 'rollup/parseAst';
13
+ * L6: import * as http from 'node:http';
14
+ * ```
15
+ *
16
+ * This file is a workaround to make sure the type definitions are available when
17
+ * importing `rollup/parseAst` in `unplugin-stencil`.
18
+ */
19
+ declare module 'rollup/parseAst' {
20
+ export function parseAst(code: string, options?: any): any
21
+ export function parseAstAsync(code: string, options?: any): Promise<any>
22
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
- import './globals';
1
+ /**
2
+ * This is a workaround to make sure the type definitions for
3
+ * rollup/parseAst are available.
4
+ */
5
+ import '../@types/rollup-parseAst.d.ts';
2
6
  export * from './types.js';
3
7
  export * from './portable-stories.js';
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
- import './globals';
1
+ /**
2
+ * This is a workaround to make sure the type definitions for
3
+ * rollup/parseAst are available.
4
+ */
5
+ import '../@types/rollup-parseAst.d.ts';
2
6
  export * from './types.js';
3
7
  export * from './portable-stories.js';
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { VNode } from '@stencil/core';
1
+ import { VNode, JSX as StencilJSX } from '@stencil/core';
2
2
  import { StorybookConfigVite } from '@storybook/builder-vite';
3
3
  import { WebRenderer } from '@storybook/types';
4
4
  export type { Args, ArgTypes, Parameters, StrictArgs } from '@storybook/types';
@@ -52,3 +52,18 @@ export type StorybookConfig = Omit<StorybookConfigBase, 'framework'> & {
52
52
  name: '@stencil/storybook-plugin';
53
53
  };
54
54
  } & StorybookConfigVite;
55
+ /**
56
+ * Extend the JSX namespace to include StencilJSX.IntrinsicElements, StencilJSX.Element, and StencilJSX.ElementClass.
57
+ * This is necessary to allow the use of Stencil components in Storybook.
58
+ * Without we get are getting type errors.
59
+ */
60
+ declare global {
61
+ namespace JSX {
62
+ interface IntrinsicElements extends StencilJSX.IntrinsicElements {
63
+ }
64
+ interface Element extends StencilJSX.Element {
65
+ }
66
+ interface ElementClass {
67
+ }
68
+ }
69
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/storybook-plugin",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Storybook plugin for Stencil",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/stenciljs/storybook",
@@ -27,6 +27,7 @@
27
27
  "files": [
28
28
  "dist",
29
29
  "template",
30
+ "@types",
30
31
  "preset.js"
31
32
  ],
32
33
  "//": "not sure why dist/preview is needed, but it is",