Skip to content

Commit 9cc9751

Browse files
authored
Merge branch 'production' into api-next-documentation-links
2 parents a366a3d + ea19438 commit 9cc9751

File tree

103 files changed

+2249
-726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2249
-726
lines changed

package-lock.json

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

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,29 @@
2727
"devDependencies": {
2828
"@astro-community/astro-embed-youtube": "^0.5.6",
2929
"@astrojs/check": "^0.9.4",
30-
"@astrojs/react": "^3.6.2",
31-
"@astrojs/rss": "^4.0.9",
30+
"@astrojs/react": "^3.6.3",
31+
"@astrojs/rss": "^4.0.10",
3232
"@astrojs/sitemap": "^3.2.1",
3333
"@astrojs/starlight": "^0.29.2",
3434
"@astrojs/starlight-docsearch": "^0.3.0",
3535
"@astrojs/starlight-tailwind": "^2.0.3",
36-
"@astrojs/tailwind": "^5.1.2",
36+
"@astrojs/tailwind": "^5.1.3",
3737
"@cloudflare/puppeteer": "^0.0.14",
3838
"@cloudflare/vitest-pool-workers": "^0.5.36",
3939
"@cloudflare/workers-types": "^4.20241112.0",
4040
"@codingheads/sticky-header": "^1.0.2",
4141
"@iarna/toml": "^2.2.5",
42-
"@iconify-json/material-symbols": "^1.2.8",
42+
"@iconify-json/material-symbols": "^1.2.10",
4343
"@stoplight/json-schema-tree": "^4.0.0",
4444
"@types/dompurify": "^3.2.0",
4545
"@types/hast": "^3.0.4",
4646
"@types/he": "^1.2.3",
4747
"@types/node": "^22.10.1",
4848
"@types/react": "^18.3.12",
4949
"@types/react-dom": "^18.3.1",
50-
"algoliasearch": "^5.15.0",
50+
"algoliasearch": "^5.17.0",
5151
"astro": "^4.16.17",
52-
"astro-breadcrumbs": "^3.2.2",
52+
"astro-breadcrumbs": "^3.3.1",
5353
"astro-icon": "^1.1.2",
5454
"astro-live-code": "^0.0.4",
5555
"date-fns": "^4.1.0",
@@ -72,7 +72,7 @@
7272
"playwright": "^1.49.0",
7373
"prettier": "^3.4.2",
7474
"prettier-plugin-astro": "^0.14.1",
75-
"puppeteer": "^23.10.1",
75+
"puppeteer": "^23.10.4",
7676
"react": "^18.3.1",
7777
"react-dom": "^18.3.1",
7878
"react-textarea-autosize": "^8.5.6",

public/core-services-preview.png

121 KB
Loading

public/dev-products-preview.png

60.2 KB
Loading

public/zt-preview.png

59.4 KB
Loading

src/assets/images/reference-architecture/optimizing-roaming-experience-with-geolocated-ips/figure1.svg

Lines changed: 107 additions & 0 deletions
Loading

src/assets/images/reference-architecture/optimizing-roaming-experience-with-geolocated-ips/figure2.svg

Lines changed: 146 additions & 0 deletions
Loading

src/components/FeatureTable.astro

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { indexPlans } from "~/util/plans";
44
import { marked } from "marked";
55
import GlossaryTooltip from "~/components/GlossaryTooltip.astro";
66
7+
const markdown = (content: any) => {
8+
if (typeof content !== "string") return content;
9+
10+
return marked.parse(content);
11+
};
12+
713
type Props = z.infer<typeof props>;
814
915
const props = z
@@ -17,30 +23,29 @@ const { id } = props.parse(Astro.props);
1723
// TODO: improve product features types
1824
const plan = (await indexPlans(id)) as any;
1925
20-
// @ts-ignore types not implemented for plans JSON
21-
const properties = plan.properties;
26+
const features: any[] = Object.values(plan.properties);
2227
23-
const markdown = (content: any) => {
24-
if (typeof content !== "string") return content;
25-
26-
return marked.parse(content);
27-
};
28+
const hasFree = features.some((x) => x.free);
29+
const hasPro = features.some((x) => x.pro);
30+
const hasBiz = features.some((x) => x.biz);
31+
const hasEnt = features.some((x) => x.ent);
32+
const hasEntPlus = features.some((x) => x.ent_plus);
2833
---
2934

3035
<table>
3136
<thead>
3237
<tr>
3338
<th></th>
34-
<th>Free</th>
35-
<th>Pro</th>
36-
<th>Business</th>
37-
<th>Enterprise</th>
38-
{plan.ent_plus && <th>{plan.ent_plus}</th>}
39+
{hasFree && <th>Free</th>}
40+
{hasPro && <th>Pro</th>}
41+
{hasBiz && <th>Business</th>}
42+
{hasEnt && <th>Enterprise</th>}
43+
{hasEntPlus && <th>{plan.ent_plus}</th>}
3944
</tr>
4045
</thead>
4146
<tbody>
4247
{
43-
Object.entries(properties).map(([_, v]: [string, any]) => {
48+
features.map((feature) => {
4449
const renderTitle = (title: string) => {
4550
const placeholder = "[[GLOSSARY_TOOLTIP_SNIPPETS_SUBREQUEST]]";
4651

@@ -67,12 +72,12 @@ const markdown = (content: any) => {
6772

6873
return (
6974
<tr>
70-
<th set:html={renderTitle(v.title)} />
71-
<td set:html={markdown(v.free)} />
72-
<td set:html={markdown(v.pro)} />
73-
<td set:html={markdown(v.biz)} />
74-
<td set:html={markdown(v.ent)} />
75-
{plan.ent_plus && <td set:html={markdown(v.ent_plus)} />}
75+
<th set:html={renderTitle(feature.title)} />
76+
{hasFree && <td set:html={markdown(feature.free)} />}
77+
{hasPro && <td set:html={markdown(feature.pro)} />}
78+
{hasBiz && <td set:html={markdown(feature.biz)} />}
79+
{hasEnt && <td set:html={markdown(feature.ent)} />}
80+
{hasEntPlus && <td set:html={markdown(feature.ent_plus)} />}
7681
</tr>
7782
);
7883
})

src/components/GitHubCode.astro

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,20 @@ if (!res.ok) {
3333
throw new Error(`[GitHubCode] Received ${res.status} from Worker.`);
3434
}
3535
36-
let content = await res.text();
36+
const content = await res.text();
37+
let contentLines = content.split("\n");
3738
3839
if (lines) {
3940
const [start, end] = lines;
4041
41-
const contentLines = content.split("\n");
42-
4342
if (contentLines.length < end - 1) {
4443
throw new Error(
4544
`[GitHubCode] End line requested is beyond content length (${contentLines.length}).`,
4645
);
4746
}
4847
49-
content = contentLines.slice(start - 1, end).join("\n");
48+
contentLines = contentLines.slice(start - 1, end);
5049
} else if (tag) {
51-
const contentLines = content.split("\n");
52-
5350
const startTag = contentLines.findIndex((x) =>
5451
x.includes(`<docs-tag name="${tag}">`),
5552
);
@@ -61,8 +58,12 @@ if (lines) {
6158
throw new Error(`[GitHubCode] Unable to find a region using tag "${tag}".`);
6259
}
6360
64-
content = contentLines.slice(startTag + 1, endTag).join("\n");
61+
contentLines = contentLines.slice(startTag + 1, endTag);
6562
}
63+
64+
contentLines = contentLines.filter(
65+
(line) => !/<[\/]?docs-tag name=".*">/.test(line),
66+
);
6667
---
6768

68-
<Code code={content} lang={lang} />
69+
<Code code={contentLines.join("\n")} lang={lang} />

src/components/overrides/Head.astro

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ if (currentSection) {
4444
content: "",
4545
});
4646
}
47+
4748
if (product.data.product.title) {
4849
const productName = product.data.product.title;
4950
Astro.props.entry.data.head.push({
@@ -63,7 +64,58 @@ if (currentSection) {
6364
content: "",
6465
});
6566
}
67+
6668
if (product.data.product.group) {
69+
const group = product.data.product.group.toLowerCase();
70+
71+
let ogImage = "https://developers.cloudflare.com/cf-twitter-card.png";
72+
const images: Record<string, string> = {
73+
"cloudflare essentials":
74+
"https://developers.cloudflare.com/core-services-preview.png",
75+
"cloudflare one": "https://developers.cloudflare.com/zt-preview.png",
76+
"developer platform":
77+
"https://developers.cloudflare.com/dev-products-preview.png",
78+
"network security":
79+
"https://developers.cloudflare.com/core-services-preview.png",
80+
"application performance":
81+
"https://developers.cloudflare.com/core-services-preview.png",
82+
"application security":
83+
"https://developers.cloudflare.com/core-services-preview.png",
84+
};
85+
86+
if (images[group]) {
87+
ogImage = images[group];
88+
}
89+
90+
const tags = [
91+
{
92+
tag: "meta",
93+
attrs: {
94+
name: "image",
95+
content: ogImage,
96+
},
97+
content: "",
98+
},
99+
{
100+
tag: "meta",
101+
attrs: {
102+
name: "og:image",
103+
content: ogImage,
104+
},
105+
content: "",
106+
},
107+
{
108+
tag: "meta",
109+
attrs: {
110+
name: "twitter:image",
111+
content: ogImage,
112+
},
113+
content: "",
114+
},
115+
] as const;
116+
117+
Astro.props.entry.data.head.push(...tags);
118+
67119
Astro.props.entry.data.head.push({
68120
tag: "meta",
69121
attrs: {

0 commit comments

Comments
 (0)