Skip to content

Commit 26a7ec9

Browse files
Merge branch 'production' into rebecca/dns-proxy-status-review
2 parents 30953e7 + 0efd748 commit 26a7ec9

File tree

23 files changed

+185
-400
lines changed

23 files changed

+185
-400
lines changed

astro.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ import starlightLinksValidator from "starlight-links-validator";
88
import icon from "astro-icon";
99
import sitemap from "@astrojs/sitemap";
1010
import react from "@astrojs/react";
11-
1211
import { readdir } from "fs/promises";
13-
import { fileURLToPath } from "url";
1412

1513
import rehypeTitleFigure from "rehype-title-figure";
1614
import rehypeMermaid from "./src/plugins/rehype/mermaid.ts";
1715
import rehypeAutolinkHeadings from "./src/plugins/rehype/autolink-headings.ts";
1816
import rehypeExternalLinks from "./src/plugins/rehype/external-links.ts";
1917
import rehypeHeadingSlugs from "./src/plugins/rehype/heading-slugs.ts";
18+
import { fileURLToPath } from "url";
2019

2120
async function autogenSections() {
2221
const sections = (

package-lock.json

Lines changed: 56 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@astrojs/starlight-docsearch": "0.5.0",
3535
"@astrojs/starlight-tailwind": "3.0.0",
3636
"@astrojs/tailwind": "5.1.5",
37-
"@cloudflare/vitest-pool-workers": "0.6.11",
37+
"@cloudflare/vitest-pool-workers": "0.6.12",
3838
"@cloudflare/workers-types": "4.20250204.0",
3939
"@codingheads/sticky-header": "1.0.2",
4040
"@expressive-code/plugin-collapsible-sections": "0.40.1",
@@ -46,7 +46,7 @@
4646
"@types/node": "22.13.1",
4747
"@types/react": "19.0.7",
4848
"@types/react-dom": "19.0.3",
49-
"@typescript-eslint/parser": "8.23.0",
49+
"@typescript-eslint/parser": "8.24.0",
5050
"algoliasearch": "5.20.1",
5151
"astro": "5.2.1",
5252
"astro-breadcrumbs": "3.3.1",
@@ -57,7 +57,7 @@
5757
"dedent": "1.5.3",
5858
"dompurify": "3.2.4",
5959
"dot-prop": "9.0.0",
60-
"eslint": "9.18.0",
60+
"eslint": "9.20.0",
6161
"eslint-plugin-astro": "1.3.1",
6262
"eslint-plugin-jsx-a11y": "6.10.2",
6363
"eslint-plugin-react": "7.37.4",
@@ -74,7 +74,7 @@
7474
"mdast-util-mdx-expression": "2.0.1",
7575
"mermaid": "11.4.1",
7676
"node-html-parser": "7.0.1",
77-
"prettier": "3.4.2",
77+
"prettier": "3.5.0",
7878
"prettier-plugin-astro": "0.14.1",
7979
"prettier-plugin-tailwindcss": "0.6.9",
8080
"pretty-bytes": "6.1.1",

src/components/Render.astro

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,29 @@ const props = z.object({
1313
let { file, product, params } = props.parse(Astro.props);
1414
1515
if (!product) {
16-
const fromSlug = Astro.params.slug?.split("/")[0];
17-
18-
if (!fromSlug) {
19-
throw new Error(
20-
`[Render] Unable to infer which folder ${file} is in, please provide a "product" input with your "file" input.`,
21-
);
22-
}
16+
product = Astro.params.slug?.split("/")[0];
17+
}
2318
24-
product = fromSlug;
19+
if (!product) {
20+
throw new Error(
21+
`[Render] Unable to infer which folder ${file} is in, please provide a "product" input with your "file" input.`,
22+
);
2523
}
2624
27-
const id = `${product}/${file}`;
28-
const partial = await getEntry("partials", id);
25+
const partial = await getEntry("partials", `${product}/${file}`);
2926
3027
if (!partial) {
3128
throw new Error(
32-
`[Render] Couldn't find "${id}" included on "${Astro.url.pathname}"`,
29+
`[Render] Couldn't find partial: ${file}. Included on ${Astro.params.slug}`,
3330
);
3431
}
3532
36-
// We currently only enforce parameters if `params` is set in the frontmatter,
37-
// until we can migrate existing `inputParameters` frontmatter to `params`.
3833
if (partial.data.params) {
39-
const expected = partial.data.params.sort();
40-
const optional = expected.filter((p) => p.endsWith("?"));
41-
const received = Object.keys(params ?? {}).sort();
42-
43-
const maximum = expected.length;
44-
const minimum = maximum - optional.length;
45-
46-
if (
47-
received.length < minimum ||
48-
received.length > maximum ||
49-
expected.some((p: string) => {
50-
if (p.endsWith("?")) return false;
51-
52-
return !received.includes(p);
53-
})
54-
) {
34+
const expected = partial.data.params;
35+
if (!params)
5536
throw new Error(
56-
`[Render] Expected parameters ${JSON.stringify(expected)} but received parameters ${JSON.stringify(received)} for "${file}" included on "${Astro.url.pathname}"`,
37+
`${file} included on ${Astro.params.slug} expected parameters: ${expected}, got none`,
5738
);
58-
}
5939
}
6040
6141
const { Content } = await render(partial);

0 commit comments

Comments
 (0)