From 1fed09d0689e5ee312d0935d56d4f1a6c4399305 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Tue, 19 Sep 2023 14:51:28 +0800 Subject: [PATCH 1/4] Update script --- packages/rsc-builder/buildRsc.ts | 32 -------------------------------- 1 file changed, 32 deletions(-) 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; From c3d6e338e660b41aed8659d8a22f51991bef48d9 Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Tue, 19 Sep 2023 14:52:10 +0800 Subject: [PATCH 2/4] Fix getInitColorSchemeScript --- packages/mui-system/src/cssVars/createCssVarsProvider.js | 1 + packages/mui-system/src/cssVars/index.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) 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/index.ts b/packages/mui-system/src/cssVars/index.ts index c8a640a0a241bd..bbc39f8cae1d67 100644 --- a/packages/mui-system/src/cssVars/index.ts +++ b/packages/mui-system/src/cssVars/index.ts @@ -1,4 +1,3 @@ -'use client'; export { default } from './createCssVarsProvider'; export type { CreateCssVarsProviderResult, From 86b23d08cbbf1ed389f62caebcebcd70fa3836ff Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Tue, 19 Sep 2023 15:46:24 +0800 Subject: [PATCH 3/4] Add another use client --- packages/mui-system/src/cssVars/getInitColorSchemeScript.tsx | 1 + 1 file changed, 1 insertion(+) 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'; From a3edefcbd0dc985f0a2c1639df783530590f462b Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Tue, 19 Sep 2023 15:59:41 +0800 Subject: [PATCH 4/4] Add back use client to cssVars/index --- packages/mui-system/src/cssVars/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mui-system/src/cssVars/index.ts b/packages/mui-system/src/cssVars/index.ts index bbc39f8cae1d67..c8a640a0a241bd 100644 --- a/packages/mui-system/src/cssVars/index.ts +++ b/packages/mui-system/src/cssVars/index.ts @@ -1,3 +1,4 @@ +'use client'; export { default } from './createCssVarsProvider'; export type { CreateCssVarsProviderResult,