next-intl 4.0.0-beta-00a79d4 → 4.0.0-beta-c8eb4ad

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.
@@ -2,7 +2,6 @@
2
2
 
3
3
  var fs = require('fs');
4
4
  var path = require('path');
5
- var chokidar = require('chokidar');
6
5
 
7
6
  function formatMessage(message) {
8
7
  return `\n[next-intl] ${message}\n`;
@@ -45,12 +44,13 @@ function createMessagesDeclaration(messagesPath) {
45
44
  });
46
45
  }
47
46
  function startWatching(messagesPath) {
48
- const watcher = chokidar.watch(messagesPath);
49
- watcher.on('change', () => {
50
- compileDeclaration(messagesPath, true);
47
+ const watcher = fs.watch(messagesPath, eventType => {
48
+ if (eventType === 'change') {
49
+ compileDeclaration(messagesPath, true);
50
+ }
51
51
  });
52
52
  process.on('exit', () => {
53
- void watcher.close();
53
+ watcher.close();
54
54
  });
55
55
  }
56
56
  function compileDeclaration(messagesPath, async = false) {
@@ -1,6 +1,5 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { watch } from 'chokidar';
4
3
  import { throwError } from './utils.js';
5
4
 
6
5
  function runOnce(fn) {
@@ -34,12 +33,13 @@ function createMessagesDeclaration(messagesPath) {
34
33
  });
35
34
  }
36
35
  function startWatching(messagesPath) {
37
- const watcher = watch(messagesPath);
38
- watcher.on('change', () => {
39
- compileDeclaration(messagesPath, true);
36
+ const watcher = fs.watch(messagesPath, eventType => {
37
+ if (eventType === 'change') {
38
+ compileDeclaration(messagesPath, true);
39
+ }
40
40
  });
41
41
  process.on('exit', () => {
42
- void watcher.close();
42
+ watcher.close();
43
43
  });
44
44
  }
45
45
  function compileDeclaration(messagesPath, async = false) {
@@ -1 +1 @@
1
- import e from"fs";import s from"path";import{watch as t}from"chokidar";import{throwError as n}from"./utils.js";function o(o){const i=s.resolve(o);e.existsSync(i)||n(`\`createMessagesDeclaration\` points to a non-existent file: ${i}`),i.endsWith(".json")||n(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${i}`);const c=process.argv.includes("dev"),a=process.argv.includes("build");var l;(c||a)&&(l=()=>{r(o),c&&function(e){const s=t(e);s.on("change",(()=>{r(e,!0)})),process.on("exit",(()=>{s.close()}))}(o)},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",l()))}function r(s,t=!1){const n=s.replace(/\.json$/,".d.json.ts");function o(e){return`// This file is auto-generated by next-intl, do not edit directly.\n// See: https://next-intl-docs.vercel.app/docs/workflows/typescript#messages-arguments\n\ndeclare const messages: ${e.trim()};\nexport default messages;`}if(t)return e.promises.readFile(s,"utf-8").then((s=>e.promises.writeFile(n,o(s))));const r=e.readFileSync(s,"utf-8");e.writeFileSync(n,o(r))}export{o as default};
1
+ import e from"fs";import s from"path";import{throwError as t}from"./utils.js";function n(n){const i=s.resolve(n);e.existsSync(i)||t(`\`createMessagesDeclaration\` points to a non-existent file: ${i}`),i.endsWith(".json")||t(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${i}`);const r=process.argv.includes("dev"),c=process.argv.includes("build");var a;(r||c)&&(a=()=>{o(n),r&&function(s){const t=e.watch(s,(e=>{"change"===e&&o(s,!0)}));process.on("exit",(()=>{t.close()}))}(n)},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",a()))}function o(s,t=!1){const n=s.replace(/\.json$/,".d.json.ts");function o(e){return`// This file is auto-generated by next-intl, do not edit directly.\n// See: https://next-intl-docs.vercel.app/docs/workflows/typescript#messages-arguments\n\ndeclare const messages: ${e.trim()};\nexport default messages;`}if(t)return e.promises.readFile(s,"utf-8").then((s=>e.promises.writeFile(n,o(s))));const i=e.readFileSync(s,"utf-8");e.writeFileSync(n,o(i))}export{n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "4.0.0-beta-00a79d4",
3
+ "version": "4.0.0-beta-c8eb4ad",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -111,9 +111,8 @@
111
111
  ],
112
112
  "dependencies": {
113
113
  "@formatjs/intl-localematcher": "^0.5.4",
114
- "chokidar": "^4.0.1",
115
114
  "negotiator": "^1.0.0",
116
- "use-intl": "4.0.0-beta-00a79d4"
115
+ "use-intl": "4.0.0-beta-c8eb4ad"
117
116
  },
118
117
  "peerDependencies": {
119
118
  "next": "^13.0.0 || ^14.0.0 || ^15.0.0",
@@ -125,5 +124,5 @@
125
124
  "optional": true
126
125
  }
127
126
  },
128
- "gitHead": "9c05cd576d214480f7459b2351f94cfa9e4aef85"
127
+ "gitHead": "0f3e1b49035abd86291ea92248a9b042e53fc549"
129
128
  }