From 11dd39b9eae2b06b37cb617102f068ef4242de5e Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Sun, 12 Jul 2026 12:53:52 +0300 Subject: [PATCH] fix(processor): resolve metadata extraction failure on Vercel --- plugins/processor/source.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/processor/source.mjs b/plugins/processor/source.mjs index 1af04165..f4d809b4 100644 --- a/plugins/processor/source.mjs +++ b/plugins/processor/source.mjs @@ -678,6 +678,11 @@ const attachSourceMetadata = (reflection, sourceEntry, exportEntry) => { }); }; +const getWebpackPath = () => { + const versions = JSON.parse(readFileSync('./versions.json')); + return versions ? `./.cache/webpack/${versions[0]}/lib` : `./webpack/lib`; +}; + /** * Enrich declaration reflections with comments and source locations recovered * from webpack/lib. The declaration file remains authoritative for public API @@ -686,11 +691,8 @@ const attachSourceMetadata = (reflection, sourceEntry, exportEntry) => { * @param {import('typedoc').ProjectReflection} project * @param {{ libDir?: string }} [options] */ -export const applySourceMetadata = ( - project, - { libDir = './webpack/lib' } = {} -) => { - const absoluteLibDir = resolve(libDir); +export const applySourceMetadata = project => { + const absoluteLibDir = resolve(getWebpackPath()); if (!existsSync(absoluteLibDir) || !statSync(absoluteLibDir).isDirectory()) { return; }