@remix-run/cloudflare-pages
Advanced tools
Comparing version 0.0.0-experimental-56ff64d1 to 0.0.0-experimental-5d79f855
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -11,2 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
import { getType } from 'mime'; | ||
import { createRequestHandler as createRequestHandler$1 } from '@remix-run/server-runtime'; | ||
@@ -26,9 +27,2 @@ | ||
} | ||
async function handleAsset(request, env) { | ||
let envWithAssets = env; | ||
const response = await envWithAssets.ASSETS.fetch(request); | ||
if (response.ok) return response; | ||
} | ||
function createFetchHandler({ | ||
@@ -48,5 +42,17 @@ build, | ||
let url = new URL(context.request.url); | ||
response = // TODO: Remove this once a fix has been meged to wranger@v2 | ||
process.env.NODE_ENV === "development" && url.pathname === "/" ? undefined : await handleAsset(context.request.clone(), context.env); | ||
try { | ||
response = await context.next(); | ||
response = response.ok ? response : undefined; | ||
} catch {} // This is a known CF bug in the Pages runtime | ||
if (response) { | ||
let contentType = getType(url.pathname); | ||
if (contentType) { | ||
response.headers.set("Content-Type", contentType); | ||
} | ||
} | ||
if (!response) { | ||
@@ -53,0 +59,0 @@ response = await handleRequest(context); |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -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-56ff64d1", | ||
"version": "0.0.0-experimental-5d79f855", | ||
"license": "MIT", | ||
@@ -17,3 +17,4 @@ "main": "./index.js", | ||
"dependencies": { | ||
"@remix-run/server-runtime": "0.0.0-experimental-56ff64d1" | ||
"@remix-run/server-runtime": "0.0.0-experimental-5d79f855", | ||
"mime": "^3.0.0" | ||
}, | ||
@@ -24,4 +25,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^3.2.0" | ||
"@cloudflare/workers-types": "^3.2.0", | ||
"@types/mime": "^2.0.3" | ||
} | ||
} |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-56ff64d1 | ||
* @remix-run/cloudflare-pages v0.0.0-experimental-5d79f855 | ||
* | ||
@@ -15,2 +15,3 @@ * Copyright (c) Remix Software Inc. | ||
var mime = require('mime'); | ||
var serverRuntime = require('@remix-run/server-runtime'); | ||
@@ -30,9 +31,2 @@ | ||
} | ||
async function handleAsset(request, env) { | ||
let envWithAssets = env; | ||
const response = await envWithAssets.ASSETS.fetch(request); | ||
if (response.ok) return response; | ||
} | ||
function createFetchHandler({ | ||
@@ -52,5 +46,17 @@ build, | ||
let url = new URL(context.request.url); | ||
response = // TODO: Remove this once a fix has been meged to wranger@v2 | ||
process.env.NODE_ENV === "development" && url.pathname === "/" ? undefined : await handleAsset(context.request.clone(), context.env); | ||
try { | ||
response = await context.next(); | ||
response = response.ok ? response : undefined; | ||
} catch {} // This is a known CF bug in the Pages runtime | ||
if (response) { | ||
let contentType = mime.getType(url.pathname); | ||
if (contentType) { | ||
response.headers.set("Content-Type", contentType); | ||
} | ||
} | ||
if (!response) { | ||
@@ -57,0 +63,0 @@ response = await handleRequest(context); |
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
18048
484
2
3
2
+ Addedmime@^3.0.0
+ Added@remix-run/server-runtime@0.0.0-experimental-5d79f855(transitive)
+ Addedmime@3.0.0(transitive)
- Removed@remix-run/server-runtime@0.0.0-experimental-56ff64d1(transitive)
Updated@remix-run/server-runtime@0.0.0-experimental-5d79f855