svelte-docinfo 0.1.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.
Files changed (97) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  3. package/dist/analyze-core.d.ts +1386 -0
  4. package/dist/analyze-core.d.ts.map +1 -0
  5. package/dist/analyze-core.js +324 -0
  6. package/dist/analyze.d.ts +137 -0
  7. package/dist/analyze.d.ts.map +1 -0
  8. package/dist/analyze.js +148 -0
  9. package/dist/cli.d.ts +102 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +206 -0
  12. package/dist/concurrency.d.ts +38 -0
  13. package/dist/concurrency.d.ts.map +1 -0
  14. package/dist/concurrency.js +57 -0
  15. package/dist/declaration-build.d.ts +164 -0
  16. package/dist/declaration-build.d.ts.map +1 -0
  17. package/dist/declaration-build.js +15 -0
  18. package/dist/declaration-helpers.d.ts +169 -0
  19. package/dist/declaration-helpers.d.ts.map +1 -0
  20. package/dist/declaration-helpers.js +239 -0
  21. package/dist/dep-resolver.d.ts +166 -0
  22. package/dist/dep-resolver.d.ts.map +1 -0
  23. package/dist/dep-resolver.js +144 -0
  24. package/dist/diagnostics.d.ts +650 -0
  25. package/dist/diagnostics.d.ts.map +1 -0
  26. package/dist/diagnostics.js +377 -0
  27. package/dist/discovery.d.ts +115 -0
  28. package/dist/discovery.d.ts.map +1 -0
  29. package/dist/discovery.js +126 -0
  30. package/dist/exports.d.ts +105 -0
  31. package/dist/exports.d.ts.map +1 -0
  32. package/dist/exports.js +274 -0
  33. package/dist/files.d.ts +77 -0
  34. package/dist/files.d.ts.map +1 -0
  35. package/dist/files.js +95 -0
  36. package/dist/index.d.ts +32 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +30 -0
  39. package/dist/log.d.ts +32 -0
  40. package/dist/log.d.ts.map +1 -0
  41. package/dist/log.js +11 -0
  42. package/dist/logo.d.ts +8 -0
  43. package/dist/logo.d.ts.map +1 -0
  44. package/dist/logo.js +9 -0
  45. package/dist/main.d.ts +11 -0
  46. package/dist/main.d.ts.map +1 -0
  47. package/dist/main.js +18 -0
  48. package/dist/paths.d.ts +35 -0
  49. package/dist/paths.d.ts.map +1 -0
  50. package/dist/paths.js +34 -0
  51. package/dist/postprocess.d.ts +145 -0
  52. package/dist/postprocess.d.ts.map +1 -0
  53. package/dist/postprocess.js +305 -0
  54. package/dist/session.d.ts +248 -0
  55. package/dist/session.d.ts.map +1 -0
  56. package/dist/session.js +496 -0
  57. package/dist/source-config.d.ts +330 -0
  58. package/dist/source-config.d.ts.map +1 -0
  59. package/dist/source-config.js +356 -0
  60. package/dist/source.d.ts +126 -0
  61. package/dist/source.d.ts.map +1 -0
  62. package/dist/source.js +68 -0
  63. package/dist/svelte.d.ts +179 -0
  64. package/dist/svelte.d.ts.map +1 -0
  65. package/dist/svelte.js +898 -0
  66. package/dist/tsdoc.d.ts +145 -0
  67. package/dist/tsdoc.d.ts.map +1 -0
  68. package/dist/tsdoc.js +262 -0
  69. package/dist/types.d.ts +3381 -0
  70. package/dist/types.d.ts.map +1 -0
  71. package/dist/types.js +588 -0
  72. package/dist/typescript-exports.d.ts +91 -0
  73. package/dist/typescript-exports.d.ts.map +1 -0
  74. package/dist/typescript-exports.js +656 -0
  75. package/dist/typescript-extract-class.d.ts +29 -0
  76. package/dist/typescript-extract-class.d.ts.map +1 -0
  77. package/dist/typescript-extract-class.js +251 -0
  78. package/dist/typescript-extract-function.d.ts +47 -0
  79. package/dist/typescript-extract-function.d.ts.map +1 -0
  80. package/dist/typescript-extract-function.js +108 -0
  81. package/dist/typescript-extract-shared.d.ts +166 -0
  82. package/dist/typescript-extract-shared.d.ts.map +1 -0
  83. package/dist/typescript-extract-shared.js +528 -0
  84. package/dist/typescript-extract-type-properties.d.ts +34 -0
  85. package/dist/typescript-extract-type-properties.d.ts.map +1 -0
  86. package/dist/typescript-extract-type-properties.js +241 -0
  87. package/dist/typescript-extract-type.d.ts +48 -0
  88. package/dist/typescript-extract-type.d.ts.map +1 -0
  89. package/dist/typescript-extract-type.js +238 -0
  90. package/dist/typescript-program.d.ts +211 -0
  91. package/dist/typescript-program.d.ts.map +1 -0
  92. package/dist/typescript-program.js +290 -0
  93. package/dist/vite.d.ts +116 -0
  94. package/dist/vite.d.ts.map +1 -0
  95. package/dist/vite.js +418 -0
  96. package/package.json +131 -0
  97. package/virtual-svelte-docinfo.d.ts +49 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Module-level export analysis: resolve every export of a TypeScript source
3
+ * file into a `DeclarationAnalysis`, including re-export classification.
4
+ *
5
+ * Builds on the per-declaration extractors in `typescript-extract-*.ts` by
6
+ * adding the orchestration layer — alias chain walking, namespace
7
+ * classification, JSDoc routing for re-exports, default-slot handling.
8
+ *
9
+ * @see `typescript-program.ts` for `IsExternalFile` and program construction
10
+ * @see `typescript-extract-*.ts` for the per-declaration extractors
11
+ *
12
+ * @module
13
+ */
14
+ import ts from 'typescript';
15
+ import type { DeclarationAnalysis, ModuleAnalysis, ModuleExportsAnalysis } from './declaration-build.js';
16
+ import type { Diagnostic } from './diagnostics.js';
17
+ import { type SourceFileInfo } from './source.js';
18
+ import { type ModuleSourceOptions } from './source-config.js';
19
+ import { type IsExternalFile } from './typescript-program.js';
20
+ /**
21
+ * Analyze a TypeScript file and extract module metadata.
22
+ *
23
+ * Wraps `analyzeExports` and adds dependency information via `extractDependencies`
24
+ * from the source file info if available.
25
+ *
26
+ * This is a high-level function suitable for building documentation or library metadata.
27
+ * For lower-level analysis, use `analyzeExports` directly.
28
+ *
29
+ * @param sourceFileInfo - the source file info (from file system, build pipeline, or other source)
30
+ * @param tsSourceFile - TypeScript source file from the program
31
+ * @param modulePath - the module path (relative to source root)
32
+ * @param checker - TypeScript type checker
33
+ * @param options - module source options for path extraction
34
+ * @param diagnostics - diagnostics collector for non-fatal issues
35
+ * @returns module metadata and re-export information
36
+ */
37
+ export declare const analyzeTypescriptModule: (sourceFileInfo: SourceFileInfo & {
38
+ dependents?: ReadonlyArray<string>;
39
+ }, tsSourceFile: ts.SourceFile, modulePath: string, checker: ts.TypeChecker, options: ModuleSourceOptions, diagnostics: Array<Diagnostic>) => ModuleAnalysis;
40
+ /**
41
+ * Analyze all exports from a TypeScript source file.
42
+ *
43
+ * Extracts the module-level comment via `extractModuleComment`, star exports via
44
+ * `extractStarExports`, and all exported declarations with complete metadata.
45
+ * Handles re-exports by:
46
+ * - Same-name re-exports: tracked in `reExports` for `alsoExportedFrom` building
47
+ * - Renamed re-exports: included as new declarations with `aliasOf` metadata
48
+ * - Star exports (`export * from`): tracked in `starExports` for namespace-level info
49
+ *
50
+ * This is a mid-level function (above the individual `extract*` helpers, below `analyze`)
51
+ * suitable for building documentation, API explorers, or analysis tools.
52
+ * For standard SvelteKit library layouts, use `createSourceOptions(process.cwd())`.
53
+ *
54
+ * @param sourceFile - the TypeScript source file to analyze
55
+ * @param checker - the TypeScript type checker
56
+ * @param options - module source options for path extraction in re-exports
57
+ * @param diagnostics - diagnostics collector for non-fatal issues
58
+ * @returns module comment, declarations, re-exports, and star exports
59
+ */
60
+ export declare const analyzeExports: (sourceFile: ts.SourceFile, checker: ts.TypeChecker, options: ModuleSourceOptions, diagnostics: Array<Diagnostic>) => ModuleExportsAnalysis;
61
+ /**
62
+ * Analyze a TypeScript symbol and extract rich metadata.
63
+ *
64
+ * This is a high-level function that combines TSDoc parsing with TypeScript
65
+ * type analysis to produce complete declaration metadata. Suitable for use
66
+ * in documentation generators, IDE integrations, and other tooling.
67
+ *
68
+ * @param symbol - the TypeScript symbol to analyze
69
+ * @param sourceFile - the source file containing the symbol
70
+ * @param checker - the TypeScript type checker
71
+ * @param diagnostics - diagnostics collector for non-fatal issues
72
+ * @param isExternalFile - predicate for determining whether a source file is external to the project
73
+ * @returns complete declaration metadata including docs, types, and parameters, plus nodocs flag
74
+ */
75
+ export declare const analyzeDeclaration: (symbol: ts.Symbol, sourceFile: ts.SourceFile, checker: ts.TypeChecker, diagnostics: Array<Diagnostic>, isExternalFile: IsExternalFile) => DeclarationAnalysis;
76
+ /**
77
+ * Extract module-level comment.
78
+ *
79
+ * @internal Used by `analyzeTypescriptModule` and `analyzeSvelteModule`'s
80
+ * `<script module>` handling. Exposed via the `svelte-docinfo/typescript-exports.js`
81
+ * subpath so the Svelte analyzer can reuse it without circular imports, but
82
+ * **not part of the stable barrel export**.
83
+ *
84
+ * Requires `@module` tag to identify module comments. The tag line is stripped
85
+ * from the output. Supports optional module renaming: `@module custom-name`.
86
+ *
87
+ * @returns cleaned module comment text (with `@module` line removed), or `undefined` if no `@module` comment found
88
+ * @see {@link https://typedoc.org/documents/Tags._module.html|TypeDoc @module documentation}
89
+ */
90
+ export declare const extractModuleComment: (sourceFile: ts.SourceFile) => string | undefined;
91
+ //# sourceMappingURL=typescript-exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-exports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/typescript-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EACX,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EAGrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EACN,KAAK,cAAc,EAInB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,mBAAmB,EAIxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,KAAK,cAAc,EAAuB,MAAM,yBAAyB,CAAC;AAMlF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GACnC,gBAAgB,cAAc,GAAG;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAC,EACrE,cAAc,EAAE,CAAC,UAAU,EAC3B,YAAY,MAAM,EAClB,SAAS,EAAE,CAAC,WAAW,EACvB,SAAS,mBAAmB,EAC5B,aAAa,KAAK,CAAC,UAAU,CAAC,KAC5B,cAqBF,CAAC;AAqJF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,GAC1B,YAAY,EAAE,CAAC,UAAU,EACzB,SAAS,EAAE,CAAC,WAAW,EACvB,SAAS,mBAAmB,EAC5B,aAAa,KAAK,CAAC,UAAU,CAAC,KAC5B,qBA2VF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAC9B,QAAQ,EAAE,CAAC,MAAM,EACjB,YAAY,EAAE,CAAC,UAAU,EACzB,SAAS,EAAE,CAAC,WAAW,EACvB,aAAa,KAAK,CAAC,UAAU,CAAC,EAC9B,gBAAgB,cAAc,KAC5B,mBA+CF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAY,EAAE,CAAC,UAAU,KAAG,MAAM,GAAG,SAqCzE,CAAC"}