@mintlify/common 1.0.791 → 1.0.793

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,6 +1,5 @@
1
1
  import type { Program, Property } from 'estree-jsx';
2
2
  import type { Root } from 'mdast';
3
- export declare const REACT_HOOKS: string[];
4
3
  export declare function isStringSafe(value: string): boolean;
5
4
  export declare function filterStyleProperties(estree: Program): Program | null;
6
5
  export declare function rebuildStyleValue(properties: Property[]): string;
@@ -135,25 +135,6 @@ const DEFAULT_PROP_EXPRESSIONS = {
135
135
  'x-hidden': { value: '"true"', estree: trueEstree },
136
136
  'x-excluded': { value: '"true"', estree: trueEstree },
137
137
  };
138
- export const REACT_HOOKS = [
139
- 'useState',
140
- 'useEffect',
141
- 'useRef',
142
- 'useCallback',
143
- 'useMemo',
144
- 'useReducer',
145
- 'useContext',
146
- 'useLayoutEffect',
147
- 'useImperativeHandle',
148
- 'useDebugValue',
149
- 'useDeferredValue',
150
- 'useTransition',
151
- 'useId',
152
- 'useSyncExternalStore',
153
- 'useInsertionEffect',
154
- 'useOptimistic',
155
- 'useActionState',
156
- ];
157
138
  export function isStringSafe(value) {
158
139
  switch (true) {
159
140
  case value === 'true':
@@ -230,25 +211,66 @@ export function rebuildStyleValue(properties) {
230
211
  });
231
212
  return `{ ${parts.join(', ')} }`;
232
213
  }
214
+ function collectIdentifiersFromPattern(pattern, out) {
215
+ if (pattern.type === 'Identifier') {
216
+ out.push({ name: pattern.name, isFunction: false });
217
+ }
218
+ else if (pattern.type === 'ObjectPattern') {
219
+ for (const prop of pattern.properties) {
220
+ if (prop.type === 'Property') {
221
+ collectIdentifiersFromPattern(prop.value, out);
222
+ }
223
+ else {
224
+ collectIdentifiersFromPattern(prop.argument, out);
225
+ }
226
+ }
227
+ }
228
+ else if (pattern.type === 'ArrayPattern') {
229
+ for (const el of pattern.elements) {
230
+ if (el)
231
+ collectIdentifiersFromPattern(el, out);
232
+ }
233
+ }
234
+ else if (pattern.type === 'AssignmentPattern') {
235
+ collectIdentifiersFromPattern(pattern.left, out);
236
+ }
237
+ else if (pattern.type === 'RestElement') {
238
+ collectIdentifiersFromPattern(pattern.argument, out);
239
+ }
240
+ }
233
241
  function collectExportedNames(estree) {
234
242
  var _a, _b;
235
243
  const names = [];
236
244
  for (const node of estree.body) {
237
245
  if (node.type !== 'ExportNamedDeclaration')
238
246
  continue;
239
- const decl = node.declaration;
240
- if (!decl)
247
+ const exportNode = node;
248
+ const decl = exportNode.declaration;
249
+ if (!decl) {
250
+ // Re-export specifiers: export { X } from 'module' or export { X }
251
+ for (const spec of exportNode.specifiers) {
252
+ // ES2022 allows Literal export names (e.g. export { foo as "bar" }),
253
+ // which have no .name — skip to avoid emitting `export const undefined = undefined`
254
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
255
+ if (spec.exported.type !== 'Identifier')
256
+ continue;
257
+ names.push({ name: spec.exported.name, isFunction: false });
258
+ }
241
259
  continue;
260
+ }
242
261
  if (decl.type === 'FunctionDeclaration' && decl.id) {
243
262
  names.push({ name: decl.id.name, isFunction: true });
244
263
  }
245
264
  else if (decl.type === 'VariableDeclaration') {
246
265
  for (const declarator of decl.declarations) {
247
- if (declarator.id.type !== 'Identifier')
248
- continue;
249
- const isFn = ((_a = declarator.init) === null || _a === void 0 ? void 0 : _a.type) === 'ArrowFunctionExpression' ||
250
- ((_b = declarator.init) === null || _b === void 0 ? void 0 : _b.type) === 'FunctionExpression';
251
- names.push({ name: declarator.id.name, isFunction: isFn });
266
+ if (declarator.id.type === 'Identifier') {
267
+ const isFn = ((_a = declarator.init) === null || _a === void 0 ? void 0 : _a.type) === 'ArrowFunctionExpression' ||
268
+ ((_b = declarator.init) === null || _b === void 0 ? void 0 : _b.type) === 'FunctionExpression';
269
+ names.push({ name: declarator.id.name, isFunction: isFn });
270
+ }
271
+ else {
272
+ collectIdentifiersFromPattern(declarator.id, names);
273
+ }
252
274
  }
253
275
  }
254
276
  }