Skip to content

Commit e19514d

Browse files
chore(deps): Update Astro from 5.9.3 to 7.1.3
1 parent 57e55a1 commit e19514d

15 files changed

Lines changed: 2720 additions & 1924 deletions

File tree

package-lock.json

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

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@
9494
"@popperjs/core": "^2.11.8"
9595
},
9696
"devDependencies": {
97-
"@astrojs/check": "^0.9.4",
98-
"@astrojs/markdown-remark": "^6.3.6",
99-
"@astrojs/mdx": "^4.3.4",
100-
"@astrojs/prism": "^3.3.0",
101-
"@astrojs/sitemap": "^3.5.0",
97+
"@astrojs/check": "^0.9.9",
98+
"@astrojs/markdown-remark": "^7.2.1",
99+
"@astrojs/mdx": "^7.0.3",
100+
"@astrojs/prism": "^4.0.2",
101+
"@astrojs/sitemap": "^3.7.3",
102102
"@babel/cli": "^7.28.3",
103103
"@babel/core": "^7.29.6",
104104
"@babel/preset-env": "^7.28.3",
@@ -116,8 +116,7 @@
116116
"@types/js-yaml": "^4.0.9",
117117
"@types/mime": "^4.0.0",
118118
"@types/prismjs": "^1.26.5",
119-
"astro": "^5.13.2",
120-
"astro-auto-import": "^0.4.4",
119+
"astro": "^7.1.3",
121120
"autoprefixer": "^10.4.21",
122121
"bundlewatch": "^0.4.2",
123122
"clean-css-cli": "^5.6.3",

scss/_alert.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
gap: $ouds-alert-space-row-gap-action;
9898
align-items: flex-start;
9999
justify-content: center; // To handle weird edge cases in de-zoom one line title alert
100+
width: 20%;
100101
min-height: $ouds-alert-size-min-height; // To handle weird edge cases in de-zoom one line title alert
101102
padding-block: $ouds-alert-space-padding-block;
102103
}
@@ -105,6 +106,7 @@
105106
display: flex;
106107
flex-direction: column;
107108
gap: $ouds-alert-space-row-gap;
109+
width: 100%;
108110

109111
> * { // To handle any content inside this text-container.
110112
margin-bottom: 0;

site/astro.config.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ import { oudsWeb } from './src/libs/astro'
66
import { getConfig } from './src/libs/config'
77
import { algoliaPlugin } from './src/plugins/algolia-plugin'
88
import { stackblitzPlugin } from './src/plugins/stackblitz-plugin'
9+
import type { Element, Text } from 'hast'
10+
import { rehypeHeadingIds, unified } from '@astrojs/markdown-remark'
11+
import { rehypeBsTable } from './src/libs/rehype'
12+
import { remarkBsComp, remarkBsConfig, remarkBsDocsref } from './src/libs/remark'
13+
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
914

1015
const isDev = process.env.NODE_ENV === 'development'
1116

17+
const headingsRangeRegex = new RegExp(`^h[${getConfig().anchors.min}-${getConfig().anchors.max}]$`)
18+
1219
const site = isDev
1320
? // In development mode, use the local dev server.
1421
'http://localhost:9001'
@@ -20,12 +27,32 @@ const site = isDev
2027

2128
// https://astro.build/config
2229
export default defineConfig({
30+
compressHTML: false,
2331
build: {
2432
assets: `${getConfig().brand}/docs/${getConfig().docs_version}/assets`
2533
},
2634
integrations: [oudsWeb()],
2735
markdown: {
2836
smartypants: false,
37+
processor: unified({
38+
rehypePlugins: [
39+
rehypeHeadingIds,
40+
[
41+
rehypeAutolinkHeadings,
42+
{
43+
behavior: 'append',
44+
content: [{ type: 'text', value: ' '}],
45+
properties: (element: Element) => ({
46+
class: 'anchor-link',
47+
ariaLabel: `Link to this section: ${(element.children[0] as Text).value}`
48+
}),
49+
test: (element: Element) => element.tagName.match(headingsRangeRegex)
50+
}
51+
],
52+
rehypeBsTable
53+
],
54+
remarkPlugins: [remarkBsConfig, remarkBsDocsref, remarkBsComp]
55+
}),
2956
syntaxHighlight: 'prism'
3057
},
3158
site,

site/src/components/DocsSidebar.astro

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import { getData } from '@libs/data'
33
import { getConfig } from '@libs/config'
4-
import { docsPages } from '@libs/content'
4+
import { docsPages, getDocsPageSlug } from '@libs/content'
55
import { getSlug } from '@libs/utils'
66
import { getVersionedDocsPath } from '@libs/path'
77
@@ -14,9 +14,10 @@ const sidebarMap = {
1414
utilities: 'utilities',
1515
layout: 'layout',
1616
about: ''
17-
}
17+
} as const
1818
19-
const sidebar = sidebarMap[slug] ? getData(`sidebar-${sidebarMap[slug]}`) : []
19+
const sidebarKey = sidebarMap[slug as keyof typeof sidebarMap]
20+
const sidebar = sidebarKey ? getData(`sidebar-${sidebarKey}`) : []
2021
---
2122

2223
<nav class="bd-links w-100" id="bd-docs-nav" aria-labelledby="docs-nav">
@@ -60,12 +61,12 @@ const sidebar = sidebarMap[slug] ? getData(`sidebar-${sidebarMap[slug]}`) : []
6061
}
6162
const active = Astro.params.slug === unversionedPageSlug
6263

63-
const generatedPage = docsPages.find((page: any) => page.slug === unversionedPageSlug)
64+
const generatedPage = docsPages.find((page: any) => getDocsPageSlug(page.id) === unversionedPageSlug)
6465

6566
// This test should not be necessary, see comments for `getSlug()` in `src/libs/utils.ts`.
6667
if (!page.direct_url && !generatedPage) {
6768
throw new Error(
68-
`The page '${page.title}' referenced in 'site/data/sidebar${sidebarMap[slug]}.yml' does not exist at '${url}'.`
69+
`The page '${page.title}' referenced in 'site/data/sidebar${sidebarKey}.yml' does not exist at '${url}'.`
6970
)
7071
}
7172

site/src/components/shortcodes/Callout.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import { getCalloutByName } from '@libs/content'
33
import type { MarkdownInstance } from 'astro'
4+
import { render } from 'astro:content'
45
56
interface Props {
67
/**
@@ -72,7 +73,7 @@ if (name) {
7273
throw new Error(`Could not find callout with name '${name}'.`)
7374
}
7475
75-
const namedCallout = await callout.render()
76+
const namedCallout = await render(callout)
7677
if (namedCallout.remarkPluginFrontmatter && namedCallout.remarkPluginFrontmatter.title) {
7778
titleToDisplay = namedCallout.remarkPluginFrontmatter.title
7879
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export { default as AddedIn } from './AddedIn.astro'
2+
export { default as BootstrapCompatibility } from './BootstrapCompatibility.astro'
3+
export { default as BrandSpecific } from './BrandSpecific.astro'
4+
export { default as BsTable } from './BsTable.astro'
5+
export { default as Callout } from './Callout.astro'
6+
export { default as CalloutSoon } from './CalloutSoon.astro'
7+
export { default as Code } from './Code.astro'
8+
export { default as ColorTable } from './ColorTable.astro'
9+
export { default as ComponentCard } from './ComponentCard.astro'
10+
export { default as ControlItem } from './ControlItem.mdx'
11+
export { default as DeprecatedIn } from './DeprecatedIn.astro'
12+
export { default as Details } from './Details.astro'
13+
export { default as EnableBtnCloseTooltip } from './EnableBtnCloseTooltip.astro'
14+
export { default as Example } from './Example.astro'
15+
export { default as GuideFooter } from './GuideFooter.mdx'
16+
export { default as JsDataAttributes } from './JsDataAttributes.mdx'
17+
export { default as JsDismiss } from './JsDismiss.astro'
18+
export { default as JsDocs } from './JsDocs.astro'
19+
export { default as MandatoryFieldIndication } from './MandatoryFieldIndication.astro'
20+
export { default as Placeholder } from './Placeholder.astro'
21+
export { default as ScssDocs } from './ScssDocs.astro'
22+
export { default as SkeletonRedirect } from './SkeletonRedirect.astro'
23+
export { default as SvgDocs } from './SvgDocs.astro'
24+
export { default as Table } from './Table.astro'
25+
export { default as TableContent } from './TableContent.md'
26+
export { default as ThemeDemo } from './ThemeDemo.astro'
27+
export { default as ThemeDemoStylesImport } from './ThemeDemoStylesImport.astro'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { z, defineCollection } from 'astro:content'
2+
import { glob } from 'astro/loaders'
23

34
const docsSchema = z.object({
45
added: z
@@ -34,12 +35,20 @@ const docsSchema = z.object({
3435
})
3536

3637
const docsCollection = defineCollection({
38+
loader: glob({
39+
base: './src/content/docs',
40+
pattern: '**/*.{md,mdx}'
41+
}),
3742
schema: docsSchema
3843
})
3944

4045
const calloutsSchema = z.object({})
4146

4247
const calloutsCollection = defineCollection({
48+
loader: glob({
49+
base: './src/content/callouts',
50+
pattern: '**/*.{md,mdx}'
51+
}),
4352
schema: calloutsSchema
4453
})
4554

site/src/content/docs/components.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ toc: true
1010

1111
import { componentsDetails } from '../../../data/components-details'
1212
import { getVersionedDocsPath } from '@libs/path'
13+
import { ComponentCard } from '@components/shortcodes'
1314

1415
<Callout
1516
type="info"

site/src/libs/astro.ts

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
3-
import { rehypeHeadingIds } from '@astrojs/markdown-remark'
43
import mdx from '@astrojs/mdx'
54
import sitemap from '@astrojs/sitemap'
65
import type { AstroIntegration } from 'astro'
7-
import autoImport from 'astro-auto-import'
8-
import type { Element, Text } from 'hast'
9-
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
106
import { getConfig } from './config'
11-
import { rehypeBsTable } from './rehype'
12-
import { remarkBsComp, remarkBsConfig, remarkBsDocsref } from './remark'
137
import { configurePrism } from './prism'
148
import {
15-
docsDirectory,
169
getDocsFsPath,
1710
getDocsPublicFsPath,
1811
getDocsStaticFsPath,
1912
validateVersionedDocsPaths
2013
} from './path'
2114

22-
// A list of directories in `src/components` that contains components that will be auto imported in all pages for
23-
// convenience.
24-
// Note: adding a new component to one of the existing directories requires a restart of the dev server.
25-
const autoImportedComponentDirectories = ['shortcodes']
26-
2715
// A list of static file paths that will be aliased to a different path.
2816
const staticFileAliases = {
2917
'/orange/docs/[version]/assets/img/favicons/apple-touch-icon.png': '/apple-touch-icon.png',
@@ -48,44 +36,18 @@ const sitemapExcludes = [
4836
`/${getConfig().brand}/docs/${getConfig().docs_version}/about`
4937
]
5038

51-
const headingsRangeRegex = new RegExp(`^h[${getConfig().anchors.min}-${getConfig().anchors.max}]$`)
52-
5339
export function oudsWeb(): AstroIntegration[] {
5440
const sitemapExcludedUrls = sitemapExcludes.map((url) => `${getConfig().baseURL}${url}/`)
5541

5642
configurePrism()
5743

5844
return [
59-
ouds_web_auto_import(),
6045
{
6146
name: 'ouds-web-integration',
6247
hooks: {
63-
'astro:config:setup': ({ addWatchFile, updateConfig }) => {
48+
'astro:config:setup': ({ addWatchFile }) => {
6449
// Reload the config when the integration is modified.
6550
addWatchFile(path.join(getDocsFsPath(), 'src/libs/astro.ts'))
66-
67-
// Add the remark and rehype plugins.
68-
updateConfig({
69-
markdown: {
70-
rehypePlugins: [
71-
rehypeHeadingIds,
72-
[
73-
rehypeAutolinkHeadings,
74-
{
75-
behavior: 'append',
76-
content: [{ type: 'text', value: ' '}],
77-
properties: (element: Element) => ({
78-
class: 'anchor-link',
79-
ariaLabel: `Link to this section: ${(element.children[0] as Text).value}`
80-
}),
81-
test: (element: Element) => element.tagName.match(headingsRangeRegex)
82-
}
83-
],
84-
rehypeBsTable
85-
],
86-
remarkPlugins: [remarkBsConfig, remarkBsDocsref, remarkBsComp]
87-
}
88-
})
8951
},
9052
'astro:config:done': () => {
9153
cleanPublicDirectory()
@@ -107,51 +69,6 @@ export function oudsWeb(): AstroIntegration[] {
10769
]
10870
}
10971

110-
function ouds_web_auto_import() {
111-
const autoImportedComponents: string[] = []
112-
const autoImportedComponentDefinitions: string[] = []
113-
114-
for (const autoImportedComponentDirectory of autoImportedComponentDirectories) {
115-
const components = fs.readdirSync(path.join(getDocsFsPath(), 'src/components', autoImportedComponentDirectory), {
116-
withFileTypes: true
117-
})
118-
119-
for (const component of components) {
120-
if (component.isFile()) {
121-
autoImportedComponents.push(
122-
`./${path.posix.join(docsDirectory, 'src/components', autoImportedComponentDirectory, component.name)}`
123-
)
124-
125-
if (component.name.endsWith('.astro')) {
126-
autoImportedComponentDefinitions.push(
127-
`export const ${component.name.replace('.astro', '')}: typeof import('@shortcodes/${
128-
component.name
129-
}').default`
130-
)
131-
}
132-
}
133-
}
134-
}
135-
136-
const autoImportedComponentDefinition = `/**
137-
* DO NOT EDIT THIS FILE MANUALLY.
138-
*
139-
* This file is automatically generated by the Bootstrap Astro Integration.
140-
* It contains the type definitions for the components that are auto imported in all pages.
141-
* @see site/src/libs/astro.ts
142-
*/
143-
export declare global {
144-
${autoImportedComponentDefinitions.join('\n ')}
145-
}
146-
`
147-
148-
fs.writeFileSync(path.join(getDocsFsPath(), 'src/types/auto-import.d.ts'), autoImportedComponentDefinition)
149-
150-
return autoImport({
151-
imports: autoImportedComponents
152-
})
153-
}
154-
15572
function cleanPublicDirectory() {
15673
fs.rmSync(getDocsPublicFsPath(), { force: true, recursive: true })
15774
}

0 commit comments

Comments
 (0)