@korioinc/next-conf 1.0.3 → 1.0.6
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,8 +2,7 @@ import type { NextConfig } from 'next';
|
|
|
2
2
|
export interface WithConfigOptions {
|
|
3
3
|
configFileName?: string;
|
|
4
4
|
linguiConfigFileName?: string;
|
|
5
|
-
|
|
6
|
-
linguiLocalePath?: string;
|
|
5
|
+
linguiLoaderDir?: string;
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
9
8
|
* 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,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,UAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAmFxG"}
|
|
@@ -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', linguiLoaderDir = './lang', } = options;
|
|
22
22
|
return {
|
|
23
23
|
...nextConfig,
|
|
24
24
|
// Turbopack configuration for development
|
|
@@ -36,10 +36,10 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
36
36
|
'lingui.config': linguiConfigFileName.startsWith('.') || linguiConfigFileName.startsWith('/')
|
|
37
37
|
? linguiConfigFileName
|
|
38
38
|
: `./${linguiConfigFileName}`,
|
|
39
|
-
//
|
|
40
|
-
'lingui.
|
|
41
|
-
?
|
|
42
|
-
: `./${
|
|
39
|
+
// Expose consumer's Lingui loader entry to all imports
|
|
40
|
+
'lingui.loader': linguiLoaderDir.startsWith('.') || linguiLoaderDir.startsWith('/')
|
|
41
|
+
? `${linguiLoaderDir}/index.ts`
|
|
42
|
+
: `./${linguiLoaderDir}/index.ts`,
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
// Webpack configuration for production builds
|
|
@@ -52,7 +52,7 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
52
52
|
const cwd = options?.dir || process.cwd();
|
|
53
53
|
const userConfigPath = path.resolve(cwd, configFileName);
|
|
54
54
|
const userLinguiConfigPath = path.resolve(cwd, linguiConfigFileName);
|
|
55
|
-
const
|
|
55
|
+
const userLinguiLoaderPath = path.resolve(cwd, linguiLoaderDir, 'index.ts');
|
|
56
56
|
// Map package paths used by this package
|
|
57
57
|
const newConfigPaths = [
|
|
58
58
|
'@korioinc/next-conf/dist/core/config.default',
|
|
@@ -68,8 +68,10 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
68
68
|
// Also alias lingui.config -> user's lingui config file
|
|
69
69
|
if (config.resolve?.alias) {
|
|
70
70
|
config.resolve.alias['lingui.config'] = userLinguiConfigPath;
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
}
|
|
72
|
+
// Alias lingui.loader -> user's loader entry
|
|
73
|
+
if (config.resolve?.alias) {
|
|
74
|
+
config.resolve.alias['lingui.loader'] = userLinguiLoaderPath;
|
|
73
75
|
}
|
|
74
76
|
// Call the original webpack function if it exists
|
|
75
77
|
if (typeof nextConfig.webpack === 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@korioinc/next-conf",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Configuration management for Next.js applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@types/node": "^22.18.
|
|
38
|
+
"@types/node": "^22.18.3",
|
|
39
39
|
"typescript": "^5.9.2",
|
|
40
|
-
"vitest": "^2.
|
|
40
|
+
"vitest": "^2.1.9"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public",
|