<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Npm on Commentary of Takao</title><link>https://takao.blog/zh-tw/tags/npm/</link><description>Recent content in Npm on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>zh-TW</language><copyright>Commentary of Takao</copyright><lastBuildDate>Wed, 15 Jul 2026 22:01:08 +0900</lastBuildDate><atom:link href="https://takao.blog/zh-tw/tags/npm/index.xml" rel="self" type="application/rss+xml"/><item><title>Exporting 正確的 TypeScript Declaration Files (.d.ts) for NPM</title><link>https://takao.blog/zh-tw/web/typescript-declaration-files-dts/</link><pubDate>Sun, 10 May 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/typescript-declaration-files-dts/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/typescript-declaration-files-dts-zh-tw.png" alt="Featured image of post Exporting 正確的 TypeScript Declaration Files (.d.ts) for NPM" /&gt;&lt;h2 id="why-declaration-files-matter"&gt;Why Declaration Files Matter
&lt;/h2&gt;&lt;p&gt;When you publish an npm package written in TypeScript, consumers need type information to get IntelliSense and compile-time checking. Without &lt;code&gt;.d.ts&lt;/code&gt; files, your library is effectively typed as &lt;code&gt;any&lt;/code&gt;, defeating the purpose of using TypeScript in the first place.&lt;/p&gt;
&lt;p&gt;Declaration files describe the shape of your exports without shipping the implementation source. They enable tree-shaking, documentation hover tips, and strict type checking in consumer projects.&lt;/p&gt;
&lt;h2 id="generating-dts-files"&gt;Generating .d.ts Files
&lt;/h2&gt;&lt;p&gt;The TypeScript compiler generates declaration files when &lt;code&gt;declaration&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt; in &lt;code&gt;tsconfig.json&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>審核 NPM 依賴關係：Snyk 和自動化修補程式管理</title><link>https://takao.blog/zh-tw/web/security-dependency-vulnerabilities-npm-audit/</link><pubDate>Sat, 15 Nov 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/security-dependency-vulnerabilities-npm-audit/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/security-dependency-vulnerabilities-npm-audit-zh-tw.png" alt="Featured image of post 審核 NPM 依賴關係：Snyk 和自動化修補程式管理" /&gt;&lt;h2 id="供應鏈問題"&gt;供應鏈問題
&lt;/h2&gt;&lt;p&gt;現代 JavaScript 應用程式提供了數以萬計的傳遞依賴項。每一個都是潛在的攻擊媒介。 &lt;strong&gt;event-stream&lt;/strong&gt; 事件（2018 年）將惡意程式包注入到流行的依賴項中，這表示漏洞可能來自樹中的任何位置。在這種規模下，僅依靠人工審核是不可能的。&lt;/p&gt;</description></item><item><title>比較套件管理器：npm、pnpm 和yarn</title><link>https://takao.blog/zh-tw/web/npm-pnpm-yarn-package-managers/</link><pubDate>Tue, 15 Apr 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh-tw/web/npm-pnpm-yarn-package-managers/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/npm-pnpm-yarn-package-managers-zh-tw.png" alt="Featured image of post 比較套件管理器：npm、pnpm 和yarn" /&gt;&lt;h2 id="介紹"&gt;介紹
&lt;/h2&gt;&lt;p&gt;在 JavaScript 和 Node.js 開發中，套件管理器是必不可少的日常工具。&lt;/p&gt;
&lt;p&gt;雖然&lt;strong&gt;npm&lt;/strong&gt;仍然是預設的行業標準，但&lt;strong&gt;pnpm&lt;/strong&gt;（以節省磁碟空間和速度而聞名）和&lt;strong&gt;yarn&lt;/strong&gt;（具有零安裝和即插即用模式）等現代替代品提供了獨特的架構。&lt;/p&gt;</description></item></channel></rss>