@monkeyplus/flow 6.0.96 → 6.0.98

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.
@@ -8,6 +8,7 @@ import { defineFlowModule } from "../../src/runtime/config.mjs";
8
8
  import { materializeGeneratedImages } from "./runtime/build.mjs";
9
9
  import { screens } from "./runtime/helpers.mjs";
10
10
  import { resetFlowImageRuntimeState } from "./runtime/server.mjs";
11
+ import { loadImageRenames } from "./runtime/renames.mjs";
11
12
  import { withWatermark } from "./watermark.mjs";
12
13
  function withoutTrailingSlash(value) {
13
14
  return value.replace(/\/+$/, "");
@@ -106,6 +107,7 @@ export default defineFlowModule({
106
107
  const isCloudflarePreset = preset === "cloudflare" || preset === "cloudflare-pages" || !!process.env.CF_PAGES;
107
108
  const defaultOutputDir = isVercelPreset ? ".vercel/output/static" : isNetlifyPreset || isCloudflarePreset ? "dist" : ".output/public";
108
109
  const nitroPublicDir = context.flowConfig.nitro?.output?.publicDir;
110
+ const precomputedRenames = loadImageRenames([renameDir, publicDir].filter(Boolean));
109
111
  const imagesRuntimeConfig = {
110
112
  dirRenames: renameDir,
111
113
  dirFiles: options.dirFiles,
@@ -118,6 +120,7 @@ export default defineFlowModule({
118
120
  generatedCacheManifestPath,
119
121
  generate: shouldGenerateOutput,
120
122
  netlifyCache: isNetlify,
123
+ all: precomputedRenames,
121
124
  options: {
122
125
  lazy: options.lazy,
123
126
  screens: options.screens,
@@ -33,7 +33,7 @@ export function getFlowImageBootPayload(config = getFlowImagesRuntimeConfig()) {
33
33
  }
34
34
  const renameSources = [config.dirRenames, config.publicDir].filter(Boolean);
35
35
  return {
36
- all: loadImageRenames(renameSources),
36
+ all: config.all || loadImageRenames(renameSources),
37
37
  options: { ...config.options },
38
38
  generateOutput: !!config.generate,
39
39
  ...shouldExposeStrapiUrlToClient() && config.strapiURL ? { strapiURL: config.strapiURL } : {}
@@ -50,7 +50,7 @@ export function getFlowImageRuntimeUtils(config = getFlowImagesRuntimeConfig())
50
50
  }
51
51
  const renameSources = [config.dirRenames, config.publicDir].filter(Boolean);
52
52
  const images = {
53
- all: loadImageRenames(renameSources),
53
+ all: config.all || loadImageRenames(renameSources),
54
54
  generate: {}
55
55
  };
56
56
  const resolver = createImageResolver(config.options, images, {
@@ -95,6 +95,7 @@ export interface FlowImagesRuntimeConfig {
95
95
  generate: boolean;
96
96
  useIpxPath?: boolean;
97
97
  netlifyCache: boolean;
98
+ all?: Record<string, FlowImageMeta>;
98
99
  options: FlowImageOptions;
99
100
  }
100
101
  export interface FlowImageRuntimeUtils {
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkeyplus/flow",
3
- "version": "6.0.96",
3
+ "version": "6.0.98",
4
4
  "description": "@monkeyplus/flow package-first runtime with Vite, Nitro, Vue and a workspace playground.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -258,7 +258,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
258
258
  sizes: string | Record<string, any>;
259
259
  strappi: boolean;
260
260
  alt: string;
261
- referrerpolicy: "origin" | "no-referrer" | "no-referrer-when-downgrade" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
261
+ referrerpolicy: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
262
262
  usemap: string;
263
263
  longdesc: string;
264
264
  ismap: boolean;
@@ -13,10 +13,6 @@ function resolveImageSource(value, fallback) {
13
13
  function getLocalSource(src) {
14
14
  return src.startsWith("http") ? "" : src;
15
15
  }
16
- function isRuntimeLambda() {
17
- const runtimeProcess = typeof globalThis === "object" ? Reflect.get(globalThis, "process") : void 0;
18
- return !!(runtimeProcess?.env?.LAMBDA_TASK_ROOT || runtimeProcess?.env?.AWS_LAMBDA_FUNCTION_VERSION);
19
- }
20
16
  export default defineComponent({
21
17
  name: "MkImage",
22
18
  inheritAttrs: false,
@@ -117,17 +113,11 @@ export default defineComponent({
117
113
  };
118
114
  });
119
115
  return () => {
120
- const isLambda = isRuntimeLambda();
121
- const compatibilityThumb = !isLambda && nSrc.value.thumbnail;
122
- let lambdaSrc = resolvedSrc.value;
123
- if (isLambda) {
124
- const meta = imageUtils.getImageMeta?.(resolvedSrc.value);
125
- lambdaSrc = meta?.rename || resolvedSrc.value;
126
- }
116
+ const compatibilityThumb = nSrc.value.thumbnail;
127
117
  return h("img", {
128
118
  ...attrs,
129
119
  ...nAttrs.value,
130
- "src": isLambda ? lambdaSrc : compatibilityThumb || nSrc.value.normal,
120
+ "src": compatibilityThumb || nSrc.value.normal,
131
121
  "data-src": compatibilityThumb ? nSrc.value.normal : void 0,
132
122
  "alt": props.alt || image.value.alt,
133
123
  "title": props.title || image.value.title,
@@ -4,10 +4,6 @@ import { useImage } from "./image-shared.mjs";
4
4
  function getLocalSource(src) {
5
5
  return src.startsWith("http") ? "" : src;
6
6
  }
7
- function isRuntimeLambda() {
8
- const runtimeProcess = typeof globalThis === "object" ? Reflect.get(globalThis, "process") : void 0;
9
- return !!(runtimeProcess?.env?.LAMBDA_TASK_ROOT || runtimeProcess?.env?.AWS_LAMBDA_FUNCTION_VERSION);
10
- }
11
7
  function resolveThumbnailValue(value, fallback) {
12
8
  return value !== void 0 ? value : fallback;
13
9
  }
@@ -127,20 +123,6 @@ export default defineComponent({
127
123
  return typeof thumbnail === "string" ? thumbnail : resolvedSrc.value;
128
124
  });
129
125
  return () => {
130
- if (isRuntimeLambda()) {
131
- const meta = imageUtils.getImageMeta?.(resolvedSrc.value);
132
- const lambdaSrc = meta?.rename || resolvedSrc.value;
133
- return h("img", {
134
- ...attrs,
135
- ...nImgAttrs.value,
136
- "src": lambdaSrc,
137
- "alt": props.alt || image.value.alt,
138
- "title": props.title || image.value.title,
139
- "width": props.eWidth || nImgAttrs.value.width,
140
- "height": props.eHeight || nImgAttrs.value.height,
141
- "x-src": getLocalSource(resolvedSrc.value)
142
- });
143
- }
144
126
  const primarySource = nSources.value[0] || { src: resolvedSrc.value, srcset: resolvedSrc.value };
145
127
  const fallbackSource = nSources.value[1];
146
128
  const compatibilityThumb = nThumbnail.value;