Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f66b7ba
refactor: enhance readable stream utilities with additional functions
mktbsh May 1, 2026
9152a23
refactor: update VSCode settings to include organizeImports action
mktbsh May 1, 2026
9d01659
refactor: remove obsolete readable stream functions from readable.ts
mktbsh May 1, 2026
f7b5830
refactor: create index.ts to consolidate exports from shared modules
mktbsh May 1, 2026
671ac15
refactor: reorganize exports in index.ts for improved structure
mktbsh May 1, 2026
2679c11
refactor: update import path for utility functions in base64 test file
mktbsh May 1, 2026
ec62787
refactor: update import paths in test files to use shared module
mktbsh May 1, 2026
7228402
refactor: reorganize exports in index.ts for improved clarity and str…
mktbsh May 1, 2026
77e3e0b
refactor: restructure text module by consolidating exports and updati…
mktbsh May 1, 2026
6ced77d
refactor: remove public API tests for consolidated structure
mktbsh May 1, 2026
ad38e3d
refactor: consolidate COBS exports and update import paths
mktbsh May 1, 2026
3211a21
refactor: format export statements for consistency
mktbsh May 1, 2026
37b4eaf
refactor: reorganize encryption module structure and update import paths
mktbsh May 1, 2026
0cebc58
refactor: restructure base64 module by consolidating exports and upda…
mktbsh May 1, 2026
11913c3
refactor: reorganize jsonl module structure and update import paths
mktbsh May 1, 2026
7138002
refactor: reorganize PNG module structure and update import paths
mktbsh May 1, 2026
9ad56dd
refactor: consolidate shared module exports and reorganize internal f…
mktbsh May 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mighty-snails-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hsblabs/web-stream-extras": patch
---

refactor: consolidate shared module exports and reorganize internal file structure
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit",
"source.organizeImports.biome": "explicit"
"source.organizeImports.biome": "explicit",
"source.organizeImports": "never"
}
}
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
],
"exports": {
".": "./dist/index.js",
"./base64": "./dist/base64.js",
"./cobs": "./dist/cobs.js",
"./encryption": "./dist/encryption.js",
"./jsonl": "./dist/jsonl.js",
"./png": "./dist/png.js",
"./text": "./dist/text.js",
"./base64": "./dist/base64/index.js",
"./cobs": "./dist/cobs/index.js",
"./encryption": "./dist/encryption/index.js",
"./jsonl": "./dist/jsonl/index.js",
"./png": "./dist/png/index.js",
"./text": "./dist/text/index.js",
"./package.json": "./package.json"
},
"types": "./dist/index.d.ts",
Expand Down
15 changes: 0 additions & 15 deletions src/base64.ts

This file was deleted.

14 changes: 7 additions & 7 deletions src/base64.test.ts → src/base64/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { describe, expect, it } from "vitest";
import {
binaryToString,
readAllBytes,
readAllChunks,
readableFromChunks,
stringToBinary,
} from "../shared";
import {
Base64DecodeStream,
Base64EncodeStream,
decodeBase64Stream,
decodeBase64UrlStream,
encodeBase64Stream,
encodeBase64UrlStream,
} from "./base64";
import {
binaryToString,
readAllBytes,
readAllChunks,
readableFromChunks,
stringToBinary,
} from "./index";

describe("base64", () => {
Expand Down
File renamed without changes.
8 changes: 0 additions & 8 deletions src/cobs.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/cobs.test.ts → src/cobs/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { describe, expect, it } from "vitest";
import * as cobsApi from "./cobs";
import { readAllBytes, readAllChunks, readableFromChunks } from "../shared";
import * as cobsApi from "./index";
import {
createCOBSDecoderStream,
createCOBSEncoderStream,
decodeCOBSFrame,
encodeCOBSFrame,
readCOBS,
writeCOBS,
} from "./cobs";
import { readAllBytes, readAllChunks, readableFromChunks } from "./readable";
} from "./index";

describe("cobs public API", () => {
it("exports the supported cobs helpers", () => {
Expand Down
File renamed without changes.
11 changes: 0 additions & 11 deletions src/encryption.ts

This file was deleted.

16 changes: 8 additions & 8 deletions src/encryption.test.ts → src/encryption/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { describe, expect, it } from "vitest";
import {
DecryptionStream,
decryptStream,
EncryptionStream,
encryptStream,
webCryptoStream,
} from "./encryption";
import { HEADER_SIZE, TAG_LENGTH } from "./encryption/constants";
import {
binaryToString,
randomBytes,
readAllBytes,
readableFromChunks,
stringToBinary,
} from "../shared";
import { HEADER_SIZE, TAG_LENGTH } from "./constants";
import {
DecryptionStream,
decryptStream,
EncryptionStream,
encryptStream,
webCryptoStream,
} from "./index";

const TEST_RECORD_SIZE = 64;
Expand Down
4 changes: 2 additions & 2 deletions src/encryption/public.ts → src/encryption/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { toArrayBuffer } from "../shared/array-buffer";
import { decodeBase64Url, encodeBase64Url } from "../shared/base64url";
import { randomBytes } from "../shared/binary";
import { throwError } from "../shared/error";
import type { BinaryReadableStream } from "../shared/stream";
import { ByteTransformStream } from "../shared/stream";
import { concatU8Arrays, toU8Array } from "../shared/uint8array";
import type { BinaryReadableStream } from "../stream-types";
import { ByteTransformStream } from "../transform-stream";
import {
AES_GCM_BIT_LENGTH,
ALGORITHM_AES_GCM,
Expand Down
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
export { readAllBytes, readAllChunks, readableFromChunks } from "./readable";
export * from "./base64";
export * from "./byte-queue";
export * from "./cobs";
export * from "./encryption";
export * from "./jsonl";
export * from "./png";
export {
binaryToString,
randomBytes,
stringToBinary,
} from "./shared/binary";
export {
readAllBytes,
readAllChunks,
readableFromChunks,
} from "./shared/readable";
export * from "./text";
15 changes: 0 additions & 15 deletions src/jsonl.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/jsonl.test.ts → src/jsonl/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
readAllChunks,
readableFromChunks,
stringToBinary,
} from "./index";
} from "../shared";
import {
encodeJSONLStream,
JSONLEncodeStream,
Expand All @@ -14,7 +14,7 @@ import {
JSONLStringifyStream,
parseJSONLStream,
stringifyJSONLStream,
} from "./jsonl";
} from "./index";

type Event = {
id: string;
Expand Down
File renamed without changes.
9 changes: 0 additions & 9 deletions src/png.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/png/framing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { decodeCOBSFrame, encodeCOBSFrame } from "../cobs/public";
import { decodeCOBSFrame, encodeCOBSFrame } from "../cobs";
import { throwError } from "../shared/error";
import { concatU8Arrays } from "../shared/uint8array";
import {
Expand Down
14 changes: 7 additions & 7 deletions src/png.test.ts → src/png/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { describe, expect, it } from "vitest";
import { decodeCOBSFrame, encodeCOBSFrame } from "./cobs";
import * as pngApi from "./png";
import { decodeCOBSFrame, encodeCOBSFrame } from "../cobs";
import { readAllBytes, readableFromChunks } from "../shared";
import {
PNG_INTERNAL_TEXT_CHUNK_KEYWORD,
PNG_PAYLOAD_MAGIC,
PNG_PAYLOAD_SEGMENT_DATA_MAX_LENGTH,
PNG_PAYLOAD_VERSION,
PNG_SIGNATURE,
} from "./png/constants";
import { crc32 } from "./png/crc32";
} from "./constants";
import { crc32 } from "./crc32";
import {
createChunk,
createPayloadDataSegment,
Expand All @@ -18,13 +18,13 @@ import {
isInternalTextChunk,
parsePayloadSegment,
parsePNGBytes,
} from "./png/framing";
} from "./framing";
import * as pngApi from "./index";
import {
createPNGTextChunkWriter,
extractPNGTextChunk,
streamPNGTextChunk,
} from "./png/public";
import { readAllBytes, readableFromChunks } from "./readable";
} from "./index";

const MINIMAL_PNG = concatBytes(
PNG_SIGNATURE,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/png/transformers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type ByteQueue, createByteQueue } from "../byte-queue";
import { throwError } from "../shared/error";
import { concatU8Arrays } from "../shared/uint8array";
import type { PNGTextChunkWriteOptions, PNGTextChunkWriter } from ".";
import {
PNG_IEND_CHUNK_TYPE,
PNG_PAYLOAD_SEGMENT_DATA_MAX_LENGTH,
Expand All @@ -18,7 +19,6 @@ import {
parsePNGChunk,
parsePNGChunkHeader,
} from "./framing";
import type { PNGTextChunkWriteOptions, PNGTextChunkWriter } from "./public";

interface Deferred<T> {
promise: Promise<T>;
Expand Down
60 changes: 0 additions & 60 deletions src/public-api.test.ts

This file was deleted.

36 changes: 0 additions & 36 deletions src/readable.ts

This file was deleted.

13 changes: 13 additions & 0 deletions src/shared/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export { toArrayBuffer } from "./array-buffer";

export {
binaryToString,
randomBytes,
stringToBinary,
} from "./binary";

export {
readAllBytes,
readAllChunks,
readableFromChunks,
} from "./readable";
Loading