taraskevizer 9.1.15 → 9.2.0

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
@@ -7,7 +7,7 @@ const printWithPrefix = (msg) => {
7
7
  process.argv.splice(0, 2);
8
8
  const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
9
9
  if (checkForOptions(['-v', '--version'])) {
10
- printWithPrefix("9.1.15");
10
+ printWithPrefix("9.2.0");
11
11
  process.exit(0);
12
12
  }
13
13
  if (checkForOptions(['-h', '--help'])) {
@@ -1,6 +1,6 @@
1
1
  const prepositionPattern = /^(?:а[бд]?|б[ея]зь?|[дз]а|д?ля|дзеля|[нп]ад?|пр[аы]|празь?|у|церазь?)$/;
2
2
  const isSingleVowel = (str) => str.match(/[аеёіоуыэюя]/g)?.length === 1;
3
- const isFirstSyllabeStressed = (word) => /^[бвгджзйклмнпрстфцчшўьʼ]*.\u0301/.test(word);
3
+ const isFirstSyllabeStressed = (word) => /^[бвгджзйклмнпхрстфхцчшўьʼ]*.\u0301/.test(word);
4
4
  export const endZSoftenAndNiaBiaz = [
5
5
  [
6
6
  / бе(зь? \S+)/g,
@@ -0,0 +1,3 @@
1
+ import type { ExtendedDict } from './types';
2
+ export declare const replaceWithDict: (text: string, dict: ExtendedDict, regex: RegExp) => string;
3
+ export declare const log: (...msgs: any[]) => any;
@@ -0,0 +1,17 @@
1
+ export const replaceWithDict = (text, dict, regex) => {
2
+ for (const item of dict) {
3
+ const [pattern, result] = item;
4
+ text = text.replace(pattern,
5
+ //@ts-ignore
6
+ result);
7
+ if (regex.test(text)) {
8
+ log('replaceWithDict:', item);
9
+ process.exit(1);
10
+ }
11
+ }
12
+ return text;
13
+ };
14
+ export const log = (...msgs) => {
15
+ console.log('[debug]', ...msgs);
16
+ return msgs[0];
17
+ };
@@ -4,8 +4,10 @@
4
4
  * Used in {@link untrim}.
5
5
  */
6
6
  export type TrimStorage = {
7
- beforeTrim: string;
8
- afterTrim: string;
7
+ trim: {
8
+ before: string;
9
+ after: string;
10
+ };
9
11
  };
10
12
  /**
11
13
  * Captures whitespaces around the text.
@@ -1,9 +1,11 @@
1
1
  import { mutatingStep } from '../lib/index.js';
2
2
 
3
3
  export const trim = mutatingStep(({ text, storage }) => {
4
- storage.beforeTrim = /^\s*/.exec(text)[0];
5
- storage.afterTrim = /\s*$/.exec(text)[0];
4
+ storage.trim = {
5
+ before: /^\s*/.exec(text)[0],
6
+ after: /\s*$/.exec(text)[0],
7
+ };
6
8
  return ` ${text.trim()} `;
7
9
  });
8
10
 
9
- export const untrim = mutatingStep(({ text, storage }) => storage.beforeTrim + text.trim() + storage.afterTrim);
11
+ export const untrim = mutatingStep(({ text, storage: { trim: { before, after }, }, }) => before + text.trim() + after);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "9.1.15",
3
+ "version": "9.2.0",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,12 +10,12 @@
10
10
  "module": "dist/index.js",
11
11
  "devDependencies": {
12
12
  "@digitak/esrun": "^3.2.26",
13
- "@types/node": "^20.16.1",
14
- "bun-types": "^1.1.26",
15
- "husky": "^9.1.5",
13
+ "@types/node": "^20.16.5",
14
+ "bun-types": "^1.1.27",
15
+ "husky": "^9.1.6",
16
16
  "prettier": "^3.3.3",
17
- "typedoc": "^0.25.13",
18
- "typescript": "^5.5.4"
17
+ "typedoc": "^0.26.7",
18
+ "typescript": "^5.6.2"
19
19
  },
20
20
  "bin": {
21
21
  "tarask": "dist/bin.js"
@@ -36,7 +36,7 @@
36
36
  "license": "MIT",
37
37
  "private": false,
38
38
  "scripts": {
39
- "build": "tsc --project src/tsconfig.json && bun ./afterbuild.js",
39
+ "build": "bun ./build.ts",
40
40
  "prettier": "prettier --write .",
41
41
  "dev": "esrun --watch=src/*,test/* --send-code-mode=temporaryFile test",
42
42
  "dev:bun": "bun test --watch",