github-url-detection 5.8.0 → 5.9.0
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 +1 -0
- package/distribution/index.js +6 -4
- package/package.json +18 -24
package/distribution/index.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export declare const isUserProfileFollowingTab: (url?: URL | HTMLAnchorElement |
|
|
|
92
92
|
export declare const hasComments: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
93
93
|
export declare const hasRichTextEditor: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
94
94
|
export declare const hasCode: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
95
|
+
export declare const hasFiles: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
95
96
|
export declare const isMarketplaceAction: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
96
97
|
export declare const isActionJobRun: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
97
98
|
export declare const isActionRun: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
package/distribution/index.js
CHANGED
|
@@ -130,7 +130,7 @@ const isPRList = (url = location) => {
|
|
|
130
130
|
|
|
131
131
|
const isPRCommit = (url = location) => {
|
|
132
132
|
var _a;
|
|
133
|
-
return /^pull\/\d+\/commits\/[\da-f]{5,40}
|
|
133
|
+
return /^pull\/\d+\/commits\/[\da-f]{5,40}$/.test(null === (_a = getRepo(url)) || void 0 === _a ? void 0 : _a.path);
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
const isPRCommit404 = () => isPRCommit() && document.title.startsWith("Commit range not found · Pull Request");
|
|
@@ -263,7 +263,7 @@ const isRepoWiki = (url = location) => {
|
|
|
263
263
|
|
|
264
264
|
const isSingleCommit = (url = location) => {
|
|
265
265
|
var _a;
|
|
266
|
-
return /^commit\/[\da-f]{5,40}
|
|
266
|
+
return /^commit\/[\da-f]{5,40}$/.test(null === (_a = getRepo(url)) || void 0 === _a ? void 0 : _a.path);
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
const isSingleFile = (url = location) => {
|
|
@@ -299,7 +299,7 @@ const isBranches = (url = location) => {
|
|
|
299
299
|
|
|
300
300
|
const isProfile = (url = location) => {
|
|
301
301
|
const pathname = getCleanPathname(url);
|
|
302
|
-
return pathname.length > 0 && !pathname.includes("/") && !reservedNames.includes(pathname);
|
|
302
|
+
return pathname.length > 0 && !pathname.includes("/") && !pathname.includes(".") && !reservedNames.includes(pathname);
|
|
303
303
|
};
|
|
304
304
|
|
|
305
305
|
const isUserProfile = () => isProfile() && !isOrganizationProfile();
|
|
@@ -320,6 +320,8 @@ const hasRichTextEditor = (url = location) => hasComments(url) || isNewIssue(url
|
|
|
320
320
|
|
|
321
321
|
const hasCode = (url = location) => hasComments(url) || isRepoTree(url) || isSingleFile(url) || isGist(url) || isCompare(url) || isBlame(url);
|
|
322
322
|
|
|
323
|
+
const hasFiles = (url = location) => isCommit(url) || isCompare(url) || isPRFiles(url);
|
|
324
|
+
|
|
323
325
|
const isMarketplaceAction = (url = location) => url.pathname.startsWith("/marketplace/actions/");
|
|
324
326
|
|
|
325
327
|
const isActionJobRun = (url = location) => {
|
|
@@ -384,4 +386,4 @@ const utils = {
|
|
|
384
386
|
getRepositoryInfo: getRepo
|
|
385
387
|
};
|
|
386
388
|
|
|
387
|
-
export { canUserEditOrganization, canUserEditRepo, hasCode, hasComments, hasFileEditor, hasReleaseEditor, hasRichTextEditor, hasWikiPageEditor, is404, is500, isActionJobRun, isActionRun, isBlame, isBranches, isClosedPR, isCommit, isCommitList, isCompare, isConversation, isConversationList, isDashboard, isDeletingFile, isDiscussion, isDiscussionList, isDraftPR, isEditingFile, isEditingRelease, isEditingWikiPage, isEmptyRepo, isEmptyRepoRoot, isEnterprise, isFileFinder, isForkedRepo, isGist, 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 };
|
|
389
|
+
export { canUserEditOrganization, canUserEditRepo, hasCode, hasComments, hasFileEditor, hasFiles, hasReleaseEditor, hasRichTextEditor, hasWikiPageEditor, is404, is500, isActionJobRun, isActionRun, isBlame, isBranches, isClosedPR, isCommit, isCommitList, isCompare, isConversation, isConversationList, isDashboard, isDeletingFile, isDiscussion, isDiscussionList, isDraftPR, isEditingFile, isEditingRelease, isEditingWikiPage, isEmptyRepo, isEmptyRepoRoot, isEnterprise, isFileFinder, isForkedRepo, isGist, 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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-url-detection",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
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",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"distribution/index.js",
|
|
23
23
|
"distribution/index.d.ts"
|
|
24
24
|
],
|
|
25
|
+
"alias": {
|
|
26
|
+
"./this-stuff-is-just-for-local-parcel-tests": "./package.json",
|
|
27
|
+
"./collector.js": "./collector.ts"
|
|
28
|
+
},
|
|
25
29
|
"scripts": {
|
|
26
30
|
"ava": "ava --timeout 30s",
|
|
27
31
|
"build": "rollup -c",
|
|
@@ -55,28 +59,17 @@
|
|
|
55
59
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
56
60
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
57
61
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
|
|
58
|
-
"@typescript-eslint/
|
|
59
|
-
"error",
|
|
60
|
-
"always-multiline"
|
|
61
|
-
]
|
|
62
|
+
"@typescript-eslint/naming-convention": "off"
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
],
|
|
65
66
|
"rules": {
|
|
66
|
-
"camelcase": "off"
|
|
67
|
-
"comma-dangle": [
|
|
68
|
-
"error",
|
|
69
|
-
"always-multiline"
|
|
70
|
-
],
|
|
71
|
-
"import/extensions": "off",
|
|
72
|
-
"import/no-useless-path-segments": "off",
|
|
73
|
-
"unicorn/import-index": "off"
|
|
67
|
+
"camelcase": "off"
|
|
74
68
|
}
|
|
75
69
|
},
|
|
76
70
|
"ava": {
|
|
77
71
|
"environmentVariables": {
|
|
78
|
-
"TS_NODE_FILES": "true"
|
|
79
|
-
"TS_NODE_COMPILER_OPTIONS": "{\"module\": \"esnext\", \"allowSyntheticDefaultImports\": true}"
|
|
72
|
+
"TS_NODE_FILES": "true"
|
|
80
73
|
},
|
|
81
74
|
"extensions": {
|
|
82
75
|
"ts": "module"
|
|
@@ -91,25 +84,26 @@
|
|
|
91
84
|
},
|
|
92
85
|
"devDependencies": {
|
|
93
86
|
"@rollup/plugin-json": "^4.1.0",
|
|
94
|
-
"@rollup/plugin-node-resolve": "^13.0.
|
|
95
|
-
"@rollup/plugin-typescript": "^8.
|
|
87
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
88
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
96
89
|
"@sindresorhus/tsconfig": "^2.0.0",
|
|
90
|
+
"@types/estree": "^0.0.50",
|
|
97
91
|
"@types/jsdom": "^16.2.13",
|
|
98
92
|
"ava": "^3.15.0",
|
|
99
93
|
"github-reserved-names": "^2.0.4",
|
|
100
|
-
"jsdom": "^
|
|
94
|
+
"jsdom": "^19.0.0",
|
|
101
95
|
"npm-run-all": "^4.1.5",
|
|
102
96
|
"parcel-bundler": "^1.12.4",
|
|
103
97
|
"parcel-plugin-svelte": "^4.0.9",
|
|
104
|
-
"rollup": "^2.
|
|
98
|
+
"rollup": "^2.60.2",
|
|
105
99
|
"rollup-plugin-terser": "^7.0.2",
|
|
106
100
|
"strip-indent": "^4.0.0",
|
|
107
|
-
"svelte": "^3.
|
|
108
|
-
"svelte-check": "^2.2.
|
|
109
|
-
"ts-node": "^10.
|
|
101
|
+
"svelte": "^3.44.2",
|
|
102
|
+
"svelte-check": "^2.2.10",
|
|
103
|
+
"ts-node": "^10.4.0",
|
|
110
104
|
"tslib": "^2.3.1",
|
|
111
|
-
"typescript": "^4.
|
|
112
|
-
"xo": "^0.
|
|
105
|
+
"typescript": "^4.5.2",
|
|
106
|
+
"xo": "^0.47.0"
|
|
113
107
|
},
|
|
114
108
|
"engines": {
|
|
115
109
|
"node": ">=12"
|