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.117 to 5.0.0-next.118

2

package.json

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

"license": "MIT",
"version": "5.0.0-next.117",
"version": "5.0.0-next.118",
"type": "module",

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

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

/**
* {@const ...} must be an assignment
* {@const ...} must consist of a single variable declaration
* @param {null | number | NodeLike} node

@@ -738,3 +738,3 @@ * @returns {never}

export function const_tag_invalid_expression(node) {
e(node, "const_tag_invalid_expression", "{@const ...} must be an assignment");
e(node, "const_tag_invalid_expression", "{@const ...} must consist of a single variable declaration");
}

@@ -741,0 +741,0 @@

@@ -554,3 +554,11 @@ import read_pattern from '../read/context.js';

const expression_start = parser.index;
const init = read_expression(parser);
if (
init.type === 'SequenceExpression' &&
!parser.template.substring(expression_start, init.start).includes('(')
) {
// const a = (b, c) is allowed but a = b, c = d is not;
e.const_tag_invalid_expression(init);
}
parser.allow_whitespace();

@@ -557,0 +565,0 @@

@@ -452,3 +452,3 @@ import is_reference from 'is-reference';

} else {
instance.scope.declare(b.id('$$props'), 'bindable_prop', 'synthetic');
instance.scope.declare(b.id('$$props'), 'rest_prop', 'synthetic');
instance.scope.declare(b.id('$$restProps'), 'rest_prop', 'synthetic');

@@ -455,0 +455,0 @@

@@ -421,3 +421,3 @@ import { walk } from 'zimmerframe';

b.call(
'$.rest_props',
'$.legacy_rest_props',
b.id('$$sanitized_props'),

@@ -435,4 +435,8 @@ b.array(named_props.map((name) => b.literal(name)))

}
component_block.body.unshift(
b.const('$$sanitized_props', b.call('$.rest_props', b.id('$$props'), b.array(to_remove)))
b.const(
'$$sanitized_props',
b.call('$.legacy_rest_props', b.id('$$props'), b.array(to_remove))
)
);

@@ -439,0 +443,0 @@ }

@@ -77,2 +77,7 @@ import * as b from '../../../utils/builders.js';

if (binding.node.name === '$$props') {
// Special case for $$props which only exists in the old world
return b.id('$$sanitized_props');
}
if (binding.kind === 'store_sub') {

@@ -87,8 +92,2 @@ return b.call(node);

if (binding.kind === 'prop' || binding.kind === 'bindable_prop') {
if (binding.node.name === '$$props') {
// Special case for $$props which only exists in the old world
// TODO this probably shouldn't have a 'prop' binding kind
return node;
}
if (

@@ -95,0 +94,0 @@ state.analysis.accessors ||

@@ -91,2 +91,3 @@ export { hmr } from './dev/hmr.js';

rest_props,
legacy_rest_props,
spread_props,

@@ -93,0 +94,0 @@ update_pre_prop,

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

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

@@ -83,6 +83,66 @@ import { inspect_fn } from '../dev/inspect.js';

export function rest_props(props, exclude, name) {
return new Proxy(DEV ? { props, exclude, name } : { props, exclude }, rest_props_handler);
return new Proxy(
DEV ? { props, exclude, name, other: {}, to_proxy: [] } : { props, exclude },
rest_props_handler
);
}
/**
* The proxy handler for legacy $$restProps and $$props
* @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: import('./types.js').Source<number> }>}}
*/
const legacy_rest_props_handler = {
get(target, key) {
if (target.exclude.includes(key)) return;
get(target.version);
return key in target.special ? target.special[key]() : target.props[key];
},
set(target, key, value) {
if (!(key in target.special)) {
// Handle props that can temporarily get out of sync with the parent
/** @type {Record<string, (v?: unknown) => unknown>} */
target.special[key] = prop(
{
get [key]() {
return target.props[key];
}
},
/** @type {string} */ (key),
PROPS_IS_UPDATED
);
}
target.special[key](value);
update(target.version); // $$props is coarse-grained: when $$props.x is updated, usages of $$props.y etc are also rerun
return true;
},
getOwnPropertyDescriptor(target, key) {
if (target.exclude.includes(key)) return;
if (key in target.props) {
return {
enumerable: true,
configurable: true,
value: target.props[key]
};
}
},
has(target, key) {
if (target.exclude.includes(key)) return false;
return key in target.props;
},
ownKeys(target) {
return Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));
}
};
/**
* @param {Record<string, unknown>} props
* @param {string[]} exclude
* @returns {Record<string, unknown>}
*/
export function legacy_rest_props(props, exclude) {
return new Proxy({ props, exclude, special: {}, version: source(0) }, legacy_rest_props_handler);
}
/**
* The proxy handler for spread props. Handles the incoming array of props

@@ -89,0 +149,0 @@ * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps

@@ -54,4 +54,7 @@ import { DEV } from 'esm-env';

get(this.#version);
// We don't populate the underlying Set, so we need to create a clone using
// our internal values and then pass that to the method.
var clone = new Set(this.values());
// @ts-ignore
return set_proto[method].apply(this, v);
return set_proto[method].apply(clone, v);
};

@@ -64,5 +67,7 @@ }

get(this.#version);
// We don't populate the underlying Set, so we need to create a clone using
// our internal values and then pass that to the method.
var clone = new Set(this.values());
// @ts-ignore
var set = /** @type {Set<T>} */ (set_proto[method].apply(this, v));
var set = /** @type {Set<T>} */ (set_proto[method].apply(clone, v));
return new ReactiveSet(set);

@@ -69,0 +74,0 @@ };

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

*/
export const VERSION = '5.0.0-next.117';
export const VERSION = '5.0.0-next.118';
export const PUBLIC_VERSION = '5';

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

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