@remix-run/cloudflare-pages
Advanced tools
Comparing version 0.0.0-experimental-d8d46263 to 0.0.0-experimental-e0ead3bf
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -13,4 +13,4 @@ * Copyright (c) Remix Software Inc. | ||
export { createCloudflareKVSessionStorage } from './sessions/cloudflareKVSessionStorage.js'; | ||
export { createFetchHandler, createRequestHandler } from './worker.js'; | ||
export { createPagesFunctionHandler, createRequestHandler } from './worker.js'; | ||
installGlobals(); |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -11,3 +11,2 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
import { getType } from 'mime'; | ||
import { createRequestHandler as createRequestHandler$1 } from '@remix-run/server-runtime'; | ||
@@ -27,3 +26,3 @@ | ||
} | ||
function createFetchHandler({ | ||
function createPagesFunctionHandler({ | ||
build, | ||
@@ -40,19 +39,13 @@ getLoadContext, | ||
const handleFetch = async context => { | ||
let response; | ||
let url = new URL(context.request.url); | ||
let response; // https://github.com/cloudflare/wrangler2/issues/117 | ||
context.request.headers.delete("if-none-match"); | ||
try { | ||
response = await context.next(); | ||
response = response.ok ? response : undefined; | ||
} catch {} // This is a known CF bug in the Pages runtime | ||
var _response; | ||
response = await context.env.ASSETS.fetch(context.request.url, context.request.clone()); | ||
response = (_response = response) !== null && _response !== void 0 && _response.ok ? new Response(response.body, response) : undefined; | ||
} catch {} | ||
if (response) { | ||
let contentType = getType(url.pathname); | ||
if (contentType) { | ||
response.headers.set("Content-Type", contentType); | ||
} | ||
} | ||
if (!response) { | ||
@@ -83,2 +76,2 @@ response = await handleRequest(context); | ||
export { createFetchHandler, createRequestHandler }; | ||
export { createPagesFunctionHandler, createRequestHandler }; |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
export { createCloudflareKVSessionStorage } from "./sessions/cloudflareKVSessionStorage"; | ||
export type { CreateFetchHandlerParams } from "./worker"; | ||
export { createFetchHandler, createRequestHandler } from "./worker"; | ||
export type { createPagesFunctionHandlerParams } from "./worker"; | ||
export { createPagesFunctionHandler, createRequestHandler } from "./worker"; |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -22,3 +22,3 @@ * Copyright (c) Remix Software Inc. | ||
exports.createCloudflareKVSessionStorage = cloudflareKVSessionStorage.createCloudflareKVSessionStorage; | ||
exports.createFetchHandler = worker.createFetchHandler; | ||
exports.createPagesFunctionHandler = worker.createPagesFunctionHandler; | ||
exports.createRequestHandler = worker.createRequestHandler; |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
{ | ||
"name": "@remix-run/cloudflare-pages", | ||
"description": "Cloudflare Pages request handler for Remix", | ||
"version": "0.0.0-experimental-d8d46263", | ||
"version": "0.0.0-experimental-e0ead3bf", | ||
"license": "MIT", | ||
@@ -17,4 +17,3 @@ "main": "./index.js", | ||
"dependencies": { | ||
"@remix-run/server-runtime": "0.0.0-experimental-d8d46263", | ||
"mime": "^3.0.0" | ||
"@remix-run/server-runtime": "0.0.0-experimental-e0ead3bf" | ||
}, | ||
@@ -21,0 +20,0 @@ "peerDependencies": { |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/// <reference types="@cloudflare/workers-types" /> | ||
import type { ServerBuild, AppLoadContext } from "@remix-run/server-runtime"; | ||
export interface CreateFetchHandlerParams<Env = any> { | ||
export interface createPagesFunctionHandlerParams<Env = any> { | ||
build: ServerBuild; | ||
@@ -8,3 +8,3 @@ getLoadContext?: (context: EventContext<Env, any, any>) => AppLoadContext; | ||
} | ||
export declare function createRequestHandler<Env = any>({ build, getLoadContext, mode }: CreateFetchHandlerParams<Env>): PagesFunction<Env>; | ||
export declare function createFetchHandler<Env = any>({ build, getLoadContext, mode }: CreateFetchHandlerParams<Env>): (context: EventContext<Env, any, any>) => Promise<Response>; | ||
export declare function createRequestHandler<Env = any>({ build, getLoadContext, mode }: createPagesFunctionHandlerParams<Env>): PagesFunction<Env>; | ||
export declare function createPagesFunctionHandler<Env = any>({ build, getLoadContext, mode }: createPagesFunctionHandlerParams<Env>): (context: EventContext<Env, any, any>) => Promise<Response>; |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-d8d46263 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-e0ead3bf | ||
* | ||
@@ -15,3 +15,2 @@ * Copyright (c) Remix Software Inc. | ||
var mime = require('mime'); | ||
var serverRuntime = require('@remix-run/server-runtime'); | ||
@@ -31,3 +30,3 @@ | ||
} | ||
function createFetchHandler({ | ||
function createPagesFunctionHandler({ | ||
build, | ||
@@ -44,19 +43,13 @@ getLoadContext, | ||
const handleFetch = async context => { | ||
let response; | ||
let url = new URL(context.request.url); | ||
let response; // https://github.com/cloudflare/wrangler2/issues/117 | ||
context.request.headers.delete("if-none-match"); | ||
try { | ||
response = await context.next(); | ||
response = response.ok ? response : undefined; | ||
} catch {} // This is a known CF bug in the Pages runtime | ||
var _response; | ||
response = await context.env.ASSETS.fetch(context.request.url, context.request.clone()); | ||
response = (_response = response) !== null && _response !== void 0 && _response.ok ? new Response(response.body, response) : undefined; | ||
} catch {} | ||
if (response) { | ||
let contentType = mime.getType(url.pathname); | ||
if (contentType) { | ||
response.headers.set("Content-Type", contentType); | ||
} | ||
} | ||
if (!response) { | ||
@@ -87,3 +80,3 @@ response = await handleRequest(context); | ||
exports.createFetchHandler = createFetchHandler; | ||
exports.createPagesFunctionHandler = createPagesFunctionHandler; | ||
exports.createRequestHandler = createRequestHandler; |
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
18105
2
472
+ Added@remix-run/server-runtime@0.0.0-experimental-e0ead3bf(transitive)
- Removedmime@^3.0.0
- Removed@remix-run/server-runtime@0.0.0-experimental-d8d46263(transitive)
- Removedmime@3.0.0(transitive)
Updated@remix-run/server-runtime@0.0.0-experimental-e0ead3bf