Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sveltekit): upgraded sveltekit support to svelltekit v1.0.0 (fix #392, #397) #402

Merged
merged 4 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 22 additions & 22 deletions examples/sveltekit/package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"name": "sveltekit",
"version": "0.0.1",
"name": "sveltekit",
"version": "0.0.1",
"private": true,
"scripts": {
"sk:dev": "vite dev",
"sk:build": "vite build",
"sk:package": "svelte-kit package",
"sk:preview": "vite preview",
"sk:check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"sk:check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"scripts": {
"sk:dev": "vite dev",
"sk:build": "vite build",
"sk:package": "svelte-kit package",
"sk:preview": "vite preview",
"sk:check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"sk:check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"story:dev": "histoire dev",
"story:build": "histoire build",
"story:preview": "histoire preview --port 4567"
},
"type": "module",
"dependencies": {
"@fontsource/fira-mono": "^4.5.0",
"cookie": "^0.4.1"
},
"devDependencies": {
},
"type": "module",
"dependencies": {
"@fontsource/fira-mono": "^4.5.0",
"cookie": "^0.4.1"
},
"devDependencies": {
"@histoire/plugin-svelte": "workspace:*",
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
"@types/cookie": "^0.5.1",
"@sveltejs/adapter-auto": "^1.0.0",
"@sveltejs/kit": "^1.0.0",
"@types/cookie": "^0.5.1",
"histoire": "workspace:*",
"svelte": "^3.54.0",
"svelte-check": "^2.7.1",
"svelte-check": "^2.7.1",
"svelte-preprocess": "^4.10.7",
"tslib": "^2.3.1",
"tslib": "^2.3.1",
"typescript": "^4.7.4",
"vite": "^4.0.0"
}
}
}
File renamed without changes.
5 changes: 0 additions & 5 deletions examples/sveltekit/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ const config = {

kit: {
adapter: adapter(),

// Override http methods in the Todo forms
methodOverride: {
allowed: ['PATCH', 'DELETE']
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/histoire-plugin-svelte/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function HstSvelte (): Plugin {
},
},
viteIgnorePlugins: [
'vite-plugin-svelte-kit',
'vite-plugin-sveltekit-compile',
],
}
},
Expand Down
7 changes: 4 additions & 3 deletions packages/histoire/src/node/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ export async function mergeHistoireViteConfig (viteConfig: InlineConfig, ctx: Co
let flatPlugins = []
if (viteConfig.plugins) {
for (const pluginOption of viteConfig.plugins) {
if (Array.isArray(pluginOption)) {
flatPlugins.push(...await Promise.all(pluginOption))
const resolvedPluginOption = await pluginOption
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this changed. Now if it's an array it's being awaited twice

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A vite plugin can be of the form: [promise, promise, promise]

if (Array.isArray(resolvedPluginOption)) {
flatPlugins.push(...await Promise.all(resolvedPluginOption))
} else {
flatPlugins.push(await pluginOption)
flatPlugins.push(resolvedPluginOption)
}
}
flatPlugins = flatPlugins.filter(Boolean)
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.