@sveltejs/kit 2.62.0 → 3.0.0-next.0

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.
Files changed (104) hide show
  1. package/package.json +28 -22
  2. package/src/cli.js +49 -20
  3. package/src/core/adapt/builder.js +38 -69
  4. package/src/core/adapt/index.js +11 -6
  5. package/src/core/config/index.js +12 -82
  6. package/src/core/config/options.js +36 -45
  7. package/src/core/env.js +240 -60
  8. package/src/core/generate_manifest/find_server_assets.js +3 -2
  9. package/src/core/generate_manifest/index.js +11 -3
  10. package/src/core/postbuild/analyse.js +20 -16
  11. package/src/core/postbuild/fallback.js +0 -3
  12. package/src/core/postbuild/prerender.js +19 -17
  13. package/src/core/postbuild/queue.js +3 -4
  14. package/src/core/sync/create_manifest_data/index.js +16 -18
  15. package/src/core/sync/sync.js +44 -23
  16. package/src/core/sync/utils.js +0 -15
  17. package/src/core/sync/write_ambient.js +5 -50
  18. package/src/core/sync/write_client_manifest.js +8 -9
  19. package/src/core/sync/write_env.js +36 -0
  20. package/src/core/sync/write_non_ambient.js +7 -7
  21. package/src/core/sync/write_root.js +41 -89
  22. package/src/core/sync/write_server.js +18 -24
  23. package/src/core/sync/write_tsconfig.js +29 -24
  24. package/src/core/sync/write_types/index.js +31 -25
  25. package/src/core/utils.js +14 -11
  26. package/src/exports/hooks/index.js +13 -0
  27. package/src/exports/index.js +8 -21
  28. package/src/exports/internal/env.js +71 -0
  29. package/src/exports/internal/types.d.ts +3 -0
  30. package/src/exports/node/index.js +8 -13
  31. package/src/exports/public.d.ts +68 -69
  32. package/src/exports/vite/build/build_server.js +14 -11
  33. package/src/exports/vite/build/remote.js +6 -7
  34. package/src/exports/vite/build/utils.js +7 -5
  35. package/src/exports/vite/dev/index.js +32 -33
  36. package/src/exports/vite/index.js +1015 -711
  37. package/src/exports/vite/module_ids.js +10 -6
  38. package/src/exports/vite/options.js +17 -0
  39. package/src/exports/vite/preview/index.js +3 -5
  40. package/src/exports/vite/static_analysis/index.js +11 -5
  41. package/src/exports/vite/utils.js +11 -41
  42. package/src/runtime/app/env/index.js +2 -0
  43. package/src/runtime/app/env/internal.js +14 -0
  44. package/src/runtime/app/env/private.js +1 -0
  45. package/src/runtime/app/env/public/client.js +1 -0
  46. package/src/runtime/app/env/public/index.js +1 -0
  47. package/src/runtime/app/env/public/server.js +1 -0
  48. package/src/runtime/app/env/standard-schema.d.ts +0 -0
  49. package/src/runtime/app/server/index.js +4 -2
  50. package/src/runtime/app/server/remote/form.js +0 -51
  51. package/src/runtime/app/server/remote/query.js +1 -8
  52. package/src/runtime/app/server/remote/shared.js +4 -3
  53. package/src/runtime/app/state/client.js +1 -12
  54. package/src/runtime/client/client.js +1 -1
  55. package/src/runtime/client/constants.js +0 -1
  56. package/src/runtime/client/remote-functions/form.svelte.js +0 -31
  57. package/src/runtime/client/remote-functions/prerender.svelte.js +1 -1
  58. package/src/runtime/client/remote-functions/query/index.js +2 -2
  59. package/src/runtime/client/remote-functions/query/instance.svelte.js +1 -2
  60. package/src/runtime/client/remote-functions/query-batch.svelte.js +2 -2
  61. package/src/runtime/client/remote-functions/query-live/instance.svelte.js +5 -8
  62. package/src/runtime/client/utils.js +9 -11
  63. package/src/runtime/components/{svelte-5/layout.svelte → layout.svelte} +1 -1
  64. package/src/runtime/form-utils.js +4 -41
  65. package/src/runtime/server/cookie.js +21 -37
  66. package/src/runtime/server/env_module.js +12 -4
  67. package/src/runtime/server/fetch.js +6 -10
  68. package/src/runtime/server/index.js +5 -9
  69. package/src/runtime/server/page/render.js +33 -37
  70. package/src/runtime/server/page/types.d.ts +4 -2
  71. package/src/runtime/server/respond.js +3 -3
  72. package/src/runtime/server/utils.js +2 -4
  73. package/src/runtime/shared-server.js +0 -22
  74. package/src/runtime/shared.js +0 -15
  75. package/src/types/ambient-private.d.ts +25 -9
  76. package/src/types/global-private.d.ts +6 -0
  77. package/src/types/internal.d.ts +4 -8
  78. package/src/utils/css.js +3 -19
  79. package/src/utils/filesystem.js +1 -30
  80. package/src/utils/http.js +0 -21
  81. package/src/utils/import.js +8 -7
  82. package/src/utils/os.js +7 -0
  83. package/src/utils/path.js +23 -0
  84. package/src/utils/shared-iterator.js +3 -0
  85. package/src/utils/streaming.js +2 -4
  86. package/src/utils/url.js +1 -1
  87. package/src/utils/vite.js +28 -0
  88. package/src/version.js +1 -1
  89. package/types/index.d.ts +85 -109
  90. package/types/index.d.ts.map +5 -6
  91. package/src/exports/vite/build/build_service_worker.js +0 -149
  92. package/src/runtime/app/environment/index.js +0 -2
  93. package/src/runtime/components/svelte-4/error.svelte +0 -6
  94. package/src/runtime/components/svelte-4/layout.svelte +0 -1
  95. package/src/runtime/env/dynamic/private.js +0 -1
  96. package/src/runtime/env/dynamic/public.js +0 -1
  97. package/src/types/synthetic/$env+dynamic+private.md +0 -43
  98. package/src/types/synthetic/$env+dynamic+public.md +0 -46
  99. package/src/types/synthetic/$env+static+private.md +0 -31
  100. package/src/types/synthetic/$env+static+public.md +0 -31
  101. package/src/utils/env.js +0 -13
  102. package/src/utils/promise.js +0 -29
  103. /package/src/runtime/app/{environment → env}/types.d.ts +0 -0
  104. /package/src/runtime/components/{svelte-5/error.svelte → error.svelte} +0 -0
@@ -1,16 +1,20 @@
1
1
  import { fileURLToPath } from 'node:url';
2
- import { posixify } from '../../utils/filesystem.js';
2
+ import { posixify } from '../../utils/os.js';
3
3
 
4
- export const env_static_private = '\0virtual:env/static/private';
5
- export const env_static_public = '\0virtual:env/static/public';
6
- export const env_dynamic_private = '\0virtual:env/dynamic/private';
7
- export const env_dynamic_public = '\0virtual:env/dynamic/public';
4
+ export const sveltekit_env = '\0virtual:__sveltekit/env';
5
+ export const sveltekit_env_public_client = '\0virtual:__sveltekit/env/public/client';
6
+ export const sveltekit_env_public_server = '\0virtual:__sveltekit/env/public/server';
7
+ export const sveltekit_env_private = '\0virtual:__sveltekit/env/private';
8
+ export const sveltekit_env_service_worker = '\0virtual:__sveltekit/env/service-worker';
8
9
 
9
10
  export const service_worker = '\0virtual:service-worker';
10
11
 
11
- export const sveltekit_environment = '\0virtual:__sveltekit/environment';
12
12
  export const sveltekit_server = '\0virtual:__sveltekit/server';
13
13
 
14
14
  export const app_server = posixify(
15
15
  fileURLToPath(new URL('../../runtime/app/server/index.js', import.meta.url))
16
16
  );
17
+
18
+ export const app_env_private = posixify(
19
+ fileURLToPath(new URL('../../runtime/app/env/private.js', import.meta.url))
20
+ );
@@ -0,0 +1,17 @@
1
+ /** @import { Validator } from '../../core/config/types.js' */
2
+
3
+ import { object, validate } from '../../core/config/options.js';
4
+
5
+ /** @type {Validator} */
6
+ const options = object({
7
+ adapter: validate(undefined, (input, keypath) => {
8
+ if (typeof input !== 'object' || !input.adapt) {
9
+ const message = `The SvelteKit Vite plugin ${keypath} should be an object with an \`adapt\` method`;
10
+ throw new Error(`${message}. See https://svelte.dev/docs/kit/adapters`);
11
+ }
12
+
13
+ return input;
14
+ })
15
+ });
16
+
17
+ export default options;
@@ -5,7 +5,6 @@ import { lookup } from 'mrmime';
5
5
  import sirv from 'sirv';
6
6
  import { loadEnv, normalizePath } from 'vite';
7
7
  import { createReadableStream, getRequest, setResponse } from '../../../exports/node/index.js';
8
- import { installPolyfills } from '../../../exports/node/polyfills.js';
9
8
  import { SVELTE_KIT_ASSETS } from '../../../constants.js';
10
9
  import { is_chrome_devtools_request, not_found } from '../utils.js';
11
10
 
@@ -17,10 +16,9 @@ import { is_chrome_devtools_request, not_found } from '../utils.js';
17
16
  * @param {import('vite').PreviewServer} vite
18
17
  * @param {import('vite').ResolvedConfig} vite_config
19
18
  * @param {import('types').ValidatedConfig} svelte_config
19
+ * @param {import('@sveltejs/kit').Adapter | undefined} adapter
20
20
  */
21
- export async function preview(vite, vite_config, svelte_config) {
22
- installPolyfills();
23
-
21
+ export async function preview(vite, vite_config, svelte_config, adapter) {
24
22
  const { paths } = svelte_config.kit;
25
23
  const base = paths.base;
26
24
  const assets = paths.assets ? SVELTE_KIT_ASSETS : paths.base;
@@ -56,7 +54,7 @@ export async function preview(vite, vite_config, svelte_config) {
56
54
  read: (file) => createReadableStream(`${dir}/${file}`)
57
55
  });
58
56
 
59
- const emulator = await svelte_config.kit.adapter?.emulate?.();
57
+ const emulator = await adapter?.emulate?.();
60
58
 
61
59
  return () => {
62
60
  // Remove the base middleware. It screws with the URL.
@@ -1,3 +1,4 @@
1
+ import path from 'node:path';
1
2
  import { tsPlugin } from '@sveltejs/acorn-typescript';
2
3
  import { Parser } from 'acorn';
3
4
  import { read } from '../../../utils/filesystem.js';
@@ -213,11 +214,13 @@ function get_name(node) {
213
214
  /**
214
215
  * Reads and statically analyses a file for page options
215
216
  * @param {string} filepath
217
+ * @param {string} root The project root directory
216
218
  * @returns {PageOptions | null} Returns the page options for the file or `null` if unanalysable
217
219
  */
218
- export function get_page_options(filepath) {
220
+ export function get_page_options(filepath, root) {
221
+ const input = read(path.resolve(root, filepath));
222
+
219
223
  try {
220
- const input = read(filepath);
221
224
  const page_options = statically_analyse_page_options(filepath, input);
222
225
  if (page_options === null) {
223
226
  return null;
@@ -229,7 +232,10 @@ export function get_page_options(filepath) {
229
232
  }
230
233
  }
231
234
 
232
- export function create_node_analyser() {
235
+ /**
236
+ * @param {string} root
237
+ */
238
+ export function create_node_analyser(root) {
233
239
  const static_exports = new Map();
234
240
 
235
241
  /**
@@ -273,7 +279,7 @@ export function create_node_analyser() {
273
279
  }
274
280
 
275
281
  if (node.server) {
276
- const server_page_options = get_page_options(node.server);
282
+ const server_page_options = get_page_options(node.server, root);
277
283
  if (server_page_options === null) {
278
284
  cache(key, null);
279
285
  return null;
@@ -282,7 +288,7 @@ export function create_node_analyser() {
282
288
  }
283
289
 
284
290
  if (node.universal) {
285
- const universal_page_options = get_page_options(node.universal);
291
+ const universal_page_options = get_page_options(node.universal, root);
286
292
  if (universal_page_options === null) {
287
293
  cache(key, null);
288
294
  return null;
@@ -1,17 +1,13 @@
1
1
  import path from 'node:path';
2
- import { loadEnv } from 'vite';
3
- import { posixify } from '../../utils/filesystem.js';
2
+ import { posixify } from '../../utils/os.js';
4
3
  import { negotiate } from '../../utils/http.js';
5
- import { filter_env } from '../../utils/env.js';
6
4
  import { escape_html } from '../../utils/escape.js';
7
5
  import { dedent } from '../../core/sync/utils.js';
8
6
  import {
9
7
  app_server,
10
- env_dynamic_private,
11
- env_dynamic_public,
12
- env_static_private,
13
- env_static_public,
14
- service_worker
8
+ app_env_private,
9
+ service_worker,
10
+ sveltekit_env_private
15
11
  } from './module_ids.js';
16
12
 
17
13
  /**
@@ -20,8 +16,9 @@ import {
20
16
  * Related to tsconfig path alias creation.
21
17
  *
22
18
  * @param {import('types').ValidatedKitConfig} config
19
+ * @param {string} root
23
20
  * */
24
- export function get_config_aliases(config) {
21
+ export function get_config_aliases(config, root) {
25
22
  /** @type {import('vite').Alias[]} */
26
23
  const alias = [
27
24
  // For now, we handle `$lib` specially here rather than make it a default value for
@@ -38,16 +35,16 @@ export function get_config_aliases(config) {
38
35
  // Doing just `{ find: key.slice(0, -2) ,..}` would mean `import .. from "key"` would also be matched, which we don't want
39
36
  alias.push({
40
37
  find: new RegExp(`^${escape_for_regexp(key.slice(0, -2))}\\/(.+)$`),
41
- replacement: `${path.resolve(value)}/$1`
38
+ replacement: `${path.resolve(root, value)}/$1`
42
39
  });
43
40
  } else if (key + '/*' in config.alias) {
44
41
  // key and key/* both exist -> the replacement for key needs to happen _only_ on import .. from "key"
45
42
  alias.push({
46
43
  find: new RegExp(`^${escape_for_regexp(key)}$`),
47
- replacement: path.resolve(value)
44
+ replacement: path.resolve(root, value)
48
45
  });
49
46
  } else {
50
- alias.push({ find: key, replacement: path.resolve(value) });
47
+ alias.push({ find: key, replacement: path.resolve(root, value) });
51
48
  }
52
49
  }
53
50
 
@@ -61,21 +58,6 @@ function escape_for_regexp(str) {
61
58
  return str.replace(/[.*+?^${}()|[\]\\]/g, (match) => '\\' + match);
62
59
  }
63
60
 
64
- /**
65
- * Load environment variables from process.env and .env files
66
- * @param {import('types').ValidatedKitConfig['env']} env_config
67
- * @param {string} mode
68
- */
69
- export function get_env(env_config, mode) {
70
- const { publicPrefix: public_prefix, privatePrefix: private_prefix } = env_config;
71
- const env = loadEnv(mode, env_config.dir, '');
72
-
73
- return {
74
- public: filter_env(env, public_prefix, private_prefix),
75
- private: filter_env(env, private_prefix, public_prefix)
76
- };
77
- }
78
-
79
61
  /**
80
62
  * Silently respond with 404 for Chrome DevTools workspaces request.
81
63
  * Chrome always requests this at the root, regardless of base path.
@@ -155,20 +137,8 @@ export function normalize_id(id, lib, cwd) {
155
137
  return '$app/server';
156
138
  }
157
139
 
158
- if (id === env_static_private) {
159
- return '$env/static/private';
160
- }
161
-
162
- if (id === env_static_public) {
163
- return '$env/static/public';
164
- }
165
-
166
- if (id === env_dynamic_private) {
167
- return '$env/dynamic/private';
168
- }
169
-
170
- if (id === env_dynamic_public) {
171
- return '$env/dynamic/public';
140
+ if (id === app_env_private || id === sveltekit_env_private) {
141
+ return '$app/env/private';
172
142
  }
173
143
 
174
144
  if (id === service_worker) {
@@ -0,0 +1,2 @@
1
+ export { BROWSER as browser, DEV as dev } from 'esm-env';
2
+ export { building, version } from './internal.js';
@@ -0,0 +1,14 @@
1
+ export const version = __SVELTEKIT_APP_VERSION__;
2
+ export let building = false;
3
+ export let prerendering = false;
4
+
5
+ export function set_building() {
6
+ building = true;
7
+ }
8
+
9
+ export function set_prerendering() {
10
+ prerendering = true;
11
+ }
12
+
13
+ // force /@vite/client to be injected
14
+ import.meta.hot;
@@ -0,0 +1 @@
1
+ export * from '__sveltekit/env/private';
@@ -0,0 +1 @@
1
+ export * from '__sveltekit/env/public/client';
@@ -0,0 +1 @@
1
+ export * from '#app/env/public';
@@ -0,0 +1 @@
1
+ export * from '__sveltekit/env/public/server';
File without changes
@@ -1,5 +1,5 @@
1
1
  import { read_implementation, manifest } from '__sveltekit/server';
2
- import { base } from '$app/paths';
2
+ import { assets } from '$app/paths/internal/server';
3
3
  import { base64_decode } from '../../utils.js';
4
4
 
5
5
  /**
@@ -54,7 +54,9 @@ export function read(asset) {
54
54
  }
55
55
 
56
56
  const file = decodeURIComponent(
57
- __SVELTEKIT_DEV__ && asset.startsWith('/@fs') ? asset : asset.slice(base.length + 1)
57
+ __SVELTEKIT_DEV__ && asset.startsWith(assets + '/@fs')
58
+ ? asset.slice(assets.length)
59
+ : asset.slice(assets.length + 1)
58
60
  );
59
61
 
60
62
  if (file in manifest._.server_assets) {
@@ -2,11 +2,9 @@
2
2
  /** @import { InternalRemoteFormIssue, MaybePromise, RemoteFormInternals } from 'types' */
3
3
  /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
4
4
  import { get_request_store } from '@sveltejs/kit/internal/server';
5
- import { DEV } from 'esm-env';
6
5
  import {
7
6
  create_field_proxy,
8
7
  set_nested_value,
9
- throw_on_old_property_access,
10
8
  deep_set,
11
9
  normalize_issue,
12
10
  flatten_issues
@@ -90,32 +88,6 @@ export function form(validate_or_fn, maybe_fn) {
90
88
  name: '',
91
89
  id: '',
92
90
  fn: async (data, meta, form_data) => {
93
- // TODO 3.0 remove this warning
94
- if (DEV && !data) {
95
- const error = () => {
96
- throw new Error(
97
- 'Remote form functions no longer get passed a FormData object. ' +
98
- "`form` now has the same signature as `query` or `command`, i.e. it expects to be invoked like `form(schema, callback)` or `form('unchecked', callback)`. " +
99
- 'The payload of the callback function is now a POJO instead of a FormData object. See https://kit.svelte.dev/docs/remote-functions#form for details.'
100
- );
101
- };
102
- data = {};
103
- for (const key of [
104
- 'append',
105
- 'delete',
106
- 'entries',
107
- 'forEach',
108
- 'get',
109
- 'getAll',
110
- 'has',
111
- 'keys',
112
- 'set',
113
- 'values'
114
- ]) {
115
- Object.defineProperty(data, key, { get: error });
116
- }
117
- }
118
-
119
91
  /** @type {{ submission: true, input?: Record<string, any>, issues?: InternalRemoteFormIssue[], result: Output }} */
120
92
  const output = {};
121
93
 
@@ -203,20 +175,6 @@ export function form(validate_or_fn, maybe_fn) {
203
175
  }
204
176
  });
205
177
 
206
- // TODO 3.0 remove
207
- if (DEV) {
208
- throw_on_old_property_access(instance);
209
-
210
- Object.defineProperty(instance, 'buttonProps', {
211
- get() {
212
- throw new Error(
213
- '`form.buttonProps` has been removed: Instead of `<button {...form.buttonProps}>, use `<button {...form.fields.action.as("submit", "value")}>`.' +
214
- ' See the PR for more info: https://github.com/sveltejs/kit/pull/14622'
215
- );
216
- }
217
- });
218
- }
219
-
220
178
  Object.defineProperty(instance, 'result', {
221
179
  get() {
222
180
  try {
@@ -320,15 +278,6 @@ function create_issues() {
320
278
  new Proxy(
321
279
  /** @param {string} message */
322
280
  (message) => {
323
- // TODO 3.0 remove
324
- if (typeof message !== 'string') {
325
- throw new Error(
326
- '`invalid` should now be imported from `@sveltejs/kit` to throw validation issues. ' +
327
- "The second parameter provided to the form function (renamed to `issue`) is still used to construct issues, e.g. `invalid(issue.field('message'))`. " +
328
- 'For more info see https://github.com/sveltejs/kit/pulls/14768'
329
- );
330
- }
331
-
332
281
  return create_issue(message);
333
282
  },
334
283
  {
@@ -3,7 +3,7 @@
3
3
  /** @import { StandardSchemaV1 } from '@standard-schema/spec' */
4
4
  import { get_request_store } from '@sveltejs/kit/internal/server';
5
5
  import { create_remote_key, stringify, stringify_remote_arg } from '../../../shared.js';
6
- import { prerendering } from '__sveltekit/environment';
6
+ import { prerendering } from '$app/env/internal';
7
7
  import {
8
8
  create_validator,
9
9
  get_cache,
@@ -435,13 +435,6 @@ function create_query_resource(__, payload, state, fn) {
435
435
  set(value) {
436
436
  return update_refresh_value(get_refresh_context(__, 'set', payload), value);
437
437
  },
438
- // TODO 3.0 remove this
439
- // @ts-expect-error This method no longer exists
440
- run() {
441
- throw new Error(
442
- `\`myQuery().run()\` has been removed — please replace it with \`myQuery()\`. See https://github.com/sveltejs/kit/pull/15779 for more details`
443
- );
444
- },
445
438
  /** @type {Promise<any>['then']} */
446
439
  then(onfulfilled, onrejected) {
447
440
  return get_promise().then(onfulfilled, onrejected);
@@ -2,9 +2,10 @@
2
2
  /** @import { ServerHooks, MaybePromise, RequestState, RemoteInternals, RequestStore, RemoteLiveQueryUserFunctionReturnType } from 'types' */
3
3
  import { parse } from 'devalue';
4
4
  import { error } from '@sveltejs/kit';
5
+ import { hydratable } from 'svelte';
5
6
  import { with_request_store, get_request_store } from '@sveltejs/kit/internal/server';
7
+ import { create_remote_key, stringify } from '../../../shared.js';
6
8
  import { noop } from '../../../../utils/functions.js';
7
- import { create_remote_key, stringify, unfriendly_hydratable } from '../../../shared.js';
8
9
 
9
10
  /**
10
11
  * @param {any} validate_or_fn
@@ -85,9 +86,9 @@ export async function get_response(internals, payload, state, get_result) {
85
86
  if (state.is_in_render && internals.id) {
86
87
  const remote_key = create_remote_key(internals.id, payload);
87
88
 
88
- Promise.resolve(entry.data)
89
+ void Promise.resolve(entry.data)
89
90
  .then((value) => {
90
- void unfriendly_hydratable(remote_key, () => stringify(value, state.transport));
91
+ void hydratable(remote_key, () => stringify(value, state.transport));
91
92
  })
92
93
  .catch(noop);
93
94
  }
@@ -1,4 +1,3 @@
1
- import { DEV } from 'esm-env';
2
1
  import {
3
2
  page as _page,
4
3
  navigating as _navigating,
@@ -47,23 +46,13 @@ export const navigating = {
47
46
  return _navigating.current ? _navigating.current.willUnload : null;
48
47
  },
49
48
  get delta() {
50
- return _navigating.current ? _navigating.current.delta : null;
49
+ return _navigating.current?.type === 'popstate' ? _navigating.current.delta : null;
51
50
  },
52
51
  get complete() {
53
52
  return _navigating.current ? _navigating.current.complete : null;
54
53
  }
55
54
  };
56
55
 
57
- // TODO: remove in 3.0
58
- if (DEV) {
59
- Object.defineProperty(navigating, 'current', {
60
- get() {
61
- // between 2.12.0 and 2.12.1 `navigating.current` existed
62
- throw new Error('Replace navigating.current.<prop> with navigating.<prop>');
63
- }
64
- });
65
- }
66
-
67
56
  export const updated = {
68
57
  get current() {
69
58
  return _updated.current;
@@ -1619,7 +1619,7 @@ function _before_navigate({ url, type, intent, delta, event, scroll }) {
1619
1619
 
1620
1620
  const nav = create_navigation(current, intent, url, type, scroll ?? null);
1621
1621
 
1622
- if (delta !== undefined) {
1622
+ if (nav.navigation.type === 'popstate' && delta !== undefined) {
1623
1623
  nav.navigation.delta = delta;
1624
1624
  }
1625
1625
 
@@ -11,6 +11,5 @@ export const PRELOAD_PRIORITIES = /** @type {const} */ ({
11
11
  hover: 2,
12
12
  viewport: 3,
13
13
  eager: 4,
14
- off: -1,
15
14
  false: -1
16
15
  });
@@ -15,7 +15,6 @@ import {
15
15
  create_field_proxy,
16
16
  deep_set,
17
17
  set_nested_value,
18
- throw_on_old_property_access,
19
18
  build_path_string,
20
19
  normalize_issue,
21
20
  serialize_binary_form,
@@ -304,22 +303,6 @@ export function form(id) {
304
303
  {},
305
304
  {
306
305
  ...descriptors,
307
- data: {
308
- get() {
309
- // TODO 3.0 remove
310
- throw new Error(
311
- `The \`data\` property has been removed from the \`enhance\` callback argument. Use \`instance.fields.value()\` instead.`
312
- );
313
- }
314
- },
315
- form: {
316
- get() {
317
- // TODO 3.0 remove
318
- throw new Error(
319
- `The \`form\` property has been removed from the \`enhance\` callback argument. To get the current \`<form>\` element, use \`instance.element\` instead.`
320
- );
321
- }
322
- },
323
306
  element: {
324
307
  value: form
325
308
  },
@@ -543,20 +526,6 @@ export function form(id) {
543
526
 
544
527
  let validate_id = 0;
545
528
 
546
- // TODO 3.0 remove
547
- if (DEV) {
548
- throw_on_old_property_access(instance);
549
-
550
- Object.defineProperty(instance, 'buttonProps', {
551
- get() {
552
- throw new Error(
553
- '`form.buttonProps` has been removed: Instead of `<button {...form.buttonProps}>, use `<button {...form.fields.action.as("submit", "value")}>`.' +
554
- ' See the PR for more info: https://github.com/sveltejs/kit/pull/14622'
555
- );
556
- }
557
- });
558
- }
559
-
560
529
  Object.defineProperties(instance, {
561
530
  element: {
562
531
  get: () => element
@@ -1,6 +1,6 @@
1
1
  /** @import { RemotePrerenderFunction } from '@sveltejs/kit' */
2
2
  import { app_dir, base } from '$app/paths/internal/client';
3
- import { version } from '__sveltekit/environment';
3
+ import { version } from '$app/env';
4
4
  import * as devalue from 'devalue';
5
5
  import { app, prerender_responses } from '../client.js';
6
6
  import { get_remote_request_headers, remote_request } from './shared.svelte.js';
@@ -4,7 +4,7 @@ import { app, query_map, query_responses } from '../../client.js';
4
4
  import { get_remote_request_headers, QUERY_FUNCTION_ID, remote_request } from '../shared.svelte.js';
5
5
  import * as devalue from 'devalue';
6
6
  import { DEV } from 'esm-env';
7
- import { unfriendly_hydratable } from '../../../shared.js';
7
+ import { hydratable } from 'svelte';
8
8
  import { QueryProxy } from './proxy.js';
9
9
 
10
10
  /**
@@ -34,7 +34,7 @@ export function query(id) {
34
34
 
35
35
  const url = `${base}/${app_dir}/remote/${id}${payload ? `?payload=${payload}` : ''}`;
36
36
 
37
- const serialized = await unfriendly_hydratable(key, () =>
37
+ const serialized = await hydratable(key, () =>
38
38
  remote_request(url, get_remote_request_headers())
39
39
  );
40
40
 
@@ -1,7 +1,6 @@
1
1
  import { query_responses } from '../../client.js';
2
2
  import { QUERY_OVERRIDE_KEY } from '../shared.svelte.js';
3
3
  import { noop } from '../../../../utils/functions.js';
4
- import { with_resolvers } from '../../../../utils/promise.js';
5
4
  import { tick, untrack } from 'svelte';
6
5
 
7
6
  /**
@@ -87,7 +86,7 @@ export class Query {
87
86
  #run() {
88
87
  this.#loading = true;
89
88
 
90
- const { promise, resolve, reject } = with_resolvers();
89
+ const { promise, resolve, reject } = Promise.withResolvers();
91
90
 
92
91
  this.#latest.push(resolve);
93
92
 
@@ -6,7 +6,7 @@ import { get_remote_request_headers, QUERY_FUNCTION_ID } from './shared.svelte.j
6
6
  import { QueryProxy } from './query/proxy.js';
7
7
  import * as devalue from 'devalue';
8
8
  import { HttpError, Redirect } from '@sveltejs/kit/internal';
9
- import { unfriendly_hydratable } from '../../shared.js';
9
+ import { hydratable } from 'svelte';
10
10
 
11
11
  /**
12
12
  * @param {string} id
@@ -19,7 +19,7 @@ export function query_batch(id) {
19
19
  /** @type {RemoteQueryFunction<any, any>} */
20
20
  const wrapper = (arg) => {
21
21
  return new QueryProxy(id, arg, async (key, payload) => {
22
- const serialized = await unfriendly_hydratable(key, () => {
22
+ const serialized = await hydratable(key, () => {
23
23
  return new Promise((resolve, reject) => {
24
24
  // create_remote_function caches identical calls, but in case a refresh to the same query is called multiple times this function
25
25
  // is invoked multiple times with the same payload, so we need to deduplicate here
@@ -1,12 +1,9 @@
1
- /** @import { PromiseWithResolvers } from '../../../../utils/promise.js' */
2
1
  import { app } from '../../client.js';
3
2
  import * as devalue from 'devalue';
4
3
  import { HttpError, Redirect } from '@sveltejs/kit/internal';
5
4
  import { noop, once } from '../../../../utils/functions.js';
6
- import { with_resolvers } from '../../../../utils/promise.js';
7
5
  import { SharedIterator } from '../../../../utils/shared-iterator.js';
8
- import { tick } from 'svelte';
9
- import { unfriendly_hydratable } from '../../../shared.js';
6
+ import { hydratable, tick } from 'svelte';
10
7
  import { create_live_iterator } from './iterator.js';
11
8
 
12
9
  /**
@@ -82,12 +79,12 @@ export class LiveQuery {
82
79
  // the semantics of awaiting a live query are a bit weird, but it's basically:
83
80
  // - It's a promise that resolves to the first value from the server
84
81
  // - Thereafter, it's a promise that immediately resolves to the current value
85
- const { promise, resolve, reject } = with_resolvers();
82
+ const { promise, resolve, reject } = Promise.withResolvers();
86
83
  this.#promise = $state.raw(promise);
87
84
  this.#resolve_first = resolve;
88
85
  this.#reject_first = reject;
89
86
 
90
- const serialized = unfriendly_hydratable(key, () => undefined);
87
+ const serialized = hydratable(key, () => undefined);
91
88
  if (serialized !== undefined) {
92
89
  this.set(devalue.parse(serialized, app.decoders));
93
90
  }
@@ -109,7 +106,7 @@ export class LiveQuery {
109
106
  if (this.#interrupt) return;
110
107
 
111
108
  /** @type {PromiseWithResolvers<void>} */
112
- const { promise: stopped, resolve: on_stop } = with_resolvers();
109
+ const { promise: stopped, resolve: on_stop } = Promise.withResolvers();
113
110
 
114
111
  while (!this.#done) {
115
112
  const controller = new AbortController();
@@ -327,7 +324,7 @@ export class LiveQuery {
327
324
  async reconnect() {
328
325
  await this.#interrupt?.();
329
326
  /** @type {PromiseWithResolvers<void>} */
330
- const { promise, resolve: on_connect, reject: on_connect_failed } = with_resolvers();
327
+ const { promise, resolve: on_connect, reject: on_connect_failed } = Promise.withResolvers();
331
328
  promise.catch(noop);
332
329
  this.#done = false;
333
330
  this.#attempt = 0;