@idlebox/common 1.4.2 → 1.4.3
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/cjs/array/arrayUnique.cjs +2 -4
- package/lib/cjs/array/arrayUnique.cjs.map +1 -1
- package/lib/cjs/array/normalizeArray.cjs +2 -4
- package/lib/cjs/array/normalizeArray.cjs.map +1 -1
- package/lib/cjs/array/sortAlpha.cjs +2 -4
- package/lib/cjs/array/sortAlpha.cjs.map +1 -1
- package/lib/cjs/date/isInvalid.cjs +1 -1
- package/lib/cjs/date/isInvalid.cjs.map +1 -1
- package/lib/cjs/date/timeString.cjs +8 -10
- package/lib/cjs/date/timeString.cjs.map +1 -1
- package/lib/cjs/debugging/serializable.cjs +2 -2
- package/lib/cjs/debugging/serializable.cjs.map +1 -1
- package/lib/cjs/debugging/tryInspect.cjs +7 -9
- package/lib/cjs/debugging/tryInspect.cjs.map +1 -1
- package/lib/cjs/error/convertUnknown.cjs +2 -4
- package/lib/cjs/error/convertUnknown.cjs.map +1 -1
- package/lib/cjs/error/getFrame.cjs +2 -2
- package/lib/cjs/error/getFrame.cjs.map +1 -1
- package/lib/cjs/error/known.cjs.map +1 -1
- package/lib/cjs/error/pretty.cjs +22 -30
- package/lib/cjs/error/pretty.cjs.map +1 -1
- package/lib/cjs/function/asyncCallbackList.cjs.map +1 -1
- package/lib/cjs/function/callbackList.cjs.map +1 -1
- package/lib/cjs/function/delayCallbackList.cjs +3 -3
- package/lib/cjs/function/delayCallbackList.cjs.map +1 -1
- package/lib/cjs/lifecycle/dispose/disposableEvent.cjs +1 -3
- package/lib/cjs/lifecycle/dispose/disposableEvent.cjs.map +1 -1
- package/lib/cjs/lifecycle/dispose/lifecycle.async.cjs.map +1 -1
- package/lib/cjs/lifecycle/dispose/lifecycle.global.cjs +4 -8
- package/lib/cjs/lifecycle/dispose/lifecycle.global.cjs.map +1 -1
- package/lib/cjs/lifecycle/dispose/lifecycle.sync.cjs +1 -1
- package/lib/cjs/lifecycle/dispose/lifecycle.sync.cjs.map +1 -1
- package/lib/cjs/lifecycle/event/event.cjs.map +1 -1
- package/lib/cjs/lifecycle/event/memorized.cjs +1 -1
- package/lib/cjs/lifecycle/event/memorized.cjs.map +1 -1
- package/lib/cjs/lifecycle/promise/cancellationToken/driver.common.cjs.map +1 -1
- package/lib/cjs/lifecycle/promise/deferredPromise.cjs +2 -2
- package/lib/cjs/lifecycle/promise/deferredPromise.cjs.map +1 -1
- package/lib/cjs/lifecycle/timeout/timeout.cjs +1 -3
- package/lib/cjs/lifecycle/timeout/timeout.cjs.map +1 -1
- package/lib/cjs/lifecycle/timeout/timeoutError.cjs.map +1 -1
- package/lib/cjs/log/logger.cjs +4 -6
- package/lib/cjs/log/logger.cjs.map +1 -1
- package/lib/cjs/mapSet/customSet.cjs +3 -7
- package/lib/cjs/mapSet/customSet.cjs.map +1 -1
- package/lib/cjs/mapSet/extendMap.cjs +5 -9
- package/lib/cjs/mapSet/extendMap.cjs.map +1 -1
- package/lib/cjs/misc/assertNotNull.cjs +1 -3
- package/lib/cjs/misc/assertNotNull.cjs.map +1 -1
- package/lib/cjs/misc/package.json.cjs +1 -1
- package/lib/cjs/misc/package.json.cjs.map +1 -1
- package/lib/cjs/object/initOnRead.cjs.map +1 -1
- package/lib/cjs/object/objectSame.cjs +2 -1
- package/lib/cjs/object/objectSame.cjs.map +1 -1
- package/lib/cjs/path/normalizePath.cjs +7 -9
- package/lib/cjs/path/normalizePath.cjs.map +1 -1
- package/lib/cjs/path/pathArray.cjs +1 -1
- package/lib/cjs/path/pathArray.cjs.map +1 -1
- package/lib/cjs/platform/globalSingleton.cjs +1 -1
- package/lib/cjs/platform/globalSymbol.cjs +6 -8
- package/lib/cjs/platform/globalSymbol.cjs.map +1 -1
- package/lib/cjs/promise/promiseCollection.cjs +3 -3
- package/lib/cjs/promise/promiseCollection.cjs.map +1 -1
- package/lib/cjs/reflection/classes/singleton.cjs +1 -3
- package/lib/cjs/reflection/classes/singleton.cjs.map +1 -1
- package/lib/cjs/reflection/methods/bind.cjs +1 -3
- package/lib/cjs/reflection/methods/bind.cjs.map +1 -1
- package/lib/cjs/reflection/methods/initOnRead.cjs +2 -2
- package/lib/cjs/reflection/methods/initOnRead.cjs.map +1 -1
- package/lib/cjs/string/castCase.cjs +5 -5
- package/lib/cjs/string/castCase.cjs.map +1 -1
- package/lib/cjs/string/pad2.cjs +2 -4
- package/lib/cjs/string/pad2.cjs.map +1 -1
- package/lib/cjs/string/sizeString.cjs +23 -27
- package/lib/cjs/string/sizeString.cjs.map +1 -1
- package/lib/esm/array/arrayUnique.d.ts +1 -3
- package/lib/esm/array/arrayUnique.d.ts.map +1 -1
- package/lib/esm/array/arrayUnique.js +2 -4
- package/lib/esm/array/arrayUnique.js.map +1 -1
- package/lib/esm/array/normalizeArray.js +2 -4
- package/lib/esm/array/normalizeArray.js.map +1 -1
- package/lib/esm/array/sortAlpha.js +2 -4
- package/lib/esm/array/sortAlpha.js.map +1 -1
- package/lib/esm/date/isInvalid.js +1 -1
- package/lib/esm/date/isInvalid.js.map +1 -1
- package/lib/esm/date/timeString.d.ts +1 -3
- package/lib/esm/date/timeString.d.ts.map +1 -1
- package/lib/esm/date/timeString.js +8 -10
- package/lib/esm/date/timeString.js.map +1 -1
- package/lib/esm/debugging/serializable.d.ts +1 -1
- package/lib/esm/debugging/serializable.d.ts.map +1 -1
- package/lib/esm/debugging/serializable.js +2 -2
- package/lib/esm/debugging/serializable.js.map +1 -1
- package/lib/esm/debugging/tryInspect.d.ts.map +1 -1
- package/lib/esm/debugging/tryInspect.js +7 -9
- package/lib/esm/debugging/tryInspect.js.map +1 -1
- package/lib/esm/error/convertUnknown.d.ts.map +1 -1
- package/lib/esm/error/convertUnknown.js +2 -4
- package/lib/esm/error/convertUnknown.js.map +1 -1
- package/lib/esm/error/getFrame.js +2 -2
- package/lib/esm/error/getFrame.js.map +1 -1
- package/lib/esm/error/known.d.ts.map +1 -1
- package/lib/esm/error/known.js.map +1 -1
- package/lib/esm/error/pretty.d.ts.map +1 -1
- package/lib/esm/error/pretty.js +22 -30
- package/lib/esm/error/pretty.js.map +1 -1
- package/lib/esm/function/asyncCallbackList.d.ts +1 -1
- package/lib/esm/function/asyncCallbackList.d.ts.map +1 -1
- package/lib/esm/function/asyncCallbackList.js.map +1 -1
- package/lib/esm/function/callbackList.d.ts.map +1 -1
- package/lib/esm/function/callbackList.js.map +1 -1
- package/lib/esm/function/delayCallbackList.d.ts.map +1 -1
- package/lib/esm/function/delayCallbackList.js +3 -3
- package/lib/esm/function/delayCallbackList.js.map +1 -1
- package/lib/esm/lifecycle/dispose/disposableEvent.d.ts +1 -1
- package/lib/esm/lifecycle/dispose/disposableEvent.d.ts.map +1 -1
- package/lib/esm/lifecycle/dispose/disposableEvent.js +1 -3
- package/lib/esm/lifecycle/dispose/disposableEvent.js.map +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.async.d.ts +2 -2
- package/lib/esm/lifecycle/dispose/lifecycle.async.d.ts.map +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.async.js.map +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.d.ts +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.d.ts.map +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.global.d.ts +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.global.d.ts.map +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.global.js +4 -8
- package/lib/esm/lifecycle/dispose/lifecycle.global.js.map +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.sync.d.ts +2 -2
- package/lib/esm/lifecycle/dispose/lifecycle.sync.d.ts.map +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.sync.js +1 -1
- package/lib/esm/lifecycle/dispose/lifecycle.sync.js.map +1 -1
- package/lib/esm/lifecycle/event/event.d.ts +3 -7
- package/lib/esm/lifecycle/event/event.d.ts.map +1 -1
- package/lib/esm/lifecycle/event/event.js.map +1 -1
- package/lib/esm/lifecycle/event/memorized.d.ts +2 -2
- package/lib/esm/lifecycle/event/memorized.d.ts.map +1 -1
- package/lib/esm/lifecycle/event/memorized.js +1 -1
- package/lib/esm/lifecycle/event/memorized.js.map +1 -1
- package/lib/esm/lifecycle/promise/cancellationToken/driver.common.js.map +1 -1
- package/lib/esm/lifecycle/promise/cancellationToken/source.d.ts +2 -2
- package/lib/esm/lifecycle/promise/cancellationToken/source.d.ts.map +1 -1
- package/lib/esm/lifecycle/promise/deferredPromise.js +2 -2
- package/lib/esm/lifecycle/promise/deferredPromise.js.map +1 -1
- package/lib/esm/lifecycle/timeout/timeout.js +1 -3
- package/lib/esm/lifecycle/timeout/timeout.js.map +1 -1
- package/lib/esm/lifecycle/timeout/timeoutError.d.ts.map +1 -1
- package/lib/esm/lifecycle/timeout/timeoutError.js.map +1 -1
- package/lib/esm/log/logger.d.ts.map +1 -1
- package/lib/esm/log/logger.js +4 -6
- package/lib/esm/log/logger.js.map +1 -1
- package/lib/esm/mapSet/customSet.d.ts +1 -3
- package/lib/esm/mapSet/customSet.d.ts.map +1 -1
- package/lib/esm/mapSet/customSet.js +3 -7
- package/lib/esm/mapSet/customSet.js.map +1 -1
- package/lib/esm/mapSet/extendMap.d.ts.map +1 -1
- package/lib/esm/mapSet/extendMap.js +5 -9
- package/lib/esm/mapSet/extendMap.js.map +1 -1
- package/lib/esm/misc/assertNotNull.d.ts.map +1 -1
- package/lib/esm/misc/assertNotNull.js +1 -3
- package/lib/esm/misc/assertNotNull.js.map +1 -1
- package/lib/esm/misc/package.json.js +1 -1
- package/lib/esm/misc/package.json.js.map +1 -1
- package/lib/esm/object/initOnRead.d.ts +1 -3
- package/lib/esm/object/initOnRead.d.ts.map +1 -1
- package/lib/esm/object/initOnRead.js.map +1 -1
- package/lib/esm/object/objectSame.js +2 -1
- package/lib/esm/object/objectSame.js.map +1 -1
- package/lib/esm/path/normalizePath.d.ts.map +1 -1
- package/lib/esm/path/normalizePath.js +7 -9
- package/lib/esm/path/normalizePath.js.map +1 -1
- package/lib/esm/path/pathArray.js +1 -1
- package/lib/esm/path/pathArray.js.map +1 -1
- package/lib/esm/platform/globalSingleton.js +1 -1
- package/lib/esm/platform/globalSymbol.d.ts.map +1 -1
- package/lib/esm/platform/globalSymbol.js +6 -8
- package/lib/esm/platform/globalSymbol.js.map +1 -1
- package/lib/esm/promise/promiseCollection.js +3 -3
- package/lib/esm/promise/promiseCollection.js.map +1 -1
- package/lib/esm/reflection/classes/hookClass.d.ts +1 -1
- package/lib/esm/reflection/classes/hookClass.d.ts.map +1 -1
- package/lib/esm/reflection/classes/singleton.d.ts.map +1 -1
- package/lib/esm/reflection/classes/singleton.js +1 -3
- package/lib/esm/reflection/classes/singleton.js.map +1 -1
- package/lib/esm/reflection/methods/bind.d.ts.map +1 -1
- package/lib/esm/reflection/methods/bind.js +1 -3
- package/lib/esm/reflection/methods/bind.js.map +1 -1
- package/lib/esm/reflection/methods/initOnRead.d.ts +1 -1
- package/lib/esm/reflection/methods/initOnRead.d.ts.map +1 -1
- package/lib/esm/reflection/methods/initOnRead.js +2 -2
- package/lib/esm/reflection/methods/initOnRead.js.map +1 -1
- package/lib/esm/string/castCase.js +5 -5
- package/lib/esm/string/castCase.js.map +1 -1
- package/lib/esm/string/pad2.d.ts.map +1 -1
- package/lib/esm/string/pad2.js +2 -4
- package/lib/esm/string/pad2.js.map +1 -1
- package/lib/esm/string/sizeString.d.ts.map +1 -1
- package/lib/esm/string/sizeString.js +23 -27
- package/lib/esm/string/sizeString.js.map +1 -1
- package/lib/esm/typingHelper/deep.partial.d.ts +1 -1
- package/lib/esm/typingHelper/deep.partial.d.ts.map +1 -1
- package/lib/esm/typingHelper/deep.readonly.d.ts +1 -1
- package/lib/esm/typingHelper/deep.readonly.d.ts.map +1 -1
- package/lib/esm/typingHelper/deep.required.d.ts +1 -1
- package/lib/esm/typingHelper/deep.required.d.ts.map +1 -1
- package/lib/esm/typingHelper/deep.writable.d.ts +1 -1
- package/lib/esm/typingHelper/deep.writable.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/array/arrayUnique.ts +3 -6
- package/src/array/normalizeArray.ts +3 -3
- package/src/array/sortAlpha.ts +3 -3
- package/src/date/isInvalid.ts +1 -1
- package/src/date/timeString.ts +9 -15
- package/src/debugging/serializable.ts +8 -8
- package/src/debugging/tryInspect.ts +12 -8
- package/src/error/convertUnknown.ts +2 -3
- package/src/error/getFrame.ts +2 -2
- package/src/error/known.ts +2 -2
- package/src/error/pretty.ts +29 -34
- package/src/function/asyncCallbackList.ts +3 -3
- package/src/function/callbackList.ts +2 -2
- package/src/function/delayCallbackList.ts +4 -4
- package/src/lifecycle/dispose/disposableEvent.ts +2 -3
- package/src/lifecycle/dispose/disposedError.ts +1 -1
- package/src/lifecycle/dispose/lifecycle.async.ts +2 -2
- package/src/lifecycle/dispose/lifecycle.global.ts +6 -7
- package/src/lifecycle/dispose/lifecycle.sync.ts +3 -3
- package/src/lifecycle/dispose/lifecycle.ts +1 -1
- package/src/lifecycle/event/event.ts +4 -8
- package/src/lifecycle/event/memorized.ts +4 -4
- package/src/lifecycle/promise/cancellationToken/driver.browser.ts +1 -1
- package/src/lifecycle/promise/cancellationToken/driver.common.ts +2 -2
- package/src/lifecycle/promise/cancellationToken/source.ts +2 -2
- package/src/lifecycle/promise/deferredPromise.ts +2 -2
- package/src/lifecycle/timeout/timeout.ts +1 -2
- package/src/lifecycle/timeout/timeoutError.ts +1 -1
- package/src/log/logger.ts +8 -9
- package/src/mapSet/customSet.ts +4 -8
- package/src/mapSet/extendMap.ts +6 -7
- package/src/misc/assertNotNull.ts +1 -2
- package/src/misc/package.json.ts +1 -1
- package/src/object/initOnRead.ts +1 -3
- package/src/object/objectSame.ts +2 -2
- package/src/path/normalizePath.ts +14 -17
- package/src/path/pathArray.ts +2 -2
- package/src/platform/globalSingleton.ts +1 -1
- package/src/platform/globalSymbol.ts +8 -9
- package/src/promise/promiseCollection.ts +3 -3
- package/src/reflection/classes/hookClass.ts +1 -1
- package/src/reflection/classes/singleton.ts +3 -4
- package/src/reflection/methods/bind.ts +1 -2
- package/src/reflection/methods/initOnRead.ts +3 -3
- package/src/string/castCase.ts +5 -5
- package/src/string/pad2.ts +2 -3
- package/src/string/sizeString.ts +33 -25
- package/src/tsconfig.json +1 -1
- package/src/typingHelper/deep.partial.ts +7 -7
- package/src/typingHelper/deep.readonly.ts +7 -7
- package/src/typingHelper/deep.required.ts +7 -7
- package/src/typingHelper/deep.writable.ts +7 -7
package/src/error/getFrame.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @returns {string} if frame greater than max, return ''
|
|
4
4
|
*/
|
|
5
5
|
export function getErrorFrame(e: Error, frame: number): string {
|
|
6
|
-
if (e
|
|
6
|
+
if (e?.stack) {
|
|
7
7
|
const stackArr = e.stack.split('\n');
|
|
8
8
|
if (stackArr.length > frame + 1) {
|
|
9
|
-
return stackArr[frame + 1]
|
|
9
|
+
return stackArr[frame + 1]?.trim();
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
return '';
|
package/src/error/known.ts
CHANGED
|
@@ -5,8 +5,8 @@ interface ErrorOptions {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
abstract class KnownErrorAbstract extends Error {
|
|
8
|
-
protected static debugMode
|
|
9
|
-
static debug(enabled
|
|
8
|
+
protected static debugMode = false;
|
|
9
|
+
static debug(enabled = true) {
|
|
10
10
|
KnownErrorAbstract.debugMode = enabled;
|
|
11
11
|
}
|
|
12
12
|
static is(e: any): e is KnownErrorAbstract {
|
package/src/error/pretty.ts
CHANGED
|
@@ -74,8 +74,8 @@ function addLoc(ret: IStructreStackLine, m: Record<TypeMatchFileOnly, string>) {
|
|
|
74
74
|
ret.location = {
|
|
75
75
|
schema: m.schema?.replace(/\/+$/, '') ?? '',
|
|
76
76
|
path: path,
|
|
77
|
-
line: parseInt(m.line),
|
|
78
|
-
column: parseInt(m.column),
|
|
77
|
+
line: Number.parseInt(m.line),
|
|
78
|
+
column: Number.parseInt(m.column),
|
|
79
79
|
isAbsolute: isAbsolute(path),
|
|
80
80
|
};
|
|
81
81
|
}
|
|
@@ -126,12 +126,13 @@ export function parseStackLine(line: string): IStructreStackLine {
|
|
|
126
126
|
addLoc(ret, mEval);
|
|
127
127
|
|
|
128
128
|
ret.eval = {
|
|
129
|
-
eval_column: parseInt(mEval.eval_column),
|
|
129
|
+
eval_column: Number.parseInt(mEval.eval_column),
|
|
130
130
|
eval_func: mEval.eval_func,
|
|
131
|
-
eval_line: parseInt(mEval.eval_line),
|
|
131
|
+
eval_line: Number.parseInt(mEval.eval_line),
|
|
132
132
|
funcs: [],
|
|
133
133
|
};
|
|
134
134
|
for (const item of line.matchAll(regEvalItem)) {
|
|
135
|
+
// biome-ignore lint/style/noNonNullAssertion: 有匹配必然有 groups
|
|
135
136
|
ret.eval.funcs.push(item.groups!.func_name);
|
|
136
137
|
}
|
|
137
138
|
ret.eval.funcs.push(mEval.eval_func);
|
|
@@ -161,7 +162,7 @@ export function prettyPrintError(type: string, e: Error) {
|
|
|
161
162
|
// console.log(JSON.stringify(e.stack), JSON.stringify(e.message));
|
|
162
163
|
notify_printed = true;
|
|
163
164
|
console.error(
|
|
164
|
-
'\x1B[2muse env.DISABLE_PRETTY_ERROR=yes / window.DISABLE_PRETTY_ERROR=true to see original error stack\x1B[0m'
|
|
165
|
+
'\x1B[2muse env.DISABLE_PRETTY_ERROR=yes / window.DISABLE_PRETTY_ERROR=true to see original error stack\x1B[0m'
|
|
165
166
|
);
|
|
166
167
|
}
|
|
167
168
|
}
|
|
@@ -197,12 +198,7 @@ export function prettyFormatStack(stackLines: readonly string[]) {
|
|
|
197
198
|
if (fn_name) {
|
|
198
199
|
ret += ' (';
|
|
199
200
|
}
|
|
200
|
-
ret += formatFileLine(
|
|
201
|
-
line.location.schema,
|
|
202
|
-
line.location.path,
|
|
203
|
-
line.location.line,
|
|
204
|
-
line.location.column,
|
|
205
|
-
);
|
|
201
|
+
ret += formatFileLine(line.location.schema, line.location.path, line.location.line, line.location.column);
|
|
206
202
|
if (fn_name) {
|
|
207
203
|
ret += ')';
|
|
208
204
|
}
|
|
@@ -216,7 +212,7 @@ export function prettyFormatStack(stackLines: readonly string[]) {
|
|
|
216
212
|
const color = fn_name ? (isNodeModule ? '14;2' : '14') : '8';
|
|
217
213
|
ret = `\x1b[0m at \x1b[38;5;${color}m`;
|
|
218
214
|
if (fn_alias && fn_name && fn_name.startsWith('Object.')) {
|
|
219
|
-
ret += fn_alias
|
|
215
|
+
ret += `${fn_alias} [export]`;
|
|
220
216
|
} else {
|
|
221
217
|
ret += formatFunctionName(fn_name, fn_alias);
|
|
222
218
|
}
|
|
@@ -232,7 +228,7 @@ export function prettyFormatStack(stackLines: readonly string[]) {
|
|
|
232
228
|
} else {
|
|
233
229
|
color = '\x1b[38;5;2m';
|
|
234
230
|
}
|
|
235
|
-
ret +=
|
|
231
|
+
ret += ` (${color}`;
|
|
236
232
|
const file = formatFileLine(line.location.schema, path, line.location.line, line.location.column);
|
|
237
233
|
const lastNmPos = file.lastIndexOf('/node_modules/');
|
|
238
234
|
if (lastNmPos >= 0) {
|
|
@@ -266,15 +262,14 @@ interface IError {
|
|
|
266
262
|
export function prettyFormatError(e: IError, withMessage = true) {
|
|
267
263
|
if (!e || !e.stack) {
|
|
268
264
|
if (withMessage) {
|
|
269
|
-
|
|
265
|
+
const msg = e?.message || 'Unknown Error';
|
|
270
266
|
|
|
271
|
-
return red(msg
|
|
272
|
-
} else {
|
|
273
|
-
return red(' No stack trace');
|
|
267
|
+
return red(`${msg}\n No stack trace`);
|
|
274
268
|
}
|
|
269
|
+
return red(' No stack trace');
|
|
275
270
|
}
|
|
276
271
|
|
|
277
|
-
|
|
272
|
+
const stackLines = e.stack.split(/\n/g);
|
|
278
273
|
|
|
279
274
|
let first = 'Unknown Error';
|
|
280
275
|
if (/^\S/.test(stackLines[0])) {
|
|
@@ -286,10 +281,9 @@ export function prettyFormatError(e: IError, withMessage = true) {
|
|
|
286
281
|
first = first.replace(/^(\S+):/, `$1(code ${e.code}):`);
|
|
287
282
|
}
|
|
288
283
|
|
|
289
|
-
return first
|
|
290
|
-
} else {
|
|
291
|
-
return prettyFormatStack(stackLines).join('\n');
|
|
284
|
+
return `${first}\n${prettyFormatStack(stackLines).join('\n')}`;
|
|
292
285
|
}
|
|
286
|
+
return prettyFormatStack(stackLines).join('\n');
|
|
293
287
|
}
|
|
294
288
|
|
|
295
289
|
let alert = false;
|
|
@@ -300,7 +294,7 @@ function formatFileLine(schema: string | undefined, file: string, row?: number,
|
|
|
300
294
|
try {
|
|
301
295
|
rel = relativePath(root, file);
|
|
302
296
|
if (rel[0] !== '.') {
|
|
303
|
-
rel =
|
|
297
|
+
rel = `./${rel}`;
|
|
304
298
|
} else if (rel[1] === '.') {
|
|
305
299
|
if (file.length < rel.length) {
|
|
306
300
|
rel = file;
|
|
@@ -311,13 +305,12 @@ function formatFileLine(schema: string | undefined, file: string, row?: number,
|
|
|
311
305
|
}
|
|
312
306
|
} catch (e: any) {
|
|
313
307
|
if (!alert) {
|
|
314
|
-
debugger;
|
|
315
308
|
alert = true;
|
|
316
309
|
console.error(
|
|
317
310
|
'pretty print error: failed calc relative path ("%s" to "%s"):\n\x1B[2mFormat%s\x1B[0m',
|
|
318
311
|
root,
|
|
319
312
|
file,
|
|
320
|
-
e.stack
|
|
313
|
+
e.stack
|
|
321
314
|
);
|
|
322
315
|
}
|
|
323
316
|
rel = file;
|
|
@@ -331,12 +324,10 @@ function formatFunctionName(fn?: string, as?: string) {
|
|
|
331
324
|
if (fn) {
|
|
332
325
|
if (as) {
|
|
333
326
|
return `${fn} [as ${as}]`;
|
|
334
|
-
} else {
|
|
335
|
-
return fn;
|
|
336
327
|
}
|
|
337
|
-
|
|
338
|
-
return '<anonymous>';
|
|
328
|
+
return fn;
|
|
339
329
|
}
|
|
330
|
+
return '<anonymous>';
|
|
340
331
|
}
|
|
341
332
|
|
|
342
333
|
function translateFunction(data: IStructreStackLine): IStructreStackLine {
|
|
@@ -353,8 +344,8 @@ function translateFunction(data: IStructreStackLine): IStructreStackLine {
|
|
|
353
344
|
data.func.name = 'process.nextTick';
|
|
354
345
|
}
|
|
355
346
|
if (data.func.name.startsWith('Timeout.') && data.func.alias === '_onTimeout') {
|
|
356
|
-
data.func.name =
|
|
357
|
-
|
|
347
|
+
data.func.name = `setTimeout->${data.func.name.slice(8)}`;
|
|
348
|
+
data.func.alias = undefined;
|
|
358
349
|
}
|
|
359
350
|
return data;
|
|
360
351
|
}
|
|
@@ -370,13 +361,17 @@ function skipSomeFrame({ location }: IStructreStackLine): boolean {
|
|
|
370
361
|
if (location.schema === 'node:') {
|
|
371
362
|
if (location.path.startsWith('internal/timers')) {
|
|
372
363
|
return false;
|
|
373
|
-
}
|
|
364
|
+
}
|
|
365
|
+
if (location.path === 'internal/modules/cjs/loader') {
|
|
374
366
|
return false;
|
|
375
|
-
}
|
|
367
|
+
}
|
|
368
|
+
if (location.path === 'internal/modules/esm/loader') {
|
|
376
369
|
return false;
|
|
377
|
-
}
|
|
370
|
+
}
|
|
371
|
+
if (location.path === 'internal/modules/run_main') {
|
|
378
372
|
return false;
|
|
379
|
-
}
|
|
373
|
+
}
|
|
374
|
+
if (location.path === 'internal/modules/esm/module_job') {
|
|
380
375
|
return false;
|
|
381
376
|
}
|
|
382
377
|
}
|
|
@@ -3,7 +3,7 @@ import { nameFunction } from './functionName.js';
|
|
|
3
3
|
export interface MyAsyncCallback<Argument extends unknown[]> {
|
|
4
4
|
displayName?: string;
|
|
5
5
|
|
|
6
|
-
(...param: Argument): Promise<
|
|
6
|
+
(...param: Argument): Promise<undefined | undefined | boolean> | undefined | undefined | boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -11,7 +11,7 @@ export interface MyAsyncCallback<Argument extends unknown[]> {
|
|
|
11
11
|
*/
|
|
12
12
|
export class AsyncCallbackList<Argument extends unknown[]> {
|
|
13
13
|
protected list: MyAsyncCallback<Argument>[] = [];
|
|
14
|
-
protected running
|
|
14
|
+
protected running = false;
|
|
15
15
|
|
|
16
16
|
constructor() {
|
|
17
17
|
this.run = (this.run as any).bind(this);
|
|
@@ -62,7 +62,7 @@ export class AsyncCallbackList<Argument extends unknown[]> {
|
|
|
62
62
|
*/
|
|
63
63
|
async run(...argument: Argument): Promise<boolean> {
|
|
64
64
|
this.running = true;
|
|
65
|
-
let ret: boolean | undefined |
|
|
65
|
+
let ret: boolean | undefined | undefined;
|
|
66
66
|
for (const cb of this.list) {
|
|
67
67
|
ret = await cb(...argument);
|
|
68
68
|
if (ret === true) {
|
|
@@ -11,8 +11,8 @@ export interface MyCallback<Argument extends unknown[]> {
|
|
|
11
11
|
*/
|
|
12
12
|
export class CallbackList<Argument extends unknown[]> {
|
|
13
13
|
protected list: MyCallback<Argument>[] = [];
|
|
14
|
-
protected running
|
|
15
|
-
protected stop
|
|
14
|
+
protected running = false;
|
|
15
|
+
protected stop = false;
|
|
16
16
|
|
|
17
17
|
constructor() {
|
|
18
18
|
this.run = (this.run as any).bind(this);
|
|
@@ -12,7 +12,7 @@ export interface MyDelayCallback<Argument extends unknown[]> {
|
|
|
12
12
|
*/
|
|
13
13
|
export class DelayCallbackList<Argument extends unknown[]> {
|
|
14
14
|
private delayArgument?: Argument;
|
|
15
|
-
private delayComplete
|
|
15
|
+
private delayComplete = false;
|
|
16
16
|
|
|
17
17
|
protected list?: MyDelayCallback<Argument>[] = [];
|
|
18
18
|
|
|
@@ -27,7 +27,7 @@ export class DelayCallbackList<Argument extends unknown[]> {
|
|
|
27
27
|
if (this.delayComplete) {
|
|
28
28
|
item(...this.delayArgument!);
|
|
29
29
|
} else {
|
|
30
|
-
this.list
|
|
30
|
+
this.list?.push(item);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -37,9 +37,9 @@ export class DelayCallbackList<Argument extends unknown[]> {
|
|
|
37
37
|
}
|
|
38
38
|
this.delayComplete = true;
|
|
39
39
|
this.delayArgument = argument;
|
|
40
|
-
this.list
|
|
40
|
+
this.list?.forEach((cb) => {
|
|
41
41
|
cb(...argument);
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
this.list = undefined;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDisposable } from './lifecycle.js';
|
|
1
|
+
import type { IDisposable } from './lifecycle.js';
|
|
2
2
|
|
|
3
3
|
declare const AbortController: new () => any;
|
|
4
4
|
|
|
@@ -86,9 +86,8 @@ function check(options: IEventListenerOptions = {}): [{ abort(): void } | undefi
|
|
|
86
86
|
const controller = new AbortController();
|
|
87
87
|
(options as any).signal = controller.signal;
|
|
88
88
|
return [controller, options];
|
|
89
|
-
} else {
|
|
90
|
-
return [undefined, options];
|
|
91
89
|
}
|
|
90
|
+
return [undefined, options];
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
function checkAllSupport(ele: IEventHostObject<any>) {
|
|
@@ -9,7 +9,7 @@ export class DisposedError extends Error {
|
|
|
9
9
|
public readonly inspectString: string;
|
|
10
10
|
constructor(
|
|
11
11
|
object: any,
|
|
12
|
-
public readonly previous: Error
|
|
12
|
+
public readonly previous: Error
|
|
13
13
|
) {
|
|
14
14
|
const insp = tryInspect(object);
|
|
15
15
|
super(`Object [${insp}] has already disposed ${getErrorFrame(previous, 2)}.`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { convertCatchedError } from '../../error/convertUnknown.js';
|
|
2
|
-
import { Emitter, EventRegister } from '../event/event.js';
|
|
2
|
+
import { Emitter, type EventRegister } from '../event/event.js';
|
|
3
3
|
import { DisposedError } from './disposedError.js';
|
|
4
|
-
import { IAsyncDisposable, IDisposableEvents } from './lifecycle.js';
|
|
4
|
+
import type { IAsyncDisposable, IDisposableEvents } from './lifecycle.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Async version of Disposable
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { globalSingletonStrong } from '../../platform/globalSingleton.js';
|
|
2
2
|
import { createSymbol } from '../../platform/globalSymbol.js';
|
|
3
|
-
import { IDisposable } from './lifecycle.js';
|
|
3
|
+
import type { IDisposable } from './lifecycle.js';
|
|
4
4
|
import { AsyncDisposable } from './lifecycle.async.js';
|
|
5
5
|
|
|
6
6
|
const symbol = createSymbol('lifecycle', 'application');
|
|
@@ -23,9 +23,8 @@ export function ensureDisposeGlobal() {
|
|
|
23
23
|
const obj = globalSingletonStrong<AsyncDisposable>(symbol);
|
|
24
24
|
if (obj && !obj.hasDisposed) {
|
|
25
25
|
return Promise.resolve(obj.dispose());
|
|
26
|
-
} else {
|
|
27
|
-
return Promise.resolve();
|
|
28
26
|
}
|
|
27
|
+
return Promise.resolve();
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -36,13 +35,13 @@ export function ensureDisposeGlobal() {
|
|
|
36
35
|
*/
|
|
37
36
|
export function disposeGlobal() {
|
|
38
37
|
const obj = globalSingletonStrong<AsyncDisposable>(symbol);
|
|
39
|
-
if (obj
|
|
38
|
+
if (obj?.hasDisposed) {
|
|
40
39
|
throw new Error('global already disposed.');
|
|
41
|
-
}
|
|
40
|
+
}
|
|
41
|
+
if (obj) {
|
|
42
42
|
return Promise.resolve(obj.dispose());
|
|
43
|
-
} else {
|
|
44
|
-
return Promise.resolve();
|
|
45
43
|
}
|
|
44
|
+
return Promise.resolve();
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Emitter, EventRegister } from '../event/event.js';
|
|
1
|
+
import { Emitter, type EventRegister } from '../event/event.js';
|
|
2
2
|
import { DisposedError } from './disposedError.js';
|
|
3
|
-
import { IDisposable, IDisposableEvents } from './lifecycle.js';
|
|
3
|
+
import type { IDisposable, IDisposableEvents } from './lifecycle.js';
|
|
4
4
|
|
|
5
5
|
export abstract class DisposableOnce implements IDisposable {
|
|
6
6
|
private _disposed?: Error;
|
|
@@ -85,7 +85,7 @@ export class Disposable implements IDisposable, IDisposableEvents {
|
|
|
85
85
|
this._onDisposeError.fire(e);
|
|
86
86
|
} else {
|
|
87
87
|
console.error('error during dispose, throw:', e);
|
|
88
|
-
this._onDisposeError.fire(new Error(
|
|
88
|
+
this._onDisposeError.fire(new Error(`${e}`));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { IDisposable } from '../dispose/lifecycle.js';
|
|
1
|
+
import type { IDisposable } from '../dispose/lifecycle.js';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
(data: T): void;
|
|
5
|
-
}
|
|
3
|
+
export type EventHandler<T> = (data: T) => void;
|
|
6
4
|
|
|
7
|
-
export
|
|
8
|
-
(callback: EventHandler<T>): IDisposable;
|
|
9
|
-
}
|
|
5
|
+
export type EventRegister<T> = (callback: EventHandler<T>) => IDisposable;
|
|
10
6
|
|
|
11
7
|
type DeferFn = () => void;
|
|
12
8
|
|
|
@@ -16,7 +12,7 @@ type DeferFn = () => void;
|
|
|
16
12
|
*/
|
|
17
13
|
export class Emitter<T> implements IDisposable {
|
|
18
14
|
protected readonly _callbacks: EventHandler<T>[] = [];
|
|
19
|
-
private executing
|
|
15
|
+
private executing = false;
|
|
20
16
|
|
|
21
17
|
constructor() {
|
|
22
18
|
this.handle = this.handle.bind(this);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable } from '../dispose/lifecycle.js';
|
|
2
|
-
import { Emitter, EventHandler } from './event.js';
|
|
1
|
+
import type { IDisposable } from '../dispose/lifecycle.js';
|
|
2
|
+
import { Emitter, type EventHandler } from './event.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 会记住上次fire的内容,并在每个新的handler注册时立即调用一次的Emitter
|
|
@@ -8,7 +8,7 @@ import { Emitter, EventHandler } from './event.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export class MemorizedEmitter<T> extends Emitter<T> {
|
|
10
10
|
private _memo?: T;
|
|
11
|
-
private _is_memo
|
|
11
|
+
private _is_memo = false;
|
|
12
12
|
|
|
13
13
|
public override fire(data: T) {
|
|
14
14
|
this._memo = data;
|
|
@@ -28,7 +28,7 @@ export class MemorizedEmitter<T> extends Emitter<T> {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
public forget() {
|
|
31
|
-
|
|
31
|
+
this._memo = undefined;
|
|
32
32
|
this._is_memo = false;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable } from '../../dispose/lifecycle.js';
|
|
2
|
-
import { Emitter, EventHandler } from '../../event/event.js';
|
|
1
|
+
import type { IDisposable } from '../../dispose/lifecycle.js';
|
|
2
|
+
import { Emitter, type EventHandler } from '../../event/event.js';
|
|
3
3
|
|
|
4
4
|
import type { CancellationDriver, __CancellationToken } from './source.js';
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { globalObject } from '../../../platform/globalObject.js';
|
|
2
|
-
import { IDisposable } from '../../dispose/lifecycle.js';
|
|
2
|
+
import type { IDisposable } from '../../dispose/lifecycle.js';
|
|
3
3
|
import { DisposableOnce } from '../../dispose/lifecycle.sync.js';
|
|
4
|
-
import { EventHandler } from '../../event/event.js';
|
|
4
|
+
import type { EventHandler } from '../../event/event.js';
|
|
5
5
|
import { CancellationDriverBrowser } from './driver.browser.js';
|
|
6
6
|
import { CancellationDriverCommon } from './driver.common.js';
|
|
7
7
|
|
|
@@ -33,7 +33,7 @@ export class DeferredPromise<T, PT = any> {
|
|
|
33
33
|
);
|
|
34
34
|
this.p
|
|
35
35
|
.finally(() => {
|
|
36
|
-
|
|
36
|
+
this._progressList = undefined;
|
|
37
37
|
})
|
|
38
38
|
.catch(() => void 0);
|
|
39
39
|
}
|
|
@@ -46,7 +46,7 @@ export class DeferredPromise<T, PT = any> {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
progress(fn: ProgressCallback<PT>): void {
|
|
49
|
-
this._progressList
|
|
49
|
+
this._progressList?.push(fn);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
get completed(): boolean {
|
|
@@ -42,7 +42,6 @@ export function timeoutPromise<T>(ms: number, message: string | T, p?: T): T {
|
|
|
42
42
|
}
|
|
43
43
|
if (p instanceof DeferredPromise) {
|
|
44
44
|
return Promise.race([p.p, timeout(ms, msg)]).then(() => p) as any;
|
|
45
|
-
} else {
|
|
46
|
-
return Promise.race([p, timeout(ms, msg)]).then(() => p) as any;
|
|
47
45
|
}
|
|
46
|
+
return Promise.race([p, timeout(ms, msg)]).then(() => p) as any;
|
|
48
47
|
}
|
|
@@ -5,7 +5,7 @@ import { humanDate } from '../../date/timeString.js';
|
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export class TimeoutError extends Error {
|
|
8
|
-
constructor(time: number, what
|
|
8
|
+
constructor(time: number, what = 'no response') {
|
|
9
9
|
super(`Timeout: ${what} in ${humanDate.deltaTiny(time)}`);
|
|
10
10
|
}
|
|
11
11
|
}
|
package/src/log/logger.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { nameFunction } from '../function/functionName.js';
|
|
|
2
2
|
import { isWeb } from '../platform/os.js';
|
|
3
3
|
|
|
4
4
|
export enum ColorKind {
|
|
5
|
-
DISABLE,
|
|
6
|
-
TERMINAL,
|
|
7
|
-
WEB,
|
|
8
|
-
DETECT,
|
|
5
|
+
DISABLE = 0,
|
|
6
|
+
TERMINAL = 1,
|
|
7
|
+
WEB = 2,
|
|
8
|
+
DETECT = 3,
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface WrappedConsoleOptions {
|
|
@@ -71,13 +71,12 @@ export abstract class WrappedConsole {
|
|
|
71
71
|
protected wrap<T extends keyof Omit<Console & { Console: any }, 'Console'>>(original: T): Function {
|
|
72
72
|
if (this.bind) {
|
|
73
73
|
return this.parent[original].bind(this.parent) as any;
|
|
74
|
-
} else {
|
|
75
|
-
return this.parent[original];
|
|
76
74
|
}
|
|
75
|
+
return this.parent[original];
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
private wrapSimple<T extends keyof Omit<Console & { Console: any }, 'Console'>>(original: T): Console[T] {
|
|
80
|
-
return nameFunction(
|
|
79
|
+
return nameFunction(`console:${original}`, this.wrap(original) as any);
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
private wrapExtra<T extends keyof Omit<Console & { Console: any }, 'Console'>>(
|
|
@@ -85,7 +84,7 @@ export abstract class WrappedConsole {
|
|
|
85
84
|
exMessage: string
|
|
86
85
|
): Console[T] {
|
|
87
86
|
const bindedFn = this.wrap(original);
|
|
88
|
-
return nameFunction(
|
|
87
|
+
return nameFunction(`console:${original}`, (...args: any[]) => {
|
|
89
88
|
this.log(exMessage);
|
|
90
89
|
bindedFn(...args);
|
|
91
90
|
});
|
|
@@ -115,7 +114,7 @@ export abstract class WrappedConsole {
|
|
|
115
114
|
|
|
116
115
|
const fn = this.wrap(original);
|
|
117
116
|
|
|
118
|
-
return nameFunction(
|
|
117
|
+
return nameFunction(`console:${original}`, (...args: any[]) => {
|
|
119
118
|
this.convertObjectArg(args, messageLoc);
|
|
120
119
|
this.processColorLabel(args, messageLoc, original, prefix);
|
|
121
120
|
fn(...args);
|
package/src/mapSet/customSet.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** Find the index of given item */
|
|
2
|
-
export
|
|
3
|
-
(this: Type[], item: Type): number;
|
|
4
|
-
}
|
|
2
|
+
export type Finder<Type> = (this: Type[], item: Type) => number;
|
|
5
3
|
|
|
6
4
|
type MyFinder<Type> = (item: Type) => number;
|
|
7
5
|
|
|
@@ -34,9 +32,8 @@ export class CustomSet<Type = string> {
|
|
|
34
32
|
if (index === -1) {
|
|
35
33
|
this.registry.push(item);
|
|
36
34
|
return true;
|
|
37
|
-
} else {
|
|
38
|
-
return false;
|
|
39
35
|
}
|
|
36
|
+
return false;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
/**
|
|
@@ -50,10 +47,9 @@ export class CustomSet<Type = string> {
|
|
|
50
47
|
const index = this.finder(item);
|
|
51
48
|
if (index === -1) {
|
|
52
49
|
return false;
|
|
53
|
-
} else {
|
|
54
|
-
this.registry.splice(index, 1);
|
|
55
|
-
return true;
|
|
56
50
|
}
|
|
51
|
+
this.registry.splice(index, 1);
|
|
52
|
+
return true;
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
/**
|
package/src/mapSet/extendMap.ts
CHANGED
|
@@ -18,11 +18,11 @@ export class ExtendMap<K, V> extends Map<K, V> {
|
|
|
18
18
|
public override get(id: K, def?: V): V {
|
|
19
19
|
if (super.has(id)) {
|
|
20
20
|
return super.get(id)!;
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
|
+
if (arguments.length === 2) {
|
|
22
23
|
return def!;
|
|
23
|
-
} else {
|
|
24
|
-
throw new Error(`Unknown key {${id}} in map.`);
|
|
25
24
|
}
|
|
25
|
+
throw new Error(`Unknown key {${id}} in map.`);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -31,10 +31,9 @@ export class ExtendMap<K, V> extends Map<K, V> {
|
|
|
31
31
|
public entry(id: K, init: (id: K) => V): V {
|
|
32
32
|
if (super.has(id)) {
|
|
33
33
|
return super.get(id)!;
|
|
34
|
-
} else {
|
|
35
|
-
const nv = init(id);
|
|
36
|
-
super.set(id, nv);
|
|
37
|
-
return nv;
|
|
38
34
|
}
|
|
35
|
+
const nv = init(id);
|
|
36
|
+
super.set(id, nv);
|
|
37
|
+
return nv;
|
|
39
38
|
}
|
|
40
39
|
}
|
|
@@ -15,7 +15,6 @@ export function assertNotNull<T>(val: T | null | undefined): T {
|
|
|
15
15
|
export function throwNull<T>(val: T) {
|
|
16
16
|
if (val === undefined || val === null) {
|
|
17
17
|
return val!;
|
|
18
|
-
} else {
|
|
19
|
-
throw new Error('Value is ' + typeof val);
|
|
20
18
|
}
|
|
19
|
+
throw new Error(`Value is ${typeof val}`);
|
|
21
20
|
}
|
package/src/misc/package.json.ts
CHANGED
|
@@ -42,7 +42,7 @@ export function parseExportsField(exports: IExportsField): IFullExportsField {
|
|
|
42
42
|
if (!isPathMap(exports)) {
|
|
43
43
|
return { '.': exports };
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
const ret: IFullExportsField = {};
|
|
46
46
|
for (const [path, def] of Object.entries(exports)) {
|
|
47
47
|
if (typeof def === 'string') {
|
|
48
48
|
ret[path] = { default: def };
|
package/src/object/initOnRead.ts
CHANGED
package/src/object/objectSame.ts
CHANGED
|
@@ -33,8 +33,8 @@ export function isObjectSameRecursive(a: any, b: any) {
|
|
|
33
33
|
|
|
34
34
|
for (const k of aks) {
|
|
35
35
|
if (a[k] !== b[k]) {
|
|
36
|
-
const av = a[k]
|
|
37
|
-
|
|
36
|
+
const av = a[k];
|
|
37
|
+
const bv = b[k];
|
|
38
38
|
if (av && bv && typeof av === 'object' && typeof bv === 'object') {
|
|
39
39
|
if (Array.isArray(av)) {
|
|
40
40
|
if (Array.isArray(bv)) {
|