import { Dictionary } from "@intlayer/types/dictionary"; import { CallerDescriptor } from "@intlayer/config/callers"; import { GetConfigurationOptions } from "@intlayer/config/node"; import { SerializedFieldRenameMap } from "@intlayer/babel"; import { IntlayerConfig } from "@intlayer/types/config"; //#region src/server/prepareSwcOptimization.d.ts /** * Field-rename tables keyed by dictionary key, forwarded to the * `@intlayer/swc` plugin's `fieldRenameMap` option. */ export type FieldRenameMapByDictionaryKey = Record; /** Verbosity forwarded to the `@intlayer/swc` plugin's `logLevel` option. */ export type SwcLogLevel = 'off' | 'info' | 'debug'; /** * Resolves the verbosity the `@intlayer/swc` plugin should report at. * * Off unless {@link SWC_LOG_LEVEL_ENV_VAR} asks for tracing: `log.mode` governs * the purge and minify reporting, which the pipeline emits in Node so the * Next.js build reads the same as the Vite one. */ export declare const resolveSwcLogLevel: (intlayerConfig: IntlayerConfig) => SwcLogLevel; /** * Whether the purge / minify pipeline can run at all, i.e. whether a usable * `@intlayer/babel` is resolvable from the project. * * Used by `withIntlayer` to keep the build report honest: announcing * `Dictionary minification enabled` while the pipeline cannot load would describe a * pass that never happens. */ export declare const getIsPurgePipelineAvailable: (intlayerConfig: IntlayerConfig) => boolean; type PrepareSwcOptimizationParams = { /** Options forwarded to the intlayer configuration loader. */ configOptions?: GetConfigurationOptions; /** Pre-loaded dictionaries, to avoid a second `getDictionaries` call. */ dictionaries?: Dictionary[]; /** Compat-adapter callers declared by the consuming plugin, if any. */ compatCallers?: CallerDescriptor[]; /** * Whether the `@intlayer/swc` plugin is installed *and* the resolved Next.js * version can load it. False leaves the compiled dictionaries untouched. */ isSwcPluginUsable: boolean; }; /** * Prepares the parts of the build optimisation the `@intlayer/swc` plugin * cannot do itself, and returns the field-rename tables it needs. * * Removing unused content fields (`build.purge`) and assigning short field * aliases (`build.minify`) require reading every component source file and * rewriting the compiled dictionary JSON — file I/O and cross-file state that a * per-file Wasm transform has no access to. That analysis therefore runs here, * in Node, through `@intlayer/babel`; the plugin only receives the resulting * tables and rewrites the matching source accesses * (`content.title` → `content.a`). * * The work is coordinated by a sentinel file: Next.js loads `next.config.*` in * several processes per build, and running the minify pass twice would derive * the aliases from the already-renamed dictionaries. Processes that lose the * race read the tables the winner cached. * * @returns The field-rename tables, keyed by dictionary key. Empty when the * pipeline is disabled, unavailable, or renamed nothing. */ export declare const prepareSwcOptimization: (intlayerConfig: IntlayerConfig, params: PrepareSwcOptimizationParams) => Promise; //#endregion //# sourceMappingURL=prepareSwcOptimization.d.ts.map