Removing unique file dependencies in QML, removing comments from JS Builds (except first one, ~-30% build size)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2024-09-26 22:36:42 +02:00
parent 49aa23de92
commit 95b47effdf
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
24 changed files with 176 additions and 100 deletions

View file

@ -20,7 +20,7 @@ import QtQuick
import Qt.labs.platform as Native
//import QtQuick.Controls 2.15
import eu.ad5001.MixedMenu 1.1
import "js/history/index.mjs" as HistoryLib
import "js/index.mjs" as JS
/*!
@ -119,7 +119,7 @@ MenuBar {
icon.color: sysPalette.buttonText
onTriggered: {
var newObj = Modules.Objects.createNewRegisteredObject(modelData)
history.addToHistory(new HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export()))
history.addToHistory(new JS.HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export()))
objectLists.update()
}
}

View file

@ -19,7 +19,7 @@
import QtQuick
import QtQml
import QtQuick.Window
import "../js/history/index.mjs" as HistoryLib
import "../js/index.mjs" as JS
/*!
\qmltype History
@ -97,9 +97,9 @@ Item {
function unserialize(undoSt, redoSt) {
clear();
for(let i = 0; i < undoSt.length; i++)
undoStack.push(new HistoryLib.Actions[undoSt[i][0]](...undoSt[i][1]))
undoStack.push(new JS.HistoryLib.Actions[undoSt[i][0]](...undoSt[i][1]))
for(let i = 0; i < redoSt.length; i++)
redoStack.push(new HistoryLib.Actions[redoSt[i][0]](...redoSt[i][1]))
redoStack.push(new JS.HistoryLib.Actions[redoSt[i][0]](...redoSt[i][1]))
undoCount = undoSt.length;
redoCount = redoSt.length;
objectLists.update()
@ -110,7 +110,7 @@ Item {
Adds an instance of HistoryLib.Action to history.
*/
function addToHistory(action) {
if(action instanceof HistoryLib.Action) {
if(action instanceof JS.HistoryLib.Action) {
console.log("Added new entry to history: " + action.getReadableString())
undoStack.push(action)
undoCount++;

View file

@ -19,7 +19,6 @@
import QtQuick.Controls
import QtQuick
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../js/utils.mjs" as Utils
/*!

View file

@ -19,7 +19,6 @@
import QtQuick.Controls
import QtQuick
import Qt5Compat.GraphicalEffects
import "../js/utils.mjs" as Utils
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting

View file

@ -18,8 +18,6 @@
import QtQuick
import Qt.labs.platform as Native
import "js/utils.mjs" as Utils
import "js/math/index.mjs" as MathLib
/*!
\qmltype LogGraphCanvas

View file

@ -23,7 +23,7 @@ import QtQuick.Layouts 1.12
import QtQuick
// Auto loading all modules.
import "js/index.mjs" as ModulesAutoload
import "js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.History 1.0
import eu.ad5001.LogarithmPlotter.ObjectLists 1.0

View file

@ -20,9 +20,7 @@ import QtQuick
import QtQuick.Controls
import Qt.labs.platform as Native
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../../js/history/index.mjs" as HistoryLib
import "../../js/utils.mjs" as Utils
import "../../js/math/index.mjs" as MathLib
import "../../js/index.mjs" as JS
/*!
\qmltype CustomPropertyList
@ -77,12 +75,12 @@ Repeater {
height: 30
label: propertyLabel
icon: `settings/custom/${propertyIcon}.svg`
defValue: Utils.simplifyExpression(obj[propertyName].toEditableString())
defValue: JS.Utils.simplifyExpression(obj[propertyName].toEditableString())
self: obj.name
variables: propertyType.variables
onChanged: function(newExpr) {
if(obj[propertyName].toString() != newExpr.toString()) {
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
obj.name, objType, propertyName,
obj[propertyName], newExpr
))
@ -117,7 +115,7 @@ Repeater {
onChanged: function(newValue) {
try {
var newValueParsed = {
"Domain": () => MathLib.parseDomain(newValue),
"Domain": () => JS.MathLib.parseDomain(newValue),
"string": () => newValue,
"number": () => newValue,
"int": () => newValue
@ -125,7 +123,7 @@ Repeater {
// Ensuring old and new values are different to prevent useless adding to history.
if(obj[propertyName] != newValueParsed) {
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
obj.name, objType, propertyName,
obj[propertyName], newValueParsed
))
@ -170,7 +168,7 @@ Repeater {
return obj[propertyName]
}
onClicked: {
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
obj.name, objType, propertyName,
obj[propertyName], this.checked
))
@ -211,7 +209,7 @@ Repeater {
if(selectedObj == null) {
// Creating new object.
selectedObj = Modules.Objects.createNewRegisteredObject(propertyType.objType)
history.addToHistory(new HistoryLib.CreateNewObject(selectedObj.name, propertyType.objType, selectedObj.export()))
history.addToHistory(new JS.HistoryLib.CreateNewObject(selectedObj.name, propertyType.objType, selectedObj.export()))
baseModel = Modules.Objects.getObjectsName(propertyType.objType).concat(
isRealObject ? [qsTr("+ Create new %1").arg(Modules.Objects.types[propertyType.objType].displayType())] :
[])
@ -221,14 +219,14 @@ Repeater {
//Modules.Objects.currentObjects[objType][objIndex].requiredBy = obj[propertyName].filter((obj) => obj.name != obj.name)
}
obj.requiredBy = obj.requiredBy.filter((obj) => obj.name != obj.name)
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
obj.name, objType, propertyName,
obj[propertyName], selectedObj
))
obj[propertyName] = selectedObj
} else if(baseModel[newIndex] != obj[propertyName]) {
// Ensuring new property is different to not add useless history entries.
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
obj.name, objType, propertyName,
obj[propertyName], baseModel[newIndex]
))
@ -258,11 +256,10 @@ Repeater {
onChanged: {
var exported = exportModel()
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
obj.name, objType, propertyName,
obj[propertyName], exported
))
//Modules.Objects.currentObjects[objType][objIndex][propertyName] = exported
obj[propertyName] = exported
root.changed()
}
@ -284,7 +281,7 @@ Repeater {
property string propertyName: modelData[0]
property var propertyType: modelData[1]
property string propertyLabel: qsTranslate('prop',propertyName)
property string propertyIcon: Utils.camelCase2readable(propertyName)
property string propertyIcon: JS.Utils.camelCase2readable(propertyName)
sourceComponent: {
if(propertyName.startsWith('comment'))

View file

@ -22,9 +22,7 @@ import QtQuick.Dialogs as D
import Qt.labs.platform as Native
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import eu.ad5001.LogarithmPlotter.Popup 1.0 as Popup
import "../../js/history/index.mjs" as HistoryLib
import "../../js/utils.mjs" as Utils
import "../../js/math/index.mjs" as MathLib
import "../../js/index.mjs" as JS
/*!
\qmltype Dialog
@ -109,12 +107,12 @@ Popup.BaseDialog {
width: dlgProperties.width
value: objEditor.obj.name
onChanged: function(newValue) {
let newName = Utils.parseName(newValue)
let newName = JS.Utils.parseName(newValue)
if(newName != '' && objEditor.obj.name != newName) {
if(newName in Modules.Objects.currentObjectsByName) {
invalidNameDialog.showDialog(newName)
} else {
history.addToHistory(new HistoryLib.NameChanged(
history.addToHistory(new JS.HistoryLib.NameChanged(
objEditor.obj.name, objEditor.objType, newName
))
Modules.Objects.renameObject(obj.name, newName)

View file

@ -18,8 +18,8 @@
import QtQuick
import QtQuick.Controls
import "../js/history/index.mjs" as HistoryLib
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../js/index.mjs" as JS
/*!
@ -104,7 +104,7 @@ Column {
onClicked: {
let newObj = Modules.Objects.createNewRegisteredObject(modelData)
history.addToHistory(new HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export()))
history.addToHistory(new JS.HistoryLib.CreateNewObject(newObj.name, modelData, newObj.export()))
objectLists.update()
let hasXProp = newObj.constructor.properties().hasOwnProperty('x')

View file

@ -21,7 +21,7 @@ import QtQuick.Dialogs
import QtQuick.Controls
import QtQuick.Window
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../js/history/index.mjs" as HistoryLib
import "../js/index.mjs" as JS
/*!
@ -72,7 +72,7 @@ Item {
anchors.left: parent.left
anchors.leftMargin: 5
onClicked: {
history.addToHistory(new HistoryLib.EditedVisibility(
history.addToHistory(new JS.HistoryLib.EditedVisibility(
obj.name, obj.type, this.checked
))
obj.visible = this.checked
@ -212,7 +212,7 @@ Item {
selectedColor: obj.color
title: qsTr("Pick new color for %1 %2").arg(obj.constructor.displayType()).arg(obj.name)
onAccepted: {
history.addToHistory(new HistoryLib.ColorChanged(
history.addToHistory(new JS.HistoryLib.ColorChanged(
obj.name, obj.type, obj.color, selectedColor.toString()
))
obj.color = selectedColor.toString()
@ -231,7 +231,7 @@ Item {
// Object still exists
// Temporary fix for objects require not being propertly updated.
object.requiredBy = []
history.addToHistory(new HistoryLib.DeleteObject(
history.addToHistory(new JS.HistoryLib.DeleteObject(
object.name, object.type, object.export()
))
Modules.Objects.deleteObject(object.name)

View file

@ -19,8 +19,7 @@
import QtQuick
import QtQuick.Controls
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "js/math/index.mjs" as MathLib
import "js/history/index.mjs" as HistoryLib
import "js/index.mjs" as JS
/*!
\qmltype PickLocationOverlay
@ -116,7 +115,7 @@ Item {
let obj = Modules.Objects.currentObjectsByName[objName]
// Set values
if(parent.userPickX && parent.userPickY) {
history.addToHistory(new HistoryLib.EditedPosition(
history.addToHistory(new JS.HistoryLib.EditedPosition(
objName, objType, obj[propertyX], newValueX, obj[propertyY], newValueY
))
obj[propertyX] = newValueX
@ -125,7 +124,7 @@ Item {
objectLists.update()
pickerRoot.picked(obj)
} else if(parent.userPickX) {
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
objName, objType, propertyX, obj[propertyX], newValueX
))
obj[propertyX] = newValueX
@ -133,7 +132,7 @@ Item {
objectLists.update()
pickerRoot.picked(obj)
} else if(parent.userPickY) {
history.addToHistory(new HistoryLib.EditedProperty(
history.addToHistory(new JS.HistoryLib.EditedProperty(
objName, objType, propertyY, obj[propertyY], newValueY
))
obj[propertyY] = newValueY
@ -327,6 +326,6 @@ Item {
if(Modules.Objects.types[objType].properties()[propertyName] == 'number')
return parseFloat(value)
else
return new MathLib.Expression(value)
return new JS.MathLib.Expression(value)
}
}

View file

@ -20,8 +20,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../js/preferences/common.mjs" as S
import "../js/utils.mjs" as Utils
import "../js/index.mjs" as JS
/*!
\qmltype Preferences
@ -77,7 +76,7 @@ Popup {
currentIndex: find(setting.value())
model: setting.defaultValues
onAccepted: function() {
editText = Utils.parseName(editText, false)
editText = JS.Utils.parseName(editText, false)
if(find(editText) === -1) model.append(editText)
setting.set(editText)
}
@ -116,7 +115,7 @@ Popup {
height: 30
label: setting.name
icon: `settings/${setting.icon}.svg`
defValue: Utils.simplifyExpression(setting.value())
defValue: JS.Utils.simplifyExpression(setting.value())
variables: setting.variables
allowGraphObjects: false
property string propertyName: setting.name

View file

@ -20,9 +20,7 @@ import QtQuick.Controls
import QtQuick
import Qt.labs.platform as Native
import eu.ad5001.LogarithmPlotter.Popup 1.0 as P
import "../js/math/index.mjs" as MathLib
import "../js/utils.mjs" as Utils
import "../js/parsing/parsing.mjs" as Parsing
import "../js/index.mjs" as JS
/*!
@ -319,9 +317,9 @@ Item {
width: parent.width
readonly property var identifierTokenTypes: [
Parsing.TokenType.VARIABLE,
Parsing.TokenType.FUNCTION,
Parsing.TokenType.CONSTANT
JS.Parsing.TokenType.VARIABLE,
JS.Parsing.TokenType.FUNCTION,
JS.Parsing.TokenType.CONSTANT
]
property var currentToken: generateTokenInformation(getTokenAt(editor.tokens, editor.cursorPosition))
property var previousToken: generateTokenInformation(getPreviousToken(currentToken.token))
@ -346,7 +344,7 @@ Item {
'value': exists ? token.value : null,
'type': exists ? token.type : null,
'startPosition': exists ? token.startPosition : 0,
'dot': exists ? (token.type == Parsing.TokenType.PUNCT && token.value == ".") : false,
'dot': exists ? (token.type == JS.Parsing.TokenType.PUNCT && token.value == ".") : false,
'identifier': exists ? identifierTokenTypes.includes(token.type) : false
}
}
@ -385,7 +383,7 @@ Item {
*/
function getPreviousToken(token) {
let newToken = getTokenAt(editor.tokens, token.startPosition)
if(newToken != null && newToken.type == Parsing.TokenType.WHITESPACE)
if(newToken != null && newToken.type == JS.Parsing.TokenType.WHITESPACE)
return getPreviousToken(newToken)
return newToken
}
@ -444,9 +442,9 @@ Item {
visbilityCondition: parent.currentToken.identifier && !parent.previousToken.dot
itemStartIndex: variablesList.itemStartIndex + variablesList.model.length
itemSelected: parent.itemSelected
categoryItems: Parsing.CONSTANTS_LIST
categoryItems: JS.Parsing.CONSTANTS_LIST
autocompleteGenerator: (item) => {return {
'text': item, 'annotation': Parsing.CONSTANTS[item],
'text': item, 'annotation': JS.Parsing.CONSTANTS[item],
'autocomplete': item + " ", 'cursorFinalOffset': 0
}}
baseText: parent.visible ? parent.currentToken.value : ""
@ -459,9 +457,9 @@ Item {
visbilityCondition: parent.currentToken.identifier && !parent.previousToken.dot
itemStartIndex: constantsList.itemStartIndex + constantsList.model.length
itemSelected: parent.itemSelected
categoryItems: Parsing.FUNCTIONS_LIST
categoryItems: JS.Parsing.FUNCTIONS_LIST
autocompleteGenerator: (item) => {return {
'text': item, 'annotation': Parsing.FUNCTIONS_USAGE[item].join(', '),
'text': item, 'annotation': JS.Parsing.FUNCTIONS_USAGE[item].join(', '),
'autocomplete': item+'()', 'cursorFinalOffset': -1
}}
baseText: parent.visible ? parent.currentToken.value : ""
@ -538,7 +536,7 @@ Item {
function parse(newExpression) {
let expr = null
try {
expr = new MathLib.Expression(value.toString())
expr = new JS.MathLib.Expression(value.toString())
// Check if the expression is valid, throws error otherwise.
if(!expr.allRequirementsFullfilled()) {
let undefVars = expr.undefinedVariables()
@ -572,7 +570,7 @@ Item {
Generates a list of tokens from the given.
*/
function tokens(text) {
let tokenizer = new Parsing.Tokenizer(new Parsing.Input(text), true, false)
let tokenizer = new JS.Parsing.Tokenizer(new JS.Parsing.Input(text), true, false)
let tokenList = []
let token
while((token = tokenizer.next()) != null)
@ -605,28 +603,28 @@ Item {
let scheme = colorSchemes[Helper.getSettingInt("expression_editor.color_scheme")]
for(let token of tokenList) {
switch(token.type) {
case Parsing.TokenType.VARIABLE:
case JS.Parsing.TokenType.VARIABLE:
parsedText += `<font color="${scheme.VARIABLE}">${token.value}</font>`
break;
case Parsing.TokenType.CONSTANT:
case JS.Parsing.TokenType.CONSTANT:
parsedText += `<font color="${scheme.CONSTANT}">${token.value}</font>`
break;
case Parsing.TokenType.FUNCTION:
parsedText += `<font color="${scheme.FUNCTION}">${Utils.escapeHTML(token.value)}</font>`
case JS.Parsing.TokenType.FUNCTION:
parsedText += `<font color="${scheme.FUNCTION}">${JS.Utils.escapeHTML(token.value)}</font>`
break;
case Parsing.TokenType.OPERATOR:
parsedText += `<font color="${scheme.OPERATOR}">${Utils.escapeHTML(token.value)}</font>`
case JS.Parsing.TokenType.OPERATOR:
parsedText += `<font color="${scheme.OPERATOR}">${JS.Utils.escapeHTML(token.value)}</font>`
break;
case Parsing.TokenType.NUMBER:
parsedText += `<font color="${scheme.NUMBER}">${Utils.escapeHTML(token.value)}</font>`
case JS.Parsing.TokenType.NUMBER:
parsedText += `<font color="${scheme.NUMBER}">${JS.Utils.escapeHTML(token.value)}</font>`
break;
case Parsing.TokenType.STRING:
parsedText += `<font color="${scheme.STRING}">${token.limitator}${Utils.escapeHTML(token.value)}${token.limitator}</font>`
case JS.Parsing.TokenType.STRING:
parsedText += `<font color="${scheme.STRING}">${token.limitator}${JS.Utils.escapeHTML(token.value)}${token.limitator}</font>`
break;
case Parsing.TokenType.WHITESPACE:
case Parsing.TokenType.PUNCT:
case JS.Parsing.TokenType.WHITESPACE:
case JS.Parsing.TokenType.PUNCT:
default:
parsedText += Utils.escapeHTML(token.value).replace(/ /g, '&nbsp;')
parsedText += JS.Utils.escapeHTML(token.value).replace(/ /g, '&nbsp;')
break;
}
}

View file

@ -20,7 +20,7 @@ import QtQuick
import QtQuick.Controls
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import eu.ad5001.LogarithmPlotter.Popup 1.0 as Popup
import "js/utils.mjs" as Utils
import "js/index.mjs" as JS
/*!
\qmltype Settings
@ -330,7 +330,7 @@ ScrollView {
currentIndex: find(settings.xlabel)
editable: true
onAccepted: function(){
editText = Utils.parseName(editText, false)
editText = JS.Utils.parseName(editText, false)
if (find(editText) === -1) model.append({text: editText})
settings.xlabel = editText
settings.changed()
@ -359,7 +359,7 @@ ScrollView {
currentIndex: find(settings.ylabel)
editable: true
onAccepted: function(){
editText = Utils.parseName(editText, false)
editText = JS.Utils.parseName(editText, false)
if (find(editText) === -1) model.append({text: editText, yaxisstep: root.yaxisstep})
settings.ylabel = editText
settings.changed()

View file

@ -19,8 +19,6 @@
import QtQuick
import QtQuick.Controls
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "js/math/index.mjs" as MathLib
import "js/history/index.mjs" as HistoryLib
/*!
\qmltype ViewPositionChangeOverlay

View file

@ -1,17 +1,17 @@
/**
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
* Copyright (C) 2021-2024 Ad5001
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@ -25,3 +25,8 @@ import * as History from "./module/history.mjs"
import * as CanvasAPI from "./module/canvas.mjs"
import * as IOAPI from "./module/io.mjs"
import * as PreferencesAPI from "./module/preferences.mjs"
export * as MathLib from "./math/index.mjs"
export * as HistoryLib from "./history/index.mjs"
export * as Parsing from "./parsing/index.mjs"
export * as Utils from "./utils.mjs"

View file

@ -1,19 +1,23 @@
/**
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
* Copyright (C) 2021-2024 Ad5001
/*!
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
*
* @author Ad5001 <mail@ad5001.eu>
* @license GPL-3.0-or-later
* @copyright (C) 2021-2024 Ad5001
* @preserve
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export const NUMBER = 0

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import * as Reference from "reference.mjs"
import * as Reference from "./reference.mjs"
import * as T from "./tokenizer.mjs"
import InputExpression from "./common.mjs"

View file

@ -17,7 +17,7 @@
*/
import * as Reference from "reference.mjs"
import * as Reference from "./reference.mjs"
const WHITESPACES = " \t\n\r"
const STRING_LIMITERS = '"\'`';

View file

@ -78,7 +78,6 @@ def check_for_updates(current_version, window):
return
def cb(show_alert, msg_text, update_available):
pass
if show_alert:
window.showAlert(msg_text)
if update_available:

82
package-lock.json generated
View file

@ -15,7 +15,8 @@
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-terser": "^0.4.4",
"install": "^0.13.0",
"rollup": "^4.22.4"
"rollup": "^4.22.4",
"rollup-plugin-cleanup": "^3.2.1"
}
},
"node_modules/@ampproject/remapping": {
@ -2476,6 +2477,29 @@
"@types/estree": "*"
}
},
"node_modules/js-cleanup": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/js-cleanup/-/js-cleanup-1.2.0.tgz",
"integrity": "sha512-JeDD0yiiSt80fXzAVa/crrS0JDPQljyBG/RpOtaSbyDq03VHa9szJWMaWOYU/bcTn412uMN2MxApXq8v79cUiQ==",
"license": "MIT",
"dependencies": {
"magic-string": "^0.25.7",
"perf-regexes": "^1.0.1",
"skip-regex": "^1.0.2"
},
"engines": {
"node": "^10.14.2 || >=12.0.0"
}
},
"node_modules/js-cleanup/node_modules/magic-string": {
"version": "0.25.9",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
"integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
"license": "MIT",
"dependencies": {
"sourcemap-codec": "^1.4.8"
}
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -2549,6 +2573,15 @@
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"license": "MIT"
},
"node_modules/perf-regexes": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/perf-regexes/-/perf-regexes-1.0.1.tgz",
"integrity": "sha512-L7MXxUDtqr4PUaLFCDCXBfGV/6KLIuSEccizDI7JxT+c9x1G1v04BQ4+4oag84SHaCdrBgQAIs/Cqn+flwFPng==",
"license": "MIT",
"engines": {
"node": ">=6.14"
}
},
"node_modules/picocolors": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz",
@ -2700,6 +2733,37 @@
"fsevents": "~2.3.2"
}
},
"node_modules/rollup-plugin-cleanup": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/rollup-plugin-cleanup/-/rollup-plugin-cleanup-3.2.1.tgz",
"integrity": "sha512-zuv8EhoO3TpnrU8MX8W7YxSbO4gmOR0ny06Lm3nkFfq0IVKdBUtHwhVzY1OAJyNCIAdLiyPnOrU0KnO0Fri1GQ==",
"license": "MIT",
"dependencies": {
"js-cleanup": "^1.2.0",
"rollup-pluginutils": "^2.8.2"
},
"engines": {
"node": "^10.14.2 || >=12.0.0"
},
"peerDependencies": {
"rollup": ">=2.0"
}
},
"node_modules/rollup-pluginutils": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz",
"integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==",
"license": "MIT",
"dependencies": {
"estree-walker": "^0.6.1"
}
},
"node_modules/rollup-pluginutils/node_modules/estree-walker": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
"integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
"license": "MIT"
},
"node_modules/rollup/node_modules/@types/estree": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
@ -2744,6 +2808,15 @@
"randombytes": "^2.1.0"
}
},
"node_modules/skip-regex": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/skip-regex/-/skip-regex-1.0.2.tgz",
"integrity": "sha512-pEjMUbwJ5Pl/6Vn6FsamXHXItJXSRftcibixDmNCWbWhic0hzHrwkMZo0IZ7fMRH9KxcWDFSkzhccB4285PutA==",
"license": "MIT",
"engines": {
"node": ">=4.2"
}
},
"node_modules/smob": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz",
@ -2769,6 +2842,13 @@
"node": ">=0.10.0"
}
},
"node_modules/sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"deprecated": "Please use @jridgewell/sourcemap-codec instead",
"license": "MIT"
},
"node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",

View file

@ -19,6 +19,7 @@
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-terser": "^0.4.4",
"install": "^0.13.0",
"rollup": "^4.22.4"
"rollup": "^4.22.4",
"rollup-plugin-cleanup": "^3.2.1"
}
}

View file

@ -19,6 +19,7 @@
import { nodeResolve } from "@rollup/plugin-node-resolve"
import commonjs from "@rollup/plugin-commonjs"
import { babel } from "@rollup/plugin-babel"
import cleanup from "rollup-plugin-cleanup"
import terser from "@rollup/plugin-terser"
const path = "LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js"
@ -34,6 +35,7 @@ export default {
plugins: [
nodeResolve({ browser: true }),
commonjs(),
cleanup({ comments: 'some' }),
babel({
babelHelpers: "bundled"
}),

View file

@ -43,7 +43,7 @@ def test_setup():
def test_map_source():
sourcemap_available = debug.SOURCEMAP_INDEX is not None
if sourcemap_available:
assert debug.map_javascript_source("js/index.mjs", 21) == ("js/module/interface.mjs", 21)
assert debug.map_javascript_source("js/index.mjs", 22) == ("js/module/interface.mjs", 23)
assert debug.map_javascript_source("js/index.mjs", 100000) == ("js/index.mjs", 100000) # Too long, not found
debug.SOURCEMAP_INDEX = None
assert debug.map_javascript_source("js/index.mjs", 21) == ("js/index.mjs", 21)