mithril-lynx 0.0.9 → 2.0.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/.omo/plans/m-request-fetch-lynx.md +306 -0
  2. package/.omo/plans/m-route-en-memoria.md +397 -0
  3. package/.omo/plans/mithril-lynx-v2-desde-cero.md +548 -0
  4. package/FETCH_INVESTIGATION.md +307 -0
  5. package/README.md +32 -302
  6. package/REQUEST.md +71 -0
  7. package/ROUTE.md +71 -0
  8. package/package.json +24 -80
  9. package/plugin.d.ts +2 -31
  10. package/plugin.js +107 -436
  11. package/rstest.config.ts +27 -0
  12. package/src/apply-patch.js +179 -0
  13. package/src/backends/virtual-backend.js +80 -0
  14. package/src/background.d.ts +11 -0
  15. package/src/background.js +79 -0
  16. package/src/channel.js +41 -0
  17. package/src/commit.js +67 -0
  18. package/src/dev-reload-client.js +168 -184
  19. package/src/dev-transport-noop.js +10 -0
  20. package/src/fake-dom.js +374 -0
  21. package/src/main-thread.d.ts +1 -0
  22. package/src/main-thread.js +68 -0
  23. package/src/mount-redraw.js +67 -0
  24. package/src/patch-protocol.js +40 -0
  25. package/src/reload/version.js +28 -0
  26. package/src/request.d.ts +37 -0
  27. package/src/request.js +181 -0
  28. package/src/route.d.ts +33 -0
  29. package/src/route.js +207 -0
  30. package/test/end-to-end.test.ts +86 -0
  31. package/test/reload-version.test.ts +17 -0
  32. package/test/request.test.ts +182 -0
  33. package/test/route-hot-reload.test.ts +40 -0
  34. package/test/route.test.ts +152 -0
  35. package/test/setup.ts +25 -0
  36. package/test/structural-reload.test.ts +95 -0
  37. package/CONTRACT.md +0 -151
  38. package/LICENSE +0 -21
  39. package/background.d.ts +0 -54
  40. package/background.js +0 -169
  41. package/element.d.ts +0 -34
  42. package/element.js +0 -83
  43. package/gesture.d.ts +0 -40
  44. package/gesture.js +0 -117
  45. package/internal/constants.js +0 -26
  46. package/internal/virtual-node.js +0 -388
  47. package/list.d.ts +0 -31
  48. package/list.js +0 -185
  49. package/main-thread.d.ts +0 -43
  50. package/main-thread.js +0 -165
  51. package/navigation.d.ts +0 -35
  52. package/navigation.js +0 -76
  53. package/renderer/background.d.ts +0 -21
  54. package/renderer/background.js +0 -84
  55. package/renderer/main-thread.d.ts +0 -12
  56. package/renderer/main-thread.js +0 -175
  57. package/src/lynx-mithril-shim.d.ts +0 -16
  58. package/src/lynx-mithril-shim.js +0 -1505
  59. package/src/worklet-runtime.js +0 -82
  60. package/testing.d.ts +0 -10
  61. package/testing.js +0 -91
package/package.json CHANGED
@@ -1,107 +1,51 @@
1
1
  {
2
2
  "name": "mithril-lynx",
3
- "version": "0.0.9",
4
- "description": "Mithril.js rendered through Lynx's Element PAPI \u2014 a contract-complete port of mithril/render/render.js@2.3.8 to the Lynx main thread, packaged as a reusable framework.",
3
+ "version": "2.0.1",
4
+ "description": "Mithril.js on Lynx: real mithril/render/render.js driven through a Lynx-backed fake DOM, with an explicit single commit hook (no conditional global flush) and three reload modes (data-light, structural-light, full). A complete rewrite of the previous mithril-lynx (0.0.x).",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/carlos-sweb/mithril-lynx.git"
10
- },
11
- "homepage": "https://github.com/carlos-sweb/mithril-lynx#readme",
12
- "bugs": {
13
- "url": "https://github.com/carlos-sweb/mithril-lynx/issues"
14
- },
15
7
  "exports": {
16
- ".": {
17
- "types": "./src/lynx-mithril-shim.d.ts",
18
- "default": "./src/lynx-mithril-shim.js"
8
+ "./background": {
9
+ "types": "./src/background.d.ts",
10
+ "default": "./src/background.js"
11
+ },
12
+ "./main-thread": {
13
+ "types": "./src/main-thread.d.ts",
14
+ "default": "./src/main-thread.js"
19
15
  },
20
16
  "./plugin": {
21
17
  "types": "./plugin.d.ts",
22
18
  "default": "./plugin.js"
23
19
  },
24
- "./main-thread": {
25
- "types": "./main-thread.d.ts",
26
- "default": "./main-thread.js"
27
- },
28
- "./background": {
29
- "types": "./background.d.ts",
30
- "default": "./background.js"
31
- },
32
- "./renderer/main-thread": {
33
- "types": "./renderer/main-thread.d.ts",
34
- "default": "./renderer/main-thread.js"
35
- },
36
- "./renderer/background": {
37
- "types": "./renderer/background.d.ts",
38
- "default": "./renderer/background.js"
39
- },
40
- "./element": {
41
- "types": "./element.d.ts",
42
- "default": "./element.js"
43
- },
44
- "./gesture": {
45
- "types": "./gesture.d.ts",
46
- "default": "./gesture.js"
47
- },
48
- "./list": {
49
- "types": "./list.d.ts",
50
- "default": "./list.js"
20
+ "./route": {
21
+ "types": "./src/route.d.ts",
22
+ "default": "./src/route.js"
51
23
  },
52
- "./navigation": {
53
- "types": "./navigation.d.ts",
54
- "default": "./navigation.js"
55
- },
56
- "./testing": {
57
- "types": "./testing.d.ts",
58
- "default": "./testing.js"
24
+ "./request": {
25
+ "types": "./src/request.d.ts",
26
+ "default": "./src/request.js"
59
27
  }
60
28
  },
61
- "files": [
62
- "src",
63
- "internal",
64
- "renderer",
65
- "plugin.js",
66
- "plugin.d.ts",
67
- "main-thread.js",
68
- "main-thread.d.ts",
69
- "background.js",
70
- "background.d.ts",
71
- "element.js",
72
- "element.d.ts",
73
- "gesture.js",
74
- "gesture.d.ts",
75
- "list.js",
76
- "list.d.ts",
77
- "navigation.js",
78
- "navigation.d.ts",
79
- "testing.js",
80
- "testing.d.ts",
81
- "CONTRACT.md"
82
- ],
83
- "engines": {
84
- "node": "^20.19.0 || >=22.12.0"
85
- },
86
29
  "scripts": {
87
30
  "test": "rstest run"
88
31
  },
32
+ "peerDependencies": {
33
+ "@lynx-js/rspeedy": "^0.17.0",
34
+ "@lynx-js/types": "4.1.0",
35
+ "mithril-runtime": "^1.1.0"
36
+ },
89
37
  "dependencies": {
90
- "@lynx-js/devtool-connector": "^0.13.2",
91
38
  "@lynx-js/runtime-wrapper-webpack-plugin": "^0.2.4",
92
39
  "@lynx-js/template-webpack-plugin": "^0.16.0"
93
40
  },
94
- "peerDependencies": {
95
- "mithril": "2.3.8",
96
- "@lynx-js/type-element-api": "0.0.9",
97
- "@lynx-js/types": "4.1.0",
98
- "@lynx-js/rspeedy": "^0.17.0"
99
- },
100
41
  "devDependencies": {
101
- "mithril": "2.3.8",
102
42
  "@lynx-js/testing-environment": "npm:@lynx-js/testing-environment-canary@0.3.2-canary-20260803-5a891c73",
103
43
  "@rstest/core": "^0.11.3",
104
44
  "jsdom": "^28.0.0",
45
+ "mithril-runtime": "^1.1.0",
105
46
  "typescript": "~6.0.3"
47
+ },
48
+ "engines": {
49
+ "node": "^20.19.0 || >=22.12.0"
106
50
  }
107
51
  }
package/plugin.d.ts CHANGED
@@ -1,37 +1,8 @@
1
- // Ambient declaration for the ESM plugin.js (the file itself is not
2
- // type-checked; this describes its runtime export shape for lynx.config.ts).
3
-
4
1
  import type { RsbuildPlugin } from "@lynx-js/rspeedy";
5
2
 
6
3
  export interface PluginMithrilLynxOptions {
7
- /** Lynx engine target SDK version. Defaults to "3.5". */
8
- targetSdkVersion?: string;
9
- /**
10
- * Opt back into module-level HMR. Defaults to false, which the plugin forces
11
- * because rspack's hot runtime can only patch modules on the background
12
- * thread, while Mithril view code always runs on the main thread — so HMR
13
- * adds hot-update error noise without ever being able to update anything.
14
- */
15
- hmr?: boolean;
16
- /**
17
- * Reload the running page after each successful dev rebuild. Defaults to
18
- * true. `true` uses the in-bundle client (`src/dev-reload-client.js`):
19
- * a WebSocket client injected into a synthetic background chunk that sends
20
- * CDP `Page.reload` via `NativeModules.LynxDevToolSetModule.invokeCdp`
21
- * (cache-busted URL) — works over Wi-Fi alone, no adb, no back-stack
22
- * corruption. `"devtool"` uses the 0.0.8 strategy: the Node dev-server
23
- * process sends CDP `Page.reload` through
24
- * `@lynx-js/devtool-connector`, which reaches the device over adb — the
25
- * fallback for viewers/SDKs without the in-bundle DevTool CDP bridge.
26
- * `false` disables live reload.
27
- */
28
- liveReload?: boolean | "devtool";
4
+ targetSdkVersion?: string;
5
+ liveReload?: boolean;
29
6
  }
30
7
 
31
- /**
32
- * Dual-bundle build plugin: for each configured entry, compiles the entry
33
- * file as the main-thread/Lepus bundle, and — if a sibling `background.ts`
34
- * or `background.js` file exists next to it — compiles that as the
35
- * background/JS-thread bundle. Pure multi-entry bundling, no code transform.
36
- */
37
8
  export function pluginMithrilLynx(options?: PluginMithrilLynxOptions): RsbuildPlugin;