惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
I
InfoQ
N
Netflix TechBlog - Medium
D
DataBreaches.Net
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
C
Cisco Blogs
T
Threat Research - Cisco Blogs
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
Recorded Future
Recorded Future
J
Java Code Geeks
The Cloudflare Blog
S
Securelist
人人都是产品经理
人人都是产品经理
T
Tor Project blog
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
V
V2EX
P
Palo Alto Networks Blog
I
Intezer
罗磊的独立博客
博客园 - 叶小钗
T
The Exploit Database - CXSecurity.com
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
Blog — PlanetScale
Blog — PlanetScale
P
Privacy International News Feed
P
Proofpoint News Feed
美团技术团队
Cisco Talos Blog
Cisco Talos Blog
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
L
LINUX DO - 热门话题
Simon Willison's Weblog
Simon Willison's Weblog
MyScale Blog
MyScale Blog
H
Help Net Security
W
WeLiveSecurity
Google Online Security Blog
Google Online Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

Deno

Deno 2.8 | Deno Claw Patrol: an open-source security firewall for agents | Deno Fresh 2.3: Zero JS by default, View Transitions, and Temporal support | Deno Deno 2.7: Temporal API, Windows ARM, and npm overrides | Deno Build a dinosaur runner game with Deno, pt. 6 | Deno Build a dinosaur runner game with Deno, pt. 5 | Deno Deno Deploy is Generally Available | Deno Introducing Deno Sandbox | Deno Build a dinosaur runner game with Deno, pt. 4 | Deno Build a dinosaur runner game with Deno, pt. 3 | Deno Build a dinosaur runner game with Deno, pt. 2 | Deno React / Next.js Denial-of-Service Vulnerability: Deno Deploy users protected | Deno Deno 2.6: dx is the new npx | Deno Build a dinosaur runner game with Deno, pt. 1 | Deno React Server Functions / Next.js Vulnerability: Deno Deploy users protected | Deno My highlights from the new Deno Deploy | Deno Deno's Other Open Source Projects | Deno How Deno protects against npm exploits | Deno Help Us Raise $200k to Free JavaScript from Oracle | Deno Deno 2.5: Permissions in the config file | Deno Fresh 2.0 Graduates to Beta, Adds Vite Support | Deno Deno 2.4: deno bundle is back | Deno JavaScript™ Trademark Update | Deno What's coming to JavaScript | Deno A brief history of JavaScript | Deno Reports of Deno's Demise Have Been Greatly Exaggerated | Deno An Update on Fresh | Deno How Plaid migrated 100 services to a new database platform 5x faster with Deno | Deno Deno 2.3: Improved deno compile, local npm packages, and more | Deno Add JSR packages with pnpm and Yarn | Deno Zero-config Debugging with Deno and OpenTelemetry | Deno Exploring Art with TypeScript, Jupyter, Polars, and Observable Plot | Deno Deno v Oracle Update 3: Fighting the JavaScript Trademark | Deno Build a custom RAG AI agent in TypeScript and Jupyter | Deno How to get deep traces in your Node.js backend with OTel and Deno | Deno toranoana.deno #20 登録受付中(2025年3月14日) | Deno Node just added TypeScript support. What does that mean for Deno? | Deno The Dino 🦕, the Llama 🦙, and the Whale 🐋 | Deno Publish a lint rule, get a prize | Deno Deno 2.2: OpenTelemetry, Lint Plugins, node:sqlite | Deno If you're not using npm specifiers, you're doing it wrong | Deno How Deno's documentation is evolving | Deno Oracle justified its JavaScript trademark with Node.js—now it wants that ignored | Deno Introducing the JSR open governance board | Deno Intro to Wasm in Deno | Deno Announcing OpenAI on JSR | Deno Deno in 2024 | Deno Goodbye WinterCG, welcome WinterTC | Deno Build a SolidJS app with Deno | Deno Run your Next.js SSR app on Deno Deploy | Deno Solve Advent of Code 2024 with Deno and Win Prizes! | Deno Deno v. Oracle: Canceling the JavaScript Trademark | Deno Deno 2.1: Wasm Imports and other enhancements | Deno Build a Typesafe API with tRPC and Deno | Deno Self-contained Executable Programs with Deno Compile | Deno Build a Database App with Drizzle ORM and Deno | Deno Introducing your new JavaScript package manager: Deno | Deno Announcing Growthbook on JSR | Deno Build an Astro site with Deno | Deno How to convert CommonJS to ESM | Deno Announcing Deno 2 | Deno The Final Touches: What’s New In v2.0.0-rc.10 | Deno Announcing Stable V8 Bindings for Rust | Deno Deno 2.0 Release Candidate | Deno Secure, efficient private npm registries with Cloudsmith and Deno | Deno Painting the Plane as We Fly It: Designing JSR | Deno Introducing Web Cache API support on Deno Deploy | Deno Deno 1.46: The Last 1.x Release | Deno Protect your cloud spend with new Deno Deploy spend limits | Deno Benchmarking AWS Lambda Cold Starts Across JavaScript Runtimes | Deno Announcing Supabase on JSR | Deno Deno 1.45: Workspace and Monorepo Support | Deno Introducing KV Backup for Deno Subhosting | Deno A Gentle Intro to TypeScript | Deno Announcing Hono on JSR | Deno How We Made the Deno Language Server Ten Times Faster | Deno How the Guardian uses Deno to audit accessibility and performance across their 2.7 million articles | Deno Introducing More Flexible Domain Association for Deno Subhosting | Deno The stabilization process of the Standard Library has begun | Deno Deno 1.44: Private npm registries, improved Node.js compat, and performance boosts | Deno How we built a secure, performant, multi-tenant cloud platform to run untrusted code | Deno The Deno Standard Library is now available on JSR | Deno How to document your JavaScript package | Deno Your Low Code Solution Needs an Escape Hatch | Deno Deno 1.43: Improved Language Server performance | Deno How Slack used Deno to save months of engineering effort in launching their new platform | Deno JSR Is Not Another Package Manager | Deno Announcing the Hookdeck SDK on JSR | Deno Announcing the Neon Serverless Driver on JSR | Deno An intro to TSConfig for JavaScript Developers | Deno How we built JSR | Deno How Netlify used Deno Subhosting to build a successful edge functions product | Deno Introducing Simpler Project Creation in Deno Deploy | Deno Deno 1.42: Better dependency management with JSR | Deno Introducing deployctl, the command line interface for Deno Deploy | Deno Introducing JSR - the JavaScript Registry | Deno How to add Monaco to a Next.js app and securely run untrusted user code | Deno Survey Results and Roadmap | Deno Deno 1.41: smaller deno compile binaries | Deno Webhooks suck, but here are alternatives | Deno
What we got wrong about HTTP imports | Deno
Ryan Dahl · 2024-07-29 · via Deno

Everything should be made as simple as possible, but not simpler.

Albert Einstein

From the beginning, HTTP imports have been a key feature of Deno. For years, this was the entire module system, aimed at simplifying JavaScript development by using the web’s distributed nature, unlike npm’s centralized registry.

For example, you can import the assertEquals() function from the standard library like this:

import { assertEquals } from "https://deno.land/std@0.224.0/assert/mod.ts";

assertEquals(1, 2);

This idea was game-changing (and still can be). We pursued it hard, before eventually realizing: this design decision came with significant tradeoffs.

Let’s explore why this approach doesn’t scale with project complexity as well as we’d originally hoped, and how Deno recommends sharing and consuming modules today to overcome these challenges.

The Dream

Designing Deno’s module system around HTTP imports was ambitious. It aimed to replace npm with a distributed system over HTTP, aligning with how ES Modules work in browsers. This eliminated the need for package.json files and node_modules folders, simplifying project structures. Deno scripts could scale down to single-file programs without a project directory or configuration. Unlike npm, which downloads large tarballs, HTTP imports fetch only the necessary source code. Private registries simply become authenticated proxies.

We integrated this deeply into Deno’s workflows, including caching, preloading, and reloading. We also built deno.land/x, a registry to connect a git repo and share it over HTTP, complete with features like generated documentation.

The Reality

Despite its promise, several issues with HTTP imports emerged since that initial implementation.

Length of URLs

Long URLs clutter codebases, especially in larger projects. Compare:

import express from "express"; 

import oak from "https://deno.land/x/oak@v16.1.0"; 

Node’s import is clearly shorter (and much more memorable).

Dependency management

Managing long URLs and versions becomes increasingly tedious as projects grow.

Initially, we embraced the deps.ts convention to centralize dependencies in a single file in a project:


export { concat } from "https://deno.land/std@0.200.0/bytes/mod.ts";
export * as base64 from "https://deno.land/std@0.200.0/encoding/base64.ts";

Then, dependencies could be imported like this:

import { concat } from "../../deps.ts";

While this works, it’s cumbersome compared to a simple package.json file.

Duplicate dependencies

URLs lack semantic versioning, making it hard to manage dependencies.

Although version strings can be embedded in URLs (e.g., https://deno.land/std@0.224.0/fs/copy.ts), HTTP imports lock you in to just one exact version until and unless you manually update the URL. In larger projects, this means you can easily wind up with several variants of the same library in your codebase (which of course is very rarely necessary or beneficial in practice).

Semantic versioning helps deduplicate dependencies, reducing the number of loaded modules. Ideally, Deno should recognize interchangeable modules, using the latest version.

Reliability

The decentralized module system also caused reliability problems. Many modules were hosted on random websites or personal servers, leading to uptime issues. While these servers going down did not immediately make the Deno programs go down (because we cache remote dependencies), it could brick CI and new deployments. And while Deno ensures high availability for its deno.land/x registry, it can’t control other hosts, making overall availability dependent on the least reliable host in your dependency graph.

The solution

To address all of the issues above, Deno’s introduced two major improvements: Import Maps, and JSR.

Turning the Corner with Import Maps and JSR

Let us be clear: Deno is not removing HTTP imports. We still believe in their usefulness. However, it’s become obvious more structure is often needed.

We are committed to improving the JavaScript ecosystem by simplifying how code is written and distributed. JavaScript, essentially the default programming language, deserves a great module system.

Part of that solution is import maps, another web standard from the browser, implemented in Deno. Import maps allow you to get short and memorable specifiers back and manage versions across many files:

{
  "imports": {
    "$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts",
    "$marked-mangle": "https://esm.sh/marked-mangle@1.0.1",
    "@astral/astral": "jsr:@astral/astral@^0.4.0",
    "@fresh/plugin-tailwind": "./plugin-tailwindcss/src/mod.ts",
    "@luca/esbuild-deno-loader": "jsr:@luca/esbuild-deno-loader@^0.10.3"
  }
}

On their own, however, import maps don’t solve the semantic versioning problem or the reliability problem—that’s where JSR comes in.

We created JSR as a centralized repository that understands semver, to address the remaining two issues:

  • JSR avoids the reliability problem of depending on multiple hosts to serve modules; and
  • JSR avoids the duplicate dependency problem using semantic versioning (similar to how package.json works in Node with npm).

We believe this new registry will vastly simplify how JavaScript is consumed and shared. While it is admittedly a bit more complex than HTTP imports, we feel the benefits are worth the tradeoffs.

What is JSR?

We launched JSR in March. JSR is an open-source, cross-runtime code registry that allows users to easily share modern JavaScript and TypeScript. It’s built to be reliable and cheap to host, essentially acting as a heavily cached file server due to immutability guarantees.

JSR understands and enforces semantic versioning, solving the duplicate dependency problem. A centralized repository also allows us to provide many improvements that wouldn’t be possible otherwise, from simple publishing of TypeScript to package scoring that encourages best practices. (You can read more about JSR here and why we built JSR here.)

Under the hood, JSR still uses HTTP imports. For example, take this specifier:

jsr:@luca/flag

The above can really just be thought of as a smart redirect to:

https://jsr.io/@luca/flag/1.0.0/mod.ts

This means JSR inherits the parts of HTTP imports that are really great. For example: granular downloads of only the code that is actually being imported (no large tarballs!). Because users are not exposed to these HTTP imports directly however, problems such as long URLs and manual string management go away.

What This Means for Modern Deno

Existing Deno scripts with HTTP imports will continue to work—they’re great for projects of a certain scale. However, we now recommend using import maps instead of deps.ts, and JSR over deno.land/x and/or npm.

So, coming back to the assert example from above: you’ll find it’s much more terse in this new system. And because of semver resolution, dependencies automatically stay up to date (as long as they are not pinned by a lockfile)!


import { assertEquals } from "https://deno.land/std@0.224.0/assert/mod.ts";


import { assertEquals } from "jsr:@std/assert@1";

assertEquals(1, 2);

When used in a larger project, you can optionally add an import map to make the import specifier shorter, and managing versions across files easier. Then the assert example looks even more terse:

import { assertEquals } from "@std/assert";
assert(1, 2);
{
  "imports": {
    "@std/assert": "jsr:@std/assert@1"
  }
}

It’s up to you when or if you opt in to this approach. We value the ability of Deno scripts to scale down to single files (without deno.json configuration), so it’s important that the import map is completely optional.

Deno 2 is around the corner

JavaScript deserves a simple module system aligned with browser standards. We want to level up the ecosystem, and help it become the industry bedrock we believe it will inevitably become.

To get there, we need good design, and good design requires iteration—we must honestly examine the problems and address them.

Solving these problems defines many of the changes in Deno 2:

  • JSR for sharing modules instead of random file servers
  • semver for versioning Deno packages
  • import maps for managing dependencies

There are a few other properties of Deno 2 that we haven’t discussed:

  • workspaces and monorepo support, landed in Deno 1.45
  • deep Node/npm compatibility including N-API support and compatibility with Next.js

We’ll be releasing Deno 2 in September this year (for real this time).

I’m excited to see how people make use of the next generation of the simple-as-possible-but-not-simpler JavaScript toolchain.

🚨️ Deno 2 is right around the corner 🚨️

There are some minor breaking changes in Deno 2, but you can make your migration smoother by using the DENO_FUTURE=1 flag today.