Add version logging and route decision logging to sx-browser
boot-init prints SX_VERSION (build timestamp) to console on startup. tryClientRoute logs why it falls through: has-data, no content, eval failed, #main-panel not found. tryEvalContent logs the actual error. Added logWarn platform function. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
|
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
|
||||||
|
var SX_VERSION = "2026-03-06T21:05:23Z";
|
||||||
|
|
||||||
function isNil(x) { return x === NIL || x === null || x === undefined; }
|
function isNil(x) { return x === NIL || x === null || x === undefined; }
|
||||||
function isSxTruthy(x) { return x !== false && !isNil(x); }
|
function isSxTruthy(x) { return x !== false && !isNil(x); }
|
||||||
@@ -2349,7 +2350,7 @@ callExpr.push(dictGet(kwargs, k)); } }
|
|||||||
})(); };
|
})(); };
|
||||||
|
|
||||||
// boot-init
|
// boot-init
|
||||||
var bootInit = function() { return (initCssTracking(), initStyleDict(), processSxScripts(NIL), processPageScripts(), sxHydrateElements(NIL), processElements(NIL)); };
|
var bootInit = function() { return (logInfo((String("sx-browser ") + String(SX_VERSION))), initCssTracking(), initStyleDict(), processSxScripts(NIL), processPageScripts(), sxHydrateElements(NIL), processElements(NIL)); };
|
||||||
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|||||||
@@ -336,6 +336,7 @@
|
|||||||
;; 5. Hydrate [data-sx] elements
|
;; 5. Hydrate [data-sx] elements
|
||||||
;; 6. Process engine elements
|
;; 6. Process engine elements
|
||||||
(do
|
(do
|
||||||
|
(log-info (str "sx-browser " SX_VERSION))
|
||||||
(init-css-tracking)
|
(init-css-tracking)
|
||||||
(init-style-dict)
|
(init-style-dict)
|
||||||
(process-sx-scripts nil)
|
(process-sx-scripts nil)
|
||||||
|
|||||||
@@ -476,6 +476,7 @@ class JSEmitter:
|
|||||||
"process-sx-scripts": "processSxScripts",
|
"process-sx-scripts": "processSxScripts",
|
||||||
"process-component-script": "processComponentScript",
|
"process-component-script": "processComponentScript",
|
||||||
"init-style-dict": "initStyleDict",
|
"init-style-dict": "initStyleDict",
|
||||||
|
"SX_VERSION": "SX_VERSION",
|
||||||
"boot-init": "bootInit",
|
"boot-init": "bootInit",
|
||||||
"resolve-mount-target": "resolveMountTarget",
|
"resolve-mount-target": "resolveMountTarget",
|
||||||
"sx-render-with-env": "sxRenderWithEnv",
|
"sx-render-with-env": "sxRenderWithEnv",
|
||||||
@@ -1288,7 +1289,9 @@ def compile_ref_to_js(
|
|||||||
parts.append(CONTINUATIONS_JS)
|
parts.append(CONTINUATIONS_JS)
|
||||||
parts.append(public_api_js(has_html, has_sx, has_dom, has_engine, has_orch, has_cssx, has_boot, has_parser, adapter_label, has_deps, has_router))
|
parts.append(public_api_js(has_html, has_sx, has_dom, has_engine, has_orch, has_cssx, has_boot, has_parser, adapter_label, has_deps, has_router))
|
||||||
parts.append(EPILOGUE)
|
parts.append(EPILOGUE)
|
||||||
return "\n".join(parts)
|
from datetime import datetime, timezone
|
||||||
|
build_ts = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
return "\n".join(parts).replace("BUILD_TIMESTAMP", build_ts)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -1312,6 +1315,7 @@ PREAMBLE = '''\
|
|||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
|
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
|
||||||
|
var SX_VERSION = "BUILD_TIMESTAMP";
|
||||||
|
|
||||||
function isNil(x) { return x === NIL || x === null || x === undefined; }
|
function isNil(x) { return x === NIL || x === null || x === undefined; }
|
||||||
function isSxTruthy(x) { return x !== false && !isNil(x); }
|
function isSxTruthy(x) { return x !== false && !isNil(x); }
|
||||||
|
|||||||
Reference in New Issue
Block a user