@remix-run/deno
Advanced tools
Comparing version 0.0.0-experimental-37286ee6 to 0.0.0-experimental-38ca648a3
import * as path from "https://deno.land/std@0.128.0/path/mod.ts"; | ||
import type { | ||
SessionData, | ||
SessionIdStorageStrategy, | ||
@@ -28,9 +29,9 @@ SessionStorage, | ||
*/ | ||
export function createFileSessionStorage({ | ||
export function createFileSessionStorage<Data = SessionData, FlashData = Data>({ | ||
cookie, | ||
dir, | ||
}: FileSessionStorageOptions): SessionStorage { | ||
}: FileSessionStorageOptions): SessionStorage<Data, FlashData> { | ||
return createSessionStorage({ | ||
cookie, | ||
async createData(data, expires) { | ||
createData: async (data, expires) => { | ||
const content = JSON.stringify({ data, expires }); | ||
@@ -68,3 +69,3 @@ | ||
}, | ||
async readData(id) { | ||
readData: async (id) => { | ||
try { | ||
@@ -91,3 +92,3 @@ const file = getFile(dir, id); | ||
}, | ||
async updateData(id, data, expires) { | ||
updateData: async (id, data, expires) => { | ||
const content = JSON.stringify({ data, expires }); | ||
@@ -98,3 +99,3 @@ const file = getFile(dir, id); | ||
}, | ||
async deleteData(id) { | ||
deleteData: async (id) => { | ||
try { | ||
@@ -101,0 +102,0 @@ await Deno.remove(getFile(dir, id)); |
@@ -12,2 +12,3 @@ /* | ||
} | ||
// deno-lint-ignore no-unused-vars no-var | ||
var process: Process; |
29
index.ts
@@ -17,10 +17,16 @@ import "./globals.ts"; | ||
export { | ||
broadcastDevReady, | ||
createSession, | ||
defer, | ||
isCookie, | ||
isSession, | ||
json, | ||
logDevReady, | ||
MaxPartSizeExceededError, | ||
redirect, | ||
redirectDocument, | ||
replace, | ||
unstable_composeUploadHandlers, | ||
unstable_createMemoryUploadHandler, | ||
unstable_data, | ||
unstable_parseMultipartFormData, | ||
@@ -31,3 +37,3 @@ } from "@remix-run/server-runtime"; | ||
ActionFunction, | ||
AppData, | ||
ActionFunctionArgs, | ||
AppLoadContext, | ||
@@ -39,24 +45,27 @@ Cookie, | ||
CookieSignatureOptions, | ||
CreateRequestHandlerFunction, | ||
DataFunctionArgs, | ||
EntryContext, | ||
ErrorBoundaryComponent, | ||
ErrorResponse, | ||
Future, | ||
HandleDataRequestFunction, | ||
HandleDocumentRequestFunction, | ||
HandleErrorFunction, | ||
HeadersArgs, | ||
HeadersFunction, | ||
HtmlLinkDescriptor, | ||
HtmlMetaDescriptor, | ||
JsonFunction, | ||
LinkDescriptor, | ||
LinksFunction, | ||
LoaderFunction, | ||
LoaderFunctionArgs, | ||
MemoryUploadHandlerFilterArgs, | ||
MemoryUploadHandlerOptions, | ||
MetaDescriptor, | ||
MetaFunction, | ||
PageLinkDescriptor, | ||
RequestHandler, | ||
RouteComponent, | ||
RouteHandle, | ||
SerializeFrom, | ||
ServerBuild, | ||
ServerEntryModule, | ||
ServerRuntimeMetaArgs as MetaArgs, | ||
ServerRuntimeMetaDescriptor as MetaDescriptor, | ||
ServerRuntimeMetaFunction as MetaFunction, | ||
Session, | ||
@@ -66,4 +75,8 @@ SessionData, | ||
SessionStorage, | ||
SignFunction, | ||
TypedDeferredData, | ||
TypedResponse, | ||
UnsignFunction, | ||
UploadHandler, | ||
UploadHandlerPart, | ||
} from "@remix-run/server-runtime"; |
@@ -1,7 +0,22 @@ | ||
Copyright 2021 Remix Software Inc. | ||
MIT License | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
Copyright (c) Remix Software Inc. 2020-2021 | ||
Copyright (c) Shopify Inc. 2022-2024 | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
{ | ||
"name": "@remix-run/deno", | ||
"version": "0.0.0-experimental-37286ee6", | ||
"version": "0.0.0-experimental-38ca648a3", | ||
"description": "Deno platform abstractions for Remix", | ||
"homepage": "https://remix.run", | ||
"main": "./index.ts", | ||
"bugs": { | ||
@@ -17,8 +18,16 @@ "url": "https://github.com/remix-run/remix/issues" | ||
"dependencies": { | ||
"@remix-run/server-runtime": "0.0.0-experimental-37286ee6", | ||
"@remix-run/server-runtime": "0.0.0-experimental-38ca648a3", | ||
"mime": "^3.0.0" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "^5.1.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"typescript": { | ||
"optional": true | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
"node": ">=18.0.0" | ||
} | ||
} | ||
} |
@@ -5,11 +5,13 @@ # @remix-run/deno | ||
For more, see the [Remix docs](https://remix.run/docs/). | ||
For more, see the [Remix docs](https://remix.run/docs). | ||
## Install | ||
Installation is done via `npm`, but the code itself is Deno source code. | ||
Read more about [why we use `npm` to manage dependencies for Deno projects](https://github.com/remix-run/remix/blob/main/docs/decisions/0001-use-npm-to-manage-npm-dependencies-for-deno-projects.md) in Remix. | ||
Installation is done via `npm`, but the code itself is Deno source code. Read | ||
more about | ||
[why we use `npm` to manage dependencies for Deno projects](https://github.com/remix-run/remix/blob/main/decisions/0001-use-npm-to-manage-npm-dependencies-for-deno-projects.md) | ||
in Remix. | ||
```sh | ||
npm install @remix-run/deno | ||
``` | ||
``` |
import * as path from "https://deno.land/std@0.128.0/path/mod.ts"; | ||
import mime from "mime"; | ||
import { createRequestHandler as createRemixRequestHandler } from "@remix-run/server-runtime"; | ||
import type { ServerBuild } from "@remix-run/server-runtime"; | ||
import type { AppLoadContext, ServerBuild } from "@remix-run/server-runtime"; | ||
@@ -14,3 +14,5 @@ function defaultCacheControl(url: URL, assetsPublicPath = "/build/") { | ||
export function createRequestHandler<Context = unknown>({ | ||
export function createRequestHandler< | ||
Context extends AppLoadContext | undefined = undefined, | ||
>({ | ||
build, | ||
@@ -24,12 +26,11 @@ mode, | ||
}) { | ||
const remixHandler = createRemixRequestHandler(build, mode); | ||
const handleRequest = createRemixRequestHandler(build, mode); | ||
return async (request: Request) => { | ||
try { | ||
const loadContext = getLoadContext | ||
? await getLoadContext(request) | ||
: undefined; | ||
const loadContext = await getLoadContext?.(request); | ||
return await remixHandler(request, loadContext); | ||
} catch (e) { | ||
console.error(e); | ||
return handleRequest(request, loadContext); | ||
} catch (error: unknown) { | ||
console.error(error); | ||
@@ -87,3 +88,5 @@ return new Response("Internal Error", { status: 500 }); | ||
export function createRequestHandlerWithStaticFiles<Context = unknown>({ | ||
export function createRequestHandlerWithStaticFiles< | ||
Context extends AppLoadContext | undefined = undefined, | ||
>({ | ||
build, | ||
@@ -111,3 +114,3 @@ mode, | ||
return await serveStaticFiles(request, staticFiles); | ||
} catch (error) { | ||
} catch (error: unknown) { | ||
if (!(error instanceof FileNotFoundError)) { | ||
@@ -114,0 +117,0 @@ throw error; |
import * as path from "https://deno.land/std@0.128.0/path/mod.ts"; | ||
import type { | ||
SessionData, | ||
SessionIdStorageStrategy, | ||
@@ -28,9 +29,9 @@ SessionStorage, | ||
*/ | ||
export function createFileSessionStorage({ | ||
export function createFileSessionStorage<Data = SessionData, FlashData = Data>({ | ||
cookie, | ||
dir, | ||
}: FileSessionStorageOptions): SessionStorage { | ||
}: FileSessionStorageOptions): SessionStorage<Data, FlashData> { | ||
return createSessionStorage({ | ||
cookie, | ||
async createData(data, expires) { | ||
createData: async (data, expires) => { | ||
const content = JSON.stringify({ data, expires }); | ||
@@ -68,3 +69,3 @@ | ||
}, | ||
async readData(id) { | ||
readData: async (id) => { | ||
try { | ||
@@ -91,3 +92,3 @@ const file = getFile(dir, id); | ||
}, | ||
async updateData(id, data, expires) { | ||
updateData: async (id, data, expires) => { | ||
const content = JSON.stringify({ data, expires }); | ||
@@ -98,3 +99,3 @@ const file = getFile(dir, id); | ||
}, | ||
async deleteData(id) { | ||
deleteData: async (id) => { | ||
try { | ||
@@ -101,0 +102,0 @@ await Deno.remove(getFile(dir, id)); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
30625
11
447
17
0
3
+ Added@remix-run/router@1.19.2(transitive)
+ Added@remix-run/server-runtime@0.0.0-experimental-38ca648a3(transitive)
+ Added@types/cookie@0.6.0(transitive)
+ Addedcookie@0.6.0(transitive)
+ Addedturbo-stream@2.4.0(transitive)
+ Addedtypescript@5.7.2(transitive)
- Removed@remix-run/router@1.21.0(transitive)
- Removed@remix-run/server-runtime@0.0.0-experimental-37286ee6(transitive)
- Removed@types/cookie@0.4.1(transitive)
- Removedcookie@0.4.2(transitive)
- Removedjsesc@3.1.0(transitive)
- Removedreact@19.0.0(transitive)
- Removedreact-dom@19.0.0(transitive)
- Removedreact-router@6.28.1(transitive)
- Removedreact-router-dom@6.28.1(transitive)
- Removedscheduler@0.25.0(transitive)
Updated@remix-run/server-runtime@0.0.0-experimental-38ca648a3