next-intl 2.7.1 → 2.7.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.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
_extends = Object.assign || function (target) {
|
|
3
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
4
|
+
var source = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var key in source) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
8
|
+
target[key] = source[key];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return target;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return _extends.apply(this, arguments);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
20
|
+
if (source == null) return {};
|
|
21
|
+
var target = {};
|
|
22
|
+
var sourceKeys = Object.keys(source);
|
|
23
|
+
var key, i;
|
|
24
|
+
|
|
25
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
26
|
+
key = sourceKeys[i];
|
|
27
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
28
|
+
target[key] = source[key];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return target;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { _extends as extends, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose };
|
|
35
|
+
//# sourceMappingURL=next-intl.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-intl.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/next-intl.esm.js
CHANGED
|
@@ -1,64 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { IntlProvider } from 'use-intl';
|
|
1
|
+
export { default as NextIntlProvider } from './next-intl.esm2.js';
|
|
4
2
|
export * from 'use-intl';
|
|
5
|
-
|
|
6
|
-
function _extends() {
|
|
7
|
-
_extends = Object.assign || function (target) {
|
|
8
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
9
|
-
var source = arguments[i];
|
|
10
|
-
|
|
11
|
-
for (var key in source) {
|
|
12
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13
|
-
target[key] = source[key];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return _extends.apply(this, arguments);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
25
|
-
if (source == null) return {};
|
|
26
|
-
var target = {};
|
|
27
|
-
var sourceKeys = Object.keys(source);
|
|
28
|
-
var key, i;
|
|
29
|
-
|
|
30
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
31
|
-
key = sourceKeys[i];
|
|
32
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
33
|
-
target[key] = source[key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return target;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var _excluded = ["locale"];
|
|
40
|
-
function NextIntlProvider(_ref) {
|
|
41
|
-
var _useRouter;
|
|
42
|
-
|
|
43
|
-
var locale = _ref.locale,
|
|
44
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
45
|
-
|
|
46
|
-
// The router can be undefined if used in a context outside
|
|
47
|
-
// of Next.js (e.g. unit tests, Storybook, ...)
|
|
48
|
-
var nextLocale = (_useRouter = useRouter()) == null ? void 0 : _useRouter.locale;
|
|
49
|
-
|
|
50
|
-
if (!locale && nextLocale) {
|
|
51
|
-
locale = nextLocale;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (!locale) {
|
|
55
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Couldn't determine locale. Please make sure you use internationalized routing or alternatively pass an explicit locale to `NextIntlProvider`." : undefined);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return React.createElement(IntlProvider, _extends({
|
|
59
|
-
locale: locale
|
|
60
|
-
}, rest));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { NextIntlProvider };
|
|
64
3
|
//# sourceMappingURL=next-intl.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.esm.js","sources":[
|
|
1
|
+
{"version":3,"file":"next-intl.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from './_virtual/next-intl.esm.js';
|
|
2
|
+
import { useRouter } from 'next/router';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { IntlProvider } from 'use-intl';
|
|
5
|
+
|
|
6
|
+
var _excluded = ["locale"];
|
|
7
|
+
function NextIntlProvider(_ref) {
|
|
8
|
+
var _useRouter;
|
|
9
|
+
|
|
10
|
+
var locale = _ref.locale,
|
|
11
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
12
|
+
|
|
13
|
+
// The router can be undefined if used in a context outside
|
|
14
|
+
// of Next.js (e.g. unit tests, Storybook, ...)
|
|
15
|
+
var nextLocale = (_useRouter = useRouter()) == null ? void 0 : _useRouter.locale;
|
|
16
|
+
|
|
17
|
+
if (!locale && nextLocale) {
|
|
18
|
+
locale = nextLocale;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!locale) {
|
|
22
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Couldn't determine locale. Please make sure you use internationalized routing or alternatively pass an explicit locale to `NextIntlProvider`." : undefined);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return React.createElement(IntlProvider, _extends({
|
|
26
|
+
locale: locale
|
|
27
|
+
}, rest));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { NextIntlProvider as default };
|
|
31
|
+
//# sourceMappingURL=next-intl.esm2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-intl.esm2.js","sources":["../src/NextIntlProvider.tsx"],"sourcesContent":["import {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale'> & {\n locale?: string;\n};\n\nexport default function NextIntlProvider({locale, ...rest}: Props) {\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n const nextLocale = useRouter()?.locale;\n\n if (!locale && nextLocale) {\n locale = nextLocale;\n }\n\n if (!locale) {\n throw new Error(\n __DEV__\n ? \"Couldn't determine locale. Please make sure you use internationalized routing or alternatively pass an explicit locale to `NextIntlProvider`.\"\n : undefined\n );\n }\n\n return <IntlProvider locale={locale} {...rest} />;\n}\n"],"names":["NextIntlProvider","locale","rest","nextLocale","useRouter","Error","undefined","React","createElement","IntlProvider"],"mappings":";;;;;;AAQc,SAAUA,gBAAV,CAAmD,IAAA,EAAA;AAAA,EAAA,IAAA,UAAA,CAAA;;AAAA,EAAvBC,IAAAA,MAAuB,QAAvBA,MAAuB;AAAA,MAAZC,IAAY,GAAA,6BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAC/D;AACA;AACA,EAAA,IAAMC,UAAU,GAAGC,CAAAA,UAAAA,GAAAA,SAAS,EAAZ,KAAA,IAAA,GAAA,KAAA,CAAA,GAAG,WAAaH,MAAhC,CAAA;;AAEA,EAAA,IAAI,CAACA,MAAD,IAAWE,UAAf,EAA2B;AACzBF,IAAAA,MAAM,GAAGE,UAAT,CAAA;AACD,GAAA;;AAED,EAAI,IAAA,CAACF,MAAL,EAAa;AACX,IAAA,MAAM,IAAII,KAAJ,CACJ,wCACI,+IADJ,GAEIC,SAHA,CAAN,CAAA;AAKD,GAAA;;AAED,EAAA,OAAOC,KAAA,CAAAC,aAAA,CAACC,YAAD,EAAA,QAAA,CAAA;AAAcR,IAAAA,MAAM,EAAEA,MAAAA;AAAtB,GAAA,EAAkCC,IAAlC,CAAP,CAAA,CAAA;AACD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intl",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.me>",
|
|
6
6
|
"description": "A minimal, but complete solution for internationalization in Next.js apps.",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"build": "dts build",
|
|
15
15
|
"test": "TZ=Europe/Berlin dts test",
|
|
16
16
|
"lint": "eslint src test && tsc",
|
|
17
|
-
"prepublishOnly": "yarn test && yarn lint && yarn build && cp ../../README.md ."
|
|
17
|
+
"prepublishOnly": "yarn test && yarn lint && yarn build && cp ../../README.md . && git checkout .",
|
|
18
|
+
"postpublish": "rm ./README.md"
|
|
18
19
|
},
|
|
19
20
|
"main": "dist/index.js",
|
|
20
21
|
"module": "dist/next-intl.esm.js",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"testEnvironment": "jsdom"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"use-intl": "^2.7.
|
|
44
|
+
"use-intl": "^2.7.3"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"next": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
@@ -60,6 +61,5 @@
|
|
|
60
61
|
},
|
|
61
62
|
"engines": {
|
|
62
63
|
"node": ">=10"
|
|
63
|
-
}
|
|
64
|
-
"gitHead": "6c4aa2b59a2345811cfbb5603f1a368fe73352ed"
|
|
64
|
+
}
|
|
65
65
|
}
|