Skip to content

Commit

Permalink
Separate @superflare/remix/dev completely from @superflare/remix
Browse files Browse the repository at this point in the history
removing the ;./index' import from superflare-remix/dev.ts makes it so that there is no possible issue with using static `import {…} from 'superflare'` in superflare-remix/index.ts, because that file won’t be executed outside of the vite bundle/execution context
  • Loading branch information
acusti committed Nov 1, 2024
1 parent 65f75d6 commit b4b0bd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/superflare-remix/dev.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Request } from "@cloudflare/workers-types";
import { cloudflareDevProxyVitePlugin } from "@remix-run/dev";
import { type Cloudflare, getLoadContext } from "./index";
import { type Cloudflare, getLoadContext } from "./load-context";
import { type Plugin, type ViteDevServer } from "vite";
import { type GetPlatformProxyOptions } from "wrangler";

Expand Down
12 changes: 6 additions & 6 deletions packages/superflare-remix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import {
type Request as WorkersRequest,
} from "@cloudflare/workers-types";
import { type AppLoadContext } from "@remix-run/cloudflare";
import type {
DefineConfigReturn,
import {
type DefineConfigReturn,
handleFetch as superflareHandleFetch,
SuperflareAuth,
SuperflareSession,
} from "superflare";
Expand Down Expand Up @@ -35,7 +36,6 @@ export async function handleFetch<Env extends { APP_KEY: string }>(
loadContext: AppLoadContext
) => Promise<Response>
) {
const superflare = await import("superflare");
const loadContext = await getLoadContext<Env>({
request,
context: {
Expand All @@ -45,11 +45,11 @@ export async function handleFetch<Env extends { APP_KEY: string }>(
// https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy
cloudflare: { caches, ctx, env, cf: request.cf },
},
SuperflareAuth: superflare.SuperflareAuth,
SuperflareSession: superflare.SuperflareSession,
SuperflareAuth,
SuperflareSession,
});

return await superflare.handleFetch<Env>(
return await superflareHandleFetch<Env>(
{
request,
env,
Expand Down

0 comments on commit b4b0bd3

Please sign in to comment.