@monkeyplus/flow 6.0.35 → 6.0.37

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.
@@ -70,6 +70,7 @@ async function run() {
70
70
  outputDir,
71
71
  generatedManifestPath,
72
72
  generate: true,
73
+ useIpxPath: true,
73
74
  netlifyCache: false,
74
75
  options
75
76
  };
@@ -3,6 +3,7 @@ import { existsSync } from "node:fs";
3
3
  import { copyFile, mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { dirname, join, resolve } from "node:path";
5
5
  import process from "node:process";
6
+ import { consola } from "consola";
6
7
  import { createIPX, ipxFSStorage, ipxHttpStorage } from "ipx";
7
8
  const DEFAULT_BUILD_BATCH_SIZE = 8;
8
9
  function getGeneratedImageKey(entry) {
@@ -135,6 +136,8 @@ export async function materializeGeneratedImages(config) {
135
136
  originalSourcesToDelete.add(image.src);
136
137
  }
137
138
  }
139
+ const totalImages = images.length;
140
+ let processedCount = 0;
138
141
  for (const batch of createBatches(images, batchSize)) {
139
142
  const results = await Promise.all(batch.map(async (image) => {
140
143
  const signature = await createSignature(image, config.publicDir);
@@ -143,14 +146,16 @@ export async function materializeGeneratedImages(config) {
143
146
  ...image,
144
147
  signature
145
148
  };
146
- const outputPath = outputFilePath(config.outputDir, image.generate);
147
- const cacheRelativePath = normalizeOutputPath(image.generate);
149
+ const outputPath = outputFilePath(config.outputDir, config.useIpxPath ? image.url : image.generate);
150
+ const cacheRelativePath = normalizeOutputPath(config.useIpxPath ? image.url : image.generate);
148
151
  const cachePath = config.generatedCacheDir ? outputFilePath(config.generatedCacheDir, cacheRelativePath) : void 0;
149
152
  activeCacheFiles.add(cacheRelativePath);
150
153
  await ensureParentDir(outputPath);
151
- const publicPreGeneratedPath = outputFilePath(config.publicDir, image.generate);
154
+ const publicPreGeneratedPath = outputFilePath(config.publicDir, image.url);
152
155
  if (existsSync(publicPreGeneratedPath)) {
153
- await copyFile(publicPreGeneratedPath, outputPath);
156
+ if (publicPreGeneratedPath !== outputPath) {
157
+ await copyFile(publicPreGeneratedPath, outputPath);
158
+ }
154
159
  return { cacheHit: 1, generated: 0 };
155
160
  }
156
161
  if (config.netlifyCache && cachePath && previousManifest[imageKey]?.signature === signature && existsSync(cachePath)) {
@@ -170,6 +175,8 @@ export async function materializeGeneratedImages(config) {
170
175
  cacheHits += result.cacheHit;
171
176
  generated += result.generated;
172
177
  }
178
+ processedCount += batch.length;
179
+ consola.info(`[flow:images] Progreso: procesadas ${processedCount} de ${totalImages} im\xE1genes...`);
173
180
  }
174
181
  if (config.netlifyCache && config.generatedCacheDir && config.generatedCacheManifestPath) {
175
182
  await mkdir(config.generatedCacheDir, { recursive: true });
@@ -93,6 +93,7 @@ export interface FlowImagesRuntimeConfig {
93
93
  generatedCacheDir?: string;
94
94
  generatedCacheManifestPath?: string;
95
95
  generate: boolean;
96
+ useIpxPath?: boolean;
96
97
  netlifyCache: boolean;
97
98
  options: FlowImageOptions;
98
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkeyplus/flow",
3
- "version": "6.0.35",
3
+ "version": "6.0.37",
4
4
  "description": "@monkeyplus/flow package-first runtime with Vite, Nitro, Vue and a workspace playground.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {