MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / handleCssUpdates

Function handleCssUpdates

packages/vite/hmr/client/css-handler.ts:45–67  ·  view source on GitHub ↗
(cssUpdates: any[], httpOrigin: string)

Source from the content-addressed store, hash-verified

43
44// Handle CSS updates from Vite
45export async function handleCssUpdates(cssUpdates: any[], httpOrigin: string): Promise<void> {
46 for (const update of cssUpdates) {
47 try {
48 const path = update.path || update.acceptedPath || '';
49 if (!path || !httpOrigin) continue;
50
51 // Compose URL like the Vite client (ensure raw content and cache-bust)
52 const hasQuery = path.includes('?');
53 const tParam = `t=${encodeURIComponent(String(update.timestamp || Date.now()))}`;
54 const directParam = hasQuery ? '&direct=1' : '?direct=1';
55 const tSuffix = (hasQuery ? '&' : '?') + tParam;
56 const url = httpOrigin + path + directParam + tSuffix;
57
58 if (VERBOSE) console.info('[ns-hmr] Fetching CSS:', url);
59 const cssText = await fetchText(url);
60 if (cssText) {
61 applyCssText(cssText);
62 }
63 } catch (e) {
64 console.warn('[ns-hmr] CSS update fetch/apply failed:', e?.message || String(e));
65 }
66 }
67}
68
69// Handle custom CSS events
70export function handleCustomCss(cssText: string): void {

Callers 1

handleHmrMessageFunction · 0.85

Calls 6

fetchTextFunction · 0.85
applyCssTextFunction · 0.85
includesMethod · 0.80
infoMethod · 0.80
warnMethod · 0.80
StringClass · 0.50

Tested by

no test coverage detected