Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by 29athrowaway on Saturday November 06, 2021 @11:02PM
(#29136173)
Personally I do not like the fact that it puts too much trust into DNS.
DNS wasn't created with security in mind, so to say Deno is secure because it uses a permissions system while relying directly into DNS for imports to me sounds weird.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by koprulusector on Sunday November 07, 2021 @01:41AM
(#29137109)
How is this any different than any other package management system? If you npm or pip install a package and import it, you’re still relying on DNS to resolve pypi or npmjs.
But with deno, if you’ve just accidentally installed some malicious squatters’ package that mimics the one you meant to use, at least you’ve got less exposure because the malicious code won’t necessarily have blanket permissions to make network calls, read files, etc. virtually any other language/package management system cannot say the same.
deno will download and cache the dependencies you import, they’re right in the project folder vs buried in a sea of node_modules. It’s super convenient to look at and inspect, if there’s any doubt or idle curiosity.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by simonw on Saturday November 06, 2021 @11:20PM
(#29136269)
It's not just DNS, thankfully - deno.land has a TLS certificate too, which I think means that DNS exploits wouldn't succeed in causing clients to install untrusted packages.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by vnglst on Saturday November 06, 2021 @03:12PM
(#29132965)
What I really like about this is that you open the dependency in a web browser and see the human readable source code. No transpiling! https://deno.land/std/http/server.ts
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by judge2020 on Saturday November 06, 2021 @11:17PM
(#29136256)
This is generally already possible with webpack, but many/most websites i've looked at have source maps turned off. Maybe the extra compile time is too much, or they just want to disincentivize client-side reverse engineering.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by 1_player on Saturday November 06, 2021 @05:18PM
(#29133878)
There's few things as fun as a multiplayer notepad that wasn't intended to be an actual chat, before it's invaded by bots and spammers. Congrats on the fella that tried to paste an ascii art version of Pepe the Frog.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by ondras on Saturday November 06, 2021 @04:26PM
(#29133534)
Right, as jitl suggested. The BroadcastChannel is used to allow cross-datacenter messaging. So every script instance has its own set of clients and forwards incoming client messages to other script/datacenter instances.
I suppose this is not limited to multiple datacenters, but to multiple script instances in one datacenter as well.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by zcbenz on Sunday November 07, 2021 @01:19AM
(#29137023)
I'm a bit confused when people say "native TypeScript" and "no transpiling" about Deno, does Deno now execute TypeScript without translating it to JavaScript first?
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by capableweb on Sunday November 07, 2021 @02:38AM
(#29137326)
No, it never did, Deno always have converted TypeScript into JavaScript that then gets read and executed by the browser, at least according to their own docs but maybe that has changed lately?
> At a high level, Deno converts TypeScript (as well as TSX and JSX) into JavaScript. It does this via a combination of the TypeScript compiler, which we build into Deno, and a Rust library called swc. When the code has been type checked and transformed, it is stored in a cache, ready for the next run without the need to convert it from its source to JavaScript again.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by koprulusector on Tuesday November 09, 2021 @06:03AM
(#29160099)
My answer wasn’t explicit enough. To clarify, I meant as a user of deno you do not need to perform any separate transpilation or build step. The runtime can read and execute typescript natively (again, from user perspective).
>Deno can run JavaScript or TypeScript out of the box with no additional tools or config required.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by capableweb on Tuesday November 09, 2021 @08:29AM
(#29161429)
Yeah, I guess if someone asks "does Deno translate TS to JS before executing it?" and someone answers "Yes, it could always do this", it's not hard for the answer to be understood as "Deno doesn't translate TS before running it".
No hard feelings though, context is important and many of us miss it at times :)
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by bryanrasmussen on Sunday November 07, 2021 @02:27AM
(#29137283)
so question - normally the thing I like about Node.js is not much context switching and ability to rerun code between backend and frontend. I can get the same thing with TS if I compile in both backend and frontend - if in Deno I don't compile and in the frontend I do are there any weird gotchas I would run into?
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by andyferris on Sunday November 07, 2021 @05:27AM
(#29138106)
Deno is aiming to have better compatibility with web standards than Node, so you should encounter fewer gotchas from reusing code in backend and frontend.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by agumonkey on Sunday November 07, 2021 @02:00AM
(#29137183)
Nothing is to be known by everybody. But it's surprising that you don't associate typescript with deno. Unless you didn't know about deno in the first place.
Just saying because TS had some kind of popularity these days.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ...
by capableweb on Sunday November 07, 2021 @02:42AM
(#29137337)
To be fair, there is absolutely zero information about what technology is being used on the page the submission links to. Clicking the top-left icon brings you to "https://dash.deno.com/projects" which then forces you to login, still not giving any indication on what this thing is about or even written in.
I can see how you can get confused, even if I wasn't as I'm around the JS community.
I expect the demo works with or without the await on the listen promise because the listen code runs regardless (and prevents main from exiting).
Native typescript, easy-as-pie dependency management. its great!
DNS wasn't created with security in mind, so to say Deno is secure because it uses a permissions system while relying directly into DNS for imports to me sounds weird.
But with deno, if you’ve just accidentally installed some malicious squatters’ package that mimics the one you meant to use, at least you’ve got less exposure because the malicious code won’t necessarily have blanket permissions to make network calls, read files, etc. virtually any other language/package management system cannot say the same.
deno will download and cache the dependencies you import, they’re right in the project folder vs buried in a sea of node_modules. It’s super convenient to look at and inspect, if there’s any doubt or idle curiosity.
https://imgur.com/a/aEHjQcp
update: the original version was too spammy, i have changed it so that pepe only responds to greetings or when you type "pepe"
update 2: i have throttled pepe so it only comes back after minute of cooldown
https://deno.com/deploy/docs/runtime-broadcast-channel/
I suppose this is not limited to multiple datacenters, but to multiple script instances in one datacenter as well.
CloudFlare: global, huge company who regrets they don't already route 100% of internet traffic
Edit: I should add, I commend both efforts, both probably improve the world more than they hurt it, just injecting a bit of humor.
> At a high level, Deno converts TypeScript (as well as TSX and JSX) into JavaScript. It does this via a combination of the TypeScript compiler, which we build into Deno, and a Rust library called swc. When the code has been type checked and transformed, it is stored in a cache, ready for the next run without the need to convert it from its source to JavaScript again.
https://deno.land/manual/typescript/overview
>Deno can run JavaScript or TypeScript out of the box with no additional tools or config required.
- https://deno.land/[email protected]/examples/hello_world
>Deno is a runtime for JavaScript/TypeScript which tries to be web compatible and use modern features wherever possible.
- https://deno.land/[email protected]/getting_started/first_steps
You can run any of their examples to see that `deno run` commands can execute typescript without requiring a separate transpilation step
No hard feelings though, context is important and many of us miss it at times :)
https://deno.land/[email protected]/typescript/overview#how-doe...
Just saying because TS had some kind of popularity these days.
I can see how you can get confused, even if I wasn't as I'm around the JS community.