From d47d7ef3fe09f7e83a76b2e26c1995e23801f2b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Aug 2024 11:34:38 +0000 Subject: [PATCH] 5ddf269 Version Packages https://github.com/QwikDev/qwik/commit/07991c131d99c2b0c0f847807401f82c4727d6c4 --- adapters/shared/vite/index.d.ts | 2 +- index.qwik.cjs | 518 +++++++----------- index.qwik.mjs | 518 +++++++----------- middleware/bun/index.mjs | 6 + vite/index.cjs | 942 +++++++++++++++++++++----------- vite/index.d.ts | 8 +- vite/index.mjs | 942 +++++++++++++++++++++----------- 7 files changed, 1653 insertions(+), 1283 deletions(-) diff --git a/adapters/shared/vite/index.d.ts b/adapters/shared/vite/index.d.ts index c5db173..412af53 100644 --- a/adapters/shared/vite/index.d.ts +++ b/adapters/shared/vite/index.d.ts @@ -87,7 +87,7 @@ export declare interface ServerAdapterOptions { export declare const STATIC_PATHS_ID = "@qwik-city-static-paths"; /** @public */ -export declare function viteAdapter(opts: ViteAdapterPluginOptions): Plugin_2; +export declare function viteAdapter(opts: ViteAdapterPluginOptions): Plugin_2; /** @public */ declare interface ViteAdapterPluginOptions { diff --git a/index.qwik.cjs b/index.qwik.cjs index 4a91d7f..f804895 100644 --- a/index.qwik.cjs +++ b/index.qwik.cjs @@ -45,8 +45,7 @@ const spaInit = qwik.eventQrl(/* @__PURE__ */ qwik.inlinedQrl((container) => { const debounceTimeout = "_qCityScrollDebounce"; const scrollHistory = "_qCityScroll"; const checkAndScroll = (scrollState) => { - if (scrollState) - win.scrollTo(scrollState.x, scrollState.y); + if (scrollState) win.scrollTo(scrollState.x, scrollState.y); }; const currentScrollState2 = () => { const elm = document.documentElement; @@ -65,8 +64,7 @@ const spaInit = qwik.eventQrl(/* @__PURE__ */ qwik.inlinedQrl((container) => { if (!win[spa] && !win[initPopstate] && !win[initAnchors] && !win[initVisibility] && !win[initScroll]) { saveScrollState(); win[initPopstate] = () => { - if (win[spa]) - return; + if (win[spa]) return; win[scrollEnabled] = false; clearTimeout(win[debounceTimeout]); if (currentPath !== location.pathname + location.search) { @@ -92,14 +90,12 @@ const spaInit = qwik.eventQrl(/* @__PURE__ */ qwik.inlinedQrl((container) => { const pushState = history.pushState; const replaceState = history.replaceState; const prepareState = (state) => { - if (state === null || typeof state === "undefined") - state = {}; + if (state === null || typeof state === "undefined") state = {}; else if (state?.constructor !== Object) { state = { _data: state }; - if (build.isDev) - console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); + if (build.isDev) console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); } state._qCityScroll = state._qCityScroll || currentScrollState2(); return state; @@ -114,8 +110,7 @@ const spaInit = qwik.eventQrl(/* @__PURE__ */ qwik.inlinedQrl((container) => { }; } win[initAnchors] = (event) => { - if (win[spa] || event.defaultPrevented) - return; + if (win[spa] || event.defaultPrevented) return; const target = event.target.closest("a[href]"); if (target && !target.hasAttribute("preventdefault:click")) { const href = target.getAttribute("href"); @@ -125,11 +120,9 @@ const spaInit = qwik.eventQrl(/* @__PURE__ */ qwik.inlinedQrl((container) => { const samePath = dest.pathname + dest.search === prev.pathname + prev.search; if (sameOrigin && samePath) { event.preventDefault(); - if (dest.href !== prev.href) - history.pushState(null, "", dest); + if (dest.href !== prev.href) history.pushState(null, "", dest); if (!dest.hash) { - if (dest.href.endsWith("#")) - window.scrollTo(0, 0); + if (dest.href.endsWith("#")) window.scrollTo(0, 0); else { win[scrollEnabled] = false; clearTimeout(win[debounceTimeout]); @@ -143,19 +136,16 @@ const spaInit = qwik.eventQrl(/* @__PURE__ */ qwik.inlinedQrl((container) => { } else { const elmId = dest.hash.slice(1); const elm = document.getElementById(elmId); - if (elm) - elm.scrollIntoView(); + if (elm) elm.scrollIntoView(); } } } }; win[initVisibility] = () => { - if (!win[spa] && win[scrollEnabled] && document.visibilityState === "hidden") - saveScrollState(); + if (!win[spa] && win[scrollEnabled] && document.visibilityState === "hidden") saveScrollState(); }; win[initScroll] = () => { - if (win[spa] || !win[scrollEnabled]) - return; + if (win[spa] || !win[scrollEnabled]) return; clearTimeout(win[debounceTimeout]); win[debounceTimeout] = setTimeout(() => { saveScrollState(); @@ -169,10 +159,9 @@ const spaInit = qwik.eventQrl(/* @__PURE__ */ qwik.inlinedQrl((container) => { passive: true }); document.body.addEventListener("click", win[initAnchors]); - if (!win.navigation) - document.addEventListener("visibilitychange", win[initVisibility], { - passive: true - }); + if (!win.navigation) document.addEventListener("visibilitychange", win[initVisibility], { + passive: true + }); }, 0); } }, "spa_init_event_1RJPKHqF8AQ")); @@ -191,8 +180,7 @@ const shim$1 = async (base, path, symbol) => { if (!window._qcs && history.scrollRestoration === "manual") { window._qcs = true; const scrollState = history.state?._qCityScroll; - if (scrollState) - window.scrollTo(scrollState.x, scrollState.y); + if (scrollState) window.scrollTo(scrollState.x, scrollState.y); const script = document.currentScript; if (script) { const container = script.closest("[q\\:container]"); @@ -200,15 +188,13 @@ const shim$1 = async (base, path, symbol) => { if (build.isDev) { const imp = new Function("url", "return import(url)"); (await imp(url.href))[symbol](container); - } else - (await import(url.href))[symbol](container); + } else (await import(url.href))[symbol](container); } } }; const RouterOutlet = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(() => { const serverData = qwik.useServerData("containerAttributes"); - if (!serverData) - throw new Error("PrefetchServiceWorker component must be rendered on the server."); + if (!serverData) throw new Error("PrefetchServiceWorker component must be rendered on the server."); const shimScript = shim(serverData["q:base"]); qwik._jsxBranch(); const nonce = qwik.useServerData("nonce"); @@ -216,11 +202,9 @@ const RouterOutlet = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli if (context.value && context.value.length > 0) { const contentsLen = context.value.length; let cmp = null; - for (let i = contentsLen - 1; i >= 0; i--) - if (context.value[i].default) - cmp = qwik._jsxC(context.value[i].default, { - children: cmp - }, 1, "zl_0"); + for (let i = contentsLen - 1; i >= 0; i--) if (context.value[i].default) cmp = qwik._jsxC(context.value[i].default, { + children: cmp + }, 1, "zl_0"); return /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, { children: [ cmp, @@ -252,23 +236,19 @@ const isSameSearchQuery = (a, b) => a.search === b.search; const isSamePath = (a, b) => isSameSearchQuery(a, b) && isSamePathname(a, b); const getClientDataPath = (pathname, pageSearch, action) => { let search = pageSearch ?? ""; - if (action) - search += (search ? "&" : "?") + QACTION_KEY + "=" + encodeURIComponent(action.id); + if (action) search += (search ? "&" : "?") + QACTION_KEY + "=" + encodeURIComponent(action.id); return pathname + (pathname.endsWith("/") ? "" : "/") + "q-data.json" + search; }; const getClientNavPath = (props, baseUrl) => { const href = props.href; - if (typeof href === "string" && typeof props.target !== "string" && !props.reload) - try { - const linkUrl = toUrl(href.trim(), baseUrl.url); - const currentUrl = toUrl("", baseUrl.url); - if (isSameOrigin(linkUrl, currentUrl)) - return toPath(linkUrl); - } catch (e) { - console.error(e); - } - else if (props.reload) - return toPath(toUrl("", baseUrl.url)); + if (typeof href === "string" && typeof props.target !== "string" && !props.reload) try { + const linkUrl = toUrl(href.trim(), baseUrl.url); + const currentUrl = toUrl("", baseUrl.url); + if (isSameOrigin(linkUrl, currentUrl)) return toPath(linkUrl); + } catch (e) { + console.error(e); + } + else if (props.reload) return toPath(toUrl("", baseUrl.url)); return null; }; const shouldPrefetchData = (clientNavPath, currentLoc) => { @@ -295,12 +275,10 @@ const resolveHead = (endpoint, routeLocation, contentModules, locale) => { const getData = (loaderOrAction) => { const id = loaderOrAction.__id; if (loaderOrAction.__brand === "server_loader") { - if (!(id in endpoint.loaders)) - throw new Error("You can not get the returned data of a loader that has not been executed for this request."); + if (!(id in endpoint.loaders)) throw new Error("You can not get the returned data of a loader that has not been executed for this request."); } const data = endpoint.loaders[id]; - if (isPromise(data)) - throw new Error("Loaders returning a promise can not be resolved for the head function."); + if (isPromise(data)) throw new Error("Loaders returning a promise can not be resolved for the head function."); return data; }; const headProps = { @@ -312,17 +290,14 @@ const resolveHead = (endpoint, routeLocation, contentModules, locale) => { for (let i = contentModules.length - 1; i >= 0; i--) { const contentModuleHead = contentModules[i] && contentModules[i].head; if (contentModuleHead) { - if (typeof contentModuleHead === "function") - resolveDocumentHead(head, qwik.withLocale(locale, () => contentModuleHead(headProps))); - else if (typeof contentModuleHead === "object") - resolveDocumentHead(head, contentModuleHead); + if (typeof contentModuleHead === "function") resolveDocumentHead(head, qwik.withLocale(locale, () => contentModuleHead(headProps))); + else if (typeof contentModuleHead === "object") resolveDocumentHead(head, contentModuleHead); } } return headProps.head; }; const resolveDocumentHead = (resolvedHead, updatedHead) => { - if (typeof updatedHead.title === "string") - resolvedHead.title = updatedHead.title; + if (typeof updatedHead.title === "string") resolvedHead.title = updatedHead.title; mergeArray(resolvedHead.meta, updatedHead.meta); mergeArray(resolvedHead.links, updatedHead.links); mergeArray(resolvedHead.styles, updatedHead.styles); @@ -330,17 +305,16 @@ const resolveDocumentHead = (resolvedHead, updatedHead) => { Object.assign(resolvedHead.frontmatter, updatedHead.frontmatter); }; const mergeArray = (existingArr, newArr) => { - if (Array.isArray(newArr)) - for (const newItem of newArr) { - if (typeof newItem.key === "string") { - const existingIndex = existingArr.findIndex((i) => i.key === newItem.key); - if (existingIndex > -1) { - existingArr[existingIndex] = newItem; - continue; - } + if (Array.isArray(newArr)) for (const newItem of newArr) { + if (typeof newItem.key === "string") { + const existingIndex = existingArr.findIndex((i) => i.key === newItem.key); + if (existingIndex > -1) { + existingArr[existingIndex] = newItem; + continue; } - existingArr.push(newItem); } + existingArr.push(newItem); + } }; const createDocumentHead = () => ({ title: "", @@ -373,26 +347,22 @@ function matchRoutePart(route, routeIdx, routeLength, path, pathIdx, pathLength) const paramValueStart = pathIdx - 1; if (isMany) { const match = recursiveScan(paramName, suffix, path, paramValueStart, pathLength, route, routeIdx + suffix.length + 1, routeLength); - if (match) - return Object.assign(params || (params = {}), match); + if (match) return Object.assign(params || (params = {}), match); } const paramValueEnd = scan(path, paramValueStart, pathLength, 47, suffix); - if (paramValueEnd == -1) - return null; + if (paramValueEnd == -1) return null; const paramValue = path.substring(paramValueStart, paramValueEnd); if (!isMany && !suffix && !paramValue) return null; pathIdx = paramValueEnd; (params || (params = {}))[paramName] = decodeURIComponent(paramValue); } else if (routeCh !== pathCh) { - if (!(isNaN(pathCh) && isRestParameter(route, routeIdx))) - return null; + if (!(isNaN(pathCh) && isRestParameter(route, routeIdx))) return null; } } if (allConsumed(route, routeIdx) && allConsumed(path, pathIdx)) return params || {}; - else - return null; + else return null; } function isRestParameter(text, idx) { return text.charCodeAt(idx) === 91 && isThreeDots(text, idx + 1); @@ -412,40 +382,27 @@ function isThreeDots(text, idx) { return text.charCodeAt(idx) === 46 && text.charCodeAt(idx + 1) === 46 && text.charCodeAt(idx + 2) === 46; } function scan(text, idx, end, ch, suffix = "") { - while (idx < end && text.charCodeAt(idx) !== ch) - idx++; + while (idx < end && text.charCodeAt(idx) !== ch) idx++; const suffixLength = suffix.length; for (let i = 0; i < suffixLength; i++) { - if (text.charCodeAt(idx - suffixLength + i) !== suffix.charCodeAt(i)) - return -1; + if (text.charCodeAt(idx - suffixLength + i) !== suffix.charCodeAt(i)) return -1; } return idx - suffixLength; } -let Char; -(function(Char2) { - Char2[Char2["EOL"] = 0] = "EOL"; - Char2[Char2["OPEN_BRACKET"] = 91] = "OPEN_BRACKET"; - Char2[Char2["CLOSE_BRACKET"] = 93] = "CLOSE_BRACKET"; - Char2[Char2["DOT"] = 46] = "DOT"; - Char2[Char2["SLASH"] = 47] = "SLASH"; -})(Char || (Char = {})); function recursiveScan(paramName, suffix, path, pathStart, pathLength, route, routeStart, routeLength) { - if (path.charCodeAt(pathStart) === 47) - pathStart++; + if (path.charCodeAt(pathStart) === 47) pathStart++; let pathIdx = pathLength; const sep = suffix + "/"; while (pathIdx >= pathStart) { const match = matchRoutePart(route, routeStart, routeLength, path, pathIdx, pathLength); if (match) { let value = path.substring(pathStart, Math.min(pathIdx, pathLength)); - if (value.endsWith(sep)) - value = value.substring(0, value.length - sep.length); + if (value.endsWith(sep)) value = value.substring(0, value.length - sep.length); match[paramName] = decodeURIComponent(value); return match; } const newPathIdx = lastIndexOf(path, pathStart, sep, pathIdx, pathStart - 1) + sep.length; - if (pathIdx === newPathIdx) - break; + if (pathIdx === newPathIdx) break; pathIdx = newPathIdx; } return null; @@ -457,13 +414,11 @@ function lastIndexOf(text, start, match, searchIdx, notFoundIdx) { return idx > start ? idx : notFoundIdx; } const loadRoute = async (routes, menus, cacheModules, pathname) => { - if (!Array.isArray(routes)) - return null; + if (!Array.isArray(routes)) return null; for (const routeData of routes) { const routeName = routeData[0]; const params = matchRoute(routeName, pathname); - if (!params) - continue; + if (!params) continue; const loaders = routeData[1]; const routeBundleNames = routeData[3]; const modules = new Array(loaders.length); @@ -474,8 +429,7 @@ const loadRoute = async (routes, menus, cacheModules, pathname) => { const menuLoader = getMenuLoader(menus, pathname); let menu = void 0; loadModule(menuLoader, pendingLoads, (menuModule) => menu = menuModule?.default, cacheModules); - if (pendingLoads.length > 0) - await Promise.all(pendingLoads); + if (pendingLoads.length > 0) await Promise.all(pendingLoads); return [ routeName, params, @@ -489,18 +443,14 @@ const loadRoute = async (routes, menus, cacheModules, pathname) => { const loadModule = (moduleLoader, pendingLoads, moduleSetter, cacheModules) => { if (typeof moduleLoader === "function") { const loadedModule = MODULE_CACHE.get(moduleLoader); - if (loadedModule) - moduleSetter(loadedModule); + if (loadedModule) moduleSetter(loadedModule); else { const moduleOrPromise = moduleLoader(); - if (typeof moduleOrPromise.then === "function") - pendingLoads.push(moduleOrPromise.then((loadedModule2) => { - if (cacheModules !== false) - MODULE_CACHE.set(moduleLoader, loadedModule2); - moduleSetter(loadedModule2); - })); - else if (moduleOrPromise) - moduleSetter(moduleOrPromise); + if (typeof moduleOrPromise.then === "function") pendingLoads.push(moduleOrPromise.then((loadedModule2) => { + if (cacheModules !== false) MODULE_CACHE.set(moduleLoader, loadedModule2); + moduleSetter(loadedModule2); + })); + else if (moduleOrPromise) moduleSetter(moduleOrPromise); } } }; @@ -508,8 +458,7 @@ const getMenuLoader = (menus, pathname) => { if (menus) { pathname = pathname.endsWith("/") ? pathname : pathname + "/"; const menu = menus.find((m) => m[0] === pathname || pathname.startsWith(m[0] + (pathname.endsWith("/") ? "" : "/"))); - if (menu) - return menu[1]; + if (menu) return menu[1]; } }; const clientNavigate = (win, navType, fromURL, toURL, replaceState = false) => { @@ -520,8 +469,7 @@ const clientNavigate = (win, navType, fromURL, toURL, replaceState = false) => { const newState = { _qCityScroll: newScrollState() }; - if (replaceState) - win.history.replaceState(newState, "", toPath(toURL)); + if (replaceState) win.history.replaceState(newState, "", toPath(toURL)); else win.history.pushState(newState, "", toPath(toURL)); } @@ -555,15 +503,12 @@ const loadClientData = async (url, element, opts) => { const pageSearch = url.search; const clientDataPath = getClientDataPath(pagePathname, pageSearch, opts?.action); let qData; - if (!opts?.action) - qData = CLIENT_DATA_CACHE.get(clientDataPath); - if (opts?.prefetchSymbols !== false) - prefetchSymbols(pagePathname); + if (!opts?.action) qData = CLIENT_DATA_CACHE.get(clientDataPath); + if (opts?.prefetchSymbols !== false) prefetchSymbols(pagePathname); let resolveFn; if (!qData) { const fetchOptions = getFetchOptions(opts?.action); - if (opts?.action) - opts.action.data = void 0; + if (opts?.action) opts.action.data = void 0; qData = fetch(clientDataPath, fetchOptions).then((rsp) => { if (rsp.redirected) { const redirectedURL = new URL(rsp.url); @@ -580,8 +525,7 @@ const loadClientData = async (url, element, opts) => { location.href = url.href; return; } - if (opts?.clearCache) - CLIENT_DATA_CACHE.delete(clientDataPath); + if (opts?.clearCache) CLIENT_DATA_CACHE.delete(clientDataPath); if (clientData.redirect) location.href = clientData.redirect; else if (opts?.action) { @@ -597,38 +541,32 @@ const loadClientData = async (url, element, opts) => { return clientData; }); else { - if (opts?.isPrefetch !== true) - location.href = url.href; + if (opts?.isPrefetch !== true) location.href = url.href; return void 0; } }); - if (!opts?.action) - CLIENT_DATA_CACHE.set(clientDataPath, qData); + if (!opts?.action) CLIENT_DATA_CACHE.set(clientDataPath, qData); } return qData.then((v) => { - if (!v) - CLIENT_DATA_CACHE.delete(clientDataPath); + if (!v) CLIENT_DATA_CACHE.delete(clientDataPath); resolveFn && resolveFn(); return v; }); }; const getFetchOptions = (action) => { const actionData = action?.data; - if (!actionData) - return void 0; - if (actionData instanceof FormData) - return { - method: "POST", - body: actionData - }; - else - return { - method: "POST", - body: JSON.stringify(actionData), - headers: { - "Content-Type": "application/json, charset=UTF-8" - } - }; + if (!actionData) return void 0; + if (actionData instanceof FormData) return { + method: "POST", + body: actionData + }; + else return { + method: "POST", + body: JSON.stringify(actionData), + headers: { + "Content-Type": "application/json, charset=UTF-8" + } + }; }; const useContent = () => qwik.useContext(ContentContext); const useDocumentHead = () => qwik.useContext(DocumentHeadContext); @@ -637,11 +575,9 @@ const useNavigate = () => qwik.useContext(RouteNavigateContext); const useAction = () => qwik.useContext(RouteActionContext); const useQwikCityEnv = () => qwik.noSerialize(qwik.useServerData("qwikcity")); const restoreScroll = (type, toUrl2, fromUrl, scroller, scrollState) => { - if (type === "popstate" && scrollState) - scroller.scrollTo(scrollState.x, scrollState.y); + if (type === "popstate" && scrollState) scroller.scrollTo(scrollState.x, scrollState.y); else if (type === "link" || type === "form") { - if (!hashScroll(toUrl2, fromUrl)) - scroller.scrollTo(0, 0); + if (!hashScroll(toUrl2, fromUrl)) scroller.scrollTo(0, 0); } }; const hashScroll = (toUrl2, fromUrl) => { @@ -675,11 +611,9 @@ const QWIK_CITY_SCROLLER = "_qCityScroller"; const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => { qwik.useStylesQrl(/* @__PURE__ */ qwik.inlinedQrl(`:root{view-transition-name:none}`, "QwikCityProvider_component_useStyles_RPDJAz33WLA")); const env = useQwikCityEnv(); - if (!env?.params) - throw new Error(`Missing Qwik City Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`); + if (!env?.params) throw new Error(`Missing Qwik City Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`); const urlEnv = qwik.useServerData("url"); - if (!urlEnv) - throw new Error(`Missing Qwik URL Env Data`); + if (!urlEnv) throw new Error(`Missing Qwik URL Env Data`); const url = new URL(urlEnv); const routeLocation = qwik.useStore({ url, @@ -722,25 +656,21 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. forceReload: opt }; if (typeof path === "number") { - if (build.isBrowser) - history.go(path); + if (build.isBrowser) history.go(path); return; } const lastDest = routeInternal2.value.dest; const dest = path === void 0 ? lastDest : toUrl(path, routeLocation2.url); if (!isSameOrigin(dest, lastDest)) { - if (build.isBrowser) - location.href = dest.href; + if (build.isBrowser) location.href = dest.href; return; } if (!forceReload && isSamePath(dest, lastDest)) { if (build.isBrowser) { - if (type === "link" && dest.href !== location.href) - history.pushState(null, "", dest); + if (type === "link" && dest.href !== location.href) history.pushState(null, "", dest); const scroller = document.getElementById(QWIK_CITY_SCROLLER) ?? document.documentElement; restoreScroll(type, dest, new URL(location.href), scroller, getScrollHistory()); - if (type === "popstate") - window._qCityScrollEnabled = true; + if (type === "popstate") window._qCityScrollEnabled = true; } return; } @@ -796,10 +726,8 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. } else { trackUrl = new URL(navigation.dest, location); if (trackUrl.pathname.endsWith("/")) { - if (!qwikCity__namespace.trailingSlash) - trackUrl.pathname = trackUrl.pathname.slice(0, -1); - } else if (qwikCity__namespace.trailingSlash) - trackUrl.pathname += "/"; + if (!qwikCity__namespace.trailingSlash) trackUrl.pathname = trackUrl.pathname.slice(0, -1); + } else if (qwikCity__namespace.trailingSlash) trackUrl.pathname += "/"; let loadRoutePromise = loadRoute(qwikCity__namespace.routes, qwikCity__namespace.menus, qwikCity__namespace.cacheModules, trackUrl.pathname); elm = qwik._getContextElement(); const pageData = clientPageData = await loadClientData(trackUrl, elm, { @@ -853,15 +781,13 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. if (props2.viewTransition !== false) document.__q_view_transition__ = true; let scrollState; - if (navType === "popstate") - scrollState = getScrollHistory(); + if (navType === "popstate") scrollState = getScrollHistory(); const scroller = document.getElementById(QWIK_CITY_SCROLLER) ?? document.documentElement; if (navigation.scroll && (!navigation.forceReload || !isSamePath(trackUrl, prevUrl)) && (navType === "link" || navType === "popstate") || navType === "form" && !isSamePath(trackUrl, prevUrl)) document.__q_scroll_restore__ = () => restoreScroll(navType, trackUrl, prevUrl, scroller, scrollState); const loaders = clientPageData?.loaders; const win = window; - if (loaders) - Object.assign(loaderState2, loaders); + if (loaders) Object.assign(loaderState2, loaders); CLIENT_DATA_CACHE.clear(); if (!win._qCitySPA) { win._qCitySPA = true; @@ -880,14 +806,12 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. const pushState = history.pushState; const replaceState2 = history.replaceState; const prepareState = (state) => { - if (state === null || typeof state === "undefined") - state = {}; + if (state === null || typeof state === "undefined") state = {}; else if (state?.constructor !== Object) { state = { _data: state }; - if (build.isDev) - console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); + if (build.isDev) console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); } state._qCityScroll = state._qCityScroll || currentScrollState(scroller); return state; @@ -902,8 +826,7 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. }; } document.body.addEventListener("click", (event) => { - if (event.defaultPrevented) - return; + if (event.defaultPrevented) return; const target = event.target.closest("a[href]"); if (target && !target.hasAttribute("preventdefault:click")) { const href = target.getAttribute("href"); @@ -912,8 +835,7 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. if (isSameOrigin(dest, prev) && isSamePath(dest, prev)) { event.preventDefault(); if (!dest.hash && !dest.href.endsWith("#")) { - if (dest.href !== prev.href) - history.pushState(null, "", dest); + if (dest.href !== prev.href) history.pushState(null, "", dest); win._qCityScrollEnabled = false; clearTimeout(win._qCityScrollDebounce); saveScrollHistory({ @@ -943,8 +865,7 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. win._qCityInitVisibility = void 0; } win.addEventListener("scroll", () => { - if (!win._qCityScrollEnabled) - return; + if (!win._qCityScrollEnabled) return; clearTimeout(win._qCityScrollDebounce); win._qCityScrollDebounce = setTimeout(() => { const scrollState2 = currentScrollState(scroller); @@ -980,10 +901,8 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. } } const promise = run(); - if (build.isServer) - return promise; - else - return; + if (build.isServer) return promise; + else return; }, "QwikCityProvider_component_useTask_02wMImzEAbk", [ actionState, content, @@ -1000,8 +919,7 @@ const QwikCityProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik. return /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "qY_0"); }, "QwikCityProvider_component_TxCFOy819ag")); function getContainer(elm) { - while (elm && elm.nodeType !== Node.ELEMENT_NODE) - elm = elm.parentElement; + while (elm && elm.nodeType !== Node.ELEMENT_NODE) elm = elm.parentElement; return elm.closest("[q\\:container]"); } const QwikCityMockProvider = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => { @@ -1056,21 +974,18 @@ const Link = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(( const prefetchData = qwik.untrack(() => !!clientNavPath && prefetchProp !== false && prefetchProp !== "js" && shouldPrefetchData(clientNavPath, loc) || void 0); const prefetch = qwik.untrack(() => prefetchData || !!clientNavPath && prefetchProp !== false && shouldPrefetchSymbols(clientNavPath, loc)); const handlePrefetch = prefetch ? /* @__PURE__ */ qwik.inlinedQrl((_, elm) => { - if (navigator.connection?.saveData) - return; + if (navigator.connection?.saveData) return; if (elm && elm.href) { const url = new URL(elm.href); prefetchSymbols(url.pathname); - if (elm.hasAttribute("data-prefetch")) - loadClientData(url, elm, { - prefetchSymbols: false, - isPrefetch: true - }); + if (elm.hasAttribute("data-prefetch")) loadClientData(url, elm, { + prefetchSymbols: false, + isPrefetch: true + }); } }, "Link_component_handlePrefetch_Osdg8FnYTw4") : void 0; const preventDefault = clientNavPath ? qwik._qrlSync((event, target) => { - if (!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) - event.preventDefault(); + if (!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) event.preventDefault(); }, "(event,target)=>{if(!(event.metaKey||event.ctrlKey||event.shiftKey||event.altKey)){event.preventDefault();}}") : void 0; const handleClick = clientNavPath ? /* @__PURE__ */ qwik.inlinedQrl(async (event, elm) => { const [nav2, reload2, replaceState2, scroll2] = qwik.useLexicalScope(); @@ -1142,8 +1057,7 @@ const routeActionQrl = (actionQrl, ...rest) => { const value = currentAction.value; if (value && value?.id === id) { const data = value.data; - if (data instanceof FormData) - initialState.formData = data; + if (data instanceof FormData) initialState.formData = data; if (value.output) { const { status, result } = value.output; initialState.status = status; @@ -1154,8 +1068,7 @@ const routeActionQrl = (actionQrl, ...rest) => { }); const submit = /* @__PURE__ */ qwik.inlinedQrl((input = {}) => { const [currentAction2, id2, loc2, state2] = qwik.useLexicalScope(); - if (build.isServer) - throw new Error(`Actions can not be invoked within the server during SSR. + if (build.isServer) throw new Error(`Actions can not be invoked within the server during SSR. Action.run() can only be called on the browser, for example when a user clicks a button, or submits a form.`); let data; let form; @@ -1163,14 +1076,11 @@ Action.run() can only be called on the browser, for example when a user clicks a form = input.target; data = new FormData(form); if ((input.submitter instanceof HTMLInputElement || input.submitter instanceof HTMLButtonElement) && input.submitter.name) { - if (input.submitter.name) - data.append(input.submitter.name, input.submitter.value); + if (input.submitter.name) data.append(input.submitter.name, input.submitter.value); } - } else - data = input; + } else data = input; return new Promise((resolve) => { - if (data instanceof FormData) - state2.formData = data; + if (data instanceof FormData) state2.formData = data; state2.submitted = true; state2.isRunning = true; loc2.isNavigating = true; @@ -1184,8 +1094,7 @@ Action.run() can only be called on the browser, for example when a user clicks a state2.status = status; state2.value = result; if (form) { - if (form.getAttribute("data-spa-reset") === "true") - form.reset(); + if (form.getAttribute("data-spa-reset") === "true") form.reset(); const detail = { status, value: result @@ -1221,8 +1130,7 @@ Action.run() can only be called on the browser, for example when a user clicks a const globalActionQrl = (actionQrl, ...rest) => { const action = routeActionQrl(actionQrl, ...rest); if (build.isServer) { - if (typeof globalThis._qwikActionsMap === "undefined") - globalThis._qwikActionsMap = /* @__PURE__ */ new Map(); + if (typeof globalThis._qwikActionsMap === "undefined") globalThis._qwikActionsMap = /* @__PURE__ */ new Map(); globalThis._qwikActionsMap.set(action.__id, action); } return action; @@ -1233,8 +1141,7 @@ const routeLoaderQrl = (loaderQrl, ...rest) => { const { id, validators } = getValidators(rest, loaderQrl); function loader() { return qwik.useContext(RouteStateContext, (state) => { - if (!(id in state)) - throw new Error(`routeLoader$ "${loaderQrl.getSymbol()}" was invoked in a route where it was not declared. + if (!(id in state)) throw new Error(`routeLoader$ "${loaderQrl.getSymbol()}" was invoked in a route where it was not declared. This is because the routeLoader$ was not exported in a 'layout.tsx' or 'index.tsx' file of the existing route. For more information check: https://qwik.dev/qwikcity/route-loader/ @@ -1252,45 +1159,38 @@ const routeLoaderQrl = (loaderQrl, ...rest) => { }; const routeLoader$ = /* @__PURE__ */ qwik.implicit$FirstArg(routeLoaderQrl); const validatorQrl = (validator) => { - if (build.isServer) - return { - validate: validator - }; + if (build.isServer) return { + validate: validator + }; return void 0; }; const validator$ = /* @__PURE__ */ qwik.implicit$FirstArg(validatorQrl); const zodQrl = (qrl) => { - if (build.isServer) - return { - async validate(ev, inputData) { - const schema = qrl.resolve().then((obj) => { - if (typeof obj === "function") - obj = obj(zod.z, ev); - if (obj instanceof zod.z.Schema) - return obj; - else - return zod.z.object(obj); - }); - const data = inputData ?? await ev.parseBody(); - const result = await (await schema).safeParseAsync(data); - if (result.success) - return result; - else { - if (build.isDev) - console.error("\nVALIDATION ERROR\naction$() zod validated failed", "\n - Issues:", result.error.issues); - const zodErrorsFlatten = result.error.flatten(); - const fieldErrors = flattenZodIssues(result.error.issues); - return { - success: false, - status: 400, - error: { - formErrors: zodErrorsFlatten.formErrors, - fieldErrors - } - }; - } + if (build.isServer) return { + async validate(ev, inputData) { + const schema = qrl.resolve().then((obj) => { + if (typeof obj === "function") obj = obj(zod.z, ev); + if (obj instanceof zod.z.Schema) return obj; + else return zod.z.object(obj); + }); + const data = inputData ?? await ev.parseBody(); + const result = await (await schema).safeParseAsync(data); + if (result.success) return result; + else { + if (build.isDev) console.error("\nVALIDATION ERROR\naction$() zod validated failed", "\n - Issues:", result.error.issues); + const zodErrorsFlatten = result.error.flatten(); + const fieldErrors = flattenZodIssues(result.error.issues); + return { + success: false, + status: 400, + error: { + formErrors: zodErrorsFlatten.formErrors, + fieldErrors + } + }; } - }; + } + }; return void 0; }; const flattenZodIssues = (issues) => { @@ -1304,11 +1204,9 @@ const flattenZodIssues = (issues) => { const keySuffix = "expected" in issue && issue.expected === "array" ? "[]" : ""; const key = issue.path.map((path) => typeof path === "number" ? "*" : path).join(".").replace(/\.\*/g, "[]") + keySuffix; acc[key] = acc[key] || []; - if (Array.isArray(acc[key])) - acc[key].push(issue.message); + if (Array.isArray(acc[key])) acc[key].push(issue.message); return acc; - } else - acc[issue.path.join(".")] = issue.message; + } else acc[issue.path.join(".")] = issue.message; return acc; }, {}); }; @@ -1316,16 +1214,14 @@ const zod$ = /* @__PURE__ */ qwik.implicit$FirstArg(zodQrl); const deepFreeze = (obj) => { Object.getOwnPropertyNames(obj).forEach((prop) => { const value = obj[prop]; - if (value && typeof value === "object" && !Object.isFrozen(value)) - deepFreeze(value); + if (value && typeof value === "object" && !Object.isFrozen(value)) deepFreeze(value); }); return Object.freeze(obj); }; const serverQrl = (qrl, options) => { if (build.isServer) { const captured = qrl.getCaptured(); - if (captured && captured.length > 0 && !qwik._getContextElement()) - throw new Error("For security reasons, we cannot serialize QRLs that capture lexical scope."); + if (captured && captured.length > 0 && !qwik._getContextElement()) throw new Error("For security reasons, we cannot serialize QRLs that capture lexical scope."); } const method = options?.method?.toUpperCase?.() || "POST"; const headers = options?.headers || {}; @@ -1349,12 +1245,9 @@ const serverQrl = (qrl, options) => { } else { const ctxElm = qwik._getContextElement(); const filteredArgs = args.map((arg) => { - if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) - return new FormData(arg.target); - else if (arg instanceof Event) - return null; - else if (arg instanceof Node) - return null; + if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) return new FormData(arg.target); + else if (arg instanceof Event) return null; + else if (arg instanceof Node) return null; return arg; }); const qrlHash = qrl2.getHash(); @@ -1374,37 +1267,30 @@ const serverQrl = (qrl, options) => { qrl2, ...filteredArgs ], false); - if (method2 === "GET") - query += `&${QDATA_KEY}=${encodeURIComponent(body)}`; + if (method2 === "GET") query += `&${QDATA_KEY}=${encodeURIComponent(body)}`; else config.body = body; const res = await fetch(`${origin2}?${QFN_KEY}=${qrlHash}${query}`, config); const contentType = res.headers.get("Content-Type"); - if (res.ok && contentType === "text/qwik-json-stream" && res.body) - return async function* () { - try { - for await (const result of deserializeStream(res.body, ctxElm ?? document.documentElement, abortSignal)) - yield result; - } finally { - if (!abortSignal?.aborted) - await res.body.cancel(); - } - }(); + if (res.ok && contentType === "text/qwik-json-stream" && res.body) return async function* () { + try { + for await (const result of deserializeStream(res.body, ctxElm ?? document.documentElement, abortSignal)) yield result; + } finally { + if (!abortSignal?.aborted) await res.body.cancel(); + } + }(); else if (contentType === "application/qwik-json") { const str = await res.text(); const obj = await qwik._deserializeData(str, ctxElm ?? document.documentElement); - if (res.status === 500) - throw obj; + if (res.status === 500) throw obj; return obj; } else if (contentType === "application/json") { const obj = await res.json(); - if (res.status === 500) - throw obj; + if (res.status === 500) throw obj; return obj; } else if (contentType === "text/plain" || contentType === "text/html") { const str = await res.text(); - if (res.status === 500) - throw str; + if (res.status === 500) throw str; return str; } } @@ -1425,24 +1311,19 @@ const getValidators = (rest, qrl) => { if (rest.length === 1) { const options = rest[0]; if (options && typeof options === "object") { - if ("validate" in options) - validators.push(options); + if ("validate" in options) validators.push(options); else { id = options.id; - if (options.validation) - validators.push(...options.validation); + if (options.validation) validators.push(...options.validation); } } - } else if (rest.length > 1) - validators.push(...rest.filter((v) => !!v)); + } else if (rest.length > 1) validators.push(...rest.filter((v) => !!v)); if (typeof id === "string") { if (build.isDev) { - if (!/^[\w/.-]+$/.test(id)) - throw new Error(`Invalid id: ${id}, id can only contain [a-zA-Z0-9_.-]`); + if (!/^[\w/.-]+$/.test(id)) throw new Error(`Invalid id: ${id}, id can only contain [a-zA-Z0-9_.-]`); } id = `id_${id}`; - } else - id = qrl.getHash(); + } else id = qrl.getHash(); return { validators: validators.reverse(), id @@ -1455,15 +1336,13 @@ const deserializeStream = async function* (stream, ctxElm, abortSignal) { const decoder = new TextDecoder(); while (!abortSignal?.aborted) { const result = await reader.read(); - if (result.done) - break; + if (result.done) break; buffer += decoder.decode(result.value, { stream: true }); const lines = buffer.split(/\n/); buffer = lines.pop(); - for (const line of lines) - yield await qwik._deserializeData(line, ctxElm); + for (const line of lines) yield await qwik._deserializeData(line, ctxElm); } } finally { reader.releaseLock(); @@ -1473,30 +1352,28 @@ const Form = ({ action, spaReset, reloadDocument, onSubmit$, ...rest }, key) => qwik._jsxBranch(); if (action) { const isArrayApi = Array.isArray(onSubmit$); - if (isArrayApi) - return qwik._jsxS("form", { - ...rest, - get action() { - return action.actionPath; - }, - action: qwik._wrapSignal(action, "actionPath"), - "preventdefault:submit": !reloadDocument, - method: "post", - ["data-spa-reset"]: spaReset ? "true" : void 0, - onSubmit$: [ - ...onSubmit$, - // action.submit "submitcompleted" event for onSubmitCompleted$ events - !reloadDocument ? /* @__PURE__ */ qwik.inlinedQrl((evt) => { - const [action2] = qwik.useLexicalScope(); - if (!action2.submitted) - return action2.submit(evt); - }, "Form_form_onSubmit_uPHV2oGn4wc", [ - action - ]) : void 0 - ] - }, { - method: qwik._IMMUTABLE - }, 0, key); + if (isArrayApi) return qwik._jsxS("form", { + ...rest, + get action() { + return action.actionPath; + }, + action: qwik._wrapSignal(action, "actionPath"), + "preventdefault:submit": !reloadDocument, + method: "post", + ["data-spa-reset"]: spaReset ? "true" : void 0, + onSubmit$: [ + ...onSubmit$, + // action.submit "submitcompleted" event for onSubmitCompleted$ events + !reloadDocument ? /* @__PURE__ */ qwik.inlinedQrl((evt) => { + const [action2] = qwik.useLexicalScope(); + if (!action2.submitted) return action2.submit(evt); + }, "Form_form_onSubmit_uPHV2oGn4wc", [ + action + ]) : void 0 + ] + }, { + method: qwik._IMMUTABLE + }, 0, key); return qwik._jsxS("form", { ...rest, get action() { @@ -1515,13 +1392,12 @@ const Form = ({ action, spaReset, reloadDocument, onSubmit$, ...rest }, key) => }, { method: qwik._IMMUTABLE }, 0, key); - } else - return /* @__PURE__ */ qwik._jsxC(GetForm, { - spaReset, - reloadDocument, - onSubmit$, - ...rest - }, 0, key); + } else return /* @__PURE__ */ qwik._jsxC(GetForm, { + spaReset, + reloadDocument, + onSubmit$, + ...rest + }, 0, key); }; const GetForm = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => { const rest = qwik._restProps(props, [ @@ -1550,8 +1426,7 @@ const GetForm = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQr const formData = new FormData(form); const params = new URLSearchParams(); formData.forEach((value, key) => { - if (typeof value === "string") - params.append(key, value); + if (typeof value === "string") params.append(key, value); }); await nav2("?" + params.toString(), { type: "form", @@ -1561,8 +1436,7 @@ const GetForm = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQr nav ]), /* @__PURE__ */ qwik.inlinedQrl((_evt, form) => { - if (form.getAttribute("data-spa-reset") === "true") - form.reset(); + if (form.getAttribute("data-spa-reset") === "true") form.reset(); form.dispatchEvent(new CustomEvent("submitcompleted", { bubbles: false, cancelable: false, diff --git a/index.qwik.mjs b/index.qwik.mjs index 2b2e7e0..d1407ed 100644 --- a/index.qwik.mjs +++ b/index.qwik.mjs @@ -27,8 +27,7 @@ const spaInit = eventQrl(/* @__PURE__ */ inlinedQrl((container) => { const debounceTimeout = "_qCityScrollDebounce"; const scrollHistory = "_qCityScroll"; const checkAndScroll = (scrollState) => { - if (scrollState) - win.scrollTo(scrollState.x, scrollState.y); + if (scrollState) win.scrollTo(scrollState.x, scrollState.y); }; const currentScrollState2 = () => { const elm = document.documentElement; @@ -47,8 +46,7 @@ const spaInit = eventQrl(/* @__PURE__ */ inlinedQrl((container) => { if (!win[spa] && !win[initPopstate] && !win[initAnchors] && !win[initVisibility] && !win[initScroll]) { saveScrollState(); win[initPopstate] = () => { - if (win[spa]) - return; + if (win[spa]) return; win[scrollEnabled] = false; clearTimeout(win[debounceTimeout]); if (currentPath !== location.pathname + location.search) { @@ -74,14 +72,12 @@ const spaInit = eventQrl(/* @__PURE__ */ inlinedQrl((container) => { const pushState = history.pushState; const replaceState = history.replaceState; const prepareState = (state) => { - if (state === null || typeof state === "undefined") - state = {}; + if (state === null || typeof state === "undefined") state = {}; else if (state?.constructor !== Object) { state = { _data: state }; - if (isDev) - console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); + if (isDev) console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); } state._qCityScroll = state._qCityScroll || currentScrollState2(); return state; @@ -96,8 +92,7 @@ const spaInit = eventQrl(/* @__PURE__ */ inlinedQrl((container) => { }; } win[initAnchors] = (event) => { - if (win[spa] || event.defaultPrevented) - return; + if (win[spa] || event.defaultPrevented) return; const target = event.target.closest("a[href]"); if (target && !target.hasAttribute("preventdefault:click")) { const href = target.getAttribute("href"); @@ -107,11 +102,9 @@ const spaInit = eventQrl(/* @__PURE__ */ inlinedQrl((container) => { const samePath = dest.pathname + dest.search === prev.pathname + prev.search; if (sameOrigin && samePath) { event.preventDefault(); - if (dest.href !== prev.href) - history.pushState(null, "", dest); + if (dest.href !== prev.href) history.pushState(null, "", dest); if (!dest.hash) { - if (dest.href.endsWith("#")) - window.scrollTo(0, 0); + if (dest.href.endsWith("#")) window.scrollTo(0, 0); else { win[scrollEnabled] = false; clearTimeout(win[debounceTimeout]); @@ -125,19 +118,16 @@ const spaInit = eventQrl(/* @__PURE__ */ inlinedQrl((container) => { } else { const elmId = dest.hash.slice(1); const elm = document.getElementById(elmId); - if (elm) - elm.scrollIntoView(); + if (elm) elm.scrollIntoView(); } } } }; win[initVisibility] = () => { - if (!win[spa] && win[scrollEnabled] && document.visibilityState === "hidden") - saveScrollState(); + if (!win[spa] && win[scrollEnabled] && document.visibilityState === "hidden") saveScrollState(); }; win[initScroll] = () => { - if (win[spa] || !win[scrollEnabled]) - return; + if (win[spa] || !win[scrollEnabled]) return; clearTimeout(win[debounceTimeout]); win[debounceTimeout] = setTimeout(() => { saveScrollState(); @@ -151,10 +141,9 @@ const spaInit = eventQrl(/* @__PURE__ */ inlinedQrl((container) => { passive: true }); document.body.addEventListener("click", win[initAnchors]); - if (!win.navigation) - document.addEventListener("visibilitychange", win[initVisibility], { - passive: true - }); + if (!win.navigation) document.addEventListener("visibilitychange", win[initVisibility], { + passive: true + }); }, 0); } }, "spa_init_event_1RJPKHqF8AQ")); @@ -173,8 +162,7 @@ const shim$1 = async (base, path, symbol) => { if (!window._qcs && history.scrollRestoration === "manual") { window._qcs = true; const scrollState = history.state?._qCityScroll; - if (scrollState) - window.scrollTo(scrollState.x, scrollState.y); + if (scrollState) window.scrollTo(scrollState.x, scrollState.y); const script = document.currentScript; if (script) { const container = script.closest("[q\\:container]"); @@ -182,15 +170,13 @@ const shim$1 = async (base, path, symbol) => { if (isDev) { const imp = new Function("url", "return import(url)"); (await imp(url.href))[symbol](container); - } else - (await import(url.href))[symbol](container); + } else (await import(url.href))[symbol](container); } } }; const RouterOutlet = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(() => { const serverData = useServerData("containerAttributes"); - if (!serverData) - throw new Error("PrefetchServiceWorker component must be rendered on the server."); + if (!serverData) throw new Error("PrefetchServiceWorker component must be rendered on the server."); const shimScript = shim(serverData["q:base"]); _jsxBranch(); const nonce = useServerData("nonce"); @@ -198,11 +184,9 @@ const RouterOutlet = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(() if (context.value && context.value.length > 0) { const contentsLen = context.value.length; let cmp = null; - for (let i = contentsLen - 1; i >= 0; i--) - if (context.value[i].default) - cmp = _jsxC(context.value[i].default, { - children: cmp - }, 1, "zl_0"); + for (let i = contentsLen - 1; i >= 0; i--) if (context.value[i].default) cmp = _jsxC(context.value[i].default, { + children: cmp + }, 1, "zl_0"); return /* @__PURE__ */ _jsxC(Fragment, { children: [ cmp, @@ -234,23 +218,19 @@ const isSameSearchQuery = (a, b) => a.search === b.search; const isSamePath = (a, b) => isSameSearchQuery(a, b) && isSamePathname(a, b); const getClientDataPath = (pathname, pageSearch, action) => { let search = pageSearch ?? ""; - if (action) - search += (search ? "&" : "?") + QACTION_KEY + "=" + encodeURIComponent(action.id); + if (action) search += (search ? "&" : "?") + QACTION_KEY + "=" + encodeURIComponent(action.id); return pathname + (pathname.endsWith("/") ? "" : "/") + "q-data.json" + search; }; const getClientNavPath = (props, baseUrl) => { const href = props.href; - if (typeof href === "string" && typeof props.target !== "string" && !props.reload) - try { - const linkUrl = toUrl(href.trim(), baseUrl.url); - const currentUrl = toUrl("", baseUrl.url); - if (isSameOrigin(linkUrl, currentUrl)) - return toPath(linkUrl); - } catch (e) { - console.error(e); - } - else if (props.reload) - return toPath(toUrl("", baseUrl.url)); + if (typeof href === "string" && typeof props.target !== "string" && !props.reload) try { + const linkUrl = toUrl(href.trim(), baseUrl.url); + const currentUrl = toUrl("", baseUrl.url); + if (isSameOrigin(linkUrl, currentUrl)) return toPath(linkUrl); + } catch (e) { + console.error(e); + } + else if (props.reload) return toPath(toUrl("", baseUrl.url)); return null; }; const shouldPrefetchData = (clientNavPath, currentLoc) => { @@ -277,12 +257,10 @@ const resolveHead = (endpoint, routeLocation, contentModules, locale) => { const getData = (loaderOrAction) => { const id = loaderOrAction.__id; if (loaderOrAction.__brand === "server_loader") { - if (!(id in endpoint.loaders)) - throw new Error("You can not get the returned data of a loader that has not been executed for this request."); + if (!(id in endpoint.loaders)) throw new Error("You can not get the returned data of a loader that has not been executed for this request."); } const data = endpoint.loaders[id]; - if (isPromise(data)) - throw new Error("Loaders returning a promise can not be resolved for the head function."); + if (isPromise(data)) throw new Error("Loaders returning a promise can not be resolved for the head function."); return data; }; const headProps = { @@ -294,17 +272,14 @@ const resolveHead = (endpoint, routeLocation, contentModules, locale) => { for (let i = contentModules.length - 1; i >= 0; i--) { const contentModuleHead = contentModules[i] && contentModules[i].head; if (contentModuleHead) { - if (typeof contentModuleHead === "function") - resolveDocumentHead(head, withLocale(locale, () => contentModuleHead(headProps))); - else if (typeof contentModuleHead === "object") - resolveDocumentHead(head, contentModuleHead); + if (typeof contentModuleHead === "function") resolveDocumentHead(head, withLocale(locale, () => contentModuleHead(headProps))); + else if (typeof contentModuleHead === "object") resolveDocumentHead(head, contentModuleHead); } } return headProps.head; }; const resolveDocumentHead = (resolvedHead, updatedHead) => { - if (typeof updatedHead.title === "string") - resolvedHead.title = updatedHead.title; + if (typeof updatedHead.title === "string") resolvedHead.title = updatedHead.title; mergeArray(resolvedHead.meta, updatedHead.meta); mergeArray(resolvedHead.links, updatedHead.links); mergeArray(resolvedHead.styles, updatedHead.styles); @@ -312,17 +287,16 @@ const resolveDocumentHead = (resolvedHead, updatedHead) => { Object.assign(resolvedHead.frontmatter, updatedHead.frontmatter); }; const mergeArray = (existingArr, newArr) => { - if (Array.isArray(newArr)) - for (const newItem of newArr) { - if (typeof newItem.key === "string") { - const existingIndex = existingArr.findIndex((i) => i.key === newItem.key); - if (existingIndex > -1) { - existingArr[existingIndex] = newItem; - continue; - } + if (Array.isArray(newArr)) for (const newItem of newArr) { + if (typeof newItem.key === "string") { + const existingIndex = existingArr.findIndex((i) => i.key === newItem.key); + if (existingIndex > -1) { + existingArr[existingIndex] = newItem; + continue; } - existingArr.push(newItem); } + existingArr.push(newItem); + } }; const createDocumentHead = () => ({ title: "", @@ -355,26 +329,22 @@ function matchRoutePart(route, routeIdx, routeLength, path, pathIdx, pathLength) const paramValueStart = pathIdx - 1; if (isMany) { const match = recursiveScan(paramName, suffix, path, paramValueStart, pathLength, route, routeIdx + suffix.length + 1, routeLength); - if (match) - return Object.assign(params || (params = {}), match); + if (match) return Object.assign(params || (params = {}), match); } const paramValueEnd = scan(path, paramValueStart, pathLength, 47, suffix); - if (paramValueEnd == -1) - return null; + if (paramValueEnd == -1) return null; const paramValue = path.substring(paramValueStart, paramValueEnd); if (!isMany && !suffix && !paramValue) return null; pathIdx = paramValueEnd; (params || (params = {}))[paramName] = decodeURIComponent(paramValue); } else if (routeCh !== pathCh) { - if (!(isNaN(pathCh) && isRestParameter(route, routeIdx))) - return null; + if (!(isNaN(pathCh) && isRestParameter(route, routeIdx))) return null; } } if (allConsumed(route, routeIdx) && allConsumed(path, pathIdx)) return params || {}; - else - return null; + else return null; } function isRestParameter(text, idx) { return text.charCodeAt(idx) === 91 && isThreeDots(text, idx + 1); @@ -394,40 +364,27 @@ function isThreeDots(text, idx) { return text.charCodeAt(idx) === 46 && text.charCodeAt(idx + 1) === 46 && text.charCodeAt(idx + 2) === 46; } function scan(text, idx, end, ch, suffix = "") { - while (idx < end && text.charCodeAt(idx) !== ch) - idx++; + while (idx < end && text.charCodeAt(idx) !== ch) idx++; const suffixLength = suffix.length; for (let i = 0; i < suffixLength; i++) { - if (text.charCodeAt(idx - suffixLength + i) !== suffix.charCodeAt(i)) - return -1; + if (text.charCodeAt(idx - suffixLength + i) !== suffix.charCodeAt(i)) return -1; } return idx - suffixLength; } -let Char; -(function(Char2) { - Char2[Char2["EOL"] = 0] = "EOL"; - Char2[Char2["OPEN_BRACKET"] = 91] = "OPEN_BRACKET"; - Char2[Char2["CLOSE_BRACKET"] = 93] = "CLOSE_BRACKET"; - Char2[Char2["DOT"] = 46] = "DOT"; - Char2[Char2["SLASH"] = 47] = "SLASH"; -})(Char || (Char = {})); function recursiveScan(paramName, suffix, path, pathStart, pathLength, route, routeStart, routeLength) { - if (path.charCodeAt(pathStart) === 47) - pathStart++; + if (path.charCodeAt(pathStart) === 47) pathStart++; let pathIdx = pathLength; const sep = suffix + "/"; while (pathIdx >= pathStart) { const match = matchRoutePart(route, routeStart, routeLength, path, pathIdx, pathLength); if (match) { let value = path.substring(pathStart, Math.min(pathIdx, pathLength)); - if (value.endsWith(sep)) - value = value.substring(0, value.length - sep.length); + if (value.endsWith(sep)) value = value.substring(0, value.length - sep.length); match[paramName] = decodeURIComponent(value); return match; } const newPathIdx = lastIndexOf(path, pathStart, sep, pathIdx, pathStart - 1) + sep.length; - if (pathIdx === newPathIdx) - break; + if (pathIdx === newPathIdx) break; pathIdx = newPathIdx; } return null; @@ -439,13 +396,11 @@ function lastIndexOf(text, start, match, searchIdx, notFoundIdx) { return idx > start ? idx : notFoundIdx; } const loadRoute = async (routes, menus, cacheModules, pathname) => { - if (!Array.isArray(routes)) - return null; + if (!Array.isArray(routes)) return null; for (const routeData of routes) { const routeName = routeData[0]; const params = matchRoute(routeName, pathname); - if (!params) - continue; + if (!params) continue; const loaders = routeData[1]; const routeBundleNames = routeData[3]; const modules = new Array(loaders.length); @@ -456,8 +411,7 @@ const loadRoute = async (routes, menus, cacheModules, pathname) => { const menuLoader = getMenuLoader(menus, pathname); let menu = void 0; loadModule(menuLoader, pendingLoads, (menuModule) => menu = menuModule?.default, cacheModules); - if (pendingLoads.length > 0) - await Promise.all(pendingLoads); + if (pendingLoads.length > 0) await Promise.all(pendingLoads); return [ routeName, params, @@ -471,18 +425,14 @@ const loadRoute = async (routes, menus, cacheModules, pathname) => { const loadModule = (moduleLoader, pendingLoads, moduleSetter, cacheModules) => { if (typeof moduleLoader === "function") { const loadedModule = MODULE_CACHE.get(moduleLoader); - if (loadedModule) - moduleSetter(loadedModule); + if (loadedModule) moduleSetter(loadedModule); else { const moduleOrPromise = moduleLoader(); - if (typeof moduleOrPromise.then === "function") - pendingLoads.push(moduleOrPromise.then((loadedModule2) => { - if (cacheModules !== false) - MODULE_CACHE.set(moduleLoader, loadedModule2); - moduleSetter(loadedModule2); - })); - else if (moduleOrPromise) - moduleSetter(moduleOrPromise); + if (typeof moduleOrPromise.then === "function") pendingLoads.push(moduleOrPromise.then((loadedModule2) => { + if (cacheModules !== false) MODULE_CACHE.set(moduleLoader, loadedModule2); + moduleSetter(loadedModule2); + })); + else if (moduleOrPromise) moduleSetter(moduleOrPromise); } } }; @@ -490,8 +440,7 @@ const getMenuLoader = (menus, pathname) => { if (menus) { pathname = pathname.endsWith("/") ? pathname : pathname + "/"; const menu = menus.find((m) => m[0] === pathname || pathname.startsWith(m[0] + (pathname.endsWith("/") ? "" : "/"))); - if (menu) - return menu[1]; + if (menu) return menu[1]; } }; const clientNavigate = (win, navType, fromURL, toURL, replaceState = false) => { @@ -502,8 +451,7 @@ const clientNavigate = (win, navType, fromURL, toURL, replaceState = false) => { const newState = { _qCityScroll: newScrollState() }; - if (replaceState) - win.history.replaceState(newState, "", toPath(toURL)); + if (replaceState) win.history.replaceState(newState, "", toPath(toURL)); else win.history.pushState(newState, "", toPath(toURL)); } @@ -537,15 +485,12 @@ const loadClientData = async (url, element, opts) => { const pageSearch = url.search; const clientDataPath = getClientDataPath(pagePathname, pageSearch, opts?.action); let qData; - if (!opts?.action) - qData = CLIENT_DATA_CACHE.get(clientDataPath); - if (opts?.prefetchSymbols !== false) - prefetchSymbols(pagePathname); + if (!opts?.action) qData = CLIENT_DATA_CACHE.get(clientDataPath); + if (opts?.prefetchSymbols !== false) prefetchSymbols(pagePathname); let resolveFn; if (!qData) { const fetchOptions = getFetchOptions(opts?.action); - if (opts?.action) - opts.action.data = void 0; + if (opts?.action) opts.action.data = void 0; qData = fetch(clientDataPath, fetchOptions).then((rsp) => { if (rsp.redirected) { const redirectedURL = new URL(rsp.url); @@ -562,8 +507,7 @@ const loadClientData = async (url, element, opts) => { location.href = url.href; return; } - if (opts?.clearCache) - CLIENT_DATA_CACHE.delete(clientDataPath); + if (opts?.clearCache) CLIENT_DATA_CACHE.delete(clientDataPath); if (clientData.redirect) location.href = clientData.redirect; else if (opts?.action) { @@ -579,38 +523,32 @@ const loadClientData = async (url, element, opts) => { return clientData; }); else { - if (opts?.isPrefetch !== true) - location.href = url.href; + if (opts?.isPrefetch !== true) location.href = url.href; return void 0; } }); - if (!opts?.action) - CLIENT_DATA_CACHE.set(clientDataPath, qData); + if (!opts?.action) CLIENT_DATA_CACHE.set(clientDataPath, qData); } return qData.then((v) => { - if (!v) - CLIENT_DATA_CACHE.delete(clientDataPath); + if (!v) CLIENT_DATA_CACHE.delete(clientDataPath); resolveFn && resolveFn(); return v; }); }; const getFetchOptions = (action) => { const actionData = action?.data; - if (!actionData) - return void 0; - if (actionData instanceof FormData) - return { - method: "POST", - body: actionData - }; - else - return { - method: "POST", - body: JSON.stringify(actionData), - headers: { - "Content-Type": "application/json, charset=UTF-8" - } - }; + if (!actionData) return void 0; + if (actionData instanceof FormData) return { + method: "POST", + body: actionData + }; + else return { + method: "POST", + body: JSON.stringify(actionData), + headers: { + "Content-Type": "application/json, charset=UTF-8" + } + }; }; const useContent = () => useContext(ContentContext); const useDocumentHead = () => useContext(DocumentHeadContext); @@ -619,11 +557,9 @@ const useNavigate = () => useContext(RouteNavigateContext); const useAction = () => useContext(RouteActionContext); const useQwikCityEnv = () => noSerialize(useServerData("qwikcity")); const restoreScroll = (type, toUrl2, fromUrl, scroller, scrollState) => { - if (type === "popstate" && scrollState) - scroller.scrollTo(scrollState.x, scrollState.y); + if (type === "popstate" && scrollState) scroller.scrollTo(scrollState.x, scrollState.y); else if (type === "link" || type === "form") { - if (!hashScroll(toUrl2, fromUrl)) - scroller.scrollTo(0, 0); + if (!hashScroll(toUrl2, fromUrl)) scroller.scrollTo(0, 0); } }; const hashScroll = (toUrl2, fromUrl) => { @@ -657,11 +593,9 @@ const QWIK_CITY_SCROLLER = "_qCityScroller"; const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => { useStylesQrl(/* @__PURE__ */ inlinedQrl(`:root{view-transition-name:none}`, "QwikCityProvider_component_useStyles_RPDJAz33WLA")); const env = useQwikCityEnv(); - if (!env?.params) - throw new Error(`Missing Qwik City Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`); + if (!env?.params) throw new Error(`Missing Qwik City Env Data for help visit https://github.com/QwikDev/qwik/issues/6237`); const urlEnv = useServerData("url"); - if (!urlEnv) - throw new Error(`Missing Qwik URL Env Data`); + if (!urlEnv) throw new Error(`Missing Qwik URL Env Data`); const url = new URL(urlEnv); const routeLocation = useStore({ url, @@ -704,25 +638,21 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl forceReload: opt }; if (typeof path === "number") { - if (isBrowser) - history.go(path); + if (isBrowser) history.go(path); return; } const lastDest = routeInternal2.value.dest; const dest = path === void 0 ? lastDest : toUrl(path, routeLocation2.url); if (!isSameOrigin(dest, lastDest)) { - if (isBrowser) - location.href = dest.href; + if (isBrowser) location.href = dest.href; return; } if (!forceReload && isSamePath(dest, lastDest)) { if (isBrowser) { - if (type === "link" && dest.href !== location.href) - history.pushState(null, "", dest); + if (type === "link" && dest.href !== location.href) history.pushState(null, "", dest); const scroller = document.getElementById(QWIK_CITY_SCROLLER) ?? document.documentElement; restoreScroll(type, dest, new URL(location.href), scroller, getScrollHistory()); - if (type === "popstate") - window._qCityScrollEnabled = true; + if (type === "popstate") window._qCityScrollEnabled = true; } return; } @@ -778,10 +708,8 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl } else { trackUrl = new URL(navigation.dest, location); if (trackUrl.pathname.endsWith("/")) { - if (!qwikCity.trailingSlash) - trackUrl.pathname = trackUrl.pathname.slice(0, -1); - } else if (qwikCity.trailingSlash) - trackUrl.pathname += "/"; + if (!qwikCity.trailingSlash) trackUrl.pathname = trackUrl.pathname.slice(0, -1); + } else if (qwikCity.trailingSlash) trackUrl.pathname += "/"; let loadRoutePromise = loadRoute(qwikCity.routes, qwikCity.menus, qwikCity.cacheModules, trackUrl.pathname); elm = _getContextElement(); const pageData = clientPageData = await loadClientData(trackUrl, elm, { @@ -835,15 +763,13 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl if (props2.viewTransition !== false) document.__q_view_transition__ = true; let scrollState; - if (navType === "popstate") - scrollState = getScrollHistory(); + if (navType === "popstate") scrollState = getScrollHistory(); const scroller = document.getElementById(QWIK_CITY_SCROLLER) ?? document.documentElement; if (navigation.scroll && (!navigation.forceReload || !isSamePath(trackUrl, prevUrl)) && (navType === "link" || navType === "popstate") || navType === "form" && !isSamePath(trackUrl, prevUrl)) document.__q_scroll_restore__ = () => restoreScroll(navType, trackUrl, prevUrl, scroller, scrollState); const loaders = clientPageData?.loaders; const win = window; - if (loaders) - Object.assign(loaderState2, loaders); + if (loaders) Object.assign(loaderState2, loaders); CLIENT_DATA_CACHE.clear(); if (!win._qCitySPA) { win._qCitySPA = true; @@ -862,14 +788,12 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl const pushState = history.pushState; const replaceState2 = history.replaceState; const prepareState = (state) => { - if (state === null || typeof state === "undefined") - state = {}; + if (state === null || typeof state === "undefined") state = {}; else if (state?.constructor !== Object) { state = { _data: state }; - if (isDev) - console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); + if (isDev) console.warn("In a Qwik SPA context, `history.state` is used to store scroll state. Direct calls to `pushState()` and `replaceState()` must supply an actual Object type. We need to be able to automatically attach the scroll state to your state object. A new state object has been created, your data has been moved to: `history.state._data`"); } state._qCityScroll = state._qCityScroll || currentScrollState(scroller); return state; @@ -884,8 +808,7 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl }; } document.body.addEventListener("click", (event) => { - if (event.defaultPrevented) - return; + if (event.defaultPrevented) return; const target = event.target.closest("a[href]"); if (target && !target.hasAttribute("preventdefault:click")) { const href = target.getAttribute("href"); @@ -894,8 +817,7 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl if (isSameOrigin(dest, prev) && isSamePath(dest, prev)) { event.preventDefault(); if (!dest.hash && !dest.href.endsWith("#")) { - if (dest.href !== prev.href) - history.pushState(null, "", dest); + if (dest.href !== prev.href) history.pushState(null, "", dest); win._qCityScrollEnabled = false; clearTimeout(win._qCityScrollDebounce); saveScrollHistory({ @@ -925,8 +847,7 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl win._qCityInitVisibility = void 0; } win.addEventListener("scroll", () => { - if (!win._qCityScrollEnabled) - return; + if (!win._qCityScrollEnabled) return; clearTimeout(win._qCityScrollDebounce); win._qCityScrollDebounce = setTimeout(() => { const scrollState2 = currentScrollState(scroller); @@ -962,10 +883,8 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl } } const promise = run(); - if (isServer) - return promise; - else - return; + if (isServer) return promise; + else return; }, "QwikCityProvider_component_useTask_02wMImzEAbk", [ actionState, content, @@ -982,8 +901,7 @@ const QwikCityProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl return /* @__PURE__ */ _jsxC(Slot, null, 3, "qY_0"); }, "QwikCityProvider_component_TxCFOy819ag")); function getContainer(elm) { - while (elm && elm.nodeType !== Node.ELEMENT_NODE) - elm = elm.parentElement; + while (elm && elm.nodeType !== Node.ELEMENT_NODE) elm = elm.parentElement; return elm.closest("[q\\:container]"); } const QwikCityMockProvider = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => { @@ -1038,21 +956,18 @@ const Link = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => const prefetchData = untrack(() => !!clientNavPath && prefetchProp !== false && prefetchProp !== "js" && shouldPrefetchData(clientNavPath, loc) || void 0); const prefetch = untrack(() => prefetchData || !!clientNavPath && prefetchProp !== false && shouldPrefetchSymbols(clientNavPath, loc)); const handlePrefetch = prefetch ? /* @__PURE__ */ inlinedQrl((_, elm) => { - if (navigator.connection?.saveData) - return; + if (navigator.connection?.saveData) return; if (elm && elm.href) { const url = new URL(elm.href); prefetchSymbols(url.pathname); - if (elm.hasAttribute("data-prefetch")) - loadClientData(url, elm, { - prefetchSymbols: false, - isPrefetch: true - }); + if (elm.hasAttribute("data-prefetch")) loadClientData(url, elm, { + prefetchSymbols: false, + isPrefetch: true + }); } }, "Link_component_handlePrefetch_Osdg8FnYTw4") : void 0; const preventDefault = clientNavPath ? _qrlSync((event, target) => { - if (!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) - event.preventDefault(); + if (!(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) event.preventDefault(); }, "(event,target)=>{if(!(event.metaKey||event.ctrlKey||event.shiftKey||event.altKey)){event.preventDefault();}}") : void 0; const handleClick = clientNavPath ? /* @__PURE__ */ inlinedQrl(async (event, elm) => { const [nav2, reload2, replaceState2, scroll2] = useLexicalScope(); @@ -1124,8 +1039,7 @@ const routeActionQrl = (actionQrl, ...rest) => { const value = currentAction.value; if (value && value?.id === id) { const data = value.data; - if (data instanceof FormData) - initialState.formData = data; + if (data instanceof FormData) initialState.formData = data; if (value.output) { const { status, result } = value.output; initialState.status = status; @@ -1136,8 +1050,7 @@ const routeActionQrl = (actionQrl, ...rest) => { }); const submit = /* @__PURE__ */ inlinedQrl((input = {}) => { const [currentAction2, id2, loc2, state2] = useLexicalScope(); - if (isServer) - throw new Error(`Actions can not be invoked within the server during SSR. + if (isServer) throw new Error(`Actions can not be invoked within the server during SSR. Action.run() can only be called on the browser, for example when a user clicks a button, or submits a form.`); let data; let form; @@ -1145,14 +1058,11 @@ Action.run() can only be called on the browser, for example when a user clicks a form = input.target; data = new FormData(form); if ((input.submitter instanceof HTMLInputElement || input.submitter instanceof HTMLButtonElement) && input.submitter.name) { - if (input.submitter.name) - data.append(input.submitter.name, input.submitter.value); + if (input.submitter.name) data.append(input.submitter.name, input.submitter.value); } - } else - data = input; + } else data = input; return new Promise((resolve) => { - if (data instanceof FormData) - state2.formData = data; + if (data instanceof FormData) state2.formData = data; state2.submitted = true; state2.isRunning = true; loc2.isNavigating = true; @@ -1166,8 +1076,7 @@ Action.run() can only be called on the browser, for example when a user clicks a state2.status = status; state2.value = result; if (form) { - if (form.getAttribute("data-spa-reset") === "true") - form.reset(); + if (form.getAttribute("data-spa-reset") === "true") form.reset(); const detail = { status, value: result @@ -1203,8 +1112,7 @@ Action.run() can only be called on the browser, for example when a user clicks a const globalActionQrl = (actionQrl, ...rest) => { const action = routeActionQrl(actionQrl, ...rest); if (isServer) { - if (typeof globalThis._qwikActionsMap === "undefined") - globalThis._qwikActionsMap = /* @__PURE__ */ new Map(); + if (typeof globalThis._qwikActionsMap === "undefined") globalThis._qwikActionsMap = /* @__PURE__ */ new Map(); globalThis._qwikActionsMap.set(action.__id, action); } return action; @@ -1215,8 +1123,7 @@ const routeLoaderQrl = (loaderQrl, ...rest) => { const { id, validators } = getValidators(rest, loaderQrl); function loader() { return useContext(RouteStateContext, (state) => { - if (!(id in state)) - throw new Error(`routeLoader$ "${loaderQrl.getSymbol()}" was invoked in a route where it was not declared. + if (!(id in state)) throw new Error(`routeLoader$ "${loaderQrl.getSymbol()}" was invoked in a route where it was not declared. This is because the routeLoader$ was not exported in a 'layout.tsx' or 'index.tsx' file of the existing route. For more information check: https://qwik.dev/qwikcity/route-loader/ @@ -1234,45 +1141,38 @@ const routeLoaderQrl = (loaderQrl, ...rest) => { }; const routeLoader$ = /* @__PURE__ */ implicit$FirstArg(routeLoaderQrl); const validatorQrl = (validator) => { - if (isServer) - return { - validate: validator - }; + if (isServer) return { + validate: validator + }; return void 0; }; const validator$ = /* @__PURE__ */ implicit$FirstArg(validatorQrl); const zodQrl = (qrl) => { - if (isServer) - return { - async validate(ev, inputData) { - const schema = qrl.resolve().then((obj) => { - if (typeof obj === "function") - obj = obj(z, ev); - if (obj instanceof z.Schema) - return obj; - else - return z.object(obj); - }); - const data = inputData ?? await ev.parseBody(); - const result = await (await schema).safeParseAsync(data); - if (result.success) - return result; - else { - if (isDev) - console.error("\nVALIDATION ERROR\naction$() zod validated failed", "\n - Issues:", result.error.issues); - const zodErrorsFlatten = result.error.flatten(); - const fieldErrors = flattenZodIssues(result.error.issues); - return { - success: false, - status: 400, - error: { - formErrors: zodErrorsFlatten.formErrors, - fieldErrors - } - }; - } + if (isServer) return { + async validate(ev, inputData) { + const schema = qrl.resolve().then((obj) => { + if (typeof obj === "function") obj = obj(z, ev); + if (obj instanceof z.Schema) return obj; + else return z.object(obj); + }); + const data = inputData ?? await ev.parseBody(); + const result = await (await schema).safeParseAsync(data); + if (result.success) return result; + else { + if (isDev) console.error("\nVALIDATION ERROR\naction$() zod validated failed", "\n - Issues:", result.error.issues); + const zodErrorsFlatten = result.error.flatten(); + const fieldErrors = flattenZodIssues(result.error.issues); + return { + success: false, + status: 400, + error: { + formErrors: zodErrorsFlatten.formErrors, + fieldErrors + } + }; } - }; + } + }; return void 0; }; const flattenZodIssues = (issues) => { @@ -1286,11 +1186,9 @@ const flattenZodIssues = (issues) => { const keySuffix = "expected" in issue && issue.expected === "array" ? "[]" : ""; const key = issue.path.map((path) => typeof path === "number" ? "*" : path).join(".").replace(/\.\*/g, "[]") + keySuffix; acc[key] = acc[key] || []; - if (Array.isArray(acc[key])) - acc[key].push(issue.message); + if (Array.isArray(acc[key])) acc[key].push(issue.message); return acc; - } else - acc[issue.path.join(".")] = issue.message; + } else acc[issue.path.join(".")] = issue.message; return acc; }, {}); }; @@ -1298,16 +1196,14 @@ const zod$ = /* @__PURE__ */ implicit$FirstArg(zodQrl); const deepFreeze = (obj) => { Object.getOwnPropertyNames(obj).forEach((prop) => { const value = obj[prop]; - if (value && typeof value === "object" && !Object.isFrozen(value)) - deepFreeze(value); + if (value && typeof value === "object" && !Object.isFrozen(value)) deepFreeze(value); }); return Object.freeze(obj); }; const serverQrl = (qrl, options) => { if (isServer) { const captured = qrl.getCaptured(); - if (captured && captured.length > 0 && !_getContextElement()) - throw new Error("For security reasons, we cannot serialize QRLs that capture lexical scope."); + if (captured && captured.length > 0 && !_getContextElement()) throw new Error("For security reasons, we cannot serialize QRLs that capture lexical scope."); } const method = options?.method?.toUpperCase?.() || "POST"; const headers = options?.headers || {}; @@ -1331,12 +1227,9 @@ const serverQrl = (qrl, options) => { } else { const ctxElm = _getContextElement(); const filteredArgs = args.map((arg) => { - if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) - return new FormData(arg.target); - else if (arg instanceof Event) - return null; - else if (arg instanceof Node) - return null; + if (arg instanceof SubmitEvent && arg.target instanceof HTMLFormElement) return new FormData(arg.target); + else if (arg instanceof Event) return null; + else if (arg instanceof Node) return null; return arg; }); const qrlHash = qrl2.getHash(); @@ -1356,37 +1249,30 @@ const serverQrl = (qrl, options) => { qrl2, ...filteredArgs ], false); - if (method2 === "GET") - query += `&${QDATA_KEY}=${encodeURIComponent(body)}`; + if (method2 === "GET") query += `&${QDATA_KEY}=${encodeURIComponent(body)}`; else config.body = body; const res = await fetch(`${origin2}?${QFN_KEY}=${qrlHash}${query}`, config); const contentType = res.headers.get("Content-Type"); - if (res.ok && contentType === "text/qwik-json-stream" && res.body) - return async function* () { - try { - for await (const result of deserializeStream(res.body, ctxElm ?? document.documentElement, abortSignal)) - yield result; - } finally { - if (!abortSignal?.aborted) - await res.body.cancel(); - } - }(); + if (res.ok && contentType === "text/qwik-json-stream" && res.body) return async function* () { + try { + for await (const result of deserializeStream(res.body, ctxElm ?? document.documentElement, abortSignal)) yield result; + } finally { + if (!abortSignal?.aborted) await res.body.cancel(); + } + }(); else if (contentType === "application/qwik-json") { const str = await res.text(); const obj = await _deserializeData(str, ctxElm ?? document.documentElement); - if (res.status === 500) - throw obj; + if (res.status === 500) throw obj; return obj; } else if (contentType === "application/json") { const obj = await res.json(); - if (res.status === 500) - throw obj; + if (res.status === 500) throw obj; return obj; } else if (contentType === "text/plain" || contentType === "text/html") { const str = await res.text(); - if (res.status === 500) - throw str; + if (res.status === 500) throw str; return str; } } @@ -1407,24 +1293,19 @@ const getValidators = (rest, qrl) => { if (rest.length === 1) { const options = rest[0]; if (options && typeof options === "object") { - if ("validate" in options) - validators.push(options); + if ("validate" in options) validators.push(options); else { id = options.id; - if (options.validation) - validators.push(...options.validation); + if (options.validation) validators.push(...options.validation); } } - } else if (rest.length > 1) - validators.push(...rest.filter((v) => !!v)); + } else if (rest.length > 1) validators.push(...rest.filter((v) => !!v)); if (typeof id === "string") { if (isDev) { - if (!/^[\w/.-]+$/.test(id)) - throw new Error(`Invalid id: ${id}, id can only contain [a-zA-Z0-9_.-]`); + if (!/^[\w/.-]+$/.test(id)) throw new Error(`Invalid id: ${id}, id can only contain [a-zA-Z0-9_.-]`); } id = `id_${id}`; - } else - id = qrl.getHash(); + } else id = qrl.getHash(); return { validators: validators.reverse(), id @@ -1437,15 +1318,13 @@ const deserializeStream = async function* (stream, ctxElm, abortSignal) { const decoder = new TextDecoder(); while (!abortSignal?.aborted) { const result = await reader.read(); - if (result.done) - break; + if (result.done) break; buffer += decoder.decode(result.value, { stream: true }); const lines = buffer.split(/\n/); buffer = lines.pop(); - for (const line of lines) - yield await _deserializeData(line, ctxElm); + for (const line of lines) yield await _deserializeData(line, ctxElm); } } finally { reader.releaseLock(); @@ -1455,30 +1334,28 @@ const Form = ({ action, spaReset, reloadDocument, onSubmit$, ...rest }, key) => _jsxBranch(); if (action) { const isArrayApi = Array.isArray(onSubmit$); - if (isArrayApi) - return _jsxS("form", { - ...rest, - get action() { - return action.actionPath; - }, - action: _wrapSignal(action, "actionPath"), - "preventdefault:submit": !reloadDocument, - method: "post", - ["data-spa-reset"]: spaReset ? "true" : void 0, - onSubmit$: [ - ...onSubmit$, - // action.submit "submitcompleted" event for onSubmitCompleted$ events - !reloadDocument ? /* @__PURE__ */ inlinedQrl((evt) => { - const [action2] = useLexicalScope(); - if (!action2.submitted) - return action2.submit(evt); - }, "Form_form_onSubmit_uPHV2oGn4wc", [ - action - ]) : void 0 - ] - }, { - method: _IMMUTABLE - }, 0, key); + if (isArrayApi) return _jsxS("form", { + ...rest, + get action() { + return action.actionPath; + }, + action: _wrapSignal(action, "actionPath"), + "preventdefault:submit": !reloadDocument, + method: "post", + ["data-spa-reset"]: spaReset ? "true" : void 0, + onSubmit$: [ + ...onSubmit$, + // action.submit "submitcompleted" event for onSubmitCompleted$ events + !reloadDocument ? /* @__PURE__ */ inlinedQrl((evt) => { + const [action2] = useLexicalScope(); + if (!action2.submitted) return action2.submit(evt); + }, "Form_form_onSubmit_uPHV2oGn4wc", [ + action + ]) : void 0 + ] + }, { + method: _IMMUTABLE + }, 0, key); return _jsxS("form", { ...rest, get action() { @@ -1497,13 +1374,12 @@ const Form = ({ action, spaReset, reloadDocument, onSubmit$, ...rest }, key) => }, { method: _IMMUTABLE }, 0, key); - } else - return /* @__PURE__ */ _jsxC(GetForm, { - spaReset, - reloadDocument, - onSubmit$, - ...rest - }, 0, key); + } else return /* @__PURE__ */ _jsxC(GetForm, { + spaReset, + reloadDocument, + onSubmit$, + ...rest + }, 0, key); }; const GetForm = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => { const rest = _restProps(props, [ @@ -1532,8 +1408,7 @@ const GetForm = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) const formData = new FormData(form); const params = new URLSearchParams(); formData.forEach((value, key) => { - if (typeof value === "string") - params.append(key, value); + if (typeof value === "string") params.append(key, value); }); await nav2("?" + params.toString(), { type: "form", @@ -1543,8 +1418,7 @@ const GetForm = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) nav ]), /* @__PURE__ */ inlinedQrl((_evt, form) => { - if (form.getAttribute("data-spa-reset") === "true") - form.reset(); + if (form.getAttribute("data-spa-reset") === "true") form.reset(); form.dispatchEvent(new CustomEvent("submitcompleted", { bubbles: false, cancelable: false, diff --git a/middleware/bun/index.mjs b/middleware/bun/index.mjs index 96c7011..7290e3e 100644 --- a/middleware/bun/index.mjs +++ b/middleware/bun/index.mjs @@ -169,6 +169,12 @@ function createQwikCity(opts) { const url = new URL(request.url); if (isStaticPath(request.method || "GET", url)) { const { filePath, content } = await openStaticFile(url); + if (!await content.exists()) { + return new Response("Not Found", { + status: 404, + headers: { "Content-Type": "text/plain; charset=utf-8", "X-Not-Found": url.pathname } + }); + } const ext = extname(filePath).replace(/^\./, ""); return new Response(await content.stream(), { status: 200, diff --git a/vite/index.cjs b/vite/index.cjs index 4bce0f3..2c599be 100644 --- a/vite/index.cjs +++ b/vite/index.cjs @@ -272,9 +272,9 @@ var init_unist_util_visit = __esm({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/identity.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/identity.js var require_identity = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/identity.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/identity.js"(exports2) { "use strict"; var ALIAS = Symbol.for("yaml.alias"); var DOC = Symbol.for("yaml.document"); @@ -329,9 +329,9 @@ var require_identity = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/visit.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/visit.js var require_visit = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/visit.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/visit.js"(exports2) { "use strict"; var identity = require_identity(); var BREAK = Symbol("break visit"); @@ -488,9 +488,9 @@ var require_visit = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/directives.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/directives.js var require_directives = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/directives.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/directives.js"(exports2) { "use strict"; var identity = require_identity(); var visit2 = require_visit(); @@ -659,9 +659,9 @@ var require_directives = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/anchors.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/anchors.js var require_anchors = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/anchors.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/anchors.js"(exports2) { "use strict"; var identity = require_identity(); var visit2 = require_visit(); @@ -730,9 +730,9 @@ var require_anchors = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/applyReviver.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/applyReviver.js var require_applyReviver = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/applyReviver.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/applyReviver.js"(exports2) { "use strict"; function applyReviver(reviver, obj, key, val) { if (val && typeof val === "object") { @@ -780,9 +780,9 @@ var require_applyReviver = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/toJS.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/toJS.js var require_toJS = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/toJS.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/toJS.js"(exports2) { "use strict"; var identity = require_identity(); function toJS(value2, arg, ctx) { @@ -810,9 +810,9 @@ var require_toJS = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Node.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Node.js var require_Node = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Node.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Node.js"(exports2) { "use strict"; var applyReviver = require_applyReviver(); var identity = require_identity(); @@ -851,9 +851,9 @@ var require_Node = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Alias.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Alias.js var require_Alias = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Alias.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Alias.js"(exports2) { "use strict"; var anchors = require_anchors(); var visit2 = require_visit(); @@ -953,9 +953,9 @@ var require_Alias = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Scalar.js var require_Scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Scalar.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Scalar.js"(exports2) { "use strict"; var identity = require_identity(); var Node = require_Node(); @@ -983,9 +983,9 @@ var require_Scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/createNode.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/createNode.js var require_createNode = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/createNode.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/createNode.js"(exports2) { "use strict"; var Alias = require_Alias(); var identity = require_identity(); @@ -1063,9 +1063,9 @@ var require_createNode = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Collection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Collection.js var require_Collection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Collection.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Collection.js"(exports2) { "use strict"; var createNode = require_createNode(); var identity = require_identity(); @@ -1207,9 +1207,9 @@ var require_Collection = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyComment.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyComment.js var require_stringifyComment = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyComment.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyComment.js"(exports2) { "use strict"; var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#"); function indentComment(comment, indent2) { @@ -1224,9 +1224,9 @@ var require_stringifyComment = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/foldFlowLines.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/foldFlowLines.js var require_foldFlowLines = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/foldFlowLines.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/foldFlowLines.js"(exports2) { "use strict"; var FOLD_FLOW = "flow"; var FOLD_BLOCK = "block"; @@ -1358,9 +1358,9 @@ ${indent2}${text3.slice(fold + 1, end2)}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyString.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyString.js var require_stringifyString = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyString.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyString.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var foldFlowLines = require_foldFlowLines(); @@ -1505,9 +1505,9 @@ ${indent2}`) + "'"; return quotedString(value2, ctx); } const indent2 = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value2) ? " " : ""); - const literal = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value2, lineWidth, indent2.length); + const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value2, lineWidth, indent2.length); if (!value2) - return literal ? "|\n" : ">\n"; + return literal2 ? "|\n" : ">\n"; let chomp; let endStart; for (endStart = value2.length; endStart > 0; --endStart) { @@ -1550,13 +1550,13 @@ ${indent2}`) + "'"; start = start.replace(/\n+/g, `$&${indent2}`); } const indentSize = indent2 ? "2" : "1"; - let header = (literal ? "|" : ">") + (startWithSpace ? indentSize : "") + chomp; + let header = (literal2 ? "|" : ">") + (startWithSpace ? indentSize : "") + chomp; if (comment) { header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " ")); if (onComment) onComment(); } - if (literal) { + if (literal2) { value2 = value2.replace(/\n+/g, `$&${indent2}`); return `${header} ${indent2}${start}${value2}${end}`; @@ -1636,9 +1636,9 @@ ${indent2}`); } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringify.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringify.js var require_stringify = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringify.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringify.js"(exports2) { "use strict"; var anchors = require_anchors(); var identity = require_identity(); @@ -1760,9 +1760,9 @@ ${ctx.indent}${str}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyPair.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyPair.js var require_stringifyPair = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyPair.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyPair.js"(exports2) { "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); @@ -1775,7 +1775,7 @@ var require_stringifyPair = __commonJS({ if (keyComment) { throw new Error("With simple keys, key nodes cannot have comments"); } - if (identity.isCollection(key)) { + if (identity.isCollection(key) || !identity.isNode(key) && typeof key === "object") { const msg = "With simple keys, collection cannot be used as a key value"; throw new Error(msg); } @@ -1893,9 +1893,9 @@ ${ctx.indent}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/log.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/log.js var require_log = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/log.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/log.js"(exports2) { "use strict"; function debug(logLevel, ...messages2) { if (logLevel === "debug") @@ -1914,9 +1914,9 @@ var require_log = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/addPairToJSMap.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/addPairToJSMap.js var require_addPairToJSMap = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports2) { "use strict"; var log = require_log(); var stringify2 = require_stringify(); @@ -2008,9 +2008,9 @@ var require_addPairToJSMap = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Pair.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Pair.js var require_Pair = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Pair.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Pair.js"(exports2) { "use strict"; var createNode = require_createNode(); var stringifyPair = require_stringifyPair(); @@ -2048,9 +2048,9 @@ var require_Pair = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyCollection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyCollection.js var require_stringifyCollection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports2) { "use strict"; var identity = require_identity(); var stringify2 = require_stringify(); @@ -2192,9 +2192,9 @@ ${indent2}${end}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLMap.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLMap.js var require_YAMLMap = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLMap.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLMap.js"(exports2) { "use strict"; var stringifyCollection = require_stringifyCollection(); var addPairToJSMap = require_addPairToJSMap(); @@ -2337,9 +2337,9 @@ var require_YAMLMap = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/map.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/map.js var require_map = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/map.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/map.js"(exports2) { "use strict"; var identity = require_identity(); var YAMLMap = require_YAMLMap(); @@ -2359,9 +2359,9 @@ var require_map = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLSeq.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLSeq.js var require_YAMLSeq = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLSeq.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLSeq.js"(exports2) { "use strict"; var createNode = require_createNode(); var stringifyCollection = require_stringifyCollection(); @@ -2475,9 +2475,9 @@ var require_YAMLSeq = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/seq.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/seq.js var require_seq = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/seq.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/seq.js"(exports2) { "use strict"; var identity = require_identity(); var YAMLSeq = require_YAMLSeq(); @@ -2497,9 +2497,9 @@ var require_seq = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/string.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/string.js var require_string = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/string.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/string.js"(exports2) { "use strict"; var stringifyString = require_stringifyString(); var string = { @@ -2516,9 +2516,9 @@ var require_string = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/null.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/null.js var require_null = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/null.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/null.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var nullTag = { @@ -2534,9 +2534,9 @@ var require_null = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/bool.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/bool.js var require_bool = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/bool.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/bool.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var boolTag = { @@ -2558,9 +2558,9 @@ var require_bool = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyNumber.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyNumber.js var require_stringifyNumber = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyNumber.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyNumber.js"(exports2) { "use strict"; function stringifyNumber({ format, minFractionDigits, tag: tag2, value: value2 }) { if (typeof value2 === "bigint") @@ -2585,9 +2585,9 @@ var require_stringifyNumber = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/float.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/float.js var require_float = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/float.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/float.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var stringifyNumber = require_stringifyNumber(); @@ -2595,7 +2595,7 @@ var require_float = __commonJS({ identify: (value2) => typeof value2 === "number", default: true, tag: "tag:yaml.org,2002:float", - test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/, + test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/, resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: stringifyNumber.stringifyNumber }; @@ -2631,9 +2631,9 @@ var require_float = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/int.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/int.js var require_int = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/int.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/int.js"(exports2) { "use strict"; var stringifyNumber = require_stringifyNumber(); var intIdentify = (value2) => typeof value2 === "bigint" || Number.isInteger(value2); @@ -2676,9 +2676,9 @@ var require_int = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/schema.js var require_schema = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/schema.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/schema.js"(exports2) { "use strict"; var map4 = require_map(); var _null = require_null(); @@ -2704,9 +2704,9 @@ var require_schema = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/json/schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/json/schema.js var require_schema2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/json/schema.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/json/schema.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var map4 = require_map(); @@ -2771,9 +2771,9 @@ var require_schema2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/binary.js var require_binary = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var stringifyString = require_stringifyString(); @@ -2835,9 +2835,9 @@ var require_binary = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/pairs.js var require_pairs = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports2) { "use strict"; var identity = require_identity(); var Pair = require_Pair(); @@ -2913,9 +2913,9 @@ ${cn.comment}` : item.comment; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/omap.js var require_omap = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports2) { "use strict"; var identity = require_identity(); var toJS = require_toJS(); @@ -2991,9 +2991,9 @@ var require_omap = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/bool.js var require_bool2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports2) { "use strict"; var Scalar = require_Scalar(); function boolStringify({ value: value2, source }, ctx) { @@ -3023,9 +3023,9 @@ var require_bool2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/float.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/float.js var require_float2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var stringifyNumber = require_stringifyNumber(); @@ -3033,7 +3033,7 @@ var require_float2 = __commonJS({ identify: (value2) => typeof value2 === "number", default: true, tag: "tag:yaml.org,2002:float", - test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/, + test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/, resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: stringifyNumber.stringifyNumber }; @@ -3072,9 +3072,9 @@ var require_float2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/int.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/int.js var require_int2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/int.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/int.js"(exports2) { "use strict"; var stringifyNumber = require_stringifyNumber(); var intIdentify = (value2) => typeof value2 === "bigint" || Number.isInteger(value2); @@ -3151,9 +3151,9 @@ var require_int2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/set.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/set.js var require_set = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports2) { "use strict"; var identity = require_identity(); var Pair = require_Pair(); @@ -3240,9 +3240,9 @@ var require_set = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js var require_timestamp = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports2) { "use strict"; var stringifyNumber = require_stringifyNumber(); function parseSexagesimal(str, asBigInt) { @@ -3328,9 +3328,9 @@ var require_timestamp = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/schema.js var require_schema3 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/schema.js"(exports2) { "use strict"; var map4 = require_map(); var _null = require_null(); @@ -3370,9 +3370,9 @@ var require_schema3 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/tags.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/tags.js var require_tags = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/tags.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/tags.js"(exports2) { "use strict"; var map4 = require_map(); var _null = require_null(); @@ -3453,9 +3453,9 @@ var require_tags = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/Schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/Schema.js var require_Schema = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/Schema.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/Schema.js"(exports2) { "use strict"; var identity = require_identity(); var map4 = require_map(); @@ -3486,9 +3486,9 @@ var require_Schema = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyDocument.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyDocument.js var require_stringifyDocument = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports2) { "use strict"; var identity = require_identity(); var stringify2 = require_stringify(); @@ -3567,9 +3567,9 @@ var require_stringifyDocument = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/Document.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/Document.js var require_Document = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/Document.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/Document.js"(exports2) { "use strict"; var Alias = require_Alias(); var Collection = require_Collection(); @@ -3875,9 +3875,9 @@ var require_Document = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/errors.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/errors.js var require_errors = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/errors.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/errors.js"(exports2) { "use strict"; var YAMLError = class extends Error { constructor(name, pos, code3, message) { @@ -3940,11 +3940,11 @@ ${pointer} } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-props.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-props.js var require_resolve_props = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-props.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-props.js"(exports2) { "use strict"; - function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) { + function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) { let spaceBefore = false; let atNewline = startOnNewline; let hasSpace = startOnNewline; @@ -3953,6 +3953,7 @@ var require_resolve_props = __commonJS({ let hasNewline = false; let hasNewlineAfterProp = false; let reqSpace = false; + let tab = null; let anchor = null; let tag2 = null; let comma = null; @@ -3964,10 +3965,17 @@ var require_resolve_props = __commonJS({ onError(token.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"); reqSpace = false; } + if (tab) { + if (atNewline && token.type !== "comment" && token.type !== "newline") { + onError(tab, "TAB_AS_INDENT", "Tabs are not allowed as indentation"); + } + tab = null; + } switch (token.type) { case "space": - if (!flow && atNewline && indicator !== "doc-start" && token.source[0] === " ") - onError(token, "TAB_AS_INDENT", "Tabs are not allowed as indentation"); + if (!flow && (indicator !== "doc-start" || (next == null ? void 0 : next.type) !== "flow-collection") && token.source.includes(" ")) { + tab = token; + } hasSpace = true; break; case "comment": { @@ -4025,7 +4033,7 @@ var require_resolve_props = __commonJS({ if (found) onError(token, "UNEXPECTED_TOKEN", `Unexpected ${token.source} in ${flow ?? "collection"}`); found = token; - atNewline = false; + atNewline = indicator === "seq-item-ind" || indicator === "explicit-key-ind"; hasSpace = false; break; case "comma": @@ -4045,8 +4053,11 @@ var require_resolve_props = __commonJS({ } const last = tokens[tokens.length - 1]; const end = last ? last.offset + last.source.length : offset; - if (reqSpace && next && next.type !== "space" && next.type !== "newline" && next.type !== "comma" && (next.type !== "scalar" || next.source !== "")) + if (reqSpace && next && next.type !== "space" && next.type !== "newline" && next.type !== "comma" && (next.type !== "scalar" || next.source !== "")) { onError(next.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"); + } + if (tab && (atNewline && tab.indent <= parentIndent || (next == null ? void 0 : next.type) === "block-map" || (next == null ? void 0 : next.type) === "block-seq")) + onError(tab, "TAB_AS_INDENT", "Tabs are not allowed as indentation"); return { comma, found, @@ -4064,9 +4075,9 @@ var require_resolve_props = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-contains-newline.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-contains-newline.js var require_util_contains_newline = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-contains-newline.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-contains-newline.js"(exports2) { "use strict"; function containsNewline(key) { if (!key) @@ -4106,9 +4117,9 @@ var require_util_contains_newline = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-flow-indent-check.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-flow-indent-check.js var require_util_flow_indent_check = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-flow-indent-check.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-flow-indent-check.js"(exports2) { "use strict"; var utilContainsNewline = require_util_contains_newline(); function flowIndentCheck(indent2, fc, onError) { @@ -4124,9 +4135,9 @@ var require_util_flow_indent_check = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-map-includes.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-map-includes.js var require_util_map_includes = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-map-includes.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-map-includes.js"(exports2) { "use strict"; var identity = require_identity(); function mapIncludes(ctx, items, search2) { @@ -4140,9 +4151,9 @@ var require_util_map_includes = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-map.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-map.js var require_resolve_block_map = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-map.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-map.js"(exports2) { "use strict"; var Pair = require_Pair(); var YAMLMap = require_YAMLMap(); @@ -4166,6 +4177,7 @@ var require_resolve_block_map = __commonJS({ next: key ?? (sep == null ? void 0 : sep[0]), offset, onError, + parentIndent: bm.indent, startOnNewline: true }); const implicitKey = !keyProps.found; @@ -4203,6 +4215,7 @@ var require_resolve_block_map = __commonJS({ next: value2, offset: keyNode.range[2], onError, + parentIndent: bm.indent, startOnNewline: !key || key.type === "block-scalar" }); offset = valueProps.end; @@ -4245,9 +4258,9 @@ var require_resolve_block_map = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-seq.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-seq.js var require_resolve_block_seq = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-seq.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-seq.js"(exports2) { "use strict"; var YAMLSeq = require_YAMLSeq(); var resolveProps = require_resolve_props(); @@ -4265,6 +4278,7 @@ var require_resolve_block_seq = __commonJS({ next: value2, offset, onError, + parentIndent: bs.indent, startOnNewline: true }); if (!props.found) { @@ -4293,9 +4307,9 @@ var require_resolve_block_seq = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-end.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-end.js var require_resolve_end = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-end.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-end.js"(exports2) { "use strict"; function resolveEnd(end, offset, reqSpace, onError) { let comment = ""; @@ -4336,9 +4350,9 @@ var require_resolve_end = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-collection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-collection.js var require_resolve_flow_collection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports2) { "use strict"; var identity = require_identity(); var Pair = require_Pair(); @@ -4369,6 +4383,7 @@ var require_resolve_flow_collection = __commonJS({ next: key ?? (sep == null ? void 0 : sep[0]), offset, onError, + parentIndent: fc.indent, startOnNewline: false }); if (!props.found) { @@ -4444,6 +4459,7 @@ var require_resolve_flow_collection = __commonJS({ next: value2, offset: keyNode.range[2], onError, + parentIndent: fc.indent, startOnNewline: false }); if (valueProps.found) { @@ -4523,9 +4539,9 @@ var require_resolve_flow_collection = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-collection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-collection.js var require_compose_collection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-collection.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-collection.js"(exports2) { "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); @@ -4580,14 +4596,14 @@ var require_compose_collection = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-scalar.js var require_resolve_block_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports2) { "use strict"; var Scalar = require_Scalar(); - function resolveBlockScalar(scalar, strict, onError) { + function resolveBlockScalar(ctx, scalar, onError) { const start = scalar.offset; - const header = parseBlockScalarHeader(scalar, strict, onError); + const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError); if (!header) return { value: "", type: null, comment: "", range: [start, start, start] }; const type = header.mode === ">" ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL; @@ -4623,6 +4639,10 @@ var require_resolve_block_scalar = __commonJS({ if (header.indent === 0) trimIndent = indent2.length; contentStart = i; + if (trimIndent === 0 && !ctx.atRoot) { + const message = "Block scalar values in collections must be indented"; + onError(offset, "BAD_INDENT", message); + } break; } offset += indent2.length + content.length + 1; @@ -4757,9 +4777,9 @@ var require_resolve_block_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-scalar.js var require_resolve_flow_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports2) { "use strict"; var Scalar = require_Scalar(); var resolveEnd = require_resolve_end(); @@ -4974,16 +4994,16 @@ var require_resolve_flow_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-scalar.js var require_compose_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-scalar.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-scalar.js"(exports2) { "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); var resolveBlockScalar = require_resolve_block_scalar(); var resolveFlowScalar = require_resolve_flow_scalar(); function composeScalar(ctx, token, tagToken, onError) { - const { value: value2, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(token, ctx.options.strict, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); + const { value: value2, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null; const tag2 = tagToken && tagName ? findScalarTagByName(ctx.schema, value2, tagName, tagToken, onError) : token.type === "scalar" ? findScalarTagByTest(ctx, value2, token, onError) : ctx.schema[identity.SCALAR]; let scalar; @@ -5054,9 +5074,9 @@ var require_compose_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-empty-scalar-position.js var require_util_empty_scalar_position = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-empty-scalar-position.js"(exports2) { "use strict"; function emptyScalarPosition(offset, before, pos) { if (before) { @@ -5085,9 +5105,9 @@ var require_util_empty_scalar_position = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-node.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-node.js var require_compose_node = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-node.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-node.js"(exports2) { "use strict"; var Alias = require_Alias(); var composeCollection = require_compose_collection(); @@ -5180,9 +5200,9 @@ var require_compose_node = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-doc.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-doc.js var require_compose_doc = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-doc.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-doc.js"(exports2) { "use strict"; var Document = require_Document(); var composeNode = require_compose_node(); @@ -5202,6 +5222,7 @@ var require_compose_doc = __commonJS({ next: value2 ?? (end == null ? void 0 : end[0]), offset, onError, + parentIndent: 0, startOnNewline: true }); if (props.found) { @@ -5221,9 +5242,9 @@ var require_compose_doc = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/composer.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/composer.js var require_composer = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/composer.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/composer.js"(exports2) { "use strict"; var directives = require_directives(); var Document = require_Document(); @@ -5427,9 +5448,9 @@ ${end.comment}` : end.comment; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-scalar.js var require_cst_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-scalar.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-scalar.js"(exports2) { "use strict"; var resolveBlockScalar = require_resolve_block_scalar(); var resolveFlowScalar = require_resolve_flow_scalar(); @@ -5450,7 +5471,7 @@ var require_cst_scalar = __commonJS({ case "double-quoted-scalar": return resolveFlowScalar.resolveFlowScalar(token, strict, _onError); case "block-scalar": - return resolveBlockScalar.resolveBlockScalar(token, strict, _onError); + return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError); } } return null; @@ -5612,9 +5633,9 @@ var require_cst_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-stringify.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-stringify.js var require_cst_stringify = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-stringify.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-stringify.js"(exports2) { "use strict"; var stringify2 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst); function stringifyToken(token) { @@ -5673,9 +5694,9 @@ var require_cst_stringify = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-visit.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-visit.js var require_cst_visit = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-visit.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-visit.js"(exports2) { "use strict"; var BREAK = Symbol("break visit"); var SKIP2 = Symbol("skip children"); @@ -5735,9 +5756,9 @@ var require_cst_visit = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst.js var require_cst = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst.js"(exports2) { "use strict"; var cstScalar = require_cst_scalar(); var cstStringify = require_cst_stringify(); @@ -5837,9 +5858,9 @@ var require_cst = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/lexer.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/lexer.js var require_lexer = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/lexer.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/lexer.js"(exports2) { "use strict"; var cst = require_cst(); function isEmpty(ch) { @@ -5854,11 +5875,11 @@ var require_lexer = __commonJS({ return false; } } - var hexDigits = "0123456789ABCDEFabcdef".split(""); - var tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""); - var invalidFlowScalarChars = ",[]{}".split(""); - var invalidAnchorChars = " ,[]{}\n\r ".split(""); - var isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch); + var hexDigits = new Set("0123456789ABCDEFabcdef"); + var tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"); + var flowIndicatorChars = new Set(",[]{}"); + var invalidAnchorChars = new Set(" ,[]{}\n\r "); + var isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch); var Lexer = class { constructor() { this.atEnd = false; @@ -5881,6 +5902,8 @@ var require_lexer = __commonJS({ */ *lex(source, incomplete = false) { if (source) { + if (typeof source !== "string") + throw TypeError("source is not a string"); this.buffer = this.buffer ? this.buffer + source : source; this.lineEndPos = null; } @@ -5978,11 +6001,15 @@ var require_lexer = __commonJS({ } if (line[0] === "%") { let dirEnd = line.length; - const cs = line.indexOf("#"); - if (cs !== -1) { + let cs = line.indexOf("#"); + while (cs !== -1) { const ch = line[cs - 1]; - if (ch === " " || ch === " ") + if (ch === " " || ch === " ") { dirEnd = cs - 1; + break; + } else { + cs = line.indexOf("#", cs + 1); + } } while (true) { const ch = line[dirEnd - 1]; @@ -6206,17 +6233,17 @@ var require_lexer = __commonJS({ let indent2 = 0; let ch; loop: - for (let i = this.pos; ch = this.buffer[i]; ++i) { + for (let i2 = this.pos; ch = this.buffer[i2]; ++i2) { switch (ch) { case " ": indent2 += 1; break; case "\n": - nl = i; + nl = i2; indent2 = 0; break; case "\r": { - const next = this.buffer[i + 1]; + const next = this.buffer[i2 + 1]; if (!next && !this.atEnd) return this.setNext("block-scalar"); if (next === "\n") @@ -6231,8 +6258,9 @@ var require_lexer = __commonJS({ if (indent2 >= this.indentNext) { if (this.blockScalarIndent === -1) this.indentNext = indent2; - else - this.indentNext += this.blockScalarIndent; + else { + this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext); + } do { const cs = this.continueScalar(nl + 1); if (cs === -1) @@ -6245,17 +6273,25 @@ var require_lexer = __commonJS({ nl = this.buffer.length; } } - if (!this.blockScalarKeep) { + let i = nl + 1; + ch = this.buffer[i]; + while (ch === " ") + ch = this.buffer[++i]; + if (ch === " ") { + while (ch === " " || ch === " " || ch === "\r" || ch === "\n") + ch = this.buffer[++i]; + nl = i - 1; + } else if (!this.blockScalarKeep) { do { - let i = nl - 1; - let ch2 = this.buffer[i]; + let i2 = nl - 1; + let ch2 = this.buffer[i2]; if (ch2 === "\r") - ch2 = this.buffer[--i]; - const lastChar = i; - while (ch2 === " " || ch2 === " ") - ch2 = this.buffer[--i]; - if (ch2 === "\n" && i >= this.pos && i + 1 + indent2 > lastChar) - nl = i; + ch2 = this.buffer[--i2]; + const lastChar = i2; + while (ch2 === " ") + ch2 = this.buffer[--i2]; + if (ch2 === "\n" && i2 >= this.pos && i2 + 1 + indent2 > lastChar) + nl = i2; else break; } while (true); @@ -6272,7 +6308,7 @@ var require_lexer = __commonJS({ while (ch = this.buffer[++i]) { if (ch === ":") { const next = this.buffer[i + 1]; - if (isEmpty(next) || inFlow && next === ",") + if (isEmpty(next) || inFlow && flowIndicatorChars.has(next)) break; end = i; } else if (isEmpty(ch)) { @@ -6285,7 +6321,7 @@ var require_lexer = __commonJS({ } else end = i; } - if (next === "#" || inFlow && invalidFlowScalarChars.includes(next)) + if (next === "#" || inFlow && flowIndicatorChars.has(next)) break; if (ch === "\n") { const cs = this.continueScalar(i + 1); @@ -6294,7 +6330,7 @@ var require_lexer = __commonJS({ i = Math.max(i, cs - 2); } } else { - if (inFlow && invalidFlowScalarChars.includes(ch)) + if (inFlow && flowIndicatorChars.has(ch)) break; end = i; } @@ -6334,7 +6370,7 @@ var require_lexer = __commonJS({ case ":": { const inFlow = this.flowLevel > 0; const ch1 = this.charAt(1); - if (isEmpty(ch1) || inFlow && invalidFlowScalarChars.includes(ch1)) { + if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) { if (!inFlow) this.indentNext = this.indentValue + 1; else if (this.flowKey) @@ -6356,9 +6392,9 @@ var require_lexer = __commonJS({ let i = this.pos + 1; let ch = this.buffer[i]; while (ch) { - if (tagChars.includes(ch)) + if (tagChars.has(ch)) ch = this.buffer[++i]; - else if (ch === "%" && hexDigits.includes(this.buffer[i + 1]) && hexDigits.includes(this.buffer[i + 2])) { + else if (ch === "%" && hexDigits.has(this.buffer[i + 1]) && hexDigits.has(this.buffer[i + 2])) { ch = this.buffer[i += 3]; } else break; @@ -6400,9 +6436,9 @@ var require_lexer = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/line-counter.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/line-counter.js var require_line_counter = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/line-counter.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/line-counter.js"(exports2) { "use strict"; var LineCounter = class { constructor() { @@ -6431,9 +6467,9 @@ var require_line_counter = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/parser.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/parser.js var require_parser = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/parser.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/parser.js"(exports2) { "use strict"; var cst = require_cst(); var lexer2 = require_lexer(); @@ -6690,7 +6726,7 @@ var require_parser = __commonJS({ it.value = token; } else { Object.assign(it, { key: token, sep: [] }); - this.onKeyLine = !includesToken(it.start, "explicit-key-ind"); + this.onKeyLine = !it.explicitKey; return; } break; @@ -6880,7 +6916,8 @@ var require_parser = __commonJS({ return; } if (this.indent >= map4.indent) { - const atNextItem = !this.onKeyLine && this.indent === map4.indent && it.sep && this.type !== "seq-item-ind"; + const atMapIndent = !this.onKeyLine && this.indent === map4.indent; + const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind"; let start = []; if (atNextItem && it.sep && !it.value) { const nl = []; @@ -6917,23 +6954,24 @@ var require_parser = __commonJS({ } return; case "explicit-key-ind": - if (!it.sep && !includesToken(it.start, "explicit-key-ind")) { + if (!it.sep && !it.explicitKey) { it.start.push(this.sourceToken); + it.explicitKey = true; } else if (atNextItem || it.value) { start.push(this.sourceToken); - map4.items.push({ start }); + map4.items.push({ start, explicitKey: true }); } else { this.stack.push({ type: "block-map", offset: this.offset, indent: this.indent, - items: [{ start: [this.sourceToken] }] + items: [{ start: [this.sourceToken], explicitKey: true }] }); } this.onKeyLine = true; return; case "map-value-ind": - if (includesToken(it.start, "explicit-key-ind")) { + if (it.explicitKey) { if (!it.sep) { if (includesToken(it.start, "newline")) { Object.assign(it, { key: null, sep: [this.sourceToken] }); @@ -7009,7 +7047,7 @@ var require_parser = __commonJS({ default: { const bv = this.startBlockValue(map4); if (bv) { - if (atNextItem && bv.type !== "block-seq" && includesToken(it.start, "explicit-key-ind")) { + if (atMapIndent && bv.type !== "block-seq") { map4.items.push({ start }); } this.stack.push(bv); @@ -7221,7 +7259,7 @@ var require_parser = __commonJS({ type: "block-map", offset: this.offset, indent: this.indent, - items: [{ start }] + items: [{ start, explicitKey: true }] }; } case "map-value-ind": { @@ -7284,9 +7322,9 @@ var require_parser = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/public-api.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/public-api.js var require_public_api = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/public-api.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/public-api.js"(exports2) { "use strict"; var composer = require_composer(); var Document = require_Document(); @@ -7378,9 +7416,9 @@ var require_public_api = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/index.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/index.js var require_dist = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/index.js"(exports2) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/index.js"(exports2) { "use strict"; var composer = require_composer(); var Document = require_Document(); @@ -12847,7 +12885,7 @@ function tokenizeGfmFootnoteCall(effects, ok3, nok) { function tokenizeDefinitionStart(effects, ok3, nok) { const self2 = this; const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []); - let identifier; + let identifier2; let size = 0; let data; return start; @@ -12883,7 +12921,7 @@ function tokenizeDefinitionStart(effects, ok3, nok) { if (code3 === 93) { effects.exit("chunkString"); const token = effects.exit("gfmFootnoteDefinitionLabelString"); - identifier = normalizeIdentifier(self2.sliceSerialize(token)); + identifier2 = normalizeIdentifier(self2.sliceSerialize(token)); effects.enter("gfmFootnoteDefinitionLabelMarker"); effects.consume(code3); effects.exit("gfmFootnoteDefinitionLabelMarker"); @@ -12910,8 +12948,8 @@ function tokenizeDefinitionStart(effects, ok3, nok) { effects.enter("definitionMarker"); effects.consume(code3); effects.exit("definitionMarker"); - if (!defined.includes(identifier)) { - defined.push(identifier); + if (!defined.includes(identifier2)) { + defined.push(identifier2); } return factorySpace( effects, @@ -14322,139 +14360,401 @@ function slug(value2, maintainCase) { return value2.replace(regex, "").replace(/ /g, "-"); } -// node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js -function isPlainObject(value2) { - if (typeof value2 !== "object" || value2 === null) { - return false; - } - const prototype = Object.getPrototypeOf(value2); - return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value2) && !(Symbol.iterator in value2); +// node_modules/.pnpm/estree-util-value-to-estree@3.1.2/node_modules/estree-util-value-to-estree/dist/estree-util-value-to-estree.js +function identifier(name) { + return { type: "Identifier", name }; } - -// node_modules/.pnpm/estree-util-value-to-estree@3.0.1/node_modules/estree-util-value-to-estree/index.js -function valueToEstree(value2, options2 = {}) { - if (value2 === void 0 || value2 === Number.POSITIVE_INFINITY || Number.isNaN(value2)) { - return { type: "Identifier", name: String(value2) }; - } - if (value2 == null || typeof value2 === "string" || typeof value2 === "boolean") { - return { type: "Literal", value: value2 }; - } - if (typeof value2 === "bigint") { - return value2 >= 0 ? { type: "Literal", value: value2, bigint: String(value2) } : { - type: "UnaryExpression", - operator: "-", - prefix: true, - argument: valueToEstree(-value2, options2) - }; - } - if (typeof value2 === "number") { - return value2 >= 0 && !Object.is(value2, -0) ? { type: "Literal", value: value2 } : { +function literal(value2) { + return { type: "Literal", value: value2 }; +} +function methodCall(object, property, args) { + return { + type: "CallExpression", + optional: false, + callee: { + type: "MemberExpression", + computed: false, + optional: false, + object, + property: identifier(property) + }, + arguments: args + }; +} +function processNumber(number2) { + if (number2 < 0 || Object.is(number2, -0)) { + return { type: "UnaryExpression", operator: "-", prefix: true, - argument: valueToEstree(-value2, options2) + argument: processNumber(-number2) }; } - if (typeof value2 === "symbol") { - if (value2.description && value2 === Symbol.for(value2.description)) { - return { - type: "CallExpression", - optional: false, - callee: { - type: "MemberExpression", - computed: false, - optional: false, - object: { type: "Identifier", name: "Symbol" }, - property: { type: "Identifier", name: "for" } - }, - arguments: [valueToEstree(value2.description, options2)] - }; - } - throw new TypeError(`Only global symbols are supported, got: ${String(value2)}`); + if (typeof number2 === "bigint") { + return { type: "Literal", bigint: String(number2) }; } - if (Array.isArray(value2)) { - const elements = []; - for (let i = 0; i < value2.length; i += 1) { - elements.push(i in value2 ? valueToEstree(value2[i], options2) : null); - } - return { type: "ArrayExpression", elements }; + if (number2 === Number.POSITIVE_INFINITY || Number.isNaN(number2)) { + return identifier(String(number2)); } - if (value2 instanceof Boolean || value2 instanceof Number || value2 instanceof String) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: value2.constructor.name }, - arguments: [valueToEstree(value2.valueOf())] - }; + return literal(number2); +} +function processNumberArray(numbers) { + const elements = []; + for (const value2 of numbers) { + elements.push(processNumber(value2)); } - if (value2 instanceof RegExp) { - return { - type: "Literal", - value: value2, - regex: { pattern: value2.source, flags: value2.flags } - }; + return { type: "ArrayExpression", elements }; +} +function isStringReconstructable(value2) { + return value2 instanceof URL || value2 instanceof URLSearchParams; +} +function isValueReconstructable(value2) { + return value2 instanceof Boolean || value2 instanceof Date || value2 instanceof Number || value2 instanceof String; +} +function isTypedArray(value2) { + return value2 instanceof BigInt64Array || value2 instanceof BigUint64Array || value2 instanceof Float32Array || value2 instanceof Float64Array || value2 instanceof Int8Array || value2 instanceof Int16Array || value2 instanceof Int32Array || value2 instanceof Uint8Array || value2 instanceof Uint8ClampedArray || value2 instanceof Uint16Array || value2 instanceof Uint32Array; +} +function compareContexts(a, b) { + const aReferencedByB = a.referencedBy.has(b.value); + const bReferencedByA = b.referencedBy.has(a.value); + if (aReferencedByB) { + if (bReferencedByA) { + return a.count - b.count; + } + return -1; } - if (value2 instanceof Date) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: "Date" }, - arguments: [valueToEstree(value2.getTime(), options2)] - }; + if (bReferencedByA) { + return 1; } - if (typeof Buffer !== "undefined" && Buffer.isBuffer(value2)) { - return { - type: "CallExpression", - optional: false, - callee: { - type: "MemberExpression", - computed: false, - optional: false, - object: { type: "Identifier", name: "Buffer" }, - property: { type: "Identifier", name: "from" } - }, - arguments: [valueToEstree([...value2])] - }; + return a.count - b.count; +} +function replaceAssignment(expression, assignment) { + if (!assignment || assignment.type !== "AssignmentExpression") { + return expression; } - if (value2 instanceof BigInt64Array || value2 instanceof BigUint64Array || value2 instanceof Float32Array || value2 instanceof Float64Array || value2 instanceof Int8Array || value2 instanceof Int16Array || value2 instanceof Int32Array || value2 instanceof Map || value2 instanceof Set || value2 instanceof Uint8Array || value2 instanceof Uint8ClampedArray || value2 instanceof Uint16Array || value2 instanceof Uint32Array) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: value2.constructor.name }, - arguments: [valueToEstree([...value2], options2)] - }; + let node2 = assignment; + while (node2.right.type === "AssignmentExpression") { + node2 = node2.right; } - if (value2 instanceof URL || value2 instanceof URLSearchParams) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: value2.constructor.name }, - arguments: [valueToEstree(String(value2), options2)] - }; + node2.right = expression; + return assignment; +} +function valueToEstree(value2, options2 = {}) { + const stack = []; + const collectedContexts = /* @__PURE__ */ new Map(); + const namedContexts = []; + function analyze(val) { + if (typeof val === "function") { + throw new TypeError(`Unsupported value: ${val}`, { cause: val }); + } + if (typeof val !== "object") { + return; + } + if (val == null) { + return; + } + const context = collectedContexts.get(val); + if (context) { + if (options2.preserveReferences) { + context.count += 1; + } + for (const ancestor of stack) { + context.referencedBy.add(ancestor); + } + if (stack.includes(val)) { + if (!options2.preserveReferences) { + throw new Error(`Found circular reference: ${val}`, { cause: val }); + } + const parent = stack.at(-1); + const parentContext = collectedContexts.get(parent); + parentContext.recursive = true; + context.recursive = true; + } + return; + } + collectedContexts.set(val, { + count: 1, + recursive: false, + referencedBy: new Set(stack), + value: val + }); + if (isTypedArray(val)) { + return; + } + if (isStringReconstructable(val)) { + return; + } + if (isValueReconstructable(val)) { + return; + } + if (value2 instanceof RegExp) { + return; + } + stack.push(val); + if (val instanceof Map) { + for (const pair of val) { + analyze(pair[0]); + analyze(pair[1]); + } + } else if (Array.isArray(val) || val instanceof Set) { + for (const entry of val) { + analyze(entry); + } + } else { + const proto = Object.getPrototypeOf(val); + if (proto != null && proto !== Object.prototype && !options2.instanceAsObject) { + throw new TypeError(`Unsupported value: ${val}`, { cause: val }); + } + for (const key of Reflect.ownKeys(val)) { + analyze(val[key]); + } + } + stack.pop(); } - if (options2.instanceAsObject || isPlainObject(value2)) { - const properties = Reflect.ownKeys(value2).map((key) => ({ - type: "Property", - method: false, - shorthand: false, - computed: typeof key !== "string", - kind: "init", - key: valueToEstree(key, options2), - value: valueToEstree(value2[key], options2) - })); - if (Object.getPrototypeOf(value2) == null) { - properties.unshift({ + function generate(val, isDeclaration) { + if (val === void 0) { + return identifier(String(val)); + } + if (val == null || typeof val === "string" || typeof val === "boolean") { + return literal(val); + } + if (typeof val === "bigint" || typeof val === "number") { + return processNumber(val); + } + if (typeof val === "symbol") { + if (val.description && val === Symbol.for(val.description)) { + return methodCall(identifier("Symbol"), "for", [literal(val.description)]); + } + throw new TypeError(`Only global symbols are supported, got: ${String(val)}`, { cause: val }); + } + const context = collectedContexts.get(val); + if (!isDeclaration && (context == null ? void 0 : context.name)) { + return identifier(context.name); + } + if (isValueReconstructable(val)) { + return { + type: "NewExpression", + callee: identifier(val.constructor.name), + arguments: [generate(val.valueOf())] + }; + } + if (val instanceof RegExp) { + return { + type: "Literal", + regex: { pattern: val.source, flags: val.flags } + }; + } + if (typeof Buffer !== "undefined" && Buffer.isBuffer(val)) { + return methodCall(identifier("Buffer"), "from", [processNumberArray(val)]); + } + if (isTypedArray(val)) { + return { + type: "NewExpression", + callee: identifier(val.constructor.name), + arguments: [processNumberArray(val)] + }; + } + if (isStringReconstructable(val)) { + return { + type: "NewExpression", + callee: identifier(val.constructor.name), + arguments: [literal(String(val))] + }; + } + if (Array.isArray(val)) { + const elements = Array.from({ length: val.length }); + let trimmable; + for (let index = 0; index < val.length; index += 1) { + if (!(index in val)) { + elements[index] = null; + trimmable = void 0; + continue; + } + const child = val[index]; + const childContext = collectedContexts.get(child); + if (context && childContext && namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) { + elements[index] = null; + trimmable ||= index; + childContext.assignment = { + type: "AssignmentExpression", + operator: "=", + left: { + type: "MemberExpression", + computed: true, + optional: false, + object: identifier(context.name), + property: literal(index) + }, + right: childContext.assignment || identifier(childContext.name) + }; + } else { + elements[index] = generate(child); + trimmable = void 0; + } + } + if (trimmable != null) { + elements.splice(trimmable); + } + return { + type: "ArrayExpression", + elements + }; + } + if (val instanceof Set) { + const elements = []; + let finalizer; + for (const child of val) { + if (finalizer) { + finalizer = methodCall(finalizer, "add", [generate(child)]); + } else { + const childContext = collectedContexts.get(child); + if (context && childContext && namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) { + finalizer = methodCall(identifier(context.name), "add", [generate(child)]); + } else { + elements.push(generate(child)); + } + } + } + if (context && finalizer) { + context.assignment = replaceAssignment(finalizer, context.assignment); + } + return { + type: "NewExpression", + callee: identifier("Set"), + arguments: elements.length ? [{ type: "ArrayExpression", elements }] : [] + }; + } + if (val instanceof Map) { + const elements = []; + let finalizer; + for (const [key, item] of val) { + if (finalizer) { + finalizer = methodCall(finalizer, "set", [generate(key), generate(item)]); + } else { + const keyContext = collectedContexts.get(key); + const itemContext = collectedContexts.get(item); + if (context && (keyContext && namedContexts.indexOf(keyContext) >= namedContexts.indexOf(context) || itemContext && namedContexts.indexOf(itemContext) >= namedContexts.indexOf(context))) { + finalizer = methodCall(identifier(context.name), "set", [ + generate(key), + generate(item) + ]); + } else { + elements.push({ + type: "ArrayExpression", + elements: [generate(key), generate(item)] + }); + } + } + } + if (context && finalizer) { + context.assignment = replaceAssignment(finalizer, context.assignment); + } + return { + type: "NewExpression", + callee: identifier("Map"), + arguments: elements.length ? [{ type: "ArrayExpression", elements }] : [] + }; + } + const properties = []; + if (Object.getPrototypeOf(val) == null) { + properties.push({ type: "Property", method: false, shorthand: false, computed: false, kind: "init", - key: { type: "Identifier", name: "__proto__" }, - value: { type: "Literal", value: null } + key: identifier("__proto__"), + value: literal(null) }); } + const object = val; + for (const key of Reflect.ownKeys(val)) { + const computed = typeof key !== "string"; + const keyExpression = generate(key); + const child = object[key]; + const childContext = collectedContexts.get(child); + if (context && childContext && namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) { + childContext.assignment = { + type: "AssignmentExpression", + operator: "=", + left: { + type: "MemberExpression", + computed: true, + optional: false, + object: identifier(context.name), + property: keyExpression + }, + right: childContext.assignment || generate(child) + }; + } else { + properties.push({ + type: "Property", + method: false, + shorthand: false, + computed, + kind: "init", + key: keyExpression, + value: generate(child) + }); + } + } return { type: "ObjectExpression", properties }; } - throw new TypeError(`Unsupported value: ${String(value2)}`); + analyze(value2); + for (const [val, context] of collectedContexts) { + if (context.recursive || context.count > 1) { + context.name = `$${namedContexts.length}`; + namedContexts.push(context); + } else { + collectedContexts.delete(val); + } + } + if (!namedContexts.length) { + return generate(value2); + } + const declarations = namedContexts.sort(compareContexts).map((context) => ({ + type: "VariableDeclarator", + id: identifier(context.name), + init: generate(context.value, true) + })); + const rootContext = collectedContexts.get(value2); + const finalizers = []; + for (const context of collectedContexts.values()) { + if (context !== rootContext && context.assignment) { + finalizers.push(context.assignment); + } + } + finalizers.push(rootContext ? rootContext.assignment || identifier(rootContext.name) : generate(value2)); + return { + type: "CallExpression", + optional: false, + arguments: [], + callee: { + type: "ArrowFunctionExpression", + expression: false, + params: [], + body: { + type: "BlockStatement", + body: [ + { + type: "VariableDeclaration", + kind: "const", + declarations + }, + { + type: "ReturnStatement", + argument: { + type: "SequenceExpression", + expressions: finalizers + } + } + ] + } + } + }; } // node_modules/.pnpm/hast-util-heading-rank@2.1.1/node_modules/hast-util-heading-rank/lib/index.js @@ -15572,14 +15872,14 @@ function csharp(Prism2) { var nestedRound = nested(/\((?:[^()]|<>)*\)/.source, 2); var name = /@?\b[A-Za-z_]\w*\b/.source; var genericName = replace2(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]); - var identifier = replace2(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [ + var identifier2 = replace2(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [ nonTypeKeywords, genericName ]); var array = /\[\s*(?:,\s*)*\]/.source; var typeExpressionWithoutTuple = replace2( /<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, - [identifier, array] + [identifier2, array] ); var tupleElement = replace2( /[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, @@ -15588,7 +15888,7 @@ function csharp(Prism2) { var tuple = replace2(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]); var typeExpression = replace2( /(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, - [tuple, identifier, array] + [tuple, identifier2, array] ); var typeInside = { keyword: keywords, @@ -15615,7 +15915,7 @@ function csharp(Prism2) { // Using static // using static System.Math; pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [ - identifier + identifier2 ]), lookbehind: true, inside: typeInside @@ -15651,7 +15951,7 @@ function csharp(Prism2) { // Single catch exception declaration // catch(Foo) // (things like catch(Foo e) is covered by variable declaration) - pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]), + pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier2]), lookbehind: true, inside: typeInside }, @@ -15729,7 +16029,7 @@ function csharp(Prism2) { // int Foo => 0; int Foo { get; set } = 0; pattern: re( /<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, - [typeExpression, identifier] + [typeExpression, identifier2] ), inside: typeInside, alias: "class-name" @@ -15822,7 +16122,7 @@ function csharp(Prism2) { ); var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source; var attr = replace2(/<<0>>(?:\s*\(<<1>>*\))?/.source, [ - identifier, + identifier2, roundExpression ]); Prism3.languages.insertBefore("csharp", "class-name", { @@ -15845,7 +16145,7 @@ function csharp(Prism2) { inside: Prism3.languages.csharp }, "class-name": { - pattern: RegExp(identifier), + pattern: RegExp(identifier2), inside: { punctuation: /\./ } @@ -26829,20 +27129,26 @@ function imagePlugin(userOpts) { this.error(`Image '${id}' could not be optimized to JSX`); } const index = code3.indexOf("export default"); - return code3.slice(0, index) + ` + return { + code: code3.slice(0, index) + ` import { _jsxQ } from '@builder.io/qwik'; const PROPS = {srcSet, width, height}; export default function (props, key, _, dev) { return _jsxQ('img', {...{decoding: 'async', loading: 'lazy'}, ...props}, PROPS, undefined, 3, key, dev); - }`; + }`, + map: null + }; } else if (extension === ".svg") { const { svgAttributes } = optimizeSvg({ code: code3, path: pathId }, userOpts); - return ` + return { + code: ` import { _jsxQ } from '@builder.io/qwik'; const PROPS = ${JSON.stringify(svgAttributes)}; export default function (props, key, _, dev) { return _jsxQ('svg', props, PROPS, undefined, 3, key, dev); - }`; + }`, + map: null + }; } } return null; @@ -27053,7 +27359,7 @@ function qwikCityPlugin(userOpts) { const fileName = (0, import_node_path11.basename)(id); if (isMenuFileName(fileName)) { const menuCode = await transformMenu(ctx.opts, id, code3); - return menuCode; + return { code: menuCode, map: null }; } if (mdxTransform) { try { diff --git a/vite/index.d.ts b/vite/index.d.ts index 2b753aa..c1bb725 100644 --- a/vite/index.d.ts +++ b/vite/index.d.ts @@ -2,6 +2,7 @@ import type { BuiltinsWithOptionalParams } from 'svgo/plugins/plugins-types'; import type { CompileOptions } from '@mdx-js/mdx'; import type { Config } from 'svgo'; import { ConfigEnv } from 'vite'; +import type { Plugin as Plugin_2 } from 'vite'; import type { PluginOption } from 'vite'; import { UserConfigExport } from 'vite'; @@ -58,6 +59,10 @@ declare interface MdxPlugins { rehypeAutolinkHeadings: boolean; } +declare type P = Plugin_2 & { + api: T; +}; + declare interface ParsedPathname { routeName: string; pattern: RegExp; @@ -103,9 +108,8 @@ declare interface PluginOptions { export declare function qwikCity(userOpts?: QwikCityVitePluginOptions): PluginOption[]; /** @public */ -export declare interface QwikCityPlugin { +export declare interface QwikCityPlugin extends P { name: 'vite-plugin-qwik-city'; - api: QwikCityPluginApi; } /** @public */ diff --git a/vite/index.mjs b/vite/index.mjs index 609236a..a6be252 100644 --- a/vite/index.mjs +++ b/vite/index.mjs @@ -270,9 +270,9 @@ var init_unist_util_visit = __esm({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/identity.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/identity.js var require_identity = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/identity.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/identity.js"(exports) { "use strict"; var ALIAS = Symbol.for("yaml.alias"); var DOC = Symbol.for("yaml.document"); @@ -327,9 +327,9 @@ var require_identity = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/visit.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/visit.js var require_visit = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/visit.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/visit.js"(exports) { "use strict"; var identity = require_identity(); var BREAK = Symbol("break visit"); @@ -486,9 +486,9 @@ var require_visit = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/directives.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/directives.js var require_directives = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/directives.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/directives.js"(exports) { "use strict"; var identity = require_identity(); var visit2 = require_visit(); @@ -657,9 +657,9 @@ var require_directives = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/anchors.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/anchors.js var require_anchors = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/anchors.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/anchors.js"(exports) { "use strict"; var identity = require_identity(); var visit2 = require_visit(); @@ -728,9 +728,9 @@ var require_anchors = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/applyReviver.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/applyReviver.js var require_applyReviver = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/applyReviver.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/applyReviver.js"(exports) { "use strict"; function applyReviver(reviver, obj, key, val) { if (val && typeof val === "object") { @@ -778,9 +778,9 @@ var require_applyReviver = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/toJS.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/toJS.js var require_toJS = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/toJS.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/toJS.js"(exports) { "use strict"; var identity = require_identity(); function toJS(value2, arg, ctx) { @@ -808,9 +808,9 @@ var require_toJS = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Node.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Node.js var require_Node = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Node.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Node.js"(exports) { "use strict"; var applyReviver = require_applyReviver(); var identity = require_identity(); @@ -849,9 +849,9 @@ var require_Node = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Alias.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Alias.js var require_Alias = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Alias.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Alias.js"(exports) { "use strict"; var anchors = require_anchors(); var visit2 = require_visit(); @@ -951,9 +951,9 @@ var require_Alias = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Scalar.js var require_Scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Scalar.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Scalar.js"(exports) { "use strict"; var identity = require_identity(); var Node = require_Node(); @@ -981,9 +981,9 @@ var require_Scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/createNode.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/createNode.js var require_createNode = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/createNode.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/createNode.js"(exports) { "use strict"; var Alias = require_Alias(); var identity = require_identity(); @@ -1061,9 +1061,9 @@ var require_createNode = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Collection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Collection.js var require_Collection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Collection.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Collection.js"(exports) { "use strict"; var createNode = require_createNode(); var identity = require_identity(); @@ -1205,9 +1205,9 @@ var require_Collection = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyComment.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyComment.js var require_stringifyComment = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyComment.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyComment.js"(exports) { "use strict"; var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#"); function indentComment(comment, indent2) { @@ -1222,9 +1222,9 @@ var require_stringifyComment = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/foldFlowLines.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/foldFlowLines.js var require_foldFlowLines = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/foldFlowLines.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/foldFlowLines.js"(exports) { "use strict"; var FOLD_FLOW = "flow"; var FOLD_BLOCK = "block"; @@ -1356,9 +1356,9 @@ ${indent2}${text3.slice(fold + 1, end2)}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyString.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyString.js var require_stringifyString = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyString.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyString.js"(exports) { "use strict"; var Scalar = require_Scalar(); var foldFlowLines = require_foldFlowLines(); @@ -1503,9 +1503,9 @@ ${indent2}`) + "'"; return quotedString(value2, ctx); } const indent2 = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value2) ? " " : ""); - const literal = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value2, lineWidth, indent2.length); + const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value2, lineWidth, indent2.length); if (!value2) - return literal ? "|\n" : ">\n"; + return literal2 ? "|\n" : ">\n"; let chomp; let endStart; for (endStart = value2.length; endStart > 0; --endStart) { @@ -1548,13 +1548,13 @@ ${indent2}`) + "'"; start = start.replace(/\n+/g, `$&${indent2}`); } const indentSize = indent2 ? "2" : "1"; - let header = (literal ? "|" : ">") + (startWithSpace ? indentSize : "") + chomp; + let header = (literal2 ? "|" : ">") + (startWithSpace ? indentSize : "") + chomp; if (comment) { header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " ")); if (onComment) onComment(); } - if (literal) { + if (literal2) { value2 = value2.replace(/\n+/g, `$&${indent2}`); return `${header} ${indent2}${start}${value2}${end}`; @@ -1634,9 +1634,9 @@ ${indent2}`); } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringify.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringify.js var require_stringify = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringify.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringify.js"(exports) { "use strict"; var anchors = require_anchors(); var identity = require_identity(); @@ -1758,9 +1758,9 @@ ${ctx.indent}${str}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyPair.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyPair.js var require_stringifyPair = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyPair.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyPair.js"(exports) { "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); @@ -1773,7 +1773,7 @@ var require_stringifyPair = __commonJS({ if (keyComment) { throw new Error("With simple keys, key nodes cannot have comments"); } - if (identity.isCollection(key)) { + if (identity.isCollection(key) || !identity.isNode(key) && typeof key === "object") { const msg = "With simple keys, collection cannot be used as a key value"; throw new Error(msg); } @@ -1891,9 +1891,9 @@ ${ctx.indent}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/log.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/log.js var require_log = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/log.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/log.js"(exports) { "use strict"; function debug(logLevel, ...messages2) { if (logLevel === "debug") @@ -1912,9 +1912,9 @@ var require_log = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/addPairToJSMap.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/addPairToJSMap.js var require_addPairToJSMap = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports) { "use strict"; var log = require_log(); var stringify2 = require_stringify(); @@ -2006,9 +2006,9 @@ var require_addPairToJSMap = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Pair.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Pair.js var require_Pair = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/Pair.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/Pair.js"(exports) { "use strict"; var createNode = require_createNode(); var stringifyPair = require_stringifyPair(); @@ -2046,9 +2046,9 @@ var require_Pair = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyCollection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyCollection.js var require_stringifyCollection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) { "use strict"; var identity = require_identity(); var stringify2 = require_stringify(); @@ -2190,9 +2190,9 @@ ${indent2}${end}`; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLMap.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLMap.js var require_YAMLMap = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLMap.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLMap.js"(exports) { "use strict"; var stringifyCollection = require_stringifyCollection(); var addPairToJSMap = require_addPairToJSMap(); @@ -2335,9 +2335,9 @@ var require_YAMLMap = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/map.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/map.js var require_map = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/map.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/map.js"(exports) { "use strict"; var identity = require_identity(); var YAMLMap = require_YAMLMap(); @@ -2357,9 +2357,9 @@ var require_map = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLSeq.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLSeq.js var require_YAMLSeq = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/nodes/YAMLSeq.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/nodes/YAMLSeq.js"(exports) { "use strict"; var createNode = require_createNode(); var stringifyCollection = require_stringifyCollection(); @@ -2473,9 +2473,9 @@ var require_YAMLSeq = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/seq.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/seq.js var require_seq = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/seq.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/seq.js"(exports) { "use strict"; var identity = require_identity(); var YAMLSeq = require_YAMLSeq(); @@ -2495,9 +2495,9 @@ var require_seq = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/string.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/string.js var require_string = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/string.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/string.js"(exports) { "use strict"; var stringifyString = require_stringifyString(); var string = { @@ -2514,9 +2514,9 @@ var require_string = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/null.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/null.js var require_null = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/common/null.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/common/null.js"(exports) { "use strict"; var Scalar = require_Scalar(); var nullTag = { @@ -2532,9 +2532,9 @@ var require_null = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/bool.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/bool.js var require_bool = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/bool.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/bool.js"(exports) { "use strict"; var Scalar = require_Scalar(); var boolTag = { @@ -2556,9 +2556,9 @@ var require_bool = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyNumber.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyNumber.js var require_stringifyNumber = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyNumber.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyNumber.js"(exports) { "use strict"; function stringifyNumber({ format, minFractionDigits, tag: tag2, value: value2 }) { if (typeof value2 === "bigint") @@ -2583,9 +2583,9 @@ var require_stringifyNumber = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/float.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/float.js var require_float = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/float.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/float.js"(exports) { "use strict"; var Scalar = require_Scalar(); var stringifyNumber = require_stringifyNumber(); @@ -2593,7 +2593,7 @@ var require_float = __commonJS({ identify: (value2) => typeof value2 === "number", default: true, tag: "tag:yaml.org,2002:float", - test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/, + test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/, resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: stringifyNumber.stringifyNumber }; @@ -2629,9 +2629,9 @@ var require_float = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/int.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/int.js var require_int = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/int.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/int.js"(exports) { "use strict"; var stringifyNumber = require_stringifyNumber(); var intIdentify = (value2) => typeof value2 === "bigint" || Number.isInteger(value2); @@ -2674,9 +2674,9 @@ var require_int = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/schema.js var require_schema = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/core/schema.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/core/schema.js"(exports) { "use strict"; var map4 = require_map(); var _null = require_null(); @@ -2702,9 +2702,9 @@ var require_schema = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/json/schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/json/schema.js var require_schema2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/json/schema.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/json/schema.js"(exports) { "use strict"; var Scalar = require_Scalar(); var map4 = require_map(); @@ -2769,9 +2769,9 @@ var require_schema2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/binary.js var require_binary = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/binary.js"(exports) { "use strict"; var Scalar = require_Scalar(); var stringifyString = require_stringifyString(); @@ -2833,9 +2833,9 @@ var require_binary = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/pairs.js var require_pairs = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports) { "use strict"; var identity = require_identity(); var Pair = require_Pair(); @@ -2911,9 +2911,9 @@ ${cn.comment}` : item.comment; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/omap.js var require_omap = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports) { "use strict"; var identity = require_identity(); var toJS = require_toJS(); @@ -2989,9 +2989,9 @@ var require_omap = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/bool.js var require_bool2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/bool.js"(exports) { "use strict"; var Scalar = require_Scalar(); function boolStringify({ value: value2, source }, ctx) { @@ -3021,9 +3021,9 @@ var require_bool2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/float.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/float.js var require_float2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/float.js"(exports) { "use strict"; var Scalar = require_Scalar(); var stringifyNumber = require_stringifyNumber(); @@ -3031,7 +3031,7 @@ var require_float2 = __commonJS({ identify: (value2) => typeof value2 === "number", default: true, tag: "tag:yaml.org,2002:float", - test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/, + test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/, resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, stringify: stringifyNumber.stringifyNumber }; @@ -3070,9 +3070,9 @@ var require_float2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/int.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/int.js var require_int2 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/int.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/int.js"(exports) { "use strict"; var stringifyNumber = require_stringifyNumber(); var intIdentify = (value2) => typeof value2 === "bigint" || Number.isInteger(value2); @@ -3149,9 +3149,9 @@ var require_int2 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/set.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/set.js var require_set = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports) { "use strict"; var identity = require_identity(); var Pair = require_Pair(); @@ -3238,9 +3238,9 @@ var require_set = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js var require_timestamp = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports) { "use strict"; var stringifyNumber = require_stringifyNumber(); function parseSexagesimal(str, asBigInt) { @@ -3326,9 +3326,9 @@ var require_timestamp = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/schema.js var require_schema3 = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/yaml-1.1/schema.js"(exports) { "use strict"; var map4 = require_map(); var _null = require_null(); @@ -3368,9 +3368,9 @@ var require_schema3 = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/tags.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/tags.js var require_tags = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/tags.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/tags.js"(exports) { "use strict"; var map4 = require_map(); var _null = require_null(); @@ -3451,9 +3451,9 @@ var require_tags = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/Schema.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/Schema.js var require_Schema = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/schema/Schema.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/schema/Schema.js"(exports) { "use strict"; var identity = require_identity(); var map4 = require_map(); @@ -3484,9 +3484,9 @@ var require_Schema = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyDocument.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyDocument.js var require_stringifyDocument = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) { "use strict"; var identity = require_identity(); var stringify2 = require_stringify(); @@ -3565,9 +3565,9 @@ var require_stringifyDocument = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/Document.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/Document.js var require_Document = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/doc/Document.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/doc/Document.js"(exports) { "use strict"; var Alias = require_Alias(); var Collection = require_Collection(); @@ -3873,9 +3873,9 @@ var require_Document = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/errors.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/errors.js var require_errors = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/errors.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/errors.js"(exports) { "use strict"; var YAMLError = class extends Error { constructor(name, pos, code3, message) { @@ -3938,11 +3938,11 @@ ${pointer} } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-props.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-props.js var require_resolve_props = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-props.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-props.js"(exports) { "use strict"; - function resolveProps(tokens, { flow, indicator, next, offset, onError, startOnNewline }) { + function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) { let spaceBefore = false; let atNewline = startOnNewline; let hasSpace = startOnNewline; @@ -3951,6 +3951,7 @@ var require_resolve_props = __commonJS({ let hasNewline = false; let hasNewlineAfterProp = false; let reqSpace = false; + let tab = null; let anchor = null; let tag2 = null; let comma = null; @@ -3962,10 +3963,17 @@ var require_resolve_props = __commonJS({ onError(token.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"); reqSpace = false; } + if (tab) { + if (atNewline && token.type !== "comment" && token.type !== "newline") { + onError(tab, "TAB_AS_INDENT", "Tabs are not allowed as indentation"); + } + tab = null; + } switch (token.type) { case "space": - if (!flow && atNewline && indicator !== "doc-start" && token.source[0] === " ") - onError(token, "TAB_AS_INDENT", "Tabs are not allowed as indentation"); + if (!flow && (indicator !== "doc-start" || (next == null ? void 0 : next.type) !== "flow-collection") && token.source.includes(" ")) { + tab = token; + } hasSpace = true; break; case "comment": { @@ -4023,7 +4031,7 @@ var require_resolve_props = __commonJS({ if (found) onError(token, "UNEXPECTED_TOKEN", `Unexpected ${token.source} in ${flow ?? "collection"}`); found = token; - atNewline = false; + atNewline = indicator === "seq-item-ind" || indicator === "explicit-key-ind"; hasSpace = false; break; case "comma": @@ -4043,8 +4051,11 @@ var require_resolve_props = __commonJS({ } const last = tokens[tokens.length - 1]; const end = last ? last.offset + last.source.length : offset; - if (reqSpace && next && next.type !== "space" && next.type !== "newline" && next.type !== "comma" && (next.type !== "scalar" || next.source !== "")) + if (reqSpace && next && next.type !== "space" && next.type !== "newline" && next.type !== "comma" && (next.type !== "scalar" || next.source !== "")) { onError(next.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"); + } + if (tab && (atNewline && tab.indent <= parentIndent || (next == null ? void 0 : next.type) === "block-map" || (next == null ? void 0 : next.type) === "block-seq")) + onError(tab, "TAB_AS_INDENT", "Tabs are not allowed as indentation"); return { comma, found, @@ -4062,9 +4073,9 @@ var require_resolve_props = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-contains-newline.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-contains-newline.js var require_util_contains_newline = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-contains-newline.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-contains-newline.js"(exports) { "use strict"; function containsNewline(key) { if (!key) @@ -4104,9 +4115,9 @@ var require_util_contains_newline = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-flow-indent-check.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-flow-indent-check.js var require_util_flow_indent_check = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-flow-indent-check.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-flow-indent-check.js"(exports) { "use strict"; var utilContainsNewline = require_util_contains_newline(); function flowIndentCheck(indent2, fc, onError) { @@ -4122,9 +4133,9 @@ var require_util_flow_indent_check = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-map-includes.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-map-includes.js var require_util_map_includes = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-map-includes.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-map-includes.js"(exports) { "use strict"; var identity = require_identity(); function mapIncludes(ctx, items, search2) { @@ -4138,9 +4149,9 @@ var require_util_map_includes = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-map.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-map.js var require_resolve_block_map = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-map.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-map.js"(exports) { "use strict"; var Pair = require_Pair(); var YAMLMap = require_YAMLMap(); @@ -4164,6 +4175,7 @@ var require_resolve_block_map = __commonJS({ next: key ?? (sep == null ? void 0 : sep[0]), offset, onError, + parentIndent: bm.indent, startOnNewline: true }); const implicitKey = !keyProps.found; @@ -4201,6 +4213,7 @@ var require_resolve_block_map = __commonJS({ next: value2, offset: keyNode.range[2], onError, + parentIndent: bm.indent, startOnNewline: !key || key.type === "block-scalar" }); offset = valueProps.end; @@ -4243,9 +4256,9 @@ var require_resolve_block_map = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-seq.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-seq.js var require_resolve_block_seq = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-seq.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-seq.js"(exports) { "use strict"; var YAMLSeq = require_YAMLSeq(); var resolveProps = require_resolve_props(); @@ -4263,6 +4276,7 @@ var require_resolve_block_seq = __commonJS({ next: value2, offset, onError, + parentIndent: bs.indent, startOnNewline: true }); if (!props.found) { @@ -4291,9 +4305,9 @@ var require_resolve_block_seq = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-end.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-end.js var require_resolve_end = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-end.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-end.js"(exports) { "use strict"; function resolveEnd(end, offset, reqSpace, onError) { let comment = ""; @@ -4334,9 +4348,9 @@ var require_resolve_end = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-collection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-collection.js var require_resolve_flow_collection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports) { "use strict"; var identity = require_identity(); var Pair = require_Pair(); @@ -4367,6 +4381,7 @@ var require_resolve_flow_collection = __commonJS({ next: key ?? (sep == null ? void 0 : sep[0]), offset, onError, + parentIndent: fc.indent, startOnNewline: false }); if (!props.found) { @@ -4442,6 +4457,7 @@ var require_resolve_flow_collection = __commonJS({ next: value2, offset: keyNode.range[2], onError, + parentIndent: fc.indent, startOnNewline: false }); if (valueProps.found) { @@ -4521,9 +4537,9 @@ var require_resolve_flow_collection = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-collection.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-collection.js var require_compose_collection = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-collection.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-collection.js"(exports) { "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); @@ -4578,14 +4594,14 @@ var require_compose_collection = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-scalar.js var require_resolve_block_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports) { "use strict"; var Scalar = require_Scalar(); - function resolveBlockScalar(scalar, strict, onError) { + function resolveBlockScalar(ctx, scalar, onError) { const start = scalar.offset; - const header = parseBlockScalarHeader(scalar, strict, onError); + const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError); if (!header) return { value: "", type: null, comment: "", range: [start, start, start] }; const type = header.mode === ">" ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL; @@ -4621,6 +4637,10 @@ var require_resolve_block_scalar = __commonJS({ if (header.indent === 0) trimIndent = indent2.length; contentStart = i; + if (trimIndent === 0 && !ctx.atRoot) { + const message = "Block scalar values in collections must be indented"; + onError(offset, "BAD_INDENT", message); + } break; } offset += indent2.length + content.length + 1; @@ -4755,9 +4775,9 @@ var require_resolve_block_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-scalar.js var require_resolve_flow_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/resolve-flow-scalar.js"(exports) { "use strict"; var Scalar = require_Scalar(); var resolveEnd = require_resolve_end(); @@ -4972,16 +4992,16 @@ var require_resolve_flow_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-scalar.js var require_compose_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-scalar.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-scalar.js"(exports) { "use strict"; var identity = require_identity(); var Scalar = require_Scalar(); var resolveBlockScalar = require_resolve_block_scalar(); var resolveFlowScalar = require_resolve_flow_scalar(); function composeScalar(ctx, token, tagToken, onError) { - const { value: value2, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(token, ctx.options.strict, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); + const { value: value2, type, comment, range: range2 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError); const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null; const tag2 = tagToken && tagName ? findScalarTagByName(ctx.schema, value2, tagName, tagToken, onError) : token.type === "scalar" ? findScalarTagByTest(ctx, value2, token, onError) : ctx.schema[identity.SCALAR]; let scalar; @@ -5052,9 +5072,9 @@ var require_compose_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-empty-scalar-position.js var require_util_empty_scalar_position = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/util-empty-scalar-position.js"(exports) { "use strict"; function emptyScalarPosition(offset, before, pos) { if (before) { @@ -5083,9 +5103,9 @@ var require_util_empty_scalar_position = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-node.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-node.js var require_compose_node = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-node.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-node.js"(exports) { "use strict"; var Alias = require_Alias(); var composeCollection = require_compose_collection(); @@ -5178,9 +5198,9 @@ var require_compose_node = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-doc.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-doc.js var require_compose_doc = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/compose-doc.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/compose-doc.js"(exports) { "use strict"; var Document = require_Document(); var composeNode = require_compose_node(); @@ -5200,6 +5220,7 @@ var require_compose_doc = __commonJS({ next: value2 ?? (end == null ? void 0 : end[0]), offset, onError, + parentIndent: 0, startOnNewline: true }); if (props.found) { @@ -5219,9 +5240,9 @@ var require_compose_doc = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/composer.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/composer.js var require_composer = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/compose/composer.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/compose/composer.js"(exports) { "use strict"; var directives = require_directives(); var Document = require_Document(); @@ -5425,9 +5446,9 @@ ${end.comment}` : end.comment; } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-scalar.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-scalar.js var require_cst_scalar = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-scalar.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-scalar.js"(exports) { "use strict"; var resolveBlockScalar = require_resolve_block_scalar(); var resolveFlowScalar = require_resolve_flow_scalar(); @@ -5448,7 +5469,7 @@ var require_cst_scalar = __commonJS({ case "double-quoted-scalar": return resolveFlowScalar.resolveFlowScalar(token, strict, _onError); case "block-scalar": - return resolveBlockScalar.resolveBlockScalar(token, strict, _onError); + return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError); } } return null; @@ -5610,9 +5631,9 @@ var require_cst_scalar = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-stringify.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-stringify.js var require_cst_stringify = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-stringify.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-stringify.js"(exports) { "use strict"; var stringify2 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst); function stringifyToken(token) { @@ -5671,9 +5692,9 @@ var require_cst_stringify = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-visit.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-visit.js var require_cst_visit = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst-visit.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst-visit.js"(exports) { "use strict"; var BREAK = Symbol("break visit"); var SKIP2 = Symbol("skip children"); @@ -5733,9 +5754,9 @@ var require_cst_visit = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst.js var require_cst = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/cst.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/cst.js"(exports) { "use strict"; var cstScalar = require_cst_scalar(); var cstStringify = require_cst_stringify(); @@ -5835,9 +5856,9 @@ var require_cst = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/lexer.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/lexer.js var require_lexer = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/lexer.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/lexer.js"(exports) { "use strict"; var cst = require_cst(); function isEmpty(ch) { @@ -5852,11 +5873,11 @@ var require_lexer = __commonJS({ return false; } } - var hexDigits = "0123456789ABCDEFabcdef".split(""); - var tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""); - var invalidFlowScalarChars = ",[]{}".split(""); - var invalidAnchorChars = " ,[]{}\n\r ".split(""); - var isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch); + var hexDigits = new Set("0123456789ABCDEFabcdef"); + var tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"); + var flowIndicatorChars = new Set(",[]{}"); + var invalidAnchorChars = new Set(" ,[]{}\n\r "); + var isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch); var Lexer = class { constructor() { this.atEnd = false; @@ -5879,6 +5900,8 @@ var require_lexer = __commonJS({ */ *lex(source, incomplete = false) { if (source) { + if (typeof source !== "string") + throw TypeError("source is not a string"); this.buffer = this.buffer ? this.buffer + source : source; this.lineEndPos = null; } @@ -5976,11 +5999,15 @@ var require_lexer = __commonJS({ } if (line[0] === "%") { let dirEnd = line.length; - const cs = line.indexOf("#"); - if (cs !== -1) { + let cs = line.indexOf("#"); + while (cs !== -1) { const ch = line[cs - 1]; - if (ch === " " || ch === " ") + if (ch === " " || ch === " ") { dirEnd = cs - 1; + break; + } else { + cs = line.indexOf("#", cs + 1); + } } while (true) { const ch = line[dirEnd - 1]; @@ -6204,17 +6231,17 @@ var require_lexer = __commonJS({ let indent2 = 0; let ch; loop: - for (let i = this.pos; ch = this.buffer[i]; ++i) { + for (let i2 = this.pos; ch = this.buffer[i2]; ++i2) { switch (ch) { case " ": indent2 += 1; break; case "\n": - nl = i; + nl = i2; indent2 = 0; break; case "\r": { - const next = this.buffer[i + 1]; + const next = this.buffer[i2 + 1]; if (!next && !this.atEnd) return this.setNext("block-scalar"); if (next === "\n") @@ -6229,8 +6256,9 @@ var require_lexer = __commonJS({ if (indent2 >= this.indentNext) { if (this.blockScalarIndent === -1) this.indentNext = indent2; - else - this.indentNext += this.blockScalarIndent; + else { + this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext); + } do { const cs = this.continueScalar(nl + 1); if (cs === -1) @@ -6243,17 +6271,25 @@ var require_lexer = __commonJS({ nl = this.buffer.length; } } - if (!this.blockScalarKeep) { + let i = nl + 1; + ch = this.buffer[i]; + while (ch === " ") + ch = this.buffer[++i]; + if (ch === " ") { + while (ch === " " || ch === " " || ch === "\r" || ch === "\n") + ch = this.buffer[++i]; + nl = i - 1; + } else if (!this.blockScalarKeep) { do { - let i = nl - 1; - let ch2 = this.buffer[i]; + let i2 = nl - 1; + let ch2 = this.buffer[i2]; if (ch2 === "\r") - ch2 = this.buffer[--i]; - const lastChar = i; - while (ch2 === " " || ch2 === " ") - ch2 = this.buffer[--i]; - if (ch2 === "\n" && i >= this.pos && i + 1 + indent2 > lastChar) - nl = i; + ch2 = this.buffer[--i2]; + const lastChar = i2; + while (ch2 === " ") + ch2 = this.buffer[--i2]; + if (ch2 === "\n" && i2 >= this.pos && i2 + 1 + indent2 > lastChar) + nl = i2; else break; } while (true); @@ -6270,7 +6306,7 @@ var require_lexer = __commonJS({ while (ch = this.buffer[++i]) { if (ch === ":") { const next = this.buffer[i + 1]; - if (isEmpty(next) || inFlow && next === ",") + if (isEmpty(next) || inFlow && flowIndicatorChars.has(next)) break; end = i; } else if (isEmpty(ch)) { @@ -6283,7 +6319,7 @@ var require_lexer = __commonJS({ } else end = i; } - if (next === "#" || inFlow && invalidFlowScalarChars.includes(next)) + if (next === "#" || inFlow && flowIndicatorChars.has(next)) break; if (ch === "\n") { const cs = this.continueScalar(i + 1); @@ -6292,7 +6328,7 @@ var require_lexer = __commonJS({ i = Math.max(i, cs - 2); } } else { - if (inFlow && invalidFlowScalarChars.includes(ch)) + if (inFlow && flowIndicatorChars.has(ch)) break; end = i; } @@ -6332,7 +6368,7 @@ var require_lexer = __commonJS({ case ":": { const inFlow = this.flowLevel > 0; const ch1 = this.charAt(1); - if (isEmpty(ch1) || inFlow && invalidFlowScalarChars.includes(ch1)) { + if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) { if (!inFlow) this.indentNext = this.indentValue + 1; else if (this.flowKey) @@ -6354,9 +6390,9 @@ var require_lexer = __commonJS({ let i = this.pos + 1; let ch = this.buffer[i]; while (ch) { - if (tagChars.includes(ch)) + if (tagChars.has(ch)) ch = this.buffer[++i]; - else if (ch === "%" && hexDigits.includes(this.buffer[i + 1]) && hexDigits.includes(this.buffer[i + 2])) { + else if (ch === "%" && hexDigits.has(this.buffer[i + 1]) && hexDigits.has(this.buffer[i + 2])) { ch = this.buffer[i += 3]; } else break; @@ -6398,9 +6434,9 @@ var require_lexer = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/line-counter.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/line-counter.js var require_line_counter = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/line-counter.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/line-counter.js"(exports) { "use strict"; var LineCounter = class { constructor() { @@ -6429,9 +6465,9 @@ var require_line_counter = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/parser.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/parser.js var require_parser = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/parse/parser.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/parse/parser.js"(exports) { "use strict"; var cst = require_cst(); var lexer2 = require_lexer(); @@ -6688,7 +6724,7 @@ var require_parser = __commonJS({ it.value = token; } else { Object.assign(it, { key: token, sep: [] }); - this.onKeyLine = !includesToken(it.start, "explicit-key-ind"); + this.onKeyLine = !it.explicitKey; return; } break; @@ -6878,7 +6914,8 @@ var require_parser = __commonJS({ return; } if (this.indent >= map4.indent) { - const atNextItem = !this.onKeyLine && this.indent === map4.indent && it.sep && this.type !== "seq-item-ind"; + const atMapIndent = !this.onKeyLine && this.indent === map4.indent; + const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind"; let start = []; if (atNextItem && it.sep && !it.value) { const nl = []; @@ -6915,23 +6952,24 @@ var require_parser = __commonJS({ } return; case "explicit-key-ind": - if (!it.sep && !includesToken(it.start, "explicit-key-ind")) { + if (!it.sep && !it.explicitKey) { it.start.push(this.sourceToken); + it.explicitKey = true; } else if (atNextItem || it.value) { start.push(this.sourceToken); - map4.items.push({ start }); + map4.items.push({ start, explicitKey: true }); } else { this.stack.push({ type: "block-map", offset: this.offset, indent: this.indent, - items: [{ start: [this.sourceToken] }] + items: [{ start: [this.sourceToken], explicitKey: true }] }); } this.onKeyLine = true; return; case "map-value-ind": - if (includesToken(it.start, "explicit-key-ind")) { + if (it.explicitKey) { if (!it.sep) { if (includesToken(it.start, "newline")) { Object.assign(it, { key: null, sep: [this.sourceToken] }); @@ -7007,7 +7045,7 @@ var require_parser = __commonJS({ default: { const bv = this.startBlockValue(map4); if (bv) { - if (atNextItem && bv.type !== "block-seq" && includesToken(it.start, "explicit-key-ind")) { + if (atMapIndent && bv.type !== "block-seq") { map4.items.push({ start }); } this.stack.push(bv); @@ -7219,7 +7257,7 @@ var require_parser = __commonJS({ type: "block-map", offset: this.offset, indent: this.indent, - items: [{ start }] + items: [{ start, explicitKey: true }] }; } case "map-value-ind": { @@ -7282,9 +7320,9 @@ var require_parser = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/public-api.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/public-api.js var require_public_api = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/public-api.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/public-api.js"(exports) { "use strict"; var composer = require_composer(); var Document = require_Document(); @@ -7376,9 +7414,9 @@ var require_public_api = __commonJS({ } }); -// node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/index.js +// node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/index.js var require_dist = __commonJS({ - "node_modules/.pnpm/yaml@2.4.2/node_modules/yaml/dist/index.js"(exports) { + "node_modules/.pnpm/yaml@2.4.5/node_modules/yaml/dist/index.js"(exports) { "use strict"; var composer = require_composer(); var Document = require_Document(); @@ -12845,7 +12883,7 @@ function tokenizeGfmFootnoteCall(effects, ok3, nok) { function tokenizeDefinitionStart(effects, ok3, nok) { const self2 = this; const defined = self2.parser.gfmFootnotes || (self2.parser.gfmFootnotes = []); - let identifier; + let identifier2; let size = 0; let data; return start; @@ -12881,7 +12919,7 @@ function tokenizeDefinitionStart(effects, ok3, nok) { if (code3 === 93) { effects.exit("chunkString"); const token = effects.exit("gfmFootnoteDefinitionLabelString"); - identifier = normalizeIdentifier(self2.sliceSerialize(token)); + identifier2 = normalizeIdentifier(self2.sliceSerialize(token)); effects.enter("gfmFootnoteDefinitionLabelMarker"); effects.consume(code3); effects.exit("gfmFootnoteDefinitionLabelMarker"); @@ -12908,8 +12946,8 @@ function tokenizeDefinitionStart(effects, ok3, nok) { effects.enter("definitionMarker"); effects.consume(code3); effects.exit("definitionMarker"); - if (!defined.includes(identifier)) { - defined.push(identifier); + if (!defined.includes(identifier2)) { + defined.push(identifier2); } return factorySpace( effects, @@ -14312,139 +14350,401 @@ function slug(value2, maintainCase) { return value2.replace(regex, "").replace(/ /g, "-"); } -// node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js -function isPlainObject(value2) { - if (typeof value2 !== "object" || value2 === null) { - return false; - } - const prototype = Object.getPrototypeOf(value2); - return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value2) && !(Symbol.iterator in value2); +// node_modules/.pnpm/estree-util-value-to-estree@3.1.2/node_modules/estree-util-value-to-estree/dist/estree-util-value-to-estree.js +function identifier(name) { + return { type: "Identifier", name }; } - -// node_modules/.pnpm/estree-util-value-to-estree@3.0.1/node_modules/estree-util-value-to-estree/index.js -function valueToEstree(value2, options2 = {}) { - if (value2 === void 0 || value2 === Number.POSITIVE_INFINITY || Number.isNaN(value2)) { - return { type: "Identifier", name: String(value2) }; - } - if (value2 == null || typeof value2 === "string" || typeof value2 === "boolean") { - return { type: "Literal", value: value2 }; - } - if (typeof value2 === "bigint") { - return value2 >= 0 ? { type: "Literal", value: value2, bigint: String(value2) } : { - type: "UnaryExpression", - operator: "-", - prefix: true, - argument: valueToEstree(-value2, options2) - }; - } - if (typeof value2 === "number") { - return value2 >= 0 && !Object.is(value2, -0) ? { type: "Literal", value: value2 } : { +function literal(value2) { + return { type: "Literal", value: value2 }; +} +function methodCall(object, property, args) { + return { + type: "CallExpression", + optional: false, + callee: { + type: "MemberExpression", + computed: false, + optional: false, + object, + property: identifier(property) + }, + arguments: args + }; +} +function processNumber(number2) { + if (number2 < 0 || Object.is(number2, -0)) { + return { type: "UnaryExpression", operator: "-", prefix: true, - argument: valueToEstree(-value2, options2) + argument: processNumber(-number2) }; } - if (typeof value2 === "symbol") { - if (value2.description && value2 === Symbol.for(value2.description)) { - return { - type: "CallExpression", - optional: false, - callee: { - type: "MemberExpression", - computed: false, - optional: false, - object: { type: "Identifier", name: "Symbol" }, - property: { type: "Identifier", name: "for" } - }, - arguments: [valueToEstree(value2.description, options2)] - }; - } - throw new TypeError(`Only global symbols are supported, got: ${String(value2)}`); + if (typeof number2 === "bigint") { + return { type: "Literal", bigint: String(number2) }; } - if (Array.isArray(value2)) { - const elements = []; - for (let i = 0; i < value2.length; i += 1) { - elements.push(i in value2 ? valueToEstree(value2[i], options2) : null); - } - return { type: "ArrayExpression", elements }; + if (number2 === Number.POSITIVE_INFINITY || Number.isNaN(number2)) { + return identifier(String(number2)); } - if (value2 instanceof Boolean || value2 instanceof Number || value2 instanceof String) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: value2.constructor.name }, - arguments: [valueToEstree(value2.valueOf())] - }; + return literal(number2); +} +function processNumberArray(numbers) { + const elements = []; + for (const value2 of numbers) { + elements.push(processNumber(value2)); } - if (value2 instanceof RegExp) { - return { - type: "Literal", - value: value2, - regex: { pattern: value2.source, flags: value2.flags } - }; + return { type: "ArrayExpression", elements }; +} +function isStringReconstructable(value2) { + return value2 instanceof URL || value2 instanceof URLSearchParams; +} +function isValueReconstructable(value2) { + return value2 instanceof Boolean || value2 instanceof Date || value2 instanceof Number || value2 instanceof String; +} +function isTypedArray(value2) { + return value2 instanceof BigInt64Array || value2 instanceof BigUint64Array || value2 instanceof Float32Array || value2 instanceof Float64Array || value2 instanceof Int8Array || value2 instanceof Int16Array || value2 instanceof Int32Array || value2 instanceof Uint8Array || value2 instanceof Uint8ClampedArray || value2 instanceof Uint16Array || value2 instanceof Uint32Array; +} +function compareContexts(a, b) { + const aReferencedByB = a.referencedBy.has(b.value); + const bReferencedByA = b.referencedBy.has(a.value); + if (aReferencedByB) { + if (bReferencedByA) { + return a.count - b.count; + } + return -1; } - if (value2 instanceof Date) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: "Date" }, - arguments: [valueToEstree(value2.getTime(), options2)] - }; + if (bReferencedByA) { + return 1; } - if (typeof Buffer !== "undefined" && Buffer.isBuffer(value2)) { - return { - type: "CallExpression", - optional: false, - callee: { - type: "MemberExpression", - computed: false, - optional: false, - object: { type: "Identifier", name: "Buffer" }, - property: { type: "Identifier", name: "from" } - }, - arguments: [valueToEstree([...value2])] - }; + return a.count - b.count; +} +function replaceAssignment(expression, assignment) { + if (!assignment || assignment.type !== "AssignmentExpression") { + return expression; } - if (value2 instanceof BigInt64Array || value2 instanceof BigUint64Array || value2 instanceof Float32Array || value2 instanceof Float64Array || value2 instanceof Int8Array || value2 instanceof Int16Array || value2 instanceof Int32Array || value2 instanceof Map || value2 instanceof Set || value2 instanceof Uint8Array || value2 instanceof Uint8ClampedArray || value2 instanceof Uint16Array || value2 instanceof Uint32Array) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: value2.constructor.name }, - arguments: [valueToEstree([...value2], options2)] - }; + let node2 = assignment; + while (node2.right.type === "AssignmentExpression") { + node2 = node2.right; } - if (value2 instanceof URL || value2 instanceof URLSearchParams) { - return { - type: "NewExpression", - callee: { type: "Identifier", name: value2.constructor.name }, - arguments: [valueToEstree(String(value2), options2)] - }; + node2.right = expression; + return assignment; +} +function valueToEstree(value2, options2 = {}) { + const stack = []; + const collectedContexts = /* @__PURE__ */ new Map(); + const namedContexts = []; + function analyze(val) { + if (typeof val === "function") { + throw new TypeError(`Unsupported value: ${val}`, { cause: val }); + } + if (typeof val !== "object") { + return; + } + if (val == null) { + return; + } + const context = collectedContexts.get(val); + if (context) { + if (options2.preserveReferences) { + context.count += 1; + } + for (const ancestor of stack) { + context.referencedBy.add(ancestor); + } + if (stack.includes(val)) { + if (!options2.preserveReferences) { + throw new Error(`Found circular reference: ${val}`, { cause: val }); + } + const parent = stack.at(-1); + const parentContext = collectedContexts.get(parent); + parentContext.recursive = true; + context.recursive = true; + } + return; + } + collectedContexts.set(val, { + count: 1, + recursive: false, + referencedBy: new Set(stack), + value: val + }); + if (isTypedArray(val)) { + return; + } + if (isStringReconstructable(val)) { + return; + } + if (isValueReconstructable(val)) { + return; + } + if (value2 instanceof RegExp) { + return; + } + stack.push(val); + if (val instanceof Map) { + for (const pair of val) { + analyze(pair[0]); + analyze(pair[1]); + } + } else if (Array.isArray(val) || val instanceof Set) { + for (const entry of val) { + analyze(entry); + } + } else { + const proto = Object.getPrototypeOf(val); + if (proto != null && proto !== Object.prototype && !options2.instanceAsObject) { + throw new TypeError(`Unsupported value: ${val}`, { cause: val }); + } + for (const key of Reflect.ownKeys(val)) { + analyze(val[key]); + } + } + stack.pop(); } - if (options2.instanceAsObject || isPlainObject(value2)) { - const properties = Reflect.ownKeys(value2).map((key) => ({ - type: "Property", - method: false, - shorthand: false, - computed: typeof key !== "string", - kind: "init", - key: valueToEstree(key, options2), - value: valueToEstree(value2[key], options2) - })); - if (Object.getPrototypeOf(value2) == null) { - properties.unshift({ + function generate(val, isDeclaration) { + if (val === void 0) { + return identifier(String(val)); + } + if (val == null || typeof val === "string" || typeof val === "boolean") { + return literal(val); + } + if (typeof val === "bigint" || typeof val === "number") { + return processNumber(val); + } + if (typeof val === "symbol") { + if (val.description && val === Symbol.for(val.description)) { + return methodCall(identifier("Symbol"), "for", [literal(val.description)]); + } + throw new TypeError(`Only global symbols are supported, got: ${String(val)}`, { cause: val }); + } + const context = collectedContexts.get(val); + if (!isDeclaration && (context == null ? void 0 : context.name)) { + return identifier(context.name); + } + if (isValueReconstructable(val)) { + return { + type: "NewExpression", + callee: identifier(val.constructor.name), + arguments: [generate(val.valueOf())] + }; + } + if (val instanceof RegExp) { + return { + type: "Literal", + regex: { pattern: val.source, flags: val.flags } + }; + } + if (typeof Buffer !== "undefined" && Buffer.isBuffer(val)) { + return methodCall(identifier("Buffer"), "from", [processNumberArray(val)]); + } + if (isTypedArray(val)) { + return { + type: "NewExpression", + callee: identifier(val.constructor.name), + arguments: [processNumberArray(val)] + }; + } + if (isStringReconstructable(val)) { + return { + type: "NewExpression", + callee: identifier(val.constructor.name), + arguments: [literal(String(val))] + }; + } + if (Array.isArray(val)) { + const elements = Array.from({ length: val.length }); + let trimmable; + for (let index = 0; index < val.length; index += 1) { + if (!(index in val)) { + elements[index] = null; + trimmable = void 0; + continue; + } + const child = val[index]; + const childContext = collectedContexts.get(child); + if (context && childContext && namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) { + elements[index] = null; + trimmable ||= index; + childContext.assignment = { + type: "AssignmentExpression", + operator: "=", + left: { + type: "MemberExpression", + computed: true, + optional: false, + object: identifier(context.name), + property: literal(index) + }, + right: childContext.assignment || identifier(childContext.name) + }; + } else { + elements[index] = generate(child); + trimmable = void 0; + } + } + if (trimmable != null) { + elements.splice(trimmable); + } + return { + type: "ArrayExpression", + elements + }; + } + if (val instanceof Set) { + const elements = []; + let finalizer; + for (const child of val) { + if (finalizer) { + finalizer = methodCall(finalizer, "add", [generate(child)]); + } else { + const childContext = collectedContexts.get(child); + if (context && childContext && namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) { + finalizer = methodCall(identifier(context.name), "add", [generate(child)]); + } else { + elements.push(generate(child)); + } + } + } + if (context && finalizer) { + context.assignment = replaceAssignment(finalizer, context.assignment); + } + return { + type: "NewExpression", + callee: identifier("Set"), + arguments: elements.length ? [{ type: "ArrayExpression", elements }] : [] + }; + } + if (val instanceof Map) { + const elements = []; + let finalizer; + for (const [key, item] of val) { + if (finalizer) { + finalizer = methodCall(finalizer, "set", [generate(key), generate(item)]); + } else { + const keyContext = collectedContexts.get(key); + const itemContext = collectedContexts.get(item); + if (context && (keyContext && namedContexts.indexOf(keyContext) >= namedContexts.indexOf(context) || itemContext && namedContexts.indexOf(itemContext) >= namedContexts.indexOf(context))) { + finalizer = methodCall(identifier(context.name), "set", [ + generate(key), + generate(item) + ]); + } else { + elements.push({ + type: "ArrayExpression", + elements: [generate(key), generate(item)] + }); + } + } + } + if (context && finalizer) { + context.assignment = replaceAssignment(finalizer, context.assignment); + } + return { + type: "NewExpression", + callee: identifier("Map"), + arguments: elements.length ? [{ type: "ArrayExpression", elements }] : [] + }; + } + const properties = []; + if (Object.getPrototypeOf(val) == null) { + properties.push({ type: "Property", method: false, shorthand: false, computed: false, kind: "init", - key: { type: "Identifier", name: "__proto__" }, - value: { type: "Literal", value: null } + key: identifier("__proto__"), + value: literal(null) }); } + const object = val; + for (const key of Reflect.ownKeys(val)) { + const computed = typeof key !== "string"; + const keyExpression = generate(key); + const child = object[key]; + const childContext = collectedContexts.get(child); + if (context && childContext && namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) { + childContext.assignment = { + type: "AssignmentExpression", + operator: "=", + left: { + type: "MemberExpression", + computed: true, + optional: false, + object: identifier(context.name), + property: keyExpression + }, + right: childContext.assignment || generate(child) + }; + } else { + properties.push({ + type: "Property", + method: false, + shorthand: false, + computed, + kind: "init", + key: keyExpression, + value: generate(child) + }); + } + } return { type: "ObjectExpression", properties }; } - throw new TypeError(`Unsupported value: ${String(value2)}`); + analyze(value2); + for (const [val, context] of collectedContexts) { + if (context.recursive || context.count > 1) { + context.name = `$${namedContexts.length}`; + namedContexts.push(context); + } else { + collectedContexts.delete(val); + } + } + if (!namedContexts.length) { + return generate(value2); + } + const declarations = namedContexts.sort(compareContexts).map((context) => ({ + type: "VariableDeclarator", + id: identifier(context.name), + init: generate(context.value, true) + })); + const rootContext = collectedContexts.get(value2); + const finalizers = []; + for (const context of collectedContexts.values()) { + if (context !== rootContext && context.assignment) { + finalizers.push(context.assignment); + } + } + finalizers.push(rootContext ? rootContext.assignment || identifier(rootContext.name) : generate(value2)); + return { + type: "CallExpression", + optional: false, + arguments: [], + callee: { + type: "ArrowFunctionExpression", + expression: false, + params: [], + body: { + type: "BlockStatement", + body: [ + { + type: "VariableDeclaration", + kind: "const", + declarations + }, + { + type: "ReturnStatement", + argument: { + type: "SequenceExpression", + expressions: finalizers + } + } + ] + } + } + }; } // node_modules/.pnpm/hast-util-heading-rank@2.1.1/node_modules/hast-util-heading-rank/lib/index.js @@ -15562,14 +15862,14 @@ function csharp(Prism2) { var nestedRound = nested(/\((?:[^()]|<>)*\)/.source, 2); var name = /@?\b[A-Za-z_]\w*\b/.source; var genericName = replace2(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]); - var identifier = replace2(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [ + var identifier2 = replace2(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [ nonTypeKeywords, genericName ]); var array = /\[\s*(?:,\s*)*\]/.source; var typeExpressionWithoutTuple = replace2( /<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, - [identifier, array] + [identifier2, array] ); var tupleElement = replace2( /[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, @@ -15578,7 +15878,7 @@ function csharp(Prism2) { var tuple = replace2(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]); var typeExpression = replace2( /(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, - [tuple, identifier, array] + [tuple, identifier2, array] ); var typeInside = { keyword: keywords, @@ -15605,7 +15905,7 @@ function csharp(Prism2) { // Using static // using static System.Math; pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [ - identifier + identifier2 ]), lookbehind: true, inside: typeInside @@ -15641,7 +15941,7 @@ function csharp(Prism2) { // Single catch exception declaration // catch(Foo) // (things like catch(Foo e) is covered by variable declaration) - pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]), + pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier2]), lookbehind: true, inside: typeInside }, @@ -15719,7 +16019,7 @@ function csharp(Prism2) { // int Foo => 0; int Foo { get; set } = 0; pattern: re( /<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, - [typeExpression, identifier] + [typeExpression, identifier2] ), inside: typeInside, alias: "class-name" @@ -15812,7 +16112,7 @@ function csharp(Prism2) { ); var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source; var attr = replace2(/<<0>>(?:\s*\(<<1>>*\))?/.source, [ - identifier, + identifier2, roundExpression ]); Prism3.languages.insertBefore("csharp", "class-name", { @@ -15835,7 +16135,7 @@ function csharp(Prism2) { inside: Prism3.languages.csharp }, "class-name": { - pattern: RegExp(identifier), + pattern: RegExp(identifier2), inside: { punctuation: /\./ } @@ -26824,20 +27124,26 @@ function imagePlugin(userOpts) { this.error(`Image '${id}' could not be optimized to JSX`); } const index = code3.indexOf("export default"); - return code3.slice(0, index) + ` + return { + code: code3.slice(0, index) + ` import { _jsxQ } from '@builder.io/qwik'; const PROPS = {srcSet, width, height}; export default function (props, key, _, dev) { return _jsxQ('img', {...{decoding: 'async', loading: 'lazy'}, ...props}, PROPS, undefined, 3, key, dev); - }`; + }`, + map: null + }; } else if (extension === ".svg") { const { svgAttributes } = optimizeSvg({ code: code3, path: pathId }, userOpts); - return ` + return { + code: ` import { _jsxQ } from '@builder.io/qwik'; const PROPS = ${JSON.stringify(svgAttributes)}; export default function (props, key, _, dev) { return _jsxQ('svg', props, PROPS, undefined, 3, key, dev); - }`; + }`, + map: null + }; } } return null; @@ -27048,7 +27354,7 @@ function qwikCityPlugin(userOpts) { const fileName = basename4(id); if (isMenuFileName(fileName)) { const menuCode = await transformMenu(ctx.opts, id, code3); - return menuCode; + return { code: menuCode, map: null }; } if (mdxTransform) { try {