@sveltejs/kit 2.15.3 → 2.16.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "2.15.3",
3
+ "version": "2.16.0",
4
4
  "description": "SvelteKit is the fastest way to build Svelte apps",
5
5
  "keywords": [
6
6
  "framework",
@@ -28,8 +28,7 @@
28
28
  "mrmime": "^2.0.0",
29
29
  "sade": "^1.8.1",
30
30
  "set-cookie-parser": "^2.6.0",
31
- "sirv": "^3.0.0",
32
- "tiny-glob": "^0.2.9"
31
+ "sirv": "^3.0.0"
33
32
  },
34
33
  "devDependencies": {
35
34
  "@playwright/test": "^1.44.1",
@@ -59,8 +58,7 @@
59
58
  "!src/core/**/fixtures",
60
59
  "!src/core/**/test",
61
60
  "types",
62
- "svelte-kit.js",
63
- "postinstall.js"
61
+ "svelte-kit.js"
64
62
  ],
65
63
  "exports": {
66
64
  "./package.json": "./package.json",
@@ -99,7 +97,6 @@
99
97
  "test:cross-platform:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:cross-platform:dev",
100
98
  "test:cross-platform:build": "pnpm test:unit && pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:cross-platform:build",
101
99
  "test:unit": "vitest --config kit.vitest.config.js run",
102
- "postinstall": "node postinstall.js",
103
100
  "generate:version": "node scripts/generate-version.js",
104
101
  "generate:types": "node scripts/generate-dts.js"
105
102
  }
@@ -3,15 +3,8 @@ import path from 'node:path';
3
3
  import { mkdirp } from '../../utils/filesystem.js';
4
4
  import { resolve_peer_dependency } from '../../utils/import.js';
5
5
 
6
- /** @type {string} */
7
- let VERSION;
8
-
9
- try {
10
- ({ VERSION } = await resolve_peer_dependency('svelte/compiler'));
11
- } catch {
12
- // we can end up here from e.g. unit tests. this is the simplest fix
13
- ({ VERSION } = await import('svelte/compiler'));
14
- }
6
+ /** @type {{ VERSION: string }} */
7
+ const { VERSION } = await resolve_peer_dependency('svelte/compiler');
15
8
 
16
9
  /** @type {Map<string, string>} */
17
10
  const previous_contents = new Map();
@@ -270,6 +270,12 @@ function update_types(config, routes, route, to_delete = new Set()) {
270
270
  'export type Actions<OutputData extends Record<string, any> | void = Record<string, any> | void> = Kit.Actions<RouteParams, OutputData, RouteId>'
271
271
  );
272
272
  }
273
+
274
+ if (route.leaf.server) {
275
+ exports.push('export type PageProps = { data: PageData; form: ActionData }');
276
+ } else {
277
+ exports.push('export type PageProps = { data: PageData }');
278
+ }
273
279
  }
274
280
 
275
281
  if (route.layout) {
@@ -333,6 +339,10 @@ function update_types(config, routes, route, to_delete = new Set()) {
333
339
 
334
340
  if (proxies.server?.modified) to_delete.delete(proxies.server.file_name);
335
341
  if (proxies.universal?.modified) to_delete.delete(proxies.universal.file_name);
342
+
343
+ exports.push(
344
+ 'export type LayoutProps = { data: LayoutData; children: import("svelte").Snippet }'
345
+ );
336
346
  }
337
347
 
338
348
  if (route.endpoint) {
@@ -84,6 +84,14 @@ export function isHttpError(e, status) {
84
84
  /**
85
85
  * Redirect a request. When called during request handling, SvelteKit will return a redirect response.
86
86
  * Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it.
87
+ *
88
+ * Most common status codes:
89
+ * * `303 See Other`: redirect as a GET request (often used after a form POST request)
90
+ * * `307 Temporary Redirect`: redirect will keep the request method
91
+ * * `308 Permanent Redirect`: redirect will keep the request method, SEO will be transferred to the new page
92
+ *
93
+ * [See all redirect status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages)
94
+ *
87
95
  * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number)} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
88
96
  * @param {string | URL} location The location to redirect to.
89
97
  * @throws {Redirect} This error instructs SvelteKit to redirect to the specified location.
@@ -34,7 +34,7 @@ export interface Adapter {
34
34
  * This function is called after SvelteKit has built your app.
35
35
  * @param builder An object provided by SvelteKit that contains methods for adapting the app
36
36
  */
37
- adapt(builder: Builder): MaybePromise<void>;
37
+ adapt: (builder: Builder) => MaybePromise<void>;
38
38
  /**
39
39
  * Checks called during dev and build to determine whether specific features will work in production with this adapter
40
40
  */
@@ -49,7 +49,7 @@ export interface Adapter {
49
49
  * Creates an `Emulator`, which allows the adapter to influence the environment
50
50
  * during dev, build and prerendering
51
51
  */
52
- emulate?(): MaybePromise<Emulator>;
52
+ emulate?: () => MaybePromise<Emulator>;
53
53
  }
54
54
 
55
55
  export type LoadProperties<input extends Record<string, any> | void> = input extends void
@@ -94,9 +94,9 @@ export interface Builder {
94
94
  /** Print messages to the console. `log.info` and `log.minor` are silent unless Vite's `logLevel` is `info`. */
95
95
  log: Logger;
96
96
  /** Remove `dir` and all its contents. */
97
- rimraf(dir: string): void;
97
+ rimraf: (dir: string) => void;
98
98
  /** Create `dir` and any required parent directories. */
99
- mkdirp(dir: string): void;
99
+ mkdirp: (dir: string) => void;
100
100
 
101
101
  /** The fully resolved `svelte.config.js`. */
102
102
  config: ValidatedConfig;
@@ -111,59 +111,59 @@ export interface Builder {
111
111
  * @param fn A function that groups a set of routes into an entry point
112
112
  * @deprecated Use `builder.routes` instead
113
113
  */
114
- createEntries(fn: (route: RouteDefinition) => AdapterEntry): Promise<void>;
114
+ createEntries: (fn: (route: RouteDefinition) => AdapterEntry) => Promise<void>;
115
115
 
116
116
  /**
117
117
  * Find all the assets imported by server files belonging to `routes`
118
118
  */
119
- findServerAssets(routes: RouteDefinition[]): string[];
119
+ findServerAssets: (routes: RouteDefinition[]) => string[];
120
120
 
121
121
  /**
122
122
  * Generate a fallback page for a static webserver to use when no route is matched. Useful for single-page apps.
123
123
  */
124
- generateFallback(dest: string): Promise<void>;
124
+ generateFallback: (dest: string) => Promise<void>;
125
125
 
126
126
  /**
127
127
  * Generate a module exposing build-time environment variables as `$env/dynamic/public`.
128
128
  */
129
- generateEnvModule(): void;
129
+ generateEnvModule: () => void;
130
130
 
131
131
  /**
132
132
  * Generate a server-side manifest to initialise the SvelteKit [server](https://svelte.dev/docs/kit/@sveltejs-kit#Server) with.
133
133
  * @param opts a relative path to the base directory of the app and optionally in which format (esm or cjs) the manifest should be generated
134
134
  */
135
- generateManifest(opts: { relativePath: string; routes?: RouteDefinition[] }): string;
135
+ generateManifest: (opts: { relativePath: string; routes?: RouteDefinition[] }) => string;
136
136
 
137
137
  /**
138
138
  * Resolve a path to the `name` directory inside `outDir`, e.g. `/path/to/.svelte-kit/my-adapter`.
139
139
  * @param name path to the file, relative to the build directory
140
140
  */
141
- getBuildDirectory(name: string): string;
141
+ getBuildDirectory: (name: string) => string;
142
142
  /** Get the fully resolved path to the directory containing client-side assets, including the contents of your `static` directory. */
143
- getClientDirectory(): string;
143
+ getClientDirectory: () => string;
144
144
  /** Get the fully resolved path to the directory containing server-side code. */
145
- getServerDirectory(): string;
145
+ getServerDirectory: () => string;
146
146
  /** Get the application path including any configured `base` path, e.g. `my-base-path/_app`. */
147
- getAppPath(): string;
147
+ getAppPath: () => string;
148
148
 
149
149
  /**
150
150
  * Write client assets to `dest`.
151
151
  * @param dest the destination folder
152
152
  * @returns an array of files written to `dest`
153
153
  */
154
- writeClient(dest: string): string[];
154
+ writeClient: (dest: string) => string[];
155
155
  /**
156
156
  * Write prerendered files to `dest`.
157
157
  * @param dest the destination folder
158
158
  * @returns an array of files written to `dest`
159
159
  */
160
- writePrerendered(dest: string): string[];
160
+ writePrerendered: (dest: string) => string[];
161
161
  /**
162
162
  * Write server-side code to `dest`.
163
163
  * @param dest the destination folder
164
164
  * @returns an array of files written to `dest`
165
165
  */
166
- writeServer(dest: string): string[];
166
+ writeServer: (dest: string) => string[];
167
167
  /**
168
168
  * Copy a file or directory.
169
169
  * @param from the source file or directory
@@ -172,20 +172,20 @@ export interface Builder {
172
172
  * @param opts.replace a map of strings to replace
173
173
  * @returns an array of files that were copied
174
174
  */
175
- copy(
175
+ copy: (
176
176
  from: string,
177
177
  to: string,
178
178
  opts?: {
179
179
  filter?(basename: string): boolean;
180
180
  replace?: Record<string, string>;
181
181
  }
182
- ): string[];
182
+ ) => string[];
183
183
 
184
184
  /**
185
185
  * Compress files in `directory` with gzip and brotli, where appropriate. Generates `.gz` and `.br` files alongside the originals.
186
186
  * @param {string} directory The directory containing the files to be compressed
187
187
  */
188
- compress(directory: string): Promise<void>;
188
+ compress: (directory: string) => Promise<void>;
189
189
  }
190
190
 
191
191
  export interface Config {
@@ -215,13 +215,13 @@ export interface Cookies {
215
215
  * @param name the name of the cookie
216
216
  * @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options)
217
217
  */
218
- get(name: string, opts?: import('cookie').CookieParseOptions): string | undefined;
218
+ get: (name: string, opts?: import('cookie').CookieParseOptions) => string | undefined;
219
219
 
220
220
  /**
221
221
  * Gets all cookies that were previously set with `cookies.set`, or from the request headers.
222
222
  * @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options)
223
223
  */
224
- getAll(opts?: import('cookie').CookieParseOptions): Array<{ name: string; value: string }>;
224
+ getAll: (opts?: import('cookie').CookieParseOptions) => Array<{ name: string; value: string }>;
225
225
 
226
226
  /**
227
227
  * Sets a cookie. This will add a `set-cookie` header to the response, but also make the cookie available via `cookies.get` or `cookies.getAll` during the current request.
@@ -233,11 +233,11 @@ export interface Cookies {
233
233
  * @param value the cookie value
234
234
  * @param opts the options, passed directly to `cookie.serialize`. See documentation [here](https://github.com/jshttp/cookie#cookieserializename-value-options)
235
235
  */
236
- set(
236
+ set: (
237
237
  name: string,
238
238
  value: string,
239
239
  opts: import('cookie').CookieSerializeOptions & { path: string }
240
- ): void;
240
+ ) => void;
241
241
 
242
242
  /**
243
243
  * Deletes a cookie by setting its value to an empty string and setting the expiry date in the past.
@@ -246,7 +246,7 @@ export interface Cookies {
246
246
  * @param name the name of the cookie
247
247
  * @param opts the options, passed directly to `cookie.serialize`. The `path` must match the path of the cookie you want to delete. See documentation [here](https://github.com/jshttp/cookie#cookieserializename-value-options)
248
248
  */
249
- delete(name: string, opts: import('cookie').CookieSerializeOptions & { path: string }): void;
249
+ delete: (name: string, opts: import('cookie').CookieSerializeOptions & { path: string }) => void;
250
250
 
251
251
  /**
252
252
  * Serialize a cookie name-value pair into a `Set-Cookie` header string, but don't apply it to the response.
@@ -259,11 +259,11 @@ export interface Cookies {
259
259
  * @param value the cookie value
260
260
  * @param opts the options, passed directly to `cookie.serialize`. See documentation [here](https://github.com/jshttp/cookie#cookieserializename-value-options)
261
261
  */
262
- serialize(
262
+ serialize: (
263
263
  name: string,
264
264
  value: string,
265
265
  opts: import('cookie').CookieSerializeOptions & { path: string }
266
- ): string;
266
+ ) => string;
267
267
  }
268
268
 
269
269
  /**
@@ -653,7 +653,7 @@ export interface KitConfig {
653
653
  * What type of client-side router to use.
654
654
  * - `'pathname'` is the default and means the current URL pathname determines the route
655
655
  * - `'hash'` means the route is determined by `location.hash`. In this case, SSR and prerendering are disabled. This is only recommended if `pathname` is not an option, for example because you don't control the webserver where your app is deployed.
656
- * It comes with some caveats: you can't use server-side rendering (or indeed any server logic), and you have to make sure that the links in your app all start with /#/, or they won't work. Beyond that, everything works exactly like a normal SvelteKit app.
656
+ * It comes with some caveats: you can't use server-side rendering (or indeed any server logic), and you have to make sure that the links in your app all start with #/, or they won't work. Beyond that, everything works exactly like a normal SvelteKit app.
657
657
  *
658
658
  * @default "pathname"
659
659
  * @since 2.14.0
@@ -738,7 +738,7 @@ export interface KitConfig {
738
738
  */
739
739
  export type Handle = (input: {
740
740
  event: RequestEvent;
741
- resolve(event: RequestEvent, opts?: ResolveOptions): MaybePromise<Response>;
741
+ resolve: (event: RequestEvent, opts?: ResolveOptions) => MaybePromise<Response>;
742
742
  }) => MaybePromise<Response>;
743
743
 
744
744
  /**
@@ -893,14 +893,14 @@ export interface LoadEvent<
893
893
  *
894
894
  * `setHeaders` has no effect when a `load` function runs in the browser.
895
895
  */
896
- setHeaders(headers: Record<string, string>): void;
896
+ setHeaders: (headers: Record<string, string>) => void;
897
897
  /**
898
898
  * `await parent()` returns data from parent `+layout.js` `load` functions.
899
899
  * Implicitly, a missing `+layout.js` is treated as a `({ data }) => data` function, meaning that it will return and forward data from parent `+layout.server.js` files.
900
900
  *
901
901
  * Be careful not to introduce accidental waterfalls when using `await parent()`. If for example you only want to merge parent data into the returned output, call it _after_ fetching your other data.
902
902
  */
903
- parent(): Promise<ParentData>;
903
+ parent: () => Promise<ParentData>;
904
904
  /**
905
905
  * This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://svelte.dev/docs/kit/$app-navigation#invalidate) to cause `load` to rerun.
906
906
  *
@@ -938,7 +938,7 @@ export interface LoadEvent<
938
938
  * <button on:click={increase}>Increase Count</button>
939
939
  * ```
940
940
  */
941
- depends(...deps: Array<`${string}:${string}`>): void;
941
+ depends: (...deps: Array<`${string}:${string}`>) => void;
942
942
  /**
943
943
  * Use this function to opt out of dependency tracking for everything that is synchronously called within the callback. Example:
944
944
  *
@@ -952,7 +952,7 @@ export interface LoadEvent<
952
952
  * }
953
953
  * ```
954
954
  */
955
- untrack<T>(fn: () => T): T;
955
+ untrack: <T>(fn: () => T) => T;
956
956
  }
957
957
 
958
958
  export interface NavigationEvent<
@@ -1047,7 +1047,7 @@ export interface BeforeNavigate extends Navigation {
1047
1047
  /**
1048
1048
  * Call this to prevent the navigation from starting.
1049
1049
  */
1050
- cancel(): void;
1050
+ cancel: () => void;
1051
1051
  }
1052
1052
 
1053
1053
  /**
@@ -1161,7 +1161,7 @@ export interface RequestEvent<
1161
1161
  /**
1162
1162
  * The client's IP address, set by the adapter.
1163
1163
  */
1164
- getClientAddress(): string;
1164
+ getClientAddress: () => string;
1165
1165
  /**
1166
1166
  * Contains custom data that was added to the request within the [`server handle hook`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle).
1167
1167
  */
@@ -1209,7 +1209,7 @@ export interface RequestEvent<
1209
1209
  *
1210
1210
  * You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://svelte.dev/docs/kit/@sveltejs-kit#Cookies) API instead.
1211
1211
  */
1212
- setHeaders(headers: Record<string, string>): void;
1212
+ setHeaders: (headers: Record<string, string>) => void;
1213
1213
  /**
1214
1214
  * The requested URL.
1215
1215
  */
@@ -1242,20 +1242,20 @@ export interface ResolveOptions {
1242
1242
  * but they will always be split at sensible boundaries such as `%sveltekit.head%` or layout/page components.
1243
1243
  * @param input the html chunk and the info if this is the last chunk
1244
1244
  */
1245
- transformPageChunk?(input: { html: string; done: boolean }): MaybePromise<string | undefined>;
1245
+ transformPageChunk?: (input: { html: string; done: boolean }) => MaybePromise<string | undefined>;
1246
1246
  /**
1247
1247
  * Determines which headers should be included in serialized responses when a `load` function loads a resource with `fetch`.
1248
1248
  * By default, none will be included.
1249
1249
  * @param name header name
1250
1250
  * @param value header value
1251
1251
  */
1252
- filterSerializedResponseHeaders?(name: string, value: string): boolean;
1252
+ filterSerializedResponseHeaders?: (name: string, value: string) => boolean;
1253
1253
  /**
1254
1254
  * Determines what should be added to the `<head>` tag to preload it.
1255
1255
  * By default, `js` and `css` files will be preloaded.
1256
1256
  * @param input the type of the file and its path
1257
1257
  */
1258
- preload?(input: { type: 'font' | 'css' | 'js' | 'asset'; path: string }): boolean;
1258
+ preload?: (input: { type: 'font' | 'css' | 'js' | 'asset'; path: string }) => boolean;
1259
1259
  }
1260
1260
 
1261
1261
  export interface RouteDefinition<Config = any> {
@@ -1297,7 +1297,7 @@ export interface SSRManifest {
1297
1297
  client: NonNullable<BuildData['client']>;
1298
1298
  nodes: SSRNodeLoader[];
1299
1299
  routes: SSRRoute[];
1300
- matchers(): Promise<Record<string, ParamMatcher>>;
1300
+ matchers: () => Promise<Record<string, ParamMatcher>>;
1301
1301
  /** A `[file]: size` map of all assets imported by server code */
1302
1302
  server_assets: Record<string, number>;
1303
1303
  };
@@ -1324,7 +1324,7 @@ export interface ServerLoadEvent<
1324
1324
  *
1325
1325
  * Be careful not to introduce accidental waterfalls when using `await parent()`. If for example you only want to merge parent data into the returned output, call it _after_ fetching your other data.
1326
1326
  */
1327
- parent(): Promise<ParentData>;
1327
+ parent: () => Promise<ParentData>;
1328
1328
  /**
1329
1329
  * This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://svelte.dev/docs/kit/$app-navigation#invalidate) to cause `load` to rerun.
1330
1330
  *
@@ -1362,7 +1362,7 @@ export interface ServerLoadEvent<
1362
1362
  * <button on:click={increase}>Increase Count</button>
1363
1363
  * ```
1364
1364
  */
1365
- depends(...deps: string[]): void;
1365
+ depends: (...deps: string[]) => void;
1366
1366
  /**
1367
1367
  * Use this function to opt out of dependency tracking for everything that is synchronously called within the callback. Example:
1368
1368
  *
@@ -1376,7 +1376,7 @@ export interface ServerLoadEvent<
1376
1376
  * }
1377
1377
  * ```
1378
1378
  */
1379
- untrack<T>(fn: () => T): T;
1379
+ untrack: <T>(fn: () => T) => T;
1380
1380
  }
1381
1381
 
1382
1382
  /**
@@ -1447,7 +1447,7 @@ export type SubmitFunction<
1447
1447
  formElement: HTMLFormElement;
1448
1448
  controller: AbortController;
1449
1449
  submitter: HTMLElement | null;
1450
- cancel(): void;
1450
+ cancel: () => void;
1451
1451
  }) => MaybePromise<
1452
1452
  | void
1453
1453
  | ((opts: {
@@ -1460,7 +1460,7 @@ export type SubmitFunction<
1460
1460
  * @param options Set `reset: false` if you don't want the `<form>` values to be reset after a successful submission.
1461
1461
  * @param invalidateAll Set `invalidateAll: false` if you don't want the action to call `invalidateAll` after submission.
1462
1462
  */
1463
- update(options?: { reset?: boolean; invalidateAll?: boolean }): Promise<void>;
1463
+ update: (options?: { reset?: boolean; invalidateAll?: boolean }) => Promise<void>;
1464
1464
  }) => void)
1465
1465
  >;
1466
1466
 
@@ -3,6 +3,7 @@ import { mkdirp } from '../../../utils/filesystem.js';
3
3
  import { find_deps, resolve_symlinks } from './utils.js';
4
4
  import { s } from '../../../utils/misc.js';
5
5
  import { normalizePath } from 'vite';
6
+ import { basename } from 'node:path';
6
7
 
7
8
  /**
8
9
  * @param {string} out
@@ -17,18 +18,47 @@ export function build_server_nodes(out, kit, manifest_data, server_manifest, cli
17
18
  mkdirp(`${out}/server/nodes`);
18
19
  mkdirp(`${out}/server/stylesheets`);
19
20
 
21
+ /** @type {Map<string, string>} */
20
22
  const stylesheet_lookup = new Map();
21
23
 
22
24
  if (css) {
23
- css.forEach((asset) => {
24
- if (asset.source.length < kit.inlineStyleThreshold) {
25
- const index = stylesheet_lookup.size;
26
- const file = `${out}/server/stylesheets/${index}.js`;
25
+ /** @type {Set<string>} */
26
+ const client_stylesheets = new Set();
27
+ for (const key in client_manifest) {
28
+ const file = client_manifest[key];
29
+ if (file.css?.[0]) {
30
+ client_stylesheets.add(file.css[0]);
31
+ }
32
+ }
33
+
34
+ /** @type {Map<number, string>} */
35
+ const server_stylesheets = new Map();
36
+
37
+ const component_stylesheet_map = new Map(Object.values(server_manifest).map((file) => [file.src, file.css?.[0]]));
27
38
 
28
- fs.writeFileSync(file, `// ${asset.fileName}\nexport default ${s(asset.source)};`);
29
- stylesheet_lookup.set(asset.fileName, index);
39
+ manifest_data.nodes.forEach((node, i) => {
40
+ const server_stylesheet = component_stylesheet_map.get(node.component);
41
+ if (node.component && server_stylesheet) {
42
+ server_stylesheets.set(i, server_stylesheet);
30
43
  }
31
44
  });
45
+
46
+ // ignore dynamically imported stylesheets since we can't inline those
47
+ css.filter(asset => client_stylesheets.has(asset.fileName))
48
+ .forEach((asset) => {
49
+ if (asset.source.length < kit.inlineStyleThreshold) {
50
+ const [index] = basename(asset.fileName).split('.');
51
+ const server_stylesheet = server_stylesheets.get(+index);
52
+ const file = `${out}/server/stylesheets/${index}.js`;
53
+
54
+ // we need to inline the server stylesheet instead of the client one
55
+ // so that asset paths are correct on document load
56
+ const source = fs.readFileSync(`${out}/server/${server_stylesheet}`, 'utf-8');
57
+
58
+ fs.writeFileSync(file, `// ${server_stylesheet}\nexport default ${s(source)};`);
59
+ stylesheet_lookup.set(asset.fileName, index);
60
+ }
61
+ });
32
62
  }
33
63
 
34
64
  manifest_data.nodes.forEach((node, i) => {
@@ -59,13 +89,19 @@ export function build_server_nodes(out, kit, manifest_data, server_manifest, cli
59
89
  }
60
90
 
61
91
  if (node.universal) {
62
- imports.push(`import * as universal from '../${server_manifest[node.universal].file}';`);
92
+ imports.push(
93
+ `import * as universal from '../${
94
+ resolve_symlinks(server_manifest, node.universal).chunk.file
95
+ }';`
96
+ );
63
97
  exports.push('export { universal };');
64
98
  exports.push(`export const universal_id = ${s(node.universal)};`);
65
99
  }
66
100
 
67
101
  if (node.server) {
68
- imports.push(`import * as server from '../${server_manifest[node.server].file}';`);
102
+ imports.push(
103
+ `import * as server from '../${resolve_symlinks(server_manifest, node.server).chunk.file}';`
104
+ );
69
105
  exports.push('export { server };');
70
106
  exports.push(`export const server_id = ${s(node.server)};`);
71
107
  }
@@ -462,7 +462,7 @@ export async function dev(vite, vite_config, svelte_config) {
462
462
  res.writeHead(200, {
463
463
  'content-type': 'application/javascript'
464
464
  });
465
- res.end(`import '${to_fs(resolved)}';`);
465
+ res.end(`import '${svelte_config.kit.paths.base}${to_fs(resolved)}';`);
466
466
  } else {
467
467
  res.writeHead(404);
468
468
  res.end('not found');
@@ -659,7 +659,7 @@ async function kit({ svelte_config }) {
659
659
  format: inline ? 'iife' : 'esm',
660
660
  name: `__sveltekit_${version_hash}.app`,
661
661
  entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`,
662
- chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[name].[hash].${ext}`,
662
+ chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[hash].${ext}`,
663
663
  assetFileNames: `${prefix}/assets/[name].[hash][extname]`,
664
664
  hoistTransitiveImports: false,
665
665
  sourcemapIgnoreList,
@@ -676,7 +676,7 @@ async function kit({ svelte_config }) {
676
676
  rollupOptions: {
677
677
  output: {
678
678
  entryFileNames: `${prefix}/workers/[name]-[hash].js`,
679
- chunkFileNames: `${prefix}/workers/chunks/[name]-[hash].js`,
679
+ chunkFileNames: `${prefix}/workers/chunks/[hash].js`,
680
680
  assetFileNames: `${prefix}/workers/assets/[name]-[hash][extname]`,
681
681
  hoistTransitiveImports: false
682
682
  }
@@ -65,6 +65,9 @@ function clone(element) {
65
65
  * - redirects to the nearest error page in case of an unexpected error
66
66
  *
67
67
  * If you provide a custom function with a callback and want to use the default behavior, invoke `update` in your callback.
68
+ * It accepts an options object
69
+ * - `reset: false` if you don't want the `<form>` values to be reset after a successful submission
70
+ * - `invalidateAll: false` if you don't want the action to call `invalidateAll` after submission
68
71
  * @template {Record<string, unknown> | undefined} Success
69
72
  * @template {Record<string, unknown> | undefined} Failure
70
73
  * @param {HTMLFormElement} form_element The form element