Skip to content

Commit bee5368

Browse files
committed
fix: tree.match is not a function
1 parent c96e085 commit bee5368

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/locals.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const vm = require('vm')
44
const matchHelper = require('posthtml-match-helper')
55
const { render } = require('posthtml-render')
6+
const { match } = require('posthtml/lib/api')
67

78
// const code = 'module.exports = {a: 1}';
89
const ctx = vm.createContext({ module })
@@ -22,7 +23,7 @@ function scriptDataLocals (tree, options) {
2223
const locals = {}
2324
const localsAttr = options.localsAttr || 'locals'
2425

25-
tree.match(matchHelper(`script[${localsAttr}]`), node => {
26+
match.call(tree, matchHelper(`script[${localsAttr}]`), node => {
2627
if (node.content) {
2728
const code = render(node.content)
2829

0 commit comments

Comments
 (0)