brease-client 0.8.2 → 0.9.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/README.md +170 -22
- package/dist/astro.js +2 -3
- package/dist/chunk-ES4KMYDH.js +771 -0
- package/dist/{chunk-QZXUMDB7.js → chunk-VQGKMILO.js} +9 -2
- package/dist/cli.cjs +892 -39
- package/dist/cli.js +262 -20
- package/dist/html.js +1 -2
- package/dist/image.cjs +2 -2
- package/dist/image.d.cts +7 -3
- package/dist/image.d.ts +7 -3
- package/dist/image.js +2 -2
- package/dist/index.cjs +412 -46
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +2 -3
- package/dist/next.cjs +89 -42
- package/dist/next.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-CQZLTZGN.js +0 -79
- package/dist/chunk-MWTYINWA.js +0 -383
- package/dist/chunk-N3QOL5EU.js +0 -10
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,204 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { SECTION_FOLDERS, checkSections } from './chunk-
|
|
2
|
+
import { createBrease, SECTION_FOLDERS, checkSections, matchRedirect, renderTemplate } from './chunk-ES4KMYDH.js';
|
|
3
|
+
import './chunk-VQGKMILO.js';
|
|
3
4
|
import './chunk-PKBMQBKP.js';
|
|
4
|
-
import { existsSync, readFileSync,
|
|
5
|
-
import { join,
|
|
5
|
+
import { existsSync, readFileSync, rmSync, mkdirSync, writeFileSync, statSync, cpSync, readdirSync } from 'fs';
|
|
6
|
+
import { relative, join, dirname, extname } from 'path';
|
|
7
|
+
import { createServer } from 'http';
|
|
6
8
|
|
|
9
|
+
var TEMPLATES_DIR = "templates";
|
|
10
|
+
var NOT_ASSETS = /* @__PURE__ */ new Set([
|
|
11
|
+
TEMPLATES_DIR,
|
|
12
|
+
"dist",
|
|
13
|
+
"node_modules",
|
|
14
|
+
"scripts",
|
|
15
|
+
".brease",
|
|
16
|
+
"brease-seed",
|
|
17
|
+
".git",
|
|
18
|
+
".vercel",
|
|
19
|
+
".github",
|
|
20
|
+
"package.json",
|
|
21
|
+
"package-lock.json",
|
|
22
|
+
"pnpm-lock.yaml",
|
|
23
|
+
"yarn.lock",
|
|
24
|
+
"bun.lock",
|
|
25
|
+
"BREASE.md",
|
|
26
|
+
"README.md",
|
|
27
|
+
"vercel.json",
|
|
28
|
+
"wrangler.toml",
|
|
29
|
+
"wrangler.jsonc"
|
|
30
|
+
]);
|
|
31
|
+
var MIME = {
|
|
32
|
+
".html": "text/html; charset=utf-8",
|
|
33
|
+
".css": "text/css",
|
|
34
|
+
".js": "text/javascript",
|
|
35
|
+
".mjs": "text/javascript",
|
|
36
|
+
".json": "application/json",
|
|
37
|
+
".svg": "image/svg+xml",
|
|
38
|
+
".png": "image/png",
|
|
39
|
+
".jpg": "image/jpeg",
|
|
40
|
+
".jpeg": "image/jpeg",
|
|
41
|
+
".webp": "image/webp",
|
|
42
|
+
".avif": "image/avif",
|
|
43
|
+
".gif": "image/gif",
|
|
44
|
+
".ico": "image/x-icon",
|
|
45
|
+
".woff": "font/woff",
|
|
46
|
+
".woff2": "font/woff2",
|
|
47
|
+
".txt": "text/plain",
|
|
48
|
+
".xml": "application/xml",
|
|
49
|
+
".pdf": "application/pdf",
|
|
50
|
+
".mp4": "video/mp4",
|
|
51
|
+
".webm": "video/webm"
|
|
52
|
+
};
|
|
53
|
+
function templateFor(root, page) {
|
|
54
|
+
const dir = join(root, TEMPLATES_DIR);
|
|
55
|
+
const candidates = [
|
|
56
|
+
page.template ? `${page.template}.html` : null,
|
|
57
|
+
page.slug === "" ? "home.html" : null,
|
|
58
|
+
"page.html"
|
|
59
|
+
].filter((c) => !!c);
|
|
60
|
+
for (const name of candidates) if (existsSync(join(dir, name))) return join(dir, name);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
var navigationKeys = (html) => [
|
|
64
|
+
...new Set([...html.matchAll(/data-brease="nav:([^"]+)"/g)].map((m) => m[1]))
|
|
65
|
+
];
|
|
66
|
+
async function renderPage(brease, root, slug, locale) {
|
|
67
|
+
const page = await brease.getPage(slug, { locale });
|
|
68
|
+
if (!page) return null;
|
|
69
|
+
const file = templateFor(root, {
|
|
70
|
+
slug,
|
|
71
|
+
template: page.content.template ?? page.template
|
|
72
|
+
});
|
|
73
|
+
if (!file) throw new Error(`No template for "${slug || "home"}": add ${TEMPLATES_DIR}/page.html`);
|
|
74
|
+
const template = readFileSync(file, "utf8");
|
|
75
|
+
const [global, navigations] = await Promise.all([
|
|
76
|
+
template.includes("_global:") ? brease.getPage("_global", { locale }).catch(() => null) : null,
|
|
77
|
+
Promise.all(
|
|
78
|
+
navigationKeys(template).map(async (key) => [
|
|
79
|
+
key,
|
|
80
|
+
await brease.getNavigation(key, { locale }).catch(() => null)
|
|
81
|
+
])
|
|
82
|
+
)
|
|
83
|
+
]);
|
|
84
|
+
return renderTemplate(template, {
|
|
85
|
+
page,
|
|
86
|
+
global,
|
|
87
|
+
navigations: Object.fromEntries(navigations)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
var outFile = (out, path) => join(out, ...path, "index.html");
|
|
91
|
+
function copyAssets(root, out) {
|
|
92
|
+
for (const name of readdirSync(root)) {
|
|
93
|
+
if (NOT_ASSETS.has(name) || name.startsWith(".env")) continue;
|
|
94
|
+
if (name.endsWith(".html") && statSync(join(root, name)).isFile()) continue;
|
|
95
|
+
cpSync(join(root, name), join(out, name), { recursive: true });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function build(brease, opts = {}) {
|
|
99
|
+
const root = opts.root ?? process.cwd();
|
|
100
|
+
const out = join(root, opts.out ?? "dist");
|
|
101
|
+
rmSync(out, { recursive: true, force: true });
|
|
102
|
+
mkdirSync(out, { recursive: true });
|
|
103
|
+
copyAssets(root, out);
|
|
104
|
+
const pages = [];
|
|
105
|
+
for (const { path } of await brease.routes()) {
|
|
106
|
+
const route = await brease.route(path);
|
|
107
|
+
if (!route) continue;
|
|
108
|
+
const html = await renderPage(brease, root, route.slug, route.locale);
|
|
109
|
+
if (!html) continue;
|
|
110
|
+
const file = outFile(out, path);
|
|
111
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
112
|
+
writeFileSync(file, html);
|
|
113
|
+
pages.push(`/${path.join("/")}`);
|
|
114
|
+
}
|
|
115
|
+
await writeHostOutput(await brease.getRedirects().catch(() => []), out, opts.host ?? detectHost());
|
|
116
|
+
return { pages, out };
|
|
117
|
+
}
|
|
118
|
+
var detectHost = () => process.env.VERCEL ? "vercel" : process.env.CF_PAGES || process.env.WORKERS_CI ? "cloudflare" : null;
|
|
119
|
+
async function writeHostOutput(redirects, out, host) {
|
|
120
|
+
const lines = redirects.map((r) => `${r.source} ${r.destination} ${r.status}`);
|
|
121
|
+
writeFileSync(join(out, "_redirects"), lines.length ? `${lines.join("\n")}
|
|
122
|
+
` : "");
|
|
123
|
+
if (host !== "vercel") return;
|
|
124
|
+
const vercel = join(dirname(out), ".vercel", "output");
|
|
125
|
+
rmSync(vercel, { recursive: true, force: true });
|
|
126
|
+
mkdirSync(vercel, { recursive: true });
|
|
127
|
+
cpSync(out, join(vercel, "static"), { recursive: true });
|
|
128
|
+
const routes = redirects.map((r) => ({
|
|
129
|
+
src: `^${vercelSource(r.source)}/?$`,
|
|
130
|
+
headers: { Location: r.destination.replace(/:(\w+)\*?/g, "$$$1") },
|
|
131
|
+
status: r.status
|
|
132
|
+
}));
|
|
133
|
+
writeFileSync(
|
|
134
|
+
join(vercel, "config.json"),
|
|
135
|
+
JSON.stringify({ version: 3, routes: [...routes, { handle: "filesystem" }] }, null, 2)
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
var vercelSource = (source) => source.split(/(:\w+\*?)/).map(
|
|
139
|
+
(part) => part.startsWith(":") ? part.endsWith("*") ? `(?<${part.slice(1, -1)}>.*)` : `(?<${part.slice(1)}>[^/]+)` : part.replace(/[.+?^${}()|[\]\\*]/g, "\\$&")
|
|
140
|
+
).join("");
|
|
141
|
+
function serve(brease, opts = {}) {
|
|
142
|
+
const root = opts.root ?? process.cwd();
|
|
143
|
+
const server = createServer(async (req, res) => {
|
|
144
|
+
try {
|
|
145
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
146
|
+
const pathname = decodeURIComponent(url.pathname);
|
|
147
|
+
const asset = join(root, pathname);
|
|
148
|
+
const inRoot = !relative(root, asset).startsWith("..");
|
|
149
|
+
const top = pathname.split("/")[1] ?? "";
|
|
150
|
+
if (inRoot && !NOT_ASSETS.has(top) && existsSync(asset) && statSync(asset).isFile() && !asset.endsWith(".html")) {
|
|
151
|
+
res.writeHead(200, {
|
|
152
|
+
"content-type": MIME[extname(asset).toLowerCase()] ?? "application/octet-stream"
|
|
153
|
+
});
|
|
154
|
+
res.end(readFileSync(asset));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const hit = matchRedirect(await brease.getRedirects().catch(() => []), pathname);
|
|
158
|
+
if (hit) {
|
|
159
|
+
res.writeHead(hit.status, { location: hit.destination });
|
|
160
|
+
res.end();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const route = await brease.route(pathname.split("/").filter(Boolean));
|
|
164
|
+
const html = route && await renderPage(brease, root, route.slug, route.locale);
|
|
165
|
+
res.writeHead(html ? 200 : 404, { "content-type": MIME[".html"] });
|
|
166
|
+
res.end(html ?? "Not found");
|
|
167
|
+
} catch (err) {
|
|
168
|
+
res.writeHead(500, { "content-type": "text/plain" });
|
|
169
|
+
res.end(`Brease couldn't render this page: ${err.message}`);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
server.listen(opts.port ?? Number(process.env.PORT ?? 3e3));
|
|
173
|
+
return server;
|
|
174
|
+
}
|
|
175
|
+
async function exportContent(brease, navigationKeys2 = []) {
|
|
176
|
+
const site = await brease.getSite();
|
|
177
|
+
const pages = {};
|
|
178
|
+
const navigations = {};
|
|
179
|
+
const global = {};
|
|
180
|
+
for (const locale of site.locales) {
|
|
181
|
+
pages[locale] = {};
|
|
182
|
+
for (const ref of await brease.getPages({ locale })) {
|
|
183
|
+
const page = await brease.getPage(ref.slug, { locale });
|
|
184
|
+
if (page) pages[locale][ref.slug] = page;
|
|
185
|
+
}
|
|
186
|
+
navigations[locale] = Object.fromEntries(
|
|
187
|
+
await Promise.all(
|
|
188
|
+
navigationKeys2.map(async (k) => [k, await brease.getNavigation(k, { locale }).catch(() => null)])
|
|
189
|
+
)
|
|
190
|
+
);
|
|
191
|
+
global[locale] = await brease.getPage("_global", { locale }).catch(() => null);
|
|
192
|
+
}
|
|
193
|
+
return { site, pages, navigations, global, redirects: await brease.getRedirects().catch(() => []) };
|
|
194
|
+
}
|
|
195
|
+
function writeJson(file, value) {
|
|
196
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
197
|
+
writeFileSync(file, `${JSON.stringify(value, null, 2)}
|
|
198
|
+
`);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/cli.ts
|
|
7
202
|
function walk(dir, out = []) {
|
|
8
203
|
for (const name of readdirSync(dir)) {
|
|
9
204
|
if (name === "node_modules") continue;
|
|
@@ -30,22 +225,69 @@ function pagesIn(root) {
|
|
|
30
225
|
}
|
|
31
226
|
return pages;
|
|
32
227
|
}
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
228
|
+
var USAGE = `Usage:
|
|
229
|
+
brease-client check the sections convention
|
|
230
|
+
brease-client build [--out dist] render every page from templates/ into dist/ (sites without a framework)
|
|
231
|
+
brease-client serve the same pages, rendered per request on $PORT (the editor's preview)
|
|
232
|
+
brease-client output <dir> write Brease's redirects for the host next to built files in <dir>
|
|
233
|
+
brease-client content <file.json> [--nav main,footer] [--watch]
|
|
234
|
+
the content a browser-only app imports at build time`;
|
|
235
|
+
var [command, ...args] = process.argv.slice(2);
|
|
236
|
+
var flag = (name) => {
|
|
237
|
+
const at = args.indexOf(`--${name}`);
|
|
238
|
+
return at === -1 ? void 0 : args[at + 1] ?? "";
|
|
239
|
+
};
|
|
240
|
+
function check() {
|
|
241
|
+
const cwd = process.cwd();
|
|
242
|
+
const folder = SECTION_FOLDERS.find((f) => existsSync(join(cwd, f)));
|
|
243
|
+
if (!folder) {
|
|
244
|
+
console.log("No sections folder (src/brease/sections or brease/sections): nothing to check.");
|
|
245
|
+
process.exit(0);
|
|
246
|
+
}
|
|
247
|
+
const files = Object.fromEntries(
|
|
248
|
+
walk(join(cwd, folder)).map((p) => [relative(cwd, p).split("\\").join("/"), readFileSync(p, "utf8")])
|
|
249
|
+
);
|
|
250
|
+
const content = ["brease-seed", ".brease"].map((d) => join(cwd, d)).find((d) => existsSync(d));
|
|
251
|
+
const warnings = checkSections(files, content ? pagesIn(content) : {});
|
|
252
|
+
for (const w of warnings) console.log(`warning: ${w}`);
|
|
253
|
+
console.log(warnings.length ? `${warnings.length} warning(s)` : "Sections look right.");
|
|
254
|
+
process.exit(warnings.length ? 1 : 0);
|
|
255
|
+
}
|
|
256
|
+
async function main() {
|
|
257
|
+
if (command === "check") return check();
|
|
258
|
+
if (command === "build") {
|
|
259
|
+
const { pages, out } = await build(createBrease(), { out: flag("out") });
|
|
260
|
+
console.log(`Rendered ${pages.length} page(s) into ${relative(process.cwd(), out) || "."}`);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (command === "serve") {
|
|
264
|
+
serve(createBrease());
|
|
265
|
+
console.log(`Serving on port ${process.env.PORT ?? 3e3}`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (command === "output" && args[0]) {
|
|
269
|
+
await writeHostOutput(await createBrease().getRedirects(), join(process.cwd(), args[0]), detectHost());
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (command === "content" && args[0]) {
|
|
273
|
+
const file = join(process.cwd(), args[0]);
|
|
274
|
+
const keys = (flag("nav") ?? "").split(",").filter(Boolean);
|
|
275
|
+
const brease = createBrease();
|
|
276
|
+
let last = "";
|
|
277
|
+
const write = async () => {
|
|
278
|
+
const json = JSON.stringify(await exportContent(brease, keys));
|
|
279
|
+
if (json === last) return;
|
|
280
|
+
last = json;
|
|
281
|
+
writeJson(file, JSON.parse(json));
|
|
282
|
+
};
|
|
283
|
+
await write();
|
|
284
|
+
if (args.includes("--watch")) setInterval(() => void write().catch((e) => console.warn(e.message)), 2e3);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
console.log(USAGE);
|
|
36
288
|
process.exit(command ? 1 : 0);
|
|
37
289
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
process.exit(0);
|
|
43
|
-
}
|
|
44
|
-
var files = Object.fromEntries(
|
|
45
|
-
walk(join(cwd, folder)).map((p) => [relative(cwd, p).split("\\").join("/"), readFileSync(p, "utf8")])
|
|
46
|
-
);
|
|
47
|
-
var content = ["brease-seed", ".brease"].map((d) => join(cwd, d)).find((d) => existsSync(d));
|
|
48
|
-
var warnings = checkSections(files, content ? pagesIn(content) : {});
|
|
49
|
-
for (const w of warnings) console.log(`warning: ${w}`);
|
|
50
|
-
console.log(warnings.length ? `${warnings.length} warning(s)` : "Sections look right.");
|
|
51
|
-
process.exit(warnings.length ? 1 : 0);
|
|
290
|
+
main().catch((err) => {
|
|
291
|
+
console.error(err instanceof Error ? err.message : err);
|
|
292
|
+
process.exit(1);
|
|
293
|
+
});
|
package/dist/html.js
CHANGED
package/dist/image.cjs
CHANGED
|
@@ -8,14 +8,14 @@ function imageUrl(src, _opts = {}) {
|
|
|
8
8
|
function srcset(_src, _opts = {}) {
|
|
9
9
|
return "";
|
|
10
10
|
}
|
|
11
|
-
function imageProps(image,
|
|
11
|
+
function imageProps(image, _opts = {}) {
|
|
12
12
|
const src = typeof image === "string" ? image : image.url;
|
|
13
13
|
const extra = typeof image === "string" ? {} : {
|
|
14
14
|
...image.alt !== void 0 ? { alt: image.alt } : {},
|
|
15
15
|
...image.width ? { width: image.width } : {},
|
|
16
16
|
...image.height ? { height: image.height } : {}
|
|
17
17
|
};
|
|
18
|
-
return { src
|
|
18
|
+
return { src, ...extra };
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
exports.DEFAULT_WIDTHS = DEFAULT_WIDTHS;
|
package/dist/image.d.cts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { B as BreaseImage } from './types-D5mwpqAP.cjs';
|
|
2
2
|
|
|
3
|
+
/** @deprecated Brease doesn't resize images; ignored. */
|
|
3
4
|
type Resize = 'cover' | 'contain' | 'fill';
|
|
5
|
+
/** @deprecated Brease doesn't resize images; ignored. */
|
|
4
6
|
type ImageOptions = {
|
|
5
7
|
width?: number;
|
|
6
8
|
height?: number;
|
|
7
9
|
quality?: number;
|
|
8
10
|
resize?: Resize;
|
|
9
11
|
};
|
|
12
|
+
/** @deprecated Not used by Brease. */
|
|
10
13
|
declare const DEFAULT_WIDTHS: number[];
|
|
11
14
|
declare function imageUrl(src: string, _opts?: ImageOptions): string;
|
|
15
|
+
/** @deprecated Always empty: Brease doesn't resize images. */
|
|
12
16
|
declare function srcset(_src: string, _opts?: {
|
|
13
17
|
widths?: number[];
|
|
14
18
|
quality?: number;
|
|
15
19
|
resize?: Resize;
|
|
16
20
|
}): string;
|
|
17
|
-
declare function imageProps(image: string | BreaseImage,
|
|
21
|
+
declare function imageProps(image: string | BreaseImage, _opts?: {
|
|
18
22
|
sizes?: string;
|
|
19
23
|
widths?: number[];
|
|
20
24
|
width?: number;
|
|
@@ -22,8 +26,8 @@ declare function imageProps(image: string | BreaseImage, opts?: {
|
|
|
22
26
|
quality?: number;
|
|
23
27
|
}): {
|
|
24
28
|
src: string;
|
|
25
|
-
srcSet
|
|
26
|
-
sizes
|
|
29
|
+
srcSet?: string;
|
|
30
|
+
sizes?: string;
|
|
27
31
|
alt?: string;
|
|
28
32
|
width?: number;
|
|
29
33
|
height?: number;
|
package/dist/image.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { B as BreaseImage } from './types-D5mwpqAP.js';
|
|
2
2
|
|
|
3
|
+
/** @deprecated Brease doesn't resize images; ignored. */
|
|
3
4
|
type Resize = 'cover' | 'contain' | 'fill';
|
|
5
|
+
/** @deprecated Brease doesn't resize images; ignored. */
|
|
4
6
|
type ImageOptions = {
|
|
5
7
|
width?: number;
|
|
6
8
|
height?: number;
|
|
7
9
|
quality?: number;
|
|
8
10
|
resize?: Resize;
|
|
9
11
|
};
|
|
12
|
+
/** @deprecated Not used by Brease. */
|
|
10
13
|
declare const DEFAULT_WIDTHS: number[];
|
|
11
14
|
declare function imageUrl(src: string, _opts?: ImageOptions): string;
|
|
15
|
+
/** @deprecated Always empty: Brease doesn't resize images. */
|
|
12
16
|
declare function srcset(_src: string, _opts?: {
|
|
13
17
|
widths?: number[];
|
|
14
18
|
quality?: number;
|
|
15
19
|
resize?: Resize;
|
|
16
20
|
}): string;
|
|
17
|
-
declare function imageProps(image: string | BreaseImage,
|
|
21
|
+
declare function imageProps(image: string | BreaseImage, _opts?: {
|
|
18
22
|
sizes?: string;
|
|
19
23
|
widths?: number[];
|
|
20
24
|
width?: number;
|
|
@@ -22,8 +26,8 @@ declare function imageProps(image: string | BreaseImage, opts?: {
|
|
|
22
26
|
quality?: number;
|
|
23
27
|
}): {
|
|
24
28
|
src: string;
|
|
25
|
-
srcSet
|
|
26
|
-
sizes
|
|
29
|
+
srcSet?: string;
|
|
30
|
+
sizes?: string;
|
|
27
31
|
alt?: string;
|
|
28
32
|
width?: number;
|
|
29
33
|
height?: number;
|
package/dist/image.js
CHANGED
|
@@ -8,14 +8,14 @@ function imageUrl(src, _opts = {}) {
|
|
|
8
8
|
function srcset(_src, _opts = {}) {
|
|
9
9
|
return "";
|
|
10
10
|
}
|
|
11
|
-
function imageProps(image,
|
|
11
|
+
function imageProps(image, _opts = {}) {
|
|
12
12
|
const src = typeof image === "string" ? image : image.url;
|
|
13
13
|
const extra = typeof image === "string" ? {} : {
|
|
14
14
|
...image.alt !== void 0 ? { alt: image.alt } : {},
|
|
15
15
|
...image.width ? { width: image.width } : {},
|
|
16
16
|
...image.height ? { height: image.height } : {}
|
|
17
17
|
};
|
|
18
|
-
return { src
|
|
18
|
+
return { src, ...extra };
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export { DEFAULT_WIDTHS, imageProps, imageUrl, srcset };
|