qarpeo 0.3.5 → 0.4.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/dist/chunks/{tools.mjs → manifest.get.mjs} +229 -3
- package/dist/cli/index.mjs +74 -5
- package/dist/features/console.d.ts +4 -0
- package/dist/module.mjs +287 -56
- package/dist/runtime/app/components/{BlobImage.vue → QImg.vue} +5 -4
- package/dist/runtime/app/composables/console.d.ts +60 -0
- package/dist/runtime/app/composables/console.mjs +169 -0
- package/dist/runtime/app/composables/pwa.d.ts +34 -0
- package/dist/runtime/app/composables/pwa.mjs +86 -0
- package/dist/runtime/app/composables/rbac.d.ts +33 -0
- package/dist/runtime/app/composables/rbac.mjs +60 -0
- package/dist/runtime/app/composables/site.d.ts +73 -0
- package/dist/runtime/app/composables/site.mjs +174 -1
- package/dist/runtime/app/middleware/console.global.d.ts +2 -0
- package/dist/runtime/app/middleware/console.global.mjs +37 -0
- package/dist/runtime/app/plugins/pwa.client.d.ts +2 -0
- package/dist/runtime/app/plugins/pwa.client.mjs +28 -0
- package/dist/runtime/app/plugins/pwa.d.ts +2 -0
- package/dist/runtime/app/plugins/pwa.mjs +42 -0
- package/dist/runtime/app/plugins/seo.mjs +39 -10
- package/dist/runtime/server/routes/__qarpeo/cloud/agents/run.post.d.ts +13 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/agents/run.post.mjs +46 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.get.d.ts +22 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.get.mjs +40 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.d.ts +20 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.mjs +52 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.d.ts +26 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.mjs +80 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.d.ts +16 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.mjs +30 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/comments.get.d.ts +21 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/comments.get.mjs +49 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.d.ts +22 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.mjs +65 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/mail/unsuppress.post.d.ts +12 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/mail/unsuppress.post.mjs +17 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/cms.post.d.ts +22 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/cms.post.mjs +87 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/products.post.d.ts +25 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/products.post.mjs +119 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/users.post.d.ts +19 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate/users.post.mjs +86 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.d.ts +21 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.mjs +91 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/notifications/test.post.d.ts +13 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/notifications/test.post.mjs +49 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/operations.get.d.ts +43 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/operations.get.mjs +111 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/overview.get.d.ts +22 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/overview.get.mjs +44 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.d.ts +9 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.mjs +27 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.d.ts +23 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.mjs +56 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/store/products.get.d.ts +21 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/store/products.get.mjs +50 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/tasks/run.post.d.ts +12 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/tasks/run.post.mjs +24 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.d.ts +26 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.mjs +40 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/users.get.d.ts +39 -0
- package/dist/runtime/server/routes/__qarpeo/cloud/users.get.mjs +69 -0
- package/dist/runtime/server/routes/__qarpeo/manifest.get.d.ts +39 -0
- package/dist/runtime/server/routes/__qarpeo/manifest.get.mjs +226 -0
- package/dist/runtime/server/routes/__qarpeo/og.get.d.ts +15 -0
- package/dist/runtime/server/routes/__qarpeo/og.get.mjs +109 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/me.get.d.ts +26 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/me.get.mjs +23 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.d.ts +12 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.mjs +12 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.d.ts +16 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.mjs +15 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.d.ts +11 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.mjs +16 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/users.post.d.ts +14 -0
- package/dist/runtime/server/routes/__qarpeo/rbac/users.post.mjs +19 -0
- package/dist/runtime/server/routes/manifest.webmanifest.get.d.ts +2 -0
- package/dist/runtime/server/routes/manifest.webmanifest.get.mjs +31 -0
- package/dist/runtime/server/routes/robots.txt.get.mjs +20 -4
- package/dist/runtime/server/routes/sitemap.xml.get.mjs +47 -6
- package/dist/runtime/server/routes/sw.js.get.d.ts +8 -0
- package/dist/runtime/server/routes/sw.js.get.mjs +141 -0
- package/dist/runtime/server/utils/auth.d.ts +2 -14
- package/dist/runtime/server/utils/auth.mjs +32 -36
- package/dist/runtime/server/utils/cloud-auth.d.ts +8 -0
- package/dist/runtime/server/utils/cloud-auth.mjs +23 -0
- package/dist/runtime/server/utils/console.d.ts +19 -0
- package/dist/runtime/server/utils/console.mjs +34 -0
- package/dist/runtime/server/utils/legacy-hash.d.ts +76 -0
- package/dist/runtime/server/utils/legacy-hash.mjs +96 -0
- package/dist/runtime/server/utils/rbac.d.ts +89 -0
- package/dist/runtime/server/utils/rbac.mjs +427 -0
- package/dist/runtime/server/utils/role-env.d.ts +19 -0
- package/dist/runtime/server/utils/role-env.mjs +34 -0
- package/dist/runtime/server.d.ts +2 -0
- package/dist/runtime/server.mjs +2 -0
- package/dist/types/console.d.ts +67 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/options.d.ts +9 -0
- package/dist/types/site.d.ts +102 -0
- package/dist/types/storage.d.ts +5 -11
- package/package.json +1 -1
- package/dist/runtime/providers/qarpeo.d.ts +0 -23
- package/dist/runtime/providers/qarpeo.mjs +0 -46
package/dist/types/options.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { AuthOptions, EmailOptions } from "./auth";
|
|
|
7
7
|
import type { CacheOptions } from "./cache";
|
|
8
8
|
import type { CMSOptions } from "./cms";
|
|
9
9
|
import type { CommentsOptions } from "./comments";
|
|
10
|
+
import type { ConsoleOptions } from "./console";
|
|
10
11
|
import type { DbOptions } from "./db";
|
|
11
12
|
import type { JobsOptions } from "./jobs";
|
|
12
13
|
import type { MailOptions } from "./email";
|
|
@@ -74,6 +75,8 @@ export interface QarpeoOptions {
|
|
|
74
75
|
site?: QarpeoSiteConfig;
|
|
75
76
|
/** Native SEO engine configuration (alias for site config) */
|
|
76
77
|
seo?: boolean | QarpeoSiteConfig;
|
|
78
|
+
/** Native Edge PWA configuration (manifest.webmanifest, /sw.js, and usePwa composable) */
|
|
79
|
+
pwa?: boolean | import("./site").QarpeoPwaConfig;
|
|
77
80
|
/**
|
|
78
81
|
* Cloudflare Worker service name override.
|
|
79
82
|
*
|
|
@@ -320,6 +323,12 @@ export interface QarpeoOptions {
|
|
|
320
323
|
* @default false
|
|
321
324
|
*/
|
|
322
325
|
store?: boolean | StoreOptions;
|
|
326
|
+
/**
|
|
327
|
+
* Website-injected `/console` staff & operations workspace plumbing (RBAC guards, composables, and nav builder).
|
|
328
|
+
*
|
|
329
|
+
* @default false
|
|
330
|
+
*/
|
|
331
|
+
console?: boolean | ConsoleOptions;
|
|
323
332
|
/**
|
|
324
333
|
* Configuration for Qarpeo DevTools (Dev-Only Management Console & DevTools panel).
|
|
325
334
|
*
|
package/dist/types/site.d.ts
CHANGED
|
@@ -54,6 +54,71 @@ export interface DocsVersionItem {
|
|
|
54
54
|
/** Whether this version is archived / deprecated */
|
|
55
55
|
isArchived?: boolean;
|
|
56
56
|
}
|
|
57
|
+
export interface PwaIconConfig {
|
|
58
|
+
/** Icon URL path (e.g. "/icons/icon-192.png") */
|
|
59
|
+
src: string;
|
|
60
|
+
/** Icon dimensions (e.g. "192x192", "512x512") */
|
|
61
|
+
sizes: string;
|
|
62
|
+
/** MIME type (e.g. "image/png", "image/svg+xml") */
|
|
63
|
+
type?: string;
|
|
64
|
+
/** Icon purpose ("any", "maskable", "monochrome") */
|
|
65
|
+
purpose?: "any" | "maskable" | "monochrome";
|
|
66
|
+
}
|
|
67
|
+
export interface PwaShortcutConfig {
|
|
68
|
+
name: string;
|
|
69
|
+
short_name?: string;
|
|
70
|
+
description?: string;
|
|
71
|
+
url: string;
|
|
72
|
+
icons?: PwaIconConfig[];
|
|
73
|
+
}
|
|
74
|
+
export interface QarpeoPwaConfig {
|
|
75
|
+
/** Enable or disable PWA manifest and service worker. Default: true when pwa object is provided */
|
|
76
|
+
enabled?: boolean;
|
|
77
|
+
/** Application name (defaults to site.name) */
|
|
78
|
+
name?: string;
|
|
79
|
+
/** Short name for home screen icon label (defaults to name) */
|
|
80
|
+
shortName?: string;
|
|
81
|
+
/** Application description (defaults to site.description) */
|
|
82
|
+
description?: string;
|
|
83
|
+
/** Start URL when launched from home screen. Default: "/" */
|
|
84
|
+
startUrl?: string;
|
|
85
|
+
/** Navigation scope. Default: "/" */
|
|
86
|
+
scope?: string;
|
|
87
|
+
/** Display mode. Default: "standalone" */
|
|
88
|
+
display?: "standalone" | "fullscreen" | "minimal-ui" | "browser";
|
|
89
|
+
/** Preferred screen orientation */
|
|
90
|
+
orientation?: "any" | "natural" | "landscape" | "portrait";
|
|
91
|
+
/** Theme color hex (used in manifest and <meta name="theme-color">). Default: "#0f172a" */
|
|
92
|
+
themeColor?: string;
|
|
93
|
+
/** Optional dark mode theme color (<meta name="theme-color" media="(prefers-color-scheme: dark)">) */
|
|
94
|
+
themeColorDark?: string;
|
|
95
|
+
/** Splash screen background color. Default: "#ffffff" */
|
|
96
|
+
backgroundColor?: string;
|
|
97
|
+
/** Language tag (defaults to site.defaultLocale || "en") */
|
|
98
|
+
lang?: string;
|
|
99
|
+
/** Text direction */
|
|
100
|
+
dir?: "ltr" | "rtl" | "auto";
|
|
101
|
+
/** Web App Manifest icons */
|
|
102
|
+
icons?: PwaIconConfig[];
|
|
103
|
+
/** Apple touch icon URL (defaults to first 180x180/192x192 icon if omitted) */
|
|
104
|
+
appleTouchIcon?: string;
|
|
105
|
+
/** App shortcuts */
|
|
106
|
+
shortcuts?: PwaShortcutConfig[];
|
|
107
|
+
/** App store categories */
|
|
108
|
+
categories?: string[];
|
|
109
|
+
/** Optional offline fallback HTML route (e.g. "/offline") */
|
|
110
|
+
offlinePage?: string;
|
|
111
|
+
/** Cache version identifier for Service Worker cache busting */
|
|
112
|
+
cacheVersion?: string;
|
|
113
|
+
/** URL prefixes cached with stale-while-revalidate (e.g. ["/api/cms/"]) */
|
|
114
|
+
cacheRoutes?: string[];
|
|
115
|
+
/** Additional URLs to precache on Service Worker install */
|
|
116
|
+
precacheUrls?: string[];
|
|
117
|
+
/** Auto-register /sw.js on client. Default: true */
|
|
118
|
+
register?: boolean;
|
|
119
|
+
/** Enable Web Push notification handlers in Service Worker. Default: false */
|
|
120
|
+
push?: boolean;
|
|
121
|
+
}
|
|
57
122
|
export interface SiteRobotsConfig {
|
|
58
123
|
/**
|
|
59
124
|
* Allow search engines to index the site. When false, generates Disallow: / on robots.txt and
|
|
@@ -64,12 +129,25 @@ export interface SiteRobotsConfig {
|
|
|
64
129
|
disallow?: string[];
|
|
65
130
|
/** Paths to allow in robots.txt. Defaults to ["/"] */
|
|
66
131
|
allow?: string[];
|
|
132
|
+
/** Block major AI training/scraping bots (GPTBot, CCBot, ClaudeBot, Google-Extended, etc.). Default: false */
|
|
133
|
+
blockAiBots?: boolean;
|
|
67
134
|
}
|
|
68
135
|
export interface SiteSitemapUrl {
|
|
69
136
|
loc: string;
|
|
70
137
|
lastmod?: string;
|
|
71
138
|
changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
|
|
72
139
|
priority?: number;
|
|
140
|
+
/** Alternate language URLs for xhtml:link hreflang */
|
|
141
|
+
alternates?: Array<{
|
|
142
|
+
hreflang: string;
|
|
143
|
+
href: string;
|
|
144
|
+
}>;
|
|
145
|
+
/** Images associated with this URL for Google Image Sitemap */
|
|
146
|
+
images?: Array<{
|
|
147
|
+
loc: string;
|
|
148
|
+
title?: string;
|
|
149
|
+
caption?: string;
|
|
150
|
+
}>;
|
|
73
151
|
}
|
|
74
152
|
export interface SiteSitemapConfig {
|
|
75
153
|
/** Automatically generate /sitemap.xml. Defaults to true when site.url is provided. */
|
|
@@ -78,6 +156,10 @@ export interface SiteSitemapConfig {
|
|
|
78
156
|
exclude?: string[];
|
|
79
157
|
/** Include published CMS entries from D1 database. Defaults to true. */
|
|
80
158
|
cms?: boolean;
|
|
159
|
+
/** Auto-discover static Nuxt pages at build time. Defaults to true. */
|
|
160
|
+
pages?: boolean;
|
|
161
|
+
/** Internal: static page paths discovered at build time */
|
|
162
|
+
discoveredPages?: string[];
|
|
81
163
|
/** Additional custom URLs to include in sitemap */
|
|
82
164
|
urls?: SiteSitemapUrl[];
|
|
83
165
|
}
|
|
@@ -93,6 +175,18 @@ export interface SiteFeedConfig {
|
|
|
93
175
|
/** Cache-Control max-age in seconds. Default: 3600. */
|
|
94
176
|
cacheMaxAge?: number;
|
|
95
177
|
}
|
|
178
|
+
export interface SiteOgImageConfig {
|
|
179
|
+
/** Enable dynamic /__qarpeo/og social card endpoint. Default: true when ogImage object is provided */
|
|
180
|
+
enabled?: boolean;
|
|
181
|
+
/** Visual theme for generated cards. Default: "dark" */
|
|
182
|
+
theme?: "dark" | "light" | "gradient";
|
|
183
|
+
/** Accent color hex. Default: "#3b82f6" */
|
|
184
|
+
themeColor?: string;
|
|
185
|
+
/** Optional logo URL rendered on the card */
|
|
186
|
+
logo?: string;
|
|
187
|
+
/** Cache-Control max-age in seconds. Default: 86400 (24h) */
|
|
188
|
+
cacheMaxAge?: number;
|
|
189
|
+
}
|
|
96
190
|
export interface QarpeoSiteConfig {
|
|
97
191
|
/** Project/site name (used for Cloudflare Worker name, SEO, emails, branding) */
|
|
98
192
|
name?: string;
|
|
@@ -118,4 +212,12 @@ export interface QarpeoSiteConfig {
|
|
|
118
212
|
feed?: boolean | SiteFeedConfig;
|
|
119
213
|
/** Auto-inject WebSite JSON-LD schema on root page. Default: true */
|
|
120
214
|
schemaOrg?: boolean;
|
|
215
|
+
/** Optional site search URL template for WebSite SearchAction JSON-LD (e.g. "/search?q={search_term_string}") */
|
|
216
|
+
searchUrl?: string;
|
|
217
|
+
/** Enforce or strip trailing slash in canonical URLs. Default: false (strip trailing slash) */
|
|
218
|
+
trailingSlash?: boolean;
|
|
219
|
+
/** Native Edge PWA configuration (manifest.webmanifest + Service Worker) */
|
|
220
|
+
pwa?: boolean | QarpeoPwaConfig;
|
|
221
|
+
/** Dynamic Edge OG Image generator (/__qarpeo/og) */
|
|
222
|
+
ogImage?: boolean | SiteOgImageConfig;
|
|
121
223
|
}
|
package/dist/types/storage.d.ts
CHANGED
|
@@ -92,23 +92,17 @@ export interface StorageOptions {
|
|
|
92
92
|
presets?: Record<string, StorageImagePreset>;
|
|
93
93
|
};
|
|
94
94
|
/**
|
|
95
|
-
* Automatically integrate `<
|
|
96
|
-
* their `src` props resolve R2 storage keys without custom slots
|
|
95
|
+
* Automatically integrate `<QImg>` with Nuxt UI components (`<UAvatar>`, `<UCard>`, etc.) so
|
|
96
|
+
* their `src` props resolve R2 storage keys without custom slots via `#build/ui-image-component`.
|
|
97
97
|
*
|
|
98
|
-
*
|
|
99
|
-
* sets it as the default provider.
|
|
100
|
-
* - When `@nuxt/image` is **not** installed, Qarpeo aliases Nuxt UI's internal image component to
|
|
101
|
-
* `<BlobImage>` via `#build/ui-image-component`.
|
|
102
|
-
*
|
|
103
|
-
* Set to `false` to opt out of all automatic Nuxt UI / image integration.
|
|
98
|
+
* Set to `false` to opt out of automatic Nuxt UI image integration.
|
|
104
99
|
*
|
|
105
100
|
* @default true
|
|
106
101
|
*/
|
|
107
102
|
ui?: boolean;
|
|
108
103
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* is the global default.
|
|
104
|
+
* Force-alias Nuxt UI's image slot (`#build/ui-image-component`) to `<QImg>` even when no
|
|
105
|
+
* explicit `binding` or `cdnUrl` is configured.
|
|
112
106
|
*
|
|
113
107
|
* Ignored when `ui` is `false`.
|
|
114
108
|
*
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface ProviderModifiers {
|
|
2
|
-
width?: number | string;
|
|
3
|
-
height?: number | string;
|
|
4
|
-
quality?: number | string;
|
|
5
|
-
format?: string;
|
|
6
|
-
fit?: string;
|
|
7
|
-
preset?: string;
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Official `@nuxt/image` provider for Qarpeo Cloudflare R2 Blob Storage.
|
|
12
|
-
*
|
|
13
|
-
* Automatically resolves R2 storage keys into Cloudflare Image Resizing CDN URLs (in production /
|
|
14
|
-
* when cdnURL is set) or local Qarpeo storage API endpoints (in development), with no external
|
|
15
|
-
* runtime dependencies.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getImage(src: string, { modifiers, baseURL, cdnURL, }?: {
|
|
18
|
-
modifiers?: ProviderModifiers;
|
|
19
|
-
baseURL?: string;
|
|
20
|
-
cdnURL?: string;
|
|
21
|
-
}): {
|
|
22
|
-
url: string;
|
|
23
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export function getImage(src, {
|
|
2
|
-
modifiers = {},
|
|
3
|
-
baseURL = "/api/storage/file",
|
|
4
|
-
cdnURL
|
|
5
|
-
} = {}) {
|
|
6
|
-
if (!src) return { url: "" };
|
|
7
|
-
if (src.startsWith("http://") || src.startsWith("https://") || src.startsWith("data:")) {
|
|
8
|
-
return { url: src };
|
|
9
|
-
}
|
|
10
|
-
const cleanKey = src.replace(/^\/+/, "");
|
|
11
|
-
let assetBase;
|
|
12
|
-
if (cdnURL) {
|
|
13
|
-
assetBase = `${cdnURL.replace(/\/+$/, "")}/${cleanKey}`;
|
|
14
|
-
} else {
|
|
15
|
-
const base = baseURL.replace(/\/+$/, "");
|
|
16
|
-
assetBase = `${base}/${cleanKey}`;
|
|
17
|
-
}
|
|
18
|
-
const cfParts = [];
|
|
19
|
-
if (modifiers.width) cfParts.push(`width=${modifiers.width}`);
|
|
20
|
-
if (modifiers.height) cfParts.push(`height=${modifiers.height}`);
|
|
21
|
-
if (modifiers.quality) cfParts.push(`quality=${modifiers.quality}`);
|
|
22
|
-
if (modifiers.format) cfParts.push(`format=${modifiers.format}`);
|
|
23
|
-
if (modifiers.fit) cfParts.push(`fit=${modifiers.fit}`);
|
|
24
|
-
const useCloudflare = cfParts.length > 0 && (cdnURL || typeof process !== "undefined" && process.env?.NODE_ENV === "production" && !import.meta.dev);
|
|
25
|
-
if (useCloudflare) {
|
|
26
|
-
const cfParamStr = cfParts.join(",");
|
|
27
|
-
try {
|
|
28
|
-
const parsed = new URL(assetBase);
|
|
29
|
-
return {
|
|
30
|
-
url: `${parsed.origin}/cdn-cgi/image/${cfParamStr}${parsed.pathname}${parsed.search}`
|
|
31
|
-
};
|
|
32
|
-
} catch {
|
|
33
|
-
const cleanPath = assetBase.startsWith("/") ? assetBase : `/${assetBase}`;
|
|
34
|
-
return { url: `/cdn-cgi/image/${cfParamStr}${cleanPath}` };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const qs = new URLSearchParams();
|
|
38
|
-
if (modifiers.preset) qs.set("preset", String(modifiers.preset));
|
|
39
|
-
if (modifiers.width) qs.set("w", String(modifiers.width));
|
|
40
|
-
if (modifiers.height) qs.set("h", String(modifiers.height));
|
|
41
|
-
if (modifiers.quality) qs.set("q", String(modifiers.quality));
|
|
42
|
-
if (modifiers.format) qs.set("f", String(modifiers.format));
|
|
43
|
-
if (modifiers.fit) qs.set("fit", String(modifiers.fit));
|
|
44
|
-
const qsStr = qs.toString();
|
|
45
|
-
return { url: qsStr ? `${assetBase}?${qsStr}` : assetBase };
|
|
46
|
-
}
|