{"version":3,"file":"index.mjs","names":["debug","fsp","path"],"sources":["../../node_modules/.pnpm/tsdown@0.21.4_typescript@5.9.3/node_modules/tsdown/esm-shims.js","../src/constants.ts","../src/utils.ts","../src/config.ts","../src/manifest.ts","../src/index.ts"],"sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","// Internal: Inferred mode, since Vite doesn't yet expose it to its plugins.\nexport const APP_ENV = process.env.RAILS_ENV || process.env.RACK_ENV || process.env.APP_ENV\n\n// Internal: Prefix used for environment variables that modify the configuration.\nexport const ENV_PREFIX = 'VITE_RUBY'\n\n// Internal: Key of the vite.json file that is applied to all environments.\nexport const ALL_ENVS_KEY = 'all'\n\n// Internal: Extensions of CSS files or known precompilers.\nexport const KNOWN_CSS_EXTENSIONS = [\n  'css',\n  'less',\n  'sass',\n  'scss',\n  'styl',\n  'stylus',\n  'pcss',\n  'postcss',\n]\n\n// Internal: Types of files that Vite should process correctly as entrypoints.\nexport const KNOWN_ENTRYPOINT_TYPES = [\n  'html',\n  'jsx?',\n  'tsx?',\n  ...KNOWN_CSS_EXTENSIONS,\n]\n\nexport const ENTRYPOINT_TYPES_REGEX = new RegExp(\n  `\\\\.(${KNOWN_ENTRYPOINT_TYPES.join('|')})(\\\\?.*)?$`,\n)\n","import { readFileSync } from 'fs'\n\nimport { ENV_PREFIX } from './constants'\n\n// Internal: Replace Windows-style separators with POSIX-style separators.\nexport function slash (path: string): string {\n  return path.replace(/\\\\/g, '/')\n}\n\n// Internal: Returns true if the specified value is a plain JS object\nexport function isObject (value: unknown): value is Record<string, any> {\n  return Object.prototype.toString.call(value) === '[object Object]'\n}\n\n// Internal: Simplistic version that gets the job done for this scenario.\n// Example: screamCase('buildOutputDir') === 'BUILD_OUTPUT_DIR'\nexport function screamCase (key: string) {\n  return key.replace(/([a-z])([A-Z])/g, '$1_$2').toUpperCase()\n}\n\n// Internal: Returns a configuration option that was provided using env vars.\nexport function configOptionFromEnv (optionName: string) {\n  return process.env[`${ENV_PREFIX}_${screamCase(optionName)}`]\n}\n\n// Internal: Ensures it's easy to turn off a setting with env vars.\nexport function booleanOption<T> (value: 'true' | 'false' | boolean | T): boolean | T {\n  if (value === 'true') return true\n  if (value === 'false') return false\n  return value\n}\n\n// Internal: Loads a json configuration file.\nexport function loadJsonConfig<T> (filepath: string): T {\n  return JSON.parse(readFileSync(filepath, { encoding: 'utf8', flag: 'r' })) as T\n}\n\n// Internal: Removes any keys with undefined or null values from the object.\nexport function cleanConfig (object: Record<string, any>) {\n  Object.keys(object).forEach((key) => {\n    const value = object[key]\n    if (value === undefined || value === null) delete object[key]\n    else if (isObject(value)) cleanConfig(value)\n  })\n  return object\n}\n","import { join, relative, resolve } from 'path'\nimport { globSync } from 'tinyglobby'\n\nimport type { UserConfig, ServerOptions } from 'vite'\nimport { APP_ENV, ALL_ENVS_KEY, ENTRYPOINT_TYPES_REGEX } from './constants'\nimport { booleanOption, loadJsonConfig, configOptionFromEnv, slash } from './utils'\nimport { Config, ResolvedConfig, UnifiedConfig, MultiEnvConfig, Entrypoints } from './types'\n\n// Internal: Default configuration that is also read from Ruby.\nexport const defaultConfig: ResolvedConfig = loadJsonConfig(resolve(__dirname, '../default.vite.json'))\n\n// Internal: Returns the files defined in the entrypoints directory that should\n// be processed by rollup.\nexport function filterEntrypointsForRollup (entrypoints: Entrypoints): Entrypoints {\n  return entrypoints\n    .filter(([_name, filename]) => ENTRYPOINT_TYPES_REGEX.test(filename))\n}\n\n// Internal: Returns the files defined in the entrypoints directory that are not\n// processed by Rollup and should be manually fingerprinted and copied over.\nexport function filterEntrypointAssets (entrypoints: Entrypoints): Entrypoints {\n  return entrypoints\n    .filter(([_name, filename]) => !ENTRYPOINT_TYPES_REGEX.test(filename))\n}\n\n// Internal: Returns all files defined in the entrypoints directory.\nexport function resolveEntrypointFiles (projectRoot: string, sourceCodeDir: string, config: ResolvedConfig): Entrypoints {\n  const inputGlobs = config.ssrBuild\n    ? [config.ssrEntrypoint]\n    : [`~/${config.entrypointsDir}/**/*`, ...config.additionalEntrypoints]\n\n  const entrypointFiles = globSync(resolveGlobs(projectRoot, sourceCodeDir, inputGlobs), { absolute: true, expandDirectories: false })\n\n  if (config.ssrBuild) {\n    if (entrypointFiles.length === 0)\n      throw new Error(`No SSR entrypoint available, please create \\`${config.ssrEntrypoint}\\` to do an SSR build.`)\n    else if (entrypointFiles.length > 1)\n      throw new Error(`Expected a single SSR entrypoint, found: ${entrypointFiles}`)\n\n    return entrypointFiles.map(file => ['ssr', file])\n  }\n\n  return entrypointFiles.map((filename) => {\n    let name = relative(sourceCodeDir, filename)\n    if (name.startsWith('..'))\n      name = relative(projectRoot, filename)\n\n    return [name, filename]\n  })\n}\n\n// Internal: Allows to use the `~` shorthand in the config globs.\nexport function resolveGlobs (projectRoot: string, sourceCodeDir: string, patterns: string[]) {\n  return patterns.map(pattern =>\n    slash(resolve(projectRoot, pattern.replace(/^~\\//, `${sourceCodeDir}/`))),\n  )\n}\n\n// Internal: Loads configuration options provided through env variables.\nfunction configFromEnv (): Config {\n  const envConfig: Record<string, any> = {}\n  Object.keys(defaultConfig).forEach((optionName) => {\n    const envValue = configOptionFromEnv(optionName)\n    if (envValue !== undefined) envConfig[optionName] = envValue\n  })\n  return envConfig\n}\n\n// Internal: Allows to load configuration from a json file, and VITE_RUBY\n// prefixed environment variables.\nexport function loadConfiguration (viteMode: string, projectRoot: string, userConfig: UserConfig): UnifiedConfig {\n  const envConfig = configFromEnv()\n  const mode = envConfig.mode || APP_ENV || viteMode\n  const filePath = join(projectRoot, envConfig.configPath || (defaultConfig.configPath as string))\n  const multiEnvConfig = loadJsonConfig<MultiEnvConfig>(filePath)\n  const fileConfig: Config = { ...multiEnvConfig[ALL_ENVS_KEY], ...multiEnvConfig[mode] }\n\n  // Combine the three possible sources: env > json file > defaults.\n  return coerceConfigurationValues({ ...defaultConfig, ...fileConfig, ...envConfig, mode }, projectRoot, userConfig)\n}\n\n// Internal: Coerces the configuration values and deals with relative paths.\nfunction coerceConfigurationValues (config: ResolvedConfig, projectRoot: string, userConfig: UserConfig): UnifiedConfig {\n  // Coerce the values to the expected types.\n  const port = config.port = parseInt(config.port as unknown as string)\n  const https = config.https = userConfig.server?.https || booleanOption(config.https)\n\n  const fs: ServerOptions['fs'] = { allow: [projectRoot], strict: userConfig.server?.fs?.strict ?? true }\n\n  const server: ServerOptions = { fs, host: config.host, https, port, strictPort: true }\n\n  if (booleanOption(config.skipProxy))\n    server.origin = userConfig.server?.origin || `${https ? 'https' : 'http'}://${config.host}:${config.port}`\n\n  // Connect directly to the Vite dev server, rack-proxy does not proxy websocket connections.\n  const hmr = userConfig.server?.hmr ?? {}\n  if (typeof hmr === 'object' && !hmr.hasOwnProperty('clientPort')) {\n    hmr.clientPort ||= port\n    server.hmr = hmr\n  }\n\n  // Use the sourceCodeDir as the Vite.js root.\n  const root = join(projectRoot, config.sourceCodeDir)\n\n  // Detect SSR builds and entrypoint provided via the --ssr flag.\n  const ssrEntrypoint = userConfig.build?.ssr\n  config.ssrBuild = Boolean(ssrEntrypoint)\n  if (typeof ssrEntrypoint === 'string')\n    config.ssrEntrypoint = ssrEntrypoint\n\n  // Vite expects the outDir to be relative to the root.\n  const outDir = relative(root, config.ssrBuild\n    ? config.ssrOutputDir\n    : join(config.publicDir, config.publicOutputDir))\n\n  const base = resolveViteBase(config)\n  const entrypoints = resolveEntrypointFiles(projectRoot, root, config)\n\n  return { ...config, server, root, outDir, base, entrypoints }\n}\n\n// Internal: Configures Vite's base according to the asset host and publicOutputDir.\nexport function resolveViteBase ({ assetHost, base, publicOutputDir }: ResolvedConfig) {\n  if (assetHost && !assetHost.startsWith('http')) assetHost = `//${assetHost}`\n\n  return [\n    ensureTrailingSlash(assetHost || base || '/'),\n    publicOutputDir ? ensureTrailingSlash(slash(publicOutputDir)) : '',\n  ].join('')\n}\n\nfunction ensureTrailingSlash (path: string) {\n  return path.endsWith('/') ? path : `${path}/`\n}\n","import path from 'path'\nimport { promises as fsp } from 'fs'\nimport { createDebug } from 'obug'\n\nimport type { Plugin, ResolvedConfig } from 'vite'\n\nimport type { OutputBundle, PluginContext } from 'rollup'\nimport { UnifiedConfig } from './types'\nimport { filterEntrypointAssets } from './config'\n\nconst debug = createDebug('vite-plugin-ruby:assets-manifest')\n\ninterface AssetsManifestChunk {\n  src?: string\n  file: string\n}\n\ntype AssetsManifest = Map<string, AssetsManifestChunk>\n\n// Internal: Writes a manifest file that allows to map an entrypoint asset file\n// name to the corresponding output file name.\nexport function assetsManifestPlugin (): Plugin {\n  let config: ResolvedConfig\n  let viteRubyConfig: UnifiedConfig\n\n  // Internal: Vite ignores some entrypoint assets, so we need to manually\n  // fingerprint the files and move them to the output directory.\n  async function fingerprintRemainingAssets (ctx: PluginContext, bundle: OutputBundle, manifest: AssetsManifest) {\n    const remainingAssets = filterEntrypointAssets(viteRubyConfig.entrypoints)\n\n    for (const [filename, absoluteFilename] of remainingAssets) {\n      const content = await fsp.readFile(absoluteFilename)\n      const ref = ctx.emitFile({ name: path.basename(filename), type: 'asset', source: content })\n      const hashedFilename = ctx.getFileName(ref)\n      manifest.set(path.relative(config.root, absoluteFilename), { file: hashedFilename, src: filename })\n    }\n  }\n\n  return {\n    name: 'vite-plugin-ruby:assets-manifest',\n    apply: 'build',\n    enforce: 'post',\n    configResolved (resolvedConfig: ResolvedConfig) {\n      config = resolvedConfig\n      viteRubyConfig = (config as any).viteRuby\n    },\n    async generateBundle (_options, bundle) {\n      if (!config.build.manifest) return\n\n      const manifestDir = typeof config.build.manifest === 'string' ? path.dirname(config.build.manifest) : '.vite'\n      const fileName = `${manifestDir}/manifest-assets.json`\n\n      const manifest: AssetsManifest = new Map()\n      await fingerprintRemainingAssets(this, bundle, manifest)\n      debug({ manifest, fileName })\n\n      this.emitFile({\n        fileName,\n        type: 'asset',\n        source: JSON.stringify(Object.fromEntries(manifest), null, 2),\n      })\n    },\n  }\n}\n","import { basename, posix, resolve } from 'path'\nimport { existsSync, readFileSync } from 'fs'\nimport type { ConfigEnv, PluginOption, UserConfig, ViteDevServer } from 'vite'\nimport { createDebug } from 'obug'\n\nimport { cleanConfig, configOptionFromEnv } from './utils'\nimport { filterEntrypointsForRollup, loadConfiguration, resolveGlobs } from './config'\nimport { assetsManifestPlugin } from './manifest'\n\nexport * from './types'\n\nexport interface PreRenderedAsset {\n  type: 'asset'\n  name?: string // Vite v7, deprecated\n  names?: string[] // Vite v8\n  originalFileName?: string // Vite v7, deprecated\n  originalFileNames?: string[] // Vite v8\n  source: string | Uint8Array\n}\n\n// Public: The resolved project root.\nexport const projectRoot = configOptionFromEnv('root') || process.cwd()\n\n// Internal: Additional paths to watch.\nlet watchAdditionalPaths: string[] = []\n\n// Public: Vite Plugin to detect entrypoints in a Ruby app, and allows to load a shared JSON configuration file that can be read from Ruby.\nexport default function ViteRubyPlugin (): PluginOption[] {\n  return [\n    {\n      name: 'vite-plugin-ruby',\n      config,\n      configureServer,\n    },\n    assetsManifestPlugin(),\n  ]\n}\n\nconst debug = createDebug('vite-plugin-ruby:config')\n\n// Internal: Resolves the configuration from environment variables and a JSON\n// config file, and configures the entrypoints and manifest generation.\nfunction config (userConfig: UserConfig, env: ConfigEnv): UserConfig {\n  const config = loadConfiguration(env.mode, projectRoot, userConfig)\n  const { assetsDir, base, outDir, server, root, entrypoints, ssrBuild } = config\n\n  const isLocal = config.mode === 'development' || config.mode === 'test'\n\n  const rollupOptions = userConfig.build?.rollupOptions\n  let rollupInput = rollupOptions?.input\n\n  // Normalize any entrypoints provided by plugins.\n  if (typeof rollupInput === 'string')\n    rollupInput = { [rollupInput]: rollupInput }\n\n  // Detect if we're using rolldown\n  // @ts-ignore - Vite plugin context provides meta information from 7 onwards.\n  const isUsingRolldown = this && this.meta && this.meta.rolldownVersion\n  const optionsKey = isUsingRolldown ? 'rolldownOptions' : 'rollupOptions'\n\n  const build = {\n    emptyOutDir: userConfig.build?.emptyOutDir ?? (ssrBuild || isLocal),\n    sourcemap: !isLocal,\n    ...userConfig.build,\n    assetsDir,\n    manifest: !ssrBuild,\n    outDir,\n    // Clear rollupOptions when using rolldown, since ...userConfig.build may have spread it in.\n    ...(isUsingRolldown && { rollupOptions: undefined }),\n    [optionsKey]: {\n      ...rollupOptions,\n      input: {\n        ...rollupInput,\n        ...Object.fromEntries(filterEntrypointsForRollup(entrypoints)),\n      },\n      output: {\n        ...outputOptions(assetsDir, ssrBuild),\n        ...rollupOptions?.output,\n      },\n    },\n  }\n\n  const envDir = userConfig.envDir || projectRoot\n\n  debug({ base, build, envDir, root, server, entrypoints: Object.fromEntries(entrypoints) })\n\n  watchAdditionalPaths = resolveGlobs(projectRoot, root, config.watchAdditionalPaths || [])\n\n  const alias = { '~/': `${root}/`, '@/': `${root}/` }\n\n  return cleanConfig({\n    resolve: { alias },\n    base,\n    envDir,\n    root,\n    server,\n    build,\n    viteRuby: config,\n  })\n}\n\n// Internal: Allows to watch additional paths outside the source code dir.\nfunction configureServer (server: ViteDevServer) {\n  server.watcher.add(watchAdditionalPaths)\n\n  return () => server.middlewares.use((req, res, next) => {\n    if (req.url === '/index.html' && !existsSync(resolve(server.config.root, 'index.html'))) {\n      res.statusCode = 404\n      const file = readFileSync(resolve(__dirname, 'dev-server-index.html'), 'utf-8')\n      res.end(file)\n    }\n\n    next()\n  })\n}\n\nfunction outputOptions (assetsDir: string, ssrBuild: boolean) {\n  // Internal: Avoid nesting entrypoints unnecessarily.\n  const outputFileName = (ext: string) => (asset: PreRenderedAsset) => {\n    // Vite v8 uses `names`, earlier versions use `name`\n    const resolvedName = asset.names?.[0] ?? asset.name ?? '[name]'\n    const shortName = basename(resolvedName).split('.')[0]\n    return posix.join(assetsDir, `${shortName}-[hash].${ext}`)\n  }\n\n  return {\n    assetFileNames: ssrBuild ? undefined : outputFileName('[ext]'),\n    entryFileNames: ssrB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