@veripublica/epubveri-wasm 0.9.28 → 0.10.0

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
@@ -56,7 +56,13 @@ interface Item {
56
56
  location?: string; // container-relative path, when available
57
57
  position?: { line: number; column: number };
58
58
  message: string; // epubveri's own message wording
59
- data?: { params: string[] };
59
+ data?: {
60
+ params: string[]; // the values interpolated into `message`
61
+ element_path?: string; // XPath-style path to the offending node
62
+ namespaces: Map<string, string>; // bindings that resolve element_path — a Map, see below
63
+ advisory_basis?: string; // "spec-ahead" | "spec-silent", on ADV-*/NEXT-* only
64
+ violation_kind?: string; // which of six kinds a schema violation is
65
+ };
60
66
  }
61
67
 
62
68
  function validate(
@@ -75,17 +81,35 @@ function version(): string;
75
81
 
76
82
  ### Advisory checks
77
83
 
78
- `advisory` mirrors the CLI `--advisory` flag: pass `true` to also emit the opt-in advisory
79
- findings epubcheck has no verdict on — currently unknown CSS property and descriptor names
80
- (`ADV-001`/`ADV-002`, at `usage` severity). It is **off by default**: leaving the argument
81
- out, or passing `false`/`undefined`, produces a byte-identical report, so existing
82
- two-argument callers are unaffected.
84
+ `advisory` mirrors the CLI `--advisory` flag: pass `true` to also emit the opt-in findings
85
+ epubcheck has no verdict on, in two families, both at `usage` severity:
83
86
 
84
- ### One CLI-only difference
87
+ - **`NEXT-*`** — a published specification requires it and epubcheck has not implemented it
88
+ yet, so it becomes an ordinary error the day it catches up (today: the EPUB 3.4 rules).
89
+ - **`ADV-*`** — no specification says anything, but the book is still probably wrong
90
+ (unknown CSS property and descriptor names, a type selector naming no known element, an
91
+ EPUB 2 package written in EPUB 3, two navigation entries landing on one document).
85
92
 
86
- The `PKG-016` check (the `.epub` **file extension** should be lowercase) is filename-
87
- based and is **not** reported here — this entry point only ever sees bytes, never a
88
- filename. Everything else matches the native CLI/library exactly.
93
+ It is **off by default**: leaving the argument out, or passing `false`/`undefined`,
94
+ produces a byte-identical report, so existing two-argument callers are unaffected. Neither
95
+ family ever affects `status` — a book that passes epubcheck passes epubveri, with or
96
+ without the flag.
97
+
98
+ ### Two differences from the CLI
99
+
100
+ **`PKG-016` is not reported here.** That check is about the `.epub` **file extension**
101
+ being lowercase, and this entry point only ever sees bytes, never a filename.
102
+
103
+ **`data.namespaces` is a `Map`, not a plain object.** That is how a Rust map crosses
104
+ into JavaScript here, and it is the one place this binding's shape differs from the
105
+ CLI's JSON, where the same field is an object. Use `data.namespaces.get("opf")`;
106
+ `data.namespaces["opf"]` is silently `undefined`. Everything else in `data` — added in
107
+ 0.10.0, having previously been CLI-only — is exactly the CLI's shape.
108
+
109
+ **Nothing is filtered here.** The CLI hides `usage`-severity findings from its human
110
+ report unless you pass `-u`; this binding is a machine interface and always returns
111
+ every finding, exactly like `--format json`. Filter on `severity` yourself if your UI
112
+ wants the CLI's default view.
89
113
 
90
114
  ## Try the demo
91
115
 
package/epubveri.d.ts CHANGED
@@ -72,10 +72,47 @@ export interface Summary {
72
72
  }
73
73
 
74
74
  /**
75
- * Tool-specific item extras.
75
+ * Tool-specific item extras — the same slot the CLI\'s `--format json` fills,
76
+ * with the same contents.
77
+ *
78
+ * Kept in step with [`epubveri::envelope::Data`] deliberately: a browser
79
+ * consumer that has to fall back to the CLI for a field is a consumer this
80
+ * package failed. Through 0.9.x this struct carried `params` alone, so
81
+ * `element_path`, `namespaces`, `advisory_basis` and `violation_kind` were
82
+ * reachable from the command line and not from the web. That was an omission
83
+ * rather than a decision — nothing about the browser makes them harder to
84
+ * produce — and 0.10.0 closes it.
85
+ *
86
+ * **Absent means absent**, as in the CLI envelope: every optional field is
87
+ * omitted rather than emitted as `null`, so a consumer tests for presence.
76
88
  */
77
89
  export interface Data {
78
90
  params: string[];
91
+ /**
92
+ * XPath-style path to the offending node, resolvable with `namespaces`.
93
+ */
94
+ element_path?: string;
95
+ /**
96
+ * Prefix -> namespace-URI bindings needed to resolve `element_path`.
97
+ *
98
+ * **This arrives in JavaScript as a `Map`, not a plain object** — that is
99
+ * how serde-wasm-bindgen renders a map, and it is the one place this
100
+ * binding\'s shape differs from the CLI\'s JSON, where the same field is an
101
+ * object. So `data.namespaces.get(\"opf\")`, never
102
+ * `data.namespaces[\"opf\"]`, which would silently be `undefined`.
103
+ */
104
+ namespaces: Map<string, string>;
105
+ /**
106
+ * `spec-ahead` | `spec-silent` — what an advisory finding is grounded in.
107
+ * Present only on `ADV-*`/`NEXT-*` findings.
108
+ */
109
+ advisory_basis?: string;
110
+ /**
111
+ * Which of the six kinds of schema violation this is, when the rule
112
+ * carries kinds. `None` says the rule has no kinds, never that the kind
113
+ * could not be determined.
114
+ */
115
+ violation_kind?: string;
79
116
  }
80
117
 
81
118
 
@@ -88,10 +125,13 @@ export interface Data {
88
125
  * names behave like `undefined` (permissive).
89
126
  *
90
127
  * `advisory` mirrors the CLI `--advisory` flag: pass `true` to also emit the
91
- * opt-in advisory findings epubcheck has no verdict on (unknown CSS
92
- * property/descriptor names, `ADV-*`, at usage severity). `undefined`/`false`
93
- * leaves them off, and with them off the report is byte-identical — so
94
- * existing two-argument callers are unaffected.
128
+ * opt-in findings epubcheck has no verdict on, in two families, both at
129
+ * `usage` severity — `NEXT-*` (a published specification requires it and
130
+ * epubcheck has not implemented it yet, so it becomes an ordinary error once
131
+ * it does) and `ADV-*` (no specification says anything, but the book is still
132
+ * probably wrong). `undefined`/`false` leaves them off, and with them off the
133
+ * report is byte-identical — so existing two-argument callers are unaffected.
134
+ * Neither family can move `status`.
95
135
  *
96
136
  * `epub_version` mirrors the CLI `-v` flag — pass `"2"`, `"2.0"`, `"3"`,
97
137
  * `"3.0"` to validate against that version whatever the book declares, or
package/epubveri_bg.js CHANGED
@@ -7,10 +7,13 @@
7
7
  * names behave like `undefined` (permissive).
8
8
  *
9
9
  * `advisory` mirrors the CLI `--advisory` flag: pass `true` to also emit the
10
- * opt-in advisory findings epubcheck has no verdict on (unknown CSS
11
- * property/descriptor names, `ADV-*`, at usage severity). `undefined`/`false`
12
- * leaves them off, and with them off the report is byte-identical — so
13
- * existing two-argument callers are unaffected.
10
+ * opt-in findings epubcheck has no verdict on, in two families, both at
11
+ * `usage` severity — `NEXT-*` (a published specification requires it and
12
+ * epubcheck has not implemented it yet, so it becomes an ordinary error once
13
+ * it does) and `ADV-*` (no specification says anything, but the book is still
14
+ * probably wrong). `undefined`/`false` leaves them off, and with them off the
15
+ * report is byte-identical — so existing two-argument callers are unaffected.
16
+ * Neither family can move `status`.
14
17
  *
15
18
  * `epub_version` mirrors the CLI `-v` flag — pass `"2"`, `"2.0"`, `"3"`,
16
19
  * `"3.0"` to validate against that version whatever the book declares, or
@@ -68,6 +71,10 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
68
71
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
69
72
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
70
73
  }
74
+ export function __wbg___wbindgen_is_string_ea5e6cc2e4141dfe(arg0) {
75
+ const ret = typeof(arg0) === 'string';
76
+ return ret;
77
+ }
71
78
  export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
72
79
  throw new Error(getStringFromWasm0(arg0, arg1));
73
80
  }
@@ -75,10 +82,18 @@ export function __wbg_new_32b398fb48b6d94a() {
75
82
  const ret = new Array();
76
83
  return ret;
77
84
  }
85
+ export function __wbg_new_7796ffc7ed656783() {
86
+ const ret = new Map();
87
+ return ret;
88
+ }
78
89
  export function __wbg_new_da52cf8fe3429cb2() {
79
90
  const ret = new Object();
80
91
  return ret;
81
92
  }
93
+ export function __wbg_set_575dd786d51585f8(arg0, arg1, arg2) {
94
+ const ret = arg0.set(arg1, arg2);
95
+ return ret;
96
+ }
82
97
  export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
83
98
  arg0[arg1] = arg2;
84
99
  }
package/epubveri_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@veripublica/epubveri-wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for epubveri — a pure-Rust, JVM-free EPUB validator that runs in the browser.",
5
- "version": "0.9.28",
5
+ "version": "0.10.0",
6
6
  "license": "AGPL-3.0-only OR LicenseRef-veripublica-Commercial",
7
7
  "repository": {
8
8
  "type": "git",