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

@preact-signals/unified-signals

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@preact-signals/unified-signals - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

CHANGELOG.md

6

dist/cjs/index.d.ts

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

import * as signals from "@preact/signals-react";
declare const Signal: typeof signals.Signal, batch: typeof signals.batch, computed: typeof signals.computed, effect: typeof signals.effect, signal: typeof signals.signal, useComputed: typeof signals.useComputed, useSignal: typeof signals.useSignal, useSignalEffect: typeof signals.useSignalEffect;
export { Signal, batch, computed, effect, signal, useComputed, useSignal, useSignalEffect, };
export * from "./reexports";
export type { Untracked } from "./type";
export { untrackedPolyfill as untracked } from "./untrackedPolyfill";

@@ -13,33 +13,10 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useSignalEffect = exports.useSignal = exports.useComputed = exports.signal = exports.effect = exports.computed = exports.batch = exports.Signal = void 0;
const signals = __importStar(require("@preact/signals-react"));
const throwNotSupportedByPreactSignalsRuntime = () => {
// @ts-expect-error i am too lazy to write types for this
if (process.env.NODE_ENV === "development") {
console.error("preact signals runtime not implemented hooks, please use `@preact/signals-react` or `@preact/signals`");
}
throw new Error("preact signals runtime not implemented hooks");
};
const { Signal, batch, computed, effect, signal, useComputed = throwNotSupportedByPreactSignalsRuntime, useSignal = throwNotSupportedByPreactSignalsRuntime, useSignalEffect = throwNotSupportedByPreactSignalsRuntime, } = signals;
exports.Signal = Signal;
exports.batch = batch;
exports.computed = computed;
exports.effect = effect;
exports.signal = signal;
exports.useComputed = useComputed;
exports.useSignal = useSignal;
exports.useSignalEffect = useSignalEffect;
exports.untracked = void 0;
__exportStar(require("./reexports"), exports);
var untrackedPolyfill_1 = require("./untrackedPolyfill");
Object.defineProperty(exports, "untracked", { enumerable: true, get: function () { return untrackedPolyfill_1.untrackedPolyfill; } });
//# sourceMappingURL=index.js.map

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

import * as signals from "@preact/signals-react";
declare const Signal: typeof signals.Signal, batch: typeof signals.batch, computed: typeof signals.computed, effect: typeof signals.effect, signal: typeof signals.signal, useComputed: typeof signals.useComputed, useSignal: typeof signals.useSignal, useSignalEffect: typeof signals.useSignalEffect;
export { Signal, batch, computed, effect, signal, useComputed, useSignal, useSignalEffect, };
export * from "./reexports";
export type { Untracked } from "./type";
export { untrackedPolyfill as untracked } from "./untrackedPolyfill";

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

import * as signals from "@preact/signals-react";
const throwNotSupportedByPreactSignalsRuntime = () => {
// @ts-expect-error i am too lazy to write types for this
if (process.env.NODE_ENV === "development") {
console.error("preact signals runtime not implemented hooks, please use `@preact/signals-react` or `@preact/signals`");
}
throw new Error("preact signals runtime not implemented hooks");
};
const { Signal, batch, computed, effect, signal, useComputed = throwNotSupportedByPreactSignalsRuntime, useSignal = throwNotSupportedByPreactSignalsRuntime, useSignalEffect = throwNotSupportedByPreactSignalsRuntime, } = signals;
export { Signal, batch, computed, effect, signal, useComputed, useSignal, useSignalEffect, };
export * from "./reexports";
export { untrackedPolyfill as untracked } from "./untrackedPolyfill";
//# sourceMappingURL=index.js.map
{
"name": "@preact-signals/unified-signals",
"version": "0.1.0",
"version": "0.2.0",
"private": false,

@@ -11,3 +11,4 @@ "publishConfig": {

"repository": {
"url": "https://github.com/XantreGodlike/preact-signals-utils",
"directory": "packages/unified-signals",
"url": "https://github.com/XantreGodlike/preact-signals",
"type": "git"

@@ -14,0 +15,0 @@ },

# `@preact-signals/unified-signals`
`@preact-signals/unified-signals` is runtime agnostic `@preact/signals` reexport which imports should be remaped depending on the runtime.
`@preact-signals/unified-signals` is runtime agnostic `@preact/signals` reexport. That can be used for library developers that want to rely on user preact signals runtime. If you want to write library that uses preact signals you can take benefit from `@preact-signals/unified-signals`. It uses shims instead of hooks if runtime is not providing it, also we polyfilling `untracked` API.

@@ -20,6 +20,20 @@ ## Installation

Same api that `@preact/signals` provides.
Basic `@preact/signals` API and untracked
### `untracked`
```ts
const a = signal(1);
const b = signal(2);
const c = computed(() => a.value + untracked(() => b.value));
console.log(c.value); // 3
a.value = 2;
console.log(c.value); // 4
b.value = 3;
console.log(c.value); // 4
```
## License
`@preact-signals/unified-signals` is licensed under the [MIT License](./LICENSE).
export * from "@preact/signals-react";
export const untracked: <T>(untrackedExecutor: () => T) => T;

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

import * as signals from "@preact/signals-react";
export * from "./reexports";
export type { Untracked } from "./type";
export { untrackedPolyfill as untracked } from "./untrackedPolyfill";
const throwNotSupportedByPreactSignalsRuntime = (): never => {
// @ts-expect-error i am too lazy to write types for this
if (process.env.NODE_ENV === "development") {
console.error(
"preact signals runtime not implemented hooks, please use `@preact/signals-react` or `@preact/signals`"
);
}
throw new Error("preact signals runtime not implemented hooks");
};
const {
Signal,
batch,
computed,
effect,
signal,
useComputed = throwNotSupportedByPreactSignalsRuntime,
useSignal = throwNotSupportedByPreactSignalsRuntime,
useSignalEffect = throwNotSupportedByPreactSignalsRuntime,
} = signals;
export {
Signal,
batch,
computed,
effect,
signal,
useComputed,
useSignal,
useSignalEffect,
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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