文書の表示以前のリビジョンバックリンク文書の先頭へ この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。 ====== Deno ====== <WRAP zoomimg w200 x1_2 fsizemin> {{ :typescript:deno_logo_2024.svg?240 |Deno Logo}}\\ [[https://commons.wikimedia.org/wiki/File:Deno_Logo_2024.svg|File:Deno Logo 2024.svg - Wikimedia Commons]] より\\ </WRAP> 公式: [[https://deno.com/|Deno, the next-generation JavaScript runtime]]\\ リポジトリ: [[git>denoland/deno|denoland/deno: A modern runtime for JavaScript and TypeScript.]]\\ **Deno** は、V8 JavaScriptエンジン及びRustプログラミング言語に基づいた、JavaScript及びTypeScriptのランタイム環境である。\\ Node.js の作者であるライアン・ダールによって作成され、セキュリティと生産性に焦点を当てている。\\ ライアン・ダールが 2018 年に行った講演「Node.jsに関する10の反省点」で発表された。\\ Deno は単一の実行ファイル内でランタイム環境とパッケージ管理システムの両方の役割を明示的に引き受けるので、別途パッケージ管理システムを必要としない。\\ [[wwjp>Deno|Deno - Wikiwand]] より\\ ===== インストール ===== 公式: [[https://docs.deno.com/runtime/|Getting Started - Deno Docs]]\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">curl</font> <font color="#A347BA">-fsSL</font> https://deno.land/install.sh <font color="#2A7BDE"><b>|</b></font> <font color="#26A269">sh</font> </pre></html></WRAP> <WRAP color_result><html><pre> ######################################################################## 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 <font color="#2A7BDE"><b>Edit shell configs to add deno to the PATH?</b></font> (Y/n) -> Enter <font color="#26A269">info</font>: backing '/home/tomoyan/.profile' up to '/home/tomoyan/.deno/.shellRcBackups/.profile.bak' <font color="#26A269">info</font>: backing '/home/tomoyan/.bash_profile' up to '/home/tomoyan/.deno/.shellRcBackups/.bash_profile.bak' <font color="#26A269">info</font>: backing '/home/tomoyan/.bashrc' up to '/home/tomoyan/.deno/.shellRcBackups/.bashrc.bak' <font color="#26A269">info</font>: 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. <font color="#2A7BDE"><b>Set up completions?</b></font> -> Use space to select and enter to continue > [x] bash [x] zsh Run 'deno --help' to get started Stuck? Join our Discord https://discord.gg/deno </pre></html></WRAP> </WRAP> シェルの設定を反映 (zsh)🤔\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">.</font><font color="#999999"> </font><font color="#999999"><u style="text-decoration-style:solid">~/.zshrc</u></font> </pre></html></WRAP> </WRAP> 動作確認🤔\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">deno</font> <font color="#A347BA">-v</font> </pre></html></WRAP> <WRAP color_result><html><pre> deno 2.2.3 </pre></html></WRAP> </WRAP> <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">deno</font> <font color="#A347BA">-h</font> </pre></html></WRAP> <WRAP color_result_long><html><pre> Deno: <font color="#26A269">A modern JavaScript and TypeScript runtime</font> <font color="#8A8A8A">Usage:</font> <font color="#26A269">deno</font> <font color="#26A269">[OPTIONS]</font> <font color="#26A269">[COMMAND]</font> <font color="#A2734C">Commands:</font> <font color="#A2734C">Execution:</font> <font color="#26A269">run</font> Run a JavaScript or TypeScript program, or a task <font color="#8A8A8A">deno run main.ts | deno run --allow-net=google.com main.ts | deno main.ts</font> <font color="#26A269">serve</font> Run a server <font color="#8A8A8A">deno serve main.ts</font> <font color="#26A269">task</font> Run a task defined in the configuration file <font color="#8A8A8A">deno task dev</font> <font color="#26A269">repl</font> Start an interactive Read-Eval-Print Loop (REPL) for Deno <font color="#26A269">eval</font> Evaluate a script from the command line <font color="#A2734C">Dependency management:</font> <font color="#26A269">add</font> Add dependencies <font color="#8A8A8A">deno add jsr:@std/assert | deno add npm:express</font> <font color="#26A269">install</font> Installs dependencies either in the local project or globally to a bin directory <font color="#26A269">uninstall</font> Uninstalls a dependency or an executable script in the installation root's bin directory <font color="#26A269">outdated</font> Find and update outdated dependencies <font color="#26A269">remove</font> Remove dependencies from the configuration file <font color="#A2734C">Tooling:</font> <font color="#26A269">bench</font> Run benchmarks <font color="#8A8A8A">deno bench bench.ts</font> <font color="#26A269">check</font> Type-check the dependencies <font color="#26A269">clean</font> Remove the cache directory <font color="#26A269">compile</font> Compile the script into a self contained executable <font color="#8A8A8A">deno compile main.ts | deno compile --target=x86_64-unknown-linux-gnu</font> <font color="#26A269">coverage</font> Print coverage reports <font color="#26A269">doc</font> Generate and show documentation for a module or built-ins <font color="#8A8A8A">deno doc | deno doc --json | deno doc --html mod.ts</font> <font color="#26A269">fmt</font> Format source files <font color="#8A8A8A">deno fmt | deno fmt main.ts</font> <font color="#26A269">info</font> Show info about cache or info related to source file <font color="#26A269">jupyter</font> Deno kernel for Jupyter notebooks <font color="#26A269">lint</font> Lint source files <font color="#26A269">init</font> Initialize a new project <font color="#26A269">test</font> Run tests <font color="#8A8A8A">deno test | deno test test.ts</font> <font color="#26A269">publish</font> Publish the current working directory's package or workspace <font color="#26A269">upgrade</font> Upgrade deno executable to given version <font color="#8A8A8A">deno upgrade | deno upgrade 1.45.0 | deno upgrade canary</font> <font color="#A2734C">Environment variables:</font> <font color="#A2734C">Docs:</font> <font color="#2AA1B3">https://docs.deno.com/go/env-vars</font> <font color="#26A269">DENO_AUTH_TOKENS</font> A semi-colon separated list of bearer tokens and hostnames to use when fetching remote modules from private repositories <font color="#8A8A8A">(e.g. "abcde12345@deno.land;54321edcba@github.com")</font> <font color="#26A269">DENO_CERT</font> Load certificate authorities from PEM encoded file <font color="#26A269">DENO_DIR</font> Set the cache directory <font color="#26A269">DENO_INSTALL_ROOT</font> Set deno install's output directory <font color="#8A8A8A">(defaults to $HOME/.deno/bin)</font> <font color="#26A269">DENO_NO_PACKAGE_JSON</font> Disables auto-resolution of package.json <font color="#26A269">DENO_NO_UPDATE_CHECK</font> Set to disable checking if a newer Deno version is available <font color="#26A269">DENO_TLS_CA_STORE</font> Comma-separated list of order dependent certificate stores. <font color="#26A269">DENO_TRACE_PERMISSIONS</font> Environmental variable to enable stack traces in permission prompts. Possible values: "system", "mozilla". <font color="#8A8A8A">(defaults to "mozilla")</font> <font color="#26A269">HTTP_PROXY</font> Proxy address for HTTP requests <font color="#8A8A8A">(module downloads, fetch)</font> <font color="#26A269">HTTPS_PROXY</font> Proxy address for HTTPS requests <font color="#8A8A8A">(module downloads, fetch)</font> <font color="#26A269">NO_COLOR</font> Set to disable color <font color="#26A269">NO_PROXY</font> Comma-separated list of hosts which do not use a proxy <font color="#8A8A8A">(module downloads, fetch)</font> <font color="#26A269">NPM_CONFIG_REGISTRY</font> URL to use for the npm registry. <font color="#A2734C">Docs:</font> https://docs.deno.com <font color="#A2734C">Standard Library:</font> https://jsr.io/@std <font color="#A2734C">Bugs:</font> https://github.com/denoland/deno/issues <font color="#A2734C">Discord:</font> https://discord.gg/deno </pre></html></WRAP> </WRAP> ===== 更新 ===== <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">deno</font> run <font color="#A347BA">-A</font> npm:create-astro@latest <font color="#A347BA">--</font> <font color="#A347BA">--template</font> minimal </pre></html></WRAP> <WRAP color_result><html><pre> <font color="#26A269">A new release of Deno is available:</font> <font color="#2AA1B3">2.2.3</font> → <font color="#2AA1B3">2.2.6</font> <font color="#666666"><i>Run `deno upgrade` to install it.</i></font> </pre></html></WRAP> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">deno</font> upgrade </pre></html></WRAP> <WRAP color_result><html><pre> Current Deno version: v2.2.3 <font color="#8A8A8A">Looking up stable version</font> Found latest stable version <font color="#26A269">v2.2.6</font> <font color="#8A8A8A">Downloading https://github.com/denoland/deno/releases/download/v2.2.6/deno-x86_64-unknown-linux-gnu.zip</font> <font color="#8A8A8A">Deno is upgrading to version 2.2.6</font> Upgraded successfully to Deno <font color="#26A269">v2.2.6</font> <font color="#8A8A8A">(stable)</font> </pre></html></WRAP> </WRAP> ===== Deno kernel for Jupyter notebooks ===== [[python:jupyterlab|JupyterLab - Project Jupyter の次世代ユーザーインターフェース]] をインストールする🤔\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">deno</font> jupyter <font color="#A347BA">-h</font> </pre></html></WRAP> <WRAP color_result><html><pre> Deno kernel for Jupyter notebooks <font color="#D0CFCC">Usage:</font> <font color="#26A269">deno jupyter</font> <font color="#26A269">[OPTIONS]</font> <font color="#A2734C">Options:</font> <font color="#26A269">--conn <conn></font> Path to JSON file describing connection parameters, provided by Jupyter <font color="#26A269">--install</font> Installs kernelspec, requires 'jupyter' command to be available. <font color="#26A269">--kernel</font> Start the kernel <font color="#26A269">-q</font>, <font color="#26A269">--quiet</font> Suppress diagnostic output </pre></html></WRAP> </WRAP> <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">deno</font> jupyter <font color="#A347BA">--install</font> </pre></html></WRAP> <WRAP color_result><html><pre> <font color="#A2734C">Warning</font> "deno jupyter" is unstable and might change in the future. ✅ Deno kernelspec installed successfully. </pre></html></WRAP> </WRAP> Jupyter Kernel のインストール確認🤔\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">mamba</font> run <font color="#A347BA">-n</font> jupyterlab jupyter kernelspec list </pre></html></WRAP> <WRAP color_result><html><pre> 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 </pre></html></WRAP> </WRAP> <WRAP zoomimg w600 x1_3> {{:javascript:deno_kernel_for_jupyter_notebooks_001.png|Deno kernel for Jupyter notebooks 001}} </WRAP> ===== tslab ===== tslab で TypeScript と JavaScript Kernel をインストールする場合は以下の手順を実行する🤔\\ 事前に [[javascript:pnpm|pnpm]] のインストールが必要😉\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">pnpm</font> install <font color="#A347BA">-g</font> tslab </pre></html></WRAP> <WRAP color_result><html><pre class=BSc> Downloading <font color="#FFFFFF">zeromq@6.3.0</font>: <font color="#33C7DE">6.99 MB</font>/<font color="#33C7DE">6.99 MB</font>, done <span style="background-color:#A2734C"><font color="#171421"> WARN </font></span> <font color="#C01C28">6 deprecated subdependencies found:</font> are-we-there-yet@3.0.1, gauge@4.0.4, glob@7.2.3, inflight@1.0.6, npmlog@6.0.2, sourcemap-codec@1.4.8<font color="#FFFFFF">-for-tslab@5.0.4</font>: <font color="#33C7DE">3.28 MB</font>/<font color="#33C7DE">7.05 MB</font> Packages: <font color="#26A269">+165</font> <font color="#26A269">++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font> Downloading <font color="#FFFFFF">@tslab/typescript-for-tslab@5.0.4</font>: <font color="#33C7DE">7.05 MB</font>/<font color="#33C7DE">7.05 MB</font>, done Progress: resolved <font color="#33C7DE">166</font>, reused <font color="#33C7DE">0</font>, downloaded <font color="#33C7DE">165</font>, added <font color="#33C7DE">165</font>, done <font color="#33C7DE">/home/tomoyan/.local/share/pnpm/global/5:</font> <font color="#26A269">+</font> tslab <font color="#666666">1.0.22</font> <font color="#A2734C">╭ Warning ──────────────────────────────────────────────────────────────────────────────────────╮</font> <font color="#A2734C">│</font> <font color="#A2734C">│</font> <font color="#A2734C">│</font> Ignored build scripts: zeromq. <font color="#A2734C">│</font> <font color="#A2734C">│</font> Run "pnpm approve-builds -g" to pick which dependencies should be allowed to run scripts. <font color="#A2734C">│</font> <font color="#A2734C">│</font> <font color="#A2734C">│</font> <font color="#A2734C">╰───────────────────────────────────────────────────────────────────────────────────────────────╯</font> Done in 29.3s using pnpm v10.6.1 </pre></html></WRAP> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">pnpm</font> approve-builds <font color="#A347BA">-g</font> <font color="#2AA1B3">?</font> Choose which packages to build (Press <font color="#2AA1B3"><space></font> to select, <font color="#2AA1B3"><a></font> to toggle all, <font color="#2AA1B3"><i></font> to invert selection) … <font color="#2AA1B3">❯</font> ● <span style="background-color:#171421"><font color="#FFFFFF">zeromq</font></span> -> Enter ✔ Choose which packages to build (Press <font color="#2AA1B3"><space></font> to select, <font color="#2AA1B3"><a></font> to toggle all, <font color="#2AA1B3"><i></font> to invert selection) · <font color="#2AA1B3">zeromq</font> <font color="#2AA1B3">?</font> <b>The next packages will now be built: zeromq.</b> <b>Do you approve?</b> (y/N) ‣ <font color="#2AA1B3">false</font> -> y <b>Do you approve?</b> (y/N) · <font color="#26A269">true</font> <font color="#666666">.pnpm/zeromq@6.3.0/node_modules/</font>zeromq: Running install script, done in 544ms </pre></html></WRAP> </WRAP> 動作確認🤔\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">tslab</font> install <font color="#A347BA">--version</font> </pre></html></WRAP> <WRAP color_result><html><pre> tslab 1.0.22 </pre></html></WRAP> </WRAP> Jupyter の TypeScript kernel と JavaScript kernel をインストール🤔\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">mamba</font> run <font color="#A347BA">-n</font> jupyterlab tslab install </pre></html></WRAP> <WRAP color_result><html><pre> 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 </pre></html></WRAP> </WRAP> Jupyter Kernel のインストール確認🤔\\ <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">mamba</font> run <font color="#A347BA">-n</font> jupyterlab jupyter kernelspec list </pre></html></WRAP> <WRAP color_result><html><pre> 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 jupyter_common /home/tomoyan/.local/share/jupyter/kernels/jupyter_common rust /home/tomoyan/.local/share/jupyter/kernels/rust tslab /home/tomoyan/.local/share/jupyter/kernels/tslab user-site-env /home/tomoyan/.local/share/jupyter/kernels/user-site-env </pre></html></WRAP> </WRAP> <WRAP color_term> <WRAP color_command><html><pre> <font color="#0087FF"><b>$</b></font> <font color="#26A269">mamba</font> run <font color="#A347BA">-n</font> jupyterlab jupyter lab <font color="#A347BA">--ip=0.0.0.0</font> <font color="#A347BA">--port=28888</font> <font color="#A347BA">--no-browser</font> </pre></html></WRAP> </WRAP> <WRAP zoomimg w600 x1_2> {{:javascript:tslab_kernel_for_jupyter_notebooks_001.png?720|tslab kernel for Jupyter notebooks 001}} </WRAP> ===== 参考文献 ===== [[jpb>bringing-modern-javascript-to-the-jupyter-notebook-fc998095081e|Bringing Modern JavaScript to the Jupyter Notebook | by Kyle Kelley | Jupyter Blog]]\\ [[https://deno.com/blog/v1.37|Deno 1.37: Modern JavaScript in Jupyter Notebooks]]\\ [[git>yunabe/tslab|yunabe/tslab: Interactive JavaScript and TypeScript programming with Jupyter]]\\ [[git>yunabe/tslab-examples|yunabe/tslab-examples: Example notebooks of tslab (https://github.com/yunabe/tslab)]]\\ [[git>denoland/pm-benchmark|denoland/pm-benchmark]]\\ typescript/deno.txt 最終更新: 2025/04/27 06:06by ともやん