Deno v0.3.0 Release Review

19.02.20194 Min Read — In Deno
Deno icon

Add Deno global namespace object

deno 모듈을 사용하는 대신 Deno 전역 변수가 추가 되었다. deno 모듈을 import 해서 사용하는 방식은 가까운 시일에 제거 되므로 코드를 업데이트 해야 한다.

before

import * as deno from "deno";
const files = await deno.readDir("/");

after

const files = await Deno.readDir("/");

Add window.location

window.location 이 추가 되어서 파일을 실행한 위치를 알수 있다.

Add back typescript version number and add Deno.version object

이전에 compiler snapshot 분리하면서 주석 처리 되었었는데 이번 PR에서 빌드시에 typescript.version 을 넣도록 변경 되었다.

https://github.com/denoland/deno/pull/1566/files#diff-44651f0848c5f82224b908fb7ebd0bc5R31

before

$ deno --version
deno: 0.2.10
v8: 7.2.502.16

after

$ deno --version
deno: 0.3.0
v8: 7.4.158
typescript: 3.2.1

Add seek and implement Seeker on File

Deno.File 에 Seeker interface가 없어서 추가 하려고 했는데 tokio 쪽 문제로 인해서 작업 마무리 못했던걸 다른 사람이 우회 하는 방법으로 수정이 되었다.

Add Deno.execPath

Deno의 실행 파일의 경로를 얻기 위한 execPath 가 추가 되었다.

How to use?

REPL 에서 다음과 같이 확인이 가능하다.

Deno.execPath
/Users/sean/GitHub/deno/./target/debug/deno

Fix behavior for extensionless files with .mime file

Add env option in Deno.run

Deno.run API를 사용할 때 env를 옵션을 추가 해서 실행 가능하게 되었다.

How to use?

(async function () {
  const p = Deno.run({
    args: [
      "python",
      "-c",
      "import os, sys; sys.stdout.write(os.environ.get('FOO', '') + os.environ.get('BAR', ''))"
    ],
    env: {
      FOO: "0123",
      BAR: "4567"
    },
    stdout: "piped"
  })
  
  const output = await p.output();
  const s = new TextDecoder().decode(output);
  console.log(s)
  p.close()
})()

Turn on v8postmortemsupport

Upgrade V8 to 7.4.158

Use proper directory for cache files

OS 별로 cache 디렉토리가 다르게 지정 되도록 수정이 있었다.

REPL multiline support with recoverable errors

Respect NO_COLOR in TypeScript output

이전에 추가 되었던 NO_COLOR 가 TypeScript를 사용하는 경우 적용이 되지 않아서 수정이 있었다.

Support scoped variables, unblock REPL async op, and REPL error colors

REPL에 기능에 대한 여러가지 수정이 있었다.