sveld 0.35.0 → 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.
- package/README.md +46 -4
- package/cli.js +1 -1
- package/lib/ComponentParser.d.ts +164 -398
- package/lib/ast-guards.d.ts +2 -0
- package/lib/browser.d.ts +39 -0
- package/lib/browser.js +268 -0
- package/lib/bundle.d.ts +9 -4
- package/lib/chunk-1p4ka68s.js +2 -0
- package/lib/chunk-72hx9e9w.js +20 -0
- package/lib/chunk-7qz0hzgw.js +217 -0
- package/lib/chunk-8xw75w8t.js +10 -0
- package/lib/chunk-cxrw7gzr.js +2 -0
- package/lib/chunk-jdnsv86e.js +1 -0
- package/lib/chunk-pmj8c3yv.js +6 -0
- package/lib/chunk-s9mzxa4y.js +1 -0
- package/lib/chunk-v4q9vw0y.js +62 -0
- package/lib/chunk-xkrgedm4.js +4 -0
- package/lib/chunk-zva3xjwa.js +13 -0
- package/lib/cli-entry.d.ts +12 -0
- package/lib/cli-entry.js +1 -0
- package/lib/get-svelte-entry.d.ts +0 -1
- package/lib/index.js +1 -484
- package/lib/parse-cache.d.ts +1 -1
- package/lib/parse-entry-exports.d.ts +2 -2
- package/lib/parse-exports.d.ts +5 -1
- package/lib/parsed-component-metadata.d.ts +13 -0
- package/lib/parser/bindings.d.ts +0 -2
- package/lib/parser/context.d.ts +13 -51
- package/lib/parser/events.d.ts +0 -2
- package/lib/parser/jsdoc.d.ts +0 -4
- package/lib/parser/prop-shared.d.ts +84 -0
- package/lib/parser/props.d.ts +6 -2
- package/lib/parser/rest-props.d.ts +0 -2
- package/lib/parser/runes-detection.d.ts +13 -0
- package/lib/parser/scopes.d.ts +23 -7
- package/lib/parser/slots.d.ts +1 -6
- package/lib/parser/source-position.d.ts +0 -4
- package/lib/parser/type-resolution.d.ts +4 -14
- package/lib/parser/typescript-casts.d.ts +1 -0
- package/lib/parser/utils.d.ts +1 -0
- package/lib/parser/variable-jsdoc.d.ts +12 -0
- package/lib/parser-stack.d.ts +20 -0
- package/lib/path.d.ts +0 -1
- package/lib/resolve-types.d.ts +1 -1
- package/lib/svelte-parse.d.ts +4 -0
- package/lib/svelte-version.d.ts +1 -0
- package/lib/writer/Writer.d.ts +7 -29
- package/lib/writer/WriterMarkdown.d.ts +0 -2
- package/lib/writer/markdown-format-utils.d.ts +0 -84
- package/lib/writer/writer-json.d.ts +2 -12
- package/lib/writer/writer-markdown.d.ts +0 -2
- package/lib/writer/writer-ts-definitions-core.d.ts +1 -9
- package/lib/writer/writer-ts-definitions.d.ts +1 -28
- package/package.json +6 -1
package/lib/ast-guards.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare function isMemberExpression(node: unknown): node is MemberExpress
|
|
|
7
7
|
export declare function isObjectExpression(node: unknown): node is ObjectExpression;
|
|
8
8
|
export declare function isCallExpression(node: unknown): node is CallExpression;
|
|
9
9
|
export declare function isCallExpressionNamed(node: unknown, calleeName: string): node is CallExpression;
|
|
10
|
+
export declare function unwrapTypeCastExpression(node: unknown): unknown;
|
|
11
|
+
export declare function getTypeCastAnnotation(node: unknown): unknown;
|
|
10
12
|
export declare function isNewExpression(node: unknown): node is NewExpression;
|
|
11
13
|
export declare function isNewExpressionNamed(node: unknown, calleeName: string): node is NewExpression;
|
|
12
14
|
export declare function isFunctionDeclaration(node: unknown): node is FunctionDeclaration;
|
package/lib/browser.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe entry point.
|
|
3
|
+
*
|
|
4
|
+
* Everything exported here avoids Node built-ins (`node:fs`, `node:path`, ...),
|
|
5
|
+
* so it bundles for the browser (Vite, esbuild, webpack, Rollup) without a
|
|
6
|
+
* polyfill. It covers parsing a single component's source and rendering that
|
|
7
|
+
* result to JSON, Markdown, TypeScript definitions, or a Custom Elements
|
|
8
|
+
* Manifest — everything except the filesystem-driven project scanning
|
|
9
|
+
* (`sveld()`/`pluginSveld()`) and CLI, which only make sense in Node.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { asNormalizedPath, ComponentParser, buildComponentApiDocument } from "sveld/browser";
|
|
14
|
+
*
|
|
15
|
+
* const parser = new ComponentParser();
|
|
16
|
+
* const diagnostics = { moduleName: "Button", filePath: "Button.svelte" };
|
|
17
|
+
* const parsed = parser.parseSvelteComponent(source, diagnostics);
|
|
18
|
+
*
|
|
19
|
+
* // `parseSvelteComponent` returns component metadata only; add the fields
|
|
20
|
+
* // `ComponentDocApi` needs (`moduleName`, `filePath`) yourself.
|
|
21
|
+
* const component = {
|
|
22
|
+
* ...parsed,
|
|
23
|
+
* moduleName: diagnostics.moduleName,
|
|
24
|
+
* filePath: asNormalizedPath(diagnostics.filePath),
|
|
25
|
+
* };
|
|
26
|
+
*
|
|
27
|
+
* const doc = buildComponentApiDocument(new Map([[component.moduleName, component]]));
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export { asNormalizedPath, type NormalizedPath } from "./brands";
|
|
31
|
+
export { default as ComponentParser, type SerializedComponentEvent } from "./ComponentParser";
|
|
32
|
+
export type { SveldDiagnostic, SveldDiagnosticKind } from "./diagnostics";
|
|
33
|
+
export type { ComponentDocApi, ComponentDocs } from "./plugin";
|
|
34
|
+
export { type BuildComponentApiDocumentOptions, buildComponentApiDocument, COMPONENT_API_SCHEMA_VERSION, type ComponentApiDocument, } from "./writer/document-model";
|
|
35
|
+
export type { AppendType, MarkdownWriterBase, TocLine } from "./writer/MarkdownWriterBase";
|
|
36
|
+
export { renderComponentsToMarkdown } from "./writer/markdown-render-utils";
|
|
37
|
+
export { type BuildCustomElementsManifestOptions, buildCustomElementsManifest, type CemAttribute, type CemClassDeclaration, type CemClassField, type CemCustomElementExport, type CemEvent, type CemExport, type CemJavaScriptExport, type CemModule, type CemSlot, type CemType, type CustomElementsManifest, } from "./writer/writer-custom-elements-core";
|
|
38
|
+
export { BrowserWriterMarkdown, type WriteMarkdownCoreOptions, writeMarkdownCore, } from "./writer/writer-markdown-core";
|
|
39
|
+
export { formatTsProps, getContextDefs, getTypeDefs, type WriteTsDefinitionOptions, writeTsDefinition, } from "./writer/writer-ts-definitions-core";
|