Skip to content

[infra] WIP - use .mjs extension instead of nested package.json #46500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cdbe226
WIP
Janpot Jul 10, 2025
04009be
Delete dhjwg.d.ts
Janpot Jul 10, 2025
9eeb7cf
Rename all d.ts files to d.mts in esm output dir
Jul 11, 2025
903e9c2
Keep both d.ts and d.mts files in esm directory
Jul 11, 2025
05b3896
Reorder babel plugin to work with packages with css imports
Jul 14, 2025
bbb68db
Update scripts/copyFiles.mjs
Janpot Jul 15, 2025
6278f26
Do it in CI only
Janpot Jul 15, 2025
d3bf474
Update config.yml
Janpot Jul 15, 2025
b13db8d
fix build
Janpot Jul 16, 2025
a1eaa8f
fixes
Janpot Jul 16, 2025
687b783
Update config.yml
Janpot Jul 16, 2025
9833048
Update pnpm-lock.yaml
Janpot Jul 16, 2025
dadb879
Update pnpm-lock.yaml
Janpot Jul 16, 2025
721baf4
Merge remote-tracking branch 'upstream/master' into wip-mjs
Janpot Jul 16, 2025
81bcffd
not needed
Janpot Jul 16, 2025
6c9ef5c
Revert "not needed"
Janpot Jul 16, 2025
bdd2339
fixes
Janpot Jul 16, 2025
6946662
tweak
Janpot Jul 16, 2025
bd7da36
Update tsconfig.build.json
Janpot Jul 16, 2025
bda8c15
better handling of these augmentation files
Janpot Jul 16, 2025
af234da
Update index.ts
Janpot Jul 16, 2025
a707491
bring back exlude
Janpot Jul 16, 2025
ff4703e
Update tsconfig.json
Janpot Jul 16, 2025
0a1306a
Update coreTypeScriptProjects.js
Janpot Jul 16, 2025
2687d58
fix tsconfigPath setting
Janpot Jul 16, 2025
b59579a
Get rid of this, it does nothing
Janpot Jul 16, 2025
199d1b7
Merge remote-tracking branch 'upstream/master' into wip-mjs
Janpot Jul 24, 2025
244cf97
Update config.yml
Janpot Jul 24, 2025
52f26d1
Create exports path discovery function
Janpot Jul 28, 2025
9b3eed2
WIP
Janpot Jul 28, 2025
f90ba78
WIP
Janpot Jul 28, 2025
69b8201
Update exportsUtils.mjs
Janpot Jul 28, 2025
6cf48a7
Fix negative patterns
Janpot Jul 28, 2025
26c1b16
fixes
Janpot Jul 29, 2025
337128a
Update exportsUtils.mjs
Janpot Jul 29, 2025
37a374a
remove MUI_EXPERIMENTAL_MJS
Janpot Jul 29, 2025
ff3cb8e
node 24
Janpot Jul 29, 2025
3addf18
Merge remote-tracking branch 'upstream/master' into wip-mjs
Janpot Jul 29, 2025
be42b3e
Update exportsUtils.mjs
Janpot Jul 29, 2025
ab4ab56
re-enable
Janpot Jul 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ default-job: &default-job
AWS_REGION_ARTIFACTS: eu-central-1
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
DANGER_DISABLE_TRANSPILATION: 'true'
MUI_EXPERIMENTAL_MJS: 1
working_directory: /tmp/material-ui
docker:
- image: cimg/node:20.17
Expand Down Expand Up @@ -239,14 +240,6 @@ jobs:
pnpm --filter @mui/material typescript:module-augmentation
pnpm --filter @mui/joy typescript:module-augmentation
pnpm --filter @mui/system typescript:module-augmentation
- run:
Copy link
Member Author

@Janpot Janpot Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting rid of this. It does exactly nothing as far as I can see. Have enquired about this before and never received any comment on this doing something useful.

name: Diff declaration files
command: |
git add -f packages/mui-material/build || echo '/material declarations do not exist'
git add -f packages/mui-lab/build || echo '/lab declarations do not exist'
git add -f packages/mui-utils/build || echo '/utils declarations do not exist'
pnpm -r build:stable && pnpm -r build:types
git --no-pager diff
- run:
name: Any defect declaration files?
command: node scripts/testBuiltTypes.mjs
Expand Down Expand Up @@ -595,7 +588,7 @@ jobs:

- run:
name: build @mui packages
command: pnpm lerna run --ignore @mui/icons-material --concurrency 6 --scope "@mui/*" build
command: pnpm release:build --scope "@mui/*" --ignore @mui/icons-material
- aws-cli/setup:
aws_access_key_id: $AWS_ACCESS_KEY_ID_ARTIFACTS
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY_ARTIFACTS
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
cache: 'pnpm' # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-dependencies
- run: pnpm install:codesandbox
- run: pnpm build:codesandbox
env:
MUI_EXPERIMENTAL_MJS: 1
- run: pnpm pkg-pr-new-release

# Tests dev-only scripts across all supported dev environments
Expand Down
Empty file.
1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[build.environment]
NODE_VERSION = "20"
PNPM_FLAGS = "--frozen-lockfile"
MUI_EXPERIMENTAL_MJS = "1"

[[plugins]]
package = "./packages/netlify-plugin-cache-docs"
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@
"prettier": "^3.6.2",
"pretty-quick": "^4.2.2",
"process": "^0.11.10",
"regexp.escape": "^2.0.1",
"resolve-pkg-maps": "^1.0.0",
"rimraf": "^6.0.1",
"serve": "^14.2.4",
"stylelint": "^16.22.0",
Expand All @@ -209,6 +211,15 @@
"engines": {
"pnpm": "10.13.1"
},
"pnpm": {
"packageExtensions": {
"@pigment-css/react": {
"peerDependencies": {
"@mui/types": "7"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing peer dependency in pigment

}
}
}
},
"resolutions": {
"@babel/core": "^7.28.0",
"@babel/plugin-transform-runtime": "^7.28.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const createTypeScriptProject = (
const {
name,
rootPath,
tsConfigPath: inputTsConfigPath = 'tsconfig.build.json',
tsConfigPath: inputTsConfigPath = 'tsconfig.json',
entryPointPath: inputEntryPointPath,
files,
} = options;
Expand Down
1 change: 1 addition & 0 deletions packages-internal/docs-utils/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
"rootDir": "./src",
"outDir": "./build",
"declaration": true,
Expand Down
1 change: 1 addition & 0 deletions packages-internal/test-utils/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
"rootDir": "./src",
"outDir": "./build",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder/utils/createTypeScriptProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const createTypeScriptProject = (
const {
name,
rootPath,
tsConfigPath: inputTsConfigPath = 'tsconfig.build.json',
tsConfigPath: inputTsConfigPath = 'tsconfig.json',
entryPointPath: inputEntryPointPath,
files,
} = options;
Expand Down
6 changes: 3 additions & 3 deletions packages/mui-docs/src/Ad/ad.styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { alpha, Theme } from '@mui/material/styles';
import { alpha, CSSProperties, Theme } from '@mui/material/styles';

export const adBodyImageStyles = (theme: Theme) => ({
export const adBodyImageStyles = (theme: Theme): Record<string, CSSProperties> => ({
root: {
display: 'block',
overflow: 'hidden',
Expand Down Expand Up @@ -45,7 +45,7 @@ export const adBodyImageStyles = (theme: Theme) => ({
},
});

export const adBodyInlineStyles = (theme: Theme) => {
export const adBodyInlineStyles = (theme: Theme): Record<string, CSSProperties> => {
const baseline = adBodyImageStyles(theme);

return {
Expand Down
9 changes: 2 additions & 7 deletions packages/mui-docs/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
Expand All @@ -12,10 +12,5 @@
"tsBuildInfoFile": "build/tsconfig.build.tsbuildinfo"
},
"include": ["./types.d.ts", "src/**/*.ts*", "src/**/*.json"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"],
"references": [
{ "path": "../mui-material/tsconfig.build.json" },
{ "path": "../mui-system/tsconfig.build.json" },
{ "path": "../mui-icons-material/tsconfig.build.json" }
]
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
}
2 changes: 1 addition & 1 deletion packages/mui-icons-material/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {},
"declaration": false,
"noEmit": false,
"emitDeclarationOnly": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-joy/src/styles/variantColorInheritance.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { ColorPaletteProp, VariantProp } from '@mui/joy/styles/types';
import { ColorPaletteProp, VariantProp } from './types';

const VariantColorContext = React.createContext<string | undefined>(undefined);

Expand Down
5 changes: 2 additions & 3 deletions packages/mui-joy/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "build/esm",
"rootDir": "./src"
},
"include": ["./src/**/*.ts*"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"],
"references": [{ "path": "../mui-system/tsconfig.build.json" }]
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
}
7 changes: 2 additions & 5 deletions packages/mui-lab/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {},
"noEmit": false,
"declaration": true,
"rootDir": "./src",
"outDir": "build/esm",
"emitDeclarationOnly": true
},
"include": ["src/**/*.ts*"],
"exclude": ["src/**/*.d.ts", "src/**/*.test.*", "./**/*.spec.*"],
"references": [
{ "path": "../mui-material/tsconfig.build.json" },
{ "path": "../mui-system/tsconfig.build.json" }
]
"exclude": ["src/**/*.d.ts", "src/**/*.test.*", "./**/*.spec.*"]
}
2 changes: 1 addition & 1 deletion packages/mui-material-nextjs/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does removing this do ?

Copy link
Member Author

@Janpot Janpot Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes it a standalone project, without project references. We're not building with tsc --buid so project references don't do much for us. We're running our own builds in order. We can't use tsc --build because that doesn't support being run in parallel on projects that share project references. The only way we could potentially use it is to generate all type declarations at once with a single tsc command for the whole repo. Or with parallellism set to 1 for the build. At which point we may as well just build in topological order, which we already do. In essence we don't need project references because with lerna we're already doing what project references do, without all the limitations they set.

"paths": {},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material-pigment-css/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export {};
* Enhance the theme types to include new properties from the CssVarsProvider.
* The theme is typed with CSS variables in `styled`, `sx`, `useTheme`, etc.
*/

declare module '@mui/material/styles' {
interface CssThemeVariables {
enabled: true;
Expand Down
11 changes: 8 additions & 3 deletions packages/mui-material/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {
// reset paths, but keep the one for @mui/material. Necessary to be able to build
// packages/mui-material/src/types/OverridableComponentAugmentation.ts
// packages/mui-material/src/themeCssVarsAugmentation/index.ts
// as the types to be overriden are otherwise not found
"@mui/material/*": ["./src/*"]
},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "build/esm",
"rootDir": "./src"
},
"include": ["./src/**/*.ts*"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"],
"references": [{ "path": "../mui-system/tsconfig.build.json" }]
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
}
2 changes: 1 addition & 1 deletion packages/mui-stylis-plugin-rtl/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
Expand Down
5 changes: 2 additions & 3 deletions packages/mui-system/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "build/esm",
"rootDir": "./src"
},
"include": ["src/**/*.ts*"],
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"],
"references": [{ "path": "../mui-utils/tsconfig.build.json" }]
"exclude": ["src/**/*.spec.ts*", "src/**/*.test.ts*"]
}
7 changes: 6 additions & 1 deletion packages/mui-types/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {
// reset paths, but keep the one for @mui/types. Necessary to be able to build
// packages/mui-types/src/OverridableComponentAugmentation.ts
// as the types to be overriden are otherwise not found
"@mui/types": ["./src"]
},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:stable": "node ../../scripts/build.mjs stable --verbose",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"build:types": "tsx ../../scripts/buildTypes.mts",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
Expand Down
5 changes: 2 additions & 3 deletions packages/mui-utils/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Actual .ts source files are transpiled via babel
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {},
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
Expand All @@ -12,6 +12,5 @@
"types": ["react", "node"]
},
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts*", "src/**/*.spec.ts*"],
"references": [{ "path": "../mui-types/tsconfig.build.json" }]
"exclude": ["src/**/*.test.ts*", "src/**/*.spec.ts*"]
}
Loading
Loading