byte-codec 1.1.3 → 1.1.4

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.
Files changed (2) hide show
  1. package/README.md +15 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white)](https://github.com/ExaDev/byte-codec) [![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](https://www.npmjs.com/package/byte-codec) [![Release](https://img.shields.io/github/v/release/ExaDev/byte-codec)](https://github.com/ExaDev/byte-codec/releases/latest) [![CI](https://img.shields.io/github/actions/workflow/status/ExaDev/byte-codec/ci.yml?branch=main)](https://github.com/ExaDev/byte-codec/actions)
4
4
 
5
- > Generic byte-level primitives (ByteWriter, ByteReader, CRC-32, deflate/inflate) and PNG/JPEG image encoding/decoding with zero PDF knowledge — the shared utility package for the documents.js family.
5
+ > Generic byte-level primitives (ByteWriter, ByteReader, CRC-32, deflate/inflate) and PNG/JPEG image encoding/decoding with zero PDF knowledge — the shared utility package for the [documents.js family](../README.md).
6
6
 
7
7
  Extracted from [pdf-codec](https://github.com/ExaDev/pdf-codec), where these utilities lived as a directory-isolated subgraph under `src/bytes/` + `src/image/` with no PDF imports. Both pdf-codec and documents.js consume them from this neutral home rather than one fetching byte utilities from a backend.
8
8
 
@@ -30,11 +30,16 @@ Requires Node.js `>=20` and pnpm `11.6.0`.
30
30
 
31
31
  ```sh
32
32
  pnpm install
33
- pnpm build # tsdown -> dist/ (ESM + CJS + .d.ts)
34
- pnpm test # vitest
35
- pnpm typecheck # tsc --noEmit
33
+ pnpm build # tsdown -> dist/ (ESM + CJS + .d.ts)
34
+ pnpm typecheck # tsc -p tsconfig.json && tsc -p tsconfig.node.json (dual tsconfig)
35
+ pnpm lint # eslint . --fix --cache --max-warnings 0
36
+ pnpm test # vitest run
37
+ pnpm test:watch # vitest
38
+ pnpm test:workers # vitest run --config vitest.workers.config.ts, inside a real Cloudflare Workers (workerd) isolate
36
39
  ```
37
40
 
41
+ To run a single test file, pass its path to vitest directly, e.g. `pnpm exec vitest run src/bytes/crc32.test.ts`.
42
+
38
43
  ## What it provides
39
44
 
40
45
  | Module | Exports |
@@ -48,6 +53,12 @@ pnpm typecheck # tsc --noEmit
48
53
  | `image/png-filter` | `filterScanlines`, `unfilterScanlines` (the five PNG scanline filters) |
49
54
  | `image/jpeg-info` | `readJpegInfo` (JPEG header reader: dimensions, components, progressive flag — no sample decoding) |
50
55
 
56
+ ## Conventions
57
+
58
+ - Worker-isomorphic (see the [family-wide convention](../README.md#conventions)): runtime `src/` must not import `node:*`, a bare Node builtin, or use the `Buffer` global — enforced by a `no-restricted-imports`/`no-restricted-globals` ESLint rule and exercised in CI by running the test suite inside an actual `workerd` isolate (`pnpm test:workers`). Test files under `src/**/*.test.ts` are exempt and may use Node APIs for fixtures.
59
+ - Only `src/index.ts` may be named `index.*` — a custom ESLint rule (`local/no-non-barrel-index`) rejects any other module using an `index` basename, since that would be a hidden entry point the `exports` map in `package.json` doesn't advertise.
60
+ - Releases are fully automated: a push to `main` runs `semantic-release` in CI, which determines the version from Conventional Commit messages, publishes to npm via OIDC trusted publishing (no local `NPM_TOKEN` needed), and re-publishes the identical build under the [npm aliases](#npm-aliases) below. There is no manual publish step.
61
+
51
62
  ## Install
52
63
 
53
64
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "byte-codec",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Generic byte-level primitives (ByteWriter, ByteReader, CRC-32, deflate/inflate) and PNG/JPEG image encoding/decoding with zero PDF knowledge — the shared utility package for the documents.js family.",
5
5
  "type": "module",
6
6
  "repository": {