taraskevizer 8.0.4 → 8.0.6

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/dist/bin.js CHANGED
@@ -14,7 +14,7 @@ const printWithPrefix = (msg) => {
14
14
  process.argv.splice(0, 2);
15
15
  const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
16
16
  if (checkForOptions(["-v", "--version"])) {
17
- printWithPrefix("8.0.4");
17
+ printWithPrefix("8.0.6");
18
18
  process.exit(0);
19
19
  }
20
20
  if (checkForOptions(["-h", "--help"])) {
@@ -66,12 +66,11 @@ Other:
66
66
  `);
67
67
  process.exit(0);
68
68
  }
69
- const general = {};
70
- const nonHtml = {
71
- variations: 2,
72
- ansiColors: true
73
- };
74
- const html = { g: true };
69
+ const cfg = new TaraskConfig({
70
+ general: {},
71
+ html: { g: true },
72
+ nonHtml: { variations: VARIATION.ALL, ansiColors: true }
73
+ });
75
74
  let mode = "plainText";
76
75
  const toHashTable = (dict) => {
77
76
  const result = {};
@@ -86,62 +85,62 @@ const optionDict = toHashTable([
86
85
  [
87
86
  ["--latin", "-l"],
88
87
  () => {
89
- general.abc = dicts.alphabets.latin;
88
+ cfg.general.abc = dicts.alphabets.latin;
90
89
  }
91
90
  ],
92
91
  [
93
92
  ["--latin-ji", "-lj"],
94
93
  () => {
95
- general.abc = dicts.alphabets.latinJi;
94
+ cfg.general.abc = dicts.alphabets.latinJi;
96
95
  }
97
96
  ],
98
97
  [
99
98
  ["--arabic", "-a"],
100
99
  () => {
101
- general.abc = dicts.alphabets.arabic;
100
+ cfg.general.abc = dicts.alphabets.arabic;
102
101
  }
103
102
  ],
104
103
  [
105
104
  ["--jrandom", "-jr"],
106
105
  () => {
107
- general.j = REPLACE_J.RANDOM;
106
+ cfg.general.j = REPLACE_J.RANDOM;
108
107
  }
109
108
  ],
110
109
  [
111
110
  ["--jalways", "-ja"],
112
111
  () => {
113
- general.j = REPLACE_J.ALWAYS;
112
+ cfg.general.j = REPLACE_J.ALWAYS;
114
113
  }
115
114
  ],
116
115
  [
117
116
  ["--no-escape-caps", "-nec"],
118
117
  () => {
119
- general.doEscapeCapitalized = false;
118
+ cfg.general.doEscapeCapitalized = false;
120
119
  }
121
120
  ],
122
121
  [
123
122
  ["--h"],
124
123
  () => {
125
- nonHtml.h = true;
126
- html.g = false;
124
+ cfg.nonHtml.h = true;
125
+ cfg.html.g = false;
127
126
  }
128
127
  ],
129
128
  [
130
129
  ["--no-variations", "-nv"],
131
130
  () => {
132
- nonHtml.variations = VARIATION.NO;
131
+ cfg.nonHtml.variations = VARIATION.NO;
133
132
  }
134
133
  ],
135
134
  [
136
135
  ["--first-variation-only", "-fvo"],
137
136
  () => {
138
- nonHtml.variations = VARIATION.FIRST;
137
+ cfg.nonHtml.variations = VARIATION.FIRST;
139
138
  }
140
139
  ],
141
140
  [
142
141
  ["--no-color", "-nc"],
143
142
  () => {
144
- nonHtml.ansiColors = false;
143
+ cfg.nonHtml.ansiColors = false;
145
144
  }
146
145
  ],
147
146
  [
@@ -189,7 +188,6 @@ if (process.argv.length) {
189
188
  }
190
189
  text = Buffer.concat(chunks, length).toString();
191
190
  }
192
- const cfg = new TaraskConfig({ general, html, nonHtml });
193
191
  if (process.stdout.write(tarask(text, pipelines[mode], cfg) + "\n")) {
194
192
  process.exit(0);
195
193
  } else {
package/dist/index.cjs CHANGED
@@ -1,35 +1,10 @@
1
- "use strict";
1
+ 'use strict';
2
+
2
3
  var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
4
  var __export = (target, all) => {
7
5
  for (var name in all)
8
6
  __defProp(target, name, { get: all[name], enumerable: true });
9
7
  };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- REPLACE_J: () => REPLACE_J,
24
- TaraskConfig: () => TaraskConfig,
25
- VARIATION: () => VARIATION,
26
- dicts: () => dict_exports,
27
- lib: () => lib_exports,
28
- pipelines: () => pipelines_exports,
29
- steps: () => steps_exports,
30
- tarask: () => tarask
31
- });
32
- module.exports = __toCommonJS(src_exports);
33
8
 
34
9
  // src/dict/index.ts
35
10
  var dict_exports = {};
@@ -1898,10 +1873,10 @@ var common = {
1898
1873
  ].map(dictFrom.nonGlobal),
1899
1874
  upper: [
1900
1875
  [
1901
- [new RegExp(" Е(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Je"],
1902
- [new RegExp(" Ё(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Jo"],
1903
- [new RegExp(" Ю(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ju"],
1904
- [new RegExp(" Я(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ja"]
1876
+ [/ Е(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Je"],
1877
+ [/ Ё(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Jo"],
1878
+ [/ Ю(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ju"],
1879
+ [/ Я(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ja"]
1905
1880
  ],
1906
1881
  [
1907
1882
  [/([АЕЁІОУЎЫЭЮЯЬ| ]\(?)Е/, "$1JE"],
@@ -1975,7 +1950,7 @@ var latinJi = {
1975
1950
  ]),
1976
1951
  upper: [
1977
1952
  ...common.upper[0],
1978
- [new RegExp("([eoua] *)І(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "gu"), "$1Ji"],
1953
+ [/([eoua] *)І(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/gu, "$1Ji"],
1979
1954
  ...common.upper[1],
1980
1955
  [/([AOEUАЕЁІОУЎЫЭЮЯ][( ]*)І/g, "$1JI"],
1981
1956
  ...common.upper[2],
@@ -2146,10 +2121,7 @@ __export(lib_exports, {
2146
2121
  });
2147
2122
 
2148
2123
  // src/lib/after-tarask.ts
2149
- var iaReplacer = ($0, $1, $2) => {
2150
- var _a;
2151
- return ((_a = $2.match(/[аеёіоуыэюя]/g)) == null ? void 0 : _a.length) === 1 ? $1 + "я" + $2 : $0;
2152
- };
2124
+ var iaReplacer = ($0, $1, $2) => $2.match(/[аеёіоуыэюя]/g)?.length === 1 ? $1 + "я" + $2 : $0;
2153
2125
  var afterTarask = [
2154
2126
  [/( б)е(зь? \S+)/g, iaReplacer],
2155
2127
  [/( н)е( \S+)/g, iaReplacer],
@@ -2239,7 +2211,7 @@ var replaceWithDict = (text, dict = []) => {
2239
2211
  // src/lib/restore-case.ts
2240
2212
  var isUpperCase = (str) => str === str.toUpperCase();
2241
2213
  var getLastLetter = (word, i) => {
2242
- const result = new RegExp("\\p{L}(?=[^\\p{L}]*$)", "u").exec(word);
2214
+ const result = /\p{L}(?=[^\p{L}]*$)/u.exec(word);
2243
2215
  if (result)
2244
2216
  return result[0];
2245
2217
  throw new Error(
@@ -2391,7 +2363,7 @@ var applyVariationsNonHtml = (options) => {
2391
2363
 
2392
2364
  // src/steps/prepare.ts
2393
2365
  var prepare = mutatingStep(
2394
- ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(new RegExp("(\\p{P}|\\p{S}|\\d+)", "gu"), " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2366
+ ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(/(\p{P}|\p{S}|\d+)/gu, " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2395
2367
  );
2396
2368
 
2397
2369
  // src/steps/resolve-syntax.ts
@@ -2418,7 +2390,7 @@ var resolveSpecialSyntax = (leftAngleBracket) => mutatingStep(
2418
2390
  abcOnlyText.split(" ")
2419
2391
  ).join(" ");
2420
2392
  const escapeCapsIfNeeded = (text2) => doEscapeCapitalized ? text2.replace(
2421
- new RegExp("(?!<=\\p{Lu} )\\p{Lu}{2}[\\p{Lu} ]*(?!= \\p{Lu})", "gu"),
2393
+ /(?!<=\p{Lu} )\p{Lu}{2}[\p{Lu} ]*(?!= \p{Lu})/gu,
2422
2394
  ($0) => {
2423
2395
  noFixArr.push(convertAlphavet($0, abc));
2424
2396
  return NOFIX_CHAR;
@@ -2555,7 +2527,7 @@ var trim = mutatingStep(({ text }) => ` ${text.trim()} `);
2555
2527
 
2556
2528
  // src/steps/finalize.ts
2557
2529
  var finalize = (newLine) => mutatingStep(
2558
- ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d+) ", "gu"), "$1").replace(/\n/g, newLine).trim()
2530
+ ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(/ (\p{P}|\p{S}|\d+) /gu, "$1").replace(/\n/g, newLine).trim()
2559
2531
  );
2560
2532
 
2561
2533
  // src/steps/to-lower-case.ts
@@ -2621,14 +2593,12 @@ var html = createPipeline(
2621
2593
  finalize("<br>"),
2622
2594
  highlightDiffStep(htmlWrappers.fix)
2623
2595
  );
2624
- // Annotate the CommonJS export names for ESM import in node:
2625
- 0 && (module.exports = {
2626
- REPLACE_J,
2627
- TaraskConfig,
2628
- VARIATION,
2629
- dicts,
2630
- lib,
2631
- pipelines,
2632
- steps,
2633
- tarask
2634
- });
2596
+
2597
+ exports.REPLACE_J = REPLACE_J;
2598
+ exports.TaraskConfig = TaraskConfig;
2599
+ exports.VARIATION = VARIATION;
2600
+ exports.dicts = dict_exports;
2601
+ exports.lib = lib_exports;
2602
+ exports.pipelines = pipelines_exports;
2603
+ exports.steps = steps_exports;
2604
+ exports.tarask = tarask;
package/dist/index.js CHANGED
@@ -1871,10 +1871,10 @@ var common = {
1871
1871
  ].map(dictFrom.nonGlobal),
1872
1872
  upper: [
1873
1873
  [
1874
- [new RegExp(" Е(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Je"],
1875
- [new RegExp(" Ё(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Jo"],
1876
- [new RegExp(" Ю(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ju"],
1877
- [new RegExp(" Я(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ja"]
1874
+ [/ Е(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Je"],
1875
+ [/ Ё(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Jo"],
1876
+ [/ Ю(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ju"],
1877
+ [/ Я(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ja"]
1878
1878
  ],
1879
1879
  [
1880
1880
  [/([АЕЁІОУЎЫЭЮЯЬ| ]\(?)Е/, "$1JE"],
@@ -1948,7 +1948,7 @@ var latinJi = {
1948
1948
  ]),
1949
1949
  upper: [
1950
1950
  ...common.upper[0],
1951
- [new RegExp("([eoua] *)І(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "gu"), "$1Ji"],
1951
+ [/([eoua] *)І(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/gu, "$1Ji"],
1952
1952
  ...common.upper[1],
1953
1953
  [/([AOEUАЕЁІОУЎЫЭЮЯ][( ]*)І/g, "$1JI"],
1954
1954
  ...common.upper[2],
@@ -2119,10 +2119,7 @@ __export(lib_exports, {
2119
2119
  });
2120
2120
 
2121
2121
  // src/lib/after-tarask.ts
2122
- var iaReplacer = ($0, $1, $2) => {
2123
- var _a;
2124
- return ((_a = $2.match(/[аеёіоуыэюя]/g)) == null ? void 0 : _a.length) === 1 ? $1 + "я" + $2 : $0;
2125
- };
2122
+ var iaReplacer = ($0, $1, $2) => $2.match(/[аеёіоуыэюя]/g)?.length === 1 ? $1 + "я" + $2 : $0;
2126
2123
  var afterTarask = [
2127
2124
  [/( б)е(зь? \S+)/g, iaReplacer],
2128
2125
  [/( н)е( \S+)/g, iaReplacer],
@@ -2212,7 +2209,7 @@ var replaceWithDict = (text, dict = []) => {
2212
2209
  // src/lib/restore-case.ts
2213
2210
  var isUpperCase = (str) => str === str.toUpperCase();
2214
2211
  var getLastLetter = (word, i) => {
2215
- const result = new RegExp("\\p{L}(?=[^\\p{L}]*$)", "u").exec(word);
2212
+ const result = /\p{L}(?=[^\p{L}]*$)/u.exec(word);
2216
2213
  if (result)
2217
2214
  return result[0];
2218
2215
  throw new Error(
@@ -2364,7 +2361,7 @@ var applyVariationsNonHtml = (options) => {
2364
2361
 
2365
2362
  // src/steps/prepare.ts
2366
2363
  var prepare = mutatingStep(
2367
- ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(new RegExp("(\\p{P}|\\p{S}|\\d+)", "gu"), " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2364
+ ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(/(\p{P}|\p{S}|\d+)/gu, " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2368
2365
  );
2369
2366
 
2370
2367
  // src/steps/resolve-syntax.ts
@@ -2391,7 +2388,7 @@ var resolveSpecialSyntax = (leftAngleBracket) => mutatingStep(
2391
2388
  abcOnlyText.split(" ")
2392
2389
  ).join(" ");
2393
2390
  const escapeCapsIfNeeded = (text2) => doEscapeCapitalized ? text2.replace(
2394
- new RegExp("(?!<=\\p{Lu} )\\p{Lu}{2}[\\p{Lu} ]*(?!= \\p{Lu})", "gu"),
2391
+ /(?!<=\p{Lu} )\p{Lu}{2}[\p{Lu} ]*(?!= \p{Lu})/gu,
2395
2392
  ($0) => {
2396
2393
  noFixArr.push(convertAlphavet($0, abc));
2397
2394
  return NOFIX_CHAR;
@@ -2528,7 +2525,7 @@ var trim = mutatingStep(({ text }) => ` ${text.trim()} `);
2528
2525
 
2529
2526
  // src/steps/finalize.ts
2530
2527
  var finalize = (newLine) => mutatingStep(
2531
- ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d+) ", "gu"), "$1").replace(/\n/g, newLine).trim()
2528
+ ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(/ (\p{P}|\p{S}|\d+) /gu, "$1").replace(/\n/g, newLine).trim()
2532
2529
  );
2533
2530
 
2534
2531
  // src/steps/to-lower-case.ts
@@ -2594,13 +2591,5 @@ var html = createPipeline(
2594
2591
  finalize("<br>"),
2595
2592
  highlightDiffStep(htmlWrappers.fix)
2596
2593
  );
2597
- export {
2598
- REPLACE_J,
2599
- TaraskConfig,
2600
- VARIATION,
2601
- dict_exports as dicts,
2602
- lib_exports as lib,
2603
- pipelines_exports as pipelines,
2604
- steps_exports as steps,
2605
- tarask
2606
- };
2594
+
2595
+ export { REPLACE_J, TaraskConfig, VARIATION, dict_exports as dicts, lib_exports as lib, pipelines_exports as pipelines, steps_exports as steps, tarask };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "8.0.4",
3
+ "version": "8.0.6",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,7 +49,7 @@
49
49
  "test": "esrun --send-code-mode=temporaryFile test",
50
50
  "test-cli": "bun run build && esrun --send-code-mode=temporaryFile test",
51
51
  "postinstall": "husky",
52
- "docs": "typedoc --out docs src/index.ts --skipErrorChecking"
52
+ "docs": "typedoc"
53
53
  },
54
54
  "sideEffects": false,
55
55
  "type": "module",