- Fix more paths (Rollup, build, eslint) paths

- Restore checking of a few modified "external" packages
master
Brett Zamir 2020-07-18 19:21:41 +08:00
parent 0fc64b4912
commit 7100111d62
14 changed files with 18325 additions and 19746 deletions

View File

@ -25,7 +25,12 @@ src/editor/jspdf/underscore-min.js
src/editor/extensions/mathjax
# Todo: We should at least check `compat/compat` in our other files, however
src/external
## Two "external" items are modified locally, so we undo their ignoring
src/external/*
!src/external/dom-polyfill
src/external/dom-polyfill/*
!src/external/dom-polyfill/dom-polyfill.js
!src/external/dynamic-import-polyfill
mochawesome-report
releases

View File

@ -47,7 +47,7 @@ module.exports = {
'src/editor/typedefs.js',
'src/editor/redirect-on-no-module-support.js',
'src/editor/extensions/imagelib/index.js',
'src/editor/external/dom-polyfill/dom-polyfill.js',
'src/external/dom-polyfill/dom-polyfill.js',
'docs/screencasts/svgopen2010/script.js'
],
rules: {
@ -121,7 +121,7 @@ module.exports = {
// Dis-apply Node rules mistakenly giving errors with browser files,
// and treating Node global `root` as being present for shadowing
{
files: ['src/editor/**'],
files: ['src/editor/**', 'src/external/**'],
globals: {
root: 'off'
},

View File

@ -3,18 +3,18 @@ import fs from 'promise-fs';
const filesAndReplacements = [
{
input: 'editor/svg-editor-es.html',
output: 'editor/xdomain-svg-editor-es.html',
input: 'src/editor/svg-editor-es.html',
output: 'src/editor/xdomain-svg-editor-es.html',
replacements: [
[
'<script type="module" src="../svgedit-config-es.js"></script>',
'<script type="module" src="../../svgedit-config-es.js"></script>',
'<script type="module" src="xdomain-svgedit-config-es.js"></script>'
]
]
},
{
input: 'editor/xdomain-svg-editor-es.html',
output: 'editor/xdomain-svg-editor.html',
input: 'src/editor/xdomain-svg-editor-es.html',
output: 'src/editor/xdomain-svg-editor.html',
replacements: [
[
'<!DOCTYPE html>',
@ -23,15 +23,15 @@ const filesAndReplacements = [
],
[
'<script type="module" src="redirect-on-lacking-support.js"></script>',
'<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>'
'<script defer="defer" src="../../dist/redirect-on-lacking-support.js"></script>'
],
[
'<script type="module" src="xdomain-svgedit-config-es.js"></script>',
'<script defer="defer" src="xdomain-svgedit-config-iife.js"></script>'
],
[
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../dist/dom-polyfill.js"></script>'
'<script src="../external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../../dist/dom-polyfill.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
@ -41,8 +41,8 @@ const filesAndReplacements = [
},
// Now that file has copied, we can replace the DOCTYPE in xdomain
{
input: 'editor/xdomain-svg-editor-es.html',
output: 'editor/xdomain-svg-editor-es.html',
input: 'src/editor/xdomain-svg-editor-es.html',
output: 'src/editor/xdomain-svg-editor-es.html',
replacements: [
[
'<!DOCTYPE html>',
@ -52,8 +52,8 @@ const filesAndReplacements = [
]
},
{
input: 'editor/svg-editor-es.html',
output: 'editor/svg-editor.html',
input: 'src/editor/svg-editor-es.html',
output: 'src/editor/svg-editor.html',
replacements: [
[
'<!DOCTYPE html>',
@ -62,15 +62,15 @@ const filesAndReplacements = [
],
[
'<script type="module" src="redirect-on-lacking-support.js"></script>',
'<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>'
'<script defer="defer" src="../../dist/redirect-on-lacking-support.js"></script>'
],
[
'<script type="module" src="../svgedit-config-es.js"></script>',
'<script defer="defer" src="../svgedit-config-iife.js"></script>'
'<script type="module" src="../../svgedit-config-es.js"></script>',
'<script defer="defer" src="../../svgedit-config-iife.js"></script>'
],
[
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../dist/dom-polyfill.js"></script>'
'<script src="../external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../../dist/dom-polyfill.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
@ -79,8 +79,8 @@ const filesAndReplacements = [
]
},
{
input: 'editor/extensions/imagelib/openclipart-es.html',
output: 'editor/extensions/imagelib/openclipart.html',
input: 'src/editor/extensions/imagelib/openclipart-es.html',
output: 'src/editor/extensions/imagelib/openclipart.html',
replacements: [
[
'<!DOCTYPE html>',
@ -89,11 +89,11 @@ const filesAndReplacements = [
],
[
'<script src="../../external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../../../dist/dom-polyfill.js"></script>'
'<script src="../../../../dist/dom-polyfill.js"></script>'
],
[
'<script type="module" src="openclipart.js"></script>',
'<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>'
'<script defer="defer" src="../../../../dist/extensions/imagelib/openclipart.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',
@ -102,8 +102,8 @@ const filesAndReplacements = [
]
},
{
input: 'editor/extensions/imagelib/index-es.html',
output: 'editor/extensions/imagelib/index.html',
input: 'src/editor/extensions/imagelib/index-es.html',
output: 'src/editor/extensions/imagelib/index.html',
replacements: [
[
'<!DOCTYPE html>',
@ -112,7 +112,7 @@ const filesAndReplacements = [
],
[
'<script type="module" src="index.js"></script>',
'<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>'
'<script defer="defer" src="../../../../dist/extensions/imagelib/index.js"></script>'
],
[
'<script nomodule="" src="redirect-on-no-module-support.js"></script>',

View File

@ -61,7 +61,7 @@ module.exports = {
'cypress',
'node_modules',
'dist',
'editor/external',
'external',
'screencasts',
'test'
],

View File

@ -11,11 +11,11 @@
"deparam"
],
"filesByLicense": {
"(MIT OR GPL-2.0)": ["editor/jquery-ui/jquery-ui-1.8.17.custom.min.js", "editor/jquerybbq/jquery.bbq.min.js", "editor/js-hotkeys/jquery.hotkeys.min.js"],
"(MIT OR GPL-2.0-or-later)": ["editor/contextmenu/jQuery.contextMenu.js", "editor/extensions/ext-server_moinsave.js"],
"Apache-2.0": ["editor/contextmenu.js", "editor/extensions/ext-foreignobject.js", "editor/extensions/ext-grid.js", "editor/extensions/ext-markers.js", "screencasts/svgopen2010/index.html", "editor/jgraduate/jQuery.jGraduate.js", "editor/extensions/mathjax/MathJax.min.js", "editor/extensions/mathjax/TeX-AMS-MML_SVG.js"],
"ISC": ["editor/external/query-result/esm/index.js"],
"LGPL-3.0-or-later": ["editor/jspdf/jspdf.plugin.svgToPdf.js"],
"X11": ["editor/jspdf/jspdf.min.js"]
"(MIT OR GPL-2.0)": ["src/editor/jquery-ui/jquery-ui-1.8.17.custom.min.js", "src/editor/jquerybbq/jquery.bbq.min.js", "src/editor/js-hotkeys/jquery.hotkeys.min.js"],
"(MIT OR GPL-2.0-or-later)": ["src/editor/contextmenu/jQuery.contextMenu.js", "src/editor/extensions/ext-server_moinsave.js"],
"Apache-2.0": ["src/editor/contextmenu.js", "src/editor/extensions/ext-foreignobject.js", "src/editor/extensions/ext-grid.js", "src/editor/extensions/ext-markers.js", "screencasts/svgopen2010/index.html", "src/editor/jgraduate/jQuery.jGraduate.js", "src/editor/extensions/mathjax/MathJax.min.js", "src/editor/extensions/mathjax/TeX-AMS-MML_SVG.js"],
"ISC": ["external/query-result/esm/index.js"],
"LGPL-3.0-or-later": ["src/editor/jspdf/jspdf.plugin.svgToPdf.js"],
"X11": ["src/editor/jspdf/jspdf.min.js"]
}
}

View File

@ -40,9 +40,9 @@
"open-cov-no-start": "open-cli http://localhost:8000/coverage/",
"open-cov": "run-p start open-cov-no-start",
"instrument:replace-html": "frs-replace \"../svgedit-config-es.js\" \"svgedit-config-es.js\" -i instrumented/svg-editor-es.html -o instrumented/svg-editor-es.html",
"instrument:replace-js": "frs-replace \"editor/svg-editor.js\" \"svg-editor.js\" -i svgedit-config-es.js -o instrumented/svgedit-config-es.js",
"instrument:replace-js": "frs-replace \"src/editor/svg-editor.js\" \"svg-editor.js\" -i svgedit-config-es.js -o instrumented/svgedit-config-es.js",
"instrument:copy-excluded": "node cypress/support/copy.js",
"copy-instrumented": "copyfiles -e \"**/*.js\" -u 1 \"editor/**/*\" instrumented && npm run instrument:replace-html && npm run instrument:replace-js && npm run instrument:copy-excluded",
"copy-instrumented": "copyfiles -e \"**/*.js\" -u 1 \"src/editor/**/*\" instrumented && npm run instrument:replace-html && npm run instrument:replace-js && npm run instrument:copy-excluded",
"instrument": "rimraf instrumented && nyc instrument editor instrumented && npm run copy-instrumented",
"report": "run-s report-no-mochawesome mochawesome-cli",
"report-summary": "run-s report-text-summary mochawesome-cli-dot",
@ -50,8 +50,8 @@
"license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
"license-badges": "run-s license-badge license-badge-dev",
"coverage-badge": "coveradge badges/coverage-badge",
"compress-images": "imageoptim \"editor/extensions/*.png\" \"editor/spinbtn/*.png\" \"editor/jgraduate/images/*.{png,gif}\" \"editor/images/*.png\"",
"copy": "copyfiles -f node_modules/load-stylesheets/dist/index-es.js editor/external/load-stylesheets && copyfiles -f node_modules/jamilih/dist/jml-es.js editor/external/jamilih && copyfiles -f node_modules/query-result/esm/index.js editor/external/query-result/esm && copyfiles -f node_modules/qr-manipulation/dist/index-es.js editor/external/qr-manipulation/dist && copyfiles -f node_modules/stackblur-canvas/dist/stackblur-es.js editor/external/stackblur-canvas/dist && copyfiles -f node_modules/regenerator-runtime/runtime.js editor/external/regenerator-runtime && copyfiles -f \"node_modules/core-js-bundle//minified*\" editor/external/core-js-bundle && copyfiles -f \"node_modules/underscore/underscore-*\" editor/jspdf && copyfiles -f \"node_modules/deparam/dist/deparam.esm.js\" editor/external/deparam",
"compress-images": "imageoptim \"src/editor/extensions/*.png\" \"src/editor/spinbtn/*.png\" \"src/editor/jgraduate/images/*.{png,gif}\" \"src/editor/images/*.png\"",
"copy": "copyfiles -f node_modules/load-stylesheets/dist/index-es.js src/external/load-stylesheets && copyfiles -f node_modules/jamilih/dist/jml-es.js editor/external/jamilih && copyfiles -f node_modules/query-result/esm/index.js editor/external/query-result/esm && copyfiles -f node_modules/qr-manipulation/dist/index-es.js editor/external/qr-manipulation/dist && copyfiles -f node_modules/stackblur-canvas/dist/stackblur-es.js editor/external/stackblur-canvas/dist && copyfiles -f node_modules/regenerator-runtime/runtime.js editor/external/regenerator-runtime && copyfiles -f \"node_modules/core-js-bundle//minified*\" editor/external/core-js-bundle && copyfiles -f \"node_modules/underscore/underscore-*\" editor/jspdf && copyfiles -f \"node_modules/deparam/dist/deparam.esm.js\" editor/external/deparam",
"remark": "remark -q -f .",
"build-html": "babel-node --plugins @babel/plugin-transform-modules-commonjs build/build-html.js",
"eslint-fix": "eslint --cache --fix --ext js,md,html .",
@ -83,13 +83,13 @@
},
"nyc": {
"exclude": [
"editor/external/**",
"editor/jquery.min.js",
"editor/jquery-ui/**",
"editor/js-hotkeys/**",
"editor/jspdf/jspdf.min.js",
"editor/jspdf/underscore-min.js",
"editor/spinbtn/**"
"src/external/**",
"src/editor/jquery.min.js",
"src/editor/jquery-ui/**",
"src/editor/js-hotkeys/**",
"src/editor/jspdf/jspdf.min.js",
"src/editor/jspdf/underscore-min.js",
"src/editor/spinbtn/**"
],
"reporter": [
"json-summary",

View File

@ -45,10 +45,10 @@ export default [
plugins
},
{
input: 'editor/xdomain-svgedit-config-es.js',
input: 'src/editor/xdomain-svgedit-config-es.js',
output: {
format: 'iife',
file: 'editor/xdomain-svgedit-config-iife.js'
file: 'src/editor/xdomain-svgedit-config-iife.js'
},
plugins
}

View File

@ -10,8 +10,8 @@ import babel from '@rollup/plugin-babel';
import {terser} from 'rollup-plugin-terser';
import replace from 'rollup-plugin-re';
const localeFiles = readdirSync('editor/locale');
const extensionFiles = readdirSync('editor/extensions');
const localeFiles = readdirSync('src/editor/locale');
const extensionFiles = readdirSync('src/editor/extensions');
const isDirectory = (source) => {
return lstatSync(source).isDirectory();
@ -19,7 +19,7 @@ const isDirectory = (source) => {
const getDirectories = (source) => {
return readdirSync(source).map((nme) => join(source, nme)).filter((i) => isDirectory(i));
};
const extensionLocaleDirs = getDirectories('editor/extensions/ext-locale');
const extensionLocaleDirs = getDirectories('src/editor/extensions/ext-locale');
const extensionLocaleFiles = [];
extensionLocaleDirs.forEach((dir) => {
readdirSync(dir).forEach((file) => {
@ -41,7 +41,7 @@ extensionLocaleDirs.forEach((dir) => {
*/
function getRollupObject ({minifying, format = 'umd'} = {}) {
const nonMinified = {
input: 'editor/svg-editor.js',
input: 'src/editor/svg-editor.js',
output: {
format,
sourcemap: minifying,
@ -78,7 +78,7 @@ export default [
// **/
...[true, false].map((min) => {
return {
input: 'editor/svgcanvas.js',
input: 'src/svgcanvas/svgcanvas.js',
output: {
format: 'iife',
sourcemap: min,
@ -109,7 +109,7 @@ export default [
};
}),
{
input: 'editor/redirect-on-lacking-support.js',
input: 'src/editor/redirect-on-lacking-support.js',
output: {
format: 'iife',
file: 'dist/redirect-on-lacking-support.js'
@ -119,7 +119,7 @@ export default [
})]
},
{
input: 'editor/jspdf/jspdf.plugin.svgToPdf.js',
input: 'src/editor/jspdf/jspdf.plugin.svgToPdf.js',
output: {
format: 'iife',
file: 'dist/jspdf.plugin.svgToPdf.js'
@ -129,7 +129,7 @@ export default [
})]
},
{
input: 'editor/extensions/imagelib/index.js',
input: 'src/editor/extensions/imagelib/index.js',
output: {
format: 'iife',
file: 'dist/extensions/imagelib/index.js'
@ -142,7 +142,7 @@ export default [
]
},
{
input: 'editor/extensions/imagelib/openclipart.js',
input: 'src/editor/extensions/imagelib/openclipart.js',
output: {
format: 'iife',
file: 'dist/extensions/imagelib/openclipart.js'
@ -155,7 +155,7 @@ export default [
]
},
{
input: 'editor/external/dom-polyfill/dom-polyfill.js',
input: 'src/external/dom-polyfill/dom-polyfill.js',
output: {
format: 'iife',
file: 'dist/dom-polyfill.js'
@ -165,7 +165,7 @@ export default [
})]
},
{
input: 'editor/canvg/canvg.js',
input: 'src/editor/canvg/canvg.js',
output: {
format: 'iife',
name: 'canvg',
@ -183,7 +183,7 @@ export default [
return undefined;
}
return {
input: 'editor/locale/' + localeFile,
input: 'src/editor/locale/' + localeFile,
output: {
format: 'iife',
name: 'svgEditorLang_' + lang[1].replace(/-/g, '_'),
@ -201,7 +201,7 @@ export default [
if (extensionFile.match(/\.php$/)) {
mkdirSync('dist/extensions', {recursive: true});
copyFileSync(
join('editor/extensions', extensionFile),
join('src/editor/extensions', extensionFile),
join('dist/extensions', extensionFile)
);
return undefined;
@ -212,7 +212,7 @@ export default [
return undefined;
}
return {
input: 'editor/extensions/' + extensionFile,
input: 'src/editor/extensions/' + extensionFile,
output: {
format: 'iife',
name: 'svgEditorExtension_' + extensionName[1].replace(/-/g, '_'),

View File

@ -17,7 +17,7 @@
<script src="../../external/core-js-bundle/minified.js"></script>
<script src="../../external/regenerator-runtime/runtime.js"></script>
<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>
<script defer="defer" src="../../../../dist/extensions/imagelib/index.js"></script>
</head>
<body>

View File

@ -11,13 +11,13 @@
<script type="module" src="../../redirect-on-lacking-support.js"></script>
<!-- Browser polyfills -->
<script src="../../../dist/dom-polyfill.js"></script>
<script src="../../../../dist/dom-polyfill.js"></script>
<!-- ES6+ polyfills (Babel) -->
<script src="../../external/core-js-bundle/minified.js"></script>
<script src="../../external/regenerator-runtime/runtime.js"></script>
<script defer="defer" src="../../../dist/extensions/imagelib/openclipart.js"></script>
<script defer="defer" src="../../../../dist/extensions/imagelib/openclipart.js"></script>
</head>
<body>

View File

@ -25,21 +25,21 @@
<!-- Lacking browser support -->
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
<script defer="defer" src="../../dist/redirect-on-lacking-support.js"></script>
<!-- As yet no ES6 Module support -->
<script src="jquery-ui/jquery-ui-1.8.17.custom.min.js"></script>
<!-- Browser polyfills -->
<script src="../dist/dom-polyfill.js"></script>
<script src="../../dist/dom-polyfill.js"></script>
<!-- ES6+ polyfills (Babel) -->
<script src="external/core-js-bundle/minified.js"></script>
<script src="external/regenerator-runtime/runtime.js"></script>
<script src="../external/core-js-bundle/minified.js"></script>
<script src="../external/regenerator-runtime/runtime.js"></script>
<!-- If you do not wish to add extensions by URL, you can add calls
within the following file to svgEditor.setConfig -->
<script defer="defer" src="../svgedit-config-iife.js"></script>
<script defer="defer" src="../../svgedit-config-iife.js"></script>
<!-- FEEDS -->
<link rel="alternate" type="application/atom+xml"

View File

@ -31,11 +31,11 @@
<script src="jquery-ui/jquery-ui-1.8.17.custom.min.js"></script>
<!-- Browser polyfills -->
<script src="external/dom-polyfill/dom-polyfill.js"></script>
<script src="../external/dom-polyfill/dom-polyfill.js"></script>
<!-- ES6+ polyfills (Babel) -->
<script src="external/core-js-bundle/minified.js"></script>
<script src="external/regenerator-runtime/runtime.js"></script>
<script src="../external/core-js-bundle/minified.js"></script>
<script src="../external/regenerator-runtime/runtime.js"></script>
<!-- If you do not wish to add extensions by URL, you can add calls
within the following file to svgEditor.setConfig -->

View File

@ -25,17 +25,17 @@
<!-- Lacking browser support -->
<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>
<script defer="defer" src="../../dist/redirect-on-lacking-support.js"></script>
<!-- As yet no ES6 Module support -->
<script src="jquery-ui/jquery-ui-1.8.17.custom.min.js"></script>
<!-- Browser polyfills -->
<script src="../dist/dom-polyfill.js"></script>
<script src="../../dist/dom-polyfill.js"></script>
<!-- ES6+ polyfills (Babel) -->
<script src="external/core-js-bundle/minified.js"></script>
<script src="external/regenerator-runtime/runtime.js"></script>
<script src="../external/core-js-bundle/minified.js"></script>
<script src="../external/regenerator-runtime/runtime.js"></script>
<!-- If you do not wish to add extensions by URL, you can add calls
within the following file to svgEditor.setConfig -->

File diff suppressed because one or more lines are too long