@sveltejs/kit 1.0.0-next.328 → 1.0.0-next.329

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.
@@ -996,8 +996,10 @@ function create_client({ target, session, base, trailing_slash }) {
996
996
  /** @type {Error | null} */
997
997
  let error = null;
998
998
 
999
- // preload modules
1000
- a.forEach((loader) => loader());
999
+ // preload modules to avoid waterfall, but handle rejections
1000
+ // so they don't get reported to Sentry et al (we don't need
1001
+ // to act on the failures at this point)
1002
+ a.forEach((loader) => loader().catch(() => {}));
1001
1003
 
1002
1004
  load: for (let i = 0; i < a.length; i += 1) {
1003
1005
  /** @type {import('./types').BranchNode | undefined} */
@@ -26,6 +26,10 @@ import 'node:url';
26
26
  import './write_tsconfig.js';
27
27
  import 'stream';
28
28
 
29
+ // Vite doesn't expose this so we just copy the list for now
30
+ // https://github.com/vitejs/vite/blob/3edd1af56e980aef56641a5a51cf2932bb580d41/packages/vite/src/node/plugins/css.ts#L96
31
+ const style_pattern = /\.(css|less|sass|scss|styl|stylus|pcss|postcss)$/;
32
+
29
33
  /**
30
34
  * @param {import('types').ValidatedConfig} config
31
35
  * @param {string} cwd
@@ -90,9 +94,8 @@ async function create_plugin(config, cwd) {
90
94
  const parsed = new URL(dep.url, 'http://localhost/');
91
95
  const query = parsed.searchParams;
92
96
 
93
- // TODO what about .scss files, etc?
94
97
  if (
95
- dep.file.endsWith('.css') ||
98
+ style_pattern.test(dep.file) ||
96
99
  (query.has('svelte') && query.get('type') === 'style')
97
100
  ) {
98
101
  try {
@@ -749,7 +749,7 @@ import type { ${imports} } from '@sveltejs/kit';`;
749
749
 
750
750
  /** @param {string} arg */
751
751
  const endpoint = (arg) => `
752
- export type RequestHandler<Output extends ResponseBody = ResponseBody> = GenericRequestHandler<${arg}, Output>;`;
752
+ export type RequestHandler<Output = ResponseBody> = GenericRequestHandler<${arg}, Output>;`;
753
753
 
754
754
  /** @param {string} arg */
755
755
  const page = (arg) => `
package/dist/cli.js CHANGED
@@ -870,7 +870,7 @@ async function launch(port, https, base) {
870
870
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
871
871
  }
872
872
 
873
- const prog = sade('svelte-kit').version('1.0.0-next.328');
873
+ const prog = sade('svelte-kit').version('1.0.0-next.329');
874
874
 
875
875
  prog
876
876
  .command('dev')
@@ -1049,7 +1049,7 @@ async function check_port(port) {
1049
1049
  function welcome({ port, host, https, open, base, loose, allow, cwd }) {
1050
1050
  if (open) launch(port, https, base);
1051
1051
 
1052
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.328'}\n`));
1052
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.329'}\n`));
1053
1053
 
1054
1054
  const protocol = https ? 'https:' : 'http:';
1055
1055
  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.328",
3
+ "version": "1.0.0-next.329",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
package/types/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import './ambient';
6
6
  import { CompileOptions } from 'svelte/types/compiler/interfaces';
7
7
  import {
8
8
  AdapterEntry,
9
+ BodyValidator,
9
10
  CspDirectives,
10
11
  JSONValue,
11
12
  Logger,
@@ -136,7 +137,7 @@ export interface Config {
136
137
  crawl?: boolean;
137
138
  default?: boolean;
138
139
  enabled?: boolean;
139
- entries?: string[];
140
+ entries?: Array<'*' | `/${string}`>;
140
141
  onError?: PrerenderOnErrorValue;
141
142
  };
142
143
  routes?: (filepath: string) => boolean;
@@ -241,15 +242,15 @@ export interface ParamMatcher {
241
242
  */
242
243
  export interface RequestHandler<
243
244
  Params extends Record<string, string> = Record<string, string>,
244
- Output extends ResponseBody = ResponseBody
245
+ Output = ResponseBody
245
246
  > {
246
247
  (event: RequestEvent<Params>): MaybePromise<RequestHandlerOutput<Output>>;
247
248
  }
248
249
 
249
- export interface RequestHandlerOutput<Output extends ResponseBody = ResponseBody> {
250
+ export interface RequestHandlerOutput<Output = ResponseBody> {
250
251
  status?: number;
251
252
  headers?: Headers | Partial<ResponseHeaders>;
252
- body?: Output;
253
+ body?: Output extends ResponseBody ? Output : BodyValidator<Output>;
253
254
  }
254
255
 
255
256
  export type ResponseBody = JSONValue | Uint8Array | ReadableStream | import('stream').Readable;
@@ -26,6 +26,10 @@ export interface AdapterEntry {
26
26
  }) => MaybePromise<void>;
27
27
  }
28
28
 
29
+ export type BodyValidator<T> = {
30
+ [P in keyof T]: T[P] extends JSONValue ? BodyValidator<T[P]> : never;
31
+ };
32
+
29
33
  // Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts
30
34
  //
31
35
  // MIT License