diff --git a/docs/plans/2026-08-10-office-preview-design.md b/docs/plans/2026-08-10-office-preview-design.md index 4fa33ed..5bef38b 100644 --- a/docs/plans/2026-08-10-office-preview-design.md +++ b/docs/plans/2026-08-10-office-preview-design.md @@ -260,7 +260,9 @@ if (officeKind === 'docx' || officeKind === 'xlsx') { - `xlsx`(SheetJS,~400KB,xlsx 导入) - `@univerjs/core` + `@univerjs/sheets` + `@univerjs/sheets-ui` + `@univerjs/sheets-formula` + `@univerjs/sheets-conditional-formatting` + `@univerjs/sheets-chart` + `@univerjs/docs-ui` + `@univerjs/design` + `@univerjs/engine-render`(~5MB 合计) -**不放 `peerDependencies`**:这些是插件自有运行时依赖,不由 web profile 提供(对比现有 `node-pty`/`xterm`/`CodeMirror` 也在 `dependencies`)。 +**不放 `peerDependencies`**:这些是插件自有运行时依赖,不由 web profile 提供(对比现有 `node-pty`/`CodeMirror` 也在 `dependencies`)。 + +> **实施偏差记录(#122,2026-08)**:上文"`xterm` 也在 `dependencies`"已过时——`xterm` 与 `@xterm/addon-fit` 自 v0.13.0 起从 `dependencies` 迁至 `devDependencies`:二者始终内联进 `lib/client-terminal.js`(tsdown `noExternal` 全内联 + CSS 构建期解析),运行时零依赖;同时代码与开发依赖已从已弃用的 `xterm` 迁移到官方新包名 `@xterm/xterm@^5.5.0`(addon-fit@0.10.0 的 peer 约束锁 `^5.0.0`,不用 6.x),消除用户安装时的 deprecated 与 missing-peer 警告。Office 预览若落地,其依赖按同一原则处理。 ### 5.2 tsdown.config.ts 调整 diff --git a/package.json b/package.json index 83102ba..e6b7ca9 100644 --- a/package.json +++ b/package.json @@ -129,13 +129,11 @@ "@codemirror/state": "^6.7.1", "@codemirror/view": "^6.43.8", "@lezer/highlight": "^1.2.3", - "@xterm/addon-fit": "^0.10.0", "clsx": "^2.1.1", "node-pty": "^1.1.0", "rxjs": "^7.8.2", "schemastery": "^3.18.0", - "ws": "^8.18.0", - "xterm": "^5.3.0" + "ws": "^8.18.0" }, "devDependencies": { "@cordisjs/plugin-loader": "^1.0.0-rc.5", @@ -159,6 +157,8 @@ "@types/react": "~18.3.1", "@types/react-dom": "~18.3.1", "@types/ws": "^8.5.10", + "@xterm/addon-fit": "^0.11.0", + "@xterm/xterm": "^5.5.0", "cordis": "^4.0.0-rc.7", "jsdom": "^29.1.1", "lightningcss": "^1.32.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cf62710..8aa50f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -74,9 +74,6 @@ importers: '@lezer/highlight': specifier: ^1.2.3 version: 1.2.3 - '@xterm/addon-fit': - specifier: ^0.10.0 - version: 0.10.0(@xterm/xterm@5.4.0) clsx: specifier: ^2.1.1 version: 2.1.1 @@ -92,9 +89,6 @@ importers: ws: specifier: ^8.18.0 version: 8.21.3 - xterm: - specifier: ^5.3.0 - version: 5.3.0 devDependencies: '@cordisjs/plugin-loader': specifier: ^1.0.0-rc.5 @@ -159,6 +153,12 @@ importers: '@types/ws': specifier: ^8.5.10 version: 8.18.1 + '@xterm/addon-fit': + specifier: ^0.11.0 + version: 0.11.0 + '@xterm/xterm': + specifier: ^5.5.0 + version: 5.5.0 cordis: specifier: ^4.0.0-rc.7 version: 4.0.0-rc.8(@cordisjs/plugin-loader@1.0.0-rc.5) @@ -1186,13 +1186,11 @@ packages: '@vitest/utils@4.1.10': resolution: {integrity: sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==} - '@xterm/addon-fit@0.10.0': - resolution: {integrity: sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ==} - peerDependencies: - '@xterm/xterm': ^5.0.0 + '@xterm/addon-fit@0.11.0': + resolution: {integrity: sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g==} - '@xterm/xterm@5.4.0': - resolution: {integrity: sha512-GlyzcZZ7LJjhFevthHtikhiDIl8lnTSgol6eTM4aoSNLcuXu3OEhnbqdCVIjtIil3jjabf3gDtb1S8FGahsuEw==} + '@xterm/xterm@5.5.0': + resolution: {integrity: sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==} '@yuku-codegen/binding-android-arm64@0.8.5': resolution: {integrity: sha512-+oEBxK35kdbskhxozjZhI8N6qrMOfphpIkXnqBj6N2DC08rdkg10MUMRNKZLBNU6uNyoYiLcLyCE6aFV2sfMKw==} @@ -2166,10 +2164,6 @@ packages: xmlchars@2.2.0: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} - xterm@5.3.0: - resolution: {integrity: sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg==} - deprecated: This package is now deprecated. Move to @xterm/xterm instead. - yuku-ast@0.8.5: resolution: {integrity: sha512-Ez2CI2BnPK/if0tVI7jB9UUDSNibcChjJDEPEKuWPJNRkbvzSoAQrSqpKtdzl8qTPp4ftVb87f/jx5HIKOieQw==} @@ -3390,11 +3384,9 @@ snapshots: convert-source-map: 2.0.0 tinyrainbow: 3.1.1 - '@xterm/addon-fit@0.10.0(@xterm/xterm@5.4.0)': - dependencies: - '@xterm/xterm': 5.4.0 + '@xterm/addon-fit@0.11.0': {} - '@xterm/xterm@5.4.0': {} + '@xterm/xterm@5.5.0': {} '@yuku-codegen/binding-android-arm64@0.8.5': optional: true @@ -4385,8 +4377,6 @@ snapshots: xmlchars@2.2.0: {} - xterm@5.3.0: {} - yuku-ast@0.8.5: dependencies: '@yuku-toolchain/types': 0.8.5 diff --git a/src/client/TerminalView.tsx b/src/client/TerminalView.tsx index ec36dc0..30c0fac 100644 --- a/src/client/TerminalView.tsx +++ b/src/client/TerminalView.tsx @@ -20,9 +20,9 @@ * reconnect grace. */ import { useEffect, useRef, useState } from 'react' -import { Terminal, type ITheme } from 'xterm' +import { Terminal, type ITheme } from '@xterm/xterm' import { FitAddon } from '@xterm/addon-fit' -import 'xterm/css/xterm.css' +import '@xterm/xterm/css/xterm.css' import { t } from './locales.ts' import { openWhenSized } from './open-when-sized.ts' import type { SessionScope } from './api.ts' diff --git a/tsdown.config.ts b/tsdown.config.ts index d5f33d5..3163253 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -248,7 +248,7 @@ function makeCssPlugin(pluginId: string): BuildPlugin { resolveId(source: string, importer: string | undefined) { if (!source.endsWith('.css')) return null // Relative/absolute paths resolve against the importer; bare - // specifiers (e.g. 'xterm/css/xterm.css') resolve from the package. + // specifiers (e.g. '@xterm/xterm/css/xterm.css') resolve from the package. let abs: string if (source.startsWith('.') || source.startsWith('/') || /^[A-Za-z]:[\\/]/.test(source)) { abs = importer === undefined ? source : resolvePath(dirname(importer), source)