github-url-detection 6.0.2 → 7.0.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 +3 -2
- package/distribution/index.js +2 -0
- package/package.json +16 -16
package/distribution/index.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export declare const isRepo: (url?: URL | HTMLAnchorElement | Location) => boole
|
|
|
63
63
|
export declare const hasRepoHeader: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
64
64
|
export declare const isEmptyRepoRoot: () => boolean;
|
|
65
65
|
export declare const isEmptyRepo: () => boolean;
|
|
66
|
+
export declare const isPublicRepo: () => boolean;
|
|
66
67
|
export declare const isArchivedRepo: () => boolean;
|
|
67
68
|
export declare const isBlank: () => boolean;
|
|
68
69
|
export declare const isRepoTaxonomyIssueOrPRList: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
@@ -112,7 +113,7 @@ export declare const isUserTheOrganizationOwner: () => boolean;
|
|
|
112
113
|
export declare const canUserEditRepo: () => boolean;
|
|
113
114
|
export declare const isNewRepo: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
114
115
|
export declare const isNewRepoTemplate: (url?: URL | HTMLAnchorElement | Location) => boolean;
|
|
115
|
-
export
|
|
116
|
+
export declare type RepositoryInfo = {
|
|
116
117
|
owner: string;
|
|
117
118
|
name: string;
|
|
118
119
|
/** The 'user/repo' part from an URL */
|
|
@@ -122,7 +123,7 @@ export interface RepositoryInfo {
|
|
|
122
123
|
@example '/user/repo/' -> ''
|
|
123
124
|
@example '/settings/token/' -> undefined */
|
|
124
125
|
path: string;
|
|
125
|
-
}
|
|
126
|
+
};
|
|
126
127
|
export declare const utils: {
|
|
127
128
|
getUsername: () => string | undefined;
|
|
128
129
|
getCleanPathname: (url?: URL | HTMLAnchorElement | Location) => string;
|
package/distribution/index.js
CHANGED
|
@@ -342,6 +342,7 @@ const isRepo = (url = location) => /^[^/]+\/[^/]+/.test(getCleanPathname(url)) &
|
|
|
342
342
|
const hasRepoHeader = (url = location) => isRepo(url) && !isRepoSearch(url);
|
|
343
343
|
const isEmptyRepoRoot = () => isRepoHome() && !exists('link[rel="canonical"]');
|
|
344
344
|
const isEmptyRepo = () => exists('[aria-label="Cannot fork because repository is empty."]');
|
|
345
|
+
const isPublicRepo = () => Boolean(isRepo() && $("#repository-container-header .Label").textContent.startsWith("Public"));
|
|
345
346
|
const isArchivedRepo = () => Boolean(isRepo() && $("#repository-container-header .Label").textContent.endsWith("archive"));
|
|
346
347
|
const isBlank = () => exists("main .blankslate");
|
|
347
348
|
const isRepoTaxonomyIssueOrPRList = (url = location) => /^labels\/.+|^milestones\/\d+(?!\/edit)/.test(getRepo(url)?.path);
|
|
@@ -519,6 +520,7 @@ export {
|
|
|
519
520
|
isProfile,
|
|
520
521
|
isProject,
|
|
521
522
|
isProjects,
|
|
523
|
+
isPublicRepo,
|
|
522
524
|
isQuickPR,
|
|
523
525
|
isReleases,
|
|
524
526
|
isReleasesOrTags,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-url-detection",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.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",
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
"author": "Federico Brigante <me@fregante.com> (https://fregante.com)",
|
|
17
17
|
"sideEffects": false,
|
|
18
18
|
"type": "module",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"exports": "./distribution/index.js",
|
|
20
|
+
"main": "./distribution/index.js",
|
|
21
|
+
"types": "./distribution/index.d.ts",
|
|
21
22
|
"files": [
|
|
22
23
|
"distribution/index.js",
|
|
23
24
|
"distribution/index.d.ts"
|
|
@@ -27,9 +28,9 @@
|
|
|
27
28
|
"build": "run-p build:*",
|
|
28
29
|
"build:vite": "vite build",
|
|
29
30
|
"build:typescript": "tsc --declaration --emitDeclarationOnly",
|
|
30
|
-
"demo:build": "vite build demo
|
|
31
|
+
"demo:build": "vite build demo",
|
|
31
32
|
"demo:test": "svelte-check",
|
|
32
|
-
"demo:watch": "vite
|
|
33
|
+
"demo:watch": "vite preview demo & vite build demo --watch # vite serve isn't real",
|
|
33
34
|
"prepack": "npm run build",
|
|
34
35
|
"test": "run-p build ava xo",
|
|
35
36
|
"watch": "run-p watch:typescript demo:watch # vite watch doesn’t generate the lib, so just use the demo",
|
|
@@ -66,26 +67,25 @@
|
|
|
66
67
|
"ts": "module"
|
|
67
68
|
},
|
|
68
69
|
"nodeArguments": [
|
|
69
|
-
"--loader
|
|
70
|
-
"--experimental-specifier-resolution=node"
|
|
70
|
+
"--loader=@esbuild-kit/esm-loader"
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
+
"@esbuild-kit/esm-loader": "^2.5.0",
|
|
74
75
|
"@sindresorhus/tsconfig": "^3.0.1",
|
|
75
|
-
"@sveltejs/vite-plugin-svelte": "^1.0
|
|
76
|
-
"ava": "^
|
|
77
|
-
"esbuild-node-loader": "^0.8.0",
|
|
76
|
+
"@sveltejs/vite-plugin-svelte": "^1.1.0",
|
|
77
|
+
"ava": "^5.0.1",
|
|
78
78
|
"github-reserved-names": "^2.0.4",
|
|
79
79
|
"npm-run-all": "^4.1.5",
|
|
80
80
|
"strip-indent": "^4.0.0",
|
|
81
|
-
"svelte": "^3.
|
|
82
|
-
"svelte-check": "^2.
|
|
81
|
+
"svelte": "^3.52.0",
|
|
82
|
+
"svelte-check": "^2.9.2",
|
|
83
83
|
"tslib": "^2.4.0",
|
|
84
|
-
"typescript": "^4.
|
|
85
|
-
"vite": "^3.
|
|
86
|
-
"xo": "^0.
|
|
84
|
+
"typescript": "^4.8.4",
|
|
85
|
+
"vite": "^3.1.8",
|
|
86
|
+
"xo": "^0.52.4"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
|
-
"node": ">=
|
|
89
|
+
"node": ">=18"
|
|
90
90
|
}
|
|
91
91
|
}
|