web: revise css-import-maps to need only a single entry, rather than dual-entry

Given that the difference Vite/Storybook cares about is whether or not there's a
sigil at the end of the CSS string, it seemed silly to require devs to enter
both the raw and sigiled string; just do an in-line text-and-replace.
This commit is contained in:
Ken Sternberg 2023-12-27 11:25:47 -08:00
parent f30bdaad1e
commit 6fb543b94f

View file

@ -7,123 +7,71 @@
// Sometime around 2030 or so, the Javascript community may finally get its collective act together // Sometime around 2030 or so, the Javascript community may finally get its collective act together
// and we'll have one unified way of doing this. I can only hope. // and we'll have one unified way of doing this. I can only hope.
export const cssImportMaps = { const cssImportMapSources = [
'import AKGlobal from "@goauthentik/common/styles/authentik.css";': 'import AKGlobal from "@goauthentik/common/styles/authentik.css";',
'import AKGlobal from "@goauthentik/common/styles/authentik.css?inline";', 'import PFAlert from "@patternfly/patternfly/components/Alert/alert.css";',
'import PFAlert from "@patternfly/patternfly/components/Alert/alert.css";': 'import PFAlertGroup from "@patternfly/patternfly/components/AlertGroup/alert-group.css";',
'import PFAlert from "@patternfly/patternfly/components/Alert/alert.css?inline";', 'import PFAvatar from "@patternfly/patternfly/components/Avatar/avatar.css";',
'import PFAlertGroup from "@patternfly/patternfly/components/AlertGroup/alert-group.css";': 'import PFBackdrop from "@patternfly/patternfly/components/Backdrop/backdrop.css";',
'import PFAlertGroup from "@patternfly/patternfly/components/AlertGroup/alert-group.css?inline";', 'import PFBackgroundImage from "@patternfly/patternfly/components/BackgroundImage/background-image.css";',
'import PFAvatar from "@patternfly/patternfly/components/Avatar/avatar.css";': 'import PFBanner from "@patternfly/patternfly/components/Banner/banner.css";',
'import PFAvatar from "@patternfly/patternfly/components/Avatar/avatar.css?inline";', 'import PFBase from "@patternfly/patternfly/patternfly-base.css";',
'import PFBackdrop from "@patternfly/patternfly/components/Backdrop/backdrop.css";': 'import PFBrand from "@patternfly/patternfly/components/Brand/brand.css";',
'import PFBackdrop from "@patternfly/patternfly/components/Backdrop/backdrop.css?inline";', 'import PFBullseye from "@patternfly/patternfly/layouts/Bullseye/bullseye.css";',
'import PFBackgroundImage from "@patternfly/patternfly/components/BackgroundImage/background-image.css";': 'import PFButton from "@patternfly/patternfly/components/Button/button.css";',
'import PFBackgroundImage from "@patternfly/patternfly/components/BackgroundImage/background-image.css?inline";', 'import PFCard from "@patternfly/patternfly/components/Card/card.css";',
'import PFBanner from "@patternfly/patternfly/components/Banner/banner.css";': 'import PFCheck from "@patternfly/patternfly/components/Check/check.css";',
'import PFBanner from "@patternfly/patternfly/components/Banner/banner.css?inline";', 'import PFChip from "@patternfly/patternfly/components/Chip/chip.css";',
'import PFBase from "@patternfly/patternfly/patternfly-base.css";': 'import PFChipGroup from "@patternfly/patternfly/components/ChipGroup/chip-group.css";',
'import PFBase from "@patternfly/patternfly/patternfly-base.css?inline";', 'import PFContent from "@patternfly/patternfly/components/Content/content.css";',
'import PFBrand from "@patternfly/patternfly/components/Brand/brand.css";': 'import PFDataList from "@patternfly/patternfly/components/DataList/data-list.css";',
'import PFBrand from "@patternfly/patternfly/components/Brand/brand.css?inline";', 'import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css";',
'import PFBullseye from "@patternfly/patternfly/layouts/Bullseye/bullseye.css";': 'import PFDisplay from "@patternfly/patternfly/utilities/Display/display.css";',
'import PFBullseye from "@patternfly/patternfly/layouts/Bullseye/bullseye.css?inline";', 'import PFDrawer from "@patternfly/patternfly/components/Drawer/drawer.css";',
'import PFButton from "@patternfly/patternfly/components/Button/button.css";': 'import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css";',
'import PFButton from "@patternfly/patternfly/components/Button/button.css?inline";', 'import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css";',
'import PFCard from "@patternfly/patternfly/components/Card/card.css";': 'import PFDualListSelector from "@patternfly/patternfly/components/DualListSelector/dual-list-selector.css";',
'import PFCard from "@patternfly/patternfly/components/Card/card.css?inline";', 'import PFEmptyState from "@patternfly/patternfly/components/EmptyState/empty-state.css";',
'import PFCheck from "@patternfly/patternfly/components/Check/check.css";': 'import PFExpandableSection from "@patternfly/patternfly/components/ExpandableSection/expandable-section.css";',
'import PFCheck from "@patternfly/patternfly/components/Check/check.css?inline";', 'import PFFAIcons from "@patternfly/patternfly/base/patternfly-fa-icons.css";',
'import PFChip from "@patternfly/patternfly/components/Chip/chip.css";': 'import PFFlex from "@patternfly/patternfly/layouts/Flex/flex.css";',
'import PFChip from "@patternfly/patternfly/components/Chip/chip.css?inline";', 'import PFForm from "@patternfly/patternfly/components/Form/form.css";',
'import PFChipGroup from "@patternfly/patternfly/components/ChipGroup/chip-group.css";': 'import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css";',
'import PFChipGroup from "@patternfly/patternfly/components/ChipGroup/chip-group.css?inline";', 'import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css";',
'import PFContent from "@patternfly/patternfly/components/Content/content.css";': 'import PFGlobal from "@patternfly/patternfly/patternfly-base.css";',
'import PFContent from "@patternfly/patternfly/components/Content/content.css?inline";', 'import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css";',
'import PFDataList from "@patternfly/patternfly/components/DataList/data-list.css";': 'import PFHint from "@patternfly/patternfly/components/Hint/hint.css";',
'import PFDataList from "@patternfly/patternfly/components/DataList/data-list.css?inline";', 'import PFInputGroup from "@patternfly/patternfly/components/InputGroup/input-group.css";',
'import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css";': 'import PFLabel from "@patternfly/patternfly/components/Label/label.css";',
'import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css?inline";', 'import PFList from "@patternfly/patternfly/components/List/list.css";',
'import PFDisplay from "@patternfly/patternfly/utilities/Display/display.css";': 'import PFLogin from "@patternfly/patternfly/components/Login/login.css";',
'import PFDisplay from "@patternfly/patternfly/utilities/Display/display.css?inline";', 'import PFModalBox from "@patternfly/patternfly/components/ModalBox/modal-box.css";',
'import PFDrawer from "@patternfly/patternfly/components/Drawer/drawer.css";': 'import PFNav from "@patternfly/patternfly/components/Nav/nav.css";',
'import PFDrawer from "@patternfly/patternfly/components/Drawer/drawer.css?inline";', 'import PFNotificationBadge from "@patternfly/patternfly/components/NotificationBadge/notification-badge.css";',
'import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css";': 'import PFNotificationDrawer from "@patternfly/patternfly/components/NotificationDrawer/notification-drawer.css";',
'import PFDropdown from "@patternfly/patternfly/components/Dropdown/dropdown.css?inline";', 'import PFPage from "@patternfly/patternfly/components/Page/page.css";',
'import PFEmptyState from "@patternfly/patternfly/components/EmptyState/empty-state.css";': 'import PFPagination from "@patternfly/patternfly/components/Pagination/pagination.css";',
'import PFEmptyState from "@patternfly/patternfly/components/EmptyState/empty-state.css?inline";', 'import PFProgressStepper from "@patternfly/patternfly/components/ProgressStepper/progress-stepper.css";',
'import PFExpandableSection from "@patternfly/patternfly/components/ExpandableSection/expandable-section.css";': 'import PFRadio from "@patternfly/patternfly/components/Radio/radio.css";',
'import PFExpandableSection from "@patternfly/patternfly/components/ExpandableSection/expandable-section.css?inline";', 'import PFSelect from "@patternfly/patternfly/components/Select/select.css";',
'import PFFAIcons from "@patternfly/patternfly/base/patternfly-fa-icons.css";': 'import PFSidebar from "@patternfly/patternfly/components/Sidebar/sidebar.css";',
'import PFFAIcons from "@patternfly/patternfly/base/patternfly-fa-icons.css?inline";', 'import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css";',
'import PFFlex from "@patternfly/patternfly/layouts/Flex/flex.css";': 'import PFSpacing from "@patternfly/patternfly/utilities/Spacing/spacing.css";',
'import PFFlex from "@patternfly/patternfly/layouts/Flex/flex.css?inline";', 'import PFSpinner from "@patternfly/patternfly/components/Spinner/spinner.css";',
'import PFForm from "@patternfly/patternfly/components/Form/form.css";': 'import PFStack from "@patternfly/patternfly/layouts/Stack/stack.css";',
'import PFForm from "@patternfly/patternfly/components/Form/form.css?inline";', 'import PFSwitch from "@patternfly/patternfly/components/Switch/switch.css";',
'import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css";': 'import PFTable from "@patternfly/patternfly/components/Table/table.css";',
'import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css?inline";', 'import PFTabs from "@patternfly/patternfly/components/Tabs/tabs.css";',
'import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css";': 'import PFTitle from "@patternfly/patternfly/components/Title/title.css";',
'import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css?inline";', 'import PFToggleGroup from "@patternfly/patternfly/components/ToggleGroup/toggle-group.css";',
'import PFGlobal from "@patternfly/patternfly/patternfly-base.css";': 'import PFToolbar from "@patternfly/patternfly/components/Toolbar/toolbar.css";',
'import PFGlobal from "@patternfly/patternfly/patternfly-base.css?inline";', 'import PFTreeView from "@patternfly/patternfly/components/TreeView/tree-view.css";',
'import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css";': 'import PFWizard from "@patternfly/patternfly/components/Wizard/wizard.css";',
'import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css?inline";', 'import ThemeDark from "@goauthentik/common/styles/theme-dark.css";',
'import PFHint from "@patternfly/patternfly/components/Hint/hint.css";': 'import styles from "./LibraryPageImpl.css";',
'import PFHint from "@patternfly/patternfly/components/Hint/hint.css?inline";', ];
'import PFInputGroup from "@patternfly/patternfly/components/InputGroup/input-group.css";':
'import PFInputGroup from "@patternfly/patternfly/components/InputGroup/input-group.css?inline";', export const cssImportMaps = cssImportMapSources.reduce(
'import PFLabel from "@patternfly/patternfly/components/Label/label.css";': (acc, source) => ({ ...acc, [source]: source.replace(".css", ".css?inline") }),
'import PFLabel from "@patternfly/patternfly/components/Label/label.css?inline";', {},
'import PFList from "@patternfly/patternfly/components/List/list.css";': );
'import PFList from "@patternfly/patternfly/components/List/list.css?inline";',
'import PFLogin from "@patternfly/patternfly/components/Login/login.css";':
'import PFLogin from "@patternfly/patternfly/components/Login/login.css?inline";',
'import PFModalBox from "@patternfly/patternfly/components/ModalBox/modal-box.css";':
'import PFModalBox from "@patternfly/patternfly/components/ModalBox/modal-box.css?inline";',
'import PFNav from "@patternfly/patternfly/components/Nav/nav.css";':
'import PFNav from "@patternfly/patternfly/components/Nav/nav.css?inline";',
'import PFNotificationBadge from "@patternfly/patternfly/components/NotificationBadge/notification-badge.css";':
'import PFNotificationBadge from "@patternfly/patternfly/components/NotificationBadge/notification-badge.css?inline";',
'import PFNotificationDrawer from "@patternfly/patternfly/components/NotificationDrawer/notification-drawer.css";':
'import PFNotificationDrawer from "@patternfly/patternfly/components/NotificationDrawer/notification-drawer.css?inline";',
'import PFPage from "@patternfly/patternfly/components/Page/page.css";':
'import PFPage from "@patternfly/patternfly/components/Page/page.css?inline";',
'import PFPagination from "@patternfly/patternfly/components/Pagination/pagination.css";':
'import PFPagination from "@patternfly/patternfly/components/Pagination/pagination.css?inline";',
'import PFProgressStepper from "@patternfly/patternfly/components/ProgressStepper/progress-stepper.css";':
'import PFProgressStepper from "@patternfly/patternfly/components/ProgressStepper/progress-stepper.css?inline";',
'import PFRadio from "@patternfly/patternfly/components/Radio/radio.css";':
'import PFRadio from "@patternfly/patternfly/components/Radio/radio.css?inline";',
'import PFSelect from "@patternfly/patternfly/components/Select/select.css";':
'import PFSelect from "@patternfly/patternfly/components/Select/select.css?inline";',
'import PFSidebar from "@patternfly/patternfly/components/Sidebar/sidebar.css";':
'import PFSidebar from "@patternfly/patternfly/components/Sidebar/sidebar.css?inline";',
'import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css";':
'import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css?inline";',
'import PFSpacing from "@patternfly/patternfly/utilities/Spacing/spacing.css";':
'import PFSpacing from "@patternfly/patternfly/utilities/Spacing/spacing.css?inline";',
'import PFSpinner from "@patternfly/patternfly/components/Spinner/spinner.css";':
'import PFSpinner from "@patternfly/patternfly/components/Spinner/spinner.css?inline";',
'import PFStack from "@patternfly/patternfly/layouts/Stack/stack.css";':
'import PFStack from "@patternfly/patternfly/layouts/Stack/stack.css?inline";',
'import PFSwitch from "@patternfly/patternfly/components/Switch/switch.css";':
'import PFSwitch from "@patternfly/patternfly/components/Switch/switch.css?inline";',
'import PFTable from "@patternfly/patternfly/components/Table/table.css";':
'import PFTable from "@patternfly/patternfly/components/Table/table.css?inline";',
'import PFTabs from "@patternfly/patternfly/components/Tabs/tabs.css";':
'import PFTabs from "@patternfly/patternfly/components/Tabs/tabs.css?inline";',
'import PFTitle from "@patternfly/patternfly/components/Title/title.css";':
'import PFTitle from "@patternfly/patternfly/components/Title/title.css?inline";',
'import PFToggleGroup from "@patternfly/patternfly/components/ToggleGroup/toggle-group.css";':
'import PFToggleGroup from "@patternfly/patternfly/components/ToggleGroup/toggle-group.css?inline";',
'import PFToolbar from "@patternfly/patternfly/components/Toolbar/toolbar.css";':
'import PFToolbar from "@patternfly/patternfly/components/Toolbar/toolbar.css?inline";',
'import PFTreeView from "@patternfly/patternfly/components/TreeView/tree-view.css";':
'import PFTreeView from "@patternfly/patternfly/components/TreeView/tree-view.css?inline";',
'import PFWizard from "@patternfly/patternfly/components/Wizard/wizard.css";':
'import PFWizard from "@patternfly/patternfly/components/Wizard/wizard.css?inline";',
'import ThemeDark from "@goauthentik/common/styles/theme-dark.css";':
'import ThemeDark from "@goauthentik/common/styles/theme-dark.css?inline";',
'import styles from "./LibraryPageImpl.css";':
'import styles from "./LibraryPageImpl.css?inline";',
};