sveld 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -262,6 +262,8 @@ export interface ParsedComponent {
262
262
  export default class ComponentParser {
263
263
  /** Parser configuration options (e.g., verbose logging) */
264
264
  private options?;
265
+ /** Whether the component uses legacy or runes syntax according to compiler metadata */
266
+ private syntaxMode;
265
267
  /** Raw source code of the Svelte component being parsed */
266
268
  private source?;
267
269
  /** Compiled Svelte code containing extracted variables and AST */
@@ -300,11 +302,46 @@ export default class ComponentParser {
300
302
  private readonly contexts;
301
303
  /** Cache for variable type and description information to avoid redundant lookups */
302
304
  private variableInfoCache;
305
+ /** Maps local binding names back to their public prop names */
306
+ private readonly propLocalToPublicName;
307
+ /** Tracks `$props()` bindings that are used as spread/rest props */
308
+ private readonly restPropLocals;
309
+ /** Tracks prop locals that are used as snippet/render props */
310
+ private readonly snippetPropLocals;
311
+ /** Component-level lexical scope shared by instance script and template */
312
+ private readonly componentScope;
313
+ /** Precomputed lexical scopes for nested AST nodes */
314
+ private scopeDeclarations;
315
+ /** Active lexical scopes while walking the component AST */
316
+ private readonly activeScopes;
303
317
  /** Cached array of source code lines split by newline for efficient line-based operations */
304
318
  private sourceLinesCache?;
305
319
  constructor(options?: ComponentParserOptions);
306
320
  private static mapToArray;
307
321
  private static assignValue;
322
+ private resolvePublicPropName;
323
+ private trackPropLocalName;
324
+ private getPropByLocalOrPublic;
325
+ private getPropTypeByLocalOrPublic;
326
+ private declareScopeBinding;
327
+ private resolveIdentifierToReactiveProp;
328
+ private collectPatternIdentifiers;
329
+ private markReactivePropsFromMutationTarget;
330
+ private isScopeOwner;
331
+ private isFunctionScopeOwner;
332
+ private getOrCreateScope;
333
+ private declareVariableDeclaration;
334
+ private declareFunctionLikeScopeBindings;
335
+ private collectDirectBlockDeclarations;
336
+ private extractRunesScopeBindings;
337
+ private collectComponentScopeDeclarations;
338
+ private collectNestedScopeDeclarations;
339
+ private buildScopeDeclarations;
340
+ private createRestPropsFromParent;
341
+ private maybeSetRestProps;
342
+ private isCallExpressionNamed;
343
+ private getPropertyName;
344
+ private logUnsupportedRunesPattern;
308
345
  private static formatComment;
309
346
  /**
310
347
  * Extracts and categorizes JSDoc tags from a parsed comment.
@@ -351,6 +388,8 @@ export default class ComponentParser {
351
388
  * ```
352
389
  */
353
390
  private static findJSDocComment;
391
+ private findAdjacentJSDocComment;
392
+ private processNodeJSDoc;
354
393
  /**
355
394
  * Processes JSDoc comments from leadingComments and extracts structured information.
356
395
  *
@@ -446,12 +485,16 @@ export default class ComponentParser {
446
485
  */
447
486
  private processInitializer;
448
487
  /**
449
- * Collects reactive variables from the compiled Svelte component.
450
- *
451
- * Reactive variables are those that are both reassigned and writable,
452
- * indicating they can change and trigger reactivity in Svelte.
488
+ * Unwraps `$bindable(...)` calls so defaults are documented as their underlying values.
489
+ */
490
+ private unwrapBindableInitializer;
491
+ /**
492
+ * Extracts component props from top-level `$props()` declarations in runes components.
453
493
  */
454
- private collectReactiveVars;
494
+ private parseRunesPropsDeclaration;
495
+ private inferSlotPropValueFromExpression;
496
+ private buildSlotPropsFromObjectExpression;
497
+ private extractRenderTagInfo;
455
498
  /**
456
499
  * Adds or merges a component prop to the props map.
457
500
  *
@@ -601,7 +644,7 @@ export default class ComponentParser {
601
644
  * Parses custom types, events, slots, and other JSDoc annotations from component comments.
602
645
  *
603
646
  * Scans the entire source for JSDoc comment blocks and extracts structured information
604
- * about events, typedefs, slots, extends, restProps, and generics. Handles complex
647
+ * about events, typedefs, callbacks, slots, extends, restProps, and generics. Handles complex
605
648
  * description extraction logic that supports both inline descriptions and preceding
606
649
  * line descriptions.
607
650
  *