vite 3.1.0-beta.0 → 3.1.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.
- package/dist/client/client.mjs +8 -25
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-94c1417a.js → dep-42c2c4e4.js} +67 -13
- package/dist/node/chunks/{dep-34b4c4eb.js → dep-665b0112.js} +143 -102
- package/dist/node/chunks/{dep-50653a8f.js → dep-6fd76b3e.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +12 -12
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +1 -1
- package/package.json +7 -8
- package/src/client/client.ts +30 -40
- package/types/chokidar.d.ts +1 -1
- package/types/hmrPayload.d.ts +4 -0
- package/types/shims.d.ts +1 -0
package/dist/client/client.mjs
CHANGED
|
@@ -318,7 +318,7 @@ async function handleMessage(payload) {
|
|
|
318
318
|
outdatedLinkTags.add(el);
|
|
319
319
|
el.after(newLinkTag);
|
|
320
320
|
}
|
|
321
|
-
console.
|
|
321
|
+
console.debug(`[vite] css hot updated: ${searchUrl}`);
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
break;
|
|
@@ -465,7 +465,7 @@ function removeStyle(id) {
|
|
|
465
465
|
sheetsMap.delete(id);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
async function fetchUpdate({ path, acceptedPath, timestamp }) {
|
|
468
|
+
async function fetchUpdate({ path, acceptedPath, timestamp, explicitImportRequired }) {
|
|
469
469
|
const mod = hotModulesMap.get(path);
|
|
470
470
|
if (!mod) {
|
|
471
471
|
// In a code-splitting project,
|
|
@@ -475,27 +475,10 @@ async function fetchUpdate({ path, acceptedPath, timestamp }) {
|
|
|
475
475
|
}
|
|
476
476
|
const moduleMap = new Map();
|
|
477
477
|
const isSelfUpdate = path === acceptedPath;
|
|
478
|
-
// make sure we only import each dep once
|
|
479
|
-
const modulesToUpdate = new Set();
|
|
480
|
-
if (isSelfUpdate) {
|
|
481
|
-
// self update - only update self
|
|
482
|
-
modulesToUpdate.add(path);
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
// dep update
|
|
486
|
-
for (const { deps } of mod.callbacks) {
|
|
487
|
-
deps.forEach((dep) => {
|
|
488
|
-
if (acceptedPath === dep) {
|
|
489
|
-
modulesToUpdate.add(dep);
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
478
|
// determine the qualified callbacks before we re-import the modules
|
|
495
|
-
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
await Promise.all(Array.from(modulesToUpdate).map(async (dep) => {
|
|
479
|
+
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
|
|
480
|
+
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
|
481
|
+
const dep = acceptedPath;
|
|
499
482
|
const disposer = disposeMap.get(dep);
|
|
500
483
|
if (disposer)
|
|
501
484
|
await disposer(dataMap.get(dep));
|
|
@@ -505,19 +488,19 @@ async function fetchUpdate({ path, acceptedPath, timestamp }) {
|
|
|
505
488
|
/* @vite-ignore */
|
|
506
489
|
base +
|
|
507
490
|
path.slice(1) +
|
|
508
|
-
|
|
491
|
+
`?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${query ? `&${query}` : ''}`);
|
|
509
492
|
moduleMap.set(dep, newMod);
|
|
510
493
|
}
|
|
511
494
|
catch (e) {
|
|
512
495
|
warnFailedFetch(e, dep);
|
|
513
496
|
}
|
|
514
|
-
}
|
|
497
|
+
}
|
|
515
498
|
return () => {
|
|
516
499
|
for (const { deps, fn } of qualifiedCallbacks) {
|
|
517
500
|
fn(deps.map((dep) => moduleMap.get(dep)));
|
|
518
501
|
}
|
|
519
502
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
|
520
|
-
console.
|
|
503
|
+
console.debug(`[vite] hot updated: ${loggedPath}`);
|
|
521
504
|
};
|
|
522
505
|
}
|
|
523
506
|
function sendMessageBuffer() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","sources":["../../src/client/overlay.ts","../../src/client/client.ts"],"sourcesContent":["import type { ErrorPayload } from 'types/hmrPayload'\n\nconst template = /*html*/ `\n<style>\n:host {\n position: fixed;\n z-index: 99999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n --monospace: 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --red: #ff5555;\n --yellow: #e2aa53;\n --purple: #cfa4ff;\n --cyan: #2dd9da;\n --dim: #c9c9c9;\n}\n\n.window {\n font-family: var(--monospace);\n line-height: 1.5;\n width: 800px;\n color: #d8d8d8;\n margin: 30px auto;\n padding: 25px 40px;\n position: relative;\n background: #181818;\n border-radius: 6px 6px 8px 8px;\n box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);\n overflow: hidden;\n border-top: 8px solid var(--red);\n direction: ltr;\n text-align: left;\n}\n\npre {\n font-family: var(--monospace);\n font-size: 16px;\n margin-top: 0;\n margin-bottom: 1em;\n overflow-x: scroll;\n scrollbar-width: none;\n}\n\npre::-webkit-scrollbar {\n display: none;\n}\n\n.message {\n line-height: 1.3;\n font-weight: 600;\n white-space: pre-wrap;\n}\n\n.message-body {\n color: var(--red);\n}\n\n.plugin {\n color: var(--purple);\n}\n\n.file {\n color: var(--cyan);\n margin-bottom: 0;\n white-space: pre-wrap;\n word-break: break-all;\n}\n\n.frame {\n color: var(--yellow);\n}\n\n.stack {\n font-size: 13px;\n color: var(--dim);\n}\n\n.tip {\n font-size: 13px;\n color: #999;\n border-top: 1px dotted #999;\n padding-top: 13px;\n}\n\ncode {\n font-size: 13px;\n font-family: var(--monospace);\n color: var(--yellow);\n}\n\n.file-link {\n text-decoration: underline;\n cursor: pointer;\n}\n</style>\n<div class=\"window\">\n <pre class=\"message\"><span class=\"plugin\"></span><span class=\"message-body\"></span></pre>\n <pre class=\"file\"></pre>\n <pre class=\"frame\"></pre>\n <pre class=\"stack\"></pre>\n <div class=\"tip\">\n Click outside or fix the code to dismiss.<br>\n You can also disable this overlay by setting\n <code>server.hmr.overlay</code> to <code>false</code> in <code>vite.config.js.</code>\n </div>\n</div>\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\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']) {\n super()\n this.root = this.attachShadow({ mode: 'open' })\n this.root.innerHTML = template\n\n codeframeRE.lastIndex = 0\n const hasFrame = err.frame && codeframeRE.test(err.frame)\n const message = hasFrame\n ? err.message.replace(codeframeRE, '')\n : err.message\n if (err.plugin) {\n this.text('.plugin', `[plugin:${err.plugin}] `)\n }\n this.text('.message-body', message.trim())\n\n const [file] = (err.loc?.file || err.id || 'unknown file').split(`?`)\n if (err.loc) {\n this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, true)\n } else if (err.id) {\n this.text('.file', file)\n }\n\n if (hasFrame) {\n this.text('.frame', err.frame!.trim())\n }\n this.text('.stack', err.stack, true)\n\n this.root.querySelector('.window')!.addEventListener('click', (e) => {\n e.stopPropagation()\n })\n this.addEventListener('click', () => {\n this.close()\n })\n }\n\n text(selector: string, text: string, linkFiles = false): void {\n const el = this.root.querySelector(selector)!\n if (!linkFiles) {\n el.textContent = text\n } else {\n let curIndex = 0\n let match: RegExpExecArray | null\n while ((match = fileRE.exec(text))) {\n const { 0: file, index } = match\n if (index != null) {\n const frag = text.slice(curIndex, index)\n el.appendChild(document.createTextNode(frag))\n const link = document.createElement('a')\n link.textContent = file\n link.className = 'file-link'\n link.onclick = () => {\n fetch('/__open-in-editor?file=' + encodeURIComponent(file))\n }\n el.appendChild(link)\n curIndex += frag.length + file.length\n }\n }\n }\n }\n\n close(): void {\n this.parentNode?.removeChild(this)\n }\n}\n\nexport const overlayId = 'vite-error-overlay'\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 payload.updates.forEach((update) => {\n if (update.type === 'js-update') {\n queueUpdate(fetchUpdate(update))\n } else {\n // css-update\n // this is only sent when a css file referenced with <link> is updated\n const { path, timestamp } = update\n const searchUrl = cleanUrl(path)\n // can't use querySelector with `[href*=]` here since the link may be\n // using relative paths so we need to use link.href to grab the full\n // URL for the include check.\n const el = Array.from(\n document.querySelectorAll<HTMLLinkElement>('link')\n ).find(\n (e) =>\n !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl)\n )\n if (el) {\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 const newLinkTag = el.cloneNode() as HTMLLinkElement\n newLinkTag.href = new URL(newPath, el.href).href\n const removeOldEl = () => el.remove()\n newLinkTag.addEventListener('load', removeOldEl)\n newLinkTag.addEventListener('error', removeOldEl)\n outdatedLinkTags.add(el)\n el.after(newLinkTag)\n }\n console.log(`[vite] css hot updated: ${searchUrl}`)\n }\n })\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 // @ts-expect-error: using experimental API\n style.replaceSync(content)\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]\n } else {\n // @ts-expect-error: using experimental API\n style.replaceSync(content)\n }\n } else {\n if (style && !(style instanceof HTMLStyleElement)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = document.createElement('style')\n style.setAttribute('type', 'text/css')\n style.innerHTML = content\n document.head.appendChild(style)\n } else {\n style.innerHTML = content\n }\n }\n sheetsMap.set(id, style)\n}\n\nexport function removeStyle(id: string): void {\n const style = sheetsMap.get(id)\n if (style) {\n if (style instanceof CSSStyleSheet) {\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = document.adoptedStyleSheets.filter(\n (s: CSSStyleSheet) => s !== style\n )\n } else {\n document.head.removeChild(style)\n }\n sheetsMap.delete(id)\n }\n}\n\nasync function fetchUpdate({ path, acceptedPath, timestamp }: Update) {\n const mod = hotModulesMap.get(path)\n if (!mod) {\n // In a code-splitting project,\n // it is common that the hot-updating module is not loaded yet.\n // https://github.com/vitejs/vite/issues/721\n return\n }\n\n const moduleMap = new Map<string, ModuleNamespace>()\n const isSelfUpdate = path === acceptedPath\n\n // make sure we only import each dep once\n const modulesToUpdate = new Set<string>()\n if (isSelfUpdate) {\n // self update - only update self\n modulesToUpdate.add(path)\n } else {\n // dep update\n for (const { deps } of mod.callbacks) {\n deps.forEach((dep) => {\n if (acceptedPath === dep) {\n modulesToUpdate.add(dep)\n }\n })\n }\n }\n\n // determine the qualified callbacks before we re-import the modules\n const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => {\n return deps.some((dep) => modulesToUpdate.has(dep))\n })\n\n await Promise.all(\n Array.from(modulesToUpdate).map(async (dep) => {\n const disposer = disposeMap.get(dep)\n if (disposer) await disposer(dataMap.get(dep))\n const [path, query] = dep.split(`?`)\n try {\n const newMod: ModuleNamespace = await import(\n /* @vite-ignore */\n base +\n path.slice(1) +\n `?import&t=${timestamp}${query ? `&${query}` : ''}`\n )\n moduleMap.set(dep, newMod)\n } catch (e) {\n warnFailedFetch(e, dep)\n }\n })\n )\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => moduleMap.get(dep)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.log(`[vite] hot updated: ${loggedPath}`)\n }\n}\n\nfunction sendMessageBuffer() {\n if (socket.readyState === 1) {\n messageBuffer.forEach((msg) => socket.send(msg))\n messageBuffer.length = 0\n }\n}\n\ninterface HotModule {\n id: string\n callbacks: HotCallback[]\n}\n\ninterface HotCallback {\n // the dependencies must be fetchable paths\n deps: string[]\n fn: (modules: 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 && deps(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => callback && callback(mod))\n } else if (Array.isArray(deps)) {\n acceptDeps(deps, callback)\n } else {\n throw new Error(`invalid hot.accept() usage.`)\n }\n },\n\n // export names (first arg) are irrelevant on the client side, they're\n // extracted in the server for propagation\n acceptExports(_: string | readonly string[], callback?: any) {\n acceptDeps([ownerPath], callback && (([mod]) => callback(mod)))\n },\n\n dispose(cb) {\n disposeMap.set(ownerPath, cb)\n },\n\n // @ts-expect-error untyped\n prune(cb: (data: any) => void) {\n pruneMap.set(ownerPath, cb)\n },\n\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n invalidate() {\n // TODO should tell the server to re-perform hmr propagation\n // from this module as root\n location.reload()\n },\n\n // custom events\n on(event, 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":[],"mappings":";;AAEA,MAAM,QAAQ,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8GzB,CAAA;AAED,MAAM,MAAM,GAAG,gCAAgC,CAAA;AAC/C,MAAM,WAAW,GAAG,0CAA0C,CAAA;AAE9D;AACA;AACA,MAAM,EAAE,WAAW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,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AACnE,YAAA,iBAAiB,EAAE,CAAA;SACpB;KACF,CAAA;AAED,IAAA,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;AAEG;AACa,SAAA,WAAW,CAAC,GAAW,EAAE,aAAqB,EAAA;;AAE5D,IAAA,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AAChD,QAAA,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
|
+
{"version":3,"file":"client.mjs","sources":["../../src/client/overlay.ts","../../src/client/client.ts"],"sourcesContent":["import type { ErrorPayload } from 'types/hmrPayload'\n\nconst template = /*html*/ `\n<style>\n:host {\n position: fixed;\n z-index: 99999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n --monospace: 'SFMono-Regular', Consolas,\n 'Liberation Mono', Menlo, Courier, monospace;\n --red: #ff5555;\n --yellow: #e2aa53;\n --purple: #cfa4ff;\n --cyan: #2dd9da;\n --dim: #c9c9c9;\n}\n\n.window {\n font-family: var(--monospace);\n line-height: 1.5;\n width: 800px;\n color: #d8d8d8;\n margin: 30px auto;\n padding: 25px 40px;\n position: relative;\n background: #181818;\n border-radius: 6px 6px 8px 8px;\n box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);\n overflow: hidden;\n border-top: 8px solid var(--red);\n direction: ltr;\n text-align: left;\n}\n\npre {\n font-family: var(--monospace);\n font-size: 16px;\n margin-top: 0;\n margin-bottom: 1em;\n overflow-x: scroll;\n scrollbar-width: none;\n}\n\npre::-webkit-scrollbar {\n display: none;\n}\n\n.message {\n line-height: 1.3;\n font-weight: 600;\n white-space: pre-wrap;\n}\n\n.message-body {\n color: var(--red);\n}\n\n.plugin {\n color: var(--purple);\n}\n\n.file {\n color: var(--cyan);\n margin-bottom: 0;\n white-space: pre-wrap;\n word-break: break-all;\n}\n\n.frame {\n color: var(--yellow);\n}\n\n.stack {\n font-size: 13px;\n color: var(--dim);\n}\n\n.tip {\n font-size: 13px;\n color: #999;\n border-top: 1px dotted #999;\n padding-top: 13px;\n}\n\ncode {\n font-size: 13px;\n font-family: var(--monospace);\n color: var(--yellow);\n}\n\n.file-link {\n text-decoration: underline;\n cursor: pointer;\n}\n</style>\n<div class=\"window\">\n <pre class=\"message\"><span class=\"plugin\"></span><span class=\"message-body\"></span></pre>\n <pre class=\"file\"></pre>\n <pre class=\"frame\"></pre>\n <pre class=\"stack\"></pre>\n <div class=\"tip\">\n Click outside or fix the code to dismiss.<br>\n You can also disable this overlay by setting\n <code>server.hmr.overlay</code> to <code>false</code> in <code>vite.config.js.</code>\n </div>\n</div>\n`\n\nconst fileRE = /(?:[a-zA-Z]:\\\\|\\/).*?:\\d+:\\d+/g\nconst codeframeRE = /^(?:>?\\s+\\d+\\s+\\|.*|\\s+\\|\\s*\\^.*)\\r?\\n/gm\n\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']) {\n super()\n this.root = this.attachShadow({ mode: 'open' })\n this.root.innerHTML = template\n\n codeframeRE.lastIndex = 0\n const hasFrame = err.frame && codeframeRE.test(err.frame)\n const message = hasFrame\n ? err.message.replace(codeframeRE, '')\n : err.message\n if (err.plugin) {\n this.text('.plugin', `[plugin:${err.plugin}] `)\n }\n this.text('.message-body', message.trim())\n\n const [file] = (err.loc?.file || err.id || 'unknown file').split(`?`)\n if (err.loc) {\n this.text('.file', `${file}:${err.loc.line}:${err.loc.column}`, true)\n } else if (err.id) {\n this.text('.file', file)\n }\n\n if (hasFrame) {\n this.text('.frame', err.frame!.trim())\n }\n this.text('.stack', err.stack, true)\n\n this.root.querySelector('.window')!.addEventListener('click', (e) => {\n e.stopPropagation()\n })\n this.addEventListener('click', () => {\n this.close()\n })\n }\n\n text(selector: string, text: string, linkFiles = false): void {\n const el = this.root.querySelector(selector)!\n if (!linkFiles) {\n el.textContent = text\n } else {\n let curIndex = 0\n let match: RegExpExecArray | null\n while ((match = fileRE.exec(text))) {\n const { 0: file, index } = match\n if (index != null) {\n const frag = text.slice(curIndex, index)\n el.appendChild(document.createTextNode(frag))\n const link = document.createElement('a')\n link.textContent = file\n link.className = 'file-link'\n link.onclick = () => {\n fetch('/__open-in-editor?file=' + encodeURIComponent(file))\n }\n el.appendChild(link)\n curIndex += frag.length + file.length\n }\n }\n }\n }\n\n close(): void {\n this.parentNode?.removeChild(this)\n }\n}\n\nexport const overlayId = 'vite-error-overlay'\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 payload.updates.forEach((update) => {\n if (update.type === 'js-update') {\n queueUpdate(fetchUpdate(update))\n } else {\n // css-update\n // this is only sent when a css file referenced with <link> is updated\n const { path, timestamp } = update\n const searchUrl = cleanUrl(path)\n // can't use querySelector with `[href*=]` here since the link may be\n // using relative paths so we need to use link.href to grab the full\n // URL for the include check.\n const el = Array.from(\n document.querySelectorAll<HTMLLinkElement>('link')\n ).find(\n (e) =>\n !outdatedLinkTags.has(e) && cleanUrl(e.href).includes(searchUrl)\n )\n if (el) {\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 const newLinkTag = el.cloneNode() as HTMLLinkElement\n newLinkTag.href = new URL(newPath, el.href).href\n const removeOldEl = () => el.remove()\n newLinkTag.addEventListener('load', removeOldEl)\n newLinkTag.addEventListener('error', removeOldEl)\n outdatedLinkTags.add(el)\n el.after(newLinkTag)\n }\n console.debug(`[vite] css hot updated: ${searchUrl}`)\n }\n })\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 // @ts-expect-error: using experimental API\n style.replaceSync(content)\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]\n } else {\n // @ts-expect-error: using experimental API\n style.replaceSync(content)\n }\n } else {\n if (style && !(style instanceof HTMLStyleElement)) {\n removeStyle(id)\n style = undefined\n }\n\n if (!style) {\n style = document.createElement('style')\n style.setAttribute('type', 'text/css')\n style.innerHTML = content\n document.head.appendChild(style)\n } else {\n style.innerHTML = content\n }\n }\n sheetsMap.set(id, style)\n}\n\nexport function removeStyle(id: string): void {\n const style = sheetsMap.get(id)\n if (style) {\n if (style instanceof CSSStyleSheet) {\n // @ts-expect-error: using experimental API\n document.adoptedStyleSheets = document.adoptedStyleSheets.filter(\n (s: CSSStyleSheet) => s !== style\n )\n } else {\n document.head.removeChild(style)\n }\n sheetsMap.delete(id)\n }\n}\n\nasync function fetchUpdate({\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 const moduleMap = new Map<string, ModuleNamespace>()\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 dep = acceptedPath\n const disposer = disposeMap.get(dep)\n if (disposer) await disposer(dataMap.get(dep))\n const [path, query] = dep.split(`?`)\n try {\n const newMod: ModuleNamespace = await import(\n /* @vite-ignore */\n base +\n path.slice(1) +\n `?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${\n query ? `&${query}` : ''\n }`\n )\n moduleMap.set(dep, newMod)\n } catch (e) {\n warnFailedFetch(e, dep)\n }\n }\n\n return () => {\n for (const { deps, fn } of qualifiedCallbacks) {\n fn(deps.map((dep) => moduleMap.get(dep)))\n }\n const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`\n console.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 && deps(mod))\n } else if (typeof deps === 'string') {\n // explicit deps\n acceptDeps([deps], ([mod]) => callback && callback(mod))\n } else if (Array.isArray(deps)) {\n acceptDeps(deps, callback)\n } else {\n throw new Error(`invalid hot.accept() usage.`)\n }\n },\n\n // export names (first arg) are irrelevant on the client side, they're\n // extracted in the server for propagation\n acceptExports(_: string | readonly string[], callback?: any) {\n acceptDeps([ownerPath], callback && (([mod]) => callback(mod)))\n },\n\n dispose(cb) {\n disposeMap.set(ownerPath, cb)\n },\n\n // @ts-expect-error untyped\n prune(cb: (data: any) => void) {\n pruneMap.set(ownerPath, cb)\n },\n\n // TODO\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n decline() {},\n\n invalidate() {\n // TODO should tell the server to re-perform hmr propagation\n // from this module as root\n location.reload()\n },\n\n // custom events\n on(event, 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":[],"mappings":";;AAEA,MAAM,QAAQ,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8GzB,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,EAAA;;AAClC,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,IAAI,GAAG,CAAC,MAAM,EAAE;YACd,IAAI,CAAC,IAAI,CA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AAE,IAAI,EAAA;AACd,YAAA,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AACnE,YAAA,iBAAiB,EAAE,CAAA;SACpB;KACF,CAAA;AAED,IAAA,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;AAEG;AACa,SAAA,WAAW,CAAC,GAAW,EAAE,aAAqB,EAAA;;AAE5D,IAAA,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AAChD,QAAA,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;;;;"}
|
|
@@ -272,7 +272,7 @@ var processContent$1 = function processContent(
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
// Syntax support:
|
|
275
|
-
if (result.opts.syntax
|
|
275
|
+
if (result.opts.syntax?.parse) {
|
|
276
276
|
parserList.push(result.opts.syntax.parse);
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -491,6 +491,7 @@ function AtImport(options) {
|
|
|
491
491
|
load: loadContent,
|
|
492
492
|
plugins: [],
|
|
493
493
|
addModulesDirectories: [],
|
|
494
|
+
nameLayer: null,
|
|
494
495
|
...options,
|
|
495
496
|
};
|
|
496
497
|
|
|
@@ -509,9 +510,12 @@ function AtImport(options) {
|
|
|
509
510
|
const state = {
|
|
510
511
|
importedFiles: {},
|
|
511
512
|
hashFiles: {},
|
|
513
|
+
rootFilename: null,
|
|
514
|
+
anonymousLayerCounter: 0,
|
|
512
515
|
};
|
|
513
516
|
|
|
514
|
-
if (styles.source
|
|
517
|
+
if (styles.source?.input?.file) {
|
|
518
|
+
state.rootFilename = styles.source.input.file;
|
|
515
519
|
state.importedFiles[styles.source.input.file] = {};
|
|
516
520
|
}
|
|
517
521
|
|
|
@@ -519,6 +523,10 @@ function AtImport(options) {
|
|
|
519
523
|
throw new Error("plugins option must be an array")
|
|
520
524
|
}
|
|
521
525
|
|
|
526
|
+
if (options.nameLayer && typeof options.nameLayer !== "function") {
|
|
527
|
+
throw new Error("nameLayer option must be a function")
|
|
528
|
+
}
|
|
529
|
+
|
|
522
530
|
return parseStyles(result, styles, options, state, [], []).then(
|
|
523
531
|
bundle => {
|
|
524
532
|
applyRaws(bundle);
|
|
@@ -553,7 +561,30 @@ function AtImport(options) {
|
|
|
553
561
|
if (stmt.type === "import") {
|
|
554
562
|
stmt.node.params = `${stmt.fullUri} ${stmt.media.join(", ")}`;
|
|
555
563
|
} else if (stmt.type === "media") {
|
|
556
|
-
|
|
564
|
+
if (stmt.layer.length) {
|
|
565
|
+
const layerNode = atRule({
|
|
566
|
+
name: "layer",
|
|
567
|
+
params: stmt.layer.filter(layer => layer !== "").join("."),
|
|
568
|
+
source: stmt.node.source,
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
if (stmt.parentMedia?.length) {
|
|
572
|
+
const mediaNode = atRule({
|
|
573
|
+
name: "media",
|
|
574
|
+
params: stmt.parentMedia.join(", "),
|
|
575
|
+
source: stmt.node.source,
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
mediaNode.append(layerNode);
|
|
579
|
+
layerNode.append(stmt.node);
|
|
580
|
+
stmt.node = mediaNode;
|
|
581
|
+
} else {
|
|
582
|
+
layerNode.append(stmt.node);
|
|
583
|
+
stmt.node = layerNode;
|
|
584
|
+
}
|
|
585
|
+
} else {
|
|
586
|
+
stmt.node.params = stmt.media.join(", ");
|
|
587
|
+
}
|
|
557
588
|
} else {
|
|
558
589
|
const { nodes } = stmt;
|
|
559
590
|
const { parent } = nodes[0];
|
|
@@ -642,6 +673,7 @@ function AtImport(options) {
|
|
|
642
673
|
return stmts.reduce((promise, stmt) => {
|
|
643
674
|
return promise.then(() => {
|
|
644
675
|
stmt.media = joinMedia(media, stmt.media || []);
|
|
676
|
+
stmt.parentMedia = media;
|
|
645
677
|
stmt.layer = joinLayer(layer, stmt.layer || []);
|
|
646
678
|
|
|
647
679
|
// skip protocol base uri (protocol://url) or protocol-relative
|
|
@@ -708,7 +740,7 @@ function AtImport(options) {
|
|
|
708
740
|
function resolveImportId(result, stmt, options, state) {
|
|
709
741
|
const atRule = stmt.node;
|
|
710
742
|
let sourceFile;
|
|
711
|
-
if (atRule.source
|
|
743
|
+
if (atRule.source?.input?.file) {
|
|
712
744
|
sourceFile = atRule.source.input.file;
|
|
713
745
|
}
|
|
714
746
|
const base = sourceFile
|
|
@@ -755,18 +787,34 @@ function AtImport(options) {
|
|
|
755
787
|
function loadImportContent(result, stmt, filename, options, state) {
|
|
756
788
|
const atRule = stmt.node;
|
|
757
789
|
const { media, layer } = stmt;
|
|
790
|
+
layer.forEach((layerPart, i) => {
|
|
791
|
+
if (layerPart === "") {
|
|
792
|
+
if (options.nameLayer) {
|
|
793
|
+
layer[i] = options
|
|
794
|
+
.nameLayer(state.anonymousLayerCounter++, state.rootFilename)
|
|
795
|
+
.toString();
|
|
796
|
+
} else {
|
|
797
|
+
throw atRule.error(
|
|
798
|
+
`When using anonymous layers in @import you must also set the "nameLayer" plugin option`
|
|
799
|
+
)
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
|
|
758
804
|
if (options.skipDuplicates) {
|
|
759
805
|
// skip files already imported at the same scope
|
|
760
|
-
if (
|
|
761
|
-
state.importedFiles[filename] &&
|
|
762
|
-
state.importedFiles[filename][media]
|
|
763
|
-
) {
|
|
806
|
+
if (state.importedFiles[filename]?.[media]?.[layer]) {
|
|
764
807
|
return
|
|
765
808
|
}
|
|
766
809
|
|
|
767
810
|
// save imported files to skip them next time
|
|
768
|
-
if (!state.importedFiles[filename])
|
|
769
|
-
|
|
811
|
+
if (!state.importedFiles[filename]) {
|
|
812
|
+
state.importedFiles[filename] = {};
|
|
813
|
+
}
|
|
814
|
+
if (!state.importedFiles[filename][media]) {
|
|
815
|
+
state.importedFiles[filename][media] = {};
|
|
816
|
+
}
|
|
817
|
+
state.importedFiles[filename][media][layer] = true;
|
|
770
818
|
}
|
|
771
819
|
|
|
772
820
|
return Promise.resolve(options.load(filename, options)).then(
|
|
@@ -777,8 +825,9 @@ function AtImport(options) {
|
|
|
777
825
|
}
|
|
778
826
|
|
|
779
827
|
// skip previous imported files not containing @import rules
|
|
780
|
-
if (state.hashFiles[content]
|
|
828
|
+
if (state.hashFiles[content]?.[media]?.[layer]) {
|
|
781
829
|
return
|
|
830
|
+
}
|
|
782
831
|
|
|
783
832
|
return processContent(
|
|
784
833
|
result,
|
|
@@ -796,8 +845,13 @@ function AtImport(options) {
|
|
|
796
845
|
});
|
|
797
846
|
if (!hasImport) {
|
|
798
847
|
// save hash files to skip them next time
|
|
799
|
-
if (!state.hashFiles[content])
|
|
800
|
-
|
|
848
|
+
if (!state.hashFiles[content]) {
|
|
849
|
+
state.hashFiles[content] = {};
|
|
850
|
+
}
|
|
851
|
+
if (!state.hashFiles[content][media]) {
|
|
852
|
+
state.hashFiles[content][media] = {};
|
|
853
|
+
}
|
|
854
|
+
state.hashFiles[content][media][layer] = true;
|
|
801
855
|
}
|
|
802
856
|
}
|
|
803
857
|
|
|
@@ -22,7 +22,7 @@ import { createHash as createHash$2 } from 'node:crypto';
|
|
|
22
22
|
import { promisify as promisify$4 } from 'node:util';
|
|
23
23
|
import { promises } from 'node:dns';
|
|
24
24
|
import resolve$5 from 'resolve';
|
|
25
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, SPECIAL_QUERY_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, NULL_BYTE_PLACEHOLDER,
|
|
25
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, SPECIAL_QUERY_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, NULL_BYTE_PLACEHOLDER, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION, VITE_PACKAGE_DIR, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
26
26
|
import require$$5 from 'crypto';
|
|
27
27
|
import require$$0$a from 'buffer';
|
|
28
28
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
@@ -11901,10 +11901,8 @@ function posToNumber(source, pos) {
|
|
|
11901
11901
|
const lines = source.split(splitRE);
|
|
11902
11902
|
const { line, column } = pos;
|
|
11903
11903
|
let start = 0;
|
|
11904
|
-
for (let i = 0; i < line - 1; i++) {
|
|
11905
|
-
|
|
11906
|
-
start += lines[i].length + 1;
|
|
11907
|
-
}
|
|
11904
|
+
for (let i = 0; i < line - 1 && i < lines.length; i++) {
|
|
11905
|
+
start += lines[i].length + 1;
|
|
11908
11906
|
}
|
|
11909
11907
|
return start + column;
|
|
11910
11908
|
}
|
|
@@ -34116,11 +34114,14 @@ function watchPackageDataPlugin(config) {
|
|
|
34116
34114
|
};
|
|
34117
34115
|
}
|
|
34118
34116
|
|
|
34117
|
+
const normalizedClientEntry$1 = normalizePath$3(CLIENT_ENTRY);
|
|
34118
|
+
const normalizedEnvEntry$1 = normalizePath$3(ENV_ENTRY);
|
|
34119
34119
|
// special id for paths marked with browser: false
|
|
34120
34120
|
// https://github.com/defunctzombie/package-browser-field-spec#ignore-a-module
|
|
34121
34121
|
const browserExternalId = '__vite-browser-external';
|
|
34122
34122
|
// special id for packages that are optional peer deps
|
|
34123
34123
|
const optionalPeerDepId = '__vite-optional-peer-dep';
|
|
34124
|
+
const nodeModulesInPathRE = /(^|\/)node_modules\//;
|
|
34124
34125
|
const isDebug$4 = process.env.DEBUG;
|
|
34125
34126
|
const debug$c = createDebugger('vite:resolve-details', {
|
|
34126
34127
|
onlyWhenFocused: true
|
|
@@ -34166,6 +34167,25 @@ function resolvePlugin(resolveOptions) {
|
|
|
34166
34167
|
: normalizePath$3(ensureVolumeInPath(path$n.resolve(root, id.slice(1))));
|
|
34167
34168
|
return optimizedPath;
|
|
34168
34169
|
}
|
|
34170
|
+
const ensureVersionQuery = (resolved) => {
|
|
34171
|
+
if (!options.isBuild &&
|
|
34172
|
+
depsOptimizer &&
|
|
34173
|
+
!(resolved === normalizedClientEntry$1 ||
|
|
34174
|
+
resolved === normalizedEnvEntry$1)) {
|
|
34175
|
+
// Ensure that direct imports of node_modules have the same version query
|
|
34176
|
+
// as if they would have been imported through a bare import
|
|
34177
|
+
// Use the original id to do the check as the resolved id may be the real
|
|
34178
|
+
// file path after symlinks resolution
|
|
34179
|
+
const isNodeModule = !!normalizePath$3(id).match(nodeModulesInPathRE);
|
|
34180
|
+
if (isNodeModule && !resolved.match(DEP_VERSION_RE)) {
|
|
34181
|
+
const versionHash = depsOptimizer.metadata.browserHash;
|
|
34182
|
+
if (versionHash && OPTIMIZABLE_ENTRY_RE.test(resolved)) {
|
|
34183
|
+
resolved = injectQuery(resolved, `v=${versionHash}`);
|
|
34184
|
+
}
|
|
34185
|
+
}
|
|
34186
|
+
}
|
|
34187
|
+
return resolved;
|
|
34188
|
+
};
|
|
34169
34189
|
// explicit fs paths that starts with /@fs/*
|
|
34170
34190
|
if (asSrc && id.startsWith(FS_PREFIX)) {
|
|
34171
34191
|
const fsPath = fsPathFromId(id);
|
|
@@ -34173,7 +34193,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
34173
34193
|
isDebug$4 && debug$c(`[@fs] ${picocolors.exports.cyan(id)} -> ${picocolors.exports.dim(res)}`);
|
|
34174
34194
|
// always return here even if res doesn't exist since /@fs/ is explicit
|
|
34175
34195
|
// if the file doesn't exist it should be a 404
|
|
34176
|
-
return res || fsPath;
|
|
34196
|
+
return ensureVersionQuery(res || fsPath);
|
|
34177
34197
|
}
|
|
34178
34198
|
// URL
|
|
34179
34199
|
// /foo -> /fs-root/foo
|
|
@@ -34181,7 +34201,7 @@ function resolvePlugin(resolveOptions) {
|
|
|
34181
34201
|
const fsPath = path$n.resolve(root, id.slice(1));
|
|
34182
34202
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
34183
34203
|
isDebug$4 && debug$c(`[url] ${picocolors.exports.cyan(id)} -> ${picocolors.exports.dim(res)}`);
|
|
34184
|
-
return res;
|
|
34204
|
+
return ensureVersionQuery(res);
|
|
34185
34205
|
}
|
|
34186
34206
|
}
|
|
34187
34207
|
// relative
|
|
@@ -34202,21 +34222,12 @@ function resolvePlugin(resolveOptions) {
|
|
|
34202
34222
|
}
|
|
34203
34223
|
return normalizedFsPath;
|
|
34204
34224
|
}
|
|
34205
|
-
const pathFromBasedir = normalizedFsPath.slice(basedir.length);
|
|
34206
|
-
if (pathFromBasedir.startsWith('/node_modules/')) {
|
|
34207
|
-
// normalize direct imports from node_modules to bare imports, so the
|
|
34208
|
-
// hashing logic is shared and we avoid duplicated modules #2503
|
|
34209
|
-
const bareImport = pathFromBasedir.slice('/node_modules/'.length);
|
|
34210
|
-
if ((res = tryNodeResolve(bareImport, importer, options, targetWeb, depsOptimizer, ssr)) &&
|
|
34211
|
-
res.id.startsWith(normalizedFsPath)) {
|
|
34212
|
-
return res;
|
|
34213
|
-
}
|
|
34214
|
-
}
|
|
34215
34225
|
if (targetWeb &&
|
|
34216
34226
|
(res = tryResolveBrowserMapping(fsPath, importer, options, true))) {
|
|
34217
34227
|
return res;
|
|
34218
34228
|
}
|
|
34219
34229
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
34230
|
+
res = ensureVersionQuery(res);
|
|
34220
34231
|
isDebug$4 &&
|
|
34221
34232
|
debug$c(`[relative] ${picocolors.exports.cyan(id)} -> ${picocolors.exports.dim(res)}`);
|
|
34222
34233
|
const pkg = importer != null && idToPkgMap.get(importer);
|
|
@@ -34237,14 +34248,14 @@ function resolvePlugin(resolveOptions) {
|
|
|
34237
34248
|
if ((res = tryFsResolve(fsPath, options))) {
|
|
34238
34249
|
isDebug$4 &&
|
|
34239
34250
|
debug$c(`[drive-relative] ${picocolors.exports.cyan(id)} -> ${picocolors.exports.dim(res)}`);
|
|
34240
|
-
return res;
|
|
34251
|
+
return ensureVersionQuery(res);
|
|
34241
34252
|
}
|
|
34242
34253
|
}
|
|
34243
34254
|
// absolute fs paths
|
|
34244
34255
|
if (isNonDriveRelativeAbsolutePath(id) &&
|
|
34245
34256
|
(res = tryFsResolve(id, options))) {
|
|
34246
34257
|
isDebug$4 && debug$c(`[fs] ${picocolors.exports.cyan(id)} -> ${picocolors.exports.dim(res)}`);
|
|
34247
|
-
return res;
|
|
34258
|
+
return ensureVersionQuery(res);
|
|
34248
34259
|
}
|
|
34249
34260
|
// external
|
|
34250
34261
|
if (isExternalUrl(id)) {
|
|
@@ -34348,7 +34359,7 @@ function splitFileAndPostfix(path) {
|
|
|
34348
34359
|
function tryFsResolve(fsPath, options, tryIndex = true, targetWeb = true) {
|
|
34349
34360
|
const { file, postfix } = splitFileAndPostfix(fsPath);
|
|
34350
34361
|
let res;
|
|
34351
|
-
// if
|
|
34362
|
+
// if there is a postfix, try resolving it as a complete path first (#4703)
|
|
34352
34363
|
if (postfix &&
|
|
34353
34364
|
(res = tryResolveFile(fsPath, '', options, false, targetWeb, options.tryPrefix, options.skipPackageJson))) {
|
|
34354
34365
|
return res;
|
|
@@ -35116,21 +35127,6 @@ module.exports = Object.create(new Proxy({}, {
|
|
|
35116
35127
|
};
|
|
35117
35128
|
}
|
|
35118
35129
|
});
|
|
35119
|
-
// yarn 2 pnp compat
|
|
35120
|
-
if (isRunningWithYarnPnp) {
|
|
35121
|
-
build.onResolve({ filter: /.*/ }, async ({ path: id, importer, kind, resolveDir, namespace }) => {
|
|
35122
|
-
const resolved = await resolve(id, importer, kind,
|
|
35123
|
-
// pass along resolveDir for entries
|
|
35124
|
-
namespace === 'dep' ? resolveDir : undefined);
|
|
35125
|
-
if (resolved) {
|
|
35126
|
-
return resolveResult(id, resolved);
|
|
35127
|
-
}
|
|
35128
|
-
});
|
|
35129
|
-
build.onLoad({ filter: /.*/ }, async (args) => ({
|
|
35130
|
-
contents: await promises$2.readFile(args.path),
|
|
35131
|
-
loader: 'default'
|
|
35132
|
-
}));
|
|
35133
|
-
}
|
|
35134
35130
|
}
|
|
35135
35131
|
};
|
|
35136
35132
|
}
|
|
@@ -35927,13 +35923,37 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
|
35927
35923
|
files: matchedFiles
|
|
35928
35924
|
};
|
|
35929
35925
|
}
|
|
35926
|
+
function globSafePath(path) {
|
|
35927
|
+
// slash path to ensure \ is converted to / as \ could lead to a double escape scenario
|
|
35928
|
+
// see https://github.com/mrmlnc/fast-glob#advanced-syntax
|
|
35929
|
+
return out.escapePath(normalizePath$3(path));
|
|
35930
|
+
}
|
|
35931
|
+
function lastNthChar(str, n) {
|
|
35932
|
+
return str.charAt(str.length - 1 - n);
|
|
35933
|
+
}
|
|
35934
|
+
function globSafeResolvedPath(resolved, glob) {
|
|
35935
|
+
// we have to escape special glob characters in the resolved path, but keep the user specified globby suffix
|
|
35936
|
+
// walk back both strings until a character difference is found
|
|
35937
|
+
// then slice up the resolved path at that pos and escape the first part
|
|
35938
|
+
let numEqual = 0;
|
|
35939
|
+
const maxEqual = Math.min(resolved.length, glob.length);
|
|
35940
|
+
while (numEqual < maxEqual &&
|
|
35941
|
+
lastNthChar(resolved, numEqual) === lastNthChar(glob, numEqual)) {
|
|
35942
|
+
numEqual += 1;
|
|
35943
|
+
}
|
|
35944
|
+
const staticPartEnd = resolved.length - numEqual;
|
|
35945
|
+
const staticPart = resolved.slice(0, staticPartEnd);
|
|
35946
|
+
const dynamicPart = resolved.slice(staticPartEnd);
|
|
35947
|
+
return globSafePath(staticPart) + dynamicPart;
|
|
35948
|
+
}
|
|
35930
35949
|
async function toAbsoluteGlob(glob, root, importer, resolveId) {
|
|
35931
35950
|
let pre = '';
|
|
35932
35951
|
if (glob.startsWith('!')) {
|
|
35933
35952
|
pre = '!';
|
|
35934
35953
|
glob = glob.slice(1);
|
|
35935
35954
|
}
|
|
35936
|
-
|
|
35955
|
+
root = globSafePath(root);
|
|
35956
|
+
const dir = importer ? globSafePath(dirname(importer)) : root;
|
|
35937
35957
|
if (glob.startsWith('/'))
|
|
35938
35958
|
return pre + posix$2.join(root, glob.slice(1));
|
|
35939
35959
|
if (glob.startsWith('./'))
|
|
@@ -35943,8 +35963,9 @@ async function toAbsoluteGlob(glob, root, importer, resolveId) {
|
|
|
35943
35963
|
if (glob.startsWith('**'))
|
|
35944
35964
|
return pre + glob;
|
|
35945
35965
|
const resolved = normalizePath$3((await resolveId(glob, importer)) || glob);
|
|
35946
|
-
if (isAbsolute$2(resolved))
|
|
35947
|
-
return pre + resolved;
|
|
35966
|
+
if (isAbsolute$2(resolved)) {
|
|
35967
|
+
return pre + globSafeResolvedPath(resolved, glob);
|
|
35968
|
+
}
|
|
35948
35969
|
throw new Error(`Invalid glob: "${glob}" (resolved: "${resolved}"). It must start with '/' or './'`);
|
|
35949
35970
|
}
|
|
35950
35971
|
function getCommonBase(globsResolved) {
|
|
@@ -36068,6 +36089,9 @@ function updateModules(file, modules, timestamp, { config, ws }) {
|
|
|
36068
36089
|
type: `${boundary.type}-update`,
|
|
36069
36090
|
timestamp,
|
|
36070
36091
|
path: boundary.url,
|
|
36092
|
+
explicitImportRequired: boundary.type === 'js'
|
|
36093
|
+
? isExplicitImportRequired(acceptedVia.url)
|
|
36094
|
+
: undefined,
|
|
36071
36095
|
acceptedPath: acceptedVia.url
|
|
36072
36096
|
})));
|
|
36073
36097
|
}
|
|
@@ -38205,7 +38229,7 @@ function webWorkerPlugin(config) {
|
|
|
38205
38229
|
const ssr = options?.ssr === true;
|
|
38206
38230
|
const query = parseRequest(id);
|
|
38207
38231
|
if (query && query[WORKER_FILE_ID] != null) {
|
|
38208
|
-
// if import worker by worker constructor will
|
|
38232
|
+
// if import worker by worker constructor will have query.type
|
|
38209
38233
|
// other type will be import worker by esm
|
|
38210
38234
|
const workerType = query['type'];
|
|
38211
38235
|
let injectEnv = '';
|
|
@@ -38358,7 +38382,7 @@ function preAliasPlugin(config) {
|
|
|
38358
38382
|
});
|
|
38359
38383
|
if (resolved && !depsOptimizer.isOptimizedDepFile(resolved.id)) {
|
|
38360
38384
|
const optimizeDeps = depsOptimizer.options;
|
|
38361
|
-
const resolvedId = resolved.id;
|
|
38385
|
+
const resolvedId = cleanUrl(resolved.id);
|
|
38362
38386
|
const isVirtual = resolvedId === id || resolvedId.includes('\0');
|
|
38363
38387
|
if (!isVirtual &&
|
|
38364
38388
|
fs$l.existsSync(resolvedId) &&
|
|
@@ -43294,7 +43318,7 @@ function buildHtmlPlugin(config) {
|
|
|
43294
43318
|
name: 'vite:build-html',
|
|
43295
43319
|
async transform(html, id) {
|
|
43296
43320
|
if (id.endsWith('.html')) {
|
|
43297
|
-
const relativeUrlPath =
|
|
43321
|
+
const relativeUrlPath = path$n.posix.relative(config.root, normalizePath$3(id));
|
|
43298
43322
|
const publicPath = `/${relativeUrlPath}`;
|
|
43299
43323
|
const publicBase = getBaseInHTML(relativeUrlPath, config);
|
|
43300
43324
|
const publicToRelative = (filename, importer) => publicBase + filename;
|
|
@@ -43567,7 +43591,7 @@ function buildHtmlPlugin(config) {
|
|
|
43567
43591
|
return tags;
|
|
43568
43592
|
};
|
|
43569
43593
|
for (const [id, html] of processedHtml) {
|
|
43570
|
-
const relativeUrlPath = path$n.posix.relative(config.root, id);
|
|
43594
|
+
const relativeUrlPath = path$n.posix.relative(config.root, normalizePath$3(id));
|
|
43571
43595
|
const assetsBase = getBaseInHTML(relativeUrlPath, config);
|
|
43572
43596
|
const toOutputFilePath = (filename, type) => {
|
|
43573
43597
|
if (isExternalUrl(filename)) {
|
|
@@ -44057,7 +44081,7 @@ function cssPostPlugin(config) {
|
|
|
44057
44081
|
}
|
|
44058
44082
|
const cssContent = await getContentWithSourcemap(css);
|
|
44059
44083
|
const devBase = config.base;
|
|
44060
|
-
|
|
44084
|
+
const code = [
|
|
44061
44085
|
`import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path$n.posix.join(devBase, CLIENT_PUBLIC_PATH))}`,
|
|
44062
44086
|
`const __vite__id = ${JSON.stringify(id)}`,
|
|
44063
44087
|
`const __vite__css = ${JSON.stringify(cssContent)}`,
|
|
@@ -44067,6 +44091,7 @@ function cssPostPlugin(config) {
|
|
|
44067
44091
|
`import.meta.hot.accept()\nexport default __vite__css`}`,
|
|
44068
44092
|
`import.meta.hot.prune(() => __vite__removeStyle(__vite__id))`
|
|
44069
44093
|
].join('\n');
|
|
44094
|
+
return { code, map: { mappings: '' } };
|
|
44070
44095
|
}
|
|
44071
44096
|
// build CSS handling ----------------------------------------------------
|
|
44072
44097
|
// record css
|
|
@@ -44363,8 +44388,8 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
44363
44388
|
opts.filename = cleanUrl(id);
|
|
44364
44389
|
opts.enableSourcemap = devSourcemap ?? false;
|
|
44365
44390
|
const preprocessResult = await preProcessor(code, config.root, opts, atImportResolvers);
|
|
44366
|
-
if (preprocessResult.
|
|
44367
|
-
throw preprocessResult.
|
|
44391
|
+
if (preprocessResult.error) {
|
|
44392
|
+
throw preprocessResult.error;
|
|
44368
44393
|
}
|
|
44369
44394
|
code = preprocessResult.code;
|
|
44370
44395
|
preprocessorMap = combineSourcemapsIfExists(opts.filename, preprocessResult.map, preprocessResult.additionalMap);
|
|
@@ -44381,7 +44406,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
44381
44406
|
const postcssOptions = (postcssConfig && postcssConfig.options) || {};
|
|
44382
44407
|
const postcssPlugins = postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [];
|
|
44383
44408
|
if (needInlineImport) {
|
|
44384
|
-
postcssPlugins.unshift((await import('./dep-
|
|
44409
|
+
postcssPlugins.unshift((await import('./dep-42c2c4e4.js').then(function (n) { return n.i; })).default({
|
|
44385
44410
|
async resolve(id, basedir) {
|
|
44386
44411
|
const publicFile = checkPublicFile(id, config);
|
|
44387
44412
|
if (publicFile) {
|
|
@@ -44392,6 +44417,9 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
44392
44417
|
return path$n.resolve(resolved);
|
|
44393
44418
|
}
|
|
44394
44419
|
return id;
|
|
44420
|
+
},
|
|
44421
|
+
nameLayer(index) {
|
|
44422
|
+
return `vite--anon-layer-${getHash(id)}-${index}`;
|
|
44395
44423
|
}
|
|
44396
44424
|
}));
|
|
44397
44425
|
}
|
|
@@ -44400,7 +44428,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
44400
44428
|
logger: config.logger
|
|
44401
44429
|
}));
|
|
44402
44430
|
if (isModule) {
|
|
44403
|
-
postcssPlugins.unshift((await import('./dep-
|
|
44431
|
+
postcssPlugins.unshift((await import('./dep-6fd76b3e.js').then(function (n) { return n.i; })).default({
|
|
44404
44432
|
...modulesOptions,
|
|
44405
44433
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
44406
44434
|
modules = _modules;
|
|
@@ -44425,56 +44453,68 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
44425
44453
|
map: preprocessorMap
|
|
44426
44454
|
};
|
|
44427
44455
|
}
|
|
44428
|
-
|
|
44429
|
-
|
|
44430
|
-
|
|
44431
|
-
|
|
44432
|
-
|
|
44433
|
-
|
|
44434
|
-
|
|
44435
|
-
|
|
44436
|
-
|
|
44437
|
-
|
|
44438
|
-
|
|
44439
|
-
|
|
44440
|
-
|
|
44441
|
-
|
|
44442
|
-
|
|
44443
|
-
|
|
44444
|
-
|
|
44456
|
+
let postcssResult;
|
|
44457
|
+
try {
|
|
44458
|
+
// postcss is an unbundled dep and should be lazy imported
|
|
44459
|
+
postcssResult = await (await import('postcss'))
|
|
44460
|
+
.default(postcssPlugins)
|
|
44461
|
+
.process(code, {
|
|
44462
|
+
...postcssOptions,
|
|
44463
|
+
to: id,
|
|
44464
|
+
from: id,
|
|
44465
|
+
...(devSourcemap
|
|
44466
|
+
? {
|
|
44467
|
+
map: {
|
|
44468
|
+
inline: false,
|
|
44469
|
+
annotation: false,
|
|
44470
|
+
// postcss may return virtual files
|
|
44471
|
+
// we cannot obtain content of them, so this needs to be enabled
|
|
44472
|
+
sourcesContent: true
|
|
44473
|
+
// when "prev: preprocessorMap", the result map may include duplicate filename in `postcssResult.map.sources`
|
|
44474
|
+
// prev: preprocessorMap,
|
|
44475
|
+
}
|
|
44476
|
+
}
|
|
44477
|
+
: {})
|
|
44478
|
+
});
|
|
44479
|
+
// record CSS dependencies from @imports
|
|
44480
|
+
for (const message of postcssResult.messages) {
|
|
44481
|
+
if (message.type === 'dependency') {
|
|
44482
|
+
deps.add(normalizePath$3(message.file));
|
|
44483
|
+
}
|
|
44484
|
+
else if (message.type === 'dir-dependency') {
|
|
44485
|
+
// https://github.com/postcss/postcss/blob/main/docs/guidelines/plugin.md#3-dependencies
|
|
44486
|
+
const { dir, glob: globPattern = '**' } = message;
|
|
44487
|
+
const pattern = out.escapePath(normalizePath$3(path$n.resolve(path$n.dirname(id), dir))) +
|
|
44488
|
+
`/` +
|
|
44489
|
+
globPattern;
|
|
44490
|
+
const files = out.sync(pattern, {
|
|
44491
|
+
ignore: ['**/node_modules/**']
|
|
44492
|
+
});
|
|
44493
|
+
for (let i = 0; i < files.length; i++) {
|
|
44494
|
+
deps.add(files[i]);
|
|
44445
44495
|
}
|
|
44446
44496
|
}
|
|
44447
|
-
|
|
44448
|
-
|
|
44449
|
-
|
|
44450
|
-
|
|
44451
|
-
|
|
44452
|
-
|
|
44453
|
-
|
|
44454
|
-
|
|
44455
|
-
|
|
44456
|
-
const { dir, glob: globPattern = '**' } = message;
|
|
44457
|
-
const pattern = out.escapePath(normalizePath$3(path$n.resolve(path$n.dirname(id), dir))) +
|
|
44458
|
-
`/` +
|
|
44459
|
-
globPattern;
|
|
44460
|
-
const files = out.sync(pattern, {
|
|
44461
|
-
ignore: ['**/node_modules/**']
|
|
44462
|
-
});
|
|
44463
|
-
for (let i = 0; i < files.length; i++) {
|
|
44464
|
-
deps.add(files[i]);
|
|
44465
|
-
}
|
|
44466
|
-
}
|
|
44467
|
-
else if (message.type === 'warning') {
|
|
44468
|
-
let msg = `[vite:css] ${message.text}`;
|
|
44469
|
-
if (message.line && message.column) {
|
|
44470
|
-
msg += `\n${generateCodeFrame(code, {
|
|
44471
|
-
line: message.line,
|
|
44472
|
-
column: message.column
|
|
44473
|
-
})}`;
|
|
44497
|
+
else if (message.type === 'warning') {
|
|
44498
|
+
let msg = `[vite:css] ${message.text}`;
|
|
44499
|
+
if (message.line && message.column) {
|
|
44500
|
+
msg += `\n${generateCodeFrame(code, {
|
|
44501
|
+
line: message.line,
|
|
44502
|
+
column: message.column
|
|
44503
|
+
})}`;
|
|
44504
|
+
}
|
|
44505
|
+
config.logger.warn(picocolors.exports.yellow(msg));
|
|
44474
44506
|
}
|
|
44475
|
-
config.logger.warn(picocolors.exports.yellow(msg));
|
|
44476
44507
|
}
|
|
44477
44508
|
}
|
|
44509
|
+
catch (e) {
|
|
44510
|
+
e.message = `[postcss] ${e.message}`;
|
|
44511
|
+
e.code = code;
|
|
44512
|
+
e.loc = {
|
|
44513
|
+
column: e.column,
|
|
44514
|
+
line: e.line
|
|
44515
|
+
};
|
|
44516
|
+
throw e;
|
|
44517
|
+
}
|
|
44478
44518
|
if (!devSourcemap) {
|
|
44479
44519
|
return {
|
|
44480
44520
|
ast: postcssResult,
|
|
@@ -44703,6 +44743,7 @@ async function minifyCSS(css, config) {
|
|
|
44703
44743
|
}
|
|
44704
44744
|
catch (e) {
|
|
44705
44745
|
if (e.errors) {
|
|
44746
|
+
e.message = '[esbuild css minify] ' + e.message;
|
|
44706
44747
|
const msgs = await formatMessages(e.errors, { kind: 'error' });
|
|
44707
44748
|
e.frame = '\n' + msgs.join('\n');
|
|
44708
44749
|
e.loc = e.errors[0].location;
|
|
@@ -44834,15 +44875,15 @@ const scss = async (source, root, options, resolvers) => {
|
|
|
44834
44875
|
code: result.css.toString(),
|
|
44835
44876
|
map,
|
|
44836
44877
|
additionalMap,
|
|
44837
|
-
errors: [],
|
|
44838
44878
|
deps
|
|
44839
44879
|
};
|
|
44840
44880
|
}
|
|
44841
44881
|
catch (e) {
|
|
44842
44882
|
// normalize SASS error
|
|
44883
|
+
e.message = `[sass] ${e.message}`;
|
|
44843
44884
|
e.id = e.file;
|
|
44844
44885
|
e.frame = e.formatted;
|
|
44845
|
-
return { code: '',
|
|
44886
|
+
return { code: '', error: e, deps: [] };
|
|
44846
44887
|
}
|
|
44847
44888
|
};
|
|
44848
44889
|
const sass = (source, root, options, aliasResolver) => scss(source, root, {
|
|
@@ -44924,13 +44965,13 @@ const less = async (source, root, options, resolvers) => {
|
|
|
44924
44965
|
catch (e) {
|
|
44925
44966
|
const error = e;
|
|
44926
44967
|
// normalize error info
|
|
44927
|
-
const normalizedError = new Error(error.message || error.type);
|
|
44968
|
+
const normalizedError = new Error(`[less] ${error.message || error.type}`);
|
|
44928
44969
|
normalizedError.loc = {
|
|
44929
44970
|
file: error.filename || options.filename,
|
|
44930
44971
|
line: error.line,
|
|
44931
44972
|
column: error.column
|
|
44932
44973
|
};
|
|
44933
|
-
return { code: '',
|
|
44974
|
+
return { code: '', error: normalizedError, deps: [] };
|
|
44934
44975
|
}
|
|
44935
44976
|
const map = result.map && JSON.parse(result.map);
|
|
44936
44977
|
if (map) {
|
|
@@ -44940,8 +44981,7 @@ const less = async (source, root, options, resolvers) => {
|
|
|
44940
44981
|
code: result.css.toString(),
|
|
44941
44982
|
map,
|
|
44942
44983
|
additionalMap,
|
|
44943
|
-
deps: result.imports
|
|
44944
|
-
errors: []
|
|
44984
|
+
deps: result.imports
|
|
44945
44985
|
};
|
|
44946
44986
|
};
|
|
44947
44987
|
/**
|
|
@@ -45019,12 +45059,12 @@ const styl = async (source, root, options) => {
|
|
|
45019
45059
|
code: result,
|
|
45020
45060
|
map: formatStylusSourceMap(map, root),
|
|
45021
45061
|
additionalMap,
|
|
45022
|
-
errors: [],
|
|
45023
45062
|
deps
|
|
45024
45063
|
};
|
|
45025
45064
|
}
|
|
45026
45065
|
catch (e) {
|
|
45027
|
-
|
|
45066
|
+
e.message = `[stylus] ${e.message}`;
|
|
45067
|
+
return { code: '', error: e, deps: [] };
|
|
45028
45068
|
}
|
|
45029
45069
|
};
|
|
45030
45070
|
function formatStylusSourceMap(mapBefore, root) {
|
|
@@ -45632,7 +45672,8 @@ async function doBuild(inlineConfig = {}) {
|
|
|
45632
45672
|
: path$n.posix.join(options.assetsDir, `[name].[hash].[ext]`),
|
|
45633
45673
|
inlineDynamicImports: output.format === 'umd' ||
|
|
45634
45674
|
output.format === 'iife' ||
|
|
45635
|
-
(ssrWorkerBuild &&
|
|
45675
|
+
(ssrWorkerBuild &&
|
|
45676
|
+
(typeof input === 'string' || Object.keys(input).length === 1)),
|
|
45636
45677
|
...output
|
|
45637
45678
|
};
|
|
45638
45679
|
};
|
|
@@ -57878,7 +57919,7 @@ function baseMiddleware({ config }) {
|
|
|
57878
57919
|
const parsed = new URL(url, 'http://vitejs.dev');
|
|
57879
57920
|
const path = parsed.pathname || '/';
|
|
57880
57921
|
if (path.startsWith(devBase)) {
|
|
57881
|
-
// rewrite url to remove base
|
|
57922
|
+
// rewrite url to remove base. this ensures that other middleware does
|
|
57882
57923
|
// not need to consider base being prepended or not
|
|
57883
57924
|
req.url = url.replace(devBase, '/');
|
|
57884
57925
|
return next();
|
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-665b0112.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -695,7 +695,7 @@ cli
|
|
|
695
695
|
.action(async (root, options) => {
|
|
696
696
|
// output structure is preserved even after bundling so require()
|
|
697
697
|
// is ok here
|
|
698
|
-
const { createServer } = await import('./chunks/dep-
|
|
698
|
+
const { createServer } = await import('./chunks/dep-665b0112.js').then(function (n) { return n.C; });
|
|
699
699
|
try {
|
|
700
700
|
const server = await createServer({
|
|
701
701
|
root,
|
|
@@ -742,7 +742,7 @@ cli
|
|
|
742
742
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
743
743
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
744
744
|
.action(async (root, options) => {
|
|
745
|
-
const { build } = await import('./chunks/dep-
|
|
745
|
+
const { build } = await import('./chunks/dep-665b0112.js').then(function (n) { return n.B; });
|
|
746
746
|
const buildOptions = cleanOptions(options);
|
|
747
747
|
try {
|
|
748
748
|
await build({
|
|
@@ -766,7 +766,7 @@ cli
|
|
|
766
766
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
767
767
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
768
768
|
.action(async (root, options) => {
|
|
769
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
769
|
+
const { optimizeDeps } = await import('./chunks/dep-665b0112.js').then(function (n) { return n.A; });
|
|
770
770
|
try {
|
|
771
771
|
const config = await resolveConfig({
|
|
772
772
|
root,
|
|
@@ -789,7 +789,7 @@ cli
|
|
|
789
789
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
790
790
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
791
791
|
.action(async (root, options) => {
|
|
792
|
-
const { preview } = await import('./chunks/dep-
|
|
792
|
+
const { preview } = await import('./chunks/dep-665b0112.js').then(function (n) { return n.D; });
|
|
793
793
|
try {
|
|
794
794
|
const server = await preview({
|
|
795
795
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -1199,7 +1199,7 @@ export declare interface IndexHtmlTransformContext {
|
|
|
1199
1199
|
originalUrl?: string;
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
|
-
export declare type IndexHtmlTransformHook = (html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
|
1202
|
+
export declare type IndexHtmlTransformHook = (this: void, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
|
1203
1203
|
|
|
1204
1204
|
export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
1205
1205
|
html: string;
|
|
@@ -1497,7 +1497,7 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1497
1497
|
/**
|
|
1498
1498
|
* Apply the plugin only for serve or build, or on certain conditions.
|
|
1499
1499
|
*/
|
|
1500
|
-
apply?: 'serve' | 'build' | ((config: UserConfig, env: ConfigEnv) => boolean);
|
|
1500
|
+
apply?: 'serve' | 'build' | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
|
|
1501
1501
|
/**
|
|
1502
1502
|
* Modify vite config before it's resolved. The hook can either mutate the
|
|
1503
1503
|
* passed-in config directly, or return a partial config object that will be
|
|
@@ -1506,11 +1506,11 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1506
1506
|
* Note: User plugins are resolved before running this hook so injecting other
|
|
1507
1507
|
* plugins inside the `config` hook will have no effect.
|
|
1508
1508
|
*/
|
|
1509
|
-
config?: ObjectHook<(config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>>;
|
|
1509
|
+
config?: ObjectHook<(this: void, config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>>;
|
|
1510
1510
|
/**
|
|
1511
1511
|
* Use this hook to read and store the final resolved vite config.
|
|
1512
1512
|
*/
|
|
1513
|
-
configResolved?: ObjectHook<(config: ResolvedConfig) => void | Promise<void>>;
|
|
1513
|
+
configResolved?: ObjectHook<(this: void, config: ResolvedConfig) => void | Promise<void>>;
|
|
1514
1514
|
/**
|
|
1515
1515
|
* Configure the vite server. The hook receives the {@link ViteDevServer}
|
|
1516
1516
|
* instance. This can also be used to store a reference to the server
|
|
@@ -1561,7 +1561,7 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1561
1561
|
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
1562
1562
|
* normal.
|
|
1563
1563
|
*/
|
|
1564
|
-
handleHotUpdate?: ObjectHook<(ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
|
1564
|
+
handleHotUpdate?: ObjectHook<(this: void, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
|
1565
1565
|
/**
|
|
1566
1566
|
* extend hooks with ssr flag
|
|
1567
1567
|
*/
|
|
@@ -1627,8 +1627,6 @@ export declare interface PreviewServer {
|
|
|
1627
1627
|
httpServer: http.Server;
|
|
1628
1628
|
/**
|
|
1629
1629
|
* The resolved urls Vite prints on the CLI
|
|
1630
|
-
*
|
|
1631
|
-
* @experimental
|
|
1632
1630
|
*/
|
|
1633
1631
|
resolvedUrls: ResolvedServerUrls;
|
|
1634
1632
|
/**
|
|
@@ -1637,7 +1635,7 @@ export declare interface PreviewServer {
|
|
|
1637
1635
|
printUrls(): void;
|
|
1638
1636
|
}
|
|
1639
1637
|
|
|
1640
|
-
export declare type PreviewServerHook = (server: {
|
|
1638
|
+
export declare type PreviewServerHook = (this: void, server: {
|
|
1641
1639
|
middlewares: Connect.Server;
|
|
1642
1640
|
httpServer: http.Server;
|
|
1643
1641
|
}) => (() => void) | void | Promise<(() => void) | void>;
|
|
@@ -2033,7 +2031,7 @@ export declare interface SendOptions {
|
|
|
2033
2031
|
map?: SourceMap | null;
|
|
2034
2032
|
}
|
|
2035
2033
|
|
|
2036
|
-
export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2034
|
+
export declare type ServerHook = (this: void, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2037
2035
|
|
|
2038
2036
|
export declare interface ServerOptions extends CommonServerOptions {
|
|
2039
2037
|
/**
|
|
@@ -2361,6 +2359,10 @@ export declare interface Update {
|
|
|
2361
2359
|
path: string
|
|
2362
2360
|
acceptedPath: string
|
|
2363
2361
|
timestamp: number
|
|
2362
|
+
/**
|
|
2363
|
+
* @experimental internal
|
|
2364
|
+
*/
|
|
2365
|
+
explicitImportRequired?: boolean | undefined
|
|
2364
2366
|
}
|
|
2365
2367
|
|
|
2366
2368
|
export declare interface UpdatePayload {
|
|
@@ -2568,8 +2570,6 @@ export declare interface ViteDevServer {
|
|
|
2568
2570
|
/**
|
|
2569
2571
|
* The resolved urls Vite prints on the CLI. null in middleware mode or
|
|
2570
2572
|
* before `server.listen` is called.
|
|
2571
|
-
*
|
|
2572
|
-
* @experimental
|
|
2573
2573
|
*/
|
|
2574
2574
|
resolvedUrls: ResolvedServerUrls | null;
|
|
2575
2575
|
/**
|
|
@@ -2714,7 +2714,7 @@ export declare interface WatchOptions {
|
|
|
2714
2714
|
ignorePermissionErrors?: boolean
|
|
2715
2715
|
|
|
2716
2716
|
/**
|
|
2717
|
-
* `true` if `useFsEvents` and `usePolling` are `false
|
|
2717
|
+
* `true` if `useFsEvents` and `usePolling` are `false`. Automatically filters out artifacts
|
|
2718
2718
|
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
|
2719
2719
|
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
|
2720
2720
|
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-665b0112.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';
|
|
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
|
31
31
|
var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
32
32
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
33
33
|
|
|
34
|
-
var version = "3.1.0
|
|
34
|
+
var version = "3.1.0";
|
|
35
35
|
|
|
36
36
|
const VERSION = version;
|
|
37
37
|
const VITE_PACKAGE_DIR = path$3.resolve(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "3.1.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"esbuild": "^0.
|
|
61
|
+
"esbuild": "^0.15.6",
|
|
62
62
|
"postcss": "^8.4.16",
|
|
63
63
|
"resolve": "^1.22.1",
|
|
64
64
|
"rollup": "~2.78.0"
|
|
@@ -68,18 +68,18 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@ampproject/remapping": "^2.2.0",
|
|
71
|
-
"@babel/parser": "^7.18.
|
|
72
|
-
"@babel/types": "^7.18.
|
|
71
|
+
"@babel/parser": "^7.18.13",
|
|
72
|
+
"@babel/types": "^7.18.13",
|
|
73
73
|
"@jridgewell/trace-mapping": "^0.3.15",
|
|
74
74
|
"@rollup/plugin-alias": "^3.1.9",
|
|
75
75
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
76
76
|
"@rollup/plugin-dynamic-import-vars": "^1.4.4",
|
|
77
77
|
"@rollup/plugin-json": "^4.1.0",
|
|
78
78
|
"@rollup/plugin-node-resolve": "13.3.0",
|
|
79
|
-
"@rollup/plugin-typescript": "^8.
|
|
79
|
+
"@rollup/plugin-typescript": "^8.4.0",
|
|
80
80
|
"@rollup/pluginutils": "^4.2.1",
|
|
81
81
|
"acorn": "^8.8.0",
|
|
82
|
-
"cac": "^6.7.
|
|
82
|
+
"cac": "^6.7.14",
|
|
83
83
|
"chokidar": "^3.5.3",
|
|
84
84
|
"connect": "^3.7.0",
|
|
85
85
|
"connect-history-api-fallback": "^2.0.0",
|
|
@@ -105,11 +105,10 @@
|
|
|
105
105
|
"parse5": "^7.0.0",
|
|
106
106
|
"periscopic": "^3.0.4",
|
|
107
107
|
"picocolors": "^1.0.0",
|
|
108
|
-
"postcss-import": "^
|
|
108
|
+
"postcss-import": "^15.0.0",
|
|
109
109
|
"postcss-load-config": "^4.0.1",
|
|
110
110
|
"postcss-modules": "^5.0.0",
|
|
111
111
|
"resolve.exports": "^1.1.0",
|
|
112
|
-
"rollup-plugin-license": "^2.8.1",
|
|
113
112
|
"sirv": "^2.0.2",
|
|
114
113
|
"source-map-js": "^1.0.2",
|
|
115
114
|
"source-map-support": "^0.5.21",
|
package/src/client/client.ts
CHANGED
|
@@ -189,7 +189,7 @@ async function handleMessage(payload: HMRPayload) {
|
|
|
189
189
|
outdatedLinkTags.add(el)
|
|
190
190
|
el.after(newLinkTag)
|
|
191
191
|
}
|
|
192
|
-
console.
|
|
192
|
+
console.debug(`[vite] css hot updated: ${searchUrl}`)
|
|
193
193
|
}
|
|
194
194
|
})
|
|
195
195
|
break
|
|
@@ -388,7 +388,12 @@ export function removeStyle(id: string): void {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
async function fetchUpdate({
|
|
391
|
+
async function fetchUpdate({
|
|
392
|
+
path,
|
|
393
|
+
acceptedPath,
|
|
394
|
+
timestamp,
|
|
395
|
+
explicitImportRequired
|
|
396
|
+
}: Update) {
|
|
392
397
|
const mod = hotModulesMap.get(path)
|
|
393
398
|
if (!mod) {
|
|
394
399
|
// In a code-splitting project,
|
|
@@ -400,52 +405,37 @@ async function fetchUpdate({ path, acceptedPath, timestamp }: Update) {
|
|
|
400
405
|
const moduleMap = new Map<string, ModuleNamespace>()
|
|
401
406
|
const isSelfUpdate = path === acceptedPath
|
|
402
407
|
|
|
403
|
-
// make sure we only import each dep once
|
|
404
|
-
const modulesToUpdate = new Set<string>()
|
|
405
|
-
if (isSelfUpdate) {
|
|
406
|
-
// self update - only update self
|
|
407
|
-
modulesToUpdate.add(path)
|
|
408
|
-
} else {
|
|
409
|
-
// dep update
|
|
410
|
-
for (const { deps } of mod.callbacks) {
|
|
411
|
-
deps.forEach((dep) => {
|
|
412
|
-
if (acceptedPath === dep) {
|
|
413
|
-
modulesToUpdate.add(dep)
|
|
414
|
-
}
|
|
415
|
-
})
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
408
|
// determine the qualified callbacks before we re-import the modules
|
|
420
|
-
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>
|
|
421
|
-
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
await Promise.all(
|
|
425
|
-
Array.from(modulesToUpdate).map(async (dep) => {
|
|
426
|
-
const disposer = disposeMap.get(dep)
|
|
427
|
-
if (disposer) await disposer(dataMap.get(dep))
|
|
428
|
-
const [path, query] = dep.split(`?`)
|
|
429
|
-
try {
|
|
430
|
-
const newMod: ModuleNamespace = await import(
|
|
431
|
-
/* @vite-ignore */
|
|
432
|
-
base +
|
|
433
|
-
path.slice(1) +
|
|
434
|
-
`?import&t=${timestamp}${query ? `&${query}` : ''}`
|
|
435
|
-
)
|
|
436
|
-
moduleMap.set(dep, newMod)
|
|
437
|
-
} catch (e) {
|
|
438
|
-
warnFailedFetch(e, dep)
|
|
439
|
-
}
|
|
440
|
-
})
|
|
409
|
+
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) =>
|
|
410
|
+
deps.includes(acceptedPath)
|
|
441
411
|
)
|
|
442
412
|
|
|
413
|
+
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
|
414
|
+
const dep = acceptedPath
|
|
415
|
+
const disposer = disposeMap.get(dep)
|
|
416
|
+
if (disposer) await disposer(dataMap.get(dep))
|
|
417
|
+
const [path, query] = dep.split(`?`)
|
|
418
|
+
try {
|
|
419
|
+
const newMod: ModuleNamespace = await import(
|
|
420
|
+
/* @vite-ignore */
|
|
421
|
+
base +
|
|
422
|
+
path.slice(1) +
|
|
423
|
+
`?${explicitImportRequired ? 'import&' : ''}t=${timestamp}${
|
|
424
|
+
query ? `&${query}` : ''
|
|
425
|
+
}`
|
|
426
|
+
)
|
|
427
|
+
moduleMap.set(dep, newMod)
|
|
428
|
+
} catch (e) {
|
|
429
|
+
warnFailedFetch(e, dep)
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
443
433
|
return () => {
|
|
444
434
|
for (const { deps, fn } of qualifiedCallbacks) {
|
|
445
435
|
fn(deps.map((dep) => moduleMap.get(dep)))
|
|
446
436
|
}
|
|
447
437
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`
|
|
448
|
-
console.
|
|
438
|
+
console.debug(`[vite] hot updated: ${loggedPath}`)
|
|
449
439
|
}
|
|
450
440
|
}
|
|
451
441
|
|
package/types/chokidar.d.ts
CHANGED
|
@@ -194,7 +194,7 @@ export interface WatchOptions {
|
|
|
194
194
|
ignorePermissionErrors?: boolean
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
* `true` if `useFsEvents` and `usePolling` are `false
|
|
197
|
+
* `true` if `useFsEvents` and `usePolling` are `false`. Automatically filters out artifacts
|
|
198
198
|
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
|
199
199
|
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
|
200
200
|
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
package/types/hmrPayload.d.ts
CHANGED
package/types/shims.d.ts
CHANGED