Skip to content

Commit

Permalink
chore: patch Astro to avoid site build errors (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi authored Mar 20, 2024
1 parent 378b860 commit c98c0ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"update": "npm run ts -- ./tools/update.ts",
"new": "npm run ts -- ./tools/new-rule.ts",
"docs:dev": "astro dev",
"docs:build": "astro build",
"docs:build": "npx -y patch-package && astro build",
"docs:setup": "node ./docs-build/setup-docs.mjs",
"docs:preview": "astro preview",
"preversion": "npm test && git add .",
Expand Down Expand Up @@ -66,7 +66,7 @@
},
"devDependencies": {
"@astrojs/compiler": "^2.0.0",
"@astrojs/mdx": "^2.0.0",
"@astrojs/mdx": "^2.2.0",
"@astrojs/svelte": "^5.0.0",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.24.2",
Expand All @@ -85,7 +85,7 @@
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"assert": "^2.0.0",
"astro": "^4.0.0",
"astro": "~4.5.0",
"env-cmd": "^10.1.0",
"esbuild": "^0.20.0",
"esbuild-register": "^3.3.3",
Expand Down
16 changes: 16 additions & 0 deletions patches/astro+4.5.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/node_modules/astro/dist/jsx/babel.js b/node_modules/astro/dist/jsx/babel.js
index 507eb4d..e643353 100644
--- a/node_modules/astro/dist/jsx/babel.js
+++ b/node_modules/astro/dist/jsx/babel.js
@@ -127,6 +127,11 @@ function astroJSX() {
pageOptions: {}
};
}
+ const runtime = path.node.body.find(body => t.isImportDeclaration(body) && body.source.value === "astro/jsx-runtime");
+ if (runtime) {
+ return
+ }
+
path.node.body.splice(
0,
0,

0 comments on commit c98c0ce

Please sign in to comment.