MCPcopy Create free account
hub / github.com/adobe/react-spectrum / rewriteMdx

Function rewriteMdx

scripts/migrateDeps.mjs:719–738  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

717}
718
719function rewriteMdx(file) {
720 let contents = fs.readFileSync(file, 'utf8');
721 contents = contents
722 .replace(
723 /\/packages\/@(react-aria|react-spectrum|react-stately)\/(.+?)\/docs\/(.+\.svg)/g,
724 (_, scope, pkg, file) => {
725 let monopackage = scope === 'react-spectrum' ? '@adobe/react-spectrum' : scope;
726 return `/packages/${monopackage}/docs/${pkg}/${file}`;
727 }
728 )
729 .replace(
730 /(['"])@(react-aria|react-spectrum|react-stately)\/(.+?)\/docs\/(.+\.svg)/g,
731 (_, q, scope, pkg, file) => {
732 let monopackage = scope === 'react-spectrum' ? '@adobe/react-spectrum' : scope;
733 return `${q}/packages/${monopackage}/docs/${pkg}/${file}`;
734 }
735 );
736
737 fs.writeFileSync(file, contents);
738}
739
740function getImportStatements(node, file, relative = true) {
741 let source = node.source.value;

Callers 2

migrateDeps.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected