-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(create-rsbuild): support for both svelte4 and svelte5 (#3771)
- Loading branch information
1 parent
5f60607
commit e1cd766
Showing
27 changed files
with
178 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import { mount } from 'svelte'; | ||
import App from './App.svelte'; | ||
import './index.css'; | ||
|
||
const app = new App({ | ||
const app = mount(App, { | ||
target: document.body, | ||
props: { | ||
name: 'world', | ||
}, | ||
}); | ||
|
||
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import { mount } from 'svelte'; | ||
import App from './App.svelte'; | ||
import './index.css'; | ||
|
||
const app = new App({ | ||
const app = mount(App, { | ||
target: document.body, | ||
props: { | ||
name: 'world', | ||
}, | ||
}); | ||
|
||
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "rsbuild-svelte4-js", | ||
"private": true, | ||
"version": "1.0.0", | ||
"scripts": { | ||
"dev": "rsbuild dev --open", | ||
"build": "rsbuild build", | ||
"preview": "rsbuild preview" | ||
}, | ||
"dependencies": { | ||
"svelte": "^4.2.19" | ||
}, | ||
"devDependencies": { | ||
"@rsbuild/core": "^1.0.13", | ||
"@rsbuild/plugin-svelte": "^1.0.1" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/create-rsbuild/template-svelte4-js/rsbuild.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
import { pluginSvelte } from '@rsbuild/plugin-svelte'; | ||
|
||
export default defineConfig({ | ||
plugins: [pluginSvelte()], | ||
}); |
28 changes: 28 additions & 0 deletions
28
packages/create-rsbuild/template-svelte4-js/src/App.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<main> | ||
<div class="content"> | ||
<h1>Rsbuild with Svelte</h1> | ||
<p>Start building amazing things with Rsbuild.</p> | ||
</div> | ||
</main> | ||
|
||
<style> | ||
.content { | ||
display: flex; | ||
min-height: 100vh; | ||
line-height: 1.1; | ||
text-align: center; | ||
flex-direction: column; | ||
justify-content: center; | ||
} | ||
.content h1 { | ||
font-size: 3.6rem; | ||
font-weight: 700; | ||
} | ||
.content p { | ||
font-size: 1.2rem; | ||
font-weight: 400; | ||
opacity: 0.5; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
body { | ||
margin: 0; | ||
color: #fff; | ||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif; | ||
background-image: linear-gradient(to bottom, #020917, #101725); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import App from './App.svelte'; | ||
import './index.css'; | ||
|
||
const app = new App({ | ||
target: document.body, | ||
}); | ||
|
||
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "rsbuild-svelte4-ts", | ||
"private": true, | ||
"version": "1.0.0", | ||
"scripts": { | ||
"dev": "rsbuild dev --open", | ||
"build": "rsbuild build", | ||
"preview": "rsbuild preview", | ||
"svelte-check": "svelte-check --tsconfig ./tsconfig.json" | ||
}, | ||
"dependencies": { | ||
"svelte": "^4.2.19" | ||
}, | ||
"devDependencies": { | ||
"@rsbuild/core": "^1.0.13", | ||
"@rsbuild/plugin-svelte": "^1.0.1", | ||
"svelte-check": "^4.0.5", | ||
"typescript": "^5.6.3" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/create-rsbuild/template-svelte4-ts/rsbuild.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from '@rsbuild/core'; | ||
import { pluginSvelte } from '@rsbuild/plugin-svelte'; | ||
|
||
export default defineConfig({ | ||
plugins: [pluginSvelte()], | ||
}); |
28 changes: 28 additions & 0 deletions
28
packages/create-rsbuild/template-svelte4-ts/src/App.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<main> | ||
<div class="content"> | ||
<h1>Rsbuild with Svelte</h1> | ||
<p>Start building amazing things with Rsbuild.</p> | ||
</div> | ||
</main> | ||
|
||
<style> | ||
.content { | ||
display: flex; | ||
min-height: 100vh; | ||
line-height: 1.1; | ||
text-align: center; | ||
flex-direction: column; | ||
justify-content: center; | ||
} | ||
.content h1 { | ||
font-size: 3.6rem; | ||
font-weight: 700; | ||
} | ||
.content p { | ||
font-size: 1.2rem; | ||
font-weight: 400; | ||
opacity: 0.5; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference types="@rsbuild/core/types" /> | ||
/// <reference types="svelte" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
body { | ||
margin: 0; | ||
color: #fff; | ||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif; | ||
background-image: linear-gradient(to bottom, #020917, #101725); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import App from './App.svelte'; | ||
import './index.css'; | ||
|
||
const app = new App({ | ||
target: document.body, | ||
}); | ||
|
||
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"lib": ["DOM", "ES2020"], | ||
"module": "ESNext", | ||
"noEmit": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
// svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript | ||
// to enforce using `import type` instead of `import` for Types. | ||
"verbatimModuleSyntax": true, | ||
"isolatedModules": true, | ||
"resolveJsonModule": true, | ||
"moduleResolution": "bundler", | ||
"useDefineForClassFields": true, | ||
"allowImportingTsExtensions": true | ||
}, | ||
"include": ["src"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters