Comparing version 5.0.0-next.197 to 5.0.0-next.198
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.197", | ||
"version": "5.0.0-next.198", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -68,2 +68,3 @@ /** @import * as ESTree from 'estree' */ | ||
private_state: new Map(), | ||
getters: {}, | ||
in_constructor: false, | ||
@@ -587,2 +588,3 @@ | ||
private_state: new Map(), | ||
getters: {}, | ||
in_constructor: false | ||
@@ -589,0 +591,0 @@ }; |
@@ -87,4 +87,5 @@ import * as b from '../../../utils/builders.js'; | ||
if (binding.expression) { | ||
return typeof binding.expression === 'function' ? binding.expression(node) : binding.expression; | ||
if (Object.hasOwn(state.getters, node.name)) { | ||
const getter = state.getters[node.name]; | ||
return typeof getter === 'function' ? getter(node) : getter; | ||
} | ||
@@ -531,13 +532,16 @@ | ||
const expression = context.state.getters[reference]; | ||
if ( | ||
// If it's a destructured derived binding, then we can extract the derived signal reference and use that. | ||
binding.expression !== null && | ||
typeof binding.expression !== 'function' && | ||
binding.expression.type === 'MemberExpression' && | ||
binding.expression.object.type === 'CallExpression' && | ||
binding.expression.object.callee.type === 'Identifier' && | ||
binding.expression.object.callee.name === '$.get' && | ||
binding.expression.object.arguments[0].type === 'Identifier' | ||
// TODO this code is bad, we need to kill it | ||
expression != null && | ||
typeof expression !== 'function' && | ||
expression.type === 'MemberExpression' && | ||
expression.object.type === 'CallExpression' && | ||
expression.object.callee.type === 'Identifier' && | ||
expression.object.callee.name === '$.get' && | ||
expression.object.arguments[0].type === 'Identifier' | ||
) { | ||
push_unique(b.id(binding.expression.object.arguments[0].name)); | ||
push_unique(b.id(expression.object.arguments[0].name)); | ||
} else if ( | ||
@@ -544,0 +548,0 @@ // If we are referencing a simple $$props value, then we need to reference the object property instead |
import type { Scope } from '../scope.js'; | ||
import type { SvelteNode, ValidatedModuleCompileOptions } from '#compiler'; | ||
import type { Analysis } from '../types.js'; | ||
import type { Expression, Identifier } from 'estree'; | ||
@@ -10,2 +11,7 @@ export interface TransformState { | ||
readonly scopes: Map<SvelteNode, Scope>; | ||
/** | ||
* A map of `[name, node]` pairs, where `Identifier` nodes matching `name` | ||
* will be replaced with `node` (e.g. `x` -> `$.get(x)`) | ||
*/ | ||
readonly getters: Record<string, Expression | ((id: Identifier) => Expression)>; | ||
} |
@@ -18,3 +18,4 @@ /** | ||
valid_elements: ['audio', 'video'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
}, | ||
@@ -29,3 +30,4 @@ duration: { | ||
valid_elements: ['audio', 'video'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
}, | ||
@@ -46,11 +48,14 @@ buffered: { | ||
valid_elements: ['audio', 'video'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
}, | ||
muted: { | ||
valid_elements: ['audio', 'video'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
}, | ||
playbackRate: { | ||
valid_elements: ['audio', 'video'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
}, | ||
@@ -130,7 +135,9 @@ seeking: { | ||
valid_elements: ['svelte:window'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
}, | ||
scrollY: { | ||
valid_elements: ['svelte:window'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
}, | ||
@@ -187,6 +194,8 @@ online: { | ||
checked: { | ||
valid_elements: ['input'] | ||
valid_elements: ['input'], | ||
bidirectional: true | ||
}, | ||
group: { | ||
valid_elements: ['input'] | ||
valid_elements: ['input'], | ||
bidirectional: true | ||
}, | ||
@@ -198,9 +207,12 @@ // various | ||
innerText: { | ||
invalid_elements: ['svelte:window', 'svelte:document'] | ||
invalid_elements: ['svelte:window', 'svelte:document'], | ||
bidirectional: true | ||
}, | ||
innerHTML: { | ||
invalid_elements: ['svelte:window', 'svelte:document'] | ||
invalid_elements: ['svelte:window', 'svelte:document'], | ||
bidirectional: true | ||
}, | ||
textContent: { | ||
invalid_elements: ['svelte:window', 'svelte:document'] | ||
invalid_elements: ['svelte:window', 'svelte:document'], | ||
bidirectional: true | ||
}, | ||
@@ -213,8 +225,10 @@ open: { | ||
value: { | ||
valid_elements: ['input', 'textarea', 'select'] | ||
valid_elements: ['input', 'textarea', 'select'], | ||
bidirectional: true | ||
}, | ||
files: { | ||
valid_elements: ['input'], | ||
omit_in_ssr: true | ||
omit_in_ssr: true, | ||
bidirectional: true | ||
} | ||
}; |
@@ -118,3 +118,2 @@ import is_reference from 'is-reference'; | ||
prop_alias: null, | ||
expression: null, | ||
mutation: null, | ||
@@ -121,0 +120,0 @@ reassigned: false, |
@@ -132,2 +132,4 @@ import type { | ||
* Will be `true` by default in Svelte 6. | ||
* Note that setting this to `true` in your `svelte.config.js` will force runes mode for your entire project, including components in `node_modules`, | ||
* which is likely not what you want. If you're using Vite, consider using [dynamicCompileOptions](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions) instead. | ||
* @default undefined | ||
@@ -309,7 +311,2 @@ */ | ||
prop_alias: string | null; | ||
/** | ||
* If this is set, all references should use this expression instead of the identifier name. | ||
* If a function is given, it will be called with the identifier at that location and should return the new expression. | ||
*/ | ||
expression: Expression | ((id: Identifier) => Expression) | null; | ||
/** If this is set, all mutations should use this expression */ | ||
@@ -316,0 +313,0 @@ mutation: ((assignment: AssignmentExpression, context: Context<any, any>) => Expression) | null; |
// This should contain all the public interfaces (not all of them are actually importable, check current Svelte for which ones are). | ||
import type { Getters } from '#shared'; | ||
import './ambient.js'; | ||
@@ -5,0 +4,0 @@ |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.197'; | ||
export const VERSION = '5.0.0-next.198'; | ||
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 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
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
2162278
47592