juxscript 1.1.158 → 1.1.159

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.
@@ -15,12 +15,29 @@ export function generateErrorCollector(options = {}) {
15
15
 
16
16
  function findSource(stack) {
17
17
  var sources = window.__juxSources;
18
- if (!sources || !stack) return null;
19
- var m = stack.match(/renderJux\\d+/);
20
- if (!m) return null;
21
- for (var key in sources) {
22
- if (sources[key].functionName === m[0]) return sources[key];
18
+ if (!sources) return null;
19
+
20
+ // Try matching renderJuxN anywhere in the stack
21
+ if (stack) {
22
+ var m = stack.match(/renderJux\\d+/g);
23
+ if (m) {
24
+ for (var i = 0; i < m.length; i++) {
25
+ for (var key in sources) {
26
+ if (sources[key].functionName === m[i]) return sources[key];
27
+ }
28
+ }
29
+ }
30
+ }
31
+
32
+ // Fallback: if there's only one source, show it
33
+ var keys = Object.keys(sources);
34
+ if (keys.length === 1) return sources[keys[0]];
35
+
36
+ // Fallback: return first source that has a functionName
37
+ for (var k in sources) {
38
+ if (sources[k].functionName) return sources[k];
23
39
  }
40
+
24
41
  return null;
25
42
  }
26
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.158",
3
+ "version": "1.1.159",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",