github-url-detection 10.0.2 → 10.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.
- package/distribution/index.d.ts +2 -0
- package/distribution/index.js +3 -1
- package/package.json +1 -1
package/distribution/index.d.ts
CHANGED
|
@@ -114,6 +114,8 @@ export declare const hasComments: (url?: URL | HTMLAnchorElement | Location) =>
|
|
|
114
114
|
export declare const hasRichTextEditor: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
115
115
|
/** Static code, not the code editor */
|
|
116
116
|
export declare const hasCode: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
117
|
+
/** Covers blob, trees and blame pages */
|
|
118
|
+
export declare const isRepoGitObject: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
117
119
|
/** Has a list of files */
|
|
118
120
|
export declare const hasFiles: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
119
121
|
export declare const isMarketplaceAction: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
package/distribution/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var isOrganizationRepo = () => exists('.AppHeader-context-full [data-hovercard-t
|
|
|
33
33
|
var isTeamDiscussion = (url = location) => Boolean(getOrg(url)?.path.startsWith("teams"));
|
|
34
34
|
var isOwnUserProfile = () => getCleanPathname() === getLoggedInUser();
|
|
35
35
|
var isOwnOrganizationProfile = () => isOrganizationProfile() && !exists('[href*="contact/report-abuse?report="]');
|
|
36
|
-
var isProject = (url = location) => /^projects\/\d+/.test(getRepo(url)?.path);
|
|
36
|
+
var isProject = (url = location) => /^projects\/\d+/.test(getRepo(url)?.path ?? getOrg(url)?.path);
|
|
37
37
|
var isProjects = (url = location) => getRepo(url)?.path === "projects";
|
|
38
38
|
var isDiscussion = (url = location) => /^discussions\/\d+/.test(getRepo(url)?.path ?? getOrg(url)?.path);
|
|
39
39
|
var isNewDiscussion = (url = location) => getRepo(url)?.path === "discussions/new" || getOrg(url)?.path === "discussions/new";
|
|
@@ -167,6 +167,7 @@ var isProfileRepoList = (url = location) => isUserProfileRepoTab(url) || getOrg(
|
|
|
167
167
|
var hasComments = (url = location) => isPR(url) || isIssue(url) || isCommit(url) || isTeamDiscussion(url) || isSingleGist(url);
|
|
168
168
|
var hasRichTextEditor = (url = location) => hasComments(url) || isNewIssue(url) || isCompare(url) || isRepliesSettings(url) || hasReleaseEditor(url) || isDiscussion(url) || isNewDiscussion(url);
|
|
169
169
|
var hasCode = (url = location) => hasComments(url) || isRepoTree(url) || isRepoSearch(url) || isGlobalSearchResults(url) || isSingleFile(url) || isGist(url) || isCompare(url) || isCompareWikiPage(url) || isBlame(url);
|
|
170
|
+
var isRepoGitObject = (url = location) => isRepo(url) && [void 0, "blob", "tree", "blame"].includes(getCleanPathname(url).split("/")[2]);
|
|
170
171
|
var hasFiles = (url = location) => isCommit(url) || isCompare(url) || isPRFiles(url);
|
|
171
172
|
var isMarketplaceAction = (url = location) => url.pathname.startsWith("/marketplace/actions/");
|
|
172
173
|
var isActionJobRun = (url = location) => Boolean(getRepo(url)?.path.startsWith("runs/"));
|
|
@@ -318,6 +319,7 @@ export {
|
|
|
318
319
|
isRepoCommitList,
|
|
319
320
|
isRepoFile404,
|
|
320
321
|
isRepoForksList,
|
|
322
|
+
isRepoGitObject,
|
|
321
323
|
isRepoHome,
|
|
322
324
|
isRepoIssueList,
|
|
323
325
|
isRepoIssueOrPRList,
|