next-intl 4.3.2 → 4.3.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.
@@ -86,9 +86,17 @@ export default messages;`;
86
86
  fs.writeFileSync(declarationPath, createDeclaration(content));
87
87
  }
88
88
 
89
- // eslint-disable-next-line import/order
90
- const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('plugin.cjs', document.baseURI).href)));
91
- const pkg = require$1('next/package.json');
89
+ function getCurrentVersion() {
90
+ try {
91
+ const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('plugin.cjs', document.baseURI).href)));
92
+ const pkg = require$1('next/package.json');
93
+ return pkg.version;
94
+ } catch (error) {
95
+ throw new Error('Failed to get current Next.js version. This can happen if next-intl/plugin is imported into your app code outside of your next.config.js.', {
96
+ cause: error
97
+ });
98
+ }
99
+ }
92
100
  function compareVersions(version1, version2) {
93
101
  const v1Parts = version1.split('.').map(Number);
94
102
  const v2Parts = version2.split('.').map(Number);
@@ -100,7 +108,7 @@ function compareVersions(version1, version2) {
100
108
  }
101
109
  return 0;
102
110
  }
103
- const hasStableTurboConfig = compareVersions(pkg.version, '15.3.0') >= 0;
111
+ const hasStableTurboConfig = compareVersions(getCurrentVersion(), '15.3.0') >= 0;
104
112
 
105
113
  function withExtensions(localPath) {
106
114
  return [`${localPath}.ts`, `${localPath}.tsx`, `${localPath}.js`, `${localPath}.jsx`];
@@ -1,8 +1,16 @@
1
1
  import { createRequire } from 'module';
2
2
 
3
- // eslint-disable-next-line import/order
4
- const require = createRequire(import.meta.url);
5
- const pkg = require('next/package.json');
3
+ function getCurrentVersion() {
4
+ try {
5
+ const require = createRequire(import.meta.url);
6
+ const pkg = require('next/package.json');
7
+ return pkg.version;
8
+ } catch (error) {
9
+ throw new Error('Failed to get current Next.js version. This can happen if next-intl/plugin is imported into your app code outside of your next.config.js.', {
10
+ cause: error
11
+ });
12
+ }
13
+ }
6
14
  function compareVersions(version1, version2) {
7
15
  const v1Parts = version1.split('.').map(Number);
8
16
  const v2Parts = version2.split('.').map(Number);
@@ -14,6 +22,6 @@ function compareVersions(version1, version2) {
14
22
  }
15
23
  return 0;
16
24
  }
17
- const hasStableTurboConfig = compareVersions(pkg.version, '15.3.0') >= 0;
25
+ const hasStableTurboConfig = compareVersions(getCurrentVersion(), '15.3.0') >= 0;
18
26
 
19
27
  export { hasStableTurboConfig as default };
@@ -1 +1 @@
1
- import{createRequire as t}from"module";const r=function(t,r){const e=t.split(".").map(Number),o=r.split(".").map(Number);for(let t=0;t<3;t++){const r=e[t]||0,n=o[t]||0;if(r>n)return 1;if(r<n)return-1}return 0}(t(import.meta.url)("next/package.json").version,"15.3.0")>=0;export{r as default};
1
+ import{createRequire as t}from"module";const r=function(t,r){const e=t.split(".").map(Number),n=r.split(".").map(Number);for(let t=0;t<3;t++){const r=e[t]||0,o=n[t]||0;if(r>o)return 1;if(r<o)return-1}return 0}(function(){try{const r=t(import.meta.url);return r("next/package.json").version}catch(t){throw new Error("Failed to get current Next.js version. This can happen if next-intl/plugin is imported into your app code outside of your next.config.js.",{cause:t})}}(),"15.3.0")>=0;export{r as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -112,7 +112,7 @@
112
112
  "dependencies": {
113
113
  "@formatjs/intl-localematcher": "^0.5.4",
114
114
  "negotiator": "^1.0.0",
115
- "use-intl": "^4.3.2"
115
+ "use-intl": "^4.3.3"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
@@ -124,5 +124,5 @@
124
124
  "optional": true
125
125
  }
126
126
  },
127
- "gitHead": "112b4e686f4c7fdb4921db78b9c83a53c86f53fc"
127
+ "gitHead": "405beefbae0fc1973a6870dd9399a1eac42ff28a"
128
128
  }