🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@solid-devtools/shared

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-devtools/shared - npm Package Compare versions

Comparing version
0.7.4
to
0.8.0
+76
dist/chunk-HUGDDQ47.js
// src/utils.ts
var getLogLabel = () => [
`%csolid-devtools`,
"color: #fff; background: #2c4f7c; padding: 1px 4px;"
];
function info(data) {
console.info(...getLogLabel(), data);
return data;
}
function log(...args) {
console.log(...getLogLabel(), ...args);
}
function warn(...args) {
console.warn(...getLogLabel(), ...args);
}
function formatTime(d = new Date()) {
return ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2) + ":" + ("0" + d.getSeconds()).slice(-2);
}
function callArrayProp(object, key, ...args) {
const arr = object[key];
if (arr)
for (const cb of arr)
cb(...args);
}
function pushToArrayProp(object, key, value) {
let arr = object[key];
if (arr)
arr.push(value);
else
arr = object[key] = [value];
return arr;
}
function mutateFilter(array, predicate) {
const temp = array.filter(predicate);
array.length = 0;
array.push.apply(array, temp);
}
function mutateRemove(array, item) {
array.splice(array.indexOf(item), 1);
}
var dedupeArray = (array) => Array.from(new Set(array));
var arrayRefEquals = (a, b) => a === b || a.length === b.length && a.every((e) => b.includes(e));
function trimString(str, maxLength) {
if (str.length <= maxLength)
return str;
return str.slice(0, maxLength) + "\u2026";
}
function findIndexById(array, id) {
for (let i = 0; i < array.length; i++)
if (array[i].id === id)
return i;
return -1;
}
function findItemById(array, id) {
for (let i = 0; i < array.length; i++) {
const item = array[i];
if (item.id === id)
return item;
}
}
export {
info,
log,
warn,
formatTime,
callArrayProp,
pushToArrayProp,
mutateFilter,
mutateRemove,
dedupeArray,
arrayRefEquals,
trimString,
findIndexById,
findItemById
};
+13
-13

@@ -1,4 +0,4 @@

@solid-devtools/shared:build: cache hit, replaying output 5cc1fdcb668a2d23
@solid-devtools/shared:build: cache hit, replaying output 25e1f10923c9b0e5
@solid-devtools/shared:build:
@solid-devtools/shared:build: > @solid-devtools/shared@0.7.4 build /home/runner/work/solid-devtools/solid-devtools/packages/shared
@solid-devtools/shared:build: > @solid-devtools/shared@0.8.0 build /home/runner/work/solid-devtools/solid-devtools/packages/shared
@solid-devtools/shared:build: > tsup

@@ -17,24 +17,24 @@ @solid-devtools/shared:build:

@solid-devtools/shared:build: ESM dist/graph.js 618.00 B
@solid-devtools/shared:build: ESM dist/utils.js 353.00 B
@solid-devtools/shared:build: ESM dist/chunk-QTPCQOAB.js 1.43 KB
@solid-devtools/shared:build: ESM dist/utils.js 419.00 B
@solid-devtools/shared:build: ESM dist/chunk-HUGDDQ47.js 1.74 KB
@solid-devtools/shared:build: ESM dist/variables.js 406.00 B
@solid-devtools/shared:build: ESM dist/serialize.js 2.94 KB
@solid-devtools/shared:build: ESM dist/primitives.js 1.34 KB
@solid-devtools/shared:build: ESM ⚡️ Build success in 76ms
@solid-devtools/shared:build: ESM dist/primitives.js 1.14 KB
@solid-devtools/shared:build: ESM ⚡️ Build success in 55ms
@solid-devtools/shared:build: CJS dist/bridge.cjs 2.37 KB
@solid-devtools/shared:build: CJS dist/diff.cjs 1.72 KB
@solid-devtools/shared:build: CJS dist/graph.cjs 1.62 KB
@solid-devtools/shared:build: CJS dist/utils.cjs 2.72 KB
@solid-devtools/shared:build: CJS dist/utils.cjs 3.11 KB
@solid-devtools/shared:build: CJS dist/variables.cjs 1.63 KB
@solid-devtools/shared:build: CJS dist/serialize.cjs 4.09 KB
@solid-devtools/shared:build: CJS dist/primitives.cjs 2.64 KB
@solid-devtools/shared:build: CJS ⚡️ Build success in 91ms
@solid-devtools/shared:build: CJS dist/primitives.cjs 2.40 KB
@solid-devtools/shared:build: CJS ⚡️ Build success in 73ms
@solid-devtools/shared:build: DTS Build start
@solid-devtools/shared:build: DTS ⚡️ Build success in 6578ms
@solid-devtools/shared:build: DTS ⚡️ Build success in 6142ms
@solid-devtools/shared:build: DTS dist/bridge.d.ts 2.81 KB
@solid-devtools/shared:build: DTS dist/graph.d.ts 5.51 KB
@solid-devtools/shared:build: DTS dist/graph.d.ts 4.27 KB
@solid-devtools/shared:build: DTS dist/variables.d.ts 422.00 B
@solid-devtools/shared:build: DTS dist/serialize.d.ts 1.79 KB
@solid-devtools/shared:build: DTS dist/diff.d.ts 436.00 B
@solid-devtools/shared:build: DTS dist/utils.d.ts 1.21 KB
@solid-devtools/shared:build: DTS dist/primitives.d.ts 1.09 KB
@solid-devtools/shared:build: DTS dist/utils.d.ts 1.43 KB
@solid-devtools/shared:build: DTS dist/primitives.d.ts 893.00 B

@@ -1,9 +0,10 @@

@solid-devtools/shared:test: cache hit, replaying output d942b0bca1217d23
@solid-devtools/shared:test: cache hit, replaying output f2946bce2492e452
@solid-devtools/shared:test:
@solid-devtools/shared:test: > @solid-devtools/shared@0.7.4 test /home/runner/work/solid-devtools/solid-devtools/packages/shared
@solid-devtools/shared:test: > @solid-devtools/shared@0.8.0 test /home/runner/work/solid-devtools/solid-devtools/packages/shared
@solid-devtools/shared:test: > jest --config jest.config.ts
@solid-devtools/shared:test:
@solid-devtools/shared:test: PASS test/serialise.test.ts (15.616 s)
@solid-devtools/shared:test: ts-jest[versions] (WARN) Version 29.0.3 of babel-jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=28.0.0 <29.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
@solid-devtools/shared:test: PASS test/serialise.test.ts (14.007 s)
@solid-devtools/shared:test: encodeValue Preview
@solid-devtools/shared:test: ✓ Infinity (28 ms)
@solid-devtools/shared:test: ✓ Infinity (19 ms)
@solid-devtools/shared:test: ✓ Negative Infinity (1 ms)

@@ -13,26 +14,26 @@ @solid-devtools/shared:test: ✓ NaN (1 ms)

@solid-devtools/shared:test: ✓ Boolean true (1 ms)
@solid-devtools/shared:test: ✓ Boolean false (12 ms)
@solid-devtools/shared:test: ✓ String
@solid-devtools/shared:test: ✓ Boolean false (17 ms)
@solid-devtools/shared:test: ✓ String (1 ms)
@solid-devtools/shared:test: ✓ String (1 ms)
@solid-devtools/shared:test: ✓ Null (1 ms)
@solid-devtools/shared:test: ✓ Undefined (17 ms)
@solid-devtools/shared:test: ✓ Undefined (1 ms)
@solid-devtools/shared:test: ✓ Named Symbol (1 ms)
@solid-devtools/shared:test: ✓ Symbol (1 ms)
@solid-devtools/shared:test: ✓ Symbol
@solid-devtools/shared:test: ✓ Function
@solid-devtools/shared:test: ✓ Named Function
@solid-devtools/shared:test: ✓ Element div (13 ms)
@solid-devtools/shared:test: ✓ Named Function (1 ms)
@solid-devtools/shared:test: ✓ Element div (29 ms)
@solid-devtools/shared:test: ✓ Element a (1 ms)
@solid-devtools/shared:test: ✓ Array empty (1 ms)
@solid-devtools/shared:test: ✓ Array empty
@solid-devtools/shared:test: ✓ Array
@solid-devtools/shared:test: ✓ Object empty (1 ms)
@solid-devtools/shared:test: ✓ Object empty
@solid-devtools/shared:test: ✓ Object
@solid-devtools/shared:test: ✓ Date (12 ms)
@solid-devtools/shared:test: ✓ Error (1 ms)
@solid-devtools/shared:test: ✓ Map
@solid-devtools/shared:test: ✓ WeakMap (1 ms)
@solid-devtools/shared:test: ✓ Set
@solid-devtools/shared:test: ✓ Date
@solid-devtools/shared:test: ✓ Error
@solid-devtools/shared:test: ✓ Map (1 ms)
@solid-devtools/shared:test: ✓ WeakMap
@solid-devtools/shared:test: ✓ Set (1 ms)
@solid-devtools/shared:test: encodeValue Deep
@solid-devtools/shared:test: ✓ Array empty
@solid-devtools/shared:test: ✓ Array shallow (13 ms)
@solid-devtools/shared:test: ✓ Array nested (1 ms)
@solid-devtools/shared:test: ✓ Array shallow (1 ms)
@solid-devtools/shared:test: ✓ Array nested (13 ms)
@solid-devtools/shared:test: ✓ Object empty (1 ms)

@@ -42,6 +43,6 @@ @solid-devtools/shared:test: ✓ Object shallow

@solid-devtools/shared:test: save elements to a map
@solid-devtools/shared:test: ✓ Element div (12 ms)
@solid-devtools/shared:test: ✓ Element a (1 ms)
@solid-devtools/shared:test: ✓ Element div (26 ms)
@solid-devtools/shared:test: ✓ Element a
@solid-devtools/shared:test: ✓ Element in object (1 ms)
@solid-devtools/shared:test: ✓ map containing correct values
@solid-devtools/shared:test: ✓ map containing correct values (1 ms)
@solid-devtools/shared:test:

@@ -51,3 +52,3 @@ @solid-devtools/shared:test: Test Suites: 1 passed, 1 total

@solid-devtools/shared:test: Snapshots: 0 total
@solid-devtools/shared:test: Time: 16.938 s
@solid-devtools/shared:test: Time: 15.453 s
@solid-devtools/shared:test: Ran all test suites.

@@ -1,5 +0,5 @@

@solid-devtools/shared:typecheck: cache hit, replaying output 39863f6f26380ac2
@solid-devtools/shared:typecheck: cache hit, replaying output 4a0972ebd9d0b08f
@solid-devtools/shared:typecheck:
@solid-devtools/shared:typecheck: > @solid-devtools/shared@0.7.4 typecheck /home/runner/work/solid-devtools/solid-devtools/packages/shared
@solid-devtools/shared:typecheck: > @solid-devtools/shared@0.8.0 typecheck /home/runner/work/solid-devtools/solid-devtools/packages/shared
@solid-devtools/shared:typecheck: > tsc --noEmit
@solid-devtools/shared:typecheck:
# solid-devtools-shared
## 0.8.0
### Minor Changes
- 5e913ac: Add virtualization of the structure tree.
### Patch Changes
- 089331d: Changes to the way roots and sub roots are handled.
Now every sub root will track their own graph independently, instead of being attached to parent tree.
Additionally the roots() and serializedRoots() signals were replaced with event emitter. (#108)
## 0.7.4

@@ -4,0 +17,0 @@

import {
log
} from "./chunk-QTPCQOAB.js";
} from "./chunk-HUGDDQ47.js";

@@ -5,0 +5,0 @@ // src/bridge.ts

import * as solid_js_types_reactive_signal from 'solid-js/types/reactive/signal';
import { Many } from '@solid-primitives/utils';
import { INTERNAL, NOTFOUND } from './variables.js';
import { INTERNAL } from './variables.js';
import { EncodedValue } from './serialize.js';

@@ -33,3 +33,2 @@

sdtType?: NodeType;
ownedRoots?: Set<Solid.Root>;
}

@@ -39,3 +38,2 @@ interface Computation<Init, Next> {

sdtType?: NodeType;
ownedRoots?: Set<Solid.Root>;
onValueUpdate?: Record<symbol, ValueUpdateListener>;

@@ -60,3 +58,3 @@ onComputationUpdate?: VoidFunction;

isDisposed?: boolean;
sdtAttached?: true;
sdtAttachedTo?: Owner | null;
sdtContext?: DebuggerContext;

@@ -103,3 +101,3 @@ value?: undefined;

removed: NodeID[];
updated: Mapped.SRoot[];
updated: Record<NodeID, Mapped.Root>;
};

@@ -114,10 +112,5 @@ declare type SignalUpdate = {

id: NodeID;
attachedTo?: NodeID;
tree: Owner;
components: Component[];
}
/** serialised (without components) */
interface SRoot {
id: NodeID;
tree: Owner;
}
interface Owner {

@@ -128,3 +121,2 @@ id: NodeID;

children: Owner[];
sources: number;
}

@@ -165,41 +157,3 @@ interface Signal {

}
declare namespace Graph {
interface Root {
readonly id: NodeID;
readonly tree: Owner;
}
interface Owner {
readonly id: NodeID;
readonly name: string;
readonly type: NodeType;
readonly sources: number;
readonly children: Owner[];
}
type Signal = {
readonly type: NodeType.Signal | NodeType.Memo;
readonly name: string;
readonly id: NodeID;
readonly observers: NodeID[];
readonly value: EncodedValue<boolean>;
readonly selected: boolean;
};
type Path = (Owner | typeof NOTFOUND)[];
type Props = {
proxy: boolean;
record: Record<string, {
selected: boolean;
value: EncodedValue<boolean>;
}>;
};
interface OwnerDetails {
readonly id: NodeID;
readonly name: string;
readonly type: NodeType;
readonly path: Path;
readonly rawPath: NodeID[];
readonly signals: Record<NodeID, Signal>;
readonly props?: Props;
}
}
export { ComputationUpdate, Core, DebuggerContext, Graph, Mapped, NodeID, NodeType, RootsUpdates, SignalUpdate, Solid, ValueUpdateListener, getOwner };
export { ComputationUpdate, Core, DebuggerContext, Mapped, NodeID, NodeType, RootsUpdates, SignalUpdate, Solid, ValueUpdateListener, getOwner };

@@ -23,3 +23,2 @@ "use strict";

__export(primitives_exports, {
createBoundSelector: () => createBoundSelector,
createConsumers: () => createConsumers,

@@ -63,9 +62,4 @@ createDerivedSignal: () => createDerivedSignal,

}
function createBoundSelector(source, fn) {
const selector = (0, import_solid_js.createSelector)(source, fn);
return [(item) => selector.bind(void 0, item), selector];
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createBoundSelector,
createConsumers,

@@ -72,0 +66,0 @@ createDerivedSignal,

@@ -1,2 +0,2 @@

import { MemoOptions, EqualityCheckerFunction } from 'solid-js/types/reactive/signal';
import { MemoOptions } from 'solid-js/types/reactive/signal';
import { Accessor } from 'solid-js';

@@ -24,4 +24,3 @@ import { AnyFunction } from '@solid-primitives/utils';

declare function createDerivedSignal<T>(fallback: T, options?: MemoOptions<T>): DerivedSignal<T>;
declare function createBoundSelector<T, U>(source: Accessor<T>, fn?: EqualityCheckerFunction<T, U>): [useSelector: (item: U) => Accessor<boolean>, selector: (item: U) => boolean];
export { DerivedSignal, createBoundSelector, createConsumers, createDerivedSignal, untrackedCallback };
export { DerivedSignal, createConsumers, createDerivedSignal, untrackedCallback };
// src/primitives.ts
import {
createMemo,
createSignal,
getOwner,
onCleanup,
createSelector,
untrack
} from "solid-js";
import { createMemo, createSignal, getOwner, onCleanup, untrack } from "solid-js";
import { remove } from "@solid-primitives/immutable";

@@ -42,8 +35,3 @@ import { onRootCleanup } from "@solid-primitives/utils";

}
function createBoundSelector(source, fn) {
const selector = createSelector(source, fn);
return [(item) => selector.bind(void 0, item), selector];
}
export {
createBoundSelector,
createConsumers,

@@ -50,0 +38,0 @@ createDerivedSignal,

@@ -26,2 +26,4 @@ "use strict";

dedupeArray: () => dedupeArray,
findIndexById: () => findIndexById,
findItemById: () => findItemById,
formatTime: () => formatTime,

@@ -83,2 +85,15 @@ info: () => info,

}
function findIndexById(array, id) {
for (let i = 0; i < array.length; i++)
if (array[i].id === id)
return i;
return -1;
}
function findItemById(array, id) {
for (let i = 0; i < array.length; i++) {
const item = array[i];
if (item.id === id)
return item;
}
}
// Annotate the CommonJS export names for ESM import in node:

@@ -89,2 +104,4 @@ 0 && (module.exports = {

dedupeArray,
findIndexById,
findItemById,
formatTime,

@@ -91,0 +108,0 @@ info,

@@ -19,3 +19,9 @@ declare function info<T>(data: T): T;

declare function trimString(str: string, maxLength: number): string;
declare function findIndexById<T extends {
id: string;
}>(array: T[], id: string): number;
declare function findItemById<T extends {
id: string;
}>(array: T[], id: string): T | undefined;
export { arrayRefEquals, callArrayProp, dedupeArray, formatTime, info, log, mutateFilter, mutateRemove, pushToArrayProp, trimString, warn };
export { arrayRefEquals, callArrayProp, dedupeArray, findIndexById, findItemById, formatTime, info, log, mutateFilter, mutateRemove, pushToArrayProp, trimString, warn };

@@ -5,2 +5,4 @@ import {

dedupeArray,
findIndexById,
findItemById,
formatTime,

@@ -14,3 +16,3 @@ info,

warn
} from "./chunk-QTPCQOAB.js";
} from "./chunk-HUGDDQ47.js";
export {

@@ -20,2 +22,4 @@ arrayRefEquals,

dedupeArray,
findIndexById,
findItemById,
formatTime,

@@ -22,0 +26,0 @@ info,

{
"name": "@solid-devtools/shared",
"version": "0.7.4",
"version": "0.8.0",
"license": "MIT",

@@ -86,7 +86,7 @@ "author": "Damian Tarnawski <gthetarnav@gmail.com>",

"@testing-library/jest-dom": "^5.16.5",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"solid-js": "^1.5.4",
"tsup": "^6.2.3",
"typescript": "^4.8.2"
"typescript": "^4.8.3"
},

@@ -93,0 +93,0 @@ "peerDependencies": {

import { getOwner as _getOwner } from "solid-js"
import { Many } from "@solid-primitives/utils"
import { INTERNAL, NOTFOUND } from "./variables"
import { INTERNAL } from "./variables"
import { EncodedValue } from "./serialize"

@@ -36,3 +36,2 @@

sdtType?: NodeType
ownedRoots?: Set<Solid.Root>
}

@@ -42,3 +41,2 @@ interface Computation<Init, Next> {

sdtType?: NodeType
ownedRoots?: Set<Solid.Root>
onValueUpdate?: Record<symbol, ValueUpdateListener>

@@ -69,5 +67,5 @@ onComputationUpdate?: VoidFunction

sourceMap?: Record<string, Signal>
// Used by the debugger
isDisposed?: boolean
// Used by the debugger
sdtAttached?: true
sdtAttachedTo?: Owner | null
sdtContext?: DebuggerContext

@@ -123,3 +121,3 @@ // Computation compatibility

removed: NodeID[]
updated: Mapped.SRoot[]
updated: Record<NodeID, Mapped.Root>
}

@@ -142,14 +140,7 @@

id: NodeID
// sub-roots will have an owner
attachedTo?: NodeID
tree: Owner
// components is an array instead of an object to preserve the order (nesting) of the components,
// this helps the locator find the most nested component first
components: Component[]
}
/** serialised (without components) */
export interface SRoot {
id: NodeID
tree: Owner
}
export interface Owner {

@@ -160,3 +151,2 @@ id: NodeID

children: Owner[]
sources: number
}

@@ -201,48 +191,1 @@

}
//
// "Graph___" — owner/signals/etc. objects handled by the devtools frontend (extension/overlay/ui packages)
// They are meant to be "reactive" — wrapped with a store
//
export namespace Graph {
export interface Root {
readonly id: NodeID
readonly tree: Owner
}
export interface Owner {
readonly id: NodeID
readonly name: string
readonly type: NodeType
readonly sources: number
readonly children: Owner[]
}
export type Signal = {
readonly type: NodeType.Signal | NodeType.Memo
readonly name: string
readonly id: NodeID
readonly observers: NodeID[]
readonly value: EncodedValue<boolean>
readonly selected: boolean
}
export type Path = (Owner | typeof NOTFOUND)[]
export type Props = {
proxy: boolean
record: Record<string, { selected: boolean; value: EncodedValue<boolean> }>
}
export interface OwnerDetails {
readonly id: NodeID
readonly name: string
readonly type: NodeType
readonly path: Path
readonly rawPath: NodeID[]
readonly signals: Record<NodeID, Signal>
readonly props?: Props
// TODO: more to come
}
}

@@ -1,11 +0,3 @@

import type { EqualityCheckerFunction, MemoOptions } from "solid-js/types/reactive/signal"
import {
Accessor,
createMemo,
createSignal,
getOwner,
onCleanup,
createSelector,
untrack,
} from "solid-js"
import type { MemoOptions } from "solid-js/types/reactive/signal"
import { Accessor, createMemo, createSignal, getOwner, onCleanup, untrack } from "solid-js"
import { remove } from "@solid-primitives/immutable"

@@ -68,9 +60,1 @@ import { AnyFunction, onRootCleanup } from "@solid-primitives/utils"

}
export function createBoundSelector<T, U>(
source: Accessor<T>,
fn?: EqualityCheckerFunction<T, U>,
): [useSelector: (item: U) => Accessor<boolean>, selector: (item: U) => boolean] {
const selector = createSelector(source, fn)
return [item => selector.bind(void 0, item), selector]
}

@@ -80,1 +80,13 @@ const getLogLabel = () => [

}
export function findIndexById<T extends { id: string }>(array: T[], id: string): number {
for (let i = 0; i < array.length; i++) if (array[i].id === id) return i
return -1
}
export function findItemById<T extends { id: string }>(array: T[], id: string): T | undefined {
for (let i = 0; i < array.length; i++) {
const item = array[i]
if (item.id === id) return item
}
}
// src/utils.ts
var getLogLabel = () => [
`%csolid-devtools`,
"color: #fff; background: #2c4f7c; padding: 1px 4px;"
];
function info(data) {
console.info(...getLogLabel(), data);
return data;
}
function log(...args) {
console.log(...getLogLabel(), ...args);
}
function warn(...args) {
console.warn(...getLogLabel(), ...args);
}
function formatTime(d = new Date()) {
return ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2) + ":" + ("0" + d.getSeconds()).slice(-2);
}
function callArrayProp(object, key, ...args) {
const arr = object[key];
if (arr)
for (const cb of arr)
cb(...args);
}
function pushToArrayProp(object, key, value) {
let arr = object[key];
if (arr)
arr.push(value);
else
arr = object[key] = [value];
return arr;
}
function mutateFilter(array, predicate) {
const temp = array.filter(predicate);
array.length = 0;
array.push.apply(array, temp);
}
function mutateRemove(array, item) {
array.splice(array.indexOf(item), 1);
}
var dedupeArray = (array) => Array.from(new Set(array));
var arrayRefEquals = (a, b) => a === b || a.length === b.length && a.every((e) => b.includes(e));
function trimString(str, maxLength) {
if (str.length <= maxLength)
return str;
return str.slice(0, maxLength) + "\u2026";
}
export {
info,
log,
warn,
formatTime,
callArrayProp,
pushToArrayProp,
mutateFilter,
mutateRemove,
dedupeArray,
arrayRefEquals,
trimString
};