Skip to content

Commit

Permalink
Merge pull request #19095 from storybookjs/vite/plugin-types
Browse files Browse the repository at this point in the history
Vite: Fix plugin types
  • Loading branch information
shilman authored Sep 6, 2022
2 parents 7bb0486 + e205738 commit 3c07761
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 69 deletions.
2 changes: 1 addition & 1 deletion code/frameworks/react-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"devDependencies": {
"@types/node": "^14.14.20 || ^16.0.0",
"typescript": "~4.6.3",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/react-vite/src/plugins/react-docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'react-docgen';
import type { DocumentationObject } from 'react-docgen/lib/Documentation';
import MagicString from 'magic-string';
import type { Plugin } from 'vite';
import type { PluginOption } from 'vite';
import actualNameHandler from './docgen-handlers/actualNameHandler';

type DocObj = DocumentationObject & { actualName: string };
Expand All @@ -27,7 +27,7 @@ type Options = {
export function reactDocgen({
include = /\.(mjs|tsx?|jsx?)$/,
exclude = [/node_modules\/.*/],
}: Options = {}): Plugin {
}: Options = {}): PluginOption {
const cwd = process.cwd();
const filter = createFilter(include, exclude);

Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/react-vite/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export const viteFinal: StorybookConfig['viteFinal'] = async (config, { presets
require('@joshwooding/vite-plugin-react-docgen-typescript')(reactDocgenTypescriptOptions)
);
} else if (reactDocgen) {
const { reactDocgen } = await import('./plugins/react-docgen');
const { reactDocgen: docgenPlugin } = await import('./plugins/react-docgen');
// Needs to run before the react plugin, so add to the front
plugins.unshift(reactDocgen() as any);
plugins.unshift(docgenPlugin());
}

return config;
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/svelte-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"devDependencies": {
"@types/node": "^14.14.20 || ^16.0.0",
"typescript": "~4.6.3",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
},
"engines": {
"node": "^14.18 || >=16"
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/svelte-vite/src/plugins/svelte-docgen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from 'vite';
import type { PluginOption } from 'vite';
import MagicString from 'magic-string';
import path from 'path';
import fs from 'fs';
Expand Down Expand Up @@ -42,7 +42,7 @@ function getNameFromFilename(filename: string) {
return base[0].toUpperCase() + base.slice(1);
}

export function svelteDocgen(svelteOptions: Record<string, any>): Plugin {
export function svelteDocgen(svelteOptions: Record<string, any>): PluginOption {
const cwd = process.cwd();
const { preprocess: preprocessOptions, logDocgen = false } = svelteOptions;
const include = /\.(svelte)$/;
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/svelte-vite/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function readPackageJson(): Record<string, any> | false {
export const viteFinal: StorybookConfig['viteFinal'] = async (config, { presets }) => {
const { plugins = [] } = config;

plugins.push(svelteDocgen(config) as any);
plugins.push(svelteDocgen(config));

return {
...config,
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/vue3-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"devDependencies": {
"@types/node": "^14.14.20 || ^16.0.0",
"typescript": "~4.6.3",
"vite": "^3.0.0-beta.1"
"vite": "^3.1.0"
},
"engines": {
"node": "^14.18 || >=16"
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/vue3-vite/src/plugins/vue-docgen.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { parse } from 'vue-docgen-api';
import type { Plugin } from 'vite';
import type { PluginOption } from 'vite';
import { createFilter } from 'vite';
import MagicString from 'magic-string';

export function vueDocgen(): Plugin {
export function vueDocgen(): PluginOption {
const include = /\.(vue)$/;
const filter = createFilter(include);

Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/vue3-vite/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function readPackageJson(): Record<string, any> | false {
export const viteFinal: StorybookConfig['viteFinal'] = async (config, { presets }) => {
const { plugins = [] } = config;

plugins.push(vueDocgen() as any);
plugins.push(vueDocgen());

const updated = {
...config,
Expand Down
2 changes: 1 addition & 1 deletion code/lib/builder-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@types/express": "^4.17.13",
"@types/node": "^17.0.23",
"typescript": "~4.6.3",
"vite": "3.1.0-beta.1"
"vite": "^3.1.0"
},
"peerDependencies": {
"@storybook/mdx2-csf": "^0.0.3"
Expand Down
64 changes: 9 additions & 55 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7690,7 +7690,7 @@ __metadata:
magic-string: ^0.26.1
slash: ^3.0.0
typescript: ~4.6.3
vite: 3.1.0-beta.1
vite: ^3.1.0
peerDependencies:
"@storybook/mdx2-csf": ^0.0.3
peerDependenciesMeta:
Expand Down Expand Up @@ -8849,7 +8849,7 @@ __metadata:
magic-string: ^0.26.1
react-docgen: ^6.0.0-alpha.3
typescript: ~4.6.3
vite: ^3.0.0-beta.1
vite: ^3.1.0
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0
Expand Down Expand Up @@ -9326,7 +9326,7 @@ __metadata:
svelte: ^3.0.0
sveltedoc-parser: ^4.2.1
typescript: ~4.6.3
vite: ^3.0.0-beta.1
vite: ^3.1.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -9532,7 +9532,7 @@ __metadata:
"@vitejs/plugin-vue": ^3.0.3
magic-string: ^0.26.1
typescript: ~4.6.3
vite: ^3.0.0-beta.1
vite: ^3.1.0
vue-docgen-api: ^4.40.0
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -39049,20 +39049,6 @@ __metadata:
languageName: node
linkType: hard

"rollup@npm:>=2.75.6 <2.77.0 || ~2.77.0":
version: 2.77.3
resolution: "rollup@npm:2.77.3"
dependencies:
fsevents: ~2.3.2
dependenciesMeta:
fsevents:
optional: true
bin:
rollup: dist/bin/rollup
checksum: 7e04ba4e8fdbc3a4a368013e4b788044c16fe94e7301aacbf38e37210983e159b97887ddd3333be9f78fedb30264f094c111ff56a0207c21d4e1745248a7aa42
languageName: node
linkType: hard

"rollup@npm:^2.43.1, rollup@npm:^2.60.2, rollup@npm:^2.74.1, rollup@npm:~2.78.0":
version: 2.78.1
resolution: "rollup@npm:2.78.1"
Expand Down Expand Up @@ -44364,11 +44350,11 @@ __metadata:
languageName: node
linkType: hard

"vite@npm:3.1.0-beta.1":
version: 3.1.0-beta.1
resolution: "vite@npm:3.1.0-beta.1"
"vite@npm:^3.1.0":
version: 3.1.0
resolution: "vite@npm:3.1.0"
dependencies:
esbuild: ^0.14.47
esbuild: ^0.15.6
fsevents: ~2.3.2
postcss: ^8.4.16
resolve: ^1.22.1
Expand All @@ -44392,39 +44378,7 @@ __metadata:
optional: true
bin:
vite: bin/vite.js
checksum: 2dad78ffb2c6dff7bbeb76ba8c237c25d1b7be3b054b3958c3d2df681bacdf300abed3d2646975788254b4a9b193636541017753fd52825e946c497f45d1dd37
languageName: node
linkType: hard

"vite@npm:^3.0.0-beta.1":
version: 3.0.9
resolution: "vite@npm:3.0.9"
dependencies:
esbuild: ^0.14.47
fsevents: ~2.3.2
postcss: ^8.4.16
resolve: ^1.22.1
rollup: ">=2.75.6 <2.77.0 || ~2.77.0"
peerDependencies:
less: "*"
sass: "*"
stylus: "*"
terser: ^5.4.0
dependenciesMeta:
fsevents:
optional: true
peerDependenciesMeta:
less:
optional: true
sass:
optional: true
stylus:
optional: true
terser:
optional: true
bin:
vite: bin/vite.js
checksum: 0e39c11e8befd9ac139ab48ace83125bb4ad0ded14fd7c370290af8c001accbb5e67ce7677d958f5b2ffaf0a38b342ffabf166bc33aa5de32a8510ecb4596be9
checksum: 38c1a495226ebda7a3f2b341152dc01cb13cbe014a0f834c0bae2f29a6a4fefa3a18587a8d787e25e0ebbd4874da2506a87e3e37b959b26ee8a22983fed2a9e0
languageName: node
linkType: hard

Expand Down

0 comments on commit 3c07761

Please sign in to comment.