@sveltejs/kit 1.0.0-next.479 → 1.0.0-next.481

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.479",
3
+ "version": "1.0.0-next.481",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -1,4 +1,4 @@
1
- This module provides access to runtime environment variables, as defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/master/packages/adapter-node) (or running [`vite preview`](https://kit.svelte.dev/docs/cli)), this is equivalent to `process.env`. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#kit-env-publicprefix).
1
+ This module provides access to runtime environment variables, as defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/master/packages/adapter-node) (or running [`vite preview`](https://kit.svelte.dev/docs/cli)), this is equivalent to `process.env`. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env).
2
2
 
3
3
  This module cannot be imported into client-side code.
4
4
 
@@ -1,4 +1,4 @@
1
- Similar to [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), but only includes variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#kit-env-publicprefix) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
1
+ Similar to [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), but only includes variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
2
2
 
3
3
  Note that public dynamic environment variables must all be sent from the server to the client, causing larger network requests — when possible, use `$env/static/public` instead.
4
4
 
@@ -1,4 +1,4 @@
1
- Environment variables [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env`. Like [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), this module cannot be imported into client-side code. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#kit-env-publicprefix).
1
+ Environment variables [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env`. Like [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), this module cannot be imported into client-side code. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env).
2
2
 
3
3
  _Unlike_ [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), the values exported from this module are statically injected into your bundle at build time, enabling optimisations like dead code elimination.
4
4
 
@@ -1,4 +1,4 @@
1
- Similar to [`$env/static/private`](https://kit.svelte.dev/docs/modules#$env-static-private), except that it only includes environment variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#kit-env-publicprefix) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
1
+ Similar to [`$env/static/private`](https://kit.svelte.dev/docs/modules#$env-static-private), except that it only includes environment variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
2
2
 
3
3
  Values are replaced statically at build time.
4
4
 
@@ -19,7 +19,7 @@ export const applyAction = ssr ? guard('applyAction') : client.apply_action;
19
19
  export function enhance(form, submit = () => {}) {
20
20
  /**
21
21
  * @param {{
22
- * action: string;
22
+ * action: URL;
23
23
  * result: import('types').ActionResult;
24
24
  * }} opts
25
25
  */
@@ -28,7 +28,7 @@ export function enhance(form, submit = () => {}) {
28
28
  await invalidateAll();
29
29
  }
30
30
 
31
- if (location.origin + location.pathname === action.split('?')[0]) {
31
+ if (location.origin + location.pathname === action.origin + action.pathname) {
32
32
  applyAction(result);
33
33
  }
34
34
  };
@@ -37,10 +37,13 @@ export function enhance(form, submit = () => {}) {
37
37
  async function handle_submit(event) {
38
38
  event.preventDefault();
39
39
 
40
- // We can't do submitter.formAction directly because that property is always set
41
- const action = event.submitter?.hasAttribute('formaction')
42
- ? /** @type {HTMLButtonElement | HTMLInputElement} */ (event.submitter).formAction
43
- : form.action;
40
+ const action = new URL(
41
+ // We can't do submitter.formAction directly because that property is always set
42
+ event.submitter?.hasAttribute('formaction')
43
+ ? /** @type {HTMLButtonElement | HTMLInputElement} */ (event.submitter).formAction
44
+ : form.action
45
+ );
46
+
44
47
  const data = new FormData(form);
45
48
  const controller = new AbortController();
46
49
 
@@ -99,7 +99,7 @@ declare module '$app/forms' {
99
99
  Success extends Record<string, unknown> | undefined = Record<string, any>,
100
100
  Invalid extends Record<string, unknown> | undefined = Record<string, any>
101
101
  > = (input: {
102
- action: string;
102
+ action: URL;
103
103
  data: FormData;
104
104
  form: HTMLFormElement;
105
105
  controller: AbortController;
@@ -108,7 +108,7 @@ declare module '$app/forms' {
108
108
  | void
109
109
  | ((opts: {
110
110
  form: HTMLFormElement;
111
- action: string;
111
+ action: URL;
112
112
  result: ActionResult<Success, Invalid>;
113
113
  }) => void);
114
114
 
package/types/index.d.ts CHANGED
@@ -292,7 +292,7 @@ export interface RequestEvent<
292
292
  /**
293
293
  * A `(event: RequestEvent) => Response` function exported from a `+server.js` file that corresponds to an HTTP verb (`GET`, `PUT`, `PATCH`, etc) and handles requests with that method.
294
294
  *
295
- * It receives `Params` as the first generic argument, which you can skip by using [generated types](/docs/types#generated-types) instead.
295
+ * It receives `Params` as the first generic argument, which you can skip by using [generated types](https://kit.svelte.dev/docs/types#generated-types) instead.
296
296
  */
297
297
  export interface RequestHandler<
298
298
  Params extends Partial<Record<string, string>> = Partial<Record<string, string>>