github-url-detection 10.2.3 → 11.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.
@@ -1,65 +1,272 @@
1
+ /* Examples added by add-examples-to-dts.ts */
1
2
  export declare const is404: () => boolean;
2
3
  export declare const is500: () => boolean;
3
4
  export declare const isPasswordConfirmation: () => boolean;
4
5
  export declare const isLoggedIn: () => boolean;
6
+ /** @example https://github.com/sindresorhus/refined-github/blame/master/package.json */
5
7
  export declare const isBlame: (url?: URL | HTMLAnchorElement | Location) => boolean;
8
+ /**
9
+ * @example https://github.com/sindresorhus/refined-github/commit/5b614b9035f2035b839f48b4db7bd5c3298d526f
10
+ * @example https://github.com/sindresorhus/refined-github/commit/5b614
11
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
12
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d79
13
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
14
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d79
15
+ */
6
16
  export declare const isCommit: (url?: URL | HTMLAnchorElement | Location) => boolean;
7
17
  export declare const isCommitList: (url?: URL | HTMLAnchorElement | Location) => boolean;
18
+ /**
19
+ * @example https://github.com/sindresorhus/refined-github/commits/master?page=2
20
+ * @example https://github.com/sindresorhus/refined-github/commits/test-branch
21
+ * @example https://github.com/sindresorhus/refined-github/commits/0.13.0
22
+ * @example https://github.com/sindresorhus/refined-github/commits/230c2
23
+ * @example https://github.com/sindresorhus/refined-github/commits/230c2935fc5aea9a681174ddbeba6255ca040d63
24
+ * @example https://github.com/sindresorhus/refined-github/commits?author=fregante
25
+ * @example https://github.com/sindresorhus/runs/commits/
26
+ */
8
27
  export declare const isRepoCommitList: (url?: URL | HTMLAnchorElement | Location) => boolean;
28
+ /**
29
+ * @example https://github.com/sindresorhus/refined-github/compare
30
+ * @example https://github.com/sindresorhus/refined-github/compare/
31
+ * @example https://github.com/sindresorhus/refined-github/compare/master...branch-name
32
+ * @example https://github.com/sindresorhus/refined-github/compare/master...branch-name?quick_pull=1
33
+ * @example https://github.com/sindresorhus/refined-github/compare/branch-1...branch-2?quick_pull=1
34
+ * @example https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1
35
+ */
9
36
  export declare const isCompare: (url?: URL | HTMLAnchorElement | Location) => boolean;
37
+ /**
38
+ * @example https://github.com/brookhong/Surfingkeys/wiki/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d
39
+ * @example https://github.com/brookhong/Surfingkeys/wiki/Color-Themes/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d
40
+ */
10
41
  export declare const isCompareWikiPage: (url?: URL | HTMLAnchorElement | Location) => boolean;
42
+ /**
43
+ * @example https://github.com///
44
+ * @example https://github.com//
45
+ * @example https://github.com/
46
+ * @example https://github.com
47
+ * @example https://github.com/orgs/test/dashboard
48
+ * @example https://github.com/dashboard/index/2
49
+ * @example https://github.com//dashboard
50
+ * @example https://github.com/dashboard
51
+ * @example https://github.com/orgs/edit/dashboard
52
+ * @example https://github.big-corp.com/
53
+ * @example https://not-github.com/
54
+ * @example https://my-little-hub.com/
55
+ * @example https://github.com/?tab=repositories
56
+ * @example https://github.com/?tab=stars
57
+ * @example https://github.com/?tab=followers
58
+ * @example https://github.com/?tab=following
59
+ * @example https://github.com/?tab=overview
60
+ * @example https://github.com?search=1
61
+ * @example https://github.com/dashboard-feed
62
+ */
11
63
  export declare const isDashboard: (url?: URL | HTMLAnchorElement | Location) => boolean;
64
+ /**
65
+ * @example https://github.big-corp.com/
66
+ * @example https://not-github.com/
67
+ * @example https://my-little-hub.com/
68
+ * @example https://my-little-hub.com/gist
69
+ * @example https://my-little-hub.com/gist/in-fragrante
70
+ * @example https://gist.my-little-hub.com/in-fragrante
71
+ */
12
72
  export declare const isEnterprise: (url?: URL | HTMLAnchorElement | Location) => boolean;
73
+ /**
74
+ * @example https://gist.github.com
75
+ * @example http://gist.github.com
76
+ * @example https://gist.github.com/new
77
+ * @example https://gist.github.com/fregante/2205329b71218fa2c1d3
78
+ * @example https://gist.github.com/fregante/2205329b71218fa2c1d3/d1ebf7d9cfaba4d4596d2ea9174e202479a5f9ad
79
+ * @example https://gist.github.com/sindresorhus/0ea3c2845718a0a0f0beb579ff14f064
80
+ * @example https://my-little-hub.com/gist
81
+ * @example https://gist.github.com/kidonng/0d16c7f17045f486751fad1b602204a0/revisions
82
+ * @example https://gist.github.com/fregante
83
+ * @example https://gist.github.com/github
84
+ * @example https://gist.github.com/babel
85
+ * @example https://my-little-hub.com/gist/in-fragrante
86
+ * @example https://gist.my-little-hub.com/in-fragrante
87
+ */
13
88
  export declare const isGist: (url?: URL | HTMLAnchorElement | Location) => boolean;
89
+ /**
90
+ * @example https://github.com/issues
91
+ * @example https://github.com/issues?q=is%3Apr+is%3Aopen
92
+ * @example https://github.com/issues/assigned
93
+ * @example https://github.com/issues/mentioned
94
+ * @example https://github.com/pulls
95
+ * @example https://github.com/pulls?q=issues
96
+ * @example https://github.com/pulls/assigned
97
+ * @example https://github.com/pulls/mentioned
98
+ * @example https://github.com/pulls/review-requested
99
+ */
14
100
  export declare const isGlobalIssueOrPRList: (url?: URL | HTMLAnchorElement | Location) => boolean;
101
+ /** @example https://github.com/search?q=refined-github&ref=opensearch */
15
102
  export declare const isGlobalSearchResults: (url?: URL | HTMLAnchorElement | Location) => boolean;
103
+ /** @example https://github.com/sindresorhus/refined-github/issues/146 */
16
104
  export declare const isIssue: (url?: URL | HTMLAnchorElement | Location) => boolean;
17
105
  export declare const isIssueOrPRList: (url?: URL | HTMLAnchorElement | Location) => boolean;
18
106
  export declare const isConversation: (url?: URL | HTMLAnchorElement | Location) => boolean;
107
+ /**
108
+ * @example https://github.com/sindresorhus/refined-github/labels
109
+ * @example https://github.com/sindresorhus/refined-github/labels/
110
+ */
19
111
  export declare const isLabelList: (url?: URL | HTMLAnchorElement | Location) => boolean;
112
+ /** @example https://github.com/kubernetes/kubernetes/milestone/56 */
20
113
  export declare const isMilestone: (url?: URL | HTMLAnchorElement | Location) => boolean;
114
+ /** @example https://github.com/sindresorhus/refined-github/milestones */
21
115
  export declare const isMilestoneList: (url?: URL | HTMLAnchorElement | Location) => boolean;
116
+ /** @example https://github.com/sindresorhus/refined-github/new/main */
22
117
  export declare const isNewFile: (url?: URL | HTMLAnchorElement | Location) => boolean;
118
+ /** @example https://github.com/sindresorhus/refined-github/issues/new */
23
119
  export declare const isNewIssue: (url?: URL | HTMLAnchorElement | Location) => boolean;
120
+ /** @example https://github.com/sindresorhus/refined-github/releases/new */
24
121
  export declare const isNewRelease: (url?: URL | HTMLAnchorElement | Location) => boolean;
122
+ /** @example https://github.com/tooomm/wikitest/wiki/_new */
25
123
  export declare const isNewWikiPage: (url?: URL | HTMLAnchorElement | Location) => boolean;
124
+ /** @example https://github.com/notifications */
26
125
  export declare const isNotifications: (url?: URL | HTMLAnchorElement | Location) => boolean;
27
126
  export declare const isOrganizationProfile: () => boolean;
28
127
  export declare const isOrganizationRepo: () => boolean;
128
+ /**
129
+ * @example https://github.com/orgs/refined-github/teams/core-team/discussions?pinned=1
130
+ * @example https://github.com/orgs/refined-github/teams/core-team/discussions/1
131
+ * @example https://github.com/orgs/refined-github/teams/core-team
132
+ */
29
133
  export declare const isTeamDiscussion: (url?: URL | HTMLAnchorElement | Location) => boolean;
30
134
  export declare const isOwnUserProfile: () => boolean;
31
135
  export declare const isOwnOrganizationProfile: () => boolean;
136
+ /**
137
+ * @example https://github.com/sindresorhus/refined-github/projects/3
138
+ * @example https://github.com/orgs/RSSNext/projects/3
139
+ */
32
140
  export declare const isProject: (url?: URL | HTMLAnchorElement | Location) => boolean;
141
+ /** @example https://github.com/sindresorhus/refined-github/projects */
33
142
  export declare const isProjects: (url?: URL | HTMLAnchorElement | Location) => boolean;
143
+ /**
144
+ * @example https://github.com/tophf/mpiv/discussions/50
145
+ * @example https://github.com/orgs/community/discussions/11202
146
+ */
34
147
  export declare const isDiscussion: (url?: URL | HTMLAnchorElement | Location) => boolean;
148
+ /**
149
+ * @example https://github.com/withastro/roadmap/discussions/new?category=proposal
150
+ * @example https://github.com/orgs/community/discussions/new?category=pull-requests
151
+ */
35
152
  export declare const isNewDiscussion: (url?: URL | HTMLAnchorElement | Location) => boolean;
153
+ /**
154
+ * @example https://github.com/tophf/mpiv/discussions
155
+ * @example https://github.com/orgs/community/discussions
156
+ */
36
157
  export declare const isDiscussionList: (url?: URL | HTMLAnchorElement | Location) => boolean;
158
+ /**
159
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
160
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d79
161
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
162
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d79
163
+ * @example https://github.com/sindresorhus/refined-github/pull/148/files
164
+ * @example https://github.com/sindresorhus/refined-github/pull/148/files/e1aba6f
165
+ * @example https://github.com/sindresorhus/refined-github/pull/148/files/1e27d799..e1aba6f
166
+ * @example https://github.com/refined-github/refined-github/pull/148/changes
167
+ * @example https://github.com/refined-github/refined-github/pull/148/changes/1e27d799..e1aba6f
168
+ * @example https://github.com/refined-github/refined-github/pull/148/changes/1e27d7998afdd3608d9fc3bf95ccf27fa5010641..e1aba6febb3fe38aafd1137cff28b536eeeabe7e
169
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits
170
+ * @example https://github.com/sindresorhus/refined-github/pull/148
171
+ */
37
172
  export declare const isPR: (url?: URL | HTMLAnchorElement | Location) => boolean;
173
+ /** @example https://github.com/sindresorhus/refined-github/pull/148/conflicts */
38
174
  export declare const isPRConflicts: (url?: URL | HTMLAnchorElement | Location) => boolean;
39
- /** Any `isIssueOrPRList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown */
175
+ /**
176
+ * Any `isIssueOrPRList` can display both issues and PRs, prefer that detection. `isPRList` only exists because this page has PR-specific filters like the "Reviews" dropdown
177
+ * @example https://github.com/pulls
178
+ * @example https://github.com/pulls?q=issues
179
+ * @example https://github.com/sindresorhus/refined-github/pulls
180
+ * @example https://github.com/sindresorhus/refined-github/pulls/
181
+ * @example https://github.com/sindresorhus/refined-github/pulls?q=is%3Aopen+is%3Apr
182
+ * @example https://github.com/sindresorhus/refined-github/pulls?q=is%3Apr+is%3Aclosed
183
+ */
40
184
  export declare const isPRList: (url?: URL | HTMLAnchorElement | Location) => boolean;
185
+ /**
186
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
187
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d79
188
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
189
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d79
190
+ */
41
191
  export declare const isPRCommit: (url?: URL | HTMLAnchorElement | Location) => boolean;
42
192
  export declare const isPRCommit404: () => boolean;
43
193
  export declare const isPRFile404: () => boolean;
194
+ /** @example https://github.com/sindresorhus/refined-github/pull/148 */
44
195
  export declare const isPRConversation: (url?: URL | HTMLAnchorElement | Location) => boolean;
196
+ /** @example https://github.com/sindresorhus/refined-github/pull/148/commits */
45
197
  export declare const isPRCommitList: (url?: URL | HTMLAnchorElement | Location) => boolean;
198
+ /**
199
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
200
+ * @example https://github.com/sindresorhus/refined-github/pull/148/commits/1e27d79
201
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d7998afdd3608d9fc3bf95ccf27fa5010641
202
+ * @example https://github.com/sindresorhus/refined-github/pull/148/changes/1e27d79
203
+ * @example https://github.com/sindresorhus/refined-github/pull/148/files
204
+ * @example https://github.com/sindresorhus/refined-github/pull/148/files/e1aba6f
205
+ * @example https://github.com/sindresorhus/refined-github/pull/148/files/1e27d799..e1aba6f
206
+ * @example https://github.com/refined-github/refined-github/pull/148/changes
207
+ * @example https://github.com/refined-github/refined-github/pull/148/changes/1e27d799..e1aba6f
208
+ * @example https://github.com/refined-github/refined-github/pull/148/changes/1e27d7998afdd3608d9fc3bf95ccf27fa5010641..e1aba6febb3fe38aafd1137cff28b536eeeabe7e
209
+ */
46
210
  export declare const isPRFiles: (url?: URL | HTMLAnchorElement | Location) => boolean;
211
+ /**
212
+ * @example https://github.com/sindresorhus/refined-github/compare/master...branch-name?quick_pull=1
213
+ * @example https://github.com/sindresorhus/refined-github/compare/branch-1...branch-2?quick_pull=1
214
+ * @example https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1
215
+ */
47
216
  export declare const isQuickPR: (url?: URL | HTMLAnchorElement | Location) => boolean;
48
217
  export declare const isMergedPR: () => boolean;
49
218
  export declare const isDraftPR: () => boolean;
50
219
  export declare const isOpenConversation: () => boolean;
51
220
  export declare const isClosedConversation: () => boolean;
221
+ /**
222
+ * @example https://github.com/sindresorhus/refined-github/releases
223
+ * @example https://github.com/sindresorhus/refined-github/releases?page=2
224
+ */
52
225
  export declare const isReleases: (url?: URL | HTMLAnchorElement | Location) => boolean;
226
+ /**
227
+ * @example https://github.com/sindresorhus/refined-github/tags
228
+ * @example https://github.com/sindresorhus/refined-github/tags?after=21.8.1
229
+ */
53
230
  export declare const isTags: (url?: URL | HTMLAnchorElement | Location) => boolean;
231
+ /**
232
+ * @example https://github.com/refined-github/refined-github/releases/tag/1.20.1
233
+ * @example https://github.com/refined-github/refined-github/releases/tag/23.7.25
234
+ */
54
235
  export declare const isSingleReleaseOrTag: (url?: URL | HTMLAnchorElement | Location) => boolean;
236
+ /**
237
+ * @example https://github.com/sindresorhus/refined-github/releases
238
+ * @example https://github.com/sindresorhus/refined-github/releases?page=2
239
+ * @example https://github.com/sindresorhus/refined-github/tags
240
+ * @example https://github.com/sindresorhus/refined-github/tags?after=21.8.1
241
+ */
55
242
  export declare const isReleasesOrTags: (url?: URL | HTMLAnchorElement | Location) => boolean;
243
+ /**
244
+ * @example https://github.com/sindresorhus/refined-github/delete/master/readme.md
245
+ * @example https://github.com/sindresorhus/refined-github/delete/ghe-injection/source/background.ts
246
+ */
56
247
  export declare const isDeletingFile: (url?: URL | HTMLAnchorElement | Location) => boolean;
248
+ /**
249
+ * @example https://github.com/sindresorhus/refined-github/edit/master/readme.md
250
+ * @example https://github.com/sindresorhus/refined-github/edit/ghe-injection/source/background.ts
251
+ */
57
252
  export declare const isEditingFile: (url?: URL | HTMLAnchorElement | Location) => boolean;
58
253
  export declare const hasFileEditor: (url?: URL | HTMLAnchorElement | Location) => boolean;
254
+ /** @example https://github.com/sindresorhus/refined-github/releases/edit/v1.2.3 */
59
255
  export declare const isEditingRelease: (url?: URL | HTMLAnchorElement | Location) => boolean;
60
256
  export declare const hasReleaseEditor: (url?: URL | HTMLAnchorElement | Location) => boolean;
257
+ /** @example https://github.com/tooomm/wikitest/wiki/Getting-Started/_edit */
61
258
  export declare const isEditingWikiPage: (url?: URL | HTMLAnchorElement | Location) => boolean;
62
259
  export declare const hasWikiPageEditor: (url?: URL | HTMLAnchorElement | Location) => boolean;
260
+ /**
261
+ * @example https://github.com/sindresorhus/refined-github/blame/master/package.json
262
+ * @example https://github.com/sindresorhus/refined-github/issues/146
263
+ * @example https://github.com/sindresorhus/notifications/
264
+ * @example https://github.com/sindresorhus/refined-github/pull/148
265
+ * @example https://github.com/sindresorhus/refined-github/milestones/new
266
+ * @example https://github.com/sindresorhus/refined-github/milestones/1/edit
267
+ * @example https://github.com/sindresorhus/refined-github/issues/new/choose
268
+ * @example https://github.com/sindresorhus/refined-github/issues/templates/edit
269
+ */
63
270
  export declare const isRepo: (url?: URL | HTMLAnchorElement | Location) => boolean;
64
271
  export declare const hasRepoHeader: (url?: URL | HTMLAnchorElement | Location) => boolean;
65
272
  export declare const isEmptyRepoRoot: () => boolean;
@@ -67,68 +274,280 @@ export declare const isEmptyRepo: () => boolean;
67
274
  export declare const isPublicRepo: () => boolean;
68
275
  export declare const isArchivedRepo: () => boolean;
69
276
  export declare const isBlank: () => boolean;
277
+ /**
278
+ * @example https://github.com/sindresorhus/refined-github/labels/bug
279
+ * @example https://github.com/sindresorhus/refined-github/labels/implemented%20by%20github
280
+ * @example https://github.com/sindresorhus/refined-github/labels/%3Adollar%3A%20Funded%20on%20Issuehunt
281
+ * @example https://github.com/sindresorhus/refined-github/milestones/1
282
+ */
70
283
  export declare const isRepoTaxonomyIssueOrPRList: (url?: URL | HTMLAnchorElement | Location) => boolean;
71
284
  export declare const isRepoIssueOrPRList: (url?: URL | HTMLAnchorElement | Location) => boolean;
285
+ /**
286
+ * @example https://github.com/sindresorhus/refined-github/pulls
287
+ * @example https://github.com/sindresorhus/refined-github/pulls/
288
+ * @example https://github.com/sindresorhus/refined-github/pulls?q=is%3Aopen+is%3Apr
289
+ * @example https://github.com/sindresorhus/refined-github/pulls?q=is%3Apr+is%3Aclosed
290
+ */
72
291
  export declare const isRepoPRList: (url?: URL | HTMLAnchorElement | Location) => boolean;
292
+ /**
293
+ * @example http://github.com/sindresorhus/ava/issues
294
+ * @example https://github.com/sindresorhus/refined-github/issues
295
+ * @example https://github.com/sindresorhus/refined-github/issues/fregante
296
+ * @example https://github.com/sindresorhus/refined-github/issues/newton
297
+ * @example https://github.com/sindresorhus/refined-github/issues/wptemplates
298
+ * @example https://github.com/sindresorhus/refined-github/issues?q=is%3Aclosed+sort%3Aupdated-desc
299
+ * @example https://github.com/sindresorhus/refined-github/labels/bug
300
+ * @example https://github.com/sindresorhus/refined-github/labels/implemented%20by%20github
301
+ * @example https://github.com/sindresorhus/refined-github/labels/%3Adollar%3A%20Funded%20on%20Issuehunt
302
+ */
73
303
  export declare const isRepoIssueList: (url?: URL | HTMLAnchorElement | Location) => boolean;
304
+ /**
305
+ * @example https://github.com/sindresorhus/refined-github
306
+ * @example https://github.com/sindresorhus/refined-github/
307
+ * @example https://github.com/sindresorhus/notifications/
308
+ * @example https://github.com/sindresorhus/edit
309
+ * @example https://github.com/sindresorhus///edit
310
+ * @example https://github.com/sindresorhus/search
311
+ * @example https://github.com/sindresorhus/branches
312
+ * @example https://github.com/sindresorhus/refined-github?files=1
313
+ */
74
314
  export declare const isRepoHome: (url?: URL | HTMLAnchorElement | Location) => boolean;
75
315
  export type RepoExplorerInfo = {
76
316
  nameWithOwner: string;
77
317
  branch: string;
78
318
  filePath: string;
79
319
  };
320
+ /**
321
+ * @example https://github.com/sindresorhus/refined-github
322
+ * @example https://github.com/sindresorhus/refined-github/
323
+ * @example https://github.com/sindresorhus/notifications/
324
+ * @example https://github.com/sindresorhus/edit
325
+ * @example https://github.com/sindresorhus///edit
326
+ * @example https://github.com/sindresorhus/search
327
+ * @example https://github.com/sindresorhus/branches
328
+ * @example https://github.com/sindresorhus/refined-github?files=1
329
+ * @example https://github.com/sindresorhus/refined-github/tree/native-copy-buttons
330
+ * @example https://github.com/sindresorhus/refined-github/tree/native-copy-buttons/
331
+ * @example https://github.com/sindresorhus/refined-github/tree/03fa6b8b4d6e68dea9dc9bee1d197ef5d992fbd6
332
+ * @example https://github.com/sindresorhus/refined-github/tree/03fa6b8b4d6e68dea9dc9bee1d197ef5d992fbd6/
333
+ * @example https://github.com/sindresorhus/refined-github/tree/57bf4
334
+ * @example https://github.com/sindresorhus/refined-github/tree/master?files=1
335
+ */
80
336
  export declare const isRepoRoot: (url?: URL | HTMLAnchorElement | Location) => boolean;
337
+ /**
338
+ * @example https://github.com/sindresorhus/refined-github/search?q=diff
339
+ * @example https://github.com/sindresorhus/refined-github/search?q=diff&unscoped_q=diff&type=Issues
340
+ * @example https://github.com/sindresorhus/refined-github/search
341
+ */
81
342
  export declare const isRepoSearch: (url?: URL | HTMLAnchorElement | Location) => boolean;
343
+ /**
344
+ * @example https://github.com/sindresorhus/refined-github/settings
345
+ * @example https://github.com/sindresorhus/refined-github/settings/branches
346
+ */
82
347
  export declare const isRepoSettings: (url?: URL | HTMLAnchorElement | Location) => boolean;
348
+ /** @example https://github.com/sindresorhus/refined-github/settings */
83
349
  export declare const isRepoMainSettings: (url?: URL | HTMLAnchorElement | Location) => boolean;
350
+ /**
351
+ * @example https://github.com/settings/replies
352
+ * @example https://github.com/settings/replies/88491/edit
353
+ */
84
354
  export declare const isRepliesSettings: (url?: URL | HTMLAnchorElement | Location) => boolean;
355
+ /**
356
+ * @example https://github.com/settings/profile
357
+ * @example https://github.com/settings/replies
358
+ * @example https://github.com/settings/replies/88491/edit
359
+ */
85
360
  export declare const isUserSettings: (url?: URL | HTMLAnchorElement | Location) => boolean;
361
+ /**
362
+ * @example https://github.com/sindresorhus/refined-github
363
+ * @example https://github.com/sindresorhus/refined-github/
364
+ * @example https://github.com/sindresorhus/notifications/
365
+ * @example https://github.com/sindresorhus/edit
366
+ * @example https://github.com/sindresorhus///edit
367
+ * @example https://github.com/sindresorhus/search
368
+ * @example https://github.com/sindresorhus/branches
369
+ * @example https://github.com/sindresorhus/refined-github?files=1
370
+ * @example https://github.com/sindresorhus/refined-github/tree/native-copy-buttons
371
+ * @example https://github.com/sindresorhus/refined-github/tree/native-copy-buttons/
372
+ * @example https://github.com/sindresorhus/refined-github/tree/03fa6b8b4d6e68dea9dc9bee1d197ef5d992fbd6
373
+ * @example https://github.com/sindresorhus/refined-github/tree/03fa6b8b4d6e68dea9dc9bee1d197ef5d992fbd6/
374
+ * @example https://github.com/sindresorhus/refined-github/tree/57bf4
375
+ * @example https://github.com/sindresorhus/refined-github/tree/master?files=1
376
+ * @example https://github.com/sindresorhus/refined-github/tree/main/source
377
+ * @example https://github.com/sindresorhus/refined-github/tree/0.13.0/extension
378
+ * @example https://github.com/sindresorhus/refined-github/tree/57bf435ee12d14b482df0bbd88013a2814c7512e/extension
379
+ * @example https://github.com/sindresorhus/refined-github?search=1
380
+ */
86
381
  export declare const isRepoTree: (url?: URL | HTMLAnchorElement | Location) => boolean;
382
+ /**
383
+ * @example https://github.com/lukesampson/scoop/wiki
384
+ * @example https://github.com/tooomm/wikitest/wiki/_new
385
+ * @example https://github.com/tooomm/wikitest/wiki/Getting-Started/_edit
386
+ * @example https://github.com/brookhong/Surfingkeys/wiki/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d
387
+ * @example https://github.com/brookhong/Surfingkeys/wiki/Color-Themes/_compare/8ebb46b1a12d16fc1af442b7df0ca13ca3bb34dc...80e51eeabe69b15a3f23880ecc36f800b71e6c6d
388
+ */
87
389
  export declare const isRepoWiki: (url?: URL | HTMLAnchorElement | Location) => boolean;
390
+ /**
391
+ * @example https://github.com/sindresorhus/refined-github/commit/5b614b9035f2035b839f48b4db7bd5c3298d526f
392
+ * @example https://github.com/sindresorhus/refined-github/commit/5b614
393
+ */
88
394
  export declare const isSingleCommit: (url?: URL | HTMLAnchorElement | Location) => boolean;
395
+ /**
396
+ * @example https://github.com/sindresorhus/refined-github/blob/master/.gitattributes
397
+ * @example https://github.com/sindresorhus/refined-github/blob/fix-narrow-diff/distribution/content.css
398
+ * @example https://github.com/sindresorhus/refined-github/blob/master/edit.txt
399
+ */
89
400
  export declare const isSingleFile: (url?: URL | HTMLAnchorElement | Location) => boolean;
401
+ /** @example https://github.com/sindresorhus/refined-github/find/master */
90
402
  export declare const isFileFinder: (url?: URL | HTMLAnchorElement | Location) => boolean;
91
403
  /**
92
404
  * @example https://github.com/fregante/GhostText/tree/3cacd7df71b097dc525d99c7aa2f54d31b02fcc8/chrome/scripts/InputArea
93
405
  * @example https://github.com/refined-github/refined-github/blob/some-non-existent-ref/source/features/bugs-tab.tsx
94
406
  */
95
407
  export declare const isRepoFile404: (url?: URL | HTMLAnchorElement | Location) => boolean;
408
+ /** @example https://github.com/sindresorhus/refined-github/network/members */
96
409
  export declare const isRepoForksList: (url?: URL | HTMLAnchorElement | Location) => boolean;
410
+ /** @example https://github.com/sindresorhus/refined-github/network */
97
411
  export declare const isRepoNetworkGraph: (url?: URL | HTMLAnchorElement | Location) => boolean;
98
412
  export declare const isForkedRepo: () => boolean;
413
+ /** @example https://github.com/refined-github/refined-github/fork */
99
414
  export declare const isForkingRepo: (url?: URL | HTMLAnchorElement | Location) => boolean;
415
+ /**
416
+ * @example https://gist.github.com/fregante/2205329b71218fa2c1d3
417
+ * @example https://gist.github.com/fregante/2205329b71218fa2c1d3/d1ebf7d9cfaba4d4596d2ea9174e202479a5f9ad
418
+ * @example https://gist.github.com/sindresorhus/0ea3c2845718a0a0f0beb579ff14f064
419
+ */
100
420
  export declare const isSingleGist: (url?: URL | HTMLAnchorElement | Location) => boolean;
421
+ /** @example https://gist.github.com/kidonng/0d16c7f17045f486751fad1b602204a0/revisions */
101
422
  export declare const isGistRevision: (url?: URL | HTMLAnchorElement | Location) => boolean;
423
+ /**
424
+ * @example https://github.com/trending
425
+ * @example https://github.com/trending/developers
426
+ * @example https://github.com/trending/unknown
427
+ */
102
428
  export declare const isTrending: (url?: URL | HTMLAnchorElement | Location) => boolean;
429
+ /** @example https://github.com/sindresorhus/refined-github/branches */
103
430
  export declare const isBranches: (url?: URL | HTMLAnchorElement | Location) => boolean;
431
+ /**
432
+ * @example https://github.com/fregante
433
+ * @example https://github.com/github
434
+ * @example https://github.com/babel
435
+ * @example https://github.com/fregante?tab=repositories
436
+ * @example https://github.com/fregante?tab=repositories&type=source
437
+ * @example https://github.com/fregante?tab=repositories&q=&type=source&language=css&sort=
438
+ * @example https://github.com/fregante?tab=stars
439
+ * @example https://github.com/fregante?direction=desc&sort=updated&tab=stars
440
+ * @example https://github.com/fregante?tab=followers
441
+ * @example https://github.com/sindresorhus?tab=followers
442
+ * @example https://github.com/fregante?tab=following
443
+ * @example https://github.com/sindresorhus?tab=following
444
+ */
104
445
  export declare const isProfile: (url?: URL | HTMLAnchorElement | Location) => boolean;
446
+ /**
447
+ * @example https://gist.github.com/fregante
448
+ * @example https://gist.github.com/github
449
+ * @example https://gist.github.com/babel
450
+ * @example https://my-little-hub.com/gist/in-fragrante
451
+ * @example https://gist.my-little-hub.com/in-fragrante
452
+ */
105
453
  export declare const isGistProfile: (url?: URL | HTMLAnchorElement | Location) => boolean;
106
454
  export declare const isUserProfile: () => boolean;
107
455
  export declare const isPrivateUserProfile: () => boolean;
108
456
  export declare const isUserProfileMainTab: () => boolean;
457
+ /**
458
+ * @example https://github.com/fregante?tab=repositories
459
+ * @example https://github.com/fregante?tab=repositories&type=source
460
+ * @example https://github.com/fregante?tab=repositories&q=&type=source&language=css&sort=
461
+ */
109
462
  export declare const isUserProfileRepoTab: (url?: URL | HTMLAnchorElement | Location) => boolean;
463
+ /**
464
+ * @example https://github.com/fregante?tab=stars
465
+ * @example https://github.com/fregante?direction=desc&sort=updated&tab=stars
466
+ */
110
467
  export declare const isUserProfileStarsTab: (url?: URL | HTMLAnchorElement | Location) => boolean;
468
+ /**
469
+ * @example https://github.com/fregante?tab=followers
470
+ * @example https://github.com/sindresorhus?tab=followers
471
+ */
111
472
  export declare const isUserProfileFollowersTab: (url?: URL | HTMLAnchorElement | Location) => boolean;
473
+ /**
474
+ * @example https://github.com/fregante?tab=following
475
+ * @example https://github.com/sindresorhus?tab=following
476
+ */
112
477
  export declare const isUserProfileFollowingTab: (url?: URL | HTMLAnchorElement | Location) => boolean;
478
+ /**
479
+ * @example https://github.com/fregante?tab=repositories
480
+ * @example https://github.com/fregante?tab=repositories&type=source
481
+ * @example https://github.com/fregante?tab=repositories&q=&type=source&language=css&sort=
482
+ * @example https://github.com/orgs/refined-github/repositories
483
+ * @example https://github.com/orgs/refined-github/repositories?q=&type=private&language=&sort=
484
+ */
113
485
  export declare const isProfileRepoList: (url?: URL | HTMLAnchorElement | Location) => boolean;
114
486
  export declare const hasComments: (url?: URL | HTMLAnchorElement | Location) => boolean;
115
487
  export declare const hasRichTextEditor: (url?: URL | HTMLAnchorElement | Location) => boolean;
116
488
  /** Static code, not the code editor */
117
489
  export declare const hasCode: (url?: URL | HTMLAnchorElement | Location) => boolean;
118
- /** Covers blob, trees and blame pages */
490
+ /**
491
+ * Covers blob, trees and blame pages
492
+ * @example https://github.com/sindresorhus/refined-github
493
+ * @example https://github.com/sindresorhus/refined-github/
494
+ * @example https://github.com/sindresorhus/notifications/
495
+ * @example https://github.com/sindresorhus/edit
496
+ * @example https://github.com/sindresorhus///edit
497
+ * @example https://github.com/sindresorhus/search
498
+ * @example https://github.com/sindresorhus/branches
499
+ * @example https://github.com/sindresorhus/refined-github?files=1
500
+ * @example https://github.com/sindresorhus/refined-github/tree/native-copy-buttons
501
+ * @example https://github.com/sindresorhus/refined-github/tree/native-copy-buttons/
502
+ * @example https://github.com/sindresorhus/refined-github/tree/03fa6b8b4d6e68dea9dc9bee1d197ef5d992fbd6
503
+ * @example https://github.com/sindresorhus/refined-github/tree/03fa6b8b4d6e68dea9dc9bee1d197ef5d992fbd6/
504
+ * @example https://github.com/sindresorhus/refined-github/tree/57bf4
505
+ * @example https://github.com/sindresorhus/refined-github/tree/master?files=1
506
+ * @example https://github.com/sindresorhus/refined-github/tree/main/source
507
+ * @example https://github.com/sindresorhus/refined-github/tree/0.13.0/extension
508
+ * @example https://github.com/sindresorhus/refined-github/tree/57bf435ee12d14b482df0bbd88013a2814c7512e/extension
509
+ * @example https://github.com/sindresorhus/refined-github?search=1
510
+ * @example https://github.com/sindresorhus/refined-github/blob/master/.gitattributes
511
+ * @example https://github.com/sindresorhus/refined-github/blob/fix-narrow-diff/distribution/content.css
512
+ * @example https://github.com/sindresorhus/refined-github/blob/master/edit.txt
513
+ * @example https://github.com/sindresorhus/refined-github/blame/master/package.json
514
+ */
119
515
  export declare const isRepoGitObject: (url?: URL | HTMLAnchorElement | Location) => boolean;
120
516
  /** Has a list of files */
121
517
  export declare const hasFiles: (url?: URL | HTMLAnchorElement | Location) => boolean;
518
+ /**
519
+ * @example https://github.com/marketplace/actions/urlchecker-action
520
+ * @example https://github.com/marketplace/actions/github-action-for-assignee-to-reviewer
521
+ * @example https://github.com/marketplace/actions/hugo-actions
522
+ */
122
523
  export declare const isMarketplaceAction: (url?: URL | HTMLAnchorElement | Location) => boolean;
524
+ /**
525
+ * @example https://github.com/sindresorhus/refined-github/runs/639481849
526
+ * @example https://github.com/refined-github/github-url-detection/runs/1224552520?check_suite_focus=true
527
+ */
123
528
  export declare const isActionJobRun: (url?: URL | HTMLAnchorElement | Location) => boolean;
529
+ /**
530
+ * @example https://github.com/sindresorhus/refined-github/runs/639481849
531
+ * @example https://github.com/refined-github/github-url-detection/runs/1224552520?check_suite_focus=true
532
+ * @example https://github.com/refined-github/github-url-detection/actions/runs/294962314
533
+ */
124
534
  export declare const isActionRun: (url?: URL | HTMLAnchorElement | Location) => boolean;
535
+ /** @example https://github.com/sindresorhus/refined-github/actions/new */
125
536
  export declare const isNewAction: (url?: URL | HTMLAnchorElement | Location) => boolean;
537
+ /**
538
+ * @example https://github.com/refined-github/github-url-detection/actions
539
+ * @example https://github.com/refined-github/github-url-detection/actions/workflows/demo.yml
540
+ * @example https://github.com/refined-github/github-url-detection/actions/workflows/esm-lint.yml
541
+ */
126
542
  export declare const isRepositoryActions: (url?: URL | HTMLAnchorElement | Location) => boolean;
127
543
  export declare const isUserTheOrganizationOwner: () => boolean;
128
544
  export declare const canUserAdminRepo: () => boolean;
129
- /** @deprecated Use `canUserAdminRepo` */
130
- export declare const canUserEditRepo: () => boolean;
545
+ /**
546
+ * @example https://github.com/new
547
+ * @example https://github.com/organizations/npmhub/repositories/new
548
+ */
131
549
  export declare const isNewRepo: (url?: URL | HTMLAnchorElement | Location) => boolean;
550
+ /** @example https://github.com/fregante/browser-extension-template/generate */
132
551
  export declare const isNewRepoTemplate: (url?: URL | HTMLAnchorElement | Location) => boolean;
133
552
  export type NameWithOwner = `${string}/${string}`;
134
553
  export type RepositoryInfo = {
@@ -143,14 +562,17 @@ export type RepositoryInfo = {
143
562
  @example '/user/repo/' -> ''
144
563
  @example '/settings/token/' -> undefined */
145
564
  path: string;
565
+ /** The `path` segments
566
+ @example '/user/repo/' -> []
567
+ @example '/user/repo/issues/' -> ['issues']
568
+ @example '/user/repo/issues/new' -> ['issues', 'new'] */
569
+ pathParts: string[];
146
570
  };
147
571
  export declare const utils: {
148
572
  getOrg: (url?: URL | HTMLAnchorElement | Location) => {
149
573
  name: string;
150
574
  path: string;
151
575
  } | undefined;
152
- /** @deprecated Use `getLoggedInUser` */
153
- getUsername: () => string | undefined;
154
576
  getLoggedInUser: () => string | undefined;
155
577
  getCleanPathname: (url?: URL | HTMLAnchorElement | Location) => string;
156
578
  getCleanGistPathname: (url?: URL | HTMLAnchorElement | Location) => string | undefined;
@@ -51,8 +51,9 @@ var isQuickPR = (url = location) => isCompare(url) && /[?&]quick_pull=1(&|$)/.te
51
51
  var getStateLabel = () => $([
52
52
  ".State",
53
53
  // Old view
54
- '[class^="StateLabel"]'
55
- // React version
54
+ // React versions
55
+ '[class^="StateLabel"]',
56
+ '[data-testid="header-state"]'
56
57
  ].join(","))?.textContent?.trim();
57
58
  var isMergedPR = () => getStateLabel() === "Merged";
58
59
  var isDraftPR = () => getStateLabel() === "Draft";
@@ -77,10 +78,7 @@ var isEditingWikiPage = (url = location) => isRepoWiki(url) && getCleanPathname(
77
78
  var hasWikiPageEditor = (url = location) => isEditingWikiPage(url) || isNewWikiPage(url);
78
79
  var isRepo = (url = location) => {
79
80
  const [user, repo, extra] = getCleanPathname(url).split("/");
80
- return Boolean(
81
- user && repo && !reservedNames.includes(user) && !url.hostname.startsWith("gist.") && extra !== "generate"
82
- // Like isNewRepoTemplate but inlined for performance
83
- );
81
+ return Boolean(user && repo && !reservedNames.includes(user) && !url.hostname.startsWith("gist.") && extra !== "generate");
84
82
  };
85
83
  var hasRepoHeader = (url = location) => isRepo(url) && !isRepoSearch(url);
86
84
  var isEmptyRepoRoot = () => isRepoHome() && !exists('link[rel="canonical"]');
@@ -177,7 +175,6 @@ var isNewAction = (url = location) => getRepo(url)?.path === "actions/new";
177
175
  var isRepositoryActions = (url = location) => /^actions(\/workflows\/.+\.ya?ml)?$/.test(getRepo(url)?.path);
178
176
  var isUserTheOrganizationOwner = () => isOrganizationProfile() && exists('[aria-label="Organization"] [data-tab-item="org-header-settings-tab"]');
179
177
  var canUserAdminRepo = () => isRepo() && exists('.reponav-item[href$="/settings"], [data-tab-item$="settings-tab"]');
180
- var canUserEditRepo = canUserAdminRepo;
181
178
  var isNewRepo = (url = location) => !isGist(url) && (url.pathname === "/new" || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url)));
182
179
  var isNewRepoTemplate = (url = location) => Boolean(url.pathname.split("/")[3] === "generate");
183
180
  var getLoggedInUser = () => $('meta[name="user-login"]')?.getAttribute("content") ?? void 0;
@@ -213,18 +210,17 @@ var getRepo = (url) => {
213
210
  if (!isRepo(url)) {
214
211
  return;
215
212
  }
216
- const [owner, name, ...path] = getCleanPathname(url).split("/");
213
+ const [owner, name, ...pathParts] = getCleanPathname(url).split("/");
217
214
  return {
218
215
  owner,
219
216
  name,
217
+ pathParts,
220
218
  nameWithOwner: `${owner}/${name}`,
221
- path: path.join("/")
219
+ path: pathParts.join("/")
222
220
  };
223
221
  };
224
222
  var utils = {
225
223
  getOrg,
226
- /** @deprecated Use `getLoggedInUser` */
227
- getUsername: getLoggedInUser,
228
224
  getLoggedInUser,
229
225
  getCleanPathname,
230
226
  getCleanGistPathname,
@@ -233,7 +229,6 @@ var utils = {
233
229
  };
234
230
  export {
235
231
  canUserAdminRepo,
236
- canUserEditRepo,
237
232
  hasCode,
238
233
  hasComments,
239
234
  hasFileEditor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-url-detection",
3
- "version": "10.2.3",
3
+ "version": "11.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",
@@ -26,7 +26,8 @@
26
26
  "scripts": {
27
27
  "build": "run-p build:*",
28
28
  "build:esbuild": "esbuild index.ts --bundle --external:github-reserved-names --outdir=distribution --format=esm --drop-labels=TEST",
29
- "build:typescript": "tsc --declaration --emitDeclarationOnly",
29
+ "build:typescript": "tsc",
30
+ "postbuild:typescript": "tsx add-examples-to-dts.ts",
30
31
  "build:demo": "vite build demo",
31
32
  "try": "esbuild index.ts --bundle --global-name=x --format=iife | pbcopy && echo 'Copied to clipboard'",
32
33
  "fix": "xo --fix",
@@ -40,41 +41,27 @@
40
41
  "watch:demo": "vite preview demo & npm run build:demo -- --watch # vite serve isn't real",
41
42
  "xo": "xo"
42
43
  },
43
- "xo": {
44
- "envs": [
45
- "browser"
46
- ],
47
- "overrides": [
48
- {
49
- "files": [
50
- "*.ts"
51
- ],
52
- "rules": {
53
- "@typescript-eslint/triple-slash-reference": "off",
54
- "@typescript-eslint/naming-convention": "off",
55
- "no-unused-labels": "off",
56
- "no-labels": "off"
57
- }
58
- }
59
- ]
60
- },
61
44
  "dependencies": {
62
- "github-reserved-names": "^2.0.7"
45
+ "github-reserved-names": "^2.1.1"
63
46
  },
64
47
  "devDependencies": {
65
- "@sindresorhus/tsconfig": "^6.0.0",
66
- "@sveltejs/vite-plugin-svelte": "^3.1.1",
67
- "esbuild": "^0.23.1",
48
+ "@sindresorhus/tsconfig": "^8.1.0",
49
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
50
+ "@types/node": "^25.0.8",
51
+ "esbuild": "^0.27.2",
52
+ "globals": "^17.0.0",
68
53
  "npm-run-all": "^4.1.5",
69
- "strip-indent": "^4.0.0",
70
- "svelte": "^4.2.18",
71
- "svelte-check": "^3.8.5",
72
- "typescript": "^5.5.4",
73
- "vite": "^5.4.2",
74
- "vitest": "^2.0.5",
75
- "xo": "^0.59.3"
54
+ "strip-indent": "^4.1.1",
55
+ "svelte": "^5.46.1",
56
+ "svelte-check": "^4.3.5",
57
+ "ts-morph": "^27.0.2",
58
+ "tsx": "^4.21.0",
59
+ "typescript": "5.9.3",
60
+ "vite": "^7.3.1",
61
+ "vitest": "^4.0.17",
62
+ "xo": "^1.2.3"
76
63
  },
77
64
  "engines": {
78
- "node": ">=20.10"
65
+ "node": ">=22.18"
79
66
  }
80
67
  }