sveld 0.36.11 → 0.37.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.
- package/README.md +522 -66
- package/lib/browser.d.ts +121 -2
- package/lib/browser.js +160 -139
- package/lib/{chunk-3a9n8agv.js → chunk-550yx3gf.js} +9 -9
- package/lib/chunk-6n4d12tf.js +1 -0
- package/lib/chunk-74rbv9gf.js +1 -0
- package/lib/chunk-eybp3ae7.js +6 -0
- package/lib/chunk-jtm65qmd.js +300 -0
- package/lib/chunk-s1v2vjye.js +7 -0
- package/lib/cli-entry.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +5 -3
- package/schema/component-api.schema.json +431 -0
- package/lib/chunk-04eb8yj0.js +0 -245
- package/lib/chunk-5b7hj275.js +0 -7
- package/lib/chunk-e1e89j27.js +0 -1
- package/lib/chunk-ncw3wbrj.js +0 -6
- package/lib/chunk-qnj6xmb6.js +0 -7
- package/lib/chunk-wq8f3w8t.js +0 -1
package/lib/browser.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ interface PendingContextKeyCandidate {
|
|
|
44
44
|
importedName: string;
|
|
45
45
|
properties: ComponentContextProp[];
|
|
46
46
|
description?: string;
|
|
47
|
+
/** Source range of the `setContext(...)` call, when available. */
|
|
48
|
+
source?: SourceRange;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
interface ParsedComponentTypeScriptMetadata {
|
|
@@ -156,6 +158,8 @@ interface ComponentProp {
|
|
|
156
158
|
deprecated?: DeprecatedValue;
|
|
157
159
|
/** `@since` / `@example` tags in source order. */
|
|
158
160
|
tags?: JsDocPassthroughTag[];
|
|
161
|
+
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
162
|
+
internal?: boolean;
|
|
159
163
|
/** Source range when available. */
|
|
160
164
|
source?: SourceRange;
|
|
161
165
|
}
|
|
@@ -175,6 +179,8 @@ interface ComponentSlot {
|
|
|
175
179
|
deprecated?: DeprecatedValue;
|
|
176
180
|
/** Tags between the description and `@slot`/`@snippet` (e.g. `@example`), in source order. */
|
|
177
181
|
tags?: JsDocPassthroughTag[];
|
|
182
|
+
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
183
|
+
internal?: boolean;
|
|
178
184
|
/** Source range when available. */
|
|
179
185
|
source?: SourceRange;
|
|
180
186
|
}
|
|
@@ -192,6 +198,8 @@ interface DispatchedEvent {
|
|
|
192
198
|
deprecated?: DeprecatedValue;
|
|
193
199
|
/** `@since` / `@example` tags in source order. */
|
|
194
200
|
tags?: JsDocPassthroughTag[];
|
|
201
|
+
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
202
|
+
internal?: boolean;
|
|
195
203
|
/** Source range when available. */
|
|
196
204
|
source?: SourceRange;
|
|
197
205
|
}
|
|
@@ -211,6 +219,8 @@ interface SerializedForwardedEvent {
|
|
|
211
219
|
detail?: string;
|
|
212
220
|
/** `@since` / `@example` tags in source order. */
|
|
213
221
|
tags?: JsDocPassthroughTag[];
|
|
222
|
+
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
223
|
+
internal?: boolean;
|
|
214
224
|
/** Source range when available. */
|
|
215
225
|
source?: SourceRange;
|
|
216
226
|
}
|
|
@@ -226,6 +236,12 @@ interface TypeDef {
|
|
|
226
236
|
description?: string;
|
|
227
237
|
/** Full `type` alias declaration text. */
|
|
228
238
|
ts: string;
|
|
239
|
+
/** Tags in the same block (e.g. `@since`, `@example`, `@see`), in source order. */
|
|
240
|
+
tags?: JsDocPassthroughTag[];
|
|
241
|
+
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
242
|
+
internal?: boolean;
|
|
243
|
+
/** Source range of the `@typedef`/`@callback` tag, when available. */
|
|
244
|
+
source?: SourceRange;
|
|
229
245
|
}
|
|
230
246
|
|
|
231
247
|
type ComponentGenerics = [name: string, type: string] | null;
|
|
@@ -268,6 +284,35 @@ interface Extends {
|
|
|
268
284
|
import: string;
|
|
269
285
|
}
|
|
270
286
|
|
|
287
|
+
type CustomElementPropType = "String" | "Boolean" | "Number" | "Array" | "Object";
|
|
288
|
+
|
|
289
|
+
interface CustomElementPropConfig {
|
|
290
|
+
/** Explicit attribute name. Svelte itself always observes every prop as an attribute; sveld's own output omits the attribute entirely when this is `false`. */
|
|
291
|
+
attribute?: string | false;
|
|
292
|
+
reflect?: boolean;
|
|
293
|
+
type?: CustomElementPropType;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
interface CustomElementOptions {
|
|
297
|
+
tag?: string;
|
|
298
|
+
shadow?: "open" | "none";
|
|
299
|
+
props?: Record<string, CustomElementPropConfig>;
|
|
300
|
+
extend?: true;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
interface ComponentCssPart {
|
|
304
|
+
name: string;
|
|
305
|
+
description?: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
interface ComponentCssProperty {
|
|
309
|
+
/** Includes the leading `--`. */
|
|
310
|
+
name: string;
|
|
311
|
+
type?: string;
|
|
312
|
+
default?: string;
|
|
313
|
+
description?: string;
|
|
314
|
+
}
|
|
315
|
+
|
|
271
316
|
interface ComponentContextProp {
|
|
272
317
|
/** Property name. */
|
|
273
318
|
name: string;
|
|
@@ -277,6 +322,8 @@ interface ComponentContextProp {
|
|
|
277
322
|
description?: string;
|
|
278
323
|
/** True when optional. */
|
|
279
324
|
optional: boolean;
|
|
325
|
+
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
326
|
+
internal?: boolean;
|
|
280
327
|
}
|
|
281
328
|
|
|
282
329
|
interface ComponentContext {
|
|
@@ -288,6 +335,12 @@ interface ComponentContext {
|
|
|
288
335
|
description?: string;
|
|
289
336
|
/** Context object properties. */
|
|
290
337
|
properties: ComponentContextProp[];
|
|
338
|
+
/** True when a `{...spread}` in the context's object literal couldn't be resolved; the generated type intersects with `Record<string, any>`. */
|
|
339
|
+
hasUnresolvedSpread?: boolean;
|
|
340
|
+
/** True from `@ignore`/`@internal` JSDoc on the `setContext` call; excluded from every output by `buildComponentApiDocument`. */
|
|
341
|
+
internal?: boolean;
|
|
342
|
+
/** Source range of the `setContext(...)` call, when available. */
|
|
343
|
+
source?: SourceRange;
|
|
291
344
|
}
|
|
292
345
|
|
|
293
346
|
interface ParsedComponent {
|
|
@@ -311,6 +364,12 @@ interface ParsedComponent {
|
|
|
311
364
|
componentCommentSource?: SourceRange;
|
|
312
365
|
contexts?: ComponentContext[];
|
|
313
366
|
customElementTag?: string;
|
|
367
|
+
/** Full `<svelte:options customElement=... />` config (shorthand or object form), when present. */
|
|
368
|
+
customElement?: CustomElementOptions;
|
|
369
|
+
/** From component-level `@csspart` JSDoc tags. */
|
|
370
|
+
cssParts?: ComponentCssPart[];
|
|
371
|
+
/** From component-level `@cssprop`/`@cssproperty` JSDoc tags. */
|
|
372
|
+
cssProperties?: ComponentCssProperty[];
|
|
314
373
|
/**
|
|
315
374
|
* Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags).
|
|
316
375
|
*/
|
|
@@ -361,6 +420,8 @@ export class ComponentParser {
|
|
|
361
420
|
binding?: ComponentPropBinding;
|
|
362
421
|
deprecated?: DeprecatedValue;
|
|
363
422
|
tags?: JsDocPassthroughTag[];
|
|
423
|
+
sveldIgnore?: string[];
|
|
424
|
+
internal: boolean;
|
|
364
425
|
} | undefined;
|
|
365
426
|
private addModuleExport;
|
|
366
427
|
/**
|
|
@@ -388,6 +449,7 @@ export class ComponentParser {
|
|
|
388
449
|
findVariableTypeAndDescription(varName: string): {
|
|
389
450
|
type: string;
|
|
390
451
|
description?: string;
|
|
452
|
+
internal?: boolean;
|
|
391
453
|
} | null;
|
|
392
454
|
accumulateGeneric(name: string, constraint: string): void;
|
|
393
455
|
/**
|
|
@@ -418,18 +480,29 @@ export class ComponentParser {
|
|
|
418
480
|
parseSvelteComponent(source: string, diagnostics: ComponentParserDiagnostics): ParsedComponent;
|
|
419
481
|
}
|
|
420
482
|
|
|
421
|
-
export type SveldDiagnosticKind = "prop-unknown-type" | "context-any-type" | "event-no-source" | "example-compile-error" | "syntax-skipped";
|
|
483
|
+
export type SveldDiagnosticKind = "prop-unknown-type" | "context-any-type" | "slot-missing-type" | "event-no-source" | "example-compile-error" | "example-syntax-error" | "syntax-skipped" | "rest-props-unresolved" | "context-duplicate-key" | "spread-unresolved" | "export-unresolved" | "extend-props-target-missing" | "extend-props-duplicate" | "extend-props-override" | "jsdoc-unknown-tag" | "typedef-duplicate" | "property-duplicate" | "generics-conflict" | "jsdoc-tag-dropped" | "internal-typedef-referenced";
|
|
484
|
+
|
|
485
|
+
type SveldDiagnosticSeverity = "error" | "warning";
|
|
422
486
|
|
|
423
487
|
export interface SveldDiagnostic {
|
|
424
488
|
/** File this came from, e.g. `"./Button.svelte"`. */
|
|
425
489
|
component: string;
|
|
426
490
|
kind: SveldDiagnosticKind;
|
|
491
|
+
/** Stable, namespaced identifier for `kind` (e.g. `"sveld/prop-unknown-type"`). */
|
|
492
|
+
code: string;
|
|
493
|
+
severity: SveldDiagnosticSeverity;
|
|
427
494
|
/** Prop, context field, or event name. */
|
|
428
495
|
name: string;
|
|
429
496
|
/** What went wrong and what type sveld used. */
|
|
430
497
|
message: string;
|
|
431
498
|
/** Where in the component source this diagnostic points, when the parser holds a stable position. */
|
|
432
499
|
source?: SourceRange;
|
|
500
|
+
/**
|
|
501
|
+
* True when suppressed by an inline `@sveld-ignore` tag or a `diagnostics.ignore`
|
|
502
|
+
* config matcher. Still present here (and counted in the summary) but never
|
|
503
|
+
* fails `--strict` / `--strict=errors`.
|
|
504
|
+
*/
|
|
505
|
+
ignored?: boolean;
|
|
433
506
|
}
|
|
434
507
|
|
|
435
508
|
declare const PARSED_COMPONENT_TYPE_SCRIPT_METADATA: unique symbol;
|
|
@@ -449,6 +522,12 @@ interface EntryExport {
|
|
|
449
522
|
/** Initializer text for simple constants. */
|
|
450
523
|
value?: string;
|
|
451
524
|
description?: string;
|
|
525
|
+
/** From `@deprecated` JSDoc. */
|
|
526
|
+
deprecated?: DeprecatedValue;
|
|
527
|
+
/** `@since` / `@example` / `@see` tags in source order. */
|
|
528
|
+
tags?: JsDocPassthroughTag[];
|
|
529
|
+
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
530
|
+
internal?: boolean;
|
|
452
531
|
/** Declaring module, relative to the entry file. */
|
|
453
532
|
source?: string;
|
|
454
533
|
isTypeOnly: boolean;
|
|
@@ -467,6 +546,27 @@ export interface CemClassField {
|
|
|
467
546
|
default?: string;
|
|
468
547
|
description?: string;
|
|
469
548
|
deprecated?: DeprecatedValue;
|
|
549
|
+
/** Present, and `true`, for an `export const` prop. */
|
|
550
|
+
readonly?: true;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
interface CemParameter {
|
|
554
|
+
name: string;
|
|
555
|
+
type?: CemType;
|
|
556
|
+
optional?: true;
|
|
557
|
+
rest?: true;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
interface CemClassMethod {
|
|
561
|
+
kind: "method";
|
|
562
|
+
name: string;
|
|
563
|
+
static: boolean;
|
|
564
|
+
parameters?: CemParameter[];
|
|
565
|
+
return?: {
|
|
566
|
+
type: CemType;
|
|
567
|
+
};
|
|
568
|
+
description?: string;
|
|
569
|
+
deprecated?: DeprecatedValue;
|
|
470
570
|
}
|
|
471
571
|
|
|
472
572
|
export interface CemAttribute {
|
|
@@ -475,6 +575,21 @@ export interface CemAttribute {
|
|
|
475
575
|
type?: CemType;
|
|
476
576
|
default?: string;
|
|
477
577
|
description?: string;
|
|
578
|
+
/** Present, and `true`, when the prop's `customElement` config sets `reflect: true`. */
|
|
579
|
+
reflects?: true;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
interface CemCssPart {
|
|
583
|
+
name: string;
|
|
584
|
+
description?: string;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
interface CemCssCustomProperty {
|
|
588
|
+
/** Includes the leading `--`. */
|
|
589
|
+
name: string;
|
|
590
|
+
type?: CemType;
|
|
591
|
+
default?: string;
|
|
592
|
+
description?: string;
|
|
478
593
|
}
|
|
479
594
|
|
|
480
595
|
export interface CemEvent {
|
|
@@ -494,10 +609,14 @@ export interface CemClassDeclaration {
|
|
|
494
609
|
kind: "class";
|
|
495
610
|
name: string;
|
|
496
611
|
description?: string;
|
|
497
|
-
members: CemClassField
|
|
612
|
+
members: Array<CemClassField | CemClassMethod>;
|
|
498
613
|
attributes: CemAttribute[];
|
|
499
614
|
events: CemEvent[];
|
|
500
615
|
slots: CemSlot[];
|
|
616
|
+
/** From component-level `@csspart` JSDoc tags. */
|
|
617
|
+
cssParts?: CemCssPart[];
|
|
618
|
+
/** From component-level `@cssprop`/`@cssproperty` JSDoc tags. */
|
|
619
|
+
cssProperties?: CemCssCustomProperty[];
|
|
501
620
|
/** Only present when the source component sets `<svelte:options customElement="..." />`. */
|
|
502
621
|
tagName?: string;
|
|
503
622
|
/** Only present when the source component sets `<svelte:options customElement="..." />`. */
|