@sola-air-ui/compiler 1.0.7 → 1.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.
@@ -0,0 +1,45 @@
1
+ // Type declarations for @sola-air-ui/compiler.
2
+
3
+ export interface CompileOptions {
4
+ /**
5
+ * 'esm' (default) emits a module importing from @sola-air-ui/core.
6
+ * 'iife' emits a self-contained bundle reading from window.SolaCore, for
7
+ * ServiceNow and other no-bundler hosts.
8
+ */
9
+ target?: 'esm' | 'iife';
10
+ /** Global name the IIFE build registers itself under. Default 'SolaComponent'. */
11
+ exportName?: string;
12
+ /** Source path, used in error messages and the source map. */
13
+ filename?: string;
14
+ /** Emit a source map mapping generated JS back to the .sola file. Default true. */
15
+ sourcemap?: boolean;
16
+ }
17
+
18
+ export interface CompileResult {
19
+ /** Generated JavaScript. */
20
+ code: string;
21
+ /** Class name scoping this component's styles. */
22
+ scopeHash: string;
23
+ /** Scoped CSS, empty when the component has no <style> block. */
24
+ css: string;
25
+ /** Source map for `code`, or null when `sourcemap` is false. */
26
+ map: SourceMap | null;
27
+ }
28
+
29
+ export interface SourceMap {
30
+ version: 3;
31
+ file?: string;
32
+ sources: string[];
33
+ sourcesContent: (string | null)[];
34
+ names: string[];
35
+ mappings: string;
36
+ }
37
+
38
+ /** Compiles a .sola single-file component to JavaScript. */
39
+ export function compile(source: string, options?: CompileOptions): CompileResult;
40
+
41
+ /** Mount function produced by compiling a .sola component. */
42
+ export type SolaComponent<P = Record<string, unknown>> = (
43
+ target: HTMLElement,
44
+ props?: P
45
+ ) => () => void;