next-intlayer 6.1.6 → 7.0.0-canary.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.
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/client/IntlayerClientProvider.cjs +19 -33
- package/dist/cjs/client/IntlayerClientProvider.cjs.map +1 -1
- package/dist/cjs/client/format/index.cjs +50 -41
- package/dist/cjs/client/index.cjs +7 -35
- package/dist/cjs/client/useLocale.cjs +39 -54
- package/dist/cjs/client/useLocale.cjs.map +1 -1
- package/dist/cjs/client/useLocalePageRouter.cjs +26 -52
- package/dist/cjs/client/useLocalePageRouter.cjs.map +1 -1
- package/dist/cjs/generateStaticParams.cjs +9 -39
- package/dist/cjs/generateStaticParams.cjs.map +1 -1
- package/dist/cjs/index.cjs +102 -57
- package/dist/cjs/middleware/index.cjs +7 -27
- package/dist/cjs/middleware/intlayerMiddleware.cjs +206 -188
- package/dist/cjs/middleware/intlayerMiddleware.cjs.map +1 -1
- package/dist/cjs/middleware/localeDetector.cjs +18 -32
- package/dist/cjs/middleware/localeDetector.cjs.map +1 -1
- package/dist/cjs/middleware/multipleMiddlewares.cjs +55 -67
- package/dist/cjs/middleware/multipleMiddlewares.cjs.map +1 -1
- package/dist/cjs/proxy/index.cjs +9 -0
- package/dist/cjs/proxy/intlayerProxy.cjs +252 -0
- package/dist/cjs/proxy/intlayerProxy.cjs.map +1 -0
- package/dist/cjs/proxy/localeDetector.cjs +21 -0
- package/dist/cjs/proxy/localeDetector.cjs.map +1 -0
- package/dist/cjs/proxy/multipleProxies.cjs +60 -0
- package/dist/cjs/proxy/multipleProxies.cjs.map +1 -0
- package/dist/cjs/proxy/multipleProxy.cjs +60 -0
- package/dist/cjs/proxy/multipleProxy.cjs.map +1 -0
- package/dist/cjs/server/compareVersion.cjs +35 -54
- package/dist/cjs/server/compareVersion.cjs.map +1 -1
- package/dist/cjs/server/format/index.cjs +50 -41
- package/dist/cjs/server/getLocale.cjs +31 -53
- package/dist/cjs/server/getLocale.cjs.map +1 -1
- package/dist/cjs/server/index.cjs +69 -53
- package/dist/cjs/server/withIntlayer.cjs +181 -247
- package/dist/cjs/server/withIntlayer.cjs.map +1 -1
- package/dist/cjs/types/NextPage.cjs +0 -17
- package/dist/cjs/types/index.cjs +0 -17
- package/dist/esm/client/IntlayerClientProvider.mjs +15 -8
- package/dist/esm/client/IntlayerClientProvider.mjs.map +1 -1
- package/dist/esm/client/format/index.mjs +3 -21
- package/dist/esm/client/index.mjs +3 -9
- package/dist/esm/client/useLocale.mjs +31 -27
- package/dist/esm/client/useLocale.mjs.map +1 -1
- package/dist/esm/client/useLocalePageRouter.mjs +19 -26
- package/dist/esm/client/useLocalePageRouter.mjs.map +1 -1
- package/dist/esm/generateStaticParams.mjs +5 -3
- package/dist/esm/generateStaticParams.mjs.map +1 -1
- package/dist/esm/index.mjs +6 -34
- package/dist/esm/middleware/index.mjs +5 -4
- package/dist/esm/middleware/intlayerMiddleware.mjs +201 -155
- package/dist/esm/middleware/intlayerMiddleware.mjs.map +1 -1
- package/dist/esm/middleware/localeDetector.mjs +16 -8
- package/dist/esm/middleware/localeDetector.mjs.map +1 -1
- package/dist/esm/middleware/multipleMiddlewares.mjs +53 -45
- package/dist/esm/middleware/multipleMiddlewares.mjs.map +1 -1
- package/dist/esm/proxy/index.mjs +5 -0
- package/dist/esm/proxy/intlayerProxy.mjs +247 -0
- package/dist/esm/proxy/intlayerProxy.mjs.map +1 -0
- package/dist/esm/proxy/localeDetector.mjs +19 -0
- package/dist/esm/proxy/localeDetector.mjs.map +1 -0
- package/dist/esm/proxy/multipleProxies.mjs +57 -0
- package/dist/esm/proxy/multipleProxies.mjs.map +1 -0
- package/dist/esm/proxy/multipleProxy.mjs +57 -0
- package/dist/esm/proxy/multipleProxy.mjs.map +1 -0
- package/dist/esm/server/compareVersion.mjs +34 -30
- package/dist/esm/server/compareVersion.mjs.map +1 -1
- package/dist/esm/server/format/index.mjs +3 -21
- package/dist/esm/server/getLocale.mjs +23 -17
- package/dist/esm/server/getLocale.mjs.map +1 -1
- package/dist/esm/server/index.mjs +4 -28
- package/dist/esm/server/withIntlayer.mjs +166 -214
- package/dist/esm/server/withIntlayer.mjs.map +1 -1
- package/dist/esm/types/NextPage.mjs +0 -1
- package/dist/esm/types/index.mjs +0 -1
- package/dist/types/client/IntlayerClientProvider.d.ts +8 -4
- package/dist/types/client/IntlayerClientProvider.d.ts.map +1 -1
- package/dist/types/client/format/index.d.ts +2 -2
- package/dist/types/client/index.d.ts +4 -4
- package/dist/types/client/useLocale.d.ts +17 -7
- package/dist/types/client/useLocale.d.ts.map +1 -1
- package/dist/types/client/useLocalePageRouter.d.ts +12 -7
- package/dist/types/client/useLocalePageRouter.d.ts.map +1 -1
- package/dist/types/generateStaticParams.d.ts +7 -2
- package/dist/types/generateStaticParams.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -5
- package/dist/types/middleware/index.d.ts +4 -4
- package/dist/types/middleware/intlayerMiddleware.d.ts +7 -2
- package/dist/types/middleware/intlayerMiddleware.d.ts.map +1 -1
- package/dist/types/middleware/localeDetector.d.ts +8 -3
- package/dist/types/middleware/localeDetector.d.ts.map +1 -1
- package/dist/types/middleware/multipleMiddlewares.d.ts +7 -2
- package/dist/types/middleware/multipleMiddlewares.d.ts.map +1 -1
- package/dist/types/proxy/index.d.ts +4 -0
- package/dist/types/proxy/intlayerProxy.d.ts +55 -0
- package/dist/types/proxy/intlayerProxy.d.ts.map +1 -0
- package/dist/types/proxy/localeDetector.d.ts +14 -0
- package/dist/types/proxy/localeDetector.d.ts.map +1 -0
- package/dist/types/proxy/multipleProxies.d.ts +34 -0
- package/dist/types/proxy/multipleProxies.d.ts.map +1 -0
- package/dist/types/proxy/multipleProxy.d.ts +34 -0
- package/dist/types/proxy/multipleProxy.d.ts.map +1 -0
- package/dist/types/server/compareVersion.d.ts +4 -1
- package/dist/types/server/compareVersion.d.ts.map +1 -1
- package/dist/types/server/format/index.d.ts +2 -2
- package/dist/types/server/getLocale.d.ts +6 -2
- package/dist/types/server/getLocale.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +4 -4
- package/dist/types/server/withIntlayer.d.ts +25 -3
- package/dist/types/server/withIntlayer.d.ts.map +1 -1
- package/dist/types/types/NextPage.d.ts +21 -17
- package/dist/types/types/NextPage.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -2
- package/package.json +48 -50
- package/LICENSE +0 -202
- package/dist/cjs/client/format/index.cjs.map +0 -1
- package/dist/cjs/client/index.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/middleware/index.cjs.map +0 -1
- package/dist/cjs/server/format/index.cjs.map +0 -1
- package/dist/cjs/server/getNextVertion.cjs +0 -39
- package/dist/cjs/server/getNextVertion.cjs.map +0 -1
- package/dist/cjs/server/index.cjs.map +0 -1
- package/dist/cjs/types/NextPage.cjs.map +0 -1
- package/dist/cjs/types/index.cjs.map +0 -1
- package/dist/esm/client/format/index.mjs.map +0 -1
- package/dist/esm/client/index.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/middleware/index.mjs.map +0 -1
- package/dist/esm/server/format/index.mjs.map +0 -1
- package/dist/esm/server/getNextVertion.mjs +0 -15
- package/dist/esm/server/getNextVertion.mjs.map +0 -1
- package/dist/esm/server/index.mjs.map +0 -1
- package/dist/esm/types/NextPage.mjs.map +0 -1
- package/dist/esm/types/index.mjs.map +0 -1
- package/dist/types/client/format/index.d.ts.map +0 -1
- package/dist/types/client/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/middleware/index.d.ts.map +0 -1
- package/dist/types/server/format/index.d.ts.map +0 -1
- package/dist/types/server/getNextVertion.d.ts +0 -2
- package/dist/types/server/getNextVertion.d.ts.map +0 -1
- package/dist/types/server/index.d.ts.map +0 -1
- package/dist/types/types/index.d.ts.map +0 -1
|
@@ -1,255 +1,189 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_server_compareVersion = require('./compareVersion.cjs');
|
|
3
|
+
let __intlayer_config = require("@intlayer/config");
|
|
4
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
7
|
+
let __intlayer_chokidar = require("@intlayer/chokidar");
|
|
8
|
+
__intlayer_chokidar = require_rolldown_runtime.__toESM(__intlayer_chokidar);
|
|
9
|
+
let __intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
|
|
10
|
+
__intlayer_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_dictionaries_entry);
|
|
11
|
+
let __intlayer_webpack = require("@intlayer/webpack");
|
|
12
|
+
__intlayer_webpack = require_rolldown_runtime.__toESM(__intlayer_webpack);
|
|
13
|
+
let deepmerge = require("deepmerge");
|
|
14
|
+
deepmerge = require_rolldown_runtime.__toESM(deepmerge);
|
|
15
|
+
let fast_glob = require("fast-glob");
|
|
16
|
+
fast_glob = require_rolldown_runtime.__toESM(fast_glob);
|
|
17
|
+
let next_package_json = require("next/package.json");
|
|
18
|
+
next_package_json = require_rolldown_runtime.__toESM(next_package_json);
|
|
19
|
+
|
|
20
|
+
//#region src/server/withIntlayer.ts
|
|
21
|
+
const isGteNext13 = require_server_compareVersion.compareVersions(next_package_json.default.version, "≥", "13.0.0");
|
|
22
|
+
const isGteNext15 = require_server_compareVersion.compareVersions(next_package_json.default.version, "≥", "15.0.0");
|
|
23
|
+
const isGteNext16 = require_server_compareVersion.compareVersions(next_package_json.default.version, "≥", "16.0.0");
|
|
24
|
+
const isTurbopackEnabled = !isGteNext16 && process.env.npm_lifecycle_script?.includes("--turbo") || isGteNext16 && !process.env.npm_lifecycle_script?.includes("--webpack");
|
|
25
|
+
const isTurbopackStable = require_server_compareVersion.compareVersions(next_package_json.default.version, "≥", "15.3.0");
|
|
26
|
+
const getIsSwcPluginAvailable = (intlayerConfig) => {
|
|
27
|
+
try {
|
|
28
|
+
intlayerConfig.build.require.resolve("@intlayer/swc");
|
|
29
|
+
return true;
|
|
30
|
+
} catch (_e) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
11
33
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var withIntlayer_exports = {};
|
|
30
|
-
__export(withIntlayer_exports, {
|
|
31
|
-
withIntlayer: () => withIntlayer
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(withIntlayer_exports);
|
|
34
|
-
var import_chokidar = require("@intlayer/chokidar");
|
|
35
|
-
var import_config = require("@intlayer/config");
|
|
36
|
-
var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"));
|
|
37
|
-
var import_webpack = require("@intlayer/webpack");
|
|
38
|
-
var import_deepmerge = __toESM(require("deepmerge"));
|
|
39
|
-
var import_fast_glob = __toESM(require("fast-glob"));
|
|
40
|
-
var import_path = require("path");
|
|
41
|
-
var import_compareVersion = require('./compareVersion.cjs');
|
|
42
|
-
var import_getNextVertion = require('./getNextVertion.cjs');
|
|
43
|
-
const isTurbopackEnabled = process.env.npm_lifecycle_script?.includes("--turbo");
|
|
44
|
-
const nextVersion = (0, import_getNextVertion.getNextVersion)();
|
|
45
|
-
const isGteNext13 = (0, import_compareVersion.compareVersions)(nextVersion, "\u2265", "13.0.0");
|
|
46
|
-
const isGteNext15 = (0, import_compareVersion.compareVersions)(nextVersion, "\u2265", "15.0.0");
|
|
47
|
-
const isTurbopackStable = (0, import_compareVersion.compareVersions)(nextVersion, "\u2265", "15.3.0");
|
|
48
|
-
const getIsSwcPluginAvailable = () => {
|
|
49
|
-
try {
|
|
50
|
-
import_config.ESMxCJSRequire.resolve("@intlayer/swc");
|
|
51
|
-
return true;
|
|
52
|
-
} catch (e) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const resolvePluginPath = (pluginPath) => {
|
|
57
|
-
const pluginPathResolved = import_config.ESMxCJSRequire.resolve(pluginPath);
|
|
58
|
-
if (isTurbopackEnabled)
|
|
59
|
-
return (0, import_config.normalizePath)(`./${(0, import_path.relative)(process.cwd(), pluginPathResolved)}`);
|
|
60
|
-
return pluginPathResolved;
|
|
34
|
+
const resolvePluginPath = (pluginPath, intlayerConfig) => {
|
|
35
|
+
const pluginPathResolved = intlayerConfig.build.require.resolve(pluginPath);
|
|
36
|
+
if (isTurbopackEnabled) return (0, __intlayer_config.normalizePath)(`./${(0, node_path.relative)(process.cwd(), pluginPathResolved)}`);
|
|
37
|
+
return pluginPathResolved;
|
|
61
38
|
};
|
|
62
39
|
const getPruneConfig = (intlayerConfig) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const fetchDictionariesEntryPath = (0, import_path.join)(mainDir, "fetch_dictionaries.mjs");
|
|
89
|
-
const filesListPattern = import_fast_glob.default.sync(traversePattern, {
|
|
90
|
-
cwd: baseDir
|
|
91
|
-
}).map((file) => (0, import_path.join)(baseDir, file));
|
|
92
|
-
const filesList = [
|
|
93
|
-
...filesListPattern,
|
|
94
|
-
dictionariesEntryPath
|
|
95
|
-
// should add dictionariesEntryPath to replace it by a empty object if import made dynamic
|
|
96
|
-
];
|
|
97
|
-
const liveSyncKeys = Object.values(import_dictionaries_entry.default).filter((dictionary) => dictionary.live).map((dictionary) => dictionary.key);
|
|
98
|
-
return {
|
|
99
|
-
experimental: {
|
|
100
|
-
swcPlugins: [
|
|
101
|
-
[
|
|
102
|
-
resolvePluginPath("@intlayer/swc"),
|
|
103
|
-
{
|
|
104
|
-
dictionariesDir,
|
|
105
|
-
dictionariesEntryPath,
|
|
106
|
-
dynamicDictionariesDir,
|
|
107
|
-
dynamicDictionariesEntryPath,
|
|
108
|
-
fetchDictionariesDir,
|
|
109
|
-
fetchDictionariesEntryPath,
|
|
110
|
-
importMode,
|
|
111
|
-
filesList,
|
|
112
|
-
replaceDictionaryEntry: false,
|
|
113
|
-
liveSyncKeys
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
};
|
|
40
|
+
const { optimize, traversePattern, importMode } = intlayerConfig.build;
|
|
41
|
+
const { dictionariesDir, dynamicDictionariesDir, fetchDictionariesDir, mainDir, baseDir } = intlayerConfig.content;
|
|
42
|
+
if (!optimize) return {};
|
|
43
|
+
if (!isGteNext13) return {};
|
|
44
|
+
if (!getIsSwcPluginAvailable(intlayerConfig)) return {};
|
|
45
|
+
const logger = (0, __intlayer_config.getAppLogger)(intlayerConfig);
|
|
46
|
+
(0, __intlayer_chokidar.runOnce)((0, node_path.join)(baseDir, ".intlayer", "cache", "intlayer-prune-plugin-enabled.lock"), () => logger("Intlayer prune plugin is enabled"), { cacheTimeoutMs: 1e3 * 10 });
|
|
47
|
+
const dictionariesEntryPath = (0, node_path.join)(mainDir, "dictionaries.mjs");
|
|
48
|
+
const dynamicDictionariesEntryPath = (0, node_path.join)(mainDir, "dynamic_dictionaries.mjs");
|
|
49
|
+
const fetchDictionariesEntryPath = (0, node_path.join)(mainDir, "fetch_dictionaries.mjs");
|
|
50
|
+
const filesList = [...fast_glob.default.sync(traversePattern, { cwd: baseDir }).map((file) => (0, node_path.join)(baseDir, file)), dictionariesEntryPath];
|
|
51
|
+
const dictionaries = (0, __intlayer_dictionaries_entry.getDictionaries)(intlayerConfig);
|
|
52
|
+
const liveSyncKeys = Object.values(dictionaries).filter((dictionary) => dictionary.live).map((dictionary) => dictionary.key);
|
|
53
|
+
return { experimental: { swcPlugins: [[resolvePluginPath("@intlayer/swc", intlayerConfig), {
|
|
54
|
+
dictionariesDir,
|
|
55
|
+
dictionariesEntryPath,
|
|
56
|
+
dynamicDictionariesDir,
|
|
57
|
+
dynamicDictionariesEntryPath,
|
|
58
|
+
fetchDictionariesDir,
|
|
59
|
+
fetchDictionariesEntryPath,
|
|
60
|
+
importMode,
|
|
61
|
+
filesList,
|
|
62
|
+
replaceDictionaryEntry: false,
|
|
63
|
+
liveSyncKeys
|
|
64
|
+
}]] } };
|
|
119
65
|
};
|
|
120
66
|
const getCommandsEvent = () => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
67
|
+
const lifecycleEvent = process.env.npm_lifecycle_event;
|
|
68
|
+
const lifecycleScript = process.env.npm_lifecycle_script ?? "";
|
|
69
|
+
return {
|
|
70
|
+
isDevCommand: lifecycleEvent === "dev" || process.argv.some((arg) => arg === "dev") || /(^|\s)(next\s+)?dev(\s|$)/.test(lifecycleScript),
|
|
71
|
+
isBuildCommand: lifecycleEvent === "build" || process.argv.some((arg) => arg === "build") || /(^|\s)(next\s+)?build(\s|$)/.test(lifecycleScript),
|
|
72
|
+
isStartCommand: lifecycleEvent === "start" || process.argv.some((arg) => arg === "start") || /(^|\s)(next\s+)?start(\s|$)/.test(lifecycleScript)
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* A Next.js plugin that adds the intlayer configuration to the webpack configuration
|
|
77
|
+
* and sets the environment variables
|
|
78
|
+
*
|
|
79
|
+
* Usage:
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* // next.config.js
|
|
83
|
+
* export default withIntlayerSync(nextConfig)
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
const withIntlayerSync = (nextConfig = {}, configOptions) => {
|
|
87
|
+
if (typeof nextConfig !== "object") nextConfig = {};
|
|
88
|
+
const intlayerConfig = (0, __intlayer_config.getConfiguration)(configOptions);
|
|
89
|
+
const { isBuildCommand, isDevCommand } = getCommandsEvent();
|
|
90
|
+
const turboConfig = {
|
|
91
|
+
resolveAlias: (0, __intlayer_config.getAlias)({
|
|
92
|
+
configuration: intlayerConfig,
|
|
93
|
+
formatter: (value) => `./${value}`
|
|
94
|
+
}),
|
|
95
|
+
rules: { "*.node": {
|
|
96
|
+
as: "*.node",
|
|
97
|
+
loaders: ["node-loader"]
|
|
98
|
+
} }
|
|
99
|
+
};
|
|
100
|
+
const serverExternalPackages = [
|
|
101
|
+
"esbuild",
|
|
102
|
+
"module",
|
|
103
|
+
"fs",
|
|
104
|
+
"chokidar",
|
|
105
|
+
"fsevents"
|
|
106
|
+
];
|
|
107
|
+
const getNewConfig = () => {
|
|
108
|
+
let config = {};
|
|
109
|
+
if (isGteNext15) config = {
|
|
110
|
+
...config,
|
|
111
|
+
serverExternalPackages
|
|
112
|
+
};
|
|
113
|
+
if (isGteNext13 && !isGteNext15) config = {
|
|
114
|
+
...config,
|
|
115
|
+
experimental: {
|
|
116
|
+
...config?.experimental ?? {},
|
|
117
|
+
serverComponentsExternalPackages: serverExternalPackages
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
if (isTurbopackEnabled) if (isGteNext15 && isTurbopackStable) config = {
|
|
121
|
+
...config,
|
|
122
|
+
turbopack: turboConfig
|
|
123
|
+
};
|
|
124
|
+
else config = {
|
|
125
|
+
...config,
|
|
126
|
+
experimental: {
|
|
127
|
+
...config?.experimental ?? {},
|
|
128
|
+
turbo: turboConfig
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
else config = {
|
|
132
|
+
...config,
|
|
133
|
+
webpack: (config$1, options) => {
|
|
134
|
+
const { isServer, nextRuntime } = options;
|
|
135
|
+
if (typeof nextConfig.webpack === "function") config$1 = nextConfig.webpack(config$1, options);
|
|
136
|
+
config$1.externals.push({
|
|
137
|
+
esbuild: "esbuild",
|
|
138
|
+
module: "module",
|
|
139
|
+
fs: "fs",
|
|
140
|
+
chokidar: "chokidar",
|
|
141
|
+
fsevents: "fsevents"
|
|
142
|
+
});
|
|
143
|
+
config$1.module.rules.push({
|
|
144
|
+
test: /\.node$/,
|
|
145
|
+
loader: "node-loader"
|
|
146
|
+
});
|
|
147
|
+
config$1.resolve.alias = {
|
|
148
|
+
...config$1.resolve.alias,
|
|
149
|
+
...(0, __intlayer_config.getAlias)({
|
|
150
|
+
configuration: intlayerConfig,
|
|
151
|
+
formatter: (value) => (0, node_path.resolve)(value)
|
|
152
|
+
})
|
|
153
|
+
};
|
|
154
|
+
if (isDevCommand && isServer && nextRuntime === "nodejs") config$1.plugins.push(new __intlayer_webpack.IntlayerPlugin(intlayerConfig));
|
|
155
|
+
return config$1;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return config;
|
|
159
|
+
};
|
|
160
|
+
let pruneConfig = {};
|
|
161
|
+
if (isBuildCommand) pruneConfig = getPruneConfig(intlayerConfig);
|
|
162
|
+
const intlayerNextConfig = (0, deepmerge.default)(pruneConfig, getNewConfig());
|
|
163
|
+
return (0, deepmerge.default)(nextConfig, intlayerNextConfig);
|
|
131
164
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
const turboConfig = {
|
|
153
|
-
resolveAlias: (0, import_config.getAlias)({
|
|
154
|
-
configuration: intlayerConfig,
|
|
155
|
-
formatter: (value) => `./${value}`
|
|
156
|
-
// prefix by './' to consider the path as relative to the project root. This is necessary for turbopack to work correctly.
|
|
157
|
-
}),
|
|
158
|
-
rules: {
|
|
159
|
-
"*.node": {
|
|
160
|
-
as: "*.node",
|
|
161
|
-
loaders: ["node-loader"]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const serverExternalPackages = [
|
|
166
|
-
"esbuild",
|
|
167
|
-
"module",
|
|
168
|
-
"fs",
|
|
169
|
-
"chokidar",
|
|
170
|
-
"fsevents"
|
|
171
|
-
];
|
|
172
|
-
const getNewConfig = () => {
|
|
173
|
-
let config = {};
|
|
174
|
-
if (isGteNext15) {
|
|
175
|
-
config = {
|
|
176
|
-
...config,
|
|
177
|
-
serverExternalPackages
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
if (isGteNext13 && !isGteNext15) {
|
|
181
|
-
config = {
|
|
182
|
-
...config,
|
|
183
|
-
experimental: {
|
|
184
|
-
...config?.experimental ?? {},
|
|
185
|
-
serverComponentsExternalPackages: serverExternalPackages
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
if (isTurbopackEnabled) {
|
|
190
|
-
if (isGteNext15 && isTurbopackStable) {
|
|
191
|
-
config = {
|
|
192
|
-
...config,
|
|
193
|
-
turbopack: turboConfig
|
|
194
|
-
};
|
|
195
|
-
} else {
|
|
196
|
-
config = {
|
|
197
|
-
...config,
|
|
198
|
-
experimental: {
|
|
199
|
-
...config?.experimental ?? {},
|
|
200
|
-
turbo: turboConfig
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
config = {
|
|
206
|
-
...config,
|
|
207
|
-
webpack: (config2, options) => {
|
|
208
|
-
const { isServer, nextRuntime } = options;
|
|
209
|
-
if (typeof nextConfig.webpack === "function") {
|
|
210
|
-
config2 = nextConfig.webpack(config2, options);
|
|
211
|
-
}
|
|
212
|
-
config2.externals.push({
|
|
213
|
-
esbuild: "esbuild",
|
|
214
|
-
module: "module",
|
|
215
|
-
fs: "fs",
|
|
216
|
-
chokidar: "chokidar",
|
|
217
|
-
fsevents: "fsevents"
|
|
218
|
-
});
|
|
219
|
-
config2.module.rules.push({
|
|
220
|
-
test: /\.node$/,
|
|
221
|
-
loader: "node-loader"
|
|
222
|
-
});
|
|
223
|
-
config2.resolve.alias = {
|
|
224
|
-
...config2.resolve.alias,
|
|
225
|
-
...(0, import_config.getAlias)({
|
|
226
|
-
configuration: intlayerConfig,
|
|
227
|
-
formatter: (value) => (0, import_path.resolve)(value)
|
|
228
|
-
// get absolute path
|
|
229
|
-
})
|
|
230
|
-
};
|
|
231
|
-
if (isDevCommand && isServer && nextRuntime === "nodejs") {
|
|
232
|
-
config2.plugins.push(new import_webpack.IntlayerPlugin());
|
|
233
|
-
}
|
|
234
|
-
return config2;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
return config;
|
|
239
|
-
};
|
|
240
|
-
let pruneConfig = {};
|
|
241
|
-
if (isBuildCommand) {
|
|
242
|
-
pruneConfig = getPruneConfig(intlayerConfig);
|
|
243
|
-
}
|
|
244
|
-
const intlayerNextConfig = (0, import_deepmerge.default)(
|
|
245
|
-
pruneConfig,
|
|
246
|
-
getNewConfig()
|
|
247
|
-
);
|
|
248
|
-
const result = (0, import_deepmerge.default)(nextConfig, intlayerNextConfig);
|
|
249
|
-
return result;
|
|
165
|
+
/**
|
|
166
|
+
* A Next.js plugin that adds the intlayer configuration to the webpack configuration
|
|
167
|
+
* and sets the environment variables
|
|
168
|
+
*
|
|
169
|
+
* Usage:
|
|
170
|
+
*
|
|
171
|
+
* ```ts
|
|
172
|
+
* // next.config.js
|
|
173
|
+
* export default withIntlayer(nextConfig)
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* > Node withIntlayer is a promise function. Use withIntlayerSync instead if you want to use it synchronously.
|
|
177
|
+
* > Using the promise allows to prepare the intlayer dictionaries before the build starts.
|
|
178
|
+
*
|
|
179
|
+
*/
|
|
180
|
+
const withIntlayer = async (nextConfig = {}, configOptions) => {
|
|
181
|
+
const { isBuildCommand, isDevCommand } = getCommandsEvent();
|
|
182
|
+
if (isBuildCommand || isDevCommand) await (0, __intlayer_chokidar.prepareIntlayer)((0, __intlayer_config.getConfiguration)(configOptions));
|
|
183
|
+
return withIntlayerSync(nextConfig, configOptions);
|
|
250
184
|
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
185
|
+
|
|
186
|
+
//#endregion
|
|
187
|
+
exports.withIntlayer = withIntlayer;
|
|
188
|
+
exports.withIntlayerSync = withIntlayerSync;
|
|
255
189
|
//# sourceMappingURL=withIntlayer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { prepareIntlayer, runOnce } from '@intlayer/chokidar';\nimport {\n ESMxCJSRequire,\n getAlias,\n getAppLogger,\n getConfiguration,\n IntlayerConfig,\n normalizePath,\n} from '@intlayer/config';\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport merge from 'deepmerge';\nimport fg from 'fast-glob';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport { join, relative, resolve } from 'path';\nimport { compareVersions } from './compareVersion';\nimport { getNextVersion } from './getNextVertion';\n\n// Extract from the start script if --turbo or --turbopack flag is used\nconst isTurbopackEnabled =\n process.env.npm_lifecycle_script?.includes('--turbo');\nconst nextVersion = getNextVersion();\nconst isGteNext13 = compareVersions(nextVersion, '≥', '13.0.0');\nconst isGteNext15 = compareVersions(nextVersion, '≥', '15.0.0');\nconst isTurbopackStable = compareVersions(nextVersion, '≥', '15.3.0');\n\n// Check if SWC plugin is available\nconst getIsSwcPluginAvailable = () => {\n try {\n ESMxCJSRequire.resolve('@intlayer/swc');\n return true;\n } catch (e) {\n return false;\n }\n};\n\nconst resolvePluginPath = (pluginPath: string): string => {\n const pluginPathResolved = ESMxCJSRequire.resolve(pluginPath);\n\n if (isTurbopackEnabled)\n // Relative path for turbopack\n return normalizePath(`./${relative(process.cwd(), pluginPathResolved)}`);\n\n // Absolute path for webpack\n return pluginPathResolved;\n};\n\nconst getPruneConfig = (\n intlayerConfig: IntlayerConfig\n): Partial<NextConfig> => {\n const { optimize, traversePattern, importMode } = intlayerConfig.build;\n const {\n dictionariesDir,\n dynamicDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n baseDir,\n } = intlayerConfig.content;\n\n if (!optimize) return {};\n\n if (!isGteNext13) return {};\n\n const isSwcPluginAvailable = getIsSwcPluginAvailable();\n\n if (!isSwcPluginAvailable) return {};\n\n const logger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(baseDir, '.intlayer', 'cache', 'intlayer-prune-plugin-enabled.lock'),\n () => logger('Intlayer prune plugin is enabled'),\n undefined,\n 1000 * 10 // 10 seconds\n );\n\n const dictionariesEntryPath = join(mainDir, 'dictionaries.mjs');\n\n const dynamicDictionariesEntryPath = join(\n mainDir,\n 'dynamic_dictionaries.mjs'\n );\n\n const fetchDictionariesEntryPath = join(mainDir, 'fetch_dictionaries.mjs');\n\n const filesListPattern = fg\n .sync(traversePattern, {\n cwd: baseDir,\n })\n .map((file) => join(baseDir, file));\n\n const filesList = [\n ...filesListPattern,\n dictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n ];\n\n const liveSyncKeys = Object.values(dictionaries)\n .filter((dictionary) => dictionary.live)\n .map((dictionary) => dictionary.key);\n\n return {\n experimental: {\n swcPlugins: [\n [\n resolvePluginPath('@intlayer/swc'),\n {\n dictionariesDir,\n dictionariesEntryPath,\n dynamicDictionariesDir,\n dynamicDictionariesEntryPath,\n fetchDictionariesDir,\n fetchDictionariesEntryPath,\n importMode,\n filesList,\n replaceDictionaryEntry: false,\n liveSyncKeys,\n } as any,\n ],\n ],\n },\n };\n};\n\nconst getCommandsEvent = () => {\n const lifecycleEvent = process.env.npm_lifecycle_event;\n const lifecycleScript = process.env.npm_lifecycle_script ?? '';\n\n const isDevCommand =\n lifecycleEvent === 'dev' ||\n process.argv.some((arg) => arg === 'dev') ||\n /(^|\\s)(next\\s+)?dev(\\s|$)/.test(lifecycleScript);\n\n const isBuildCommand =\n lifecycleEvent === 'build' ||\n process.argv.some((arg) => arg === 'build') ||\n /(^|\\s)(next\\s+)?build(\\s|$)/.test(lifecycleScript);\n\n const isStartCommand =\n lifecycleEvent === 'start' ||\n process.argv.some((arg) => arg === 'start') ||\n /(^|\\s)(next\\s+)?start(\\s|$)/.test(lifecycleScript);\n\n return {\n isDevCommand,\n isBuildCommand,\n isStartCommand,\n };\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 variablesi\n *\n * Usage:\n *\n * ```ts\n * // next.config.js\n * export default withIntlayer(nextConfig)\n * ```\n */\nexport const withIntlayer = async <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T\n): Promise<NextConfig & T> => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const intlayerConfig = getConfiguration();\n const { isDevCommand, isBuildCommand } = getCommandsEvent();\n const appLogger = getAppLogger(intlayerConfig);\n\n const sentinelPath = join(\n intlayerConfig.content.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-prepared.lock'\n );\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n\n if (isBuildCommand || isDevCommand) {\n await runOnce(\n sentinelPath,\n async () => await prepareIntlayer(intlayerConfig),\n () => appLogger('Intlayer prepared')\n );\n }\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => `./${value}`, // prefix by './' to consider the path as relative to the project root. This is necessary for turbopack to work correctly.\n }),\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n };\n\n const serverExternalPackages = [\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n ];\n\n const getNewConfig = (): Partial<NextConfig> => {\n let config: Partial<NextConfig> = {};\n\n if (isGteNext15) {\n config = {\n ...config,\n serverExternalPackages,\n };\n }\n\n if (isGteNext13 && !isGteNext15) {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n serverComponentsExternalPackages: serverExternalPackages,\n },\n };\n }\n\n if (isTurbopackEnabled) {\n if (isGteNext15 && isTurbopackStable) {\n config = {\n ...config,\n turbopack: turboConfig,\n };\n } else {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n turbo: turboConfig,\n },\n };\n }\n } else {\n config = {\n ...config,\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\n // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n // If the user has defined their own webpack config, call it\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // Mark these modules as externals\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\n });\n\n // Use `node-loader` for any `.node` files\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Always alias on the server (node/edge) for stability.\n // On the client, alias only when not using live sync.\n config.resolve.alias = {\n ...config.resolve.alias,\n ...getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n };\n\n // Activate watch mode webpack plugin\n if (isDevCommand && isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntlayerPlugin());\n }\n\n return config;\n },\n };\n }\n\n return config;\n };\n\n let pruneConfig: Partial<NextConfig> = {};\n\n if (isBuildCommand) {\n pruneConfig = getPruneConfig(intlayerConfig);\n }\n\n const intlayerNextConfig: Partial<NextConfig> = merge(\n pruneConfig,\n getNewConfig()\n );\n\n // Merge the new config with the user's config\n const result = merge(nextConfig, intlayerNextConfig) as NextConfig & T;\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyC;AACzC,oBAOO;AACP,gCAAyB;AACzB,qBAA+B;AAC/B,uBAAkB;AAClB,uBAAe;AAGf,kBAAwC;AACxC,4BAAgC;AAChC,4BAA+B;AAG/B,MAAM,qBACJ,QAAQ,IAAI,sBAAsB,SAAS,SAAS;AACtD,MAAM,kBAAc,sCAAe;AACnC,MAAM,kBAAc,uCAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,kBAAc,uCAAgB,aAAa,UAAK,QAAQ;AAC9D,MAAM,wBAAoB,uCAAgB,aAAa,UAAK,QAAQ;AAGpE,MAAM,0BAA0B,MAAM;AACpC,MAAI;AACF,iCAAe,QAAQ,eAAe;AACtC,WAAO;AAAA,EACT,SAAS,GAAG;AACV,WAAO;AAAA,EACT;AACF;AAEA,MAAM,oBAAoB,CAAC,eAA+B;AACxD,QAAM,qBAAqB,6BAAe,QAAQ,UAAU;A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ACf,WAAW,CAAC,cAAkB,qBAAQ,KAAK;AAAA;AAAA,YAC7C,CAAC;AAAA,UACH;AAGA,cAAI,gBAAgB,YAAY,gBAAgB,UAAU;AACxD,YAAAA,QAAO,QAAQ,KAAK,IAAI,8BAAe,CAAC;AAAA,UAC1C;AAEA,iBAAOA;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,cAAmC,CAAC;AAExC,MAAI,gBAAgB;AAClB,kBAAc,eAAe,cAAc;AAAA,EAC7C;AAEA,QAAM,yBAA0C,iBAAAC;AAAA,IAC9C;AAAA,IACA,aAAa;AAAA,EACf;AAGA,QAAM,aAAS,iBAAAA,SAAM,YAAY,kBAAkB;AAEnD,SAAO;AACT;","names":["fg","dictionaries","config","merge"]}
|
|
1
|
+
{"version":3,"file":"withIntlayer.cjs","names":["compareVersions","nextPackageJSON","fg","config: Partial<NextConfig>","config","IntlayerPlugin","pruneConfig: Partial<NextConfig>","intlayerNextConfig: Partial<NextConfig>"],"sources":["../../../src/server/withIntlayer.ts"],"sourcesContent":["import { join, relative, resolve } from 'node:path';\nimport { prepareIntlayer, runOnce } from '@intlayer/chokidar';\nimport {\n type GetConfigurationOptions,\n getAlias,\n getAppLogger,\n getConfiguration,\n normalizePath,\n} from '@intlayer/config';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport merge from 'deepmerge';\nimport fg from 'fast-glob';\nimport type { NextConfig } from 'next';\nimport type { NextJsWebpackConfig } from 'next/dist/server/config-shared';\nimport nextPackageJSON from 'next/package.json' with { type: 'json' };\nimport { compareVersions } from './compareVersion';\n\n// Extract from the start script if --turbo or --turbopack flag is used\nconst isGteNext13 = compareVersions(nextPackageJSON.version, '≥', '13.0.0');\nconst isGteNext15 = compareVersions(nextPackageJSON.version, '≥', '15.0.0');\nconst isGteNext16 = compareVersions(nextPackageJSON.version, '≥', '16.0.0');\nconst isTurbopackEnabled =\n (!isGteNext16 && process.env.npm_lifecycle_script?.includes('--turbo')) ||\n (isGteNext16 && !process.env.npm_lifecycle_script?.includes('--webpack'));\n\nconst isTurbopackStable = compareVersions(\n nextPackageJSON.version,\n '≥',\n '15.3.0'\n);\n\n// Check if SWC plugin is available\nconst getIsSwcPluginAvailable = (intlayerConfig: IntlayerConfig) => {\n try {\n intlayerConfig.build.require.resolve('@intlayer/swc');\n return true;\n } catch (_e) {\n return false;\n }\n};\n\nconst resolvePluginPath = (\n pluginPath: string,\n intlayerConfig: IntlayerConfig\n): string => {\n const pluginPathResolved = intlayerConfig.build.require.resolve(pluginPath);\n\n if (isTurbopackEnabled)\n // Relative path for turbopack\n return normalizePath(`./${relative(process.cwd(), pluginPathResolved)}`);\n\n // Absolute path for webpack\n return pluginPathResolved;\n};\n\nconst getPruneConfig = (\n intlayerConfig: IntlayerConfig\n): Partial<NextConfig> => {\n const { optimize, traversePattern, importMode } = intlayerConfig.build;\n const {\n dictionariesDir,\n dynamicDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n baseDir,\n } = intlayerConfig.content;\n\n if (!optimize) return {};\n\n if (!isGteNext13) return {};\n\n const isSwcPluginAvailable = getIsSwcPluginAvailable(intlayerConfig);\n\n if (!isSwcPluginAvailable) return {};\n\n const logger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(baseDir, '.intlayer', 'cache', 'intlayer-prune-plugin-enabled.lock'),\n () => logger('Intlayer prune plugin is enabled'),\n {\n cacheTimeoutMs: 1000 * 10, // 10 seconds\n }\n );\n\n const dictionariesEntryPath = join(mainDir, 'dictionaries.mjs');\n\n const dynamicDictionariesEntryPath = join(\n mainDir,\n 'dynamic_dictionaries.mjs'\n );\n\n const fetchDictionariesEntryPath = join(mainDir, 'fetch_dictionaries.mjs');\n\n const filesListPattern = fg\n .sync(traversePattern, {\n cwd: baseDir,\n })\n .map((file) => join(baseDir, file));\n\n const filesList = [\n ...filesListPattern,\n dictionariesEntryPath, // should add dictionariesEntryPath to replace it by a empty object if import made dynamic\n ];\n\n const dictionaries = getDictionaries(intlayerConfig);\n\n const liveSyncKeys = Object.values(dictionaries)\n .filter((dictionary) => dictionary.live)\n .map((dictionary) => dictionary.key);\n\n return {\n experimental: {\n swcPlugins: [\n [\n resolvePluginPath('@intlayer/swc', intlayerConfig),\n {\n dictionariesDir,\n dictionariesEntryPath,\n dynamicDictionariesDir,\n dynamicDictionariesEntryPath,\n fetchDictionariesDir,\n fetchDictionariesEntryPath,\n importMode,\n filesList,\n replaceDictionaryEntry: false,\n liveSyncKeys,\n } as any,\n ],\n ],\n },\n };\n};\n\nconst getCommandsEvent = () => {\n const lifecycleEvent = process.env.npm_lifecycle_event;\n const lifecycleScript = process.env.npm_lifecycle_script ?? '';\n\n const isDevCommand =\n lifecycleEvent === 'dev' ||\n process.argv.some((arg) => arg === 'dev') ||\n /(^|\\s)(next\\s+)?dev(\\s|$)/.test(lifecycleScript);\n\n const isBuildCommand =\n lifecycleEvent === 'build' ||\n process.argv.some((arg) => arg === 'build') ||\n /(^|\\s)(next\\s+)?build(\\s|$)/.test(lifecycleScript);\n\n const isStartCommand =\n lifecycleEvent === 'start' ||\n process.argv.some((arg) => arg === 'start') ||\n /(^|\\s)(next\\s+)?start(\\s|$)/.test(lifecycleScript);\n\n return {\n isDevCommand,\n isBuildCommand,\n isStartCommand,\n };\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 withIntlayerSync(nextConfig)\n * ```\n */\nexport const withIntlayerSync = <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T,\n configOptions?: GetConfigurationOptions\n): NextConfig & T => {\n if (typeof nextConfig !== 'object') {\n nextConfig = {} as T;\n }\n\n const intlayerConfig = getConfiguration(configOptions);\n\n const { isBuildCommand, isDevCommand } = getCommandsEvent();\n\n // Only provide turbo-specific config if user explicitly sets it\n const turboConfig = {\n resolveAlias: getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => `./${value}`, // prefix by './' to consider the path as relative to the project root. This is necessary for turbopack to work correctly.\n }),\n\n rules: {\n '*.node': {\n as: '*.node',\n loaders: ['node-loader'],\n },\n },\n };\n\n const serverExternalPackages = [\n 'esbuild',\n 'module',\n 'fs',\n 'chokidar',\n 'fsevents',\n ];\n\n const getNewConfig = (): Partial<NextConfig> => {\n let config: Partial<NextConfig> = {};\n\n if (isGteNext15) {\n config = {\n ...config,\n serverExternalPackages,\n };\n }\n\n if (isGteNext13 && !isGteNext15) {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n serverComponentsExternalPackages: serverExternalPackages,\n },\n };\n }\n\n if (isTurbopackEnabled) {\n if (isGteNext15 && isTurbopackStable) {\n config = {\n ...config,\n turbopack: turboConfig,\n };\n } else {\n config = {\n ...config,\n experimental: {\n ...(config?.experimental ?? {}),\n // @ts-ignore exist in next@14\n turbo: turboConfig,\n },\n };\n }\n } else {\n config = {\n ...config,\n webpack: (config: WebpackParams['0'], options: WebpackParams[1]) => {\n // Only add Intlayer plugin on server side (node runtime)\n const { isServer, nextRuntime } = options;\n\n // If the user has defined their own webpack config, call it\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // Mark these modules as externals\n config.externals.push({\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n chokidar: 'chokidar',\n fsevents: 'fsevents',\n });\n\n // Use `node-loader` for any `.node` files\n config.module.rules.push({\n test: /\\.node$/,\n loader: 'node-loader',\n });\n\n // Always alias on the server (node/edge) for stability.\n // On the client, alias only when not using live sync.\n config.resolve.alias = {\n ...config.resolve.alias,\n ...getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => resolve(value), // get absolute path\n }),\n };\n\n // Activate watch mode webpack plugin\n if (isDevCommand && isServer && nextRuntime === 'nodejs') {\n config.plugins.push(new IntlayerPlugin(intlayerConfig));\n }\n\n return config;\n },\n };\n }\n\n return config;\n };\n\n let pruneConfig: Partial<NextConfig> = {};\n\n if (isBuildCommand) {\n pruneConfig = getPruneConfig(intlayerConfig);\n }\n\n const intlayerNextConfig: Partial<NextConfig> = merge(\n pruneConfig,\n getNewConfig()\n );\n\n // Merge the new config with the user's config\n const result = merge(nextConfig, intlayerNextConfig) as NextConfig & T;\n\n return result;\n};\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 * > Node withIntlayer is a promise function. Use withIntlayerSync instead if you want to use it synchronously.\n * > Using the promise allows to prepare the intlayer dictionaries before the build starts.\n *\n */\nexport const withIntlayer = async <T extends Partial<NextConfig>>(\n nextConfig: T = {} as T,\n configOptions?: GetConfigurationOptions\n): Promise<NextConfig & T> => {\n const { isBuildCommand, isDevCommand } = getCommandsEvent();\n\n // Only call prepareIntlayer during `dev` or `build` (not during `start`)\n if (isBuildCommand || isDevCommand) {\n const intlayerConfig = getConfiguration(configOptions);\n await prepareIntlayer(intlayerConfig);\n }\n\n return withIntlayerSync(nextConfig, configOptions);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,cAAcA,8CAAgBC,0BAAgB,SAAS,KAAK,SAAS;AAC3E,MAAM,cAAcD,8CAAgBC,0BAAgB,SAAS,KAAK,SAAS;AAC3E,MAAM,cAAcD,8CAAgBC,0BAAgB,SAAS,KAAK,SAAS;AAC3E,MAAM,qBACH,CAAC,eAAe,QAAQ,IAAI,sBAAsB,SAAS,UAAU,IACrE,eAAe,CAAC,QAAQ,IAAI,sBAAsB,SAAS,YAAY;AAE1E,MAAM,oBAAoBD,8CACxBC,0BAAgB,SAChB,KACA,SACD;AAGD,MAAM,2BAA2B,mBAAmC;AAClE,KAAI;AACF,iBAAe,MAAM,QAAQ,QAAQ,gBAAgB;AACrD,SAAO;UACA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U;KACX,CAAC;AAGF,aAAO,OAAO,MAAM,KAAK;KACvB,MAAM;KACN,QAAQ;KACT,CAAC;AAIF,aAAO,QAAQ,QAAQ;KACrB,GAAGA,SAAO,QAAQ;KAClB,mCAAY;MACV,eAAe;MACf,YAAY,iCAA0B,MAAM;MAC7C,CAAC;KACH;AAGD,QAAI,gBAAgB,YAAY,gBAAgB,SAC9C,UAAO,QAAQ,KAAK,IAAIC,kCAAe,eAAe,CAAC;AAGzD,WAAOD;;GAEV;AAGH,SAAO;;CAGT,IAAIE,cAAmC,EAAE;AAEzC,KAAI,eACF,eAAc,eAAe,eAAe;CAG9C,MAAMC,4CACJ,aACA,cAAc,CACf;AAKD,+BAFqB,YAAY,mBAAmB;;;;;;;;;;;;;;;;;AAoBtD,MAAa,eAAe,OAC1B,aAAgB,EAAE,EAClB,kBAC4B;CAC5B,MAAM,EAAE,gBAAgB,iBAAiB,kBAAkB;AAG3D,KAAI,kBAAkB,aAEpB,wFADwC,cAAc,CACjB;AAGvC,QAAO,iBAAiB,YAAY,cAAc"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var NextPage_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(NextPage_exports);
|
|
17
|
-
//# sourceMappingURL=NextPage.cjs.map
|
package/dist/cjs/types/index.cjs
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
17
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { useLocale as useLocale$1 } from "./useLocale.mjs";
|
|
3
5
|
import { IntlayerProvider } from "react-intlayer";
|
|
4
|
-
import {
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/client/IntlayerClientProvider.tsx
|
|
5
9
|
const IntlayerClientProvider = (props) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const { setLocale } = useLocale$1();
|
|
11
|
+
return /* @__PURE__ */ jsx(IntlayerProvider, {
|
|
12
|
+
setLocale,
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
11
15
|
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { IntlayerClientProvider };
|
|
12
19
|
//# sourceMappingURL=IntlayerClientProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\nimport { IntlayerProvider, type IntlayerProviderProps } from 'react-intlayer';\nimport { useLocale } from './useLocale';\n\nexport type IntlayerClientProviderProps = IntlayerProviderProps;\n\nexport const IntlayerClientProvider: FC<IntlayerProviderProps> = (props) => {\n const { setLocale } = useLocale();\n return <IntlayerProvider setLocale={setLocale} {...props} />;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntlayerClientProvider.mjs","names":["IntlayerClientProvider: FC<IntlayerProviderProps>","useLocale"],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\nimport { IntlayerProvider, type IntlayerProviderProps } from 'react-intlayer';\nimport { useLocale } from './useLocale';\n\nexport type IntlayerClientProviderProps = IntlayerProviderProps;\n\nexport const IntlayerClientProvider: FC<IntlayerProviderProps> = (props) => {\n const { setLocale } = useLocale();\n return <IntlayerProvider setLocale={setLocale} {...props} />;\n};\n"],"mappings":";;;;;;;;AAQA,MAAaA,0BAAqD,UAAU;CAC1E,MAAM,EAAE,cAAcC,aAAW;AACjC,QAAO,oBAAC;EAA4B;EAAW,GAAI;GAAS"}
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useDate,
|
|
5
|
-
useList,
|
|
6
|
-
useNumber,
|
|
7
|
-
usePercentage,
|
|
8
|
-
useRelativeTime,
|
|
9
|
-
useUnit
|
|
10
|
-
} from "react-intlayer/format";
|
|
11
|
-
export {
|
|
12
|
-
useCompact,
|
|
13
|
-
useCurrency,
|
|
14
|
-
useDate,
|
|
15
|
-
useList,
|
|
16
|
-
useNumber,
|
|
17
|
-
usePercentage,
|
|
18
|
-
useRelativeTime,
|
|
19
|
-
useUnit
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { useCompact, useCurrency, useDate, useList, useNumber, usePercentage, useRelativeTime, useUnit } from "react-intlayer/format";
|
|
2
|
+
|
|
3
|
+
export { useCompact, useCurrency, useDate, useList, useNumber, usePercentage, useRelativeTime, useUnit };
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IntlayerClientProvider
|
|
3
|
-
} from "./IntlayerClientProvider.mjs";
|
|
4
1
|
import { useLocale } from "./useLocale.mjs";
|
|
2
|
+
import { IntlayerClientProvider } from "./IntlayerClientProvider.mjs";
|
|
5
3
|
import { useLocalePageRouter } from "./useLocalePageRouter.mjs";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
useLocale,
|
|
9
|
-
useLocalePageRouter
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=index.mjs.map
|
|
4
|
+
|
|
5
|
+
export { IntlayerClientProvider, useLocale, useLocalePageRouter };
|