Skip to content

Commit

Permalink
feat(WIP): move to jsr
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Jul 10, 2024
1 parent 1aeb488 commit cfae87b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2023 the denosaurs team
Copyright (c) 2022-2024 the denosaurs team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ the web-standard
provide fast and easy route matching.

```ts
import { router } from "https://deno.land/x/rutt/mod.ts";
import { router } from "jsr:@denosaurs/rutt";

await Deno.serve(
router({
Expand All @@ -33,4 +33,4 @@ Pull request, issues and feedback are very welcome. Code style is formatted with

### Licence

Copyright 2022-2023, the denosaurs team. All rights reserved. MIT license.
Copyright 2022-2024, the denosaurs team. All rights reserved. MIT license.
8 changes: 7 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"importMap": "./import_map.json"
"name": "@denosaurs/rutt",
"version": "0.1.0",
"imports": {
"https://deno.land/x/rutt/mod.ts": "./mod.ts"
},
"exports": "./mod.ts"

}
5 changes: 0 additions & 5 deletions import_map.json

This file was deleted.

16 changes: 8 additions & 8 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ export interface Routes<T = {}> {
* {@link MatchHandler} is called.
*/
// deno-lint-ignore ban-types
export type InternalRoute<T = {}> = {
export interface InternalRoute<T = {}> {
pattern: RegExp | URLPattern;
methods: Record<string, MatchHandler<T>>;
};
}

/**
* An array of {@link InternalRoute internal route} objects which the
Expand Down Expand Up @@ -293,13 +293,13 @@ export function router<T = unknown>(

if (methods["any"]) {
return await methods["any"](req, ctx, groups);
} else {
return await unknownMethodHandler!(
req,
ctx,
Object.keys(methods) as KnownMethod[],
);
}

return await unknownMethodHandler!(
req,
ctx,
Object.keys(methods) as KnownMethod[],
);
}
}

Expand Down
9 changes: 3 additions & 6 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {
assert,
assertEquals,
assertIsError,
} from "https://deno.land/[email protected]/assert/mod.ts";
import { router } from "./mod.ts";
import { assert, assertEquals, assertIsError } from "jsr:@std/[email protected]";
import { router } from "https://deno.land/x/rutt/mod.ts";

/// @ts-ignore - Deno doesn't have this type
const TEST_CONN_INFO: Deno.ServeHandlerInfo = {
remoteAddr: {
transport: "tcp",
Expand Down

0 comments on commit cfae87b

Please sign in to comment.