New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

svelte

Package Overview
Dependencies
Maintainers
3
Versions
841
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte - npm Package Compare versions

Comparing version 5.19.5 to 5.19.6

2

package.json

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

"license": "MIT",
"version": "5.19.5",
"version": "5.19.6",
"type": "module",

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

@@ -342,3 +342,4 @@ /** @import * as Compiler from '#compiler' */

// If this is a :has inside a global selector, we gotta include the element itself, too,
// because the global selector might be for an element that's outside the component (e.g. :root).
// because the global selector might be for an element that's outside the component,
// e.g. :root:has(.scoped), :global(.foo):has(.scoped), or :root { &:has(.scoped) {} }
const rules = get_parent_rules(rule);

@@ -349,3 +350,7 @@ const include_self =

c.children.some((r) =>
r.selectors.some((s) => s.type === 'PseudoClassSelector' && s.name === 'root')
r.selectors.some(
(s) =>
s.type === 'PseudoClassSelector' &&
(s.name === 'root' || (s.name === 'global' && s.args))
)
)

@@ -352,0 +357,0 @@ );

@@ -759,3 +759,4 @@ /** @import { Context } from '../../types.js' */

!is_interactive_element(node.name, attribute_map) &&
!attribute_map.has('tabindex')
!attribute_map.has('tabindex') &&
!has_spread
) {

@@ -814,5 +815,5 @@ w.a11y_aria_activedescendant_has_tabindex(attribute);

const required_role_props = Object.keys(role.requiredProps);
const has_missing_props = required_role_props.some(
(prop) => !attributes.find((a) => a.name === prop)
);
const has_missing_props =
!has_spread &&
required_role_props.some((prop) => !attributes.find((a) => a.name === prop));
if (has_missing_props) {

@@ -833,2 +834,3 @@ w.a11y_role_has_required_aria_props(

if (
!has_spread &&
!has_disabled_attribute(attribute_map) &&

@@ -851,2 +853,3 @@ !is_hidden_from_screen_reader(node.name, attribute_map) &&

if (
!has_spread &&
is_interactive_element(node.name, attribute_map) &&

@@ -860,2 +863,3 @@ (is_non_interactive_roles(current_role) || is_presentation_role(current_role))

if (
!has_spread &&
is_non_interactive_element(node.name, attribute_map) &&

@@ -955,2 +959,3 @@ is_interactive_roles(current_role) &&

if (
!has_spread &&
!has_contenteditable_attr &&

@@ -973,2 +978,3 @@ !is_hidden_from_screen_reader(node.name, attribute_map) &&

if (
!has_spread &&
(!role || role_static_value !== null) &&

@@ -991,7 +997,7 @@ !is_hidden_from_screen_reader(node.name, attribute_map) &&

if (handlers.has('mouseover') && !handlers.has('focus')) {
if (!has_spread && handlers.has('mouseover') && !handlers.has('focus')) {
w.a11y_mouse_events_have_key_events(node, 'mouseover', 'focus');
}
if (handlers.has('mouseout') && !handlers.has('blur')) {
if (!has_spread && handlers.has('mouseout') && !handlers.has('blur')) {
w.a11y_mouse_events_have_key_events(node, 'mouseout', 'blur');

@@ -1006,3 +1012,3 @@ }

if (!is_hidden && !is_labelled && !has_content(node)) {
if (!has_spread && !is_hidden && !is_labelled && !has_content(node)) {
w.a11y_consider_explicit_label(node);

@@ -1066,3 +1072,3 @@ }

const aria_hidden = get_static_value(attribute_map.get('aria-hidden'));
if (alt_attribute && !aria_hidden) {
if (alt_attribute && !aria_hidden && !has_spread) {
if (/\b(image|picture|photo)\b/i.test(alt_attribute)) {

@@ -1100,3 +1106,3 @@ w.a11y_img_redundant_alt(node);

};
if (!attribute_map.has('for') && !has_input_child(node)) {
if (!has_spread && !attribute_map.has('for') && !has_input_child(node)) {
w.a11y_label_has_associated_control(node);

@@ -1109,3 +1115,3 @@ }

const aria_hidden_exist = aria_hidden_attribute && get_static_value(aria_hidden_attribute);
if (attribute_map.has('muted') || aria_hidden_exist === 'true') {
if (attribute_map.has('muted') || aria_hidden_exist === 'true' || has_spread) {
return;

@@ -1156,2 +1162,3 @@ }

if (
!has_spread &&
!is_labelled &&

@@ -1158,0 +1165,0 @@ !has_contenteditable_binding &&

@@ -83,6 +83,2 @@ /** @import { AST } from '#compiler' */

if (owner) {
if (!is_text_attribute(attribute)) {
e.slot_attribute_invalid(attribute);
}
if (

@@ -94,26 +90,32 @@ owner.type === 'Component' ||

if (owner !== parent) {
e.slot_attribute_invalid_placement(attribute);
}
if (!is_component) {
e.slot_attribute_invalid_placement(attribute);
}
} else {
if (!is_text_attribute(attribute)) {
e.slot_attribute_invalid(attribute);
}
const name = attribute.value[0].data;
const name = attribute.value[0].data;
if (context.state.component_slots.has(name)) {
e.slot_attribute_duplicate(attribute, name, owner.name);
}
if (context.state.component_slots.has(name)) {
e.slot_attribute_duplicate(attribute, name, owner.name);
}
context.state.component_slots.add(name);
context.state.component_slots.add(name);
if (name === 'default') {
for (const node of owner.fragment.nodes) {
if (node.type === 'Text' && regex_only_whitespaces.test(node.data)) {
continue;
}
if (node.type === 'RegularElement' || node.type === 'SvelteFragment') {
if (node.attributes.some((a) => a.type === 'Attribute' && a.name === 'slot')) {
if (name === 'default') {
for (const node of owner.fragment.nodes) {
if (node.type === 'Text' && regex_only_whitespaces.test(node.data)) {
continue;
}
if (node.type === 'RegularElement' || node.type === 'SvelteFragment') {
if (node.attributes.some((a) => a.type === 'Attribute' && a.name === 'slot')) {
continue;
}
}
e.slot_default_duplicate(node);
}
e.slot_default_duplicate(node);
}

@@ -120,0 +122,0 @@ }

@@ -11,3 +11,38 @@ /** @import { ComponentContext, ComponentContextLegacy } from '#client' */

import { component_context } from './internal/client/context.js';
import { DEV } from 'esm-env';
if (DEV) {
/**
* @param {string} rune
*/
function throw_rune_error(rune) {
if (!(rune in globalThis)) {
// TODO if people start adjusting the "this can contain runes" config through v-p-s more, adjust this message
/** @type {any} */
let value; // let's hope noone modifies this global, but belts and braces
Object.defineProperty(globalThis, rune, {
configurable: true,
// eslint-disable-next-line getter-return
get: () => {
if (value !== undefined) {
return value;
}
e.rune_outside_svelte(rune);
},
set: (v) => {
value = v;
}
});
}
}
throw_rune_error('$state');
throw_rune_error('$effect');
throw_rune_error('$derived');
throw_rune_error('$inspect');
throw_rune_error('$props');
throw_rune_error('$bindable');
}
/**

@@ -14,0 +49,0 @@ * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.

@@ -11,3 +11,4 @@ /** @import { ComponentContext } from '#client' */

set_active_effect,
set_active_reaction
set_active_reaction,
untrack
} from './runtime.js';

@@ -53,10 +54,2 @@ import { effect } from './reactivity/effects.js';

const result = /** @type {T} */ (context_map.get(key));
if (DEV) {
const fn = /** @type {ComponentContext} */ (component_context).function;
if (fn) {
add_owner(result, fn, true);
}
}
return result;

@@ -79,2 +72,11 @@ }

const context_map = get_or_init_context_map('setContext');
if (DEV) {
// When state is put into context, we treat as if it's global from now on.
// We do for performance reasons (it's for example very expensive to call
// getContext on a big object many times when part of a list component)
// and danger of false positives.
untrack(() => add_owner(context, null, true));
}
context_map.set(key, context);

@@ -106,12 +108,2 @@ return context;

const context_map = get_or_init_context_map('getAllContexts');
if (DEV) {
const fn = component_context?.function;
if (fn) {
for (const value of context_map.values()) {
add_owner(value, fn, true);
}
}
}
return /** @type {T} */ (context_map);

@@ -192,2 +184,7 @@ }

/** @returns {boolean} */
export function is_runes() {
return !legacy_mode_flag || (component_context !== null && component_context.l === null);
}
/**

@@ -194,0 +191,0 @@ * @param {string} name

@@ -112,3 +112,3 @@ /** @import { ProxyMetadata } from '#client' */

* @param {any} object
* @param {any} owner
* @param {any | null} owner
* @param {boolean} [global]

@@ -124,3 +124,3 @@ * @param {boolean} [skip_warning]

if (owner[FILENAME] !== component[FILENAME] && !skip_warning) {
if (owner && owner[FILENAME] !== component[FILENAME] && !skip_warning) {
w.ownership_invalid_binding(component[FILENAME], owner[FILENAME], original[FILENAME]);

@@ -170,3 +170,3 @@ }

* @param {any} object
* @param {Function} owner
* @param {Function | null} owner If `null`, then the object is globally owned and will not be checked
* @param {Set<any>} seen

@@ -180,3 +180,7 @@ */

if ('owners' in metadata && metadata.owners != null) {
metadata.owners.add(owner);
if (owner) {
metadata.owners.add(owner);
} else {
metadata.owners = null;
}
}

@@ -223,2 +227,6 @@ } else if (object && typeof object === 'object') {

metadata.owners.has(component) ||
// This helps avoid false positives when using HMR, where the component function is replaced
[...metadata.owners].some(
(owner) => /** @type {any} */ (owner)[FILENAME] === /** @type {any} */ (component)?.[FILENAME]
) ||
(metadata.parent !== null && has_owner(metadata.parent, component))

@@ -225,0 +233,0 @@ );

@@ -6,3 +6,3 @@ /** @import { Effect, Source, TemplateNode } from '#client' */

import { internal_set, mutable_source, source } from '../../reactivity/sources.js';
import { flush_sync, is_runes, set_active_effect, set_active_reaction } from '../../runtime.js';
import { flush_sync, set_active_effect, set_active_reaction } from '../../runtime.js';
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';

@@ -13,2 +13,3 @@ import { queue_micro_task } from '../task.js';

component_context,
is_runes,
set_component_context,

@@ -15,0 +16,0 @@ set_dev_current_component_function

@@ -222,13 +222,3 @@ /** @import { EachItem, EachState, Effect, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */

if (!hydrating) {
var effect = /** @type {Effect} */ (active_reaction);
reconcile(
array,
state,
anchor,
render_fn,
flags,
(effect.f & INERT) !== 0,
get_key,
get_collection
);
reconcile(array, state, anchor, render_fn, flags, get_key, get_collection);
}

@@ -277,3 +267,2 @@

* @param {number} flags
* @param {boolean} is_inert
* @param {(value: V, index: number) => any} get_key

@@ -283,3 +272,3 @@ * @param {() => V[]} get_collection

*/
function reconcile(array, state, anchor, render_fn, flags, is_inert, get_key, get_collection) {
function reconcile(array, state, anchor, render_fn, flags, get_key, get_collection) {
var is_animated = (flags & EACH_IS_ANIMATED) !== 0;

@@ -426,3 +415,3 @@ var should_update = (flags & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0;

// skip over adding it to our seen Set as the item is already being handled
if (is_inert || (current.e.f & INERT) === 0) {
if ((current.e.f & INERT) === 0) {
(seen ??= new Set()).add(current);

@@ -451,3 +440,3 @@ }

// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished
if (is_inert || (current.e.f & INERT) === 0) {
if ((current.e.f & INERT) === 0) {
to_destroy.push(current);

@@ -454,0 +443,0 @@ }

@@ -5,3 +5,3 @@ /** @import { Effect, TemplateNode } from '#client' */

import { not_equal, safe_not_equal } from '../../reactivity/equality.js';
import { is_runes } from '../../runtime.js';
import { is_runes } from '../../context.js';
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';

@@ -8,0 +8,0 @@

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

import { hydrating } from '../../hydration.js';
import { is_runes, untrack } from '../../../runtime.js';
import { untrack } from '../../../runtime.js';
import { is_runes } from '../../../context.js';

@@ -11,0 +12,0 @@ /**

@@ -113,3 +113,3 @@ export { FILENAME, HMR, NAMESPACE_SVG } from '../../constants.js';

} from './reactivity/effects.js';
export { mutable_state, mutate, set, state } from './reactivity/sources.js';
export { mutable_state, mutate, set, state, update, update_pre } from './reactivity/sources.js';
export {

@@ -143,4 +143,2 @@ prop,

untrack,
update,
update_pre,
exclude_from_object,

@@ -147,0 +145,0 @@ deep_read,

@@ -11,12 +11,5 @@ /** @import { Source } from './types.js' */

import { get_descriptor, is_function } from '../../shared/utils.js';
import { mutable_source, set, source } from './sources.js';
import { mutable_source, set, source, update } from './sources.js';
import { derived, derived_safe_equal } from './deriveds.js';
import {
active_effect,
get,
captured_signals,
set_active_effect,
untrack,
update
} from '../runtime.js';
import { active_effect, get, captured_signals, set_active_effect, untrack } from '../runtime.js';
import { safe_equals } from './equality.js';

@@ -23,0 +16,0 @@ import * as e from '../errors.js';

@@ -8,3 +8,2 @@ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */

get,
is_runes,
schedule_effect,

@@ -38,3 +37,3 @@ set_untracked_writes,

import { get_stack } from '../dev/tracing.js';
import { component_context } from '../context.js';
import { component_context, is_runes } from '../context.js';

@@ -232,2 +231,31 @@ export let inspect_effects = new Set();

/**
* @template {number | bigint} T
* @param {Source<T>} source
* @param {1 | -1} [d]
* @returns {T}
*/
export function update(source, d = 1) {
var value = get(source);
var result = d === 1 ? value++ : value--;
set(source, value);
// @ts-expect-error
return result;
}
/**
* @template {number | bigint} T
* @param {Source<T>} source
* @param {1 | -1} [d]
* @returns {T}
*/
export function update_pre(source, d = 1) {
var value = get(source);
// @ts-expect-error
return set(source, d === 1 ? ++value : --value);
}
/**
* @param {Value} signal

@@ -234,0 +262,0 @@ * @param {number} status should be DIRTY or MAYBE_DIRTY

@@ -29,3 +29,3 @@ /** @import { ComponentContext, Derived, Effect, Reaction, Signal, Source, Value } from '#client' */

import { flush_tasks } from './dom/task.js';
import { internal_set, set } from './reactivity/sources.js';
import { internal_set } from './reactivity/sources.js';
import {

@@ -39,3 +39,3 @@ destroy_derived,

import { FILENAME } from '../../constants.js';
import { legacy_mode_flag, tracing_mode_flag } from '../flags/index.js';
import { tracing_mode_flag } from '../flags/index.js';
import { tracing_expressions, get_stack } from './dev/tracing.js';

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

dev_current_component_function,
is_runes,
set_component_context,

@@ -167,7 +168,2 @@ set_dev_current_component_function

/** @returns {boolean} */
export function is_runes() {
return !legacy_mode_flag || (component_context !== null && component_context.l === null);
}
/**

@@ -813,3 +809,8 @@ * Determines whether a derived or effect is dirty.

} else {
// Ensure we set the effect to be the active reaction
// to ensure that unowned deriveds are correctly tracked
// because we're flushing the current effect
var previous_active_reaction = active_reaction;
try {
active_reaction = current_effect;
if (check_dirtiness(current_effect)) {

@@ -820,2 +821,4 @@ update_effect(current_effect);

handle_error(error, current_effect, null, current_effect.ctx);
} finally {
active_reaction = previous_active_reaction;
}

@@ -965,9 +968,7 @@ }

if (parent !== null) {
if (parent !== null && (parent.f & UNOWNED) === 0) {
// If the derived is owned by another derived then mark it as unowned
// as the derived value might have been referenced in a different context
// since and thus its parent might not be its true owner anymore
if ((parent.f & UNOWNED) === 0) {
derived.f ^= UNOWNED;
}
derived.f ^= UNOWNED;
}

@@ -1106,31 +1107,2 @@ }

/**
* @template {number | bigint} T
* @param {Value<T>} signal
* @param {1 | -1} [d]
* @returns {T}
*/
export function update(signal, d = 1) {
var value = get(signal);
var result = d === 1 ? value++ : value--;
set(signal, value);
// @ts-expect-error
return result;
}
/**
* @template {number | bigint} T
* @param {Value<T>} signal
* @param {1 | -1} [d]
* @returns {T}
*/
export function update_pre(signal, d = 1) {
var value = get(signal);
// @ts-expect-error
return set(signal, d === 1 ? ++value : --value);
}
/**
* @param {Record<string, unknown>} obj

@@ -1226,35 +1198,1 @@ * @param {string[]} keys

}
if (DEV) {
/**
* @param {string} rune
*/
function throw_rune_error(rune) {
if (!(rune in globalThis)) {
// TODO if people start adjusting the "this can contain runes" config through v-p-s more, adjust this message
/** @type {any} */
let value; // let's hope noone modifies this global, but belts and braces
Object.defineProperty(globalThis, rune, {
configurable: true,
// eslint-disable-next-line getter-return
get: () => {
if (value !== undefined) {
return value;
}
e.rune_outside_svelte(rune);
},
set: (v) => {
value = v;
}
});
}
}
throw_rune_error('$state');
throw_rune_error('$effect');
throw_rune_error('$derived');
throw_rune_error('$inspect');
throw_rune_error('$props');
throw_rune_error('$bindable');
}

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

*/
export const VERSION = '5.19.5';
export const VERSION = '5.19.6';
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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc