blume 1.1.2 → 1.1.4
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/CHANGELOG.md +47 -0
- package/dist/cli/index.js +284 -109
- package/dist/cli/index.js.map +33 -33
- package/dist/types/ai/component-markdown.d.ts +10 -0
- package/dist/types/core/config-input.d.ts +44 -0
- package/dist/types/core/data.d.ts +2 -0
- package/dist/types/core/i18n-ui.d.ts +24 -24
- package/dist/types/core/schema.d.ts +282 -114
- package/dist/types/core/types.d.ts +14 -0
- package/dist/types/openapi/references.d.ts +5 -0
- package/docs/advanced/api-reference.mdx +20 -0
- package/docs/configuration/index.mdx +27 -0
- package/package.json +1 -1
- package/src/ai/component-markdown.ts +28 -0
- package/src/ai/llms.ts +11 -2
- package/src/ai/markdown.ts +12 -6
- package/src/ai/mcp/server.ts +29 -6
- package/src/astro/examples.ts +13 -0
- package/src/astro/generate.ts +141 -58
- package/src/astro/templates.ts +65 -21
- package/src/audit/checks/duplicates.ts +15 -6
- package/src/audit/checks/indexability.ts +11 -2
- package/src/audit/checks/network.ts +22 -8
- package/src/audit/checks/sitemap.ts +42 -16
- package/src/audit/redirects.ts +12 -1
- package/src/audit/run.ts +13 -3
- package/src/audit/url.ts +21 -2
- package/src/cli/commands/audit.ts +21 -6
- package/src/cli/commands/dev.ts +19 -2
- package/src/components/content/Frame.astro +4 -1
- package/src/components/content/Prompt.astro +4 -1
- package/src/components/content/Tooltip.astro +4 -1
- package/src/components/content/Update.astro +45 -0
- package/src/components/islands/ask-ai.tsx +19 -2
- package/src/components/islands/hooks.ts +38 -11
- package/src/components/layout/Logo.astro +2 -2
- package/src/components/layout/RootLayout.astro +27 -7
- package/src/components/layout/Search.astro +5 -1
- package/src/components/layout/head-scripts.ts +22 -5
- package/src/components/openapi/ApiTagOperations.astro +17 -8
- package/src/core/config-input.ts +45 -0
- package/src/core/data.ts +2 -0
- package/src/core/date-format.ts +17 -0
- package/src/core/deployment-env.ts +7 -2
- package/src/core/graph.ts +7 -1
- package/src/core/i18n.ts +10 -2
- package/src/core/navigation.ts +7 -3
- package/src/core/project-graph.ts +9 -0
- package/src/core/schema.ts +64 -0
- package/src/core/sources/normalize.ts +69 -8
- package/src/core/sources/notion.ts +4 -2
- package/src/core/sources/sanity.ts +5 -3
- package/src/core/types.ts +16 -0
- package/src/markdown/code-title.ts +7 -1
- package/src/openapi/model.ts +31 -2
- package/src/openapi/references.ts +6 -0
- package/src/openapi/render-mdx.ts +12 -7
- package/src/openapi/scalar.ts +4 -0
- package/src/registry/eject.ts +6 -3
- package/src/theme/entry.ts +7 -0
- package/src/theme/twoslash.ts +10 -0
|
@@ -42,6 +42,11 @@ export interface ReferenceSource {
|
|
|
42
42
|
spec: string;
|
|
43
43
|
/** Per-block Scalar theme name override, if any (Scalar renderer only). */
|
|
44
44
|
theme?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Arbitrary Scalar config forwarded to `<ScalarComponent>` (Scalar renderer
|
|
47
|
+
* only). Takes precedence over Blume's derived spec/theme config.
|
|
48
|
+
*/
|
|
49
|
+
scalar?: Record<string, unknown>;
|
|
45
50
|
/** Display options carried through to the Blume renderer. */
|
|
46
51
|
display: ReferenceDisplay;
|
|
47
52
|
/**
|
|
@@ -117,6 +122,7 @@ const referencesFor = (
|
|
|
117
122
|
label,
|
|
118
123
|
renderer,
|
|
119
124
|
route,
|
|
125
|
+
scalar: block.scalar,
|
|
120
126
|
slug: routeSlug(route),
|
|
121
127
|
spec: source.spec,
|
|
122
128
|
theme: block.theme,
|
|
@@ -11,13 +11,14 @@ import type { ApiOperationRef, ApiSpecData } from "./model.ts";
|
|
|
11
11
|
* omit their own top heading.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
// Neutralize the few characters MDX treats specially (`{` expressions, `<`
|
|
15
|
-
// so an arbitrary spec description can be embedded in the body verbatim
|
|
16
|
-
// breaking compilation. They render as their literal selves.
|
|
17
|
-
|
|
14
|
+
// Neutralize the few characters MDX treats specially (`{` expressions, `<`
|
|
15
|
+
// JSX) so an arbitrary spec description can be embedded in the body verbatim
|
|
16
|
+
// without breaking compilation. They render as their literal selves. `>` is
|
|
17
|
+
// deliberately not escaped: it isn't MDX-special on its own, and escaping it
|
|
18
|
+
// turns a `> Note:` blockquote into literal "> Note:" text.
|
|
19
|
+
const MDX_UNSAFE = /[<{}]/gu;
|
|
18
20
|
const ENTITIES: Record<string, string> = {
|
|
19
21
|
"<": "<",
|
|
20
|
-
">": ">",
|
|
21
22
|
"{": "{",
|
|
22
23
|
"}": "}",
|
|
23
24
|
};
|
|
@@ -28,8 +29,12 @@ const MDX_ESM_KEYWORD = /^(?<keyword>import|export)\b/gmu;
|
|
|
28
29
|
// Backtick code — inline spans and fences alike — is already literal in MDX,
|
|
29
30
|
// and entities are NOT decoded inside it, so escaping there would render the
|
|
30
31
|
// entity text verbatim (`/pets/{petId}`). Matching any balanced
|
|
31
|
-
// backtick run covers `code`, ``code``, and ```fences``` in one shot.
|
|
32
|
-
|
|
32
|
+
// backtick run covers `code`, ``code``, and ```fences``` in one shot. Both
|
|
33
|
+
// runs are pinned by the backtick lookarounds: CommonMark pairs a span only
|
|
34
|
+
// with an *equal-length* run, so without them a lone backtick would "close" on
|
|
35
|
+
// the first backtick of a longer fence run — leaving `{` in the real prose
|
|
36
|
+
// unescaped (a compile error) and escaping entities into the fence body.
|
|
37
|
+
const BACKTICK_CODE = /(?<!`)(?<bt>`+)(?!`)[\s\S]*?(?<!`)\k<bt>(?!`)/gu;
|
|
33
38
|
|
|
34
39
|
const escapeProse = (text: string): string =>
|
|
35
40
|
text
|
package/src/openapi/scalar.ts
CHANGED
|
@@ -161,6 +161,10 @@ export const buildReferenceFiles = async (options: {
|
|
|
161
161
|
configuration: {
|
|
162
162
|
...spec.config,
|
|
163
163
|
...themeConfiguration(config, ref.theme),
|
|
164
|
+
// Author-supplied Scalar options win outright — a full escape hatch
|
|
165
|
+
// over Blume's derived spec/theme config (localization, agent,
|
|
166
|
+
// hideTestRequestButton, orderSchemaPropertiesBy, and the rest).
|
|
167
|
+
...ref.scalar,
|
|
164
168
|
},
|
|
165
169
|
dataImport: `${"../".repeat(depth + 1)}generated/data.json`,
|
|
166
170
|
route: ref.route,
|
package/src/registry/eject.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { buildRawMarkdown } from "../ai/markdown.ts";
|
|
|
9
9
|
import { buildMcpData } from "../ai/mcp/data.ts";
|
|
10
10
|
import { buildMcpDiscovery, buildMcpServerCard } from "../ai/mcp/discovery.ts";
|
|
11
11
|
import { planComponentSlots } from "../astro/component-slots.ts";
|
|
12
|
-
import { discoverExamples } from "../astro/examples.ts";
|
|
12
|
+
import { discoverExamples, exampleMarkdownLookup } from "../astro/examples.ts";
|
|
13
13
|
import {
|
|
14
14
|
buildRuntimeData,
|
|
15
15
|
collectStaged,
|
|
@@ -292,6 +292,11 @@ export const eject = async (
|
|
|
292
292
|
const exportPdf = config.export.pdf;
|
|
293
293
|
const exportEpub = config.export.epub;
|
|
294
294
|
|
|
295
|
+
// Discover examples first and expose them on the project, so the agent-facing
|
|
296
|
+
// Markdown built below (raw `.md`, MCP) downlevels `<Component>` to its source.
|
|
297
|
+
const examples = await discoverExamples(root, config.examples.source);
|
|
298
|
+
project.examples = exampleMarkdownLookup(examples.examples);
|
|
299
|
+
|
|
295
300
|
const [
|
|
296
301
|
pages,
|
|
297
302
|
needsReactRaw,
|
|
@@ -300,7 +305,6 @@ export const eject = async (
|
|
|
300
305
|
userExamplesCss,
|
|
301
306
|
rawMarkdown,
|
|
302
307
|
islands,
|
|
303
|
-
examples,
|
|
304
308
|
] = await Promise.all([
|
|
305
309
|
context.pagesRoot ? discoverPages(context.pagesRoot) : Promise.resolve([]),
|
|
306
310
|
detectNeedsReact(root),
|
|
@@ -311,7 +315,6 @@ export const eject = async (
|
|
|
311
315
|
readExamplesCss(root, config.examples.css),
|
|
312
316
|
buildRawMarkdown(project),
|
|
313
317
|
discoverIslands(root),
|
|
314
|
-
discoverExamples(root, config.examples.source),
|
|
315
318
|
]);
|
|
316
319
|
// Island/example frameworks drive which Astro renderers the ejected config
|
|
317
320
|
// wires in; React also switches on for project `.tsx`/`.jsx` and Ask AI.
|
package/src/theme/entry.ts
CHANGED
|
@@ -247,6 +247,13 @@ ${THEME_MAPPING}
|
|
|
247
247
|
letter-spacing: 0;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
/* A heading can carry one long unbreakable token — an OpenAPI operation's title
|
|
251
|
+
is \`METHOD /very/long/{path}\` when the spec sets no summary — which would run
|
|
252
|
+
off the content column. Break it across lines instead of overflowing. */
|
|
253
|
+
.prose :where(h1, h2, h3, h4, h5, h6) {
|
|
254
|
+
overflow-wrap: break-word;
|
|
255
|
+
}
|
|
256
|
+
|
|
250
257
|
.prose :where(h1) {
|
|
251
258
|
font-size: 3rem;
|
|
252
259
|
line-height: 1.1;
|
package/src/theme/twoslash.ts
CHANGED
|
@@ -43,6 +43,16 @@ const OVERRIDES = `
|
|
|
43
43
|
padding-right: 1.25rem;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/* Twoslash blocks keep \`overflow: visible\` so popups can escape, which means
|
|
47
|
+
long lines can't scroll — they'd push past the viewport on narrow screens.
|
|
48
|
+
Wrap them on mobile instead; hover popups still position against the token. */
|
|
49
|
+
@media (max-width: 640px) {
|
|
50
|
+
.prose pre.twoslash code {
|
|
51
|
+
white-space: pre-wrap;
|
|
52
|
+
overflow-wrap: anywhere;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
/* The rich renderer renders each popup's type signature as a nested Shiki
|
|
47
57
|
pre. Strip the code-block chrome (border, radius, padding, background) so it
|
|
48
58
|
sits flush inside the popup, which owns the frame. */
|