vasille 5.1.3 → 5.1.5

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 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";
@@ -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++;
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 instanceof Error ? `${error.message}\n${error.stack}` : `${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 instanceof Error ? `${error.message}\n${error.stack}` : `${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 instanceof Error ? `${e.message}\n${e.stack}` : `${e}`,
132
+ error: errorToString(e),
133
133
  position: position,
134
134
  deps: this.valuesCache.map(toDevValue),
135
135
  });
@@ -46,6 +46,7 @@ export class RepeatNode extends Fragment {
46
46
  }
47
47
  destroy() {
48
48
  this.nodes.clear();
49
+ super.destroy();
49
50
  }
50
51
  newChild(_id, _item) {
51
52
  return new Fragment(this.runner);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The same framework which is designed to build bulletproof frontends (core library).",
4
4
  "main": "lib/index.js",
5
5
  "types": "types/index.d.ts",
6
- "version": "5.1.3",
6
+ "version": "5.1.5",
7
7
  "exports": {
8
8
  ".": {
9
9
  "types": "./types/index.d.ts",
@@ -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
  }