diff --git a/package.json b/package.json index 9805cc349bb35..98b8fe391aa70 100644 --- a/package.json +++ b/package.json @@ -115,6 +115,9 @@ "react-dom", "vite" ] + }, + "patchedDependencies": { + "astro@2.0.17": "patches/astro@2.0.17.patch" } } } diff --git a/patches/astro@2.0.17.patch b/patches/astro@2.0.17.patch new file mode 100644 index 0000000000000..3c98552de821f --- /dev/null +++ b/patches/astro@2.0.17.patch @@ -0,0 +1,30 @@ +diff --git a/dist/content/internal.js b/dist/content/internal.js +index 697a57cdce15610a422f9a42e861f2f4d7d99737..cb9f11759651c0516ee4bbc2334e1c137e5f3bac 100644 +--- a/dist/content/internal.js ++++ b/dist/content/internal.js +@@ -28,12 +28,17 @@ function createCollectionToGlobResultMap({ + } + return collectionToGlobResultMap; + } ++const cacheByCollection = new Map(); + function createGetCollection({ + collectionToEntryMap, + collectionToRenderEntryMap + }) { + return async function getCollection(collection, filter) { + const lazyImports = Object.values(collectionToEntryMap[collection] ?? {}); ++ // TODO: cache on prod builds only ++ if (cacheByCollection.has(collection)) { ++ return cacheByCollection.get(collection); ++ } + const entries = Promise.all( + lazyImports.map(async (lazyImport) => { + const entry = await lazyImport(); +@@ -53,6 +58,7 @@ function createGetCollection({ + }; + }) + ); ++ cacheByCollection.set(collection, entries); + if (typeof filter === "function") { + return (await entries).filter(filter); + } else { \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d6acc13a56bd0..0f1d17a8f76fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,10 @@ lockfileVersion: 5.4 +patchedDependencies: + astro@2.0.17: + hash: xf7wxti4apssfjkfm4jyy2lwmy + path: patches/astro@2.0.17.patch + specifiers: '@11ty/eleventy-fetch': ^3.0.0 '@actions/core': ^1.9.0 @@ -102,7 +107,7 @@ devDependencies: '@types/node': 18.6.4 '@typescript-eslint/eslint-plugin': 5.46.1_57lsfxhrvnuchjqw5nfxr44o7y '@typescript-eslint/parser': 5.46.1_ixh6nceclvqov4hcu5gszby2fi - astro: 2.0.17_lo4g36gygrjg64j6jydpsd7m54 + astro: 2.0.17_xf7wxti4apssfjkfm4jyy2lwmy_lo4g36gygrjg64j6jydpsd7m54 astro-auto-import: 0.2.1_astro@2.0.17 astro-eslint-parser: 0.9.2 astro-og-canvas: 0.1.6_astro@2.0.17 @@ -363,7 +368,7 @@ packages: astro: ^2.0.2 dependencies: '@astrojs/prism': 2.0.0 - astro: 2.0.17_lo4g36gygrjg64j6jydpsd7m54 + astro: 2.0.17_xf7wxti4apssfjkfm4jyy2lwmy_lo4g36gygrjg64j6jydpsd7m54 github-slugger: 1.5.0 import-meta-resolve: 2.1.0 rehype-raw: 6.1.1 @@ -1694,7 +1699,7 @@ packages: dependencies: '@types/node': 18.6.4 acorn: 8.8.1 - astro: 2.0.17_lo4g36gygrjg64j6jydpsd7m54 + astro: 2.0.17_xf7wxti4apssfjkfm4jyy2lwmy_lo4g36gygrjg64j6jydpsd7m54 dev: true /astro-eslint-parser/0.9.2: @@ -1718,12 +1723,12 @@ packages: peerDependencies: astro: ^1.0.0 || ^2.0.0-beta dependencies: - astro: 2.0.17_lo4g36gygrjg64j6jydpsd7m54 + astro: 2.0.17_xf7wxti4apssfjkfm4jyy2lwmy_lo4g36gygrjg64j6jydpsd7m54 canvaskit-wasm: 0.37.0 entities: 4.4.0 dev: true - /astro/2.0.17_lo4g36gygrjg64j6jydpsd7m54: + /astro/2.0.17_xf7wxti4apssfjkfm4jyy2lwmy_lo4g36gygrjg64j6jydpsd7m54: resolution: {integrity: sha512-K/SAoe4Tfhg4XhOu1mFOp9qiC/m8YuBmL3//WAA+mcPTlg9A21nlXH/jmsfbizQdZn/AyoPrkTWQm1pnU05OsQ==} engines: {node: '>=16.12.0', npm: '>=6.14.0'} hasBin: true @@ -1789,6 +1794,7 @@ packages: - supports-color - terser dev: true + patched: true /astrojs-compiler-sync/0.3.1_@astrojs+compiler@0.31.0: resolution: {integrity: sha512-IzPuzkwdiRIZoBhCTuFhuBMWVESXgthTdwQ24QS8LvLargcWAA4E21KmZo4wimsmOG5vj4KKs9QFpy9zhXuo9Q==}