-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
only skip files that were already written when prerendering (#4928)
* only skip files that were already written when prerendering - fixes #4927 * update lockfile
- Loading branch information
1 parent
3d34924
commit ae416be
Showing
12 changed files
with
211 additions
and
1 deletion.
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 | ||
--- | ||
|
||
only skip files that were already written when 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "prerendering-test-paths-base", | ||
"private": true, | ||
"version": "0.0.1", | ||
"scripts": { | ||
"dev": "node ../../cli.js dev", | ||
"build": "node ../../cli.js build --verbose", | ||
"preview": "node ../../cli.js preview", | ||
"check": "tsc && svelte-check", | ||
"test": "npm run build && uvu test" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/kit": "workspace:*", | ||
"svelte": "^3.43.0", | ||
"svelte-check": "^2.5.0", | ||
"typescript": "~4.6.2", | ||
"uvu": "^0.5.2" | ||
}, | ||
"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,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
%svelte.head% | ||
</head> | ||
<body> | ||
%svelte.body% | ||
</body> | ||
</html> |
Empty file.
5 changes: 5 additions & 0 deletions
5
packages/kit/test/prerendering/paths-base/src/routes/dynamic/[slug].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,5 @@ | ||
<script> | ||
import { page } from '$app/stores'; | ||
</script> | ||
|
||
<h1>{$page.params.slug}</h1> |
10 changes: 10 additions & 0 deletions
10
packages/kit/test/prerendering/paths-base/src/routes/index.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,10 @@ | ||
<script context="module"> | ||
import { base } from '$app/paths'; | ||
export function load() { | ||
return { | ||
status: 301, | ||
redirect: `${base}/dynamic/foo` | ||
}; | ||
} | ||
</script> |
1 change: 1 addition & 0 deletions
1
packages/kit/test/prerendering/paths-base/src/routes/nested/index.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 @@ | ||
<h1>nested hello</h1> |
31 changes: 31 additions & 0 deletions
31
packages/kit/test/prerendering/paths-base/svelte.config.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,31 @@ | ||
import path from 'path'; | ||
import adapter from '../../../../adapter-static/index.js'; | ||
|
||
/** @type {import('@sveltejs/kit').Config} */ | ||
const config = { | ||
kit: { | ||
adapter: adapter(), | ||
|
||
paths: { | ||
base: '/path-base', | ||
}, | ||
|
||
prerender: { | ||
default: true | ||
}, | ||
|
||
vite: { | ||
build: { | ||
minify: false | ||
}, | ||
clearScreen: false, | ||
server: { | ||
fs: { | ||
allow: [path.resolve('../../../src')] | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default config; |
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,21 @@ | ||
import fs from 'fs'; | ||
import { fileURLToPath } from 'url'; | ||
import { test } from 'uvu'; | ||
import * as assert from 'uvu/assert'; | ||
|
||
const build = fileURLToPath(new URL('../build', import.meta.url)); | ||
|
||
/** @param {string} file */ | ||
const read = (file) => fs.readFileSync(`${build}/${file}`, 'utf-8'); | ||
|
||
test('prerenders /path-base', () => { | ||
const content = read('index.html'); | ||
assert.equal(content, '<meta http-equiv="refresh" content="0;url=/path-base/dynamic/foo">'); | ||
}); | ||
|
||
test('prerenders /path-base/dynamic/foo', () => { | ||
const content = read('dynamic/foo.html'); | ||
assert.ok(content.includes('<h1>foo</h1>')); | ||
}); | ||
|
||
test.run(); |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"paths": { | ||
"$lib": ["src/lib"], | ||
"$lib/*": ["src/lib/*"], | ||
"types": ["../../../types/internal"] | ||
} | ||
}, | ||
"extends": "./.svelte-kit/tsconfig.json" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.