Skip to content

Commit

Permalink
chore: stop relying on remix magic export
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung committed May 23, 2022
1 parent ee0fbad commit 0e0b63b
Show file tree
Hide file tree
Showing 39 changed files with 83 additions and 66 deletions.
2 changes: 1 addition & 1 deletion app/components/About.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from 'react';
import { useMatches } from 'remix';
import { useMatches } from '@remix-run/react';
import SvgIcon from '~/components/SvgIcon';
import logo from '~/icons/logo.svg';

Expand Down
2 changes: 1 addition & 1 deletion app/components/BackupForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement } from 'react';
import { Form } from 'remix';
import { Form } from '@remix-run/react';

interface BackupFormProps {
data: any;
Expand Down
2 changes: 1 addition & 1 deletion app/components/BookmarkDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactElement, useMemo } from 'react';
import { useLocation } from 'remix';
import { useLocation } from '@remix-run/react';
import { PaneContainer, PaneHeader, PaneContent, PaneFooter } from '~/layout';
import IconLink from '~/components/IconLink';
import InputOption from '~/components/InputOption';
Expand Down
2 changes: 1 addition & 1 deletion app/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link } from 'remix';
import { Link } from '@remix-run/react';
import type { ReactElement } from 'react';
import type { Resource } from '~/types';
import { getSite, getResourceURL } from '~/search';
Expand Down
2 changes: 1 addition & 1 deletion app/components/Feed.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactNode } from 'react';
import { useMemo } from 'react';
import { useLocation } from 'remix';
import { useLocation } from '@remix-run/react';
import clsx from 'clsx';
import SearchList from '~/components/SearchList';
import ResourcesList from '~/components/ResourcesList';
Expand Down
2 changes: 1 addition & 1 deletion app/components/IconLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clsx from 'clsx';
import type { ComponentProps, ReactElement } from 'react';
import { Link } from 'remix';
import { Link } from '@remix-run/react';
import SvgIcon from '~/components/SvgIcon';

interface IconLinkProps {
Expand Down
2 changes: 1 addition & 1 deletion app/components/Progress.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactElement, RefObject } from 'react';
import { useEffect, useRef } from 'react';
import { useTransition } from 'remix';
import { useTransition } from '@remix-run/react';

export function useProgress(): RefObject<HTMLElement> {
const el = useRef<HTMLElement>(null);
Expand Down
2 changes: 1 addition & 1 deletion app/components/ResourcesDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, useLocation, useFetcher } from 'remix';
import { Link, useLocation, useFetcher } from '@remix-run/react';
import type { ReactElement, ReactNode } from 'react';
import { useEffect, useMemo } from 'react';
import type { Resource } from '~/types';
Expand Down
2 changes: 1 addition & 1 deletion app/components/ResourcesList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, useLocation } from 'remix';
import { Link, useLocation } from '@remix-run/react';
import Card from '~/components/Card';
import SvgIcon from '~/components/SvgIcon';
import searchIcon from '~/icons/search.svg';
Expand Down
2 changes: 1 addition & 1 deletion app/components/SearchList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Form, Link } from 'remix';
import { Form, Link } from '@remix-run/react';
import { useRef, useState } from 'react';
import clsx from 'clsx';
import SvgIcon from '~/components/SvgIcon';
Expand Down
2 changes: 1 addition & 1 deletion app/components/ShowMoreButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link } from 'remix';
import { Link } from '@remix-run/react';
import { useInView } from 'react-intersection-observer';
import { getResourceSearchParams } from '~/search';
import { SearchOptions } from '~/types';
Expand Down
2 changes: 1 addition & 1 deletion app/components/SidebarNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactElement, ReactNode } from 'react';
import { useMemo } from 'react';
import { Form, Link, NavLink, useLocation } from 'remix';
import { Form, Link, NavLink, useLocation } from '@remix-run/react';
import clsx from 'clsx';
import SvgIcon from '~/components/SvgIcon';
import logo from '~/icons/logo.svg';
Expand Down
2 changes: 1 addition & 1 deletion app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOM from 'react-dom';
import { RemixBrowser } from 'remix';
import { RemixBrowser } from '@remix-run/react';

ReactDOM.hydrate(<RemixBrowser />, document);
4 changes: 2 additions & 2 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ReactDOMServer from 'react-dom/server';
import type { EntryContext } from 'remix';
import { RemixServer } from 'remix';
import type { EntryContext } from '@remix-run/cloudflare';
import { RemixServer } from '@remix-run/react';

export default function handleRequest(
request: Request,
Expand Down
2 changes: 1 addition & 1 deletion app/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMatches } from 'remix';
import { useMatches } from '@remix-run/react';
import { GuideMetadata, SessionData } from '~/types';

export function useSessionData(): SessionData {
Expand Down
8 changes: 4 additions & 4 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import type {
LinksFunction,
MetaFunction,
LoaderFunction,
ShouldReloadFunction,
} from 'remix';
} from '@remix-run/cloudflare';
import { json } from '@remix-run/cloudflare';
import type { ShouldReloadFunction } from '@remix-run/react';
import {
Meta,
Links,
Scripts,
LiveReload,
useCatch,
Outlet,
json,
} from 'remix';
} from '@remix-run/react';
import type { Context } from '~/types';
import stylesUrl from '~/styles/tailwind.css';

Expand Down
6 changes: 4 additions & 2 deletions app/routes/__layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { LoaderFunction, ShouldReloadFunction } from 'remix';
import { Outlet, json, useLoaderData, useLocation } from 'remix';
import type { ShouldReloadFunction } from '@remix-run/react';
import { Outlet, useLoaderData, useLocation } from '@remix-run/react';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { json } from '@remix-run/cloudflare';
import clsx from 'clsx';
import Progress from '~/components/Progress';
import SidebarNavigation from '~/components/SidebarNavigation';
Expand Down
12 changes: 8 additions & 4 deletions app/routes/__layout/$guide.$list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useMemo } from 'react';
import type { LoaderFunction, ShouldReloadFunction } from 'remix';
import { Outlet, useLoaderData, useLocation, json } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { json } from '@remix-run/cloudflare';
import { Outlet, useLoaderData, useLocation } from '@remix-run/react';
import type { ShouldReloadFunction } from '@remix-run/react';
import Feed from '~/components/Feed';
import { notFound } from '~/helpers';
import { search } from '~/resources';
Expand Down Expand Up @@ -50,8 +52,10 @@ export const unstable_shouldReload: ShouldReloadFunction = ({
};

export default function List() {
const { entries, count } =
useLoaderData<{ entries: Resource[]; count: number }>();
const { entries, count } = useLoaderData<{
entries: Resource[];
count: number;
}>();
const location = useLocation();
const resourceId = useMemo(() => {
const searchParams = new URLSearchParams(location.search);
Expand Down
7 changes: 4 additions & 3 deletions app/routes/__layout/$guide.$list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type {
LoaderFunction,
ActionFunction,
ShouldReloadFunction,
MetaFunction,
} from 'remix';
import { Form, useLocation, useLoaderData, json, redirect } from 'remix';
} from '@remix-run/cloudflare';
import { json, redirect } from '@remix-run/cloudflare';
import type { ShouldReloadFunction } from '@remix-run/react';
import { Form, useLocation, useLoaderData } from '@remix-run/react';
import { useMemo } from 'react';
import clsx from 'clsx';
import About from '~/components/About';
Expand Down
12 changes: 8 additions & 4 deletions app/routes/__layout/$guide.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useMemo } from 'react';
import type { LoaderFunction, ShouldReloadFunction } from 'remix';
import { Outlet, useLoaderData, useLocation, json, redirect } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { json, redirect } from '@remix-run/cloudflare';
import { Outlet, useLoaderData, useLocation } from '@remix-run/react';
import type { ShouldReloadFunction } from '@remix-run/react';
import Feed from '~/components/Feed';
import { notFound } from '~/helpers';
import { search } from '~/resources';
Expand Down Expand Up @@ -42,8 +44,10 @@ export const unstable_shouldReload: ShouldReloadFunction = ({
};

export default function List() {
const { entries, count } =
useLoaderData<{ entries: Resource[]; count: number }>();
const { entries, count } = useLoaderData<{
entries: Resource[];
count: number;
}>();
const location = useLocation();
const resourceId = useMemo(() => {
const searchParams = new URLSearchParams(location.search);
Expand Down
7 changes: 4 additions & 3 deletions app/routes/__layout/$guide/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type {
ActionFunction,
LoaderFunction,
ShouldReloadFunction,
MetaFunction,
} from 'remix';
import { Form, useLoaderData, useLocation, json, redirect } from 'remix';
} from '@remix-run/cloudflare';
import { json, redirect } from '@remix-run/cloudflare';
import type { ShouldReloadFunction } from '@remix-run/react';
import { Form, useLoaderData, useLocation } from '@remix-run/react';
import { useMemo } from 'react';
import clsx from 'clsx';
import About from '~/components/About';
Expand Down
4 changes: 2 additions & 2 deletions app/routes/__layout/admin.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LoaderFunction } from 'remix';
import { Outlet, useLoaderData, useLocation } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { Outlet, useLoaderData, useLocation } from '@remix-run/react';
import { useMemo } from 'react';
import menuIcon from '~/icons/menu.svg';
import FlashMessage from '~/components/FlashMessage';
Expand Down
5 changes: 3 additions & 2 deletions app/routes/__layout/admin/pages.statistics.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ActionFunction } from 'remix';
import { json, useActionData, redirect } from 'remix';
import type { ActionFunction } from '@remix-run/cloudflare';
import { json, redirect } from '@remix-run/cloudflare';
import { useActionData } from '@remix-run/react';
import { requireAdministrator } from '~/helpers';
import BackupForm from '~/components/BackupForm';
import type { Context } from '~/types';
Expand Down
5 changes: 3 additions & 2 deletions app/routes/__layout/admin/pages.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LoaderFunction, ActionFunction, Link } from 'remix';
import { Form, useLoaderData, useLocation, json, redirect } from 'remix';
import type { LoaderFunction, ActionFunction } from '@remix-run/cloudflare';
import { json, redirect } from '@remix-run/cloudflare';
import { Link, Form, useLoaderData, useLocation } from '@remix-run/react';
import { requireAdministrator } from '~/helpers';
import { getSite } from '~/search';
import type { Context, PageMetadata } from '~/types';
Expand Down
5 changes: 3 additions & 2 deletions app/routes/__layout/admin/resources.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ActionFunction } from 'remix';
import { json, useActionData, redirect } from 'remix';
import type { ActionFunction } from '@remix-run/cloudflare';
import { json, redirect } from '@remix-run/cloudflare';
import { useActionData } from '@remix-run/react';
import { requireAdministrator } from '~/helpers';
import BackupForm from '~/components/BackupForm';
import type { Context } from '~/types';
Expand Down
5 changes: 3 additions & 2 deletions app/routes/__layout/admin/users.$userId.backup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ActionFunction } from 'remix';
import { json, useActionData, redirect } from 'remix';
import type { ActionFunction } from '@remix-run/cloudflare';
import { json, redirect } from '@remix-run/cloudflare';
import { useActionData } from '@remix-run/react';
import { requireAdministrator, notFound } from '~/helpers';
import BackupForm from '~/components/BackupForm';
import type { Context } from '~/types';
Expand Down
5 changes: 3 additions & 2 deletions app/routes/__layout/admin/users.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { LoaderFunction } from 'remix';
import { Link, useLoaderData, json } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { json } from '@remix-run/cloudflare';
import { Link, useLoaderData } from '@remix-run/react';
import { requireAdministrator } from '~/helpers';
import type { Context, UserProfile } from '~/types';

Expand Down
4 changes: 2 additions & 2 deletions app/routes/__layout/resources/$resourceId.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LoaderFunction } from 'remix';
import { redirect } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { redirect } from '@remix-run/cloudflare';
import { getRelatedSearchParams } from '~/search';

export let loader: LoaderFunction = async ({ request, params }) => {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/__layout/resources/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LoaderFunction } from 'remix';
import { redirect } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { redirect } from '@remix-run/cloudflare';
import { getRelatedSearchParams } from '~/search';

export let loader: LoaderFunction = async ({ request }) => {
Expand Down
5 changes: 3 additions & 2 deletions app/routes/__layout/submit.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { MetaFunction, ActionFunction } from 'remix';
import { Form, redirect, useLocation } from 'remix';
import type { MetaFunction, ActionFunction } from '@remix-run/cloudflare';
import { redirect } from '@remix-run/cloudflare';
import { Form, useLocation } from '@remix-run/react';
import { useMemo } from 'react';
import menuIcon from '~/icons/menu.svg';
import FlashMessage from '~/components/FlashMessage';
Expand Down
2 changes: 1 addition & 1 deletion app/routes/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunction } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';

export let loader: LoaderFunction = async ({ context }) => {
return await context.session.login();
Expand Down
4 changes: 2 additions & 2 deletions app/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LoaderFunction, MetaFunction } from 'remix';
import { redirect } from 'remix';
import type { LoaderFunction, MetaFunction } from '@remix-run/cloudflare';
import { redirect } from '@remix-run/cloudflare';
import { formatMeta } from '~/helpers';

export let meta: MetaFunction = () => {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/login.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunction, ActionFunction } from 'remix';
import type { LoaderFunction, ActionFunction } from '@remix-run/cloudflare';
import { notFound } from '~/helpers';

export let loader: LoaderFunction = async ({ context }) => {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/logout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ActionFunction, LoaderFunction } from 'remix';
import type { ActionFunction, LoaderFunction } from '@remix-run/cloudflare';
import { notFound } from '~/helpers';

export let action: ActionFunction = async ({ context }) => {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/news.$list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LoaderFunction } from 'remix';
import { redirect } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { redirect } from '@remix-run/cloudflare';

export let loader: LoaderFunction = ({ params }) => {
throw redirect(`/discover/${params.list}`);
Expand Down
4 changes: 2 additions & 2 deletions app/routes/news.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LoaderFunction } from 'remix';
import { redirect } from 'remix';
import type { LoaderFunction } from '@remix-run/cloudflare';
import { redirect } from '@remix-run/cloudflare';

export let loader: LoaderFunction = () => {
throw redirect('/discover');
Expand Down
2 changes: 1 addition & 1 deletion app/scroll.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
import { useBeforeUnload, useLocation, useTransition } from 'remix';
import { useBeforeUnload, useLocation, useTransition } from '@remix-run/react';

let STORAGE_KEY = 'feed-positions';

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"dev:remix": "remix watch",
"dev:style": "tailwindcss -o ./app/styles/tailwind.css --watch",
"dev": "concurrently \"npm:dev:*\"",
"postinstall": "remix setup cloudflare",
"prebuild": "npm run cleanup",
"test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" playwright test",
"start": "miniflare",
Expand Down
2 changes: 1 addition & 1 deletion worker/context/session.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Authenticator } from 'remix-auth';
import { GitHubStrategy } from 'remix-auth-github';
import { createCookieSessionStorage, redirect } from 'remix';
import { createCookieSessionStorage, redirect } from '@remix-run/cloudflare';
import type { Env, MessageType, SessionData, UserProfile } from '../types';
import { getUserStore } from '../store/UserStore';

Expand Down

0 comments on commit 0e0b63b

Please sign in to comment.