@mui/internal-docs-infra 0.12.1-canary.41 → 0.12.1-canary.43

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-docs-infra",
3
- "version": "0.12.1-canary.41",
3
+ "version": "0.12.1-canary.43",
4
4
  "author": "MUI Team",
5
5
  "description": "MUI Infra - internal documentation creation tools.",
6
6
  "license": "MIT",
@@ -31,17 +31,17 @@
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.29.7",
33
33
  "@csstools/postcss-light-dark-function": "^3.0.3",
34
- "@csstools/postcss-relative-color-syntax": "^4.0.8",
34
+ "@csstools/postcss-relative-color-syntax": "^4.0.9",
35
35
  "@csstools/postcss-stepped-value-functions": "^5.0.4",
36
36
  "@orama/orama": "^3.1.18",
37
37
  "@orama/plugin-qps": "^3.1.18",
38
38
  "@orama/stemmers": "^3.1.18",
39
39
  "@orama/stopwords": "^3.1.18",
40
- "@wooorm/starry-night": "^3.10.0",
40
+ "@wooorm/starry-night": "^3.11.0",
41
41
  "autoprefixer": "^10.5.4",
42
42
  "chalk": "^6.0.0",
43
43
  "clipboard-copy": "^4.0.1",
44
- "es-toolkit": "^1.51.0",
44
+ "es-toolkit": "^1.52.0",
45
45
  "fflate": "^0.8.3",
46
46
  "hast-util-to-jsx-runtime": "^2.3.6",
47
47
  "hast-util-to-text": "^4.0.2",
@@ -62,7 +62,7 @@
62
62
  "remark-mdx": "^3.1.1",
63
63
  "remark-parse": "^11.0.0",
64
64
  "remark-stringify": "^11.0.0",
65
- "remark-typography": "^0.8.1",
65
+ "remark-typography": "^0.8.2",
66
66
  "sucrase": "^3.35.1",
67
67
  "typescript": "npm:@typescript/typescript6@6.0.2",
68
68
  "typescript-api-extractor": "1.0.0-beta.6",
@@ -804,5 +804,5 @@
804
804
  "bin": {
805
805
  "docs-infra": "./cli/index.mjs"
806
806
  },
807
- "gitSha": "96f05ba632fabe0c395fd6bf647b40c3bb717ee6"
807
+ "gitSha": "2a2c232ded2053934aa082b335952c525c6ea88c"
808
808
  }
@@ -0,0 +1,14 @@
1
+ import type * as tae from 'typescript-api-extractor';
2
+ /**
3
+ * Checks if a type name belongs to a built-in namespace.
4
+ *
5
+ * Names are compared whole: a `PickerConfig` of ours is not the built-in `Pick`.
6
+ */
7
+ export declare function isBuiltInTypeName(typeName: tae.TypeName): boolean;
8
+ /**
9
+ * Whether a type is one the reader already knows, rather than one these docs describe.
10
+ *
11
+ * A wrapper qualifies only when its arguments do too: the keys of `Omit<Config, 'size'>`
12
+ * come from `Config`, so naming the wrapper would describe nothing.
13
+ */
14
+ export declare function isBuiltInTypeReference(type: tae.AnyType): boolean;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Type namespaces the reader is expected to know, which these docs are therefore not
3
+ * responsible for describing.
4
+ */
5
+ const BUILT_IN_NAMESPACES = ['React', 'JSX', 'HTML', 'CSS', 'SVG', 'Omit', 'Pick', 'Partial'];
6
+
7
+ /**
8
+ * Checks if a type name belongs to a built-in namespace.
9
+ *
10
+ * Names are compared whole: a `PickerConfig` of ours is not the built-in `Pick`.
11
+ */
12
+ export function isBuiltInTypeName(typeName) {
13
+ return BUILT_IN_NAMESPACES.some(builtIn => typeName.name === builtIn || (typeName.namespaces?.includes(builtIn) ?? false));
14
+ }
15
+
16
+ /** The name a type is written as, for the node kinds that carry one. */
17
+ function namedAs(type) {
18
+ return 'typeName' in type ? type.typeName : undefined;
19
+ }
20
+
21
+ /**
22
+ * Whether a type is one the reader already knows, rather than one these docs describe.
23
+ *
24
+ * A wrapper qualifies only when its arguments do too: the keys of `Omit<Config, 'size'>`
25
+ * come from `Config`, so naming the wrapper would describe nothing.
26
+ */
27
+ export function isBuiltInTypeReference(type) {
28
+ const typeName = namedAs(type);
29
+ if (typeName === undefined || !isBuiltInTypeName(typeName)) {
30
+ return false;
31
+ }
32
+ return typeName.typeArguments?.every(
33
+ // Literals and intrinsics name nothing, so they cannot disqualify their wrapper.
34
+ argument => namedAs(argument.type) === undefined || isBuiltInTypeReference(argument.type)) ?? true;
35
+ }
@@ -25,11 +25,6 @@ export interface ExternalTypesCollector {
25
25
  /** Map of original export names to dotted display names, used to identify renamed own types */
26
26
  typeNameMap?: Record<string, string>;
27
27
  }
28
- /**
29
- * Checks if a type name belongs to a built-in namespace that should be skipped
30
- * during external type collection.
31
- */
32
- export declare function isBuiltInTypeName(typeName: tae.TypeName): boolean;
33
28
  /**
34
29
  * Checks whether a type name belongs to one of the module's own exports.
35
30
  * Matches both direct export names (e.g., `AlertDialogRootChangeEventReason`)
@@ -1,5 +1,6 @@
1
1
  import { uniq } from 'es-toolkit';
2
2
  import { isExternalType, isIntrinsicType, isUnionType, isObjectType, isLiteralType, isTypeOperatorType, isTypeQueryType } from "./typeGuards.mjs";
3
+ import { isBuiltInTypeName } from "./builtInTypes.mjs";
3
4
  import { groupType, UNION_OR_INTERSECTION } from "./precedence.mjs";
4
5
 
5
6
  /**
@@ -14,20 +15,6 @@ import { groupType, UNION_OR_INTERSECTION } from "./precedence.mjs";
14
15
  * external types as they are encountered in the formatted output.
15
16
  */
16
17
 
17
- /**
18
- * Built-in type namespaces that should not be collected as external types.
19
- */
20
- const BUILT_IN_NAMESPACES = ['React', 'JSX', 'HTML', 'CSS', 'SVG', 'Omit', 'Pick', 'Partial'];
21
-
22
- /**
23
- * Checks if a type name belongs to a built-in namespace that should be skipped
24
- * during external type collection.
25
- */
26
- export function isBuiltInTypeName(typeName) {
27
- const name = typeName.name || '';
28
- return BUILT_IN_NAMESPACES.some(ns => name.startsWith(ns) || (typeName.namespaces?.includes(ns) ?? false));
29
- }
30
-
31
18
  /**
32
19
  * Checks whether a type name belongs to one of the module's own exports.
33
20
  * Matches both direct export names (e.g., `AlertDialogRootChangeEventReason`)
@@ -1,6 +1,7 @@
1
1
  import { uniq } from 'es-toolkit';
2
2
  import { isExternalType, isIntrinsicType, isUnionType, isIntersectionType, isObjectType, isAnonymousObjectType, isArrayType, isFunctionType, isLiteralType, isTupleType, isTypeParameterType, isTypeOperatorType, isTypeQueryType, isInternalTypeName } from "./typeGuards.mjs";
3
3
  import { isOwnTypeName, maybeCollectExternalUnion, maybeCollectExternalFunction, maybeCollectExternalReference } from "./externalTypes.mjs";
4
+ import { isBuiltInTypeReference } from "./builtInTypes.mjs";
4
5
  import { prettyFormat } from "./format.mjs";
5
6
  import { groupType, UNION, UNION_OR_INTERSECTION } from "./precedence.mjs";
6
7
  /**
@@ -9,9 +10,17 @@ import { groupType, UNION, UNION_OR_INTERSECTION } from "./precedence.mjs";
9
10
  *
10
11
  * A type parameter operand is kept by name in raw declarations: the checker resolves
11
12
  * `keyof T` to its base constraint, which holds no type parameter to recover `T` from.
13
+ *
14
+ * A built-in operand is kept by name too. Its keys are the reader's to already know, and
15
+ * listing them buries the page: `keyof React.JSX.IntrinsicElements` says what a wall of
16
+ * tag names does not. Types the page is responsible for documenting still expand, since
17
+ * nothing else on the page would tell the reader what their keys are.
18
+ *
12
19
  * Both the union branch and the operator branch ask this, so they cannot disagree about
13
20
  * which operators expand. `formatExternalTypeDefinition` takes no options and always
14
- * expands, so it deliberately does not share this rule.
21
+ * expands, so it deliberately does not share this rule: an operator reached through a
22
+ * collected type still shows its keys in the External Types section, whichever reason
23
+ * kept it by name here.
15
24
  */
16
25
  function resolvedOperatorKeys(type, preserveTypeParameters) {
17
26
  if (!isTypeOperatorType(type) || type.resolvedType === undefined) {
@@ -20,6 +29,9 @@ function resolvedOperatorKeys(type, preserveTypeParameters) {
20
29
  if (preserveTypeParameters && isTypeParameterType(type.type)) {
21
30
  return undefined;
22
31
  }
32
+ if (isBuiltInTypeReference(type.type)) {
33
+ return undefined;
34
+ }
23
35
  return type.resolvedType;
24
36
  }
25
37
  export function formatType(type, options) {