Deno
公式: Deno, the next-generation JavaScript runtime
Deno は、V8 JavaScriptエンジン及びRustプログラミング言語に基づいた、JavaScript及びTypeScriptのランタイム環境である。
Node.js の作者であるライアン・ダールによって作成され、セキュリティと生産性に焦点を当てている。
ライアン・ダールが 2018 年に行った講演「Node.jsに関する10の反省点」で発表された。
Deno は単一の実行ファイル内でランタイム環境とパッケージ管理システムの両方の役割を明示的に引き受けるので、別途パッケージ管理システムを必要としない。
Deno - Wikiwand より
インストール
公式: Getting Started - Deno Docs
$ curl -fsSL https://deno.land/install.sh | sh
######################################################################## 100.0% Archive: /home/tomoyan/.deno/bin/deno.zip inflating: /home/tomoyan/.deno/bin/deno Deno was installed successfully to /home/tomoyan/.deno/bin/deno info: backing '/home/tomoyan/.bash_profile' up to '/home/tomoyan/.deno/.shellRcBackups/.bash_profile.bak' info: backing '/home/tomoyan/.bashrc' up to '/home/tomoyan/.deno/.shellRcBackups/.bashrc.bak' info: backing '/home/tomoyan/.zshrc' up to '/home/tomoyan/.deno/.shellRcBackups/.zshrc.bak' Deno was added to the PATH. You may need to restart your shell for it to become available. warning: Failed to install completions for bash: PermissionDenied: Permission denied (os error 13): mkdir '/usr/local/etc/bash_completion.d' Run '/home/tomoyan/.deno/bin/deno --help' to get started Stuck? Join our Discord https://discord.gg/deno
シェルの設定を反映 (zsh)🤔
$ . ~/.zshrc
動作確認🤔
$ deno -v
deno 1.46.3
$ deno -h
Deno: A modern JavaScript and TypeScript runtime Usage: deno [OPTIONS] [COMMAND] Commands: Execution: run Run a JavaScript or TypeScript program, or a task deno run main.ts | deno run --allow-net=google.com main.ts | deno main.ts serve Run a server deno serve main.ts task Run a task defined in the configuration file deno task dev repl Start an interactive Read-Eval-Print Loop (REPL) for Deno eval Evaluate a script from the command line Dependency management: add Add dependencies deno add @std/assert | deno add npm:express install Install script as an executable uninstall Uninstall a script previously installed with deno install remove Remove dependencies from the configuration file Tooling: bench Run benchmarks deno bench bench.ts cache Cache the dependencies check Type-check the dependencies compile Compile the script into a self contained executable deno compile main.ts | deno compile --target=x86_64-unknown-linux-gnu coverage Print coverage reports doc Genereate and show documentation for a module or built-ins deno doc | deno doc --json | deno doc --html mod.ts fmt Format source files deno fmt | deno fmt main.ts info Show info about cache or info related to source file jupyter Deno kernel for Jupyter notebooks lint Lint source files init Initialize a new project test Run tests deno test | deno test test.ts publish Publish the current working directory's package or workspace upgrade Upgrade deno executable to given version deno upgrade | deno upgrade 1.45.0 | deno upgrade canary Environment variables: DENO_AUTH_TOKENS A semi-colon separated list of bearer tokens and hostnames to use when fetching remote modules from private repositories (e.g. "abcde12345@deno.land;54321edcba@github.com") DENO_FUTURE Set to "1" to enable APIs that will take effect in Deno 2 DENO_CERT Load certificate authorities from PEM encoded file DENO_DIR Set the cache directory DENO_INSTALL_ROOT Set deno install's output directory (defaults to $HOME/.deno/bin) DENO_NO_PACKAGE_JSON Disables auto-resolution of package.json DENO_NO_UPDATE_CHECK Set to disable checking if a newer Deno version is available DENO_TLS_CA_STORE Comma-separated list of order dependent certificate stores. Possible values: "system", "mozilla". (defaults to "mozilla") HTTP_PROXY Proxy address for HTTP requests (module downloads, fetch) HTTPS_PROXY Proxy address for HTTPS requests (module downloads, fetch) NO_COLOR Set to disable color NO_PROXY Comma-separated list of hosts which do not use a proxy (module downloads, fetch) NPM_CONFIG_REGISTRY URL to use for the npm registry. Docs: https://docs.deno.com Standard Library: https://jsr.io/@std Bugs: https://github.com/denoland/deno/issues Discord: https://discord.gg/deno
Deno kernel for Jupyter notebooks
JupyterLab - Project Jupyter の次世代ユーザーインターフェース をインストールする🤔
$ deno jupyter -h
Deno kernel for Jupyter notebooks Usage: deno jupyter [OPTIONS] Options: --conn <conn> Path to JSON file describing connection parameters, provided by Jupyter --install Installs kernelspec, requires 'jupyter' command to be available. --kernel Start the kernel -q, --quiet Suppress diagnostic output
$ deno jupyter --install
Warning "deno jupyter" is unstable and might change in the future. ✅ Deno kernelspec installed successfully.
Jupyter Kernel のインストール確認🤔
$ mamba run -n jupyterlab jupyter kernelspec list
Available kernels: python3 /home/tomoyan/miniforge3/envs/jupyterlab/share/jupyter/kernels/python3 xpython /home/tomoyan/miniforge3/envs/jupyterlab/share/jupyter/kernels/xpython xpython-raw /home/tomoyan/miniforge3/envs/jupyterlab/share/jupyter/kernels/xpython-raw deno /home/tomoyan/.local/share/jupyter/kernels/deno
tslab
tslab で TypeScript と JavaScript Kernel をインストールする場合は以下の手順を実行する🤔
$ pnpm install -g tslab
Downloading @tslab/typescript-for-tslab@5.0.4: 7.05 MB/7.05 MB, done
WARN 3 deprecated subdependencies found: glob@7.2.3, inflight@1.0.6, sourcemap-codec@1.4.8
Packages: +136
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 137, reused 0, downloaded 136, added 136, done
.pnpm/zeromq@6.0.4/node_modules/zeromq: Running install script, done in 378ms
/home/tomoyan/.local/share/pnpm/global/5:
+ tslab 1.0.22
Done in 6.8s
動作確認🤔
$ tslab install --version
tslab 1.0.22
Jupyter の TypeScript kernel と JavaScript kernel をインストール🤔
$ mamba run -n jupyterlab tslab install
Running python3 /home/tomoyan/.local/share/pnpm/global/5/.pnpm/tslab@1.0.22/node_modules/tslab/python/install.py --tslab=tslab Installing TypeScript kernel spec Installing JavaScript kernel spec
Jupyter Kernel のインストール確認🤔
$ mamba run -n jupyterlab jupyter kernelspec list
Available kernels: python3 /home/tomoyan/miniforge3/envs/jupyterlab/share/jupyter/kernels/python3 xpython /home/tomoyan/miniforge3/envs/jupyterlab/share/jupyter/kernels/xpython xpython-raw /home/tomoyan/miniforge3/envs/jupyterlab/share/jupyter/kernels/xpython-raw deno /home/tomoyan/.local/share/jupyter/kernels/deno jslab /home/tomoyan/.local/share/jupyter/kernels/jslab tslab /home/tomoyan/.local/share/jupyter/kernels/tslab