Upgrade devDependencies and implement kernel plugin demo - #42
Conversation
Bump multiple devDependencies in package.json (eslint -> ^10.2.1, @eslint/js -> ^10.0.1, @typescript-eslint/* -> ^8.59.1, typescript -> ^6.0.3, webpack -> ^5.106.2, sass -> ^1.99.0, tslib -> ^2.8.1, siyuan -> 1.2.2-alpha.0, globals -> ^17.5.0, and others). Regenerate pnpm-lock.yaml to match the upgraded packages — updates include resolved versions/integrity for eslint ecosystem, parcel-watcher binaries, ajv/acorn/other dependencies, and some added type packages. This keeps the build/lint toolchain up to date and syncs the lockfile with the new dependency set.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Introduce a dedicated kernel build target and developer workflows: add webpack.kernel.config.js and pnpm-workspace.yaml, split dev/build scripts in package.json into kernel and app targets, and add a combined dev script. Expose supported kernels in plugin.json, ignore kernel.js in .gitignore, and make small code/import cleanup in src/index.ts. Update docs to clarify SSE/WS server handler signatures and handler typing. Dev dependencies were bumped accordingly.
Rename server request parameter types in src/kernel.ts from IServerWsRequest/IServerEsRequest to IServerWebSocketRequest/IServerEventSourceRequest to improve type clarity. Also apply minor spacing/style fix in webpack.config.js copy pattern for consistent formatting.
|
文档添加一下中文,代码不要进行格式化。 |
能否提供一下原风格的格式化配置文件 |
|
看一下这个可以不? |
@Vanessa219 |
|
能保持现有代码风格的话可以使用。 |
Apply non-functional formatting and documentation fixes across the repo. Changes include: tidy Markdown tables and examples in docs/superpowers, adjust dprint.json formatting rules (lineWidth -> 120; importDeclaration rules), restructure and reformat eslint.config.mjs, minor pnpm-workspace quoting change, whitespace/commas and template formatting in src/index.ts, multiline handler formatting in src/kernel.ts, small tsconfig spacing fix, and clean up plugin-related blocks in webpack.config.js. These are style/docs/config updates only and do not alter runtime behavior.
Update dprint config: change typescript.quoteStyle from "alwaysDouble" to "preferDouble". Adjust src/index.ts to use a single-quoted selector with unescaped inner double quotes ("[contenteditable=\"true\"]" -> '[contenteditable="true"]') to improve readability and reduce escaping.
@Vanessa219
其他与现有风格保持一致 |
Update formatting rules and apply spacing changes to remove spaces surrounding object properties and destructured bindings. Added dprint setting "spaceSurroundingProperties": false and normalized object-brace spacing across docs, ESLint config, source files (src/index.ts, src/kernel.ts), and webpack configs. Purely stylistic changes to improve consistency; no functional behavior altered.
Update webpack.config.js to include dist/kernel.js in the CopyWebpackPlugin patterns so kernel.js is copied into the final ./dist/ directory. Ensures kernel.js is present in the packaged build output.
0eb7027 to
d988d5f
Compare
|
Expand and translate inline documentation in src/kernel.ts: add Chinese TSDoc and examples, clarify lifecycle state machine, storage semantics (single-use IDataObject, path roots), client.fetch/socket/event behavior (JWT injection, open semantics), and server handler details for HTTP, WebSocket and SSE. Mostly comment, formatting and explanatory changes to make kernel APIs and examples clearer for contributors; no functional logic changes.
Add a diagnostic in src/kernel.ts to list all properties on globalThis so developers can see which global objects and built-in modules the goja engine supports. Includes a bilingual comment (Chinese/English) and a commented example output. This is intended as a discovery/debugging aid and does not change core logic.
|
@Vanessa219 |
There was a problem hiding this comment.
Pull request overview
This PR upgrades the TypeScript/webpack toolchain and adds a kernel plugin demo intended to serve as a reference implementation of the SiYuan kernel plugin API, along with build/config changes to produce and package both the app plugin and kernel plugin artifacts.
Changes:
- Added a full kernel plugin demo implementation (
src/kernel.ts) plus kernel-specific webpack build config. - Refactored build scripts/config to separate app vs kernel builds and package kernel output into
dist/. - Upgraded devDependencies and introduced
dprintformatting configuration.
Reviewed changes
Copilot reviewed 11 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
webpack.kernel.config.js |
Adds a dedicated webpack build for the kernel plugin bundle. |
webpack.config.js |
Refactors production/dev behavior and attempts to package the kernel bundle into dist/. |
tsconfig.json |
Minor JSON formatting change. |
src/kernel.ts |
Adds the kernel plugin demo/reference implementation. |
src/index.ts |
Import cleanup and formatting adjustments. |
pnpm-workspace.yaml |
Adds pnpm workspace/build-script restrictions configuration. |
pnpm-lock.yaml |
Updates lockfile for upgraded tooling dependencies. |
plugin.json |
Declares supported kernel platforms via new kernels field. |
package.json |
Adds format scripts, refactors dev/build scripts, upgrades devDependencies. |
eslint.config.mjs |
Reorders/cleans up flat config structure and formatting. |
dprint.json |
Adds dprint formatter configuration. |
docs/superpowers/specs/2026-05-09-kernel-plugin-demo-design.md |
Adds design spec for the kernel plugin demo. |
docs/superpowers/plans/2026-05-09-kernel-plugin-demo.md |
Adds an implementation plan document for the demo. |
CHANGELOG.md |
Minor markdown formatting fix. |
.gitignore |
Ignores dprint state and kernel build output. |
💡 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>
Replace shell-style parallel/serial script invocations with npm-run-all (run-p/run-s) to improve cross-platform script orchestration; add npm-run-all as a devDependency. Bump @typescript-eslint packages to 8.59.3 and adjust devDependency ordering. Update pnpm-lock.yaml to reflect the dependency changes. Remove two "Out of Scope" bullets from the spec doc and apply a small change to src/kernel.ts.
|
@Vanessa219 已修复对应的问题 |
|
这个没看明白,我打包后,kernel 如何加载,如何看输出的日志? |
这个应该是 siyuan-note/petal#50 中新增的类型不在已发布的 siyuan - npm 模块中造成的 |
在 日志为内核日志 (写入 |
|
明白了,谢谢 |
|
ts 升级导致 index.ts 有 25 个报错,下次要升级的话,需要把报错一并解决。目前已降低版本号。 |


This pull request introduces a kernel plugin demo to serve as a comprehensive TypeScript reference implementation for the SiYuan kernel plugin API. It includes a new design spec, a full implementation in
src/kernel.ts, TypeScript definition updates, significant build and configuration changes to support kernel plugins, and dependency upgrades. The changes are grouped below by theme.Kernel Plugin Demo & API Coverage
docs/superpowers/specs/2026-05-09-kernel-plugin-demo-design.md) outlining the goals, architecture, API coverage, TSDoc comment strategy, type usage, and file changes for the new kernel plugin demo, which serves as the living reference for kernel plugin development.plugin.jsonto declare supported kernel platforms under the newkernelsfield, enabling kernel plugin support for all major environments.Build System & Configuration
webpack.kernel.config.js) for building the kernel plugin, supporting both development and production modes, and outputting as an ECMAScript module.package.jsonto handle separate builds for app and kernel plugins, and updated major dev dependencies for improved compatibility and performance.webpack.config.js) to use a singleproductionflag, improved entry/output logic, and ensured consistent source map and minimization behavior. [1] [2] [3]pnpm-workspace.yamlrestrictions to disallow building native dependencies for@parcel/watcherandesbuild, improving cross-platform reliability.TypeScript & Import Cleanups
src/index.tsto useIMenuItemfrom the mainsiyuanpackage, removing a redundant import fromsiyuan/types.These changes collectively lay the foundation for robust kernel plugin development, improve build separation and reliability, and ensure the codebase is up-to-date with the latest tooling.
REL: siyuan-note/siyuan#17487