New:Socket for Asana Is Now Available.Learn more
Get Started

solid-js

Package Overview
Dependencies
Maintainers
1
Versions
532
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-js - npm Package Compare versions

Comparing version
2.0.0-beta.19
to
2.0.0-beta.20
+40
dist/refresh.cjs
'use strict';
require('solid-js');
function $$registry() {
return {
components: new Map()
};
}
function $$component(registry, id, component, options = {}) {
return component;
}
const refreshConfig = {};
function configureRefresh(config) {
Object.assign(refreshConfig, config);
}
function $$decline(...[type, hot, inline]) {
{
warnProductionUse();
return;
}
}
let warnedProduction = false;
function warnProductionUse() {
if (warnedProduction) return;
console.warn("[solid-js/refresh] This module is development-only. Compiled HMR wrappers " + "should not be part of a production build; the refresh runtime is inert here.");
warnedProduction = true;
}
function $$refresh(...[type, hot, registry]) {
{
warnProductionUse();
return;
}
}
exports.$$component = $$component;
exports.$$decline = $$decline;
exports.$$refresh = $$refresh;
exports.$$registry = $$registry;
exports.configureRefresh = configureRefresh;
'use strict';
var solidJs = require('solid-js');
function setComponentProperty(component, key, value) {
const descriptor = Object.getOwnPropertyDescriptor(component, key);
if (descriptor) {
Object.defineProperty(component, key, {
...descriptor,
value
});
} else {
Object.defineProperty(component, key, {
value,
writable: false,
enumerable: false,
configurable: true
});
}
}
function createProxy(source, name, instances, location) {
const refreshName = `[solid-refresh]${name}`;
function HMRComp(props) {
if (solidJs.getOwner()) {
instances.count++;
solidJs.onCleanup(() => {
instances.count--;
});
}
const s = solidJs.untrack(source);
if (!s || solidJs.$DEVCOMP in s) {
return solidJs.createMemo(() => {
const c = source();
if (c) {
return solidJs.untrack(() => c(props), c[solidJs.$DEVCOMP] && `<${name}>`);
}
return undefined;
}, {
name: refreshName,
transparent: true
});
}
return s(props);
}
setComponentProperty(HMRComp, "name", refreshName);
if (location) {
setComponentProperty(HMRComp, "location", location);
}
return new Proxy(HMRComp, {
get(_, property) {
if (property === "location" || property === "name") {
return HMRComp[property];
}
return solidJs.untrack(source)[property];
},
set(_, property, value) {
solidJs.untrack(source)[property] = value;
return true;
}
});
}
function isListUpdatedInternal(a, b) {
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
if (aKeys.length !== bKeys.length) {
return true;
}
const keys = new Set([...aKeys, ...bKeys]);
if (keys.size !== aKeys.length) {
return true;
}
for (const key of keys) {
if (a[key] !== b[key] || a[key] !== a[key] && b[key] !== b[key]) {
return true;
}
}
return false;
}
function isListUpdated(a, b) {
if (a && b) {
return isListUpdatedInternal(a, b);
}
return a == null !== (b == null);
}
function $$registry() {
return {
components: new Map()
};
}
function $$component(registry, id, component, options = {}) {
let current = component;
const [comp, setComp] = solidJs.createSignal(() => current);
const update = action => {
current = action();
setComp(() => current);
};
const instances = {
count: 0
};
const proxy = createProxy(comp, id, instances, options.location);
registry.components.set(id, {
id,
component,
proxy,
update,
instances,
...options
});
return proxy;
}
function patchComponent(oldData, newData) {
if (oldData.instances.count === 0) {
oldData.dependencies = newData.dependencies;
oldData.signature = newData.signature;
oldData.update(() => newData.component);
} else {
const oldComp = oldData.component;
const newComp = newData.component;
if (oldComp.id != null && typeof oldComp.id === "symbol") {
newComp.id = oldComp.id;
}
if (newData.signature) {
const oldDeps = oldData.dependencies?.call(oldData);
const newDeps = newData.dependencies?.call(newData);
if (newData.signature !== oldData.signature || isListUpdated(newDeps, oldDeps)) {
oldData.dependencies = newDeps ? () => newDeps : undefined;
oldData.signature = newData.signature;
oldData.update(() => newData.component);
}
} else {
oldData.update(() => newData.component);
}
}
newData.update(() => oldData.proxy);
}
function patchComponents(oldData, newData) {
const components = new Set([...oldData.components.keys(), ...newData.components.keys()]);
for (const key of components) {
const oldComponent = oldData.components.get(key);
const newComponent = newData.components.get(key);
if (oldComponent) {
if (newComponent) {
patchComponent(oldComponent, newComponent);
} else {
return true;
}
} else if (newComponent) {
oldData.components.set(key, newComponent);
}
}
return false;
}
function patchRegistry(oldRegistry, newRegistry) {
return patchComponents(oldRegistry, newRegistry);
}
const SOLID_REFRESH = "solid-refresh";
const SOLID_REFRESH_PREV = "solid-refresh-prev";
const refreshConfig = {};
function configureRefresh(config) {
Object.assign(refreshConfig, config);
}
let warnedNoInvalidate = false;
function bailInvalidate(hot) {
if (refreshConfig.invalidate) {
refreshConfig.invalidate(hot);
return;
}
if (hot && typeof hot.invalidate === "function") {
hot.invalidate();
return;
}
if (typeof window !== "undefined" && typeof window.location?.reload === "function") {
window.location.reload();
return;
}
if (!warnedNoInvalidate) {
console.warn("[solid-js/refresh] A module needs to be invalidated, but no hot invalidation " + "mechanism is available in this environment. Configure one via " + "configureRefresh({ invalidate }) or reload manually to see the latest code.");
warnedNoInvalidate = true;
}
}
function $$decline(...[type, hot, inline]) {
switch (type) {
case "esm":
{
if (inline) {
hot.invalidate();
} else {
hot.decline();
}
break;
}
case "vite":
{
if (inline) {
hot.invalidate();
} else {
hot.accept(() => {
hot.invalidate();
});
}
break;
}
case "rspack-esm":
case "webpack5":
{
if (inline) {
hot.invalidate();
} else {
hot.decline();
}
break;
}
case "standard":
{
if (inline) {
bailInvalidate(hot);
} else if (hot.decline) {
hot.decline();
} else {
hot.accept(() => {
bailInvalidate(hot);
});
}
break;
}
}
}
let warnedNoDev = false;
function shouldWarnAndDecline() {
if (solidJs.DEV) {
return false;
}
if (!warnedNoDev) {
console.warn("[solid-js/refresh] The production build of solid-js was loaded alongside the " + "development refresh runtime. Make sure your build system enables the " + "'development' export condition consistently.");
warnedNoDev = true;
}
return true;
}
function $$refreshESM(type, hot, registry) {
if (shouldWarnAndDecline()) {
$$decline(type, hot);
} else if (hot.data) {
hot.data[SOLID_REFRESH] = hot.data[SOLID_REFRESH] || registry;
hot.data[SOLID_REFRESH_PREV] = registry;
hot.accept(mod => {
if (mod == null || patchRegistry(hot.data[SOLID_REFRESH], hot.data[SOLID_REFRESH_PREV])) {
hot.invalidate();
}
});
} else {
$$decline(type, hot);
}
}
function $$refreshStandard(type, hot, registry) {
if (shouldWarnAndDecline()) {
$$decline(type, hot);
} else {
const current = hot.data;
if (current && current[SOLID_REFRESH]) {
if (patchRegistry(current[SOLID_REFRESH], registry)) {
$$decline(type, hot, true);
}
}
hot.dispose(data => {
data[SOLID_REFRESH] = current ? current[SOLID_REFRESH] : registry;
});
hot.accept();
}
}
function $$refresh(...[type, hot, registry]) {
switch (type) {
case "esm":
case "vite":
{
$$refreshESM(type, hot, registry);
break;
}
case "standard":
case "webpack5":
case "rspack-esm":
{
$$refreshStandard(type, hot, registry);
break;
}
}
}
exports.$$component = $$component;
exports.$$decline = $$decline;
exports.$$refresh = $$refresh;
exports.$$registry = $$registry;
exports.configureRefresh = configureRefresh;
import { createSignal, untrack, getOwner, onCleanup, $DEVCOMP, createMemo, DEV } from 'solid-js';
function setComponentProperty(component, key, value) {
const descriptor = Object.getOwnPropertyDescriptor(component, key);
if (descriptor) {
Object.defineProperty(component, key, {
...descriptor,
value
});
} else {
Object.defineProperty(component, key, {
value,
writable: false,
enumerable: false,
configurable: true
});
}
}
function createProxy(source, name, instances, location) {
const refreshName = `[solid-refresh]${name}`;
function HMRComp(props) {
if (getOwner()) {
instances.count++;
onCleanup(() => {
instances.count--;
});
}
const s = untrack(source);
if (!s || $DEVCOMP in s) {
return createMemo(() => {
const c = source();
if (c) {
return untrack(() => c(props), c[$DEVCOMP] && `<${name}>`);
}
return undefined;
}, {
name: refreshName,
transparent: true
});
}
return s(props);
}
setComponentProperty(HMRComp, "name", refreshName);
if (location) {
setComponentProperty(HMRComp, "location", location);
}
return new Proxy(HMRComp, {
get(_, property) {
if (property === "location" || property === "name") {
return HMRComp[property];
}
return untrack(source)[property];
},
set(_, property, value) {
untrack(source)[property] = value;
return true;
}
});
}
function isListUpdatedInternal(a, b) {
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
if (aKeys.length !== bKeys.length) {
return true;
}
const keys = new Set([...aKeys, ...bKeys]);
if (keys.size !== aKeys.length) {
return true;
}
for (const key of keys) {
if (a[key] !== b[key] || a[key] !== a[key] && b[key] !== b[key]) {
return true;
}
}
return false;
}
function isListUpdated(a, b) {
if (a && b) {
return isListUpdatedInternal(a, b);
}
return a == null !== (b == null);
}
function $$registry() {
return {
components: new Map()
};
}
function $$component(registry, id, component, options = {}) {
let current = component;
const [comp, setComp] = createSignal(() => current);
const update = action => {
current = action();
setComp(() => current);
};
const instances = {
count: 0
};
const proxy = createProxy(comp, id, instances, options.location);
registry.components.set(id, {
id,
component,
proxy,
update,
instances,
...options
});
return proxy;
}
function patchComponent(oldData, newData) {
if (oldData.instances.count === 0) {
oldData.dependencies = newData.dependencies;
oldData.signature = newData.signature;
oldData.update(() => newData.component);
} else {
const oldComp = oldData.component;
const newComp = newData.component;
if (oldComp.id != null && typeof oldComp.id === "symbol") {
newComp.id = oldComp.id;
}
if (newData.signature) {
const oldDeps = oldData.dependencies?.call(oldData);
const newDeps = newData.dependencies?.call(newData);
if (newData.signature !== oldData.signature || isListUpdated(newDeps, oldDeps)) {
oldData.dependencies = newDeps ? () => newDeps : undefined;
oldData.signature = newData.signature;
oldData.update(() => newData.component);
}
} else {
oldData.update(() => newData.component);
}
}
newData.update(() => oldData.proxy);
}
function patchComponents(oldData, newData) {
const components = new Set([...oldData.components.keys(), ...newData.components.keys()]);
for (const key of components) {
const oldComponent = oldData.components.get(key);
const newComponent = newData.components.get(key);
if (oldComponent) {
if (newComponent) {
patchComponent(oldComponent, newComponent);
} else {
return true;
}
} else if (newComponent) {
oldData.components.set(key, newComponent);
}
}
return false;
}
function patchRegistry(oldRegistry, newRegistry) {
return patchComponents(oldRegistry, newRegistry);
}
const SOLID_REFRESH = "solid-refresh";
const SOLID_REFRESH_PREV = "solid-refresh-prev";
const refreshConfig = {};
function configureRefresh(config) {
Object.assign(refreshConfig, config);
}
let warnedNoInvalidate = false;
function bailInvalidate(hot) {
if (refreshConfig.invalidate) {
refreshConfig.invalidate(hot);
return;
}
if (hot && typeof hot.invalidate === "function") {
hot.invalidate();
return;
}
if (typeof window !== "undefined" && typeof window.location?.reload === "function") {
window.location.reload();
return;
}
if (!warnedNoInvalidate) {
console.warn("[solid-js/refresh] A module needs to be invalidated, but no hot invalidation " + "mechanism is available in this environment. Configure one via " + "configureRefresh({ invalidate }) or reload manually to see the latest code.");
warnedNoInvalidate = true;
}
}
function $$decline(...[type, hot, inline]) {
switch (type) {
case "esm":
{
if (inline) {
hot.invalidate();
} else {
hot.decline();
}
break;
}
case "vite":
{
if (inline) {
hot.invalidate();
} else {
hot.accept(() => {
hot.invalidate();
});
}
break;
}
case "rspack-esm":
case "webpack5":
{
if (inline) {
hot.invalidate();
} else {
hot.decline();
}
break;
}
case "standard":
{
if (inline) {
bailInvalidate(hot);
} else if (hot.decline) {
hot.decline();
} else {
hot.accept(() => {
bailInvalidate(hot);
});
}
break;
}
}
}
let warnedNoDev = false;
function shouldWarnAndDecline() {
if (DEV) {
return false;
}
if (!warnedNoDev) {
console.warn("[solid-js/refresh] The production build of solid-js was loaded alongside the " + "development refresh runtime. Make sure your build system enables the " + "'development' export condition consistently.");
warnedNoDev = true;
}
return true;
}
function $$refreshESM(type, hot, registry) {
if (shouldWarnAndDecline()) {
$$decline(type, hot);
} else if (hot.data) {
hot.data[SOLID_REFRESH] = hot.data[SOLID_REFRESH] || registry;
hot.data[SOLID_REFRESH_PREV] = registry;
hot.accept(mod => {
if (mod == null || patchRegistry(hot.data[SOLID_REFRESH], hot.data[SOLID_REFRESH_PREV])) {
hot.invalidate();
}
});
} else {
$$decline(type, hot);
}
}
function $$refreshStandard(type, hot, registry) {
if (shouldWarnAndDecline()) {
$$decline(type, hot);
} else {
const current = hot.data;
if (current && current[SOLID_REFRESH]) {
if (patchRegistry(current[SOLID_REFRESH], registry)) {
$$decline(type, hot, true);
}
}
hot.dispose(data => {
data[SOLID_REFRESH] = current ? current[SOLID_REFRESH] : registry;
});
hot.accept();
}
}
function $$refresh(...[type, hot, registry]) {
switch (type) {
case "esm":
case "vite":
{
$$refreshESM(type, hot, registry);
break;
}
case "standard":
case "webpack5":
case "rspack-esm":
{
$$refreshStandard(type, hot, registry);
break;
}
}
}
export { $$component, $$decline, $$refresh, $$registry, configureRefresh };
import 'solid-js';
function $$registry() {
return {
components: new Map()
};
}
function $$component(registry, id, component, options = {}) {
return component;
}
const refreshConfig = {};
function configureRefresh(config) {
Object.assign(refreshConfig, config);
}
function $$decline(...[type, hot, inline]) {
{
warnProductionUse();
return;
}
}
let warnedProduction = false;
function warnProductionUse() {
if (warnedProduction) return;
console.warn("[solid-js/refresh] This module is development-only. Compiled HMR wrappers " + "should not be part of a production build; the refresh runtime is inert here.");
warnedProduction = true;
}
function $$refresh(...[type, hot, registry]) {
{
warnProductionUse();
return;
}
}
export { $$component, $$decline, $$refresh, $$registry, configureRefresh };
import type { Element as SolidElement } from "../types.cjs";
export interface BaseComponent<P> {
(props: P): SolidElement;
}
/** Mutable live-mount counter shared between a proxy and its registration. */
interface LiveInstances {
count: number;
}
interface ComponentOptions {
location?: string;
signature?: string;
dependencies?: () => Record<string, any>;
}
export interface ComponentRegistrationData<P> extends ComponentOptions {
id: string;
component: (props: P) => SolidElement;
proxy: (props: P) => SolidElement;
update: (action: () => (props: P) => SolidElement) => void;
/** Live renders through this registration's proxy (owner not yet disposed). */
instances: LiveInstances;
}
export interface Registry {
components: Map<string, ComponentRegistrationData<any>>;
}
export declare function $$registry(): Registry;
export declare function $$component<P extends Record<string, any>>(registry: Registry, id: string, component: (props: P) => SolidElement, options?: ComponentOptions): (props: P) => SolidElement;
declare const SOLID_REFRESH = "solid-refresh";
declare const SOLID_REFRESH_PREV = "solid-refresh-prev";
type HotData = {
[key in typeof SOLID_REFRESH | typeof SOLID_REFRESH_PREV]: Registry;
};
export type ESMRuntimeType = "esm" | "vite";
export type StandardRuntimeType = "standard" | "webpack5" | "rspack-esm";
export type RuntimeType = ESMRuntimeType | StandardRuntimeType;
interface ESMHot {
data: HotData;
accept: (cb: (module?: unknown) => void) => void;
invalidate: () => void;
decline: () => void;
}
interface StandardHot {
data: HotData;
accept: (cb?: () => void) => void;
dispose: (cb: (data: HotData) => void) => void;
invalidate?: () => void;
decline?: () => void;
}
export interface RefreshConfig {
/**
* Called when the runtime bails out of hot-swapping (the module must be
* fully re-executed, e.g. an exported component vanished and the bundler
* lacks an invalidate/decline API). Overrides the default bail behavior:
* `hot.invalidate()` when available → `window.location.reload()` in DOM
* environments → one-time console warning otherwise.
*/
invalidate?: (hot?: {
invalidate?: () => void;
}) => void;
}
/**
* Configures runtime behavior that is not part of the frozen compiled-wrapper
* ABI. Intended to be called once by bundler integrations (vite-plugin-solid)
* before any hot update fires.
*/
export declare function configureRefresh(config: RefreshConfig): void;
type ESMDecline = [type: ESMRuntimeType, hot: ESMHot, inline?: boolean];
type StandardDecline = [type: StandardRuntimeType, hot: StandardHot, inline?: boolean];
type Decline = ESMDecline | StandardDecline;
export declare function $$decline(...[type, hot, inline]: Decline): void;
type ESMRefresh = [type: ESMRuntimeType, hot: ESMHot, registry: Registry];
type StandardRefresh = [type: StandardRuntimeType, hot: StandardHot, registry: Registry];
type Refresh = ESMRefresh | StandardRefresh;
export declare function $$refresh(...[type, hot, registry]: Refresh): void;
export {};
import type { Element as SolidElement } from "../types.js";
export interface BaseComponent<P> {
(props: P): SolidElement;
}
/** Mutable live-mount counter shared between a proxy and its registration. */
interface LiveInstances {
count: number;
}
interface ComponentOptions {
location?: string;
signature?: string;
dependencies?: () => Record<string, any>;
}
export interface ComponentRegistrationData<P> extends ComponentOptions {
id: string;
component: (props: P) => SolidElement;
proxy: (props: P) => SolidElement;
update: (action: () => (props: P) => SolidElement) => void;
/** Live renders through this registration's proxy (owner not yet disposed). */
instances: LiveInstances;
}
export interface Registry {
components: Map<string, ComponentRegistrationData<any>>;
}
export declare function $$registry(): Registry;
export declare function $$component<P extends Record<string, any>>(registry: Registry, id: string, component: (props: P) => SolidElement, options?: ComponentOptions): (props: P) => SolidElement;
declare const SOLID_REFRESH = "solid-refresh";
declare const SOLID_REFRESH_PREV = "solid-refresh-prev";
type HotData = {
[key in typeof SOLID_REFRESH | typeof SOLID_REFRESH_PREV]: Registry;
};
export type ESMRuntimeType = "esm" | "vite";
export type StandardRuntimeType = "standard" | "webpack5" | "rspack-esm";
export type RuntimeType = ESMRuntimeType | StandardRuntimeType;
interface ESMHot {
data: HotData;
accept: (cb: (module?: unknown) => void) => void;
invalidate: () => void;
decline: () => void;
}
interface StandardHot {
data: HotData;
accept: (cb?: () => void) => void;
dispose: (cb: (data: HotData) => void) => void;
invalidate?: () => void;
decline?: () => void;
}
export interface RefreshConfig {
/**
* Called when the runtime bails out of hot-swapping (the module must be
* fully re-executed, e.g. an exported component vanished and the bundler
* lacks an invalidate/decline API). Overrides the default bail behavior:
* `hot.invalidate()` when available → `window.location.reload()` in DOM
* environments → one-time console warning otherwise.
*/
invalidate?: (hot?: {
invalidate?: () => void;
}) => void;
}
/**
* Configures runtime behavior that is not part of the frozen compiled-wrapper
* ABI. Intended to be called once by bundler integrations (vite-plugin-solid)
* before any hot update fires.
*/
export declare function configureRefresh(config: RefreshConfig): void;
type ESMDecline = [type: ESMRuntimeType, hot: ESMHot, inline?: boolean];
type StandardDecline = [type: StandardRuntimeType, hot: StandardHot, inline?: boolean];
type Decline = ESMDecline | StandardDecline;
export declare function $$decline(...[type, hot, inline]: Decline): void;
type ESMRefresh = [type: ESMRuntimeType, hot: ESMHot, registry: Registry];
type StandardRefresh = [type: StandardRuntimeType, hot: StandardHot, registry: Registry];
type Refresh = ESMRefresh | StandardRefresh;
export declare function $$refresh(...[type, hot, registry]: Refresh): void;
export {};
+13
-17

@@ -153,16 +153,14 @@ 'use strict';

}
const NO_HYDRATED_VALUE = Symbol("NO_HYDRATED_VALUE");
function readHydratedValue(initP, refresh) {
if (initP == null) return NO_HYDRATED_VALUE;
refresh();
if (typeof initP === "object" && initP.s === 2) throw initP.v;
return initP?.v ?? initP;
if (initP != null && typeof initP === "object") {
if (initP.s === 2) throw initP.v;
if (initP.s === 1) return initP.v;
}
return initP;
}
function readSerializedOrCompute(compute, prev) {
const o = signals.getOwner();
const hasSerialized = !sharedConfig.done && sharedConfig.has(o.id);
if (!sharedConfig.hydrating && !hasSerialized) return compute(prev);
const initP = hasSerialized ? sharedConfig.load(o.id) : undefined;
const init = readHydratedValue(initP, () => subFetch(compute, prev));
return init !== NO_HYDRATED_VALUE ? init : compute(prev);
if (sharedConfig.done || !sharedConfig.has(o.id)) return compute(prev);
return readHydratedValue(sharedConfig.load(o.id), () => subFetch(compute, prev));
}

@@ -491,7 +489,3 @@ function forwardIteratorReturn(it, value) {

if (!hydrated()) {
if (sharedConfig.has(o.id)) {
const initP = sharedConfig.load(o.id);
const init = readHydratedValue(initP, () => subFetch(fn, draft));
if (init !== NO_HYDRATED_VALUE) return init;
}
if (sharedConfig.has(o.id)) return readHydratedValue(sharedConfig.load(o.id), () => subFetch(fn, draft));
return fn(draft);

@@ -808,3 +802,4 @@ }

if (sharedConfig.hydrating) comp = _lazyHydrationLookup(comp, moduleUrl);
if (!comp) {
let local = comp;
if (!local) {
p || (p = fn());

@@ -814,6 +809,6 @@ p.then(mod => {

});
comp = signals.createMemo(() => p.then(mod => mod.default));
local = signals.createMemo(() => p.then(mod => mod.default));
}
let Comp;
return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
return signals.createMemo(() => (Comp = (comp || local)()) ? signals.untrack(() => {
Object.assign(Comp, {

@@ -889,2 +884,3 @@ [$DEVCOMP]: true

const mp = mps[i];
if (mp == null) continue;
const prevFunc = func;

@@ -891,0 +887,0 @@ const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, {

@@ -152,16 +152,14 @@ import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, getOwner, untrack, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createRevealOrder as createRevealOrder$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, peekNextChildId, getNextChildId, clearSnapshots, flush, markSnapshotScope, onCleanup, isDisposed, mapArray, repeat, DEV as DEV$1 } from '@solidjs/signals';

}
const NO_HYDRATED_VALUE = Symbol("NO_HYDRATED_VALUE");
function readHydratedValue(initP, refresh) {
if (initP == null) return NO_HYDRATED_VALUE;
refresh();
if (typeof initP === "object" && initP.s === 2) throw initP.v;
return initP?.v ?? initP;
if (initP != null && typeof initP === "object") {
if (initP.s === 2) throw initP.v;
if (initP.s === 1) return initP.v;
}
return initP;
}
function readSerializedOrCompute(compute, prev) {
const o = getOwner();
const hasSerialized = !sharedConfig.done && sharedConfig.has(o.id);
if (!sharedConfig.hydrating && !hasSerialized) return compute(prev);
const initP = hasSerialized ? sharedConfig.load(o.id) : undefined;
const init = readHydratedValue(initP, () => subFetch(compute, prev));
return init !== NO_HYDRATED_VALUE ? init : compute(prev);
if (sharedConfig.done || !sharedConfig.has(o.id)) return compute(prev);
return readHydratedValue(sharedConfig.load(o.id), () => subFetch(compute, prev));
}

@@ -490,7 +488,3 @@ function forwardIteratorReturn(it, value) {

if (!hydrated()) {
if (sharedConfig.has(o.id)) {
const initP = sharedConfig.load(o.id);
const init = readHydratedValue(initP, () => subFetch(fn, draft));
if (init !== NO_HYDRATED_VALUE) return init;
}
if (sharedConfig.has(o.id)) return readHydratedValue(sharedConfig.load(o.id), () => subFetch(fn, draft));
return fn(draft);

@@ -807,3 +801,4 @@ }

if (sharedConfig.hydrating) comp = _lazyHydrationLookup(comp, moduleUrl);
if (!comp) {
let local = comp;
if (!local) {
p || (p = fn());

@@ -813,6 +808,6 @@ p.then(mod => {

});
comp = createMemo$1(() => p.then(mod => mod.default));
local = createMemo$1(() => p.then(mod => mod.default));
}
let Comp;
return createMemo$1(() => (Comp = comp()) ? untrack(() => {
return createMemo$1(() => (Comp = (comp || local)()) ? untrack(() => {
Object.assign(Comp, {

@@ -888,2 +883,3 @@ [$DEVCOMP]: true

const mp = mps[i];
if (mp == null) continue;
const prevFunc = func;

@@ -890,0 +886,0 @@ const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, {

@@ -140,2 +140,4 @@ 'use strict';

}
} else {
node._childCount = 0;
}

@@ -168,2 +170,7 @@ return;

}
function resetOwnerForRerun(owner) {
const node = owner;
if (node._firstChild || node._disposal) disposeOwner(owner, false);
node._childCount = 0;
}
function createRoot(init, options) {

@@ -293,8 +300,11 @@ const owner = createOwner(options);

};
runWithOwner(owner, () => onCleanup(() => {
onCleanup(() => {
comp.disposed = true;
}));
});
function update() {
if (comp.disposed) return;
const run = () => runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value)));
const run = () => {
resetOwnerForRerun(owner);
return runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value)));
};
try {

@@ -342,5 +352,3 @@ comp.error = undefined;

currentOwner = owner;
const o = owner;
if (o._firstChild || o._disposal) disposeOwner(owner, false);
o._childCount = 0;
resetOwnerForRerun(owner);
try {

@@ -584,5 +592,5 @@ value = compute(value);

if (ssrSource || effectFn) {
runWithOwner(owner, () => onCleanup(() => {
onCleanup(() => {
comp.disposed = true;
}));
});
}

@@ -602,2 +610,3 @@ try {

try {
resetOwnerForRerun(owner);
const result = runWithOwner(owner, () => runWithObserver(comp, () => compute(undefined)));

@@ -681,5 +690,5 @@ if (!options?.defer) effectFn(result, undefined);

let disposed = false;
runWithOwner(owner, () => onCleanup(() => {
onCleanup(() => {
disposed = true;
}));
});
const ssrSource = options?.ssrSource;

@@ -689,3 +698,6 @@ const useProxy = ssrSource !== "hybrid";

const draft = useProxy ? createDeepProxy(state, patches) : state;
const runProjection = () => runWithOwner(owner, () => fn(draft));
const runProjection = () => {
resetOwnerForRerun(owner);
return runWithOwner(owner, () => fn(draft));
};
let result;

@@ -1435,2 +1447,3 @@ try {

for (let i = 0; i < conds.length; i++) {
if (conds[i] == null) continue;
const w = conds[i].when;

@@ -1437,0 +1450,0 @@ if (w) {

@@ -139,2 +139,4 @@ import { NotReadyError, $REFRESH, merge as merge$1, isWrappable, NoOwnerError, ContextNotFoundError, $PROXY, flatten } from '@solidjs/signals';

}
} else {
node._childCount = 0;
}

@@ -167,2 +169,7 @@ return;

}
function resetOwnerForRerun(owner) {
const node = owner;
if (node._firstChild || node._disposal) disposeOwner(owner, false);
node._childCount = 0;
}
function createRoot(init, options) {

@@ -292,8 +299,11 @@ const owner = createOwner(options);

};
runWithOwner(owner, () => onCleanup(() => {
onCleanup(() => {
comp.disposed = true;
}));
});
function update() {
if (comp.disposed) return;
const run = () => runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value)));
const run = () => {
resetOwnerForRerun(owner);
return runWithOwner(owner, () => runWithObserver(comp, () => comp.compute(comp.value)));
};
try {

@@ -341,5 +351,3 @@ comp.error = undefined;

currentOwner = owner;
const o = owner;
if (o._firstChild || o._disposal) disposeOwner(owner, false);
o._childCount = 0;
resetOwnerForRerun(owner);
try {

@@ -583,5 +591,5 @@ value = compute(value);

if (ssrSource || effectFn) {
runWithOwner(owner, () => onCleanup(() => {
onCleanup(() => {
comp.disposed = true;
}));
});
}

@@ -601,2 +609,3 @@ try {

try {
resetOwnerForRerun(owner);
const result = runWithOwner(owner, () => runWithObserver(comp, () => compute(undefined)));

@@ -680,5 +689,5 @@ if (!options?.defer) effectFn(result, undefined);

let disposed = false;
runWithOwner(owner, () => onCleanup(() => {
onCleanup(() => {
disposed = true;
}));
});
const ssrSource = options?.ssrSource;

@@ -688,3 +697,6 @@ const useProxy = ssrSource !== "hybrid";

const draft = useProxy ? createDeepProxy(state, patches) : state;
const runProjection = () => runWithOwner(owner, () => fn(draft));
const runProjection = () => {
resetOwnerForRerun(owner);
return runWithOwner(owner, () => fn(draft));
};
let result;

@@ -1434,2 +1446,3 @@ try {

for (let i = 0; i < conds.length; i++) {
if (conds[i] == null) continue;
const w = conds[i].when;

@@ -1436,0 +1449,0 @@ if (w) {

@@ -136,16 +136,14 @@ 'use strict';

}
const NO_HYDRATED_VALUE = Symbol("NO_HYDRATED_VALUE");
function readHydratedValue(initP, refresh) {
if (initP == null) return NO_HYDRATED_VALUE;
refresh();
if (typeof initP === "object" && initP.s === 2) throw initP.v;
return initP?.v ?? initP;
if (initP != null && typeof initP === "object") {
if (initP.s === 2) throw initP.v;
if (initP.s === 1) return initP.v;
}
return initP;
}
function readSerializedOrCompute(compute, prev) {
const o = signals.getOwner();
const hasSerialized = !sharedConfig.done && sharedConfig.has(o.id);
if (!sharedConfig.hydrating && !hasSerialized) return compute(prev);
const initP = hasSerialized ? sharedConfig.load(o.id) : undefined;
const init = readHydratedValue(initP, () => subFetch(compute, prev));
return init !== NO_HYDRATED_VALUE ? init : compute(prev);
if (sharedConfig.done || !sharedConfig.has(o.id)) return compute(prev);
return readHydratedValue(sharedConfig.load(o.id), () => subFetch(compute, prev));
}

@@ -474,7 +472,3 @@ function forwardIteratorReturn(it, value) {

if (!hydrated()) {
if (sharedConfig.has(o.id)) {
const initP = sharedConfig.load(o.id);
const init = readHydratedValue(initP, () => subFetch(fn, draft));
if (init !== NO_HYDRATED_VALUE) return init;
}
if (sharedConfig.has(o.id)) return readHydratedValue(sharedConfig.load(o.id), () => subFetch(fn, draft));
return fn(draft);

@@ -791,3 +785,4 @@ }

if (sharedConfig.hydrating) comp = _lazyHydrationLookup(comp, moduleUrl);
if (!comp) {
let local = comp;
if (!local) {
p || (p = fn());

@@ -797,6 +792,6 @@ p.then(mod => {

});
comp = signals.createMemo(() => p.then(mod => mod.default));
local = signals.createMemo(() => p.then(mod => mod.default));
}
let Comp;
return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
return signals.createMemo(() => (Comp = (comp || local)()) ? signals.untrack(() => {
return Comp(props);

@@ -863,2 +858,3 @@ }) : "", {

const mp = mps[i];
if (mp == null) continue;
const prevFunc = func;

@@ -865,0 +861,0 @@ const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, undefined);

@@ -135,16 +135,14 @@ import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createRevealOrder as createRevealOrder$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getOwner, peekNextChildId, getNextChildId, clearSnapshots, flush, markSnapshotScope, onCleanup, isDisposed, untrack, mapArray, repeat } from '@solidjs/signals';

}
const NO_HYDRATED_VALUE = Symbol("NO_HYDRATED_VALUE");
function readHydratedValue(initP, refresh) {
if (initP == null) return NO_HYDRATED_VALUE;
refresh();
if (typeof initP === "object" && initP.s === 2) throw initP.v;
return initP?.v ?? initP;
if (initP != null && typeof initP === "object") {
if (initP.s === 2) throw initP.v;
if (initP.s === 1) return initP.v;
}
return initP;
}
function readSerializedOrCompute(compute, prev) {
const o = getOwner();
const hasSerialized = !sharedConfig.done && sharedConfig.has(o.id);
if (!sharedConfig.hydrating && !hasSerialized) return compute(prev);
const initP = hasSerialized ? sharedConfig.load(o.id) : undefined;
const init = readHydratedValue(initP, () => subFetch(compute, prev));
return init !== NO_HYDRATED_VALUE ? init : compute(prev);
if (sharedConfig.done || !sharedConfig.has(o.id)) return compute(prev);
return readHydratedValue(sharedConfig.load(o.id), () => subFetch(compute, prev));
}

@@ -473,7 +471,3 @@ function forwardIteratorReturn(it, value) {

if (!hydrated()) {
if (sharedConfig.has(o.id)) {
const initP = sharedConfig.load(o.id);
const init = readHydratedValue(initP, () => subFetch(fn, draft));
if (init !== NO_HYDRATED_VALUE) return init;
}
if (sharedConfig.has(o.id)) return readHydratedValue(sharedConfig.load(o.id), () => subFetch(fn, draft));
return fn(draft);

@@ -790,3 +784,4 @@ }

if (sharedConfig.hydrating) comp = _lazyHydrationLookup(comp, moduleUrl);
if (!comp) {
let local = comp;
if (!local) {
p || (p = fn());

@@ -796,6 +791,6 @@ p.then(mod => {

});
comp = createMemo$1(() => p.then(mod => mod.default));
local = createMemo$1(() => p.then(mod => mod.default));
}
let Comp;
return createMemo$1(() => (Comp = comp()) ? untrack(() => {
return createMemo$1(() => (Comp = (comp || local)()) ? untrack(() => {
return Comp(props);

@@ -862,2 +857,3 @@ }) : "", {

const mp = mps[i];
if (mp == null) continue;
const prevFunc = func;

@@ -864,0 +860,0 @@ const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined);

{
"name": "solid-js",
"description": "Reactive JavaScript library for building user interfaces. Compiles JSX to real DOM with fine-grained signal-based updates — no virtual DOM.",
"version": "2.0.0-beta.19",
"version": "2.0.0-beta.20",
"author": "Ryan Carniato",

@@ -98,2 +98,22 @@ "license": "MIT",

},
"./refresh": {
"development": {
"import": {
"types": "./types/refresh/index.d.ts",
"default": "./dist/refresh.dev.js"
},
"require": {
"types": "./types-cjs/refresh/index.d.cts",
"default": "./dist/refresh.dev.cjs"
}
},
"import": {
"types": "./types/refresh/index.d.ts",
"default": "./dist/refresh.js"
},
"require": {
"types": "./types-cjs/refresh/index.d.cts",
"default": "./dist/refresh.cjs"
}
},
"./types/*": "./types/*",

@@ -112,3 +132,3 @@ "./package.json": "./package.json"

"dependencies": {
"@solidjs/signals": "^2.0.0-beta.19",
"@solidjs/signals": "^2.0.0-beta.20",
"csstype": "^3.1.0",

@@ -115,0 +135,0 @@ "seroval": "~1.5.4",

@@ -40,2 +40,14 @@ import { $REFRESH } from "@solidjs/signals";

export declare function disposeOwner(owner: Owner, self?: boolean): void;
/**
* Client parity for async retries (#2900): on the client every recompute
* disposes the owner's children and resets `_childCount`, so child hydration
* ids are stable across reruns. Call before re-running a compute under the
* same owner. Runs the owner's own `_disposal` too — the failed run's
* onCleanups must fire like any recompute's — which is why the retrying
* primitives register their lifecycle cleanup (`comp.disposed`) on the
* creation context rather than on `owner`: a retry must not cancel itself.
*
* @internal
*/
export declare function resetOwnerForRerun(owner: Owner): void;
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {

@@ -42,0 +54,0 @@ id?: string;

@@ -40,2 +40,14 @@ import { $REFRESH } from "@solidjs/signals";

export declare function disposeOwner(owner: Owner, self?: boolean): void;
/**
* Client parity for async retries (#2900): on the client every recompute
* disposes the owner's children and resets `_childCount`, so child hydration
* ids are stable across reruns. Call before re-running a compute under the
* same owner. Runs the owner's own `_disposal` too — the failed run's
* onCleanups must fire like any recompute's — which is why the retrying
* primitives register their lifecycle cleanup (`comp.disposed`) on the
* creation context rather than on `owner`: a retry must not cancel itself.
*
* @internal
*/
export declare function resetOwnerForRerun(owner: Owner): void;
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {

@@ -42,0 +54,0 @@ id?: string;