@sudajs/cli 0.9.0 → 0.9.1

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/dist/index.d.ts CHANGED
@@ -98,6 +98,7 @@ declare const __testUtils: {
98
98
  createThemeProjectRequire: typeof createThemeProjectRequire;
99
99
  createRemotePageDraft: typeof createRemotePageDraft;
100
100
  findAnchorTagByHref: typeof findAnchorTagByHref;
101
+ formatMissingSharpWarning: typeof formatMissingSharpWarning;
101
102
  loadThemeScopedRenderer: typeof loadThemeScopedRenderer;
102
103
  normalizePlaywrightModule: typeof normalizePlaywrightModule;
103
104
  normalizeSharpModule: typeof normalizeSharpModule;
@@ -195,6 +196,7 @@ type SharpOptimizer = (input: string) => {
195
196
  declare function createThemeProjectRequire(themeRoot: string): NodeJS.Require;
196
197
  declare function normalizePlaywrightModule(moduleValue: unknown): PlaywrightModule | null;
197
198
  declare function normalizeSharpModule(moduleValue: unknown): SharpOptimizer | null;
199
+ declare function formatMissingSharpWarning(): string;
198
200
  /**
199
201
  * 解析人机交互的 `key@version` 格式。允许仅 `key`,也允许带 version。
200
202
  * 注意:theme key 现行约束不含 `@`,所以从右侧第一个 `@` 之后视为 version。
package/dist/index.js CHANGED
@@ -834,6 +834,7 @@ var __testUtils = {
834
834
  createThemeProjectRequire,
835
835
  createRemotePageDraft,
836
836
  findAnchorTagByHref,
837
+ formatMissingSharpWarning,
837
838
  loadThemeScopedRenderer,
838
839
  normalizePlaywrightModule,
839
840
  normalizeSharpModule,
@@ -1194,6 +1195,9 @@ async function loadPlaywright(themeRoot) {
1194
1195
  "Playwright is required for screenshot capture. Install it as a dev dependency: `pnpm add -D playwright && pnpm exec playwright install chromium`."
1195
1196
  );
1196
1197
  }
1198
+ function formatMissingSharpWarning() {
1199
+ return "warning: PNG optimization skipped because optional dependency `sharp` is not installed. Install it as a dev dependency in the theme project: `pnpm add -D sharp`.";
1200
+ }
1197
1201
  var warnedMissingSharp = false;
1198
1202
  var warnedSharpOptimizeFailure = false;
1199
1203
  async function loadOptionalSharp(themeRoot) {
@@ -1218,9 +1222,7 @@ async function optimizePngIfAvailable(themeRoot, filePath) {
1218
1222
  const sharp = await loadOptionalSharp(themeRoot);
1219
1223
  if (!sharp) {
1220
1224
  if (!warnedMissingSharp) {
1221
- console.warn(
1222
- "warning: PNG optimization skipped because optional dependency `sharp` is not installed. Install it in the theme project to enable preview compression."
1223
- );
1225
+ console.warn(formatMissingSharpWarning());
1224
1226
  warnedMissingSharp = true;
1225
1227
  }
1226
1228
  return;