github-url-detection 8.0.0 → 8.1.0
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.
- package/distribution/index.d.ts +5 -0
- package/distribution/index.js +2 -0
- package/package.json +1 -1
package/distribution/index.d.ts
CHANGED
|
@@ -83,6 +83,11 @@ export declare const isRepoWiki: (url?: URL | HTMLAnchorElement | Location) => b
|
|
|
83
83
|
export declare const isSingleCommit: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
84
84
|
export declare const isSingleFile: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
85
85
|
export declare const isFileFinder: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
86
|
+
/**
|
|
87
|
+
* @example https://github.com/fregante/GhostText/tree/3cacd7df71b097dc525d99c7aa2f54d31b02fcc8/chrome/scripts/InputArea
|
|
88
|
+
* @example https://github.com/refined-github/refined-github/blob/some-non-existent-ref/source/features/bugs-tab.tsx
|
|
89
|
+
*/
|
|
90
|
+
export declare const isRepoFile404: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
86
91
|
export declare const isRepoForksList: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
87
92
|
export declare const isRepoNetworkGraph: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
88
93
|
export declare const isForkedRepo: () => boolean;
|
package/distribution/index.js
CHANGED
|
@@ -379,6 +379,7 @@ const isRepoWiki = (url = location) => Boolean(getRepo(url)?.path.startsWith("wi
|
|
|
379
379
|
const isSingleCommit = (url = location) => /^commit\/[\da-f]{5,40}$/.test(getRepo(url)?.path);
|
|
380
380
|
const isSingleFile = (url = location) => Boolean(getRepo(url)?.path.startsWith("blob/"));
|
|
381
381
|
const isFileFinder = (url = location) => Boolean(getRepo(url)?.path.startsWith("find/"));
|
|
382
|
+
const isRepoFile404 = (url = location) => (isSingleFile(url) || isRepoTree(url)) && document.title.startsWith("File not found");
|
|
382
383
|
const isRepoForksList = (url = location) => getRepo(url)?.path === "network/members";
|
|
383
384
|
const isRepoNetworkGraph = (url = location) => getRepo(url)?.path === "network";
|
|
384
385
|
const isForkedRepo = () => exists('meta[name="octolytics-dimension-repository_is_fork"][content="true"]');
|
|
@@ -544,6 +545,7 @@ export {
|
|
|
544
545
|
isRepliesSettings,
|
|
545
546
|
isRepo,
|
|
546
547
|
isRepoCommitList,
|
|
548
|
+
isRepoFile404,
|
|
547
549
|
isRepoForksList,
|
|
548
550
|
isRepoHome,
|
|
549
551
|
isRepoIssueList,
|