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

csnover/dojo-boilerplate 375

A starting point for developing with Dojo

kitsonk/colors 38

Console colors for Deno

kitsonk/app-example 8

An example Dojo 2 Application

kitsonk/controller 8

Commands and Action Abstractions for Dojo

h-o-t/nocuous 7

A static code analysis tool for JavaScript and TypeScript.

kitsonk/choak 7

An example chat application using Deno and Oak

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 eventoakserver/oak

Kitson Kelly

commit sha c368d30885a1c799fc21676940f899170e5963ab

Test for body parsing invalid content

view details

push time in 4 hours

issue commentdenoland/deno

Deno CLI - allow ts-ignore comments

This should be moved to https://github.com/denoland/deno_lint/

Keimeno

comment created time in 4 hours

issue closedoakserver/oak

Sending Raw text - Server Crush

If we try to use this code, and we send raw text via postman decode will fail.

app.use(async (ctx) => {
  const result = ctx.request.body(); // content type automatically detected
  if (result.type === "json") {
    const value = await result.value; // an object of parsed JSON
  }


here is the error :

error: Uncaught SyntaxError: Unexpected token a in JSON at position 0
          JSON.parse(decoder.decode(await this.#valuePromise()));

    at JSON.parse (<anonymous>)
    at value (body.ts:202:16)

we need internal handling to solve this issue.

closed time in 4 hours

gungunfebrianza

issue commentoakserver/oak

Sending Raw text - Server Crush

The only time the result.type would be set to JSON is when the Content-Type is set to application/json. If you set that content type and then send a body that is invalid JSON, the behaviour you are seeing is to be expected (that an error throws).

If there is a risk that someone might try to send invalid JSON in the payload, you should write the code to handle that properly, in a way that is meaningful to your application. For example:

app.use(async (ctx) => {
  const result = ctx.request.body(); // content type automatically detected
  if (result.type === "json") {
    try {
      const value = await result.value;
    } catch (e) {
      if (e instanceof SyntaxError) {
        ctx.throw(Status.BadRequest, e.message);
      } else {
        ctx.throw(Status.InternalServerError);
      }
    }
  }
});
gungunfebrianza

comment created time in 4 hours

push eventoakserver/oak

Kitson Kelly

commit sha 877785fa1f1cd4ad20d90baac2aa91a28860e467

Update links in docs

view details

push time in 5 hours

issue closedoakserver/oak

Main page shows wrong version as latest, and no changelog

oak

I see that Oak is very much maintained and up-to-date, but on casual inspection, the latest version was released in May. With Deno's rapid development this is very discouraging for potential users. It is very misleading, can it be corrected?

Also, I can't find a changelog, is there one? Cheers.

closed time in 5 hours

David-Else

issue commentoakserver/oak

Main page shows wrong version as latest, and no changelog

That is a behaviour of "releases" in GitHub and it cannot be controlled (like a lot of things on GitHub). Please refer to the tags to determine the latest release. I may "release" every tag in the future, but I am not sure.

There is no change log at this point. Something I will consider in the future.

David-Else

comment created time in 5 hours

issue commentdenoland/deno

Add a way to dynamically import the same module multiple times

Basically what you are asking for is hot module reloading... That is problematic in a lot of ways. ES Modules and their exports are immutable by design. As stated in #5548 we should find better ways to do this to support things like development. There is discussion in #6694 about this as well.

Instead of asking for a specific feature, what use case are you trying to solve?

lem0nify

comment created time in 5 hours

issue commentdenoland/deno

Consider "release" branch of std

It solves enough of this problem to close the issue, certainly.

kitsonk

comment created time in 5 hours

issue closeddenoland/deno

Consider "release" branch of std

We currently committed code to master for std to be compatible with the version of the cli in master, and that flushed out a whole set of people complaining about the breaking changes and code not running. People are either ignoring the warning message, not understanding what it means, or depending on code that depends on master. All which lead to 😠 😭 😖.

Maybe we should introduce a release branch for the purposes of std which is created at the same time as the cli release, and point https://deno.land/std/ at that branch by default instead of master. We can then eliminate the warning code in the cli as well. I believe it is reasonable to expect https://deno.land/std/ to be compatible with the current release of the cli, even though people should still depend on specific versions as a matter of best practice.

closed time in 5 hours

kitsonk

push eventoakserver/oak

Kitson Kelly

commit sha d1e1e69bb0298849b467a0347acf02ad65897de3

Repoint docs at github.io

view details

push time in 7 hours

delete branch oakserver/oak

delete branch : master

delete time in 7 hours

push eventh-o-t/nocuous

Kitson Kelly

commit sha c9e3041deec4ba56ec6c0f3489026d42d5eee9a5

Create codeql-analysis.yml Experiment with code scanning.

view details

push time in 7 hours

issue closedoakserver/oak

Oak website returning 404

Link is in the repo description: https://oakserver.github.io/oak/

closed time in a day

captDaylight

issue commentoakserver/oak

Oak website returning 404

GitHub can now be published of any branch.

captDaylight

comment created time in a day

issue commentdenoland/deno

Add a way to dynamically import the same module multiple times

Why do we even have to store dynamically imported modules in cache?

Because that is very similar to the way browsers work. Clearly dynamic implies something to you that it doesn't actually mean to imply, it means "allow me to conditionally run this code in the current execution context", but all the rules to how modules are fetched, compiled and imported apply whether it be static or dynamic.

Ultimately this is a duplicate of #5548 and #6694

lem0nify

comment created time in a day

pull request commentdenoland/deno

feat(std): add deno_shim for browsers

Yeah, I need to rework it. Certainly possible to do as a seperate package as well.

kitsonk

comment created time in a day

issue commentdenoland/deno

Deno info should not type check

Just for context, there is a small amount of dependencies that not type checking would not catch currently, that would be caught under type checking.

For example:

const a = "./a.ts";
const a_mod = await import(a);

Would be caught under type checking, as the TypeScript compiler realises that value being passed to the dynamic import is statically determinable at call point, and would then make "./a.ts" a dependency of the module.

ry

comment created time in 2 days

issue commentdenoland/deno

SyntaxError on deno info

@bartlomieju looks like the type stripping isn't stripping types. 😭

dangry

comment created time in 4 days

fork kitsonk/deno_lint

Blazing fast linter for JavaScript and TypeScript written in Rust

fork in 4 days

issue closedoakserver/oak

Typing Error with deno latest version 1.2.1 | 'string | URL' is not assignable to parameter of type 'string'.

Code:

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

const body = "Hello World"
const app = new Application();

app.use((ctx) => {
  ctx.response.body = `<!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  </head>
  <body>
    ${body}
  </body>
  </html>`;
});

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

deno --version

Output:

deno 1.2.1
v8 8.5.216
typescript 3.9.2

Error:

error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@0.56.0/path/win32.ts:917:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@0.56.0/path/posix.ts:438:18

Note: It is working file with deno@1.1.3

closed time in 5 days

deepakshrma

issue commentoakserver/oak

Typing Error with deno latest version 1.2.1 | 'string | URL' is not assignable to parameter of type 'string'.

You need to reload your cache deno run --reload whatever.ts.

Please don't use an unpinned version of oak, as it will lead to this very specific issue and is clearly mentioned in the README:

Warning The examples in this README pull from main, which may not make sense to do when you are looking to actually deploy a workload. You would want to "pin" to a particular version which is compatible with the version of Deno you are using and has a fixed set of APIs you would expect. https://deno.land/x/ supports using git tags in the URL to direct you at a particular version. So to use version 3.0.0 of oak, you would want to import https://deno.land/x/oak@v3.0.0/mod.ts.

Currently you should use https://deno.land/x/oak@v6.0.1/mod.ts which is the latest release.

deepakshrma

comment created time in 5 days

issue commentdenoland/deno

Collect and share Deno code coverage

Blocked by #106, we are not going to introduce an external library to instrument the code, we are going to get it directly from V8 and built it into the test harness. There are other solutions for the Rust code, we just need to integrate them into the CI process.

I don't think the lack of code coverage is a big factor in people making a decision about contributing or not, personally.

trivikr

comment created time in 5 days

issue commentdenoland/deno

`deno test` fails to load `Deno` when a tsconfig.json file is present

If you supply a lib attribute in your compiler options, it will always override the defaults, and you need to include deno.ns. What happens when you omit a lib attribute in your tsconfig.json?

matsko

comment created time in 5 days

issue commentdenoland/deno

bundle output contains top-level await.

It should read "some bundles can also be loaded in the web browser". There are all sorts of things that can make bundles incompatible with browsers.

Top level await is already in V8 and being implemented in Chromium, so it will eventually end up in Chrome and Edge.

zhengxiaoyao0716

comment created time in 5 days

issue commentdenoland/vscode_deno

Has this project been abandoned?

We have a close relationship with the TypeScript core team. The problem here is that the main maintainer doesn't have the time to maintain it and so @ry is trying to pick up the challenge as mentioned above. I would personally take it up, but I have limited time to dedicate to Deno at the moment and I've been buried in another thing. We will get it sorted out for sure, but it will take a bit of time.

promethyttrium

comment created time in 5 days

issue commentdenoland/deno

[Discussion]: std/cli

In my opinion, that feels like an highly opinionated "framework" that should start life outside std and only come into std if it become a de facto.

timreichen

comment created time in 5 days

issue commentdenoland/deno

[Discussion]: std/cli

In my opinion, that feels like an highly opinionated "framework" that should start life outside std and only come into std if it become a de facto.

timreichen

comment created time in 5 days

issue commentdenoland/deno

Support access token authorisation for remote files

@pomke the tokens are tied to users, not repos... it would be a limitation that the same user has to have read access to all the repos. That is a limitation that seems reasonable.

kitsonk

comment created time in 5 days

issue commentdenoland/deno

Using Deno bundle programmatically requires the --unstable flag

In fact we will be breaking those APIs: #4752

shardyMBAI

comment created time in 5 days

issue commentdenoland/deno

Support access token authorisation for remote files

We need to get it implemented on the command line and with environment variables first, and iterate from there. We don't need to solve every problem at the start.

kitsonk

comment created time in 5 days

issue commentdenoland/deno

[Feature Request] Public API for TTYs

I don't see how this issue is unique/different from #6706 you opened, which is far more specific about what capabilities you would like to see... For the sake of everyone's sanity, could we try to keep the discussion in one issue, up until there is something actionable that warrants creating multiple issues?

AZMCode

comment created time in 5 days

pull request commentdenoland/deno

BREAKING refactor(std/path): Rename some symbols

This would have no effect without explicitly upgrading std and there's no transitive effect from an intermediary dependency updating its version of std.

That is the residual issue. When we merged with master, we had a load of people up in arms, because they were on 1.1.3 and their dependency was using std from master, which then was breaking. The fix of not serving the main branch, but the latest release with a "bare" specifier wouldn't fix it either, because as soon as we release that version of standard, we would break a lot of libraries that exist out there that are using the latest release of std that would need to be updated. I know it would break the main branch of oak, and the fact that this required changes in 20+ files indicates how pervasive this API. Mostly because there really isn't anything in the browser standards that comes close to providing the functionality, so we have no choice.

I am all for breaking things, but as pointed out, this is 6 of one, half dozen of another. For every argument on this API there is an equal counter argument against. In my mind, the APIs in std are JavaScript convention first, Go Lang second, then other prior art. There is a strong convention with Node.js in this space, and Go Lang is semi-aligned to that. Sadly, Rust is the outlier here.

In my mind, a breaking change that doesn't have a strong compelling argument coupled with wide 3rd party adoption, is a challenge.

nayeemrmn

comment created time in 5 days

pull request commentdenoland/deno

BREAKING refactor(std/path): Rename some symbols

While dirname() is non sensical to some, parent() is non sensical to others.

Go Lang, which is the "default" for std APIs:

  • basename() -> base()
  • dirname() -> dir()
  • extname() -> ext()
  • sep -> separator

Also, this wouldn't be a minor breaking change, it would have significant impacts, and we originally thought correcting URL | string was a good idea and look at the impact that had. If this was a year ago, I would have thought it would be a good conversation to debate, but sadly, I think the cowpath is already paved.

nayeemrmn

comment created time in 5 days

issue commentdenoland/deno

[Feature Request] Public API for TTYs

Duplicate of #6706 and #3456 which was closed by #6520.

AZMCode

comment created time in 6 days

issue commentdenoland/deno

TypeScript compiler in Rust

Possibly... We were talking about introducing a top level option of --isolated in addition to the existing --no-check which would set the config to "isolateModules": true without needing to use a --config tsconfig.json. We could use the code paths then to just do the type checking with no emit and then use the swc type stripping, even before we could do the AST transform. That would be a stepping stone to making that the default in a future version.

kitsonk

comment created time in 6 days

issue commentdenoland/deno

TypeScript compiler in Rust

@bartlomieju after the compiler refactor, my opinion is that we need to investigate the swc AST -> TypeScript AST and feed the compiler pre-parsed AST (this in theory would also open the door to just using tsc for type checking as well, but as we discussed, we can't do that without a significant breaking change, because Deno would only work effectively with "isolatedModules": true).

kitsonk

comment created time in 6 days

push eventkitsonk/deno

Kitson Kelly

commit sha 076547fbbb52b1df9d6db36dd72353bffa9e4a8b

chore: use matches macro for bool matches (#6904)

view details

Ryan Dahl

commit sha b7942bf0f6f151e172db9b1e08cf4436e8365e8b

Change release build flags to optimize for size (#6907)

view details

Bartek Iwańczuk

commit sha 315efbc0e86d9d848efa4b889aefbc665508598a

fix: downcast from SwcDiagnosticBuffer to OpError (#6909)

view details

Bartek Iwańczuk

commit sha c6917133942c791480cd2aec7297b2a2ee623059

refactor: Use SWC to strip types for "--no-check" flag (#6895)

view details

Luca Casonato

commit sha 1b60840f286bc0203a3bd2900f67557a8ff2c3f6

feat(std/async): add pooledMap utility (#6898)

view details

Kitson Kelly

commit sha 97252ece754feb5c09ac07cd38594f5c13f14c67

WIP

view details

push time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha ead32a680b28f7462da2d77e70310949b1b2575f

WIP

view details

push time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha 070ff0dbe1c783fa932278610215c181b62300a7

bump ci

view details

push time in 8 days

issue commentdenoland/deno_website2

example fails when trying to run

Ref denoland/deno#6723 there are changes afoot so that documentation doesn't have to be updated on every release.

apopiak

comment created time in 8 days

pull request commentdenoland/deno

chore(ci): update actions to run on ubuntu-18.04

Everyone had to re-sign the CLA, as the terms were changed.

ry

comment created time in 8 days

push eventkitsonk/deno

Kitson Kelly

commit sha 700f1d922cf9e78875baf4371d53c294b41e978d

chore: use matches macro for bool matches

view details

push time in 8 days

PR opened denoland/deno

chore: use matches macro for bool matches

Nightly clippy flags these up as errors, but there appears to issue with adopting this style prematurely.

+8 -24

0 comment

3 changed files

pr created time in 8 days

create barnchkitsonk/deno

branch : matches_macro

created branch time in 8 days

push eventkitsonk/deno

Bartek Iwańczuk

commit sha 98e0ed54db5bbd8befcb5afbb1d63f2b80677f51

fix: ModuleSpecifier removes relative path parts (#6762)

view details

Ryan Dahl

commit sha 6c637f04bf70b631c363ef9c87303e7d7dcdc633

refactor(cli): Remove dead code (#6765)

view details

Casper Beyer

commit sha de3416689175214f33b226d4c510da63737c0db9

fix(std/wasi): remove number overload from rights in path_open (#6768)

view details

JohannLai

commit sha d60f9c2549c7dfb0fbd6c9c8984c215f5dd75e76

fix(cli/js/web): IPv6 hostname should be compressed (#6772)

view details

David Sherret

commit sha 2d58fee8071987567a25f26b14e29cdcca9cb5ab

Update dprint. Also ignore gh-pages dir. (#6778)

view details

uki00a

commit sha 121eaa4efcaa5c8a4cab25eed15de07642e0407d

fix(std/encoding/toml): could not parse strings with apostrophes/semicolons (#6781)

view details

Bartek Iwańczuk

commit sha 6e34f6a7cca11ba245f0b55c3b956b59948b37b7

fix: providing empty source code for missing compiled files (#6760) This commit adds a fallback mechanism for absent compiled source file. Because imported type declaration files are not emitted by TS compiler and their imports are not elided users often hit "No such file or directory" error. With this commit in such situation an empty source file will be provided to V8 with a warning to the user suggesting using "import type"/ "export type" syntax instead.

view details

Bartek Iwańczuk

commit sha da48fa42d309e32684210a8d30ec3fc7ef7079df

chore: update Rust to 1.45.0 (#6791)

view details

Luca Casonato

commit sha 071a6e284aaaa26d40300b82d9f4cbb15a4dd6f5

Share reqwest client between fetch calls (#6792)

view details

sonota88

commit sha aebea6bd24dc1788c6db2f58204177af1c5d2dd6

doc(std/bytes): Fix wrong import in the example code (copyBytes) (#6787)

view details

Bert Belder

commit sha faa64edaf409757549a7df85812f6ea4f368051c

Upgrade to rusty_v8 0.7.0 (#6801)

view details

Jason Miller

commit sha c587450cd458514d8ae17d1fb649b1d36bb4649e

typo (#6800)

view details

木杉

commit sha 53adde866dd399aa2509d14508642fce37afb8f5

refactor(std/path): enrich the types in parse_format_test (#6803)

view details

Bartek Iwańczuk

commit sha fa61956f03491101b6ef64423ea2f1f73af26a73

Port internal TS code to JS (#6793) Co-authored-by: Ryan Dahl <ry@tinyclouds.org>

view details

Ryan Dahl

commit sha 628c10b55259f9d2b215b4203c2228062da189dc

fix benchmark_test (#6814)

view details

crowlKats

commit sha 903d28f872b90a800c64339dea058806cde0be67

Remove duplicate code and allow filename overwrite for DomFile (#6817)

view details

Ryan Dahl

commit sha 2460689b1a9582ef6ab8c5fa429e281c88bc14d1

Remove deno_typescript (#6813)

view details

木杉

commit sha f34a441a7d3e3e5c1517207a1ee2ed2a0eaee0c9

fix(tools/lint): don't exceed max command line length on windows (#6804)

view details

crowlKats

commit sha 9d13b539b5dfc96e2b5a0e89fc8e0312d6500fff

Fix lastModified for DomFile in FormData (#6830)

view details

Ryan Dahl

commit sha bf9930066d3a5d26baad22fb1766de26be49c2ae

Reduce size of TypeScript Compiler snapshot (#6809) This PR is intentionally ugly. It duplicates all of the code in cli/js2/ into cli/tsc/ ... because it's very important that we all understand that this code is unnecessarily duplicated in our binary. I hope this ugliness provides the motivation to clean it up. The typescript git submodule is removed, because it's a very large repo and contains all sorts of stuff we don't need. Instead the necessary files are copied directly into the deno repo. Hence +200k lines. COMPILER_SNAPSHOT.bin size ``` master 3448139 this branch 3320972 ``` Fixes #6812

view details

push time in 8 days

push eventkitsonk/deno

Kitson Kelly

commit sha 204c4f2179f7ecba3427750d506aa7480205b2f5

WIP

view details

push time in 8 days

issue commentmicrosoft/TypeScript

Symbols disallowed as object keys

Duplicate of #1863

00ff0000red

comment created time in 8 days

pull request commentdenoland/deno

[WIP] Refactor the compiler

Can you git mv the various typescript files so the diff was easier to look at?

If I did that right now, it would break CLI, so I have simply hacked around it for now.

kitsonk

comment created time in 8 days

push eventkitsonk/deno

Kitson Kelly

commit sha 6294ebb5abf9fe746937551c4ffa4879571f74b3

WIP

view details

push time in 8 days

push eventoakserver/oak

Kitson Kelly

commit sha 0bcffbb05e772ae2e7a598dfac83de1efece79b8

Fix CI configuration

view details

push time in 8 days

issue commentoakserver/oak

Add Eslint

deno lint was added in 59782a5917c58187b27c490d0a3cb69b1a3aa7ac.

cktang88

comment created time in 8 days

push eventoakserver/oak

Kitson Kelly

commit sha 59782a5917c58187b27c490d0a3cb69b1a3aa7ac

Lint code and add deno lint to pipeline

view details

push time in 8 days

issue openeddenoland/deno_lint

False positive on no-this-alias

The following code triggers the rule no-this-alias inappropriately:

const { value } = this;

The rule should be catching only things like this:

const self = this;

created time in 8 days

push eventoakserver/media_types

Kitson Kelly

commit sha 0167e1bcfba6ff2f0c62034cf7d8e667728cdebf

Add deno lint to CI

view details

push time in 8 days

Pull request review commentdenoland/deno

Use SWC to strip types for "--no-check" flag

 mod tests {     let source_code = compiled_file.code;     assert!(source_code       .as_bytes()-      .starts_with(b"console.log(\"Hello World\");"));+      .starts_with(b"console.log('Hello World');"));

Super yucky! It really shouldn't be doing that.

bartlomieju

comment created time in 8 days

issue commentoakserver/oak

Sharing state between middlewares using the context

The context is the same, trust me.

Why you don't think it is the same is that .cookies.get() only looks at cookie values in the request and not anything in the response. Because of the support for verified keys, I am not too keen on changing the behaviour, it would make it appear that the cookie is actually part of the request, when it isn't.

I would simply have the middleware move the session state in and out of the context.state... So something like this:

let sessionId = context.cookies.get(SESSION_ID);
let state;
if (!sessionId) {
  sessionId = // new guid
  context.cookies.set(SESSION_ID, sessionId);
  // init state
}
context.state.session = // get state 
await next();
// whatever other cleanup, persistence, whatever
delete context.state.session;

That way, consumers of your middleware don't have to even think about it, they will simply use:

context.state.session.whatever
domenichelfenstein

comment created time in 8 days

issue commentdenoland/deno

Question: install scripts with external assets

npm install -g with a postinstall hook ~can add~ has added your computer to a crypto-mining farm (in the past)

swwind

comment created time in 8 days

issue commentdenoland/deno

`deno bundle <file> -m` (minifier)

We already use swc in Deno. Again this is still a long term goal, as there are a load of other things we need to do (including ones related to bundling, see: #4549) before this became a priority, some of which would block this (source maps for example).

Zacharys-Hackery

comment created time in 8 days

pull request commentdenoland/deno

Use SWC to strip types for "--no-check" flag

I agree that compiler refactor is important, I don't suggest trying to hook SWC up to type checking process in this PR. Are you ok with landing change just for --no-check?

Yeah, I hadn't actually looked at the changes... straight forwards and should be easy to integrate. 👍

Thinking more, we might want to help people make the transition. I know we have avoided it, but if we surfaced --isolated as an option for run and check, then people would be able to easily run their code in type check and get back errors that are more meaningful to what they need to fix in order to support just type stripping. It would make the introduction of the breaking change easier.

bartlomieju

comment created time in 8 days

issue commentdenoland/deno

`deno bundle <file> -m` (minifier)

This would be a long term goal.

We couldn't use uglify as it doesn't work with modern JavaScript, uglify-es is no longer maintained, terser is the successor to uglify. Even then we wouldn't use it. We would look to swc though its minification likely needs improvement.

Zacharys-Hackery

comment created time in 8 days

issue commentdenoland/deno

Deno with Hermes?

Also, Hermes is significantly slower than V8 as well (34 times slower based on that benchmark). I am afraid there are a lot better paths to #986 than using Hermes.

randallb

comment created time in 8 days

pull request commentdenoland/deno

Use SWC to strip types for "--no-check" flag

Couple thoughts... I know we are eager to do this, but I think the refactor of the compiler is important (#6894). This should be even easier to implement when that is redone.

Second, we can't use it for the type checking without breaking a lot of code in the wild, especially code that doesn't use export type and import type plus const enum and potentially other code. (You want to run it with "isolatedModules": true so that the type checking is as close to just type stripping as possible). Honestly we wouldn't be able to do that until 2.0 IMO.

bartlomieju

comment created time in 8 days

push eventkitsonk/deno

Kitson Kelly

commit sha 5d1bccfe5eed699bcb34aa13d7363d389ab23e8f

WIP

view details

push time in 9 days

PR opened denoland/deno

[WIP] Refactor the compiler

This is a major refactor of the TypeScript compilation infrastructure. Raising for early visibility, but it is still very much a work in progress. It totally rewrites how the compilations are handled to abstract out the logic, which should make it easier to move parts and pieces in the future, at the same time leveraging more Rust infrastructure and signficantly "dumbing" down the interface to the TypeScript compiler.

Currently it is a seperate crate as that has been easier for me to work on it without having to deal with merge conflicts and other changes.

Currently I have the following working:

  • Ability to create snapshots with custom libs (like deno.ns).
  • Ability to compile a set of sources and specify any custom libs to type check against.
  • Ability to transpile an arbitrary set of sources.

Things that I need to do:

  • Introduce bundling, which the bundle creation will be done in Rust, using the TypeScript compiler just for type checking and transpilation.
  • Finish off the display of the diagnostics.
  • Look at moving the dependency graph logic in.
  • Integrate into the CLI.

When finished this will:

Fixes #5606 Fixes #5607 Fixes #6686

+29 -0

0 comment

2 changed files

pr created time in 9 days

issue commentdenoland/deno

std should be checked with strict type checking

This should be closed.

ry

comment created time in 9 days

create barnchkitsonk/deno

branch : deno_compiler

created branch time in 9 days

Pull request review commentswc-project/swc

Fix bugs

+{+  "type": "Module",+  "span": {+    "start": 14,+    "end": 45,+    "ctxt": 0+  },+  "body": [+    {+      "type": "ExportAllDeclaration",+      "span": {+        "start": 14,+        "end": 45,+        "ctxt": 0+      },+      "source": {+        "type": "StringLiteral",+        "span": {+          "start": 33,+          "end": 45,+          "ctxt": 0+        },+        "value": "../typings",+        "hasEscape": false+      }+    }+  ],

Babel and typescript-eslint set exportKind to "type" instead of "value": https://astexplorer.net/#/gist/408ad6e07e866fd7743725e9073bdf5b/74e0f25919bf3f997a3d83dee2a3635fc701156a. TypeScript transpileOnly() will always strip export type and import type statements. The main reason the syntax was introduced was to make type stripping possible (as export ... from ... cannot be statically determined to be a type or not).

Erroring I suspect would be a challenge, since it is valid TypeScript and we wouldn't want to @ts-ignore it.

kdy1

comment created time in 9 days

issue commentoakserver/oak

Sharing state between middlewares using the context

Normally you don't want to grab a reference to the context, but instead have a middleware that does pre and post processing before other middleware that needs that occurs. It could set something in the .state per request, like:

app.use(async (context, next) => {
  context.state.session = "whatever";
  await next();
  delete context.state.session;
});

If you are obsessed about hiding it, use a symbol that only you have reference to as the key.

But if you are really obsessed about hiding it:

const myPrivateData = new WeakMap();
myPrivateData.set(context, "something");

The context object is the same object through the handling of the request.

domenichelfenstein

comment created time in 9 days

push eventoakserver/oak

Kitson Kelly

commit sha eca47926692a9f3d53c02fe24a213dd57c008328

Update to Deno 1.2.1, std 0.62.0, media_types 2.4.3

view details

push time in 9 days

created tagoakserver/media_types

tagv2.4.3

A module that assists in resolving media types and extensions.

created time in 9 days

PR closed oakserver/media_types

Upgrade std lib to 0.62.0

Because of these types of issues: https://github.com/deligenius/view-engine/issues/13

+2 -2

1 comment

2 changed files

spedy

pr closed time in 9 days

pull request commentoakserver/media_types

Upgrade std lib to 0.62.0

Thanks, but needed to upgrade the Deno version for CI as well as fix the formatting error.

Fixed in f3623d95f17a12ad0dbf7c5780736b515edc29fd

spedy

comment created time in 9 days

push eventoakserver/media_types

Kitson Kelly

commit sha f3623d95f17a12ad0dbf7c5780736b515edc29fd

Update to Deno 1.2.1 and std 0.62.0

view details

push time in 9 days

pull request commentdenoland/deno_third_party

Update to TypeScript 3.9.7

This will not update the Deno CLI to TypeScript 3.9.7. This simply updates the version of TypeScript typescript-eslint uses.

trivikr

comment created time in 10 days

issue commentdenoland/deno

Using @deno-types breaks Deno.bundle() imports

Duplicate of #6338

randallb

comment created time in 10 days

issue commentdenoland/deno

TypeScript compiler in Rust

Regarding the type stripping: #6864 is the tracking issue.

kitsonk

comment created time in 10 days

issue commentoakserver/oak

Sharing state between middlewares using the context

context.state? Which can be strongly typed using generics?

domenichelfenstein

comment created time in 11 days

issue commentdenoland/deno

Stream API for HTTP requests (Server implements ReadableStream<ServerRequest>)

@jimmywarting unless it gets implemented in the standard, it won't get implemented in Deno.

rsp

comment created time in 11 days

issue commentdenoland/deno

Efficiency/speed proposal: just strip types

As stated this is already implemented, and we have plans for improving it.

Also see #5432 which is effectively the master issue for all this work.

sdegutis

comment created time in 11 days

issue commentdenoland/deno

Fetch API doesn't respect forbidden headers

Ah, I mis-read what you said. I thought you were suggesting the behaviour of Deno was to silently drop the cookie header, but it is browsers.

The problem is fetch() will always behave differently in a server context and a client context. You have all the situations with same origin and cross origin which just don't make sense in a server context. I am still just for documenting it. As you state, Node's implementation just passes forbidden as well.

It is that or we implement some sort of cookie jar per origin that manages the cookies itself, and set the cookies on the document if you "really" want browser compatibility, but that just doesn't seem logical to me.

nayeemrmn

comment created time in 11 days

issue commentoakserver/oak

ctx.response.headers.set() going to lowercase

I see that two, just because someone posts something on Stack Overflow as an answer doesn't make it true. I specifically tested against IE11 and had no issue with content-type. I suggest you try it yourself as well.

narwy

comment created time in 11 days

issue commentdenoland/deno

Move config parsing out of js/compiler.ts

In my refactor of the compiler branch, I have all of the parsing and processing of the tsconfig, including the ignoring the options we ignore in Rust now.

kitsonk

comment created time in 11 days

issue commentdenoland/deno

Compiler Hints cause issues with bundle

Duplicate of #6338

mcbobby123

comment created time in 11 days

issue commentdenoland/deno

Fetch API doesn't respect forbidden headers

The behaviour is to silently drop them, at least in Chrome. I just did:

await fetch("http://localhost:8000", { headers: new Headers([["cookie", "foo=bar"]]) });

And it simply stripped the cookie header. The reason why they are forbidden is because the user agent controls them, and can't be overridden by user land. We should simply document the behaviour in my opinion, since there is no browser error when passed.

nayeemrmn

comment created time in 11 days

issue commentdenoland/deno

Argument of type 'string | URL' is not assignable to parameter of type 'string'

@chovy that additional error you have is that the code is not --no-check safe. ./levels.ts is re-exporting a type that does not have a runtime emit. So instead of export { SomeInterface } from "whatever.ts" you should use export type { SomeInterface } from "whatever.ts".

gungunfebrianza

comment created time in 11 days

issue commentdenoland/deno

deno test on 1.2.0 - broken with TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.

deno info --no-check main.ts should give you a full dependency tree.

aricart

comment created time in 11 days

pull request commentdenoland/deno

fix: deno-types directive should have higher precedence than X-TypeScript-Types header

Well, and a lot of folks who want to support Deno and Node.js with a single distributable of JavaScript plus TypeScript types. It would mean a lot of folks would not be able to consume that JavaScript in a type safe way as the authors intended.

bartlomieju

comment created time in 11 days

issue commentoakserver/oak

ctx.response.headers.set() going to lowercase

I just tried with IE11 and had no issues with an all lowercase content type.

narwy

comment created time in 11 days

issue commentoakserver/oak

ctx.response.headers.set() going to lowercase

Correct. That is the behaviour of Headers() in the browser, of which the Deno implementation is used underneath: https://fetch.spec.whatwg.org/#terminology-headers.

Is this causing some sort of problem? It shouldn't.

narwy

comment created time in 12 days

issue commentdenoland/deno

Deno v1.1.x fails with TypeScript error in deno test

There are a lot of things that "work" at runtime that aren't valid when you type check. If you don't want to type check it, use --no-check or // @ts-nocheck in the file.

adrai

comment created time in 12 days

issue commentoakserver/oak

error: Uncaught PermissionDenied: network access to "127.0.0.1:8000", run again with the --allow-net flag

It was valid at the time the bug was reported. Deno has changed since then.

peidrao

comment created time in 13 days

issue commentdenoland/deno

Support module type augmentation

As you pointed out Deno does support it. You just have to know the module name. Let alone augmenting existing TypeScript is "dangerous" in my opinion, like augmenting built in globals.

Your best approach is to import whatever you want, augment it, and re-export it, and any code the needs the argumentation would depend on that re-export.

Cretezy

comment created time in 13 days

issue commentdenoland/deno

feature-request: first-class test-coverage support

No. There are big reactors in the internals at the moment which make this something that would need to come afterwards.

bcoe

comment created time in 13 days

issue commentdenoland/deno

Argument of type 'string | URL' is not assignable to parameter of type 'string'

You should replace deps.ts with a file that you have on your local machine. Likely what you run with deno run ....

gungunfebrianza

comment created time in 14 days

issue commentdenoland/deno

import map on transpileOnly

Deno.transpileOnly does not resolve modules at all. You have to supply it sources. An import map makes no sense in that context.

newtack

comment created time in 14 days

issue commentdenoland/deno

Argument of type 'string | URL' is not assignable to parameter of type 'string'

@reselbob your problem is the same as the others. You are using Deno 1.2.0, but some dependency of yours is pulling in std prior to 0.61.0 (the log states it is 0.57.0). You need to identify the offending dependency and update it.

gungunfebrianza

comment created time in 14 days

issue commentdenoland/deno

Go-like Importing Scheme

Everything is just an explicit URL with no "magic" resolution. This proposal would require magical resolution and coupling to things like how code is structured in GitHub. That is not something that Deno wants to do.

For the Deno namespace, if the Built-in modules proposal for ECMAScript/JavaScript ever got close to being adopted, Deno would consider using that syntax to make the Deno namespace a built-in module.

ZiQiLN

comment created time in 15 days

issue commentdenoland/deno

deno bundle @ts-nocheck must appear in first 5 lines

So, why wouldn't it be an issue for the plugin?

brandonkal

comment created time in 15 days

issue commentdenoland/deno

deno bundle @ts-nocheck must appear in first 5 lines

the first 5 lines at least in VSCode

Using what plugin? Why would this be an issue for the Deno CLI? Not entirely sure what problem this is causing either.

brandonkal

comment created time in 15 days

more