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] Avoid aliasing to the monorepo dependencies #3137

Merged
merged 7 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 0 additions & 16 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,12 @@ const { version: transformRuntimeVersion } = fse.readJSONSync(
require.resolve('@babel/runtime-corejs2/package.json'),
);

const errorCodesPath = require.resolve('@mui/monorepo/docs/public/static/error-codes.json');
const missingError = process.env.MUI_EXTRACT_ERROR_CODES === 'true' ? 'write' : 'annotate';

const muiErrorMacro = require.resolve('@mui/monorepo/packages/mui-babel-macros/MuiError.macro');

module.exports = {
presets: [
// backport of https://github.com/zeit/next.js/pull/9511
['next/babel', { 'transform-runtime': { corejs: 2, version: transformRuntimeVersion } }],
],
plugins: [
[
'babel-plugin-macros',
{
muiError: {
errorCodesPath,
missingError,
},
// TODO: Figure out dependency resolution for macros so this hack isn't needed.
resolvePath: () => muiErrorMacro,
},
],
'babel-plugin-optimize-clsx',
// for IE 11 support
'@babel/plugin-transform-object-assign',
Expand Down
21 changes: 5 additions & 16 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,8 @@ const { findPages } = require('./src/modules/utils/find');

const MONOREPO_PATH = path.resolve(currentDirectory, '../node_modules/@mui/monorepo');
const MONOREPO_PACKAGES = {
'@mui/base': path.resolve(MONOREPO_PATH, './packages/mui-base/src'),
'@mui/codemod': path.resolve(MONOREPO_PATH, './packages/mui-codemod/src'),
'@mui/docs': path.resolve(MONOREPO_PATH, './packages/mui-docs/src'),
'@mui/envinfo': path.resolve(MONOREPO_PATH, './packages/mui-envinfo'),
'@mui/icons-material': path.resolve(MONOREPO_PATH, './packages/mui-icons-material/lib'),
'@mui/joy': path.resolve(MONOREPO_PATH, './packages/mui-joy/src'),
'@mui/lab': path.resolve(MONOREPO_PATH, './packages/mui-lab/src'),
'@mui/material': path.resolve(MONOREPO_PATH, './packages/mui-material/src'),
'@mui/material-next': path.resolve(MONOREPO_PATH, './packages/mui-material-next/src'),
'@mui/material-nextjs': path.resolve(MONOREPO_PATH, './packages/mui-material-nextjs/src'),
'@mui/private-theming': path.resolve(MONOREPO_PATH, './packages/mui-private-theming/src'),
'@mui/styled-engine': path.resolve(MONOREPO_PATH, './packages/mui-styled-engine/src'),
'@mui/styled-engine-sc': path.resolve(MONOREPO_PATH, './packages/mui-styled-engine-sc/src'),
'@mui/styles': path.resolve(MONOREPO_PATH, './packages/mui-styles'),
'@mui/system': path.resolve(MONOREPO_PATH, './packages/mui-system/src'),
'@mui/types': path.resolve(MONOREPO_PATH, './packages/mui-types'),
'@mui/markdown': path.resolve(MONOREPO_PATH, './packages/markdown'),
'@mui/utils': path.resolve(MONOREPO_PATH, './packages/mui-utils/src'),
};

export default withDocsInfra({
Expand Down Expand Up @@ -88,6 +72,11 @@ export default withDocsInfra({
},
],
},
{
test: /\.+(js|jsx|mjs|ts|tsx)$/,
include: [/(@mui[\\/]monorepo)$/, /(@mui[\\/]monorepo)[\\/](?!.*node_modules)/],
use: options.defaultLoaders.babel,
},
]),
},
};
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@emotion/server": "11.11.0",
"@emotion/styled": "11.11.0",
"@mui/icons-material": "5.15.7",
"@mui/joy": "5.0.0-beta.24",
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed for any of the changes in this PR? Or was it missing before?

Copy link
Member Author

Choose a reason for hiding this comment

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

It seemed to be missing before

"@mui/lab": "5.0.0-alpha.163",
"@mui/material": "5.15.7",
"@mui/material-nextjs": "^5.15.7",
Expand Down Expand Up @@ -93,7 +94,6 @@
"@types/doctrine": "0.0.9",
"@types/json-schema": "7.0.15",
"@types/react-is": "18.2.4",
"babel-plugin-macros": "3.1.0",
"cpy-cli": "5.0.0",
"cross-fetch": "4.0.0",
"gm": "1.25.0",
Expand Down
Loading
Loading