next-intlayer 1.2.1 → 2.0.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.
|
@@ -30,11 +30,28 @@ const withIntlayer = (_pluginOptions = {}) => (nextConfig = {}) => {
|
|
|
30
30
|
const intlayerConfig = (0, import_config.getConfiguration)();
|
|
31
31
|
const env = (0, import_config.formatEnvVariable)("next");
|
|
32
32
|
const { mainDir, baseDir } = intlayerConfig.content;
|
|
33
|
+
const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.mjs");
|
|
34
|
+
const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
|
|
33
35
|
return Object.assign({}, nextConfig, {
|
|
34
36
|
env: { ...nextConfig.env, ...env },
|
|
37
|
+
experimental: {
|
|
38
|
+
...nextConfig.experimental ?? {},
|
|
39
|
+
// Using Intlayer with Turbopack is not supported as long external modules can't be resolved (such as esbuild or fs)
|
|
40
|
+
turbo: {
|
|
41
|
+
...nextConfig.experimental?.turbo ?? {},
|
|
42
|
+
resolveAlias: {
|
|
43
|
+
...nextConfig.experimental?.turbo?.resolveAlias,
|
|
44
|
+
"@intlayer/dictionaries-entry": (0, import_path.resolve)(relativeDictionariesPath)
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
"*.node": {
|
|
48
|
+
as: "*.node",
|
|
49
|
+
loaders: ["node-loader"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
35
54
|
webpack: (config, { isServer, nextRuntime }) => {
|
|
36
|
-
const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.cjs");
|
|
37
|
-
const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
|
|
38
55
|
config.resolve.alias["@intlayer/dictionaries-entry"] = (0, import_path.resolve)(
|
|
39
56
|
relativeDictionariesPath
|
|
40
57
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { resolve, relative, join } from 'path';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { IntLayerPlugin } from '@intlayer/webpack';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\n\ntype PluginOptions = {\n // TODO: add options\n};\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 variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n */\nexport const withIntlayer =\n (_pluginOptions: PluginOptions = {}) =>\n (nextConfig: Partial<NextConfig> = {}): Partial<NextConfig> => {\n if (typeof nextConfig !== 'object') nextConfig = {};\n\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('next');\n\n const { mainDir, baseDir } = intlayerConfig.content;\n\n return Object.assign({}, nextConfig, {\n env: { ...nextConfig.env, ...env },\n\n webpack: (\n config: WebpackParams['0'],\n { isServer, nextRuntime }: WebpackParams[1]\n ) => {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { resolve, relative, join } from 'path';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { IntLayerPlugin } from '@intlayer/webpack';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\n\ntype PluginOptions = {\n // TODO: add options\n};\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 variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n */\nexport const withIntlayer =\n (_pluginOptions: PluginOptions = {}) =>\n (nextConfig: Partial<NextConfig> = {}): Partial<NextConfig> => {\n if (typeof nextConfig !== 'object') nextConfig = {};\n\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('next');\n\n const { mainDir, baseDir } = intlayerConfig.content;\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n return Object.assign({}, nextConfig, {\n env: { ...nextConfig.env, ...env },\n\n experimental: {\n ...(nextConfig.experimental ?? {}),\n // Using Intlayer with Turbopack is not supported as long external modules can't be resolved (such as esbuild or fs)\n turbo: {\n ...(nextConfig.experimental?.turbo ?? {}),\n resolveAlias: {\n ...nextConfig.experimental?.turbo?.resolveAlias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n },\n },\n\n webpack: (\n config: WebpackParams['0'],\n { isServer, nextRuntime }: WebpackParams[1]\n ) => {\n config.resolve.alias['@intlayer/dictionaries-entry'] = resolve(\n relativeDictionariesPath\n );\n\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n });\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Apply IntLayerPlugin only on the server-side\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntLayerPlugin());\n }\n\n return config;\n },\n } satisfies Partial<NextConfig>);\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwC;AACxC,oBAAoD;AACpD,qBAA+B;AAsBxB,MAAM,eACX,CAAC,iBAAgC,CAAC,MAClC,CAAC,aAAkC,CAAC,MAA2B;AAC7D,MAAI,OAAO,eAAe;AAAU,iBAAa,CAAC;AAElD,QAAM,qBAAiB,gCAAiB;AAGxC,QAAM,UAAM,iCAAkB,MAAM;AAEpC,QAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAC5C,QAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,QAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAEnE,SAAO,OAAO,OAAO,CAAC,GAAG,YAAY;AAAA,IACnC,KAAK,EAAE,GAAG,WAAW,KAAK,GAAG,IAAI;AAAA,IAEjC,cAAc;AAAA,MACZ,GAAI,WAAW,gBAAgB,CAAC;AAAA;AAAA,MAEhC,OAAO;AAAA,QACL,GAAI,WAAW,cAAc,SAAS,CAAC;AAAA,QACvC,cAAc;AAAA,UACZ,GAAG,WAAW,cAAc,OAAO;AAAA,UACnC,oCAAgC,qBAAQ,wBAAwB;AAAA,QAClE;AAAA,QAEA,OAAO;AAAA,UACL,UAAU;AAAA,YACR,IAAI;AAAA,YACJ,SAAS,CAAC,aAAa;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IAEA,SAAS,CACP,QACA,EAAE,UAAU,YAAY,MACrB;AACH,aAAO,QAAQ,MAAM,8BAA8B,QAAI;AAAA,QACrD;AAAA,MACF;AAEA,aAAO,UAAU,KAAK;AAAA,QACpB,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,IAAI;AAAA,MACN,CAAC;AACD,aAAO,OAAO,MAAM,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AAGD,UAAI,YAAY,gBAAgB,UAAU;AACxC,eAAO,QAAQ,KAAK,IAAI,8BAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF,CAA+B;AACjC;","names":[]}
|
|
@@ -7,11 +7,28 @@ const withIntlayer = (_pluginOptions = {}) => (nextConfig = {}) => {
|
|
|
7
7
|
const intlayerConfig = getConfiguration();
|
|
8
8
|
const env = formatEnvVariable("next");
|
|
9
9
|
const { mainDir, baseDir } = intlayerConfig.content;
|
|
10
|
+
const dictionariesPath = join(mainDir, "dictionaries.mjs");
|
|
11
|
+
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
10
12
|
return Object.assign({}, nextConfig, {
|
|
11
13
|
env: { ...nextConfig.env, ...env },
|
|
14
|
+
experimental: {
|
|
15
|
+
...nextConfig.experimental ?? {},
|
|
16
|
+
// Using Intlayer with Turbopack is not supported as long external modules can't be resolved (such as esbuild or fs)
|
|
17
|
+
turbo: {
|
|
18
|
+
...nextConfig.experimental?.turbo ?? {},
|
|
19
|
+
resolveAlias: {
|
|
20
|
+
...nextConfig.experimental?.turbo?.resolveAlias,
|
|
21
|
+
"@intlayer/dictionaries-entry": resolve(relativeDictionariesPath)
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
"*.node": {
|
|
25
|
+
as: "*.node",
|
|
26
|
+
loaders: ["node-loader"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
12
31
|
webpack: (config, { isServer, nextRuntime }) => {
|
|
13
|
-
const dictionariesPath = join(mainDir, "dictionaries.cjs");
|
|
14
|
-
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
15
32
|
config.resolve.alias["@intlayer/dictionaries-entry"] = resolve(
|
|
16
33
|
relativeDictionariesPath
|
|
17
34
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { resolve, relative, join } from 'path';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { IntLayerPlugin } from '@intlayer/webpack';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\n\ntype PluginOptions = {\n // TODO: add options\n};\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 variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n */\nexport const withIntlayer =\n (_pluginOptions: PluginOptions = {}) =>\n (nextConfig: Partial<NextConfig> = {}): Partial<NextConfig> => {\n if (typeof nextConfig !== 'object') nextConfig = {};\n\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('next');\n\n const { mainDir, baseDir } = intlayerConfig.content;\n\n return Object.assign({}, nextConfig, {\n env: { ...nextConfig.env, ...env },\n\n webpack: (\n config: WebpackParams['0'],\n { isServer, nextRuntime }: WebpackParams[1]\n ) => {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { resolve, relative, join } from 'path';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { IntLayerPlugin } from '@intlayer/webpack';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\n\ntype PluginOptions = {\n // TODO: add options\n};\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 variables\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n *\n */\nexport const withIntlayer =\n (_pluginOptions: PluginOptions = {}) =>\n (nextConfig: Partial<NextConfig> = {}): Partial<NextConfig> => {\n if (typeof nextConfig !== 'object') nextConfig = {};\n\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('next');\n\n const { mainDir, baseDir } = intlayerConfig.content;\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n return Object.assign({}, nextConfig, {\n env: { ...nextConfig.env, ...env },\n\n experimental: {\n ...(nextConfig.experimental ?? {}),\n // Using Intlayer with Turbopack is not supported as long external modules can't be resolved (such as esbuild or fs)\n turbo: {\n ...(nextConfig.experimental?.turbo ?? {}),\n resolveAlias: {\n ...nextConfig.experimental?.turbo?.resolveAlias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n },\n },\n\n webpack: (\n config: WebpackParams['0'],\n { isServer, nextRuntime }: WebpackParams[1]\n ) => {\n config.resolve.alias['@intlayer/dictionaries-entry'] = resolve(\n relativeDictionariesPath\n );\n\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n });\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Apply IntLayerPlugin only on the server-side\n if (isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntLayerPlugin());\n }\n\n return config;\n },\n } satisfies Partial<NextConfig>);\n };\n"],"mappings":"AAAA,SAAS,SAAS,UAAU,YAAY;AACxC,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,sBAAsB;AAsBxB,MAAM,eACX,CAAC,iBAAgC,CAAC,MAClC,CAAC,aAAkC,CAAC,MAA2B;AAC7D,MAAI,OAAO,eAAe;AAAU,iBAAa,CAAC;AAElD,QAAM,iBAAiB,iBAAiB;AAGxC,QAAM,MAAM,kBAAkB,MAAM;AAEpC,QAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAC5C,QAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,QAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAEnE,SAAO,OAAO,OAAO,CAAC,GAAG,YAAY;AAAA,IACnC,KAAK,EAAE,GAAG,WAAW,KAAK,GAAG,IAAI;AAAA,IAEjC,cAAc;AAAA,MACZ,GAAI,WAAW,gBAAgB,CAAC;AAAA;AAAA,MAEhC,OAAO;AAAA,QACL,GAAI,WAAW,cAAc,SAAS,CAAC;AAAA,QACvC,cAAc;AAAA,UACZ,GAAG,WAAW,cAAc,OAAO;AAAA,UACnC,gCAAgC,QAAQ,wBAAwB;AAAA,QAClE;AAAA,QAEA,OAAO;AAAA,UACL,UAAU;AAAA,YACR,IAAI;AAAA,YACJ,SAAS,CAAC,aAAa;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IAEA,SAAS,CACP,QACA,EAAE,UAAU,YAAY,MACrB;AACH,aAAO,QAAQ,MAAM,8BAA8B,IAAI;AAAA,QACrD;AAAA,MACF;AAEA,aAAO,UAAU,KAAK;AAAA,QACpB,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,IAAI;AAAA,MACN,CAAC;AACD,aAAO,OAAO,MAAM,KAAK;AAAA,QACvB,MAAM;AAAA,QACN,QAAQ;AAAA,MACV,CAAC;AAGD,UAAI,YAAY,gBAAgB,UAAU;AACxC,eAAO,QAAQ,KAAK,IAAI,eAAe,CAAC;AAAA,MAC1C;AAEA,aAAO;AAAA,IACT;AAAA,EACF,CAA+B;AACjC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intlayer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Webpack configuration for IntLayer using NextJS",
|
|
6
6
|
"keywords": [
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"negotiator": "^0.6.3",
|
|
67
67
|
"next": "14.1.4",
|
|
68
68
|
"webpack": "^5.91.0",
|
|
69
|
-
"@intlayer/chokidar": "^
|
|
70
|
-
"@intlayer/config": "^
|
|
71
|
-
"@intlayer/core": "^
|
|
72
|
-
"@intlayer/dictionaries-entry": "^
|
|
73
|
-
"@intlayer/webpack": "^
|
|
74
|
-
"intlayer": "^
|
|
75
|
-
"react-intlayer": "^
|
|
69
|
+
"@intlayer/chokidar": "^2.0.0",
|
|
70
|
+
"@intlayer/config": "^2.0.0",
|
|
71
|
+
"@intlayer/core": "^2.0.0",
|
|
72
|
+
"@intlayer/dictionaries-entry": "^2.0.0",
|
|
73
|
+
"@intlayer/webpack": "^2.0.0",
|
|
74
|
+
"intlayer": "^2.0.0",
|
|
75
|
+
"react-intlayer": "^2.0.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/negotiator": "^0.6.3",
|
|
@@ -33,17 +33,35 @@ export const withIntlayer =
|
|
|
33
33
|
const env = formatEnvVariable('next');
|
|
34
34
|
|
|
35
35
|
const { mainDir, baseDir } = intlayerConfig.content;
|
|
36
|
+
const dictionariesPath = join(mainDir, 'dictionaries.mjs');
|
|
37
|
+
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
36
38
|
|
|
37
39
|
return Object.assign({}, nextConfig, {
|
|
38
40
|
env: { ...nextConfig.env, ...env },
|
|
39
41
|
|
|
42
|
+
experimental: {
|
|
43
|
+
...(nextConfig.experimental ?? {}),
|
|
44
|
+
// Using Intlayer with Turbopack is not supported as long external modules can't be resolved (such as esbuild or fs)
|
|
45
|
+
turbo: {
|
|
46
|
+
...(nextConfig.experimental?.turbo ?? {}),
|
|
47
|
+
resolveAlias: {
|
|
48
|
+
...nextConfig.experimental?.turbo?.resolveAlias,
|
|
49
|
+
'@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
rules: {
|
|
53
|
+
'*.node': {
|
|
54
|
+
as: '*.node',
|
|
55
|
+
loaders: ['node-loader'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
|
|
40
61
|
webpack: (
|
|
41
62
|
config: WebpackParams['0'],
|
|
42
63
|
{ isServer, nextRuntime }: WebpackParams[1]
|
|
43
64
|
) => {
|
|
44
|
-
const dictionariesPath = join(mainDir, 'dictionaries.cjs');
|
|
45
|
-
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
46
|
-
|
|
47
65
|
config.resolve.alias['@intlayer/dictionaries-entry'] = resolve(
|
|
48
66
|
relativeDictionariesPath
|
|
49
67
|
);
|
|
@@ -65,5 +83,5 @@ export const withIntlayer =
|
|
|
65
83
|
|
|
66
84
|
return config;
|
|
67
85
|
},
|
|
68
|
-
});
|
|
86
|
+
} satisfies Partial<NextConfig>);
|
|
69
87
|
};
|