profile
viewpoint
Kitson Kelly kitsonk @ThoughtWorksInc Melbourne, Australia http://www.kitsonkelly.com/ Principal Technologist @ThoughtWorksInc, contributing to @denoland and author of @oakserver

csnover/dojo-boilerplate 377

A starting point for developing with Dojo

kitsonk/colors 39

Console colors for Deno

kitsonk/app-example 8

An example Dojo 2 Application

kitsonk/choak 8

An example chat application using Deno and Oak

kitsonk/controller 8

Commands and Action Abstractions for Dojo

h-o-t/nocuous 6

A static code analysis tool for JavaScript and TypeScript.

kitsonk/d2-proto 4

Dojo 2.0 Prototypes and Experiments

kitsonk/bubba 3

A GitHub bot, making Eric's life easier

kitsonk/core-js 2

Prototype Core of Dojo 2

kitsonk/api-doc 1

A TypeScript API Documentation Generator

push eventkitsonk/deno

Ergenekon Yiğit

commit sha 4fa69e890ee92c3b81beed8c8a2b262db8c905ac

fix: atob should throw dom exception (#5730)

view details

luism3861

commit sha 7cdf3fb7e922e17d41d75a4bab50cea2c2e3bab7

remove dead link (#5655)

view details

Marcos Casagrande

commit sha 28b651c2e2bbe590295077f9253a3feb084349fd

Simplify isFiniteNonNegativeNumber (#5686)

view details

Marcos Casagrande

commit sha 7f81f02ce794ac14ca25d3505f339cb663499ce6

std/node: fs.writeFile/sync path can now be an URL (#5652)

view details

Ali Hasani

commit sha 3b86552d669b44c13f8dcf72e1147f79e9f680c6

refactor: remove duplicated code in std/node/module (#5778)

view details

Luca Casonato

commit sha 6feca0ef8bec69f4940c28a9ac0b6a0eeb6884ba

Fix Deno.dir and Diagnostics being present at stable runtime (#5750)

view details

guzhongren

commit sha 94f1de5f805638b7bc06ac36b7fb8adb568c7a25

Fix example (#5775)

view details

Bartek Iwańczuk

commit sha c3c16f025ca6f30f3faaa70481a125494ddcea87

fix: TSX analysis in module graph loader (#5785)

view details

Umar Bolatov

commit sha 2bbe475dbbd46c505cdb2a5e511caadbd63dd1fd

docs: update permissions example (#5809)

view details

skdltmxn

commit sha f6e31603563bad38c663494ddec6a363989b5786

feat(std/encoding): add base64 (#5811)

view details

Valentin Anger

commit sha b7f0b073bb7585ea932a5783ff4ea88843a46b1b

Add unstable checks for unix transport (#5818) Also remove the unix example from the stable documentation to stay in line with the `Deno.listen` one

view details

Andrew Mitchell

commit sha 4ca0d6e2d37ce2be029269be498c76922e30944b

Re-enable several fetch tests (#5803)

view details

Bartek Iwańczuk

commit sha e934df5f7dd7ebc52e8c74033d478c88fa638224

fix: create HTTP cache lazily (#5795)

view details

Bert Belder

commit sha ee0b5bb89ec33acc5dafb876de1f9fda5bcfa236

test: add utility function for assigning unique port to inspector (#5822)

view details

Bert Belder

commit sha 131f2a5f0cdcdbebe3e17c447869f92c99a7c051

fix: BorrowMutError when evaluating expression in inspector console (#5822) Note that this does not fix the 'Uncaught ReferenceError' issue that happens when 'eager evaluation' is enabled in the inspector. Fixes: #5807

view details

Marcos Casagrande

commit sha 20bf04dc7e046e8191443e75be451ec81523a86a

Move getHeaderValueParams & hasHeaderValueOf to util.ts (#5824)

view details

Martin Suchanek

commit sha fbbb9f1c36db526edc136fa2ecc4e6aba022099b

Add missing async delay import to code sample (#5837)

view details

Marcos Casagrande

commit sha c9f0e34e294241541ba59c3a7eb52f42df7ff993

Improve bufferFromStream (#5826)

view details

Marcos Casagrande

commit sha 1c4a9665e2a2ff85ccb8060f168dafafa4d2194b

fix: Allow ArrayBuffer as Fetch request body (#5831)

view details

Rares Folea

commit sha aef9f22462d287a5d18e517aabd8f03210d159b8

Fix typo (#5834)

view details

push time in 7 hours

push eventkitsonk/deno

Kitson Kelly

commit sha ebae1a20d59a50a53c99a14019c841a10839f95f

Migrate from dprint-ignore to deno-fmt-ignore (#5659)

view details

Stephan Seidt

commit sha 55d36006fc00768d1ddfaff8ea8abe6cd2b19e4b

Add wasm to media types (#5896)

view details

Bartek Iwańczuk

commit sha 7d764a2c27d9c50d1f4db1d73fe800b808402765

upgrade: dprint to 0.19.0 (#5899)

view details

Stephan Seidt

commit sha db9c2c156a064469fc0ac6a1ad48ae4425926681

Fix shebangs (#5898)

view details

Marcos Casagrande

commit sha f8c6500eef59e046f4fd90d3c37a1e16606a0a78

test(clie/web/fetch): Re-enable tests (#5904)

view details

Matt Dumler

commit sha f6e58b076ca430c29f164b65678bbf6bc64a39b7

fix(doc): handle comments at the top of the file (#5891)

view details

Kitson Kelly

commit sha 579b6668f153ad39bf167838fde02893b09d391d

REPL evaluates in strict mode

view details

Kitson Kelly

commit sha 2fd7cdd326edeca3213262b8beac224e1232519c

linting

view details

Kitson Kelly

commit sha 711c7e445414ae96982b940d866bc8ae90e9b183

fix intergration tests

view details

push time in 7 hours

push eventoakserver/awesome-oak

Deno Tutorials

commit sha e6c9fe271c31b6028c5231074665eea9dbb27b28

Added session middleware (session), logging middleware (organ), and security middleware (snelm) (#4)

view details

push time in 7 hours

PR merged oakserver/awesome-oak

Added the following middleware: session, organ, snelm

Added session middleware (session), logging middleware (organ), and security middleware (snelm)

+3 -0

0 comment

1 changed file

denjucks

pr closed time in 7 hours

issue commentoakserver/oak

Middleware not working when using a router

This is fixed in master now. Getting response.status will return what should be sent in the response if it is not explicitly set. There is also improvements so that calling .toServerResponse() doesn't "break" the response (though you shouldn't need to do it in most cases).

denjucks

comment created time in 9 hours

push eventoakserver/oak

Kitson Kelly

commit sha efaecc01b192515a47b1a6526b173110f5253f80

Formatting

view details

Kitson Kelly

commit sha ad899191d549d1994794b34dd2ced4e9b893807e

Unset response.status reflects to be sent status. Plus improvements to inline docs, and hardening of response when not writable. Fixes #118

view details

push time in 9 hours

issue closedoakserver/oak

Middleware not working when using a router

I placed middleware after a router and it never gets called for some reason. I want to log the status of a response. Below is the code used.

import { Application, Router } from "https://deno.land/x/oak/mod.ts";

const app = new Application();

const router = new Router();
router.get("/", async (context, next) => {
  context.response.body = "hello world";
  await next();
});

app.use(router.routes());
app.use(router.allowedMethods());

app.use(async (context, next) => {
  console.log(context.response.toServerResponse().status);
  await next();
});

await app.listen({ port: 8000 });

closed time in 9 hours

denjucks

push eventkitsonk/oak

Kitson Kelly

commit sha efaecc01b192515a47b1a6526b173110f5253f80

Formatting

view details

Kitson Kelly

commit sha ad899191d549d1994794b34dd2ced4e9b893807e

Unset response.status reflects to be sent status. Plus improvements to inline docs, and hardening of response when not writable. Fixes #118

view details

push time in 9 hours

issue commentoakserver/oak

Middleware not working when using a router

If I change response.status to a getter, I can put logic in there that would determine based on the current state of the response, what the .status would be if not set.

denjucks

comment created time in 12 hours

issue commentoakserver/oak

router.get(*, callback) now causes an error

I am unable to reproduce this off of master. There was a big rewrite of the router, which changed some of the types which may have resolved this issue.

nickpersad

comment created time in 12 hours

issue closedoakserver/oak

Application state in Routers not typed properly

While using typescript and defining a state for the application like so:

const app = new Application<AppState>()

typings for ctx.state is not typed accordingly to AppState interface with this code

new Router().get('/', (ctx) => ctx.state)

Am I missing something or do the Router class need generic typings similar to Application?

While running the code the state is actually there, only the typings that are incorrect.

closed time in 12 hours

Tsourdox

pull request commentoakserver/oak

Update deps.ts for changes in send.ts

Please combine with #126.

hviana

comment created time in 12 hours

Pull request review commentoakserver/oak

Update send.ts

 export async function send(     immutable = false,     maxage = 0,     root,+    buffSize = 32000
    segmentSize = 32000
hviana

comment created time in 12 hours

Pull request review commentoakserver/oak

Update send.ts

 export async function send(       ? extname(basename(path, encodingExt))       : extname(path);   }-  response.body = await Deno.readFile(path);+  const file = await Deno.open(path);+  const bufReader = new BufReader(file,buffSize);

please run deno fmt to fix linting issues.

hviana

comment created time in 12 hours

Pull request review commentoakserver/oak

Update send.ts

 export interface SendOptions {   /** Try to match extensions from passed array to search for file when no    * extension is sufficed in URL. First found is served. (defaults to    * `undefined`) */+

unecessary, please remove

hviana

comment created time in 12 hours

Pull request review commentoakserver/oak

Update send.ts

 export interface SendOptions {   /** Try to match extensions from passed array to search for file when no    * extension is sufficed in URL. First found is served. (defaults to    * `undefined`) */+   extensions?: string[];+  +  /** Buffer size for sending files. There must be a good relationship between+   * memory consumption and overhead. I recommend 32k. */+  buffSize?: number;
  /** The number of bytes per segment to read the file from
   * the file system.  Defaults to 32k. */
  segmentSize?: number;

Also try to alphabetise the properties, which now would be true.

hviana

comment created time in 12 hours

issue commentdenoland/deno

How to programmatically generate default tsconfig?

@orta well this wouldn't be used by the Deno runtime at all, it would be used by those who are trying to mimic enough of Deno somewhere else, so it being in a npm package is not a limiter there.

jsejcksn

comment created time in 12 hours

issue closedoakserver/oak

Q&A: Router prefix problem

Hello! So I've been trying to use oak to tinker arround and found either a bug or I'm using it in an incorrect way. I have the following router :

const TodoRouter = new Router({
    prefix: '/api/todo'
}); 

TodoRouter.get('/' , async (ctx) => {
    console.log('api')
    ctx.response.body = "Hello world"
} )

What I expected : doing a Get request to localhost:port/api/todo would return "Hello World" What happened : Doing a Get Request to localhost:port/api/todo return nothing image

So my Question is, when using a Router without a Prefix, the '/' route, work for either localhost:port and localhost:port/ so I would assume that with a prefix works the same, with that in mind is this the correct behaviour or a bug? Thanks in advance

closed time in 20 hours

StraightUpCode

issue commentoakserver/oak

Q&A: Router prefix problem

I believe this is fixed in master now.

StraightUpCode

comment created time in 20 hours

issue closedoakserver/oak

Argument of type 'Status.BadRequest' is not assignable to parameter of type 'ErrorStatus'.

error: TS2345 [ERROR]: Argument of type 'Status.BadRequest' is not assignable to parameter of type 'ErrorStatus'.
api_1  |     context.throw(Status.BadRequest, "Bad Request");

using example code in https://github.com/oakserver/oak/blob/master/examples/routingServer.ts

line 73

closed time in 20 hours

closet6

issue commentoakserver/oak

Application state in Routers not typed properly

I believe this is fixed in master now.

Tsourdox

comment created time in 20 hours

push eventoakserver/oak

Kitson Kelly

commit sha e91d619cac8bafa27990f1e7856da862b635033c

Restore router delete method types. Fixes #122

view details

push time in 20 hours

issue closedoakserver/oak

Restore types for Router delete.

There is a mis-parsing error in the master version of Deno, which has meant removing the types from the Router .delete() method. See: https://github.com/denoland/deno/issues/5867

When this is resolved, they need to be restored.

closed time in 20 hours

kitsonk

push eventkitsonk/oak

Kitson Kelly

commit sha e91d619cac8bafa27990f1e7856da862b635033c

Restore router delete method types. Fixes #122

view details

push time in 20 hours

push eventoakserver/oak

Kitson Kelly

commit sha 71f25d792b4e9f385cf427b49e423c4636ae994b

Add "listen" event for Application. Fixes #104

view details

push time in 20 hours

issue closedoakserver/oak

"listening" event

First of all: Dope project!

I would like to log something when the server is listening and ready to take requests. Would it be possible to add something like a "listening" event?

Usage example:

const PORT = 8000;
const app = new Application();
app.use(...);
app.addEventListener('listening', () => console.log(`Listening at http://localhost:${PORT} 🦕`));
await app.listen({ port: PORT });

closed time in 20 hours

Ricki-BumbleDev

push eventkitsonk/oak

Kitson Kelly

commit sha 71f25d792b4e9f385cf427b49e423c4636ae994b

Add "listen" event for Application. Fixes #104

view details

push time in 20 hours

issue commentoakserver/oak

Support multipart form data

I've started working on this, but it is fairly complex. I am not convinced the std multi part really is a good interface, so I am going to come up with something a better better I think.

lengfangbing

comment created time in 21 hours

push eventkitsonk/oak

Caíque de Castro Soares da Silva

commit sha d28b727a24af99b5554e01b138e939f1c0d78352

Fix encode uri on redirect (#120) Resolves #119

view details

SillyFreak

commit sha 094916b8deb94760e242fcbee971a52fb49f6e5b

fix example author (#123)

view details

push time in a day

issue commentdenoland/deno

Uncaught TypeError: Cannot read property '_TextDecoder' of undefined

@satishbabariya you were also likely ignoring the warning that was being logged to the console...

Warning Implicitly using master branch https://deno.land/std/uuid/mod.ts
satishbabariya

comment created time in a day

issue commentdenoland/deno

Uncaught TypeError: Cannot read property '_TextDecoder' of undefined

There is mention of it in the manual which was added here https://deno.land/manual/standard_library#versioning-and-stability but it looks like the README was not updated: https://github.com/denoland/deno/tree/master/std#how-to-use.

cc/ @bartlomieju @lucacasonato

satishbabariya

comment created time in a day

pull request commentdenoland/deno

Migrate from dprint-ignore to deno-fmt-ignore

@bartlomieju all green now/again

kitsonk

comment created time in a day

push eventkitsonk/deno

Chris Schepman

commit sha bebb8c029fff56f3a6e653b757583ab5c1d4b11f

docs: Update debugger.md (#5615)

view details

Bartek Iwańczuk

commit sha 5f9c1c7da6047ee8612e71f8ef4ca9c950b3a699

fix: disallow http imports for modules loaded over https (#5680)

view details

Colin Harrington

commit sha aea5b12baedd5156850fd97bf2b5085da0927b00

ci: Errors in benchmarks should fail CI (#5422)

view details

Bhumij Gupta

commit sha 88e8c32652873be1f230c31cad26e93efbfca0d6

docd: Replace obsolete Deno.homeDir() with Deno.dir('home') (#5708)

view details

Bartek Iwańczuk

commit sha f98cc34c405aefd1c46fe5c6b5e0051e1a502f64

docs: add entry for 'deno info' (#5703)

view details

skdltmxn

commit sha 49c85a2c2396d6d010296503faf0b0b8712e9cd0

feat(std/hash): add md5 (#5719)

view details

Khang Dinh

commit sha 65f4e5912293bea5c59e2923cabfa8c0373a05a7

typos (#5713)

view details

moyinzi

commit sha 8d8a2f573f32e0b2680eb114739902c5953f7b99

fix(std/http): file_server's target directory (#5695)

view details

Bartek Iwańczuk

commit sha 491feb859f30f56bc25d6afc730a1c709a0bb807

fix: --inspect flag working like --inspect-brk (#5697)

view details

David Sherret

commit sha ee710994925e8840ea387e1853d9c15f3eb73149

fix(fmt): Do not panic on new expr with no parens. (#5734) Closes #5567

view details

Bartek Iwańczuk

commit sha f9e45114b9c423b72e9c44c4a8aef90f5c3b44d6

fix: redirects handling in module analysis (#5726) This commit fixes a bug introduced in #5029 that caused bad handling of redirects during module analysis. Also ensured that duplicate modules are not downloaded.

view details

Chris Knight

commit sha 4b06e357655e5e4e1aba6d9591eeb7ca269850ed

doc: clarify and warn on Deno.read/write behaviour (#5743)

view details

Bartek Iwańczuk

commit sha e191c70989a1dbf29b095bf6c2f7b62b90de012a

fix: ts type imports (#5733)

view details

Bartek Iwańczuk

commit sha 960f9ccb2e700332dc576163b62c518120c73f15

fix: SWC lexer settings and silent errors (#5752) This commit changes how error occurring in SWC are handled. Changed lexer settings to properly handle TS decorators. Changed output of SWC error to annotate with position in file.

view details

Ali Hasani

commit sha 1a6c5413272d110dd96fa354db28a668f55a4399

re-enable symlink tests on windows (#5746)

view details

Bartek Iwańczuk

commit sha 526c9196e23af34d1ecd424d09c99c7003c33844

v1.0.2

view details

Ergenekon Yiğit

commit sha 4fa69e890ee92c3b81beed8c8a2b262db8c905ac

fix: atob should throw dom exception (#5730)

view details

luism3861

commit sha 7cdf3fb7e922e17d41d75a4bab50cea2c2e3bab7

remove dead link (#5655)

view details

Marcos Casagrande

commit sha 28b651c2e2bbe590295077f9253a3feb084349fd

Simplify isFiniteNonNegativeNumber (#5686)

view details

Marcos Casagrande

commit sha 7f81f02ce794ac14ca25d3505f339cb663499ce6

std/node: fs.writeFile/sync path can now be an URL (#5652)

view details

push time in a day

push eventkitsonk/deno

uki00a

commit sha cdc9323cccdee544562712018f722026bdfbbd6c

fix: REPL does not exit properly when close() is called (#5451)

view details

Speykious

commit sha 9752b853ddac3ba41378d0ae8a8604a28e285ffb

Provide better ANSI colorized output when inspecting objects (#5404)

view details

zfx

commit sha 7589d4d7c4a7c95298268eb8bea0e808feb0c6a9

fix(multipart): fix error when parsing file name in utf8 format (#5428)

view details

moumni

commit sha 949061c4b68e41aa93da97125cd15ad8c9e7f44f

fix url (#5637)

view details

Ryan Dahl

commit sha 0fb5f23466a84835cb1b4202d06ec53dc1592961

fix(doc): crash on formatting type predicate (#5651)

view details

Marcos Casagrande

commit sha 62c34bc21e8864ec5701ad493c73224367627580

fix(std/node) improve fs.close compatibility (#5649)

view details

Marcos Casagrande

commit sha eb5acb39d5936d3e0fde44a33357cda88a5ff55f

feat(std/node): Add fs.promises.readFile (#5656)

view details

Anil Seervi

commit sha f366e5e9bb5982376b160bebd35c3edf2c9ff19b

docs(std): fixed spelling mistake (#5662)

view details

Bartek Iwańczuk

commit sha 8799855fdc97960b18fbbb3450ed132e352607c4

refactor: reorganize TS compiler (#5603)

view details

Marcos Casagrande

commit sha 7566aa8765be82a9773b7ff83c3ddc8e70041e79

fix(std/log): await default logger setup (#5341)

view details

Evan Hahn

commit sha f5c0188b5edf9451aca42347dd4a48708fefce23

std/node: add util.callbackify (#5415) This adds [Node's `util.callbackify`][0] to `std/node/util.ts`. I lifted most of this from the [original Node source code][1] (and [its tests][2]). I tried to make minimal modifications to the source. I made a few arbitrary decisions: - I was unable to do the function's types elegantly. I made overloads for functions that have 0 to 5 (inclusive) arguments, excluding the callback. I would love to know a better way to do this. (It seems that the folks at DefinitelyTyped [were also stumped][3], though maybe their solution is deliberate.) - There are a few edge cases that cause custom Node errors to be produced. Instead of re-implementing those errors completely, I created simplified classes. These are mostly correct but are not identical to the real Node errors. - The tests implement a possibly-arcane `TestQueue` class. I originally used a lot of inline promises but found it too repetitive. Closes [#5366][4]. [0]: https://nodejs.org/api/util.html#util_util_callbackify_original [1]: https://github.com/nodejs/node/blob/47804933012841f2dc90626bdcc161adf34569a5/lib/util.js#L183-L226 [2]: https://github.com/nodejs/node/blob/47804933012841f2dc90626bdcc161adf34569a5/test/parallel/test-util-callbackify.js [3]: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/7d24857ddb07ab637dfa8c477d13352f8a8206fc/types/node/util.d.ts#L61-L84 [4]: https://github.com/denoland/deno/issues/5366

view details

Oliver Lenehan

commit sha 662eb8f8c981565950d35cdd1c9ca6a67eaef8f2

feat(std/fmt): rgb24 and bgRgb24 can use numbers for color (#5198)

view details

David Sherret

commit sha 91d576aa5aee10f651ff10086aee90bdae659e87

Update dprint 0.18.4 (#5671) Fixes trailing comma issue

view details

Ali Hasani

commit sha ef14d62462d7f5bc2f091c3521409b4a16c5f87c

feat(std/bytes): add hasSuffix and contains functions, update docs (#4801)

view details

uki00a

commit sha 9b4da88a96ce4c793e7b15d9b340fa6326a29a82

fix(std/io): BufReader should not share the internal buffer across reads (#4543)

view details

Garrone Joseph

commit sha 7630326b4c5ed32377f34a6668beac626d5156ac

feat(std/node) Export TextDecoder and TextEncoder from util (#5663)

view details

Ali Hasani

commit sha 22da75b8e554f69e552d6312c1ce412cbc6d05bd

feat(std/node): first pass at url module (#4700)

view details

uki00a

commit sha 6d7e3621daad936c87de930e8b9537e5ccc913e3

fix: compilation error introduced by #4543 (#5673)

view details

Hendrik

commit sha 765acd3170dca4320397fbdec41540b43e6d4315

Provide required arguments to walk in example. (#5668)

view details

Ryan Dahl

commit sha 49dda23f6b936f21de2a3de4be39771f30ddd6e9

v1.0.1

view details

push time in a day

issue commentdenoland/deno

Uncaught TypeError: Cannot read property '_TextDecoder' of undefined

You are using the master branch of standard, it is only compatible with the master branch of Deno. It is by luck that it works with 1.0.2. The version compatible with 1.0.0 is v0.51.0 (https://deno.land/std@v0.51.0/uuid/mod.ts). The version with 1.0.2 is v0.53.0 (https://deno.land/std@v0.53.0/uuid/mod.ts`).

satishbabariya

comment created time in a day

push eventkitsonk/deno

Kitson Kelly

commit sha 9b42015ed8b243d5212d99c88b0d043210bc7697

add unstable APIs

view details

push time in a day

issue commentdenoland/deno

Uncaught TypeError: Cannot read property '_TextDecoder' of undefined

Same here... what version of Deno?

satishbabariya

comment created time in a day

issue closedoakserver/oak

Is a directory (os error 21)

There is OS error when I'm using OAK.

$ deno run --allow-net ./index.ts Download https://deno.land/x/oak/mod.ts error: Is a directory (os error 21)

$ deno --version deno 1.0.2 v8 8.4.300 typescript 3.9.2

macOS Catalina 10.15.4

Additionally: I checked it on Windows 10 too.

I get different error on Windows. error: Access is denied. (os error 5)

closed time in a day

aykhanhuseyn

issue commentoakserver/oak

Is a directory (os error 21)

Deno requires fully qualified URL for modules and does not support any "magic" resolution. Please refer to Deno documentation. https://deno.land/manual/getting_started/typescript

aykhanhuseyn

comment created time in a day

issue closedoakserver/oak

Uncaught ReferenceError

I am beginning to learn Deno and decided to use Oak as my middleware to build a REST API. However, I keep getting this error:

Uncaught ReferenceError: ErrorEvent is not defined export class ApplicationErrorEvent<S extends State> extends ErrorEvent { ^ at application.ts:78:61

Any ideas on how to fix it?

closed time in a day

egutierrez10

Pull request review commentdenoland/deno

[WIP] refactor: TS compiler and module graph

-error: Uncaught SyntaxError: Unexpected end of input-    at [WILDCARD]tests/error_syntax_empty_trailing_line.mjs:[WILDCARD]+error: Unexpected eof at [WILDCARD]tests/error_syntax_empty_trailing_line.mjs:2:21

I think the same here... "eof" is sometimes well understood, but "Unexpected end of file" is clearer. No sense in holding up this PR, but maybe we should have a DX issue for error messages for this. Hopefully something the wider community would help out with.

bartlomieju

comment created time in a day

Pull request review commentdenoland/deno

[WIP] refactor: TS compiler and module graph

 async fn bundle_command(    let global_state = GlobalState::new(flags)?; -  let bundle_result = tsc::bundle(+  // TODO(bartlomieju): probably should respect --quiet flag+  eprintln!("Bundling {}", module_specifier.to_string());++  let output = tsc::bundle(     &global_state,     compiler_config,-    module_name,+    module_specifier,     maybe_import_map,-    out_file,     global_state.flags.unstable,   )-  .await;+  .await?;    debug!(">>>>> bundle END");-  bundle_result++  let output_string = fmt::format_text(&output)?;++  if let Some(out_file_) = out_file.as_ref() {+    eprintln!("Emitting bundle to {:?}", out_file_);++    let output_bytes = output_string.as_bytes();+    let output_len = output_bytes.len();++    deno_fs::write_file(out_file_, output_bytes, 0o666)?;+    // TODO(bartlomieju): do we really need to show this info? (it doesn't respect --quiet flag)

It should respect the quiet flag. I think it is good for it to express what it is doing though. Especially with creating a file, to give some sort of information about that file.

bartlomieju

comment created time in a day

Pull request review commentdenoland/deno

[WIP] refactor: TS compiler and module graph

-error: Uncaught SyntaxError: Unexpected identifier-(the following is a syntax error  ^^ ! )-     ~~~~~~~~~-    at [WILDCARD]tests/error_syntax.js:3:6+error: Expected Comma, got Some(Word(following)) at [WILDCARD]tests/error_syntax.js:3:5

I think we need to improve these over time, as got Some(Word(follow)) is pretty inaccessible to developers. Ultimately we want go grab the source line and highlight the span, and put some sort of match in to humanise the errors.

bartlomieju

comment created time in a day

issue commentoakserver/oak

Is a directory (os error 21)

It is hard to guess what is in ./index.ts unless you provide it. I am afraid my mind reading skills are limited.

aykhanhuseyn

comment created time in 2 days

push eventoakserver/oak

SillyFreak

commit sha 094916b8deb94760e242fcbee971a52fb49f6e5b

fix example author (#123)

view details

push time in 2 days

PR merged oakserver/oak

Fix Author name in README

I know this fix is extremely important, but nonetheless: one of the README examples uses "Conan Doyle, Author" instead of ".. Arthur".

That's all, thanks

+1 -1

0 comment

1 changed file

SillyFreak

pr closed time in 2 days

issue commentoakserver/oak

Uncaught ReferenceError

You need to provide more information than this, like what version of Deno you are using and what version of oak.

egutierrez10

comment created time in 2 days

issue commentdenoland/deno

console log not aligning

That is why the issue is open @amarkantku.

t829702

comment created time in 2 days

issue commentdenoland/deno

`deno bundle` produce typescript file

I don't think anyone said TypeScript is the source of truth. It is a first class language. Outputting to a TypeScript bundle is inefficient, as it would require reparsing again. Outputting the .d.ts file is just as truthful as outputting TypeScript and more efficient and subsequent consumption.

Source maps is #4499.

davidcallanan

comment created time in 2 days

push eventkitsonk/deno

Bartek Iwańczuk

commit sha f9e45114b9c423b72e9c44c4a8aef90f5c3b44d6

fix: redirects handling in module analysis (#5726) This commit fixes a bug introduced in #5029 that caused bad handling of redirects during module analysis. Also ensured that duplicate modules are not downloaded.

view details

Chris Knight

commit sha 4b06e357655e5e4e1aba6d9591eeb7ca269850ed

doc: clarify and warn on Deno.read/write behaviour (#5743)

view details

Bartek Iwańczuk

commit sha e191c70989a1dbf29b095bf6c2f7b62b90de012a

fix: ts type imports (#5733)

view details

Bartek Iwańczuk

commit sha 960f9ccb2e700332dc576163b62c518120c73f15

fix: SWC lexer settings and silent errors (#5752) This commit changes how error occurring in SWC are handled. Changed lexer settings to properly handle TS decorators. Changed output of SWC error to annotate with position in file.

view details

Ali Hasani

commit sha 1a6c5413272d110dd96fa354db28a668f55a4399

re-enable symlink tests on windows (#5746)

view details

Bartek Iwańczuk

commit sha 526c9196e23af34d1ecd424d09c99c7003c33844

v1.0.2

view details

Ergenekon Yiğit

commit sha 4fa69e890ee92c3b81beed8c8a2b262db8c905ac

fix: atob should throw dom exception (#5730)

view details

luism3861

commit sha 7cdf3fb7e922e17d41d75a4bab50cea2c2e3bab7

remove dead link (#5655)

view details

Marcos Casagrande

commit sha 28b651c2e2bbe590295077f9253a3feb084349fd

Simplify isFiniteNonNegativeNumber (#5686)

view details

Marcos Casagrande

commit sha 7f81f02ce794ac14ca25d3505f339cb663499ce6

std/node: fs.writeFile/sync path can now be an URL (#5652)

view details

Ali Hasani

commit sha 3b86552d669b44c13f8dcf72e1147f79e9f680c6

refactor: remove duplicated code in std/node/module (#5778)

view details

Luca Casonato

commit sha 6feca0ef8bec69f4940c28a9ac0b6a0eeb6884ba

Fix Deno.dir and Diagnostics being present at stable runtime (#5750)

view details

guzhongren

commit sha 94f1de5f805638b7bc06ac36b7fb8adb568c7a25

Fix example (#5775)

view details

Bartek Iwańczuk

commit sha c3c16f025ca6f30f3faaa70481a125494ddcea87

fix: TSX analysis in module graph loader (#5785)

view details

Umar Bolatov

commit sha 2bbe475dbbd46c505cdb2a5e511caadbd63dd1fd

docs: update permissions example (#5809)

view details

skdltmxn

commit sha f6e31603563bad38c663494ddec6a363989b5786

feat(std/encoding): add base64 (#5811)

view details

Valentin Anger

commit sha b7f0b073bb7585ea932a5783ff4ea88843a46b1b

Add unstable checks for unix transport (#5818) Also remove the unix example from the stable documentation to stay in line with the `Deno.listen` one

view details

Andrew Mitchell

commit sha 4ca0d6e2d37ce2be029269be498c76922e30944b

Re-enable several fetch tests (#5803)

view details

Bartek Iwańczuk

commit sha e934df5f7dd7ebc52e8c74033d478c88fa638224

fix: create HTTP cache lazily (#5795)

view details

Bert Belder

commit sha ee0b5bb89ec33acc5dafb876de1f9fda5bcfa236

test: add utility function for assigning unique port to inspector (#5822)

view details

push time in 2 days

PR opened denoland/deno

Use ts-expect-error instead of ts-ignore.

TypeScript 3.9 introduced // @ts-expect-error which can be used instead of // @ts-ignore, where if there is no error to ignore, it will throw. Moving to this has identified about 15 instances where we were "ignoring" errors that didn't exist.

+81 -94

0 comment

34 changed files

pr created time in 2 days

push eventkitsonk/deno

Kitson Kelly

commit sha 24ef6ebdc2dd04f0d61bc89c31db74ba9e3f78b8

revert unintended format

view details

push time in 2 days

create barnchkitsonk/deno

branch : ts-expect-error

created branch time in 2 days

push eventoakserver/oak

Caíque de Castro Soares da Silva

commit sha d28b727a24af99b5554e01b138e939f1c0d78352

Fix encode uri on redirect (#120) Resolves #119

view details

push time in 2 days

PR merged oakserver/oak

Fix encode uri on redirect

Fixes #119

The koa framework uses this function to encode URI. https://github.com/koajs/koa/blob/master/lib/response.js#L20 https://github.com/pillarjs/encodeurl/blob/master/index.js

+29 -2

0 comment

3 changed files

caiquecastro

pr closed time in 2 days

issue closedoakserver/oak

Redirect url being encoded twice

I am redirecting on my route:

const url = new URL('https://accounts.spotify.com/authorize');
url.searchParams.append('response_type', 'code');
url.searchParams.append('redirect_uri', 'http://localhost:3000/callback');
url.searchParams.append('client_id', 'my-client-id');
url.searchParams.append('scope', 'user-read-private user-read-email');
url.searchParams.append('state', 'some-string');
url.searchParams.append('show_dialog', 'true');

context.response.redirect(url);

The generated response is:

Headers:

HTTP/1.1 302 Found
content-length: 254
location: https://accounts.spotify.com/authorize?response_type=code&redirect_uri=http%253A%252F%252Flocalhost%253A3000%252Fcallback&client_id=my-client-id&scope=user-read-private%2520user-read-email&state=some-string&show_dialog=true
content-type: text/plain; charset=utf-8

Body:
Redirecting to https://accounts.spotify.com/authorize?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&client_id=my-client-id&scope=user-read-private%20user-read-email&state=some-string&show_dialog=true.

If you check the generated redirect_uri:

redirect_uri=http%253A%252F%252Flocalhost%253A3000%252Fcallback

instead of 

redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback

The % is being encoded twice: % -> %25

https://github.com/oakserver/oak/blob/master/response.ts#L102

closed time in 2 days

caiquecastro

issue closedoakserver/oak

[Proposal] Better type support

Since this project followed koa's design, it has the same problem on types. Here I have a proposal to bring better type support for middleware.

The problem is that you cannot extend Application's type parameter when applying middlewares(which attach extra properties to ctx.state) on it. For example:

const app = new Application()

app.use(ctx => {
    ctx.state.username = 'foo'
}).use(ctx => {
    // not type safe for username
    ctx.state.username
})

My idea is we can change the prototype of use like this:

class Application<S>{
  use<NS extends {} = S>(middleware: Middleware<NS, Context<NS>>): Application<NS extends S ? NS : (S & NS)>
}

So we can happily write middleware with type checking:

// when need to extend context type, declare only what you want to attach
app.use((ctx: Context<{ name: string }>) => {
  ctx.state.name = 'foo'
  // I'm not including next here for simplification 
})
// extend again
.use((ctx: Context<{ id: string }>) => {
  ctx.state.id = 'id'
})
// context type is by default according to last middleware
.use((ctx) => {
  // ctx has a default type
  ctx.state.id = 'id'
  ctx.state.name = 'name'
})

It's not hard to do so if we don't support applying multiple middleware by one use call(which should be a rare use case).

And it's a little complicated for Router, we also want Router to have same context type as Application, so the Router instance must be created by a Application instance, so its type parameter can be inherited.

Application<S> {
  createRouter(): Router<S>
}

If you're good with this, I'll be working on it and send a pull request. Or please reply if have any comments.

closed time in 2 days

themez

issue commentoakserver/oak

[Proposal] Better type support

Closed via 5e591f91a5af410a83a779a9e3314a2d7bb40545

themez

comment created time in 2 days

push eventoakserver/oak

Kitson Kelly

commit sha 48b1a41cc9d644b9c7b835568b67b5eee12df72d

Update to media_types v2.3.3

view details

Kitson Kelly

commit sha 5e591f91a5af410a83a779a9e3314a2d7bb40545

Improve state and router param types. Co-authored-by: Zeng Xian <xian.zeng@iftech.io>

view details

push time in 2 days

push eventkitsonk/oak

Kitson Kelly

commit sha 48b1a41cc9d644b9c7b835568b67b5eee12df72d

Update to media_types v2.3.3

view details

Kitson Kelly

commit sha 5e591f91a5af410a83a779a9e3314a2d7bb40545

Improve state and router param types. Co-authored-by: Zeng Xian <xian.zeng@iftech.io>

view details

push time in 2 days

created tagoakserver/media_types

tagv2.3.3

A module that assists in resolving media types and extensions.

created time in 2 days

issue openedoakserver/oak

Restore types for Router delete.

There is a mis-parsing error in the master version of Deno, which has meant removing the types from the Router .delete() method. See: https://github.com/denoland/deno/issues/5867

When this is resolved, they need to be restored.

created time in 2 days

issue openeddenoland/deno

Parsing error on master with properties named delete

I did a build from master and the following now errors (which it didn't previously):

const foo = { delete<S>() {} };

I get:

$ deno run bad_parse.ts
error: TS1005 at file:///bad_parse.ts:1:20,Expected Comma, got Some(JSXTagStart) at file:///bad_parse.ts:1:20

Basically anything that contains a /method of delete and has some sort of generic blows up. Likely related to delete being a reserved word in certain contexts, but being totally valid here. TypeScript compiler has no problem with this.

created time in 2 days

push eventoakserver/oak

Kitson Kelly

commit sha 8ff91819ee02e16a4ff66896615acb3146b5527a

Improvements to cookie example

view details

Kitson Kelly

commit sha eacb19b92ce1b0541c5d55541002782365d3629b

Add getQuery helper. Fixes #121

view details

push time in 2 days

issue closedoakserver/oak

Create helper function for query params

Refs #116

I will create a helper function that makes it a bit easier to deal with query/search params on a request.

closed time in 2 days

kitsonk

push eventkitsonk/oak

Kitson Kelly

commit sha 8ff91819ee02e16a4ff66896615acb3146b5527a

Improvements to cookie example

view details

Kitson Kelly

commit sha eacb19b92ce1b0541c5d55541002782365d3629b

Add getQuery helper. Fixes #121

view details

push time in 2 days

PR closed oakserver/oak

Un-Strict Prefix routing fix

Un-Strict Prefix routing fix

as @aldinp16 mention setPrefix() is where it seems to go wrong and its correct 😬. oak uses path-to-regexp to return the regex that creates matches for the routes. One of the arguments it needs it's the path, when we set an endpoint with the base path '/' the setPrefix() function is putting the prefix and the path together

this.path = `${prefix}${this.path}`

which when we send to pathToRegexp() even with the strict flag as false we are still passing the path with the strict trailing / because those 2 are put together so it returns a regex that needs to verify that last / as part of the path hence it is on a permanent strict mode.

FIX

debugging was the hard part but the fix is relatively easy. We just have to check if we have a "base" path / and if the strict option is false. if those things are both true we just set the path to its prefix this.path =${prefix}; else continue as usual with this.path = ${prefix}${this.path};

 if (this.path === "/" && !this.options.strict) {
        // check if path is set to "base" and the strict option
        this.path = `${prefix}`;
      } else {
        this.path = `${prefix}${this.path}`;
      }

Fixes #91

+45 -1

3 comments

2 changed files

Marguelgtz

pr closed time in 2 days

pull request commentoakserver/oak

Un-Strict Prefix routing fix

Ok, should be working in a7562cccf5f48cccc882ca78f5a34d4ac03a4926 (and I added a test to verify too)

Marguelgtz

comment created time in 2 days

issue closedoakserver/oak

cookies should be an iterable

Cookies should be iterable so you can do:

app.use((ctx) => {
  for (const [key, value] of ctx.cookies) {
    // do something
  }
});

closed time in 2 days

kitsonk

push eventoakserver/oak

Kitson Kelly

commit sha db53b3450e302e5669ce24f961a513d10cce730b

Cookies are iterable Fixes #107

view details

push time in 2 days

push eventkitsonk/oak

Kitson Kelly

commit sha db53b3450e302e5669ce24f961a513d10cce730b

Cookies are iterable Fixes #107

view details

push time in 2 days

push eventoakserver/oak

Kitson Kelly

commit sha a7562cccf5f48cccc882ca78f5a34d4ac03a4926

Rewrite router based on @koa/router

view details

push time in 2 days

push eventkitsonk/oak

Reed Jones

commit sha d6f90580f68e22f7c60713733b8cdd95f06ffcb7

Inconsistent version was 'pinned' in the docs (#103)

view details

Daniël Illouz

commit sha 47429e969a193501a9b2f668fb7bd29878f328a0

Fixed typo in middleware paragraph (#112)

view details

Kitson Kelly

commit sha a7562cccf5f48cccc882ca78f5a34d4ac03a4926

Rewrite router based on @koa/router

view details

push time in 2 days

issue closedoakserver/oak

Get Form Values from body.

I tried to get form values from request.body but kept returning urlparamsimpl {} and I can't get form values from that.

closed time in 2 days

devYusuf

issue commentoakserver/oak

Get Form Values from body.

Lots of good conversations here, but oak doesn't currently support multi-part form data, but it should. I am going to close this as a duplicate of #109 as that was the first to bring it up, and I think I have enough information now to try to solve the problem.

Duplicate of #109

devYusuf

comment created time in 2 days

issue commentoakserver/oak

get request body when content-type is form-data looks strange. #question

@lengfangbing Yes, dealing with multi-part form data is something oak should do without the user being aware of how it is dealt with.

lengfangbing

comment created time in 2 days

Pull request review commentoakserver/oak

Fix encode uri on redirect

 function isReader(value: any): value is Deno.Reader {     typeof value.read === "function"; } +const ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g

Can we move this whole bit to /util.ts. It makes more sense there.

caiquecastro

comment created time in 2 days

push eventkitsonk/oak

Kitson Kelly

commit sha f233a632c376816a3f7e372749c80435149d445b

Rewrite router based on @koa/router

view details

push time in 2 days

issue openedoakserver/oak

Create helper function for query params

Refs #116

I will create a helper function that makes it a bit easier to deal with query/search params on a request.

created time in 2 days

push eventoakserver/awesome-oak

Mahmoud Ashraf

commit sha c148492d3119589f3e4ed2cec08662cbeccdec36

add deno_crud_jwt project to boilerplates section (#1)

view details

push time in 2 days

push eventoakserver/awesome-oak

John Guo

commit sha 7fda29484fef43d064b0872305e35ff84ae49471

Update README.md (#3) Co-authored-by: Kitson Kelly <me@kitsonkelly.com>

view details

push time in 2 days

push eventgjuoun/awesome-oak

Halvard Mørstad

commit sha 067b6f68e18924782f6e34a4ca8a98ede6555e87

Adding middlewares for error handling, logging, and jwt (#2)

view details

Kitson Kelly

commit sha fc062e4754657932b5dc22de135bbc83567c8d7d

Merge branch 'master' into master

view details

push time in 2 days

push eventoakserver/awesome-oak

Halvard Mørstad

commit sha 067b6f68e18924782f6e34a4ca8a98ede6555e87

Adding middlewares for error handling, logging, and jwt (#2)

view details

push time in 2 days

issue commentoakserver/oak

Middleware not working when using a router

by doing context.response.toServerResponse().status you are consuming the response which means it can't be sent to the server. I need to make that more hidden, because it shouldn't be used by middleware. If you want to know what the status of the response is at the time... context.response.status, but you also want to put the next() before hand.

If you are depending on automatic body processing though, which will set the status when the body is processed, then that isn't quite do-able at the moment, because the status isn't set until after all the middleware has run.

denjucks

comment created time in 2 days

issue commentoakserver/oak

Cannot get params from context

Btw, would you know how to handle query param with oak though

ctx.request.url.searchParams.get("id");

I can see that is getting a bit cumbersome though, and some users would expect to be able to have the params and these "merged". I want to avoid creating aliases and the like, but I think a helper function that would return the searchParams as a single object optionally merged with the parsed out params would be a good idea... something that would work like this:

const query = queryParams(ctx, { mergeParams: true });
Waxoussou

comment created time in 2 days

issue commentoakserver/oak

Q&A: Can you close the server manually?

@adoi abort signals are the browser standard for aborting asynchronous processes, I would prefer to align to that. From an overall architecture perspective, I am not convinced that the ability to close the server and stop processing requests should be an implicit API offered up to middleware. The ability to allow middleware to do that should be explicit. For example is someone wanted to create a middleware library that needed to close the server, the would have a constructor (or factory) that would take the abort controller as an argument. This would ensure that the consumer of the middleware is explicit of allowing the middleware to potentially close the server:

import { Application } from "https://deno.land/x/oak/mod.ts";
import { SomeMiddleware } from "https://some.lib/mod.ts";

const abortController = new AbortController();
const { signal } = abortController;
const app = new App({ signal });
const app.use(new SomeMiddleware({ abortController }));
app.listen();

Is there an example of a library otherwise compatible with oak that is simply missing a server close()?

oak doesn't aim to be compatible with middleware that wasn't written for it. It is fully embracing Deno and Deno's patterns as well as trying to cut down on the n number of ways to do something that I feel is a challenge with koa and koa-router.

olaven

comment created time in 2 days

push eventoakserver/middleware

Juan González

commit sha ff4218a9381168b4541a0910af3e47eadde50778

Fix responseTimeHeader typo (#3) Fixes #2

view details

push time in 3 days

issue closedoakserver/middleware

responseTypeHeader vs response_time_header

Hi,

In documentation and in the code I'm seeing references for response_time_header and others to responseTypeHeader, is that a typo or is it intentional? which one should be valid? type vs time?

Happy to help if needed!

closed time in 3 days

JuanJo4

PR merged oakserver/middleware

#2 Fix responseTimeHeader typo

Let me know if I'm missing something. I hope that helps!

+4 -4

0 comment

3 changed files

JuanJo4

pr closed time in 3 days

issue commentoakserver/oak

Get Form Values from body.

@devYusuf you need to supply what sort of request you are making and ctx.request.body() returns an Promise<Body> and you are not awaiting the promise or otherwise handling the promise.

devYusuf

comment created time in 3 days

issue commentoakserver/oak

Application state in Routers not typed properly

@Tsourdox yeah, it is an oversight. I am doing a rewrite of the router right now that will include the ability to assert the state as a generic.

Currently though you should be able to do something like this:

new Router().get('/', (ctx: RouterContext<RouteParams, AppState>) => ctx.state);
Tsourdox

comment created time in 3 days

issue commentoakserver/oak

Cannot get params from context

As stated by @LauraBeatris a more complete reproduction is required.

Waxoussou

comment created time in 3 days

issue commentoakserver/oak

Request: Add middleware property to context

This is what ctx.state is for... It can be strongly typed as well, by using the generic. Is there something missing from that?

halvardssm

comment created time in 3 days

issue commentoakserver/oak

Get Form Values from body.

@devYusuf as stated by @LauraBeatris if you are missing a content-type it won't work. If you still think it is an issue, please provide information a complete reproduction, including what the request looks like.

devYusuf

comment created time in 3 days

issue commentoakserver/middleware

responseTypeHeader vs response_time_header

It is unintentional. It all should be "time".

JuanJo4

comment created time in 3 days

issue commentdenoland/deno

Pronunciation

International Phonetic Alphabet: /diˈ-no̩/

billythekid

comment created time in 3 days

push eventoakserver/oak

Daniël Illouz

commit sha 47429e969a193501a9b2f668fb7bd29878f328a0

Fixed typo in middleware paragraph (#112)

view details

push time in 4 days

more