-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Logan McAnsh <[email protected]>
- Loading branch information
Showing
24 changed files
with
481 additions
and
165 deletions.
There are no files selected for viewing
This file contains 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
12 changes: 12 additions & 0 deletions
12
examples/playground/vite.config.ts.timestamp-1731715104505-f49232386f5ef.mjs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// vite.config.ts | ||
import { vitePlugin as remix } from "file:///Users/lmcansh/remix-fastify/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_react@1_fdtw53wollluzaehojg7fjacfe/node_modules/@remix-run/dev/dist/index.js"; | ||
import { defineConfig } from "file:///Users/lmcansh/remix-fastify/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/index.js"; | ||
import tsconfigPaths from "file:///Users/lmcansh/remix-fastify/node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected][email protected]_/node_modules/vite-tsconfig-paths/dist/index.js"; | ||
import tailwindcss from "file:///Users/lmcansh/remix-fastify/node_modules/.pnpm/@[email protected][email protected]_@[email protected][email protected]_/node_modules/@tailwindcss/vite/dist/index.mjs"; | ||
var vite_config_default = defineConfig({ | ||
plugins: [remix(), tsconfigPaths(), tailwindcss()] | ||
}); | ||
export { | ||
vite_config_default as default | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvVXNlcnMvbG1jYW5zaC9yZW1peC1mYXN0aWZ5L2V4YW1wbGVzL3BsYXlncm91bmRcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIi9Vc2Vycy9sbWNhbnNoL3JlbWl4LWZhc3RpZnkvZXhhbXBsZXMvcGxheWdyb3VuZC92aXRlLmNvbmZpZy50c1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vVXNlcnMvbG1jYW5zaC9yZW1peC1mYXN0aWZ5L2V4YW1wbGVzL3BsYXlncm91bmQvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgeyB2aXRlUGx1Z2luIGFzIHJlbWl4IH0gZnJvbSBcIkByZW1peC1ydW4vZGV2XCI7XG5pbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tIFwidml0ZVwiO1xuaW1wb3J0IHRzY29uZmlnUGF0aHMgZnJvbSBcInZpdGUtdHNjb25maWctcGF0aHNcIjtcbmltcG9ydCB0YWlsd2luZGNzcyBmcm9tIFwiQHRhaWx3aW5kY3NzL3ZpdGVcIjtcblxuZXhwb3J0IGRlZmF1bHQgZGVmaW5lQ29uZmlnKHtcbiAgcGx1Z2luczogW3JlbWl4KCksIHRzY29uZmlnUGF0aHMoKSwgdGFpbHdpbmRjc3MoKV0sXG59KTtcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBa1UsU0FBUyxjQUFjLGFBQWE7QUFDdFcsU0FBUyxvQkFBb0I7QUFDN0IsT0FBTyxtQkFBbUI7QUFDMUIsT0FBTyxpQkFBaUI7QUFFeEIsSUFBTyxzQkFBUSxhQUFhO0FBQUEsRUFDMUIsU0FBUyxDQUFDLE1BQU0sR0FBRyxjQUFjLEdBQUcsWUFBWSxDQUFDO0FBQ25ELENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "@mcansh/remix-fastify", | ||
"version": "4.0.1", | ||
"description": "Fastify server request handler for Remix", | ||
"description": "Fastify server request handler for Remix and React Router", | ||
"repository": "mcansh/remix-fastify", | ||
"license": "MIT", | ||
"author": "Logan McAnsh <[email protected]> (https://mcan.sh)", | ||
|
@@ -11,6 +11,7 @@ | |
"keywords": [ | ||
"remix", | ||
"remix-run", | ||
"react-router", | ||
"fastify" | ||
], | ||
"funding": [ | ||
|
@@ -25,6 +26,14 @@ | |
".": { | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.js" | ||
}, | ||
"./react-router": { | ||
"require": "./dist/react-router.cjs", | ||
"import": "./dist/react-router.js" | ||
}, | ||
"./remix": { | ||
"require": "./dist/remix.cjs", | ||
"import": "./dist/remix.js" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
|
@@ -35,10 +44,18 @@ | |
"dist", | ||
"package.json", | ||
"README.md", | ||
"LICENSE" | ||
"LICENSE", | ||
"react-router.cjs", | ||
"react-router.d.cts", | ||
"react-router.d.ts", | ||
"react-router.js", | ||
"remix.cjs", | ||
"remix.d.cts", | ||
"remix.d.ts", | ||
"remix.js" | ||
], | ||
"scripts": { | ||
"prepublishOnly": "npm run build && cp ../../LICENSE LICENSE && publint && attw $(npm pack)", | ||
"prepublishOnly": "npm run build && cp ../../LICENSE LICENSE && publint && attw --pack", | ||
"typecheck": "tsc", | ||
"dev": "tsup --watch", | ||
"build": "tsup", | ||
|
@@ -52,18 +69,20 @@ | |
"pretty-cache-header": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@react-router/node": "7.0.0-pre.5", | ||
"@remix-run/node": "^2.13.1", | ||
"@types/node": "^22.7.7", | ||
"@typescript/lib-dom": "npm:@types/web@^0.0.174", | ||
"fastify": "^5.0.0", | ||
"node-mocks-http": "^1.16.1", | ||
"react-router": "^7.0.0-pre.5", | ||
"typescript": "^5.6.3", | ||
"vite": "^5.4.9" | ||
}, | ||
"peerDependencies": { | ||
"@remix-run/node": "^2.0.0", | ||
"fastify": "^3.29.0 || ^4.0.0 || ^5.0.0", | ||
"react-router": "*", | ||
"react-router": ">=7.0.0 || >=7.0.0.pre", | ||
"vite": "^5.0.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("./dist/react-router"); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type * from "./dist/react-router"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type * from "./dist/react-router"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./dist/react-router"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("./dist/remix"); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type * from "./dist/remix"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type * from "./dist/remix"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./dist/remix"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export type { GetLoadContextFunction, RequestHandler } from "./server"; | ||
export { createRequestHandler } from "./server"; | ||
export { remixFastify } from "./plugin"; | ||
export type { RemixFastifyOptions } from "./plugin"; | ||
export type { | ||
GetLoadContextFunction, | ||
RequestHandler, | ||
RemixFastifyOptions, | ||
} from "./remix"; | ||
export { createRequestHandler, remixFastify } from "./remix"; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import fp from "fastify-plugin"; | ||
|
||
import type { HttpServer } from "../shared"; | ||
import type { AppLoadContext, ServerBuild } from "react-router"; | ||
import { createRequestHandler } from "../servers/react-router"; | ||
import { createPlugin, type PluginOptions } from "."; | ||
|
||
export type ReactRouterFastifyOptions = Omit< | ||
PluginOptions<HttpServer, AppLoadContext, ServerBuild>, | ||
"virtualModule" | ||
>; | ||
|
||
export const reactRouterFastify = fp<ReactRouterFastifyOptions>( | ||
async (fastify, options) => { | ||
let plugin = createPlugin( | ||
fastify, | ||
{ | ||
...options, | ||
virtualModule: "virtual:react-router/server-build", | ||
}, | ||
createRequestHandler, | ||
); | ||
return plugin(); | ||
}, | ||
{ | ||
// replaced with the package name during build | ||
name: process.env.__PACKAGE_NAME__, | ||
fastify: process.env.__FASTIFY_VERSION__, | ||
}, | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import fp from "fastify-plugin"; | ||
import type { AppLoadContext, ServerBuild } from "@remix-run/node"; | ||
|
||
import { createRequestHandler } from "../servers/remix"; | ||
import type { HttpServer } from "../shared"; | ||
import { createPlugin, type PluginOptions } from "."; | ||
|
||
export type RemixFastifyOptions = Omit< | ||
PluginOptions<HttpServer, AppLoadContext, ServerBuild>, | ||
"virtualModule" | ||
>; | ||
|
||
export const remixFastify = fp<RemixFastifyOptions>( | ||
async (fastify, options) => { | ||
let plugin = createPlugin( | ||
fastify, | ||
{ | ||
...options, | ||
virtualModule: "virtual:remix/server-build", | ||
}, | ||
createRequestHandler, | ||
); | ||
return plugin(); | ||
}, | ||
{ | ||
// replaced with the package name during build | ||
name: process.env.__PACKAGE_NAME__, | ||
fastify: process.env.__FASTIFY_VERSION__, | ||
}, | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { AppLoadContext } from "react-router"; | ||
import type { | ||
HttpServer, | ||
GetLoadContextFunction as SharedGetLoadContextFunction, | ||
} from "./shared"; | ||
export type { RequestHandler } from "./shared"; | ||
export { createRequestHandler } from "./servers/react-router"; | ||
export { reactRouterFastify } from "./plugins/react-router"; | ||
export type { ReactRouterFastifyOptions } from "./plugins/react-router"; | ||
|
||
export type GetLoadContextFunction<Server extends HttpServer> = | ||
SharedGetLoadContextFunction<Server, AppLoadContext>; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { AppLoadContext } from "@remix-run/node"; | ||
import type { | ||
HttpServer, | ||
GetLoadContextFunction as SharedGetLoadContextFunction, | ||
} from "./shared"; | ||
export type { RequestHandler } from "./shared"; | ||
export { createRequestHandler } from "./servers/remix"; | ||
export { remixFastify } from "./plugins/remix"; | ||
export type { RemixFastifyOptions } from "./plugins/remix"; | ||
|
||
export type GetLoadContextFunction<Server extends HttpServer> = | ||
SharedGetLoadContextFunction<Server, AppLoadContext>; |
Oops, something went wrong.