@likecoin/epubcheck-ts 0.5.1 → 0.6.1

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 CHANGED
@@ -6,7 +6,7 @@ Validate EPUB files in Node.js and the browser. A TypeScript implementation of [
6
6
  [![npm](https://img.shields.io/npm/v/%40likecoin%2Fepubcheck-ts)](https://www.npmjs.com/package/@likecoin/epubcheck-ts)
7
7
  [![License](https://img.shields.io/npm/l/%40likecoin%2Fepubcheck-ts)](./LICENSE)
8
8
 
9
- > **Status**: ~97% feature parity with Java EPUBCheck (1333 tests passing, 34 skipped). See [PROJECT_STATUS.md](./PROJECT_STATUS.md) for details. For full EPUB 3 conformance testing, use the official [Java EPUBCheck](https://github.com/w3c/epubcheck).
9
+ > **Status**: ~99% feature parity with Java EPUBCheck (1361 tests passing, 14 skipped). See [PROJECT_STATUS.md](./PROJECT_STATUS.md) for details. For full EPUB 3 conformance testing, use the official [Java EPUBCheck](https://github.com/w3c/epubcheck).
10
10
 
11
11
  ## Features
12
12
 
@@ -292,7 +292,7 @@ This library is a TypeScript port of the Java-based [EPUBCheck](https://github.c
292
292
 
293
293
  Legend: 🟢 Complete | 🟡 Partial | 🔴 Basic | ❌ Not Started
294
294
 
295
- **Overall Progress: ~97% of Java EPUBCheck features**
295
+ **Overall Progress: ~99% of Java EPUBCheck features**
296
296
 
297
297
  See [PROJECT_STATUS.md](./PROJECT_STATUS.md) for detailed comparison.
298
298
 
@@ -377,7 +377,7 @@ Legend: ✅ Implemented
377
377
  | Aspect | epubcheck-ts | EPUBCheck (Java) |
378
378
  |--------|--------------|------------------|
379
379
  | Runtime | Node.js / Browser | JVM |
380
- | Feature Parity | ~97% | 100% |
380
+ | Feature Parity | ~99% | 100% |
381
381
  | Bundle Size | ~450KB JS + ~1.6MB WASM | ~15MB |
382
382
  | Installation | `npm install` | Download JAR |
383
383
  | Integration | Native JS/TS | CLI or Java API |
package/bin/epubcheck.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import { readFile, readdir, stat, writeFile } from "node:fs/promises";
3
3
  import { parseArgs } from "node:util";
4
4
  import { basename, join, relative, sep } from "node:path";
5
- const { EpubCheck, EPUB_VERSIONS, toJSONReport } = await import("../dist/index.js");
6
- const VERSION = "0.5.1";
5
+ const { EpubCheck, EPUB_VERSIONS, MessageId, toJSONReport } = await import("../dist/index.js");
6
+ const VERSION = "0.6.1";
7
7
  const VALID_MODES = /* @__PURE__ */ new Set([
8
8
  "exp",
9
9
  "opf",
@@ -301,6 +301,19 @@ async function main() {
301
301
  const shouldFail = result.errorCount > 0 || result.fatalCount > 0 || failOnWarnings && result.warningCount > 0;
302
302
  process.exit(shouldFail ? 1 : 0);
303
303
  } catch (error) {
304
+ const code = error?.code;
305
+ if (code === "ENOENT") {
306
+ console.error(`\x1B[31m\x1B[1mFATAL (${filePath}):\x1B[0m EPUB file could not be found`);
307
+ console.error(` \x1B[90mID: ${MessageId.PKG_018}\x1B[0m`);
308
+ process.exit(1);
309
+ }
310
+ if (code === "EACCES" || code === "EISDIR" || code === "EIO") {
311
+ console.error(
312
+ `\x1B[31m\x1B[1mFATAL (${filePath}):\x1B[0m Unable to read EPUB contents: ${error instanceof Error ? error.message : String(error)}`
313
+ );
314
+ console.error(` \x1B[90mID: ${MessageId.PKG_015}\x1B[0m`);
315
+ process.exit(1);
316
+ }
304
317
  console.error("\x1B[31mError:\x1B[0m", error instanceof Error ? error.message : String(error));
305
318
  if (error instanceof Error && error.stack && !values.quiet) {
306
319
  console.error("\x1B[90m" + error.stack + "\x1B[0m");
package/bin/epubcheck.ts CHANGED
@@ -20,9 +20,9 @@ import type {
20
20
  } from '../src/types.js';
21
21
 
22
22
  // Dynamic import to support both ESM and CJS builds
23
- const { EpubCheck, EPUB_VERSIONS, toJSONReport } = await import('../dist/index.js');
23
+ const { EpubCheck, EPUB_VERSIONS, MessageId, toJSONReport } = await import('../dist/index.js');
24
24
 
25
- const VERSION = '0.5.1';
25
+ const VERSION = '0.6.1';
26
26
  const VALID_MODES: ReadonlySet<ValidationMode> = new Set([
27
27
  'exp',
28
28
  'opf',
@@ -399,6 +399,19 @@ async function main(): Promise<void> {
399
399
  result.errorCount > 0 || result.fatalCount > 0 || (failOnWarnings && result.warningCount > 0);
400
400
  process.exit(shouldFail ? 1 : 0);
401
401
  } catch (error) {
402
+ const code = (error as NodeJS.ErrnoException | undefined)?.code;
403
+ if (code === 'ENOENT') {
404
+ console.error(`\x1b[31m\x1b[1mFATAL (${filePath}):\x1b[0m EPUB file could not be found`);
405
+ console.error(` \x1b[90mID: ${MessageId.PKG_018}\x1b[0m`);
406
+ process.exit(1);
407
+ }
408
+ if (code === 'EACCES' || code === 'EISDIR' || code === 'EIO') {
409
+ console.error(
410
+ `\x1b[31m\x1b[1mFATAL (${filePath}):\x1b[0m Unable to read EPUB contents: ${error instanceof Error ? error.message : String(error)}`,
411
+ );
412
+ console.error(` \x1b[90mID: ${MessageId.PKG_015}\x1b[0m`);
413
+ process.exit(1);
414
+ }
402
415
  console.error('\x1b[31mError:\x1b[0m', error instanceof Error ? error.message : String(error));
403
416
  if (error instanceof Error && error.stack && !values.quiet) {
404
417
  console.error('\x1b[90m' + error.stack + '\x1b[0m');