Skip to content

修复原生 ESM 导入并收紧发布验证 / Fix native ESM imports and guard release checks - #43

Merged
tiye merged 1 commit into
mainfrom
fix/esm-import-and-package-checks
Oct 26, 2026
Merged

tiye merged 1 commit into
mainfrom
fix/esm-import-and-package-checks

Conversation

@tiye

@tiye tiye commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

这次让 Calcit 项目使用的 bottom-tip 公共入口可以在 Node 原生 ESM 中直接导入,不再要求应用为 virtual-dom/create-element 加 resolver hook;同时为后续正式补丁收紧 nanoid 的最低依赖范围。HUD 的显示、关闭、自动隐藏及旧定时器取消行为不变。PR 流程不再尝试上传 Demo;这不是 npm 已发布或下游安全告警全部解除的声明。

中文

关联 #40、#42;两项均待正式发布与下游验证后收尾,不在源码合并时自动关闭。

修改

  • 公共入口的 virtual-dom/create-element 改为现有正式文件 virtual-dom/create-element.js,保持实现和公开导出不变。
  • nanoid 范围从 ^5.0.9 收紧为 ^5.1.16。Yarn 生成的 lockfile 仅改变这一 selector,已锁定版本 5.1.16、URL 与 integrity 均不变;没有强制跨 major 的 override。
  • 用 Node 原生 ESM 回归替代原先始终失败的占位 test;CI 在 Node 24、Yarn 1.22.22 下 frozen 安装,执行编译、测试、Demo 构建与包内容检查;发布前也运行相同入口测试。npm 凭据仅传给 publish 步骤。
  • 原 Demo 上传仅允许 main/master 的 push,保留原目标;PR 上跳过部署和部署状态展示。PR 创建本身不发布或部署。
  • 增加中文验证说明,测试文件不进入发布包。

验证与边界

  • 最新提交 c384bace155ea0c5562e3d1f318901e0d42ea135 的 Ubuntu CI 成功;构建/测试通过,两个部署相关步骤均为 skipped。
  • 先验证新回归在原源码下失败为 ERR_MODULE_NOT_FOUND,提示缺失 .js;修复后通过。测试不注入 window/document,也没有 resolver hook。
  • TypeScript 编译、Vite 原 Demo 构建通过;原 lockfile frozen 安装通过;git diff --check 通过。
  • 新临时消费者安装本地打包候选后,直接 import render, {renderTip} from 'bottom-tip' 成功,实际安装 nanoid 5.1.16。
  • 真实 Chromium 对原 Demo 验证 warn/error、长文本、关闭按钮、ok~ 自动隐藏、后续 warn 不被旧 ok~ 定时器关闭;没有 pageerror,也没有重复根节点。仅监听随机 127.0.0.1 端口,未访问生产。
  • 这是未发布源码候选,package 版本暂保留 0.1.5,不冒充 registry 的同名旧包。正式发布须使用新版本、最新完整审查与 CI、精确 main 验证及发布任务/registry 核实;不得重发或移动 0.1.5。
  • 合并仍会触发现有 main Demo 上传,因此本 PR 先保持开放,未经明确授权不主动合并或部署。当前没有新 npm 发布。
  • bottom-tip 的新包不能被宣称会单独解决 Vite/PostCSS 等其他依赖链的安全更新阻塞;下游须在正式包发布后重新核实,不能先删除 workaround。

English

Refs #40 and #42. Keep both open until a formal release and downstream acceptance, rather than auto-closing on source merge.

Changes

  • Use the existing explicit virtual-dom/create-element.js subpath in the public entry, preserving implementation and exports.
  • Raise nanoid's minimum range from ^5.0.9 to ^5.1.16. The Yarn-generated lockfile changes only that selector; locked version 5.1.16, URL and integrity are unchanged. No cross-major override.
  • Replace the always-failing placeholder test with a native Node ESM import regression. CI uses Node 24 and Yarn 1.22.22 for frozen installation, compilation, tests, Demo build and package-content inspection. Run the import test before publishing as well; expose npm credentials only to the publish step.
  • Limit the existing Demo upload to main/master pushes, retaining its destination. PRs skip deployment and deployment-status output; opening this PR neither publishes nor deploys.
  • Document verification in Chinese and omit test files from the published package.

Validation and boundaries

  • Ubuntu CI passes for exact HEAD c384bace155ea0c5562e3d1f318901e0d42ea135: build/tests succeed and both deployment-related steps are skipped.
  • Red/green regression: the original source fails with ERR_MODULE_NOT_FOUND for the extensionless subpath; the fix passes without browser globals or resolver hooks.
  • TypeScript compilation, original Vite Demo build, frozen installation and diff whitespace checks pass.
  • A fresh temporary consumer installs the local tarball, imports both public exports directly and resolves nanoid 5.1.16.
  • Real Chromium validates warnings/errors, long text, close, timed ok~ hiding and stale-timer cancellation after a newer warning, with no page errors or duplicate root. The server binds only a random loopback port; no production access.
  • This is an unpublished source candidate retaining the 0.1.5 version label, not the registry's existing package. Publishing requires a new version, complete latest-head review/CI, exact-main verification and workflow/registry acceptance. Do not overwrite or republish 0.1.5.
  • Merging still triggers the existing main Demo upload, so keep the PR open pending explicit authorization; no npm release or production deployment has occurred.
  • A bottom-tip patch alone does not attest fixes to independent Vite/PostCSS dependency constraints. Revalidate consumers after formal publication before retiring workarounds.

@tiye
tiye merged commit d793080 into main Oct 26, 2026
1 check passed
@tiye
tiye deleted the fix/esm-import-and-package-checks branch October 26, 2026 16:53
@tiye

tiye commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

中文

用户已明确允许合并后的 Demo 上传与 0.1.6 发布。复核最终 8 个文件及原 0.1.5 以来的源码差异:公共实现只修正 create-element.js 导入,原 HUD 行为回归通过;未将此自查冒充独立 bot 或用户的代码 review。PR 已由外部合并,精确 main CI 和 Demo 上传均成功。现仅推进纯版本提交,待其 CI 成功后发布新 annotated tag,不移动旧 tag。

English

The user explicitly authorized the post-merge Demo upload and 0.1.6 release. Rechecked the final eight files and source changes since 0.1.5: the public implementation only corrects the create-element.js import, with original HUD behavior passing. This self-review is not represented as independent bot/user code review. The PR was externally merged; exact-main CI and Demo upload succeed. Proceeding with the version-only commit, then a new annotated tag after its CI passes; existing tags remain unchanged.

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.

1 participant