Files
wehub-resource-sync adf0d17497
publish / version_or_publish (push) Waiting to run
storybook-build / changes (push) Waiting to run
storybook-build / :storybook-build (push) Blocked by required conditions
Sync Gradio Skills to Hugging Face / sync-skills (push) Waiting to run
functional / changes (push) Waiting to run
functional / build-frontend (push) Blocked by required conditions
functional / functional-test-SSR=false (push) Blocked by required conditions
functional / functional-reload (push) Blocked by required conditions
functional / functional-test-SSR=true (push) Blocked by required conditions
hygiene / hygiene-test (push) Waiting to run
python / changes (push) Waiting to run
python / build (push) Blocked by required conditions
python / test-ubuntu-latest-flaky (push) Blocked by required conditions
python / test-ubuntu-latest-not-flaky (push) Blocked by required conditions
python / test-windows-latest-flaky (push) Blocked by required conditions
python / test-windows-latest-not-flaky (push) Blocked by required conditions
js / changes (push) Waiting to run
js / js-test (push) Blocked by required conditions
docs-build / changes (push) Waiting to run
docs-build / docs-build (push) Blocked by required conditions
docs-build / website-build (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 13:17:32 +08:00

81 lines
2.4 KiB
TypeScript

import type { StorybookConfig } from "@storybook/svelte-vite";
import { svelte, vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import { sveltePreprocess } from "svelte-preprocess";
const config: StorybookConfig = {
stories: [
"../js/storybook/**/*.mdx",
"../js/!(dataframe|dataframe-interim|core)/*.stories.svelte",
"../js/!(dataframe|dataframe-interim|core)/src/**/*.stories.svelte"
],
staticDirs: ["../js/spa/public", "../js/storybook/public", "./test_files"],
addons: [
{
name: "@storybook/addon-svelte-csf",
options: {
legacyTemplate: true
}
},
"@chromatic-com/storybook",
"@storybook/addon-vitest",
"@storybook/addon-a11y",
"@storybook/addon-docs"
],
framework: "@storybook/svelte-vite",
async viteFinal(config) {
config.plugins = (config.plugins || []).filter((plugin) => {
const name = Array.isArray(plugin) ? undefined : (plugin as any)?.name;
return (
name !== "storybook:svelte-docgen-plugin" &&
name !== "vite-plugin-svelte"
);
});
config.plugins.unshift(
svelte({
configFile: false,
// configFile:false means the project's svelte.config.js (and its
// preprocessing) isn't loaded, so enable TS preprocessing here —
// matching the main app's config. Without it, Svelte's built-in
// parser chokes on TS generics in a class `extends` clause
// (e.g. `extends Gradio<A, B>`).
preprocess: [vitePreprocess(), sveltePreprocess()],
// Disabled so workspace @gradio/* .svelte sources go through this
// (preprocessed) plugin rather than being esbuild-prebundled without
// preprocessing — the prebundle path can't strip TS generics in a
// class `extends` clause and fails to parse on Svelte 5.48.
prebundleSvelteLibraries: false,
dynamicCompileOptions({ filename }) {
// Process @storybook/svelte files from node_modules
if (filename.includes("node_modules/@storybook/svelte")) {
return { generate: "client" };
}
}
})
);
config.resolve = config.resolve || {};
config.resolve.conditions = [
"gradio",
"browser",
"import",
"module",
"default"
];
config.optimizeDeps = config.optimizeDeps || {};
config.optimizeDeps.include = [
...(config.optimizeDeps.include || []),
"@storybook/svelte"
];
config.optimizeDeps.exclude = [
...(config.optimizeDeps.exclude || []),
"@gradio/utils",
"@gradio/theme"
];
return config;
}
};
export default config;