@korioinc/next-conf 1.0.2 → 1.0.3
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.
|
@@ -2,7 +2,8 @@ import type { NextConfig } from 'next';
|
|
|
2
2
|
export interface WithConfigOptions {
|
|
3
3
|
configFileName?: string;
|
|
4
4
|
linguiConfigFileName?: string;
|
|
5
|
-
|
|
5
|
+
/** Directory containing Lingui PO catalogs. Defaults to './lang'. */
|
|
6
|
+
linguiLocalePath?: string;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Next.js configuration plugin that injects webpack aliases
|
|
@@ -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;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,
|
|
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,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,UAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAgFxG"}
|
|
@@ -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', linguiConfigFileName = 'lingui.config.ts',
|
|
21
|
+
const { configFileName = 'next-kit.config.ts', linguiConfigFileName = 'lingui.config.ts', linguiLocalePath = './lang', } = options;
|
|
22
22
|
return {
|
|
23
23
|
...nextConfig,
|
|
24
24
|
// Turbopack configuration for development
|
|
@@ -36,12 +36,10 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
36
36
|
'lingui.config': linguiConfigFileName.startsWith('.') || linguiConfigFileName.startsWith('/')
|
|
37
37
|
? linguiConfigFileName
|
|
38
38
|
: `./${linguiConfigFileName}`,
|
|
39
|
-
// Lingui
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
? linguiCatalogsPath
|
|
44
|
-
: `./${linguiCatalogsPath}`),
|
|
39
|
+
// Stable alias for Lingui locales
|
|
40
|
+
'lingui.locales': linguiLocalePath.startsWith('.') || linguiLocalePath.startsWith('/')
|
|
41
|
+
? linguiLocalePath
|
|
42
|
+
: `./${linguiLocalePath}`,
|
|
45
43
|
},
|
|
46
44
|
},
|
|
47
45
|
// Webpack configuration for production builds
|
|
@@ -54,6 +52,7 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
54
52
|
const cwd = options?.dir || process.cwd();
|
|
55
53
|
const userConfigPath = path.resolve(cwd, configFileName);
|
|
56
54
|
const userLinguiConfigPath = path.resolve(cwd, linguiConfigFileName);
|
|
55
|
+
const userLinguiLocalesDirAbs = path.resolve(cwd, linguiLocalePath);
|
|
57
56
|
// Map package paths used by this package
|
|
58
57
|
const newConfigPaths = [
|
|
59
58
|
'@korioinc/next-conf/dist/core/config.default',
|
|
@@ -69,12 +68,8 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
69
68
|
// Also alias lingui.config -> user's lingui config file
|
|
70
69
|
if (config.resolve?.alias) {
|
|
71
70
|
config.resolve.alias['lingui.config'] = userLinguiConfigPath;
|
|
72
|
-
|
|
73
|
-
|
|
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;
|
|
71
|
+
// Expose Lingui locales alias
|
|
72
|
+
config.resolve.alias['lingui.locales'] = userLinguiLocalesDirAbs;
|
|
78
73
|
}
|
|
79
74
|
// Call the original webpack function if it exists
|
|
80
75
|
if (typeof nextConfig.webpack === 'function') {
|