@mintlify/common 1.0.601 → 1.0.603
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { walk } from 'estree-walker';
|
|
2
2
|
import { remove } from 'unist-util-remove';
|
|
3
|
+
import { CONTINUE, visit } from 'unist-util-visit';
|
|
3
4
|
import { isMdxJsEsm } from '../../utils.js';
|
|
4
5
|
const REACT_HOOKS = [
|
|
5
6
|
'useState',
|
|
@@ -32,6 +33,23 @@ export const remarkMdxRemoveJs = () => (tree) => {
|
|
|
32
33
|
const containsReact = REACT_HOOKS.some((hook) => value.includes(hook) || value.includes('React.' + hook.toLowerCase()));
|
|
33
34
|
return containsReact;
|
|
34
35
|
});
|
|
36
|
+
visit(tree, (node) => {
|
|
37
|
+
if (!('attributes' in node))
|
|
38
|
+
return CONTINUE;
|
|
39
|
+
node.attributes = node.attributes.map((attr) => {
|
|
40
|
+
if (attr.type === 'mdxJsxExpressionAttribute') {
|
|
41
|
+
attr.value = '""';
|
|
42
|
+
if (attr.data)
|
|
43
|
+
attr.data = undefined;
|
|
44
|
+
}
|
|
45
|
+
if (attr.type === 'mdxJsxAttribute' && attr.value instanceof Object) {
|
|
46
|
+
attr.value.value = '""';
|
|
47
|
+
if (attr.value.data)
|
|
48
|
+
attr.value.data = undefined;
|
|
49
|
+
}
|
|
50
|
+
return attr;
|
|
51
|
+
});
|
|
52
|
+
});
|
|
35
53
|
};
|
|
36
54
|
function isFunction(estree) {
|
|
37
55
|
if (!estree.body.length)
|