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

[system] Fix getInitColorSchemeScript RSC error #39054

Closed
Closed
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
1 change: 1 addition & 0 deletions packages/mui-system/src/cssVars/createCssVarsProvider.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
import * as React from 'react';
import PropTypes from 'prop-types';
import MuiError from '@mui/utils/macros/MuiError.macro';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
import * as React from 'react';

export const DEFAULT_MODE_STORAGE_KEY = 'mode';
Expand Down
32 changes: 0 additions & 32 deletions packages/rsc-builder/buildRsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -124,24 +109,11 @@ async function run(argv: yargs.ArgumentsCamelCase<CommandOptions>) {
];
}

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;
Expand All @@ -153,10 +125,6 @@ async function run(argv: yargs.ArgumentsCamelCase<CommandOptions>) {
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;
Expand Down