@idlebox/common 1.5.14 → 1.5.15

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.
Files changed (33) hide show
  1. package/lib/autoindex.d.ts +2 -0
  2. package/lib/autoindex.d.ts.map +1 -1
  3. package/lib/autoindex.js +67 -65
  4. package/lib/autoindex.js.map +1 -1
  5. package/lib/debugging/inspect.d.ts +2 -0
  6. package/lib/debugging/inspect.d.ts.map +1 -1
  7. package/lib/debugging/inspect.js +20 -8
  8. package/lib/debugging/inspect.js.map +1 -1
  9. package/lib/lifecycle/dispose/bridges/function.d.ts.map +1 -1
  10. package/lib/lifecycle/dispose/bridges/function.js +5 -2
  11. package/lib/lifecycle/dispose/bridges/function.js.map +1 -1
  12. package/lib/lifecycle/dispose/bridges/streams.d.ts.map +1 -1
  13. package/lib/lifecycle/dispose/bridges/streams.js +9 -4
  14. package/lib/lifecycle/dispose/bridges/streams.js.map +1 -1
  15. package/lib/lifecycle/dispose/disposable.d.ts.map +1 -1
  16. package/lib/lifecycle/dispose/disposable.js +11 -1
  17. package/lib/lifecycle/dispose/disposable.js.map +1 -1
  18. package/lib/lifecycle/event/event.d.ts +2 -0
  19. package/lib/lifecycle/event/event.d.ts.map +1 -1
  20. package/lib/lifecycle/event/event.js +15 -1
  21. package/lib/lifecycle/event/event.js.map +1 -1
  22. package/lib/schedule/interval.d.ts +2 -0
  23. package/lib/schedule/interval.d.ts.map +1 -1
  24. package/lib/schedule/interval.js +11 -0
  25. package/lib/schedule/interval.js.map +1 -1
  26. package/package.json +3 -3
  27. package/src/autoindex.ts +90 -88
  28. package/src/debugging/inspect.ts +24 -4
  29. package/src/lifecycle/dispose/bridges/function.ts +11 -5
  30. package/src/lifecycle/dispose/bridges/streams.ts +47 -36
  31. package/src/lifecycle/dispose/disposable.ts +14 -1
  32. package/src/lifecycle/event/event.ts +18 -1
  33. package/src/schedule/interval.ts +12 -0
package/src/autoindex.ts CHANGED
@@ -15,36 +15,36 @@
15
15
  // @ts-ignore
16
16
 
17
17
  /* array/diff.ts */
18
- // Identifiers
18
+ // Identifiers (2)
19
19
  export type { IArrayUpdate } from "./array/diff.js";
20
20
  export { arrayDiff } from "./array/diff.js";
21
21
  /* array/is-same.ts */
22
- // Identifiers
22
+ // Identifiers (1)
23
23
  export { isArraySame } from "./array/is-same.js";
24
24
  /* array/normalize.ts */
25
- // Identifiers
25
+ // Identifiers (1)
26
26
  export { normalizeArray } from "./array/normalize.js";
27
27
  /* array/sort-alpha.ts */
28
- // Identifiers
28
+ // Identifiers (1)
29
29
  export { sortByString } from "./array/sort-alpha.js";
30
30
  /* array/unique.ts */
31
- // Identifiers
31
+ // Identifiers (4)
32
32
  export { arrayUnique } from "./array/unique.js";
33
33
  export { arrayUniqueReference } from "./array/unique.js";
34
34
  export type { IUniqueIdFactory } from "./array/unique.js";
35
35
  export { uniqueFilter } from "./array/unique.js";
36
36
  /* date/consts.ts */
37
- // Identifiers
37
+ // Identifiers (5)
38
38
  export { oneSecond } from "./date/consts.js";
39
39
  export { oneMinute } from "./date/consts.js";
40
40
  export { oneHour } from "./date/consts.js";
41
41
  export { oneDay } from "./date/consts.js";
42
42
  export { oneWeek } from "./date/consts.js";
43
43
  /* date/is-invalid.ts */
44
- // Identifiers
44
+ // Identifiers (1)
45
45
  export { isDateInvalid } from "./date/is-invalid.js";
46
46
  /* date/sibling.ts */
47
- // Identifiers
47
+ // Identifiers (7)
48
48
  export { nextSecond } from "./date/sibling.js";
49
49
  export { nextMinute } from "./date/sibling.js";
50
50
  export { nextHour } from "./date/sibling.js";
@@ -53,17 +53,19 @@
53
53
  export { nextMonth } from "./date/sibling.js";
54
54
  export { nextYear } from "./date/sibling.js";
55
55
  /* date/to-string.ts */
56
- // Identifiers
56
+ // Identifiers (1)
57
57
  export { humanDate } from "./date/to-string.js";
58
58
  /* date/unix.ts */
59
- // Identifiers
59
+ // Identifiers (2)
60
60
  export { getTimeStamp } from "./date/unix.js";
61
61
  export { fromTimeStamp } from "./date/unix.js";
62
62
  /* debugging/inspect.ts */
63
- // Identifiers
63
+ // Identifiers (3)
64
+ export { inspectSymbol } from "./debugging/inspect.js";
65
+ export { defineInspectMethod } from "./debugging/inspect.js";
64
66
  export { tryInspect } from "./debugging/inspect.js";
65
67
  /* debugging/object-with-name.ts */
66
- // Identifiers
68
+ // Identifiers (10)
67
69
  export type { NamedObject } from "./debugging/object-with-name.js";
68
70
  export { objectName } from "./debugging/object-with-name.js";
69
71
  export { nameObject } from "./debugging/object-with-name.js";
@@ -75,152 +77,152 @@
75
77
  export { nameFunction } from "./debugging/object-with-name.js";
76
78
  export { assertFunctionHasName } from "./debugging/object-with-name.js";
77
79
  /* debugging/serializable.ts */
78
- // Identifiers
80
+ // Identifiers (5)
79
81
  export { isScalar } from "./debugging/serializable.js";
80
82
  export { SerializableKind } from "./debugging/serializable.js";
81
83
  export { isSerializable } from "./debugging/serializable.js";
82
84
  export { getTypeOf } from "./debugging/serializable.js";
83
85
  export { assertSerializable } from "./debugging/serializable.js";
84
86
  /* error/convert-unknown.ts */
85
- // Identifiers
87
+ // Identifiers (1)
86
88
  export { convertCaughtError } from "./error/convert-unknown.js";
87
89
  /* error/get-frame.ts */
88
- // Identifiers
90
+ // Identifiers (1)
89
91
  export { getErrorFrame } from "./error/get-frame.js";
90
92
  /* error/known.ts */
91
- // Identifiers
93
+ // Identifiers (1)
92
94
  export { KnownError } from "./error/known.js";
93
95
  /* error/pretty.nodejs.ts */
94
- // Identifiers
96
+ // Identifiers (4)
95
97
  export { setErrorLogRoot } from "./error/pretty.nodejs.js";
96
98
  export { prettyPrintError } from "./error/pretty.nodejs.js";
97
99
  export { prettyFormatStack } from "./error/pretty.nodejs.js";
98
100
  export { prettyFormatError } from "./error/pretty.nodejs.js";
99
101
  /* error/pretty.vscode.ts */
100
- // Identifiers
102
+ // Identifiers (1)
101
103
  export { vscEscapeValue } from "./error/pretty.vscode.js";
102
104
  /* error/stack-parser.v8.ts */
103
- // Identifiers
105
+ // Identifiers (3)
104
106
  export { parseStackString } from "./error/stack-parser.v8.js";
105
107
  export type { IStructreStackLine } from "./error/stack-parser.v8.js";
106
108
  export { parseStackLine } from "./error/stack-parser.v8.js";
107
109
  /* error/stack-trace.ts */
108
- // Identifiers
110
+ // Identifiers (3)
109
111
  export type { StackTraceHolder } from "./error/stack-trace.js";
110
112
  export type { IWithStack } from "./error/stack-trace.js";
111
113
  export { createStackTraceHolder } from "./error/stack-trace.js";
112
114
  /* function/callback-list.async.ts */
113
- // Identifiers
115
+ // Identifiers (2)
114
116
  export type { MyAsyncCallback } from "./function/callback-list.async.js";
115
117
  export { AsyncCallbackList } from "./function/callback-list.async.js";
116
118
  /* function/callback-list.delay.ts */
117
- // Identifiers
119
+ // Identifiers (2)
118
120
  export type { MyDelayCallback } from "./function/callback-list.delay.js";
119
121
  export { MemorizedOnceCallbackList } from "./function/callback-list.delay.js";
120
122
  /* function/callback-list.ts */
121
- // Identifiers
123
+ // Identifiers (2)
122
124
  export type { MyCallback } from "./function/callback-list.js";
123
125
  export { CallbackList } from "./function/callback-list.js";
124
126
  /* function/noop.ts */
125
- // Identifiers
127
+ // Identifiers (1)
126
128
  export { noop } from "./function/noop.js";
127
129
  /* iterate/merge-iterable.ts */
128
- // Identifiers
130
+ // Identifiers (4)
129
131
  export { mergeIterables } from "./iterate/merge-iterable.js";
130
132
  export { joinAsyncIterables } from "./iterate/merge-iterable.js";
131
133
  export { interleaveIterables } from "./iterate/merge-iterable.js";
132
134
  export { interleaveAsyncIterables } from "./iterate/merge-iterable.js";
133
135
  /* legacy/rename.ts */
134
- // Identifiers
136
+ // Identifiers (4)
135
137
  export { toDisposable } from "./legacy/rename.js";
136
138
  export { AsyncDisposable } from "./legacy/rename.js";
137
139
  export { Disposable } from "./legacy/rename.js";
138
140
  export { convertCatchedError } from "./legacy/rename.js";
139
141
  /* lifecycle/cancellation/driver.browser.ts */
140
- // Identifiers
142
+ // Identifiers (0)
141
143
  /* lifecycle/cancellation/driver.common.ts */
142
- // Identifiers
144
+ // Identifiers (0)
143
145
  /* lifecycle/cancellation/source.ts */
144
- // Identifiers
146
+ // Identifiers (2)
145
147
  export type { CancellationToken } from "./lifecycle/cancellation/source.js";
146
148
  export { CancellationTokenSource } from "./lifecycle/cancellation/source.js";
147
149
  /* lifecycle/dispose/async-disposable.ts */
148
- // Identifiers
150
+ // Identifiers (2)
149
151
  export { EnhancedAsyncDisposable } from "./lifecycle/dispose/async-disposable.js";
150
152
  export { UnorderedAsyncDisposable } from "./lifecycle/dispose/async-disposable.js";
151
153
  /* lifecycle/dispose/bridges/function.ts */
152
- // Identifiers
154
+ // Identifiers (2)
153
155
  export { functionToDisposable } from "./lifecycle/dispose/bridges/function.js";
154
156
  export { disposerFunction } from "./lifecycle/dispose/bridges/function.js";
155
157
  /* lifecycle/dispose/bridges/native.ts */
156
- // Identifiers
158
+ // Identifiers (2)
157
159
  export { fromNativeDisposable } from "./lifecycle/dispose/bridges/native.js";
158
160
  export { toNativeDisposable } from "./lifecycle/dispose/bridges/native.js";
159
161
  /* lifecycle/dispose/bridges/streams.ts */
160
- // Identifiers
162
+ // Identifiers (2)
161
163
  export { closableToDisposable } from "./lifecycle/dispose/bridges/streams.js";
162
164
  export { endableToDisposable } from "./lifecycle/dispose/bridges/streams.js";
163
165
  /* lifecycle/dispose/debug.ts */
164
- // Identifiers
166
+ // Identifiers (0)
165
167
  /* lifecycle/dispose/disposable.ts */
166
- // Identifiers
168
+ // Identifiers (5)
167
169
  export { DuplicateDisposeAction } from "./lifecycle/dispose/disposable.js";
168
170
  export type { IDisposableEvents } from "./lifecycle/dispose/disposable.js";
169
171
  export type { IDisposable } from "./lifecycle/dispose/disposable.js";
170
172
  export type { IAsyncDisposable } from "./lifecycle/dispose/disposable.js";
171
173
  export { AbstractEnhancedDisposable } from "./lifecycle/dispose/disposable.js";
172
174
  /* lifecycle/dispose/disposableEvent.ts */
173
- // Identifiers
175
+ // Identifiers (4)
174
176
  export { addAnyKindOfListener } from "./lifecycle/dispose/disposableEvent.js";
175
177
  export type { IShorthandEmitterObject } from "./lifecycle/dispose/disposableEvent.js";
176
178
  export type { IEventEmitterObject } from "./lifecycle/dispose/disposableEvent.js";
177
179
  export { addDisposableEventListener } from "./lifecycle/dispose/disposableEvent.js";
178
180
  /* lifecycle/dispose/disposedError.ts */
179
- // Identifiers
181
+ // Identifiers (2)
180
182
  export { DisposedError } from "./lifecycle/dispose/disposedError.js";
181
183
  export { DuplicateDisposed } from "./lifecycle/dispose/disposedError.js";
182
184
  /* lifecycle/dispose/sync-disposable.ts */
183
- // Identifiers
185
+ // Identifiers (2)
184
186
  export { DisposableOnce } from "./lifecycle/dispose/sync-disposable.js";
185
187
  export { EnhancedDisposable } from "./lifecycle/dispose/sync-disposable.js";
186
188
  /* lifecycle/event/event.ts */
187
- // Identifiers
189
+ // Identifiers (1)
188
190
  export { Emitter } from "./lifecycle/event/event.js";
189
191
  /* lifecycle/event/memorized.ts */
190
- // Identifiers
192
+ // Identifiers (1)
191
193
  export { MemorizedEmitter } from "./lifecycle/event/memorized.js";
192
194
  /* lifecycle/event/type.ts */
193
- // Identifiers
195
+ // Identifiers (4)
194
196
  export type { IEventEmitter } from "./lifecycle/event/type.js";
195
197
  export type { EventHandler } from "./lifecycle/event/type.js";
196
198
  export type { EventRegister } from "./lifecycle/event/type.js";
197
199
  export type { EventEmitterMap } from "./lifecycle/event/type.js";
198
200
  /* lifecycle/global/global-lifecycle.ts */
199
- // Identifiers
201
+ // Identifiers (3)
200
202
  export { registerGlobalLifecycle } from "./lifecycle/global/global-lifecycle.js";
201
203
  export { ensureDisposeGlobal } from "./lifecycle/global/global-lifecycle.js";
202
204
  export { disposeGlobal } from "./lifecycle/global/global-lifecycle.js";
203
205
  /* log/logger.ts */
204
- // Identifiers
206
+ // Identifiers (3)
205
207
  export { ColorKind } from "./log/logger.js";
206
208
  export type { WrappedConsoleOptions } from "./log/logger.js";
207
209
  export { WrappedConsole } from "./log/logger.js";
208
210
  /* map-and-set/custom-set.ts */
209
- // Identifiers
211
+ // Identifiers (2)
210
212
  export type { Finder } from "./map-and-set/custom-set.js";
211
213
  export { CustomSet } from "./map-and-set/custom-set.js";
212
214
  /* map-and-set/object-map.ts */
213
- // Identifiers
215
+ // Identifiers (1)
214
216
  export { convertToMap } from "./map-and-set/object-map.js";
215
217
  /* map-and-set/required-map.ts */
216
- // Identifiers
218
+ // Identifiers (2)
217
219
  export { RequiredMap } from "./map-and-set/required-map.js";
218
220
  export { InstanceMap } from "./map-and-set/required-map.js";
219
221
  /* misc/assertNotNull.ts */
220
- // Identifiers
222
+ // Identifiers (1)
221
223
  export { assertNotNull } from "./misc/assertNotNull.js";
222
224
  /* misc/package.json.ts */
223
- // Identifiers
225
+ // Identifiers (9)
224
226
  export type { IExportCondition } from "./misc/package.json.js";
225
227
  export type { IExportMap } from "./misc/package.json.js";
226
228
  export type { IFullExportsField } from "./misc/package.json.js";
@@ -231,58 +233,58 @@
231
233
  export type { IPackageJson } from "./misc/package.json.js";
232
234
  export type { IPackageJsonNpmDist } from "./misc/package.json.js";
233
235
  /* object/definePublicConstant.ts */
234
- // Identifiers
236
+ // Identifiers (2)
235
237
  export { definePublicConstant } from "./object/definePublicConstant.js";
236
238
  export { definePrivateConstant } from "./object/definePublicConstant.js";
237
239
  /* object/initOnRead.ts */
238
- // Identifiers
240
+ // Identifiers (2)
239
241
  export type { InitFunc } from "./object/initOnRead.js";
240
242
  export { initOnRead } from "./object/initOnRead.js";
241
243
  /* object/objectPath.ts */
242
- // Identifiers
244
+ // Identifiers (2)
243
245
  export { objectPath } from "./object/objectPath.js";
244
246
  export { ObjectPath } from "./object/objectPath.js";
245
247
  /* object/objectSame.ts */
246
- // Identifiers
248
+ // Identifiers (2)
247
249
  export { isObjectSame } from "./object/objectSame.js";
248
250
  export { isObjectSameRecursive } from "./object/objectSame.js";
249
251
  /* path/isAbsolute.ts */
250
- // Identifiers
252
+ // Identifiers (1)
251
253
  export { isAbsolute } from "./path/isAbsolute.js";
252
254
  /* path/normalizePath.ts */
253
- // Identifiers
255
+ // Identifiers (5)
254
256
  export { PathKind } from "./path/normalizePath.js";
255
257
  export type { IPathInfo } from "./path/normalizePath.js";
256
258
  export { analyzePath } from "./path/normalizePath.js";
257
259
  export { normalizePath } from "./path/normalizePath.js";
258
260
  export { relativePath } from "./path/normalizePath.js";
259
261
  /* path/pathArray.ts */
260
- // Identifiers
262
+ // Identifiers (3)
261
263
  export { PathArrayWindows } from "./path/pathArray.js";
262
264
  export { PathArrayPosix } from "./path/pathArray.js";
263
265
  export { PathArray } from "./path/pathArray.js";
264
266
  /* path/pathCalc.ts */
265
- // Identifiers
267
+ // Identifiers (1)
266
268
  export { isPathContains } from "./path/pathCalc.js";
267
269
  /* platform/compile.ts */
268
- // Identifiers
270
+ // Identifiers (2)
269
271
  export { isProductionMode } from "./platform/compile.js";
270
272
  export { isBuildMode } from "./platform/compile.js";
271
273
  /* platform/globalObject.ts */
272
- // Identifiers
274
+ // Identifiers (2)
273
275
  export { globalObject } from "./platform/globalObject.js";
274
276
  export { ensureGlobalObject } from "./platform/globalObject.js";
275
277
  /* platform/globalSingleton.ts */
276
- // Identifiers
278
+ // Identifiers (3)
277
279
  export { globalSingletonStrong } from "./platform/globalSingleton.js";
278
280
  export { globalSingletonDelete } from "./platform/globalSingleton.js";
279
281
  export { globalSingleton } from "./platform/globalSingleton.js";
280
282
  /* platform/globalSymbol.ts */
281
- // Identifiers
283
+ // Identifiers (2)
282
284
  export { createSymbol } from "./platform/globalSymbol.js";
283
285
  export { deleteSymbol } from "./platform/globalSymbol.js";
284
286
  /* platform/os.ts */
285
- // Identifiers
287
+ // Identifiers (16)
286
288
  export { hasProcess } from "./platform/os.js";
287
289
  export { hasWindow } from "./platform/os.js";
288
290
  export { hasGlobal } from "./platform/os.js";
@@ -300,101 +302,101 @@
300
302
  export { sepList } from "./platform/os.js";
301
303
  export { is32Bit } from "./platform/os.js";
302
304
  /* promise/await-iterator.ts */
303
- // Identifiers
305
+ // Identifiers (1)
304
306
  export { awaitIterator } from "./promise/await-iterator.js";
305
307
  /* promise/deferred-promise.ts */
306
- // Identifiers
308
+ // Identifiers (4)
307
309
  export type { ValueCallback } from "./promise/deferred-promise.js";
308
310
  export type { ProgressCallback } from "./promise/deferred-promise.js";
309
311
  export type { IProgressHolder } from "./promise/deferred-promise.js";
310
312
  export { DeferredPromise } from "./promise/deferred-promise.js";
311
313
  /* promise/promise-bool.ts */
312
- // Identifiers
314
+ // Identifiers (1)
313
315
  export { promiseBool } from "./promise/promise-bool.js";
314
316
  /* promise/promise-list.ts */
315
- // Identifiers
317
+ // Identifiers (1)
316
318
  export { PromiseCollection } from "./promise/promise-list.js";
317
319
  /* re-export.ts */
318
- // Identifiers
319
- // References
320
+ // Identifiers (0)
321
+ // References (1)
320
322
  export * from "@idlebox/errors";
321
323
  /* reflection/classes/pointer.ts */
322
- // Identifiers
324
+ // Identifiers (2)
323
325
  export type { Ref } from "./reflection/classes/pointer.js";
324
326
  export { Pointer } from "./reflection/classes/pointer.js";
325
327
  /* reflection/classes/singleton.ts */
326
- // Identifiers
328
+ // Identifiers (4)
327
329
  export { singletonSymbol } from "./reflection/classes/singleton.js";
328
330
  export { SingletonType } from "./reflection/classes/singleton.js";
329
331
  export { singleton } from "./reflection/classes/singleton.js";
330
332
  export { createSingleton } from "./reflection/classes/singleton.js";
331
333
  /* reflection/methods/bind.ts */
332
- // Identifiers
334
+ // Identifiers (1)
333
335
  export { bindThis } from "./reflection/methods/bind.js";
334
336
  /* reflection/methods/memorize.ts */
335
- // Identifiers
337
+ // Identifiers (2)
336
338
  export { memo } from "./reflection/methods/memorize.js";
337
339
  export { forgetMemorized } from "./reflection/methods/memorize.js";
338
340
  /* schedule/extendable-timer.ts */
339
- // Identifiers
341
+ // Identifiers (1)
340
342
  export { ExtendableTimer } from "./schedule/extendable-timer.js";
341
343
  /* schedule/interval.ts */
342
- // Identifiers
344
+ // Identifiers (2)
343
345
  export { interval } from "./schedule/interval.js";
344
346
  export { Interval } from "./schedule/interval.js";
345
347
  /* schedule/local-type.ts */
346
- // Identifiers
348
+ // Identifiers (2)
347
349
  export type { TimeoutType } from "./schedule/local-type.js";
348
350
  export type { IntervalType } from "./schedule/local-type.js";
349
351
  /* schedule/scheduler.ts */
350
- // Identifiers
352
+ // Identifiers (1)
351
353
  export { scheduler } from "./schedule/scheduler.js";
352
354
  /* schedule/timeout.ts */
353
- // Identifiers
355
+ // Identifiers (3)
354
356
  export { timeout } from "./schedule/timeout.js";
355
357
  export { sleep } from "./schedule/timeout.js";
356
358
  export { raceTimeout } from "./schedule/timeout.js";
357
359
  /* state/simple-state-machine.ts */
358
- // Identifiers
360
+ // Identifiers (3)
359
361
  export type { ISsmRuleMap } from "./state/simple-state-machine.js";
360
362
  export type { IStateChangeEvent } from "./state/simple-state-machine.js";
361
363
  export { SimpleStateMachine } from "./state/simple-state-machine.js";
362
364
  /* string/case-cast.ts */
363
- // Identifiers
365
+ // Identifiers (5)
364
366
  export { camelCase } from "./string/case-cast.js";
365
367
  export { ucfirst } from "./string/case-cast.js";
366
368
  export { lcfirst } from "./string/case-cast.js";
367
369
  export { linux_case } from "./string/case-cast.js";
368
370
  export { linux_case_hyphen } from "./string/case-cast.js";
369
371
  /* string/concatType.generated.ts */
370
- // Identifiers
372
+ // Identifiers (1)
371
373
  export { concatStringType } from "./string/concatType.generated.js";
372
374
  /* string/escape-regexp.ts */
373
- // Identifiers
375
+ // Identifiers (1)
374
376
  export { escapeRegExp } from "./string/escape-regexp.js";
375
377
  /* string/human-bytes.ts */
376
- // Identifiers
378
+ // Identifiers (3)
377
379
  export { humanSizeSI } from "./string/human-bytes.js";
378
380
  export { humanSize } from "./string/human-bytes.js";
379
381
  export { humanSpeed } from "./string/human-bytes.js";
380
382
  /* string/pad2.ts */
381
- // Identifiers
383
+ // Identifiers (1)
382
384
  export { pad2 } from "./string/pad2.js";
383
385
  /* typing-helper/callback.ts */
384
- // Identifiers
386
+ // Identifiers (1)
385
387
  export type { ICommonCallback } from "./typing-helper/callback.js";
386
388
  /* typing-helper/deep.partial.ts */
387
- // Identifiers
389
+ // Identifiers (1)
388
390
  export type { DeepPartial } from "./typing-helper/deep.partial.js";
389
391
  /* typing-helper/deep.readonly.ts */
390
- // Identifiers
392
+ // Identifiers (1)
391
393
  export type { DeepReadonly } from "./typing-helper/deep.readonly.js";
392
394
  /* typing-helper/deep.required.ts */
393
- // Identifiers
395
+ // Identifiers (1)
394
396
  export type { DeepNonNullable } from "./typing-helper/deep.required.js";
395
397
  /* typing-helper/deep.writable.ts */
396
- // Identifiers
398
+ // Identifiers (1)
397
399
  export type { DeepWriteable } from "./typing-helper/deep.writable.js";
398
400
  /* typing-helper/literal.ts */
399
- // Identifiers
401
+ // Identifiers (1)
400
402
  export type { Primitive } from "./typing-helper/literal.js";
@@ -1,16 +1,36 @@
1
- const inspect = Symbol.for('nodejs.util.inspect.custom'); // high version node
1
+ import { definePrivateConstant } from '../object/definePublicConstant.js';
2
+
3
+ export const inspectSymbol = Symbol.for('nodejs.util.inspect.custom'); // high version node
4
+
5
+ export function defineInspectMethod<T>(obj: T, method: (this: T, depth: number, context: any, inspect: Function) => string): T {
6
+ definePrivateConstant(obj, inspectSymbol, method);
7
+ return obj;
8
+ }
2
9
 
3
10
  /**
4
11
  * try to call `inspect` method of an object, if not exists, call `toString`.
5
12
  * @returns {string}
6
13
  */
7
- export function tryInspect(object: any): string {
14
+ export function tryInspect(object: any): string;
15
+ /** @internal */
16
+ export function tryInspect(object: any, options: any): string;
17
+ export function tryInspect(object: any, options?: any): string {
8
18
  if (!object || typeof object !== 'object') {
9
19
  return JSON.stringify(object);
10
20
  }
11
21
 
12
- if (object[inspect]) {
13
- return object[inspect]();
22
+ if (object[inspectSymbol]) {
23
+ if (options) {
24
+ options.depth--;
25
+ } else {
26
+ options = {
27
+ depth: 3,
28
+ stylize(s: string) {
29
+ return s;
30
+ },
31
+ };
32
+ }
33
+ return object[inspectSymbol](options.depth, options, tryInspect);
14
34
  }
15
35
  if (object.inspect) {
16
36
  return object.inspect();
@@ -1,3 +1,4 @@
1
+ import { defineInspectMethod } from '../../../debugging/inspect.js';
1
2
  import { functionName, nameObject } from '../../../debugging/object-with-name.js';
2
3
  import { dispose_name } from '../debug.js';
3
4
  import type { IAsyncDisposable, IDisposable } from '../disposable.js';
@@ -7,12 +8,17 @@ import type { IAsyncDisposable, IDisposable } from '../disposable.js';
7
8
  * @public
8
9
  */
9
10
  export function functionToDisposable<RT>(fn: () => RT): RT extends Promise<any> ? IAsyncDisposable : IDisposable {
10
- return {
11
- get displayName() {
12
- return `disposeFn(${functionName(fn)})`;
11
+ return defineInspectMethod(
12
+ {
13
+ get displayName() {
14
+ return `disposeFn(${functionName(fn)})`;
15
+ },
16
+ dispose: fn,
17
+ } as any,
18
+ (_depth, options) => {
19
+ return options.stylize(`[FunctionDisposable ${functionName(fn)}]`, 'special');
13
20
  },
14
- dispose: fn,
15
- } as any;
21
+ );
16
22
  }
17
23
 
18
24
  /**
@@ -1,3 +1,4 @@
1
+ import { defineInspectMethod } from '../../../debugging/inspect.js';
1
2
  import { objectName } from '../../../debugging/object-with-name.js';
2
3
  import type { IAsyncDisposable } from '../disposable.js';
3
4
 
@@ -13,26 +14,31 @@ type ClosableAsync = {
13
14
  export function closableToDisposable<T extends ClosableAsync>(closable: T): IAsyncDisposable {
14
15
  const promised = closable.close.length === 0;
15
16
 
16
- return {
17
- get displayName() {
18
- return `closable(${objectName(closable) || 'unknown'})`;
19
- },
20
- dispose(): Promise<void> {
21
- if (promised) {
22
- return Promise.resolve(closable.close()).then(() => undefined);
23
- } else {
24
- return new Promise<void>((resolve, reject) => {
25
- closable.close((error) => {
26
- if (error) {
27
- reject(error);
28
- } else {
29
- resolve();
30
- }
17
+ return defineInspectMethod(
18
+ {
19
+ get displayName() {
20
+ return `closable(${objectName(closable) || 'unknown'})`;
21
+ },
22
+ dispose(): Promise<void> {
23
+ if (promised) {
24
+ return Promise.resolve(closable.close()).then(() => undefined);
25
+ } else {
26
+ return new Promise<void>((resolve, reject) => {
27
+ closable.close((error) => {
28
+ if (error) {
29
+ reject(error);
30
+ } else {
31
+ resolve();
32
+ }
33
+ });
31
34
  });
32
- });
33
- }
35
+ }
36
+ },
37
+ },
38
+ (_depth, options) => {
39
+ return options.stylize(`[ClosableDisposable ${objectName(closable) || 'unknown'}]`, 'special');
34
40
  },
35
- };
41
+ );
36
42
  }
37
43
 
38
44
  type EndableAsync = {
@@ -47,24 +53,29 @@ type EndableAsync = {
47
53
  export function endableToDisposable<T extends EndableAsync>(endable: T): IAsyncDisposable {
48
54
  const promised = endable.end.length === 0;
49
55
 
50
- return {
51
- get displayName() {
52
- return `endable(${objectName(endable) || 'unknown'})`;
53
- },
54
- dispose(): Promise<void> {
55
- if (promised) {
56
- return Promise.resolve(endable.end()).then(() => undefined);
57
- } else {
58
- return new Promise<void>((resolve, reject) => {
59
- return endable.end((error) => {
60
- if (error) {
61
- reject(error);
62
- } else {
63
- resolve();
64
- }
56
+ return defineInspectMethod(
57
+ {
58
+ get displayName() {
59
+ return `endable(${objectName(endable) || 'unknown'})`;
60
+ },
61
+ dispose(): Promise<void> {
62
+ if (promised) {
63
+ return Promise.resolve(endable.end()).then(() => undefined);
64
+ } else {
65
+ return new Promise<void>((resolve, reject) => {
66
+ return endable.end((error) => {
67
+ if (error) {
68
+ reject(error);
69
+ } else {
70
+ resolve();
71
+ }
72
+ });
65
73
  });
66
- });
67
- }
74
+ }
75
+ },
76
+ },
77
+ (_depth, options) => {
78
+ return options.stylize(`[EndableDisposable ${objectName(endable) || 'unknown'}]`, 'special');
68
79
  },
69
- };
80
+ );
70
81
  }