sveld 0.38.0 → 0.38.2
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 +1 -1
- package/{lib/browser.d.ts → browser.d.ts} +9 -54
- package/browser.js +245 -0
- package/chunk-261qwh99.js +5 -0
- package/chunk-28h1esfd.js +29 -0
- package/chunk-80eafzch.js +1 -0
- package/chunk-rn01dzny.js +234 -0
- package/chunk-wpqsw5ca.js +13 -0
- package/cli-entry.js +38 -0
- package/cli.js +1 -1
- package/{lib/index.d.ts → index.d.ts} +13 -60
- package/index.js +1 -0
- package/package.json +9 -14
- package/lib/browser.js +0 -262
- package/lib/chunk-12m2j9sx.js +0 -244
- package/lib/chunk-4zz6y1q7.js +0 -5
- package/lib/chunk-bkyrjqfv.js +0 -1
- package/lib/chunk-m08z217p.js +0 -36
- package/lib/chunk-mrkc1dc9.js +0 -13
- package/lib/cli-entry.js +0 -38
- package/lib/index.js +0 -1
package/cli-entry.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{ie,se,oe,_,n,Ot,xe,Te,B,Ee,Se,Y,j,N,J,Z,q,F,C,I,Me,R,jt,$e}from"./chunk-rn01dzny.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
|
+
|
|
3
|
+
Generate TypeScript definitions and component documentation for a Svelte
|
|
4
|
+
library. With no flags, only TypeScript definitions are generated for the
|
|
5
|
+
entry resolved from package.json#svelte.
|
|
6
|
+
|
|
7
|
+
--entry, --config, --cache, --check, and --types-format accept their
|
|
8
|
+
value as --flag=value or as a separate --flag value argument.
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
--entry=<path> Entry point to uncompiled Svelte source (default: package.json "svelte" field)
|
|
12
|
+
--config=<path> Load this config file (relative to the working directory) instead of discovering sveld.config.{js,mjs,ts}
|
|
13
|
+
--glob Analyze all *.svelte files instead of the entry barrel
|
|
14
|
+
--types Generate TypeScript definitions (default: true)
|
|
15
|
+
--json Generate component documentation in JSON format
|
|
16
|
+
--markdown Generate component documentation in Markdown format
|
|
17
|
+
--fail-fast Abort the run when a single component fails to parse
|
|
18
|
+
-q, --quiet Suppress progress logs (errors, the diagnostics summary, and the --check report are unaffected)
|
|
19
|
+
--stdout Print the document from exactly one of --json or --markdown to stdout and write nothing to disk (rejects --types and --check)
|
|
20
|
+
--cache[=<path>] Persist parsed output and skip re-parsing unchanged files (on by default, default path: node_modules/.cache/sveld/parse-cache.json; pass --cache=false to disable)
|
|
21
|
+
--check-examples[=syntax] Check @example blocks: TS/JS against the TypeScript program, svelte/html markup against sveast; --check-examples=syntax runs only the markup path and never loads TypeScript
|
|
22
|
+
--report-diagnostics Print unresolved-type diagnostics to stderr
|
|
23
|
+
--strict[=errors] Exit with code 4 when diagnostics exist (implies --report-diagnostics); --strict=errors only fails on error-severity diagnostics
|
|
24
|
+
--types-format=<format> ".d.ts" output format: "class" (default) or "component" (Svelte 5 Component<...>)
|
|
25
|
+
--types-index-types Sets typesOptions.indexTypes; also re-exports generated types from index.d.ts (pass --types-index-types=false to disable)
|
|
26
|
+
--check[=<path>] Diff the parsed API against a committed snapshot; exit 3 on a breaking change (default path: COMPONENT_API.json)
|
|
27
|
+
--check-level=<major|minor|patch> Minimum bump --check fails the run on (default: major)
|
|
28
|
+
--format=<text|json> Output format for the --check report and the diagnostics summary (default: text)
|
|
29
|
+
-h, --help Print this help message and exit
|
|
30
|
+
-v, --version Print the installed sveld version and exit
|
|
31
|
+
|
|
32
|
+
Exit codes:
|
|
33
|
+
0 success
|
|
34
|
+
1 usage or configuration error
|
|
35
|
+
2 generation failure
|
|
36
|
+
3 breaking API change detected by --check
|
|
37
|
+
4 diagnostics present under --strict
|
|
38
|
+
`,b=["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"]]),O=/[A-Z]/g,A=new Set(["glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","types-index-types"]),L=new Set(["entry","config","cache","check","types-format"]),T=new Set(["entry","config","types-format"]);function P(o){let t=o.replace(O,(r)=>`-${r.toLowerCase()}`);return _(t,b)}function G(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&&L.has(s)){if(t!==void 0&&!t.startsWith("--")&&!S.has(t))i=t,e=!0;else if(T.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:U(s,i,o),consumedNext:e,flag:s}}function U(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:P(o)}}}function D(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}=G(i,o[s+1]);if(e.kind!=="option")return e;if(t=N(t,e.option),r=A.has(d),u)s++}return{kind:"options",options:t}}async function H(o){if(typeof o!=="string")return j();let t=E(o);if(!v(t))throw Error(`sveld: config file "${o}" does not exist.`);return Y(t)}function p(o,t){return o!==void 0&&!t.includes(o)}async function M(o){let t=(a)=>{console.error(a),o.exitCode=h.USAGE_ERROR},r=D(o.argv.slice(2));if(r.kind==="help"){console.log(w);return}if(r.kind==="version"){console.log(Ot.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 H(s.config)}catch(a){return t(a instanceof Error?a.message:String(a))}let e=N(i,s);if(J(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}".`);q(e.quiet===!0);let d=Me(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=Z(n(g));else return t(`sveld: ${d.message}`);let c,l;try{if(c=await I(f,e.glob===!0,C(e)),e.check)l=await B(c.components,xe(e),{entryExports:c.entryExports});if(e.stdout)await jt(c,e,f);else await R(c,e,f),c.cache?.save()}catch(a){if(a instanceof F)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=ie(c.diagnostics,k);if(k&&m.length>0)if(e.format==="json")o.stderr.write(oe(m));else console.error(se(m));if(l)if(e.format==="json")o.stdout.write(Se(l));else console.log(Ee(l));let y=$e({errors:c.errors,check:l,writesSnapshot:l?Te(e,l.snapshotFile):!1,checkLevel:e.checkLevel,diagnostics:m,strict:e.strict});if(y!==h.SUCCESS)o.exitCode=y}export{M as cli};
|
package/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as nodeModule from "node:module";
|
|
|
7
7
|
// 22.1+; a no-op on older Node and Bun), so startup skips recompiling them.
|
|
8
8
|
nodeModule.enableCompileCache?.();
|
|
9
9
|
|
|
10
|
-
import("./
|
|
10
|
+
import("./cli-entry.js")
|
|
11
11
|
.then(({ cli }) => cli(process))
|
|
12
12
|
.catch((error) => {
|
|
13
13
|
console.error(error);
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import type { Property } from "estree";
|
|
2
|
-
|
|
3
|
-
import type { Dirent } from "node:fs";
|
|
4
|
-
|
|
5
|
-
import { type Program } from "acorn";
|
|
6
|
-
|
|
7
1
|
interface ComponentParserDiagnostics {
|
|
8
2
|
moduleName: string;
|
|
9
3
|
filePath: string;
|
|
10
4
|
}
|
|
11
5
|
|
|
12
6
|
export class ComponentParser {
|
|
13
|
-
/**
|
|
14
|
-
* All per-parse mutable state (props, slots, events, scopes, source, etc.).
|
|
15
|
-
* See {@link ParserContext} for field-by-field documentation. Replaced
|
|
16
|
-
* wholesale by `cleanup()` between parses.
|
|
17
|
-
*/
|
|
18
7
|
private ctx;
|
|
19
8
|
/**
|
|
20
9
|
* Resets parser state for reuse between parses.
|
|
@@ -55,9 +44,9 @@ interface JsDocPassthroughTag {
|
|
|
55
44
|
type DeprecatedValue = string | true;
|
|
56
45
|
|
|
57
46
|
interface SourcePosition {
|
|
58
|
-
/** 1-based
|
|
47
|
+
/** 1-based. */
|
|
59
48
|
line: number;
|
|
60
|
-
/** 0-based
|
|
49
|
+
/** 0-based. */
|
|
61
50
|
column: number;
|
|
62
51
|
}
|
|
63
52
|
|
|
@@ -120,13 +109,9 @@ interface PendingDispatchEscapeCandidate {
|
|
|
120
109
|
}
|
|
121
110
|
|
|
122
111
|
interface PendingCrossFileCandidates {
|
|
123
|
-
/** Unresolved CallExpression defaults. */
|
|
124
112
|
pendingCallDefaultCandidates?: PendingCallDefaultCandidate[];
|
|
125
|
-
/** Imported-identifier defaults. */
|
|
126
113
|
pendingConstDefaultCandidates?: PendingConstDefaultCandidate[];
|
|
127
|
-
/** Unresolved `setContext` import keys. */
|
|
128
114
|
pendingContextKeyCandidates?: PendingContextKeyCandidate[];
|
|
129
|
-
/** Dispatchers passed to imported functions. */
|
|
130
115
|
pendingDispatchEscapeCandidates?: PendingDispatchEscapeCandidate[];
|
|
131
116
|
/**
|
|
132
117
|
* `event-no-source` diagnostics held back while the dispatcher escapes to
|
|
@@ -172,13 +157,9 @@ interface ComponentPropDefaultValue {
|
|
|
172
157
|
type ComponentPropBinding = "readonly" | "writable";
|
|
173
158
|
|
|
174
159
|
interface ComponentPropParam {
|
|
175
|
-
/** Parameter name. */
|
|
176
160
|
name: string;
|
|
177
|
-
/** Parameter type (e.g. `"string"`, `"CustomType"`). */
|
|
178
161
|
type: string;
|
|
179
|
-
/** From JSDoc `@param`. */
|
|
180
162
|
description?: string;
|
|
181
|
-
/** True when optional. */
|
|
182
163
|
optional?: boolean;
|
|
183
164
|
}
|
|
184
165
|
|
|
@@ -225,7 +206,6 @@ interface ComponentProp {
|
|
|
225
206
|
kind: "let" | "const" | "function" | "re-export" | "class";
|
|
226
207
|
/** True when declared with `const`. */
|
|
227
208
|
constant: boolean;
|
|
228
|
-
/** TypeScript type text. */
|
|
229
209
|
type?: string;
|
|
230
210
|
/** Conservative provenance for the prop type. See the precedence rule on {@link ComponentProp}. */
|
|
231
211
|
typeSource?: ComponentPropTypeSource;
|
|
@@ -262,7 +242,6 @@ interface ComponentProp {
|
|
|
262
242
|
* type/JSDoc signature in runes only (see {@link ComponentProp}).
|
|
263
243
|
*/
|
|
264
244
|
isFunction: boolean;
|
|
265
|
-
/** True for `function` declarations. */
|
|
266
245
|
isFunctionDeclaration: boolean;
|
|
267
246
|
/** True when declared with `let` and no default. */
|
|
268
247
|
isRequired: boolean;
|
|
@@ -283,14 +262,12 @@ interface ComponentProp {
|
|
|
283
262
|
internal?: boolean;
|
|
284
263
|
/** Set when `kind` is `"re-export"`. */
|
|
285
264
|
reExport?: ComponentPropReExport;
|
|
286
|
-
/** Source range when available. */
|
|
287
265
|
source?: SourceRange;
|
|
288
266
|
}
|
|
289
267
|
|
|
290
268
|
interface ComponentSlot {
|
|
291
|
-
/**
|
|
269
|
+
/** `null` for the default slot. */
|
|
292
270
|
name?: string | null;
|
|
293
|
-
/** True for the default slot. */
|
|
294
271
|
default: boolean;
|
|
295
272
|
/** Fallback content when the slot is empty. */
|
|
296
273
|
fallback?: string;
|
|
@@ -304,16 +281,12 @@ interface ComponentSlot {
|
|
|
304
281
|
tags?: JsDocPassthroughTag[];
|
|
305
282
|
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
306
283
|
internal?: boolean;
|
|
307
|
-
/** Source range when available. */
|
|
308
284
|
source?: SourceRange;
|
|
309
285
|
}
|
|
310
286
|
|
|
311
287
|
interface DispatchedEvent {
|
|
312
|
-
/** Discriminator: `"dispatched"`. */
|
|
313
288
|
type: "dispatched";
|
|
314
|
-
/** Event name. */
|
|
315
289
|
name: string;
|
|
316
|
-
/** Detail type text. */
|
|
317
290
|
detail?: string;
|
|
318
291
|
/** From JSDoc `@event`. */
|
|
319
292
|
description?: string;
|
|
@@ -323,14 +296,11 @@ interface DispatchedEvent {
|
|
|
323
296
|
tags?: JsDocPassthroughTag[];
|
|
324
297
|
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
325
298
|
internal?: boolean;
|
|
326
|
-
/** Source range when available. */
|
|
327
299
|
source?: SourceRange;
|
|
328
300
|
}
|
|
329
301
|
|
|
330
302
|
interface SerializedForwardedEvent {
|
|
331
|
-
/** Discriminator: `"forwarded"`. */
|
|
332
303
|
type: "forwarded";
|
|
333
|
-
/** Event name. */
|
|
334
304
|
name: string;
|
|
335
305
|
/** Element name as a string for JSON output. */
|
|
336
306
|
element: string;
|
|
@@ -344,7 +314,6 @@ interface SerializedForwardedEvent {
|
|
|
344
314
|
tags?: JsDocPassthroughTag[];
|
|
345
315
|
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
346
316
|
internal?: boolean;
|
|
347
|
-
/** Source range when available. */
|
|
348
317
|
source?: SourceRange;
|
|
349
318
|
}
|
|
350
319
|
|
|
@@ -353,9 +322,7 @@ export type SerializedComponentEvent = SerializedForwardedEvent | DispatchedEven
|
|
|
353
322
|
interface TypeDef {
|
|
354
323
|
/** Type text (e.g. `"{ x: number; y: number }"`). */
|
|
355
324
|
type: string;
|
|
356
|
-
/** Type name. */
|
|
357
325
|
name: string;
|
|
358
|
-
/** From JSDoc. */
|
|
359
326
|
description?: string;
|
|
360
327
|
/** Full `type` alias declaration text. */
|
|
361
328
|
ts: string;
|
|
@@ -370,9 +337,7 @@ interface TypeDef {
|
|
|
370
337
|
type ComponentGenerics = [name: string, type: string] | null;
|
|
371
338
|
|
|
372
339
|
interface ComponentInlineElement {
|
|
373
|
-
/** Discriminator: `"InlineComponent"`. */
|
|
374
340
|
type: "InlineComponent";
|
|
375
|
-
/** Component name. */
|
|
376
341
|
name: string;
|
|
377
342
|
}
|
|
378
343
|
|
|
@@ -437,20 +402,15 @@ interface ComponentCssProperty {
|
|
|
437
402
|
}
|
|
438
403
|
|
|
439
404
|
interface ComponentContextProp {
|
|
440
|
-
/** Property name. */
|
|
441
405
|
name: string;
|
|
442
|
-
/** Property type text. */
|
|
443
406
|
type: string;
|
|
444
|
-
/** From JSDoc. */
|
|
445
407
|
description?: string;
|
|
446
|
-
/** True when optional. */
|
|
447
408
|
optional: boolean;
|
|
448
409
|
/** True from `@ignore`/`@internal` JSDoc; excluded from every output by `buildComponentApiDocument`. */
|
|
449
410
|
internal?: boolean;
|
|
450
411
|
}
|
|
451
412
|
|
|
452
413
|
interface ComponentContext {
|
|
453
|
-
/** Context key from `setContext`. */
|
|
454
414
|
key: string;
|
|
455
415
|
/** Generated type name (e.g. `"ModalContext"`). */
|
|
456
416
|
typeName: string;
|
|
@@ -460,9 +420,8 @@ interface ComponentContext {
|
|
|
460
420
|
* when untyped). `properties` is empty then.
|
|
461
421
|
*/
|
|
462
422
|
type?: string;
|
|
463
|
-
/** From JSDoc. */
|
|
464
423
|
description?: string;
|
|
465
|
-
/**
|
|
424
|
+
/** Empty when {@link ComponentContext.type} is set. */
|
|
466
425
|
properties: ComponentContextProp[];
|
|
467
426
|
/** True when a `{...spread}` in the context's object literal couldn't be resolved; the generated type intersects with `Record<string, any>`. */
|
|
468
427
|
hasUnresolvedSpread?: boolean;
|
|
@@ -473,7 +432,6 @@ interface ComponentContext {
|
|
|
473
432
|
}
|
|
474
433
|
|
|
475
434
|
interface ParsedComponent {
|
|
476
|
-
/** Source range of the parsed file. */
|
|
477
435
|
source?: SourceRange;
|
|
478
436
|
syntaxMode: SyntaxMode;
|
|
479
437
|
scriptLanguage?: ScriptLanguage;
|
|
@@ -499,20 +457,16 @@ interface ParsedComponent {
|
|
|
499
457
|
cssParts?: ComponentCssPart[];
|
|
500
458
|
/** From component-level `@cssprop`/`@cssproperty` JSDoc tags. */
|
|
501
459
|
cssProperties?: ComponentCssProperty[];
|
|
502
|
-
/**
|
|
503
|
-
* Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags).
|
|
504
|
-
*/
|
|
460
|
+
/** Type guesses from this parse (unknown props, `any` contexts, orphan `@event` tags). */
|
|
505
461
|
diagnostics?: SveldDiagnostic[];
|
|
506
462
|
/** Writer-only TypeScript metadata. Not serialized to JSON. */
|
|
507
463
|
[PARSED_COMPONENT_TYPE_SCRIPT_METADATA]?: ParsedComponentTypeScriptMetadata;
|
|
508
464
|
}
|
|
509
465
|
|
|
510
|
-
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";
|
|
511
467
|
|
|
512
468
|
export type SveldDiagnosticSeverity = "error" | "warning";
|
|
513
469
|
|
|
514
|
-
export declare const DIAGNOSTIC_CODES: Record<SveldDiagnosticKind, string>;
|
|
515
|
-
|
|
516
470
|
export interface SveldDiagnostic {
|
|
517
471
|
/**
|
|
518
472
|
* File this came from, e.g. `"./Button.svelte"`, or the entry barrel
|
|
@@ -543,6 +497,8 @@ export interface DiagnosticIgnoreMatcher {
|
|
|
543
497
|
name?: string;
|
|
544
498
|
}
|
|
545
499
|
|
|
500
|
+
export declare const DIAGNOSTIC_CODES: Record<SveldDiagnosticKind, string>;
|
|
501
|
+
|
|
546
502
|
export declare const DIAGNOSTICS_SCHEMA_VERSION = 1;
|
|
547
503
|
|
|
548
504
|
export interface DiagnosticsJson {
|
|
@@ -627,7 +583,7 @@ interface GenerateBundleOptions {
|
|
|
627
583
|
* Check `@example` blocks on props, module exports, slots, and events.
|
|
628
584
|
* `true` runs plain TS/JS examples through the TypeScript program
|
|
629
585
|
* (`example-compile-error` diagnostics; requires `typescript`) and
|
|
630
|
-
* Svelte/HTML examples through sveld's
|
|
586
|
+
* Svelte/HTML examples through sveld's template parser (sveast)
|
|
631
587
|
* (`example-syntax-error` diagnostics; no `typescript` needed). Pass
|
|
632
588
|
* `"syntax"` to run only the markup path, so `typescript` is never loaded
|
|
633
589
|
* even when TS/JS examples exist. Off by default.
|
|
@@ -926,16 +882,13 @@ interface WriteTsDefinitionOptions {
|
|
|
926
882
|
/**
|
|
927
883
|
* `"class"` (default) extends the deprecated `SvelteComponentTyped`.
|
|
928
884
|
* `"component"` emits `declare const X: Component<Props, Exports, Bindings>`
|
|
929
|
-
* instead, for Svelte 5+ consumers. Generic components
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
* 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.
|
|
933
888
|
*/
|
|
934
889
|
format?: "class" | "component";
|
|
935
890
|
}
|
|
936
891
|
|
|
937
|
-
type SveldOptions = SveldRuntimeOptions;
|
|
938
|
-
|
|
939
892
|
export interface SveldResult {
|
|
940
893
|
/** Diagnostics from this run. */
|
|
941
894
|
diagnostics: SveldDiagnostic[];
|
|
@@ -959,4 +912,4 @@ export interface SveldResult {
|
|
|
959
912
|
|
|
960
913
|
type ExitCode = 0 | 1 | 2 | 3 | 4;
|
|
961
914
|
|
|
962
|
-
export declare function sveld(opts?:
|
|
915
|
+
export declare function sveld(opts?: SveldRuntimeOptions): Promise<SveldResult>;
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G,qe,d,Mt,B,Ee,$t,Se,qt,Bt,Ft}from"./chunk-rn01dzny.js";import{K}from"./chunk-28h1esfd.js";export{$t as CHECK_REPORT_SCHEMA_VERSION,K as ComponentParser,qe as DIAGNOSTICS_SCHEMA_VERSION,G as DIAGNOSTIC_CODES,d as buildComponentApiDocument,Bt as default,qt as defineConfig,Mt as diffApiDocuments,Ee as formatCheckReport,Se as formatCheckReportJson,B as runCheck,Ft as sveld};
|
package/package.json
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sveld",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Generate TypeScript definitions and component documentation for your Svelte components.",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "./
|
|
8
|
-
"types": "./
|
|
7
|
+
"main": "./index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"types": "./
|
|
12
|
-
"import": "./
|
|
13
|
-
"default": "./
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"import": "./index.js",
|
|
13
|
+
"default": "./index.js"
|
|
14
14
|
},
|
|
15
15
|
"./browser": {
|
|
16
|
-
"types": "./
|
|
17
|
-
"import": "./
|
|
18
|
-
"default": "./
|
|
16
|
+
"types": "./browser.d.ts",
|
|
17
|
+
"import": "./browser.js",
|
|
18
|
+
"default": "./browser.js"
|
|
19
19
|
},
|
|
20
20
|
"./schema/component-api.schema.json": "./schema/component-api.schema.json"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
23
|
"sveld": "cli.js"
|
|
24
24
|
},
|
|
25
|
-
"files": [
|
|
26
|
-
"lib",
|
|
27
|
-
"cli.js",
|
|
28
|
-
"schema"
|
|
29
|
-
],
|
|
30
25
|
"repository": {
|
|
31
26
|
"type": "git",
|
|
32
27
|
"url": "git+https://github.com/carbon-design-system/sveld.git"
|