|
1 | | -// Fork from eslint-plugin-userscripts |
2 | | -// Documentation: |
3 | | -// - Tampermonkey: https://www.tampermonkey.net/documentation.php#_grant |
4 | | -// - Violentmonkey: https://violentmonkey.github.io/api/gm |
5 | | -// - Greasemonkey: https://wiki.greasespot.net/Greasemonkey_Manual:API |
6 | | -// - ScriptCat: https://docs.scriptcat.org/docs/dev/cat-api/ |
| 1 | +const compat_grant = require("eslint-plugin-userscripts/dist/data/compat-grant.js"); |
7 | 2 | const compatMap = { |
8 | 3 | CAT_userConfig: [{ type: "scriptcat", versionConstraint: ">=0.11.0-beta" }], |
9 | 4 | CAT_fileStorage: [{ type: "scriptcat", versionConstraint: ">=0.11.0" }], |
10 | | - "GM.addElement": [ |
11 | | - { type: "tampermonkey", versionConstraint: ">=4.11.6113" }, |
12 | | - { type: "violentmonkey", versionConstraint: ">=2.13.0-beta.3" }, |
13 | | - ], |
14 | | - GM_addElement: [ |
15 | | - { type: "tampermonkey", versionConstraint: ">=4.11.6113" }, |
16 | | - { type: "violentmonkey", versionConstraint: ">=2.13.0-beta.3" }, |
17 | | - { type: "scriptcat", versionConstraint: "*" }, |
18 | | - ], |
19 | | - "GM.addStyle": [ |
20 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
21 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
22 | | - ], |
23 | | - GM_addStyle: [ |
24 | | - { type: "tampermonkey", versionConstraint: "*" }, |
25 | | - { type: "violentmonkey", versionConstraint: "*" }, |
26 | | - { type: "greasemonkey", versionConstraint: ">=0.6.1.4 <4" }, |
27 | | - ], |
28 | | - "GM.addValueChangeListener": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
29 | | - GM_addValueChangeListener: [ |
30 | | - { type: "tampermonkey", versionConstraint: ">=2.3.2607" }, |
31 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
32 | | - ], |
33 | | - "GM.cookie": [ |
34 | | - { type: "tampermonkey", versionConstraint: ">=4.8" }, |
35 | | - { type: "scriptcat", versionConstraint: "*" }, |
36 | | - ], |
37 | | - GM_cookie: [ |
38 | | - { type: "tampermonkey", versionConstraint: ">=4.8" }, |
39 | | - { type: "scriptcat", versionConstraint: "*" }, |
40 | | - ], |
41 | | - "GM.deleteValue": [ |
42 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
43 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
44 | | - { type: "greasemonkey", versionConstraint: ">=4.0" }, |
45 | | - ], |
46 | | - GM_deleteValue: [ |
47 | | - { type: "tampermonkey", versionConstraint: "*" }, |
48 | | - { type: "violentmonkey", versionConstraint: "*" }, |
49 | | - { type: "greasemonkey", versionConstraint: ">=0.8.20090123.1 <4" }, |
50 | | - ], |
51 | | - "GM.download": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
52 | | - GM_download: [ |
53 | | - { type: "tampermonkey", versionConstraint: ">=3.8" }, |
54 | | - { type: "violentmonkey", versionConstraint: ">=2.9.5" }, |
55 | | - ], |
56 | | - "GM.getResourceText": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
57 | | - GM_getResourceText: [ |
58 | | - { type: "tampermonkey", versionConstraint: "*" }, |
59 | | - { type: "violentmonkey", versionConstraint: "*" }, |
60 | | - { type: "greasemonkey", versionConstraint: ">=0.8.20080609.0 <4" }, |
61 | | - ], |
62 | | - "GM.getResourceURL": [{ type: "violentmonkey", versionConstraint: ">=2.12.0 <2.13.0.10" }], |
63 | | - GM_getResourceURL: [ |
64 | | - { type: "tampermonkey", versionConstraint: "*" }, |
65 | | - { type: "violentmonkey", versionConstraint: "*" }, |
66 | | - { type: "greasemonkey", versionConstraint: ">=0.8.20080609.0 <4" }, |
67 | | - ], |
68 | | - "GM.getResourceUrl": [ |
69 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
70 | | - { type: "violentmonkey", versionConstraint: ">=2.13.0.10" }, |
71 | | - { type: "greasemonkey", versionConstraint: ">=4.0" }, |
72 | | - ], |
73 | | - "GM.getTab": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
74 | | - GM_getTab: [{ type: "tampermonkey", versionConstraint: ">=4.0.10" }], |
75 | | - "GM.getTabs": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
76 | | - GM_getTabs: [{ type: "tampermonkey", versionConstraint: ">=4.0.10" }], |
77 | | - "GM.getValue": [ |
78 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
79 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
80 | | - { type: "greasemonkey", versionConstraint: ">=4.0" }, |
81 | | - ], |
82 | | - GM_getValue: [ |
83 | | - { type: "tampermonkey", versionConstraint: "*" }, |
84 | | - { type: "violentmonkey", versionConstraint: "*" }, |
85 | | - { type: "greasemonkey", versionConstraint: ">=0.3-beta <4" }, |
86 | | - ], |
87 | | - "GM.info": [ |
88 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
89 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
90 | | - { type: "greasemonkey", versionConstraint: ">=4" }, |
91 | | - ], |
92 | | - GM_info: [ |
93 | | - { type: "tampermonkey", versionConstraint: ">=2.4.2718" }, |
94 | | - { type: "violentmonkey", versionConstraint: "*" }, |
95 | | - { type: "greasemonkey", versionConstraint: ">=0.9.16 <4" }, |
96 | | - ], |
97 | | - "GM.listValues": [ |
98 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
99 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
100 | | - { type: "greasemonkey", versionConstraint: ">=4" }, |
101 | | - ], |
102 | | - GM_listValues: [ |
103 | | - { type: "tampermonkey", versionConstraint: "*" }, |
104 | | - { type: "violentmonkey", versionConstraint: "*" }, |
105 | | - { type: "greasemonkey", versionConstraint: ">=0.8.20090123.1 <4" }, |
106 | | - ], |
107 | | - "GM.log": [ |
108 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
109 | | - { type: "greasemonkey", versionConstraint: ">=4" }, |
110 | | - ], |
111 | | - GM_log: [ |
112 | | - { type: "tampermonkey", versionConstraint: "*" }, |
113 | | - { type: "violentmonkey", versionConstraint: "*" }, |
114 | | - { type: "greasemonkey", versionConstraint: ">=0.3-beta <4" }, |
115 | | - ], |
116 | | - "GM.notification": [ |
117 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
118 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
119 | | - { type: "greasemonkey", versionConstraint: ">=4" }, |
120 | | - ], |
121 | | - GM_notification: [ |
122 | | - { type: "tampermonkey", versionConstraint: ">=2.0.2344" }, |
123 | | - { type: "violentmonkey", versionConstraint: ">=2.5.0" }, |
124 | | - ], |
125 | | - "GM.openInTab": [ |
126 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
127 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
128 | | - { type: "greasemonkey", versionConstraint: ">=4" }, |
129 | | - ], |
130 | | - GM_openInTab: [ |
131 | | - { type: "tampermonkey", versionConstraint: "*" }, |
132 | | - { type: "violentmonkey", versionConstraint: "*" }, |
133 | | - { type: "greasemonkey", versionConstraint: ">=0.5-beta <4" }, |
134 | | - ], |
135 | | - "GM.registerMenuCommand": [ |
136 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
137 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
138 | | - { type: "greasemonkey", versionConstraint: ">=4.11" }, |
139 | | - ], |
140 | | - GM_registerMenuCommand: [ |
141 | | - { type: "tampermonkey", versionConstraint: "*" }, |
142 | | - { type: "violentmonkey", versionConstraint: "*" }, |
143 | | - { type: "greasemonkey", versionConstraint: ">=0.2.5 <4" }, |
144 | | - ], |
145 | | - "GM.removeValueChangeListener": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
146 | | - GM_removeValueChangeListener: [ |
147 | | - { type: "tampermonkey", versionConstraint: ">=2.3.2607" }, |
148 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
149 | | - ], |
150 | | - "GM.saveTab": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
151 | | - GM_saveTab: [{ type: "tampermonkey", versionConstraint: ">=4.0.10" }], |
152 | | - "GM.setClipboard": [ |
153 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
154 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
155 | | - { type: "greasemonkey", versionConstraint: ">=4" }, |
156 | | - ], |
157 | | - GM_setClipboard: [ |
158 | | - { type: "tampermonkey", versionConstraint: ">=2.6.2767" }, |
159 | | - { type: "violentmonkey", versionConstraint: ">=2.5.0" }, |
160 | | - { type: "greasemonkey", versionConstraint: ">=1.10 <4" }, |
161 | | - ], |
162 | | - "GM.setValue": [ |
163 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
164 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
165 | | - { type: "greasemonkey", versionConstraint: ">=4" }, |
166 | | - ], |
167 | | - GM_setValue: [ |
168 | | - { type: "tampermonkey", versionConstraint: "*" }, |
169 | | - { type: "violentmonkey", versionConstraint: "*" }, |
170 | | - { type: "greasemonkey", versionConstraint: ">=0.3-beta <4" }, |
171 | | - ], |
172 | | - "GM.unregisterMenuCommand": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
173 | | - GM_unregisterMenuCommand: [ |
174 | | - { type: "tampermonkey", versionConstraint: ">=3.6.3737" }, |
175 | | - { type: "violentmonkey", versionConstraint: ">=2.9.4" }, |
176 | | - ], |
177 | | - "GM.webRequest": [{ type: "tampermonkey", versionConstraint: ">=4.5" }], |
178 | | - GM_webRequest: [{ type: "tampermonkey", versionConstraint: ">=4.4" }], |
179 | | - GM_xmlhttpRequest: [ |
180 | | - { type: "tampermonkey", versionConstraint: "*" }, |
181 | | - { type: "violentmonkey", versionConstraint: "*" }, |
182 | | - { type: "greasemonkey", versionConstraint: ">=0.2.5 <4" }, |
183 | | - ], |
184 | | - "GM.xmlHttpRequest": [ |
185 | | - { type: "tampermonkey", versionConstraint: ">=4.5" }, |
186 | | - { type: "violentmonkey", versionConstraint: ">=2.12.0" }, |
187 | | - { type: "greasemonkey", versionConstraint: ">=4.0" }, |
188 | | - ], |
189 | | - none: [ |
190 | | - { type: "tampermonkey", versionConstraint: "*" }, |
191 | | - { type: "violentmonkey", versionConstraint: "*" }, |
192 | | - { type: "greasemonkey", versionConstraint: "*" }, |
193 | | - ], |
194 | | - unsafeWindow: [ |
195 | | - { type: "tampermonkey", versionConstraint: "*" }, |
196 | | - { type: "violentmonkey", versionConstraint: "*" }, |
197 | | - { type: "greasemonkey", versionConstraint: ">=0.5-beta" }, |
198 | | - ], |
199 | | - "window.close": [ |
200 | | - { type: "tampermonkey", versionConstraint: ">=3.12.58" }, |
201 | | - { type: "violentmonkey", versionConstraint: ">=2.6.2" }, |
202 | | - ], |
203 | | - "window.focus": [ |
204 | | - { type: "tampermonkey", versionConstraint: ">=3.12.58" }, |
205 | | - { type: "violentmonkey", versionConstraint: ">=2.12.10" }, |
206 | | - ], |
207 | | - "window.onurlchange": [{ type: "tampermonkey", versionConstraint: ">=4.11" }], |
| 5 | + ...compat_grant.compatMap, |
208 | 6 | }; |
209 | 7 |
|
210 | 8 | const gmPolyfillOverride = { |
211 | | - GM_addStyle: "ignore", |
212 | | - GM_registerMenuCommand: "ignore", |
213 | | - GM_getResourceText: { |
214 | | - deps: ["GM.getResourceUrl", "GM.log"], |
215 | | - }, |
216 | | - "GM.log": "ignore", |
217 | | - "GM.info": { |
218 | | - deps: ["GM_info"], |
219 | | - }, |
220 | | - "GM.addStyle": { |
221 | | - deps: ["GM_addStyle"], |
222 | | - }, |
223 | | - "GM.deleteValue": { |
224 | | - deps: ["GM_deleteValue"], |
225 | | - }, |
226 | | - "GM.getResourceUrl": { |
227 | | - deps: ["GM_getResourceURL"], |
228 | | - }, |
229 | | - "GM.getValue": { |
230 | | - deps: ["GM_getValue"], |
231 | | - }, |
232 | | - "GM.listValues": { |
233 | | - deps: ["GM_listValues"], |
234 | | - }, |
235 | | - "GM.notification": { |
236 | | - deps: ["GM_notification"], |
237 | | - }, |
238 | | - "GM.openInTab": { |
239 | | - deps: ["GM_openInTab"], |
240 | | - }, |
241 | | - "GM.registerMenuCommand": { |
242 | | - deps: ["GM_registerMenuCommand"], |
243 | | - }, |
244 | | - "GM.setClipboard": { |
245 | | - deps: ["GM_setClipboard"], |
246 | | - }, |
247 | | - "GM.setValue": { |
248 | | - deps: ["GM_setValue"], |
249 | | - }, |
250 | | - "GM.xmlHttpRequest": { |
251 | | - deps: ["GM_xmlhttpRequest"], |
252 | | - }, |
253 | | - "GM.getResourceText": { |
254 | | - deps: ["GM_getResourceText"], |
255 | | - }, |
| 9 | + ...compat_grant.gmPolyfillOverride, |
256 | 10 | }; |
257 | 11 |
|
258 | | -module.exports.compatMap = compatMap; |
259 | | -module.exports.gmPolyfillOverride = gmPolyfillOverride; |
| 12 | +module.exports = { compatMap, gmPolyfillOverride }; |
0 commit comments