vastlint 0.2.6 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vastlint",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "description": "VAST XML validator — checks ad tags against IAB VAST 2.0 through 4.3",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Alex Sekowski <alex@vastlint.org>",
@@ -50,4 +50,4 @@
50
50
  "engines": {
51
51
  "node": ">=18"
52
52
  }
53
- }
53
+ }
@@ -1,6 +1,39 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * Fix common VAST issues and return the repaired XML alongside a report.
6
+ *
7
+ * Returns a plain JavaScript object shaped like:
8
+ * ```ts
9
+ * {
10
+ * xml: string, // repaired VAST XML
11
+ * applied: Array<{
12
+ * rule_id: string,
13
+ * description: string,
14
+ * path: string,
15
+ * }>,
16
+ * remaining: Array<{ // issues that could not be auto-fixed
17
+ * id: string,
18
+ * severity: "error" | "warning" | "info",
19
+ * message: string,
20
+ * path: string | null,
21
+ * spec_ref: string,
22
+ * line: number | null,
23
+ * col: number | null,
24
+ * }>,
25
+ * }
26
+ * ```
27
+ */
28
+ export function fix(xml: string): any;
29
+
30
+ /**
31
+ * Fix a VAST XML string with caller-supplied options.
32
+ *
33
+ * Accepts the same `options` object as `validateWithOptions`.
34
+ */
35
+ export function fixWithOptions(xml: string, options: any): any;
36
+
4
37
  /**
5
38
  * Returns the full rule catalog as a JS array.
6
39
  *
package/vastlint_wasm.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./vastlint_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- rules, validate, validateWithOptions
8
+ fix, fixWithOptions, rules, validate, validateWithOptions
9
9
  } from "./vastlint_wasm_bg.js";
@@ -1,3 +1,57 @@
1
+ /**
2
+ * Fix common VAST issues and return the repaired XML alongside a report.
3
+ *
4
+ * Returns a plain JavaScript object shaped like:
5
+ * ```ts
6
+ * {
7
+ * xml: string, // repaired VAST XML
8
+ * applied: Array<{
9
+ * rule_id: string,
10
+ * description: string,
11
+ * path: string,
12
+ * }>,
13
+ * remaining: Array<{ // issues that could not be auto-fixed
14
+ * id: string,
15
+ * severity: "error" | "warning" | "info",
16
+ * message: string,
17
+ * path: string | null,
18
+ * spec_ref: string,
19
+ * line: number | null,
20
+ * col: number | null,
21
+ * }>,
22
+ * }
23
+ * ```
24
+ * @param {string} xml
25
+ * @returns {any}
26
+ */
27
+ export function fix(xml) {
28
+ const ptr0 = passStringToWasm0(xml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
29
+ const len0 = WASM_VECTOR_LEN;
30
+ const ret = wasm.fix(ptr0, len0);
31
+ if (ret[2]) {
32
+ throw takeFromExternrefTable0(ret[1]);
33
+ }
34
+ return takeFromExternrefTable0(ret[0]);
35
+ }
36
+
37
+ /**
38
+ * Fix a VAST XML string with caller-supplied options.
39
+ *
40
+ * Accepts the same `options` object as `validateWithOptions`.
41
+ * @param {string} xml
42
+ * @param {any} options
43
+ * @returns {any}
44
+ */
45
+ export function fixWithOptions(xml, options) {
46
+ const ptr0 = passStringToWasm0(xml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
47
+ const len0 = WASM_VECTOR_LEN;
48
+ const ret = wasm.fixWithOptions(ptr0, len0, options);
49
+ if (ret[2]) {
50
+ throw takeFromExternrefTable0(ret[1]);
51
+ }
52
+ return takeFromExternrefTable0(ret[0]);
53
+ }
54
+
1
55
  /**
2
56
  * Returns the full rule catalog as a JS array.
3
57
  *
Binary file
@@ -1,6 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const fix: (a: number, b: number) => [number, number, number];
5
+ export const fixWithOptions: (a: number, b: number, c: any) => [number, number, number];
4
6
  export const rules: () => [number, number, number];
5
7
  export const validate: (a: number, b: number) => [number, number, number];
6
8
  export const validateWithOptions: (a: number, b: number, c: any) => [number, number, number];
@@ -1,5 +1,61 @@
1
1
  /* @ts-self-types="./vastlint_wasm.d.ts" */
2
2
 
3
+ /**
4
+ * Fix common VAST issues and return the repaired XML alongside a report.
5
+ *
6
+ * Returns a plain JavaScript object shaped like:
7
+ * ```ts
8
+ * {
9
+ * xml: string, // repaired VAST XML
10
+ * applied: Array<{
11
+ * rule_id: string,
12
+ * description: string,
13
+ * path: string,
14
+ * }>,
15
+ * remaining: Array<{ // issues that could not be auto-fixed
16
+ * id: string,
17
+ * severity: "error" | "warning" | "info",
18
+ * message: string,
19
+ * path: string | null,
20
+ * spec_ref: string,
21
+ * line: number | null,
22
+ * col: number | null,
23
+ * }>,
24
+ * }
25
+ * ```
26
+ * @param {string} xml
27
+ * @returns {any}
28
+ */
29
+ function fix(xml) {
30
+ const ptr0 = passStringToWasm0(xml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
31
+ const len0 = WASM_VECTOR_LEN;
32
+ const ret = wasm.fix(ptr0, len0);
33
+ if (ret[2]) {
34
+ throw takeFromExternrefTable0(ret[1]);
35
+ }
36
+ return takeFromExternrefTable0(ret[0]);
37
+ }
38
+ exports.fix = fix;
39
+
40
+ /**
41
+ * Fix a VAST XML string with caller-supplied options.
42
+ *
43
+ * Accepts the same `options` object as `validateWithOptions`.
44
+ * @param {string} xml
45
+ * @param {any} options
46
+ * @returns {any}
47
+ */
48
+ function fixWithOptions(xml, options) {
49
+ const ptr0 = passStringToWasm0(xml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
50
+ const len0 = WASM_VECTOR_LEN;
51
+ const ret = wasm.fixWithOptions(ptr0, len0, options);
52
+ if (ret[2]) {
53
+ throw takeFromExternrefTable0(ret[1]);
54
+ }
55
+ return takeFromExternrefTable0(ret[0]);
56
+ }
57
+ exports.fixWithOptions = fixWithOptions;
58
+
3
59
  /**
4
60
  * Returns the full rule catalog as a JS array.
5
61
  *