@oktis-works/admin 0.1.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/bin/admin.js +19 -0
- package/dist/client/_astro/ContentEditor.A5N-aCxT.js +1 -0
- package/dist/client/_astro/PostTypesManager.w66_1tDh.js +1 -0
- package/dist/client/_astro/TaxonomiesManager.Dv_OOCEw.js +1 -0
- package/dist/client/_astro/api.GqKwASBH.js +1 -0
- package/dist/client/_astro/client.CCQ0X2AX.js +1 -0
- package/dist/client/_astro/edit.B4LyOiwH.css +1 -0
- package/dist/client/_astro/hoisted.SqllSTyr.js +1 -0
- package/dist/client/_astro/web.D5F0ytYW.js +1 -0
- package/dist/server/_empty-middleware.mjs +3 -0
- package/dist/server/chunks/astro/assets-service_BADPYD54.mjs +438 -0
- package/dist/server/chunks/astro_C5DJOQ1V.mjs +2038 -0
- package/dist/server/chunks/edit_CLlDPSWF.mjs +6 -0
- package/dist/server/chunks/index_By1s_hvq.mjs +6 -0
- package/dist/server/chunks/index_CAPo3ste.mjs +6 -0
- package/dist/server/chunks/login_GjNKFqRH.mjs +6 -0
- package/dist/server/chunks/node_CZILS-L9.mjs +6 -0
- package/dist/server/chunks/pages/edit_DSkfb6lH.mjs +2173 -0
- package/dist/server/chunks/pages/index_7XvpCth_.mjs +61 -0
- package/dist/server/chunks/pages/login_BKgn8hvS.mjs +12 -0
- package/dist/server/chunks/pages/node_CxUkTckt.mjs +268 -0
- package/dist/server/chunks/pages/post-types_BeBr92jW.mjs +246 -0
- package/dist/server/chunks/pages/taxonomies_B0jngTat.mjs +69 -0
- package/dist/server/chunks/post-types_CVELl9a2.mjs +6 -0
- package/dist/server/chunks/taxonomies_D8nuzf2R.mjs +6 -0
- package/dist/server/entry.mjs +9777 -0
- package/dist/server/manifest_BgSBppnI.mjs +455 -0
- package/dist/server/renderers.mjs +101 -0
- package/package.json +43 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { A as AstroError, E as ExpectedImage, L as LocalImageUsedWrongly, M as MissingImageDimension, U as UnsupportedImageFormat, I as IncompatibleDescriptorOptions, a as UnsupportedImageConversion, b as InvalidImageService, c as ExpectedImageOptions, d as MissingSharp } from '../astro_C5DJOQ1V.mjs';
|
|
2
|
+
|
|
3
|
+
function appendForwardSlash(path) {
|
|
4
|
+
return path.endsWith("/") ? path : path + "/";
|
|
5
|
+
}
|
|
6
|
+
function prependForwardSlash(path) {
|
|
7
|
+
return path[0] === "/" ? path : "/" + path;
|
|
8
|
+
}
|
|
9
|
+
function collapseDuplicateSlashes(path) {
|
|
10
|
+
return path.replace(/(?<!:)\/\/+/g, "/");
|
|
11
|
+
}
|
|
12
|
+
function removeTrailingForwardSlash(path) {
|
|
13
|
+
return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
|
|
14
|
+
}
|
|
15
|
+
function removeLeadingForwardSlash(path) {
|
|
16
|
+
return path.startsWith("/") ? path.substring(1) : path;
|
|
17
|
+
}
|
|
18
|
+
function trimSlashes(path) {
|
|
19
|
+
return path.replace(/^\/|\/$/g, "");
|
|
20
|
+
}
|
|
21
|
+
function isString(path) {
|
|
22
|
+
return typeof path === "string" || path instanceof String;
|
|
23
|
+
}
|
|
24
|
+
function joinPaths(...paths) {
|
|
25
|
+
return paths.filter(isString).map((path, i) => {
|
|
26
|
+
if (i === 0) {
|
|
27
|
+
return removeTrailingForwardSlash(path);
|
|
28
|
+
} else if (i === paths.length - 1) {
|
|
29
|
+
return removeLeadingForwardSlash(path);
|
|
30
|
+
} else {
|
|
31
|
+
return trimSlashes(path);
|
|
32
|
+
}
|
|
33
|
+
}).join("/");
|
|
34
|
+
}
|
|
35
|
+
function isRemotePath(src) {
|
|
36
|
+
return /^(http|ftp|https|ws):?\/\//.test(src) || src.startsWith("data:");
|
|
37
|
+
}
|
|
38
|
+
function slash(path) {
|
|
39
|
+
return path.replace(/\\/g, "/");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const VALID_SUPPORTED_FORMATS = [
|
|
43
|
+
"jpeg",
|
|
44
|
+
"jpg",
|
|
45
|
+
"png",
|
|
46
|
+
"tiff",
|
|
47
|
+
"webp",
|
|
48
|
+
"gif",
|
|
49
|
+
"svg",
|
|
50
|
+
"avif"
|
|
51
|
+
];
|
|
52
|
+
const DEFAULT_OUTPUT_FORMAT = "webp";
|
|
53
|
+
const DEFAULT_HASH_PROPS = ["src", "width", "height", "format", "quality"];
|
|
54
|
+
|
|
55
|
+
function isLocalService(service) {
|
|
56
|
+
if (!service) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return "transform" in service;
|
|
60
|
+
}
|
|
61
|
+
function parseQuality(quality) {
|
|
62
|
+
let result = parseInt(quality);
|
|
63
|
+
if (Number.isNaN(result)) {
|
|
64
|
+
return quality;
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
const baseService = {
|
|
69
|
+
validateOptions(options) {
|
|
70
|
+
if (!options.src || typeof options.src !== "string" && typeof options.src !== "object") {
|
|
71
|
+
throw new AstroError({
|
|
72
|
+
...ExpectedImage,
|
|
73
|
+
message: ExpectedImage.message(
|
|
74
|
+
JSON.stringify(options.src),
|
|
75
|
+
typeof options.src,
|
|
76
|
+
JSON.stringify(options, (_, v) => v === void 0 ? null : v)
|
|
77
|
+
)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!isESMImportedImage(options.src)) {
|
|
81
|
+
if (options.src.startsWith("/@fs/") || !isRemotePath(options.src) && !options.src.startsWith("/")) {
|
|
82
|
+
throw new AstroError({
|
|
83
|
+
...LocalImageUsedWrongly,
|
|
84
|
+
message: LocalImageUsedWrongly.message(options.src)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
let missingDimension;
|
|
88
|
+
if (!options.width && !options.height) {
|
|
89
|
+
missingDimension = "both";
|
|
90
|
+
} else if (!options.width && options.height) {
|
|
91
|
+
missingDimension = "width";
|
|
92
|
+
} else if (options.width && !options.height) {
|
|
93
|
+
missingDimension = "height";
|
|
94
|
+
}
|
|
95
|
+
if (missingDimension) {
|
|
96
|
+
throw new AstroError({
|
|
97
|
+
...MissingImageDimension,
|
|
98
|
+
message: MissingImageDimension.message(missingDimension, options.src)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (!VALID_SUPPORTED_FORMATS.includes(options.src.format)) {
|
|
103
|
+
throw new AstroError({
|
|
104
|
+
...UnsupportedImageFormat,
|
|
105
|
+
message: UnsupportedImageFormat.message(
|
|
106
|
+
options.src.format,
|
|
107
|
+
options.src.src,
|
|
108
|
+
VALID_SUPPORTED_FORMATS
|
|
109
|
+
)
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (options.widths && options.densities) {
|
|
113
|
+
throw new AstroError(IncompatibleDescriptorOptions);
|
|
114
|
+
}
|
|
115
|
+
if (options.src.format === "svg") {
|
|
116
|
+
options.format = "svg";
|
|
117
|
+
}
|
|
118
|
+
if (options.src.format === "svg" && options.format !== "svg" || options.src.format !== "svg" && options.format === "svg") {
|
|
119
|
+
throw new AstroError(UnsupportedImageConversion);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!options.format) {
|
|
123
|
+
options.format = DEFAULT_OUTPUT_FORMAT;
|
|
124
|
+
}
|
|
125
|
+
if (options.width)
|
|
126
|
+
options.width = Math.round(options.width);
|
|
127
|
+
if (options.height)
|
|
128
|
+
options.height = Math.round(options.height);
|
|
129
|
+
return options;
|
|
130
|
+
},
|
|
131
|
+
getHTMLAttributes(options) {
|
|
132
|
+
const { targetWidth, targetHeight } = getTargetDimensions(options);
|
|
133
|
+
const { src, width, height, format, quality, densities, widths, formats, ...attributes } = options;
|
|
134
|
+
return {
|
|
135
|
+
...attributes,
|
|
136
|
+
width: targetWidth,
|
|
137
|
+
height: targetHeight,
|
|
138
|
+
loading: attributes.loading ?? "lazy",
|
|
139
|
+
decoding: attributes.decoding ?? "async"
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
getSrcSet(options) {
|
|
143
|
+
const srcSet = [];
|
|
144
|
+
const { targetWidth } = getTargetDimensions(options);
|
|
145
|
+
const { widths, densities } = options;
|
|
146
|
+
const targetFormat = options.format ?? DEFAULT_OUTPUT_FORMAT;
|
|
147
|
+
let imageWidth = options.width;
|
|
148
|
+
let maxWidth = Infinity;
|
|
149
|
+
if (isESMImportedImage(options.src)) {
|
|
150
|
+
imageWidth = options.src.width;
|
|
151
|
+
maxWidth = imageWidth;
|
|
152
|
+
}
|
|
153
|
+
const {
|
|
154
|
+
width: transformWidth,
|
|
155
|
+
height: transformHeight,
|
|
156
|
+
...transformWithoutDimensions
|
|
157
|
+
} = options;
|
|
158
|
+
const allWidths = [];
|
|
159
|
+
if (densities) {
|
|
160
|
+
const densityValues = densities.map((density) => {
|
|
161
|
+
if (typeof density === "number") {
|
|
162
|
+
return density;
|
|
163
|
+
} else {
|
|
164
|
+
return parseFloat(density);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const densityWidths = densityValues.sort().map((density) => Math.round(targetWidth * density));
|
|
168
|
+
allWidths.push(
|
|
169
|
+
...densityWidths.map((width, index) => ({
|
|
170
|
+
maxTargetWidth: Math.min(width, maxWidth),
|
|
171
|
+
descriptor: `${densityValues[index]}x`
|
|
172
|
+
}))
|
|
173
|
+
);
|
|
174
|
+
} else if (widths) {
|
|
175
|
+
allWidths.push(
|
|
176
|
+
...widths.map((width) => ({
|
|
177
|
+
maxTargetWidth: Math.min(width, maxWidth),
|
|
178
|
+
descriptor: `${width}w`
|
|
179
|
+
}))
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
for (const { maxTargetWidth, descriptor } of allWidths) {
|
|
183
|
+
const srcSetTransform = { ...transformWithoutDimensions };
|
|
184
|
+
if (maxTargetWidth !== imageWidth) {
|
|
185
|
+
srcSetTransform.width = maxTargetWidth;
|
|
186
|
+
} else {
|
|
187
|
+
if (options.width && options.height) {
|
|
188
|
+
srcSetTransform.width = options.width;
|
|
189
|
+
srcSetTransform.height = options.height;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
srcSet.push({
|
|
193
|
+
transform: srcSetTransform,
|
|
194
|
+
descriptor,
|
|
195
|
+
attributes: {
|
|
196
|
+
type: `image/${targetFormat}`
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return srcSet;
|
|
201
|
+
},
|
|
202
|
+
getURL(options, imageConfig) {
|
|
203
|
+
const searchParams = new URLSearchParams();
|
|
204
|
+
if (isESMImportedImage(options.src)) {
|
|
205
|
+
searchParams.append("href", options.src.src);
|
|
206
|
+
} else if (isRemoteAllowed(options.src, imageConfig)) {
|
|
207
|
+
searchParams.append("href", options.src);
|
|
208
|
+
} else {
|
|
209
|
+
return options.src;
|
|
210
|
+
}
|
|
211
|
+
const params = {
|
|
212
|
+
w: "width",
|
|
213
|
+
h: "height",
|
|
214
|
+
q: "quality",
|
|
215
|
+
f: "format"
|
|
216
|
+
};
|
|
217
|
+
Object.entries(params).forEach(([param, key]) => {
|
|
218
|
+
options[key] && searchParams.append(param, options[key].toString());
|
|
219
|
+
});
|
|
220
|
+
const imageEndpoint = joinPaths("/", "/_image");
|
|
221
|
+
return `${imageEndpoint}?${searchParams}`;
|
|
222
|
+
},
|
|
223
|
+
parseURL(url) {
|
|
224
|
+
const params = url.searchParams;
|
|
225
|
+
if (!params.has("href")) {
|
|
226
|
+
return void 0;
|
|
227
|
+
}
|
|
228
|
+
const transform = {
|
|
229
|
+
src: params.get("href"),
|
|
230
|
+
width: params.has("w") ? parseInt(params.get("w")) : void 0,
|
|
231
|
+
height: params.has("h") ? parseInt(params.get("h")) : void 0,
|
|
232
|
+
format: params.get("f"),
|
|
233
|
+
quality: params.get("q")
|
|
234
|
+
};
|
|
235
|
+
return transform;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
function getTargetDimensions(options) {
|
|
239
|
+
let targetWidth = options.width;
|
|
240
|
+
let targetHeight = options.height;
|
|
241
|
+
if (isESMImportedImage(options.src)) {
|
|
242
|
+
const aspectRatio = options.src.width / options.src.height;
|
|
243
|
+
if (targetHeight && !targetWidth) {
|
|
244
|
+
targetWidth = Math.round(targetHeight * aspectRatio);
|
|
245
|
+
} else if (targetWidth && !targetHeight) {
|
|
246
|
+
targetHeight = Math.round(targetWidth / aspectRatio);
|
|
247
|
+
} else if (!targetWidth && !targetHeight) {
|
|
248
|
+
targetWidth = options.src.width;
|
|
249
|
+
targetHeight = options.src.height;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
targetWidth,
|
|
254
|
+
targetHeight
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function matchPattern(url, remotePattern) {
|
|
259
|
+
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname);
|
|
260
|
+
}
|
|
261
|
+
function matchPort(url, port) {
|
|
262
|
+
return !port || port === url.port;
|
|
263
|
+
}
|
|
264
|
+
function matchProtocol(url, protocol) {
|
|
265
|
+
return !protocol || protocol === url.protocol.slice(0, -1);
|
|
266
|
+
}
|
|
267
|
+
function matchHostname(url, hostname, allowWildcard) {
|
|
268
|
+
if (!hostname) {
|
|
269
|
+
return true;
|
|
270
|
+
} else if (!allowWildcard || !hostname.startsWith("*")) {
|
|
271
|
+
return hostname === url.hostname;
|
|
272
|
+
} else if (hostname.startsWith("**.")) {
|
|
273
|
+
const slicedHostname = hostname.slice(2);
|
|
274
|
+
return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
|
|
275
|
+
} else if (hostname.startsWith("*.")) {
|
|
276
|
+
const slicedHostname = hostname.slice(1);
|
|
277
|
+
const additionalSubdomains = url.hostname.replace(slicedHostname, "").split(".").filter(Boolean);
|
|
278
|
+
return additionalSubdomains.length === 1;
|
|
279
|
+
}
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
function matchPathname(url, pathname, allowWildcard) {
|
|
283
|
+
if (!pathname) {
|
|
284
|
+
return true;
|
|
285
|
+
} else if (!pathname.endsWith("*")) {
|
|
286
|
+
return pathname === url.pathname;
|
|
287
|
+
} else if (pathname.endsWith("/**")) {
|
|
288
|
+
const slicedPathname = pathname.slice(0, -2);
|
|
289
|
+
return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
|
|
290
|
+
} else if (pathname.endsWith("/*")) {
|
|
291
|
+
const slicedPathname = pathname.slice(0, -1);
|
|
292
|
+
const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean);
|
|
293
|
+
return additionalPathChunks.length === 1;
|
|
294
|
+
}
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function isESMImportedImage(src) {
|
|
299
|
+
return typeof src === "object";
|
|
300
|
+
}
|
|
301
|
+
function isRemoteImage(src) {
|
|
302
|
+
return typeof src === "string";
|
|
303
|
+
}
|
|
304
|
+
function isRemoteAllowed(src, {
|
|
305
|
+
domains = [],
|
|
306
|
+
remotePatterns = []
|
|
307
|
+
}) {
|
|
308
|
+
if (!isRemotePath(src))
|
|
309
|
+
return false;
|
|
310
|
+
const url = new URL(src);
|
|
311
|
+
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
312
|
+
}
|
|
313
|
+
async function getConfiguredImageService() {
|
|
314
|
+
if (!globalThis?.astroAsset?.imageService) {
|
|
315
|
+
const { default: service } = await Promise.resolve().then(() => sharp$1).catch((e) => {
|
|
316
|
+
const error = new AstroError(InvalidImageService);
|
|
317
|
+
error.cause = e;
|
|
318
|
+
throw error;
|
|
319
|
+
});
|
|
320
|
+
if (!globalThis.astroAsset)
|
|
321
|
+
globalThis.astroAsset = {};
|
|
322
|
+
globalThis.astroAsset.imageService = service;
|
|
323
|
+
return service;
|
|
324
|
+
}
|
|
325
|
+
return globalThis.astroAsset.imageService;
|
|
326
|
+
}
|
|
327
|
+
async function getImage(options, imageConfig) {
|
|
328
|
+
if (!options || typeof options !== "object") {
|
|
329
|
+
throw new AstroError({
|
|
330
|
+
...ExpectedImageOptions,
|
|
331
|
+
message: ExpectedImageOptions.message(JSON.stringify(options))
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
const service = await getConfiguredImageService();
|
|
335
|
+
const resolvedOptions = {
|
|
336
|
+
...options,
|
|
337
|
+
src: typeof options.src === "object" && "then" in options.src ? (await options.src).default ?? await options.src : options.src
|
|
338
|
+
};
|
|
339
|
+
const clonedSrc = isESMImportedImage(resolvedOptions.src) ? (
|
|
340
|
+
// @ts-expect-error - clone is a private, hidden prop
|
|
341
|
+
resolvedOptions.src.clone ?? resolvedOptions.src
|
|
342
|
+
) : resolvedOptions.src;
|
|
343
|
+
resolvedOptions.src = clonedSrc;
|
|
344
|
+
const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig) : resolvedOptions;
|
|
345
|
+
const srcSetTransforms = service.getSrcSet ? await service.getSrcSet(validatedOptions, imageConfig) : [];
|
|
346
|
+
let imageURL = await service.getURL(validatedOptions, imageConfig);
|
|
347
|
+
let srcSets = await Promise.all(
|
|
348
|
+
srcSetTransforms.map(async (srcSet) => ({
|
|
349
|
+
transform: srcSet.transform,
|
|
350
|
+
url: await service.getURL(srcSet.transform, imageConfig),
|
|
351
|
+
descriptor: srcSet.descriptor,
|
|
352
|
+
attributes: srcSet.attributes
|
|
353
|
+
}))
|
|
354
|
+
);
|
|
355
|
+
if (isLocalService(service) && globalThis.astroAsset.addStaticImage && !(isRemoteImage(validatedOptions.src) && imageURL === validatedOptions.src)) {
|
|
356
|
+
const propsToHash = service.propertiesToHash ?? DEFAULT_HASH_PROPS;
|
|
357
|
+
imageURL = globalThis.astroAsset.addStaticImage(validatedOptions, propsToHash);
|
|
358
|
+
srcSets = srcSetTransforms.map((srcSet) => ({
|
|
359
|
+
transform: srcSet.transform,
|
|
360
|
+
url: globalThis.astroAsset.addStaticImage(srcSet.transform, propsToHash),
|
|
361
|
+
descriptor: srcSet.descriptor,
|
|
362
|
+
attributes: srcSet.attributes
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
rawOptions: resolvedOptions,
|
|
367
|
+
options: validatedOptions,
|
|
368
|
+
src: imageURL,
|
|
369
|
+
srcSet: {
|
|
370
|
+
values: srcSets,
|
|
371
|
+
attribute: srcSets.map((srcSet) => `${srcSet.url} ${srcSet.descriptor}`).join(", ")
|
|
372
|
+
},
|
|
373
|
+
attributes: service.getHTMLAttributes !== void 0 ? await service.getHTMLAttributes(validatedOptions, imageConfig) : {}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
let sharp;
|
|
378
|
+
const qualityTable = {
|
|
379
|
+
low: 25,
|
|
380
|
+
mid: 50,
|
|
381
|
+
high: 80,
|
|
382
|
+
max: 100
|
|
383
|
+
};
|
|
384
|
+
async function loadSharp() {
|
|
385
|
+
let sharpImport;
|
|
386
|
+
try {
|
|
387
|
+
sharpImport = (await import('sharp')).default;
|
|
388
|
+
} catch (e) {
|
|
389
|
+
throw new AstroError(MissingSharp);
|
|
390
|
+
}
|
|
391
|
+
return sharpImport;
|
|
392
|
+
}
|
|
393
|
+
const sharpService = {
|
|
394
|
+
validateOptions: baseService.validateOptions,
|
|
395
|
+
getURL: baseService.getURL,
|
|
396
|
+
parseURL: baseService.parseURL,
|
|
397
|
+
getHTMLAttributes: baseService.getHTMLAttributes,
|
|
398
|
+
getSrcSet: baseService.getSrcSet,
|
|
399
|
+
async transform(inputBuffer, transformOptions) {
|
|
400
|
+
if (!sharp)
|
|
401
|
+
sharp = await loadSharp();
|
|
402
|
+
const transform = transformOptions;
|
|
403
|
+
if (transform.format === "svg")
|
|
404
|
+
return { data: inputBuffer, format: "svg" };
|
|
405
|
+
let result = sharp(inputBuffer, { failOnError: false, pages: -1 });
|
|
406
|
+
result.rotate();
|
|
407
|
+
if (transform.height && !transform.width) {
|
|
408
|
+
result.resize({ height: Math.round(transform.height) });
|
|
409
|
+
} else if (transform.width) {
|
|
410
|
+
result.resize({ width: Math.round(transform.width) });
|
|
411
|
+
}
|
|
412
|
+
if (transform.format) {
|
|
413
|
+
let quality = void 0;
|
|
414
|
+
if (transform.quality) {
|
|
415
|
+
const parsedQuality = parseQuality(transform.quality);
|
|
416
|
+
if (typeof parsedQuality === "number") {
|
|
417
|
+
quality = parsedQuality;
|
|
418
|
+
} else {
|
|
419
|
+
quality = transform.quality in qualityTable ? qualityTable[transform.quality] : void 0;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
result.toFormat(transform.format, { quality });
|
|
423
|
+
}
|
|
424
|
+
const { data, info } = await result.toBuffer({ resolveWithObject: true });
|
|
425
|
+
return {
|
|
426
|
+
data,
|
|
427
|
+
format: info.format
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
var sharp_default = sharpService;
|
|
432
|
+
|
|
433
|
+
const sharp$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
434
|
+
__proto__: null,
|
|
435
|
+
default: sharp_default
|
|
436
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
437
|
+
|
|
438
|
+
export { getConfiguredImageService as a, isRemotePath as b, isRemoteAllowed as c, appendForwardSlash as d, collapseDuplicateSlashes as e, getImage as g, isESMImportedImage as i, joinPaths as j, prependForwardSlash as p, removeTrailingForwardSlash as r, slash as s, trimSlashes as t };
|