@shopify/remix-oxygen
Advanced tools
Comparing version 0.0.0-next-d6e612f-20230407114147 to 0.0.0-next-d8c905c-20230606203233
@@ -54,2 +54,3 @@ import { createCookieFactory, createCookieSessionStorageFactory, createSessionStorageFactory, createMemorySessionStorageFactory, createRequestHandler as createRequestHandler$1 } from '@remix-run/server-runtime'; | ||
mode, | ||
poweredByHeader = true, | ||
getLoadContext | ||
@@ -59,6 +60,10 @@ }) { | ||
return async (request) => { | ||
return handleRequest( | ||
const response = await handleRequest( | ||
request, | ||
await getLoadContext?.(request) | ||
); | ||
if (poweredByHeader) { | ||
response.headers.append("powered-by", "Shopify, Hydrogen"); | ||
} | ||
return response; | ||
}; | ||
@@ -65,0 +70,0 @@ } |
@@ -10,5 +10,6 @@ import * as _remix_run_server_runtime from '@remix-run/server-runtime'; | ||
declare function createRequestHandler<Context = unknown>({ build, mode, getLoadContext, }: { | ||
declare function createRequestHandler<Context = unknown>({ build, mode, poweredByHeader, getLoadContext, }: { | ||
build: ServerBuild; | ||
mode?: string; | ||
poweredByHeader?: boolean; | ||
getLoadContext?: (request: Request) => Promise<Context> | Context; | ||
@@ -15,0 +16,0 @@ }): (request: Request) => Promise<Response>; |
import { createCookieFactory, createCookieSessionStorageFactory, createSessionStorageFactory, createMemorySessionStorageFactory, createRequestHandler } from '@remix-run/server-runtime'; | ||
export { MaxPartSizeExceededError, createSession, defer, isCookie, isSession, json, redirect, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData } from '@remix-run/server-runtime'; | ||
var s=new TextEncoder,c=async(e,t)=>{let r=await p(t,["sign"]),o=s.encode(e),n=await crypto.subtle.sign("HMAC",r,o),a=btoa(String.fromCharCode(...new Uint8Array(n))).replace(/=+$/,"");return e+"."+a},u=async(e,t)=>{let r=e.lastIndexOf("."),o=e.slice(0,r),n=e.slice(r+1),a=await p(t,["verify"]),l=s.encode(o),g=y(atob(n));return await crypto.subtle.verify("HMAC",a,g,l)?o:!1};async function p(e,t){return await crypto.subtle.importKey("raw",s.encode(e),{name:"HMAC",hash:"SHA-256"},!1,t)}function y(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}var i=createCookieFactory({sign:c,unsign:u}),f=createCookieSessionStorageFactory(i),d=createSessionStorageFactory(i),H=createMemorySessionStorageFactory(d);function F({build:e,mode:t,getLoadContext:r}){let o=createRequestHandler(e,t);return async n=>o(n,await r?.(n))}function M(e){return e.headers.get("oxygen-buyer-ip")??void 0}function A(e){let t=e.headers;return {requestGroupId:t.get("request-id"),buyerIp:t.get("oxygen-buyer-ip"),cookie:t.get("cookie")}} | ||
var i=new TextEncoder,u=async(e,t)=>{let r=await d(t,["sign"]),o=i.encode(e),a=await crypto.subtle.sign("HMAC",r,o),n=btoa(String.fromCharCode(...new Uint8Array(a))).replace(/=+$/,"");return e+"."+n},p=async(e,t)=>{let r=e.lastIndexOf("."),o=e.slice(0,r),a=e.slice(r+1),n=await d(t,["verify"]),s=i.encode(o),y=g(atob(a));return await crypto.subtle.verify("HMAC",n,y,s)?o:!1};async function d(e,t){return await crypto.subtle.importKey("raw",i.encode(e),{name:"HMAC",hash:"SHA-256"},!1,t)}function g(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}var c=createCookieFactory({sign:u,unsign:p}),f=createCookieSessionStorageFactory(c),l=createSessionStorageFactory(c),H=createMemorySessionStorageFactory(l);function F({build:e,mode:t,poweredByHeader:r=!0,getLoadContext:o}){let a=createRequestHandler(e,t);return async n=>{let s=await a(n,await o?.(n));return r&&s.headers.append("powered-by","Shopify, Hydrogen"),s}}function M(e){return e.headers.get("oxygen-buyer-ip")??void 0}function A(e){let t=e.headers;return {requestGroupId:t.get("request-id"),buyerIp:t.get("oxygen-buyer-ip"),cookie:t.get("cookie")}} | ||
export { i as createCookie, f as createCookieSessionStorage, H as createMemorySessionStorage, F as createRequestHandler, d as createSessionStorage, M as getBuyerIp, A as getStorefrontHeaders }; | ||
export { c as createCookie, f as createCookieSessionStorage, H as createMemorySessionStorage, F as createRequestHandler, l as createSessionStorage, M as getBuyerIp, A as getStorefrontHeaders }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map |
@@ -8,4 +8,4 @@ { | ||
"type": "module", | ||
"version": "0.0.0-next-d6e612f-20230407114147", | ||
"license": "SEE LICENSE IN LICENSE.md", | ||
"version": "0.0.0-next-d8c905c-20230606203233", | ||
"license": "MIT", | ||
"main": "dist/index.cjs", | ||
@@ -12,0 +12,0 @@ "module": "dist/production/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
46465
0
291