Repository: sveltejs/kit
Pull request #7724 (2022-11-19 04:22:40)

[chore] don't override printUrls
See https://github.com/vitejs/vite/issues/9378#issuecomment-1229771480 for an explanation

Should this close https://github.com/vitejs/vite/issues/9378?

changeset-bot[bot]: ###  ⚠️  No Changeset found

Latest commit: b4751f62641dbb557ab108ecb3f06bc6aa728230

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. **If these changes should result in a version bump, you need to add a changeset.**

<details><summary>This PR includes no changesets</summary>

  When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

</details>

[Click here to learn what changesets are, and how to add one](https://github.com/changesets/changesets/blob/master/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/benmccann/kit/new/deferred_warning?filename=.changeset/gold-laws-applaud.md&value=---%0A%22%40sveltejs%2Fkit%22%3A%20patch%0A---%0A%0A%5Bchore%5D%20don't%20override%20printUrls%0A)



Patch:
diff --git a/.changeset/green-timers-develop.md b/.changeset/green-timers-develop.md
new file mode 100644
index 000000000..cc63776d2
--- /dev/null
+++ b/.changeset/green-timers-develop.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Prevent Vite from nuking logs on startup
diff --git a/.changeset/perfect-needles-tap.md b/.changeset/perfect-needles-tap.md
new file mode 100644
index 000000000..be8b72924
--- /dev/null
+++ b/.changeset/perfect-needles-tap.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Always set `Accept` and `Accept-Language` headers when making a self-request
diff --git a/.changeset/pre.json b/.changeset/pre.json
index f47dd0e27..75af262c7 100644
--- a/.changeset/pre.json
+++ b/.changeset/pre.json
@@ -140,6 +140,7 @@
     "calm-spiders-turn",
     "calm-steaks-yell",
     "calm-walls-happen",
+    "calm-ways-jump",
     "chatty-apricots-fly",
     "chatty-ducks-shop",
     "chatty-impalas-smash",
@@ -167,6 +168,7 @@
     "clean-camels-pump",
     "clean-chicken-walk",
     "clean-countries-push",
+    "clean-grapes-think",
     "clean-islands-do",
     "clean-jars-float",
     "clean-schools-doubt",
@@ -307,6 +309,7 @@
     "empty-teachers-cheat",
     "empty-vans-draw",
     "empty-worms-appear",
+    "fair-dolls-press",
     "fair-panthers-notice",
     "fair-pets-bake",
     "fair-rivers-repair",
@@ -406,6 +409,7 @@
     "friendly-dodos-exercise",
     "friendly-eggs-cry",
     "friendly-pears-wash",
+    "friendly-plums-notice",
     "friendly-rivers-argue",
     "friendly-starfishes-yell",
     "funny-ads-move",
@@ -678,11 +682,13 @@
     "lovely-seahorses-sell",
     "lovely-sloths-flow",
     "lucky-bottles-kick",
+    "lucky-gifts-jump",
     "lucky-glasses-sell",
     "lucky-guests-act",
     "lucky-moles-count",
     "lucky-phones-march",
     "lucky-plums-listen",
+    "lucky-rocks-marry",
     "many-cups-report",
     "many-eyes-travel",
     "many-forks-sniff",
@@ -857,6 +863,7 @@
     "perfect-ghosts-shake",
     "perfect-kiwis-sneeze",
     "perfect-mayflies-sneeze",
+    "perfect-needles-tap",
     "perfect-rules-burn",
     "perfect-socks-sparkle",
     "pink-ducks-press",
@@ -1467,6 +1474,7 @@
     "wicked-cars-sniff",
     "wicked-humans-taste",
     "wicked-items-repair",
+    "wicked-kiwis-burn",
     "wicked-oranges-share",
     "wicked-plums-count",
     "wicked-rockets-roll",
diff --git a/packages/create-svelte/CHANGELOG.md b/packages/create-svelte/CHANGELOG.md
index 75e83cf8a..79e2ecb53 100644
--- a/packages/create-svelte/CHANGELOG.md
+++ b/packages/create-svelte/CHANGELOG.md
@@ -1,5 +1,11 @@
 # create-svelte
 
+## 2.0.0-next.192
+
+### Patch Changes
+
+- Ignore Vite timestamp files by default in `create-svelte` templates (added to `.gitignore`) ([#7660](https://github.com/sveltejs/kit/pull/7660))
+
 ## 2.0.0-next.191
 
 ### Patch Changes
diff --git a/packages/create-svelte/package.json b/packages/create-svelte/package.json
index 02af92a79..d21fce66a 100644
--- a/packages/create-svelte/package.json
+++ b/packages/create-svelte/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "create-svelte",
-	"version": "2.0.0-next.191",
+	"version": "2.0.0-next.192",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/CHANGELOG.md b/packages/kit/CHANGELOG.md
index 1142c62e9..50de67a82 100644
--- a/packages/kit/CHANGELOG.md
+++ b/packages/kit/CHANGELOG.md
@@ -1,5 +1,23 @@
 # @sveltejs/kit
 
+## 1.0.0-next.552
+
+### Patch Changes
+
+- Don't hardcode version in client bundle ([#7694](https://github.com/sveltejs/kit/pull/7694))
+
+- Allow .d.ts files to have a + prefix ([#7682](https://github.com/sveltejs/kit/pull/7682))
+
+- Expose version from `$app/environment` ([#7689](https://github.com/sveltejs/kit/pull/7689))
+
+- [fix] export HttpError/Redirect interface ([#7701](https://github.com/sveltejs/kit/pull/7701))
+
+- [fix] don't preload fonts by default ([#7704](https://github.com/sveltejs/kit/pull/7704))
+
+- Always set `Accept` and `Accept-Language` headers when making a self-request ([#7722](https://github.com/sveltejs/kit/pull/7722))
+
+- [fix] adjust interfaces to fix type errors ([#7718](https://github.com/sveltejs/kit/pull/7718))
+
 ## 1.0.0-next.551
 
 ### Patch Changes
diff --git a/packages/kit/package.json b/packages/kit/package.json
index 38bd048cf..95fa4adab 100644
--- a/packages/kit/package.json
+++ b/packages/kit/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "@sveltejs/kit",
-	"version": "1.0.0-next.551",
+	"version": "1.0.0-next.552",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js
index 179924b71..6d8642d0f 100644
--- a/packages/kit/src/exports/vite/index.js
+++ b/packages/kit/src/exports/vite/index.js
@@ -107,9 +107,6 @@ function kit() {
 	/** @type {import('types').BuildData} */
 	let build_data;
 
-	/** @type {string | undefined} */
-	let deferred_warning;
-
 	/** @type {{ public: Record<string, string>; private: Record<string, string> }} */
 	let env;
 
@@ -284,7 +281,9 @@ function kit() {
 				}
 			};
 
-			deferred_warning = warn_overridden_config(config, result);
+			const warning = warn_overridden_config(config, result);
+			if (warning) console.error(warning);
+
 			return result;
 		},
 
@@ -334,6 +333,10 @@ function kit() {
 		 */
 		configResolved(config) {
 			vite_config = config;
+
+			// This is a hack to prevent Vite from nuking useful logs,
+			// pending https://github.com/vitejs/vite/issues/9378
+			config.logger.warn('');
 		},
 
 		/**
@@ -540,14 +543,6 @@ function kit() {
 		 * @see https://vitejs.dev/guide/api-plugin.html#configureserver
 		 */
 		async configureServer(vite) {
-			// This method is called by Vite after clearing the screen.
-			// This patch ensures we can log any important messages afterwards for the user to see.
-			const print_urls = vite.printUrls;
-			vite.printUrls = function () {
-				print_urls.apply(this);
-				if (deferred_warning) console.error('\n' + deferred_warning);
-			};
-
 			return await dev(vite, vite_config, svelte_config);
 		},
 
diff --git a/packages/kit/src/runtime/server/fetch.js b/packages/kit/src/runtime/server/fetch.js
index 1b1b60bf6..89f21b5db 100644
--- a/packages/kit/src/runtime/server/fetch.js
+++ b/packages/kit/src/runtime/server/fetch.js
@@ -128,6 +128,17 @@ export function create_fetch({ event, options, state, get_cookie_header }) {
 					throw new Error('Request body must be a string or TypedArray');
 				}
 
+				if (!request.headers.has('accept')) {
+					request.headers.set('accept', '*/*');
+				}
+
+				if (!request.headers.has('accept-language')) {
+					request.headers.set(
+						'accept-language',
+						/** @type {string} */ (event.request.headers.get('accept-language'))
+					);
+				}
+
 				response = await respond(request, options, state);
 
 				const set_cookie = response.headers.get('set-cookie');


Test patch:
diff --git a/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers.json/+server.js b/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers.json/+server.js
deleted file mode 100644
index d58d91263..000000000
--- a/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers.json/+server.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import { json } from '@sveltejs/kit';
-
-/** @type {import('./$types').RequestHandler} */
-export function GET({ request }) {
-	/** @type {Record<string, string>} */
-	const body = {};
-
-	request.headers.forEach((value, key) => {
-		body[key] = value;
-	});
-
-	return json(body);
-}
diff --git a/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.js b/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.js
index 69e85a35b..991d09aef 100644
--- a/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.js
+++ b/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.js
@@ -1,6 +1,6 @@
 /** @type {import('@sveltejs/kit').Load} */
 export async function load({ fetch }) {
-	const res = await fetch('/load/fetch-request-headers.json');
+	const res = await fetch('/load/fetch-request-headers/data');
 
 	return {
 		headers: await res.json()
diff --git a/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.svelte b/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.svelte
index 27cbe80d0..3987470dd 100644
--- a/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.svelte
+++ b/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/+page.svelte
@@ -3,6 +3,8 @@
 	export let data;
 
 	const json = JSON.stringify({
+		accept: data.headers['accept'],
+		'accept-language': data.headers['accept-language'],
 		connection: data.headers['connection'],
 		'sec-fetch-dest': data.headers['sec-fetch-dest'],
 		'sec-fetch-mode': data.headers['sec-fetch-mode'],
diff --git a/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/data/+server.js b/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/data/+server.js
new file mode 100644
index 000000000..4d9966804
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/load/fetch-request-headers/data/+server.js
@@ -0,0 +1,6 @@
+import { json } from '@sveltejs/kit';
+
+/** @type {import('./$types').RequestHandler} */
+export function GET({ request }) {
+	return json(Object.fromEntries(request.headers));
+}
diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js
index 2ee921709..be47fcb68 100644
--- a/packages/kit/test/apps/basics/test/test.js
+++ b/packages/kit/test/apps/basics/test/test.js
@@ -817,6 +817,8 @@ test.describe('Load', () => {
 
 		if (javaScriptEnabled) {
 			expect(headers).toEqual({
+				accept: '*/*',
+				'accept-language': 'en-US',
 				// the referer will be the previous page in the client-side
 				// navigation case
 				referer: `${baseURL}/load`,
@@ -827,7 +829,10 @@ test.describe('Load', () => {
 				connection: 'keep-alive'
 			});
 		} else {
-			expect(headers).toEqual({});
+			expect(headers).toEqual({
+				accept: '*/*',
+				'accept-language': 'en-US'
+			});
 		}
 	});