langsmith 0.5.15 → 0.5.17
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 +2 -2
- package/dist/client.cjs +116 -143
- package/dist/client.d.ts +19 -40
- package/dist/client.js +116 -143
- package/dist/experimental/anthropic/index.cjs +4 -1
- package/dist/experimental/anthropic/index.js +4 -1
- package/dist/experimental/vercel/index.cjs +1 -0
- package/dist/experimental/vercel/index.js +1 -0
- package/dist/experimental/vercel/middleware.cjs +2 -0
- package/dist/experimental/vercel/middleware.js +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/schemas.d.ts +1 -3
- package/dist/utils/chalk/source/index.cjs +187 -0
- package/dist/utils/chalk/source/index.d.ts +19 -0
- package/dist/utils/chalk/source/index.js +173 -0
- package/dist/utils/chalk/source/utilities.cjs +35 -0
- package/dist/utils/chalk/source/utilities.d.ts +2 -0
- package/dist/utils/chalk/source/utilities.js +31 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.cjs +193 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.d.ts +58 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.js +190 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.cjs +31 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.d.ts +15 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.js +29 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.cjs +155 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.d.ts +21 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.js +149 -0
- package/dist/utils/console-table-printer/index.cjs +11 -0
- package/dist/utils/console-table-printer/index.d.ts +4 -0
- package/dist/utils/console-table-printer/index.js +3 -0
- package/dist/utils/console-table-printer/src/console-table-printer.cjs +42 -0
- package/dist/utils/console-table-printer/src/console-table-printer.d.ts +14 -0
- package/dist/utils/console-table-printer/src/console-table-printer.js +36 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.cjs +25 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.d.ts +6 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.js +20 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.cjs +142 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.d.ts +6 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.js +133 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.cjs +186 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.d.ts +31 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.js +184 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.cjs +53 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.d.ts +3 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.js +48 -0
- package/dist/utils/console-table-printer/src/models/common.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/common.d.ts +14 -0
- package/dist/utils/console-table-printer/src/models/common.js +1 -0
- package/dist/utils/console-table-printer/src/models/external-table.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/external-table.d.ts +99 -0
- package/dist/utils/console-table-printer/src/models/external-table.js +1 -0
- package/dist/utils/console-table-printer/src/models/internal-table.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/internal-table.d.ts +24 -0
- package/dist/utils/console-table-printer/src/models/internal-table.js +1 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.cjs +43 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.d.ts +12 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.js +39 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.cjs +23 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.d.ts +3 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.js +18 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.cjs +68 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.d.ts +4 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.js +62 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.cjs +55 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.d.ts +11 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.js +52 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.cjs +101 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.d.ts +29 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.js +88 -0
- package/dist/utils/fs.d.ts +1 -1
- package/dist/utils/jestlike/reporter.cjs +23 -23
- package/dist/utils/jestlike/reporter.js +2 -2
- package/dist/utils/prompts.cjs +0 -10
- package/dist/utils/prompts.d.ts +0 -1
- package/dist/utils/prompts.js +0 -9
- package/dist/utils/simple-wcswidth/index.cjs +10 -0
- package/dist/utils/simple-wcswidth/index.d.ts +3 -0
- package/dist/utils/simple-wcswidth/index.js +3 -0
- package/dist/utils/simple-wcswidth/src/binary-search.cjs +24 -0
- package/dist/utils/simple-wcswidth/src/binary-search.d.ts +3 -0
- package/dist/utils/simple-wcswidth/src/binary-search.js +22 -0
- package/dist/utils/simple-wcswidth/src/models.cjs +2 -0
- package/dist/utils/simple-wcswidth/src/models.d.ts +4 -0
- package/dist/utils/simple-wcswidth/src/models.js +1 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.cjs +149 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.d.ts +3 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.js +147 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.cjs +20 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.d.ts +2 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.js +15 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.cjs +67 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.d.ts +2 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.js +62 -0
- package/dist/wrappers/anthropic.cjs +4 -0
- package/dist/wrappers/anthropic.d.ts +1 -0
- package/dist/wrappers/anthropic.js +4 -0
- package/package.json +20 -19
|
@@ -37,8 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.printReporterTable = printReporterTable;
|
|
40
|
-
const
|
|
41
|
-
const
|
|
40
|
+
const index_js_1 = require("../console-table-printer/index.cjs");
|
|
41
|
+
const index_js_2 = __importDefault(require("../chalk/source/index.cjs"));
|
|
42
42
|
const os = __importStar(require("node:os"));
|
|
43
43
|
const path = __importStar(require("node:path"));
|
|
44
44
|
const fs = __importStar(require("node:fs/promises"));
|
|
@@ -64,13 +64,13 @@ function formatTestName(name, duration) {
|
|
|
64
64
|
function getFormattedStatus(status) {
|
|
65
65
|
const s = status.toLowerCase();
|
|
66
66
|
if (s === "pending" || s === "skipped") {
|
|
67
|
-
return
|
|
67
|
+
return index_js_2.default.yellow("○ Skipped");
|
|
68
68
|
}
|
|
69
69
|
else if (s.includes("pass")) {
|
|
70
|
-
return
|
|
70
|
+
return index_js_2.default.green("✓ Passed");
|
|
71
71
|
}
|
|
72
72
|
else if (s.includes("fail")) {
|
|
73
|
-
return
|
|
73
|
+
return index_js_2.default.red("✕ Failed");
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
76
|
return status;
|
|
@@ -198,32 +198,32 @@ async function printReporterTable(testSuiteName, results, testStatus, failureMes
|
|
|
198
198
|
let coloredKey;
|
|
199
199
|
let coloredScore;
|
|
200
200
|
if (isNaN(deviation)) {
|
|
201
|
-
coloredKey =
|
|
202
|
-
coloredScore =
|
|
201
|
+
coloredKey = index_js_2.default.white(`${key}:`);
|
|
202
|
+
coloredScore = index_js_2.default.white(score);
|
|
203
203
|
}
|
|
204
204
|
else if (deviation <= -1) {
|
|
205
|
-
coloredKey =
|
|
206
|
-
coloredScore =
|
|
205
|
+
coloredKey = index_js_2.default.redBright(`${key}:`);
|
|
206
|
+
coloredScore = index_js_2.default.redBright(score);
|
|
207
207
|
}
|
|
208
208
|
else if (deviation < -0.5) {
|
|
209
|
-
coloredKey =
|
|
210
|
-
coloredScore =
|
|
209
|
+
coloredKey = index_js_2.default.red(`${key}:`);
|
|
210
|
+
coloredScore = index_js_2.default.red(score);
|
|
211
211
|
}
|
|
212
212
|
else if (deviation < 0) {
|
|
213
|
-
coloredKey =
|
|
214
|
-
coloredScore =
|
|
213
|
+
coloredKey = index_js_2.default.yellow(`${key}:`);
|
|
214
|
+
coloredScore = index_js_2.default.yellow(score);
|
|
215
215
|
}
|
|
216
216
|
else if (deviation === 0) {
|
|
217
|
-
coloredKey =
|
|
218
|
-
coloredScore =
|
|
217
|
+
coloredKey = index_js_2.default.white(`${key}:`);
|
|
218
|
+
coloredScore = index_js_2.default.white(score);
|
|
219
219
|
}
|
|
220
220
|
else if (deviation <= 0.5) {
|
|
221
|
-
coloredKey =
|
|
222
|
-
coloredScore =
|
|
221
|
+
coloredKey = index_js_2.default.green(`${key}:`);
|
|
222
|
+
coloredScore = index_js_2.default.green(score);
|
|
223
223
|
}
|
|
224
224
|
else {
|
|
225
|
-
coloredKey =
|
|
226
|
-
coloredScore =
|
|
225
|
+
coloredKey = index_js_2.default.greenBright(`${key}:`);
|
|
226
|
+
coloredScore = index_js_2.default.greenBright(score);
|
|
227
227
|
}
|
|
228
228
|
if (collapseFeedbackColumn) {
|
|
229
229
|
delete row[0][key];
|
|
@@ -266,7 +266,7 @@ async function printReporterTable(testSuiteName, results, testStatus, failureMes
|
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
console.log();
|
|
269
|
-
const table = new
|
|
269
|
+
const table = new index_js_1.Table({
|
|
270
270
|
columns: defaultColumns,
|
|
271
271
|
colorMap: {
|
|
272
272
|
grey: "\x1b[90m",
|
|
@@ -276,10 +276,10 @@ async function printReporterTable(testSuiteName, results, testStatus, failureMes
|
|
|
276
276
|
table.addRow(row[0], row[1]);
|
|
277
277
|
}
|
|
278
278
|
const testStatusColor = testStatus.includes("pass")
|
|
279
|
-
?
|
|
279
|
+
? index_js_2.default.green
|
|
280
280
|
: testStatus.includes("fail")
|
|
281
|
-
?
|
|
282
|
-
:
|
|
281
|
+
? index_js_2.default.red
|
|
282
|
+
: index_js_2.default.yellow;
|
|
283
283
|
if (testSuiteName) {
|
|
284
284
|
console.log(testStatusColor(`› ${testSuiteName}`));
|
|
285
285
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Table } from "console-table-printer";
|
|
2
|
-
import chalk from "chalk";
|
|
1
|
+
import { Table } from "../console-table-printer/index.js";
|
|
2
|
+
import chalk from "../chalk/source/index.js";
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import * as fs from "node:fs/promises";
|
package/dist/utils/prompts.cjs
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isVersionGreaterOrEqual = isVersionGreaterOrEqual;
|
|
4
3
|
exports.parsePromptIdentifier = parsePromptIdentifier;
|
|
5
|
-
const semver_1 = require("semver");
|
|
6
4
|
const error_js_1 = require("./error.cjs");
|
|
7
|
-
function isVersionGreaterOrEqual(current_version, target_version) {
|
|
8
|
-
const current = (0, semver_1.parse)(current_version);
|
|
9
|
-
const target = (0, semver_1.parse)(target_version);
|
|
10
|
-
if (!current || !target) {
|
|
11
|
-
throw new Error("Invalid version format.");
|
|
12
|
-
}
|
|
13
|
-
return current.compare(target) >= 0;
|
|
14
|
-
}
|
|
15
5
|
function parsePromptIdentifier(identifier) {
|
|
16
6
|
if (!identifier ||
|
|
17
7
|
identifier.split("/").length > 2 ||
|
package/dist/utils/prompts.d.ts
CHANGED
package/dist/utils/prompts.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { parse as parseVersion } from "semver";
|
|
2
1
|
import { getInvalidPromptIdentifierMsg } from "./error.js";
|
|
3
|
-
export function isVersionGreaterOrEqual(current_version, target_version) {
|
|
4
|
-
const current = parseVersion(current_version);
|
|
5
|
-
const target = parseVersion(target_version);
|
|
6
|
-
if (!current || !target) {
|
|
7
|
-
throw new Error("Invalid version format.");
|
|
8
|
-
}
|
|
9
|
-
return current.compare(target) >= 0;
|
|
10
|
-
}
|
|
11
2
|
export function parsePromptIdentifier(identifier) {
|
|
12
3
|
if (!identifier ||
|
|
13
4
|
identifier.split("/").length > 2 ||
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.wcswidth = exports.wcwidth = void 0;
|
|
7
|
+
const wcswidth_js_1 = __importDefault(require("./src/wcswidth.cjs"));
|
|
8
|
+
exports.wcswidth = wcswidth_js_1.default;
|
|
9
|
+
const wcwidth_js_1 = __importDefault(require("./src/wcwidth.cjs"));
|
|
10
|
+
exports.wcwidth = wcwidth_js_1.default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* auxiliary function for binary search in interval table */
|
|
4
|
+
const bisearch = (ucs, table, tableSize) => {
|
|
5
|
+
let min = 0;
|
|
6
|
+
let mid;
|
|
7
|
+
let max = tableSize;
|
|
8
|
+
if (ucs < table[0].first || ucs > table[max].last)
|
|
9
|
+
return 0;
|
|
10
|
+
while (max >= min) {
|
|
11
|
+
mid = Math.floor((min + max) / 2);
|
|
12
|
+
if (ucs > table[mid].last) {
|
|
13
|
+
min = mid + 1;
|
|
14
|
+
}
|
|
15
|
+
else if (ucs < table[mid].first) {
|
|
16
|
+
max = mid - 1;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return 0;
|
|
23
|
+
};
|
|
24
|
+
exports.default = bisearch;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* auxiliary function for binary search in interval table */
|
|
2
|
+
const bisearch = (ucs, table, tableSize) => {
|
|
3
|
+
let min = 0;
|
|
4
|
+
let mid;
|
|
5
|
+
let max = tableSize;
|
|
6
|
+
if (ucs < table[0].first || ucs > table[max].last)
|
|
7
|
+
return 0;
|
|
8
|
+
while (max >= min) {
|
|
9
|
+
mid = Math.floor((min + max) / 2);
|
|
10
|
+
if (ucs > table[mid].last) {
|
|
11
|
+
min = mid + 1;
|
|
12
|
+
}
|
|
13
|
+
else if (ucs < table[mid].first) {
|
|
14
|
+
max = mid - 1;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return 0;
|
|
21
|
+
};
|
|
22
|
+
export default bisearch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* sorted list of non-overlapping intervals of non-spacing characters */
|
|
4
|
+
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
|
|
5
|
+
const combining = [
|
|
6
|
+
{ first: 0x0300, last: 0x036f },
|
|
7
|
+
{ first: 0x0483, last: 0x0486 },
|
|
8
|
+
{ first: 0x0488, last: 0x0489 },
|
|
9
|
+
{ first: 0x0591, last: 0x05bd },
|
|
10
|
+
{ first: 0x05bf, last: 0x05bf },
|
|
11
|
+
{ first: 0x05c1, last: 0x05c2 },
|
|
12
|
+
{ first: 0x05c4, last: 0x05c5 },
|
|
13
|
+
{ first: 0x05c7, last: 0x05c7 },
|
|
14
|
+
{ first: 0x0600, last: 0x0603 },
|
|
15
|
+
{ first: 0x0610, last: 0x0615 },
|
|
16
|
+
{ first: 0x064b, last: 0x065e },
|
|
17
|
+
{ first: 0x0670, last: 0x0670 },
|
|
18
|
+
{ first: 0x06d6, last: 0x06e4 },
|
|
19
|
+
{ first: 0x06e7, last: 0x06e8 },
|
|
20
|
+
{ first: 0x06ea, last: 0x06ed },
|
|
21
|
+
{ first: 0x070f, last: 0x070f },
|
|
22
|
+
{ first: 0x0711, last: 0x0711 },
|
|
23
|
+
{ first: 0x0730, last: 0x074a },
|
|
24
|
+
{ first: 0x07a6, last: 0x07b0 },
|
|
25
|
+
{ first: 0x07eb, last: 0x07f3 },
|
|
26
|
+
{ first: 0x0901, last: 0x0902 },
|
|
27
|
+
{ first: 0x093c, last: 0x093c },
|
|
28
|
+
{ first: 0x0941, last: 0x0948 },
|
|
29
|
+
{ first: 0x094d, last: 0x094d },
|
|
30
|
+
{ first: 0x0951, last: 0x0954 },
|
|
31
|
+
{ first: 0x0962, last: 0x0963 },
|
|
32
|
+
{ first: 0x0981, last: 0x0981 },
|
|
33
|
+
{ first: 0x09bc, last: 0x09bc },
|
|
34
|
+
{ first: 0x09c1, last: 0x09c4 },
|
|
35
|
+
{ first: 0x09cd, last: 0x09cd },
|
|
36
|
+
{ first: 0x09e2, last: 0x09e3 },
|
|
37
|
+
{ first: 0x0a01, last: 0x0a02 },
|
|
38
|
+
{ first: 0x0a3c, last: 0x0a3c },
|
|
39
|
+
{ first: 0x0a41, last: 0x0a42 },
|
|
40
|
+
{ first: 0x0a47, last: 0x0a48 },
|
|
41
|
+
{ first: 0x0a4b, last: 0x0a4d },
|
|
42
|
+
{ first: 0x0a70, last: 0x0a71 },
|
|
43
|
+
{ first: 0x0a81, last: 0x0a82 },
|
|
44
|
+
{ first: 0x0abc, last: 0x0abc },
|
|
45
|
+
{ first: 0x0ac1, last: 0x0ac5 },
|
|
46
|
+
{ first: 0x0ac7, last: 0x0ac8 },
|
|
47
|
+
{ first: 0x0acd, last: 0x0acd },
|
|
48
|
+
{ first: 0x0ae2, last: 0x0ae3 },
|
|
49
|
+
{ first: 0x0b01, last: 0x0b01 },
|
|
50
|
+
{ first: 0x0b3c, last: 0x0b3c },
|
|
51
|
+
{ first: 0x0b3f, last: 0x0b3f },
|
|
52
|
+
{ first: 0x0b41, last: 0x0b43 },
|
|
53
|
+
{ first: 0x0b4d, last: 0x0b4d },
|
|
54
|
+
{ first: 0x0b56, last: 0x0b56 },
|
|
55
|
+
{ first: 0x0b82, last: 0x0b82 },
|
|
56
|
+
{ first: 0x0bc0, last: 0x0bc0 },
|
|
57
|
+
{ first: 0x0bcd, last: 0x0bcd },
|
|
58
|
+
{ first: 0x0c3e, last: 0x0c40 },
|
|
59
|
+
{ first: 0x0c46, last: 0x0c48 },
|
|
60
|
+
{ first: 0x0c4a, last: 0x0c4d },
|
|
61
|
+
{ first: 0x0c55, last: 0x0c56 },
|
|
62
|
+
{ first: 0x0cbc, last: 0x0cbc },
|
|
63
|
+
{ first: 0x0cbf, last: 0x0cbf },
|
|
64
|
+
{ first: 0x0cc6, last: 0x0cc6 },
|
|
65
|
+
{ first: 0x0ccc, last: 0x0ccd },
|
|
66
|
+
{ first: 0x0ce2, last: 0x0ce3 },
|
|
67
|
+
{ first: 0x0d41, last: 0x0d43 },
|
|
68
|
+
{ first: 0x0d4d, last: 0x0d4d },
|
|
69
|
+
{ first: 0x0dca, last: 0x0dca },
|
|
70
|
+
{ first: 0x0dd2, last: 0x0dd4 },
|
|
71
|
+
{ first: 0x0dd6, last: 0x0dd6 },
|
|
72
|
+
{ first: 0x0e31, last: 0x0e31 },
|
|
73
|
+
{ first: 0x0e34, last: 0x0e3a },
|
|
74
|
+
{ first: 0x0e47, last: 0x0e4e },
|
|
75
|
+
{ first: 0x0eb1, last: 0x0eb1 },
|
|
76
|
+
{ first: 0x0eb4, last: 0x0eb9 },
|
|
77
|
+
{ first: 0x0ebb, last: 0x0ebc },
|
|
78
|
+
{ first: 0x0ec8, last: 0x0ecd },
|
|
79
|
+
{ first: 0x0f18, last: 0x0f19 },
|
|
80
|
+
{ first: 0x0f35, last: 0x0f35 },
|
|
81
|
+
{ first: 0x0f37, last: 0x0f37 },
|
|
82
|
+
{ first: 0x0f39, last: 0x0f39 },
|
|
83
|
+
{ first: 0x0f71, last: 0x0f7e },
|
|
84
|
+
{ first: 0x0f80, last: 0x0f84 },
|
|
85
|
+
{ first: 0x0f86, last: 0x0f87 },
|
|
86
|
+
{ first: 0x0f90, last: 0x0f97 },
|
|
87
|
+
{ first: 0x0f99, last: 0x0fbc },
|
|
88
|
+
{ first: 0x0fc6, last: 0x0fc6 },
|
|
89
|
+
{ first: 0x102d, last: 0x1030 },
|
|
90
|
+
{ first: 0x1032, last: 0x1032 },
|
|
91
|
+
{ first: 0x1036, last: 0x1037 },
|
|
92
|
+
{ first: 0x1039, last: 0x1039 },
|
|
93
|
+
{ first: 0x1058, last: 0x1059 },
|
|
94
|
+
{ first: 0x1160, last: 0x11ff },
|
|
95
|
+
{ first: 0x135f, last: 0x135f },
|
|
96
|
+
{ first: 0x1712, last: 0x1714 },
|
|
97
|
+
{ first: 0x1732, last: 0x1734 },
|
|
98
|
+
{ first: 0x1752, last: 0x1753 },
|
|
99
|
+
{ first: 0x1772, last: 0x1773 },
|
|
100
|
+
{ first: 0x17b4, last: 0x17b5 },
|
|
101
|
+
{ first: 0x17b7, last: 0x17bd },
|
|
102
|
+
{ first: 0x17c6, last: 0x17c6 },
|
|
103
|
+
{ first: 0x17c9, last: 0x17d3 },
|
|
104
|
+
{ first: 0x17dd, last: 0x17dd },
|
|
105
|
+
{ first: 0x180b, last: 0x180d },
|
|
106
|
+
{ first: 0x18a9, last: 0x18a9 },
|
|
107
|
+
{ first: 0x1920, last: 0x1922 },
|
|
108
|
+
{ first: 0x1927, last: 0x1928 },
|
|
109
|
+
{ first: 0x1932, last: 0x1932 },
|
|
110
|
+
{ first: 0x1939, last: 0x193b },
|
|
111
|
+
{ first: 0x1a17, last: 0x1a18 },
|
|
112
|
+
{ first: 0x1b00, last: 0x1b03 },
|
|
113
|
+
{ first: 0x1b34, last: 0x1b34 },
|
|
114
|
+
{ first: 0x1b36, last: 0x1b3a },
|
|
115
|
+
{ first: 0x1b3c, last: 0x1b3c },
|
|
116
|
+
{ first: 0x1b42, last: 0x1b42 },
|
|
117
|
+
{ first: 0x1b6b, last: 0x1b73 },
|
|
118
|
+
{ first: 0x1dc0, last: 0x1dca },
|
|
119
|
+
{ first: 0x1dfe, last: 0x1dff },
|
|
120
|
+
{ first: 0x200b, last: 0x200f },
|
|
121
|
+
{ first: 0x202a, last: 0x202e },
|
|
122
|
+
{ first: 0x2060, last: 0x2063 },
|
|
123
|
+
{ first: 0x206a, last: 0x206f },
|
|
124
|
+
{ first: 0x20d0, last: 0x20ef },
|
|
125
|
+
{ first: 0x302a, last: 0x302f },
|
|
126
|
+
{ first: 0x3099, last: 0x309a },
|
|
127
|
+
{ first: 0xa806, last: 0xa806 },
|
|
128
|
+
{ first: 0xa80b, last: 0xa80b },
|
|
129
|
+
{ first: 0xa825, last: 0xa826 },
|
|
130
|
+
{ first: 0xfb1e, last: 0xfb1e },
|
|
131
|
+
{ first: 0xfe00, last: 0xfe0f },
|
|
132
|
+
{ first: 0xfe20, last: 0xfe23 },
|
|
133
|
+
{ first: 0xfeff, last: 0xfeff },
|
|
134
|
+
{ first: 0xfff9, last: 0xfffb },
|
|
135
|
+
{ first: 0x10a01, last: 0x10a03 },
|
|
136
|
+
{ first: 0x10a05, last: 0x10a06 },
|
|
137
|
+
{ first: 0x10a0c, last: 0x10a0f },
|
|
138
|
+
{ first: 0x10a38, last: 0x10a3a },
|
|
139
|
+
{ first: 0x10a3f, last: 0x10a3f },
|
|
140
|
+
{ first: 0x1d167, last: 0x1d169 },
|
|
141
|
+
{ first: 0x1d173, last: 0x1d182 },
|
|
142
|
+
{ first: 0x1d185, last: 0x1d18b },
|
|
143
|
+
{ first: 0x1d1aa, last: 0x1d1ad },
|
|
144
|
+
{ first: 0x1d242, last: 0x1d244 },
|
|
145
|
+
{ first: 0xe0001, last: 0xe0001 },
|
|
146
|
+
{ first: 0xe0020, last: 0xe007f },
|
|
147
|
+
{ first: 0xe0100, last: 0xe01ef },
|
|
148
|
+
];
|
|
149
|
+
exports.default = combining;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* sorted list of non-overlapping intervals of non-spacing characters */
|
|
2
|
+
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
|
|
3
|
+
const combining = [
|
|
4
|
+
{ first: 0x0300, last: 0x036f },
|
|
5
|
+
{ first: 0x0483, last: 0x0486 },
|
|
6
|
+
{ first: 0x0488, last: 0x0489 },
|
|
7
|
+
{ first: 0x0591, last: 0x05bd },
|
|
8
|
+
{ first: 0x05bf, last: 0x05bf },
|
|
9
|
+
{ first: 0x05c1, last: 0x05c2 },
|
|
10
|
+
{ first: 0x05c4, last: 0x05c5 },
|
|
11
|
+
{ first: 0x05c7, last: 0x05c7 },
|
|
12
|
+
{ first: 0x0600, last: 0x0603 },
|
|
13
|
+
{ first: 0x0610, last: 0x0615 },
|
|
14
|
+
{ first: 0x064b, last: 0x065e },
|
|
15
|
+
{ first: 0x0670, last: 0x0670 },
|
|
16
|
+
{ first: 0x06d6, last: 0x06e4 },
|
|
17
|
+
{ first: 0x06e7, last: 0x06e8 },
|
|
18
|
+
{ first: 0x06ea, last: 0x06ed },
|
|
19
|
+
{ first: 0x070f, last: 0x070f },
|
|
20
|
+
{ first: 0x0711, last: 0x0711 },
|
|
21
|
+
{ first: 0x0730, last: 0x074a },
|
|
22
|
+
{ first: 0x07a6, last: 0x07b0 },
|
|
23
|
+
{ first: 0x07eb, last: 0x07f3 },
|
|
24
|
+
{ first: 0x0901, last: 0x0902 },
|
|
25
|
+
{ first: 0x093c, last: 0x093c },
|
|
26
|
+
{ first: 0x0941, last: 0x0948 },
|
|
27
|
+
{ first: 0x094d, last: 0x094d },
|
|
28
|
+
{ first: 0x0951, last: 0x0954 },
|
|
29
|
+
{ first: 0x0962, last: 0x0963 },
|
|
30
|
+
{ first: 0x0981, last: 0x0981 },
|
|
31
|
+
{ first: 0x09bc, last: 0x09bc },
|
|
32
|
+
{ first: 0x09c1, last: 0x09c4 },
|
|
33
|
+
{ first: 0x09cd, last: 0x09cd },
|
|
34
|
+
{ first: 0x09e2, last: 0x09e3 },
|
|
35
|
+
{ first: 0x0a01, last: 0x0a02 },
|
|
36
|
+
{ first: 0x0a3c, last: 0x0a3c },
|
|
37
|
+
{ first: 0x0a41, last: 0x0a42 },
|
|
38
|
+
{ first: 0x0a47, last: 0x0a48 },
|
|
39
|
+
{ first: 0x0a4b, last: 0x0a4d },
|
|
40
|
+
{ first: 0x0a70, last: 0x0a71 },
|
|
41
|
+
{ first: 0x0a81, last: 0x0a82 },
|
|
42
|
+
{ first: 0x0abc, last: 0x0abc },
|
|
43
|
+
{ first: 0x0ac1, last: 0x0ac5 },
|
|
44
|
+
{ first: 0x0ac7, last: 0x0ac8 },
|
|
45
|
+
{ first: 0x0acd, last: 0x0acd },
|
|
46
|
+
{ first: 0x0ae2, last: 0x0ae3 },
|
|
47
|
+
{ first: 0x0b01, last: 0x0b01 },
|
|
48
|
+
{ first: 0x0b3c, last: 0x0b3c },
|
|
49
|
+
{ first: 0x0b3f, last: 0x0b3f },
|
|
50
|
+
{ first: 0x0b41, last: 0x0b43 },
|
|
51
|
+
{ first: 0x0b4d, last: 0x0b4d },
|
|
52
|
+
{ first: 0x0b56, last: 0x0b56 },
|
|
53
|
+
{ first: 0x0b82, last: 0x0b82 },
|
|
54
|
+
{ first: 0x0bc0, last: 0x0bc0 },
|
|
55
|
+
{ first: 0x0bcd, last: 0x0bcd },
|
|
56
|
+
{ first: 0x0c3e, last: 0x0c40 },
|
|
57
|
+
{ first: 0x0c46, last: 0x0c48 },
|
|
58
|
+
{ first: 0x0c4a, last: 0x0c4d },
|
|
59
|
+
{ first: 0x0c55, last: 0x0c56 },
|
|
60
|
+
{ first: 0x0cbc, last: 0x0cbc },
|
|
61
|
+
{ first: 0x0cbf, last: 0x0cbf },
|
|
62
|
+
{ first: 0x0cc6, last: 0x0cc6 },
|
|
63
|
+
{ first: 0x0ccc, last: 0x0ccd },
|
|
64
|
+
{ first: 0x0ce2, last: 0x0ce3 },
|
|
65
|
+
{ first: 0x0d41, last: 0x0d43 },
|
|
66
|
+
{ first: 0x0d4d, last: 0x0d4d },
|
|
67
|
+
{ first: 0x0dca, last: 0x0dca },
|
|
68
|
+
{ first: 0x0dd2, last: 0x0dd4 },
|
|
69
|
+
{ first: 0x0dd6, last: 0x0dd6 },
|
|
70
|
+
{ first: 0x0e31, last: 0x0e31 },
|
|
71
|
+
{ first: 0x0e34, last: 0x0e3a },
|
|
72
|
+
{ first: 0x0e47, last: 0x0e4e },
|
|
73
|
+
{ first: 0x0eb1, last: 0x0eb1 },
|
|
74
|
+
{ first: 0x0eb4, last: 0x0eb9 },
|
|
75
|
+
{ first: 0x0ebb, last: 0x0ebc },
|
|
76
|
+
{ first: 0x0ec8, last: 0x0ecd },
|
|
77
|
+
{ first: 0x0f18, last: 0x0f19 },
|
|
78
|
+
{ first: 0x0f35, last: 0x0f35 },
|
|
79
|
+
{ first: 0x0f37, last: 0x0f37 },
|
|
80
|
+
{ first: 0x0f39, last: 0x0f39 },
|
|
81
|
+
{ first: 0x0f71, last: 0x0f7e },
|
|
82
|
+
{ first: 0x0f80, last: 0x0f84 },
|
|
83
|
+
{ first: 0x0f86, last: 0x0f87 },
|
|
84
|
+
{ first: 0x0f90, last: 0x0f97 },
|
|
85
|
+
{ first: 0x0f99, last: 0x0fbc },
|
|
86
|
+
{ first: 0x0fc6, last: 0x0fc6 },
|
|
87
|
+
{ first: 0x102d, last: 0x1030 },
|
|
88
|
+
{ first: 0x1032, last: 0x1032 },
|
|
89
|
+
{ first: 0x1036, last: 0x1037 },
|
|
90
|
+
{ first: 0x1039, last: 0x1039 },
|
|
91
|
+
{ first: 0x1058, last: 0x1059 },
|
|
92
|
+
{ first: 0x1160, last: 0x11ff },
|
|
93
|
+
{ first: 0x135f, last: 0x135f },
|
|
94
|
+
{ first: 0x1712, last: 0x1714 },
|
|
95
|
+
{ first: 0x1732, last: 0x1734 },
|
|
96
|
+
{ first: 0x1752, last: 0x1753 },
|
|
97
|
+
{ first: 0x1772, last: 0x1773 },
|
|
98
|
+
{ first: 0x17b4, last: 0x17b5 },
|
|
99
|
+
{ first: 0x17b7, last: 0x17bd },
|
|
100
|
+
{ first: 0x17c6, last: 0x17c6 },
|
|
101
|
+
{ first: 0x17c9, last: 0x17d3 },
|
|
102
|
+
{ first: 0x17dd, last: 0x17dd },
|
|
103
|
+
{ first: 0x180b, last: 0x180d },
|
|
104
|
+
{ first: 0x18a9, last: 0x18a9 },
|
|
105
|
+
{ first: 0x1920, last: 0x1922 },
|
|
106
|
+
{ first: 0x1927, last: 0x1928 },
|
|
107
|
+
{ first: 0x1932, last: 0x1932 },
|
|
108
|
+
{ first: 0x1939, last: 0x193b },
|
|
109
|
+
{ first: 0x1a17, last: 0x1a18 },
|
|
110
|
+
{ first: 0x1b00, last: 0x1b03 },
|
|
111
|
+
{ first: 0x1b34, last: 0x1b34 },
|
|
112
|
+
{ first: 0x1b36, last: 0x1b3a },
|
|
113
|
+
{ first: 0x1b3c, last: 0x1b3c },
|
|
114
|
+
{ first: 0x1b42, last: 0x1b42 },
|
|
115
|
+
{ first: 0x1b6b, last: 0x1b73 },
|
|
116
|
+
{ first: 0x1dc0, last: 0x1dca },
|
|
117
|
+
{ first: 0x1dfe, last: 0x1dff },
|
|
118
|
+
{ first: 0x200b, last: 0x200f },
|
|
119
|
+
{ first: 0x202a, last: 0x202e },
|
|
120
|
+
{ first: 0x2060, last: 0x2063 },
|
|
121
|
+
{ first: 0x206a, last: 0x206f },
|
|
122
|
+
{ first: 0x20d0, last: 0x20ef },
|
|
123
|
+
{ first: 0x302a, last: 0x302f },
|
|
124
|
+
{ first: 0x3099, last: 0x309a },
|
|
125
|
+
{ first: 0xa806, last: 0xa806 },
|
|
126
|
+
{ first: 0xa80b, last: 0xa80b },
|
|
127
|
+
{ first: 0xa825, last: 0xa826 },
|
|
128
|
+
{ first: 0xfb1e, last: 0xfb1e },
|
|
129
|
+
{ first: 0xfe00, last: 0xfe0f },
|
|
130
|
+
{ first: 0xfe20, last: 0xfe23 },
|
|
131
|
+
{ first: 0xfeff, last: 0xfeff },
|
|
132
|
+
{ first: 0xfff9, last: 0xfffb },
|
|
133
|
+
{ first: 0x10a01, last: 0x10a03 },
|
|
134
|
+
{ first: 0x10a05, last: 0x10a06 },
|
|
135
|
+
{ first: 0x10a0c, last: 0x10a0f },
|
|
136
|
+
{ first: 0x10a38, last: 0x10a3a },
|
|
137
|
+
{ first: 0x10a3f, last: 0x10a3f },
|
|
138
|
+
{ first: 0x1d167, last: 0x1d169 },
|
|
139
|
+
{ first: 0x1d173, last: 0x1d182 },
|
|
140
|
+
{ first: 0x1d185, last: 0x1d18b },
|
|
141
|
+
{ first: 0x1d1aa, last: 0x1d1ad },
|
|
142
|
+
{ first: 0x1d242, last: 0x1d244 },
|
|
143
|
+
{ first: 0xe0001, last: 0xe0001 },
|
|
144
|
+
{ first: 0xe0020, last: 0xe007f },
|
|
145
|
+
{ first: 0xe0100, last: 0xe01ef },
|
|
146
|
+
];
|
|
147
|
+
export default combining;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const wcwidth_js_1 = __importDefault(require("./wcwidth.cjs"));
|
|
7
|
+
const mk_wcswidth = (pwcs) => {
|
|
8
|
+
let width = 0;
|
|
9
|
+
// eslint-disable-next-line no-plusplus
|
|
10
|
+
for (let i = 0; i < pwcs.length; i++) {
|
|
11
|
+
const charCode = pwcs.charCodeAt(i);
|
|
12
|
+
const w = (0, wcwidth_js_1.default)(charCode);
|
|
13
|
+
if (w < 0) {
|
|
14
|
+
return -1;
|
|
15
|
+
}
|
|
16
|
+
width += w;
|
|
17
|
+
}
|
|
18
|
+
return width;
|
|
19
|
+
};
|
|
20
|
+
exports.default = mk_wcswidth;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import mk_wcwidth from './wcwidth.js';
|
|
2
|
+
const mk_wcswidth = (pwcs) => {
|
|
3
|
+
let width = 0;
|
|
4
|
+
// eslint-disable-next-line no-plusplus
|
|
5
|
+
for (let i = 0; i < pwcs.length; i++) {
|
|
6
|
+
const charCode = pwcs.charCodeAt(i);
|
|
7
|
+
const w = mk_wcwidth(charCode);
|
|
8
|
+
if (w < 0) {
|
|
9
|
+
return -1;
|
|
10
|
+
}
|
|
11
|
+
width += w;
|
|
12
|
+
}
|
|
13
|
+
return width;
|
|
14
|
+
};
|
|
15
|
+
export default mk_wcswidth;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const non_spacing_chars_js_1 = __importDefault(require("./non-spacing-chars.cjs"));
|
|
7
|
+
const binary_search_js_1 = __importDefault(require("./binary-search.cjs"));
|
|
8
|
+
/* The following two functions define the column width of an ISO 10646
|
|
9
|
+
* character as follows:
|
|
10
|
+
*
|
|
11
|
+
* - The null character (U+0000) has a column width of 0.
|
|
12
|
+
*
|
|
13
|
+
* - Other C0/C1 control characters and DEL will lead to a return
|
|
14
|
+
* value of -1.
|
|
15
|
+
*
|
|
16
|
+
* - Non-spacing and enclosing combining characters (general
|
|
17
|
+
* category code Mn or Me in the Unicode database) have a
|
|
18
|
+
* column width of 0.
|
|
19
|
+
*
|
|
20
|
+
* - SOFT HYPHEN (U+00AD) has a column width of 1.
|
|
21
|
+
*
|
|
22
|
+
* - Other format characters (general category code Cf in the Unicode
|
|
23
|
+
* database) and ZERO WIDTH SPACE (U+200B) have a column width of 0.
|
|
24
|
+
*
|
|
25
|
+
* - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
|
|
26
|
+
* have a column width of 0.
|
|
27
|
+
*
|
|
28
|
+
* - Spacing characters in the East Asian Wide (W) or East Asian
|
|
29
|
+
* Full-width (F) category as defined in Unicode Technical
|
|
30
|
+
* Report #11 have a column width of 2.
|
|
31
|
+
*
|
|
32
|
+
* - All remaining characters (including all printable
|
|
33
|
+
* ISO 8859-1 and WGL4 characters, Unicode control characters,
|
|
34
|
+
* etc.) have a column width of 1.
|
|
35
|
+
*
|
|
36
|
+
* This implementation assumes that wchar_t characters are encoded
|
|
37
|
+
* in ISO 10646.
|
|
38
|
+
*/
|
|
39
|
+
const mk_wcwidth = (ucs) => {
|
|
40
|
+
/* test for 8-bit control characters */
|
|
41
|
+
if (ucs === 0) {
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) {
|
|
45
|
+
return -1;
|
|
46
|
+
}
|
|
47
|
+
/* binary search in table of non-spacing characters */
|
|
48
|
+
if ((0, binary_search_js_1.default)(ucs, non_spacing_chars_js_1.default, non_spacing_chars_js_1.default.length - 1)) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
/* if we arrive here, ucs is not a combining or C0/C1 control character */
|
|
52
|
+
return (1 +
|
|
53
|
+
Number(ucs >= 0x1100 &&
|
|
54
|
+
(ucs <= 0x115f /* Hangul Jamo init. consonants */ ||
|
|
55
|
+
ucs === 0x2329 ||
|
|
56
|
+
ucs === 0x232a ||
|
|
57
|
+
(ucs >= 0x2e80 && ucs <= 0xa4cf && ucs !== 0x303f) /* CJK ... Yi */ ||
|
|
58
|
+
(ucs >= 0xac00 && ucs <= 0xd7a3) /* Hangul Syllables */ ||
|
|
59
|
+
(ucs >= 0xf900 && ucs <= 0xfaff) /* CJK Compatibility Ideographs */ ||
|
|
60
|
+
(ucs >= 0xfe10 && ucs <= 0xfe19) /* Vertical forms */ ||
|
|
61
|
+
(ucs >= 0xfe30 && ucs <= 0xfe6f) /* CJK Compatibility Forms */ ||
|
|
62
|
+
(ucs >= 0xff00 && ucs <= 0xff60) /* Fullwidth Forms */ ||
|
|
63
|
+
(ucs >= 0xffe0 && ucs <= 0xffe6) ||
|
|
64
|
+
(ucs >= 0x20000 && ucs <= 0x2fffd) ||
|
|
65
|
+
(ucs >= 0x30000 && ucs <= 0x3fffd))));
|
|
66
|
+
};
|
|
67
|
+
exports.default = mk_wcwidth;
|