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 380

A starting point for developing with Dojo

kitsonk/colors 39

Console colors for Deno

kitsonk/app-example 8

An example Dojo 2 Application

kitsonk/controller 8

Commands and Action Abstractions for Dojo

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

kitsonk/api-viewer 1

Viewer for output of js-doc-parse

push eventkitsonk/deno

Kitson Kelly

commit sha f76ab9c80618651f2860db3dd11006832d132ecd

WIP

view details

push time in 4 hours

push eventkitsonk/deno

Bert Belder

commit sha 25467aa7c7852c3695091a547ffac4857478c037

Add blanket impl for the 'Resource' trait (#3903)

view details

Bert Belder

commit sha f650c3edb3081ac0433b338c0c99418171656dd1

Refactor deno_core_http_bench and make it single-threaded (#3903)

view details

Kevin (Kun) "Kassimo" Qian

commit sha 619a24390ff15d5ea5e577a4d0391823f94e8592

install: add --force flag and remove yes/no prompt (#3917)

view details

Bartek Iwańczuk

commit sha cdba5ab6fc633606aaa6f95d0825832c3ac6fe5c

refactor: rename ThreadSafeState, use RefCell for mutable state (#3931) * rename ThreadSafeState to State * State stores InnerState wrapped in Rc and RefCell

view details

Yusuke Sakurai

commit sha a4bb8bab44cc778e6e455f19fdae9f3e4acc809b

remove non-null assertion operator from std (part2) (#3927)

view details

Bartek Iwańczuk

commit sha 1c0ffa138355c7eb90fd5d3c01f799245636bcc0

reenable server tests (#3928)

view details

Kevin (Kun) "Kassimo" Qian

commit sha 506601841218fe34a744c8fce0f1011c716bdc73

fmt: `deno fmt -` formats stdin and print to stdout (#3920)

view details

Nikolai Vavilov

commit sha 61c5bb86db42a2d575f51e966dbc77f711c64054

Bump required VS version (#3940) deno builds successfully with VS2019, so no need to require VS2017.

view details

Andy Finch

commit sha 1abd408770f6dc4205a471bb79d48b643f53074d

No longer require aligned buffer for shared queue (#3935) Fixes: #3925

view details

Benny Shi

commit sha e8f639ce53c5a232c84d499b0d6375a2d2ad7131

Add readlink, readlinkSync for std/node/fs.ts (#3926)

view details

Yusuke Sakurai

commit sha e6f204199b1a1f6c5d963da2b8cdfc5992656147

feat: Support HTTP trailer headers for response (#3938)

view details

Ryan Dahl

commit sha e1105a159406d8b64a833fa3266fd4ac7fc47a00

upgrade: dprint-plugin-typescript 0.5.0 (#3952)

view details

Chris Knight

commit sha 81905a867ea3f942619229e330840d132c57a5da

feat: Event emitter node polyfill (#3944)

view details

Bartek Iwańczuk

commit sha 79b3bc05d6de520f1df73face1744ae3d8be0bb8

workers: basic event loop (#3828) * establish basic event loop for workers * make "self.close()" inside worker * remove "runWorkerMessageLoop() - instead manually call global function in Rust when message arrives. This is done in preparation for structured clone * refactor "WorkerChannel" and use distinct structs for internal and external channels; "WorkerChannelsInternal" and "WorkerHandle" * move "State.worker_channels_internal" to "Worker.internal_channels" * add "WorkerEvent" enum for child->host communication; currently "Message(Buf)" and "Error(ErrBox)" variants are supported * add tests for nested workers * add tests for worker throwing error on startup

view details

Nayeem Rahman

commit sha 701ce9b3342647cf01cb23c4fc28bc99ce0aa8c1

refactor: Use PathBuf for paths in flag parsing and whitelists (#3955) * Use PathBuf for DenoSubcommand::Bundle's out_file * Use PathBuf for DenoSubcommand::Format's files * Use PathBuf for DenoSubcommand::Install's dir * Use PathBuf for read/write whitelists

view details

Bartek Iwańczuk

commit sha a3bfbcceade3d359f677106399562b461b4af01a

refactor: rewrite deno test, add Deno.test() (#3865) * rewrite test runner in Rust * migrate "test" and "runTests" functions from std to "Deno" namespace * use "Deno.test()" to run internal JS unit tests * remove std downloads for Deno subcommands

view details

uki00a

commit sha 5a143cdbd34df590a24ec756a6319a89d7656e5c

fix(std/node): support named import for EventEmitter (#3959)

view details

Bartek Iwańczuk

commit sha e0bcecee6042b219c6626172851af5a25362b948

refactor: Remove atomics from metrics (#3968) * replace "AtomicUsize" with "u64" for field type on "Metrics" * move "compiler_starts" field from "Metrics" to "GlobalState"

view details

Bartek Iwańczuk

commit sha 61273085e40fb4d992eef4b1b5601e3567c80664

refactor: rewrite tests in std/ to use Deno.test (#3930)

view details

Bartek Iwańczuk

commit sha b67f20be3b5234bad2565c1770fa89d49942b342

update references to testing/mod.ts in manual (#3973)

view details

push time in 4 hours

PR opened denoland/deno

Support types compiler option in compiler APIs.

This PR provides functionality to handles types in the compiler APIs to make it easier to supply external type libraries.

This will make it easier to supply "pre-configured" helpers in std to compile things like React based code.

+91 -7

0 comment

6 changed files

pr created time in 5 hours

create barnchkitsonk/deno

branch : compiler-api-types

created branch time in 5 hours

issue commentdenoland/deno

New cache layout broke VS code plugin

Just to point out, base32 or base64 do seem a bit of overkill... they are designed to encode arbitrary data. URLs can only contain a certain set of characters. Though I am not aware of an encoding that is file safe that only deals with encoding valid URL characters.

The following text:

raw.githubusercontent.com/microsoft/TypeScript/v3.7.2/lib/lib.dom.d.ts

Encodes in base-32 as:

OJQXOLTHNF2GQ5LCOVZWK4TDN5XHIZLOOQXGG33NF5WWSY3SN5ZW6ZTUF5KHS4DFKNRXE2LQOQXXMMZOG4XDEL3MNFRC63DJMIXGI33NFZSC45DT

Also, from an encoding perspective, domains are case-insensitive, while that path and query are case sensitive.

ry

comment created time in 11 hours

issue commentdenoland/deno

Add TestDefinition::skip

I said harder, not impossible.

nayeemrmn

comment created time in a day

issue commentdenoland/deno

Recommended in documentation "file_server" compiles with error

Yes, we deploy breaking changes to master at the moment, which can mean that unless you are using a version of Deno off of master, other things on master won't work.

We should either update the manual automatically with the current latest tag as the part of the build process, or put an example/caveat there of how to use the pinned version. We can't just expect people to "know" that.

balajahe

comment created time in a day

push eventkitsonk/deno

Ryan Dahl

commit sha f47f3f96726a94dd2df5d68e3c786b5079089dd4

Remove _async from method names since _sync are gone (#4128)

view details

Kitson Kelly

commit sha be787d09d537d6c1a6846168613dd0defe069448

upgrade: TypeScript 3.8 (#4100)

view details

João Souto

commit sha e53064c4f22efeb8a4eda2712e15c77d2699a686

Port permission_prompt_tests to Rust (#4129)

view details

push time in a day

pull request commentdenoland/deno

Bundles can be sync or async based on top level await

Shouldn't the modules instantiate synchronously?

Not if there is top level await... modules instantiate asynchronously which has to bubble up to a top level await, otherwise you can't support bundling top level await modules. The was the whole reason to move System from AMD, because AMD will likely never support asynchronous module instantiation, while as System accommodated it. System aligns to the way the module instantiation happens when there is a TLA in an ESM module and TypeScript emits TLA modules to that standard.

kitsonk

comment created time in a day

pull request commentdenoland/deno

Bundles can be sync or async based on top level await

This is rebase of master which includes 3.8, so this should be ready to go.

kitsonk

comment created time in a day

push eventkitsonk/deno

Ryan Dahl

commit sha 91b606aaae23bcb790b55adc5fe70a182a37d564

Clean up how we use opIds (#4118)

view details

Nayeem Rahman

commit sha 14e7e1e3af43b2322a26fcc542428c8f1af4460d

fix: Resolve makeTemp* paths from CWD (#4104)

view details

Ryan Dahl

commit sha fe181e2b4850a83344f0aa5840fffe97c8cb8839

ci: Use fetch-depth: 5 (#4127)

view details

Ryan Dahl

commit sha f47f3f96726a94dd2df5d68e3c786b5079089dd4

Remove _async from method names since _sync are gone (#4128)

view details

Kitson Kelly

commit sha be787d09d537d6c1a6846168613dd0defe069448

upgrade: TypeScript 3.8 (#4100)

view details

João Souto

commit sha e53064c4f22efeb8a4eda2712e15c77d2699a686

Port permission_prompt_tests to Rust (#4129)

view details

Kitson Kelly

commit sha 9d9c7b8c951141bef41644c602b6086da84c47d3

Bundles can be sync or async based on top level await Previously, bundles always utilised top level await, even if the bundled modules didn't require top level await. Now, analysis of the bundle is done and if none of the bundled modules are asynchronously executed, then the bundle as a whole will be synchronously executed. Fixes #4055 Fixes #4123

view details

Kitson Kelly

commit sha ec77b6662e9aab9e353124bf821dcbb1d2838167

linting

view details

Kitson Kelly

commit sha e7eaf30f3508dde4e967a51aaa31abfb1bfa6d58

fix tests

view details

Kitson Kelly

commit sha 4db7e049d3743a080e57350962e47162ea069e30

fix tests

view details

Kitson Kelly

commit sha e6d7951e67b849d7e424ee8026033b1ccb8adcb6

fix tests

view details

push time in a day

issue commentdenoland/deno

local modules?

It certainly would help if you do a bit of searching before opening issues and keep the issue tracker to issue.

General use questions should be done in other channels, like Gitter.

trusktr

comment created time in a day

push eventkitsonk/deno

Yusuke Sakurai

commit sha 22f88b9f37b7e233fd4f15b73d5a2096224e56dc

fix: [http] Consume unread body and trailers before reading next request (#3990) - Added `ServerRequest.finalize()`: consuming all unread body stream and trailers. - This is cleanup method for reading next request from same keep-alive connection. - Needed when handler didn't consume all body and trailers even after responding. - refactor: `ServerRequest._bodyStream()`, `ServerRequestBody` are removed. - Now using `bodyReader()` and `chunkedBodyReader()` instead. - fix: Trailers should only be read `transfer-encoding` is `chunked` and `trailer` header is set and its value is valid. - fix: use `Headers.append()` on reading trailers. - fix: delete `trailer` field from headers after reading trailers. - reorg: Several functions related to IO are moved into `http/io.ts`

view details

Kitson Kelly

commit sha 805992b14a65a6dbfb857dea6d9b657477de043d

Fix issues with JavaScript importing JavaScript. (#4120) Fixes #3852 Fixes #4117

view details

Ryan Dahl

commit sha 91b606aaae23bcb790b55adc5fe70a182a37d564

Clean up how we use opIds (#4118)

view details

Nayeem Rahman

commit sha 14e7e1e3af43b2322a26fcc542428c8f1af4460d

fix: Resolve makeTemp* paths from CWD (#4104)

view details

Ryan Dahl

commit sha fe181e2b4850a83344f0aa5840fffe97c8cb8839

ci: Use fetch-depth: 5 (#4127)

view details

push time in 2 days

created tagoakserver/oak

tagv3.1.0

A middleware framework for Deno's net server

created time in 2 days

push eventoakserver/oak

Kitson Kelly

commit sha 52e2c8ad0f6a44821059b665ffcceb7fd512c72a

Update to Deno 0.34

view details

push time in 2 days

issue commentdenoland/deno

Add TestDefinition::skip

The only problem with that, is that it makes it harder to do a conditional skip. For example, you might want to skip on a particular OS for a time period:

Deno.test({
  skip: Deno.build.os === "win",
  name: "skip on windows",
  fn() { /* ... */ }
}

It is also easier to comment out or remove...

nayeemrmn

comment created time in 2 days

push eventkitsonk/deno

Kitson Kelly

commit sha 3d3f35694d71c0d98dd0b94242ec6c12b82df8f1

fix tests

view details

push time in 2 days

push eventkitsonk/deno

Kitson Kelly

commit sha 78ea52ec1682b0d5df44c80612f64c3c479e6d34

fix tests

view details

push time in 2 days

push eventkitsonk/deno

Kitson Kelly

commit sha 9e2454ac785788ad7c7f0440ce18eaf8bd2c3be7

fix tests

view details

push time in 2 days

pull request commentdenoland/deno

Bundles can be sync or async based on top level await

Side note, I also believe that once this is landed, I can refactor deno_typescript and the snapshots to use the same bundler code, which seems logical while it might take a while to have ESM modules injected directly into the isolate for snapshotting.

kitsonk

comment created time in 2 days

push eventkitsonk/deno

Kitson Kelly

commit sha f465cbdd1cef2a4fe0f00f4333084cb94607792b

linting

view details

push time in 2 days

PR opened denoland/deno

Bundles can be sync or async based on top level await

Previously, bundles always utilised top level await, even if the bundled modules didn't require top level await. This PR performs analysis of the bundle and if none of the bundled modules are asynchronously executed, then the bundle as a whole will be synchronously instantiated.

This does mean though that if a bundled module uses top level await, that will bubble up into the bundle, and currently be incompatible with the browser. TLA in bundles though won't work until #4100 is merged.

Also this also introduces some minor improvements in the bundle loader which make it even more terse and cryptic in order to save space.

Fixes #4055 Fixes #4123

+51 -30

0 comment

2 changed files

pr created time in 2 days

create barnchkitsonk/deno

branch : no-tla-bundles

created branch time in 2 days

issue openeddenoland/deno

feat: bundles always use TLA, though browsers don't support TLA

As point out in https://github.com/denoland/deno/issues/4031#issuecomment-590178526 the changes to the bundles to support TLA in TypeScript 3.8 also forced all bundles to require support of TLA, even if none of the modules in the bundle required TLA. We should fix this since browser support for TLA seems a way off.

created time in 2 days

PR opened denoland/deno

Fix issues with JavaScript importing JavaScript.

Fixes #3852 Fixes #4117

This is just a "tactical" fix for the moment addressing an unintentional regression introduced in #4009/#4040. A larger change needs to happen in order to ensure that the compiler deals effectively with JavaScript files imported into TypeScript files where type checking of those JavaScript files is not desired (ref #4078) as well as provide good support when type checking and transformation is desired (ref #4110).

+20 -5

0 comment

7 changed files

pr created time in 2 days

create barnchkitsonk/deno

branch : fix-js-issues

created branch time in 2 days

Pull request review commentdenoland/deno

Clean up how we use opIds

 function cache(   } } -let OP_FETCH_ASSET: number; const encoder = new TextEncoder(); const decoder = new TextDecoder();  /** Retrieve an asset from Rust. */ export function getAsset(name: string): string {-  if (!OP_FETCH_ASSET) {-    OP_FETCH_ASSET = core.ops()["fetch_asset"];-  }+  const opId = core.ops()["fetch_asset"];

slightly inefficient in that core.ops() will get called on every asset fetch during bundling...

ry

comment created time in 2 days

issue commentdenoland/deno

remote CDN imports not being properly resolved

Hrmmmm... yeah, it was all in the same domain space of trying to "improve" import detection problems on some modules (ref: #4040 #4010 #4110 #4078)

The use cases help, just need to figure out how to make everyone happy.

FredKSchott

comment created time in 2 days

push eventkitsonk/deno

Yusuke Sakurai

commit sha 162d66d23fe984d7ac0396faacb8800f19a719fd

fix: chat example's content-security-policy (#4091)

view details

uki00a

commit sha fe9ac35a650dfeea9168fc1cbbbf323b5689fc3b

fix(std/examples): add tests for examples (#4094)

view details

ecyrbe

commit sha fb08cf7005c9dc781d51c7d02ae06060e44d32a3

Add missing node os.release() implementation (#4065)

view details

Yoshiya Hinosawa

commit sha c080d7fba34fa9114e191b171d6a810312d74343

fix: add mutex guard for permission_prompt tests (#4105) This PR introduces the mutex guard for the test cases which depends on the permission prompt mocking utility. permission_request test cases depend on the mocked (dummy) value of the permission_prompt result. The value is stored at static STUB_PROMPT_VALUE: AtomicBool and these test cases share this value. So we should lock at the start of these test cases. Before this change cargo test permission failed 6 times out of 20. After this change, 0 times out of 20 (on my mac).

view details

João Souto

commit sha c250778704a4e0065e54e6bf6ca6c39d556a6d8d

Remove ansi_term dependency (#4106)

view details

Matthew Lennon

commit sha c74684ed901b7313c317aa32aaad92841b3cd6d3

update build instructions for windows (#4027)

view details

Bartek Iwańczuk

commit sha 5da7c7df1d8649ddb5628b4dc830aa8c23ccb488

disable std/examples/chat tests for windows (#4109)

view details

Kitson Kelly

commit sha 2b7e28b591a6947f76ddf9a53f49eec8f1accc0f

feat: Add Deno.formatDiagnostics (#4032)

view details

Nayeem Rahman

commit sha db597055958a9dbc9c8e633e01d9229b55d1d6ef

doc: Remove old link to deno types output (#4111)

view details

Bartek Iwańczuk

commit sha e1687c0a4616e90d4bbde42b13a0356a7f6a1e7d

rename Deno.Err -> Deno.errors (#4093)

view details

Ryan Dahl

commit sha f4fd433e1aa6c8c086c38df39c39bec23c56a29c

Add Deno.Err change missing from previous commit (#4113)

view details

Suguru Motegi

commit sha 79c6e052ed29b9b78c31f2e01da3b91f76b6a017

fix: createSecKey logic (#4063)

view details

Ryan Dahl

commit sha 4005174f6c584fd5200dbe450b269a7f0de487ce

Revert "Remove ansi_term dependency" Broke colors https://github.com/denoland/deno/issues/4112#issuecomment-590545385 This reverts commit c250778704a4e0065e54e6bf6ca6c39d556a6d8d.

view details

João Souto

commit sha ac933dd1b89a20b2e63b5d6edc5b3d0c549335bc

port tools/repl_test.py to Rust (#4096) ref #2988

view details

João Souto

commit sha 5c1ab080cd8989c3ac2b3a8c919fe14052feac79

Remove ansi_term dependency (#4116)

view details

push time in 2 days

issue commentdenoland/deno

Prevent modules imported through https to internally import http modules

@ry you are right...

While I can't find anything official in any standards, it looks like all implementations follow CORS rules. The most concise source is here: https://jakearchibald.com/2017/es-modules-in-browsers/#always-cors. Browsers also prevent/block downgrades, so an http:// import from a https:// imported module should be disallowed, while a https:// import from an http:// module would be allowed.

It is hard to apply the CORS model to Deno though, but blocking downgrades... It is arguable that whatever we do would apply to fetch() as well.

kevinkassimo

comment created time in 2 days

issue commentdenoland/deno

[bug] deno bundle generate broken code

While it might be complicated, I think I can detect when a bundle contains modules that are using TLA, and pass in something that will change the instantiation from async to sync. Let me see if I can do that.

saostad

comment created time in 3 days

issue commentdenoland/deno

New cache layout broke VS code plugin

Would a distributed manifest be a problem. We already write out the headers, so write out in some sort of meta data file the original URL? That would put the work on the plugin to go and collect all the meta-data files to create a map, and what the FS events on the DENO_DIR for any new files and add them to the cache. For Deno it would be still be O(1).

ry

comment created time in 3 days

issue commentdenoland/deno

Prevent modules imported through https to internally import http modules

Browsers don't support FQDN imports within modules, I believe. If they did, then CORS rules would likely apply.

kevinkassimo

comment created time in 3 days

issue commentdenoland/deno

discussion: error classes

Only problem is the name of the class would be PermissionDenied and lose the error. I don't know if that is a problem, but default logging would be:

error: Uncaught PermissionDenied: msg

Instead of:

error: Uncaught PermissionDeniedError: msg

Which is more aligned to other JavaScript errors.

ry

comment created time in 3 days

Pull request review commentdenoland/deno

Update to TypeScript 3.8

 for (const filename of filenames) {   await Deno.copy(Deno.stdout, file);   file.close(); }+export {};

If we ignore it, we need to check the emit on bundles... as TypeScript might not emit an async function for the module, which it didn't do in TS 3.7.

kitsonk

comment created time in 3 days

Pull request review commentdenoland/deno

Update to TypeScript 3.8

 export const ignoredDiagnostics = [   // TS1103: 'for-await-of' statement is only allowed within an async function   // or async generator.   1103,

No, I believe technically it is seperate from top level await in TC39 and isn't stage 3 yet. 🤷‍♂

kitsonk

comment created time in 3 days

Pull request review commentdenoland/deno

Update to TypeScript 3.8

 for (const filename of filenames) {   await Deno.copy(Deno.stdout, file);   file.close(); }+export {};

I honestly don't think you can unless you really do something ugly behind the scenes. See: https://github.com/microsoft/TypeScript/issues/18232. There is a Stage 1 proposal to try to fix it: https://github.com/tc39/proposal-modules-pragma.

Maybe we should just ignore the error again, because we never have non-modules.

kitsonk

comment created time in 3 days

Pull request review commentdenoland/deno

Update to TypeScript 3.8

+third_party/node_modules

Mentioned above https://github.com/denoland/deno/pull/4100#issuecomment-590150784

kitsonk

comment created time in 3 days

Pull request review commentdenoland/deno

Update to TypeScript 3.8

 class Host {     /** @type {ts.ResolvedModule[]} */     const r = resolvedNames.map(resolvedFileName => {       const extension = getExtension(resolvedFileName);+      if (!moduleMap.has(resolvedFileName)) {+        // If we match the external specifier regex, we will then create an internal+        // specifier and then use that when creating the source file+        const result = externalSpecifierRegEx.exec(resolvedFileName);

Ok... But file://foo/bar/baz/deno/js/compiler.ts gets transformed into $deno$/js/compiler.ts. I have simply moved what was already there.

kitsonk

comment created time in 3 days

issue commentdenoland/deno

Inconsistent UX between `deno run` and `deno test`

My only argument is that it should be normalized across OSes and should include the full path that was attempted to be resolved. Sometimes with complex relative URLs, it might hard to determine what is what.

kitsonk

comment created time in 3 days

issue commentdenoland/deno

[bug] deno bundle generate broken code

@ry, well the problem is they don't have a choice now, because the bundle loader works in an async way in order to accomodate bundling modules that require TLA, which means that we have to instantiate the loader using TLA. So until browsers support TLA, it means Deno bundles would not work in browsers.

saostad

comment created time in 3 days

pull request commentdenoland/deno

[feat] Continuation of node fs polyfill with directory support

I'm not sure but I think VS Code / ESLint probably sniff for tsconfig.json and assumes non-strict when it doesn't find it. Maybe @kitsonk can give more clues.

It would be up to whatever plugin to determine what to configure the language service yet. If it is @axetroy plugin, then I don't know if he has defaulted to strict mode now under Deno.

cknight

comment created time in 3 days

issue commentdenoland/deno

Odd behavior when using a function called "define" and checkJs together

Yeah, there are a few things that I need to work through to get everything right.

ry

comment created time in 3 days

push eventkitsonk/deno

push time in 3 days

push eventkitsonk/deno

Kitson Kelly

commit sha 16009f9c1d1b24b5e6e2cfb5fa278bde6fa638ac

Fix tests

view details

push time in 3 days

push eventkitsonk/deno

Kitson Kelly

commit sha 475c620e424a8d7f58142e9ce54590f9fd87cf26

Fix tests

view details

push time in 3 days

push eventkitsonk/deno

Kitson Kelly

commit sha 087e960506fb7265d305bb53243241d8a896e52f

Revert impl trait NoneError

view details

push time in 3 days

issue commentdenoland/deno

[bug] deno bundle generate broken code

My personal opinion is that we don't hold up support top level await in bundles. We have been supporting it in Deno ever since it was implemented in V8 (and wanted to support it earlier).

The only solution is that if the main module has no exports, we could drop the await, but it if does, we need to have the await there.

@ry thoughts?

saostad

comment created time in 3 days

Pull request review commentdenoland/deno

feat: Add Deno.formatDiagnostics to provide formatting of compiler diagnostics

 fn op_apply_source_map(     "column": orig_column as u32,   }))) }++fn op_format_diagnostic(+  _state: &State,+  args: Value,+  _zero_copy: Option<ZeroCopyBuf>,+) -> Result<JsonOp, ErrBox> {+  let diagnostic = Diagnostic::from_json_value(&args);+  let result = format!("{}", diagnostic.unwrap());+  Ok(JsonOp::Sync(json!({ "result": result })))

Hmmm... can't use the feature on the stable channel, so I will have to remove it.

kitsonk

comment created time in 3 days

push eventkitsonk/deno

木杉

commit sha 6dd964384509e71598d08ae09c59f5f2c035a135

upgrade: dprint 0.6.1 (#4061)

view details

Bartek Iwańczuk

commit sha d9efb8c02a0036d755c35e8e9c88d58bd45a9e2b

fix: add io ops to worker to fix fetch (#4054)

view details

Bartek Iwańczuk

commit sha dd8a10948195f231a6a9eb652e3f208813904ad6

refactor: remove unneeded ErrorKinds (#3936)

view details

hazæ41

commit sha 08686cbc3ae63008837ee45b2c4f41d6674c57dd

feat: support UDP sockets (#3946)

view details

ecyrbe

commit sha 754b8c65ad5adda2961c667a6b64ab59c130111d

feat(std/node) : add os.platform (#4064)

view details

Bartek Iwańczuk

commit sha bd640bc7e6a946dec4477afc64d8083e372660f6

feat: Deno.fsEvents() (#3452)

view details

jigsaw

commit sha c34d96d86557d434bdf124063e4eec4662067c1e

Fix example (#4076)

view details

ecyrbe

commit sha fb98556d56d0defa325fab1296077627cce31aab

feat(std/node): add os.loadavg() (#4075)

view details

Yusuke Sakurai

commit sha 8b646e8657309e57bd4e907f911529e33e3a05fb

Added browser chat example (#4022)

view details

EnokMan

commit sha 14129b6c8f3335b215a2d9614c4523e8e3200e82

feat: support brotli compression for fetch API (#4082)

view details

Kevin (Kun) "Kassimo" Qian

commit sha bf48f5fa5a15e01d6f8b7eb7c3e70f6ecc91fa23

Move WebAsssembly namespace to shared_globals (#4084)

view details

Kevin (Kun) "Kassimo" Qian

commit sha e9fff02e9681f3eb2edee9f94db66b140e179899

fetch: proper error for unsupported protocol (#4085)

view details

Yusuke Sakurai

commit sha d9886a44d107de48b312ba71833709494b5ade5e

fix: [ws] sock shouldn't throw eof error when failed to read frame (#4083)

view details

Ben Noordhuis

commit sha 45eb2f9b37c2c7498c58eb45f76667aaa4a7d731

feat(std/node): add os Symbol.toPrimitive methods (#4073) Node's os module exports a number of methods that evaluate to themselves when coerced to a primitive. I.e., `"" + os.arch` and `os.arch()` evaluate to the same string, and now Deno's shims do too.

view details

Bartek Iwańczuk

commit sha 4e1abb4f3a1fbdac25b1e7db0588572e4d5a6579

refactor: use OpError instead of ErrBox for errors in ops (#4058) To better reflect changes in error types in JS from #3662 this PR changes default error type used in ops from "ErrBox" to "OpError". "OpError" is a type that can be sent over to JSON; it has all information needed to construct error in JavaScript. That made "GetErrorKind" trait useless and so it was removed altogether. To provide compatibility with previous use of "ErrBox" an implementation of "From<ErrBox> for OpError" was added, however, it is an escape hatch and ops implementors should strive to use "OpError" directly.

view details

Kitson Kelly

commit sha 8c8d44f7c0439645b9267af56de2644455375880

[std] Add diagnostic formatting util

view details

Kitson Kelly

commit sha fc4d990bffa994c909899815ca99a83380b0bc43

Add Deno.formatDiagnostics

view details

Kitson Kelly

commit sha ba297a90fff9f54dd73843e191167d54a62e68da

Address feedback

view details

push time in 3 days

Pull request review commentdenoland/deno

feat: Add Deno.formatDiagnostics to provide formatting of compiler diagnostics

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++import { assertEquals, test } from "./test_util.ts";++const { formatDiagnostics } = Deno;++const fixture01: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 2,+    code: 4000+  }+];++const expected01 = `error TS4000: Example error++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ^+`;++const fixture02: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4000+  }+];++const expected02 = `error TS4000: Example error++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~+`;++const fixture03: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    messageChain: {+      message: "First level",+      category: Deno.DiagnosticCategory.Error,+      code: 4001,+      next: [+        {+          message: "Level 2 01",+          category: Deno.DiagnosticCategory.Error,+          code: 4002+        },+        {+          message: "Level 2 02",+          category: Deno.DiagnosticCategory.Error,+          code: 4003,+          next: [+            {+              message: "Level 3 01",+              category: Deno.DiagnosticCategory.Error,+              code: 4004+            }+          ]+        }+      ]+    },+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4000+  }+];++const expected03 = `error TS4000: First level+  Level 2 01+  Level 2 02+    Level 3 01++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~+`;++const fixture04: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    relatedInformation: [+      {+        message: "Related information",+        category: Deno.DiagnosticCategory.Info,+        sourceLine: "1234567890",+        lineNumber: 99,+        scriptResourceName: "foo.ts",+        startColumn: 3,+        endColumn: 7,+        code: 1000+      }+    ],+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4000+  }+];++const expected04 = `error TS4000: Example error++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~++  Related information++    ► foo.ts:100:4++    100 1234567890+           ~~~~++`;++const fixture05: Deno.DiagnosticItem[] = [+  {+    message: "Error 001",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4000+  },+  {+    message: "Error 002",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4001+  },+  {+    message: "Error 003",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4002+  },+  {+    message: "Error 004",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4003+  }+];++const expected05 = `error TS4000: Error 001++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~++error TS4001: Error 002++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~++error TS4002: Error 003++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~++error TS4003: Error 004++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~+++Found 4 errors.+`;++test(function formatDiagnosticBasic() {+  const actual = formatDiagnostics(fixture01);+  assertEquals(actual, expected01);+});++test(function formatDiagnosticColSpan() {+  const actual = formatDiagnostics(fixture02);+  assertEquals(actual, expected02);+});++test(function formatDiagnosticMessageChain() {+  const actual = formatDiagnostics(fixture03);+  assertEquals(actual, expected03);+});++test(function formatDiagnosticRelatedInfo() {+  const actual = formatDiagnostics(fixture04);+  assertEquals(actual, expected04);+});++test(function formatDiagnosticRelatedInfo() {+  const actual = formatDiagnostics(fixture05);+  assertEquals(actual, expected05);+});

It panics at the moment, because the DiagnosticItem.from_json_value() liberally uses .unwrap() when picking values out of the JSON structure. It would require a lot of refactoring to bubble that back up to the OP, so the OP could return something that isn't panicky (unless there is an easier way I am not aware of).

I would prefer to open another issue to deal with refactoring that and returning something non-panicky.

kitsonk

comment created time in 3 days

Pull request review commentdenoland/deno

feat: Add Deno.formatDiagnostics to provide formatting of compiler diagnostics

 fn op_apply_source_map(     "column": orig_column as u32,   }))) }++fn op_format_diagnostic(+  _state: &State,+  args: Value,+  _zero_copy: Option<ZeroCopyBuf>,+) -> Result<JsonOp, ErrBox> {+  let diagnostic = Diagnostic::from_json_value(&args);+  let result = format!("{}", diagnostic.unwrap());+  Ok(JsonOp::Sync(json!({ "result": result })))
the trait `std::convert::From<std::option::NoneError>` is not implemented for `op_error::OpError`

So it requires implementing NoneError, which is still experimental, which I have done... not sure if you really want that though.

kitsonk

comment created time in 3 days

issue openeddenoland/deno

Inconsistent UX between `deno run` and `deno test`

On a mac:

> deno test bad_module.ts
No such file or directory (os error 2)

Versus:

> deno run bad_module.ts
Cannot resolve module "file:///Users/kkelly/github/deno/bad_module.ts"

The deno run is far more informative and consistent across OSes.

created time in 3 days

issue commentdenoland/deno

Expose zlib ops

The path wouldn't be from rusty_v8. zlib is available in the Rust side of the deno crate. What needs to occur is an op from the runtime to a Rust function in the Deno crate that will handle the compression and decompression.

I think we need a bit of agreement on what the API should look like. In Go, compression like zlib uses the Reader and Writer type of interfaces. On the other hand, the web standards tend more towards the encoder/decoder type of concept, with no ability for back pressure (ref: TextEncoder).

Also, there is the consideration of actual use cases... lets say you have a file or a network connection that is encoded with a particular type of compression... you would want to op from Rust into JavaScript to just send it back via an op to Rust to be uncompressed... so how would we efficiently pipeline those activities?

hazae41

comment created time in 3 days

issue openeddenoland/deno

[bug] importing JSON doesn't work in bundles

Breaking this out of #4062 as the fix might land differently.

JSON is not importable to bundles currently. This is because we need to do the transformation into an ESM ourselves, as TypeScript will strongly type it, but expects the host to do the transformation.

created time in 3 days

push eventkitsonk/deno

木杉

commit sha 6dd964384509e71598d08ae09c59f5f2c035a135

upgrade: dprint 0.6.1 (#4061)

view details

Bartek Iwańczuk

commit sha d9efb8c02a0036d755c35e8e9c88d58bd45a9e2b

fix: add io ops to worker to fix fetch (#4054)

view details

Bartek Iwańczuk

commit sha dd8a10948195f231a6a9eb652e3f208813904ad6

refactor: remove unneeded ErrorKinds (#3936)

view details

hazæ41

commit sha 08686cbc3ae63008837ee45b2c4f41d6674c57dd

feat: support UDP sockets (#3946)

view details

ecyrbe

commit sha 754b8c65ad5adda2961c667a6b64ab59c130111d

feat(std/node) : add os.platform (#4064)

view details

Bartek Iwańczuk

commit sha bd640bc7e6a946dec4477afc64d8083e372660f6

feat: Deno.fsEvents() (#3452)

view details

jigsaw

commit sha c34d96d86557d434bdf124063e4eec4662067c1e

Fix example (#4076)

view details

ecyrbe

commit sha fb98556d56d0defa325fab1296077627cce31aab

feat(std/node): add os.loadavg() (#4075)

view details

Yusuke Sakurai

commit sha 8b646e8657309e57bd4e907f911529e33e3a05fb

Added browser chat example (#4022)

view details

EnokMan

commit sha 14129b6c8f3335b215a2d9614c4523e8e3200e82

feat: support brotli compression for fetch API (#4082)

view details

Kevin (Kun) "Kassimo" Qian

commit sha bf48f5fa5a15e01d6f8b7eb7c3e70f6ecc91fa23

Move WebAsssembly namespace to shared_globals (#4084)

view details

Kevin (Kun) "Kassimo" Qian

commit sha e9fff02e9681f3eb2edee9f94db66b140e179899

fetch: proper error for unsupported protocol (#4085)

view details

Yusuke Sakurai

commit sha d9886a44d107de48b312ba71833709494b5ade5e

fix: [ws] sock shouldn't throw eof error when failed to read frame (#4083)

view details

Ben Noordhuis

commit sha 45eb2f9b37c2c7498c58eb45f76667aaa4a7d731

feat(std/node): add os Symbol.toPrimitive methods (#4073) Node's os module exports a number of methods that evaluate to themselves when coerced to a primitive. I.e., `"" + os.arch` and `os.arch()` evaluate to the same string, and now Deno's shims do too.

view details

Bartek Iwańczuk

commit sha 4e1abb4f3a1fbdac25b1e7db0588572e4d5a6579

refactor: use OpError instead of ErrBox for errors in ops (#4058) To better reflect changes in error types in JS from #3662 this PR changes default error type used in ops from "ErrBox" to "OpError". "OpError" is a type that can be sent over to JSON; it has all information needed to construct error in JavaScript. That made "GetErrorKind" trait useless and so it was removed altogether. To provide compatibility with previous use of "ErrBox" an implementation of "From<ErrBox> for OpError" was added, however, it is an escape hatch and ops implementors should strive to use "OpError" directly.

view details

push time in 3 days

push eventkitsonk/deno

Kitson Kelly

commit sha 0ec4adbe4cf5cd516477dd0d3b5dbe2a0eab6f5d

Fix TLA in std/examples

view details

push time in 3 days

issue commentdenoland/deno

discussion: adopt baretest-like testing API

Personally, I don't feel we need to introduce a class to make all this happen.

How are capabilities like test setup and teardown work in Rust? That model seems to be very effective for us. I believe there is effectively block of code that are only included in the final binary and run when you do a test build, and the implementation of anything fancy is left up to the implementor.

I think we should really think minimalistic, otherwise we will be in the test harness business, not the JavaScript/TypeScript runtime business.

bartlomieju

comment created time in 3 days

pull request commentdenoland/deno

Update to TypeScript 3.8

Note on adding (back) a symbolic link for node_modules... it seems recent versions of eslint throw if this isn't present, stating the plugins referenced in the config are invalid. I haven't chased down what or how this was introduced, or if there is a better workaround.

The error is like this:

Oops! Something went wrong! :(

ESLint: 6.8.0.

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/home/runner/work/deno/deno".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

eslint

We need to have more current version of eslint and associated plugins to make sure we are supporting things like TLA and private fields that were recently introduced to ECMAScript and supported in TypeScript.

kitsonk

comment created time in 3 days

push eventkitsonk/deno

Kitson Kelly

commit sha a7626ad3b479a09e6203ec4771a7541666f2dcb2

Formatting 🤦

view details

push time in 3 days

push eventkitsonk/deno

Kitson Kelly

commit sha 6ae458586829af0c56e8e04f2d526bc1e84d9ad6

Check symbolic link in for node_modules There was a change/regression with eslint where it requires a symbolic link now to node_modules in order to resolve all the plugins.

view details

push time in 3 days

PR opened denoland/deno

Update to TypeScript 3.8

This PR updates Deno to TypeScript 3.8.

In regards to top-level-await, TypeScript will throw if the input does not look like a module (as top-level-await is not supported in scripts). The TypeScript error recommends adding export {}; to the file, which is the current idiomatic way of identifying a module as a module that otherwise has no imports or exports.

Resolves #3937 Resolves #3301 Resolves #3391

+78 -25

0 comment

13 changed files

pr created time in 3 days

create barnchkitsonk/deno

branch : ts38

created branch time in 3 days

issue commentdenoland/deno

Support TypeScript 3.8

I've got a branch working, but there was a change in behaviour in TypeScript 3.8. Previously, source maps generated by TypeScript utilised the fileName from the SourceFile. Now they appear to use the filename provided by CompilerHost.resolveModules(). The problem was that when we created the source file, when building the internal bundles, we would replace the file:// specifier which specific to the system it was built on with $deno$ so that stack traces would provide an internal identifier when code occurred there.

I am going to have to move the logic we have from CompilerHost.getSourceFile() to CompilerHost.resolveModules(), but that is what is taking a bit longer than a straight forward upgrade.

kitsonk

comment created time in 3 days

push eventkitsonk/deno_third_party

Kitson Kelly

commit sha b1103a02e8112a20126c84d2d4751ed1302c8ade

Add prettier plugins for eslint

view details

push time in 3 days

issue commentdenoland/deno

discussion: move asserts to Deno.assert

The swmi-concen is top level bloat of Deno stuff. At one point we decorated assert with properties so you could do assert() or assert.equals(). Personally I would like us to do that again (along with refactoring the display logic to Deno.test().

I haven't looked in depth of the logic of diff. It would be really good if it was really general purpose. I built one (which also provided a patch() which could apply mutations as well. I can dig it out.

bartlomieju

comment created time in 4 days

issue commentdenoland/deno

discussion: error classes

At first I thought Deno.Errors because namespace tend to be capitalised, but then I remembered Symbol.wellKnown contains a load of symbols, so Deno.errrors containing a bunch of error classes seems fine. I agree Err or err is way too terse.

ry

comment created time in 4 days

issue commentdenoland/deno

discussion: move asserts to Deno.assert

Personal opinion, we should only move assert and AssertionError class, instead of dragging in a whole load of stuff. Those can be built upon downstream, but it really should be up to the test harness to format an assertion error when it throws.

I suggested AssertionError a way back, but I didn't fully articulate what it should be, and now that I had more experience in this space in a side project, I believe AssertionError should be:

class AssertionError extends Error {
  expected?: any;
  actual?: any;
  showDiff?: boolean;

  constructor(message: string) {
    super(message);
    this.name = "AssertionError";
  }
}

And the display logic though be figured out by whomever catches the AssertionError instead of the display logic being in the assertion. This would make it compatible with other test harnesses (like Jest for example). While Jest doesn't respect the showDiff flag, there are other libraries that do. This would move all the display logic to Deno.test or whatever other harness people used.

bartlomieju

comment created time in 4 days

issue commentdenoland/deno

TypeScript compilation hangs on large files

I haven't tried it yet, but the equivalent of Deno would be though:

tsc -m es6 --target esnext --allowJs --strict module.ts

I suspect you would get a different compile time there, as tsc would access the JavaScript file. I think we need to consider the impact of having allowJs on by default while not having checkJs on by default, as it appears to be causing a few issues. There are a couple other things we might be able to do too, to trick the compiler with JavaScript files.

aduh95

comment created time in 4 days

issue commentdenoland/deno

[bug] Can't import jspm modules

shouldn't it just skip type checking for JavaScript files, but still fully resolve module graph?

Why, it is not doing anything with them. Why would it need to check and resolve the dependency graph? It was checking the dependency graph that was causing problems in other places. The problem though here is that the initial .ts file pulls in a .js file that we now don't analyse the imports for, and the compiler expects all imports to be there. I think I know what the problem is.

I guess ultimately though, we really shouldn't even be trying to load something like jsdom into the compiler. Ideally a @deno-types pragma would be used and then that would work perfect. The problem of course is that @types/jsdom isn't very Deno friendly because it imports in a couple of other dependent types and relies on Node.js resolution logic. We really need a way to "bundle" types for Deno, so that all that could be preprocessed and a complete type file handed to Deno.

FedericoMorrone

comment created time in 5 days

issue commentdenoland/deno

New cache layout broke VS code plugin

I'm not sure it would be that horrible versus the current situation. We already write out headers and other stuff, and we don't expire stuff in the cache, so if we are intelligent about it, we wouldn't even touch the file unless we are actually writing out something to the cache. Also Deno shouldn't use it internally as an index or anything, it simply should write stuff out. If someone deletes only a part of a cache but doesn't delete the manifest file, that is there problem.

ry

comment created time in 5 days

issue commentdenoland/deno

New cache layout broke VS code plugin

What if there was a manifest in $DENO_DIR/deps that contained information like:

{
  "https://deno.land/foo/bar.ts": "https/deno.land/11d2ae31f7817c87b53893788205d431da511568dcd7bb9c363c6e52fb21a7fd"
}

Potentially more data could be cached in the key, like if there were redirects from the requested URL to the final one.

ry

comment created time in 6 days

issue commentdenoland/deno

rewrite compiler_imports.ts::processImports to Rust

If I'm not mistaken this step requires to parse AST of each file

It doesn't, it only does effectively a pattern match for import like statements. Ergo why it is preprocess, and quicker.

In my mind the earlier steps were to produce the AST for deno ast/Deno.ast() and see how that goes. Doing the dependency analysis would be the logical next step.

Some thoughts I shared with Ry:

Thinking out loud. Looked at swc. The parser is based off of Babel and so the AST is Babel like. The types are parsed and are part of the AST, but transforming it into TS AST for type checking would be tough. But from a transform, emit perspective it has everything we need.

It does in theory make tree shaking possible, as the Babel AST is estree like.

I still think it would be good to start by exposing the parser and maybe the transformer in the runtime.

bartlomieju

comment created time in 6 days

issue commentdenoland/deno

Deno.sh domain

Or some place in St. Helena I've never heard of.

JerryGreen

comment created time in 6 days

issue openeddenoland/deno

[bug] dynamic import not working in bundles

Dynamic import is not working in bundles. While the static analysis of the dependencies is occurring, the module specifier is being passed unmodified, which means it is up to the bundle code to resolve the specifier.

Also, importing of JSON doesn't work in the bundle. The source JSON is simply inlined into the bundle.

created time in 6 days

issue commentdenoland/deno

[bug] default function in deno bundle is not a function

I think bundling bundles is crazy personally... but hey, who am I to say.

The problem is that bundles require TLA, because System is needed to support TLA, the problem is TypeScript 3.7 isn't able to support TLA, so effectively we can't bundle a bundle under TS 3.7, because bundles now need TLA. TS 3.7 just came out, which I am working on a PR right now, which should restore the functionality.

alexanderGalushka

comment created time in 6 days

Pull request review commentdenoland/deno

feat: Add Deno.formatDiagnostics to provide formatting of compiler diagnostics

+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.++import { assertEquals, test } from "./test_util.ts";++const { formatDiagnostics } = Deno;++const fixture01: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 2,+    code: 4000+  }+];++const expected01 = `error TS4000: Example error++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ^+`;++const fixture02: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4000+  }+];++const expected02 = `error TS4000: Example error++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~+`;++const fixture03: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    messageChain: {+      message: "First level",+      category: Deno.DiagnosticCategory.Error,+      code: 4001,+      next: [+        {+          message: "Level 2 01",+          category: Deno.DiagnosticCategory.Error,+          code: 4002+        },+        {+          message: "Level 2 02",+          category: Deno.DiagnosticCategory.Error,+          code: 4003,+          next: [+            {+              message: "Level 3 01",+              category: Deno.DiagnosticCategory.Error,+              code: 4004+            }+          ]+        }+      ]+    },+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4000+  }+];++const expected03 = `error TS4000: First level+  Level 2 01+  Level 2 02+    Level 3 01++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~+`;++const fixture04: Deno.DiagnosticItem[] = [+  {+    message: "Example error",+    relatedInformation: [+      {+        message: "Related information",+        category: Deno.DiagnosticCategory.Info,+        sourceLine: "1234567890",+        lineNumber: 99,+        scriptResourceName: "foo.ts",+        startColumn: 3,+        endColumn: 7,+        code: 1000+      }+    ],+    category: Deno.DiagnosticCategory.Error,+    sourceLine: "abcdefghijklmnopqrstuv",+    lineNumber: 1000,+    scriptResourceName: "foo.ts",+    startColumn: 1,+    endColumn: 5,+    code: 4000+  }+];++const expected04 = `error TS4000: Example error++► foo.ts:1001:2++1001 abcdefghijklmnopqrstuv+      ~~~~++  Related information++    ► foo.ts:100:4++    100 1234567890+           ~~~~++`;

I tried stripping the ANSI codes using a regex, it didn't work. I should try again. Doing just .includes() feels like it would not be good coverage.

kitsonk

comment created time in 6 days

Pull request review commentdenoland/deno

feat: Add Deno.formatDiagnostics to provide formatting of compiler diagnostics

 import "./url_test.ts"; import "./url_search_params_test.ts"; import "./utime_test.ts"; import "./write_file_test.ts";++// The ordering of these cannot be alphabetical

Sorry, I should have completed it... I went in there and got frustrated that they weren't all alphabetical, reordered them, and the permissions stuff has to come later, so I backed out my change, put half a comment there out of frustration, but didn't filly explain it.

kitsonk

comment created time in 6 days

issue commentdenoland/deno

[bug] default function in deno bundle is not a function

Hmmmm... bundling bundles. We certainly didn't design for that.

Is there a specific reason why you are bundling worker-fn.ts instead of just passing it on new Worker()?

alexanderGalushka

comment created time in 6 days

push eventkitsonk/deno_third_party

Kitson Kelly

commit sha 6178d94bdbe2f51b066575ea81c32b92768110fd

Update to TypeScript 3.8

view details

Kitson Kelly

commit sha 52590eca89f1982fad65a0ecd571e2d8f89b8299

Update eslint typescript-eslint

view details

push time in 6 days

issue openedaxetroy/vscode-deno

Utilise TS 3.8 language extension auto import

I figured this feature in TS 3.8 would be useful: https://github.com/microsoft/TypeScript/pull/36725

created time in 6 days

push eventkitsonk/deno

Kitson Kelly

commit sha 6d7f5255764b80d3d4ef3915135391a2d6cf5874

Add Deno.formatDiagnostics

view details

push time in 6 days

push eventkitsonk/deno

Clemens Tolboom

commit sha 7e49d96cbcde1e8eb89d0fdd499be473822b725b

/std/ws: Fix args index for WS examples (#4046)

view details

Ryan Dahl

commit sha a0d3b4ebc509d9e5dfca555084fd1100e114664a

v0.34.0

view details

push time in 6 days

push eventkitsonk/deno

Clemens Tolboom

commit sha 7e49d96cbcde1e8eb89d0fdd499be473822b725b

/std/ws: Fix args index for WS examples (#4046)

view details

Ryan Dahl

commit sha a0d3b4ebc509d9e5dfca555084fd1100e114664a

v0.34.0

view details

Kitson Kelly

commit sha 92281d42e3fdff66a60c56e57ad1ac80926857c7

[std] Add diagnostic formatting util

view details

Kitson Kelly

commit sha 6d66ac63831b3b86f77fa775bfd871c3a9909ee8

Convert to an op and add Deno.formatDiagnostics

view details

Kitson Kelly

commit sha 95233212620a17c1d6cf9faabcd4142ebb9866b0

Fix linting issue

view details

push time in 6 days

issue commentdenoland/deno

Deno.sh domain

I personally like deno.land, I don't personally thing .sh domains are cooler.

JerryGreen

comment created time in 6 days

issue commentdenoland/deno

[bug] default function in deno bundle is not a function

I can't re-create this...

Given an input of:

export default function cubeIt(req: any, res: any) {
  const result = 3*3*3;
  res.send({ date: new Date(), result });
}

I get an output of:

// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

// This is a specialised implementation of a System module loader.

// eslint-disable-next-line @typescript-eslint/no-unused-vars
let System;
let __inst;

(() => {
  const mMap = new Map();
  System = {
    register(id, deps, f) {
      mMap.set(id, {
        id,
        deps,
        f,
        exp: {}
      });
    }
  };

  const gC = (data, main) => {
    const { id } = data;
    return {
      id,
      import: async id => mMap.get(id)?.exp,
      meta: { url: id, main }
    };
  };

  const gE = data => {
    const { exp } = data;
    return (id, value) => {
      const values = typeof id === "string" ? { [id]: value } : id;
      for (const [id, value] of Object.entries(values)) {
        Object.defineProperty(exp, id, {
          value,
          writable: true,
          enumerable: true
        });
      }
    };
  };

  const iQ = [];

  const enq = ids => {
    for (const id of ids) {
      if (!iQ.includes(id)) {
        const { deps } = mMap.get(id);
        iQ.push(id);
        enq(deps);
      }
    }
  };

  const dr = async main => {
    const rQ = [];
    let id;
    while ((id = iQ.pop())) {
      const m = mMap.get(id);
      const { f } = m;
      if (!f) {
        return;
      }
      rQ.push([m.deps, f(gE(m), gC(m, id === main))]);
      m.f = undefined;
    }
    let r;
    while ((r = rQ.shift())) {
      const [deps, { execute, setters }] = r;
      for (let i = 0; i < deps.length; i++) setters[i](mMap.get(deps[i])?.exp);
      const e = execute();
      if (e) await e;
    }
  };

  __inst = async id => {
    System = undefined;
    __inst = undefined;
    enq([id]);
    await dr(id);
    return mMap.get(id)?.exp;
  };
})();

System.register("exp_def", [], function (exports_1, context_1) {
    "use strict";
    var __moduleName = context_1 && context_1.id;
    function cubeIt(req, res) {
        const result = 3 * 3 * 3;
        res.send({ date: new Date(), result });
    }
    exports_1("default", cubeIt);
    return {
        setters: [],
        execute: function () {
        }
    };
});

const __exp = await __inst("exp_def");
export default __exp["default"];

Which when I then create another file that imports it:

import fn from "./test.bundle.js";

console.log(fn);

I get the following:

[Function: cubeIt]
alexanderGalushka

comment created time in 6 days

issue commentdenoland/deno

User libraries should be strict by default if written in TypeScript

Per-module permissions/config/etc. are a rabbit hole I don't think we really want to go down. Non-strict code does no one any favours. If people can't get the upstream code to be strict, using tsconfig.json and setting "strict": false is what people should do in my opinion.

Ciantic

comment created time in 6 days

issue commentdenoland/deno

Deno.sh domain

I don't believe we ever controlled that domain, nor officially used it in any capacity.

JerryGreen

comment created time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha a6dab9095d64dc4a579e62a22f29137bae95ce4b

Fix linting issue

view details

push time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha 046bbb26913f9da58b0d23ae331e9dab9dc19e59

Support loading additional TS lib files (#3863) Fixes #3726 This PR provides support for referencing other lib files (like lib.dom.d.ts that are not used by default in Deno.

view details

Bartek Iwańczuk

commit sha 852823fa505d75d61e70e1330bbf366aa248e650

refactor: rewrite HTTP cache for file fetcher (#4030)

view details

Maximilien Mellen

commit sha 90125566bbaed8b5c6e55ca8dbc432e3433fb73c

Enable TS strict mode by default (#3899) Fixes #3324 Co-authored-by: Kitson Kelly <me@kitsonkelly.com>

view details

Bartek Iwańczuk

commit sha 742a16b5069b2a6dee200d908df54fab77408581

refactor: rewrite file_fetcher to use async fns, lift blocking call (#4037)

view details

Kitson Kelly

commit sha 0e579ee9dce917c1b783cea5506315f78b1e0a00

fix: emit when bundle contains single module (#4042) Fixes #4031 When a bundle contains a single module, we were incorrectly determining the module name, resulting in a non-functional bundle. This PR corrects that determination.

view details

Kitson Kelly

commit sha 6431622a6debc0443f9269fe0157571ec54701c0

fix: mis-detecting imports on JavaScript when there is no checkJs (#4040) This PR fixes an issue where we recursively analysed imports on plain JS files in the compiler irrespective of "checkJs" being true. This caused problems where when analysing the imports of those files, we would mistake some import like structures (AMD/CommonJS) as dependencies and try to resolve the "modules" even though the compiler would not actually look at those files.

view details

Kitson Kelly

commit sha ad0be4b0227ade35672e50970adacfd8c2801543

[std] Add diagnostic formatting util

view details

Kitson Kelly

commit sha e325717e0f87883214a25dcab63df3862bbcfe82

Convert to an op and add Deno.formatDiagnostics

view details

push time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha 0e579ee9dce917c1b783cea5506315f78b1e0a00

fix: emit when bundle contains single module (#4042) Fixes #4031 When a bundle contains a single module, we were incorrectly determining the module name, resulting in a non-functional bundle. This PR corrects that determination.

view details

Kitson Kelly

commit sha 6431622a6debc0443f9269fe0157571ec54701c0

fix: mis-detecting imports on JavaScript when there is no checkJs (#4040) This PR fixes an issue where we recursively analysed imports on plain JS files in the compiler irrespective of "checkJs" being true. This caused problems where when analysing the imports of those files, we would mistake some import like structures (AMD/CommonJS) as dependencies and try to resolve the "modules" even though the compiler would not actually look at those files.

view details

push time in 7 days

issue commentdenoland/deno

fail to bundle a single module

This was fixed in #4042

alexanderGalushka

comment created time in 7 days

issue commentdenoland/deno

[bug] Can't import jspm modules

This doesn't really fix it, because even with #4030 and #4040 you will get back the following:

Download https://dev.jspm.io/jspm
error TS2307: Cannot find module '/npm:jspm@0.16.55/api.dew.js'.

► https://dev.jspm.io/jspm:1:21

1 import { dew } from "/npm:jspm@0.16.55/api.dew.js";
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Deno doesn't resolve module specifiers like that.

FedericoMorrone

comment created time in 7 days

issue commentdenoland/deno

jsdom Port for 1.0 (Feature Request)

Also, #4040 helps get a step further, but there is a dependency in there what has some jspm import syntax which we don't support in Deno.

David-Else

comment created time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha 4ffd277aa3043e3578c26cbb48d9e9fd8eb954ce

Media type tests are flaky

view details

push time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha 7b8b7bc6b1ae0796a16bca47b901f92a13e0e879

Fix common path detection

view details

push time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha 81d8a429e90687faa769fc9a64ac2d4770b9da25

Fix typo in test

view details

push time in 7 days

push eventkitsonk/deno

Kitson Kelly

commit sha b3dff4dcd3b2dfc5c26a479334174927616297b8

Fix comment issue

view details

push time in 7 days

PR opened denoland/deno

fix: emit when bundle contains single module

Fixes #4031

When a bundle contains a single module, we were incorrectly determining the module name, resulting in a non-functional bundle. This PR corrects that determination.

Note though that modules need to be detected as modules by TypeScript though, and not scripts, so a module needs at least one import/export or use:

export {};
+43 -1

0 comment

3 changed files

pr created time in 7 days

create barnchkitsonk/deno

branch : fix-single-module-bundle

created branch time in 7 days

more