@sveltejs/kit 1.0.0-next.419 → 1.0.0-next.421

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.419",
3
+ "version": "1.0.0-next.421",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -39,11 +39,11 @@
39
39
  "tiny-glob": "^0.2.9",
40
40
  "typescript": "^4.7.4",
41
41
  "uvu": "^0.5.3",
42
- "vite": "3.0.2"
42
+ "vite": "^3.0.8"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "svelte": "^3.44.0",
46
- "vite": "3.0.2"
46
+ "vite": "^3.0.0"
47
47
  },
48
48
  "bin": {
49
49
  "svelte-kit": "svelte-kit.js"
@@ -117,7 +117,8 @@ export async function render_page(event, route, options, state, resolve_opts) {
117
117
  });
118
118
  }
119
119
 
120
- const should_prerender = leaf_node.shared?.prerender ?? options.prerender.default;
120
+ const should_prerender =
121
+ leaf_node.shared?.prerender ?? leaf_node.server?.prerender ?? options.prerender.default;
121
122
  if (should_prerender) {
122
123
  const mod = leaf_node.server;
123
124
  if (mod && (mod.POST || mod.PUT || mod.DELETE || mod.PATCH)) {
@@ -4,7 +4,7 @@ import { mkdirp, posixify } from '../../utils/filesystem.js';
4
4
  import { get_vite_config, merge_vite_configs, resolve_entry } from '../utils.js';
5
5
  import { load_template } from '../../core/config/index.js';
6
6
  import { runtime_directory } from '../../core/utils.js';
7
- import { create_build, find_deps, get_default_config, is_http_method } from './utils.js';
7
+ import { create_build, find_deps, get_default_build_config, is_http_method } from './utils.js';
8
8
  import { s } from '../../utils/misc.js';
9
9
 
10
10
  /**
@@ -205,7 +205,7 @@ export async function build_server(options, client) {
205
205
  );
206
206
 
207
207
  const merged_config = merge_vite_configs(
208
- get_default_config({ config, input, ssr: true, outDir: `${output_dir}/server` }),
208
+ get_default_build_config({ config, input, ssr: true, outDir: `${output_dir}/server` }),
209
209
  await get_vite_config(vite_config, vite_config_env)
210
210
  );
211
211
 
@@ -87,7 +87,7 @@ export function find_deps(manifest, entry, add_dynamic_css) {
87
87
  * }} options
88
88
  * @return {import('vite').UserConfig}
89
89
  */
90
- export const get_default_config = function ({ config, input, ssr, outDir }) {
90
+ export function get_default_build_config({ config, input, ssr, outDir }) {
91
91
  const prefix = `${config.kit.appDir}/immutable`;
92
92
 
93
93
  return {
@@ -135,7 +135,7 @@ export const get_default_config = function ({ config, input, ssr, outDir }) {
135
135
  }
136
136
  }
137
137
  };
138
- };
138
+ }
139
139
 
140
140
  /**
141
141
  * @param {import('types').ValidatedKitConfig} config
package/src/vite/index.js CHANGED
@@ -12,7 +12,7 @@ import { load_config } from '../core/config/index.js';
12
12
  import { dev } from './dev/index.js';
13
13
  import { generate_manifest } from '../core/generate_manifest/index.js';
14
14
  import { runtime_directory, logger } from '../core/utils.js';
15
- import { find_deps, get_default_config as get_default_build_config } from './build/utils.js';
15
+ import { find_deps, get_default_build_config } from './build/utils.js';
16
16
  import { preview } from './preview/index.js';
17
17
  import { get_aliases, resolve_entry, prevent_illegal_rollup_imports, get_env } from './utils.js';
18
18
  import { fileURLToPath } from 'node:url';
@@ -266,6 +266,13 @@ function kit() {
266
266
  `${posixify(svelte_config.kit.outDir)}/!(generated)`
267
267
  ]
268
268
  }
269
+ },
270
+ ssr: {
271
+ // Without this, Vite will treat `@sveltejs/kit` as noExternal if it's
272
+ // a linked dependency, and that causes modules to be imported twice
273
+ // under different IDs, which breaks a bunch of stuff
274
+ // https://github.com/vitejs/vite/pull/9296
275
+ external: ['@sveltejs/kit']
269
276
  }
270
277
  };
271
278
 
package/types/index.d.ts CHANGED
@@ -106,7 +106,6 @@ export interface Config {
106
106
  compilerOptions?: CompileOptions;
107
107
  extensions?: string[];
108
108
  kit?: KitConfig;
109
- preprocess?: any;
110
109
  package?: {
111
110
  source?: string;
112
111
  dir?: string;
@@ -114,6 +113,7 @@ export interface Config {
114
113
  exports?: (filepath: string) => boolean;
115
114
  files?: (filepath: string) => boolean;
116
115
  };
116
+ preprocess?: any;
117
117
  [key: string]: any;
118
118
  }
119
119
 
@@ -211,12 +211,11 @@ export interface SSRNode {
211
211
  hydrate?: boolean;
212
212
  prerender?: boolean;
213
213
  router?: boolean;
214
- ssr?: boolean;
215
214
  };
216
215
 
217
216
  server: {
218
217
  load?: ServerLoad;
219
- HEAD?: ServerLoad;
218
+ prerender?: boolean;
220
219
  POST?: Action;
221
220
  PATCH?: Action;
222
221
  PUT?: Action;