Deno v1.28.3
Deno v1.28.3がリリースされました。
大きな変更点として、Deno v1.28.0で実装されたDeno.Commandに関するAPIの変更が実施されています。(Deno.CommandAPIの見直しについて)
また、Node.js互換性の改善についても引き続き実施されています。
node:moduleのcreateRequireで絶対パスがサポートdeno runコマンドでnpm:と--inspect-brkの併用がサポートpackages.jsonのexports.typesサポートに関する改善
その他の変更点
- プロセス停止前に未解決の
Promiseが存在する際のエラーメッセージが改善 (問題が発生している箇所がエラーメッセージに表示されるように) ReadableStreamのリーダー周辺の型定義の改善- Denoのトランスパイル結果のキャッシュと
deno test --coverageで生成されたカバレッジの整合性が取れなかった場合に、プロセスがパニックする問題が修正 deno replの履歴管理に関する信頼性の向上
https://github.com/denoland/deno/releases/tag/v1.28.3
deno_std v0.167.0
deno_std v0.167.0がリリースされています。
std/async/retryモジュールの追加
std/asyncにExponential backoffアルゴリズムに基づいたリトライ機能を提供するモジュールが追加されました。
import { retry } from "https://deno.land/std@0.167.0/async/retry.ts";
const result = await retry(async () => {
const result = await doSomeAsyncOperation();
return result;
}, {
multiplier: 2,
maxTimeout: 16_000,
maxAttempts: 10,
minTimeout: 500,
});
std/testing/typesモジュールの追加
std/testingにTypeScriptの型をテストするためのモジュールが追加されています。
import type { Has, IsExact, IsNullable } from "https://deno.land/std@0.167.0/testing/types.ts";
import { assertType } from "https://deno.land/std@0.167.0/testing/types.ts";
assertType<IsNullable<undefined>>(true);
assertType<IsNullable<null | number>>(true);
assertType<IsNullable<"foo">>(false);
assertType<IsExact<{ name: string }, { name: string }>>(true);
assertType<IsExact<{ id: number }, { name: string }>>(false);
assertType<Has<number | string, number>>(true);
assertType<Has<string | number, object>>(false);
std/dotenv - 型推論のサポート
restrictEnvAccessToオプションが指定された場合、その値を元に戻り値の型が推論されるようになりました。
import { config } from "https://deno.land/std@0.167.0/dotenv/mod.ts";
import type { IsExact } from "https://deno.land/std@0.167.0/testing/types.ts";
import { assertType } from "https://deno.land/std@0.167.0/testing/types.ts";
const conf = await config({
restrictEnvAccessTo: ["REDIS_URL", "MONGO_URL"],
});
assertType<
IsExact<typeof conf, { REDIS_URL: string, MONGO_URL: string }>
>(true);
std/node - Node.js互換性の改善
node:os:os.versionが実装 (Next.jsのnext infoコマンドを動かすための対応)- undiciのサポートに向けた対応
node:util:types.isProxyが実装node:tls:TLSSocketクラスでsecureConnectイベントがサポート
https://github.com/denoland/deno_std/releases/tag/0.167.0
Deno名前空間からのspawn/spawnSync/spawnChildの削除
Deno v1.21.0で実装されたDeno.spawnなどのAPIを削除するPRが作成されています。
unstable: remove Deno.spawn, Deno.spawnSync, Deno.spawnChild APIs #16893
この変更は次のDeno v1.29でのリリースが検討されているようです。
また、従来のDeno.runやDeno v1.28.0で実装されたDeno.Commandについては引き続き使用することができます。
https://github.com/denoland/deno/pull/16893
DenoのMastodonアカウント
Deno公式のMastodonアカウントが公開されています。
https://buttondown.email/denonews/archive/54-npm-compatibility-is-stabilized-in-128/
socket.io-deno
Socket.IO公式でDenoによるプロトコルの実装が公開されています。