sveld 0.37.4 → 0.37.5

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.
package/README.md CHANGED
@@ -2187,7 +2187,27 @@ Chained references are also resolved:
2187
2187
  count?: number;
2188
2188
  ```
2189
2189
 
2190
- Resolution follows up to 5 levels of indirection. Beyond that, the last resolved identifier name is used as the default value. If the identifier cannot be resolved (e.g., it is imported from another module), the variable name is used as-is.
2190
+ Resolution follows up to 5 levels of indirection. Beyond that, the last resolved identifier name is used as the default value.
2191
+
2192
+ A named import resolves when the imported module (followed through re-exports) declares it as an `export const` with a string, number, boolean, or static template literal:
2193
+
2194
+ ```svelte
2195
+ <script>
2196
+ // timing.js: export const TOOLTIP_LEAVE_DELAY_MS = 300;
2197
+ import { TOOLTIP_LEAVE_DELAY_MS } from "./timing.js";
2198
+
2199
+ export let leaveDelayMs = TOOLTIP_LEAVE_DELAY_MS;
2200
+ </script>
2201
+ ```
2202
+
2203
+ ```ts
2204
+ /**
2205
+ * @default 300
2206
+ */
2207
+ leaveDelayMs?: number;
2208
+ ```
2209
+
2210
+ Any other identifier that cannot be resolved (an `export let`, a computed value, a package import) is used as-is, and its type falls back to `any`.
2191
2211
 
2192
2212
  When an explicit `@default` annotation is provided, it always takes precedence over the resolved value.
2193
2213
 
package/lib/browser.d.ts CHANGED
@@ -37,6 +37,13 @@ interface PendingCallDefaultCandidate {
37
37
  importedName?: string;
38
38
  }
39
39
 
40
+ interface PendingConstDefaultCandidate {
41
+ propName: string;
42
+ location: "props" | "moduleExports";
43
+ importSource: string;
44
+ importedName: string;
45
+ }
46
+
40
47
  interface PendingContextKeyCandidate {
41
48
  importSource: string;
42
49
  importedName: string;
@@ -60,6 +67,8 @@ interface ParsedComponentTypeScriptMetadata {
60
67
  referencesComponentGenerics?: boolean;
61
68
  /** Unresolved CallExpression defaults for the cross-file pass in `generateBundle`. */
62
69
  pendingCallDefaultCandidates?: PendingCallDefaultCandidate[];
70
+ /** Imported-identifier defaults for the cross-file pass in `generateBundle`. */
71
+ pendingConstDefaultCandidates?: PendingConstDefaultCandidate[];
63
72
  /** Unresolved `setContext` import keys for the cross-file pass in `generateBundle`. */
64
73
  pendingContextKeyCandidates?: PendingContextKeyCandidate[];
65
74
  }