forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added sourcemap support (remix-run#242)
feat: added sourcemap support feat!: remix-node has been renamed remix-server. remix-node has been repurposed to house the abstractions of the node runtime. feat!: added abstraction for runtimes (remix-run#244) feat!: moved fileStorage session to remix-node this removes the last node specific platform modules from remix-server-runtime feat: added cloudflare worker handler (untested) feat: moved to webcrypto instead of "crypto" to support more platforms feat!: updated .npmrc to minimum required version for webcrypto API feat: Use node-fetch types in node adapters feat: abstracted req and res types through the platform feat: Add base64 encoding primitives to node globals Co-authored-by: Michael Jackson <[email protected]>
- Loading branch information
1 parent
841b5f8
commit a8bcc1f
Showing
71 changed files
with
1,297 additions
and
645 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14 | ||
15 |
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
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
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,3 @@ | ||
import { installGlobals } from "../packages/remix-node/globals"; | ||
|
||
installGlobals(); |
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
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,2 @@ | ||
export type { GetLoadContextFunction, RequestHandler } from "./worker"; | ||
export { createRequestHandler } from "./worker"; |
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,15 @@ | ||
{ | ||
"name": "@remix-run/cloudflare-workers", | ||
"description": "Cloudflare worker request handler for Remix", | ||
"version": "0.17.5", | ||
"repository": "https://github.com/remix-run/packages", | ||
"dependencies": { | ||
"@remix-run/server-runtime": "0.17.5" | ||
}, | ||
"peerDependencies": { | ||
"@cloudflare/workers-types": "^2.2.2" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^2.2.2" | ||
} | ||
} |
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 { json, redirect } from "@remix-run/server-runtime"; |
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,11 @@ | ||
import type { | ||
ActionFunction as CoreActionFunction, | ||
HeadersFunction as CoreHeadersFunction, | ||
LoaderFunction as CoreLoaderFunction | ||
} from "@remix-run/server-runtime"; | ||
|
||
export type ActionFunction = CoreActionFunction<Request, Response>; | ||
|
||
export type HeadersFunction = CoreHeadersFunction<Headers, HeadersInit>; | ||
|
||
export type LoaderFunction = CoreLoaderFunction<Request, Response>; |
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,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["ES2019", "WebWorker"], | ||
"target": "ES2019", | ||
"types": ["@cloudflare/workers-types"], | ||
|
||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
|
||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
|
||
"outDir": "../../build/node_modules/@remix-run/cloudflare-workers", | ||
"rootDir": "." | ||
} | ||
} |
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,43 @@ | ||
import type { | ||
AppLoadContext, | ||
ServerBuild, | ||
ServerPlatform | ||
} from "@remix-run/server-runtime"; | ||
import { createRequestHandler as createRemixRequestHandler } from "@remix-run/server-runtime"; | ||
|
||
/** | ||
* A function that returns the value to use as `context` in route `loader` and | ||
* `action` functions. | ||
* | ||
* You can think of this as an escape hatch that allows you to pass | ||
* environment/platform-specific values through to your loader/action. | ||
*/ | ||
export interface GetLoadContextFunction { | ||
(event: FetchEvent): AppLoadContext; | ||
} | ||
|
||
export type RequestHandler = ReturnType<typeof createRequestHandler>; | ||
|
||
/** | ||
* Returns a request handler for Cloudflare runtime that serves the | ||
* response using Remix. | ||
*/ | ||
export function createRequestHandler({ | ||
build, | ||
getLoadContext, | ||
mode | ||
}: { | ||
build: ServerBuild; | ||
getLoadContext?: GetLoadContextFunction; | ||
mode?: string; | ||
}) { | ||
let platform: ServerPlatform = {}; | ||
let handleRequest = createRemixRequestHandler(build, platform, mode); | ||
|
||
return (event: FetchEvent) => { | ||
let loadContext = | ||
typeof getLoadContext === "function" ? getLoadContext(event) : undefined; | ||
|
||
return handleRequest(event.request, loadContext); | ||
}; | ||
} |
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
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
Oops, something went wrong.