Skip to content

Commit

Permalink
Merge branch 'node-native-esm' (PR #2914)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Apr 9, 2021
2 parents 68d1de8 + 62c6ad0 commit ac4afe3
Show file tree
Hide file tree
Showing 37 changed files with 4,376 additions and 210 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ coverage
test-treeshake/*-umd.js
amd
cjs
/underscore.js
/underscore-min.js
/underscore-min.js.map
/underscore-node-*-pre*
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ sudo: false
jobs:
include:
- node_js: 8
env: EXTRA=false
env:
- DOWNGRADE=true
- EXTRA=false
- node_js: 10
env: EXTRA=true
env:
- DOWNGRADE=false
- EXTRA=false
- node_js: 14
env: EXTRA=false
env:
- DOWNGRADE=false
- EXTRA=true
before_install:
- npm install -g karma-cli
before_script:
- npm install karma-sauce-launcher
- "[ $DOWNGRADE = false ] || npm install rollup@1"
script:
- npm test
- "[ $EXTRA = false ] || npm run test-browser"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/underscore/blob/master/modules/index.js).

* In your pull request, do not add documentation or re-build the minified `underscore-min.js` file. We'll do those things before cutting a new release.
* In your pull request, do not add documentation or re-build the minified `underscore-umd-min.js` file. We'll do those things before cutting a new release.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "underscore",
"main": "underscore.js",
"main": "underscore-umd.js",
"keywords": ["util", "functional", "server", "client", "browser"],
"ignore" : ["docs", "test", "*.yml", "CNAME", "index.html", "favicon.ico", "CONTRIBUTING.md", ".*", "package.json", "karma.*"]
}
2 changes: 1 addition & 1 deletion docs/modules/_setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ <h1>_setup.js</h1>

</div>

<div class="content"><div class='highlight'><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">var</span> VERSION = <span class="hljs-string">'1.12.1'</span>;</pre></div></div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">var</span> VERSION = <span class="hljs-string">'1.13.0-3'</span>;</pre></div></div>

</li>

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ <h1 id="named-exports">Named Exports</h1>
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">&#182;</a>
</div>
<pre><code>Underscore.js <span class="hljs-number">1.12</span><span class="hljs-number">.1</span>
<pre><code>Underscore.js <span class="hljs-number">1.13</span><span class="hljs-number">.0</span><span class="hljs-number">-3</span>
<span class="hljs-attr">https</span>:<span class="hljs-comment">//underscorejs.org</span>
(c) <span class="hljs-number">2009</span><span class="hljs-number">-2020</span> Jeremy Ashkenas, DocumentCloud and Investigative Reporters &amp; Editors
Underscore may be freely distributed under the MIT license.</code></pre>
Expand Down
124 changes: 62 additions & 62 deletions docs/underscore-esm.html

Large diffs are not rendered by default.

126 changes: 94 additions & 32 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<div id="sidebar" class="interface">

<a class="toc_title" href="#">
Underscore.js <span class="version">(1.12.1)</span>
Underscore.js <span class="version">(1.13.0-3)</span>
</a>
<ul class="toc_section">
<li>&raquo; <a href="https://github.com/jashkenas/underscore">GitHub Repository</a></li>
Expand Down Expand Up @@ -442,23 +442,20 @@
</p>

<p>
You may choose between monolithic and modular imports. There is a quick
summary of the options below, as well as a more comprehensive
discussion in <a
href="https://juliangonggrijp.com/article/introducing-modular-underscore.html"
>the article</a>.
You may choose between monolithic and modular imports. There is a quick
summary of the options below, as well as a more comprehensive
discussion in <a
href="https://juliangonggrijp.com/article/introducing-modular-underscore.html"
>the article</a>.
</p>

<p>
<i><a
href="https://cdn.statically.io/gh/jashkenas/underscore/1.13.0-1/index.html"
>Prerelease version 1.13.0-1</a> adds full support for native ESM
imports in Node.js version 12 and later. It should do this without
breaking existing setups. Please try it out by installing
<i>Prerelease version 1.13.0-1 adds full support for native ESM imports
in Node.js version 12 and later. It should do this without breaking
existing setups. Please try it out by installing
<tt>underscore@preview</tt> from NPM and let us know whether it worked
for you in <a
href="https://github.com/jashkenas/underscore/pull/2914"
>the pull request</a>!</i>
for you in <a href="https://github.com/jashkenas/underscore/pull/2914">the
pull request</a>!</i>
</p>

<p>
Expand Down Expand Up @@ -486,7 +483,7 @@
<i>Underscore is an open-source component of <a href="https://documentcloud.org/">DocumentCloud</a>.</i>
</p>

<h2>v1.12.1 Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and use "Save As")</i></h2>
<h2>v1.13.0-3 Downloads <i style="padding-left: 12px; font-size:12px;">(Right-click, and use "Save As")</i></h2>

<table>
<tr>
Expand All @@ -504,17 +501,17 @@ <h2>v1.12.1 Downloads <i style="padding-left: 12px; font-size:12px;">(Right-clic
</td>
</tr>
<tr>
<td class="dl-link"><a href="underscore.js">UMD (Development)</a></td>
<td class="dl-link"><a href="underscore-umd.js">UMD (Development)</a></td>
<td>
<i>67.45kb, Uncompressed with Bountiful Comments</i>
&nbsp;<small>(<a href="underscore.js.map">Source Map</a>)</small>
&nbsp;<small>(<a href="underscore-umd.js.map">Source Map</a>)</small>
</td>
</tr>
<tr>
<td class="dl-link"><a href="underscore-min.js">UMD (Production)</a></td>
<td class="dl-link"><a href="underscore-umd-min.js">UMD (Production)</a></td>
<td>
<i>7.39kb, Minified and Gzipped</i>
&nbsp;<small>(<a href="underscore-min.js.map">Source Map</a>)</small>
&nbsp;<small>(<a href="underscore-umd-min.js.map">Source Map</a>)</small>
</td>
</tr>
<tr>
Expand All @@ -525,37 +522,37 @@ <h2>v1.12.1 Downloads <i style="padding-left: 12px; font-size:12px;">(Right-clic
<td><i>Unreleased, current <tt>master</tt>, use by your own judgement and at your own risk</i></td>
</tr>
<tr>
<td class="dl-link"><a href="https://raw.github.com/jashkenas/underscore/master/underscore.js">Edge UMD</a></td>
<td class="dl-link"><a href="https://raw.github.com/jashkenas/underscore/master/underscore-umd.js">Edge UMD</a></td>
<td><i>Unreleased, current <tt>master</tt>, use if you’re feeling lucky</i></td>
</tr>
</table>

<h2>v1.12.1 CDN URLs <i style="padding-left: 12px; font-size:12px;">(Use with <tt>&lt;script src="..."&gt;&lt;/script&gt;</tt>)</i></h2>
<h2>v1.13.0-3 CDN URLs <i style="padding-left: 12px; font-size:12px;">(Use with <tt>&lt;script src="..."&gt;&lt;/script&gt;</tt>)</i></h2>

<ul>
<li>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.12.1/underscore-min.js</tt>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.13.0-3/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.12.1/underscore-esm-min.js</tt>
<tt>https://cdn.jsdelivr.net/npm/underscore@1.13.0-3/underscore-esm-min.js</tt>
</li>
<li>
<tt>https://unpkg.com/underscore@1.12.1/underscore-min.js</tt>
<tt>https://unpkg.com/underscore@1.13.0-3/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://unpkg.com/underscore@1.12.1/underscore-esm-min.js</tt>
<tt>https://unpkg.com/underscore@1.13.0-3/underscore-esm-min.js</tt>
</li>
<li>
<tt>https://pagecdn.io/lib/underscore/1.12.1/underscore-min.js</tt>
<tt>https://pagecdn.io/lib/underscore/1.13.0-3/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://pagecdn.io/lib/underscore/1.12.1/underscore-esm-min.js</tt>
<tt>https://pagecdn.io/lib/underscore/1.13.0-3/underscore-esm-min.js</tt>
</li>
<li>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.12.1/underscore-min.js</tt>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.0-3/underscore-umd-min.js</tt>
</li>
<li>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.12.1/underscore-esm-min.js</tt>
<tt>https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.0-3/underscore-esm-min.js</tt>
</li>
</ul>

Expand All @@ -573,7 +570,7 @@ <h2>Package Installation</h2>
</li>
</ul>

<h2>Monolithic Import</h2>
<h2>Monolithic Import (recommended)</h2>

<ul>
<li>
Expand All @@ -586,7 +583,7 @@ <h2>Monolithic Import</h2>
<b>CommonJS</b> <tt>var _ = require('underscore');</tt>
</li>
<li>
<b>ExtendScript</b> <tt>#include "underscore.js"</tt>
<b>ExtendScript</b> <tt>#include "underscore-umd.js"</tt>
</li>
</ul>

Expand Down Expand Up @@ -2715,6 +2712,31 @@ <h2 id="notes">Notes</h2>

<h2 id="changelog">Change Log</h2>

<p id="1.13.0-3">
<b class="header">1.13.0-3</b> &mdash; <small><i>March 31, 2021</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.13.0-2...1.13.0-3">Diff</a> &mdash; <a href="https://cdn.rawgit.com/jashkenas/underscore/1.13.0-3/index.html">Docs</a><br />
<ul>
<li>
Adds a <tt>"module"</tt> exports condition to the
<tt>package.json</tt>, which should theoretically help to avoid
duplicate code bundling with <tt>exports</tt>-aware build tools.
</li>
<li>
Re-synchronizes some comments and documentation text with the
1.12.x branch.
</li>
</ul>
</p>

<p id="1.13.0-2">
<b class="header">1.13.0-2</b> &mdash; <small><i>March 15, 2021</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.13.0-1...1.13.0-2">Diff</a> &mdash; <a href="https://cdn.rawgit.com/jashkenas/underscore/1.13.0-2/index.html">Docs</a><br />
<ul>
<li>
Fixes the same security issue in <tt>_.template</tt> as the
parallel 1.12.1 release.
</li>
</ul>
</p>

<p id="1.12.1">
<b class="header">1.12.1</b> &mdash; <small><i>March 15, 2021</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.12.0...1.12.1">Diff</a> &mdash; <a href="https://cdn.statically.io/gh/jashkenas/underscore/1.12.1/index.html">Docs</a><br />
<ul>
Expand All @@ -2728,6 +2750,46 @@ <h2 id="changelog">Change Log</h2>
href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23358"
>CVE-2021-23358</a>
</li>
<li>
Restores an optimization in <tt>_.debounce</tt> that was
unintentionally lost in version 1.9.0 (same as in parallel preview
release 1.13.0-0).
</li>
<li>
Various test and documentation enhancements (same as in parallel
preview releases 1.13.0-0 and 1.13.0-1).
</li>
</ul>
</p>

<p id="1.13.0-1">
<b class="header">1.13.0-1</b> &mdash; <small><i>March 11, 2021</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.13.0-0...1.13.0-1">Diff</a> &mdash; <a href="https://cdn.rawgit.com/jashkenas/underscore/1.13.0-1/index.html">Docs</a><br />
<ul>
<li>
Fixes an issue that caused aliases to be absent among the named
exports in the new native ESM entry point for Node.js 12+.
</li>
<li>
More test and documentation fixes and enhancements.
</li>
</ul>
</p>

<p id="1.13.0-0">
<b class="header">1.13.0-0</b> &mdash; <small><i>March 9, 2021</i></small> &mdash; <a href="https://github.com/jashkenas/underscore/compare/1.12.0...1.13.0-0">Diff</a> &mdash; <a href="https://cdn.rawgit.com/jashkenas/underscore/1.13.0-0/index.html">Docs</a><br />
<ul>
<li>
Adds experimental support for native ESM imports in Node.js. You
can now also do named imports or even deep module imports directly
from a Node.js process in Node.js version 12 and later. Monolithic
imports are recommended for use in production. State (such as
mixed-in functions) is shared between CommonJS and ESM consumers.
</li>
<li>
Renames the UMD bundle to <tt>underscore-umd.js</tt> for
consistency with the other bundle names. An alias named
<tt>underscore.js</tt> is retained for backwards compatibility.
</li>
<li>
Restores an optimization in <tt>_.debounce</tt> that was
unintentionally lost in version 1.9.0.
Expand Down Expand Up @@ -3938,7 +4000,7 @@ <h2 id="changelog">Change Log</h2>
</div>

<!-- Include Underscore, so you can play with it in the console. -->
<script type="text/javascript" src="underscore.js"></script>
<script type="text/javascript" src="underscore-umd.js"></script>
<script type="text/javascript" src="docs/main.js"></script>

</body>
Expand Down
2 changes: 1 addition & 1 deletion karma.conf-sauce.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = function(config) {
files: [
'test/vendor/qunit-extras.js',
'test/qunit-setup.js',
'underscore.js',
'underscore-umd.js',
'test/*.js'
],

Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
'test/qunit-setup.js',
'underscore.js',
'underscore-umd.js',
'test/*.js'
],

Expand Down
2 changes: 1 addition & 1 deletion modules/_setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Current version.
export var VERSION = '1.12.1';
export var VERSION = '1.13.0-3';

// Establish the root object, `window` (`self`) in the browser, `global`
// on the server, or `this` in some virtual machines. We use `self`
Expand Down
2 changes: 1 addition & 1 deletion modules/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Named Exports
// =============

// Underscore.js 1.12.1
// Underscore.js 1.13.0-3
// https://underscorejs.org
// (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
Expand Down
3 changes: 3 additions & 0 deletions modules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}

0 comments on commit ac4afe3

Please sign in to comment.