vite 4.0.3 → 4.1.0-beta.0

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.

package/LICENSE.md CHANGED
@@ -1833,6 +1833,32 @@ Repository: git+https://github.com/isaacs/isexe.git
1833
1833
 
1834
1834
  ---------------------------------------
1835
1835
 
1836
+ ## json-stable-stringify
1837
+ License: MIT
1838
+ By: James Halliday
1839
+ Repository: git://github.com/ljharb/json-stable-stringify.git
1840
+
1841
+ > This software is released under the MIT license:
1842
+ >
1843
+ > Permission is hereby granted, free of charge, to any person obtaining a copy of
1844
+ > this software and associated documentation files (the "Software"), to deal in
1845
+ > the Software without restriction, including without limitation the rights to
1846
+ > use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1847
+ > the Software, and to permit persons to whom the Software is furnished to do so,
1848
+ > subject to the following conditions:
1849
+ >
1850
+ > The above copyright notice and this permission notice shall be included in all
1851
+ > copies or substantial portions of the Software.
1852
+ >
1853
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1854
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1855
+ > FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1856
+ > COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1857
+ > IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1858
+ > CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1859
+
1860
+ ---------------------------------------
1861
+
1836
1862
  ## launch-editor
1837
1863
  License: MIT
1838
1864
  By: Evan You
@@ -207,7 +207,7 @@ console.debug('[vite] connecting...');
207
207
  const importMetaUrl = new URL(import.meta.url);
208
208
  // use server configuration, then fallback to inference
209
209
  const serverHost = __SERVER_HOST__;
210
- const socketProtocol = __HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws');
210
+ const socketProtocol = __HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws');
211
211
  const hmrPort = __HMR_PORT__;
212
212
  const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${hmrPort || importMetaUrl.port}${__HMR_BASE__}`;
213
213
  const directSocketHost = __HMR_DIRECT_TARGET__;
@@ -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\n// injected by the hmr plugin when served\ndeclare const __BASE__: string\n\nconst base = __BASE__ || '/'\n\n// set :host styles to make playwright detect the element as visible\nconst template = /*html*/ `\n<style>\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 99999;\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 --window-background: #181818;\n --window-color: #d8d8d8;\n}\n\n.backdrop {\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}\n\n.window {\n font-family: var(--monospace);\n line-height: 1.5;\n width: 800px;\n color: var(--window-color);\n margin: 30px auto;\n padding: 25px 40px;\n position: relative;\n background: var(--window-background);\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=\"backdrop\" part=\"backdrop\">\n <div class=\"window\" part=\"window\">\n <pre class=\"message\" part=\"message\"><span class=\"plugin\"></span><span class=\"message-body\"></span></pre>\n <pre class=\"file\" part=\"file\"></pre>\n <pre class=\"frame\" part=\"frame\"></pre>\n <pre class=\"stack\" part=\"stack\"></pre>\n <div class=\"tip\" part=\"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</div>\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\n// Allow `ErrorOverlay` to extend `HTMLElement` even in environments where\n// `HTMLElement` was not originally defined.\nconst { HTMLElement = class {} as typeof globalThis.HTMLElement } = globalThis\nexport class ErrorOverlay extends HTMLElement {\n root: ShadowRoot\n\n constructor(err: ErrorPayload['err'], links = true) {\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}`, links)\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, links)\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 fileRE.lastIndex = 0\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(`${base}__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'\nconst { customElements } = globalThis // Ensure `customElements` is defined before the next line.\nif (customElements && !customElements.get(overlayId)) {\n customElements.define(overlayId, ErrorOverlay)\n}\n","import type { ErrorPayload, HMRPayload, Update } from 'types/hmrPayload'\nimport type { ModuleNamespace, ViteHotContext } from 'types/hot'\nimport type { InferCustomEventPayload } 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 __SERVER_HOST__: string\ndeclare const __HMR_PROTOCOL__: string | null\ndeclare const __HMR_HOSTNAME__: string | null\ndeclare const __HMR_PORT__: number | null\ndeclare const __HMR_DIRECT_TARGET__: string\ndeclare const __HMR_BASE__: string\ndeclare const __HMR_TIMEOUT__: number\ndeclare const __HMR_ENABLE_OVERLAY__: boolean\n\nconsole.debug('[vite] connecting...')\n\nconst importMetaUrl = new URL(import.meta.url)\n\n// use server configuration, then fallback to inference\nconst serverHost = __SERVER_HOST__\nconst socketProtocol =\n __HMR_PROTOCOL__ || (location.protocol === 'https:' ? 'wss' : 'ws')\nconst hmrPort = __HMR_PORT__\nconst socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${\n hmrPort || importMetaUrl.port\n}${__HMR_BASE__}`\nconst directSocketHost = __HMR_DIRECT_TARGET__\nconst base = __BASE__ || '/'\nconst messageBuffer: string[] = []\n\nlet socket: WebSocket\ntry {\n let fallback: (() => void) | undefined\n // only use fallback when port is inferred to prevent confusion\n if (!hmrPort) {\n fallback = () => {\n // fallback to connecting directly to the hmr server\n // for servers which does not support proxying websocket\n socket = setupWebSocket(socketProtocol, directSocketHost, () => {\n const currentScriptHostURL = new URL(import.meta.url)\n const currentScriptHost =\n currentScriptHostURL.host +\n currentScriptHostURL.pathname.replace(/@vite\\/client$/, '')\n console.error(\n '[vite] failed to connect to websocket.\\n' +\n 'your current setup:\\n' +\n ` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\\n` +\n ` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\\n` +\n 'Check out your Vite / network configuration and https://vitejs.dev/config/server-options.html#server-hmr .',\n )\n })\n socket.addEventListener(\n 'open',\n () => {\n console.info(\n '[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.',\n )\n },\n { once: true },\n )\n }\n }\n\n socket = setupWebSocket(socketProtocol, socketHost, fallback)\n} catch (error) {\n console.error(`[vite] failed to connect to websocket (${error}). `)\n}\n\nfunction setupWebSocket(\n protocol: string,\n hostAndPath: string,\n onCloseWithoutOpen?: () => void,\n) {\n const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr')\n let isOpened = false\n\n socket.addEventListener(\n 'open',\n () => {\n isOpened = true\n },\n { once: true },\n )\n\n // Listen for messages\n socket.addEventListener('message', async ({ data }) => {\n handleMessage(JSON.parse(data))\n })\n\n // ping server\n socket.addEventListener('close', async ({ wasClean }) => {\n if (wasClean) return\n\n if (!isOpened && onCloseWithoutOpen) {\n onCloseWithoutOpen()\n return\n }\n\n console.log(`[vite] server connection lost. polling for restart...`)\n await waitForSuccessfulPing(protocol, hostAndPath)\n location.reload()\n })\n\n return socket\n}\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\nlet isFirstUpdate = true\nconst outdatedLinkTags = new WeakSet<HTMLLinkElement>()\n\nasync function handleMessage(payload: HMRPayload) {\n switch (payload.type) {\n case 'connected':\n console.debug(`[vite] connected.`)\n sendMessageBuffer()\n // proxy(nginx, docker) hmr ws maybe caused timeout,\n // so send ping package let ws keep alive.\n setInterval(() => {\n if (socket.readyState === socket.OPEN) {\n socket.send('{\"type\":\"ping\"}')\n }\n }, __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 await Promise.all(\n payload.updates.map(async (update): Promise<void> => {\n if (update.type === 'js-update') {\n return queueUpdate(fetchUpdate(update))\n }\n\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(\n (e) =>\n !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl),\n )\n\n if (!el) {\n return\n }\n\n const newPath = `${base}${searchUrl.slice(1)}${\n searchUrl.includes('?') ? '&' : '?'\n }t=${timestamp}`\n\n // rather than swapping the href on the existing tag, we will\n // create a new link tag. Once the new stylesheet has loaded we\n // will remove the existing link tag. This removes a Flash Of\n // Unstyled Content that can occur when swapping out the tag href\n // directly, as the new stylesheet has not yet been loaded.\n return new Promise((resolve) => {\n const newLinkTag = el.cloneNode() as HTMLLinkElement\n newLinkTag.href = new URL(newPath, el.href).href\n const removeOldEl = () => {\n el.remove()\n console.debug(`[vite] css hot updated: ${searchUrl}`)\n resolve()\n }\n newLinkTag.addEventListener('load', removeOldEl)\n newLinkTag.addEventListener('error', removeOldEl)\n outdatedLinkTags.add(el)\n el.after(newLinkTag)\n })\n }),\n )\n notifyListeners('vite:afterUpdate', payload)\n break\n case 'custom': {\n notifyListeners(payload.event, 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 payload.path === '/index.html' ||\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<T extends string>(\n event: T,\n data: InferCustomEventPayload<T>,\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(\n socketProtocol: string,\n hostAndPath: string,\n ms = 1000,\n) {\n const pingHostProtocol = socketProtocol === 'wss' ? 'https' : 'http'\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n // A fetch on a websocket URL will return a successful promise with status 400,\n // but will reject a networking error.\n // When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors\n await fetch(`${pingHostProtocol}://${hostAndPath}`, {\n mode: 'no-cors',\n })\n break\n } catch (e) {\n // wait ms before attempting to ping again\n await new Promise((resolve) => setTimeout(resolve, ms))\n }\n }\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 string,\n HTMLStyleElement | CSSStyleSheet | undefined\n>()\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 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.setAttribute('data-vite-dev-id', id)\n style.textContent = content\n document.head.appendChild(style)\n } else {\n style.textContent = 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 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({\n path,\n acceptedPath,\n timestamp,\n explicitImportRequired,\n}: 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 let fetchedModule: ModuleNamespace | undefined\n const isSelfUpdate = path === acceptedPath\n\n // determine the qualified callbacks before we re-import the modules\n const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>\n deps.includes(acceptedPath),\n )\n\n if (isSelfUpdate || qualifiedCallbacks.length > 0) {\n const disposer = disposeMap.get(acceptedPath)\n if (disposer) await disposer(dataMap.get(acceptedPath))\n const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`)\n try {\n fetchedModule = await import(\n /* @vite-ignore */\n base +\n acceptedPathWithoutQuery.slice(1) +\n `?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${\n query ? `&${query}` : ''\n }`\n )\n } catch (e) {\n warnFailedFetch(e, acceptedPath)\n }\n }\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => (dep === acceptedPath ? fetchedModule : undefined)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.debug(`[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: Array<ModuleNamespace | undefined>) => void\n}\n\ntype CustomListenersMap = Map<string, ((data: any) => void)[]>\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: CustomListenersMap = new Map()\nconst ctxToListenersMap = new Map<string, CustomListenersMap>()\n\nexport function createHotContext(ownerPath: string): ViteHotContext {\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: CustomListenersMap = 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: ViteHotContext = {\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?.(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => 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 // export names (first arg) are irrelevant on the client side, they're\n // extracted in the server for propagation\n acceptExports(_, callback) {\n acceptDeps([ownerPath], ([mod]) => callback?.(mod))\n },\n\n dispose(cb) {\n disposeMap.set(ownerPath, cb)\n },\n\n prune(cb) {\n pruneMap.set(ownerPath, cb)\n },\n\n // Kept for backward compatibility (#11036)\n // @ts-expect-error untyped\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n // tell the server to re-perform hmr propagation from this module as root\n invalidate(message) {\n notifyListeners('vite:invalidate', { path: ownerPath, message })\n this.send('vite:invalidate', { path: ownerPath, message })\n console.debug(\n `[vite] invalidate ${ownerPath}${message ? `: ${message}` : ''}`,\n )\n },\n\n // custom events\n on(event, cb) {\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, data) {\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 }`\n}\n\nexport { ErrorOverlay }\n"],"names":["base"],"mappings":";;AAKA,MAAMA,MAAI,GAAG,QAAQ,IAAI,GAAG,CAAA;AAE5B;AACA,MAAM,QAAQ,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HzB,CAAA;AAED,MAAM,MAAM,GAAG,gCAAgC,CAAA;AAC/C,MAAM,WAAW,GAAG,0CAA0C,CAAA;AAE9D;AACA;AACA,MAAM,EAAE,WAAW,GAAG,MAAA;CAAyC,EAAE,GAAG,UAAU,CAAA;AACxE,MAAO,YAAa,SAAQ,WAAW,CAAA;AAG3C,IAAA,WAAA,CAAY,GAAwB,EAAE,KAAK,GAAG,IAAI,EAAA;;AAChD,QAAA,KAAK,EAAE,CAAA;AACP,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAC/C,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;AAE9B,QAAA,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;AACzB,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACzD,MAAM,OAAO,GAAG,QAAQ;cACpB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;AACtC,cAAE,GAAG,CAAC,OAAO,CAAA;QACf,IA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C,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAC7D,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;IAE1D,OAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,aAAa,CAAA,EAAG,MAAM,GAAG,CAAG,CAAA,CAAA,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA,EACvE,IAAI,IAAI,EACV,CAAA,CAAE,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\n// injected by the hmr plugin when served\ndeclare const __BASE__: string\n\nconst base = __BASE__ || '/'\n\n// set :host styles to make playwright detect the element as visible\nconst template = /*html*/ `\n<style>\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 99999;\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 --window-background: #181818;\n --window-color: #d8d8d8;\n}\n\n.backdrop {\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}\n\n.window {\n font-family: var(--monospace);\n line-height: 1.5;\n width: 800px;\n color: var(--window-color);\n margin: 30px auto;\n padding: 25px 40px;\n position: relative;\n background: var(--window-background);\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=\"backdrop\" part=\"backdrop\">\n <div class=\"window\" part=\"window\">\n <pre class=\"message\" part=\"message\"><span class=\"plugin\"></span><span class=\"message-body\"></span></pre>\n <pre class=\"file\" part=\"file\"></pre>\n <pre class=\"frame\" part=\"frame\"></pre>\n <pre class=\"stack\" part=\"stack\"></pre>\n <div class=\"tip\" part=\"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</div>\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\n// Allow `ErrorOverlay` to extend `HTMLElement` even in environments where\n// `HTMLElement` was not originally defined.\nconst { HTMLElement = class {} as typeof globalThis.HTMLElement } = globalThis\nexport class ErrorOverlay extends HTMLElement {\n root: ShadowRoot\n\n constructor(err: ErrorPayload['err'], links = true) {\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}`, links)\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, links)\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 fileRE.lastIndex = 0\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(`${base}__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'\nconst { customElements } = globalThis // Ensure `customElements` is defined before the next line.\nif (customElements && !customElements.get(overlayId)) {\n customElements.define(overlayId, ErrorOverlay)\n}\n","import type { ErrorPayload, HMRPayload, Update } from 'types/hmrPayload'\nimport type { ModuleNamespace, ViteHotContext } from 'types/hot'\nimport type { InferCustomEventPayload } 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 __SERVER_HOST__: string\ndeclare const __HMR_PROTOCOL__: string | null\ndeclare const __HMR_HOSTNAME__: string | null\ndeclare const __HMR_PORT__: number | null\ndeclare const __HMR_DIRECT_TARGET__: string\ndeclare const __HMR_BASE__: string\ndeclare const __HMR_TIMEOUT__: number\ndeclare const __HMR_ENABLE_OVERLAY__: boolean\n\nconsole.debug('[vite] connecting...')\n\nconst importMetaUrl = new URL(import.meta.url)\n\n// use server configuration, then fallback to inference\nconst serverHost = __SERVER_HOST__\nconst socketProtocol =\n __HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws')\nconst hmrPort = __HMR_PORT__\nconst socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${\n hmrPort || importMetaUrl.port\n}${__HMR_BASE__}`\nconst directSocketHost = __HMR_DIRECT_TARGET__\nconst base = __BASE__ || '/'\nconst messageBuffer: string[] = []\n\nlet socket: WebSocket\ntry {\n let fallback: (() => void) | undefined\n // only use fallback when port is inferred to prevent confusion\n if (!hmrPort) {\n fallback = () => {\n // fallback to connecting directly to the hmr server\n // for servers which does not support proxying websocket\n socket = setupWebSocket(socketProtocol, directSocketHost, () => {\n const currentScriptHostURL = new URL(import.meta.url)\n const currentScriptHost =\n currentScriptHostURL.host +\n currentScriptHostURL.pathname.replace(/@vite\\/client$/, '')\n console.error(\n '[vite] failed to connect to websocket.\\n' +\n 'your current setup:\\n' +\n ` (browser) ${currentScriptHost} <--[HTTP]--> ${serverHost} (server)\\n` +\n ` (browser) ${socketHost} <--[WebSocket (failing)]--> ${directSocketHost} (server)\\n` +\n 'Check out your Vite / network configuration and https://vitejs.dev/config/server-options.html#server-hmr .',\n )\n })\n socket.addEventListener(\n 'open',\n () => {\n console.info(\n '[vite] Direct websocket connection fallback. Check out https://vitejs.dev/config/server-options.html#server-hmr to remove the previous connection error.',\n )\n },\n { once: true },\n )\n }\n }\n\n socket = setupWebSocket(socketProtocol, socketHost, fallback)\n} catch (error) {\n console.error(`[vite] failed to connect to websocket (${error}). `)\n}\n\nfunction setupWebSocket(\n protocol: string,\n hostAndPath: string,\n onCloseWithoutOpen?: () => void,\n) {\n const socket = new WebSocket(`${protocol}://${hostAndPath}`, 'vite-hmr')\n let isOpened = false\n\n socket.addEventListener(\n 'open',\n () => {\n isOpened = true\n },\n { once: true },\n )\n\n // Listen for messages\n socket.addEventListener('message', async ({ data }) => {\n handleMessage(JSON.parse(data))\n })\n\n // ping server\n socket.addEventListener('close', async ({ wasClean }) => {\n if (wasClean) return\n\n if (!isOpened && onCloseWithoutOpen) {\n onCloseWithoutOpen()\n return\n }\n\n console.log(`[vite] server connection lost. polling for restart...`)\n await waitForSuccessfulPing(protocol, hostAndPath)\n location.reload()\n })\n\n return socket\n}\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\nlet isFirstUpdate = true\nconst outdatedLinkTags = new WeakSet<HTMLLinkElement>()\n\nasync function handleMessage(payload: HMRPayload) {\n switch (payload.type) {\n case 'connected':\n console.debug(`[vite] connected.`)\n sendMessageBuffer()\n // proxy(nginx, docker) hmr ws maybe caused timeout,\n // so send ping package let ws keep alive.\n setInterval(() => {\n if (socket.readyState === socket.OPEN) {\n socket.send('{\"type\":\"ping\"}')\n }\n }, __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 await Promise.all(\n payload.updates.map(async (update): Promise<void> => {\n if (update.type === 'js-update') {\n return queueUpdate(fetchUpdate(update))\n }\n\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(\n (e) =>\n !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl),\n )\n\n if (!el) {\n return\n }\n\n const newPath = `${base}${searchUrl.slice(1)}${\n searchUrl.includes('?') ? '&' : '?'\n }t=${timestamp}`\n\n // rather than swapping the href on the existing tag, we will\n // create a new link tag. Once the new stylesheet has loaded we\n // will remove the existing link tag. This removes a Flash Of\n // Unstyled Content that can occur when swapping out the tag href\n // directly, as the new stylesheet has not yet been loaded.\n return new Promise((resolve) => {\n const newLinkTag = el.cloneNode() as HTMLLinkElement\n newLinkTag.href = new URL(newPath, el.href).href\n const removeOldEl = () => {\n el.remove()\n console.debug(`[vite] css hot updated: ${searchUrl}`)\n resolve()\n }\n newLinkTag.addEventListener('load', removeOldEl)\n newLinkTag.addEventListener('error', removeOldEl)\n outdatedLinkTags.add(el)\n el.after(newLinkTag)\n })\n }),\n )\n notifyListeners('vite:afterUpdate', payload)\n break\n case 'custom': {\n notifyListeners(payload.event, 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 payload.path === '/index.html' ||\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<T extends string>(\n event: T,\n data: InferCustomEventPayload<T>,\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(\n socketProtocol: string,\n hostAndPath: string,\n ms = 1000,\n) {\n const pingHostProtocol = socketProtocol === 'wss' ? 'https' : 'http'\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n // A fetch on a websocket URL will return a successful promise with status 400,\n // but will reject a networking error.\n // When running on middleware mode, it returns status 426, and an cors error happens if mode is not no-cors\n await fetch(`${pingHostProtocol}://${hostAndPath}`, {\n mode: 'no-cors',\n })\n break\n } catch (e) {\n // wait ms before attempting to ping again\n await new Promise((resolve) => setTimeout(resolve, ms))\n }\n }\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 string,\n HTMLStyleElement | CSSStyleSheet | undefined\n>()\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 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.setAttribute('data-vite-dev-id', id)\n style.textContent = content\n document.head.appendChild(style)\n } else {\n style.textContent = 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 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({\n path,\n acceptedPath,\n timestamp,\n explicitImportRequired,\n}: 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 let fetchedModule: ModuleNamespace | undefined\n const isSelfUpdate = path === acceptedPath\n\n // determine the qualified callbacks before we re-import the modules\n const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>\n deps.includes(acceptedPath),\n )\n\n if (isSelfUpdate || qualifiedCallbacks.length > 0) {\n const disposer = disposeMap.get(acceptedPath)\n if (disposer) await disposer(dataMap.get(acceptedPath))\n const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`)\n try {\n fetchedModule = await import(\n /* @vite-ignore */\n base +\n acceptedPathWithoutQuery.slice(1) +\n `?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${\n query ? `&${query}` : ''\n }`\n )\n } catch (e) {\n warnFailedFetch(e, acceptedPath)\n }\n }\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => (dep === acceptedPath ? fetchedModule : undefined)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.debug(`[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: Array<ModuleNamespace | undefined>) => void\n}\n\ntype CustomListenersMap = Map<string, ((data: any) => void)[]>\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: CustomListenersMap = new Map()\nconst ctxToListenersMap = new Map<string, CustomListenersMap>()\n\nexport function createHotContext(ownerPath: string): ViteHotContext {\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: CustomListenersMap = 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: ViteHotContext = {\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?.(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => 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 // export names (first arg) are irrelevant on the client side, they're\n // extracted in the server for propagation\n acceptExports(_, callback) {\n acceptDeps([ownerPath], ([mod]) => callback?.(mod))\n },\n\n dispose(cb) {\n disposeMap.set(ownerPath, cb)\n },\n\n prune(cb) {\n pruneMap.set(ownerPath, cb)\n },\n\n // Kept for backward compatibility (#11036)\n // @ts-expect-error untyped\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n // tell the server to re-perform hmr propagation from this module as root\n invalidate(message) {\n notifyListeners('vite:invalidate', { path: ownerPath, message })\n this.send('vite:invalidate', { path: ownerPath, message })\n console.debug(\n `[vite] invalidate ${ownerPath}${message ? `: ${message}` : ''}`,\n )\n },\n\n // custom events\n on(event, cb) {\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, data) {\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 }`\n}\n\nexport { ErrorOverlay }\n"],"names":["base"],"mappings":";;AAKA,MAAMA,MAAI,GAAG,QAAQ,IAAI,GAAG,CAAA;AAE5B;AACA,MAAM,QAAQ,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HzB,CAAA;AAED,MAAM,MAAM,GAAG,gCAAgC,CAAA;AAC/C,MAAM,WAAW,GAAG,0CAA0C,CAAA;AAE9D;AACA;AACA,MAAM,EAAE,WAAW,GAAG,MAAA;CAAyC,EAAE,GAAG,UAAU,CAAA;AACxE,MAAO,YAAa,SAAQ,WAAW,CAAA;AAG3C,IAAA,WAAA,CAAY,GAAwB,EAAE,KAAK,GAAG,IAAI,EAAA;;AAChD,QAAA,KAAK,EAAE,CAAA;AACP,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAC/C,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;AAE9B,QAAA,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;AACzB,QAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACzD,MAAM,OAAO,GAAG,QAAQ;cACpB,GAAG,CAAC,OAAO,CAAC,OAA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AAA,OAAO,GAAG,CAAA;AACX,KAAA;;AAGD,IAAA,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAC7D,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA;IAE1D,OAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,aAAa,CAAA,EAAG,MAAM,GAAG,CAAG,CAAA,CAAA,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA,EACvE,IAAI,IAAI,EACV,CAAA,CAAE,CAAA;AACJ;;;;"}
@@ -1,6 +1,6 @@
1
1
  import require$$0__default from 'fs';
2
2
  import require$$0 from 'postcss';
3
- import { C as commonjsGlobal } from './dep-0bae2027.js';
3
+ import { C as commonjsGlobal } from './dep-5a9137b7.js';
4
4
  import require$$0$1 from 'path';
5
5
  import require$$5 from 'crypto';
6
6
  import require$$0$2 from 'util';
@@ -2639,11 +2639,11 @@ const attachScopes = function attachScopes(ast, propertyName = 'scope') {
2639
2639
  };
2640
2640
 
2641
2641
  // Helper since Typescript can't detect readonly arrays with Array.isArray
2642
- function isArray$1(arg) {
2642
+ function isArray$2(arg) {
2643
2643
  return Array.isArray(arg);
2644
2644
  }
2645
2645
  function ensureArray(thing) {
2646
- if (isArray$1(thing))
2646
+ if (isArray$2(thing))
2647
2647
  return thing;
2648
2648
  if (thing == null)
2649
2649
  return [];
@@ -11968,7 +11968,12 @@ function copyDir(srcDir, destDir) {
11968
11968
  const removeDir = isWindows$4
11969
11969
  ? promisify$4(gracefulRemoveDir)
11970
11970
  : function removeDirSync(dir) {
11971
- fs$l.rmSync(dir, { recursive: true, force: true });
11971
+ // when removing `.vite/deps`, if it doesn't exist, nodejs may also remove
11972
+ // other directories within `.vite/`, including `.vite/deps_temp` (bug).
11973
+ // workaround by checking for directory existence before removing for now.
11974
+ if (fs$l.existsSync(dir)) {
11975
+ fs$l.rmSync(dir, { recursive: true, force: true });
11976
+ }
11972
11977
  };
11973
11978
  const renameDir = isWindows$4 ? promisify$4(gracefulRename) : fs$l.renameSync;
11974
11979
  function ensureWatchedFile(watcher, file, root) {
@@ -12152,8 +12157,8 @@ async function resolveServerUrls(server, options, config) {
12152
12157
  const base = config.rawBase === './' || config.rawBase === '' ? '/' : config.rawBase;
12153
12158
  if (hostname.host && loopbackHosts.has(hostname.host)) {
12154
12159
  let hostnameName = hostname.name;
12155
- if (hostnameName === '::1' ||
12156
- hostnameName === '0000:0000:0000:0000:0000:0000:0000:0001') {
12160
+ // ipv6 host
12161
+ if (hostnameName.includes(':')) {
12157
12162
  hostnameName = `[${hostnameName}]`;
12158
12163
  }
12159
12164
  local.push(`${protocol}://${hostnameName}:${port}${base}`);
@@ -12167,7 +12172,11 @@ async function resolveServerUrls(server, options, config) {
12167
12172
  // @ts-expect-error Node 18.0 - 18.3 returns number
12168
12173
  (typeof detail.family === 'number' && detail.family === 4)))
12169
12174
  .forEach((detail) => {
12170
- const host = detail.address.replace('127.0.0.1', hostname.name);
12175
+ let host = detail.address.replace('127.0.0.1', hostname.name);
12176
+ // ipv6 host
12177
+ if (host.includes(':')) {
12178
+ host = `[${host}]`;
12179
+ }
12171
12180
  const url = `${protocol}://${host}:${port}${base}`;
12172
12181
  if (detail.address.includes('127.0.0.1')) {
12173
12182
  local.push(url);
@@ -12794,25 +12803,7 @@ function displaySize(bytes) {
12794
12803
  })} kB`;
12795
12804
  }
12796
12805
 
12797
- var __defProp = Object.defineProperty;
12798
- var __defProps = Object.defineProperties;
12799
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
12800
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
12801
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12802
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12803
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12804
- var __spreadValues = (a, b) => {
12805
- for (var prop in b || (b = {}))
12806
- if (__hasOwnProp.call(b, prop))
12807
- __defNormalProp(a, prop, b[prop]);
12808
- if (__getOwnPropSymbols)
12809
- for (var prop of __getOwnPropSymbols(b)) {
12810
- if (__propIsEnum.call(b, prop))
12811
- __defNormalProp(a, prop, b[prop]);
12812
- }
12813
- return a;
12814
- };
12815
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12806
+ // src/find.ts
12816
12807
  async function find(filename, options) {
12817
12808
  let dir = require$$0$4.dirname(require$$0$4.resolve(filename));
12818
12809
  const root = (options == null ? void 0 : options.root) ? require$$0$4.resolve(options.root) : null;
@@ -12990,7 +12981,9 @@ var NATIVE_SEP_RE = new RegExp("\\" + require$$0$4.sep, "g");
12990
12981
  var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
12991
12982
  var GLOB_ALL_PATTERN = `**/*`;
12992
12983
  var DEFAULT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
12993
- var DEFAULT_EXTENSIONS_RE_GROUP = `\\.(?:${DEFAULT_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
12984
+ var DEFAULT_EXTENSIONS_RE_GROUP = `\\.(?:${DEFAULT_EXTENSIONS.map((ext) => ext.substring(1)).join(
12985
+ "|"
12986
+ )})`;
12994
12987
  new Function("path", "return import(path).then(m => m.default)");
12995
12988
  async function resolveTSConfig(filename) {
12996
12989
  if (require$$0$4.extname(filename) !== ".json") {
@@ -13019,7 +13012,9 @@ function resolve2posix(dir, filename) {
13019
13012
  if (require$$0$4.sep === require$$0$4.posix.sep) {
13020
13013
  return dir ? require$$0$4.resolve(dir, filename) : require$$0$4.resolve(filename);
13021
13014
  }
13022
- return native2posix(dir ? require$$0$4.resolve(posix2native(dir), posix2native(filename)) : require$$0$4.resolve(posix2native(filename)));
13015
+ return native2posix(
13016
+ dir ? require$$0$4.resolve(posix2native(dir), posix2native(filename)) : require$$0$4.resolve(posix2native(filename))
13017
+ );
13023
13018
  }
13024
13019
  function resolveReferencedTSConfigFiles(result) {
13025
13020
  const dir = require$$0$4.dirname(result.tsconfigFile);
@@ -13030,11 +13025,14 @@ function resolveReferencedTSConfigFiles(result) {
13030
13025
  }
13031
13026
  function resolveSolutionTSConfig(filename, result) {
13032
13027
  if (result.referenced && DEFAULT_EXTENSIONS.some((ext) => filename.endsWith(ext)) && !isIncluded(filename, result)) {
13033
- const solutionTSConfig = result.referenced.find((referenced) => isIncluded(filename, referenced));
13028
+ const solutionTSConfig = result.referenced.find(
13029
+ (referenced) => isIncluded(filename, referenced)
13030
+ );
13034
13031
  if (solutionTSConfig) {
13035
- return __spreadProps(__spreadValues({}, solutionTSConfig), {
13032
+ return {
13033
+ ...solutionTSConfig,
13036
13034
  solution: result
13037
- });
13035
+ };
13038
13036
  }
13039
13037
  }
13040
13038
  return result;
@@ -13046,7 +13044,11 @@ function isIncluded(filename, result) {
13046
13044
  if (files.includes(filename)) {
13047
13045
  return true;
13048
13046
  }
13049
- const isIncluded2 = isGlobMatch(absoluteFilename, dir, result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN]));
13047
+ const isIncluded2 = isGlobMatch(
13048
+ absoluteFilename,
13049
+ dir,
13050
+ result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN])
13051
+ );
13050
13052
  if (isIncluded2) {
13051
13053
  const isExcluded = isGlobMatch(absoluteFilename, dir, result.tsconfig.exclude || []);
13052
13054
  return !isExcluded;
@@ -13172,7 +13174,12 @@ async function parseFile$1(tsconfigFile, cache) {
13172
13174
  cache == null ? void 0 : cache.set(tsconfigFile, result);
13173
13175
  return result;
13174
13176
  } catch (e) {
13175
- throw new TSConfckParseError(`parsing ${tsconfigFile} failed: ${e}`, "PARSE_FILE", tsconfigFile, e);
13177
+ throw new TSConfckParseError(
13178
+ `parsing ${tsconfigFile} failed: ${e}`,
13179
+ "PARSE_FILE",
13180
+ tsconfigFile,
13181
+ e
13182
+ );
13176
13183
  }
13177
13184
  }
13178
13185
  function normalizeTSConfig(tsconfig, dir) {
@@ -13203,7 +13210,11 @@ async function parseExtends(result, cache) {
13203
13210
  const extendedTSConfigFile = resolveExtends(extending.tsconfig.extends, extending.tsconfigFile);
13204
13211
  if (extended.some((x) => x.tsconfigFile === extendedTSConfigFile)) {
13205
13212
  const circle = extended.concat({ tsconfigFile: extendedTSConfigFile, tsconfig: null }).map((e) => e.tsconfigFile).join(" -> ");
13206
- throw new TSConfckParseError(`Circular dependency in "extends": ${circle}`, "EXTENDS_CIRCULAR", result.tsconfigFile);
13213
+ throw new TSConfckParseError(
13214
+ `Circular dependency in "extends": ${circle}`,
13215
+ "EXTENDS_CIRCULAR",
13216
+ result.tsconfigFile
13217
+ );
13207
13218
  }
13208
13219
  extended.push(await parseFile$1(extendedTSConfigFile, cache));
13209
13220
  }
@@ -13227,7 +13238,12 @@ function resolveExtends(extended, from) {
13227
13238
  error = e;
13228
13239
  }
13229
13240
  }
13230
- throw new TSConfckParseError(`failed to resolve "extends":"${extended}" in ${from}`, "EXTENDS_RESOLVE", from, error);
13241
+ throw new TSConfckParseError(
13242
+ `failed to resolve "extends":"${extended}" in ${from}`,
13243
+ "EXTENDS_RESOLVE",
13244
+ from,
13245
+ error
13246
+ );
13231
13247
  }
13232
13248
  var EXTENDABLE_KEYS = [
13233
13249
  "compilerOptions",
@@ -13242,7 +13258,9 @@ var EXTENDABLE_KEYS = [
13242
13258
  function extendTSConfig(extending, extended) {
13243
13259
  const extendingConfig = extending.tsconfig;
13244
13260
  const extendedConfig = extended.tsconfig;
13245
- const relativePath = native2posix(require$$0$4.relative(require$$0$4.dirname(extending.tsconfigFile), require$$0$4.dirname(extended.tsconfigFile)));
13261
+ const relativePath = native2posix(
13262
+ require$$0$4.relative(require$$0$4.dirname(extending.tsconfigFile), require$$0$4.dirname(extended.tsconfigFile))
13263
+ );
13246
13264
  for (const key of Object.keys(extendedConfig).filter((key2) => EXTENDABLE_KEYS.includes(key2))) {
13247
13265
  if (key === "compilerOptions") {
13248
13266
  if (!extendingConfig.compilerOptions) {
@@ -13252,13 +13270,21 @@ function extendTSConfig(extending, extended) {
13252
13270
  if (Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) {
13253
13271
  continue;
13254
13272
  }
13255
- extendingConfig.compilerOptions[option] = rebaseRelative(option, extendedConfig.compilerOptions[option], relativePath);
13273
+ extendingConfig.compilerOptions[option] = rebaseRelative(
13274
+ option,
13275
+ extendedConfig.compilerOptions[option],
13276
+ relativePath
13277
+ );
13256
13278
  }
13257
13279
  } else if (extendingConfig[key] === void 0) {
13258
13280
  if (key === "watchOptions") {
13259
13281
  extendingConfig.watchOptions = {};
13260
13282
  for (const option of Object.keys(extendedConfig.watchOptions)) {
13261
- extendingConfig.watchOptions[option] = rebaseRelative(option, extendedConfig.watchOptions[option], relativePath);
13283
+ extendingConfig.watchOptions[option] = rebaseRelative(
13284
+ option,
13285
+ extendedConfig.watchOptions[option],
13286
+ relativePath
13287
+ );
13262
13288
  }
13263
13289
  } else {
13264
13290
  extendingConfig[key] = rebaseRelative(key, extendedConfig[key], relativePath);
@@ -13864,6 +13890,90 @@ function terserPlugin(config) {
13864
13890
  };
13865
13891
  }
13866
13892
 
13893
+ var json = JSON;
13894
+
13895
+ var isArray$1 = Array.isArray || function (x) {
13896
+ return {}.toString.call(x) === '[object Array]';
13897
+ };
13898
+
13899
+ var objectKeys = Object.keys || function (obj) {
13900
+ var has = Object.prototype.hasOwnProperty || function () { return true; };
13901
+ var keys = [];
13902
+ for (var key in obj) {
13903
+ if (has.call(obj, key)) { keys.push(key); }
13904
+ }
13905
+ return keys;
13906
+ };
13907
+
13908
+ var jsonStableStringify = function (obj, opts) {
13909
+ if (!opts) { opts = {}; }
13910
+ if (typeof opts === 'function') { opts = { cmp: opts }; }
13911
+ var space = opts.space || '';
13912
+ if (typeof space === 'number') { space = Array(space + 1).join(' '); }
13913
+ var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
13914
+ var replacer = opts.replacer || function (key, value) { return value; };
13915
+
13916
+ var cmp = opts.cmp && (function (f) {
13917
+ return function (node) {
13918
+ return function (a, b) {
13919
+ var aobj = { key: a, value: node[a] };
13920
+ var bobj = { key: b, value: node[b] };
13921
+ return f(aobj, bobj);
13922
+ };
13923
+ };
13924
+ }(opts.cmp));
13925
+
13926
+ var seen = [];
13927
+ return (function stringify(parent, key, node, level) {
13928
+ var indent = space ? '\n' + new Array(level + 1).join(space) : '';
13929
+ var colonSeparator = space ? ': ' : ':';
13930
+
13931
+ if (node && node.toJSON && typeof node.toJSON === 'function') {
13932
+ node = node.toJSON();
13933
+ }
13934
+
13935
+ node = replacer.call(parent, key, node);
13936
+
13937
+ if (node === undefined) {
13938
+ return;
13939
+ }
13940
+ if (typeof node !== 'object' || node === null) {
13941
+ return json.stringify(node);
13942
+ }
13943
+ if (isArray$1(node)) {
13944
+ var out = [];
13945
+ for (var i = 0; i < node.length; i++) {
13946
+ var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
13947
+ out.push(indent + space + item);
13948
+ }
13949
+ return '[' + out.join(',') + indent + ']';
13950
+ }
13951
+
13952
+ if (seen.indexOf(node) !== -1) {
13953
+ if (cycles) { return json.stringify('__cycle__'); }
13954
+ throw new TypeError('Converting circular structure to JSON');
13955
+ } else { seen.push(node); }
13956
+
13957
+ var keys = objectKeys(node).sort(cmp && cmp(node));
13958
+ var out = [];
13959
+ for (var i = 0; i < keys.length; i++) {
13960
+ var key = keys[i];
13961
+ var value = stringify(node, key, node[key], level + 1);
13962
+
13963
+ if (!value) { continue; }
13964
+
13965
+ var keyValue = json.stringify(key)
13966
+ + colonSeparator
13967
+ + value;
13968
+
13969
+ out.push(indent + space + keyValue);
13970
+ }
13971
+ seen.splice(seen.indexOf(node), 1);
13972
+ return '{' + out.join(',') + indent + '}';
13973
+
13974
+ }({ '': obj }, '', obj, 0));
13975
+ };
13976
+
13867
13977
  const mimes$1 = {
13868
13978
  "ez": "application/andrew-inset",
13869
13979
  "aw": "application/applixware",
@@ -14282,6 +14392,7 @@ function lookup(extn) {
14282
14392
  const assetUrlRE = /__VITE_ASSET__([a-z\d]+)__(?:\$_(.*?)__)?/g;
14283
14393
  const rawRE = /(?:\?|&)raw(?:&|$)/;
14284
14394
  const urlRE = /(\?|&)url(?:&|$)/;
14395
+ const jsSourceMapRE = /\.[cm]?js\.map$/;
14285
14396
  const assetCache = new WeakMap();
14286
14397
  const generatedAssets = new WeakMap();
14287
14398
  // add own dictionary entry by directly assigning mrmime
@@ -14390,7 +14501,8 @@ function assetPlugin(config) {
14390
14501
  if (config.command === 'build' && config.build.ssr) {
14391
14502
  for (const file in bundle) {
14392
14503
  if (bundle[file].type === 'asset' &&
14393
- !file.includes('ssr-manifest.json')) {
14504
+ !file.endsWith('ssr-manifest.json') &&
14505
+ !jsSourceMapRE.test(file)) {
14394
14506
  delete bundle[file];
14395
14507
  }
14396
14508
  }
@@ -14405,6 +14517,10 @@ function checkPublicFile(url, { publicDir }) {
14405
14517
  return;
14406
14518
  }
14407
14519
  const publicFile = path$o.join(publicDir, cleanUrl(url));
14520
+ if (!publicFile.startsWith(publicDir)) {
14521
+ // can happen if URL starts with '../'
14522
+ return;
14523
+ }
14408
14524
  if (fs$l.existsSync(publicFile)) {
14409
14525
  return publicFile;
14410
14526
  }
@@ -14638,7 +14754,7 @@ function manifestPlugin(config) {
14638
14754
  ? config.build.manifest
14639
14755
  : 'manifest.json',
14640
14756
  type: 'asset',
14641
- source: JSON.stringify(manifest, null, 2),
14757
+ source: jsonStableStringify(manifest, { space: 2 }),
14642
14758
  });
14643
14759
  }
14644
14760
  },
@@ -21404,13 +21520,16 @@ function tryFsResolve(fsPath, options, tryIndex = true, targetWeb = true) {
21404
21520
  }
21405
21521
  for (const ext of options.extensions) {
21406
21522
  if (postfix &&
21407
- (res = tryResolveFile(fsPath + ext, '', options, false, targetWeb, options.tryPrefix, options.skipPackageJson))) {
21523
+ (res = tryResolveFile(fsPath + ext, '', options, false, targetWeb, options.tryPrefix, options.skipPackageJson, false))) {
21408
21524
  return res;
21409
21525
  }
21410
- if ((res = tryResolveFile(file + ext, postfix, options, false, targetWeb, options.tryPrefix, options.skipPackageJson))) {
21526
+ if ((res = tryResolveFile(file + ext, postfix, options, false, targetWeb, options.tryPrefix, options.skipPackageJson, false))) {
21411
21527
  return res;
21412
21528
  }
21413
21529
  }
21530
+ // if `tryIndex` false, skip as we've already tested above
21531
+ if (!tryIndex)
21532
+ return;
21414
21533
  if (postfix &&
21415
21534
  (res = tryResolveFile(fsPath, '', options, tryIndex, targetWeb, options.tryPrefix, options.skipPackageJson))) {
21416
21535
  return res;
@@ -21419,9 +21538,10 @@ function tryFsResolve(fsPath, options, tryIndex = true, targetWeb = true) {
21419
21538
  return res;
21420
21539
  }
21421
21540
  }
21422
- function tryResolveFile(file, postfix, options, tryIndex, targetWeb, tryPrefix, skipPackageJson) {
21423
- if (isFileReadable(file)) {
21424
- if (!fs$l.statSync(file).isDirectory()) {
21541
+ function tryResolveFile(file, postfix, options, tryIndex, targetWeb, tryPrefix, skipPackageJson, skipTsExtension) {
21542
+ const stat = fs$l.statSync(file, { throwIfNoEntry: false });
21543
+ if (stat) {
21544
+ if (!stat.isDirectory()) {
21425
21545
  return getRealPath(file, options.preserveSymlinks) + postfix;
21426
21546
  }
21427
21547
  else if (tryIndex) {
@@ -21444,11 +21564,13 @@ function tryResolveFile(file, postfix, options, tryIndex, targetWeb, tryPrefix,
21444
21564
  return index + postfix;
21445
21565
  }
21446
21566
  }
21447
- const tryTsExtension = options.isFromTsImporter && isPossibleTsOutput(file);
21448
- if (tryTsExtension) {
21567
+ // try resolve .js import to typescript file
21568
+ if (!skipTsExtension &&
21569
+ options.isFromTsImporter &&
21570
+ isPossibleTsOutput(file)) {
21449
21571
  const tsSrcPaths = getPotentialTsSrcPaths(file);
21450
21572
  for (const srcPath of tsSrcPaths) {
21451
- const res = tryResolveFile(srcPath, postfix, options, tryIndex, targetWeb, tryPrefix, skipPackageJson);
21573
+ const res = tryResolveFile(srcPath, postfix, options, tryIndex, targetWeb, tryPrefix, skipPackageJson, true);
21452
21574
  if (res)
21453
21575
  return res;
21454
21576
  }
@@ -21505,21 +21627,22 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
21505
21627
  if (nestedRoot) {
21506
21628
  basedir = nestedResolveFrom(nestedRoot, basedir, preserveSymlinks);
21507
21629
  }
21630
+ let pkg;
21631
+ let pkgId;
21508
21632
  // nearest package.json
21509
21633
  let nearestPkg;
21510
- // nearest package.json that may have the `exports` field
21511
- let pkg;
21512
- let pkgId = possiblePkgIds.reverse().find((pkgId) => {
21634
+ const rootPkgId = possiblePkgIds[0];
21635
+ const rootPkg = resolvePackageData(rootPkgId, basedir, preserveSymlinks, packageCache);
21636
+ const nearestPkgId = [...possiblePkgIds].reverse().find((pkgId) => {
21513
21637
  nearestPkg = resolvePackageData(pkgId, basedir, preserveSymlinks, packageCache);
21514
21638
  return nearestPkg;
21515
21639
  });
21516
- const rootPkgId = possiblePkgIds[0];
21517
- const rootPkg = resolvePackageData(rootPkgId, basedir, preserveSymlinks, packageCache);
21518
21640
  if (rootPkg?.data?.exports) {
21519
- pkg = rootPkg;
21520
21641
  pkgId = rootPkgId;
21642
+ pkg = rootPkg;
21521
21643
  }
21522
21644
  else {
21645
+ pkgId = nearestPkgId;
21523
21646
  pkg = nearestPkg;
21524
21647
  }
21525
21648
  if (!pkg || !nearestPkg) {
@@ -21733,6 +21856,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
21733
21856
  if (data.exports) {
21734
21857
  entryPoint = resolveExports(data, '.', options, targetWeb);
21735
21858
  }
21859
+ const resolvedFromExports = !!entryPoint;
21736
21860
  // if exports resolved to .mjs, still resolve other fields.
21737
21861
  // This is because .mjs files can technically import .cjs files which would
21738
21862
  // make them invalid for pure ESM environments - so if other module/browser
@@ -21775,7 +21899,9 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
21775
21899
  }
21776
21900
  }
21777
21901
  }
21778
- if (!entryPoint || entryPoint.endsWith('.mjs')) {
21902
+ // fallback to mainFields if still not resolved
21903
+ // TODO: review if `.mjs` check is still needed
21904
+ if (!resolvedFromExports && (!entryPoint || entryPoint.endsWith('.mjs'))) {
21779
21905
  for (const field of options.mainFields) {
21780
21906
  if (field === 'browser')
21781
21907
  continue; // already checked above
@@ -35157,6 +35283,8 @@ const inlineImportRE = /(?<!(?<!\.\.)\.)\bimport\s*\(("(?:[^"]|(?<=\\)")*"|'(?:[
35157
35283
  const htmlLangRE = /\.(?:html|htm)$/;
35158
35284
  const importMapRE = /[ \t]*<script[^>]*type\s*=\s*(?:"importmap"|'importmap'|importmap)[^>]*>.*?<\/script>/is;
35159
35285
  const moduleScriptRE = /[ \t]*<script[^>]*type\s*=\s*(?:"module"|'module'|module)[^>]*>/i;
35286
+ const modulePreloadLinkRE = /[ \t]*<link[^>]*rel\s*=\s*(?:"modulepreload"|'modulepreload'|modulepreload)[\s\S]*?\/>/i;
35287
+ const importMapAppendRE = new RegExp([moduleScriptRE, modulePreloadLinkRE].map((r) => r.source).join('|'), 'i');
35160
35288
  const isHTMLProxy = (id) => htmlProxyRE$1.test(id);
35161
35289
  const isHTMLRequest = (request) => htmlLangRE.test(request);
35162
35290
  // HTML Proxy Caches are stored by config -> filePath -> index
@@ -35719,21 +35847,21 @@ function preImportMapHook(config) {
35719
35847
  const importMapIndex = html.match(importMapRE)?.index;
35720
35848
  if (importMapIndex === undefined)
35721
35849
  return;
35722
- const moduleScriptIndex = html.match(moduleScriptRE)?.index;
35723
- if (moduleScriptIndex === undefined)
35850
+ const importMapAppendIndex = html.match(importMapAppendRE)?.index;
35851
+ if (importMapAppendIndex === undefined)
35724
35852
  return;
35725
- if (moduleScriptIndex < importMapIndex) {
35853
+ if (importMapAppendIndex < importMapIndex) {
35726
35854
  const relativeHtml = normalizePath$3(path$o.relative(config.root, ctx.filename));
35727
- config.logger.warnOnce(picocolorsExports.yellow(picocolorsExports.bold(`(!) <script type="importmap"> should come before <script type="module"> in /${relativeHtml}`)));
35855
+ config.logger.warnOnce(picocolorsExports.yellow(picocolorsExports.bold(`(!) <script type="importmap"> should come before <script type="module"> and <link rel="modulepreload"> in /${relativeHtml}`)));
35728
35856
  }
35729
35857
  };
35730
35858
  }
35731
35859
  /**
35732
- * Move importmap before the first module script
35860
+ * Move importmap before the first module script and modulepreload link
35733
35861
  */
35734
35862
  function postImportMapHook() {
35735
35863
  return (html) => {
35736
- if (!moduleScriptRE.test(html))
35864
+ if (!importMapAppendRE.test(html))
35737
35865
  return;
35738
35866
  let importMap;
35739
35867
  html = html.replace(importMapRE, (match) => {
@@ -35741,7 +35869,7 @@ function postImportMapHook() {
35741
35869
  return '';
35742
35870
  });
35743
35871
  if (importMap) {
35744
- html = html.replace(moduleScriptRE, (match) => `${importMap}\n${match}`);
35872
+ html = html.replace(importMapAppendRE, (match) => `${importMap}\n${match}`);
35745
35873
  }
35746
35874
  return html;
35747
35875
  };
@@ -36297,6 +36425,15 @@ function cssPostPlugin(config) {
36297
36425
  }
36298
36426
  return null;
36299
36427
  },
36428
+ augmentChunkHash(chunk) {
36429
+ if (chunk.viteMetadata?.importedCss.size) {
36430
+ let hash = '';
36431
+ for (const id of chunk.viteMetadata.importedCss) {
36432
+ hash += id;
36433
+ }
36434
+ return hash;
36435
+ }
36436
+ },
36300
36437
  async generateBundle(opts, bundle) {
36301
36438
  // @ts-expect-error asset emits are skipped in legacy bundle
36302
36439
  if (opts.__vite_skip_asset_emit__) {
@@ -36500,7 +36637,7 @@ async function compileCSS(id, code, config, urlReplacer) {
36500
36637
  }));
36501
36638
  }
36502
36639
  if (isModule) {
36503
- postcssPlugins.unshift((await import('./dep-80491704.js').then(function (n) { return n.i; })).default({
36640
+ postcssPlugins.unshift((await import('./dep-41ca0ecb.js').then(function (n) { return n.i; })).default({
36504
36641
  ...modulesOptions,
36505
36642
  localsConvention: modulesOptions?.localsConvention,
36506
36643
  getJSON(cssFileName, _modules, outputFileName) {
@@ -38023,12 +38160,12 @@ async function handleHMRUpdate(file, server) {
38023
38160
  }
38024
38161
  updateModules(shortFile, hmrContext.modules, timestamp, server);
38025
38162
  }
38026
- function updateModules(file, modules, timestamp, { config, ws }, afterInvalidation) {
38163
+ function updateModules(file, modules, timestamp, { config, ws, moduleGraph }, afterInvalidation) {
38027
38164
  const updates = [];
38028
38165
  const invalidatedModules = new Set();
38029
38166
  let needFullReload = false;
38030
38167
  for (const mod of modules) {
38031
- invalidate(mod, timestamp, invalidatedModules);
38168
+ moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true);
38032
38169
  if (needFullReload) {
38033
38170
  continue;
38034
38171
  }
@@ -38155,22 +38292,6 @@ function propagateUpdate(node, boundaries, currentChain = [node]) {
38155
38292
  }
38156
38293
  return false;
38157
38294
  }
38158
- function invalidate(mod, timestamp, seen) {
38159
- if (seen.has(mod)) {
38160
- return;
38161
- }
38162
- seen.add(mod);
38163
- mod.lastHMRTimestamp = timestamp;
38164
- mod.transformResult = null;
38165
- mod.ssrModule = null;
38166
- mod.ssrError = null;
38167
- mod.ssrTransformResult = null;
38168
- mod.importers.forEach((importer) => {
38169
- if (!importer.acceptedHmrDeps.has(mod)) {
38170
- invalidate(importer, timestamp, seen);
38171
- }
38172
- });
38173
- }
38174
38295
  function handlePrunedModules(mods, { ws }) {
38175
38296
  // update the disposed modules' hmr timestamp
38176
38297
  // since if it's re-imported, it should re-apply side effects
@@ -43070,13 +43191,8 @@ async function extractExportsData(filePath, config, ssr) {
43070
43191
  };
43071
43192
  return exportsData;
43072
43193
  }
43073
- // https://github.com/vitejs/vite/issues/1724#issuecomment-767619642
43074
- // a list of modules that pretends to be ESM but still uses `require`.
43075
- // this causes esbuild to wrap them as CJS even when its entry appears to be ESM.
43076
- const KNOWN_INTEROP_IDS = new Set(['moment']);
43077
43194
  function needsInterop(config, ssr, id, exportsData, output) {
43078
- if (getDepOptimizationConfig(config, ssr)?.needsInterop?.includes(id) ||
43079
- KNOWN_INTEROP_IDS.has(id)) {
43195
+ if (getDepOptimizationConfig(config, ssr)?.needsInterop?.includes(id)) {
43080
43196
  return true;
43081
43197
  }
43082
43198
  const { hasImports, exports } = exportsData;
@@ -43725,7 +43841,7 @@ function ssrManifestPlugin(config) {
43725
43841
  ? config.build.ssrManifest
43726
43842
  : 'ssr-manifest.json',
43727
43843
  type: 'asset',
43728
- source: JSON.stringify(ssrManifest, null, 2),
43844
+ source: jsonStableStringify(ssrManifest, { space: 2 }),
43729
43845
  });
43730
43846
  },
43731
43847
  };
@@ -44155,6 +44271,13 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
44155
44271
  if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {
44156
44272
  process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
44157
44273
  }
44274
+ // support BROWSER and BROWSER_ARGS env variables
44275
+ if (parsed.BROWSER && process.env.BROWSER === undefined) {
44276
+ process.env.BROWSER = parsed.BROWSER;
44277
+ }
44278
+ if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
44279
+ process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
44280
+ }
44158
44281
  try {
44159
44282
  // let environment variables use each other
44160
44283
  expand_1({ parsed });
@@ -44303,32 +44426,11 @@ async function resolveBuildPlugins(config) {
44303
44426
  ],
44304
44427
  };
44305
44428
  }
44306
- /**
44307
- * Track parallel build calls and only stop the esbuild service when all
44308
- * builds are done. (#1098)
44309
- */
44310
- let parallelCallCounts = 0;
44311
- // we use a separate counter to track since the call may error before the
44312
- // bundle is even pushed.
44313
- const parallelBuilds = [];
44314
44429
  /**
44315
44430
  * Bundles the app for production.
44316
44431
  * Returns a Promise containing the build result.
44317
44432
  */
44318
44433
  async function build(inlineConfig = {}) {
44319
- parallelCallCounts++;
44320
- try {
44321
- return await doBuild(inlineConfig);
44322
- }
44323
- finally {
44324
- parallelCallCounts--;
44325
- if (parallelCallCounts <= 0) {
44326
- await Promise.all(parallelBuilds.map((bundle) => bundle.close()));
44327
- parallelBuilds.length = 0;
44328
- }
44329
- }
44330
- }
44331
- async function doBuild(inlineConfig = {}) {
44332
44434
  const config = await resolveConfig(inlineConfig, 'build', 'production', 'production');
44333
44435
  const options = config.build;
44334
44436
  const ssr = !!options.ssr;
@@ -44373,6 +44475,7 @@ async function doBuild(inlineConfig = {}) {
44373
44475
  : libOptions
44374
44476
  ? 'strict'
44375
44477
  : false,
44478
+ cache: config.build.watch ? undefined : false,
44376
44479
  ...options.rollupOptions,
44377
44480
  input,
44378
44481
  plugins,
@@ -44391,6 +44494,7 @@ async function doBuild(inlineConfig = {}) {
44391
44494
  }
44392
44495
  config.logger.error(msg, { error: e });
44393
44496
  };
44497
+ let bundle;
44394
44498
  try {
44395
44499
  const buildOutputOptions = (output = {}) => {
44396
44500
  // @ts-expect-error See https://github.com/vitejs/vite/issues/5812#issuecomment-984345618
@@ -44479,17 +44583,13 @@ async function doBuild(inlineConfig = {}) {
44479
44583
  }
44480
44584
  // write or generate files with rollup
44481
44585
  const { rollup } = await import('rollup');
44482
- const bundle = await rollup(rollupOptions);
44483
- parallelBuilds.push(bundle);
44484
- const generate = (output = {}) => {
44485
- return bundle[options.write ? 'write' : 'generate'](output);
44486
- };
44586
+ bundle = await rollup(rollupOptions);
44487
44587
  if (options.write) {
44488
44588
  prepareOutDir(outDirs, options.emptyOutDir, config);
44489
44589
  }
44490
44590
  const res = [];
44491
44591
  for (const output of normalizedOutputs) {
44492
- res.push(await generate(output));
44592
+ res.push(await bundle[options.write ? 'write' : 'generate'](output));
44493
44593
  }
44494
44594
  return Array.isArray(outputs) ? res : res[0];
44495
44595
  }
@@ -44497,6 +44597,10 @@ async function doBuild(inlineConfig = {}) {
44497
44597
  outputBuildError(e);
44498
44598
  throw e;
44499
44599
  }
44600
+ finally {
44601
+ if (bundle)
44602
+ bundle.close();
44603
+ }
44500
44604
  }
44501
44605
  function prepareOutDir(outDirs, emptyOutDir, config) {
44502
44606
  const nonDuplicateDirs = new Set(outDirs);
@@ -53324,7 +53428,10 @@ function openBrowser(url, opt, logger) {
53324
53428
  return executeNodeScript(browser, url, logger);
53325
53429
  }
53326
53430
  else if (browser.toLowerCase() !== 'none') {
53327
- return startBrowserProcess(browser, url);
53431
+ const browserArgs = process.env.BROWSER_ARGS
53432
+ ? process.env.BROWSER_ARGS.split(' ')
53433
+ : [];
53434
+ return startBrowserProcess(browser, browserArgs, url);
53328
53435
  }
53329
53436
  return false;
53330
53437
  }
@@ -53350,7 +53457,7 @@ const supportedChromiumBrowsers = [
53350
53457
  'Vivaldi',
53351
53458
  'Chromium',
53352
53459
  ];
53353
- function startBrowserProcess(browser, url) {
53460
+ function startBrowserProcess(browser, browserArgs, url) {
53354
53461
  // If we're on OS X, the user hasn't specifically
53355
53462
  // requested a different browser, we can try opening
53356
53463
  // a Chromium browser with AppleScript. This lets us reuse an
@@ -53388,7 +53495,9 @@ function startBrowserProcess(browser, url) {
53388
53495
  // Fallback to open
53389
53496
  // (It will always open new tab)
53390
53497
  try {
53391
- const options = browser ? { app: { name: browser } } : {};
53498
+ const options = browser
53499
+ ? { app: { name: browser, arguments: browserArgs } }
53500
+ : {};
53392
53501
  open_1(url, options).catch(() => { }); // Prevent `unhandledRejection` error.
53393
53502
  return true;
53394
53503
  }
@@ -53470,6 +53579,13 @@ const BASE_SHORTCUTS = [
53470
53579
  openBrowser(url, true, server.config.logger);
53471
53580
  },
53472
53581
  },
53582
+ {
53583
+ key: 'c',
53584
+ description: 'clear console',
53585
+ action(server) {
53586
+ server.config.logger.clearScreen('error');
53587
+ },
53588
+ },
53473
53589
  {
53474
53590
  key: 'q',
53475
53591
  description: 'quit',
@@ -60718,15 +60834,6 @@ class ModuleNode {
60718
60834
  }
60719
60835
  }
60720
60836
  }
60721
- function invalidateSSRModule(mod, seen) {
60722
- if (seen.has(mod)) {
60723
- return;
60724
- }
60725
- seen.add(mod);
60726
- mod.ssrModule = null;
60727
- mod.ssrError = null;
60728
- mod.importers.forEach((importer) => invalidateSSRModule(importer, seen));
60729
- }
60730
60837
  class ModuleGraph {
60731
60838
  constructor(resolveId) {
60732
60839
  this.resolveId = resolveId;
@@ -60755,15 +60862,30 @@ class ModuleGraph {
60755
60862
  });
60756
60863
  }
60757
60864
  }
60758
- invalidateModule(mod, seen = new Set(), timestamp = Date.now()) {
60759
- // Save the timestamp for this invalidation, so we can avoid caching the result of possible already started
60760
- // processing being done for this module
60761
- mod.lastInvalidationTimestamp = timestamp;
60865
+ invalidateModule(mod, seen = new Set(), timestamp = Date.now(), isHmr = false) {
60866
+ if (seen.has(mod)) {
60867
+ return;
60868
+ }
60869
+ seen.add(mod);
60870
+ if (isHmr) {
60871
+ mod.lastHMRTimestamp = timestamp;
60872
+ }
60873
+ else {
60874
+ // Save the timestamp for this invalidation, so we can avoid caching the result of possible already started
60875
+ // processing being done for this module
60876
+ mod.lastInvalidationTimestamp = timestamp;
60877
+ }
60762
60878
  // Don't invalidate mod.info and mod.meta, as they are part of the processing pipeline
60763
60879
  // Invalidating the transform result is enough to ensure this module is re-processed next time it is requested
60764
60880
  mod.transformResult = null;
60765
60881
  mod.ssrTransformResult = null;
60766
- invalidateSSRModule(mod, seen);
60882
+ mod.ssrModule = null;
60883
+ mod.ssrError = null;
60884
+ mod.importers.forEach((importer) => {
60885
+ if (!importer.acceptedHmrDeps.has(mod)) {
60886
+ this.invalidateModule(importer, seen, timestamp, isHmr);
60887
+ }
60888
+ });
60767
60889
  }
60768
60890
  invalidateAll() {
60769
60891
  const timestamp = Date.now();
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-0bae2027.js';
5
+ import { A as picocolorsExports, B as bindShortcuts, w as createLogger, h as resolveConfig } from './chunks/dep-5a9137b7.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:url';
8
8
  import 'node:module';
@@ -724,7 +724,7 @@ cli
724
724
  filterDuplicateOptions(options);
725
725
  // output structure is preserved even after bundling so require()
726
726
  // is ok here
727
- const { createServer } = await import('./chunks/dep-0bae2027.js').then(function (n) { return n.F; });
727
+ const { createServer } = await import('./chunks/dep-5a9137b7.js').then(function (n) { return n.F; });
728
728
  try {
729
729
  const server = await createServer({
730
730
  root,
@@ -802,7 +802,7 @@ cli
802
802
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
803
803
  .action(async (root, options) => {
804
804
  filterDuplicateOptions(options);
805
- const { build } = await import('./chunks/dep-0bae2027.js').then(function (n) { return n.E; });
805
+ const { build } = await import('./chunks/dep-5a9137b7.js').then(function (n) { return n.E; });
806
806
  const buildOptions = cleanOptions(options);
807
807
  try {
808
808
  await build({
@@ -830,7 +830,7 @@ cli
830
830
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
831
831
  .action(async (root, options) => {
832
832
  filterDuplicateOptions(options);
833
- const { optimizeDeps } = await import('./chunks/dep-0bae2027.js').then(function (n) { return n.D; });
833
+ const { optimizeDeps } = await import('./chunks/dep-5a9137b7.js').then(function (n) { return n.D; });
834
834
  try {
835
835
  const config = await resolveConfig({
836
836
  root,
@@ -855,7 +855,7 @@ cli
855
855
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
856
856
  .action(async (root, options) => {
857
857
  filterDuplicateOptions(options);
858
- const { preview } = await import('./chunks/dep-0bae2027.js').then(function (n) { return n.G; });
858
+ const { preview } = await import('./chunks/dep-5a9137b7.js').then(function (n) { return n.G; });
859
859
  try {
860
860
  const server = await preview({
861
861
  root,
@@ -2,6 +2,7 @@
2
2
 
3
3
  import type { Agent } from 'node:http';
4
4
  import type { BuildOptions as BuildOptions_2 } from 'esbuild';
5
+ import { ChunkMetadata } from "../../types/metadata";
5
6
  import type { ClientRequest } from 'node:http';
6
7
  import type { ClientRequestArgs } from 'node:http';
7
8
  import { ConnectedPayload } from "../../types/hmrPayload";
@@ -292,10 +293,7 @@ export declare interface BuildOptions {
292
293
  watch?: WatcherOptions | null;
293
294
  }
294
295
 
295
- export declare interface ChunkMetadata {
296
- importedAssets: Set<string>;
297
- importedCss: Set<string>;
298
- }
296
+ export { ChunkMetadata }
299
297
 
300
298
  export declare interface CommonServerOptions {
301
299
  /**
@@ -1296,7 +1294,7 @@ export declare class ModuleGraph {
1296
1294
  getModuleById(id: string): ModuleNode | undefined;
1297
1295
  getModulesByFile(file: string): Set<ModuleNode> | undefined;
1298
1296
  onFileChange(file: string): void;
1299
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number): void;
1297
+ invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean): void;
1300
1298
  invalidateAll(): void;
1301
1299
  /**
1302
1300
  * Update the module graph based on a module's updated imports information
@@ -1,4 +1,4 @@
1
- export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-0bae2027.js';
1
+ export { b as build, e as buildErrorMessage, u as createFilter, w as createLogger, c as createServer, g as defineConfig, f as formatPostcssSourceMap, j as getDepOptimizationConfig, k as isDepsOptimizerEnabled, l as loadConfigFromFile, y as loadEnv, q as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, i as resolveBaseUrl, h as resolveConfig, z as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, x as searchForWorkspaceRoot, v as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-5a9137b7.js';
2
2
  export { VERSION as version } from './constants.js';
3
3
  export { version as esbuildVersion } from 'esbuild';
4
4
  export { VERSION as rollupVersion } from 'rollup';
@@ -3478,7 +3478,12 @@ function isFileReadable(filename) {
3478
3478
  isWindows
3479
3479
  ? node_util.promisify(gracefulRemoveDir)
3480
3480
  : function removeDirSync(dir) {
3481
- fs$1.rmSync(dir, { recursive: true, force: true });
3481
+ // when removing `.vite/deps`, if it doesn't exist, nodejs may also remove
3482
+ // other directories within `.vite/`, including `.vite/deps_temp` (bug).
3483
+ // workaround by checking for directory existence before removing for now.
3484
+ if (fs$1.existsSync(dir)) {
3485
+ fs$1.rmSync(dir, { recursive: true, force: true });
3486
+ }
3482
3487
  };
3483
3488
  isWindows ? node_util.promisify(gracefulRename) : fs$1.renameSync;
3484
3489
  function arraify(target) {
@@ -4259,6 +4264,13 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
4259
4264
  if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === undefined) {
4260
4265
  process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
4261
4266
  }
4267
+ // support BROWSER and BROWSER_ARGS env variables
4268
+ if (parsed.BROWSER && process.env.BROWSER === undefined) {
4269
+ process.env.BROWSER = parsed.BROWSER;
4270
+ }
4271
+ if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === undefined) {
4272
+ process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
4273
+ }
4262
4274
  try {
4263
4275
  // let environment variables use each other
4264
4276
  expand_1({ parsed });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "4.0.3",
3
+ "version": "4.1.0-beta.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
61
61
  "dependencies": {
62
- "esbuild": "^0.16.3",
62
+ "esbuild": "^0.16.14",
63
63
  "postcss": "^8.4.20",
64
64
  "resolve": "^1.22.1",
65
65
  "rollup": "^3.7.0"
@@ -69,13 +69,13 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@ampproject/remapping": "^2.2.0",
72
- "@babel/parser": "^7.20.5",
73
- "@babel/types": "^7.20.5",
72
+ "@babel/parser": "^7.20.7",
73
+ "@babel/types": "^7.20.7",
74
74
  "@jridgewell/trace-mapping": "^0.3.17",
75
75
  "@rollup/plugin-alias": "^4.0.2",
76
76
  "@rollup/plugin-commonjs": "^24.0.0",
77
- "@rollup/plugin-dynamic-import-vars": "^2.0.1",
78
- "@rollup/plugin-json": "^5.0.2",
77
+ "@rollup/plugin-dynamic-import-vars": "^2.0.2",
78
+ "@rollup/plugin-json": "^6.0.0",
79
79
  "@rollup/plugin-node-resolve": "15.0.1",
80
80
  "@rollup/plugin-typescript": "^10.0.1",
81
81
  "@rollup/pluginutils": "^5.0.2",
@@ -93,10 +93,11 @@
93
93
  "dotenv": "^16.0.3",
94
94
  "dotenv-expand": "^9.0.0",
95
95
  "es-module-lexer": "^1.1.0",
96
- "estree-walker": "^3.0.1",
96
+ "estree-walker": "^3.0.2",
97
97
  "etag": "^1.8.1",
98
98
  "fast-glob": "^3.2.12",
99
99
  "http-proxy": "^1.18.1",
100
+ "json-stable-stringify": "^1.0.2",
100
101
  "launch-editor-middleware": "^2.6.0",
101
102
  "magic-string": "^0.27.0",
102
103
  "micromatch": "^4.0.5",
@@ -118,7 +119,7 @@
118
119
  "source-map-support": "^0.5.21",
119
120
  "strip-ansi": "^7.0.1",
120
121
  "strip-literal": "^0.4.2",
121
- "tsconfck": "^2.0.1",
122
+ "tsconfck": "^2.0.2",
122
123
  "tslib": "^2.4.1",
123
124
  "types": "link:./types",
124
125
  "ufo": "^1.0.1",
@@ -0,0 +1,10 @@
1
+ export interface ChunkMetadata {
2
+ importedAssets: Set<string>
3
+ importedCss: Set<string>
4
+ }
5
+
6
+ declare module 'rollup' {
7
+ export interface RenderedChunk {
8
+ viteMetadata: ChunkMetadata
9
+ }
10
+ }