houdini-adapter-cloudflare 1.2.10 → 1.2.12
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 +18 -1
- package/build/index.js +18 -1
- package/build/worker.cjs +4 -4
- package/build/worker.js +5 -5
- package/package.json +4 -3
package/build/index.cjs
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
"use strict";var
|
|
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)}
|
package/build/index.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
import{fs as e,path as
|
|
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};
|
package/build/worker.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var
|
|
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
2
|
<script>
|
|
3
|
-
window.__houdini__initial__cache__ = ${
|
|
3
|
+
window.__houdini__initial__cache__ = ${n.serialize()};
|
|
4
4
|
window.__houdini__initial__session__ = ${JSON.stringify(r)};
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<!-- add a virtual module that hydrates the client and sets up the initial pending cache -->
|
|
8
|
-
<script type="module" src="/assets/pages/${
|
|
9
|
-
`),new Response(
|
|
8
|
+
<script type="module" src="/assets/pages/${s.id}.js" async=""></script>
|
|
9
|
+
`),new Response(d)}var O=U;
|
package/build/worker.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{parse as
|
|
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
2
|
<script>
|
|
3
|
-
window.__houdini__initial__cache__ = ${
|
|
4
|
-
window.__houdini__initial__session__ = ${JSON.stringify(
|
|
3
|
+
window.__houdini__initial__cache__ = ${n.serialize()};
|
|
4
|
+
window.__houdini__initial__session__ = ${JSON.stringify(s)};
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<!-- add a virtual module that hydrates the client and sets up the initial pending cache -->
|
|
8
|
-
<script type="module" src="/assets/pages/${
|
|
9
|
-
`),new Response(
|
|
8
|
+
<script type="module" src="/assets/pages/${e.id}.js" async=""></script>
|
|
9
|
+
`),new Response(a)}var D=A;export{D as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-adapter-cloudflare",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.12",
|
|
4
4
|
"description": "The adapter for deploying your Houdini application to Cloudflare Pages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"houdini",
|
|
@@ -28,11 +28,12 @@
|
|
|
28
28
|
"@types/react": "^18.2.21",
|
|
29
29
|
"@types/react-dom": "^18.0.10",
|
|
30
30
|
"cookie": "^0.5.0",
|
|
31
|
+
"graphql-yoga": "^4.0.4",
|
|
31
32
|
"itty-router": "^4.0.23",
|
|
32
33
|
"react": "^18.2.0",
|
|
33
34
|
"react-dom": "^18.2.0",
|
|
34
35
|
"react-streaming": "^0.3.14",
|
|
35
|
-
"houdini": "^1.2.
|
|
36
|
+
"houdini": "^1.2.12"
|
|
36
37
|
},
|
|
37
38
|
"files": [
|
|
38
39
|
"build"
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
60
|
"scripts": {
|
|
60
|
-
"build": "tsup src/index.ts src/worker.tsx --format esm,cjs --external ../\\$houdini --external
|
|
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
62
|
"build:": "cd ../../ && ((run build && cd -) || (cd - && exit 1))",
|
|
62
63
|
"build:build": "pnpm build: && pnpm build"
|
|
63
64
|
}
|