Skip to content

Commit 3af17c5

Browse files
committed
Build internal packages with tsdown
Switch @mui/internal-api-docs-builder, @mui/internal-core-docs and @mui/internal-docs-utils from `code-infra build` to `code-infra build-new`. core-docs needs two source changes for its declarations: - `standardNavIcons` gets an explicit type. Its inferred declaration pointed at `packages/mui-material/src`, a path that doesn't exist in the published package and that build-new refuses to bundle. - `VersionsContext` moves from JavaScript to TypeScript. build-new writes declarations for TypeScript sources only, so the context was re-exported without a declaration. `tsBuildInfoFile` pointed into `build/`, so build-new published the build info file. Without it the file stays out of the package, as in api-docs-builder.
1 parent efccbe5 commit 3af17c5

8 files changed

Lines changed: 19 additions & 22 deletions

File tree

‎packages-internal/api-docs-builder/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"test": "pnpm --workspace-root test:unit --project \"*:@mui/internal-api-docs-builder\"",
99
"typescript": "tsc -p tsconfig.json",
10-
"build": "code-infra build --tsgo --flat --skipBabelRuntimeCheck"
10+
"build": "code-infra build-new"
1111
},
1212
"repository": {
1313
"type": "git",

‎packages-internal/core-docs/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"homepage": "https://github.com/mui/material-ui/tree/master/packages-internal/core-docs",
2424
"scripts": {
25-
"build": "code-infra build --tsgo --flat --bundle esm --copy \"src/translations/translations.json\" --copy \"src/nextFonts/fonts\" --copy \"src/ThemeContext/syntax.css\"",
25+
"build": "code-infra build-new --bundle esm --copy \"src/translations/translations.json\" --copy \"src/nextFonts/fonts\" --copy \"src/ThemeContext/syntax.css\"",
2626
"release": "pnpm build && pnpm publish",
2727
"test": "exit 0",
2828
"typescript": "tsc -p tsconfig.json"

‎packages-internal/core-docs/src/AppLayout/icons/navIcons.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import type SvgIcon from '@mui/material/SvgIcon';
12
import ArticleRoundedIcon from '@mui/icons-material/ArticleRounded';
23
import VisibilityRoundedIcon from '@mui/icons-material/VisibilityRounded';
34
import BookRoundedIcon from '@mui/icons-material/BookRounded';
45
import ChromeReaderModeRoundedIcon from '@mui/icons-material/ChromeReaderModeRounded';
56
import WebRoundedIcon from '@mui/icons-material/WebRounded';
67

7-
export const standardNavIcons = {
8+
type NavIconName = 'ReaderIcon' | 'BookIcon' | 'DescriptionIcon' | 'VisibilityIcon' | 'WebIcon';
9+
10+
// Without the annotation, the declaration points at `packages/mui-material/src`.
11+
export const standardNavIcons: Record<NavIconName, typeof SvgIcon> = {
812
ReaderIcon: ChromeReaderModeRoundedIcon,
913
BookIcon: BookRoundedIcon,
1014
DescriptionIcon: ArticleRoundedIcon,

‎packages-internal/core-docs/src/DocsApp/VersionsContext.js‎

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as React from 'react';
2+
3+
export type VersionsContextValue = Array<{ version: string; url: string }>;
4+
5+
const VersionsContext = React.createContext<VersionsContextValue>(null!);
6+
7+
if (process.env.NODE_ENV !== 'production') {
8+
VersionsContext.displayName = 'VersionsContext';
9+
}
10+
11+
export default VersionsContext;

‎packages-internal/core-docs/tsconfig.build.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"emitDeclarationOnly": true,
1010
"outDir": "build",
1111
"rootDir": "./src",
12-
"tsBuildInfoFile": "build/tsconfig.build.tsbuildinfo",
1312
"paths": {
1413
"@mui/internal-markdown": ["../markdown/index.d.mts"],
1514
"@mui/internal-markdown/prism": ["../markdown/prism.d.mts"]

‎packages-internal/docs-utils/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"scripts": {
1313
"prebuild": "rimraf ./build",
14-
"build": "code-infra build --tsgo --flat --skip-babel-runtime-check",
14+
"build": "code-infra build-new",
1515
"typescript": "tsc -p tsconfig.json",
1616
"release:publish": "pnpm build && pnpm publish --tag latest",
1717
"release:publish:dry-run": "pnpm build && pnpm publish --tag latest --registry=\"http://localhost:4873/\""

‎packages-internal/docs-utils/tsconfig.build.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"declaration": true,
77
"noEmit": false,
88
"composite": true,
9-
"tsBuildInfoFile": "./build/.tsbuildinfo",
109
"target": "ES2020",
1110
"types": ["node"]
1211
},

0 commit comments

Comments
 (0)