github-url-detection 5.10.0 → 5.12.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 +3 -0
- package/distribution/index.js +7 -3
- package/package.json +1 -1
package/distribution/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const isCommit: (url?: URL | HTMLAnchorElement | Location) => boo
|
|
|
6
6
|
export declare const isCommitList: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
7
7
|
export declare const isRepoCommitList: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
8
8
|
export declare const isCompare: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
9
|
+
export declare const isCompareWikiPage: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
9
10
|
export declare const isDashboard: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
10
11
|
export declare const isEnterprise: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
11
12
|
export declare const isGist: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
@@ -45,6 +46,8 @@ export declare const isQuickPR: (url?: URL | HTMLAnchorElement | Location) => bo
|
|
|
45
46
|
export declare const isDraftPR: () => boolean;
|
|
46
47
|
export declare const isOpenPR: () => boolean;
|
|
47
48
|
export declare const isMergedPR: () => boolean;
|
|
49
|
+
export declare const isClosedConversation: () => boolean;
|
|
50
|
+
/** @deprecated Use isClosedConversation */
|
|
48
51
|
export declare const isClosedPR: () => boolean;
|
|
49
52
|
export declare const isReleases: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
50
53
|
export declare const isTags: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
package/distribution/index.js
CHANGED
|
@@ -27,6 +27,8 @@ const isCompare = (url = location) => {
|
|
|
27
27
|
return Boolean(null === (_a = getRepo(url)) || void 0 === _a ? void 0 : _a.path.startsWith("compare"));
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const isCompareWikiPage = (url = location) => isRepoWiki(url) && getCleanPathname(url).split("/").slice(3, 5).includes("_compare");
|
|
31
|
+
|
|
30
32
|
const isDashboard = (url = location) => !isGist(url) && /^$|^(orgs\/[^/]+\/)?dashboard(\/|$)/.test(getCleanPathname(url));
|
|
31
33
|
|
|
32
34
|
const isEnterprise = (url = location) => "github.com" !== url.hostname && "gist.github.com" !== url.hostname;
|
|
@@ -160,7 +162,9 @@ const isOpenPR = () => exists('#partial-discussion-header [title="Status: Open"]
|
|
|
160
162
|
|
|
161
163
|
const isMergedPR = () => exists('#partial-discussion-header [title="Status: Merged"]');
|
|
162
164
|
|
|
163
|
-
const
|
|
165
|
+
const isClosedConversation = () => exists('#partial-discussion-header :is([title="Status: Closed"], [title="Status: Merged"], [title="Status: Closed as not planned"])');
|
|
166
|
+
|
|
167
|
+
const isClosedPR = isClosedConversation;
|
|
164
168
|
|
|
165
169
|
const isReleases = (url = location) => {
|
|
166
170
|
var _a;
|
|
@@ -322,7 +326,7 @@ const hasComments = (url = location) => isPR(url) || isIssue(url) || isCommit(ur
|
|
|
322
326
|
|
|
323
327
|
const hasRichTextEditor = (url = location) => hasComments(url) || isNewIssue(url) || isCompare(url) || isRepliesSettings(url) || hasReleaseEditor(url) || isDiscussion(url);
|
|
324
328
|
|
|
325
|
-
const hasCode = (url = location) => hasComments(url) || isRepoTree(url) || isRepoSearch(url) || isGlobalSearchResults(url) || isSingleFile(url) || isGist(url) || isCompare(url) || isBlame(url);
|
|
329
|
+
const hasCode = (url = location) => hasComments(url) || isRepoTree(url) || isRepoSearch(url) || isGlobalSearchResults(url) || isSingleFile(url) || isGist(url) || isCompare(url) || isCompareWikiPage(url) || isBlame(url);
|
|
326
330
|
|
|
327
331
|
const hasFiles = (url = location) => isCommit(url) || isCompare(url) || isPRFiles(url);
|
|
328
332
|
|
|
@@ -390,4 +394,4 @@ const utils = {
|
|
|
390
394
|
getRepositoryInfo: getRepo
|
|
391
395
|
};
|
|
392
396
|
|
|
393
|
-
export { canUserEditOrganization, canUserEditRepo, hasCode, hasComments, hasFileEditor, hasFiles, hasReleaseEditor, hasRichTextEditor, hasWikiPageEditor, is404, is500, isActionJobRun, isActionRun, isBlame, isBlank, isBranches, isClosedPR, isCommit, isCommitList, isCompare, isConversation, isConversationList, isDashboard, isDeletingFile, isDiscussion, isDiscussionList, isDraftPR, isEditingFile, isEditingRelease, isEditingWikiPage, isEmptyRepo, isEmptyRepoRoot, isEnterprise, isFileFinder, isForkedRepo, isGist, isGistRevision, isGlobalConversationList, isGlobalSearchResults, isIssue, isLabelList, isMarketplaceAction, isMergedPR, isMilestone, isMilestoneList, isNewAction, isNewFile, isNewIssue, isNewRelease, isNewRepo, isNewRepoTemplate, isNewWikiPage, isNotifications, isOpenPR, isOrganizationDiscussion, isOrganizationProfile, isOrganizationRepo, isOwnOrganizationProfile, isOwnUserProfile, isPR, isPRCommit, isPRCommit404, isPRCommitList, isPRConflicts, isPRConversation, isPRFile404, isPRFiles, isPRList, isPasswordConfirmation, isProfile, isProject, isProjects, isQuickPR, isReleases, isReleasesOrTags, isRepliesSettings, isRepo, isRepoCommitList, isRepoConversationList, isRepoForksList, isRepoHome, isRepoIssueList, isRepoMainSettings, isRepoNetworkGraph, isRepoPRList, isRepoRoot, isRepoSearch, isRepoSettings, isRepoTaxonomyConversationList, isRepoTree, isRepoWiki, isRepositoryActions, isSingleCommit, isSingleFile, isSingleGist, isSingleTag, isTags, isTrending, isUserProfile, isUserProfileFollowersTab, isUserProfileFollowingTab, isUserProfileMainTab, isUserProfileRepoTab, isUserProfileStarsTab, isUserSettings, isUserTheOrganizationOwner, utils };
|
|
397
|
+
export { canUserEditOrganization, canUserEditRepo, hasCode, hasComments, hasFileEditor, hasFiles, hasReleaseEditor, hasRichTextEditor, hasWikiPageEditor, is404, is500, isActionJobRun, isActionRun, isBlame, isBlank, isBranches, isClosedConversation, isClosedPR, isCommit, isCommitList, isCompare, isCompareWikiPage, isConversation, isConversationList, isDashboard, isDeletingFile, isDiscussion, isDiscussionList, isDraftPR, isEditingFile, isEditingRelease, isEditingWikiPage, isEmptyRepo, isEmptyRepoRoot, isEnterprise, isFileFinder, isForkedRepo, isGist, isGistRevision, isGlobalConversationList, isGlobalSearchResults, isIssue, isLabelList, isMarketplaceAction, isMergedPR, isMilestone, isMilestoneList, isNewAction, isNewFile, isNewIssue, isNewRelease, isNewRepo, isNewRepoTemplate, isNewWikiPage, isNotifications, isOpenPR, isOrganizationDiscussion, isOrganizationProfile, isOrganizationRepo, isOwnOrganizationProfile, isOwnUserProfile, isPR, isPRCommit, isPRCommit404, isPRCommitList, isPRConflicts, isPRConversation, isPRFile404, isPRFiles, isPRList, isPasswordConfirmation, isProfile, isProject, isProjects, isQuickPR, isReleases, isReleasesOrTags, isRepliesSettings, isRepo, isRepoCommitList, isRepoConversationList, isRepoForksList, isRepoHome, isRepoIssueList, isRepoMainSettings, isRepoNetworkGraph, isRepoPRList, isRepoRoot, isRepoSearch, isRepoSettings, isRepoTaxonomyConversationList, isRepoTree, isRepoWiki, isRepositoryActions, isSingleCommit, isSingleFile, isSingleGist, isSingleTag, isTags, isTrending, isUserProfile, isUserProfileFollowersTab, isUserProfileFollowingTab, isUserProfileMainTab, isUserProfileRepoTab, isUserProfileStarsTab, isUserSettings, isUserTheOrganizationOwner, utils };
|