@monkeyplus/flow 6.0.36 → 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
  };
@@ -146,14 +146,16 @@ export async function materializeGeneratedImages(config) {
146
146
  ...image,
147
147
  signature
148
148
  };
149
- const outputPath = outputFilePath(config.outputDir, image.generate);
150
- 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);
151
151
  const cachePath = config.generatedCacheDir ? outputFilePath(config.generatedCacheDir, cacheRelativePath) : void 0;
152
152
  activeCacheFiles.add(cacheRelativePath);
153
153
  await ensureParentDir(outputPath);
154
- const publicPreGeneratedPath = outputFilePath(config.publicDir, image.generate);
154
+ const publicPreGeneratedPath = outputFilePath(config.publicDir, image.url);
155
155
  if (existsSync(publicPreGeneratedPath)) {
156
- await copyFile(publicPreGeneratedPath, outputPath);
156
+ if (publicPreGeneratedPath !== outputPath) {
157
+ await copyFile(publicPreGeneratedPath, outputPath);
158
+ }
157
159
  return { cacheHit: 1, generated: 0 };
158
160
  }
159
161
  if (config.netlifyCache && cachePath && previousManifest[imageKey]?.signature === signature && existsSync(cachePath)) {
@@ -168,8 +168,8 @@ export function createImageResolver(imagesOptions, stateImages, runtime = {}) {
168
168
  baseDir = getBaseDir(replacedPath, imagesOptions.dirImages);
169
169
  }
170
170
  const modifierSegment = getModifierSegment(image.modifiers);
171
- const baseURL = imagesOptions.baseURL || "/_ipx";
172
- image.generate = joinURL(baseURL, modifierSegment === "_" ? "" : modifierSegment, replacedPath);
171
+ const relativePath = getRelativePath(replacedPath, baseDir);
172
+ image.generate = joinURL(`/${baseDir}`, modifierSegment === "_" ? "" : modifierSegment, relativePath);
173
173
  if (originalExt) {
174
174
  image.generate = image.generate.replace(originalExt, image.ext);
175
175
  } else if (!image.generate.includes(".") && image.ext) {
@@ -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.36",
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": {