Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions plugins/processor/source.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
Loading