@mintlify/common 1.0.782 → 1.0.783
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,35 +231,37 @@ export function rebuildStyleValue(properties) {
|
|
|
231
231
|
});
|
|
232
232
|
return `{ ${parts.join(', ')} }`;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function isUnsafeEsm(estree) {
|
|
235
235
|
if (!estree.body.length)
|
|
236
236
|
return false;
|
|
237
|
-
let
|
|
237
|
+
let hasUnsafeNode = 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
|
-
|
|
240
|
+
switch (node.type) {
|
|
241
|
+
// Function/class definitions (could be used as executable components)
|
|
242
|
+
case 'FunctionDeclaration':
|
|
243
|
+
case 'FunctionExpression':
|
|
244
|
+
case 'ArrowFunctionExpression':
|
|
245
|
+
case 'ClassDeclaration':
|
|
246
|
+
case 'ClassExpression':
|
|
247
|
+
// Code execution
|
|
248
|
+
case 'CallExpression':
|
|
249
|
+
case 'NewExpression':
|
|
250
|
+
case 'ImportExpression':
|
|
251
|
+
case 'TaggedTemplateExpression':
|
|
252
|
+
case 'AwaitExpression':
|
|
253
|
+
case 'YieldExpression':
|
|
254
|
+
// Side effects
|
|
255
|
+
case 'AssignmentExpression':
|
|
256
|
+
case 'UpdateExpression':
|
|
257
|
+
// Property access (could read process.env, globalThis, etc.)
|
|
258
|
+
case 'MemberExpression':
|
|
259
|
+
hasUnsafeNode = true;
|
|
260
|
+
return this.skip();
|
|
259
261
|
}
|
|
260
262
|
},
|
|
261
263
|
});
|
|
262
|
-
return
|
|
264
|
+
return hasUnsafeNode;
|
|
263
265
|
}
|
|
264
266
|
function isArrayOfStringLiterals(estree) {
|
|
265
267
|
const stmt = estree.body[0];
|
|
@@ -276,11 +278,9 @@ export function remarkMdxRemoveJs() {
|
|
|
276
278
|
var _a;
|
|
277
279
|
if (!isMdxJsEsm(node))
|
|
278
280
|
return false;
|
|
279
|
-
if (((_a = node.data) === null || _a === void 0 ? void 0 : _a.estree)
|
|
281
|
+
if (!((_a = node.data) === null || _a === void 0 ? void 0 : _a.estree))
|
|
280
282
|
return false;
|
|
281
|
-
|
|
282
|
-
const containsReact = REACT_HOOKS.some((hook) => value.includes(hook) || value.includes('React.' + hook.toLowerCase()));
|
|
283
|
-
return containsReact;
|
|
283
|
+
return isUnsafeEsm(node.data.estree);
|
|
284
284
|
});
|
|
285
285
|
visit(tree, (node) => {
|
|
286
286
|
if (!('attributes' in node))
|