Skip to content
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

Update Deno Dependencies #17

Merged
merged 3 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 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.144.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
import { serveDirWithTs } from "https://deno.land/x/ts_serve@$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@v10.6.0/mod.ts";
import { Application } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { tsMiddleware } from "https://deno.land/x/ts_serve@$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.144.0/http/file_server.ts/~/serveDir)
[serveDir](https://doc.deno.land/https://deno.land/std@0.153.0/http/file_server.ts/~/serveDir)
function in the Deno standard library:

```ts
import { serve } from "https://deno.land/std@0.144.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
import { serveDirWithTs } from "https://deno.land/x/ts_serve@$VERSION/mod.ts";

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

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

```ts
import { serve } from "https://deno.land/std@0.144.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
import { serveFileWithTs } from "https://deno.land/x/ts_serve@$VERSION/mod.ts";

serve((request) => serveFileWithTs(request, "./mod.ts"));
Expand All @@ -82,7 +82,7 @@ server will force the wasm file to be read ahead. Otherwise the wasm file will
take about 3 seconds to load the first time it is transpiled.

```ts
import { serve } from "https://deno.land/std@0.144.0/http/mod.ts";
import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
import {
fourceInstantiateWasm,
serveDirWithTs,
Expand Down
4 changes: 2 additions & 2 deletions file_server_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts";
import { serve } from "https://deno.land/std@0.152.0/http/mod.ts";
import { assertEquals } from "https://deno.land/std@0.153.0/testing/asserts.ts";
import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
import {
MediaType,
serveDirWithTs,
Expand Down
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { transpile } from "./utils/transpile.ts";
* There is no need to call this function where performance is not important. In that case, the wasm file will be automatically loaded in about 3 seconds when you transpile for the first time.
*
* ```ts
* import { serve } from "https://deno.land/std@0.152.0/http/mod.ts";
* import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
* import { serveDirWithTs, fourceInstantiateWasm } from "https://deno.land/x/ts_serve@$VERSION/mod.ts";
*
* fourceInstantiateWasm();
Expand Down
4 changes: 2 additions & 2 deletions mod_test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { assert } from "https://deno.land/std@0.152.0/testing/asserts.ts";
import { assert } from "https://deno.land/std@0.153.0/testing/asserts.ts";
import {
assertSpyCalls,
stub,
} from "https://deno.land/std@0.152.0/testing/mock.ts";
} from "https://deno.land/std@0.153.0/testing/mock.ts";

import { fourceInstantiateWasm, transpile } from "./mod.ts";

Expand Down
8 changes: 4 additions & 4 deletions oak_test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts";
import { deferred } from "https://deno.land/std@0.152.0/async/mod.ts";
import { Application } from "https://deno.land/x/oak@v10.6.0/mod.ts";
import { assertEquals } from "https://deno.land/std@0.153.0/testing/asserts.ts";
import { deferred } from "https://deno.land/std@0.153.0/async/mod.ts";
import { Application } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { MediaType, transpile, tsMiddleware } from "./mod.ts";

const port = 8888;
const jsContentType = "application/javascript; charset=utf-8";
const jsContentType = "application/javascript; charset=UTF-8";

async function startServer() {
const app = new Application();
Expand Down
12 changes: 6 additions & 6 deletions src/file_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import {
type ServeDirOptions,
serveFile,
type ServeFileOptions,
} from "https://deno.land/std@0.152.0/http/file_server.ts";
import { contentType } from "https://deno.land/std@0.152.0/media_types/mod.ts";
} from "https://deno.land/std@0.153.0/http/file_server.ts";
import { contentType } from "https://deno.land/std@0.153.0/media_types/mod.ts";
import { MediaType, transpile } from "../utils/transpile.ts";

const jsContentType = contentType(".js");

/**
* This can be used in the same way as the [serveFile](https://doc.deno.land/https://deno.land/std@0.152.0/http/file_server.ts/~/serveFile) function of the standard library, but if the file is TypeScript, it will be rewritten to JavaScript.
* This can be used in the same way as the [serveFile](https://doc.deno.land/https://deno.land/std@0.153.0/http/file_server.ts/~/serveFile) function of the standard library, but if the file is TypeScript, it will be rewritten to JavaScript.
*
* ```ts
* import { serve } from "https://deno.land/std@0.152.0/http/mod.ts";
* import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
* import { serveFileWithTs, fourceInstantiateWasm } from "https://deno.land/x/ts_serve@$VERSION/mod.ts";
*
* fourceInstantiateWasm();
Expand Down Expand Up @@ -47,10 +47,10 @@ export async function serveFileWithTs(
}

/**
* This can be used in the same way as the [serveDir](https://doc.deno.land/https://deno.land/std@0.152.0/http/file_server.ts/~/serveDir) function of the standard library, but if the file is TypeScript, it will be rewritten to JavaScript.
* This can be used in the same way as the [serveDir](https://doc.deno.land/https://deno.land/std@0.153.0/http/file_server.ts/~/serveDir) function of the standard library, but if the file is TypeScript, it will be rewritten to JavaScript.
*
* ```ts
* import { serve } from "https://deno.land/std@0.152.0/http/mod.ts";
* import { serve } from "https://deno.land/std@0.153.0/http/mod.ts";
* import { serveDirWithTs, fourceInstantiateWasm } from "https://deno.land/x/ts_serve@$VERSION/mod.ts";
*
* fourceInstantiateWasm();
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@v10.6.0/mod.ts";
import { convertBodyToBodyInit } from "https://deno.land/x/oak@v10.6.0/response.ts";
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 { 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@v10.6.0/mod.ts";
* import { Application } from "https://deno.land/x/oak@v11.1.0/mod.ts";
* import { tsMiddleware, fourceInstantiateWasm } from "https://deno.land/x/ts_serve@$VERSION/mod.ts";
*
* fourceInstantiateWasm();
Expand Down
2 changes: 1 addition & 1 deletion utils/transpile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { emit } from "https://deno.land/x/emit@0.5.0/mod.ts";
import { emit } from "https://deno.land/x/emit@0.7.0/mod.ts";

/** File type. You can pass it as an option to the transpile function to tell it what media type the source is. */
export enum MediaType {
Expand Down
2 changes: 1 addition & 1 deletion utils/transpile_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "https://deno.land/std@0.152.0/testing/asserts.ts";
import { assertEquals } from "https://deno.land/std@0.153.0/testing/asserts.ts";
import { MediaType, transpile } from "./transpile.ts";

const codes = [
Expand Down