Skip to content

Commit

Permalink
Revert "feat: add wildcard imports as exports (#4976)"
Browse files Browse the repository at this point in the history
This reverts commit f448b1b.
  • Loading branch information
siddharthkp authored Sep 26, 2024
1 parent 21c3fce commit 3efe841
Show file tree
Hide file tree
Showing 24 changed files with 22 additions and 80 deletions.
5 changes: 0 additions & 5 deletions .changeset/lucky-oranges-camp.md

This file was deleted.

9 changes: 1 addition & 8 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
"import": "./lib-esm/next/index.js",
"require": "./lib/next/index.js"
},
"./test-helpers": {
"import": "./lib-esm/test-helpers.js",
"require": "./lib/test-helpers.js"
},
"./lib-esm/*": {
"import": [
"./lib-esm/*.js",
Expand All @@ -40,10 +36,7 @@
"typings": "lib/index.d.ts",
"sideEffects": [
"lib-esm/**/*.css",
"lib/**/*.css",
"src/**/test-helpers.tsx",
"lib-esm/**/test-helpers.js",
"lib/**/test-helpers.js"
"lib/**/*.css"
],
"scripts": {
"build": "./script/build",
Expand Down
15 changes: 1 addition & 14 deletions packages/react/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ const input = new Set([
),
])

function getEntrypointsFromInput(input) {
return Object.fromEntries(
Array.from(input).map(value => {
const relativePath = path.relative('src', value)
return [path.join(path.dirname(relativePath), path.basename(relativePath, path.extname(relativePath))), value]
}),
)
}

const extensions = ['.js', '.jsx', '.ts', '.tsx']
const ESM_ONLY = new Set([
'@github/combobox-nav',
Expand All @@ -97,11 +88,7 @@ const postcssModulesOptions = {
}

const baseConfig = {
input: {
...getEntrypointsFromInput(input),
// "./test-helpers"
'test-helpers': 'src/utils/test-helpers.tsx',
},
input: Array.from(input),
plugins: [
babel({
extensions,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components'
import {AlertIcon, InfoIcon, StopIcon, CheckCircleIcon, XIcon} from '@primer/octicons-react'
import {Button, IconButton} from '../Button'
import {get} from '../constants'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'
import {useMergedRefs} from '../internal/hooks/useMergedRefs'
import {useFeatureFlag} from '../FeatureFlags'
import classes from './Banner.module.css'
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Button/ButtonBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {StyledButton} from './types'
import {getVariantStyles, getButtonStyles, getAlignContentSize} from './styles'
import {useRefObjectAsForwardedRef} from '../hooks/useRefObjectAsForwardedRef'
import {defaultSxProp} from '../utils/defaultSxProp'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'
import Spinner from '../Spinner'
import CounterLabel from '../CounterLabel'
import {useId} from '../hooks'
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/DataTable/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components'
import {get} from '../constants'
import {Button} from '../internal/components/ButtonReset'
import {LiveRegion, LiveRegionOutlet, Message} from '../internal/components/LiveRegion'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'
import {warning} from '../utils/warning'
import type {ResponsiveValue} from '../hooks/useResponsiveValue'
import {viewportRanges} from '../hooks/useResponsiveValue'
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/FeatureFlags/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export {FeatureFlags} from './FeatureFlags'
export type {FeatureFlagsProps} from './FeatureFlags'
export {useFeatureFlag} from './useFeatureFlag'
export {DefaultFeatureFlags} from './DefaultFeatureFlags'
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {useId} from '../hooks/useId'
import {useProvidedRefOrCreate} from '../hooks/useProvidedRefOrCreate'
import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate'
import useScrollFlash from '../hooks/useScrollFlash'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'
import type {SxProp} from '../sx'

const menuScrollMargins: ScrollIntoViewOptions = {startMargin: 0, endMargin: 8}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {useId} from '../hooks/useId'
import {useProvidedRefOrCreate} from '../hooks/useProvidedRefOrCreate'
import {useProvidedStateOrCreate} from '../hooks/useProvidedStateOrCreate'
import useScrollFlash from '../hooks/useScrollFlash'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'
import type {SxProp} from '../sx'

import {isValidElementType} from 'react-is'
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Spinner/Spinner.examples.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import type {Meta} from '@storybook/react'
import Spinner from './Spinner'
import {Box, Button} from '..'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'
import {AriaStatus} from '../live-region'

export default {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import styled from 'styled-components'
import sx, {type SxProp} from '../sx'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'
import type {HTMLDataAttributes} from '../internal/internal-types'
import Box from '../Box'
import {useId} from '../hooks'
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/Token/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export type {TokenSizeKeys} from './TokenBase'
export {default} from './Token'
export type {TokenProps} from './Token'
export {default as IssueLabelToken} from './IssueLabelToken'
export type {IssueLabelTokenProps} from './IssueLabelToken'
export {default as AvatarToken} from './AvatarToken'
2 changes: 0 additions & 2 deletions packages/react/src/VisuallyHidden/index.ts

This file was deleted.

14 changes: 0 additions & 14 deletions packages/react/src/__tests__/__snapshots__/exports.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ exports[`@primer/react should not update exports without a semver change 1`] = `
"AvatarToken",
"BaseStyles",
"type BaseStylesProps",
"type BetterCssProperties",
"type BetterSystemStyleObject",
"Box",
"type BoxProps",
"BranchName",
Expand Down Expand Up @@ -82,9 +80,7 @@ exports[`@primer/react should not update exports without a semver change 1`] = `
"IconButton",
"type IconButtonProps",
"IssueLabelToken",
"type IssueLabelTokenProps",
"Label",
"type LabelColorOptions",
"LabelGroup",
"type LabelGroupProps",
"type LabelProps",
Expand Down Expand Up @@ -202,29 +198,21 @@ exports[`@primer/react should not update exports without a semver change 1`] = `
"useFocusTrap",
"useFocusZone",
"useFormControlForwardedProps",
"useIsomorphicLayoutEffect",
"useOnEscapePress",
"useOnOutsideClick",
"useOpenAndCloseFocus",
"useOverlay",
"useProvidedRefOrCreate",
"useRefObjectAsForwardedRef",
"useResizeObserver",
"useResponsiveValue",
"useSafeTimeout",
"useTheme",
"VisuallyHidden",
"type VisuallyHiddenProps",
]
`;

exports[`@primer/react/deprecated should not update exports without a semver change 1`] = `
[
"ActionList",
"type ActionListGroupedListProps",
"type ActionListGroupProps",
"type ActionListItemInput",
"type ActionListItemProps",
"type ActionListProps",
"ActionMenu",
"type ActionMenuProps",
Expand All @@ -247,7 +235,6 @@ exports[`@primer/react/deprecated should not update exports without a semver cha
"type DialogProps",
"FilteredSearch",
"type FilteredSearchProps",
"type ForwardRefComponent",
"Octicon",
"type OcticonProps",
"Pagehead",
Expand Down Expand Up @@ -284,7 +271,6 @@ exports[`@primer/react/experimental should not update exports without a semver c
"type DataTableProps",
"default",
"default",
"DefaultFeatureFlags",
"Dialog",
"type DialogButtonProps",
"type DialogHeaderProps",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/deprecated/ActionList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {List} from './List'
import {Group} from './Group'
import {Item} from './Item'
import {Divider} from './Divider'
export type {ListProps as ActionListProps, GroupedListProps, ItemInput} from './List'
export type {ListProps as ActionListProps} from './List'
export type {GroupProps} from './Group'
export type {ItemProps} from './Item'

Expand Down
9 changes: 1 addition & 8 deletions packages/react/src/deprecated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
// Deprecated in v35.0.0 on March 9, 2022
// TODO: We can remove these 6 months after release: September 10, 2022
export {ActionList} from './ActionList'
export type {
ActionListProps,
ItemProps as ActionListItemProps,
GroupProps as ActionListGroupProps,
GroupedListProps as ActionListGroupedListProps,
ItemInput as ActionListItemInput,
} from './ActionList'
export type {ActionListProps} from './ActionList'
export {ActionMenu} from './ActionMenu'
export type {ActionMenuProps} from './ActionMenu'
// (copied over from src/index) not exporting new DropdownMenu types yet due to conflict with Dropdown types above
Expand Down Expand Up @@ -59,5 +53,4 @@ export {default as TabNav} from '../TabNav'
export type {TabNavProps, TabNavLinkProps} from '../TabNav'
export {default as Tooltip} from '../Tooltip/Tooltip'
export type {TooltipProps} from '../Tooltip/Tooltip'
export type {ForwardRefComponent} from '../utils/polymorphic'
// end of v37.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {ComponentProps} from '../../utils/types'
import {SkeletonText} from './SkeletonText'
import {Avatar, Box, Button, IconButton, Text} from '../../'
import {SkeletonAvatar} from './SkeletonAvatar'
import {VisuallyHidden} from '../../VisuallyHidden'
import {VisuallyHidden} from '../../internal/components/VisuallyHidden'
import {KebabHorizontalIcon} from '@primer/octicons-react'

export default {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/experimental/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export {UnderlinePanels} from './UnderlinePanels'
export type {UnderlinePanelsProps, UnderlinePanelsTabProps, UnderlinePanelsPanelProps} from './UnderlinePanels'

export {SkeletonBox, SkeletonText, SkeletonAvatar} from './Skeleton'
export {FeatureFlags, DefaultFeatureFlags} from '../FeatureFlags'
export {FeatureFlags} from '../FeatureFlags'
export type {FeatureFlagsProps} from '../FeatureFlags'

export {FilteredActionList} from '../FilteredActionList'
Expand Down
11 changes: 3 additions & 8 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export type {FocusZoneHookSettings} from './hooks/useFocusZone'
export {useRefObjectAsForwardedRef} from './hooks/useRefObjectAsForwardedRef'
export {useResizeObserver} from './hooks/useResizeObserver'
export {useResponsiveValue} from './hooks/useResponsiveValue'
export {default as useIsomorphicLayoutEffect} from './utils/useIsomorphicLayoutEffect'
export {useProvidedRefOrCreate} from './hooks/useProvidedRefOrCreate'

// Utils
export {createComponent} from './utils/create-component'
Expand Down Expand Up @@ -106,7 +104,7 @@ export type {HeaderProps, HeaderItemProps, HeaderLinkProps} from './Header'
export {default as Heading} from './Heading'
export type {HeadingProps} from './Heading'
export {default as Label} from './Label'
export type {LabelProps, LabelColorOptions} from './Label'
export type {LabelProps} from './Label'
export {default as LabelGroup} from './LabelGroup'
export type {LabelGroupProps} from './LabelGroup'
export {default as Link} from './Link'
Expand Down Expand Up @@ -171,7 +169,7 @@ export type {
TimelineItemsProps,
} from './Timeline'
export {default as Token, IssueLabelToken, AvatarToken} from './Token'
export type {TokenProps, IssueLabelTokenProps} from './Token'
export type {TokenProps} from './Token'
export {default as Tooltip} from './Tooltip/Tooltip'
export type {TooltipProps} from './Tooltip/Tooltip'
export {default as Truncate} from './Truncate'
Expand All @@ -192,9 +190,6 @@ export type {
TreeViewErrorDialogProps,
} from './TreeView'

export {VisuallyHidden} from './VisuallyHidden'
export type {VisuallyHiddenProps} from './VisuallyHidden'

export {UnderlineNav} from './UnderlineNav'
export type {UnderlineNavProps, UnderlineNavItemProps} from './UnderlineNav'

Expand All @@ -208,4 +203,4 @@ export {PageHeader} from './PageHeader'
export type {PageHeaderProps} from './PageHeader'

export {default as sx, merge} from './sx'
export type {BetterCssProperties, BetterSystemStyleObject, SxProp} from './sx'
export type {SxProp} from './sx'
2 changes: 1 addition & 1 deletion packages/react/src/internal/components/LiveRegion.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {VisuallyHidden} from '../../VisuallyHidden'
import {VisuallyHidden} from './VisuallyHidden'

type LiveRegionContext = {
announce: (message: string) => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from 'styled-components'
import type {SxProp} from '../sx'
import sx from '../sx'
import type {SxProp} from '../../sx'
import sx from '../../sx'

/**
* Provides a component that implements the "visually hidden" technique. This is
Expand All @@ -24,5 +24,3 @@ export const VisuallyHidden = styled.span<SxProp>`
${sx}
`

export type VisuallyHiddenProps = React.ComponentPropsWithoutRef<typeof VisuallyHidden>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {StoryObj} from '@storybook/react'
import React, {useEffect, useState} from 'react'
import {Announce} from './Announce'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'

export default {
title: 'Experimental/Components/Announce/Features',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {StoryObj} from '@storybook/react'
import React from 'react'
import {AriaAlert} from './AriaAlert'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'

export default {
title: 'Experimental/Components/AriaAlert/Features',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {StoryObj} from '@storybook/react'
import React, {useEffect, useState} from 'react'
import {AriaStatus} from './AriaStatus'
import {VisuallyHidden} from '../VisuallyHidden'
import {VisuallyHidden} from '../internal/components/VisuallyHidden'

export default {
title: 'Experimental/Components/AriaStatus/Features',
Expand Down

0 comments on commit 3efe841

Please sign in to comment.