houdini-adapter-cloudflare 1.2.13 → 1.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.cjs CHANGED
@@ -1,18 +1 @@
1
- "use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(o,r)=>{for(var a in r)l(o,a,{get:r[a],enumerable:!0})},d=(o,r,a,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of g(r))!f.call(o,e)&&e!==a&&l(o,e,{get:()=>r[e],enumerable:!(i=m(r,e))||i.enumerable});return o};var y=o=>d(l({},"__esModule",{value:!0}),o);var N={};h(N,{default:()=>w});module.exports=y(N);var t=require("houdini"),p=require("url"),A={},u=async({config:o,conventions:r,publicBase:a,outDir:i,sourceDir:e,manifest:s})=>{await t.fs.recursiveCopy(e,i);let n=await t.fs.readFile(E("./worker.js")),c=`
2
- const graphqlEndpoint = ${JSON.stringify((0,t.localApiEndpoint)(o.configFile))}
3
- const schema = null
4
- const yoga = null
5
- `;s.local_yoga?c=`
6
- import schema from '../src/api/+schema'
7
- import yoga from '../src/api/+yoga'
8
-
9
- const graphqlEndpoint = ${JSON.stringify((0,t.localApiEndpoint)(o.configFile))}
10
- `:s.local_schema&&(c=`
11
- import createYoga from '../$houdini/plugins/houdini-react/units/render/yoga'
12
- import schema from '../src/api/+schema'
13
-
14
- const graphqlEndpoint = ${JSON.stringify((0,t.localApiEndpoint)(o.configFile))}
15
- const yoga = createYoga({
16
- graphqlEndpoint
17
- })
18
- `),n=n.replaceAll('console.log("DYNAMIC_CONTENT")',c),await t.fs.writeFile(t.path.join(i,"_worker.js"),n)},w=u;function E(o){return(0,p.fileURLToPath)(new URL(o,A.url).href)}
1
+ "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var d=(r,e)=>{for(var t in e)p(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of s(e))!w.call(r,i)&&i!==t&&p(r,i,{get:()=>e[i],enumerable:!(a=l(e,i))||a.enumerable});return r};var c=r=>f(p({},"__esModule",{value:!0}),r);var j={};d(j,{default:()=>u});module.exports=c(j);var o=require("houdini"),n=require("url"),k={},m=async({adapterPath:r,outDir:e,sourceDir:t})=>{await o.fs.recursiveCopy(t,e);let a=await o.fs.readFile(h("./worker.js"));a=a.replaceAll("houdini/adapter",r),await o.fs.writeFile(o.path.join(e,"_worker.js"),a)},u=m;function h(r){return(0,n.fileURLToPath)(new URL(r,k.url).href)}
package/build/index.js CHANGED
@@ -1,18 +1 @@
1
- import{fs as e,path as l,localApiEndpoint as a}from"houdini";import{fileURLToPath as s}from"node:url";var p=async({config:o,conventions:g,publicBase:f,outDir:i,sourceDir:c,manifest:n})=>{await e.recursiveCopy(c,i);let r=await e.readFile(m("./worker.js")),t=`
2
- const graphqlEndpoint = ${JSON.stringify(a(o.configFile))}
3
- const schema = null
4
- const yoga = null
5
- `;n.local_yoga?t=`
6
- import schema from '../src/api/+schema'
7
- import yoga from '../src/api/+yoga'
8
-
9
- const graphqlEndpoint = ${JSON.stringify(a(o.configFile))}
10
- `:n.local_schema&&(t=`
11
- import createYoga from '../$houdini/plugins/houdini-react/units/render/yoga'
12
- import schema from '../src/api/+schema'
13
-
14
- const graphqlEndpoint = ${JSON.stringify(a(o.configFile))}
15
- const yoga = createYoga({
16
- graphqlEndpoint
17
- })
18
- `),r=r.replaceAll('console.log("DYNAMIC_CONTENT")',t),await e.writeFile(l.join(i,"_worker.js"),r)},y=p;function m(o){return s(new URL(o,import.meta.url).href)}export{y as default};
1
+ import{fs as t,path as i}from"houdini";import{fileURLToPath as p}from"node:url";var n=async({adapterPath:e,outDir:a,sourceDir:o})=>{await t.recursiveCopy(o,a);let r=await t.readFile(l("./worker.js"));r=r.replaceAll("houdini/adapter",e),await t.writeFile(i.join(a,"_worker.js"),r)},d=n;function l(e){return p(new URL(e,import.meta.url).href)}export{d as default};
package/build/worker.cjs CHANGED
@@ -1,9 +1 @@
1
- "use strict";var C=Object.create;var a=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var N=(e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})},m=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of b(t))!L.call(e,n)&&n!==r&&a(e,n,{get:()=>t[n],enumerable:!(s=T(t,n))||s.enumerable});return e};var p=(e,t,r)=>(r=e!=null?C(H(e)):{},m(t||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e)),P=e=>m(a({},"__esModule",{value:!0}),e);var $={};N($,{default:()=>O});module.exports=P($);var i=require("graphql"),h=require("react-streaming/server"),u=require("../$houdini/plugins/houdini-react/runtime"),_=p(require("../$houdini/plugins/houdini-react/runtime/manifest"),1),g=require("../$houdini/plugins/houdini-react/runtime/routing/lib/match"),w=p(require("../$houdini/plugins/houdini-react/units/render/App"),1),y=require("../$houdini/runtime/cache/cache.js"),o=require("../$houdini/runtime/lib/config"),E=require("../$houdini/runtime/lib/config"),c=require("../$houdini/runtime/router/server"),R=p(require("../src/+client"),1),S=require("react/jsx-runtime");console.log("DYNAMIC_CONTENT");schema&&R.default.registerProxy(graphqlEndpoint,async({query:e,variables:t,session:r})=>{let s=(0,i.parse)(e);return await(0,i.execute)(schema,s,null,r,t)});var f=(0,E.getCurrentConfig)(),x=(0,o.localApiSessionKeys)(f),U={async fetch(e,t,r){let s=new URL(e.url).pathname;if(s.startsWith("/assets/")||s==="/favicon.ico")return await t.ASSETS.fetch(e);let n=await k(e);return n||(yoga&&s===(0,o.localApiEndpoint)(f)?yoga(e,t,r):await v(e))}};async function k(e){let t=new Response,r=!1;if(await(0,c.handle_request)({config:f,session_keys:x,url:new URL(e.url).pathname,redirect:(s,n)=>{let d=t.headers;t=Response.redirect(n,s);for(let[l,A]of Object.entries(d))t.headers.set(l,A)},set_header(s,n){t.headers.set(s,n.toString())},get_header:s=>e.headers.get(s)??void 0,next(){r=!1}}),r)return t}async function v(e){let t=new URL(e.url).pathname,r=await(0,c.get_session)(e.headers,x),[s]=(0,g.find_match)(_.default,t,!0);if(!s)throw new Error("no match");let n=new y.Cache({disabled:!1}),{readable:d,injectToStream:l}=await(0,h.renderToStream)((0,S.jsx)(w.default,{loaded_queries:{},loaded_artifacts:{},initialURL:t,cache:n,session:r,assetPrefix:"/assets",...(0,u.router_cache)()}),{userAgent:"Vite"});return l(`
2
- <script>
3
- window.__houdini__initial__cache__ = ${n.serialize()};
4
- window.__houdini__initial__session__ = ${JSON.stringify(r)};
5
- </script>
6
-
7
- <!-- add a virtual module that hydrates the client and sets up the initial pending cache -->
8
- <script type="module" src="/assets/pages/${s.id}.js" async=""></script>
9
- `),new Response(d)}var O=U;
1
+ "use strict";var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var i=(r,t)=>{for(var e in t)o(r,e,{get:t[e],enumerable:!0})},f=(r,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of p(t))!d.call(r,s)&&s!==e&&o(r,s,{get:()=>t[s],enumerable:!(a=c(t,s))||a.enumerable});return r};var l=r=>f(o({},"__esModule",{value:!0}),r);var w={};i(w,{default:()=>m});module.exports=l(w);var n=require("houdini/adapter"),u=(0,n.createServerAdapter)({production:!0,assetPrefix:"/assets"}),h={async fetch(r,t,e){let a=new URL(r.url).pathname;return a.startsWith("/assets/")||a==="/favicon.ico"?await t.ASSETS.fetch(r):await u(r,t,e)}},m=h;
package/build/worker.js CHANGED
@@ -1,9 +1 @@
1
- import{execute as l,parse as p}from"graphql";import{renderToStream as f}from"react-streaming/server";import{router_cache as m}from"../$houdini/plugins/houdini-react/runtime";import h from"../$houdini/plugins/houdini-react/runtime/manifest";import{find_match as u}from"../$houdini/plugins/houdini-react/runtime/routing/lib/match";import _ from"../$houdini/plugins/houdini-react/units/render/App";import{Cache as g}from"../$houdini/runtime/cache/cache.js";import{localApiEndpoint as w,localApiSessionKeys as y}from"../$houdini/runtime/lib/config";import{getCurrentConfig as E}from"../$houdini/runtime/lib/config";import{handle_request as R,get_session as x}from"../$houdini/runtime/router/server";import S from"../src/+client";import{jsx as b}from"react/jsx-runtime";console.log("DYNAMIC_CONTENT");schema&&S.registerProxy(graphqlEndpoint,async({query:t,variables:r,session:s})=>{let e=p(t);return await l(schema,e,null,s,r)});var o=E(),c=y(o),A={async fetch(t,r,s){let e=new URL(t.url).pathname;if(e.startsWith("/assets/")||e==="/favicon.ico")return await r.ASSETS.fetch(t);let n=await C(t);return n||(yoga&&e===w(o)?yoga(t,r,s):await T(t))}};async function C(t){let r=new Response,s=!1;if(await R({config:o,session_keys:c,url:new URL(t.url).pathname,redirect:(e,n)=>{let a=r.headers;r=Response.redirect(n,e);for(let[i,d]of Object.entries(a))r.headers.set(i,d)},set_header(e,n){r.headers.set(e,n.toString())},get_header:e=>t.headers.get(e)??void 0,next(){s=!1}}),s)return r}async function T(t){let r=new URL(t.url).pathname,s=await x(t.headers,c),[e]=u(h,r,!0);if(!e)throw new Error("no match");let n=new g({disabled:!1}),{readable:a,injectToStream:i}=await f(b(_,{loaded_queries:{},loaded_artifacts:{},initialURL:r,cache:n,session:s,assetPrefix:"/assets",...m()}),{userAgent:"Vite"});return i(`
2
- <script>
3
- window.__houdini__initial__cache__ = ${n.serialize()};
4
- window.__houdini__initial__session__ = ${JSON.stringify(s)};
5
- </script>
6
-
7
- <!-- add a virtual module that hydrates the client and sets up the initial pending cache -->
8
- <script type="module" src="/assets/pages/${e.id}.js" async=""></script>
9
- `),new Response(a)}var D=A;export{D as default};
1
+ import{createServerAdapter as s}from"houdini/adapter";var o=s({production:!0,assetPrefix:"/assets"}),n={async fetch(t,r,a){let e=new URL(t.url).pathname;return e.startsWith("/assets/")||e==="/favicon.ico"?await r.ASSETS.fetch(t):await o(t,r,a)}},p=n;export{p as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-adapter-cloudflare",
3
- "version": "1.2.13",
3
+ "version": "1.2.15",
4
4
  "description": "The adapter for deploying your Houdini application to Cloudflare Pages",
5
5
  "keywords": [
6
6
  "houdini",
@@ -33,7 +33,7 @@
33
33
  "react": "^18.2.0",
34
34
  "react-dom": "^18.2.0",
35
35
  "react-streaming": "^0.3.14",
36
- "houdini": "^1.2.13"
36
+ "houdini": "^1.2.15"
37
37
  },
38
38
  "files": [
39
39
  "build"
@@ -58,7 +58,7 @@
58
58
  }
59
59
  },
60
60
  "scripts": {
61
- "build": "tsup src/index.ts src/worker.tsx --format esm,cjs --external ../\\$houdini --external ../src --external graphql --minify --dts --clean --out-dir build",
61
+ "build": "tsup src/index.ts src/worker.ts --format esm,cjs --external ../\\$houdini --external ../src --external graphql --minify --dts --clean --out-dir build",
62
62
  "build:": "cd ../../ && ((run build && cd -) || (cd - && exit 1))",
63
63
  "build:build": "pnpm build: && pnpm build"
64
64
  }