Skip to content

refactor: 重构构建流程,使用 treeshake,输出 ESM 和 UMD 格式,#1617

Draft
RSS1102 wants to merge 48 commits intodevfrom
rss1102/chore/build/tree-sharking
Draft

refactor: 重构构建流程,使用 treeshake,输出 ESM 和 UMD 格式,#1617
RSS1102 wants to merge 48 commits intodevfrom
rss1102/chore/build/tree-sharking

Conversation

@RSS1102
Copy link
Collaborator

@RSS1102 RSS1102 commented Feb 1, 2026

激进优化打包

@changeset-bot
Copy link

changeset-bot bot commented Feb 1, 2026

⚠️ No Changeset found

Latest commit: 1c96dac

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 1, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/cherry-markdown@1617
npm i https://pkg.pr.new/cherry-markdown@1617
yarn add https://pkg.pr.new/cherry-markdown@1617.tgz

commit: 1c96dac

@cherry-markdown-bot
Copy link
Collaborator

cherry-markdown-bot commented Feb 1, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2026

Size Change: -2.66 MB (-35.58%) 🎉

Total Size: 4.81 MB

Filename Size Change
./packages/cherry-markdown/dist/addons/advance/cherry-table-echarts-plugin.esm.js 65.9 kB +65.9 kB (new file) 🆕
./packages/cherry-markdown/dist/addons/advance/cherry-table-echarts-plugin.js 66 kB +16.4 kB (+33.09%) 🚨
./packages/cherry-markdown/dist/addons/advance/cherry-tapd-checklist-plugin.esm.js 29.1 kB +29.1 kB (new file) 🆕
./packages/cherry-markdown/dist/addons/advance/cherry-tapd-checklist-plugin.js 29.2 kB +7.39 kB (+33.92%) 🚨
./packages/cherry-markdown/dist/addons/advance/cherry-tapd-html-tag-plugin.esm.js 28.9 kB +28.9 kB (new file) 🆕
./packages/cherry-markdown/dist/addons/advance/cherry-tapd-html-tag-plugin.js 29 kB +7.27 kB (+33.42%) 🚨
./packages/cherry-markdown/dist/addons/advance/cherry-tapd-table-plugin.esm.js 33 kB +33 kB (new file) 🆕
./packages/cherry-markdown/dist/addons/advance/cherry-tapd-table-plugin.js 33.1 kB +8.27 kB (+33.33%) 🚨
./packages/cherry-markdown/dist/addons/cherry-code-block-mermaid-plugin.esm.js 31.5 kB +31.5 kB (new file) 🆕
./packages/cherry-markdown/dist/addons/cherry-code-block-mermaid-plugin.js 31.6 kB +8.43 kB (+36.37%) 🚨
./packages/cherry-markdown/dist/addons/cherry-code-block-plantuml-plugin.esm.js 33.9 kB +33.9 kB (new file) 🆕
./packages/cherry-markdown/dist/addons/cherry-code-block-plantuml-plugin.js 34 kB +9.28 kB (+37.49%) 🚨
./packages/cherry-markdown/dist/cherry-markdown.core.common.d.ts 0 B -106 B (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.core.common.js 0 B -480 kB (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.core.esm.d.ts 106 B +106 B (new file) 🆕
./packages/cherry-markdown/dist/cherry-markdown.core.esm.js 360 kB +360 kB (new file) 🆕
./packages/cherry-markdown/dist/cherry-markdown.core.js 361 kB -119 kB (-24.84%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.css 28.4 kB -8.32 kB (-22.68%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.d.ts 78 B -23 B (-22.77%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.engine.core.common.d.ts 0 B -116 B (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.engine.core.common.js 0 B -180 kB (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.engine.core.esm.js 169 kB -11.2 kB (-6.2%)
./packages/cherry-markdown/dist/cherry-markdown.engine.core.js 169 kB -11.2 kB (-6.23%)
./packages/cherry-markdown/dist/cherry-markdown.esm.d.ts 78 B -23 B (-22.77%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.esm.js 205 kB -1.11 MB (-84.4%) 🏆
./packages/cherry-markdown/dist/cherry-markdown.js 1.31 MB -769 kB (-37.08%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.markdown.css 13.9 kB -6.35 kB (-31.3%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.markdown.min.css 0 B -13.9 kB (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.min.css 0 B -28.4 kB (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.min.d.ts 0 B -101 B (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.min.js 0 B -1.32 MB (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.stream.common.d.ts 0 B -113 B (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.stream.common.js 0 B -290 kB (removed) 🏆
./packages/cherry-markdown/dist/cherry-markdown.stream.d.ts 89 B -24 B (-21.24%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.stream.esm.d.ts 89 B -24 B (-21.24%) 🎉
./packages/cherry-markdown/dist/cherry-markdown.stream.esm.js 262 kB -27 kB (-9.34%)
./packages/cherry-markdown/dist/cherry-markdown.stream.js 262 kB -27.2 kB (-9.4%)
./packages/cherry-markdown/dist/types/Cherry.config.d.ts 122 B +5 B (+4.27%)
./packages/cherry-markdown/dist/types/Cherry.d.ts 4.42 kB +4 B (+0.09%)
./packages/cherry-markdown/dist/types/CherryStream.d.ts 2.93 kB +2.93 kB (new file) 🆕
./packages/cherry-markdown/dist/types/core/HookCenter.d.ts 816 B -2 B (-0.24%)
./packages/cherry-markdown/dist/types/core/hooks/Strikethrough.d.ts 240 B +5 B (+2.13%)
./packages/cherry-markdown/dist/types/core/SyntaxBase.d.ts 955 B +4 B (+0.42%)
./packages/cherry-markdown/dist/types/Editor.d.ts 1.68 kB +5 B (+0.3%)
./packages/cherry-markdown/dist/types/index.d.ts 70 B -6 B (-7.89%)
./packages/cherry-markdown/dist/types/index.engine.core.d.ts 376 B +3 B (+0.8%)
./packages/cherry-markdown/dist/types/index.stream.d.ts 69 B +69 B (new file) 🆕
./packages/cherry-markdown/dist/types/Previewer.d.ts 2.27 kB +3 B (+0.13%)
./packages/cherry-markdown/dist/types/toolbars/HookCenter.d.ts 508 B +3 B (+0.59%)
./packages/cherry-markdown/dist/types/toolbars/MenuBase.d.ts 2.58 kB +7 B (+0.27%)
./packages/cherry-markdown/dist/types/toolbars/ShortcutKeyConfigPanel.d.ts 1.36 kB +6 B (+0.44%)
./packages/cherry-markdown/dist/vendor-Ci81SK9S.esm.js 790 kB +790 kB (new file) 🆕
./packages/cherry-markdown/dist/vendor-codemirror-N-gyoVFZ.esm.js 107 kB +107 kB (new file) 🆕
./packages/cherry-markdown/dist/vendor-mermaid-Nkx4oVYS.esm.js 195 kB +195 kB (new file) 🆕
./packages/cherry-markdown/dist/vendor-prism-BWtqAyL6.esm.js 6.24 kB +6.24 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
./packages/cherry-markdown/dist/cherry-markdown.core.d.ts 106 B
./packages/cherry-markdown/dist/cherry-markdown.engine.core.d.ts 116 B
./packages/cherry-markdown/dist/cherry-markdown.engine.core.esm.d.ts 116 B
./packages/cherry-markdown/dist/types/addons/advance/cherry-table-echarts-plugin.d.ts 1.73 kB
./packages/cherry-markdown/dist/types/addons/advance/cherry-tapd-checklist-plugin.d.ts 323 B
./packages/cherry-markdown/dist/types/addons/advance/cherry-tapd-html-tag-plugin.d.ts 494 B
./packages/cherry-markdown/dist/types/addons/advance/cherry-tapd-table-plugin.d.ts 1.15 kB
./packages/cherry-markdown/dist/types/addons/cherry-code-block-mermaid-plugin.d.ts 1.37 kB
./packages/cherry-markdown/dist/types/addons/cherry-code-block-plantuml-plugin.d.ts 160 B
./packages/cherry-markdown/dist/types/CherryStatic.d.ts 509 B
./packages/cherry-markdown/dist/types/core/hooks/AiFlowAutoClose.d.ts 370 B
./packages/cherry-markdown/dist/types/core/hooks/AutoLink.d.ts 948 B
./packages/cherry-markdown/dist/types/core/hooks/BackgroundColor.d.ts 189 B
./packages/cherry-markdown/dist/types/core/hooks/Blockquote.d.ts 195 B
./packages/cherry-markdown/dist/types/core/hooks/Br.d.ts 193 B
./packages/cherry-markdown/dist/types/core/hooks/CodeBlock.d.ts 1.31 kB
./packages/cherry-markdown/dist/types/core/hooks/Color.d.ts 183 B
./packages/cherry-markdown/dist/types/core/hooks/CommentReference.d.ts 665 B
./packages/cherry-markdown/dist/types/core/hooks/Detail.d.ts 328 B
./packages/cherry-markdown/dist/types/core/hooks/Emoji.config.d.ts 9.31 kB
./packages/cherry-markdown/dist/types/core/hooks/Emoji.d.ts 9.36 kB
./packages/cherry-markdown/dist/types/core/hooks/Emphasis.d.ts 263 B
./packages/cherry-markdown/dist/types/core/hooks/Footnote.d.ts 307 B
./packages/cherry-markdown/dist/types/core/hooks/FrontMatter.d.ts 192 B
./packages/cherry-markdown/dist/types/core/hooks/Header.d.ts 605 B
./packages/cherry-markdown/dist/types/core/hooks/HighLight.d.ts 158 B
./packages/cherry-markdown/dist/types/core/hooks/Hr.d.ts 223 B
./packages/cherry-markdown/dist/types/core/hooks/HtmlBlock.d.ts 313 B
./packages/cherry-markdown/dist/types/core/hooks/Image.d.ts 325 B
./packages/cherry-markdown/dist/types/core/hooks/InlineCode.d.ts 181 B
./packages/cherry-markdown/dist/types/core/hooks/InlineMath.d.ts 487 B
./packages/cherry-markdown/dist/types/core/hooks/Link.d.ts 583 B
./packages/cherry-markdown/dist/types/core/hooks/List.d.ts 347 B
./packages/cherry-markdown/dist/types/core/hooks/MathBlock.d.ts 451 B
./packages/cherry-markdown/dist/types/core/hooks/Panel.d.ts 435 B
./packages/cherry-markdown/dist/types/core/hooks/Paragraph.d.ts 664 B
./packages/cherry-markdown/dist/types/core/hooks/Ruby.d.ts 154 B
./packages/cherry-markdown/dist/types/core/hooks/Size.d.ts 177 B
./packages/cherry-markdown/dist/types/core/hooks/Space.d.ts 199 B
./packages/cherry-markdown/dist/types/core/hooks/Sub.d.ts 180 B
./packages/cherry-markdown/dist/types/core/hooks/Suggester.d.ts 1.72 kB
./packages/cherry-markdown/dist/types/core/hooks/SuggestList.d.ts 158 B
./packages/cherry-markdown/dist/types/core/hooks/Sup.d.ts 180 B
./packages/cherry-markdown/dist/types/core/hooks/Table.d.ts 554 B
./packages/cherry-markdown/dist/types/core/hooks/Toc.d.ts 974 B
./packages/cherry-markdown/dist/types/core/hooks/Transfer.d.ts 176 B
./packages/cherry-markdown/dist/types/core/hooks/Underline.d.ts 157 B
./packages/cherry-markdown/dist/types/core/HooksConfig.d.ts 524 B
./packages/cherry-markdown/dist/types/core/ParagraphBase.d.ts 1.18 kB
./packages/cherry-markdown/dist/types/Engine.d.ts 1.47 kB
./packages/cherry-markdown/dist/types/Event.d.ts 531 B
./packages/cherry-markdown/dist/types/Factory.d.ts 972 B
./packages/cherry-markdown/dist/types/index.core.d.ts 122 B
./packages/cherry-markdown/dist/types/index.engine.d.ts 87 B
./packages/cherry-markdown/dist/types/libs/rawdeflate.d.ts 87 B
./packages/cherry-markdown/dist/types/locales/en_US.d.ts 1.05 kB
./packages/cherry-markdown/dist/types/locales/index.d.ts 141 B
./packages/cherry-markdown/dist/types/locales/ru_RU.d.ts 1.05 kB
./packages/cherry-markdown/dist/types/locales/zh_CN.d.ts 1.06 kB
./packages/cherry-markdown/dist/types/Logger.d.ts 441 B
./packages/cherry-markdown/dist/types/Sanitizer.d.ts 85 B
./packages/cherry-markdown/dist/types/toolbars/Bubble.d.ts 657 B
./packages/cherry-markdown/dist/types/toolbars/BubbleFormula.d.ts 1.38 kB
./packages/cherry-markdown/dist/types/toolbars/BubbleTable.d.ts 329 B
./packages/cherry-markdown/dist/types/toolbars/FloatMenu.d.ts 577 B
./packages/cherry-markdown/dist/types/toolbars/HiddenToolbar.d.ts 226 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Align.d.ts 191 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Audio.d.ts 322 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Bold.d.ts 455 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Br.d.ts 318 B
./packages/cherry-markdown/dist/types/toolbars/hooks/ChangeLocale.d.ts 252 B
./packages/cherry-markdown/dist/types/toolbars/hooks/CheckList.d.ts 353 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Code.d.ts 398 B
./packages/cherry-markdown/dist/types/toolbars/hooks/CodeTheme.d.ts 451 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Color.d.ts 2.11 kB
./packages/cherry-markdown/dist/types/toolbars/hooks/Copy.d.ts 697 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Detail.d.ts 324 B
./packages/cherry-markdown/dist/types/toolbars/hooks/DrawIo.d.ts 421 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Export.d.ts 195 B
./packages/cherry-markdown/dist/types/toolbars/hooks/File.d.ts 319 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Formula.d.ts 459 B
./packages/cherry-markdown/dist/types/toolbars/hooks/FullScreen.d.ts 206 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Graph.d.ts 736 B
./packages/cherry-markdown/dist/types/toolbars/hooks/H1.d.ts 390 B
./packages/cherry-markdown/dist/types/toolbars/hooks/H2.d.ts 391 B
./packages/cherry-markdown/dist/types/toolbars/hooks/H3.d.ts 391 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Header.d.ts 505 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Hr.d.ts 322 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Image.d.ts 345 B
./packages/cherry-markdown/dist/types/toolbars/hooks/InlineCode.d.ts 429 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Insert.d.ts 473 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Italic.d.ts 464 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Justify.d.ts 163 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Link.d.ts 347 B
./packages/cherry-markdown/dist/types/toolbars/hooks/List.d.ts 486 B
./packages/cherry-markdown/dist/types/toolbars/hooks/MobilePreview.d.ts 316 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Ol.d.ts 349 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Panel.d.ts 475 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Pdf.d.ts 318 B
./packages/cherry-markdown/dist/types/toolbars/hooks/ProTable.d.ts 561 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Publish.d.ts 388 B
./packages/cherry-markdown/dist/types/toolbars/hooks/QuickTable.d.ts 441 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Quote.d.ts 245 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Redo.d.ts 268 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Ruby.d.ts 447 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Search.d.ts 369 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Settings.d.ts 752 B
./packages/cherry-markdown/dist/types/toolbars/hooks/ShortcutKey.d.ts 442 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Size.d.ts 301 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Split.d.ts 319 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Strikethrough.d.ts 404 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Sub.d.ts 372 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Sup.d.ts 372 B
./packages/cherry-markdown/dist/types/toolbars/hooks/SwitchModel.d.ts 285 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Table.d.ts 364 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Theme.d.ts 465 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Toc.d.ts 320 B
./packages/cherry-markdown/dist/types/toolbars/hooks/TogglePreview.d.ts 340 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Ul.d.ts 350 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Underline.d.ts 404 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Undo.d.ts 245 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Video.d.ts 322 B
./packages/cherry-markdown/dist/types/toolbars/hooks/Word.d.ts 318 B
./packages/cherry-markdown/dist/types/toolbars/hooks/WordCount.d.ts 463 B
./packages/cherry-markdown/dist/types/toolbars/PreviewerBubble.d.ts 2.03 kB
./packages/cherry-markdown/dist/types/toolbars/Sidebar.d.ts 224 B
./packages/cherry-markdown/dist/types/toolbars/Toc.d.ts 369 B
./packages/cherry-markdown/dist/types/toolbars/Toolbar.d.ts 2.28 kB
./packages/cherry-markdown/dist/types/toolbars/ToolbarRight.d.ts 156 B
./packages/cherry-markdown/dist/types/UrlCache.d.ts 529 B
./packages/cherry-markdown/dist/types/utils/async-render-handler.d.ts 344 B
./packages/cherry-markdown/dist/types/utils/autoindent.d.ts 450 B
./packages/cherry-markdown/dist/types/utils/cm-search-replace.d.ts 1.52 kB
./packages/cherry-markdown/dist/types/utils/code-preview-language-setting.d.ts 169 B
./packages/cherry-markdown/dist/types/utils/codeBlockContentHandler.d.ts 951 B
./packages/cherry-markdown/dist/types/utils/color.d.ts 205 B
./packages/cherry-markdown/dist/types/utils/config.d.ts 984 B
./packages/cherry-markdown/dist/types/utils/copy.d.ts 577 B
./packages/cherry-markdown/dist/types/utils/dialog.d.ts 195 B
./packages/cherry-markdown/dist/types/utils/dom.d.ts 650 B
./packages/cherry-markdown/dist/types/utils/downloadUtil.d.ts 426 B
./packages/cherry-markdown/dist/types/utils/env.d.ts 482 B
./packages/cherry-markdown/dist/types/utils/error.d.ts 185 B
./packages/cherry-markdown/dist/types/utils/event.d.ts 440 B
./packages/cherry-markdown/dist/types/utils/export.d.ts 351 B
./packages/cherry-markdown/dist/types/utils/exportWord.d.ts 424 B
./packages/cherry-markdown/dist/types/utils/file.d.ts 848 B
./packages/cherry-markdown/dist/types/utils/footnoteHoverHandler.d.ts 889 B
./packages/cherry-markdown/dist/types/utils/formulaUtilsHandler.d.ts 531 B
./packages/cherry-markdown/dist/types/utils/htmlparser.d.ts 1.67 kB
./packages/cherry-markdown/dist/types/utils/image.d.ts 454 B
./packages/cherry-markdown/dist/types/utils/imgSizeHandler.d.ts 969 B
./packages/cherry-markdown/dist/types/utils/imgToolHandler.d.ts 332 B
./packages/cherry-markdown/dist/types/utils/lazyLoadImg.d.ts 2.57 kB
./packages/cherry-markdown/dist/types/utils/lineFeed.d.ts 720 B
./packages/cherry-markdown/dist/types/utils/listContentHandler.d.ts 645 B
./packages/cherry-markdown/dist/types/utils/lookbehind-replace.d.ts 381 B
./packages/cherry-markdown/dist/types/utils/LRUCache.d.ts 554 B
./packages/cherry-markdown/dist/types/utils/mathjax.d.ts 218 B
./packages/cherry-markdown/dist/types/utils/myersDiff.d.ts 431 B
./packages/cherry-markdown/dist/types/utils/pasteHelper.d.ts 757 B
./packages/cherry-markdown/dist/types/utils/platformTransform.d.ts 151 B
./packages/cherry-markdown/dist/types/utils/recount-pos.d.ts 259 B
./packages/cherry-markdown/dist/types/utils/regexp.d.ts 1.57 kB
./packages/cherry-markdown/dist/types/utils/sanitize.d.ts 423 B
./packages/cherry-markdown/dist/types/utils/selection.d.ts 723 B
./packages/cherry-markdown/dist/types/utils/shortcutKey.d.ts 539 B
./packages/cherry-markdown/dist/types/utils/svgUtils.d.ts 650 B
./packages/cherry-markdown/dist/types/utils/tableContentHandler.d.ts 3.24 kB

compressed-size-action

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本 PR 旨在重构 cherry-markdown 的构建流程:通过并行构建 addons、统一压缩配置,并输出 ESM/UMD 产物,同时调整类型声明生成与文档示例以适配新的分发形态。

Changes:

  • 重构 Rollup 构建:拆分为 full/core/engine/stream 多入口的 UMD+ESM 输出,并引入共享 terser 配置与更多 treeshake/性能选项
  • addons 构建改为并行,并新增 stream 专用 HooksConfig 与构建期拦截/剔除 codemirror 相关导入
  • 调整 types 生成/路径替换脚本与 README 文档示例

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
yarn.lock 新增/更新构建相关依赖锁定(含 Babel 插件、cherry-markdown 条目)
scripts/post-build.ts 构建后将 dist 拷贝到 VSCode 插件资源目录并增加日志
packages/cherry-markdown/tsconfig.json 调整 JS 检查与类型声明生成输入/排除项
packages/cherry-markdown/tsconfig.addons.json 调整 addons 的声明生成配置(emitDeclarationOnly/outDir/paths 等)
packages/cherry-markdown/src/index.stream.js stream 入口改为直接导出 CherryStream
packages/cherry-markdown/src/index.stream.core.js 删除旧的 stream core 入口
packages/cherry-markdown/src/index.js 完整版入口初始化 mermaid 插件并仅默认导出
packages/cherry-markdown/src/core/hooks/CodeBlock.js 调整 Prism 引入方式与语言组件加载
packages/cherry-markdown/src/core/HooksConfig.stream.js 新增 stream 专用 hooks 配置(移除编辑器相关 hook)
packages/cherry-markdown/src/core/HooksConfig.js 轻微整理(空行)
packages/cherry-markdown/src/UrlCache.js CryptoJS 引入方式调整
packages/cherry-markdown/src/Sanitizer.node.js Node 环境 sanitizer 创建方式注释与微调
packages/cherry-markdown/src/Engine.js CryptoJS 引入方式调整
packages/cherry-markdown/package.json 调整 main/style/exports、构建脚本与新增 Babel 插件依赖
packages/cherry-markdown/build/terser.config.js 新增共享 terser 插件配置封装
packages/cherry-markdown/build/rollup.styles.config.js 样式构建改为仅输出压缩版并过滤部分警告
packages/cherry-markdown/build/rollup.stream.config.js stream 构建:拦截 HooksConfig、剔除 PreviewerBubble、外部化 codemirror 等
packages/cherry-markdown/build/rollup.engine.config.js engine 构建输出 UMD+ESM,并复用共享 terser 配置
packages/cherry-markdown/build/rollup.core.config.js core 构建输出 UMD+ESM,并复用共享 terser 配置
packages/cherry-markdown/build/rollup.base.config.js base 配置:treeshake 策略、commonjs/babel 选项与 dist-types 生成逻辑调整
packages/cherry-markdown/build/replacePaths.js replacePaths 脚本改为 ESM 并扩展替换规则
packages/cherry-markdown/build/replacePaths.cjs 删除旧 CJS replacePaths 脚本
packages/cherry-markdown/build/build.js full 构建输出 UMD+ESM(ESM 支持拆分)并复用共享 terser
packages/cherry-markdown/build/addons.build.js addons 构建改为并行并输出 UMD/ESM
packages/cherry-markdown/build/addons.build.cjs 删除旧 CJS addons 构建脚本
packages/cherry-markdown/babel.config.mjs 新增 optional-catch-binding Babel 插件
README.md 更新 UMD/ESM/Node/stream/core/engine 的使用示例
README.CN.md 同步更新中文文档使用示例
.husky/commit-msg commit-msg 钩子改用 npx 执行 commitlint
Comments suppressed due to low confidence (1)

packages/cherry-markdown/build/rollup.base.config.js:35

  • The conditional alias for @/Sanitizer -> src/Sanitizer.node.js was removed, but src/Sanitizer.js references window at module load time. This makes Node/SSR usage (e.g. engine build) crash with ReferenceError: window is not defined. Reintroduce a Node-targeted alias (per build target) or make the sanitizer module environment-safe (lazy init / conditional import).
const aliasPluginOptions = {
  entries: [
    {
      find: '@',
      replacement: path.resolve(PROJECT_ROOT_PATH, 'src'),

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 20 to 27
const basePlugins = [
baseConfig.plugins.find((p) => p.name === 'json'),
baseConfig.plugins.find((p) => p.name === 'replace'),
baseConfig.plugins.find((p) => p.name === 'alias'),
baseConfig.plugins.find((p) => p.name === 'resolve'),
baseConfig.plugins.find((p) => p.name === 'commonjs'),
baseConfig.plugins.find((p) => p.name === 'babel'),
baseConfig.plugins.find((p) => p.name === 'dist-types'),
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baseConfig.plugins.find((p) => p.name === 'resolve') will not find the node-resolve plugin (its name is typically node-resolve), so the config can end up missing module resolution entirely and fail to bundle dependencies. Update the lookup to node-resolve (or import/configure @rollup/plugin-node-resolve directly here) and consider asserting the plugin was found to fail fast.

Suggested change
const basePlugins = [
baseConfig.plugins.find((p) => p.name === 'json'),
baseConfig.plugins.find((p) => p.name === 'replace'),
baseConfig.plugins.find((p) => p.name === 'alias'),
baseConfig.plugins.find((p) => p.name === 'resolve'),
baseConfig.plugins.find((p) => p.name === 'commonjs'),
baseConfig.plugins.find((p) => p.name === 'babel'),
baseConfig.plugins.find((p) => p.name === 'dist-types'),
const resolvePlugin = baseConfig.plugins.find((p) => p && p.name === 'node-resolve');
if (!resolvePlugin) {
throw new Error(
'Expected Rollup node-resolve plugin with name "node-resolve" in baseConfig.plugins but none was found.'
);
}
const basePlugins = [
baseConfig.plugins.find((p) => p && p.name === 'json'),
baseConfig.plugins.find((p) => p && p.name === 'replace'),
baseConfig.plugins.find((p) => p && p.name === 'alias'),
resolvePlugin,
baseConfig.plugins.find((p) => p && p.name === 'commonjs'),
baseConfig.plugins.find((p) => p && p.name === 'babel'),
baseConfig.plugins.find((p) => p && p.name === 'dist-types'),

Copilot uses AI. Check for mistakes.
Comment on lines 189 to 193
```javascript
import 'cherry-markdown/dist/cherry-markdown.css';
import Cherry from 'cherry-markdown/dist/cherry-markdown.core';
const cherryInstance = new Cherry({
import { core as CherryCore } from 'cherry-markdown';
const cherryInstance = new CherryCore({
id: 'markdown-container',
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs use import { core as CherryCore } from 'cherry-markdown', but there is no core named export from the package root (the core build is a separate entrypoint). Either add core/engine/stream named exports at the root (and update exports + typings), or revert these examples to the existing dist/cherry-markdown.core* / dist/cherry-markdown.engine* subpath imports.

Copilot uses AI. Check for mistakes.
Comment on lines +169 to +170
import { stream } from 'cherry-markdown';
const cherryInstance = new stream({
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These examples use import { stream } from 'cherry-markdown' / new stream(...), but the package root entry does not export a named stream today. Please either export stream (and keep exports/typings in sync) or update the docs to use the supported stream build subpath import.

Suggested change
import { stream } from 'cherry-markdown';
const cherryInstance = new stream({
import CherryMarkdownStream from 'cherry-markdown/dist/stream';
const cherryInstance = new CherryMarkdownStream({

Copilot uses AI. Check for mistakes.
import 'cherry-markdown/dist/cherry-markdown.css';
import Cherry from 'cherry-markdown/dist/cherry-markdown.core';
const cherryInstance = new Cherry({
import { core as CherryCore } from 'cherry-markdown';
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs use import { core as CherryCore } from 'cherry-markdown', but the root entry doesn’t currently export core. Align documentation with the published API (or add root-level core/engine/stream exports + typings so these snippets actually work).

Suggested change
import { core as CherryCore } from 'cherry-markdown';
import CherryCore from 'cherry-markdown/dist/cherry-markdown.core';

Copilot uses AI. Check for mistakes.
"build:addons": "node build/addons.build.js",
"build:types": "tsc --project tsconfig.json && node build/replacePaths.js",
"build:styles": "cross-env NODE_ENV=production rollup --config build/rollup.styles.config.js",
"verify:stream": "node scripts/verify-stream-config.js",
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify:stream points to scripts/verify-stream-config.js, but there is no packages/cherry-markdown/scripts directory (and no such file in the repo). This script will fail when invoked; either add the script or remove/rename the entry.

Copilot uses AI. Check for mistakes.
Comment on lines +179 to 181
const { engine: CherryEngine } = require('cherry-markdown');
const cherryEngineInstance = new CherryEngine();
const htmlContent = cherryEngineInstance.makeHtml('# welcome to cherry editor!');
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Node example uses require('cherry-markdown') and expects an engine export, but the package is ESM (type: module) and currently doesn’t expose an engine named export from the root. Please update the example to match the actual entrypoints, or add proper exports (including a real CJS target if require() is supported).

Suggested change
const { engine: CherryEngine } = require('cherry-markdown');
const cherryEngineInstance = new CherryEngine();
const htmlContent = cherryEngineInstance.makeHtml('# welcome to cherry editor!');
import Cherry from 'cherry-markdown';
const cherryInstance = new Cherry();
const htmlContent = cherryInstance.makeHtml('# welcome to cherry editor!');

Copilot uses AI. Check for mistakes.
@RSS1102 RSS1102 changed the title refactor: 重构构建流程,支持并行构建插件,输出 ESM 和 UMD 格式,优化类型声明生成 refactor: 重构构建流程,使用 treeshake,输出 ESM 和 UMD 格式, Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants