From 8abe2c5473cf4fc59a8cafbd028df7b734ddbf3f Mon Sep 17 00:00:00 2001 From: EthanThatOneKid <31261035+EthanThatOneKid@users.noreply.github.com> Date: Sat, 22 Jun 2024 12:04:50 -0700 Subject: [PATCH 1/2] reflect the sole dependency on @fartlabs/htx Update README.md to reflect the sole dependency on @fartlabs/htx (we no longer require a separate dependency on @fartlabs/jsonx for the jsx runtime). --- README.md | 6 +++--- deno.jsonc | 5 ++++- jsx-runtime.ts | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 jsx-runtime.ts diff --git a/README.md b/README.md index 22860dd..c4e88b9 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,10 @@ Let's learn how to get started with rtx by creating a simple router in Deno. deno init ``` -3\. Add `@fartlabs/jsonx` and `@fartlabs/rtx` as project dependencies. +3\. Add `@fartlabs/rtx` as a project dependency. ```sh -deno add @fartlabs/jsonx @fartlabs/rtx +deno add @fartlabs/rtx ``` 4\. Add the following values to your `deno.json(c)` file. @@ -36,7 +36,7 @@ deno add @fartlabs/jsonx @fartlabs/rtx { "compilerOptions": { "jsx": "react-jsx", - "jsxImportSource": "@fartlabs/jsonx" + "jsxImportSource": "@fartlabs/rtx" } } ``` diff --git a/deno.jsonc b/deno.jsonc index 686c06f..697b1be 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -2,7 +2,10 @@ "lock": false, "name": "@fartlabs/rtx", "version": "0.0.4", - "exports": "./mod.ts", + "exports": { + "./": "./mod.ts", + "./jsx-runtime": "./jsx-runtime.ts" + }, "imports": { "@fartlabs/jsonx": "jsr:@fartlabs/jsonx@^0.0.10", "@fartlabs/rt": "jsr:@fartlabs/rt@^0.0.3" diff --git a/jsx-runtime.ts b/jsx-runtime.ts new file mode 100644 index 0000000..93fa75f --- /dev/null +++ b/jsx-runtime.ts @@ -0,0 +1 @@ +export * from "@fartlabs/jsonx/jsx-runtime"; From bac8a07c208aeb38fe41ddbbd250b36360ea640d Mon Sep 17 00:00:00 2001 From: EthanThatOneKid <31261035+EthanThatOneKid@users.noreply.github.com> Date: Sat, 22 Jun 2024 12:06:08 -0700 Subject: [PATCH 2/2] fix lint error --- rtx.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rtx.ts b/rtx.ts index 1e5e0b7..38def53 100644 --- a/rtx.ts +++ b/rtx.ts @@ -11,7 +11,7 @@ import { createRouter, Router as CRouter } from "@fartlabs/rt"; */ export type ComponentsInterface = Record< Capitalize>, - (props: RouteProps) => CRouter + (props: RouteProps) => CRouter >; /** @@ -34,9 +34,9 @@ export interface RouterProps { /** * Router is the router component. */ -export function Router(props: RouterProps): CRouter { +export function Router(props: RouterProps): CRouter { const router = createRouter(); - ((props.children) as CRouter[]) + ((props.children) as CRouter[]) ?.forEach((child) => { if (child instanceof CRouter) { router.use(child); @@ -60,69 +60,69 @@ export function Router(props: RouterProps): CRouter { /** * Route is the route component. */ -export function Route(props: IRoute): CRouter { +export function Route(props: IRoute): CRouter { return createRouter().with(props); } /** * Connect is the route component for a CONNECT route. */ -export function Connect(props: RouteProps): CRouter { +export function Connect(props: RouteProps): CRouter { return createRouter().connect(props.pattern, props.handle); } /** * Delete is the route component for a DELETE route. */ -export function Delete(props: RouteProps): CRouter { +export function Delete(props: RouteProps): CRouter { return createRouter().delete(props.pattern, props.handle); } /** * Get is the route component for a GET route. */ -export function Get(props: RouteProps): CRouter { +export function Get(props: RouteProps): CRouter { return createRouter().get(props.pattern, props.handle); } /** * Head is the route component for a HEAD route. */ -export function Head(props: RouteProps): CRouter { +export function Head(props: RouteProps): CRouter { return createRouter().head(props.pattern, props.handle); } /** * Options is the route component for a OPTIONS route. */ -export function Options(props: RouteProps): CRouter { +export function Options(props: RouteProps): CRouter { return createRouter().options(props.pattern, props.handle); } /** * Patch is the route component for a PATCH route. */ -export function Patch(props: RouteProps): CRouter { +export function Patch(props: RouteProps): CRouter { return createRouter().patch(props.pattern, props.handle); } /** * Post is the route component for a POST route. */ -export function Post(props: RouteProps): CRouter { +export function Post(props: RouteProps): CRouter { return createRouter().post(props.pattern, props.handle); } /** * Put is the route component for a PUT route. */ -export function Put(props: RouteProps): CRouter { +export function Put(props: RouteProps): CRouter { return createRouter().put(props.pattern, props.handle); } /** * Trace is the route component for a TRACE route. */ -export function Trace(props: RouteProps): CRouter { +export function Trace(props: RouteProps): CRouter { return createRouter().trace(props.pattern, props.handle); }