Git Product home page Git Product logo

deno's Introduction

Deno

Twitter badge Discord badge YouTube badge

the deno mascot dinosaur standing in the rain

Deno (/ˈdiːnoʊ/, pronounced dee-no) is a JavaScript, TypeScript, and WebAssembly runtime with secure defaults and a great developer experience. It's built on V8, Rust, and Tokio.

Learn more about the Deno runtime in the documentation.

Installation

Install the Deno runtime on your system using one of the commands below. Note that there are a number of ways to install Deno - a comprehensive list of installation options can be found here.

Shell (Mac, Linux):

curl -fsSL https://deno.land/install.sh | sh

PowerShell (Windows):

irm https://deno.land/install.ps1 | iex

Homebrew (Mac):

brew install deno

Chocolatey (Windows):

choco install deno

Build and install from source

Complete instructions for building Deno from source can be found in the manual here.

Your first Deno program

Deno can be used for many different applications, but is most commonly used to build web servers. Create a file called server.ts and include the following TypeScript code:

Deno.serve((_req: Request) => {
  return new Response("Hello, world!");
});

Run your server with the following command:

deno run --allow-net server.ts

This should start a local web server on http://localhost:8000.

Learn more about writing and running Deno programs in the docs.

Additional resources

Contributing

We appreciate your help! To contribute, please read our contributing instructions.

deno's People

Contributors

aapoalas avatar aarono avatar afinch7 avatar axetroy avatar bartlomieju avatar bnoordhuis avatar caspervonb avatar cknight avatar crowlkats avatar denobot avatar dsherret avatar gjzwiers avatar iuioiua avatar justjavac avatar keroxp avatar kevinkassimo avatar kitsonk avatar kt3k avatar littledivy avatar lucacasonato avatar magurotuna avatar marcosc90 avatar mmastrac avatar nayeemrmn avatar petamoriken avatar piscisaureus avatar ry avatar satyarohith avatar uki00a avatar zekth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deno's Issues

discussion: distributed deno backends and configurability

Hi, Denors,

Currently the Deno is using msg.pb to define all messages between the JS and Golang backend. How about making the arch of the TS & Golang to be more flexible by introducing the IPC/RPC messaging?

For instance, when somebody does a http request in TS, this message should be dispatched to one of configured backends. BTW we are able to do write the backend by other languages like erlang, rustlang or C/C++. This would make Deno would be birth for distributed system.

This is also one of the features that I hope to bring to Deno :)

/cc @ry @qti3e

Mojo IPC instead of Proto?

Disclaimer, I don't work on Chrome proper, so claims here may be overstated a bit :)

Chromium has separated many features in to services that communicate via Mojo IPC.

Some possible advantages of using Mojo IPC over Protos, that I'm extracting from a pretty cursory reads of docs:

  • It may be possible to utilize Chromium's set of services to provide network, filesystem, storage, audio, etc., APIs. I'm not sure indexeddb is a service yet, but if it is, then you could offer first-class indexeddb support furthing the web-compatible story.
  • It would provide a native extension point that's compatible with Chromium's internals, and automatically callable from JS.
  • Mojo historically at least is designed to support multiple language runtimes, V8 being just one. Maybe deno could support other runtimes like Python, that have access to the same Mojo Services, whether provided by native code, or from JavaScript.

I think a sandboxed, multi-language runtime based around Chrome's IPC system is would be very, very interesting.

Channels as async iterators

Hey,

V8 ships with async iterators - I was wondering if they should be used for channels as they provide a bi-directional pull stream and have very nice for... await syntax for messages :)

This also comes with all the debugging benefits of being a built-in and a standard between browsers, Node.js and other environments.

when i run ./build.py --use_ccache ,there was a mistake

image

go get -u github.com/ry/v8worker2
cd $GOPATH/src/github.com/ry/v8worker2
./build.py --use_ccache

out_path None
Rebuilding V8
Fetching dependencies.
Traceback (most recent call last):
  File "./build.py", line 149, in <module>
    main()
  File "./build.py", line 85, in main
    lib_fn = Rebuild()
  File "./build.py", line 97, in Rebuild
    EnsureDeps(v8_path)
  File "./build.py", line 146, in EnsureDeps
    env=env)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 535, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception

Please explain...

Is it like nodejs but for TypeScript and with blocking IO / without callback madness?

Compilation issue

Hi, I am trying to build locally but I get the next error and I am not sure if this is my fault or not :)

$ go get -d github.com/ry/v8worker2 || true
# cd /go/src/github.com/ry/v8worker2; git submodule update --init --recursive
Submodule 'depot_tools' (https://chromium.googlesource.com/chromium/tools/depot_tools.git) registered for path 'depot_tools'
Submodule 'v8' (https://github.com/v8/v8.git) registered for path 'v8'
Cloning into '/go/src/github.com/ry/v8worker2/depot_tools'...
Cloning into '/go/src/github.com/ry/v8worker2/v8'...
From https://chromium.googlesource.com/chromium/tools/depot_tools
 * branch              f16fdf3165b8b86d10386d18a6b6075169c10e15 -> FETCH_HEAD
Submodule path 'depot_tools': checked out 'f16fdf3165b8b86d10386d18a6b6075169c10e15'
error: no such remote ref fe12316ec4b4a101923e395791ca55442e62f4cc
Fetched in submodule path 'v8', but it did not contain fe12316ec4b4a101923e395791ca55442e62f4cc. Direct fetching of that commit failed.
package github.com/ry/v8worker2: exit status 1

cd $GOPATH/src/github.com/ry/v8worker2    && ./build.py --use_ccache --out_path $V8WORKER2_OUT_PATH
depot_tools update failed. Conflict in /go/src/github.com/ry/v8worker2/depot_tools
/go/src/github.com/ry/v8worker2/.git/modules/depot_tools/rebase-apply/patch:56: trailing whitespace.
   
/go/src/github.com/ry/v8worker2/.git/modules/depot_tools/rebase-apply/patch:71: trailing whitespace.

/go/src/github.com/ry/v8worker2/.git/modules/depot_tools/rebase-apply/patch:73: trailing whitespace.
Windows only).
/go/src/github.com/ry/v8worker2/.git/modules/depot_tools/rebase-apply/patch:77: trailing whitespace.

/go/src/github.com/ry/v8worker2/.git/modules/depot_tools/rebase-apply/patch:225: trailing whitespace.
 
warning: squelched 596 whitespace errors
warning: 601 lines add whitespace errors.
error: Failed to merge in the changes.
Patch failed at 0001 Create the Next Generation of depot_tools. Eh.
The copy of the patch that failed is found in: /go/src/github.com/ry/v8worker2/.git/modules/depot_tools/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
Bootstrapping cipd client for linux-amd64 from https://chrome-infra-packages.appspot.com/client?platform=linux-amd64&version=git_revision:4d19637ec2c3d1efd8c6a1b05285118b786919e2...
gn.py: Could not find checkout in any parent of the current path.
This must be run inside a checkout.
out_path ['/v8worker2_out']
Rebuilding V8
Fetching dependencies.
Running gn
Traceback (most recent call last):
  File "./build.py", line 149, in <module>
    main()
  File "./build.py", line 85, in main
    lib_fn = Rebuild()
  File "./build.py", line 114, in Rebuild
    env=env)
  File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/go/src/github.com/ry/v8worker2/depot_tools/gn', 'gen', '/v8worker2_out/v8build', '--args=   is_component_build=false   is_debug=false   libcpp_is_static=false   symbol_level=1   treat_warnings_as_errors=false   use_custom_libcxx=false   use_sysroot=false   v8_deprecation_warnings=false   v8_embedder_string="-v8worker2"   v8_enable_gdbjit=false   v8_enable_i18n_support=false   v8_enable_test_features=false   v8_experimental_extra_library_files=[]   v8_extra_library_files=[]   v8_imminent_deprecation_warnings=false   v8_monolithic=true   v8_static_library=false   v8_target_cpu="x64"   v8_untrusted_code_mitigations=false   v8_use_external_startup_data=false   v8_use_snapshot=true  cc_wrapper="/usr/bin/ccache"']' returned non-zero exit status 1

What I should check?
Thans in advance

0.0

study then give up

Maybe need a package management tool

Import from url is very hard to use. I think is not a good idea.
If so,

  1. We must manage more js files not our own development.
  2. Heavily dependent on the network, because the third package also can import another packages.

Like C#\Java, the nuget and maven is good for use. Maybe use that mode can help us manage the packages.

Cannot run testdata/006

Hi bro, I have configured the environment and run the deno, but I cannot pass the 6th test case, and the following is screenshot of terminal:
image

Custom tsconfig.json

What happens or should happen if you import a TS file that has different compiler options? Does/will deno look for a separate tsconfig.json somehow?

Package Name Map support as alternative to node module resolution

Very interesting project! I love the web-compatibility goal.

One thing that would help there is support for bare module specifiers via package name maps: https://github.com/domenic/package-name-maps

This would allow for imports like:

import * as _ from 'lodash';

Without any requirements on a specific package manager. It's our hope that npm, yarn and others will produce package-name maps during installation, giving you a bridge there. We have a reference implementation in progress here: WICG/import-maps#37

All exceptions/errors should exit through the same routine

Currently there are multiple paths:

Unhandled Promise Exceptions

https://github.com/ry/deno/blob/e401d9e21bd3803d7d329ed8b7c831127f12832f/runtime.ts#L33-L43

Normal Exceptions

This is for normal exceptions, which rise up during the worker.SendBytes() call.
https://github.com/ry/deno/blob/e401d9e21bd3803d7d329ed8b7c831127f12832f/util.go#L49-L54
Not that the exception is formatted by V8Worker2's ExceptionString().
https://github.com/ry/v8worker2/blob/d2017b36edb8429471b08b27123981f1abd5fcb0/binding.cc#L93-L151
Ideally the ExceptionString code path would go away and everything would go through window.onerror.

Use a separate file for source maps in ~/.deno/cache

Currently we use inlineSourceMaps: https://github.com/ry/deno/blob/c0cc240810f9280ca458c54b4cb69acc30e47e27/runtime.ts#L187
However this makes examining the cache files difficult.

To make this change happen, the CodeFetchRes message must also return a separate source map. So to start, a new entry string code_fetch_res_source_map would be added to msg.proto here
https://github.com/ry/deno/blob/c0cc240810f9280ca458c54b4cb69acc30e47e27/msg.proto#L51-L58
and probably add string code_cache_source_map here
https://github.com/ry/deno/blob/c0cc240810f9280ca458c54b4cb69acc30e47e27/msg.proto#L60-L63

discussion: struct the browser-compatible APIs

@ry @qti3e I just have a proposal about which Web APIs should be supported:

  • High level
    • Console
    • URL
    • File/FileList/FileReader/Blob
    • XMLHttpRequest/Fetch
    • WebSocket
    • URLSearchParams
  • Middle level
    • AudioContext/AudioBuffer
    • Canvas

Btw, supports WebGL that makes like tfjs could run at deno, and make use of the GPUs, it might be interesting personally :)

哎呦,不错,这个叼

dear ry,
nice work,your code is very six.

old iron , double click six six six .
thanks this old iron's plane.

Compare bootstrap speed with Node.js

➜ tmp echo "console.log('Hello world')" > index.js
➜ tmp time deno index.js
Hello world
deno index.js 1.89s user 0.22s system 138% cpu 1.515 total
➜ tmp time node index.js
Hello world
node index.js 0.08s user 0.03s system 94% cpu 0.109 total

The golang runtime has a huge influence for bootstrap time. How you think about this, seems golang bootstrap time is had to improve.

deno/dispatch.go:10:26: undefined: BaseMsg

I run go get -u github.com/ry/deno/... following the README.md,
and got this message

$ go get  -u github.com/ry/deno/...
# github.com/ry/deno
../deno/dispatch.go:10:26: undefined: BaseMsg
../deno/dispatch.go:30:10: undefined: BaseMsg
../deno/dispatch.go:62:14: undefined: BaseMsg
../deno/dispatch.go:68:34: undefined: Msg
../deno/dispatch.go:119:13: select case must be receive, send or assign recv
../deno/fetch.go:13:11: undefined: Msg
../deno/fetch.go:16:8: undefined: Msg_FETCH_REQ
../deno/fetch.go:29:14: undefined: Msg
../deno/main.go:38:15: undefined: Asset
../deno/main.go:110:19: undefined: Msg
../deno/main.go:110:19: too many errors

Please close this project for now.

You created node few years ago and it's very exciting project. we using and enjoy it. but it has a very big problem , we call "callback hell" or "callback shit". of course, some people create few solutions. but you didn't do anything to solve the problem and leaved node project.

Now, you back with deno, also it's basic on v8 engine. Will i like it ? no, i don't like it as i don't like you.

Before you created something that has relationship between javascript & v8 , please go to node project and fix the issues first. here you go

Before that, please close this project. Ok ?

Thanks.

Deno vs Node.js

Hi Ryan,
Thanks a lot for your contributions that changed the whole world! You're awesome man!

What is the differences between this runtime than Node.js for a user like me that uses TypeScript with Node?

Can you please write about this point?

Thanks,
Yours,
Islam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.