juxscript 1.1.385 → 1.1.388
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/dist/components/indexDb.d.ts +6 -6
- package/dist/components/indexDb.d.ts.map +1 -1
- package/dist/components/indexDb.js +5 -5
- package/dist/components/indexDb.js.map +1 -1
- package/machinery/compiler4.js +19 -0
- package/machinery/errors-client.js +112 -0
- package/machinery/errors.js +4 -121
- package/machinery/validate-jux.js +333 -0
- package/package.json +1 -1
- package/dist/components/sidebar.d.ts +0 -62
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/sidebar.js +0 -153
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/store.d.ts +0 -78
- package/dist/components/store.d.ts.map +0 -1
- package/dist/components/store.js +0 -249
- package/dist/components/store.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface IndexDbStoreOptions {
|
|
2
2
|
db: string;
|
|
3
3
|
table: string;
|
|
4
4
|
version?: number;
|
|
@@ -11,9 +11,9 @@ interface StoreOptions {
|
|
|
11
11
|
}>;
|
|
12
12
|
auto?: boolean;
|
|
13
13
|
}
|
|
14
|
-
declare class
|
|
14
|
+
declare class IndexDb {
|
|
15
15
|
id: string;
|
|
16
|
-
options:
|
|
16
|
+
options: IndexDbStoreOptions;
|
|
17
17
|
_element: HTMLElement;
|
|
18
18
|
private _db;
|
|
19
19
|
private _value;
|
|
@@ -21,7 +21,7 @@ declare class Store {
|
|
|
21
21
|
private _error;
|
|
22
22
|
private _onChange;
|
|
23
23
|
private _ready;
|
|
24
|
-
constructor(id: string, options:
|
|
24
|
+
constructor(id: string, options: IndexDbStoreOptions);
|
|
25
25
|
private _open;
|
|
26
26
|
private _tx;
|
|
27
27
|
private _notifyChange;
|
|
@@ -75,6 +75,6 @@ declare class Store {
|
|
|
75
75
|
* }
|
|
76
76
|
* });
|
|
77
77
|
*/
|
|
78
|
-
export declare function indexDb(id: string, options:
|
|
79
|
-
export {
|
|
78
|
+
export declare function indexDb(id: string, options: IndexDbStoreOptions): Promise<IndexDb>;
|
|
79
|
+
export { IndexDb, IndexDbStoreOptions };
|
|
80
80
|
//# sourceMappingURL=indexDb.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexDb.d.ts","sourceRoot":"","sources":["../../lib/components/indexDb.ts"],"names":[],"mappings":"AAGA,UAAU,
|
|
1
|
+
{"version":3,"file":"indexDb.d.ts","sourceRoot":"","sources":["../../lib/components/indexDb.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAChF,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,cAAM,OAAO;IACT,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,GAAG,CAA4B;IACvC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,MAAM,CAAgB;gBAElB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB;IA0BpD,OAAO,CAAC,KAAK;IAgCb,OAAO,CAAC,GAAG;IAOX,OAAO,CAAC,aAAa;IAoBrB,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAA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options) {
|
|
5
5
|
this._db = null;
|
|
6
6
|
this._value = [];
|
|
@@ -18,7 +18,7 @@ class Store {
|
|
|
18
18
|
// Create a hidden DOM element so pageState can wire events
|
|
19
19
|
this._element = document.createElement('div');
|
|
20
20
|
this._element.id = this.id;
|
|
21
|
-
this._element.setAttribute('data-jux-
|
|
21
|
+
this._element.setAttribute('data-jux-indexdb', this.options.table);
|
|
22
22
|
this._element.setAttribute('data-count', '0');
|
|
23
23
|
this._element.setAttribute('data-loading', 'false');
|
|
24
24
|
this._element.style.display = 'none';
|
|
@@ -51,7 +51,7 @@ class Store {
|
|
|
51
51
|
};
|
|
52
52
|
req.onerror = (e) => {
|
|
53
53
|
this._error = `IndexedDB open failed: ${e.target.error?.message}`;
|
|
54
|
-
console.error(`❌ jux.
|
|
54
|
+
console.error(`❌ jux.indexDb('${this.id}'):`, this._error);
|
|
55
55
|
reject(new Error(this._error));
|
|
56
56
|
};
|
|
57
57
|
});
|
|
@@ -241,7 +241,7 @@ class Store {
|
|
|
241
241
|
* });
|
|
242
242
|
*/
|
|
243
243
|
export async function indexDb(id, options) {
|
|
244
|
-
const s = new
|
|
244
|
+
const s = new IndexDb(id, options);
|
|
245
245
|
pageState.__register(s);
|
|
246
246
|
if (options.auto !== false) {
|
|
247
247
|
await s.getAll();
|
|
@@ -249,5 +249,5 @@ export async function indexDb(id, options) {
|
|
|
249
249
|
}
|
|
250
250
|
return s;
|
|
251
251
|
}
|
|
252
|
-
export {
|
|
252
|
+
export { IndexDb };
|
|
253
253
|
//# sourceMappingURL=indexDb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexDb.js","sourceRoot":"","sources":["../../lib/components/indexDb.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAYlD,MAAM,
|
|
1
|
+
{"version":3,"file":"indexDb.js","sourceRoot":"","sources":["../../lib/components/ind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AO,CAAC,EAAU,EAAE,OAA4B;IAClE,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACnC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAExB,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QACjB,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,CAAC;AACb,CAAC;AAED,OAAO,EAAE,OAAO,EAAuB,CAAC"}
|
package/machinery/compiler4.js
CHANGED
|
@@ -6,6 +6,7 @@ import path from 'path';
|
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
7
|
import { generateErrorCollector } from './errors.js';
|
|
8
8
|
import { autowrap } from './autowrap.js';
|
|
9
|
+
import { validateJuxFiles, printValidationResults } from './validate-jux.js';
|
|
9
10
|
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = path.dirname(__filename);
|
|
@@ -744,6 +745,24 @@ ${bodyContainers} <div id="app"></div>
|
|
|
744
745
|
}
|
|
745
746
|
fs.mkdirSync(this.distDir, { recursive: true });
|
|
746
747
|
|
|
748
|
+
// Copy error overlay script to dist
|
|
749
|
+
const errSrc = path.resolve(__dirname, 'errors-client.js');
|
|
750
|
+
if (fs.existsSync(errSrc) && process.env.NODE_ENV !== 'production') {
|
|
751
|
+
fs.copyFileSync(errSrc, path.join(this.distDir, 'jux-errors.js'));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// ── Validate .jux files before compilation ──
|
|
755
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
756
|
+
const juxValidation = validateJuxFiles(this.srcDir, packageRoot);
|
|
757
|
+
const juxErrorCount = printValidationResults(juxValidation);
|
|
758
|
+
if (juxErrorCount > 0) {
|
|
759
|
+
console.error(`\n🛑 BUILD FAILED — ${juxErrorCount} .jux validation error(s)\n`);
|
|
760
|
+
return { success: false, errors: juxValidation.errors, warnings: juxValidation.warnings };
|
|
761
|
+
}
|
|
762
|
+
if (juxValidation.stats.files > 0) {
|
|
763
|
+
console.log(`✅ Validated ${juxValidation.stats.files} .jux file(s): ${juxValidation.stats.calls} calls, ${juxValidation.stats.vars} tracked vars`);
|
|
764
|
+
}
|
|
765
|
+
|
|
747
766
|
this.copyPublicFolder();
|
|
748
767
|
|
|
749
768
|
const precompileResult = this._validatePrecompile();
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JUX client-side error overlay.
|
|
3
|
+
* Injected as <script src="/jux-errors.js"> in dev mode.
|
|
4
|
+
*/
|
|
5
|
+
(function() {
|
|
6
|
+
var MAX_ERRORS = 50;
|
|
7
|
+
var __errors = [];
|
|
8
|
+
var __overlay = null;
|
|
9
|
+
var __list = null;
|
|
10
|
+
|
|
11
|
+
function findSource(stack) {
|
|
12
|
+
var sources = window.__juxSources;
|
|
13
|
+
if (!sources) return null;
|
|
14
|
+
if (stack) {
|
|
15
|
+
var m = stack.match(/renderJux\d+/g);
|
|
16
|
+
if (m) {
|
|
17
|
+
for (var i = 0; i < m.length; i++) {
|
|
18
|
+
for (var key in sources) {
|
|
19
|
+
if (sources[key].functionName === m[i]) return sources[key];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
var keys = Object.keys(sources);
|
|
25
|
+
if (keys.length === 1) return sources[keys[0]];
|
|
26
|
+
for (var k in sources) {
|
|
27
|
+
if (sources[k].functionName) return sources[k];
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function escapeHtml(s) {
|
|
33
|
+
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function renderSource(src) {
|
|
37
|
+
if (!src) return '';
|
|
38
|
+
var lines = src.lines || [];
|
|
39
|
+
var html = '<div style="margin-top:8px;padding:8px;background:#111;border:1px solid #333;border-radius:4px;">';
|
|
40
|
+
html += '<div style="color:#ff5555;font-size:12px;margin-bottom:6px;font-weight:bold;">' + escapeHtml(src.file) + '</div>';
|
|
41
|
+
for (var i = 0; i < lines.length; i++) {
|
|
42
|
+
html += '<div style="padding:1px 8px;white-space:pre;">' +
|
|
43
|
+
'<span style="color:#555;display:inline-block;width:32px;text-align:right;margin-right:12px;user-select:none;">' + (i+1) + '</span>' +
|
|
44
|
+
'<span style="color:#ccc;">' + escapeHtml(lines[i]) + '</span></div>';
|
|
45
|
+
}
|
|
46
|
+
html += '</div>';
|
|
47
|
+
return html;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function createOverlay() {
|
|
51
|
+
__overlay = document.createElement('div');
|
|
52
|
+
__overlay.setAttribute('style','position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99999;background:rgba(0,0,0,0.85);color:#f8f8f8;font-family:monospace;font-size:14px;overflow-y:auto;');
|
|
53
|
+
var c = document.createElement('div');
|
|
54
|
+
c.setAttribute('style','max-width:960px;margin:40px auto;padding:24px 32px;border:2px solid #ff5555;border-radius:8px;background:#1a1a1a;');
|
|
55
|
+
var h = document.createElement('div');
|
|
56
|
+
h.setAttribute('style','display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;padding-bottom:12px;border-bottom:1px solid #333;');
|
|
57
|
+
var t = document.createElement('div');
|
|
58
|
+
t.setAttribute('style','color:#ff5555;font-size:16px;font-weight:bold;');
|
|
59
|
+
t.textContent = 'Runtime Error';
|
|
60
|
+
var btn = document.createElement('button');
|
|
61
|
+
btn.textContent = 'Close';
|
|
62
|
+
btn.setAttribute('style','background:transparent;border:1px solid #555;color:#aaa;padding:4px 12px;border-radius:4px;cursor:pointer;font-family:monospace;font-size:12px;');
|
|
63
|
+
btn.addEventListener('click', function() { __overlay.style.display = 'none'; });
|
|
64
|
+
h.appendChild(t); h.appendChild(btn); c.appendChild(h);
|
|
65
|
+
__list = document.createElement('div');
|
|
66
|
+
c.appendChild(__list); __overlay.appendChild(c);
|
|
67
|
+
document.body.appendChild(__overlay);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function addError(type, message, stack) {
|
|
71
|
+
if (__errors.length >= MAX_ERRORS) __errors.shift();
|
|
72
|
+
__errors.push({ type: type, message: message, stack: stack });
|
|
73
|
+
if (!__overlay) createOverlay();
|
|
74
|
+
__overlay.style.display = 'block';
|
|
75
|
+
|
|
76
|
+
var item = document.createElement('div');
|
|
77
|
+
item.setAttribute('style','padding:12px 16px;margin-bottom:8px;background:#222;border-left:3px solid #ff5555;border-radius:4px;');
|
|
78
|
+
|
|
79
|
+
var label = type === 'error' ? 'Error' : type === 'rejection' ? 'Unhandled Rejection' : 'console.error';
|
|
80
|
+
item.innerHTML = '<div style="color:#888;font-size:12px;margin-bottom:4px;">' + label + '</div>' +
|
|
81
|
+
'<div style="color:#ff8888;font-size:14px;white-space:pre-wrap;word-break:break-word;font-weight:bold;">' + escapeHtml(message) + '</div>';
|
|
82
|
+
|
|
83
|
+
var src = findSource(stack);
|
|
84
|
+
if (src) item.innerHTML += renderSource(src);
|
|
85
|
+
|
|
86
|
+
if (stack) {
|
|
87
|
+
var d = document.createElement('details');
|
|
88
|
+
d.setAttribute('style','margin-top:8px;');
|
|
89
|
+
d.innerHTML = '<summary style="cursor:pointer;color:#555;font-size:12px;">Stack trace</summary>' +
|
|
90
|
+
'<pre style="margin:4px 0 0;padding:8px;font-size:12px;color:#666;white-space:pre-wrap;background:#111;border:1px solid #333;border-radius:4px;max-height:200px;overflow-y:auto;">' + escapeHtml(stack) + '</pre>';
|
|
91
|
+
item.appendChild(d);
|
|
92
|
+
}
|
|
93
|
+
__list.appendChild(item);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
window.onerror = function(msg, src, line, col, err) {
|
|
97
|
+
addError('error', msg, err && err.stack ? err.stack : '');
|
|
98
|
+
};
|
|
99
|
+
window.addEventListener('unhandledrejection', function(e) {
|
|
100
|
+
var r = e.reason;
|
|
101
|
+
addError('rejection', r instanceof Error ? r.message : String(r), r instanceof Error ? r.stack : '');
|
|
102
|
+
});
|
|
103
|
+
var _ce = console.error;
|
|
104
|
+
console.error = function() {
|
|
105
|
+
var msg = Array.prototype.slice.call(arguments).map(function(a) {
|
|
106
|
+
return typeof a === 'object' ? JSON.stringify(a) : String(a);
|
|
107
|
+
}).join(' ');
|
|
108
|
+
addError('console', msg, '');
|
|
109
|
+
_ce.apply(console, arguments);
|
|
110
|
+
};
|
|
111
|
+
window.__juxErrors = { list: function() { return __errors.slice(); }, count: function() { return __errors.length; } };
|
|
112
|
+
})();
|
package/machinery/errors.js
CHANGED
|
@@ -1,126 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Returns a <script> tag for the error overlay.
|
|
3
|
+
* In production, returns empty string.
|
|
4
4
|
*/
|
|
5
5
|
export function generateErrorCollector(options = {}) {
|
|
6
|
-
const { enabled = true
|
|
6
|
+
const { enabled = true } = options;
|
|
7
7
|
if (!enabled) return '';
|
|
8
|
-
|
|
9
|
-
return `
|
|
10
|
-
<script>
|
|
11
|
-
(function() {
|
|
12
|
-
var __errors = [];
|
|
13
|
-
var __overlay = null;
|
|
14
|
-
var __list = null;
|
|
15
|
-
|
|
16
|
-
function findSource(stack) {
|
|
17
|
-
var sources = window.__juxSources;
|
|
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];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function escapeHtml(s) {
|
|
45
|
-
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function renderSource(src) {
|
|
49
|
-
if (!src) return '';
|
|
50
|
-
var lines = src.lines || [];
|
|
51
|
-
var html = '<div style="margin-top:8px;padding:8px;background:#111;border:1px solid #333;border-radius:4px;">';
|
|
52
|
-
html += '<div style="color:#ff5555;font-size:12px;margin-bottom:6px;font-weight:bold;">' + escapeHtml(src.file) + '</div>';
|
|
53
|
-
for (var i = 0; i < lines.length; i++) {
|
|
54
|
-
html += '<div style="padding:1px 8px;white-space:pre;">' +
|
|
55
|
-
'<span style="color:#555;display:inline-block;width:32px;text-align:right;margin-right:12px;user-select:none;">' + (i+1) + '</span>' +
|
|
56
|
-
'<span style="color:#ccc;">' + escapeHtml(lines[i]) + '</span></div>';
|
|
57
|
-
}
|
|
58
|
-
html += '</div>';
|
|
59
|
-
return html;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function createOverlay() {
|
|
63
|
-
__overlay = document.createElement('div');
|
|
64
|
-
__overlay.setAttribute('style','position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:99999;background:rgba(0,0,0,0.85);color:#f8f8f8;font-family:monospace;font-size:14px;overflow-y:auto;');
|
|
65
|
-
var c = document.createElement('div');
|
|
66
|
-
c.setAttribute('style','max-width:960px;margin:40px auto;padding:24px 32px;border:2px solid #ff5555;border-radius:8px;background:#1a1a1a;');
|
|
67
|
-
var h = document.createElement('div');
|
|
68
|
-
h.setAttribute('style','display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;padding-bottom:12px;border-bottom:1px solid #333;');
|
|
69
|
-
var t = document.createElement('div');
|
|
70
|
-
t.setAttribute('style','color:#ff5555;font-size:16px;font-weight:bold;');
|
|
71
|
-
t.textContent = 'Runtime Error';
|
|
72
|
-
var btn = document.createElement('button');
|
|
73
|
-
btn.textContent = 'Close';
|
|
74
|
-
btn.setAttribute('style','background:transparent;border:1px solid #555;color:#aaa;padding:4px 12px;border-radius:4px;cursor:pointer;font-family:monospace;font-size:12px;');
|
|
75
|
-
btn.addEventListener('click', function() { __overlay.style.display = 'none'; });
|
|
76
|
-
h.appendChild(t); h.appendChild(btn); c.appendChild(h);
|
|
77
|
-
__list = document.createElement('div');
|
|
78
|
-
c.appendChild(__list); __overlay.appendChild(c);
|
|
79
|
-
document.body.appendChild(__overlay);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function addError(type, message, stack) {
|
|
83
|
-
if (__errors.length >= ${maxErrors}) __errors.shift();
|
|
84
|
-
__errors.push({ type: type, message: message, stack: stack });
|
|
85
|
-
if (!__overlay) createOverlay();
|
|
86
|
-
__overlay.style.display = 'block';
|
|
87
|
-
|
|
88
|
-
var item = document.createElement('div');
|
|
89
|
-
item.setAttribute('style','padding:12px 16px;margin-bottom:8px;background:#222;border-left:3px solid #ff5555;border-radius:4px;');
|
|
90
|
-
|
|
91
|
-
var label = type === 'error' ? 'Error' : type === 'rejection' ? 'Unhandled Rejection' : 'console.error';
|
|
92
|
-
item.innerHTML = '<div style="color:#888;font-size:12px;margin-bottom:4px;">' + label + '</div>' +
|
|
93
|
-
'<div style="color:#ff8888;font-size:14px;white-space:pre-wrap;word-break:break-word;font-weight:bold;">' + escapeHtml(message) + '</div>';
|
|
94
|
-
|
|
95
|
-
var src = findSource(stack);
|
|
96
|
-
if (src) item.innerHTML += renderSource(src);
|
|
97
|
-
|
|
98
|
-
if (stack) {
|
|
99
|
-
var d = document.createElement('details');
|
|
100
|
-
d.setAttribute('style','margin-top:8px;');
|
|
101
|
-
d.innerHTML = '<summary style="cursor:pointer;color:#555;font-size:12px;">Stack trace</summary>' +
|
|
102
|
-
'<pre style="margin:4px 0 0;padding:8px;font-size:12px;color:#666;white-space:pre-wrap;background:#111;border:1px solid #333;border-radius:4px;max-height:200px;overflow-y:auto;">' + escapeHtml(stack) + '</pre>';
|
|
103
|
-
item.appendChild(d);
|
|
104
|
-
}
|
|
105
|
-
__list.appendChild(item);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
window.onerror = function(msg, src, line, col, err) {
|
|
109
|
-
addError('error', msg, err && err.stack ? err.stack : '');
|
|
110
|
-
};
|
|
111
|
-
window.addEventListener('unhandledrejection', function(e) {
|
|
112
|
-
var r = e.reason;
|
|
113
|
-
addError('rejection', r instanceof Error ? r.message : String(r), r instanceof Error ? r.stack : '');
|
|
114
|
-
});
|
|
115
|
-
var _ce = console.error;
|
|
116
|
-
console.error = function() {
|
|
117
|
-
var msg = Array.prototype.slice.call(arguments).map(function(a) {
|
|
118
|
-
return typeof a === 'object' ? JSON.stringify(a) : String(a);
|
|
119
|
-
}).join(' ');
|
|
120
|
-
addError('console', msg, '');
|
|
121
|
-
_ce.apply(console, arguments);
|
|
122
|
-
};
|
|
123
|
-
window.__juxErrors = { list: function() { return __errors.slice(); }, count: function() { return __errors.length; } };
|
|
124
|
-
})();
|
|
125
|
-
</script>`;
|
|
8
|
+
return `<script src="/jux-errors.js"></script>`;
|
|
126
9
|
}
|