@sveltejs/kit 2.8.3 → 2.8.5
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
|
@@ -21,6 +21,8 @@ import { check_feature } from '../../../utils/features.js';
|
|
|
21
21
|
import { escape_html } from '../../../utils/escape.js';
|
|
22
22
|
|
|
23
23
|
const cwd = process.cwd();
|
|
24
|
+
// vite-specifc queries that we should skip handling for css urls
|
|
25
|
+
const vite_css_query_regex = /(?:\?|&)(?:raw|url|inline)(?:&|$)/;
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* @param {import('vite').ViteDevServer} vite
|
|
@@ -188,6 +190,7 @@ export async function dev(vite, vite_config, svelte_config) {
|
|
|
188
190
|
// in dev we inline all styles to avoid FOUC. this gets populated lazily so that
|
|
189
191
|
// components/stylesheets loaded via import() during `load` are included
|
|
190
192
|
result.inline_styles = async () => {
|
|
193
|
+
/** @type {Set<import('vite').ModuleNode>} */
|
|
191
194
|
const deps = new Set();
|
|
192
195
|
|
|
193
196
|
for (const module_node of module_nodes) {
|
|
@@ -198,19 +201,12 @@ export async function dev(vite, vite_config, svelte_config) {
|
|
|
198
201
|
const styles = {};
|
|
199
202
|
|
|
200
203
|
for (const dep of deps) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
(isCSSRequest(dep.file) ||
|
|
206
|
-
(query.has('svelte') && query.get('type') === 'style')) &&
|
|
207
|
-
!(query.has('raw') || query.has('url') || query.has('inline'))
|
|
208
|
-
) {
|
|
204
|
+
if (isCSSRequest(dep.url) && !vite_css_query_regex.test(dep.url)) {
|
|
205
|
+
const inlineCssUrl = dep.url.includes('?')
|
|
206
|
+
? dep.url.replace('?', '?inline&')
|
|
207
|
+
: dep.url + '?inline';
|
|
209
208
|
try {
|
|
210
|
-
|
|
211
|
-
const mod = await vite.ssrLoadModule(
|
|
212
|
-
`${decodeURI(url.pathname)}${url.search}${url.hash}`
|
|
213
|
-
);
|
|
209
|
+
const mod = await vite.ssrLoadModule(inlineCssUrl);
|
|
214
210
|
styles[dep.url] = mod.default;
|
|
215
211
|
} catch {
|
|
216
212
|
// this can happen with dynamically imported modules, I think
|
|
@@ -2358,6 +2358,7 @@ async function _hydrate(
|
|
|
2358
2358
|
|
|
2359
2359
|
/** @type {import('./types.js').NavigationFinished | undefined} */
|
|
2360
2360
|
let result;
|
|
2361
|
+
let hydrate = true;
|
|
2361
2362
|
|
|
2362
2363
|
try {
|
|
2363
2364
|
const branch_promises = node_ids.map(async (n, i) => {
|
|
@@ -2422,13 +2423,16 @@ async function _hydrate(
|
|
|
2422
2423
|
url,
|
|
2423
2424
|
route
|
|
2424
2425
|
});
|
|
2426
|
+
|
|
2427
|
+
target.textContent = '';
|
|
2428
|
+
hydrate = false;
|
|
2425
2429
|
}
|
|
2426
2430
|
|
|
2427
2431
|
if (result.props.page) {
|
|
2428
2432
|
result.props.page.state = {};
|
|
2429
2433
|
}
|
|
2430
2434
|
|
|
2431
|
-
initialize(result, target,
|
|
2435
|
+
initialize(result, target, hydrate);
|
|
2432
2436
|
}
|
|
2433
2437
|
|
|
2434
2438
|
/**
|
package/src/version.js
CHANGED