diff --git a/packages/mui-system/src/cssVars/createCssVarsProvider.js b/packages/mui-system/src/cssVars/createCssVarsProvider.js index ddd9398f91ce53..cb0670ed1d8e28 100644 --- a/packages/mui-system/src/cssVars/createCssVarsProvider.js +++ b/packages/mui-system/src/cssVars/createCssVarsProvider.js @@ -1,3 +1,4 @@ +'use client'; import * as React from 'react'; import PropTypes from 'prop-types'; import MuiError from '@mui/utils/macros/MuiError.macro'; diff --git a/packages/mui-system/src/cssVars/getInitColorSchemeScript.tsx b/packages/mui-system/src/cssVars/getInitColorSchemeScript.tsx index d392ddbc8d053d..416092ade33968 100644 --- a/packages/mui-system/src/cssVars/getInitColorSchemeScript.tsx +++ b/packages/mui-system/src/cssVars/getInitColorSchemeScript.tsx @@ -1,3 +1,4 @@ +'use client'; import * as React from 'react'; export const DEFAULT_MODE_STORAGE_KEY = 'mode'; diff --git a/packages/rsc-builder/buildRsc.ts b/packages/rsc-builder/buildRsc.ts index 3a4616d63a967f..59705255ed8dcd 100644 --- a/packages/rsc-builder/buildRsc.ts +++ b/packages/rsc-builder/buildRsc.ts @@ -73,21 +73,6 @@ async function processFile( await fse.writeFile(filename, newContents); } -function getIndexFile(directory: string) { - const items = fse.readdirSync(directory); - - const indexFile = items.reduce((prev, curr) => { - if (!/^index.(js|ts)/.test(curr)) { - return prev; - } - return curr; - }, ''); - - return { - filename: path.join(directory, indexFile), - }; -} - async function findAll( directories: string[], grep: RegExp | null, @@ -124,24 +109,11 @@ async function run(argv: yargs.ArgumentsCamelCase) { ]; } - const indexFile = getIndexFile(projectSrc); - - try { - processFile(indexFile.filename); - } catch (error: any) { - error.message = `${path.relative(process.cwd(), indexFile.filename)}: ${error.message}`; - throw error; - } - const components = await findAll(directories, grep, findComponents); components.forEach(async (component) => { try { processFile(component.filename); - - if (component.indexFilename) { - processFile(component.indexFilename); - } } catch (error: any) { error.message = `${path.relative(process.cwd(), component.filename)}: ${error.message}`; throw error; @@ -153,10 +125,6 @@ async function run(argv: yargs.ArgumentsCamelCase) { hooks.forEach(async (hook) => { try { processFile(hook.filename); - - if (hook.indexFilename) { - processFile(hook.indexFilename); - } } catch (error: any) { error.message = `${path.relative(process.cwd(), hook.filename)}: ${error.message}`; throw error;