Skip to content

Commit

Permalink
remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
danilo-leal committed May 3, 2024
1 parent 52ce12c commit 527c9cd
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions docs/src/modules/components/DemoToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,31 +261,6 @@ function useToolbar(controlRefs, options = {}) {
};
}

function copyWithRelativeModules(raw, relativeModules) {
if (relativeModules) {
relativeModules.forEach(({ module, raw: content }) => {
// remove exports from relative module
content = content.replace(/export( )*(default)*( )*\w+;|export default|export/gm, '');
// replace import statement with relative module content
// the module might be imported with or without extension, so we need to cover all cases
// E.g.: /import .* from '(.\/top100Films.js|.\/top100Films)';/
const extensions = ['', '.js', '.jsx', '.ts', '.tsx', '.css', '.json'];
const patterns = extensions
.map((ext) => {
if (module.endsWith(ext)) {
return module.replace(ext, '');
}
return '';
})
.filter(Boolean)
.join('|');
const importPattern = new RegExp(`import .* from '(${patterns})';`);
raw = raw.replace(importPattern, content);
});
}
return copy(raw);
}

export default function DemoToolbar(props) {
const {
codeOpen,
Expand Down

0 comments on commit 527c9cd

Please sign in to comment.