|
| 1 | +--- |
| 2 | +title: "2022-03-01のJS: Redux Toolkit 1.8.0、Node.js 17.6.0、CSS Cascade Layers" |
| 3 | +author: "azu" |
| 4 | +layout: post |
| 5 | +date : 2022-02-28T12:49:04.690Z |
| 6 | +category: JSer |
| 7 | +tags: |
| 8 | +- node.js |
| 9 | +- TypeScript |
| 10 | +- Tools |
| 11 | +- pnpm |
| 12 | +- Chrome |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +JSer.info #581 - Redux Toolkit 1.8.0がリリースされました。 |
| 17 | + |
| 18 | +- [Release v1.8.0 · reduxjs/redux-toolkit](https://github.com/reduxjs/redux-toolkit/releases/tag/v1.8.0) |
| 19 | + |
| 20 | +1.8.0では、新しい非同期Middlewareとして`createListenerMiddleware`が追加されています。 |
| 21 | + |
| 22 | +- [createListenerMiddleware | Redux Toolkit](https://redux-toolkit.js.org/api/createListenerMiddleware) |
| 23 | + |
| 24 | +`createListenerMiddleware`は[redux-saga](https://github.com/redux-saga/redux-saga)や[redux-observable](https://redux-observable.js.org/)など同じく非同期処理を扱うためのMiddlewareです。 |
| 25 | +シンプルな`dispatch`や`getState`などのAPIや、redux-sagaをインスパイアした`take`や[Temporal](https://docs.temporal.io/docs/typescript/workflows#condition)をインスパイアした`condition`など複雑なタスクを扱うAPIも持っています。 |
| 26 | + |
| 27 | +次の動画で、この新しい`createListenerMiddleware`がどのように作られたのかを紹介しています。 |
| 28 | + |
| 29 | +- [Redux Insights: the Redux Toolkit "action listener" middleware - YouTube](https://www.youtube.com/watch?v=D5WOry6gw9c) |
| 30 | +- [New experimental "action listener middleware" package available · Discussion #1648 · reduxjs/redux-toolkit](https://github.com/reduxjs/redux-toolkit/discussions/1648) |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +Node.js 17.6.0がリリースされました。 |
| 35 | + |
| 36 | +- [Node v17.6.0 (Current) | Node.js](https://nodejs.org/en/blog/release/v17.6.0/) |
| 37 | + |
| 38 | +[Node v17.5.0](https://nodejs.org/en/blog/release/v17.5.0/)でStreamに対して現在Stage 2のECMAScript Proposalである[Iterator Helpers](https://github.com/tc39/proposal-iterator-helpers)が実装されていました。 |
| 39 | +しかし、仕様に準拠した実装をした場合に[mongoose](https://github.com/Automattic/mongoose/issues/11377)などのモジュールが動かなくなるリグレッションが発生したため、[仕様への準拠を一部revert](https://github.com/nodejs/node/pull/41931)しています。 |
| 40 | + |
| 41 | +- [Regression in Node 17.5, Assigning a function to prototype of an Object results in a TypeError: Cannot assign to read only property 'x' of object 'y' at Object.<anonymous> · Issue #41926 · nodejs/node](https://github.com/nodejs/node/issues/41926) |
| 42 | + |
| 43 | +具体的にはIterator Helperの仕様では、`map`などのメソッドは[`{ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }`](https://tc39.es/proposal-iterator-helpers/#sec-iterator.prototype)で実装されることなっています。 |
| 44 | + |
| 45 | +この場合、次のようにStreamの`prototype.map`を上書きしようとする、`Writable`が`false`であるため、例外が発生してできません。 |
| 46 | + |
| 47 | +```js |
| 48 | +// [Writable]]: falseでは書き込めない |
| 49 | +ReadableStream.prototype.map = function(fn) { // 例外が発生する |
| 50 | + // .. |
| 51 | +}; |
| 52 | +``` |
| 53 | + |
| 54 | +mongooseなどで、このような代入が存在したため、[`[[Writable]]: false`を`[[Writable]]: true`にする変更(revert)](https://github.com/nodejs/node/pull/41931)がNode.js 17.6.0に含まれています。(BREAKING CHANGEとなってしまったため) |
| 55 | + |
| 56 | +- [fix Node.js 17.5 compatibility by benjamingr · Pull Request #11381 · Automattic/mongoose](https://github.com/Automattic/mongoose/pull/11381) |
| 57 | + - mongoose側での修正 |
| 58 | + |
| 59 | +---- |
| 60 | + |
| 61 | +[A Complete Guide to CSS Cascade Layers | CSS-Tricks - CSS-Tricks](https://css-tricks.com/css-cascade-layers/)という記事では、Chrome/Edge 99+、Firefox 97+、Safari Technology Preview 133で実装されている CSS Cascade Layers について紹介されています。 |
| 62 | + |
| 63 | +CSSでは、UA、`!important`、[詳細度](https://developer.mozilla.org/ja/docs/Web/CSS/Specificity)などによってどのスタイルが当たるかの[Cascadingの仕様](https://drafts.csswg.org/css-cascade/#cascading)があります。 |
| 64 | +この仕様に[Cascade Layers](https://www.w3.org/TR/css-cascade-5/#layering)というものが追加され、各ブラウザでの実装が進んでいます。 |
| 65 | + |
| 66 | +この記事では、Cascade Layersの基本的な使い方、Important layers、Layerの優先度、sub layerについてなど書かれています。 |
| 67 | + |
| 68 | +---- |
| 69 | + |
| 70 | +<h1 class="site-genre">ヘッドライン</h1> |
| 71 | + |
| 72 | +---- |
| 73 | + |
| 74 | +## Release v6.32.0 · pnpm/pnpm |
| 75 | +[github.com/pnpm/pnpm/releases/tag/v6.32.0](https://github.com/pnpm/pnpm/releases/tag/v6.32.0 "Release v6.32.0 · pnpm/pnpm") |
| 76 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">pnpm</span> <span class="jser-tag">ReleaseNote</span></p> |
| 77 | + |
| 78 | +pnpm 6.32.0リリース。 |
| 79 | +インストールスクリプトを実行できるパッケージを指定する`onlyBuiltDependencies`の追加、`overrides`フィールドが`pnpm add`に対して反映されるようになるなど |
| 80 | + |
| 81 | + |
| 82 | +---- |
| 83 | + |
| 84 | +## Astro 0.23 Release Notes | Astro |
| 85 | +[astro.build/blog/astro-023/](https://astro.build/blog/astro-023/ "Astro 0.23 Release Notes | Astro") |
| 86 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">library</span> <span class="jser-tag">ReleaseNote</span></p> |
| 87 | + |
| 88 | +Astro 0.23リリース。 |
| 89 | +HTML以外のビルドに対応、`set:html`と`set:text`ディレクティブの追加、`PUBLIC_` prefixの環境変数はフロントエンドへ公開するように変更。 |
| 90 | +また、次のバージョンではコンポーネント内のテキストを自動的にHTMLエスケープするよう変更予定。 |
| 91 | + |
| 92 | + |
| 93 | +---- |
| 94 | + |
| 95 | +## Node v17.6.0 (Current) | Node.js |
| 96 | +[nodejs.org/en/blog/release/v17.6.0/](https://nodejs.org/en/blog/release/v17.6.0/ "Node v17.6.0 (Current) | Node.js") |
| 97 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">node.js</span> <span class="jser-tag">ReleaseNote</span></p> |
| 98 | + |
| 99 | +Node.js 17.6.0リリース。 |
| 100 | +StreamにIterator helperの`map`などをメソッドを追加すると壊れるモジュールがあったため、仕様への準拠を一時的にrevert。 |
| 101 | +`--experimental-https-modules`のフラグ付きでHTTP URLをESMモジュールとしてロードできるように。 |
| 102 | +また`process.on("multipleResolves", ...)`がDeprecatedとなった。 |
| 103 | + |
| 104 | +- [stream: add map method to Readable: by benjamingr · Pull Request #40815 · nodejs/node](https://github.com/nodejs/node/pull/40815 "stream: add map method to Readable: by benjamingr · Pull Request #40815 · nodejs/node") |
| 105 | + |
| 106 | +---- |
| 107 | + |
| 108 | +## Release v1.8.0 · reduxjs/redux-toolkit |
| 109 | +[reduxjs/redux-toolkit/releases/tag/v1.8.0](https://github.com/reduxjs/redux-toolkit/releases/tag/v1.8.0) |
| 110 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">redux</span> <span class="jser-tag">library</span> <span class="jser-tag">ReleaseNote</span></p> |
| 111 | + |
| 112 | +Redux Toolkit v1.8.0-rc.0リリース。 |
| 113 | +新しい非同期Middlewareとして`createListenerMiddleware`を追加、`configureStore`の型定義の改善など |
| 114 | + |
| 115 | +- [New experimental &quot;action listener middleware&quot; package available · Discussion #1648 · reduxjs/redux-toolkit](https://github.com/reduxjs/redux-toolkit/discussions/1648 "New experimental &amp;quot;action listener middleware&amp;quot; package available · Discussion #1648 · reduxjs/redux-toolkit") |
| 116 | + |
| 117 | +---- |
| 118 | +<h1 class="site-genre">アーティクル</h1> |
| 119 | + |
| 120 | +---- |
| 121 | + |
| 122 | +## What's New In DevTools (Chrome 99) - Chrome Developers |
| 123 | +[developer.chrome.com/blog/new-in-devtools-99/](https://developer.chrome.com/blog/new-in-devtools-99/ "What's New In DevTools (Chrome 99) - Chrome Developers") |
| 124 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">Chrome</span> <span class="jser-tag">article</span> <span class="jser-tag">debug</span></p> |
| 125 | + |
| 126 | +Chrome 99の開発者ツールの変更点について。 |
| 127 | +WebSocketsのThrottilingに対応、Reporting APIのパネルを追加、ANSI escape codeを使ったコンソールログのスタイリングをサポートなど |
| 128 | + |
| 129 | + |
| 130 | +---- |
| 131 | + |
| 132 | +## How to publish Deno modules to NPM |
| 133 | +[deno.com/blog/dnt-oak](https://deno.com/blog/dnt-oak "How to publish Deno modules to NPM") |
| 134 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">deno</span> <span class="jser-tag">node.js</span> <span class="jser-tag">npm</span> <span class="jser-tag">article</span></p> |
| 135 | + |
| 136 | +Denoで書かれたライブラリをNode.js向けにnpmへ公開する方法について。 |
| 137 | +HTTPフレームワークであるoakをdntを使ってNode.jsでも動かすように変換して公開した方法について |
| 138 | + |
| 139 | +- [denoland/dnt: Deno to npm package build tool.](https://github.com/denoland/dnt/ "denoland/dnt: Deno to npm package build tool.") |
| 140 | +- [feat: add experimental support for Node.js by kitsonk · Pull Request #479 · oakserver/oak](https://github.com/oakserver/oak/pull/479 "feat: add experimental support for Node.js by kitsonk · Pull Request #479 · oakserver/oak") |
| 141 | + |
| 142 | +---- |
| 143 | + |
| 144 | +## A Complete Guide to CSS Cascade Layers | CSS-Tricks - CSS-Tricks |
| 145 | +[css-tricks.com/css-cascade-layers/](https://css-tricks.com/css-cascade-layers/ "A Complete Guide to CSS Cascade Layers | CSS-Tricks - CSS-Tricks") |
| 146 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">CSS</span> <span class="jser-tag">article</span></p> |
| 147 | + |
| 148 | +CSS Cascade Layersの解説記事。 |
| 149 | +Cascade Layersの基本的な使い方、Important layers、Layerの優先度、sub layerについてなど |
| 150 | + |
| 151 | + |
| 152 | +---- |
| 153 | +<h1 class="site-genre">サイト、サービス、ドキュメント</h1> |
| 154 | + |
| 155 | +---- |
| 156 | + |
| 157 | +## microsoft/TypeScript-Compiler-Notes: A repo containing notes about the TypeScript Compiler codebase |
| 158 | +[github.com/microsoft/TypeScript-Compiler-Notes](https://github.com/microsoft/TypeScript-Compiler-Notes "microsoft/TypeScript-Compiler-Notes: A repo containing notes about the TypeScript Compiler codebase") |
| 159 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">TypeScript</span> <span class="jser-tag">document</span></p> |
| 160 | + |
| 161 | +TypeScriptのコンパイラーについてのメモをまとめたリポジトリ。 |
| 162 | +重要な変更のPRのまとめ、コンパイルプロセスの解説やContributeする方法ついてなど書かれている |
| 163 | + |
| 164 | + |
| 165 | +---- |
| 166 | +<h1 class="site-genre">ソフトウェア、ツール、ライブラリ関係</h1> |
| 167 | + |
| 168 | +---- |
| 169 | + |
| 170 | +## JoshuaKGoldberg/TypeStat: Converts JavaScript to TypeScript and TypeScript to better TypeScript. |
| 171 | +[github.com/JoshuaKGoldberg/TypeStat](https://github.com/JoshuaKGoldberg/TypeStat "JoshuaKGoldberg/TypeStat: Converts JavaScript to TypeScript and TypeScript to better TypeScript.") |
| 172 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">TypeScript</span> <span class="jser-tag">Tools</span></p> |
| 173 | + |
| 174 | +JavaScriptのコードにTypeScriptの型をつけてTypeScriptのコードベースに変換するツール |
| 175 | + |
| 176 | + |
| 177 | +---- |
| 178 | + |
| 179 | +## xataio/screenshot: A zero-dependency browser-native way to take screenshots powered by the native web MediaDevices API. |
| 180 | +[github.com/xataio/screenshot](https://github.com/xataio/screenshot "xataio/screenshot: A zero-dependency browser-native way to take screenshots powered by the native web MediaDevices API.") |
| 181 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">library</span> <span class="jser-tag">Image</span> <span class="jser-tag">browser</span></p> |
| 182 | + |
| 183 | +`MediaDevices.getDisplayMedia`を使ったスクリーンショットライブラリ。 |
| 184 | +画面の表示そのものをキャプチャ画像として取得できる |
| 185 | + |
| 186 | +- [Xata | New Open Source Library: Announcing @xata.io/screenshot](https://www.xata.io/blog/introducing-screenshot/ "Xata | New Open Source Library: Announcing @xata.io/screenshot") |
| 187 | + |
| 188 | +---- |
| 189 | + |
| 190 | +## leafac/caxa: 📦 Package Node.js applications into executable binaries 📦 |
| 191 | +[github.com/leafac/caxa](https://github.com/leafac/caxa "leafac/caxa: 📦 Package Node.js applications into executable binaries 📦") |
| 192 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">node.js</span> <span class="jser-tag">Tools</span></p> |
| 193 | + |
| 194 | +Node.jsアプリケーションを単一の実行バイナリにパッケージングするツール。 |
| 195 | +Node.jsとアプリを含む自己解凍型アーカイブとして扱うことで、`fs`などへのpatchをせずにパッケージングしている |
| 196 | + |
| 197 | + |
| 198 | +---- |
| 199 | +<h1 class="site-genre">書籍関係</h1> |
| 200 | + |
| 201 | +---- |
| 202 | + |
| 203 | +## vinodotdev/node-to-rust |
| 204 | +[github.com/vinodotdev/node-to-rust/](https://github.com/vinodotdev/node-to-rust/ "vinodotdev/node-to-rust") |
| 205 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">Rust</span> <span class="jser-tag">book</span></p> |
| 206 | + |
| 207 | +JavaScriptユーザ向けのRust入門書 |
| 208 | + |
| 209 | + |
| 210 | +---- |
0 commit comments