Skip to content

Commit

Permalink
Fix transpiler (RobotWebTools#501)
Browse files Browse the repository at this point in the history
* (transpiler) always enable errors

* (transpiler) throw error on LogError

* (transpiler) fix properties regex
  • Loading branch information
MatthijsBurgh committed Feb 9, 2022
1 parent a006df3 commit 6240501
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions es6-transpiler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const debug = require('debug')
const path = require('path')

debug.enable('ES6Transpiler:Error')

const colors = {
GRAY: 0,
RED: 1,
Expand All @@ -18,7 +20,10 @@ const stringifyObjects = (...args) => args
: arg)

const logError = debug('ES6Transpiler:Error')
logError.log = (...args) => console.error(...stringifyObjects(...args))
logError.log = (...args) => {
console.error(...stringifyObjects(...args))
throw new Error("Execution stopped because of an error, sea above.")
}
logError.color = colors.RED

const logWarning = debug('ES6Transpiler:Warning')
Expand Down Expand Up @@ -217,7 +222,7 @@ const transpile = {
exportedProperties: (filepath) => [
// from:
// ROS3D.MARKER_ARROW = 0;
/\nROS3D\.(.*)\s*=\s*(.*)/g,
/\nROS3D\.(\S*)\s*=\s*(.*)/g,
// to:
// export var MARKER_ARROW = 0;
(match, $1, $2) => {
Expand Down

0 comments on commit 6240501

Please sign in to comment.