fusee-framework 2.7.0 → 2.7.1

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 (61) hide show
  1. package/README.md +56 -2
  2. package/bin/create-fusee-linux +0 -0
  3. package/bin/create-fusee-mac-arm64 +0 -0
  4. package/bin/create-fusee-mac-intel +0 -0
  5. package/bin/create-fusee-win.exe +0 -0
  6. package/framework/auto-import-preset.js +20 -12
  7. package/framework/auto-imports.d.ts +68 -39
  8. package/framework/core/compiler.js +310 -310
  9. package/framework/core/component-core.js +445 -0
  10. package/framework/core/component.js +11 -440
  11. package/framework/core/composable.js +29 -29
  12. package/framework/core/h.js +588 -557
  13. package/framework/core/jsx-helpers.js +11 -2
  14. package/framework/core/jsx-runtime.js +73 -73
  15. package/framework/core/rust-compiler/pkg/fusee_compiler_bg.wasm +0 -0
  16. package/framework/core/store.js +333 -333
  17. package/framework/globals.js +42 -0
  18. package/framework/index.js +22 -55
  19. package/framework/router/file-router.js +184 -184
  20. package/framework/server/actions.js +183 -183
  21. package/framework/server/generate-manifest.js +3 -3
  22. package/framework/types/component.d.ts +97 -86
  23. package/framework/types/index.d.ts +118 -117
  24. package/package.json +83 -80
  25. package/framework/core/rust-compiler/Cargo.toml +0 -31
  26. package/framework/core/rust-compiler/README.md +0 -69
  27. package/framework/core/rust-compiler/pkg/README.md +0 -69
  28. package/framework/core/rust-compiler/pkg/fusee_compiler.d.ts +0 -6
  29. package/framework/core/rust-compiler/pkg/fusee_compiler.js +0 -9
  30. package/framework/core/rust-compiler/pkg/fusee_compiler_bg.js +0 -137
  31. package/framework/core/rust-compiler/pkg/fusee_compiler_bg.wasm.d.ts +0 -11
  32. package/framework/core/rust-compiler/pkg/package.json +0 -18
  33. package/framework/core/rust-compiler/src/ast.rs +0 -274
  34. package/framework/core/rust-compiler/src/errors.rs +0 -204
  35. package/framework/core/rust-compiler/src/generator.rs +0 -583
  36. package/framework/core/rust-compiler/src/lexer.rs +0 -414
  37. package/framework/core/rust-compiler/src/lib.rs +0 -87
  38. package/framework/core/rust-compiler/src/main_compiler.rs +0 -165
  39. package/framework/core/rust-compiler/src/parser.rs +0 -516
  40. package/framework/core/rust-compiler/src/ssr_generator.rs +0 -688
  41. package/framework/core/rust-compiler/src/transformer.rs +0 -562
  42. package/framework/core/rust-compiler/src/utils.rs +0 -10
  43. package/framework/engine-go/actions.go +0 -112
  44. package/framework/engine-go/cmd/server/main.go +0 -233
  45. package/framework/engine-go/comet/comet.go +0 -41
  46. package/framework/engine-go/comet/fragment.go +0 -51
  47. package/framework/engine-go/dispatcher.go +0 -120
  48. package/framework/engine-go/elements.go +0 -248
  49. package/framework/engine-go/evalexpr/evalexpr.go +0 -733
  50. package/framework/engine-go/go.mod +0 -3
  51. package/framework/engine-go/hydration.go +0 -43
  52. package/framework/engine-go/load-helpers.go +0 -29
  53. package/framework/engine-go/manifest.go +0 -41
  54. package/framework/engine-go/reactive.go +0 -123
  55. package/framework/engine-go/render.go +0 -635
  56. package/framework/engine-go/reqcontext.go +0 -48
  57. package/framework/engine-go/router.go +0 -85
  58. package/framework/engine-go/rustast/rustast.go +0 -317
  59. package/framework/engine-go/ssr.go +0 -103
  60. package/framework/engine-go/static-assets.go +0 -139
  61. package/framework/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
@@ -1,4 +1,4 @@
1
- import { hFor, hIf } from './h.js'
1
+ import { hFor, hIf, hText } from './h.js'
2
2
 
3
3
  /**
4
4
  * Flattens JSX children into a single array of fnodes, dropping
@@ -6,7 +6,8 @@ import { hFor, hIf } from './h.js'
6
6
  * behave the way JSX authors expect. Recursively flattens nested arrays,
7
7
  * which is all Fragment needs: it returns its children as-is, and whatever
8
8
  * consumes those children (h()'s children arg, or another flattenChildren
9
- * call) inlines them automatically.
9
+ * call) inlines them automatically. Text and numbers become text nodes, and
10
+ * getters (dynamic `{expr}` wrapped by the Babel plugin) become reactive ones.
10
11
  */
11
12
  export function flattenChildren(children) {
12
13
  const out = []
@@ -19,6 +20,14 @@ export function flattenChildren(children) {
19
20
  stack.unshift(...child)
20
21
  continue
21
22
  }
23
+ if (typeof child === 'string' || typeof child === 'number' || typeof child === 'bigint') {
24
+ out.push(hText(String(child)))
25
+ continue
26
+ }
27
+ if (typeof child === 'function') {
28
+ out.push(hText(child))
29
+ continue
30
+ }
22
31
  out.push(child)
23
32
  }
24
33
 
@@ -1,74 +1,74 @@
1
- // Point your bundler at this module and JSX compiles here with zero custom
2
- // parser/Babel plugin needed yet:
3
- // - esbuild/Vite: jsx: 'automatic', jsxImportSource: '<path-to-this-folder>'
4
- // - tsconfig.json: "jsx": "react-jsx", "jsxImportSource": "<path-to-this-folder>"
5
-
6
- import { h, createComponent } from './h.js'
7
- import {
8
- Fragment,
9
- For,
10
- Show,
11
- Slot,
12
- on,
13
- flattenChildren,
14
- normalizeEventProps,
15
- normalizeComponentListenerProps,
16
- splitSlotChildren
17
- } from './jsx-helpers.js'
18
- import { defineComponent as coreDefineComponent } from '../component.js' // adjust to your project layout
19
-
20
- export { Fragment, For, Show, Slot, on }
21
-
22
- /**
23
- * Wraps defineComponent so JSX can tell "a fusée component" apart from a
24
- * plain helper function (Fragment/For/Show/Slot, or your own stateless JSX
25
- * helpers). Import defineComponent from here instead of component.js in
26
- * any file that defines components with JSX.
27
- */
28
- export function defineComponent(options) {
29
- const factory = coreDefineComponent(options)
30
- factory._isFuseeComponent = true
31
- factory._componentName = options?.name
32
- return factory
33
- }
34
-
35
- /** Dispatches a JSX element to h() (DOM tags), createComponent() (fusée components), or a direct call (helpers). */
36
- function createNode(type, rawProps) {
37
- const { children, ...rest } = rawProps || {}
38
-
39
- if (type === Fragment) {
40
- return Fragment({ children })
41
- }
42
-
43
- if (typeof type === 'string') {
44
- return h(type, normalizeEventProps(rest), flattenChildren(children))
45
- }
46
-
47
- if (typeof type === 'function' && type._isFuseeComponent) {
48
- const name = type._componentName || type.name || 'AnonymousComponent'
49
- const props = normalizeComponentListenerProps(rest)
50
- return createComponent(name, type, props, splitSlotChildren(children))
51
- }
52
-
53
- if (typeof type === 'function') {
54
- return type({ ...rest, children })
55
- }
56
-
57
- console.warn('[fusée] Unsupported JSX element type:', type)
58
- return null
59
- }
60
-
61
- /** Automatic JSX runtime entry point for a single (or statically known) child. */
62
- export function jsx(type, props, _key) {
63
- return createNode(type, props)
64
- }
65
-
66
- /** Automatic JSX runtime entry point when children are a static array. */
67
- export function jsxs(type, props, _key) {
68
- return createNode(type, props)
69
- }
70
-
71
- /** Dev-mode entry point; fusée doesn't use the extra source/self-closing args (yet). */
72
- export function jsxDEV(type, props, _key, _isStaticChildren, _source, _self) {
73
- return createNode(type, props)
1
+ // Point your bundler at this module and JSX compiles here with zero custom
2
+ // parser/Babel plugin needed yet:
3
+ // - esbuild/Vite: jsx: 'automatic', jsxImportSource: '<path-to-this-folder>'
4
+ // - tsconfig.json: "jsx": "react-jsx", "jsxImportSource": "<path-to-this-folder>"
5
+
6
+ import { h, createComponent } from './h.js'
7
+ import {
8
+ Fragment,
9
+ For,
10
+ Show,
11
+ Slot,
12
+ on,
13
+ flattenChildren,
14
+ normalizeEventProps,
15
+ normalizeComponentListenerProps,
16
+ splitSlotChildren
17
+ } from './jsx-helpers.js'
18
+ import { defineCompiledComponent as coreDefineComponent } from './component-core.js'
19
+
20
+ export { Fragment, For, Show, Slot, on }
21
+
22
+ /**
23
+ * Wraps defineComponent so JSX can tell "a fusée component" apart from a
24
+ * plain helper function (Fragment/For/Show/Slot, or your own stateless JSX
25
+ * helpers). Import defineComponent from here instead of component.js in
26
+ * any file that defines components with JSX.
27
+ */
28
+ export function defineComponent(options) {
29
+ const factory = coreDefineComponent(options)
30
+ factory._isFuseeComponent = true
31
+ factory._componentName = options?.name
32
+ return factory
33
+ }
34
+
35
+ /** Dispatches a JSX element to h() (DOM tags), createComponent() (fusée components), or a direct call (helpers). */
36
+ function createNode(type, rawProps) {
37
+ const { children, ...rest } = rawProps || {}
38
+
39
+ if (type === Fragment) {
40
+ return Fragment({ children })
41
+ }
42
+
43
+ if (typeof type === 'string') {
44
+ return h(type, normalizeEventProps(rest), flattenChildren(children))
45
+ }
46
+
47
+ if (typeof type === 'function' && type._isFuseeComponent) {
48
+ const name = type._componentName || type.name || 'AnonymousComponent'
49
+ const props = normalizeComponentListenerProps(rest)
50
+ return createComponent(name, type, props, splitSlotChildren(children))
51
+ }
52
+
53
+ if (typeof type === 'function') {
54
+ return type({ ...rest, children })
55
+ }
56
+
57
+ console.warn('[fusée] Unsupported JSX element type:', type)
58
+ return null
59
+ }
60
+
61
+ /** Automatic JSX runtime entry point for a single (or statically known) child. */
62
+ export function jsx(type, props, _key) {
63
+ return createNode(type, props)
64
+ }
65
+
66
+ /** Automatic JSX runtime entry point when children are a static array. */
67
+ export function jsxs(type, props, _key) {
68
+ return createNode(type, props)
69
+ }
70
+
71
+ /** Dev-mode entry point; fusée doesn't use the extra source/self-closing args (yet). */
72
+ export function jsxDEV(type, props, _key, _isStaticChildren, _source, _self) {
73
+ return createNode(type, props)
74
74
  }