Skip to content

Apply exclude filter to imported paths#32

Open
Amxx wants to merge 2 commits into
OpenZeppelin:masterfrom
Amxx:feature/exclude-imports
Open

Apply exclude filter to imported paths#32
Amxx wants to merge 2 commits into
OpenZeppelin:masterfrom
Amxx:feature/exclude-imports

Conversation

@Amxx
Copy link
Copy Markdown
Collaborator

@Amxx Amxx commented Mar 19, 2024

No description provided.

@Amxx Amxx marked this pull request as draft March 19, 2024 12:15
Comment thread src/plugin.ts Outdated
const { isMatch } = await import('micromatch');
const { getExposed } = await import('./core');

const inputFiles = Object.fromEntries(compilationJob.getResolvedFiles().map(rf => [rf.sourceName, rf.absolutePath]));
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this was unused

@Amxx Amxx marked this pull request as ready for review March 19, 2024 12:24
@Amxx Amxx requested a review from frangio March 19, 2024 19:20
Comment thread src/plugin.ts

const include = await getMatcher(hre.config);
const exposed = getExposed(output, include, hre.config);
const include = (sourceName: string) => sourceName.startsWith(sourcesDir) && hre.config.exposed.include.some(p => isMatch(path.relative(sourcesDir, sourceName), p));
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if the sourceName.startsWith(sourcesDir) is really necessary. The hre.config.exposed.includeis likelly to only allow these path anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
const include = (sourceName: string) => sourceName.startsWith(sourcesDir) && hre.config.exposed.include.some(p => isMatch(path.relative(sourcesDir, sourceName), p));
const include = (sourceName: string) => hre.config.exposed.include.some(p => isMatch(path.relative(sourcesDir, sourceName), p));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant