import { PackageManager } from "./packageManager.js"; //#region src/init/utils/nextCompilerBabel.d.ts /** * `babel.config.js` wiring the full Intlayer compiler + build-optimization * pipeline for Next.js. * * The four passes run in a fixed order — extract first (so dictionaries exist), * optimize last (because it erases the dictionary key the previous passes rely * on). `presets: ["next/babel"]` is required so Babel keeps compiling JSX/TS * the way Next.js does; without it the build breaks. */ export declare const NEXT_INTLAYER_BABEL_CONFIG_CONTENT = "const {\n intlayerExtractBabelPlugin,\n intlayerPurgeBabelPlugin,\n intlayerMinifyBabelPlugin,\n intlayerOptimizeBabelPlugin,\n getExtractPluginOptions,\n getPurgePluginOptions,\n getMinifyPluginOptions,\n getOptimizePluginOptions,\n} = require(\"@intlayer/babel\");\n\nmodule.exports = {\n presets: [\"next/babel\"],\n plugins: [\n // Extract: compile .content.ts files → .intlayer/**/*.json\n [intlayerExtractBabelPlugin, getExtractPluginOptions()],\n\n // Purge: remove unused fields from .intlayer/**/*.json\n // (reads intlayer.config.ts build.purge flag)\n [intlayerPurgeBabelPlugin, getPurgePluginOptions()],\n\n // Minify: rename field keys in JSON + source code\n // (reads intlayer.config.ts build.minify flag)\n [intlayerMinifyBabelPlugin, getMinifyPluginOptions()],\n\n // Optimize: rewrite useIntlayer('key') → useDictionary(hash)\n // Must come last because it erases the dictionary key.\n [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],\n ],\n};\n"; /** * Wires the Intlayer compiler + build-optimization Babel plugins into a Next.js * project that already uses Babel. * * Only acts when a Babel config is detected. A default Next.js project compiles * with SWC, where the Intlayer optimize pass is injected automatically by * `withIntlayer` once `@intlayer/swc` is installed — no Babel config is needed, * so there is nothing to set up here. Writing a `babel.config.js` would in fact * be harmful: Next.js falls back from SWC to Babel as soon as one exists, which * disables both the project's SWC compiler and the `@intlayer/swc` plugin. * * When a Babel config is present it: * * 1. Installs `@intlayer/babel` as a dev dependency (unless already present or * `skipInstall` is set). * 2. Leaves the existing config untouched and prints the plugins to add, since * arbitrary user configs cannot be safely merged. * * Idempotent: re-running detects the already-wired `@intlayer/babel` import and * skips. * * @param rootDir - Project root directory. * @param packageManager - Detected package manager used to install the package. * @param allDeps - Combined prod + dev dependencies, used to skip a redundant install. * @param skipInstall - When `true`, dependency installation is skipped. */ export declare const setupNextCompilerBabelConfig: ({ rootDir, packageManager, allDeps, skipInstall }: { rootDir: string; packageManager: PackageManager; allDeps: Record; skipInstall: boolean; }) => Promise; //#endregion //# sourceMappingURL=nextCompilerBabel.d.ts.map