@sveltejs/kit 1.3.0 → 1.3.1

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.
@@ -1,26 +1,27 @@
1
- import { fork } from 'node:child_process';
2
1
  import fs from 'node:fs';
3
2
  import path from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
3
 
6
4
  import { svelte } from '@sveltejs/vite-plugin-svelte';
7
5
  import colors from 'kleur';
8
6
  import * as vite from 'vite';
9
7
 
10
- import { mkdirp, posixify, resolve_entry, rimraf } from '../../utils/filesystem.js';
8
+ import { mkdirp, posixify, read, resolve_entry, rimraf } from '../../utils/filesystem.js';
11
9
  import { create_static_module, create_dynamic_module } from '../../core/env.js';
12
10
  import * as sync from '../../core/sync/sync.js';
13
11
  import { create_assets } from '../../core/sync/create_manifest_data/index.js';
14
12
  import { runtime_directory, logger } from '../../core/utils.js';
15
13
  import { load_config } from '../../core/config/index.js';
16
14
  import { generate_manifest } from '../../core/generate_manifest/index.js';
17
- import { build_server } from './build/build_server.js';
15
+ import { build_server_nodes } from './build/build_server.js';
18
16
  import { build_service_worker } from './build/build_service_worker.js';
19
17
  import { assets_base, find_deps } from './build/utils.js';
20
18
  import { dev } from './dev/index.js';
21
19
  import { is_illegal, module_guard, normalize_id } from './graph_analysis/index.js';
22
20
  import { preview } from './preview/index.js';
23
21
  import { get_config_aliases, get_env } from './utils.js';
22
+ import { write_client_manifest } from '../../core/sync/write_client_manifest.js';
23
+ import prerender from '../../core/postbuild/prerender.js';
24
+ import analyse from '../../core/postbuild/analyse.js';
24
25
 
25
26
  export { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
26
27
 
@@ -138,6 +139,11 @@ export async function sveltekit() {
138
139
  return [...svelte(vite_plugin_svelte_options), ...kit({ svelte_config })];
139
140
  }
140
141
 
142
+ /**
143
+ * If `true`, the server build has been completed and we're creating the client build
144
+ */
145
+ let secondary_build = false;
146
+
141
147
  /**
142
148
  * Returns the SvelteKit Vite plugin. Vite executes Rollup hooks as well as some of its own.
143
149
  * Background reading is available at:
@@ -167,22 +173,13 @@ function kit({ svelte_config }) {
167
173
  /** @type {boolean} */
168
174
  let is_build;
169
175
 
170
- /** @type {import('types').Logger} */
171
- let log;
172
-
173
- /** @type {import('types').Prerendered} */
174
- let prerendered;
175
-
176
- /** @type {import('types').PrerenderMap} */
177
- let prerender_map;
178
-
179
- /** @type {import('types').BuildData} */
180
- let build_data;
181
-
182
176
  /** @type {{ public: Record<string, string>; private: Record<string, string> }} */
183
177
  let env;
184
178
 
185
- let completed_build = false;
179
+ /** @type {(() => Promise<void>) | null} */
180
+ let finalise = null;
181
+
182
+ const service_worker_entry_file = resolve_entry(kit.files.serviceWorker);
186
183
 
187
184
  /** @type {import('vite').Plugin} */
188
185
  const plugin_setup = {
@@ -212,12 +209,19 @@ function kit({ svelte_config }) {
212
209
  const client_hooks = resolve_entry(kit.files.hooks.client);
213
210
  if (client_hooks) allow.add(path.dirname(client_hooks));
214
211
 
212
+ const generated = path.posix.join(kit.outDir, 'generated');
213
+
215
214
  // dev and preview config can be shared
216
215
  /** @type {import('vite').UserConfig} */
217
216
  const new_config = {
218
217
  resolve: {
219
218
  alias: [
220
- { find: '__GENERATED__', replacement: path.posix.join(kit.outDir, 'generated') },
219
+ {
220
+ find: '__CLIENT__',
221
+ replacement: `${generated}/${is_build ? 'client-optimized' : 'client'}`
222
+ },
223
+ { find: '__SERVER__', replacement: `${generated}/server` },
224
+ { find: '__GENERATED__', replacement: generated },
221
225
  { find: '$app', replacement: `${runtime_directory}/app` },
222
226
  ...get_config_aliases(kit)
223
227
  ]
@@ -246,6 +250,9 @@ function kit({ svelte_config }) {
246
250
  };
247
251
 
248
252
  if (is_build) {
253
+ if (!new_config.build) new_config.build = {};
254
+ new_config.build.ssr = !secondary_build;
255
+
249
256
  new_config.define = {
250
257
  __SVELTEKIT_ADAPTER_NAME__: JSON.stringify(kit.adapter?.name),
251
258
  __SVELTEKIT_APP_VERSION_FILE__: JSON.stringify(`${kit.appDir}/version.json`),
@@ -345,6 +352,35 @@ function kit({ svelte_config }) {
345
352
  }
346
353
  };
347
354
 
355
+ /**
356
+ * Ensures that client-side code can't accidentally import server-side code,
357
+ * whether in `*.server.js` files, `$lib/server`, or `$env/[static|dynamic]/private`
358
+ * @type {import('vite').Plugin}
359
+ */
360
+ const plugin_guard = {
361
+ name: 'vite-plugin-sveltekit-guard',
362
+
363
+ writeBundle: {
364
+ sequential: true,
365
+ async handler(_options) {
366
+ if (!secondary_build) return;
367
+
368
+ const guard = module_guard(this, {
369
+ cwd: vite.normalizePath(process.cwd()),
370
+ lib: vite.normalizePath(kit.files.lib)
371
+ });
372
+
373
+ manifest_data.nodes.forEach((_node, i) => {
374
+ const id = vite.normalizePath(
375
+ path.resolve(kit.outDir, `generated/client-optimized/nodes/${i}.js`)
376
+ );
377
+
378
+ guard.check(id);
379
+ });
380
+ }
381
+ }
382
+ };
383
+
348
384
  /** @type {import('vite').Plugin} */
349
385
  const plugin_compile = {
350
386
  name: 'vite-plugin-sveltekit-compile',
@@ -360,7 +396,7 @@ function kit({ svelte_config }) {
360
396
  if (is_build) {
361
397
  manifest_data = (await sync.all(svelte_config, config_env.mode)).manifest_data;
362
398
 
363
- const ssr = config.build?.ssr ?? false;
399
+ const ssr = /** @type {boolean} */ (config.build?.ssr);
364
400
  const prefix = `${kit.appDir}/immutable`;
365
401
 
366
402
  /** @type {Record<string, string>} */
@@ -368,7 +404,7 @@ function kit({ svelte_config }) {
368
404
 
369
405
  if (ssr) {
370
406
  input.index = `${runtime_directory}/server/index.js`;
371
- input.internal = `${kit.outDir}/generated/server-internal.js`;
407
+ input.internal = `${kit.outDir}/generated/server/internal.js`;
372
408
 
373
409
  // add entry points for every endpoint...
374
410
  manifest_data.routes.forEach((route) => {
@@ -499,10 +535,10 @@ function kit({ svelte_config }) {
499
535
  * Clears the output directories.
500
536
  */
501
537
  buildStart() {
502
- if (vite_config.build.ssr) return;
538
+ if (secondary_build) return;
503
539
 
504
- // Reset for new build. Goes here because `build --watch` calls buildStart but not config
505
- completed_build = false;
540
+ // reset (here, not in `config`, because `build --watch` skips `config`)
541
+ finalise = null;
506
542
 
507
543
  if (is_build) {
508
544
  if (!vite_config.build.watch) {
@@ -513,7 +549,7 @@ function kit({ svelte_config }) {
513
549
  },
514
550
 
515
551
  generateBundle() {
516
- if (vite_config.build.ssr) return;
552
+ if (!secondary_build) return;
517
553
 
518
554
  this.emitFile({
519
555
  type: 'asset',
@@ -529,71 +565,77 @@ function kit({ svelte_config }) {
529
565
  */
530
566
  writeBundle: {
531
567
  sequential: true,
532
- async handler(_options, bundle) {
533
- if (vite_config.build.ssr) return;
568
+ async handler(_options) {
569
+ if (secondary_build) return; // only run this once
570
+ secondary_build = true;
534
571
 
535
- const guard = module_guard(this, {
536
- cwd: vite.normalizePath(process.cwd()),
537
- lib: vite.normalizePath(kit.files.lib)
538
- });
539
-
540
- manifest_data.nodes.forEach((_node, i) => {
541
- const id = vite.normalizePath(path.resolve(kit.outDir, `generated/nodes/${i}.js`));
572
+ const verbose = vite_config.logLevel === 'info';
573
+ const log = logger({ verbose });
542
574
 
543
- guard.check(id);
544
- });
575
+ /** @type {import('vite').Manifest} */
576
+ const server_manifest = JSON.parse(read(`${out}/server/${vite_config.build.manifest}`));
545
577
 
546
- const verbose = vite_config.logLevel === 'info';
547
- log = logger({
548
- verbose
549
- });
578
+ /** @type {import('types').BuildData} */
579
+ const build_data = {
580
+ app_dir: kit.appDir,
581
+ app_path: `${kit.paths.base.slice(1)}${kit.paths.base ? '/' : ''}${kit.appDir}`,
582
+ manifest_data,
583
+ service_worker: !!service_worker_entry_file ? 'service-worker.js' : null, // TODO make file configurable?
584
+ client_entry: null,
585
+ server_manifest
586
+ };
550
587
 
551
- const { assets, chunks } = collect_output(bundle);
552
- log.info(
553
- `Client build completed. Wrote ${chunks.length} chunks and ${assets.length} assets`
588
+ const manifest_path = `${out}/server/manifest-full.js`;
589
+ fs.writeFileSync(
590
+ manifest_path,
591
+ `export const manifest = ${generate_manifest({
592
+ build_data,
593
+ relative_path: '.',
594
+ routes: manifest_data.routes
595
+ })};\n`
554
596
  );
555
597
 
556
- log.info('Building server');
598
+ // first, build server nodes without the client manifest so we can analyse it
599
+ build_server_nodes(out, kit, manifest_data, server_manifest, null, null);
557
600
 
558
- const options = {
559
- config: svelte_config,
560
- vite_config,
561
- vite_config_env,
562
- manifest_data,
563
- output_dir: out
564
- };
601
+ const metadata = await analyse({
602
+ manifest_path,
603
+ env: { ...env.private, ...env.public }
604
+ });
565
605
 
566
- /** @type {import('vite').Manifest} */
567
- const vite_manifest = JSON.parse(
568
- fs.readFileSync(`${out}/client/${vite_config.build.manifest}`, 'utf-8')
606
+ // create client build
607
+ write_client_manifest(
608
+ kit,
609
+ manifest_data,
610
+ `${kit.outDir}/generated/client-optimized`,
611
+ metadata.nodes
569
612
  );
570
613
 
571
- const client = {
572
- assets,
573
- chunks,
574
- entry: find_deps(
575
- vite_manifest,
576
- posixify(path.relative('.', `${runtime_directory}/client/start.js`)),
577
- false
578
- ),
579
- vite_manifest
580
- };
614
+ const { output } = /** @type {import('rollup').RollupOutput} */ (
615
+ await vite.build({
616
+ configFile: vite_config.configFile,
617
+ // CLI args
618
+ mode: vite_config_env.mode,
619
+ logLevel: vite_config.logLevel,
620
+ clearScreen: vite_config.clearScreen
621
+ })
622
+ );
581
623
 
582
- const server = await build_server(options, client);
624
+ /** @type {import('vite').Manifest} */
625
+ const client_manifest = JSON.parse(read(`${out}/client/${vite_config.build.manifest}`));
583
626
 
584
- const service_worker_entry_file = resolve_entry(kit.files.serviceWorker);
627
+ build_data.client_entry = find_deps(
628
+ client_manifest,
629
+ posixify(path.relative('.', `${runtime_directory}/client/start.js`)),
630
+ false
631
+ );
585
632
 
586
- /** @type {import('types').BuildData} */
587
- build_data = {
588
- app_dir: kit.appDir,
589
- app_path: `${kit.paths.base.slice(1)}${kit.paths.base ? '/' : ''}${kit.appDir}`,
590
- manifest_data,
591
- service_worker: !!service_worker_entry_file ? 'service-worker.js' : null, // TODO make file configurable?
592
- client,
593
- server
594
- };
633
+ const css = output.filter(
634
+ /** @type {(value: any) => value is import('rollup').OutputAsset} */
635
+ (value) => value.type === 'asset' && value.fileName.endsWith('.css')
636
+ );
595
637
 
596
- const manifest_path = `${out}/server/manifest-full.js`;
638
+ // regenerate manifest now that we have client entry...
597
639
  fs.writeFileSync(
598
640
  manifest_path,
599
641
  `export const manifest = ${generate_manifest({
@@ -603,44 +645,18 @@ function kit({ svelte_config }) {
603
645
  })};\n`
604
646
  );
605
647
 
648
+ // regenerate nodes with the client manifest...
649
+ build_server_nodes(out, kit, manifest_data, server_manifest, client_manifest, css);
650
+
651
+ // ...and prerender
606
652
  log.info('Prerendering');
607
- await new Promise((fulfil, reject) => {
608
- const results_path = `${kit.outDir}/generated/prerendered.json`;
609
-
610
- // do prerendering in a subprocess so any dangling stuff gets killed upon completion
611
- const script = fileURLToPath(new URL('../../core/postbuild/index.js', import.meta.url));
612
-
613
- const child = fork(
614
- script,
615
- [
616
- vite_config.build.outDir,
617
- manifest_path,
618
- results_path,
619
- '' + verbose,
620
- JSON.stringify({ ...env.private, ...env.public })
621
- ],
622
- {
623
- stdio: 'inherit'
624
- }
625
- );
626
653
 
627
- child.on('exit', (code) => {
628
- if (code) {
629
- reject(new Error(`Prerendering failed with code ${code}`));
630
- } else {
631
- const results = JSON.parse(fs.readFileSync(results_path, 'utf8'), (key, value) => {
632
- if (key === 'pages' || key === 'assets' || key === 'redirects') {
633
- return new Map(value);
634
- }
635
- return value;
636
- });
637
-
638
- prerendered = results.prerendered;
639
- prerender_map = new Map(results.prerender_map);
640
-
641
- fulfil(undefined);
642
- }
643
- });
654
+ const { prerendered, prerender_map } = await prerender({
655
+ out,
656
+ manifest_path,
657
+ metadata,
658
+ verbose,
659
+ env: { ...env.private, ...env.public }
644
660
  });
645
661
 
646
662
  // generate a new manifest that doesn't include prerendered pages
@@ -661,18 +677,41 @@ function kit({ svelte_config }) {
661
677
  log.info('Building service worker');
662
678
 
663
679
  await build_service_worker(
664
- options,
680
+ out,
681
+ kit,
682
+ vite_config,
683
+ manifest_data,
665
684
  service_worker_entry_file,
666
685
  prerendered,
667
- client.vite_manifest
686
+ client_manifest
668
687
  );
669
688
  }
670
689
 
671
- console.log(
672
- `\nRun ${colors.bold().cyan('npm run preview')} to preview your production build locally.`
673
- );
690
+ // we need to defer this to closeBundle, so that adapters copy files
691
+ // created by other Vite plugins
692
+ finalise = async () => {
693
+ console.log(
694
+ `\nRun ${colors
695
+ .bold()
696
+ .cyan('npm run preview')} to preview your production build locally.`
697
+ );
698
+
699
+ if (kit.adapter) {
700
+ const { adapt } = await import('../../core/adapt/index.js');
701
+ await adapt(svelte_config, build_data, metadata, prerendered, prerender_map, log);
702
+ } else {
703
+ console.log(colors.bold().yellow('\nNo adapter specified'));
674
704
 
675
- completed_build = true;
705
+ const link = colors.bold().cyan('https://kit.svelte.dev/docs/adapters');
706
+ console.log(
707
+ `See ${link} to learn how to configure your app to run on the platform of your choosing`
708
+ );
709
+ }
710
+
711
+ // avoid making the manifest available to users
712
+ fs.unlinkSync(`${out}/client/${vite_config.build.manifest}`);
713
+ fs.unlinkSync(`${out}/server/${vite_config.build.manifest}`);
714
+ };
676
715
  }
677
716
  },
678
717
 
@@ -682,50 +721,12 @@ function kit({ svelte_config }) {
682
721
  closeBundle: {
683
722
  sequential: true,
684
723
  async handler() {
685
- // vite calls closeBundle when dev-server restarts, ignore that,
686
- // and only adapt when build successfully completes.
687
- const is_restart = !completed_build;
688
- if (vite_config.build.ssr || is_restart) {
689
- return;
690
- }
691
-
692
- if (kit.adapter) {
693
- const { adapt } = await import('../../core/adapt/index.js');
694
- await adapt(svelte_config, build_data, prerendered, prerender_map, { log });
695
- } else {
696
- console.log(colors.bold().yellow('\nNo adapter specified'));
697
-
698
- const link = colors.bold().cyan('https://kit.svelte.dev/docs/adapters');
699
- console.log(
700
- `See ${link} to learn how to configure your app to run on the platform of your choosing`
701
- );
702
- }
703
-
704
- // avoid making the manifest available to users
705
- fs.unlinkSync(`${out}/client/${vite_config.build.manifest}`);
706
- fs.unlinkSync(`${out}/server/${vite_config.build.manifest}`);
724
+ finalise?.();
707
725
  }
708
726
  }
709
727
  };
710
728
 
711
- return [plugin_setup, plugin_virtual_modules, plugin_compile];
712
- }
713
-
714
- /** @param {import('rollup').OutputBundle} bundle */
715
- function collect_output(bundle) {
716
- /** @type {import('rollup').OutputChunk[]} */
717
- const chunks = [];
718
- /** @type {import('rollup').OutputAsset[]} */
719
- const assets = [];
720
- for (const value of Object.values(bundle)) {
721
- // collect asset and output chunks
722
- if (value.type === 'asset') {
723
- assets.push(value);
724
- } else {
725
- chunks.push(value);
726
- }
727
- }
728
- return { assets, chunks };
729
+ return [plugin_setup, plugin_virtual_modules, plugin_guard, plugin_compile];
729
730
  }
730
731
 
731
732
  /**
@@ -1,4 +1,4 @@
1
- declare module '__GENERATED__/client-manifest.js' {
1
+ declare module '__CLIENT__/manifest.js' {
2
2
  import { CSRPageNodeLoader, ClientHooks, ParamMatcher } from 'types';
3
3
 
4
4
  /**
@@ -25,7 +25,7 @@ import {
25
25
  import { parse } from './parse.js';
26
26
 
27
27
  import Root from '__GENERATED__/root.svelte';
28
- import { nodes, server_loads, dictionary, matchers, hooks } from '__GENERATED__/client-manifest.js';
28
+ import { nodes, server_loads, dictionary, matchers, hooks } from '__CLIENT__/manifest.js';
29
29
  import { HttpError, Redirect } from '../control.js';
30
30
  import { stores } from './singletons.js';
31
31
  import { unwrap_promises } from '../../utils/promises.js';
@@ -921,12 +921,12 @@ export function create_client({ target, base }) {
921
921
  /** @type {Record<string, string>} */
922
922
  const params = {}; // error page does not have params
923
923
 
924
- const node = await default_layout_loader();
925
-
926
924
  /** @type {import('types').ServerDataNode | null} */
927
925
  let server_data_node = null;
928
926
 
929
- if (node.has_server_load) {
927
+ const default_layout_has_server_load = server_loads[0] === 0;
928
+
929
+ if (default_layout_has_server_load) {
930
930
  // TODO post-https://github.com/sveltejs/kit/discussions/6124 we can use
931
931
  // existing root layout data
932
932
  try {
@@ -3,7 +3,7 @@ import { exec, parse_route_id } from '../../utils/routing.js';
3
3
  /**
4
4
  * @param {import('types').CSRPageNodeLoader[]} nodes
5
5
  * @param {number[]} server_loads
6
- * @param {typeof import('__GENERATED__/client-manifest.js').dictionary} dictionary
6
+ * @param {typeof import('__CLIENT__/manifest.js').dictionary} dictionary
7
7
  * @param {Record<string, (param: string) => boolean>} matchers
8
8
  * @returns {import('types').CSRRoute[]}
9
9
  */
@@ -1,4 +1,4 @@
1
- declare module '__GENERATED__/server-internal.js' {
1
+ declare module '__SERVER__/internal.js' {
2
2
  export const options: import('types').SSROptions;
3
3
  export const get_hooks: () => Promise<{
4
4
  handle?: import('types').Handle;
@@ -1,6 +1,6 @@
1
1
  import { respond } from './respond.js';
2
2
  import { set_private_env, set_public_env } from '../shared.js';
3
- import { options, get_hooks } from '__GENERATED__/server-internal.js';
3
+ import { options, get_hooks } from '__SERVER__/internal.js';
4
4
 
5
5
  export class Server {
6
6
  /** @type {import('types').SSROptions} */
@@ -176,3 +176,8 @@ export function resolve_entry(entry) {
176
176
 
177
177
  return null;
178
178
  }
179
+
180
+ /** @param {string} file */
181
+ export function read(file) {
182
+ return fs.readFileSync(file, 'utf-8');
183
+ }
@@ -0,0 +1,76 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import child_process from 'node:child_process';
3
+
4
+ /**
5
+ * Runs a task in a subprocess so any dangling stuff gets killed upon completion.
6
+ * The subprocess needs to be the file `forked` is called in, and `forked` needs to be called eagerly at the top level.
7
+ * @template T
8
+ * @template U
9
+ * @param {string} module `import.meta.url` of the file
10
+ * @param {(opts: T) => U} callback The function that is invoked in the subprocess
11
+ * @returns {(opts: T) => Promise<U>} A function that when called starts the subprocess
12
+ */
13
+ export function forked(module, callback) {
14
+ if (process.env.SVELTEKIT_FORK && process.send) {
15
+ process.send({ type: 'ready', module });
16
+
17
+ process.on(
18
+ 'message',
19
+ /** @param {any} data */ async (data) => {
20
+ if (data?.type === 'args' && data.module === module) {
21
+ if (process.send) {
22
+ process.send({
23
+ type: 'result',
24
+ module,
25
+ payload: await callback(data.payload)
26
+ });
27
+ }
28
+ }
29
+ }
30
+ );
31
+ }
32
+
33
+ /**
34
+ * @param {T} opts
35
+ * @returns {Promise<U>}
36
+ */
37
+ const fn = function (opts) {
38
+ return new Promise((fulfil, reject) => {
39
+ const script = fileURLToPath(new URL(module, import.meta.url));
40
+
41
+ const child = child_process.fork(script, {
42
+ stdio: 'inherit',
43
+ env: {
44
+ SVELTEKIT_FORK: 'true'
45
+ },
46
+ serialization: 'advanced'
47
+ });
48
+
49
+ child.on(
50
+ 'message',
51
+ /** @param {any} data */ (data) => {
52
+ if (data?.type === 'ready' && data.module === module) {
53
+ child.send({
54
+ type: 'args',
55
+ module,
56
+ payload: opts
57
+ });
58
+ }
59
+
60
+ if (data?.type === 'result' && data.module === module) {
61
+ child.kill();
62
+ fulfil(data.payload);
63
+ }
64
+ }
65
+ );
66
+
67
+ child.on('exit', (code) => {
68
+ if (code) {
69
+ reject(new Error(`Failed with code ${code}`));
70
+ }
71
+ });
72
+ });
73
+ };
74
+
75
+ return fn;
76
+ }
@@ -1,4 +1,4 @@
1
- import { OutputAsset, OutputChunk } from 'rollup';
1
+ import { OutputChunk } from 'rollup';
2
2
  import { SvelteComponent } from 'svelte/internal';
3
3
  import {
4
4
  Config,
@@ -7,7 +7,6 @@ import {
7
7
  HandleServerError,
8
8
  KitConfig,
9
9
  Load,
10
- RequestEvent,
11
10
  RequestHandler,
12
11
  ResolveOptions,
13
12
  Server,
@@ -49,22 +48,13 @@ export interface BuildData {
49
48
  app_path: string;
50
49
  manifest_data: ManifestData;
51
50
  service_worker: string | null;
52
- client: {
53
- assets: OutputAsset[];
54
- chunks: OutputChunk[];
55
- entry: {
56
- file: string;
57
- imports: string[];
58
- stylesheets: string[];
59
- fonts: string[];
60
- };
61
- vite_manifest: import('vite').Manifest;
62
- };
63
- server: {
64
- chunks: OutputChunk[];
65
- methods: Record<string, HttpMethod[]>;
66
- vite_manifest: import('vite').Manifest;
67
- };
51
+ client_entry: {
52
+ file: string;
53
+ imports: string[];
54
+ stylesheets: string[];
55
+ fonts: string[];
56
+ } | null;
57
+ server_manifest: import('vite').Manifest;
68
58
  }
69
59
 
70
60
  export interface CSRPageNode {
@@ -73,7 +63,6 @@ export interface CSRPageNode {
73
63
  load?: Load;
74
64
  trailingSlash?: TrailingSlash;
75
65
  };
76
- has_server_load: boolean;
77
66
  }
78
67
 
79
68
  export type CSRPageNodeLoader = () => Promise<CSRPageNode>;
@@ -244,6 +233,17 @@ export interface ServerErrorNode {
244
233
  status?: number;
245
234
  }
246
235
 
236
+ export interface ServerMetadata {
237
+ nodes: Array<{ has_server_load: boolean }>;
238
+ routes: Map<
239
+ string,
240
+ {
241
+ prerender: PrerenderOption | undefined;
242
+ methods: HttpMethod[];
243
+ }
244
+ >;
245
+ }
246
+
247
247
  export interface SSRComponent {
248
248
  default: {
249
249
  render(props: Record<string, any>): {
@@ -261,7 +261,7 @@ export type SSRComponentLoader = () => Promise<SSRComponent>;
261
261
 
262
262
  export interface SSRNode {
263
263
  component: SSRComponentLoader;
264
- /** index into the `components` array in client-manifest.js */
264
+ /** index into the `components` array in client/manifest.js */
265
265
  index: number;
266
266
  /** client-side module URL for this component */
267
267
  file: string;