Skip to content

Commit

Permalink
refactor(imports): remove barrel imports (#783)
Browse files Browse the repository at this point in the history
* remove barrel imports from wasm package

* remove barrel imports from ui package

* remove index from ui package

* remove barrel imports from storage package

* remove barrel imports from services and router packages

* remove barrel imports from query package

* more imports

* remove barrel imports from types package

* format

* fix build

* pnpm format

* update vite imports

* comments

* wild card

* more wild card

* modify exports
  • Loading branch information
TalDerei authored Mar 21, 2024
1 parent 7f339a5 commit 9609ae9
Show file tree
Hide file tree
Showing 222 changed files with 464 additions and 483 deletions.
2 changes: 1 addition & 1 deletion apps/extension/src/approve-origin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { localExtStorage } from '@penumbra-zone/storage';
import { localExtStorage } from '@penumbra-zone/storage/src/chrome/local';
import { OriginApproval, PopupType } from './message/popup';
import { popup } from './popup';
import Map from '@penumbra-zone/polyfills/src/Map.groupBy';
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/hooks/full-sync-height.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import { TendermintQuerier } from '@penumbra-zone/query';
import { TendermintQuerier } from '@penumbra-zone/query/src/queriers/tendermint';
import { PopupLoaderData } from '../routes/popup/home';
import { useStore } from '../state';
import { networkSelector } from '../state/network';
Expand Down
12 changes: 0 additions & 12 deletions apps/extension/src/icons/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/extension/src/impls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { sctImpl } from '@penumbra-zone/router/src/grpc/sct';
import { stakingImpl } from '@penumbra-zone/router/src/grpc/staking';
import { viewImpl } from '@penumbra-zone/router/src/grpc/view-protocol-server';

import { localExtStorage } from '@penumbra-zone/storage';
import { localExtStorage } from '@penumbra-zone/storage/src/chrome/local';
import { ServiceType } from '@bufbuild/protobuf';

const grpcEndpoint = await localExtStorage.get('grpcEndpoint');
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/message/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
} from '@penumbra-zone/types/src/internal-msg/shared';
import type { UserChoice } from '@penumbra-zone/types/src/user-choice';
import type { Jsonified } from '@penumbra-zone/types/src/jsonified';
import { OriginRecord } from '@penumbra-zone/storage';
import { OriginRecord } from '@penumbra-zone/storage/src/chrome/local';

export enum PopupType {
TxApproval = 'TxApproval',
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/popup.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { sessionExtStorage } from '@penumbra-zone/storage/src/chrome/session';
import { PopupMessage, PopupRequest, PopupType } from './message/popup';
import { PopupPath } from './routes/popup/paths';
import type {
InternalRequest,
InternalResponse,
} from '@penumbra-zone/types/src/internal-msg/shared';
import { isChromeResponderDroppedError } from '@penumbra-zone/types/src/internal-msg/chrome-error';
import { sessionExtStorage } from '@penumbra-zone/storage';
import { Code, ConnectError } from '@connectrpc/connect';
import { errorFromJson } from '@connectrpc/connect/protocol-connect';
import { JsonValue } from '@bufbuild/protobuf';
Expand Down
5 changes: 3 additions & 2 deletions apps/extension/src/routes/page/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { redirect } from 'react-router-dom';
import { PagePath } from './paths';
import { Button, SplashPage } from '@penumbra-zone/ui';
import { localExtStorage } from '@penumbra-zone/storage';
import { SplashPage } from '@penumbra-zone/ui/components/ui/splash-page';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { localExtStorage } from '@penumbra-zone/storage/src/chrome/local';

// Because Zustand initializes default empty (prior to persisted storage synced),
// We need to manually check storage for accounts in the loader.
Expand Down
10 changes: 5 additions & 5 deletions apps/extension/src/routes/page/onboarding/confirm-backup.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { useState } from 'react';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { BackIcon } from '@penumbra-zone/ui/components/ui/back-icon';
import {
BackIcon,
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
FadeTransition,
Input,
} from '@penumbra-zone/ui';
} from '@penumbra-zone/ui/components/ui/card';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { Input } from '@penumbra-zone/ui/components/ui/input';
import { useStore } from '../../../state';
import { generateSelector } from '../../../state/seed-phrase/generate';
import { usePageNav } from '../../../utils/navigate';
Expand Down
19 changes: 7 additions & 12 deletions apps/extension/src/routes/page/onboarding/generate.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import { ExclamationTriangleIcon, LockClosedIcon } from '@radix-ui/react-icons';
import { SeedPhraseLength } from '@penumbra-zone/crypto-web/src/mnemonic';
import { useEffect, useState } from 'react';
import {
BackIcon,
Button,
Card,
CardContent,
CardHeader,
CardTitle,
CopyToClipboard,
FadeTransition,
Input,
} from '@penumbra-zone/ui';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { BackIcon } from '@penumbra-zone/ui/components/ui/back-icon';
import { Card, CardContent, CardHeader, CardTitle } from '@penumbra-zone/ui/components/ui/card';
import { CopyToClipboard } from '@penumbra-zone/ui/components/ui/copy-to-clipboard';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { Input } from '@penumbra-zone/ui/components/ui/input';
import { cn } from '@penumbra-zone/ui/lib/utils';
import { useCountdown } from 'usehooks-ts';
import { useStore } from '../../../state';
import { generateSelector } from '../../../state/seed-phrase/generate';
import { usePageNav } from '../../../utils/navigate';
import { PagePath } from '../paths';
import { WordLengthToogles } from '../../../shared';
import { WordLengthToogles } from '../../../shared/containers/word-length-toogles';

export const GenerateSeedPhrase = () => {
const navigate = usePageNav();
Expand Down
10 changes: 5 additions & 5 deletions apps/extension/src/routes/page/onboarding/import.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { BackIcon } from '@penumbra-zone/ui/components/ui/back-icon';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import {
BackIcon,
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
FadeTransition,
} from '@penumbra-zone/ui';
} from '@penumbra-zone/ui/components/ui/card';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { cn } from '@penumbra-zone/ui/lib/utils';
import { useStore } from '../../../state';
import { importSelector } from '../../../state/seed-phrase/import';
import { usePageNav } from '../../../utils/navigate';
import { PagePath } from '../paths';
import { ImportForm } from '../../../shared';
import { ImportForm } from '../../../shared/containers/import-form';
import { FormEvent, MouseEvent } from 'react';

export const ImportSeedPhrase = () => {
Expand Down
10 changes: 5 additions & 5 deletions apps/extension/src/routes/page/onboarding/set-password.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { FormEvent, MouseEvent, useState } from 'react';
import { BackIcon } from '@penumbra-zone/ui/components/ui/back-icon';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import {
BackIcon,
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
FadeTransition,
} from '@penumbra-zone/ui';
} from '@penumbra-zone/ui/components/ui/card';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { useOnboardingSave } from '../../../hooks/onboarding';
import { usePageNav } from '../../../utils/navigate';
import { PagePath } from '../paths';
import { PasswordInput } from '../../../shared';
import { PasswordInput } from '../../../shared/components/password-input';

export const SetPassword = () => {
const navigate = usePageNav();
Expand Down
8 changes: 4 additions & 4 deletions apps/extension/src/routes/page/onboarding/start.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Button } from '@penumbra-zone/ui/components/ui/button';
import {
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
CompressedVideoLogo,
FadeTransition,
} from '@penumbra-zone/ui';
} from '@penumbra-zone/ui/components/ui/card';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { CompressedVideoLogo } from '@penumbra-zone/ui/components/ui/logo/compressed-video';
import { usePageNav } from '../../../utils/navigate';
import { PagePath } from '../paths';

Expand Down
3 changes: 2 additions & 1 deletion apps/extension/src/routes/page/onboarding/success.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button, SplashPage } from '@penumbra-zone/ui';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { SplashPage } from '@penumbra-zone/ui/components/ui/splash-page';

export const OnboardingSuccess = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Button } from '@penumbra-zone/ui/components/ui/button';
import {
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
FadeTransition,
} from '@penumbra-zone/ui';
} from '@penumbra-zone/ui/components/ui/card';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { cn } from '@penumbra-zone/ui/lib/utils';
import { useStore } from '../../../state';
import { importSelector } from '../../../state/seed-phrase/import';
import { usePageNav } from '../../../utils/navigate';
import { PagePath } from '../paths';
import { ImportForm } from '../../../shared';
import { ImportForm } from '../../../shared/containers/import-form';

export const RestorePassword = () => {
const navigate = usePageNav();
Expand Down
10 changes: 5 additions & 5 deletions apps/extension/src/routes/page/restore-password/set-password.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { useState } from 'react';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { BackIcon } from '@penumbra-zone/ui/components/ui/back-icon';
import {
BackIcon,
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
FadeTransition,
} from '@penumbra-zone/ui';
} from '@penumbra-zone/ui/components/ui/card';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { useOnboardingSave } from '../../../hooks/onboarding';
import { usePageNav } from '../../../utils/navigate';
import { PagePath } from '../paths';
import { PasswordInput } from '../../../shared';
import { PasswordInput } from '../../../shared/components/password-input';

export const SetPassword = () => {
const navigate = usePageNav();
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/routes/popup/approval/approve-deny.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button } from '@penumbra-zone/ui';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { useEffect } from 'react';
import { useCountdown } from 'usehooks-ts';

Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/routes/popup/approval/origin.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FadeTransition } from '@penumbra-zone/ui';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { useStore } from '../../../state';
import { originApprovalSelector } from '../../../state/origin-approval';
import { ApproveDeny } from './approve-deny';
import { LinkGradientIcon } from '../../../icons';
import { LinkGradientIcon } from '../../../icons/link-gradient';
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { DisplayOriginURL } from '../../../shared/components/display-origin-url';
import { cn } from '@penumbra-zone/ui/lib/utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TransactionViewComponent } from '@penumbra-zone/ui';
import { TransactionViewComponent } from '@penumbra-zone/ui/components/ui/tx/view/transaction';
import { useStore } from '../../../../state';
import { txApprovalSelector } from '../../../../state/tx-approval';
import { JsonViewer } from '@penumbra-zone/ui/components/ui/json-viewer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tabs, TabsList, TabsTrigger } from '@penumbra-zone/ui';
import { Tabs, TabsList, TabsTrigger } from '@penumbra-zone/ui/components/ui/tabs';
import { cn } from '@penumbra-zone/ui/lib/utils';
import { TransactionViewTab } from './types';
import { useStore } from '../../../../state';
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/routes/popup/home/block-sync.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LargeBlockSyncStatus } from '@penumbra-zone/ui';
import { LargeBlockSyncStatus } from '@penumbra-zone/ui/components/ui/block-sync-status/large';
import { useSyncProgress } from '../../../hooks/full-sync-height';

export const BlockSync = () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/routes/popup/home/index-header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HamburgerMenuIcon } from '@radix-ui/react-icons';
import { usePopupNav } from '../../../utils/navigate';
import { PopupPath } from '../paths';
import { NetworksPopover } from '@penumbra-zone/ui';
import { NetworksPopover } from '@penumbra-zone/ui/components/ui/networks-popover';
import { useChainIdQuery } from '../../../hooks/chain-id';
import { motion } from 'framer-motion';

Expand Down
4 changes: 2 additions & 2 deletions apps/extension/src/routes/popup/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SelectAccount } from '@penumbra-zone/ui';
import { SelectAccount } from '@penumbra-zone/ui/components/ui/select-account';
import { IndexHeader } from './index-header';
import { useStore } from '../../../state';
import { BlockSync } from './block-sync';
import { localExtStorage } from '@penumbra-zone/storage';
import { localExtStorage } from '@penumbra-zone/storage/src/chrome/local';
import { addrByIndexSelector, getActiveWallet } from '../../../state/wallets';
import { needsLogin } from '../popup-needs';

Expand Down
6 changes: 4 additions & 2 deletions apps/extension/src/routes/popup/login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Button, FadeTransition, InputProps } from '@penumbra-zone/ui';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { InputProps } from '@penumbra-zone/ui/components/ui/input';
import { PagePath } from '../page/paths';
import { PasswordInput } from '../../shared';
import { PasswordInput } from '../../shared/components/password-input';
import { usePopupNav } from '../../utils/navigate';
import { useStore } from '../../state';
import { passwordSelector } from '../../state/password';
Expand Down
3 changes: 2 additions & 1 deletion apps/extension/src/routes/popup/popup-needs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { redirect } from 'react-router-dom';
import { PopupPath } from './paths';
import { localExtStorage, sessionExtStorage } from '@penumbra-zone/storage';
import { localExtStorage } from '@penumbra-zone/storage/src/chrome/local';
import { sessionExtStorage } from '@penumbra-zone/storage/src/chrome/session';

export const needsLogin = async (): Promise<Response | null> => {
const password = await sessionExtStorage.get('passwordKey');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { TrashIcon } from '@radix-ui/react-icons';
import { CustomLink, SettingsHeader } from '../../../shared';
import { CustomLink } from '../../../shared/components/link';
import { SettingsHeader } from '../../../shared/components/settings-header';
import { usePopupNav } from '../../../utils/navigate';
import { PopupPath } from '../paths';
import { DashboardGradientIcon } from '../../../icons';
import { FadeTransition } from '@penumbra-zone/ui';
import { DashboardGradientIcon } from '../../../icons/dashboard-gradient';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';

const links = [
// TODO: Enable when ready
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Button, FadeTransition, Input } from '@penumbra-zone/ui';
import { SettingsHeader } from '../../../shared';
import { TimerGradientIcon } from '../../../icons';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { Input } from '@penumbra-zone/ui/components/ui/input';
import { SettingsHeader } from '../../../shared/components/settings-header';
import { TimerGradientIcon } from '../../../icons/time-gradient';

export const SettingsAutoLock = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { Button, FadeTransition } from '@penumbra-zone/ui';
import { SettingsHeader } from '../../../shared';
import { TrashGradientIcon } from '../../../icons';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { SettingsHeader } from '../../../shared/components/settings-header';
import { TrashGradientIcon } from '../../../icons/trash-gradient';
import { ServicesMessage } from '@penumbra-zone/types/src/services';
import { usePopupNav } from '../../../utils/navigate';
import { PopupPath } from '../paths';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Link1Icon, LinkBreak1Icon, MagnifyingGlassIcon, TrashIcon } from '@radix-ui/react-icons';
import { useEffect } from 'react';
import { Button, FadeTransition, Input } from '@penumbra-zone/ui';
import { LinkGradientIcon } from '../../../icons';
import { SettingsHeader } from '../../../shared';
import { OriginRecord } from '@penumbra-zone/storage';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { Input } from '@penumbra-zone/ui/components/ui/input';
import { LinkGradientIcon } from '../../../icons/link-gradient';
import { SettingsHeader } from '../../../shared/components/settings-header';
import { OriginRecord } from '@penumbra-zone/storage/src/chrome/local';
import { DisplayOriginURL } from '../../../shared/components/display-origin-url';
import { useStore } from '../../../state';
import { connectedSitesSelector } from '../../../state/connected-sites';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { ExclamationTriangleIcon } from '@radix-ui/react-icons';
import { useState } from 'react';
import { Button, CopyToClipboard, FadeTransition } from '@penumbra-zone/ui';
import { PasswordInput, SettingsHeader } from '../../../shared';
import { Button } from '@penumbra-zone/ui/components/ui/button';
import { FadeTransition } from '@penumbra-zone/ui/components/ui/fade-transition';
import { CopyToClipboard } from '@penumbra-zone/ui/components/ui/copy-to-clipboard';
import { SettingsHeader } from '../../../shared/components/settings-header';
import { PasswordInput } from '../../../shared/components/password-input';
import { useStore } from '../../../state';
import { passwordSelector } from '../../../state/password';
import { KeyGradientIcon } from '../../../icons';
import { KeyGradientIcon } from '../../../icons/key-gradient';
import { walletsSelector } from '../../../state/wallets';

export const SettingsFullViewingKey = () => {
Expand Down
Loading

0 comments on commit 9609ae9

Please sign in to comment.