Skip to content

Commit f95e5c4

Browse files
authored
make manifest.mimeTypes part of the public API (#4302)
* make manifest.mime part of the public API * change mime to mimeTypes * update changeset
1 parent 03c29de commit f95e5c4

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

.changeset/early-pants-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
Make `manifest.mimeTypes` part of the public API

packages/kit/src/core/dev/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export async function create_plugin(config, cwd) {
4949
manifest = {
5050
appDir: config.kit.appDir,
5151
assets: new Set(manifest_data.assets.map((asset) => asset.file)),
52+
mimeTypes: get_mime_lookup(manifest_data),
5253
_: {
53-
mime: get_mime_lookup(manifest_data),
5454
entry: {
5555
file: `/@fs${runtime}/client/start.js`,
5656
css: [],

packages/kit/src/core/generate_manifest/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export function generate_manifest({ build_data, relative_path, routes, format =
5858
return `{
5959
appDir: ${s(build_data.app_dir)},
6060
assets: new Set(${s(assets)}),
61+
mimeTypes: ${s(get_mime_lookup(build_data.manifest_data))},
6162
_: {
62-
mime: ${s(get_mime_lookup(build_data.manifest_data))},
6363
entry: ${s(build_data.client.entry)},
6464
nodes: [
6565
${Array.from(bundled_nodes.values()).map(node => importer(node.path)).join(',\n\t\t\t\t')}

packages/kit/src/runtime/server/page/load_node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export async function load_node({
155155

156156
if (options.read) {
157157
const type = is_asset
158-
? options.manifest._.mime[filename.slice(filename.lastIndexOf('.'))]
158+
? options.manifest.mimeTypes[filename.slice(filename.lastIndexOf('.'))]
159159
: 'text/html';
160160

161161
response = new Response(options.read(file), {

packages/kit/types/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,10 @@ export class Server {
241241
export interface SSRManifest {
242242
appDir: string;
243243
assets: Set<string>;
244+
mimeTypes: Record<string, string>;
245+
244246
/** private fields */
245247
_: {
246-
mime: Record<string, string>;
247248
entry: {
248249
file: string;
249250
js: string[];

0 commit comments

Comments
 (0)