@korioinc/next-conf 1.0.0 → 1.0.1
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,6 +1,11 @@
|
|
|
1
1
|
import type { NextConfig } from 'next';
|
|
2
2
|
export interface WithConfigOptions {
|
|
3
3
|
configFileName?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Path or filename for the consumer's Lingui config.
|
|
6
|
+
* Defaults to `lingui.config.ts` at the project root.
|
|
7
|
+
*/
|
|
8
|
+
linguiConfigFileName?: string;
|
|
4
9
|
}
|
|
5
10
|
/**
|
|
6
11
|
* 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;
|
|
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;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,UAAe,EAAE,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAoExG"}
|
|
@@ -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' } = options;
|
|
22
22
|
return {
|
|
23
23
|
...nextConfig,
|
|
24
24
|
// Turbopack configuration for development
|
|
@@ -31,6 +31,11 @@ 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}`,
|
|
34
39
|
},
|
|
35
40
|
},
|
|
36
41
|
// Webpack configuration for production builds
|
|
@@ -42,6 +47,7 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
42
47
|
// This allows clean static imports without any @ts-ignore
|
|
43
48
|
const cwd = options?.dir || process.cwd();
|
|
44
49
|
const userConfigPath = path.resolve(cwd, configFileName);
|
|
50
|
+
const userLinguiConfigPath = path.resolve(cwd, linguiConfigFileName);
|
|
45
51
|
// Map package paths used by this package
|
|
46
52
|
const newConfigPaths = [
|
|
47
53
|
'@korioinc/next-conf/dist/core/config.default',
|
|
@@ -54,6 +60,10 @@ export function withNextKitConf(nextConfig = {}, options = {}) {
|
|
|
54
60
|
config.resolve.alias[defaultPath] = userConfigPath;
|
|
55
61
|
}
|
|
56
62
|
});
|
|
63
|
+
// Also alias lingui.config -> user's lingui config file
|
|
64
|
+
if (config.resolve?.alias) {
|
|
65
|
+
config.resolve.alias['lingui.config'] = userLinguiConfigPath;
|
|
66
|
+
}
|
|
57
67
|
// Call the original webpack function if it exists
|
|
58
68
|
if (typeof nextConfig.webpack === 'function') {
|
|
59
69
|
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.1",
|
|
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
|
}
|