taraskevizer 10.0.0-alpha.0 → 10.0.0-alpha.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/dist/bin.js +4 -4
- package/dist/config.d.ts +3 -3
- package/dist/config.js +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/steps/apply-g.js +2 -2
- package/dist/steps/apply-variations.js +1 -1
- package/dist/steps/highlight-diff.js +3 -3
- package/dist/wrappers.d.ts +3 -3
- package/package.json +1 -1
- package/dist/constants.d.ts +0 -29
- package/dist/constants.js +0 -12
package/dist/bin.js
CHANGED
|
@@ -6,7 +6,7 @@ const printWithPrefix = (msg) => {
|
|
|
6
6
|
process.argv.splice(0, 2);
|
|
7
7
|
const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
|
|
8
8
|
if (checkForOptions(['-v', '--version'])) {
|
|
9
|
-
printWithPrefix("10.0.0-alpha.
|
|
9
|
+
printWithPrefix("10.0.0-alpha.2");
|
|
10
10
|
process.exit(0);
|
|
11
11
|
}
|
|
12
12
|
if (checkForOptions(['-h', '--help'])) {
|
|
@@ -61,7 +61,7 @@ OPTIONS
|
|
|
61
61
|
let cfg = {
|
|
62
62
|
g: true,
|
|
63
63
|
variations: 'all',
|
|
64
|
-
|
|
64
|
+
wrappers: wrappers.ansiColor,
|
|
65
65
|
};
|
|
66
66
|
let mode = 'tarask';
|
|
67
67
|
const toHashTable = (dict) => {
|
|
@@ -131,7 +131,7 @@ const optionDict = toHashTable([
|
|
|
131
131
|
[
|
|
132
132
|
['--no-color', '-nc'],
|
|
133
133
|
() => {
|
|
134
|
-
cfg.
|
|
134
|
+
cfg.wrappers = null;
|
|
135
135
|
},
|
|
136
136
|
],
|
|
137
137
|
[
|
|
@@ -192,7 +192,7 @@ cfg = new TaraskConfig(isHtml
|
|
|
192
192
|
? {
|
|
193
193
|
...htmlConfigOptions,
|
|
194
194
|
...cfg,
|
|
195
|
-
|
|
195
|
+
wrappers: htmlConfigOptions.wrappers,
|
|
196
196
|
}
|
|
197
197
|
: cfg);
|
|
198
198
|
if (process.stdout.write(pipelines[mode](text, cfg) + '\n')) {
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PartialReadonly } from './types';
|
|
2
2
|
import type { Alphabet } from './dict/alphabets';
|
|
3
|
-
import { type
|
|
3
|
+
import { type Wrappers } from './wrappers';
|
|
4
4
|
export type Variation = 'no' | 'first' | 'all';
|
|
5
5
|
export type OptionJ = 'never' | 'random' | 'always';
|
|
6
6
|
export declare class TaraskConfig {
|
|
@@ -38,7 +38,7 @@ export declare class TaraskConfig {
|
|
|
38
38
|
*
|
|
39
39
|
* @default null
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
wrappers: null | Wrappers;
|
|
42
42
|
/**
|
|
43
43
|
* Do replace ґ(g) by г(h) in cyrillic alphabet?
|
|
44
44
|
*
|
|
@@ -88,7 +88,7 @@ export declare class TaraskConfig {
|
|
|
88
88
|
* });
|
|
89
89
|
*/
|
|
90
90
|
export declare const htmlConfigOptions: {
|
|
91
|
-
readonly
|
|
91
|
+
readonly wrappers: Required<Wrappers>;
|
|
92
92
|
readonly g: false;
|
|
93
93
|
readonly newLine: "<br>";
|
|
94
94
|
readonly leftAngleBracket: "<";
|
package/dist/config.js
CHANGED
|
@@ -15,7 +15,7 @@ export class TaraskConfig {
|
|
|
15
15
|
|
|
16
16
|
doEscapeCapitalized = true;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
wrappers = null;
|
|
19
19
|
|
|
20
20
|
g = true;
|
|
21
21
|
|
|
@@ -27,7 +27,7 @@ export class TaraskConfig {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export const htmlConfigOptions = {
|
|
30
|
-
|
|
30
|
+
wrappers: html,
|
|
31
31
|
g: false,
|
|
32
32
|
newLine: '<br>',
|
|
33
33
|
leftAngleBracket: '<',
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/steps/apply-g.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { replaceG } from '../lib/index.js';
|
|
2
2
|
import { alphabets, gobj } from '../dict/index.js';
|
|
3
3
|
export const applyG = (ctx) => {
|
|
4
|
-
const { abc, g,
|
|
5
|
-
const wrap =
|
|
4
|
+
const { abc, g, wrappers } = ctx.cfg;
|
|
5
|
+
const wrap = wrappers?.letterH;
|
|
6
6
|
if (abc === alphabets.cyrillic && (wrap || !g))
|
|
7
7
|
ctx.text = replaceG(wrap ? (g ? wrap('$&') : ($0) => wrap(gobj[$0])) : ($0) => gobj[$0])(ctx.text);
|
|
8
8
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { mutatingStep } from '../lib/index.js';
|
|
2
2
|
import { defaultVariation } from '../wrappers.js';
|
|
3
|
-
export const applyVariations = mutatingStep(({ text, cfg: {
|
|
3
|
+
export const applyVariations = mutatingStep(({ text, cfg: { wrappers, variations } }) => text.replace(/\([^)]*?\)/g, (wrappers?.variable || defaultVariation)[variations]));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { highlightDiff } from '../lib/index.js';
|
|
2
2
|
import { alphabets } from '../dict/index.js';
|
|
3
3
|
|
|
4
|
-
export const highlightDiffStep = ({ cfg: { abc,
|
|
5
|
-
if (
|
|
6
|
-
highlightDiff(textArr, origArr, abc === alphabets.cyrillic,
|
|
4
|
+
export const highlightDiffStep = ({ cfg: { abc, wrappers }, storage: { textArr, origArr }, }) => {
|
|
5
|
+
if (wrappers?.fix)
|
|
6
|
+
highlightDiff(textArr, origArr, abc === alphabets.cyrillic, wrappers.fix);
|
|
7
7
|
};
|
package/dist/wrappers.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ type TransformString = (content: string) => string;
|
|
|
3
3
|
export type VariationWrappers = {
|
|
4
4
|
[p in Variation]: TransformString;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
6
|
+
export type Wrappers = {
|
|
7
7
|
fix?: TransformString;
|
|
8
8
|
variable?: VariationWrappers;
|
|
9
9
|
letterH?: TransformString;
|
|
10
10
|
};
|
|
11
11
|
export declare const defaultVariation: VariationWrappers;
|
|
12
|
-
export declare const html: Required<
|
|
13
|
-
export declare const ansiColor: Required<
|
|
12
|
+
export declare const html: Required<Wrappers>;
|
|
13
|
+
export declare const ansiColor: Required<Wrappers>;
|
|
14
14
|
export {};
|
package/package.json
CHANGED
package/dist/constants.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { OptionJ, Variation } from './config';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated since 9.1.0. Will be removed in 10.0.0
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* {
|
|
7
|
-
* // deprecated
|
|
8
|
-
* j: REPLACE_J.NEVER
|
|
9
|
-
* // use this instead
|
|
10
|
-
* j: "never"
|
|
11
|
-
* }
|
|
12
|
-
*/
|
|
13
|
-
export declare const REPLACE_J: {
|
|
14
|
-
[P in Uppercase<OptionJ>]: Lowercase<P>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated since 9.1.0. Will be removed in 10.0.0
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* {
|
|
21
|
-
* // deprecated
|
|
22
|
-
* variations: VARIATION.NO
|
|
23
|
-
* // use this instead
|
|
24
|
-
* variations: "no"
|
|
25
|
-
* }
|
|
26
|
-
*/
|
|
27
|
-
export declare const VARIATION: {
|
|
28
|
-
[P in Uppercase<Variation>]: Lowercase<P>;
|
|
29
|
-
};
|