From e14e85425eb7a5fdc1d5aab6f4ae091f93ab45a7 Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Fri, 17 Nov 2023 19:10:46 +0100 Subject: [PATCH] Add patch for inflexible sveltejs-kit --- package.json | 4 ++- patches/@sveltejs+kit+1.27.6.patch | 17 ++++++++++++ src/routes/+layout.svelte | 5 ++-- src/routes/+page.svelte | 4 +++ src/routes/api/+page.svelte | 43 ++++++++++++++++++++++++------ 5 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 patches/@sveltejs+kit+1.27.6.patch diff --git a/package.json b/package.json index 891090d..744d61e 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --check . && eslint .", - "format": "prettier --write ." + "format": "prettier --write .", + "postinstall": "patch-package" }, "devDependencies": { "@rollup/plugin-json": "^6.0.1", @@ -37,6 +38,7 @@ "@fontsource/oswald": "^5.0.17", "@fontsource/ubuntu": "^5.0.8", "bootstrap": "^5.3.2", + "patch-package": "^8.0.0", "svelte-i18n": "^4.0.0", "sveltestrap": "^5.11.2", "swagger-ui": "^5.10.0" diff --git a/patches/@sveltejs+kit+1.27.6.patch b/patches/@sveltejs+kit+1.27.6.patch new file mode 100644 index 0000000..a008413 --- /dev/null +++ b/patches/@sveltejs+kit+1.27.6.patch @@ -0,0 +1,17 @@ +diff --git a/node_modules/@sveltejs/kit/src/exports/vite/index.js b/node_modules/@sveltejs/kit/src/exports/vite/index.js +index a7a886d..d3433b5 100644 +--- a/node_modules/@sveltejs/kit/src/exports/vite/index.js ++++ b/node_modules/@sveltejs/kit/src/exports/vite/index.js +@@ -561,9 +561,9 @@ function kit({ svelte_config }) { + input, + output: { + format: 'esm', +- entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`, +- chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[name].[hash].${ext}`, +- assetFileNames: `${prefix}/assets/[name].[hash][extname]`, ++ entryFileNames: ssr ? '[name].js' : `${prefix}/[hash].${ext}`, ++ chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[hash].${ext}`, ++ assetFileNames: `${prefix}/assets/[hash][extname]`, + hoistTransitiveImports: false, + sourcemapIgnoreList + }, diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 982cbc8..972ae36 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -15,6 +15,7 @@ import { locale, locales, waitLocale } from 'svelte-i18n'; import type { LayoutLoad } from './$types'; import { browser } from '$app/environment'; + import { page } from '$app/stores'; export const setLocale = (lang: string) => () => { locale.set(lang); @@ -27,10 +28,10 @@ diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 0aefe4b..d581125 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -34,6 +34,10 @@ }); + + ₿TClock + + diff --git a/src/routes/api/+page.svelte b/src/routes/api/+page.svelte index 084ca3a..52cf39e 100644 --- a/src/routes/api/+page.svelte +++ b/src/routes/api/+page.svelte @@ -4,21 +4,48 @@ import { onMount } from 'svelte'; import * as swaggerJson from './swagger.json'; - //import SwaggerUI from 'swagger-ui'; - //import 'swagger-ui/dist/swagger-ui.css'; + // import SwaggerUI from 'swagger-ui'; + import 'swagger-ui/dist/swagger-ui.css'; onMount(async () => { - // SwaggerUI({ - // spec: swaggerJson, - // dom_id: '#swagger-ui-container' - // }); + // @ts-ignore + SwaggerUIBundle({ + spec: swaggerJson, + dom_id: '#swagger-ui-container', + presets: [ + // @ts-ignore + SwaggerUIBundle.presets.apis, + // @ts-ignore + SwaggerUIStandalonePreset + ], +// layout: "StandaloneLayout", + }); }); - API playground + API playground + + + -
+