sveld 0.35.1 → 0.35.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.
Files changed (51) hide show
  1. package/README.md +0 -4
  2. package/cli.js +1 -1
  3. package/lib/ComponentParser.d.ts +139 -401
  4. package/lib/ast-guards.d.ts +0 -2
  5. package/lib/browser.js +203 -225
  6. package/lib/bundle.d.ts +1 -3
  7. package/lib/chunk-1p4ka68s.js +2 -0
  8. package/lib/chunk-72hx9e9w.js +20 -0
  9. package/lib/chunk-7qz0hzgw.js +217 -0
  10. package/lib/chunk-8xw75w8t.js +10 -0
  11. package/lib/chunk-cxrw7gzr.js +2 -0
  12. package/lib/chunk-jdnsv86e.js +1 -0
  13. package/lib/chunk-pmj8c3yv.js +6 -0
  14. package/lib/chunk-s9mzxa4y.js +1 -0
  15. package/lib/chunk-v4q9vw0y.js +62 -0
  16. package/lib/chunk-xkrgedm4.js +4 -0
  17. package/lib/chunk-zva3xjwa.js +13 -0
  18. package/lib/cli-entry.d.ts +12 -0
  19. package/lib/cli-entry.js +1 -0
  20. package/lib/get-svelte-entry.d.ts +0 -1
  21. package/lib/index.js +1 -343
  22. package/lib/parse-cache.d.ts +1 -1
  23. package/lib/parse-entry-exports.d.ts +2 -2
  24. package/lib/parsed-component-metadata.d.ts +13 -0
  25. package/lib/parser/bindings.d.ts +0 -2
  26. package/lib/parser/context.d.ts +7 -49
  27. package/lib/parser/events.d.ts +0 -2
  28. package/lib/parser/jsdoc.d.ts +0 -4
  29. package/lib/parser/prop-shared.d.ts +84 -0
  30. package/lib/parser/props.d.ts +0 -2
  31. package/lib/parser/rest-props.d.ts +0 -2
  32. package/lib/parser/runes-detection.d.ts +1 -4
  33. package/lib/parser/scopes.d.ts +0 -2
  34. package/lib/parser/slots.d.ts +0 -5
  35. package/lib/parser/source-position.d.ts +0 -4
  36. package/lib/parser/type-resolution.d.ts +0 -15
  37. package/lib/parser/typescript-casts.d.ts +0 -1
  38. package/lib/parser/utils.d.ts +1 -0
  39. package/lib/parser/variable-jsdoc.d.ts +12 -0
  40. package/lib/parser-stack.d.ts +20 -0
  41. package/lib/path.d.ts +0 -1
  42. package/lib/svelte-parse.d.ts +4 -0
  43. package/lib/svelte-version.d.ts +1 -0
  44. package/lib/writer/Writer.d.ts +7 -29
  45. package/lib/writer/WriterMarkdown.d.ts +0 -2
  46. package/lib/writer/markdown-format-utils.d.ts +0 -84
  47. package/lib/writer/writer-json.d.ts +2 -12
  48. package/lib/writer/writer-markdown.d.ts +0 -2
  49. package/lib/writer/writer-ts-definitions-core.d.ts +1 -9
  50. package/lib/writer/writer-ts-definitions.d.ts +1 -28
  51. package/package.json +1 -1
@@ -9,25 +9,15 @@ export interface WriteJsonOptions {
9
9
  entryExports?: EntryExports;
10
10
  }
11
11
  /**
12
- * Writes component documentation to JSON format.
13
- *
14
- * Can write either:
15
- * - Individual JSON files per component (when `outDir` is specified)
16
- * - A single combined JSON file (when only `outFile` is specified)
17
- *
18
- * @param components - Map of component documentation to write
19
- * @param options - Write options including output directory or file
20
- * @returns A promise that resolves when all files have been written
21
- *
22
12
  * @example
23
13
  * ```ts
24
- * // Write individual files:
14
+ * // Per-component files:
25
15
  * await writeJson(components, {
26
16
  * inputDir: "./src",
27
17
  * outDir: "./dist"
28
18
  * });
29
19
  *
30
- * // Write single file:
20
+ * // Single combined file:
31
21
  * await writeJson(components, {
32
22
  * inputDir: "./src",
33
23
  * outFile: "components.api.json"
@@ -9,8 +9,6 @@ export interface WriteMarkdownOptions {
9
9
  onAppend?: (type: AppendType, document: WriterMarkdown, components: ComponentDocs) => void;
10
10
  }
11
11
  /**
12
- * Renders component docs to markdown and optionally writes `outFile`.
13
- *
14
12
  * @example
15
13
  * ```ts
16
14
  * const markdown = await writeMarkdown(components, {
@@ -2,23 +2,15 @@ import type { ComponentDocApi } from "../plugin";
2
2
  export declare function formatTsProps(props?: string): string;
3
3
  export declare function getTypeDefs(def: Pick<ComponentDocApi, "typedefs">): string;
4
4
  /**
5
- * Generates TypeScript type definitions for component contexts.
6
- *
7
- * Creates exported type definitions for each context, including generic
8
- * type parameters when contexts reference component generics. Handles
9
- * empty context objects by using `Record<string, never>`.
5
+ * Exported context type definitions for a component.
10
6
  *
11
7
  * @param def - Component documentation containing contexts and generics
12
8
  * @returns TypeScript type definition string, or empty string if no contexts
13
9
  *
14
10
  * @example
15
11
  * ```ts
16
- * // Input: contexts with generic reference
17
- * // Output:
18
12
  * // export type ModalContext<T> = {
19
- * // /** Open the modal *\/
20
13
  * // open: () => void;
21
- * // /** Close the modal *\/
22
14
  * // close: () => void;
23
15
  * // };
24
16
  * ```
@@ -12,14 +12,6 @@ import { type WriteTsDefinitionOptions } from "./writer-ts-definitions-core";
12
12
  */
13
13
  export { formatTsProps, getContextDefs, getTypeDefs, type WriteTsDefinitionOptions, writeTsDefinition, } from "./writer-ts-definitions-core";
14
14
  /**
15
- * Options for writing TypeScript definition files.
16
- *
17
- * @property outDir - The output directory where `.d.ts` files will be written
18
- * @property inputDir - The input directory containing source components
19
- * @property preamble - Text to prepend to the main `index.d.ts` file
20
- * @property exports - Parsed export information for generating the index file
21
- * @property format - `"class"` (default) or `"component"`; see {@link WriteTsDefinitionOptions}
22
- *
23
15
  * @example
24
16
  * ```ts
25
17
  * const options: WriteTsDefinitionsOptions = {
@@ -37,34 +29,15 @@ export interface WriteTsDefinitionsOptions extends WriteTsDefinitionOptions {
37
29
  exports: ParsedExports;
38
30
  }
39
31
  /**
40
- * Writes TypeScript definition files for all parsed Svelte components.
41
- *
42
- * Generates individual `.d.ts` files for each component and a main `index.d.ts`
43
- * file that exports all components. Uses a TypeScript writer to handle file
44
- * I/O operations efficiently.
45
- *
46
- * @param components - Map of component module names to their parsed documentation
47
- * @param options - Configuration options for writing definitions
48
- * @returns A promise that resolves when all files have been written
49
- *
50
32
  * @example
51
33
  * ```ts
52
- * const components = new Map([
53
- * ["Button", { filePath: "Button.svelte", props: [...], ... }],
54
- * ["Input", { filePath: "Input.svelte", props: [...], ... }]
55
- * ]);
56
- *
57
34
  * await writeTsDefinitions(components, {
58
35
  * outDir: "./dist",
59
36
  * inputDir: "./src",
60
37
  * preamble: "// Generated\n",
61
38
  * exports: { ... }
62
39
  * });
63
- *
64
- * // Creates:
65
- * // - dist/Button.d.ts
66
- * // - dist/Input.d.ts
67
- * // - dist/index.d.ts
40
+ * // Creates dist/Button.d.ts, dist/Input.d.ts, dist/index.d.ts
68
41
  * ```
69
42
  */
70
43
  export default function writeTsDefinitions(components: ComponentDocs, options: WriteTsDefinitionsOptions): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveld",
3
- "version": "0.35.1",
3
+ "version": "0.35.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Generate TypeScript definitions and component documentation for your Svelte components.",
6
6
  "type": "module",