//#region src/extractorLoader.d.ts /** * Options the loader accepts. Turbopack serialises loader options to JSON, so * every field has to stay a plain JSON value — the Intlayer configuration * itself (which carries functions, e.g. `compiler.output`) is therefore loaded * by the loader rather than handed to it. */ export type IntlayerExtractorLoaderOptions = { /** * Whether the host bundler is serving (`dev`) or building (`build`). * * Passed explicitly because a Turbopack loader runs in a worker process whose * environment does not necessarily carry `INTLAYER_IS_DEV_COMMAND`. */ mode?: 'dev' | 'build'; }; /** * Structural view of the loader context, limited to what this loader uses. * Typed locally rather than imported from `webpack` because the same file is * also run by Turbopack's webpack-loader compatibility layer, and `webpack` is * only an optional peer dependency. */ type IntlayerLoaderContext = { /** Absolute path of the file being compiled. */ resourcePath: string; /** Switches the loader to asynchronous mode. */ async: () => (error: Error | null, content?: string) => void; /** webpack 5 / Turbopack accessor for the loader options. */ getOptions?: () => IntlayerExtractorLoaderOptions; /** Legacy options holder, used when `getOptions` is unavailable. */ query?: IntlayerExtractorLoaderOptions | string; }; /** * Webpack-compatible loader running the Intlayer compiler extraction pass. * * It replaces the `babel.config.js` setup on Next.js: Turbopack never reads a * Babel config, and on webpack a Babel config would opt the whole project out * of SWC. Registered automatically by `withIntlayer` on both bundlers. * * @example next.config.ts — registered by hand * ```ts * export default { * turbopack: { * rules: { * // No `as`: it renames the module, so naming the extension the rule * // already matches would ask for `Component.tsx.tsx`. * '*.tsx': { * loaders: [ * { * loader: require.resolve('next-intlayer/extractor-loader'), * options: { mode: 'dev' }, * }, * ], * }, * }, * }, * }; * ``` */ declare const intlayerExtractorLoader: (this: IntlayerLoaderContext, source: string) => void; //#endregion export { intlayerExtractorLoader as default }; //# sourceMappingURL=extractorLoader.d.ts.map