Repository: sveltejs/kit
Pull request #3471 (2022-01-20 21:01:07)

publish tags
WIP for now, clean up our debugging, and prepare to set version in the commit message for the template repository.

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [ ] 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
- [ ] 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
- [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpx changeset` and following the prompts. All changesets should be `patch` until SvelteKit 1.0


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

Latest commit: 0dd83f7a727e1111caa17f9e9962c48904f88c3b

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/antony/kit/new/cleanup-update-template?filename=.changeset/young-fireants-shout.md&value=---%0A%0A---%0A%0Awip%20-%20cleanup%20debugging%0A)


antony: Before we try to get the `npm_version_number` into this PR, we need to consider if this is the correct version number to include. Updating kit components without updating the cli obviously would not update this release number, and all of the kit component versions would be listed in the `package.json` anyway. So I wonder if this becomes more of a date, or something, or a reference to a build workflow run, instead.

Patch:
diff --git a/.changeset/pre.json b/.changeset/pre.json
index a775af371..279b56e65 100644
--- a/.changeset/pre.json
+++ b/.changeset/pre.json
@@ -134,6 +134,7 @@
     "eight-glasses-sparkle",
     "eight-hats-worry",
     "eight-keys-give",
+    "eight-readers-thank",
     "eighty-candles-grow",
     "eighty-carrots-heal",
     "eighty-waves-obey",
diff --git a/.changeset/proud-buses-hug.md b/.changeset/proud-buses-hug.md
new file mode 100644
index 000000000..98213f1c8
--- /dev/null
+++ b/.changeset/proud-buses-hug.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Decode fetched resources before checking against manifest when prerendering
diff --git a/.changeset/serious-horses-rule.md b/.changeset/serious-horses-rule.md
new file mode 100644
index 000000000..9932eb971
--- /dev/null
+++ b/.changeset/serious-horses-rule.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Breaking: remove -H and (conflicting) -h shortcuts from CLI
diff --git a/.github/workflows/update_template.yml b/.github/workflows/update_template.yml
index dcca025e1..947221885 100644
--- a/.github/workflows/update_template.yml
+++ b/.github/workflows/update_template.yml
@@ -1,11 +1,9 @@
 name: Update Template
 
 on:
-  workflow_run:
-    workflows: [Release]
-    types:
-      - completed
-  workflow_dispatch:
+  push:
+    tags:
+      - create-svelte@*
 
 jobs:
   release:
@@ -51,9 +49,8 @@ jobs:
       - name: Publish
         working-directory: ${{ github.workspace }}/template
         run: |
-          touch "generated-$(date +%s)"
           git config user.email "noreply@svelte.dev"
           git config user.name "[bot]"
           git add -A
-          git commit -m "version $npm_package_version"
+          git commit -m "create-svelte version ${{ github.ref_name }}"
           git push -u origin main -f
diff --git a/package.json b/package.json
index 8abc7d377..d72d328f9 100644
--- a/package.json
+++ b/package.json
@@ -9,9 +9,8 @@
 		"check": "pnpm -r check",
 		"lint": "pnpm -r lint",
 		"format": "pnpm -r format",
-		"release": "pnpm publish --tag=next --filter=\"@sveltejs/*\" --filter=\"create-svelte\"",
-		"preview:docs": "action-deploy-docs --project=kit",
-		"changeset:version": "changeset version && pnpm i --lockfile-only"
+		"release": "pnpm changeset publish --tag=next --filter=\"@sveltejs/*\" --filter=\"create-svelte\"",
+		"preview:docs": "action-deploy-docs --project=kit"
 	},
 	"repository": {
 		"type": "git",
diff --git a/packages/kit/CHANGELOG.md b/packages/kit/CHANGELOG.md
index 0e0256107..52de0d8ec 100644
--- a/packages/kit/CHANGELOG.md
+++ b/packages/kit/CHANGELOG.md
@@ -1,5 +1,11 @@
 # @sveltejs/kit
 
+## 1.0.0-next.247
+
+### Patch Changes
+
+- fix handling an incoming request from HTTP/2 ([#3572](https://github.com/sveltejs/kit/pull/3572))
+
 ## 1.0.0-next.246
 
 ### Patch Changes
diff --git a/packages/kit/package.json b/packages/kit/package.json
index 4bdbad79d..59855a0d9 100644
--- a/packages/kit/package.json
+++ b/packages/kit/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "@sveltejs/kit",
-	"version": "1.0.0-next.246",
+	"version": "1.0.0-next.247",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/src/cli.js b/packages/kit/src/cli.js
index cf5e532e3..44284332c 100755
--- a/packages/kit/src/cli.js
+++ b/packages/kit/src/cli.js
@@ -45,11 +45,14 @@ prog
 	.command('dev')
 	.describe('Start a development server')
 	.option('-p, --port', 'Port')
-	.option('-h, --host', 'Host (only use this on trusted networks)')
-	.option('-H, --https', 'Use self-signed HTTPS certificate')
 	.option('-o, --open', 'Open a browser tab')
-	.action(async ({ port, host, https, open }) => {
+	.option('--host', 'Host (only use this on trusted networks)')
+	.option('--https', 'Use self-signed HTTPS certificate')
+	.option('-H', 'no longer supported, use --https instead') // TODO remove for 1.0
+	.action(async ({ port, host, https, open, H }) => {
 		try {
+			if (H) throw new Error('-H is no longer supported — use --https instead');
+
 			process.env.NODE_ENV = process.env.NODE_ENV || 'development';
 			const config = await load_config();
 
@@ -118,11 +121,14 @@ prog
 	.command('preview')
 	.describe('Serve an already-built app')
 	.option('-p, --port', 'Port', 3000)
-	.option('-h, --host', 'Host (only use this on trusted networks)', 'localhost')
-	.option('-H, --https', 'Use self-signed HTTPS certificate', false)
 	.option('-o, --open', 'Open a browser tab', false)
-	.action(async ({ port, host, https, open }) => {
+	.option('--host', 'Host (only use this on trusted networks)', 'localhost')
+	.option('--https', 'Use self-signed HTTPS certificate', false)
+	.option('-H', 'no longer supported, use --https instead') // TODO remove for 1.0
+	.action(async ({ port, host, https, open, H }) => {
 		try {
+			if (H) throw new Error('-H is no longer supported — use --https instead');
+
 			await check_port(port);
 
 			process.env.NODE_ENV = process.env.NODE_ENV || 'production';
diff --git a/packages/kit/src/core/dev/plugin.js b/packages/kit/src/core/dev/plugin.js
index 763475d54..97af10bda 100644
--- a/packages/kit/src/core/dev/plugin.js
+++ b/packages/kit/src/core/dev/plugin.js
@@ -25,7 +25,7 @@ export async function create_plugin(config, cwd) {
 
 	if (config.kit.amp) {
 		process.env.VITE_SVELTEKIT_AMP = 'true';
-		amp = (await import('./amp_hook')).handle;
+		amp = (await import('./amp_hook.js')).handle;
 	}
 
 	return {
diff --git a/packages/kit/src/runtime/server/page/load_node.js b/packages/kit/src/runtime/server/page/load_node.js
index 66a61a9ff..bb878ae14 100644
--- a/packages/kit/src/runtime/server/page/load_node.js
+++ b/packages/kit/src/runtime/server/page/load_node.js
@@ -105,7 +105,7 @@ export async function load_node({
 				// handle fetch requests for static assets. e.g. prebaked data, etc.
 				// we need to support everything the browser's fetch supports
 				const prefix = options.paths.assets || options.paths.base;
-				const filename = (
+				const filename = decodeURIComponent(
 					resolved.startsWith(prefix) ? resolved.slice(prefix.length) : resolved
 				).slice(1);
 				const filename_html = `${filename}/index.html`; // path may also match path/index.html


Test patch:
diff --git a/packages/kit/src/packaging/test/fixtures/emitTypes-false/expected/package.json b/packages/kit/src/packaging/test/fixtures/emitTypes-false/expected/package.json
index 3c97b0b19..155b61eed 100644
--- a/packages/kit/src/packaging/test/fixtures/emitTypes-false/expected/package.json
+++ b/packages/kit/src/packaging/test/fixtures/emitTypes-false/expected/package.json
@@ -10,5 +10,6 @@
 		"./Test2.svelte": "./Test2.svelte",
 		".": "./index.js"
 	},
-	"svelte": "./index.js"
-}
+	"svelte": "./index.js",
+	"private": true
+}
\ No newline at end of file
diff --git a/packages/kit/src/packaging/test/fixtures/emitTypes-false/package.json b/packages/kit/src/packaging/test/fixtures/emitTypes-false/package.json
index ec97559d2..9e7047972 100644
--- a/packages/kit/src/packaging/test/fixtures/emitTypes-false/package.json
+++ b/packages/kit/src/packaging/test/fixtures/emitTypes-false/package.json
@@ -3,5 +3,6 @@
 	"private": true,
 	"version": "1.0.0",
 	"description": "emitTypes settings disabled",
-	"type": "module"
+	"type": "module",
+	"private": true
 }
diff --git a/packages/kit/src/packaging/test/fixtures/exports-merge/expected/package.json b/packages/kit/src/packaging/test/fixtures/exports-merge/expected/package.json
index 87ee8e1ea..c9b9cf831 100644
--- a/packages/kit/src/packaging/test/fixtures/exports-merge/expected/package.json
+++ b/packages/kit/src/packaging/test/fixtures/exports-merge/expected/package.json
@@ -18,5 +18,6 @@
 		"./package.json": "./package.json"
 	},
 	"type": "module",
-	"svelte": "./index.js"
-}
+	"svelte": "./index.js",
+	"private": true
+}
\ No newline at end of file
diff --git a/packages/kit/src/packaging/test/fixtures/exports-merge/package.json b/packages/kit/src/packaging/test/fixtures/exports-merge/package.json
index 0033602dd..65239ea98 100644
--- a/packages/kit/src/packaging/test/fixtures/exports-merge/package.json
+++ b/packages/kit/src/packaging/test/fixtures/exports-merge/package.json
@@ -9,5 +9,6 @@
 		},
 		"./constants": "./internal/constants.js",
 		"./Test": "./Test.svelte"
-	}
+	},
+	"private": true
 }
diff --git a/packages/kit/src/packaging/test/fixtures/exports-replace/expected/package.json b/packages/kit/src/packaging/test/fixtures/exports-replace/expected/package.json
index e84633d71..195d12dbb 100644
--- a/packages/kit/src/packaging/test/fixtures/exports-replace/expected/package.json
+++ b/packages/kit/src/packaging/test/fixtures/exports-replace/expected/package.json
@@ -10,5 +10,6 @@
 		},
 		"./package.json": "./package.json"
 	},
-	"svelte": "./Test.svelte"
-}
+	"svelte": "./Test.svelte",
+	"private": true
+}
\ No newline at end of file
diff --git a/packages/kit/src/packaging/test/fixtures/exports-replace/package.json b/packages/kit/src/packaging/test/fixtures/exports-replace/package.json
index 96c198738..15f323229 100644
--- a/packages/kit/src/packaging/test/fixtures/exports-replace/package.json
+++ b/packages/kit/src/packaging/test/fixtures/exports-replace/package.json
@@ -9,5 +9,6 @@
 			"import": "./index.js"
 		}
 	},
-	"svelte": "./Test.svelte"
+	"svelte": "./Test.svelte",
+	"private": true
 }
diff --git a/packages/kit/src/packaging/test/fixtures/files-exclude/expected/package.json b/packages/kit/src/packaging/test/fixtures/files-exclude/expected/package.json
index 26f20bb77..a3c82600a 100644
--- a/packages/kit/src/packaging/test/fixtures/files-exclude/expected/package.json
+++ b/packages/kit/src/packaging/test/fixtures/files-exclude/expected/package.json
@@ -10,5 +10,6 @@
 		"./Test.svelte": "./Test.svelte",
 		".": "./index.js"
 	},
-	"svelte": "./index.js"
-}
+	"svelte": "./index.js",
+	"private": true
+}
\ No newline at end of file
diff --git a/packages/kit/src/packaging/test/fixtures/files-exclude/package.json b/packages/kit/src/packaging/test/fixtures/files-exclude/package.json
index c81333c30..bd93108f9 100644
--- a/packages/kit/src/packaging/test/fixtures/files-exclude/package.json
+++ b/packages/kit/src/packaging/test/fixtures/files-exclude/package.json
@@ -3,5 +3,6 @@
 	"private": true,
 	"version": "1.0.0",
 	"description": "files.exclude settings configured",
-	"type": "module"
+	"type": "module",
+	"private": true
 }
diff --git a/packages/kit/src/packaging/test/fixtures/javascript/expected/package.json b/packages/kit/src/packaging/test/fixtures/javascript/expected/package.json
index 3d7d65e37..eb0e3fbaf 100644
--- a/packages/kit/src/packaging/test/fixtures/javascript/expected/package.json
+++ b/packages/kit/src/packaging/test/fixtures/javascript/expected/package.json
@@ -13,5 +13,6 @@
 		"./utils": "./utils.js",
 		".": "./index.js"
 	},
-	"svelte": "./index.js"
-}
+	"svelte": "./index.js",
+	"private": true
+}
\ No newline at end of file
diff --git a/packages/kit/src/packaging/test/fixtures/javascript/package.json b/packages/kit/src/packaging/test/fixtures/javascript/package.json
index 77440f772..6a4302f4a 100644
--- a/packages/kit/src/packaging/test/fixtures/javascript/package.json
+++ b/packages/kit/src/packaging/test/fixtures/javascript/package.json
@@ -2,5 +2,6 @@
 	"name": "javascript",
 	"private": true,
 	"version": "1.0.0",
-	"description": "standard javascript package"
+	"description": "standard javascript package",
+	"private": true
 }
diff --git a/packages/kit/src/packaging/test/fixtures/resolve-alias/expected/package.json b/packages/kit/src/packaging/test/fixtures/resolve-alias/expected/package.json
index 3e59313a2..8fe125dd9 100644
--- a/packages/kit/src/packaging/test/fixtures/resolve-alias/expected/package.json
+++ b/packages/kit/src/packaging/test/fixtures/resolve-alias/expected/package.json
@@ -12,5 +12,6 @@
 		"./sub/bar": "./sub/bar.js",
 		"./sub/foo": "./sub/foo.js"
 	},
-	"svelte": "./index.js"
-}
+	"svelte": "./index.js",
+	"private": true
+}
\ No newline at end of file
diff --git a/packages/kit/src/packaging/test/fixtures/resolve-alias/package.json b/packages/kit/src/packaging/test/fixtures/resolve-alias/package.json
index 19ecfdbec..c3b4b1e06 100644
--- a/packages/kit/src/packaging/test/fixtures/resolve-alias/package.json
+++ b/packages/kit/src/packaging/test/fixtures/resolve-alias/package.json
@@ -3,5 +3,6 @@
 	"private": true,
 	"version": "1.0.0",
 	"description": "package using $lib alias",
-	"type": "module"
+	"type": "module",
+	"private": true
 }
diff --git a/packages/kit/src/packaging/test/fixtures/typescript/expected/package.json b/packages/kit/src/packaging/test/fixtures/typescript/expected/package.json
index 59ea2b06d..1a13934d3 100644
--- a/packages/kit/src/packaging/test/fixtures/typescript/expected/package.json
+++ b/packages/kit/src/packaging/test/fixtures/typescript/expected/package.json
@@ -12,5 +12,6 @@
 		"./utils": "./utils.js",
 		".": "./index.js"
 	},
-	"svelte": "./index.js"
-}
+	"svelte": "./index.js",
+	"private": true
+}
\ No newline at end of file
diff --git a/packages/kit/src/packaging/test/fixtures/typescript/package.json b/packages/kit/src/packaging/test/fixtures/typescript/package.json
index 7e166c721..32db075e1 100644
--- a/packages/kit/src/packaging/test/fixtures/typescript/package.json
+++ b/packages/kit/src/packaging/test/fixtures/typescript/package.json
@@ -3,5 +3,6 @@
 	"private": true,
 	"version": "1.0.0",
 	"description": "standard typescript package",
-	"type": "module"
+	"type": "module",
+	"private": true
 }
diff --git a/packages/kit/test/prerendering/basics/src/routes/load-file-with-spaces.svelte b/packages/kit/test/prerendering/basics/src/routes/load-file-with-spaces.svelte
new file mode 100644
index 000000000..b0a3d165f
--- /dev/null
+++ b/packages/kit/test/prerendering/basics/src/routes/load-file-with-spaces.svelte
@@ -0,0 +1,25 @@
+<script context="module">
+	/** @type {import('@sveltejs/kit').Load} */
+	export async function load({ fetch }) {
+		const r1 = await fetch('/file%20with%20spaces.json');
+		const p1 = await r1.json();
+
+		const r2 = await fetch('/file with spaces.json');
+		const p2 = await r2.json();
+
+		if (p1.answer !== p2.answer) {
+			throw new Error('oops');
+		}
+
+		return {
+			props: p1
+		};
+	}
+</script>
+
+<script>
+	/** @type {number} */
+	export let answer;
+</script>
+
+<h1>answer: {answer}</h1>
diff --git a/packages/kit/test/prerendering/basics/static/file with spaces.json b/packages/kit/test/prerendering/basics/static/file with spaces.json
new file mode 100644
index 000000000..6e887fd6a
--- /dev/null
+++ b/packages/kit/test/prerendering/basics/static/file with spaces.json
@@ -0,0 +1,1 @@
+{ "answer": 42 }
diff --git a/packages/kit/test/prerendering/basics/test/test.js b/packages/kit/test/prerendering/basics/test/test.js
index 16972c334..2cef10ee3 100644
--- a/packages/kit/test/prerendering/basics/test/test.js
+++ b/packages/kit/test/prerendering/basics/test/test.js
@@ -58,4 +58,9 @@ test('renders page with unbuffered data from endpoint', () => {
 	assert.equal(json, JSON.stringify({ answer: 42 }));
 });
 
+test('loads a file with spaces in the filename', () => {
+	const content = read('load-file-with-spaces/index.html');
+	assert.ok(content.includes('<h1>answer: 42</h1>'), content);
+});
+
 test.run();