fusee-framework 2.7.0 → 2.7.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 +98 -26
- 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/framework/auto-import-preset.js +20 -12
- package/framework/auto-imports.d.ts +68 -39
- package/framework/core/compiler.js +310 -310
- package/framework/core/component-core.js +445 -0
- package/framework/core/component.js +11 -440
- package/framework/core/composable.js +29 -29
- package/framework/core/h.js +119 -44
- package/framework/core/jsx-helpers.js +11 -2
- package/framework/core/jsx-runtime.js +73 -73
- package/framework/core/rust-compiler/pkg/fusee_compiler_bg.wasm +0 -0
- package/framework/core/store.js +333 -333
- package/framework/globals.js +42 -0
- package/framework/index.js +22 -55
- package/framework/router/file-router.js +184 -184
- package/framework/server/actions.js +183 -183
- package/framework/server/generate-manifest.js +3 -3
- package/framework/types/component.d.ts +97 -86
- package/framework/types/index.d.ts +118 -117
- package/package.json +83 -80
- package/framework/core/rust-compiler/Cargo.toml +0 -31
- package/framework/core/rust-compiler/README.md +0 -69
- package/framework/core/rust-compiler/pkg/README.md +0 -69
- package/framework/core/rust-compiler/pkg/fusee_compiler.d.ts +0 -6
- package/framework/core/rust-compiler/pkg/fusee_compiler.js +0 -9
- package/framework/core/rust-compiler/pkg/fusee_compiler_bg.js +0 -137
- package/framework/core/rust-compiler/pkg/fusee_compiler_bg.wasm.d.ts +0 -11
- package/framework/core/rust-compiler/pkg/package.json +0 -18
- package/framework/core/rust-compiler/src/ast.rs +0 -274
- package/framework/core/rust-compiler/src/errors.rs +0 -204
- package/framework/core/rust-compiler/src/generator.rs +0 -583
- package/framework/core/rust-compiler/src/lexer.rs +0 -414
- package/framework/core/rust-compiler/src/lib.rs +0 -87
- package/framework/core/rust-compiler/src/main_compiler.rs +0 -165
- package/framework/core/rust-compiler/src/parser.rs +0 -516
- package/framework/core/rust-compiler/src/ssr_generator.rs +0 -688
- package/framework/core/rust-compiler/src/transformer.rs +0 -562
- package/framework/core/rust-compiler/src/utils.rs +0 -10
- package/framework/engine-go/actions.go +0 -112
- package/framework/engine-go/cmd/server/main.go +0 -233
- package/framework/engine-go/comet/comet.go +0 -41
- package/framework/engine-go/comet/fragment.go +0 -51
- package/framework/engine-go/dispatcher.go +0 -120
- package/framework/engine-go/elements.go +0 -248
- package/framework/engine-go/evalexpr/evalexpr.go +0 -733
- package/framework/engine-go/go.mod +0 -3
- package/framework/engine-go/hydration.go +0 -43
- package/framework/engine-go/load-helpers.go +0 -29
- package/framework/engine-go/manifest.go +0 -41
- package/framework/engine-go/reactive.go +0 -123
- package/framework/engine-go/render.go +0 -635
- package/framework/engine-go/reqcontext.go +0 -48
- package/framework/engine-go/router.go +0 -85
- package/framework/engine-go/rustast/rustast.go +0 -317
- package/framework/engine-go/ssr.go +0 -103
- package/framework/engine-go/static-assets.go +0 -139
- package/framework/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<h1 align="center">Fusée Framework</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<strong>v2.7.
|
|
8
|
+
<strong>v2.7.1 — Signals-First JS Framework | Atomic Reactivity | Rust Compiler | Go Toolchain</strong>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<br />
|
|
@@ -14,7 +14,7 @@ Fusée is a custom, high-performance fine-grained reactive JavaScript framework
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
## What's New in 2.7.
|
|
17
|
+
## What's New in 2.7.2
|
|
18
18
|
|
|
19
19
|
- Added **Web Components**: `defineElement()` turns a fusée component into a native custom
|
|
20
20
|
element with reactive props synced to attributes, shadow DOM, scoped `css` styles, native
|
|
@@ -25,18 +25,27 @@ Fusée is a custom, high-performance fine-grained reactive JavaScript framework
|
|
|
25
25
|
(`renderElementsSSR()`) and in the Go SSR engine (elements are read from `app/elements`
|
|
26
26
|
by `npm run manifest`).
|
|
27
27
|
- Added `fusee generate element <tag-name>`.
|
|
28
|
+
- **Smaller bundles:** importing `fusee-framework` no longer copies the API onto `globalThis`,
|
|
29
|
+
so bundlers drop the modules an app doesn't use (a counter app went from 23.6 KB to
|
|
30
|
+
11.0 KB gzip). The auto-import preset now covers every export.
|
|
31
|
+
**Breaking:** code that calls the API with neither imports nor auto-imports (e.g. a plain
|
|
32
|
+
`<script>`) must add `import 'fusee-framework/globals'`.
|
|
28
33
|
- Fixed: delegated events (`@click`) inside shadow roots; the first `:binding` on a tag being
|
|
29
34
|
ignored in string templates; content right after an `f-if` element being dropped by the
|
|
30
35
|
compiler; manifest pages in the Go dev server not receiving their `Load` data;
|
|
31
36
|
`fusee-framework` and `fusee-framework/server` failing to import in plain Node.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- Added `
|
|
39
|
-
|
|
37
|
+
- Fixed compiled templates (`.fusee` files and JSX `render()`): nested elements were flattened
|
|
38
|
+
into the component's container; `f-for` lists and `f-if` branches that were already non-empty
|
|
39
|
+
or true at mount rendered nothing; swapping two keyed rows had no effect; loops without
|
|
40
|
+
`:key` rendered only their last item.
|
|
41
|
+
- `f-for` items now use the same syntax on the client, in SSR and in the Go engine:
|
|
42
|
+
`{{ row.id }}`. Compiled client templates used to need `{{ row().id }}`, which still works.
|
|
43
|
+
- Added `defineCompiledComponent()` for components with a compiled `render`: it leaves the
|
|
44
|
+
runtime template compiler out of the bundle (a counter component: 11.9 KB → 6.4 KB gzip).
|
|
45
|
+
JSX components use it automatically.
|
|
46
|
+
- Fixed the JSX runtime: it failed to load (wrong import path), and text and `{expression}`
|
|
47
|
+
children were not rendered.
|
|
48
|
+
- Fixed dependency tracking in f-for for h.js
|
|
40
49
|
|
|
41
50
|
## Quick Start
|
|
42
51
|
|
|
@@ -486,7 +495,9 @@ import type {
|
|
|
486
495
|
} from "./framework/types";
|
|
487
496
|
```
|
|
488
497
|
|
|
489
|
-
|
|
498
|
+
Every fusée export is auto-imported in Vite builds (`framework/auto-import-preset.js`, typed in `framework/auto-imports.d.ts`). Your own services, components, stores, actions, utilities, and types should be imported explicitly.
|
|
499
|
+
|
|
500
|
+
Outside Vite (a plain `<script type="module">`, a quick demo), either import what you use or load `import 'fusee-framework/globals'`, which puts the whole API on `globalThis`. Avoid it in bundled apps: it keeps the entire framework in the bundle.
|
|
490
501
|
|
|
491
502
|
---
|
|
492
503
|
|
|
@@ -498,21 +509,82 @@ It can be installed from the CLI after installing the SSR engine (default: not i
|
|
|
498
509
|
|
|
499
510
|
## Performance Benchmarks
|
|
500
511
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
|
512
|
-
|
|
|
513
|
-
|
|
|
514
|
-
|
|
|
515
|
-
|
|
|
512
|
+
The benchmark runs the operations from
|
|
513
|
+
[js-framework-benchmark](https://github.com/krausest/js-framework-benchmark) on a keyed table in
|
|
514
|
+
headless Chromium. Each sample is read from a Chrome trace: it is the busy main-thread time from
|
|
515
|
+
the start of the operation until the frame that shows the result is committed (script, style,
|
|
516
|
+
layout and paint), with time spent idle waiting for the next frame left out. Every sample starts
|
|
517
|
+
from a freshly loaded page with 3 warmup runs, and the DOM is checked after each operation.
|
|
518
|
+
Some tests slow the CPU down, as js-framework-benchmark does.
|
|
519
|
+
|
|
520
|
+
Fusée (current `main`), median of 15 runs, AMD Ryzen 5 3500U laptop (lower is better):
|
|
521
|
+
|
|
522
|
+
| Operation | CPU slowdown | Median | ± 95% CI | Script |
|
|
523
|
+
| :--------------------- | :----------: | :------: | :--------: | :------: |
|
|
524
|
+
| Create 1,000 rows | 1x | 51.6 ms | ± 4.4 ms | 14.5 ms |
|
|
525
|
+
| Replace 1,000 rows | 1x | 51.0 ms | ± 4.2 ms | 20.1 ms |
|
|
526
|
+
| Update every 10th row | 4x | 56.9 ms | ± 4.6 ms | 5.0 ms |
|
|
527
|
+
| Select row | 4x | 9.0 ms | ± 0.8 ms | 2.5 ms |
|
|
528
|
+
| Swap 2 rows | 4x | 39.3 ms | ± 2.4 ms | 3.2 ms |
|
|
529
|
+
| Remove row | 2x | 25.7 ms | ± 3.6 ms | 2.6 ms |
|
|
530
|
+
| Create 10,000 rows | 1x | 500.4 ms | ± 208.0 ms | 159.4 ms |
|
|
531
|
+
| Append 1,000 rows | 1x | 47.1 ms | ± 4.1 ms | 13.4 ms |
|
|
532
|
+
| Clear 1,000 rows | 4x | 39.1 ms | ± 8.2 ms | 36.9 ms |
|
|
533
|
+
|
|
534
|
+
"Script" is the part of the median spent in JavaScript, including garbage collection; the rest
|
|
535
|
+
is the browser's style, layout and paint work.
|
|
536
|
+
|
|
537
|
+
### Memory
|
|
538
|
+
|
|
539
|
+
JS heap after a forced garbage collection:
|
|
540
|
+
|
|
541
|
+
| Version | Fresh page | 1,000 rows | After 5× create + clear |
|
|
542
|
+
| :------------- | :--------: | :--------: | :---------------------: |
|
|
543
|
+
| Current `main` | 1.10 MB | 4.38 MB | **1.36 MB** |
|
|
544
|
+
| 2.7.2 | 1.10 MB | 4.41 MB | 10.81 MB |
|
|
545
|
+
|
|
546
|
+
Up to 2.7.1, `f-for` kept every row it had ever rendered reachable, so each create + clear
|
|
547
|
+
cycle left about 1.9 MB behind. Removed rows are now freed.
|
|
548
|
+
|
|
549
|
+
A ranking against React, Vue, Angular, Svelte, Solid, Preact, Qwik, Lit and Mithril with this
|
|
550
|
+
method is being re-measured. The previous ranking measured each operation plus two animation
|
|
551
|
+
frames, so frame timing (about 33 ms) hid most of the differences between frameworks.
|
|
552
|
+
|
|
553
|
+
### Bundle size
|
|
554
|
+
|
|
555
|
+
Production JavaScript of the same benchmark app (a keyed 1,000-row table), built with Vite
|
|
556
|
+
and compressed with gzip level 9 and brotli quality 11:
|
|
557
|
+
|
|
558
|
+
| Rank | Framework | gzip | brotli |
|
|
559
|
+
| :----: | :--------------------- | :----------: | :----------: |
|
|
560
|
+
| **1** | **Solid** | 3.9 KB | 3.5 KB |
|
|
561
|
+
| **2** | **Preact** | 5.9 KB | 5.4 KB |
|
|
562
|
+
| **3** | **Lit** | 6.3 KB | 5.7 KB |
|
|
563
|
+
| **4** | <mark>**Fusée**</mark> | **6.3 KB** | **5.7 KB** |
|
|
564
|
+
| **5** | **Svelte** | 12.8 KB | 11.7 KB |
|
|
565
|
+
| **6** | **Mithril** | 13.8 KB | 12.1 KB |
|
|
566
|
+
| **7** | **Vue** | 24.5 KB | 22.1 KB |
|
|
567
|
+
| **8** | **Qwik** | 27.3 KB | 24.4 KB |
|
|
568
|
+
| **9** | **Angular** | 34.6 KB | 31.0 KB |
|
|
569
|
+
| **10** | **React** | 44.9 KB | 39.3 KB |
|
|
570
|
+
|
|
571
|
+
Lit and Fusée are within a few bytes of each other: Lit is 12 bytes smaller with gzip, Fusée
|
|
572
|
+
9 bytes smaller with brotli.
|
|
573
|
+
|
|
574
|
+
Fusée is tree-shakable: an app only ships the parts it uses. The main cost to watch is the
|
|
575
|
+
runtime template compiler, which string templates (`template: '...'`) need. Minimal counter
|
|
576
|
+
component, gzip:
|
|
577
|
+
|
|
578
|
+
| Component style | gzip |
|
|
579
|
+
| :------------------------------------------------------ | :-----: |
|
|
580
|
+
| Compiled template + `defineCompiledComponent()` | 6.4 KB |
|
|
581
|
+
| JSX (`render()`, via the fusée JSX runtime) | 6.5 KB |
|
|
582
|
+
| String template + `defineComponent()` | 11.1 KB |
|
|
583
|
+
| String template custom element, `defineElement()` | 13.3 KB |
|
|
584
|
+
|
|
585
|
+
`defineCompiledComponent()` works like `defineComponent()` for components with a compiled
|
|
586
|
+
`render` (a `.fusee` file, or `.template.html` through the compiler plugin), and leaves the
|
|
587
|
+
template compiler out. JSX components get the same saving automatically.
|
|
516
588
|
|
|
517
589
|
---
|
|
518
590
|
|
package/bin/create-fusee-linux
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/create-fusee-win.exe
CHANGED
|
Binary file
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
export const FuseePreset = {
|
|
2
|
-
'fusee-framework': [
|
|
3
|
-
'signal', 'computed', 'effect', 'watch',
|
|
4
|
-
'batch', 'untrack', 'inspect', 'onCleanup', 'resource', 'defineResource',
|
|
5
|
-
'createSuspense', 'scheduleAsyncJob',
|
|
6
|
-
'defineComponent', 'defineAsyncComponent', 'onMount', 'onUnmount', 'parseSlots',
|
|
7
|
-
'defineElement', 'toCustomElement', 'css', 'unsafeCSS',
|
|
8
|
-
'directive', 'reconcile', 'mountTemplate', 'emit',
|
|
9
|
-
'provide', 'inject', 'provideGlobal', 'InjectionToken',
|
|
10
|
-
'defineComposable', 'assertSetupContext'
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export const FuseePreset = {
|
|
2
|
+
'fusee-framework': [
|
|
3
|
+
'signal', 'computed', 'effect', 'watch',
|
|
4
|
+
'batch', 'untrack', 'inspect', 'onCleanup', 'resource', 'defineResource',
|
|
5
|
+
'createSuspense', 'scheduleAsyncJob',
|
|
6
|
+
'defineComponent', 'defineCompiledComponent', 'defineAsyncComponent', 'onMount', 'onUnmount', 'parseSlots',
|
|
7
|
+
'defineElement', 'toCustomElement', 'css', 'unsafeCSS',
|
|
8
|
+
'directive', 'reconcile', 'mountTemplate', 'emit',
|
|
9
|
+
'provide', 'inject', 'provideGlobal', 'InjectionToken', 'getCurrentInstance',
|
|
10
|
+
'defineComposable', 'assertSetupContext',
|
|
11
|
+
'createRouter', 'navigate', 'mountOutlet', 'currentRoute', 'routeParams', 'routeQuery',
|
|
12
|
+
'matchedRoutes', 'generateRoutes',
|
|
13
|
+
'defineStore', 'resetStore', 'clearStores', 'registerStorePlugin', 'storeToRefs',
|
|
14
|
+
'storeToState', 'storeToGetters', 'useNestedStore', 'MutationType',
|
|
15
|
+
'defineAction', 'createActionProxy', 'useAction',
|
|
16
|
+
'createApp',
|
|
17
|
+
'defineCompilerPlugin', 'defineServerPlugin', 'defineDevToolsPlugin', 'defineRuntimeAdapter',
|
|
18
|
+
'defineFuseePlugin'
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -1,39 +1,68 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
// noinspection JSUnusedGlobalSymbols
|
|
5
|
-
// Generated by unplugin-auto-import
|
|
6
|
-
// biome-ignore lint: disable
|
|
7
|
-
export {}
|
|
8
|
-
declare global {
|
|
9
|
-
const InjectionToken: typeof import('fusee-framework').InjectionToken
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
// noinspection JSUnusedGlobalSymbols
|
|
5
|
+
// Generated by unplugin-auto-import
|
|
6
|
+
// biome-ignore lint: disable
|
|
7
|
+
export {}
|
|
8
|
+
declare global {
|
|
9
|
+
const InjectionToken: typeof import('fusee-framework').InjectionToken
|
|
10
|
+
const MutationType: typeof import('fusee-framework').MutationType
|
|
11
|
+
const assertSetupContext: typeof import('fusee-framework').assertSetupContext
|
|
12
|
+
const batch: typeof import('fusee-framework').batch
|
|
13
|
+
const clearStores: typeof import('fusee-framework').clearStores
|
|
14
|
+
const computed: typeof import('fusee-framework').computed
|
|
15
|
+
const createActionProxy: typeof import('fusee-framework').createActionProxy
|
|
16
|
+
const createApp: typeof import('fusee-framework').createApp
|
|
17
|
+
const createRouter: typeof import('fusee-framework').createRouter
|
|
18
|
+
const createSuspense: typeof import('fusee-framework').createSuspense
|
|
19
|
+
const css: typeof import('fusee-framework').css
|
|
20
|
+
const currentRoute: typeof import('fusee-framework').currentRoute
|
|
21
|
+
const defineAction: typeof import('fusee-framework').defineAction
|
|
22
|
+
const defineAsyncComponent: typeof import('fusee-framework').defineAsyncComponent
|
|
23
|
+
const defineCompiledComponent: typeof import('fusee-framework').defineCompiledComponent
|
|
24
|
+
const defineCompilerPlugin: typeof import('fusee-framework').defineCompilerPlugin
|
|
25
|
+
const defineComponent: typeof import('fusee-framework').defineComponent
|
|
26
|
+
const defineComposable: typeof import('fusee-framework').defineComposable
|
|
27
|
+
const defineDevToolsPlugin: typeof import('fusee-framework').defineDevToolsPlugin
|
|
28
|
+
const defineElement: typeof import('fusee-framework').defineElement
|
|
29
|
+
const defineFuseePlugin: typeof import('fusee-framework').defineFuseePlugin
|
|
30
|
+
const defineResource: typeof import('fusee-framework').defineResource
|
|
31
|
+
const defineRuntimeAdapter: typeof import('fusee-framework').defineRuntimeAdapter
|
|
32
|
+
const defineServerPlugin: typeof import('fusee-framework').defineServerPlugin
|
|
33
|
+
const defineStore: typeof import('fusee-framework').defineStore
|
|
34
|
+
const directive: typeof import('fusee-framework').directive
|
|
35
|
+
const effect: typeof import('fusee-framework').effect
|
|
36
|
+
const emit: typeof import('fusee-framework').emit
|
|
37
|
+
const generateRoutes: typeof import('fusee-framework').generateRoutes
|
|
38
|
+
const getCurrentInstance: typeof import('fusee-framework').getCurrentInstance
|
|
39
|
+
const inject: typeof import('fusee-framework').inject
|
|
40
|
+
const inspect: typeof import('fusee-framework').inspect
|
|
41
|
+
const matchedRoutes: typeof import('fusee-framework').matchedRoutes
|
|
42
|
+
const mountOutlet: typeof import('fusee-framework').mountOutlet
|
|
43
|
+
const mountTemplate: typeof import('fusee-framework').mountTemplate
|
|
44
|
+
const navigate: typeof import('fusee-framework').navigate
|
|
45
|
+
const onCleanup: typeof import('fusee-framework').onCleanup
|
|
46
|
+
const onMount: typeof import('fusee-framework').onMount
|
|
47
|
+
const onUnmount: typeof import('fusee-framework').onUnmount
|
|
48
|
+
const parseSlots: typeof import('fusee-framework').parseSlots
|
|
49
|
+
const provide: typeof import('fusee-framework').provide
|
|
50
|
+
const provideGlobal: typeof import('fusee-framework').provideGlobal
|
|
51
|
+
const reconcile: typeof import('fusee-framework').reconcile
|
|
52
|
+
const registerStorePlugin: typeof import('fusee-framework').registerStorePlugin
|
|
53
|
+
const resetStore: typeof import('fusee-framework').resetStore
|
|
54
|
+
const resource: typeof import('fusee-framework').resource
|
|
55
|
+
const routeParams: typeof import('fusee-framework').routeParams
|
|
56
|
+
const routeQuery: typeof import('fusee-framework').routeQuery
|
|
57
|
+
const scheduleAsyncJob: typeof import('fusee-framework').scheduleAsyncJob
|
|
58
|
+
const signal: typeof import('fusee-framework').signal
|
|
59
|
+
const storeToGetters: typeof import('fusee-framework').storeToGetters
|
|
60
|
+
const storeToRefs: typeof import('fusee-framework').storeToRefs
|
|
61
|
+
const storeToState: typeof import('fusee-framework').storeToState
|
|
62
|
+
const toCustomElement: typeof import('fusee-framework').toCustomElement
|
|
63
|
+
const unsafeCSS: typeof import('fusee-framework').unsafeCSS
|
|
64
|
+
const untrack: typeof import('fusee-framework').untrack
|
|
65
|
+
const useAction: typeof import('fusee-framework').useAction
|
|
66
|
+
const useNestedStore: typeof import('fusee-framework').useNestedStore
|
|
67
|
+
const watch: typeof import('fusee-framework').watch
|
|
68
|
+
}
|