@sveltejs/vite-plugin-svelte 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils/log.ts","../src/handle-hot-update.ts","../src/utils/compile.ts","../src/utils/hash.ts","../src/utils/id.ts","../src/utils/options.ts","../src/utils/load-svelte-config.ts","../src/utils/constants.ts","../src/utils/dependencies.ts","../src/utils/esbuild.ts","../src/utils/error.ts","../src/utils/preprocess.ts","../src/utils/sourcemap.ts","../src/utils/vite-plugin-svelte-cache.ts","../src/utils/watch.ts","../src/utils/resolve.ts","../src/utils/optimizer.ts","../src/ui/inspector/plugin.ts"],"sourcesContent":["import fs from 'fs';\nimport { HmrContext, ModuleNode, Plugin, ResolvedConfig, UserConfig } from 'vite';\nimport { handleHotUpdate } from './handle-hot-update';\nimport { log, logCompilerWarnings } from './utils/log';\nimport { CompileData, createCompileSvelte } from './utils/compile';\nimport { buildIdParser, IdParser, SvelteRequest } from './utils/id';\nimport {\n\tbuildExtraViteConfig,\n\tvalidateInlineOptions,\n\tOptions,\n\tResolvedOptions,\n\tresolveOptions,\n\tpatchResolvedViteConfig,\n\tpreResolveOptions\n} from './utils/options';\nimport { VitePluginSvelteCache } from './utils/vite-plugin-svelte-cache';\n\nimport { ensureWatchedFile, setupWatchers } from './utils/watch';\nimport { resolveViaPackageJsonSvelte } from './utils/resolve';\nimport { PartialResolvedId } from 'rollup';\nimport { toRollupError } from './utils/error';\nimport { saveSvelteMetadata } from './utils/optimizer';\nimport { svelteInspector } from './ui/inspector/plugin';\n\ninterface PluginAPI {\n\t/**\n\t * must not be modified, should not be used outside of vite-plugin-svelte repo\n\t * @internal\n\t * @experimental\n\t */\n\toptions?: ResolvedOptions;\n\t// TODO expose compile cache here so other utility plugins can use it\n}\n\nexport function svelte(inlineOptions?: Partial<Options>): Plugin[] {\n\tif (process.env.DEBUG != null) {\n\t\tlog.setLevel('debug');\n\t}\n\tvalidateInlineOptions(inlineOptions);\n\tconst cache = new VitePluginSvelteCache();\n\t// updated in configResolved hook\n\tlet requestParser: IdParser;\n\tlet options: ResolvedOptions;\n\tlet viteConfig: ResolvedConfig;\n\t/* eslint-disable no-unused-vars */\n\tlet compileSvelte: (\n\t\tsvelteRequest: SvelteRequest,\n\t\tcode: string,\n\t\toptions: Partial<ResolvedOptions>\n\t) => Promise<CompileData>;\n\t/* eslint-enable no-unused-vars */\n\n\tlet resolvedSvelteSSR: Promise<PartialResolvedId | null>;\n\tconst api: PluginAPI = {};\n\tconst plugins: Plugin[] = [\n\t\t{\n\t\t\tname: 'vite-plugin-svelte',\n\t\t\t// make sure our resolver runs before vite internal resolver to resolve svelte field correctly\n\t\t\tenforce: 'pre',\n\t\t\tapi,\n\t\t\tasync config(config, configEnv): Promise<Partial<UserConfig>> {\n\t\t\t\t// setup logger\n\t\t\t\tif (process.env.DEBUG) {\n\t\t\t\t\tlog.setLevel('debug');\n\t\t\t\t} else if (config.logLevel) {\n\t\t\t\t\tlog.setLevel(config.logLevel);\n\t\t\t\t}\n\t\t\t\t// @ts-expect-error temporarily lend the options variable until fixed in configResolved\n\t\t\t\toptions = await preResolveOptions(inlineOptions, config, configEnv);\n\t\t\t\t// extra vite config\n\t\t\t\tconst extraViteConfig = buildExtraViteConfig(options, config);\n\t\t\t\tlog.debug('additional vite config', extraViteConfig);\n\t\t\t\treturn extraViteConfig;\n\t\t\t},\n\n\t\t\tasync configResolved(config) {\n\t\t\t\toptions = resolveOptions(options, config);\n\t\t\t\tpatchResolvedViteConfig(config, options);\n\t\t\t\trequestParser = buildIdParser(options);\n\t\t\t\tcompileSvelte = createCompileSvelte(options);\n\t\t\t\tviteConfig = config;\n\t\t\t\t// TODO deep clone to avoid mutability from outside?\n\t\t\t\tapi.options = options;\n\t\t\t\tlog.debug('resolved options', options);\n\t\t\t},\n\n\t\t\tasync buildStart() {\n\t\t\t\tif (!options.experimental?.prebundleSvelteLibraries) return;\n\t\t\t\tconst isSvelteMetadataChanged = await saveSvelteMetadata(viteConfig.cacheDir, options);\n\t\t\t\tif (isSvelteMetadataChanged) {\n\t\t\t\t\t// Force Vite to optimize again. Although we mutate the config here, it works because\n\t\t\t\t\t// Vite's optimizer runs after `buildStart()`.\n\t\t\t\t\t// TODO: verify this works in vite3\n\t\t\t\t\tviteConfig.optimizeDeps.force = true;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tconfigureServer(server) {\n\t\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\t\toptions.server = server;\n\t\t\t\tsetupWatchers(options, cache, requestParser);\n\t\t\t},\n\n\t\t\tload(id, opts) {\n\t\t\t\tconst ssr = !!opts?.ssr;\n\t\t\t\tconst svelteRequest = requestParser(id, !!ssr);\n\t\t\t\tif (svelteRequest) {\n\t\t\t\t\tconst { filename, query } = svelteRequest;\n\t\t\t\t\t// virtual css module\n\t\t\t\t\tif (query.svelte && query.type === 'style') {\n\t\t\t\t\t\tconst css = cache.getCSS(svelteRequest);\n\t\t\t\t\t\tif (css) {\n\t\t\t\t\t\t\tlog.debug(`load returns css for ${filename}`);\n\t\t\t\t\t\t\treturn css;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// prevent vite asset plugin from loading files as url that should be compiled in transform\n\t\t\t\t\tif (viteConfig.assetsInclude(filename)) {\n\t\t\t\t\t\tlog.debug(`load returns raw content for ${filename}`);\n\t\t\t\t\t\treturn fs.readFileSync(filename, 'utf-8');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tasync resolveId(importee, importer, opts) {\n\t\t\t\tconst ssr = !!opts?.ssr;\n\t\t\t\tconst svelteRequest = requestParser(importee, ssr);\n\t\t\t\tif (svelteRequest?.query.svelte) {\n\t\t\t\t\tif (svelteRequest.query.type === 'style') {\n\t\t\t\t\t\t// return cssId with root prefix so postcss pipeline of vite finds the directory correctly\n\t\t\t\t\t\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/14\n\t\t\t\t\t\tlog.debug(`resolveId resolved virtual css module ${svelteRequest.cssId}`);\n\t\t\t\t\t\treturn svelteRequest.cssId;\n\t\t\t\t\t}\n\t\t\t\t\tlog.debug(`resolveId resolved ${importee}`);\n\t\t\t\t\treturn importee; // query with svelte tag, an id we generated, no need for further analysis\n\t\t\t\t}\n\n\t\t\t\tif (ssr && importee === 'svelte') {\n\t\t\t\t\tif (!resolvedSvelteSSR) {\n\t\t\t\t\t\tresolvedSvelteSSR = this.resolve('svelte/ssr', undefined, { skipSelf: true }).then(\n\t\t\t\t\t\t\t(svelteSSR) => {\n\t\t\t\t\t\t\t\tlog.debug('resolved svelte to svelte/ssr');\n\t\t\t\t\t\t\t\treturn svelteSSR;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(err) => {\n\t\t\t\t\t\t\t\tlog.debug(\n\t\t\t\t\t\t\t\t\t'failed to resolve svelte to svelte/ssr. Update svelte to a version that exports it',\n\t\t\t\t\t\t\t\t\terr\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn null; // returning null here leads to svelte getting resolved regularly\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn resolvedSvelteSSR;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst resolved = resolveViaPackageJsonSvelte(importee, importer, cache);\n\t\t\t\t\tif (resolved) {\n\t\t\t\t\t\tlog.debug(\n\t\t\t\t\t\t\t`resolveId resolved ${resolved} via package.json svelte field of ${importee}`\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn resolved;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tlog.debug.once(\n\t\t\t\t\t\t`error trying to resolve ${importee} from ${importer} via package.json svelte field `,\n\t\t\t\t\t\te\n\t\t\t\t\t);\n\t\t\t\t\t// this error most likely happens due to non-svelte related importee/importers so swallow it here\n\t\t\t\t\t// in case it really way a svelte library, users will notice anyway. (lib not working due to failed resolve)\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tasync transform(code, id, opts) {\n\t\t\t\tconst ssr = !!opts?.ssr;\n\t\t\t\tconst svelteRequest = requestParser(id, ssr);\n\t\t\t\tif (!svelteRequest || svelteRequest.query.svelte) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet compileData;\n\t\t\t\ttry {\n\t\t\t\t\tcompileData = await compileSvelte(svelteRequest, code, options);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tcache.setError(svelteRequest, e);\n\t\t\t\t\tthrow toRollupError(e, options);\n\t\t\t\t}\n\t\t\t\tlogCompilerWarnings(svelteRequest, compileData.compiled.warnings, options);\n\t\t\t\tcache.update(compileData);\n\t\t\t\tif (compileData.dependencies?.length && options.server) {\n\t\t\t\t\tcompileData.dependencies.forEach((d) => {\n\t\t\t\t\t\tensureWatchedFile(options.server!.watcher, d, options.root);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tlog.debug(`transform returns compiled js for ${svelteRequest.filename}`);\n\t\t\t\treturn {\n\t\t\t\t\t...compileData.compiled.js,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tvite: {\n\t\t\t\t\t\t\tlang: compileData.lang\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\n\t\t\thandleHotUpdate(ctx: HmrContext): void | Promise<Array<ModuleNode> | void> {\n\t\t\t\tif (!options.hot || !options.emitCss) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst svelteRequest = requestParser(ctx.file, false, ctx.timestamp);\n\t\t\t\tif (svelteRequest) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn handleHotUpdate(compileSvelte, ctx, svelteRequest, cache, options);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthrow toRollupError(e, options);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t];\n\tplugins.push(svelteInspector());\n\treturn plugins.filter(Boolean);\n}\n\nexport { loadSvelteConfig } from './utils/load-svelte-config';\n\nexport {\n\tOptions,\n\tPluginOptions,\n\tSvelteOptions,\n\tPreprocessor,\n\tPreprocessorGroup,\n\tCompileOptions,\n\tCssHashGetter,\n\tArrayable,\n\tMarkupPreprocessor,\n\tModuleFormat,\n\tProcessed,\n\tWarning\n} from './utils/options';\n\nexport { SvelteWarningsMessage } from './utils/log';\n","/* eslint-disable no-unused-vars,no-console */\nimport { cyan, yellow, red } from 'kleur/colors';\nimport debug from 'debug';\nimport { ResolvedOptions, Warning } from './options';\nimport { SvelteRequest } from './id';\n\nconst levels: string[] = ['debug', 'info', 'warn', 'error', 'silent'];\nconst prefix = 'vite-plugin-svelte';\nconst loggers: { [key: string]: any } = {\n\tdebug: {\n\t\tlog: debug(`vite:${prefix}`),\n\t\tenabled: false,\n\t\tisDebug: true\n\t},\n\tinfo: {\n\t\tcolor: cyan,\n\t\tlog: console.log,\n\t\tenabled: true\n\t},\n\twarn: {\n\t\tcolor: yellow,\n\t\tlog: console.warn,\n\t\tenabled: true\n\t},\n\terror: {\n\t\tcolor: red,\n\t\tlog: console.error,\n\t\tenabled: true\n\t},\n\tsilent: {\n\t\tenabled: false\n\t}\n};\n\nlet _level: string = 'info';\nfunction setLevel(level: string) {\n\tif (level === _level) {\n\t\treturn;\n\t}\n\tconst levelIndex = levels.indexOf(level);\n\tif (levelIndex > -1) {\n\t\t_level = level;\n\t\tfor (let i = 0; i < levels.length; i++) {\n\t\t\tloggers[levels[i]].enabled = i >= levelIndex;\n\t\t}\n\t} else {\n\t\t_log(loggers.error, `invalid log level: ${level} `);\n\t}\n}\n\nfunction _log(logger: any, message: string, payload?: any) {\n\tif (!logger.enabled) {\n\t\treturn;\n\t}\n\tif (logger.isDebug) {\n\t\tpayload !== undefined ? logger.log(message, payload) : logger.log(message);\n\t} else {\n\t\tlogger.log(logger.color(`${new Date().toLocaleTimeString()} [${prefix}] ${message}`));\n\t\tif (payload) {\n\t\t\tlogger.log(payload);\n\t\t}\n\t}\n}\n\nexport interface LogFn {\n\t(message: string, payload?: any): void;\n\tenabled: boolean;\n\tonce: (message: string, payload?: any) => void;\n}\n\nfunction createLogger(level: string): LogFn {\n\tconst logger = loggers[level];\n\tconst logFn: LogFn = _log.bind(null, logger) as LogFn;\n\tconst logged = new Set<String>();\n\tconst once = function (message: string, payload?: any) {\n\t\tif (logged.has(message)) {\n\t\t\treturn;\n\t\t}\n\t\tlogged.add(message);\n\t\tlogFn.apply(null, [message, payload]);\n\t};\n\tObject.defineProperty(logFn, 'enabled', {\n\t\tget() {\n\t\t\treturn logger.enabled;\n\t\t}\n\t});\n\tObject.defineProperty(logFn, 'once', {\n\t\tget() {\n\t\t\treturn once;\n\t\t}\n\t});\n\treturn logFn;\n}\n\nexport const log = {\n\tdebug: createLogger('debug'),\n\tinfo: createLogger('info'),\n\twarn: createLogger('warn'),\n\terror: createLogger('error'),\n\tsetLevel\n};\n\nexport type SvelteWarningsMessage = {\n\tid: string;\n\tfilename: string;\n\tnormalizedFilename: string;\n\ttimestamp: number;\n\twarnings: Warning[]; // allWarnings filtered by warnings where onwarn did not call the default handler\n\tallWarnings: Warning[]; // includes warnings filtered by onwarn and our extra vite plugin svelte warnings\n\trawWarnings: Warning[]; // raw compiler output\n};\n\nexport function logCompilerWarnings(\n\tsvelteRequest: SvelteRequest,\n\twarnings: Warning[],\n\toptions: ResolvedOptions\n) {\n\tconst { emitCss, onwarn, isBuild } = options;\n\tconst sendViaWS = !isBuild && options.experimental?.sendWarningsToBrowser;\n\tlet warn = isBuild ? warnBuild : warnDev;\n\tconst handledByDefaultWarn: Warning[] = [];\n\tconst notIgnored = warnings?.filter((w) => !ignoreCompilerWarning(w, isBuild, emitCss));\n\tconst extra = buildExtraWarnings(warnings, isBuild);\n\tconst allWarnings = [...notIgnored, ...extra];\n\tif (sendViaWS) {\n\t\tconst _warn = warn;\n\t\twarn = (w: Warning) => {\n\t\t\thandledByDefaultWarn.push(w);\n\t\t\t_warn(w);\n\t\t};\n\t}\n\tallWarnings.forEach((warning) => {\n\t\tif (onwarn) {\n\t\t\tonwarn(warning, warn);\n\t\t} else {\n\t\t\twarn(warning);\n\t\t}\n\t});\n\tif (sendViaWS) {\n\t\tconst message: SvelteWarningsMessage = {\n\t\t\tid: svelteRequest.id,\n\t\t\tfilename: svelteRequest.filename,\n\t\t\tnormalizedFilename: svelteRequest.normalizedFilename,\n\t\t\ttimestamp: svelteRequest.timestamp,\n\t\t\twarnings: handledByDefaultWarn, // allWarnings filtered by warnings where onwarn did not call the default handler\n\t\t\tallWarnings, // includes warnings filtered by onwarn and our extra vite plugin svelte warnings\n\t\t\trawWarnings: warnings // raw compiler output\n\t\t};\n\t\tlog.debug(`sending svelte:warnings message for ${svelteRequest.normalizedFilename}`);\n\t\toptions.server?.ws?.send('svelte:warnings', message);\n\t}\n}\n\nfunction ignoreCompilerWarning(\n\twarning: Warning,\n\tisBuild: boolean,\n\temitCss: boolean | undefined\n): boolean {\n\treturn (\n\t\t(!emitCss && warning.code === 'css-unused-selector') || // same as rollup-plugin-svelte\n\t\t(!isBuild && isNoScopableElementWarning(warning))\n\t);\n}\n\nfunction isNoScopableElementWarning(warning: Warning) {\n\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/153\n\treturn warning.code === 'css-unused-selector' && warning.message.includes('\"*\"');\n}\n\nfunction buildExtraWarnings(warnings: Warning[], isBuild: boolean): Warning[] {\n\tconst extraWarnings = [];\n\tif (!isBuild) {\n\t\tconst noScopableElementWarnings = warnings.filter((w) => isNoScopableElementWarning(w));\n\t\tif (noScopableElementWarnings.length > 0) {\n\t\t\t// in case there are multiple, use last one as that is the one caused by our *{} rule\n\t\t\tconst noScopableElementWarning =\n\t\t\t\tnoScopableElementWarnings[noScopableElementWarnings.length - 1];\n\t\t\textraWarnings.push({\n\t\t\t\t...noScopableElementWarning,\n\t\t\t\tcode: 'vite-plugin-svelte-css-no-scopable-elements',\n\t\t\t\tmessage: `No scopable elements found in template. If you're using global styles in the style tag, you should move it into an external stylesheet file and import it in JS. See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#where-should-i-put-my-global-styles.`\n\t\t\t});\n\t\t}\n\t}\n\treturn extraWarnings;\n}\n\nfunction warnDev(w: Warning) {\n\tlog.info.enabled && log.info(buildExtendedLogMessage(w));\n}\n\nfunction warnBuild(w: Warning) {\n\tlog.warn.enabled && log.warn(buildExtendedLogMessage(w), w.frame);\n}\n\nexport function buildExtendedLogMessage(w: Warning) {\n\tconst parts = [];\n\tif (w.filename) {\n\t\tparts.push(w.filename);\n\t}\n\tif (w.start) {\n\t\tparts.push(':', w.start.line, ':', w.start.column);\n\t}\n\tif (w.message) {\n\t\tif (parts.length > 0) {\n\t\t\tparts.push(' ');\n\t\t}\n\t\tparts.push(w.message);\n\t}\n\treturn parts.join('');\n}\n","import { ModuleNode, HmrContext } from 'vite';\nimport { Code, CompileData } from './utils/compile';\nimport { log, logCompilerWarnings } from './utils/log';\nimport { SvelteRequest } from './utils/id';\nimport { VitePluginSvelteCache } from './utils/vite-plugin-svelte-cache';\nimport { ResolvedOptions } from './utils/options';\n\n/**\n * Vite-specific HMR handling\n */\nexport async function handleHotUpdate(\n\tcompileSvelte: Function,\n\tctx: HmrContext,\n\tsvelteRequest: SvelteRequest,\n\tcache: VitePluginSvelteCache,\n\toptions: ResolvedOptions\n): Promise<ModuleNode[] | void> {\n\tif (!cache.has(svelteRequest)) {\n\t\t// file hasn't been requested yet (e.g. async component)\n\t\tlog.debug(`handleHotUpdate called before initial transform for ${svelteRequest.id}`);\n\t\treturn;\n\t}\n\tconst { read, server } = ctx;\n\n\tconst cachedJS = cache.getJS(svelteRequest);\n\tconst cachedCss = cache.getCSS(svelteRequest);\n\n\tconst content = await read();\n\tlet compileData: CompileData;\n\ttry {\n\t\tcompileData = await compileSvelte(svelteRequest, content, options);\n\t\tcache.update(compileData);\n\t} catch (e) {\n\t\tcache.setError(svelteRequest, e);\n\t\tthrow e;\n\t}\n\n\tconst affectedModules = new Set<ModuleNode | undefined>();\n\n\tconst cssModule = server.moduleGraph.getModuleById(svelteRequest.cssId);\n\tconst mainModule = server.moduleGraph.getModuleById(svelteRequest.id);\n\tconst cssUpdated = cssModule && cssChanged(cachedCss, compileData.compiled.css);\n\tif (cssUpdated) {\n\t\tlog.debug(`handleHotUpdate css changed for ${svelteRequest.cssId}`);\n\t\taffectedModules.add(cssModule);\n\t}\n\tconst jsUpdated =\n\t\tmainModule && jsChanged(cachedJS, compileData.compiled.js, svelteRequest.filename);\n\tif (jsUpdated) {\n\t\tlog.debug(`handleHotUpdate js changed for ${svelteRequest.id}`);\n\t\taffectedModules.add(mainModule);\n\t}\n\n\tif (!jsUpdated) {\n\t\t// transform won't be called, log warnings here\n\t\tlogCompilerWarnings(svelteRequest, compileData.compiled.warnings, options);\n\t}\n\n\tconst result = [...affectedModules].filter(Boolean) as ModuleNode[];\n\n\t// TODO is this enough? see also: https://github.com/vitejs/vite/issues/2274\n\tconst ssrModulesToInvalidate = result.filter((m) => !!m.ssrTransformResult);\n\tif (ssrModulesToInvalidate.length > 0) {\n\t\tlog.debug(`invalidating modules ${ssrModulesToInvalidate.map((m) => m.id).join(', ')}`);\n\t\tssrModulesToInvalidate.forEach((moduleNode) => server.moduleGraph.invalidateModule(moduleNode));\n\t}\n\tif (result.length > 0) {\n\t\tlog.debug(\n\t\t\t`handleHotUpdate for ${svelteRequest.id} result: ${result.map((m) => m.id).join(', ')}`\n\t\t);\n\t}\n\treturn result;\n}\n\nfunction cssChanged(prev?: Code, next?: Code): boolean {\n\treturn !isCodeEqual(prev?.code, next?.code);\n}\n\nfunction jsChanged(prev?: Code, next?: Code, filename?: string): boolean {\n\tconst prevJs = prev?.code;\n\tconst nextJs = next?.code;\n\tconst isStrictEqual = isCodeEqual(prevJs, nextJs);\n\tif (isStrictEqual) {\n\t\treturn false;\n\t}\n\tconst isLooseEqual = isCodeEqual(normalizeJsCode(prevJs), normalizeJsCode(nextJs));\n\tif (!isStrictEqual && isLooseEqual) {\n\t\tlog.warn(\n\t\t\t`ignoring compiler output js change for ${filename} as it is equal to previous output after normalization`\n\t\t);\n\t}\n\treturn !isLooseEqual;\n}\n\nfunction isCodeEqual(prev?: string, next?: string): boolean {\n\tif (!prev && !next) {\n\t\treturn true;\n\t}\n\tif ((!prev && next) || (prev && !next)) {\n\t\treturn false;\n\t}\n\treturn prev === next;\n}\n\n/**\n * remove code that only changes metadata and does not require a js update for the component to keep working\n *\n * 1) add_location() calls. These add location metadata to elements, only useful for tooling like sapper studio\n * 2) ... maybe more (or less) in the future\n * @param code\n */\nfunction normalizeJsCode(code?: string): string | undefined {\n\tif (!code) {\n\t\treturn code;\n\t}\n\treturn code.replace(/\\s*\\badd_location\\s*\\([^)]*\\)\\s*;?/g, '');\n}\n","import { CompileOptions, ResolvedOptions } from './options';\nimport { compile, preprocess, walk } from 'svelte/compiler';\n// @ts-ignore\nimport { createMakeHot } from 'svelte-hmr';\nimport { SvelteRequest } from './id';\nimport { safeBase64Hash } from './hash';\nimport { log } from './log';\n\nconst scriptLangRE = /<script [^>]*lang=[\"']?([^\"' >]+)[\"']?[^>]*>/;\n\nconst _createCompileSvelte = (makeHot: Function) =>\n\tasync function compileSvelte(\n\t\tsvelteRequest: SvelteRequest,\n\t\tcode: string,\n\t\toptions: Partial<ResolvedOptions>\n\t): Promise<CompileData> {\n\t\tconst { filename, normalizedFilename, cssId, ssr } = svelteRequest;\n\t\tconst { emitCss = true } = options;\n\t\tconst dependencies = [];\n\n\t\tconst compileOptions: CompileOptions = {\n\t\t\t...options.compilerOptions,\n\t\t\tfilename,\n\t\t\tgenerate: ssr ? 'ssr' : 'dom',\n\t\t\tformat: 'esm'\n\t\t};\n\t\tif (options.hot && options.emitCss) {\n\t\t\tconst hash = `s-${safeBase64Hash(normalizedFilename)}`;\n\t\t\tlog.debug(`setting cssHash ${hash} for ${normalizedFilename}`);\n\t\t\tcompileOptions.cssHash = () => hash;\n\t\t}\n\t\tif (ssr && compileOptions.enableSourcemap !== false) {\n\t\t\tif (typeof compileOptions.enableSourcemap === 'object') {\n\t\t\t\tcompileOptions.enableSourcemap.css = false;\n\t\t\t} else {\n\t\t\t\tcompileOptions.enableSourcemap = { js: true, css: false };\n\t\t\t}\n\t\t}\n\n\t\tlet preprocessed;\n\n\t\tif (options.preprocess) {\n\t\t\ttry {\n\t\t\t\tpreprocessed = await preprocess(code, options.preprocess, { filename });\n\t\t\t} catch (e) {\n\t\t\t\te.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`;\n\t\t\t\tthrow e;\n\t\t\t}\n\n\t\t\tif (preprocessed.dependencies) dependencies.push(...preprocessed.dependencies);\n\t\t\tif (preprocessed.map) compileOptions.sourcemap = preprocessed.map;\n\t\t}\n\t\tconst finalCode = preprocessed ? preprocessed.code : code;\n\t\tconst dynamicCompileOptions = await options.experimental?.dynamicCompileOptions?.({\n\t\t\tfilename,\n\t\t\tcode: finalCode,\n\t\t\tcompileOptions\n\t\t});\n\t\tif (dynamicCompileOptions && log.debug.enabled) {\n\t\t\tlog.debug(\n\t\t\t\t`dynamic compile options for ${filename}: ${JSON.stringify(dynamicCompileOptions)}`\n\t\t\t);\n\t\t}\n\t\tconst finalCompileOptions = dynamicCompileOptions\n\t\t\t? {\n\t\t\t\t\t...compileOptions,\n\t\t\t\t\t...dynamicCompileOptions\n\t\t\t }\n\t\t\t: compileOptions;\n\t\tconst compiled = compile(finalCode, finalCompileOptions);\n\n\t\tif (emitCss && compiled.css.code) {\n\t\t\t// TODO properly update sourcemap?\n\t\t\tcompiled.js.code += `\\nimport ${JSON.stringify(cssId)};\\n`;\n\t\t}\n\n\t\t// only apply hmr when not in ssr context and hot options are set\n\t\tif (!ssr && makeHot) {\n\t\t\tcompiled.js.code = makeHot({\n\t\t\t\tid: filename,\n\t\t\t\tcompiledCode: compiled.js.code,\n\t\t\t\thotOptions: options.hot,\n\t\t\t\tcompiled,\n\t\t\t\toriginalCode: code,\n\t\t\t\tcompileOptions: finalCompileOptions\n\t\t\t});\n\t\t}\n\n\t\tcompiled.js.dependencies = dependencies;\n\n\t\treturn {\n\t\t\tfilename,\n\t\t\tnormalizedFilename,\n\t\t\tlang: code.match(scriptLangRE)?.[1] || 'js',\n\t\t\t// @ts-ignore\n\t\t\tcompiled,\n\t\t\tssr,\n\t\t\tdependencies\n\t\t};\n\t};\n\nfunction buildMakeHot(options: ResolvedOptions) {\n\tconst needsMakeHot = options.hot !== false && options.isServe && !options.isProduction;\n\tif (needsMakeHot) {\n\t\t// @ts-ignore\n\t\tconst hotApi = options?.hot?.hotApi;\n\t\t// @ts-ignore\n\t\tconst adapter = options?.hot?.adapter;\n\t\treturn createMakeHot({\n\t\t\twalk,\n\t\t\thotApi,\n\t\t\tadapter,\n\t\t\thotOptions: { noOverlay: true, ...(options.hot as object) }\n\t\t});\n\t}\n}\n\nexport function createCompileSvelte(options: ResolvedOptions) {\n\tconst makeHot = buildMakeHot(options);\n\treturn _createCompileSvelte(makeHot);\n}\n\nexport interface Code {\n\tcode: string;\n\tmap?: any;\n\tdependencies?: any[];\n}\n\nexport interface Compiled {\n\tjs: Code;\n\tcss: Code;\n\tast: any; // TODO type\n\twarnings: any[]; // TODO type\n\tvars: {\n\t\tname: string;\n\t\texport_name: string;\n\t\tinjected: boolean;\n\t\tmodule: boolean;\n\t\tmutated: boolean;\n\t\treassigned: boolean;\n\t\treferenced: boolean;\n\t\twritable: boolean;\n\t\treferenced_from_script: boolean;\n\t}[];\n\tstats: {\n\t\ttimings: {\n\t\t\ttotal: number;\n\t\t};\n\t};\n}\n\nexport interface CompileData {\n\tfilename: string;\n\tnormalizedFilename: string;\n\tlang: string;\n\tcompiled: Compiled;\n\tssr: boolean | undefined;\n\tdependencies: string[];\n}\n","import * as crypto from 'crypto';\n\nconst hashes = Object.create(null);\n\n//TODO shorter?\nconst hash_length = 12;\n\nexport function safeBase64Hash(input: string) {\n\tif (hashes[input]) {\n\t\treturn hashes[input];\n\t}\n\t//TODO if performance really matters, use a faster one like xx-hash etc.\n\t// should be evenly distributed because short input length and similarities in paths could cause collisions otherwise\n\t// OR DON'T USE A HASH AT ALL, what about a simple counter?\n\tconst md5 = crypto.createHash('md5');\n\tmd5.update(input);\n\tconst hash = toSafe(md5.digest('base64')).slice(0, hash_length);\n\thashes[input] = hash;\n\treturn hash;\n}\n\nconst replacements: { [key: string]: string } = {\n\t'+': '-',\n\t'/': '_',\n\t'=': ''\n};\n\nconst replaceRE = new RegExp(`[${Object.keys(replacements).join('')}]`, 'g');\n\nfunction toSafe(base64: string) {\n\treturn base64.replace(replaceRE, (x) => replacements[x]);\n}\n","/* eslint-disable no-unused-vars */\nimport { createFilter } from '@rollup/pluginutils';\nimport { Arrayable, ResolvedOptions } from './options';\nimport { normalizePath } from 'vite';\nimport * as fs from 'fs';\n\nconst VITE_FS_PREFIX = '/@fs/';\nconst IS_WINDOWS = process.platform === 'win32';\n\nexport type SvelteQueryTypes = 'style' | 'script';\n\nexport interface RequestQuery {\n\t// our own\n\tsvelte?: boolean;\n\ttype?: SvelteQueryTypes;\n\t// vite specific\n\turl?: boolean;\n\traw?: boolean;\n}\n\nexport interface SvelteRequest {\n\tid: string;\n\tcssId: string;\n\tfilename: string;\n\tnormalizedFilename: string;\n\tquery: RequestQuery;\n\ttimestamp: number;\n\tssr: boolean;\n}\n\nfunction splitId(id: string) {\n\tconst parts = id.split(`?`, 2);\n\tconst filename = parts[0];\n\tconst rawQuery = parts[1];\n\treturn { filename, rawQuery };\n}\n\nfunction parseToSvelteRequest(\n\tid: string,\n\tfilename: string,\n\trawQuery: string,\n\troot: string,\n\ttimestamp: number,\n\tssr: boolean\n): SvelteRequest | undefined {\n\tconst query = parseRequestQuery(rawQuery);\n\tif (query.url || query.raw) {\n\t\t// skip requests with special vite tags\n\t\treturn;\n\t}\n\tconst normalizedFilename = normalize(filename, root);\n\tconst cssId = createVirtualImportId(filename, root, 'style');\n\n\treturn {\n\t\tid,\n\t\tfilename,\n\t\tnormalizedFilename,\n\t\tcssId,\n\t\tquery,\n\t\ttimestamp,\n\t\tssr\n\t};\n}\n\nfunction createVirtualImportId(filename: string, root: string, type: SvelteQueryTypes) {\n\tconst parts = ['svelte', `type=${type}`];\n\tif (type === 'style') {\n\t\tparts.push('lang.css');\n\t}\n\tif (existsInRoot(filename, root)) {\n\t\tfilename = root + filename;\n\t} else if (filename.startsWith(VITE_FS_PREFIX)) {\n\t\tfilename = IS_WINDOWS\n\t\t\t? filename.slice(VITE_FS_PREFIX.length) // remove /@fs/ from /@fs/C:/...\n\t\t\t: filename.slice(VITE_FS_PREFIX.length - 1); // remove /@fs from /@fs/home/user\n\t}\n\t// return same virtual id format as vite-plugin-vue eg ...App.svelte?svelte&type=style&lang.css\n\treturn `${filename}?${parts.join('&')}`;\n}\n\nfunction parseRequestQuery(rawQuery: string): RequestQuery {\n\tconst query = Object.fromEntries(new URLSearchParams(rawQuery));\n\tfor (const key in query) {\n\t\tif (query[key] === '') {\n\t\t\t// @ts-ignore\n\t\t\tquery[key] = true;\n\t\t}\n\t}\n\treturn query as RequestQuery;\n}\n\n/**\n * posixify and remove root at start\n *\n * @param filename\n * @param normalizedRoot\n */\nfunction normalize(filename: string, normalizedRoot: string) {\n\treturn stripRoot(normalizePath(filename), normalizedRoot);\n}\n\nfunction existsInRoot(filename: string, root: string) {\n\tif (filename.startsWith(VITE_FS_PREFIX)) {\n\t\treturn false; // vite already tagged it as out of root\n\t}\n\treturn fs.existsSync(root + filename);\n}\n\nfunction stripRoot(normalizedFilename: string, normalizedRoot: string) {\n\treturn normalizedFilename.startsWith(normalizedRoot + '/')\n\t\t? normalizedFilename.slice(normalizedRoot.length)\n\t\t: normalizedFilename;\n}\n\nfunction buildFilter(\n\tinclude: Arrayable<string> | undefined,\n\texclude: Arrayable<string> | undefined,\n\textensions: string[]\n): (filename: string) => boolean {\n\tconst rollupFilter = createFilter(include, exclude);\n\treturn (filename) => rollupFilter(filename) && extensions.some((ext) => filename.endsWith(ext));\n}\n\nexport type IdParser = (id: string, ssr: boolean, timestamp?: number) => SvelteRequest | undefined;\nexport function buildIdParser(options: ResolvedOptions): IdParser {\n\tconst { include, exclude, extensions, root } = options;\n\tconst normalizedRoot = normalizePath(root);\n\tconst filter = buildFilter(include, exclude, extensions!);\n\treturn (id, ssr, timestamp = Date.now()) => {\n\t\tconst { filename, rawQuery } = splitId(id);\n\t\tif (filter(filename)) {\n\t\t\treturn parseToSvelteRequest(id, filename, rawQuery, normalizedRoot, timestamp, ssr);\n\t\t}\n\t};\n}\n","/* eslint-disable no-unused-vars */\nimport {\n\tConfigEnv,\n\tDepOptimizationOptions,\n\tResolvedConfig,\n\tUserConfig,\n\tViteDevServer,\n\tnormalizePath\n} from 'vite';\nimport { log } from './log';\nimport { loadSvelteConfig } from './load-svelte-config';\nimport { SVELTE_HMR_IMPORTS, SVELTE_IMPORTS, SVELTE_RESOLVE_MAIN_FIELDS } from './constants';\n// eslint-disable-next-line node/no-missing-import\nimport type { CompileOptions, Warning } from 'svelte/types/compiler/interfaces';\nimport type {\n\tMarkupPreprocessor,\n\tPreprocessor,\n\tPreprocessorGroup,\n\tProcessed\n\t// eslint-disable-next-line node/no-missing-import\n} from 'svelte/types/compiler/preprocess';\n\nimport path from 'path';\nimport { findRootSvelteDependencies, needsOptimization, SvelteDependency } from './dependencies';\nimport { createRequire } from 'module';\nimport { esbuildSveltePlugin, facadeEsbuildSveltePluginName } from './esbuild';\nimport { addExtraPreprocessors } from './preprocess';\nimport deepmerge from 'deepmerge';\n\nconst allowedPluginOptions = new Set([\n\t'include',\n\t'exclude',\n\t'emitCss',\n\t'hot',\n\t'ignorePluginPreprocessors',\n\t'disableDependencyReinclusion',\n\t'experimental'\n]);\n\nconst knownRootOptions = new Set(['extensions', 'compilerOptions', 'preprocess', 'onwarn']);\n\nconst allowedInlineOptions = new Set([\n\t'configFile',\n\t'kit', // only for internal use by sveltekit\n\t...allowedPluginOptions,\n\t...knownRootOptions\n]);\n\nexport function validateInlineOptions(inlineOptions?: Partial<Options>) {\n\tconst invalidKeys = Object.keys(inlineOptions || {}).filter(\n\t\t(key) => !allowedInlineOptions.has(key)\n\t);\n\tif (invalidKeys.length) {\n\t\tlog.warn(`invalid plugin options \"${invalidKeys.join(', ')}\" in inline config`, inlineOptions);\n\t}\n}\n\nfunction convertPluginOptions(config?: Partial<SvelteOptions>): Partial<Options> | undefined {\n\tif (!config) {\n\t\treturn;\n\t}\n\tconst invalidRootOptions = Object.keys(config).filter((key) => allowedPluginOptions.has(key));\n\tif (invalidRootOptions.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid options in svelte config. Move the following options into 'vitePlugin:{...}': ${invalidRootOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t}\n\tif (!config.vitePlugin) {\n\t\treturn config;\n\t}\n\tconst pluginOptions = config.vitePlugin;\n\tconst pluginOptionKeys = Object.keys(pluginOptions);\n\n\tconst rootOptionsInPluginOptions = pluginOptionKeys.filter((key) => knownRootOptions.has(key));\n\tif (rootOptionsInPluginOptions.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid options in svelte config under vitePlugin:{...}', move them to the config root : ${rootOptionsInPluginOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t}\n\tconst duplicateOptions = pluginOptionKeys.filter((key) =>\n\t\tObject.prototype.hasOwnProperty.call(config, key)\n\t);\n\tif (duplicateOptions.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid duplicate options in svelte config under vitePlugin:{...}', they are defined in root too and must only exist once: ${duplicateOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t}\n\tconst unknownPluginOptions = pluginOptionKeys.filter((key) => !allowedPluginOptions.has(key));\n\tif (unknownPluginOptions.length > 0) {\n\t\tlog.warn(\n\t\t\t`ignoring unknown plugin options in svelte config under vitePlugin:{...}: ${unknownPluginOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t\tunknownPluginOptions.forEach((unkownOption) => {\n\t\t\t// @ts-ignore\n\t\t\tdelete pluginOptions[unkownOption];\n\t\t});\n\t}\n\n\tconst result: Options = {\n\t\t...config,\n\t\t...pluginOptions\n\t};\n\t// @ts-expect-error it exists\n\tdelete result.vitePlugin;\n\n\treturn result;\n}\n\n// used in config phase, merges the default options, svelte config, and inline options\nexport async function preResolveOptions(\n\tinlineOptions: Partial<Options> = {},\n\tviteUserConfig: UserConfig,\n\tviteEnv: ConfigEnv\n): Promise<PreResolvedOptions> {\n\tconst viteConfigWithResolvedRoot: UserConfig = {\n\t\t...viteUserConfig,\n\t\troot: resolveViteRoot(viteUserConfig)\n\t};\n\tconst defaultOptions: Partial<Options> = {\n\t\textensions: ['.svelte'],\n\t\temitCss: true\n\t};\n\tconst svelteConfig = convertPluginOptions(\n\t\tawait loadSvelteConfig(viteConfigWithResolvedRoot, inlineOptions)\n\t);\n\n\tconst extraOptions: Partial<PreResolvedOptions> = {\n\t\troot: viteConfigWithResolvedRoot.root!,\n\t\tisBuild: viteEnv.command === 'build',\n\t\tisServe: viteEnv.command === 'serve',\n\t\tisDebug: process.env.DEBUG != null\n\t};\n\tconst merged = mergeConfigs<Partial<PreResolvedOptions> | undefined>(\n\t\tdefaultOptions,\n\t\tsvelteConfig,\n\t\tinlineOptions,\n\t\textraOptions\n\t);\n\t// configFile of svelteConfig contains the absolute path it was loaded from,\n\t// prefer it over the possibly relative inline path\n\tif (svelteConfig?.configFile) {\n\t\tmerged.configFile = svelteConfig.configFile;\n\t}\n\treturn merged;\n}\n\nfunction mergeConfigs<T>(...configs: T[]): ResolvedOptions {\n\tlet result = {};\n\tfor (const config of configs.filter(Boolean)) {\n\t\tresult = deepmerge<T>(result, config, {\n\t\t\t// replace arrays\n\t\t\tarrayMerge: (target: any[], source: any[]) => source ?? target\n\t\t});\n\t}\n\treturn result as ResolvedOptions;\n}\n\n// used in configResolved phase, merges a contextual default config, pre-resolved options, and some preprocessors.\n// also validates the final config.\nexport function resolveOptions(\n\tpreResolveOptions: PreResolvedOptions,\n\tviteConfig: ResolvedConfig\n): ResolvedOptions {\n\tconst defaultOptions: Partial<Options> = {\n\t\thot: viteConfig.isProduction ? false : { injectCss: !preResolveOptions.emitCss },\n\t\tcompilerOptions: {\n\t\t\tcss: !preResolveOptions.emitCss,\n\t\t\tdev: !viteConfig.isProduction\n\t\t}\n\t};\n\tconst extraOptions: Partial<ResolvedOptions> = {\n\t\troot: viteConfig.root,\n\t\tisProduction: viteConfig.isProduction\n\t};\n\tconst merged: ResolvedOptions = mergeConfigs(defaultOptions, preResolveOptions, extraOptions);\n\n\tremoveIgnoredOptions(merged);\n\taddSvelteKitOptions(merged);\n\taddExtraPreprocessors(merged, viteConfig);\n\tenforceOptionsForHmr(merged);\n\tenforceOptionsForProduction(merged);\n\treturn merged;\n}\n\nfunction enforceOptionsForHmr(options: ResolvedOptions) {\n\tif (options.hot) {\n\t\tif (!options.compilerOptions.dev) {\n\t\t\tlog.warn('hmr is enabled but compilerOptions.dev is false, forcing it to true');\n\t\t\toptions.compilerOptions.dev = true;\n\t\t}\n\t\tif (options.emitCss) {\n\t\t\tif (options.hot !== true && options.hot.injectCss) {\n\t\t\t\tlog.warn('hmr and emitCss are enabled but hot.injectCss is true, forcing it to false');\n\t\t\t\toptions.hot.injectCss = false;\n\t\t\t}\n\t\t\tif (options.compilerOptions.css) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t'hmr and emitCss are enabled but compilerOptions.css is true, forcing it to false'\n\t\t\t\t);\n\t\t\t\toptions.compilerOptions.css = false;\n\t\t\t}\n\t\t} else {\n\t\t\tif (options.hot === true || !options.hot.injectCss) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t'hmr with emitCss disabled requires option hot.injectCss to be enabled, forcing it to true'\n\t\t\t\t);\n\t\t\t\tif (options.hot === true) {\n\t\t\t\t\toptions.hot = { injectCss: true };\n\t\t\t\t} else {\n\t\t\t\t\toptions.hot.injectCss = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!options.compilerOptions.css) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t'hmr with emitCss disabled requires compilerOptions.css to be enabled, forcing it to true'\n\t\t\t\t);\n\t\t\t\toptions.compilerOptions.css = true;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction enforceOptionsForProduction(options: ResolvedOptions) {\n\tif (options.isProduction) {\n\t\tif (options.hot) {\n\t\t\tlog.warn('options.hot is enabled but does not work on production build, forcing it to false');\n\t\t\toptions.hot = false;\n\t\t}\n\t\tif (options.compilerOptions.dev) {\n\t\t\tlog.warn(\n\t\t\t\t'you are building for production but compilerOptions.dev is true, forcing it to false'\n\t\t\t);\n\t\t\toptions.compilerOptions.dev = false;\n\t\t}\n\t}\n}\n\nfunction removeIgnoredOptions(options: ResolvedOptions) {\n\tconst ignoredCompilerOptions = ['generate', 'format', 'filename'];\n\tif (options.hot && options.emitCss) {\n\t\tignoredCompilerOptions.push('cssHash');\n\t}\n\tconst passedCompilerOptions = Object.keys(options.compilerOptions || {});\n\tconst passedIgnored = passedCompilerOptions.filter((o) => ignoredCompilerOptions.includes(o));\n\tif (passedIgnored.length) {\n\t\tlog.warn(\n\t\t\t`The following Svelte compilerOptions are controlled by vite-plugin-svelte and essential to its functionality. User-specified values are ignored. Please remove them from your configuration: ${passedIgnored.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t\tpassedIgnored.forEach((ignored) => {\n\t\t\t// @ts-expect-error string access\n\t\t\tdelete options.compilerOptions[ignored];\n\t\t});\n\t}\n}\n\n// some SvelteKit options need compilerOptions to work, so set them here.\nfunction addSvelteKitOptions(options: ResolvedOptions) {\n\t// @ts-expect-error kit is not typed to avoid dependency on sveltekit\n\tif (options?.kit != null) {\n\t\t// @ts-expect-error kit is not typed to avoid dependency on sveltekit\n\t\tconst kit_browser_hydrate = options.kit.browser?.hydrate;\n\t\tconst hydratable = kit_browser_hydrate !== false;\n\t\tif (\n\t\t\toptions.compilerOptions.hydratable != null &&\n\t\t\toptions.compilerOptions.hydratable !== hydratable\n\t\t) {\n\t\t\tlog.warn(\n\t\t\t\t`Conflicting values \"compilerOptions.hydratable: ${options.compilerOptions.hydratable}\" and \"kit.browser.hydrate: ${kit_browser_hydrate}\" in your svelte config. You should remove \"compilerOptions.hydratable\".`\n\t\t\t);\n\t\t}\n\t\tlog.debug(`Setting compilerOptions.hydratable: ${hydratable} for SvelteKit`);\n\t\toptions.compilerOptions.hydratable = hydratable;\n\t}\n}\n\n// vite passes unresolved `root`option to config hook but we need the resolved value, so do it here\n// https://github.com/sveltejs/vite-plugin-svelte/issues/113\n// https://github.com/vitejs/vite/blob/43c957de8a99bb326afd732c962f42127b0a4d1e/packages/vite/src/node/config.ts#L293\nfunction resolveViteRoot(viteConfig: UserConfig): string | undefined {\n\treturn normalizePath(viteConfig.root ? path.resolve(viteConfig.root) : process.cwd());\n}\n\nexport function buildExtraViteConfig(\n\toptions: PreResolvedOptions,\n\tconfig: UserConfig\n): Partial<UserConfig> {\n\t// extra handling for svelte dependencies in the project\n\tconst svelteDeps = findRootSvelteDependencies(options.root);\n\tconst extraViteConfig: Partial<UserConfig> = {\n\t\tresolve: {\n\t\t\tmainFields: [...SVELTE_RESOLVE_MAIN_FIELDS],\n\t\t\tdedupe: [...SVELTE_IMPORTS, ...SVELTE_HMR_IMPORTS]\n\t\t}\n\t\t// this option is still awaiting a PR in vite to be supported\n\t\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/60\n\t\t// @ts-ignore\n\t\t// knownJsSrcExtensions: options.extensions\n\t};\n\n\textraViteConfig.optimizeDeps = buildOptimizeDepsForSvelte(\n\t\tsvelteDeps,\n\t\toptions,\n\t\tconfig.optimizeDeps\n\t);\n\n\tif (options.experimental?.prebundleSvelteLibraries) {\n\t\textraViteConfig.optimizeDeps = {\n\t\t\t...extraViteConfig.optimizeDeps,\n\t\t\t// Experimental Vite API to allow these extensions to be scanned and prebundled\n\t\t\t// @ts-ignore\n\t\t\textensions: options.extensions ?? ['.svelte'],\n\t\t\t// Add esbuild plugin to prebundle Svelte files.\n\t\t\t// Currently a placeholder as more information is needed after Vite config is resolved,\n\t\t\t// the real Svelte plugin is added in `patchResolvedViteConfig()`\n\t\t\tesbuildOptions: {\n\t\t\t\tplugins: [{ name: facadeEsbuildSveltePluginName, setup: () => {} }]\n\t\t\t}\n\t\t};\n\t}\n\n\t// @ts-ignore\n\textraViteConfig.ssr = buildSSROptionsForSvelte(svelteDeps, options, config, extraViteConfig);\n\n\treturn extraViteConfig;\n}\n\nfunction buildOptimizeDepsForSvelte(\n\tsvelteDeps: SvelteDependency[],\n\toptions: PreResolvedOptions,\n\toptimizeDeps?: DepOptimizationOptions\n): DepOptimizationOptions {\n\t// include svelte imports for optimization unless explicitly excluded\n\tconst include: string[] = [];\n\tconst exclude: string[] = ['svelte-hmr'];\n\tconst isIncluded = (dep: string) => include.includes(dep) || optimizeDeps?.include?.includes(dep);\n\tconst isExcluded = (dep: string) => {\n\t\treturn (\n\t\t\texclude.includes(dep) ||\n\t\t\t// vite optimizeDeps.exclude works for subpackages too\n\t\t\t// see https://github.com/vitejs/vite/blob/c87763c1418d1ba876eae13d139eba83ac6f28b2/packages/vite/src/node/optimizer/scan.ts#L293\n\t\t\toptimizeDeps?.exclude?.some((id: string) => dep === id || id.startsWith(`${dep}/`))\n\t\t);\n\t};\n\tif (!isExcluded('svelte')) {\n\t\tconst svelteImportsToInclude = SVELTE_IMPORTS.filter((x) => x !== 'svelte/ssr'); // not used on clientside\n\t\tlog.debug(\n\t\t\t`adding bare svelte packages to optimizeDeps.include: ${svelteImportsToInclude.join(', ')} `\n\t\t);\n\t\tinclude.push(...svelteImportsToInclude.filter((x) => !isIncluded(x)));\n\t} else {\n\t\tlog.debug('\"svelte\" is excluded in optimizeDeps.exclude, skipped adding it to include.');\n\t}\n\n\t// If we prebundle svelte libraries, we can skip the whole prebundling dance below\n\tif (options.experimental?.prebundleSvelteLibraries) {\n\t\treturn { include, exclude };\n\t}\n\n\t// only svelte component libraries needs to be processed for optimizeDeps, js libraries work fine\n\tsvelteDeps = svelteDeps.filter((dep) => dep.type === 'component-library');\n\n\tconst svelteDepsToExclude = Array.from(new Set(svelteDeps.map((dep) => dep.name))).filter(\n\t\t(dep) => !isIncluded(dep)\n\t);\n\tlog.debug(`automatically excluding found svelte dependencies: ${svelteDepsToExclude.join(', ')}`);\n\texclude.push(...svelteDepsToExclude.filter((x) => !isExcluded(x)));\n\n\tif (options.disableDependencyReinclusion !== true) {\n\t\tconst disabledReinclusions = options.disableDependencyReinclusion || [];\n\t\tif (disabledReinclusions.length > 0) {\n\t\t\tlog.debug(`not reincluding transitive dependencies of`, disabledReinclusions);\n\t\t}\n\t\tconst transitiveDepsToInclude = svelteDeps\n\t\t\t.filter((dep) => !disabledReinclusions.includes(dep.name) && isExcluded(dep.name))\n\t\t\t.flatMap((dep) => {\n\t\t\t\tconst localRequire = createRequire(`${dep.dir}/package.json`);\n\t\t\t\treturn Object.keys(dep.pkg.dependencies || {})\n\t\t\t\t\t.filter((depOfDep) => !isExcluded(depOfDep) && needsOptimization(depOfDep, localRequire))\n\t\t\t\t\t.map((depOfDep) => dep.path.concat(dep.name, depOfDep).join(' > '));\n\t\t\t});\n\t\tlog.debug(\n\t\t\t`reincluding transitive dependencies of excluded svelte dependencies`,\n\t\t\ttransitiveDepsToInclude\n\t\t);\n\t\tinclude.push(...transitiveDepsToInclude);\n\t}\n\n\treturn { include, exclude };\n}\n\nfunction buildSSROptionsForSvelte(\n\tsvelteDeps: SvelteDependency[],\n\toptions: ResolvedOptions,\n\tconfig: UserConfig\n): any {\n\tconst noExternal: (string | RegExp)[] = [];\n\n\t// add svelte to ssr.noExternal unless it is present in ssr.external\n\t// so we can resolve it with svelte/ssr\n\tif (!config.ssr?.external?.includes('svelte')) {\n\t\tnoExternal.push('svelte', /^svelte\\//);\n\t}\n\n\t// add svelte dependencies to ssr.noExternal unless present in ssr.external\n\tnoExternal.push(\n\t\t...Array.from(new Set(svelteDeps.map((s) => s.name))).filter(\n\t\t\t(x) => !config.ssr?.external?.includes(x)\n\t\t)\n\t);\n\tconst ssr = {\n\t\tnoExternal,\n\t\texternal: [] as string[]\n\t};\n\n\tif (options.isServe) {\n\t\t// during dev, we have to externalize transitive dependencies, see https://github.com/sveltejs/vite-plugin-svelte/issues/281\n\t\tssr.external = Array.from(\n\t\t\tnew Set(svelteDeps.flatMap((dep) => Object.keys(dep.pkg.dependencies || {})))\n\t\t).filter(\n\t\t\t(dep) =>\n\t\t\t\t!ssr.noExternal.includes(dep) &&\n\t\t\t\t// TODO noExternal can be something different than a string array\n\t\t\t\t//!config.ssr?.noExternal?.includes(dep) &&\n\t\t\t\t!config.ssr?.external?.includes(dep)\n\t\t);\n\t}\n\n\treturn ssr;\n}\n\nexport function patchResolvedViteConfig(viteConfig: ResolvedConfig, options: ResolvedOptions) {\n\tconst facadeEsbuildSveltePlugin = viteConfig.optimizeDeps.esbuildOptions?.plugins?.find(\n\t\t(plugin) => plugin.name === facadeEsbuildSveltePluginName\n\t);\n\tif (facadeEsbuildSveltePlugin) {\n\t\tObject.assign(facadeEsbuildSveltePlugin, esbuildSveltePlugin(options));\n\t}\n}\n\nexport type Options = Omit<SvelteOptions, 'vitePlugin'> & PluginOptionsInline;\n\ninterface PluginOptionsInline extends PluginOptions {\n\t/**\n\t * Path to a svelte config file, either absolute or relative to Vite root\n\t *\n\t * set to `false` to ignore the svelte config file\n\t *\n\t * @see https://vitejs.dev/config/#root\n\t */\n\tconfigFile?: string | false;\n}\n\nexport interface PluginOptions {\n\t/**\n\t * A `picomatch` pattern, or array of patterns, which specifies the files the plugin should\n\t * operate on. By default, all svelte files are included.\n\t *\n\t * @see https://github.com/micromatch/picomatch\n\t */\n\tinclude?: Arrayable<string>;\n\n\t/**\n\t * A `picomatch` pattern, or array of patterns, which specifies the files to be ignored by the\n\t * plugin. By default, no files are ignored.\n\t *\n\t * @see https://github.com/micromatch/picomatch\n\t */\n\texclude?: Arrayable<string>;\n\n\t/**\n\t * Emit Svelte styles as virtual CSS files for Vite and other plugins to process\n\t *\n\t * @default true\n\t */\n\temitCss?: boolean;\n\n\t/**\n\t * Enable or disable Hot Module Replacement.\n\t *\n\t * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t *\n\t * DO NOT CUSTOMIZE SVELTE-HMR OPTIONS UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING\n\t *\n\t * YOU HAVE BEEN WARNED\n\t *\n\t * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t *\n\t * Set an object to pass custom options to svelte-hmr\n\t *\n\t * @see https://github.com/rixo/svelte-hmr#options\n\t * @default true for development, always false for production\n\t */\n\thot?: boolean | { injectCss?: boolean; [key: string]: any };\n\n\t/**\n\t * Some Vite plugins can contribute additional preprocessors by defining `api.sveltePreprocess`.\n\t * If you don't want to use them, set this to true to ignore them all or use an array of strings\n\t * with plugin names to specify which.\n\t *\n\t * @default false\n\t */\n\tignorePluginPreprocessors?: boolean | string[];\n\n\t/**\n\t * vite-plugin-svelte automatically handles excluding svelte libraries and reinclusion of their dependencies\n\t * in vite.optimizeDeps.\n\t *\n\t * `disableDependencyReinclusion: true` disables all reinclusions\n\t * `disableDependencyReinclusion: ['foo','bar']` disables reinclusions for dependencies of foo and bar\n\t *\n\t * This should be used for hybrid packages that contain both node and browser dependencies, eg Routify\n\t *\n\t * @default false\n\t */\n\tdisableDependencyReinclusion?: boolean | string[];\n\n\t/**\n\t * These options are considered experimental and breaking changes to them can occur in any release\n\t */\n\texperimental?: ExperimentalOptions;\n}\n\nexport interface SvelteOptions {\n\t/**\n\t * A list of file extensions to be compiled by Svelte\n\t *\n\t * @default ['.svelte']\n\t */\n\textensions?: string[];\n\n\t/**\n\t * An array of preprocessors to transform the Svelte source code before compilation\n\t *\n\t * @see https://svelte.dev/docs#svelte_preprocess\n\t */\n\tpreprocess?: Arrayable<PreprocessorGroup>;\n\n\t/**\n\t * The options to be passed to the Svelte compiler. A few options are set by default,\n\t * including `dev` and `css`. However, some options are non-configurable, like\n\t * `filename`, `format`, `generate`, and `cssHash` (in dev).\n\t *\n\t * @see https://svelte.dev/docs#svelte_compile\n\t */\n\tcompilerOptions?: Omit<CompileOptions, 'filename' | 'format' | 'generate'>;\n\n\t/**\n\t * Handles warning emitted from the Svelte compiler\n\t */\n\tonwarn?: (warning: Warning, defaultHandler?: (warning: Warning) => void) => void;\n\n\t/**\n\t * Options for vite-plugin-svelte\n\t */\n\tvitePlugin?: PluginOptions;\n}\n\n/**\n * These options are considered experimental and breaking changes to them can occur in any release\n */\nexport interface ExperimentalOptions {\n\t/**\n\t * Use extra preprocessors that delegate style and TypeScript preprocessing to native Vite plugins\n\t *\n\t * Do not use together with `svelte-preprocess`!\n\t *\n\t * @default false\n\t */\n\tuseVitePreprocess?: boolean;\n\n\t/**\n\t * Force Vite to pre-bundle Svelte libraries\n\t *\n\t * @default false\n\t */\n\tprebundleSvelteLibraries?: boolean;\n\n\t/**\n\t * If a preprocessor does not provide a sourcemap, a best-effort fallback sourcemap will be provided.\n\t * This option requires `diff-match-patch` to be installed as a peer dependency.\n\t *\n\t * @see https://github.com/google/diff-match-patch\n\t * @default false\n\t */\n\tgenerateMissingPreprocessorSourcemaps?: boolean;\n\n\t/**\n\t * A function to update `compilerOptions` before compilation\n\t *\n\t * `data.filename` - The file to be compiled\n\t * `data.code` - The preprocessed Svelte code\n\t * `data.compileOptions` - The current compiler options\n\t *\n\t * To change part of the compiler options, return an object with the changes you need.\n\t *\n\t * @example\n\t * ```\n\t * ({ filename, compileOptions }) => {\n\t * // Dynamically set hydration per Svelte file\n\t * if (compileWithHydratable(filename) && !compileOptions.hydratable) {\n\t * return { hydratable: true };\n\t * }\n\t * }\n\t * ```\n\t */\n\tdynamicCompileOptions?: (data: {\n\t\tfilename: string;\n\t\tcode: string;\n\t\tcompileOptions: Partial<CompileOptions>;\n\t}) => Promise<Partial<CompileOptions> | void> | Partial<CompileOptions> | void;\n\n\t/**\n\t * enable svelte inspector\n\t */\n\tinspector?: InspectorOptions | boolean;\n\n\t/**\n\t * send a websocket message with svelte compiler warnings during dev\n\t *\n\t */\n\tsendWarningsToBrowser?: boolean;\n}\n\nexport interface InspectorOptions {\n\t/**\n\t * define a key combo to toggle inspector,\n\t * @default 'control-shift' on windows, 'meta-shift' on other os\n\t *\n\t * any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by -\n\t * examples: control-shift, control-o, control-alt-s meta-x control-meta\n\t * Some keys have native behavior (e.g. alt-s opens history menu on firefox).\n\t * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended.\n\t */\n\ttoggleKeyCombo?: string;\n\n\t/**\n\t * inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress\n\t * @default false\n\t */\n\tholdMode?: boolean;\n\t/**\n\t * when to show the toggle button\n\t * @default 'active'\n\t */\n\tshowToggleButton?: 'always' | 'active' | 'never';\n\n\t/**\n\t * where to display the toggle button\n\t * @default top-right\n\t */\n\ttoggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';\n\n\t/**\n\t * inject custom styles when inspector is active\n\t */\n\tcustomStyles?: boolean;\n\n\t/**\n\t * append an import to the module id ending with `appendTo` instead of adding a script into body\n\t * useful for frameworks that do not support trannsformIndexHtml hook\n\t *\n\t * WARNING: only set this if you know exactly what it does.\n\t * Regular users of vite-plugin-svelte or SvelteKit do not need it\n\t */\n\tappendTo?: string;\n}\n\nexport interface PreResolvedOptions extends Options {\n\t// these options are non-nullable after resolve\n\tcompilerOptions: CompileOptions;\n\texperimental?: ExperimentalOptions;\n\t// extra options\n\troot: string;\n\tisBuild: boolean;\n\tisServe: boolean;\n\tisDebug: boolean;\n}\n\nexport interface ResolvedOptions extends PreResolvedOptions {\n\tisProduction: boolean;\n\tserver?: ViteDevServer;\n}\n\nexport type {\n\tCompileOptions,\n\tProcessed,\n\tMarkupPreprocessor,\n\tPreprocessor,\n\tPreprocessorGroup,\n\tWarning\n};\n\nexport type ModuleFormat = NonNullable<CompileOptions['format']>;\n\nexport type CssHashGetter = NonNullable<CompileOptions['cssHash']>;\n\nexport type Arrayable<T> = T | T[];\n","import { createRequire } from 'module';\nimport path from 'path';\nimport fs from 'fs';\nimport { pathToFileURL } from 'url';\nimport { log } from './log';\nimport { Options, SvelteOptions } from './options';\nimport { UserConfig } from 'vite';\n\n// used to require cjs config in esm.\n// NOTE dynamic import() cjs technically works, but timestamp query cache bust\n// have no effect, likely because it has another internal cache?\nlet esmRequire: NodeRequire;\n\nexport const knownSvelteConfigNames = [\n\t'svelte.config.js',\n\t'svelte.config.cjs',\n\t'svelte.config.mjs'\n];\n\n// hide dynamic import from ts transform to prevent it turning into a require\n// see https://github.com/microsoft/TypeScript/issues/43329#issuecomment-811606238\n// also use timestamp query to avoid caching on reload\nconst dynamicImportDefault = new Function(\n\t'path',\n\t'timestamp',\n\t'return import(path + \"?t=\" + timestamp).then(m => m.default)'\n);\n\nexport async function loadSvelteConfig(\n\tviteConfig?: UserConfig,\n\tinlineOptions?: Partial<Options>\n): Promise<Partial<SvelteOptions> | undefined> {\n\tif (inlineOptions?.configFile === false) {\n\t\treturn;\n\t}\n\tconst configFile = findConfigToLoad(viteConfig, inlineOptions);\n\tif (configFile) {\n\t\tlet err;\n\t\t// try to use dynamic import for svelte.config.js first\n\t\tif (configFile.endsWith('.js') || configFile.endsWith('.mjs')) {\n\t\t\ttry {\n\t\t\t\tconst result = await dynamicImportDefault(\n\t\t\t\t\tpathToFileURL(configFile).href,\n\t\t\t\t\tfs.statSync(configFile).mtimeMs\n\t\t\t\t);\n\t\t\t\tif (result != null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tconfigFile\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`invalid export in ${configFile}`);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tlog.error(`failed to import config ${configFile}`, e);\n\t\t\t\terr = e;\n\t\t\t}\n\t\t}\n\t\t// cjs or error with dynamic import\n\t\tif (!configFile.endsWith('.mjs')) {\n\t\t\ttry {\n\t\t\t\t// identify which require function to use (esm and cjs mode)\n\t\t\t\tconst _require = import.meta.url\n\t\t\t\t\t? (esmRequire ??= createRequire(import.meta.url))\n\t\t\t\t\t: require;\n\n\t\t\t\t// avoid loading cached version on reload\n\t\t\t\tdelete _require.cache[_require.resolve(configFile)];\n\t\t\t\tconst result = _require(configFile);\n\t\t\t\tif (result != null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tconfigFile\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`invalid export in ${configFile}`);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tlog.error(`failed to require config ${configFile}`, e);\n\t\t\t\tif (!err) {\n\t\t\t\t\terr = e;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// failed to load existing config file\n\t\tthrow err;\n\t}\n}\n\nfunction findConfigToLoad(viteConfig?: UserConfig, inlineOptions?: Partial<Options>) {\n\tconst root = viteConfig?.root || process.cwd();\n\tif (inlineOptions?.configFile) {\n\t\tconst abolutePath = path.isAbsolute(inlineOptions.configFile)\n\t\t\t? inlineOptions.configFile\n\t\t\t: path.resolve(root, inlineOptions.configFile);\n\t\tif (!fs.existsSync(abolutePath)) {\n\t\t\tthrow new Error(`failed to find svelte config file ${abolutePath}.`);\n\t\t}\n\t\treturn abolutePath;\n\t} else {\n\t\tconst existingKnownConfigFiles = knownSvelteConfigNames\n\t\t\t.map((candidate) => path.resolve(root, candidate))\n\t\t\t.filter((file) => fs.existsSync(file));\n\t\tif (existingKnownConfigFiles.length === 0) {\n\t\t\tlog.debug(`no svelte config found at ${root}`);\n\t\t\treturn;\n\t\t} else if (existingKnownConfigFiles.length > 1) {\n\t\t\tlog.warn(\n\t\t\t\t`found more than one svelte config file, using ${existingKnownConfigFiles[0]}. you should only have one!`,\n\t\t\t\texistingKnownConfigFiles\n\t\t\t);\n\t\t}\n\t\treturn existingKnownConfigFiles[0];\n\t}\n}\n","const VITE_RESOLVE_MAIN_FIELDS = ['module', 'jsnext:main', 'jsnext'];\n\nexport const SVELTE_RESOLVE_MAIN_FIELDS = ['svelte', ...VITE_RESOLVE_MAIN_FIELDS];\n\nexport const SVELTE_IMPORTS = [\n\t'svelte/animate',\n\t'svelte/easing',\n\t'svelte/internal',\n\t'svelte/motion',\n\t'svelte/ssr',\n\t'svelte/store',\n\t'svelte/transition',\n\t'svelte'\n];\n\nexport const SVELTE_HMR_IMPORTS = [\n\t'svelte-hmr/runtime/hot-api-esm.js',\n\t'svelte-hmr/runtime/proxy-adapter-dom.js',\n\t'svelte-hmr'\n];\n","import { log } from './log';\nimport path from 'path';\nimport fs from 'fs';\nimport { createRequire } from 'module';\n\nexport function findRootSvelteDependencies(root: string, cwdFallback = true): SvelteDependency[] {\n\tlog.debug(`findSvelteDependencies: searching svelte dependencies in ${root}`);\n\tconst pkgFile = path.join(root, 'package.json');\n\tif (!fs.existsSync(pkgFile)) {\n\t\tif (cwdFallback) {\n\t\t\tconst cwd = process.cwd();\n\t\t\tif (root !== cwd) {\n\t\t\t\tlog.debug(`no package.json found in vite root ${root}`);\n\t\t\t\treturn findRootSvelteDependencies(cwd, false);\n\t\t\t}\n\t\t}\n\t\tlog.warn(`no package.json found, findRootSvelteDependencies failed`);\n\t\treturn [];\n\t}\n\n\tconst pkg = parsePkg(root);\n\tif (!pkg) {\n\t\treturn [];\n\t}\n\n\tconst deps = [\n\t\t...Object.keys(pkg.dependencies || {}),\n\t\t...Object.keys(pkg.devDependencies || {})\n\t].filter((dep) => !is_common_without_svelte_field(dep));\n\n\treturn getSvelteDependencies(deps, root);\n}\n\nfunction getSvelteDependencies(\n\tdeps: string[],\n\tpkgDir: string,\n\tpath: string[] = []\n): SvelteDependency[] {\n\tconst result = [];\n\tconst localRequire = createRequire(`${pkgDir}/package.json`);\n\tconst resolvedDeps = deps\n\t\t.map((dep) => resolveDependencyData(dep, localRequire))\n\t\t.filter(Boolean) as DependencyData[];\n\tfor (const { pkg, dir } of resolvedDeps) {\n\t\tconst type = getSvelteDependencyType(pkg);\n\t\tif (!type) continue;\n\t\tresult.push({ name: pkg.name, type, pkg, dir, path });\n\t\t// continue crawling for component libraries so we can optimize them, js libraries are fine\n\t\tif (type === 'component-library' && pkg.dependencies) {\n\t\t\tlet dependencyNames = Object.keys(pkg.dependencies);\n\t\t\tconst circular = dependencyNames.filter((name) => path.includes(name));\n\t\t\tif (circular.length > 0) {\n\t\t\t\tlog.warn.enabled &&\n\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t`skipping circular svelte dependencies in automated vite optimizeDeps handling`,\n\t\t\t\t\t\tcircular.map((x) => path.concat(x).join('>'))\n\t\t\t\t\t);\n\t\t\t\tdependencyNames = dependencyNames.filter((name) => !path.includes(name));\n\t\t\t}\n\t\t\tif (path.length === 3) {\n\t\t\t\tlog.debug.once(`encountered deep svelte dependency tree: ${path.join('>')}`);\n\t\t\t}\n\t\t\tresult.push(...getSvelteDependencies(dependencyNames, dir, path.concat(pkg.name)));\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function resolveDependencyData(\n\tdep: string,\n\tlocalRequire: NodeRequire\n): DependencyData | void {\n\ttry {\n\t\tconst pkgJson = `${dep}/package.json`;\n\t\tconst pkg = localRequire(pkgJson);\n\t\tconst dir = path.dirname(localRequire.resolve(pkgJson));\n\t\treturn { dir, pkg };\n\t} catch (e) {\n\t\tlog.debug.once(`dependency ${dep} does not export package.json`, e);\n\t\t// walk up from default export until we find package.json with name=dep\n\t\ttry {\n\t\t\tlet dir = path.dirname(localRequire.resolve(dep));\n\t\t\twhile (dir) {\n\t\t\t\tconst pkg = parsePkg(dir, true);\n\t\t\t\tif (pkg && pkg.name === dep) {\n\t\t\t\t\treturn { dir, pkg };\n\t\t\t\t}\n\t\t\t\tconst parent = path.dirname(dir);\n\t\t\t\tif (parent === dir) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdir = parent;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tlog.debug.once(`error while trying to find package.json of ${dep}`, e);\n\t\t}\n\t}\n\tlog.debug.once(`failed to resolve ${dep}`);\n}\n\nfunction parsePkg(dir: string, silent = false): Pkg | void {\n\tconst pkgFile = path.join(dir, 'package.json');\n\ttry {\n\t\treturn JSON.parse(fs.readFileSync(pkgFile, 'utf-8'));\n\t} catch (e) {\n\t\t!silent && log.warn.enabled && log.warn(`failed to parse ${pkgFile}`, e);\n\t}\n}\n\nfunction getSvelteDependencyType(pkg: Pkg): SvelteDependencyType | undefined {\n\tif (isSvelteComponentLib(pkg)) {\n\t\treturn 'component-library';\n\t} else if (isSvelteLib(pkg)) {\n\t\treturn 'js-library';\n\t} else {\n\t\treturn undefined;\n\t}\n}\n\nfunction isSvelteComponentLib(pkg: Pkg) {\n\treturn !!pkg.svelte;\n}\n\nfunction isSvelteLib(pkg: Pkg) {\n\treturn !!pkg.dependencies?.svelte || !!pkg.peerDependencies?.svelte;\n}\n\nconst COMMON_DEPENDENCIES_WITHOUT_SVELTE_FIELD = [\n\t'@lukeed/uuid',\n\t'@playwright/test',\n\t'@sveltejs/vite-plugin-svelte',\n\t'@sveltejs/kit',\n\t'autoprefixer',\n\t'cookie',\n\t'dotenv',\n\t'esbuild',\n\t'eslint',\n\t'jest',\n\t'mdsvex',\n\t'playwright',\n\t'postcss',\n\t'prettier',\n\t'svelte',\n\t'svelte-check',\n\t'svelte-hmr',\n\t'svelte-preprocess',\n\t'tslib',\n\t'typescript',\n\t'vite',\n\t'vitest',\n\t'__vite-browser-external' // see https://github.com/sveltejs/vite-plugin-svelte/issues/362\n];\nconst COMMON_PREFIXES_WITHOUT_SVELTE_FIELD = [\n\t'@fontsource/',\n\t'@postcss-plugins/',\n\t'@rollup/',\n\t'@sveltejs/adapter-',\n\t'@types/',\n\t'@typescript-eslint/',\n\t'eslint-',\n\t'jest-',\n\t'postcss-plugin-',\n\t'prettier-plugin-',\n\t'rollup-plugin-',\n\t'vite-plugin-'\n];\n\n/**\n * Test for common dependency names that tell us it is not a package including a svelte field, eg. eslint + plugins.\n *\n * This speeds up the find process as we don't have to try and require the package.json for all of them\n *\n * @param dependency {string}\n * @returns {boolean} true if it is a dependency without a svelte field\n */\nexport function is_common_without_svelte_field(dependency: string): boolean {\n\treturn (\n\t\tCOMMON_DEPENDENCIES_WITHOUT_SVELTE_FIELD.includes(dependency) ||\n\t\tCOMMON_PREFIXES_WITHOUT_SVELTE_FIELD.some(\n\t\t\t(prefix) =>\n\t\t\t\tprefix.startsWith('@')\n\t\t\t\t\t? dependency.startsWith(prefix)\n\t\t\t\t\t: dependency.substring(dependency.lastIndexOf('/') + 1).startsWith(prefix) // check prefix omitting @scope/\n\t\t)\n\t);\n}\n\nexport function needsOptimization(dep: string, localRequire: NodeRequire): boolean {\n\tconst depData = resolveDependencyData(dep, localRequire);\n\tif (!depData) return false;\n\tconst pkg = depData.pkg;\n\t// only optimize if is cjs, using the below as heuristic\n\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/162\n\tconst hasEsmFields = pkg.module || pkg.exports;\n\tif (hasEsmFields) return false;\n\tif (pkg.main) {\n\t\t// ensure entry is js so vite can prebundle it\n\t\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/233\n\t\tconst entryExt = path.extname(pkg.main);\n\t\treturn !entryExt || entryExt === '.js' || entryExt === '.cjs';\n\t} else {\n\t\t// check if has implicit index.js entrypoint\n\t\t// https://github.com/sveltejs/vite-plugin-svelte/issues/281\n\t\ttry {\n\t\t\tlocalRequire.resolve(`${dep}/index.js`);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninterface DependencyData {\n\tdir: string;\n\tpkg: Pkg;\n}\n\nexport interface SvelteDependency {\n\tname: string;\n\ttype: SvelteDependencyType;\n\tdir: string;\n\tpkg: Pkg;\n\tpath: string[];\n}\n\n// component-library => exports svelte components\n// js-library => only uses svelte api, no components\nexport type SvelteDependencyType = 'component-library' | 'js-library';\n\nexport interface Pkg {\n\tname: string;\n\tsvelte?: string;\n\tdependencies?: DependencyList;\n\tdevDependencies?: DependencyList;\n\tpeerDependencies?: DependencyList;\n\t[key: string]: any;\n}\n\nexport interface DependencyList {\n\t[key: string]: string;\n}\n","import { promises as fs } from 'fs';\nimport { compile, preprocess } from 'svelte/compiler';\nimport { DepOptimizationOptions } from 'vite';\nimport { Compiled } from './compile';\nimport { log } from './log';\nimport { CompileOptions, ResolvedOptions } from './options';\nimport { toESBuildError } from './error';\n\ntype EsbuildOptions = NonNullable<DepOptimizationOptions['esbuildOptions']>;\ntype EsbuildPlugin = NonNullable<EsbuildOptions['plugins']>[number];\n\nexport const facadeEsbuildSveltePluginName = 'vite-plugin-svelte:facade';\n\nexport function esbuildSveltePlugin(options: ResolvedOptions): EsbuildPlugin {\n\treturn {\n\t\tname: 'vite-plugin-svelte:optimize-svelte',\n\t\tsetup(build) {\n\t\t\t// Skip in scanning phase as Vite already handles scanning Svelte files.\n\t\t\t// Otherwise this would heavily slow down the scanning phase.\n\t\t\tif (build.initialOptions.plugins?.some((v) => v.name === 'vite:dep-scan')) return;\n\n\t\t\tconst svelteExtensions = (options.extensions ?? ['.svelte']).map((ext) => ext.slice(1));\n\t\t\tconst svelteFilter = new RegExp(`\\\\.(` + svelteExtensions.join('|') + `)(\\\\?.*)?$`);\n\n\t\t\tbuild.onLoad({ filter: svelteFilter }, async ({ path: filename }) => {\n\t\t\t\tconst code = await fs.readFile(filename, 'utf8');\n\t\t\t\ttry {\n\t\t\t\t\tconst contents = await compileSvelte(options, { filename, code });\n\t\t\t\t\treturn { contents };\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn { errors: [toESBuildError(e, options)] };\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n}\n\nasync function compileSvelte(\n\toptions: ResolvedOptions,\n\t{ filename, code }: { filename: string; code: string }\n): Promise<string> {\n\tconst compileOptions: CompileOptions = {\n\t\t...options.compilerOptions,\n\t\tcss: true,\n\t\tfilename,\n\t\tformat: 'esm',\n\t\tgenerate: 'dom'\n\t};\n\n\tlet preprocessed;\n\n\tif (options.preprocess) {\n\t\ttry {\n\t\t\tpreprocessed = await preprocess(code, options.preprocess, { filename });\n\t\t} catch (e) {\n\t\t\te.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`;\n\t\t\tthrow e;\n\t\t}\n\t\tif (preprocessed.map) compileOptions.sourcemap = preprocessed.map;\n\t}\n\n\tconst finalCode = preprocessed ? preprocessed.code : code;\n\n\tconst dynamicCompileOptions = await options.experimental?.dynamicCompileOptions?.({\n\t\tfilename,\n\t\tcode: finalCode,\n\t\tcompileOptions\n\t});\n\n\tif (dynamicCompileOptions && log.debug.enabled) {\n\t\tlog.debug(`dynamic compile options for ${filename}: ${JSON.stringify(dynamicCompileOptions)}`);\n\t}\n\n\tconst finalCompileOptions = dynamicCompileOptions\n\t\t? {\n\t\t\t\t...compileOptions,\n\t\t\t\t...dynamicCompileOptions\n\t\t }\n\t\t: compileOptions;\n\n\tconst compiled = compile(finalCode, finalCompileOptions) as Compiled;\n\n\treturn compiled.js.code + '//# sourceMappingURL=' + compiled.js.map.toUrl();\n}\n","import { RollupError } from 'rollup';\nimport { ResolvedOptions, Warning } from './options';\nimport { buildExtendedLogMessage } from './log';\nimport { PartialMessage } from 'esbuild';\n\n/**\n * convert an error thrown by svelte.compile to a RollupError so that vite displays it in a user friendly way\n * @param error a svelte compiler error, which is a mix of Warning and an error\n * @returns {RollupError} the converted error\n */\nexport function toRollupError(error: Warning & Error, options: ResolvedOptions): RollupError {\n\tconst { filename, frame, start, code, name, stack } = error;\n\tconst rollupError: RollupError = {\n\t\tname, // needed otherwise sveltekit coalesce_to_error turns it into a string\n\t\tid: filename,\n\t\tmessage: buildExtendedLogMessage(error), // include filename:line:column so that it's clickable\n\t\tframe: formatFrameForVite(frame),\n\t\tcode,\n\t\tstack: options.isBuild || options.isDebug || !frame ? stack : ''\n\t};\n\tif (start) {\n\t\trollupError.loc = {\n\t\t\tline: start.line,\n\t\t\tcolumn: start.column,\n\t\t\tfile: filename\n\t\t};\n\t}\n\treturn rollupError;\n}\n\n/**\n * convert an error thrown by svelte.compile to an esbuild PartialMessage\n * @param error a svelte compiler error, which is a mix of Warning and an error\n * @returns {PartialMessage} the converted error\n */\nexport function toESBuildError(error: Warning & Error, options: ResolvedOptions): PartialMessage {\n\tconst { filename, frame, start, stack } = error;\n\tconst partialMessage: PartialMessage = {\n\t\ttext: buildExtendedLogMessage(error)\n\t};\n\tif (start) {\n\t\tpartialMessage.location = {\n\t\t\tline: start.line,\n\t\t\tcolumn: start.column,\n\t\t\tfile: filename,\n\t\t\tlineText: lineFromFrame(start.line, frame) // needed to get a meaningful error message on cli\n\t\t};\n\t}\n\tif (options.isBuild || options.isDebug || !frame) {\n\t\tpartialMessage.detail = stack;\n\t}\n\treturn partialMessage;\n}\n\n/**\n * extract line with number from codeframe\n */\nfunction lineFromFrame(lineNo: number, frame?: string): string {\n\tif (!frame) {\n\t\treturn '';\n\t}\n\tconst lines = frame.split('\\n');\n\tconst errorLine = lines.find((line) => line.trimStart().startsWith(`${lineNo}: `));\n\treturn errorLine ? errorLine.substring(errorLine.indexOf(': ') + 3) : '';\n}\n\n/**\n * vite error overlay expects a specific format to show frames\n * this reformats svelte frame (colon separated, less whitespace)\n * to one that vite displays on overlay ( pipe separated, more whitespace)\n * e.g.\n * ```\n * 1: foo\n * 2: bar;\n * ^\n * 3: baz\n * ```\n * to\n * ```\n * 1 | foo\n * 2 | bar;\n * ^\n * 3 | baz\n * ```\n * @see https://github.com/vitejs/vite/blob/96591bf9989529de839ba89958755eafe4c445ae/packages/vite/src/client/overlay.ts#L116\n */\nfunction formatFrameForVite(frame?: string): string {\n\tif (!frame) {\n\t\treturn '';\n\t}\n\treturn frame\n\t\t.split('\\n')\n\t\t.map((line) => (line.match(/^\\s+\\^/) ? ' ' + line : ' ' + line.replace(':', ' | ')))\n\t\t.join('\\n');\n}\n","import {\n\ttransformWithEsbuild,\n\tESBuildOptions,\n\tResolvedConfig,\n\tTransformResult,\n\tPlugin\n} from 'vite';\nimport MagicString from 'magic-string';\nimport { preprocess } from 'svelte/compiler';\nimport { Preprocessor, PreprocessorGroup, Processed, ResolvedOptions } from './options';\nimport { TransformPluginContext } from 'rollup';\nimport { log } from './log';\nimport { buildSourceMap } from './sourcemap';\nimport path from 'path';\n\nconst supportedStyleLangs = ['css', 'less', 'sass', 'scss', 'styl', 'stylus', 'postcss'];\n\nconst supportedScriptLangs = ['ts'];\n\nfunction createViteScriptPreprocessor(): Preprocessor {\n\treturn async ({ attributes, content, filename = '' }) => {\n\t\tconst lang = attributes.lang as string;\n\t\tif (!supportedScriptLangs.includes(lang)) return;\n\t\tconst transformResult = await transformWithEsbuild(content, filename, {\n\t\t\tloader: lang as ESBuildOptions['loader'],\n\t\t\ttsconfigRaw: {\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\t// svelte typescript needs this flag to work with type imports\n\t\t\t\t\timportsNotUsedAsValues: 'preserve',\n\t\t\t\t\tpreserveValueImports: true\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn {\n\t\t\tcode: transformResult.code,\n\t\t\tmap: transformResult.map\n\t\t};\n\t};\n}\n\nfunction createViteStylePreprocessor(config: ResolvedConfig): Preprocessor {\n\tconst pluginName = 'vite:css';\n\tconst plugin = config.plugins.find((p) => p.name === pluginName);\n\tif (!plugin) {\n\t\tthrow new Error(`failed to find plugin ${pluginName}`);\n\t}\n\tif (!plugin.transform) {\n\t\tthrow new Error(`plugin ${pluginName} has no transform`);\n\t}\n\tconst pluginTransform = plugin.transform!.bind(null as unknown as TransformPluginContext);\n\treturn async ({ attributes, content, filename = '' }) => {\n\t\tconst lang = attributes.lang as string;\n\t\tif (!supportedStyleLangs.includes(lang)) return;\n\t\tconst moduleId = `${filename}.${lang}`;\n\t\tconst transformResult: TransformResult = (await pluginTransform(\n\t\t\tcontent,\n\t\t\tmoduleId\n\t\t)) as TransformResult;\n\t\t// patch sourcemap source to point back to original filename\n\t\tif (transformResult.map?.sources?.[0] === moduleId) {\n\t\t\ttransformResult.map.sources[0] = path.basename(filename);\n\t\t}\n\t\treturn {\n\t\t\tcode: transformResult.code,\n\t\t\tmap: transformResult.map ?? undefined\n\t\t};\n\t};\n}\n\nfunction createVitePreprocessorGroup(config: ResolvedConfig): PreprocessorGroup {\n\treturn {\n\t\tmarkup({ content, filename }) {\n\t\t\treturn preprocess(\n\t\t\t\tcontent,\n\t\t\t\t{\n\t\t\t\t\tscript: createViteScriptPreprocessor(),\n\t\t\t\t\tstyle: createViteStylePreprocessor(config)\n\t\t\t\t},\n\t\t\t\t{ filename }\n\t\t\t);\n\t\t}\n\t} as PreprocessorGroup;\n}\n\n/**\n * this appends a *{} rule to component styles to force the svelte compiler to add style classes to all nodes\n * That means adding/removing class rules from <style> node won't trigger js updates as the scope classes are not changed\n *\n * only used during dev with enabled css hmr\n */\nfunction createInjectScopeEverythingRulePreprocessorGroup(): PreprocessorGroup {\n\treturn {\n\t\tstyle({ content, filename }) {\n\t\t\tconst s = new MagicString(content);\n\t\t\ts.append(' *{}');\n\t\t\treturn {\n\t\t\t\tcode: s.toString(),\n\t\t\t\tmap: s.generateDecodedMap({\n\t\t\t\t\tsource: filename ? path.basename(filename) : undefined,\n\t\t\t\t\thires: true\n\t\t\t\t})\n\t\t\t};\n\t\t}\n\t};\n}\n\nfunction buildExtraPreprocessors(options: ResolvedOptions, config: ResolvedConfig) {\n\tconst prependPreprocessors: PreprocessorGroup[] = [];\n\tconst appendPreprocessors: PreprocessorGroup[] = [];\n\n\tif (options.experimental?.useVitePreprocess) {\n\t\tlog.debug('adding vite preprocessor');\n\t\tprependPreprocessors.push(createVitePreprocessorGroup(config));\n\t}\n\n\t// @ts-ignore\n\tconst pluginsWithPreprocessorsDeprecated = config.plugins.filter((p) => p?.sveltePreprocess);\n\tif (pluginsWithPreprocessorsDeprecated.length > 0) {\n\t\tlog.warn(\n\t\t\t`The following plugins use the deprecated 'plugin.sveltePreprocess' field. Please contact their maintainers and ask them to move it to 'plugin.api.sveltePreprocess': ${pluginsWithPreprocessorsDeprecated\n\t\t\t\t.map((p) => p.name)\n\t\t\t\t.join(', ')}`\n\t\t);\n\t\t// patch plugin to avoid breaking\n\t\tpluginsWithPreprocessorsDeprecated.forEach((p) => {\n\t\t\tif (!p.api) {\n\t\t\t\tp.api = {};\n\t\t\t}\n\t\t\tif (p.api.sveltePreprocess === undefined) {\n\t\t\t\t// @ts-ignore\n\t\t\t\tp.api.sveltePreprocess = p.sveltePreprocess;\n\t\t\t} else {\n\t\t\t\tlog.error(\n\t\t\t\t\t`ignoring plugin.sveltePreprocess of ${p.name} because it already defined plugin.api.sveltePreprocess.`\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tconst pluginsWithPreprocessors: Plugin[] = config.plugins.filter((p) => p?.api?.sveltePreprocess);\n\tconst ignored: Plugin[] = [],\n\t\tincluded: Plugin[] = [];\n\tfor (const p of pluginsWithPreprocessors) {\n\t\tif (\n\t\t\toptions.ignorePluginPreprocessors === true ||\n\t\t\t(Array.isArray(options.ignorePluginPreprocessors) &&\n\t\t\t\toptions.ignorePluginPreprocessors?.includes(p.name))\n\t\t) {\n\t\t\tignored.push(p);\n\t\t} else {\n\t\t\tincluded.push(p);\n\t\t}\n\t}\n\tif (ignored.length > 0) {\n\t\tlog.debug(\n\t\t\t`Ignoring svelte preprocessors defined by these vite plugins: ${ignored\n\t\t\t\t.map((p) => p.name)\n\t\t\t\t.join(', ')}`\n\t\t);\n\t}\n\tif (included.length > 0) {\n\t\tlog.debug(\n\t\t\t`Adding svelte preprocessors defined by these vite plugins: ${included\n\t\t\t\t.map((p) => p.name)\n\t\t\t\t.join(', ')}`\n\t\t);\n\t\tappendPreprocessors.push(...pluginsWithPreprocessors.map((p) => p.api.sveltePreprocess));\n\t}\n\n\tif (options.hot && options.emitCss) {\n\t\tappendPreprocessors.push(createInjectScopeEverythingRulePreprocessorGroup());\n\t}\n\n\treturn { prependPreprocessors, appendPreprocessors };\n}\n\nexport function addExtraPreprocessors(options: ResolvedOptions, config: ResolvedConfig) {\n\tconst { prependPreprocessors, appendPreprocessors } = buildExtraPreprocessors(options, config);\n\tif (prependPreprocessors.length > 0 || appendPreprocessors.length > 0) {\n\t\tif (!options.preprocess) {\n\t\t\toptions.preprocess = [...prependPreprocessors, ...appendPreprocessors];\n\t\t} else if (Array.isArray(options.preprocess)) {\n\t\t\toptions.preprocess.unshift(...prependPreprocessors);\n\t\t\toptions.preprocess.push(...appendPreprocessors);\n\t\t} else {\n\t\t\toptions.preprocess = [...prependPreprocessors, options.preprocess, ...appendPreprocessors];\n\t\t}\n\t}\n\tconst generateMissingSourceMaps = !!options.experimental?.generateMissingPreprocessorSourcemaps;\n\tif (options.preprocess && generateMissingSourceMaps) {\n\t\toptions.preprocess = Array.isArray(options.preprocess)\n\t\t\t? options.preprocess.map((p, i) => validateSourceMapOutputWrapper(p, i))\n\t\t\t: validateSourceMapOutputWrapper(options.preprocess, 0);\n\t}\n}\n\nfunction validateSourceMapOutputWrapper(group: PreprocessorGroup, i: number): PreprocessorGroup {\n\tconst wrapper: PreprocessorGroup = {};\n\n\tfor (const [processorType, processorFn] of Object.entries(group) as Array<\n\t\t// eslint-disable-next-line no-unused-vars\n\t\t[keyof PreprocessorGroup, (options: { filename?: string; content: string }) => Processed]\n\t>) {\n\t\twrapper[processorType] = async (options) => {\n\t\t\tconst result = await processorFn(options);\n\n\t\t\tif (result && result.code !== options.content) {\n\t\t\t\tlet invalidMap = false;\n\t\t\t\tif (!result.map) {\n\t\t\t\t\tinvalidMap = true;\n\t\t\t\t\tlog.warn.enabled &&\n\t\t\t\t\t\tlog.warn.once(\n\t\t\t\t\t\t\t`preprocessor at index ${i} did not return a sourcemap for ${processorType} transform`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfilename: options.filename,\n\t\t\t\t\t\t\t\ttype: processorType,\n\t\t\t\t\t\t\t\tprocessor: processorFn.toString()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t} else if ((result.map as any)?.mappings === '') {\n\t\t\t\t\tinvalidMap = true;\n\t\t\t\t\tlog.warn.enabled &&\n\t\t\t\t\t\tlog.warn.once(\n\t\t\t\t\t\t\t`preprocessor at index ${i} returned an invalid empty sourcemap for ${processorType} transform`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfilename: options.filename,\n\t\t\t\t\t\t\t\ttype: processorType,\n\t\t\t\t\t\t\t\tprocessor: processorFn.toString()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (invalidMap) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst map = await buildSourceMap(options.content, result.code, options.filename);\n\t\t\t\t\t\tif (map) {\n\t\t\t\t\t\t\tlog.debug.enabled &&\n\t\t\t\t\t\t\t\tlog.debug(\n\t\t\t\t\t\t\t\t\t`adding generated sourcemap to preprocesor result for ${options.filename}`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tresult.map = map;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tlog.error(`failed to build sourcemap`, e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t}\n\n\treturn wrapper;\n}\n","import MagicString, { MagicStringOptions } from 'magic-string';\nimport { log } from './log';\n\nexport async function buildMagicString(\n\tfrom: string,\n\tto: string,\n\toptions?: MagicStringOptions\n): Promise<MagicString | null> {\n\tlet diff_match_patch, DIFF_DELETE: number, DIFF_INSERT: number;\n\ttry {\n\t\tconst dmpPkg = await import('diff-match-patch');\n\t\tdiff_match_patch = dmpPkg.diff_match_patch;\n\t\tDIFF_INSERT = dmpPkg.DIFF_INSERT;\n\t\tDIFF_DELETE = dmpPkg.DIFF_DELETE;\n\t} catch (e) {\n\t\tlog.error.once(\n\t\t\t'Failed to import optional dependency \"diff-match-patch\". Please install it to enable generated sourcemaps.'\n\t\t);\n\t\treturn null;\n\t}\n\n\tconst dmp = new diff_match_patch();\n\tconst diffs = dmp.diff_main(from, to);\n\tdmp.diff_cleanupSemantic(diffs);\n\tconst m = new MagicString(from, options);\n\tlet pos = 0;\n\tfor (let i = 0; i < diffs.length; i++) {\n\t\tconst diff = diffs[i];\n\t\tconst nextDiff = diffs[i + 1];\n\t\tif (diff[0] === DIFF_DELETE) {\n\t\t\tif (nextDiff?.[0] === DIFF_INSERT) {\n\t\t\t\t// delete followed by insert, use overwrite and skip ahead\n\t\t\t\tm.overwrite(pos, pos + diff[1].length, nextDiff[1]);\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tm.remove(pos, pos + diff[1].length);\n\t\t\t}\n\t\t\tpos += diff[1].length;\n\t\t} else if (diff[0] === DIFF_INSERT) {\n\t\t\tif (nextDiff) {\n\t\t\t\tm.appendRight(pos, diff[1]);\n\t\t\t} else {\n\t\t\t\tm.append(diff[1]);\n\t\t\t}\n\t\t} else {\n\t\t\t// unchanged block, advance pos\n\t\t\tpos += diff[1].length;\n\t\t}\n\t}\n\t// at this point m.toString() === to\n\treturn m;\n}\n\nexport async function buildSourceMap(from: string, to: string, filename?: string) {\n\t// @ts-ignore\n\tconst m = await buildMagicString(from, to, { filename });\n\treturn m ? m.generateDecodedMap({ source: filename, hires: true, includeContent: false }) : null;\n}\n","import { SvelteRequest } from './id';\nimport { Code, CompileData } from './compile';\n\nexport class VitePluginSvelteCache {\n\tprivate _css = new Map<string, Code>();\n\tprivate _js = new Map<string, Code>();\n\tprivate _dependencies = new Map<string, string[]>();\n\tprivate _dependants = new Map<string, Set<string>>();\n\tprivate _resolvedSvelteFields = new Map<string, string>();\n\tprivate _errors = new Map<string, any>();\n\n\tpublic update(compileData: CompileData) {\n\t\tthis._errors.delete(compileData.normalizedFilename);\n\t\tthis.updateCSS(compileData);\n\t\tthis.updateJS(compileData);\n\t\tthis.updateDependencies(compileData);\n\t}\n\n\tpublic has(svelteRequest: SvelteRequest) {\n\t\tconst id = svelteRequest.normalizedFilename;\n\t\treturn this._errors.has(id) || this._js.has(id) || this._css.has(id);\n\t}\n\n\tpublic setError(svelteRequest: SvelteRequest, error: any) {\n\t\t// keep dependency info, otherwise errors in dependants would not trigger an update after fixing\n\t\t// because they are no longer watched\n\t\tthis.remove(svelteRequest, true);\n\t\tthis._errors.set(svelteRequest.normalizedFilename, error);\n\t}\n\n\tprivate updateCSS(compileData: CompileData) {\n\t\tthis._css.set(compileData.normalizedFilename, compileData.compiled.css);\n\t}\n\n\tprivate updateJS(compileData: CompileData) {\n\t\tif (!compileData.ssr) {\n\t\t\t// do not cache SSR js\n\t\t\tthis._js.set(compileData.normalizedFilename, compileData.compiled.js);\n\t\t}\n\t}\n\n\tprivate updateDependencies(compileData: CompileData) {\n\t\tconst id = compileData.normalizedFilename;\n\t\tconst prevDependencies = this._dependencies.get(id) || [];\n\t\tconst dependencies = compileData.dependencies;\n\t\tthis._dependencies.set(id, dependencies);\n\t\tconst removed = prevDependencies.filter((d) => !dependencies.includes(d));\n\t\tconst added = dependencies.filter((d) => !prevDependencies.includes(d));\n\t\tadded.forEach((d) => {\n\t\t\tif (!this._dependants.has(d)) {\n\t\t\t\tthis._dependants.set(d, new Set<string>());\n\t\t\t}\n\t\t\tthis._dependants.get(d)!.add(compileData.filename);\n\t\t});\n\t\tremoved.forEach((d) => {\n\t\t\tthis._dependants.get(d)!.delete(compileData.filename);\n\t\t});\n\t}\n\n\tpublic remove(svelteRequest: SvelteRequest, keepDependencies: boolean = false): boolean {\n\t\tconst id = svelteRequest.normalizedFilename;\n\t\tlet removed = false;\n\t\tif (this._errors.delete(id)) {\n\t\t\tremoved = true;\n\t\t}\n\t\tif (this._js.delete(id)) {\n\t\t\tremoved = true;\n\t\t}\n\t\tif (this._css.delete(id)) {\n\t\t\tremoved = true;\n\t\t}\n\t\tif (!keepDependencies) {\n\t\t\tconst dependencies = this._dependencies.get(id);\n\t\t\tif (dependencies) {\n\t\t\t\tremoved = true;\n\t\t\t\tdependencies.forEach((d) => {\n\t\t\t\t\tconst dependants = this._dependants.get(d);\n\t\t\t\t\tif (dependants && dependants.has(svelteRequest.filename)) {\n\t\t\t\t\t\tdependants.delete(svelteRequest.filename);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tthis._dependencies.delete(id);\n\t\t\t}\n\t\t}\n\n\t\treturn removed;\n\t}\n\n\tpublic getCSS(svelteRequest: SvelteRequest) {\n\t\treturn this._css.get(svelteRequest.normalizedFilename);\n\t}\n\n\tpublic getJS(svelteRequest: SvelteRequest) {\n\t\tif (!svelteRequest.ssr) {\n\t\t\t// SSR js isn't cached\n\t\t\treturn this._js.get(svelteRequest.normalizedFilename);\n\t\t}\n\t}\n\n\tpublic getError(svelteRequest: SvelteRequest) {\n\t\treturn this._errors.get(svelteRequest.normalizedFilename);\n\t}\n\n\tpublic getDependants(path: string): string[] {\n\t\tconst dependants = this._dependants.get(path);\n\t\treturn dependants ? [...dependants] : [];\n\t}\n\n\tpublic getResolvedSvelteField(name: string, importer?: string): string | void {\n\t\treturn this._resolvedSvelteFields.get(this._getResolvedSvelteFieldKey(name, importer));\n\t}\n\n\tpublic setResolvedSvelteField(\n\t\timportee: string,\n\t\timporter: string | undefined = undefined,\n\t\tresolvedSvelte: string\n\t) {\n\t\tthis._resolvedSvelteFields.set(\n\t\t\tthis._getResolvedSvelteFieldKey(importee, importer),\n\t\t\tresolvedSvelte\n\t\t);\n\t}\n\n\tprivate _getResolvedSvelteFieldKey(importee: string, importer?: string): string {\n\t\treturn importer ? `${importer} > ${importee}` : importee;\n\t}\n}\n","import { VitePluginSvelteCache } from './vite-plugin-svelte-cache';\nimport fs from 'fs';\nimport { log } from './log';\nimport { IdParser } from './id';\nimport { ResolvedOptions } from './options';\nimport { knownSvelteConfigNames } from './load-svelte-config';\nimport path from 'path';\nimport { FSWatcher } from 'vite';\n\nexport function setupWatchers(\n\toptions: ResolvedOptions,\n\tcache: VitePluginSvelteCache,\n\trequestParser: IdParser\n) {\n\tconst { server, configFile: svelteConfigFile } = options;\n\tif (!server) {\n\t\treturn;\n\t}\n\tconst { watcher, ws } = server;\n\tconst { root, server: serverConfig } = server.config;\n\n\tconst emitChangeEventOnDependants = (filename: string) => {\n\t\tconst dependants = cache.getDependants(filename);\n\t\tdependants.forEach((dependant) => {\n\t\t\tif (fs.existsSync(dependant)) {\n\t\t\t\tlog.debug(\n\t\t\t\t\t`emitting virtual change event for \"${dependant}\" because depdendency \"${filename}\" changed`\n\t\t\t\t);\n\t\t\t\twatcher.emit('change', dependant);\n\t\t\t}\n\t\t});\n\t};\n\n\tconst removeUnlinkedFromCache = (filename: string) => {\n\t\tconst svelteRequest = requestParser(filename, false);\n\t\tif (svelteRequest) {\n\t\t\tconst removedFromCache = cache.remove(svelteRequest);\n\t\t\tif (removedFromCache) {\n\t\t\t\tlog.debug(`cleared VitePluginSvelteCache for deleted file ${filename}`);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst triggerViteRestart = (filename: string) => {\n\t\tif (serverConfig.middlewareMode) {\n\t\t\t// in middlewareMode we can't restart the server automatically\n\t\t\t// show the user an overlay instead\n\t\t\tconst message =\n\t\t\t\t'Svelte config change detected, restart your dev process to apply the changes.';\n\t\t\tlog.info(message, filename);\n\t\t\tws.send({\n\t\t\t\ttype: 'error',\n\t\t\t\terr: { message, stack: '', plugin: 'vite-plugin-svelte', id: filename }\n\t\t\t});\n\t\t} else {\n\t\t\tlog.info(`svelte config changed: restarting vite server. - file: ${filename}`);\n\t\t\tserver.restart();\n\t\t}\n\t};\n\n\t// collection of watcher listeners by event\n\tconst listenerCollection = {\n\t\tadd: [] as Array<Function>,\n\t\tchange: [emitChangeEventOnDependants],\n\t\tunlink: [removeUnlinkedFromCache, emitChangeEventOnDependants]\n\t};\n\n\tif (svelteConfigFile !== false) {\n\t\t// configFile false means we ignore the file and external process is responsible\n\t\tconst possibleSvelteConfigs = knownSvelteConfigNames.map((cfg) => path.join(root, cfg));\n\t\tconst restartOnConfigAdd = (filename: string) => {\n\t\t\tif (possibleSvelteConfigs.includes(filename)) {\n\t\t\t\ttriggerViteRestart(filename);\n\t\t\t}\n\t\t};\n\n\t\tconst restartOnConfigChange = (filename: string) => {\n\t\t\tif (filename === svelteConfigFile) {\n\t\t\t\ttriggerViteRestart(filename);\n\t\t\t}\n\t\t};\n\n\t\tif (svelteConfigFile) {\n\t\t\tlistenerCollection.change.push(restartOnConfigChange);\n\t\t\tlistenerCollection.unlink.push(restartOnConfigChange);\n\t\t} else {\n\t\t\tlistenerCollection.add.push(restartOnConfigAdd);\n\t\t}\n\t}\n\n\tObject.entries(listenerCollection).forEach(([evt, listeners]) => {\n\t\tif (listeners.length > 0) {\n\t\t\twatcher.on(evt, (filename) => listeners.forEach((listener) => listener(filename)));\n\t\t}\n\t});\n}\n// taken from vite utils\nexport function ensureWatchedFile(watcher: FSWatcher, file: string | null, root: string): void {\n\tif (\n\t\tfile &&\n\t\t// only need to watch if out of root\n\t\t!file.startsWith(root + '/') &&\n\t\t// some rollup plugins use null bytes for private resolved Ids\n\t\t!file.includes('\\0') &&\n\t\tfs.existsSync(file)\n\t) {\n\t\t// resolve file to normalized system path\n\t\twatcher.add(path.resolve(file));\n\t}\n}\n","import path from 'path';\nimport { builtinModules, createRequire } from 'module';\nimport { is_common_without_svelte_field, resolveDependencyData } from './dependencies';\nimport { VitePluginSvelteCache } from './vite-plugin-svelte-cache';\n\nexport function resolveViaPackageJsonSvelte(\n\timportee: string,\n\timporter: string | undefined,\n\tcache: VitePluginSvelteCache\n): string | void {\n\tif (\n\t\timporter &&\n\t\tisBareImport(importee) &&\n\t\t!isNodeInternal(importee) &&\n\t\t!is_common_without_svelte_field(importee)\n\t) {\n\t\tconst cached = cache.getResolvedSvelteField(importee, importer);\n\t\tif (cached) {\n\t\t\treturn cached;\n\t\t}\n\t\tconst localRequire = createRequire(importer);\n\t\tconst pkgData = resolveDependencyData(importee, localRequire);\n\t\tif (pkgData) {\n\t\t\tconst { pkg, dir } = pkgData;\n\t\t\tif (pkg.svelte) {\n\t\t\t\tconst result = path.resolve(dir, pkg.svelte);\n\t\t\t\tcache.setResolvedSvelteField(importee, importer, result);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction isNodeInternal(importee: string) {\n\treturn importee.startsWith('node:') || builtinModules.includes(importee);\n}\n\nfunction isBareImport(importee: string): boolean {\n\tif (\n\t\t!importee ||\n\t\timportee[0] === '.' ||\n\t\timportee[0] === '\\0' ||\n\t\timportee.includes(':') ||\n\t\tpath.isAbsolute(importee)\n\t) {\n\t\treturn false;\n\t}\n\tconst parts = importee.split('/');\n\tswitch (parts.length) {\n\t\tcase 1:\n\t\t\treturn true;\n\t\tcase 2:\n\t\t\treturn parts[0].startsWith('@');\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n","import { promises as fs } from 'fs';\nimport path from 'path';\nimport { ResolvedOptions } from './options';\n\n// List of options that changes the prebundling result\nconst PREBUNDLE_SENSITIVE_OPTIONS: (keyof ResolvedOptions)[] = [\n\t'compilerOptions',\n\t'configFile',\n\t'experimental',\n\t'extensions',\n\t'ignorePluginPreprocessors',\n\t'preprocess'\n];\n\n/**\n * @returns Whether the Svelte metadata has changed\n */\nexport async function saveSvelteMetadata(cacheDir: string, options: ResolvedOptions) {\n\tconst svelteMetadata = generateSvelteMetadata(options);\n\tconst svelteMetadataPath = path.resolve(cacheDir, '_svelte_metadata.json');\n\n\tconst currentSvelteMetadata = JSON.stringify(svelteMetadata, (_, value) => {\n\t\t// Handle preprocessors\n\t\treturn typeof value === 'function' ? value.toString() : value;\n\t});\n\n\tlet existingSvelteMetadata: string | undefined;\n\ttry {\n\t\texistingSvelteMetadata = await fs.readFile(svelteMetadataPath, 'utf8');\n\t} catch {\n\t\t// ignore\n\t}\n\n\tawait fs.mkdir(cacheDir, { recursive: true });\n\tawait fs.writeFile(svelteMetadataPath, currentSvelteMetadata);\n\treturn currentSvelteMetadata !== existingSvelteMetadata;\n}\n\nfunction generateSvelteMetadata(options: ResolvedOptions) {\n\tconst metadata: Record<string, any> = {};\n\tfor (const key of PREBUNDLE_SENSITIVE_OPTIONS) {\n\t\tmetadata[key] = options[key];\n\t}\n\treturn metadata;\n}\n","import { Plugin, normalizePath } from 'vite';\nimport { log } from '../../utils/log';\nimport { InspectorOptions } from '../../utils/options';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport fs from 'fs';\n\nconst defaultInspectorOptions: InspectorOptions = {\n\ttoggleKeyCombo: process.platform === 'win32' ? 'control-shift' : 'meta-shift',\n\tholdMode: false,\n\tshowToggleButton: 'active',\n\ttoggleButtonPos: 'top-right',\n\tcustomStyles: true\n};\n\nfunction getInspectorPath() {\n\tconst pluginPath = normalizePath(path.dirname(fileURLToPath(import.meta.url)));\n\treturn pluginPath.replace(/\\/vite-plugin-svelte\\/dist$/, '/vite-plugin-svelte/src/ui/inspector/');\n}\n\nexport function svelteInspector(): Plugin {\n\tconst inspectorPath = getInspectorPath();\n\tlog.debug.enabled && log.debug(`svelte inspector path: ${inspectorPath}`);\n\tlet inspectorOptions: InspectorOptions;\n\tlet appendTo: string | undefined;\n\tlet disabled = false;\n\n\treturn {\n\t\tname: 'vite-plugin-svelte:inspector',\n\t\tapply: 'serve',\n\t\tenforce: 'pre',\n\n\t\tconfigResolved(config) {\n\t\t\tconst vps = config.plugins.find((p) => p.name === 'vite-plugin-svelte');\n\t\t\tif (vps?.api?.options?.experimental?.inspector) {\n\t\t\t\tinspectorOptions = {\n\t\t\t\t\t...defaultInspectorOptions,\n\t\t\t\t\t...vps.api.options.experimental.inspector\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!vps || !inspectorOptions) {\n\t\t\t\tlog.debug('inspector disabled, could not find config');\n\t\t\t\tdisabled = true;\n\t\t\t} else {\n\t\t\t\tif (vps.api.options.kit && !inspectorOptions.appendTo) {\n\t\t\t\t\tconst out_dir = path.basename(vps.api.options.kit.outDir || '.svelte-kit');\n\t\t\t\t\tinspectorOptions.appendTo = `${out_dir}/runtime/client/start.js`;\n\t\t\t\t}\n\t\t\t\tappendTo = inspectorOptions.appendTo;\n\t\t\t}\n\t\t},\n\n\t\tasync resolveId(importee: string, importer, options) {\n\t\t\tif (options?.ssr || disabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (importee.startsWith('virtual:svelte-inspector-options')) {\n\t\t\t\treturn importee;\n\t\t\t} else if (importee.startsWith('virtual:svelte-inspector-path:')) {\n\t\t\t\tconst resolved = importee.replace('virtual:svelte-inspector-path:', inspectorPath);\n\t\t\t\tlog.debug.enabled && log.debug(`resolved ${importee} with ${resolved}`);\n\t\t\t\treturn resolved;\n\t\t\t}\n\t\t},\n\n\t\tasync load(id, options) {\n\t\t\tif (options?.ssr || disabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (id === 'virtual:svelte-inspector-options') {\n\t\t\t\treturn `export default ${JSON.stringify(inspectorOptions ?? {})}`;\n\t\t\t} else if (id.startsWith(inspectorPath)) {\n\t\t\t\t// read file ourselves to avoid getting shut out by vites fs.allow check\n\t\t\t\treturn await fs.promises.readFile(id, 'utf-8');\n\t\t\t}\n\t\t},\n\n\t\ttransform(code: string, id: string, options?: { ssr?: boolean }) {\n\t\t\tif (options?.ssr || disabled || !appendTo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (id.endsWith(appendTo)) {\n\t\t\t\treturn { code: `${code}\\nimport 'virtual:svelte-inspector-path:load-inspector.js'` };\n\t\t\t}\n\t\t},\n\t\ttransformIndexHtml(html) {\n\t\t\tif (disabled || appendTo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\thtml,\n\t\t\t\ttags: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'script',\n\t\t\t\t\t\tinjectTo: 'body',\n\t\t\t\t\t\tattrs: {\n\t\t\t\t\t\t\ttype: 'module',\n\t\t\t\t\t\t\t// /@id/ is needed, otherwise the virtual: is seen as protocol by browser and cors error happens\n\t\t\t\t\t\t\tsrc: '/@id/virtual:svelte-inspector-path:load-inspector.js'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t};\n\t\t}\n\t};\n}\n"],"mappings":";;;;;;;;;AAAA;;;ACCA;AACA;AAIA,IAAM,SAAmB,CAAC,SAAS,QAAQ,QAAQ,SAAS,QAAQ;AACpE,IAAM,SAAS;AACf,IAAM,UAAkC;AAAA,EACvC,OAAO;AAAA,IACN,KAAK,MAAM,QAAQ,QAAQ;AAAA,IAC3B,SAAS;AAAA,IACT,SAAS;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACL,OAAO;AAAA,IACP,KAAK,QAAQ;AAAA,IACb,SAAS;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACL,OAAO;AAAA,IACP,KAAK,QAAQ;AAAA,IACb,SAAS;AAAA,EACV;AAAA,EACA,OAAO;AAAA,IACN,OAAO;AAAA,IACP,KAAK,QAAQ;AAAA,IACb,SAAS;AAAA,EACV;AAAA,EACA,QAAQ;AAAA,IACP,SAAS;AAAA,EACV;AACD;AAEA,IAAI,SAAiB;AACrB,kBAAkB,OAAe;AAChC,MAAI,UAAU,QAAQ;AACrB;AAAA,EACD;AACA,QAAM,aAAa,OAAO,QAAQ,KAAK;AACvC,MAAI,aAAa,IAAI;AACpB,aAAS;AACT,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACvC,cAAQ,OAAO,IAAI,UAAU,KAAK;AAAA,IACnC;AAAA,EACD,OAAO;AACN,SAAK,QAAQ,OAAO,sBAAsB,QAAQ;AAAA,EACnD;AACD;AAEA,cAAc,QAAa,SAAiB,SAAe;AAC1D,MAAI,CAAC,OAAO,SAAS;AACpB;AAAA,EACD;AACA,MAAI,OAAO,SAAS;AACnB,gBAA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,OAAO;AAAA,UACzE,SAAS,GAAP;AACD,kBAAM,cAAc,GAAG,OAAO;AAAA,UAC/B;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACA,UAAQ,KAAK,gBAAgB,CAAC;AAC9B,SAAO,QAAQ,OAAO,OAAO;AAC9B;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/log.ts","../src/handle-hot-update.ts","../src/utils/compile.ts","../src/utils/hash.ts","../src/utils/id.ts","../src/utils/options.ts","../src/utils/load-svelte-config.ts","../src/utils/constants.ts","../src/utils/dependencies.ts","../src/utils/esbuild.ts","../src/utils/error.ts","../src/utils/preprocess.ts","../src/utils/sourcemap.ts","../src/utils/vite-plugin-svelte-cache.ts","../src/utils/watch.ts","../src/utils/resolve.ts","../src/utils/optimizer.ts","../src/ui/inspector/plugin.ts","../src/ui/inspector/utils.ts"],"sourcesContent":["import fs from 'fs';\nimport { HmrContext, ModuleNode, Plugin, ResolvedConfig, UserConfig } from 'vite';\nimport { handleHotUpdate } from './handle-hot-update';\nimport { log, logCompilerWarnings } from './utils/log';\nimport { CompileData, createCompileSvelte } from './utils/compile';\nimport { buildIdParser, IdParser, SvelteRequest } from './utils/id';\nimport {\n\tbuildExtraViteConfig,\n\tvalidateInlineOptions,\n\tOptions,\n\tResolvedOptions,\n\tresolveOptions,\n\tpatchResolvedViteConfig,\n\tpreResolveOptions\n} from './utils/options';\nimport { VitePluginSvelteCache } from './utils/vite-plugin-svelte-cache';\n\nimport { ensureWatchedFile, setupWatchers } from './utils/watch';\nimport { resolveViaPackageJsonSvelte } from './utils/resolve';\nimport { PartialResolvedId } from 'rollup';\nimport { toRollupError } from './utils/error';\nimport { saveSvelteMetadata } from './utils/optimizer';\nimport { svelteInspector } from './ui/inspector/plugin';\n\ninterface PluginAPI {\n\t/**\n\t * must not be modified, should not be used outside of vite-plugin-svelte repo\n\t * @internal\n\t * @experimental\n\t */\n\toptions?: ResolvedOptions;\n\t// TODO expose compile cache here so other utility plugins can use it\n}\n\nexport function svelte(inlineOptions?: Partial<Options>): Plugin[] {\n\tif (process.env.DEBUG != null) {\n\t\tlog.setLevel('debug');\n\t}\n\tvalidateInlineOptions(inlineOptions);\n\tconst cache = new VitePluginSvelteCache();\n\t// updated in configResolved hook\n\tlet requestParser: IdParser;\n\tlet options: ResolvedOptions;\n\tlet viteConfig: ResolvedConfig;\n\t/* eslint-disable no-unused-vars */\n\tlet compileSvelte: (\n\t\tsvelteRequest: SvelteRequest,\n\t\tcode: string,\n\t\toptions: Partial<ResolvedOptions>\n\t) => Promise<CompileData>;\n\t/* eslint-enable no-unused-vars */\n\n\tlet resolvedSvelteSSR: Promise<PartialResolvedId | null>;\n\tconst api: PluginAPI = {};\n\tconst plugins: Plugin[] = [\n\t\t{\n\t\t\tname: 'vite-plugin-svelte',\n\t\t\t// make sure our resolver runs before vite internal resolver to resolve svelte field correctly\n\t\t\tenforce: 'pre',\n\t\t\tapi,\n\t\t\tasync config(config, configEnv): Promise<Partial<UserConfig>> {\n\t\t\t\t// setup logger\n\t\t\t\tif (process.env.DEBUG) {\n\t\t\t\t\tlog.setLevel('debug');\n\t\t\t\t} else if (config.logLevel) {\n\t\t\t\t\tlog.setLevel(config.logLevel);\n\t\t\t\t}\n\t\t\t\t// @ts-expect-error temporarily lend the options variable until fixed in configResolved\n\t\t\t\toptions = await preResolveOptions(inlineOptions, config, configEnv);\n\t\t\t\t// extra vite config\n\t\t\t\tconst extraViteConfig = buildExtraViteConfig(options, config);\n\t\t\t\tlog.debug('additional vite config', extraViteConfig);\n\t\t\t\treturn extraViteConfig;\n\t\t\t},\n\n\t\t\tasync configResolved(config) {\n\t\t\t\toptions = resolveOptions(options, config);\n\t\t\t\tpatchResolvedViteConfig(config, options);\n\t\t\t\trequestParser = buildIdParser(options);\n\t\t\t\tcompileSvelte = createCompileSvelte(options);\n\t\t\t\tviteConfig = config;\n\t\t\t\t// TODO deep clone to avoid mutability from outside?\n\t\t\t\tapi.options = options;\n\t\t\t\tlog.debug('resolved options', options);\n\t\t\t},\n\n\t\t\tasync buildStart() {\n\t\t\t\tif (!options.experimental?.prebundleSvelteLibraries) return;\n\t\t\t\tconst isSvelteMetadataChanged = await saveSvelteMetadata(viteConfig.cacheDir, options);\n\t\t\t\tif (isSvelteMetadataChanged) {\n\t\t\t\t\t// Force Vite to optimize again. Although we mutate the config here, it works because\n\t\t\t\t\t// Vite's optimizer runs after `buildStart()`.\n\t\t\t\t\t// TODO: verify this works in vite3\n\t\t\t\t\tviteConfig.optimizeDeps.force = true;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tconfigureServer(server) {\n\t\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\t\toptions.server = server;\n\t\t\t\tsetupWatchers(options, cache, requestParser);\n\t\t\t},\n\n\t\t\tload(id, opts) {\n\t\t\t\tconst ssr = !!opts?.ssr;\n\t\t\t\tconst svelteRequest = requestParser(id, !!ssr);\n\t\t\t\tif (svelteRequest) {\n\t\t\t\t\tconst { filename, query } = svelteRequest;\n\t\t\t\t\t// virtual css module\n\t\t\t\t\tif (query.svelte && query.type === 'style') {\n\t\t\t\t\t\tconst css = cache.getCSS(svelteRequest);\n\t\t\t\t\t\tif (css) {\n\t\t\t\t\t\t\tlog.debug(`load returns css for ${filename}`);\n\t\t\t\t\t\t\treturn css;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// prevent vite asset plugin from loading files as url that should be compiled in transform\n\t\t\t\t\tif (viteConfig.assetsInclude(filename)) {\n\t\t\t\t\t\tlog.debug(`load returns raw content for ${filename}`);\n\t\t\t\t\t\treturn fs.readFileSync(filename, 'utf-8');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tasync resolveId(importee, importer, opts) {\n\t\t\t\tconst ssr = !!opts?.ssr;\n\t\t\t\tconst svelteRequest = requestParser(importee, ssr);\n\t\t\t\tif (svelteRequest?.query.svelte) {\n\t\t\t\t\tif (svelteRequest.query.type === 'style') {\n\t\t\t\t\t\t// return cssId with root prefix so postcss pipeline of vite finds the directory correctly\n\t\t\t\t\t\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/14\n\t\t\t\t\t\tlog.debug(`resolveId resolved virtual css module ${svelteRequest.cssId}`);\n\t\t\t\t\t\treturn svelteRequest.cssId;\n\t\t\t\t\t}\n\t\t\t\t\tlog.debug(`resolveId resolved ${importee}`);\n\t\t\t\t\treturn importee; // query with svelte tag, an id we generated, no need for further analysis\n\t\t\t\t}\n\n\t\t\t\tif (ssr && importee === 'svelte') {\n\t\t\t\t\tif (!resolvedSvelteSSR) {\n\t\t\t\t\t\tresolvedSvelteSSR = this.resolve('svelte/ssr', undefined, { skipSelf: true }).then(\n\t\t\t\t\t\t\t(svelteSSR) => {\n\t\t\t\t\t\t\t\tlog.debug('resolved svelte to svelte/ssr');\n\t\t\t\t\t\t\t\treturn svelteSSR;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(err) => {\n\t\t\t\t\t\t\t\tlog.debug(\n\t\t\t\t\t\t\t\t\t'failed to resolve svelte to svelte/ssr. Update svelte to a version that exports it',\n\t\t\t\t\t\t\t\t\terr\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn null; // returning null here leads to svelte getting resolved regularly\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn resolvedSvelteSSR;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst resolved = resolveViaPackageJsonSvelte(importee, importer, cache);\n\t\t\t\t\tif (resolved) {\n\t\t\t\t\t\tlog.debug(\n\t\t\t\t\t\t\t`resolveId resolved ${resolved} via package.json svelte field of ${importee}`\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn resolved;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tlog.debug.once(\n\t\t\t\t\t\t`error trying to resolve ${importee} from ${importer} via package.json svelte field `,\n\t\t\t\t\t\te\n\t\t\t\t\t);\n\t\t\t\t\t// this error most likely happens due to non-svelte related importee/importers so swallow it here\n\t\t\t\t\t// in case it really way a svelte library, users will notice anyway. (lib not working due to failed resolve)\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tasync transform(code, id, opts) {\n\t\t\t\tconst ssr = !!opts?.ssr;\n\t\t\t\tconst svelteRequest = requestParser(id, ssr);\n\t\t\t\tif (!svelteRequest || svelteRequest.query.svelte) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet compileData;\n\t\t\t\ttry {\n\t\t\t\t\tcompileData = await compileSvelte(svelteRequest, code, options);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tcache.setError(svelteRequest, e);\n\t\t\t\t\tthrow toRollupError(e, options);\n\t\t\t\t}\n\t\t\t\tlogCompilerWarnings(svelteRequest, compileData.compiled.warnings, options);\n\t\t\t\tcache.update(compileData);\n\t\t\t\tif (compileData.dependencies?.length && options.server) {\n\t\t\t\t\tcompileData.dependencies.forEach((d) => {\n\t\t\t\t\t\tensureWatchedFile(options.server!.watcher, d, options.root);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tlog.debug(`transform returns compiled js for ${svelteRequest.filename}`);\n\t\t\t\treturn {\n\t\t\t\t\t...compileData.compiled.js,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tvite: {\n\t\t\t\t\t\t\tlang: compileData.lang\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\n\t\t\thandleHotUpdate(ctx: HmrContext): void | Promise<Array<ModuleNode> | void> {\n\t\t\t\tif (!options.hot || !options.emitCss) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst svelteRequest = requestParser(ctx.file, false, ctx.timestamp);\n\t\t\t\tif (svelteRequest) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn handleHotUpdate(compileSvelte, ctx, svelteRequest, cache, options);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthrow toRollupError(e, options);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t];\n\tplugins.push(svelteInspector());\n\treturn plugins.filter(Boolean);\n}\n\nexport { loadSvelteConfig } from './utils/load-svelte-config';\n\nexport {\n\tOptions,\n\tPluginOptions,\n\tSvelteOptions,\n\tPreprocessor,\n\tPreprocessorGroup,\n\tCompileOptions,\n\tCssHashGetter,\n\tArrayable,\n\tMarkupPreprocessor,\n\tModuleFormat,\n\tProcessed,\n\tWarning\n} from './utils/options';\n\nexport { SvelteWarningsMessage } from './utils/log';\n","/* eslint-disable no-unused-vars,no-console */\nimport { cyan, yellow, red } from 'kleur/colors';\nimport debug from 'debug';\nimport { ResolvedOptions, Warning } from './options';\nimport { SvelteRequest } from './id';\n\nconst levels: string[] = ['debug', 'info', 'warn', 'error', 'silent'];\nconst prefix = 'vite-plugin-svelte';\nconst loggers: { [key: string]: any } = {\n\tdebug: {\n\t\tlog: debug(`vite:${prefix}`),\n\t\tenabled: false,\n\t\tisDebug: true\n\t},\n\tinfo: {\n\t\tcolor: cyan,\n\t\tlog: console.log,\n\t\tenabled: true\n\t},\n\twarn: {\n\t\tcolor: yellow,\n\t\tlog: console.warn,\n\t\tenabled: true\n\t},\n\terror: {\n\t\tcolor: red,\n\t\tlog: console.error,\n\t\tenabled: true\n\t},\n\tsilent: {\n\t\tenabled: false\n\t}\n};\n\nlet _level: string = 'info';\nfunction setLevel(level: string) {\n\tif (level === _level) {\n\t\treturn;\n\t}\n\tconst levelIndex = levels.indexOf(level);\n\tif (levelIndex > -1) {\n\t\t_level = level;\n\t\tfor (let i = 0; i < levels.length; i++) {\n\t\t\tloggers[levels[i]].enabled = i >= levelIndex;\n\t\t}\n\t} else {\n\t\t_log(loggers.error, `invalid log level: ${level} `);\n\t}\n}\n\nfunction _log(logger: any, message: string, payload?: any) {\n\tif (!logger.enabled) {\n\t\treturn;\n\t}\n\tif (logger.isDebug) {\n\t\tpayload !== undefined ? logger.log(message, payload) : logger.log(message);\n\t} else {\n\t\tlogger.log(logger.color(`${new Date().toLocaleTimeString()} [${prefix}] ${message}`));\n\t\tif (payload) {\n\t\t\tlogger.log(payload);\n\t\t}\n\t}\n}\n\nexport interface LogFn {\n\t(message: string, payload?: any): void;\n\tenabled: boolean;\n\tonce: (message: string, payload?: any) => void;\n}\n\nfunction createLogger(level: string): LogFn {\n\tconst logger = loggers[level];\n\tconst logFn: LogFn = _log.bind(null, logger) as LogFn;\n\tconst logged = new Set<String>();\n\tconst once = function (message: string, payload?: any) {\n\t\tif (logged.has(message)) {\n\t\t\treturn;\n\t\t}\n\t\tlogged.add(message);\n\t\tlogFn.apply(null, [message, payload]);\n\t};\n\tObject.defineProperty(logFn, 'enabled', {\n\t\tget() {\n\t\t\treturn logger.enabled;\n\t\t}\n\t});\n\tObject.defineProperty(logFn, 'once', {\n\t\tget() {\n\t\t\treturn once;\n\t\t}\n\t});\n\treturn logFn;\n}\n\nexport const log = {\n\tdebug: createLogger('debug'),\n\tinfo: createLogger('info'),\n\twarn: createLogger('warn'),\n\terror: createLogger('error'),\n\tsetLevel\n};\n\nexport type SvelteWarningsMessage = {\n\tid: string;\n\tfilename: string;\n\tnormalizedFilename: string;\n\ttimestamp: number;\n\twarnings: Warning[]; // allWarnings filtered by warnings where onwarn did not call the default handler\n\tallWarnings: Warning[]; // includes warnings filtered by onwarn and our extra vite plugin svelte warnings\n\trawWarnings: Warning[]; // raw compiler output\n};\n\nexport function logCompilerWarnings(\n\tsvelteRequest: SvelteRequest,\n\twarnings: Warning[],\n\toptions: ResolvedOptions\n) {\n\tconst { emitCss, onwarn, isBuild } = options;\n\tconst sendViaWS = !isBuild && options.experimental?.sendWarningsToBrowser;\n\tlet warn = isBuild ? warnBuild : warnDev;\n\tconst handledByDefaultWarn: Warning[] = [];\n\tconst notIgnored = warnings?.filter((w) => !ignoreCompilerWarning(w, isBuild, emitCss));\n\tconst extra = buildExtraWarnings(warnings, isBuild);\n\tconst allWarnings = [...notIgnored, ...extra];\n\tif (sendViaWS) {\n\t\tconst _warn = warn;\n\t\twarn = (w: Warning) => {\n\t\t\thandledByDefaultWarn.push(w);\n\t\t\t_warn(w);\n\t\t};\n\t}\n\tallWarnings.forEach((warning) => {\n\t\tif (onwarn) {\n\t\t\tonwarn(warning, warn);\n\t\t} else {\n\t\t\twarn(warning);\n\t\t}\n\t});\n\tif (sendViaWS) {\n\t\tconst message: SvelteWarningsMessage = {\n\t\t\tid: svelteRequest.id,\n\t\t\tfilename: svelteRequest.filename,\n\t\t\tnormalizedFilename: svelteRequest.normalizedFilename,\n\t\t\ttimestamp: svelteRequest.timestamp,\n\t\t\twarnings: handledByDefaultWarn, // allWarnings filtered by warnings where onwarn did not call the default handler\n\t\t\tallWarnings, // includes warnings filtered by onwarn and our extra vite plugin svelte warnings\n\t\t\trawWarnings: warnings // raw compiler output\n\t\t};\n\t\tlog.debug(`sending svelte:warnings message for ${svelteRequest.normalizedFilename}`);\n\t\toptions.server?.ws?.send('svelte:warnings', message);\n\t}\n}\n\nfunction ignoreCompilerWarning(\n\twarning: Warning,\n\tisBuild: boolean,\n\temitCss: boolean | undefined\n): boolean {\n\treturn (\n\t\t(!emitCss && warning.code === 'css-unused-selector') || // same as rollup-plugin-svelte\n\t\t(!isBuild && isNoScopableElementWarning(warning))\n\t);\n}\n\nfunction isNoScopableElementWarning(warning: Warning) {\n\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/153\n\treturn warning.code === 'css-unused-selector' && warning.message.includes('\"*\"');\n}\n\nfunction buildExtraWarnings(warnings: Warning[], isBuild: boolean): Warning[] {\n\tconst extraWarnings = [];\n\tif (!isBuild) {\n\t\tconst noScopableElementWarnings = warnings.filter((w) => isNoScopableElementWarning(w));\n\t\tif (noScopableElementWarnings.length > 0) {\n\t\t\t// in case there are multiple, use last one as that is the one caused by our *{} rule\n\t\t\tconst noScopableElementWarning =\n\t\t\t\tnoScopableElementWarnings[noScopableElementWarnings.length - 1];\n\t\t\textraWarnings.push({\n\t\t\t\t...noScopableElementWarning,\n\t\t\t\tcode: 'vite-plugin-svelte-css-no-scopable-elements',\n\t\t\t\tmessage: `No scopable elements found in template. If you're using global styles in the style tag, you should move it into an external stylesheet file and import it in JS. See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#where-should-i-put-my-global-styles.`\n\t\t\t});\n\t\t}\n\t}\n\treturn extraWarnings;\n}\n\nfunction warnDev(w: Warning) {\n\tlog.info.enabled && log.info(buildExtendedLogMessage(w));\n}\n\nfunction warnBuild(w: Warning) {\n\tlog.warn.enabled && log.warn(buildExtendedLogMessage(w), w.frame);\n}\n\nexport function buildExtendedLogMessage(w: Warning) {\n\tconst parts = [];\n\tif (w.filename) {\n\t\tparts.push(w.filename);\n\t}\n\tif (w.start) {\n\t\tparts.push(':', w.start.line, ':', w.start.column);\n\t}\n\tif (w.message) {\n\t\tif (parts.length > 0) {\n\t\t\tparts.push(' ');\n\t\t}\n\t\tparts.push(w.message);\n\t}\n\treturn parts.join('');\n}\n","import { ModuleNode, HmrContext } from 'vite';\nimport { Code, CompileData } from './utils/compile';\nimport { log, logCompilerWarnings } from './utils/log';\nimport { SvelteRequest } from './utils/id';\nimport { VitePluginSvelteCache } from './utils/vite-plugin-svelte-cache';\nimport { ResolvedOptions } from './utils/options';\n\n/**\n * Vite-specific HMR handling\n */\nexport async function handleHotUpdate(\n\tcompileSvelte: Function,\n\tctx: HmrContext,\n\tsvelteRequest: SvelteRequest,\n\tcache: VitePluginSvelteCache,\n\toptions: ResolvedOptions\n): Promise<ModuleNode[] | void> {\n\tif (!cache.has(svelteRequest)) {\n\t\t// file hasn't been requested yet (e.g. async component)\n\t\tlog.debug(`handleHotUpdate called before initial transform for ${svelteRequest.id}`);\n\t\treturn;\n\t}\n\tconst { read, server } = ctx;\n\n\tconst cachedJS = cache.getJS(svelteRequest);\n\tconst cachedCss = cache.getCSS(svelteRequest);\n\n\tconst content = await read();\n\tlet compileData: CompileData;\n\ttry {\n\t\tcompileData = await compileSvelte(svelteRequest, content, options);\n\t\tcache.update(compileData);\n\t} catch (e) {\n\t\tcache.setError(svelteRequest, e);\n\t\tthrow e;\n\t}\n\n\tconst affectedModules = new Set<ModuleNode | undefined>();\n\n\tconst cssModule = server.moduleGraph.getModuleById(svelteRequest.cssId);\n\tconst mainModule = server.moduleGraph.getModuleById(svelteRequest.id);\n\tconst cssUpdated = cssModule && cssChanged(cachedCss, compileData.compiled.css);\n\tif (cssUpdated) {\n\t\tlog.debug(`handleHotUpdate css changed for ${svelteRequest.cssId}`);\n\t\taffectedModules.add(cssModule);\n\t}\n\tconst jsUpdated =\n\t\tmainModule && jsChanged(cachedJS, compileData.compiled.js, svelteRequest.filename);\n\tif (jsUpdated) {\n\t\tlog.debug(`handleHotUpdate js changed for ${svelteRequest.id}`);\n\t\taffectedModules.add(mainModule);\n\t}\n\n\tif (!jsUpdated) {\n\t\t// transform won't be called, log warnings here\n\t\tlogCompilerWarnings(svelteRequest, compileData.compiled.warnings, options);\n\t}\n\n\tconst result = [...affectedModules].filter(Boolean) as ModuleNode[];\n\n\t// TODO is this enough? see also: https://github.com/vitejs/vite/issues/2274\n\tconst ssrModulesToInvalidate = result.filter((m) => !!m.ssrTransformResult);\n\tif (ssrModulesToInvalidate.length > 0) {\n\t\tlog.debug(`invalidating modules ${ssrModulesToInvalidate.map((m) => m.id).join(', ')}`);\n\t\tssrModulesToInvalidate.forEach((moduleNode) => server.moduleGraph.invalidateModule(moduleNode));\n\t}\n\tif (result.length > 0) {\n\t\tlog.debug(\n\t\t\t`handleHotUpdate for ${svelteRequest.id} result: ${result.map((m) => m.id).join(', ')}`\n\t\t);\n\t}\n\treturn result;\n}\n\nfunction cssChanged(prev?: Code, next?: Code): boolean {\n\treturn !isCodeEqual(prev?.code, next?.code);\n}\n\nfunction jsChanged(prev?: Code, next?: Code, filename?: string): boolean {\n\tconst prevJs = prev?.code;\n\tconst nextJs = next?.code;\n\tconst isStrictEqual = isCodeEqual(prevJs, nextJs);\n\tif (isStrictEqual) {\n\t\treturn false;\n\t}\n\tconst isLooseEqual = isCodeEqual(normalizeJsCode(prevJs), normalizeJsCode(nextJs));\n\tif (!isStrictEqual && isLooseEqual) {\n\t\tlog.warn(\n\t\t\t`ignoring compiler output js change for ${filename} as it is equal to previous output after normalization`\n\t\t);\n\t}\n\treturn !isLooseEqual;\n}\n\nfunction isCodeEqual(prev?: string, next?: string): boolean {\n\tif (!prev && !next) {\n\t\treturn true;\n\t}\n\tif ((!prev && next) || (prev && !next)) {\n\t\treturn false;\n\t}\n\treturn prev === next;\n}\n\n/**\n * remove code that only changes metadata and does not require a js update for the component to keep working\n *\n * 1) add_location() calls. These add location metadata to elements, only used by some dev tools\n * 2) ... maybe more (or less) in the future\n * @param code\n */\nfunction normalizeJsCode(code?: string): string | undefined {\n\tif (!code) {\n\t\treturn code;\n\t}\n\treturn code.replace(/\\s*\\badd_location\\s*\\([^)]*\\)\\s*;?/g, '');\n}\n","import { CompileOptions, ResolvedOptions } from './options';\nimport { compile, preprocess, walk } from 'svelte/compiler';\n// @ts-ignore\nimport { createMakeHot } from 'svelte-hmr';\nimport { SvelteRequest } from './id';\nimport { safeBase64Hash } from './hash';\nimport { log } from './log';\n\nconst scriptLangRE = /<script [^>]*lang=[\"']?([^\"' >]+)[\"']?[^>]*>/;\n\nconst _createCompileSvelte = (makeHot: Function) =>\n\tasync function compileSvelte(\n\t\tsvelteRequest: SvelteRequest,\n\t\tcode: string,\n\t\toptions: Partial<ResolvedOptions>\n\t): Promise<CompileData> {\n\t\tconst { filename, normalizedFilename, cssId, ssr } = svelteRequest;\n\t\tconst { emitCss = true } = options;\n\t\tconst dependencies = [];\n\n\t\tconst compileOptions: CompileOptions = {\n\t\t\t...options.compilerOptions,\n\t\t\tfilename,\n\t\t\tgenerate: ssr ? 'ssr' : 'dom',\n\t\t\tformat: 'esm'\n\t\t};\n\t\tif (options.hot && options.emitCss) {\n\t\t\tconst hash = `s-${safeBase64Hash(normalizedFilename)}`;\n\t\t\tlog.debug(`setting cssHash ${hash} for ${normalizedFilename}`);\n\t\t\tcompileOptions.cssHash = () => hash;\n\t\t}\n\t\tif (ssr && compileOptions.enableSourcemap !== false) {\n\t\t\tif (typeof compileOptions.enableSourcemap === 'object') {\n\t\t\t\tcompileOptions.enableSourcemap.css = false;\n\t\t\t} else {\n\t\t\t\tcompileOptions.enableSourcemap = { js: true, css: false };\n\t\t\t}\n\t\t}\n\n\t\tlet preprocessed;\n\n\t\tif (options.preprocess) {\n\t\t\ttry {\n\t\t\t\tpreprocessed = await preprocess(code, options.preprocess, { filename });\n\t\t\t} catch (e) {\n\t\t\t\te.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`;\n\t\t\t\tthrow e;\n\t\t\t}\n\n\t\t\tif (preprocessed.dependencies) dependencies.push(...preprocessed.dependencies);\n\t\t\tif (preprocessed.map) compileOptions.sourcemap = preprocessed.map;\n\t\t}\n\t\tconst finalCode = preprocessed ? preprocessed.code : code;\n\t\tconst dynamicCompileOptions = await options.experimental?.dynamicCompileOptions?.({\n\t\t\tfilename,\n\t\t\tcode: finalCode,\n\t\t\tcompileOptions\n\t\t});\n\t\tif (dynamicCompileOptions && log.debug.enabled) {\n\t\t\tlog.debug(\n\t\t\t\t`dynamic compile options for ${filename}: ${JSON.stringify(dynamicCompileOptions)}`\n\t\t\t);\n\t\t}\n\t\tconst finalCompileOptions = dynamicCompileOptions\n\t\t\t? {\n\t\t\t\t\t...compileOptions,\n\t\t\t\t\t...dynamicCompileOptions\n\t\t\t }\n\t\t\t: compileOptions;\n\t\tconst compiled = compile(finalCode, finalCompileOptions);\n\n\t\tif (emitCss && compiled.css.code) {\n\t\t\t// TODO properly update sourcemap?\n\t\t\tcompiled.js.code += `\\nimport ${JSON.stringify(cssId)};\\n`;\n\t\t}\n\n\t\t// only apply hmr when not in ssr context and hot options are set\n\t\tif (!ssr && makeHot) {\n\t\t\tcompiled.js.code = makeHot({\n\t\t\t\tid: filename,\n\t\t\t\tcompiledCode: compiled.js.code,\n\t\t\t\thotOptions: options.hot,\n\t\t\t\tcompiled,\n\t\t\t\toriginalCode: code,\n\t\t\t\tcompileOptions: finalCompileOptions\n\t\t\t});\n\t\t}\n\n\t\tcompiled.js.dependencies = dependencies;\n\n\t\treturn {\n\t\t\tfilename,\n\t\t\tnormalizedFilename,\n\t\t\tlang: code.match(scriptLangRE)?.[1] || 'js',\n\t\t\t// @ts-ignore\n\t\t\tcompiled,\n\t\t\tssr,\n\t\t\tdependencies\n\t\t};\n\t};\n\nfunction buildMakeHot(options: ResolvedOptions) {\n\tconst needsMakeHot = options.hot !== false && options.isServe && !options.isProduction;\n\tif (needsMakeHot) {\n\t\t// @ts-ignore\n\t\tconst hotApi = options?.hot?.hotApi;\n\t\t// @ts-ignore\n\t\tconst adapter = options?.hot?.adapter;\n\t\treturn createMakeHot({\n\t\t\twalk,\n\t\t\thotApi,\n\t\t\tadapter,\n\t\t\thotOptions: { noOverlay: true, ...(options.hot as object) }\n\t\t});\n\t}\n}\n\nexport function createCompileSvelte(options: ResolvedOptions) {\n\tconst makeHot = buildMakeHot(options);\n\treturn _createCompileSvelte(makeHot);\n}\n\nexport interface Code {\n\tcode: string;\n\tmap?: any;\n\tdependencies?: any[];\n}\n\nexport interface Compiled {\n\tjs: Code;\n\tcss: Code;\n\tast: any; // TODO type\n\twarnings: any[]; // TODO type\n\tvars: {\n\t\tname: string;\n\t\texport_name: string;\n\t\tinjected: boolean;\n\t\tmodule: boolean;\n\t\tmutated: boolean;\n\t\treassigned: boolean;\n\t\treferenced: boolean;\n\t\twritable: boolean;\n\t\treferenced_from_script: boolean;\n\t}[];\n\tstats: {\n\t\ttimings: {\n\t\t\ttotal: number;\n\t\t};\n\t};\n}\n\nexport interface CompileData {\n\tfilename: string;\n\tnormalizedFilename: string;\n\tlang: string;\n\tcompiled: Compiled;\n\tssr: boolean | undefined;\n\tdependencies: string[];\n}\n","import * as crypto from 'crypto';\n\nconst hashes = Object.create(null);\n\n//TODO shorter?\nconst hash_length = 12;\n\nexport function safeBase64Hash(input: string) {\n\tif (hashes[input]) {\n\t\treturn hashes[input];\n\t}\n\t//TODO if performance really matters, use a faster one like xx-hash etc.\n\t// should be evenly distributed because short input length and similarities in paths could cause collisions otherwise\n\t// OR DON'T USE A HASH AT ALL, what about a simple counter?\n\tconst md5 = crypto.createHash('md5');\n\tmd5.update(input);\n\tconst hash = toSafe(md5.digest('base64')).slice(0, hash_length);\n\thashes[input] = hash;\n\treturn hash;\n}\n\nconst replacements: { [key: string]: string } = {\n\t'+': '-',\n\t'/': '_',\n\t'=': ''\n};\n\nconst replaceRE = new RegExp(`[${Object.keys(replacements).join('')}]`, 'g');\n\nfunction toSafe(base64: string) {\n\treturn base64.replace(replaceRE, (x) => replacements[x]);\n}\n","/* eslint-disable no-unused-vars */\nimport { createFilter } from '@rollup/pluginutils';\nimport { Arrayable, ResolvedOptions } from './options';\nimport { normalizePath } from 'vite';\nimport * as fs from 'fs';\n\nconst VITE_FS_PREFIX = '/@fs/';\nconst IS_WINDOWS = process.platform === 'win32';\n\nexport type SvelteQueryTypes = 'style' | 'script';\n\nexport interface RequestQuery {\n\t// our own\n\tsvelte?: boolean;\n\ttype?: SvelteQueryTypes;\n\t// vite specific\n\turl?: boolean;\n\traw?: boolean;\n}\n\nexport interface SvelteRequest {\n\tid: string;\n\tcssId: string;\n\tfilename: string;\n\tnormalizedFilename: string;\n\tquery: RequestQuery;\n\ttimestamp: number;\n\tssr: boolean;\n}\n\nfunction splitId(id: string) {\n\tconst parts = id.split(`?`, 2);\n\tconst filename = parts[0];\n\tconst rawQuery = parts[1];\n\treturn { filename, rawQuery };\n}\n\nfunction parseToSvelteRequest(\n\tid: string,\n\tfilename: string,\n\trawQuery: string,\n\troot: string,\n\ttimestamp: number,\n\tssr: boolean\n): SvelteRequest | undefined {\n\tconst query = parseRequestQuery(rawQuery);\n\tif (query.url || query.raw) {\n\t\t// skip requests with special vite tags\n\t\treturn;\n\t}\n\tconst normalizedFilename = normalize(filename, root);\n\tconst cssId = createVirtualImportId(filename, root, 'style');\n\n\treturn {\n\t\tid,\n\t\tfilename,\n\t\tnormalizedFilename,\n\t\tcssId,\n\t\tquery,\n\t\ttimestamp,\n\t\tssr\n\t};\n}\n\nfunction createVirtualImportId(filename: string, root: string, type: SvelteQueryTypes) {\n\tconst parts = ['svelte', `type=${type}`];\n\tif (type === 'style') {\n\t\tparts.push('lang.css');\n\t}\n\tif (existsInRoot(filename, root)) {\n\t\tfilename = root + filename;\n\t} else if (filename.startsWith(VITE_FS_PREFIX)) {\n\t\tfilename = IS_WINDOWS\n\t\t\t? filename.slice(VITE_FS_PREFIX.length) // remove /@fs/ from /@fs/C:/...\n\t\t\t: filename.slice(VITE_FS_PREFIX.length - 1); // remove /@fs from /@fs/home/user\n\t}\n\t// return same virtual id format as vite-plugin-vue eg ...App.svelte?svelte&type=style&lang.css\n\treturn `${filename}?${parts.join('&')}`;\n}\n\nfunction parseRequestQuery(rawQuery: string): RequestQuery {\n\tconst query = Object.fromEntries(new URLSearchParams(rawQuery));\n\tfor (const key in query) {\n\t\tif (query[key] === '') {\n\t\t\t// @ts-ignore\n\t\t\tquery[key] = true;\n\t\t}\n\t}\n\treturn query as RequestQuery;\n}\n\n/**\n * posixify and remove root at start\n *\n * @param filename\n * @param normalizedRoot\n */\nfunction normalize(filename: string, normalizedRoot: string) {\n\treturn stripRoot(normalizePath(filename), normalizedRoot);\n}\n\nfunction existsInRoot(filename: string, root: string) {\n\tif (filename.startsWith(VITE_FS_PREFIX)) {\n\t\treturn false; // vite already tagged it as out of root\n\t}\n\treturn fs.existsSync(root + filename);\n}\n\nfunction stripRoot(normalizedFilename: string, normalizedRoot: string) {\n\treturn normalizedFilename.startsWith(normalizedRoot + '/')\n\t\t? normalizedFilename.slice(normalizedRoot.length)\n\t\t: normalizedFilename;\n}\n\nfunction buildFilter(\n\tinclude: Arrayable<string> | undefined,\n\texclude: Arrayable<string> | undefined,\n\textensions: string[]\n): (filename: string) => boolean {\n\tconst rollupFilter = createFilter(include, exclude);\n\treturn (filename) => rollupFilter(filename) && extensions.some((ext) => filename.endsWith(ext));\n}\n\nexport type IdParser = (id: string, ssr: boolean, timestamp?: number) => SvelteRequest | undefined;\nexport function buildIdParser(options: ResolvedOptions): IdParser {\n\tconst { include, exclude, extensions, root } = options;\n\tconst normalizedRoot = normalizePath(root);\n\tconst filter = buildFilter(include, exclude, extensions!);\n\treturn (id, ssr, timestamp = Date.now()) => {\n\t\tconst { filename, rawQuery } = splitId(id);\n\t\tif (filter(filename)) {\n\t\t\treturn parseToSvelteRequest(id, filename, rawQuery, normalizedRoot, timestamp, ssr);\n\t\t}\n\t};\n}\n","/* eslint-disable no-unused-vars */\nimport {\n\tConfigEnv,\n\tDepOptimizationOptions,\n\tResolvedConfig,\n\tUserConfig,\n\tViteDevServer,\n\tnormalizePath\n} from 'vite';\nimport { log } from './log';\nimport { loadSvelteConfig } from './load-svelte-config';\nimport { SVELTE_HMR_IMPORTS, SVELTE_IMPORTS, SVELTE_RESOLVE_MAIN_FIELDS } from './constants';\n// eslint-disable-next-line node/no-missing-import\nimport type { CompileOptions, Warning } from 'svelte/types/compiler/interfaces';\nimport type {\n\tMarkupPreprocessor,\n\tPreprocessor,\n\tPreprocessorGroup,\n\tProcessed\n\t// eslint-disable-next-line node/no-missing-import\n} from 'svelte/types/compiler/preprocess';\n\nimport path from 'path';\nimport { findRootSvelteDependencies, needsOptimization, SvelteDependency } from './dependencies';\nimport { createRequire } from 'module';\nimport { esbuildSveltePlugin, facadeEsbuildSveltePluginName } from './esbuild';\nimport { addExtraPreprocessors } from './preprocess';\nimport deepmerge from 'deepmerge';\n\nconst allowedPluginOptions = new Set([\n\t'include',\n\t'exclude',\n\t'emitCss',\n\t'hot',\n\t'ignorePluginPreprocessors',\n\t'disableDependencyReinclusion',\n\t'experimental'\n]);\n\nconst knownRootOptions = new Set(['extensions', 'compilerOptions', 'preprocess', 'onwarn']);\n\nconst allowedInlineOptions = new Set([\n\t'configFile',\n\t'kit', // only for internal use by sveltekit\n\t...allowedPluginOptions,\n\t...knownRootOptions\n]);\n\nexport function validateInlineOptions(inlineOptions?: Partial<Options>) {\n\tconst invalidKeys = Object.keys(inlineOptions || {}).filter(\n\t\t(key) => !allowedInlineOptions.has(key)\n\t);\n\tif (invalidKeys.length) {\n\t\tlog.warn(`invalid plugin options \"${invalidKeys.join(', ')}\" in inline config`, inlineOptions);\n\t}\n}\n\nfunction convertPluginOptions(config?: Partial<SvelteOptions>): Partial<Options> | undefined {\n\tif (!config) {\n\t\treturn;\n\t}\n\tconst invalidRootOptions = Object.keys(config).filter((key) => allowedPluginOptions.has(key));\n\tif (invalidRootOptions.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid options in svelte config. Move the following options into 'vitePlugin:{...}': ${invalidRootOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t}\n\tif (!config.vitePlugin) {\n\t\treturn config;\n\t}\n\tconst pluginOptions = config.vitePlugin;\n\tconst pluginOptionKeys = Object.keys(pluginOptions);\n\n\tconst rootOptionsInPluginOptions = pluginOptionKeys.filter((key) => knownRootOptions.has(key));\n\tif (rootOptionsInPluginOptions.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid options in svelte config under vitePlugin:{...}', move them to the config root : ${rootOptionsInPluginOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t}\n\tconst duplicateOptions = pluginOptionKeys.filter((key) =>\n\t\tObject.prototype.hasOwnProperty.call(config, key)\n\t);\n\tif (duplicateOptions.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid duplicate options in svelte config under vitePlugin:{...}', they are defined in root too and must only exist once: ${duplicateOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t}\n\tconst unknownPluginOptions = pluginOptionKeys.filter((key) => !allowedPluginOptions.has(key));\n\tif (unknownPluginOptions.length > 0) {\n\t\tlog.warn(\n\t\t\t`ignoring unknown plugin options in svelte config under vitePlugin:{...}: ${unknownPluginOptions.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t\tunknownPluginOptions.forEach((unkownOption) => {\n\t\t\t// @ts-ignore\n\t\t\tdelete pluginOptions[unkownOption];\n\t\t});\n\t}\n\n\tconst result: Options = {\n\t\t...config,\n\t\t...pluginOptions\n\t};\n\t// @ts-expect-error it exists\n\tdelete result.vitePlugin;\n\n\treturn result;\n}\n\n// used in config phase, merges the default options, svelte config, and inline options\nexport async function preResolveOptions(\n\tinlineOptions: Partial<Options> = {},\n\tviteUserConfig: UserConfig,\n\tviteEnv: ConfigEnv\n): Promise<PreResolvedOptions> {\n\tconst viteConfigWithResolvedRoot: UserConfig = {\n\t\t...viteUserConfig,\n\t\troot: resolveViteRoot(viteUserConfig)\n\t};\n\tconst defaultOptions: Partial<Options> = {\n\t\textensions: ['.svelte'],\n\t\temitCss: true\n\t};\n\tconst svelteConfig = convertPluginOptions(\n\t\tawait loadSvelteConfig(viteConfigWithResolvedRoot, inlineOptions)\n\t);\n\n\tconst extraOptions: Partial<PreResolvedOptions> = {\n\t\troot: viteConfigWithResolvedRoot.root!,\n\t\tisBuild: viteEnv.command === 'build',\n\t\tisServe: viteEnv.command === 'serve',\n\t\tisDebug: process.env.DEBUG != null\n\t};\n\tconst merged = mergeConfigs<PreResolvedOptions>(\n\t\tdefaultOptions,\n\t\tsvelteConfig,\n\t\tinlineOptions,\n\t\textraOptions\n\t);\n\t// configFile of svelteConfig contains the absolute path it was loaded from,\n\t// prefer it over the possibly relative inline path\n\tif (svelteConfig?.configFile) {\n\t\tmerged.configFile = svelteConfig.configFile;\n\t}\n\treturn merged;\n}\n\nfunction mergeConfigs<T>(...configs: (Partial<T> | undefined)[]): T {\n\tlet result: Partial<T> = {};\n\tfor (const config of configs.filter((x) => x != null)) {\n\t\tresult = deepmerge<T>(result, config!, {\n\t\t\t// replace arrays\n\t\t\tarrayMerge: (target: any[], source: any[]) => source ?? target\n\t\t});\n\t}\n\treturn result as T;\n}\n\n// used in configResolved phase, merges a contextual default config, pre-resolved options, and some preprocessors.\n// also validates the final config.\nexport function resolveOptions(\n\tpreResolveOptions: PreResolvedOptions,\n\tviteConfig: ResolvedConfig\n): ResolvedOptions {\n\tconst defaultOptions: Partial<Options> = {\n\t\thot: viteConfig.isProduction ? false : { injectCss: !preResolveOptions.emitCss },\n\t\tcompilerOptions: {\n\t\t\tcss: !preResolveOptions.emitCss,\n\t\t\tdev: !viteConfig.isProduction\n\t\t}\n\t};\n\tconst extraOptions: Partial<ResolvedOptions> = {\n\t\troot: viteConfig.root,\n\t\tisProduction: viteConfig.isProduction\n\t};\n\tconst merged = mergeConfigs<ResolvedOptions>(defaultOptions, preResolveOptions, extraOptions);\n\n\tremoveIgnoredOptions(merged);\n\taddSvelteKitOptions(merged);\n\taddExtraPreprocessors(merged, viteConfig);\n\tenforceOptionsForHmr(merged);\n\tenforceOptionsForProduction(merged);\n\treturn merged;\n}\n\nfunction enforceOptionsForHmr(options: ResolvedOptions) {\n\tif (options.hot) {\n\t\tif (!options.compilerOptions.dev) {\n\t\t\tlog.warn('hmr is enabled but compilerOptions.dev is false, forcing it to true');\n\t\t\toptions.compilerOptions.dev = true;\n\t\t}\n\t\tif (options.emitCss) {\n\t\t\tif (options.hot !== true && options.hot.injectCss) {\n\t\t\t\tlog.warn('hmr and emitCss are enabled but hot.injectCss is true, forcing it to false');\n\t\t\t\toptions.hot.injectCss = false;\n\t\t\t}\n\t\t\tif (options.compilerOptions.css) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t'hmr and emitCss are enabled but compilerOptions.css is true, forcing it to false'\n\t\t\t\t);\n\t\t\t\toptions.compilerOptions.css = false;\n\t\t\t}\n\t\t} else {\n\t\t\tif (options.hot === true || !options.hot.injectCss) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t'hmr with emitCss disabled requires option hot.injectCss to be enabled, forcing it to true'\n\t\t\t\t);\n\t\t\t\tif (options.hot === true) {\n\t\t\t\t\toptions.hot = { injectCss: true };\n\t\t\t\t} else {\n\t\t\t\t\toptions.hot.injectCss = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!options.compilerOptions.css) {\n\t\t\t\tlog.warn(\n\t\t\t\t\t'hmr with emitCss disabled requires compilerOptions.css to be enabled, forcing it to true'\n\t\t\t\t);\n\t\t\t\toptions.compilerOptions.css = true;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction enforceOptionsForProduction(options: ResolvedOptions) {\n\tif (options.isProduction) {\n\t\tif (options.hot) {\n\t\t\tlog.warn('options.hot is enabled but does not work on production build, forcing it to false');\n\t\t\toptions.hot = false;\n\t\t}\n\t\tif (options.compilerOptions.dev) {\n\t\t\tlog.warn(\n\t\t\t\t'you are building for production but compilerOptions.dev is true, forcing it to false'\n\t\t\t);\n\t\t\toptions.compilerOptions.dev = false;\n\t\t}\n\t}\n}\n\nfunction removeIgnoredOptions(options: ResolvedOptions) {\n\tconst ignoredCompilerOptions = ['generate', 'format', 'filename'];\n\tif (options.hot && options.emitCss) {\n\t\tignoredCompilerOptions.push('cssHash');\n\t}\n\tconst passedCompilerOptions = Object.keys(options.compilerOptions || {});\n\tconst passedIgnored = passedCompilerOptions.filter((o) => ignoredCompilerOptions.includes(o));\n\tif (passedIgnored.length) {\n\t\tlog.warn(\n\t\t\t`The following Svelte compilerOptions are controlled by vite-plugin-svelte and essential to its functionality. User-specified values are ignored. Please remove them from your configuration: ${passedIgnored.join(\n\t\t\t\t', '\n\t\t\t)}`\n\t\t);\n\t\tpassedIgnored.forEach((ignored) => {\n\t\t\t// @ts-expect-error string access\n\t\t\tdelete options.compilerOptions[ignored];\n\t\t});\n\t}\n}\n\n// some SvelteKit options need compilerOptions to work, so set them here.\nfunction addSvelteKitOptions(options: ResolvedOptions) {\n\t// @ts-expect-error kit is not typed to avoid dependency on sveltekit\n\tif (options?.kit != null) {\n\t\t// @ts-expect-error kit is not typed to avoid dependency on sveltekit\n\t\tconst kit_browser_hydrate = options.kit.browser?.hydrate;\n\t\tconst hydratable = kit_browser_hydrate !== false;\n\t\tif (\n\t\t\toptions.compilerOptions.hydratable != null &&\n\t\t\toptions.compilerOptions.hydratable !== hydratable\n\t\t) {\n\t\t\tlog.warn(\n\t\t\t\t`Conflicting values \"compilerOptions.hydratable: ${options.compilerOptions.hydratable}\" and \"kit.browser.hydrate: ${kit_browser_hydrate}\" in your svelte config. You should remove \"compilerOptions.hydratable\".`\n\t\t\t);\n\t\t}\n\t\tlog.debug(`Setting compilerOptions.hydratable: ${hydratable} for SvelteKit`);\n\t\toptions.compilerOptions.hydratable = hydratable;\n\t}\n}\n\n// vite passes unresolved `root`option to config hook but we need the resolved value, so do it here\n// https://github.com/sveltejs/vite-plugin-svelte/issues/113\n// https://github.com/vitejs/vite/blob/43c957de8a99bb326afd732c962f42127b0a4d1e/packages/vite/src/node/config.ts#L293\nfunction resolveViteRoot(viteConfig: UserConfig): string | undefined {\n\treturn normalizePath(viteConfig.root ? path.resolve(viteConfig.root) : process.cwd());\n}\n\nexport function buildExtraViteConfig(\n\toptions: PreResolvedOptions,\n\tconfig: UserConfig\n): Partial<UserConfig> {\n\t// extra handling for svelte dependencies in the project\n\tconst svelteDeps = findRootSvelteDependencies(options.root);\n\tconst extraViteConfig: Partial<UserConfig> = {\n\t\tresolve: {\n\t\t\tmainFields: [...SVELTE_RESOLVE_MAIN_FIELDS],\n\t\t\tdedupe: [...SVELTE_IMPORTS, ...SVELTE_HMR_IMPORTS]\n\t\t}\n\t\t// this option is still awaiting a PR in vite to be supported\n\t\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/60\n\t\t// @ts-ignore\n\t\t// knownJsSrcExtensions: options.extensions\n\t};\n\n\textraViteConfig.optimizeDeps = buildOptimizeDepsForSvelte(\n\t\tsvelteDeps,\n\t\toptions,\n\t\tconfig.optimizeDeps\n\t);\n\n\tif (options.experimental?.prebundleSvelteLibraries) {\n\t\textraViteConfig.optimizeDeps = {\n\t\t\t...extraViteConfig.optimizeDeps,\n\t\t\t// Experimental Vite API to allow these extensions to be scanned and prebundled\n\t\t\t// @ts-ignore\n\t\t\textensions: options.extensions ?? ['.svelte'],\n\t\t\t// Add esbuild plugin to prebundle Svelte files.\n\t\t\t// Currently a placeholder as more information is needed after Vite config is resolved,\n\t\t\t// the real Svelte plugin is added in `patchResolvedViteConfig()`\n\t\t\tesbuildOptions: {\n\t\t\t\tplugins: [{ name: facadeEsbuildSveltePluginName, setup: () => {} }]\n\t\t\t}\n\t\t};\n\t}\n\n\t// @ts-ignore\n\textraViteConfig.ssr = buildSSROptionsForSvelte(svelteDeps, options, config, extraViteConfig);\n\n\treturn extraViteConfig;\n}\n\nfunction buildOptimizeDepsForSvelte(\n\tsvelteDeps: SvelteDependency[],\n\toptions: PreResolvedOptions,\n\toptimizeDeps?: DepOptimizationOptions\n): DepOptimizationOptions {\n\t// include svelte imports for optimization unless explicitly excluded\n\tconst include: string[] = [];\n\tconst exclude: string[] = ['svelte-hmr'];\n\tconst isIncluded = (dep: string) => include.includes(dep) || optimizeDeps?.include?.includes(dep);\n\tconst isExcluded = (dep: string) => {\n\t\treturn (\n\t\t\texclude.includes(dep) ||\n\t\t\t// vite optimizeDeps.exclude works for subpackages too\n\t\t\t// see https://github.com/vitejs/vite/blob/c87763c1418d1ba876eae13d139eba83ac6f28b2/packages/vite/src/node/optimizer/scan.ts#L293\n\t\t\toptimizeDeps?.exclude?.some((id: string) => dep === id || id.startsWith(`${dep}/`))\n\t\t);\n\t};\n\tif (!isExcluded('svelte')) {\n\t\tconst svelteImportsToInclude = SVELTE_IMPORTS.filter((x) => x !== 'svelte/ssr'); // not used on clientside\n\t\tlog.debug(\n\t\t\t`adding bare svelte packages to optimizeDeps.include: ${svelteImportsToInclude.join(', ')} `\n\t\t);\n\t\tinclude.push(...svelteImportsToInclude.filter((x) => !isIncluded(x)));\n\t} else {\n\t\tlog.debug('\"svelte\" is excluded in optimizeDeps.exclude, skipped adding it to include.');\n\t}\n\n\t// If we prebundle svelte libraries, we can skip the whole prebundling dance below\n\tif (options.experimental?.prebundleSvelteLibraries) {\n\t\treturn { include, exclude };\n\t}\n\n\t// only svelte component libraries needs to be processed for optimizeDeps, js libraries work fine\n\tsvelteDeps = svelteDeps.filter((dep) => dep.type === 'component-library');\n\n\tconst svelteDepsToExclude = Array.from(new Set(svelteDeps.map((dep) => dep.name))).filter(\n\t\t(dep) => !isIncluded(dep)\n\t);\n\tlog.debug(`automatically excluding found svelte dependencies: ${svelteDepsToExclude.join(', ')}`);\n\texclude.push(...svelteDepsToExclude.filter((x) => !isExcluded(x)));\n\n\tif (options.disableDependencyReinclusion !== true) {\n\t\tconst disabledReinclusions = options.disableDependencyReinclusion || [];\n\t\tif (disabledReinclusions.length > 0) {\n\t\t\tlog.debug(`not reincluding transitive dependencies of`, disabledReinclusions);\n\t\t}\n\t\tconst transitiveDepsToInclude = svelteDeps\n\t\t\t.filter((dep) => !disabledReinclusions.includes(dep.name) && isExcluded(dep.name))\n\t\t\t.flatMap((dep) => {\n\t\t\t\tconst localRequire = createRequire(`${dep.dir}/package.json`);\n\t\t\t\treturn Object.keys(dep.pkg.dependencies || {})\n\t\t\t\t\t.filter((depOfDep) => !isExcluded(depOfDep) && needsOptimization(depOfDep, localRequire))\n\t\t\t\t\t.map((depOfDep) => dep.path.concat(dep.name, depOfDep).join(' > '));\n\t\t\t});\n\t\tlog.debug(\n\t\t\t`reincluding transitive dependencies of excluded svelte dependencies`,\n\t\t\ttransitiveDepsToInclude\n\t\t);\n\t\tinclude.push(...transitiveDepsToInclude);\n\t}\n\n\treturn { include, exclude };\n}\n\nfunction buildSSROptionsForSvelte(\n\tsvelteDeps: SvelteDependency[],\n\toptions: ResolvedOptions,\n\tconfig: UserConfig\n): any {\n\tconst noExternal: (string | RegExp)[] = [];\n\n\t// add svelte to ssr.noExternal unless it is present in ssr.external\n\t// so we can resolve it with svelte/ssr\n\tif (!config.ssr?.external?.includes('svelte')) {\n\t\tnoExternal.push('svelte', /^svelte\\//);\n\t}\n\n\t// add svelte dependencies to ssr.noExternal unless present in ssr.external\n\tnoExternal.push(\n\t\t...Array.from(new Set(svelteDeps.map((s) => s.name))).filter(\n\t\t\t(x) => !config.ssr?.external?.includes(x)\n\t\t)\n\t);\n\tconst ssr = {\n\t\tnoExternal,\n\t\texternal: [] as string[]\n\t};\n\n\tif (options.isServe) {\n\t\t// during dev, we have to externalize transitive dependencies, see https://github.com/sveltejs/vite-plugin-svelte/issues/281\n\t\tssr.external = Array.from(\n\t\t\tnew Set(svelteDeps.flatMap((dep) => Object.keys(dep.pkg.dependencies || {})))\n\t\t).filter(\n\t\t\t(dep) =>\n\t\t\t\t!ssr.noExternal.includes(dep) &&\n\t\t\t\t// TODO noExternal can be something different than a string array\n\t\t\t\t//!config.ssr?.noExternal?.includes(dep) &&\n\t\t\t\t!config.ssr?.external?.includes(dep)\n\t\t);\n\t}\n\n\treturn ssr;\n}\n\nexport function patchResolvedViteConfig(viteConfig: ResolvedConfig, options: ResolvedOptions) {\n\tconst facadeEsbuildSveltePlugin = viteConfig.optimizeDeps.esbuildOptions?.plugins?.find(\n\t\t(plugin) => plugin.name === facadeEsbuildSveltePluginName\n\t);\n\tif (facadeEsbuildSveltePlugin) {\n\t\tObject.assign(facadeEsbuildSveltePlugin, esbuildSveltePlugin(options));\n\t}\n}\n\nexport type Options = Omit<SvelteOptions, 'vitePlugin'> & PluginOptionsInline;\n\ninterface PluginOptionsInline extends PluginOptions {\n\t/**\n\t * Path to a svelte config file, either absolute or relative to Vite root\n\t *\n\t * set to `false` to ignore the svelte config file\n\t *\n\t * @see https://vitejs.dev/config/#root\n\t */\n\tconfigFile?: string | false;\n}\n\nexport interface PluginOptions {\n\t/**\n\t * A `picomatch` pattern, or array of patterns, which specifies the files the plugin should\n\t * operate on. By default, all svelte files are included.\n\t *\n\t * @see https://github.com/micromatch/picomatch\n\t */\n\tinclude?: Arrayable<string>;\n\n\t/**\n\t * A `picomatch` pattern, or array of patterns, which specifies the files to be ignored by the\n\t * plugin. By default, no files are ignored.\n\t *\n\t * @see https://github.com/micromatch/picomatch\n\t */\n\texclude?: Arrayable<string>;\n\n\t/**\n\t * Emit Svelte styles as virtual CSS files for Vite and other plugins to process\n\t *\n\t * @default true\n\t */\n\temitCss?: boolean;\n\n\t/**\n\t * Enable or disable Hot Module Replacement.\n\t *\n\t * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t *\n\t * DO NOT CUSTOMIZE SVELTE-HMR OPTIONS UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING\n\t *\n\t * YOU HAVE BEEN WARNED\n\t *\n\t * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\t *\n\t * Set an object to pass custom options to svelte-hmr\n\t *\n\t * @see https://github.com/rixo/svelte-hmr#options\n\t * @default true for development, always false for production\n\t */\n\thot?: boolean | { injectCss?: boolean; [key: string]: any };\n\n\t/**\n\t * Some Vite plugins can contribute additional preprocessors by defining `api.sveltePreprocess`.\n\t * If you don't want to use them, set this to true to ignore them all or use an array of strings\n\t * with plugin names to specify which.\n\t *\n\t * @default false\n\t */\n\tignorePluginPreprocessors?: boolean | string[];\n\n\t/**\n\t * vite-plugin-svelte automatically handles excluding svelte libraries and reinclusion of their dependencies\n\t * in vite.optimizeDeps.\n\t *\n\t * `disableDependencyReinclusion: true` disables all reinclusions\n\t * `disableDependencyReinclusion: ['foo','bar']` disables reinclusions for dependencies of foo and bar\n\t *\n\t * This should be used for hybrid packages that contain both node and browser dependencies, eg Routify\n\t *\n\t * @default false\n\t */\n\tdisableDependencyReinclusion?: boolean | string[];\n\n\t/**\n\t * These options are considered experimental and breaking changes to them can occur in any release\n\t */\n\texperimental?: ExperimentalOptions;\n}\n\nexport interface SvelteOptions {\n\t/**\n\t * A list of file extensions to be compiled by Svelte\n\t *\n\t * @default ['.svelte']\n\t */\n\textensions?: string[];\n\n\t/**\n\t * An array of preprocessors to transform the Svelte source code before compilation\n\t *\n\t * @see https://svelte.dev/docs#svelte_preprocess\n\t */\n\tpreprocess?: Arrayable<PreprocessorGroup>;\n\n\t/**\n\t * The options to be passed to the Svelte compiler. A few options are set by default,\n\t * including `dev` and `css`. However, some options are non-configurable, like\n\t * `filename`, `format`, `generate`, and `cssHash` (in dev).\n\t *\n\t * @see https://svelte.dev/docs#svelte_compile\n\t */\n\tcompilerOptions?: Omit<CompileOptions, 'filename' | 'format' | 'generate'>;\n\n\t/**\n\t * Handles warning emitted from the Svelte compiler\n\t */\n\tonwarn?: (warning: Warning, defaultHandler?: (warning: Warning) => void) => void;\n\n\t/**\n\t * Options for vite-plugin-svelte\n\t */\n\tvitePlugin?: PluginOptions;\n}\n\n/**\n * These options are considered experimental and breaking changes to them can occur in any release\n */\nexport interface ExperimentalOptions {\n\t/**\n\t * Use extra preprocessors that delegate style and TypeScript preprocessing to native Vite plugins\n\t *\n\t * Do not use together with `svelte-preprocess`!\n\t *\n\t * @default false\n\t */\n\tuseVitePreprocess?: boolean;\n\n\t/**\n\t * Force Vite to pre-bundle Svelte libraries\n\t *\n\t * @default false\n\t */\n\tprebundleSvelteLibraries?: boolean;\n\n\t/**\n\t * If a preprocessor does not provide a sourcemap, a best-effort fallback sourcemap will be provided.\n\t * This option requires `diff-match-patch` to be installed as a peer dependency.\n\t *\n\t * @see https://github.com/google/diff-match-patch\n\t * @default false\n\t */\n\tgenerateMissingPreprocessorSourcemaps?: boolean;\n\n\t/**\n\t * A function to update `compilerOptions` before compilation\n\t *\n\t * `data.filename` - The file to be compiled\n\t * `data.code` - The preprocessed Svelte code\n\t * `data.compileOptions` - The current compiler options\n\t *\n\t * To change part of the compiler options, return an object with the changes you need.\n\t *\n\t * @example\n\t * ```\n\t * ({ filename, compileOptions }) => {\n\t * // Dynamically set hydration per Svelte file\n\t * if (compileWithHydratable(filename) && !compileOptions.hydratable) {\n\t * return { hydratable: true };\n\t * }\n\t * }\n\t * ```\n\t */\n\tdynamicCompileOptions?: (data: {\n\t\tfilename: string;\n\t\tcode: string;\n\t\tcompileOptions: Partial<CompileOptions>;\n\t}) => Promise<Partial<CompileOptions> | void> | Partial<CompileOptions> | void;\n\n\t/**\n\t * enable svelte inspector\n\t */\n\tinspector?: InspectorOptions | boolean;\n\n\t/**\n\t * send a websocket message with svelte compiler warnings during dev\n\t *\n\t */\n\tsendWarningsToBrowser?: boolean;\n}\n\nexport interface InspectorOptions {\n\t/**\n\t * define a key combo to toggle inspector,\n\t * @default 'control-shift' on windows, 'meta-shift' on other os\n\t *\n\t * any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by -\n\t * examples: control-shift, control-o, control-alt-s meta-x control-meta\n\t * Some keys have native behavior (e.g. alt-s opens history menu on firefox).\n\t * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended.\n\t */\n\ttoggleKeyCombo?: string;\n\n\t/**\n\t * inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress\n\t * @default false\n\t */\n\tholdMode?: boolean;\n\t/**\n\t * when to show the toggle button\n\t * @default 'active'\n\t */\n\tshowToggleButton?: 'always' | 'active' | 'never';\n\n\t/**\n\t * where to display the toggle button\n\t * @default top-right\n\t */\n\ttoggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';\n\n\t/**\n\t * inject custom styles when inspector is active\n\t */\n\tcustomStyles?: boolean;\n\n\t/**\n\t * append an import to the module id ending with `appendTo` instead of adding a script into body\n\t * useful for frameworks that do not support trannsformIndexHtml hook\n\t *\n\t * WARNING: only set this if you know exactly what it does.\n\t * Regular users of vite-plugin-svelte or SvelteKit do not need it\n\t */\n\tappendTo?: string;\n}\n\nexport interface PreResolvedOptions extends Options {\n\t// these options are non-nullable after resolve\n\tcompilerOptions: CompileOptions;\n\texperimental?: ExperimentalOptions;\n\t// extra options\n\troot: string;\n\tisBuild: boolean;\n\tisServe: boolean;\n\tisDebug: boolean;\n}\n\nexport interface ResolvedOptions extends PreResolvedOptions {\n\tisProduction: boolean;\n\tserver?: ViteDevServer;\n}\n\nexport type {\n\tCompileOptions,\n\tProcessed,\n\tMarkupPreprocessor,\n\tPreprocessor,\n\tPreprocessorGroup,\n\tWarning\n};\n\nexport type ModuleFormat = NonNullable<CompileOptions['format']>;\n\nexport type CssHashGetter = NonNullable<CompileOptions['cssHash']>;\n\nexport type Arrayable<T> = T | T[];\n","import { createRequire } from 'module';\nimport path from 'path';\nimport fs from 'fs';\nimport { pathToFileURL } from 'url';\nimport { log } from './log';\nimport { Options, SvelteOptions } from './options';\nimport { UserConfig } from 'vite';\n\n// used to require cjs config in esm.\n// NOTE dynamic import() cjs technically works, but timestamp query cache bust\n// have no effect, likely because it has another internal cache?\nlet esmRequire: NodeRequire;\n\nexport const knownSvelteConfigNames = [\n\t'svelte.config.js',\n\t'svelte.config.cjs',\n\t'svelte.config.mjs'\n];\n\n// hide dynamic import from ts transform to prevent it turning into a require\n// see https://github.com/microsoft/TypeScript/issues/43329#issuecomment-811606238\n// also use timestamp query to avoid caching on reload\nconst dynamicImportDefault = new Function(\n\t'path',\n\t'timestamp',\n\t'return import(path + \"?t=\" + timestamp).then(m => m.default)'\n);\n\nexport async function loadSvelteConfig(\n\tviteConfig?: UserConfig,\n\tinlineOptions?: Partial<Options>\n): Promise<Partial<SvelteOptions> | undefined> {\n\tif (inlineOptions?.configFile === false) {\n\t\treturn;\n\t}\n\tconst configFile = findConfigToLoad(viteConfig, inlineOptions);\n\tif (configFile) {\n\t\tlet err;\n\t\t// try to use dynamic import for svelte.config.js first\n\t\tif (configFile.endsWith('.js') || configFile.endsWith('.mjs')) {\n\t\t\ttry {\n\t\t\t\tconst result = await dynamicImportDefault(\n\t\t\t\t\tpathToFileURL(configFile).href,\n\t\t\t\t\tfs.statSync(configFile).mtimeMs\n\t\t\t\t);\n\t\t\t\tif (result != null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tconfigFile\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`invalid export in ${configFile}`);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tlog.error(`failed to import config ${configFile}`, e);\n\t\t\t\terr = e;\n\t\t\t}\n\t\t}\n\t\t// cjs or error with dynamic import\n\t\tif (!configFile.endsWith('.mjs')) {\n\t\t\ttry {\n\t\t\t\t// identify which require function to use (esm and cjs mode)\n\t\t\t\tconst _require = import.meta.url\n\t\t\t\t\t? (esmRequire ??= createRequire(import.meta.url))\n\t\t\t\t\t: require;\n\n\t\t\t\t// avoid loading cached version on reload\n\t\t\t\tdelete _require.cache[_require.resolve(configFile)];\n\t\t\t\tconst result = _require(configFile);\n\t\t\t\tif (result != null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tconfigFile\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`invalid export in ${configFile}`);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tlog.error(`failed to require config ${configFile}`, e);\n\t\t\t\tif (!err) {\n\t\t\t\t\terr = e;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// failed to load existing config file\n\t\tthrow err;\n\t}\n}\n\nfunction findConfigToLoad(viteConfig?: UserConfig, inlineOptions?: Partial<Options>) {\n\tconst root = viteConfig?.root || process.cwd();\n\tif (inlineOptions?.configFile) {\n\t\tconst abolutePath = path.isAbsolute(inlineOptions.configFile)\n\t\t\t? inlineOptions.configFile\n\t\t\t: path.resolve(root, inlineOptions.configFile);\n\t\tif (!fs.existsSync(abolutePath)) {\n\t\t\tthrow new Error(`failed to find svelte config file ${abolutePath}.`);\n\t\t}\n\t\treturn abolutePath;\n\t} else {\n\t\tconst existingKnownConfigFiles = knownSvelteConfigNames\n\t\t\t.map((candidate) => path.resolve(root, candidate))\n\t\t\t.filter((file) => fs.existsSync(file));\n\t\tif (existingKnownConfigFiles.length === 0) {\n\t\t\tlog.debug(`no svelte config found at ${root}`);\n\t\t\treturn;\n\t\t} else if (existingKnownConfigFiles.length > 1) {\n\t\t\tlog.warn(\n\t\t\t\t`found more than one svelte config file, using ${existingKnownConfigFiles[0]}. you should only have one!`,\n\t\t\t\texistingKnownConfigFiles\n\t\t\t);\n\t\t}\n\t\treturn existingKnownConfigFiles[0];\n\t}\n}\n","const VITE_RESOLVE_MAIN_FIELDS = ['module', 'jsnext:main', 'jsnext'];\n\nexport const SVELTE_RESOLVE_MAIN_FIELDS = ['svelte', ...VITE_RESOLVE_MAIN_FIELDS];\n\nexport const SVELTE_IMPORTS = [\n\t'svelte/animate',\n\t'svelte/easing',\n\t'svelte/internal',\n\t'svelte/motion',\n\t'svelte/ssr',\n\t'svelte/store',\n\t'svelte/transition',\n\t'svelte'\n];\n\nexport const SVELTE_HMR_IMPORTS = [\n\t'svelte-hmr/runtime/hot-api-esm.js',\n\t'svelte-hmr/runtime/proxy-adapter-dom.js',\n\t'svelte-hmr'\n];\n","import { log } from './log';\nimport path from 'path';\nimport fs from 'fs';\nimport { createRequire } from 'module';\n\nexport function findRootSvelteDependencies(root: string, cwdFallback = true): SvelteDependency[] {\n\tlog.debug(`findSvelteDependencies: searching svelte dependencies in ${root}`);\n\tconst pkgFile = path.join(root, 'package.json');\n\tif (!fs.existsSync(pkgFile)) {\n\t\tif (cwdFallback) {\n\t\t\tconst cwd = process.cwd();\n\t\t\tif (root !== cwd) {\n\t\t\t\tlog.debug(`no package.json found in vite root ${root}`);\n\t\t\t\treturn findRootSvelteDependencies(cwd, false);\n\t\t\t}\n\t\t}\n\t\tlog.warn(`no package.json found, findRootSvelteDependencies failed`);\n\t\treturn [];\n\t}\n\n\tconst pkg = parsePkg(root);\n\tif (!pkg) {\n\t\treturn [];\n\t}\n\n\tconst deps = [\n\t\t...Object.keys(pkg.dependencies || {}),\n\t\t...Object.keys(pkg.devDependencies || {})\n\t].filter((dep) => !is_common_without_svelte_field(dep));\n\n\treturn getSvelteDependencies(deps, root);\n}\n\nfunction getSvelteDependencies(\n\tdeps: string[],\n\tpkgDir: string,\n\tpath: string[] = []\n): SvelteDependency[] {\n\tconst result = [];\n\tconst localRequire = createRequire(`${pkgDir}/package.json`);\n\tconst resolvedDeps = deps\n\t\t.map((dep) => resolveDependencyData(dep, localRequire))\n\t\t.filter(Boolean) as DependencyData[];\n\tfor (const { pkg, dir } of resolvedDeps) {\n\t\tconst type = getSvelteDependencyType(pkg);\n\t\tif (!type) continue;\n\t\tresult.push({ name: pkg.name, type, pkg, dir, path });\n\t\t// continue crawling for component libraries so we can optimize them, js libraries are fine\n\t\tif (type === 'component-library' && pkg.dependencies) {\n\t\t\tlet dependencyNames = Object.keys(pkg.dependencies);\n\t\t\tconst circular = dependencyNames.filter((name) => path.includes(name));\n\t\t\tif (circular.length > 0) {\n\t\t\t\tlog.warn.enabled &&\n\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t`skipping circular svelte dependencies in automated vite optimizeDeps handling`,\n\t\t\t\t\t\tcircular.map((x) => path.concat(x).join('>'))\n\t\t\t\t\t);\n\t\t\t\tdependencyNames = dependencyNames.filter((name) => !path.includes(name));\n\t\t\t}\n\t\t\tif (path.length === 3) {\n\t\t\t\tlog.debug.once(`encountered deep svelte dependency tree: ${path.join('>')}`);\n\t\t\t}\n\t\t\tresult.push(...getSvelteDependencies(dependencyNames, dir, path.concat(pkg.name)));\n\t\t}\n\t}\n\treturn result;\n}\n\nexport function resolveDependencyData(\n\tdep: string,\n\tlocalRequire: NodeRequire\n): DependencyData | void {\n\ttry {\n\t\tconst pkgJson = `${dep}/package.json`;\n\t\tconst pkg = localRequire(pkgJson);\n\t\tconst dir = path.dirname(localRequire.resolve(pkgJson));\n\t\treturn { dir, pkg };\n\t} catch (e) {\n\t\tlog.debug.once(`dependency ${dep} does not export package.json`, e);\n\t\t// walk up from default export until we find package.json with name=dep\n\t\ttry {\n\t\t\tlet dir = path.dirname(localRequire.resolve(dep));\n\t\t\twhile (dir) {\n\t\t\t\tconst pkg = parsePkg(dir, true);\n\t\t\t\tif (pkg && pkg.name === dep) {\n\t\t\t\t\treturn { dir, pkg };\n\t\t\t\t}\n\t\t\t\tconst parent = path.dirname(dir);\n\t\t\t\tif (parent === dir) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdir = parent;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tlog.debug.once(`error while trying to find package.json of ${dep}`, e);\n\t\t}\n\t}\n\tlog.debug.once(`failed to resolve ${dep}`);\n}\n\nfunction parsePkg(dir: string, silent = false): Pkg | void {\n\tconst pkgFile = path.join(dir, 'package.json');\n\ttry {\n\t\treturn JSON.parse(fs.readFileSync(pkgFile, 'utf-8'));\n\t} catch (e) {\n\t\t!silent && log.warn.enabled && log.warn(`failed to parse ${pkgFile}`, e);\n\t}\n}\n\nfunction getSvelteDependencyType(pkg: Pkg): SvelteDependencyType | undefined {\n\tif (isSvelteComponentLib(pkg)) {\n\t\treturn 'component-library';\n\t} else if (isSvelteLib(pkg)) {\n\t\treturn 'js-library';\n\t} else {\n\t\treturn undefined;\n\t}\n}\n\nfunction isSvelteComponentLib(pkg: Pkg) {\n\treturn !!pkg.svelte;\n}\n\nfunction isSvelteLib(pkg: Pkg) {\n\treturn !!pkg.dependencies?.svelte || !!pkg.peerDependencies?.svelte;\n}\n\nconst COMMON_DEPENDENCIES_WITHOUT_SVELTE_FIELD = [\n\t'@lukeed/uuid',\n\t'@playwright/test',\n\t'@sveltejs/vite-plugin-svelte',\n\t'@sveltejs/kit',\n\t'autoprefixer',\n\t'cookie',\n\t'dotenv',\n\t'esbuild',\n\t'eslint',\n\t'jest',\n\t'mdsvex',\n\t'playwright',\n\t'postcss',\n\t'prettier',\n\t'svelte',\n\t'svelte-check',\n\t'svelte-hmr',\n\t'svelte-preprocess',\n\t'tslib',\n\t'typescript',\n\t'vite',\n\t'vitest',\n\t'__vite-browser-external' // see https://github.com/sveltejs/vite-plugin-svelte/issues/362\n];\nconst COMMON_PREFIXES_WITHOUT_SVELTE_FIELD = [\n\t'@fontsource/',\n\t'@postcss-plugins/',\n\t'@rollup/',\n\t'@sveltejs/adapter-',\n\t'@types/',\n\t'@typescript-eslint/',\n\t'eslint-',\n\t'jest-',\n\t'postcss-plugin-',\n\t'prettier-plugin-',\n\t'rollup-plugin-',\n\t'vite-plugin-'\n];\n\n/**\n * Test for common dependency names that tell us it is not a package including a svelte field, eg. eslint + plugins.\n *\n * This speeds up the find process as we don't have to try and require the package.json for all of them\n *\n * @param dependency {string}\n * @returns {boolean} true if it is a dependency without a svelte field\n */\nexport function is_common_without_svelte_field(dependency: string): boolean {\n\treturn (\n\t\tCOMMON_DEPENDENCIES_WITHOUT_SVELTE_FIELD.includes(dependency) ||\n\t\tCOMMON_PREFIXES_WITHOUT_SVELTE_FIELD.some(\n\t\t\t(prefix) =>\n\t\t\t\tprefix.startsWith('@')\n\t\t\t\t\t? dependency.startsWith(prefix)\n\t\t\t\t\t: dependency.substring(dependency.lastIndexOf('/') + 1).startsWith(prefix) // check prefix omitting @scope/\n\t\t)\n\t);\n}\n\nexport function needsOptimization(dep: string, localRequire: NodeRequire): boolean {\n\tconst depData = resolveDependencyData(dep, localRequire);\n\tif (!depData) return false;\n\tconst pkg = depData.pkg;\n\t// only optimize if is cjs, using the below as heuristic\n\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/162\n\tconst hasEsmFields = pkg.module || pkg.exports;\n\tif (hasEsmFields) return false;\n\tif (pkg.main) {\n\t\t// ensure entry is js so vite can prebundle it\n\t\t// see https://github.com/sveltejs/vite-plugin-svelte/issues/233\n\t\tconst entryExt = path.extname(pkg.main);\n\t\treturn !entryExt || entryExt === '.js' || entryExt === '.cjs';\n\t} else {\n\t\t// check if has implicit index.js entrypoint\n\t\t// https://github.com/sveltejs/vite-plugin-svelte/issues/281\n\t\ttry {\n\t\t\tlocalRequire.resolve(`${dep}/index.js`);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\ninterface DependencyData {\n\tdir: string;\n\tpkg: Pkg;\n}\n\nexport interface SvelteDependency {\n\tname: string;\n\ttype: SvelteDependencyType;\n\tdir: string;\n\tpkg: Pkg;\n\tpath: string[];\n}\n\n// component-library => exports svelte components\n// js-library => only uses svelte api, no components\nexport type SvelteDependencyType = 'component-library' | 'js-library';\n\nexport interface Pkg {\n\tname: string;\n\tsvelte?: string;\n\tdependencies?: DependencyList;\n\tdevDependencies?: DependencyList;\n\tpeerDependencies?: DependencyList;\n\t[key: string]: any;\n}\n\nexport interface DependencyList {\n\t[key: string]: string;\n}\n","import { promises as fs } from 'fs';\nimport { compile, preprocess } from 'svelte/compiler';\nimport { DepOptimizationOptions } from 'vite';\nimport { Compiled } from './compile';\nimport { log } from './log';\nimport { CompileOptions, ResolvedOptions } from './options';\nimport { toESBuildError } from './error';\n\ntype EsbuildOptions = NonNullable<DepOptimizationOptions['esbuildOptions']>;\ntype EsbuildPlugin = NonNullable<EsbuildOptions['plugins']>[number];\n\nexport const facadeEsbuildSveltePluginName = 'vite-plugin-svelte:facade';\n\nexport function esbuildSveltePlugin(options: ResolvedOptions): EsbuildPlugin {\n\treturn {\n\t\tname: 'vite-plugin-svelte:optimize-svelte',\n\t\tsetup(build) {\n\t\t\t// Skip in scanning phase as Vite already handles scanning Svelte files.\n\t\t\t// Otherwise this would heavily slow down the scanning phase.\n\t\t\tif (build.initialOptions.plugins?.some((v) => v.name === 'vite:dep-scan')) return;\n\n\t\t\tconst svelteExtensions = (options.extensions ?? ['.svelte']).map((ext) => ext.slice(1));\n\t\t\tconst svelteFilter = new RegExp(`\\\\.(` + svelteExtensions.join('|') + `)(\\\\?.*)?$`);\n\n\t\t\tbuild.onLoad({ filter: svelteFilter }, async ({ path: filename }) => {\n\t\t\t\tconst code = await fs.readFile(filename, 'utf8');\n\t\t\t\ttry {\n\t\t\t\t\tconst contents = await compileSvelte(options, { filename, code });\n\t\t\t\t\treturn { contents };\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn { errors: [toESBuildError(e, options)] };\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n}\n\nasync function compileSvelte(\n\toptions: ResolvedOptions,\n\t{ filename, code }: { filename: string; code: string }\n): Promise<string> {\n\tconst compileOptions: CompileOptions = {\n\t\t...options.compilerOptions,\n\t\tcss: true,\n\t\tfilename,\n\t\tformat: 'esm',\n\t\tgenerate: 'dom'\n\t};\n\n\tlet preprocessed;\n\n\tif (options.preprocess) {\n\t\ttry {\n\t\t\tpreprocessed = await preprocess(code, options.preprocess, { filename });\n\t\t} catch (e) {\n\t\t\te.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`;\n\t\t\tthrow e;\n\t\t}\n\t\tif (preprocessed.map) compileOptions.sourcemap = preprocessed.map;\n\t}\n\n\tconst finalCode = preprocessed ? preprocessed.code : code;\n\n\tconst dynamicCompileOptions = await options.experimental?.dynamicCompileOptions?.({\n\t\tfilename,\n\t\tcode: finalCode,\n\t\tcompileOptions\n\t});\n\n\tif (dynamicCompileOptions && log.debug.enabled) {\n\t\tlog.debug(`dynamic compile options for ${filename}: ${JSON.stringify(dynamicCompileOptions)}`);\n\t}\n\n\tconst finalCompileOptions = dynamicCompileOptions\n\t\t? {\n\t\t\t\t...compileOptions,\n\t\t\t\t...dynamicCompileOptions\n\t\t }\n\t\t: compileOptions;\n\n\tconst compiled = compile(finalCode, finalCompileOptions) as Compiled;\n\n\treturn compiled.js.code + '//# sourceMappingURL=' + compiled.js.map.toUrl();\n}\n","import { RollupError } from 'rollup';\nimport { ResolvedOptions, Warning } from './options';\nimport { buildExtendedLogMessage } from './log';\nimport { PartialMessage } from 'esbuild';\n\n/**\n * convert an error thrown by svelte.compile to a RollupError so that vite displays it in a user friendly way\n * @param error a svelte compiler error, which is a mix of Warning and an error\n * @returns {RollupError} the converted error\n */\nexport function toRollupError(error: Warning & Error, options: ResolvedOptions): RollupError {\n\tconst { filename, frame, start, code, name, stack } = error;\n\tconst rollupError: RollupError = {\n\t\tname, // needed otherwise sveltekit coalesce_to_error turns it into a string\n\t\tid: filename,\n\t\tmessage: buildExtendedLogMessage(error), // include filename:line:column so that it's clickable\n\t\tframe: formatFrameForVite(frame),\n\t\tcode,\n\t\tstack: options.isBuild || options.isDebug || !frame ? stack : ''\n\t};\n\tif (start) {\n\t\trollupError.loc = {\n\t\t\tline: start.line,\n\t\t\tcolumn: start.column,\n\t\t\tfile: filename\n\t\t};\n\t}\n\treturn rollupError;\n}\n\n/**\n * convert an error thrown by svelte.compile to an esbuild PartialMessage\n * @param error a svelte compiler error, which is a mix of Warning and an error\n * @returns {PartialMessage} the converted error\n */\nexport function toESBuildError(error: Warning & Error, options: ResolvedOptions): PartialMessage {\n\tconst { filename, frame, start, stack } = error;\n\tconst partialMessage: PartialMessage = {\n\t\ttext: buildExtendedLogMessage(error)\n\t};\n\tif (start) {\n\t\tpartialMessage.location = {\n\t\t\tline: start.line,\n\t\t\tcolumn: start.column,\n\t\t\tfile: filename,\n\t\t\tlineText: lineFromFrame(start.line, frame) // needed to get a meaningful error message on cli\n\t\t};\n\t}\n\tif (options.isBuild || options.isDebug || !frame) {\n\t\tpartialMessage.detail = stack;\n\t}\n\treturn partialMessage;\n}\n\n/**\n * extract line with number from codeframe\n */\nfunction lineFromFrame(lineNo: number, frame?: string): string {\n\tif (!frame) {\n\t\treturn '';\n\t}\n\tconst lines = frame.split('\\n');\n\tconst errorLine = lines.find((line) => line.trimStart().startsWith(`${lineNo}: `));\n\treturn errorLine ? errorLine.substring(errorLine.indexOf(': ') + 3) : '';\n}\n\n/**\n * vite error overlay expects a specific format to show frames\n * this reformats svelte frame (colon separated, less whitespace)\n * to one that vite displays on overlay ( pipe separated, more whitespace)\n * e.g.\n * ```\n * 1: foo\n * 2: bar;\n * ^\n * 3: baz\n * ```\n * to\n * ```\n * 1 | foo\n * 2 | bar;\n * ^\n * 3 | baz\n * ```\n * @see https://github.com/vitejs/vite/blob/96591bf9989529de839ba89958755eafe4c445ae/packages/vite/src/client/overlay.ts#L116\n */\nfunction formatFrameForVite(frame?: string): string {\n\tif (!frame) {\n\t\treturn '';\n\t}\n\treturn frame\n\t\t.split('\\n')\n\t\t.map((line) => (line.match(/^\\s+\\^/) ? ' ' + line : ' ' + line.replace(':', ' | ')))\n\t\t.join('\\n');\n}\n","import {\n\ttransformWithEsbuild,\n\tESBuildOptions,\n\tResolvedConfig,\n\tTransformResult,\n\tPlugin\n} from 'vite';\nimport MagicString from 'magic-string';\nimport { preprocess } from 'svelte/compiler';\nimport { Preprocessor, PreprocessorGroup, Processed, ResolvedOptions } from './options';\nimport { TransformPluginContext } from 'rollup';\nimport { log } from './log';\nimport { buildSourceMap } from './sourcemap';\nimport path from 'path';\n\nconst supportedStyleLangs = ['css', 'less', 'sass', 'scss', 'styl', 'stylus', 'postcss'];\n\nconst supportedScriptLangs = ['ts'];\n\nfunction createViteScriptPreprocessor(): Preprocessor {\n\treturn async ({ attributes, content, filename = '' }) => {\n\t\tconst lang = attributes.lang as string;\n\t\tif (!supportedScriptLangs.includes(lang)) return;\n\t\tconst transformResult = await transformWithEsbuild(content, filename, {\n\t\t\tloader: lang as ESBuildOptions['loader'],\n\t\t\ttsconfigRaw: {\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\t// svelte typescript needs this flag to work with type imports\n\t\t\t\t\timportsNotUsedAsValues: 'preserve',\n\t\t\t\t\tpreserveValueImports: true\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn {\n\t\t\tcode: transformResult.code,\n\t\t\tmap: transformResult.map\n\t\t};\n\t};\n}\n\nfunction createViteStylePreprocessor(config: ResolvedConfig): Preprocessor {\n\tconst pluginName = 'vite:css';\n\tconst plugin = config.plugins.find((p) => p.name === pluginName);\n\tif (!plugin) {\n\t\tthrow new Error(`failed to find plugin ${pluginName}`);\n\t}\n\tif (!plugin.transform) {\n\t\tthrow new Error(`plugin ${pluginName} has no transform`);\n\t}\n\tconst pluginTransform = plugin.transform!.bind(null as unknown as TransformPluginContext);\n\treturn async ({ attributes, content, filename = '' }) => {\n\t\tconst lang = attributes.lang as string;\n\t\tif (!supportedStyleLangs.includes(lang)) return;\n\t\tconst moduleId = `${filename}.${lang}`;\n\t\tconst transformResult: TransformResult = (await pluginTransform(\n\t\t\tcontent,\n\t\t\tmoduleId\n\t\t)) as TransformResult;\n\t\t// patch sourcemap source to point back to original filename\n\t\tif (transformResult.map?.sources?.[0] === moduleId) {\n\t\t\ttransformResult.map.sources[0] = path.basename(filename);\n\t\t}\n\t\treturn {\n\t\t\tcode: transformResult.code,\n\t\t\tmap: transformResult.map ?? undefined\n\t\t};\n\t};\n}\n\nfunction createVitePreprocessorGroup(config: ResolvedConfig): PreprocessorGroup {\n\treturn {\n\t\tmarkup({ content, filename }) {\n\t\t\treturn preprocess(\n\t\t\t\tcontent,\n\t\t\t\t{\n\t\t\t\t\tscript: createViteScriptPreprocessor(),\n\t\t\t\t\tstyle: createViteStylePreprocessor(config)\n\t\t\t\t},\n\t\t\t\t{ filename }\n\t\t\t);\n\t\t}\n\t} as PreprocessorGroup;\n}\n\n/**\n * this appends a *{} rule to component styles to force the svelte compiler to add style classes to all nodes\n * That means adding/removing class rules from <style> node won't trigger js updates as the scope classes are not changed\n *\n * only used during dev with enabled css hmr\n */\nfunction createInjectScopeEverythingRulePreprocessorGroup(): PreprocessorGroup {\n\treturn {\n\t\tstyle({ content, filename }) {\n\t\t\tconst s = new MagicString(content);\n\t\t\ts.append(' *{}');\n\t\t\treturn {\n\t\t\t\tcode: s.toString(),\n\t\t\t\tmap: s.generateDecodedMap({\n\t\t\t\t\tsource: filename ? path.basename(filename) : undefined,\n\t\t\t\t\thires: true\n\t\t\t\t})\n\t\t\t};\n\t\t}\n\t};\n}\n\nfunction buildExtraPreprocessors(options: ResolvedOptions, config: ResolvedConfig) {\n\tconst prependPreprocessors: PreprocessorGroup[] = [];\n\tconst appendPreprocessors: PreprocessorGroup[] = [];\n\n\tif (options.experimental?.useVitePreprocess) {\n\t\tlog.debug('adding vite preprocessor');\n\t\tprependPreprocessors.push(createVitePreprocessorGroup(config));\n\t}\n\n\t// @ts-ignore\n\tconst pluginsWithPreprocessorsDeprecated = config.plugins.filter((p) => p?.sveltePreprocess);\n\tif (pluginsWithPreprocessorsDeprecated.length > 0) {\n\t\tlog.warn(\n\t\t\t`The following plugins use the deprecated 'plugin.sveltePreprocess' field. Please contact their maintainers and ask them to move it to 'plugin.api.sveltePreprocess': ${pluginsWithPreprocessorsDeprecated\n\t\t\t\t.map((p) => p.name)\n\t\t\t\t.join(', ')}`\n\t\t);\n\t\t// patch plugin to avoid breaking\n\t\tpluginsWithPreprocessorsDeprecated.forEach((p) => {\n\t\t\tif (!p.api) {\n\t\t\t\tp.api = {};\n\t\t\t}\n\t\t\tif (p.api.sveltePreprocess === undefined) {\n\t\t\t\t// @ts-ignore\n\t\t\t\tp.api.sveltePreprocess = p.sveltePreprocess;\n\t\t\t} else {\n\t\t\t\tlog.error(\n\t\t\t\t\t`ignoring plugin.sveltePreprocess of ${p.name} because it already defined plugin.api.sveltePreprocess.`\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tconst pluginsWithPreprocessors: Plugin[] = config.plugins.filter((p) => p?.api?.sveltePreprocess);\n\tconst ignored: Plugin[] = [],\n\t\tincluded: Plugin[] = [];\n\tfor (const p of pluginsWithPreprocessors) {\n\t\tif (\n\t\t\toptions.ignorePluginPreprocessors === true ||\n\t\t\t(Array.isArray(options.ignorePluginPreprocessors) &&\n\t\t\t\toptions.ignorePluginPreprocessors?.includes(p.name))\n\t\t) {\n\t\t\tignored.push(p);\n\t\t} else {\n\t\t\tincluded.push(p);\n\t\t}\n\t}\n\tif (ignored.length > 0) {\n\t\tlog.debug(\n\t\t\t`Ignoring svelte preprocessors defined by these vite plugins: ${ignored\n\t\t\t\t.map((p) => p.name)\n\t\t\t\t.join(', ')}`\n\t\t);\n\t}\n\tif (included.length > 0) {\n\t\tlog.debug(\n\t\t\t`Adding svelte preprocessors defined by these vite plugins: ${included\n\t\t\t\t.map((p) => p.name)\n\t\t\t\t.join(', ')}`\n\t\t);\n\t\tappendPreprocessors.push(...pluginsWithPreprocessors.map((p) => p.api.sveltePreprocess));\n\t}\n\n\tif (options.hot && options.emitCss) {\n\t\tappendPreprocessors.push(createInjectScopeEverythingRulePreprocessorGroup());\n\t}\n\n\treturn { prependPreprocessors, appendPreprocessors };\n}\n\nexport function addExtraPreprocessors(options: ResolvedOptions, config: ResolvedConfig) {\n\tconst { prependPreprocessors, appendPreprocessors } = buildExtraPreprocessors(options, config);\n\tif (prependPreprocessors.length > 0 || appendPreprocessors.length > 0) {\n\t\tif (!options.preprocess) {\n\t\t\toptions.preprocess = [...prependPreprocessors, ...appendPreprocessors];\n\t\t} else if (Array.isArray(options.preprocess)) {\n\t\t\toptions.preprocess.unshift(...prependPreprocessors);\n\t\t\toptions.preprocess.push(...appendPreprocessors);\n\t\t} else {\n\t\t\toptions.preprocess = [...prependPreprocessors, options.preprocess, ...appendPreprocessors];\n\t\t}\n\t}\n\tconst generateMissingSourceMaps = !!options.experimental?.generateMissingPreprocessorSourcemaps;\n\tif (options.preprocess && generateMissingSourceMaps) {\n\t\toptions.preprocess = Array.isArray(options.preprocess)\n\t\t\t? options.preprocess.map((p, i) => validateSourceMapOutputWrapper(p, i))\n\t\t\t: validateSourceMapOutputWrapper(options.preprocess, 0);\n\t}\n}\n\nfunction validateSourceMapOutputWrapper(group: PreprocessorGroup, i: number): PreprocessorGroup {\n\tconst wrapper: PreprocessorGroup = {};\n\n\tfor (const [processorType, processorFn] of Object.entries(group) as Array<\n\t\t// eslint-disable-next-line no-unused-vars\n\t\t[keyof PreprocessorGroup, (options: { filename?: string; content: string }) => Processed]\n\t>) {\n\t\twrapper[processorType] = async (options) => {\n\t\t\tconst result = await processorFn(options);\n\n\t\t\tif (result && result.code !== options.content) {\n\t\t\t\tlet invalidMap = false;\n\t\t\t\tif (!result.map) {\n\t\t\t\t\tinvalidMap = true;\n\t\t\t\t\tlog.warn.enabled &&\n\t\t\t\t\t\tlog.warn.once(\n\t\t\t\t\t\t\t`preprocessor at index ${i} did not return a sourcemap for ${processorType} transform`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfilename: options.filename,\n\t\t\t\t\t\t\t\ttype: processorType,\n\t\t\t\t\t\t\t\tprocessor: processorFn.toString()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t} else if ((result.map as any)?.mappings === '') {\n\t\t\t\t\tinvalidMap = true;\n\t\t\t\t\tlog.warn.enabled &&\n\t\t\t\t\t\tlog.warn.once(\n\t\t\t\t\t\t\t`preprocessor at index ${i} returned an invalid empty sourcemap for ${processorType} transform`,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfilename: options.filename,\n\t\t\t\t\t\t\t\ttype: processorType,\n\t\t\t\t\t\t\t\tprocessor: processorFn.toString()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (invalidMap) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst map = await buildSourceMap(options.content, result.code, options.filename);\n\t\t\t\t\t\tif (map) {\n\t\t\t\t\t\t\tlog.debug.enabled &&\n\t\t\t\t\t\t\t\tlog.debug(\n\t\t\t\t\t\t\t\t\t`adding generated sourcemap to preprocesor result for ${options.filename}`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tresult.map = map;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tlog.error(`failed to build sourcemap`, e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\t}\n\n\treturn wrapper;\n}\n","import MagicString, { MagicStringOptions } from 'magic-string';\nimport { log } from './log';\n\nexport async function buildMagicString(\n\tfrom: string,\n\tto: string,\n\toptions?: MagicStringOptions\n): Promise<MagicString | null> {\n\tlet diff_match_patch, DIFF_DELETE: number, DIFF_INSERT: number;\n\ttry {\n\t\tconst dmpPkg = await import('diff-match-patch');\n\t\tdiff_match_patch = dmpPkg.diff_match_patch;\n\t\tDIFF_INSERT = dmpPkg.DIFF_INSERT;\n\t\tDIFF_DELETE = dmpPkg.DIFF_DELETE;\n\t} catch (e) {\n\t\tlog.error.once(\n\t\t\t'Failed to import optional dependency \"diff-match-patch\". Please install it to enable generated sourcemaps.'\n\t\t);\n\t\treturn null;\n\t}\n\n\tconst dmp = new diff_match_patch();\n\tconst diffs = dmp.diff_main(from, to);\n\tdmp.diff_cleanupSemantic(diffs);\n\tconst m = new MagicString(from, options);\n\tlet pos = 0;\n\tfor (let i = 0; i < diffs.length; i++) {\n\t\tconst diff = diffs[i];\n\t\tconst nextDiff = diffs[i + 1];\n\t\tif (diff[0] === DIFF_DELETE) {\n\t\t\tif (nextDiff?.[0] === DIFF_INSERT) {\n\t\t\t\t// delete followed by insert, use overwrite and skip ahead\n\t\t\t\tm.overwrite(pos, pos + diff[1].length, nextDiff[1]);\n\t\t\t\ti++;\n\t\t\t} else {\n\t\t\t\tm.remove(pos, pos + diff[1].length);\n\t\t\t}\n\t\t\tpos += diff[1].length;\n\t\t} else if (diff[0] === DIFF_INSERT) {\n\t\t\tif (nextDiff) {\n\t\t\t\tm.appendRight(pos, diff[1]);\n\t\t\t} else {\n\t\t\t\tm.append(diff[1]);\n\t\t\t}\n\t\t} else {\n\t\t\t// unchanged block, advance pos\n\t\t\tpos += diff[1].length;\n\t\t}\n\t}\n\t// at this point m.toString() === to\n\treturn m;\n}\n\nexport async function buildSourceMap(from: string, to: string, filename?: string) {\n\t// @ts-ignore\n\tconst m = await buildMagicString(from, to, { filename });\n\treturn m ? m.generateDecodedMap({ source: filename, hires: true, includeContent: false }) : null;\n}\n","import { SvelteRequest } from './id';\nimport { Code, CompileData } from './compile';\n\nexport class VitePluginSvelteCache {\n\tprivate _css = new Map<string, Code>();\n\tprivate _js = new Map<string, Code>();\n\tprivate _dependencies = new Map<string, string[]>();\n\tprivate _dependants = new Map<string, Set<string>>();\n\tprivate _resolvedSvelteFields = new Map<string, string>();\n\tprivate _errors = new Map<string, any>();\n\n\tpublic update(compileData: CompileData) {\n\t\tthis._errors.delete(compileData.normalizedFilename);\n\t\tthis.updateCSS(compileData);\n\t\tthis.updateJS(compileData);\n\t\tthis.updateDependencies(compileData);\n\t}\n\n\tpublic has(svelteRequest: SvelteRequest) {\n\t\tconst id = svelteRequest.normalizedFilename;\n\t\treturn this._errors.has(id) || this._js.has(id) || this._css.has(id);\n\t}\n\n\tpublic setError(svelteRequest: SvelteRequest, error: any) {\n\t\t// keep dependency info, otherwise errors in dependants would not trigger an update after fixing\n\t\t// because they are no longer watched\n\t\tthis.remove(svelteRequest, true);\n\t\tthis._errors.set(svelteRequest.normalizedFilename, error);\n\t}\n\n\tprivate updateCSS(compileData: CompileData) {\n\t\tthis._css.set(compileData.normalizedFilename, compileData.compiled.css);\n\t}\n\n\tprivate updateJS(compileData: CompileData) {\n\t\tif (!compileData.ssr) {\n\t\t\t// do not cache SSR js\n\t\t\tthis._js.set(compileData.normalizedFilename, compileData.compiled.js);\n\t\t}\n\t}\n\n\tprivate updateDependencies(compileData: CompileData) {\n\t\tconst id = compileData.normalizedFilename;\n\t\tconst prevDependencies = this._dependencies.get(id) || [];\n\t\tconst dependencies = compileData.dependencies;\n\t\tthis._dependencies.set(id, dependencies);\n\t\tconst removed = prevDependencies.filter((d) => !dependencies.includes(d));\n\t\tconst added = dependencies.filter((d) => !prevDependencies.includes(d));\n\t\tadded.forEach((d) => {\n\t\t\tif (!this._dependants.has(d)) {\n\t\t\t\tthis._dependants.set(d, new Set<string>());\n\t\t\t}\n\t\t\tthis._dependants.get(d)!.add(compileData.filename);\n\t\t});\n\t\tremoved.forEach((d) => {\n\t\t\tthis._dependants.get(d)!.delete(compileData.filename);\n\t\t});\n\t}\n\n\tpublic remove(svelteRequest: SvelteRequest, keepDependencies: boolean = false): boolean {\n\t\tconst id = svelteRequest.normalizedFilename;\n\t\tlet removed = false;\n\t\tif (this._errors.delete(id)) {\n\t\t\tremoved = true;\n\t\t}\n\t\tif (this._js.delete(id)) {\n\t\t\tremoved = true;\n\t\t}\n\t\tif (this._css.delete(id)) {\n\t\t\tremoved = true;\n\t\t}\n\t\tif (!keepDependencies) {\n\t\t\tconst dependencies = this._dependencies.get(id);\n\t\t\tif (dependencies) {\n\t\t\t\tremoved = true;\n\t\t\t\tdependencies.forEach((d) => {\n\t\t\t\t\tconst dependants = this._dependants.get(d);\n\t\t\t\t\tif (dependants && dependants.has(svelteRequest.filename)) {\n\t\t\t\t\t\tdependants.delete(svelteRequest.filename);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tthis._dependencies.delete(id);\n\t\t\t}\n\t\t}\n\n\t\treturn removed;\n\t}\n\n\tpublic getCSS(svelteRequest: SvelteRequest) {\n\t\treturn this._css.get(svelteRequest.normalizedFilename);\n\t}\n\n\tpublic getJS(svelteRequest: SvelteRequest) {\n\t\tif (!svelteRequest.ssr) {\n\t\t\t// SSR js isn't cached\n\t\t\treturn this._js.get(svelteRequest.normalizedFilename);\n\t\t}\n\t}\n\n\tpublic getError(svelteRequest: SvelteRequest) {\n\t\treturn this._errors.get(svelteRequest.normalizedFilename);\n\t}\n\n\tpublic getDependants(path: string): string[] {\n\t\tconst dependants = this._dependants.get(path);\n\t\treturn dependants ? [...dependants] : [];\n\t}\n\n\tpublic getResolvedSvelteField(name: string, importer?: string): string | void {\n\t\treturn this._resolvedSvelteFields.get(this._getResolvedSvelteFieldKey(name, importer));\n\t}\n\n\tpublic setResolvedSvelteField(\n\t\timportee: string,\n\t\timporter: string | undefined = undefined,\n\t\tresolvedSvelte: string\n\t) {\n\t\tthis._resolvedSvelteFields.set(\n\t\t\tthis._getResolvedSvelteFieldKey(importee, importer),\n\t\t\tresolvedSvelte\n\t\t);\n\t}\n\n\tprivate _getResolvedSvelteFieldKey(importee: string, importer?: string): string {\n\t\treturn importer ? `${importer} > ${importee}` : importee;\n\t}\n}\n","import { VitePluginSvelteCache } from './vite-plugin-svelte-cache';\nimport fs from 'fs';\nimport { log } from './log';\nimport { IdParser } from './id';\nimport { ResolvedOptions } from './options';\nimport { knownSvelteConfigNames } from './load-svelte-config';\nimport path from 'path';\nimport { FSWatcher } from 'vite';\n\nexport function setupWatchers(\n\toptions: ResolvedOptions,\n\tcache: VitePluginSvelteCache,\n\trequestParser: IdParser\n) {\n\tconst { server, configFile: svelteConfigFile } = options;\n\tif (!server) {\n\t\treturn;\n\t}\n\tconst { watcher, ws } = server;\n\tconst { root, server: serverConfig } = server.config;\n\n\tconst emitChangeEventOnDependants = (filename: string) => {\n\t\tconst dependants = cache.getDependants(filename);\n\t\tdependants.forEach((dependant) => {\n\t\t\tif (fs.existsSync(dependant)) {\n\t\t\t\tlog.debug(\n\t\t\t\t\t`emitting virtual change event for \"${dependant}\" because depdendency \"${filename}\" changed`\n\t\t\t\t);\n\t\t\t\twatcher.emit('change', dependant);\n\t\t\t}\n\t\t});\n\t};\n\n\tconst removeUnlinkedFromCache = (filename: string) => {\n\t\tconst svelteRequest = requestParser(filename, false);\n\t\tif (svelteRequest) {\n\t\t\tconst removedFromCache = cache.remove(svelteRequest);\n\t\t\tif (removedFromCache) {\n\t\t\t\tlog.debug(`cleared VitePluginSvelteCache for deleted file ${filename}`);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst triggerViteRestart = (filename: string) => {\n\t\tif (serverConfig.middlewareMode) {\n\t\t\t// in middlewareMode we can't restart the server automatically\n\t\t\t// show the user an overlay instead\n\t\t\tconst message =\n\t\t\t\t'Svelte config change detected, restart your dev process to apply the changes.';\n\t\t\tlog.info(message, filename);\n\t\t\tws.send({\n\t\t\t\ttype: 'error',\n\t\t\t\terr: { message, stack: '', plugin: 'vite-plugin-svelte', id: filename }\n\t\t\t});\n\t\t} else {\n\t\t\tlog.info(`svelte config changed: restarting vite server. - file: ${filename}`);\n\t\t\tserver.restart();\n\t\t}\n\t};\n\n\t// collection of watcher listeners by event\n\tconst listenerCollection = {\n\t\tadd: [] as Array<Function>,\n\t\tchange: [emitChangeEventOnDependants],\n\t\tunlink: [removeUnlinkedFromCache, emitChangeEventOnDependants]\n\t};\n\n\tif (svelteConfigFile !== false) {\n\t\t// configFile false means we ignore the file and external process is responsible\n\t\tconst possibleSvelteConfigs = knownSvelteConfigNames.map((cfg) => path.join(root, cfg));\n\t\tconst restartOnConfigAdd = (filename: string) => {\n\t\t\tif (possibleSvelteConfigs.includes(filename)) {\n\t\t\t\ttriggerViteRestart(filename);\n\t\t\t}\n\t\t};\n\n\t\tconst restartOnConfigChange = (filename: string) => {\n\t\t\tif (filename === svelteConfigFile) {\n\t\t\t\ttriggerViteRestart(filename);\n\t\t\t}\n\t\t};\n\n\t\tif (svelteConfigFile) {\n\t\t\tlistenerCollection.change.push(restartOnConfigChange);\n\t\t\tlistenerCollection.unlink.push(restartOnConfigChange);\n\t\t} else {\n\t\t\tlistenerCollection.add.push(restartOnConfigAdd);\n\t\t}\n\t}\n\n\tObject.entries(listenerCollection).forEach(([evt, listeners]) => {\n\t\tif (listeners.length > 0) {\n\t\t\twatcher.on(evt, (filename) => listeners.forEach((listener) => listener(filename)));\n\t\t}\n\t});\n}\n// taken from vite utils\nexport function ensureWatchedFile(watcher: FSWatcher, file: string | null, root: string): void {\n\tif (\n\t\tfile &&\n\t\t// only need to watch if out of root\n\t\t!file.startsWith(root + '/') &&\n\t\t// some rollup plugins use null bytes for private resolved Ids\n\t\t!file.includes('\\0') &&\n\t\tfs.existsSync(file)\n\t) {\n\t\t// resolve file to normalized system path\n\t\twatcher.add(path.resolve(file));\n\t}\n}\n","import path from 'path';\nimport { builtinModules, createRequire } from 'module';\nimport { is_common_without_svelte_field, resolveDependencyData } from './dependencies';\nimport { VitePluginSvelteCache } from './vite-plugin-svelte-cache';\n\nexport function resolveViaPackageJsonSvelte(\n\timportee: string,\n\timporter: string | undefined,\n\tcache: VitePluginSvelteCache\n): string | void {\n\tif (\n\t\timporter &&\n\t\tisBareImport(importee) &&\n\t\t!isNodeInternal(importee) &&\n\t\t!is_common_without_svelte_field(importee)\n\t) {\n\t\tconst cached = cache.getResolvedSvelteField(importee, importer);\n\t\tif (cached) {\n\t\t\treturn cached;\n\t\t}\n\t\tconst localRequire = createRequire(importer);\n\t\tconst pkgData = resolveDependencyData(importee, localRequire);\n\t\tif (pkgData) {\n\t\t\tconst { pkg, dir } = pkgData;\n\t\t\tif (pkg.svelte) {\n\t\t\t\tconst result = path.resolve(dir, pkg.svelte);\n\t\t\t\tcache.setResolvedSvelteField(importee, importer, result);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction isNodeInternal(importee: string) {\n\treturn importee.startsWith('node:') || builtinModules.includes(importee);\n}\n\nfunction isBareImport(importee: string): boolean {\n\tif (\n\t\t!importee ||\n\t\timportee[0] === '.' ||\n\t\timportee[0] === '\\0' ||\n\t\timportee.includes(':') ||\n\t\tpath.isAbsolute(importee)\n\t) {\n\t\treturn false;\n\t}\n\tconst parts = importee.split('/');\n\tswitch (parts.length) {\n\t\tcase 1:\n\t\t\treturn true;\n\t\tcase 2:\n\t\t\treturn parts[0].startsWith('@');\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n","import { promises as fs } from 'fs';\nimport path from 'path';\nimport { ResolvedOptions } from './options';\n\n// List of options that changes the prebundling result\nconst PREBUNDLE_SENSITIVE_OPTIONS: (keyof ResolvedOptions)[] = [\n\t'compilerOptions',\n\t'configFile',\n\t'experimental',\n\t'extensions',\n\t'ignorePluginPreprocessors',\n\t'preprocess'\n];\n\n/**\n * @returns Whether the Svelte metadata has changed\n */\nexport async function saveSvelteMetadata(cacheDir: string, options: ResolvedOptions) {\n\tconst svelteMetadata = generateSvelteMetadata(options);\n\tconst svelteMetadataPath = path.resolve(cacheDir, '_svelte_metadata.json');\n\n\tconst currentSvelteMetadata = JSON.stringify(svelteMetadata, (_, value) => {\n\t\t// Handle preprocessors\n\t\treturn typeof value === 'function' ? value.toString() : value;\n\t});\n\n\tlet existingSvelteMetadata: string | undefined;\n\ttry {\n\t\texistingSvelteMetadata = await fs.readFile(svelteMetadataPath, 'utf8');\n\t} catch {\n\t\t// ignore\n\t}\n\n\tawait fs.mkdir(cacheDir, { recursive: true });\n\tawait fs.writeFile(svelteMetadataPath, currentSvelteMetadata);\n\treturn currentSvelteMetadata !== existingSvelteMetadata;\n}\n\nfunction generateSvelteMetadata(options: ResolvedOptions) {\n\tconst metadata: Record<string, any> = {};\n\tfor (const key of PREBUNDLE_SENSITIVE_OPTIONS) {\n\t\tmetadata[key] = options[key];\n\t}\n\treturn metadata;\n}\n","import { Plugin, normalizePath } from 'vite';\nimport { log } from '../../utils/log';\nimport { InspectorOptions } from '../../utils/options';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport fs from 'fs';\nimport { idToFile } from './utils';\n\nconst defaultInspectorOptions: InspectorOptions = {\n\ttoggleKeyCombo: process.platform === 'win32' ? 'control-shift' : 'meta-shift',\n\tholdMode: false,\n\tshowToggleButton: 'active',\n\ttoggleButtonPos: 'top-right',\n\tcustomStyles: true\n};\n\nfunction getInspectorPath() {\n\tconst pluginPath = normalizePath(path.dirname(fileURLToPath(import.meta.url)));\n\treturn pluginPath.replace(/\\/vite-plugin-svelte\\/dist$/, '/vite-plugin-svelte/src/ui/inspector/');\n}\n\nexport function svelteInspector(): Plugin {\n\tconst inspectorPath = getInspectorPath();\n\tlog.debug.enabled && log.debug(`svelte inspector path: ${inspectorPath}`);\n\tlet inspectorOptions: InspectorOptions;\n\tlet appendTo: string | undefined;\n\tlet disabled = false;\n\n\treturn {\n\t\tname: 'vite-plugin-svelte:inspector',\n\t\tapply: 'serve',\n\t\tenforce: 'pre',\n\n\t\tconfigResolved(config) {\n\t\t\tconst vps = config.plugins.find((p) => p.name === 'vite-plugin-svelte');\n\t\t\tif (vps?.api?.options?.experimental?.inspector) {\n\t\t\t\tinspectorOptions = {\n\t\t\t\t\t...defaultInspectorOptions,\n\t\t\t\t\t...vps.api.options.experimental.inspector\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!vps || !inspectorOptions) {\n\t\t\t\tlog.debug('inspector disabled, could not find config');\n\t\t\t\tdisabled = true;\n\t\t\t} else {\n\t\t\t\tif (vps.api.options.kit && !inspectorOptions.appendTo) {\n\t\t\t\t\tconst out_dir = path.basename(vps.api.options.kit.outDir || '.svelte-kit');\n\t\t\t\t\tinspectorOptions.appendTo = `${out_dir}/generated/root.svelte`;\n\t\t\t\t}\n\t\t\t\tappendTo = inspectorOptions.appendTo;\n\t\t\t}\n\t\t},\n\n\t\tasync resolveId(importee: string, importer, options) {\n\t\t\tif (options?.ssr || disabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (importee.startsWith('virtual:svelte-inspector-options')) {\n\t\t\t\treturn importee;\n\t\t\t} else if (importee.startsWith('virtual:svelte-inspector-path:')) {\n\t\t\t\tconst resolved = importee.replace('virtual:svelte-inspector-path:', inspectorPath);\n\t\t\t\tlog.debug.enabled && log.debug(`resolved ${importee} with ${resolved}`);\n\t\t\t\treturn resolved;\n\t\t\t}\n\t\t},\n\n\t\tasync load(id, options) {\n\t\t\tif (options?.ssr || disabled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (id === 'virtual:svelte-inspector-options') {\n\t\t\t\treturn `export default ${JSON.stringify(inspectorOptions ?? {})}`;\n\t\t\t} else if (id.startsWith(inspectorPath)) {\n\t\t\t\t// read file ourselves to avoid getting shut out by vites fs.allow check\n\t\t\t\tconst file = idToFile(id);\n\t\t\t\tif (fs.existsSync(file)) {\n\t\t\t\t\treturn await fs.promises.readFile(file, 'utf-8');\n\t\t\t\t} else {\n\t\t\t\t\tlog.error(`failed to find file for svelte-inspector: ${file}, referenced by id ${id}.`);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\ttransform(code: string, id: string, options?: { ssr?: boolean }) {\n\t\t\tif (options?.ssr || disabled || !appendTo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (id.endsWith(appendTo)) {\n\t\t\t\treturn { code: `${code}\\nimport 'virtual:svelte-inspector-path:load-inspector.js'` };\n\t\t\t}\n\t\t},\n\t\ttransformIndexHtml(html) {\n\t\t\tif (disabled || appendTo) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\thtml,\n\t\t\t\ttags: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttag: 'script',\n\t\t\t\t\t\tinjectTo: 'body',\n\t\t\t\t\t\tattrs: {\n\t\t\t\t\t\t\ttype: 'module',\n\t\t\t\t\t\t\t// /@id/ is needed, otherwise the virtual: is seen as protocol by browser and cors error happens\n\t\t\t\t\t\t\tsrc: '/@id/virtual:svelte-inspector-path:load-inspector.js'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t};\n\t\t}\n\t};\n}\n","const FS_PREFIX = `/@fs/`;\nconst IS_WINDOWS = process.platform === 'win32';\nconst queryRE = /\\?.*$/s;\nconst hashRE = /#.*$/s;\n\nexport function idToFile(id: string): string {\n\t// strip /@fs/ but keep leading / on non-windows\n\tif (id.startsWith(FS_PREFIX)) {\n\t\tid = id = id.slice(IS_WINDOWS ? FS_PREFIX.length : FS_PREFIX.length - 1);\n\t}\n\t// strip query and hash\n\treturn id.replace(hashRE, '').replace(queryRE, '');\n}\n"],"mappings":";;;;;;;;;AAAA,OAAOA,SAAQ;;;ACCf,SAAS,MAAM,QAAQ,WAAW;AAClC,OAAO,WAAW;AAIlB,IAAM,SAAmB,CAAC,SAAS,QAAQ,QAAQ,SAAS,QAAQ;AACpE,IAAM,SAAS;AACf,IAAM,UAAkC;AAAA,EACvC,OAAO;AAAA,IACN,KAAK,MAAM,QAAQ,QAAQ;AAAA,IAC3B,SAAS;AAAA,IACT,SAAS;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACL,OAAO;AAAA,IACP,KAAK,QAAQ;AAAA,IACb,SAAS;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACL,OAAO;AAAA,IACP,KAAK,QAAQ;AAAA,IACb,SAAS;AAAA,EACV;AAAA,E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BAAY,iBAAZ,mBAA0B,WAAU,QAAQ,QAAQ;AACvD,sBAAY,aAAa,QAAQ,CAAC,MAAM;AACvC,8BAAkB,QAAQ,OAAQ,SAAS,GAAG,QAAQ,IAAI;AAAA,UAC3D,CAAC;AAAA,QACF;AACA,YAAI,MAAM,qCAAqC,cAAc,UAAU;AACvE,eAAO;AAAA,UACN,GAAG,YAAY,SAAS;AAAA,UACxB,MAAM;AAAA,YACL,MAAM;AAAA,cACL,MAAM,YAAY;AAAA,YACnB;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MAEA,gBAAgB,KAA2D;AAC1E,YAAI,CAAC,QAAQ,OAAO,CAAC,QAAQ,SAAS;AACrC;AAAA,QACD;AACA,cAAM,gBAAgB,cAAc,IAAI,MAAM,OAAO,IAAI,SAAS;AAClE,YAAI,eAAe;AAClB,cAAI;AACH,mBAAO,gBAAgBA,gBAAe,KAAK,eAAe,OAAO,OAAO;AAAA,UACzE,SAAS,GAAP;AACD,kBAAM,cAAc,GAAG,OAAO;AAAA,UAC/B;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACA,UAAQ,KAAK,gBAAgB,CAAC;AAC9B,SAAO,QAAQ,OAAO,OAAO;AAC9B;","names":["fs","compileSvelte","compileSvelte","normalizePath","fs","fs","path","path","fs","createRequire","e","prefix","createRequire","fs","compile","preprocess","fs","preprocess","compile","MagicString","preprocess","path","preprocess","MagicString","_a","preResolveOptions","normalizePath","path","_a","createRequire","_b","path","fs","path","fs","path","createRequire","createRequire","path","fs","path","normalizePath","path","fs","IS_WINDOWS","normalizePath","path","fs","compileSvelte","fs"]}