Skip to content

Commit 1b58184

Browse files
Merge pull request #298 from TorstenDittmann/feat-svelte-5
feat: svelte 5
2 parents 4cc698c + 3c49c53 commit 1b58184

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2165
-3400
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ jobs:
1414
- run: npm install -g --force corepack@latest
1515
- run: corepack enable
1616
- run: pnpm install --frozen-lockfile
17+
- run: pnpm run build
1718
- run: pnpm run lint

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- run: corepack enable
2020
- run: pnpm install --frozen-lockfile
2121
- run: pnpm run build
22-
- run: pnpm test
22+
- run: pnpm run test

apps/demo/.eslintignore

Lines changed: 0 additions & 13 deletions
This file was deleted.

apps/demo/.eslintrc.cjs

Lines changed: 0 additions & 31 deletions
This file was deleted.

apps/demo/.gitignore

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
.DS_Store
1+
test-results
22
node_modules
3-
/build
3+
4+
# Output
5+
.output
6+
.vercel
7+
.netlify
8+
.wrangler
49
/.svelte-kit
5-
/package
10+
/build
11+
12+
# OS
13+
.DS_Store
14+
Thumbs.db
15+
16+
# Env
617
.env
718
.env.*
819
!.env.example
20+
!.env.test
21+
22+
# Vite
923
vite.config.js.timestamp-*
1024
vite.config.ts.timestamp-*
11-
/test-results

apps/demo/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

apps/demo/.prettierignore

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
.DS_Store
2-
node_modules
3-
/build
4-
/.svelte-kit
5-
/package
6-
.env
7-
.env.*
8-
!.env.example
9-
10-
# Ignore files for PNPM, NPM and YARN
11-
pnpm-lock.yaml
1+
# Package Managers
122
package-lock.json
3+
pnpm-lock.yaml
134
yarn.lock
5+
bun.lock
6+
bun.lockb

apps/demo/.prettierrc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
{
2-
"useTabs": false,
3-
"tabWidth": 4,
4-
"singleQuote": true,
5-
"trailingComma": "all",
6-
"printWidth": 100,
7-
"plugins": ["prettier-plugin-svelte"],
8-
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
2+
"useTabs": true,
3+
"singleQuote": true,
4+
"trailingComma": "none",
5+
"printWidth": 100,
6+
"plugins": ["prettier-plugin-svelte"],
7+
"overrides": [
8+
{
9+
"files": "*.svelte",
10+
"options": {
11+
"parser": "svelte"
12+
}
13+
}
14+
]
915
}

apps/demo/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# sv
2+
3+
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
4+
5+
## Creating a project
6+
7+
If you're seeing this, you've probably already done this step. Congrats!
8+
9+
```bash
10+
# create a new project in the current directory
11+
npx sv create
12+
13+
# create a new project in my-app
14+
npx sv create my-app
15+
```
16+
17+
## Developing
18+
19+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
20+
21+
```bash
22+
npm run dev
23+
24+
# or start the server and open the app in a new browser tab
25+
npm run dev -- --open
26+
```
27+
28+
## Building
29+
30+
To create a production version of your app:
31+
32+
```bash
33+
npm run build
34+
```
35+
36+
You can preview the production build with `npm run preview`.
37+
38+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.

apps/demo/e2e/demo.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
test('tags work', async ({ page }) => {
4+
await page.goto('http://localhost:4173/playground/tags');
5+
6+
expect(await page.content()).toContain('Addition');
7+
expect(await page.content()).toContain('Multiply');
8+
expect(await page.content()).toContain('Types');
9+
});
10+
11+
test('tags work with types', async ({ page }) => {
12+
await page.goto('http://localhost:4173/playground/tags');
13+
14+
expect(await page.content()).toContain('Types');
15+
expect(await page.content()).toContain('<b>lorem ipsum</b> is typeof <b>string</b>');
16+
expect(await page.content()).toContain('<b>123</b> is typeof <b>number</b>');
17+
expect(await page.content()).toContain('<b>true</b> is typeof <b>boolean</b>');
18+
});
19+
20+
test('partials work', async ({ page }) => {
21+
await page.goto('http://localhost:4173/playground/partials');
22+
23+
expect(await page.content()).toContain('I am a partial.');
24+
expect(await page.content()).toContain('I am a nested partial.');
25+
expect(await page.content()).toContain('I am passed to a variable.');
26+
});
27+
28+
test('named layouts work', async ({ page }) => {
29+
await page.goto('http://localhost:4173/playground/layout');
30+
31+
expect(await page.content()).toContain('I am on an alternative layout');
32+
expect(await page.content()).toContain('And it works!');
33+
});

apps/demo/eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import prettier from 'eslint-config-prettier';
2+
import js from '@eslint/js';
3+
import { includeIgnoreFile } from '@eslint/compat';
4+
import svelte from 'eslint-plugin-svelte';
5+
import globals from 'globals';
6+
import { fileURLToPath } from 'node:url';
7+
import ts from 'typescript-eslint';
8+
import svelteConfig from './svelte.config.js';
9+
10+
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
11+
12+
export default ts.config(
13+
includeIgnoreFile(gitignorePath),
14+
js.configs.recommended,
15+
...ts.configs.recommended,
16+
...svelte.configs.recommended,
17+
prettier,
18+
...svelte.configs.prettier,
19+
{
20+
languageOptions: {
21+
globals: { ...globals.browser, ...globals.node }
22+
},
23+
rules: { 'no-undef': 'off' }
24+
},
25+
{
26+
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
27+
ignores: ['eslint.config.js', 'svelte.config.js'],
28+
languageOptions: {
29+
parserOptions: {
30+
projectService: true,
31+
extraFileExtensions: ['.svelte'],
32+
parser: ts.parser,
33+
svelteConfig
34+
}
35+
}
36+
}
37+
);

apps/demo/package.json

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
{
2-
"name": "demo",
3-
"version": "0.0.1",
4-
"private": true,
5-
"scripts": {
6-
"dev": "vite dev",
7-
"build": "vite build",
8-
"preview": "vite preview",
9-
"test": "playwright install --with-deps && playwright test",
10-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
12-
"lint": "prettier --check . && eslint .",
13-
"format": "prettier --write ."
14-
},
15-
"devDependencies": {
16-
"@playwright/test": "^1.28.1",
17-
"@sveltejs/adapter-cloudflare": "^4.4.0",
18-
"@sveltejs/kit": "catalog:default",
19-
"@sveltejs/vite-plugin-svelte": "^3.0.0",
20-
"@typescript-eslint/eslint-plugin": "^7.0.0",
21-
"@typescript-eslint/parser": "catalog:default",
22-
"eslint": "^8.53.0",
23-
"eslint-config-prettier": "^9.1.0",
24-
"eslint-plugin-svelte": "^2.35.1",
25-
"prettier": "catalog:default",
26-
"prettier-plugin-svelte": "^3.0.3",
27-
"svelte": "catalog:default",
28-
"svelte-check": "^3.6.2",
29-
"svelte-markdoc-preprocess": "workspace:*",
30-
"tslib": "^2.4.1",
31-
"typescript": "^5.5.2",
32-
"vite": "^5.0.0"
33-
},
34-
"type": "module",
35-
"dependencies": {
36-
"highlight.js": "^11.8.0"
37-
}
2+
"name": "demo-5",
3+
"private": true,
4+
"version": "0.0.1",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite dev",
8+
"build": "vite build",
9+
"preview": "vite preview",
10+
"prepare": "svelte-kit sync || echo ''",
11+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13+
"format": "prettier --write .",
14+
"lint": "prettier --check . && eslint .",
15+
"test:e2e": "playwright install --with-deps && playwright test",
16+
"test": "npm run test:e2e"
17+
},
18+
"devDependencies": {
19+
"@eslint/compat": "^1.2.7",
20+
"@eslint/js": "^9.23.0",
21+
"@playwright/test": "^1.51.1",
22+
"@sveltejs/adapter-auto": "^5.0.0",
23+
"@sveltejs/kit": "^2.20.2",
24+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
25+
"eslint": "^9.23.0",
26+
"eslint-config-prettier": "^10.1.1",
27+
"eslint-plugin-svelte": "^3.4.1",
28+
"globals": "^16.0.0",
29+
"prettier": "^3.5.3",
30+
"prettier-plugin-svelte": "^3.3.3",
31+
"svelte": "^5.25.5",
32+
"svelte-check": "^4.1.5",
33+
"svelte-markdoc-preprocess": "workspace:*",
34+
"typescript": "^5.8.2",
35+
"typescript-eslint": "^8.29.0",
36+
"vite": "^6.2.4"
37+
},
38+
"dependencies": {
39+
"highlight.js": "^11.11.1"
40+
}
3841
}

apps/demo/playwright.config.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import type { PlaywrightTestConfig } from '@playwright/test';
1+
import { defineConfig } from '@playwright/test';
22

3-
const config: PlaywrightTestConfig = {
4-
webServer: {
5-
command: 'npm run build && npm run preview',
6-
port: 4173,
7-
},
8-
testDir: 'tests',
9-
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
10-
};
11-
12-
export default config;
3+
export default defineConfig({
4+
webServer: {
5+
command: 'npm run build && npm run preview',
6+
port: 4173
7+
},
8+
testDir: 'e2e'
9+
});

apps/demo/src/app.d.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
// See https://kit.svelte.dev/docs/types#app
1+
// See https://svelte.dev/docs/kit/types#app.d.ts
22
// for information about these interfaces
33
declare global {
4-
namespace App {
5-
// interface Error {}
6-
// interface Locals {}
7-
// interface PageData {}
8-
// interface Platform {}
9-
}
4+
namespace App {
5+
// interface Error {}
6+
// interface Locals {}
7+
// interface PageData {}
8+
// interface PageState {}
9+
// interface Platform {}
10+
}
1011
}
1112

1213
export {};

apps/demo/src/app.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8" />
5-
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6-
<meta name="viewport" content="width=device-width" />
7-
<link
8-
rel="stylesheet"
9-
href="https://assets.ubuntu.com/v1/vanilla-framework-version-4.2.0.min.css"
10-
/>
11-
%sveltekit.head%
12-
</head>
13-
<body data-sveltekit-preload-data="hover">
14-
<div style="display: contents">%sveltekit.body%</div>
15-
</body>
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<link
8+
rel="stylesheet"
9+
href="https://assets.ubuntu.com/v1/vanilla-framework-version-4.2.0.min.css"
10+
/>
11+
%sveltekit.head%
12+
</head>
13+
<body data-sveltekit-preload-data="hover">
14+
<div style="display: contents">%sveltekit.body%</div>
15+
</body>
1616
</html>

apps/demo/src/lib/Nodes.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script context="module">
2-
export { default as Heading } from './nodes/Heading.svelte';
3-
export { default as Fence } from './nodes/Fence.svelte';
1+
<script module>
2+
export { default as Heading } from './nodes/Heading.svelte';
3+
export { default as Fence } from './nodes/Fence.svelte';
44
</script>

0 commit comments

Comments
 (0)