Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte

Package Overview
Dependencies
Maintainers
0
Versions
777
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.169 to 5.0.0-next.170

4

package.json

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

"license": "MIT",
"version": "5.0.0-next.169",
"version": "5.0.0-next.170",
"type": "module",

@@ -114,3 +114,3 @@ "types": "./types/index.d.ts",

"@types/aria-query": "^5.0.4",
"dts-buddy": "^0.5.0",
"dts-buddy": "^0.5.1",
"esbuild": "^0.19.11",

@@ -117,0 +117,0 @@ "rollup": "^4.9.5",

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

/** @import { FlipParams, AnimationConfig } from './public.js' */
import { cubicOut } from '../easing/index.js';

@@ -10,4 +11,4 @@

* @param {{ from: DOMRect; to: DOMRect }} fromTo
* @param {import('./public.js').FlipParams} params
* @returns {import('./public.js').AnimationConfig}
* @param {FlipParams} params
* @returns {AnimationConfig}
*/

@@ -14,0 +15,0 @@ export function flip(node, { from, to }, params = {}) {

/* This file is generated by scripts/process-messages/index.js. Do not edit! */
/** @import { Location } from 'locate-character' */
import * as state from './state.js';
/** @typedef {{ start?: number, end?: number }} NodeLike */
// interface is duplicated between here (used internally) and ./interfaces.js
// (exposed publicly), and I'm not sure how to avoid that
export class CompileError extends Error {
export class InternalCompileError extends Error {
name = 'CompileError';
filename = state.filename;
/** @type {import('#compiler').CompileError['position']} */
/** @type {[number, number] | undefined} */
position = undefined;
/** @type {import('#compiler').CompileError['start']} */
/** @type {Location | undefined} */
start = undefined;
/** @type {import('#compiler').CompileError['end']} */
/** @type {Location | undefined} */
end = undefined;

@@ -62,3 +61,3 @@

throw new CompileError(code, message, start !== undefined && end !== undefined ? [start, end] : undefined);
throw new InternalCompileError(code, message, start !== undefined && end !== undefined ? [start, end] : undefined);
}

@@ -65,0 +64,0 @@

@@ -0,1 +1,3 @@

/** @import { LegacyRoot } from './types/legacy-nodes.js' */
/** @import { CompileOptions, CompileResult, ValidatedCompileOptions, ModuleCompileOptions, Root } from '#compiler' */
import { walk as zimmerframe_walk } from 'zimmerframe';

@@ -17,4 +19,4 @@ import { convert } from './legacy.js';

* @param {string} source The component source code
* @param {import('#compiler').CompileOptions} options The compiler options
* @returns {import('#compiler').CompileResult}
* @param {CompileOptions} options The compiler options
* @returns {CompileResult}
*/

@@ -29,3 +31,3 @@ export function compile(source, options) {

/** @type {import('#compiler').ValidatedCompileOptions} */
/** @type {ValidatedCompileOptions} */
const combined_options = {

@@ -57,4 +59,4 @@ ...validated,

* @param {string} source The component source code
* @param {import('#compiler').ModuleCompileOptions} options
* @returns {import('#compiler').CompileResult}
* @param {ModuleCompileOptions} options
* @returns {CompileResult}
*/

@@ -79,3 +81,3 @@ export function compileModule(source, options) {

* @param {{ filename?: string; modern: true }} options
* @returns {import('#compiler').Root}
* @returns {Root}
*/

@@ -93,3 +95,3 @@

* @param {{ filename?: string; modern?: false }} [options]
* @returns {import('./types/legacy-nodes.js').LegacyRoot}
* @returns {LegacyRoot}
*/

@@ -106,3 +108,3 @@

* @param {{ filename?: string; rootDir?: string; modern?: boolean }} [options]
* @returns {import('#compiler').Root | import('./types/legacy-nodes.js').LegacyRoot}
* @returns {Root | LegacyRoot}
*/

@@ -118,3 +120,3 @@ export function parse(source, { filename, rootDir, modern } = {}) {

* @param {string} source
* @param {import('#compiler').Root} ast
* @param {Root} ast
* @param {boolean | undefined} modern

@@ -149,4 +151,3 @@ */

export { CompileError } from './errors.js';
export { VERSION } from '../version.js';
export { migrate } from './migrate/index.js';

@@ -0,1 +1,7 @@

/** @import { VariableDeclarator, Node, Identifier } from 'estree' */
/** @import { SvelteNode } from '../types/template.js' */
/** @import { Visitors } from 'zimmerframe' */
/** @import { ComponentAnalysis } from '../phases/types.js' */
/** @import { Scope } from '../phases/scope.js' */
/** @import * as Compiler from '#compiler' */
import MagicString from 'magic-string';

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

/** @type {import('#compiler').ValidatedCompileOptions} */
/** @type {Compiler.ValidatedCompileOptions} */
const combined_options = {

@@ -164,5 +170,5 @@ ...validate_component_options({}, ''),

* @typedef {{
* scope: import('../phases/scope.js').Scope;
* scope: Scope;
* str: MagicString;
* analysis: import('../phases/types.js').ComponentAnalysis;
* analysis: ComponentAnalysis;
* indent: string;

@@ -180,3 +186,3 @@ * props: Array<{ local: string; exported: string; init: string; bindable: boolean; slot_name?: string; optional: boolean; type: string; comment?: string }>;

/** @type {import('zimmerframe').Visitors<import('../types/template.js').SvelteNode, State>} */
/** @type {Visitors<SvelteNode, State>} */
const instance_script = {

@@ -287,5 +293,3 @@ _(node, { state, next }) {

const binding = /** @type {import('#compiler').Binding} */ (
state.scope.get(declarator.id.name)
);
const binding = /** @type {Compiler.Binding} */ (state.scope.get(declarator.id.name));

@@ -436,3 +440,3 @@ if (

/** @type {import('zimmerframe').Visitors<import('../types/template.js').SvelteNode, State>} */
/** @type {Visitors<SvelteNode, State>} */
const template = {

@@ -551,5 +555,5 @@ Identifier(node, { state, path }) {

/**
* @param {import('estree').VariableDeclarator} declarator
* @param {VariableDeclarator} declarator
* @param {MagicString} str
* @param {import('#compiler').SvelteNode[]} path
* @param {Compiler.SvelteNode[]} path
*/

@@ -560,3 +564,3 @@ function extract_type_and_comment(declarator, str, path) {

// Try to find jsdoc above the declaration
let comment_node = /** @type {import('estree').Node} */ (parent)?.leadingComments?.at(-1);
let comment_node = /** @type {Node} */ (parent)?.leadingComments?.at(-1);
if (comment_node?.type !== 'Block') comment_node = undefined;

@@ -600,7 +604,7 @@

/**
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement | import('#compiler').SvelteWindow | import('#compiler').SvelteDocument | import('#compiler').SvelteBody} element
* @param {Compiler.RegularElement | Compiler.SvelteElement | Compiler.SvelteWindow | Compiler.SvelteDocument | Compiler.SvelteBody} element
* @param {State} state
*/
function handle_events(element, state) {
/** @type {Map<string, import('#compiler').OnDirective[]>} */
/** @type {Map<string, Compiler.OnDirective[]>} */
const handlers = new Map();

@@ -816,3 +820,3 @@ for (const attribute of element.attributes) {

/**
* @param {import('#compiler').OnDirective} last
* @param {Compiler.OnDirective} last
* @param {State} state

@@ -833,3 +837,3 @@ */

/**
* @param {import('estree').Identifier} node
* @param {Identifier} node
* @param {State} state

@@ -836,0 +840,0 @@ * @param {any[]} path

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

/** @import { TemplateNode, Fragment, Root, SvelteOptionsRaw } from '#compiler' */
// @ts-expect-error acorn type definitions are borked in the release we use

@@ -29,9 +30,9 @@ import { isIdentifierStart, isIdentifierChar } from 'acorn';

/** @type {import('#compiler').TemplateNode[]} */
/** @type {TemplateNode[]} */
stack = [];
/** @type {import('#compiler').Fragment[]} */
/** @type {Fragment[]} */
fragments = [];
/** @type {import('#compiler').Root} */
/** @type {Root} */
root;

@@ -124,5 +125,3 @@

if (options_index !== -1) {
const options = /** @type {import('#compiler').SvelteOptionsRaw} */ (
this.root.fragment.nodes[options_index]
);
const options = /** @type {SvelteOptionsRaw} */ (this.root.fragment.nodes[options_index]);
this.root.fragment.nodes.splice(options_index, 1);

@@ -294,3 +293,3 @@ this.root.options = read_options(options);

* @param {string} template
* @returns {import('#compiler').Root}
* @returns {Root}
*/

@@ -297,0 +296,0 @@ export function parse(template) {

@@ -0,1 +1,4 @@

/** @import { Location } from 'locate-character' */
/** @import { Pattern } from 'estree' */
/** @import { Parser } from '../index.js' */
// @ts-expect-error acorn type definitions are borked in the release we use

@@ -16,4 +19,4 @@ import { isIdentifierStart } from 'acorn';

/**
* @param {import('../index.js').Parser} parser
* @returns {import('estree').Pattern}
* @param {Parser} parser
* @returns {Pattern}
*/

@@ -34,4 +37,4 @@ export default function read_pattern(parser) {

loc: {
start: /** @type {import('locate-character').Location} */ (locator(start)),
end: /** @type {import('locate-character').Location} */ (locator(parser.index))
start: /** @type {Location} */ (locator(start)),
end: /** @type {Location} */ (locator(parser.index))
},

@@ -100,3 +103,3 @@ end: parser.index,

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @returns {any}

@@ -103,0 +106,0 @@ */

@@ -0,1 +1,3 @@

/** @import { ObjectExpression } from 'estree' */
/** @import { SvelteOptionsRaw, Root, SvelteOptions } from '#compiler' */
import { namespace_mathml, namespace_svg } from '../../../../constants.js';

@@ -7,7 +9,7 @@ import * as e from '../../../errors.js';

/**
* @param {import('#compiler').SvelteOptionsRaw} node
* @returns {import('#compiler').Root['options']}
* @param {SvelteOptionsRaw} node
* @returns {Root['options']}
*/
export default function read_options(node) {
/** @type {import('#compiler').SvelteOptions} */
/** @type {SvelteOptions} */
const component_options = {

@@ -41,3 +43,3 @@ start: node.start,

case 'customElement': {
/** @type {import('#compiler').SvelteOptions['customElement']} */
/** @type {SvelteOptions['customElement']} */
const ce = { tag: '' };

@@ -91,4 +93,3 @@

ce.props = {};
for (const property of /** @type {import('estree').ObjectExpression} */ (props)
.properties) {
for (const property of /** @type {ObjectExpression} */ (props).properties) {
if (

@@ -95,0 +96,0 @@ property.type !== 'Property' ||

@@ -0,1 +1,4 @@

/** @import { Program } from 'estree' */
/** @import { Attribute, SpreadAttribute, Directive, Script } from '#compiler' */
/** @import { Parser } from '../index.js' */
import * as acorn from '../acorn.js';

@@ -32,6 +35,6 @@ import { regex_not_newline_characters } from '../../patterns.js';

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @param {number} start
* @param {Array<import('#compiler').Attribute | import('#compiler').SpreadAttribute | import('#compiler').Directive>} attributes
* @returns {import('#compiler').Script}
* @param {Array<Attribute | SpreadAttribute | Directive>} attributes
* @returns {Script}
*/

@@ -49,3 +52,3 @@ export function read_script(parser, start, attributes) {

/** @type {import('estree').Program} */
/** @type {Program} */
let ast;

@@ -52,0 +55,0 @@

@@ -0,1 +1,3 @@

/** @import { Attribute, SpreadAttribute, Directive, Css } from '#compiler' */
/** @import { Parser } from '../index.js' */
import * as e from '../../../errors.js';

@@ -17,6 +19,6 @@

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @param {number} start
* @param {Array<import('#compiler').Attribute | import('#compiler').SpreadAttribute | import('#compiler').Directive>} attributes
* @returns {import('#compiler').Css.StyleSheet}
* @param {Array<Attribute | SpreadAttribute | Directive>} attributes
* @returns {Css.StyleSheet}
*/

@@ -46,3 +48,3 @@ export default function read_style(parser, start, attributes) {

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @param {string} close

@@ -52,3 +54,3 @@ * @returns {any[]}

function read_body(parser, close) {
/** @type {Array<import('#compiler').Css.Rule | import('#compiler').Css.Atrule>} */
/** @type {Array<Css.Rule | Css.Atrule>} */
const children = [];

@@ -74,4 +76,4 @@

/**
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Css.Atrule}
* @param {Parser} parser
* @returns {Css.Atrule}
*/

@@ -86,3 +88,3 @@ function read_at_rule(parser) {

/** @type {import('#compiler').Css.Block | null} */
/** @type {Css.Block | null} */
let block = null;

@@ -109,4 +111,4 @@

/**
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Css.Rule}
* @param {Parser} parser
* @returns {Css.Rule}
*/

@@ -131,8 +133,8 @@ function read_rule(parser) {

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @param {boolean} [inside_pseudo_class]
* @returns {import('#compiler').Css.SelectorList}
* @returns {Css.SelectorList}
*/
function read_selector_list(parser, inside_pseudo_class = false) {
/** @type {import('#compiler').Css.ComplexSelector[]} */
/** @type {Css.ComplexSelector[]} */
const children = [];

@@ -168,5 +170,5 @@

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @param {boolean} [inside_pseudo_class]
* @returns {import('#compiler').Css.ComplexSelector}
* @returns {Css.ComplexSelector}
*/

@@ -176,9 +178,9 @@ function read_selector(parser, inside_pseudo_class = false) {

/** @type {import('#compiler').Css.RelativeSelector[]} */
/** @type {Css.RelativeSelector[]} */
const children = [];
/**
* @param {import('#compiler').Css.Combinator | null} combinator
* @param {Css.Combinator | null} combinator
* @param {number} start
* @returns {import('#compiler').Css.RelativeSelector}
* @returns {Css.RelativeSelector}
*/

@@ -200,3 +202,3 @@ function create_selector(combinator, start) {

/** @type {import('#compiler').Css.RelativeSelector} */
/** @type {Css.RelativeSelector} */
let relative_selector = create_selector(null, parser.index);

@@ -258,3 +260,3 @@

/** @type {null | import('#compiler').Css.SelectorList} */
/** @type {null | Css.SelectorList} */
let args = null;

@@ -387,4 +389,4 @@

/**
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Css.Combinator | null}
* @param {Parser} parser
* @returns {Css.Combinator | null}
*/

@@ -423,4 +425,4 @@ function read_combinator(parser) {

/**
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Css.Block}
* @param {Parser} parser
* @returns {Css.Block}
*/

@@ -432,3 +434,3 @@ function read_block(parser) {

/** @type {Array<import('#compiler').Css.Declaration | import('#compiler').Css.Rule | import('#compiler').Css.Atrule>} */
/** @type {Array<Css.Declaration | Css.Rule | Css.Atrule>} */
const children = [];

@@ -459,4 +461,4 @@

*
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Css.Declaration | import('#compiler').Css.Rule | import('#compiler').Css.Atrule}
* @param {Parser} parser
* @returns {Css.Declaration | Css.Rule | Css.Atrule}
*/

@@ -479,4 +481,4 @@ function read_block_item(parser) {

/**
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Css.Declaration}
* @param {Parser} parser
* @returns {Css.Declaration}
*/

@@ -514,3 +516,3 @@ function read_declaration(parser) {

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @returns {string}

@@ -557,3 +559,3 @@ */

* `foo` or `'foo bar'` or `"foo bar"`
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
*/

@@ -590,3 +592,3 @@ function read_attribute_value(parser) {

* https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
*/

@@ -630,3 +632,3 @@ function read_identifier(parser) {

/** @param {import('../index.js').Parser} parser */
/** @param {Parser} parser */
function allow_comment_or_whitespace(parser) {

@@ -633,0 +635,0 @@ parser.allow_whitespace();

@@ -0,1 +1,3 @@

/** @import { Context, Visitors } from 'zimmerframe' */
/** @import { FunctionExpression, FunctionDeclaration } from 'estree' */
import { walk } from 'zimmerframe';

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

/**
* @param {import('estree').FunctionExpression | import('estree').FunctionDeclaration} node
* @param {import('zimmerframe').Context<any, any>} context
* @param {FunctionExpression | FunctionDeclaration} node
* @param {Context<any, any>} context
*/

@@ -16,3 +18,3 @@ function remove_this_param(node, context) {

/** @type {import('zimmerframe').Visitors<any, null>} */
/** @type {Visitors<any, null>} */
const visitors = {

@@ -19,0 +21,0 @@ ImportDeclaration(node) {

@@ -0,1 +1,3 @@

/** @import { Parser } from '../index.js' */
/** @import * as Compiler from '#compiler' */
import { is_void } from '../utils/names.js';

@@ -17,3 +19,3 @@ import read_expression from '../read/expression.js';

/** @type {Map<string, import('#compiler').ElementLike['type']>} */
/** @type {Map<string, Compiler.ElementLike['type']>} */
const root_only_meta_tags = new Map([

@@ -27,3 +29,3 @@ ['svelte:head', 'SvelteHead'],

/** @type {Map<string, import('#compiler').ElementLike['type']>} */
/** @type {Map<string, Compiler.ElementLike['type']>} */
const meta_tags = new Map([

@@ -44,3 +46,3 @@ ...root_only_meta_tags,

/** @param {import('#compiler').TemplateNode[]} stack */
/** @param {Compiler.TemplateNode[]} stack */
function parent_is_head(stack) {

@@ -56,3 +58,3 @@ let i = stack.length;

/** @param {import('#compiler').TemplateNode[]} stack */
/** @param {Compiler.TemplateNode[]} stack */
function parent_is_shadowroot_template(stack) {

@@ -64,3 +66,3 @@ // https://developer.chrome.com/docs/css-ui/declarative-shadow-dom#building_a_declarative_shadow_root

stack[i].type === 'RegularElement' &&
/** @type {import('#compiler').RegularElement} */ (stack[i]).attributes.some(
/** @type {Compiler.RegularElement} */ (stack[i]).attributes.some(
(a) => a.type === 'Attribute' && a.name === 'shadowrootmode'

@@ -79,3 +81,3 @@ )

/** @param {import('../index.js').Parser} parser */
/** @param {Parser} parser */
export default function element(parser) {

@@ -90,3 +92,3 @@ const start = parser.index++;

/** @type {ReturnType<typeof parser.append<import('#compiler').Comment>>} */
/** @type {ReturnType<typeof parser.append<Compiler.Comment>>} */
parser.append({

@@ -110,6 +112,6 @@ type: 'Comment',

['svelte:options', 'svelte:window', 'svelte:body', 'svelte:document'].includes(name) &&
/** @type {import('#compiler').ElementLike} */ (parent).fragment.nodes.length
/** @type {Compiler.ElementLike} */ (parent).fragment.nodes.length
) {
e.svelte_meta_invalid_content(
/** @type {import('#compiler').ElementLike} */ (parent).fragment.nodes[0].start,
/** @type {Compiler.ElementLike} */ (parent).fragment.nodes[0].start,
name

@@ -142,3 +144,3 @@ );

/** @type {import('#compiler').ElementLike} */
/** @type {Compiler.ElementLike} */
const element =

@@ -161,3 +163,3 @@ type === 'RegularElement'

}
: /** @type {import('#compiler').ElementLike} */ ({
: /** @type {Compiler.ElementLike} */ ({
type,

@@ -185,3 +187,3 @@ start,

// close any elements that don't have their own closing tags, e.g. <div><p></div>
while (/** @type {import('#compiler').RegularElement} */ (parent).name !== name) {
while (/** @type {Compiler.RegularElement} */ (parent).name !== name) {
if (parent.type !== 'RegularElement') {

@@ -252,5 +254,3 @@ if (parser.last_auto_closed_tag && parser.last_auto_closed_tag.tag === name) {

const definition = /** @type {import('#compiler').Attribute} */ (
element.attributes.splice(index, 1)[0]
);
const definition = /** @type {Compiler.Attribute} */ (element.attributes.splice(index, 1)[0]);
if (

@@ -276,5 +276,3 @@ definition.value === true ||

const definition = /** @type {import('#compiler').Attribute} */ (
element.attributes.splice(index, 1)[0]
);
const definition = /** @type {Compiler.Attribute} */ (element.attributes.splice(index, 1)[0]);

@@ -312,3 +310,3 @@ if (definition.value === true) {

/** @type {import('#compiler').Comment | null} */
/** @type {Compiler.Comment | null} */
let prev_comment = null;

@@ -380,3 +378,3 @@ for (let i = current.fragment.nodes.length - 1; i >= 0; i--) {

/** @type {import('#compiler').Text} */
/** @type {Compiler.Text} */
const node = {

@@ -402,3 +400,3 @@ start,

/** @param {import('../index.js').Parser} parser */
/** @param {Parser} parser */
function read_tag_name(parser) {

@@ -460,4 +458,4 @@ const start = parser.index;

/**
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Attribute | null}
* @param {Parser} parser
* @returns {Compiler.Attribute | null}
*/

@@ -470,3 +468,3 @@ function read_static_attribute(parser) {

/** @type {true | Array<import('#compiler').Text | import('#compiler').ExpressionTag>} */
/** @type {true | Array<Compiler.Text | Compiler.ExpressionTag>} */
let value = true;

@@ -508,4 +506,4 @@

/**
* @param {import('../index.js').Parser} parser
* @returns {import('#compiler').Attribute | import('#compiler').SpreadAttribute | import('#compiler').Directive | null}
* @param {Parser} parser
* @returns {Compiler.Attribute | Compiler.SpreadAttribute | Compiler.Directive | null}
*/

@@ -524,3 +522,3 @@ function read_attribute(parser) {

/** @type {import('#compiler').SpreadAttribute} */
/** @type {Compiler.SpreadAttribute} */
const spread = {

@@ -550,3 +548,3 @@ type: 'SpreadAttribute',

/** @type {import('#compiler').ExpressionTag} */
/** @type {Compiler.ExpressionTag} */
const expression = {

@@ -583,3 +581,3 @@ type: 'ExpressionTag',

/** @type {true | Array<import('#compiler').Text | import('#compiler').ExpressionTag>} */
/** @type {true | Array<Compiler.Text | Compiler.ExpressionTag>} */
let value = true;

@@ -629,3 +627,3 @@ if (parser.eat('=')) {

/** @type {import('#compiler').Directive} */
/** @type {Compiler.Directive} */
// @ts-expect-error TODO can't figure out this error

@@ -689,3 +687,3 @@ const directive = {

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
*/

@@ -741,3 +739,3 @@ function read_attribute_value(parser) {

/**
* @param {import('../index.js').Parser} parser
* @param {Parser} parser
* @param {() => boolean} done

@@ -748,3 +746,3 @@ * @param {string} location

function read_sequence(parser, done, location) {
/** @type {import('#compiler').Text} */
/** @type {Compiler.Text} */
let current_chunk = {

@@ -759,3 +757,3 @@ start: parser.index,

/** @type {Array<import('#compiler').Text | import('#compiler').ExpressionTag>} */
/** @type {Array<Compiler.Text | Compiler.ExpressionTag>} */
const chunks = [];

@@ -798,3 +796,3 @@

/** @type {import('#compiler').ExpressionTag} */
/** @type {Compiler.ExpressionTag} */
const chunk = {

@@ -801,0 +799,0 @@ type: 'ExpressionTag',

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

/** @import { Parser } from '../index.js' */
import element from './element.js';

@@ -5,3 +6,3 @@ import tag from './tag.js';

/** @param {import('../index.js').Parser} parser */
/** @param {Parser} parser */
export default function fragment(parser) {

@@ -8,0 +9,0 @@ if (parser.match('<')) {

@@ -0,4 +1,6 @@

/** @import { Text } from '#compiler' */
/** @import { Parser } from '../index.js' */
import { decode_character_references } from '../utils/html.js';
/** @param {import('../index.js').Parser} parser */
/** @param {Parser} parser */
export default function text(parser) {

@@ -13,3 +15,3 @@ const start = parser.index;

/** @type {ReturnType<typeof parser.append<import('#compiler').Text>>} */
/** @type {ReturnType<typeof parser.append<Text>>} */
parser.append({

@@ -16,0 +18,0 @@ type: 'Text',

@@ -0,4 +1,5 @@

/** @import { Fragment } from '#compiler' */
/**
* @param {any} transparent
* @returns {import('#compiler').Fragment}
* @returns {Fragment}
*/

@@ -5,0 +6,0 @@ export function create_fragment(transparent = false) {

@@ -0,1 +1,5 @@

/** @import { Visitors } from 'zimmerframe' */
/** @import { AnalysisState } from './types.js' */
/** @import { Attribute, SvelteNode, TemplateNode, RegularElement, SvelteElement } from '#compiler' */
/** @import { ARIARoleDefinitionKey, ARIARoleRelationConcept, ARIAProperty, ARIAPropertyDefinition, ARIARoleDefinition } from 'aria-query' */
import { roles as roles_map, aria, elementRoles } from 'aria-query';

@@ -46,3 +50,3 @@ // @ts-expect-error package doesn't provide typings

/**
* @param {import('aria-query').ARIARoleDefinitionKey} role
* @param {ARIARoleDefinitionKey} role
*/

@@ -54,3 +58,3 @@ function is_non_interactive_roles(role) {

/**
* @param {import('aria-query').ARIARoleDefinitionKey} role
* @param {ARIARoleDefinitionKey} role
*/

@@ -62,3 +66,3 @@ function is_interactive_roles(role) {

/**
* @param {import('aria-query').ARIARoleDefinitionKey} role
* @param {ARIARoleDefinitionKey} role
*/

@@ -72,3 +76,3 @@ function is_abstract_role(role) {

/**
* @param {import('aria-query').ARIARoleDefinitionKey} role
* @param {ARIARoleDefinitionKey} role
*/

@@ -81,3 +85,3 @@ function is_presentation_role(role) {

* @param {string} tag_name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
*/

@@ -100,3 +104,3 @@ function is_hidden_from_screen_reader(tag_name, attribute_map) {

/**
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
*/

@@ -120,3 +124,3 @@ function has_disabled_attribute(attribute_map) {

/**
* @type {import('aria-query').ARIARoleRelationConcept[]}
* @type {ARIARoleRelationConcept[]}
*/

@@ -131,3 +135,3 @@ const non_interactive_element_role_schemas = [];

/**
* @type {import('aria-query').ARIARoleRelationConcept[]}
* @type {ARIARoleRelationConcept[]}
*/

@@ -148,3 +152,3 @@ const interactive_element_role_schemas = [];

/**
* @type {import('aria-query').ARIARoleRelationConcept[]}
* @type {ARIARoleRelationConcept[]}
*/

@@ -164,3 +168,3 @@ const interactive_element_ax_object_schemas = [];

/**
* @type {import('aria-query').ARIARoleRelationConcept[]}
* @type {ARIARoleRelationConcept[]}
*/

@@ -180,5 +184,5 @@ const non_interactive_element_ax_object_schemas = [];

/**
* @param {import('aria-query').ARIARoleRelationConcept} schema
* @param {ARIARoleRelationConcept} schema
* @param {string} tag_name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
*/

@@ -206,3 +210,3 @@ function match_schema(schema, tag_name, attribute_map) {

* @param {string} tag_name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
* @returns {ElementInteractivity[keyof ElementInteractivity]}

@@ -243,3 +247,3 @@ */

* @param {string} tag_name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
* @returns {boolean}

@@ -253,3 +257,3 @@ */

* @param {string} tag_name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
* @returns {boolean}

@@ -263,3 +267,3 @@ */

* @param {string} tag_name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
* @returns {boolean}

@@ -272,5 +276,5 @@ */

/**
* @param {import('aria-query').ARIARoleDefinitionKey} role
* @param {ARIARoleDefinitionKey} role
* @param {string} tag_name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
*/

@@ -559,3 +563,3 @@ function is_semantic_role_element(role, tag_name, attribute_map) {

/** @param {Map<string, import('#compiler').Attribute>} attribute_map */
/** @param {Map<string, Attribute>} attribute_map */
function input_implicit_role(attribute_map) {

@@ -573,3 +577,3 @@ const type_attribute = attribute_map.get('type');

/** @param {Map<string, import('#compiler').Attribute>} attribute_map */
/** @param {Map<string, Attribute>} attribute_map */
function menuitem_implicit_role(attribute_map) {

@@ -585,3 +589,3 @@ const type_attribute = attribute_map.get('type');

* @param {string} name
* @param {Map<string, import('#compiler').Attribute>} attribute_map
* @param {Map<string, Attribute>} attribute_map
*/

@@ -601,3 +605,3 @@ function get_implicit_role(name, attribute_map) {

/**
* @param {import('#compiler').SvelteNode | null} parent
* @param {SvelteNode | null} parent
* @param {string[]} elements

@@ -611,3 +615,3 @@ */

}
parent = /** @type {import('#compiler').TemplateNode} */ (parent).parent;
parent = /** @type {TemplateNode} */ (parent).parent;
}

@@ -618,5 +622,5 @@ return false;

/**
* @param {import('#compiler').Attribute} attribute
* @param {import('aria-query').ARIAProperty} name
* @param {import('aria-query').ARIAPropertyDefinition} schema
* @param {Attribute} attribute
* @param {ARIAProperty} name
* @param {ARIAPropertyDefinition} schema
* @param {string | true | null} value

@@ -669,3 +673,3 @@ */

/**
* @param {import('#compiler').RegularElement |import('#compiler').SvelteElement} node
* @param {RegularElement |SvelteElement} node
* @param {string[]} attributes

@@ -686,3 +690,3 @@ * @param {string} name

/**
* @param {import('#compiler').Attribute | undefined} attribute
* @param {Attribute | undefined} attribute
*/

@@ -697,3 +701,3 @@ function get_static_value(attribute) {

/**
* @param {import('#compiler').Attribute | undefined} attribute
* @param {Attribute | undefined} attribute
*/

@@ -707,4 +711,4 @@ function get_static_text_value(attribute) {

/**
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} node
* @param {import('./types.js').AnalysisState} state
* @param {RegularElement | SvelteElement} node
* @param {AnalysisState} state
*/

@@ -715,3 +719,3 @@ function check_element(node, state) {

/** @type {Map<string, import('#compiler').Attribute>} */
/** @type {Map<string, Attribute>} */
const attribute_map = new Map();

@@ -722,3 +726,3 @@

/** @type {import('#compiler').Attribute[]} */
/** @type {Attribute[]} */
const attributes = [];

@@ -779,10 +783,5 @@

const schema = aria.get(/** @type {import('aria-query').ARIAProperty} */ (name));
const schema = aria.get(/** @type {ARIAProperty} */ (name));
if (schema !== undefined) {
validate_aria_attribute_value(
attribute,
/** @type {import('aria-query').ARIAProperty} */ (name),
schema,
value
);
validate_aria_attribute_value(attribute, /** @type {ARIAProperty} */ (name), schema, value);
}

@@ -811,4 +810,3 @@

for (const c_r of value.split(regex_whitespaces)) {
const current_role =
/** @type {import('aria-query').ARIARoleDefinitionKey} current_role */ (c_r);
const current_role = /** @type {ARIARoleDefinitionKey} current_role */ (c_r);

@@ -932,5 +930,3 @@ if (current_role && is_abstract_role(current_role)) {

const role = attribute_map.get('role');
const role_static_value = /** @type {import('aria-query').ARIARoleDefinitionKey} */ (
get_static_text_value(role)
);
const role_static_value = /** @type {ARIARoleDefinitionKey} */ (get_static_text_value(role));

@@ -956,3 +952,3 @@ // click-events-have-key-events

const role_value = /** @type {import('aria-query').ARIARoleDefinitionKey} */ (
const role_value = /** @type {ARIARoleDefinitionKey} */ (
role ? role_static_value : get_implicit_role(node.name, attribute_map)

@@ -976,11 +972,7 @@ );

if (typeof role_value === 'string' && roles_map.has(role_value)) {
const { props } = /** @type {import('aria-query').ARIARoleDefinition} */ (
roles_map.get(role_value)
);
const { props } = /** @type {ARIARoleDefinition} */ (roles_map.get(role_value));
const invalid_aria_props = aria.keys().filter((attribute) => !(attribute in props));
const is_implicit = role_value && role === undefined;
for (const attr of attributes) {
if (
invalid_aria_props.includes(/** @type {import('aria-query').ARIAProperty} */ (attr.name))
) {
if (invalid_aria_props.includes(/** @type {ARIAProperty} */ (attr.name))) {
if (is_implicit) {

@@ -1111,3 +1103,3 @@ w.a11y_role_supports_aria_props_implicit(attr, attr.name, role_value, node.name);

if (node.name === 'label') {
/** @param {import('#compiler').TemplateNode} node */
/** @param {TemplateNode} node */
const has_input_child = (node) => {

@@ -1149,3 +1141,3 @@ let has = false;

let has_caption = false;
const track = /** @type {import('#compiler').RegularElement | undefined} */ (
const track = /** @type {RegularElement | undefined} */ (
node.fragment.nodes.find((i) => i.type === 'RegularElement' && i.name === 'track')

@@ -1202,3 +1194,3 @@ );

/**
* @type {import('zimmerframe').Visitors<import('#compiler').SvelteNode, import('./types.js').AnalysisState>}
* @type {Visitors<SvelteNode, AnalysisState>}
*/

@@ -1205,0 +1197,0 @@ export const a11y_validators = {

@@ -0,1 +1,4 @@

/** @import { ComponentAnalysis } from '../../types.js' */
/** @import { Css } from '#compiler' */
/** @import { Visitors } from 'zimmerframe' */
import { walk } from 'zimmerframe';

@@ -7,12 +10,12 @@ import * as e from '../../../errors.js';

/**
* @typedef {import('zimmerframe').Visitors<
* import('#compiler').Css.Node,
* @typedef {Visitors<
* Css.Node,
* {
* keyframes: string[];
* rule: import('#compiler').Css.Rule | null;
* rule: Css.Rule | null;
* }
* >} Visitors
* >} CssVisitors
*/
/** @param {import('#compiler').Css.RelativeSelector} relative_selector */
/** @param {Css.RelativeSelector} relative_selector */
function is_global(relative_selector) {

@@ -31,3 +34,3 @@ const first = relative_selector.selectors[0];

/** @type {Visitors} */
/** @type {CssVisitors} */
const analysis_visitors = {

@@ -107,3 +110,3 @@ Atrule(node, context) {

/** @type {Visitors} */
/** @type {CssVisitors} */
const validation_visitors = {

@@ -184,3 +187,3 @@ Rule(node, context) {

NestingSelector(node, context) {
const rule = /** @type {import('#compiler').Css.Rule} */ (context.state.rule);
const rule = /** @type {Css.Rule} */ (context.state.rule);
if (!rule.metadata.parent_rule) {

@@ -195,4 +198,4 @@ e.css_nesting_selector_invalid_placement(node);

/**
* @param {import('#compiler').Css.StyleSheet} stylesheet
* @param {import('../../types.js').ComponentAnalysis} analysis
* @param {Css.StyleSheet} stylesheet
* @param {ComponentAnalysis} analysis
*/

@@ -199,0 +202,0 @@ export function analyze_css(stylesheet, analysis) {

@@ -0,1 +1,3 @@

/** @import { Visitors } from 'zimmerframe' */
/** @import * as Compiler from '#compiler' */
import { walk } from 'zimmerframe';

@@ -7,4 +9,4 @@ import { get_possible_values } from './utils.js';

* @typedef {{
* stylesheet: import('#compiler').Css.StyleSheet;
* element: import('#compiler').RegularElement | import('#compiler').SvelteElement;
* stylesheet: Compiler.Css.StyleSheet;
* element: Compiler.RegularElement | Compiler.SvelteElement;
* }} State

@@ -22,3 +24,3 @@ */

/** @type {import('#compiler').Css.Combinator} */
/** @type {Compiler.Css.Combinator} */
const descendant_combinator = {

@@ -31,3 +33,3 @@ type: 'Combinator',

/** @type {import('#compiler').Css.RelativeSelector} */
/** @type {Compiler.Css.RelativeSelector} */
const nesting_selector = {

@@ -55,4 +57,4 @@ type: 'RelativeSelector',

*
* @param {import('#compiler').Css.StyleSheet} stylesheet
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} element
* @param {Compiler.Css.StyleSheet} stylesheet
* @param {Compiler.RegularElement | Compiler.SvelteElement} element
*/

@@ -63,3 +65,3 @@ export function prune(stylesheet, element) {

/** @type {import('zimmerframe').Visitors<import('#compiler').Css.Node, State>} */
/** @type {Visitors<Compiler.Css.Node, State>} */
const visitors = {

@@ -95,3 +97,3 @@ Rule(node, context) {

selectors,
/** @type {import('#compiler').Css.Rule} */ (node.metadata.rule),
/** @type {Compiler.Css.Rule} */ (node.metadata.rule),
context.state.element,

@@ -113,3 +115,3 @@ context.state.stylesheet

* Discard trailing `:global(...)` selectors, these are unused for scoping purposes
* @param {import('#compiler').Css.ComplexSelector} node
* @param {Compiler.Css.ComplexSelector} node
*/

@@ -125,6 +127,6 @@ function truncate(node) {

/**
* @param {import('#compiler').Css.RelativeSelector[]} relative_selectors
* @param {import('#compiler').Css.Rule} rule
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} element
* @param {import('#compiler').Css.StyleSheet} stylesheet
* @param {Compiler.Css.RelativeSelector[]} relative_selectors
* @param {Compiler.Css.Rule} rule
* @param {Compiler.RegularElement | Compiler.SvelteElement} element
* @param {Compiler.Css.StyleSheet} stylesheet
* @returns {boolean}

@@ -155,3 +157,3 @@ */

case '>': {
let parent = /** @type {import('#compiler').TemplateNode | null} */ (element.parent);
let parent = /** @type {Compiler.TemplateNode | null} */ (element.parent);

@@ -179,3 +181,3 @@ let parent_matched = false;

parent = /** @type {import('#compiler').TemplateNode | null} */ (parent.parent);
parent = /** @type {Compiler.TemplateNode | null} */ (parent.parent);
}

@@ -231,4 +233,4 @@

* for transformation in a later step
* @param {import('#compiler').Css.RelativeSelector} relative_selector
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} element
* @param {Compiler.Css.RelativeSelector} relative_selector
* @param {Compiler.RegularElement | Compiler.SvelteElement} element
*/

@@ -245,4 +247,4 @@ function mark(relative_selector, element) {

* a global selector
* @param {import('#compiler').Css.RelativeSelector} selector
* @param {import('#compiler').Css.Rule} rule
* @param {Compiler.Css.RelativeSelector} selector
* @param {Compiler.Css.Rule} rule
*/

@@ -255,3 +257,3 @@ function is_global(selector, rule) {

for (const s of selector.selectors) {
/** @type {import('#compiler').Css.SelectorList | null} */
/** @type {Compiler.Css.SelectorList | null} */
let selector_list = null;

@@ -267,3 +269,3 @@ let owner = rule;

if (s.type === 'NestingSelector') {
owner = /** @type {import('#compiler').Css.Rule} */ (rule.metadata.parent_rule);
owner = /** @type {Compiler.Css.Rule} */ (rule.metadata.parent_rule);
selector_list = owner.prelude;

@@ -291,6 +293,6 @@ }

*
* @param {import('#compiler').Css.RelativeSelector} relative_selector
* @param {import('#compiler').Css.Rule} rule
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} element
* @param {import('#compiler').Css.StyleSheet} stylesheet
* @param {Compiler.Css.RelativeSelector} relative_selector
* @param {Compiler.Css.Rule} rule
* @param {Compiler.RegularElement | Compiler.SvelteElement} element
* @param {Compiler.Css.StyleSheet} stylesheet
* @returns {boolean}

@@ -311,3 +313,3 @@ */

if (name === 'global' && relative_selector.selectors.length === 1) {
const args = /** @type {import('#compiler').Css.SelectorList} */ (selector.args);
const args = /** @type {Compiler.Css.SelectorList} */ (selector.args);
const complex_selector = args.children[0];

@@ -392,3 +394,3 @@ return apply_selector(complex_selector.children, rule, element, stylesheet);

const parent = /** @type {import('#compiler').Css.Rule} */ (rule.metadata.parent_rule);
const parent = /** @type {Compiler.Css.Rule} */ (rule.metadata.parent_rule);

@@ -445,3 +447,3 @@ for (const complex_selector of parent.prelude.children) {

/**
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} node
* @param {Compiler.RegularElement | Compiler.SvelteElement} node
* @param {string} name

@@ -556,7 +558,7 @@ * @param {string | null} expected_value

/**
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} node
* @returns {import('#compiler').RegularElement | import('#compiler').SvelteElement | null}
* @param {Compiler.RegularElement | Compiler.SvelteElement} node
* @returns {Compiler.RegularElement | Compiler.SvelteElement | null}
*/
function get_element_parent(node) {
/** @type {import('#compiler').SvelteNode | null} */
/** @type {Compiler.SvelteNode | null} */
let parent = node;

@@ -591,7 +593,7 @@ while (

* ```
* @param {import('#compiler').SvelteNode} node
* @returns {import('#compiler').SvelteNode}
* @param {Compiler.SvelteNode} node
* @returns {Compiler.SvelteNode}
*/
function find_previous_sibling(node) {
/** @type {import('#compiler').SvelteNode} */
/** @type {Compiler.SvelteNode} */
let current_node = node;

@@ -625,11 +627,11 @@

/**
* @param {import('#compiler').SvelteNode} node
* @param {Compiler.SvelteNode} node
* @param {boolean} adjacent_only
* @returns {Map<import('#compiler').RegularElement | import('#compiler').SvelteElement | import('#compiler').SlotElement | import('#compiler').RenderTag, NodeExistsValue>}
* @returns {Map<Compiler.RegularElement | Compiler.SvelteElement | Compiler.SlotElement | Compiler.RenderTag, NodeExistsValue>}
*/
function get_possible_element_siblings(node, adjacent_only) {
/** @type {Map<import('#compiler').RegularElement | import('#compiler').SvelteElement | import('#compiler').SlotElement | import('#compiler').RenderTag, NodeExistsValue>} */
/** @type {Map<Compiler.RegularElement | Compiler.SvelteElement | Compiler.SlotElement | Compiler.RenderTag, NodeExistsValue>} */
const result = new Map();
/** @type {import('#compiler').SvelteNode} */
/** @type {Compiler.SvelteNode} */
let prev = node;

@@ -666,3 +668,3 @@ while ((prev = find_previous_sibling(prev))) {

if (!prev || !adjacent_only) {
/** @type {import('#compiler').SvelteNode | null} */
/** @type {Compiler.SvelteNode | null} */
let parent = node;

@@ -694,8 +696,8 @@

/**
* @param {import('#compiler').EachBlock | import('#compiler').IfBlock | import('#compiler').AwaitBlock} relative_selector
* @param {Compiler.EachBlock | Compiler.IfBlock | Compiler.AwaitBlock} relative_selector
* @param {boolean} adjacent_only
* @returns {Map<import('#compiler').RegularElement, NodeExistsValue>}
* @returns {Map<Compiler.RegularElement, NodeExistsValue>}
*/
function get_possible_last_child(relative_selector, adjacent_only) {
/** @typedef {Map<import('#compiler').RegularElement, NodeExistsValue>} NodeMap */
/** @typedef {Map<Compiler.RegularElement, NodeExistsValue>} NodeMap */

@@ -802,3 +804,3 @@ /** @type {NodeMap} */

/** @param {Map<import('#compiler').RegularElement, NodeExistsValue>} result */
/** @param {Map<Compiler.RegularElement, NodeExistsValue>} result */
function mark_as_probably(result) {

@@ -811,7 +813,7 @@ for (const key of result.keys()) {

/**
* @param {import('#compiler').SvelteNode[]} children
* @param {Compiler.SvelteNode[]} children
* @param {boolean} adjacent_only
*/
function loop_child(children, adjacent_only) {
/** @type {Map<import('#compiler').RegularElement, NodeExistsValue>} */
/** @type {Map<Compiler.RegularElement, NodeExistsValue>} */
const result = new Map();

@@ -818,0 +820,0 @@ for (let i = children.length - 1; i >= 0; i--) {

@@ -0,1 +1,3 @@

/** @import { Visitors } from 'zimmerframe' */
/** @import { Css } from '#compiler' */
import { walk } from 'zimmerframe';

@@ -6,3 +8,3 @@ import * as w from '../../../warnings.js';

/**
* @param {import('#compiler').Css.StyleSheet} stylesheet
* @param {Css.StyleSheet} stylesheet
*/

@@ -13,3 +15,3 @@ export function warn_unused(stylesheet) {

/** @type {import('zimmerframe').Visitors<import('#compiler').Css.Node, { stylesheet: import('#compiler').Css.StyleSheet }>} */
/** @type {Visitors<Css.Node, { stylesheet: Css.StyleSheet }>} */
const visitors = {

@@ -16,0 +18,0 @@ Atrule(node, context) {

@@ -0,5 +1,7 @@

/** @import { Text, ExpressionTag } from '#compiler' */
/** @import { Node } from 'estree' */
const UNKNOWN = {};
/**
* @param {import('estree').Node} node
* @param {Node} node
* @param {Set<any>} set

@@ -19,3 +21,3 @@ */

/**
* @param {import('#compiler').Text | import('#compiler').ExpressionTag} chunk
* @param {Text | ExpressionTag} chunk
* @returns {Set<string> | null}

@@ -22,0 +24,0 @@ */

@@ -0,1 +1,5 @@

/** @import * as ESTree from 'estree' */
/** @import { ValidatedCompileOptions, SvelteNode, ValidatedModuleCompileOptions } from '#compiler' */
/** @import { ComponentAnalysis, Analysis } from '../../types' */
/** @import { Visitors, ComponentClientTransformState, ClientTransformState } from './types' */
import { walk } from 'zimmerframe';

@@ -15,4 +19,4 @@ import * as b from '../../../utils/builders.js';

* This function ensures visitor sets don't accidentally clobber each other
* @param {...import('./types').Visitors} array
* @returns {import('./types').Visitors}
* @param {...Visitors} array
* @returns {Visitors}
*/

@@ -39,8 +43,8 @@ function combine_visitors(...array) {

* @param {string} source
* @param {import('../../types').ComponentAnalysis} analysis
* @param {import('#compiler').ValidatedCompileOptions} options
* @returns {import('estree').Program}
* @param {ComponentAnalysis} analysis
* @param {ValidatedCompileOptions} options
* @returns {ESTree.Program}
*/
export function client_component(source, analysis, options) {
/** @type {import('./types').ComponentClientTransformState} */
/** @type {ComponentClientTransformState} */
const state = {

@@ -77,5 +81,5 @@ analysis,

const module = /** @type {import('estree').Program} */ (
const module = /** @type {ESTree.Program} */ (
walk(
/** @type {import('#compiler').SvelteNode} */ (analysis.module.ast),
/** @type {SvelteNode} */ (analysis.module.ast),
state,

@@ -93,5 +97,5 @@ combine_visitors(

const instance_state = { ...state, scope: analysis.instance.scope };
const instance = /** @type {import('estree').Program} */ (
const instance = /** @type {ESTree.Program} */ (
walk(
/** @type {import('#compiler').SvelteNode} */ (analysis.instance.ast),
/** @type {SvelteNode} */ (analysis.instance.ast),
instance_state,

@@ -121,5 +125,5 @@ combine_visitors(

const template = /** @type {import('estree').Program} */ (
const template = /** @type {ESTree.Program} */ (
walk(
/** @type {import('#compiler').SvelteNode} */ (analysis.template.ast),
/** @type {SvelteNode} */ (analysis.template.ast),
{ ...state, scope: analysis.instance.scope },

@@ -146,6 +150,6 @@ combine_visitors(

/** @type {import('estree').Statement[]} */
/** @type {ESTree.Statement[]} */
const store_setup = [];
/** @type {import('estree').VariableDeclaration[]} */
/** @type {ESTree.VariableDeclaration[]} */
const legacy_reactive_declarations = [];

@@ -202,3 +206,3 @@

* Used to store the group nodes
* @type {import('estree').VariableDeclaration[]}
* @type {ESTree.VariableDeclaration[]}
*/

@@ -210,3 +214,3 @@ const group_binding_declarations = [];

/** @type {Array<import('estree').Property | import('estree').SpreadElement>} */
/** @type {Array<ESTree.Property | ESTree.SpreadElement>} */
const component_returned_object = analysis.exports.map(({ name, alias }) => {

@@ -229,3 +233,3 @@ const expression = serialize_get_binding(b.id(name), instance_state);

const exports = analysis.exports.map(({ name, alias }) => b.literal(alias ?? name));
/** @type {import('estree').Literal[]} */
/** @type {ESTree.Literal[]} */
const bindable = [];

@@ -266,3 +270,3 @@ for (const [name, binding] of properties) {

left: b.id('$$value'),
right: /** @type {import('estree').Expression} */ (binding.initial)
right: /** @type {ESTree.Expression} */ (binding.initial)
};

@@ -303,5 +307,5 @@ }

...analysis.top_level_snippets,
.../** @type {import('estree').Statement[]} */ (instance.body),
.../** @type {ESTree.Statement[]} */ (instance.body),
analysis.runes || !analysis.needs_context ? b.empty : b.stmt(b.call('$.init')),
.../** @type {import('estree').Statement[]} */ (template.body)
.../** @type {ESTree.Statement[]} */ (template.body)
]);

@@ -494,3 +498,3 @@

/** @type {import('estree').Property[]} */
/** @type {ESTree.Property[]} */
const props_str = [];

@@ -510,3 +514,3 @@

const value = b.object(
/** @type {import('estree').Property[]} */ (
/** @type {ESTree.Property[]} */ (
[

@@ -555,8 +559,8 @@ prop_def.attribute ? b.init('attribute', b.literal(prop_def.attribute)) : undefined,

/**
* @param {import('../../types').Analysis} analysis
* @param {import('#compiler').ValidatedModuleCompileOptions} options
* @returns {import('estree').Program}
* @param {Analysis} analysis
* @param {ValidatedModuleCompileOptions} options
* @returns {ESTree.Program}
*/
export function client_module(analysis, options) {
/** @type {import('./types').ClientTransformState} */
/** @type {ClientTransformState} */
const state = {

@@ -573,5 +577,5 @@ analysis,

const module = /** @type {import('estree').Program} */ (
const module = /** @type {ESTree.Program} */ (
walk(
/** @type {import('#compiler').SvelteNode} */ (analysis.module.ast),
/** @type {SvelteNode} */ (analysis.module.ast),
state,

@@ -578,0 +582,0 @@ combine_visitors(

@@ -0,1 +1,5 @@

/** @import { Binding, ReactiveStatement } from '#compiler' */
/** @import { ComponentVisitors } from '../types.js' */
/** @import { Scope } from '../../../scope.js' */
/** @import { VariableDeclarator, Expression, Identifier, Statement } from 'estree' */
import { is_hoistable_function } from '../../utils.js';

@@ -8,5 +12,5 @@ import * as b from '../../../../utils/builders.js';

* Creates the output for a state declaration.
* @param {import('estree').VariableDeclarator} declarator
* @param {import('../../../scope.js').Scope} scope
* @param {import('estree').Expression} value
* @param {VariableDeclarator} declarator
* @param {Scope} scope
* @param {Expression} value
*/

@@ -24,3 +28,3 @@ function create_state_declarators(declarator, scope, value) {

const value = path.expression?.(b.id(tmp));
const binding = scope.get(/** @type {import('estree').Identifier} */ (path.node).name);
const binding = scope.get(/** @type {Identifier} */ (path.node).name);
return b.declarator(

@@ -34,12 +38,10 @@ path.node,

/** @type {import('../types.js').ComponentVisitors} */
/** @type {ComponentVisitors} */
export const javascript_visitors_legacy = {
VariableDeclaration(node, { state, visit }) {
/** @type {import('estree').VariableDeclarator[]} */
/** @type {VariableDeclarator[]} */
const declarations = [];
for (const declarator of node.declarations) {
const bindings = /** @type {import('#compiler').Binding[]} */ (
state.scope.get_bindings(declarator)
);
const bindings = /** @type {Binding[]} */ (state.scope.get_bindings(declarator));
const has_state = bindings.some((binding) => binding.kind === 'state');

@@ -53,11 +55,7 @@ const has_props = bindings.some((binding) => binding.kind === 'bindable_prop');

state.hoisted.push(
b.declaration(
'const',
declarator.id,
/** @type {import('estree').Expression} */ (hoistable_function)
)
b.declaration('const', declarator.id, /** @type {Expression} */ (hoistable_function))
);
continue;
}
declarations.push(/** @type {import('estree').VariableDeclarator} */ (visit(declarator)));
declarations.push(/** @type {VariableDeclarator} */ (visit(declarator)));
continue;

@@ -75,10 +73,8 @@ }

b.id(tmp),
/** @type {import('estree').Expression} */ (
visit(/** @type {import('estree').Expression} */ (declarator.init))
)
/** @type {Expression} */ (visit(/** @type {Expression} */ (declarator.init)))
)
);
for (const path of paths) {
const name = /** @type {import('estree').Identifier} */ (path.node).name;
const binding = /** @type {import('#compiler').Binding} */ (state.scope.get(name));
const name = /** @type {Identifier} */ (path.node).name;
const binding = /** @type {Binding} */ (state.scope.get(name));
const value = path.expression?.(b.id(tmp));

@@ -97,5 +93,3 @@ declarations.push(

const binding = /** @type {import('#compiler').Binding} */ (
state.scope.get(declarator.id.name)
);
const binding = /** @type {Binding} */ (state.scope.get(declarator.id.name));

@@ -109,3 +103,3 @@ declarations.push(

binding.prop_alias ?? declarator.id.name,
declarator.init && /** @type {import('estree').Expression} */ (visit(declarator.init))
declarator.init && /** @type {Expression} */ (visit(declarator.init))
)

@@ -122,3 +116,3 @@ )

state.scope,
/** @type {import('estree').Expression} */ (declarator.init && visit(declarator.init))
/** @type {Expression} */ (declarator.init && visit(declarator.init))
)

@@ -146,3 +140,3 @@ );

// the compiler can 'see', but we untrack the effect itself
const reactive_stmt = /** @type {import('#compiler').ReactiveStatement} */ (
const reactive_stmt = /** @type {ReactiveStatement} */ (
state.analysis.reactive_statements.get(node)

@@ -155,3 +149,3 @@ );

let serialized_body = /** @type {import('estree').Statement} */ (context.visit(node.body));
let serialized_body = /** @type {Statement} */ (context.visit(node.body));

@@ -164,3 +158,3 @@ if (serialized_body.type !== 'BlockStatement') {

/** @type {import('estree').Expression[]} */
/** @type {Expression[]} */
const sequence = [];

@@ -167,0 +161,0 @@ for (const binding of dependencies) {

@@ -0,5 +1,7 @@

/** @import { FunctionDeclaration } from 'estree' */
/** @import { ComponentVisitors } from '../types.js' */
import * as b from '../../../../utils/builders.js';
import { function_visitor, serialize_hoistable_params } from '../utils.js';
/** @type {import('../types.js').ComponentVisitors} */
/** @type {ComponentVisitors} */
export const javascript_visitors = {

@@ -17,3 +19,3 @@ FunctionExpression: function_visitor,

context.state.hoisted.push(
/** @type {import('estree').FunctionDeclaration} */ ({
/** @type {FunctionDeclaration} */ ({
...node,

@@ -20,0 +22,0 @@ id: node.id !== null ? context.visit(node.id, state) : null,

@@ -0,1 +1,4 @@

/** @import { Visitors } from 'zimmerframe' */
/** @import { ValidatedCompileOptions, Css } from '#compiler' */
/** @import { ComponentAnalysis } from '../../types.js' */
import MagicString from 'magic-string';

@@ -22,4 +25,4 @@ import { walk } from 'zimmerframe';

* @param {string} source
* @param {import('../../types.js').ComponentAnalysis} analysis
* @param {import('#compiler').ValidatedCompileOptions} options
* @param {ComponentAnalysis} analysis
* @param {ValidatedCompileOptions} options
*/

@@ -41,5 +44,5 @@ export function render_stylesheet(source, analysis, options) {

const ast = /** @type {import('#compiler').Css.StyleSheet} */ (analysis.css.ast);
const ast = /** @type {Css.StyleSheet} */ (analysis.css.ast);
walk(/** @type {import('#compiler').Css.Node} */ (ast), state, visitors);
walk(/** @type {Css.Node} */ (ast), state, visitors);

@@ -69,3 +72,3 @@ code.remove(0, ast.content.start);

/** @type {import('zimmerframe').Visitors<import('#compiler').Css.Node, State>} */
/** @type {Visitors<Css.Node, State>} */
const visitors = {

@@ -202,3 +205,3 @@ _: (node, context) => {

/** @type {import('#compiler').Css.Rule | null} */
/** @type {Css.Rule | null} */
let rule = parent.metadata.parent_rule;

@@ -220,3 +223,3 @@

/** @param {import('#compiler').Css.SimpleSelector} selector */
/** @param {Css.SimpleSelector} selector */
function remove_global_pseudo_class(selector) {

@@ -301,3 +304,3 @@ context.state.code

/** @param {import('#compiler').Css.Rule} rule */
/** @param {Css.Rule} rule */
function is_empty(rule) {

@@ -325,3 +328,3 @@ if (rule.metadata.is_global_block) {

/** @param {import('#compiler').Css.Rule} rule */
/** @param {Css.Rule} rule */
function is_used(rule) {

@@ -345,3 +348,3 @@ for (const selector of rule.prelude.children) {

*
* @param {import('#compiler').Css.Rule} node
* @param {Css.Rule} node
* @param {MagicString} code

@@ -348,0 +351,0 @@ */

@@ -0,1 +1,3 @@

/** @import { ValidatedCompileOptions, CompileResult, ValidatedModuleCompileOptions } from '#compiler' */
/** @import { ComponentAnalysis, Analysis } from '../types' */
import { print } from 'esrap';

@@ -10,6 +12,6 @@ import { VERSION } from '../../../version.js';

/**
* @param {import('../types').ComponentAnalysis} analysis
* @param {ComponentAnalysis} analysis
* @param {string} source
* @param {import('#compiler').ValidatedCompileOptions} options
* @returns {import('#compiler').CompileResult}
* @param {ValidatedCompileOptions} options
* @returns {CompileResult}
*/

@@ -59,6 +61,6 @@ export function transform_component(analysis, source, options) {

/**
* @param {import('../types').Analysis} analysis
* @param {Analysis} analysis
* @param {string} source
* @param {import('#compiler').ValidatedModuleCompileOptions} options
* @returns {import('#compiler').CompileResult}
* @param {ValidatedModuleCompileOptions} options
* @returns {CompileResult}
*/

@@ -65,0 +67,0 @@ export function transform_module(analysis, source, options) {

@@ -0,1 +1,5 @@

/** @import { Context } from 'zimmerframe' */
/** @import { TransformState } from './types.js' */
/** @import * as Compiler from '#compiler' */
/** @import { Node, Expression, CallExpression } from 'estree' */
import {

@@ -15,3 +19,3 @@ regex_ends_with_whitespaces,

/**
* @param {import('estree').Node} node
* @param {Node} node
* @returns {boolean}

@@ -32,4 +36,4 @@ */

* Match Svelte 4 behaviour by sorting ConstTag nodes in topological order
* @param {import("#compiler").SvelteNode[]} nodes
* @param {import('./types.js').TransformState} state
* @param {Compiler.SvelteNode[]} nodes
* @param {TransformState} state
*/

@@ -39,4 +43,4 @@ function sort_const_tags(nodes, state) {

* @typedef {{
* node: import('#compiler').ConstTag;
* deps: Set<import('#compiler').Binding>;
* node: Compiler.ConstTag;
* deps: Set<Compiler.Binding>;
* }} Tag

@@ -47,3 +51,3 @@ */

/** @type {Map<import('#compiler').Binding, Tag>} */
/** @type {Map<Compiler.Binding, Tag>} */
const tags = new Map();

@@ -58,6 +62,6 @@

const bindings = extract_identifiers(declaration.id).map((id) => {
return /** @type {import('#compiler').Binding} */ (state.scope.get(id.name));
return /** @type {Compiler.Binding} */ (state.scope.get(id.name));
});
/** @type {Set<import('#compiler').Binding>} */
/** @type {Set<Compiler.Binding>} */
const deps = new Set();

@@ -68,3 +72,3 @@

Identifier(node, context) {
const parent = /** @type {import('estree').Expression} */ (context.path.at(-1));
const parent = /** @type {Expression} */ (context.path.at(-1));

@@ -90,3 +94,3 @@ if (is_reference(node, parent)) {

/** @type {Array<[import('#compiler').Binding, import('#compiler').Binding]>} */
/** @type {Array<[Compiler.Binding, Compiler.Binding]>} */
const edges = [];

@@ -108,3 +112,3 @@

/** @type {import('#compiler').ConstTag[]} */
/** @type {Compiler.ConstTag[]} */
const sorted = [];

@@ -140,7 +144,7 @@

* in which case we remove it entirely
* @param {import('#compiler').SvelteNode} parent
* @param {import('#compiler').SvelteNode[]} nodes
* @param {import('#compiler').SvelteNode[]} path
* @param {import('#compiler').Namespace} namespace
* @param {import('./types.js').TransformState} state
* @param {Compiler.SvelteNode} parent
* @param {Compiler.SvelteNode[]} nodes
* @param {Compiler.SvelteNode[]} path
* @param {Compiler.Namespace} namespace
* @param {TransformState} state
* @param {boolean} preserve_whitespace

@@ -165,6 +169,6 @@ * @param {boolean} preserve_comments

/** @type {import('#compiler').SvelteNode[]} */
/** @type {Compiler.SvelteNode[]} */
const hoisted = [];
/** @type {import('#compiler').SvelteNode[]} */
/** @type {Compiler.SvelteNode[]} */
const regular = [];

@@ -233,3 +237,3 @@

/** @type {import('#compiler').SvelteNode[]} */
/** @type {Compiler.SvelteNode[]} */
const trimmed = [];

@@ -276,5 +280,5 @@

* Infers the namespace for the children of a node that should be used when creating the `$.template(...)`.
* @param {import('#compiler').Namespace} namespace
* @param {import('#compiler').SvelteNode} parent
* @param {import('#compiler').SvelteNode[]} nodes
* @param {Compiler.Namespace} namespace
* @param {Compiler.SvelteNode} parent
* @param {Compiler.SvelteNode[]} nodes
*/

@@ -318,8 +322,8 @@ export function infer_namespace(namespace, parent, nodes) {

* in which case we assume svg.
* @param {import('#compiler').SvelteNode[]} nodes
* @param {import('#compiler').Namespace | 'keep' | 'maybe_html'} namespace
* @param {Compiler.SvelteNode[]} nodes
* @param {Compiler.Namespace | 'keep' | 'maybe_html'} namespace
*/
function check_nodes_for_namespace(nodes, namespace) {
/**
* @param {import('#compiler').SvelteElement | import('#compiler').RegularElement} node}
* @param {Compiler.SvelteElement | Compiler.RegularElement} node}
* @param {{stop: () => void}} context

@@ -373,5 +377,5 @@ */

* Determines the namespace the children of this node are in.
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} node
* @param {import('#compiler').Namespace} namespace
* @returns {import('#compiler').Namespace}
* @param {Compiler.RegularElement | Compiler.SvelteElement} node
* @param {Compiler.Namespace} namespace
* @returns {Compiler.Namespace}
*/

@@ -395,5 +399,5 @@ export function determine_namespace_for_children(node, namespace) {

/**
* @template {import('./types.js').TransformState} T
* @param {import('estree').CallExpression} node
* @param {import('zimmerframe').Context<any, T>} context
* @template {TransformState} T
* @param {CallExpression} node
* @param {Context<any, T>} context
*/

@@ -407,8 +411,7 @@ export function transform_inspect_rune(node, context) {

if (node.callee.type === 'MemberExpression') {
const raw_inspect_args = /** @type {import('estree').CallExpression} */ (node.callee.object)
.arguments;
const raw_inspect_args = /** @type {CallExpression} */ (node.callee.object).arguments;
const inspect_args =
/** @type {Array<import('estree').Expression>} */
/** @type {Array<Expression>} */
(raw_inspect_args.map((arg) => visit(arg)));
const with_arg = /** @type {import('estree').Expression} */ (visit(node.arguments[0]));
const with_arg = /** @type {Expression} */ (visit(node.arguments[0]));

@@ -421,7 +424,5 @@ return b.call(

} else {
const arg = node.arguments.map(
(arg) => /** @type {import('estree').Expression} */ (visit(arg))
);
const arg = node.arguments.map((arg) => /** @type {Expression} */ (visit(arg)));
return b.call('$.inspect', as_fn ? b.thunk(b.array(arg)) : b.array(arg));
}
}

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

/** @import { Css } from '#compiler' */
const regex_css_browser_prefix = /^-((webkit)|(moz)|(o)|(ms))-/;

@@ -12,3 +13,3 @@ export const regex_css_name_boundary = /^[\s,;}]$/;

/** @param {import('#compiler').Css.Atrule} node */
/** @param {Css.Atrule} node */
export const is_keyframes_node = (node) => remove_css_prefix(node.name) === 'keyframes';

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

/** @import * as Compiler from '#compiler' */
/**

@@ -16,4 +17,4 @@ * All nodes that can appear elsewhere than the top level, have attributes and can contain children

* Returns true for all nodes that can appear elsewhere than the top level, have attributes and can contain children
* @param {import('#compiler').SvelteNode} node
* @returns {node is import('#compiler').Component | import('#compiler').RegularElement | import('#compiler').SlotElement | import('#compiler').SvelteComponent | import('#compiler').SvelteElement | import('#compiler').SvelteFragment | import('#compiler').SvelteSelf}
* @param {Compiler.SvelteNode} node
* @returns {node is Compiler.Component | Compiler.RegularElement | Compiler.SlotElement | Compiler.SvelteComponent | Compiler.SvelteElement | Compiler.SvelteFragment | Compiler.SvelteSelf}
*/

@@ -25,3 +26,3 @@ export function is_element_node(node) {

/**
* @param {import('#compiler').RegularElement | import('#compiler').SvelteElement} node
* @param {Compiler.RegularElement | Compiler.SvelteElement} node
* @returns {boolean}

@@ -37,4 +38,4 @@ */

* @param {number} end
* @param {true | Array<import('#compiler').Text | import('#compiler').ExpressionTag>} value
* @returns {import('#compiler').Attribute}
* @param {true | Array<Compiler.Text | Compiler.ExpressionTag>} value
* @returns {Compiler.Attribute}
*/

@@ -41,0 +42,0 @@ export function create_attribute(name, start, end, value) {

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

/** @import { Visitors, Context } from 'zimmerframe' */
const overrides = {

@@ -13,3 +14,3 @@ visit() {

* @template U
* @param {...import('zimmerframe').Visitors<T, U>} tasks
* @param {...Visitors<T, U>} tasks
* @returns

@@ -28,3 +29,3 @@ */

/** @type {import('zimmerframe').Visitors<T, U>} */
/** @type {Visitors<T, U>} */
// @ts-expect-error

@@ -38,3 +39,3 @@ const combined = {};

* @param {T} node
* @param {import('zimmerframe').Context<T, U>} context
* @param {Context<T, U>} context
*/

@@ -41,0 +42,0 @@ function visitor(node, context) {

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

/** @import { Processed } from './public.js' */
import { decode as decode_mappings } from '@jridgewell/sourcemap-codec';

@@ -83,3 +84,3 @@

/**
* @param {import('./public.js').Processed} processed
* @param {Processed} processed
*/

@@ -86,0 +87,0 @@ export function decode_map(processed) {

@@ -0,1 +1,4 @@

/** @import { Processed, Preprocessor, MarkupPreprocessor, PreprocessorGroup } from './public.js' */
/** @import { SourceUpdate, Source } from './private.js' */
/** @import { DecodedSourceMap, RawSourceMap } from '@ampproject/remapping' */
import { getLocator } from 'locate-character';

@@ -29,3 +32,3 @@ import {

* @default []
* @type {Array<import('@ampproject/remapping').DecodedSourceMap | import('@ampproject/remapping').RawSourceMap>}
* @type {Array<DecodedSourceMap | RawSourceMap>}
*/

@@ -63,3 +66,3 @@ sourcemap_list = [];

/**
* @param {import('./private.js').SourceUpdate} opts
* @param {SourceUpdate} opts
*/

@@ -80,3 +83,3 @@ update_source({ string: source, map, dependencies }) {

/**
* @returns {import('./public.js').Processed}
* @returns {Processed}
*/

@@ -102,3 +105,3 @@ to_processed() {

* Convert preprocessor output for the tag content into MappedCode
* @param {import('./public.js').Processed} processed
* @param {Processed} processed
* @param {{ line: number; column: number; }} location

@@ -112,3 +115,3 @@ * @param {string} file_basename

/**
* @type {import('@ampproject/remapping').DecodedSourceMap | undefined}
* @type {DecodedSourceMap | undefined}
*/

@@ -132,7 +135,7 @@ let decoded_map = undefined;

* representing the tag content replaced with `processed`.
* @param {import('./public.js').Processed} processed
* @param {Processed} processed
* @param {'style' | 'script'} tag_name
* @param {string} original_attributes
* @param {string} generated_attributes
* @param {import('./private.js').Source} source
* @param {Source} source
* @returns {MappedCode}

@@ -166,3 +169,3 @@ */

// Generate a source map for the open tag
/** @type {import('@ampproject/remapping').DecodedSourceMap['mappings']} */
/** @type {DecodedSourceMap['mappings']} */
const mappings = [

@@ -193,3 +196,3 @@ [

/** @type {import('@ampproject/remapping').DecodedSourceMap} */
/** @type {DecodedSourceMap} */
const map = {

@@ -266,5 +269,5 @@ version: 3,

* @param {'style' | 'script'} tag_name
* @param {import('./public.js').Preprocessor} preprocessor
* @param {import('./private.js').Source} source
* @returns {Promise<import('./private.js').SourceUpdate>}
* @param {Preprocessor} preprocessor
* @param {Source} source
* @returns {Promise<SourceUpdate>}
*/

@@ -311,4 +314,4 @@ async function process_tag(tag_name, preprocessor, source) {

/**
* @param {import('./public.js').MarkupPreprocessor} process
* @param {import('./private.js').Source} source
* @param {MarkupPreprocessor} process
* @param {Source} source
*/

@@ -342,5 +345,5 @@ async function process_markup(process, source) {

* @param {string} source
* @param {import('./public.js').PreprocessorGroup | import('./public.js').PreprocessorGroup[]} preprocessor
* @param {PreprocessorGroup | PreprocessorGroup[]} preprocessor
* @param {{ filename?: string }} [options]
* @returns {Promise<import('./public.js').Processed>}
* @returns {Promise<Processed>}
*/

@@ -347,0 +350,0 @@ export default async function preprocess(source, preprocessor, options) {

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

/** @import { Source, Replacement } from './private.js' */
import { MappedCode } from '../utils/mapped_code.js';

@@ -6,4 +7,4 @@

* @param {number} offset
* @param {import('./private.js').Source} opts
* @returns {import('./private.js').Source}
* @param {Source} opts
* @returns {Source}
*/

@@ -26,3 +27,3 @@ export function slice_source(code_slice, offset, { file_basename, filename, get_location }) {

/**
* @type {Array<Promise<import('./private.js').Replacement>>}
* @type {Array<Promise<Replacement>>}
*/

@@ -44,4 +45,4 @@ const replacements = [];

/**
* @param {import('./private.js').Replacement[]} replacements
* @param {import('./private.js').Source} source
* @param {Replacement[]} replacements
* @param {Source} source
* @returns {MappedCode}

@@ -68,3 +69,3 @@ */

* @param {(...match: any[]) => Promise<MappedCode>} get_replacement
* @param {import('./private.js').Source} location
* @param {Source} location
* @returns {Promise<MappedCode>}

@@ -71,0 +72,0 @@ */

@@ -8,2 +8,8 @@ export * from './index.js';

} from './preprocess/public';
export type { CompileOptions, ModuleCompileOptions, CompileResult, Warning } from './types/index';
export type {
CompileError,
CompileOptions,
ModuleCompileOptions,
CompileResult,
Warning
} from './types/index';

@@ -0,1 +1,3 @@

/** @import { SvelteNode } from './types' */
/** @import { Warning } from '#compiler' */
import { getLocator } from 'locate-character';

@@ -5,3 +7,3 @@

/** @type {import('#compiler').Warning[]} */
/** @type {Warning[]} */
export let warnings = [];

@@ -28,3 +30,3 @@

* while the stack is being built.
* @type {Map<import("./types").SvelteNode | NodeLike, Set<string>[]>}
* @type {Map<SvelteNode | NodeLike, Set<string>[]>}
*/

@@ -31,0 +33,0 @@ export let ignore_map = new Map();

@@ -15,2 +15,3 @@ import type {

import type { EachBlock, Namespace, SvelteNode, SvelteOptions } from './template.js';
import type { InternalCompileError } from '../errors.js';

@@ -63,9 +64,3 @@ /** The return value of `compile` from `svelte/compiler` */

export interface CompileError extends Error {
code: string;
filename?: string;
position?: [number, number];
start?: Location;
end?: Location;
}
export interface CompileError extends InternalCompileError {}

@@ -72,0 +67,0 @@ export type CssHashGetter = (args: {

@@ -0,1 +1,3 @@

/** @import { Attribute, Text, ExpressionTag, SvelteNode } from '#compiler' */
/** @import * as ESTree from 'estree' */
import { walk } from 'zimmerframe';

@@ -6,10 +8,8 @@ import * as b from '../utils/builders.js';

* Gets the left-most identifier of a member expression or identifier.
* @param {import('estree').MemberExpression | import('estree').Identifier} expression
* @returns {import('estree').Identifier | null}
* @param {ESTree.MemberExpression | ESTree.Identifier} expression
* @returns {ESTree.Identifier | null}
*/
export function object(expression) {
while (expression.type === 'MemberExpression') {
expression = /** @type {import('estree').MemberExpression | import('estree').Identifier} */ (
expression.object
);
expression = /** @type {ESTree.MemberExpression | ESTree.Identifier} */ (expression.object);
}

@@ -26,4 +26,4 @@

* Returns true if the attribute contains a single static text node.
* @param {import('#compiler').Attribute} attribute
* @returns {attribute is import('#compiler').Attribute & { value: [import('#compiler').Text] }}
* @param {Attribute} attribute
* @returns {attribute is Attribute & { value: [Text] }}
*/

@@ -38,4 +38,4 @@ export function is_text_attribute(attribute) {

* Returns true if the attribute contains a single expression node.
* @param {import('#compiler').Attribute} attribute
* @returns {attribute is import('#compiler').Attribute & { value: [import('#compiler').ExpressionTag] }}
* @param {Attribute} attribute
* @returns {attribute is Attribute & { value: [ExpressionTag] }}
*/

@@ -52,4 +52,4 @@ export function is_expression_attribute(attribute) {

* Returns true if the attribute starts with `on` and contains a single expression node.
* @param {import('#compiler').Attribute} attribute
* @returns {attribute is import('#compiler').Attribute & { value: [import('#compiler').ExpressionTag] }}
* @param {Attribute} attribute
* @returns {attribute is Attribute & { value: [ExpressionTag] }}
*/

@@ -62,5 +62,5 @@ export function is_event_attribute(attribute) {

* Extracts all identifiers from a pattern.
* @param {import('estree').Pattern} param
* @param {import('estree').Identifier[]} [nodes]
* @returns {import('estree').Identifier[]}
* @param {ESTree.Pattern} param
* @param {ESTree.Identifier[]} [nodes]
* @returns {ESTree.Identifier[]}
*/

@@ -105,7 +105,7 @@ export function extract_identifiers(param, nodes = []) {

* Extracts all identifiers and a stringified keypath from an expression.
* @param {import('estree').Expression} expr
* @returns {[keypath: string, ids: import('estree').Identifier[]]}
* @param {ESTree.Expression} expr
* @returns {[keypath: string, ids: ESTree.Identifier[]]}
*/
export function extract_all_identifiers_from_expression(expr) {
/** @type {import('estree').Identifier[]} */
/** @type {ESTree.Identifier[]} */
let nodes = [];

@@ -152,4 +152,4 @@ /** @type {string[]} */

* Extracts all leaf identifiers from a destructuring expression.
* @param {import('estree').Identifier | import('estree').ObjectExpression | import('estree').ArrayExpression} node
* @param {import('estree').Identifier[]} [nodes]
* @param {ESTree.Identifier | ESTree.ObjectExpression | ESTree.ArrayExpression} node
* @param {ESTree.Identifier[]} [nodes]
* @returns

@@ -191,9 +191,9 @@ */

* @typedef {Object} DestructuredAssignment
* @property {import('estree').Identifier | import('estree').MemberExpression} node The node the destructuring path end in. Can be a member expression only for assignment expressions
* @property {ESTree.Identifier | ESTree.MemberExpression} node The node the destructuring path end in. Can be a member expression only for assignment expressions
* @property {boolean} is_rest `true` if this is a `...rest` destructuring
* @property {boolean} has_default_value `true` if this has a fallback value like `const { foo = 'bar } = ..`
* @property {(expression: import('estree').Expression) => import('estree').Identifier | import('estree').MemberExpression | import('estree').CallExpression | import('estree').AwaitExpression} expression Returns an expression which walks the path starting at the given expression.
* @property {(expression: ESTree.Expression) => ESTree.Identifier | ESTree.MemberExpression | ESTree.CallExpression | ESTree.AwaitExpression} expression Returns an expression which walks the path starting at the given expression.
* This will be a call expression if a rest element or default is involved — e.g. `const { foo: { bar: baz = 42 }, ...rest } = quux` — since we can't represent `baz` or `rest` purely as a path
* Will be an await expression in case of an async default value (`const { foo = await bar } = ...`)
* @property {(expression: import('estree').Expression) => import('estree').Identifier | import('estree').MemberExpression | import('estree').CallExpression | import('estree').AwaitExpression} update_expression Like `expression` but without default values.
* @property {(expression: ESTree.Expression) => ESTree.Identifier | ESTree.MemberExpression | ESTree.CallExpression | ESTree.AwaitExpression} update_expression Like `expression` but without default values.
*/

@@ -203,3 +203,3 @@

* Extracts all destructured assignments from a pattern.
* @param {import('estree').Node} param
* @param {ESTree.Node} param
* @returns {DestructuredAssignment[]}

@@ -211,4 +211,4 @@ */

param,
(node) => /** @type {import('estree').Identifier | import('estree').MemberExpression} */ (node),
(node) => /** @type {import('estree').Identifier | import('estree').MemberExpression} */ (node),
(node) => /** @type {ESTree.Identifier | ESTree.MemberExpression} */ (node),
(node) => /** @type {ESTree.Identifier | ESTree.MemberExpression} */ (node),
false

@@ -220,3 +220,3 @@ );

* @param {DestructuredAssignment[]} assignments
* @param {import('estree').Node} param
* @param {ESTree.Node} param
* @param {DestructuredAssignment['expression']} expression

@@ -245,3 +245,3 @@ * @param {DestructuredAssignment['update_expression']} update_expression

const rest_expression = (object) => {
/** @type {import('estree').Expression[]} */
/** @type {ESTree.Expression[]} */
const props = [];

@@ -366,3 +366,3 @@ for (const p of param.properties) {

*
* @template {import('#compiler').SvelteNode} T
* @template {SvelteNode} T
* @param {T[]} path

@@ -385,3 +385,3 @@ * @param {number} at

* reading signals prematurely)
* @param {import('estree').Expression} node
* @param {ESTree.Expression} node
* @returns {boolean}

@@ -415,4 +415,4 @@ */

/**
* @template {import('estree').SimpleCallExpression | import('estree').MemberExpression} T
* @param {import('estree').ChainExpression & { expression : T } | T} node
* @template {ESTree.SimpleCallExpression | ESTree.MemberExpression} T
* @param {ESTree.ChainExpression & { expression : T } | T} node
* @returns {T}

@@ -425,3 +425,3 @@ */

/**
* @param {import('estree').Expression | import('estree').Pattern} expression
* @param {ESTree.Expression | ESTree.Pattern} expression
* @returns {boolean}

@@ -428,0 +428,0 @@ */

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

/** @import * as ESTree from 'estree' */
import { regex_is_valid_identifier } from '../phases/patterns.js';

@@ -5,4 +6,4 @@ import { sanitize_template_string } from './sanitize_template_string.js';

/**
* @param {Array<import('estree').Expression | import('estree').SpreadElement | null>} elements
* @returns {import('estree').ArrayExpression}
* @param {Array<ESTree.Expression | ESTree.SpreadElement | null>} elements
* @returns {ESTree.ArrayExpression}
*/

@@ -14,4 +15,4 @@ export function array(elements = []) {

/**
* @param {Array<import('estree').Pattern | null>} elements
* @returns {import('estree').ArrayPattern}
* @param {Array<ESTree.Pattern | null>} elements
* @returns {ESTree.ArrayPattern}
*/

@@ -23,5 +24,5 @@ export function array_pattern(elements) {

/**
* @param {import('estree').Pattern} left
* @param {import('estree').Expression} right
* @returns {import('estree').AssignmentPattern}
* @param {ESTree.Pattern} left
* @param {ESTree.Expression} right
* @returns {ESTree.AssignmentPattern}
*/

@@ -33,5 +34,5 @@ export function assignment_pattern(left, right) {

/**
* @param {Array<import('estree').Pattern>} params
* @param {import('estree').BlockStatement | import('estree').Expression} body
* @returns {import('estree').ArrowFunctionExpression}
* @param {Array<ESTree.Pattern>} params
* @param {ESTree.BlockStatement | ESTree.Expression} body
* @returns {ESTree.ArrowFunctionExpression}
*/

@@ -51,6 +52,6 @@ export function arrow(params, body) {

/**
* @param {import('estree').AssignmentOperator} operator
* @param {import('estree').Pattern} left
* @param {import('estree').Expression} right
* @returns {import('estree').AssignmentExpression}
* @param {ESTree.AssignmentOperator} operator
* @param {ESTree.Pattern} left
* @param {ESTree.Expression} right
* @returns {ESTree.AssignmentExpression}
*/

@@ -63,4 +64,4 @@ export function assignment(operator, left, right) {

* @template T
* @param {T & import('estree').BaseFunction} func
* @returns {T & import('estree').BaseFunction}
* @param {T & ESTree.BaseFunction} func
* @returns {T & ESTree.BaseFunction}
*/

@@ -72,4 +73,4 @@ export function async(func) {

/**
* @param {import('estree').Expression} argument
* @returns {import('estree').AwaitExpression}
* @param {ESTree.Expression} argument
* @returns {ESTree.AwaitExpression}
*/

@@ -81,6 +82,6 @@ function await_builder(argument) {

/**
* @param {import('estree').BinaryOperator} operator
* @param {import('estree').Expression} left
* @param {import('estree').Expression} right
* @returns {import('estree').BinaryExpression}
* @param {ESTree.BinaryOperator} operator
* @param {ESTree.Expression} left
* @param {ESTree.Expression} right
* @returns {ESTree.BinaryExpression}
*/

@@ -92,4 +93,4 @@ export function binary(operator, left, right) {

/**
* @param {import('estree').Statement[]} body
* @returns {import('estree').BlockStatement}
* @param {ESTree.Statement[]} body
* @returns {ESTree.BlockStatement}
*/

@@ -102,4 +103,4 @@ export function block(body) {

* @param {string} name
* @param {import('estree').Statement} body
* @returns {import('estree').LabeledStatement}
* @param {ESTree.Statement} body
* @returns {ESTree.LabeledStatement}
*/

@@ -111,5 +112,5 @@ export function labeled(name, body) {

/**
* @param {string | import('estree').Expression} callee
* @param {...(import('estree').Expression | import('estree').SpreadElement | false | undefined)} args
* @returns {import('estree').CallExpression}
* @param {string | ESTree.Expression} callee
* @param {...(ESTree.Expression | ESTree.SpreadElement | false | undefined)} args
* @returns {ESTree.CallExpression}
*/

@@ -138,5 +139,3 @@ export function call(callee, ...args) {

callee,
arguments: /** @type {Array<import('estree').Expression | import('estree').SpreadElement>} */ (
args
),
arguments: /** @type {Array<ESTree.Expression | ESTree.SpreadElement>} */ (args),
optional: false

@@ -147,8 +146,8 @@ };

/**
* @param {string | import('estree').Expression} callee
* @param {...import('estree').Expression} args
* @returns {import('estree').ChainExpression}
* @param {string | ESTree.Expression} callee
* @param {...ESTree.Expression} args
* @returns {ESTree.ChainExpression}
*/
export function maybe_call(callee, ...args) {
const expression = /** @type {import('estree').SimpleCallExpression} */ (call(callee, ...args));
const expression = /** @type {ESTree.SimpleCallExpression} */ (call(callee, ...args));
expression.optional = true;

@@ -163,5 +162,5 @@

/**
* @param {import('estree').UnaryOperator} operator
* @param {import('estree').Expression} argument
* @returns {import('estree').UnaryExpression}
* @param {ESTree.UnaryOperator} operator
* @param {ESTree.Expression} argument
* @returns {ESTree.UnaryExpression}
*/

@@ -173,6 +172,6 @@ export function unary(operator, argument) {

/**
* @param {import('estree').Expression} test
* @param {import('estree').Expression} consequent
* @param {import('estree').Expression} alternate
* @returns {import('estree').ConditionalExpression}
* @param {ESTree.Expression} test
* @param {ESTree.Expression} consequent
* @param {ESTree.Expression} alternate
* @returns {ESTree.ConditionalExpression}
*/

@@ -184,6 +183,6 @@ export function conditional(test, consequent, alternate) {

/**
* @param {import('estree').LogicalOperator} operator
* @param {import('estree').Expression} left
* @param {import('estree').Expression} right
* @returns {import('estree').LogicalExpression}
* @param {ESTree.LogicalOperator} operator
* @param {ESTree.Expression} left
* @param {ESTree.Expression} right
* @returns {ESTree.LogicalExpression}
*/

@@ -196,5 +195,5 @@ export function logical(operator, left, right) {

* @param {'const' | 'let' | 'var'} kind
* @param {string | import('estree').Pattern} pattern
* @param {import('estree').Expression} [init]
* @returns {import('estree').VariableDeclaration}
* @param {string | ESTree.Pattern} pattern
* @param {ESTree.Expression} [init]
* @returns {ESTree.VariableDeclaration}
*/

@@ -212,5 +211,5 @@ export function declaration(kind, pattern, init) {

/**
* @param {import('estree').Pattern} id
* @param {import('estree').Expression} [init]
* @returns {import('estree').VariableDeclarator}
* @param {ESTree.Pattern} id
* @param {ESTree.Expression} [init]
* @returns {ESTree.VariableDeclarator}
*/

@@ -221,3 +220,3 @@ export function declarator(id, init) {

/** @type {import('estree').EmptyStatement} */
/** @type {ESTree.EmptyStatement} */
export const empty = {

@@ -228,4 +227,4 @@ type: 'EmptyStatement'

/**
* @param {import('estree').Expression | import('estree').MaybeNamedClassDeclaration | import('estree').MaybeNamedFunctionDeclaration} declaration
* @returns {import('estree').ExportDefaultDeclaration}
* @param {ESTree.Expression | ESTree.MaybeNamedClassDeclaration | ESTree.MaybeNamedFunctionDeclaration} declaration
* @returns {ESTree.ExportDefaultDeclaration}
*/

@@ -237,6 +236,6 @@ export function export_default(declaration) {

/**
* @param {import('estree').Identifier} id
* @param {import('estree').Pattern[]} params
* @param {import('estree').BlockStatement} body
* @returns {import('estree').FunctionDeclaration}
* @param {ESTree.Identifier} id
* @param {ESTree.Pattern[]} params
* @param {ESTree.BlockStatement} body
* @returns {ESTree.FunctionDeclaration}
*/

@@ -257,4 +256,4 @@ export function function_declaration(id, params, body) {

* @param {string} name
* @param {import('estree').Statement[]} body
* @returns {import('estree').Property & { value: import('estree').FunctionExpression}}}
* @param {ESTree.Statement[]} body
* @returns {ESTree.Property & { value: ESTree.FunctionExpression}}}
*/

@@ -267,3 +266,3 @@ export function get(name, body) {

* @param {string} name
* @returns {import('estree').Identifier}
* @returns {ESTree.Identifier}
*/

@@ -276,3 +275,3 @@ export function id(name) {

* @param {string} name
* @returns {import('estree').PrivateIdentifier}
* @returns {ESTree.PrivateIdentifier}
*/

@@ -285,3 +284,3 @@ export function private_id(name) {

* @param {string} local
* @returns {import('estree').ImportNamespaceSpecifier}
* @returns {ESTree.ImportNamespaceSpecifier}
*/

@@ -297,4 +296,4 @@ function import_namespace(local) {

* @param {string} name
* @param {import('estree').Expression} value
* @returns {import('estree').Property}
* @param {ESTree.Expression} value
* @returns {ESTree.Property}
*/

@@ -307,3 +306,3 @@ export function init(name, value) {

* @param {string | boolean | null | number | RegExp} value
* @returns {import('estree').Literal}
* @returns {ESTree.Literal}
*/

@@ -316,7 +315,7 @@ export function literal(value) {

/**
* @param {import('estree').Expression | import('estree').Super} object
* @param {import('estree').Expression | import('estree').PrivateIdentifier} property
* @param {ESTree.Expression | ESTree.Super} object
* @param {ESTree.Expression | ESTree.PrivateIdentifier} property
* @param {boolean} computed
* @param {boolean} optional
* @returns {import('estree').MemberExpression}
* @returns {ESTree.MemberExpression}
*/

@@ -329,3 +328,3 @@ export function member(object, property, computed = false, optional = false) {

* @param {string} path
* @returns {import('estree').Identifier | import('estree').MemberExpression}
* @returns {ESTree.Identifier | ESTree.MemberExpression}
*/

@@ -335,3 +334,3 @@ export function member_id(path) {

/** @type {import('estree').Identifier | import('estree').MemberExpression} */
/** @type {ESTree.Identifier | ESTree.MemberExpression} */
let expression = id(parts[0]);

@@ -346,4 +345,4 @@

/**
* @param {Array<import('estree').Property | import('estree').SpreadElement>} properties
* @returns {import('estree').ObjectExpression}
* @param {Array<ESTree.Property | ESTree.SpreadElement>} properties
* @returns {ESTree.ObjectExpression}
*/

@@ -355,4 +354,4 @@ export function object(properties) {

/**
* @param {Array<import('estree').RestElement | import('estree').AssignmentProperty>} properties
* @returns {import('estree').ObjectPattern}
* @param {Array<ESTree.RestElement | ESTree.AssignmentProperty>} properties
* @returns {ESTree.ObjectPattern}
*/

@@ -364,8 +363,8 @@ export function object_pattern(properties) {

/**
* @template {import('estree').Expression} Value
* @template {ESTree.Expression} Value
* @param {'init' | 'get' | 'set'} kind
* @param {import('estree').Expression} key
* @param {ESTree.Expression} key
* @param {Value} value
* @param {boolean} computed
* @returns {import('estree').Property & { value: Value }}
* @returns {ESTree.Property & { value: Value }}
*/

@@ -377,7 +376,7 @@ export function prop(kind, key, value, computed = false) {

/**
* @param {import('estree').Expression | import('estree').PrivateIdentifier} key
* @param {import('estree').Expression | null | undefined} value
* @param {ESTree.Expression | ESTree.PrivateIdentifier} key
* @param {ESTree.Expression | null | undefined} value
* @param {boolean} computed
* @param {boolean} is_static
* @returns {import('estree').PropertyDefinition}
* @returns {ESTree.PropertyDefinition}
*/

@@ -391,3 +390,3 @@ export function prop_def(key, value, computed = false, is_static = false) {

* @param {boolean} tail
* @returns {import('estree').TemplateElement}
* @returns {ESTree.TemplateElement}
*/

@@ -400,4 +399,4 @@ export function quasi(cooked, tail = false) {

/**
* @param {import('estree').Pattern} argument
* @returns {import('estree').RestElement}
* @param {ESTree.Pattern} argument
* @returns {ESTree.RestElement}
*/

@@ -409,4 +408,4 @@ export function rest(argument) {

/**
* @param {import('estree').Expression[]} expressions
* @returns {import('estree').SequenceExpression}
* @param {ESTree.Expression[]} expressions
* @returns {ESTree.SequenceExpression}
*/

@@ -419,4 +418,4 @@ export function sequence(expressions) {

* @param {string} name
* @param {import('estree').Statement[]} body
* @returns {import('estree').Property & { value: import('estree').FunctionExpression}}
* @param {ESTree.Statement[]} body
* @returns {ESTree.Property & { value: ESTree.FunctionExpression}}
*/

@@ -428,4 +427,4 @@ export function set(name, body) {

/**
* @param {import('estree').Expression} argument
* @returns {import('estree').SpreadElement}
* @param {ESTree.Expression} argument
* @returns {ESTree.SpreadElement}
*/

@@ -437,4 +436,4 @@ export function spread(argument) {

/**
* @param {import('estree').Expression} expression
* @returns {import('estree').ExpressionStatement}
* @param {ESTree.Expression} expression
* @returns {ESTree.ExpressionStatement}
*/

@@ -446,5 +445,5 @@ export function stmt(expression) {

/**
* @param {import('estree').TemplateElement[]} elements
* @param {import('estree').Expression[]} expressions
* @returns {import('estree').TemplateLiteral}
* @param {ESTree.TemplateElement[]} elements
* @param {ESTree.Expression[]} expressions
* @returns {ESTree.TemplateLiteral}
*/

@@ -456,5 +455,5 @@ export function template(elements, expressions) {

/**
* @param {import('estree').Expression | import('estree').BlockStatement} expression
* @param {ESTree.Expression | ESTree.BlockStatement} expression
* @param {boolean} [async]
* @returns {import('estree').Expression}
* @returns {ESTree.Expression}
*/

@@ -479,5 +478,5 @@ export function thunk(expression, async = false) {

*
* @param {string | import('estree').Expression} expression
* @param {...import('estree').Expression} args
* @returns {import('estree').NewExpression}
* @param {string | ESTree.Expression} expression
* @param {...ESTree.Expression} args
* @returns {ESTree.NewExpression}
*/

@@ -495,6 +494,6 @@ function new_builder(expression, ...args) {

/**
* @param {import('estree').UpdateOperator} operator
* @param {import('estree').Expression} argument
* @param {ESTree.UpdateOperator} operator
* @param {ESTree.Expression} argument
* @param {boolean} prefix
* @returns {import('estree').UpdateExpression}
* @returns {ESTree.UpdateExpression}
*/

@@ -506,5 +505,5 @@ export function update(operator, argument, prefix = false) {

/**
* @param {import('estree').Expression} test
* @param {import('estree').Statement} body
* @returns {import('estree').DoWhileStatement}
* @param {ESTree.Expression} test
* @param {ESTree.Statement} body
* @returns {ESTree.DoWhileStatement}
*/

@@ -519,3 +518,3 @@ export function do_while(test, body) {

/** @type {import('estree').DebuggerStatement} */
/** @type {ESTree.DebuggerStatement} */
const debugger_builder = {

@@ -525,3 +524,3 @@ type: 'DebuggerStatement'

/** @type {import('estree').ThisExpression} */
/** @type {ESTree.ThisExpression} */
const this_instance = {

@@ -532,5 +531,5 @@ type: 'ThisExpression'

/**
* @param {string | import('estree').Pattern} pattern
* @param { import('estree').Expression} [init]
* @returns {import('estree').VariableDeclaration}
* @param {string | ESTree.Pattern} pattern
* @param { ESTree.Expression} [init]
* @returns {ESTree.VariableDeclaration}
*/

@@ -542,5 +541,5 @@ function let_builder(pattern, init) {

/**
* @param {string | import('estree').Pattern} pattern
* @param { import('estree').Expression} init
* @returns {import('estree').VariableDeclaration}
* @param {string | ESTree.Pattern} pattern
* @param { ESTree.Expression} init
* @returns {ESTree.VariableDeclaration}
*/

@@ -552,5 +551,5 @@ function const_builder(pattern, init) {

/**
* @param {string | import('estree').Pattern} pattern
* @param { import('estree').Expression} [init]
* @returns {import('estree').VariableDeclaration}
* @param {string | ESTree.Pattern} pattern
* @param { ESTree.Expression} [init]
* @returns {ESTree.VariableDeclaration}
*/

@@ -563,7 +562,7 @@ function var_builder(pattern, init) {

*
* @param {import('estree').VariableDeclaration | import('estree').Expression | null} init
* @param {import('estree').Expression} test
* @param {import('estree').Expression} update
* @param {import('estree').Statement} body
* @returns {import('estree').ForStatement}
* @param {ESTree.VariableDeclaration | ESTree.Expression | null} init
* @param {ESTree.Expression} test
* @param {ESTree.Expression} update
* @param {ESTree.Statement} body
* @returns {ESTree.ForStatement}
*/

@@ -577,8 +576,8 @@ function for_builder(init, test, update, body) {

* @param {'constructor' | 'method' | 'get' | 'set'} kind
* @param {import('estree').Expression | import('estree').PrivateIdentifier} key
* @param {import('estree').Pattern[]} params
* @param {import('estree').Statement[]} body
* @param {ESTree.Expression | ESTree.PrivateIdentifier} key
* @param {ESTree.Pattern[]} params
* @param {ESTree.Statement[]} body
* @param {boolean} computed
* @param {boolean} is_static
* @returns {import('estree').MethodDefinition}
* @returns {ESTree.MethodDefinition}
*/

@@ -598,6 +597,6 @@ export function method(kind, key, params, body, computed = false, is_static = false) {

*
* @param {import('estree').Identifier | null} id
* @param {import('estree').Pattern[]} params
* @param {import('estree').BlockStatement} body
* @returns {import('estree').FunctionExpression}
* @param {ESTree.Identifier | null} id
* @param {ESTree.Pattern[]} params
* @param {ESTree.BlockStatement} body
* @returns {ESTree.FunctionExpression}
*/

@@ -617,6 +616,6 @@ function function_builder(id, params, body) {

/**
* @param {import('estree').Expression} test
* @param {import('estree').Statement} consequent
* @param {import('estree').Statement} [alternate]
* @returns {import('estree').IfStatement}
* @param {ESTree.Expression} test
* @param {ESTree.Statement} consequent
* @param {ESTree.Statement} [alternate]
* @returns {ESTree.IfStatement}
*/

@@ -630,3 +629,3 @@ function if_builder(test, consequent, alternate) {

* @param {string} source
* @returns {import('estree').ImportDeclaration}
* @returns {ESTree.ImportDeclaration}
*/

@@ -644,3 +643,3 @@ export function import_all(as, source) {

* @param {string} source
* @returns {import('estree').ImportDeclaration}
* @returns {ESTree.ImportDeclaration}
*/

@@ -660,4 +659,4 @@ export function imports(parts, source) {

/**
* @param {import('estree').Expression | null} argument
* @returns {import('estree').ReturnStatement}
* @param {ESTree.Expression | null} argument
* @returns {ESTree.ReturnStatement}
*/

@@ -670,3 +669,3 @@ function return_builder(argument = null) {

* @param {string} str
* @returns {import('estree').ThrowStatement}
* @returns {ESTree.ThrowStatement}
*/

@@ -698,3 +697,3 @@ export function throw_error(str) {

* @param {string} name
* @returns {import('estree').Expression}
* @returns {ESTree.Expression}
*/

@@ -701,0 +700,0 @@ export function key(name) {

@@ -0,1 +1,6 @@

/** @import { ValidatedCompileOptions } from '#compiler' */
/** @import { Processed } from '../preprocess/public.js' */
/** @import { SourceMap } from 'magic-string' */
/** @import { Source } from '../preprocess/private.js' */
/** @import { DecodedSourceMap, SourceMapSegment, RawSourceMap } from '@ampproject/remapping' */
import remapping from '@ampproject/remapping';

@@ -13,3 +18,3 @@ import { push_array } from './push_array.js';

/**
* @param {import('@ampproject/remapping').DecodedSourceMap} map
* @param {DecodedSourceMap} map
* @param {{ line: number; column: number; }} offset

@@ -78,3 +83,3 @@ * @param {number} source_index

/**
* @type {import('@ampproject/remapping').DecodedSourceMap}
* @type {DecodedSourceMap}
*/

@@ -85,3 +90,3 @@ map = /** @type {any} */ (undefined);

* @param {string} string
* @param {import('@ampproject/remapping').DecodedSourceMap | null} map
* @param {DecodedSourceMap | null} map
*/

@@ -177,3 +182,3 @@ constructor(string = '', map = null) {

m1.mappings[m1.mappings.length - 1],
/** @type {import('@ampproject/remapping').SourceMapSegment[]} */ (m2.mappings.shift())
/** @type {SourceMapSegment[]} */ (m2.mappings.shift())
);

@@ -188,3 +193,3 @@ // append other lines

* @param {string} string
* @param {import('@ampproject/remapping').DecodedSourceMap} [map]
* @param {DecodedSourceMap} [map]
* @returns {MappedCode}

@@ -213,3 +218,3 @@ */

* @static
* @param {import('../preprocess/private.js').Source} opts
* @param {Source} opts
* @returns {MappedCode}

@@ -225,3 +230,3 @@ */

/**
* @type {import('@ampproject/remapping').DecodedSourceMap}
* @type {DecodedSourceMap}
*/

@@ -265,3 +270,3 @@ const map = { version: 3, names: [], sources: [file_basename], mappings: [] };

* @param {string} filename Basename of the input file
* @param {Array<import('@ampproject/remapping').DecodedSourceMap | import('@ampproject/remapping').RawSourceMap>} sourcemap_list
* @param {Array<DecodedSourceMap | RawSourceMap>} sourcemap_list
*/

@@ -307,5 +312,5 @@ export function combine_sourcemaps(filename, sourcemap_list) {

* @param {string} filename
* @param {import('magic-string').SourceMap} svelte_map
* @param {string | import('@ampproject/remapping').DecodedSourceMap | import('@ampproject/remapping').RawSourceMap} preprocessor_map_input
* @returns {import('magic-string').SourceMap}
* @param {SourceMap} svelte_map
* @param {string | DecodedSourceMap | RawSourceMap} preprocessor_map_input
* @returns {SourceMap}
*/

@@ -335,3 +340,3 @@ function apply_preprocessor_sourcemap(filename, svelte_map, preprocessor_map_input) {

});
return /** @type {import('magic-string').SourceMap} */ (result_map);
return /** @type {SourceMap} */ (result_map);
}

@@ -342,3 +347,3 @@ const regex_data_uri = /data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(\S*)/;

/**
* @param {import('../preprocess/public.js').Processed} processed
* @param {Processed} processed
* @param {'script' | 'style'} tag_name

@@ -396,4 +401,4 @@ * @returns {void}

/**
* @param {{ code: string, map: import('magic-string').SourceMap}} result
* @param {import('#compiler').ValidatedCompileOptions} options
* @param {{ code: string, map: SourceMap}} result
* @param {ValidatedCompileOptions} options
* @param {string} source_name

@@ -400,0 +405,0 @@ */

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

/** @import { ModuleCompileOptions, ValidatedModuleCompileOptions, CompileOptions, ValidatedCompileOptions } from '#compiler' */
import * as e from './errors.js';

@@ -35,3 +36,3 @@ import * as w from './warnings.js';

export const validate_module_options =
/** @type {Validator<import('#compiler').ModuleCompileOptions, import('#compiler').ValidatedModuleCompileOptions>} */ (
/** @type {Validator<ModuleCompileOptions, ValidatedModuleCompileOptions>} */ (
object({

@@ -43,3 +44,3 @@ ...common

export const validate_component_options =
/** @type {Validator<import('#compiler').CompileOptions, import('#compiler').ValidatedCompileOptions>} */ (
/** @type {Validator<CompileOptions, ValidatedCompileOptions>} */ (
object({

@@ -46,0 +47,0 @@ ...common,

@@ -259,2 +259,3 @@ // This should contain all the public interfaces (not all of them are actually importable, check current Svelte for which ones are).

// Use an interface instead of a type, makes for better intellisense info because the type is named in more situations.
/**

@@ -271,16 +272,13 @@ * The type of a `#snippet` block. You can use it to (for example) express that your component expects a snippet of a certain type:

*/
export type Snippet<Parameters extends unknown[] = []> =
// this conditional allows tuples but not arrays. Arrays would indicate a
// rest parameter type, which is not supported. If rest parameters are added
// in the future, the condition can be removed.
number extends Parameters['length']
? never
: {
(
this: void,
...args: Parameters
): typeof SnippetReturn & {
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
};
};
export interface Snippet<Parameters extends unknown[] = []> {
(
this: void,
// this conditional allows tuples but not arrays. Arrays would indicate a
// rest parameter type, which is not supported. If rest parameters are added
// in the future, the condition can be removed.
...args: number extends Parameters['length'] ? never : Parameters
): typeof SnippetReturn & {
_: 'functions passed to {@render ...} tags must use the `Snippet` type imported from "svelte"';
};
}

@@ -287,0 +285,0 @@ interface DispatchOptions {

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

/** @import { SourceLocation } from '../../../compiler/phases/3-transform/client/types.js' */
import { HYDRATION_END, HYDRATION_START } from '../../../constants.js';

@@ -7,3 +8,3 @@ import { hydrating } from '../dom/hydration.js';

* @param {string} filename
* @param {import('../../../compiler/phases/3-transform/client/types.js').SourceLocation[]} locations
* @param {SourceLocation[]} locations
* @returns {any}

@@ -25,3 +26,3 @@ */

* @param {string} filename
* @param {import('../../../compiler/phases/3-transform/client/types.js').SourceLocation} location
* @param {SourceLocation} location
*/

@@ -42,3 +43,3 @@ function assign_location(element, filename, location) {

* @param {string} filename
* @param {import('../../../compiler/phases/3-transform/client/types.js').SourceLocation[]} locations
* @param {SourceLocation[]} locations
*/

@@ -45,0 +46,0 @@ function assign_locations(node, filename, locations) {

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

/** @import { Source, Effect } from '#client' */
import { block, branch, destroy_effect } from '../reactivity/effects.js';

@@ -8,3 +9,3 @@ import { set_should_intro } from '../render.js';

* @template {(anchor: Comment, props: any) => any} Component
* @param {import("#client").Source<Component>} source
* @param {Source<Component>} source
*/

@@ -19,3 +20,3 @@ export function hmr(source) {

/** @type {import("#client").Effect} */
/** @type {Effect} */
let effect;

@@ -22,0 +23,0 @@

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

/** @import { ProxyMetadata } from '#client' */
/** @typedef {{ file: string, line: number, column: number }} Location */

@@ -137,4 +138,4 @@

/**
* @param {import('#client').ProxyMetadata<any> | null} from
* @param {import('#client').ProxyMetadata<any>} to
* @param {ProxyMetadata<any> | null} from
* @param {ProxyMetadata<any>} to
*/

@@ -166,3 +167,3 @@ export function widen_ownership(from, to) {

function add_owner_to_object(object, owner, seen) {
const metadata = /** @type {import('#client').ProxyMetadata} */ (object?.[STATE_SYMBOL]);
const metadata = /** @type {ProxyMetadata} */ (object?.[STATE_SYMBOL]);

@@ -204,3 +205,3 @@ if (metadata) {

/**
* @param {import('#client').ProxyMetadata} metadata
* @param {ProxyMetadata} metadata
* @param {Function} component

@@ -221,3 +222,3 @@ * @returns {boolean}

/**
* @param {import('#client').ProxyMetadata} metadata
* @param {ProxyMetadata} metadata
* @returns {any}

@@ -228,3 +229,3 @@ */

metadata?.owners?.values().next().value ??
get_owner(/** @type {import('#client').ProxyMetadata} */ (metadata.parent))
get_owner(/** @type {ProxyMetadata} */ (metadata.parent))
);

@@ -234,3 +235,3 @@ }

/**
* @param {import('#client').ProxyMetadata} metadata
* @param {ProxyMetadata} metadata
*/

@@ -237,0 +238,0 @@ export function check_ownership(metadata) {

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

/** @import { Dom, Effect } from '#client' */
import { UNINITIALIZED } from '../../../../constants.js';

@@ -9,3 +10,3 @@ import { block, branch, pause_effect } from '../../reactivity/effects.js';

* @param {() => V} get_key
* @param {(anchor: Node) => import('#client').Dom | void} render_fn
* @param {(anchor: Node) => Dom | void} render_fn
* @returns {void}

@@ -17,3 +18,3 @@ */

/** @type {import('#client').Effect} */
/** @type {Effect} */
let effect;

@@ -20,0 +21,0 @@

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

/** @import { TemplateNode, Dom, Effect } from '#client' */
import { DEV } from 'esm-env';

@@ -8,5 +9,5 @@ import { block, branch, pause_effect } from '../../reactivity/effects.js';

* @template {(props: P) => void} C
* @param {import('#client').TemplateNode} anchor
* @param {TemplateNode} anchor
* @param {() => C} get_component
* @param {(anchor: import('#client').TemplateNode, component: C) => import('#client').Dom | void} render_fn
* @param {(anchor: TemplateNode, component: C) => Dom | void} render_fn
* @returns {void}

@@ -18,3 +19,3 @@ */

/** @type {import('#client').Effect | null} */
/** @type {Effect | null} */
let effect;

@@ -21,0 +22,0 @@

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

/** @import { ActionPayload } from '#client' */
import { effect, render_effect } from '../../reactivity/effects.js';

@@ -7,3 +8,3 @@ import { deep_read_state, untrack } from '../../runtime.js';

* @param {Element} dom
* @param {(dom: Element, value?: P) => import('#client').ActionPayload<P>} action
* @param {(dom: Element, value?: P) => ActionPayload<P>} action
* @param {() => P} [get_value]

@@ -10,0 +11,0 @@ * @returns {void}

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

/** @import { ComponentContextLegacy } from '#client' */
import { run, run_all } from '../../../shared/utils.js';

@@ -9,5 +10,3 @@ import { user_pre_effect, user_effect } from '../../reactivity/effects.js';

export function init() {
const context = /** @type {import('#client').ComponentContextLegacy} */ (
current_component_context
);
const context = /** @type {ComponentContextLegacy} */ (current_component_context);

@@ -49,3 +48,3 @@ const callbacks = context.l.u;

* so they can be registered to the effect this function is called in.
* @param {import('#client').ComponentContextLegacy} context
* @param {ComponentContextLegacy} context
*/

@@ -52,0 +51,0 @@ function observe_all(context) {

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

/** @import { TaskCallback, Task, TaskEntry } from '#client' */
import { raf } from './timing.js';

@@ -25,7 +26,7 @@

* until it returns a falsy value or is aborted
* @param {import('#client').TaskCallback} callback
* @returns {import('#client').Task}
* @param {TaskCallback} callback
* @returns {Task}
*/
export function loop(callback) {
/** @type {import('#client').TaskEntry} */
/** @type {TaskEntry} */
let task;

@@ -32,0 +33,0 @@

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

/** @type {import('#client').Equals} */
/** @import { Equals } from '#client' */
/** @type {Equals} */
export function equals(value) {

@@ -17,5 +18,5 @@ return value === this.v;

/** @type {import('#client').Equals} */
/** @type {Equals} */
export function safe_equals(value) {
return !safe_not_equal(value, this.v);
}

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

/** @import { Source } from './types.js' */
import { DEV } from 'esm-env';

@@ -91,3 +92,3 @@ import {

* 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> }>}}
* @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number> }>}}
*/

@@ -94,0 +95,0 @@ const legacy_rest_props_handler = {

@@ -0,1 +1,3 @@

/** @import { StoreReferencesContainer, Source } from '#client' */
/** @import { Store } from '#shared' */
import { subscribe_to_store } from '../../../store/utils.js';

@@ -13,9 +15,9 @@ import { noop } from '../../shared/utils.js';

* @template V
* @param {import('#shared').Store<V> | null | undefined} store
* @param {Store<V> | null | undefined} store
* @param {string} store_name
* @param {import('#client').StoreReferencesContainer} stores
* @param {StoreReferencesContainer} stores
* @returns {V}
*/
export function store_get(store, store_name, stores) {
/** @type {import('#client').StoreReferencesContainer[''] | undefined} */
/** @type {StoreReferencesContainer[''] | undefined} */
let entry = stores[store_name];

@@ -50,8 +52,8 @@ const is_new = entry === undefined;

* then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.
* @param {import('#shared').Store<any> | null | undefined} store
* @param {Store<any> | null | undefined} store
* @param {string} store_name
* @param {import('#client').StoreReferencesContainer} stores
* @param {StoreReferencesContainer} stores
*/
export function store_unsub(store, store_name, stores) {
/** @type {import('#client').StoreReferencesContainer[''] | undefined} */
/** @type {StoreReferencesContainer[''] | undefined} */
let entry = stores[store_name];

@@ -70,4 +72,4 @@

* @template V
* @param {import('#shared').Store<V> | null | undefined} store
* @param {import('#client').Source<V>} source
* @param {Store<V> | null | undefined} store
* @param {Source<V>} source
*/

@@ -86,3 +88,3 @@ function connect_store_to_signal(store, source) {

* @template V
* @param {import('#shared').Store<V>} store
* @param {Store<V>} store
* @param {V} value

@@ -97,3 +99,3 @@ * @returns {V}

/**
* @param {import('#client').StoreReferencesContainer} stores
* @param {StoreReferencesContainer} stores
* @param {string} store_name

@@ -110,3 +112,3 @@ */

* Unsubscribes from all auto-subscribed stores on destroy
* @param {import('#client').StoreReferencesContainer} stores
* @param {StoreReferencesContainer} stores
*/

@@ -125,3 +127,3 @@ export function unsubscribe_on_destroy(stores) {

* Updates a store with a new value.
* @param {import('#shared').Store<V>} store the store to update
* @param {Store<V>} store the store to update
* @param {any} expression the expression that mutates the store

@@ -137,3 +139,3 @@ * @param {V} new_value the new store value

/**
* @param {import('#shared').Store<number>} store
* @param {Store<number>} store
* @param {number} store_value

@@ -149,3 +151,3 @@ * @param {1 | -1} [d]

/**
* @param {import('#shared').Store<number>} store
* @param {Store<number>} store
* @param {number} store_value

@@ -152,0 +154,0 @@ * @param {1 | -1} [d]

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

/** @import { Raf } from '#client' */
import { noop } from '../shared/utils.js';

@@ -9,3 +10,3 @@

/** @type {import('#client').Raf} */
/** @type {Raf} */
export const raf = {

@@ -12,0 +13,0 @@ tick: /** @param {any} _ */ (_) => request_animation_frame(_),

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

/** @import { Component } from '#server' */
import { DEV } from 'esm-env';

@@ -5,3 +6,3 @@ import { on_destroy } from './index.js';

/** @type {import('#server').Component | null} */
/** @type {Component | null} */
export var current_component = null;

@@ -69,3 +70,3 @@

export function pop() {
var component = /** @type {import('#server').Component} */ (current_component);
var component = /** @type {Component} */ (current_component);

@@ -82,3 +83,3 @@ var ondestroy = component.d;

/**
* @param {import('#server').Component} component_context
* @param {Component} component_context
* @returns {Map<unknown, unknown> | null}

@@ -85,0 +86,0 @@ */

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

/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
import { proxy } from '../internal/client/proxy.js';

@@ -16,4 +17,4 @@ import { user_pre_effect } from '../internal/client/reactivity/effects.js';

*
* @param {import('svelte').ComponentConstructorOptions<Props> & {
* component: import('svelte').ComponentType<import('svelte').SvelteComponent<Props, Events, Slots>> | import('svelte').Component<Props>;
* @param {ComponentConstructorOptions<Props> & {
* component: ComponentType<SvelteComponent<Props, Events, Slots>> | Component<Props>;
* immutable?: boolean;

@@ -23,3 +24,3 @@ * hydrate?: boolean;

* }} options
* @returns {import('svelte').SvelteComponent<Props, Events, Slots> & Exports}
* @returns {SvelteComponent<Props, Events, Slots> & Exports}
*/

@@ -41,4 +42,4 @@ export function createClassComponent(options) {

*
* @param {import('svelte').SvelteComponent<Props, Events, Slots> | import('svelte').Component<Props>} component
* @returns {import('svelte').ComponentType<import('svelte').SvelteComponent<Props, Events, Slots> & Exports>}
* @param {SvelteComponent<Props, Events, Slots> | Component<Props>} component
* @returns {ComponentType<SvelteComponent<Props, Events, Slots> & Exports>}
*/

@@ -66,3 +67,3 @@ export function asClassComponent(component) {

/**
* @param {import('svelte').ComponentConstructorOptions & {
* @param {ComponentConstructorOptions & {
* component: any;

@@ -69,0 +70,0 @@ * immutable?: boolean;

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

/** @import { SvelteComponent } from '../index.js' */
import { asClassComponent as as_class_component, createClassComponent } from './legacy-client.js';

@@ -18,4 +19,4 @@ import { render } from '../internal/server/index.js';

*
* @param {import('../index.js').SvelteComponent<Props, Events, Slots>} component
* @returns {typeof import('../index.js').SvelteComponent<Props, Events, Slots> & Exports}
* @param {SvelteComponent<Props, Events, Slots>} component
* @returns {typeof SvelteComponent<Props, Events, Slots> & Exports}
*/

@@ -22,0 +23,0 @@ export function asClassComponent(component) {

@@ -0,1 +1,4 @@

/** @import { Task } from '../internal/client/types' */
/** @import { Tweened } from './public' */
/** @import { TweenedOptions } from './private' */
import { writable } from '../store/index.js';

@@ -79,8 +82,8 @@ import { raf } from '../internal/client/timing.js';

* @param {T} [value]
* @param {import('./private').TweenedOptions<T>} [defaults]
* @returns {import('./public').Tweened<T>}
* @param {TweenedOptions<T>} [defaults]
* @returns {Tweened<T>}
*/
export function tweened(value, defaults = {}) {
const store = writable(value);
/** @type {import('../internal/client/types').Task} */
/** @type {Task} */
let task;

@@ -90,3 +93,3 @@ let target_value = value;

* @param {T} new_value
* @param {import('./private').TweenedOptions<T>} [opts]
* @param {TweenedOptions<T>} [opts]
*/

@@ -101,3 +104,3 @@ function set(new_value, opts) {

/** @type {import('../internal/client/types').Task | null} */
/** @type {Task | null} */
let previous_task = task;

@@ -104,0 +107,0 @@

@@ -0,1 +1,3 @@

/** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from './public' */
/** @import { Invalidator, Stores, StoresValues, SubscribeInvalidateTuple } from './private' */
import { noop, run_all } from '../internal/shared/utils.js';

@@ -6,3 +8,3 @@ import { safe_not_equal } from '../internal/client/reactivity/equality.js';

/**
* @type {Array<import('./private').SubscribeInvalidateTuple<any> | any>}
* @type {Array<SubscribeInvalidateTuple<any> | any>}
*/

@@ -17,4 +19,4 @@ const subscriber_queue = [];

* @param {T} [value] initial value
* @param {import('./public').StartStopNotifier<T>} [start]
* @returns {import('./public').Readable<T>}
* @param {StartStopNotifier<T>} [start]
* @returns {Readable<T>}
*/

@@ -33,10 +35,10 @@ export function readable(value, start) {

* @param {T} [value] initial value
* @param {import('./public').StartStopNotifier<T>} [start]
* @returns {import('./public').Writable<T>}
* @param {StartStopNotifier<T>} [start]
* @returns {Writable<T>}
*/
export function writable(value, start = noop) {
/** @type {import('./public').Unsubscriber | null} */
/** @type {Unsubscriber | null} */
let stop = null;
/** @type {Set<import('./private').SubscribeInvalidateTuple<T>>} */
/** @type {Set<SubscribeInvalidateTuple<T>>} */
const subscribers = new Set();

@@ -69,3 +71,3 @@

/**
* @param {import('./public').Updater<T>} fn
* @param {Updater<T>} fn
* @returns {void}

@@ -78,8 +80,8 @@ */

/**
* @param {import('./public').Subscriber<T>} run
* @param {import('./private').Invalidator<T>} [invalidate]
* @returns {import('./public').Unsubscriber}
* @param {Subscriber<T>} run
* @param {Invalidator<T>} [invalidate]
* @returns {Unsubscriber}
*/
function subscribe(run, invalidate = noop) {
/** @type {import('./private').SubscribeInvalidateTuple<T>} */
/** @type {SubscribeInvalidateTuple<T>} */
const subscriber = [run, invalidate];

@@ -107,9 +109,9 @@ subscribers.add(subscriber);

* https://svelte.dev/docs/svelte-store#derived
* @template {import('./private.js').Stores} S
* @template {Stores} S
* @template T
* @overload
* @param {S} stores
* @param {(values: import('./private.js').StoresValues<S>, set: (value: T) => void, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn
* @param {(values: StoresValues<S>, set: (value: T) => void, update: (fn: Updater<T>) => void) => Unsubscriber | void} fn
* @param {T} [initial_value]
* @returns {import('./public.js').Readable<T>}
* @returns {Readable<T>}
*/

@@ -121,12 +123,12 @@ /**

* https://svelte.dev/docs/svelte-store#derived
* @template {import('./private.js').Stores} S
* @template {Stores} S
* @template T
* @overload
* @param {S} stores
* @param {(values: import('./private.js').StoresValues<S>) => T} fn
* @param {(values: StoresValues<S>) => T} fn
* @param {T} [initial_value]
* @returns {import('./public.js').Readable<T>}
* @returns {Readable<T>}
*/
/**
* @template {import('./private.js').Stores} S
* @template {Stores} S
* @template T

@@ -136,7 +138,7 @@ * @param {S} stores

* @param {T} [initial_value]
* @returns {import('./public.js').Readable<T>}
* @returns {Readable<T>}
*/
export function derived(stores, fn, initial_value) {
const single = !Array.isArray(stores);
/** @type {Array<import('./public').Readable<any>>} */
/** @type {Array<Readable<any>>} */
const stores_array = single ? [stores] : stores;

@@ -198,4 +200,4 @@ if (!stores_array.every(Boolean)) {

* @template T
* @param {import('./public').Readable<T>} store - store to make readonly
* @returns {import('./public').Readable<T>}
* @param {Readable<T>} store - store to make readonly
* @returns {Readable<T>}
*/

@@ -214,3 +216,3 @@ export function readonly(store) {

* @template T
* @param {import('../store/public').Readable<T>} store
* @param {Readable<T>} store
* @returns {T}

@@ -217,0 +219,0 @@ */

import { Readable, Subscriber } from './public.js';
/** Cleanup logic callback. */
export type Invalidator<T> = (value?: T) => void;
type Invalidator<T> = (value?: T) => void;
/** Pair of subscriber and invalidator. */
export type SubscribeInvalidateTuple<T> = [Subscriber<T>, Invalidator<T>];
type SubscribeInvalidateTuple<T> = [Subscriber<T>, Invalidator<T>];
/** One or more `Readable`s. */
export type Stores =
| Readable<any>
| [Readable<any>, ...Array<Readable<any>>]
| Array<Readable<any>>;
type Stores = Readable<any> | [Readable<any>, ...Array<Readable<any>>] | Array<Readable<any>>;
/** One or more values from `Readable` stores. */
export type StoresValues<T> =
type StoresValues<T> =
T extends Readable<infer U> ? U : { [K in keyof T]: T[K] extends Readable<infer U> ? U : never };
export { Invalidator, SubscribeInvalidateTuple, Stores, StoresValues };
import type { Invalidator } from './private.js';
/** Callback to inform of a value updates. */
export type Subscriber<T> = (value: T) => void;
type Subscriber<T> = (value: T) => void;
/** Unsubscribes from value updates. */
export type Unsubscriber = () => void;
type Unsubscriber = () => void;
/** Callback to update a value. */
export type Updater<T> = (value: T) => T;
type Updater<T> = (value: T) => T;

@@ -21,3 +21,3 @@ /**

*/
export type StartStopNotifier<T> = (
type StartStopNotifier<T> = (
set: (value: T) => void,

@@ -28,3 +28,3 @@ update: (fn: Updater<T>) => void

/** Readable interface for subscribing. */
export interface Readable<T> {
interface Readable<T> {
/**

@@ -39,3 +39,3 @@ * Subscribe on value changes.

/** Writable interface for both updating and subscribing. */
export interface Writable<T> extends Readable<T> {
interface Writable<T> extends Readable<T> {
/**

@@ -54,2 +54,4 @@ * Set value and inform subscribers.

export { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable };
export * from './index.js';

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

/** @import { Readable } from './public' */
import { noop } from '../internal/shared/utils.js';

@@ -5,3 +6,3 @@

* @template T
* @param {import('./public').Readable<T> | null | undefined} store
* @param {Readable<T> | null | undefined} store
* @param {(value: T) => void} run

@@ -8,0 +9,0 @@ * @param {(value: T) => void} [invalidate]

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

/** @import { BlurParams, CrossfadeParams, DrawParams, FadeParams, FlyParams, ScaleParams, SlideParams, TransitionConfig } from './public' */
/** @param {number} x */

@@ -32,4 +33,4 @@ const linear = (x) => x;

* @param {Element} node
* @param {import('./public').BlurParams} [params]
* @returns {import('./public').TransitionConfig}
* @param {BlurParams} [params]
* @returns {TransitionConfig}
*/

@@ -58,4 +59,4 @@ export function blur(

* @param {Element} node
* @param {import('./public').FadeParams} [params]
* @returns {import('./public').TransitionConfig}
* @param {FadeParams} [params]
* @returns {TransitionConfig}
*/

@@ -77,4 +78,4 @@ export function fade(node, { delay = 0, duration = 400, easing = linear } = {}) {

* @param {Element} node
* @param {import('./public').FlyParams} [params]
* @returns {import('./public').TransitionConfig}
* @param {FlyParams} [params]
* @returns {TransitionConfig}
*/

@@ -106,4 +107,4 @@ export function fly(

* @param {Element} node
* @param {import('./public').SlideParams} [params]
* @returns {import('./public').TransitionConfig}
* @param {SlideParams} [params]
* @returns {TransitionConfig}
*/

@@ -151,4 +152,4 @@ export function slide(node, { delay = 0, duration = 400, easing = cubic_out, axis = 'y' } = {}) {

* @param {Element} node
* @param {import('./public').ScaleParams} [params]
* @returns {import('./public').TransitionConfig}
* @param {ScaleParams} [params]
* @returns {TransitionConfig}
*/

@@ -180,4 +181,4 @@ export function scale(

* @param {SVGElement & { getTotalLength(): number }} node
* @param {import('./public').DrawParams} [params]
* @returns {import('./public').TransitionConfig}
* @param {DrawParams} [params]
* @returns {TransitionConfig}
*/

@@ -227,6 +228,6 @@ export function draw(node, { delay = 0, speed, duration, easing = cubic_in_out } = {}) {

* https://svelte.dev/docs/svelte-transition#crossfade
* @param {import('./public').CrossfadeParams & {
* fallback?: (node: Element, params: import('./public').CrossfadeParams, intro: boolean) => import('./public').TransitionConfig;
* @param {CrossfadeParams & {
* fallback?: (node: Element, params: CrossfadeParams, intro: boolean) => TransitionConfig;
* }} params
* @returns {[(node: any, params: import('./public').CrossfadeParams & { key: any; }) => () => import('./public').TransitionConfig, (node: any, params: import('./public').CrossfadeParams & { key: any; }) => () => import('./public').TransitionConfig]}
* @returns {[(node: any, params: CrossfadeParams & { key: any; }) => () => TransitionConfig, (node: any, params: CrossfadeParams & { key: any; }) => () => TransitionConfig]}
*/

@@ -242,4 +243,4 @@ export function crossfade({ fallback, ...defaults }) {

* @param {Element} node
* @param {import('./public').CrossfadeParams} params
* @returns {import('./public').TransitionConfig}
* @param {CrossfadeParams} params
* @returns {TransitionConfig}
*/

@@ -280,3 +281,3 @@ function crossfade(from_node, node, params) {

* @param {boolean} intro
* @returns {(node: any, params: import('./public').CrossfadeParams & { key: any; }) => () => import('./public').TransitionConfig}
* @returns {(node: any, params: CrossfadeParams & { key: any; }) => () => TransitionConfig}
*/

@@ -283,0 +284,0 @@ function transition(items, counterparts, intro) {

@@ -1,4 +0,4 @@

export type EasingFunction = (t: number) => number;
type EasingFunction = (t: number) => number;
export interface TransitionConfig {
interface TransitionConfig {
delay?: number;

@@ -11,3 +11,3 @@ duration?: number;

export interface BlurParams {
interface BlurParams {
delay?: number;

@@ -20,3 +20,3 @@ duration?: number;

export interface FadeParams {
interface FadeParams {
delay?: number;

@@ -27,3 +27,3 @@ duration?: number;

export interface FlyParams {
interface FlyParams {
delay?: number;

@@ -37,3 +37,3 @@ duration?: number;

export interface SlideParams {
interface SlideParams {
delay?: number;

@@ -45,3 +45,3 @@ duration?: number;

export interface ScaleParams {
interface ScaleParams {
delay?: number;

@@ -54,3 +54,3 @@ duration?: number;

export interface DrawParams {
interface DrawParams {
delay?: number;

@@ -62,3 +62,3 @@ speed?: number;

export interface CrossfadeParams {
interface CrossfadeParams {
delay?: number;

@@ -69,2 +69,14 @@ duration?: number | ((len: number) => number);

export {
EasingFunction,
TransitionConfig,
BlurParams,
FadeParams,
FlyParams,
SlideParams,
ScaleParams,
DrawParams,
CrossfadeParams
};
export * from './index.js';

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

*/
export const VERSION = '5.0.0-next.169';
export const VERSION = '5.0.0-next.170';
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