Skip to content

Commit

Permalink
fix(deps): remove http import of fresh
Browse files Browse the repository at this point in the history
  • Loading branch information
vicary committed Oct 8, 2024
1 parent b763bca commit d25ede8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@vicary/fresh-graphql",
"version": "0.2.10-alpha.0",
"exports": "./mod.ts",
"license": "MIT",
"publish": {
"exclude": [
".github/**",
Expand Down
1 change: 0 additions & 1 deletion deps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export type { FreshContext } from "https://deno.land/x/[email protected]/server.ts";
export { assert } from "jsr:@std/assert@^0.219.1/assert";
export * as colors from "jsr:@std/fmt@^0.219.1/colors";
export { ensureDir } from "jsr:@std/fs@^0.219.1/ensure_dir";
Expand Down
18 changes: 16 additions & 2 deletions server.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import { createYoga, type FreshContext } from "./deps.ts";
import { createYoga } from "./deps.ts";
import type { Manifest } from "./schema.ts";
import { fromManifest } from "./schema.ts";

export type CreateHandlerOptions = {
debug?: boolean;
};

/**
* A stubbed version of FreshContext.
*
* Fresh 1.x uses HTTP import which is not compatible with JSR modules, to be
* updated when Fresh 2.x is released.
*
* ```ts
* import type { FreshContext } from "jsr:@fresh/core@^2.0";
* ```
*/
export type FreshContext = {
request: Request;
};

export function createHandler<TManifest extends Manifest>(
manifest: TManifest,
options?: CreateHandlerOptions,
) {
): (req: Request, ctx: FreshContext) => Promise<Response> {
// FRSH_GQL_DEV is set when you start the GraphQL development server in dev.ts.
const debug = options?.debug ?? Deno.env.has("FRSH_GQL_DEV");

Expand Down

0 comments on commit d25ede8

Please sign in to comment.