Skip to content

Commit

Permalink
exports for dist folder in package.json, change esm extension to .mjs
Browse files Browse the repository at this point in the history
Refs #3239
  • Loading branch information
mikekucera committed Apr 24, 2024
1 parent 59f83e2 commit 550a8a7
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/cytoscape.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31266,7 +31266,7 @@ sheetfn.appendToStyle = function (style) {
return style;
};

var version = "3.29.0";
var version = "3.29.1";

var cytoscape = function cytoscape(options) {
// if no options specified, use default
Expand Down
2 changes: 1 addition & 1 deletion dist/cytoscape.esm.min.js → dist/cytoscape.esm.min.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cytoscape.esm.js → dist/cytoscape.esm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31264,7 +31264,7 @@ sheetfn.appendToStyle = function (style) {
return style;
};

var version = "3.29.0";
var version = "3.29.1";

var cytoscape = function cytoscape(options) {
// if no options specified, use default
Expand Down
2 changes: 1 addition & 1 deletion dist/cytoscape.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cytoscape.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -31270,7 +31270,7 @@ var printLayoutInfo;
return style;
};

var version = "3.29.0";
var version = "3.29.1";

var cytoscape = function cytoscape(options) {
// if no options specified, use default
Expand Down
6 changes: 3 additions & 3 deletions documentation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@ <h2 id="getting-started/including-cytoscape.js">Including Cytoscape.js <a href="
</code></pre>
<p>or</p>
<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">
<span class="hljs-keyword">import</span> cytoscape <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;./cytoscape.esm.min.js&quot;</span>;
<span class="hljs-keyword">import</span> cytoscape <span class="hljs-keyword">from</span> <span class="hljs-string">&quot;./cytoscape.esm.min.mjs&quot;</span>;
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
<p>To use Cytoscape.js from a Content Delivery Network (<a href="https://en.wikipedia.org/wiki/Content_delivery_network">CDN</a>),
Expand Down Expand Up @@ -2053,7 +2053,7 @@ <h2 id="getting-started/including-cytoscape.js">Including Cytoscape.js <a href="
<td>For debugging with globals or <code>require()</code>.</td>
</tr>
<tr>
<td><code>cytoscape.esm.min.js</code></td>
<td><code>cytoscape.esm.min.mjs</code></td>
<td>yes</td>
<td><a href="https://nodejs.org/api/esm.html#introduction">ESM</a> <small>(ECMAScript, uses <code>import</code> / <code>export</code>)</small></td>
<td>For use with modern <code>import</code>/<code>export</code>, i.e. <code>import cytoscape from &#39;cytoscape&#39;</code>.</td>
Expand All @@ -2065,7 +2065,7 @@ <h2 id="getting-started/including-cytoscape.js">Including Cytoscape.js <a href="
<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>
</tr>
<tr>
<td><code>cytoscape.esm.js</code></td>
<td><code>cytoscape.esm.mjs</code></td>
<td>no</td>
<td><a href="https://nodejs.org/api/esm.html#introduction">ESM</a></td>
<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>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@
"node": ">=0.10"
},
"main": "dist/cytoscape.cjs.js",
"module": "dist/cytoscape.esm.js",
"module": "dist/cytoscape.esm.mjs",
"exports": {
".": {
"import": "./dist/cytoscape.esm.js",
"import": "./dist/cytoscape.esm.mjs",
"require": "./dist/cytoscape.cjs.js"
},
"./dist/cytoscape.esm": {
"import": "./dist/cytoscape.esm.mjs"
},
"./dist/cytoscape.esm.min": {
"import": "./dist/cytoscape.esm.min.mjs"
},
"./dist/*": {
"import": "./dist/*.js",
"require": "./dist/*.js"
}
},
"unpkg": "dist/cytoscape.min.js",
Expand All @@ -50,7 +60,7 @@
"build:min": "cross-env FILE=min rollup -c",
"clean": "rimraf build/*",
"copyright": "node -r esm license-update",
"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",
"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",
"dist": "cross-env NODE_ENV=production run-s build dist:*",
"release": "run-s copyright dist docs",
"watch": "run-s watch:fast",
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const configs = [
{
input,
output: {
file: 'build/cytoscape.esm.min.js',
file: 'build/cytoscape.esm.min.mjs',
format: 'es'
},
plugins: [
Expand All @@ -104,7 +104,7 @@ const configs = [

{
input,
output: { file: 'build/cytoscape.esm.js', format: 'es' },
output: { file: 'build/cytoscape.esm.mjs', format: 'es' },
plugins: [
nodeResolve(),
commonjs({ include: '**/node_modules/**' }),
Expand All @@ -116,5 +116,5 @@ const configs = [
];

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

0 comments on commit 550a8a7

Please sign in to comment.