resuxjs 0.2.22 → 0.2.24

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -8
  3. package/dist/cli.d.ts +9 -0
  4. package/dist/cli.js +1671 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/compiler/index.js +77 -40
  7. package/dist/compiler/index.js.map +1 -1
  8. package/dist/globals.d.ts +32 -24
  9. package/dist/index.d.ts +0 -8
  10. package/dist/index.js +0 -1666
  11. package/dist/index.js.map +1 -1
  12. package/dist/node.d.ts +2 -0
  13. package/dist/node.js +2 -0
  14. package/dist/node.js.map +1 -0
  15. package/dist/reactivity/computed.d.ts +7 -0
  16. package/dist/reactivity/computed.js +53 -0
  17. package/dist/reactivity/computed.js.map +1 -0
  18. package/dist/reactivity/effect.d.ts +17 -0
  19. package/dist/reactivity/effect.js +113 -0
  20. package/dist/reactivity/effect.js.map +1 -0
  21. package/dist/reactivity/index.d.ts +8 -0
  22. package/dist/reactivity/index.js +8 -0
  23. package/dist/reactivity/index.js.map +1 -0
  24. package/dist/reactivity/reactive.d.ts +5 -0
  25. package/dist/reactivity/reactive.js +95 -0
  26. package/dist/reactivity/reactive.js.map +1 -0
  27. package/dist/reactivity/readonly.d.ts +1 -0
  28. package/dist/reactivity/readonly.js +2 -0
  29. package/dist/reactivity/readonly.js.map +1 -0
  30. package/dist/reactivity/ref.d.ts +22 -0
  31. package/dist/reactivity/ref.js +85 -0
  32. package/dist/reactivity/ref.js.map +1 -0
  33. package/dist/reactivity/scheduler.d.ts +6 -0
  34. package/dist/reactivity/scheduler.js +38 -0
  35. package/dist/reactivity/scheduler.js.map +1 -0
  36. package/dist/reactivity/types.d.ts +30 -0
  37. package/dist/reactivity/types.js +2 -0
  38. package/dist/reactivity/types.js.map +1 -0
  39. package/dist/reactivity/utils.d.ts +14 -0
  40. package/dist/reactivity/utils.js +34 -0
  41. package/dist/reactivity/utils.js.map +1 -0
  42. package/dist/reactivity/watch.d.ts +5 -0
  43. package/dist/reactivity/watch.js +98 -0
  44. package/dist/reactivity/watch.js.map +1 -0
  45. package/dist/runtime/index.d.ts +17 -3
  46. package/dist/runtime/index.js +542 -34
  47. package/dist/runtime/index.js.map +1 -1
  48. package/package.json +38 -8
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mahmoud Abdalrhman Mohamed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Resux
2
2
 
3
- Resux is an experimental web framework prototype with a custom resumable runtime.
3
+ Resux is an experimental web framework with a custom resumable runtime.
4
4
 
5
5
  It uses familiar `.vue` files and `pages/` routing, but normal Resux components do not use Vue hydration or the Vue runtime. The compiler parses a small Vue-like SFC subset, renders HTML on the server, serializes route and component state, then loads client code only when an event is triggered. Vue runtime is available as an opt-in island escape hatch for complex client widgets.
6
6
 
7
- This is an MVP, not a production-ready framework.
7
+ The v1 release line treats the documented compiler, SSR renderer, resume runtime, routing, and CLI commands as the stable core. Advanced Vue compatibility, Vue islands, Nitro adapter behavior, and unsupported Vue SFC syntax are still experimental and should fail loudly instead of silently falling back to hydration.
8
8
 
9
9
  ## Create App
10
10
 
@@ -31,7 +31,7 @@ Generated apps use a single Resux dependency, similar to Nuxt apps installing `n
31
31
  ```json
32
32
  {
33
33
  "dependencies": {
34
- "resuxjs": "^0.2.14"
34
+ "resuxjs": "^<current-version>"
35
35
  }
36
36
  }
37
37
  ```
@@ -40,6 +40,7 @@ For local development before publishing:
40
40
 
41
41
  ```sh
42
42
  npm install
43
+ npm run typecheck
43
44
  npm run build
44
45
  npm run create:local -- my-app --no-install
45
46
  ```
@@ -58,17 +59,27 @@ npm run dev
58
59
  src/
59
60
  compiler/ SFC parser, route manifest builder, code generator
60
61
  runtime/ SSR renderer, composables, client resume loader source
61
- index.ts Resux CLI, Node server, and public node handler
62
+ index.ts Runtime-only public root export
63
+ cli.ts Resux CLI, dev server, preview server, deploy helpers
64
+ node.ts Node server handler export for adapters
62
65
  create.ts App scaffolder used by `resux init`
63
66
 
64
67
  templates/ Starter files copied by `resux init`
65
68
  tests/ Compiler, SSR, and client resume tests
66
69
  ```
67
70
 
71
+ Public imports are split so browser/client bundles do not accidentally pull compiler or server code:
72
+
73
+ ```ts
74
+ import { renderApp } from "resuxjs/runtime"
75
+ import { createResuxNodeHandler } from "resuxjs/node"
76
+ ```
77
+
68
78
  ## Development
69
79
 
70
80
  ```sh
71
81
  npm install
82
+ npm run typecheck
72
83
  npm run build
73
84
  npm test
74
85
  ```
@@ -81,6 +92,21 @@ npm run pack:check
81
92
 
82
93
  This builds, tests, and dry-runs npm packing for the single `resuxjs` package.
83
94
 
95
+ CI runs on every push and pull request with `npm ci`, optional linting, typecheck, build, tests, and package dry-run checks.
96
+
97
+ ## Release Process
98
+
99
+ Normal pushes never publish to npm. They only run CI. Publishing is intentionally gated to version tags or GitHub Releases so an ordinary `main` push cannot publish a broken package.
100
+
101
+ To release:
102
+
103
+ 1. Update the version and create the release commit/tag with `npm version 1.0.0`.
104
+ 2. Push the release commit with `git push origin main`.
105
+ 3. Push the version tag with `git push origin v1.0.0`.
106
+ 4. The GitHub Action publishes `resuxjs@1.0.0` to npm.
107
+
108
+ The npm publish workflow validates that the tag matches `package.json`, runs `npm ci` and `npm run pack:check`, skips publishing if the package version already exists, then publishes with `NPM_TOKEN` and npm provenance.
109
+
84
110
  ## CLI
85
111
 
86
112
  The `resux` CLI supports:
@@ -144,6 +170,36 @@ export default defineResuxConfig({
144
170
  })
145
171
  ```
146
172
 
173
+ ## Reactivity APIs
174
+
175
+ Resux includes a native reactivity layer for resumable components. You can use it with globals in app files, or import directly:
176
+
177
+ ```ts
178
+ import {
179
+ ref,
180
+ reactive,
181
+ computed,
182
+ watch,
183
+ watchEffect,
184
+ readonly,
185
+ toRef,
186
+ toRefs,
187
+ unref,
188
+ isRef,
189
+ isReactive,
190
+ isReadonly,
191
+ nextTick
192
+ } from "resuxjs"
193
+ ```
194
+
195
+ Or from the focused subpath:
196
+
197
+ ```ts
198
+ import { ref, reactive, computed } from "resuxjs/reactivity"
199
+ ```
200
+
201
+ These APIs are Resux-native. Normal Resux components do not depend on Vue hydration runtime.
202
+
147
203
  ## Vite
148
204
 
149
205
  Resux uses Vite in both main app commands:
@@ -302,7 +358,7 @@ Server middleware can continue by returning nothing, use h3-style helpers such a
302
358
  - Resumable event handlers such as `@click="increment"`.
303
359
  - Lazy client handler chunks loaded on first interaction.
304
360
  - Client-side navigation, persistent same-layout DOM, built-in route transition progress, and hover/focus route payload prefetch for same-origin links.
305
- - MVP composables: `useState`, `useAsyncData`, `useRoute`, `useRouter`, `useHead`, `useSeoMeta`, `useRuntimeConfig`, `useResuxApp`, `apiURL`, `useFetch`, `$fetch`, and `onMounted`.
361
+ - Stable core composables: `useState`, `useAsyncData`, `useRoute`, `useRouter`, `useHead`, `useSeoMeta`, `useRuntimeConfig`, `useResuxApp`, `apiURL`, `useFetch`, `$fetch`, and `onMounted`.
306
362
  - `useAsyncData` returns a Nuxt-like resource with reactive `data`, `pending`, and `error` refs, plus `value` as a data alias for compatibility. Use `await useAsyncData(...)` when you want SSR to fetch before rendering the page; omit `await` when you intentionally want an SSR skeleton that resumes in the browser.
307
363
 
308
364
  ## Component Syntax
@@ -401,7 +457,7 @@ On the server, `$fetch("/api/test")` uses the current request origin, then confi
401
457
 
402
458
  ## Supported Syntax
403
459
 
404
- The MVP compiler supports:
460
+ The v1 compiler supports:
405
461
 
406
462
  - Static elements and text.
407
463
  - Interpolation: `{{ value }}`.
@@ -457,12 +513,13 @@ Unsupported resumability patterns should fail at compile time instead of silentl
457
513
 
458
514
  ## Architecture
459
515
 
460
- Resux is one package with four internal parts:
516
+ Resux is one package with five internal parts:
461
517
 
462
518
  - Compiler: parses `.vue` files, creates routes, validates resumable handlers, and emits server/client modules.
463
519
  - Runtime: renders HTML on the server, provides Resux-style composables, runs plugins, applies layouts, collects head entries, and serializes payloads.
464
- - CLI: builds apps, starts the dev server, and previews generated output.
520
+ - CLI and Node server: builds apps, starts the dev server, previews generated output, and exposes `resuxjs/node`.
465
521
  - Create CLI: scaffolds a starter app for `resux init`.
522
+ - Package entrypoints: keep the root runtime-only while `resuxjs/compiler`, `resuxjs/runtime`, `resuxjs/node`, `resuxjs/globals`, and `resuxjs/create` expose focused surfaces.
466
523
 
467
524
  The browser initially receives only server-rendered HTML, the serialized payload, and the small resume loader.
468
525
 
package/dist/cli.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { type IncomingMessage, type ServerResponse } from "node:http";
3
+ export * from "./runtime/index.js";
4
+ export interface ResuxNodeHandlerOptions {
5
+ appRoot?: string;
6
+ outDir?: string;
7
+ securityHeaders?: boolean;
8
+ }
9
+ export declare function createResuxNodeHandler(options?: ResuxNodeHandlerOptions): (request: IncomingMessage, response: ServerResponse) => void;