@sveltejs/kit 1.0.0-next.347 → 1.0.0-next.348

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.
@@ -3093,8 +3093,9 @@ async function respond(request, options, state) {
3093
3093
  const is_data_request = decoded.endsWith(DATA_SUFFIX);
3094
3094
 
3095
3095
  if (is_data_request) {
3096
- decoded = decoded.slice(0, -DATA_SUFFIX.length) || '/';
3097
- url = new URL(url.origin + url.pathname.slice(0, -DATA_SUFFIX.length) + url.search);
3096
+ const data_suffix_length = DATA_SUFFIX.length - (options.trailing_slash === 'always' ? 1 : 0);
3097
+ decoded = decoded.slice(0, -data_suffix_length) || '/';
3098
+ url = new URL(url.origin + url.pathname.slice(0, -data_suffix_length) + url.search);
3098
3099
  }
3099
3100
 
3100
3101
  if (!state.prerendering?.fallback) {
@@ -3113,19 +3114,26 @@ async function respond(request, options, state) {
3113
3114
  }
3114
3115
  }
3115
3116
 
3116
- if (route?.type === 'page') {
3117
- const normalized = normalize_path(url.pathname, options.trailing_slash);
3117
+ if (route) {
3118
+ if (route.type === 'page') {
3119
+ const normalized = normalize_path(url.pathname, options.trailing_slash);
3118
3120
 
3119
- if (normalized !== url.pathname && !state.prerendering?.fallback) {
3121
+ if (normalized !== url.pathname && !state.prerendering?.fallback) {
3122
+ return new Response(undefined, {
3123
+ status: 301,
3124
+ headers: {
3125
+ 'x-sveltekit-normalize': '1',
3126
+ location:
3127
+ // ensure paths starting with '//' are not treated as protocol-relative
3128
+ (normalized.startsWith('//') ? url.origin + normalized : normalized) +
3129
+ (url.search === '?' ? '' : url.search)
3130
+ }
3131
+ });
3132
+ }
3133
+ } else if (is_data_request) {
3134
+ // requesting /__data.json should fail for a standalone endpoint
3120
3135
  return new Response(undefined, {
3121
- status: 301,
3122
- headers: {
3123
- 'x-sveltekit-normalize': '1',
3124
- location:
3125
- // ensure paths starting with '//' are not treated as protocol-relative
3126
- (normalized.startsWith('//') ? url.origin + normalized : normalized) +
3127
- (url.search === '?' ? '' : url.search)
3128
- }
3136
+ status: 404
3129
3137
  });
3130
3138
  }
3131
3139
  }
@@ -137,7 +137,7 @@ function find_deps(file, manifest, js, css) {
137
137
  */
138
138
  const get_default_config = function ({ client_out_dir, config, input, output_dir, ssr }) {
139
139
  return {
140
- base: assets_base(config),
140
+ base: assets_base(config.kit),
141
141
  build: {
142
142
  cssCodeSplit: true,
143
143
  manifest: true,
@@ -169,21 +169,21 @@ const get_default_config = function ({ client_out_dir, config, input, output_dir
169
169
  // if it happens to be 'public' instead of 'static'
170
170
  publicDir: false,
171
171
  resolve: {
172
- alias: get_aliases(config)
172
+ alias: get_aliases(config.kit)
173
173
  }
174
174
  };
175
175
  };
176
176
 
177
177
  /**
178
- * @param {import('types').ValidatedConfig} config
178
+ * @param {import('types').ValidatedKitConfig} config
179
179
  * @returns {string}
180
180
  */
181
181
  function assets_base(config) {
182
182
  // TODO this is so that Vite's preloading works. Unfortunately, it fails
183
183
  // during `svelte-kit preview`, because we use a local asset path. This
184
184
  // may be fixed in Vite 3: https://github.com/vitejs/vite/issues/2009
185
- const { base, assets } = config.kit.paths;
186
- return `${assets || base}/${config.kit.appDir}/immutable/`;
185
+ const { base, assets } = config.paths;
186
+ return `${assets || base}/${config.appDir}/immutable/`;
187
187
  }
188
188
 
189
189
  /**
@@ -248,7 +248,7 @@ async function build_service_worker(
248
248
 
249
249
  /** @type {[any, string[]]} */
250
250
  const [merged_config, conflicts] = deep_merge(await config.kit.vite(), {
251
- base: assets_base(config),
251
+ base: assets_base(config.kit),
252
252
  build: {
253
253
  lib: {
254
254
  entry: service_worker_entry_file,
@@ -511,7 +511,7 @@ async function build_server(options, client) {
511
511
  config,
512
512
  hooks: app_relative(hooks_file),
513
513
  has_service_worker: config.kit.serviceWorker.register && !!service_worker_entry_file,
514
- runtime: get_runtime_path(config),
514
+ runtime: get_runtime_path(config.kit),
515
515
  template: load_template(cwd, config)
516
516
  })
517
517
  );
@@ -1031,7 +1031,7 @@ const REDIRECT = 3;
1031
1031
 
1032
1032
  /**
1033
1033
  * @param {{
1034
- * config: import('types').ValidatedConfig;
1034
+ * config: import('types').ValidatedKitConfig;
1035
1035
  * entries: string[];
1036
1036
  * files: Set<string>;
1037
1037
  * log: Logger;
@@ -1046,36 +1046,36 @@ async function prerender({ config, entries, files, log }) {
1046
1046
  paths: []
1047
1047
  };
1048
1048
 
1049
- if (!config.kit.prerender.enabled) {
1049
+ if (!config.prerender.enabled) {
1050
1050
  return prerendered;
1051
1051
  }
1052
1052
 
1053
1053
  installPolyfills();
1054
1054
 
1055
- const server_root = join(config.kit.outDir, 'output');
1055
+ const server_root = join(config.outDir, 'output');
1056
1056
 
1057
1057
  /** @type {import('types').ServerModule} */
1058
1058
  const { Server, override } = await import(pathToFileURL(`${server_root}/server/index.js`).href);
1059
1059
  const { manifest } = await import(pathToFileURL(`${server_root}/server/manifest.js`).href);
1060
1060
 
1061
1061
  override({
1062
- paths: config.kit.paths,
1062
+ paths: config.paths,
1063
1063
  prerendering: true,
1064
- read: (file) => readFileSync(join(config.kit.files.assets, file))
1064
+ read: (file) => readFileSync(join(config.files.assets, file))
1065
1065
  });
1066
1066
 
1067
1067
  const server = new Server(manifest);
1068
1068
 
1069
- const error = normalise_error_handler(log, config.kit.prerender.onError);
1069
+ const error = normalise_error_handler(log, config.prerender.onError);
1070
1070
 
1071
- const q = queue(config.kit.prerender.concurrency);
1071
+ const q = queue(config.prerender.concurrency);
1072
1072
 
1073
1073
  /**
1074
1074
  * @param {string} path
1075
1075
  * @param {boolean} is_html
1076
1076
  */
1077
1077
  function output_filename(path, is_html) {
1078
- const file = path.slice(config.kit.paths.base.length + 1);
1078
+ const file = path.slice(config.paths.base.length + 1);
1079
1079
 
1080
1080
  if (file === '') {
1081
1081
  return 'index.html';
@@ -1100,7 +1100,7 @@ async function prerender({ config, entries, files, log }) {
1100
1100
  if (seen.has(decoded)) return;
1101
1101
  seen.add(decoded);
1102
1102
 
1103
- const file = decoded.slice(config.kit.paths.base.length + 1);
1103
+ const file = decoded.slice(config.paths.base.length + 1);
1104
1104
  if (files.has(file)) return;
1105
1105
 
1106
1106
  return q.add(() => visit(decoded, encoded || encodeURI(decoded), referrer));
@@ -1112,7 +1112,7 @@ async function prerender({ config, entries, files, log }) {
1112
1112
  * @param {string?} referrer
1113
1113
  */
1114
1114
  async function visit(decoded, encoded, referrer) {
1115
- if (!decoded.startsWith(config.kit.paths.base)) {
1115
+ if (!decoded.startsWith(config.paths.base)) {
1116
1116
  error({ status: 404, path: decoded, referrer, referenceType: 'linked' });
1117
1117
  return;
1118
1118
  }
@@ -1149,7 +1149,7 @@ async function prerender({ config, entries, files, log }) {
1149
1149
  );
1150
1150
  }
1151
1151
 
1152
- if (config.kit.prerender.crawl && response.headers.get('content-type') === 'text/html') {
1152
+ if (config.prerender.crawl && response.headers.get('content-type') === 'text/html') {
1153
1153
  for (const href of crawl(text)) {
1154
1154
  if (href.startsWith('data:') || href.startsWith('#')) continue;
1155
1155
 
@@ -1178,7 +1178,7 @@ async function prerender({ config, entries, files, log }) {
1178
1178
  const is_html = response_type === REDIRECT || type === 'text/html';
1179
1179
 
1180
1180
  const file = output_filename(decoded, is_html);
1181
- const dest = `${config.kit.outDir}/output/prerendered/${category}/${file}`;
1181
+ const dest = `${config.outDir}/output/prerendered/${category}/${file}`;
1182
1182
 
1183
1183
  if (written.has(file)) return;
1184
1184
 
@@ -1242,14 +1242,14 @@ async function prerender({ config, entries, files, log }) {
1242
1242
  }
1243
1243
  }
1244
1244
 
1245
- if (config.kit.prerender.enabled) {
1246
- for (const entry of config.kit.prerender.entries) {
1245
+ if (config.prerender.enabled) {
1246
+ for (const entry of config.prerender.entries) {
1247
1247
  if (entry === '*') {
1248
1248
  for (const entry of entries) {
1249
- enqueue(null, config.kit.paths.base + entry); // TODO can we pre-normalize these?
1249
+ enqueue(null, config.paths.base + entry); // TODO can we pre-normalize these?
1250
1250
  }
1251
1251
  } else {
1252
- enqueue(null, config.kit.paths.base + entry);
1252
+ enqueue(null, config.paths.base + entry);
1253
1253
  }
1254
1254
  }
1255
1255
 
@@ -1264,7 +1264,7 @@ async function prerender({ config, entries, files, log }) {
1264
1264
  }
1265
1265
  });
1266
1266
 
1267
- const file = `${config.kit.outDir}/output/prerendered/fallback.html`;
1267
+ const file = `${config.outDir}/output/prerendered/fallback.html`;
1268
1268
  mkdirp(dirname(file));
1269
1269
  writeFileSync(file, await rendered.text());
1270
1270
 
@@ -1299,7 +1299,7 @@ async function build(config, { log }) {
1299
1299
  build_dir,
1300
1300
  manifest_data,
1301
1301
  output_dir,
1302
- client_entry_file: path__default.relative(cwd, `${get_runtime_path(config)}/client/start.js`),
1302
+ client_entry_file: path__default.relative(cwd, `${get_runtime_path(config.kit)}/client/start.js`),
1303
1303
  service_worker_entry_file: resolve_entry(config.kit.files.serviceWorker)
1304
1304
  };
1305
1305
 
@@ -1338,7 +1338,7 @@ async function build(config, { log }) {
1338
1338
  });
1339
1339
 
1340
1340
  const prerendered = await prerender({
1341
- config,
1341
+ config: config.kit,
1342
1342
  entries: options.manifest_data.routes
1343
1343
  .map((route) => (route.type === 'page' ? route.path : ''))
1344
1344
  .filter(Boolean),
@@ -15556,7 +15556,7 @@ async function build(config, cwd = process.cwd()) {
15556
15556
  mkdirp(dir);
15557
15557
 
15558
15558
  // Make sure generated tsconfig is up-to-date
15559
- write_tsconfig(config, cwd);
15559
+ write_tsconfig(config.kit, cwd);
15560
15560
 
15561
15561
  const files = scan(config);
15562
15562
 
@@ -42,6 +42,7 @@ const cwd = process.cwd();
42
42
  * @return {import('vite').Plugin}
43
43
  */
44
44
  const sveltekit = function (svelte_config) {
45
+ const kit_config = svelte_config.kit;
45
46
  return {
46
47
  name: 'vite-plugin-svelte-kit',
47
48
 
@@ -52,9 +53,9 @@ const sveltekit = function (svelte_config) {
52
53
  fs: {
53
54
  allow: [
54
55
  ...new Set([
55
- svelte_config.kit.files.lib,
56
- svelte_config.kit.files.routes,
57
- svelte_config.kit.outDir,
56
+ kit_config.files.lib,
57
+ kit_config.files.routes,
58
+ kit_config.outDir,
58
59
  path__default.resolve(cwd, 'src'),
59
60
  path__default.resolve(cwd, 'node_modules'),
60
61
  path__default.resolve(searchForWorkspaceRoot(cwd), 'node_modules')
@@ -64,14 +65,11 @@ const sveltekit = function (svelte_config) {
64
65
  port: 3000,
65
66
  strictPort: true,
66
67
  watch: {
67
- ignored: [
68
- `${svelte_config.kit.outDir}/**`,
69
- `!${svelte_config.kit.outDir}/generated/**`
70
- ]
68
+ ignored: [`${kit_config.outDir}/**`, `!${kit_config.outDir}/generated/**`]
71
69
  }
72
70
  }
73
71
  },
74
- await svelte_config.kit.vite()
72
+ await kit_config.vite()
75
73
  );
76
74
 
77
75
  /** @type {[any, string[]]} */
@@ -79,13 +77,13 @@ const sveltekit = function (svelte_config) {
79
77
  configFile: false,
80
78
  root: cwd,
81
79
  resolve: {
82
- alias: get_aliases(svelte_config)
80
+ alias: get_aliases(kit_config)
83
81
  },
84
82
  build: {
85
83
  rollupOptions: {
86
84
  // Vite dependency crawler needs an explicit JS entry point
87
85
  // eventhough server otherwise works without it
88
- input: `${get_runtime_path(svelte_config)}/client/start.js`
86
+ input: `${get_runtime_path(kit_config)}/client/start.js`
89
87
  }
90
88
  },
91
89
  base: '/'
@@ -101,7 +99,7 @@ const sveltekit = function (svelte_config) {
101
99
 
102
100
  init(svelte_config);
103
101
 
104
- const runtime = get_runtime_path(svelte_config);
102
+ const runtime = get_runtime_path(kit_config);
105
103
 
106
104
  process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = '0';
107
105
 
@@ -115,7 +113,7 @@ const sveltekit = function (svelte_config) {
115
113
  const { manifest_data } = update(svelte_config);
116
114
 
117
115
  manifest = {
118
- appDir: svelte_config.kit.appDir,
116
+ appDir: kit_config.appDir,
119
117
  assets: new Set(manifest_data.assets.map((asset) => asset.file)),
120
118
  mimeTypes: get_mime_lookup(manifest_data),
121
119
  _: {
@@ -235,16 +233,14 @@ const sveltekit = function (svelte_config) {
235
233
 
236
234
  for (const event of ['add', 'unlink']) {
237
235
  vite.watcher.on(event, (file) => {
238
- if (file.startsWith(svelte_config.kit.files.routes + path__default.sep)) {
236
+ if (file.startsWith(kit_config.files.routes + path__default.sep)) {
239
237
  update_manifest();
240
238
  }
241
239
  });
242
240
  }
243
241
 
244
- const assets = svelte_config.kit.paths.assets
245
- ? SVELTE_KIT_ASSETS
246
- : svelte_config.kit.paths.base;
247
- const asset_server = sirv(svelte_config.kit.files.assets, {
242
+ const assets = kit_config.paths.assets ? SVELTE_KIT_ASSETS : kit_config.paths.base;
243
+ const asset_server = sirv(kit_config.files.assets, {
248
244
  dev: true,
249
245
  etag: true,
250
246
  maxAge: 0,
@@ -168,7 +168,7 @@ const DEFAULT = 'default';
168
168
  */
169
169
  function create_manifest_data({
170
170
  config,
171
- fallback = `${get_runtime_path(config)}/components`,
171
+ fallback = `${get_runtime_path(config.kit)}/components`,
172
172
  cwd = process.cwd()
173
173
  }) {
174
174
  /** @type {import('types').RouteData[]} */
@@ -829,7 +829,7 @@ function write_types(config, manifest_data) {
829
829
  /** @param {import('types').ValidatedConfig} config */
830
830
  function init(config) {
831
831
  copy_assets(path__default.join(config.kit.outDir, 'runtime'));
832
- write_tsconfig(config);
832
+ write_tsconfig(config.kit);
833
833
  }
834
834
 
835
835
  /** @param {import('types').ValidatedConfig} config */
@@ -36,9 +36,9 @@ function trim(str) {
36
36
  /** @param {string} file */
37
37
  const exists = (file) => fs__default.existsSync(file) && file;
38
38
 
39
- /** @param {import('types').ValidatedConfig} config */
39
+ /** @param {import('types').ValidatedKitConfig} config */
40
40
  function write_tsconfig(config, cwd = process.cwd()) {
41
- const out = path__default.join(config.kit.outDir, 'tsconfig.json');
41
+ const out = path__default.join(config.outDir, 'tsconfig.json');
42
42
  const user_file =
43
43
  exists(path__default.resolve(cwd, 'tsconfig.json')) || exists(path__default.resolve(cwd, 'jsconfig.json'));
44
44
 
@@ -48,11 +48,11 @@ function write_tsconfig(config, cwd = process.cwd()) {
48
48
  const project_relative = (file) => posixify(path__default.relative('.', file));
49
49
 
50
50
  /** @param {string} file */
51
- const config_relative = (file) => posixify(path__default.relative(config.kit.outDir, file));
51
+ const config_relative = (file) => posixify(path__default.relative(config.outDir, file));
52
52
 
53
53
  const dirs = new Set([
54
- project_relative(path__default.dirname(config.kit.files.routes)),
55
- project_relative(path__default.dirname(config.kit.files.lib))
54
+ project_relative(path__default.dirname(config.files.routes)),
55
+ project_relative(path__default.dirname(config.files.lib))
56
56
  ]);
57
57
 
58
58
  /** @type {string[]} */
@@ -66,8 +66,8 @@ function write_tsconfig(config, cwd = process.cwd()) {
66
66
  /** @type {Record<string, string[]>} */
67
67
  const paths = {};
68
68
  const alias = {
69
- $lib: project_relative(config.kit.files.lib),
70
- ...config.kit.alias
69
+ $lib: project_relative(config.files.lib),
70
+ ...config.alias
71
71
  };
72
72
  for (const [key, value] of Object.entries(alias)) {
73
73
  if (fs__default.existsSync(project_relative(value))) {
@@ -113,7 +113,7 @@ function write_tsconfig(config, cwd = process.cwd()) {
113
113
  }
114
114
 
115
115
  /**
116
- * @param {import('types').ValidatedConfig} config
116
+ * @param {import('types').ValidatedKitConfig} config
117
117
  * @param {string} cwd
118
118
  * @param {string} out
119
119
  * @param {string} user_file
@@ -132,17 +132,15 @@ function validate(config, cwd, out, user_file) {
132
132
  if (extends_framework_config) {
133
133
  const { paths: user_paths } = user_tsconfig.compilerOptions || {};
134
134
 
135
- if (user_paths && fs__default.existsSync(config.kit.files.lib)) {
135
+ if (user_paths && fs__default.existsSync(config.files.lib)) {
136
136
  /** @type {string[]} */
137
137
  const lib = user_paths['$lib'] || [];
138
138
  /** @type {string[]} */
139
139
  const lib_ = user_paths['$lib/*'] || [];
140
140
 
141
141
  const missing_lib_paths =
142
- !lib.some((relative) => path__default.resolve(cwd, relative) === config.kit.files.lib) ||
143
- !lib_.some(
144
- (relative) => path__default.resolve(cwd, relative) === path__default.join(config.kit.files.lib, '/*')
145
- );
142
+ !lib.some((relative) => path__default.resolve(cwd, relative) === config.files.lib) ||
143
+ !lib_.some((relative) => path__default.resolve(cwd, relative) === path__default.join(config.files.lib, '/*'));
146
144
 
147
145
  if (missing_lib_paths) {
148
146
  console.warn(
@@ -150,7 +148,7 @@ function validate(config, cwd, out, user_file) {
150
148
  .bold()
151
149
  .yellow(`Your compilerOptions.paths in ${kind} should include the following:`)
152
150
  );
153
- const relative = posixify(path__default.relative('.', config.kit.files.lib));
151
+ const relative = posixify(path__default.relative('.', config.files.lib));
154
152
  console.warn(`{\n "$lib":["${relative}"],\n "$lib/*":["${relative}/*"]\n}`);
155
153
  }
156
154
  }
package/dist/cli.js CHANGED
@@ -218,8 +218,8 @@ async function blame(port) {
218
218
  }
219
219
  }
220
220
 
221
- const get_runtime_path = /** @param {import('types').ValidatedConfig} config */ (config) =>
222
- posixify_path(path__default.join(config.kit.outDir, 'runtime'))
221
+ const get_runtime_path = /** @param {import('types').ValidatedKitConfig} config */ (config) =>
222
+ posixify_path(path__default.join(config.outDir, 'runtime'))
223
223
  ;
224
224
 
225
225
  /** @param {string} str */
@@ -292,19 +292,19 @@ function get_mime_lookup(manifest_data) {
292
292
  return mime;
293
293
  }
294
294
 
295
- /** @param {import('types').ValidatedConfig} config */
295
+ /** @param {import('types').ValidatedKitConfig} config */
296
296
  function get_aliases(config) {
297
297
  /** @type {Record<string, string>} */
298
298
  const alias = {
299
- __GENERATED__: path__default.posix.join(config.kit.outDir, 'generated'),
299
+ __GENERATED__: path__default.posix.join(config.outDir, 'generated'),
300
300
  $app: `${get_runtime_path(config)}/app`,
301
301
 
302
302
  // For now, we handle `$lib` specially here rather than make it a default value for
303
303
  // `config.kit.alias` since it has special meaning for packaging, etc.
304
- $lib: config.kit.files.lib
304
+ $lib: config.files.lib
305
305
  };
306
306
 
307
- for (const [key, value] of Object.entries(config.kit.alias)) {
307
+ for (const [key, value] of Object.entries(config.alias)) {
308
308
  alias[key] = path__default.resolve(value);
309
309
  }
310
310
 
@@ -908,7 +908,7 @@ async function launch(port, https, base) {
908
908
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
909
909
  }
910
910
 
911
- const prog = sade('svelte-kit').version('1.0.0-next.347');
911
+ const prog = sade('svelte-kit').version('1.0.0-next.348');
912
912
 
913
913
  prog
914
914
  .command('dev')
@@ -1149,7 +1149,7 @@ async function check_port(port) {
1149
1149
  function welcome({ port, host, https, open, base, loose, allow, cwd }) {
1150
1150
  if (open) launch(port, https, base);
1151
1151
 
1152
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.347'}\n`));
1152
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.348'}\n`));
1153
1153
 
1154
1154
  const protocol = https ? 'https:' : 'http:';
1155
1155
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.347",
3
+ "version": "1.0.0-next.348",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -106,7 +106,7 @@ declare module '$app/navigation' {
106
106
  opts?: { replaceState?: boolean; noscroll?: boolean; keepfocus?: boolean; state?: any }
107
107
  ): Promise<void>;
108
108
  /**
109
- * Causes any `load` functions belonging to the currently active page to re-run if they `fetch` the resource in question. Returns a `Promise` that resolves when the page is subsequently updated.
109
+ * Causes any `load` functions belonging to the currently active page to re-run if they `fetch` the resource in question, or re-fetches data from a page endpoint if the invalidated resource is the page itself. Returns a `Promise` that resolves when the page is subsequently updated.
110
110
  * @param dependency The invalidated resource
111
111
  */
112
112
  export function invalidate(dependency: string | ((href: string) => boolean)): Promise<void>;
package/types/index.d.ts CHANGED
@@ -91,68 +91,70 @@ export interface Builder {
91
91
  export interface Config {
92
92
  compilerOptions?: CompileOptions;
93
93
  extensions?: string[];
94
- kit?: {
95
- adapter?: Adapter;
96
- alias?: Record<string, string>;
97
- appDir?: string;
98
- browser?: {
99
- hydrate?: boolean;
100
- router?: boolean;
101
- };
102
- csp?: {
103
- mode?: 'hash' | 'nonce' | 'auto';
104
- directives?: CspDirectives;
105
- };
106
- endpointExtensions?: string[];
107
- files?: {
108
- assets?: string;
109
- hooks?: string;
110
- lib?: string;
111
- params?: string;
112
- routes?: string;
113
- serviceWorker?: string;
114
- template?: string;
115
- };
116
- floc?: boolean;
117
- inlineStyleThreshold?: number;
118
- methodOverride?: {
119
- parameter?: string;
120
- allowed?: string[];
121
- };
122
- outDir?: string;
123
- package?: {
124
- dir?: string;
125
- emitTypes?: boolean;
126
- exports?(filepath: string): boolean;
127
- files?(filepath: string): boolean;
128
- };
129
- paths?: {
130
- assets?: string;
131
- base?: string;
132
- };
133
- prerender?: {
134
- concurrency?: number;
135
- crawl?: boolean;
136
- default?: boolean;
137
- enabled?: boolean;
138
- entries?: Array<'*' | `/${string}`>;
139
- onError?: PrerenderOnErrorValue;
140
- };
141
- routes?: (filepath: string) => boolean;
142
- serviceWorker?: {
143
- register?: boolean;
144
- files?: (filepath: string) => boolean;
145
- };
146
- trailingSlash?: TrailingSlash;
147
- version?: {
148
- name?: string;
149
- pollInterval?: number;
150
- };
151
- vite?: import('vite').UserConfig | (() => MaybePromise<import('vite').UserConfig>);
152
- };
94
+ kit?: KitConfig;
153
95
  preprocess?: any;
154
96
  }
155
97
 
98
+ export interface KitConfig {
99
+ adapter?: Adapter;
100
+ alias?: Record<string, string>;
101
+ appDir?: string;
102
+ browser?: {
103
+ hydrate?: boolean;
104
+ router?: boolean;
105
+ };
106
+ csp?: {
107
+ mode?: 'hash' | 'nonce' | 'auto';
108
+ directives?: CspDirectives;
109
+ };
110
+ endpointExtensions?: string[];
111
+ files?: {
112
+ assets?: string;
113
+ hooks?: string;
114
+ lib?: string;
115
+ params?: string;
116
+ routes?: string;
117
+ serviceWorker?: string;
118
+ template?: string;
119
+ };
120
+ floc?: boolean;
121
+ inlineStyleThreshold?: number;
122
+ methodOverride?: {
123
+ parameter?: string;
124
+ allowed?: string[];
125
+ };
126
+ outDir?: string;
127
+ package?: {
128
+ dir?: string;
129
+ emitTypes?: boolean;
130
+ exports?(filepath: string): boolean;
131
+ files?(filepath: string): boolean;
132
+ };
133
+ paths?: {
134
+ assets?: string;
135
+ base?: string;
136
+ };
137
+ prerender?: {
138
+ concurrency?: number;
139
+ crawl?: boolean;
140
+ default?: boolean;
141
+ enabled?: boolean;
142
+ entries?: Array<'*' | `/${string}`>;
143
+ onError?: PrerenderOnErrorValue;
144
+ };
145
+ routes?: (filepath: string) => boolean;
146
+ serviceWorker?: {
147
+ register?: boolean;
148
+ files?: (filepath: string) => boolean;
149
+ };
150
+ trailingSlash?: TrailingSlash;
151
+ version?: {
152
+ name?: string;
153
+ pollInterval?: number;
154
+ };
155
+ vite?: import('vite').UserConfig | (() => MaybePromise<import('vite').UserConfig>);
156
+ }
157
+
156
158
  export interface ExternalFetch {
157
159
  (req: Request): Promise<Response>;
158
160
  }
@@ -5,6 +5,7 @@ import {
5
5
  GetSession,
6
6
  Handle,
7
7
  HandleError,
8
+ KitConfig,
8
9
  Load,
9
10
  RequestEvent,
10
11
  RequestHandler,
@@ -319,5 +320,7 @@ export type StrictBody = string | Uint8Array;
319
320
 
320
321
  export type ValidatedConfig = RecursiveRequired<Config>;
321
322
 
323
+ export type ValidatedKitConfig = RecursiveRequired<KitConfig>;
324
+
322
325
  export * from './index';
323
326
  export * from './private';