@vesk/compiler 0.1.0 → 0.1.14

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/dist/vsk-tsx.d.ts CHANGED
@@ -1,3 +1,65 @@
1
+ /**
2
+ * Segment-based TSX codegen. `vskToTsx` remains the byte-identical string
3
+ * transform used by the typechecker; `compileVskCodegen` additionally
4
+ * records `CodeMapping`s (source offset -> generated offset) so the
5
+ * Volar-based LSP can map positions, hover, completions and diagnostics
6
+ * between the user's `.vsk` source and the virtual TSX file TS actually
7
+ * analyzes. Synthetic text (braces, semicolons, `.map` scaffolding) is
8
+ * emitted without a mapping; verbatim user text is mapped 1:1.
9
+ */
10
+ export interface CodeInfo {
11
+ verification?: boolean;
12
+ completion?: boolean | {
13
+ isAdditional?: boolean;
14
+ };
15
+ semantic?: boolean | {
16
+ shouldHighlight?: boolean;
17
+ shouldRename?: boolean;
18
+ };
19
+ navigation?: boolean | {
20
+ shouldRename?: boolean;
21
+ resolveRenameNewName?: (newName: string) => string;
22
+ };
23
+ structure?: boolean;
24
+ format?: boolean;
25
+ customData?: Record<string, unknown>;
26
+ }
27
+ export interface CodeMapping {
28
+ sourceOffsets: number[];
29
+ generatedOffsets: number[];
30
+ lengths: number[];
31
+ generatedLengths?: number[];
32
+ data: CodeInfo;
33
+ }
34
+ export interface StyleRegion {
35
+ /** Source range of the whole `<style>` element. */
36
+ start: number;
37
+ end: number;
38
+ /** The CSS text between the opening and closing tags. */
39
+ content: string;
40
+ }
41
+ export interface VskCodegenError {
42
+ message: string;
43
+ start: number;
44
+ end: number;
45
+ }
46
+ export interface VskCodegenOptions {
47
+ /**
48
+ * When set, `&[count] = track(...)` declarations rewrite to
49
+ * `const __cell = track(...); let count = __cell.get(); let rawCell =
50
+ * __cell;` so TypeScript infers the cell's value type (hover shows
51
+ * `number`, not `any`). Only used by the LSP — `vskToTsx` keeps the
52
+ * plain `let count: any = ...` form.
53
+ */
54
+ typedCells?: boolean;
55
+ }
56
+ export interface VskCodegenResult {
57
+ code: string;
58
+ mappings: CodeMapping[];
59
+ styleRegions: StyleRegion[];
60
+ errors: VskCodegenError[];
61
+ }
62
+ export declare function compileVskCodegen(source: string, opts?: VskCodegenOptions): VskCodegenResult;
1
63
  export declare function vskToTsx(source: string): string;
2
64
  export declare function generateVskDts(source: string): string;
3
65
  //# sourceMappingURL=vsk-tsx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vsk-tsx.d.ts","sourceRoot":"","sources":["../src/vsk-tsx.ts"],"names":[],"mappings":"AAmfA,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA8C/C;AAWD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAmDrD"}
1
+ {"version":3,"file":"vsk-tsx.d.ts","sourceRoot":"","sources":["../src/vsk-tsx.ts"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AAEH,MAAM,WAAW,QAAQ;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,eAAe,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3E,UAAU,CAAC,EAAE,OAAO,GAAG;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;KAAE,CAAC;IACtG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,MA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