From 7f80d79aab9966132b35826ef2dfeb2dc3b17908 Mon Sep 17 00:00:00 2001 From: HiDeoo <494699+HiDeoo@users.noreply.github.com> Date: Sat, 21 Dec 2024 11:00:22 +0100 Subject: [PATCH] feat: add support for astro 5 --- .changeset/fifty-eyes-crash.md | 9 + .eslintrc.json | 3 - .vscode/settings.json | 13 + docs/.prettierignore | 13 - docs/astro.config.ts | 1 + docs/package.json | 12 +- .../Attributes/animate-interval-0.svg | 2 +- .../docs/examples/Attributes/dark-theme-0.svg | 2 +- .../d2/docs/examples/Attributes/layout-0.svg | 2 +- .../d2/docs/examples/Attributes/padding-0.svg | 2 +- .../d2/docs/examples/Attributes/sketch-0.svg | 2 +- .../d2/docs/examples/Attributes/target-0.svg | 2 +- .../d2/docs/examples/Attributes/theme-0.svg | 4 +- .../d2/docs/examples/Attributes/width-0.svg | 2 +- docs/public/d2/docs/examples/advanced-0.svg | 2 +- docs/public/d2/docs/examples/grid-0.svg | 2 +- .../public/d2/docs/examples/hello-world-0.svg | 2 +- docs/public/d2/docs/examples/icons-0.svg | 2 +- docs/public/d2/docs/examples/icons-1.svg | 2 +- docs/public/d2/docs/examples/latex-0.svg | 2 +- docs/public/d2/docs/examples/sequence-0.svg | 310 +- docs/public/d2/docs/examples/sql-tables-0.svg | 2 +- docs/public/d2/docs/getting-started-0.svg | 2 +- docs/public/d2/docs/index-0.svg | 4 +- docs/src/content.config.ts | 7 + docs/src/content/config.ts | 7 - docs/src/content/docs/index.mdx | 4 +- docs/src/env.d.ts | 2 - docs/tsconfig.json | 2 +- eslint.config.mjs | 3 + package.json | 24 +- packages/astro-d2/.npmignore | 1 - packages/astro-d2/.prettierignore | 12 - packages/astro-d2/index.ts | 2 + packages/astro-d2/libs/astro.ts | 17 + packages/astro-d2/libs/attributes.ts | 2 +- packages/astro-d2/libs/d2.ts | 2 +- packages/astro-d2/package.json | 26 +- packages/astro-d2/tsconfig.json | 2 +- pnpm-lock.yaml | 6019 +++++++++-------- tsconfig.json | 1 + 41 files changed, 3476 insertions(+), 3056 deletions(-) create mode 100644 .changeset/fifty-eyes-crash.md delete mode 100644 .eslintrc.json create mode 100644 .vscode/settings.json delete mode 100644 docs/.prettierignore create mode 100644 docs/src/content.config.ts delete mode 100644 docs/src/content/config.ts delete mode 100644 docs/src/env.d.ts create mode 100644 eslint.config.mjs delete mode 100644 packages/astro-d2/.prettierignore create mode 100644 packages/astro-d2/libs/astro.ts diff --git a/.changeset/fifty-eyes-crash.md b/.changeset/fifty-eyes-crash.md new file mode 100644 index 0000000..de9dec5 --- /dev/null +++ b/.changeset/fifty-eyes-crash.md @@ -0,0 +1,9 @@ +--- +'astro-d2': minor +--- + +Adds support for Astro v5, drops support for Astro v4. + +Please follow the [upgrade guide](https://docs.astro.build/en/guides/upgrade-to/v5/) to update your project. + +When using the integration with the [Content Layer API](https://docs.astro.build/en/guides/content-collections) and the [`skipGeneration` option](https://astro-d2.vercel.app/configuration/#skipgeneration) is set to `false`, the integration will automatically invalidate the content layer cache at build time so that all existing diagrams can be generated while ensuring that all removed diagrams are properly cleaned up. This limitation will be removed if and when some upstream technical blockers are resolved. diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 2c08f7e..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["@hideoo"] -} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e4a6ee6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "eslint.useFlatConfig": true, + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "html", + "vue", + "markdown", + "astro" + ] +} diff --git a/docs/.prettierignore b/docs/.prettierignore deleted file mode 100644 index 5baa342..0000000 --- a/docs/.prettierignore +++ /dev/null @@ -1,13 +0,0 @@ -.astro -.github/blocks -.next -.vercel -.vscode-test -.vscode-test-web -build -coverage -dist -dist-ssr -out -pnpm-lock.yaml -src/env.d.ts diff --git a/docs/astro.config.ts b/docs/astro.config.ts index d1ed12d..a97e895 100644 --- a/docs/astro.config.ts +++ b/docs/astro.config.ts @@ -43,4 +43,5 @@ export default defineConfig({ title: 'Astro D2', }), ], + site: 'https://astro-d2.vercel.app/', }) diff --git a/docs/package.json b/docs/package.json index 9851758..84d79f0 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,14 +9,13 @@ "dev": "astro dev", "build": "astro build", "preview": "astro preview", - "lint": "eslint . --cache --max-warnings=0", - "format": "prettier -w --cache --ignore-unknown ." + "lint": "eslint . --cache --max-warnings=0" }, "dependencies": { - "@astrojs/starlight": "0.22.4", - "astro": "4.3.1", + "@astrojs/starlight": "^0.30.3", + "astro": "^5.1.1", "astro-d2": "workspace:*", - "sharp": "0.33.2" + "sharp": "^0.33.5" }, "engines": { "node": ">=18" @@ -34,7 +33,8 @@ "homepage": "https://github.com/HiDeoo/astro-d2", "repository": { "type": "git", - "url": "https://github.com/HiDeoo/astro-d2.git" + "url": "https://github.com/HiDeoo/astro-d2.git", + "directory": "docs" }, "bugs": "https://github.com/HiDeoo/astro-d2/issues" } diff --git a/docs/public/d2/docs/examples/Attributes/animate-interval-0.svg b/docs/public/d2/docs/examples/Attributes/animate-interval-0.svg index 8567661..d68ac57 100644 --- a/docs/public/d2/docs/examples/Attributes/animate-interval-0.svg +++ b/docs/public/d2/docs/examples/Attributes/animate-interval-0.svg @@ -1,4 +1,4 @@ -ContentWebsite Astro + .d2-3990259979 .color-AB5{color:#FFF2AA;}.appendix text.text{fill:#170206}.md{--color-fg-default:#170206;--color-fg-muted:#535152;--color-fg-subtle:#787777;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#ECEBEB;--color-border-default:#31021D;--color-border-muted:#9B1A48;--color-neutral-muted:#ECEBEB;--color-accent-fg:#9B1A48;--color-accent-emphasis:#9B1A48;--color-attention-subtle:#535152;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-B4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]>ContentWebsite Astro diff --git a/docs/public/d2/docs/examples/Attributes/width-0.svg b/docs/public/d2/docs/examples/Attributes/width-0.svg index bc05fc7..b526181 100644 --- a/docs/public/d2/docs/examples/Attributes/width-0.svg +++ b/docs/public/d2/docs/examples/Attributes/width-0.svg @@ -1,4 +1,4 @@ -AliceBob What should I use to create diagrams?D2 - + .d2-1006561166 .fill-N1{fill:#0A0F25;} + .d2-1006561166 .fill-N2{fill:#676C7E;} + .d2-1006561166 .fill-N3{fill:#9499AB;} + .d2-1006561166 .fill-N4{fill:#CFD2DD;} + .d2-1006561166 .fill-N5{fill:#DEE1EB;} + .d2-1006561166 .fill-N6{fill:#EEF1F8;} + .d2-1006561166 .fill-N7{fill:#FFFFFF;} + .d2-1006561166 .fill-B1{fill:#0D32B2;} + .d2-1006561166 .fill-B2{fill:#0D32B2;} + .d2-1006561166 .fill-B3{fill:#E3E9FD;} + .d2-1006561166 .fill-B4{fill:#E3E9FD;} + .d2-1006561166 .fill-B5{fill:#EDF0FD;} + .d2-1006561166 .fill-B6{fill:#F7F8FE;} + .d2-1006561166 .fill-AA2{fill:#4A6FF3;} + .d2-1006561166 .fill-AA4{fill:#EDF0FD;} + .d2-1006561166 .fill-AA5{fill:#F7F8FE;} + .d2-1006561166 .fill-AB4{fill:#EDF0FD;} + .d2-1006561166 .fill-AB5{fill:#F7F8FE;} + .d2-1006561166 .stroke-N1{stroke:#0A0F25;} + .d2-1006561166 .stroke-N2{stroke:#676C7E;} + .d2-1006561166 .stroke-N3{stroke:#9499AB;} + .d2-1006561166 .stroke-N4{stroke:#CFD2DD;} + .d2-1006561166 .stroke-N5{stroke:#DEE1EB;} + .d2-1006561166 .stroke-N6{stroke:#EEF1F8;} + .d2-1006561166 .stroke-N7{stroke:#FFFFFF;} + .d2-1006561166 .stroke-B1{stroke:#0D32B2;} + .d2-1006561166 .stroke-B2{stroke:#0D32B2;} + .d2-1006561166 .stroke-B3{stroke:#E3E9FD;} + .d2-1006561166 .stroke-B4{stroke:#E3E9FD;} + .d2-1006561166 .stroke-B5{stroke:#EDF0FD;} + .d2-1006561166 .stroke-B6{stroke:#F7F8FE;} + .d2-1006561166 .stroke-AA2{stroke:#4A6FF3;} + .d2-1006561166 .stroke-AA4{stroke:#EDF0FD;} + .d2-1006561166 .stroke-AA5{stroke:#F7F8FE;} + .d2-1006561166 .stroke-AB4{stroke:#EDF0FD;} + .d2-1006561166 .stroke-AB5{stroke:#F7F8FE;} + .d2-1006561166 .background-color-N1{background-color:#0A0F25;} + .d2-1006561166 .background-color-N2{background-color:#676C7E;} + .d2-1006561166 .background-color-N3{background-color:#9499AB;} + .d2-1006561166 .background-color-N4{background-color:#CFD2DD;} + .d2-1006561166 .background-color-N5{background-color:#DEE1EB;} + .d2-1006561166 .background-color-N6{background-color:#EEF1F8;} + .d2-1006561166 .background-color-N7{background-color:#FFFFFF;} + .d2-1006561166 .background-color-B1{background-color:#0D32B2;} + .d2-1006561166 .background-color-B2{background-color:#0D32B2;} + .d2-1006561166 .background-color-B3{background-color:#E3E9FD;} + .d2-1006561166 .background-color-B4{background-color:#E3E9FD;} + .d2-1006561166 .background-color-B5{background-color:#EDF0FD;} + .d2-1006561166 .background-color-B6{background-color:#F7F8FE;} + .d2-1006561166 .background-color-AA2{background-color:#4A6FF3;} + .d2-1006561166 .background-color-AA4{background-color:#EDF0FD;} + .d2-1006561166 .background-color-AA5{background-color:#F7F8FE;} + .d2-1006561166 .background-color-AB4{background-color:#EDF0FD;} + .d2-1006561166 .background-color-AB5{background-color:#F7F8FE;} + .d2-1006561166 .color-N1{color:#0A0F25;} + .d2-1006561166 .color-N2{color:#676C7E;} + .d2-1006561166 .color-N3{color:#9499AB;} + .d2-1006561166 .color-N4{color:#CFD2DD;} + .d2-1006561166 .color-N5{color:#DEE1EB;} + .d2-1006561166 .color-N6{color:#EEF1F8;} + .d2-1006561166 .color-N7{color:#FFFFFF;} + .d2-1006561166 .color-B1{color:#0D32B2;} + .d2-1006561166 .color-B2{color:#0D32B2;} + .d2-1006561166 .color-B3{color:#E3E9FD;} + .d2-1006561166 .color-B4{color:#E3E9FD;} + .d2-1006561166 .color-B5{color:#EDF0FD;} + .d2-1006561166 .color-B6{color:#F7F8FE;} + .d2-1006561166 .color-AA2{color:#4A6FF3;} + .d2-1006561166 .color-AA4{color:#EDF0FD;} + .d2-1006561166 .color-AA5{color:#F7F8FE;} + .d2-1006561166 .color-AB4{color:#EDF0FD;} + .d2-1006561166 .color-AB5{color:#F7F8FE;}.appendix text.text{fill:#0A0F25}.md{--color-fg-default:#0A0F25;--color-fg-muted:#676C7E;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#0D32B2;--color-border-muted:#0D32B2;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0D32B2;--color-accent-emphasis:#0D32B2;--color-attention-subtle:#676C7E;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AA5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-AB5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N6{fill:url(#streaks-bright);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}@media screen and (prefers-color-scheme:dark){ + .d2-1006561166 .fill-N1{fill:#CDD6F4;} + .d2-1006561166 .fill-N2{fill:#BAC2DE;} + .d2-1006561166 .fill-N3{fill:#A6ADC8;} + .d2-1006561166 .fill-N4{fill:#585B70;} + .d2-1006561166 .fill-N5{fill:#45475A;} + .d2-1006561166 .fill-N6{fill:#313244;} + .d2-1006561166 .fill-N7{fill:#1E1E2E;} + .d2-1006561166 .fill-B1{fill:#CBA6f7;} + .d2-1006561166 .fill-B2{fill:#CBA6f7;} + .d2-1006561166 .fill-B3{fill:#6C7086;} + .d2-1006561166 .fill-B4{fill:#585B70;} + .d2-1006561166 .fill-B5{fill:#45475A;} + .d2-1006561166 .fill-B6{fill:#313244;} + .d2-1006561166 .fill-AA2{fill:#f38BA8;} + .d2-1006561166 .fill-AA4{fill:#45475A;} + .d2-1006561166 .fill-AA5{fill:#313244;} + .d2-1006561166 .fill-AB4{fill:#45475A;} + .d2-1006561166 .fill-AB5{fill:#313244;} + .d2-1006561166 .stroke-N1{stroke:#CDD6F4;} + .d2-1006561166 .stroke-N2{stroke:#BAC2DE;} + .d2-1006561166 .stroke-N3{stroke:#A6ADC8;} + .d2-1006561166 .stroke-N4{stroke:#585B70;} + .d2-1006561166 .stroke-N5{stroke:#45475A;} + .d2-1006561166 .stroke-N6{stroke:#313244;} + .d2-1006561166 .stroke-N7{stroke:#1E1E2E;} + .d2-1006561166 .stroke-B1{stroke:#CBA6f7;} + .d2-1006561166 .stroke-B2{stroke:#CBA6f7;} + .d2-1006561166 .stroke-B3{stroke:#6C7086;} + .d2-1006561166 .stroke-B4{stroke:#585B70;} + .d2-1006561166 .stroke-B5{stroke:#45475A;} + .d2-1006561166 .stroke-B6{stroke:#313244;} + .d2-1006561166 .stroke-AA2{stroke:#f38BA8;} + .d2-1006561166 .stroke-AA4{stroke:#45475A;} + .d2-1006561166 .stroke-AA5{stroke:#313244;} + .d2-1006561166 .stroke-AB4{stroke:#45475A;} + .d2-1006561166 .stroke-AB5{stroke:#313244;} + .d2-1006561166 .background-color-N1{background-color:#CDD6F4;} + .d2-1006561166 .background-color-N2{background-color:#BAC2DE;} + .d2-1006561166 .background-color-N3{background-color:#A6ADC8;} + .d2-1006561166 .background-color-N4{background-color:#585B70;} + .d2-1006561166 .background-color-N5{background-color:#45475A;} + .d2-1006561166 .background-color-N6{background-color:#313244;} + .d2-1006561166 .background-color-N7{background-color:#1E1E2E;} + .d2-1006561166 .background-color-B1{background-color:#CBA6f7;} + .d2-1006561166 .background-color-B2{background-color:#CBA6f7;} + .d2-1006561166 .background-color-B3{background-color:#6C7086;} + .d2-1006561166 .background-color-B4{background-color:#585B70;} + .d2-1006561166 .background-color-B5{background-color:#45475A;} + .d2-1006561166 .background-color-B6{background-color:#313244;} + .d2-1006561166 .background-color-AA2{background-color:#f38BA8;} + .d2-1006561166 .background-color-AA4{background-color:#45475A;} + .d2-1006561166 .background-color-AA5{background-color:#313244;} + .d2-1006561166 .background-color-AB4{background-color:#45475A;} + .d2-1006561166 .background-color-AB5{background-color:#313244;} + .d2-1006561166 .color-N1{color:#CDD6F4;} + .d2-1006561166 .color-N2{color:#BAC2DE;} + .d2-1006561166 .color-N3{color:#A6ADC8;} + .d2-1006561166 .color-N4{color:#585B70;} + .d2-1006561166 .color-N5{color:#45475A;} + .d2-1006561166 .color-N6{color:#313244;} + .d2-1006561166 .color-N7{color:#1E1E2E;} + .d2-1006561166 .color-B1{color:#CBA6f7;} + .d2-1006561166 .color-B2{color:#CBA6f7;} + .d2-1006561166 .color-B3{color:#6C7086;} + .d2-1006561166 .color-B4{color:#585B70;} + .d2-1006561166 .color-B5{color:#45475A;} + .d2-1006561166 .color-B6{color:#313244;} + .d2-1006561166 .color-AA2{color:#f38BA8;} + .d2-1006561166 .color-AA4{color:#45475A;} + .d2-1006561166 .color-AA5{color:#313244;} + .d2-1006561166 .color-AB4{color:#45475A;} + .d2-1006561166 .color-AB5{color:#313244;}.appendix text.text{fill:#CDD6F4}.md{--color-fg-default:#CDD6F4;--color-fg-muted:#BAC2DE;--color-fg-subtle:#A6ADC8;--color-canvas-default:#1E1E2E;--color-canvas-subtle:#313244;--color-border-default:#CBA6f7;--color-border-muted:#CBA6f7;--color-neutral-muted:#313244;--color-accent-fg:#CBA6f7;--color-accent-emphasis:#CBA6f7;--color-attention-subtle:#BAC2DE;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-B2{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-B3{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-B4{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-B5{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-B6{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-AA2{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-AA4{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-AA5{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-AB4{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-AB5{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N1{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N2{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N3{fill:url(#streaks-normal);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-dark);mix-blend-mode:overlay}.sketch-overlay-N5{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N6{fill:url(#streaks-darker);mix-blend-mode:lighten}.sketch-overlay-N7{fill:url(#streaks-darker);mix-blend-mode:lighten}.light-code{display: none}.dark-code{display: block}}]]>AliceBob What should I use to create diagrams?D2 + - - - + + + diff --git a/docs/public/d2/docs/examples/sql-tables-0.svg b/docs/public/d2/docs/examples/sql-tables-0.svg index 5d13ef7..9258d44 100644 --- a/docs/public/d2/docs/examples/sql-tables-0.svg +++ b/docs/public/d2/docs/examples/sql-tables-0.svg @@ -1,4 +1,4 @@ -