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.36.0の変更点まとめ

Last updated at Posted at 2020-03-29

概要

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

破壊的変更

Deno.errors.Otherが削除された

使用されていなかったため、削除されました。

Deno.readDirDeno.readdirにリネームされた

Node.js等に合わせてreadDirreaddirにリネームされました

新機能

std/encoding/binaryモジュールが追加された

Goのencoding/binaryパッケージと同様の機能が提供されています。

(std/node/fs)appendFileappendFileSyncが実装された

import * as fs from "https://deno.land/std@v0.36.0/node/fs.ts"

fs.appendFile("./hello.txt", "world", (err: Error) => {
  if (err) {
    console.error(err);
  }
});

(std/node/os) tmpdirが実装された

import * as os from "https://deno.land/std@v0.36.0/node/os.ts";

console.log(os.tmpdir()); // /tmp

Deno.umaskが実装された

引数として数値を渡すと、プロセスのumask値を指定した値に変更できます。

引数を渡さずに呼ぶとプロセスのumask値を取得できます。

console.log(Deno.umask().toString(8)); // 22

--quietフラグが実装された

$ deno run --quiet ./mod.tsのように実行すると、下記のメッセージ等が表示されなくなります。

Compile file:///home/uki00a/work/deno/sample/mod.ts

seekがファイルの現在位置を返却するようになった

const file = await Deno.open("./hello.txt");
try {
  const position = await Deno.seek(file.rid, 2, Deno.SeekMode.SEEK_START);
  console.log(position); // 2
} finally {
  file.close();
}

その他

window.addEventListenerにasync関数を渡せるようになった

window.addEventListener('load', async () => { // v0.35.0の時点ではコンパイルエラーが発生していた
  ...
});

(std/testing) assertThrowsのエラーメッセージが改善された

Windowsでdeno installを実行すると、ファイル名に余分な.が含まれてしまう問題が修正された

@yuta0801さんにより修正されました

dprintが0.8.0にアップデートされた

TypeScriptが3.8.3にアップデートされた

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?