fix: preserve U+FEFF at chunk boundaries (#1010)

This commit is contained in:
vorotamoroz
2026-07-14 02:15:57 +09:00
committed by GitHub
parent ff12778301
commit a41c829c10
7 changed files with 33 additions and 11 deletions
+1 -1
View File
@@ -41,7 +41,7 @@
"dependencies": {
"chokidar": "^4.0.0",
"minimatch": "^10.2.5",
"octagonal-wheels": "^0.1.47",
"octagonal-wheels": "^0.1.50",
"pouchdb-adapter-http": "^9.0.0",
"pouchdb-adapter-leveldb": "^9.0.0",
"pouchdb-core": "^9.0.0",
+1 -1
View File
@@ -12,7 +12,7 @@
"preview": "vite preview"
},
"dependencies": {
"octagonal-wheels": "^0.1.47"
"octagonal-wheels": "^0.1.50"
},
"devDependencies": {
"@playwright/test": "^1.58.2",
+1 -1
View File
@@ -12,7 +12,7 @@
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
},
"dependencies": {
"octagonal-wheels": "^0.1.47"
"octagonal-wheels": "^0.1.50"
},
"devDependencies": {
"eslint-plugin-svelte": "^3.19.0",
+18
View File
@@ -0,0 +1,18 @@
import { splitPiecesRabinKarp } from "@lib/string_and_binary/chunks.ts";
import { describe, expect, it } from "vitest";
describe("Rabin-Karp text splitting", () => {
it("preserves U+FEFF at the beginning of an internal chunk", async () => {
const content = `${"a".repeat(1024)}\uFEFF${"b".repeat(1024)}`;
const createChunks = await splitPiecesRabinKarp(new Blob([content], { type: "text/plain" }), 1024, true, 1024);
const chunks: string[] = [];
for await (const chunk of createChunks()) {
chunks.push(chunk);
}
expect(chunks).toHaveLength(3);
expect(chunks[1].startsWith("\uFEFF")).toBe(true);
expect(chunks.join("")).toBe(content);
});
});