UNPKG

rolldown-vite

Version:

Vite on Rolldown preview

1,424 lines (1,407 loc) 1.31 MB
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toDynamicImportESM, r as __export, s as __toESM, t as __commonJSMin } from "./chunk.js"; import { A as OPTIMIZABLE_ENTRY_RE, C as ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, D as JS_TYPES_RE, E as FS_PREFIX, F as defaultAllowedOrigins, I as loopbackHosts, L as wildcardHosts, M as SPECIAL_QUERY_RE, N as VERSION, O as KNOWN_ASSET_TYPES, P as VITE_PACKAGE_DIR, R as require_picocolors, S as ENV_PUBLIC_PATH, T as ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, _ as DEFAULT_SERVER_CONDITIONS, a as CLIENT_ENTRY, b as DEV_PROD_CONDITION, c as DEFAULT_ASSETS_INLINE_LIMIT, d as DEFAULT_CLIENT_MAIN_FIELDS, f as DEFAULT_CONFIG_FILES, g as DEFAULT_PREVIEW_PORT, h as DEFAULT_EXTERNAL_CONDITIONS, i as CLIENT_DIR, j as ROLLUP_HOOKS, k as METADATA_FILENAME, l as DEFAULT_ASSETS_RE, m as DEFAULT_EXTENSIONS, n as createLogger, o as CLIENT_PUBLIC_PATH, p as DEFAULT_DEV_PORT, r as printServerUrls, s as CSS_LANGS_RE, t as LogLevels, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS, w as ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, x as ENV_ENTRY, y as DEP_VERSION_RE } from "./logger.js"; import { builtinModules, createRequire } from "node:module"; import { parseAst, parseAstAsync } from "rolldown/parseAst"; import { esmExternalRequirePlugin } from "rolldown/plugins"; import { minify, minifySync, parse, parseSync, scan, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteDynamicImportVarsPlugin, viteImportGlobPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWasmHelperPlugin, viteWebWorkerPostPlugin } from "rolldown/experimental"; import * as fs$2 from "node:fs"; import fs, { existsSync, promises, readFileSync } from "node:fs"; import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep } from "node:path"; import fsp, { constants } from "node:fs/promises"; import url, { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url"; import { format, formatWithOptions, inspect, promisify, stripVTControlCharacters } from "node:util"; import { performance as performance$1 } from "node:perf_hooks"; import crypto from "node:crypto"; import picomatch from "picomatch"; import { VERSION as rolldownVersion, rolldown } from "rolldown"; import os from "node:os"; import net from "node:net"; import childProcess, { exec, execFile, execSync } from "node:child_process"; import { promises as promises$1 } from "node:dns"; import { isatty } from "node:tty"; import path$1, { isAbsolute as isAbsolute$1, join as join$1, posix as posix$1, resolve as resolve$1, win32 } from "path"; import { withFilter } from "rolldown/filter"; import { gzip } from "node:zlib"; import readline from "node:readline"; import { createRequire as createRequire$1 } from "module"; import { MessageChannel, Worker } from "node:worker_threads"; import isModuleSyncConditionEnabled from "#module-sync-enabled"; import assert from "node:assert"; import process$1 from "node:process"; import v8 from "node:v8"; import { escapePath, glob, globSync, isDynamicPattern } from "tinyglobby"; import { Buffer as Buffer$1 } from "node:buffer"; import { EventEmitter } from "node:events"; import { readdirSync, statSync } from "fs"; import { STATUS_CODES, createServer, get } from "node:http"; import { createServer as createServer$1, get as get$1 } from "node:https"; import { ESModulesEvaluator, ModuleRunner, createNodeImportMeta } from "rolldown-vite/module-runner"; import zlib from "zlib"; import * as qs from "node:querystring"; //#region src/shared/constants.ts /** * Prefix for resolved Ids that are not valid browser import specifiers */ const VALID_ID_PREFIX = `/@id/`; /** * Plugins that use 'virtual modules' (e.g. for helper functions), prefix the * module ID with `\0`, a convention from the rollup ecosystem. * This prevents other plugins from trying to process the id (like node resolution), * and core features like sourcemaps can use this info to differentiate between * virtual modules and regular files. * `\0` is not a permitted char in import URLs so we have to replace them during * import analysis. The id will be decoded back before entering the plugins pipeline. * These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual * modules in the browser end up encoded as `/@id/__x00__{id}` */ const NULL_BYTE_PLACEHOLDER = `__x00__`; let SOURCEMAPPING_URL = "sourceMa"; SOURCEMAPPING_URL += "ppingURL"; const MODULE_RUNNER_SOURCEMAPPING_SOURCE = "//# sourceMappingSource=vite-generated"; const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP"; //#endregion //#region src/shared/utils.ts const isWindows = typeof process !== "undefined" && process.platform === "win32"; /** * Prepend `/@id/` and replace null byte so the id is URL-safe. * This is prepended to resolved ids that are not valid browser * import specifiers by the importAnalysis plugin. */ function wrapId(id) { return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER); } /** * Undo {@link wrapId}'s `/@id/` and null byte replacements. */ function unwrapId(id) { return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id; } const windowsSlashRE = /\\/g; function slash(p) { return p.replace(windowsSlashRE, "/"); } const postfixRE = /[?#].*$/; function cleanUrl(url$4) { return url$4.replace(postfixRE, ""); } function splitFileAndPostfix(path$12) { const file = cleanUrl(path$12); return { file, postfix: path$12.slice(file.length) }; } function withTrailingSlash(path$12) { if (path$12[path$12.length - 1] !== "/") return `${path$12}/`; return path$12; } function promiseWithResolvers() { let resolve$4; let reject; return { promise: new Promise((_resolve, _reject) => { resolve$4 = _resolve; reject = _reject; }), resolve: resolve$4, reject }; } //#endregion //#region src/module-runner/importMetaResolver.ts const customizationHookNamespace = "vite-module-runner:import-meta-resolve/v1/"; const customizationHooksModule = ` export async function resolve(specifier, context, nextResolve) { if (specifier.startsWith(${JSON.stringify(customizationHookNamespace)})) { const data = specifier.slice(${JSON.stringify(customizationHookNamespace)}.length) const [parsedSpecifier, parsedImporter] = JSON.parse(data) specifier = parsedSpecifier context.parentURL = parsedImporter } return nextResolve(specifier, context) } `; function customizationHookResolve(specifier, context, nextResolve) { if (specifier.startsWith(customizationHookNamespace)) { const data = specifier.slice(42); const [parsedSpecifier, parsedImporter] = JSON.parse(data); specifier = parsedSpecifier; context.parentURL = parsedImporter; } return nextResolve(specifier, context); } async function createImportMetaResolver() { let module$1; try { module$1 = (await import("node:module")).Module; } catch { return; } if (!module$1) return; if (module$1.registerHooks) { module$1.registerHooks({ resolve: customizationHookResolve }); return importMetaResolveWithCustomHook; } if (!module$1.register) return; try { const hookModuleContent = `data:text/javascript,${encodeURI(customizationHooksModule)}`; module$1.register(hookModuleContent); } catch (e$1) { if ("code" in e$1 && e$1.code === "ERR_NETWORK_IMPORT_DISALLOWED") return; throw e$1; } return importMetaResolveWithCustomHook; } function importMetaResolveWithCustomHook(specifier, importer) { return import.meta.resolve(`${customizationHookNamespace}${JSON.stringify([specifier, importer])}`); } const importMetaResolveWithCustomHookString = ` (() => { const resolve = 'resolve' return (specifier, importer) => import.meta[resolve]( \`${customizationHookNamespace}\${JSON.stringify([specifier, importer])}\`, ) })() `; //#endregion //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs var comma = ",".charCodeAt(0); var semicolon = ";".charCodeAt(0); var chars$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var intToChar = new Uint8Array(64); var charToInt = new Uint8Array(128); for (let i$1 = 0; i$1 < chars$1.length; i$1++) { const c = chars$1.charCodeAt(i$1); intToChar[i$1] = c; charToInt[c] = i$1; } function decodeInteger(reader, relative$2) { let value$1 = 0; let shift = 0; let integer = 0; do { integer = charToInt[reader.next()]; value$1 |= (integer & 31) << shift; shift += 5; } while (integer & 32); const shouldNegate = value$1 & 1; value$1 >>>= 1; if (shouldNegate) value$1 = -2147483648 | -value$1; return relative$2 + value$1; } function encodeInteger(builder, num, relative$2) { let delta = num - relative$2; delta = delta < 0 ? -delta << 1 | 1 : delta << 1; do { let clamped = delta & 31; delta >>>= 5; if (delta > 0) clamped |= 32; builder.write(intToChar[clamped]); } while (delta > 0); return num; } function hasMoreVlq(reader, max) { if (reader.pos >= max) return false; return reader.peek() !== comma; } var bufLength = 1024 * 16; var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) { return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString(); } } : { decode(buf) { let out = ""; for (let i$1 = 0; i$1 < buf.length; i$1++) out += String.fromCharCode(buf[i$1]); return out; } }; var StringWriter = class { constructor() { this.pos = 0; this.out = ""; this.buffer = new Uint8Array(bufLength); } write(v) { const { buffer } = this; buffer[this.pos++] = v; if (this.pos === bufLength) { this.out += td.decode(buffer); this.pos = 0; } } flush() { const { buffer, out, pos } = this; return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; } }; var StringReader = class { constructor(buffer) { this.pos = 0; this.buffer = buffer; } next() { return this.buffer.charCodeAt(this.pos++); } peek() { return this.buffer.charCodeAt(this.pos); } indexOf(char) { const { buffer, pos } = this; const idx = buffer.indexOf(char, pos); return idx === -1 ? buffer.length : idx; } }; function decode(mappings) { const { length } = mappings; const reader = new StringReader(mappings); const decoded = []; let genColumn = 0; let sourcesIndex = 0; let sourceLine = 0; let sourceColumn = 0; let namesIndex = 0; do { const semi = reader.indexOf(";"); const line = []; let sorted = true; let lastCol = 0; genColumn = 0; while (reader.pos < semi) { let seg; genColumn = decodeInteger(reader, genColumn); if (genColumn < lastCol) sorted = false; lastCol = genColumn; if (hasMoreVlq(reader, semi)) { sourcesIndex = decodeInteger(reader, sourcesIndex); sourceLine = decodeInteger(reader, sourceLine); sourceColumn = decodeInteger(reader, sourceColumn); if (hasMoreVlq(reader, semi)) { namesIndex = decodeInteger(reader, namesIndex); seg = [ genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex ]; } else seg = [ genColumn, sourcesIndex, sourceLine, sourceColumn ]; } else seg = [genColumn]; line.push(seg); reader.pos++; } if (!sorted) sort(line); decoded.push(line); reader.pos = semi + 1; } while (reader.pos <= length); return decoded; } function sort(line) { line.sort(sortComparator$1); } function sortComparator$1(a, b) { return a[0] - b[0]; } function encode(decoded) { const writer = new StringWriter(); let sourcesIndex = 0; let sourceLine = 0; let sourceColumn = 0; let namesIndex = 0; for (let i$1 = 0; i$1 < decoded.length; i$1++) { const line = decoded[i$1]; if (i$1 > 0) writer.write(semicolon); if (line.length === 0) continue; let genColumn = 0; for (let j = 0; j < line.length; j++) { const segment = line[j]; if (j > 0) writer.write(comma); genColumn = encodeInteger(writer, segment[0], genColumn); if (segment.length === 1) continue; sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); sourceLine = encodeInteger(writer, segment[2], sourceLine); sourceColumn = encodeInteger(writer, segment[3], sourceColumn); if (segment.length === 4) continue; namesIndex = encodeInteger(writer, segment[4], namesIndex); } } return writer.flush(); } //#endregion //#region ../../node_modules/.pnpm/@jridgewell+resolve-uri@3.1.2/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs const schemeRegex = /^[\w+.-]+:\/\//; /** * Matches the parts of a URL: * 1. Scheme, including ":", guaranteed. * 2. User/password, including "@", optional. * 3. Host, guaranteed. * 4. Port, including ":", optional. * 5. Path, including "/", optional. * 6. Query, including "?", optional. * 7. Hash, including "#", optional. */ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; /** * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). * * 1. Host, optional. * 2. Path, which may include "/", guaranteed. * 3. Query, including "?", optional. * 4. Hash, including "#", optional. */ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; function isAbsoluteUrl(input) { return schemeRegex.test(input); } function isSchemeRelativeUrl(input) { return input.startsWith("//"); } function isAbsolutePath(input) { return input.startsWith("/"); } function isFileUrl(input) { return input.startsWith("file:"); } function isRelative(input) { return /^[.?#]/.test(input); } function parseAbsoluteUrl(input) { const match = urlRegex.exec(input); return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || ""); } function parseFileUrl(input) { const match = fileRegex.exec(input); const path$12 = match[2]; return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path$12) ? path$12 : "/" + path$12, match[3] || "", match[4] || ""); } function makeUrl(scheme, user, host, port, path$12, query, hash$1) { return { scheme, user, host, port, path: path$12, query, hash: hash$1, type: 7 }; } function parseUrl$3(input) { if (isSchemeRelativeUrl(input)) { const url$5 = parseAbsoluteUrl("http:" + input); url$5.scheme = ""; url$5.type = 6; return url$5; } if (isAbsolutePath(input)) { const url$5 = parseAbsoluteUrl("http://foo.com" + input); url$5.scheme = ""; url$5.host = ""; url$5.type = 5; return url$5; } if (isFileUrl(input)) return parseFileUrl(input); if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input); const url$4 = parseAbsoluteUrl("http://foo.com/" + input); url$4.scheme = ""; url$4.host = ""; url$4.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1; return url$4; } function stripPathFilename(path$12) { if (path$12.endsWith("/..")) return path$12; const index = path$12.lastIndexOf("/"); return path$12.slice(0, index + 1); } function mergePaths(url$4, base) { normalizePath$4(base, base.type); if (url$4.path === "/") url$4.path = base.path; else url$4.path = stripPathFilename(base.path) + url$4.path; } /** * The path can have empty directories "//", unneeded parents "foo/..", or current directory * "foo/.". We need to normalize to a standard representation. */ function normalizePath$4(url$4, type) { const rel = type <= 4; const pieces = url$4.path.split("/"); let pointer = 1; let positive = 0; let addTrailingSlash = false; for (let i$1 = 1; i$1 < pieces.length; i$1++) { const piece = pieces[i$1]; if (!piece) { addTrailingSlash = true; continue; } addTrailingSlash = false; if (piece === ".") continue; if (piece === "..") { if (positive) { addTrailingSlash = true; positive--; pointer--; } else if (rel) pieces[pointer++] = piece; continue; } pieces[pointer++] = piece; positive++; } let path$12 = ""; for (let i$1 = 1; i$1 < pointer; i$1++) path$12 += "/" + pieces[i$1]; if (!path$12 || addTrailingSlash && !path$12.endsWith("/..")) path$12 += "/"; url$4.path = path$12; } /** * Attempts to resolve `input` URL/path relative to `base`. */ function resolve$3(input, base) { if (!input && !base) return ""; const url$4 = parseUrl$3(input); let inputType = url$4.type; if (base && inputType !== 7) { const baseUrl = parseUrl$3(base); const baseType = baseUrl.type; switch (inputType) { case 1: url$4.hash = baseUrl.hash; case 2: url$4.query = baseUrl.query; case 3: case 4: mergePaths(url$4, baseUrl); case 5: url$4.user = baseUrl.user; url$4.host = baseUrl.host; url$4.port = baseUrl.port; case 6: url$4.scheme = baseUrl.scheme; } if (baseType > inputType) inputType = baseType; } normalizePath$4(url$4, inputType); const queryHash = url$4.query + url$4.hash; switch (inputType) { case 2: case 3: return queryHash; case 4: { const path$12 = url$4.path.slice(1); if (!path$12) return queryHash || "."; if (isRelative(base || input) && !isRelative(path$12)) return "./" + path$12 + queryHash; return path$12 + queryHash; } case 5: return url$4.path + queryHash; default: return url$4.scheme + "//" + url$4.user + url$4.host + url$4.port + url$4.path + queryHash; } } //#endregion //#region ../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs function stripFilename(path$12) { if (!path$12) return ""; const index = path$12.lastIndexOf("/"); return path$12.slice(0, index + 1); } function resolver(mapUrl, sourceRoot) { const from = stripFilename(mapUrl); const prefix = sourceRoot ? sourceRoot + "/" : ""; return (source) => resolve$3(prefix + (source || ""), from); } var COLUMN$1 = 0; var SOURCES_INDEX$1 = 1; var SOURCE_LINE$1 = 2; var SOURCE_COLUMN$1 = 3; var NAMES_INDEX$1 = 4; function maybeSort(mappings, owned) { const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); if (unsortedIndex === mappings.length) return mappings; if (!owned) mappings = mappings.slice(); for (let i$1 = unsortedIndex; i$1 < mappings.length; i$1 = nextUnsortedSegmentLine(mappings, i$1 + 1)) mappings[i$1] = sortSegments(mappings[i$1], owned); return mappings; } function nextUnsortedSegmentLine(mappings, start) { for (let i$1 = start; i$1 < mappings.length; i$1++) if (!isSorted(mappings[i$1])) return i$1; return mappings.length; } function isSorted(line) { for (let j = 1; j < line.length; j++) if (line[j][COLUMN$1] < line[j - 1][COLUMN$1]) return false; return true; } function sortSegments(line, owned) { if (!owned) line = line.slice(); return line.sort(sortComparator); } function sortComparator(a, b) { return a[COLUMN$1] - b[COLUMN$1]; } var found = false; function binarySearch(haystack, needle, low, high) { while (low <= high) { const mid = low + (high - low >> 1); const cmp = haystack[mid][COLUMN$1] - needle; if (cmp === 0) { found = true; return mid; } if (cmp < 0) low = mid + 1; else high = mid - 1; } found = false; return low - 1; } function upperBound(haystack, needle, index) { for (let i$1 = index + 1; i$1 < haystack.length; index = i$1++) if (haystack[i$1][COLUMN$1] !== needle) break; return index; } function lowerBound(haystack, needle, index) { for (let i$1 = index - 1; i$1 >= 0; index = i$1--) if (haystack[i$1][COLUMN$1] !== needle) break; return index; } function memoizedState() { return { lastKey: -1, lastNeedle: -1, lastIndex: -1 }; } function memoizedBinarySearch(haystack, needle, state, key) { const { lastKey, lastNeedle, lastIndex } = state; let low = 0; let high = haystack.length - 1; if (key === lastKey) { if (needle === lastNeedle) { found = lastIndex !== -1 && haystack[lastIndex][COLUMN$1] === needle; return lastIndex; } if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex; else high = lastIndex; } state.lastKey = key; state.lastNeedle = needle; return state.lastIndex = binarySearch(haystack, needle, low, high); } function parse$15(map$1) { return typeof map$1 === "string" ? JSON.parse(map$1) : map$1; } var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; var LEAST_UPPER_BOUND = -1; var GREATEST_LOWER_BOUND = 1; var TraceMap = class { constructor(map$1, mapUrl) { const isString$1 = typeof map$1 === "string"; if (!isString$1 && map$1._decodedMemo) return map$1; const parsed = parse$15(map$1); const { version: version$1, file, names, sourceRoot, sources, sourcesContent } = parsed; this.version = version$1; this.file = file; this.names = names || []; this.sourceRoot = sourceRoot; this.sources = sources; this.sourcesContent = sourcesContent; this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0; const resolve$4 = resolver(mapUrl, sourceRoot); this.resolvedSources = sources.map(resolve$4); const { mappings } = parsed; if (typeof mappings === "string") { this._encoded = mappings; this._decoded = void 0; } else if (Array.isArray(mappings)) { this._encoded = void 0; this._decoded = maybeSort(mappings, isString$1); } else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`); else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`); this._decodedMemo = memoizedState(); this._bySources = void 0; this._bySourceMemos = void 0; } }; function cast$1(map$1) { return map$1; } function decodedMappings(map$1) { var _a; return (_a = cast$1(map$1))._decoded || (_a._decoded = decode(cast$1(map$1)._encoded)); } function traceSegment(map$1, line, column) { const decoded = decodedMappings(map$1); if (line >= decoded.length) return null; const segments = decoded[line]; const index = traceSegmentInternal(segments, cast$1(map$1)._decodedMemo, line, column, GREATEST_LOWER_BOUND); return index === -1 ? null : segments[index]; } function originalPositionFor(map$1, needle) { let { line, column, bias } = needle; line--; if (line < 0) throw new Error(LINE_GTR_ZERO); if (column < 0) throw new Error(COL_GTR_EQ_ZERO); const decoded = decodedMappings(map$1); if (line >= decoded.length) return OMapping(null, null, null, null); const segments = decoded[line]; const index = traceSegmentInternal(segments, cast$1(map$1)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); if (index === -1) return OMapping(null, null, null, null); const segment = segments[index]; if (segment.length === 1) return OMapping(null, null, null, null); const { names, resolvedSources } = map$1; return OMapping(resolvedSources[segment[SOURCES_INDEX$1]], segment[SOURCE_LINE$1] + 1, segment[SOURCE_COLUMN$1], segment.length === 5 ? names[segment[NAMES_INDEX$1]] : null); } function OMapping(source, line, column, name) { return { source, line, column, name }; } function traceSegmentInternal(segments, memo, line, column, bias) { let index = memoizedBinarySearch(segments, column, memo, line); if (found) index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); else if (bias === LEAST_UPPER_BOUND) index++; if (index === -1 || index === segments.length) return -1; return index; } //#endregion //#region ../../node_modules/.pnpm/@jridgewell+gen-mapping@0.3.12/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs var SetArray = class { constructor() { this._indexes = { __proto__: null }; this.array = []; } }; function cast(set) { return set; } function get$2(setarr, key) { return cast(setarr)._indexes[key]; } function put(setarr, key) { const index = get$2(setarr, key); if (index !== void 0) return index; const { array, _indexes: indexes } = cast(setarr); return indexes[key] = array.push(key) - 1; } function remove(setarr, key) { const index = get$2(setarr, key); if (index === void 0) return; const { array, _indexes: indexes } = cast(setarr); for (let i$1 = index + 1; i$1 < array.length; i$1++) { const k = array[i$1]; array[i$1 - 1] = k; indexes[k]--; } indexes[key] = void 0; array.pop(); } var COLUMN = 0; var SOURCES_INDEX = 1; var SOURCE_LINE = 2; var SOURCE_COLUMN = 3; var NAMES_INDEX = 4; var NO_NAME = -1; var GenMapping = class { constructor({ file, sourceRoot } = {}) { this._names = new SetArray(); this._sources = new SetArray(); this._sourcesContent = []; this._mappings = []; this.file = file; this.sourceRoot = sourceRoot; this._ignoreList = new SetArray(); } }; function cast2(map$1) { return map$1; } var maybeAddSegment = (map$1, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { return addSegmentInternal(true, map$1, genLine, genColumn, source, sourceLine, sourceColumn, name, content); }; function setSourceContent(map$1, source, content) { const { _sources: sources, _sourcesContent: sourcesContent } = cast2(map$1); const index = put(sources, source); sourcesContent[index] = content; } function setIgnore(map$1, source, ignore = true) { const { _sources: sources, _sourcesContent: sourcesContent, _ignoreList: ignoreList } = cast2(map$1); const index = put(sources, source); if (index === sourcesContent.length) sourcesContent[index] = null; if (ignore) put(ignoreList, index); else remove(ignoreList, index); } function toDecodedMap(map$1) { const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList } = cast2(map$1); removeEmptyFinalLines(mappings); return { version: 3, file: map$1.file || void 0, names: names.array, sourceRoot: map$1.sourceRoot || void 0, sources: sources.array, sourcesContent, mappings, ignoreList: ignoreList.array }; } function toEncodedMap(map$1) { const decoded = toDecodedMap(map$1); return Object.assign({}, decoded, { mappings: encode(decoded.mappings) }); } function addSegmentInternal(skipable, map$1, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = cast2(map$1); const line = getIndex(mappings, genLine); const index = getColumnIndex(line, genColumn); if (!source) { if (skipable && skipSourceless(line, index)) return; return insert(line, index, [genColumn]); } assert$2(sourceLine); assert$2(sourceColumn); const sourcesIndex = put(sources, source); const namesIndex = name ? put(names, name) : NO_NAME; if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null; if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) return; return insert(line, index, name ? [ genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex ] : [ genColumn, sourcesIndex, sourceLine, sourceColumn ]); } function assert$2(_val) {} function getIndex(arr, index) { for (let i$1 = arr.length; i$1 <= index; i$1++) arr[i$1] = []; return arr[index]; } function getColumnIndex(line, genColumn) { let index = line.length; for (let i$1 = index - 1; i$1 >= 0; index = i$1--) if (genColumn >= line[i$1][COLUMN]) break; return index; } function insert(array, index, value$1) { for (let i$1 = array.length; i$1 > index; i$1--) array[i$1] = array[i$1 - 1]; array[index] = value$1; } function removeEmptyFinalLines(mappings) { const { length } = mappings; let len = length; for (let i$1 = len - 1; i$1 >= 0; len = i$1, i$1--) if (mappings[i$1].length > 0) break; if (len < length) mappings.length = len; } function skipSourceless(line, index) { if (index === 0) return true; return line[index - 1].length === 1; } function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { if (index === 0) return false; const prev = line[index - 1]; if (prev.length === 1) return false; return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME); } //#endregion //#region ../../node_modules/.pnpm/@jridgewell+remapping@2.3.5/node_modules/@jridgewell/remapping/dist/remapping.mjs var SOURCELESS_MAPPING = /* @__PURE__ */ SegmentObject("", -1, -1, "", null, false); var EMPTY_SOURCES = []; function SegmentObject(source, line, column, name, content, ignore) { return { source, line, column, name, content, ignore }; } function Source(map$1, sources, source, content, ignore) { return { map: map$1, sources, source, content, ignore }; } function MapSource(map$1, sources) { return Source(map$1, sources, "", null, false); } function OriginalSource(source, content, ignore) { return Source(null, EMPTY_SOURCES, source, content, ignore); } function traceMappings(tree) { const gen = new GenMapping({ file: tree.map.file }); const { sources: rootSources, map: map$1 } = tree; const rootNames = map$1.names; const rootMappings = decodedMappings(map$1); for (let i$1 = 0; i$1 < rootMappings.length; i$1++) { const segments = rootMappings[i$1]; for (let j = 0; j < segments.length; j++) { const segment = segments[j]; const genCol = segment[0]; let traced = SOURCELESS_MAPPING; if (segment.length !== 1) { const source2 = rootSources[segment[1]]; traced = originalPositionFor$1(source2, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : ""); if (traced == null) continue; } const { column, line, name, content, source, ignore } = traced; maybeAddSegment(gen, i$1, genCol, source, line, column, name); if (source && content != null) setSourceContent(gen, source, content); if (ignore) setIgnore(gen, source, true); } } return gen; } function originalPositionFor$1(source, line, column, name) { if (!source.map) return SegmentObject(source.source, line, column, name, source.content, source.ignore); const segment = traceSegment(source.map, line, column); if (segment == null) return null; if (segment.length === 1) return SOURCELESS_MAPPING; return originalPositionFor$1(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name); } function asArray(value$1) { if (Array.isArray(value$1)) return value$1; return [value$1]; } function buildSourceMapTree(input, loader$1) { const maps = asArray(input).map((m) => new TraceMap(m, "")); const map$1 = maps.pop(); for (let i$1 = 0; i$1 < maps.length; i$1++) if (maps[i$1].sources.length > 1) throw new Error(`Transformation map ${i$1} must have exactly one source file. Did you specify these with the most recent transformation maps first?`); let tree = build$1(map$1, loader$1, "", 0); for (let i$1 = maps.length - 1; i$1 >= 0; i$1--) tree = MapSource(maps[i$1], [tree]); return tree; } function build$1(map$1, loader$1, importer, importerDepth) { const { resolvedSources, sourcesContent, ignoreList } = map$1; const depth = importerDepth + 1; return MapSource(map$1, resolvedSources.map((sourceFile, i$1) => { const ctx = { importer, depth, source: sourceFile || "", content: void 0, ignore: void 0 }; const sourceMap = loader$1(ctx.source, ctx); const { source, content, ignore } = ctx; if (sourceMap) return build$1(new TraceMap(sourceMap, source), loader$1, source, depth); return OriginalSource(source, content !== void 0 ? content : sourcesContent ? sourcesContent[i$1] : null, ignore !== void 0 ? ignore : ignoreList ? ignoreList.includes(i$1) : false); })); } var SourceMap$1 = class { constructor(map$1, options$1) { const out = options$1.decodedMappings ? toDecodedMap(map$1) : toEncodedMap(map$1); this.version = out.version; this.file = out.file; this.mappings = out.mappings; this.names = out.names; this.ignoreList = out.ignoreList; this.sourceRoot = out.sourceRoot; this.sources = out.sources; if (!options$1.excludeContent) this.sourcesContent = out.sourcesContent; } toString() { return JSON.stringify(this); } }; function remapping(input, loader$1, options$1) { const opts = typeof options$1 === "object" ? options$1 : { excludeContent: !!options$1, decodedMappings: false }; return new SourceMap$1(traceMappings(buildSourceMapTree(input, loader$1)), opts); } //#endregion //#region ../../node_modules/.pnpm/obug@1.0.2_ms@2.1.3/node_modules/obug/dist/core.js function coerce(value$1) { if (value$1 instanceof Error) return value$1.stack || value$1.message; return value$1; } function selectColor(colors$37, namespace) { let hash$1 = 0; for (let i$1 = 0; i$1 < namespace.length; i$1++) { hash$1 = (hash$1 << 5) - hash$1 + namespace.charCodeAt(i$1); hash$1 |= 0; } return colors$37[Math.abs(hash$1) % colors$37.length]; } function matchesTemplate(search, template) { let searchIndex = 0; let templateIndex = 0; let starIndex = -1; let matchIndex = 0; while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") { starIndex = templateIndex; matchIndex = searchIndex; templateIndex++; } else { searchIndex++; templateIndex++; } else if (starIndex !== -1) { templateIndex = starIndex + 1; matchIndex++; searchIndex = matchIndex; } else return false; while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++; return templateIndex === template.length; } function humanize(value$1) { if (value$1 >= 1e3) return `${(value$1 / 1e3).toFixed(1)}s`; return `${value$1}ms`; } function setup(useColors$1, colors$37, log$3, load$2, save$1, formatArgs$1, init$2) { const createDebug$1 = (namespace) => { let prevTime; let enableOverride; let namespacesCache; let enabledCache; const debug$18 = (...args) => { if (!debug$18.enabled) return; const curr = Date.now(); debug$18.diff = curr - (prevTime || curr); debug$18.prev = prevTime; debug$18.curr = curr; prevTime = curr; args[0] = coerce(args[0]); if (typeof args[0] !== "string") args.unshift("%O"); let index = 0; args[0] = args[0].replace(/%([a-z%])/gi, (match, format$3) => { if (match === "%%") return "%"; index++; const formatter = createDebug$1.formatters[format$3]; if (typeof formatter === "function") { const value$1 = args[index]; match = formatter.call(debug$18, value$1); args.splice(index, 1); index--; } return match; }); createDebug$1.formatArgs.call(debug$18, args); (debug$18.log || createDebug$1.log).apply(debug$18, args); }; function extend(namespace$1, delimiter = ":") { const newDebug = createDebug$1(this.namespace + delimiter + namespace$1); newDebug.log = this.log; return newDebug; } debug$18.namespace = namespace; debug$18.useColors = useColors$1; debug$18.color = selectColor(colors$37, namespace); debug$18.extend = extend; debug$18.log = log$3; Object.defineProperty(debug$18, "enabled", { enumerable: true, configurable: false, get: () => { if (enableOverride != null) return enableOverride; if (namespacesCache !== createDebug$1.namespaces) { namespacesCache = createDebug$1.namespaces; enabledCache = createDebug$1.enabled(namespace); } return enabledCache; }, set: (v) => { enableOverride = v; } }); init$2 && init$2(debug$18); return debug$18; }; function enable(namespaces) { save$1(namespaces); createDebug$1.namespaces = namespaces; createDebug$1.names = []; createDebug$1.skips = []; const split = namespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean); for (const ns of split) if (ns[0] === "-") createDebug$1.skips.push(ns.slice(1)); else createDebug$1.names.push(ns); } function disable() { const namespaces = [...createDebug$1.names, ...createDebug$1.skips.map((namespace) => `-${namespace}`)].join(","); createDebug$1.enable(""); return namespaces; } function enabled(name) { for (const skip of createDebug$1.skips) if (matchesTemplate(name, skip)) return false; for (const ns of createDebug$1.names) if (matchesTemplate(name, ns)) return true; return false; } createDebug$1.namespaces = ""; createDebug$1.formatters = {}; createDebug$1.enable = enable; createDebug$1.disable = disable; createDebug$1.enabled = enabled; createDebug$1.names = []; createDebug$1.skips = []; createDebug$1.selectColor = (ns) => selectColor(colors$37, ns); createDebug$1.formatArgs = formatArgs$1; createDebug$1.log = log$3; createDebug$1.enable(load$2()); return createDebug$1; } var init_core = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/obug@1.0.2_ms@2.1.3/node_modules/obug/dist/node.js var node_exports = /* @__PURE__ */ __export({ createDebug: () => createDebug, default: () => node_default, formatArgs: () => formatArgs, log: () => log$2, "module.exports": () => createDebug }); function log$2(...args) { process.stderr.write(`${formatWithOptions(inspectOpts, ...args)}\n`); } function load$1() { return process.env.DEBUG || ""; } function save(namespaces) { if (namespaces) process.env.DEBUG = namespaces; else delete process.env.DEBUG; } function useColors() { return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd); } function formatArgs(args) { const { namespace: name, useColors: useColors$1 } = this; if (useColors$1) { const c = this.color; const colorCode = `\u001B[3${c < 8 ? c : `8;5;${c}`}`; const prefix = ` ${colorCode};1m${name} \u001B[0m`; args[0] = prefix + args[0].split("\n").join(`\n${prefix}`); args.push(`${colorCode}m+${humanize$1(this.diff)}\u001B[0m`); } else args[0] = `${getDate()}${name} ${args[0]}`; } function getDate() { if (inspectOpts.hideDate) return ""; return `${(/* @__PURE__ */ new Date()).toISOString()} `; } function init$1(debug$18) { debug$18.inspectOpts = Object.assign({}, inspectOpts); } var require$1, colors$36, inspectOpts, humanize$1, createDebug, node_default; var init_node = __esmMin((() => { init_core(); require$1 = createRequire(import.meta.url); colors$36 = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ] : [ 6, 2, 3, 4, 5, 1 ]; inspectOpts = Object.keys(process.env).filter((key) => { return /^debug_/i.test(key); }).reduce((obj, key) => { const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase()); let value$1 = process.env[key]; if (value$1 === "null") value$1 = null; else if (/^yes|on|true|enabled$/i.test(value$1)) value$1 = true; else if (/^no|off|false|disabled$/i.test(value$1)) value$1 = false; else value$1 = Number(value$1); obj[prop] = value$1; return obj; }, {}); ; try { humanize$1 = require$1("ms"); } catch (_unused) { humanize$1 = humanize; } createDebug = setup(useColors(), colors$36, log$2, load$1, save, formatArgs, init$1); createDebug.inspectOpts = inspectOpts; createDebug.formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" "); }; createDebug.formatters.O = function(v) { this.inspectOpts.colors = this.useColors; return inspect(v, this.inspectOpts); }; node_default = createDebug; createDebug.default = createDebug; createDebug.debug = createDebug; })); //#endregion //#region ../../node_modules/.pnpm/@rollup+pluginutils@5.3.0_rollup@4.43.0/node_modules/@rollup/pluginutils/dist/es/index.js function isArray(arg) { return Array.isArray(arg); } function ensureArray(thing) { if (isArray(thing)) return thing; if (thing == null) return []; return [thing]; } const normalizePathRegExp = new RegExp(`\\${win32.sep}`, "g"); const normalizePath$3 = function normalizePath$5(filename) { return filename.replace(normalizePathRegExp, posix$1.sep); }; function getMatcherString$1(id, resolutionBase) { if (resolutionBase === false || isAbsolute$1(id) || id.startsWith("**")) return normalizePath$3(id); const basePath = normalizePath$3(resolve$1(resolutionBase || "")).replace(/[-^$*+?.()|[\]{}]/g, "\\$&"); return posix$1.join(basePath, normalizePath$3(id)); } const createFilter$2 = function createFilter$3(include, exclude, options$1) { const resolutionBase = options$1 && options$1.resolve; const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => { return picomatch(getMatcherString$1(id, resolutionBase), { dot: true })(what); } }; const includeMatchers = ensureArray(include).map(getMatcher); const excludeMatchers = ensureArray(exclude).map(getMatcher); if (!includeMatchers.length && !excludeMatchers.length) return (id) => typeof id === "string" && !id.includes("\0"); return function result(id) { if (typeof id !== "string") return false; if (id.includes("\0")) return false; const pathId = normalizePath$3(id); for (let i$1 = 0; i$1 < excludeMatchers.length; ++i$1) { const matcher = excludeMatchers[i$1]; if (matcher instanceof RegExp) matcher.lastIndex = 0; if (matcher.test(pathId)) return false; } for (let i$1 = 0; i$1 < includeMatchers.length; ++i$1) { const matcher = includeMatchers[i$1]; if (matcher instanceof RegExp) matcher.lastIndex = 0; if (matcher.test(pathId)) return true; } return !includeMatchers.length; }; }; const forbiddenIdentifiers = new Set(`break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl`.split(" ")); forbiddenIdentifiers.add(""); const makeLegalIdentifier = function makeLegalIdentifier$1(str) { let identifier = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, "_"); if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) identifier = `_${identifier}`; return identifier || "_"; }; function stringify$4(obj) { return (JSON.stringify(obj) || "undefined").replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`); } function serializeArray(arr, indent, baseIndent) { let output = "["; const separator = indent ? `\n${baseIndent}${indent}` : ""; for (let i$1 = 0; i$1 < arr.length; i$1++) { const key = arr[i$1]; output += `${i$1 > 0 ? "," : ""}${separator}${serialize(key, indent, baseIndent + indent)}`; } return `${output}${indent ? `\n${baseIndent}` : ""}]`; } function serializeObject(obj, indent, baseIndent) { let output = "{"; const separator = indent ? `\n${baseIndent}${indent}` : ""; const entries = Object.entries(obj); for (let i$1 = 0; i$1 < entries.length; i$1++) { const [key, value$1] = entries[i$1]; const stringKey = makeLegalIdentifier(key) === key ? key : stringify$4(key); output += `${i$1 > 0 ? "," : ""}${separator}${stringKey}:${indent ? " " : ""}${serialize(value$1, indent, baseIndent + indent)}`; } return `${output}${indent ? `\n${baseIndent}` : ""}}`; } function serialize(obj, indent, baseIndent) { if (typeof obj === "object" && obj !== null) { if (Array.isArray(obj)) return serializeArray(obj, indent, baseIndent); if (obj instanceof Date) return `new Date(${obj.getTime()})`; if (obj instanceof RegExp) return obj.toString(); return serializeObject(obj, indent, baseIndent); } if (typeof obj === "number") { if (obj === Infinity) return "Infinity"; if (obj === -Infinity) return "-Infinity"; if (obj === 0) return 1 / obj === Infinity ? "0" : "-0"; if (obj !== obj) return "NaN"; } if (typeof obj === "symbol") { const key = Symbol.keyFor(obj); if (key !== void 0) return `Symbol.for(${stringify$4(key)})`; } if (typeof obj === "bigint") return `${obj}n`; return stringify$4(obj); } const hasStringIsWellFormed = "isWellFormed" in String.prototype; function isWellFormedString(input) { if (hasStringIsWellFormed) return input.isWellFormed(); return !/\p{Surrogate}/u.test(input); } const dataToEsm = function dataToEsm$1(data, options$1 = {}) { var _a, _b; const t$1 = options$1.compact ? "" : "indent" in options$1 ? options$1.indent : " "; const _ = options$1.compact ? "" : " "; const n$2 = options$1.compact ? "" : "\n"; const declarationType = options$1.preferConst ? "const" : "var"; if (options$1.namedExports === false || typeof data !== "object" || Array.isArray(data) || data instanceof Date || data instanceof RegExp || data === null) { const code = serialize(data, options$1.compact ? null : t$1, ""); return `export default${_ || (/^[{[\-\/]/.test(code) ? "" : " ")}${code};`; } let maxUnderbarPrefixLength = 0; for (const key of Object.keys(data)) { const underbarPrefixLength = (_b = (_a = /^(_+)/.exec(key)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0; if (underbarPrefixLength > maxUnderbarPrefixLength) maxUnderbarPrefixLength = underbarPrefixLength; } const arbitraryNamePrefix = `${"_".repeat(maxUnderbarPrefixLength + 1)}arbitrary`; let namedExportCode = ""; const defaultExportRows = []; const arbitraryNameExportRows = []; for (const [key, value$1] of Object.entries(data)) if (key === makeLegalIdentifier(key)) { if (options$1.objectShorthand) defaultExportRows.push(key); else defaultExportRows.push(`${key}:${_}${key}`); namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value$1, options$1.compact ? null : t$1, "")};${n$2}`; } else { defaultExportRows.push(`${stringify$4(key)}:${_}${serialize(value$1, options$1.compact ? null : t$1, "")}`); if (options$1.includeArbitraryNames && isWellFormedString(key)) { const variableName = `${arbitraryNamePrefix}${arbitraryNameExportRows.length}`; namedExportCode += `${declarationType} ${variableName}${_}=${_}${serialize(value$1, options$1.compact ? null : t$1, "")};${n$2}`; arbitraryNameExportRows.push(`${variableName} as ${JSON.stringify(key)}`); } } const arbitraryExportCode = arbitraryNameExportRows.length > 0 ? `export${_}{${n$2}${t$1}${arbitraryNameExportRows.join(`,${n$2}${t$1}`)}${n$2}};${n$2}` : ""; const defaultExportCode = `export default${_}{${n$2}${t$1}${defaultExportRows.join(`,${n$2}${t$1}`)}${n$2}};${n$2}`; return `${namedExportCode}${arbitraryExportCode}${defaultExportCode}`; }; //#endregion //#region src/shared/builtin.ts function createIsBuiltin(builtins) { const plainBuiltinsSet = new Set(builtins.filter((builtin) => typeof builtin === "string")); const regexBuiltins = builtins.filter((builtin) => typeof builtin !== "string"); return (id) => plainBuiltinsSet.has(id) || regexBuiltins.some((regexp) => regexp.test(id)); } //#endregion //#region src/node/packages.ts let pnp; if (process.versions.pnp) try { pnp = createRequire( /** #__KEEP__ */ import.meta.url )("pnpapi"); } catch {} function invalidatePackageData(packageCache, pkgPath) { const pkgDir = normalizePath(path.dirname(pkgPath)); packageCache.forEach((pkg, cacheKey) => { if (pkg.dir === pkgDir) packageCache.delete(cacheKey); }); } function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageCache) { if (pnp) { const cacheKey = getRpdCacheKey(pkgName, basedir, preserveSymlinks); if (packageCache?.has(cacheKey)) return packageCache.get(cacheKey); try { const pkg = pnp.resolveToUnqualified(pkgName, basedir, { considerBuiltins: false }); if (!pkg) return null; const pkgData = loadPackageData(path.join(pkg, "package.json")); packageCache?.set(cacheKey, pkgData); return pkgData; } catch { return null; } } const originalBasedir = basedir; while (basedir) { if (packageCache) { const cached = getRpdCache(packageCache, pkgName, basedir, originalBasedir, preserveSymlinks); if (cached) return cached; } const pkg = path.join(basedir, "node_modules", pkgName, "package.json"); try { if (fs.existsSync(pkg)) { const pkgData = loadPackageData(preserveSymlinks ? pkg : safeRealpathSync(pkg)); if (packageCache) setRpdCache(packageCache, pkgData, pkgName, basedir, originalBasedir, preserveSymlinks); return pkgData; } } catch {} const nextBasedir = path.dirname(basedir); if (nextBasedir === basedir) break; basedir = nextBasedir; } return null; } function findNearestPackageData(basedir, packageCache) { const originalBasedir = basedir; while (basedir) { if (packageCache) { const cached = getFnpdCache(packageCache, basedir, originalBasedir); if (cached) return cached; } const pkgPath = path.join(basedir, "package.json"); if (tryStatSync(pkgPath)?.isFile()) try { const pkgData = loadPackageData(pkgPath); if (packageCache