From c121341b6c693af3621d5537013db484fe80e38f Mon Sep 17 00:00:00 2001
From: dk <2597375+Thesephi@users.noreply.github.com>
Date: Mon, 17 Jun 2024 04:52:04 +0200
Subject: [PATCH] Release/0.7.3 (#18)
* v0.7.3 - See CHANGELOG for details
---
CHANGELOG.md | 12 +++++++++
README.md | 71 ++++++++++++++++++++++------------------------------
jsr.json | 5 ++--
3 files changed, 45 insertions(+), 43 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81905a3..86be1e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+## [0.7.3] - 2024-06-17
+
+### Added
+
+- More symbols exported directly for better compatibilities with Cloudflare
+ Workers projects (esp. in IDE environments such as Visual Studio Code)
+
+### Fixed
+
+- Better support for JavaScript Registry documentation navigation indentation
+ behaviors
+
## [0.7.2] - 2024-06-17
### Changed
diff --git a/README.md b/README.md
index 2f1169c..86486c9 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ class MyPokedex {
}
```
-## Forewords
+# Forewords
If you're familiar with the
[npm library routing-controllers](https://www.npmjs.com/package/routing-controllers),
@@ -32,20 +32,18 @@ replacement for routing-controllers, as it attempts to conform to
yet. There's currently no plan to support TypeScript "experimental" decorators,
but if you feel strongly for it, please feel free to fork this repo!
-## Example Usages
-
-### Heads up
+# Heads up
For easy reading, the examples below do not specify any explicit version when
installing library dependencies. But in your production code, it's advisable to
pin every dependency to a specific version.
-### Deno runtime
+# Deno runtime
Prerequisite:
[Deno](https://docs.deno.com/runtime/manual/getting_started/installation)
-#### Example: Retrieving path parameters
+## Example: Retrieving path parameters
```bash
deno add @oak/oak @dklab/oak-routing-ctrl
@@ -87,9 +85,7 @@ deno run --allow-env --allow-net main.ts
curl localhost:1993/v1/hello/world # prints: hello, world
```
-#### Other examples
-
-##### Retrieving path parameters and request body
+## Example: Retrieving path parameters and request body
View Example
@@ -102,7 +98,6 @@ import {
Post,
useOakServer,
} from "@dklab/oak-routing-ctrl";
-const app = new Application();
@Controller("/v1")
class MyController {
@@ -113,11 +108,13 @@ class MyController {
}
}
+const app = new Application();
useOakServer(app, [MyController]);
-
await app.listen({ port: 1993 });
```
+_
+
```bash
curl -H"Content-Type: application/json" localhost:1993/v1/tell/alice -d'{"message": "all we need is love"}'
# prints: telling alice that "all we need is love"
@@ -125,7 +122,7 @@ curl -H"Content-Type: application/json" localhost:1993/v1/tell/alice -d'{"messag
-##### Retrieving request query and path parameters
+## Example: Retrieving request query and path parameters
View Example
@@ -138,7 +135,6 @@ import {
Get,
useOakServer,
} from "@dklab/oak-routing-ctrl";
-const app = new Application();
@Controller("/v1")
class MyController {
@@ -149,11 +145,13 @@ class MyController {
}
}
+const app = new Application();
useOakServer(app, [MyController]);
-
await app.listen({ port: 1993 });
```
+_
+
```bash
curl localhost:1993/v1/books/thriller\?page=2
# prints: searching for books in category "thriller" with query "page=2"
@@ -161,7 +159,7 @@ curl localhost:1993/v1/books/thriller\?page=2
-##### Accessing underlying context object
+## Example: Accessing underlying context object
View Example
@@ -169,7 +167,6 @@ curl localhost:1993/v1/books/thriller\?page=2
```ts
import { Application } from "@oak/oak/application";
import { Controller, Get, useOakServer } from "@dklab/oak-routing-ctrl";
-const app = new Application();
@Controller()
class MyController {
@@ -181,11 +178,13 @@ class MyController {
}
}
+const app = new Application();
useOakServer(app, [MyController]);
-
await app.listen({ port: 1993 });
```
+_
+
```bash
curl -H"x-foo: lorem" localhost:1993/foo/bar
# prints: request header x-foo has value "lorem"
@@ -193,11 +192,9 @@ curl -H"x-foo: lorem" localhost:1993/foo/bar
----
+# Other runtimes
-### Other runtimes
-
-#### Node.js
+## Node.js
View Example
@@ -241,12 +238,12 @@ await app.listen({ port: 1993 });
_
```bash
-curl http://localhost:1993/hello/world # prints: hello, world
+curl http://localhost:1993/v1/hello/world # prints: hello, world
```
-#### Cloudflare Workers
+## Cloudflare Workers
View Example
@@ -264,7 +261,7 @@ import {
ControllerMethodArgs,
Get,
useOakServer,
-} from "@dklab/oak-routing-ctrl";
+} from "@dklab/oak-routing-ctrl/mod";
@Controller()
class MyCloudflareWorkerController {
@@ -288,7 +285,7 @@ curl http://{your-cloudflare-worker-domain}/hello/world # prints: hello, world
-#### Bun
+## Bun
View Example
@@ -300,19 +297,13 @@ bunx jsr i @oak/oak @dklab/oak-routing-ctrl
_
```ts
-import { Application } from "@oak/oak/application";
-
-import {
- Controller,
- ControllerMethodArgs,
- Get,
- useOakServer,
-} from "@dklab/oak-routing-ctrl";
+import { Application, type RouterContext } from "@oak/oak";
+import { Controller, Get, useOakServer } from "@dklab/oak-routing-ctrl";
@Controller("/v1")
class MyController {
@Get("/hello/:name")
- hello(ctx) {
+ hello(ctx: RouterContext<"/hello/:name">) {
return `hello, ${ctx.params.name}`;
}
}
@@ -325,25 +316,23 @@ await app.listen({ port: 1993 });
_
```bash
-curl http://localhost:1993/hello/world # prints: hello, world
+curl http://localhost:1993/v1/hello/world # prints: hello, world
```
-## Documentation
+# Documentation
Documentation is hosted on the Javascript Registry:
https://jsr.io/@dklab/oak-routing-ctrl/doc
-## Contributor Resources
+# Contributor Resources
-### Tests
+## Tests
```bash
deno test -A --coverage=cov_profile
deno coverage cov_profile
```
-### Test Coverage
-
-![coverage](https://codecov.io/gh/Thesephi/oak-routing-ctrl/graphs/tree.svg?token=BA3M9P6410)
+[![coverage](https://codecov.io/gh/Thesephi/oak-routing-ctrl/graphs/tree.svg?token=BA3M9P6410)](https://codecov.io/github/Thesephi/oak-routing-ctrl)
diff --git a/jsr.json b/jsr.json
index e6f7690..7c7e921 100644
--- a/jsr.json
+++ b/jsr.json
@@ -1,8 +1,9 @@
{
"name": "@dklab/oak-routing-ctrl",
- "version": "0.7.2",
+ "version": "0.7.3",
"exports": {
- ".": "./mod.ts"
+ ".": "./mod.ts",
+ "./mod": "./mod.ts"
},
"exclude": [
"**/*_test.ts",