safechunk 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/adapters.cjs +861 -0
- package/dist/adapters.d.cts +66 -0
- package/dist/adapters.d.ts +66 -0
- package/dist/adapters.js +121 -0
- package/dist/chunk-FPS7R6OR.js +717 -0
- package/dist/index.cjs +744 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -0
- package/package.json +74 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Core text chunking engine for safechunk. */
|
|
2
|
+
type Target = "telegram" | "discord" | "llm";
|
|
3
|
+
type Format = "plain" | "markdown" | "html";
|
|
4
|
+
interface ChunkOptions {
|
|
5
|
+
maxSize?: number;
|
|
6
|
+
max_size?: number;
|
|
7
|
+
target?: Target;
|
|
8
|
+
format?: Format;
|
|
9
|
+
overlap?: number;
|
|
10
|
+
}
|
|
11
|
+
declare const TARGET_LIMITS: Readonly<Record<Target, number>>;
|
|
12
|
+
/** Split text into chunks preserving document structure, markup, and Unicode graphemes. */
|
|
13
|
+
declare function chunk(text: string, options?: ChunkOptions): string[];
|
|
14
|
+
|
|
15
|
+
export { type ChunkOptions, type Format, TARGET_LIMITS, type Target, chunk };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Core text chunking engine for safechunk. */
|
|
2
|
+
type Target = "telegram" | "discord" | "llm";
|
|
3
|
+
type Format = "plain" | "markdown" | "html";
|
|
4
|
+
interface ChunkOptions {
|
|
5
|
+
maxSize?: number;
|
|
6
|
+
max_size?: number;
|
|
7
|
+
target?: Target;
|
|
8
|
+
format?: Format;
|
|
9
|
+
overlap?: number;
|
|
10
|
+
}
|
|
11
|
+
declare const TARGET_LIMITS: Readonly<Record<Target, number>>;
|
|
12
|
+
/** Split text into chunks preserving document structure, markup, and Unicode graphemes. */
|
|
13
|
+
declare function chunk(text: string, options?: ChunkOptions): string[];
|
|
14
|
+
|
|
15
|
+
export { type ChunkOptions, type Format, TARGET_LIMITS, type Target, chunk };
|
package/dist/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "safechunk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Intelligent text chunking for Telegram, Discord, and LLMs with Markdown, HTML, and Unicode safety",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./adapters": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/adapters.d.ts",
|
|
24
|
+
"default": "./dist/adapters.js"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./dist/adapters.d.cts",
|
|
28
|
+
"default": "./dist/adapters.cjs"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"keywords": [
|
|
38
|
+
"chunk",
|
|
39
|
+
"chunking",
|
|
40
|
+
"text-splitting",
|
|
41
|
+
"telegram",
|
|
42
|
+
"discord",
|
|
43
|
+
"llm",
|
|
44
|
+
"rag",
|
|
45
|
+
"langchain",
|
|
46
|
+
"llamaindex",
|
|
47
|
+
"grammy",
|
|
48
|
+
"discord-js",
|
|
49
|
+
"markdown",
|
|
50
|
+
"html",
|
|
51
|
+
"unicode"
|
|
52
|
+
],
|
|
53
|
+
"homepage": "https://github.com/ProstoAndriuha/safechunk",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/ProstoAndriuha/safechunk.git",
|
|
57
|
+
"directory": "packages/typescript"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/ProstoAndriuha/safechunk/issues"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=18"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsup",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"typecheck": "tsc --noEmit"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/node": "^22.0.0",
|
|
72
|
+
"tsup": "^8.0.0",
|
|
73
|
+
"typescript": "^5.5.0",
|
|
74
|
+
"vitest": "^2.0.0"
|
|
75
|
+
}
|
|
76
|
+
}
|