<?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[Contributing——模具行业从业者必备知识手册]]></title><description><![CDATA[<p dir="auto">&lt;h2&gt;Contributing&lt;/h2&gt;</p>
<p dir="auto">&lt;h3&gt;Adding a new plugin or polyfill to support (when approved in the next ECMAScript version)&lt;/h3&gt;</p>
<p dir="auto">&lt;h4&gt;Update <a href="https://github.com/babel/babel/blob/main/packages/babel-compat-data/scripts/data/plugin-features.js" rel="nofollow ugc"><code>plugin-features.js</code></a>&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;If you were going to add &lt;code&gt;**&lt;/code&gt; which is in ES2016:&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Find the relevant entries on &lt;a href="<a href="https://kangax.github.io/compat-table/es2016plus/#test-exponentiation_(**%22%3Ecompat-table%3C/a%3E_operator):" rel="nofollow ugc">https://kangax.github.io/compat-table/es2016plus/#test-exponentiation_(**"&gt;compat-table&lt;/a&gt;_operator):</a>&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;&lt;code&gt;exponentiation (**) operator&lt;/code&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Find the corresponding babel plugin:&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;&lt;code&gt;@babel/plugin-transform-exponentiation-operator&lt;/code&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;And add them in this structure:&lt;/p&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
// es2016<br />
"@babel/plugin-transform-exponentiation-operator": {<br />
features: [<br />
"exponentiation (**) operator",<br />
],<br />
},<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;h4&gt;Update data for <code>core-js@2</code> polyfilling&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;In case you want to add &lt;code&gt;Object.values&lt;/code&gt; which is in ES2017:&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Find the relevant feature and subfeature on &lt;a href="<a href="https://kangax.github.io/compat-table/es2016plus/#test-Object_static_methods_Object.values" rel="nofollow ugc">https://kangax.github.io/compat-table/es2016plus/#test-Object_static_methods_Object.values</a>"&gt;compat-table&lt;/a&gt;&lt;/p&gt;<br />
&lt;p&gt;and split it with &lt;code&gt;/&lt;/code&gt;:&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;&lt;code&gt;Object static methods / Object.values&lt;/code&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Find the corresponding module on &lt;a href="<a href="https://github.com/zloirock/core-js/tree/v2/modules" rel="nofollow ugc">https://github.com/zloirock/core-js/tree/v2/modules</a>"&gt;&lt;code&gt;core-js@2&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;&lt;code&gt;es7.object.values.js&lt;/code&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Find required ES version in &lt;a href="<a href="https://github.com/babel/babel/blob/main/packages/babel-preset-env/data/corejs2-built-in-features.js" rel="nofollow ugc">https://github.com/babel/babel/blob/main/packages/babel-preset-env/data/corejs2-built-in-features.js</a>"&gt;&lt;code&gt;corejs2-built-in-features.js&lt;/code&gt;&lt;/a&gt; and add the new feature:&lt;/p&gt;</p>
<p dir="auto">&lt;pre&gt;&lt;code&gt;<br />
const es = {<br />
//...<br />
"es7.object.values": "Object static methods / Object.values"<br />
}<br />
&lt;/code&gt;&lt;/pre&gt;</p>
<p dir="auto">&lt;p&gt;If you want to transform a new built-in by &lt;code&gt;useBuiltIns: 'usage'&lt;/code&gt;, add mapping to related &lt;code&gt;core-js&lt;/code&gt; modules to &lt;a href="<a href="https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs2/built-in-definitions.js" rel="nofollow ugc">https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs2/built-in-definitions.js</a>"&gt;this file&lt;/a&gt;.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;Update data for <code>core-js@3</code> polyfilling&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Just update the version of &lt;a href="<a href="https://github.com/zloirock/core-js/tree/main/packages/core-js-compat" rel="nofollow ugc">https://github.com/zloirock/core-js/tree/main/packages/core-js-compat</a>"&gt;&lt;code&gt;core-js-compat&lt;/code&gt;&lt;/a&gt; in dependencies.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;If you want to transform a new built-in by &lt;code&gt;useBuiltIns: 'usage'&lt;/code&gt;, add mapping to related &lt;a href="<a href="https://github.com/zloirock/core-js/tree/main/packages/core-js/modules" rel="nofollow ugc">https://github.com/zloirock/core-js/tree/main/packages/core-js/modules</a>"&gt;&lt;code&gt;core-js&lt;/code&gt;&lt;/a&gt; modules to &lt;a href="<a href="https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs3/built-in-definitions.js" rel="nofollow ugc">https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs3/built-in-definitions.js</a>"&gt;this file&lt;/a&gt;.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;If you want to mark a new proposal as shipped, add it to &lt;a href="<a href="https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs3/shipped-proposals.js" rel="nofollow ugc">https://github.com/babel/babel/blob/main/packages/babel-preset-env/polyfills/corejs3/shipped-proposals.js</a>"&gt;this list&lt;/a&gt;.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;Update <a href="https://github.com/babel/babel/blob/main/packages/babel-preset-env/data/plugins.json" rel="nofollow ugc"><code>plugins.json</code></a>&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;Until &lt;code&gt;compat-table&lt;/code&gt; is a standalone npm module for data we are using the git commit in &lt;code&gt;packages/babel-compat-data/scripts/download-compat-table.sh&lt;/code&gt;&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;&lt;code&gt;COMPAT_TABLE_COMMIT=[latest-commit-hash]&lt;/code&gt;,&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;So we update and then run &lt;code&gt;npm run build-data&lt;/code&gt;. If there are no changes, then &lt;code&gt;plugins.json&lt;/code&gt; will be the same.&lt;/p&gt;</p>
<p dir="auto">&lt;h3&gt;Tests&lt;/h3&gt;</p>
<p dir="auto">&lt;h4&gt;Running tests&lt;/h4&gt;<br />
&lt;p&gt;See general &lt;a href="<a href="https://github.com/babel/babel/blob/main/CONTRIBUTING.md#running-lintingtests" rel="nofollow ugc">https://github.com/babel/babel/blob/main/CONTRIBUTING.md#running-lintingtests</a>"&gt;CONTRIBUTING.md&lt;/a&gt;.&lt;/p&gt;</p>
<p dir="auto">&lt;h4&gt;Writing tests&lt;/h4&gt;</p>
<p dir="auto">&lt;p&gt;#### General&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;All the tests for &lt;code&gt;@babel/preset-env&lt;/code&gt; exist in the &lt;code&gt;test/fixtures&lt;/code&gt; folder. The&lt;/p&gt;<br />
&lt;p&gt;test setup and conventions are exactly the same as testing a Babel plugin, so&lt;/p&gt;<br />
&lt;p&gt;please read our &lt;a href="<a href="https://github.com/babel/babel/blob/main/CONTRIBUTING.md#babel-plugin-x" rel="nofollow ugc">https://github.com/babel/babel/blob/main/CONTRIBUTING.md#babel-plugin-x</a>"&gt;documentation on writing tests&lt;/a&gt;.&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;#### Testing the &lt;code&gt;debug&lt;/code&gt; option&lt;/p&gt;</p>
<p dir="auto">&lt;p&gt;Testing debug output to &lt;code&gt;stdout&lt;/code&gt; is similar. Under the &lt;code&gt;test/debug-fixtures&lt;/code&gt;,&lt;/p&gt;<br />
&lt;p&gt;create a folder with a descriptive name of your test, and add the following:&lt;/p&gt;</p>
<p dir="auto">&lt;ul&gt;<br />
&lt;li&gt;Add a &lt;code&gt;options.json&lt;/code&gt; file (just as the other tests, this is&lt;/li&gt;<br />
&lt;/ul&gt;</p>
<p dir="auto">&lt;hr&gt;<br />
&lt;p&gt;哪个方案更实用？欢迎投票讨论。&lt;/p&gt;</p>
]]></description><link>https://forum.mj7.cn/topic/7235/contributing-模具行业从业者必备知识手册</link><generator>RSS for Node</generator><lastBuildDate>Fri, 02 Oct 2026 08:15:02 GMT</lastBuildDate><atom:link href="https://forum.mj7.cn/topic/7235.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Apr 2026 22:08:08 GMT</pubDate><ttl>60</ttl></channel></rss>