mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-18 07:24:07 +01:00
Migrate to Vite+ unified toolchain (#428)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/* oxlint-disable no-base-to-string */
|
||||
import { DOMParser } from '@xmldom/xmldom';
|
||||
import type { PluginDefinition } from '@yaakapp/api';
|
||||
import xpath from 'xpath';
|
||||
@@ -7,7 +8,7 @@ export const plugin: PluginDefinition = {
|
||||
name: 'XPath',
|
||||
description: 'Filter XPath',
|
||||
onFilter(_ctx, args) {
|
||||
// biome-ignore lint/suspicious/noExplicitAny: none
|
||||
// oxlint-disable-next-line no-explicit-any
|
||||
const doc: any = new DOMParser().parseFromString(args.payload, 'text/xml');
|
||||
try {
|
||||
const result = xpath.select(args.filter, doc, false);
|
||||
@@ -17,7 +18,7 @@ export const plugin: PluginDefinition = {
|
||||
// Not sure what cases this happens in (?)
|
||||
return { content: String(result) };
|
||||
} catch (err) {
|
||||
return { content: '', error: `Invalid filter: ${err}` };
|
||||
return { content: '', error: `Invalid filter: ${err instanceof Error ? err.message : String(err)}` };
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user