deno eval
命令行用法
o eval [选项] [CODE_ARG]...
从命令行评估 JavaScript。
deno eval "console.log('hello world')"
以 TypeScript 评估:
deno eval --ext=ts "const v: string = 'hello'; console.log(v)"
此命令隐式拥有所有权限。
了解更多: https://docs.deno.com/go/eval
不稳定选项 Jump to heading
--unstable
Jump to heading
--unstable
标志已被弃用。请改用细粒度的 --unstable-*
标志.
--unstable-bare-node-builtins
Jump to heading
启用不稳定的裸节点内置功能.
--unstable-broadcast-channel
Jump to heading
启用不稳定的 BroadcastChannel
API.
--unstable-cron
Jump to heading
启用不稳定的 Deno.cron API.
--unstable-detect-cjs
Jump to heading
在更多情况下将模棱两可的 .js、.jsx、.ts、.tsx 文件视为 CommonJS 模块.
--unstable-kv
Jump to heading
启用不稳定的键值存储 API.
--unstable-net
Jump to heading
启用不稳定的网络 API.
--unstable-node-globals
Jump to heading
在所有地方暴露 Node 全局变量.
--unstable-sloppy-imports
Jump to heading
启用通过扩展探测、.js 到 .ts 以及目录探测来解析模块的不稳定功能.
--unstable-temporal
Jump to heading
启用不稳定的 Temporal API.
--unstable-unsafe-proto
Jump to heading
启用不安全的 proto 支持。这是一个安全风险。.
--unstable-webgpu
Jump to heading
启用不稳定的 WebGPU
API.
--unstable-worker-options
Jump to heading
启用不稳定的 Web Worker API.
类型检查选项 Jump to heading
--check
Jump to heading
启用类型检查。此子命令默认不进行类型检查 如果提供了 "all" 值,远程模块将被包含。 或者,可以使用 'deno check' 子命令.
--no-check
Jump to heading
跳过类型检查。如果提供了 "remote" 值,远程模块的诊断错误将被忽略.
依赖管理选项 Jump to heading
--cached-only
Jump to heading
要求远程依赖项已缓存.
--frozen
Jump to heading
如果锁文件过期则报错.
--import-map
Jump to heading
从本地文件或远程 URL 加载导入映射文件 文档:https://docs.deno.com/runtime/manual/basics/import_maps.
--lock
Jump to heading
检查指定的锁文件。(如果未提供值,默认为 "./deno.lock").
--no-lock
Jump to heading
禁用自动发现锁文件.
--no-npm
Jump to heading
不解析 npm 模块.
--no-remote
Jump to heading
不解析远程模块.
--node-modules-dir
Jump to heading
设置 npm 包的 node 模块管理模式.
--reload
Jump to heading
Short flag: -r
重新加载源代码缓存(重新编译 TypeScript) 无值 重新加载所有内容 jsr:@std/http/file-server,jsr:@std/assert/assert-equals 重新加载特定模块 npm: 重新加载所有 npm 模块 npm:chalk 重新加载特定 npm 模块.
--vendor
Jump to heading
切换远程模块的本地 vendor 文件夹和 npm 包的 node_modules 文件夹的使用.
Options Jump to heading
--allow-scripts
Jump to heading
允许运行给定包的 npm 生命周期脚本
注意:只有在使用 node_modules 目录时才会执行脚本(--node-modules-dir
).
--cert
Jump to heading
从 PEM 编码文件加载证书颁发机构.
--config
Jump to heading
Short flag: -c
配置 deno 的不同方面,包括 TypeScript、代码格式化和代码格式化
通常配置文件将被称为 deno.json
或 deno.jsonc
并自动检测;在这种情况下,此标志不是必需的。
文档:https://docs.deno.com/go/config.
--env-file
Jump to heading
从本地文件加载环境变量 仅使用具有给定键的第一个环境变量。 现有的进程环境变量不会被覆盖,因此如果环境中已经存在具有相同名称的变量,它们的值将被保留。 如果 .env 文件中存在多个相同环境变量的声明,则应用第一个遇到的声明。这由您作为参数传递的文件的顺序决定。.
--ext
Jump to heading
设置提供文件的内容类型.
--location
Jump to heading
某些 web API 使用的 globalThis.location 的值.
--no-config
Jump to heading
禁用自动加载配置文件.
--print
Jump to heading
Short flag: -p
将结果打印到标准输出.
--seed
Jump to heading
设置随机数生成器种子.
--v8-flags
Jump to heading
要查看所有可用标志的列表,请使用 --v8-flags=--help
标志也可以通过 DENO_V8_FLAGS 环境变量设置。
使用此标志设置的任何标志都会附加在 DENO_V8_FLAGS 环境变量之后.
调试选项 Jump to heading
--inspect
Jump to heading
在 host:port 上激活检查器 [默认: 127.0.0.1:9229]
--inspect-brk
Jump to heading
在 host:port 上激活检查器,等待调试器连接并在用户脚本开始时中断.
--inspect-wait
Jump to heading
在 host:port 上激活检查器,并在运行用户代码之前等待调试器连接.