{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import * as babel from '@babel/core';\nimport solid from 'babel-preset-solid';\nimport { readFileSync } from 'fs';\nimport { mergeAndConcat } from 'merge-anything';\nimport { createRequire } from 'module';\nimport path from 'path';\nimport solidRefresh from 'solid-refresh/babel';\nimport type { FilterPattern, Plugin } from 'vite';\nimport { createFilter, searchForWorkspaceRoot, version } from 'vite';\nimport { crawlFrameworkPkgs } from 'vitefu';\n\nconst require = createRequire(import.meta.url);\n\nconst runtimePublicPath = '/@solid-refresh';\nconst runtimeFilePath = require.resolve('solid-refresh/dist/solid-refresh.mjs');\nconst runtimeCode = readFileSync(runtimeFilePath, 'utf-8');\n\nconst viteVersionMajor = +version.split('.')[0];\nconst isVite6OrNewer = viteVersionMajor >= 6;\nconst isVite8OrNewer = viteVersionMajor >= 8;\n\n/** Possible options for the extensions property */\nexport interface ExtensionOptions {\n  typescript?: boolean;\n}\n\n/** Configuration options for vite-plugin-solid. */\nexport interface Options {\n  /**\n   * A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files\n   * the plugin should operate on.\n   */\n  include?: FilterPattern;\n  /**\n   * A [picomatch](https://github.com/micromatch/picomatch) pattern, or array of patterns, which specifies the files\n   * to be ignored by the plugin.\n   */\n  exclude?: FilterPattern;\n  /**\n   * This will inject solid-js/dev in place of solid-js in dev mode. Has no\n   * effect in prod. If set to `false`, it won't inject it in dev. This is\n   * useful for extra logs and debugging.\n   *\n   * @default true\n   */\n  dev?: boolean;\n  /**\n   * This will force SSR code in the produced files.\n   *\n   * With `true`, client code is hydratable and server code is hydratable SSR\n   * output. With `false`, client code is non-hydratable DOM output, and modules\n   * loaded on the server (for example through `ssrLoadModule` to prerender a\n   * page) get non-hydratable SSR output.\n   *\n   * @default false\n   */\n  ssr?: boolean;\n\n  /**\n   * This will inject HMR runtime in dev mode. Has no effect in prod. If\n   * set to `false`, it won't inject the runtime in dev.\n   *\n   * @default true\n   */\n  hot?: boolean;\n  /**\n   * This registers additional extensions that should be processed by\n   * vite-plugin-solid.\n   *\n   * @default undefined\n   */\n  extensions?: (string | [string, ExtensionOptions])[];\n  /**\n   * Pass any additional babel transform options. They will be merged with\n   * the transformations required by Solid.\n   *\n   * @default {}\n   */\n  babel?:\n    | babel.TransformOptions\n    | ((source: string, id: string, ssr: boolean) => babel.TransformOptions)\n    | ((source: string, id: string, ssr: boolean) => Promise<babel.TransformOptions>);\n  /**\n   * Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).\n   * They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).\n   *\n   * @default {}\n   */\n  solid?: {\n    /**\n     * Remove unnecessary closing tags from template strings. More info here:\n     * https://github.com/solidjs/solid/blob/main/CHANGELOG.md#smaller-templates\n     *\n     * @default false\n     */\n    omitNestedClosingTags?: boolean;\n\n    /**\n     * Remove the last closing tag from template strings. Enabled by default even when `omitNestedClosingTags` is disabled.\n     * Can be disabled for compatibility for some browser-like environments.\n     *\n     * @default true\n     */\n    omitLastClosingTag?: boolean;\n\n    /**\n     * Remove unnecessary quotes from template strings.\n     * Can be disabled for compatibility for some browser-like environments.\n     *\n     * @default true\n     */\n    omitQuotes?: boolean;\n\n    /**\n     * Only applies when `hydratable` is `true`. When `true`, an element marked\n     * `$ServerOnly` registers no client template, so it can only be obtained by\n     * hydrating server-rendered DOM and throws if it is ever re-created on the client.\n     *\n     * The plugin sets this to `false` for client transforms in dev while HMR is\n     * enabled, since Solid Refresh re-runs components outside of hydration. Pass\n     * an explicit value to override that.\n     *\n     * @default true\n     */\n    omitServerOnlyTemplates?: boolean;\n\n    /**\n     * The name of the runtime module to import the methods from.\n     *\n     * @default \"solid-js/web\"\n     */\n    moduleName?: string;\n\n    /**\n     * The output mode of the compiler.\n     * Can be:\n     * - \"dom\" is standard output\n     * - \"ssr\" is for server side rendering of strings.\n     * - \"universal\" is for using custom renderers from solid-js/universal\n     *\n     * @default \"dom\"\n     */\n    generate?: 'ssr' | 'dom' | 'universal';\n\n    /**\n     * Indicate whether the output should contain hydratable markers.\n     *\n     * @default false\n     */\n    hydratable?: boolean;\n\n    /**\n     * Boolean to indicate whether to enable automatic event delegation on camelCase.\n     *\n     * @default true\n     */\n    delegateEvents?: boolean;\n\n    /**\n     * Boolean indicates whether smart conditional detection should be used.\n     * This optimizes simple boolean expressions and ternaries in JSX.\n     *\n     * @default true\n     */\n    wrapConditionals?: boolean;\n\n    /**\n     * Boolean indicates whether to set current render context on Custom Elements and slots.\n     * Useful for seemless Context API with Web Components.\n     *\n     * @default true\n     */\n    contextToCustomElements?: boolean;\n\n    /**\n     * Array of Component exports from module, that aren't included by default with the library.\n     * This plugin will automatically import them if it comes across them in the JSX.\n     *\n     * @default [\"For\",\"Show\",\"Switch\",\"Match\",\"Suspense\",\"SuspenseList\",\"Portal\",\"Index\",\"Dynamic\",\"ErrorBoundary\"]\n     */\n    builtIns?: string[];\n  };\n}\n\nfunction getExtension(filename: string): string {\n  const index = filename.lastIndexOf('.');\n  return index < 0 ? '' : filename.substring(index);\n}\n\n/**\n * The path the transform compiles for `id`. This is normally `id` without its\n * query. Some plugins put the extension after the query instead, such as\n * unplugin-icons' `~icons/mdi/folder?width=2em.tsx`. Then the full id is used,\n * as it was before queries were stripped. #206\n */\nfunction getTransformPath(id: string, isHandled: (path: string) => boolean): string {\n  const cleanId = id.replace(/\\?.*$/, '');\n  return cleanId !== id && !isHandled(cleanId) && isHandled(id) ? id : cleanId;\n}\nfunction containsSolidField(fields: Record<string, any>) {\n  const keys = Object.keys(fields);\n  for (let i = 0; i < keys.length; i++) {\n    const key = keys[i];\n    if (key === 'solid') return true;\n    if (typeof fields[key] === 'object' && fields[key] != null && containsSolidField(fields[key]))\n      return true;\n  }\n  return false;\n}\n\nfunction getJestDomExport(setupFiles: string[], root: string) {\n  if (setupFiles?.some((file) => /jest-dom/.test(file))) return undefined;\n\n  // Resolve from the project root, not from this plugin's own location. With pnpm's\n  // isolated node_modules layout the plugin can reach a jest-dom that only exists as a\n  // transitive dependency (e.g. of Storybook), while Vitest resolves `setupFiles` from the\n  // project root, where it isn't installed, and fails to load it.\n  // https://github.com/solidjs/solid-vite-plugin/issues/231\n  // The bare specifier (not the resolved path) is injected on purpose: `require.resolve` picks\n  // jest-dom's CommonJS entry, which Vitest refuses to load, while Vitest itself resolves the\n  // specifier to the ESM entry.\n  const projectRequire = createRequire(path.join(root, 'package.json'));\n  return ['@testing-library/jest-dom/vitest', '@testing-library/jest-dom/extend-expect'].find(\n    (specifier) => {\n      try {\n        projectRequire.resolve(specifier);\n        return true;\n      } catch (e) {\n        return false;\n      }\n    },\n  );\n}\n\nfunction readPackageJson(specifier: string, requires: NodeRequire[]) {\n  for (const req of requires) {\n    try {\n      const file = req.resolve(`${specifier}/package.json`);\n      return { dir: path.dirname(file), pkg: JSON.parse(readFileSync(file, 'utf-8')) };\n    } catch (e) {}\n  }\n  return undefined;\n}\n\n/**\n * Vitest before 1.0 resolves `setupFiles` with `require.resolve`, which picks\n * jest-dom's CommonJS `vitest` entry. In that file `require('vitest').expect`\n * is undefined, so it throws \"Cannot read properties of undefined (reading\n * 'extend')\". For those versions, return the path of jest-dom's ESM entry. #141\n */\nfunction getJestDomVitestEsmPath(root: string): string | undefined {\n  const rootRequire = createRequire(path.join(path.resolve(root), 'package.json'));\n  const vitest = readPackageJson('vitest', [rootRequire, require]);\n  if (!vitest || +String(vitest.pkg.version).split('.')[0] >= 1) return undefined;\n  const jestDom = readPackageJson('@testing-library/jest-dom', [rootRequire, require]);\n  const entry = jestDom?.pkg.exports?.['./vitest']?.import;\n  const file = typeof entry === 'string' ? entry : entry?.default;\n  return typeof file === 'string' ? path.join(jestDom.dir, file) : undefined;\n}\n\nexport default function solidPlugin(options: Partial<Options> = {}): Plugin {\n  const filter = createFilter(options.include, options.exclude);\n\n  let needHmr = false;\n  let replaceDev = false;\n  let projectRoot = process.cwd();\n  let isTestMode = false;\n  let solidPkgsConfig: Awaited<ReturnType<typeof crawlFrameworkPkgs>>;\n  // Packages that import solid-js without a `solid` export condition, found\n  // by the crawl in test mode. They are inlined with solid-js (see\n  // `test.server.deps` below).\n  const testRuntimeConsumers = new Set<string>();\n  // True when a DOM test run inlines the Solid runtime. The `ssr`\n  // environment then does not get the `browser` condition (see\n  // `configEnvironment` below).\n  let domTestRuntimeInlined = false;\n\n  return {\n    name: 'solid',\n    enforce: 'pre',\n\n    async config(userConfig, { command }) {\n      // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode\n      replaceDev = options.dev === true || (options.dev !== false && command === 'serve');\n      projectRoot = userConfig.root;\n      isTestMode = userConfig.mode === 'test';\n      domTestRuntimeInlined = false;\n\n      // Leave the user's `resolve.alias` as it is. Turning an object into an\n      // array changes how Vite merges it with aliases from later plugins:\n      // their entries then take priority over the user's. #130\n\n      solidPkgsConfig = await crawlFrameworkPkgs({\n        viteUserConfig: userConfig,\n        root: projectRoot || process.cwd(),\n        isBuild: command === 'build',\n        isFrameworkPkgByJson(pkgJson) {\n          return containsSolidField(pkgJson.exports || {});\n        },\n        // Only records the runtime consumers for the jsdom test posture.\n        // Returning false keeps vitefu's output unchanged.\n        isSemiFrameworkPkgByJson(pkgJson) {\n          if (\n            isTestMode &&\n            !options.ssr &&\n            typeof pkgJson.name === 'string' &&\n            (pkgJson.dependencies?.['solid-js'] || pkgJson.peerDependencies?.['solid-js'])\n          ) {\n            testRuntimeConsumers.add(pkgJson.name);\n          }\n          return false;\n        },\n      });\n\n      const solidDeps = ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h'];\n\n      // vitefu only reads the dependencies of the package.json at the Vite\n      // root. In a workspace, the project can also import packages that are\n      // only declared in the workspace root's package.json (npm and yarn\n      // hoist them). A framework package found that way was left external,\n      // so Node loaded its raw `.jsx` source and failed with\n      // `Unknown file extension \".jsx\"` (#157). Crawl the workspace root too\n      // and inline its framework packages. Only `ssr.noExternal` is merged:\n      // inlining a name that is never imported does nothing, while\n      // `optimizeDeps.include` entries must resolve from the project root.\n      const crawlRoot = path.resolve(projectRoot || process.cwd());\n      const workspaceRoot = searchForWorkspaceRoot(crawlRoot);\n      if (workspaceRoot !== crawlRoot) {\n        const workspacePkgs = await crawlFrameworkPkgs({\n          viteUserConfig: userConfig,\n          root: workspaceRoot,\n          isBuild: command === 'build',\n          isFrameworkPkgByJson(pkgJson) {\n            return containsSolidField(pkgJson.exports || {});\n          },\n        });\n        for (const name of workspacePkgs.ssr.noExternal) {\n          if (!solidPkgsConfig.ssr.noExternal.includes(name)) {\n            solidPkgsConfig.ssr.noExternal.push(name);\n          }\n        }\n      }\n\n      // fix for bundling dev in production\n      const nestedDeps = replaceDev ? solidDeps : [];\n\n      const userTest = (userConfig as any).test ?? {};\n      const test = {} as any;\n      if (userConfig.mode === 'test') {\n        // to simplify the processing of the config, we normalize the setupFiles to an array\n        const userSetupFiles: string[] =\n          typeof userTest.setupFiles === 'string'\n            ? [userTest.setupFiles]\n            : userTest.setupFiles || [];\n\n        if (!userTest.environment && !userTest.workspace && !userTest.projects && !options.ssr) {\n          test.environment = 'jsdom';\n        }\n\n        // Vitest 5 defaults `test.sharedViteServer` to true: inline projects\n        // then reuse the root Vite server and take their `test` options from\n        // the raw root block captured before any `config` hook runs, so\n        // nothing injected here (jsdom, jest-dom, server.deps) reaches them.\n        // Vitest reads the option off the resolved root config, so this\n        // restores per-project resolution as under Vitest 4. Older Vitest\n        // versions ignore the option.\n        if (userTest.projects && userTest.sharedViteServer === undefined) {\n          test.sharedViteServer = false;\n        }\n\n        if (\n          !userTest.server?.deps?.external?.find((item: string | RegExp) =>\n            /solid-js/.test(item.toString()),\n          )\n        ) {\n          if (options.ssr) {\n            test.server = { deps: { external: [/solid-js/] } };\n          } else if (userTest.server?.deps?.inline !== true) {\n            // An externalized package is imported natively, and its own\n            // imports are resolved by the host runtime, not by Vite. Node\n            // gets the `browser` condition from vitest's worker\n            // `--conditions`, but Deno (in a worker thread) resolves\n            // `deno`/`node` and lands on the server build: `render` from\n            // `@solidjs/testing-library` threw \"Client-only API called on the\n            // server side\" (#369). Inline solid-js and the packages that\n            // import it, so these imports go through Vite's `browser`\n            // condition and load one client-build instance. A consumer left\n            // external would load a second, native copy. Packages with a\n            // `solid` export condition are inlined already through vitefu.\n            // A user `inline` list is merged with this one; `inline: true`\n            // inlines everything already.\n            test.server = {\n              deps: {\n                inline: [/[\\\\/]node_modules[\\\\/]solid-js[\\\\/]/, ...testRuntimeConsumers],\n              },\n            };\n          }\n          const environment = userTest.environment ?? test.environment;\n          domTestRuntimeInlined =\n            !options.ssr &&\n            !userTest.browser?.enabled &&\n            (environment === 'jsdom' || environment === 'happy-dom');\n        }\n        if (!userTest.browser?.enabled) {\n          // vitest browser mode already has bundled jest-dom assertions\n          // https://main.vitest.dev/guide/browser/assertion-api.html#assertion-api\n          const jestDomImport = getJestDomExport(\n            userSetupFiles,\n            path.resolve(projectRoot || process.cwd()),\n          );\n          if (jestDomImport) {\n            test.setupFiles = [\n              (jestDomImport === '@testing-library/jest-dom/vitest' &&\n                getJestDomVitestEsmPath(userConfig.root || process.cwd())) ||\n                jestDomImport,\n            ];\n          }\n        }\n      }\n\n      // Before Vite 6, conditions are set here for every build.\n      const legacyConditions = [\n        'solid',\n        ...(replaceDev ? ['development'] : []),\n        ...(userConfig.mode === 'test' && !options.ssr ? ['browser'] : []),\n      ];\n      // A server build with `ssr.target: 'webworker'` resolves solid-js to its\n      // browser build, so add the `worker` condition, which selects the server\n      // build. #153 Vite 4 and 5 read `ssr.resolve.conditions` instead of\n      // `resolve.conditions` when it is set, so it repeats the top-level list\n      // unless the user set their own. Vite 3 has no such option.\n      const userSsrConditions = (userConfig.ssr as any)?.resolve?.conditions;\n      const legacySsr =\n        userConfig.ssr?.target === 'webworker'\n          ? {\n              ...solidPkgsConfig.ssr,\n              resolve: {\n                conditions: userSsrConditions\n                  ? ['solid', 'worker']\n                  : [...legacyConditions, ...(userConfig.resolve?.conditions ?? []), 'worker'],\n              },\n            }\n          : solidPkgsConfig.ssr;\n\n      return {\n        /**\n         * We only need esbuild on .ts or .js files.\n         * .tsx & .jsx files are handled by us\n         */\n        // esbuild: { include: /\\.ts$/ },\n        resolve: {\n          conditions: isVite6OrNewer ? undefined : legacyConditions,\n          // Dedupe in builds too. A dependency that ships its own nested\n          // solid-js would otherwise add a second runtime to the bundle. #112\n          dedupe: solidDeps,\n        },\n        optimizeDeps: {\n          include: [...nestedDeps, ...solidPkgsConfig.optimizeDeps.include],\n          exclude: solidPkgsConfig.optimizeDeps.exclude,\n          // Vite 8+ uses Rolldown for dependency scanning. Rolldown defaults to\n          // React's automatic JSX runtime for .tsx files, injecting a\n          // react/jsx-dev-runtime import that fails to resolve and aborts the\n          // scan. 'preserve' is no fix: the scanner re-parses the transformed\n          // output as plain JS, so any preserved JSX is a hard parse error\n          // (issue #262). The classic runtime is the only scan-safe lowering:\n          // it emits bare `React.createElement` calls without injecting any\n          // import, and the scan output is never executed — it only exists so\n          // rolldown can walk the import graph.\n          ...(isVite8OrNewer\n            ? { rolldownOptions: { transform: { jsx: { runtime: 'classic' as const } } } }\n            : {}),\n        },\n        ...(!isVite6OrNewer ? { ssr: legacySsr } : {}),\n        ...(Object.keys(test).length ? { test } : {}),\n      };\n    },\n\n    // @ts-ignore This hook only works in Vite 6\n    async configEnvironment(name, config, opts) {\n      config.resolve ??= {};\n      // Emulate Vite default fallback for `resolve.conditions` if not set\n      if (config.resolve.conditions == null) {\n        // @ts-ignore These exports only exist in Vite 6\n        const { defaultClientConditions, defaultServerConditions } = await import('vite');\n        if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {\n          config.resolve.conditions = [...defaultClientConditions];\n        } else {\n          config.resolve.conditions = [...defaultServerConditions];\n        }\n      }\n      // Vitest passes the `ssr` environment's conditions to Node as\n      // `--conditions` for the packages it leaves external. With `browser`\n      // there, Node-only packages fail to load. For example, `msw/node`\n      // imports `@mswjs/interceptors/ClientRequest`, whose `browser`\n      // export is `null` (#125). DOM tests run in the `client` environment,\n      // and the Solid runtime is inlined in that case, so the `ssr`\n      // environment does not need `browser`.\n      const addBrowser =\n        isTestMode &&\n        !opts.isSsrTargetWebworker &&\n        !options.ssr &&\n        !(domTestRuntimeInlined && name === 'ssr');\n      config.resolve.conditions = [\n        'solid',\n        // A server build with `ssr.target: 'webworker'` starts from Vite's\n        // client conditions, which select the browser build of solid-js. Its\n        // `worker` export points at the server build. #153\n        ...(opts.isSsrTargetWebworker ? ['worker'] : []),\n        ...(replaceDev ? ['development'] : []),\n        ...(addBrowser ? ['browser'] : []),\n        ...config.resolve.conditions,\n      ];\n\n      // Set resolve.noExternal and resolve.external for SSR environment (Vite 6+)\n      // Only set resolve.external if noExternal is not true (to avoid conflicts with plugins like Cloudflare)\n      if (isVite6OrNewer && name === 'ssr' && solidPkgsConfig) {\n        if (config.resolve.noExternal !== true) {\n          config.resolve.noExternal = [\n            ...(Array.isArray(config.resolve.noExternal) ? config.resolve.noExternal : []),\n            ...solidPkgsConfig.ssr.noExternal,\n          ];\n          config.resolve.external = [\n            ...(Array.isArray(config.resolve.external) ? config.resolve.external : []),\n            ...solidPkgsConfig.ssr.external,\n          ];\n        }\n      }\n    },\n\n    configResolved(config) {\n      needHmr =\n        !isTestMode &&\n        config.command === 'serve' &&\n        config.mode !== 'production' &&\n        options.hot !== false;\n    },\n\n    resolveId(id) {\n      // `solid-refresh` is the import added by the HMR transform. It is\n      // resolved here rather than through `resolve.alias`, because adding an\n      // alias array would also change how the user's aliases merge. #130\n      if (id === runtimePublicPath || id === 'solid-refresh') return runtimePublicPath;\n    },\n\n    load(id) {\n      if (id === runtimePublicPath) return runtimeCode;\n    },\n\n    async transform(source, id, transformOptions) {\n      const isSsr = this.environment\n        ? this.environment.config.consumer === 'server'\n        : Boolean(transformOptions?.ssr);\n\n      const extensionsToWatch = options.extensions || [];\n      const allExtensions = extensionsToWatch.map((extension) =>\n        // An extension can be a string or a tuple [extension, options]\n        typeof extension === 'string' ? extension : extension[0],\n      );\n\n      if (!filter(id)) {\n        return null;\n      }\n\n      id = getTransformPath(\n        id,\n        (path) => /\\.[mc]?[tj]sx$/i.test(path) || allExtensions.includes(getExtension(path)),\n      );\n      // Read the extension from the query-free path, so a dot inside the\n      // query (`a.mdx?x=1.5`) is not taken as the extension.\n      const currentFileExtension = getExtension(id);\n\n      if (!(/\\.[mc]?[tj]sx$/i.test(id) || allExtensions.includes(currentFileExtension))) {\n        return null;\n      }\n\n      const inNodeModules = /node_modules/.test(id);\n\n      let solidOptions: { generate: 'ssr' | 'dom'; hydratable: boolean };\n\n      if (options.ssr) {\n        if (isSsr) {\n          solidOptions = { generate: 'ssr', hydratable: true };\n        } else {\n          solidOptions = { generate: 'dom', hydratable: true };\n        }\n      } else {\n        // A client-rendered app can still load modules on the server, for\n        // example to prerender static pages with `ssrLoadModule`. DOM output\n        // cannot run there, so server transforms use the SSR generate. Nothing\n        // hydrates the result, so it stays non-hydratable. Vitest keeps DOM\n        // output, since tests resolve the browser build of solid-js.\n        solidOptions = {\n          generate: isSsr && !isTestMode ? 'ssr' : 'dom',\n          hydratable: false,\n        };\n      }\n\n      // We need to know if the current file extension has a typescript options tied to it\n      const shouldBeProcessedWithTypescript =\n        /\\.[mc]?tsx$/i.test(id) ||\n        extensionsToWatch.some((extension) => {\n          if (typeof extension === 'string') {\n            return extension.includes('tsx');\n          }\n\n          const [extensionName, extensionOptions] = extension;\n          if (extensionName !== currentFileExtension) return false;\n\n          return extensionOptions.typescript;\n        });\n      const plugins: NonNullable<NonNullable<babel.TransformOptions['parserOpts']>['plugins']> = [\n        'jsx',\n      ];\n\n      if (shouldBeProcessedWithTypescript) {\n        plugins.push('typescript');\n      }\n\n      // babel-plugin-jsx-dom-expressions >= 0.40.10 omits the client template of\n      // `$ServerOnly` elements by default, so re-creating such an element outside\n      // of hydration throws \"template is not a function\". Solid Refresh does\n      // exactly that on every hot update, so keep the templates in client HMR\n      // transforms. An explicit user setting still wins.\n      const presetOptions = {\n        ...solidOptions,\n        ...(needHmr && !isSsr ? { omitServerOnlyTemplates: false } : {}),\n        ...(options.solid || {}),\n      };\n\n      const opts: babel.TransformOptions = {\n        root: projectRoot,\n        filename: id,\n        sourceFileName: id,\n        presets: [[solid, presetOptions]],\n        plugins: needHmr && !isSsr && !inNodeModules ? [[solidRefresh, { bundler: 'vite' }]] : [],\n        ast: false,\n        sourceMaps: true,\n        configFile: false,\n        babelrc: false,\n        parserOpts: {\n          plugins,\n        },\n      };\n\n      // Default value for babel user options\n      let babelUserOptions: babel.TransformOptions = {};\n\n      if (options.babel) {\n        if (typeof options.babel === 'function') {\n          const babelOptions = options.babel(source, id, isSsr);\n          babelUserOptions = babelOptions instanceof Promise ? await babelOptions : babelOptions;\n        } else {\n          babelUserOptions = options.babel;\n        }\n      }\n\n      const babelOptions = mergeAndConcat(babelUserOptions, opts) as babel.TransformOptions;\n\n      const { code, map } = await babel.transformAsync(source, babelOptions);\n\n      return { code, map };\n    },\n  };\n}\n"],"names":["require","createRequire","import","runtimePublicPath","runtimeFilePath","resolve","runtimeCode","readFileSync","viteVersionMajor","version","split","isVite6OrNewer","isVite8OrNewer","getExtension","filename","index","lastIndexOf","substring","getTransformPath","id","isHandled","cleanId","replace","containsSolidField","fields","keys","Object","i","length","key","getJestDomExport","setupFiles","root","some","file","test","undefined","projectRequire","path","join","find","specifier","e","readPackageJson","requires","req","dir","dirname","pkg","JSON","parse","getJestDomVitestEsmPath","rootRequire","vitest","String","jestDom","entry","exports","default","solidPlugin","options","filter","createFilter","include","exclude","needHmr","replaceDev","projectRoot","process","cwd","isTestMode","solidPkgsConfig","testRuntimeConsumers","Set","domTestRuntimeInlined","name","enforce","config","userConfig","command","dev","mode","crawlFrameworkPkgs","viteUserConfig","isBuild","isFrameworkPkgByJson","pkgJson","isSemiFrameworkPkgByJson","ssr","dependencies","peerDependencies","add","solidDeps","crawlRoot","workspaceRoot","searchForWorkspaceRoot","workspacePkgs","noExternal","includes","push","nestedDeps","userTest","userSetupFiles","environment","workspace","projects","sharedViteServer","server","deps","external","item","toString","inline","browser","enabled","jestDomImport","legacyConditions","userSsrConditions","conditions","legacySsr","target","dedupe","optimizeDeps","rolldownOptions","transform","jsx","runtime","configEnvironment","opts","defaultClientConditions","defaultServerConditions","consumer","isSsrTargetWebworker","addBrowser","Array","isArray","configResolved","hot","resolveId","load","source","transformOptions","isSsr","Boolean","extensionsToWatch","extensions","allExtensions","map","extension","currentFileExtension","inNodeModules","solidOptions","generate","hydratable","shouldBeProcessedWithTypescript","extensionName","extensionOptions","typescript","plugins","presetOptions","omitServerOnlyTemplates","solid","sourceFileName","presets","solidRefresh","bundler","ast","sourceMaps","configFile","babelrc","parserOpts","babelUserOptions","babel","babelOptions","Promise","mergeAndConcat","code","transformAsync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAMA,SAAO,GAAGC,sBAAa,CAACC,2PAAe,CAAC;AAE9C,MAAMC,iBAAiB,GAAG,iBAAiB;AAC3C,MAAMC,eAAe,GAAGJ,SAAO,CAACK,OAAO,CAAC,sCAAsC,CAAC;AAC/E,MAAMC,WAAW,GAAGC,eAAY,CAACH,eAAe,EAAE,OAAO,CAAC;AAE1D,MAAMI,gBAAgB,GAAG,CAACC,YAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/C,MAAMC,cAAc,GAAGH,gBAAgB,IAAI,CAAC;AAC5C,MAAMI,cAAc,GAAGJ,gBAAgB,IAAI,CAAC;;AAE5C;;AAKA;;AA8JA,SAASK,YAAYA,CAACC,QAAgB,EAAU;AAC9C,EAAA,MAAMC,KAAK,GAAGD,QAAQ,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,OAAOD,KAAK,GAAG,CAAC,GAAG,EAAE,GAAGD,QAAQ,CAACG,SAAS,CAACF,KAAK,CAAC;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SA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