vastlint 0.3.0 → 0.3.2

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 CHANGED
@@ -13,6 +13,8 @@ module.exports = {
13
13
  validate: wasm.validate,
14
14
  validateWithOptions: wasm.validateWithOptions,
15
15
  rules: wasm.rules,
16
+ fix: wasm.fix,
17
+ fixWithOptions: wasm.fixWithOptions,
16
18
  validateFiltered(xml, minSeverity = 'error') {
17
19
  const order = { error: 2, warning: 1, info: 0 };
18
20
  const min = order[minSeverity] ?? 0;
package/index.d.ts CHANGED
@@ -89,3 +89,41 @@ export declare function validateFiltered(
89
89
  * Returns the full catalog of all known validation rules.
90
90
  */
91
91
  export declare function rules(): RuleMeta[];
92
+
93
+ /** A single fix that was automatically applied to the document. */
94
+ export interface AppliedFix {
95
+ /** The rule ID this fix addresses, e.g. `"VAST-2.0-mediafile-https"`. */
96
+ rule_id: string;
97
+ /** Human-readable description of what was changed. */
98
+ description: string;
99
+ /** XPath-like path to the element that was modified. */
100
+ path: string;
101
+ }
102
+
103
+ export interface FixResult {
104
+ /** The repaired VAST XML string. */
105
+ xml: string;
106
+ /** All fixes that were successfully applied, in document order. */
107
+ applied: AppliedFix[];
108
+ /** Issues that remain after all fixes were applied (require manual intervention). */
109
+ remaining: Issue[];
110
+ }
111
+
112
+ /**
113
+ * Fix a VAST XML string using default settings.
114
+ * Upgrades http:// URLs to https:// and removes deprecated attributes.
115
+ *
116
+ * @example
117
+ * import { fix } from 'vastlint';
118
+ * const result = fix(xml);
119
+ * console.log(result.xml); // repaired XML
120
+ * console.log(result.applied); // what was changed
121
+ * console.log(result.remaining); // issues that need manual attention
122
+ */
123
+ export declare function fix(xml: string): FixResult;
124
+
125
+ /**
126
+ * Fix a VAST XML string with caller-supplied options.
127
+ * Accepts the same options object as `validateWithOptions`.
128
+ */
129
+ export declare function fixWithOptions(xml: string, options: ValidateOptions): FixResult;
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 } = _wasm;
20
+ export const { validate, validateWithOptions, rules, fix, fixWithOptions } = _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.3.0",
3
+ "version": "0.3.2",
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
+ }
Binary file