vite 2.9.0-beta.8 → 2.9.0-beta.9

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -189,6 +189,7 @@ const socketHost = __HMR_PORT__
189
189
  : `${__HMR_HOSTNAME__ || location.hostname}`;
190
190
  const socket = new WebSocket(`${socketProtocol}://${socketHost}`, 'vite-hmr');
191
191
  const base = __BASE__ || '/';
192
+ const messageBuffer = [];
192
193
  function warnFailedFetch(err, path) {
193
194
  if (!err.message.match('fetch')) {
194
195
  console.error(err);
@@ -211,9 +212,10 @@ async function handleMessage(payload) {
211
212
  switch (payload.type) {
212
213
  case 'connected':
213
214
  console.log(`[vite] connected.`);
215
+ sendMessageBuffer();
214
216
  // proxy(nginx, docker) hmr ws maybe caused timeout,
215
217
  // so send ping package let ws keep alive.
216
- setInterval(() => socket.send('ping'), __HMR_TIMEOUT__);
218
+ setInterval(() => socket.send('{"type":"ping"}'), __HMR_TIMEOUT__);
217
219
  break;
218
220
  case 'update':
219
221
  notifyListeners('vite:beforeUpdate', payload);
@@ -454,6 +456,12 @@ async function fetchUpdate({ path, acceptedPath, timestamp }) {
454
456
  console.log(`[vite] hot updated: ${loggedPath}`);
455
457
  };
456
458
  }
459
+ function sendMessageBuffer() {
460
+ if (socket.readyState === 1) {
461
+ messageBuffer.forEach((msg) => socket.send(msg));
462
+ messageBuffer.length = 0;
463
+ }
464
+ }
457
465
  const hotModulesMap = new Map();
458
466
  const disposeMap = new Map();
459
467
  const pruneMap = new Map();
@@ -542,6 +550,10 @@ const createHotContext = (ownerPath) => {
542
550
  };
543
551
  addToMap(customListenersMap);
544
552
  addToMap(newListeners);
553
+ },
554
+ send: (event, data) => {
555
+ messageBuffer.push(JSON.stringify({ type: 'custom', event, data }));
556
+ sendMessageBuffer();
545
557
  }
546
558
  };
547
559
  return hot;
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","sources":["../../src/client/overlay.ts","../../src/client/client.ts"],"sourcesContent":["import type { ErrorPayload } from 'types/hmrPayload'\n\nconst template = /*html*/ `\n<style>\n:host {\n position: fixed;\n z-index: 99999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n --monospace: 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --red: #ff5555;\n --yellow: #e2aa53;\n --purple: #cfa4ff;\n --cyan: #2dd9da;\n --dim: #c9c9c9;\n}\n\n.window {\n font-family: var(--monospace);\n line-height: 1.5;\n width: 800px;\n color: #d8d8d8;\n margin: 30px auto;\n padding: 25px 40px;\n position: relative;\n background: #181818;\n border-radius: 6px 6px 8px 8px;\n box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);\n overflow: hidden;\n border-top: 8px solid var(--red);\n direction: ltr;\n text-align: left;\n}\n\npre {\n font-family: var(--monospace);\n font-size: 16px;\n margin-top: 0;\n margin-bottom: 1em;\n overflow-x: scroll;\n scrollbar-width: none;\n}\n\npre::-webkit-scrollbar {\n display: none;\n}\n\n.message {\n line-height: 1.3;\n font-weight: 600;\n white-space: pre-wrap;\n}\n\n.message-body {\n color: var(--red);\n}\n\n.plugin {\n color: var(--purple);\n}\n\n.file {\n color: var(--cyan);\n margin-bottom: 0;\n white-space: pre-wrap;\n word-break: break-all;\n}\n\n.frame {\n color: var(--yellow);\n}\n\n.stack {\n font-size: 13px;\n color: var(--dim);\n}\n\n.tip {\n font-size: 13px;\n color: #999;\n border-top: 1px dotted #999;\n padding-top: 13px;\n}\n\ncode {\n font-size: 13px;\n font-family: var(--monospace);\n color: var(--yellow);\n}\n\n.file-link {\n text-decoration: underline;\n cursor: pointer;\n}\n</style>\n<div class=\"window\">\n <pre class=\"message\"><span class=\"plugin\"></span><span class=\"message-body\"></span></pre>\n <pre class=\"file\"></pre>\n <pre class=\"frame\"></pre>\n <pre class=\"stack\"></pre>\n <div class=\"tip\">\n Click outside or fix the code to dismiss.<br>\n You can also disable this overlay by setting\n <code>server.hmr.overlay</code> to <code>false</code> in <code>vite.config.js.</code>\n </div>\n</div>\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\nexport class ErrorOverlay extends HTMLElement {\n root: ShadowRoot\n\n constructor(err: ErrorPayload['err']) {\n super()\n this.root = this.attachShadow({ mode: 'open' })\n this.root.innerHTML = template\n\n codeframeRE.lastIndex = 0\n const hasFrame = err.frame && codeframeRE.test(err.frame)\n const message = hasFrame\n ? err.message.replace(codeframeRE, '')\n : err.message\n if (err.plugin) {\n this.text('.plugin', `[plugin:${err.plugin}] `)\n }\n this.text('.message-body', message.trim())\n\n const [file] = (err.loc?.file || err.id || 'unknown file').split(`?`)\n if (err.loc) {\n this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, true)\n } else if (err.id) {\n this.text('.file', file)\n }\n\n if (hasFrame) {\n this.text('.frame', err.frame!.trim())\n }\n this.text('.stack', err.stack, true)\n\n this.root.querySelector('.window')!.addEventListener('click', (e) => {\n e.stopPropagation()\n })\n this.addEventListener('click', () => {\n this.close()\n })\n }\n\n text(selector: string, text: string, linkFiles = false): void {\n const el = this.root.querySelector(selector)!\n if (!linkFiles) {\n el.textContent = text\n } else {\n let curIndex = 0\n let match: RegExpExecArray | null\n while ((match = fileRE.exec(text))) {\n const { 0: file, index } = match\n if (index != null) {\n const frag = text.slice(curIndex, index)\n el.appendChild(document.createTextNode(frag))\n const link = document.createElement('a')\n link.textContent = file\n link.className = 'file-link'\n link.onclick = () => {\n fetch('/__open-in-editor?file=' + encodeURIComponent(file))\n }\n el.appendChild(link)\n curIndex += frag.length + file.length\n }\n }\n }\n }\n\n close(): void {\n this.parentNode?.removeChild(this)\n }\n}\n\nexport const overlayId = 'vite-error-overlay'\nif (customElements && !customElements.get(overlayId)) {\n customElements.define(overlayId, ErrorOverlay)\n}\n","import type {\n ErrorPayload,\n FullReloadPayload,\n HMRPayload,\n PrunePayload,\n Update,\n UpdatePayload\n} from 'types/hmrPayload'\nimport type { CustomEventName } from 'types/customEvent'\nimport { ErrorOverlay, overlayId } from './overlay'\n// eslint-disable-next-line node/no-missing-import\nimport '@vite/env'\n\n// injected by the hmr plugin when served\ndeclare const __BASE__: string\ndeclare const __HMR_PROTOCOL__: string\ndeclare const __HMR_HOSTNAME__: string\ndeclare const __HMR_PORT__: string | false\ndeclare const __HMR_TIMEOUT__: number\ndeclare const __HMR_ENABLE_OVERLAY__: boolean\n\nconsole.log('[vite] connecting...')\n\n// use server configuration, then fallback to inference\nconst socketProtocol =\n __HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws')\nconst socketHost = __HMR_PORT__\n ? `${__HMR_HOSTNAME__ || location.hostname}:${__HMR_PORT__}`\n : `${__HMR_HOSTNAME__ || location.hostname}`\n\nconst socket = new WebSocket(`${socketProtocol}://${socketHost}`, 'vite-hmr')\nconst base = __BASE__ || '/'\n\nfunction warnFailedFetch(err: Error, path: string | string[]) {\n if (!err.message.match('fetch')) {\n console.error(err)\n }\n console.error(\n `[hmr] Failed to reload ${path}. ` +\n `This could be due to syntax errors or importing non-existent ` +\n `modules. (see errors above)`\n )\n}\n\nfunction cleanUrl(pathname: string): string {\n const url = new URL(pathname, location.toString())\n url.searchParams.delete('direct')\n return url.pathname + url.search\n}\n\n// Listen for messages\nsocket.addEventListener('message', async ({ data }) => {\n handleMessage(JSON.parse(data))\n})\n\nlet isFirstUpdate = true\n\nasync function handleMessage(payload: HMRPayload) {\n switch (payload.type) {\n case 'connected':\n console.log(`[vite] connected.`)\n // proxy(nginx, docker) hmr ws maybe caused timeout,\n // so send ping package let ws keep alive.\n setInterval(() => socket.send('ping'), __HMR_TIMEOUT__)\n break\n case 'update':\n notifyListeners('vite:beforeUpdate', payload)\n // if this is the first update and there's already an error overlay, it\n // means the page opened with existing server compile error and the whole\n // module script failed to load (since one of the nested imports is 500).\n // in this case a normal update won't work and a full reload is needed.\n if (isFirstUpdate && hasErrorOverlay()) {\n window.location.reload()\n return\n } else {\n clearErrorOverlay()\n isFirstUpdate = false\n }\n payload.updates.forEach((update) => {\n if (update.type === 'js-update') {\n queueUpdate(fetchUpdate(update))\n } else {\n // css-update\n // this is only sent when a css file referenced with <link> is updated\n const { path, timestamp } = update\n const searchUrl = cleanUrl(path)\n // can't use querySelector with `[href*=]` here since the link may be\n // using relative paths so we need to use link.href to grab the full\n // URL for the include check.\n const el = Array.from(\n document.querySelectorAll<HTMLLinkElement>('link')\n ).find((e) => cleanUrl(e.href).includes(searchUrl))\n if (el) {\n const newPath = `${base}${searchUrl.slice(1)}${\n searchUrl.includes('?') ? '&' : '?'\n }t=${timestamp}`\n el.href = new URL(newPath, el.href).href\n }\n console.log(`[vite] css hot updated: ${searchUrl}`)\n }\n })\n break\n case 'custom': {\n notifyListeners(payload.event as CustomEventName<any>, payload.data)\n break\n }\n case 'full-reload':\n notifyListeners('vite:beforeFullReload', payload)\n if (payload.path && payload.path.endsWith('.html')) {\n // if html file is edited, only reload the page if the browser is\n // currently on that page.\n const pagePath = decodeURI(location.pathname)\n const payloadPath = base + payload.path.slice(1)\n if (\n pagePath === payloadPath ||\n (pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath)\n ) {\n location.reload()\n }\n return\n } else {\n location.reload()\n }\n break\n case 'prune':\n notifyListeners('vite:beforePrune', payload)\n // After an HMR update, some modules are no longer imported on the page\n // but they may have left behind side effects that need to be cleaned up\n // (.e.g style injections)\n // TODO Trigger their dispose callbacks.\n payload.paths.forEach((path) => {\n const fn = pruneMap.get(path)\n if (fn) {\n fn(dataMap.get(path))\n }\n })\n break\n case 'error': {\n notifyListeners('vite:error', payload)\n const err = payload.err\n if (enableOverlay) {\n createErrorOverlay(err)\n } else {\n console.error(\n `[vite] Internal Server Error\\n${err.message}\\n${err.stack}`\n )\n }\n break\n }\n default: {\n const check: never = payload\n return check\n }\n }\n}\n\nfunction notifyListeners(\n event: 'vite:beforeUpdate',\n payload: UpdatePayload\n): void\nfunction notifyListeners(event: 'vite:beforePrune', payload: PrunePayload): void\nfunction notifyListeners(\n event: 'vite:beforeFullReload',\n payload: FullReloadPayload\n): void\nfunction notifyListeners(event: 'vite:error', payload: ErrorPayload): void\nfunction notifyListeners<T extends string>(\n event: CustomEventName<T>,\n data: any\n): void\nfunction notifyListeners(event: string, data: any): void {\n const cbs = customListenersMap.get(event)\n if (cbs) {\n cbs.forEach((cb) => cb(data))\n }\n}\n\nconst enableOverlay = __HMR_ENABLE_OVERLAY__\n\nfunction createErrorOverlay(err: ErrorPayload['err']) {\n if (!enableOverlay) return\n clearErrorOverlay()\n document.body.appendChild(new ErrorOverlay(err))\n}\n\nfunction clearErrorOverlay() {\n document\n .querySelectorAll(overlayId)\n .forEach((n) => (n as ErrorOverlay).close())\n}\n\nfunction hasErrorOverlay() {\n return document.querySelectorAll(overlayId).length\n}\n\nlet pending = false\nlet queued: Promise<(() => void) | undefined>[] = []\n\n/**\n * buffer multiple hot updates triggered by the same src change\n * so that they are invoked in the same order they were sent.\n * (otherwise the order may be inconsistent because of the http request round trip)\n */\nasync function queueUpdate(p: Promise<(() => void) | undefined>) {\n queued.push(p)\n if (!pending) {\n pending = true\n await Promise.resolve()\n pending = false\n const loading = [...queued]\n queued = []\n ;(await Promise.all(loading)).forEach((fn) => fn && fn())\n }\n}\n\nasync function waitForSuccessfulPing(ms = 1000) {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n const pingResponse = await fetch(`${base}__vite_ping`)\n\n // success - 2xx status code\n if (pingResponse.ok) break\n // failure - non-2xx status code\n else throw new Error()\n } catch (e) {\n // wait ms before attempting to ping again\n await new Promise((resolve) => setTimeout(resolve, ms))\n }\n }\n}\n\n// ping server\nsocket.addEventListener('close', async ({ wasClean }) => {\n if (wasClean) return\n console.log(`[vite] server connection lost. polling for restart...`)\n await waitForSuccessfulPing()\n location.reload()\n})\n\n// https://wicg.github.io/construct-stylesheets\nconst supportsConstructedSheet = (() => {\n // TODO: re-enable this try block once Chrome fixes the performance of\n // rule insertion in really big stylesheets\n // try {\n // new CSSStyleSheet()\n // return true\n // } catch (e) {}\n return false\n})()\n\nconst sheetsMap = new Map()\n\nexport function updateStyle(id: string, content: string): void {\n let style = sheetsMap.get(id)\n if (supportsConstructedSheet && !content.includes('@import')) {\n if (style && !(style instanceof CSSStyleSheet)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = new CSSStyleSheet()\n style.replaceSync(content)\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]\n } else {\n style.replaceSync(content)\n }\n } else {\n if (style && !(style instanceof HTMLStyleElement)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = document.createElement('style')\n style.setAttribute('type', 'text/css')\n style.innerHTML = content\n document.head.appendChild(style)\n } else {\n style.innerHTML = content\n }\n }\n sheetsMap.set(id, style)\n}\n\nexport function removeStyle(id: string): void {\n const style = sheetsMap.get(id)\n if (style) {\n if (style instanceof CSSStyleSheet) {\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = document.adoptedStyleSheets.filter(\n (s: CSSStyleSheet) => s !== style\n )\n } else {\n document.head.removeChild(style)\n }\n sheetsMap.delete(id)\n }\n}\n\nasync function fetchUpdate({ path, acceptedPath, timestamp }: Update) {\n const mod = hotModulesMap.get(path)\n if (!mod) {\n // In a code-splitting project,\n // it is common that the hot-updating module is not loaded yet.\n // https://github.com/vitejs/vite/issues/721\n return\n }\n\n const moduleMap = new Map()\n const isSelfUpdate = path === acceptedPath\n\n // make sure we only import each dep once\n const modulesToUpdate = new Set<string>()\n if (isSelfUpdate) {\n // self update - only update self\n modulesToUpdate.add(path)\n } else {\n // dep update\n for (const { deps } of mod.callbacks) {\n deps.forEach((dep) => {\n if (acceptedPath === dep) {\n modulesToUpdate.add(dep)\n }\n })\n }\n }\n\n // determine the qualified callbacks before we re-import the modules\n const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => {\n return deps.some((dep) => modulesToUpdate.has(dep))\n })\n\n await Promise.all(\n Array.from(modulesToUpdate).map(async (dep) => {\n const disposer = disposeMap.get(dep)\n if (disposer) await disposer(dataMap.get(dep))\n const [path, query] = dep.split(`?`)\n try {\n const newMod = await import(\n /* @vite-ignore */\n base +\n path.slice(1) +\n `?import&t=${timestamp}${query ? `&${query}` : ''}`\n )\n moduleMap.set(dep, newMod)\n } catch (e) {\n warnFailedFetch(e, dep)\n }\n })\n )\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => moduleMap.get(dep)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.log(`[vite] hot updated: ${loggedPath}`)\n }\n}\n\ninterface HotModule {\n id: string\n callbacks: HotCallback[]\n}\n\ninterface HotCallback {\n // the dependencies must be fetchable paths\n deps: string[]\n fn: (modules: object[]) => void\n}\n\nconst hotModulesMap = new Map<string, HotModule>()\nconst disposeMap = new Map<string, (data: any) => void | Promise<void>>()\nconst pruneMap = new Map<string, (data: any) => void | Promise<void>>()\nconst dataMap = new Map<string, any>()\nconst customListenersMap = new Map<string, ((data: any) => void)[]>()\nconst ctxToListenersMap = new Map<\n string,\n Map<string, ((data: any) => void)[]>\n>()\n\n// Just infer the return type for now\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const createHotContext = (ownerPath: string) => {\n if (!dataMap.has(ownerPath)) {\n dataMap.set(ownerPath, {})\n }\n\n // when a file is hot updated, a new context is created\n // clear its stale callbacks\n const mod = hotModulesMap.get(ownerPath)\n if (mod) {\n mod.callbacks = []\n }\n\n // clear stale custom event listeners\n const staleListeners = ctxToListenersMap.get(ownerPath)\n if (staleListeners) {\n for (const [event, staleFns] of staleListeners) {\n const listeners = customListenersMap.get(event)\n if (listeners) {\n customListenersMap.set(\n event,\n listeners.filter((l) => !staleFns.includes(l))\n )\n }\n }\n }\n\n const newListeners = new Map()\n ctxToListenersMap.set(ownerPath, newListeners)\n\n function acceptDeps(deps: string[], callback: HotCallback['fn'] = () => {}) {\n const mod: HotModule = hotModulesMap.get(ownerPath) || {\n id: ownerPath,\n callbacks: []\n }\n mod.callbacks.push({\n deps,\n fn: callback\n })\n hotModulesMap.set(ownerPath, mod)\n }\n\n const hot = {\n get data() {\n return dataMap.get(ownerPath)\n },\n\n accept(deps: any, callback?: any) {\n if (typeof deps === 'function' || !deps) {\n // self-accept: hot.accept(() => {})\n acceptDeps([ownerPath], ([mod]) => deps && deps(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => callback && callback(mod))\n } else if (Array.isArray(deps)) {\n acceptDeps(deps, callback)\n } else {\n throw new Error(`invalid hot.accept() usage.`)\n }\n },\n\n acceptDeps() {\n throw new Error(\n `hot.acceptDeps() is deprecated. ` +\n `Use hot.accept() with the same signature instead.`\n )\n },\n\n dispose(cb: (data: any) => void) {\n disposeMap.set(ownerPath, cb)\n },\n\n prune(cb: (data: any) => void) {\n pruneMap.set(ownerPath, cb)\n },\n\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n invalidate() {\n // TODO should tell the server to re-perform hmr propagation\n // from this module as root\n location.reload()\n },\n\n // custom events\n on: (event: string, cb: (data: any) => void) => {\n const addToMap = (map: Map<string, any[]>) => {\n const existing = map.get(event) || []\n existing.push(cb)\n map.set(event, existing)\n }\n addToMap(customListenersMap)\n addToMap(newListeners)\n }\n }\n\n return hot\n}\n\n/**\n * urls here are dynamic import() urls that couldn't be statically analyzed\n */\nexport function injectQuery(url: string, queryToInject: string): string {\n // skip urls that won't be handled by vite\n if (!url.startsWith('.') && !url.startsWith('/')) {\n return url\n }\n\n // can't use pathname from URL since it may be relative like ../\n const pathname = url.replace(/#.*$/, '').replace(/\\?.*$/, '')\n const { search, hash } = new URL(url, 'http://vit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GAAuB;gBACvC,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;gBACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBACjB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aACzB,CAAA;YACD,QAAQ,CAAC,kBAAkB,CAAC,CAAA;YAC5B,QAAQ,CAAC,YAAY,CAAC,CAAA;SACvB;KACF,CAAA;IAED,OAAO,GAAG,CAAA;AACZ,EAAC;AAED;;;SAGgB,WAAW,CAAC,GAAW,EAAE,aAAqB;;IAE5D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAChD,OAAO,GAAG,CAAA;KACX;;IAGD,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IAC7D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;IAE1D,OAAO,GAAG,QAAQ,IAAI,aAAa,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GACvE,IAAI,IAAI,EACV,EAAE,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"client.mjs","sources":["../../src/client/overlay.ts","../../src/client/client.ts"],"sourcesContent":["import type { ErrorPayload } from 'types/hmrPayload'\n\nconst template = /*html*/ `\n<style>\n:host {\n position: fixed;\n z-index: 99999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n --monospace: 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --red: #ff5555;\n --yellow: #e2aa53;\n --purple: #cfa4ff;\n --cyan: #2dd9da;\n --dim: #c9c9c9;\n}\n\n.window {\n font-family: var(--monospace);\n line-height: 1.5;\n width: 800px;\n color: #d8d8d8;\n margin: 30px auto;\n padding: 25px 40px;\n position: relative;\n background: #181818;\n border-radius: 6px 6px 8px 8px;\n box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);\n overflow: hidden;\n border-top: 8px solid var(--red);\n direction: ltr;\n text-align: left;\n}\n\npre {\n font-family: var(--monospace);\n font-size: 16px;\n margin-top: 0;\n margin-bottom: 1em;\n overflow-x: scroll;\n scrollbar-width: none;\n}\n\npre::-webkit-scrollbar {\n display: none;\n}\n\n.message {\n line-height: 1.3;\n font-weight: 600;\n white-space: pre-wrap;\n}\n\n.message-body {\n color: var(--red);\n}\n\n.plugin {\n color: var(--purple);\n}\n\n.file {\n color: var(--cyan);\n margin-bottom: 0;\n white-space: pre-wrap;\n word-break: break-all;\n}\n\n.frame {\n color: var(--yellow);\n}\n\n.stack {\n font-size: 13px;\n color: var(--dim);\n}\n\n.tip {\n font-size: 13px;\n color: #999;\n border-top: 1px dotted #999;\n padding-top: 13px;\n}\n\ncode {\n font-size: 13px;\n font-family: var(--monospace);\n color: var(--yellow);\n}\n\n.file-link {\n text-decoration: underline;\n cursor: pointer;\n}\n</style>\n<div class=\"window\">\n <pre class=\"message\"><span class=\"plugin\"></span><span class=\"message-body\"></span></pre>\n <pre class=\"file\"></pre>\n <pre class=\"frame\"></pre>\n <pre class=\"stack\"></pre>\n <div class=\"tip\">\n Click outside or fix the code to dismiss.<br>\n You can also disable this overlay by setting\n <code>server.hmr.overlay</code> to <code>false</code> in <code>vite.config.js.</code>\n </div>\n</div>\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\nexport class ErrorOverlay extends HTMLElement {\n root: ShadowRoot\n\n constructor(err: ErrorPayload['err']) {\n super()\n this.root = this.attachShadow({ mode: 'open' })\n this.root.innerHTML = template\n\n codeframeRE.lastIndex = 0\n const hasFrame = err.frame && codeframeRE.test(err.frame)\n const message = hasFrame\n ? err.message.replace(codeframeRE, '')\n : err.message\n if (err.plugin) {\n this.text('.plugin', `[plugin:${err.plugin}] `)\n }\n this.text('.message-body', message.trim())\n\n const [file] = (err.loc?.file || err.id || 'unknown file').split(`?`)\n if (err.loc) {\n this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, true)\n } else if (err.id) {\n this.text('.file', file)\n }\n\n if (hasFrame) {\n this.text('.frame', err.frame!.trim())\n }\n this.text('.stack', err.stack, true)\n\n this.root.querySelector('.window')!.addEventListener('click', (e) => {\n e.stopPropagation()\n })\n this.addEventListener('click', () => {\n this.close()\n })\n }\n\n text(selector: string, text: string, linkFiles = false): void {\n const el = this.root.querySelector(selector)!\n if (!linkFiles) {\n el.textContent = text\n } else {\n let curIndex = 0\n let match: RegExpExecArray | null\n while ((match = fileRE.exec(text))) {\n const { 0: file, index } = match\n if (index != null) {\n const frag = text.slice(curIndex, index)\n el.appendChild(document.createTextNode(frag))\n const link = document.createElement('a')\n link.textContent = file\n link.className = 'file-link'\n link.onclick = () => {\n fetch('/__open-in-editor?file=' + encodeURIComponent(file))\n }\n el.appendChild(link)\n curIndex += frag.length + file.length\n }\n }\n }\n }\n\n close(): void {\n this.parentNode?.removeChild(this)\n }\n}\n\nexport const overlayId = 'vite-error-overlay'\nif (customElements && !customElements.get(overlayId)) {\n customElements.define(overlayId, ErrorOverlay)\n}\n","import type {\n ErrorPayload,\n FullReloadPayload,\n HMRPayload,\n PrunePayload,\n Update,\n UpdatePayload\n} from 'types/hmrPayload'\nimport type { CustomEventName } from 'types/customEvent'\nimport { ErrorOverlay, overlayId } from './overlay'\n// eslint-disable-next-line node/no-missing-import\nimport '@vite/env'\n\n// injected by the hmr plugin when served\ndeclare const __BASE__: string\ndeclare const __HMR_PROTOCOL__: string\ndeclare const __HMR_HOSTNAME__: string\ndeclare const __HMR_PORT__: string | false\ndeclare const __HMR_TIMEOUT__: number\ndeclare const __HMR_ENABLE_OVERLAY__: boolean\n\nconsole.log('[vite] connecting...')\n\n// use server configuration, then fallback to inference\nconst socketProtocol =\n __HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws')\nconst socketHost = __HMR_PORT__\n ? `${__HMR_HOSTNAME__ || location.hostname}:${__HMR_PORT__}`\n : `${__HMR_HOSTNAME__ || location.hostname}`\n\nconst socket = new WebSocket(`${socketProtocol}://${socketHost}`, 'vite-hmr')\nconst base = __BASE__ || '/'\nconst messageBuffer: string[] = []\n\nfunction warnFailedFetch(err: Error, path: string | string[]) {\n if (!err.message.match('fetch')) {\n console.error(err)\n }\n console.error(\n `[hmr] Failed to reload ${path}. ` +\n `This could be due to syntax errors or importing non-existent ` +\n `modules. (see errors above)`\n )\n}\n\nfunction cleanUrl(pathname: string): string {\n const url = new URL(pathname, location.toString())\n url.searchParams.delete('direct')\n return url.pathname + url.search\n}\n\n// Listen for messages\nsocket.addEventListener('message', async ({ data }) => {\n handleMessage(JSON.parse(data))\n})\n\nlet isFirstUpdate = true\n\nasync function handleMessage(payload: HMRPayload) {\n switch (payload.type) {\n case 'connected':\n console.log(`[vite] connected.`)\n sendMessageBuffer()\n // proxy(nginx, docker) hmr ws maybe caused timeout,\n // so send ping package let ws keep alive.\n setInterval(() => socket.send('{\"type\":\"ping\"}'), __HMR_TIMEOUT__)\n break\n case 'update':\n notifyListeners('vite:beforeUpdate', payload)\n // if this is the first update and there's already an error overlay, it\n // means the page opened with existing server compile error and the whole\n // module script failed to load (since one of the nested imports is 500).\n // in this case a normal update won't work and a full reload is needed.\n if (isFirstUpdate && hasErrorOverlay()) {\n window.location.reload()\n return\n } else {\n clearErrorOverlay()\n isFirstUpdate = false\n }\n payload.updates.forEach((update) => {\n if (update.type === 'js-update') {\n queueUpdate(fetchUpdate(update))\n } else {\n // css-update\n // this is only sent when a css file referenced with <link> is updated\n const { path, timestamp } = update\n const searchUrl = cleanUrl(path)\n // can't use querySelector with `[href*=]` here since the link may be\n // using relative paths so we need to use link.href to grab the full\n // URL for the include check.\n const el = Array.from(\n document.querySelectorAll<HTMLLinkElement>('link')\n ).find((e) => cleanUrl(e.href).includes(searchUrl))\n if (el) {\n const newPath = `${base}${searchUrl.slice(1)}${\n searchUrl.includes('?') ? '&' : '?'\n }t=${timestamp}`\n el.href = new URL(newPath, el.href).href\n }\n console.log(`[vite] css hot updated: ${searchUrl}`)\n }\n })\n break\n case 'custom': {\n notifyListeners(payload.event as CustomEventName<any>, payload.data)\n break\n }\n case 'full-reload':\n notifyListeners('vite:beforeFullReload', payload)\n if (payload.path && payload.path.endsWith('.html')) {\n // if html file is edited, only reload the page if the browser is\n // currently on that page.\n const pagePath = decodeURI(location.pathname)\n const payloadPath = base + payload.path.slice(1)\n if (\n pagePath === payloadPath ||\n (pagePath.endsWith('/') && pagePath + 'index.html' === payloadPath)\n ) {\n location.reload()\n }\n return\n } else {\n location.reload()\n }\n break\n case 'prune':\n notifyListeners('vite:beforePrune', payload)\n // After an HMR update, some modules are no longer imported on the page\n // but they may have left behind side effects that need to be cleaned up\n // (.e.g style injections)\n // TODO Trigger their dispose callbacks.\n payload.paths.forEach((path) => {\n const fn = pruneMap.get(path)\n if (fn) {\n fn(dataMap.get(path))\n }\n })\n break\n case 'error': {\n notifyListeners('vite:error', payload)\n const err = payload.err\n if (enableOverlay) {\n createErrorOverlay(err)\n } else {\n console.error(\n `[vite] Internal Server Error\\n${err.message}\\n${err.stack}`\n )\n }\n break\n }\n default: {\n const check: never = payload\n return check\n }\n }\n}\n\nfunction notifyListeners(\n event: 'vite:beforeUpdate',\n payload: UpdatePayload\n): void\nfunction notifyListeners(event: 'vite:beforePrune', payload: PrunePayload): void\nfunction notifyListeners(\n event: 'vite:beforeFullReload',\n payload: FullReloadPayload\n): void\nfunction notifyListeners(event: 'vite:error', payload: ErrorPayload): void\nfunction notifyListeners<T extends string>(\n event: CustomEventName<T>,\n data: any\n): void\nfunction notifyListeners(event: string, data: any): void {\n const cbs = customListenersMap.get(event)\n if (cbs) {\n cbs.forEach((cb) => cb(data))\n }\n}\n\nconst enableOverlay = __HMR_ENABLE_OVERLAY__\n\nfunction createErrorOverlay(err: ErrorPayload['err']) {\n if (!enableOverlay) return\n clearErrorOverlay()\n document.body.appendChild(new ErrorOverlay(err))\n}\n\nfunction clearErrorOverlay() {\n document\n .querySelectorAll(overlayId)\n .forEach((n) => (n as ErrorOverlay).close())\n}\n\nfunction hasErrorOverlay() {\n return document.querySelectorAll(overlayId).length\n}\n\nlet pending = false\nlet queued: Promise<(() => void) | undefined>[] = []\n\n/**\n * buffer multiple hot updates triggered by the same src change\n * so that they are invoked in the same order they were sent.\n * (otherwise the order may be inconsistent because of the http request round trip)\n */\nasync function queueUpdate(p: Promise<(() => void) | undefined>) {\n queued.push(p)\n if (!pending) {\n pending = true\n await Promise.resolve()\n pending = false\n const loading = [...queued]\n queued = []\n ;(await Promise.all(loading)).forEach((fn) => fn && fn())\n }\n}\n\nasync function waitForSuccessfulPing(ms = 1000) {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n const pingResponse = await fetch(`${base}__vite_ping`)\n\n // success - 2xx status code\n if (pingResponse.ok) break\n // failure - non-2xx status code\n else throw new Error()\n } catch (e) {\n // wait ms before attempting to ping again\n await new Promise((resolve) => setTimeout(resolve, ms))\n }\n }\n}\n\n// ping server\nsocket.addEventListener('close', async ({ wasClean }) => {\n if (wasClean) return\n console.log(`[vite] server connection lost. polling for restart...`)\n await waitForSuccessfulPing()\n location.reload()\n})\n\n// https://wicg.github.io/construct-stylesheets\nconst supportsConstructedSheet = (() => {\n // TODO: re-enable this try block once Chrome fixes the performance of\n // rule insertion in really big stylesheets\n // try {\n // new CSSStyleSheet()\n // return true\n // } catch (e) {}\n return false\n})()\n\nconst sheetsMap = new Map()\n\nexport function updateStyle(id: string, content: string): void {\n let style = sheetsMap.get(id)\n if (supportsConstructedSheet && !content.includes('@import')) {\n if (style && !(style instanceof CSSStyleSheet)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = new CSSStyleSheet()\n style.replaceSync(content)\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]\n } else {\n style.replaceSync(content)\n }\n } else {\n if (style && !(style instanceof HTMLStyleElement)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = document.createElement('style')\n style.setAttribute('type', 'text/css')\n style.innerHTML = content\n document.head.appendChild(style)\n } else {\n style.innerHTML = content\n }\n }\n sheetsMap.set(id, style)\n}\n\nexport function removeStyle(id: string): void {\n const style = sheetsMap.get(id)\n if (style) {\n if (style instanceof CSSStyleSheet) {\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = document.adoptedStyleSheets.filter(\n (s: CSSStyleSheet) => s !== style\n )\n } else {\n document.head.removeChild(style)\n }\n sheetsMap.delete(id)\n }\n}\n\nasync function fetchUpdate({ path, acceptedPath, timestamp }: Update) {\n const mod = hotModulesMap.get(path)\n if (!mod) {\n // In a code-splitting project,\n // it is common that the hot-updating module is not loaded yet.\n // https://github.com/vitejs/vite/issues/721\n return\n }\n\n const moduleMap = new Map()\n const isSelfUpdate = path === acceptedPath\n\n // make sure we only import each dep once\n const modulesToUpdate = new Set<string>()\n if (isSelfUpdate) {\n // self update - only update self\n modulesToUpdate.add(path)\n } else {\n // dep update\n for (const { deps } of mod.callbacks) {\n deps.forEach((dep) => {\n if (acceptedPath === dep) {\n modulesToUpdate.add(dep)\n }\n })\n }\n }\n\n // determine the qualified callbacks before we re-import the modules\n const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => {\n return deps.some((dep) => modulesToUpdate.has(dep))\n })\n\n await Promise.all(\n Array.from(modulesToUpdate).map(async (dep) => {\n const disposer = disposeMap.get(dep)\n if (disposer) await disposer(dataMap.get(dep))\n const [path, query] = dep.split(`?`)\n try {\n const newMod = await import(\n /* @vite-ignore */\n base +\n path.slice(1) +\n `?import&t=${timestamp}${query ? `&${query}` : ''}`\n )\n moduleMap.set(dep, newMod)\n } catch (e) {\n warnFailedFetch(e, dep)\n }\n })\n )\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => moduleMap.get(dep)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.log(`[vite] hot updated: ${loggedPath}`)\n }\n}\n\nfunction sendMessageBuffer() {\n if (socket.readyState === 1) {\n messageBuffer.forEach((msg) => socket.send(msg))\n messageBuffer.length = 0\n }\n}\n\ninterface HotModule {\n id: string\n callbacks: HotCallback[]\n}\n\ninterface HotCallback {\n // the dependencies must be fetchable paths\n deps: string[]\n fn: (modules: object[]) => void\n}\n\nconst hotModulesMap = new Map<string, HotModule>()\nconst disposeMap = new Map<string, (data: any) => void | Promise<void>>()\nconst pruneMap = new Map<string, (data: any) => void | Promise<void>>()\nconst dataMap = new Map<string, any>()\nconst customListenersMap = new Map<string, ((data: any) => void)[]>()\nconst ctxToListenersMap = new Map<\n string,\n Map<string, ((data: any) => void)[]>\n>()\n\n// Just infer the return type for now\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const createHotContext = (ownerPath: string) => {\n if (!dataMap.has(ownerPath)) {\n dataMap.set(ownerPath, {})\n }\n\n // when a file is hot updated, a new context is created\n // clear its stale callbacks\n const mod = hotModulesMap.get(ownerPath)\n if (mod) {\n mod.callbacks = []\n }\n\n // clear stale custom event listeners\n const staleListeners = ctxToListenersMap.get(ownerPath)\n if (staleListeners) {\n for (const [event, staleFns] of staleListeners) {\n const listeners = customListenersMap.get(event)\n if (listeners) {\n customListenersMap.set(\n event,\n listeners.filter((l) => !staleFns.includes(l))\n )\n }\n }\n }\n\n const newListeners = new Map()\n ctxToListenersMap.set(ownerPath, newListeners)\n\n function acceptDeps(deps: string[], callback: HotCallback['fn'] = () => {}) {\n const mod: HotModule = hotModulesMap.get(ownerPath) || {\n id: ownerPath,\n callbacks: []\n }\n mod.callbacks.push({\n deps,\n fn: callback\n })\n hotModulesMap.set(ownerPath, mod)\n }\n\n const hot = {\n get data() {\n return dataMap.get(ownerPath)\n },\n\n accept(deps: any, callback?: any) {\n if (typeof deps === 'function' || !deps) {\n // self-accept: hot.accept(() => {})\n acceptDeps([ownerPath], ([mod]) => deps && deps(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => callback && callback(mod))\n } else if (Array.isArray(deps)) {\n acceptDeps(deps, callback)\n } else {\n throw new Error(`invalid hot.accept() usage.`)\n }\n },\n\n acceptDeps() {\n throw new Error(\n `hot.acceptDeps() is deprecated. ` +\n `Use hot.accept() with the same signature instead.`\n )\n },\n\n dispose(cb: (data: any) => void) {\n disposeMap.set(ownerPath, cb)\n },\n\n prune(cb: (data: any) => void) {\n pruneMap.set(ownerPath, cb)\n },\n\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n invalidate() {\n // TODO should tell the server to re-perform hmr propagation\n // from this module as root\n location.reload()\n },\n\n // custom events\n on: (event: string, cb: (data: any) => void) => {\n const addToMap = (map: Map<string, any[]>) => {\n const existing = map.get(event) || []\n existing.push(cb)\n map.set(event, existing)\n }\n addToMap(customListenersMap)\n addToMap(newListeners)\n },\n\n send: (event: string, data?: any) => {\n messageBuffer.push(JSON.stringify({ type: 'custom', event, data }))\n sendMessageBuffer()\n }\n }\n\n return hot\n}\n\n/**\n * urls here are dynamic import() urls that couldn't be statically analyzed\n */\nexport function injectQuery(url: string, queryToInject: string): string {\n // skip urls that won't be handled by vite\n if (!url.startsWith('.') && !url.startsWith('/')) {\n return url\n }\n\n // can't use pathname from URL since it may be relative like ../\n const pathname = url.replace(/#.*$/, '').replace(/\\?.*$/, '')\n const { search, hash } = new URL(url, 'http://vitejs.dev')\n\n return `${pathname}?${queryToInject}${search ? `&` + search.slice(1) : ''}${\n hash || ''\n }`\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G,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,GACvE,IAAI,IAAI,EACV,EAAE,CAAA;AACJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('postcss');
4
- var index$1 = require('./dep-a7fb482c.js');
4
+ var index$1 = require('./dep-f5b7cdd7.js');
5
5
  var path$2 = require('path');
6
6
  var require$$1 = require('crypto');
7
7
  var fs = require('fs');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./dep-a7fb482c.js');
3
+ var index = require('./dep-f5b7cdd7.js');
4
4
  var require$$1 = require('crypto');
5
5
  require('fs');
6
6
  require('path');
@@ -18679,7 +18679,9 @@ function cssPlugin(config) {
18679
18679
  },
18680
18680
  async transform(raw, id, options) {
18681
18681
  var _a, _b;
18682
- if (!isCSSRequest(id) || commonjsProxyRE.test(id)) {
18682
+ if (!isCSSRequest(id) ||
18683
+ commonjsProxyRE.test(id) ||
18684
+ SPECIAL_QUERY_RE.test(id)) {
18683
18685
  return;
18684
18686
  }
18685
18687
  const ssr = (options === null || options === void 0 ? void 0 : options.ssr) === true;
@@ -18760,7 +18762,10 @@ function cssPostPlugin(config) {
18760
18762
  hasEmitted = false;
18761
18763
  },
18762
18764
  async transform(css, id, options) {
18763
- if (!isCSSRequest(id) || commonjsProxyRE.test(id)) {
18765
+ var _a;
18766
+ if (!isCSSRequest(id) ||
18767
+ commonjsProxyRE.test(id) ||
18768
+ SPECIAL_QUERY_RE.test(id)) {
18764
18769
  return;
18765
18770
  }
18766
18771
  const inlined = inlineRE.test(id);
@@ -18778,9 +18783,12 @@ function cssPostPlugin(config) {
18778
18783
  if (inlined) {
18779
18784
  return `export default ${JSON.stringify(css)}`;
18780
18785
  }
18781
- const sourcemap = this.getCombinedSourcemap();
18782
- await injectSourcesContent(sourcemap, cleanUrl(id), config.logger);
18783
- const cssContent = getCodeWithSourcemap('css', css, sourcemap);
18786
+ let cssContent = css;
18787
+ if ((_a = config.css) === null || _a === void 0 ? void 0 : _a.devSourcemap) {
18788
+ const sourcemap = this.getCombinedSourcemap();
18789
+ await injectSourcesContent(sourcemap, cleanUrl(id), config.logger);
18790
+ cssContent = getCodeWithSourcemap('css', css, sourcemap);
18791
+ }
18784
18792
  return [
18785
18793
  `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path__default.posix.join(config.base, CLIENT_PUBLIC_PATH))}`,
18786
18794
  `const __vite__id = ${JSON.stringify(id)}`,
@@ -19009,7 +19017,7 @@ function getCssResolversKeys(resolvers) {
19009
19017
  }
19010
19018
  async function compileCSS(id, code, config, urlReplacer, atImportResolvers, server) {
19011
19019
  var _a;
19012
- const { modules: modulesOptions, preprocessorOptions } = config.css || {};
19020
+ const { modules: modulesOptions, preprocessorOptions, devSourcemap } = config.css || {};
19013
19021
  const isModule = modulesOptions !== false && cssModuleRE.test(id);
19014
19022
  // although at serve time it can work without processing, we do need to
19015
19023
  // crawl them in order to register watch dependencies.
@@ -19053,6 +19061,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
19053
19061
  }
19054
19062
  // important: set this for relative import resolving
19055
19063
  opts.filename = cleanUrl(id);
19064
+ opts.enableSourcemap = devSourcemap !== null && devSourcemap !== void 0 ? devSourcemap : false;
19056
19065
  const preprocessResult = await preProcessor(code, config.root, opts, atImportResolvers);
19057
19066
  if (preprocessResult.errors.length) {
19058
19067
  throw preprocessResult.errors[0];
@@ -19091,7 +19100,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
19091
19100
  replacer: urlReplacer
19092
19101
  }));
19093
19102
  if (isModule) {
19094
- postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-c9843b31.js'); }).then(function (n) { return n.index; })).default({
19103
+ postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-051d3e69.js'); }).then(function (n) { return n.index; })).default({
19095
19104
  ...modulesOptions,
19096
19105
  getJSON(cssFileName, _modules, outputFileName) {
19097
19106
  modules = _modules;
@@ -19171,6 +19180,15 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
19171
19180
  config.logger.warn(colors$1.yellow(msg));
19172
19181
  }
19173
19182
  }
19183
+ if (!devSourcemap) {
19184
+ return {
19185
+ ast: postcssResult,
19186
+ code: postcssResult.css,
19187
+ map: { mappings: '' },
19188
+ modules,
19189
+ deps
19190
+ };
19191
+ }
19174
19192
  const rawPostcssMap = postcssResult.map.toJSON();
19175
19193
  const postcssMap = formatPostcssSourceMap(
19176
19194
  // version property of rawPostcssMap is declared as string
@@ -19400,16 +19418,20 @@ const scss = async (source, root, options, resolvers) => {
19400
19418
  ? importer.push(...options.importer)
19401
19419
  : importer.push(options.importer);
19402
19420
  }
19403
- const { content: data, map: additionalMap } = await getSource(source, options.filename, options.additionalData);
19421
+ const { content: data, map: additionalMap } = await getSource(source, options.filename, options.additionalData, options.enableSourcemap);
19404
19422
  const finalOptions = {
19405
19423
  ...options,
19406
19424
  data,
19407
19425
  file: options.filename,
19408
19426
  outFile: options.filename,
19409
19427
  importer,
19410
- sourceMap: true,
19411
- omitSourceMapUrl: true,
19412
- sourceMapRoot: path__default.dirname(options.filename)
19428
+ ...(options.enableSourcemap
19429
+ ? {
19430
+ sourceMap: true,
19431
+ omitSourceMapUrl: true,
19432
+ sourceMapRoot: path__default.dirname(options.filename)
19433
+ }
19434
+ : {})
19413
19435
  };
19414
19436
  try {
19415
19437
  const result = await new Promise((resolve, reject) => {
@@ -19496,16 +19518,20 @@ async function rebaseUrls(file, rootFile, alias) {
19496
19518
  const less = async (source, root, options, resolvers) => {
19497
19519
  const nodeLess = loadPreprocessor("less" /* less */, root);
19498
19520
  const viteResolverPlugin = createViteLessPlugin(nodeLess, options.filename, options.alias, resolvers);
19499
- const { content, map: additionalMap } = await getSource(source, options.filename, options.additionalData);
19521
+ const { content, map: additionalMap } = await getSource(source, options.filename, options.additionalData, options.enableSourcemap);
19500
19522
  let result;
19501
19523
  try {
19502
19524
  result = await nodeLess.render(content, {
19503
19525
  ...options,
19504
19526
  plugins: [viteResolverPlugin, ...(options.plugins || [])],
19505
- sourceMap: {
19506
- outputSourceFiles: true,
19507
- sourceMapFileInline: false
19508
- }
19527
+ ...(options.enableSourcemap
19528
+ ? {
19529
+ sourceMap: {
19530
+ outputSourceFiles: true,
19531
+ sourceMapFileInline: false
19532
+ }
19533
+ }
19534
+ : {})
19509
19535
  });
19510
19536
  }
19511
19537
  catch (e) {
@@ -19585,17 +19611,19 @@ const styl = async (source, root, options) => {
19585
19611
  const nodeStylus = loadPreprocessor("stylus" /* stylus */, root);
19586
19612
  // Get source with preprocessor options.additionalData. Make sure a new line separator
19587
19613
  // is added to avoid any render error, as added stylus content may not have semi-colon separators
19588
- const { content, map: additionalMap } = await getSource(source, options.filename, options.additionalData, '\n');
19614
+ const { content, map: additionalMap } = await getSource(source, options.filename, options.additionalData, options.enableSourcemap, '\n');
19589
19615
  // Get preprocessor options.imports dependencies as stylus
19590
19616
  // does not return them with its builtin `.deps()` method
19591
19617
  const importsDeps = ((_a = options.imports) !== null && _a !== void 0 ? _a : []).map((dep) => path__default.resolve(dep));
19592
19618
  try {
19593
19619
  const ref = nodeStylus(content, options);
19594
- ref.set('sourcemap', {
19595
- comment: false,
19596
- inline: false,
19597
- basePath: root
19598
- });
19620
+ if (options.enableSourcemap) {
19621
+ ref.set('sourcemap', {
19622
+ comment: false,
19623
+ inline: false,
19624
+ basePath: root
19625
+ });
19626
+ }
19599
19627
  const result = ref.render();
19600
19628
  // Concat imports deps with computed deps
19601
19629
  const deps = [...ref.deps(), ...importsDeps];
@@ -19614,6 +19642,8 @@ const styl = async (source, root, options) => {
19614
19642
  }
19615
19643
  };
19616
19644
  function formatStylusSourceMap(mapBefore, root) {
19645
+ if (!mapBefore)
19646
+ return undefined;
19617
19647
  const map = { ...mapBefore };
19618
19648
  const resolveFromRoot = (p) => normalizePath$4(path__default.resolve(root, p));
19619
19649
  if (map.file) {
@@ -19622,7 +19652,7 @@ function formatStylusSourceMap(mapBefore, root) {
19622
19652
  map.sources = map.sources.map(resolveFromRoot);
19623
19653
  return map;
19624
19654
  }
19625
- async function getSource(source, filename, additionalData, sep = '') {
19655
+ async function getSource(source, filename, additionalData, enableSourcemap, sep = '') {
19626
19656
  if (!additionalData)
19627
19657
  return { content: source };
19628
19658
  if (typeof additionalData === 'function') {
@@ -19632,6 +19662,9 @@ async function getSource(source, filename, additionalData, sep = '') {
19632
19662
  }
19633
19663
  return newContent;
19634
19664
  }
19665
+ if (!enableSourcemap) {
19666
+ return { content: additionalData + sep + source };
19667
+ }
19635
19668
  const ms = new MagicString$1(source);
19636
19669
  ms.appendLeft(0, sep);
19637
19670
  ms.appendLeft(0, additionalData);
@@ -21301,6 +21334,7 @@ function preload(baseModule, deps) {
21301
21334
  function buildImportAnalysisPlugin(config) {
21302
21335
  const ssr = !!config.build.ssr;
21303
21336
  const insertPreload = !(ssr || !!config.build.lib);
21337
+ const isWorker = config.isWorker;
21304
21338
  const scriptRel = config.build.polyfillModulePreload
21305
21339
  ? `'modulepreload'`
21306
21340
  : `(${detectScriptRel.toString()})()`;
@@ -21327,6 +21361,10 @@ function buildImportAnalysisPlugin(config) {
21327
21361
  !source.includes('import.meta.glob')) {
21328
21362
  return;
21329
21363
  }
21364
+ if (isWorker) {
21365
+ // preload method use `document` and can't run in the worker
21366
+ return;
21367
+ }
21330
21368
  await init;
21331
21369
  let imports = [];
21332
21370
  try {
@@ -21410,7 +21448,7 @@ function buildImportAnalysisPlugin(config) {
21410
21448
  return null;
21411
21449
  },
21412
21450
  generateBundle({ format }, bundle) {
21413
- if (format !== 'es' || ssr) {
21451
+ if (format !== 'es' || ssr || isWorker) {
21414
21452
  return;
21415
21453
  }
21416
21454
  for (const file in bundle) {
@@ -21639,7 +21677,7 @@ const assetAttrsConfig = {
21639
21677
  const isAsyncScriptMap = new WeakMap();
21640
21678
  async function traverseHtml(html, filePath, visitor) {
21641
21679
  // lazy load compiler
21642
- const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-57c89c81.js'); }).then(function (n) { return n.compilerDom_cjs; });
21680
+ const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-f61a3114.js'); }).then(function (n) { return n.compilerDom_cjs; });
21643
21681
  // @vue/compiler-core doesn't like lowercase doctypes
21644
21682
  html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
21645
21683
  try {
@@ -44841,7 +44879,7 @@ async function getCertificate(cacheDir) {
44841
44879
  return content;
44842
44880
  }
44843
44881
  catch {
44844
- const content = (await Promise.resolve().then(function () { return require('./dep-35d2a41c.js'); })).createCertificate();
44882
+ const content = (await Promise.resolve().then(function () { return require('./dep-368120f8.js'); })).createCertificate();
44845
44883
  fs$n.promises
44846
44884
  .mkdir(cacheDir, { recursive: true })
44847
44885
  .then(() => fs$n.promises.writeFile(cachePath, content))
@@ -49069,6 +49107,13 @@ function abortHandshake(socket, code, message, headers) {
49069
49107
  }
49070
49108
 
49071
49109
  const HMR_HEADER = 'vite-hmr';
49110
+ const wsServerEvents = [
49111
+ 'connection',
49112
+ 'error',
49113
+ 'headers',
49114
+ 'listening',
49115
+ 'message'
49116
+ ];
49072
49117
  function createWebSocketServer(server, config, httpsOptions) {
49073
49118
  let wss;
49074
49119
  let httpsServer = undefined;
@@ -49078,6 +49123,8 @@ function createWebSocketServer(server, config, httpsOptions) {
49078
49123
  // TODO: the main server port may not have been chosen yet as it may use the next available
49079
49124
  const portsAreCompatible = !hmrPort || hmrPort === config.server.port;
49080
49125
  const wsServer = hmrServer || (portsAreCompatible && server);
49126
+ const customListeners = new Map();
49127
+ const clientsMap = new WeakMap();
49081
49128
  if (wsServer) {
49082
49129
  wss = new websocketServer({ noServer: true });
49083
49130
  wsServer.on('upgrade', (req, socket, head) => {
@@ -49120,6 +49167,22 @@ function createWebSocketServer(server, config, httpsOptions) {
49120
49167
  wss = new websocketServer(websocketServerOptions);
49121
49168
  }
49122
49169
  wss.on('connection', (socket) => {
49170
+ socket.on('message', (raw) => {
49171
+ if (!customListeners.size)
49172
+ return;
49173
+ let parsed;
49174
+ try {
49175
+ parsed = JSON.parse(String(raw));
49176
+ }
49177
+ catch { }
49178
+ if (!parsed || parsed.type !== 'custom' || !parsed.event)
49179
+ return;
49180
+ const listeners = customListeners.get(parsed.event);
49181
+ if (!(listeners === null || listeners === void 0 ? void 0 : listeners.size))
49182
+ return;
49183
+ const client = getSocketClent(socket);
49184
+ listeners.forEach((listener) => listener(parsed.data, client));
49185
+ });
49123
49186
  socket.send(JSON.stringify({ type: 'connected' }));
49124
49187
  if (bufferedError) {
49125
49188
  socket.send(JSON.stringify(bufferedError));
@@ -49131,15 +49194,70 @@ function createWebSocketServer(server, config, httpsOptions) {
49131
49194
  config.logger.error(colors$1.red(`WebSocket server error:\n${e.stack || e.message}`), { error: e });
49132
49195
  }
49133
49196
  });
49197
+ // Provide a wrapper to the ws client so we can send messages in JSON format
49198
+ // To be consistent with server.ws.send
49199
+ function getSocketClent(socket) {
49200
+ if (!clientsMap.has(socket)) {
49201
+ clientsMap.set(socket, {
49202
+ send: (...args) => {
49203
+ let payload;
49204
+ if (typeof args[0] === 'string') {
49205
+ payload = {
49206
+ type: 'custom',
49207
+ event: args[0],
49208
+ data: args[1]
49209
+ };
49210
+ }
49211
+ else {
49212
+ payload = args[0];
49213
+ }
49214
+ socket.send(JSON.stringify(payload));
49215
+ },
49216
+ socket
49217
+ });
49218
+ }
49219
+ return clientsMap.get(socket);
49220
+ }
49134
49221
  // On page reloads, if a file fails to compile and returns 500, the server
49135
49222
  // sends the error payload before the client connection is established.
49136
49223
  // If we have no open clients, buffer the error and send it to the next
49137
49224
  // connected client.
49138
49225
  let bufferedError = null;
49139
49226
  return {
49140
- on: wss.on.bind(wss),
49141
- off: wss.off.bind(wss),
49142
- send(payload) {
49227
+ on: ((event, fn) => {
49228
+ if (wsServerEvents.includes(event))
49229
+ wss.on(event, fn);
49230
+ else {
49231
+ if (!customListeners.has(event)) {
49232
+ customListeners.set(event, new Set());
49233
+ }
49234
+ customListeners.get(event).add(fn);
49235
+ }
49236
+ }),
49237
+ off: ((event, fn) => {
49238
+ var _a;
49239
+ if (wsServerEvents.includes(event)) {
49240
+ wss.off(event, fn);
49241
+ }
49242
+ else {
49243
+ (_a = customListeners.get(event)) === null || _a === void 0 ? void 0 : _a.delete(fn);
49244
+ }
49245
+ }),
49246
+ get clients() {
49247
+ return new Set(Array.from(wss.clients).map(getSocketClent));
49248
+ },
49249
+ send(...args) {
49250
+ let payload;
49251
+ if (typeof args[0] === 'string') {
49252
+ payload = {
49253
+ type: 'custom',
49254
+ event: args[0],
49255
+ data: args[1]
49256
+ };
49257
+ }
49258
+ else {
49259
+ payload = args[0];
49260
+ }
49143
49261
  if (payload.type === 'error' && !wss.clients.size) {
49144
49262
  bufferedError = payload;
49145
49263
  return;
@@ -57768,11 +57886,20 @@ function definePlugin(config) {
57768
57886
 
57769
57887
  const WORKER_FILE_ID = 'worker_url_file';
57770
57888
  function getWorkerType(code, noCommentsCode, i) {
57889
+ function err(e, pos) {
57890
+ const error = new Error(e);
57891
+ error.pos = pos;
57892
+ throw error;
57893
+ }
57771
57894
  const commaIndex = noCommentsCode.indexOf(',', i);
57772
57895
  if (commaIndex === -1) {
57773
57896
  return 'classic';
57774
57897
  }
57775
57898
  const endIndex = noCommentsCode.indexOf(')', i);
57899
+ // case: ') ... ,' mean no worker options params
57900
+ if (commaIndex > endIndex) {
57901
+ return 'classic';
57902
+ }
57776
57903
  // need to find in comment code
57777
57904
  let workerOptsString = code.substring(commaIndex + 1, endIndex);
57778
57905
  const hasViteIgnore = /\/\*\s*@vite-ignore\s*\*\//.test(workerOptsString);
@@ -57790,8 +57917,8 @@ function getWorkerType(code, noCommentsCode, i) {
57790
57917
  }
57791
57918
  catch (e) {
57792
57919
  // can't parse by JSON5, so the worker options had unexpect char.
57793
- throw new Error('Vite is unable to parse the worker options as the value is not static.' +
57794
- 'To ignore this error, please use /* @vite-ignore */ in the worker options.');
57920
+ err('Vite is unable to parse the worker options as the value is not static.' +
57921
+ 'To ignore this error, please use /* @vite-ignore */ in the worker options.', commaIndex + 1);
57795
57922
  }
57796
57923
  if (['classic', 'module'].includes(workerOpts.type)) {
57797
57924
  return workerOpts.type;
@@ -58319,6 +58446,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
58319
58446
  cacheDir,
58320
58447
  command,
58321
58448
  mode,
58449
+ isWorker: false,
58322
58450
  isProduction,
58323
58451
  plugins: userPlugins,
58324
58452
  server,
@@ -58349,7 +58477,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
58349
58477
  };
58350
58478
  // flat config.worker.plugin
58351
58479
  const [workerPrePlugins, workerNormalPlugins, workerPostPlugins] = sortUserPlugins((_g = config.worker) === null || _g === void 0 ? void 0 : _g.plugins);
58352
- const workerResolved = { ...resolved };
58480
+ const workerResolved = { ...resolved, isWorker: true };
58353
58481
  resolved.worker.plugins = await resolvePlugins(workerResolved, workerPrePlugins, workerNormalPlugins, workerPostPlugins);
58354
58482
  // call configResolved worker plugins hooks
58355
58483
  await Promise.all(resolved.worker.plugins.map((p) => { var _a; return (_a = p.configResolved) === null || _a === void 0 ? void 0 : _a.call(p, workerResolved); }));
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./dep-a7fb482c.js');
3
+ var index = require('./dep-f5b7cdd7.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
package/dist/node/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('events');
4
- var index = require('./chunks/dep-a7fb482c.js');
4
+ var index = require('./chunks/dep-f5b7cdd7.js');
5
5
  var perf_hooks = require('perf_hooks');
6
6
  require('fs');
7
7
  require('path');
@@ -683,7 +683,7 @@ cli
683
683
  .action(async (root, options) => {
684
684
  // output structure is preserved even after bundling so require()
685
685
  // is ok here
686
- const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-a7fb482c.js'); }).then(function (n) { return n.index$1; });
686
+ const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-f5b7cdd7.js'); }).then(function (n) { return n.index$1; });
687
687
  try {
688
688
  const server = await createServer({
689
689
  root,
@@ -732,7 +732,7 @@ cli
732
732
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
733
733
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
734
734
  .action(async (root, options) => {
735
- const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-a7fb482c.js'); }).then(function (n) { return n.build$1; });
735
+ const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-f5b7cdd7.js'); }).then(function (n) { return n.build$1; });
736
736
  const buildOptions = cleanOptions(options);
737
737
  try {
738
738
  await build({
@@ -755,7 +755,7 @@ cli
755
755
  .command('optimize [root]', 'pre-bundle dependencies')
756
756
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
757
757
  .action(async (root, options) => {
758
- const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-a7fb482c.js'); }).then(function (n) { return n.index; });
758
+ const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-f5b7cdd7.js'); }).then(function (n) { return n.index; });
759
759
  try {
760
760
  const config = await index.resolveConfig({
761
761
  root,
@@ -778,7 +778,7 @@ cli
778
778
  .option('--https', `[boolean] use TLS + HTTP/2`)
779
779
  .option('--open [path]', `[boolean | string] open browser on startup`)
780
780
  .action(async (root, options) => {
781
- const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-a7fb482c.js'); }).then(function (n) { return n.preview$1; });
781
+ const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-f5b7cdd7.js'); }).then(function (n) { return n.preview$1; });
782
782
  try {
783
783
  const server = await preview({
784
784
  root,
@@ -35,8 +35,8 @@ import type { RollupOutput } from 'rollup';
35
35
  import type { RollupWatcher } from 'rollup';
36
36
  import type { SecureContextOptions } from 'tls';
37
37
  import type { Server } from 'http';
38
- import type { Server as Server_2 } from 'https';
39
- import type { Server as Server_3 } from 'net';
38
+ import type { Server as Server_2 } from 'net';
39
+ import type { Server as Server_3 } from 'https';
40
40
  import type { ServerOptions as ServerOptions_2 } from 'https';
41
41
  import type { ServerResponse } from 'http';
42
42
  import type { SourceDescription } from 'rollup';
@@ -48,6 +48,8 @@ import type { TransformResult as TransformResult_3 } from 'rollup';
48
48
  import type * as url from 'url';
49
49
  import type { URL as URL_2 } from 'url';
50
50
  import type { WatcherOptions } from 'rollup';
51
+ import type { WebSocket as WebSocket_2 } from 'ws';
52
+ import { WebSocketServer as WebSocketServer_2 } from 'ws';
51
53
  import type { ZlibOptions } from 'zlib';
52
54
 
53
55
  export declare interface Alias {
@@ -485,6 +487,12 @@ export declare interface CSSOptions {
485
487
  postcss?: string | (Postcss.ProcessOptions & {
486
488
  plugins?: Postcss.Plugin[];
487
489
  });
490
+ /**
491
+ * Enables css sourcemaps during dev
492
+ * @default false
493
+ * @experimental
494
+ */
495
+ devSourcemap?: boolean;
488
496
  }
489
497
 
490
498
  export declare interface CustomPayload {
@@ -1384,7 +1392,7 @@ export declare interface PreviewServer {
1384
1392
  /**
1385
1393
  * @deprecated Use `server.printUrls()` instead
1386
1394
  */
1387
- export declare function printHttpServerUrls(server: Server_3, config: ResolvedConfig): void;
1395
+ export declare function printHttpServerUrls(server: Server_2, config: ResolvedConfig): void;
1388
1396
 
1389
1397
  export declare interface ProxyOptions extends HttpProxy.ServerOptions {
1390
1398
  /**
@@ -1420,6 +1428,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'alia
1420
1428
  cacheDir: string;
1421
1429
  command: 'build' | 'serve';
1422
1430
  mode: string;
1431
+ isWorker: boolean;
1423
1432
  isProduction: boolean;
1424
1433
  env: Record<string, any>;
1425
1434
  resolve: ResolveOptions & {
@@ -2699,7 +2708,7 @@ export declare namespace WebSocket {
2699
2708
  host?: string | undefined
2700
2709
  port?: number | undefined
2701
2710
  backlog?: number | undefined
2702
- server?: Server | Server_2 | undefined
2711
+ server?: Server | Server_3 | undefined
2703
2712
  verifyClient?:
2704
2713
  | VerifyClientCallbackAsync
2705
2714
  | VerifyClientCallbackSync
@@ -2831,11 +2840,53 @@ export declare const WebSocketAlias: typeof WebSocket;
2831
2840
 
2832
2841
  export declare interface WebSocketAlias extends WebSocket {}
2833
2842
 
2843
+ export declare interface WebSocketClient {
2844
+ /**
2845
+ * Send event to the client
2846
+ */
2847
+ send(payload: HMRPayload): void;
2848
+ /**
2849
+ * Send custom event
2850
+ */
2851
+ send(event: string, payload?: CustomPayload['data']): void;
2852
+ /**
2853
+ * The raw WebSocket instance
2854
+ * @advanced
2855
+ */
2856
+ socket: WebSocket_2;
2857
+ }
2858
+
2859
+ export declare type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
2860
+
2834
2861
  export declare interface WebSocketServer {
2835
- on: WebSocket.Server['on'];
2836
- off: WebSocket.Server['off'];
2862
+ /**
2863
+ * Get all connected clients.
2864
+ */
2865
+ clients: Set<WebSocketClient>;
2866
+ /**
2867
+ * Boardcast events to all clients
2868
+ */
2837
2869
  send(payload: HMRPayload): void;
2870
+ /**
2871
+ * Send custom event
2872
+ */
2873
+ send(event: string, payload?: CustomPayload['data']): void;
2874
+ /**
2875
+ * Disconnect all clients and terminate the server.
2876
+ */
2838
2877
  close(): Promise<void>;
2878
+ /**
2879
+ * Handle custom event emitted by `import.meta.hot.send`
2880
+ */
2881
+ on: WebSocketServer_2['on'] & {
2882
+ (event: string, listener: WebSocketCustomListener<any>): void;
2883
+ };
2884
+ /**
2885
+ * Unregister event listener.
2886
+ */
2887
+ off: WebSocketServer_2['off'] & {
2888
+ (event: string, listener: WebSocketCustomListener<any>): void;
2889
+ };
2839
2890
  }
2840
2891
 
2841
2892
  export { }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./chunks/dep-a7fb482c.js');
5
+ var index = require('./chunks/dep-f5b7cdd7.js');
6
6
  require('fs');
7
7
  require('path');
8
8
  require('tty');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "2.9.0-beta.8",
3
+ "version": "2.9.0-beta.9",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "description": "Native-ESM powered web dev build tool",
@@ -30,6 +30,7 @@ const socketHost = __HMR_PORT__
30
30
 
31
31
  const socket = new WebSocket(`${socketProtocol}://${socketHost}`, 'vite-hmr')
32
32
  const base = __BASE__ || '/'
33
+ const messageBuffer: string[] = []
33
34
 
34
35
  function warnFailedFetch(err: Error, path: string | string[]) {
35
36
  if (!err.message.match('fetch')) {
@@ -59,9 +60,10 @@ async function handleMessage(payload: HMRPayload) {
59
60
  switch (payload.type) {
60
61
  case 'connected':
61
62
  console.log(`[vite] connected.`)
63
+ sendMessageBuffer()
62
64
  // proxy(nginx, docker) hmr ws maybe caused timeout,
63
65
  // so send ping package let ws keep alive.
64
- setInterval(() => socket.send('ping'), __HMR_TIMEOUT__)
66
+ setInterval(() => socket.send('{"type":"ping"}'), __HMR_TIMEOUT__)
65
67
  break
66
68
  case 'update':
67
69
  notifyListeners('vite:beforeUpdate', payload)
@@ -361,6 +363,13 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) {
361
363
  }
362
364
  }
363
365
 
366
+ function sendMessageBuffer() {
367
+ if (socket.readyState === 1) {
368
+ messageBuffer.forEach((msg) => socket.send(msg))
369
+ messageBuffer.length = 0
370
+ }
371
+ }
372
+
364
373
  interface HotModule {
365
374
  id: string
366
375
  callbacks: HotCallback[]
@@ -478,6 +487,11 @@ export const createHotContext = (ownerPath: string) => {
478
487
  }
479
488
  addToMap(customListenersMap)
480
489
  addToMap(newListeners)
490
+ },
491
+
492
+ send: (event: string, data?: any) => {
493
+ messageBuffer.push(JSON.stringify({ type: 'custom', event, data }))
494
+ sendMessageBuffer()
481
495
  }
482
496
  }
483
497
 
@@ -59,6 +59,8 @@ interface ImportMeta {
59
59
  cb: (data: any) => void
60
60
  ): void
61
61
  }
62
+
63
+ send(event: string, data?: any): void
62
64
  }
63
65
 
64
66
  readonly env: ImportMetaEnv