Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion documentation/docs/20-core-concepts/60-remote-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ export const survey = form(
<form {...survey}>
<h2>Which operating system do you use?</h2>

+++ <script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Move the <script> block to the top level of the example. Imports inside markup will cause a Svelte compilation error.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At documentation/docs/20-core-concepts/60-remote-functions.md, line 412:

<comment>Move the `<script>` block to the top level of the example. Imports inside markup will cause a Svelte compilation error.</comment>

<file context>
@@ -409,6 +409,10 @@ export const survey = form(
 <form {...survey}>
 	<h2>Which operating system do you use?</h2>
 
++++	<script>
+		import { operatingSystems, languages, survey } from './data.remote';
+	</script>+++
</file context>

import { operatingSystems, languages, survey } from './data.remote';
</script>+++

Comment on lines 409 to +415

Copilot AI Jan 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script tag is incorrectly placed inside the form element. In Svelte components, the script tag must be at the top of the component file, before any markup. It should be placed before the opening form tag on line 409, not after the h2 element on line 410.

Suggested change
<form {...survey}>
<h2>Which operating system do you use?</h2>
+++ <script>
import { operatingSystems, languages, survey } from './data.remote';
</script>+++
+++ <script>
import { operatingSystems, languages, survey } from './data.remote';
</script>+++
<form {...survey}>
<h2>Which operating system do you use?</h2>

Copilot uses AI. Check for mistakes.
{#each operatingSystems as os}
<label>
<input {...survey.fields.operatingSystem.as('radio', os)}>
Expand Down Expand Up @@ -827,7 +831,7 @@ To accomplish this, add a field to your schema for the button value, and use `as
```svelte
<!--- file: src/routes/login/+page.svelte --->
<script>
import { loginOrRegister } from '$lib/auth';
import { loginOrRegister } from '$lib/auth.remote';
</script>

<form {...loginOrRegister}>
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/60-appendix/20-integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Use `vitePreprocess()` to enable CSS preprocessors in `<style>` tags: PostCSS, S
### `script`

Use `vitePreprocess({ script: true })` if:
- your project is before Svelte 5
- your project uses Svelte 4 or earlier
- you are using advanced TypeScript features that emit code _(check [`vitePreprocess`](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md) documentation)_

> [!NOTE]
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-netlify/test/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { NetlifyDev } from '@netlify/dev';
import http from 'node:http';
import process from 'node:process';
import { getRequest, setResponse } from '@sveltejs/kit/node';
import { getRequest, setResponse } from '@tg-svelte/kit/node';

const netlifyDev = new NetlifyDev({});

Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-node/src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ function get_origin(headers) {
// this helps us avoid host injections through the protocol header
if (protocol.includes(':')) {
throw new Error(
`The ${protocol_header} header specified ${protocol} which is an invalid because it includes \`:\`. It should only contain the protocol scheme (e.g. \`https\`)`
`The ${protocol_header} header specified ${protocol} which is invalid because it includes \`:\`. It should only contain the protocol scheme (e.g. \`https\`)`
);
}

const host =
normalise_header(host_header, headers[host_header]) ||
normalise_header('host', headers['host']);
if (!host) {
const header_names = host_header ? `${host_header} or host headers` : 'host header';
const header_names = host_header ? `${host_header} or host header` : 'host header';
throw new Error(
`Could not determine host. The request must have a value provided by the ${header_names}`
);
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tg-svelte/kit",
"version": "2.50.1",
"version": "2.50.1-tg.1",
"description": "SvelteKit fork with legacy browser support (IE11) and static builds",
"keywords": [
"framework",
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/app/server/remote/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function form(validate_or_fn, maybe_fn) {
Object.defineProperty(instance, 'buttonProps', {
get() {
throw new Error(
'`form.buttonProps` has been removed: Instead of `<button {...form.buttonProps}>, use `<button {...form.fields.action.as("submit", "value")}>`.' +
'`form.buttonProps` has been removed: Instead of `<button {...form.buttonProps}>`, use `<button {...form.fields.action.as("submit", "value")}>`.' +
' See the PR for more info: https://github.com/sveltejs/kit/pull/14622'
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export function form(id) {
Object.defineProperty(instance, 'buttonProps', {
get() {
throw new Error(
'`form.buttonProps` has been removed: Instead of `<button {...form.buttonProps}>, use `<button {...form.fields.action.as("submit", "value")}>`.' +
'`form.buttonProps` has been removed: Instead of `<button {...form.buttonProps}>`, use `<button {...form.fields.action.as("submit", "value")}>`.' +
' See the PR for more info: https://github.com/sveltejs/kit/pull/14622'
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/form-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { DEV } from 'esm-env';
import * as devalue from 'devalue';
import { text_decoder, text_encoder } from './utils.js';
import { SvelteKitError } from '@sveltejs/kit/internal';
import { SvelteKitError } from '@tg-svelte/kit/internal';

/**
* Sets a value in a nested object using a path string, mutating the original object
Expand Down
9 changes: 8 additions & 1 deletion packages/kit/src/runtime/server/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,17 @@ export async function internal_respond(request, options, manifest, state) {
return text('Malformed URI', { status: 400 });
}

let decoded_original_path;
try {
decoded_original_path = decode_pathname(url.pathname);
} catch {
return text('Malformed URI', { status: 400 });
}

// try to serve the rerouted prerendered resource if it exists
if (
// the resolved path has been decoded so it should be compared to the decoded url pathname
resolved_path !== decode_pathname(url.pathname) &&
resolved_path !== decoded_original_path &&
!state.prerendering?.fallback &&
has_prerendered_path(manifest, resolved_path)
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// generated during release, do not modify

/** @type {string} */
export const VERSION = '2.50.1';
export const VERSION = '2.50.1-tg.1';
Loading
Loading