sveld 0.38.1 → 0.38.3

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/cli-entry.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Z,K,ee,v,t,vt,ue,le,L,fe,de,H,O,D,M,z,j,q,S,C,Ce,P,At,Pe}from"./chunk-ymq8jc0f.js";import{existsSync as k}from"node:fs";import{join as E,resolve as x}from"node:path";var m="src/index.js",s={SUCCESS:0,USAGE_ERROR:1,GENERATION_FAILURE:2,BREAKING_CHANGE:3,DIAGNOSTICS:4},R=`Usage: sveld [options]
1
+ import{se,oe,ae,N,n,$t,Te,Ee,J,Se,ke,Z,q,I,F,K,V,U,D,R,Be,L,qt,je}from"./chunk-ssa3mr5n.js";import{existsSync as v}from"node:fs";import{join as x,resolve as E}from"node:path";var g="src/index.js",h={SUCCESS:0,USAGE_ERROR:1,GENERATION_FAILURE:2,BREAKING_CHANGE:3,DIAGNOSTICS:4},w=`Usage: sveld [options]
2
2
 
3
3
  Generate TypeScript definitions and component documentation for a Svelte
4
4
  library. With no flags, only TypeScript definitions are generated for the
@@ -35,4 +35,4 @@ Exit codes:
35
35
  2 generation failure
36
36
  3 breaking API change detected by --check
37
37
  4 diagnostics present under --strict
38
- `,w=["help","version","glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","entry","config","cache","check","check-level","types-format","types-index-types","format"],y=new Map([["-h","--help"],["-v","--version"],["-q","--quiet"]]),A=/[A-Z]/g,b=new Set(["glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","types-index-types"]),_=new Set(["entry","config","cache","check","types-format"]),G=new Set(["entry","config","types-format"]);function U(n){let e=n.replace(A,(i)=>`-${i.toLowerCase()}`);return v(e,w)}function F(n,e){let i=n.indexOf("="),r=i===-1?n.slice(2):n.slice(2,i),o=i===-1?!0:n.slice(i+1),c=!1;if(i===-1&&_.has(r)){if(e!==void 0&&!e.startsWith("--")&&!y.has(e))o=e,c=!0;else if(G.has(r))return{result:{kind:"usage-error",message:`sveld: --${r} requires a value (pass --${r}=<value> or --${r} <value>).`},consumedNext:!1,flag:r}}return{result:T(r,o,n),consumedNext:c,flag:r}}function T(n,e,i){switch(n){case"help":return{kind:"help"};case"version":return{kind:"version"};case"glob":case"types":case"json":case"markdown":case"quiet":return{kind:"option",option:{[n]:e===!0||e==="true"}};case"stdout":if(e===!0||e==="true")return{kind:"option",option:{stdout:!0}};if(e==="false")return{kind:"option",option:{stdout:!1}};return{kind:"usage-error",message:`sveld: --stdout does not take a value; got "${e}".`};case"strict":if(e===!0||e==="true")return{kind:"option",option:{strict:!0}};if(e==="false")return{kind:"option",option:{strict:!1}};return{kind:"option",option:{strict:e}};case"report-diagnostics":return{kind:"option",option:{reportDiagnostics:e===!0||e==="true"}};case"check-examples":if(e===!0||e==="true")return{kind:"option",option:{checkExamples:!0}};if(e==="false")return{kind:"option",option:{checkExamples:!1}};return{kind:"option",option:{checkExamples:e}};case"fail-fast":return{kind:"option",option:{failFast:e===!0||e==="true"}};case"entry":return typeof e==="string"?{kind:"option",option:{entry:e}}:{kind:"option",option:{}};case"config":return typeof e==="string"?{kind:"option",option:{config:e}}:{kind:"option",option:{}};case"cache":if(e==="false")return{kind:"option",option:{cache:!1}};return{kind:"option",option:{cache:typeof e==="string"?e:!0}};case"check":if(e==="false")return{kind:"option",option:{check:!1}};return{kind:"option",option:{check:typeof e==="string"?e:!0}};case"types-format":return typeof e==="string"?{kind:"option",option:{typesOptions:{format:e}}}:{kind:"option",option:{}};case"types-index-types":return{kind:"option",option:{typesOptions:{indexTypes:e===!0||e==="true"}}};case"format":return typeof e==="string"?{kind:"option",option:{format:e}}:{kind:"option",option:{}};case"check-level":return typeof e==="string"?{kind:"option",option:{checkLevel:e}}:{kind:"option",option:{}};default:return{kind:"unknown",arg:i,suggestion:U(n)}}}function N(n){let e={},i=!1;for(let r=0;r<n.length;r++){let o=y.get(n[r])??n[r];if(!o.startsWith("--"))return{kind:"unknown",arg:o,positionalHint:i?!0:void 0};let{result:c,consumedNext:f,flag:p}=F(o,n[r+1]);if(c.kind!=="option")return c;if(e=D(e,c.option),i=b.has(p),f)r++}return{kind:"options",options:e}}async function I(n){if(typeof n!=="string")return O();let e=x(n);if(!k(e))throw Error(`sveld: config file "${n}" does not exist.`);return H(e)}async function B(n){let e=N(n.argv.slice(2));if(e.kind==="help"){console.log(R);return}if(e.kind==="version"){console.log(vt.version);return}if(e.kind==="usage-error"){console.error(e.message),n.exitCode=s.USAGE_ERROR;return}if(e.kind==="unknown"){let a=`sveld: unknown flag "${e.arg}".`;if(e.suggestion)a+=` Did you mean "--${e.suggestion}"?`;if(e.positionalHint)a+=" Values are passed as --flag=value or --flag value.";console.error(a),console.error("Run sveld --help for a list of available flags."),n.exitCode=s.USAGE_ERROR;return}let i=e.options,r;try{r=await I(i.config)}catch(a){console.error(a instanceof Error?a.message:String(a)),n.exitCode=s.USAGE_ERROR;return}let o=D(r,i);if(M(o),o.stdout){if([o.json,o.markdown].filter(Boolean).length!==1){console.error("sveld: --stdout requires exactly one of --json or --markdown."),n.exitCode=s.USAGE_ERROR;return}if(o.types===!0){console.error("sveld: --stdout cannot be combined with --types; type definitions span multiple files."),n.exitCode=s.USAGE_ERROR;return}if(o.check){console.error("sveld: --stdout cannot be combined with --check; both write their document to stdout."),n.exitCode=s.USAGE_ERROR;return}}if(o.format!==void 0&&o.format!=="text"&&o.format!=="json"){console.error(`sveld: --format must be "text" or "json"; got "${o.format}".`),n.exitCode=s.USAGE_ERROR;return}if(o.strict!==void 0&&o.strict!==!0&&o.strict!==!1&&o.strict!=="errors"){console.error(`sveld: --strict must be "errors" when given a value; got "${o.strict}".`),n.exitCode=s.USAGE_ERROR;return}if(o.checkLevel!==void 0&&o.checkLevel!=="major"&&o.checkLevel!=="minor"&&o.checkLevel!=="patch"){console.error(`sveld: --check-level must be "major", "minor", or "patch"; got "${o.checkLevel}".`),n.exitCode=s.USAGE_ERROR;return}if(o.checkExamples!==void 0&&o.checkExamples!==!0&&o.checkExamples!==!1&&o.checkExamples!=="syntax"){console.error(`sveld: --check-examples must be "syntax" when given a value; got "${o.checkExamples}".`),n.exitCode=s.USAGE_ERROR;return}let c=o.typesOptions?.format;if(c!==void 0&&c!=="class"&&c!=="component"){console.error(`sveld: --types-format must be "class" or "component"; got "${c}".`),n.exitCode=s.USAGE_ERROR;return}j(o.quiet===!0);let f=Ce(o.entry),p;if(f.entry!==null)p=f.entry;else if(!f.configured&&k(E(n.cwd(),m)))console.error(`sveld: no entry point configured; using "${m}". Set package.json#svelte (or pass --entry) to silence this.`),p=z(t(m));else{console.error(`sveld: ${f.message}`),n.exitCode=s.USAGE_ERROR;return}let l,d;try{if(l=await C(p,o.glob===!0,S(o)),o.check)d=await L(l.components,ue(o),{entryExports:l.entryExports});if(o.stdout)await At(l,o,p);else await P(l,o,p),l.cache?.save()}catch(a){if(a instanceof q){console.error(`sveld: ${a.message}`),n.exitCode=s.USAGE_ERROR;return}console.error(a instanceof Error?a.message:String(a)),n.exitCode=s.GENERATION_FAILURE;return}let g=o.reportDiagnostics||o.strict,u=Z(l.diagnostics,g);if(g&&u.length>0)if(o.format==="json")n.stderr.write(ee(u));else console.error(K(u));if(d)if(o.format==="json")n.stdout.write(de(d));else console.log(fe(d));let h=Pe({errors:l.errors,check:d,writesSnapshot:d?le(o,d.snapshotFile):!1,checkLevel:o.checkLevel,diagnostics:u,strict:o.strict});if(h!==s.SUCCESS)n.exitCode=h}export{B as cli};
38
+ `,C=["help","version","glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","entry","config","cache","check","check-level","types-format","types-index-types","format"],S=new Map([["-h","--help"],["-v","--version"],["-q","--quiet"]]),b=/[A-Z]/g,O=new Set(["glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","types-index-types"]),j=new Set(["entry","config","cache","check","types-format"]),A=new Set(["entry","config","types-format"]);function T(o){let t=o.replace(b,(r)=>`-${r.toLowerCase()}`);return N(t,C)}function P(o,t){let r=o.indexOf("="),s=r===-1?o.slice(2):o.slice(2,r),i=r===-1?!0:o.slice(r+1),e=!1;if(r===-1&&j.has(s)){if(t!==void 0&&!t.startsWith("--")&&!S.has(t))i=t,e=!0;else if(A.has(s))return{result:{kind:"usage-error",message:`sveld: --${s} requires a value (pass --${s}=<value> or --${s} <value>).`},consumedNext:!1,flag:s}}return{result:_(s,i,o),consumedNext:e,flag:s}}function _(o,t,r){let s=(u)=>({kind:"option",option:u}),i=t===!0||t==="true",e=typeof t==="string"?t:void 0;switch(o){case"help":return{kind:"help"};case"version":return{kind:"version"};case"glob":case"types":case"json":case"markdown":case"quiet":return s({[o]:i});case"stdout":if(i)return s({stdout:!0});if(t==="false")return s({stdout:!1});return{kind:"usage-error",message:`sveld: --stdout does not take a value; got "${t}".`};case"strict":if(i)return s({strict:!0});if(t==="false")return s({strict:!1});return s({strict:t});case"report-diagnostics":return s({reportDiagnostics:i});case"check-examples":if(i)return s({checkExamples:!0});if(t==="false")return s({checkExamples:!1});return s({checkExamples:t});case"fail-fast":return s({failFast:i});case"entry":return s(e===void 0?{}:{entry:e});case"config":return s(e===void 0?{}:{config:e});case"cache":if(t==="false")return s({cache:!1});return s({cache:e??!0});case"check":if(t==="false")return s({check:!1});return s({check:e??!0});case"types-format":return s(e===void 0?{}:{typesOptions:{format:e}});case"types-index-types":return s({typesOptions:{indexTypes:i}});case"format":return s(e===void 0?{}:{format:e});case"check-level":return s(e===void 0?{}:{checkLevel:e});default:return{kind:"unknown",arg:r,suggestion:T(o)}}}function G(o){let t={},r=!1;for(let s=0;s<o.length;s++){let i=S.get(o[s])??o[s];if(!i.startsWith("--"))return{kind:"unknown",arg:i,positionalHint:r?!0:void 0};let{result:e,consumedNext:u,flag:d}=P(i,o[s+1]);if(e.kind!=="option")return e;if(t=I(t,e.option),r=O.has(d),u)s++}return{kind:"options",options:t}}async function B(o){if(typeof o!=="string")return q();let t=E(o);if(!v(t))throw Error(`sveld: config file "${o}" does not exist.`);return Z(t)}function p(o,t){return o!==void 0&&!t.includes(o)}async function H(o){let t=(a)=>{console.error(a),o.exitCode=h.USAGE_ERROR},r=G(o.argv.slice(2));if(r.kind==="help"){console.log(w);return}if(r.kind==="version"){console.log($t.version);return}if(r.kind==="usage-error")return t(r.message);if(r.kind==="unknown"){let a=`sveld: unknown flag "${r.arg}".`;if(r.suggestion)a+=` Did you mean "--${r.suggestion}"?`;if(r.positionalHint)a+=" Values are passed as --flag=value or --flag value.";return console.error(a),t("Run sveld --help for a list of available flags.")}let s=r.options,i;try{i=await B(s.config)}catch(a){return t(a instanceof Error?a.message:String(a))}let e=I(i,s);if(F(e),e.stdout){if([e.json,e.markdown].filter(Boolean).length!==1)return t("sveld: --stdout requires exactly one of --json or --markdown.");if(e.types===!0)return t("sveld: --stdout cannot be combined with --types; type definitions span multiple files.");if(e.check)return t("sveld: --stdout cannot be combined with --check; both write their document to stdout.")}if(p(e.format,["text","json"]))return t(`sveld: --format must be "text" or "json"; got "${e.format}".`);if(p(e.strict,[!0,!1,"errors"]))return t(`sveld: --strict must be "errors" when given a value; got "${e.strict}".`);if(p(e.checkLevel,["major","minor","patch"]))return t(`sveld: --check-level must be "major", "minor", or "patch"; got "${e.checkLevel}".`);if(p(e.checkExamples,[!0,!1,"syntax"]))return t(`sveld: --check-examples must be "syntax" when given a value; got "${e.checkExamples}".`);let u=e.typesOptions?.format;if(p(u,["class","component"]))return t(`sveld: --types-format must be "class" or "component"; got "${u}".`);V(e.quiet===!0);let d=Be(e.entry),f;if(d.entry!==null)f=d.entry;else if(!d.configured&&v(x(o.cwd(),g)))console.error(`sveld: no entry point configured; using "${g}". Set package.json#svelte (or pass --entry) to silence this.`),f=K(n(g));else return t(`sveld: ${d.message}`);let c,l;try{if(c=await R(f,e.glob===!0,D(e)),e.check)l=await J(c.components,Te(e),{entryExports:c.entryExports});if(e.stdout)await qt(c,e,f);else await L(c,e,f),c.cache?.save()}catch(a){if(a instanceof U)return t(`sveld: ${a.message}`);console.error(a instanceof Error?a.message:String(a)),o.exitCode=h.GENERATION_FAILURE;return}let k=e.reportDiagnostics||e.strict,m=se(c.diagnostics,k);if(k&&m.length>0)if(e.format==="json")o.stderr.write(ae(m));else console.error(oe(m));if(l)if(e.format==="json")o.stdout.write(ke(l));else console.log(Se(l));let y=je({errors:c.errors,check:l,writesSnapshot:l?Ee(e,l.snapshotFile):!1,checkLevel:e.checkLevel,diagnostics:m,strict:e.strict});if(y!==h.SUCCESS)o.exitCode=y}export{H as cli};
package/index.d.ts CHANGED
@@ -4,11 +4,6 @@ interface ComponentParserDiagnostics {
4
4
  }
5
5
 
6
6
  export class ComponentParser {
7
- /**
8
- * All per-parse mutable state (props, slots, events, scopes, source, etc.).
9
- * See {@link ParserContext} for field-by-field documentation. Replaced
10
- * wholesale by `cleanup()` between parses.
11
- */
12
7
  private ctx;
13
8
  /**
14
9
  * Resets parser state for reuse between parses.
@@ -49,9 +44,9 @@ interface JsDocPassthroughTag {
49
44
  type DeprecatedValue = string | true;
50
45
 
51
46
  interface SourcePosition {
52
- /** 1-based source line number */
47
+ /** 1-based. */
53
48
  line: number;
54
- /** 0-based source column number */
49
+ /** 0-based. */
55
50
  column: number;
56
51
  }
57
52
 
@@ -114,13 +109,9 @@ interface PendingDispatchEscapeCandidate {
114
109
  }
115
110
 
116
111
  interface PendingCrossFileCandidates {
117
- /** Unresolved CallExpression defaults. */
118
112
  pendingCallDefaultCandidates?: PendingCallDefaultCandidate[];
119
- /** Imported-identifier defaults. */
120
113
  pendingConstDefaultCandidates?: PendingConstDefaultCandidate[];
121
- /** Unresolved `setContext` import keys. */
122
114
  pendingContextKeyCandidates?: PendingContextKeyCandidate[];
123
- /** Dispatchers passed to imported functions. */
124
115
  pendingDispatchEscapeCandidates?: PendingDispatchEscapeCandidate[];
125
116
  /**
126
117
  * `event-no-source` diagnostics held back while the dispatcher escapes to
@@ -166,13 +157,9 @@ interface ComponentPropDefaultValue {
166
157
  type ComponentPropBinding = "readonly" | "writable";
167
158
 
168
159
  interface ComponentPropParam {
169
- /** Parameter name. */
170
160
  name: string;
171
- /** Parameter type (e.g. `"string"`, `"CustomType"`). */
172
161
  type: string;
173
- /** From JSDoc `@param`. */
174
162
  description?: string;
175
- /** True when optional. */
176
163
  optional?: boolean;
177
164
  }
178
165
 
@@ -219,7 +206,6 @@ interface ComponentProp {
219
206
  kind: "let" | "const" | "function" | "re-export" | "class";
220
207
  /** True when declared with `const`. */
221
208
  constant: boolean;
222
- /** TypeScript type text. */
223
209
  type?: string;
224
210
  /** Conservative provenance for the prop type. See the precedence rule on {@link ComponentProp}. */
225
211
  typeSource?: ComponentPropTypeSource;
@@ -256,7 +242,6 @@ interface ComponentProp {
256
242
  * type/JSDoc signature in runes only (see {@link ComponentProp}).
257
243
  */
258
244
  isFunction: boolean;
259
- /** True for `function` declarations. */
260
245
  isFunctionDeclaration: boolean;
261
246
  /** True when declared with `let` and no default. */
262
247
  isRequired: boolean;
@@ -277,14 +262,12 @@ interface ComponentProp {
277
262
  internal?: boolean;
278
263
  /** Set when `kind` is `"re-export"`. */
279
264
  reExport?: ComponentPropReExport;
280
- /** Source range when available. */
281
265
  source?: SourceRange;
282
266
  }
283
267
 
284
268
  interface ComponentSlot {
285
- /** Slot name (`null` for the default slot). */
269
+ /** `null` for the default slot. */
286
270
  name?: string | null;
287
- /** True for the default slot. */
288
271
  default: boolean;
289
272
  /** Fallback content when the slot is empty. */
290
273
  fallback?: string;
@@ -298,16 +281,12 @@ interface ComponentSlot {
298
281
  tags?: JsDocPassthroughTag[];
299
282
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
300
283
  internal?: boolean;
301
- /** Source range when available. */
302
284
  source?: SourceRange;
303
285
  }
304
286
 
305
287
  interface DispatchedEvent {
306
- /** Discriminator: `"dispatched"`. */
307
288
  type: "dispatched";
308
- /** Event name. */
309
289
  name: string;
310
- /** Detail type text. */
311
290
  detail?: string;
312
291
  /** From JSDoc `@event`. */
313
292
  description?: string;
@@ -317,14 +296,11 @@ interface DispatchedEvent {
317
296
  tags?: JsDocPassthroughTag[];
318
297
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
319
298
  internal?: boolean;
320
- /** Source range when available. */
321
299
  source?: SourceRange;
322
300
  }
323
301
 
324
302
  interface SerializedForwardedEvent {
325
- /** Discriminator: `"forwarded"`. */
326
303
  type: "forwarded";
327
- /** Event name. */
328
304
  name: string;
329
305
  /** Element name as a string for JSON output. */
330
306
  element: string;
@@ -338,7 +314,6 @@ interface SerializedForwardedEvent {
338
314
  tags?: JsDocPassthroughTag[];
339
315
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
340
316
  internal?: boolean;
341
- /** Source range when available. */
342
317
  source?: SourceRange;
343
318
  }
344
319
 
@@ -347,9 +322,7 @@ export type SerializedComponentEvent = SerializedForwardedEvent | DispatchedEven
347
322
  interface TypeDef {
348
323
  /** Type text (e.g. `"{ x: number; y: number }"`). */
349
324
  type: string;
350
- /** Type name. */
351
325
  name: string;
352
- /** From JSDoc. */
353
326
  description?: string;
354
327
  /** Full `type` alias declaration text. */
355
328
  ts: string;
@@ -364,9 +337,7 @@ interface TypeDef {
364
337
  type ComponentGenerics = [name: string, type: string] | null;
365
338
 
366
339
  interface ComponentInlineElement {
367
- /** Discriminator: `"InlineComponent"`. */
368
340
  type: "InlineComponent";
369
- /** Component name. */
370
341
  name: string;
371
342
  }
372
343
 
@@ -431,20 +402,15 @@ interface ComponentCssProperty {
431
402
  }
432
403
 
433
404
  interface ComponentContextProp {
434
- /** Property name. */
435
405
  name: string;
436
- /** Property type text. */
437
406
  type: string;
438
- /** From JSDoc. */
439
407
  description?: string;
440
- /** True when optional. */
441
408
  optional: boolean;
442
409
  /** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
443
410
  internal?: boolean;
444
411
  }
445
412
 
446
413
  interface ComponentContext {
447
- /** Context key from `setContext`. */
448
414
  key: string;
449
415
  /** Generated type name (e.g. `"ModalContext"`). */
450
416
  typeName: string;
@@ -454,9 +420,8 @@ interface ComponentContext {
454
420
  * when untyped). `properties` is empty then.
455
421
  */
456
422
  type?: string;
457
- /** From JSDoc. */
458
423
  description?: string;
459
- /** Context object properties. Empty when {@link ComponentContext.type} is set. */
424
+ /** Empty when {@link ComponentContext.type} is set. */
460
425
  properties: ComponentContextProp[];
461
426
  /** True when a `{...spread}` in the context's object literal couldn't be resolved; the generated type intersects with `Record<string, any>`. */
462
427
  hasUnresolvedSpread?: boolean;
@@ -467,7 +432,6 @@ interface ComponentContext {
467
432
  }
468
433
 
469
434
  interface ParsedComponent {
470
- /** Source range of the parsed file. */
471
435
  source?: SourceRange;
472
436
  syntaxMode: SyntaxMode;
473
437
  scriptLanguage?: ScriptLanguage;
@@ -493,20 +457,16 @@ interface ParsedComponent {
493
457
  cssParts?: ComponentCssPart[];
494
458
  /** From component-level `@cssprop`/`@cssproperty` JSDoc tags. */
495
459
  cssProperties?: ComponentCssProperty[];
496
- /**
497
- * Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags).
498
- */
460
+ /** Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags). */
499
461
  diagnostics?: SveldDiagnostic[];
500
462
  /** Writer-only TypeScript metadata. Not serialized to JSON. */
501
463
  [PARSED_COMPONENT_TYPE_SCRIPT_METADATA]?: ParsedComponentTypeScriptMetadata;
502
464
  }
503
465
 
504
- export type SveldDiagnosticKind = "prop-unknown-type" | "context-any-type" | "slot-missing-type" | "event-no-source" | "dispatch-escapes" | "example-compile-error" | "example-syntax-error" | "syntax-skipped" | "type-syntax-error" | "rest-props-unresolved" | "context-duplicate-key" | "context-key-unresolved" | "context-value-unresolved" | "spread-unresolved" | "export-unresolved" | "module-export-conflict" | "extend-props-target-missing" | "extend-props-duplicate" | "extend-props-override" | "jsdoc-unknown-tag" | "typedef-duplicate" | "property-duplicate" | "generics-conflict" | "event-description-ambiguous" | "jsdoc-tag-dropped" | "internal-typedef-referenced" | "cross-file-unresolved" | "export-ambiguous";
466
+ export type SveldDiagnosticKind = "prop-unknown-type" | "context-any-type" | "slot-missing-type" | "slot-not-rendered" | "event-no-source" | "dispatch-escapes" | "example-compile-error" | "example-syntax-error" | "syntax-skipped" | "type-syntax-error" | "rest-props-unresolved" | "context-duplicate-key" | "context-key-unresolved" | "context-value-unresolved" | "spread-unresolved" | "export-unresolved" | "module-export-conflict" | "extend-props-target-missing" | "extend-props-duplicate" | "extend-props-override" | "jsdoc-unknown-tag" | "typedef-duplicate" | "property-duplicate" | "generics-conflict" | "event-description-ambiguous" | "jsdoc-tag-dropped" | "internal-typedef-referenced" | "cross-file-unresolved" | "export-ambiguous";
505
467
 
506
468
  export type SveldDiagnosticSeverity = "error" | "warning";
507
469
 
508
- export declare const DIAGNOSTIC_CODES: Record<SveldDiagnosticKind, string>;
509
-
510
470
  export interface SveldDiagnostic {
511
471
  /**
512
472
  * File this came from, e.g. `"./Button.svelte"`, or the entry barrel
@@ -537,6 +497,8 @@ export interface DiagnosticIgnoreMatcher {
537
497
  name?: string;
538
498
  }
539
499
 
500
+ export declare const DIAGNOSTIC_CODES: Record<SveldDiagnosticKind, string>;
501
+
540
502
  export declare const DIAGNOSTICS_SCHEMA_VERSION = 1;
541
503
 
542
504
  export interface DiagnosticsJson {
@@ -920,16 +882,13 @@ interface WriteTsDefinitionOptions {
920
882
  /**
921
883
  * `"class"` (default) extends the deprecated `SvelteComponentTyped`.
922
884
  * `"component"` emits `declare const X: Component<Props, Exports, Bindings>`
923
- * instead, for Svelte 5+ consumers. Generic components get a per-component
924
- * interface with a generic call signature instead of `Component<...>`
925
- * directly, since a `declare const` can't itself carry a generic type
926
- * parameter (see `genGenericComponentDeclaration`).
885
+ * instead, for Svelte 5+ consumers. Generic components and components with
886
+ * events get a per-component interface instead, since a `declare const`
887
+ * can't carry a generic type parameter and `Component` has no events slot.
927
888
  */
928
889
  format?: "class" | "component";
929
890
  }
930
891
 
931
- type SveldOptions = SveldRuntimeOptions;
932
-
933
892
  export interface SveldResult {
934
893
  /** Diagnostics from this run. */
935
894
  diagnostics: SveldDiagnostic[];
@@ -953,4 +912,4 @@ export interface SveldResult {
953
912
 
954
913
  type ExitCode = 0 | 1 | 2 | 3 | 4;
955
914
 
956
- export declare function sveld(opts?: SveldOptions): Promise<SveldResult>;
915
+ export declare function sveld(opts?: SveldRuntimeOptions): Promise<SveldResult>;
package/index.js CHANGED
@@ -1 +1 @@
1
- import{J,Re,l,Dt,L,fe,Ct,de,Nt,Pt,Rt}from"./chunk-ymq8jc0f.js";import{X}from"./chunk-x0hkebcs.js";export{Ct as CHECK_REPORT_SCHEMA_VERSION,X as ComponentParser,Re as DIAGNOSTICS_SCHEMA_VERSION,J as DIAGNOSTIC_CODES,l as buildComponentApiDocument,Pt as default,Nt as defineConfig,Dt as diffApiDocuments,fe as formatCheckReport,de as formatCheckReportJson,L as runCheck,Rt as sveld};
1
+ import{H,Ve,m,Bt,J,Se,jt,ke,Vt,Jt,Ut}from"./chunk-ssa3mr5n.js";import{ee}from"./chunk-nv6dzbmp.js";export{jt as CHECK_REPORT_SCHEMA_VERSION,ee as ComponentParser,Ve as DIAGNOSTICS_SCHEMA_VERSION,H as DIAGNOSTIC_CODES,m as buildComponentApiDocument,Jt as default,Vt as defineConfig,Bt as diffApiDocuments,Se as formatCheckReport,ke as formatCheckReportJson,J as runCheck,Ut as sveld};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveld",
3
- "version": "0.38.1",
3
+ "version": "0.38.3",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Generate TypeScript definitions and component documentation for your Svelte components.",
6
6
  "type": "module",