@esgettext/tools 1.3.3 → 1.3.4

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/README.md CHANGED
@@ -7,37 +7,37 @@ The package also contains code for parsing po files and for writing them.
7
7
  ## Table of Contents <!-- omit in toc -->
8
8
 
9
9
  - [Prerequisites](#prerequisites)
10
- - [Un\*x/Linux](#unxlinux)
11
- - [Mac OS X](#mac-os-x)
12
- - [MacPorts](#macports)
13
- - [HomeBrew](#homebrew)
14
- - [MS-DOS (Microsoft Windows)](#ms-dos-microsoft-windows)
10
+ - [Un\*x/Linux](#unxlinux)
11
+ - [Mac OS X](#mac-os-x)
12
+ - [MacPorts](#macports)
13
+ - [HomeBrew](#homebrew)
14
+ - [MS-DOS (Microsoft Windows)](#ms-dos-microsoft-windows)
15
15
  - [Installation](#installation)
16
16
  - [The Tools](#the-tools)
17
- - [`esgettext xgettext`](#esgettext-xgettext)
18
- - [Other Commands](#other-commands)
17
+ - [`esgettext xgettext`](#esgettext-xgettext)
18
+ - [Other Commands](#other-commands)
19
19
  - [Configuration](#configuration)
20
- - [Configuration Files](#configuration-files)
21
- - [Validation](#validation)
22
- - [Configuration Schema](#configuration-schema)
23
- - [`package`](#package)
24
- - [`package.textdomain`](#packagetextdomain)
25
- - [`package.msgid-bugs-address`](#packagemsgid-bugs-address)
26
- - [`package.name`](#packagename)
27
- - [`package.copyright-holder`](#packagecopyright-holder)
28
- - [`package.version`](#packageversion)
29
- - [`po`:](#po)
30
- - [`po.directory`](#podirectory)
31
- - [`po.locales`](#polocales)
32
- - [`install`](#install)
33
- - [`install.directory`](#installdirectory)
34
- - [`programs`](#programs)
35
- - [`programs.msgmerge`](#programsmsgmerge)
36
- - [`programs.msgmerge.path`](#programsmsgmergepath)
37
- - [`programs.msgmerge.options`](#programsmsgmergeoptions)
38
- - [`programs.msgfmt`](#programsmsgfmt)
39
- - [`programs.msgfmt.path`](#programsmsgfmtpath)
40
- - [`programs.msgfmt.options`](#programsmsgfmtoptions)
20
+ - [Configuration Files](#configuration-files)
21
+ - [Validation](#validation)
22
+ - [Configuration Schema](#configuration-schema)
23
+ - [`package`](#package)
24
+ - [`package.textdomain`](#packagetextdomain)
25
+ - [`package.msgid-bugs-address`](#packagemsgid-bugs-address)
26
+ - [`package.name`](#packagename)
27
+ - [`package.copyright-holder`](#packagecopyright-holder)
28
+ - [`package.version`](#packageversion)
29
+ - [`po`:](#po)
30
+ - [`po.directory`](#podirectory)
31
+ - [`po.locales`](#polocales)
32
+ - [`install`](#install)
33
+ - [`install.directory`](#installdirectory)
34
+ - [`programs`](#programs)
35
+ - [`programs.msgmerge`](#programsmsgmerge)
36
+ - [`programs.msgmerge.path`](#programsmsgmergepath)
37
+ - [`programs.msgmerge.options`](#programsmsgmergeoptions)
38
+ - [`programs.msgfmt`](#programsmsgfmt)
39
+ - [`programs.msgfmt.path`](#programsmsgfmtpath)
40
+ - [`programs.msgfmt.options`](#programsmsgfmtoptions)
41
41
  - [Copyright](#copyright)
42
42
 
43
43
  ## Prerequisites
@@ -47,7 +47,7 @@ tools. If the command `xgettext --version` outputs some kind of version
47
47
  information, you are most probably set. Otherwise check the information for
48
48
  your platform below.
49
49
 
50
- ### Un\*x/Linux
50
+ ### Un*x/Linux
51
51
 
52
52
  Use the package manager of your vendor to search for something like
53
53
  "gettext-tools" or just "gettext" and install it. The gettext tools are
@@ -74,8 +74,8 @@ $ brew install gettext
74
74
 
75
75
  The options that I know of are
76
76
 
77
- - [Cygwin](https://www.cygwin.com/)
78
- - [MinGW](http://www.mingw.org/)
77
+ * [Cygwin](https://www.cygwin.com/)
78
+ * [MinGW](http://www.mingw.org/)
79
79
 
80
80
  See their documentation for more information.
81
81
 
@@ -121,7 +121,6 @@ If you have installed them globally, just omit the leading `npx`.
121
121
  Try this for an overview:
122
122
 
123
123
  ```shell
124
- $ npm install --save-deve @esgettext/tools
125
124
  $ npx esgettext --help
126
125
  ```
127
126
 
@@ -138,7 +137,7 @@ for more details.
138
137
 
139
138
  ### Other Commands
140
139
 
141
- All other commands should be understandable by their help output. Try
140
+ All other commands should be understandable by their help output. Try
142
141
  `npx esgettext --help` for an overview over all commands, and
143
142
  `npx esgettext COMMAND --help` for help for a specific command.
144
143
 
@@ -151,18 +150,18 @@ in a configuration file or just in `package.json`.
151
150
 
152
151
  Configuration files are checked in this order:
153
152
 
154
- - esgettext.config.mjs
155
- - esgettext.config.cjs
156
- - esgettext.config.js
157
- - esgettext.config.json
158
- - package.json
153
+ * esgettext.config.mjs
154
+ * esgettext.config.cjs
155
+ * esgettext.config.js
156
+ * esgettext.config.json
157
+ * package.json
159
158
 
160
159
  The JavaScript versions should have one default export with the configuration.
161
160
  The JSON version just defines the configuration. Alteratively, you can add
162
161
  a field "esgettext" to your `package.json`.
163
162
 
164
163
  You should always configure `po.locales` with a list of locale identifiers that
165
- your package supports. Otherwise, using `esgettext` does not make sense.
164
+ your package supports. Otherwise, using `esgettext` does not make sense.
166
165
 
167
166
  You should also set `package.textdomain` unless you are happy with the
168
167
  default which is just your package name read from `package.json`.
@@ -171,8 +170,8 @@ All other configuration values have sane defaults.
171
170
 
172
171
  ### Validation
173
172
 
174
- The required format is always the same. Note that the configuration gets
175
- validated against a schema. All tools will fail with a validation error if
173
+ The required format is always the same. Note that the configuration gets
174
+ validated against a schema. All tools will fail with a validation error if
176
175
  you pass an invalid configuration.
177
176
 
178
177
  ### Configuration Schema
@@ -181,7 +180,7 @@ All fields in the configuration are optional because you are always able to
181
180
  pass them on the command line.
182
181
 
183
182
  Options passed on the command line have higher precedence than options given
184
- in a configuration file. Options that you define inside a section `esgettext`
183
+ in a configuration file. Options that you define inside a section `esgettext`
185
184
  in `package.json` have higher precedence than options that default to
186
185
  general fields inside `package.json`.
187
186
 
@@ -207,12 +206,12 @@ General information about your package.
207
206
  ##### `package.textdomain`
208
207
 
209
208
  The textdomain of your package, usually something like
210
- `com.example.YOUR-PACKAGE`. You should configure this.
209
+ `com.example.YOUR-PACKAGE`. You should configure this.
211
210
 
212
211
  ##### `package.msgid-bugs-address`
213
212
 
214
213
  An email address or URL where to send bug reports or questions about message
215
- ids. This is added to the respective field in all generated po files.
214
+ ids. This is added to the respective field in all generated po files.
216
215
 
217
216
  If you omit this field, it will be read from the fields `bugs.email` or
218
217
  `bugs.url` (in that order) in `package.json`.
@@ -226,12 +225,13 @@ If you omit this field, it will be read from the field `name` in
226
225
 
227
226
  ##### `package.copyright-holder`
228
227
 
229
- The copyright holder of your package. This is added as a comment to all
228
+ The copyright holder of your package. This is added as a comment to all
230
229
  generated po files.
231
230
 
232
231
  If you omit this field, it will be read from the field `people.author` in
233
232
  `package.json`.
234
233
 
234
+
235
235
  ##### `package.version`
236
236
 
237
237
  The version of your package.
@@ -250,7 +250,7 @@ The directory where all translation related files reside, usually 'po'.
250
250
 
251
251
  ##### `po.locales`
252
252
 
253
- An array of locale identifiers. This should always be configured.
253
+ An array of locale identifiers. This should always be configured.
254
254
 
255
255
  #### `install`
256
256
 
@@ -273,8 +273,8 @@ The path to the `msgmerge` program of your system.
273
273
 
274
274
  ###### `programs.msgmerge.options`
275
275
 
276
- An array of options to pass to the `msgmerge` program. Only boolean options
277
- without arguments are supported. And you have to omit the leading hyphens,
276
+ An array of options to pass to the `msgmerge` program. Only boolean options
277
+ without arguments are supported. And you have to omit the leading hyphens,
278
278
  for example `['verbose']` or `['v']`, and not `['--verbose']` or `['-v']`.
279
279
 
280
280
  ##### `programs.msgfmt`
@@ -285,8 +285,8 @@ The path to the `msgfmt` program of your system.
285
285
 
286
286
  ###### `programs.msgfmt.options`
287
287
 
288
- An array of options to pass to the `msgmerge` program. Only boolean options
289
- without arguments are supported. And you have to omit the leading hyphens,
288
+ An array of options to pass to the `msgmerge` program. Only boolean options
289
+ without arguments are supported. And you have to omit the leading hyphens,
290
290
  for example `['verbose']` or `['v']`, and not `['--verbose']` or `['-v']`.
291
291
 
292
292
  ## Copyright
@@ -194,7 +194,8 @@ class Convert {
194
194
  filename = undefined;
195
195
  }
196
196
  if (typeof filename !== 'undefined') {
197
- return fs.readFileSync(filename);
197
+ const b = fs.readFileSync(filename);
198
+ return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);
198
199
  }
199
200
  // Must read from standard input.
200
201
  const stdinFd = 0;
@@ -204,7 +205,8 @@ class Convert {
204
205
  while ((bytesRead = fs.readSync(stdinFd, buffer, 0, buffer.length, null)) > 0) {
205
206
  chunks.push(Buffer.from(buffer.subarray(0, bytesRead)));
206
207
  }
207
- return Buffer.concat(chunks);
208
+ const b = Buffer.concat(chunks);
209
+ return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);
208
210
  }
209
211
  catch (error) {
210
212
  if (typeof filename === 'undefined') {
@@ -183,7 +183,8 @@ class Install {
183
183
  }));
184
184
  }
185
185
  const input = (0, fs_1.readFileSync)(inFile);
186
- const catalog = (0, runtime_1.parseMoCatalog)(input);
186
+ const b = input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
187
+ const catalog = (0, runtime_1.parseMoCatalog)(b);
187
188
  const json = JSON.stringify(catalog);
188
189
  (0, fs_1.writeFile)(outFile, json, err => {
189
190
  if (err) {
@@ -208,7 +209,8 @@ class Install {
208
209
  }));
209
210
  }
210
211
  const input = (0, fs_1.readFileSync)(inFile);
211
- const catalog = (0, runtime_1.parseMoCatalog)(input);
212
+ const b = input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
213
+ const catalog = (0, runtime_1.parseMoCatalog)(b);
212
214
  const msgs = {};
213
215
  for (const msgid in catalog.entries) {
214
216
  const msgstr = catalog.entries[msgid];
package/dist/package.js CHANGED
@@ -9,7 +9,7 @@ class Package {
9
9
  return 'https://github.com/gflohr/esgettext/issues';
10
10
  }
11
11
  static getVersion() {
12
- return '1.3.3';
12
+ return '1.3.4';
13
13
  }
14
14
  static getNpmRunAllVersion() {
15
15
  return '^4.1.5';
@@ -11,7 +11,8 @@ class JavaScriptParser extends parser_2.Parser {
11
11
  allowReturnOutsideFunction: true,
12
12
  allowSuperOutsideMethod: true,
13
13
  allowUndeclaredExports: true,
14
- errorRecovery: true,
14
+ // Documented but not supported. FIXME! Maybe only missing in types.
15
+ // errorRecovery: true,
15
16
  sourceFilename: filename,
16
17
  plugins: [
17
18
  'flow',
@@ -547,6 +547,10 @@ class Parser {
547
547
  ++i;
548
548
  continue;
549
549
  }
550
+ if (buf[i] === 0xd) {
551
+ ++i;
552
+ continue;
553
+ }
550
554
  if (0xc2 <= buf[i] &&
551
555
  buf[i] <= 0xdf &&
552
556
  0x80 <= buf[i + 1] &&
@@ -11,7 +11,8 @@ class TypeScriptParser extends parser_2.Parser {
11
11
  allowReturnOutsideFunction: true,
12
12
  allowSuperOutsideMethod: true,
13
13
  allowUndeclaredExports: true,
14
- errorRecovery: true,
14
+ // Documented but not supported. FIXME! Maybe only missing in types.
15
+ // errorRecovery: true,
15
16
  sourceFilename: filename,
16
17
  plugins: [
17
18
  'typescript',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esgettext/tools",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Gettext-like po creation and manipulation",
5
5
  "keywords": [
6
6
  "gettext",
@@ -104,7 +104,7 @@
104
104
  "dependencies": {
105
105
  "@babel/parser": "^7.24.7",
106
106
  "@babel/traverse": "^7.24.7",
107
- "@esgettext/runtime": "^1.3.2",
107
+ "@esgettext/runtime": "^1.3.4",
108
108
  "@inquirer/prompts": "^5.0.6",
109
109
  "@npmcli/package-json": "^5.2.0",
110
110
  "@valibot/i18n": "^0.15.0",
@@ -114,5 +114,5 @@
114
114
  "valibot": "^0.31.1",
115
115
  "yargs": "^17.7.2"
116
116
  },
117
- "gitHead": "26c7da76d48c0e0e2d6021ed3e8fd5939417895f"
117
+ "gitHead": "b874712f63ffbc0dfeebd5d23a2fdeafd232857b"
118
118
  }