Skip to content

Commit c45c479

Browse files
committed
feat: added more built-in GM_* APIs
1 parent 8825575 commit c45c479

File tree

13 files changed

+802
-36
lines changed

13 files changed

+802
-36
lines changed

examples/basic/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ import './styles/style.sass'
44

55
const div = document.querySelector('div')!
66
div.appendChild(createButton())
7-
8-
GM_addStyle('')

examples/basic/src/vite-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/// <reference types="vite/client" />
2-
/// <reference types="vite-userscript-plugin/tampermonkey" />
2+
/// <reference types="vite-userscript-plugin/types/tampermonkey" />

examples/jsx/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { mount, unmount } from 'redom-jsx'
22
import type { RedomComponent, RedomEl } from 'redom-jsx'
3-
import { Counter } from './Counter.jsx'
3+
import { Counter } from './Counter.js'
44

55
export class App implements RedomComponent {
66
el: RedomEl

examples/jsx/src/Toggle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RedomComponent, RedomEl } from 'redom-jsx'
2-
import { Heading } from './Heading.jsx'
2+
import { Heading } from './Heading.js'
33

44
export class Toggle implements RedomComponent {
55
el: RedomEl

examples/jsx/src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from 'redom-jsx'
2-
import { App } from './App.jsx'
3-
import { List } from './List.jsx'
4-
import { Toggle } from './Toggle.jsx'
2+
import { App } from './App.js'
3+
import { List } from './List.js'
4+
import { Toggle } from './Toggle.js'
55

66
mount(document.body, <App />)
77
mount(document.body, <Toggle />)

examples/jsx/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"outDir": "dist",
55
"jsx": "preserve",
66
"types": [
7-
"vite-userscript-plugin/tampermonkey"
7+
"vite-userscript-plugin/types/tampermonkey"
88
]
99
},
1010
"include": [

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"files": [
1313
"dist",
14-
"tampermonkey.d.ts"
14+
"types"
1515
],
1616
"scripts": {
1717
"dev": "tsup --watch",
@@ -58,13 +58,13 @@
5858
"@types/node": "^18.7.18",
5959
"@types/serve-handler": "^6.1.1",
6060
"@types/websocket": "^1.0.5",
61-
"@vitest/ui": "^0.23.2",
61+
"@vitest/ui": "^0.23.4",
6262
"tsup": "^6.2.3",
6363
"turbo": "^1.4.7",
6464
"typescript": "^4.8.3",
6565
"vite": "^3.1.2",
6666
"vite-plugin-dts": "^1.5.0",
67-
"vitest": "^0.23.2"
67+
"vitest": "^0.23.4"
6868
},
6969
"peerDependencies": {
7070
"vite": ">=2.9.0"

pnpm-lock.yaml

Lines changed: 79 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"emitDeclarationOnly": true
66
},
77
"include": [
8-
"src/**/*",
9-
"tampermonkey.d.ts"
8+
"src",
9+
"types"
1010
]
1111
}

types/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Userscript type definitions
2+
3+
[![tampermonkey](https://img.shields.io/npm/v/@types/tampermonkey?label=%40types%2Ftampermonkey)](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tampermonkey)
4+
[![greasemonkey](https://img.shields.io/npm/v/@types/greasemonkey?label=%40types%2Fgreasemonkey)](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/greasemonkey)
5+
[![violentmonkey](https://img.shields.io/npm/v/@violentmonkey/types?label=%40violentmonkey%2Ftypes)](https://github.com/violentmonkey/types)
6+
7+
> Type declaration for `GM_*`, `GM.*` APIs in Tampermonkey, Greasemonkey and Violentmonkey.
8+
9+
## Installation
10+
11+
```sh
12+
npm install --save @types/tampermonkey
13+
```
14+
15+
```sh
16+
npm install --save @types/greasemonkey
17+
```
18+
19+
```sh
20+
npm install --save @violentmonkey/types
21+
```

0 commit comments

Comments
 (0)