chore: move types and base tsconfig into separate package

This commit is contained in:
PalmDevs 2025-04-05 18:17:06 +07:00
parent a31002fba1
commit 206cd6ee78
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
8 changed files with 75 additions and 54 deletions

View file

@ -29,10 +29,16 @@
},
"lib/modules": {
"name": "@revenge-mod/modules",
"dependencies": {
"@revenge-mod/types": "workspace:*",
},
},
"lib/patcher": {
"name": "@revenge-mod/patcher",
},
"lib/types": {
"name": "@revenge-mod/types",
},
"lib/utils": {
"name": "@revenge-mod/utils",
},
@ -411,6 +417,8 @@
"@revenge-mod/patcher": ["@revenge-mod/patcher@workspace:lib/patcher"],
"@revenge-mod/types": ["@revenge-mod/types@workspace:lib/types"],
"@revenge-mod/utils": ["@revenge-mod/utils@workspace:lib/utils"],
"@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.0-beta.7-commit.eeb1005", "", { "os": "darwin", "cpu": "arm64" }, "sha512-WQVJ5ArMFTa4p3TlinFrHlBoKOq1cLSp2uWUpws7cwfpJto3ecGiQJnbbRI8RaDaoS9grare9DrimrKIYPs91w=="],

View file

@ -0,0 +1,21 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
// Features
"lib": ["ESNext"],
"module": "ESNext",
"target": "ES2015",
// Bundler
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"noEmit": true,
// Type checking
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": false,
"types": ["@revenge-mod/types", "@revenge-mod/types/internal/types.d.ts"]
}
}

View file

@ -1,12 +1,5 @@
// Type definitions for things in this codebase ONLY!
import type { Buffer as _Buffer } from 'buffer'
declare global {
// Discord has a Buffer polyfill that gets initialized a little later, be careful with this
var Buffer: typeof _Buffer
}
declare global {
const __BUILD_ENV__: 'development' | 'production'
const __BUILD_COMMIT__: string

16
lib/types/package.json Normal file
View file

@ -0,0 +1,16 @@
{
"name": "@revenge-mod/types",
"private": true,
"type": "module",
"exports": {
"./*": {
"types": "./*"
},
".": {
"types": "./types.d.ts"
},
"./tsconfig": {
"default": "./tsconfig.json"
}
}
}

20
lib/types/tsconfig.json Normal file
View file

@ -0,0 +1,20 @@
{
"compilerOptions": {
// Features
"lib": ["ESNext"],
"module": "ESNext",
"target": "ES2015",
// Bundler
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"noEmit": true,
// Type checking
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noPropertyAccessFromIndexSignature": false,
"types": ["@revenge-mod/types"]
}
}

View file

@ -1,6 +1,7 @@
// All of these typings are exported, be careful what you export here!
import type { Metro } from '@revenge-mod/modules'
import type { Buffer as _Buffer } from 'buffer'
import type { ErrorUtils as RNErrorUtils } from 'react-native'
/// HERMES
@ -85,6 +86,12 @@ declare global {
const ErrorUtils: RNErrorUtils
}
/// POLYFILLS
declare global {
var Buffer: typeof _Buffer
}
export namespace ReactNative {
namespace AssetsRegistry {
export type AssetDestPathResolver = 'android' | 'generic'

View file

@ -1,24 +1,3 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false,
// Other options
"types": []
}
"extends": "@revenge-mod/types/tsconfig"
}

View file

@ -1,27 +1,4 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false,
// Other options
"types": []
},
"exclude": ["scripts/**"]
"extends": "@revenge-mod/types/internal/tsconfig.json",
"exclude": ["scripts"]
}