fusee-framework 1.6.0 → 1.8.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.
- package/README.md +145 -123
- package/app/benchmark/benchmark.js +633 -0
- package/app/benchmark/index.html +102 -0
- package/app/benchmark/styles.css +249 -0
- package/app/components/Counter.js +17 -7
- package/app/components/CounterSection.js +3 -4
- package/app/main.js +50 -62
- package/app/main.ts +78 -63
- package/app/pages/404.js +16 -0
- package/app/pages/[...all].js +35 -0
- package/app/pages/[...all].ts +35 -0
- package/app/pages/_layout.js +53 -0
- package/app/pages/_layout.ts +26 -0
- package/app/pages/about.js +23 -0
- package/app/pages/about.ts +29 -0
- package/app/pages/async-work.js +65 -0
- package/app/pages/composables.js +158 -0
- package/app/pages/composables.ts +158 -0
- package/app/pages/dynamic.js +40 -0
- package/app/pages/dynamic.ts +40 -0
- package/app/pages/index.js +137 -0
- package/app/pages/index.ts +87 -0
- package/app/pages/login.ts +21 -0
- package/app/pages/objects/[id].js +56 -0
- package/app/pages/objects/[id].ts +56 -0
- package/app/pages/posts/[category]/[slug].js +56 -0
- package/app/pages/posts/[category]/[slug].ts +56 -0
- package/app/pages/router-example.js +79 -0
- package/app/pages/router-example.ts +56 -0
- package/app/pages/scroll-demo.ts +102 -0
- package/app/pages/test-for.js +65 -0
- package/app/pages/test-for.ts +80 -0
- package/app/pages/users/[id].js +24 -0
- package/app/pages/users/[id].ts +46 -0
- package/app/pages/users/index.js +22 -0
- package/app/pages/users/index.ts +29 -0
- package/app/pages/users.js +43 -0
- package/app/pages/users.ts +78 -0
- package/app/providers/ChildComponent.js +8 -2
- package/app/providers/ChildComponent.ts +47 -47
- package/app/providers/GrandchildComponent.js +19 -0
- package/app/providers/ParentComponent.js +5 -1
- package/app/routes/About.js +1 -1
- package/app/routes/About.ts +1 -1
- package/app/routes/AuthRoutes.ts +41 -0
- package/app/routes/Home.js +9 -0
- package/app/routes/NotFound.js +16 -0
- package/app/routes/NotFound.ts +16 -0
- package/app/routes/RouterExample.js +78 -0
- package/app/routes/RouterExample.ts +56 -0
- package/app/routes/TestResource.js +47 -0
- package/app/routes/WildcardDemo.js +35 -0
- package/app/routes/WildcardDemo.ts +35 -0
- package/app/services.js +15 -0
- package/auto-imports.d.ts +9 -0
- package/bin/create-fusee-linux +0 -0
- package/bin/create-fusee-mac-arm64 +0 -0
- package/bin/create-fusee-mac-intel +0 -0
- package/bin/create-fusee-win.exe +0 -0
- package/bin/create-fusee.exe +0 -0
- package/bin/index.js +38 -0
- package/create-fusee-go/cmd/generate.go +72 -0
- package/create-fusee-go/cmd/init.go +38 -0
- package/create-fusee-go/cmd/root.go +121 -0
- package/create-fusee-go/go.mod +10 -0
- package/create-fusee-go/go.sum +10 -0
- package/create-fusee-go/internal/assets/assets.go +78 -0
- package/create-fusee-go/internal/assets/embed/framework/auto-import-preset.js +9 -0
- package/create-fusee-go/internal/assets/embed/framework/core/compiler.js +253 -0
- package/create-fusee-go/internal/assets/embed/framework/core/component.js +266 -0
- package/create-fusee-go/internal/assets/embed/framework/core/composable.js +27 -0
- package/create-fusee-go/internal/assets/embed/framework/core/directives.js +875 -0
- package/create-fusee-go/internal/assets/embed/framework/core/evaluator.js +153 -0
- package/create-fusee-go/internal/assets/embed/framework/core/event-delegation.js +191 -0
- package/create-fusee-go/internal/assets/embed/framework/core/signal.js +412 -0
- package/create-fusee-go/internal/assets/embed/framework/core/store.js +81 -0
- package/create-fusee-go/internal/assets/embed/framework/index.d.ts +3 -0
- package/create-fusee-go/internal/assets/embed/framework/index.js +10 -0
- package/create-fusee-go/internal/assets/embed/framework/router/file-router.js +177 -0
- package/create-fusee-go/internal/assets/embed/framework/router/router.js +462 -0
- package/create-fusee-go/internal/assets/embed/framework/types/compiler.d.ts +15 -0
- package/create-fusee-go/internal/assets/embed/framework/types/component.d.ts +88 -0
- package/create-fusee-go/internal/assets/embed/framework/types/composable.d.ts +14 -0
- package/create-fusee-go/internal/assets/embed/framework/types/directives.d.ts +55 -0
- package/create-fusee-go/internal/assets/embed/framework/types/evaluator.d.ts +13 -0
- package/create-fusee-go/internal/assets/embed/framework/types/event-delegation.d.ts +32 -0
- package/create-fusee-go/internal/assets/embed/framework/types/index.d.ts +22 -0
- package/create-fusee-go/internal/assets/embed/framework/types/router.d.ts +32 -0
- package/create-fusee-go/internal/assets/embed/framework/types/signal.d.ts +79 -0
- package/create-fusee-go/internal/assets/embed/framework/types/store.d.ts +8 -0
- package/create-fusee-go/internal/assets/templates/Counter.tmpl +26 -0
- package/create-fusee-go/internal/assets/templates/component.tmpl +11 -0
- package/create-fusee-go/internal/assets/templates/components/Loading.tmpl +24 -0
- package/create-fusee-go/internal/assets/templates/index.html.tmpl +15 -0
- package/create-fusee-go/internal/assets/templates/main.tmpl +14 -0
- package/create-fusee-go/internal/assets/templates/package.json.tmpl +14 -0
- package/create-fusee-go/internal/assets/templates/page.tmpl +12 -0
- package/create-fusee-go/internal/assets/templates/pages/about.tmpl +20 -0
- package/create-fusee-go/internal/assets/templates/pages/index.tmpl +22 -0
- package/create-fusee-go/internal/assets/templates/pages/layout.tmpl +18 -0
- package/create-fusee-go/internal/assets/templates/tsconfig.json.tmpl +14 -0
- package/create-fusee-go/internal/assets/templates/vite.config.js.tmpl +18 -0
- package/create-fusee-go/main.go +7 -0
- package/framework/auto-import-preset.js +13 -9
- package/framework/core/compiler.js +252 -249
- package/framework/core/component.js +279 -260
- package/framework/core/di.js +187 -0
- package/framework/core/directives.js +819 -786
- package/framework/core/evaluator.js +153 -70
- package/framework/core/event-delegation.js +33 -14
- package/framework/core/reconcile.js +151 -0
- package/framework/core/signal.js +679 -403
- package/framework/core/store.js +322 -81
- package/framework/index.js +12 -11
- package/framework/router/file-router.js +177 -0
- package/framework/router/router.js +554 -80
- package/framework/types/component.d.ts +89 -88
- package/framework/types/di.d.ts +43 -0
- package/framework/types/event-delegation.d.ts +0 -58
- package/framework/types/index.d.ts +32 -22
- package/framework/types/reconcile.d.ts +7 -0
- package/framework/types/router.d.ts +42 -15
- package/framework/types/signal.d.ts +147 -78
- package/framework/types/store.d.ts +66 -8
- package/index.html +638 -626
- package/package.json +5 -3
- package/tsconfig.json +1 -0
- package/vite.config.js +7 -1
- /package/{framework → create-fusee-go/internal/assets/embed/framework}/bin/create-fusee.js +0 -0
package/README.md
CHANGED
|
@@ -1,123 +1,145 @@
|
|
|
1
|
-
# Fusée Framework
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
1
|
+
# Fusée Framework
|
|
2
|
+
|
|
3
|
+
**v1.8.0 — Signals-First JS Framework | Atomic Reactivity | Peak Performance**
|
|
4
|
+
|
|
5
|
+
Fusée is a custom, high-performance fine-grained reactive JavaScript framework built for speed and simplicity. It features a recursive, non-greedy compiler, a signals-based reactivity engine, Dependency Injection for components and a comprehensive CLI for instant application scaffolding.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
The fastest way to get started with Fusée is via the **Go-Powered CLI**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# 1. Install Fusée CLI globally
|
|
15
|
+
npm install -g fusee-framework
|
|
16
|
+
|
|
17
|
+
# 2. Scaffold a new high-performance project
|
|
18
|
+
create-fusee-app my-awesome-app
|
|
19
|
+
# or simply
|
|
20
|
+
fusee init my-awesome-app
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Follow the interactive prompt to choose your template (**JavaScript** or **TypeScript**) and launch your app instantly!
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## File-Based Routing (Nuxt-style)
|
|
28
|
+
|
|
29
|
+
Fusée now supports automated, file-based routing!
|
|
30
|
+
|
|
31
|
+
- **Pages**: Just drop a file in `app/pages/` and it becomes a route.
|
|
32
|
+
- **Layouts**: Use `app/pages/_layout.js` to wrap your pages in consistent UI structures.
|
|
33
|
+
- **Dynamic Routes**: Support for `[id].js` style dynamic parameters.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Generate a new page instantly
|
|
37
|
+
fusee generate page contact
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Key Features
|
|
43
|
+
|
|
44
|
+
- **New Go-Powered CLI**: Blazing fast project scaffolding and resource generation.
|
|
45
|
+
- **Signals/Resources-First Reactivity**: Modern atomic updates that ensure only the modified parts of the DOM are touched.
|
|
46
|
+
- **Nuxt-style File Routing**: Automated route discovery with layout support.
|
|
47
|
+
- **Recursive Hybrid Compiler**: A robust architectural approach to node traversal.
|
|
48
|
+
- **Optimized Directives**: Native support for `f-if`, `f-for`, `f-model`, `f-text`, `f-cloak` and more.
|
|
49
|
+
- **Performance Shield (`f-once`)**: Isolate and stabilize static subtrees.
|
|
50
|
+
- **Vite Integration**: Full support for the fastest development workflow and HMR.
|
|
51
|
+
- **Dependency Injection**: Nested Provide/Inject and Shadowing.
|
|
52
|
+
- **Memory Safety**: Explicit checks for memory leaks and automatic effect disposal.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Project Structure
|
|
57
|
+
|
|
58
|
+
A typical Fusée project looks like this:
|
|
59
|
+
|
|
60
|
+
- **`framework/`**: The core reactive engine.
|
|
61
|
+
- **`app/`**: Your application logic (routes, components).
|
|
62
|
+
- **`index.html`**: The entry point of your reactive world.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Example Component
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
export const Welcome = defineComponent({
|
|
70
|
+
setup() {
|
|
71
|
+
const name = signal("World");
|
|
72
|
+
const count = signal(0);
|
|
73
|
+
const double = computed(() => count() * 2);
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
name,
|
|
77
|
+
count,
|
|
78
|
+
double,
|
|
79
|
+
inc: () => count(count() + 1),
|
|
80
|
+
template: `
|
|
81
|
+
<div class="card">
|
|
82
|
+
<h2>Hello, {{ name }}!</h2>
|
|
83
|
+
<input f-model="name" placeholder="Name" />
|
|
84
|
+
|
|
85
|
+
<button @click.debounce.300ms="inc">
|
|
86
|
+
Clicked {{ count }} times
|
|
87
|
+
</button>
|
|
88
|
+
|
|
89
|
+
<p f-if="count() > 0">
|
|
90
|
+
Double: <strong>{{ double }}</strong>
|
|
91
|
+
</p>
|
|
92
|
+
</div>
|
|
93
|
+
`,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Quality Assurance & Testing
|
|
102
|
+
|
|
103
|
+
Fusée is built with a test-driven mindset to ensure the reliability of its reactivity engine and component lifecycle.
|
|
104
|
+
|
|
105
|
+
- **Total Tests:** `527`
|
|
106
|
+
- **Status:** `All Passed`
|
|
107
|
+
- **Framework:** [Vitest](https://vitest.dev/)
|
|
108
|
+
- **Environment:** JSDOM (Browser simulation)
|
|
109
|
+
|
|
110
|
+
### Running Tests
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Run all tests (easiest)
|
|
114
|
+
npm test
|
|
115
|
+
|
|
116
|
+
# Run all tests with verbose output
|
|
117
|
+
npx vitest --reporter=verbose
|
|
118
|
+
|
|
119
|
+
# Run type tests only
|
|
120
|
+
npx vitest run --typecheck
|
|
121
|
+
|
|
122
|
+
# Run tests in watch mode
|
|
123
|
+
npx vitest
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Test Coverage includes:
|
|
127
|
+
|
|
128
|
+
- **Reactivity Engine:** 100% (Signals, Batching, Computed, Watchers).
|
|
129
|
+
- **Component System:** Props, Slots, Async Components, and Lifecycle Hooks.
|
|
130
|
+
- **Dependency Injection:** Nested Provide/Inject and Shadowing.
|
|
131
|
+
- **Directives:** `f-if`, `f-for`, `f-model`, and Event Modifiers.
|
|
132
|
+
- **Events:** Event delegation and native event handling.
|
|
133
|
+
- **Memory Safety:** Explicit checks for memory leaks and automatic effect disposal.
|
|
134
|
+
- **Type Safety:** Comprehensive TypeScript definitions and type tests.
|
|
135
|
+
- **Integration Tests:** Advanced module combinations and edge cases.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Future Roadmap
|
|
140
|
+
|
|
141
|
+
- [ ] Advanced state management and SSR support
|
|
142
|
+
- [ ] Lightweight compiler which transforms declarative HTML into optimized runtime instructions
|
|
143
|
+
- [ ] Integrated backend development support
|
|
144
|
+
|
|
145
|
+
Built by me, Sebi Somu, a forward-thinking JavaScript Architect.
|