You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
最近、色々なライブラリをCommonJS(CJS)からECMAScript Module(ESM)へとマイグレーションしています。 その際に、ESMでは__dirnameやrequireなどCommonJS特有の機能は使えなくなっています。 また、TypeScriptやBabelなど多くのツールはCJSではimport時に拡張子はなくても大丈夫ですが、ESMの場合はimport時に拡張子が必要になります。 import url from "node:url"; - import { mdEscape } from "./mdEscape"; + import { mdEscape } from "./mdEscape.js"; // ESMでは相対パスに拡張子は省略できない + const __filename = url.fileURLToPath(import.meta.url); /
Typesafe Jest lifecycle hooks "Providers" – Typesafe modular reusable lifecycle hooks Builtin providers: Dir Get a temp/given directory and instance of fs-jetpack pointing to it. Browser Get a Playwright browser. Page Get a Playwright page. Run Handy child-process methods powered by Execa. If Dir in upstream context then used for default CWD. ChildProcess Easily run a child-process over the test l
TypeStat is a CLI utility that modifies TypeScript types in existing code. The built-in mutators will only ever add or remove types and will never change your runtime behavior. TypeStat can: ✨ Convert JavaScript files to TypeScript in a single bound! ✨ Add TypeScript types on files freshly converted from JavaScript to TypeScript! ✨ Infer types to fix --noImplicitAny and --noImplicitThis violations
This book explains and illustrates how to implement Domain-Driven Design, Command Query Responsibility Segregation and Event Sourcing. The goal is to build software that is behavior-rich, event-based, problem-centric, reactive, scalable and well-designed. Domain-Driven Design is a way to build software that focuses on the problem to solve and its associated knowledge areas. Command Query Responsib
📝 require(moduleName) は同期処理なのに対して、import(moduleName)は非同期処理となります。 📝 tsconfig.jsonでesModuleInteropがtrueでないとdeafult importの意味合いは異なります。 この表はCommonJS ModulesとECMAScript Modulesで機能的に1対1で応するという意味ではありませんが、 大まかにはこの対応表にそってECMAScript Modulesの構文へと変換ができます。 エディターを使い手動で変換したり、次のようなツールを使ってある程度機械的な変換も可能です。 cjstoesm commonjs-to-es-module-codemod このモジュールの変換で重要なことは、できるだけCommonJS ModulesとECMAScript Modulesを混ぜないことです。
TypeScriptの主要な入力ファイルは .ts, .tsx, .mts, .cts ですが、JavaScriptファイル (.js, .jsx, .mjs, .cjs) も読み込んで処理することができます。JSDocによる型アノテーションを認識するため、生のJavaScriptでもそれなりに型をつけることができます。 本稿ではタイトル通り、TypeScriptのJSDocサポートでできることとできないこと (.ts でしかできないこと) をまとめます。 おことわり 本記事はTypeScript 4.4時点での実装状況に基づいています。なるべくソースコード中の関係する箇所を参照するようにしたので、今後の変更はご自分で検証してください。 (TypeScript Playgroundで試すだけでも有用です JavaScriptモードで開始できるリンク) JSDocの機能一覧・TypeScri
PackemonScaffold, build, and maintain npm packages using standardized configurations and practices. Supports JavaScript and TypeScript. 📦 Zero-config packagesNo longer fiddle with Babel, Rollup, Webpack or other tooling configurations. Packemon configures packages automatically using sane and common defaults. 🧩 Multiple platformsSupport either or both Node.js and Web based platforms on a per-pro
Clipanion supports advanced typing mechanisms Clipanion supports nested commands (yarn workspaces list) Clipanion supports transparent option proxying without -- (for example yarn dlx eslint --fix) Clipanion supports all option types you could think of (including negations, batches, ...) Clipanion offers a Typanion integration for increased validation capabilities Clipanion generates an optimized
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く