← 返回
开发者工具 中文

Deno

Build with Deno runtime avoiding permission gotchas, URL import traps, and Node.js migration pitfalls.
使用 Deno 运行时构建,避免权限陷阱、URL 导入陷阱以及 Node.js 迁移的坑。
ivangdavila ivangdavila 来源
开发者工具 clawhub v1.0.0 1 版本 99895 Key: 无需
★ 2
Stars
📥 911
下载
💾 11
安装
1
版本
#latest

概述

When to Use

User needs Deno expertise — secure TypeScript runtime with permissions model. Agent handles permission configuration, dependency management via URLs/npm, and migration from Node.js.

Quick Reference

TopicFile
-------------
Permission systempermissions.md
Imports and dependenciesimports.md
Node.js migrationnode-compat.md

Permission Traps

  • --allow-all in development — then production crashes because you don't know what permissions you actually need
  • --allow-read without path — grants access to entire filesystem, security hole
  • --allow-run without list — subprocess can run anything, specify: --allow-run=git,npm
  • --allow-env without list — leaks all env vars, specify: --allow-env=API_KEY,DATABASE_URL
  • --allow-net without list — can connect anywhere, specify hosts: --allow-net=api.example.com
  • Missing permission in CI — hangs waiting for prompt that never comes, add --no-prompt

Import Traps

  • Remote URLs in production — network failure = app won't start, vendor dependencies locally
  • No lockfile by default — deps can change between runs, always use deno.lock
  • @^1.0.0 semver syntax doesn't exist — use exact URLs or import maps
  • Import maps in wrong place — must be in deno.json, not separate file (Deno 2.x)
  • HTTPS required — HTTP imports blocked by default, most CDNs work but self-hosted may not
  • URL typo — no error until runtime when import fails

TypeScript Traps

  • .ts extension required in imports — model generates extensionless imports that fail
  • tsconfig.json paths ignored — Deno uses import maps in deno.json, not tsconfig
  • Type-only imports — must use import type or bundler may fail
  • Decorators — experimental, different from tsc behavior
  • /// — handled differently than tsc, may be ignored

Deployment Traps

  • deno compile includes runtime — binary is 50MB+ minimum
  • --cached-only requires prior cache — fresh server needs deno cache first
  • Deno Deploy limitations — no filesystem, no subprocess, no FFI
  • Environment variables — different API: Deno.env.get("VAR") not process.env.VAR
  • Signals — Deno.addSignalListener not process.on("SIGTERM")

Testing Traps

  • Deno.test different from Jest — no describe, different assertions
  • Async test without await — test passes before promise resolves
  • Resource leaks — tests fail if you don't close files/connections
  • Permissions in tests — test may need different permissions than main code
  • Snapshot testing — format differs from Jest snapshots

npm Compatibility Traps

  • npm: specifier — works for most packages but native addons fail
  • node: specifier required — import fs from 'fs' fails, need import fs from 'node:fs'
  • node_modules optional — enable with "nodeModulesDir": true in deno.json
  • package.json scripts — not automatically supported, use deno.json tasks
  • Peer dependencies — handled differently, may get wrong versions

Runtime Differences

  • Deno.readTextFile vs fs.readFile — different API, different error types
  • fetch is global — no import needed, unlike Node 18-
  • Top-level await — works everywhere, no wrapper needed
  • Permissions at runtime — can request dynamically but user must approve

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 08:11 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 325,898
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,465
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,385 📥 321,012