Skip to content

Commit

Permalink
update remark-npm2yarn, import Tab as Tabs.Tab (#1234)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yassin Eldeeb <yassineldeeb94@gmail.com>
Co-authored-by: yangxingyuan <39261479+sanyuan0704@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Aleksandra <alexsandra.sikora@gmail.com>
  • Loading branch information
7 people authored Oct 8, 2023
1 parent 083ebf6 commit 51afe0b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-bobcats-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@theguild/remark-npm2yarn': minor
---

import `Tab` as `Tabs.Tab`
7 changes: 1 addition & 6 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ export { default as Giscus } from '@giscus/react';
export { useMounted } from 'nextra/hooks';
export { useMDXComponents } from 'nextra/mdx';
export { RemoteContent, useSSG } from 'nextra/ssg';
export { Mermaid, Callout } from 'nextra/components';
export { Mermaid, Callout, Tabs, Cards, Steps, FileTree, Tab, Card } from 'nextra/components';
export {
type DocsThemeConfig,
Bleed,
Collapse,
Navbar,
NotFoundPage,
ServerSideErrorPage,
Tab,
useConfig,
useTheme,
Card,
Cards,
Steps,
FileTree,
} from 'nextra-theme-docs';

declare module 'react' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ function _createMdxContent(props) {
pre: \\"pre\\",
code: \\"code\\",
span: \\"span\\"
}, _provideComponents(), props.components), {$Tabs, $Tab} = _components;
if (!$Tab) _missingMdxReference(\\"$Tab\\", true);
}, _provideComponents(), props.components), {$Tabs} = _components;
if (!$Tabs) _missingMdxReference(\\"$Tabs\\", true);
if (!$Tabs.Tab) _missingMdxReference(\\"$Tabs.Tab\\", true);
return _jsxs($Tabs, {
items: [\\"npm\\", \\"pnpm\\", \\"yarn\\", \\"bun\\"],
storageKey: \\"testKey\\",
children: [_jsx($Tab, {
children: [_jsx($Tabs.Tab, {
children: _jsx(_components.pre, {
\\"data-language\\": \\"sh\\",
\\"data-theme\\": \\"default\\",
Expand Down Expand Up @@ -64,7 +64,7 @@ function _createMdxContent(props) {
})
})
})
}), _jsx($Tab, {
}), _jsx($Tabs.Tab, {
children: _jsx(_components.pre, {
\\"data-language\\": \\"sh\\",
\\"data-theme\\": \\"default\\",
Expand Down Expand Up @@ -113,7 +113,7 @@ function _createMdxContent(props) {
})
})
})
}), _jsx($Tab, {
}), _jsx($Tabs.Tab, {
children: _jsx(_components.pre, {
\\"data-language\\": \\"sh\\",
\\"data-theme\\": \\"default\\",
Expand Down Expand Up @@ -162,7 +162,7 @@ function _createMdxContent(props) {
})
})
})
}), _jsx($Tab, {
}), _jsx($Tabs.Tab, {
children: _jsx(_components.pre, {
\\"data-language\\": \\"sh\\",
\\"data-theme\\": \\"default\\",
Expand Down
8 changes: 1 addition & 7 deletions packages/remark-npm2yarn/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import {

// To avoid conflicts with other Tabs/Tab declarations
const TABS_NAME = '$Tabs';
const TAB_NAME = '$Tab';

function getTabAST(node: Code, packageManager: PackageManager, newMetadata: string) {
return {
type: 'mdxJsxFlowElement',
name: TAB_NAME,
name: `${TABS_NAME}.Tab`,
children: [
{
type: node.type,
Expand Down Expand Up @@ -51,11 +50,6 @@ export const remarkNpm2Yarn: Plugin<
imported: { type: 'Identifier', name: 'Tabs' },
local: { type: 'Identifier', name: TABS_NAME },
},
{
type: 'ImportSpecifier',
imported: { type: 'Identifier', name: 'Tab' },
local: { type: 'Identifier', name: TAB_NAME },
},
],
},
],
Expand Down

1 comment on commit 51afe0b

@vercel
Copy link

@vercel vercel bot commented on 51afe0b Oct 8, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.