MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / logOwnersDiff

Function logOwnersDiff

packages/logger/src/log.ts:293–324  ·  view source on GitHub ↗
(
    from: readonly T[],
    to: readonly T[],
    diff: 'thorow' | 'stack',
    logGroup?: (owner: T) => void,
)

Source from the content-addressed store, hash-verified

291}
292
293function logOwnersDiff<T extends Solid.Owner>(
294 from: readonly T[],
295 to: readonly T[],
296 diff: 'thorow' | 'stack',
297 logGroup?: (owner: T) => void,
298): void {
299 const [getMark, owners] = diff === 'thorow' ? getDiffMap(from, to) : getStackDiffMap(from, to)
300
301 paddedForEach(
302 owners,
303 owner => NODE_TYPE_NAMES[getOwnerType(owner)],
304 (type, owner) => {
305 const mark = getMark(owner)
306 const name = getNodeName(owner)
307 const label = (() => {
308 if (mark === 'added')
309 return [`${inGray(type)} %c${name}%c new`, STYLES.grayBackground, STYLES.new]
310 if (mark === 'removed')
311 return [
312 `${inGray(type)} %c${name}`,
313 'background: rgba(153, 153, 153, 0.15); padding: 0 0.2em; border-radius: 4px; text-decoration: line-through; color: #888',
314 ]
315 return [`${inGray(type)} %c${name}`, STYLES.grayBackground]
316 })()
317 if (logGroup) {
318 console.groupCollapsed(...label)
319 logGroup(owner)
320 console.groupEnd()
321 } else console.log(...label)
322 },
323 )
324}
325
326export function logOwnerList<T extends Solid.Owner>(
327 owners: readonly T[],

Callers 2

logOwnedFunction · 0.85
logObserversFunction · 0.85

Calls 6

getDiffMapFunction · 0.90
getStackDiffMapFunction · 0.90
getOwnerTypeFunction · 0.90
getNodeNameFunction · 0.90
paddedForEachFunction · 0.85
inGrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…