Skip to content

Commit 550a8a7

Browse files
committed
exports for dist folder in package.json, change esm extension to .mjs
Refs #3239
1 parent 59f83e2 commit 550a8a7

9 files changed

+26
-16
lines changed

Diff for: dist/cytoscape.cjs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31266,7 +31266,7 @@ sheetfn.appendToStyle = function (style) {
3126631266
return style;
3126731267
};
3126831268

31269-
var version = "3.29.0";
31269+
var version = "3.29.1";
3127031270

3127131271
var cytoscape = function cytoscape(options) {
3127231272
// if no options specified, use default

Diff for: dist/cytoscape.esm.min.js renamed to dist/cytoscape.esm.min.mjs

+1-1
Large diffs are not rendered by default.

Diff for: dist/cytoscape.esm.js renamed to dist/cytoscape.esm.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31264,7 +31264,7 @@ sheetfn.appendToStyle = function (style) {
3126431264
return style;
3126531265
};
3126631266

31267-
var version = "3.29.0";
31267+
var version = "3.29.1";
3126831268

3126931269
var cytoscape = function cytoscape(options) {
3127031270
// if no options specified, use default

Diff for: dist/cytoscape.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/cytoscape.umd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31270,7 +31270,7 @@ var printLayoutInfo;
3127031270
return style;
3127131271
};
3127231272

31273-
var version = "3.29.0";
31273+
var version = "3.29.1";
3127431274

3127531275
var cytoscape = function cytoscape(options) {
3127631276
// if no options specified, use default

Diff for: documentation/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ <h2 id="getting-started/including-cytoscape.js">Including Cytoscape.js <a href="
20192019
</code></pre>
20202020
<p>or</p>
20212021
<pre><code class="language-html"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;module&quot;</span>&gt;</span><span class="javascript">
2022-
<span class="hljs-keyword">import</span> cytoscape <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;./cytoscape.esm.min.js&quot;</span>;
2022+
<span class="hljs-keyword">import</span> cytoscape <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;./cytoscape.esm.min.mjs&quot;</span>;
20232023
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
20242024
</code></pre>
20252025
<p>To use Cytoscape.js from a Content Delivery Network (<a href="https://en.wikipedia.org/wiki/Content_delivery_network">CDN</a>),
@@ -2053,7 +2053,7 @@ <h2 id="getting-started/including-cytoscape.js">Including Cytoscape.js <a href="
20532053
<td>For debugging with globals or <code>require()</code>.</td>
20542054
</tr>
20552055
<tr>
2056-
<td><code>cytoscape.esm.min.js</code></td>
2056+
<td><code>cytoscape.esm.min.mjs</code></td>
20572057
<td>yes</td>
20582058
<td><a href="https://nodejs.org/api/esm.html#introduction">ESM</a> <small>(ECMAScript, uses <code>import</code> / <code>export</code>)</small></td>
20592059
<td>For use with modern <code>import</code>/<code>export</code>, i.e. <code>import cytoscape from &#39;cytoscape&#39;</code>.</td>
@@ -2065,7 +2065,7 @@ <h2 id="getting-started/including-cytoscape.js">Including Cytoscape.js <a href="
20652065
<td>Intended to be consumed automatically by <a href="https://en.wikipedia.org/wiki/Node.js">Node.js</a> or a bundler like <a href="https://webpack.js.org/">Webpack</a> via <code>require(&#39;cytoscape&#39;)</code>.</td>
20662066
</tr>
20672067
<tr>
2068-
<td><code>cytoscape.esm.js</code></td>
2068+
<td><code>cytoscape.esm.mjs</code></td>
20692069
<td>no</td>
20702070
<td><a href="https://nodejs.org/api/esm.html#introduction">ESM</a></td>
20712071
<td>Intended to be consumed automatically by <a href="https://en.wikipedia.org/wiki/Node.js">Node.js</a> or a bundler like <a href="https://webpack.js.org/">Webpack</a> via <code>import cytoscape from &#39;cytoscape&#39;</code>. This file may alternatively be used for manually debugging ESM builds or pages that use ESM.</td>

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,21 @@
3131
"node": ">=0.10"
3232
},
3333
"main": "dist/cytoscape.cjs.js",
34-
"module": "dist/cytoscape.esm.js",
34+
"module": "dist/cytoscape.esm.mjs",
3535
"exports": {
3636
".": {
37-
"import": "./dist/cytoscape.esm.js",
37+
"import": "./dist/cytoscape.esm.mjs",
3838
"require": "./dist/cytoscape.cjs.js"
39+
},
40+
"./dist/cytoscape.esm": {
41+
"import": "./dist/cytoscape.esm.mjs"
42+
},
43+
"./dist/cytoscape.esm.min": {
44+
"import": "./dist/cytoscape.esm.min.mjs"
45+
},
46+
"./dist/*": {
47+
"import": "./dist/*.js",
48+
"require": "./dist/*.js"
3949
}
4050
},
4151
"unpkg": "dist/cytoscape.min.js",
@@ -50,7 +60,7 @@
5060
"build:min": "cross-env FILE=min rollup -c",
5161
"clean": "rimraf build/*",
5262
"copyright": "node -r esm license-update",
53-
"dist:copy": "cpy build/cytoscape.umd.js build/cytoscape.min.js build/cytoscape.cjs.js build/cytoscape.esm.js build/cytoscape.esm.min.js dist",
63+
"dist:copy": "cpy build/cytoscape.umd.js build/cytoscape.min.js build/cytoscape.cjs.js build/cytoscape.esm.mjs build/cytoscape.esm.min.mjs dist",
5464
"dist": "cross-env NODE_ENV=production run-s build dist:*",
5565
"release": "run-s copyright dist docs",
5666
"watch": "run-s watch:fast",

Diff for: rollup.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const configs = [
7777
{
7878
input,
7979
output: {
80-
file: 'build/cytoscape.esm.min.js',
80+
file: 'build/cytoscape.esm.min.mjs',
8181
format: 'es'
8282
},
8383
plugins: [
@@ -104,7 +104,7 @@ const configs = [
104104

105105
{
106106
input,
107-
output: { file: 'build/cytoscape.esm.js', format: 'es' },
107+
output: { file: 'build/cytoscape.esm.mjs', format: 'es' },
108108
plugins: [
109109
nodeResolve(),
110110
commonjs({ include: '**/node_modules/**' }),
@@ -116,5 +116,5 @@ const configs = [
116116
];
117117

118118
export default FILE
119-
? configs.filter(config => config.output.file.endsWith(FILE + '.js'))
119+
? configs.filter(config => config.output.file.endsWith(FILE + '.js') || config.output.file.endsWith(FILE + '.mjs'))
120120
: configs;

0 commit comments

Comments
 (0)