@zenithbuild/runtime 0.6.5 → 0.6.6
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/diagnostics.js +29 -1
- package/package.json +10 -1
package/dist/diagnostics.js
CHANGED
|
@@ -79,6 +79,29 @@ function _safeJson(payload) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
function _readProcessEnv(name) {
|
|
83
|
+
const runtime = typeof globalThis !== 'undefined' ? globalThis : {};
|
|
84
|
+
const runtimeProcess = typeof process !== 'undefined'
|
|
85
|
+
? process
|
|
86
|
+
: runtime.process;
|
|
87
|
+
|
|
88
|
+
if (!runtimeProcess || typeof runtimeProcess !== 'object' || !runtimeProcess.env) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
const value = runtimeProcess.env[name];
|
|
92
|
+
return typeof value === 'string' ? value : undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function _shouldLogRuntimeError() {
|
|
96
|
+
if (_readProcessEnv('ZENITH_LOG_RUNTIME_ERRORS') === '1') {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
const isTestMode =
|
|
100
|
+
_readProcessEnv('NODE_ENV') === 'test'
|
|
101
|
+
|| _readProcessEnv('ZENITH_TEST_MODE') === '1';
|
|
102
|
+
return !isTestMode;
|
|
103
|
+
}
|
|
104
|
+
|
|
82
105
|
function _isDevDiagnosticsMode() {
|
|
83
106
|
const runtime = typeof globalThis !== 'undefined' ? globalThis : {};
|
|
84
107
|
if (runtime.__ZENITH_RUNTIME_DEV__ === true || runtime.__ZENITH_DEV__ === true) {
|
|
@@ -269,7 +292,12 @@ function _reportRuntimeError(error) {
|
|
|
269
292
|
if (!error || error.__zenithRuntimeErrorReported === true) return;
|
|
270
293
|
error.__zenithRuntimeErrorReported = true;
|
|
271
294
|
const payload = error.zenithRuntimeError;
|
|
272
|
-
if (
|
|
295
|
+
if (
|
|
296
|
+
payload
|
|
297
|
+
&& _shouldLogRuntimeError()
|
|
298
|
+
&& typeof console !== 'undefined'
|
|
299
|
+
&& typeof console.error === 'function'
|
|
300
|
+
) {
|
|
273
301
|
console.error('[Zenith Runtime]', payload);
|
|
274
302
|
}
|
|
275
303
|
_renderOverlay(payload);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenithbuild/runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -19,6 +19,15 @@
|
|
|
19
19
|
"LICENSE",
|
|
20
20
|
"package.json"
|
|
21
21
|
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/zenithbuild/framework",
|
|
25
|
+
"directory": "packages/runtime"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/zenithbuild/framework/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/zenithbuild/framework#readme",
|
|
22
31
|
"scripts": {
|
|
23
32
|
"build": "mkdir -p dist && cp -a src/* dist/",
|
|
24
33
|
"test": "npm run build && NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.js",
|