Repository: sveltejs/kit (js)

Issue:
explain status codes for 'fail' and 'redirect' functions in documentation
### Describe the problem

you have set typed status codes for both but I cannot figure out what they mean or why they are what they are, explaining in docs would be useful

### Describe the proposed solution

see above

### Alternatives considered

_No response_

### Importance

would make my life easier

### Additional Information

_No response_

Pull request:
docs: links to http status codes
closes #8264

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.


Patch:
diff --git a/.changeset/mean-pants-destroy.md b/.changeset/mean-pants-destroy.md
new file mode 100644
index 000000000..ec044f160
--- /dev/null
+++ b/.changeset/mean-pants-destroy.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+docs: links to http status codes
diff --git a/.changeset/nervous-socks-end.md b/.changeset/nervous-socks-end.md
new file mode 100644
index 000000000..eb690f87e
--- /dev/null
+++ b/.changeset/nervous-socks-end.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+fix: prerender page when prerender set to 'auto' and ssr set to true
diff --git a/.changeset/strange-pens-pump.md b/.changeset/strange-pens-pump.md
new file mode 100644
index 000000000..6ed108939
--- /dev/null
+++ b/.changeset/strange-pens-pump.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+fix: check version on node fetch fail
diff --git a/documentation/docs/20-core-concepts/10-routing.md b/documentation/docs/20-core-concepts/10-routing.md
index 1646886d8..3ba58edf5 100644
--- a/documentation/docs/20-core-concepts/10-routing.md
+++ b/documentation/docs/20-core-concepts/10-routing.md
@@ -129,6 +129,10 @@ If an error occurs during `load`, SvelteKit will render a default error page. Yo
 
 SvelteKit will 'walk up the tree' looking for the closest error boundary — if the file above didn't exist it would try `src/routes/blog/+error.svelte` and then `src/routes/+error.svelte` before rendering the default error page. If _that_ fails (or if the error was thrown from the `load` function of the root `+layout`, which sits 'above' the root `+error`), SvelteKit will bail out and render a static fallback error page, which you can customise by creating a `src/error.html` file.
 
+If the error occurs inside a `load` function in `+layout(.server).js`, the closest error boundary in the tree is an `+error.svelte` file _above_ that layout (not next to it).
+
+If no route can be found (404), `src/routes/+error.svelte` (or the default error page, if that file does not exist) will be used.
+
 > `+error.svelte` is _not_ used when an error occurs inside [`handle`](/docs/hooks#server-hooks-handle) or a [+server.js](#server) request handler.
 
 You can read more about error handling [here](/docs/errors).
diff --git a/documentation/docs/30-advanced/25-errors.md b/documentation/docs/30-advanced/25-errors.md
index 249aa8dd2..24d4862f6 100644
--- a/documentation/docs/30-advanced/25-errors.md
+++ b/documentation/docs/30-advanced/25-errors.md
@@ -131,7 +131,7 @@ You can customise the fallback error page by adding a `src/error.html` file:
 
 SvelteKit will replace `%sveltekit.status%` and `%sveltekit.error.message%` with their corresponding values.
 
-If the error instead occurs inside a `load` function while rendering a page, SvelteKit will render the [`+error.svelte`](/docs/routing#error) component nearest to where the error occurred.
+If the error instead occurs inside a `load` function while rendering a page, SvelteKit will render the [`+error.svelte`](/docs/routing#error) component nearest to where the error occurred. If the error occurs inside a `load` function in `+layout(.server).js`, the closest error boundary in the tree is an `+error.svelte` file _above_ that layout (not next to it).
 
 The exception is when the error occurs inside the root `+layout.js` or `+layout.server.js`, since the root layout would ordinarily _contain_ the `+error.svelte` component. In this case, SvelteKit uses the fallback error page.
 
diff --git a/packages/adapter-netlify/package.json b/packages/adapter-netlify/package.json
index 13cd02a73..c6c0c6f64 100644
--- a/packages/adapter-netlify/package.json
+++ b/packages/adapter-netlify/package.json
@@ -44,7 +44,7 @@
 		"@sveltejs/kit": "workspace:^",
 		"@types/node": "^16.18.6",
 		"@types/set-cookie-parser": "^2.4.2",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"rollup": "^3.7.0",
 		"typescript": "^4.9.4",
 		"uvu": "^0.5.6"
diff --git a/packages/adapter-node/package.json b/packages/adapter-node/package.json
index a2297bb30..d6c224db0 100644
--- a/packages/adapter-node/package.json
+++ b/packages/adapter-node/package.json
@@ -36,7 +36,7 @@
 		"@types/node": "^16.18.6",
 		"c8": "^7.12.0",
 		"polka": "^1.0.0-next.22",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"sirv": "^2.0.2",
 		"typescript": "^4.9.4",
 		"uvu": "^0.5.6"
diff --git a/packages/kit/src/core/prerender/prerender.js b/packages/kit/src/core/prerender/prerender.js
index 0e6f86306..07d7f0136 100644
--- a/packages/kit/src/core/prerender/prerender.js
+++ b/packages/kit/src/core/prerender/prerender.js
@@ -413,7 +413,7 @@ export async function prerender() {
 				// People can opt out of this behavior by explicitly setting prerender to false
 				(should_prerender !== false && get_option(nodes, 'ssr') === false && !page?.server?.actions
 					? 'auto'
-					: false);
+					: should_prerender ?? false);
 
 			prerender_map.set(route.id, prerender);
 		}
diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js
index ddc3a32c3..a669388e2 100644
--- a/packages/kit/src/runtime/client/client.js
+++ b/packages/kit/src/runtime/client/client.js
@@ -824,6 +824,12 @@ export function create_client({ target, base }) {
 						status = err.status;
 						error = err.body;
 					} else {
+						// Referenced node could have been removed due to redeploy, check
+						const updated = await stores.updated.check();
+						if (updated) {
+							return await native_navigation(url);
+						}
+
 						error = await handle_error(err, { params, url, route: { id: route.id } });
 					}
 
diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts
index 2944b989c..9924fd438 100644
--- a/packages/kit/types/index.d.ts
+++ b/packages/kit/types/index.d.ts
@@ -1080,7 +1080,7 @@ export type ActionResult<
  * Creates an `HttpError` object with an HTTP status code and an optional message.
  * This object, if thrown during request handling, will cause SvelteKit to
  * return an error response without invoking `handleError`
- * @param status The HTTP status code
+ * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
  * @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
  */
 export function error(status: number, body: App.Error): HttpError;
@@ -1094,15 +1094,16 @@ export function error(
  * The object returned by the [`error`](https://kit.svelte.dev/docs/modules#sveltejs-kit-error) function.
  */
 export interface HttpError {
-	/** The [HTTP status code](https://httpstatusdogs.com), in the range 400-599 */
+	/** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses), in the range 400-599. */
 	status: number;
 	/** The content of the error. */
 	body: App.Error;
 }
 
 /**
- * Create a `Redirect` object. If thrown during request handling, SvelteKit will
- * return a redirect response.
+ * Create a `Redirect` object. If thrown during request handling, SvelteKit will return a redirect response.
+ * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
+ * @param location The location to redirect to.
  */
 export function redirect(
 	status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308,
@@ -1113,7 +1114,7 @@ export function redirect(
  * The object returned by the [`redirect`](https://kit.svelte.dev/docs/modules#sveltejs-kit-redirect) function
  */
 export interface Redirect {
-	/** The [HTTP status code](https://httpstatusdogs.com), in the range 300-308. */
+	/** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages), in the range 300-308. */
 	status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308;
 	/** The location to redirect to. */
 	location: string;
@@ -1128,6 +1129,8 @@ export function json(data: any, init?: ResponseInit): Response;
 
 /**
  * Create an `ActionFailure` object.
+ * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
+ * @param data Data associated with the failure (e.g. validation errors)
  */
 export function fail<T extends Record<string, unknown> | undefined>(
 	status: number,
@@ -1139,7 +1142,9 @@ export function fail<T extends Record<string, unknown> | undefined>(
  */
 export interface ActionFailure<T extends Record<string, unknown> | undefined = undefined>
 	extends UniqueInterface {
+	/** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses), in the range 400-599. */
 	status: number;
+	/** Data associated with the failure (e.g. validation errors) */
 	data: T;
 }
 
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ff9c56b0d..69d62fe79 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -88,7 +88,7 @@ importers:
       '@types/node': ^16.18.6
       '@types/set-cookie-parser': ^2.4.2
       esbuild: ^0.16.3
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       rollup: ^3.7.0
       set-cookie-parser: ^2.5.1
       typescript: ^4.9.4
@@ -105,7 +105,7 @@ importers:
       '@sveltejs/kit': link:../kit
       '@types/node': 16.18.6
       '@types/set-cookie-parser': 2.4.2
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       rollup: 3.7.0
       typescript: 4.9.4
       uvu: 0.5.6
@@ -119,7 +119,7 @@ importers:
       '@types/node': ^16.18.6
       c8: ^7.12.0
       polka: ^1.0.0-next.22
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       rollup: ^3.7.0
       sirv: ^2.0.2
       typescript: ^4.9.4
@@ -134,7 +134,7 @@ importers:
       '@types/node': 16.18.6
       c8: 7.12.0
       polka: 1.0.0-next.22
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       sirv: 2.0.2
       typescript: 4.9.4
       uvu: 0.5.6
@@ -338,7 +338,7 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       svelte: ^3.55.1
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -346,7 +346,7 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       svelte: 3.55.1
       svelte-check: 3.0.2_svelte@3.55.1
       typescript: 4.9.4
@@ -356,7 +356,6 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^3.0.2
       svelte: ^3.55.1
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -364,7 +363,6 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 3.0.2
       svelte: 3.55.1
       svelte-check: 3.0.2_svelte@3.55.1
       typescript: 4.9.4
@@ -408,7 +406,7 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^3.0.2
+      rimraf: ^4.0.0
       svelte: ^3.55.1
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -416,7 +414,7 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 3.0.2
+      rimraf: 4.0.1
       svelte: 3.55.1
       svelte-check: 3.0.2_svelte@3.55.1
       typescript: 4.9.4
@@ -3736,6 +3734,12 @@ packages:
     dependencies:
       glob: 7.2.3
 
+  /rimraf/4.0.1:
+    resolution: {integrity: sha512-qwvb/Wzf8XJxdv8InnDtmijfbIk6gk576swPeogHbUh7AT4ezF42lvhXUdbIzMYrO4HbaXi1rYGhKTDyPF1AJw==}
+    engines: {node: '>=14'}
+    hasBin: true
+    dev: true
+
   /rollup-pluginutils/2.8.2:
     resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==}
     dependencies:


Test patch:
diff --git a/packages/kit/test/apps/basics/package.json b/packages/kit/test/apps/basics/package.json
index 3c1ac04cd..6257ff4b4 100644
--- a/packages/kit/test/apps/basics/package.json
+++ b/packages/kit/test/apps/basics/package.json
@@ -14,7 +14,7 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"svelte": "^3.55.1",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",
diff --git a/packages/kit/test/apps/dev-only/package.json b/packages/kit/test/apps/dev-only/package.json
index b4e3669c9..b5e510b23 100644
--- a/packages/kit/test/apps/dev-only/package.json
+++ b/packages/kit/test/apps/dev-only/package.json
@@ -12,7 +12,6 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^3.0.2",
 		"svelte": "^3.55.1",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",
diff --git a/packages/kit/test/apps/writes/package.json b/packages/kit/test/apps/writes/package.json
index 77c09f269..a4879d8c8 100644
--- a/packages/kit/test/apps/writes/package.json
+++ b/packages/kit/test/apps/writes/package.json
@@ -14,7 +14,7 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^3.0.2",
+		"rimraf": "^4.0.0",
 		"svelte": "^3.55.1",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",
diff --git a/packages/kit/test/prerendering/basics/test/test.js b/packages/kit/test/prerendering/basics/test/test.js
index 5304db890..d205597f3 100644
--- a/packages/kit/test/prerendering/basics/test/test.js
+++ b/packages/kit/test/prerendering/basics/test/test.js
@@ -139,7 +139,7 @@ test('decodes paths when writing files', () => {
 	assert.equal(content, JSON.stringify({ path: 'path with encoded spaces' }));
 });
 
-test('prerendering is set to true in global code of hooks.js', () => {
+test('prerendering is set to true in root +layout.js', () => {
 	const content = read('prerendering-true.html');
 	assert.ok(content.includes('<h1>prerendering: true/true</h1>'), content);
 });
diff --git a/packages/kit/test/prerendering/ssr-false/src/routes/prerenderable-3/+page.js b/packages/kit/test/prerendering/ssr-false/src/routes/prerenderable-3/+page.js
new file mode 100644
index 000000000..f1b9bcf9e
--- /dev/null
+++ b/packages/kit/test/prerendering/ssr-false/src/routes/prerenderable-3/+page.js
@@ -0,0 +1,2 @@
+export const prerender = 'auto';
+export const ssr = true;
diff --git a/packages/kit/test/prerendering/ssr-false/src/routes/prerenderable-3/+page.svelte b/packages/kit/test/prerendering/ssr-false/src/routes/prerenderable-3/+page.svelte
new file mode 100644
index 000000000..f844d12b1
--- /dev/null
+++ b/packages/kit/test/prerendering/ssr-false/src/routes/prerenderable-3/+page.svelte
@@ -0,0 +1,1 @@
+<p>prerenderable shell</p>
diff --git a/packages/kit/test/prerendering/ssr-false/test/test.js b/packages/kit/test/prerendering/ssr-false/test/test.js
index 6b70952ef..86912a868 100644
--- a/packages/kit/test/prerendering/ssr-false/test/test.js
+++ b/packages/kit/test/prerendering/ssr-false/test/test.js
@@ -18,8 +18,13 @@ test('prerenders /prerenderable-2 shell', () => {
 	assert.ok(!content.includes('prerenderable shell'));
 });
 
+test('prerenders /prerenderable-3 shell with ssr=true and prerender=auto', () => {
+	const content = read('prerenderable-3.html');
+	assert.ok(content.includes('prerenderable shell'));
+});
+
 test('does not prerender non prerenderable things', () => {
-	assert.equal(fs.readdirSync(build).length, 2);
+	assert.equal(fs.readdirSync(build).length, 3);
 });
 
 test('keeps not-explicitly-prerendered routes in the manifest', () => {