@alignable/bifrost-fastify 0.0.10 → 0.0.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/dist/index.js +1 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import proxy from "@fastify/http-proxy";
|
|
3
3
|
import accepts from "@fastify/accepts";
|
|
4
4
|
import forwarded from "@fastify/forwarded";
|
|
5
|
-
import jsdom from "jsdom";
|
|
6
5
|
import { renderPage } from "vite-plugin-ssr/server";
|
|
7
6
|
function streamToString(stream) {
|
|
8
7
|
const chunks = [];
|
|
@@ -76,7 +75,6 @@ var viteProxyPlugin = async (fastify, { upstream, host, rewriteRequestHeaders, g
|
|
|
76
75
|
reply.status(200).type("application/json").send(
|
|
77
76
|
JSON.stringify({
|
|
78
77
|
pageContext: {
|
|
79
|
-
// A bit hacky, but we manually construct the VPS pageContext here
|
|
80
78
|
_pageId: proxyPageId,
|
|
81
79
|
redirectTo: url
|
|
82
80
|
}
|
|
@@ -91,25 +89,7 @@ var viteProxyPlugin = async (fastify, { upstream, host, rewriteRequestHeaders, g
|
|
|
91
89
|
if (!layout) {
|
|
92
90
|
return reply.send(res);
|
|
93
91
|
}
|
|
94
|
-
const
|
|
95
|
-
const dom = new jsdom.JSDOM(html);
|
|
96
|
-
const doc = dom.window.document;
|
|
97
|
-
const bodyEl = doc.querySelector("body");
|
|
98
|
-
const head = doc.querySelector("head");
|
|
99
|
-
if (!bodyEl || !head) {
|
|
100
|
-
return reply.code(404).type("text/html").send("proxy failed");
|
|
101
|
-
}
|
|
102
|
-
bodyEl.querySelectorAll("a[rel='external']").forEach((e) => e.setAttribute("data-turbolinks", "false"));
|
|
103
|
-
bodyEl.querySelectorAll("a").forEach((e) => e.rel = "external");
|
|
104
|
-
const bodyAttrs = {};
|
|
105
|
-
bodyEl.getAttributeNames().forEach((name) => {
|
|
106
|
-
bodyAttrs[name] = bodyEl.getAttribute(name);
|
|
107
|
-
});
|
|
108
|
-
const proxy2 = {
|
|
109
|
-
body: bodyEl.innerHTML,
|
|
110
|
-
head: head.innerHTML,
|
|
111
|
-
bodyAttrs
|
|
112
|
-
};
|
|
92
|
+
const proxy2 = await streamToString(res);
|
|
113
93
|
const pageContextInit = {
|
|
114
94
|
urlOriginal: req.url,
|
|
115
95
|
layout,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["// Note that this file isn't processed by Vite, see https://github.com/brillout/vite-plugin-ssr/issues/562\nimport { FastifyReply, RawServerBase, FastifyPluginAsync } from \"fastify\";\nimport { FastifyRequest, RequestGenericInterface } from \"fastify/types/request\";\nimport proxy from \"@fastify/http-proxy\";\nimport accepts from \"@fastify/accepts\";\nimport { type PageContextProxy, type Proxy } from \"../bifrost/types/internal.js\";\nimport forwarded from \"@fastify/forwarded\";\nimport { Writable } from \"stream\";\nimport jsdom from \"jsdom\";\nimport { IncomingHttpHeaders, IncomingMessage } from \"http\";\nimport {\n Http2ServerRequest,\n IncomingHttpHeaders as Http2IncomingHttpHeaders,\n} from \"http2\";\nimport { renderPage } from \"vite-plugin-ssr/server\";\n\ntype RequestExtendedWithProxy = FastifyRequest<\n RequestGenericInterface,\n RawServerBase\n> & { _proxy?: { isPageContext: boolean; originalUrl?: string } };\n\nfunction streamToString(stream: Writable): Promise<string> {\n const chunks: Buffer[] = [];\n return new Promise((resolve, reject) => {\n stream.on(\"data\", (chunk) => chunks.push(Buffer.from(chunk)));\n stream.on(\"error\", (err) => reject(err));\n stream.on(\"end\", () => resolve(Buffer.concat(chunks).toString(\"utf8\")));\n });\n}\n\nasync function replyWithPage(\n reply: FastifyReply<RawServerBase>,\n pageContext: Awaited<ReturnType<typeof renderPage>>\n): Promise<FastifyReply> {\n const { httpResponse } = pageContext;\n\n if (!httpResponse) {\n return reply.code(404).type(\"text/html\").send(\"Not Found\");\n }\n\n const { body, statusCode, contentType } = httpResponse;\n\n return reply.status(statusCode).type(contentType).send(body);\n}\n\nconst proxyPageId = \"/proxy/pages\";\n\ninterface ViteProxyPluginOptions {\n upstream: URL;\n host: URL;\n getLayout: (reply: FastifyReply<RawServerBase>) => {\n layout: string;\n layoutProps: any;\n };\n /// Use to signal to legacy backend to return special results (eg. remove navbar etc)\n rewriteRequestHeaders?: (\n req: Http2ServerRequest | IncomingMessage,\n headers: Http2IncomingHttpHeaders | IncomingHttpHeaders\n ) => Http2IncomingHttpHeaders | IncomingHttpHeaders;\n}\n/**\n * Fastify plugin that wraps @fasitfy/http-proxy to proxy Rails/Turbolinks server into a Vite-Plugin-SSR site.\n */\nexport const viteProxyPlugin: FastifyPluginAsync<\n ViteProxyPluginOptions\n> = async (fastify, { upstream, host, rewriteRequestHeaders, getLayout }) => {\n await fastify.register(accepts);\n await fastify.register(proxy, {\n upstream: upstream.href,\n async preHandler(req, reply) {\n if (req.method === \"GET\" && req.accepts().type([\"html\"]) === \"html\") {\n const pageContextInit = {\n urlOriginal: req.url,\n };\n\n const pageContext = await renderPage<\n { _pageId: string },\n typeof pageContextInit\n >(pageContextInit);\n\n const proxy = pageContext._pageId === proxyPageId;\n\n if (!proxy) {\n return replyWithPage(reply, pageContext);\n } else {\n // pageContext.json is added on client navigations to indicate we are returning just json for the client router\n // we have to remove it before proxying though.\n (req as RequestExtendedWithProxy)._proxy = {\n isPageContext: req.raw.url!.includes(\"/index.pageContext.json\"),\n originalUrl: req.raw.url,\n };\n req.raw.url = req.raw.url!.replace(\"/index.pageContext.json\", \"\");\n }\n }\n },\n replyOptions: {\n rewriteRequestHeaders(request, headers) {\n // Delete cache headers\n delete headers[\"if-modified-since\"];\n delete headers[\"if-none-match\"];\n delete headers[\"if-unmodified-since\"];\n delete headers[\"if-none-match\"];\n delete headers[\"if-range\"];\n\n const fwd = forwarded(request as IncomingMessage).reverse();\n // fwd.push(request.ip); TODO: not sure if this is needed\n headers[\"X-Forwarded-For\"] = fwd.join(\", \");\n headers[\"X-Forwarded-Host\"] = host.host;\n headers[\"X-Forwarded-Protocol\"] = host.protocol;\n if (rewriteRequestHeaders) {\n return rewriteRequestHeaders(request, headers);\n }\n return headers;\n },\n async onResponse(req, reply: FastifyReply<RawServerBase>, res) {\n const { isPageContext = false, originalUrl = undefined } =\n (req as RequestExtendedWithProxy)._proxy || {};\n if (isPageContext && originalUrl) {\n // restore url rewrite\n req.raw.url = originalUrl;\n }\n\n if ([301, 302, 303, 307, 308].includes(reply.statusCode)) {\n const location = reply.getHeader(\"location\") as string;\n if (location) {\n const url = new URL(location);\n if (url.host === upstream.host) {\n // rewrite redirect on upstream's host to the proxy host\n url.host = host.host;\n }\n reply.header(\"location\", url);\n if (isPageContext) {\n reply\n .status(200)\n .type(\"application/json\")\n .send(\n JSON.stringify({\n pageContext: {\n // A bit hacky, but we manually construct the VPS pageContext here\n _pageId: proxyPageId,\n redirectTo: url,\n },\n })\n );\n } else {\n return reply.send(res);\n }\n }\n }\n\n const { layout, layoutProps } = getLayout(reply);\n if (!layout) {\n return reply.send(res);\n }\n\n const html = await streamToString(res);\n const dom = new jsdom.JSDOM(html);\n const doc = dom.window.document;\n const bodyEl = doc.querySelector(\"body\");\n const head = doc.querySelector(\"head\");\n\n if (!bodyEl || !head) {\n return reply.code(404).type(\"text/html\").send(\"proxy failed\");\n }\n\n // disable vite-plugin-ssr link interceptor. May not be neccessary in future:\n // https://github.com/brillout/vite-plugin-ssr/discussions/728#discussioncomment-5634111\n bodyEl\n .querySelectorAll(\"a[rel='external']\")\n .forEach((e) => e.setAttribute(\"data-turbolinks\", \"false\"));\n bodyEl.querySelectorAll(\"a\").forEach((e) => (e.rel = \"external\"));\n\n const bodyAttrs: Record<string, string> = {};\n bodyEl.getAttributeNames().forEach((name) => {\n bodyAttrs[name] = bodyEl.getAttribute(name)!;\n });\n\n const proxy: Proxy = {\n body: bodyEl.innerHTML,\n head: head.innerHTML,\n bodyAttrs,\n };\n\n const pageContextInit: Partial<PageContextProxy> = {\n urlOriginal: req.url,\n layout,\n layoutProps,\n };\n // proxySendClient is serialized and sent to client on subsequent navigation. proxy is ONLY included server-side to avoid doubling page size\n if (isPageContext) { //TODO: send whole string instead of parsing and let browser do the parsing (turbolinks bridge lib)\n Object.assign(pageContextInit, { proxySendClient: proxy });\n } else {\n Object.assign(pageContextInit, { proxy });\n }\n const pageContext = await renderPage(pageContextInit);\n return replyWithPage(reply, pageContext);\n },\n },\n });\n};\n"],"mappings":";AAGA,OAAO,WAAW;AAClB,OAAO,aAAa;AAEpB,OAAO,eAAe;AAEtB,OAAO,WAAW;AAMlB,SAAS,kBAAkB;AAO3B,SAAS,eAAe,QAAmC;AACzD,QAAM,SAAmB,CAAC;AAC1B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,WAAO,GAAG,QAAQ,CAAC,UAAU,OAAO,KAAK,OAAO,KAAK,KAAK,CAAC,CAAC;AAC5D,WAAO,GAAG,SAAS,CAAC,QAAQ,OAAO,GAAG,CAAC;AACvC,WAAO,GAAG,OAAO,MAAM,QAAQ,OAAO,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC;AAAA,EACxE,CAAC;AACH;AAEA,eAAe,cACb,OACA,aACuB;AACvB,QAAM,EAAE,aAAa,IAAI;AAEzB,MAAI,CAAC,cAAc;AACjB,WAAO,MAAM,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW;AAAA,EAC3D;AAEA,QAAM,EAAE,MAAM,YAAY,YAAY,IAAI;AAE1C,SAAO,MAAM,OAAO,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,IAAI;AAC7D;AAEA,IAAM,cAAc;AAkBb,IAAM,kBAET,OAAO,SAAS,EAAE,UAAU,MAAM,uBAAuB,UAAU,MAAM;AAC3E,QAAM,QAAQ,SAAS,OAAO;AAC9B,QAAM,QAAQ,SAAS,OAAO;AAAA,IAC5B,UAAU,SAAS;AAAA,IACnB,MAAM,WAAW,KAA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A,UACX;AAAA,QACF;AAEA,cAAM,kBAA6C;AAAA,UACjD,aAAa,IAAI;AAAA,UACjB;AAAA,UACA;AAAA,QACF;AAEA,YAAI,eAAe;AACjB,iBAAO,OAAO,iBAAiB,EAAE,iBAAiBA,OAAM,CAAC;AAAA,QAC3D,OAAO;AACL,iBAAO,OAAO,iBAAiB,EAAE,OAAAA,OAAM,CAAC;AAAA,QAC1C;AACA,cAAM,cAAc,MAAM,WAAW,eAAe;AACpD,eAAO,cAAc,OAAO,WAAW;AAAA,MACzC;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":["proxy"]}
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["// Note that this file isn't processed by Vite, see https://github.com/brillout/vite-plugin-ssr/issues/562\nimport { FastifyReply, RawServerBase, FastifyPluginAsync } from \"fastify\";\nimport { FastifyRequest, RequestGenericInterface } from \"fastify/types/request\";\nimport proxy from \"@fastify/http-proxy\";\nimport accepts from \"@fastify/accepts\";\nimport { type PageContextProxy } from \"../bifrost/types/internal.js\";\nimport forwarded from \"@fastify/forwarded\";\nimport { Writable } from \"stream\";\nimport { IncomingHttpHeaders, IncomingMessage } from \"http\";\nimport {\n Http2ServerRequest,\n IncomingHttpHeaders as Http2IncomingHttpHeaders,\n} from \"http2\";\nimport { renderPage } from \"vite-plugin-ssr/server\";\n\ntype RequestExtendedWithProxy = FastifyRequest<\n RequestGenericInterface,\n RawServerBase\n> & { _proxy?: { isPageContext: boolean; originalUrl?: string } };\n\nfunction streamToString(stream: Writable): Promise<string> {\n const chunks: Buffer[] = [];\n return new Promise((resolve, reject) => {\n stream.on(\"data\", (chunk) => chunks.push(Buffer.from(chunk)));\n stream.on(\"error\", (err) => reject(err));\n stream.on(\"end\", () => resolve(Buffer.concat(chunks).toString(\"utf8\")));\n });\n}\n\nasync function replyWithPage(\n reply: FastifyReply<RawServerBase>,\n pageContext: Awaited<ReturnType<typeof renderPage>>\n): Promise<FastifyReply> {\n const { httpResponse } = pageContext;\n\n if (!httpResponse) {\n return reply.code(404).type(\"text/html\").send(\"Not Found\");\n }\n\n const { body, statusCode, contentType } = httpResponse;\n\n return reply.status(statusCode).type(contentType).send(body);\n}\n\nconst proxyPageId = \"/proxy/pages\";\n\ninterface ViteProxyPluginOptions {\n upstream: URL;\n host: URL;\n getLayout: (reply: FastifyReply<RawServerBase>) => {\n layout: string;\n layoutProps: any;\n };\n /// Use to signal to legacy backend to return special results (eg. remove navbar etc)\n rewriteRequestHeaders?: (\n req: Http2ServerRequest | IncomingMessage,\n headers: Http2IncomingHttpHeaders | IncomingHttpHeaders\n ) => Http2IncomingHttpHeaders | IncomingHttpHeaders;\n}\n/**\n * Fastify plugin that wraps @fasitfy/http-proxy to proxy Rails/Turbolinks server into a Vite-Plugin-SSR site.\n */\nexport const viteProxyPlugin: FastifyPluginAsync<\n ViteProxyPluginOptions\n> = async (fastify, { upstream, host, rewriteRequestHeaders, getLayout }) => {\n await fastify.register(accepts);\n await fastify.register(proxy, {\n upstream: upstream.href,\n async preHandler(req, reply) {\n if (req.method === \"GET\" && req.accepts().type([\"html\"]) === \"html\") {\n const pageContextInit = {\n urlOriginal: req.url,\n };\n\n const pageContext = await renderPage<\n { _pageId: string },\n typeof pageContextInit\n >(pageContextInit);\n\n const proxy = pageContext._pageId === proxyPageId;\n\n if (!proxy) {\n return replyWithPage(reply, pageContext);\n } else {\n // pageContext.json is added on client navigations to indicate we are returning just json for the client router\n // we have to remove it before proxying though.\n (req as RequestExtendedWithProxy)._proxy = {\n isPageContext: req.raw.url!.includes(\"/index.pageContext.json\"),\n originalUrl: req.raw.url,\n };\n req.raw.url = req.raw.url!.replace(\"/index.pageContext.json\", \"\");\n }\n }\n },\n replyOptions: {\n rewriteRequestHeaders(request, headers) {\n // Delete cache headers\n delete headers[\"if-modified-since\"];\n delete headers[\"if-none-match\"];\n delete headers[\"if-unmodified-since\"];\n delete headers[\"if-none-match\"];\n delete headers[\"if-range\"];\n\n const fwd = forwarded(request as IncomingMessage).reverse();\n // fwd.push(request.ip); TODO: not sure if this is needed\n headers[\"X-Forwarded-For\"] = fwd.join(\", \");\n headers[\"X-Forwarded-Host\"] = host.host;\n headers[\"X-Forwarded-Protocol\"] = host.protocol;\n if (rewriteRequestHeaders) {\n return rewriteRequestHeaders(request, headers);\n }\n return headers;\n },\n async onResponse(req, reply: FastifyReply<RawServerBase>, res) {\n const { isPageContext = false, originalUrl = undefined } =\n (req as RequestExtendedWithProxy)._proxy || {};\n if (isPageContext && originalUrl) {\n // restore url rewrite\n req.raw.url = originalUrl;\n }\n\n if ([301, 302, 303, 307, 308].includes(reply.statusCode)) {\n const location = reply.getHeader(\"location\") as string;\n if (location) {\n const url = new URL(location);\n if (url.host === upstream.host) {\n // rewrite redirect on upstream's host to the proxy host\n url.host = host.host;\n }\n reply.header(\"location\", url);\n if (isPageContext) {\n reply\n .status(200)\n .type(\"application/json\")\n .send(\n JSON.stringify({\n pageContext: {\n _pageId: proxyPageId,\n redirectTo: url,\n },\n })\n );\n } else {\n return reply.send(res);\n }\n }\n }\n\n const { layout, layoutProps } = getLayout(reply);\n if (!layout) {\n return reply.send(res);\n }\n\n const proxy = await streamToString(res);\n\n const pageContextInit: Partial<PageContextProxy> = {\n urlOriginal: req.url,\n layout,\n layoutProps,\n };\n if (isPageContext) {\n // proxySendClient is serialized and sent to client on subsequent navigation.\n Object.assign(pageContextInit, { proxySendClient: proxy });\n } else {\n // proxy is ONLY included server-side to avoid doubling page size\n Object.assign(pageContextInit, { proxy });\n }\n const pageContext = await renderPage(pageContextInit);\n return replyWithPage(reply, pageContext);\n },\n },\n });\n};\n"],"mappings":";AAGA,OAAO,WAAW;AAClB,OAAO,aAAa;AAEpB,OAAO,eAAe;AAOtB,SAAS,kBAAkB;AAO3B,SAAS,eAAe,QAAmC;AACzD,QAAM,SAAmB,CAAC;AAC1B,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,WAAO,GAAG,QAAQ,CAAC,UAAU,OAAO,KAAK,OAAO,K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QACvB;AAEA,cAAMA,SAAQ,MAAM,eAAe,GAAG;AAEtC,cAAM,kBAA6C;AAAA,UACjD,aAAa,IAAI;AAAA,UACjB;AAAA,UACA;AAAA,QACF;AACA,YAAI,eAAe;AAEjB,iBAAO,OAAO,iBAAiB,EAAE,iBAAiBA,OAAM,CAAC;AAAA,QAC3D,OAAO;AAEL,iBAAO,OAAO,iBAAiB,EAAE,OAAAA,OAAM,CAAC;AAAA,QAC1C;AACA,cAAM,cAAc,MAAM,WAAW,eAAe;AACpD,eAAO,cAAc,OAAO,WAAW;AAAA,MACzC;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":["proxy"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alignable/bifrost-fastify",
|
|
3
3
|
"repository": "https://github.com/Alignable/bifrost.git",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -13,14 +13,13 @@
|
|
|
13
13
|
"compression": "^1.7.4",
|
|
14
14
|
"cross-env": "^7.0.3",
|
|
15
15
|
"fastify": "^4.9.2",
|
|
16
|
-
"jsdom": "^21.1.1",
|
|
17
16
|
"sirv": "^2.0.2",
|
|
18
17
|
"ts-node": "^10.9.1",
|
|
19
18
|
"vite": "^4.0.3"
|
|
20
19
|
},
|
|
21
20
|
"peerDependencies": {
|
|
22
21
|
"fastify": "^4.9.2",
|
|
23
|
-
"vite-plugin-ssr": "
|
|
22
|
+
"vite-plugin-ssr": "0.4.131-commit-35ca471f7"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"@types/connect": "^3.4.35",
|