Files
svgedit/rollup.config.js
JFH 1af0cd0572 V7 preview (#480)
* #issue-fix The new menu will ask if you want to erase the current content but it will ignore the answer

* #issue-fix  dialog needs to be closer than the original

* #issue-fix main menu alignment changes

* #issue_fix double click and opensvg issue fixed

* #issue-fix process_cancel change to seConfirm

* #issue-fix review how the top toolbar display when many buttons are displayed

* #issue-fix unwanted css reoved

* #issue-fix BOTTOM TOOLS Make sure all features of the bottom toolbar are working

* #issue-fix IMPORT IMAGE menu open issue fixed

* #issue-fix alert dialog overwrite style

* #issue-fix lint issue fixed

* npm update + associated fixes

* #36 look of opacity button should like the zoom button (without the dropdown button)

* #37 Clicking anywhere on the bottom bar (for example below the opacity button is displaying the “color popup”.)

* #38 The opacity button does not update with the current element

* #42 When you import an image, it works well but the dialog should disappear automatically

* Fixes #53: 4th option for the background display fixed

* Fixes #53: 4th option for the background fixed

* #49 the x button does not work

* Fixes #41: Alignment fixes in bottom bar

* fix test scenario

* #39 opacity button/stroke size/radius button don’t allow the 0 value

* #41 The look and alignment of stroke size and stroke style should be consistent with the rest of the bottom bar.

* #44 Text font dropdown is broken

* #52 Fix the export

* Fixes #44: Text font dropdown fixed

* Fixes #44: Text font dropdown fixed

* Fixes #44: Text font dropdown fixed

* Fixes #44: Text font dropdown fixed

* Update index.html

* update husky

* fixes

* moves from index.html to js

* fix #66

* fix #48 first set of new icons

* Reorganize tools in left panel to be more intuitive

* Update button styles to adapt to new icons

* Fix #48 new set of icons for alignments

* Variabilisation of icon bkgd colors
Update of color choice to fit new icons design

* Update canvas and rulers colors

* Improve layer handle design

* Modernize SVG Logo but keeping original spirit

* Fix #48 continue improve icons

* Continue to reorganise left panel

* Update right panel handle for layers

* Fix #48 new set of icons for main menu

* Improve main menu design

* Rework menu organisation

* Rework menu organisation

* Update input element design

* New icons

* Improve Zoom Module

* Improve Color Picker Module

* New icons

* New icons

* #65 restore the feature of start/end marker lines partially did

* #64 The export dialog needs to include the quality options (except for PDF)

* #39 opacity button/stroke size/radius button don’t allow the 0 value

* #39 eslint changes

* #69 menu button style overwrite

* #65 restore the feature of start/end marker lines

* #43 With a small window, the look of the top toolbar is broken

* #43 tool top alignment revert

* #46 Move this jQuery component to a web component  for graduate and picker components

* #46 Move this jQuery component to a web component

* remove some non standard lint rules

* #46 picker convert as pure javascript changes

* #46 jquery plugin convert to pure javascript

* #46 jquery plugin change to pure javascript

* #46 jquery remove and convert to pure javascript

* #46 slider issue fixed

* #46 ColorValuePicker and js convertion

* #46 globals $ remov from slider class

* #46 jquery convert pure javascript changes

* #46 jquery to js convertion changes

* #46 paintbox and current element color set issue fixed

* #46 unwanted files removed

* #46 $.extend modify changes

* #46 extend modifiey changes

* #46 $.extend change to pure javascript

* #46 extend and data changes

* #46 jquery removed

* #45 These buttons don't work and dropdown is broken

* #45 These buttons don't work and dropdown is broken

* #45 These buttons don't work and dropdown is broken commit reverted

* #43 With a small window, the look of the top toolbar is broken

* Update jQuery.jPicker.js

* #76 draggable modification changes

* #76 jquery-ui-1.8.17.custom.min.js removed from editor

* #76 jquery ui file removed

* npm update

* #77 console issue fixed

* #77 <SVG> button issue fixed

* #77 shortkey issue fixed

* #77 jquery hotkeys plugin changes

* #77 hotkey plugin related changes

* #78 hotkey related code comment.

* #78 js-hotkeys/jquery.hotkeys.min.js file removed from svgedit.js

* #51 Rewrite the color palette without elix

* #81 unwanted files removed

* #81 folder name renamed

* #81 folder rename changes

* #81 jquery-ui  folder renamed

* #81 jquery modify changes

* #81 globals $ removed

Co-authored-by: Agriya Dev5 <agriya.dev5@agriya.in>
Co-authored-by: mathieucura <mathieu@optimistik.fr>
2021-03-05 12:45:07 +01:00

158 lines
5.0 KiB
JavaScript

/* eslint-env node */
// This rollup script is run by the command:
// 'npm run build'
import path from 'path';
import {lstatSync, readdirSync} from 'fs';
import rimraf from 'rimraf';
import babel from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import nodePolyfills from 'rollup-plugin-node-polyfills';
import url from '@rollup/plugin-url'; // for XML/SVG files
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars';
import {terser} from 'rollup-plugin-terser';
// import progress from 'rollup-plugin-progress';
import filesize from 'rollup-plugin-filesize';
// utility function
const getDirectories = (source) => {
const isDirectory = (dir) => {
return lstatSync(dir).isDirectory();
};
return readdirSync(source).map((nme) => path.join(source, nme)).filter((i) => isDirectory(i));
};
// capture the list of files to build for extensions and ext-locales
const extensionDirs = getDirectories('src/editor/extensions');
const dest = ['dist/editor', 'dist/editor/system'];
// remove existing distribution
// eslint-disable-next-line no-console
rimraf('./dist', () => console.info('recreating dist'));
// config for svgedit core module
const config = [{
input: ['src/editor/index.js'],
output: [
{
format: 'es',
inlineDynamicImports: true,
sourcemap: true,
file: 'dist/editor/index.js'
},
{
format: 'es',
inlineDynamicImports: true,
sourcemap: true,
file: 'dist/editor/xdomain-index.js',
intro: 'const XDOMAIN = true;'
},
{
format: 'system',
dir: 'dist/editor/system',
inlineDynamicImports: true
}
],
plugins: [
// progress(),
copy({
targets: [
{
src: 'src/editor/index.html',
dest: 'dist/editor'
},
{
src: 'src/editor/index.html',
dest: 'dist/editor',
rename: 'xdomain-index.html',
transform: (contents) => contents.toString()
.replace('<script type="module" src="index.js">', '<script type="module" src="xdomain-index.js">')
},
{
src: 'src/editor/index.html',
dest: ['dist/editor/system'],
rename: 'index.html',
transform: (contents) => contents.toString()
.replace('<script type="module" src="index.js">',
`<script>
const systemJsLoaderTag = document.createElement('script');
systemJsLoaderTag.src = './s.min.js';
systemJsLoaderTag.addEventListener('load', function () {
System.import('./index.js');
});
document.head.appendChild(systemJsLoaderTag);
`)
},
{
src: ['node_modules/systemjs/dist/s.min.js', 'node_modules/systemjs/dist/s.min.js.map'],
dest: 'dist/editor/system'
},
{src: 'src/editor/images', dest},
{src: 'src/editor/extensions/ext-shapes/shapelib', dest: dest.map((d) => `${d}/extensions/ext-shapes`)},
{src: 'src/editor/jgraduate', dest},
{src: 'src/editor/spinbtn', dest},
{src: 'src/editor/embedapi.html', dest},
{src: 'src/editor/embedapi.js', dest},
{src: 'src/editor/browser-not-supported.html', dest},
{src: 'src/editor/redirect-on-lacking-support.js', dest},
{src: 'src/editor/svgedit.css', dest}
]
}),
nodeResolve({
browser: true,
preferBuiltins: true
}),
commonjs(),
dynamicImportVars({include: `src/editor/locale.js`}),
babel({babelHelpers: 'bundled', exclude: [/\/core-js\//]}), // exclude core-js to avoid circular dependencies.
nodePolyfills(),
terser({keep_fnames: true}), // keep_fnames is needed to avoid an error when calling extensions.
filesize()
]
}];
// config for dynamic extensions
extensionDirs.forEach((extensionDir) => {
const extensionName = path.basename(extensionDir);
extensionName && config.push(
{
input: `./src/editor/extensions/${extensionName}/${extensionName}.js`,
output: [
{
format: 'es',
dir: `dist/editor/extensions/${extensionName}`,
inlineDynamicImports: true,
sourcemap: true
},
{
format: 'system',
dir: `dist/editor/system/extensions/${extensionName}`,
inlineDynamicImports: true
}
],
plugins: [
// progress(),
url({
include: ['**/*.svg', '**/*.png', '**/*.jpg', '**/*.gif', '**/*.xml'],
limit: 0,
fileName: '[name][extname]'
}),
nodeResolve({
browser: true,
preferBuiltins: true
}),
commonjs({exclude: `src/editor/extensions/${extensionName}/${extensionName}.js`}),
dynamicImportVars({include: `src/editor/extensions/${extensionName}/${extensionName}.js`}),
babel({babelHelpers: 'bundled', exclude: [/\/core-js\//]}),
nodePolyfills(),
terser({keep_fnames: true})
]
}
);
});
export default config;