@mintlify/common 1.0.784 → 1.0.786
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.
|
@@ -231,45 +231,35 @@ export function rebuildStyleValue(properties) {
|
|
|
231
231
|
});
|
|
232
232
|
return `{ ${parts.join(', ')} }`;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function isFunction(estree) {
|
|
235
235
|
if (!estree.body.length)
|
|
236
236
|
return false;
|
|
237
|
-
let
|
|
237
|
+
let hasFunctionDeclaration = false;
|
|
238
238
|
walk(estree, {
|
|
239
239
|
enter(node) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
hasUnsafeNode = true;
|
|
260
|
-
return this.skip();
|
|
261
|
-
// Re-exports pull in external modules (e.g. `export { readFileSync } from 'fs'`)
|
|
262
|
-
case 'ExportNamedDeclaration':
|
|
263
|
-
case 'ExportAllDeclaration':
|
|
264
|
-
if ('source' in node && node.source != null) {
|
|
265
|
-
hasUnsafeNode = true;
|
|
266
|
-
return this.skip();
|
|
267
|
-
}
|
|
268
|
-
break;
|
|
240
|
+
if (node.type === 'FunctionDeclaration' ||
|
|
241
|
+
node.type === 'ArrowFunctionExpression' ||
|
|
242
|
+
node.type === 'FunctionExpression') {
|
|
243
|
+
hasFunctionDeclaration = true;
|
|
244
|
+
return this.skip();
|
|
245
|
+
}
|
|
246
|
+
if (node.type === 'ExportDefaultDeclaration' &&
|
|
247
|
+
(node.declaration.type === 'FunctionDeclaration' ||
|
|
248
|
+
node.declaration.type === 'FunctionExpression' ||
|
|
249
|
+
node.declaration.type === 'ArrowFunctionExpression')) {
|
|
250
|
+
hasFunctionDeclaration = true;
|
|
251
|
+
return this.skip();
|
|
252
|
+
}
|
|
253
|
+
if (node.type === 'VariableDeclaration' &&
|
|
254
|
+
node.declarations.some((decl) => decl.init &&
|
|
255
|
+
(decl.init.type === 'ArrowFunctionExpression' ||
|
|
256
|
+
decl.init.type === 'FunctionExpression'))) {
|
|
257
|
+
hasFunctionDeclaration = true;
|
|
258
|
+
return this.skip();
|
|
269
259
|
}
|
|
270
260
|
},
|
|
271
261
|
});
|
|
272
|
-
return
|
|
262
|
+
return hasFunctionDeclaration;
|
|
273
263
|
}
|
|
274
264
|
function isArrayOfStringLiterals(estree) {
|
|
275
265
|
const stmt = estree.body[0];
|
|
@@ -286,9 +276,11 @@ export function remarkMdxRemoveJs() {
|
|
|
286
276
|
var _a;
|
|
287
277
|
if (!isMdxJsEsm(node))
|
|
288
278
|
return false;
|
|
289
|
-
if (
|
|
279
|
+
if (((_a = node.data) === null || _a === void 0 ? void 0 : _a.estree) && !isFunction(node.data.estree))
|
|
290
280
|
return false;
|
|
291
|
-
|
|
281
|
+
const value = node.value;
|
|
282
|
+
const containsReact = REACT_HOOKS.some((hook) => value.includes(hook) || value.includes('React.' + hook.toLowerCase()));
|
|
283
|
+
return containsReact;
|
|
292
284
|
});
|
|
293
285
|
visit(tree, (node) => {
|
|
294
286
|
if (!('attributes' in node))
|