deps-conflict-resolver 1.2.0 → 1.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/README.en.md CHANGED
@@ -137,6 +137,18 @@ The plugin supports automatic detection of the package manager and registry:
137
137
 
138
138
  An explicit `registry` option overrides this detection. The resolver uses it for remote version queries, and the package manager uses the same registry when installing aliases.
139
139
 
140
+ ## Command-Line Diagnostics and Preparation
141
+
142
+ Inspect conflicts, explicitly prepare aliases, and validate the installed environment offline in CI:
143
+
144
+ ```bash
145
+ pnpm exec deps-conflict-resolver doctor legacy-lib --json
146
+ pnpm exec deps-conflict-resolver prepare legacy-lib
147
+ pnpm exec deps-conflict-resolver doctor legacy-lib --offline --strict --json
148
+ ```
149
+
150
+ `doctor` never installs packages; without package names it scans runtime dependencies and installed optional dependencies. `prepare` requires package names and updates the manifest and lockfile through the project's package manager. `--json` emits structured diagnostics, aliases, and installation outcomes. Commit the resulting manifest and lockfile and use a frozen installation in CI.
151
+
140
152
  ## Strict and Offline Resolution
141
153
 
142
154
  `offline: true` reuses verified installed aliases without registry queries or installation. Setting `autoInstall: false` alone does not prevent version queries. `strict: true` reports unresolved required dependencies, installation failures, and ambiguous runtime resolutions. Both options default to `false`.
@@ -155,6 +167,19 @@ console.log(resolver.explainResolution('vue', '/absolute/path/to/legacy-lib/inde
155
167
 
156
168
  Diagnostics expose stable codes. A failed strict initialization throws the exported `ResolutionError`, which includes `diagnostics`.
157
169
 
170
+ ## Vite Server-Side Rendering
171
+
172
+ The Vite plugin supports esbuild pre-bundling in Vite 4–7 and native Rolldown in Vite 8. Set `ssr: 'auto'` to include affected packages and active aliases in SSR builds and development pre-bundling:
173
+
174
+ ```typescript
175
+ depsConflictResolverVitePlugin({
176
+ dependencies: ['legacy-lib'],
177
+ ssr: 'auto',
178
+ });
179
+ ```
180
+
181
+ The default is `ssr: 'manual'`. Explicit `ssr.external` entries and SSR optimization exclusions retain Vite's precedence; avoid excluding packages that require redirection. When `projectRoot` is omitted, the plugin uses the final configured Vite `root`.
182
+
158
183
  ## How It Works
159
184
 
160
185
  ### 1. Dependency Analysis
package/README.md CHANGED
@@ -137,6 +137,18 @@ const resolved = resolver.resolveModule('vue', '/path/to/importer.js');
137
137
 
138
138
  显式设置 `registry` 时会覆盖上述自动检测结果:解析器从该地址查询可用版本,包管理器安装别名时也使用同一地址。
139
139
 
140
+ ## 命令行诊断与准备
141
+
142
+ 可以先诊断依赖冲突,再显式安装需要的别名,并在 CI 中离线校验:
143
+
144
+ ```bash
145
+ pnpm exec deps-conflict-resolver doctor legacy-lib --json
146
+ pnpm exec deps-conflict-resolver prepare legacy-lib
147
+ pnpm exec deps-conflict-resolver doctor legacy-lib --offline --strict --json
148
+ ```
149
+
150
+ `doctor` 不执行安装;未指定包名时会检查项目的运行时依赖和已安装的可选依赖。`prepare` 需要指定包名,并通过项目包管理器更新依赖清单和锁文件。`--json` 输出包含诊断、别名和安装结果的结构化报告。建议提交准备过程产生的清单和锁文件,并在 CI 中先执行冻结安装。
151
+
140
152
  ## 严格模式与离线解析
141
153
 
142
154
  `offline: true` 只复用经过验证的已安装别名,不查询 registry,也不执行安装;单独设置 `autoInstall: false` 不会禁止版本查询。`strict: true` 会在必要依赖未解决、安装失败或实际解析存在歧义时报告错误。两者默认均为 `false`。
@@ -155,6 +167,19 @@ console.log(resolver.explainResolution('vue', '/absolute/path/to/legacy-lib/inde
155
167
 
156
168
  诊断包含稳定的错误代码;严格模式初始化失败时可捕获导出的 `ResolutionError` 并读取其 `diagnostics`。
157
169
 
170
+ ## Vite 服务端渲染
171
+
172
+ Vite 插件支持 Vite 4–7 的 esbuild 预构建和 Vite 8 的原生 Rolldown。设置 `ssr: 'auto'` 可将需要重定向的包和有效别名加入 SSR 构建及开发预构建:
173
+
174
+ ```typescript
175
+ depsConflictResolverVitePlugin({
176
+ dependencies: ['legacy-lib'],
177
+ ssr: 'auto',
178
+ });
179
+ ```
180
+
181
+ 默认值为 `ssr: 'manual'`。显式 `ssr.external` 和 SSR 优化排除项仍遵循 Vite 的优先级;需要重定向的包不应同时被排除。未指定 `projectRoot` 时,插件使用最终 Vite 配置的 `root`。
182
+
158
183
  ## 工作原理
159
184
 
160
185
  ### 1. 依赖分析