@sveltejs/kit 1.0.0-next.244 → 1.0.0-next.245
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/assets/server/index.js +2 -1
- package/dist/chunks/index.js +4 -2
- package/dist/chunks/index3.js +2 -5
- package/dist/cli.js +2 -2
- package/package.json +1 -1
- package/types/app.d.ts +7 -3
- package/types/endpoint.d.ts +6 -2
- package/types/hooks.d.ts +11 -6
- package/types/internal.d.ts +1 -0
package/assets/server/index.js
CHANGED
package/dist/chunks/index.js
CHANGED
|
@@ -2081,7 +2081,8 @@ async function respond(request, options, state = {}) {
|
|
|
2081
2081
|
request,
|
|
2082
2082
|
url,
|
|
2083
2083
|
params: {},
|
|
2084
|
-
locals: {}
|
|
2084
|
+
locals: {},
|
|
2085
|
+
platform: state.platform
|
|
2085
2086
|
};
|
|
2086
2087
|
|
|
2087
2088
|
// TODO remove this for 1.0
|
|
@@ -2383,7 +2384,6 @@ async function create_plugin(config, cwd) {
|
|
|
2383
2384
|
vite.middlewares.use(async (req, res) => {
|
|
2384
2385
|
try {
|
|
2385
2386
|
if (!req.url || !req.method) throw new Error('Incomplete request');
|
|
2386
|
-
if (req.url === '/favicon.ico') return not_found(res);
|
|
2387
2387
|
|
|
2388
2388
|
const base = `${vite.config.server.https ? 'https' : 'http'}://${req.headers.host}`;
|
|
2389
2389
|
|
|
@@ -2400,6 +2400,8 @@ async function create_plugin(config, cwd) {
|
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
2402
|
|
|
2403
|
+
if (req.url === '/favicon.ico') return not_found(res);
|
|
2404
|
+
|
|
2403
2405
|
if (!decoded.startsWith(config.kit.paths.base)) return not_found(res);
|
|
2404
2406
|
|
|
2405
2407
|
/** @type {Partial<import('types/internal').Hooks>} */
|
package/dist/chunks/index3.js
CHANGED
|
@@ -326,14 +326,12 @@ export class App {
|
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
render(request, {
|
|
330
|
-
prerender
|
|
331
|
-
} = {}) {
|
|
329
|
+
render(request, options = {}) {
|
|
332
330
|
if (!(request instanceof Request)) {
|
|
333
331
|
throw new Error('The first argument to app.render must be a Request object. See https://github.com/sveltejs/kit/pull/3384 for details');
|
|
334
332
|
}
|
|
335
333
|
|
|
336
|
-
return respond(request, this.options,
|
|
334
|
+
return respond(request, this.options, options);
|
|
337
335
|
}
|
|
338
336
|
}
|
|
339
337
|
`;
|
|
@@ -402,7 +400,6 @@ async function build_server(
|
|
|
402
400
|
return relative_file[0] === '.' ? relative_file : `./${relative_file}`;
|
|
403
401
|
};
|
|
404
402
|
|
|
405
|
-
// prettier-ignore
|
|
406
403
|
fs__default.writeFileSync(
|
|
407
404
|
input.app,
|
|
408
405
|
app_template({
|
package/dist/cli.js
CHANGED
|
@@ -986,7 +986,7 @@ async function launch(port, https) {
|
|
|
986
986
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
987
987
|
}
|
|
988
988
|
|
|
989
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
989
|
+
const prog = sade('svelte-kit').version('1.0.0-next.245');
|
|
990
990
|
|
|
991
991
|
prog
|
|
992
992
|
.command('dev')
|
|
@@ -1138,7 +1138,7 @@ async function check_port(port) {
|
|
|
1138
1138
|
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
1139
1139
|
if (open) launch(port, https);
|
|
1140
1140
|
|
|
1141
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1141
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.245'}\n`));
|
|
1142
1142
|
|
|
1143
1143
|
const protocol = https ? 'https:' : 'http:';
|
|
1144
1144
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/package.json
CHANGED
package/types/app.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { PrerenderOptions, SSRNodeLoader, SSRRoute } from './internal';
|
|
2
2
|
|
|
3
|
+
export interface RequestOptions<Platform = Record<string, any>> {
|
|
4
|
+
platform?: Platform;
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
export class App {
|
|
4
8
|
constructor(manifest: SSRManifest);
|
|
5
|
-
render(request: Request): Promise<Response>;
|
|
9
|
+
render(request: Request, options?: RequestOptions): Promise<Response>;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export class InternalApp extends App {
|
|
9
13
|
render(
|
|
10
14
|
request: Request,
|
|
11
|
-
options?: {
|
|
12
|
-
prerender
|
|
15
|
+
options?: RequestOptions & {
|
|
16
|
+
prerender?: PrerenderOptions;
|
|
13
17
|
}
|
|
14
18
|
): Promise<Response>;
|
|
15
19
|
}
|
package/types/endpoint.d.ts
CHANGED
|
@@ -13,8 +13,12 @@ export interface Fallthrough {
|
|
|
13
13
|
fallthrough: true;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export interface RequestHandler<
|
|
17
|
-
|
|
16
|
+
export interface RequestHandler<
|
|
17
|
+
Locals = Record<string, any>,
|
|
18
|
+
Platform = Record<string, any>,
|
|
19
|
+
Output extends Body = Body
|
|
20
|
+
> {
|
|
21
|
+
(event: RequestEvent<Locals, Platform>): MaybePromise<
|
|
18
22
|
Either<Response | EndpointOutput<Output>, Fallthrough>
|
|
19
23
|
>;
|
|
20
24
|
}
|
package/types/hooks.d.ts
CHANGED
|
@@ -2,25 +2,30 @@ import { MaybePromise } from './helper';
|
|
|
2
2
|
|
|
3
3
|
export type StrictBody = string | Uint8Array;
|
|
4
4
|
|
|
5
|
-
export interface RequestEvent<Locals = Record<string, any>> {
|
|
5
|
+
export interface RequestEvent<Locals = Record<string, any>, Platform = Record<string, any>> {
|
|
6
6
|
request: Request;
|
|
7
7
|
url: URL;
|
|
8
8
|
params: Record<string, string>;
|
|
9
9
|
locals: Locals;
|
|
10
|
+
platform: Readonly<Platform>;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export interface GetSession<
|
|
13
|
-
|
|
13
|
+
export interface GetSession<
|
|
14
|
+
Locals = Record<string, any>,
|
|
15
|
+
Platform = Record<string, any>,
|
|
16
|
+
Session = any
|
|
17
|
+
> {
|
|
18
|
+
(event: RequestEvent<Locals, Platform>): MaybePromise<Session>;
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export interface ResolveOpts {
|
|
17
22
|
ssr?: boolean;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
export interface Handle<Locals = Record<string, any>> {
|
|
25
|
+
export interface Handle<Locals = Record<string, any>, Platform = Record<string, any>> {
|
|
21
26
|
(input: {
|
|
22
|
-
event: RequestEvent<Locals>;
|
|
23
|
-
resolve(event: RequestEvent<Locals>, opts?: ResolveOpts): MaybePromise<Response>;
|
|
27
|
+
event: RequestEvent<Locals, Platform>;
|
|
28
|
+
resolve(event: RequestEvent<Locals, Platform>, opts?: ResolveOpts): MaybePromise<Response>;
|
|
24
29
|
}): MaybePromise<Response>;
|
|
25
30
|
}
|
|
26
31
|
|