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

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Spread Privacy
Spread Privacy
T
Troy Hunt's Blog
Recent Announcements
Recent Announcements
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Schneier on Security
罗磊的独立博客
T
The Exploit Database - CXSecurity.com
博客园 - 司徒正美
月光博客
月光博客
C
Cybersecurity and Infrastructure Security Agency CISA
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Project Zero
Project Zero
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
L
Lohrmann on Cybersecurity
阮一峰的网络日志
阮一峰的网络日志
C
CERT Recently Published Vulnerability Notes
腾讯CDC
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
T
Threat Research - Cisco Blogs
T
Tenable Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - Franky
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
Attack and Defense Labs
Attack and Defense Labs
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
Scott Helme
Scott Helme
小众软件
小众软件
L
LINUX DO - 最新话题
博客园 - 叶小钗
博客园 - 【当耐特】
PCI Perspectives
PCI Perspectives
SecWiki News
SecWiki News
S
Security Affairs
P
Palo Alto Networks Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
SegmentFault 最新的问题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 聂微东
量子位
C
CXSECURITY Database RSS Feed - CXSecurity.com
Help Net Security
Help Net Security
S
Secure Thoughts
S
Securelist

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 What we got wrong about HTTP imports | 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
Deno 1.20 Release Notes | Deno
2022-03-17 · via Deno

Deno 1.20 has been tagged and released with the following new features and changes:

  • Faster calls into Rust
  • Auto-compression for HTTP response bodies
  • New subcommand: deno bench
  • New subcommand: deno task
  • Import map specified in config file
  • Do not require TLS/HTTPS information to be external files
  • Low level API to upgrade HTTP connections
  • FFI API supports read only global statics
  • Tracing operations while using deno test
  • Support for AbortSignal.timeout()
  • Dedicated interface for TCP and Unix connections
  • BREAKING: Stricter defaults in programmatic permissions for tests and workers
  • TypeScript 4.6
  • V8 10.0

If you already have Deno installed, you can upgrade to 1.20 by running:

If you are installing Deno for the first time, you can use one of the methods listed below:


curl -fsSL https://deno.land/x/install/install.sh | sh


iwr https://deno.land/x/install/install.ps1 -useb | iex


brew install deno


scoop install deno


choco install deno

Faster calls into Rust

While not a directly user facing feature, when your code is executed, it often needs to communicate between the Javascript engine (V8) and the rest of Deno, which is written in Rust.

In this release we have optimized our communication layer to be up to ~60% faster - we have leveraged Rust proc macros to generate highly optimized V8 bindings from existing Rust code.

The macro optimizes away deserialization of unused arguments, speeds up metric collection and provides a base for future integration with the V8 Fast API, which will further improve performance between Javascript and Rust.

Previous versions of Deno used a common V8 binding along with a routing mechanism to call into the ops (what we call a message between Rust and V8). With this new proc macro, each op gets its own V8 binding thus eliminating the need for routing ops.

Here are some baseline overhead benchmarks:

a graph demonstrating the significant performance improvement of internal Deno ops

Overall thanks to this change and other optimizations, Deno 1.20 improves base64 roundtrip of 1mb string from ~125ms to ~3.3ms in Deno 1.19!

For more details, dive into this PR.

Auto-compression for HTTP Response bodies

Deno’s native HTTP server now supports auto-compression for response bodies. When a client request supports either gzip or brotli compression, and your server responds with a body that isn’t a stream, the body will be automatically compressed within Deno, without any need for you to configure anything:

import { serve } from "https://deno.land/std@0.140.0/http/server.ts";

function handler(req: Request): Response {
  const body = JSON.stringify({
    hello: "deno",
    now: "with",
    compressed: "body",
  });
  return new Response(body, {
    headers: {
      "content-type": "application/json; charset=utf-8",
    },
  });
}

serve(handler, { port: 4242 });

Internally, Deno will analyze the Accept-Encoding header, plus ensure the response body content type is compressible and automatically compress the response:

> curl -I --request GET --url http://localhost:4242 --H "Accept-Encoding: gzip, deflate, br"

HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
vary: Accept-Encoding
content-encoding: gzip
content-length: 72
date: Tue, 15 Mar 2022 00:00:00 GMT

There are a few more details and caveats. Check out Automatic Body Compression in the manual for more details.

New subcommand: deno bench

Benchmarking your code is an effective way to identify performance issues and regressions and this release adds new deno bench subcommand and Deno.bench() API. deno bench is modelled after deno test and works in similar manner.

First, let us create a file url_bench.ts and register a benchmark test using the Deno.bench() function.

url_bench.ts

Deno.bench("URL parsing", () => {
  new URL("https://deno.land");
});

Second, run the benchmark using the deno bench subcommand (--unstable is required for now, since it is a new API).

deno bench --unstable url_bench.ts
running 1 bench from file:///dev/url_bench.ts
bench URL parsing ... 1000 iterations 23,063 ns/iter (208..356,041 ns/iter) ok (1s)

bench result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (1s)

By default, each registered bench case will be run 2000 times: first a thousand warmup iterations will be performed to allow the V8 JavaScript engine to optimize your code; and then another thousand iterations will be measured and reported.

You can customize number of warmup and measure iterations by setting Deno.BenchDefinition.warmup and Deno.BenchDefinition.n respectively:


Deno.bench({ warmup: 1e5, n: 1e6 }, function resolveUrl() {
  new URL("./foo.js", import.meta.url);
});

To learn more about deno bench visit the manual.

We plan to add more features to deno bench in the near future, including:

  • more detailed reports with percentile ranks
  • JSON and CSV report output
  • integration into the language server so it can be used in editors

We are also looking for feedback from the community to help shape the feature and stabilize it.

New subcommand: deno task

Deno 1.20 adds a new task runner to provide a convenient way of defining and executing custom commands specific to the development of a codebase. This is similar to npm scripts or makefiles, and is designed to work in a cross platform way.

Say we had the following command that was used often in our codebase:

deno run --allow-read=. scripts/analyze.js

We could define this in a Deno configuration file:

{
  "tasks": {
    "analyze": "deno run --allow-read=. scripts/analyze.js"
  }
}

Then when in a directory that automatically resolves this configuration file, tasks may be run by calling deno task <task-name>. So in this case, to execute the analyze task we would run:

Or a more complex example:

{
  "tasks": {
    
    
    
    
    
    
    "npm:publish": "BUILD=prod deno task npm:build && cd dist && npm publish",
    
    "npm:build": "deno run -A scripts/build_npm_package.js"
  }
}

The syntax used is a subset of POSIX like shells and works cross platform on Windows, Mac, and Linux. Additionally, it comes with a few built-in cross platform commands such as mkdir, cp, mv, rm, and sleep. This shared syntax and built-in commands exist to eliminate the need for additional cross platform tools seen in the npm ecosystem such as cross-env, rimraf, etc.

For a more detailed overview see the manual.

Note that deno task is unstable and might drastically change in the future. We would appreciate your feedback to help shape this feature.

Import map specified in the configuration file

Previously, specifying an import map file required always providing the --import-map flag on the command line.

deno run --import-map=import_map.json main.ts

In Deno 1.20, this may now be specified in the Deno configuration file.

{
  "importMap": "import_map.json"
}

The benefit is that if your current working directory resolves a configuration file or you specify a configuration file via --config=<FILE>, then you no longer need to also remember to specify the --import-map=<FILE> flag.

Additionally, the configuration file serves as a single source of truth. For example, after upgrading to Deno 1.20 you can move your LSP import map configuration to deno.json (e.g. in VSCode you can move the "deno.importMap": "<FILE>" config in your editor settings to only be in your deno.jsonc config file if you desire).

Do not require TLS/HTTPS information to be external files

Secure HTTPS requests require certificate and private key information to support the TLS protocol to secure those connections. Previously Deno only allowed the certificate and the private key to be stored as physical files on disk. In this release we have added cert and key options to Deno.listenTls() API and deprecated certFile and keyFile.

This allows users to load the PEM certificate and private key from any source as a string. For example:

const listener = Deno.listenTls({
  hostname: "localhost",
  port: 6969,
  cert: await Deno.readTextFile("localhost.crt"),
  key: await Deno.readTextFile("localhost.key"),
});

Low-level API to upgrade HTTP connections

A new Deno namespace API was added in this release: Deno.upgradeHttp(). It is unstable and requires the --unstable flag to be used.

You can use this API to perform an upgrade of the HTTP connection, which allows to implement higher level protocols based on HTTP (like WebSockets); the API works for TCP, TLS and Unix socket connections.

This is a low level API and most users won’t need to use it directly.

An example using TCP connection:

import { serve } from "https://deno.land/std@0.140.0/http/server.ts";

serve((req) => {
  const p = Deno.upgradeHttp(req);

  
  
  (async () => {
    const [conn, firstPacket] = await p;
    const decoder = new TextDecoder();
    const text = decoder.decode(firstPacket);
    console.log(text);
    
    conn.close();
  })();

  
  return new Response(null, { status: 101 });
});

FFI API supports read-only global statics

This release adds ability to use global statics in Foreign Function Interface API.

Given following definitions:

#[no_mangle]
pub static static_u32: u32 = 42;

#[repr(C)]
pub struct Structure {
  _data: u32,
}

#[no_mangle]
pub static static_ptr: Structure = Structure { _data: 42 };

You can now access them in your user code:

const dylib = Deno.dlopen("./path/to/lib.so", {
  "static_u32": {
    type: "u32",
  },
  "static_ptr": {
    type: "pointer",
  },
});

console.log("Static u32:", dylib.symbols.static_u32);

console.log(
  "Static ptr:",
  dylib.symbols.static_ptr instanceof Deno.UnsafePointer,
);

const view = new Deno.UnsafePointerView(dylib.symbols.static_ptr);
console.log("Static ptr value:", view.getUint32());

Thank you to Aapo Alasuutari for implementing this feature.

Tracing operations while using deno test

In v1.19 we introduced better errors for ops and resource sanitizers in Deno.test.

This is a very useful feature for debugging testing code that has leaks of ops or resources. Unfortunately after shipping this change we received reports that performance of deno test degraded noticeably. The performance regression was caused by excessive collection of stack traces and source mapping of code.

Without a clear way to not incur performance hit for users who do not need these detailed error messages with traces, we decided to disable tracing feature by default. Starting with v1.20, the sanitizers will collect detailed tracing data only with --trace-ops flag present.

In case your test leaks ops and you did not invoke deno test with --trace-ops you will be prompted to do so in the error message:


Deno.test("test 1", () => {
  setTimeout(() => {}, 10000);
  setTimeout(() => {}, 10001);
});
$ deno test ./test.ts
Check ./test.ts
running 1 test from ./test.ts
test test 1 ... FAILED (1ms)

failures:

test 1
Test case is leaking async ops.

- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.

To get more details where ops were leaked, run again with --trace-ops flag.

failures:

    test 1

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

error: Test failed

Running again with --trace-ops will show where the leaks occurred:

$ deno test --trace-ops file:///dev/test.ts
Check file:///dev/test.ts
running 1 test from ./test.ts
test test 1 ... FAILED (1ms)

failures:

test 1
Test case is leaking async ops.

- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
    at Object.opAsync (deno:core/01_core.js:161:42)
    at runAfterTimeout (deno:ext/web/02_timers.js:234:31)
    at initializeTimer (deno:ext/web/02_timers.js:200:5)
    at setTimeout (deno:ext/web/02_timers.js:337:12)
    at test (file:///dev/test.ts:4:3)
    at file:///dev/test.ts:8:27

    at Object.opAsync (deno:core/01_core.js:161:42)
    at runAfterTimeout (deno:ext/web/02_timers.js:234:31)
    at initializeTimer (deno:ext/web/02_timers.js:200:5)
    at setTimeout (deno:ext/web/02_timers.js:337:12)
    at test (file:///dev/test.ts:5:3)
    at file:///dev/test.ts:8:27


failures:

    test 1

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

error: Test failed

Support for AbortSignal.timeout(ms)

Aborting an AbortSignal after a certain amount of time has passed is a common pattern. For example:


const controller = new AbortController();
setTimeout(() => controller.abort(), 2_000);
const signal = controller.signal;

try {
  const result = await fetch("https://deno.land", { signal });
  
} catch (err) {
  if (signal.aborted) {
    
  } else {
    throw err;
  }
}

To simplify this pattern, WHATWG introduced a new AbortSignal.timeout(ms) static method. When called, this will create a new AbortSignal which will be aborted with a “TimeoutError” DOMException in the specified number of milliseconds.

try {
  const result = await fetch("https://deno.land", {
    
    signal: AbortSignal.timeout(2_000),
  });
  
} catch (err) {
  if (err instanceof DOMException && err.name === "TimeoutError") {
    
  } else {
    throw err;
  }
}

Thank you to Andreu Botella for implementing this feature.

Dedicated interface for TCP and Unix connections

This release adds two new interfaces: Deno.TcpConn and Deno.UnixConn, which are used as return types for Deno.connect() API.

This is a small quality of life improvement for type checking your code and allows for easier discovery of methods available for both connection types.

BREAKING: Stricter defaults in programmatic permissions for tests and workers

When spawning a web worker using the Worker interface or registering a test with Deno.test, you have the ability to specify a specific set of permissions to apply to that worker or test. This is done by passing a “permissions” object to the options bag of the calls. These permissions must be a subset of the current permissions (to prevent permission escalations). If no permissions are explicitly specified in the options bag, the default permissions will be used.

Previously, if you only specified new permissions for a certain capability (for example "net"), then all other capabilities would have their permissions inherited from the current permissions. Here is an example:



Deno.test("read only test", { permissions: { read: true } }, () => {
  
  
  
  
});

We avoid breaking changes in minor releases, but we feel strongly that we had gotten this existing behavior wrong.

Instead of defaulting permissions for omitted capabilities to "inherit", we now default to "none". This means if a certain permission is omitted, but some permissions are specified, it will be assumed that the user doesn’t want to grant this permission in the downstream scope. Again, while this is a breaking change, we feel the new behavior is less surprising as well as reduces situations where permissions are accidentally granted.

If you relied on this previous behaviour, update your permissions bag to explicitly specify "inherit" for all capabilities that do not have explicit values set.

This release additionally adds a Deno.PermissionOptions interface which unifies an API for specifying permissions for WorkerOptions, Deno.TestDefinition and Deno.BenchDefinition. Previously all three of these had separate implementations.

TypeScript 4.6

Deno 1.20 ships with the latest stable version of TypeScript. For more information on new features in TypeScript see TypeScript’s 4.6 blog post

V8 10.0

This release upgrades to the latest release of V8 (10.0, previously 9.9). The V8 team has not yet posted about the release. When they do, we will link it here. In lieu of a blog post explore the diff: https://github.com/v8/v8/compare/9.9-lkgr…10.0-lkgr

HN Comments