Skip to content

[chore] cleanup a few types #2677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions packages/kit/src/core/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ import { copy_assets, posixify, resolve_entry } from '../utils.js';
/** @param {any} value */
const s = (value) => JSON.stringify(value);

/** @typedef {Record<string, {
* file: string;
* css: string[];
* imports: string[];
* }>} ClientManifest */

/**
* @param {import('types/config').ValidatedConfig} config
* @param {{
Expand Down Expand Up @@ -113,7 +107,6 @@ async function build_client({
process.env.VITE_SVELTEKIT_AMP = config.kit.amp ? 'true' : '';

const client_out_dir = `${output_dir}/client/${config.kit.appDir}`;
const client_manifest_file = `${client_out_dir}/manifest.json`;

/** @type {Record<string, string>} */
const input = {
Expand Down Expand Up @@ -188,7 +181,8 @@ async function build_client({

await vite.build(merged_config);

/** @type {ClientManifest} */
const client_manifest_file = `${client_out_dir}/manifest.json`;
/** @type {import('vite').Manifest} */
const client_manifest = JSON.parse(fs.readFileSync(client_manifest_file, 'utf-8'));
fs.renameSync(client_manifest_file, `${output_dir}/manifest.json`); // inspectable but not shipped

Expand All @@ -206,7 +200,7 @@ async function build_client({
* client_entry_file: string;
* service_worker_entry_file: string | null;
* }} options
* @param {ClientManifest} client_manifest
* @param {import('vite').Manifest} client_manifest
* @param {string} runtime
*/
async function build_server(
Expand Down Expand Up @@ -512,7 +506,7 @@ async function build_server(
* client_entry_file: string;
* service_worker_entry_file: string | null;
* }} options
* @param {ClientManifest} client_manifest
* @param {import('vite').Manifest} client_manifest
*/
async function build_service_worker(
{ cwd, assets_base, config, manifest, build_dir, output_dir, service_worker_entry_file },
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/types/ambient-modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ declare module '@sveltejs/kit/ssr' {
type State = import('@sveltejs/kit/types/internal').SSRRenderState;

export interface Respond {
(incoming: IncomingRequest, options: Options, state?: State): Response;
(incoming: IncomingRequest, options: Options, state?: State): Promise<Response>;
}
export const respond: Respond;
}
Expand Down
6 changes: 5 additions & 1 deletion packages/kit/types/internal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@ export interface Hooks {

export interface SSRNode {
module: SSRComponent;
entry: string; // client-side module corresponding to this component
/** client-side module URL for this component */
entry: string;
/** external CSS files */
css: string[];
/** external JS files */
js: string[];
/** inlined styles */
styles: string[];
}

Expand Down