Skip to content

Commit 52c6c8b

Browse files
committed
6.0.1, update build to maintain dts output paths
1 parent a80bf96 commit 52c6c8b

34 files changed

Lines changed: 25555 additions & 56939 deletions

build/dts-paths.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { resolve } from 'node:path';
2+
3+
const normalizePath = (filePath: string): string => filePath.replace(/\\/g, '/');
4+
5+
export const rewriteLegacyCoreDtsPath = (filePath: string): string => {
6+
const normalizedPath = normalizePath(filePath);
7+
const legacyPathMarker = '/dist/js/';
8+
const markerIndex = normalizedPath.indexOf(legacyPathMarker);
9+
10+
if (markerIndex === -1) {
11+
return filePath;
12+
}
13+
14+
const distRoot = normalizedPath.slice(0, markerIndex + '/dist'.length);
15+
const relativePath = normalizedPath.slice(markerIndex + legacyPathMarker.length);
16+
17+
return resolve(distRoot, relativePath);
18+
};
19+
20+
export const rewriteLegacyPluginDtsPath = (filePath: string, pluginName: string): string | null => {
21+
const normalizedPath = normalizePath(filePath);
22+
23+
if (normalizedPath.endsWith(`/${pluginName}.d.ts`)) {
24+
return filePath;
25+
}
26+
27+
if (!normalizedPath.endsWith('/index.d.ts')) {
28+
return null;
29+
}
30+
31+
const pluginDirectoryMarker = `/${pluginName}/`;
32+
const markerIndex = normalizedPath.indexOf(pluginDirectoryMarker);
33+
34+
if (markerIndex === -1) {
35+
return null;
36+
}
37+
38+
return resolve(normalizedPath.slice(0, markerIndex), `${pluginName}.d.ts`);
39+
};

dist/plugin/highlight.js

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)