@apify/docusaurus-plugin-typedoc-api 5.1.0 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,6 @@ export interface SourceLinkProps {
5
5
  }
6
6
  export declare function resolveGithubUrl(source: JSONOutput.SourceReference & {
7
7
  gitRevision?: string;
8
- }, siteConfig: DocusaurusConfig, gitRefName: string): string;
8
+ }, siteConfig: DocusaurusConfig, gitRefName: string): string | undefined;
9
9
  export declare function SourceLink({ sources }: SourceLinkProps): import("react/jsx-runtime").JSX.Element;
10
10
  //# sourceMappingURL=SourceLink.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SourceLink.d.ts","sourceRoot":"","sources":["../../src/components/SourceLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAS1D,MAAM,WAAW,eAAe;IAC/B,OAAO,CAAC,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC;CACvC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAExJ;AAED,wBAAgB,UAAU,CAAC,EAAE,OAAY,EAAE,EAAE,eAAe,2CAuB3D"}
1
+ {"version":3,"file":"SourceLink.d.ts","sourceRoot":"","sources":["../../src/components/SourceLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAS1D,MAAM,WAAW,eAAe;IAC/B,OAAO,CAAC,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC;CACvC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUpK;AAED,wBAAgB,UAAU,CAAC,EAAE,OAAY,EAAE,EAAE,eAAe,2CA+B3D"}
@@ -6,8 +6,14 @@ function replaceWithSrc(url) {
6
6
  return url.replace(/\/(dts|dist|lib|build|es|esm|cjs|mjs)\//, '/src/');
7
7
  }
8
8
  export function resolveGithubUrl(source, siteConfig, gitRefName) {
9
- var _a, _b;
10
- return (_a = source.url) !== null && _a !== void 0 ? _a : `https://${siteConfig.githubHost}${siteConfig.githubPort ? `:${siteConfig.githubPort}` : ''}/${siteConfig.organizationName}/${siteConfig.projectName}/blob/${(_b = source.gitRevision) !== null && _b !== void 0 ? _b : gitRefName}/${replaceWithSrc(source.fileName)}#L${source.line}`;
9
+ var _a;
10
+ if (source.url) {
11
+ return source.url;
12
+ }
13
+ if (!siteConfig.githubHost || !siteConfig.organizationName || !siteConfig.projectName) {
14
+ return undefined;
15
+ }
16
+ return `https://${siteConfig.githubHost}${siteConfig.githubPort ? `:${siteConfig.githubPort}` : ''}/${siteConfig.organizationName}/${siteConfig.projectName}/blob/${(_a = source.gitRevision) !== null && _a !== void 0 ? _a : gitRefName}/${replaceWithSrc(source.fileName)}#L${source.line}`;
11
17
  }
12
18
  export function SourceLink({ sources = [] }) {
13
19
  const { siteConfig } = useDocusaurusContext();
@@ -15,6 +21,12 @@ export function SourceLink({ sources = [] }) {
15
21
  if (sources.length === 0) {
16
22
  return null;
17
23
  }
18
- return (_jsx(_Fragment, { children: sources.map((source) => (_jsx("a", { className: "tsd-anchor", href: resolveGithubUrl(source, siteConfig, gitRefName), rel: "noreferrer", target: "_blank", children: _jsx("i", { className: "codicon codicon-file-code" }) }, source.fileName))) }));
24
+ return (_jsx(_Fragment, { children: sources.map((source) => {
25
+ const url = resolveGithubUrl(source, siteConfig, gitRefName);
26
+ if (!url) {
27
+ return null;
28
+ }
29
+ return (_jsx("a", { className: "tsd-anchor", href: url, rel: "noreferrer", target: "_blank", children: _jsx("i", { className: "codicon codicon-file-code" }) }, source.fileName));
30
+ }) }));
19
31
  }
20
32
  //# sourceMappingURL=SourceLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SourceLink.js","sourceRoot":"","sources":["../../src/components/SourceLink.tsx"],"names":[],"mappings":";AAEA,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,SAAS,cAAc,CAAC,GAAW;IAClC,8BAA8B;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,yCAAyC,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC;AAMD,MAAM,UAAU,gBAAgB,CAAC,MAA6D,EAAE,UAA4B,EAAE,UAAkB;;IAC/I,OAAO,MAAA,MAAM,CAAC,GAAG,mCAAI,WAAW,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,UAAU,CAAC,gBAAgB,IAAI,UAAU,CAAC,WAAW,SAAS,MAAA,MAAM,CAAC,WAAW,mCAAI,UAAU,IAAI,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;AACzQ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,GAAG,EAAE,EAAmB;IAC3D,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,CACN,4BACE,OAAO,CAAC,GA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AU,UAAU,CAAC,EAAE,OAAO,GAAG,EAAE,EAAmB;IAC3D,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,CACN,4BACE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACvB,MAAM,GAAG,GAAG,gBAAgB,CAAC,MAAM,EAAE,UAAmB,EAAE,UAAU,CAAC,CAAC;YAEtE,IAAI,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC;YACb,CAAC;YAED,OAAO,CACN,YAEC,SAAS,EAAC,YAAY,EACtB,IAAI,EAAE,GAAG,EACT,GAAG,EAAC,YAAY,EAChB,MAAM,EAAC,QAAQ,YAEf,YAAG,SAAS,EAAC,2BAA2B,GAAG,IANtC,MAAM,CAAC,QAAQ,CAOjB,CACJ,CAAC;QACH,CAAC,CAAC,GACA,CACH,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docusaurus-plugin-typedoc-api",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "Docusaurus plugin that provides source code API documentation powered by TypeDoc.",
5
5
  "workspaces": [
6
6
  "playground/website"
@@ -12,8 +12,16 @@ export interface SourceLinkProps {
12
12
  sources?: JSONOutput.SourceReference[];
13
13
  }
14
14
 
15
- export function resolveGithubUrl(source: JSONOutput.SourceReference & { gitRevision?: string }, siteConfig: DocusaurusConfig, gitRefName: string): string {
16
- return source.url ?? `https://${siteConfig.githubHost}${siteConfig.githubPort ? `:${siteConfig.githubPort}` : ''}/${siteConfig.organizationName}/${siteConfig.projectName}/blob/${source.gitRevision ?? gitRefName}/${replaceWithSrc(source.fileName)}#L${source.line}`;
15
+ export function resolveGithubUrl(source: JSONOutput.SourceReference & { gitRevision?: string }, siteConfig: DocusaurusConfig, gitRefName: string): string | undefined {
16
+ if (source.url) {
17
+ return source.url;
18
+ }
19
+
20
+ if (!siteConfig.githubHost || !siteConfig.organizationName || !siteConfig.projectName) {
21
+ return undefined;
22
+ }
23
+
24
+ return `https://${siteConfig.githubHost}${siteConfig.githubPort ? `:${siteConfig.githubPort}` : ''}/${siteConfig.organizationName}/${siteConfig.projectName}/blob/${source.gitRevision ?? gitRefName}/${replaceWithSrc(source.fileName)}#L${source.line}`;
17
25
  }
18
26
 
19
27
  export function SourceLink({ sources = [] }: SourceLinkProps) {
@@ -26,17 +34,25 @@ export function SourceLink({ sources = [] }: SourceLinkProps) {
26
34
 
27
35
  return (
28
36
  <>
29
- {sources.map((source) => (
30
- <a
31
- key={source.fileName}
32
- className="tsd-anchor"
33
- href={resolveGithubUrl(source, siteConfig as never, gitRefName)}
34
- rel="noreferrer"
35
- target="_blank"
36
- >
37
- <i className="codicon codicon-file-code" />
38
- </a>
39
- ))}
37
+ {sources.map((source) => {
38
+ const url = resolveGithubUrl(source, siteConfig as never, gitRefName);
39
+
40
+ if (!url) {
41
+ return null;
42
+ }
43
+
44
+ return (
45
+ <a
46
+ key={source.fileName}
47
+ className="tsd-anchor"
48
+ href={url}
49
+ rel="noreferrer"
50
+ target="_blank"
51
+ >
52
+ <i className="codicon codicon-file-code" />
53
+ </a>
54
+ );
55
+ })}
40
56
  </>
41
57
  );
42
58
  }