-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip: clean up some things * feat: add vite-plugin-svelte-module * wip: add svelte module support to prebundling * fix: update to lastest changes and remove link * chore reenable prettier/eslint and fix findings * fix: remove runes option * fix: add types * fix: remove missing svelte5 exports workaround * refactor: consolidate svelte5 warnings into a single log * chore: enable running e2e tests with svelte5, update ci setup, add improve svelte5 generated vite config * fix workflow * fix: use correct comparison value for load-raw server output in svelte5
- Loading branch information
Showing
98 changed files
with
1,363 additions
and
1,743 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/vite-plugin-svelte': minor | ||
--- | ||
|
||
Add experimental support for svelte5 |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { createCounter } from './src/counter/Counter.svelte.js'; | ||
export { default as Counter } from './src/counter/Counter.svelte'; |
19 changes: 19 additions & 0 deletions
19
packages/e2e-tests/_test_dependencies/svelte-module/package.json
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 @@ | ||
{ | ||
"version": "1.0.0", | ||
"private": true, | ||
"name": "e2e-test-dep-svelte-module", | ||
"main": "index.js", | ||
"svelte": "index.js", | ||
"files": [ | ||
"src", | ||
"index.js" | ||
], | ||
"exports": { | ||
".": { | ||
"import": { | ||
"svelte": "./index.js" | ||
} | ||
} | ||
}, | ||
"type": "module" | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/e2e-tests/_test_dependencies/svelte-module/src/counter/Counter.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,13 @@ | ||
<script> | ||
import { createCounter } from './Counter.svelte.js'; | ||
const counter = createCounter(0); | ||
let localCounter = $state(0); | ||
</script> | ||
|
||
<button on:click={counter.increment}> | ||
count is {counter.count} | ||
</button> | ||
|
||
<button on:click={() => localCounter++}> | ||
local count is {localCounter} | ||
</button> |
11 changes: 11 additions & 0 deletions
11
packages/e2e-tests/_test_dependencies/svelte-module/src/counter/Counter.svelte.js
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,11 @@ | ||
export function createCounter(n = 0) { | ||
let count = $state(n); | ||
return { | ||
get count() { | ||
return count; | ||
}, | ||
increment() { | ||
count++; | ||
} | ||
}; | ||
} |
8 changes: 6 additions & 2 deletions
8
packages/e2e-tests/autoprefixer-browerslist/__tests__/autoprefixer-browerslist.spec.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
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,19 +1,22 @@ | ||
import { browserLogs, findAssetFile, getColor, getText, isBuild } from '~utils'; | ||
import { browserLogs, findAssetFile, getColor, getText, isBuild, isSvelte4 } from '~utils'; | ||
import { describe, test, expect } from 'vitest'; | ||
// svelte5 removed the css: none option | ||
describe.runIf(isSvelte4)('css-none', async () => { | ||
test('should not have failed requests', async () => { | ||
browserLogs.forEach((msg) => { | ||
expect(msg).not.toMatch('404'); | ||
}); | ||
}); | ||
|
||
test('should not have failed requests', async () => { | ||
browserLogs.forEach((msg) => { | ||
expect(msg).not.toMatch('404'); | ||
test('should not apply component css', async () => { | ||
expect(await getText('#test')).toBe('not red'); | ||
expect(await getColor('#test')).not.toBe('red'); | ||
}); | ||
}); | ||
|
||
test('should not apply component css', async () => { | ||
expect(await getText('#test')).toBe('not red'); | ||
expect(await getColor('#test')).not.toBe('red'); | ||
if (isBuild) { | ||
test('should not output css', async () => { | ||
const css = await findAssetFile(/index.*\.css/); | ||
expect(css).toBe(''); // findAssetFile returns empty for not found | ||
}); | ||
} | ||
}); | ||
|
||
if (isBuild) { | ||
test('should not output css', async () => { | ||
const css = await findAssetFile(/index.*\.css/); | ||
expect(css).toBe(''); // findAssetFile returns empty for not found | ||
}); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
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,7 +1,7 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body | ||
}); | ||
|
||
export default app; | ||
if (App.toString().startsWith('class ')) { | ||
new App({ target: document.body }); | ||
} else { | ||
import('svelte').then(({ mount }) => mount(App, { target: document.body })); | ||
} |
Oops, something went wrong.