@dxos/debug 0.8.4-main.c1de068 → 0.8.4-main.c4373fc
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/lib/browser/index.mjs +73 -17
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +73 -17
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -3,9 +3,26 @@ var checkType = (value) => value;
|
|
|
3
3
|
|
|
4
4
|
// src/error-handler.ts
|
|
5
5
|
import { EventEmitter } from "@dxos/node-std/events";
|
|
6
|
+
function _define_property(obj, key, value) {
|
|
7
|
+
if (key in obj) {
|
|
8
|
+
Object.defineProperty(obj, key, {
|
|
9
|
+
value,
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true
|
|
13
|
+
});
|
|
14
|
+
} else {
|
|
15
|
+
obj[key] = value;
|
|
16
|
+
}
|
|
17
|
+
return obj;
|
|
18
|
+
}
|
|
6
19
|
var ErrorHandler = class extends EventEmitter {
|
|
20
|
+
reset() {
|
|
21
|
+
window.removeEventListener("error", this._listener);
|
|
22
|
+
window.removeEventListener("unhandledrejection", this._listener);
|
|
23
|
+
}
|
|
7
24
|
constructor() {
|
|
8
|
-
super();
|
|
25
|
+
super(), _define_property(this, "_listener", void 0);
|
|
9
26
|
this._listener = (event) => {
|
|
10
27
|
const cause = event.error || event.reason || event;
|
|
11
28
|
const message = cause.stack || cause.message || cause.toString();
|
|
@@ -14,17 +31,23 @@ var ErrorHandler = class extends EventEmitter {
|
|
|
14
31
|
window.addEventListener("error", this._listener);
|
|
15
32
|
window.addEventListener("unhandledrejection", this._listener);
|
|
16
33
|
}
|
|
17
|
-
reset() {
|
|
18
|
-
window.removeEventListener("error", this._listener);
|
|
19
|
-
window.removeEventListener("unhandledrejection", this._listener);
|
|
20
|
-
}
|
|
21
34
|
};
|
|
22
35
|
|
|
23
36
|
// src/error-stream.ts
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
function _define_property2(obj, key, value) {
|
|
38
|
+
if (key in obj) {
|
|
39
|
+
Object.defineProperty(obj, key, {
|
|
40
|
+
value,
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
obj[key] = value;
|
|
27
47
|
}
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
var ErrorStream = class {
|
|
28
51
|
assertNoUnhandledErrors() {
|
|
29
52
|
if (this._unhandledErrors > 0) {
|
|
30
53
|
throw new Error(`Assertion failed: expected no unhandled errors to be thrown, but ${this._unhandledErrors} were thrown.`);
|
|
@@ -49,6 +72,10 @@ var ErrorStream = class {
|
|
|
49
72
|
throw error;
|
|
50
73
|
});
|
|
51
74
|
}
|
|
75
|
+
constructor() {
|
|
76
|
+
_define_property2(this, "_handler", void 0);
|
|
77
|
+
_define_property2(this, "_unhandledErrors", 0);
|
|
78
|
+
}
|
|
52
79
|
};
|
|
53
80
|
|
|
54
81
|
// src/fail.ts
|
|
@@ -89,12 +116,25 @@ var raise = (error) => {
|
|
|
89
116
|
};
|
|
90
117
|
|
|
91
118
|
// src/snoop.ts
|
|
92
|
-
|
|
119
|
+
function _define_property3(obj, key, value) {
|
|
120
|
+
if (key in obj) {
|
|
121
|
+
Object.defineProperty(obj, key, {
|
|
122
|
+
value,
|
|
123
|
+
enumerable: true,
|
|
124
|
+
configurable: true,
|
|
125
|
+
writable: true
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
obj[key] = value;
|
|
129
|
+
}
|
|
130
|
+
return obj;
|
|
131
|
+
}
|
|
132
|
+
var SnoopLevel = /* @__PURE__ */ (function(SnoopLevel2) {
|
|
93
133
|
SnoopLevel2[SnoopLevel2["DEFAULT"] = 0] = "DEFAULT";
|
|
94
134
|
SnoopLevel2[SnoopLevel2["VERBOSE"] = 1] = "VERBOSE";
|
|
95
135
|
SnoopLevel2[SnoopLevel2["BOLD"] = 2] = "BOLD";
|
|
96
136
|
return SnoopLevel2;
|
|
97
|
-
}({});
|
|
137
|
+
})({});
|
|
98
138
|
var Snoop = class _Snoop {
|
|
99
139
|
static stackFunction(err) {
|
|
100
140
|
const stack = err.stack.split("\n");
|
|
@@ -104,9 +144,6 @@ var Snoop = class _Snoop {
|
|
|
104
144
|
return `[${file.substring(file.lastIndexOf("/") + 1)}:${line}]`;
|
|
105
145
|
}
|
|
106
146
|
}
|
|
107
|
-
constructor(_context) {
|
|
108
|
-
this._context = _context;
|
|
109
|
-
}
|
|
110
147
|
get verbose() {
|
|
111
148
|
return 1;
|
|
112
149
|
}
|
|
@@ -147,14 +184,28 @@ var Snoop = class _Snoop {
|
|
|
147
184
|
return r;
|
|
148
185
|
};
|
|
149
186
|
}
|
|
187
|
+
constructor(_context) {
|
|
188
|
+
_define_property3(this, "_context", void 0);
|
|
189
|
+
this._context = _context;
|
|
190
|
+
}
|
|
150
191
|
};
|
|
151
192
|
var snoop = new Snoop();
|
|
152
193
|
|
|
153
194
|
// src/stack-trace.ts
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
195
|
+
function _define_property4(obj, key, value) {
|
|
196
|
+
if (key in obj) {
|
|
197
|
+
Object.defineProperty(obj, key, {
|
|
198
|
+
value,
|
|
199
|
+
enumerable: true,
|
|
200
|
+
configurable: true,
|
|
201
|
+
writable: true
|
|
202
|
+
});
|
|
203
|
+
} else {
|
|
204
|
+
obj[key] = value;
|
|
157
205
|
}
|
|
206
|
+
return obj;
|
|
207
|
+
}
|
|
208
|
+
var StackTrace = class {
|
|
158
209
|
/**
|
|
159
210
|
* Get stack formatted as string.
|
|
160
211
|
* @param skipFrames Number of frames to skip. By default, the first frame would be the invocation of the StackTrace constructor.
|
|
@@ -168,6 +219,10 @@ var StackTrace = class {
|
|
|
168
219
|
const stack = this._stack.stack.split("\n");
|
|
169
220
|
return stack.slice(skipFrames + 2);
|
|
170
221
|
}
|
|
222
|
+
constructor() {
|
|
223
|
+
_define_property4(this, "_stack", void 0);
|
|
224
|
+
this._stack = new Error();
|
|
225
|
+
}
|
|
171
226
|
};
|
|
172
227
|
|
|
173
228
|
// src/strings.ts
|
|
@@ -230,7 +285,8 @@ var todo = (message) => {
|
|
|
230
285
|
var devtoolsFormatter = Symbol.for("devtoolsFormatter");
|
|
231
286
|
var register = () => {
|
|
232
287
|
if (typeof window !== "undefined") {
|
|
233
|
-
|
|
288
|
+
var _window;
|
|
289
|
+
((_window = window).devtoolsFormatters ?? (_window.devtoolsFormatters = [])).push({
|
|
234
290
|
header: (value, config) => {
|
|
235
291
|
const formatter = value[devtoolsFormatter];
|
|
236
292
|
if (formatter === void 0) {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/assert.ts", "../../../src/error-handler.ts", "../../../src/error-stream.ts", "../../../src/fail.ts", "../../../src/inspect.ts", "../../../src/log-method.ts", "../../../src/raise.ts", "../../../src/snoop.ts", "../../../src/stack-trace.ts", "../../../src/strings.ts", "../../../src/throw.ts", "../../../src/timeout-warning.ts", "../../../src/todo.ts", "../../../src/devtools-formatter.ts", "../../../src/equality.ts", "../../../src/exposed-modules.ts", "../../../src/inspect-custom.ts"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * A simple syntax sugar to write `value as T` as a statement.\n *\n * NOTE: This does not provide any type safety.\n * It's just for convenience so that autocomplete works for value.\n * It's recommended to check the type URL manually beforehand or use `assertAnyType` instead.\n * @param value\n */\nexport const checkType = <T>(value: T): T => value;\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { EventEmitter } from 'node:events';\n\n/**\n * Listens for global errors.\n */\nexport class ErrorHandler extends EventEmitter {\n _listener: EventListener;\n\n constructor() {\n super();\n\n this._listener = (event: any) => {\n const cause = event.error || event.reason || event;\n const message = cause.stack || cause.message || cause.toString();\n this.emit('error', message);\n\n // Default logging.\n // code event.preventDefault();\n };\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event\n window.addEventListener('error', this._listener);\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event\n window.addEventListener('unhandledrejection', this._listener);\n }\n\n reset(): void {\n window.removeEventListener('error', this._listener);\n window.removeEventListener('unhandledrejection', this._listener);\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nexport type ErrorHandlerCallback = (error: Error) => void;\n\n/**\n * Represents a stream of errors that entities can expose.\n */\nexport class ErrorStream {\n private _handler: ErrorHandlerCallback | undefined;\n\n private _unhandledErrors = 0;\n\n assertNoUnhandledErrors(): void {\n if (this._unhandledErrors > 0) {\n throw new Error(\n `Assertion failed: expected no unhandled errors to be thrown, but ${this._unhandledErrors} were thrown.`,\n );\n }\n }\n\n raise(error: Error): void {\n if (this._handler) {\n this._handler(error);\n } else {\n this._unhandledError(error);\n }\n }\n\n handle(handler: ErrorHandlerCallback): void {\n this._handler = handler;\n }\n\n pipeTo(receiver: ErrorStream): void {\n this.handle((error) => receiver.raise(error));\n }\n\n private _unhandledError(error: Error): void {\n this._unhandledErrors++;\n\n setTimeout(() => {\n throw error;\n });\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\n/**\n * Should be used in expressions where values are cheked not to be null or undefined.\n *\n * Example:\n *\n * ```\n * const value: string | undefined;\n *\n * callMethod(value ?? failUndefined());\n * ```\n */\n// TODO(burdon): Rename failIfUndefined().\nexport const failUndefined = () => {\n throw new Error('Required value was null or undefined.');\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\n/**\n * Utility to automatically log debug info.\n *\n * ```\n * // Called via `console.log`.\n * [inspect.custom] () {\n * return inspectObject(this);\n * }\n *\n * // Called via `JSON.stringify`.\n * toJSON () {\n * return { ... };\n * }\n * ```\n */\nexport const inspectObject = (obj: any) => {\n const name = Object.getPrototypeOf(obj).constructor.name;\n return obj.toJSON ? `${name}(${inspect(obj.toJSON())})` : String(obj);\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nexport function logMethod(\n target: any,\n propertyName: string,\n descriptor: TypedPropertyDescriptor<(...args: any) => any>,\n): void {\n const method = descriptor.value!;\n descriptor.value = function (this: any, ...args: any) {\n console.log(`Called ${target.constructor.name}.${propertyName} ${args}`);\n try {\n const result = method.apply(this, args);\n if (typeof result.catch === 'function') {\n result.catch((err: any) => {\n console.log(`Rejected ${target.constructor.name}.${propertyName}`, err);\n });\n }\n return result;\n } catch (err: any) {\n console.log(`Thrown ${target.constructor.name}.${propertyName}`, err);\n throw err;\n }\n };\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * Immediatelly throws an error passed as an argument.\n *\n * Usefull for throwing errors from inside expressions.\n * For example:\n * ```\n * const item = model.getById(someId) ?? raise(new Error('Not found'));\n * ```\n * @param error\n */\nexport const raise = (error: Error): never => {\n throw error;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport enum SnoopLevel {\n DEFAULT = 0,\n VERBOSE = 1,\n BOLD = 2,\n}\n\n/**\n * Utils for debug logging of functions.\n */\n// TODO(burdon): Integrate with log/spyglass.\nexport class Snoop {\n static stackFunction(err: Error): string | undefined {\n const stack = err.stack!.split('\\n');\n const match = stack[2].match(/.+\\((.+)\\).*/);\n if (match) {\n const [file, line] = match[1].split(':');\n return `[${file.substring(file.lastIndexOf('/') + 1)}:${line}]`;\n }\n }\n\n constructor(private readonly _context?: string) {}\n\n get verbose() {\n return SnoopLevel.VERBOSE;\n }\n\n get bold() {\n return SnoopLevel.BOLD;\n }\n\n format(prefix: string, name: string, args: string, level: SnoopLevel): string {\n const pre = prefix.repeat(level === SnoopLevel.BOLD ? 8 : 2);\n const label = this._context ? `${this._context}.${name}` : name;\n const line = `${pre} ${label}${args}`;\n return level === SnoopLevel.BOLD ? [pre, line, pre].join('\\n') : line;\n }\n\n in(label: string, level: SnoopLevel, ...args: any[]): string {\n return this.format('<', label, level === SnoopLevel.DEFAULT ? '' : `(${String(...args)})`, level);\n }\n\n out(label: string, level: SnoopLevel, result: any): string {\n return this.format('>', label, level === SnoopLevel.DEFAULT ? '' : ` = ${String(result)}`, level);\n }\n\n sync(f: any, label?: string, level: SnoopLevel = SnoopLevel.VERBOSE) {\n label = label ?? Snoop.stackFunction(new Error());\n return (...args: any[]) => {\n console.log(this.in(label ?? '', level, ...args));\n const r = f(...args);\n console.log(this.out(label ?? '', level, r));\n return r;\n };\n }\n\n async(f: any, label?: string, level: SnoopLevel = SnoopLevel.VERBOSE) {\n label = label ?? Snoop.stackFunction(new Error());\n return async (...args: any[]) => {\n console.log(this.in(label ?? '', level, ...args));\n const r = await f(...args);\n console.log(this.out(label ?? '', level, r));\n return r;\n };\n }\n}\n\nexport const snoop = new Snoop();\n", "//\n// Copyright 2021 DXOS.org\n//\n\n/**\n * Will capture the stack trace at the point where the class is created.\n * Stack traces are formatted lazily only when `getStack` is called.\n * Formatting is significantly more expensive than capture so only call getStack when you need them.\n */\nexport class StackTrace {\n private _stack: Error;\n\n constructor() {\n this._stack = new Error();\n }\n\n /**\n * Get stack formatted as string.\n * @param skipFrames Number of frames to skip. By default, the first frame would be the invocation of the StackTrace constructor.\n * @returns\n */\n getStack(skipFrames = 0): string {\n const stack = this._stack.stack!.split('\\n');\n return stack.slice(skipFrames + 2).join('\\n');\n }\n\n getStackArray(skipFrames = 0): string[] {\n const stack = this._stack.stack!.split('\\n');\n return stack.slice(skipFrames + 2);\n }\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\nexport const truncate = (str = '', length = 8, pad: boolean | string = false) => {\n if (str.length >= length - 1) {\n return str.substring(0, length - 1) + '…';\n } else {\n return pad ? str.padEnd(length, typeof pad === 'boolean' ? ' ' : pad[0]) : str;\n }\n};\n\nexport const truncateKey = (key: any, length = 8) => {\n const str = String(key);\n if (str.length <= length) {\n return str;\n }\n\n return str.slice(0, length);\n\n // return start\n // ? `${str.slice(0, length)}...`\n // : `${str.substring(0, length / 2)}...${str.substring(str.length - length / 2)}`;\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * Wrapper for async tests.\n * @param {Function} test - Async test\n * @param errType\n * @return {Promise<void>}\n *\n * @deprecated Use vitests `expect(() => ...).toThrowError();` instead.\n */\nexport const expectToThrow = async (test: () => void, errType = Error) => {\n let thrown;\n try {\n await test();\n } catch (err) {\n thrown = err;\n }\n\n if (thrown === undefined || !(thrown instanceof errType)) {\n throw new Error(`Expected function to throw instance of ${errType.prototype.name}`);\n }\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { StackTrace } from './stack-trace';\n\n/**\n * Prints a warning to console if the action takes longer then specified timeout. No errors are thrown.\n *\n * @param timeout Timeout in milliseconds after which warning is printed.\n * @param context Context description that would be included in the printed message.\n * @param body Action which is timed.\n */\nexport const warnAfterTimeout = async <T>(timeout: number, context: string, body: () => Promise<T>): Promise<T> => {\n const stack = new StackTrace();\n const timeoutId = setTimeout(() => {\n console.warn(\n `Action \\`${context}\\` is taking more then ${timeout.toLocaleString()}ms to complete. This might be a bug.\\n${stack.getStack()}`,\n );\n }, timeout);\n try {\n return await body();\n } finally {\n clearTimeout(timeoutId);\n }\n};\n\n/**\n * A decorator that prints a warning to console if method execution time exceeds specified timeout.\n *\n * ```typescript\n * class Foo {\n * @timed(5_000)\n * async doStuff() {\n * // long task\n * }\n * }\n * ```\n *\n * This is useful for debugging code that might deadlock.\n *\n * @param timeout Timeout in milliseconds after which the warning is printed.\n */\nexport function timed(timeout: number) {\n return (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<(...args: any) => any>) => {\n const method = descriptor.value!;\n descriptor.value = function (this: any, ...args: any) {\n return warnAfterTimeout(timeout, `${target.constructor.name}.${propertyName}`, () => method.apply(this, args));\n };\n };\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * Throws an error. Can be used in an expression instead of a value\n */\nexport const todo = (message?: string): never => {\n throw new Error(message ?? 'Not implemented.');\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Lets types provide custom formatters for the Chrome Devtools.\n *\n * https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html\n * NOTE: Must be enabled in chrome devtools preferences.\n *\n * @example\n * ```typescript\n * class MyType {\n * get [devtoolsFormatter] (): DevtoolsFormatter {\n * ...\n * }\n * ```\n */\n\nexport const devtoolsFormatter = Symbol.for('devtoolsFormatter');\n\nexport type JsonML = [string, Record<string, any>?, ...(JsonML | string)[]];\n\nexport interface DevtoolsFormatter {\n /**\n * NOTE: Make sure to do an instance check and return null if the object is not of the correct type.\n */\n header: (config?: any) => JsonML | null;\n hasBody?: (config?: any) => boolean;\n body?: (config?: any) => JsonML | null;\n}\n\n/**\n * Types that implement this interface can provide custom formatters for the Chrome Devtools.\n *\n * https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n */\nexport interface CustomDevtoolsFormattable {\n get [devtoolsFormatter](): DevtoolsFormatter;\n}\n\nconst register = () => {\n if (typeof window !== 'undefined') {\n ((window as any).devtoolsFormatters ??= []).push({\n header: (value: any, config: any) => {\n const formatter = value[devtoolsFormatter];\n if (formatter === undefined) {\n return null;\n }\n if (typeof formatter !== 'object' || formatter === null || typeof formatter.header !== 'function') {\n throw new Error(`Invalid devtools formatter for ${value.constructor.name}`);\n }\n\n return formatter.header(config);\n },\n hasBody: (value: any, config: any) => {\n const formatter = value[devtoolsFormatter];\n if (!formatter || !formatter.hasBody) {\n return false;\n }\n\n return formatter.hasBody(config);\n },\n body: (value: any, config: any) => {\n const formatter = value[devtoolsFormatter];\n if (!formatter || !formatter.body) {\n return null;\n }\n\n return formatter.body(config);\n },\n });\n }\n};\n\nregister();\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const equalsSymbol = Symbol.for('dxos.common.equals');\n\nexport interface Equatable {\n [equalsSymbol]: (other: any) => boolean;\n}\n\n// TODO(dmaretskyi): export to @dxos/traits.\n// TODO(dmaretskyi): Hash trait for maps?\n\nexport const isEquatable = (value: any): value is Equatable => {\n return typeof value === 'object' && value !== null && typeof value[equalsSymbol] === 'function';\n};\n\nexport const isEqual = (value: Equatable, other: any) => {\n return value[equalsSymbol](other);\n};\n\n/**\n * Feed this as a third argument to `_.isEqualWith` to compare objects with `Equatable` interface.\n */\nexport const loadashEqualityFn = (value: any, other: any): boolean | undefined => {\n if (!isEquatable(value)) {\n return undefined;\n }\n return isEqual(value, other);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Allows to register a module to be used later during debugging.\n *\n * ```ts\n * import * as keys from '@dxos/keys';\n * exposeModule('@dxos/keys', keys);\n *\n * ...\n *\n * const { PublicKey } = importModule('@dxos/keys');\n * ```\n *\n * Overwrites the module if it already exists.\n */\nexport const exposeModule = (name: string, module: any) => {\n EXPOSED_MODULES[name] = module;\n};\n\n/**\n * Imports a previously exposed module by its name.\n * Throws an error if the module is not found.\n *\n * @param {string} name - The name of the module to import.\n * @returns {any} The imported module.\n * @throws {Error} If the module is not exposed.\n */\nexport const importModule = (name: string) => {\n if (EXPOSED_MODULES[name]) {\n return EXPOSED_MODULES[name];\n } else {\n throw new Error(`Module ${name} is not exposed.`);\n }\n};\n\nconst EXPOSED_MODULES: Record<string, any> = {};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { InspectOptionsStylized, inspect as inspectFn } from 'node:util';\n\n/**\n * Using this allows code to be written in a portable fashion, so that the custom inspect function is used in an Node.js environment and ignored in the browser.\n */\nexport const inspectCustom = Symbol.for('nodejs.util.inspect.custom');\n\nexport type CustomInspectFunction<T = any> = (\n this: T,\n depth: number,\n options: InspectOptionsStylized,\n inspect: typeof inspectFn,\n) => any; // TODO: , inspect: inspect\n\nexport interface CustomInspectable {\n [inspectCustom]: CustomInspectFunction;\n}\n"],
|
|
5
|
-
"mappings": ";AAYO,IA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AO;AACL,UAAM,IAAII,MAAM,UAAUJ,IAAAA,kBAAsB;EAClD;AACF;AAEA,IAAME,kBAAuC,CAAC;;;AC7BvC,IAAMG,gBAAgBC,OAAOC,IAAI,4BAAA;",
|
|
6
|
+
"names": ["checkType", "value", "EventEmitter", "ErrorHandler", "EventEmitter", "reset", "window", "removeEventListener", "_listener", "event", "cause", "error", "reason", "message", "stack", "toString", "emit", "addEventListener", "ErrorStream", "assertNoUnhandledErrors", "_unhandledErrors", "Error", "raise", "error", "_handler", "_unhandledError", "handle", "handler", "pipeTo", "receiver", "setTimeout", "_define_property", "failUndefined", "Error", "inspect", "inspectObject", "obj", "name", "Object", "getPrototypeOf", "toJSON", "inspect", "String", "logMethod", "target", "propertyName", "descriptor", "method", "value", "args", "console", "log", "name", "result", "apply", "catch", "err", "raise", "error", "SnoopLevel", "Snoop", "stackFunction", "err", "stack", "split", "match", "file", "line", "substring", "lastIndexOf", "verbose", "bold", "format", "prefix", "name", "args", "level", "pre", "repeat", "label", "_context", "join", "in", "String", "out", "result", "sync", "f", "Error", "console", "log", "r", "async", "snoop", "_define_property", "StackTrace", "getStack", "skipFrames", "stack", "_stack", "split", "slice", "join", "getStackArray", "_define_property", "Error", "truncate", "str", "length", "pad", "substring", "padEnd", "truncateKey", "key", "String", "slice", "expectToThrow", "test", "errType", "Error", "thrown", "err", "undefined", "prototype", "name", "warnAfterTimeout", "timeout", "context", "body", "stack", "StackTrace", "timeoutId", "setTimeout", "console", "warn", "toLocaleString", "getStack", "clearTimeout", "timed", "target", "propertyName", "descriptor", "method", "value", "args", "name", "apply", "todo", "message", "Error", "devtoolsFormatter", "Symbol", "for", "register", "window", "devtoolsFormatters", "push", "header", "value", "config", "formatter", "undefined", "Error", "name", "hasBody", "body", "equalsSymbol", "Symbol", "for", "isEquatable", "value", "isEqual", "other", "loadashEqualityFn", "undefined", "exposeModule", "name", "module", "EXPOSED_MODULES", "importModule", "Error", "inspectCustom", "Symbol", "for"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/assert.ts":{"bytes":1281,"imports":[],"format":"esm"},"src/error-handler.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/assert.ts":{"bytes":1281,"imports":[],"format":"esm"},"src/error-handler.ts":{"bytes":3900,"imports":[{"path":"@dxos/node-std/events","kind":"import-statement","external":true}],"format":"esm"},"src/error-stream.ts":{"bytes":3839,"imports":[],"format":"esm"},"src/fail.ts":{"bytes":1344,"imports":[],"format":"esm"},"src/inspect.ts":{"bytes":1936,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"src/log-method.ts":{"bytes":2983,"imports":[],"format":"esm"},"src/raise.ts":{"bytes":1188,"imports":[],"format":"esm"},"src/snoop.ts":{"bytes":8252,"imports":[],"format":"esm"},"src/stack-trace.ts":{"bytes":3362,"imports":[],"format":"esm"},"src/strings.ts":{"bytes":2473,"imports":[],"format":"esm"},"src/throw.ts":{"bytes":2059,"imports":[],"format":"esm"},"src/timeout-warning.ts":{"bytes":5062,"imports":[{"path":"src/stack-trace.ts","kind":"import-statement","original":"./stack-trace"}],"format":"esm"},"src/todo.ts":{"bytes":907,"imports":[],"format":"esm"},"src/devtools-formatter.ts":{"bytes":6215,"imports":[],"format":"esm"},"src/equality.ts":{"bytes":2711,"imports":[],"format":"esm"},"src/exposed-modules.ts":{"bytes":2948,"imports":[],"format":"esm"},"src/inspect-custom.ts":{"bytes":1537,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1931,"imports":[{"path":"src/assert.ts","kind":"import-statement","original":"./assert"},{"path":"src/error-handler.ts","kind":"import-statement","original":"./error-handler"},{"path":"src/error-stream.ts","kind":"import-statement","original":"./error-stream"},{"path":"src/fail.ts","kind":"import-statement","original":"./fail"},{"path":"src/inspect.ts","kind":"import-statement","original":"./inspect"},{"path":"src/log-method.ts","kind":"import-statement","original":"./log-method"},{"path":"src/raise.ts","kind":"import-statement","original":"./raise"},{"path":"src/snoop.ts","kind":"import-statement","original":"./snoop"},{"path":"src/stack-trace.ts","kind":"import-statement","original":"./stack-trace"},{"path":"src/strings.ts","kind":"import-statement","original":"./strings"},{"path":"src/throw.ts","kind":"import-statement","original":"./throw"},{"path":"src/timeout-warning.ts","kind":"import-statement","original":"./timeout-warning"},{"path":"src/todo.ts","kind":"import-statement","original":"./todo"},{"path":"src/devtools-formatter.ts","kind":"import-statement","original":"./devtools-formatter"},{"path":"src/equality.ts","kind":"import-statement","original":"./equality"},{"path":"src/exposed-modules.ts","kind":"import-statement","original":"./exposed-modules"},{"path":"src/inspect-custom.ts","kind":"import-statement","original":"./inspect-custom"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":24200},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/events","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"exports":["ErrorHandler","ErrorStream","Snoop","SnoopLevel","StackTrace","checkType","devtoolsFormatter","equalsSymbol","expectToThrow","exposeModule","failUndefined","importModule","inspectCustom","inspectObject","isEqual","isEquatable","loadashEqualityFn","logMethod","raise","snoop","timed","todo","truncate","truncateKey","warnAfterTimeout"],"entryPoint":"src/index.ts","inputs":{"src/assert.ts":{"bytesInOutput":34},"src/index.ts":{"bytesInOutput":0},"src/error-handler.ts":{"bytesInOutput":903},"src/error-stream.ts":{"bytesInOutput":974},"src/fail.ts":{"bytesInOutput":91},"src/inspect.ts":{"bytesInOutput":214},"src/log-method.ts":{"bytesInOutput":597},"src/raise.ts":{"bytesInOutput":43},"src/snoop.ts":{"bytesInOutput":2092},"src/stack-trace.ts":{"bytesInOutput":827},"src/strings.ts":{"bytesInOutput":396},"src/throw.ts":{"bytesInOutput":290},"src/timeout-warning.ts":{"bytesInOutput":664},"src/todo.ts":{"bytesInOutput":79},"src/devtools-formatter.ts":{"bytesInOutput":1094},"src/equality.ts":{"bytesInOutput":391},"src/exposed-modules.ts":{"bytesInOutput":271},"src/inspect-custom.ts":{"bytesInOutput":62}},"bytes":9790}}}
|
|
@@ -5,9 +5,26 @@ var checkType = (value) => value;
|
|
|
5
5
|
|
|
6
6
|
// src/error-handler.ts
|
|
7
7
|
import { EventEmitter } from "node:events";
|
|
8
|
+
function _define_property(obj, key, value) {
|
|
9
|
+
if (key in obj) {
|
|
10
|
+
Object.defineProperty(obj, key, {
|
|
11
|
+
value,
|
|
12
|
+
enumerable: true,
|
|
13
|
+
configurable: true,
|
|
14
|
+
writable: true
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
obj[key] = value;
|
|
18
|
+
}
|
|
19
|
+
return obj;
|
|
20
|
+
}
|
|
8
21
|
var ErrorHandler = class extends EventEmitter {
|
|
22
|
+
reset() {
|
|
23
|
+
window.removeEventListener("error", this._listener);
|
|
24
|
+
window.removeEventListener("unhandledrejection", this._listener);
|
|
25
|
+
}
|
|
9
26
|
constructor() {
|
|
10
|
-
super();
|
|
27
|
+
super(), _define_property(this, "_listener", void 0);
|
|
11
28
|
this._listener = (event) => {
|
|
12
29
|
const cause = event.error || event.reason || event;
|
|
13
30
|
const message = cause.stack || cause.message || cause.toString();
|
|
@@ -16,17 +33,23 @@ var ErrorHandler = class extends EventEmitter {
|
|
|
16
33
|
window.addEventListener("error", this._listener);
|
|
17
34
|
window.addEventListener("unhandledrejection", this._listener);
|
|
18
35
|
}
|
|
19
|
-
reset() {
|
|
20
|
-
window.removeEventListener("error", this._listener);
|
|
21
|
-
window.removeEventListener("unhandledrejection", this._listener);
|
|
22
|
-
}
|
|
23
36
|
};
|
|
24
37
|
|
|
25
38
|
// src/error-stream.ts
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
function _define_property2(obj, key, value) {
|
|
40
|
+
if (key in obj) {
|
|
41
|
+
Object.defineProperty(obj, key, {
|
|
42
|
+
value,
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
obj[key] = value;
|
|
29
49
|
}
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
var ErrorStream = class {
|
|
30
53
|
assertNoUnhandledErrors() {
|
|
31
54
|
if (this._unhandledErrors > 0) {
|
|
32
55
|
throw new Error(`Assertion failed: expected no unhandled errors to be thrown, but ${this._unhandledErrors} were thrown.`);
|
|
@@ -51,6 +74,10 @@ var ErrorStream = class {
|
|
|
51
74
|
throw error;
|
|
52
75
|
});
|
|
53
76
|
}
|
|
77
|
+
constructor() {
|
|
78
|
+
_define_property2(this, "_handler", void 0);
|
|
79
|
+
_define_property2(this, "_unhandledErrors", 0);
|
|
80
|
+
}
|
|
54
81
|
};
|
|
55
82
|
|
|
56
83
|
// src/fail.ts
|
|
@@ -91,12 +118,25 @@ var raise = (error) => {
|
|
|
91
118
|
};
|
|
92
119
|
|
|
93
120
|
// src/snoop.ts
|
|
94
|
-
|
|
121
|
+
function _define_property3(obj, key, value) {
|
|
122
|
+
if (key in obj) {
|
|
123
|
+
Object.defineProperty(obj, key, {
|
|
124
|
+
value,
|
|
125
|
+
enumerable: true,
|
|
126
|
+
configurable: true,
|
|
127
|
+
writable: true
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
obj[key] = value;
|
|
131
|
+
}
|
|
132
|
+
return obj;
|
|
133
|
+
}
|
|
134
|
+
var SnoopLevel = /* @__PURE__ */ (function(SnoopLevel2) {
|
|
95
135
|
SnoopLevel2[SnoopLevel2["DEFAULT"] = 0] = "DEFAULT";
|
|
96
136
|
SnoopLevel2[SnoopLevel2["VERBOSE"] = 1] = "VERBOSE";
|
|
97
137
|
SnoopLevel2[SnoopLevel2["BOLD"] = 2] = "BOLD";
|
|
98
138
|
return SnoopLevel2;
|
|
99
|
-
}({});
|
|
139
|
+
})({});
|
|
100
140
|
var Snoop = class _Snoop {
|
|
101
141
|
static stackFunction(err) {
|
|
102
142
|
const stack = err.stack.split("\n");
|
|
@@ -106,9 +146,6 @@ var Snoop = class _Snoop {
|
|
|
106
146
|
return `[${file.substring(file.lastIndexOf("/") + 1)}:${line}]`;
|
|
107
147
|
}
|
|
108
148
|
}
|
|
109
|
-
constructor(_context) {
|
|
110
|
-
this._context = _context;
|
|
111
|
-
}
|
|
112
149
|
get verbose() {
|
|
113
150
|
return 1;
|
|
114
151
|
}
|
|
@@ -149,14 +186,28 @@ var Snoop = class _Snoop {
|
|
|
149
186
|
return r;
|
|
150
187
|
};
|
|
151
188
|
}
|
|
189
|
+
constructor(_context) {
|
|
190
|
+
_define_property3(this, "_context", void 0);
|
|
191
|
+
this._context = _context;
|
|
192
|
+
}
|
|
152
193
|
};
|
|
153
194
|
var snoop = new Snoop();
|
|
154
195
|
|
|
155
196
|
// src/stack-trace.ts
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
197
|
+
function _define_property4(obj, key, value) {
|
|
198
|
+
if (key in obj) {
|
|
199
|
+
Object.defineProperty(obj, key, {
|
|
200
|
+
value,
|
|
201
|
+
enumerable: true,
|
|
202
|
+
configurable: true,
|
|
203
|
+
writable: true
|
|
204
|
+
});
|
|
205
|
+
} else {
|
|
206
|
+
obj[key] = value;
|
|
159
207
|
}
|
|
208
|
+
return obj;
|
|
209
|
+
}
|
|
210
|
+
var StackTrace = class {
|
|
160
211
|
/**
|
|
161
212
|
* Get stack formatted as string.
|
|
162
213
|
* @param skipFrames Number of frames to skip. By default, the first frame would be the invocation of the StackTrace constructor.
|
|
@@ -170,6 +221,10 @@ var StackTrace = class {
|
|
|
170
221
|
const stack = this._stack.stack.split("\n");
|
|
171
222
|
return stack.slice(skipFrames + 2);
|
|
172
223
|
}
|
|
224
|
+
constructor() {
|
|
225
|
+
_define_property4(this, "_stack", void 0);
|
|
226
|
+
this._stack = new Error();
|
|
227
|
+
}
|
|
173
228
|
};
|
|
174
229
|
|
|
175
230
|
// src/strings.ts
|
|
@@ -232,7 +287,8 @@ var todo = (message) => {
|
|
|
232
287
|
var devtoolsFormatter = Symbol.for("devtoolsFormatter");
|
|
233
288
|
var register = () => {
|
|
234
289
|
if (typeof window !== "undefined") {
|
|
235
|
-
|
|
290
|
+
var _window;
|
|
291
|
+
((_window = window).devtoolsFormatters ?? (_window.devtoolsFormatters = [])).push({
|
|
236
292
|
header: (value, config) => {
|
|
237
293
|
const formatter = value[devtoolsFormatter];
|
|
238
294
|
if (formatter === void 0) {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/assert.ts", "../../../src/error-handler.ts", "../../../src/error-stream.ts", "../../../src/fail.ts", "../../../src/inspect.ts", "../../../src/log-method.ts", "../../../src/raise.ts", "../../../src/snoop.ts", "../../../src/stack-trace.ts", "../../../src/strings.ts", "../../../src/throw.ts", "../../../src/timeout-warning.ts", "../../../src/todo.ts", "../../../src/devtools-formatter.ts", "../../../src/equality.ts", "../../../src/exposed-modules.ts", "../../../src/inspect-custom.ts"],
|
|
4
4
|
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * A simple syntax sugar to write `value as T` as a statement.\n *\n * NOTE: This does not provide any type safety.\n * It's just for convenience so that autocomplete works for value.\n * It's recommended to check the type URL manually beforehand or use `assertAnyType` instead.\n * @param value\n */\nexport const checkType = <T>(value: T): T => value;\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { EventEmitter } from 'node:events';\n\n/**\n * Listens for global errors.\n */\nexport class ErrorHandler extends EventEmitter {\n _listener: EventListener;\n\n constructor() {\n super();\n\n this._listener = (event: any) => {\n const cause = event.error || event.reason || event;\n const message = cause.stack || cause.message || cause.toString();\n this.emit('error', message);\n\n // Default logging.\n // code event.preventDefault();\n };\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event\n window.addEventListener('error', this._listener);\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event\n window.addEventListener('unhandledrejection', this._listener);\n }\n\n reset(): void {\n window.removeEventListener('error', this._listener);\n window.removeEventListener('unhandledrejection', this._listener);\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\nexport type ErrorHandlerCallback = (error: Error) => void;\n\n/**\n * Represents a stream of errors that entities can expose.\n */\nexport class ErrorStream {\n private _handler: ErrorHandlerCallback | undefined;\n\n private _unhandledErrors = 0;\n\n assertNoUnhandledErrors(): void {\n if (this._unhandledErrors > 0) {\n throw new Error(\n `Assertion failed: expected no unhandled errors to be thrown, but ${this._unhandledErrors} were thrown.`,\n );\n }\n }\n\n raise(error: Error): void {\n if (this._handler) {\n this._handler(error);\n } else {\n this._unhandledError(error);\n }\n }\n\n handle(handler: ErrorHandlerCallback): void {\n this._handler = handler;\n }\n\n pipeTo(receiver: ErrorStream): void {\n this.handle((error) => receiver.raise(error));\n }\n\n private _unhandledError(error: Error): void {\n this._unhandledErrors++;\n\n setTimeout(() => {\n throw error;\n });\n }\n}\n", "//\n// Copyright 2021 DXOS.org\n//\n\n/**\n * Should be used in expressions where values are cheked not to be null or undefined.\n *\n * Example:\n *\n * ```\n * const value: string | undefined;\n *\n * callMethod(value ?? failUndefined());\n * ```\n */\n// TODO(burdon): Rename failIfUndefined().\nexport const failUndefined = () => {\n throw new Error('Required value was null or undefined.');\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\n/**\n * Utility to automatically log debug info.\n *\n * ```\n * // Called via `console.log`.\n * [inspect.custom] () {\n * return inspectObject(this);\n * }\n *\n * // Called via `JSON.stringify`.\n * toJSON () {\n * return { ... };\n * }\n * ```\n */\nexport const inspectObject = (obj: any) => {\n const name = Object.getPrototypeOf(obj).constructor.name;\n return obj.toJSON ? `${name}(${inspect(obj.toJSON())})` : String(obj);\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nexport function logMethod(\n target: any,\n propertyName: string,\n descriptor: TypedPropertyDescriptor<(...args: any) => any>,\n): void {\n const method = descriptor.value!;\n descriptor.value = function (this: any, ...args: any) {\n console.log(`Called ${target.constructor.name}.${propertyName} ${args}`);\n try {\n const result = method.apply(this, args);\n if (typeof result.catch === 'function') {\n result.catch((err: any) => {\n console.log(`Rejected ${target.constructor.name}.${propertyName}`, err);\n });\n }\n return result;\n } catch (err: any) {\n console.log(`Thrown ${target.constructor.name}.${propertyName}`, err);\n throw err;\n }\n };\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * Immediatelly throws an error passed as an argument.\n *\n * Usefull for throwing errors from inside expressions.\n * For example:\n * ```\n * const item = model.getById(someId) ?? raise(new Error('Not found'));\n * ```\n * @param error\n */\nexport const raise = (error: Error): never => {\n throw error;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport enum SnoopLevel {\n DEFAULT = 0,\n VERBOSE = 1,\n BOLD = 2,\n}\n\n/**\n * Utils for debug logging of functions.\n */\n// TODO(burdon): Integrate with log/spyglass.\nexport class Snoop {\n static stackFunction(err: Error): string | undefined {\n const stack = err.stack!.split('\\n');\n const match = stack[2].match(/.+\\((.+)\\).*/);\n if (match) {\n const [file, line] = match[1].split(':');\n return `[${file.substring(file.lastIndexOf('/') + 1)}:${line}]`;\n }\n }\n\n constructor(private readonly _context?: string) {}\n\n get verbose() {\n return SnoopLevel.VERBOSE;\n }\n\n get bold() {\n return SnoopLevel.BOLD;\n }\n\n format(prefix: string, name: string, args: string, level: SnoopLevel): string {\n const pre = prefix.repeat(level === SnoopLevel.BOLD ? 8 : 2);\n const label = this._context ? `${this._context}.${name}` : name;\n const line = `${pre} ${label}${args}`;\n return level === SnoopLevel.BOLD ? [pre, line, pre].join('\\n') : line;\n }\n\n in(label: string, level: SnoopLevel, ...args: any[]): string {\n return this.format('<', label, level === SnoopLevel.DEFAULT ? '' : `(${String(...args)})`, level);\n }\n\n out(label: string, level: SnoopLevel, result: any): string {\n return this.format('>', label, level === SnoopLevel.DEFAULT ? '' : ` = ${String(result)}`, level);\n }\n\n sync(f: any, label?: string, level: SnoopLevel = SnoopLevel.VERBOSE) {\n label = label ?? Snoop.stackFunction(new Error());\n return (...args: any[]) => {\n console.log(this.in(label ?? '', level, ...args));\n const r = f(...args);\n console.log(this.out(label ?? '', level, r));\n return r;\n };\n }\n\n async(f: any, label?: string, level: SnoopLevel = SnoopLevel.VERBOSE) {\n label = label ?? Snoop.stackFunction(new Error());\n return async (...args: any[]) => {\n console.log(this.in(label ?? '', level, ...args));\n const r = await f(...args);\n console.log(this.out(label ?? '', level, r));\n return r;\n };\n }\n}\n\nexport const snoop = new Snoop();\n", "//\n// Copyright 2021 DXOS.org\n//\n\n/**\n * Will capture the stack trace at the point where the class is created.\n * Stack traces are formatted lazily only when `getStack` is called.\n * Formatting is significantly more expensive than capture so only call getStack when you need them.\n */\nexport class StackTrace {\n private _stack: Error;\n\n constructor() {\n this._stack = new Error();\n }\n\n /**\n * Get stack formatted as string.\n * @param skipFrames Number of frames to skip. By default, the first frame would be the invocation of the StackTrace constructor.\n * @returns\n */\n getStack(skipFrames = 0): string {\n const stack = this._stack.stack!.split('\\n');\n return stack.slice(skipFrames + 2).join('\\n');\n }\n\n getStackArray(skipFrames = 0): string[] {\n const stack = this._stack.stack!.split('\\n');\n return stack.slice(skipFrames + 2);\n }\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\nexport const truncate = (str = '', length = 8, pad: boolean | string = false) => {\n if (str.length >= length - 1) {\n return str.substring(0, length - 1) + '…';\n } else {\n return pad ? str.padEnd(length, typeof pad === 'boolean' ? ' ' : pad[0]) : str;\n }\n};\n\nexport const truncateKey = (key: any, length = 8) => {\n const str = String(key);\n if (str.length <= length) {\n return str;\n }\n\n return str.slice(0, length);\n\n // return start\n // ? `${str.slice(0, length)}...`\n // : `${str.substring(0, length / 2)}...${str.substring(str.length - length / 2)}`;\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * Wrapper for async tests.\n * @param {Function} test - Async test\n * @param errType\n * @return {Promise<void>}\n *\n * @deprecated Use vitests `expect(() => ...).toThrowError();` instead.\n */\nexport const expectToThrow = async (test: () => void, errType = Error) => {\n let thrown;\n try {\n await test();\n } catch (err) {\n thrown = err;\n }\n\n if (thrown === undefined || !(thrown instanceof errType)) {\n throw new Error(`Expected function to throw instance of ${errType.prototype.name}`);\n }\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { StackTrace } from './stack-trace';\n\n/**\n * Prints a warning to console if the action takes longer then specified timeout. No errors are thrown.\n *\n * @param timeout Timeout in milliseconds after which warning is printed.\n * @param context Context description that would be included in the printed message.\n * @param body Action which is timed.\n */\nexport const warnAfterTimeout = async <T>(timeout: number, context: string, body: () => Promise<T>): Promise<T> => {\n const stack = new StackTrace();\n const timeoutId = setTimeout(() => {\n console.warn(\n `Action \\`${context}\\` is taking more then ${timeout.toLocaleString()}ms to complete. This might be a bug.\\n${stack.getStack()}`,\n );\n }, timeout);\n try {\n return await body();\n } finally {\n clearTimeout(timeoutId);\n }\n};\n\n/**\n * A decorator that prints a warning to console if method execution time exceeds specified timeout.\n *\n * ```typescript\n * class Foo {\n * @timed(5_000)\n * async doStuff() {\n * // long task\n * }\n * }\n * ```\n *\n * This is useful for debugging code that might deadlock.\n *\n * @param timeout Timeout in milliseconds after which the warning is printed.\n */\nexport function timed(timeout: number) {\n return (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<(...args: any) => any>) => {\n const method = descriptor.value!;\n descriptor.value = function (this: any, ...args: any) {\n return warnAfterTimeout(timeout, `${target.constructor.name}.${propertyName}`, () => method.apply(this, args));\n };\n };\n}\n", "//\n// Copyright 2020 DXOS.org\n//\n\n/**\n * Throws an error. Can be used in an expression instead of a value\n */\nexport const todo = (message?: string): never => {\n throw new Error(message ?? 'Not implemented.');\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Lets types provide custom formatters for the Chrome Devtools.\n *\n * https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html\n * NOTE: Must be enabled in chrome devtools preferences.\n *\n * @example\n * ```typescript\n * class MyType {\n * get [devtoolsFormatter] (): DevtoolsFormatter {\n * ...\n * }\n * ```\n */\n\nexport const devtoolsFormatter = Symbol.for('devtoolsFormatter');\n\nexport type JsonML = [string, Record<string, any>?, ...(JsonML | string)[]];\n\nexport interface DevtoolsFormatter {\n /**\n * NOTE: Make sure to do an instance check and return null if the object is not of the correct type.\n */\n header: (config?: any) => JsonML | null;\n hasBody?: (config?: any) => boolean;\n body?: (config?: any) => JsonML | null;\n}\n\n/**\n * Types that implement this interface can provide custom formatters for the Chrome Devtools.\n *\n * https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n */\nexport interface CustomDevtoolsFormattable {\n get [devtoolsFormatter](): DevtoolsFormatter;\n}\n\nconst register = () => {\n if (typeof window !== 'undefined') {\n ((window as any).devtoolsFormatters ??= []).push({\n header: (value: any, config: any) => {\n const formatter = value[devtoolsFormatter];\n if (formatter === undefined) {\n return null;\n }\n if (typeof formatter !== 'object' || formatter === null || typeof formatter.header !== 'function') {\n throw new Error(`Invalid devtools formatter for ${value.constructor.name}`);\n }\n\n return formatter.header(config);\n },\n hasBody: (value: any, config: any) => {\n const formatter = value[devtoolsFormatter];\n if (!formatter || !formatter.hasBody) {\n return false;\n }\n\n return formatter.hasBody(config);\n },\n body: (value: any, config: any) => {\n const formatter = value[devtoolsFormatter];\n if (!formatter || !formatter.body) {\n return null;\n }\n\n return formatter.body(config);\n },\n });\n }\n};\n\nregister();\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const equalsSymbol = Symbol.for('dxos.common.equals');\n\nexport interface Equatable {\n [equalsSymbol]: (other: any) => boolean;\n}\n\n// TODO(dmaretskyi): export to @dxos/traits.\n// TODO(dmaretskyi): Hash trait for maps?\n\nexport const isEquatable = (value: any): value is Equatable => {\n return typeof value === 'object' && value !== null && typeof value[equalsSymbol] === 'function';\n};\n\nexport const isEqual = (value: Equatable, other: any) => {\n return value[equalsSymbol](other);\n};\n\n/**\n * Feed this as a third argument to `_.isEqualWith` to compare objects with `Equatable` interface.\n */\nexport const loadashEqualityFn = (value: any, other: any): boolean | undefined => {\n if (!isEquatable(value)) {\n return undefined;\n }\n return isEqual(value, other);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * Allows to register a module to be used later during debugging.\n *\n * ```ts\n * import * as keys from '@dxos/keys';\n * exposeModule('@dxos/keys', keys);\n *\n * ...\n *\n * const { PublicKey } = importModule('@dxos/keys');\n * ```\n *\n * Overwrites the module if it already exists.\n */\nexport const exposeModule = (name: string, module: any) => {\n EXPOSED_MODULES[name] = module;\n};\n\n/**\n * Imports a previously exposed module by its name.\n * Throws an error if the module is not found.\n *\n * @param {string} name - The name of the module to import.\n * @returns {any} The imported module.\n * @throws {Error} If the module is not exposed.\n */\nexport const importModule = (name: string) => {\n if (EXPOSED_MODULES[name]) {\n return EXPOSED_MODULES[name];\n } else {\n throw new Error(`Module ${name} is not exposed.`);\n }\n};\n\nconst EXPOSED_MODULES: Record<string, any> = {};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { InspectOptionsStylized, inspect as inspectFn } from 'node:util';\n\n/**\n * Using this allows code to be written in a portable fashion, so that the custom inspect function is used in an Node.js environment and ignored in the browser.\n */\nexport const inspectCustom = Symbol.for('nodejs.util.inspect.custom');\n\nexport type CustomInspectFunction<T = any> = (\n this: T,\n depth: number,\n options: InspectOptionsStylized,\n inspect: typeof inspectFn,\n) => any; // TODO: , inspect: inspect\n\nexport interface CustomInspectable {\n [inspectCustom]: CustomInspectFunction;\n}\n"],
|
|
5
|
-
"mappings": ";;;AAYO,IAAMA,YAAY,CAAIC,UAAgBA;;;ACR7C,SAASC,oBAAoB
|
|
6
|
-
"names": ["checkType", "value", "EventEmitter", "ErrorHandler", "EventEmitter", "
|
|
5
|
+
"mappings": ";;;AAYO,IAAMA,YAAY,CAAIC,UAAgBA;;;ACR7C,SAASC,oBAAoB;;;;;;;;;;;;;;AAKtB,IAAMC,eAAN,cAA2BC,aAAAA;EAsBhCC,QAAc;AACZC,WAAOC,oBAAoB,SAAS,KAAKC,SAAS;AAClDF,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;AACpB,cAAMC,YAAYF,MAAMR,iBAAAA;AACxB,YAAI,CAACU,aAAa,CAACA,UAAUI,SAAS;AACpC,iBAAO;QACT;AAEA,eAAOJ,UAAUI,QAAQL,MAAAA;MAC3B;MACAM,MAAM,CAACP,OAAYC,WAAAA;AACjB,cAAMC,YAAYF,MAAMR,iBAAAA;AACxB,YAAI,CAACU,aAAa,CAACA,UAAUK,MAAM;AACjC,iBAAO;QACT;AAEA,eAAOL,UAAUK,KAAKN,MAAAA;MACxB;IACF,CAAA;EACF;AACF;AAEAN,SAAAA;;;ACvEO,IAAMa,eAAeC,OAAOC,IAAI,oBAAA;AAShC,IAAMC,cAAc,CAACC,UAAAA;AAC1B,SAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQ,OAAOA,MAAMJ,YAAAA,MAAkB;AACvF;AAEO,IAAMK,UAAU,CAACD,OAAkBE,UAAAA;AACxC,SAAOF,MAAMJ,YAAAA,EAAcM,KAAAA;AAC7B;AAKO,IAAMC,oBAAoB,CAACH,OAAYE,UAAAA;AAC5C,MAAI,CAACH,YAAYC,KAAAA,GAAQ;AACvB,WAAOI;EACT;AACA,SAAOH,QAAQD,OAAOE,KAAAA;AACxB;;;ACXO,IAAMG,eAAe,CAACC,MAAcC,WAAAA;AACzCC,kBAAgBF,IAAAA,IAAQC;AAC1B;AAUO,IAAME,eAAe,CAACH,SAAAA;AAC3B,MAAIE,gBAAgBF,IAAAA,GAAO;AACzB,WAAOE,gBAAgBF,IAAAA;EACzB,OAAO;AACL,UAAM,IAAII,MAAM,UAAUJ,IAAAA,kBAAsB;EAClD;AACF;AAEA,IAAME,kBAAuC,CAAC;;;AC7BvC,IAAMG,gBAAgBC,OAAOC,IAAI,4BAAA;",
|
|
6
|
+
"names": ["checkType", "value", "EventEmitter", "ErrorHandler", "EventEmitter", "reset", "window", "removeEventListener", "_listener", "event", "cause", "error", "reason", "message", "stack", "toString", "emit", "addEventListener", "ErrorStream", "assertNoUnhandledErrors", "_unhandledErrors", "Error", "raise", "error", "_handler", "_unhandledError", "handle", "handler", "pipeTo", "receiver", "setTimeout", "_define_property", "failUndefined", "Error", "inspect", "inspectObject", "obj", "name", "Object", "getPrototypeOf", "toJSON", "inspect", "String", "logMethod", "target", "propertyName", "descriptor", "method", "value", "args", "console", "log", "name", "result", "apply", "catch", "err", "raise", "error", "SnoopLevel", "Snoop", "stackFunction", "err", "stack", "split", "match", "file", "line", "substring", "lastIndexOf", "verbose", "bold", "format", "prefix", "name", "args", "level", "pre", "repeat", "label", "_context", "join", "in", "String", "out", "result", "sync", "f", "Error", "console", "log", "r", "async", "snoop", "_define_property", "StackTrace", "getStack", "skipFrames", "stack", "_stack", "split", "slice", "join", "getStackArray", "_define_property", "Error", "truncate", "str", "length", "pad", "substring", "padEnd", "truncateKey", "key", "String", "slice", "expectToThrow", "test", "errType", "Error", "thrown", "err", "undefined", "prototype", "name", "warnAfterTimeout", "timeout", "context", "body", "stack", "StackTrace", "timeoutId", "setTimeout", "console", "warn", "toLocaleString", "getStack", "clearTimeout", "timed", "target", "propertyName", "descriptor", "method", "value", "args", "name", "apply", "todo", "message", "Error", "devtoolsFormatter", "Symbol", "for", "register", "window", "devtoolsFormatters", "push", "header", "value", "config", "formatter", "undefined", "Error", "name", "hasBody", "body", "equalsSymbol", "Symbol", "for", "isEquatable", "value", "isEqual", "other", "loadashEqualityFn", "undefined", "exposeModule", "name", "module", "EXPOSED_MODULES", "importModule", "Error", "inspectCustom", "Symbol", "for"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/assert.ts":{"bytes":1281,"imports":[],"format":"esm"},"src/error-handler.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/assert.ts":{"bytes":1281,"imports":[],"format":"esm"},"src/error-handler.ts":{"bytes":3900,"imports":[{"path":"node:events","kind":"import-statement","external":true}],"format":"esm"},"src/error-stream.ts":{"bytes":3839,"imports":[],"format":"esm"},"src/fail.ts":{"bytes":1344,"imports":[],"format":"esm"},"src/inspect.ts":{"bytes":1936,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/log-method.ts":{"bytes":2983,"imports":[],"format":"esm"},"src/raise.ts":{"bytes":1188,"imports":[],"format":"esm"},"src/snoop.ts":{"bytes":8252,"imports":[],"format":"esm"},"src/stack-trace.ts":{"bytes":3362,"imports":[],"format":"esm"},"src/strings.ts":{"bytes":2473,"imports":[],"format":"esm"},"src/throw.ts":{"bytes":2059,"imports":[],"format":"esm"},"src/timeout-warning.ts":{"bytes":5062,"imports":[{"path":"src/stack-trace.ts","kind":"import-statement","original":"./stack-trace"}],"format":"esm"},"src/todo.ts":{"bytes":907,"imports":[],"format":"esm"},"src/devtools-formatter.ts":{"bytes":6215,"imports":[],"format":"esm"},"src/equality.ts":{"bytes":2711,"imports":[],"format":"esm"},"src/exposed-modules.ts":{"bytes":2948,"imports":[],"format":"esm"},"src/inspect-custom.ts":{"bytes":1537,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1931,"imports":[{"path":"src/assert.ts","kind":"import-statement","original":"./assert"},{"path":"src/error-handler.ts","kind":"import-statement","original":"./error-handler"},{"path":"src/error-stream.ts","kind":"import-statement","original":"./error-stream"},{"path":"src/fail.ts","kind":"import-statement","original":"./fail"},{"path":"src/inspect.ts","kind":"import-statement","original":"./inspect"},{"path":"src/log-method.ts","kind":"import-statement","original":"./log-method"},{"path":"src/raise.ts","kind":"import-statement","original":"./raise"},{"path":"src/snoop.ts","kind":"import-statement","original":"./snoop"},{"path":"src/stack-trace.ts","kind":"import-statement","original":"./stack-trace"},{"path":"src/strings.ts","kind":"import-statement","original":"./strings"},{"path":"src/throw.ts","kind":"import-statement","original":"./throw"},{"path":"src/timeout-warning.ts","kind":"import-statement","original":"./timeout-warning"},{"path":"src/todo.ts","kind":"import-statement","original":"./todo"},{"path":"src/devtools-formatter.ts","kind":"import-statement","original":"./devtools-formatter"},{"path":"src/equality.ts","kind":"import-statement","original":"./equality"},{"path":"src/exposed-modules.ts","kind":"import-statement","original":"./exposed-modules"},{"path":"src/inspect-custom.ts","kind":"import-statement","original":"./inspect-custom"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":24202},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"node:events","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true}],"exports":["ErrorHandler","ErrorStream","Snoop","SnoopLevel","StackTrace","checkType","devtoolsFormatter","equalsSymbol","expectToThrow","exposeModule","failUndefined","importModule","inspectCustom","inspectObject","isEqual","isEquatable","loadashEqualityFn","logMethod","raise","snoop","timed","todo","truncate","truncateKey","warnAfterTimeout"],"entryPoint":"src/index.ts","inputs":{"src/assert.ts":{"bytesInOutput":34},"src/index.ts":{"bytesInOutput":0},"src/error-handler.ts":{"bytesInOutput":893},"src/error-stream.ts":{"bytesInOutput":974},"src/fail.ts":{"bytesInOutput":91},"src/inspect.ts":{"bytesInOutput":204},"src/log-method.ts":{"bytesInOutput":597},"src/raise.ts":{"bytesInOutput":43},"src/snoop.ts":{"bytesInOutput":2092},"src/stack-trace.ts":{"bytesInOutput":827},"src/strings.ts":{"bytesInOutput":396},"src/throw.ts":{"bytesInOutput":290},"src/timeout-warning.ts":{"bytesInOutput":664},"src/todo.ts":{"bytesInOutput":79},"src/devtools-formatter.ts":{"bytesInOutput":1094},"src/equality.ts":{"bytesInOutput":391},"src/exposed-modules.ts":{"bytesInOutput":271},"src/inspect-custom.ts":{"bytesInOutput":62}},"bytes":9863}}}
|