next-translate-plugin 2.6.2 → 3.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/lib/cjs/index.js +7 -7
- package/lib/esm/index.js +7 -7
- package/package.json +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -24,12 +24,6 @@ function nextTranslate(nextConfig) {
|
|
|
24
24
|
basePath = path_1.default.resolve(path_1.default.relative(basePath, process.env.NEXT_TRANSLATE_PATH || '.'));
|
|
25
25
|
var nextConfigI18n = nextConfig.i18n || {};
|
|
26
26
|
var _a = require(path_1.default.join(basePath, 'i18n')), _b = _a.locales, locales = _b === void 0 ? nextConfigI18n.locales || [] : _b, _c = _a.defaultLocale, defaultLocale = _c === void 0 ? nextConfigI18n.defaultLocale || 'en' : _c, _d = _a.domains, domains = _d === void 0 ? nextConfigI18n.domains : _d, _e = _a.localeDetection, localeDetection = _e === void 0 ? nextConfigI18n.localeDetection : _e, _f = _a.loader, loader = _f === void 0 ? true : _f, pagesInDir = _a.pagesInDir, _g = _a.extensionsRgx, extensionsRgx = _g === void 0 ? test : _g, _h = _a.revalidate, revalidate = _h === void 0 ? 0 : _h;
|
|
27
|
-
var nextConfigWithI18n = __assign(__assign({}, nextConfig), { i18n: {
|
|
28
|
-
locales: locales,
|
|
29
|
-
defaultLocale: defaultLocale,
|
|
30
|
-
domains: domains,
|
|
31
|
-
localeDetection: localeDetection,
|
|
32
|
-
} });
|
|
33
27
|
var pagesFolder = (0, utils_1.calculatePageDir)('pages', pagesInDir, basePath);
|
|
34
28
|
var appFolder = (0, utils_1.calculatePageDir)('app', pagesInDir, basePath);
|
|
35
29
|
var existLocalesFolder = (0, utils_1.existLocalesFolderWithNamespaces)(basePath);
|
|
@@ -37,7 +31,7 @@ function nextTranslate(nextConfig) {
|
|
|
37
31
|
var hasGetInitialPropsOnAppJs = false;
|
|
38
32
|
var hasAppJs = false;
|
|
39
33
|
if (!existPagesFolder && !(0, utils_1.existPages)(basePath, appFolder)) {
|
|
40
|
-
return
|
|
34
|
+
return nextConfig;
|
|
41
35
|
}
|
|
42
36
|
if (existPagesFolder) {
|
|
43
37
|
var pagesPath = path_1.default.join(basePath, pagesFolder);
|
|
@@ -54,6 +48,12 @@ function nextTranslate(nextConfig) {
|
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
50
|
}
|
|
51
|
+
var nextConfigWithI18n = hasAppJs ? nextConfig : __assign(__assign({}, nextConfig), { i18n: {
|
|
52
|
+
locales: locales,
|
|
53
|
+
defaultLocale: defaultLocale,
|
|
54
|
+
domains: domains,
|
|
55
|
+
localeDetection: localeDetection,
|
|
56
|
+
} });
|
|
57
57
|
return __assign(__assign({}, nextConfigWithI18n), { webpack: function (conf, options) {
|
|
58
58
|
var config = typeof nextConfig.webpack === 'function'
|
|
59
59
|
? nextConfig.webpack(conf, options)
|
package/lib/esm/index.js
CHANGED
|
@@ -19,12 +19,6 @@ function nextTranslate(nextConfig) {
|
|
|
19
19
|
basePath = path.resolve(path.relative(basePath, process.env.NEXT_TRANSLATE_PATH || '.'));
|
|
20
20
|
var nextConfigI18n = nextConfig.i18n || {};
|
|
21
21
|
var _a = require(path.join(basePath, 'i18n')), _b = _a.locales, locales = _b === void 0 ? nextConfigI18n.locales || [] : _b, _c = _a.defaultLocale, defaultLocale = _c === void 0 ? nextConfigI18n.defaultLocale || 'en' : _c, _d = _a.domains, domains = _d === void 0 ? nextConfigI18n.domains : _d, _e = _a.localeDetection, localeDetection = _e === void 0 ? nextConfigI18n.localeDetection : _e, _f = _a.loader, loader = _f === void 0 ? true : _f, pagesInDir = _a.pagesInDir, _g = _a.extensionsRgx, extensionsRgx = _g === void 0 ? test : _g, _h = _a.revalidate, revalidate = _h === void 0 ? 0 : _h;
|
|
22
|
-
var nextConfigWithI18n = __assign(__assign({}, nextConfig), { i18n: {
|
|
23
|
-
locales: locales,
|
|
24
|
-
defaultLocale: defaultLocale,
|
|
25
|
-
domains: domains,
|
|
26
|
-
localeDetection: localeDetection,
|
|
27
|
-
} });
|
|
28
22
|
var pagesFolder = calculatePageDir('pages', pagesInDir, basePath);
|
|
29
23
|
var appFolder = calculatePageDir('app', pagesInDir, basePath);
|
|
30
24
|
var existLocalesFolder = existLocalesFolderWithNamespaces(basePath);
|
|
@@ -32,7 +26,7 @@ function nextTranslate(nextConfig) {
|
|
|
32
26
|
var hasGetInitialPropsOnAppJs = false;
|
|
33
27
|
var hasAppJs = false;
|
|
34
28
|
if (!existPagesFolder && !existPages(basePath, appFolder)) {
|
|
35
|
-
return
|
|
29
|
+
return nextConfig;
|
|
36
30
|
}
|
|
37
31
|
if (existPagesFolder) {
|
|
38
32
|
var pagesPath = path.join(basePath, pagesFolder);
|
|
@@ -49,6 +43,12 @@ function nextTranslate(nextConfig) {
|
|
|
49
43
|
}
|
|
50
44
|
}
|
|
51
45
|
}
|
|
46
|
+
var nextConfigWithI18n = hasAppJs ? nextConfig : __assign(__assign({}, nextConfig), { i18n: {
|
|
47
|
+
locales: locales,
|
|
48
|
+
defaultLocale: defaultLocale,
|
|
49
|
+
domains: domains,
|
|
50
|
+
localeDetection: localeDetection,
|
|
51
|
+
} });
|
|
52
52
|
return __assign(__assign({}, nextConfigWithI18n), { webpack: function (conf, options) {
|
|
53
53
|
var config = typeof nextConfig.webpack === 'function'
|
|
54
54
|
? nextConfig.webpack(conf, options)
|