├── demo ├── .npmrc ├── func │ ├── HelloWorld │ │ ├── sample.dat │ │ └── index.js │ ├── package.json │ └── host.json ├── static │ ├── robots.txt │ └── favicon.png ├── src │ ├── lib │ │ └── images │ │ │ ├── svelte-welcome.png │ │ │ ├── svelte-welcome.webp │ │ │ ├── github.svg │ │ │ └── svelte-logo.svg │ ├── routes │ │ ├── +page.js │ │ ├── about │ │ │ ├── +page.js │ │ │ └── +page.svelte │ │ ├── sverdle │ │ │ ├── how-to-play │ │ │ │ ├── +page.js │ │ │ │ └── +page.svelte │ │ │ ├── game.js │ │ │ ├── +page.server.js │ │ │ └── +page.svelte │ │ ├── methods │ │ │ └── +server.js │ │ ├── +layout.svelte │ │ ├── +page.svelte │ │ ├── Counter.svelte │ │ └── Header.svelte │ ├── app.d.ts │ ├── app.html │ └── app.css ├── swa-cli.config.json ├── vite.config.js ├── svelte.config.js ├── playwright.config.js ├── .gitignore ├── jsconfig.json ├── package.json ├── tests │ └── app.spec.js ├── README.md └── package-lock.json ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .vscode └── settings.json ├── files ├── api │ ├── local.settings.json │ ├── package.json │ ├── host.json │ └── .funcignore ├── entry.d.ts ├── headers.js └── entry.js ├── vite.config.js ├── tsconfig.json ├── .github └── workflows │ ├── test.yml │ ├── release.yml │ └── azure-static-web-apps-polite-desert-00b80111e.yml ├── CONTRIBUTING.md ├── LICENSE ├── package.json ├── index.d.ts ├── types └── swa.d.ts ├── test ├── json.js ├── headers.test.js └── index.test.js ├── index.js ├── CHANGELOG.md └── README.md /demo/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | coverage/ 3 | *.tgz 4 | .vscode/ -------------------------------------------------------------------------------- /demo/func/HelloWorld/sample.dat: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Azure" 3 | } -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | CHANGELOG.md 2 | coverage/ 3 | build/ 4 | .svelte-kit/ 5 | sk_render/ -------------------------------------------------------------------------------- /demo/static/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /demo/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geoffrich/svelte-adapter-azure-swa/HEAD/demo/static/favicon.png -------------------------------------------------------------------------------- /demo/func/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "**/index.js", 3 | "dependencies": { 4 | "@azure/functions": "^4" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "printWidth": 100 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.formatOnSave": true, 3 | "[json]": { 4 | "editor.formatOnSave": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /files/api/local.settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "IsEncrypted": false, 3 | "Values": { 4 | "FUNCTIONS_WORKER_RUNTIME": "node" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /files/api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "sk_render/index.js", 3 | "dependencies": { 4 | "@azure/functions": "^4" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /demo/src/lib/images/svelte-welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geoffrich/svelte-adapter-azure-swa/HEAD/demo/src/lib/images/svelte-welcome.png -------------------------------------------------------------------------------- /demo/src/lib/images/svelte-welcome.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geoffrich/svelte-adapter-azure-swa/HEAD/demo/src/lib/images/svelte-welcome.webp -------------------------------------------------------------------------------- /demo/swa-cli.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": { 3 | "app": { 4 | "outputLocation": "./build/static", 5 | "apiLocation": "./build/server" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /demo/func/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "extensionBundle": { 4 | "id": "Microsoft.Azure.Functions.ExtensionBundle", 5 | "version": "[4.0.0, 5.0.0)" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /files/api/host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "extensionBundle": { 4 | "id": "Microsoft.Azure.Functions.ExtensionBundle", 5 | "version": "[4.0.0, 5.0.0)" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /demo/src/routes/+page.js: -------------------------------------------------------------------------------- 1 | // since there's no dynamic data here, we can prerender 2 | // it so that it gets served as a static asset in production 3 | export const prerender = true; 4 | -------------------------------------------------------------------------------- /demo/vite.config.js: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import { defineConfig } from 'vite'; 3 | 4 | export default defineConfig({ 5 | plugins: [sveltekit()] 6 | }); 7 | -------------------------------------------------------------------------------- /files/api/.funcignore: -------------------------------------------------------------------------------- 1 | *.js.map 2 | *.ts 3 | .git* 4 | .vscode 5 | __azurite_db*__.json 6 | __blobstorage__ 7 | __queuestorage__ 8 | local.settings.json 9 | test 10 | tsconfig.json -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { configDefaults, defineConfig } from 'vitest/config'; 2 | 3 | export default defineConfig({ 4 | test: { 5 | exclude: [...configDefaults.exclude, 'demo/**'] 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /files/entry.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'SERVER' { 2 | export { Server } from '@sveltejs/kit'; 3 | } 4 | 5 | declare module 'MANIFEST' { 6 | import { SSRManifest } from '@sveltejs/kit'; 7 | export const manifest: SSRManifest; 8 | } 9 | -------------------------------------------------------------------------------- /demo/svelte.config.js: -------------------------------------------------------------------------------- 1 | import adapter from 'svelte-adapter-azure-swa'; 2 | 3 | /** @type {import('@sveltejs/kit').Config} */ 4 | const config = { 5 | kit: { 6 | adapter: adapter({ 7 | apiDir: './func' 8 | }) 9 | } 10 | }; 11 | 12 | export default config; 13 | -------------------------------------------------------------------------------- /demo/playwright.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('@playwright/test').PlaywrightTestConfig} */ 2 | const config = { 3 | webServer: process.env.CI 4 | ? undefined 5 | : { 6 | command: 'npm run build && npm run preview', 7 | port: 4173 8 | } 9 | }; 10 | 11 | export default config; 12 | -------------------------------------------------------------------------------- /demo/src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://svelte.dev/docs/kit/types#app.d.ts 2 | // for information about these interfaces 3 | declare global { 4 | namespace App { 5 | // interface Error {} 6 | // interface Locals {} 7 | // interface PageData {} 8 | // interface PageState {} 9 | // interface Platform {} 10 | } 11 | } 12 | 13 | export {}; 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "checkJs": true, 5 | "noEmit": true, 6 | "noImplicitAny": true, 7 | "target": "es2022", 8 | "module": "es2022", 9 | "moduleResolution": "node", 10 | "allowSyntheticDefaultImports": true, 11 | "lib": ["es2023"] 12 | }, 13 | "include": ["./index.js", "files"] 14 | } 15 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | test-results 2 | node_modules 3 | 4 | # Output 5 | .output 6 | .vercel 7 | .netlify 8 | .wrangler 9 | /.svelte-kit 10 | /build 11 | 12 | # OS 13 | .DS_Store 14 | Thumbs.db 15 | 16 | # Env 17 | .env 18 | .env.* 19 | !.env.example 20 | !.env.test 21 | 22 | # Vite 23 | vite.config.js.timestamp-* 24 | vite.config.ts.timestamp-* 25 | 26 | sk_render/ -------------------------------------------------------------------------------- /demo/src/routes/about/+page.js: -------------------------------------------------------------------------------- 1 | import { dev } from '$app/environment'; 2 | 3 | // we don't need any JS on this page, though we'll load 4 | // it in dev so that we get hot module replacement 5 | export const csr = dev; 6 | 7 | // since there's no dynamic data here, we can prerender 8 | // it so that it gets served as a static asset in production 9 | export const prerender = true; 10 | -------------------------------------------------------------------------------- /demo/src/routes/sverdle/how-to-play/+page.js: -------------------------------------------------------------------------------- 1 | import { dev } from '$app/environment'; 2 | 3 | // we don't need any JS on this page, though we'll load 4 | // it in dev so that we get hot module replacement 5 | export const csr = dev; 6 | 7 | // since there's no dynamic data here, we can prerender 8 | // it so that it gets served as a static asset in production 9 | export const prerender = true; 10 | -------------------------------------------------------------------------------- /demo/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |10 | This is a SvelteKit app. You can make your own by typing 11 | the following into your command line and following the prompts: 12 |
13 | 14 |npx sv create15 | 16 |
17 | The page you're looking at is purely static HTML, with no client-side interactivity needed. 18 | Because of that, we don't need to load any JavaScript. Try viewing the page's source, or opening 19 | the devtools network panel and reloading. 20 |
21 | 22 |23 | The Sverdle page illustrates SvelteKit's data loading and form handling. Try 24 | using it with JavaScript disabled! 25 |
26 |10 | Sverdle is a clone of Wordle, the 11 | word guessing game. To play, enter a five-letter English word. For example: 12 |
13 | 14 |23 | The y is in the right place. r and 24 | t 25 | are the right letters, but in the wrong place. The other letters are wrong, and can be discarded. 26 | Let's make another guess: 27 |
28 | 29 |This time we guessed right! You have six guesses to get the word.
38 | 39 |
40 | Unlike the original Wordle, Sverdle runs on the server instead of in the browser, making it
41 | impossible to cheat. It uses <form> and cookies to submit data, meaning you can
42 | even play with JavaScript disabled!
43 |