next-intl 4.10.1 → 4.11.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,6 @@
1
1
  'use strict';
2
2
 
3
- var plugin = require('./plugin-Har7Ebj3.cjs');
3
+ var plugin = require('./plugin-0S9vVrVM.cjs');
4
4
  var ExtractorCodec = require('./ExtractorCodec-D9Tw618d.cjs');
5
5
  require('fs/promises');
6
6
  require('path');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var POParser = require('po-parser');
4
- var plugin = require('./plugin-Har7Ebj3.cjs');
4
+ var plugin = require('./plugin-0S9vVrVM.cjs');
5
5
  var ExtractorCodec = require('./ExtractorCodec-D9Tw618d.cjs');
6
6
  require('fs/promises');
7
7
  require('path');
@@ -65,7 +65,7 @@ function createMessagesDeclaration(messagesPaths) {
65
65
 
66
66
  // Note: These commands don't consult the
67
67
  // Next.js config, so we can't detect them here.
68
- // - telemetry
68
+ // - telemetry (however, the `detached-flush` DOES - see `createNextIntlPlugin`)
69
69
  // - lint
70
70
  //
71
71
  // What remains are:
@@ -122,11 +122,11 @@ export default messages;`;
122
122
 
123
123
  const formats = {
124
124
  json: {
125
- codec: () => Promise.resolve().then(function () { return require('./JSONCodec-XU-elSg6.cjs'); }),
125
+ codec: () => Promise.resolve().then(function () { return require('./JSONCodec-B-lAnRTg.cjs'); }),
126
126
  extension: '.json'
127
127
  },
128
128
  po: {
129
- codec: () => Promise.resolve().then(function () { return require('./POCodec-cA1pxFGQ.cjs'); }),
129
+ codec: () => Promise.resolve().then(function () { return require('./POCodec-0XdsL-1F.cjs'); }),
130
130
  extension: '.po'
131
131
  }
132
132
  };
@@ -999,7 +999,7 @@ class LRUCache {
999
999
  }
1000
1000
  }
1001
1001
 
1002
- const require$2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('plugin-Har7Ebj3.cjs', document.baseURI).href)));
1002
+ const require$2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('plugin-0S9vVrVM.cjs', document.baseURI).href)));
1003
1003
  class MessageExtractor {
1004
1004
  compileCache = new LRUCache(750);
1005
1005
  constructor(opts) {
@@ -1116,8 +1116,8 @@ function initExtractionCompiler(pluginConfig) {
1116
1116
  // - typegen
1117
1117
  //
1118
1118
  // Doesn't consult Next.js config anyway:
1119
- // - telemetry
1120
1119
  // - lint
1120
+ // - telemetry (however, the `detached-flush` DOES - see `createNextIntlPlugin`)
1121
1121
  //
1122
1122
  // What remains are:
1123
1123
  // - dev (NODE_ENV=development)
@@ -1157,7 +1157,7 @@ function initExtractionCompiler(pluginConfig) {
1157
1157
 
1158
1158
  function getCurrentVersion() {
1159
1159
  try {
1160
- 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-Har7Ebj3.cjs', document.baseURI).href)));
1160
+ 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-0S9vVrVM.cjs', document.baseURI).href)));
1161
1161
  const pkg = require$1('next/package.json');
1162
1162
  return pkg.version;
1163
1163
  } catch (error) {
@@ -1184,7 +1184,7 @@ function isNextJs16OrHigher() {
1184
1184
  return compareVersions(getCurrentVersion(), '16.0.0') >= 0;
1185
1185
  }
1186
1186
 
1187
- 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-Har7Ebj3.cjs', document.baseURI).href)));
1187
+ 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-0S9vVrVM.cjs', document.baseURI).href)));
1188
1188
  function withExtensions(localPath) {
1189
1189
  return [`${localPath}.ts`, `${localPath}.tsx`, `${localPath}.js`, `${localPath}.jsx`];
1190
1190
  }
@@ -1445,11 +1445,14 @@ function initPlugin(pluginConfig, nextConfig) {
1445
1445
  if (nextConfig?.i18n != null) {
1446
1446
  warn("An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");
1447
1447
  }
1448
+ const skipWatchers = isNextTelemetryDetachedFlushProcess();
1448
1449
  const messagesPathOrPaths = pluginConfig.experimental?.createMessagesDeclaration;
1449
- if (messagesPathOrPaths) {
1450
+ if (messagesPathOrPaths && !skipWatchers) {
1450
1451
  createMessagesDeclaration(typeof messagesPathOrPaths === 'string' ? [messagesPathOrPaths] : messagesPathOrPaths);
1451
1452
  }
1452
- initExtractionCompiler(pluginConfig);
1453
+ if (!skipWatchers) {
1454
+ initExtractionCompiler(pluginConfig);
1455
+ }
1453
1456
  return getNextConfig(pluginConfig, nextConfig);
1454
1457
  }
1455
1458
  function createNextIntlPlugin(i18nPathOrConfig = {}) {
@@ -1461,6 +1464,18 @@ function createNextIntlPlugin(i18nPathOrConfig = {}) {
1461
1464
  };
1462
1465
  }
1463
1466
 
1467
+ /**
1468
+ * Next runs `telemetry/detached-flush.js` in a detached process to flush telemetry
1469
+ * (often when `next dev` exits). That loads dev `next.config` with inherited
1470
+ * `NODE_ENV=development`, which would otherwise start orphan plugin watchers.
1471
+ */
1472
+ function isNextTelemetryDetachedFlushProcess() {
1473
+ const scriptPath = process.argv[1];
1474
+ if (!scriptPath) return false;
1475
+ const normalized = scriptPath.replace(/\\/g, '/');
1476
+ return normalized.includes('/telemetry/detached-flush');
1477
+ }
1478
+
1464
1479
  exports.createNextIntlPlugin = createNextIntlPlugin;
1465
1480
  exports.getSortedMessages = getSortedMessages;
1466
1481
  exports.isForbiddenObjectKey = isForbiddenObjectKey;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var plugin = require('./plugin-Har7Ebj3.cjs');
3
+ var plugin = require('./plugin-0S9vVrVM.cjs');
4
4
  require('fs/promises');
5
5
  require('path');
6
6
  require('@parcel/watcher');
@@ -7,11 +7,14 @@ function initPlugin(pluginConfig, nextConfig) {
7
7
  if (nextConfig?.i18n != null) {
8
8
  warn("An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");
9
9
  }
10
+ const skipWatchers = isNextTelemetryDetachedFlushProcess();
10
11
  const messagesPathOrPaths = pluginConfig.experimental?.createMessagesDeclaration;
11
- if (messagesPathOrPaths) {
12
+ if (messagesPathOrPaths && !skipWatchers) {
12
13
  createMessagesDeclaration(typeof messagesPathOrPaths === 'string' ? [messagesPathOrPaths] : messagesPathOrPaths);
13
14
  }
14
- initExtractionCompiler(pluginConfig);
15
+ if (!skipWatchers) {
16
+ initExtractionCompiler(pluginConfig);
17
+ }
15
18
  return getNextConfig(pluginConfig, nextConfig);
16
19
  }
17
20
  function createNextIntlPlugin(i18nPathOrConfig = {}) {
@@ -23,4 +26,16 @@ function createNextIntlPlugin(i18nPathOrConfig = {}) {
23
26
  };
24
27
  }
25
28
 
29
+ /**
30
+ * Next runs `telemetry/detached-flush.js` in a detached process to flush telemetry
31
+ * (often when `next dev` exits). That loads dev `next.config` with inherited
32
+ * `NODE_ENV=development`, which would otherwise start orphan plugin watchers.
33
+ */
34
+ function isNextTelemetryDetachedFlushProcess() {
35
+ const scriptPath = process.argv[1];
36
+ if (!scriptPath) return false;
37
+ const normalized = scriptPath.replace(/\\/g, '/');
38
+ return normalized.includes('/telemetry/detached-flush');
39
+ }
40
+
26
41
  export { createNextIntlPlugin as default };
@@ -12,7 +12,7 @@ function createMessagesDeclaration(messagesPaths) {
12
12
 
13
13
  // Note: These commands don't consult the
14
14
  // Next.js config, so we can't detect them here.
15
- // - telemetry
15
+ // - telemetry (however, the `detached-flush` DOES - see `createNextIntlPlugin`)
16
16
  // - lint
17
17
  //
18
18
  // What remains are:
@@ -17,8 +17,8 @@ function initExtractionCompiler(pluginConfig) {
17
17
  // - typegen
18
18
  //
19
19
  // Doesn't consult Next.js config anyway:
20
- // - telemetry
21
20
  // - lint
21
+ // - telemetry (however, the `detached-flush` DOES - see `createNextIntlPlugin`)
22
22
  //
23
23
  // What remains are:
24
24
  // - dev (NODE_ENV=development)
@@ -1 +1 @@
1
- import e from"./extractor/initExtractionCompiler.js";import t from"./getNextConfig.js";import{warn as r}from"./utils.js";import o from"./declaration/createMessagesDeclaration.js";function n(n={}){const i="string"==typeof n?{requestConfig:n}:n;return function(n){return function(n,i){null!=i?.i18n&&r("An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");const s=n.experimental?.createMessagesDeclaration;return s&&o("string"==typeof s?[s]:s),e(n),t(n,i)}(i,n)}}export{n as default};
1
+ import e from"./extractor/initExtractionCompiler.js";import t from"./getNextConfig.js";import{warn as r}from"./utils.js";import o from"./declaration/createMessagesDeclaration.js";function n(n,i){null!=i?.i18n&&r("An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n");const s=function(){const e=process.argv[1];if(!e)return!1;return e.replace(/\\/g,"/").includes("/telemetry/detached-flush")}(),a=n.experimental?.createMessagesDeclaration;return a&&!s&&o("string"==typeof a?[a]:a),s||e(n),t(n,i)}function i(e={}){const t="string"==typeof e?{requestConfig:e}:e;return function(e){return n(t,e)}}export{i as default};
@@ -20,6 +20,10 @@ declare function getFormatterCachedImpl(config: Parameters<typeof createFormatte
20
20
  (start: Date | number, end: Date | number, options?: import("use-intl/core").DateTimeFormatOptions): string;
21
21
  (start: Date | number, end: Date | number, format?: string, options?: import("use-intl/core").DateTimeFormatOptions): string;
22
22
  };
23
+ displayName: {
24
+ (value: string, options: Intl.DisplayNamesOptions): string;
25
+ (value: string, format: string, options?: Intl.DisplayNamesOptions): string;
26
+ };
23
27
  };
24
28
  declare const getFormatterCached: typeof getFormatterCachedImpl;
25
29
  export default getFormatterCached;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "4.10.1",
3
+ "version": "4.11.1",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -127,11 +127,11 @@
127
127
  "@formatjs/intl-localematcher": "^0.8.1",
128
128
  "@parcel/watcher": "^2.4.1",
129
129
  "@swc/core": "^1.15.2",
130
- "icu-minify": "^4.10.1",
130
+ "icu-minify": "^4.11.1",
131
131
  "negotiator": "^1.0.0",
132
- "next-intl-swc-plugin-extractor": "^4.10.1",
132
+ "next-intl-swc-plugin-extractor": "^4.11.1",
133
133
  "po-parser": "^2.1.1",
134
- "use-intl": "^4.10.1"
134
+ "use-intl": "^4.11.1"
135
135
  },
136
136
  "peerDependencies": {
137
137
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
@@ -142,5 +142,5 @@
142
142
  "optional": true
143
143
  }
144
144
  },
145
- "gitHead": "11d9ce823f9901041eaeb620859607aadf49ef3f"
145
+ "gitHead": "a6a8f8f4f8b72e5435147c98c6f23b301b79d35c"
146
146
  }
@@ -1,3 +0,0 @@
1
- export default class KeyGenerator {
2
- static generate(message: string): string;
3
- }