lilact 0.26.13 → 0.26.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/errors.jsx CHANGED
@@ -137,7 +137,7 @@ export function scanBlockLabels(code, path)
137
137
  * @returns A new object that includes `path`, `row`, `col`, `msg`, `name`, and optional `stack`.
138
138
  * The exception itself is stored as `err`.
139
139
  */
140
- export function traceError(error)
140
+ export function traceError(error, run_path)
141
141
  {
142
142
  if(error?.is_traced) {
143
143
  return error;
@@ -146,7 +146,7 @@ export function traceError(error)
146
146
  const loc = parseEvalLocationFromStack(error.stack);
147
147
 
148
148
  const obj = {
149
- fileName: loc.url?.slice(6) || error.fileName,
149
+ fileName: loc.url?.slice(6) || run_path || error.fileName,
150
150
 
151
151
  lineNumber: loc.line,
152
152
  columnNumber: loc.col,
@@ -173,37 +173,40 @@ export function traceError(error)
173
173
  obj.lineNumber = mloc.line;
174
174
  obj.columnNumber = mloc.col;
175
175
  }
176
- else if( error.lilact_trace!==undefined) {
176
+ else {
177
177
 
178
178
  let loc = getErrorLocation(error);
179
179
 
180
- let mps;
181
- let blk;
180
+ if( error.lilact_trace!==undefined) {
181
+ let mps;
182
+ let blk;
182
183
 
183
- if(typeof(error.lilact_trace)==='object') {
184
- blk = Lilact.blocks_info.labels[error.lilact_trace[0]];
185
- }
186
- else {
187
- blk = Lilact.blocks_info.labels[error.lilact_trace];
188
- }
184
+ if(typeof(error.lilact_trace)==='object') {
185
+ blk = Lilact.blocks_info.labels[error.lilact_trace[0]];
186
+ }
187
+ else {
188
+ blk = Lilact.blocks_info.labels[error.lilact_trace];
189
+ }
189
190
 
190
- if(blk) {
191
- obj.fileName = blk.path;
192
- obj.label = blk.label;
191
+ if(blk) {
192
+ obj.fileName = blk.path;
193
+ obj.label = blk.label;
193
194
 
194
- mps = required_scripts[blk.path].mappings;
195
+ mps = required_scripts[blk.path].mappings;
195
196
 
196
- loc = mapLocation(mps, loc.line-1, loc.col-1);
197
-
198
- obj.lineNumber = loc.line;
199
- obj.columnNumber = loc.col;
197
+ loc = mapLocation(mps, loc.line-1, loc.col-1);
198
+ }
200
199
  }
200
+
201
+ obj.lineNumber = loc.line;
202
+ obj.columnNumber = loc.col;
201
203
  }
202
204
 
203
205
  }
204
206
  else {
205
207
  const loc = getErrorLocation(error);
206
208
  if(error.fileName) obj.fileName = error.fileName;
209
+ else if(run_path) obj.fileName = run_path;
207
210
  obj.lineNumber = loc.line;
208
211
  obj.columnNumber = loc.col;
209
212
  }
package/src/jsx.js CHANGED
@@ -992,9 +992,11 @@ export function transpileJSX( jsx, {
992
992
  const eols = scanEOLs(jsx);
993
993
 
994
994
  raiseError = ((eols, msg, index)=>{
995
+ const rc = getRowCol(eols, index);
995
996
  const er = new Error(msg);
997
+ console.error(`JSXParserError: ${msg} [file ${path} at line ${rc[0]+1}]`);
998
+ [er.lineNumber, er.columnNumber] = rc;
996
999
  er.name = 'JSXParseError';
997
- [er.lineNumber, er.columnNumber] = getRowCol(eols, index);
998
1000
  er.fileName = path;
999
1001
  er.lilact_trace = 'parse';
1000
1002
  throw er;
package/src/run.jsx CHANGED
@@ -129,7 +129,7 @@ if(DEBUG) {
129
129
  return res;
130
130
  }
131
131
  catch(e) {
132
- e = Lilact.traceError(e);
132
+ e = Lilact.traceError(e, path);
133
133
  throw e;
134
134
  }
135
135
  }