diff --git a/plugins/sql/src/plugin.rs b/plugins/sql/src/plugin.rs index 24109ad4..48d2e241 100644 --- a/plugins/sql/src/plugin.rs +++ b/plugins/sql/src/plugin.rs @@ -348,7 +348,9 @@ impl Builder { drop(lock); app.manage(instances); - app.manage(Migrations(Mutex::new(self.migrations.take().unwrap_or_default()))); + app.manage(Migrations(Mutex::new( + self.migrations.take().unwrap_or_default(), + ))); Ok(()) }) diff --git a/plugins/websocket/examples/svelte-app/README.md b/plugins/websocket/examples/svelte-app/README.md index 7b1ba836..5fdf6998 100644 --- a/plugins/websocket/examples/svelte-app/README.md +++ b/plugins/websocket/examples/svelte-app/README.md @@ -1,4 +1,4 @@ -*Looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)* +_Looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)_ --- @@ -13,8 +13,7 @@ npx degit sveltejs/template svelte-app cd svelte-app ``` -*Note that you will need to have [Node.js](https://nodejs.org) installed.* - +_Note that you will need to have [Node.js](https://nodejs.org) installed._ ## Get started @@ -47,12 +46,11 @@ npm run build You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com). - ## Single-page app mode By default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere. -If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for *any* path. You can make it so by editing the `"start"` command in package.json: +If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for _any_ path. You can make it so by editing the `"start"` command in package.json: ```js "start": "sirv public --single" diff --git a/plugins/websocket/examples/svelte-app/public/global.css b/plugins/websocket/examples/svelte-app/public/global.css index bb28a941..d8d4fb96 100644 --- a/plugins/websocket/examples/svelte-app/public/global.css +++ b/plugins/websocket/examples/svelte-app/public/global.css @@ -1,63 +1,68 @@ -html, body { - position: relative; - width: 100%; - height: 100%; +html, +body { + position: relative; + width: 100%; + height: 100%; } body { - color: #333; - margin: 0; - padding: 8px; - box-sizing: border-box; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; + color: #333; + margin: 0; + padding: 8px; + box-sizing: border-box; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, + Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } a { - color: rgb(0,100,200); - text-decoration: none; + color: rgb(0, 100, 200); + text-decoration: none; } a:hover { - text-decoration: underline; + text-decoration: underline; } a:visited { - color: rgb(0,80,160); + color: rgb(0, 80, 160); } label { - display: block; + display: block; } -input, button, select, textarea { - font-family: inherit; - font-size: inherit; - -webkit-padding: 0.4em 0; - padding: 0.4em; - margin: 0 0 0.5em 0; - box-sizing: border-box; - border: 1px solid #ccc; - border-radius: 2px; +input, +button, +select, +textarea { + font-family: inherit; + font-size: inherit; + -webkit-padding: 0.4em 0; + padding: 0.4em; + margin: 0 0 0.5em 0; + box-sizing: border-box; + border: 1px solid #ccc; + border-radius: 2px; } input:disabled { - color: #ccc; + color: #ccc; } button { - color: #333; - background-color: #f4f4f4; - outline: none; + color: #333; + background-color: #f4f4f4; + outline: none; } button:disabled { - color: #999; + color: #999; } button:not(:disabled):active { - background-color: #ddd; + background-color: #ddd; } button:focus { - border-color: #666; + border-color: #666; } diff --git a/plugins/websocket/examples/svelte-app/public/index.html b/plugins/websocket/examples/svelte-app/public/index.html index 63cf2502..1e84363f 100644 --- a/plugins/websocket/examples/svelte-app/public/index.html +++ b/plugins/websocket/examples/svelte-app/public/index.html @@ -1,20 +1,17 @@ + + + - - - + Svelte app - Svelte app + + + - - - + + - - - - - - - \ No newline at end of file + + diff --git a/plugins/websocket/examples/svelte-app/rollup.config.js b/plugins/websocket/examples/svelte-app/rollup.config.js index 3f472f38..10fbfae8 100644 --- a/plugins/websocket/examples/svelte-app/rollup.config.js +++ b/plugins/websocket/examples/svelte-app/rollup.config.js @@ -1,83 +1,87 @@ -import svelte from 'rollup-plugin-svelte'; -import commonjs from '@rollup/plugin-commonjs'; -import resolve from '@rollup/plugin-node-resolve'; -import livereload from 'rollup-plugin-livereload'; -import { terser } from 'rollup-plugin-terser'; -import sveltePreprocess from 'svelte-preprocess'; -import typescript from '@rollup/plugin-typescript'; -import css from 'rollup-plugin-css-only'; +import svelte from "rollup-plugin-svelte"; +import commonjs from "@rollup/plugin-commonjs"; +import resolve from "@rollup/plugin-node-resolve"; +import livereload from "rollup-plugin-livereload"; +import { terser } from "rollup-plugin-terser"; +import sveltePreprocess from "svelte-preprocess"; +import typescript from "@rollup/plugin-typescript"; +import css from "rollup-plugin-css-only"; const production = !process.env.ROLLUP_WATCH; function serve() { - let server; + let server; - function toExit() { - if (server) server.kill(0); - } + function toExit() { + if (server) server.kill(0); + } - return { - writeBundle() { - if (server) return; - server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], { - stdio: ['ignore', 'inherit', 'inherit'], - shell: true - }); + return { + writeBundle() { + if (server) return; + server = require("child_process").spawn( + "npm", + ["run", "start", "--", "--dev"], + { + stdio: ["ignore", "inherit", "inherit"], + shell: true, + } + ); - process.on('SIGTERM', toExit); - process.on('exit', toExit); - } - }; + process.on("SIGTERM", toExit); + process.on("exit", toExit); + }, + }; } export default { - input: 'src/main.ts', - output: { - sourcemap: true, - format: 'iife', - name: 'app', - file: 'public/build/bundle.js' - }, - plugins: [ - svelte({ - preprocess: sveltePreprocess(), - compilerOptions: { - // enable run-time checks when not in production - dev: !production - } - }), - // we'll extract any component CSS out into - // a separate file - better for performance - css({ output: 'bundle.css' }), + input: "src/main.ts", + output: { + sourcemap: true, + format: "iife", + name: "app", + file: "public/build/bundle.js", + }, + plugins: [ + svelte({ + preprocess: sveltePreprocess(), + compilerOptions: { + // enable run-time checks when not in production + dev: !production, + }, + }), + // we'll extract any component CSS out into + // a separate file - better for performance + css({ output: "bundle.css" }), - // If you have external dependencies installed from - // npm, you'll most likely need these plugins. In - // some cases you'll need additional configuration - - // consult the documentation for details: - // https://github.com/rollup/plugins/tree/master/packages/commonjs - resolve({ - browser: true, - dedupe: ['svelte'] - }), - commonjs(), - typescript({ - sourceMap: !production, - inlineSources: !production - }), + // If you have external dependencies installed from + // npm, you'll most likely need these plugins. In + // some cases you'll need additional configuration - + // consult the documentation for details: + // https://github.com/rollup/plugins/tree/master/packages/commonjs + resolve({ + browser: true, + dedupe: ["svelte"], + }), + commonjs(), + typescript({ + sourceMap: !production, + inlineSources: !production, + }), - // In dev mode, call `npm run start` once - // the bundle has been generated - !production && serve(), + // In dev mode, call `npm run start` once + // the bundle has been generated + !production && serve(), - // Watch the `public` directory and refresh the - // browser on changes when not in production - !production && livereload('public'), + // Watch the `public` directory and refresh the + // browser on changes when not in production + !production && livereload("public"), - // If we're building for production (npm run build - // instead of npm run dev), minify - production && terser() - ], - watch: { - clearScreen: false - } + // If we're building for production (npm run build + // instead of npm run dev), minify + production && terser(), + ], + watch: { + clearScreen: false, + }, }; diff --git a/plugins/websocket/examples/svelte-app/src-tauri/tauri.conf.json b/plugins/websocket/examples/svelte-app/src-tauri/tauri.conf.json index 4361ee8b..906ed528 100644 --- a/plugins/websocket/examples/svelte-app/src-tauri/tauri.conf.json +++ b/plugins/websocket/examples/svelte-app/src-tauri/tauri.conf.json @@ -51,4 +51,4 @@ "csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'" } } -} \ No newline at end of file +} diff --git a/plugins/websocket/examples/svelte-app/src/main.ts b/plugins/websocket/examples/svelte-app/src/main.ts index 64ce82ec..8278f6c0 100644 --- a/plugins/websocket/examples/svelte-app/src/main.ts +++ b/plugins/websocket/examples/svelte-app/src/main.ts @@ -1,8 +1,8 @@ -import App from './App.svelte'; +import App from "./App.svelte"; const app = new App({ - target: document.body, - props: {} + target: document.body, + props: {}, }); export default app; diff --git a/plugins/websocket/examples/svelte-app/tsconfig.json b/plugins/websocket/examples/svelte-app/tsconfig.json index b082e968..54312483 100644 --- a/plugins/websocket/examples/svelte-app/tsconfig.json +++ b/plugins/websocket/examples/svelte-app/tsconfig.json @@ -3,4 +3,4 @@ "include": ["src/**/*"], "exclude": ["node_modules/*", "__sapper__/*", "public/*"] -} \ No newline at end of file +}