sailfork / t3code-github / .repos/ alchemy-effect/ packages/ frontend-frameworks/ fixtures/ nextjs/ e2e.config.ts

import { KvNamespace, Text } from "@alchemy.run/cloudflare-runtime/core/bindings";
import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options";
import { make } from "@alchemy.run/frontend-frameworks/nextjs";
import { kCurrentWorker } from "miniflare";

export default Options.make({
  // Exercise explicit OpenNext configuration for direct framework consumers.
  framework: (options) => make({ ...options, nextjs: { configPath: "open-next.config.ts" } }),
  vite: {
    compatibilityDate: "2026-05-12",
    compatibilityFlags: ["nodejs_compat", "global_fetch_strictly_public"],
    worker: {
      name: "fixtures-nextjs",
      bindings: [
        Text.local("TEST_TEXT", "hello-from-binding"),
        KvNamespace.local({ binding: "FIXTURE_KV" }),
      ],
    },
  },
  miniflare: {
    name: "fixtures-nextjs",
    compatibilityDate: "2026-05-12",
    compatibilityFlags: ["nodejs_compat", "global_fetch_strictly_public"],
    bindings: { TEST_TEXT: "hello-from-binding" },
    kvNamespaces: ["FIXTURE_KV"],
    serviceBindings: { WORKER_SELF_REFERENCE: kCurrentWorker },
    durableObjects: {
      NEXT_CACHE_DO_QUEUE: { className: "DOQueueHandler", useSQLite: true },
    },
    assets: {
      binding: "ASSETS",
      routerConfig: {
        has_user_worker: true,
        invoke_user_worker_ahead_of_assets: true,
      },
      assetConfig: {
        html_handling: "none",
        not_found_handling: "none",
      },
    },
  },
});