Skip to content
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

[code-infra] Update package layout for better ESM support #43264

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 90 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
0c2d530
WIP
Janpot Aug 11, 2024
f0cc38e
exclude icons
Janpot Aug 11, 2024
3955055
MUI_PACKAGE_EXPORTS
Janpot Aug 11, 2024
33c43c1
more
Janpot Aug 11, 2024
5888018
Update copyFilesUtils.mjs
Janpot Aug 11, 2024
642fdcd
remove deep export
Janpot Aug 12, 2024
868a81d
bring back flag
Janpot Aug 12, 2024
e03039f
Update ci.yml
Janpot Aug 12, 2024
f5bb040
WIP
Janpot Aug 12, 2024
da26652
Merge branch 'next' into esm-exports
Janpot Aug 23, 2024
4229626
Update build.mjs
Janpot Aug 23, 2024
c11b8e5
remove this
Janpot Aug 25, 2024
a98520b
fix snapshot
Janpot Aug 25, 2024
60e04ca
vite icons alias
Janpot Aug 25, 2024
6e2bbcc
remove 'use client' from index.* fles
Janpot Aug 25, 2024
9348956
Update package.json
Janpot Aug 25, 2024
860a36e
Update package.json
Janpot Aug 25, 2024
904f65b
Update package.json
Janpot Aug 25, 2024
0de01ee
Revert "remove 'use client' from index.* fles"
Janpot Aug 26, 2024
5172a89
bring changes to snashots
Janpot Aug 27, 2024
9eaa517
Update webpack.config.js
Janpot Aug 27, 2024
2011763
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Aug 27, 2024
4c44355
Update scripts/build.mjs
Janpot Aug 28, 2024
626135d
Reapply "remove 'use client' from index.* fles"
Janpot Aug 28, 2024
b4e9968
remove 'use client'
Janpot Aug 28, 2024
6bf0206
Update pnpm-lock.yaml
Janpot Aug 28, 2024
ba50924
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Aug 28, 2024
97f711a
fix tsc
Janpot Aug 28, 2024
f7b83b9
Update tsconfig.json
Janpot Aug 28, 2024
32afa8d
Merge branch 'master' into esm-exports
Janpot Aug 28, 2024
72beb0e
zis
Janpot Aug 28, 2024
bb746d1
update exports of icons
Janpot Aug 28, 2024
db13926
fix overrides of export field
Janpot Aug 28, 2024
ee3f56b
Merge branch 'master' into esm-exports
Janpot Aug 28, 2024
85e1af7
Update build.mjs
Janpot Aug 29, 2024
d881880
next document fix
Janpot Aug 30, 2024
66e9d33
ci
Janpot Aug 30, 2024
d4953d4
ci
Janpot Aug 30, 2024
c6212c5
Update pagesRouterV13Document.tsx
Janpot Aug 30, 2024
debe230
Update package.json
Janpot Aug 30, 2024
02749c1
Update package.json
Janpot Aug 30, 2024
c1061e7
Update package.json
Janpot Aug 30, 2024
ff6c473
remove mjs
Janpot Aug 31, 2024
096d907
remove unnecessary
Janpot Sep 2, 2024
6074ce9
extension
Janpot Sep 2, 2024
9aabf3b
Update copyFiles.mjs
Janpot Sep 2, 2024
3cccf14
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Sep 4, 2024
eedc2b9
Revert
Janpot Sep 4, 2024
029389f
jdsh
Janpot Sep 4, 2024
b43e03e
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Sep 23, 2024
a9bedd6
Update pnpm-lock.yaml
Janpot Sep 23, 2024
ea378ca
Update package.json
Janpot Sep 23, 2024
1d5d237
Update webpack.config.js
Janpot Sep 23, 2024
32a2605
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Oct 1, 2024
4f95710
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Jan 6, 2025
8a28484
Update pnpm-lock.yaml
Janpot Jan 6, 2025
8574570
pre icons
Janpot Jan 15, 2025
2543ef9
let's go icons
Janpot Jan 15, 2025
af54979
nextjs
Janpot Jan 15, 2025
0f7a8dd
dedupe
Janpot Jan 15, 2025
503c400
fix conflicting types
Janpot Jan 15, 2025
bf76b5c
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Jan 15, 2025
47e6cf5
Update pnpm-lock.yaml
Janpot Jan 15, 2025
3a70237
Update pnpm-lock.yaml
Janpot Jan 15, 2025
2422d84
Update LoadingButton.d.ts
Janpot Jan 15, 2025
fcaae07
fix docs
Janpot Jan 15, 2025
8ffb129
icons and ci
Janpot Jan 16, 2025
ad0a5e6
Delete package.json
Janpot Jan 16, 2025
0efeedc
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Jan 16, 2025
eddd2a4
Update config.yml
Janpot Jan 16, 2025
0139ba4
Update config.yml
Janpot Jan 16, 2025
ee6e93a
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Jan 16, 2025
712a00a
lerna is broken
Janpot Jan 16, 2025
a9d990a
frg
Janpot Jan 16, 2025
69f01b3
Update ci.yml
Janpot Jan 16, 2025
727bad6
Update tsconfig.json
Janpot Jan 16, 2025
91286e0
Update tsconfig.json
Janpot Jan 16, 2025
a6339cc
dewf
Janpot Jan 16, 2025
378e512
Update package.json
Janpot Jan 16, 2025
0df21b4
windows
Janpot Jan 16, 2025
1d213c8
sideEffects
Janpot Jan 17, 2025
61ef90f
remove --build
Janpot Jan 18, 2025
b1b4d86
Update pnpm-lock.yaml
Janpot Jan 18, 2025
7fb1dc5
Update buildTypes.mts
Janpot Jan 18, 2025
d127e32
Update tsconfig.build.json
Janpot Jan 18, 2025
7b2d481
Update buildTypes.mts
Janpot Jan 18, 2025
5a862c0
Update buildTypes.mts
Janpot Jan 19, 2025
0f32163
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Jan 23, 2025
3ed9f16
backwards compatibility mode
Janpot Jan 23, 2025
93d37f5
Merge branch 'master' into esm-exports
Janpot Jan 23, 2025
e7cc867
Merge remote-tracking branch 'upstream/master' into esm-exports
Janpot Jan 28, 2025
56c2982
do skipEsmPkg
Janpot Jan 28, 2025
7e54d18
Update ci.yml
Janpot Jan 28, 2025
877947a
stream logs to try get a clue where next gets stuck
Janpot Jan 29, 2025
9251e8f
disable sourcemaps
Janpot Jan 29, 2025
e997060
use esm for next config
Janpot Jan 29, 2025
6cdfa8c
bring these references back?
Janpot Jan 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ jobs:
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:types
pnpm -r build:stable && pnpm -r build:types
git --no-pager diff
- run:
name: Any defect declaration files?
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- run: pnpm install
- run: pnpm build:ci
env:
NODE_OPTIONS: --max_old_space_size=4096
NODE_OPTIONS: --max_old_space_size=8192
- run: pnpm release:changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
15 changes: 2 additions & 13 deletions apps/pigment-css-next-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"],
"references": [
{
"path": "../../packages/mui-system/tsconfig.build.json"
},
{
"path": "../../packages/mui-base/tsconfig.build.json"
},
{
"path": "../../packages/mui-material/tsconfig.build.json"
}
]
"include": ["next-env.d.ts", "./src/**/*.ts", "./src/**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
13 changes: 1 addition & 12 deletions apps/pigment-css-vite-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,5 @@
"compilerOptions": {
"jsx": "react-jsx",
"allowImportingTsExtensions": true
},
"references": [
{
"path": "../../packages/mui-system/tsconfig.build.json"
},
{
"path": "../../packages/mui-base/tsconfig.build.json"
},
{
"path": "../../packages/mui-material/tsconfig.build.json"
}
]
}
}
15 changes: 4 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,9 @@ module.exports = function getBabelConfig(api) {
'@babel/preset-typescript',
];

const usesAliases =
// in this config:
api.env(['coverage', 'development', 'test', 'benchmark']) ||
process.env.NODE_ENV === 'test' ||
// in webpack config:
api.env(['regressions']);

const outFileExtension = '.js';
// Essentially only replace in production builds.
// When aliasing we want to keep the original extension
const outFileExtension = process.env.MUI_OUT_FILE_EXTENSION || null;

/** @type {babel.PluginItem[]} */
const plugins = [
Expand Down Expand Up @@ -118,9 +113,7 @@ module.exports = function getBabelConfig(api) {
[
'@mui/internal-babel-plugin-resolve-imports',
{
// Don't replace the extension when we're using aliases.
// Essentially only replace in production builds.
outExtension: usesAliases ? null : outFileExtension,
outExtension: outFileExtension,
},
],
]
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"nx_test_karma": "cross-env NODE_ENV=test karma start test/karma.conf.js",
"nx_test_regressions_run": "mocha --config test/regressions/.mocharc.js --delay 'test/regressions/**/*.test.js'",
"nx_test_regressions_pigment_css_run": "mocha --config apps/pigment-css-vite-app/.mocharc.cjs --delay 'apps/pigment-css-vite-app/**/*.test.js'",
"clean": "pnpm -r exec rm -rf build",
"nx_test_unit": "cross-env NODE_ENV=test mocha \"packages/**/*.test.?(c|m)[jt]s?(x)\" \"packages-internal/**/*.test.?(c|m)[jt]s?(x)\" \"docs/**/*.test.?(c|m)[jt]s?(x)\""
},
"dependencies": {
Expand Down Expand Up @@ -175,11 +176,11 @@
"karma-mocha": "^2.0.1",
"karma-sourcemap-loader": "^0.4.0",
"karma-webpack": "^5.0.0",
"lerna": "^8.1.9",
"lerna": "^8.1.8",
"lodash": "^4.17.21",
"markdownlint-cli2": "^0.17.1",
"mocha": "^11.0.1",
"nx": "^20.3.1",
"nx": "^19.8.14",
DiegoAndai marked this conversation as resolved.
Show resolved Hide resolved
"nyc": "^17.1.0",
"piscina": "^4.8.0",
"postcss-styled-syntax": "^0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"build:types": "node ../../scripts/buildTypes.mjs",
"build:types": "tsx ../../scripts/buildTypes.mts",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
"release": "pnpm build && pnpm publish",
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-base/**/*.test.?(c|m)[jt]s?(x)'",
Expand Down
12 changes: 6 additions & 6 deletions packages/mui-base/src/Select/Select.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ describe('<Select />', () => {
);

const select = screen.getByRole('combobox');
act(() => {
await act(async () => {
DiegoAndai marked this conversation as resolved.
Show resolved Hide resolved
select.click();
});

Expand All @@ -1022,7 +1022,7 @@ describe('<Select />', () => {

const select = screen.getByRole('combobox');

act(() => {
await act(async () => {
select.click();
});

Expand All @@ -1041,7 +1041,7 @@ describe('<Select />', () => {
);

const select = screen.getByRole('combobox');
act(() => {
await act(async () => {
select.click();
});

Expand Down Expand Up @@ -1253,11 +1253,11 @@ describe('<Select />', () => {
const updateButton = getByTestId('update-externally');
const selectButton = getByTestId('select');

act(() => updateButton.click());
act(() => selectButton.click());
await act(async () => updateButton.click());
await act(async () => selectButton.click());

const option2 = getByText('2');
act(() => option2.click());
await act(async () => option2.click());

expect(selectButton).to.have.text('1, 2');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "build",
"outDir": "build/esm",
"rootDir": "./src"
},
"include": ["src/**/*.ts*"],
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"build:modern": "echo 'Skip modern build'",
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:types": "node ../../scripts/buildTypes.mjs",
"build:types": "tsx ../../scripts/buildTypes.mts",
"build:copy-files": "node ../../scripts/copyFiles.mjs ./src/translations/translations.json:./translations/translations.json ./src/translations/translations.json:./node/translations/translations.json",
"prebuild": "rimraf build",
"release": "pnpm build && pnpm publish",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-docs/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"declaration": true,
"noEmit": false,
"emitDeclarationOnly": true,
"outDir": "build",
"outDir": "build/esm",
"rootDir": "./src",
"tsBuildInfoFile": "build/tsconfig.build.tsbuildinfo"
},
Expand Down
1 change: 1 addition & 0 deletions packages/mui-icons-material/lib/esm/icon.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading