ripple 0.3.12 → 0.3.14

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 (217) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/package.json +11 -30
  3. package/src/compiler/types/import.d.ts +0 -12
  4. package/src/helpers.d.ts +2 -0
  5. package/src/runtime/array.js +38 -38
  6. package/src/runtime/create-subscriber.js +2 -2
  7. package/src/runtime/index-client.js +15 -13
  8. package/src/runtime/index-server.js +18 -11
  9. package/src/runtime/internal/client/bindings.js +4 -6
  10. package/src/runtime/internal/client/blocks.js +19 -23
  11. package/src/runtime/internal/client/constants.js +20 -9
  12. package/src/runtime/internal/client/events.js +8 -3
  13. package/src/runtime/internal/client/hmr.js +5 -17
  14. package/src/runtime/internal/client/index.js +14 -4
  15. package/src/runtime/internal/client/runtime.js +436 -173
  16. package/src/runtime/internal/client/try.js +334 -156
  17. package/src/runtime/internal/client/types.d.ts +26 -0
  18. package/src/runtime/internal/server/blocks.js +181 -0
  19. package/src/runtime/internal/server/constants.js +7 -0
  20. package/src/runtime/internal/server/index.js +774 -150
  21. package/src/runtime/internal/server/types.d.ts +35 -0
  22. package/src/runtime/media-query.js +34 -33
  23. package/src/runtime/object.js +7 -10
  24. package/src/runtime/proxy.js +2 -3
  25. package/src/runtime/reactive-value.js +23 -21
  26. package/src/server/index.js +1 -1
  27. package/src/utils/ast.js +1 -1
  28. package/src/utils/async.js +35 -0
  29. package/src/utils/attributes.js +43 -0
  30. package/src/utils/builders.js +5 -3
  31. package/tests/client/__snapshots__/computed-properties.test.rsrx.snap +49 -0
  32. package/tests/client/__snapshots__/for.test.rsrx.snap +319 -0
  33. package/tests/client/__snapshots__/html.test.rsrx.snap +40 -0
  34. package/tests/client/_etc.test.rsrx +7 -0
  35. package/tests/client/array/{array.static.test.ripple → array.static.test.rsrx} +18 -20
  36. package/tests/client/async-suspend.test.rsrx +662 -0
  37. package/tests/client/basic/__snapshots__/basic.attributes.test.rsrx.snap +60 -0
  38. package/tests/client/basic/__snapshots__/basic.rendering.test.rsrx.snap +59 -0
  39. package/tests/client/basic/{basic.errors.test.ripple → basic.errors.test.rsrx} +3 -3
  40. package/tests/client/basic/{basic.styling.test.ripple → basic.styling.test.rsrx} +1 -1
  41. package/tests/client/compiler/__snapshots__/compiler.assignments.test.rsrx.snap +12 -0
  42. package/tests/client/compiler/__snapshots__/compiler.typescript.test.rsrx.snap +46 -0
  43. package/tests/client/compiler/{compiler.assignments.test.ripple → compiler.assignments.test.rsrx} +1 -1
  44. package/tests/client/compiler/{compiler.attributes.test.ripple → compiler.attributes.test.rsrx} +1 -1
  45. package/tests/client/compiler/{compiler.basic.test.ripple → compiler.basic.test.rsrx} +13 -13
  46. package/tests/client/compiler/{compiler.tracked-access.test.ripple → compiler.tracked-access.test.rsrx} +1 -1
  47. package/tests/client/compiler/{compiler.try-in-function.test.ripple → compiler.try-in-function.test.rsrx} +9 -7
  48. package/tests/client/compiler/{compiler.typescript.test.ripple → compiler.typescript.test.rsrx} +1 -1
  49. package/tests/client/composite/__snapshots__/composite.render.test.rsrx.snap +37 -0
  50. package/tests/client/css/{global-additional-cases.test.ripple → global-additional-cases.test.rsrx} +1 -1
  51. package/tests/client/css/{global-advanced-selectors.test.ripple → global-advanced-selectors.test.rsrx} +1 -1
  52. package/tests/client/css/{global-at-rules.test.ripple → global-at-rules.test.rsrx} +1 -1
  53. package/tests/client/css/{global-basic.test.ripple → global-basic.test.rsrx} +1 -1
  54. package/tests/client/css/{global-classes-ids.test.ripple → global-classes-ids.test.rsrx} +1 -1
  55. package/tests/client/css/{global-combinators.test.ripple → global-combinators.test.rsrx} +1 -1
  56. package/tests/client/css/{global-complex-nesting.test.ripple → global-complex-nesting.test.rsrx} +1 -1
  57. package/tests/client/css/{global-edge-cases.test.ripple → global-edge-cases.test.rsrx} +1 -1
  58. package/tests/client/css/{global-keyframes.test.ripple → global-keyframes.test.rsrx} +1 -1
  59. package/tests/client/css/{global-nested.test.ripple → global-nested.test.rsrx} +1 -1
  60. package/tests/client/css/{global-pseudo.test.ripple → global-pseudo.test.rsrx} +1 -1
  61. package/tests/client/css/{global-scoping.test.ripple → global-scoping.test.rsrx} +1 -1
  62. package/tests/client/css/{style-identifier.test.ripple → style-identifier.test.rsrx} +1 -1
  63. package/tests/client/{function-overload.test.ripple → function-overload.test.rsrx} +1 -1
  64. package/tests/client/{return.test.ripple → return.test.rsrx} +1 -1
  65. package/tests/client/try.test.rsrx +1702 -0
  66. package/tests/hydration/build-components.js +6 -4
  67. package/tests/hydration/compiled/client/head.js +11 -11
  68. package/tests/hydration/compiled/client/mixed-control-flow.js +55 -70
  69. package/tests/hydration/compiled/client/nested-control-flow.js +72 -88
  70. package/tests/hydration/compiled/client/try.js +42 -54
  71. package/tests/hydration/compiled/server/basic.js +491 -369
  72. package/tests/hydration/compiled/server/composite.js +153 -128
  73. package/tests/hydration/compiled/server/events.js +166 -145
  74. package/tests/hydration/compiled/server/for.js +821 -677
  75. package/tests/hydration/compiled/server/head.js +200 -165
  76. package/tests/hydration/compiled/server/hmr.js +62 -54
  77. package/tests/hydration/compiled/server/html-in-template.js +64 -55
  78. package/tests/hydration/compiled/server/html.js +1477 -1360
  79. package/tests/hydration/compiled/server/if-children.js +448 -408
  80. package/tests/hydration/compiled/server/if.js +204 -171
  81. package/tests/hydration/compiled/server/mixed-control-flow.js +237 -195
  82. package/tests/hydration/compiled/server/nested-control-flow.js +533 -467
  83. package/tests/hydration/compiled/server/portal.js +94 -107
  84. package/tests/hydration/compiled/server/reactivity.js +87 -64
  85. package/tests/hydration/compiled/server/return.js +1424 -1174
  86. package/tests/hydration/compiled/server/switch.js +268 -238
  87. package/tests/hydration/compiled/server/try.js +98 -87
  88. package/tests/hydration/components/{mixed-control-flow.ripple → mixed-control-flow.rsrx} +2 -2
  89. package/tests/hydration/components/{try.ripple → try.rsrx} +4 -2
  90. package/tests/hydration/mixed-control-flow.test.js +14 -0
  91. package/tests/hydration/nested-control-flow.test.js +50 -48
  92. package/tests/hydration/try.test.js +25 -0
  93. package/tests/server/__snapshots__/compiler.test.ripple.snap +0 -32
  94. package/tests/server/__snapshots__/compiler.test.rsrx.snap +95 -0
  95. package/tests/server/{compiler.test.ripple → compiler.test.rsrx} +0 -17
  96. package/tests/server/{html-nesting-validation.test.ripple → html-nesting-validation.test.rsrx} +3 -3
  97. package/tests/server/streaming-ssr.test.rsrx +115 -0
  98. package/tests/server/{style-identifier.test.ripple → style-identifier.test.rsrx} +1 -1
  99. package/tests/server/try.test.rsrx +503 -0
  100. package/tests/setup-server.js +1 -1
  101. package/tests/utils/compiler-compat-config.test.js +4 -4
  102. package/tests/utils/vite-plugin-config.test.js +1 -1
  103. package/tests/utils/vite-plugin-hmr.test.js +5 -5
  104. package/tsconfig.json +2 -0
  105. package/types/index.d.ts +13 -23
  106. package/types/server.d.ts +43 -16
  107. package/src/compiler/comment-utils.js +0 -91
  108. package/src/compiler/errors.js +0 -77
  109. package/src/compiler/identifier-utils.js +0 -80
  110. package/src/compiler/index.d.ts +0 -127
  111. package/src/compiler/index.js +0 -89
  112. package/src/compiler/phases/1-parse/index.js +0 -2964
  113. package/src/compiler/phases/1-parse/style.js +0 -704
  114. package/src/compiler/phases/2-analyze/css-analyze.js +0 -160
  115. package/src/compiler/phases/2-analyze/index.js +0 -2238
  116. package/src/compiler/phases/2-analyze/prune.js +0 -1131
  117. package/src/compiler/phases/2-analyze/validation.js +0 -168
  118. package/src/compiler/phases/3-transform/client/index.js +0 -5301
  119. package/src/compiler/phases/3-transform/segments.js +0 -2129
  120. package/src/compiler/phases/3-transform/server/index.js +0 -1899
  121. package/src/compiler/phases/3-transform/stylesheet.js +0 -545
  122. package/src/compiler/scope.js +0 -476
  123. package/src/compiler/source-map-utils.js +0 -358
  124. package/src/compiler/types/acorn.d.ts +0 -11
  125. package/src/compiler/types/estree-jsx.d.ts +0 -11
  126. package/src/compiler/types/estree.d.ts +0 -11
  127. package/src/compiler/types/index.d.ts +0 -1404
  128. package/src/compiler/types/parse.d.ts +0 -1721
  129. package/src/compiler/utils.js +0 -1263
  130. package/tests/client/_etc.test.ripple +0 -5
  131. package/tests/client/async-suspend.test.ripple +0 -94
  132. package/tests/client/try.test.ripple +0 -196
  133. package/tests/server/streaming-ssr.test.ripple +0 -68
  134. package/tests/server/try.test.ripple +0 -82
  135. /package/tests/client/array/{array.copy-within.test.ripple → array.copy-within.test.rsrx} +0 -0
  136. /package/tests/client/array/{array.derived.test.ripple → array.derived.test.rsrx} +0 -0
  137. /package/tests/client/array/{array.iteration.test.ripple → array.iteration.test.rsrx} +0 -0
  138. /package/tests/client/array/{array.mutations.test.ripple → array.mutations.test.rsrx} +0 -0
  139. /package/tests/client/array/{array.to-methods.test.ripple → array.to-methods.test.rsrx} +0 -0
  140. /package/tests/client/basic/{basic.attributes.test.ripple → basic.attributes.test.rsrx} +0 -0
  141. /package/tests/client/basic/{basic.collections.test.ripple → basic.collections.test.rsrx} +0 -0
  142. /package/tests/client/basic/{basic.components.test.ripple → basic.components.test.rsrx} +0 -0
  143. /package/tests/client/basic/{basic.events.test.ripple → basic.events.test.rsrx} +0 -0
  144. /package/tests/client/basic/{basic.get-set.test.ripple → basic.get-set.test.rsrx} +0 -0
  145. /package/tests/client/basic/{basic.hmr.test.ripple → basic.hmr.test.rsrx} +0 -0
  146. /package/tests/client/basic/{basic.reactivity.test.ripple → basic.reactivity.test.rsrx} +0 -0
  147. /package/tests/client/basic/{basic.rendering.test.ripple → basic.rendering.test.rsrx} +0 -0
  148. /package/tests/client/basic/{basic.utilities.test.ripple → basic.utilities.test.rsrx} +0 -0
  149. /package/tests/client/{boundaries.test.ripple → boundaries.test.rsrx} +0 -0
  150. /package/tests/client/compiler/{compiler.regex.test.ripple → compiler.regex.test.rsrx} +0 -0
  151. /package/tests/client/composite/{composite.dynamic-components.test.ripple → composite.dynamic-components.test.rsrx} +0 -0
  152. /package/tests/client/composite/{composite.generics.test.ripple → composite.generics.test.rsrx} +0 -0
  153. /package/tests/client/composite/{composite.props.test.ripple → composite.props.test.rsrx} +0 -0
  154. /package/tests/client/composite/{composite.reactivity.test.ripple → composite.reactivity.test.rsrx} +0 -0
  155. /package/tests/client/composite/{composite.render.test.ripple → composite.render.test.rsrx} +0 -0
  156. /package/tests/client/{computed-properties.test.ripple → computed-properties.test.rsrx} +0 -0
  157. /package/tests/client/{context.test.ripple → context.test.rsrx} +0 -0
  158. /package/tests/client/{date.test.ripple → date.test.rsrx} +0 -0
  159. /package/tests/client/{dynamic-elements.test.ripple → dynamic-elements.test.rsrx} +0 -0
  160. /package/tests/client/{events.test.ripple → events.test.rsrx} +0 -0
  161. /package/tests/client/{for.test.ripple → for.test.rsrx} +0 -0
  162. /package/tests/client/{function-overload-import.ripple → function-overload-import.rsrx} +0 -0
  163. /package/tests/client/{head.test.ripple → head.test.rsrx} +0 -0
  164. /package/tests/client/{html.test.ripple → html.test.rsrx} +0 -0
  165. /package/tests/client/{input-value.test.ripple → input-value.test.rsrx} +0 -0
  166. /package/tests/client/{lazy-destructuring.test.ripple → lazy-destructuring.test.rsrx} +0 -0
  167. /package/tests/client/{map.test.ripple → map.test.rsrx} +0 -0
  168. /package/tests/client/{media-query.test.ripple → media-query.test.rsrx} +0 -0
  169. /package/tests/client/{object.test.ripple → object.test.rsrx} +0 -0
  170. /package/tests/client/{portal.test.ripple → portal.test.rsrx} +0 -0
  171. /package/tests/client/{ref.test.ripple → ref.test.rsrx} +0 -0
  172. /package/tests/client/{set.test.ripple → set.test.rsrx} +0 -0
  173. /package/tests/client/{svg.test.ripple → svg.test.rsrx} +0 -0
  174. /package/tests/client/{switch.test.ripple → switch.test.rsrx} +0 -0
  175. /package/tests/client/{tsx.test.ripple → tsx.test.rsrx} +0 -0
  176. /package/tests/client/{typescript-generics.test.ripple → typescript-generics.test.rsrx} +0 -0
  177. /package/tests/client/url/{url.derived.test.ripple → url.derived.test.rsrx} +0 -0
  178. /package/tests/client/url/{url.parsing.test.ripple → url.parsing.test.rsrx} +0 -0
  179. /package/tests/client/url/{url.partial-removal.test.ripple → url.partial-removal.test.rsrx} +0 -0
  180. /package/tests/client/url/{url.reactivity.test.ripple → url.reactivity.test.rsrx} +0 -0
  181. /package/tests/client/url/{url.serialization.test.ripple → url.serialization.test.rsrx} +0 -0
  182. /package/tests/client/url-search-params/{url-search-params.derived.test.ripple → url-search-params.derived.test.rsrx} +0 -0
  183. /package/tests/client/url-search-params/{url-search-params.initialization.test.ripple → url-search-params.initialization.test.rsrx} +0 -0
  184. /package/tests/client/url-search-params/{url-search-params.iteration.test.ripple → url-search-params.iteration.test.rsrx} +0 -0
  185. /package/tests/client/url-search-params/{url-search-params.mutation.test.ripple → url-search-params.mutation.test.rsrx} +0 -0
  186. /package/tests/client/url-search-params/{url-search-params.retrieval.test.ripple → url-search-params.retrieval.test.rsrx} +0 -0
  187. /package/tests/client/url-search-params/{url-search-params.serialization.test.ripple → url-search-params.serialization.test.rsrx} +0 -0
  188. /package/tests/client/url-search-params/{url-search-params.tracked-url.test.ripple → url-search-params.tracked-url.test.rsrx} +0 -0
  189. /package/tests/hydration/components/{basic.ripple → basic.rsrx} +0 -0
  190. /package/tests/hydration/components/{composite.ripple → composite.rsrx} +0 -0
  191. /package/tests/hydration/components/{events.ripple → events.rsrx} +0 -0
  192. /package/tests/hydration/components/{for.ripple → for.rsrx} +0 -0
  193. /package/tests/hydration/components/{head.ripple → head.rsrx} +0 -0
  194. /package/tests/hydration/components/{hmr.ripple → hmr.rsrx} +0 -0
  195. /package/tests/hydration/components/{html-in-template.ripple → html-in-template.rsrx} +0 -0
  196. /package/tests/hydration/components/{html.ripple → html.rsrx} +0 -0
  197. /package/tests/hydration/components/{if-children.ripple → if-children.rsrx} +0 -0
  198. /package/tests/hydration/components/{if.ripple → if.rsrx} +0 -0
  199. /package/tests/hydration/components/{nested-control-flow.ripple → nested-control-flow.rsrx} +0 -0
  200. /package/tests/hydration/components/{portal.ripple → portal.rsrx} +0 -0
  201. /package/tests/hydration/components/{reactivity.ripple → reactivity.rsrx} +0 -0
  202. /package/tests/hydration/components/{return.ripple → return.rsrx} +0 -0
  203. /package/tests/hydration/components/{switch.ripple → switch.rsrx} +0 -0
  204. /package/tests/server/{await.test.ripple → await.test.rsrx} +0 -0
  205. /package/tests/server/{basic.attributes.test.ripple → basic.attributes.test.rsrx} +0 -0
  206. /package/tests/server/{basic.components.test.ripple → basic.components.test.rsrx} +0 -0
  207. /package/tests/server/{basic.test.ripple → basic.test.rsrx} +0 -0
  208. /package/tests/server/{composite.props.test.ripple → composite.props.test.rsrx} +0 -0
  209. /package/tests/server/{composite.test.ripple → composite.test.rsrx} +0 -0
  210. /package/tests/server/{context.test.ripple → context.test.rsrx} +0 -0
  211. /package/tests/server/{dynamic-elements.test.ripple → dynamic-elements.test.rsrx} +0 -0
  212. /package/tests/server/{for.test.ripple → for.test.rsrx} +0 -0
  213. /package/tests/server/{head.test.ripple → head.test.rsrx} +0 -0
  214. /package/tests/server/{if.test.ripple → if.test.rsrx} +0 -0
  215. /package/tests/server/{lazy-destructuring.test.ripple → lazy-destructuring.test.rsrx} +0 -0
  216. /package/tests/server/{return.test.ripple → return.test.rsrx} +0 -0
  217. /package/tests/server/{switch.test.ripple → switch.test.rsrx} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # ripple
2
2
 
3
+ ## 0.3.14
4
+
5
+ ### Patch Changes
6
+
7
+ - [#866](https://github.com/Ripple-TS/ripple/pull/866)
8
+ [`228f1bb`](https://github.com/Ripple-TS/ripple/commit/228f1bb36cd3e8506c422ed0997164bf5a0b5fe2)
9
+ Thanks [@trueadm](https://github.com/trueadm)! - Extract compiler into
10
+ `@tsrx/core` and `@tsrx/ripple` packages
11
+ - `@tsrx/core`: Core compiler infrastructure — parser factory, scope management,
12
+ utilities, constants, and type definitions
13
+ - `@tsrx/ripple`: Ripple-specific compiler — RipplePlugin, analyze,
14
+ client/server transforms
15
+ - Remove compiler source code from `ripple` package (consumers should use
16
+ `@tsrx/ripple`)
17
+ - Migrate eslint-plugin type imports to `@tsrx/core/types/*`
18
+ - Remove unused compiler dependencies from `ripple` package
19
+
20
+ - Updated dependencies
21
+ [[`228f1bb`](https://github.com/Ripple-TS/ripple/commit/228f1bb36cd3e8506c422ed0997164bf5a0b5fe2)]:
22
+ - ripple@0.3.14
23
+
24
+ ## 0.3.13
25
+
26
+ ### Patch Changes
27
+
28
+ - [#842](https://github.com/Ripple-TS/ripple/pull/842)
29
+ [`4eb4d68`](https://github.com/Ripple-TS/ripple/commit/4eb4d6851573d771d65f1e85b1b442ad3cdc53d2)
30
+ Thanks [@leonidaz](https://github.com/leonidaz)! - fix(server): inject SSR web
31
+ stream sinks instead of creating node streams
32
+
33
+ - [#862](https://github.com/Ripple-TS/ripple/pull/862)
34
+ [`48af856`](https://github.com/Ripple-TS/ripple/commit/48af85678d5e1b32bb1c5e3fbb2fb07498bc88a3)
35
+ Thanks [@leonidaz](https://github.com/leonidaz)! - Add a release changeset for
36
+ the async tracking work introduced in commit
37
+ `4eb4d6851573d771d65f1e85b1b442ad3cdc53d2`.
38
+
39
+ This ships async tracking as a first-class feature in Ripple:
40
+ - remove and prohibit direct component-level `await`; async component flows now
41
+ require using `trackAsync()` (with `trackPending()` for pending state checks)
42
+ - add `trackAsync()` and `trackPending()` support so async values can be read
43
+ through Ripple's reactive runtime using tracked async values
44
+ - update compiler/runtime behavior for `try`/`catch`/`pending` boundaries so
45
+ async pending and error states can render and recover correctly in client and
46
+ SSR paths
47
+ - align `@ripple-ts/compat-react` async boundary behavior with the new Ripple
48
+ async tracking semantics
49
+ - update editor/tooling integration to match the new async syntax/runtime shape
50
+
51
+ - [`6e11177`](https://github.com/Ripple-TS/ripple/commit/6e111778cae4e7d9876e51e293520f0859eb5890)
52
+ Thanks [@trueadm](https://github.com/trueadm)! - Add `.rsrx` support across
53
+ Ripple tooling and rename the repository's tracked `.ripple` modules to `.rsrx`.
54
+ - Updated dependencies
55
+ [[`4eb4d68`](https://github.com/Ripple-TS/ripple/commit/4eb4d6851573d771d65f1e85b1b442ad3cdc53d2),
56
+ [`48af856`](https://github.com/Ripple-TS/ripple/commit/48af85678d5e1b32bb1c5e3fbb2fb07498bc88a3),
57
+ [`6e11177`](https://github.com/Ripple-TS/ripple/commit/6e111778cae4e7d9876e51e293520f0859eb5890)]:
58
+ - ripple@0.3.13
59
+
3
60
  ## 0.3.12
4
61
 
5
62
  ### Patch Changes
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ripple is an elegant TypeScript UI framework",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.3.12",
6
+ "version": "0.3.14",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index-client.js",
9
9
  "main": "src/runtime/index-client.js",
@@ -33,29 +33,12 @@
33
33
  "types": "./types/server.d.ts",
34
34
  "default": "./src/server/index.js"
35
35
  },
36
- "./compiler": {
37
- "types": "./src/compiler/index.d.ts",
38
- "require": "./src/compiler/index.js",
39
- "default": "./src/compiler/index.js"
40
- },
41
- "./types/estree": {
42
- "types": "./src/compiler/types/estree.d.ts"
43
- },
44
- "./types/estree-jsx": {
45
- "types": "./src/compiler/types/estree-jsx.d.ts"
46
- },
47
- "./types/acorn": {
48
- "types": "./src/compiler/types/acorn.d.ts"
49
- },
50
36
  "./compiler/internal/import": {
51
37
  "types": "./src/compiler/types/import.d.ts"
52
38
  },
53
39
  "./compiler/internal/rpc": {
54
40
  "types": "./src/compiler/types/rpc.d.ts"
55
41
  },
56
- "./compiler/internal/identifier/utils": {
57
- "default": "./src/compiler/identifier-utils.js"
58
- },
59
42
  "./validator": {
60
43
  "types": "./types/index.d.ts",
61
44
  "require": "./validator/index.js",
@@ -64,9 +47,15 @@
64
47
  "./internal/client": {
65
48
  "default": "./src/runtime/internal/client/index.js"
66
49
  },
50
+ "./internal/client-types": {
51
+ "types": "./src/runtime/internal/client/types.d.ts"
52
+ },
67
53
  "./internal/server": {
68
54
  "default": "./src/runtime/internal/server/index.js"
69
55
  },
56
+ "./internal/server-types": {
57
+ "types": "./src/runtime/internal/server/types.d.ts"
58
+ },
70
59
  "./jsx-runtime": {
71
60
  "types": "./src/jsx-runtime.d.ts",
72
61
  "import": "./src/jsx-runtime.js",
@@ -77,23 +66,13 @@
77
66
  "#client": "./src/runtime/internal/client/types.d.ts",
78
67
  "#client/constants": "./src/internal/client/constants.js",
79
68
  "#server": "./src/runtime/internal/server/types.d.ts",
80
- "#compiler": "./src/compiler/types/index.d.ts",
81
- "#parser": "./src/compiler/types/parse.d.ts",
82
69
  "#public": "./types/index.d.ts",
83
70
  "#helpers": "./src/helpers.d.ts"
84
71
  },
85
72
  "dependencies": {
86
- "@jridgewell/sourcemap-codec": "^1.5.5",
87
- "@sveltejs/acorn-typescript": "^1.0.9",
88
- "acorn": "^8.15.0",
89
73
  "clsx": "^2.1.1",
90
74
  "devalue": "^5.6.3",
91
75
  "esm-env": "^1.2.2",
92
- "esrap": "^2.1.0",
93
- "is-reference": "^3.0.3",
94
- "magic-string": "^0.30.18",
95
- "muggle-string": "^0.4.1",
96
- "zimmerframe": "^1.1.2",
97
76
  "@types/estree": "^1.0.8",
98
77
  "@types/estree-jsx": "^1.0.5"
99
78
  },
@@ -102,9 +81,11 @@
102
81
  "@typescript-eslint/types": "^8.40.0",
103
82
  "typescript": "^5.9.3",
104
83
  "@volar/language-core": "~2.4.28",
105
- "vscode-languageserver-types": "^3.17.5"
84
+ "vscode-languageserver-types": "^3.17.5",
85
+ "@tsrx/core": "0.0.2",
86
+ "@tsrx/ripple": "0.0.2"
106
87
  },
107
88
  "peerDependencies": {
108
- "ripple": "0.3.12"
89
+ "ripple": "0.3.14"
109
90
  }
110
91
  }
@@ -34,16 +34,10 @@ import {
34
34
  RippleSet as _$_Set__Ripple,
35
35
  RippleArray as _$_Array__Ripple,
36
36
  RippleObject as _$_Object__Ripple,
37
- Context as _$_Context__Ripple,
38
37
  RippleURL as _$_URL__Ripple,
39
38
  RippleURLSearchParams as _$_URLSearchParams__Ripple,
40
39
  RippleDate as _$_Date__Ripple,
41
- MediaQuery as _$_MediaQuery__,
42
40
  createRefKey as _$_RefKey__create,
43
- track as _$_track__,
44
- effect as _$_effect__,
45
- untrack as _$_untrack__,
46
- ripple_namespace as _$__u0023_ripple,
47
41
  } from 'ripple';
48
42
 
49
43
  export {
@@ -51,14 +45,8 @@ export {
51
45
  _$_Set__Ripple,
52
46
  _$_Array__Ripple,
53
47
  _$_Object__Ripple,
54
- _$_Context__Ripple,
55
48
  _$_URL__Ripple,
56
49
  _$_URLSearchParams__Ripple,
57
50
  _$_Date__Ripple,
58
- _$_MediaQuery__,
59
51
  _$_RefKey__create,
60
- _$_track__,
61
- _$_effect__,
62
- _$_untrack__,
63
- _$__u0023_ripple,
64
52
  };
package/src/helpers.d.ts CHANGED
@@ -7,3 +7,5 @@ export type RequiredPresent<T, K extends keyof T> = Omit<T, K> & Required<Pick<T
7
7
  export type Nullable<T> = T | null;
8
8
 
9
9
  export type Nullish<T> = T | null | undefined;
10
+
11
+ export type NestedArray<T> = (T | NestedArray<T>)[];
@@ -4,49 +4,49 @@ import { array_proxy } from './proxy.js';
4
4
 
5
5
  /**
6
6
  * @template T
7
- * @constructor
8
- * @param {...T} elements
9
- * @returns {RippleArray<T>}
10
7
  */
11
- export function RippleArray(...elements) {
12
- if (!new.target) {
13
- throw new Error("RippleArray must be called with 'new'");
8
+ export class RippleArray {
9
+ /**
10
+ * @param {...T} elements
11
+ */
12
+ constructor(...elements) {
13
+ var block = safe_scope();
14
+ return /** @type {RippleArray<any>} */ (
15
+ /** @type {unknown} */ (ripple_array(block, ...elements))
16
+ );
14
17
  }
15
18
 
16
- var block = safe_scope();
17
- return ripple_array(block, ...elements);
18
- }
19
-
20
- /**
21
- * @template T
22
- * @param {ArrayLike<T> | Iterable<T>} arrayLike
23
- * @param {(v: T, k: number) => any | undefined} [mapFn]
24
- * @param {*} [thisArg]
25
- * @returns {RippleArray<T>}
26
- */
27
- RippleArray.from = function (arrayLike, mapFn, thisArg) {
28
- return ripple_array.from(safe_scope(), arrayLike, mapFn, thisArg);
29
- };
19
+ /**
20
+ * @template U
21
+ * @param {ArrayLike<U> | Iterable<U>} arrayLike
22
+ * @param {(v: U, k: number) => any | undefined} [mapFn]
23
+ * @param {*} [thisArg]
24
+ * @returns {RippleArray<U>}
25
+ */
26
+ static from(arrayLike, mapFn, thisArg) {
27
+ return ripple_array.from(safe_scope(), arrayLike, mapFn, thisArg);
28
+ }
30
29
 
31
- /**
32
- * @template T
33
- * @param {...T} items
34
- * @returns {RippleArray<T>}
35
- */
36
- RippleArray.of = function (...items) {
37
- return ripple_array.of(safe_scope(), ...items);
38
- };
30
+ /**
31
+ * @template U
32
+ * @param {...U} items
33
+ * @returns {RippleArray<U>}
34
+ */
35
+ static of(...items) {
36
+ return ripple_array.of(safe_scope(), ...items);
37
+ }
39
38
 
40
- /**
41
- * @template T
42
- * @param {ArrayLike<T> | Iterable<T>} arrayLike
43
- * @param {(v: T, k: number) => any | undefined} [mapFn]
44
- * @param {any} [thisArg]
45
- * @returns {Promise<RippleArray<T>>}
46
- */
47
- RippleArray.fromAsync = async function (arrayLike, mapFn, thisArg) {
48
- return ripple_array.fromAsync(safe_scope(), arrayLike, mapFn, thisArg);
49
- };
39
+ /**
40
+ * @template U
41
+ * @param {ArrayLike<U> | Iterable<U>} arrayLike
42
+ * @param {(v: U, k: number) => any | undefined} [mapFn]
43
+ * @param {any} [thisArg]
44
+ * @returns {Promise<RippleArray<U>>}
45
+ */
46
+ static async fromAsync(arrayLike, mapFn, thisArg) {
47
+ return ripple_array.fromAsync(safe_scope(), arrayLike, mapFn, thisArg);
48
+ }
49
+ }
50
50
 
51
51
  /**
52
52
  * @template T
@@ -1,8 +1,8 @@
1
- /** @import { createSubscriber } from '#public' */
1
+ /** @import { createSubscriber as createSubscriberType } from '#public' */
2
2
  import { untrack, queue_microtask } from './internal/client/runtime.js';
3
3
  import { effect } from './internal/client/blocks.js';
4
4
 
5
- /** @type {createSubscriber} */
5
+ /** @type {typeof createSubscriberType} */
6
6
  export function createSubscriber(start) {
7
7
  let subscribers = 0;
8
8
  /** @type {(() => void) | void} */
@@ -21,6 +21,12 @@ import { COMMENT_NODE, HYDRATION_START } from '../constants.js';
21
21
 
22
22
  // Re-export JSX runtime functions for jsxImportSource: "ripple"
23
23
  export { jsx, jsxs, Fragment } from '../jsx-runtime.js';
24
+ export {
25
+ UNINITIALIZED,
26
+ DERIVED_UPDATED,
27
+ SUSPENSE_PENDING,
28
+ SUSPENSE_REJECTED,
29
+ } from './internal/client/constants.js';
24
30
 
25
31
  /**
26
32
  * @returns {CompatOptions | undefined}
@@ -112,7 +118,15 @@ export function hydrate(component, options) {
112
118
 
113
119
  export { Context } from './internal/client/context.js';
114
120
 
115
- export { flush_sync as flushSync, track, untrack, tick } from './internal/client/runtime.js';
121
+ export {
122
+ flush_sync as flushSync,
123
+ track,
124
+ track_async as trackAsync,
125
+ untrack,
126
+ tick,
127
+ is_tracked_pending as trackPending,
128
+ peek_tracked as peek,
129
+ } from './internal/client/runtime.js';
116
130
 
117
131
  export { RippleArray } from './array.js';
118
132
 
@@ -159,15 +173,3 @@ export {
159
173
  bindOffsetWidth,
160
174
  bindOffsetHeight,
161
175
  } from './internal/client/bindings.js';
162
-
163
- import { RippleMap } from './map.js';
164
- import { RippleSet } from './set.js';
165
- import { RippleArray } from './array.js';
166
- import { RippleObject } from './object.js';
167
- import { Context } from './internal/client/context.js';
168
- import { RippleURL } from './url.js';
169
- import { RippleURLSearchParams } from './url-search-params.js';
170
- import { RippleDate } from './date.js';
171
- import { MediaQuery } from './media-query.js';
172
- import { track, untrack, ref_prop as createRefKey } from './internal/client/runtime.js';
173
- import { user_effect as effect } from './internal/client/blocks.js';
@@ -1,10 +1,21 @@
1
- import { get, set, untrack, track } from './internal/server/index.js';
1
+ import { output_push, noop } from './internal/server/index.js';
2
2
 
3
3
  export { Context } from './internal/server/context.js';
4
-
5
- export { get, set, untrack, track };
6
-
7
- function noop() {}
4
+ export {
5
+ get,
6
+ set,
7
+ untrack,
8
+ track,
9
+ track_async as trackAsync,
10
+ is_tracked_pending as trackPending,
11
+ peek_tracked as peek,
12
+ } from './internal/server/index.js';
13
+ export {
14
+ UNINITIALIZED,
15
+ DERIVED_UPDATED,
16
+ SUSPENSE_PENDING,
17
+ SUSPENSE_REJECTED,
18
+ } from './internal/client/constants.js';
8
19
 
9
20
  export const effect = noop;
10
21
  export const createRefKey = noop;
@@ -61,13 +72,9 @@ export const bindOffsetHeight = noop;
61
72
  * Portal component noop for server-side rendering.
62
73
  * Portals are client-only and do not render on the server.
63
74
  * However, we need to output a marker comment so hydration can work correctly.
64
- * @param {any} output
65
- * @param {any} __
66
75
  */
67
- export function Portal(output, __) {
76
+ export function Portal() {
68
77
  // Portals are client-only, but we need to output a marker for hydration
69
78
  // Output an empty HTML comment as a placeholder
70
- if (output && typeof output.push === 'function') {
71
- output.push('<!--portal-->');
72
- }
79
+ output_push('<!--portal-->');
73
80
  }
@@ -1,11 +1,9 @@
1
1
  /** @import { Tracked } from '#client' */
2
2
 
3
- /**
4
- @typedef {(v: unknown) => void} SetFunction
5
- @typedef {() => any} BindGetter
6
- @typedef {(v: unknown) => void} BindSetter
7
- @typedef {{getter: BindGetter, setter: BindSetter}} BindGetSet
8
- */
3
+ /** @typedef {(v: unknown) => void} SetFunction */
4
+ /** @typedef {() => any} BindGetter */
5
+ /** @typedef {(v: unknown) => void} BindSetter */
6
+ /** @typedef {{getter: BindGetter, setter: BindSetter}} BindGetSet */
9
7
 
10
8
  import { effect, render } from './blocks.js';
11
9
  import { on } from './events.js';
@@ -8,10 +8,12 @@ import {
8
8
  DESTROYED,
9
9
  EFFECT_BLOCK,
10
10
  PAUSED,
11
+ PRE_EFFECT_BLOCK,
11
12
  RENDER_BLOCK,
12
13
  ROOT_BLOCK,
13
14
  TRY_BLOCK,
14
15
  HEAD_BLOCK,
16
+ DIRECT_CHILD_BLOCK,
15
17
  } from './constants.js';
16
18
  import { next_sibling } from './operations.js';
17
19
  import { apply_element_spread } from './render.js';
@@ -20,13 +22,11 @@ import {
20
22
  active_component,
21
23
  active_reaction,
22
24
  create_component_ctx,
23
- handle_error,
24
25
  is_block_dirty,
25
26
  run_block,
26
27
  run_teardown,
27
28
  schedule_update,
28
29
  } from './runtime.js';
29
- import { suspend } from './try.js';
30
30
 
31
31
  /**
32
32
  * @param {Function} fn
@@ -60,6 +60,14 @@ export function effect(fn) {
60
60
  return block(EFFECT_BLOCK, fn);
61
61
  }
62
62
 
63
+ /**
64
+ * Creates a pre-effect block that runs eagerly before render blocks in the flush cycle.
65
+ * @param {Function} fn
66
+ */
67
+ export function pre_effect(fn) {
68
+ return block(PRE_EFFECT_BLOCK, fn);
69
+ }
70
+
63
71
  /**
64
72
  * @param {Function} fn
65
73
  * @param {any} [state]
@@ -87,27 +95,6 @@ export function branch(fn, flags = 0, state = null) {
87
95
  return block(BRANCH_BLOCK | flags, fn, state);
88
96
  }
89
97
 
90
- /**
91
- * @param {() => any} fn
92
- */
93
- export function async(fn) {
94
- return block(BRANCH_BLOCK, async () => {
95
- var current_block = active_block;
96
- const unsuspend = suspend();
97
- try {
98
- await fn();
99
- // An extra microtask tick ensures `suspend()` → `pending` is visible for at
100
- // least one full microtask cycle. This matters during SSR hydration: the
101
- // test (or any awaiter) gets to observe the pending state before `unsuspend`
102
- // swaps back to the resolved content.
103
- await Promise.resolve();
104
- unsuspend();
105
- } catch (error) {
106
- handle_error(error, /** @type {Block} */ (current_block));
107
- }
108
- });
109
- }
110
-
111
98
  /**
112
99
  * @param {Element} element
113
100
  * @param {() => (element: Element) => (void | (() => void))} get_fn
@@ -176,6 +163,15 @@ export function create_try_block(fn, state) {
176
163
  return block(TRY_BLOCK, fn, state);
177
164
  }
178
165
 
166
+ /**
167
+ * @param {() => void} fn
168
+ * @param {number} [flags]
169
+ * @param {any} [state]
170
+ */
171
+ export function boundary_fn_running_block(fn, flags = 0, state = null) {
172
+ return branch(fn, DIRECT_CHILD_BLOCK | flags, state);
173
+ }
174
+
179
175
  /**
180
176
  * @param {Block} block
181
177
  * @param {Block} parent_block
@@ -9,18 +9,21 @@ export var SWITCH_BLOCK = 1 << 8;
9
9
  export var COMPOSITE_BLOCK = 1 << 9;
10
10
  export var ASYNC_BLOCK = 1 << 10;
11
11
  export var HEAD_BLOCK = 1 << 11;
12
- export var CONTAINS_UPDATE = 1 << 12;
13
- export var CONTAINS_TEARDOWN = 1 << 13;
14
- export var BLOCK_HAS_RUN = 1 << 14;
15
- export var TRACKED = 1 << 15;
16
- export var DERIVED = 1 << 16;
17
- export var DEFERRED = 1 << 17;
18
- export var PAUSED = 1 << 18;
19
- export var DESTROYED = 1 << 19;
12
+ export var PRE_EFFECT_BLOCK = 1 << 12;
13
+ export var DIRECT_CHILD_BLOCK = 1 << 13;
14
+ export var CONTAINS_UPDATE = 1 << 14;
15
+ export var CONTAINS_TEARDOWN = 1 << 15;
16
+ export var BLOCK_HAS_RUN = 1 << 16;
17
+ export var TRACKED = 1 << 17;
18
+ export var DERIVED = 1 << 18;
19
+ export var DEFERRED = 1 << 19;
20
+ export var PAUSED = 1 << 20;
21
+ export var DESTROYED = 1 << 21;
20
22
 
21
23
  export var CONTROL_FLOW_BLOCK = FOR_BLOCK | IF_BLOCK | SWITCH_BLOCK | TRY_BLOCK | COMPOSITE_BLOCK;
22
24
 
23
- export var UNINITIALIZED = Symbol();
25
+ /** @type {unique symbol} */
26
+ export const UNINITIALIZED = Symbol('uninitialized');
24
27
  /** @type {unique symbol} */
25
28
  export const TRACKED_ARRAY = Symbol();
26
29
  /** @type {unique symbol} */
@@ -38,3 +41,11 @@ export const NAMESPACE_URI = {
38
41
  svg: 'http://www.w3.org/2000/svg',
39
42
  mathml: 'http://www.w3.org/1998/Math/MathML',
40
43
  };
44
+ /** @type {unique symbol} */
45
+ export const DERIVED_UPDATED = Symbol('derived_updated');
46
+ /** @type {unique symbol} */
47
+ export const SUSPENSE_PENDING = Symbol('suspense_pending');
48
+ /** @type {unique symbol} */
49
+ export const SUSPENSE_REJECTED = Symbol('suspense_rejected');
50
+ /** @type {unique symbol} */
51
+ export const ASYNC_DERIVED_READ_THROWN = Symbol('async_derived_read_thrown');
@@ -277,8 +277,9 @@ function create_event(event_name, dom, handler, options) {
277
277
  }
278
278
 
279
279
  /**
280
- * @type {EventListener}
281
280
  * @this {Element}
281
+ * @param {Event} event
282
+ * @returns {any}
282
283
  */
283
284
  function target_handler(event) {
284
285
  var previous_block = active_block;
@@ -295,7 +296,7 @@ function create_event(event_name, dom, handler, options) {
295
296
  handle_event_propagation.call(dom, event);
296
297
  }
297
298
  if (!event.cancelBubble) {
298
- return handler?.call(this, event);
299
+ return handler?.call(/** @type {Element} */ (this), event);
299
300
  }
300
301
  } finally {
301
302
  set_active_block(previous_block);
@@ -380,6 +381,7 @@ export function delegate(events) {
380
381
 
381
382
  /** @param {Element} target */
382
383
  export function handle_root_events(target) {
384
+ /** @type {Set<string>} */
383
385
  var registered_events = new Set();
384
386
  root_target = target;
385
387
 
@@ -417,7 +419,10 @@ export function handle_root_events(target) {
417
419
 
418
420
  return () => {
419
421
  for (var event_name of registered_events) {
420
- target.removeEventListener(event_name, handle_event_propagation);
422
+ target.removeEventListener(
423
+ event_name,
424
+ /** @type {EventListener} */ (handle_event_propagation),
425
+ );
421
426
  }
422
427
  root_event_handles.delete(event_handle);
423
428
  root_target = null;
@@ -6,21 +6,9 @@ import { hydrate_node, hydrating } from './hydration.js';
6
6
  import { branch, destroy_block, render } from './blocks.js';
7
7
  import { active_block, get, set, tracked } from './runtime.js';
8
8
 
9
- /**
10
- @typedef {
11
- (anchor: Node, props: any, block: Block | null) => void
12
- } Component
13
-
14
- @typedef {
15
- Component & {
16
- [HMR]: {
17
- fn: Component;
18
- current: Tracked | undefined;
19
- update: (incoming: ComponentWrapper) => void;
20
- }
21
- }
22
- } ComponentWrapper
23
- */
9
+ /** @typedef {(anchor: Node, props: any, block: Block | null) => void} Component */
10
+
11
+ /** @typedef {Component & { [HMR]: { fn: Component; current: Tracked | undefined; update: (incoming: ComponentWrapper) => void; } }} ComponentWrapper */
24
12
 
25
13
  /**
26
14
  * Wraps a component function for HMR (Hot Module Replacement).
@@ -35,10 +23,9 @@ export function hmr(fn) {
35
23
  var current;
36
24
 
37
25
  /**
38
- * @type {ComponentWrapper}
39
26
  * @param {Node} anchor
40
27
  * @param {any} props
41
- * @param {Block | null} block
28
+ * @param {Block | null} [block]
42
29
  */
43
30
  function wrapper(anchor, props, block = active_block) {
44
31
  if (current === undefined) {
@@ -88,6 +75,7 @@ export function hmr(fn) {
88
75
  wrapper[HMR] = {
89
76
  fn,
90
77
  current,
78
+ /** @param {ComponentWrapper} incoming */
91
79
  update: (incoming) => {
92
80
  fn = incoming[HMR].fn;
93
81
  wrapper[HMR].fn = fn;
@@ -20,15 +20,22 @@ export {
20
20
  export {
21
21
  render,
22
22
  render_spread,
23
- async,
24
23
  ref,
25
24
  branch,
26
25
  destroy_block,
27
26
  move_block,
28
27
  root,
29
28
  user_effect as effect,
29
+ resume_block,
30
+ is_destroyed,
30
31
  } from './blocks.js';
31
32
 
33
+ export {
34
+ UNINITIALIZED,
35
+ DERIVED_UPDATED,
36
+ SUSPENSE_PENDING,
37
+ SUSPENSE_REJECTED,
38
+ } from './constants.js';
32
39
  export { event, render_event, delegate } from './events.js';
33
40
 
34
41
  export {
@@ -40,7 +47,6 @@ export {
40
47
  get_tracked,
41
48
  get_derived,
42
49
  set,
43
- async_computed,
44
50
  tracked,
45
51
  spread_props,
46
52
  computed_property,
@@ -52,6 +58,9 @@ export {
52
58
  update_property,
53
59
  update_pre_property,
54
60
  track,
61
+ track_async,
62
+ is_tracked_pending,
63
+ peek_tracked,
55
64
  push_component,
56
65
  pop_component,
57
66
  untrack,
@@ -59,12 +68,13 @@ export {
59
68
  fallback,
60
69
  exclude_from_object,
61
70
  derived,
62
- maybe_tracked,
63
71
  tick,
64
72
  proxy_props,
65
73
  with_block,
66
74
  with_ns,
67
75
  handle_error,
76
+ queue_post_block_flush_callback,
77
+ schedule_update,
68
78
  } from './runtime.js';
69
79
 
70
80
  export { composite } from './composite.js';
@@ -73,7 +83,7 @@ export { for_block as for, for_block_keyed as for_keyed } from './for.js';
73
83
 
74
84
  export { if_block as if } from './if.js';
75
85
 
76
- export { try_block as try, aborted, suspend } from './try.js';
86
+ export { try_block as try, get_pending_boundary } from './try.js';
77
87
 
78
88
  export { switch_block as switch } from './switch.js';
79
89