github-url-detection 11.1.0 → 11.1.2
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 +4 -0
- package/distribution/index.js +3 -2
- package/package.json +1 -1
package/distribution/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare const isRepoCommitList: (url?: URL | HTMLAnchorElement | Location
|
|
|
32
32
|
* @example https://github.com/sindresorhus/refined-github/compare/master...branch-name?quick_pull=1
|
|
33
33
|
* @example https://github.com/sindresorhus/refined-github/compare/branch-1...branch-2?quick_pull=1
|
|
34
34
|
* @example https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1
|
|
35
|
+
* @example https://github.com/refined-github/sandbox/compare/fregante-patch-2?expand=1
|
|
36
|
+
* @example https://github.com/refined-github/sandbox/compare/default-a...fregante-patch-2?expand=1
|
|
35
37
|
*/
|
|
36
38
|
export declare const isCompare: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
37
39
|
/**
|
|
@@ -212,6 +214,8 @@ export declare const isPRFiles: (url?: URL | HTMLAnchorElement | Location) => bo
|
|
|
212
214
|
* @example https://github.com/sindresorhus/refined-github/compare/master...branch-name?quick_pull=1
|
|
213
215
|
* @example https://github.com/sindresorhus/refined-github/compare/branch-1...branch-2?quick_pull=1
|
|
214
216
|
* @example https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1
|
|
217
|
+
* @example https://github.com/refined-github/sandbox/compare/fregante-patch-2?expand=1
|
|
218
|
+
* @example https://github.com/refined-github/sandbox/compare/default-a...fregante-patch-2?expand=1
|
|
215
219
|
*/
|
|
216
220
|
export declare const isQuickPR: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
217
221
|
export declare const isMergedPR: () => boolean;
|
package/distribution/index.js
CHANGED
|
@@ -47,13 +47,14 @@ var isPRFile404 = () => isPRFiles() && document.title.startsWith("Commit range n
|
|
|
47
47
|
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|(changes(\/[\da-f]{7,40}..[\da-f]{7,40})?$))/.test(getRepo(url)?.path) || isPRCommit(url);
|
|
50
|
-
var isQuickPR = (url = location) => isCompare(url) && /[?&]quick_pull=1(&|$)/.test(url.search);
|
|
50
|
+
var isQuickPR = (url = location) => isCompare(url) && /[?&](quick_pull|expand)=1(&|$)/.test(url.search);
|
|
51
51
|
var getStateLabel = () => $([
|
|
52
52
|
".State",
|
|
53
53
|
// Old view
|
|
54
54
|
// React versions
|
|
55
55
|
'[class^="StateLabel"]',
|
|
56
|
-
|
|
56
|
+
// TODO: Remove after July 2026
|
|
57
|
+
'[class^="prc-StateLabel-StateLabel"]'
|
|
57
58
|
].join(","))?.textContent?.trim();
|
|
58
59
|
var isMergedPR = () => getStateLabel() === "Merged";
|
|
59
60
|
var isDraftPR = () => getStateLabel() === "Draft";
|