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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
P
Proofpoint News Feed
G
Google Developers Blog
Project Zero
Project Zero
小众软件
小众软件
NISL@THU
NISL@THU
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Vulnerabilities – Threatpost
B
Blog RSS Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
宝玉的分享
宝玉的分享
博客园 - 司徒正美
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
G
GRAHAM CLULEY
GbyAI
GbyAI
Recent Announcements
Recent Announcements
Cisco Talos Blog
Cisco Talos Blog
C
Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
T
Tailwind CSS Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
PCI Perspectives
PCI Perspectives
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
M
MIT News - Artificial intelligence
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threatpost
B
Blog
The Hacker News
The Hacker News
Attack and Defense Labs
Attack and Defense Labs
腾讯CDC
T
Tenable Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

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.39: The Return of WebGPU | Deno
2023-12-15 · via Deno

Deno 1.39 marks a significant update in the Deno ecosystem, featuring the much-anticipated return of WebGPU, enhancing capabilities for graphics, gaming, and machine learning. We’ve also introduced new deno coverage reporters for improved codebase analytics and made substantial strides in Node.js compatibility, easing the transition for Node.js developers. Finally, this release includes updates to the Standard Library, performance optimizations, and the latest TypeScript 5.3 support.

If you already have Deno installed, upgrade to version 1.39 in your terminal with:

If you don’t yet have Deno installed, you can install it with one of the following commands, or many other ways.

MacOS / Linux Install

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

Windows Install

irm https://deno.land/install.ps1 | iex

Here’s an overview of what’s new in Deno 1.39:

  • WebGPU is back
  • New deno coverage reporters
  • Updates to deno compile
  • Enhanced Language Server
  • Node.js compatibility improvements
    • Sloppy imports
    • Support running node_modules/.bin/ executables in deno task
    • CommonJS entrypoints in node_modules
    • Support for Object.prototype.__proto__
    • Node.js APIs updates
  • Changes to Deno APIs
    • Deno.serve() support for Unix sockets is now stable
    • Deno.HttpServer.shutdown() is now stable
    • Deno.HttpClient can now be declared with using keyword
    • KV watch
    • Deno.cron
    • Deprecated IO interfaces
  • Changes to Web APIs
    • AbortSignal.any()
    • ImageData
    • ReadableStream.read min option
    • Improved URLPattern performance
  • Standard Library updates
    • std/webgpu
    • std/expect
    • std/ini
    • std/data_structures
    • std/text
    • std/cli
    • std/net
  • TypeScript 5.3
  • Upcoming changes to the decorators

WebGPU is back

The WebGPU API gives developers a low level, high performance, cross architecture way to program GPU hardware from JavaScript. It is the effective successor to WebGL on the Web. The spec has been finalized and Chrome has already shipped the API. Support is underway in Firefox and Safari.

Deno first introduced WebGPU back in early 2021 but it was removed earlier this year due to performance problems. With this release, we are happy to re-introduce it with all the performance issues worked out.

GPUs have the ability to compute certain numerical operations with extreme parallelism as compared to CPUs. This is useful for a variety of applications, beyond just rendering and games. For example, machine learning algorithms can often be expressed as a series of matrix operations, which can be computed extremely efficiently on a GPU.

Our WebGPU implementation is based on the same underlying system as the upcoming WebGPU implementation in Firefox, so we’re confident that it’s a solid foundation for developers to build on.

A basic example of getting information about the GPU via WebGPU:


const adapter = await navigator.gpu.requestAdapter();
if (adapter) {
  
  const adapterInfo = await adapter.requestAdapterInfo();
  console.log(`Found adapter: ${adapterInfo.device}`); 
  const features = [...adapter.features.values()];
  console.log(`Supported features: ${features.join(", ")}`);
} else {
  console.error("No adapter found");
}

Further examples can be viewed over at our webgpu-examples repository.

Although the specification is stable, WebGPU is still considered unstable in Deno. To access it in Deno use the --unstable-webgpu flag. We’re planning to stabilize it soon, after we’ve had a chance to get more feedback from the community and more time to verify the implementation against the specification test suite.

For more webgpu functionalities, we’ve also added std/webgpu (more info below).

Thanks to the wgpu team for the help provided to achieve this.

New deno coverage reporters

In this release, deno coverage received two new reporters: summary and html. You can now also omit the directory value for the --coverage flag in deno test, as we now default to using ./coverage/ directory.

The summary reporter is the new default reporter. It outputs the coverage summary in a concise table giving you information about coverage in particular files and overall summary:

$ deno coverage
----------------------------------
File         | Branch % | Line % |
----------------------------------
 bar.ts      |      0.0 |   57.1 |
 baz/quux.ts |      0.0 |   28.6 |
 baz/qux.ts  |    100.0 |  100.0 |
 foo.ts      |     50.0 |   76.9 |
----------------------------------
 All files   |     40.0 |   61.0 |
----------------------------------

The previously default reporter that prints uncovered lines in all files to the terminal is still available using the --detailed flag.

You can also specify --html flag to get the detailed coverage report in HTML format.

$ deno test --coverage
$ deno coverage --html
HTML coverage report has been generated at file:///path/to/project/coverage/html/index.html

The examples of the coverage report look like the below:

HTML Coverage Report Index

HTML Coverage Report Source

The output of deno coverage --html is completely static and can be hosted on any static file server, such as GitHub Pages.

We still support the --lcov flag, which outputs the coverage report in the LCOV format, which is useful for integrating with other tools such as Codecov or Coveralls.

We have further plans to improve deno coverage and make it more useful. If you have feedback you’d like to share, please comment on this issue.

Updates to deno compile

Deno 1.39 introduces significant advancements in the deno compile feature:

Better node_modules support: With the --unstable-byonm flag, deno compile now supports “bring your own node_modules”, enhancing Node.js compatibility. This feature allows you to use npm packages directly in your Deno projects, bridging the gap between Deno and the extensive npm ecosystem. Learn more about this feature in our previous blog post.

Flexible Naming for Executables: Deno has removed restrictions on executable naming. You can now name your compiled programs with leading digits, such as 3d_modeler, offering more flexibility in naming conventions.

More Dynamic Import Support: More dynamic import patterns are now supported in deno compile. This is interesting because Deno needs to statically include all modules that may be imported at runtime in the binary produced by deno compile. Because of this, dynamic imports can be problematic. Now, Deno can handle more dynamic import patterns, such as:

await import(`./dir/${expr}`);

In this example, Deno will include all modules from ./dir/ and its subdirectories into the compiled binary. This allows you to import any of these files at runtime. This update simplifies dependency management by ensuring that all modules referenced dynamically are available at runtime.

Enhanced Language Server

In our ongoing commitment to improving the Deno Language Server (LSP), this release introduces significant performance enhancements.

Responsive Typing Experience: We’ve optimized the handling of rapid request bursts during fast typing, ensuring a smoother and more responsive editing experience in your IDE.

Shutdown Timeout: To tackle the issue of lingering ‘zombie’ LSP instances, we’ve implemented a shutdown-timeout mechanism. This feature forcefully terminates LSP processes when you close your editor after a set timeout, promoting efficient resource utilization.

Update Notifications: The language server now actively informs you of the latest Deno updates. This feature aims to simplify the process of keeping your Deno installation current, ensuring you always have access to the latest features and fixes.

Enhanced Diagnostics: We’ve introduced a new deno.logFile setting in VSCode. When used alongside deno.internalDebug, this feature allows for the capture of detailed diagnostic data, aiding in performance analysis and troubleshooting.

We are dedicated to continuously enhancing the Deno LSP. Should you encounter any performance issues with the LSP or within VSCode Deno, your feedback is invaluable. Please let us know about your experience here.

Node.js compatibility improvements

Sloppy imports

Migrating existing TypeScript codebases to Deno can be a daunting task. One of the biggest hurdles is the fact that Deno requires you to explicitly specify file extensions in the import statements.

Imagine a TypeScript project that had a file foo.ts that imported bar.ts:


import { Example } from "./bar";
console.log(Example);


export const Example = "Example";

In previous versions of Deno, this would error out with an unhelpful message:


$ deno run foo.ts
error: Module not found "file:///dev/bar"
  at file:///dev/foo.ts:1:25

Now in Deno 1.39 this error message is improved and an escape hatch made available:


$ deno run foo.ts
error: Module not found "file:///dev/bar". Maybe add a '.ts' extension or run with --unstable-sloppy-imports
    at file:///dev/foo.ts:1:25

Running with the --unstable-sloppy-imports flag will execute the code without any changes:


$ deno run --unstable-sloppy-imports foo.ts
Warning Sloppy imports are not recommended and have a negative impact on performance.
Warning Sloppy module resolution (hint: add .ts extension)
    at file:///dev/foo.ts:1:25
Example

In addition to resolving imports without file extension, this feature also allows to resolve “directory” imports, as well as importing .ts files using .js extension:


export default {
  "/": () => "Hello World",
  "/example": () => "Example",
};


export const bar = "bar";


import routes from "./routes";
import { bar } from "./bar.js";

console.log(routes);
console.log(bar);
$ deno run --unstable-sloppy-imports foo.ts
Warning Sloppy imports are not recommended and have a negative impact on performance.
Warning Sloppy module resolution (hint: specify path to index.ts file in directory instead)
    at file:///Users/ib/dev/deno/foo.ts:1:20
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///Users/ib/dev/deno/foo.ts:2:21
{ "/": [Function: /], "/example": [Function: /example] }
bar

As seen above, using this flag will print warnings that guide you towards migrating the code to the recommended import syntax. You will also get diagnostics in your editor, along with “quick fixes” that will make it easier to apply necessary changes.

We hope this feature will make it much easier to try out and migrate existing projects to Deno.

Support running node_modules/.bin/ executables in deno task

deno task can run tasks defined in deno.json, as well as scripts defined in package.json. This release adds support for running executables in node_modules/.bin/ directory in deno task.

If you have package.json that looks like this:

{
  "scripts": {
    "dev": "vite dev"
  }
}

You can run vite dev with deno task:

$ deno task dev

Deno will look for vite executable in node_modules/.bin/ directory and run it using Deno - even if the node_modules/.bin/vite uses shebang defining Node.js as an interpreter.

CommonJS entrypoints in node_modules

Deno will now correctly handle CommonJS entrypoints in node_modules, respecting the type setting from package.json for the relevant package. This should greatly improve compatibility with packages that still haven’t migrated to ESM.

Support for Object.prototype.__proto__

Deno made a conscious decision to not support Object.prototype.__proto__ for security reasons. However there are still many packages on npm that rely on this property to work correctly.

In this release we introduced a new --unstable-unsafe-proto flag that allows you to enable this property. It is not recommended to use this flag, but if you really need to use a package that relies on it, the escape hatch is now available to you.

Node.js APIs updates

Following Node.js APIs are now available:

  • crypto.createPrivateKey
  • http.ClientRequest.setTimeout
  • http.globalAgent
  • perf_hooks.performance
  • process.geteuid
  • process.report
  • util.parseArgs
  • vm.runInNewContext

Additionally we fixed several bugs in already supported Node.js APIs:

  • child_process.spawnSync handling of status was incorrect
  • child_process.spawnSync properly normalizes stdio
  • child_process can handle IPC pipes on Unix systems (Windows support coming soon)
  • crypto.sign now works with PEM private keys
  • fs.existsSync is now faster when file does not exist
  • process.exitCode should change exit code of process
  • allow null value for http.OutgoingMessage.setHeader
  • fix Buffer.copy when sourceStart > source.length
  • fix os.freemem
  • fix stream.Writable
  • handle closing process.stdin more than once

Changes to Deno APIs

This release includes several changes to the Deno APIs:

Deno.serve() support for Unix sockets is now stable

Deno.serve(
  { transport: "unix", address: "/tmp/my.sock" },
  (req) => new Response("Hello!"),
);

Deno.HttpServer.shutdown() is now stable

const server = Deno.serve((req) => new Response("Hello!"));


Deno.addSignalListener("SIGINT", () => {
  server.shutdown();
});

await server.finished;

Deno.HttpClient can now be declared with using keyword

Following up on Explicit Resource Management introduced to Deno APIs in the previous release, this release brings support for using keyword to Deno.HttpClient:

{
  using client = Deno.createHttpClient({});
  const response = await fetch("http://localhost:4545/assets/fixture.json", {
    client,
  });
  const json = await response.json();
}

KV watch

The new, unstable Deno.Kv.watch() API to watch for changes to the given keys in the given database. This API returns a ReadableStream that emits a new value whenever any of the watched keys change their versionstamp. The emitted value is an array Deno.KvEntryMaybeobjects, with the same length and order as thekeys array. Read more about the KV watch feature here.

const db = await Deno.openKv();

const stream = db.watch([["foo"], ["bar"]]);
for await (const entries of stream) {
  entries[0].key; 
  entries[0].value; 
  entries[0].versionstamp; 
  entries[1].key; 
  entries[1].value; 
  entries[1].versionstamp; 
}

Cron

The Deno.cron function, introduced recently, has seen an exciting update in this release. It now supports an intuitive JSON format for defining schedules, making it easier to understand and implement cron jobs. For more in-depth information, explore our detailed blog post about the cron feature.

Traditional Unix Cron Format

Previously, setting up a task to run every 20 minutes required the Unix cron format:

Deno.cron("myCron", "*/20 * * * *", () => {
  console.log("Running every 20 minutes");
});

New JSON Format

Now, you can achieve the same with a more readable JSON format:

Deno.cron("myCron", {
  minutes: { every: 20 },
}, () => {
  console.log("Running every 20 minutes");
});

Deprecated IO interfaces

We’ve been pushing Deno APIs to use Web Streams API for multiple months now and to finalize this change the v1.39 release brings a deprecation to the various IO interfaces in Deno.

The following interfaces are now deprecated and are slated to be removed in Deno 2:

  • Deno.Reader
  • Deno.ReaderSync
  • Deno.Writer
  • Deno.WriterSync
  • Deno.Closer

You will now get a warning in your editor when using these interfaces, with suggestions to use Web Streams APIs instead.

Changes to Web APIs

AbortSignal.any()

This API allows for listening to multiple AbortSignals, and will abort if any of the specified signals is aborted.

This can be useful if you have an API that provides an AbortSignal (for example, Request), and you want to additionally depend on another AbortSignal.

ImageData

The ImageData Web API is a class that can be used to represent an image in a standardized format.

A quick example of creating a 1x2 pixels red image:

const rawImage = new Uint8ClampedArray([255, 0, 0, 1, 255, 0, 0, 1]);
new ImageData(rawImage, 1, 2);

Thanks to @jamsinclair who contributed this feature.

ReadableStream.read min option

The min option for ReadableStreamBYOBReader.read allows for specifying the minimum amount of bytes to read. This is useful for various encoding formats that require reading an n amount of bytes, which can be achieved by setting the min option to the same length as the byte length of the buffer.

For example:

const response = await fetch("https://example.com");
const reader = response.body!.getReader({ mode: "byob" });
const buffer = new Uint8Array(10);

const { value } = await reader.read(buffer, { min: 5 });

Improved URLPattern performance

The URLPattern API has received performance improvements that make it 6 to 8 times faster when matching against multiple patterns, this is an optimization directed towards a popular scenario of using URLPattern in an HTTP router.

Standard Library updates

std/webgpu

Alongside releasing WebGPU in the CLI, we also added std/webgpu in this release.

This module adds some additional functionalities, including createTextureWithData for creating a GPUTexture with existing data, describeTextureFormat to get information about a texture format, and createCapture to take a “capture” using a texture, among others.

Some of these functionalities have been ported/based on wgpu features, and further functionalities are planned.

std/expect

In this release std/expect has been added. The module exports two functions: expect and fn. These are designed to be compatible with Jest.

import { expect } from "https://deno.land/std@0.209.0/expect/mod.ts";

expect(Math.max(5, 8)).not.toEqual(5);
expect(Math.max(5, 8)).toEqual(8);

expect(Math.pow(3, 5)).toBeGreaterThan(100);
expect(Math.pow(3, 5)).toBeLessThan(300);

Currently expect supports the following matcher and modifier APIs: not, resolves, rejects, toBe, toEqual, toStrictEqual, toMatch, toMatchObject, toBeDefined, toBeUndefined, toBeNull, toBeNaN, toBeTruthy, toBeFalsy, toContain, toContainEqual, toHaveLength, toBeGreaterThan, toBeGreaterThanOrEqual, toBeLessThan, toBeLessThanOrEqual, toBeCloseTo, toBeInstanceOf, toThrow, toHaveProperty, toHaveLength.

The module also provides mock related util and assertions:

import { expect, fn } from "https://deno.land/std@0.209.0/expect/mod.ts";

const mockFn = fn();

mockFn();
mockFn();
mockFn();

expect(mockFn).toHaveBeenCalled();
expect(mockFn).not.toHaveBeenCalledTimes(1);
expect(mockFn).toHaveBeenCalledTimes(3);

The following mock related matchers are implemented: toHaveBeenCalled, toHaveBeenCalledTimes, toHaveBeenCalledWith, toHaveBeenLastCalledWith, toHaveBeenNthCalledWith, toHaveReturned, toHaveReturnedTimes, toHaveReturnedWith, toHaveLastReturnedWith, toHaveNthReturnedWith.

The module is not completely compatible with expect API of Jest. The following APIs are not implemented yet: toMatchSnapShot, toMatchInlineSnapShot, toThrowErrorMatchingSnapShot, toThrowErrorMatchingInlineSnapShot, expect.anything, expect.any, expect.arrayContaining, expect.not.arrayContaining, expect.closedTo, expect.objectContaining, expect.not.objectContaining, expect.stringContaining, expect.not.stringContaining, expect.stringMatching, expect.not.stringMatching, expect.assertions, expect.hasAssertions, expect.addEqualityTester, expect.addSnapshotSerializer, expect.extend.

Standard Library also has std/testing/bdd module. Now you can write your test cases in BDD style using Standard Library.

import { describe, it } from "https://deno.land/std@0.209.0/testing/bdd.ts";
import { expect } from "https://deno.land/std@0.209.0/expect/mod.ts";

describe("Math", () => {
  describe("max", () => {
    it("returns max value from the given args", () => {
      expect(Math.max(1, 2, 3)).toEqual(3);
      expect(Math.max(-3, -2, -1)).toEqual(-1);
    });
  });
});

Save this file as my_test.ts and you can execute it with the command:

$ deno test my_test.ts
Check file:///path/to/my_test.ts
running 1 test from ./my_test.ts
Math ...
  max ...
    returns max value from the given args ... ok (1ms)
  max ... ok (1ms)
Math ... ok (1ms)

ok | 1 passed (2 steps) | 0 failed (1ms)

Thanks Thomas Cruveilher for contributing to this feature.

std/ini

In this release std/ini has been added. The module provides the parser and serializer for working with INI files.

Thanks Aaron Huggins for contributing to this feature.

std/data_structures

std/data_structures has been added in this release. This module exports classes that implements data structure algorithms. Currently RedBlackTree, BinarySearchTree, and BinaryHeap classes are available.

std/text

std/text has been added in this release. This module exports utility functions for comparing/sorting/choosing texts with certain criteria:

import {
  closestString,
  levenshteinDistance,
} from "https://deno.land/std@0.209.0/text/mod.ts";


console.log(levenshteinDistance("hello", "halo")); 
console.log(levenshteinDistance("hello", "world")); 

console.log(closestString("puhs", ["commit", "pull", "push"])); 

Thanks Jeff Hykin for contributing these features.

std/cli

std/cli has been added in this release. This module currently exports 2 APIs: parseArgs and promptSecret.

import {
  parseArgs,
  promptSecret,
} from "https://deno.land/std@0.209.0/cli/mod.ts";

const parsedArgs = parseArgs(["--foo", "--bar=baz", "./quux.txt"]);
console.log(parsedArgs);



const credential = promptSecret("Enter the credential ");

Note: parseArgs is the same as parse in std/flags, but we realized the scope of std/flags is too limited, and decided to explore more CLI-related features under std/cli.

Thanks Alisue for proposing and implementing promptSecret.

std/net

std/net has been added in this release. This module exports 1 API: getAvailablePort, which is useful for choosing available TCP port.

import { getAvailablePort } from "https://deno.land/std@0.209.0/net/mod.ts";

const port = await getAvailablePort();

Thanks Harry Solovay for contributing to this feature.

TypeScript 5.3

Deno v1.39 ships with latest release of TypeScript 5.3, read more in Announcing TypeScript 5.3 blog post.

Upcoming changes to the decorators

Currently, Deno enables experimental TypeScript decorators by default. Due to the TC39 Decorator proposal being at Stage 3 and a popular request we’ve decided to change the default setting for decorators in the upcoming Deno v1.40 release.

In the next release the experimental TypeScript decorators will be disabled by default and the TC39 Decorators will be enabled by default.

If you are using experimental TS decorators, prepare yourself for this change by adding this configuration to your deno.json:

{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}

Thank you to our contributors!

We couldn’t build Deno without the help of our community! Whether by answering questions in our community Discord server or reporting bugs, we are incredibly grateful for your support. In particular, we’d like to thank the following people for their contributions to Deno 1.39: Aravind, Birk Skyum, Bolat Azamat, Chen Su, Daniel Mizerski, Florian Schwalm, Gasman, Ian Bull, Jacob Hummer, Jakub Jirutka, Jamie, Jesse Jackson, John Spurlock, Jordan Harband, Julien Cayzac, Jérôme Benoit, Kenta Moriuchi, Laurence Rowe, Max Goodhart, Raashid Anwar, Tareque Md Hanif, btoo, citrusmunch, lionel-rowe, liruifengv, pk, scarf, ud2, and 林炳权.

Would you like to join the ranks of Deno contributors? Check out our contribution docs here, and we’ll see you on the list next time.

Believe it or not, the changes listed above still don’t tell you everything that got better in 1.39. You can view the full list of pull requests merged in Deno 1.39 on GitHub here.

Thank you for catching up with our 1.39 release, and we hope you love building with Deno!

🍋 Fresh 1.6 is out.

Fresh v1.6 apps have expanded plugin APIs, faster route matching, and official Tailwind CSS support.