github-url-detection 8.0.0 → 8.1.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.
@@ -83,6 +83,11 @@ export declare const isRepoWiki: (url?: URL | HTMLAnchorElement | Location) => b
83
83
  export declare const isSingleCommit: (url?: URL | HTMLAnchorElement | Location) => boolean;
84
84
  export declare const isSingleFile: (url?: URL | HTMLAnchorElement | Location) => boolean;
85
85
  export declare const isFileFinder: (url?: URL | HTMLAnchorElement | Location) => boolean;
86
+ /**
87
+ * @example https://github.com/fregante/GhostText/tree/3cacd7df71b097dc525d99c7aa2f54d31b02fcc8/chrome/scripts/InputArea
88
+ * @example https://github.com/refined-github/refined-github/blob/some-non-existent-ref/source/features/bugs-tab.tsx
89
+ */
90
+ export declare const isRepoFile404: (url?: URL | HTMLAnchorElement | Location) => boolean;
86
91
  export declare const isRepoForksList: (url?: URL | HTMLAnchorElement | Location) => boolean;
87
92
  export declare const isRepoNetworkGraph: (url?: URL | HTMLAnchorElement | Location) => boolean;
88
93
  export declare const isForkedRepo: () => boolean;
@@ -1,4 +1,6 @@
1
1
  const reservedNames = [
2
+ "300",
3
+ "302",
2
4
  "400",
3
5
  "401",
4
6
  "402",
@@ -43,6 +45,10 @@ const reservedNames = [
43
45
  "509",
44
46
  "510",
45
47
  "511",
48
+ "693",
49
+ "694",
50
+ "695",
51
+ "900",
46
52
  "about",
47
53
  "access",
48
54
  "account",
@@ -68,6 +74,7 @@ const reservedNames = [
68
74
  "central",
69
75
  "certification",
70
76
  "changelog",
77
+ "chat",
71
78
  "cla",
72
79
  "cloud",
73
80
  "codereview",
@@ -86,6 +93,7 @@ const reservedNames = [
86
93
  "customer-stories",
87
94
  "customer",
88
95
  "customers",
96
+ "dashboard-feed",
89
97
  "dashboard",
90
98
  "dashboards",
91
99
  "design",
@@ -287,7 +295,7 @@ const isCommitList = (url = location) => isRepoCommitList(url) || isPRCommitList
287
295
  const isRepoCommitList = (url = location) => Boolean(getRepo(url)?.path.startsWith("commits"));
288
296
  const isCompare = (url = location) => Boolean(getRepo(url)?.path.startsWith("compare"));
289
297
  const isCompareWikiPage = (url = location) => isRepoWiki(url) && getCleanPathname(url).split("/").slice(3, 5).includes("_compare");
290
- const isDashboard = (url = location) => !isGist(url) && /^$|^(orgs\/[^/]+\/)?dashboard(\/|$)/.test(getCleanPathname(url));
298
+ const isDashboard = (url = location) => !isGist(url) && /^$|^(orgs\/[^/]+\/)?dashboard(-feed)?(\/|$)/.test(getCleanPathname(url));
291
299
  const isEnterprise = (url = location) => url.hostname !== "github.com" && url.hostname !== "gist.github.com";
292
300
  const isGist = (url = location) => typeof getCleanGistPathname(url) === "string";
293
301
  const isGlobalIssueOrPRList = (url = location) => ["issues", "pulls"].includes(url.pathname.split("/", 2)[1]);
@@ -379,6 +387,7 @@ const isRepoWiki = (url = location) => Boolean(getRepo(url)?.path.startsWith("wi
379
387
  const isSingleCommit = (url = location) => /^commit\/[\da-f]{5,40}$/.test(getRepo(url)?.path);
380
388
  const isSingleFile = (url = location) => Boolean(getRepo(url)?.path.startsWith("blob/"));
381
389
  const isFileFinder = (url = location) => Boolean(getRepo(url)?.path.startsWith("find/"));
390
+ const isRepoFile404 = (url = location) => (isSingleFile(url) || isRepoTree(url)) && document.title.startsWith("File not found");
382
391
  const isRepoForksList = (url = location) => getRepo(url)?.path === "network/members";
383
392
  const isRepoNetworkGraph = (url = location) => getRepo(url)?.path === "network";
384
393
  const isForkedRepo = () => exists('meta[name="octolytics-dimension-repository_is_fork"][content="true"]');
@@ -544,6 +553,7 @@ export {
544
553
  isRepliesSettings,
545
554
  isRepo,
546
555
  isRepoCommitList,
556
+ isRepoFile404,
547
557
  isRepoForksList,
548
558
  isRepoHome,
549
559
  isRepoIssueList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-url-detection",
3
- "version": "8.0.0",
3
+ "version": "8.1.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",
@@ -24,7 +24,6 @@
24
24
  "distribution/index.d.ts"
25
25
  ],
26
26
  "scripts": {
27
- "ava": "ava --timeout 30s",
28
27
  "build": "run-p build:*",
29
28
  "build:vite": "vite build",
30
29
  "build:typescript": "tsc --declaration --emitDeclarationOnly",
@@ -32,10 +31,11 @@
32
31
  "demo:test": "svelte-check",
33
32
  "demo:watch": "vite preview demo & vite build demo --watch # vite serve isn't real",
34
33
  "prepack": "npm run build",
35
- "test": "run-p build ava xo",
34
+ "test": "run-p build test:unit xo",
35
+ "test:unit": "bun test",
36
36
  "watch": "run-p watch:typescript demo:watch # vite watch doesn’t generate the lib, so just use the demo",
37
37
  "watch:typescript": "tsc --watch --noEmit",
38
- "watch:ava": "run-p 'ava -- --watch' 'watch:typescript -- --watch'",
38
+ "watch:test:unit": "run-p 'test:unit -- --watch' 'watch:typescript -- --watch'",
39
39
  "xo": "xo"
40
40
  },
41
41
  "xo": {
@@ -48,7 +48,7 @@
48
48
  "*.ts"
49
49
  ],
50
50
  "rules": {
51
- "ava/assertion-arguments": "off",
51
+ "@typescript-eslint/triple-slash-reference": "off",
52
52
  "@typescript-eslint/dot-notation": "off",
53
53
  "@typescript-eslint/no-non-null-assertion": "off",
54
54
  "@typescript-eslint/no-unsafe-member-access": "off",
@@ -62,27 +62,19 @@
62
62
  "camelcase": "off"
63
63
  }
64
64
  },
65
- "ava": {
66
- "extensions": {
67
- "ts": "module"
68
- },
69
- "nodeArguments": [
70
- "--loader=@esbuild-kit/esm-loader"
71
- ]
72
- },
73
65
  "devDependencies": {
74
- "@esbuild-kit/esm-loader": "^2.5.5",
75
- "@sindresorhus/tsconfig": "^3.0.1",
76
- "@sveltejs/vite-plugin-svelte": "^2.4.3",
77
- "ava": "^5.3.1",
78
- "github-reserved-names": "^2.0.4",
66
+ "@sindresorhus/tsconfig": "^4.0.0",
67
+ "@sveltejs/vite-plugin-svelte": "^2.4.6",
68
+ "bun": "^1.0.3",
69
+ "bun-types": "^1.0.3",
70
+ "github-reserved-names": "^2.0.5",
79
71
  "npm-run-all": "^4.1.5",
80
72
  "strip-indent": "^4.0.0",
81
- "svelte": "^4.1.2",
82
- "svelte-check": "^3.4.6",
83
- "typescript": "^5.1.6",
84
- "vite": "^4.4.7",
85
- "xo": "^0.55.0"
73
+ "svelte": "^4.2.1",
74
+ "svelte-check": "^3.5.2",
75
+ "typescript": "^5.2.2",
76
+ "vite": "^4.4.9",
77
+ "xo": "^0.56.0"
86
78
  },
87
79
  "engines": {
88
80
  "node": ">=18"