github-url-detection 9.0.3 → 10.0.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 -4
- package/distribution/index.js +14 -26
- package/package.json +2 -1
package/distribution/index.d.ts
CHANGED
|
@@ -45,11 +45,10 @@ export declare const isPRConversation: (url?: URL | HTMLAnchorElement | Location
|
|
|
45
45
|
export declare const isPRCommitList: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
46
46
|
export declare const isPRFiles: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
47
47
|
export declare const isQuickPR: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
48
|
-
export declare const isDraftPR: () => boolean;
|
|
49
|
-
export declare const isOpenPR: () => boolean;
|
|
50
48
|
export declare const isMergedPR: () => boolean;
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const
|
|
49
|
+
export declare const isDraftPR: () => boolean;
|
|
50
|
+
export declare const isOpenConversation: () => boolean;
|
|
51
|
+
export declare const isClosedConversation: () => boolean;
|
|
53
52
|
export declare const isReleases: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
54
53
|
export declare const isTags: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
55
54
|
export declare const isSingleReleaseOrTag: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
package/distribution/index.js
CHANGED
|
@@ -48,32 +48,21 @@ var isPRConversation = (url = location) => /^pull\/\d+$/.test(getRepo(url)?.path
|
|
|
48
48
|
var isPRCommitList = (url = location) => /^pull\/\d+\/commits$/.test(getRepo(url)?.path);
|
|
49
49
|
var isPRFiles = (url = location) => /^pull\/\d+\/files/.test(getRepo(url)?.path) || isPRCommit(url);
|
|
50
50
|
var isQuickPR = (url = location) => isCompare(url) && /[?&]quick_pull=1(&|$)/.test(url.search);
|
|
51
|
-
var
|
|
51
|
+
var getStateLabel = () => $([
|
|
52
52
|
".State",
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const status =
|
|
53
|
+
// Old view
|
|
54
|
+
'[class^="StateLabel"]'
|
|
55
|
+
// React version
|
|
56
|
+
].join(","))?.textContent?.trim();
|
|
57
|
+
var isMergedPR = () => getStateLabel() === "Merged";
|
|
58
|
+
var isDraftPR = () => getStateLabel() === "Draft";
|
|
59
|
+
var isOpenConversation = () => {
|
|
60
|
+
const status = getStateLabel();
|
|
61
61
|
return status === "Open" || status === "Draft";
|
|
62
62
|
};
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
const status = $(stateSelector).textContent.trim();
|
|
69
|
-
return status === "Closed" || status === "Merged";
|
|
70
|
-
};
|
|
71
|
-
var isClosedIssue = () => {
|
|
72
|
-
if (!isIssue()) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
const status = $(stateSelector).textContent.trim();
|
|
76
|
-
return status === "Closed" || status === "Closed as not planned";
|
|
63
|
+
var isClosedConversation = () => {
|
|
64
|
+
const status = getStateLabel();
|
|
65
|
+
return status === "Closed" || status === "Closed as not planned" || status === "Merged";
|
|
77
66
|
};
|
|
78
67
|
var isReleases = (url = location) => getRepo(url)?.path === "releases";
|
|
79
68
|
var isTags = (url = location) => getRepo(url)?.path === "tags";
|
|
@@ -234,8 +223,7 @@ export {
|
|
|
234
223
|
isBlame,
|
|
235
224
|
isBlank,
|
|
236
225
|
isBranches,
|
|
237
|
-
|
|
238
|
-
isClosedPR,
|
|
226
|
+
isClosedConversation,
|
|
239
227
|
isCommit,
|
|
240
228
|
isCommitList,
|
|
241
229
|
isCompare,
|
|
@@ -276,7 +264,7 @@ export {
|
|
|
276
264
|
isNewRepoTemplate,
|
|
277
265
|
isNewWikiPage,
|
|
278
266
|
isNotifications,
|
|
279
|
-
|
|
267
|
+
isOpenConversation,
|
|
280
268
|
isOrganizationProfile,
|
|
281
269
|
isOrganizationRepo,
|
|
282
270
|
isOwnOrganizationProfile,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-url-detection",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"build:esbuild": "esbuild index.ts --bundle --external:github-reserved-names --outdir=distribution --format=esm --drop-labels=TEST",
|
|
29
29
|
"build:typescript": "tsc --declaration --emitDeclarationOnly",
|
|
30
30
|
"build:demo": "vite build demo",
|
|
31
|
+
"fix": "xo --fix",
|
|
31
32
|
"prepack": "npm run build",
|
|
32
33
|
"test": "run-p build test:* xo",
|
|
33
34
|
"test:unit": "vitest",
|