Socket
Socket
Sign inDemoInstall

svelte

Package Overview
Dependencies
18
Maintainers
3
Versions
625
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-next.125 to 5.0.0-next.126

2

package.json

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "5.0.0-next.125",
"version": "5.0.0-next.126",
"type": "module",

@@ -8,0 +8,0 @@ "types": "./types/index.d.ts",

@@ -625,2 +625,4 @@ import is_reference from 'is-reference';

context.next({ ...context.state, parent_element: null });
if (node.expression.name !== 'children') return;

@@ -627,0 +629,0 @@

@@ -23,3 +23,3 @@ import { snapshot } from '../proxy.js';

export function inspect(get_value, inspector = console.log) {
validate_effect(current_effect, '$inspect');
validate_effect('$inspect');

@@ -26,0 +26,0 @@ let initial = true;

@@ -115,2 +115,18 @@ /* This file is generated by scripts/process-messages/index.js. Do not edit! */

/**
* Effect cannot be created inside a `$derived` value that was not itself created inside an effect
* @returns {never}
*/
export function effect_in_unowned_derived() {
if (DEV) {
const error = new Error(`${"effect_in_unowned_derived"}\n${"Effect cannot be created inside a `$derived` value that was not itself created inside an effect"}`);
error.name = 'Svelte error';
throw error;
} else {
// TODO print a link to the documentation
throw new Error("effect_in_unowned_derived");
}
}
/**
* `%rune%` can only be used inside an effect (e.g. during component initialisation)

@@ -117,0 +133,0 @@ * @param {string} rune

@@ -88,3 +88,3 @@ import { DEV } from 'esm-env';

* @param {boolean} force_schedule
* @returns {void}
* @returns {boolean}
*/

@@ -105,3 +105,5 @@ export function update_derived(derived, force_schedule) {

if (!derived.equals(value)) {
var is_equal = derived.equals(value);
if (!is_equal) {
derived.v = value;

@@ -114,2 +116,4 @@ mark_reactions(derived, DIRTY, force_schedule);

}
return is_equal;
}

@@ -123,2 +127,3 @@

destroy_derived_children(signal);
destroy_effect_children(signal);
remove_reactions(signal, 0);

@@ -125,0 +130,0 @@ set_signal_status(signal, DESTROYED);

@@ -29,3 +29,5 @@ import {

ROOT_EFFECT,
EFFECT_TRANSPARENT
EFFECT_TRANSPARENT,
DERIVED,
UNOWNED
} from '../constants.js';

@@ -38,8 +40,6 @@ import { set } from './sources.js';

/**
* @param {import('#client').Effect | null} effect
* @param {'$effect' | '$effect.pre' | '$inspect'} rune
* @returns {asserts effect}
*/
export function validate_effect(effect, rune) {
if (effect === null) {
export function validate_effect(rune) {
if (current_effect === null && current_reaction === null) {
e.effect_orphan(rune);

@@ -98,2 +98,14 @@ }

if (current_reaction !== null && !is_root) {
var flags = current_reaction.f;
if ((flags & DERIVED) !== 0) {
if ((flags & UNOWNED) !== 0) {
e.effect_in_unowned_derived();
}
// If we are inside a derived, then we also need to attach the
// effect to the parent effect too.
if (current_effect !== null) {
push_effect(effect, current_effect);
}
}
push_effect(effect, current_reaction);

@@ -124,3 +136,11 @@ }

export function effect_active() {
return current_effect ? (current_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 : false;
if (current_reaction && (current_reaction.f & DERIVED) !== 0) {
return (current_reaction.f & UNOWNED) === 0;
}
if (current_effect) {
return (current_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0;
}
return false;
}

@@ -133,3 +153,3 @@

export function user_effect(fn) {
validate_effect(current_effect, '$effect');
validate_effect('$effect');

@@ -139,3 +159,4 @@ // Non-nested `$effect(...)` in a component should be deferred

const defer =
current_effect.f & RENDER_EFFECT &&
current_effect !== null &&
(current_effect.f & RENDER_EFFECT) !== 0 &&
// TODO do we actually need this? removing them changes nothing

@@ -159,3 +180,3 @@ current_component_context !== null &&

export function user_pre_effect(fn) {
validate_effect(current_effect, '$effect.pre');
validate_effect('$effect.pre');
return render_effect(fn);

@@ -162,0 +183,0 @@ }

@@ -194,2 +194,3 @@ import { DEV } from 'esm-env';

var length = dependencies.length;
var is_equal;

@@ -200,3 +201,3 @@ for (var i = 0; i < length; i++) {

if (!is_dirty && check_dirtiness(/** @type {import('#client').Derived} */ (dependency))) {
update_derived(/** @type {import('#client').Derived} **/ (dependency), true);
is_equal = update_derived(/** @type {import('#client').Derived} **/ (dependency), true);
}

@@ -213,3 +214,3 @@

/** @type {import('#client').Derived} */ (reaction).version = version;
return true;
return !is_equal;
}

@@ -216,0 +217,0 @@

@@ -9,3 +9,3 @@ // generated during release, do not modify

*/
export const VERSION = '5.0.0-next.125';
export const VERSION = '5.0.0-next.126';
export const PUBLIC_VERSION = '5';

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc