@abide/abide 0.43.0 → 0.44.0

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 (160) hide show
  1. package/AGENTS.md +293 -219
  2. package/CHANGELOG.md +46 -0
  3. package/README.md +191 -67
  4. package/package.json +2 -2
  5. package/src/abideLsp.ts +8 -4
  6. package/src/abideResolverPlugin.ts +11 -1
  7. package/src/build.ts +9 -0
  8. package/src/buildDisconnected.ts +2 -0
  9. package/src/devEntry.ts +1 -0
  10. package/src/lib/bundle/probeAbideServer.ts +1 -1
  11. package/src/lib/cli/parseArgvForRpc.ts +4 -2
  12. package/src/lib/cli/types/CliManifest.ts +6 -4
  13. package/src/lib/mcp/annotationsForMethod.ts +1 -1
  14. package/src/lib/mcp/toolResultFromResponse.ts +1 -1
  15. package/src/lib/mcp/types/JsonRpcRequest.ts +3 -3
  16. package/src/lib/server/AppModule.ts +1 -1
  17. package/src/lib/server/cli/handleCliDownload.ts +7 -5
  18. package/src/lib/server/cli/installScript.ts +3 -3
  19. package/src/lib/server/prompts/promptRegistry.ts +1 -1
  20. package/src/lib/server/prompts/types/Prompt.ts +2 -1
  21. package/src/lib/server/rpc/dispatchRpcInProcess.ts +2 -2
  22. package/src/lib/server/rpc/types/RpcHelper.ts +1 -1
  23. package/src/lib/server/runtime/createPublicAssetServer.ts +2 -2
  24. package/src/lib/server/runtime/createRouteDispatcher.ts +1 -1
  25. package/src/lib/server/runtime/createServer.ts +21 -0
  26. package/src/lib/server/runtime/createUiPageRenderer.ts +7 -11
  27. package/src/lib/server/runtime/crossOriginForbidden.ts +2 -2
  28. package/src/lib/server/runtime/crossOriginGate.ts +1 -1
  29. package/src/lib/server/runtime/devHotModuleResponse.ts +2 -2
  30. package/src/lib/server/runtime/disableIdleTimeoutForStream.ts +1 -1
  31. package/src/lib/server/runtime/logExposedSurfaces.ts +3 -4
  32. package/src/lib/server/runtime/serializeCacheSnapshot.ts +3 -8
  33. package/src/lib/server/runtime/snapshotEntryFromCache.ts +10 -7
  34. package/src/lib/server/runtime/streamFromIterator.ts +2 -2
  35. package/src/lib/server/runtime/types/InspectorRpc.ts +2 -2
  36. package/src/lib/server/socket.ts +1 -1
  37. package/src/lib/server/sockets/createSocketDispatcher.ts +2 -2
  38. package/src/lib/server/sockets/socketRegistry.ts +2 -2
  39. package/src/lib/server/sockets/types/SocketClientFrame.ts +3 -3
  40. package/src/lib/shared/CACHE_WRAPPED.ts +3 -2
  41. package/src/lib/shared/REMOTE_FUNCTION.ts +1 -1
  42. package/src/lib/shared/STREAMING_CONTENT_TYPES.ts +3 -2
  43. package/src/lib/shared/bodyValueForKind.ts +35 -0
  44. package/src/lib/shared/cache.ts +1 -1
  45. package/src/lib/shared/cacheEntryFromSnapshot.ts +23 -18
  46. package/src/lib/shared/createPushIterator.ts +1 -1
  47. package/src/lib/shared/decodeResponse.ts +11 -8
  48. package/src/lib/shared/hasReplayableRequest.ts +17 -0
  49. package/src/lib/shared/html.ts +7 -26
  50. package/src/lib/shared/manifestModule.ts +2 -2
  51. package/src/lib/shared/online.ts +1 -1
  52. package/src/lib/shared/outboxProbeSlot.ts +1 -1
  53. package/src/lib/shared/pageUrlForFile.ts +1 -1
  54. package/src/lib/shared/routeParamsShape.ts +20 -0
  55. package/src/lib/shared/snapshotShippable.ts +22 -0
  56. package/src/lib/shared/types/CacheEntry.ts +1 -1
  57. package/src/lib/shared/types/CacheInvalidation.ts +3 -3
  58. package/src/lib/shared/types/ClientFlags.ts +5 -3
  59. package/src/lib/shared/types/LastConnection.ts +1 -1
  60. package/src/lib/shared/url.ts +4 -1
  61. package/src/lib/shared/withBase.ts +1 -2
  62. package/src/lib/shared/writeDts.ts +2 -2
  63. package/src/lib/shared/writeRoutesDts.ts +3 -31
  64. package/src/lib/test/createTestSocketChannel.ts +3 -3
  65. package/src/lib/ui/COMPONENT_WRAPPER_PREFIX.ts +1 -1
  66. package/src/lib/ui/compile/ABIDE_SEMANTIC_TOKENS_LEGEND.ts +40 -6
  67. package/src/lib/ui/compile/REACTIVE_CALLEES.ts +1 -1
  68. package/src/lib/ui/compile/UI_RUNTIME_IMPORTS.ts +49 -37
  69. package/src/lib/ui/compile/abideUiPlugin.ts +1 -1
  70. package/src/lib/ui/compile/assertRuntimeHelpersBound.ts +3 -1
  71. package/src/lib/ui/compile/awaitPlan.ts +14 -2
  72. package/src/lib/ui/compile/catchBinding.ts +8 -0
  73. package/src/lib/ui/compile/classStyleMergePlan.ts +108 -0
  74. package/src/lib/ui/compile/collectAbideDiagnostics.ts +11 -0
  75. package/src/lib/ui/compile/compileComponent.ts +4 -4
  76. package/src/lib/ui/compile/compileModule.ts +20 -6
  77. package/src/lib/ui/compile/compileSSR.ts +12 -10
  78. package/src/lib/ui/compile/compileShadow.ts +107 -16
  79. package/src/lib/ui/compile/composeProps.ts +3 -3
  80. package/src/lib/ui/compile/createShadowLanguageService.ts +30 -2
  81. package/src/lib/ui/compile/createShadowProgram.ts +2 -1
  82. package/src/lib/ui/compile/createShadowScope.ts +42 -0
  83. package/src/lib/ui/compile/decodeHtmlEntities.ts +4 -0
  84. package/src/lib/ui/compile/desugarSignals.ts +12 -7
  85. package/src/lib/ui/compile/eachPlan.ts +61 -0
  86. package/src/lib/ui/compile/elementPlan.ts +55 -0
  87. package/src/lib/ui/compile/encodeSemanticTokens.ts +24 -1
  88. package/src/lib/ui/compile/generateBuild.ts +150 -127
  89. package/src/lib/ui/compile/generateSSR.ts +112 -73
  90. package/src/lib/ui/compile/ifPlan.ts +7 -1
  91. package/src/lib/ui/compile/interpolatedTemplateLiteral.ts +25 -0
  92. package/src/lib/ui/compile/isPlainIdentifier.ts +7 -0
  93. package/src/lib/ui/compile/isTextLeaf.ts +8 -7
  94. package/src/lib/ui/compile/lowerContext.ts +36 -46
  95. package/src/lib/ui/compile/lowerDocAccess.ts +2 -2
  96. package/src/lib/ui/compile/lowerScript.ts +1 -1
  97. package/src/lib/ui/compile/markupTokens.ts +313 -0
  98. package/src/lib/ui/compile/pagePropsType.ts +23 -0
  99. package/src/lib/ui/compile/parseTemplate.ts +131 -61
  100. package/src/lib/ui/compile/reactiveBinding.ts +47 -0
  101. package/src/lib/ui/compile/renameSignalRefs.ts +44 -10
  102. package/src/lib/ui/compile/skeletonable.ts +5 -5
  103. package/src/lib/ui/compile/snippetPlan.ts +28 -0
  104. package/src/lib/ui/compile/spreadExcludedNames.ts +4 -4
  105. package/src/lib/ui/compile/structuralBlockTokens.ts +3 -4
  106. package/src/lib/ui/compile/switchPlan.ts +7 -1
  107. package/src/lib/ui/compile/tryPlan.ts +8 -1
  108. package/src/lib/ui/compile/types/AnalyzedComponent.ts +2 -2
  109. package/src/lib/ui/compile/types/Binding.ts +24 -0
  110. package/src/lib/ui/compile/types/CompiledShadow.ts +13 -1
  111. package/src/lib/ui/compile/types/ElementPlan.ts +43 -0
  112. package/src/lib/ui/compile/types/ShadowKind.ts +9 -0
  113. package/src/lib/ui/compile/types/ShadowScope.ts +19 -0
  114. package/src/lib/ui/compile/types/TemplateAttr.ts +7 -0
  115. package/src/lib/ui/compile/types/TemplateNode.ts +8 -8
  116. package/src/lib/ui/compile/withBindings.ts +45 -0
  117. package/src/lib/ui/createScope.ts +2 -2
  118. package/src/lib/ui/dom/MATHML_NAMESPACE.ts +2 -2
  119. package/src/lib/ui/dom/SVG_NAMESPACE.ts +3 -2
  120. package/src/lib/ui/dom/appendText.ts +1 -1
  121. package/src/lib/ui/dom/applyResolved.ts +1 -1
  122. package/src/lib/ui/dom/buildDetachedRange.ts +4 -3
  123. package/src/lib/ui/dom/cloneStatic.ts +3 -2
  124. package/src/lib/ui/dom/each.ts +26 -7
  125. package/src/lib/ui/dom/foreignWrapperTag.ts +2 -2
  126. package/src/lib/ui/dom/mountChild.ts +8 -1
  127. package/src/lib/ui/dom/readCall.ts +6 -4
  128. package/src/lib/ui/dom/scopeLabel.ts +3 -3
  129. package/src/lib/ui/dom/switchBlock.ts +3 -1
  130. package/src/lib/ui/dom/types/EachRow.ts +4 -0
  131. package/src/lib/ui/dom/types/SkeletonHoles.ts +4 -2
  132. package/src/lib/ui/history.ts +1 -2
  133. package/src/lib/ui/html.ts +28 -0
  134. package/src/lib/ui/installHotBridge.ts +0 -2
  135. package/src/lib/ui/renderChain.ts +16 -3
  136. package/src/lib/ui/router.ts +66 -15
  137. package/src/lib/ui/rpcOutbox/createOutboxQueue.ts +1 -1
  138. package/src/lib/ui/runtime/CHILD_PRESENT.ts +8 -0
  139. package/src/lib/ui/runtime/OUTLET_MARKER.ts +2 -2
  140. package/src/lib/ui/runtime/RANGE_MARKER.ts +1 -1
  141. package/src/lib/ui/runtime/REACTIVE_CONTEXT.ts +9 -3
  142. package/src/lib/ui/runtime/captureModelDoc.ts +1 -1
  143. package/src/lib/ui/runtime/createDoc.ts +5 -1
  144. package/src/lib/ui/runtime/createEffectNode.ts +5 -5
  145. package/src/lib/ui/runtime/flushEffects.ts +22 -9
  146. package/src/lib/ui/runtime/historyEntries.ts +1 -1
  147. package/src/lib/ui/runtime/track.ts +4 -2
  148. package/src/lib/ui/runtime/trigger.ts +34 -20
  149. package/src/lib/ui/runtime/types/Route.ts +2 -2
  150. package/src/lib/ui/runtime/types/UiComponent.ts +3 -2
  151. package/src/lib/ui/runtime/types/UiProps.ts +9 -12
  152. package/src/lib/ui/runtime/walkPath.ts +15 -3
  153. package/src/lib/ui/startClient.ts +41 -14
  154. package/src/lib/ui/state.ts +3 -3
  155. package/src/lib/ui/types/Scope.ts +3 -3
  156. package/src/serverBuildPlugins.ts +11 -5
  157. package/src/zodCjsPlugin.ts +36 -0
  158. package/template/.zed/settings.json +7 -1
  159. package/template/package.json +3 -0
  160. package/template/src/ui/pages/layout.abide +3 -5
@@ -1,12 +1,14 @@
1
1
  import type { BunPlugin } from 'bun'
2
2
  import { abideResolverPlugin } from './abideResolverPlugin.ts'
3
3
  import { abideUiPlugin } from './lib/ui/compile/abideUiPlugin.ts'
4
+ import { zodCjsPlugin } from './zodCjsPlugin.ts'
4
5
 
5
6
  /*
6
- The server-target Bun.build plugin pair shared by compile / buildCli / bundleApp:
7
- the abide-ui `.abide` loader (so SSR `render()` resolves) plus abide's virtual-
8
- module resolver. `embedAssets` flips on the gzip asset embed used by the
9
- standalone server binary; the CLI + launcher builds leave it off.
7
+ The server-target Bun.build plugin set shared by compile / buildCli / bundleApp:
8
+ the abide-ui `.abide` loader (so SSR `render()` resolves), abide's virtual-module
9
+ resolver, and the zod→CommonJS shim that works around bun's broken ESM-cycle
10
+ bundling (see zodCjsPlugin). `embedAssets` flips on the gzip asset embed used by
11
+ the standalone server binary; the CLI + launcher builds leave it off.
10
12
  */
11
13
  export function serverBuildPlugins({
12
14
  cwd,
@@ -15,5 +17,9 @@ export function serverBuildPlugins({
15
17
  cwd: string
16
18
  embedAssets?: boolean
17
19
  }): BunPlugin[] {
18
- return [abideUiPlugin, abideResolverPlugin({ cwd, embedAssets, target: 'server' })]
20
+ return [
21
+ zodCjsPlugin(cwd),
22
+ abideUiPlugin,
23
+ abideResolverPlugin({ cwd, embedAssets, target: 'server' }),
24
+ ]
19
25
  }
@@ -0,0 +1,36 @@
1
+ import { existsSync } from 'node:fs'
2
+ import { dirname } from 'node:path'
3
+ import type { BunPlugin } from 'bun'
4
+
5
+ /*
6
+ Routes every `zod` import in a server bundle to zod's CommonJS build.
7
+
8
+ zod v4's ESM is reached through two subpaths (`zod` and `zod/v4/core`) whose
9
+ modules form an initialization cycle. Bun's bundler emits a broken init order
10
+ for that cycle (oven-sh/bun#31586, closed as not-planned), so a bundled binary
11
+ crashes (`<helper> is not defined`) or — for a lazily imported module — silently
12
+ fails to evaluate, which drops every rpc whose module imports zod from the
13
+ registry. It only bites bundled output; `abide dev` runs unbundled and is fine.
14
+
15
+ zod ships a parallel CommonJS build (`index.cjs`, `v4/core/index.cjs`, …), and
16
+ CommonJS resolves circular requires through a mutating `module.exports` with no
17
+ temporal-dead-zone, so the cycle initializes correctly. Resolving each zod
18
+ specifier to its `.cjs` sibling makes bun bundle zod as CommonJS and sidesteps
19
+ the bug while keeping zod v4. Server-only: the client bundle strips zod from rpc
20
+ modules (they become remote proxies), and dev never bundles.
21
+ */
22
+ export function zodCjsPlugin(cwd: string): BunPlugin {
23
+ return {
24
+ name: 'abide-zod-cjs',
25
+ setup(build) {
26
+ build.onResolve({ filter: /^zod($|\/)/ }, (args) => {
27
+ /* Resolve from the importer (or cwd for the entry) to zod's ESM
28
+ target, then swap to its `.cjs` sibling when one exists. */
29
+ const from = args.importer ? dirname(args.importer) : cwd
30
+ const resolved = Bun.resolveSync(args.path, from)
31
+ const cjs = resolved.replace(/\.js$/, '.cjs')
32
+ return { path: existsSync(cjs) ? cjs : resolved }
33
+ })
34
+ },
35
+ }
36
+ }
@@ -1,4 +1,10 @@
1
1
  {
2
2
  "auto_install_extensions": { "abide": true },
3
- "semantic_tokens": "combined"
3
+ "semantic_tokens": "combined",
4
+ "global_lsp_settings": {
5
+ "semantic_token_rules": [
6
+ { "token_type": "tag", "style": ["tag"] },
7
+ { "token_type": "attribute", "style": ["attribute"] }
8
+ ]
9
+ }
4
10
  }
@@ -14,5 +14,8 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@abide/abide": "^0.27.0"
17
+ },
18
+ "devDependencies": {
19
+ "@types/bun": "^1.3.14"
17
20
  }
18
21
  }
@@ -1,8 +1,8 @@
1
1
  <script>
2
2
  /*
3
3
  Root layout. A layout.abide wraps every page at or below its folder — here
4
- src/ui/pages/, so it wraps the whole app. The page lands in the <slot/> outlet;
5
- the resolver finds it by filename (no per-page import), and the client router
4
+ src/ui/pages/, so it wraps the whole app. The page renders where this layout
5
+ calls {children()}; the resolver finds it by filename (no per-page import), and the client router
6
6
  keeps it mounted across navigation, so this chrome never re-mounts. A nested
7
7
  layout.abide (in a subfolder) wraps inside this one. Runs on the server during
8
8
  SSR and on the client after hydration.
@@ -16,6 +16,4 @@ import '../app.css'
16
16
  <a href="/about">About</a>
17
17
  </nav>
18
18
  </header>
19
- <main>
20
- <slot></slot>
21
- </main>
19
+ <main>{children()}</main>