@mintlify/common 1.0.1080 → 1.0.1082

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.
@@ -25,6 +25,8 @@ export const COMPONENTS_WITHOUT_ID = new Set([
25
25
  'DynamicCustomComponent',
26
26
  'Expandable',
27
27
  'Frame',
28
+ 'GitHub',
29
+ 'Github',
28
30
  'Icon',
29
31
  'Latex',
30
32
  'Mermaid',
@@ -1,7 +1,7 @@
1
1
  import type { Root } from 'mdast';
2
2
  import type { FileType, FileWithImports } from '../../types/mdx/index.js';
3
3
  export type ResolveImportsWarning = {
4
- type: 'invalid-import-path' | 'missing-file' | 'import-resolution-error';
4
+ type: 'invalid-import-path' | 'missing-file' | 'import-resolution-error' | 'default-import-no-default-export';
5
5
  message: string;
6
6
  };
7
7
  export declare const resolveAllImports: (params: {
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { MdxImportSpecifier } from '../../types/mdx/snippets/import.js';
10
11
  import { getExportMapFromTree } from './getExportMap.js';
11
12
  import { resolveImport } from './resolveImport/index.js';
12
13
  import { resolveImportPath } from './resolveImportPath.js';
@@ -37,10 +38,23 @@ export const resolveAllImports = (params) => __awaiter(void 0, void 0, void 0, f
37
38
  }
38
39
  continue;
39
40
  }
41
+ const snippetExportMap = getExportMapFromTree(importedSnippet.tree);
40
42
  const specifiers = fileWithImports.importMap[source];
41
43
  if (specifiers == undefined)
42
44
  continue;
43
45
  for (const specifier of specifiers) {
46
+ if (specifier.type === MdxImportSpecifier.ImportDefaultSpecifier &&
47
+ !('default' in snippetExportMap) &&
48
+ Object.keys(snippetExportMap).length > 0 &&
49
+ importedSnippet.tree.children.every((node) => node.type === 'yaml' || node.type === 'mdxjsEsm')) {
50
+ const message = `Default import "${specifier.name}" in ${fileWithImports.filename} will not render — ${resolvedPath} has no default export. Use a named import instead: import { ExportName } from '${source}'`;
51
+ if (onWarning) {
52
+ onWarning({ type: 'default-import-no-default-export', message });
53
+ }
54
+ else {
55
+ console.log(message);
56
+ }
57
+ }
44
58
  try {
45
59
  const contentWithResolvedImport = yield resolveImport(specifier, ast, importedSnippet.tree, exportMap);
46
60
  if (contentWithResolvedImport == undefined) {
package/dist/mdx/utils.js CHANGED
@@ -80,6 +80,10 @@ export const allowedComponents = [
80
80
  'Column',
81
81
  'Expandable',
82
82
  'Frame',
83
+ 'GitHub',
84
+ 'GitHub.Repo',
85
+ 'Github',
86
+ 'Github.Repo',
83
87
  'Heading',
84
88
  'Info',
85
89
  'Icon',