npm types package

This commit is contained in:
Vendicated 2023-04-19 20:18:42 +02:00
parent 8dd70f5d1a
commit b7299ea2cc
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905
10 changed files with 242 additions and 108 deletions

2
packages/vencord-types/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
dist
node_modules

View File

@ -0,0 +1,2 @@
node_modules
prepare.ts

View File

@ -0,0 +1,11 @@
# Vencord Types
Typings for Vencord's api, published to npm
```sh
npm i @vencord/types
yarn add @vencord/types
pnpm add @vencord/types
```

5
packages/vencord-types/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/* eslint-disable */
/// <reference path="dist/Vencord.d.ts" />
/// <reference path="dist/globals.d.ts" />
/// <reference path="dist/modules.d.ts" />

View File

@ -0,0 +1,26 @@
{
"name": "@vencord/types",
"private": false,
"version": "0.1.0",
"description": "",
"types": "index.d.ts",
"scripts": {
"prepublishOnly": "tsx ./prepare.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Vencord",
"license": "GPL-3.0",
"devDependencies": {
"tsx": "^3.12.6"
},
"dependencies": {
"@types/lodash": "^4.14.191",
"@types/node": "^18.11.18",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"discord-types": "^1.3.26",
"standalone-electron-types": "^1.0.0",
"type-fest": "^3.5.3"
}
}

View File

@ -0,0 +1,31 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { cpSync, rmSync } from "fs";
import { join } from "path";
for (const file of ["preload.d.ts", "userplugins", "main", "debug"]) {
rmSync(join(__dirname, "dist", file), { recursive: true, force: true });
}
for (const file of ["globals.d.ts", "modules.d.ts"]) {
cpSync(
join(__dirname, "..", "..", "src", file),
join(__dirname, "dist", file)
);
}

232
pnpm-lock.yaml generated
View File

@ -8,102 +8,132 @@ patchedDependencies:
hash: 7wc6icvgtg3uswirb5tpsbjnbe
path: patches/eslint@8.28.0.patch
dependencies:
'@vap/core':
specifier: 0.0.12
version: 0.0.12
'@vap/shiki':
specifier: 0.10.3
version: 0.10.3
fflate:
specifier: ^0.7.4
version: 0.7.4
nanoid:
specifier: ^4.0.2
version: 4.0.2
virtual-merge:
specifier: ^1.0.1
version: 1.0.1
importers:
devDependencies:
'@types/diff':
specifier: ^5.0.2
version: 5.0.2
'@types/lodash':
specifier: ^4.14.191
version: 4.14.191
'@types/node':
specifier: ^18.11.18
version: 18.11.18
'@types/react':
specifier: ^18.0.27
version: 18.0.27
'@types/react-dom':
specifier: ^18.0.10
version: 18.0.10
'@types/yazl':
specifier: ^2.4.2
version: 2.4.2
'@typescript-eslint/eslint-plugin':
specifier: ^5.49.0
version: 5.49.0(@typescript-eslint/parser@5.49.0)(eslint@8.28.0)(typescript@4.9.4)
'@typescript-eslint/parser':
specifier: ^5.49.0
version: 5.49.0(eslint@8.28.0)(typescript@4.9.4)
diff:
specifier: ^5.1.0
version: 5.1.0
discord-types:
specifier: ^1.3.26
version: 1.3.26
esbuild:
specifier: ^0.15.18
version: 0.15.18
eslint:
specifier: ^8.28.0
version: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe)
eslint-import-resolver-alias:
specifier: ^1.1.2
version: 1.1.2
eslint-plugin-header:
specifier: ^3.1.1
version: 3.1.1(eslint@8.28.0)
eslint-plugin-path-alias:
specifier: ^1.0.0
version: 1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0)
eslint-plugin-simple-import-sort:
specifier: ^8.0.0
version: 8.0.0(eslint@8.28.0)
eslint-plugin-unused-imports:
specifier: ^2.0.0
version: 2.0.0(@typescript-eslint/eslint-plugin@5.49.0)(eslint@8.28.0)
highlight.js:
specifier: 10.6.0
version: 10.6.0
moment:
specifier: ^2.29.4
version: 2.29.4
puppeteer-core:
specifier: ^19.6.0
version: 19.6.0
standalone-electron-types:
specifier: ^1.0.0
version: 1.0.0
stylelint:
specifier: ^14.16.1
version: 14.16.1
stylelint-config-standard:
specifier: ^29.0.0
version: 29.0.0(stylelint@14.16.1)
tsx:
specifier: ^3.12.6
version: 3.12.6
type-fest:
specifier: ^3.5.3
version: 3.5.3
typescript:
specifier: ^4.9.4
version: 4.9.4
.:
dependencies:
'@vap/core':
specifier: 0.0.12
version: 0.0.12
'@vap/shiki':
specifier: 0.10.3
version: 0.10.3
fflate:
specifier: ^0.7.4
version: 0.7.4
nanoid:
specifier: ^4.0.2
version: 4.0.2
virtual-merge:
specifier: ^1.0.1
version: 1.0.1
devDependencies:
'@types/diff':
specifier: ^5.0.2
version: 5.0.2
'@types/lodash':
specifier: ^4.14.191
version: 4.14.191
'@types/node':
specifier: ^18.11.18
version: 18.11.18
'@types/react':
specifier: ^18.0.27
version: 18.0.27
'@types/react-dom':
specifier: ^18.0.10
version: 18.0.10
'@types/yazl':
specifier: ^2.4.2
version: 2.4.2
'@typescript-eslint/eslint-plugin':
specifier: ^5.49.0
version: 5.49.0(@typescript-eslint/parser@5.49.0)(eslint@8.28.0)(typescript@4.9.4)
'@typescript-eslint/parser':
specifier: ^5.49.0
version: 5.49.0(eslint@8.28.0)(typescript@4.9.4)
diff:
specifier: ^5.1.0
version: 5.1.0
discord-types:
specifier: ^1.3.26
version: 1.3.26
esbuild:
specifier: ^0.15.18
version: 0.15.18
eslint:
specifier: ^8.28.0
version: 8.28.0(patch_hash=7wc6icvgtg3uswirb5tpsbjnbe)
eslint-import-resolver-alias:
specifier: ^1.1.2
version: 1.1.2
eslint-plugin-header:
specifier: ^3.1.1
version: 3.1.1(eslint@8.28.0)
eslint-plugin-path-alias:
specifier: ^1.0.0
version: 1.0.0(patch_hash=m6sma4g6bh67km3q6igf6uxaja)(eslint@8.28.0)
eslint-plugin-simple-import-sort:
specifier: ^8.0.0
version: 8.0.0(eslint@8.28.0)
eslint-plugin-unused-imports:
specifier: ^2.0.0
version: 2.0.0(@typescript-eslint/eslint-plugin@5.49.0)(eslint@8.28.0)
highlight.js:
specifier: 10.6.0
version: 10.6.0
moment:
specifier: ^2.29.4
version: 2.29.4
puppeteer-core:
specifier: ^19.6.0
version: 19.6.0
standalone-electron-types:
specifier: ^1.0.0
version: 1.0.0
stylelint:
specifier: ^14.16.1
version: 14.16.1
stylelint-config-standard:
specifier: ^29.0.0
version: 29.0.0(stylelint@14.16.1)
tsx:
specifier: ^3.12.6
version: 3.12.6
type-fest:
specifier: ^3.5.3
version: 3.5.3
typescript:
specifier: ^4.9.4
version: 4.9.4
packages/vencord-types:
dependencies:
'@types/lodash':
specifier: ^4.14.191
version: 4.14.191
'@types/node':
specifier: ^18.11.18
version: 18.11.18
'@types/react':
specifier: ^18.0.27
version: 18.0.27
'@types/react-dom':
specifier: ^18.0.10
version: 18.0.10
discord-types:
specifier: ^1.3.26
version: 1.3.26
standalone-electron-types:
specifier: ^1.0.0
version: 1.0.0
type-fest:
specifier: ^3.5.3
version: 3.5.3
devDependencies:
tsx:
specifier: ^3.12.6
version: 3.12.6
packages:
@ -444,7 +474,6 @@ packages:
/@types/lodash@4.14.191:
resolution: {integrity: sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ==}
dev: true
/@types/minimist@1.2.2:
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
@ -452,7 +481,6 @@ packages:
/@types/node@18.11.18:
resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==}
dev: true
/@types/normalize-package-data@2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
@ -464,20 +492,17 @@ packages:
/@types/prop-types@15.7.5:
resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}
dev: true
/@types/react-dom@18.0.10:
resolution: {integrity: sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg==}
dependencies:
'@types/react': 18.0.27
dev: true
/@types/react@17.0.2:
resolution: {integrity: sha512-Xt40xQsrkdvjn1EyWe1Bc0dJLcil/9x2vAuW7ya+PuQip4UYUaXyhzWmAbwRsdMgwOFHpfp7/FFZebDU6Y8VHA==}
dependencies:
'@types/prop-types': 15.7.5
csstype: 3.1.0
dev: true
/@types/react@18.0.27:
resolution: {integrity: sha512-3vtRKHgVxu3Jp9t718R9BuzoD4NcQ8YJ5XRzsSKxNDiDonD2MXIT1TmSkenxuCycZJoQT5d2vE8LwWJxBC1gmA==}
@ -485,11 +510,9 @@ packages:
'@types/prop-types': 15.7.5
'@types/scheduler': 0.16.2
csstype: 3.1.0
dev: true
/@types/scheduler@0.16.2:
resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==}
dev: true
/@types/semver@7.3.13:
resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==}
@ -980,7 +1003,6 @@ packages:
/csstype@3.1.0:
resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
dev: true
/debug@2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
@ -1070,7 +1092,6 @@ packages:
dependencies:
'@types/react': 17.0.2
moment: 2.29.4
dev: true
/doctrine@3.0.0:
resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
@ -2262,7 +2283,6 @@ packages:
/moment@2.29.4:
resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==}
dev: true
/ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
@ -2828,7 +2848,6 @@ packages:
resolution: {integrity: sha512-0HOi/tlTz3mjWhsAz4uRbpQcHMZ+ifj1JzWW9nugykOHClBBG77ps8QinrzX1eow4Iw2pnC+RFaSYRgufF4BOg==}
dependencies:
'@types/node': 18.11.18
dev: true
/static-extend@0.1.2:
resolution: {integrity: sha512-72E9+uLc27Mt718pMHt9VMNiAL4LMsmDbBva8mxWUCkT07fSzEGMYUCk0XWY6lp0j6RBAG4cJ3mWuZv2OE3s0g==}
@ -3098,7 +3117,6 @@ packages:
/type-fest@3.5.3:
resolution: {integrity: sha512-V2+og4j/rWReWvaFrse3s9g2xvUv/K9Azm/xo6CjIuq7oeGqsoimC7+9/A3tfvNcbQf8RPSVj/HV81fB4DJrjA==}
engines: {node: '>=14.16'}
dev: true
/typescript@4.9.4:
resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==}

2
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,2 @@
packages:
- packages/*

2
src/modules.d.ts vendored
View File

@ -20,7 +20,7 @@
/// <reference types="standalone-electron-types"/>
declare module "~plugins" {
const plugins: Record<string, import("@utils/types").Plugin>;
const plugins: Record<string, import("./utils/types").Plugin>;
export default plugins;
}

View File

@ -0,0 +1,37 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "HighResImages",
description: "Makes Discord use higher resolution versions of images (pfps, emotes, etc)",
authors: [Devs.Ven],
patches: [
{
find: 'command:"tenor"',
replacement: {
// resolution list. Simply removes everything smaller than 512
match: /=\[16,20,22.+?,(512,.+?3072,4096)\]/,
replace: "=[$1]"
}
}
]
});