Skip to content

Commit

Permalink
docs: add articles/2024/05/26 (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
uki00a committed May 26, 2024
1 parent 4b0112e commit 4a4d2b5
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions content/articles/2024/05/26.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: 2024/05/20〜2024/05/26の最新情報
tags:
- Deno
- deno_std
- fresh
- deno_core
categories:
- news
date: 2024-05-26
description: Fresh v2のアルファバージョンが公開, Deno v1.43.6 (JestやVitest向けの互換性の改善, URLの静的メソッドに関する型の改善など), `deno_std`のリリース (@std/collections@1.0.0-rc.1, @std/streamsにconcatReadableStreamsが追加), deno installでのnpmやpnpmなどのロックファイルのサポートについて, deno_coreにARCHITECTURE.mdが追加
---

## Fresh v2のアルファバージョンが公開

Fresh v2向けに開発されていたコードが`main`ブランチに取り込まれています。

> [major: import Fresh 2.0 code (denoland/fresh#2449)](https://github.com/denoland/fresh/pull/2449)
合わせて、[Fresh v2のアルファバージョン](https://jsr.io/@fresh/core@2.0.0-alpha.11)として公開されています。

現状、大きな変更として以下のような内容がありそうです。

- Freshの[JSR](https://jsr.io/@fresh)への公開
- `preact``esbuild`などのパッケージが`npm:`経由で読み込まれるように変更されています (例: [`www/deno.json`](https://github.com/denoland/fresh/blob/8865d290ceeb7bc157df8dfd1f0952ef63fe666e/www/deno.json))
- ExpressライクなAPIの採用 (例: [`www/main.ts`](https://github.com/denoland/fresh/blob/8865d290ceeb7bc157df8dfd1f0952ef63fe666e/www/main.ts))
- ハンドラーやページコンポーネントなどの定義方法の改善 (例: [`www/routes/showcase.tsx`](https://github.com/denoland/fresh/blob/8865d290ceeb7bc157df8dfd1f0952ef63fe666e/www/routes/showcase.tsx#L12-L21))

現状、わかっている変更点などを少しずつ以下のページにまとめているため、もし興味がありましたら参照ください。

- https://scrapbox.io/uki00a/Fresh_v2

## Deno v1.43.6

[Deno v1.43.6](https://github.com/denoland/deno/releases/tag/v1.43.6)がリリースされています。

### Node.js互換性の改善

JestやVitest, avaなどのテストフレームワーク向けの対応を中心に進められています。

- `node:worker_threads`: `Worker`を介して転送されるメッセージの中に`MessagePort`があった場合に、`addListener`などのメソッドが未定義になってしまう問題が修正されています (`vitest`など向けの対応)
- `node:module`: [ava](https://github.com/avajs/ava)を動かせるようにするため、`findSourceMap`の空実装が追加されています。
- `node:process`: `process.listeners()``'SIG*'`を渡した際に、きちんとリスナー数が返却されるように改善されています。

### `deno task`

`deno.json``nodeModulesDir: true`設定されていて かつ `node_modules`ディレクトリがない場合に、`deno task`の実行に失敗してしまう問題が修正されています。

### `deno serve`

[`deno serve`]({{< ref "articles/deno/v1.43.md" >}})コマンドで指定されたエントリポイントで`fetch`が引数を受け取らない形式で定義されている場合に、`TypeError`が発生する問題が修正されています。

### `URL.{canParse,parse}`の型定義の改善

- `URL.canParse`の第2引数に`URL`オブジェクトを渡せるように型定義が改善されています。
- [`URL.parse`]({{< ref "articles/deno/v1.43.md" >}})の型定義が追加されています。

## `deno_std`のリリース

[`deno_std`](https://github.com/denoland/deno_std/releases/tag/release-2024.05.22)のリリースが行われています。主要な変更点についてのみ紹介します。

### `@std/collections@1.0.0-rc.1`

[@std/collections v1のRCバージョン](https://jsr.io/@std/collections@1.0.0-rc.1)が公開されています。近いうちにv1がリリースされる可能性がありそうです。

### `@std/streams@0.224.1`

新規APIとして`concatReadableStreams`が追加されています。

```typescript
import { concatReadableStreams } from "jsr:@std/streams@0.224.1/concat-readable-streams";

const result = await Array.fromAsync(concatReadableStreams(
ReadableStream.from([1]),
ReadableStream.from([2, 3]),
ReadableStream.from([4, 5, 6]),
));
console.info(result); // => [ 1, 2, 3, 4, 5, 6 ]
```

## `deno install`と各種パッケージマネージャーとの相互運用性の改善

`deno install`コマンドでnpm/pnpm/Yarn/Bunなどが生成するロックファイルをサポートすることで、より相互運用性を高めることが検討されているようです。

> [FUTURE: deno install should interop with other package managers #23909](https://github.com/denoland/deno/issues/23909)
この機能が入ると、[BYONM]({{< ref "articles/deno/v1.38.md" >}})などと合わせることで、少しずつDenoへの移行などはやりやすくなる可能性もありそうです。

## `deno_core``ARCHITECTURE.md`が追加

[deno_core](https://github.com/denoland/deno_core)の仕組みなどについて解説した`ARCHITECTURE.md`というファイルが追加されています。

> [chore: ARCHITECTURE.md (denoland/deno_core#737)](https://github.com/denoland/deno_core/pull/737)

0 comments on commit 4a4d2b5

Please sign in to comment.