vastlint 0.4.16 → 0.4.18
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/index.cjs +1 -0
- package/index.d.ts +28 -0
- package/index.js +1 -1
- package/package.json +6 -2
- package/vastlint_wasm.d.ts +5 -0
- package/vastlint_wasm.js +1 -1
- package/vastlint_wasm_bg.js +15 -0
- package/vastlint_wasm_bg.wasm +0 -0
- package/vastlint_wasm_bg.wasm.d.ts +1 -0
- package/vastlint_wasm_cjs.js +16 -0
package/index.cjs
CHANGED
|
@@ -15,6 +15,7 @@ module.exports = {
|
|
|
15
15
|
rules: wasm.rules,
|
|
16
16
|
fix: wasm.fix,
|
|
17
17
|
fixWithOptions: wasm.fixWithOptions,
|
|
18
|
+
inspectDocument: wasm.inspectDocument,
|
|
18
19
|
validateFiltered(xml, minSeverity = 'error') {
|
|
19
20
|
const order = { error: 2, warning: 1, info: 0 };
|
|
20
21
|
const min = order[minSeverity] ?? 0;
|
package/index.d.ts
CHANGED
|
@@ -51,6 +51,29 @@ export interface ValidateOptions {
|
|
|
51
51
|
rule_overrides?: Record<string, 'error' | 'warning' | 'info' | 'off'>;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
export type InspectAdType = 'Wrapper' | 'InLine' | 'Unknown';
|
|
55
|
+
|
|
56
|
+
export interface InspectMediaFile {
|
|
57
|
+
url: string;
|
|
58
|
+
mimeType: string;
|
|
59
|
+
delivery: string;
|
|
60
|
+
width: string;
|
|
61
|
+
height: string;
|
|
62
|
+
bitrate: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface InspectDocumentResult {
|
|
66
|
+
adType: InspectAdType;
|
|
67
|
+
adSystem: string;
|
|
68
|
+
adTitle: string;
|
|
69
|
+
duration: string;
|
|
70
|
+
impressionCount: number;
|
|
71
|
+
trackingEventCount: number;
|
|
72
|
+
mediaFiles: InspectMediaFile[];
|
|
73
|
+
companionCount: number;
|
|
74
|
+
wrapperUri: string | null;
|
|
75
|
+
}
|
|
76
|
+
|
|
54
77
|
/**
|
|
55
78
|
* Validate a VAST XML string using default settings.
|
|
56
79
|
*
|
|
@@ -76,6 +99,11 @@ export declare function validateWithOptions(
|
|
|
76
99
|
options: ValidateOptions
|
|
77
100
|
): ValidationResult;
|
|
78
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Extract creative and wrapper metadata from a single VAST XML document.
|
|
104
|
+
*/
|
|
105
|
+
export declare function inspectDocument(xml: string): InspectDocumentResult;
|
|
106
|
+
|
|
79
107
|
/**
|
|
80
108
|
* Like `validate`, but filters the returned issues to those at or above
|
|
81
109
|
* `minSeverity`. Useful when you only care about hard errors.
|
package/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// wasm-pack generates vastlint_wasm.js (ESM glue) and vastlint_wasm_bg.wasm.
|
|
18
18
|
// assemble.js copies both to the package root during the build.
|
|
19
19
|
import * as _wasm from './vastlint_wasm.js';
|
|
20
|
-
export const { validate, validateWithOptions, rules, fix, fixWithOptions } = _wasm;
|
|
20
|
+
export const { validate, validateWithOptions, rules, fix, fixWithOptions, inspectDocument } = _wasm;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Validate a VAST XML string and return only issues at or above a minimum severity.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vastlint",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
4
4
|
"description": "VAST XML linter — validates IAB VAST 2.0–4.3 ad tags against the full spec. 121 rules. Rust/WASM core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Alex Sekowski <alex@vastlint.org>",
|
|
@@ -60,9 +60,13 @@
|
|
|
60
60
|
"README.md"
|
|
61
61
|
],
|
|
62
62
|
"scripts": {
|
|
63
|
-
"build": "wasm-pack build ../crates/vastlint-wasm --target bundler --out-dir pkg && wasm-pack build ../crates/vastlint-wasm --target nodejs --out-dir pkg-node && node scripts/assemble.js"
|
|
63
|
+
"build": "wasm-pack build ../crates/vastlint-wasm --target bundler --out-dir ../../npm/pkg && wasm-pack build ../crates/vastlint-wasm --target nodejs --out-dir ../../npm/pkg-node && node scripts/assemble.js",
|
|
64
|
+
"test:runtime": "npm run build && node --test scripts/runtime-smoke.cjs"
|
|
64
65
|
},
|
|
65
66
|
"engines": {
|
|
66
67
|
"node": ">=18"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
67
71
|
}
|
|
68
72
|
}
|
package/vastlint_wasm.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ export function fix(xml: string): any;
|
|
|
34
34
|
*/
|
|
35
35
|
export function fixWithOptions(xml: string, options: any): any;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Extract creative and wrapper metadata from a single VAST XML document.
|
|
39
|
+
*/
|
|
40
|
+
export function inspectDocument(xml: string): any;
|
|
41
|
+
|
|
37
42
|
/**
|
|
38
43
|
* Returns the full rule catalog as a JS array.
|
|
39
44
|
*
|
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
|
-
fix, fixWithOptions, rules, validate, validateWithOptions
|
|
8
|
+
fix, fixWithOptions, inspectDocument, rules, validate, validateWithOptions
|
|
9
9
|
} from "./vastlint_wasm_bg.js";
|
package/vastlint_wasm_bg.js
CHANGED
|
@@ -52,6 +52,21 @@ export function fixWithOptions(xml, options) {
|
|
|
52
52
|
return takeFromExternrefTable0(ret[0]);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Extract creative and wrapper metadata from a single VAST XML document.
|
|
57
|
+
* @param {string} xml
|
|
58
|
+
* @returns {any}
|
|
59
|
+
*/
|
|
60
|
+
export function inspectDocument(xml) {
|
|
61
|
+
const ptr0 = passStringToWasm0(xml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
62
|
+
const len0 = WASM_VECTOR_LEN;
|
|
63
|
+
const ret = wasm.inspectDocument(ptr0, len0);
|
|
64
|
+
if (ret[2]) {
|
|
65
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
66
|
+
}
|
|
67
|
+
return takeFromExternrefTable0(ret[0]);
|
|
68
|
+
}
|
|
69
|
+
|
|
55
70
|
/**
|
|
56
71
|
* Returns the full rule catalog as a JS array.
|
|
57
72
|
*
|
package/vastlint_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const fix: (a: number, b: number) => [number, number, number];
|
|
5
5
|
export const fixWithOptions: (a: number, b: number, c: any) => [number, number, number];
|
|
6
|
+
export const inspectDocument: (a: number, b: number) => [number, number, number];
|
|
6
7
|
export const rules: () => [number, number, number];
|
|
7
8
|
export const validate: (a: number, b: number) => [number, number, number];
|
|
8
9
|
export const validateWithOptions: (a: number, b: number, c: any) => [number, number, number];
|
package/vastlint_wasm_cjs.js
CHANGED
|
@@ -56,6 +56,22 @@ function fixWithOptions(xml, options) {
|
|
|
56
56
|
}
|
|
57
57
|
exports.fixWithOptions = fixWithOptions;
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Extract creative and wrapper metadata from a single VAST XML document.
|
|
61
|
+
* @param {string} xml
|
|
62
|
+
* @returns {any}
|
|
63
|
+
*/
|
|
64
|
+
function inspectDocument(xml) {
|
|
65
|
+
const ptr0 = passStringToWasm0(xml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
66
|
+
const len0 = WASM_VECTOR_LEN;
|
|
67
|
+
const ret = wasm.inspectDocument(ptr0, len0);
|
|
68
|
+
if (ret[2]) {
|
|
69
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
70
|
+
}
|
|
71
|
+
return takeFromExternrefTable0(ret[0]);
|
|
72
|
+
}
|
|
73
|
+
exports.inspectDocument = inspectDocument;
|
|
74
|
+
|
|
59
75
|
/**
|
|
60
76
|
* Returns the full rule catalog as a JS array.
|
|
61
77
|
*
|