BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Deno 1.8 Ships with WebGPU Support, Dynamic Permissions, and More

Deno 1.8 Ships with WebGPU Support, Dynamic Permissions, and More

This item in japanese

Bookmarks

Deno 1.8 recently shipped with plenty of new features, including WebGPU support, internationalization APIs, stabilized import maps, support for fetching private modules, and more. The Deno permissions API is now stable. Deno 1.8 additionally ships with TypeScript 4.2.

The release note explained the motivation behind the support for the WebGPU APIs as follows:

These days, most neural networks are defined in Python with the computation offloaded to GPUs. We believe JavaScript, instead of Python, could act as an ideal language for expressing mathematical ideas if the proper infrastructure existed. Providing WebGPU support out-of-the-box in Deno is a step in this direction. Our goal is to run Tensorflow.js on Deno, with GPU acceleration. We expect this to be achieved in the coming weeks or months.

WebGPU is an API originally proposed by Apple that exposes the GPU computation functionality available on many devices. WebGPU may provide better performance than WebGL in tasks that benefit from parallel processing — as often occurs in scientific computing, machine learning, graphics and games development. As the feature may not be available or allowed on specific devices, developers will need to do feature detection as follows:

// Run with `deno run --unstable  
// https://deno.land/posts/v1.8/webgpu_discover.ts`

// Try to get an adapter from the user agent.
const adapter = await navigator.gpu.requestAdapter();
if (adapter) {
  // Print out some basic details about the adapter.
  console.log(`Found adapter: ${adapter.name}`);
  const features = [...adapter.features.values()];
  console.log(`Supported features: ${features.join(", ")}`);
} else {
  console.error("No adapter found");
}

Deno 1.8 supports the International Components for Unicode (ICU) that is used to implement many low-level internationalization (i18n) operations. All browser internationalization APIs that depend on ICU should now be available in Deno. The JavaScript internationalization API provides several key pieces of language-sensitive functionality that are required in most applications: string comparison (collation), number formatting, date and time formatting, display names, list formatting, pluralization rules, and case conversion.

Import maps, recently added in Chrome 89, are now a stable Deno feature. The import-map option accepts both local paths and URLs. Deno users no longer need to use the --unstable flag when providing import maps:

deno run --import-map=https://example.com/import_map.json ./mod.ts

Import maps specify what URLs get fetched by JavaScript import statements and import() expressions (e.g., import moment from "moment"). Import maps thus allow remapping imports without modifying the source code.

Deno users may also now fetch remote modules from private servers using authentication tokens. Deno users can specify per-domain authentication tokens to fetch private modules with the DENO_AUTH_TOKENS environment variable (e.g, DENO_AUTH_TOKENS=a1b2c3d4e5f6@deno.land).

Deno permissions, links, and symlinks are now stable. The Deno.permissions API lets developers query, request, and revoke permissions at runtime. Previously Deno developers had to give all necessary permissions at launch time — a behavior that has been described as suboptimal by some developers.

Deno users can upgrade by running deno upgrade in a terminal. Deno 1.8 is a large release and developers are encouraged to review the full list and description of new features and stabilized APIs.

Deno is open-source software available under the MIT license. Contributions are encouraged via the Deno Project and should follow the Deno contribution guideline.

Rate this Article

Adoption
Style

BT