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 86af5de commit 12f6335
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 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 = "snapshot";
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 = "snapshot";
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 = "snapshot";
var version = "3.29.1";

var cytoscape = function cytoscape(options) {
// if no options specified, use default
Expand Down
2 changes: 1 addition & 1 deletion 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 12f6335

Please sign in to comment.