Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@maverick-js/signals

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maverick-js/signals - npm Package Compare versions

Comparing version 5.10.3 to 5.10.4

dist/dev/core.js

4

dist/dev/index.js

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

export { SCOPE, computed, createComputation, createScope, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-RDXOW6QS.js';
export { createComputation, createScope, getContext, getScope, isFunction, isNotEqual, onDispose, onError, peek, root, scoped, setContext, tick, untrack } from './core.js';
export { computed, effect, isReadSignal, isWriteSignal, readonly, signal } from './signals.js';
export { SCOPE } from './symbols.js';

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

import { effect, write, onDispose, read, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-RDXOW6QS.js';
import { write, onDispose, read, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './core.js';
import { effect } from './signals.js';
import './symbols.js';
// src/selector.ts
function selector(source) {

@@ -30,3 +31,3 @@ let currentKey, nodes = /* @__PURE__ */ new Map();

}
var SelectorProto = Selector.prototype;
const SelectorProto = Selector.prototype;
SelectorProto._changed = isNotEqual;

@@ -41,3 +42,2 @@ SelectorProto.call = function() {

// src/map.ts
function computedMap(list, map, options) {

@@ -44,0 +44,0 @@ return read.bind(

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

export { SCOPE, computed, createComputation, createScope, effect, getContext, getScope, isFunction, isNotEqual, isReadSignal, isWriteSignal, onDispose, onError, peek, readonly, root, scoped, setContext, signal, tick, untrack } from './chunks/chunk-H5MBZ4KB.js';
export { createComputation, createScope, getContext, getScope, isFunction, isNotEqual, onDispose, onError, peek, root, scoped, setContext, tick, untrack } from './core.js';
export { computed, effect, isReadSignal, isWriteSignal, readonly, signal } from './signals.js';
export { SCOPE } from './symbols.js';

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

import { effect, write, onDispose, read, isNotEqual, createComputation, createScope, scoped, dispose, compute } from './chunks/chunk-H5MBZ4KB.js';
import { onDispose, read, isNotEqual, write, createComputation, createScope, scoped, dispose, compute } from './core.js';
import { effect } from './signals.js';
import './symbols.js';
// src/selector.ts
function selector(source) {

@@ -16,3 +17,3 @@ let currentKey, nodes = /* @__PURE__ */ new Map();

nodes.set(key, node = new Selector(key, key === currentKey, nodes));
node.s += 1;
node.a += 1;
onDispose(node);

@@ -23,21 +24,20 @@ return read.bind(node);

function Selector(key, initialValue, nodes) {
this.e = /** CLEAN */
this.d = /** CLEAN */
0;
this.v = key;
this.l = initialValue;
this.s = 0;
this.c = nodes;
this.d = null;
this.c = key;
this.e = initialValue;
this.a = 0;
this.b = nodes;
this.f = null;
}
var SelectorProto = Selector.prototype;
SelectorProto.r = isNotEqual;
const SelectorProto = Selector.prototype;
SelectorProto.g = isNotEqual;
SelectorProto.call = function() {
this.s -= 1;
if (!this.s) {
this.c.delete(this.v);
this.c = null;
this.a -= 1;
if (!this.a) {
this.b.delete(this.c);
this.b = null;
}
};
// src/map.ts
function computedMap(list, map, options) {

@@ -48,9 +48,9 @@ return read.bind(

updateMap.bind({
o: createScope(),
h: 0,
t: list,
g: [],
p: map,
f: [],
c: []
e: createScope(),
d: 0,
g: list,
c: [],
f: map,
a: [],
b: []
}),

@@ -62,11 +62,11 @@ options

function updateMap() {
let i = 0, newItems = this.t() || [], mapper = () => this.p(read.bind(this.c[i]), i);
let i = 0, newItems = this.g() || [], mapper = () => this.f(read.bind(this.b[i]), i);
scoped(() => {
if (newItems.length === 0) {
if (this.h !== 0) {
dispose.call(this.o, false);
this.g = [];
this.f = [];
this.h = 0;
if (this.d !== 0) {
dispose.call(this.e, false);
this.c = [];
this.a = [];
this.d = 0;
this.b = [];
}

@@ -76,7 +76,7 @@ return;

for (i = 0; i < newItems.length; i++) {
if (i < this.g.length && this.g[i] !== newItems[i]) {
write.call(this.c[i], newItems[i]);
} else if (i >= this.g.length) {
this.f[i] = compute(
this.c[i] = createComputation(newItems[i], null),
if (i < this.c.length && this.c[i] !== newItems[i]) {
write.call(this.b[i], newItems[i]);
} else if (i >= this.c.length) {
this.a[i] = compute(
this.b[i] = createComputation(newItems[i], null),
mapper,

@@ -87,9 +87,9 @@ null

}
for (; i < this.g.length; i++)
dispose.call(this.c[i]);
this.h = this.c.length = newItems.length;
this.g = newItems.slice(0);
this.f = this.f.slice(0, this.h);
}, this.o);
return this.f;
for (; i < this.c.length; i++)
dispose.call(this.b[i]);
this.d = this.b.length = newItems.length;
this.c = newItems.slice(0);
this.a = this.a.slice(0, this.d);
}, this.e);
return this.a;
}

@@ -101,9 +101,9 @@ function computedKeyedMap(list, map, options) {

updateKeyedMap.bind({
o: createScope(),
h: 0,
t: list,
g: [],
p: map,
f: [],
c: []
e: createScope(),
d: 0,
g: list,
c: [],
f: map,
a: [],
b: []
}),

@@ -115,19 +115,19 @@ options

function updateKeyedMap() {
const newItems = this.t() || [], indexed = this.p.length > 1;
const newItems = this.g() || [], indexed = this.f.length > 1;
scoped(() => {
let newLen = newItems.length, i, j, mapper = indexed ? () => this.p(newItems[j], read.bind(this.c[j])) : () => this.p(newItems[j]);
let newLen = newItems.length, i, j, mapper = indexed ? () => this.f(newItems[j], read.bind(this.b[j])) : () => this.f(newItems[j]);
if (newLen === 0) {
if (this.h !== 0) {
dispose.call(this.o, false);
if (this.d !== 0) {
dispose.call(this.e, false);
this.b = [];
this.c = [];
this.g = [];
this.f = [];
this.h = 0;
this.a = [];
this.d = 0;
}
} else if (this.h === 0) {
this.f = new Array(newLen);
} else if (this.d === 0) {
this.a = new Array(newLen);
for (j = 0; j < newLen; j++) {
this.g[j] = newItems[j];
this.f[j] = compute(
this.c[j] = createComputation(j, null),
this.c[j] = newItems[j];
this.a[j] = compute(
this.b[j] = createComputation(j, null),
mapper,

@@ -137,10 +137,10 @@ null

}
this.h = newLen;
this.d = newLen;
} else {
let start, end, newEnd, item, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen);
for (start = 0, end = Math.min(this.h, newLen); start < end && this.g[start] === newItems[start]; start++)
for (start = 0, end = Math.min(this.d, newLen); start < end && this.c[start] === newItems[start]; start++)
;
for (end = this.h - 1, newEnd = newLen - 1; end >= start && newEnd >= start && this.g[end] === newItems[newEnd]; end--, newEnd--) {
temp[newEnd] = this.f[end];
tempNodes[newEnd] = this.c[end];
for (end = this.d - 1, newEnd = newLen - 1; end >= start && newEnd >= start && this.c[end] === newItems[newEnd]; end--, newEnd--) {
temp[newEnd] = this.a[end];
tempNodes[newEnd] = this.b[end];
}

@@ -156,20 +156,20 @@ newIndices = /* @__PURE__ */ new Map();

for (i = start; i <= end; i++) {
item = this.g[i];
item = this.c[i];
j = newIndices.get(item);
if (j !== void 0 && j !== -1) {
temp[j] = this.f[i];
tempNodes[j] = this.c[i];
temp[j] = this.a[i];
tempNodes[j] = this.b[i];
j = newIndicesNext[j];
newIndices.set(item, j);
} else
dispose.call(this.c[i]);
dispose.call(this.b[i]);
}
for (j = start; j < newLen; j++) {
if (j in temp) {
this.f[j] = temp[j];
this.c[j] = tempNodes[j];
write.call(this.c[j], j);
this.a[j] = temp[j];
this.b[j] = tempNodes[j];
write.call(this.b[j], j);
} else {
this.f[j] = compute(
this.c[j] = createComputation(j, null),
this.a[j] = compute(
this.b[j] = createComputation(j, null),
mapper,

@@ -180,9 +180,9 @@ null

}
this.f = this.f.slice(0, this.h = newLen);
this.g = newItems.slice(0);
this.a = this.a.slice(0, this.d = newLen);
this.c = newItems.slice(0);
}
}, this.o);
return this.f;
}, this.e);
return this.a;
}
export { computedKeyedMap, computedMap, selector };

@@ -5,6 +5,5 @@ {

"license": "MIT",
"version": "5.10.3",
"version": "5.10.4",
"type": "module",
"types": "dist/types/index.d.ts",
"main": "dist/server/index.cjs",
"module": "dist/prod/index.js",

@@ -14,7 +13,6 @@ "sideEffects": false,

"dist/",
"index.d.ts",
"map.d.ts"
"*.d.ts"
],
"scripts": {
"build": "rimraf dist && tsup",
"build": "rimraf dist && rollup -c && pnpm types",
"types": "tsc -p tsconfig.build.json",

@@ -27,3 +25,3 @@ "format": "prettier src --write --loglevel warn",

"bench:layers": "pnpm build && node bench/layers.js",
"validate": "pnpm test && pnpm test:gc && pnpm build && pnpm types",
"validate": "pnpm test && pnpm test:gc && pnpm build",
"release": "pnpm validate && standard-version && git push --follow-tags origin main && npm publish"

@@ -47,9 +45,11 @@ },

"cli-table": "^0.3.11",
"esbuild": "^0.18.1",
"kleur": "^4.1.5",
"prettier": "^2.8.0",
"rimraf": "^3.0.2",
"rollup": "^3.25.1",
"rollup-plugin-esbuild": "^5.0.0",
"s-js": "^0.4.9",
"solid-js": "^1.7.0",
"standard-version": "^9.5.0",
"tsup": "^6.7.0",
"typescript": "^5.0.0",

@@ -64,22 +64,12 @@ "vite": "^4.0.0",

".": {
"import": {
"test": "./dist/dev/index.js",
"node": "./dist/server/index.js",
"deno": "./dist/server/index.js",
"bun": "./dist/server/index.js",
"development": "./dist/dev/index.js",
"default": "./dist/prod/index.js"
},
"require": "./dist/server/index.cjs"
"types": "./dist/types/index.d.ts",
"test": "./dist/dev/index.js",
"development": "./dist/dev/index.js",
"default": "./dist/prod/index.js"
},
"./map": {
"import": {
"test": "./dist/dev/map.js",
"node": "./dist/server/map.js",
"deno": "./dist/server/map.js",
"bun": "./dist/server/index.js",
"development": "./dist/dev/map.js",
"default": "./dist/prod/map.js"
},
"require": "./dist/server/map.cjs"
"types": "./dist/types/map.d.ts",
"test": "./dist/dev/map.js",
"development": "./dist/dev/map.js",
"default": "./dist/prod/map.js"
},

@@ -86,0 +76,0 @@ "./package.json": "./package.json"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc