next-intlayer 5.3.13 → 5.4.0-canary.0

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.
@@ -55,8 +55,8 @@ const withIntlayer = (nextConfig = {}) => {
55
55
  const turboConfig = {
56
56
  resolveAlias: {
57
57
  // "prefix by './' to consider the path as relative to the project root. This is necessary for turbo to work correctly."
58
- "@intlayer/dictionaries-entry": "./" + relativeDictionariesPath,
59
- "@intlayer/config/built": "./" + relativeConfigurationPath
58
+ "@intlayer/dictionaries-entry": `./${relativeDictionariesPath}`,
59
+ "@intlayer/config/built": `./${relativeConfigurationPath}`
60
60
  },
61
61
  rules: {
62
62
  "*.node": {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport merge from 'deepmerge';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport { join, relative, resolve } from 'path';\nimport { compareVersions } from './compareVersion';\nimport { getNextVersion } from './getNextVertion';\n\n// Extract from the start script if --turbo or --turbopack flag is used\nconst isTurbopackEnabled =\n process.env.npm_lifecycle_script?.includes('--turbo');\nconst nextVersion = getNextVersion();\nconst isGteNext13 = compareVersions(nextVersion, '≥', '13.0.0');\nconst isGteNext15 = compareVersions(nextVersion, '≥', '15.0.0');\nconst isTurbopackStable = compareVersions(nextVersion, '≥', '15.3.0');\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variablesi\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n */\nexport const withIntlayer = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const intlayerConfig = getConfiguration();\n\n // Format all configuration values as environment variables\n const { mainDir, configDir, baseDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: {\n // \"prefix by './' to consider the path as relative to the project root. This is necessary for turbo to work correctly.\"\n '@intlayer/dictionaries-entry': './' + relativeDictionariesPath,\n '@intlayer/config/built': './' + relativeConfigurationPath,\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 ];\n\n const newConfig: Partial<NextConfig> = {\n // Only add `serverExternalPackages` if Next.js is v15+\n ...(isGteNext15\n ? {\n // only for Next ≥15\n serverExternalPackages,\n }\n : {\n // only for Next ≥13 and <15.3\n ...(isGteNext13 && {\n serverComponentsExternalPackages: serverExternalPackages,\n }),\n }),\n\n ...(isTurbopackEnabled && {\n ...(isGteNext15 && isTurbopackStable\n ? {\n // only for Next ≥15.3\n turbopack: turboConfig,\n }\n : {\n experimental: {\n // only for Next ≥13 and <15.3\n turbo: turboConfig,\n },\n }),\n }),\n\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\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 // Alias the dictionary entry for all builds\n config.resolve.alias = {\n ...config.resolve.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\n };\n\n // Mark these modules as externals\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\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 // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntlayerPlugin());\n }\n\n return config;\n },\n };\n\n // Merge the new config with the user's config\n return merge(nextConfig, newConfig) as NextConfig & T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,qBAA+B;AAC/B,uBAAkB;AAGlB,kBAAwC;AACxC,4BAAgC;AAChC,4BAA+B;AAG/B,MAAM,qBACJ,QAAQ,IAAI,sBAAsB,SAAS,SAAS;AACtD,MAAM,kBAAc,sCAAe;AACnC,MAAM,kBAAc,uCAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,kBAAc,uCAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,wBAAoB,uCAAgB,aAAa,UAAK,QAAQ;AAe7D,MAAM,eAAe,CAC1B,aAAgB,CAAC,MACE;AACnB,MAAI,OAAO,eAAe,UAAU;AAClC,iBAAa,CAAC;AAAA,EAChB;AAEA,QAAM,qBAAiB,gCAAiB;AAGxC,QAAM,EAAE,SAAS,WAAW,QAAQ,IAAI,eAAe;AAEvD,QAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,QAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAEnE,QAAM,wBAAoB,kBAAK,WAAW,oBAAoB;AAC9D,QAAM,gCAA4B,sBAAS,SAAS,iBAAiB;AAGrE,QAAM,cAAc;AAAA,IAClB,cAAc;AAAA;AAAA,MAEZ,gCAAgC,OAAO;AAAA,MACvC,0BAA0B,OAAO;AAAA,IACnC;AAAA,IACA,OAAO;AAAA,MACL,UAAU;AAAA,QACR,IAAI;AAAA,QACJ,SAAS,CAAC,aAAa;AAAA,MACzB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,yBAAyB;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,YAAiC;AAAA;AAAA,IAErC,GAAI,cACA;AAAA;AAAA,MAEE;AAAA,IACF,IACA;AAAA;AAAA,MAEE,GAAI,eAAe;AAAA,QACjB,kCAAkC;AAAA,MACpC;AAAA,IACF;AAAA,IAEJ,GAAI,sBAAsB;AAAA,MACxB,GAAI,eAAe,oBACf;AAAA;AAAA,QAEE,WAAW;AAAA,MACb,IACA;AAAA,QACE,cAAc;AAAA;AAAA,UAEZ,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACN;AAAA,IAEA,SAAS,CAAC,QAA4B,YAA8B;AAElE,UAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAS,WAAW,QAAQ,QAAQ,OAAO;AAAA,MAC7C;AAGA,aAAO,QAAQ,QAAQ;AAAA,QACrB,GAAG,OAAO,QAAQ;AAAA,QAClB,oCAAgC,qBAAQ,wBAAwB;AAAA,QAChE,8BAA0B,qBAAQ,yBAAyB;AAAA,MAC7D;AAGA,aAAO,UAAU,KAAK;AAAA,QACpB,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,UAAU;AAAA,MACZ,CAAC;AAGD,aAAO,OAAO,MAAM,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AAGD,YAAM,EAAE,UAAU,YAAY,IAAI;AAElC,UAAI,YAAY,gBAAgB,UAAU;AACxC,eAAO,QAAQ,KAAK,IAAI,8BAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AAGA,aAAO,iBAAAA,SAAM,YAAY,SAAS;AACpC;","names":["merge"]}
1
+ {"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport merge from 'deepmerge';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport { join, relative, resolve } from 'path';\nimport { compareVersions } from './compareVersion';\nimport { getNextVersion } from './getNextVertion';\n\n// Extract from the start script if --turbo or --turbopack flag is used\nconst isTurbopackEnabled =\n process.env.npm_lifecycle_script?.includes('--turbo');\nconst nextVersion = getNextVersion();\nconst isGteNext13 = compareVersions(nextVersion, '≥', '13.0.0');\nconst isGteNext15 = compareVersions(nextVersion, '≥', '15.0.0');\nconst isTurbopackStable = compareVersions(nextVersion, '≥', '15.3.0');\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variablesi\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n */\nexport const withIntlayer = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const intlayerConfig = getConfiguration();\n\n // Format all configuration values as environment variables\n const { mainDir, configDir, baseDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: {\n // \"prefix by './' to consider the path as relative to the project root. This is necessary for turbo to work correctly.\"\n '@intlayer/dictionaries-entry': `./${relativeDictionariesPath}`,\n '@intlayer/config/built': `./${relativeConfigurationPath}`,\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 ];\n\n const newConfig: Partial<NextConfig> = {\n // Only add `serverExternalPackages` if Next.js is v15+\n ...(isGteNext15\n ? {\n // only for Next ≥15\n serverExternalPackages,\n }\n : {\n // only for Next ≥13 and <15.3\n ...(isGteNext13 && {\n serverComponentsExternalPackages: serverExternalPackages,\n }),\n }),\n\n ...(isTurbopackEnabled && {\n ...(isGteNext15 && isTurbopackStable\n ? {\n // only for Next ≥15.3\n turbopack: turboConfig,\n }\n : {\n experimental: {\n // only for Next ≥13 and <15.3\n turbo: turboConfig,\n },\n }),\n }),\n\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\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 // Alias the dictionary entry for all builds\n config.resolve.alias = {\n ...config.resolve.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\n };\n\n // Mark these modules as externals\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\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 // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntlayerPlugin());\n }\n\n return config;\n },\n };\n\n // Merge the new config with the user's config\n return merge(nextConfig, newConfig) as NextConfig & T;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,qBAA+B;AAC/B,uBAAkB;AAGlB,kBAAwC;AACxC,4BAAgC;AAChC,4BAA+B;AAG/B,MAAM,qBACJ,QAAQ,IAAI,sBAAsB,SAAS,SAAS;AACtD,MAAM,kBAAc,sCAAe;AACnC,MAAM,kBAAc,uCAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,kBAAc,uCAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,wBAAoB,uCAAgB,aAAa,UAAK,QAAQ;AAe7D,MAAM,eAAe,CAC1B,aAAgB,C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,yBAAyB;AAAA,MAC7D;AAGA,aAAO,UAAU,KAAK;AAAA,QACpB,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,UAAU;AAAA,MACZ,CAAC;AAGD,aAAO,OAAO,MAAM,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AAGD,YAAM,EAAE,UAAU,YAAY,IAAI;AAElC,UAAI,YAAY,gBAAgB,UAAU;AACxC,eAAO,QAAQ,KAAK,IAAI,8BAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AAGA,aAAO,iBAAAA,SAAM,YAAY,SAAS;AACpC;","names":["merge"]}
@@ -22,8 +22,8 @@ const withIntlayer = (nextConfig = {}) => {
22
22
  const turboConfig = {
23
23
  resolveAlias: {
24
24
  // "prefix by './' to consider the path as relative to the project root. This is necessary for turbo to work correctly."
25
- "@intlayer/dictionaries-entry": "./" + relativeDictionariesPath,
26
- "@intlayer/config/built": "./" + relativeConfigurationPath
25
+ "@intlayer/dictionaries-entry": `./${relativeDictionariesPath}`,
26
+ "@intlayer/config/built": `./${relativeConfigurationPath}`
27
27
  },
28
28
  rules: {
29
29
  "*.node": {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport merge from 'deepmerge';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport { join, relative, resolve } from 'path';\nimport { compareVersions } from './compareVersion';\nimport { getNextVersion } from './getNextVertion';\n\n// Extract from the start script if --turbo or --turbopack flag is used\nconst isTurbopackEnabled =\n process.env.npm_lifecycle_script?.includes('--turbo');\nconst nextVersion = getNextVersion();\nconst isGteNext13 = compareVersions(nextVersion, '≥', '13.0.0');\nconst isGteNext15 = compareVersions(nextVersion, '≥', '15.0.0');\nconst isTurbopackStable = compareVersions(nextVersion, '≥', '15.3.0');\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variablesi\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n */\nexport const withIntlayer = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const intlayerConfig = getConfiguration();\n\n // Format all configuration values as environment variables\n const { mainDir, configDir, baseDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: {\n // \"prefix by './' to consider the path as relative to the project root. This is necessary for turbo to work correctly.\"\n '@intlayer/dictionaries-entry': './' + relativeDictionariesPath,\n '@intlayer/config/built': './' + relativeConfigurationPath,\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 ];\n\n const newConfig: Partial<NextConfig> = {\n // Only add `serverExternalPackages` if Next.js is v15+\n ...(isGteNext15\n ? {\n // only for Next ≥15\n serverExternalPackages,\n }\n : {\n // only for Next ≥13 and <15.3\n ...(isGteNext13 && {\n serverComponentsExternalPackages: serverExternalPackages,\n }),\n }),\n\n ...(isTurbopackEnabled && {\n ...(isGteNext15 && isTurbopackStable\n ? {\n // only for Next ≥15.3\n turbopack: turboConfig,\n }\n : {\n experimental: {\n // only for Next ≥13 and <15.3\n turbo: turboConfig,\n },\n }),\n }),\n\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\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 // Alias the dictionary entry for all builds\n config.resolve.alias = {\n ...config.resolve.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\n };\n\n // Mark these modules as externals\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\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 // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntlayerPlugin());\n }\n\n return config;\n },\n };\n\n // Merge the new config with the user's config\n return merge(nextConfig, newConfig) as NextConfig & T;\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,OAAO,WAAW;AAGlB,SAAS,MAAM,UAAU,eAAe;AACxC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAG/B,MAAM,qBACJ,QAAQ,IAAI,sBAAsB,SAAS,SAAS;AACtD,MAAM,cAAc,eAAe;AACnC,MAAM,cAAc,gBAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,cAAc,gBAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,oBAAoB,gBAAgB,aAAa,UAAK,QAAQ;AAe7D,MAAM,eAAe,CAC1B,aAAgB,CAAC,MACE;AACnB,MAAI,OAAO,eAAe,UAAU;AAClC,iBAAa,CAAC;AAAA,EAChB;AAEA,QAAM,iBAAiB,iBAAiB;AAGxC,QAAM,EAAE,SAAS,WAAW,QAAQ,IAAI,eAAe;AAEvD,QAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,QAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAEnE,QAAM,oBAAoB,KAAK,WAAW,oBAAoB;AAC9D,QAAM,4BAA4B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,KAAK,IAAI,eAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AAGA,SAAO,MAAM,YAAY,SAAS;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport merge from 'deepmerge';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport { join, relative, resolve } from 'path';\nimport { compareVersions } from './compareVersion';\nimport { getNextVersion } from './getNextVertion';\n\n// Extract from the start script if --turbo or --turbopack flag is used\nconst isTurbopackEnabled =\n process.env.npm_lifecycle_script?.includes('--turbo');\nconst nextVersion = getNextVersion();\nconst isGteNext13 = compareVersions(nextVersion, '≥', '13.0.0');\nconst isGteNext15 = compareVersions(nextVersion, '≥', '15.0.0');\nconst isTurbopackStable = compareVersions(nextVersion, '≥', '15.3.0');\n\ntype WebpackParams = Parameters<NextJsWebpackConfig>;\n\n/**\n * A Next.js plugin that adds the intlayer configuration to the webpack configuration\n * and sets the environment variablesi\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n */\nexport const withIntlayer = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const intlayerConfig = getConfiguration();\n\n // Format all configuration values as environment variables\n const { mainDir, configDir, baseDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: {\n // \"prefix by './' to consider the path as relative to the project root. This is necessary for turbo to work correctly.\"\n '@intlayer/dictionaries-entry': `./${relativeDictionariesPath}`,\n '@intlayer/config/built': `./${relativeConfigurationPath}`,\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 ];\n\n const newConfig: Partial<NextConfig> = {\n // Only add `serverExternalPackages` if Next.js is v15+\n ...(isGteNext15\n ? {\n // only for Next ≥15\n serverExternalPackages,\n }\n : {\n // only for Next ≥13 and <15.3\n ...(isGteNext13 && {\n serverComponentsExternalPackages: serverExternalPackages,\n }),\n }),\n\n ...(isTurbopackEnabled && {\n ...(isGteNext15 && isTurbopackStable\n ? {\n // only for Next ≥15.3\n turbopack: turboConfig,\n }\n : {\n experimental: {\n // only for Next ≥13 and <15.3\n turbo: turboConfig,\n },\n }),\n }),\n\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\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 // Alias the dictionary entry for all builds\n config.resolve.alias = {\n ...config.resolve.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n '@intlayer/config/built': resolve(relativeConfigurationPath),\n };\n\n // Mark these modules as externals\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\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 // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntlayerPlugin());\n }\n\n return config;\n },\n };\n\n // Merge the new config with the user's config\n return merge(nextConfig, newConfig) as NextConfig & T;\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,OAAO,WAAW;AAGlB,SAAS,MAAM,UAAU,eAAe;AACxC,SAAS,uBAAuB;AAChC,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F;AAAA,IACN;AAAA,IAEA,SAAS,CAAC,QAA4B,YAA8B;AAElE,UAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAS,WAAW,QAAQ,QAAQ,OAAO;AAAA,MAC7C;AAGA,aAAO,QAAQ,QAAQ;AAAA,QACrB,GAAG,OAAO,QAAQ;AAAA,QAClB,gCAAgC,QAAQ,wBAAwB;AAAA,QAChE,0BAA0B,QAAQ,yBAAyB;AAAA,MAC7D;AAGA,aAAO,UAAU,KAAK;AAAA,QACpB,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,IAAI;AAAA,QACJ,UAAU;AAAA,QACV,UAAU;AAAA,MACZ,CAAC;AAGD,aAAO,OAAO,MAAM,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AAGD,YAAM,EAAE,UAAU,YAAY,IAAI;AAElC,UAAI,YAAY,gBAAgB,UAAU;AACxC,eAAO,QAAQ,KAAK,IAAI,eAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF;AAGA,SAAO,MAAM,YAAY,SAAS;AACpC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intlayer",
3
- "version": "5.3.13",
3
+ "version": "5.4.0-canary.0",
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": [
@@ -69,12 +69,12 @@
69
69
  "dependencies": {
70
70
  "deepmerge": "^4.3.1",
71
71
  "node-loader": "^2.1.0",
72
- "@intlayer/chokidar": "5.3.13",
73
- "@intlayer/config": "5.3.13",
74
- "@intlayer/core": "5.3.13",
75
- "@intlayer/dictionaries-entry": "5.3.13",
76
- "react-intlayer": "5.3.13",
77
- "@intlayer/webpack": "5.3.13"
72
+ "@intlayer/config": "5.4.0-canary.0",
73
+ "@intlayer/core": "5.4.0-canary.0",
74
+ "@intlayer/chokidar": "5.4.0-canary.0",
75
+ "@intlayer/dictionaries-entry": "5.4.0-canary.0",
76
+ "react-intlayer": "5.4.0-canary.0",
77
+ "@intlayer/webpack": "5.4.0-canary.0"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/node": "^22.13.10",
@@ -89,21 +89,21 @@
89
89
  "tsup": "^8.4.0",
90
90
  "typescript": "^5.8.2",
91
91
  "@utils/eslint-config": "1.0.4",
92
+ "intlayer": "5.4.0-canary.0",
92
93
  "@utils/ts-config": "1.0.4",
93
- "@utils/tsup-config": "1.0.4",
94
94
  "@utils/ts-config-types": "1.0.4",
95
- "intlayer": "5.3.13"
95
+ "@utils/tsup-config": "1.0.4"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "next": ">=14.0.0",
99
99
  "react": ">=16.0.0",
100
100
  "react-dom": ">=16.0.0",
101
- "@intlayer/config": "5.3.13",
102
- "@intlayer/core": "5.3.13",
103
- "intlayer": "5.3.13",
104
- "@intlayer/webpack": "5.3.13",
105
- "@intlayer/dictionaries-entry": "5.3.13",
106
- "react-intlayer": "5.3.13"
101
+ "@intlayer/config": "5.4.0-canary.0",
102
+ "@intlayer/core": "5.4.0-canary.0",
103
+ "intlayer": "5.4.0-canary.0",
104
+ "@intlayer/dictionaries-entry": "5.4.0-canary.0",
105
+ "@intlayer/webpack": "5.4.0-canary.0",
106
+ "react-intlayer": "5.4.0-canary.0"
107
107
  },
108
108
  "engines": {
109
109
  "node": ">=14.18"