@mzzsfy/dsh-toast 0.2.2 → 0.2.4

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.
package/README.md CHANGED
@@ -63,3 +63,7 @@ toast('回合完成', { holdMs: 6 * 1000 }) // 自定义展示期
63
63
  - 样式全部取宿主 `--dsw-*` 令牌且带就近 fallback(宿主升级更名令牌时降级为可用默认形态,不静默失效);样式挂宿主文档级、幂等且内容变化原位替换,容器在场时随每次挂载自愈
64
64
  - store 位于模块闭包单例;渲染容器惰性自举、幂等、自愈(旧 root 卸载后重建),容器带代际标记防 HMR 两代互拆;不依赖宿主生命周期
65
65
  - react / react-dom/client 由宿主平台模块表提供,peerDependencies 声明 react 与 react-dom
66
+
67
+ ## dsh 版本兼容
68
+
69
+ 公共依赖包,由消费方(dsh-cron-board 等)代挂装载,三版本(0.1.2-rc.1 / 0.1.5-rc.3 / 0.1.7-rc.1)装载层均正常,无独立激活单元;turn-notify/usage-panel 等消费方的通知面已在各自兼容断言中覆盖。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mzzsfy/dsh-toast",
3
3
  "description": "全局浮出通知 Toast 库:多条并存栈式展示,自动消失与常驻确认两种生命周期;普通 npm 依赖(非 dsh 插件),由消费插件的 cordis.patch.yml 代挂宿主占位条目",
4
- "version": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "exports": {
@@ -0,0 +1,51 @@
1
+ // 公共依赖包形态守卫:本包不声明 dsh.bundle.patch、不自带 cordis.patch.yml、
2
+ // 不进 profile 表层 manifest 依赖行与装载层。表层 dependencies 行是插件市场
3
+ // 「已安装」列表的唯一数据源(全量展示,仅过滤官方内盒),本包一旦被显式
4
+ // add 写入表层行,市场即把它当插件展示——该现象曾出现并已修复(表层数行
5
+ // 由 dev-link 对公共依赖包一律删除),此测试把约束固化为机器断言防回归。
6
+ // 规约见 DEVELOPMENT/client-dependency.md 与 DEVELOPMENT/profile-link.md 第 4 条,
7
+ // 机制推导见本包 MECHANISM.md。
8
+ import test from 'node:test'
9
+ import assert from 'node:assert/strict'
10
+ import { existsSync, readFileSync } from 'node:fs'
11
+ import { fileURLToPath } from 'node:url'
12
+ import { dirname, join } from 'node:path'
13
+ import { homedir } from 'node:os'
14
+
15
+ const PKG_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
16
+ const PKG_NAME = '@mzzsfy/dsh-toast'
17
+ // profile 路径与 scripts/dev-link.mjs 同构;不存在(如 CI)时终态用例跳过
18
+ const PROFILE_MANIFEST = join(homedir(), '.dsh', 'profiles', 'web', 'package.json')
19
+
20
+ test('package.json 不声明 dsh.bundle.patch,维持公共依赖包身份', () => {
21
+ const manifest = JSON.parse(readFileSync(join(PKG_ROOT, 'package.json'), 'utf8'))
22
+ assert.equal(
23
+ manifest.dsh?.bundle?.patch, undefined,
24
+ '声明 dsh.bundle.patch 即成为插件包:官方 reconcile 会将其入 dsh.profile.bundles,dev-link 也失去删表层行的依据',
25
+ )
26
+ })
27
+
28
+ test('不自带 cordis.patch.yml,装载靠消费方代挂占位', () => {
29
+ assert.equal(
30
+ existsSync(join(PKG_ROOT, 'cordis.patch.yml')), false,
31
+ '公共依赖包禁止自带 patch;client 进入模块表由消费插件 cordis.patch.yml 代挂占位条目承载',
32
+ )
33
+ })
34
+
35
+ test('profile 表层 dependencies 无本包行,市场已装列表不可见', (t) => {
36
+ if (!existsSync(PROFILE_MANIFEST)) return t.skip('本机无 profile,终态由 dev-link 维护')
37
+ const manifest = JSON.parse(readFileSync(PROFILE_MANIFEST, 'utf8').replace(/^\uFEFF/, ''))
38
+ assert.equal(
39
+ manifest.dependencies?.[PKG_NAME], undefined,
40
+ '表层依赖行存在即市场已装列表展示本包;安装由消费方 dependencies 声明承载,表层行一律删除',
41
+ )
42
+ })
43
+
44
+ test('profile dsh.profile.bundles 无本包,不进宿主装载层', (t) => {
45
+ if (!existsSync(PROFILE_MANIFEST)) return t.skip('本机无 profile,终态由 dev-link 维护')
46
+ const manifest = JSON.parse(readFileSync(PROFILE_MANIFEST, 'utf8').replace(/^\uFEFF/, ''))
47
+ assert.equal(
48
+ manifest.dsh?.profile?.bundles?.includes(PKG_NAME), false,
49
+ '公共依赖包无宿主半区可载,入装载层即「装而不载」的伪插件形态',
50
+ )
51
+ })