biketrack-app/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js.map

1 line
131 KiB
Plaintext
Raw Permalink Normal View History

2022-07-11 10:27:11 +02:00
{"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\