This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { describe, it, expect } from "vitest"; | |
| import { routesFromGlob, type RoutesFromGlob } from "./routes"; | |
| describe("routesFromGlob", () => { | |
| it("correctly transforms routes", () => { | |
| let routes = { | |
| "./routes/_index/route.tsx": () => "Index Route", | |
| "./routes/single/route.tsx": () => "Single Route", | |
| "./routes/$param/route.tsx": () => "Param Route", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createBrowserRouter, RouterProvider } from "react-router-dom"; | |
| import { globRoutes } from "@/lib/routes"; | |
| const router = createBrowserRouter( | |
| globRoutes(import.meta.glob("./routes/**/route.tsx")) | |
| ); | |
| function App() { | |
| return <RouterProvider router={router} />; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getIsLiked(viewerId, entityId) { | |
| // hit a database or something | |
| } | |
| function toggleLikeStatus(viewerId, entityId) { | |
| // hit a database or something | |
| return !currentStatus; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("node:fs"); | |
| const { createRequestHandler } = require("@remix-run/express"); | |
| const { broadcastDevReady, installGlobals } = require("@remix-run/node"); | |
| const compression = require("compression"); | |
| const express = require("express"); | |
| const morgan = require("morgan"); | |
| const sourceMapSupport = require("source-map-support"); | |
| sourceMapSupport.install(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function createDevMiddleware(pathname: string) { | |
| return { | |
| hmr(request: Request) { | |
| return new Response( | |
| new ReadableStream({ | |
| start(controller) { | |
| controller.enqueue( | |
| `id:0\nevent: message\ndata: ${JSON.stringify({ | |
| type: "connected", | |
| })}\n\n` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { readFile } from 'node:fs/promises' | |
| import * as path from 'node:path' | |
| import { type LoadHook, type ResolveHook, type ResolveHookContext } from 'node:module' | |
| import { fileURLToPath } from 'node:url' | |
| import * as oxy from '@oxidation-compiler/napi' | |
| import type { ModuleExport } from './module-info.js' | |
| import * as clientTransforms from './transform-client.js' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from "react"; | |
| // @ts-ignore | |
| import * as ReactDOM from "#react-dom-server-implementation"; | |
| // @ts-ignore | |
| import * as ReactDOMClient from "#react-server-dom-client-implementation"; | |
| export async function fetch( | |
| request: Request, | |
| { | |
| browserEntry, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const remote = () => "@app/" + "other"; | |
| __webpack_chunk_load__(remote()).then(async () => { | |
| const container = __webpack_require__(remote()); | |
| const factory = await container.get("./federated"); | |
| const mod = factory(); | |
| console.log({ | |
| APP_NAME, | |
| REMOTE: mod.name, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { Server } from "node:http"; | |
| export type Handler = (request: Request) => Response | Promise<Response>; | |
| export type CreateServerOptions = { | |
| onError?: (error: unknown) => void; | |
| }; | |
| export declare function createServer( | |
| handler: Handler, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from "react"; | |
| import { useNavigate, useSubmit } from "@remix-run/react"; | |
| export function useEventDelegation() { | |
| const navigate = useNavigate(); | |
| const submit = useSubmit(); | |
| React.useEffect(() => { | |
| const handleClick = (e: MouseEvent) => { | |
| const target = e.target as HTMLElement; | |
| if ( |