@dogsbay/format-astro 0.2.0-beta.115 → 0.2.0-beta.116
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/api-markdown.d.ts +8 -0
- package/dist/api-markdown.d.ts.map +1 -0
- package/dist/api-markdown.js +41 -0
- package/dist/api-markdown.js.map +1 -0
- package/dist/blog.d.ts.map +1 -1
- package/dist/blog.js +5 -1
- package/dist/blog.js.map +1 -1
- package/dist/browser.d.ts +14 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +14 -0
- package/dist/browser.js.map +1 -0
- package/dist/canonical.d.ts +34 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +107 -0
- package/dist/canonical.js.map +1 -0
- package/dist/head-metadata.d.ts +26 -0
- package/dist/head-metadata.d.ts.map +1 -0
- package/dist/head-metadata.js +56 -0
- package/dist/head-metadata.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/llms-txt.d.ts +3 -3
- package/dist/llms-txt.d.ts.map +1 -1
- package/dist/llms-txt.js +48 -242
- package/dist/llms-txt.js.map +1 -1
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +3 -1
- package/dist/plugins.js.map +1 -1
- package/dist/project.d.ts +36 -1
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +276 -841
- package/dist/project.js.map +1 -1
- package/dist/redirects.d.ts +22 -0
- package/dist/redirects.d.ts.map +1 -1
- package/dist/redirects.js +70 -123
- package/dist/redirects.js.map +1 -1
- package/dist/serialize.d.ts +4 -13
- package/dist/serialize.d.ts.map +1 -1
- package/dist/serialize.js +304 -102
- package/dist/serialize.js.map +1 -1
- package/dist/sitemap.d.ts +44 -17
- package/dist/sitemap.d.ts.map +1 -1
- package/dist/sitemap.js +31 -104
- package/dist/sitemap.js.map +1 -1
- package/dist/taxonomy.d.ts.map +1 -1
- package/dist/taxonomy.js +7 -1
- package/dist/taxonomy.js.map +1 -1
- package/dist/theme-css.d.ts +26 -0
- package/dist/theme-css.d.ts.map +1 -0
- package/dist/theme-css.js +642 -0
- package/dist/theme-css.js.map +1 -0
- package/dist/tone-classes.d.ts +14 -0
- package/dist/tone-classes.d.ts.map +1 -0
- package/dist/tone-classes.js +30 -0
- package/dist/tone-classes.js.map +1 -0
- package/dist/write-if-changed.d.ts +21 -0
- package/dist/write-if-changed.d.ts.map +1 -0
- package/dist/write-if-changed.js +58 -0
- package/dist/write-if-changed.js.map +1 -0
- package/package.json +13 -5
package/dist/redirects.js
CHANGED
|
@@ -22,13 +22,9 @@
|
|
|
22
22
|
* This module is pure: it does no IO, so every rule and every refusal is
|
|
23
23
|
* testable without building a site.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
const MAX_RULES = 2100;
|
|
27
|
-
const MAX_RULE_CHARS = 1000;
|
|
25
|
+
import { isExternalUrl, renderRedirectStub, renderRedirectsFile as renderRedirectsLines, resolveRedirects, } from "@dogsbay/site-files";
|
|
28
26
|
const VALID_STATUS = new Set([301, 302, 303, 307, 308]);
|
|
29
|
-
|
|
30
|
-
return /^[a-z][a-z0-9+.-]*:/i.test(target) || target.startsWith("//");
|
|
31
|
-
}
|
|
27
|
+
const isExternal = isExternalUrl;
|
|
32
28
|
/**
|
|
33
29
|
* A page slug → the path it is served at. Mirrors the emitter: pages are
|
|
34
30
|
* directories with a trailing slash, `index` is the prefix root.
|
|
@@ -40,6 +36,42 @@ export function slugToServedPath(slug, prefix) {
|
|
|
40
36
|
return `${base}/`;
|
|
41
37
|
return `${base}/${clean}/`;
|
|
42
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The site-path prefix a page's source is published under (its namespace,
|
|
41
|
+
* language and version segments, as `latest` or `en/v3`): its slug without
|
|
42
|
+
* the path the source gave it. "" for a site without those axes.
|
|
43
|
+
*/
|
|
44
|
+
export function pageUnitPrefix(page) {
|
|
45
|
+
const clean = (s) => s.replace(/^\/+|\/+$/g, "").replace(/(^|\/)index$/, "");
|
|
46
|
+
const slug = clean(page.slug);
|
|
47
|
+
const inside = clean(page.multiSource?.originalSlug ?? page.slug);
|
|
48
|
+
if (!inside)
|
|
49
|
+
return slug;
|
|
50
|
+
if (slug === inside)
|
|
51
|
+
return "";
|
|
52
|
+
return slug.endsWith(`/${inside}`) ? slug.slice(0, -inside.length - 1) : "";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A path written in a page's front matter (`redirect:`, `aliases:`) as a site
|
|
56
|
+
* path: relative to the page's unit (its language and version), unless it
|
|
57
|
+
* already starts with it, as dogsbay-ssg reads it (issue #096). A copied
|
|
58
|
+
* version (`latest` snapshotted to `v4/`) keeps its redirects inside itself.
|
|
59
|
+
* `mount` (urlBase + basePath) may be written or not; URLs pass through.
|
|
60
|
+
*/
|
|
61
|
+
export function inPageUnit(raw, unit, mount) {
|
|
62
|
+
if (!unit || isExternal(raw))
|
|
63
|
+
return raw;
|
|
64
|
+
const t = raw.trim();
|
|
65
|
+
const cut = t.search(/[?#]/);
|
|
66
|
+
const suffix = cut < 0 ? "" : t.slice(cut);
|
|
67
|
+
let p = (cut < 0 ? t : t.slice(0, cut)).replace(/^\/+/, "");
|
|
68
|
+
const m = mount.replace(/^\/+|\/+$/g, "");
|
|
69
|
+
if (m && (p === m || p.startsWith(`${m}/`)))
|
|
70
|
+
p = p.slice(m.length).replace(/^\/+/, "");
|
|
71
|
+
if (!(p === unit || p.startsWith(`${unit}/`)))
|
|
72
|
+
p = p ? `${unit}/${p}` : unit;
|
|
73
|
+
return `/${p}${suffix}`;
|
|
74
|
+
}
|
|
43
75
|
/**
|
|
44
76
|
* Normalize an authored path to the served form: leading slash, mount prefix
|
|
45
77
|
* applied once, trailing slash unless it names a file. External URLs pass
|
|
@@ -48,21 +80,22 @@ export function slugToServedPath(slug, prefix) {
|
|
|
48
80
|
export function normalizeTarget(raw, prefix) {
|
|
49
81
|
if (isExternal(raw))
|
|
50
82
|
return raw;
|
|
51
|
-
|
|
83
|
+
// A "#anchor" or "?query" stays on the target as written; only the path is
|
|
84
|
+
// normalized (it used to become "/a#x/", which matched no page).
|
|
85
|
+
const trimmed = raw.trim();
|
|
86
|
+
const cut = trimmed.search(/[?#]/);
|
|
87
|
+
const suffix = cut < 0 ? "" : trimmed.slice(cut);
|
|
88
|
+
let p = cut < 0 ? trimmed : trimmed.slice(0, cut);
|
|
52
89
|
if (!p.startsWith("/"))
|
|
53
90
|
p = `/${p}`;
|
|
54
91
|
const base = prefix.replace(/\/+$/, "");
|
|
55
|
-
// Already carries the mount prefix? Don't add it twice — authors reasonably
|
|
56
|
-
// write either form, and `/blog/blog/old` fires for nothing.
|
|
57
92
|
if (base && p !== base && !p.startsWith(`${base}/`)) {
|
|
58
93
|
p = `${base}${p}`;
|
|
59
94
|
}
|
|
60
|
-
// Trailing slash unless the last segment looks like a file. Without this a
|
|
61
|
-
// rule lands on a path that redirects again (docs-dev/url-shape.md).
|
|
62
95
|
const last = p.split("/").pop() ?? "";
|
|
63
96
|
if (!last.includes(".") && !p.endsWith("/"))
|
|
64
97
|
p = `${p}/`;
|
|
65
|
-
return p;
|
|
98
|
+
return p + suffix;
|
|
66
99
|
}
|
|
67
100
|
/**
|
|
68
101
|
* Gather every declared redirect, resolve paths, and refuse the ones that
|
|
@@ -72,7 +105,6 @@ export function collectRedirects(input) {
|
|
|
72
105
|
const { pages, config, prefix } = input;
|
|
73
106
|
const errors = [];
|
|
74
107
|
const warnings = [];
|
|
75
|
-
const bySource = new Map();
|
|
76
108
|
const livePaths = new Set();
|
|
77
109
|
for (const page of pages) {
|
|
78
110
|
// A page that only redirects is not a live page — it is the thing being
|
|
@@ -80,29 +112,21 @@ export function collectRedirects(input) {
|
|
|
80
112
|
if (!page.redirect)
|
|
81
113
|
livePaths.add(slugToServedPath(page.slug, prefix));
|
|
82
114
|
}
|
|
115
|
+
// Duplicates are resolved (and reported) by resolveRedirects.
|
|
116
|
+
const candidates = [];
|
|
83
117
|
const add = (rule) => {
|
|
84
|
-
|
|
85
|
-
if (existing) {
|
|
86
|
-
// Config wins over frontmatter (the plan's precedence); two rules of the
|
|
87
|
-
// same origin for one source is an authoring mistake, not a preference.
|
|
88
|
-
if (existing.origin === rule.origin || rule.origin !== "config") {
|
|
89
|
-
if (existing.to !== rule.to) {
|
|
90
|
-
errors.push(`two redirects for ${rule.from} (→ ${existing.to} and → ${rule.to}). ` +
|
|
91
|
-
`To fix: keep one; a duplicate source has no defined winner.`);
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
bySource.set(rule.from, rule);
|
|
118
|
+
candidates.push(rule);
|
|
97
119
|
};
|
|
98
120
|
// 1. Page frontmatter: `redirect:` (this page forwards) and `aliases:` (old
|
|
99
121
|
// paths that forward TO this page).
|
|
100
122
|
for (const page of pages) {
|
|
101
123
|
const here = slugToServedPath(page.slug, prefix);
|
|
124
|
+
// Front matter paths are relative to the page's language and version (#096).
|
|
125
|
+
const unit = pageUnitPrefix(page);
|
|
102
126
|
if (page.redirect) {
|
|
103
127
|
add({
|
|
104
128
|
from: here,
|
|
105
|
-
to: normalizeTarget(page.redirect, prefix),
|
|
129
|
+
to: normalizeTarget(inPageUnit(page.redirect, unit, prefix), prefix),
|
|
106
130
|
status: 301,
|
|
107
131
|
origin: "frontmatter",
|
|
108
132
|
declaredBy: page.slug,
|
|
@@ -117,7 +141,7 @@ export function collectRedirects(input) {
|
|
|
117
141
|
else {
|
|
118
142
|
for (const alias of aliases) {
|
|
119
143
|
add({
|
|
120
|
-
from: normalizeTarget(alias, prefix),
|
|
144
|
+
from: normalizeTarget(inPageUnit(alias, unit, prefix), prefix),
|
|
121
145
|
to: here,
|
|
122
146
|
status: 301,
|
|
123
147
|
origin: "aliases",
|
|
@@ -147,86 +171,21 @@ export function collectRedirects(input) {
|
|
|
147
171
|
origin: "config",
|
|
148
172
|
});
|
|
149
173
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
errors.push(`redirect ${r.from} → ${r.to} points at itself` +
|
|
156
|
-
(r.declaredBy ? ` (declared on ${r.declaredBy})` : "") +
|
|
157
|
-
`. To fix: remove it.`);
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
return true;
|
|
174
|
+
const resolved = resolveRedirects(candidates, {
|
|
175
|
+
strict: true,
|
|
176
|
+
// A target's "#anchor" or "?query" is not part of the page it names.
|
|
177
|
+
isPage: (path) => livePaths.has(path.split(/[?#]/)[0]),
|
|
178
|
+
cloudflareLimits: true,
|
|
161
179
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
let hop = targets.get(rule.to);
|
|
168
|
-
let hops = 0;
|
|
169
|
-
while (hop && !isExternal(rule.to)) {
|
|
170
|
-
if (seen.has(hop.from)) {
|
|
171
|
-
errors.push(`redirect loop: ${[...seen].join(" → ")} → ${hop.from}. To fix: break the cycle.`);
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
seen.add(hop.from);
|
|
175
|
-
rule.to = hop.to;
|
|
176
|
-
hops++;
|
|
177
|
-
hop = targets.get(rule.to);
|
|
178
|
-
}
|
|
179
|
-
if (hops > 0) {
|
|
180
|
-
warnings.push(`collapsed a redirect chain: ${rule.from} now points straight at ${rule.to} (${hops} hop(s) removed)`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
// 5. Dangling internal target. A 301 into a 404 is worse than no redirect —
|
|
184
|
-
// the old URL at least told the truth.
|
|
185
|
-
for (const rule of rules) {
|
|
186
|
-
if (isExternal(rule.to))
|
|
187
|
-
continue;
|
|
188
|
-
if (!livePaths.has(rule.to)) {
|
|
189
|
-
errors.push(`redirect ${rule.from} → ${rule.to} points at a page this build does not emit` +
|
|
190
|
-
(rule.declaredBy ? ` (declared on ${rule.declaredBy})` : "") +
|
|
191
|
-
`. To fix: correct the target, or point it at an external URL.`);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
// 6. A source that is also a live page. On Cloudflare the redirect wins
|
|
195
|
-
// (redirects are followed whether or not an asset matches), so the page
|
|
196
|
-
// becomes unreachable — silently. Everywhere else the page wins and the
|
|
197
|
-
// redirect never fires. Either way somebody is surprised.
|
|
198
|
-
for (const rule of rules) {
|
|
199
|
-
if (livePaths.has(rule.from)) {
|
|
200
|
-
errors.push(`redirect source ${rule.from} is also a page this build emits. ` +
|
|
201
|
-
`To fix: remove the page or the redirect — on Cloudflare the redirect ` +
|
|
202
|
-
`wins and the page is unreachable; on a static host the page wins and ` +
|
|
203
|
-
`the redirect never fires.`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
// 7. Platform ceilings, identical on Free and Paid.
|
|
207
|
-
if (rules.length > MAX_RULES) {
|
|
208
|
-
errors.push(`${rules.length} redirects exceeds the ${MAX_RULES}-rule limit for _redirects. ` +
|
|
209
|
-
`To fix: use Cloudflare Bulk Redirects for the long tail.`);
|
|
210
|
-
}
|
|
211
|
-
for (const rule of rules) {
|
|
212
|
-
const line = `${rule.from} ${rule.to} ${rule.status}`;
|
|
213
|
-
if (line.length > MAX_RULE_CHARS) {
|
|
214
|
-
errors.push(`redirect rule for ${rule.from} is ${line.length} characters, over the ` +
|
|
215
|
-
`${MAX_RULE_CHARS}-character limit. To fix: shorten the paths.`);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
rules.sort((a, b) => a.from.localeCompare(b.from));
|
|
219
|
-
return { rules, errors, warnings };
|
|
180
|
+
return {
|
|
181
|
+
rules: resolved.rules,
|
|
182
|
+
errors: [...errors, ...resolved.errors],
|
|
183
|
+
warnings: [...warnings, ...resolved.warnings],
|
|
184
|
+
};
|
|
220
185
|
}
|
|
221
186
|
/** The `_redirects` file Workers Static Assets reads from the assets root. */
|
|
222
187
|
export function renderRedirectsFile(rules) {
|
|
223
|
-
|
|
224
|
-
"# Generated by dogsbay. Do not edit — declare redirects with `redirect:`",
|
|
225
|
-
"# or `aliases:` frontmatter, or the `redirects:` block in dogsbay.config.yml.",
|
|
226
|
-
// The status is never omitted: the default is 302, and a rename is a 301.
|
|
227
|
-
...rules.map((r) => `${r.from} ${r.to} ${r.status}`),
|
|
228
|
-
];
|
|
229
|
-
return `${lines.join("\n")}\n`;
|
|
188
|
+
return renderRedirectsLines(rules);
|
|
230
189
|
}
|
|
231
190
|
/**
|
|
232
191
|
* A static stub for hosts with no redirect mechanism (GitHub Pages, plain
|
|
@@ -240,25 +199,7 @@ export function renderMetaRefreshPage(rule, siteUrl) {
|
|
|
240
199
|
: isExternal(rule.to)
|
|
241
200
|
? rule.to
|
|
242
201
|
: undefined;
|
|
243
|
-
|
|
244
|
-
return [
|
|
245
|
-
"<!doctype html>",
|
|
246
|
-
'<html lang="en">',
|
|
247
|
-
"<head>",
|
|
248
|
-
'<meta charset="utf-8">',
|
|
249
|
-
`<meta http-equiv="refresh" content="0; url=${esc(rule.to)}">`,
|
|
250
|
-
'<meta name="robots" content="noindex">',
|
|
251
|
-
canonical ? `<link rel="canonical" href="${esc(canonical)}">` : "",
|
|
252
|
-
`<title>Redirecting to ${esc(rule.to)}</title>`,
|
|
253
|
-
"</head>",
|
|
254
|
-
"<body>",
|
|
255
|
-
`<p>This page has moved to <a href="${esc(rule.to)}">${esc(rule.to)}</a>.</p>`,
|
|
256
|
-
"</body>",
|
|
257
|
-
"</html>",
|
|
258
|
-
"",
|
|
259
|
-
]
|
|
260
|
-
.filter(Boolean)
|
|
261
|
-
.join("\n");
|
|
202
|
+
return renderRedirectStub(rule.to, canonical);
|
|
262
203
|
}
|
|
263
204
|
/**
|
|
264
205
|
* Where a stub page goes inside `public/`, relative to it. The served path
|
|
@@ -272,6 +213,12 @@ export function stubPathForRule(rule, prefix) {
|
|
|
272
213
|
if (base && p.startsWith(base))
|
|
273
214
|
p = p.slice(base.length);
|
|
274
215
|
p = p.replace(/^\/+|\/+$/g, "");
|
|
216
|
+
// The stub is written at this path under public/. resolveRedirects refuses
|
|
217
|
+
// such a source already; this is the last line before a file write, so a
|
|
218
|
+
// `..` that reached it some other way cannot leave the site.
|
|
219
|
+
if (p.split("/").some((seg) => seg === ".." || seg === ".") || /[\\\u0000]/.test(p)) {
|
|
220
|
+
throw new Error(`redirect source ${JSON.stringify(rule.from)} would write outside the site`);
|
|
221
|
+
}
|
|
275
222
|
return p ? `${p}/index.html` : "index.html";
|
|
276
223
|
}
|
|
277
224
|
//# sourceMappingURL=redirects.js.map
|
package/dist/redirects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirects.js","sourceRoot":"","sources":["../src/redirects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"redirects.js","sourceRoot":"","sources":["../src/redirects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,IAAI,oBAAoB,EAC3C,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAuC7B,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAExD,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,MAAc;IAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,IAAI,GAAG,CAAC;IAC9B,OAAO,GAAG,IAAI,IAAI,K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E;IAC3E,yEAAyE;IACzE,6DAA6D;IAC7D,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC;AAC9C,CAAC"}
|
package/dist/serialize.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface AstroGenOptions {
|
|
|
19
19
|
imageOptimization?: boolean;
|
|
20
20
|
/** Controls CodeBlock title bar: true = always (default), "auto" = only with explicit title */
|
|
21
21
|
codeBlockTitle?: boolean | "auto";
|
|
22
|
+
/** A paragraph that is one titled image renders as a captioned figure (`content.imageCaptions: title`). */
|
|
23
|
+
imageCaptions?: boolean;
|
|
22
24
|
/**
|
|
23
25
|
* Combined URL prefix (urlBase + basePath). When non-empty, the
|
|
24
26
|
* caller is expected to have already pre-rewritten absolute image
|
|
@@ -29,19 +31,8 @@ export interface AstroGenOptions {
|
|
|
29
31
|
*/
|
|
30
32
|
combinedPrefix?: string;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* Each tone is a `bg + text` Tailwind class pair. Used to make grid demos
|
|
35
|
-
* declarative — authors specify a tone instead of writing the styling.
|
|
36
|
-
*
|
|
37
|
-
* Exported because the scaffolded site's `global.css` must safelist
|
|
38
|
-
* these classes via `@source inline()` — they only appear in
|
|
39
|
-
* markdown-generated `.astro` pages, which Tailwind's content
|
|
40
|
-
* scanner doesn't always pick up reliably (and consumers who put
|
|
41
|
-
* their content/ outside the scanned globs won't pick them up at
|
|
42
|
-
* all). See generateGlobalCss in project.ts.
|
|
43
|
-
*/
|
|
44
|
-
export declare const TONE_CLASSES: Record<string, string>;
|
|
34
|
+
import { TONE_CLASSES } from "./tone-classes.js";
|
|
35
|
+
export { TONE_CLASSES };
|
|
45
36
|
/** Escape for use inside an Astro {expression}. Uses JSON.stringify for safety. */
|
|
46
37
|
export declare function escapeExpr(s: string): string;
|
|
47
38
|
/** Escape for use in an HTML attribute value (double-quoted). */
|
package/dist/serialize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAYxE;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,QAAQ,CAAC;AA+BpD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC,2GAA2G;IAC3G,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,CAAC;AA8FxB,mFAAmF;AACnF,wBAAgB,UAA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