Enhance SSE send format and expand file includes for .mts/.cts - #44
Merged
Vanessa219 merged 4 commits intoMay 13, 2026
Merged
Conversation
dprint.json: expand file includes to cover .mts and .cts files and set importDeclaration.spaceSurroundingNamedImports to false. src/kernel.ts: change SSE port.send usage to the object form (including event, data, id, retry) for update events and send the connection message as a plain data payload. This adapts to the updated SSE send API/shape and ensures update events include an id and retry hint.
13 tasks
Register a filesystem watcher for the plugin storage directory on load and remove it on unload. Adds storage.watcher.add("./") in the onload path and storage.watcher.remove("./") in the onunload path, and includes storage in the siyuan destructuring. This ensures the plugin listens for storage events and cleans up the watcher to avoid resource leaks.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates formatting configuration to include modern TypeScript module extensions and adapts the sample SSE server handler to a newer port.send payload shape, including SSE metadata (event name, id, retry).
Changes:
- Expanded
dprint.jsonincludes to cover.mtsand.cts, and adjusted named-import spacing configuration. - Added storage directory filesystem watching on plugin load and removed the watch on unload.
- Updated SSE
request.port.sendusage to send an object payload (withevent,data,id,retry) for update events and a plaindatapayload for the connection message.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/kernel.ts | Adds storage watcher lifecycle wiring and updates SSE send calls to the new object-form payload. |
| dprint.json | Extends formatter include globs for .mts/.cts and tweaks TypeScript import formatting behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Clarify the Server-Sent Events handler docs: replace the previous signature port.send(eventType, data) with the single-argument port.send(event) and remove the explicit mapping notes for `event:` and `data:`. This is a documentation-only change to reduce confusion about the SSE send API; no functional code changes.
Contributor
Author
|
@Vanessa219 已修复报告的问题 |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dprint.json: expand file includes to cover .mts and .cts files and set importDeclaration.spaceSurroundingNamedImports to false.
src/kernel.ts: change SSE port.send usage to the object form (including event, data, id, retry) for update events and send the connection message as a plain data payload. This adapts to the updated SSE send API/shape and ensures update events include an id and retry hint.