Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
justjavac committed May 7, 2020
0 parents commit f8fdb6c
Show file tree
Hide file tree
Showing 81 changed files with 4,084 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Deno Docs

- [English](./en)
- [简体中文](./zh-cn)
47 changes: 47 additions & 0 deletions en/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Deno Docs

- [Introduction](./introduction.md)
- [Getting Started](./getting_started.md)
- [Installation](./getting_started/installation.md)
- [Setup your environment](./getting_started/setup_your_environment.md)
- [First steps](./getting_started/first_steps.md)
- [Permissions](./getting_started/permissions.md)
- [Using TypeScript](./getting_started/typescript.md)
- [Using WebAssembly](./getting_started/wasm.md)
- [The Runtime](./runtime.md)
- [Program Lifecycle](./runtime/program_lifecycle.md)
- [Compiler APIs](./runtime/compiler_apis.md)
- [Unstable APIs](./runtime/unstable.md)
- [Linking to external code](./linking_to_external_code.md)
- [Reloading modules](./linking_to_external_code/reloading_modules.md)
- [Integrity checking](./linking_to_external_code/integrity_checking.md)
- [Proxies](./linking_to_external_code/proxies.md)
- [Import maps](./linking_to_external_code/import_maps.md)
- [Testing](./testing.md)
- [Writing tests](./testing/writing.md)
- [Running tests](./testing/running.md)
- [Plugins](./plugins.md)
- [How do plugins work?](./plugins/how_do_plugins_work.md)
- [Creating plugins](./plugins/creating_plugins.md)
- [Using plugins](./plugins/using_plugins.md)
- [Tools](./tools.md)
- [Debugger](./tools/debugger.md)
- [Script installer](./tools/script_installer.md)
- [Formatter](./tools/formatter.md)
- [Bundler](./tools/bundler.md)
- [Documentation generator](./tools/documentation_generator.md)
- [Dependency inspector](./tools/dependency_inspector.md)
- [Embedding Deno](./embedding_deno.md)
- [Contributing](./contributing.md)
- [Building from source](./contributing/building_from_source.md)
- [Development tools](./contributing/development_tools.md)
- [Architecture](./contributing/architecture.md)
- [Examples](./examples.md)
- [Unix cat program](./examples/unix_cat.md)
- [File server](./examples/fileserver.md)
- [TCP echo server](./examples/tcp_echo.md)
- [Creating a subprocess](./examples/subprocess.md)
- [Inspecting and revoking permissions](./examples/permissions.md)
- [OS Signals](./examples/os_signals.md)
- [File system events](./examples/file_system_events.md)
- [Checking if file is main](./examples/testing_if_main.md)
60 changes: 60 additions & 0 deletions en/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Contributing

- Read the [style guide](style_guide.md).
- Progress towards future releases is tracked
[here](https://github.com/denoland/deno/milestones).
- Please don't make [the benchmarks](https://deno.land/benchmarks.html) worse.
- Ask for help in the [community chat room](https://discord.gg/TGMHGv6).
- If you are going to work on an issue, mention so in the issue comments
_before_ you start working on the issue.

## Development

Instructions on how to build from source can be found
[here](./building-from-source).

## Submitting a Pull Request

Before submitting, please make sure the following is done:

1. That there is a related issue and it is referenced in the PR text.
2. There are tests that cover the changes.
3. Ensure `cargo test` passes.
4. Format your code with `tools/format.py`
5. Make sure `./tools/lint.py` passes.

## Changes to `third_party`

[`deno_third_party`](https://github.com/denoland/deno_third_party) contains most
of the external code that Deno depends on, so that we know exactly what we are
executing at any given time. It is carefully maintained with a mixture of manual
labor and private scripts. It's likely you will need help from @ry or
@piscisaureus to make changes.

## Adding Ops (aka bindings)

We are very concerned about making mistakes when adding new APIs. When adding an
Op to Deno, the counterpart interfaces on other platforms should be researched.
Please list how this functionality is done in Go, Node, Rust, and Python.

As an example, see how `Deno.rename()` was proposed and added in
[PR #671](https://github.com/denoland/deno/pull/671).

## Documenting APIs

It is important to document public APIs and we want to do that inline with the
code. This helps ensure that code and documentation are tightly coupled
together.

### Utilize JSDoc

All publicly exposed APIs and types, both via the `deno` module as well as the
global/`window` namespace should have JSDoc documentation. This documentation is
parsed and available to the TypeScript compiler, and therefore easy to provide
further downstream. JSDoc blocks come just prior to the statement they apply to
and are denoted by a leading `/**` before terminating with a `*/`. For example:

```ts
/** A simple JSDoc comment */
export const FOO = "foo";
```
50 changes: 50 additions & 0 deletions en/contributing/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Internal details

### Deno and Linux analogy

| **Linux** | **Deno** |
| ------------------------------: | :------------------------------- |
| Processes | Web Workers |
| Syscalls | Ops |
| File descriptors (fd) | [Resource ids (rid)](#resources) |
| Scheduler | Tokio |
| Userland: libc++ / glib / boost | https://deno.land/std/ |
| /proc/\$\$/stat | [Deno.metrics()](#metrics) |
| man pages | deno types |

#### Resources

Resources (AKA `rid`) are Deno's version of file descriptors. They are integer
values used to refer to open files, sockets, and other concepts. For testing it
would be good to be able to query the system for how many open resources there
are.

```ts
const { resources, close } = Deno;
console.log(resources());
// { 0: "stdin", 1: "stdout", 2: "stderr" }
close(0);
console.log(resources());
// { 1: "stdout", 2: "stderr" }
```

#### Metrics

Metrics is Deno's internal counter for various statistics.

```shell
> console.table(Deno.metrics())
┌──────────────────┬────────┐
│ (index) │ Values │
├──────────────────┼────────┤
│ opsDispatched │ 9 │
│ opsCompleted │ 9 │
│ bytesSentControl │ 504 │
│ bytesSentData │ 0 │
│ bytesReceived │ 856 │
└──────────────────┴────────┘
```

### Schematic diagram

![architectural schematic](https://deno.land/images/schematic_v0.2.png)
89 changes: 89 additions & 0 deletions en/contributing/building_from_source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
## Building from source

Below are instructions on how to build Deno from source. If you just want to use
Deno you can download a prebuilt executable (more information in the
`Getting Started` chapter).

### Cloning the Repository

Clone on Linux or Mac:

```bash
git clone --recurse-submodules https://github.com/denoland/deno.git
```

Extra steps for Windows users:

1. [Enable "Developer Mode"](https://www.google.com/search?q=windows+enable+developer+mode)
(otherwise symlinks would require administrator privileges).
2. Make sure you are using git version 2.19.2.windows.1 or newer.
3. Set `core.symlinks=true` before the checkout:
```bash
git config --global core.symlinks true
git clone --recurse-submodules https://github.com/denoland/deno.git
```

### Prerequisites

The easiest way to build Deno is by using a precompiled version of V8:

```
cargo build -vv
```

However if you want to build Deno and V8 from source code:

```
V8_FROM_SOURCE=1 cargo build -vv
```

When building V8 from source, there are more dependencies:

[Python 2](https://www.python.org/downloads). Ensure that a suffix-less
`python`/`python.exe` exists in your `PATH` and it refers to Python 2,
[not 3](https://github.com/denoland/deno/issues/464#issuecomment-411795578).

For Linux users glib-2.0 development files must also be installed. (On Ubuntu,
run `apt install libglib2.0-dev`.)

Mac users must have [XCode](https://developer.apple.com/xcode/) installed.

For Windows users:

1. Get [VS Community 2019](https://www.visualstudio.com/downloads/) with
"Desktop development with C++" toolkit and make sure to select the following
required tools listed below along with all C++ tools.

- Visual C++ tools for CMake
- Windows 10 SDK (10.0.17763.0)
- Testing tools core features - Build Tools
- Visual C++ ATL for x86 and x64
- Visual C++ MFC for x86 and x64
- C++/CLI support
- VC++ 2015.3 v14.00 (v140) toolset for desktop

2. Enable "Debugging Tools for Windows". Go to "Control Panel" → "Programs" →
"Programs and Features" → Select "Windows Software Development Kit - Windows
10" → "Change" → "Change" → Check "Debugging Tools For Windows" → "Change" ->
"Finish". Or use:
[Debugging Tools for Windows](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/)
(Notice: it will download the files, you should install
`X64 Debuggers And Tools-x64_en-us.msi` file manually.)

See [rusty_v8's README](https://github.com/denoland/rusty_v8) for more details
about the V8 build.

### Building

Build with Cargo:

```bash
# Build:
cargo build -vv

# Build errors? Ensure you have latest master and try building again, or if that doesn't work try:
cargo clean && cargo build -vv

# Run:
./target/debug/deno cli/tests/002_hello.ts
```
Loading

0 comments on commit f8fdb6c

Please sign in to comment.