Socket
Socket
Sign inDemoInstall

svelte

Package Overview
Dependencies
18
Maintainers
3
Versions
617
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-next.73 to 5.0.0-next.74

2

package.json

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

"license": "MIT",
"version": "5.0.0-next.73",
"version": "5.0.0-next.74",
"type": "module",

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

@@ -135,3 +135,3 @@ /**

constructor(arr) {
// initialization
// initialisation
for (let i = GRAM_SIZE_LOWER; i < GRAM_SIZE_UPPER + 1; ++i) {

@@ -138,0 +138,0 @@ this.items[i] = [];

@@ -217,2 +217,6 @@ import { walk } from 'zimmerframe';

if (analysis.reactive_statements.size > 0) {
instance.body.push(b.stmt(b.call('$.legacy_pre_effect_reset')));
}
/**

@@ -219,0 +223,0 @@ * Used to store the group nodes

@@ -160,3 +160,2 @@ import { is_hoistable_function } from '../../utils.js';

const body = serialized_body.body;
const new_body = [];

@@ -180,14 +179,12 @@ /** @type {import('estree').Expression[]} */

if (sequence.length > 0) {
new_body.push(b.stmt(b.sequence(sequence)));
}
new_body.push(b.stmt(b.call('$.untrack', b.thunk(b.block(body)))));
serialized_body.body = new_body;
// these statements will be topologically ordered later
state.legacy_reactive_statements.set(
node,
b.stmt(b.call('$.pre_effect', b.thunk(serialized_body)))
b.stmt(
b.call(
'$.legacy_pre_effect',
sequence.length > 0 ? b.thunk(b.sequence(sequence)) : b.thunk(b.block([])),
b.thunk(b.block(body))
)
)
);

@@ -194,0 +191,0 @@

@@ -8,5 +8,9 @@ import { DEV } from 'esm-env';

flush_local_render_effects,
schedule_effect
get,
is_runes,
schedule_effect,
untrack
} from '../runtime.js';
import { DIRTY, MANAGED, RENDER_EFFECT, EFFECT, PRE_EFFECT } from '../constants.js';
import { set } from './sources.js';

@@ -160,2 +164,3 @@ /**

const sync = current_effect !== null && (current_effect.f & RENDER_EFFECT) !== 0;
const runes = is_runes(current_component_context);
return create_effect(

@@ -175,2 +180,43 @@ PRE_EFFECT,

/**
* Internal representation of `$: ..`
* @param {() => any} deps
* @param {() => void | (() => void)} fn
* @returns {import('#client').Effect}
*/
export function legacy_pre_effect(deps, fn) {
const component_context = /** @type {import('#client').ComponentContext} */ (
current_component_context
);
const token = {};
return create_effect(
PRE_EFFECT,
() => {
deps();
if (component_context.l1.includes(token)) {
return;
}
component_context.l1.push(token);
set(component_context.l2, true);
return untrack(fn);
},
true,
current_block,
true
);
}
export function legacy_pre_effect_reset() {
const component_context = /** @type {import('#client').ComponentContext} */ (
current_component_context
);
return render_effect(() => {
const x = get(component_context.l2);
if (x) {
component_context.l1.length = 0;
component_context.l2.v = false; // set directly to avoid rerunning this effect
}
});
}
/**
* This effect is used to ensure binding are kept in sync. We use a pre effect to ensure we run before the

@@ -177,0 +223,0 @@ * bindings which are in later effects. However, we don't use a pre_effect directly as we don't want to flush anything.

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

// We additionally want to skip this logic for when ignore_mutation_validation is
// true, as stores write to source signal on initialization.
// true, as stores write to source signal on initialisation.
if (

@@ -131,0 +131,0 @@ is_runes(null) &&

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

import { add_owner } from './dev/ownership.js';
import { mutate, set } from './reactivity/sources.js';
import { mutate, set, source } from './reactivity/sources.js';

@@ -434,7 +434,3 @@ const IS_EFFECT = EFFECT | PRE_EFFECT | RENDER_EFFECT;

const component_context = signal.x;
if (
is_runes(component_context) && // Don't rerun pre effects more than once to accomodate for "$: only runs once" behavior
(signal.f & PRE_EFFECT) !== 0 &&
current_queued_pre_and_render_effects.length > 0
) {
if ((signal.f & PRE_EFFECT) !== 0 && current_queued_pre_and_render_effects.length > 0) {
flush_local_pre_effects(component_context);

@@ -1168,2 +1164,5 @@ }

r: runes,
// legacy $:
l1: [],
l2: source(false),
// update_callbacks

@@ -1170,0 +1169,0 @@ u: null

@@ -45,2 +45,6 @@ import {

r: boolean;
/** legacy mode: if `$:` statements are allowed to run (ensures they only run once per render) */
l1: any[];
/** legacy mode: if `$:` statements are allowed to run (ensures they only run once per render) */
l2: Source<boolean>;
/** update_callbacks */

@@ -47,0 +51,0 @@ u: null | {

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

*/
export const VERSION = '5.0.0-next.73';
export const VERSION = '5.0.0-next.74';
export const PUBLIC_VERSION = '5';

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc