Skip to content

Commit c2ad884

Browse files
authored
build: don't expose page errors (#209)
1 parent a690a6e commit c2ad884

File tree

1 file changed

+6
-2
lines changed
  • packages/metascraper-readability

1 file changed

+6
-2
lines changed

packages/metascraper-readability/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
const { createValidator } = require('@metascraper/helpers')
44
const Readability = require('readability')
55
const memoizeOne = require('memoize-one')
6-
const { JSDOM } = require('jsdom')
6+
const jsdom = require('jsdom')
7+
8+
const { JSDOM } = jsdom
79

810
const memoFn = (newArgs, oldArgs) => newArgs[0].url === oldArgs[0].url
911

12+
const virtualConsole = new jsdom.VirtualConsole()
13+
1014
const readability = memoizeOne(({ htmlDom, url }) => {
11-
const dom = new JSDOM(htmlDom.html(), { url })
15+
const dom = new JSDOM(htmlDom.html(), { virtualConsole, url })
1216
const reader = new Readability(dom.window.document)
1317
return reader.parse()
1418
}, memoFn)

0 commit comments

Comments
 (0)