Skip to content

Commit

Permalink
Remove 'use client' from useAutocomplete reexport
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoAndai committed Apr 18, 2024
1 parent ca753db commit 6486ba7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
'use client';
export { useAutocomplete as default } from '@mui/base/useAutocomplete';
export * from '@mui/base/useAutocomplete';
11 changes: 9 additions & 2 deletions packages/rsc-builder/buildRsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Project = {
rootPath: string;
additionalPaths?: string[];
additionalFiles?: string[];
filesToSkip?: string[]; // relative to the src directory
};

const PROJECTS: Project[] = [
Expand All @@ -21,6 +22,7 @@ const PROJECTS: Project[] = [
{
name: 'material',
rootPath: path.join(process.cwd(), 'packages/mui-material'),
filesToSkip: ['useAutocomplete/useAutocomplete.js'],
},
{
name: 'joy',
Expand Down Expand Up @@ -75,12 +77,16 @@ async function processFile(

async function findAll(
directories: string[],
filesToSkip: string[],
grep: RegExp | null,
findFn: typeof findComponents | typeof findHooks,
) {
const result = await Promise.all(
directories.map((dir) => {
return findFn(dir).filter((item) => {
if (filesToSkip.includes(item.filename)) {
return false;
}
if (grep === null) {
return true;
}
Expand All @@ -99,6 +105,7 @@ async function run(argv: yargs.ArgumentsCamelCase<CommandOptions>) {
await resolvedPromise;

const projectSrc = path.join(project.rootPath, 'src');
const filesToSkip = (project.filesToSkip || []).map((file) => path.join(projectSrc, file));

let directories = [projectSrc];

Expand All @@ -109,7 +116,7 @@ async function run(argv: yargs.ArgumentsCamelCase<CommandOptions>) {
];
}

const components = await findAll(directories, grep, findComponents);
const components = await findAll(directories, filesToSkip, grep, findComponents);

components.forEach(async (component) => {
try {
Expand All @@ -120,7 +127,7 @@ async function run(argv: yargs.ArgumentsCamelCase<CommandOptions>) {
}
});

const hooks = await findAll(directories, grep, findHooks);
const hooks = await findAll(directories, filesToSkip, grep, findHooks);

hooks.forEach(async (hook) => {
try {
Expand Down

0 comments on commit 6486ba7

Please sign in to comment.