-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] SSR never option #2529
Closed
Closed
[feat] SSR never option #2529
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
c90fc22
add 'never' option to ssr
JeanJPNM ba8b648
update options validator
JeanJPNM 7aab5d4
update page renderer
JeanJPNM dc28d89
fix no ssr response
JeanJPNM ce61f66
remove ssr union check
JeanJPNM 1e6185e
fix formatting
JeanJPNM 7fd45bd
add 'never' option to ssr
JeanJPNM 4ee0a9c
update options validator
JeanJPNM bc35a2c
update page renderer
JeanJPNM a3c0a30
fix no ssr response
JeanJPNM 73ebf0d
remove ssr union check
JeanJPNM 64947d0
fix formatting
JeanJPNM dede251
Merge branch 'ssr-never-option' of https://github.com/JeanJPNM/kit in…
JeanJPNM caf1d52
ensure ssr is boolean on get_page_config
JeanJPNM b78c01b
mention "never" on docs
JeanJPNM 7ecd93e
mention "never" on integrations faq
JeanJPNM bc144a0
avoid prerendering when ssr = 'never'
JeanJPNM 5701dd8
avoid importing components on server build
JeanJPNM d2f7b31
clarify "never" option on docs
JeanJPNM e04e707
fix typo on docs
JeanJPNM 87edb89
add changeset
JeanJPNM 0e83be9
Update changeset
JeanJPNM 25ded6c
update docs
JeanJPNM edbd994
add spa tests
JeanJPNM 2c86494
fix formatting
JeanJPNM 86d2d19
remove unused prerendering check
JeanJPNM f5d4645
check for ssr option in respond_with_error
JeanJPNM 9dad824
warn users about using "never"
JeanJPNM 5d9a94a
replace tabs by spaces on page/render.js
JeanJPNM 023ca9b
group module and metadata lookups
JeanJPNM cfc5eae
more concise spa check
JeanJPNM 1b4720e
type cast formatting
JeanJPNM be01755
show the file name in the error message
JeanJPNM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/kit': patch | ||
--- | ||
|
||
Added a "never" value to the config.kit.ssr option that prevents pages from being evaluated on the server on both ssr and prerendering. |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "test-spa", | ||
"private": true, | ||
"version": "0.0.1", | ||
"scripts": { | ||
"dev": "../../../svelte-kit.js dev", | ||
"build": "../../../svelte-kit.js build", | ||
"preview": "../../../svelte-kit.js preview" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/kit": "workspace:*", | ||
"@sveltejs/adapter-node": "workspace:*", | ||
"svelte": "^3.43.0" | ||
}, | ||
"type": "module" | ||
} |
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 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
|
||
%svelte.head% | ||
</head> | ||
<body> | ||
<div id="svelte">%svelte.body%</div> | ||
</body> | ||
</html> |
1 change: 1 addition & 0 deletions
1
packages/kit/test/apps/spa/src/routes/client-code/_client_dep.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 @@ | ||
export const root = /** @type {HTMLElement} */ (document.getElementById('svelte')); |
22 changes: 22 additions & 0 deletions
22
packages/kit/test/apps/spa/src/routes/client-code/_tests.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,22 @@ | ||
import * as assert from 'uvu/assert'; | ||
|
||
/** @type {import('test').TestMaker} */ | ||
export default function (test) { | ||
test('page with client only code', '/client-code', async ({ page, js }) => { | ||
if (js) { | ||
await page.waitForSelector('span'); | ||
assert.equal(await page.textContent('span'), 'App root is div#svelte'); | ||
} else { | ||
assert.ok(await page.evaluate(() => !document.querySelector('span'))); | ||
} | ||
}); | ||
|
||
test('page with client only dependency', '/client-code/dep', async ({ page, js }) => { | ||
if (js) { | ||
await page.waitForSelector('span'); | ||
assert.equal(await page.textContent('span'), 'App root is div#svelte'); | ||
} else { | ||
assert.ok(await page.evaluate(() => !document.querySelector('span'))); | ||
} | ||
}); | ||
} |
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 @@ | ||
<script> | ||
import { root } from './_client_dep'; | ||
</script> | ||
|
||
<span>App root is {root.localName}#{root.id}</span> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any harm in having
metadata_lookup
populated even if it's not used? I wonder if it might be simpler to just leave the code as is and not add an extra condition, but want to make sure I'm not missing anythingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I just thought that it would be better to not populate
metadata_lookup
when it isn't going to be used.