fusee-framework 1.7.0 → 1.9.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 (77) hide show
  1. package/README.md +206 -139
  2. package/app/benchmark/benchmark.js +2 -2
  3. package/app/benchmark/vite.config.js +23 -0
  4. package/app/main.js +24 -3
  5. package/app/main.ts +7 -1
  6. package/app/pages/_layout.js +27 -0
  7. package/app/pages/async-work.js +65 -0
  8. package/app/pages/index.js +25 -5
  9. package/app/pages/index.ts +9 -0
  10. package/app/pages/router-example.js +24 -1
  11. package/app/pages/scroll-demo.ts +102 -0
  12. package/app/providers/ChildComponent.js +8 -2
  13. package/app/providers/ChildComponent.ts +47 -47
  14. package/app/providers/GrandchildComponent.js +19 -0
  15. package/app/providers/ParentComponent.js +5 -1
  16. package/app/routes/RouterExample.js +23 -1
  17. package/app/routes/TestResource.js +47 -0
  18. package/app/services.js +15 -0
  19. package/auto-imports.d.ts +12 -0
  20. package/framework/auto-import-preset.js +15 -9
  21. package/framework/core/async-context.js +27 -0
  22. package/framework/core/compiler/ast.js +167 -0
  23. package/framework/core/compiler/errors-list.js +47 -0
  24. package/framework/core/compiler/errors.js +107 -0
  25. package/framework/core/compiler/generator.js +363 -0
  26. package/framework/core/compiler/lexer.js +347 -0
  27. package/framework/core/compiler/main-compiler.js +115 -0
  28. package/framework/core/compiler/parser.js +414 -0
  29. package/framework/core/compiler/plugins/actions-plugin.js +263 -0
  30. package/framework/core/compiler/plugins/compiler-plugin.d.ts +5 -0
  31. package/framework/core/compiler/plugins/compiler-plugin.js +45 -0
  32. package/framework/core/compiler/plugins/file-router-plugin.js +301 -0
  33. package/framework/core/compiler/plugins/router-plugin.js +196 -0
  34. package/framework/core/compiler/transformer.js +398 -0
  35. package/framework/core/component.js +61 -23
  36. package/framework/core/di.js +187 -0
  37. package/framework/core/directives.js +40 -96
  38. package/framework/core/evaluator.js +1 -1
  39. package/framework/core/h.js +430 -0
  40. package/framework/core/hydration.js +83 -0
  41. package/framework/core/reconcile.js +151 -0
  42. package/framework/core/signal.js +269 -0
  43. package/framework/core/store.js +322 -81
  44. package/framework/index.js +5 -3
  45. package/framework/router/file-router.js +1 -1
  46. package/framework/router/router.js +113 -21
  47. package/framework/server/actions.js +173 -0
  48. package/framework/server/actions.server.js +88 -0
  49. package/framework/server/index.js +18 -0
  50. package/framework/types/actions.d.ts +50 -0
  51. package/framework/types/actions.server.d.ts +36 -0
  52. package/framework/types/compiler/ast.d.ts +166 -0
  53. package/framework/types/compiler/errors-codes.d.ts +23 -0
  54. package/framework/types/compiler/errors.d.ts +43 -0
  55. package/framework/types/compiler/generator.d.ts +8 -0
  56. package/framework/types/compiler/h.d.ts +46 -0
  57. package/framework/types/compiler/lexer.d.ts +27 -0
  58. package/framework/types/compiler/main-compiler.d.ts +60 -0
  59. package/framework/types/compiler/parser.d.ts +4 -0
  60. package/framework/types/compiler/plugins/actions.d.ts +30 -0
  61. package/framework/types/compiler/plugins/compiler-plugin.d.ts +5 -0
  62. package/framework/types/compiler/plugins/file-router-plugins.d.ts +32 -0
  63. package/framework/types/compiler/plugins/router-plugin.d.ts +24 -0
  64. package/framework/types/compiler/transformer.d.ts +28 -0
  65. package/framework/types/component.d.ts +89 -88
  66. package/framework/types/di.d.ts +43 -0
  67. package/framework/types/hydration.d.ts +30 -0
  68. package/framework/types/index.d.ts +38 -22
  69. package/framework/types/reconcile.d.ts +7 -0
  70. package/framework/types/router.d.ts +11 -1
  71. package/framework/types/server.d.ts +11 -0
  72. package/framework/types/signal.d.ts +142 -79
  73. package/framework/types/store.d.ts +66 -8
  74. package/ghid_go_fusee_integrat_go1_26.txt +276 -0
  75. package/ghid_rust_fusee_rust_1_95_0.txt +1118 -0
  76. package/package.json +44 -36
  77. package/vite.config.js +65 -47
@@ -0,0 +1,166 @@
1
+ export declare const NodeType: {
2
+ readonly ROOT: 'Root'
3
+ readonly ELEMENT: 'Element'
4
+ readonly COMPONENT: 'Component'
5
+ readonly TEXT: 'Text'
6
+ readonly INTERPOLATION: 'Interpolation'
7
+ readonly EXPRESSION: 'Expression'
8
+ readonly ATTRIBUTE: 'Attribute'
9
+ readonly BINDING: 'Binding'
10
+ readonly EVENT: 'Event'
11
+ readonly DIRECTIVE: 'Directive'
12
+ readonly SLOT_OUTLET: 'SlotOutlet'
13
+ readonly SLOT_CONTENT: 'SlotContent'
14
+ }
15
+
16
+ export type NodeTypeValue = typeof NodeType[keyof typeof NodeType]
17
+
18
+ export interface Position {
19
+ line: number
20
+ col: number
21
+ offset: number
22
+ }
23
+
24
+ export interface SourceLocation {
25
+ start: Position
26
+ end: Position
27
+ source?: string
28
+ }
29
+
30
+ export interface BaseNode {
31
+ type: NodeTypeValue | 'If'
32
+ loc: SourceLocation | null
33
+ }
34
+
35
+ export interface RootNode extends BaseNode {
36
+ type: 'Root'
37
+ children: ChildNode[]
38
+ _hoisted?: AnyNode[]
39
+ }
40
+
41
+ export interface ElementNode extends BaseNode {
42
+ type: 'Element'
43
+ tag: string
44
+ props: PropNode[]
45
+ children: ChildNode[]
46
+ selfClosing: boolean
47
+ isStatic: boolean
48
+ hoisted: boolean
49
+ }
50
+
51
+ export interface ComponentNode extends BaseNode {
52
+ type: 'Component'
53
+ name: string
54
+ props: PropNode[]
55
+ slots: Record<string, ChildNode[]>
56
+ isStatic: boolean
57
+ }
58
+
59
+ export interface TextNode extends BaseNode {
60
+ type: 'Text'
61
+ content: string
62
+ isStatic: true
63
+ }
64
+
65
+ export interface InterpolationNode extends BaseNode {
66
+ type: 'Interpolation'
67
+ expression: ExpressionNode
68
+ isStatic: boolean
69
+ }
70
+
71
+ export interface ExpressionNode extends BaseNode {
72
+ type: 'Expression'
73
+ content: string
74
+ isStatic: boolean
75
+ _isForKey?: boolean
76
+ }
77
+
78
+ export interface AttributeNode extends BaseNode {
79
+ type: 'Attribute'
80
+ name: string
81
+ value: string | null
82
+ }
83
+
84
+ export interface BindingNode extends BaseNode {
85
+ type: 'Binding'
86
+ name: string
87
+ expression: ExpressionNode
88
+ isProp: boolean
89
+ }
90
+
91
+ export interface EventNode extends BaseNode {
92
+ type: 'Event'
93
+ name: string
94
+ expression: ExpressionNode
95
+ modifiers: string[]
96
+ }
97
+
98
+ export type DirectiveName = 'if' | 'else-if' | 'else' | 'for' | 'model' | 'show' | 'once' | 'ref' | 'html' | string
99
+
100
+ export interface DirectiveNode extends BaseNode {
101
+ type: 'Directive'
102
+ name: DirectiveName
103
+ expression: ExpressionNode | null
104
+ arg: ForArg | null
105
+ }
106
+
107
+ export interface SlotOutletNode extends BaseNode {
108
+ type: 'SlotOutlet'
109
+ slotName: string
110
+ fallback: ChildNode[]
111
+ }
112
+
113
+ export interface SlotContentNode extends BaseNode {
114
+ type: 'SlotContent'
115
+ slotName: string
116
+ children: ChildNode[]
117
+ }
118
+
119
+ export interface IfNode {
120
+ type: 'If'
121
+ branches: IfBranch[]
122
+ loc: SourceLocation | null
123
+ isStatic: false
124
+ }
125
+
126
+ export interface IfBranch {
127
+ condition: ExpressionNode | null
128
+ node: ElementNode | ComponentNode
129
+ }
130
+
131
+ export interface ForArg {
132
+ item: string
133
+ source: string
134
+ index: string | null
135
+ loc: SourceLocation | null
136
+ }
137
+
138
+ export type PropNode = AttributeNode | BindingNode | EventNode | DirectiveNode
139
+ export type ChildNode = ElementNode | ComponentNode | TextNode | InterpolationNode | SlotOutletNode | SlotContentNode | IfNode
140
+ export type AnyNode = RootNode | ChildNode | PropNode | ExpressionNode | ForArg
141
+
142
+ export declare function createLoc(start: Position, end: Position, source?: string): SourceLocation
143
+ export declare function createPos(line: number, col: number, offset: number): Position
144
+ export declare function createRoot(children?: ChildNode[], loc?: SourceLocation | null): RootNode
145
+ export declare function createElement(tag: string, props?: PropNode[], children?: ChildNode[], selfClosing?: boolean, loc?: SourceLocation | null): ElementNode
146
+ export declare function createComponent(name: string, props?: PropNode[], slots?: Record<string, ChildNode[]>, loc?: SourceLocation | null): ComponentNode
147
+ export declare function createText(content: string, loc?: SourceLocation | null): TextNode
148
+ export declare function createInterpolation(expression: ExpressionNode, loc?: SourceLocation | null): InterpolationNode
149
+ export declare function createExpression(content: string, isStatic?: boolean, loc?: SourceLocation | null): ExpressionNode
150
+ export declare function createAttribute(name: string, value: string | null, loc?: SourceLocation | null): AttributeNode
151
+ export declare function createBinding(name: string, expression: ExpressionNode, isProp?: boolean, loc?: SourceLocation | null): BindingNode
152
+ export declare function createEvent(name: string, expression: ExpressionNode, modifiers?: string[], loc?: SourceLocation | null): EventNode
153
+ export declare function createDirective(name: DirectiveName, expression?: ExpressionNode | null, arg?: ForArg | null, loc?: SourceLocation | null): DirectiveNode
154
+ export declare function createSlotOutlet(slotName?: string, fallback?: ChildNode[], loc?: SourceLocation | null): SlotOutletNode
155
+ export declare function createSlotContent(slotName?: string, children?: ChildNode[], loc?: SourceLocation | null): SlotContentNode
156
+ export declare function createForArg(item: string, source: string, index?: string | null, loc?: SourceLocation | null): ForArg
157
+
158
+ export declare function isElement(node: AnyNode | null | undefined): node is ElementNode
159
+ export declare function isComponent(node: AnyNode | null | undefined): node is ComponentNode
160
+ export declare function isText(node: AnyNode | null | undefined): node is TextNode
161
+ export declare function isInterpolation(node: AnyNode | null | undefined): node is InterpolationNode
162
+ export declare function isDirective(node: AnyNode | null | undefined, name?: DirectiveName): node is DirectiveNode
163
+ export declare function isStaticText(node: AnyNode | null | undefined): boolean
164
+ export declare function findDirective(element: ElementNode | ComponentNode, name: DirectiveName): DirectiveNode | null
165
+ export declare function getEvents(element: ElementNode | ComponentNode): EventNode[]
166
+ export declare function cloneNode<T extends AnyNode>(node: T): T
@@ -0,0 +1,23 @@
1
+ export declare const ErrorCode: {
2
+ readonly UNEXPECTED_CHAR: 'E001'
3
+ readonly UNTERMINATED_STRING: 'E002'
4
+ readonly UNTERMINATED_MUSTACHE: 'E003'
5
+ readonly UNTERMINATED_TAG: 'E004'
6
+ readonly MALFORMED_COMMENT: 'E005'
7
+ readonly UNEXPECTED_TOKEN: 'P001'
8
+ readonly MISSING_CLOSING_TAG: 'P002'
9
+ readonly UNEXPECTED_CLOSING_TAG: 'P003'
10
+ readonly INVALID_DIRECTIVE_SYNTAX: 'P004'
11
+ readonly INVALID_FOR_SYNTAX: 'P005'
12
+ readonly DUPLICATE_KEY: 'P006'
13
+ readonly V_ELSE_NO_IF: 'P007'
14
+ readonly EMPTY_EXPRESSION: 'P008'
15
+ readonly INVALID_SLOT_NAME: 'P009'
16
+ readonly DUPLICATE_DIRECTIVE: 'T001'
17
+ readonly FOR_MISSING_KEY: 'T002'
18
+ readonly MODEL_ON_NON_INPUT: 'T003'
19
+ readonly COMPONENT_NOT_REGISTERED: 'T004'
20
+ readonly UNKNOWN_IDENTIFIER: 'S001'
21
+ readonly STATIC_FOR_KEY: 'S002'
22
+ readonly UNKNOWN_NODE_TYPE: 'G001'
23
+ }
@@ -0,0 +1,43 @@
1
+ import type { SourceLocation } from './ast.js'
2
+ import type { ErrorCode } from './errors-list.js'
3
+
4
+ export type ErrorCodeValue = typeof ErrorCode[keyof typeof ErrorCode]
5
+
6
+ export declare class CompileError extends Error {
7
+ readonly name: 'CompileError'
8
+ readonly code: ErrorCodeValue
9
+ readonly loc: SourceLocation | null
10
+ readonly source: string
11
+
12
+ constructor(code: ErrorCodeValue, loc: SourceLocation | null, source: string, ...args: string[])
13
+
14
+ format(filePath?: string): string
15
+ _buildSnippet(): string
16
+ }
17
+
18
+ export declare class CompileWarning {
19
+ readonly message: string
20
+ readonly code: ErrorCodeValue
21
+ readonly loc: SourceLocation | null
22
+ readonly source: string
23
+
24
+ constructor(code: ErrorCodeValue, loc: SourceLocation | null, source: string, ...args: string[])
25
+
26
+ format(filePath?: string): string
27
+ }
28
+
29
+ export declare class ErrorCollector {
30
+ readonly source: string
31
+ readonly errors: CompileError[]
32
+ readonly warnings: CompileWarning[]
33
+ readonly hasErrors: boolean
34
+ readonly hasWarnings: boolean
35
+
36
+ constructor(source: string)
37
+
38
+ error(code: ErrorCodeValue, loc: SourceLocation | null, ...args: string[]): CompileError
39
+ warn(code: ErrorCodeValue, loc: SourceLocation | null, ...args: string[]): CompileWarning
40
+ throwIfAny(): void
41
+ }
42
+
43
+ export declare function throwError(code: ErrorCodeValue, loc: SourceLocation | null, source: string, ...args: string[]): never
@@ -0,0 +1,8 @@
1
+ import type { RootNode } from './ast.js'
2
+
3
+ export interface GenerateOptions {
4
+ runtimePath?: string
5
+ source?: string
6
+ }
7
+
8
+ export declare function generate(ast: RootNode, options?: GenerateOptions): string
@@ -0,0 +1,46 @@
1
+ export interface FNode {
2
+ node: Node
3
+ effects: Array<() => void>
4
+ _isIf?: boolean
5
+ _isFor?: boolean
6
+ _isSlot?: boolean
7
+ _tag?: string
8
+ _component?: ComponentApi
9
+ _ifBranchNodes?: () => FNode[]
10
+ _getNodes?: () => FNode[]
11
+ _slotNodes?: FNode[]
12
+ props?: Record<string, unknown>
13
+ children?: FNode[]
14
+ }
15
+
16
+ export interface ComponentApi {
17
+ render(container: HTMLElement): unknown
18
+ unmount(): void
19
+ instance: unknown
20
+ }
21
+
22
+ export type StaticPropValue = string | boolean | null
23
+ export type PropGetter<T = unknown> = () => T
24
+ export interface EventDescriptor {
25
+ handler: ((...args: unknown[]) => void) | null
26
+ modifiers: string[]
27
+ }
28
+
29
+ export type SlotMap = Record<string, () => FNode[]>
30
+ export type PropsMap = Record<string, StaticPropValue | PropGetter | EventDescriptor | true>
31
+
32
+ export declare function h(tag: string, props?: PropsMap, children?: FNode[], isStatic?: boolean): FNode
33
+ export declare function hText(value: string | (() => string)): FNode
34
+ export declare function hIf(branches: Array<[(() => boolean) | null, () => FNode[]]>): FNode
35
+ export declare function hFor<T>(sourceGetter: () => T[], renderItem: (item: T, index?: number) => FNode, keyFn: (item: T, index?: number) => unknown): FNode
36
+ export declare function hSlot(slots: SlotMap | null | undefined, name: string, fallback?: FNode[]): FNode
37
+ export declare function createComponent(name: string, ComponentFn: ((...args: unknown[]) => ComponentApi) | undefined | null, rawProps?: PropsMap, rawSlots?: SlotMap): FNode
38
+
39
+ export interface MountedApp {
40
+ unmount(): void
41
+ }
42
+
43
+ export declare function mount(renderFn: (ctx: unknown, components: Record<string, unknown>) => FNode[], ctx: unknown, components: Record<string, unknown>, container: HTMLElement): MountedApp
44
+
45
+ export declare const _effect: (fn: () => void) => () => void
46
+ export declare const _batch: <T>(fn: () => T) => T
@@ -0,0 +1,27 @@
1
+ import type { SourceLocation } from './ast.js'
2
+
3
+ export declare const TokenType: {
4
+ readonly TAG_OPEN: 'TAG_OPEN'
5
+ readonly TAG_OPEN_CLOSE: 'TAG_OPEN_CLOSE'
6
+ readonly TAG_CLOSE: 'TAG_CLOSE'
7
+ readonly TAG_SELF_CLOSE: 'TAG_SELF_CLOSE'
8
+ readonly COMMENT: 'COMMENT'
9
+ readonly ATTR_NAME: 'ATTR_NAME'
10
+ readonly ATTR_EQUALS: 'ATTR_EQUALS'
11
+ readonly ATTR_VALUE: 'ATTR_VALUE'
12
+ readonly TEXT: 'TEXT'
13
+ readonly MUSTACHE_OPEN: 'MUSTACHE_OPEN'
14
+ readonly MUSTACHE_EXPR: 'MUSTACHE_EXPR'
15
+ readonly MUSTACHE_CLOSE: 'MUSTACHE_CLOSE'
16
+ readonly EOF: 'EOF'
17
+ }
18
+
19
+ export type TokenTypeValue = typeof TokenType[keyof typeof TokenType]
20
+
21
+ export interface Token {
22
+ type: TokenTypeValue
23
+ value: string
24
+ loc: SourceLocation
25
+ }
26
+
27
+ export declare function tokenize(source: string): Token[]
@@ -0,0 +1,60 @@
1
+ import type { RootNode } from './ast.js'
2
+ import type { Token } from './lexer.js'
3
+ import type { CompileWarning } from './errors.js'
4
+ import type { CompileError } from './errors.js'
5
+
6
+ export interface CompileOptions {
7
+ components?: string[] | Set<string>
8
+ runtimePath?: string
9
+ filename?: string
10
+ throwOnWarning?: boolean
11
+ scope?: string[]
12
+ }
13
+
14
+ export interface CompileResult {
15
+ code: string
16
+ ast: RootNode
17
+ tokens: Token[]
18
+ warnings: CompileWarning[]
19
+ }
20
+
21
+ export interface ParseOnlyResult {
22
+ ast: RootNode
23
+ tokens: Token[]
24
+ }
25
+
26
+ export interface BatchEntry {
27
+ id: string
28
+ source: string
29
+ }
30
+
31
+ export interface BatchResult {
32
+ id: string
33
+ code: string | null
34
+ warnings: CompileWarning[]
35
+ error: CompileError | null
36
+ }
37
+
38
+ export declare function compile(source: string, options?: CompileOptions): CompileResult
39
+ export declare function parseOnly(source: string, options?: Pick<CompileOptions, 'components'>): ParseOnlyResult
40
+ export declare function transformOnly(ast: RootNode, options?: Pick<CompileOptions, 'components' | 'scope'> & { source?: string }): { ast: RootNode; warnings: CompileWarning[] }
41
+ export declare function compileBatch(templates: BatchEntry[], sharedOptions?: CompileOptions): BatchResult[]
42
+
43
+ export interface FuseePluginOptions {
44
+ runtimePath?: string
45
+ components?: string[]
46
+ scope?: string[]
47
+ }
48
+
49
+ export declare function fuseePlugin(options?: FuseePluginOptions): {
50
+ name: 'vite-plugin-fusee'
51
+ transform(src: string, id: string): { code: string; map: null } | null
52
+ }
53
+
54
+ export { fileRouterPlugin } from './plugins/file-router-plugin.js'
55
+ export { actionsPlugin } from './plugins/actions-plugin.js'
56
+ export { routerPlugin } from './plugins/router-plugin.js'
57
+ export { fuseeCompilerPlugin } from './plugins/compiler-plugin.js'
58
+ export { compileFileRoutes, generateRoutesModule, generateRouteTypes, validateRoutes as validateFileRoutes } from './plugins/file-router-plugin.js'
59
+ export { validateActions, generateClientStubs, generateServerRoutes, generateActionTypes } from './plugins/actions-plugin.js'
60
+ export { validateRoutes, generateRouterTypes } from './plugins/router-plugin.js'
@@ -0,0 +1,4 @@
1
+ import type { Token } from './lexer.js'
2
+ import type { RootNode } from './ast.js'
3
+
4
+ export declare function parse(tokens: Token[], source: string, components?: Set<string>): RootNode
@@ -0,0 +1,30 @@
1
+ export interface ActionsPluginOptions {
2
+ serverActionsFile?: string
3
+ clientActionsFile?: string
4
+ baseUrl?: string
5
+ typesOutput?: string
6
+ }
7
+
8
+ export interface ActionDef {
9
+ name: string
10
+ exportName: string
11
+ }
12
+
13
+ export interface ActionValidationResult {
14
+ warnings: string[]
15
+ errors: string[]
16
+ }
17
+
18
+ export declare function actionsPlugin(options?: ActionsPluginOptions): {
19
+ name: 'vite-plugin-fusee-actions'
20
+ configResolved(config: { root: string }): void
21
+ resolveId(id: string): string | undefined
22
+ load(id: string): Promise<string | null>
23
+ buildEnd(): Promise<void>
24
+ handleHotUpdate(ctx: { file: string; server: unknown }): void
25
+ }
26
+
27
+ export declare function validateActions(serverActions: ActionDef[], clientActions: string[]): ActionValidationResult
28
+ export declare function generateClientStubs(actions: ActionDef[], options?: { baseUrl?: string }): string
29
+ export declare function generateServerRoutes(actions: ActionDef[], options?: { serverActionsFile?: string; baseUrl?: string }): string
30
+ export declare function generateActionTypes(actions: ActionDef[]): string
@@ -0,0 +1,5 @@
1
+ export declare function fuseeCompilerPlugin(): {
2
+ name: 'vite-plugin-fusee-compiler'
3
+ enforce: 'pre'
4
+ transform(code: string, id: string): { code: string; map: null } | null
5
+ }
@@ -0,0 +1,32 @@
1
+ export interface FileRouterPluginOptions {
2
+ pagesDir?: string
3
+ loadingComponent?: unknown
4
+ }
5
+
6
+ export interface RouteNode {
7
+ path: string
8
+ filePath?: string
9
+ children?: RouteNode[]
10
+ }
11
+
12
+ export interface RouteValidationResult {
13
+ warnings: string[]
14
+ errors: string[]
15
+ }
16
+
17
+ export interface ImportEntry {
18
+ varName: string
19
+ filePath: string
20
+ }
21
+
22
+ export declare function fileRouterPlugin(options?: FileRouterPluginOptions): {
23
+ name: 'vite-plugin-fusee-file-router'
24
+ buildStart(): Promise<void>
25
+ resolveId(id: string): string | undefined
26
+ load(id: string): Promise<string | null>
27
+ }
28
+
29
+ export declare function compileFileRoutes(files: string[], options?: { pagesDir?: string }): RouteNode[]
30
+ export declare function generateRoutesModule(routes: RouteNode[], pagesDir?: string): string
31
+ export declare function validateRoutes(routes: RouteNode[]): RouteValidationResult
32
+ export declare function generateRouteTypes(routes: RouteNode[]): string
@@ -0,0 +1,24 @@
1
+ export interface RouterPluginOptions {
2
+ typesOutput?: string
3
+ pagesDir?: string
4
+ strict?: boolean
5
+ }
6
+
7
+ export interface RouteNode {
8
+ path: string
9
+ filePath?: string
10
+ children?: RouteNode[]
11
+ }
12
+
13
+ export interface RouteValidationResult {
14
+ warnings: string[]
15
+ errors: string[]
16
+ }
17
+
18
+ export declare function routerPlugin(options?: RouterPluginOptions): {
19
+ name: 'vite-plugin-fusee-router'
20
+ generateBundle(): Promise<void>
21
+ }
22
+
23
+ export declare function validateRoutes(routes: RouteNode[]): RouteValidationResult
24
+ export declare function generateRouterTypes(routes: RouteNode[]): string
@@ -0,0 +1,28 @@
1
+ import type { RootNode } from './ast.js'
2
+ import type { CompileWarning } from './errors.js'
3
+
4
+ export interface TransformOptions {
5
+ components?: Set<string>
6
+ source?: string
7
+ scope?: string[]
8
+ }
9
+
10
+ export interface TransformResult {
11
+ ast: RootNode
12
+ warnings: CompileWarning[]
13
+ }
14
+
15
+ /**
16
+ * Run all transformer steps on the Root AST (mutates in-place).
17
+ *
18
+ * Steps:
19
+ * 1. markStatic — bottom-up static marking
20
+ * 2. hoistStatic — collect f-once + multi-static-child subtrees
21
+ * 3. chainConditionals — f-if / f-else-if / f-else -> IfNode
22
+ * 4. validateFor — warn on f-for without :key (T002)
23
+ * 5. validateModel — warn on f-model on non-input (T003)
24
+ * 6. validateComponents — warn on unregistered component (T004)
25
+ * 7. analyseScope — resolve identifiers (needs `scope`)
26
+ * 8. validateExpressions — warn on unknown identifiers (S001) + static :key (S002)
27
+ */
28
+ export declare function transform(ast: RootNode, options?: TransformOptions): TransformResult