Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 97 additions & 52 deletions .config/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,121 @@
import cleanup from 'rollup-plugin-cleanup';
import terser from '@rollup/plugin-terser';

export default [
{
input: 'src/jsmind.js',
output: {
const banner =
'/**\n* @license BSD-3-Clause\n* @copyright 2014-2025 [email protected]\n*\n* Project Home:\n* https://github.com/hizzgdev/jsmind/\n*/';

const cleanupPlugin = cleanup({
comments: 'none',
});

const terserPlugin = terser({
output: {
comments: 'all',
},
});

// Main library configuration
const mainConfig = {
input: 'src/jsmind.js',
output: [
// ES Module - for modern bundlers with tree-shaking support
{
file: 'es/jsmind.js',
format: 'es',
banner,
sourcemap: true,
},
// CommonJS - for require/legacy toolchains
{
file: 'lib/jsmind.js',
format: 'cjs',
banner,
sourcemap: true,
exports: 'auto',
},
// UMD - for direct <script> usage, exposes global jsMind
{
name: 'jsMind',
file: 'es6/jsmind.js',
file: 'dist/jsmind.js',
format: 'umd',
banner: '/**\n* @license BSD-3-Clause\n* @copyright 2014-2025 [email protected]\n*\n* Project Home:\n* https://github.com/hizzgdev/jsmind/\n*/',
banner,
sourcemap: true,
},
plugins: [
cleanup({
comments: 'none',
}),
terser({
output: {
comments: 'all',
},
}),
],
},
{
input: 'src/plugins/jsmind.draggable-node.js',
output: {
],
plugins: [cleanupPlugin, terserPlugin],
};

// Draggable-node plugin configuration
const draggableNodeConfig = {
input: 'src/plugins/jsmind.draggable-node.js',
output: [
// ES Module
{
file: 'es/jsmind.draggable-node.js',
format: 'es',
banner,
sourcemap: true,
},
// CommonJS
{
file: 'lib/jsmind.draggable-node.js',
format: 'cjs',
banner,
sourcemap: true,
exports: 'named',
},
// UMD
{
name: 'jsMindDraggableNode',
file: 'es6/jsmind.draggable-node.js',
file: 'dist/jsmind.draggable-node.js',
format: 'umd',
banner: '/**\n* @license BSD-3-Clause\n* @copyright 2014-2025 [email protected]\n*\n* Project Home:\n* https://github.com/hizzgdev/jsmind/\n*/',
banner,
sourcemap: true,
globals: {
jsmind: 'jsMind',
},
exports: 'named',
},
external: ['jsmind'],
plugins: [
cleanup({
comments: 'none',
}),
terser({
output: {
comments: 'all',
},
}),
],
},
{
input: 'src/plugins/jsmind.screenshot.js',
output: {
],
external: ['jsmind'],
plugins: [cleanupPlugin, terserPlugin],
};

// Screenshot plugin configuration
const screenshotConfig = {
input: 'src/plugins/jsmind.screenshot.js',
output: [
// ES Module
{
file: 'es/jsmind.screenshot.js',
format: 'es',
banner,
sourcemap: true,
},
// CommonJS
{
file: 'lib/jsmind.screenshot.js',
format: 'cjs',
banner,
sourcemap: true,
exports: 'named',
},
// UMD
{
name: 'jsMindScreenshot',
file: 'es6/jsmind.screenshot.js',
file: 'dist/jsmind.screenshot.js',
format: 'umd',
banner: '/**\n* @license BSD-3-Clause\n* @copyright 2014-2025 [email protected]\n*\n* Project Home:\n* https://github.com/hizzgdev/jsmind/\n*/',
banner,
sourcemap: true,
globals: {
'jsmind': 'jsMind',
'dom-to-image': 'domtoimage',
},
exports: 'named',
},
external: ['jsmind', 'dom-to-image'],
plugins: [
cleanup({
comments: 'none',
}),
terser({
output: {
comments: 'all',
},
}),
],
},
];
],
external: ['jsmind', 'dom-to-image'],
plugins: [cleanupPlugin, terserPlugin],
};

export default [mainConfig, draggableNodeConfig, screenshotConfig];
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
.DS_Store
node_modules/

# Build outputs
es/*.js
es/*.js.map
lib/*.js
lib/*.js.map
dist/*.js
dist/*.js.map
es6/*.js
es6/*.js.map
types/generated/
Expand Down
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
"name": "jsmind",
"version": "0.9.0",
"description": "jsMind is a pure javascript library for mindmap, it base on html5 canvas. jsMind was released under BSD license, you can embed it in any project, if only you observe the license.",
"main": "es6/jsmind.js",
"main": "lib/jsmind.js",
"module": "es/jsmind.js",
"unpkg": "dist/jsmind.js",
"types": "types/generated/index.d.ts",
"exports": {
".": {
"import": "./es6/jsmind.js",
"require": "./es6/jsmind.js",
"import": "./es/jsmind.js",
"require": "./lib/jsmind.js",
"types": "./types/generated/index.d.ts"
},
"./draggable-node": {
"import": "./es6/jsmind.draggable-node.js",
"require": "./es6/jsmind.draggable-node.js",
"import": "./es/jsmind.draggable-node.js",
"require": "./lib/jsmind.draggable-node.js",
"types": "./types/generated/plugins/jsmind.draggable-node.d.ts"
},
"./screenshot": {
"import": "./es6/jsmind.screenshot.js",
"require": "./es6/jsmind.screenshot.js",
"import": "./es/jsmind.screenshot.js",
"require": "./lib/jsmind.screenshot.js",
"types": "./types/generated/plugins/jsmind.screenshot.d.ts"
},
"./style/jsmind.css": "./style/jsmind.css"
Expand All @@ -27,7 +29,9 @@
"example": "example"
},
"files": [
"es6",
"es",
"lib",
"dist",
"style",
"types",
"LICENSE",
Expand Down
157 changes: 0 additions & 157 deletions tests/types/fixtures/optional-parameters-test.ts

This file was deleted.