|
| 1 | +--- |
| 2 | +title: "2022-02-14のJS: Parcel 2.3.0、Vite 2.8.0、Angular Compilerがどのように動いているか、JavaScriptでDDD" |
| 3 | +author: "azu" |
| 4 | +layout: post |
| 5 | +date : 2022-02-14T13:44:43.741Z |
| 6 | +category: JSer |
| 7 | +tags: |
| 8 | +- TypeScript |
| 9 | +- node.js |
| 10 | +- vite |
| 11 | +- ShellScript |
| 12 | +- bundler |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +JSer.info #579 - Parcel 2.3.0がリリースされました。 |
| 17 | + |
| 18 | +- [Release v2.3.0 · parcel-bundler/parcel](https://github.com/parcel-bundler/parcel/releases/tag/v2.3.0) |
| 19 | + |
| 20 | +ParcelでParcel自体のいくつかの依存関係を事前にbundleするように変更。 Node Core ModulesのpolyfillやBabel/PostCSSの依存関係をオンデマンドでインストールするように変更などの変更が含まれています。 |
| 21 | + |
| 22 | +- [Reduce the number of npm dependencies needed by parcel by devongovett · Pull Request #7576 · parcel-bundler/parcel](https://github.com/parcel-bundler/parcel/pull/7576) |
| 23 | + |
| 24 | +Vite 2.8.0がリリースされています。 |
| 25 | + |
| 26 | +- [vite/CHANGELOG.md at main · vitejs/vite](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#280-2022-02-09) |
| 27 | + |
| 28 | +[macOS Montereyで`5000` portが利用されている](https://developer.apple.com/forums/thread/682332)ため、`vite preview`のデフォルトportが`4173`へと変更されています。 |
| 29 | + |
| 30 | +また、Workerとしてbundleする対象をURL使ったものへと変更して、これを推奨として扱うように変更されています。 |
| 31 | + |
| 32 | +```diff |
| 33 | +- import MyWorker from './worker.js?worker' |
| 34 | +- const worker = new MyWorker() |
| 35 | ++ const worker = new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }) |
| 36 | +``` |
| 37 | + |
| 38 | +Parcel 2.3.0の変更もそうですが、Vite 2.8.0でもパッケージのインストールサイズの削減が含まれています。 |
| 39 | +依存関係を含めたパッケージのインストールサイズの測定には、[Package Phobia](https://packagephobia.com/)というサイトが使われることが多いですが、それぞれのパッケージのサイズは次のページで見られます。 |
| 40 | + |
| 41 | +- [parcel - Package Phobia](https://packagephobia.com/result?p=parcel) |
| 42 | +- [vite - Package Phobia](https://packagephobia.com/result?p=vite) |
| 43 | + |
| 44 | +Parcelのインストールサイズが大きくなっているのは、実行する端末とは別のアーキテクチャのネイティブバイナリも含まれているためです。 |
| 45 | +Vite(esbuild)では`optionalDependencies`を使って、実行する端末のアーキテクチャのバイナリだけをダウンロードしようとしています。 |
| 46 | + |
| 47 | +- [Different strategy for installing platform-specific binaries · Issue #789 · evanw/esbuild](https://github.com/evanw/esbuild/issues/789#issuecomment-903037112) |
| 48 | + |
| 49 | +ただし、この`optionalDependencies`でアーキテクチャ別のパッケージ(バイナリ)を配布した時の挙動は、npm/yarn/pnpmで統一されているわけではありません。 |
| 50 | + |
| 51 | +現在[SWC](https://github.com/swc-project/swc)や[esbuild](https://esbuild.github.io/)、[napi-rs](https://github.com/napi-rs/napi-rs)を使ったnative moduleの需要が高まってきたため、この挙動を定義する方法について議論がされています。 |
| 52 | + |
| 53 | +- [[RRFC] Add libc fields to select optionalDependencies should be installed or skipped · Issue #438 · npm/rfcs](https://github.com/npm/rfcs/issues/438) |
| 54 | +- [RFC: Package Distributions by darcyclarke · Pull Request #519 · npm/rfcs](https://github.com/npm/rfcs/pull/519) |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +[How the Angular Compiler Works. The Angular Compiler (which we call… | by Alex Rickabaugh | Feb, 2022 | Angular Blog](https://blog.angular.io/how-the-angular-compiler-works-42111f9d2549)という記事では、AngularのコンパイラーであるAngular Compilerがどのようにコンポーネントをコンパイルしてるかについて解説されています。 |
| 59 | + |
| 60 | +どのようにコンポーネントの型チェックをしているかや、Transpileしているかについて解説されています。 |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +[Implementing DDD, CQRS and Event Sourcing](https://leanpub.com/implementing-ddd-cqrs-and-event-sourcing)という書籍は、コードにJavaScript/Node.jsを使ってDDD(ドメイン駆動開発)について解説しています。 |
| 65 | + |
| 66 | +書籍では、DDDの概念とその実装について書かれていて、特定のフレームワークを使わずに理論と実装を進めながらアーキテクチャについて解説しています。 |
| 67 | + |
| 68 | +なぜ、DDDの解説にJavaScriptを使ったかやサードパーティのライブラリを使わずに解説したのかについてなどのFAQは次の記事で解説されています。 |
| 69 | + |
| 70 | +- [Why my book uses Node.js and JavaScript - Alex Lawrence](https://www.alex-lawrence.com/posts/why-my-book-uses-nodejs-and-javascript/) |
| 71 | +- [Using the filesystem for illustration purposes - Alex Lawrence](https://www.alex-lawrence.com/posts/using-the-filesystem-for-illustration-purposes/) |
| 72 | + |
| 73 | + |
| 74 | +---- |
| 75 | + |
| 76 | +<h1 class="site-genre">ヘッドライン</h1> |
| 77 | + |
| 78 | +---- |
| 79 | + |
| 80 | +## Release 5.0.0 · google/zx |
| 81 | +[github.com/google/zx/releases/tag/5.0.0](https://github.com/google/zx/releases/tag/5.0.0 "Release 5.0.0 · google/zx") |
| 82 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">ShellScript</span> <span class="jser-tag">JavaScript</span> <span class="jser-tag">node.js</span> <span class="jser-tag">library</span></p> |
| 83 | + |
| 84 | +zx 5.0.0リリース。 |
| 85 | +YAMLのサポート、 |
| 86 | +`.ts`のビルトインサポートを削除、Node.js 16未満のサポート終了など |
| 87 | + |
| 88 | + |
| 89 | +---- |
| 90 | + |
| 91 | +## Release v2.3.0 · parcel-bundler/parcel |
| 92 | +[github.com/parcel-bundler/parcel/releases/tag/v2.3.0](https://github.com/parcel-bundler/parcel/releases/tag/v2.3.0 "Release v2.3.0 · parcel-bundler/parcel") |
| 93 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">bundler</span> <span class="jser-tag">ReleaseNote</span></p> |
| 94 | + |
| 95 | +Parcel 2.3.0リリース。 |
| 96 | +ParcelでParcel自体のいくつかの依存関係を事前にbundleするように変更。 |
| 97 | +Node Core ModulesのpolyfillやBabel/PostCSSの依存関係をオンデマンドでインストールするように変更など |
| 98 | + |
| 99 | +- [Reduce the number of npm dependencies needed by parcel by devongovett · Pull Request #7576 · parcel-bundler/parcel](https://github.com/parcel-bundler/parcel/pull/7576 "Reduce the number of npm dependencies needed by parcel by devongovett · Pull Request #7576 · parcel-bundler/parcel") |
| 100 | + |
| 101 | +---- |
| 102 | + |
| 103 | +## Release v8.5.0 · npm/cli |
| 104 | +[github.com/npm/cli/releases/tag/v8.5.0](https://github.com/npm/cli/releases/tag/v8.5.0 "Release v8.5.0 · npm/cli") |
| 105 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">npm</span> <span class="jser-tag">ReleaseNote</span></p> |
| 106 | + |
| 107 | +npm 8.5.0リリース。 |
| 108 | +workspace内でのnpm installなどのコマンドがコンテキストに基づいて実行されるように変更など |
| 109 | + |
| 110 | +- [RFC: npm workspaces: auto switch context based on cwd by ruyadorno · Pull Request #343 · npm/rfcs](https://github.com/npm/rfcs/pull/343 "RFC: npm workspaces: auto switch context based on cwd by ruyadorno · Pull Request #343 · npm/rfcs") |
| 111 | + |
| 112 | +---- |
| 113 | + |
| 114 | +## Release Notes for Safari Technology Preview 140 | WebKit |
| 115 | +[webkit.org/blog/12255/release-notes-for-safari-technology-preview-140/](https://webkit.org/blog/12255/release-notes-for-safari-technology-preview-140/ "Release Notes for Safari Technology Preview 140 | WebKit") |
| 116 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">safari</span> <span class="jser-tag">ReleaseNote</span></p> |
| 117 | + |
| 118 | +Safari Technology Preview 140リリース。 |
| 119 | +CSSの`:has()`擬似クラスのサポート、`FetchEvent.handled`のサポート、`form.requestSubmit()`の有効化。 |
| 120 | +script要素がサポートしているtypeを判定する |
| 121 | +`HTMLScriptElement.supports(type)`の実装など |
| 122 | + |
| 123 | +- [Add FetchEvent.handled (#1397) by tingshao · Pull Request #1496 · w3c/ServiceWorker](https://github.com/w3c/ServiceWorker/pull/1496 "Add FetchEvent.handled (#1397) by tingshao · Pull Request #1496 · w3c/ServiceWorker") |
| 124 | +- [HTMLScriptElement.supports() - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/supports "HTMLScriptElement.supports() - Web APIs | MDN") |
| 125 | + |
| 126 | +---- |
| 127 | + |
| 128 | +## Announcing TypeScript 4.6 RC - TypeScript |
| 129 | +[devblogs.microsoft.com/typescript/announcing-typescript-4-6-rc/](https://devblogs.microsoft.com/typescript/announcing-typescript-4-6-rc/ "Announcing TypeScript 4.6 RC - TypeScript") |
| 130 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">TypeScript</span> <span class="jser-tag">ReleaseNote</span></p> |
| 131 | + |
| 132 | +TypeScript 4.6 RCリリース。 |
| 133 | +再帰型、インターフェースへのインデックスアクセス、関数の引数における型推論の改善。 |
| 134 | +`--target es2022`のサポート、`checkJs`が有効時のJavaScriptの構文エラーのチェックを改善。 |
| 135 | +`--generateTrace`で出力できるビルドのトレースデータを分析するための`@typescript/analyze-trace`パッケージの公開など |
| 136 | + |
| 137 | + |
| 138 | +---- |
| 139 | + |
| 140 | +## vite/CHANGELOG.md at main · vitejs/vite |
| 141 | +[github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#280-2022-02-09](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#280-2022-02-09 "vite/CHANGELOG.md at main · vitejs/vite") |
| 142 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">vite</span> <span class="jser-tag">ReleaseNote</span></p> |
| 143 | + |
| 144 | +Vite 2.8.0リリース。 |
| 145 | +`vite preview`のデフォルトportの変更、Workerとしてbundleする対象を`URL`使ったものへと変更、設定に`worker`オプションを追加など。 |
| 146 | +また、パッケージのファイルサイズの削減など |
| 147 | + |
| 148 | + |
| 149 | +---- |
| 150 | + |
| 151 | +## Release v28.0.0-alpha.0 · facebook/jest |
| 152 | +[github.com/facebook/jest/releases/tag/v28.0.0-alpha.0](https://github.com/facebook/jest/releases/tag/v28.0.0-alpha.0 "Release v28.0.0-alpha.0 · facebook/jest") |
| 153 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">testing</span> <span class="jser-tag">library</span> <span class="jser-tag">ReleaseNote</span></p> |
| 154 | + |
| 155 | +Jest 28αリリース。 |
| 156 | +27で`jest-circus`がデフォルトとなったため、JSDOMとjasmin2のenviromentをデフォルトでは含めないように変更。 |
| 157 | +`package.json`の`exports`フィールドに対応など |
| 158 | + |
| 159 | + |
| 160 | +---- |
| 161 | + |
| 162 | +## ESLint v8.9.0 released - ESLint - Pluggable JavaScript linter |
| 163 | +[eslint.org/blog/2022/02/eslint-v8.9.0-released](https://eslint.org/blog/2022/02/eslint-v8.9.0-released "ESLint v8.9.0 released - ESLint - Pluggable JavaScript linter") |
| 164 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">ESLint</span> <span class="jser-tag">ReleaseNote</span></p> |
| 165 | + |
| 166 | +ESLint 8.9.0リリース。 |
| 167 | +`env`に`es2016`/`es2018`/`es2019`/`es2022`オプションの追加、ES3のコードでは`"use strict"`を無視するように変更など |
| 168 | + |
| 169 | + |
| 170 | +---- |
| 171 | + |
| 172 | +## Firefox 97.0, See All New Features, Updates and Fixes |
| 173 | +[www.mozilla.org/en-US/firefox/97.0/releasenotes/](https://www.mozilla.org/en-US/firefox/97.0/releasenotes/ "Firefox 97.0, See All New Features, Updates and Fixes") |
| 174 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">Firefox</span> <span class="jser-tag">ReleaseNote</span></p> |
| 175 | + |
| 176 | +Firefox 97リリース。 |
| 177 | +CSSの`cap`と`ic` unitをサポート、`@scroll-timeline`と`animation-timeline`のサポート、CSS cascade layersをデフォルトで有効化。 |
| 178 | +`AbortController.abort()`/`AbortSignal.throwIfAborted()`/`AbortSignal.reason`プロパティのサポートなど |
| 179 | + |
| 180 | +- [Firefox 97 for developers - Mozilla | MDN](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/97 "Firefox 97 for developers - Mozilla | MDN") |
| 181 | + |
| 182 | +---- |
| 183 | + |
| 184 | +## Node v17.5.0 (Current) | Node.js |
| 185 | +[nodejs.org/en/blog/release/v17.5.0/](https://nodejs.org/en/blog/release/v17.5.0/ "Node v17.5.0 (Current) | Node.js") |
| 186 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">node.js</span> <span class="jser-tag">ReleaseNote</span></p> |
| 187 | + |
| 188 | +Node.js 17.5.0リリース。 |
| 189 | +`--experimental-fetch`フラグ付きでundiciベースのFetch APIの実装を追加、Streamにiterator-helper proposalの実装など |
| 190 | + |
| 191 | + |
| 192 | +---- |
| 193 | +<h1 class="site-genre">アーティクル</h1> |
| 194 | + |
| 195 | +---- |
| 196 | + |
| 197 | +## How the Angular Compiler Works. The Angular Compiler (which we call… | by Alex Rickabaugh | Feb, 2022 | Angular Blog |
| 198 | +[blog.angular.io/how-the-angular-compiler-works-42111f9d2549](https://blog.angular.io/how-the-angular-compiler-works-42111f9d2549 "How the Angular Compiler Works. The Angular Compiler (which we call… | by Alex Rickabaugh | Feb, 2022 | Angular Blog") |
| 199 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">Angular</span> <span class="jser-tag">TypeScript</span> <span class="jser-tag">article</span></p> |
| 200 | + |
| 201 | +Angular Compilerがどのように動いているかについての解説記事。 |
| 202 | +どのようにAngular componentのテンプレートの型チェックをして変換しているのかについて。 |
| 203 | + |
| 204 | + |
| 205 | +---- |
| 206 | + |
| 207 | +## Web パフォーマンスとプロダクト KPI の相関を可視化する話 2022ver - ドクターズプライム Official Blog |
| 208 | +[blog.drsprime.com/entry/2022/02/10/170000](https://blog.drsprime.com/entry/2022/02/10/170000 "Web パフォーマンスとプロダクト KPI の相関を可視化する話 2022ver - ドクターズプライム Official Blog") |
| 209 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">performance</span> <span class="jser-tag">JavaScript</span> <span class="jser-tag">Chrome</span> <span class="jser-tag">article</span></p> |
| 210 | + |
| 211 | +Web VitalsのメトリクスをGoogle Analyticsに送信し、Google データポータルで可視化する方法について |
| 212 | + |
| 213 | + |
| 214 | +---- |
| 215 | +<h1 class="site-genre">サイト、サービス、ドキュメント</h1> |
| 216 | + |
| 217 | +---- |
| 218 | + |
| 219 | +## checkly/puppeteer-to-playwright: Puppeteer to Playwright conversion script |
| 220 | +[github.com/checkly/puppeteer-to-playwright](https://github.com/checkly/puppeteer-to-playwright "checkly/puppeteer-to-playwright: Puppeteer to Playwright conversion script") |
| 221 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">puppeteer</span> <span class="jser-tag">Tools</span> <span class="jser-tag">refactoring</span></p> |
| 222 | + |
| 223 | +Puppeter向けのスクリプトをPlaywright向けに変換するツール |
| 224 | + |
| 225 | + |
| 226 | +---- |
| 227 | +<h1 class="site-genre">ソフトウェア、ツール、ライブラリ関係</h1> |
| 228 | + |
| 229 | +---- |
| 230 | + |
| 231 | +## papyrs/stylo: Another kind of rich text editor |
| 232 | +[github.com/papyrs/stylo](https://github.com/papyrs/stylo "papyrs/stylo: Another kind of rich text editor") |
| 233 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">WebComponents</span> <span class="jser-tag">library</span> <span class="jser-tag">JavaScript</span></p> |
| 234 | + |
| 235 | +ContentEditableベースのWYSIWYGなWeb Components |
| 236 | + |
| 237 | + |
| 238 | +---- |
| 239 | + |
| 240 | +## hikerpig/pintora: An extensible text-to-diagrams library that works in both browser and node.js |
| 241 | +[github.com/hikerpig/pintora](https://github.com/hikerpig/pintora "hikerpig/pintora: An extensible text-to-diagrams library that works in both browser and node.js") |
| 242 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">library</span> <span class="jser-tag">graphic</span></p> |
| 243 | + |
| 244 | +Mermaid.jsやPlantUMLのようにテキストでダイアグラムを書くライブラリ。 |
| 245 | +Sequence Diagram、Component Diagram、Activity Diagram、Mind Mapなどの形式に対応していて、プラグインでカスタマイズできる |
| 246 | + |
| 247 | + |
| 248 | +---- |
| 249 | + |
| 250 | +## Aslemammad/react-worker-components-plugin: ⚡ Something like react server components, but web workers instead of a server |
| 251 | +[github.com/Aslemammad/react-worker-components-plugin](https://github.com/Aslemammad/react-worker-components-plugin "Aslemammad/react-worker-components-plugin: ⚡ Something like react server components, but web workers instead of a server") |
| 252 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">React</span> <span class="jser-tag">vite</span> <span class="jser-tag">plugin</span></p> |
| 253 | + |
| 254 | +importしたReactコンポーネントをreact-worker-componentsを使ってWebWorkerで動かすように変換するViteプラグイン |
| 255 | + |
| 256 | +- [dai-shi/react-worker-components: React Worker Components simplify using Web Workers](https://github.com/dai-shi/react-worker-components "dai-shi/react-worker-components: React Worker Components simplify using Web Workers") |
| 257 | + |
| 258 | +---- |
| 259 | +<h1 class="site-genre">書籍関係</h1> |
| 260 | + |
| 261 | +---- |
| 262 | + |
| 263 | +## Implementing DDD, CQRS and… by Alex Lawrence \[PDF/iPad/Kindle\] |
| 264 | +[leanpub.com/implementing-ddd-cqrs-and-event-sourcing](https://leanpub.com/implementing-ddd-cqrs-and-event-sourcing "Implementing DDD, CQRS and… by Alex Lawrence \[PDF/iPad/Kindle\]") |
| 265 | +<p class="jser-tags jser-tag-icon"><span class="jser-tag">JavaScript</span> <span class="jser-tag">TypeScript</span> <span class="jser-tag">DDD</span> <span class="jser-tag">book</span></p> |
| 266 | + |
| 267 | +JavaScriptで書かれたDDD/CQRS/Event Sourcingについての書籍。 |
| 268 | +ドメイン駆動設計の理論的な話から、JavaScript/Node.jsを使った実装について。 |
| 269 | +Event Sourcingでは、ブラウザ上のUIと`EventSource`を使ったRead Modelについても扱っている |
| 270 | + |
| 271 | +- [Why my book uses Node.js and JavaScript - Alex Lawrence](https://www.alex-lawrence.com/posts/why-my-book-uses-nodejs-and-javascript/ "Why my book uses Node.js and JavaScript - Alex Lawrence") |
| 272 | + |
| 273 | +---- |
0 commit comments