reactive-md 0.3.0 → 0.4.0
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/CHANGELOG-ch.md +96 -0
- package/CHANGELOG.md +96 -40
- package/CONTRIBUTING-ch.md +62 -0
- package/CONTRIBUTING.md +64 -61
- package/README-ch.md +122 -0
- package/README-en.md +146 -0
- package/README.md +146 -88
- package/SECURITY-ch.md +80 -0
- package/SECURITY.md +80 -68
- package/THIRD_PARTY_NOTICES.md +85 -1
- package/bin/reactive-md.mjs +40 -0
- package/cli/args.mjs +181 -0
- package/cli/assets.mjs +390 -0
- package/cli/build.mjs +268 -0
- package/cli/document.mjs +130 -0
- package/cli/errors.mjs +61 -0
- package/cli/fs-utils.mjs +133 -0
- package/cli/glob.mjs +203 -0
- package/cli/help.mjs +138 -0
- package/cli/lint.mjs +177 -0
- package/cli/main.mjs +55 -0
- package/cli/migrate.mjs +368 -0
- package/cli/package.mjs +209 -0
- package/dist-library/reactive-md-react.js +3603 -1690
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +1798 -4
- package/dist-library/runtime-DtjdPXxJ.js +15410 -0
- package/dist-library/types/index.d.ts +1 -0
- package/dist-library/types/local/LocalDocumentView.d.ts +66 -3
- package/dist-library/types/local/authoring.d.ts +63 -0
- package/dist-library/types/local/collection-functions.d.ts +4 -0
- package/dist-library/types/local/colors.d.ts +2 -0
- package/dist-library/types/local/compiler.d.ts +3 -3
- package/dist-library/types/local/computations.d.ts +53 -0
- package/dist-library/types/local/data-functions.d.ts +22 -0
- package/dist-library/types/local/data-table.d.ts +65 -0
- package/dist-library/types/local/dates.d.ts +2 -0
- package/dist-library/types/local/dependencies.d.ts +31 -0
- package/dist-library/types/local/diagnostics.d.ts +1450 -0
- package/dist-library/types/local/expression.d.ts +13 -3
- package/dist-library/types/local/formatting.d.ts +41 -0
- package/dist-library/types/local/heading-anchors.d.ts +17 -0
- package/dist-library/types/local/i18n.d.ts +18 -0
- package/dist-library/types/local/index.d.ts +18 -1
- package/dist-library/types/local/limits.d.ts +33 -1
- package/dist-library/types/local/locale.d.ts +1 -0
- package/dist-library/types/local/math.d.ts +6 -1
- package/dist-library/types/local/parser.d.ts +10 -4
- package/dist-library/types/local/render-types.d.ts +5 -1
- package/dist-library/types/local/retention.d.ts +23 -0
- package/dist-library/types/local/schema.d.ts +25 -3
- package/dist-library/types/local/source-migration.d.ts +35 -0
- package/dist-library/types/local/state.d.ts +80 -0
- package/dist-library/types/local/text-length.d.ts +13 -0
- package/dist-library/types/local/theme.d.ts +30 -0
- package/dist-library/types/local/types.d.ts +120 -4
- package/dist-library/types/local/validation.d.ts +32 -0
- package/dist-library/types/local/version.d.ts +1 -1
- package/dist-library/types/local/worker.d.ts +82 -0
- package/dist-library/types/react/index.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +64 -0
- package/dist-standalone/reactive-md-standalone.css +2 -0
- package/dist-standalone/reactive-md-standalone.js +57 -0
- package/docs/author-tools-ch.md +56 -0
- package/docs/author-tools-en.md +56 -0
- package/docs/compatibility-ch.md +103 -0
- package/docs/compatibility-en.md +103 -0
- package/docs/component-development-ch.md +210 -0
- package/docs/component-development-en.md +210 -0
- package/docs/component-protocol-ch.md +710 -0
- package/docs/component-protocol-en.md +710 -0
- package/docs/computations-formatting-ch.md +87 -0
- package/docs/computations-formatting-en.md +87 -0
- package/docs/constraints-collections-ch.md +84 -0
- package/docs/constraints-collections-en.md +84 -0
- package/docs/diagnostics-counting-ch.md +84 -0
- package/docs/diagnostics-counting-en.md +84 -0
- package/docs/local-components-v2-ch.md +138 -0
- package/docs/local-components-v2-en.md +104 -0
- package/docs/{local-guide.md → local-guide-ch.md} +961 -936
- package/docs/local-guide-en.md +961 -0
- package/docs/local-integration-ch.md +363 -0
- package/docs/local-integration-en.md +363 -0
- package/docs/{local-interaction-syntax.md → local-interaction-syntax-ch.md} +485 -437
- package/docs/local-interaction-syntax-en.md +483 -0
- package/docs/performance-ch.md +76 -0
- package/docs/performance-en.md +76 -0
- package/docs/release-0.4.0-ch.md +89 -0
- package/docs/release-0.4.0-en.md +89 -0
- package/docs/releasing-ch.md +101 -0
- package/docs/releasing-en.md +101 -0
- package/docs/shareable-export-ch.md +205 -0
- package/docs/shareable-export-en.md +207 -0
- package/docs/source-versioning-ch.md +159 -0
- package/docs/source-versioning-en.md +159 -0
- package/docs/theme-protocol-ch.md +107 -0
- package/docs/theme-protocol-en.md +107 -0
- package/examples/conformance/README.md +53 -11
- package/examples/conformance/component-protocol-1.json +482 -0
- package/examples/conformance/component-protocol-1.schema.json +76 -0
- package/examples/conformance/history/v0.3.1/catalog.reactive.md +20 -0
- package/examples/conformance/history/v0.3.1/charts.reactive.md +73 -0
- package/examples/conformance/history/v0.3.1/checklist.reactive.md +32 -0
- package/examples/conformance/history/v0.3.1/comparison.reactive.md +47 -0
- package/examples/conformance/history/v0.3.1/components.reactive.md +44 -0
- package/examples/conformance/history/v0.3.1/counter.reactive.md +7 -0
- package/examples/conformance/history/v0.3.1/diagnostics.reactive.md +54 -0
- package/examples/conformance/history/v0.3.1/diagram.reactive.md +44 -0
- package/examples/conformance/history/v0.3.1/gallery.reactive.md +61 -0
- package/examples/conformance/history/v0.3.1/local-draft-1.json +50 -0
- package/examples/conformance/history/v0.3.1/parameters.reactive.md +36 -0
- package/examples/conformance/history/v0.3.1/planning.reactive.md +24 -0
- package/examples/conformance/history/v0.3.1/pricing.reactive.md +20 -0
- package/examples/conformance/history/v0.3.1/provenance.json +72 -0
- package/examples/conformance/local-draft-1.json +50 -49
- package/examples/conformance/local-draft-2.json +212 -0
- package/examples/integration/README.md +45 -29
- package/examples/integration/core/index.mjs +32 -19
- package/examples/integration/react/index.html +1 -1
- package/examples/integration/react/main.jsx +5 -5
- package/examples/integration/worker/index.html +19 -0
- package/examples/integration/worker/main.js +61 -0
- package/examples/integration/worker/package.json +13 -0
- package/examples/integration/worker/worker.js +3 -0
- package/examples/local/README.md +72 -66
- package/examples/local/catalog.reactive.md +14 -14
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/checklist.reactive.md +19 -19
- package/examples/local/comparison.reactive.md +23 -23
- package/examples/local/components.reactive.md +20 -20
- package/examples/local/counter.reactive.md +4 -4
- package/examples/local/diagnostics.reactive.md +25 -25
- package/examples/local/diagram.reactive.md +20 -20
- package/examples/local/gallery.reactive.md +31 -31
- package/examples/local/parameters.reactive.md +19 -19
- package/examples/local/planning.reactive.md +15 -15
- package/examples/local/pricing.reactive.md +10 -10
- package/examples/local/recipes/invoice-zh.reactive.md +36 -0
- package/examples/local/recipes/invoice.reactive.md +36 -0
- package/examples/local/recipes/workshop-zh.reactive.md +33 -0
- package/examples/local/recipes/workshop.reactive.md +33 -0
- package/examples/local/showcase/README.md +25 -0
- package/examples/local/showcase/explore.reactive.md +102 -0
- package/examples/local/showcase/flow.reactive.md +86 -0
- package/examples/local/showcase/forms.reactive.md +126 -0
- package/examples/local/showcase/functions.reactive.md +119 -0
- package/examples/local/showcase/layout.reactive.md +100 -0
- package/examples/local/showcase/statistics.reactive.md +108 -0
- package/examples/local/showcase/tasks.reactive.md +89 -0
- package/examples/local/showcase/zh/explore.reactive.md +102 -0
- package/examples/local/showcase/zh/flow.reactive.md +86 -0
- package/examples/local/showcase/zh/forms.reactive.md +126 -0
- package/examples/local/showcase/zh/functions.reactive.md +119 -0
- package/examples/local/showcase/zh/layout.reactive.md +100 -0
- package/examples/local/showcase/zh/statistics.reactive.md +108 -0
- package/examples/local/showcase/zh/tasks.reactive.md +89 -0
- package/examples/local/zh/catalog.reactive.md +20 -0
- package/examples/local/zh/charts.reactive.md +73 -0
- package/examples/local/zh/checklist.reactive.md +32 -0
- package/examples/local/zh/comparison.reactive.md +47 -0
- package/examples/local/zh/components.reactive.md +44 -0
- package/examples/local/zh/counter.reactive.md +7 -0
- package/examples/local/zh/diagnostics.reactive.md +54 -0
- package/examples/local/zh/diagram.reactive.md +44 -0
- package/examples/local/zh/gallery.reactive.md +61 -0
- package/examples/local/zh/parameters.reactive.md +36 -0
- package/examples/local/zh/planning.reactive.md +24 -0
- package/examples/local/zh/pricing.reactive.md +20 -0
- package/package.json +90 -75
- package/README.en.md +0 -75
- package/dist-library/runtime-D4phFXOr.js +0 -10937
- package/docs/compatibility.md +0 -67
- package/docs/local-integration.md +0 -193
- package/docs/performance.md +0 -30
- package/docs/releasing.md +0 -92
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Performance measurements
|
|
2
|
+
|
|
3
|
+
Build the language package in the source repository root, then run:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm run build
|
|
7
|
+
npm run benchmark
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The script warms up 3 times and measures 20 times per scenario, reporting the median and P95; raw results are written to `artifacts/benchmark.json`. Use `npm run benchmark -- --iterations 50 --output artifacts/benchmark-50.json` to change the iteration count and output location. The report includes the package version, Node version, operating system and CPU information.
|
|
11
|
+
|
|
12
|
+
## Local baseline
|
|
13
|
+
|
|
14
|
+
2026-10-22, Reactive MD 0.3.0, Node 22.17.0, Windows x64, Intel Core Ultra 5 125H. Other development processes were running on the machine during measurement. This baseline predates the 0.4.0 release; re-run the benchmark before using it as a release comparison.
|
|
15
|
+
|
|
16
|
+
| Scenario | Median | P95 |
|
|
17
|
+
| --- | ---: | ---: |
|
|
18
|
+
| Compile the cost example, 378 characters | 2.51 ms | 5.83 ms |
|
|
19
|
+
| Compile a 250-row responsive table, 7,161 characters | 17.04 ms | 28.05 ms |
|
|
20
|
+
| Compile a 100-section article, 15,550 characters | 45.34 ms | 59.81 ms |
|
|
21
|
+
| 100 consecutive state writes and expression evaluations | 0.20 ms | 0.34 ms |
|
|
22
|
+
| Three curves, 200 sample points each | 0.55 ms | 1.61 ms |
|
|
23
|
+
|
|
24
|
+
Timing includes correctness assertions; one measurement of a runtime scenario includes 100 updates. The plotting scenario includes breakpoint checks for regular functions and non-grid asymptotes.
|
|
25
|
+
|
|
26
|
+
These numbers measure compilation, evaluation and sampling in Node; they do not include browser layout, painting or input-to-frame latency. Use them to compare versions under the same conditions; they set no cross-machine pass thresholds and do not imply that every document within the source limit takes the same time. CI saves measurement reports for Node 24; the [first CI run](https://github.com/yao1145/ReactiveMD/actions/runs/39782886373) passed and produced a report.
|
|
27
|
+
|
|
28
|
+
## Large documents in the host
|
|
29
|
+
|
|
30
|
+
Document source is limited to 1,000,000 UTF-16 code units, and plotting and expressions have separate computation budgets; see the [security policy](../SECURITY.md) for details. Resource limits bound the work, but the compile API remains synchronous. Editors can coalesce compilations triggered by consecutive input; when handling untrusted or large documents, compile in a host Worker or a separate process, with the host controlling concurrency and timeouts.
|
|
31
|
+
|
|
32
|
+
The syntax node budget defaults to 10,000, and hosts can adjust it per call with `compileLocal(source, { limits: { maxSyntaxNodes: 50_000 } })`, see the [Core API](local-integration-en.md#core-api). After raising the budget, measure compilation, memory and final preview rendering costs together.
|
|
33
|
+
|
|
34
|
+
## Rendering optimization contract
|
|
35
|
+
|
|
36
|
+
The reference renderer uses dependency information produced by the compiler to skip subtrees that cannot read a changed parameter. This is an internal rendering optimization, not an author-visible feature or a new public API.
|
|
37
|
+
|
|
38
|
+
- The public contract is semantic: state values, rendered text, diagnostics, accessibility attributes, static SSR output and interactive behavior remain the same as an unconditioned render. Only the amount of recomputation changes.
|
|
39
|
+
- `document.dependencies` is a frozen, serializable internal map. It marks subtrees whose reads cannot be decided statically as `null`; those subtrees are rendered conservatively. Hosts and alternative renderers must not depend on its shape, and may ignore it.
|
|
40
|
+
- Source changes, instance disposal, panel reset and visibility changes that can alter hidden state still update the affected subtrees. The optimization never suppresses a diagnostic or a validation hint.
|
|
41
|
+
- `npm run verify:memo` compares the optimized renderer with the unconditioned baseline on the same documents and state revisions. `npm run verify:release` includes that check. A rendering optimization is acceptable only when both produce equivalent observable output.
|
|
42
|
+
|
|
43
|
+
## Playground live editing
|
|
44
|
+
|
|
45
|
+
The Playground calls the public `compileLocal` in a separate module Worker and coalesces edits within 150 ms. The scheduler keeps at most one task being compiled and one latest source waiting to compile; stale results never replace the current preview or diagnostics. The editor and export always use the latest source; while waiting for compilation, the preview shows "Compiling" and keeps the previous preview. The preview component reuses the same document, avoiding a full preview rebuild on every keystroke.
|
|
46
|
+
|
|
47
|
+
Source persistence is deferred, and pending writes are flushed when switching examples or leaving the page. If the Worker is unavailable or fails, the page shows a fallback notice and compiles on the main thread after coalescing edits; that mode still has the cost of blocking on large documents. In normal Worker mode, React rendering, layout and painting after receiving compile results still run on the main thread.
|
|
48
|
+
|
|
49
|
+
The synchronous compile API and `LocalReactiveDocument` keep their existing behavior. Other hosts can refer to `demo/src/local-compile-worker.ts` and the scheduler to move compilation into a Worker they control.
|
|
50
|
+
|
|
51
|
+
### Re-measurement
|
|
52
|
+
|
|
53
|
+
After building the language package in the repository root, run:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
node scripts/benchmark-large-documents.mjs
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The script warms up 3 times, measures 20 times, checks compilation results for 10-, 100-, 300- and 600-section articles and saves the median and P95. With the Playground running, run the following browser checks from the repository root; the default server is `http://127.0.0.1:5184`, which `DEMO_URL` can override.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
node demo/scripts/verify-editing.mjs
|
|
63
|
+
node demo/scripts/benchmark-editing.mjs
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The editing benchmark types 10 consecutive characters at the end of a 300-section article of about 47,000 characters, with a 20 ms interval between keystrokes, and records the latency from the input event to the next `requestAnimationFrame` callback plus main-thread long tasks. This metric observes input responsiveness and is not the time until painting completes; long-task statistics include the final preview render. `EDITING_SECTIONS` adjusts the number of sections and `EDITING_REPORT` sets the report path. All reports are written to the ignored `artifacts/` directory.
|
|
67
|
+
|
|
68
|
+
On 2026-10-22, a before/after comparison was run on the same 46,969-character article on the Windows machine above with local Edge. Both sides used the Vite development server and a 1440 × 1000 viewport; the original version was `94fd72e`, and the optimized version includes the Worker scheduling and preview reuse described in this section.
|
|
69
|
+
|
|
70
|
+
| Metric | Original | Optimized |
|
|
71
|
+
| --- | ---: | ---: |
|
|
72
|
+
| Median latency from input to next frame callback | 147.3 ms | 9.5 ms |
|
|
73
|
+
| Maximum latency from input to next frame callback | 157.9 ms | 36.9 ms |
|
|
74
|
+
| Total time to type 10 consecutive characters | 2,302 ms | 538 ms |
|
|
75
|
+
|
|
76
|
+
The raw reports are `artifacts/benchmark-editing-before.json` and `artifacts/benchmark-editing-after.json`. This is a single local observation; machine load affects the numbers. The optimization mainly reduces main-thread work triggered by keystrokes; the algorithm and single-compile speed of synchronous `compileLocal` itself are unchanged.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 0.4.0 预览与迁移
|
|
2
|
+
|
|
3
|
+
状态:发布在 `next` 分发渠道的预览版。包版本 `0.4.0`,语法修订 `local-draft-2`,组块协议 `component-protocol-1`,主题协议 `reactive-md-theme-1`。这些是彼此独立的版本轴;`local-draft-2`、`component-protocol-1` 和 `reactive-md-theme-1` 都不是包版本。
|
|
4
|
+
|
|
5
|
+
使用 `npm install reactive-md@next` 安装预览版,或用 `npm install reactive-md@0.4.0` 固定版本。`0.3.1` 仍为 `latest` 版本。
|
|
6
|
+
|
|
7
|
+
本文汇总 0.4.0 包含的能力、对现有文档和宿主的变化,以及从 `0.3.1` / `local-draft-1` 升级的步骤。具体规则仍以链接的参考页为准;本页是升级清单。显式修订声明和迁移工具见[源码修订与迁移](source-versioning-ch.md)。
|
|
8
|
+
|
|
9
|
+
## 适合哪些项目
|
|
10
|
+
|
|
11
|
+
- 需要命名计算、格式化、校验、集合、新输入类型、主题或离线 HTML 导出的作者。
|
|
12
|
+
- 可以把宿主更新到 `local-draft-2`,并愿意补充 `LocalValueKind` 穷举、运行时适配器和状态处理的宿主。
|
|
13
|
+
- 固定使用 `0.3.1`、只需要 `local-draft-1` 的项目可以继续留在旧版本;它仍为 `latest`。当前构建只接受一个语法修订,不提供独立的 `local-draft-1` 模式;使用受支持旧写法的无指令源码按 `local-draft-2` 规则读取,显式 `local-draft-1` 声明必须先迁移。
|
|
14
|
+
|
|
15
|
+
## 0.4.0 包含的能力
|
|
16
|
+
|
|
17
|
+
| 范围 | 内容 |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| 语法 | 十个 `local-draft-2` 组块:`jump`、`anchor`、`text`、`section`、`multi-select`、`range-slider`、`coordinate`、`quiz`、`steps`、`step` |
|
|
20
|
+
| 源码修订 | 可选的 `local-draft-2` 指令、版本查看与升级检查、单份源码的元数据迁移 |
|
|
21
|
+
| 计算 | 顶层 `<const>` 与 `<computed>` 声明,支持依赖排序、类型推断、循环检测和运行时独立缓存 |
|
|
22
|
+
| 表达式 | 字符串与数字数组字面量、索引、`sum`/`average`/`minOf`/`maxOf`、数字/百分比/科学计数法/货币格式化、文本函数及 UTC 日期比较与日期差 |
|
|
23
|
+
| 校验与数据 | 提示型 `<validation>` 规则、`runtime.validate()`、`alert`/`badge` 动态 `tone`、带稳定行键的 `<data-table>`/`<column>` |
|
|
24
|
+
| 外观 | `<theme name="…">`、宿主主题登记、文档深浅模式、组块主色和清单完成样式 |
|
|
25
|
+
| 诊断 | 中英文共享诊断目录,渲染器、Playground 与 CLI 按语言显示,机器字段保持稳定 |
|
|
26
|
+
| 宿主状态 | 按名称读写公开参数、`exportLocalState`/`importLocalState`、参数保留工具和可选的 Worker 编译 |
|
|
27
|
+
| 导出 | `reactive-md build`/`lint`、交互与静态单文件 HTML、版本化状态文件、经校验的本地位图内联、standalone `ReactiveMD.mount`/`mountAll` 和 `<reactive-md-doc>` |
|
|
28
|
+
| 作者工具 | 高亮、补全、绑定定位、重命名、格式化及 `lint --locale en|zh` |
|
|
29
|
+
| 渲染 | 依赖感知的渲染,避免重算未受影响的文档子树 |
|
|
30
|
+
|
|
31
|
+
可运行示例见[示例索引](../examples/local/README.md),包括六个双语功能场景、账单示例和工作坊示例。全部可接受的标签名见[语法规范](local-interaction-syntax-ch.md#12-组件速查与语法裁剪)。
|
|
32
|
+
|
|
33
|
+
## 从 0.3.1 / local-draft-1 升级
|
|
34
|
+
|
|
35
|
+
无指令源码中,`local-draft-1` 已支持的写法继续有效;下面这些变化仍需要检查源码和宿主。
|
|
36
|
+
|
|
37
|
+
### 新增保留标识符
|
|
38
|
+
|
|
39
|
+
新增表达式函数名不能再用作控件绑定名。升级前请重命名以下同名旧绑定并同步修改引用:
|
|
40
|
+
|
|
41
|
+
`sum`、`average`、`minOf`、`maxOf`、`formatNumber`、`formatPercent`、`formatScientific`、`formatCurrency`、`trim`、`lower`、`upper`、`startsWith`、`endsWith`、`replace`、`slice`、`dateCompare`、`dateDiff`。
|
|
42
|
+
|
|
43
|
+
它们与原有保留名共同生效:数学与集合函数(`abs`、`sqrt`、`floor`、`ceil`、`round`、`min`、`max`、`pow`、`sin`、`cos`、`tan`、`asin`、`acos`、`atan`、`exp`、`log`、`len`、`contains`、`clamp`)、常量 `pi` 与 `e`、绘图名 `x` 与 `y`、字面量 `true`、`false`、`null`,以及 `__proto__`、`prototype`、`constructor`。详见[复用计算与格式化数值](computations-formatting-ch.md#兼容性)。
|
|
44
|
+
|
|
45
|
+
### 新增可识别标签名
|
|
46
|
+
|
|
47
|
+
当前构建会把以下名称解释为标签:`jump`、`anchor`、`text`、`section`、`multi-select`、`range-slider`、`coordinate`、`quiz`、`steps`、`step`、`computed`、`const`、`validation`、`data-table`、`column`。
|
|
48
|
+
|
|
49
|
+
如果旧文档把这些名称当作普通正文,或作为“未知标签按原文显示”的示例,现在会被解析为组块或声明。请把这类示例放进行内代码、代码围栏,或转义标签,并核对新增保留名与下列行为变化。
|
|
50
|
+
|
|
51
|
+
开头的 `<theme name="…">` 是文档元数据,不是组块;它同样只允许在正文前声明一次。
|
|
52
|
+
|
|
53
|
+
### 修订声明与迁移
|
|
54
|
+
|
|
55
|
+
源码可以在前导区声明 `<!-- reactive-md: local-draft-2 -->`。无指令源码保持当前修订的行为。显式 `local-draft-1` 或未知修订会以 `local.version.*` 诊断拒绝,不创建运行时;声明旧修订不会选择旧解析器。
|
|
56
|
+
|
|
57
|
+
`reactive-md migrate` 或纯核心 `migrateLocalSource` 把单份源码迁移到 `local-draft-2`。迁移只替换或补上元数据注释,保留正文原始字节、BOM 和 CRLF。写出结果前会阻止新增保留绑定、新增可识别标签、当前编译错误和文本控件长度语义变化;不重命名标识符,也不激活原先按原文显示的标签。清单完成样式属于兼容例外,不阻止迁移。迁移会改变源码摘要,之后应重新导出状态文件。在这一声明之前构建的读者(包括 `0.3.1`)会把它当作普通注释,不执行检查,因此应先迁移旧文档。
|
|
58
|
+
|
|
59
|
+
### 行为变化
|
|
60
|
+
|
|
61
|
+
- 清单中已勾选的条目现在加删除线并变淡,包括初始 `[x]` 条目。
|
|
62
|
+
- `alert` 与 `badge` 可以在现有枚举内使用动态 `tone` 表达式。
|
|
63
|
+
- 提供 `key`(稳定标识列)时,`table` 和 `chart` 可通过 `bind` 公开选择状态;没有 `key` 的旧表格仍只在渲染器内部保存选择。
|
|
64
|
+
- 文本控件的 `min-length` 与 `max-length` 按 Unicode 码点计数,与字符串 `len()` 一致。原先因 emoji 占两个 UTF-16 代码单元而失败的值现在可能通过;源码位置和资源预算仍按 UTF-16 计算。
|
|
65
|
+
- `document.bindings` 与 `document.initialState` 仍只描述可写控件;`runtime.snapshot().state` 还会包含成功求值的命名计算结果,宿主不能假设快照里只有控件。
|
|
66
|
+
- `LocalValueKind` 增加 `number-array`,`LocalValue` 增加 `number[]`;可写的清单与多选控件仍产生字符串数组。
|
|
67
|
+
- 自定义运行时适配器需要补充 `validate()`;多槽控件使用 `get(node, slot?)`、`set(node, value, slot?)` 和 `setMany(node, values)`。
|
|
68
|
+
- 状态文件携带 `syntax: "local-draft-2"` 和源码摘要。语法修订、摘要或公开参数集合不一致时会拒绝整个文件。
|
|
69
|
+
- 显示用诊断通过共享目录本地化;回调仍收到结构化诊断。`message` 是显示文本,不是 API。
|
|
70
|
+
|
|
71
|
+
## 升级清单
|
|
72
|
+
|
|
73
|
+
1. 从 `next` 安装 `0.4.0` 或固定 `0.4.0`,保存原始 `.reactive.md` 源码,并记录 `LOCAL_SYNTAX_VERSION`。
|
|
74
|
+
2. 对每份源码运行 `reactive-md migrate <file> --check` 或 `migrateLocalSource`。无版本声明的历史文档要加 `--from local-draft-1`;写出结果前处理全部阻止项。
|
|
75
|
+
3. 在代码区域之外搜索 15 个新增可识别标签名,按需要转义或放进代码。
|
|
76
|
+
4. 搜索 `bind`、`bind-start`、`bind-end`、`bind-x`、`bind-y` 的值,确认没有 17 个新增保留标识符;如有则重命名绑定和引用。核心入口的 `renameLocalBinding` 和编辑器重命名会同时更新声明、表达式引用与绘图参数。
|
|
77
|
+
5. 重新编译全部文档,处理新增的位置或结构诊断,尤其是顶层 `computed`/`const`、`validation`、`data-table`/`column`、`steps`/`step` 和 `quiz`。
|
|
78
|
+
6. 更新宿主对 `number-array`、`validate()`、槽位 API 和包含计算值的快照的处理。
|
|
79
|
+
7. 重新检查状态导入导出、参数保留和宿主内的 HTML 导出。迁移会改变源码摘要,应重新导出状态文件。
|
|
80
|
+
8. 检查可见变化:清单完成样式、表格/图表选择和主题 CSS。
|
|
81
|
+
9. 运行[发布验证入口](../CONTRIBUTING-ch.md),并用自己的文档和浏览器检查复验。
|
|
82
|
+
|
|
83
|
+
## 验证范围
|
|
84
|
+
|
|
85
|
+
`0.4.0` 面向 Node.js 22.12 与 Node 24;CI 门禁使用 Playwright Chromium,本地检查使用 Microsoft Edge。`npm run verify:release` 是完整发布门禁:覆盖核心与 Demo 测试、类型、包与文档检查、仓库外真实 tarball 消费,以及计算、集合、作者工具、状态恢复、HTML 导出的浏览器检查和渲染等价检查。单项命令仍列在[贡献指南](../CONTRIBUTING-ch.md)。
|
|
86
|
+
|
|
87
|
+
静态 SSR 由 packed 检查覆盖。单文件导出的静态首屏水合由 Playwright Chromium 和本地 Edge 检查覆盖。该路径之外的通用 SSR 水合、Firefox 与 Safari/WebKit 尚未验证,不作支持声明。
|
|
88
|
+
|
|
89
|
+
版本规则与诊断契约见[版本与兼容性](compatibility-ch.md),修订指令与迁移工具见[源码修订与迁移](source-versioning-ch.md),HTML 与状态格式见[可分享文档与静态导出](shareable-export-ch.md),组块新增见[local-draft-2 扩展说明](local-components-v2-ch.md)。
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 0.4.0 preview and migration
|
|
2
|
+
|
|
3
|
+
Status: preview release on the `next` distribution channel. Package version `0.4.0`, syntax revision `local-draft-2`, component protocol `component-protocol-1`, theme protocol `reactive-md-theme-1`. These are separate version axes; `local-draft-2`, `component-protocol-1` and `reactive-md-theme-1` are not package versions.
|
|
4
|
+
|
|
5
|
+
Install the preview with `npm install reactive-md@next`, or pin it with `npm install reactive-md@0.4.0`. `0.3.1` remains the `latest` release.
|
|
6
|
+
|
|
7
|
+
This page summarizes what 0.4.0 contains, what changes for existing documents and hosts, and how to move from `0.3.1` / `local-draft-1`. Detailed rules remain in the linked reference pages; this page is the upgrade checklist. Explicit revision declarations and the migration tools are specified in [Source revisions and migration](source-versioning-en.md).
|
|
8
|
+
|
|
9
|
+
## Who should upgrade
|
|
10
|
+
|
|
11
|
+
- Authors who need named calculations, formatting, validation, collections, new input types, themes or offline HTML export.
|
|
12
|
+
- Hosts that can adopt `local-draft-2` and update exhaustive `LocalValueKind` checks, runtime adapters and state handling.
|
|
13
|
+
- Projects that pin `0.3.1` and only need `local-draft-1` can stay there; it remains the `latest` release. The build accepts one syntax revision and has no separate `local-draft-1` mode; unversioned source in supported old forms is read under `local-draft-2` rules, while an explicit `local-draft-1` declaration must be migrated first.
|
|
14
|
+
|
|
15
|
+
## What 0.4.0 contains
|
|
16
|
+
|
|
17
|
+
| Area | Included |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Syntax | Ten `local-draft-2` components: `jump`, `anchor`, `text`, `section`, `multi-select`, `range-slider`, `coordinate`, `quiz`, `steps`, `step` |
|
|
20
|
+
| Source revisions | Optional `local-draft-2` directive, version inspection and upgrade checks, and single-source metadata migration |
|
|
21
|
+
| Calculations | Top-level `<const>` and `<computed>` declarations with dependency ordering, inferred types, cycle detection and per-runtime caching |
|
|
22
|
+
| Expressions | String and numeric array literals, indexing, `sum`/`average`/`minOf`/`maxOf`, number/percent/scientific/currency formatting, text functions and UTC date comparison/differences |
|
|
23
|
+
| Validation and data | Advisory `<validation>` rules, `runtime.validate()`, dynamic `alert`/`badge` tones, `<data-table>`/`<column>` row generation with stable keys |
|
|
24
|
+
| Appearance | `<theme name="…">`, host theme registration, document color schemes, component accent colors and completed-checklist styling |
|
|
25
|
+
| Diagnostics | Shared English/Chinese catalogue and localization in the renderer, Playground and CLI, with stable machine fields |
|
|
26
|
+
| Host state | Public parameter access by name, `exportLocalState`/`importLocalState`, retention helpers and optional Worker compilation |
|
|
27
|
+
| Export | `reactive-md build`/`lint`, interactive and static single-file HTML, versioned state files, verified local raster inlining, standalone `ReactiveMD.mount`/`mountAll` and `<reactive-md-doc>` |
|
|
28
|
+
| Author tools | Highlighting, completion, binding navigation, rename, formatting and `lint --locale en|zh` |
|
|
29
|
+
| Rendering | Dependency-aware rendering that avoids recomputing unaffected document subtrees |
|
|
30
|
+
|
|
31
|
+
The runnable examples are in the [example index](../examples/local/README.md), including the six bilingual feature tours, the invoice recipe and the workshop recipe. Every accepted tag name is listed in the [syntax specification](local-interaction-syntax-en.md#12-component-reference-and-syntax-scope).
|
|
32
|
+
|
|
33
|
+
## Upgrade from 0.3.1 / local-draft-1
|
|
34
|
+
|
|
35
|
+
Unversioned source in previously supported `local-draft-1` forms keeps its supported forms. The changes below still require a source and host review.
|
|
36
|
+
|
|
37
|
+
### Newly reserved identifiers
|
|
38
|
+
|
|
39
|
+
The new expression functions are reserved binding names. Rename any existing control binding with one of these names and update its references before upgrading:
|
|
40
|
+
|
|
41
|
+
`sum`, `average`, `minOf`, `maxOf`, `formatNumber`, `formatPercent`, `formatScientific`, `formatCurrency`, `trim`, `lower`, `upper`, `startsWith`, `endsWith`, `replace`, `slice`, `dateCompare`, `dateDiff`.
|
|
42
|
+
|
|
43
|
+
These join the existing reserved names: math and collection functions (`abs`, `sqrt`, `floor`, `ceil`, `round`, `min`, `max`, `pow`, `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `exp`, `log`, `len`, `contains`, `clamp`), the constants `pi` and `e`, the plot names `x` and `y`, the literals `true`, `false` and `null`, and `__proto__`, `prototype` and `constructor`. See [Reusing calculations and formatting values](computations-formatting-en.md#compatibility).
|
|
44
|
+
|
|
45
|
+
### Newly recognized tag names
|
|
46
|
+
|
|
47
|
+
The build now interprets these names as tags: `jump`, `anchor`, `text`, `section`, `multi-select`, `range-slider`, `coordinate`, `quiz`, `steps`, `step`, `computed`, `const`, `validation`, `data-table` and `column`.
|
|
48
|
+
|
|
49
|
+
Source that used one of these names as literal prose, or as an inert unknown-tag example, now parses as a component or declaration. Put literal examples inside code spans or fences, or escape the tag. Also check reserved identifiers and the behaviour changes below.
|
|
50
|
+
|
|
51
|
+
The leading `<theme name="…">` declaration is document metadata, not a component. It joins the same placement rule: one declaration before the body.
|
|
52
|
+
|
|
53
|
+
### Version declarations and migration
|
|
54
|
+
|
|
55
|
+
A source may declare `<!-- reactive-md: local-draft-2 -->` in its prologue. Unversioned source keeps current-revision behavior. An explicit `local-draft-1` or unknown revision is rejected with a `local.version.*` diagnostic and creates no runtime; declaring an old revision does not select an old parser.
|
|
56
|
+
|
|
57
|
+
`reactive-md migrate` or the pure core `migrateLocalSource` moves one source to `local-draft-2`. Migration replaces or adds only the metadata comment and preserves body bytes, BOM and CRLF. It blocks newly reserved bindings, newly recognized tags, current compile errors and text-control length changes before writing output. It does not rename identifiers or activate formerly inert tags. Completed checklist styling is a compatibility exception and does not block migration. Because migration changes the source digest, export fresh state files afterwards. Readers built before this declaration, including `0.3.1`, treat it as an ordinary comment and do not enforce the check, so migrate old documents first.
|
|
58
|
+
|
|
59
|
+
### Behaviour changes
|
|
60
|
+
|
|
61
|
+
- Completed checklist items are now struck through and muted, including `[x]` items in the initial state.
|
|
62
|
+
- `alert` and `badge` accept a dynamic `tone` expression within their existing enums.
|
|
63
|
+
- `table` and `chart` expose selection through `bind` when `key` names a stable identifier column. Existing tables without `key` keep renderer-local selection.
|
|
64
|
+
- Text-control `min-length` and `max-length` count Unicode code points, matching string `len()`. Values that previously failed because an emoji occupied two UTF-16 code units can now pass. Source positions and resource budgets still use UTF-16 units.
|
|
65
|
+
- `document.bindings` and `document.initialState` still describe writable controls. `runtime.snapshot().state` also contains successful named calculation results. Do not assume the snapshot contains controls only.
|
|
66
|
+
- `LocalValueKind` gains `number-array`; `LocalValue` gains `number[]`. Writable checklist and multi-select controls still produce string arrays.
|
|
67
|
+
- Custom runtime adapters need `validate()`; multi-slot controls use `get(node, slot?)`, `set(node, value, slot?)` and `setMany(node, values)`.
|
|
68
|
+
- State files carry `syntax: "local-draft-2"` and a source digest. A file is rejected when either the revision, digest or exact public parameter set differs.
|
|
69
|
+
- Displayed diagnostics are localized through the shared catalogue; callbacks still receive structured diagnostics. `message` remains display text, not an API.
|
|
70
|
+
|
|
71
|
+
## Upgrade checklist
|
|
72
|
+
|
|
73
|
+
1. Install `0.4.0` from `next` or pin `0.4.0`, keep the original `.reactive.md` sources and record `LOCAL_SYNTAX_VERSION`.
|
|
74
|
+
2. Run `reactive-md migrate <file> --check` or `migrateLocalSource` on each source. Unversioned historical documents need `--from local-draft-1`; resolve every reported blocker before writing output.
|
|
75
|
+
3. Search prose and examples for the 15 newly recognized tag names outside code regions; escape them or move them into code.
|
|
76
|
+
4. Search `bind`, `bind-start`, `bind-end`, `bind-x` and `bind-y` values for the 17 newly reserved identifiers; rename the bindings and their references. The core `renameLocalBinding` helper and the editor rename action update declarations, expression references and plot parameters together.
|
|
77
|
+
5. Recompile every document and fix new placement or structure diagnostics, especially top-level `computed`/`const`, `validation`, `data-table`/`column`, `steps`/`step` and `quiz`.
|
|
78
|
+
6. Update hosts for `number-array`, `validate()`, slot APIs and snapshots that include calculated values.
|
|
79
|
+
7. Recheck state import/export, retention and any HTML export inside the host. Migration changes the source digest; export fresh state files.
|
|
80
|
+
8. Check the visible changes: checklist completion styling, table/chart selection and theme CSS.
|
|
81
|
+
9. Run the [release verification gate](../CONTRIBUTING.md) and your own document and browser checks.
|
|
82
|
+
|
|
83
|
+
## Verification scope
|
|
84
|
+
|
|
85
|
+
The `0.4.0` build targets Node.js 22.12 and Node 24; its CI gate uses Playwright Chromium and local checks use Microsoft Edge. `npm run verify:release` is the complete release gate: it covers core and demo tests, types, package and documentation checks, packed consumption outside the repository, and the browser checks for calculations, collections, authoring, state restoration, HTML export and rendering equivalence. Individual commands remain in the [contributing guide](../CONTRIBUTING.md).
|
|
86
|
+
|
|
87
|
+
Static SSR is covered by the packed check. Single-file export static-first hydration is covered by the Playwright Chromium and local Edge checks. General SSR hydration outside that path, Firefox and Safari/WebKit are unverified and are not claimed as supported.
|
|
88
|
+
|
|
89
|
+
Use [Versions and compatibility](compatibility-en.md) for the version rules and diagnostics contract, [Source revisions and migration](source-versioning-en.md) for the directive and migration tools, [Shareable documents and static export](shareable-export-en.md) for the HTML and state formats, and [local-draft-2 components and migration](local-components-v2-en.md) for the component additions.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# 发布清单
|
|
2
|
+
|
|
3
|
+
本文件是维护者的手动发布流程。本清单覆盖发布在 `next` 渠道的 `0.4.0` 预览版;`0.3.1` 保持 `latest`,直到另行决定提升。版本规则见[版本与兼容性](compatibility-ch.md),面向使用者的升级说明见[0.4.0 发布与迁移](release-0.4.0-ch.md)。
|
|
4
|
+
|
|
5
|
+
## 发布前确认
|
|
6
|
+
|
|
7
|
+
### 包身份与元数据
|
|
8
|
+
|
|
9
|
+
非 scope 名称 `reactive-md` 已由已发布的 `0.3.0`、`0.3.1` 建立,`reactive-md/react` 和 `reactive-md/styles.css` 子路径也随这些版本生效。不要把改名当作常规发布准备:改名会破坏导入、状态工具和文档。
|
|
10
|
+
|
|
11
|
+
1. 除非维护者明确决定改用 scope,否则保持 `reactive-md`。scope 需要对应的 npm 账号或组织权限。
|
|
12
|
+
2. 如果改名,同时更新 `package.json` 的 `name`、文档中的导入语句、tarball 文件名说明、示例和两个子路径,并在变更记录中按破坏性变更说明。
|
|
13
|
+
3. 核对 `package.json` 的 `repository`、`homepage`、`bugs`、`license`、`engines` 等发布元数据;当前已设置,发布前确认 URL 和最低 Node 版本仍然正确,并确认 `private` 保持移除状态。
|
|
14
|
+
4. 确认 `files` 覆盖发布所需内容。当前包含 `dist-library`、`dist-standalone`、`bin`、`cli`、README(`README.md`、`README-en.md`、`README-ch.md`)、中英文贡献指南、变更记录与安全策略、`THIRD_PARTY_NOTICES.md`、`docs` 和 `examples`;新增文档或 notice 时同步加入 `files`。
|
|
15
|
+
|
|
16
|
+
包名和版本决定 tarball 名称。当前 `0.4.0` 的预期文件名是 `reactive-md-0.4.0.tgz`;改名或改版本后以 `npm pack` 的实际输出为准。
|
|
17
|
+
|
|
18
|
+
### 第三方 notice
|
|
19
|
+
|
|
20
|
+
库产物打包了 `remark-gfm@4.0.1`、`remark-parse@11.0.0`、`unified@11.0.5` 及其依赖。独立 HTML 运行时还打包了 React、React DOM 和 scheduler;库的 React 入口使用宿主提供的 peer dependency。`THIRD_PARTY_NOTICES.md` 保留这些打包依赖的版权和许可声明。
|
|
21
|
+
|
|
22
|
+
维护者在发布前:
|
|
23
|
+
|
|
24
|
+
1. 运行 `npm run notices`,从已安装依赖重新生成 `THIRD_PARTY_NOTICES.md`。生成脚本覆盖 `remark-gfm`、`remark-parse`、`unified`、`react`、`react-dom` 的依赖树和实际许可证文本,包括 scheduler。
|
|
25
|
+
2. 确认 `package.json` 的 `files` 包含 `THIRD_PARTY_NOTICES.md`,并随 tarball 分发。
|
|
26
|
+
3. 检查 `npm pack --dry-run` 的输出,确认没有 `node_modules`、`demo/`、`demo/artifacts/`、测试产物或本地缓存。
|
|
27
|
+
4. 核对依赖许可证与打包内容一致;新增或升级 Markdown 依赖后重新生成 notice。
|
|
28
|
+
|
|
29
|
+
## 本地 tarball 安装
|
|
30
|
+
|
|
31
|
+
完整的本地门禁是:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm ci
|
|
35
|
+
npm run verify:release
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`verify:release` 运行 Node 端与浏览器检查,构建包,在仓库外安装真实 tarball,并验证多份能力组合后的文档行为;它自行管理预览服务和浏览器生命周期。CI 通过 `verify:release:node` 和 `verify:release:browser` 分片运行同一门禁。本机需已安装浏览器。
|
|
39
|
+
|
|
40
|
+
packed 检查会在 `artifacts/release-package/` 保留经过验证的原始安装包,并在同目录的 `package-verification.json` 记录 SHA256 与 npm integrity。完整门禁通过后发布这一安装包;源码、包元数据或随包文档变化后重新验证。
|
|
41
|
+
|
|
42
|
+
需要手工检查包内容时,直接使用 tarball。在仓库根目录:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm pack
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`npm pack` 会通过 `prepack` 先运行构建和 `npm run notices`,生成 `dist-library/` 与 `THIRD_PARTY_NOTICES.md`。`dist-library/` 是 `package.json` 的 `exports` 指向的目录。随后在一个空目录中验证安装:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
mkdir /tmp/reactive-md-consumer
|
|
52
|
+
cd /tmp/reactive-md-consumer
|
|
53
|
+
npm init -y
|
|
54
|
+
npm install /path/to/reactive-md-0.4.0.tgz
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
核心入口可在 Node 中直接检查:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
node --input-type=module -e "import { compileLocal, LOCAL_SYNTAX_VERSION } from 'reactive-md'; console.log(LOCAL_SYNTAX_VERSION, compileLocal('# ok').ok)"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
React 入口需要另装 React 19:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
npm install react@19 react-dom@19
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
71
|
+
import 'reactive-md/styles.css';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
静态 SSR 渲染由 packed 检查覆盖。单文件导出的静态首屏水合由 Playwright Chromium 和本地 Edge 浏览器检查覆盖;该路径之外的通用 SSR 水合尚未验证。安装验证还应确认 tarball 中的 `dist-library/types`、`dist-standalone`、`bin`、`cli`、`README.md`、`README-en.md`、`README-ch.md`、`CHANGELOG-ch.md`、`SECURITY-ch.md`、`THIRD_PARTY_NOTICES.md`、`docs` 和 `examples` 完整,并检查 `docs` 中没有指向未打包 `demo/`、`src/`、`tests/` 或 `.tasks/` 文件的本地链接。
|
|
75
|
+
|
|
76
|
+
## 发布说明
|
|
77
|
+
|
|
78
|
+
发布说明面向使用者,至少包含:
|
|
79
|
+
|
|
80
|
+
- 包版本、`LOCAL_SYNTAX_VERSION`、组块协议修订与主题协议修订;这些不是同一个版本号。
|
|
81
|
+
- 安装方式:`npm install reactive-md@next`,或使用 `npm install reactive-md@<version>` 固定版本;并提供可下载 tarball 作为离线安装选项。
|
|
82
|
+
- 用户可见变化、破坏性变更和迁移步骤;直接链接[变更记录](../CHANGELOG-ch.md),本轮同时链接[0.4.0 发布说明](release-0.4.0-ch.md)。
|
|
83
|
+
- 已验证的平台,以及未验证的浏览器、通用 SSR 水合等范围。
|
|
84
|
+
- 已知限制和安全说明链接 [SECURITY-ch.md](../SECURITY-ch.md)。
|
|
85
|
+
|
|
86
|
+
不要写尚未执行的检查结果,也不要把 CI 配置存在写成 CI 已通过。
|
|
87
|
+
|
|
88
|
+
## 人工发布清单
|
|
89
|
+
|
|
90
|
+
1. 确认工作区干净,变更已审查;`npm ci` 从锁文件安装成功。
|
|
91
|
+
2. 在 Node 22.12 和受支持的较新 LTS(当前为 24)上运行 `npm run verify:release`。这是维护者和 CI 共用的完整门禁,不要用一组自行挑选的命令代替。
|
|
92
|
+
3. 确认版本号、`CHANGELOG-ch.md` 和发布说明一致。语法变化时更新 `LOCAL_SYNTAX_VERSION`;组块或主题协议修订仅在各自契约变化时更新,这些版本轴保持独立。
|
|
93
|
+
4. 检查门禁保留的安装包,包括文件列表、大小和许可文件。手动重新运行 `npm pack` 会产生新候选包,需要单独完成安装验证。
|
|
94
|
+
5. 核对安装包的 SHA256 与 `artifacts/release-package/package-verification.json` 一致,并记录到发布说明或内部发布记录。
|
|
95
|
+
6. 合并发布提交,等待 `main` 上的 CI 全部通过。
|
|
96
|
+
7. 手动创建并推送 tag,例如 `v0.4.0`。不要在自动发布工作流中保存 npm token。
|
|
97
|
+
8. 在维护者本机完成 npm 登录和双因素认证后,手动发布已经验证的预览版安装包:`npm publish artifacts/release-package/reactive-md-0.4.0.tgz --access public --tag next`。预览版使用 `next` 分发标签;是否更新稳定版的 `latest` 标签另行决定。
|
|
98
|
+
9. 在 npm 和 GitHub Releases 上核对包内容、版本、README、许可与发布说明;从公开 registry 重新安装一次。
|
|
99
|
+
10. 从 registry 验证 README 中的安装命令可用,核对 registry 的完整性摘要与发布 tarball 一致。
|
|
100
|
+
|
|
101
|
+
README 中的版本与安装命令应在打包前准备好,并在发布后验证。发布过程中不要提交 token、`.npmrc` 凭据或本机路径。
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Release checklist
|
|
2
|
+
|
|
3
|
+
This file is the maintainers' manual release process. This checklist covers the `0.4.0` preview release on the `next` channel; `0.3.1` remains `latest` until a separate promotion decision. See [Versions and compatibility](compatibility-en.md) for version rules and [0.4.0 release and migration](release-0.4.0-en.md) for the user-facing upgrade summary.
|
|
4
|
+
|
|
5
|
+
## Before release
|
|
6
|
+
|
|
7
|
+
### Package identity and metadata
|
|
8
|
+
|
|
9
|
+
The unscoped name `reactive-md` is already established by the published `0.3.0` and `0.3.1` releases, together with the `reactive-md/react` and `reactive-md/styles.css` subpaths. Do not treat a rename as routine release preparation: changing the name is a breaking change for imports, state tooling and documentation.
|
|
10
|
+
|
|
11
|
+
1. Keep `reactive-md` unless maintainers explicitly decide on a scoped rename. A scope requires the corresponding npm account or organization permissions.
|
|
12
|
+
2. If renaming, update `name` in `package.json`, import statements in the documentation, tarball filename references, examples and both subpaths, then record the change as breaking in the changelog.
|
|
13
|
+
3. Check release metadata in `package.json`: `repository`, `homepage`, `bugs`, `license`, `engines` and similar fields. They are currently set; before releasing, confirm the URLs and minimum Node version are still correct and that `private` remains removed.
|
|
14
|
+
4. Confirm `files` covers what needs to be published. It currently includes `dist-library`, `dist-standalone`, `bin`, `cli`, the READMEs (`README.md`, `README-en.md`, `README-ch.md`), the contributing, changelog and security guides in both languages, `THIRD_PARTY_NOTICES.md`, `docs` and `examples`; add any new documentation or notices to `files` as well.
|
|
15
|
+
|
|
16
|
+
The package name and version determine the tarball name. The expected filename for `0.4.0` is `reactive-md-0.4.0.tgz`; after renaming or changing the version, use the actual output of `npm pack`.
|
|
17
|
+
|
|
18
|
+
### Third-party notices
|
|
19
|
+
|
|
20
|
+
The library bundles `remark-gfm@4.0.1`, `remark-parse@11.0.0`, `unified@11.0.5` and their dependencies. The standalone HTML runtime also bundles React, React DOM and scheduler; the library React entry uses host-provided peers. All these bundles retain the installed dependencies' copyright and license notices in `THIRD_PARTY_NOTICES.md`.
|
|
21
|
+
|
|
22
|
+
Before releasing, maintainers:
|
|
23
|
+
|
|
24
|
+
1. Run `npm run notices` to regenerate `THIRD_PARTY_NOTICES.md` from installed dependencies. The generation script covers the dependency trees and actual license texts of `remark-gfm`, `remark-parse`, `unified`, `react` and `react-dom`, including scheduler.
|
|
25
|
+
2. Confirm `files` in `package.json` includes `THIRD_PARTY_NOTICES.md` so it ships in the tarball.
|
|
26
|
+
3. Inspect the output of `npm pack --dry-run` and confirm there is no `node_modules`, `demo/`, `demo/artifacts/`, test output or local cache.
|
|
27
|
+
4. Check that dependency licenses match the packaged content; regenerate notices after adding or upgrading Markdown dependencies.
|
|
28
|
+
|
|
29
|
+
## Local tarball installation
|
|
30
|
+
|
|
31
|
+
The complete local gate is:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm ci
|
|
35
|
+
npm run verify:release
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`verify:release` runs the Node-side and browser checks, builds the package, installs the real tarball outside the repository and exercises combined document behavior. It manages the preview server and browser lifecycle itself. CI splits the same gate with `verify:release:node` and `verify:release:browser`. A browser must already be installed locally.
|
|
39
|
+
|
|
40
|
+
The packed check retains the exact verified archive in `artifacts/release-package/` and records its SHA256 and npm integrity in `package-verification.json` there. Publish that archive after the complete gate passes. Re-run verification if source, package metadata or packaged documentation changes.
|
|
41
|
+
|
|
42
|
+
To inspect the package manually, use the tarball directly. In the repository root:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm pack
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`npm pack` runs the build and `npm run notices` through `prepack` first, producing `dist-library/` and `THIRD_PARTY_NOTICES.md`. `dist-library/` is the directory targeted by `exports` in `package.json`. Then verify installation in an empty directory:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
mkdir /tmp/reactive-md-consumer
|
|
52
|
+
cd /tmp/reactive-md-consumer
|
|
53
|
+
npm init -y
|
|
54
|
+
npm install /path/to/reactive-md-0.4.0.tgz
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The core entry can be checked directly in Node:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
node --input-type=module -e "import { compileLocal, LOCAL_SYNTAX_VERSION } from 'reactive-md'; console.log(LOCAL_SYNTAX_VERSION, compileLocal('# ok').ok)"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The React entry requires React 19 to be installed separately:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
npm install react@19 react-dom@19
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { LocalReactiveDocument } from 'reactive-md/react';
|
|
71
|
+
import 'reactive-md/styles.css';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Static SSR rendering is covered by the packed check. Single-file export static-first hydration is covered by the Playwright Chromium and local Edge browser checks; general SSR hydration outside that path is unverified. Installation verification should also confirm that the tarball contains complete `dist-library/types`, `dist-standalone`, `bin`, `cli`, `README.md`, `README-en.md`, `README-ch.md`, `CHANGELOG.md`, `SECURITY.md`, `THIRD_PARTY_NOTICES.md`, `docs` and `examples`, and check that `docs` contains no local links to unpackaged `demo/`, `src/`, `tests/` or `.tasks/` files.
|
|
75
|
+
|
|
76
|
+
## Release notes
|
|
77
|
+
|
|
78
|
+
Release notes are for users and must include at least:
|
|
79
|
+
|
|
80
|
+
- The package version, `LOCAL_SYNTAX_VERSION`, component protocol revision and theme protocol revision; these are different version numbers.
|
|
81
|
+
- The install command `npm install reactive-md@next`, or `npm install reactive-md@<version>` to pin the release, with a downloadable tarball as an offline installation option.
|
|
82
|
+
- User-visible changes, breaking changes and migration steps; link directly to the [changelog](../CHANGELOG.md) and the [0.4.0 release notes](release-0.4.0-en.md) for this cycle.
|
|
83
|
+
- Verified platforms, plus unverified browsers, general SSR hydration and other scope.
|
|
84
|
+
- Known limitations and a link to [SECURITY.md](../SECURITY.md).
|
|
85
|
+
|
|
86
|
+
Do not write results for checks that have not run, and do not present the existence of CI configuration as CI passing.
|
|
87
|
+
|
|
88
|
+
## Manual release checklist
|
|
89
|
+
|
|
90
|
+
1. Confirm the working tree is clean, changes have been reviewed, and `npm ci` installs successfully from the lockfile.
|
|
91
|
+
2. On Node 22.12 and a supported newer LTS (currently 24), run `npm run verify:release`. This is the same complete gate local maintainers and CI use; do not replace it with a list of hand-picked commands.
|
|
92
|
+
3. Confirm the version number, `CHANGELOG.md` and the release notes agree. Update `LOCAL_SYNTAX_VERSION` when syntax changes; update component or theme protocol revisions only when their own contracts change. These version axes remain independent.
|
|
93
|
+
4. Inspect the verified archive retained by the gate, including its file list, size and license files. A fresh manual `npm pack` produces a new candidate that needs its own installation verification.
|
|
94
|
+
5. Compare the archive's SHA256 with `artifacts/release-package/package-verification.json` and record it in the release notes or an internal release record.
|
|
95
|
+
6. Merge the release commit and wait for all CI on `main` to pass.
|
|
96
|
+
7. Create and push the tag manually, for example `v0.4.0`. Do not store npm tokens in an automated release workflow.
|
|
97
|
+
8. After signing in to npm and completing two-factor authentication on the maintainer's machine, publish the verified preview tarball manually: `npm publish artifacts/release-package/reactive-md-0.4.0.tgz --access public --tag next`. The preview uses the `next` distribution tag; changing the stable `latest` tag is a separate release decision.
|
|
98
|
+
9. Verify the package contents, version, README, license and release notes on npm and GitHub Releases; reinstall once from the public registry.
|
|
99
|
+
10. Verify that the install command in the README works from the registry, and that the registry integrity digest matches the released tarball.
|
|
100
|
+
|
|
101
|
+
The version and install command in the README should be ready before packaging and verified after release. Do not commit tokens, `.npmrc` credentials or local paths during the release process.
|