-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapt Superflare to work with Wrangler 3 and Remix v2 (vite compiler) #66
base: main
Are you sure you want to change the base?
Conversation
plus remove the @remix-run/dev patch
• reference: https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers • also, update @superflare/remix peerDependencies • remove unused @remix-run/serve dependency • move @remix-run/server-runtime from devDependencies → dependencies • upgrade to latest @cloudflare/workers-types + make it consistent across workspaces
…and refactor it to be an async function, plus add a D1DatabaseAdaptor for exposing a compatible API for a SqlliteDB instance
@@ -88,14 +88,17 @@ export async function getManifest( | |||
return JSON.parse(manifest); | |||
} | |||
|
|||
function getNodeText(node: RenderableTreeNode) { | |||
function getNodeText(renderableNode: RenderableTreeNode) { | |||
if (typeof renderableNode === "string") return renderableNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jplhomer heads up that this line is a change in behavior. in the previous version of this function, if typeof node === "string"
, the function returned an empty string, which i thought might be a bug, but if it is in fact desired, i will just lump this check in with the conditions in the next if
statement (on line 93) so that it also returns an empty string.
…plus take advantage of MetaFunction type’s generics
From the wrangler docs: “Only required if your wrangler.toml does not include a main key” Source: https://developers.cloudflare.com/workers/wrangler/commands/#dev
reproduces the changes suggested in remix-run/remix#9774
• the Env type is now generated by the wrangler types command and written to worker-configuration.d.ts • note however that it doesn’t include CF_PAGES or APP_KEY, which are both used in examples/remix-cms/functions/[[remix]].ts
adds getSessionCookie to AppLoadContext and provides it from load-context.ts
also, bring over code to ensure session has a sessionId from superflare#handleFetch
@jplhomer i believe the last major missing piece for basic functionality was the logic to so instead, i added the an alternative solution that would enable us to avoid requiring custom code in the developer’s the remix-cms example now allows registering and logging in, which is exciting. i need to also update the superflare |
• move @remix-run/cloudflare AppLoadContext definition to index.ts • use AppLoadContext where necessary • use WorkersRequest for accuracy + global Request for @remix-run/cloudflare’s createRequestHandler return value compatibility • restore local ./load-context.ts to expand @remix-run/cloudflare’s AppLoadContext type to include a cloudflare property based on Env interface from ./worker-configuration.d.ts
added new @superflare/remix-dev package to host the superflareDevProxyVitePlugin in such a way that it can be independently imported into users’ vite.config.ts file without then getting included in the built cloudflare workers bundle
the template dependency string will have to be changed from "workspace:*" → "*" once the new package has been published
fixes durable objects in dev: https://developers.cloudflare.com/workers/wrangler/api/#supported-bindings
@jplhomer i got the i also found out that including the is it possible to get another |
@jplhomer thanks for triggering the pkg-pr-new workflow! the build failed because some of the changes in |
@jplhomer one thing i wanted to call out from my previous message: i chose to call the new dev-only package i introduced |
previously available as @superflare/remix-dev, but this is simpler
@jplhomer i decided to try implementing a separate entry point in the |
This PR:
migrate
command’s--db
option is now the name of the DB binding, not a path to the actual local DB filedev
command now runsremix vite:dev
for the main server +wrangler dev
in parallel to enable Durable Objectsbetter-sqlite3
in favor ofwrangler
’sgetPlatformProxy
API./d1js/*
vendored files@superflare/remix
plugin, available at@superflare/remix/dev
, which providessuperflareDevProxyVitePlugin
, a drop-in replacement for remix’scloudflareDevProxyVitePlugin
that supports superflare and its automatic session handling and auth featurespnpm
implements #62