-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: prerender optional parameters as empty when entries contains '*'
#11178
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
Merged
benmccann
merged 13 commits into
sveltejs:version-2
from
LorisSigrist:11133-crawl-optional-param-at-root
Dec 12, 2023
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5a67927
Prerender optional params without value
LorisSigrist 234cb59
Merge branch 'master' into 11133-crawl-optional-param-at-root
LorisSigrist d8c4bdf
Format, Lint & fix lockfile
LorisSigrist 4a8d717
Add changeset
LorisSigrist bcfe4dd
Update packages/kit/src/core/postbuild/prerender.js
LorisSigrist a32a5b3
Update .changeset/good-jars-relax.md
LorisSigrist e382995
Move test from own project into `prerendering/basics`
LorisSigrist 1b862f0
Merge remote-tracking branch 'origin/11133-crawl-optional-param-at-ro…
LorisSigrist d4697c9
Update KitConfig.entries description
LorisSigrist 24c4589
Hopefully fix test on ubuntu
LorisSigrist 02269ae
Update packages/kit/src/exports/public.d.ts
benmccann ff3ee54
Merge branch 'version-2' into 11133-crawl-optional-param-at-root
benmccann 37cfe14
update types
benmccann 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 hidden or 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 | ||
| --- | ||
|
|
||
| fix: Prerender optional parameters without value | ||
This file contains hidden or 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
21 changes: 21 additions & 0 deletions
21
packages/kit/test/prerendering/optional-params/package.json
This file contains hidden or 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,21 @@ | ||
| { | ||
| "name": "prerendering-test-optional-params", | ||
| "private": true, | ||
| "version": "0.0.1", | ||
| "scripts": { | ||
| "dev": "vite dev", | ||
| "build": "vite build", | ||
| "preview": "vite preview", | ||
| "check": "svelte-kit sync && tsc && svelte-check", | ||
| "test": "svelte-kit sync && pnpm build && vitest run" | ||
| }, | ||
| "devDependencies": { | ||
| "@sveltejs/kit": "workspace:^", | ||
| "svelte": "^4.2.2", | ||
| "svelte-check": "^3.4.4", | ||
| "typescript": "^4.9.4", | ||
| "vite": "^4.4.9", | ||
| "vitest": "^0.34.5" | ||
| }, | ||
| "type": "module" | ||
| } |
12 changes: 12 additions & 0 deletions
12
packages/kit/test/prerendering/optional-params/src/app.html
This file contains hidden or 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,12 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
| %sveltekit.head% | ||
| </head> | ||
| <body> | ||
| %sveltekit.body% | ||
| </body> | ||
| </html> |
1 change: 1 addition & 0 deletions
1
packages/kit/test/prerendering/optional-params/src/routes/+layout.js
This file contains hidden or 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 prerender = true; |
1 change: 1 addition & 0 deletions
1
packages/kit/test/prerendering/optional-params/src/routes/[[lang]]/+page.svelte
This file contains hidden or 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 @@ | ||
| <a href="/en">English</a> |
10 changes: 10 additions & 0 deletions
10
packages/kit/test/prerendering/optional-params/svelte.config.js
This file contains hidden or 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,10 @@ | ||
| import adapter from '../../../../adapter-static/index.js'; | ||
|
|
||
| /** @type {import('@sveltejs/kit').Config} */ | ||
| const config = { | ||
| kit: { | ||
| adapter: adapter() | ||
| } | ||
| }; | ||
|
|
||
| export default config; |
19 changes: 19 additions & 0 deletions
19
packages/kit/test/prerendering/optional-params/test/tests.spec.js
This file contains hidden or 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 @@ | ||
| import * as fs from 'node:fs'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { expect, test } from 'vitest'; | ||
| import { replace_hydration_attrs } from '../../test-utils'; | ||
|
|
||
| const build = fileURLToPath(new URL('../build', import.meta.url)); | ||
|
|
||
| /** @param {string} file */ | ||
| const read = (file) => fs.readFileSync(`${build}/${file}`, 'utf-8'); | ||
|
|
||
| test('prerenders /', () => { | ||
| const content = replace_hydration_attrs(read('index.html')); | ||
| expect(content).toContain('<a href="/en">English</a>'); | ||
| }); | ||
|
|
||
| test('prerenders nested /en', () => { | ||
| const content = replace_hydration_attrs(read('en.html')); | ||
| expect(content).toContain('<a href="/en">English</a>'); | ||
| }); |
16 changes: 16 additions & 0 deletions
16
packages/kit/test/prerendering/optional-params/tsconfig.json
This file contains hidden or 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 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "allowJs": true, | ||
| "checkJs": true, | ||
| "noEmit": true, | ||
| "module": "esnext", | ||
| "moduleResolution": "node", | ||
| "paths": { | ||
| "@sveltejs/kit": ["../../../types"], | ||
| "$lib": ["./src/lib"], | ||
| "$lib/*": ["./src/lib/*"], | ||
| "types": ["../../../types/internal"] | ||
| } | ||
| }, | ||
| "extends": "./.svelte-kit/tsconfig.json" | ||
| } |
23 changes: 23 additions & 0 deletions
23
packages/kit/test/prerendering/optional-params/vite.config.js
This file contains hidden or 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,23 @@ | ||
| import * as path from 'node:path'; | ||
| import { sveltekit } from '@sveltejs/kit/vite'; | ||
|
|
||
| /** @type {import('vite').UserConfig} */ | ||
| const config = { | ||
| build: { | ||
| minify: false | ||
| }, | ||
|
|
||
| clearScreen: false, | ||
|
|
||
| logLevel: 'silent', | ||
|
|
||
| plugins: [sveltekit()], | ||
|
|
||
| server: { | ||
| fs: { | ||
| allow: [path.resolve('../../../src')] | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| export default config; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Uh oh!
There was an error while loading. Please reload this page.