Comparing version 5.0.0-next.232 to 5.0.0-next.233
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.232", | ||
"version": "5.0.0-next.233", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -351,10 +351,3 @@ /** @import { BlockStatement, Expression, ExpressionStatement, Identifier, MemberExpression, Property, Statement } from 'estree' */ | ||
[b.id('$$anchor'), b.id(component_name)], | ||
b.block([ | ||
...binding_initializers, | ||
b.stmt( | ||
dev | ||
? b.call('$.validate_dynamic_component', b.thunk(prev(b.id('$$anchor')))) | ||
: prev(b.id('$$anchor')) | ||
) | ||
]) | ||
b.block([...binding_initializers, b.stmt(prev(b.id('$$anchor')))]) | ||
) | ||
@@ -361,0 +354,0 @@ ); |
@@ -26,3 +26,3 @@ /** @import { Identifier } from 'estree' */ | ||
context.state.transform[name] = { | ||
read: get_value, | ||
read: binding.declaration_kind === 'var' ? (node) => b.call('$.safe_get', node) : get_value, | ||
assign: (node, value) => { | ||
@@ -29,0 +29,0 @@ let call = b.call('$.set', node, value); |
@@ -287,3 +287,3 @@ /** @import { CallExpression, Expression, Identifier, Literal, VariableDeclaration, VariableDeclarator } from 'estree' */ | ||
/** | ||
* Creates the output for a state declaration. | ||
* Creates the output for a state declaration in legacy mode. | ||
* @param {VariableDeclarator} declarator | ||
@@ -290,0 +290,0 @@ * @param {Scope} scope |
@@ -464,4 +464,16 @@ /** @import { ClassDeclaration, Expression, FunctionDeclaration, Identifier, ImportDeclaration, MemberExpression, Node, Pattern, VariableDeclarator } from 'estree' */ | ||
ForOfStatement: create_block_scope, | ||
BlockStatement: create_block_scope, | ||
SwitchStatement: create_block_scope, | ||
BlockStatement(node, context) { | ||
const parent = context.path.at(-1); | ||
if ( | ||
parent?.type === 'FunctionDeclaration' || | ||
parent?.type === 'FunctionExpression' || | ||
parent?.type === 'ArrowFunctionExpression' | ||
) { | ||
// We already created a new scope for the function | ||
context.next(); | ||
} else { | ||
create_block_scope(node, context); | ||
} | ||
}, | ||
@@ -468,0 +480,0 @@ ClassDeclaration(node, { state, next }) { |
@@ -130,2 +130,3 @@ export { FILENAME, HMR } from '../../constants.js'; | ||
get, | ||
safe_get, | ||
invalidate_inner_signals, | ||
@@ -147,8 +148,3 @@ flush_sync, | ||
} from './runtime.js'; | ||
export { | ||
validate_binding, | ||
validate_dynamic_component, | ||
validate_each_keys, | ||
validate_prop_bindings | ||
} from './validate.js'; | ||
export { validate_binding, validate_each_keys, validate_prop_bindings } from './validate.js'; | ||
export { raf } from './timing.js'; | ||
@@ -155,0 +151,0 @@ export { proxy } from './proxy.js'; |
@@ -738,2 +738,12 @@ /** @import { ComponentContext, Derived, Effect, Reaction, Signal, Source, Value } from '#client' */ | ||
/** | ||
* Like `get`, but checks for `undefined`. Used for `var` declarations because they can be accessed before being declared | ||
* @template V | ||
* @param {Value<V> | undefined} signal | ||
* @returns {V | undefined} | ||
*/ | ||
export function safe_get(signal) { | ||
return signal && get(signal); | ||
} | ||
/** | ||
* Invokes a function and captures all signals that are read during the invocation, | ||
@@ -740,0 +750,0 @@ * then invalidates them. |
@@ -18,27 +18,2 @@ import { dev_current_component_function, untrack } from './runtime.js'; | ||
/** | ||
* @template Component | ||
* @param {() => Component} component_fn | ||
* @returns {Component} | ||
*/ | ||
export function validate_dynamic_component(component_fn) { | ||
try { | ||
const instance = component_fn(); | ||
if (instance !== undefined && typeof instance !== 'object') { | ||
e.svelte_component_invalid_this_value(); | ||
} | ||
return instance; | ||
} catch (err) { | ||
const { message } = /** @type {Error} */ (err); | ||
if (typeof message === 'string' && message.indexOf('is not a function') !== -1) { | ||
e.svelte_component_invalid_this_value(); | ||
} | ||
throw err; | ||
} | ||
} | ||
/** | ||
* @param {() => any} collection | ||
@@ -45,0 +20,0 @@ * @param {(item: any, index: number) => string} key_fn |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.232'; | ||
export const VERSION = '5.0.0-next.233'; | ||
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2208456
48918