Socket
Socket
Sign inDemoInstall

svelte

Package Overview
Dependencies
Maintainers
3
Versions
752
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.0.0-next.268 to 5.0.0-next.269

2

package.json

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

"license": "MIT",
"version": "5.0.0-next.268",
"version": "5.0.0-next.269",
"type": "module",

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

@@ -552,2 +552,21 @@ /** @import { VariableDeclarator, Node, Identifier, AssignmentExpression, LabeledStatement, ExpressionStatement } from 'estree' */

) {
const indent = state.str.original.substring(
state.str.original.lastIndexOf('\n', /** @type {number} */ (node.start)) + 1,
/** @type {number} */ (node.start)
);
// transfer all the leading comments
if (
labeled_statement.body.type === 'BlockStatement' &&
labeled_statement.body.body[0].leadingComments
) {
for (let comment of labeled_statement.body.body[0].leadingComments) {
state.str.prependLeft(
/** @type {number} */ (node.start),
comment.type === 'Block'
? `/*${comment.value}*/\n${indent}`
: `// ${comment.value}\n${indent}`
);
}
}
// Someone wrote a `$: { ... }` statement which we can turn into a `$derived`

@@ -577,2 +596,17 @@ state.str.appendRight(

state.derived_labeled_statements.add(labeled_statement);
// transfer all the trailing comments
if (
labeled_statement.body.type === 'BlockStatement' &&
labeled_statement.body.body[0].trailingComments
) {
for (let comment of labeled_statement.body.body[0].trailingComments) {
state.str.appendRight(
/** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end),
comment.type === 'Block'
? `\n${indent}/*${comment.value}*/`
: `\n${indent}// ${comment.value}`
);
}
}
} else {

@@ -1266,8 +1300,15 @@ state.str.prependLeft(

* @param {string} source
* @param {Node} node
* @param {LabeledStatement} node
*/
function get_node_range(source, node) {
let start = /** @type {number} */ (node.start);
let end = /** @type {number} */ (node.end);
const first_leading_comment = node.leadingComments?.[0];
const last_trailing_comment = node.trailingComments?.[node.trailingComments.length - 1];
// @ts-expect-error the type of `Comment` seems to be wrong...the node actually contains
// start and end but the type seems to only contain a `range` (which doesn't actually exists)
let start = /** @type {number} */ (first_leading_comment?.start ?? node.start);
// @ts-expect-error the type of `Comment` seems to be wrong...the node actually contains
// start and end but the type seems to only contain a `range` (which doesn't actually exists)
let end = /** @type {number} */ (last_trailing_comment?.end ?? node.end);
let idx = start;

@@ -1274,0 +1315,0 @@ while (source[idx - 1] !== '\n' && source[idx - 1] !== '\r') {

@@ -78,2 +78,10 @@ /** @import { AST } from '#compiler' */

if (
node.attributes.some(
(attribute) => attribute.type === 'Attribute' && attribute.name === 'autofocus'
)
) {
mark_subtree_dynamic(context.path);
}
const binding = context.state.scope.get(node.name);

@@ -80,0 +88,0 @@ if (

@@ -145,2 +145,6 @@ /** @import { Expression } from 'estree' */

if (attribute.name === 'autofocus') {
return false;
}
if (node.name === 'option' && attribute.name === 'value') {

@@ -147,0 +151,0 @@ return false;

@@ -0,1 +1,2 @@

import { UNINITIALIZED } from '../../../constants.js';
import { snapshot } from '../../shared/clone.js';

@@ -15,5 +16,22 @@ import { inspect_effect, validate_effect } from '../reactivity/effects.js';

inspect_effect(() => {
inspector(initial ? 'init' : 'update', ...snapshot(get_value(), true));
/** @type {any} */
var value = UNINITIALIZED;
// Capturing the value might result in an exception due to the inspect effect being
// sync and thus operating on stale data. In the case we encounter an exception we
// can bail-out of reporting the value. Instead we simply console.error the error
// so at least it's known that an error occured, but we don't stop execution
try {
value = get_value();
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
}
if (value !== UNINITIALIZED) {
inspector(initial ? 'init' : 'update', ...snapshot(value, true));
}
initial = false;
});
}
/** @import { Effect, Source, TemplateNode } from '#client' */
import { is_promise, noop } from '../../../shared/utils.js';
import { DEV } from 'esm-env';
import { is_promise } from '../../../shared/utils.js';
import { block, branch, pause_effect, resume_effect } from '../../reactivity/effects.js';
import { internal_set, mutable_source, source } from '../../reactivity/sources.js';
import {

@@ -7,12 +10,9 @@ component_context,

is_runes,
set_component_context,
set_active_effect,
set_active_reaction,
set_component_context,
set_dev_current_component_function
} from '../../runtime.js';
import { block, branch, pause_effect, resume_effect } from '../../reactivity/effects.js';
import { DEV } from 'esm-env';
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
import { queue_micro_task } from '../task.js';
import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';
import { mutable_source, set, source } from '../../reactivity/sources.js';

@@ -124,3 +124,5 @@ const PENDING = 0;

if (promise !== input) return;
set(input_source, value);
// we technically could use `set` here since it's on the next microtick
// but let's use internal_set for consistency and just to be safe
internal_set(input_source, value);
update(THEN, true);

@@ -130,3 +132,5 @@ },

if (promise !== input) return;
set(error_source, error);
// we technically could use `set` here since it's on the next microtick
// but let's use internal_set for consistency and just to be safe
internal_set(error_source, error);
update(CATCH, true);

@@ -148,3 +152,3 @@ }

} else {
set(input_source, input);
internal_set(input_source, input);
update(THEN, false);

@@ -151,0 +155,0 @@ }

/** @import { TemplateNode, Dom, Effect } from '#client' */
import { EFFECT_TRANSPARENT } from '../../constants.js';
import { block, branch, pause_effect } from '../../reactivity/effects.js';

@@ -37,3 +38,3 @@ import { hydrate_next, hydrate_node, hydrating } from '../hydration.js';

}
});
}, EFFECT_TRANSPARENT);

@@ -40,0 +41,0 @@ if (hydrating) {

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

/**
* Detected a migrated `$:` reactive block that both accesses and updates the same reactive value. This may cause recursive updates when converted to an `$effect`.
*/
export function legacy_recursive_reactive_block() {
if (DEV) {
console.warn(`%c[svelte] legacy_recursive_reactive_block\n%cDetected a migrated \`$:\` reactive block that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \`$effect\`.`, bold, normal);
} else {
// TODO print a link to the documentation
console.warn("legacy_recursive_reactive_block");
}
}
/**
* Tried to unmount a component that was not mounted

@@ -105,0 +117,0 @@ */

/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
import { DIRTY, MAYBE_DIRTY } from '../internal/client/constants.js';
import { user_pre_effect } from '../internal/client/reactivity/effects.js';
import { mutable_source, set } from '../internal/client/reactivity/sources.js';
import { hydrate, mount, unmount } from '../internal/client/render.js';
import { component_context, flush_sync, get } from '../internal/client/runtime.js';
import {
active_effect,
component_context,
flush_sync,
get,
set_signal_status
} from '../internal/client/runtime.js';
import { lifecycle_outside_component } from '../internal/shared/errors.js';
import { define_property, is_array } from '../internal/shared/utils.js';
import * as w from '../internal/client/warnings.js';

@@ -172,3 +180,11 @@ /**

export function run(fn) {
user_pre_effect(fn);
user_pre_effect(() => {
fn();
var effect = /** @type {import('#client').Effect} */ (active_effect);
// If the effect is immediately made dirty again, mark it as maybe dirty to emulate legacy behaviour
if ((effect.f & DIRTY) !== 0) {
w.legacy_recursive_reactive_block();
set_signal_status(effect, MAYBE_DIRTY);
}
});
}

@@ -175,0 +191,0 @@

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

*/
export const VERSION = '5.0.0-next.268';
export const VERSION = '5.0.0-next.269';
export const PUBLIC_VERSION = '5';

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

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