next-intlayer 9.0.0-canary.13 → 9.0.0-canary.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/server/withIntlayer.cjs +24 -10
- package/dist/cjs/server/withIntlayer.cjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +5 -1
- package/dist/esm/server/withIntlayer.mjs +25 -10
- package/dist/esm/server/withIntlayer.mjs.map +1 -1
- package/dist/types/index.d.ts +28 -28
- package/dist/types/server/withIntlayer.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
|
|
4
|
+
let node_module = require("node:module");
|
|
4
5
|
let node_path = require("node:path");
|
|
5
6
|
let _intlayer_config_colors = require("@intlayer/config/colors");
|
|
6
7
|
_intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
|
|
@@ -9,16 +10,23 @@ let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
|
9
10
|
let _intlayer_config_node = require("@intlayer/config/node");
|
|
10
11
|
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
11
12
|
let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
|
|
12
|
-
let
|
|
13
|
-
let _intlayer_engine_cli = require("@intlayer/engine/cli");
|
|
13
|
+
let _intlayer_engine_logConfigDetails = require("@intlayer/engine/logConfigDetails");
|
|
14
14
|
let _intlayer_engine_utils = require("@intlayer/engine/utils");
|
|
15
|
-
let _intlayer_webpack = require("@intlayer/webpack");
|
|
16
15
|
let defu = require("defu");
|
|
17
16
|
let next_package_json = require("next/package.json");
|
|
18
17
|
next_package_json = require_runtime.__toESM(next_package_json);
|
|
19
18
|
|
|
20
19
|
//#region src/server/withIntlayer.ts
|
|
21
20
|
/**
|
|
21
|
+
* A `require` bound to this module, usable in both the ESM and CJS builds.
|
|
22
|
+
*
|
|
23
|
+
* Used to lazily pull in heavy, situational dependencies (e.g.
|
|
24
|
+
* `@intlayer/webpack`) only when they are actually needed, keeping the initial
|
|
25
|
+
* `next.config` evaluation lightweight. Mirrors the `configESMxCJSRequire`
|
|
26
|
+
* pattern from `@intlayer/config`.
|
|
27
|
+
*/
|
|
28
|
+
const withIntlayerRequire = _intlayer_config_utils.isESModule ? (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href) : require;
|
|
29
|
+
/**
|
|
22
30
|
* Resolve the Next.js version from the *user's* project at runtime.
|
|
23
31
|
* A static `import from 'next/package.json'` would resolve relative to
|
|
24
32
|
* next-intlayer's own node_modules, which may differ in a monorepo.
|
|
@@ -172,7 +180,7 @@ const withIntlayerSync = (nextConfig = {}, configOptions) => {
|
|
|
172
180
|
if (typeof nextConfig !== "object") nextConfig = {};
|
|
173
181
|
const resolvedConfigOptions = resolveConfigOptions(configOptions);
|
|
174
182
|
const intlayerConfig = (0, _intlayer_config_node.getConfiguration)(resolvedConfigOptions);
|
|
175
|
-
(0,
|
|
183
|
+
(0, _intlayer_engine_logConfigDetails.logConfigDetails)(resolvedConfigOptions);
|
|
176
184
|
const appLogger = (0, _intlayer_config_logger.getAppLogger)(intlayerConfig);
|
|
177
185
|
const { isGteNext13, isGteNext15, isGteNext16, isTurbopackStable } = getNextVersionFlags(intlayerConfig);
|
|
178
186
|
const isTurbopackEnabledFromCommand = isGteNext16 ? !process.env["npm_lifecycle_script"]?.includes("--webpack") : process.env["npm_lifecycle_script"]?.includes("--turbo");
|
|
@@ -270,7 +278,10 @@ const withIntlayerSync = (nextConfig = {}, configOptions) => {
|
|
|
270
278
|
formatter: (value) => (0, node_path.resolve)(value)
|
|
271
279
|
})
|
|
272
280
|
};
|
|
273
|
-
if (isDevCommand && isServer && nextRuntime === "nodejs")
|
|
281
|
+
if (isDevCommand && isServer && nextRuntime === "nodejs") {
|
|
282
|
+
const { IntlayerPlugin } = withIntlayerRequire("@intlayer/webpack");
|
|
283
|
+
config.plugins.push(new IntlayerPlugin(intlayerConfig));
|
|
284
|
+
}
|
|
274
285
|
return config;
|
|
275
286
|
}
|
|
276
287
|
};
|
|
@@ -300,11 +311,14 @@ const withIntlayer = async (nextConfig = {}, configOptions) => {
|
|
|
300
311
|
const resolvedConfigOptions = resolveConfigOptions(configOptions);
|
|
301
312
|
const intlayerConfig = (0, _intlayer_config_node.getConfiguration)(resolvedConfigOptions);
|
|
302
313
|
const { mode } = intlayerConfig.build;
|
|
303
|
-
if (!isStartCommand && (isDevCommand || isBuildCommand || mode === "auto"))
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
314
|
+
if (!isStartCommand && (isDevCommand || isBuildCommand || mode === "auto")) {
|
|
315
|
+
const { prepareIntlayer } = await import("@intlayer/engine/build");
|
|
316
|
+
await prepareIntlayer(intlayerConfig, {
|
|
317
|
+
clean: isBuildCommand,
|
|
318
|
+
cacheTimeoutMs: isBuildCommand ? 1e3 * 30 : 1e3 * 60 * 60,
|
|
319
|
+
env: isBuildCommand ? "prod" : "dev"
|
|
320
|
+
});
|
|
321
|
+
}
|
|
308
322
|
return withIntlayerSync(await nextConfig, resolvedConfigOptions);
|
|
309
323
|
};
|
|
310
324
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIntlayer.cjs","names":["nextPackageJSON","ANSIColors","IMPORT_MODE","IntlayerPlugin"],"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { join, relative, resolve } from 'node:path';\nimport type { SwcExtraCallerConfig } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { IMPORT_MODE } from '@intlayer/config/defaultValues';\nimport {\n formatDictionarySelectorEnvVar,\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport {\n compareVersions,\n getAlias,\n getHasDictionarySelector,\n getProjectRequire,\n getUnusedNodeTypes,\n normalizePath,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { buildComponentFilesList, runOnce } from '@intlayer/engine/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport { defu } from 'defu';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport nextPackageJSON from 'next/package.json' with { type: 'json' };\n\n/**\n * Resolve the Next.js version from the *user's* project at runtime.\n * A static `import from 'next/package.json'` would resolve relative to\n * next-intlayer's own node_modules, which may differ in a monorepo.\n */\nconst getNextVersionFlags = (intlayerConfig: IntlayerConfig) => {\n let nextVersion = nextPackageJSON.version;\n\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n const pkg = requireFunction('next/package.json') as { version: string };\n nextVersion = pkg.version;\n } catch {\n // keep default\n }\n\n return {\n isGteNext13: compareVersions(nextVersion, '≥', '13.0.0'),\n isGteNext15: compareVersions(nextVersion, '≥', '15.0.0'),\n isGteNext16: compareVersions(nextVersion, '≥', '16.0.0'),\n isTurbopackStable: compareVersions(nextVersion, '≥', '15.3.0'),\n };\n};\n\n// Check if SWC plugin is available\nconst getIsSwcPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/swc');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\n// Check if Babel plugin is available\nconst getIsBabelExtractPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/babel');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\nconst resolvePluginPath = (\n pluginPath: string,\n intlayerConfig: IntlayerConfig,\n isTurbopackEnabled: boolean\n): string => {\n const requireFunction = intlayerConfig.build?.require ?? getProjectRequire();\n const pluginPathResolved = requireFunction?.resolve(pluginPath);\n\n if (isTurbopackEnabled)\n // Relative path for turbopack\n return normalizePath(`./${relative(process.cwd(), pluginPathResolved)}`);\n\n // Absolute path for webpack\n return pluginPathResolved;\n};\n\nconst getPruneConfig = (\n intlayerConfig: IntlayerConfig,\n isBuildCommand: boolean,\n isTurbopackEnabled: boolean,\n isDevCommand: boolean,\n isGteNext13: boolean,\n swcExtraCallers?: SwcExtraCallerConfig[]\n): Partial<NextConfig> => {\n const { optimize } = intlayerConfig.build;\n const importMode =\n intlayerConfig.build.importMode ?? intlayerConfig.dictionary?.importMode;\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n } = intlayerConfig.system;\n const { baseDir } = intlayerConfig.system;\n const logger = getAppLogger(intlayerConfig);\n\n if (optimize === false) {\n return {};\n }\n if (optimize === undefined && !isBuildCommand) {\n return {};\n }\n\n if (!isGteNext13) return {};\n\n const isSwcPluginAvailable = getIsSwcPluginAvailable(intlayerConfig);\n\n runOnce(\n join(baseDir, '.intlayer', 'cache', 'intlayer-prune-plugin-enabled.lock'),\n () => {\n if (isSwcPluginAvailable) {\n logger([\n `Build optimization ${colorize('enabled', ANSIColors.GREEN)}`,\n colorize(`(import mode:`, ANSIColors.GREY_DARK),\n colorize(importMode ?? IMPORT_MODE, ANSIColors.BLUE),\n colorize(`)`, ANSIColors.GREY_DARK),\n ]);\n } else {\n logger([\n colorize('Recommended: Install', ANSIColors.GREY),\n colorize('@intlayer/swc', ANSIColors.GREY_LIGHT),\n colorize(\n 'package to enable build optimization. See documentation:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://intlayer.org/docs/bundle-optimization',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n runOnce(\n join(\n baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-compiler-plugin-enabled.lock'\n ),\n () => {\n const isBabelExtractPluginAvailable =\n getIsBabelExtractPluginAvailable(intlayerConfig);\n\n if (isBabelExtractPluginAvailable) {\n let isEnabled = intlayerConfig.compiler?.enabled ?? true;\n\n if (isEnabled === 'build-only') {\n isEnabled = !isDevCommand;\n }\n\n if (isEnabled) {\n logger('Intlayer compiler enabled');\n } else {\n logger('Intlayer compiler disabled');\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n if (!isSwcPluginAvailable) {\n return {};\n }\n\n const dictionariesEntryPath = join(mainDir, 'dictionaries.mjs');\n\n const dynamicDictionariesEntryPath = join(\n mainDir,\n 'dynamic_dictionaries.mjs'\n );\n\n const unmergedDictionariesEntryPath = join(\n mainDir,\n 'unmerged_dictionaries.mjs'\n );\n\n const fetchDictionariesEntryPath = join(mainDir, 'fetch_dictionaries.mjs');\n\n const filesListPattern = buildComponentFilesList(intlayerConfig);\n\n const filesList = [\n ...filesListPattern,\n dictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n unmergedDictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n ];\n\n const dictionaries = getDictionaries(intlayerConfig);\n\n const dictionaryModeMap: Record<string, 'static' | 'dynamic' | 'fetch'> = {};\n\n (Object.values(dictionaries) as Dictionary[]).forEach((dictionary) => {\n dictionaryModeMap[dictionary.key] =\n dictionary.importMode ?? importMode ?? IMPORT_MODE;\n });\n\n return {\n experimental: {\n swcPlugins: [\n [\n resolvePluginPath(\n '@intlayer/swc',\n intlayerConfig,\n isTurbopackEnabled\n ),\n {\n dictionariesDir,\n dictionariesEntryPath,\n unmergedDictionariesEntryPath,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n dynamicDictionariesEntryPath,\n fetchDictionariesDir,\n fetchDictionariesEntryPath,\n importMode,\n filesList,\n replaceDictionaryEntry: true,\n dictionaryModeMap,\n extraCallers: swcExtraCallers ?? [],\n },\n ],\n ],\n },\n };\n};\n\nconst getCommandsEvent = () => {\n const lifecycleEvent = process.env['npm_lifecycle_event'];\n const lifecycleScript = process.env['npm_lifecycle_script'] ?? '';\n\n const isDevCommand =\n lifecycleEvent === 'dev' ||\n process.argv.some((arg) => arg === 'dev') ||\n /(^|\\s)(next\\s+)?dev(\\s|$)/.test(lifecycleScript);\n\n const isBuildCommand =\n lifecycleEvent === 'build' ||\n process.argv.some((arg) => arg === 'build') ||\n /(^|\\s)(next\\s+)?build(\\s|$)/.test(lifecycleScript);\n\n const isStartCommand =\n lifecycleEvent === 'start' ||\n process.argv.some((arg) => arg === 'start') ||\n /(^|\\s)(next\\s+)?start(\\s|$)/.test(lifecycleScript);\n\n return {\n isDevCommand,\n isBuildCommand,\n isStartCommand,\n };\n};\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\ntype WithIntlayerOptions = GetConfigurationOptions & {\n enableTurbopack?: boolean;\n swcExtraCallers?: SwcExtraCallerConfig[];\n};\n\n/**\n * Pin the env file used to resolve the Intlayer configuration to the Next.js\n * command being run (`dev` → `development`, `build`/`start` → `production`).\n *\n * Next.js loads the config file in several processes during a single command\n * (the main `build` process plus one or more Turbopack/webpack workers), and\n * `process.env.NODE_ENV` is not guaranteed to hold the same value in all of\n * them. Since `getConfiguration` falls back to `NODE_ENV` to pick its env file\n * (`.env.development.local` vs `.env.production.local`), those processes could\n * otherwise resolve *different* env values (e.g. `applicationURL`,\n * `INTLAYER_CLIENT_ID`). The resulting configuration would differ between\n * processes, defeating the `isCachedConfigurationUpToDate` check and forcing a\n * redundant full dictionary rebuild.\n *\n * Passing an explicit `env` keeps configuration resolution deterministic across\n * every process of the command. An `env` already set by the caller is\n * respected, and when the command cannot be determined we fall back to\n * `getConfiguration`'s own default (i.e. leave `env` unset).\n */\nconst resolveConfigOptions = (\n configOptions?: WithIntlayerOptions\n): WithIntlayerOptions | undefined => {\n // Respect an explicit override from the caller (idempotent on re-entry).\n if (configOptions?.env) return configOptions;\n\n const { isDevCommand, isBuildCommand, isStartCommand } = getCommandsEvent();\n\n const env = isDevCommand\n ? 'development'\n : isBuildCommand || isStartCommand\n ? 'production'\n : undefined;\n\n if (!env) return configOptions;\n\n return {\n ...configOptions,\n env,\n };\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayerSync(nextConfig)\n * ```\n */\nexport const withIntlayerSync = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T,\n configOptions?: WithIntlayerOptions\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n logConfigDetails(resolvedConfigOptions);\n\n const appLogger = getAppLogger(intlayerConfig);\n\n const { isGteNext13, isGteNext15, isGteNext16, isTurbopackStable } =\n getNextVersionFlags(intlayerConfig);\n\n const isTurbopackEnabledFromCommand = isGteNext16\n ? // Next@16 enables turbopack by default; disable with --webpack\n !process.env['npm_lifecycle_script']?.includes('--webpack')\n : // Next@15 uses --turbopack, Next@14 uses --turbo\n process.env['npm_lifecycle_script']?.includes('--turbo');\n\n const isTurbopackEnabled =\n configOptions?.enableTurbopack ?? isTurbopackEnabledFromCommand;\n\n if (isTurbopackEnabled && typeof nextConfig.webpack !== 'undefined') {\n appLogger(\n 'Turbopack is enabled but a custom webpack config is present. It will be ignored.'\n );\n }\n\n const { isBuildCommand, isDevCommand } = getCommandsEvent();\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => `./${value}`, // prefix by './' to consider the path as relative to the project root. This is necessary for turbopack to work correctly.\n }),\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n };\n\n const serverExternalPackages = [\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n '@intlayer/engine',\n '@intlayer/webpack',\n ];\n\n let env: Record<string, string> = {};\n\n if (isBuildCommand) {\n const dictionaries = getDictionaries(intlayerConfig);\n\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = getUnusedNodeTypes(dictionaries);\n\n if (unusedNodeTypes && unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused logic:',\n unusedNodeTypes\n .filter(\n (key) => !['reactNode', 'solidNode', 'preactNode'].includes(key)\n )\n .map((key) => colorize(key, ANSIColors.BLUE))\n .join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n env = {\n ...env,\n\n // Tree shacking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes),\n\n // Tree shacking the dictionary selector logic\n // (collections / variants)\n ...formatDictionarySelectorEnvVar(getHasDictionarySelector(dictionaries)),\n\n // Tree shacking based on config\n ...getConfigEnvVars(intlayerConfig),\n };\n }\n\n const getNewConfig = (): Partial<NextConfig> => {\n let config: Partial<NextConfig> = {\n env,\n };\n\n if (isGteNext15) {\n config = {\n ...config,\n serverExternalPackages,\n };\n }\n\n if (isGteNext13 && !isGteNext15) {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n serverComponentsExternalPackages: serverExternalPackages,\n },\n };\n }\n\n if (isTurbopackEnabled) {\n if (isGteNext15 && isTurbopackStable) {\n config = {\n ...config,\n turbopack: turboConfig,\n };\n } else {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n // @ts-ignore exist in next@14\n turbo: turboConfig,\n },\n };\n }\n } else {\n config = {\n ...config,\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\n // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n // If the user has defined their own webpack config, call it\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // Rspack set external as false by default\n // Overwrite it to allow pushing the desired externals\n if (config.externals === false) {\n config.externals = [];\n }\n\n // Mark server-only modules as externals (function form handles subpaths)\n const externalExact = new Set([\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n ]);\n const externalPrefixes = ['@intlayer/engine', '@intlayer/webpack'];\n config.externals.push(\n (\n { request }: { request?: string },\n callback: (err: Error | null, result?: string) => void\n ) => {\n if (\n request &&\n (externalExact.has(request) ||\n externalPrefixes.some(\n (prefix) =>\n request === prefix || request.startsWith(`${prefix}/`)\n ))\n ) {\n return callback(null, `commonjs ${request}`);\n }\n callback(null);\n }\n );\n\n // Use `node-loader` for any `.node` files\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Always alias on the server (node/edge) for stability.\n // On the client, alias only when not using live sync.\n config.resolve.alias = {\n ...config.resolve.alias,\n ...getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n };\n\n // Activate watch mode webpack plugin\n if (isDevCommand && isServer && nextRuntime === 'nodejs') {\n // Optional as rspack not support plugin yet\n config.plugins.push(new IntlayerPlugin(intlayerConfig));\n }\n\n return config;\n },\n };\n }\n\n return config;\n };\n\n const pruneConfig: Partial<NextConfig> = getPruneConfig(\n intlayerConfig,\n isBuildCommand,\n isTurbopackEnabled ?? false,\n isDevCommand,\n isGteNext13,\n configOptions?.swcExtraCallers\n );\n\n const intlayerNextConfig: Partial<NextConfig> = defu(\n getNewConfig(),\n pruneConfig\n );\n\n // Merge the new config with the user's config\n const result = defu(intlayerNextConfig, nextConfig) as NextConfig & T;\n\n return result;\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n * > Node withIntlayer is a promise function. Use withIntlayerSync instead if you want to use it synchronously.\n * > Using the promise allows to prepare the intlayer dictionaries before the build starts.\n *\n */\nexport const withIntlayer = async <T extends NextConfig | Partial<NextConfig>>(\n nextConfig: T | Promise<T> = {} as T,\n configOptions?: WithIntlayerOptions\n): Promise<NextConfig & T> => {\n const { isBuildCommand, isDevCommand, isStartCommand } = getCommandsEvent();\n\n process.env.INTLAYER_IS_DEV_COMMAND = isDevCommand ? 'true' : 'false';\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n const { mode } = intlayerConfig.build;\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n // If prod: clean and rebuild once\n // If dev: rebuild only once if it's more than 1 hour since last rebuild\n if (!isStartCommand && (isDevCommand || isBuildCommand || mode === 'auto')) {\n // prepareIntlayer use runOnce to ensure to run only once because will run twice on client and server side otherwise\n await prepareIntlayer(intlayerConfig, {\n clean: isBuildCommand,\n cacheTimeoutMs: isBuildCommand\n ? 1000 * 30 // 30 seconds for build (to ensure to rebuild all dictionaries)\n : 1000 * 60 * 60, // 1 hour for dev (default cache timeout)\n env: isBuildCommand ? 'prod' : 'dev',\n });\n }\n\n const nextConfigResolved = await nextConfig;\n\n return withIntlayerSync(nextConfigResolved, resolvedConfigOptions);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,uBAAuB,mBAAmC;CAC9D,IAAI,cAAcA,0BAAgB;AAElC,KAAI;AAIF,iBAFE,eAAe,OAAO,0DAA8B,EAC1B,oBACX,CAAC;SACZ;AAIR,QAAO;EACL,yDAA6B,aAAa,KAAK,SAAS;EACxD,yDAA6B,aAAa,KAAK,SAAS;EACxD,yDAA6B,aAAa,KAAK,SAAS;EACxD,+DAAmC,aAAa,KAAK,SAAS;EAC/D;;AAIH,MAAM,2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KACrB,GAAG,OAAO,QAAQ;KAClB,wCAAY;MACV,eAAe;MACf,YAAY,iCAA0B,MAAM;MAC7C,CAAC;KACH;AAGD,QAAI,gBAAgB,YAAY,gBAAgB,SAE9C,QAAO,QAAQ,KAAK,IAAIE,iCAAe,eAAe,CAAC;AAGzD,WAAO;;GAEV;AAGH,SAAO;;CAGT,MAAM,cAAmC,eACvC,gBACA,gBACA,sBAAsB,OACtB,cACA,aACA,eAAe,gBAChB;AAUD,sCAPE,cAAc,EACd,YAIoC,EAAE,WAE3B;;;;;;;;;;;;;;;;;AAkBf,MAAa,eAAe,OAC1B,aAA6B,EAAE,EAC/B,kBAC4B;CAC5B,MAAM,EAAE,gBAAgB,cAAc,mBAAmB,kBAAkB;AAE3E,SAAQ,IAAI,0BAA0B,eAAe,SAAS;CAE9D,MAAM,wBAAwB,qBAAqB,cAAc;CAEjE,MAAM,6DAAkC,sBAAsB;CAE9D,MAAM,EAAE,SAAS,eAAe;AAKhC,KAAI,CAAC,mBAAmB,gBAAgB,kBAAkB,SAAS,QAEjE,mDAAsB,gBAAgB;EACpC,OAAO;EACP,gBAAgB,iBACZ,MAAO,KACP,MAAO,KAAK;EAChB,KAAK,iBAAiB,SAAS;EAChC,CAAC;AAKJ,QAAO,iBAAiB,MAFS,YAEW,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"withIntlayer.cjs","names":["isESModule","nextPackageJSON","ANSIColors","IMPORT_MODE"],"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { join, relative, resolve } from 'node:path';\nimport type { SwcExtraCallerConfig } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { IMPORT_MODE } from '@intlayer/config/defaultValues';\nimport {\n formatDictionarySelectorEnvVar,\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport {\n compareVersions,\n getAlias,\n getHasDictionarySelector,\n getProjectRequire,\n getUnusedNodeTypes,\n isESModule,\n normalizePath,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport { logConfigDetails } from '@intlayer/engine/logConfigDetails';\nimport { buildComponentFilesList, runOnce } from '@intlayer/engine/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { IntlayerPlugin as IntlayerPluginType } from '@intlayer/webpack';\nimport { defu } from 'defu';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport nextPackageJSON from 'next/package.json' with { type: 'json' };\n\n/**\n * A `require` bound to this module, usable in both the ESM and CJS builds.\n *\n * Used to lazily pull in heavy, situational dependencies (e.g.\n * `@intlayer/webpack`) only when they are actually needed, keeping the initial\n * `next.config` evaluation lightweight. Mirrors the `configESMxCJSRequire`\n * pattern from `@intlayer/config`.\n */\nconst withIntlayerRequire: NodeJS.Require = isESModule\n ? createRequire(import.meta.url)\n : require;\n\n/**\n * Resolve the Next.js version from the *user's* project at runtime.\n * A static `import from 'next/package.json'` would resolve relative to\n * next-intlayer's own node_modules, which may differ in a monorepo.\n */\nconst getNextVersionFlags = (intlayerConfig: IntlayerConfig) => {\n let nextVersion = nextPackageJSON.version;\n\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n const pkg = requireFunction('next/package.json') as { version: string };\n nextVersion = pkg.version;\n } catch {\n // keep default\n }\n\n return {\n isGteNext13: compareVersions(nextVersion, '≥', '13.0.0'),\n isGteNext15: compareVersions(nextVersion, '≥', '15.0.0'),\n isGteNext16: compareVersions(nextVersion, '≥', '16.0.0'),\n isTurbopackStable: compareVersions(nextVersion, '≥', '15.3.0'),\n };\n};\n\n// Check if SWC plugin is available\nconst getIsSwcPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/swc');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\n// Check if Babel plugin is available\nconst getIsBabelExtractPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/babel');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\nconst resolvePluginPath = (\n pluginPath: string,\n intlayerConfig: IntlayerConfig,\n isTurbopackEnabled: boolean\n): string => {\n const requireFunction = intlayerConfig.build?.require ?? getProjectRequire();\n const pluginPathResolved = requireFunction?.resolve(pluginPath);\n\n if (isTurbopackEnabled)\n // Relative path for turbopack\n return normalizePath(`./${relative(process.cwd(), pluginPathResolved)}`);\n\n // Absolute path for webpack\n return pluginPathResolved;\n};\n\nconst getPruneConfig = (\n intlayerConfig: IntlayerConfig,\n isBuildCommand: boolean,\n isTurbopackEnabled: boolean,\n isDevCommand: boolean,\n isGteNext13: boolean,\n swcExtraCallers?: SwcExtraCallerConfig[]\n): Partial<NextConfig> => {\n const { optimize } = intlayerConfig.build;\n const importMode =\n intlayerConfig.build.importMode ?? intlayerConfig.dictionary?.importMode;\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n } = intlayerConfig.system;\n const { baseDir } = intlayerConfig.system;\n const logger = getAppLogger(intlayerConfig);\n\n if (optimize === false) {\n return {};\n }\n if (optimize === undefined && !isBuildCommand) {\n return {};\n }\n\n if (!isGteNext13) return {};\n\n const isSwcPluginAvailable = getIsSwcPluginAvailable(intlayerConfig);\n\n runOnce(\n join(baseDir, '.intlayer', 'cache', 'intlayer-prune-plugin-enabled.lock'),\n () => {\n if (isSwcPluginAvailable) {\n logger([\n `Build optimization ${colorize('enabled', ANSIColors.GREEN)}`,\n colorize(`(import mode:`, ANSIColors.GREY_DARK),\n colorize(importMode ?? IMPORT_MODE, ANSIColors.BLUE),\n colorize(`)`, ANSIColors.GREY_DARK),\n ]);\n } else {\n logger([\n colorize('Recommended: Install', ANSIColors.GREY),\n colorize('@intlayer/swc', ANSIColors.GREY_LIGHT),\n colorize(\n 'package to enable build optimization. See documentation:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://intlayer.org/docs/bundle-optimization',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n runOnce(\n join(\n baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-compiler-plugin-enabled.lock'\n ),\n () => {\n const isBabelExtractPluginAvailable =\n getIsBabelExtractPluginAvailable(intlayerConfig);\n\n if (isBabelExtractPluginAvailable) {\n let isEnabled = intlayerConfig.compiler?.enabled ?? true;\n\n if (isEnabled === 'build-only') {\n isEnabled = !isDevCommand;\n }\n\n if (isEnabled) {\n logger('Intlayer compiler enabled');\n } else {\n logger('Intlayer compiler disabled');\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n if (!isSwcPluginAvailable) {\n return {};\n }\n\n const dictionariesEntryPath = join(mainDir, 'dictionaries.mjs');\n\n const dynamicDictionariesEntryPath = join(\n mainDir,\n 'dynamic_dictionaries.mjs'\n );\n\n const unmergedDictionariesEntryPath = join(\n mainDir,\n 'unmerged_dictionaries.mjs'\n );\n\n const fetchDictionariesEntryPath = join(mainDir, 'fetch_dictionaries.mjs');\n\n const filesListPattern = buildComponentFilesList(intlayerConfig);\n\n const filesList = [\n ...filesListPattern,\n dictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n unmergedDictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n ];\n\n const dictionaries = getDictionaries(intlayerConfig);\n\n const dictionaryModeMap: Record<string, 'static' | 'dynamic' | 'fetch'> = {};\n\n (Object.values(dictionaries) as Dictionary[]).forEach((dictionary) => {\n dictionaryModeMap[dictionary.key] =\n dictionary.importMode ?? importMode ?? IMPORT_MODE;\n });\n\n return {\n experimental: {\n swcPlugins: [\n [\n resolvePluginPath(\n '@intlayer/swc',\n intlayerConfig,\n isTurbopackEnabled\n ),\n {\n dictionariesDir,\n dictionariesEntryPath,\n unmergedDictionariesEntryPath,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n dynamicDictionariesEntryPath,\n fetchDictionariesDir,\n fetchDictionariesEntryPath,\n importMode,\n filesList,\n replaceDictionaryEntry: true,\n dictionaryModeMap,\n extraCallers: swcExtraCallers ?? [],\n },\n ],\n ],\n },\n };\n};\n\nconst getCommandsEvent = () => {\n const lifecycleEvent = process.env['npm_lifecycle_event'];\n const lifecycleScript = process.env['npm_lifecycle_script'] ?? '';\n\n const isDevCommand =\n lifecycleEvent === 'dev' ||\n process.argv.some((arg) => arg === 'dev') ||\n /(^|\\s)(next\\s+)?dev(\\s|$)/.test(lifecycleScript);\n\n const isBuildCommand =\n lifecycleEvent === 'build' ||\n process.argv.some((arg) => arg === 'build') ||\n /(^|\\s)(next\\s+)?build(\\s|$)/.test(lifecycleScript);\n\n const isStartCommand =\n lifecycleEvent === 'start' ||\n process.argv.some((arg) => arg === 'start') ||\n /(^|\\s)(next\\s+)?start(\\s|$)/.test(lifecycleScript);\n\n return {\n isDevCommand,\n isBuildCommand,\n isStartCommand,\n };\n};\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\ntype WithIntlayerOptions = GetConfigurationOptions & {\n enableTurbopack?: boolean;\n swcExtraCallers?: SwcExtraCallerConfig[];\n};\n\n/**\n * Pin the env file used to resolve the Intlayer configuration to the Next.js\n * command being run (`dev` → `development`, `build`/`start` → `production`).\n *\n * Next.js loads the config file in several processes during a single command\n * (the main `build` process plus one or more Turbopack/webpack workers), and\n * `process.env.NODE_ENV` is not guaranteed to hold the same value in all of\n * them. Since `getConfiguration` falls back to `NODE_ENV` to pick its env file\n * (`.env.development.local` vs `.env.production.local`), those processes could\n * otherwise resolve *different* env values (e.g. `applicationURL`,\n * `INTLAYER_CLIENT_ID`). The resulting configuration would differ between\n * processes, defeating the `isCachedConfigurationUpToDate` check and forcing a\n * redundant full dictionary rebuild.\n *\n * Passing an explicit `env` keeps configuration resolution deterministic across\n * every process of the command. An `env` already set by the caller is\n * respected, and when the command cannot be determined we fall back to\n * `getConfiguration`'s own default (i.e. leave `env` unset).\n */\nconst resolveConfigOptions = (\n configOptions?: WithIntlayerOptions\n): WithIntlayerOptions | undefined => {\n // Respect an explicit override from the caller (idempotent on re-entry).\n if (configOptions?.env) return configOptions;\n\n const { isDevCommand, isBuildCommand, isStartCommand } = getCommandsEvent();\n\n const env = isDevCommand\n ? 'development'\n : isBuildCommand || isStartCommand\n ? 'production'\n : undefined;\n\n if (!env) return configOptions;\n\n return {\n ...configOptions,\n env,\n };\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayerSync(nextConfig)\n * ```\n */\nexport const withIntlayerSync = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T,\n configOptions?: WithIntlayerOptions\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n logConfigDetails(resolvedConfigOptions);\n\n const appLogger = getAppLogger(intlayerConfig);\n\n const { isGteNext13, isGteNext15, isGteNext16, isTurbopackStable } =\n getNextVersionFlags(intlayerConfig);\n\n const isTurbopackEnabledFromCommand = isGteNext16\n ? // Next@16 enables turbopack by default; disable with --webpack\n !process.env['npm_lifecycle_script']?.includes('--webpack')\n : // Next@15 uses --turbopack, Next@14 uses --turbo\n process.env['npm_lifecycle_script']?.includes('--turbo');\n\n const isTurbopackEnabled =\n configOptions?.enableTurbopack ?? isTurbopackEnabledFromCommand;\n\n if (isTurbopackEnabled && typeof nextConfig.webpack !== 'undefined') {\n appLogger(\n 'Turbopack is enabled but a custom webpack config is present. It will be ignored.'\n );\n }\n\n const { isBuildCommand, isDevCommand } = getCommandsEvent();\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => `./${value}`, // prefix by './' to consider the path as relative to the project root. This is necessary for turbopack to work correctly.\n }),\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n };\n\n const serverExternalPackages = [\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n '@intlayer/engine',\n '@intlayer/webpack',\n ];\n\n let env: Record<string, string> = {};\n\n if (isBuildCommand) {\n const dictionaries = getDictionaries(intlayerConfig);\n\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = getUnusedNodeTypes(dictionaries);\n\n if (unusedNodeTypes && unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused logic:',\n unusedNodeTypes\n .filter(\n (key) => !['reactNode', 'solidNode', 'preactNode'].includes(key)\n )\n .map((key) => colorize(key, ANSIColors.BLUE))\n .join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n env = {\n ...env,\n\n // Tree shacking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes),\n\n // Tree shacking the dictionary selector logic\n // (collections / variants)\n ...formatDictionarySelectorEnvVar(getHasDictionarySelector(dictionaries)),\n\n // Tree shacking based on config\n ...getConfigEnvVars(intlayerConfig),\n };\n }\n\n const getNewConfig = (): Partial<NextConfig> => {\n let config: Partial<NextConfig> = {\n env,\n };\n\n if (isGteNext15) {\n config = {\n ...config,\n serverExternalPackages,\n };\n }\n\n if (isGteNext13 && !isGteNext15) {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n serverComponentsExternalPackages: serverExternalPackages,\n },\n };\n }\n\n if (isTurbopackEnabled) {\n if (isGteNext15 && isTurbopackStable) {\n config = {\n ...config,\n turbopack: turboConfig,\n };\n } else {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n // @ts-ignore exist in next@14\n turbo: turboConfig,\n },\n };\n }\n } else {\n config = {\n ...config,\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\n // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n // If the user has defined their own webpack config, call it\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // Rspack set external as false by default\n // Overwrite it to allow pushing the desired externals\n if (config.externals === false) {\n config.externals = [];\n }\n\n // Mark server-only modules as externals (function form handles subpaths)\n const externalExact = new Set([\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n ]);\n const externalPrefixes = ['@intlayer/engine', '@intlayer/webpack'];\n config.externals.push(\n (\n { request }: { request?: string },\n callback: (err: Error | null, result?: string) => void\n ) => {\n if (\n request &&\n (externalExact.has(request) ||\n externalPrefixes.some(\n (prefix) =>\n request === prefix || request.startsWith(`${prefix}/`)\n ))\n ) {\n return callback(null, `commonjs ${request}`);\n }\n callback(null);\n }\n );\n\n // Use `node-loader` for any `.node` files\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Always alias on the server (node/edge) for stability.\n // On the client, alias only when not using live sync.\n config.resolve.alias = {\n ...config.resolve.alias,\n ...getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n };\n\n // Activate watch mode webpack plugin\n if (isDevCommand && isServer && nextRuntime === 'nodejs') {\n // Lazily load `@intlayer/webpack` only on the dev server's Node\n // runtime — the single place the plugin is needed. This keeps it out\n // of the initial `next.config` load and out of the (default)\n // Turbopack path entirely. `require` is used because Next.js invokes\n // the webpack config callback synchronously.\n const { IntlayerPlugin } = withIntlayerRequire(\n '@intlayer/webpack'\n ) as { IntlayerPlugin: typeof IntlayerPluginType };\n\n // Optional as rspack not support plugin yet\n config.plugins.push(new IntlayerPlugin(intlayerConfig));\n }\n\n return config;\n },\n };\n }\n\n return config;\n };\n\n const pruneConfig: Partial<NextConfig> = getPruneConfig(\n intlayerConfig,\n isBuildCommand,\n isTurbopackEnabled ?? false,\n isDevCommand,\n isGteNext13,\n configOptions?.swcExtraCallers\n );\n\n const intlayerNextConfig: Partial<NextConfig> = defu(\n getNewConfig(),\n pruneConfig\n );\n\n // Merge the new config with the user's config\n const result = defu(intlayerNextConfig, nextConfig) as NextConfig & T;\n\n return result;\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n * > Node withIntlayer is a promise function. Use withIntlayerSync instead if you want to use it synchronously.\n * > Using the promise allows to prepare the intlayer dictionaries before the build starts.\n *\n */\nexport const withIntlayer = async <T extends NextConfig | Partial<NextConfig>>(\n nextConfig: T | Promise<T> = {} as T,\n configOptions?: WithIntlayerOptions\n): Promise<NextConfig & T> => {\n const { isBuildCommand, isDevCommand, isStartCommand } = getCommandsEvent();\n\n process.env.INTLAYER_IS_DEV_COMMAND = isDevCommand ? 'true' : 'false';\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n const { mode } = intlayerConfig.build;\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n // If prod: clean and rebuild once\n // If dev: rebuild only once if it's more than 1 hour since last rebuild\n if (!isStartCommand && (isDevCommand || isBuildCommand || mode === 'auto')) {\n // Lazily load the heavy build pipeline (`@intlayer/engine/build`) only when\n // a rebuild is actually required, keeping `next.config` evaluation cheap for\n // commands (e.g. `start`) that never touch it.\n const { prepareIntlayer } = await import('@intlayer/engine/build');\n\n // prepareIntlayer use runOnce to ensure to run only once because will run twice on client and server side otherwise\n await prepareIntlayer(intlayerConfig, {\n clean: isBuildCommand,\n cacheTimeoutMs: isBuildCommand\n ? 1000 * 30 // 30 seconds for build (to ensure to rebuild all dictionaries)\n : 1000 * 60 * 60, // 1 hour for dev (default cache timeout)\n env: isBuildCommand ? 'prod' : 'dev',\n });\n }\n\n const nextConfigResolved = await nextConfig;\n\n return withIntlayerSync(nextConfigResolved, resolvedConfigOptions);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,sBAAsCA,iHACV,GAC9B;;;;;;AAOJ,MAAM,uBAAuB,mBAAmC;CAC9D,IAAI,cAAcC,0BAAgB;AAElC,KAAI;AAIF,iBAFE,eAAe,OAAO,0DAA8B,EAC1B,oBACX,CAAC;SACZ;AAIR,QAAO;EACL,yDAA6B,aAAa,KAAK,SAAS;EACxD,yDAA6B,aAAa,KAAK,SAAS;EACxD,yDAA6B,aAAa,KAAK,SAAS;EACxD,+DAAmC,aAAa,KAAK,SAAS;EAC/D;;AAIH,MAAM,2BAA2B,mBAAmC;AAClE,KAAI;AAGF,GADE,eAAe,OAAO,0DAA8B,EACtC,QAAQ,gBAAgB;AACxC,SAAO;UACA,IAAI;AACX,SAAO;;;AAKX,MAAM,oCAAoC,mBAAmC;AAC3E,KAAI;AAGF,GADE,eAAe,OAAO,0DAA8B,EACtC,QAAQ,kBAAkB;AAC1C,SAAO;UACA,IAAI;AACX,SAAO;;;AAIX,MAAM,qBACJ,YACA,gBACA,uBACW;CAEX,MAAM,sBADkB,eAAe,OAAO,0DAA8B,GAChC,QAAQ,WAAW;AAE/D,KAAI,mBAEF,kDAAqB,6BAAc,QAAQ,KAAK,EAAE,mBAAmB,GAAG;AAG1E,QAAO;;AAGT,MAAM,kBACJ,gBACA,gBACA,oBACA,cACA,aACA,oBACwB;CACxB,MAAM,EAAE,aAAa,eAAe;CACpC,MAAM,aACJ,eAAe,MAAM,cAAc,eAAe,YAAY;CAChE,MAAM,EACJ,iBACA,yBACA,wBACA,sBACA,YACE,eAAe;CACnB,MAAM,EAAE,YAAY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AAe;AAKhC,KAAI,CAAC,mBAAmB,gBAAgB,kBAAkB,SAAS,SAAS;EAI1E,MAAM,EAAE,oBAAoB,MAAM,OAAO;AAGzC,QAAM,gBAAgB,gBAAgB;GACpC,OAAO;GACP,gBAAgB,iBACZ,MAAO,KACP,MAAO,KAAK;GAChB,KAAK,iBAAiB,SAAS;GAChC,CAAC;;AAKJ,QAAO,iBAAiB,MAFS,YAEW,sBAAsB"}
|
|
@@ -31,6 +31,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
31
31
|
return to;
|
|
32
32
|
};
|
|
33
33
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
34
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
35
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
36
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
37
|
+
});
|
|
34
38
|
|
|
35
39
|
//#endregion
|
|
36
|
-
export { __exportAll, __reExport };
|
|
40
|
+
export { __exportAll, __reExport, __require };
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
import { __require } from "../_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { IMPORT_MODE } from "@intlayer/config/defaultValues";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
2
4
|
import { join, relative, resolve } from "node:path";
|
|
3
5
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
4
6
|
import { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, getConfigEnvVars } from "@intlayer/config/envVars";
|
|
5
7
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
6
8
|
import { getConfiguration } from "@intlayer/config/node";
|
|
7
|
-
import { compareVersions, getAlias, getHasDictionarySelector, getProjectRequire, getUnusedNodeTypes, normalizePath } from "@intlayer/config/utils";
|
|
9
|
+
import { compareVersions, getAlias, getHasDictionarySelector, getProjectRequire, getUnusedNodeTypes, isESModule, normalizePath } from "@intlayer/config/utils";
|
|
8
10
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
9
|
-
import {
|
|
10
|
-
import { logConfigDetails } from "@intlayer/engine/cli";
|
|
11
|
+
import { logConfigDetails } from "@intlayer/engine/logConfigDetails";
|
|
11
12
|
import { buildComponentFilesList, runOnce } from "@intlayer/engine/utils";
|
|
12
|
-
import { IntlayerPlugin } from "@intlayer/webpack";
|
|
13
13
|
import { defu } from "defu";
|
|
14
14
|
import nextPackageJSON from "next/package.json" with { type: "json" };
|
|
15
15
|
|
|
16
16
|
//#region src/server/withIntlayer.ts
|
|
17
17
|
/**
|
|
18
|
+
* A `require` bound to this module, usable in both the ESM and CJS builds.
|
|
19
|
+
*
|
|
20
|
+
* Used to lazily pull in heavy, situational dependencies (e.g.
|
|
21
|
+
* `@intlayer/webpack`) only when they are actually needed, keeping the initial
|
|
22
|
+
* `next.config` evaluation lightweight. Mirrors the `configESMxCJSRequire`
|
|
23
|
+
* pattern from `@intlayer/config`.
|
|
24
|
+
*/
|
|
25
|
+
const withIntlayerRequire = isESModule ? createRequire(import.meta.url) : __require;
|
|
26
|
+
/**
|
|
18
27
|
* Resolve the Next.js version from the *user's* project at runtime.
|
|
19
28
|
* A static `import from 'next/package.json'` would resolve relative to
|
|
20
29
|
* next-intlayer's own node_modules, which may differ in a monorepo.
|
|
@@ -266,7 +275,10 @@ const withIntlayerSync = (nextConfig = {}, configOptions) => {
|
|
|
266
275
|
formatter: (value) => resolve(value)
|
|
267
276
|
})
|
|
268
277
|
};
|
|
269
|
-
if (isDevCommand && isServer && nextRuntime === "nodejs")
|
|
278
|
+
if (isDevCommand && isServer && nextRuntime === "nodejs") {
|
|
279
|
+
const { IntlayerPlugin } = withIntlayerRequire("@intlayer/webpack");
|
|
280
|
+
config.plugins.push(new IntlayerPlugin(intlayerConfig));
|
|
281
|
+
}
|
|
270
282
|
return config;
|
|
271
283
|
}
|
|
272
284
|
};
|
|
@@ -296,11 +308,14 @@ const withIntlayer = async (nextConfig = {}, configOptions) => {
|
|
|
296
308
|
const resolvedConfigOptions = resolveConfigOptions(configOptions);
|
|
297
309
|
const intlayerConfig = getConfiguration(resolvedConfigOptions);
|
|
298
310
|
const { mode } = intlayerConfig.build;
|
|
299
|
-
if (!isStartCommand && (isDevCommand || isBuildCommand || mode === "auto"))
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
if (!isStartCommand && (isDevCommand || isBuildCommand || mode === "auto")) {
|
|
312
|
+
const { prepareIntlayer } = await import("@intlayer/engine/build");
|
|
313
|
+
await prepareIntlayer(intlayerConfig, {
|
|
314
|
+
clean: isBuildCommand,
|
|
315
|
+
cacheTimeoutMs: isBuildCommand ? 1e3 * 30 : 1e3 * 60 * 60,
|
|
316
|
+
env: isBuildCommand ? "prod" : "dev"
|
|
317
|
+
});
|
|
318
|
+
}
|
|
304
319
|
return withIntlayerSync(await nextConfig, resolvedConfigOptions);
|
|
305
320
|
};
|
|
306
321
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIntlayer.mjs","names":[],"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { join, relative, resolve } from 'node:path';\nimport type { SwcExtraCallerConfig } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { IMPORT_MODE } from '@intlayer/config/defaultValues';\nimport {\n formatDictionarySelectorEnvVar,\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport {\n compareVersions,\n getAlias,\n getHasDictionarySelector,\n getProjectRequire,\n getUnusedNodeTypes,\n normalizePath,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { buildComponentFilesList, runOnce } from '@intlayer/engine/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport { defu } from 'defu';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport nextPackageJSON from 'next/package.json' with { type: 'json' };\n\n/**\n * Resolve the Next.js version from the *user's* project at runtime.\n * A static `import from 'next/package.json'` would resolve relative to\n * next-intlayer's own node_modules, which may differ in a monorepo.\n */\nconst getNextVersionFlags = (intlayerConfig: IntlayerConfig) => {\n let nextVersion = nextPackageJSON.version;\n\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n const pkg = requireFunction('next/package.json') as { version: string };\n nextVersion = pkg.version;\n } catch {\n // keep default\n }\n\n return {\n isGteNext13: compareVersions(nextVersion, '≥', '13.0.0'),\n isGteNext15: compareVersions(nextVersion, '≥', '15.0.0'),\n isGteNext16: compareVersions(nextVersion, '≥', '16.0.0'),\n isTurbopackStable: compareVersions(nextVersion, '≥', '15.3.0'),\n };\n};\n\n// Check if SWC plugin is available\nconst getIsSwcPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/swc');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\n// Check if Babel plugin is available\nconst getIsBabelExtractPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/babel');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\nconst resolvePluginPath = (\n pluginPath: string,\n intlayerConfig: IntlayerConfig,\n isTurbopackEnabled: boolean\n): string => {\n const requireFunction = intlayerConfig.build?.require ?? getProjectRequire();\n const pluginPathResolved = requireFunction?.resolve(pluginPath);\n\n if (isTurbopackEnabled)\n // Relative path for turbopack\n return normalizePath(`./${relative(process.cwd(), pluginPathResolved)}`);\n\n // Absolute path for webpack\n return pluginPathResolved;\n};\n\nconst getPruneConfig = (\n intlayerConfig: IntlayerConfig,\n isBuildCommand: boolean,\n isTurbopackEnabled: boolean,\n isDevCommand: boolean,\n isGteNext13: boolean,\n swcExtraCallers?: SwcExtraCallerConfig[]\n): Partial<NextConfig> => {\n const { optimize } = intlayerConfig.build;\n const importMode =\n intlayerConfig.build.importMode ?? intlayerConfig.dictionary?.importMode;\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n } = intlayerConfig.system;\n const { baseDir } = intlayerConfig.system;\n const logger = getAppLogger(intlayerConfig);\n\n if (optimize === false) {\n return {};\n }\n if (optimize === undefined && !isBuildCommand) {\n return {};\n }\n\n if (!isGteNext13) return {};\n\n const isSwcPluginAvailable = getIsSwcPluginAvailable(intlayerConfig);\n\n runOnce(\n join(baseDir, '.intlayer', 'cache', 'intlayer-prune-plugin-enabled.lock'),\n () => {\n if (isSwcPluginAvailable) {\n logger([\n `Build optimization ${colorize('enabled', ANSIColors.GREEN)}`,\n colorize(`(import mode:`, ANSIColors.GREY_DARK),\n colorize(importMode ?? IMPORT_MODE, ANSIColors.BLUE),\n colorize(`)`, ANSIColors.GREY_DARK),\n ]);\n } else {\n logger([\n colorize('Recommended: Install', ANSIColors.GREY),\n colorize('@intlayer/swc', ANSIColors.GREY_LIGHT),\n colorize(\n 'package to enable build optimization. See documentation:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://intlayer.org/docs/bundle-optimization',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n runOnce(\n join(\n baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-compiler-plugin-enabled.lock'\n ),\n () => {\n const isBabelExtractPluginAvailable =\n getIsBabelExtractPluginAvailable(intlayerConfig);\n\n if (isBabelExtractPluginAvailable) {\n let isEnabled = intlayerConfig.compiler?.enabled ?? true;\n\n if (isEnabled === 'build-only') {\n isEnabled = !isDevCommand;\n }\n\n if (isEnabled) {\n logger('Intlayer compiler enabled');\n } else {\n logger('Intlayer compiler disabled');\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n if (!isSwcPluginAvailable) {\n return {};\n }\n\n const dictionariesEntryPath = join(mainDir, 'dictionaries.mjs');\n\n const dynamicDictionariesEntryPath = join(\n mainDir,\n 'dynamic_dictionaries.mjs'\n );\n\n const unmergedDictionariesEntryPath = join(\n mainDir,\n 'unmerged_dictionaries.mjs'\n );\n\n const fetchDictionariesEntryPath = join(mainDir, 'fetch_dictionaries.mjs');\n\n const filesListPattern = buildComponentFilesList(intlayerConfig);\n\n const filesList = [\n ...filesListPattern,\n dictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n unmergedDictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n ];\n\n const dictionaries = getDictionaries(intlayerConfig);\n\n const dictionaryModeMap: Record<string, 'static' | 'dynamic' | 'fetch'> = {};\n\n (Object.values(dictionaries) as Dictionary[]).forEach((dictionary) => {\n dictionaryModeMap[dictionary.key] =\n dictionary.importMode ?? importMode ?? IMPORT_MODE;\n });\n\n return {\n experimental: {\n swcPlugins: [\n [\n resolvePluginPath(\n '@intlayer/swc',\n intlayerConfig,\n isTurbopackEnabled\n ),\n {\n dictionariesDir,\n dictionariesEntryPath,\n unmergedDictionariesEntryPath,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n dynamicDictionariesEntryPath,\n fetchDictionariesDir,\n fetchDictionariesEntryPath,\n importMode,\n filesList,\n replaceDictionaryEntry: true,\n dictionaryModeMap,\n extraCallers: swcExtraCallers ?? [],\n },\n ],\n ],\n },\n };\n};\n\nconst getCommandsEvent = () => {\n const lifecycleEvent = process.env['npm_lifecycle_event'];\n const lifecycleScript = process.env['npm_lifecycle_script'] ?? '';\n\n const isDevCommand =\n lifecycleEvent === 'dev' ||\n process.argv.some((arg) => arg === 'dev') ||\n /(^|\\s)(next\\s+)?dev(\\s|$)/.test(lifecycleScript);\n\n const isBuildCommand =\n lifecycleEvent === 'build' ||\n process.argv.some((arg) => arg === 'build') ||\n /(^|\\s)(next\\s+)?build(\\s|$)/.test(lifecycleScript);\n\n const isStartCommand =\n lifecycleEvent === 'start' ||\n process.argv.some((arg) => arg === 'start') ||\n /(^|\\s)(next\\s+)?start(\\s|$)/.test(lifecycleScript);\n\n return {\n isDevCommand,\n isBuildCommand,\n isStartCommand,\n };\n};\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\ntype WithIntlayerOptions = GetConfigurationOptions & {\n enableTurbopack?: boolean;\n swcExtraCallers?: SwcExtraCallerConfig[];\n};\n\n/**\n * Pin the env file used to resolve the Intlayer configuration to the Next.js\n * command being run (`dev` → `development`, `build`/`start` → `production`).\n *\n * Next.js loads the config file in several processes during a single command\n * (the main `build` process plus one or more Turbopack/webpack workers), and\n * `process.env.NODE_ENV` is not guaranteed to hold the same value in all of\n * them. Since `getConfiguration` falls back to `NODE_ENV` to pick its env file\n * (`.env.development.local` vs `.env.production.local`), those processes could\n * otherwise resolve *different* env values (e.g. `applicationURL`,\n * `INTLAYER_CLIENT_ID`). The resulting configuration would differ between\n * processes, defeating the `isCachedConfigurationUpToDate` check and forcing a\n * redundant full dictionary rebuild.\n *\n * Passing an explicit `env` keeps configuration resolution deterministic across\n * every process of the command. An `env` already set by the caller is\n * respected, and when the command cannot be determined we fall back to\n * `getConfiguration`'s own default (i.e. leave `env` unset).\n */\nconst resolveConfigOptions = (\n configOptions?: WithIntlayerOptions\n): WithIntlayerOptions | undefined => {\n // Respect an explicit override from the caller (idempotent on re-entry).\n if (configOptions?.env) return configOptions;\n\n const { isDevCommand, isBuildCommand, isStartCommand } = getCommandsEvent();\n\n const env = isDevCommand\n ? 'development'\n : isBuildCommand || isStartCommand\n ? 'production'\n : undefined;\n\n if (!env) return configOptions;\n\n return {\n ...configOptions,\n env,\n };\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayerSync(nextConfig)\n * ```\n */\nexport const withIntlayerSync = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T,\n configOptions?: WithIntlayerOptions\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n logConfigDetails(resolvedConfigOptions);\n\n const appLogger = getAppLogger(intlayerConfig);\n\n const { isGteNext13, isGteNext15, isGteNext16, isTurbopackStable } =\n getNextVersionFlags(intlayerConfig);\n\n const isTurbopackEnabledFromCommand = isGteNext16\n ? // Next@16 enables turbopack by default; disable with --webpack\n !process.env['npm_lifecycle_script']?.includes('--webpack')\n : // Next@15 uses --turbopack, Next@14 uses --turbo\n process.env['npm_lifecycle_script']?.includes('--turbo');\n\n const isTurbopackEnabled =\n configOptions?.enableTurbopack ?? isTurbopackEnabledFromCommand;\n\n if (isTurbopackEnabled && typeof nextConfig.webpack !== 'undefined') {\n appLogger(\n 'Turbopack is enabled but a custom webpack config is present. It will be ignored.'\n );\n }\n\n const { isBuildCommand, isDevCommand } = getCommandsEvent();\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => `./${value}`, // prefix by './' to consider the path as relative to the project root. This is necessary for turbopack to work correctly.\n }),\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n };\n\n const serverExternalPackages = [\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n '@intlayer/engine',\n '@intlayer/webpack',\n ];\n\n let env: Record<string, string> = {};\n\n if (isBuildCommand) {\n const dictionaries = getDictionaries(intlayerConfig);\n\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = getUnusedNodeTypes(dictionaries);\n\n if (unusedNodeTypes && unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused logic:',\n unusedNodeTypes\n .filter(\n (key) => !['reactNode', 'solidNode', 'preactNode'].includes(key)\n )\n .map((key) => colorize(key, ANSIColors.BLUE))\n .join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n env = {\n ...env,\n\n // Tree shacking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes),\n\n // Tree shacking the dictionary selector logic\n // (collections / variants)\n ...formatDictionarySelectorEnvVar(getHasDictionarySelector(dictionaries)),\n\n // Tree shacking based on config\n ...getConfigEnvVars(intlayerConfig),\n };\n }\n\n const getNewConfig = (): Partial<NextConfig> => {\n let config: Partial<NextConfig> = {\n env,\n };\n\n if (isGteNext15) {\n config = {\n ...config,\n serverExternalPackages,\n };\n }\n\n if (isGteNext13 && !isGteNext15) {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n serverComponentsExternalPackages: serverExternalPackages,\n },\n };\n }\n\n if (isTurbopackEnabled) {\n if (isGteNext15 && isTurbopackStable) {\n config = {\n ...config,\n turbopack: turboConfig,\n };\n } else {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n // @ts-ignore exist in next@14\n turbo: turboConfig,\n },\n };\n }\n } else {\n config = {\n ...config,\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\n // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n // If the user has defined their own webpack config, call it\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // Rspack set external as false by default\n // Overwrite it to allow pushing the desired externals\n if (config.externals === false) {\n config.externals = [];\n }\n\n // Mark server-only modules as externals (function form handles subpaths)\n const externalExact = new Set([\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n ]);\n const externalPrefixes = ['@intlayer/engine', '@intlayer/webpack'];\n config.externals.push(\n (\n { request }: { request?: string },\n callback: (err: Error | null, result?: string) => void\n ) => {\n if (\n request &&\n (externalExact.has(request) ||\n externalPrefixes.some(\n (prefix) =>\n request === prefix || request.startsWith(`${prefix}/`)\n ))\n ) {\n return callback(null, `commonjs ${request}`);\n }\n callback(null);\n }\n );\n\n // Use `node-loader` for any `.node` files\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Always alias on the server (node/edge) for stability.\n // On the client, alias only when not using live sync.\n config.resolve.alias = {\n ...config.resolve.alias,\n ...getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n };\n\n // Activate watch mode webpack plugin\n if (isDevCommand && isServer && nextRuntime === 'nodejs') {\n // Optional as rspack not support plugin yet\n config.plugins.push(new IntlayerPlugin(intlayerConfig));\n }\n\n return config;\n },\n };\n }\n\n return config;\n };\n\n const pruneConfig: Partial<NextConfig> = getPruneConfig(\n intlayerConfig,\n isBuildCommand,\n isTurbopackEnabled ?? false,\n isDevCommand,\n isGteNext13,\n configOptions?.swcExtraCallers\n );\n\n const intlayerNextConfig: Partial<NextConfig> = defu(\n getNewConfig(),\n pruneConfig\n );\n\n // Merge the new config with the user's config\n const result = defu(intlayerNextConfig, nextConfig) as NextConfig & T;\n\n return result;\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n * > Node withIntlayer is a promise function. Use withIntlayerSync instead if you want to use it synchronously.\n * > Using the promise allows to prepare the intlayer dictionaries before the build starts.\n *\n */\nexport const withIntlayer = async <T extends NextConfig | Partial<NextConfig>>(\n nextConfig: T | Promise<T> = {} as T,\n configOptions?: WithIntlayerOptions\n): Promise<NextConfig & T> => {\n const { isBuildCommand, isDevCommand, isStartCommand } = getCommandsEvent();\n\n process.env.INTLAYER_IS_DEV_COMMAND = isDevCommand ? 'true' : 'false';\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n const { mode } = intlayerConfig.build;\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n // If prod: clean and rebuild once\n // If dev: rebuild only once if it's more than 1 hour since last rebuild\n if (!isStartCommand && (isDevCommand || isBuildCommand || mode === 'auto')) {\n // prepareIntlayer use runOnce to ensure to run only once because will run twice on client and server side otherwise\n await prepareIntlayer(intlayerConfig, {\n clean: isBuildCommand,\n cacheTimeoutMs: isBuildCommand\n ? 1000 * 30 // 30 seconds for build (to ensure to rebuild all dictionaries)\n : 1000 * 60 * 60, // 1 hour for dev (default cache timeout)\n env: isBuildCommand ? 'prod' : 'dev',\n });\n }\n\n const nextConfigResolved = await nextConfig;\n\n return withIntlayerSync(nextConfigResolved, resolvedConfigOptions);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,uBAAuB,mBAAmC;CAC9D,IAAI,cAAc,gBAAgB;AAElC,KAAI;AAIF,iBAFE,eAAe,OAAO,WAAW,mBAAmB,EAC1B,oBACX,CAAC;SACZ;AAIR,QAAO;EACL,aAAa,gBAAgB,aAAa,KAAK,SAAS;EACxD,aAAa,gBAAgB,aAAa,KAAK,SAAS;EACxD,aAAa,gBAAgB,aAAa,KAAK,SAAS;EACxD,mBAAmB,gBAAgB,aAAa,KAAK,SAAS;EAC/D;;AAIH,MAAM,2BAA2B,mBAAmC;AAClE,KAAI;AAGF,GADE,eAAe,OAAO,WAAW,mBAAmB,EACtC,QAAQ,gBAAgB;AACxC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B,MAAM;KACN,QAAQ;KACT,CAAC;AAIF,WAAO,QAAQ,QAAQ;KACrB,GAAG,OAAO,QAAQ;KAClB,GAAG,SAAS;MACV,eAAe;MACf,YAAY,UAAkB,QAAQ,MAAM;MAC7C,CAAC;KACH;AAGD,QAAI,gBAAgB,YAAY,gBAAgB,SAE9C,QAAO,QAAQ,KAAK,IAAI,eAAe,eAAe,CAAC;AAGzD,WAAO;;GAEV;AAGH,SAAO;;CAGT,MAAM,cAAmC,eACvC,gBACA,gBACA,sBAAsB,OACtB,cACA,aACA,eAAe,gBAChB;AAUD,QAFe,KANiC,KAC9C,cAAc,EACd,YAIoC,EAAE,WAE3B;;;;;;;;;;;;;;;;;AAkBf,MAAa,eAAe,OAC1B,aAA6B,EAAE,EAC/B,kBAC4B;CAC5B,MAAM,EAAE,gBAAgB,cAAc,mBAAmB,kBAAkB;AAE3E,SAAQ,IAAI,0BAA0B,eAAe,SAAS;CAE9D,MAAM,wBAAwB,qBAAqB,cAAc;CAEjE,MAAM,iBAAiB,iBAAiB,sBAAsB;CAE9D,MAAM,EAAE,SAAS,eAAe;AAKhC,KAAI,CAAC,mBAAmB,gBAAgB,kBAAkB,SAAS,QAEjE,OAAM,gBAAgB,gBAAgB;EACpC,OAAO;EACP,gBAAgB,iBACZ,MAAO,KACP,MAAO,KAAK;EAChB,KAAK,iBAAiB,SAAS;EAChC,CAAC;AAKJ,QAAO,iBAAiB,MAFS,YAEW,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"withIntlayer.mjs","names":[],"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { join, relative, resolve } from 'node:path';\nimport type { SwcExtraCallerConfig } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { IMPORT_MODE } from '@intlayer/config/defaultValues';\nimport {\n formatDictionarySelectorEnvVar,\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport {\n compareVersions,\n getAlias,\n getHasDictionarySelector,\n getProjectRequire,\n getUnusedNodeTypes,\n isESModule,\n normalizePath,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport { logConfigDetails } from '@intlayer/engine/logConfigDetails';\nimport { buildComponentFilesList, runOnce } from '@intlayer/engine/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { IntlayerPlugin as IntlayerPluginType } from '@intlayer/webpack';\nimport { defu } from 'defu';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport nextPackageJSON from 'next/package.json' with { type: 'json' };\n\n/**\n * A `require` bound to this module, usable in both the ESM and CJS builds.\n *\n * Used to lazily pull in heavy, situational dependencies (e.g.\n * `@intlayer/webpack`) only when they are actually needed, keeping the initial\n * `next.config` evaluation lightweight. Mirrors the `configESMxCJSRequire`\n * pattern from `@intlayer/config`.\n */\nconst withIntlayerRequire: NodeJS.Require = isESModule\n ? createRequire(import.meta.url)\n : require;\n\n/**\n * Resolve the Next.js version from the *user's* project at runtime.\n * A static `import from 'next/package.json'` would resolve relative to\n * next-intlayer's own node_modules, which may differ in a monorepo.\n */\nconst getNextVersionFlags = (intlayerConfig: IntlayerConfig) => {\n let nextVersion = nextPackageJSON.version;\n\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n const pkg = requireFunction('next/package.json') as { version: string };\n nextVersion = pkg.version;\n } catch {\n // keep default\n }\n\n return {\n isGteNext13: compareVersions(nextVersion, '≥', '13.0.0'),\n isGteNext15: compareVersions(nextVersion, '≥', '15.0.0'),\n isGteNext16: compareVersions(nextVersion, '≥', '16.0.0'),\n isTurbopackStable: compareVersions(nextVersion, '≥', '15.3.0'),\n };\n};\n\n// Check if SWC plugin is available\nconst getIsSwcPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/swc');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\n// Check if Babel plugin is available\nconst getIsBabelExtractPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n const requireFunction =\n intlayerConfig.build?.require ?? getProjectRequire();\n requireFunction.resolve('@intlayer/babel');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\nconst resolvePluginPath = (\n pluginPath: string,\n intlayerConfig: IntlayerConfig,\n isTurbopackEnabled: boolean\n): string => {\n const requireFunction = intlayerConfig.build?.require ?? getProjectRequire();\n const pluginPathResolved = requireFunction?.resolve(pluginPath);\n\n if (isTurbopackEnabled)\n // Relative path for turbopack\n return normalizePath(`./${relative(process.cwd(), pluginPathResolved)}`);\n\n // Absolute path for webpack\n return pluginPathResolved;\n};\n\nconst getPruneConfig = (\n intlayerConfig: IntlayerConfig,\n isBuildCommand: boolean,\n isTurbopackEnabled: boolean,\n isDevCommand: boolean,\n isGteNext13: boolean,\n swcExtraCallers?: SwcExtraCallerConfig[]\n): Partial<NextConfig> => {\n const { optimize } = intlayerConfig.build;\n const importMode =\n intlayerConfig.build.importMode ?? intlayerConfig.dictionary?.importMode;\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n } = intlayerConfig.system;\n const { baseDir } = intlayerConfig.system;\n const logger = getAppLogger(intlayerConfig);\n\n if (optimize === false) {\n return {};\n }\n if (optimize === undefined && !isBuildCommand) {\n return {};\n }\n\n if (!isGteNext13) return {};\n\n const isSwcPluginAvailable = getIsSwcPluginAvailable(intlayerConfig);\n\n runOnce(\n join(baseDir, '.intlayer', 'cache', 'intlayer-prune-plugin-enabled.lock'),\n () => {\n if (isSwcPluginAvailable) {\n logger([\n `Build optimization ${colorize('enabled', ANSIColors.GREEN)}`,\n colorize(`(import mode:`, ANSIColors.GREY_DARK),\n colorize(importMode ?? IMPORT_MODE, ANSIColors.BLUE),\n colorize(`)`, ANSIColors.GREY_DARK),\n ]);\n } else {\n logger([\n colorize('Recommended: Install', ANSIColors.GREY),\n colorize('@intlayer/swc', ANSIColors.GREY_LIGHT),\n colorize(\n 'package to enable build optimization. See documentation:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://intlayer.org/docs/bundle-optimization',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n runOnce(\n join(\n baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-compiler-plugin-enabled.lock'\n ),\n () => {\n const isBabelExtractPluginAvailable =\n getIsBabelExtractPluginAvailable(intlayerConfig);\n\n if (isBabelExtractPluginAvailable) {\n let isEnabled = intlayerConfig.compiler?.enabled ?? true;\n\n if (isEnabled === 'build-only') {\n isEnabled = !isDevCommand;\n }\n\n if (isEnabled) {\n logger('Intlayer compiler enabled');\n } else {\n logger('Intlayer compiler disabled');\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 30, // 30 seconds\n }\n );\n\n if (!isSwcPluginAvailable) {\n return {};\n }\n\n const dictionariesEntryPath = join(mainDir, 'dictionaries.mjs');\n\n const dynamicDictionariesEntryPath = join(\n mainDir,\n 'dynamic_dictionaries.mjs'\n );\n\n const unmergedDictionariesEntryPath = join(\n mainDir,\n 'unmerged_dictionaries.mjs'\n );\n\n const fetchDictionariesEntryPath = join(mainDir, 'fetch_dictionaries.mjs');\n\n const filesListPattern = buildComponentFilesList(intlayerConfig);\n\n const filesList = [\n ...filesListPattern,\n dictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n unmergedDictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n ];\n\n const dictionaries = getDictionaries(intlayerConfig);\n\n const dictionaryModeMap: Record<string, 'static' | 'dynamic' | 'fetch'> = {};\n\n (Object.values(dictionaries) as Dictionary[]).forEach((dictionary) => {\n dictionaryModeMap[dictionary.key] =\n dictionary.importMode ?? importMode ?? IMPORT_MODE;\n });\n\n return {\n experimental: {\n swcPlugins: [\n [\n resolvePluginPath(\n '@intlayer/swc',\n intlayerConfig,\n isTurbopackEnabled\n ),\n {\n dictionariesDir,\n dictionariesEntryPath,\n unmergedDictionariesEntryPath,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n dynamicDictionariesEntryPath,\n fetchDictionariesDir,\n fetchDictionariesEntryPath,\n importMode,\n filesList,\n replaceDictionaryEntry: true,\n dictionaryModeMap,\n extraCallers: swcExtraCallers ?? [],\n },\n ],\n ],\n },\n };\n};\n\nconst getCommandsEvent = () => {\n const lifecycleEvent = process.env['npm_lifecycle_event'];\n const lifecycleScript = process.env['npm_lifecycle_script'] ?? '';\n\n const isDevCommand =\n lifecycleEvent === 'dev' ||\n process.argv.some((arg) => arg === 'dev') ||\n /(^|\\s)(next\\s+)?dev(\\s|$)/.test(lifecycleScript);\n\n const isBuildCommand =\n lifecycleEvent === 'build' ||\n process.argv.some((arg) => arg === 'build') ||\n /(^|\\s)(next\\s+)?build(\\s|$)/.test(lifecycleScript);\n\n const isStartCommand =\n lifecycleEvent === 'start' ||\n process.argv.some((arg) => arg === 'start') ||\n /(^|\\s)(next\\s+)?start(\\s|$)/.test(lifecycleScript);\n\n return {\n isDevCommand,\n isBuildCommand,\n isStartCommand,\n };\n};\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\ntype WithIntlayerOptions = GetConfigurationOptions & {\n enableTurbopack?: boolean;\n swcExtraCallers?: SwcExtraCallerConfig[];\n};\n\n/**\n * Pin the env file used to resolve the Intlayer configuration to the Next.js\n * command being run (`dev` → `development`, `build`/`start` → `production`).\n *\n * Next.js loads the config file in several processes during a single command\n * (the main `build` process plus one or more Turbopack/webpack workers), and\n * `process.env.NODE_ENV` is not guaranteed to hold the same value in all of\n * them. Since `getConfiguration` falls back to `NODE_ENV` to pick its env file\n * (`.env.development.local` vs `.env.production.local`), those processes could\n * otherwise resolve *different* env values (e.g. `applicationURL`,\n * `INTLAYER_CLIENT_ID`). The resulting configuration would differ between\n * processes, defeating the `isCachedConfigurationUpToDate` check and forcing a\n * redundant full dictionary rebuild.\n *\n * Passing an explicit `env` keeps configuration resolution deterministic across\n * every process of the command. An `env` already set by the caller is\n * respected, and when the command cannot be determined we fall back to\n * `getConfiguration`'s own default (i.e. leave `env` unset).\n */\nconst resolveConfigOptions = (\n configOptions?: WithIntlayerOptions\n): WithIntlayerOptions | undefined => {\n // Respect an explicit override from the caller (idempotent on re-entry).\n if (configOptions?.env) return configOptions;\n\n const { isDevCommand, isBuildCommand, isStartCommand } = getCommandsEvent();\n\n const env = isDevCommand\n ? 'development'\n : isBuildCommand || isStartCommand\n ? 'production'\n : undefined;\n\n if (!env) return configOptions;\n\n return {\n ...configOptions,\n env,\n };\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayerSync(nextConfig)\n * ```\n */\nexport const withIntlayerSync = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T,\n configOptions?: WithIntlayerOptions\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n logConfigDetails(resolvedConfigOptions);\n\n const appLogger = getAppLogger(intlayerConfig);\n\n const { isGteNext13, isGteNext15, isGteNext16, isTurbopackStable } =\n getNextVersionFlags(intlayerConfig);\n\n const isTurbopackEnabledFromCommand = isGteNext16\n ? // Next@16 enables turbopack by default; disable with --webpack\n !process.env['npm_lifecycle_script']?.includes('--webpack')\n : // Next@15 uses --turbopack, Next@14 uses --turbo\n process.env['npm_lifecycle_script']?.includes('--turbo');\n\n const isTurbopackEnabled =\n configOptions?.enableTurbopack ?? isTurbopackEnabledFromCommand;\n\n if (isTurbopackEnabled && typeof nextConfig.webpack !== 'undefined') {\n appLogger(\n 'Turbopack is enabled but a custom webpack config is present. It will be ignored.'\n );\n }\n\n const { isBuildCommand, isDevCommand } = getCommandsEvent();\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => `./${value}`, // prefix by './' to consider the path as relative to the project root. This is necessary for turbopack to work correctly.\n }),\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n };\n\n const serverExternalPackages = [\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n '@intlayer/engine',\n '@intlayer/webpack',\n ];\n\n let env: Record<string, string> = {};\n\n if (isBuildCommand) {\n const dictionaries = getDictionaries(intlayerConfig);\n\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = getUnusedNodeTypes(dictionaries);\n\n if (unusedNodeTypes && unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused logic:',\n unusedNodeTypes\n .filter(\n (key) => !['reactNode', 'solidNode', 'preactNode'].includes(key)\n )\n .map((key) => colorize(key, ANSIColors.BLUE))\n .join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n env = {\n ...env,\n\n // Tree shacking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes),\n\n // Tree shacking the dictionary selector logic\n // (collections / variants)\n ...formatDictionarySelectorEnvVar(getHasDictionarySelector(dictionaries)),\n\n // Tree shacking based on config\n ...getConfigEnvVars(intlayerConfig),\n };\n }\n\n const getNewConfig = (): Partial<NextConfig> => {\n let config: Partial<NextConfig> = {\n env,\n };\n\n if (isGteNext15) {\n config = {\n ...config,\n serverExternalPackages,\n };\n }\n\n if (isGteNext13 && !isGteNext15) {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n serverComponentsExternalPackages: serverExternalPackages,\n },\n };\n }\n\n if (isTurbopackEnabled) {\n if (isGteNext15 && isTurbopackStable) {\n config = {\n ...config,\n turbopack: turboConfig,\n };\n } else {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n // @ts-ignore exist in next@14\n turbo: turboConfig,\n },\n };\n }\n } else {\n config = {\n ...config,\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\n // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n // If the user has defined their own webpack config, call it\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // Rspack set external as false by default\n // Overwrite it to allow pushing the desired externals\n if (config.externals === false) {\n config.externals = [];\n }\n\n // Mark server-only modules as externals (function form handles subpaths)\n const externalExact = new Set([\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n 'recast',\n ]);\n const externalPrefixes = ['@intlayer/engine', '@intlayer/webpack'];\n config.externals.push(\n (\n { request }: { request?: string },\n callback: (err: Error | null, result?: string) => void\n ) => {\n if (\n request &&\n (externalExact.has(request) ||\n externalPrefixes.some(\n (prefix) =>\n request === prefix || request.startsWith(`${prefix}/`)\n ))\n ) {\n return callback(null, `commonjs ${request}`);\n }\n callback(null);\n }\n );\n\n // Use `node-loader` for any `.node` files\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Always alias on the server (node/edge) for stability.\n // On the client, alias only when not using live sync.\n config.resolve.alias = {\n ...config.resolve.alias,\n ...getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n };\n\n // Activate watch mode webpack plugin\n if (isDevCommand && isServer && nextRuntime === 'nodejs') {\n // Lazily load `@intlayer/webpack` only on the dev server's Node\n // runtime — the single place the plugin is needed. This keeps it out\n // of the initial `next.config` load and out of the (default)\n // Turbopack path entirely. `require` is used because Next.js invokes\n // the webpack config callback synchronously.\n const { IntlayerPlugin } = withIntlayerRequire(\n '@intlayer/webpack'\n ) as { IntlayerPlugin: typeof IntlayerPluginType };\n\n // Optional as rspack not support plugin yet\n config.plugins.push(new IntlayerPlugin(intlayerConfig));\n }\n\n return config;\n },\n };\n }\n\n return config;\n };\n\n const pruneConfig: Partial<NextConfig> = getPruneConfig(\n intlayerConfig,\n isBuildCommand,\n isTurbopackEnabled ?? false,\n isDevCommand,\n isGteNext13,\n configOptions?.swcExtraCallers\n );\n\n const intlayerNextConfig: Partial<NextConfig> = defu(\n getNewConfig(),\n pruneConfig\n );\n\n // Merge the new config with the user's config\n const result = defu(intlayerNextConfig, nextConfig) as NextConfig & T;\n\n return result;\n};\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n * > Node withIntlayer is a promise function. Use withIntlayerSync instead if you want to use it synchronously.\n * > Using the promise allows to prepare the intlayer dictionaries before the build starts.\n *\n */\nexport const withIntlayer = async <T extends NextConfig | Partial<NextConfig>>(\n nextConfig: T | Promise<T> = {} as T,\n configOptions?: WithIntlayerOptions\n): Promise<NextConfig & T> => {\n const { isBuildCommand, isDevCommand, isStartCommand } = getCommandsEvent();\n\n process.env.INTLAYER_IS_DEV_COMMAND = isDevCommand ? 'true' : 'false';\n\n const resolvedConfigOptions = resolveConfigOptions(configOptions);\n\n const intlayerConfig = getConfiguration(resolvedConfigOptions);\n\n const { mode } = intlayerConfig.build;\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n // If prod: clean and rebuild once\n // If dev: rebuild only once if it's more than 1 hour since last rebuild\n if (!isStartCommand && (isDevCommand || isBuildCommand || mode === 'auto')) {\n // Lazily load the heavy build pipeline (`@intlayer/engine/build`) only when\n // a rebuild is actually required, keeping `next.config` evaluation cheap for\n // commands (e.g. `start`) that never touch it.\n const { prepareIntlayer } = await import('@intlayer/engine/build');\n\n // prepareIntlayer use runOnce to ensure to run only once because will run twice on client and server side otherwise\n await prepareIntlayer(intlayerConfig, {\n clean: isBuildCommand,\n cacheTimeoutMs: isBuildCommand\n ? 1000 * 30 // 30 seconds for build (to ensure to rebuild all dictionaries)\n : 1000 * 60 * 60, // 1 hour for dev (default cache timeout)\n env: isBuildCommand ? 'prod' : 'dev',\n });\n }\n\n const nextConfigResolved = await nextConfig;\n\n return withIntlayerSync(nextConfigResolved, resolvedConfigOptions);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,sBAAsC,aACxC,cAAc,OAAO,KAAK,IAAI;;;;;;AAQlC,MAAM,uBAAuB,mBAAmC;CAC9D,IAAI,cAAc,gBAAgB;AAElC,KAAI;AAIF,iBAFE,eAAe,OAAO,WAAW,mBAAmB,EAC1B,oBACX,CAAC;SACZ;AAIR,QAAO;EACL,aAAa,gBAAgB,aAAa,KAAK,SAAS;EACxD,aAAa,gBAAgB,aAAa,KAAK,SAAS;EACxD,aAAa,gBAAgB,aAAa,KAAK,SAAS;EACxD,mBAAmB,gBAAgB,aAAa,KAAK,SAAS;EAC/D;;AAIH,MAAM,2BAA2B,mBAAmC;AAClE,KAAI;AAGF,GADE,eAAe,OAAO,WAAW,mBAAmB,EACtC,QAAQ,gBAAgB;AACxC,SAAO;UACA,IAAI;AACX,SAAO;;;AAKX,MAAM,oCAAoC,mBAAmC;AAC3E,KAAI;AAGF,GADE,eAAe,OAAO,WAAW,mBAAmB,EACtC,QAAQ,kBAAkB;AAC1C,SAAO;UACA,IAAI;AACX,SAAO;;;AAIX,MAAM,qBACJ,YACA,gBACA,uBACW;CAEX,MAAM,sBADkB,eAAe,OAAO,WAAW,mBAAmB,GAChC,QAAQ,WAAW;AAE/D,KAAI,mBAEF,QAAO,cAAc,KAAK,SAAS,QAAQ,KAAK,EAAE,mBAAmB,GAAG;AAG1E,QAAO;;AAGT,MAAM,kBACJ,gBACA,gBACA,oBACA,cACA,aACA,oBACwB;CACxB,MAAM,EAAE,aAAa,eAAe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AAE,WAE3B;;;;;;;;;;;;;;;;;AAkBf,MAAa,eAAe,OAC1B,aAA6B,EAAE,EAC/B,kBAC4B;CAC5B,MAAM,EAAE,gBAAgB,cAAc,mBAAmB,kBAAkB;AAE3E,SAAQ,IAAI,0BAA0B,eAAe,SAAS;CAE9D,MAAM,wBAAwB,qBAAqB,cAAc;CAEjE,MAAM,iBAAiB,iBAAiB,sBAAsB;CAE9D,MAAM,EAAE,SAAS,eAAe;AAKhC,KAAI,CAAC,mBAAmB,gBAAgB,kBAAkB,SAAS,SAAS;EAI1E,MAAM,EAAE,oBAAoB,MAAM,OAAO;AAGzC,QAAM,gBAAgB,gBAAgB;GACpC,OAAO;GACP,gBAAgB,iBACZ,MAAO,KACP,MAAO,KAAK;GAChB,KAAK,iBAAiB,SAAS;GAChC,CAAC;;AAKJ,QAAO,iBAAiB,MAFS,YAEW,sBAAsB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -17,6 +17,13 @@ import * as _$react_intlayer_markdown0 from "react-intlayer/markdown";
|
|
|
17
17
|
declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptions & {
|
|
18
18
|
components?: {} & {
|
|
19
19
|
object?: _$react.FC<_$react.DetailedHTMLProps<_$react.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
20
|
+
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
21
|
+
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
22
|
+
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
23
|
+
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
24
|
+
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
25
|
+
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
26
|
+
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
20
27
|
html?: _$react.FC<_$react.DetailedHTMLProps<_$react.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
|
|
21
28
|
head?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
|
|
22
29
|
body?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
|
|
@@ -46,9 +53,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
46
53
|
del?: _$react.FC<_$react.DetailedHTMLProps<_$react.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
47
54
|
ins?: _$react.FC<_$react.DetailedHTMLProps<_$react.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
48
55
|
mark?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
49
|
-
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
50
|
-
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
51
|
-
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
52
56
|
code?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
53
57
|
pre?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
54
58
|
blockquote?: _$react.FC<_$react.DetailedHTMLProps<_$react.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
@@ -70,8 +74,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
70
74
|
thead?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
71
75
|
tbody?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
72
76
|
tfoot?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
73
|
-
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
74
|
-
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
75
77
|
td?: _$react.FC<_$react.DetailedHTMLProps<_$react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
76
78
|
caption?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
77
79
|
colgroup?: _$react.FC<_$react.DetailedHTMLProps<_$react.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
@@ -87,7 +89,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
87
89
|
fieldset?: _$react.FC<_$react.DetailedHTMLProps<_$react.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
88
90
|
legend?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
89
91
|
datalist?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>>;
|
|
90
|
-
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
91
92
|
progress?: _$react.FC<_$react.DetailedHTMLProps<_$react.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
92
93
|
meter?: _$react.FC<_$react.DetailedHTMLProps<_$react.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
93
94
|
img?: _$react.FC<_$react.DetailedHTMLProps<_$react.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
@@ -106,7 +107,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
106
107
|
summary?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
107
108
|
dialog?: _$react.FC<_$react.DetailedHTMLProps<_$react.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
108
109
|
br?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
109
|
-
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
110
110
|
wbr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
111
111
|
ruby?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
112
112
|
rt?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
@@ -122,6 +122,13 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
122
122
|
wrapper?: _$react.FC<_$react.HTMLAttributes<HTMLElement>>;
|
|
123
123
|
renderMarkdown?: (markdown: string | _$react_intlayer_markdown0.ParsedMarkdown, options?: index_d_exports.MarkdownProviderOptions, components?: {} & {
|
|
124
124
|
object?: _$react.FC<_$react.DetailedHTMLProps<_$react.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
125
|
+
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
126
|
+
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
127
|
+
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
128
|
+
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
129
|
+
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
130
|
+
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
131
|
+
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
125
132
|
html?: _$react.FC<_$react.DetailedHTMLProps<_$react.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
|
|
126
133
|
head?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
|
|
127
134
|
body?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
|
|
@@ -151,9 +158,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
151
158
|
del?: _$react.FC<_$react.DetailedHTMLProps<_$react.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
152
159
|
ins?: _$react.FC<_$react.DetailedHTMLProps<_$react.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
153
160
|
mark?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
154
|
-
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
155
|
-
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
156
|
-
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
157
161
|
code?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
158
162
|
pre?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
159
163
|
blockquote?: _$react.FC<_$react.DetailedHTMLProps<_$react.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
@@ -175,8 +179,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
175
179
|
thead?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
176
180
|
tbody?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
177
181
|
tfoot?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
178
|
-
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
179
|
-
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
180
182
|
td?: _$react.FC<_$react.DetailedHTMLProps<_$react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
181
183
|
caption?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
182
184
|
colgroup?: _$react.FC<_$react.DetailedHTMLProps<_$react.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
@@ -192,7 +194,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
192
194
|
fieldset?: _$react.FC<_$react.DetailedHTMLProps<_$react.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
193
195
|
legend?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
194
196
|
datalist?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>>;
|
|
195
|
-
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
196
197
|
progress?: _$react.FC<_$react.DetailedHTMLProps<_$react.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
197
198
|
meter?: _$react.FC<_$react.DetailedHTMLProps<_$react.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
198
199
|
img?: _$react.FC<_$react.DetailedHTMLProps<_$react.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
@@ -211,7 +212,6 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
211
212
|
summary?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
212
213
|
dialog?: _$react.FC<_$react.DetailedHTMLProps<_$react.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
213
214
|
br?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
214
|
-
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
215
215
|
wbr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
216
216
|
ruby?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
217
217
|
rt?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
@@ -233,6 +233,13 @@ declare const MarkdownProvider: _$react.FC<index_d_exports.MarkdownProviderOptio
|
|
|
233
233
|
declare const useMarkdownContext: () => {
|
|
234
234
|
components?: {} & {
|
|
235
235
|
object?: _$react.FC<_$react.DetailedHTMLProps<_$react.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
236
|
+
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
237
|
+
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
238
|
+
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
239
|
+
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
240
|
+
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
241
|
+
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
242
|
+
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
236
243
|
html?: _$react.FC<_$react.DetailedHTMLProps<_$react.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
|
|
237
244
|
head?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
|
|
238
245
|
body?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
|
|
@@ -262,9 +269,6 @@ declare const useMarkdownContext: () => {
|
|
|
262
269
|
del?: _$react.FC<_$react.DetailedHTMLProps<_$react.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
263
270
|
ins?: _$react.FC<_$react.DetailedHTMLProps<_$react.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
264
271
|
mark?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
265
|
-
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
266
|
-
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
267
|
-
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
268
272
|
code?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
269
273
|
pre?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
270
274
|
blockquote?: _$react.FC<_$react.DetailedHTMLProps<_$react.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
@@ -286,8 +290,6 @@ declare const useMarkdownContext: () => {
|
|
|
286
290
|
thead?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
287
291
|
tbody?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
288
292
|
tfoot?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
289
|
-
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
290
|
-
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
291
293
|
td?: _$react.FC<_$react.DetailedHTMLProps<_$react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
292
294
|
caption?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
293
295
|
colgroup?: _$react.FC<_$react.DetailedHTMLProps<_$react.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
@@ -303,7 +305,6 @@ declare const useMarkdownContext: () => {
|
|
|
303
305
|
fieldset?: _$react.FC<_$react.DetailedHTMLProps<_$react.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
304
306
|
legend?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
305
307
|
datalist?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>>;
|
|
306
|
-
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
307
308
|
progress?: _$react.FC<_$react.DetailedHTMLProps<_$react.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
308
309
|
meter?: _$react.FC<_$react.DetailedHTMLProps<_$react.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
309
310
|
img?: _$react.FC<_$react.DetailedHTMLProps<_$react.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
@@ -322,7 +323,6 @@ declare const useMarkdownContext: () => {
|
|
|
322
323
|
summary?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
323
324
|
dialog?: _$react.FC<_$react.DetailedHTMLProps<_$react.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
324
325
|
br?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
325
|
-
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
326
326
|
wbr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
327
327
|
ruby?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
328
328
|
rt?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
@@ -337,6 +337,13 @@ declare const useMarkdownContext: () => {
|
|
|
337
337
|
};
|
|
338
338
|
renderMarkdown: (markdown: string | _$react_intlayer_markdown0.ParsedMarkdown, options?: index_d_exports.MarkdownProviderOptions, components?: {} & {
|
|
339
339
|
object?: _$react.FC<_$react.DetailedHTMLProps<_$react.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>>;
|
|
340
|
+
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
341
|
+
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
342
|
+
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
343
|
+
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
344
|
+
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
345
|
+
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
346
|
+
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
340
347
|
html?: _$react.FC<_$react.DetailedHTMLProps<_$react.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>>;
|
|
341
348
|
head?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>>;
|
|
342
349
|
body?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>;
|
|
@@ -366,9 +373,6 @@ declare const useMarkdownContext: () => {
|
|
|
366
373
|
del?: _$react.FC<_$react.DetailedHTMLProps<_$react.DelHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
367
374
|
ins?: _$react.FC<_$react.DetailedHTMLProps<_$react.InsHTMLAttributes<HTMLModElement>, HTMLModElement>>;
|
|
368
375
|
mark?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
369
|
-
small?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
370
|
-
sub?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
371
|
-
sup?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
372
376
|
code?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
373
377
|
pre?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLPreElement>, HTMLPreElement>>;
|
|
374
378
|
blockquote?: _$react.FC<_$react.DetailedHTMLProps<_$react.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>>;
|
|
@@ -390,8 +394,6 @@ declare const useMarkdownContext: () => {
|
|
|
390
394
|
thead?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
391
395
|
tbody?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
392
396
|
tfoot?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
|
|
393
|
-
tr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
|
|
394
|
-
th?: _$react.FC<_$react.DetailedHTMLProps<_$react.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
|
|
395
397
|
td?: _$react.FC<_$react.DetailedHTMLProps<_$react.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
|
|
396
398
|
caption?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
397
399
|
colgroup?: _$react.FC<_$react.DetailedHTMLProps<_$react.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>>;
|
|
@@ -407,7 +409,6 @@ declare const useMarkdownContext: () => {
|
|
|
407
409
|
fieldset?: _$react.FC<_$react.DetailedHTMLProps<_$react.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>>;
|
|
408
410
|
legend?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>>;
|
|
409
411
|
datalist?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>>;
|
|
410
|
-
output?: _$react.FC<_$react.DetailedHTMLProps<_$react.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>>;
|
|
411
412
|
progress?: _$react.FC<_$react.DetailedHTMLProps<_$react.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>>;
|
|
412
413
|
meter?: _$react.FC<_$react.DetailedHTMLProps<_$react.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>>;
|
|
413
414
|
img?: _$react.FC<_$react.DetailedHTMLProps<_$react.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>>;
|
|
@@ -426,7 +427,6 @@ declare const useMarkdownContext: () => {
|
|
|
426
427
|
summary?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
427
428
|
dialog?: _$react.FC<_$react.DetailedHTMLProps<_$react.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>>;
|
|
428
429
|
br?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLBRElement>, HTMLBRElement>>;
|
|
429
|
-
hr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLHRElement>, HTMLHRElement>>;
|
|
430
430
|
wbr?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
431
431
|
ruby?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
432
432
|
rt?: _$react.FC<_$react.DetailedHTMLProps<_$react.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIntlayer.d.ts","names":[],"sources":["../../../src/server/withIntlayer.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"withIntlayer.d.ts","names":[],"sources":["../../../src/server/withIntlayer.ts"],"mappings":";;;;;KAySK,mBAAA,GAAsB,uBAAA;EACzB,eAAA;EACA,eAAA,GAAkB,oBAAA;AAAA;;;;;;;;;AAuDpB;;;cAAa,gBAAA,aAA8B,OAAA,CAAQ,UAAA,GACjD,UAAA,GAAY,CAAA,EACZ,aAAA,GAAgB,mBAAA,KACf,UAAA,GAAa,CAAA;;;;;;;;;;;;;;;;cAuQH,YAAA,aAAgC,UAAA,GAAa,OAAA,CAAQ,UAAA,GAChE,UAAA,GAAY,CAAA,GAAI,OAAA,CAAQ,CAAA,GACxB,aAAA,GAAgB,mBAAA,KACf,OAAA,CAAQ,UAAA,GAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intlayer",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Simplify internationalization i18n in Next.js with context providers, hooks, locale detection, and multilingual content integration.",
|
|
6
6
|
"keywords": [
|
|
@@ -133,15 +133,15 @@
|
|
|
133
133
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
134
134
|
},
|
|
135
135
|
"dependencies": {
|
|
136
|
-
"@intlayer/config": "9.0.0-canary.
|
|
137
|
-
"@intlayer/core": "9.0.0-canary.
|
|
138
|
-
"@intlayer/dictionaries-entry": "9.0.0-canary.
|
|
139
|
-
"@intlayer/engine": "9.0.0-canary.
|
|
140
|
-
"@intlayer/types": "9.0.0-canary.
|
|
141
|
-
"@intlayer/webpack": "9.0.0-canary.
|
|
136
|
+
"@intlayer/config": "9.0.0-canary.14",
|
|
137
|
+
"@intlayer/core": "9.0.0-canary.14",
|
|
138
|
+
"@intlayer/dictionaries-entry": "9.0.0-canary.14",
|
|
139
|
+
"@intlayer/engine": "9.0.0-canary.14",
|
|
140
|
+
"@intlayer/types": "9.0.0-canary.14",
|
|
141
|
+
"@intlayer/webpack": "9.0.0-canary.14",
|
|
142
142
|
"defu": "6.1.7",
|
|
143
143
|
"node-loader": "2.1.0",
|
|
144
|
-
"react-intlayer": "9.0.0-canary.
|
|
144
|
+
"react-intlayer": "9.0.0-canary.14"
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@types/node": "25.9.4",
|