<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[depd依赖模块 - 编程技术参考——模具行业从业者必备知识手册]]></title><description><![CDATA[<p dir="auto">&lt;h2&gt;depd&lt;/h2&gt;</p>
<p dir="auto">&lt;p&gt;[![NPM Version][npm-version-image&rsqb;&rsqb;[npm-url]&lt;/p&gt;<br />
&lt;p&gt;[![NPM Downloads][npm-downloads-image&rsqb;&rsqb;[npm-url]&lt;/p&gt;<br />
&lt;p&gt;[![Node.js Version][node-image&rsqb;&rsqb;[node-url]&lt;/p&gt;<br />
&lt;p&gt;[![Linux Build][travis-image&rsqb;&rsqb;[travis-url]&lt;/p&gt;<br />
&lt;p&gt;[![Windows Build][appveyor-image&rsqb;&rsqb;[appveyor-url]&lt;/p&gt;<br />
&lt;p&gt;[![Coverage Status][coveralls-image&rsqb;&rsqb;[coveralls-url]&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Deprecate all the things&lt;/p&gt;</p>
<p dir="auto">&lt;blockquote&gt;<br />
&lt;p&gt;With great modules comes great responsibility; mark things deprecated!&lt;/p&gt;<br />
&lt;/blockquote&gt;</p>
<p dir="auto">&lt;h3&gt;Install&lt;/h3&gt;</p>
<p dir="auto">&lt;p&gt;This module is installed directly using &lt;code&gt;npm&lt;/code&gt;:&lt;/p&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
$ npm install depd<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;p&gt;This module can also be bundled with systems like&lt;/p&gt;<br />
&lt;p&gt;&lt;a href="<a href="http://browserify.org/" rel="nofollow ugc">http://browserify.org/</a>"&gt;Browserify&lt;/a&gt; or &lt;a href="<a href="https://webpack.github.io/" rel="nofollow ugc">https://webpack.github.io/</a>"&gt;webpack&lt;/a&gt;,&lt;/p&gt;<br />
&lt;p&gt;though by default this module will alter it's API to no longer display or&lt;/p&gt;<br />
&lt;p&gt;track deprecations.&lt;/p&gt;</p>
<p dir="auto">&lt;h3&gt;API&lt;/h3&gt;</p>
<p dir="auto">&lt;p&gt;&lt;!-- eslint-disable no-unused-vars --&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
var deprecate = require('depd')('my-module')<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;p&gt;This library allows you to display deprecation messages to your users.&lt;/p&gt;<br />
&lt;p&gt;This library goes above and beyond with deprecation warnings by&lt;/p&gt;<br />
&lt;p&gt;introspection of the call stack (but only the bits that it is interested&lt;/p&gt;<br />
&lt;p&gt;in).&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Instead of just warning on the first invocation of a deprecated&lt;/p&gt;<br />
&lt;p&gt;function and never again, this module will warn on the first invocation&lt;/p&gt;<br />
&lt;p&gt;of a deprecated function per unique call site, making it ideal to alert&lt;/p&gt;<br />
&lt;p&gt;users of all deprecated uses across the code base, rather than just&lt;/p&gt;<br />
&lt;p&gt;whatever happens to execute first.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;The deprecation warnings from this module also include the file and line&lt;/p&gt;<br />
&lt;p&gt;information for the call into the module that the deprecated function was&lt;/p&gt;<br />
&lt;p&gt;in.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt; this library has a similar interface to the &lt;code&gt;debug&lt;/code&gt; module, and&lt;/p&gt;<br />
&lt;p&gt;this module uses the calling file to get the boundary for the call stacks,&lt;/p&gt;<br />
&lt;p&gt;so you should always create a new &lt;code&gt;deprecate&lt;/code&gt; object in each file and not&lt;/p&gt;<br />
&lt;p&gt;within some central file.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;depd(namespace)&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Create a new deprecate function that uses the given namespace name in the&lt;/p&gt;<br />
&lt;p&gt;messages and will display the call site prior to the stack entering the&lt;/p&gt;<br />
&lt;p&gt;file this function was called from. It is highly suggested you use the&lt;/p&gt;<br />
&lt;p&gt;name of your module as the namespace.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;deprecate(message)&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Call this function from deprecated code to display a deprecation message.&lt;/p&gt;<br />
&lt;p&gt;This message will appear once per unique caller site. Caller site is the&lt;/p&gt;<br />
&lt;p&gt;first call site in the stack in a different file from the caller of this&lt;/p&gt;<br />
&lt;p&gt;function.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;If the message is omitted, a message is generated for you based on the site&lt;/p&gt;<br />
&lt;p&gt;of the &lt;code&gt;deprecate()&lt;/code&gt; call and will display the name of the function called,&lt;/p&gt;<br />
&lt;p&gt;similar to the name displayed in a stack trace.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;deprecate.function(fn, message)&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Call this function to wrap a given function in a deprecation message on any&lt;/p&gt;<br />
&lt;p&gt;call to the function. An optional message can be supplied to provide a custom&lt;/p&gt;<br />
&lt;p&gt;message.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;deprecate.property(obj, prop, message)&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Call this function to wrap a given property on object in a deprecation message&lt;/p&gt;<br />
&lt;p&gt;on any accessing or setting of the property. An optional message can be supplied&lt;/p&gt;<br />
&lt;p&gt;to provide a custom message.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;The method must be called on the object where the property belongs (not&lt;/p&gt;<br />
&lt;p&gt;inherited from the prototype).&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;If the property is a data descriptor, it will be converted to an accessor&lt;/p&gt;<br />
&lt;p&gt;descriptor in order to display the deprecation message.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;process.on('deprecation', fn)&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;This module will allow easy capturing of deprecation errors by emitting the&lt;/p&gt;<br />
&lt;p&gt;errors as the type "deprecation" on the global &lt;code&gt;process&lt;/code&gt;. If there are no&lt;/p&gt;<br />
&lt;p&gt;listeners for this type, the errors are written to STDERR as normal, but if&lt;/p&gt;<br />
&lt;p&gt;there are any listeners, nothing will be written to STDERR and instead only&lt;/p&gt;<br />
&lt;p&gt;emitted. From there, you&lt;/p&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;p&gt;这个参数你们一般设多少？评论区说说。&lt;/p&gt;</p>
]]></description><link>https://forum.mj7.cn/topic/7197/depd依赖模块-编程技术参考-模具行业从业者必备知识手册</link><generator>RSS for Node</generator><lastBuildDate>Fri, 02 Oct 2026 11:05:53 GMT</lastBuildDate><atom:link href="https://forum.mj7.cn/topic/7197.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Apr 2026 21:52:44 GMT</pubDate><ttl>60</ttl></channel></rss>