1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

deno v0.28.0の変更点

Posted at

概要

denoのv0.28.0がリリースされたため、変更点をまとめます。

Deno.dir()関数に"executable"を渡せるようになった(Linux環境のみ)

Deno.dir('executable');

下記いずれかが返却されます。

  • XDG_BIN_HOME
  • $XDG_DATA_HOME/../bin
  • $HOME/.local/bin

標準ライブラリの各モジュールにmod.tsファイルが追加された

各標準モジュールにmod.tsファイルが追加されている。

それに合わせて、一部関数名等のリネームも行われている。

  • std/archive/mod.ts
  • std/encoding/mod.ts
  • std/fmt/mod.ts
  • std/http/mod.ts
  • std/io/mod.ts
  • std/mime/mod.ts
  • std/multipart/mod.ts

参考

その他の修正点等

Promiseがrejectされcatchされなかった場合、REPLが停止する問題が修正された

parseAll関数(std/encoding/yaml)でマルチドキュメントyamlのパースに失敗する問題が修正された

v0.27.0
import { parseAll } from "https://deno.land/std@v0.27.0/encoding/yaml/parse.ts";

const data = parseAll(`
name: hoge
age: 20
---
name: fuga
age: 30
`);
// error: Uncaught YAMLError: can not read an implicit mapping pair; a colon is missed at line 4, column 1:

v0.28.0
import { parseAll } from "https://deno.land/std@v0.28.0/encoding/yaml/parse.ts";

const data = parseAll(`
name: hoge
age: 20
---
name: fuga
age: 30
`);

console.info(data); // [ { name: "hoge", age: 20 }, { name: "fuga", age: 30 } ]

read*関数にサイズが0のUint8Arrayが渡された場合、0を返すように修正された。

0.27.0で下記コードを実行すると、エラーが発生します。
0.28.0にて、この問題が修正されました。

const file = await Deno.open('/path/to/file.txt');
try {
  const bytesRead = await file.read(new Uint8Array(0));
  console.info(bytesRead);
} finally {
  file.close();
}

Deno.shutdown関数及びDeno.ShutdownModeenumが追加された

uuidモジュールのワイルドカードexportが廃止された

Deno.dirに不正な文字列が与えられた際に、例外を投げるのではなくnullが返却されるようになった。

v0.27.0で下記コードを実行するとエラーが発生しますが、v0.28.0ではnullが返却されるように修正されました。

Deno.dir('hoge'); // null

console.clearが同期的に実行されるようになった。

例えば、下記のコードをv0.27.0で実行すると、helloworldの両方がクリアされてしまい、画面には何も表示されません。

v0.28.0では、helloの出力の後にクリアが行われるようになったため、worldの出力は画面に残ります。

console.info('hello');
console.clear();
console.info('world');
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?