Skip to content

Commit

Permalink
Update Deno Dependencies (#35)
Browse files Browse the repository at this point in the history
* chore(deps): update deno dependencies

* Update README.md

* Update README.md

---------

Co-authored-by: GitHub <[email protected]>
Co-authored-by: ayame113 <[email protected]>
  • Loading branch information
3 people authored Mar 6, 2023
1 parent a20c91c commit b929b42
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TypeScript + ES Modules
Transpile TypeScript on the fly and serve it from your server as ES Modules.

```ts
import { serve } from "https://deno.land/std@0.177.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.178.0/http/mod.ts";
import { serveDirWithTs } from "https://deno.land/x/ts_serve@$MODULE_VERSION/mod.ts";

serve((request) => serveDirWithTs(request));
Expand All @@ -34,7 +34,7 @@ console.log(1);
As oak middleware:

```ts
import { Application } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { Application } from "https://deno.land/x/oak@v12.0.1/mod.ts";
import { tsMiddleware } from "https://deno.land/x/ts_serve@$MODULE_VERSION/mod.ts";

const app = new Application();
Expand All @@ -54,22 +54,22 @@ await app.listen({ port: 8000 });
```

As a replacement for the
[serveDir](https://doc.deno.land/https://deno.land/std@0.177.0/http/file_server.ts/~/serveDir)
[serveDir](https://doc.deno.land/https://deno.land/std@0.178.0/http/file_server.ts/~/serveDir)
function in the Deno standard library:

```ts
import { serve } from "https://deno.land/std@0.177.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.178.0/http/mod.ts";
import { serveDirWithTs } from "https://deno.land/x/ts_serve@$MODULE_VERSION/mod.ts";

serve((request) => serveDirWithTs(request));
```

As a replacement for the
[serveFile](https://doc.deno.land/https://deno.land/std@0.177.0/http/file_server.ts/~/serveFile)
[serveFile](https://doc.deno.land/https://deno.land/std@0.178.0/http/file_server.ts/~/serveFile)
function in the Deno standard library:

```ts
import { serve } from "https://deno.land/std@0.177.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.178.0/http/mod.ts";
import { serveFileWithTs } from "https://deno.land/x/ts_serve@$MODULE_VERSION/mod.ts";

serve((request) => serveFileWithTs(request, "./mod.ts"));
Expand All @@ -78,13 +78,13 @@ serve((request) => serveFileWithTs(request, "./mod.ts"));
As [Hono](https://honojs.dev/)'s handler:

```ts
import { serve } from "https://deno.land/std@0.177.0/http/server.ts";
import { Hono } from "https://deno.land/x/hono@v2.2.5/mod.ts";
import { serve } from "https://deno.land/std@0.178.0/http/server.ts";
import { Hono } from "https://deno.land/x/hono@v3.0.2/mod.ts";
import { serveDirWithTs } from "https://deno.land/x/ts_serve@$MODULE_VERSION/mod.ts";

const app = new Hono();
app.get("*", (c) => {
return serveDirWithTs(c.req);
return serveDirWithTs(c.req.raw);
});
serve(app.fetch);
```
Expand All @@ -100,7 +100,7 @@ takes time. In that case, calling this function in advance can speed up later
calls to the transpile function.

```ts
import { serve } from "https://deno.land/std@0.177.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.178.0/http/mod.ts";
import {
fourceInstantiateWasm,
serveDirWithTs,
Expand Down
2 changes: 1 addition & 1 deletion oak_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
fail,
} from "https://deno.land/[email protected]/testing/asserts.ts";
import { deferred } from "https://deno.land/[email protected]/async/mod.ts";
import { Application } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { Application } from "https://deno.land/x/oak@v12.0.1/mod.ts";
import { MediaType, transpile, tsMiddleware } from "./mod.ts";

const port = 8888;
Expand Down
6 changes: 3 additions & 3 deletions src/oak.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Context } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { convertBodyToBodyInit } from "https://deno.land/x/oak@v11.1.0/response.ts";
import type { Context } from "https://deno.land/x/oak@v12.0.1/mod.ts";
import { convertBodyToBodyInit } from "https://deno.land/x/oak@v12.0.1/response.ts";

import { MediaType, transpile } from "../utils/transpile.ts";

Expand All @@ -14,7 +14,7 @@ const jsxType = new Set<string | undefined>(["jsx", ".jsx", "text/jsx"]);
* Oak middleware that rewrites TypeScript response to JavaScript response.
*
* ```ts
* import { Application } from "https://deno.land/x/oak@v11.1.0/mod.ts";
* import { Application } from "https://deno.land/x/oak@v12.0.1/mod.ts";
* import { tsMiddleware, fourceInstantiateWasm } from "https://deno.land/x/ts_serve@$MODULE_VERSION/mod.ts";
*
* fourceInstantiateWasm();
Expand Down

0 comments on commit b929b42

Please sign in to comment.