@likecoin/epubcheck-ts 0.3.2 → 0.3.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.
- package/README.md +8 -1
- package/bin/epubcheck.js +2 -4
- package/bin/epubcheck.ts +9 -13
- package/dist/index.cjs +754 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +754 -41
- package/dist/index.js.map +1 -1
- package/package.json +9 -15
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A TypeScript port of [EPUBCheck](https://github.com/w3c/epubcheck) - the officia
|
|
|
6
6
|
[](https://www.npmjs.com/package/@likecoin/epubcheck-ts)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
|
|
9
|
-
> **Note**: This library is primarily developed for internal use at [3ook.com](https://3ook.com/about) and is built with AI-assisted development. While it has comprehensive test coverage (
|
|
9
|
+
> **Note**: This library is primarily developed for internal use at [3ook.com](https://3ook.com/about) and is built with AI-assisted development. While it has comprehensive test coverage (607 tests) and ~75% feature parity with Java EPUBCheck, it may not be suitable for mission-critical production workloads. For production environments requiring full EPUB validation, consider using the official [Java EPUBCheck](https://github.com/w3c/epubcheck). Contributions and feedback are welcome!
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
@@ -133,6 +133,8 @@ fileInput.addEventListener('change', async (event) => {
|
|
|
133
133
|
|
|
134
134
|
## API
|
|
135
135
|
|
|
136
|
+
> Full API reference: [online](https://likecoin.github.io/epubcheck-ts/docs/) | [markdown](./docs/md/globals.md)
|
|
137
|
+
|
|
136
138
|
### `EpubCheck.validate(data, options?)`
|
|
137
139
|
|
|
138
140
|
Static method to validate an EPUB file.
|
|
@@ -319,6 +321,9 @@ npm run build
|
|
|
319
321
|
| `npm run format` | Format with Biome |
|
|
320
322
|
| `npm run typecheck` | TypeScript type checking |
|
|
321
323
|
| `npm run check` | Run all checks (format + typecheck) |
|
|
324
|
+
| `npm run docs` | Generate API docs (HTML + Markdown) |
|
|
325
|
+
| `npm run docs:html` | Generate HTML API docs to `docs/html/` |
|
|
326
|
+
| `npm run docs:md` | Generate Markdown API docs to `docs/md/` |
|
|
322
327
|
|
|
323
328
|
### Project Structure
|
|
324
329
|
|
|
@@ -345,6 +350,8 @@ epubcheck-ts/
|
|
|
345
350
|
├── test/
|
|
346
351
|
│ ├── fixtures/ # Test EPUB files
|
|
347
352
|
│ └── integration/ # Integration tests
|
|
353
|
+
├── docs/
|
|
354
|
+
│ └── md/ # Generated API docs (Markdown, checked in)
|
|
348
355
|
├── examples/
|
|
349
356
|
│ └── web/ # Web demo ✅
|
|
350
357
|
└── dist/ # Build output
|
package/bin/epubcheck.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readFile, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
4
|
import { basename } from "node:path";
|
|
5
5
|
const { EpubCheck, toJSONReport } = await import("../dist/index.js");
|
|
6
|
-
const VERSION = "0.3.
|
|
6
|
+
const VERSION = "0.3.4";
|
|
7
7
|
const { values, positionals } = parseArgs({
|
|
8
8
|
options: {
|
|
9
9
|
json: { type: "string", short: "j" },
|
|
@@ -111,9 +111,7 @@ async function main() {
|
|
|
111
111
|
if (!values.quiet) {
|
|
112
112
|
const fatal = result.messages.filter((m) => m.severity === "fatal");
|
|
113
113
|
const errors = result.messages.filter((m) => m.severity === "error");
|
|
114
|
-
const warnings = result.messages.filter(
|
|
115
|
-
(m) => m.severity === "warning"
|
|
116
|
-
);
|
|
114
|
+
const warnings = result.messages.filter((m) => m.severity === "warning");
|
|
117
115
|
const info = result.messages.filter((m) => m.severity === "info");
|
|
118
116
|
const usage = result.messages.filter((m) => m.severity === "usage");
|
|
119
117
|
const printMessages = (messages, color, label) => {
|
package/bin/epubcheck.ts
CHANGED
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
11
11
|
import { parseArgs } from 'node:util';
|
|
12
12
|
import { basename } from 'node:path';
|
|
13
|
+
import type { EpubCheckOptions, EPUBProfile, ValidationMessage } from '../src/types.js';
|
|
13
14
|
|
|
14
15
|
// Dynamic import to support both ESM and CJS builds
|
|
15
16
|
const { EpubCheck, toJSONReport } = await import('../dist/index.js');
|
|
16
17
|
|
|
17
|
-
const VERSION = '0.3.
|
|
18
|
+
const VERSION = '0.3.4';
|
|
18
19
|
|
|
19
20
|
// Parse command line arguments
|
|
20
21
|
const { values, positionals } = parseArgs({
|
|
@@ -110,12 +111,9 @@ async function main(): Promise<void> {
|
|
|
110
111
|
|
|
111
112
|
// Validate
|
|
112
113
|
const startTime = Date.now();
|
|
113
|
-
const options: {
|
|
114
|
-
profile?: 'default' | 'dict' | 'edupub' | 'idx' | 'preview';
|
|
115
|
-
includeUsage?: boolean;
|
|
116
|
-
} = {};
|
|
114
|
+
const options: EpubCheckOptions = {};
|
|
117
115
|
if (values.profile) {
|
|
118
|
-
options.profile = values.profile as
|
|
116
|
+
options.profile = values.profile as EPUBProfile;
|
|
119
117
|
}
|
|
120
118
|
if (values.usage) {
|
|
121
119
|
options.includeUsage = true;
|
|
@@ -147,13 +145,11 @@ async function main(): Promise<void> {
|
|
|
147
145
|
// Console output (unless quiet mode)
|
|
148
146
|
if (!values.quiet) {
|
|
149
147
|
// Group messages by severity
|
|
150
|
-
const fatal = result.messages.filter((m:
|
|
151
|
-
const errors = result.messages.filter((m:
|
|
152
|
-
const warnings = result.messages.filter(
|
|
153
|
-
|
|
154
|
-
);
|
|
155
|
-
const info = result.messages.filter((m: { severity: string }) => m.severity === 'info');
|
|
156
|
-
const usage = result.messages.filter((m: { severity: string }) => m.severity === 'usage');
|
|
148
|
+
const fatal = result.messages.filter((m: ValidationMessage) => m.severity === 'fatal');
|
|
149
|
+
const errors = result.messages.filter((m: ValidationMessage) => m.severity === 'error');
|
|
150
|
+
const warnings = result.messages.filter((m: ValidationMessage) => m.severity === 'warning');
|
|
151
|
+
const info = result.messages.filter((m: ValidationMessage) => m.severity === 'info');
|
|
152
|
+
const usage = result.messages.filter((m: ValidationMessage) => m.severity === 'usage');
|
|
157
153
|
|
|
158
154
|
// Print messages with colors
|
|
159
155
|
const printMessages = (
|