taraskevizer 2.0.1 → 2.0.2

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/bin/index.js CHANGED
@@ -2,21 +2,22 @@
2
2
  import { tarask, taraskToHtml } from '../dist/index.js';
3
3
  import { readFile } from 'fs/promises';
4
4
 
5
- const print = (...msgs) => {
6
- console.log('\x1b[34m[taraskevizer]\x1b[0m', ...msgs);
5
+ const printWithPrefix = (msg) => {
6
+ process.stdout.write(
7
+ '\x1b[34m[taraskevizer]\x1b[0m ' + msg.toString() + '\n'
8
+ );
7
9
  };
8
10
 
9
- const getPkg = () =>
10
- readFile(new URL('../package.json', import.meta.url)).then(JSON.parse);
11
-
12
11
  process.argv.splice(0, 2);
13
12
 
14
13
  const checkForOptions = (options) =>
15
14
  options.includes(process.argv[0].toLowerCase());
16
15
 
17
16
  if (checkForOptions(['-v', '--version'])) {
18
- const { version } = await getPkg();
19
- print(version);
17
+ const { version } = JSON.parse(
18
+ await readFile(new URL('../package.json', import.meta.url), 'utf8')
19
+ );
20
+ printWithPrefix(version);
20
21
  process.exit(0);
21
22
  }
22
23
 
@@ -29,7 +30,14 @@ const htmlOptions = { g: true };
29
30
 
30
31
  let isHtml = false;
31
32
 
32
- const optionDict = [
33
+ const toHashTable = (dict) => {
34
+ const result = {};
35
+ for (const [options, callback] of dict)
36
+ for (const option of options) result[option] = callback;
37
+ return result;
38
+ };
39
+
40
+ const optionDict = toHashTable([
33
41
  [
34
42
  ['--latin', '-l'],
35
43
  () => {
@@ -91,21 +99,22 @@ const optionDict = [
91
99
  isHtml = true;
92
100
  },
93
101
  ],
94
- ];
102
+ ]);
103
+
104
+ let currOption;
95
105
 
96
- optionEater: while (true) {
97
- for (const [options, callback] of optionDict)
98
- if (checkForOptions(options)) {
99
- process.argv.shift();
100
- callback();
101
- continue optionEater;
102
- }
103
- break;
106
+ while ((currOption = process.argv.shift())) {
107
+ if (currOption in optionDict) {
108
+ optionDict[currOption]();
109
+ } else {
110
+ process.argv.unshift(currOption);
111
+ break;
112
+ }
104
113
  }
105
114
 
106
115
  const text = process.argv.join(' ');
107
116
 
108
- console.log(
117
+ process.stdout.write(
109
118
  isHtml
110
119
  ? taraskToHtml(text, taraskOptions, htmlOptions)
111
120
  : tarask(text, taraskOptions, nonHtmlOptions)
package/dist/index.cjs CHANGED
@@ -854,6 +854,7 @@ var rawWordlist = [
854
854
  [/календ/, "кале�нд"],
855
855
  [/ленд/, "лэнд"],
856
856
  [/люксем/, "люксэм"],
857
+ [/ луіш/, " лу�іш"],
857
858
  [/ луі/, " люі"],
858
859
  [/лунаці/, "люнаты"],
859
860
  [/люнебур/, "люнэбур"],
@@ -1055,6 +1056,7 @@ var rawWordlist = [
1055
1056
  [/персі(?=[ійя])/, "пэрсі"],
1056
1057
  [/персід/, "пэрсыд"],
1057
1058
  [/ перу/, " пэру"],
1059
+ [/перыгел/, "пэрыг�ел"],
1058
1060
  [/перыяд/, "пэрыяд"],
1059
1061
  [/ песа /, " пэса "],
1060
1062
  [/песімі(?=[зс])/, "пэсымі"],
@@ -1891,7 +1893,7 @@ var rawWordlist = [
1891
1893
  [/нкск/, "нск"],
1892
1894
  [/[ктцч]ск/, "цк"],
1893
1895
  [/падскарб/, "пад�скарб"],
1894
- [/ райхск/, " райх�ск"],
1896
+ [/ (звыш|райх)ск/, " $1�ск"],
1895
1897
  [/ г[еэ]рцагс/, " гэрцаг�с"],
1896
1898
  [/ (дву|тро|чатыро)хс/, " $1х�с"],
1897
1899
  [/[гґзжхш]с(?=(?:к|тв)\S)/, "с"],
@@ -2263,7 +2265,7 @@ var tarask = (text, taraskOptions, nonHtmlOptions = {}) => {
2263
2265
  const replacer = ($0) => $0.slice(1, -1).split("|")[wordIndex];
2264
2266
  text = text.replace(
2265
2267
  OPTIONAL_WORDS_REGEX,
2266
- nonHtmlOptions.nodeColors ? ($0) => tagApplications.nonHtml.L(replacer($0)) : replacer
2268
+ nonHtmlOptions.nodeColors ? ($0) => apply.L(replacer($0)) : replacer
2267
2269
  );
2268
2270
  }
2269
2271
  return finilize(applyNoFix(text).replace(/&#40/g, "("), "\n");
package/dist/index.js CHANGED
@@ -823,6 +823,7 @@ var rawWordlist = [
823
823
  [/календ/, "кале�нд"],
824
824
  [/ленд/, "лэнд"],
825
825
  [/люксем/, "люксэм"],
826
+ [/ луіш/, " лу�іш"],
826
827
  [/ луі/, " люі"],
827
828
  [/лунаці/, "люнаты"],
828
829
  [/люнебур/, "люнэбур"],
@@ -1024,6 +1025,7 @@ var rawWordlist = [
1024
1025
  [/персі(?=[ійя])/, "пэрсі"],
1025
1026
  [/персід/, "пэрсыд"],
1026
1027
  [/ перу/, " пэру"],
1028
+ [/перыгел/, "пэрыг�ел"],
1027
1029
  [/перыяд/, "пэрыяд"],
1028
1030
  [/ песа /, " пэса "],
1029
1031
  [/песімі(?=[зс])/, "пэсымі"],
@@ -1860,7 +1862,7 @@ var rawWordlist = [
1860
1862
  [/нкск/, "нск"],
1861
1863
  [/[ктцч]ск/, "цк"],
1862
1864
  [/падскарб/, "пад�скарб"],
1863
- [/ райхск/, " райх�ск"],
1865
+ [/ (звыш|райх)ск/, " $1�ск"],
1864
1866
  [/ г[еэ]рцагс/, " гэрцаг�с"],
1865
1867
  [/ (дву|тро|чатыро)хс/, " $1х�с"],
1866
1868
  [/[гґзжхш]с(?=(?:к|тв)\S)/, "с"],
@@ -2232,7 +2234,7 @@ var tarask = (text, taraskOptions, nonHtmlOptions = {}) => {
2232
2234
  const replacer = ($0) => $0.slice(1, -1).split("|")[wordIndex];
2233
2235
  text = text.replace(
2234
2236
  OPTIONAL_WORDS_REGEX,
2235
- nonHtmlOptions.nodeColors ? ($0) => tagApplications.nonHtml.L(replacer($0)) : replacer
2237
+ nonHtmlOptions.nodeColors ? ($0) => apply.L(replacer($0)) : replacer
2236
2238
  );
2237
2239
  }
2238
2240
  return finilize(applyNoFix(text).replace(/&#40/g, "("), "\n");
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "taraskevizer",
3
3
  "author": "GooseOb",
4
4
  "license": "MIT",
5
- "version": "2.0.1",
5
+ "version": "2.0.2",
6
6
  "private": false,
7
7
  "homepage": "https://gooseob.github.io/taraskevizatar/",
8
8
  "main": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "README.md"
19
19
  ],
20
20
  "scripts": {
21
- "build": "tsup --config build-config/index.js",
21
+ "build": "tsup --config build-config/index.ts",
22
22
  "build:bun_EXPERIMENTAL": "bun ./build-config/bun.ts",
23
23
  "dev": "esrun --watch=src/*,test/*,bin/* --send-code-mode=temporaryFile test",
24
24
  "dev:bun": "bun ./test/bun-watch.ts",