Skip to content

Commit 960f228

Browse files
committed
build(deps): bump acorn-walk from 8.2.0 to 8.3.5 and update type definitions in JSX handlers
1 parent ad49cf1 commit 960f228

3 files changed

Lines changed: 30 additions & 15 deletions

File tree

package-lock.json

Lines changed: 15 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/purgecss-from-jsx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"acorn": "^8.7.0",
3131
"acorn-jsx": "^5.3.1",
3232
"acorn-jsx-walk": "^2.0.0",
33-
"acorn-walk": "^8.2.0"
33+
"acorn-walk": "^8.3.5"
3434
},
3535
"publishConfig": {
3636
"access": "public",

packages/purgecss-from-jsx/src/index.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ function purgeFromJsx(options?: acorn.Options) {
3636
).parse(content, options || { ecmaVersion: "latest" }),
3737
state,
3838
{
39-
JSXOpeningElement(acornNode, state, callback) {
39+
JSXOpeningElement(
40+
acornNode: acorn.Node,
41+
state: NodeState,
42+
callback: (node: acorn.Node, state: NodeState) => void,
43+
) {
4044
const node = acornNode as JSXOpeningElement;
4145
const nameState: NodeState = {};
4246

@@ -49,7 +53,11 @@ function purgeFromJsx(options?: acorn.Options) {
4953
callback(node.attributes[i], state);
5054
}
5155
},
52-
JSXAttribute(acornNode, state, callback) {
56+
JSXAttribute(
57+
acornNode: acorn.Node,
58+
state: NodeState,
59+
callback: (node: acorn.Node, state: NodeState) => void,
60+
) {
5361
const node = acornNode as JSXAttribute;
5462

5563
if (!node.value) {
@@ -78,22 +86,22 @@ function purgeFromJsx(options?: acorn.Options) {
7886
break;
7987
}
8088
},
81-
JSXIdentifier(acornNode, state) {
89+
JSXIdentifier(acornNode: acorn.Node, state: NodeState) {
8290
const node = acornNode as JSXIdentifier;
8391
state.text = node.name;
8492
},
85-
JSXNamespacedName(acornNode, state) {
93+
JSXNamespacedName(acornNode: acorn.Node, state: NodeState) {
8694
const node = acornNode as JSXNamespacedName;
8795
state.text = node.namespace.name + ":" + node.name.name;
8896
},
8997
// Only handle Literal for now, not JSXExpressionContainer | JSXElement
90-
Literal(acornNode, state) {
98+
Literal(acornNode: acorn.Node, state: NodeState) {
9199
const node = acornNode as Literal;
92100
if (typeof node.value === "string") {
93101
state.text = node.value;
94102
}
95103
},
96-
},
104+
} as unknown as walk.RecursiveVisitors<NodeState>,
97105
{ ...walk.base },
98106
);
99107

0 commit comments

Comments
 (0)