import { CompatSyncConfig, CompatVitePluginConfig } from "./packageManager.js"; import { RoutingConfig } from "@intlayer/types/config"; //#region src/init/utils/configManipulation.d.ts /** The locale routing strategies supported by the Intlayer configuration. */ export type RoutingMode = RoutingConfig['mode']; /** * Sets `routing.mode` in an Intlayer configuration file to the requested * strategy. Idempotent: re-running with the same mode produces identical * output. Supports `.ts`, `.mjs`, `.js` and `.cjs` configs; JSON configs are * handled with a scoped string replacement since they cannot be parsed by the * TypeScript recast parser. */ export declare const setIntlayerConfigRoutingMode: (content: string, extension: string, mode: RoutingMode) => string; /** * Sets `compiler.output` in an Intlayer configuration file to the given path * template (the `{{variable}}` string form, e.g. * `/locales/{{locale}}/{{key}}.content.json`). Idempotent: re-running with the * same template produces identical output. Supports `.ts`, `.mjs`, `.js` and * `.cjs` configs; JSON configs are supported too since the template is a plain * string. */ export declare const setIntlayerConfigCompilerOutput: (content: string, extension: string, outputTemplate: string) => string; /** * Enables the Intlayer visual editor in a configuration file: sets * `editor.enabled` to `true` and wires `clientId` / `clientSecret` to the * `INTLAYER_CLIENT_ID` / `INTLAYER_CLIENT_SECRET` environment variables. * Idempotent and non-destructive — existing `clientId` / `clientSecret` values * are preserved. Only `.ts`, `.mjs`, `.js` and `.cjs` configs are supported * (JSON cannot reference `process.env`). */ export declare const enableIntlayerEditorConfig: (content: string) => string; /** * Detects whether a Vite config already wires in an Intlayer plugin — either the * base `vite-intlayer` plugin or one of the compat adapters (e.g. * `reactI18nextVitePlugin` from `@intlayer/react-i18next/plugin`). The compat * plugins internally wrap `intlayer()`, so a standalone `intlayer()` must not be * appended when one is already present, otherwise the plugin runs twice. */ export declare const hasIntlayerVitePlugin: (content: string) => boolean; export declare const updateViteConfig: (content: string, extension: string) => string; export declare const updateAstroConfig: (content: string, extension: string) => string; export declare const updateNextConfig: (content: string, extension: string) => string; /** * Wraps a React Native Metro config's exported value with * `configMetroIntlayerSync` from `react-native-intlayer/metro`, injecting the * import. The synchronous helper is used because it wraps a plain config object * and needs no IIFE, making it safe to inject into existing configs without * restructuring them. * * Non-destructive: returns the content unchanged when the export is already * wrapped, when the Intlayer Metro plugin is already present, or when the export * is a custom async IIFE that cannot be wrapped synchronously. Callers should * compare the result with the input to detect the skipped case. */ export declare const updateMetroConfig: (content: string, extension: string) => string; /** * Builds the contents of a fresh `metro.config.js` wired with the Intlayer * Metro plugin. Uses the async `configMetroIntlayer` helper (which can build * dictionaries on server start) and picks the default-config source based on * whether the project is an Expo app. */ export declare const getMetroConfigTemplate: (isExpo: boolean) => string; export declare const updateNuxtConfig: (content: string) => string; /** * Updates a Vite config for vue-i18n compat: injects `vueI18nVitePlugin` from * `@intlayer/vue-i18n/plugin` into the plugins array. */ export declare const updateViteConfigForVueI18n: (content: string, extension: string) => string; /** * Generic vite config updater for any compat plugin that uses alias injection. * Injects the named import from `pluginPackageSource` and appends the plugin * call to the `plugins` array. */ export declare const updateViteConfigForCompatPlugin: (content: string, extension: string, pluginConfig: CompatVitePluginConfig) => string; /** * Rewrites the module source of an existing named import in a vite config, * keeping the imported binding and its call site untouched. Used when a compat * plugin is a drop-in replacement for an i18n library's own vite plugin — e.g. * lingui: `import { lingui } from "@lingui/vite-plugin"` becomes * `import { lingui } from "@intlayer/lingui/plugin"`, leaving `lingui()` in the * `plugins` array as-is. Returns the content unchanged when no matching import * is found. */ export declare const replaceViteConfigPluginImportSource: (content: string, importName: string, fromPackageSource: string, toPackageSource: string) => string; /** * Updates a Next.js config for next-translate compat: wraps the default export * with `withNextTranslate` from `@intlayer/next-translate/plugin`. */ export declare const updateNextConfigForNextTranslate: (content: string, extension: string) => string; /** * Updates a Nuxt config for nuxtjs-i18n compat: adds `@intlayer/nuxtjs-i18n` * to the `modules` array. */ export declare const updateNuxtConfigForNuxtjsI18n: (content: string) => string; /** * Updates a Next.js config for next-i18next compat: wraps the default export * with `withI18next` from `@intlayer/next-i18next/plugin`. */ export declare const updateNextConfigForNextI18next: (content: string, extension: string) => string; /** * Updates a Next.js config for next-intl compat: replaces any existing * `next-intl/plugin` import source with `@intlayer/next-intl/plugin`, or * injects `createNextIntlPlugin` with a factory-call wrapper when no such * import is present. */ export declare const updateNextConfigForNextIntl: (content: string, extension: string) => string; /** * Injects the sync plugin import (`syncJSON` / `syncPO`) and a configured * `syncJSON(...)` / `syncPO(...)` call into the plugins array of an intlayer * config file. Idempotent: skips when the plugin call is already present. */ export declare const updateIntlayerConfigWithSyncPlugin: (content: string, extension: string, syncConfig: CompatSyncConfig) => string; //#endregion //# sourceMappingURL=configManipulation.d.ts.map