@sveltejs/kit 1.0.0-next.489 → 1.0.0-next.490
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/package.json
CHANGED
|
@@ -68,7 +68,7 @@ export async function write_types(config, manifest_data, file) {
|
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const id = path.
|
|
71
|
+
const id = posixify(path.relative(config.kit.files.routes, path.dirname(file)));
|
|
72
72
|
|
|
73
73
|
const route = manifest_data.routes.find((route) => route.id === id);
|
|
74
74
|
if (!route) return; // this shouldn't ever happen
|
|
@@ -70,21 +70,18 @@ export function allowed_methods(mod) {
|
|
|
70
70
|
|
|
71
71
|
/** @param {any} data */
|
|
72
72
|
export function data_response(data) {
|
|
73
|
+
const headers = {
|
|
74
|
+
'content-type': 'application/javascript',
|
|
75
|
+
'cache-control': 'private, no-store'
|
|
76
|
+
};
|
|
77
|
+
|
|
73
78
|
try {
|
|
74
|
-
return new Response(`window.__sveltekit_data = ${devalue(data)}`, {
|
|
75
|
-
headers: {
|
|
76
|
-
'content-type': 'application/javascript'
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
+
return new Response(`window.__sveltekit_data = ${devalue(data)}`, { headers });
|
|
79
80
|
} catch (e) {
|
|
80
81
|
const error = /** @type {any} */ (e);
|
|
81
82
|
const match = /\[(\d+)\]\.data\.(.+)/.exec(error.path);
|
|
82
83
|
const message = match ? `${error.message} (data.${match[2]})` : error.message;
|
|
83
|
-
return new Response(`throw new Error(${JSON.stringify(message)})`, {
|
|
84
|
-
headers: {
|
|
85
|
-
'content-type': 'application/javascript'
|
|
86
|
-
}
|
|
87
|
-
});
|
|
84
|
+
return new Response(`throw new Error(${JSON.stringify(message)})`, { headers });
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
|