vasille 5.1.4 → 5.1.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/lib/dev/index.js +1 -1
- package/lib/dev/inspectable.js +7 -2
- package/lib/dev/state.js +4 -4
- package/package.json +1 -1
- package/types/dev/index.d.ts +1 -1
- package/types/dev/inspectable.d.ts +1 -0
package/lib/dev/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DevReactive } from "./core.js";
|
|
2
2
|
export { DevApp, DevPortal, DevSwitchedNode, DevWatch } from "./components.js";
|
|
3
|
-
export { executionPosition, provideId, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, } from "./inspectable.js";
|
|
3
|
+
export { executionPosition, provideId, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, errorToString, } from "./inspectable.js";
|
|
4
4
|
export { DevArrayModel, DevMapModel, DevSetModel } from "./models.js";
|
|
5
5
|
export { DevFragment, ModelId, shareStateById } from "./node.js";
|
|
6
6
|
export { DevRunner, PositionedText, positionedText, remapObject, DevTextNode, DevTag, } from "./runner.js";
|
package/lib/dev/inspectable.js
CHANGED
|
@@ -15,6 +15,11 @@ export function executionPosition(inspector, pathLineAndChar, error) {
|
|
|
15
15
|
});
|
|
16
16
|
return id;
|
|
17
17
|
}
|
|
18
|
+
export function errorToString(e) {
|
|
19
|
+
return e instanceof Error
|
|
20
|
+
? `${e.name}:${e.message}\n${e.stack}`
|
|
21
|
+
: `${e && typeof e === "object" ? e.constructor.name : typeof e}:${e}`;
|
|
22
|
+
}
|
|
18
23
|
let id = 0;
|
|
19
24
|
export function provideId() {
|
|
20
25
|
return id++;
|
|
@@ -59,7 +64,7 @@ export function runFn(fn, args, declaration, inspector) {
|
|
|
59
64
|
result.catch(e => {
|
|
60
65
|
inspector.functionThrows({
|
|
61
66
|
targetId: id,
|
|
62
|
-
error:
|
|
67
|
+
error: errorToString(e),
|
|
63
68
|
async: false,
|
|
64
69
|
time: Date.now(),
|
|
65
70
|
});
|
|
@@ -80,7 +85,7 @@ export function runFn(fn, args, declaration, inspector) {
|
|
|
80
85
|
catch (e) {
|
|
81
86
|
inspector.functionThrows({
|
|
82
87
|
targetId: id,
|
|
83
|
-
error:
|
|
88
|
+
error: errorToString(e),
|
|
84
89
|
async: false,
|
|
85
90
|
time: Date.now(),
|
|
86
91
|
});
|
package/lib/dev/state.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IValue } from "../core/ivalue.js";
|
|
2
|
-
import { provideId, toDevValue, } from "./inspectable.js";
|
|
2
|
+
import { errorToString, provideId, toDevValue, } from "./inspectable.js";
|
|
3
3
|
export class DevIValue extends IValue {
|
|
4
4
|
}
|
|
5
5
|
export class BaseDevReference extends DevIValue {
|
|
@@ -74,7 +74,7 @@ export class DevReference extends BaseDevReference {
|
|
|
74
74
|
this.inspector?.reportReferenceError({
|
|
75
75
|
targetId: this.id,
|
|
76
76
|
time: Date.now(),
|
|
77
|
-
error: error
|
|
77
|
+
error: errorToString(error),
|
|
78
78
|
position: position,
|
|
79
79
|
});
|
|
80
80
|
}
|
|
@@ -94,7 +94,7 @@ export class ExpressionDevReference extends BaseDevReference {
|
|
|
94
94
|
this.inspector?.reportReferenceError({
|
|
95
95
|
targetId: this.id,
|
|
96
96
|
time: Date.now(),
|
|
97
|
-
error: error
|
|
97
|
+
error: errorToString(error),
|
|
98
98
|
position: position,
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -129,7 +129,7 @@ export class DevExpression extends IValue {
|
|
|
129
129
|
inspector?.reportExpressionCalculationError({
|
|
130
130
|
targetId: id,
|
|
131
131
|
time: Date.now(),
|
|
132
|
-
error: e
|
|
132
|
+
error: errorToString(e),
|
|
133
133
|
position: position,
|
|
134
134
|
deps: this.valuesCache.map(toDevValue),
|
|
135
135
|
});
|
package/package.json
CHANGED
package/types/dev/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DevReactive } from "./core.js";
|
|
2
2
|
export { DevApp, DevPortal, DevSwitchedNode, DevWatch } from "./components.js";
|
|
3
|
-
export { type Dependency, type DevValue, type Inspectable, type InspectableReactive, type InspectableReference, type Inspector, type StaticPosition, type ExecutionPosition, type ProtocolExecutionPosition, type ProtocolComponent, type ProtocolDependency, type ProtocolExpression, type ProtocolExpressionError, type ProtocolExpressionUpdate, type ProtocolModel, type ProtocolModelUpdate, type ProtocolNode, type ProtocolParent, type ProtocolPosition, type ProtocolReference, type ProtocolReferenceError, type ProtocolReferenceUpdate, type ProtocolState, type ProtocolTag, type ProtocolCustomModel, type ProtocolStore, type ProtocolRouterActionCall, type ProtocolDevValue, type ProtocolSlotError, type ProtocolRouterStateChange, type ProtocolRoutes, type ProtocolRouterTargetResult, type ProtocolFunctionError, type ProtocolFunctionResult, type ProtocolFunctionCall, type ProtocolEventTrigger, type ProtocolComposeTime, type ProtocolError, type IDevRunner, type DestroyData, executionPosition, provideId, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, } from "./inspectable.js";
|
|
3
|
+
export { type Dependency, type DevValue, type Inspectable, type InspectableReactive, type InspectableReference, type Inspector, type StaticPosition, type ExecutionPosition, type ProtocolExecutionPosition, type ProtocolComponent, type ProtocolDependency, type ProtocolExpression, type ProtocolExpressionError, type ProtocolExpressionUpdate, type ProtocolModel, type ProtocolModelUpdate, type ProtocolNode, type ProtocolParent, type ProtocolPosition, type ProtocolReference, type ProtocolReferenceError, type ProtocolReferenceUpdate, type ProtocolState, type ProtocolTag, type ProtocolCustomModel, type ProtocolStore, type ProtocolRouterActionCall, type ProtocolDevValue, type ProtocolSlotError, type ProtocolRouterStateChange, type ProtocolRoutes, type ProtocolRouterTargetResult, type ProtocolFunctionError, type ProtocolFunctionResult, type ProtocolFunctionCall, type ProtocolEventTrigger, type ProtocolComposeTime, type ProtocolError, type IDevRunner, type DestroyData, executionPosition, provideId, runFn, wrapFn, registerReference, toDevId, toDevIdOrValue, toDevObject, toDevValue, errorToString, } from "./inspectable.js";
|
|
4
4
|
export { DevArrayModel, DevMapModel, DevSetModel } from "./models.js";
|
|
5
5
|
export { DevFragment, ModelId, shareStateById } from "./node.js";
|
|
6
6
|
export { DevRunner, PositionedText, type DevTagOptions, positionedText, remapObject, DevTextNode, DevTag, } from "./runner.js";
|
|
@@ -3,6 +3,7 @@ import { DevReference } from "./state.js";
|
|
|
3
3
|
export type StaticPosition = [string, number, number, number, number];
|
|
4
4
|
export type ExecutionPosition = number;
|
|
5
5
|
export declare function executionPosition(inspector: Inspector, pathLineAndChar: StaticPosition, error: Error): ExecutionPosition;
|
|
6
|
+
export declare function errorToString(e: unknown): string;
|
|
6
7
|
export interface Inspectable {
|
|
7
8
|
id: number;
|
|
8
9
|
}
|