@korioinc/next-conf 1.0.0 → 1.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-config.d.ts","sourceRoot":"","sources":["../../src/plugin/with-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AA2BvC,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"with-config.d.ts","sourceRoot":"","sources":["../../src/plugin/with-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AA2BvC,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,UAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAsFxG"}
|
|
@@ -18,7 +18,7 @@ import * as path from 'path';
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
21
|
-
const { configFileName = 'next-kit.config.ts' } = options;
|
|
21
|
+
const { configFileName = 'next-kit.config.ts', linguiConfigFileName = 'lingui.config.ts', linguiCatalogsPath = 'lang', } = options;
|
|
22
22
|
return {
|
|
23
23
|
...nextConfig,
|
|
24
24
|
// Turbopack configuration for development
|
|
@@ -31,6 +31,17 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
31
31
|
'@korioinc/next-conf/dist/core/config.default.js': configFileName.startsWith('.') || configFileName.startsWith('/') ? configFileName : `./${configFileName}`,
|
|
32
32
|
'@korioinc/next-conf/src/core/config.default.ts': configFileName.startsWith('.') || configFileName.startsWith('/') ? configFileName : `./${configFileName}`,
|
|
33
33
|
'@korioinc/next-conf/src/core/config.default': configFileName.startsWith('.') || configFileName.startsWith('/') ? configFileName : `./${configFileName}`,
|
|
34
|
+
// Expose consumer's lingui.config to all imports (including node_modules)
|
|
35
|
+
// Prefer a specifier (`./...`) that Turbopack can follow cleanly
|
|
36
|
+
'lingui.config': linguiConfigFileName.startsWith('.') || linguiConfigFileName.startsWith('/')
|
|
37
|
+
? linguiConfigFileName
|
|
38
|
+
: `./${linguiConfigFileName}`,
|
|
39
|
+
// Lingui catalogs alias
|
|
40
|
+
// Prefer existing alias; else use provided/default path (as a specifier)
|
|
41
|
+
'lingui.locale-path': nextConfig.turbopack?.resolveAlias?.['lingui.locale-path'] ??
|
|
42
|
+
(linguiCatalogsPath.startsWith('.') || linguiCatalogsPath.startsWith('/')
|
|
43
|
+
? linguiCatalogsPath
|
|
44
|
+
: `./${linguiCatalogsPath}`),
|
|
34
45
|
},
|
|
35
46
|
},
|
|
36
47
|
// Webpack configuration for production builds
|
|
@@ -42,6 +53,7 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
42
53
|
// This allows clean static imports without any @ts-ignore
|
|
43
54
|
const cwd = options?.dir || process.cwd();
|
|
44
55
|
const userConfigPath = path.resolve(cwd, configFileName);
|
|
56
|
+
const userLinguiConfigPath = path.resolve(cwd, linguiConfigFileName);
|
|
45
57
|
// Map package paths used by this package
|
|
46
58
|
const newConfigPaths = [
|
|
47
59
|
'@korioinc/next-conf/dist/core/config.default',
|
|
@@ -54,6 +66,16 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
54
66
|
config.resolve.alias[defaultPath] = userConfigPath;
|
|
55
67
|
}
|
|
56
68
|
});
|
|
69
|
+
// Also alias lingui.config -> user's lingui config file
|
|
70
|
+
if (config.resolve?.alias) {
|
|
71
|
+
config.resolve.alias['lingui.config'] = userLinguiConfigPath;
|
|
72
|
+
}
|
|
73
|
+
// Lingui catalogs alias for Webpack (prefer existing)
|
|
74
|
+
if (config.resolve?.alias) {
|
|
75
|
+
const existing = config.resolve.alias['lingui.locale-path'];
|
|
76
|
+
const desired = existing || path.resolve(cwd, linguiCatalogsPath);
|
|
77
|
+
config.resolve.alias['lingui.locale-path'] = desired;
|
|
78
|
+
}
|
|
57
79
|
// Call the original webpack function if it exists
|
|
58
80
|
if (typeof nextConfig.webpack === 'function') {
|
|
59
81
|
return nextConfig.webpack(config, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@korioinc/next-conf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Configuration management for Next.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,13 +26,6 @@
|
|
|
26
26
|
"README.md",
|
|
27
27
|
"LICENSE"
|
|
28
28
|
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "tsc -p tsconfig.json",
|
|
31
|
-
"dev": "tsc -p tsconfig.json -w",
|
|
32
|
-
"test": "vitest",
|
|
33
|
-
"lint": "eslint . --max-warnings 0",
|
|
34
|
-
"typecheck": "tsc --noEmit"
|
|
35
|
-
},
|
|
36
29
|
"peerDependencies": {
|
|
37
30
|
"next": ">=15"
|
|
38
31
|
},
|
|
@@ -56,5 +49,12 @@
|
|
|
56
49
|
"directory": "packages/conf"
|
|
57
50
|
},
|
|
58
51
|
"author": "Korio Inc.",
|
|
59
|
-
"license": "MIT"
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc -p tsconfig.json",
|
|
55
|
+
"dev": "tsc -p tsconfig.json -w",
|
|
56
|
+
"test": "vitest",
|
|
57
|
+
"lint": "eslint . --max-warnings 0",
|
|
58
|
+
"typecheck": "tsc --noEmit"
|
|
59
|
+
}
|
|
60
60
|
}
|