Compare commits

..
15 Commits
Author SHA1 Message Date
rilaxik e29dc20398 upd (fw):
- deployment config + scripts
- License bump
2025-01-29 17:34:03 +00:00
rilaxik 82050004f6 upd (fw):
- sharing same tsconfig
2025-01-29 14:57:58 +00:00
rilaxik 179d7b8b93 upd (fw):
- eslint config
- correct tsconfigs
2025-01-28 22:44:54 +00:00
rilaxik 978d15bd25 Merge remote-tracking branch 'origin/dev' into dev 2025-01-28 21:06:42 +00:00
rilaxik 4e48772950 upd (fw):
- using syncpack to maintain dependencies consistency
- testing lerna
2025-01-28 21:06:25 +00:00
rilaxik 84994ef121 upd (fw):
- using syncpack to maintain dependencies consistency
- testing lerna
2025-01-28 21:06:12 +00:00
rilaxik 166b933b71 upd (fw): configs 2025-01-28 19:04:16 +00:00
Oleksandr Honcharov e3d7a66646 license update 2025-01-28 17:06:01 +02:00
Oleksandr Honcharov f977e6191f added skipLibCheck for RPC 2025-01-28 16:56:57 +02:00
Oleksandr Honcharov 593f4650a3 versions changes / code improvements 2025-01-28 16:53:44 +02:00
Oleksandr Honcharov d56c52abf5 lock file 2025-01-28 16:38:10 +02:00
rilaxik f5648abb00 upd (fw): versions bump + configs 2025-01-28 14:37:29 +00:00
rilaxik 47375c0a15 upd (fw): versions bump + configs 2025-01-28 14:35:38 +00:00
rilaxik b55204ee61 upd (cli): repos bump 2025-01-27 01:35:19 +00:00
rilaxik 51f50141ab dx
removed type exports and changed export path to enable symlink while developing
2025-01-26 21:18:36 +00:00
40 changed files with 4231 additions and 8862 deletions
+8
View File
@@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [
["@entityseven/rage-fw-browser","@entityseven/rage-fw-client","@entityseven/rage-fw-server"]
],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
-31
View File
@@ -1,31 +0,0 @@
env:
node: true
es6: true
es2019: true
extends:
- 'eslint:recommended'
- 'plugin:@typescript-eslint/recommended'
# - 'prettier'
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: '2019'
sourceType: 'script'
plugins:
- '@typescript-eslint'
ignorePatterns:
- 'node_modules'
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
"argsIgnorePattern": '^_',
"varsIgnorePattern": '^_',
"caughtErrorsIgnorePattern": '^_'
}
],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'consistent-return': 'warn',
'no-empty': 'off',
}
+2 -1
View File
@@ -1,4 +1,5 @@
.idea .idea
node_modules node_modules
dist dist
.nx/cache
+33
View File
@@ -0,0 +1,33 @@
{
"dependencyTypes": ["prod", "peer", "dev"],
"versionGroups": [
{
"label": "Ensure @ragempcommunity/types-* always match",
"packages": ["**"],
"dependencies": ["@ragempcommunity/types-cef","@ragempcommunity/types-client", "@ragempcommunity/types-server"],
"pinVersion": "sameRange",
"range": "^"
},
{
"label": "Use workspace protocol when developing local packages",
"packages": ["**"],
"dependencies": ["@entityseven/rage-fw-shared-types", "@entityseven/rage-fw-rpc"]
"pinVersion": "workspace:*",
"range": ""
},
{
"label": "Ensure @types/node match same version (for tsup)",
"packages": ["**"],
"dependencies": ["@types/node"],
"pinVersion": "sameRange",
"range": ""
},
{
"label": "Ensure newest breaking Typescript version",
"packages": ["**"],
"dependencies": ["typescript"],
"pinVersion": "sameRange",
"range": "^"
}
]
}
+1 -1
View File
@@ -1,4 +1,4 @@
# Custom Attribution-NoDerivs Software License # Custom Attribution-NoDerives Software License
This license allows you to use, copy, and distribute the RageFW (the "Software"), including for commercial purposes, provided that the following conditions are met: This license allows you to use, copy, and distribute the RageFW (the "Software"), including for commercial purposes, provided that the following conditions are met:
+1 -1
View File
@@ -1,4 +1,4 @@
Custom Attribution-NoDerivs Software License Custom Attribution-NoDerives Software License
Copyright (c) 2024 Entity Seven Group Copyright (c) 2024 Entity Seven Group
+21 -6
View File
@@ -1,22 +1,37 @@
{ {
"private": false,
"name": "@entityseven/rage-fw-browser", "name": "@entityseven/rage-fw-browser",
"version": "0.2.0", "version": "0.2.0",
"main": "dist/index.js",
"types": "dist/src/index.d.ts",
"files": [ "files": [
"dist/**/*", "dist/**/*",
"readme.md", "readme.md",
"LICENSE" "LICENSE",
"package.json"
], ],
"main": "src/index.ts",
"exports": {
".": "./src/index.ts"
},
"publishConfig": {
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": "./dist/index.js"
}
},
"scripts": { "scripts": {
"build": "tsup" "build": "tsup"
}, },
"dependencies": { "dependencies": {
"@entityseven/rage-fw-rpc": "0.2.5" "@entityseven/rage-fw-rpc": "workspace:*"
},
"devDependencies": {
"@types/node": "22.12.0"
}, },
"peerDependencies": { "peerDependencies": {
"@entityseven/rage-fw-shared-types": "0.2.0", "@entityseven/rage-fw-shared-types": "workspace:*",
"@ragempcommunity/types-cef": "^2.1.8" "@ragempcommunity/types-cef": "^2.1.8",
"typescript": "^5.7.3"
}, },
"description": "Package used on a browser-side of your Rage:MP Server", "description": "Package used on a browser-side of your Rage:MP Server",
"keywords": [ "keywords": [
-5
View File
@@ -1,11 +1,6 @@
import { Helper } from './helper' import { Helper } from './helper'
import { rpc } from './rpc' import { rpc } from './rpc'
import type * as T from '../types' import type * as T from '../types'
import {
RageFW_BrowserEvent,
RageFW_ClientEvent,
RageFW_ServerEvent,
} from '../types'
/** Browser-side interactions */ /** Browser-side interactions */
export class Browser extends Helper { export class Browser extends Helper {
+4 -21
View File
@@ -1,25 +1,8 @@
{ {
"$schema": "https://json.schemastore.org/tsconfig", "$schema": "https://json.schemastore.org/tsconfig",
"display": "Base", "display": "Browser",
"exclude": [
"node_modules"
],
"compilerOptions": { "compilerOptions": {
"incremental": false, "types": ["./node_modules/@ragempcommunity/types-cef/index.d.ts", "node"]
"composite": false, },
"target": "ES2022", "extends": ["../tsconfig.ragefw.json"]
"experimentalDecorators": true,
"moduleDetection": "auto",
"module": "CommonJS",
"resolveJsonModule": true,
"declaration": false,
"declarationMap": false,
"sourceMap": false,
"downlevelIteration": false,
"inlineSourceMap": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
} }
+2 -2
View File
@@ -1,12 +1,12 @@
import { defineConfig } from 'tsup' import { defineConfig } from 'tsup'
export default defineConfig({ export default defineConfig({
entry: ['src/index.ts'], entry: ['src/**/*.ts'],
outDir: './dist', outDir: './dist',
format: ['cjs'], format: ['cjs'],
noExternal: ['rage-rpc'],
experimentalDts: true, experimentalDts: true,
splitting: false, splitting: false,
bundle: false,
sourcemap: false, sourcemap: false,
clean: true, clean: true,
}) })
+5 -4
View File
@@ -13,7 +13,8 @@
"scripts": { "scripts": {
"watch": "tsc -w", "watch": "tsc -w",
"build": "tsup", "build": "tsup",
"start": "npx ./dist create" "start": "npx ./dist create",
"install": "pnpm install --ignore-workspace"
}, },
"dependencies": { "dependencies": {
"@inquirer/prompts": "^5.0.5", "@inquirer/prompts": "^5.0.5",
@@ -22,12 +23,12 @@
"yargs": "^17.7.2" "yargs": "^17.7.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.14.2", "@types/node": "^22.12.0",
"@types/yargs": "^17.0.32", "@types/yargs": "^17.0.32",
"prettier": "^3.3.2", "prettier": "^3.3.2",
"typescript": "^5.4.5" "typescript": "^5.7.3"
}, },
"description": "CLI to scaffold a preview for Rage-FW", "description": "CLI to scaffold a preview for Rage FW",
"keywords": ["create-rage-fw","ragefw-cli", "ragefw", "rage-fw", "ragemp", "rage:mp", "rage", "gta5"], "keywords": ["create-rage-fw","ragefw-cli", "ragefw", "rage-fw", "ragemp", "rage:mp", "rage", "gta5"],
"author": "Entity Seven Group", "author": "Entity Seven Group",
"contributors": [ "contributors": [
+488
View File
@@ -0,0 +1,488 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
dependencies:
'@inquirer/prompts':
specifier: ^5.0.5
version: 5.5.0
chalk:
specifier: 4.1.2
version: 4.1.2
ky:
specifier: ^1.7.2
version: 1.7.4
yargs:
specifier: ^17.7.2
version: 17.7.2
devDependencies:
'@types/node':
specifier: ^22.12.0
version: 22.12.0
'@types/yargs':
specifier: ^17.0.32
version: 17.0.33
prettier:
specifier: ^3.3.2
version: 3.4.2
typescript:
specifier: ^5.7.3
version: 5.7.3
packages:
'@inquirer/[email protected]':
resolution: {integrity: sha512-sMgdETOfi2dUHT8r7TT1BTKOwNvdDGFDXYWtQ2J69SvlYNntk9I/gJe7r5yvMwwsuKnYbuRs3pNhx4tgNck5aA==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-oOIwPs0Dvq5220Z8lGL/6LHRTEr9TgLHmiI99Rj1PJ1p1czTys+olrgBqZk4E2qC0YTzeHprxSQmoHioVdJ7Lw==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-F2VBt7W/mwqEU4bL0RnHNZmC/OxzNx9cOYxHqnXX3MP6ruYvZUZAW9imgN9+h/uBT/oP8Gh888J2OZSbjSeWcg==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-9KHOpJ+dIL5SZli8lJ6xdaYLPPzB8xB9GZItg39MBybzhxA16vxmszmQFrRwbOA918WA2rvu8xhDEg/p6LXKbw==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-qnJsUcOGCSG1e5DTOErmv2BPQqrtT6uzqn1vI/aYGiPKq+FgslGZmtdnXbhuI7IlT7OByDoEEqdnhUnVR2hhLw==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-BXvGj0ehzrngHTPTDqUoDT3NXL8U0RxUk2zJm2A66RhCEIWdtU1v6GuUqNAgArW4PQ9CinqIWyHdQgdwOj06zQ==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-XfnpCStx2xgh1LIRqPXrTNEEByqQWoxsWYzNRSEUxJ5c6EQlhMogJ3vHKu8aXuTacebtaZzMAHwEL0kAflKOBw==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-ilUnia/GZUtfSZy3YEErXLJ2Sljo/mf9fiKc08n18DdwdmDbOzRcTv65H1jjDvlsAuvdFXf4Sa/aL7iw/NanVA==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-5otqIpgsPYIshqhgtEwSspBQE40etouR8VIxzpJkv9i0dVHIpyhiivbkH9/dGiMLdyamT54YRdGJLfl8TFnLHg==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-BHDeL0catgHdcHbSFFUddNzvx/imzJMft+tWDPwTm3hfu8/tApk1HrooNngB2Mb4qY+KaRWF+iZqoVUPeslEog==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-zzfNuINhFF7OLAtGHfhwOW2TlYJyli7lOUoJUXw/uyklcwalV6WRXBXtFIicN8rTRK1XTiPWB4UY+YuW8dsnLQ==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-h+/5LSj51dx7hp5xOn4QFnUaKeARwUCLs6mIhtkJ0JYPBLmEYjdHSYh7I6GrLg9LwpJ3xeX0FZgAG1q0QdCpVQ==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-YmDobTItPP3WcEI86GvPo+T2sRHkxxOq/kXmsBjHS5BVXUgvgZ5AfJjkvQvZr03T81NnI3KrrRuMzeuYUQRFOA==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==}
engines: {node: '>=18'}
'@inquirer/[email protected]':
resolution: {integrity: sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==}
engines: {node: '>=18'}
'@types/[email protected]':
resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==}
'@types/[email protected]':
resolution: {integrity: sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==}
'@types/[email protected]':
resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==}
'@types/[email protected]':
resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==}
'@types/[email protected]':
resolution: {integrity: sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==}
[email protected]:
resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==}
[email protected]:
resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==}
engines: {node: '>= 12'}
[email protected]:
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
engines: {node: '>=12'}
[email protected]:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
[email protected]:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
[email protected]:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
[email protected]:
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==}
engines: {node: '>=4'}
[email protected]:
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
engines: {node: 6.* || 8.* || >= 10.*}
[email protected]:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'}
[email protected]:
resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-zYEr/gh7uLW2l4su11bmQ2M9xLgQLjyvx58UyNM/6nuqyWFHPX5ktMjvpev3F8QWdjSsHUpnWew4PBCswBNuMQ==}
engines: {node: '>=18'}
[email protected]:
resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
[email protected]:
resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
engines: {node: '>=0.10.0'}
[email protected]:
resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==}
engines: {node: '>=14'}
hasBin: true
[email protected]:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'}
[email protected]:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
[email protected]:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'}
[email protected]:
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
engines: {node: '>=0.6.0'}
[email protected]:
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==}
engines: {node: '>=14.17'}
hasBin: true
[email protected]:
resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
[email protected]:
resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
[email protected]:
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
[email protected]:
resolution: {integrity: sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==}
engines: {node: '>=18'}
snapshots:
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/figures': 1.0.9
'@inquirer/type': 1.5.5
ansi-escapes: 4.3.2
yoctocolors-cjs: 2.1.2
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/type': 1.5.5
'@inquirer/[email protected]':
dependencies:
'@inquirer/figures': 1.0.9
'@inquirer/type': 2.0.0
'@types/mute-stream': 0.0.4
'@types/node': 22.12.0
'@types/wrap-ansi': 3.0.0
ansi-escapes: 4.3.2
cli-width: 4.1.0
mute-stream: 1.0.0
signal-exit: 4.1.0
strip-ansi: 6.0.1
wrap-ansi: 6.2.0
yoctocolors-cjs: 2.1.2
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/type': 1.5.5
external-editor: 3.1.0
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/type': 1.5.5
yoctocolors-cjs: 2.1.2
'@inquirer/[email protected]': {}
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/type': 1.5.5
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/type': 1.5.5
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/type': 1.5.5
ansi-escapes: 4.3.2
'@inquirer/[email protected]':
dependencies:
'@inquirer/checkbox': 2.5.0
'@inquirer/confirm': 3.2.0
'@inquirer/editor': 2.2.0
'@inquirer/expand': 2.3.0
'@inquirer/input': 2.3.0
'@inquirer/number': 1.1.0
'@inquirer/password': 2.2.0
'@inquirer/rawlist': 2.3.0
'@inquirer/search': 1.1.0
'@inquirer/select': 2.5.0
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/type': 1.5.5
yoctocolors-cjs: 2.1.2
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/figures': 1.0.9
'@inquirer/type': 1.5.5
yoctocolors-cjs: 2.1.2
'@inquirer/[email protected]':
dependencies:
'@inquirer/core': 9.2.1
'@inquirer/figures': 1.0.9
'@inquirer/type': 1.5.5
ansi-escapes: 4.3.2
yoctocolors-cjs: 2.1.2
'@inquirer/[email protected]':
dependencies:
mute-stream: 1.0.0
'@inquirer/[email protected]':
dependencies:
mute-stream: 1.0.0
'@types/[email protected]':
dependencies:
'@types/node': 22.12.0
'@types/[email protected]':
dependencies:
undici-types: 6.20.0
'@types/[email protected]': {}
'@types/[email protected]': {}
'@types/[email protected]':
dependencies:
'@types/yargs-parser': 21.0.3
[email protected]:
dependencies:
type-fest: 0.21.3
[email protected]: {}
[email protected]:
dependencies:
color-convert: 2.0.1
[email protected]:
dependencies:
ansi-styles: 4.3.0
supports-color: 7.2.0
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
string-width: 4.2.3
strip-ansi: 6.0.1
wrap-ansi: 7.0.0
[email protected]:
dependencies:
color-name: 1.1.4
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
chardet: 0.7.0
iconv-lite: 0.4.24
tmp: 0.0.33
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
safer-buffer: 2.1.2
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
emoji-regex: 8.0.0
is-fullwidth-code-point: 3.0.0
strip-ansi: 6.0.1
[email protected]:
dependencies:
ansi-regex: 5.0.1
[email protected]:
dependencies:
has-flag: 4.0.0
[email protected]:
dependencies:
os-tmpdir: 1.0.2
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
ansi-styles: 4.3.0
string-width: 4.2.3
strip-ansi: 6.0.1
[email protected]:
dependencies:
ansi-styles: 4.3.0
string-width: 4.2.3
strip-ansi: 6.0.1
[email protected]: {}
[email protected]: {}
[email protected]:
dependencies:
cliui: 8.0.1
escalade: 3.2.0
get-caller-file: 2.0.5
require-directory: 2.1.1
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 21.1.1
[email protected]: {}
+20 -13
View File
@@ -3,9 +3,22 @@ import { input, select } from '@inquirer/prompts'
import path from 'node:path' import path from 'node:path'
import { cloneBranch } from '../utils/cloner' import { cloneBranch } from '../utils/cloner'
const choices = {
'react-18': {
name: 'React 18',
value: 'react-18',
description: 'React 18 + TypeScript (Vite) as a front-end',
},
'svelte-5': {
name: 'Svelte 5',
value: 'svelte-5',
description: 'Svelte 5 + TypeScript (Vite) as a front-end',
},
} as const
export async function initProject() { export async function initProject() {
let folder let folder: string | undefined
let framework let framework: keyof typeof choices | undefined
if (!folder) { if (!folder) {
folder = await input({ folder = await input({
@@ -21,23 +34,17 @@ export async function initProject() {
message: c.gray('Select front-end:'), message: c.gray('Select front-end:'),
default: 'react-18', default: 'react-18',
loop: true, loop: true,
choices: [ choices: Object.values(choices),
{
name: 'React 18',
value: 'react-18',
description: 'React 18 + TypeScript (Vite) as a front-end',
},
],
}) })
} else { } else {
console.log(c.gray('Front-end:'), framework) console.log(c.gray('Front-end:'), choices[framework].name)
} }
console.log( console.log(
c.gray('\nScaffolding template project into'), c.gray('\nScaffolding template project into'),
folder, folder,
c.gray('with'), c.gray('with'),
framework, choices[framework].name,
c.gray('as a front-end..'), c.gray('as a front-end..'),
) )
@@ -50,12 +57,12 @@ export async function initProject() {
console.log(c.gray('Scaffolded project into'), folder) console.log(c.gray('Scaffolded project into'), folder)
console.log( console.log(
c.gray( c.gray(
`Project was created ar dir: ${path.join(process.cwd(), folder)}`, `Project was created in: ${path.join(process.cwd(), folder)}`,
), ),
) )
}) })
.catch(e => { .catch(e => {
console.log(c.red('Error occured: \n', e)) console.log(c.red('Error occurred: \n', e))
console.log(c.red('Please open an issue if you see this')) console.log(c.red('Please open an issue if you see this'))
}) })
} }
+5 -5
View File
@@ -17,8 +17,8 @@ const choices = {
} as const } as const
export async function testRpc() { export async function testRpc() {
let folder let folder: string | undefined
let framework let framework: keyof typeof choices | undefined
if (!folder) { if (!folder) {
folder = await input({ folder = await input({
@@ -37,7 +37,7 @@ export async function testRpc() {
choices: Object.values(choices), choices: Object.values(choices),
}) })
} else { } else {
console.log(c.gray('Front-end:'), framework) console.log(c.gray('Front-end:'), choices[framework].name)
} }
console.log( console.log(
@@ -45,7 +45,7 @@ export async function testRpc() {
folder, folder,
c.gray('with'), c.gray('with'),
choices[framework].name, choices[framework].name,
c.gray('as a frontend..'), c.gray('as a frontend'),
) )
cloneBranch( cloneBranch(
@@ -62,7 +62,7 @@ export async function testRpc() {
) )
}) })
.catch(e => { .catch(e => {
console.log(c.red('Error occured: \n', e)) console.log(c.red('Error occurred: \n', e))
console.log(c.red('Please open an issue if you see this')) console.log(c.red('Please open an issue if you see this'))
}) })
} }
+2 -2
View File
@@ -1,9 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "esnext",
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"lib": ["DOM", "ES6"], "lib": ["DOM", "esnext"],
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": true,
+1 -1
View File
@@ -1,4 +1,4 @@
Custom Attribution-NoDerivs Software License Custom Attribution-NoDerives Software License
Copyright (c) 2024 Entity Seven Group Copyright (c) 2024 Entity Seven Group
+58 -34
View File
@@ -1,38 +1,62 @@
{ {
"name": "@entityseven/rage-fw-client", "private": false,
"version": "0.2.0", "name": "@entityseven/rage-fw-client",
"version": "0.2.0",
"files": [
"dist/**/*",
"readme.md",
"LICENSE",
"package.json"
],
"main": "src/index.ts",
"exports": {
".": "./src/index.ts"
},
"publishConfig": {
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/src/index.d.ts", "types": "dist/index.d.ts",
"files": [ "exports": {
"dist/**/*", ".": "./dist/index.js"
"readme.md", }
"LICENSE" },
], "scripts": {
"scripts": { "build": "tsup"
"build": "tsup" },
"dependencies": {
"@entityseven/rage-fw-rpc": "workspace:*",
"zod": "^3.24.1"
},
"devDependencies": {
"@types/node": "22.12.0"
},
"peerDependencies": {
"@entityseven/rage-fw-shared-types": "workspace:*",
"@ragempcommunity/types-client": "^2.1.8",
"typescript": "^5.7.3"
},
"description": "Package used on a client-side of your Rage:MP Server",
"keywords": [
"rage-fw-client",
"ragefw",
"rage-fw",
"ragemp",
"rage:mp",
"rage",
"gta5"
],
"author": "Entity Seven Group",
"contributors": [
{
"name": "Danya H",
"email": "[email protected]",
"url": "https://github.com/rilaxik/"
}, },
"dependencies": { {
"@entityseven/rage-fw-rpc": "0.2.5" "name": "Oleksandr Honcharov",
}, "email": "[email protected]",
"peerDependencies": { "url": "https://github.com/SashaGoncharov19/"
"@entityseven/rage-fw-shared-types": "0.2.0", }
"@ragempcommunity/types-client": "^2.1.8" ],
}, "license": "Custom-Attribution-NoDerivs",
"description": "Package used on a client-side of your Rage:MP Server", "gitHead": "ffd542c1deddb3033e16e0dae7557313ae09b05f"
"keywords": ["rage-fw-client", "ragefw", "rage-fw", "ragemp", "rage:mp", "rage", "gta5"],
"author": "Entity Seven Group",
"contributors": [
{
"name": "Danya H",
"email": "[email protected]",
"url": "https://github.com/rilaxik/"
},
{
"name": "Oleksandr Honcharov",
"email": "[email protected]",
"url": "https://github.com/SashaGoncharov19/"
}
],
"license": "Custom-Attribution-NoDerivs",
"gitHead": "ffd542c1deddb3033e16e0dae7557313ae09b05f"
} }
+4 -21
View File
@@ -1,25 +1,8 @@
{ {
"$schema": "https://json.schemastore.org/tsconfig", "$schema": "https://json.schemastore.org/tsconfig",
"display": "Base", "display": "Client",
"exclude": [
"node_modules"
],
"compilerOptions": { "compilerOptions": {
"incremental": false, "types": ["./node_modules/@ragempcommunity/types-client/index.d.ts"]
"composite": false, },
"target": "ES2022", "extends": ["../tsconfig.ragefw.json"]
"experimentalDecorators": true,
"moduleDetection": "auto",
"module": "CommonJS",
"resolveJsonModule": true,
"declaration": false,
"declarationMap": false,
"sourceMap": false,
"downlevelIteration": false,
"inlineSourceMap": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
} }
+2 -2
View File
@@ -1,12 +1,12 @@
import { defineConfig } from 'tsup' import { defineConfig } from 'tsup'
export default defineConfig({ export default defineConfig({
entry: ['src/index.ts'], entry: ['src/**/*.ts'],
outDir: './dist', outDir: './dist',
format: ['cjs'], format: ['cjs'],
noExternal: ['rage-rpc'],
experimentalDts: true, experimentalDts: true,
splitting: false, splitting: false,
bundle: false,
sourcemap: false, sourcemap: false,
clean: true, clean: true,
}) })
+57
View File
@@ -0,0 +1,57 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import type { Linter } from 'eslint'
export default [
{
ignores: ['**/.*/*', '**/dist/*', '**/node_modules/*', '*.config.*'],
},
pluginJs.configs.recommended,
...(tseslint.configs.recommended as Linter.Config[]),
{
name: 'global',
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'consistent-return': 'off',
'no-empty': 'off',
},
},
{
name: 'browser/rpc',
files: ['browser/src/*.{ts,js}', 'rpc/src/*.{ts,js}'],
languageOptions: {
globals: { ...globals.browser, ...globals.node, ...globals.es2022 },
},
},
{
name: 'cli',
files: ['cli/src/*.{ts,js}'],
languageOptions: {
globals: { ...globals.node, ...globals.es2024 },
ecmaVersion: 2024,
},
},
{
name: 'client/server/shared',
files: [
'client/**/*.{ts,js}',
'server/**/*.{ts,js}',
'shared/**/*.{ts,js}',
],
languageOptions: {
globals: { ...globals.node, ...globals.es2022 },
},
},
] satisfies Linter.Config[]
-5
View File
@@ -1,5 +0,0 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.2.1-0.2.0-alpha.2.0",
"npmClient": "pnpm"
}
+40 -20
View File
@@ -1,29 +1,46 @@
{ {
"workspaces": [
"*",
"!cli"
],
"scripts": { "scripts": {
"publish": "lerna publish --force-publish", "lint": "eslint . --config eslint.config.ts",
"build": "lerna run build", "_____build": "echo build",
"lint": "eslint --c .eslintrc.yaml --ext .ts client/ server/ shared-types/", "build:browser": "cd browser && pnpm build",
"build:client": "cd client && pnpm build",
"rebuild:browser": "cd browser && pnpm build", "build:server": "cd server && pnpm build",
"rebuild:client": "cd client && pnpm build", "build:rpc": "cd rpc && pnpm build",
"rebuild:server": "cd server && pnpm build", "build": "pnpm build:browser && pnpm build:client && pnpm build:server && pnpm build:rpc",
"rebuild": "pnpm rebuild:browser && pnpm rebuild:client && pnpm rebuild:server" "_____deps": "echo must be ran before lerna commands",
"deps:check": "syncpack list-mismatches",
"deps:fix": "syncpack fix-mismatches",
"_____publish": "echo publish",
"publish:check": "pnpm run deps:check && pnpm run lint",
"publish:changeset": "pnpm changeset add",
"publish:version": "pnpm changeset version"
}, },
"dependencies": { "dependencies": {
"@microsoft/api-extractor": "^7.47.0", "@changesets/cli": "^2.27.12",
"@eslint/js": "^9.19.0",
"@microsoft/api-extractor": "^7.49.1",
"@ragempcommunity/types-cef": "^2.1.8", "@ragempcommunity/types-cef": "^2.1.8",
"@ragempcommunity/types-client": "^2.1.8", "@ragempcommunity/types-client": "^2.1.8",
"@ragempcommunity/types-server": "^2.1.8", "@ragempcommunity/types-server": "^2.1.8",
"@typescript-eslint/eslint-plugin": "^7.13.0", "eslint": "^9.19.0",
"@typescript-eslint/parser": "^7.13.0", "globals": "^15.14.0",
"@types/node": "^22.8.1", "jiti": "^2.4.2",
"eslint": "^8.56.0", "prettier": "^3.4.2",
"lerna": "^8.1.3", "tsup": "^8.3.6",
"prettier": "^3.3.1", "typescript": "^5.7.3",
"rage-rpc": "^0.4.0", "typescript-eslint": "^8.22.0",
"tsup": "^8.1.0", "winston": "^3.17.0"
"typescript": "^5.4.5", },
"winston": "^3.13.0" "engines": {
"node": ">=14",
"pnpm": ">=10"
},
"pnpm": {
"requiredScripts": []
}, },
"private": true, "private": true,
"type": "module", "type": "module",
@@ -40,5 +57,8 @@
"email": "[email protected]", "email": "[email protected]",
"url": "https://github.com/SashaGoncharov19/" "url": "https://github.com/SashaGoncharov19/"
} }
] ],
"devDependencies": {
"syncpack": "^13.0.0"
}
} }
+3291 -8538
View File
File diff suppressed because it is too large Load Diff
+2 -4
View File
@@ -1,5 +1,3 @@
packages: packages:
- "server" - "*"
- "client" - "!cli"
- "browser"
- "shared-types"
+3 -4
View File
@@ -1,4 +1,5 @@
{ {
"private": false,
"name": "@entityseven/rage-fw-rpc", "name": "@entityseven/rage-fw-rpc",
"version": "0.2.5", "version": "0.2.5",
"main": "dist/index.js", "main": "dist/index.js",
@@ -13,12 +14,10 @@
"LICENSE" "LICENSE"
], ],
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "^7.47.9", "@types/node": "22.12.0"
"prettier": "^3.3.2",
"tsup": "^8.3.0"
}, },
"peerDependencies": { "peerDependencies": {
"typescript": "^5" "typescript": "^5.7.3"
}, },
"description": "Rage-FW RPC (Remote procedure caller) for Rage:MP", "description": "Rage-FW RPC (Remote procedure caller) for Rage:MP",
"keywords": [ "keywords": [
+1 -1
View File
@@ -24,7 +24,7 @@ export class Browser extends Wrapper {
* NOT INTENDED FOR OUT-OF-CONTEXT USE * NOT INTENDED FOR OUT-OF-CONTEXT USE
*/ */
public _resolveEmitDestination(dataRaw: string) { public _resolveEmitDestination(dataRaw: string) {
let state = Utils.prepareExecution(dataRaw) const state = Utils.prepareExecution(dataRaw)
switch (state.calledTo) { switch (state.calledTo) {
case Environment.BROWSER: case Environment.BROWSER:
+53 -53
View File
@@ -91,7 +91,7 @@ class Rpc extends Wrapper {
*/ */
public register< public register<
CallbackArguments extends unknown[] = unknown[], CallbackArguments extends unknown[] = unknown[],
CallbackReturn extends unknown = unknown, CallbackReturn = unknown,
EventName extends string = string, EventName extends string = string,
>( >(
eventName: EventName, eventName: EventName,
@@ -155,7 +155,7 @@ class Rpc extends Wrapper {
public async callClient< public async callClient<
Arguments extends unknown[] = unknown[], Arguments extends unknown[] = unknown[],
EventName extends string = string, EventName extends string = string,
Return extends unknown = unknown, Return = unknown,
>(eventName: EventName, args?: Arguments): Promise<Return> >(eventName: EventName, args?: Arguments): Promise<Return>
/** /**
* Calls a client-side event from server or browser * Calls a client-side event from server or browser
@@ -178,37 +178,28 @@ class Rpc extends Wrapper {
public async callClient< public async callClient<
Arguments extends unknown[] = unknown[], Arguments extends unknown[] = unknown[],
EventName extends string = string, EventName extends string = string,
Return extends unknown = unknown, Return = unknown,
>(player: PlayerMp, eventName: EventName, args?: Arguments): Promise<Return> >(player: PlayerMp, eventName: EventName, args?: Arguments): Promise<Return>
public async callClient( public async callClient(
playerOrEventName: PlayerMp | string, playerOrEventName: PlayerMp | string,
eventNameOrArgs?: string | unknown[], eventNameOrArgs?: string | unknown[],
args?: unknown[], args?: unknown[],
) { ) {
_is1StParamPlayer(playerOrEventName) if (_is1StParamPlayer(playerOrEventName)) {
? this.log( this.log(
'callClient', 'callClient',
eventNameOrArgs as string, eventNameOrArgs as string,
playerOrEventName, playerOrEventName,
eventNameOrArgs, eventNameOrArgs,
args, args,
) )
: this.log( } else {
'callClient', this.log('callClient', playerOrEventName as string, eventNameOrArgs)
playerOrEventName as string, }
eventNameOrArgs,
)
if (this.forceBrowserDevMode_) return if (this.forceBrowserDevMode_) return
Utils.errorUnknownEnvironment(this.environment_) Utils.errorUnknownEnvironment(this.environment_)
function _is1StParamPlayer(x: unknown): x is PlayerMp {
return typeof x === 'object'
}
function _is2NdParamEventName(x: unknown): x is string {
return typeof x === 'string'
}
if (this.environment_ === Environment.CLIENT) { if (this.environment_ === Environment.CLIENT) {
// client // client
return await this.call( return await this.call(
@@ -260,6 +251,14 @@ class Rpc extends Wrapper {
mp.trigger(Events.LOCAL_EVENT_LISTENER, dataRaw) mp.trigger(Events.LOCAL_EVENT_LISTENER, dataRaw)
return (await this.responseHandler(state.uuid)).data return (await this.responseHandler(state.uuid)).data
} }
function _is1StParamPlayer(x: unknown): x is PlayerMp {
return typeof x === 'object'
}
function _is2NdParamEventName(x: unknown): x is string {
return typeof x === 'string'
}
} }
/** /**
@@ -282,7 +281,7 @@ class Rpc extends Wrapper {
public async callServer< public async callServer<
Arguments extends unknown[] = unknown[], Arguments extends unknown[] = unknown[],
EventName extends string = string, EventName extends string = string,
Return extends unknown = unknown, Return = unknown,
>(eventName: EventName, args?: Arguments): Promise<Return> { >(eventName: EventName, args?: Arguments): Promise<Return> {
this.log('callServer', eventName, args) this.log('callServer', eventName, args)
if (this.forceBrowserDevMode_) if (this.forceBrowserDevMode_)
@@ -337,7 +336,7 @@ class Rpc extends Wrapper {
public async callBrowser< public async callBrowser<
Arguments extends unknown[] = unknown[], Arguments extends unknown[] = unknown[],
EventName extends string = string, EventName extends string = string,
Return extends unknown = unknown, Return = unknown,
>(eventName: EventName, args?: Arguments): Promise<Return> >(eventName: EventName, args?: Arguments): Promise<Return>
/** /**
* Calls a browser-side event from server or client * Calls a browser-side event from server or client
@@ -360,37 +359,32 @@ class Rpc extends Wrapper {
public async callBrowser< public async callBrowser<
Arguments extends unknown[] = unknown[], Arguments extends unknown[] = unknown[],
EventName extends string = string, EventName extends string = string,
Return extends unknown = unknown, Return = unknown,
>(player: PlayerMp, eventName: EventName, args?: Arguments): Promise<Return> >(player: PlayerMp, eventName: EventName, args?: Arguments): Promise<Return>
public async callBrowser( public async callBrowser(
playerOrEventName: PlayerMp | string, playerOrEventName: PlayerMp | string,
eventNameOrArgs?: string | unknown[], eventNameOrArgs?: string | unknown[],
args?: unknown[], args?: unknown[],
) { ) {
_is1StParamPlayer(playerOrEventName) if (_is1StParamPlayer(playerOrEventName)) {
? this.log( this.log(
'DEV callClient', 'DEV callClient',
eventNameOrArgs as string, eventNameOrArgs as string,
playerOrEventName, playerOrEventName,
eventNameOrArgs, eventNameOrArgs,
args, args,
) )
: this.log( } else {
'DEV callClient', this.log(
playerOrEventName as string, 'DEV callClient',
eventNameOrArgs, playerOrEventName as string,
) eventNameOrArgs,
)
}
if (this.forceBrowserDevMode_) return if (this.forceBrowserDevMode_) return
Utils.errorUnknownEnvironment(this.environment_) Utils.errorUnknownEnvironment(this.environment_)
function _is1StParamPlayer(x: unknown): x is PlayerMp {
return typeof x === 'object'
}
function _is2NdParamEventName(x: unknown): x is string {
return typeof x === 'string'
}
const state: RPCState = { const state: RPCState = {
uuid: Utils.generateUUID(), uuid: Utils.generateUUID(),
eventName: !_is1StParamPlayer(playerOrEventName) eventName: !_is1StParamPlayer(playerOrEventName)
@@ -424,6 +418,14 @@ class Rpc extends Wrapper {
} }
return (await this.responseHandler(state.uuid)).data return (await this.responseHandler(state.uuid)).data
function _is1StParamPlayer(x: unknown): x is PlayerMp {
return typeof x === 'object'
}
function _is2NdParamEventName(x: unknown): x is string {
return typeof x === 'string'
}
} }
/** /**
@@ -446,14 +448,14 @@ class Rpc extends Wrapper {
public async call< public async call<
Arguments extends unknown[] = unknown[], Arguments extends unknown[] = unknown[],
EventName extends string = string, EventName extends string = string,
Return extends unknown = unknown, Return = unknown,
>(eventName: EventName, args?: Arguments): Promise<Return> { >(eventName: EventName, args?: Arguments): Promise<Return> {
this.log('call', eventName, args) this.log('call', eventName, args)
if (this.forceBrowserDevMode_) if (this.forceBrowserDevMode_)
return undefined as unknown as Promise<Return> return undefined as unknown as Promise<Return>
Utils.errorUnknownEnvironment(this.environment_) Utils.errorUnknownEnvironment(this.environment_)
let state: RPCState = { const state: RPCState = {
uuid: Utils.generateUUID(), uuid: Utils.generateUUID(),
eventName, eventName,
calledTo: this.environment_, calledTo: this.environment_,
@@ -469,9 +471,7 @@ class Rpc extends Wrapper {
/** /**
* redirects an event in cases of it calling its own environment * redirects an event in cases of it calling its own environment
*/ */
private async callSelf<Return extends unknown = unknown>( private async callSelf<Return = unknown>(state: RPCState): Promise<Return> {
state: RPCState,
): Promise<Return> {
state = this.verifyEvent_(state) state = this.verifyEvent_(state)
if (state.knownError) { if (state.knownError) {
this.triggerError_(state, state.knownError) this.triggerError_(state, state.knownError)
+3 -3
View File
@@ -1,8 +1,8 @@
import { Wrapper } from './wrapper' import { Wrapper } from './wrapper'
import { import {
type PlayerMp,
Environment, Environment,
Events, Events,
type PlayerMp,
RPCEventType, RPCEventType,
RPCState, RPCState,
RpcWrapperConfig, RpcWrapperConfig,
@@ -20,7 +20,7 @@ export class Server extends Wrapper {
) { ) {
super(options) super(options)
if (!!options.forceBrowserDevMode) return if (options.forceBrowserDevMode) return
// specific event to save player in context as it is not available on server -> server calls // specific event to save player in context as it is not available on server -> server calls
mp.events.add( mp.events.add(
@@ -35,7 +35,7 @@ export class Server extends Wrapper {
* NOT INTENDED FOR OUT-OF-CONTEXT USE * NOT INTENDED FOR OUT-OF-CONTEXT USE
*/ */
public _resolveEmitDestination(player: PlayerMp, dataRaw: string) { public _resolveEmitDestination(player: PlayerMp, dataRaw: string) {
let state = Utils.prepareExecution(dataRaw) const state = Utils.prepareExecution(dataRaw)
switch (state.calledTo) { switch (state.calledTo) {
case Environment.SERVER: case Environment.SERVER:
+1 -1
View File
@@ -29,7 +29,7 @@ export class Wrapper {
// checks if event is available (registered) in current environment // checks if event is available (registered) in current environment
protected verifyEvent_(data: string | RPCState): RPCState { protected verifyEvent_(data: string | RPCState): RPCState {
let rpcData = const rpcData =
typeof data === 'string' ? Utils.prepareExecution(data) : data typeof data === 'string' ? Utils.prepareExecution(data) : data
if (!this.state_[rpcData.eventName]) { if (!this.state_[rpcData.eventName]) {
+4 -15
View File
@@ -1,29 +1,18 @@
{ {
"$schema": "https://json.schemastore.org/tsconfig",
"display": "RPC",
"compilerOptions": { "compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"lib": [ "lib": [
"ES6", "es2022",
"dom" "dom"
], ],
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": true,
"outDir": "bin",
"esModuleInterop": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
}, },
"include": [ "include": [
"src/**/*",
"./index.d.ts" "./index.d.ts"
], ],
"exclude": [ "extends": ["../tsconfig.ragefw.json"]
"node_modules",
"dist"
]
} }
+1 -1
View File
@@ -1,4 +1,4 @@
Custom Attribution-NoDerivs Software License Custom Attribution-NoDerives Software License
Copyright (c) 2024 Entity Seven Group Copyright (c) 2024 Entity Seven Group
+58 -34
View File
@@ -1,38 +1,62 @@
{ {
"name": "@entityseven/rage-fw-server", "private": false,
"version": "0.2.0", "name": "@entityseven/rage-fw-server",
"version": "0.2.0",
"files": [
"dist/**/*",
"readme.md",
"LICENSE",
"package.json"
],
"main": "src/index.ts",
"exports": {
".": "./src/index.ts"
},
"publishConfig": {
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/src/index.d.ts", "types": "dist/index.d.ts",
"files": [ "exports": {
"dist/**/*", ".": "./dist/index.js"
"readme.md", }
"LICENSE" },
], "scripts": {
"scripts": { "build": "tsup"
"build": "tsup" },
"dependencies": {
"@entityseven/rage-fw-rpc": "workspace:*",
"zod": "^3.24.1"
},
"devDependencies": {
"@types/node": "22.12.0"
},
"peerDependencies": {
"@entityseven/rage-fw-shared-types": "workspace:*",
"@ragempcommunity/types-server": "^2.1.8",
"typescript": "^5.7.3"
},
"description": "Package used on a server-side of your Rage:MP Server",
"keywords": [
"rage-fw-server",
"ragefw",
"rage-fw",
"ragemp",
"rage:mp",
"rage",
"gta5"
],
"author": "Entity Seven Group",
"contributors": [
{
"name": "Danya H",
"email": "[email protected]",
"url": "https://github.com/rilaxik/"
}, },
"dependencies": { {
"@entityseven/rage-fw-rpc": "0.2.5" "name": "Oleksandr Honcharov",
}, "email": "[email protected]",
"peerDependencies": { "url": "https://github.com/SashaGoncharov19/"
"@entityseven/rage-fw-shared-types": "0.2.0", }
"@ragempcommunity/types-server": "^2.1.8" ],
}, "license": "Custom-Attribution-NoDerivs",
"description": "Package used on a server-side of your Rage:MP Server", "gitHead": "ffd542c1deddb3033e16e0dae7557313ae09b05f"
"keywords": ["rage-fw-server", "ragefw", "rage-fw", "ragemp", "rage:mp", "rage", "gta5"],
"author": "Entity Seven Group",
"contributors": [
{
"name": "Danya H",
"email": "[email protected]",
"url": "https://github.com/rilaxik/"
},
{
"name": "Oleksandr Honcharov",
"email": "[email protected]",
"url": "https://github.com/SashaGoncharov19/"
}
],
"license": "Custom-Attribution-NoDerivs",
"gitHead": "ffd542c1deddb3033e16e0dae7557313ae09b05f"
} }
+2 -2
View File
@@ -4,8 +4,8 @@ const { timestamp, printf, colorize } = format
/** Used to log in a server console */ /** Used to log in a server console */
export class Logger { export class Logger {
private format = printf(({ message, level, timestamp }) => { private format = printf(({ message, level }) => {
return `[${new Date(timestamp).toLocaleTimeString()}] [${level}]: ${message}` return `[${new Date().toLocaleTimeString()}] [${level}]: ${message}`
}) })
private systemLogger = winston.createLogger({ private systemLogger = winston.createLogger({
+4 -21
View File
@@ -1,25 +1,8 @@
{ {
"$schema": "https://json.schemastore.org/tsconfig", "$schema": "https://json.schemastore.org/tsconfig",
"display": "Base", "display": "Server",
"exclude": [
"node_modules"
],
"compilerOptions": { "compilerOptions": {
"incremental": false, "types": ["./node_modules/@ragempcommunity/types-server/index.d.ts"]
"composite": false, },
"target": "ES2022", "extends": ["../tsconfig.ragefw.json"]
"experimentalDecorators": true,
"moduleDetection": "auto",
"module": "CommonJS",
"resolveJsonModule": true,
"declaration": true,
"declarationMap": false,
"sourceMap": false,
"downlevelIteration": false,
"inlineSourceMap": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
}
} }
+2 -2
View File
@@ -1,12 +1,12 @@
import { defineConfig } from 'tsup' import { defineConfig } from 'tsup'
export default defineConfig({ export default defineConfig({
entry: ['src/index.ts'], entry: ['src/**/*.ts'],
outDir: './dist', outDir: './dist',
format: ['cjs'], format: ['cjs'],
noExternal: ['rage-rpc'],
experimentalDts: true, experimentalDts: true,
splitting: false, splitting: false,
bundle: false,
sourcemap: false, sourcemap: false,
clean: true, clean: true,
}) })
+1 -1
View File
@@ -1,4 +1,4 @@
# Custom Attribution-NoDerivs Software License # Custom Attribution-NoDerives Software License
This license allows you to use, copy, and distribute the RageFW (the "Software"), including for commercial purposes, provided that the following conditions are met: This license allows you to use, copy, and distribute the RageFW (the "Software"), including for commercial purposes, provided that the following conditions are met:
+7 -5
View File
@@ -1,12 +1,14 @@
{ {
"name": "@entityseven/rage-fw-shared-types", "private": false,
"version": "0.2.0",
"types": "types/types/index.d.ts",
"files": [ "files": [
"types/**/*", "types/**/*",
"readme.md", "readme.md",
"LICENSE" "LICENSE",
"package.json"
], ],
"types": "types/types/index.d.ts",
"name": "@entityseven/rage-fw-shared-types",
"version": "0.2.0",
"description": "Package used among all environments of your Rage-FW based server", "description": "Package used among all environments of your Rage-FW based server",
"keywords": ["rage-fw-shared-types", "rage-fw-shared","ragefw", "rage-fw", "ragemp", "rage:mp", "rage", "gta5"], "keywords": ["rage-fw-shared-types", "rage-fw-shared","ragefw", "rage-fw", "ragemp", "rage:mp", "rage", "gta5"],
"type": "module", "type": "module",
@@ -23,6 +25,6 @@
"url": "https://github.com/SashaGoncharov19/" "url": "https://github.com/SashaGoncharov19/"
} }
], ],
"license": "Custom-Attribution-NoDerivs", "license": "Custom-Attribution-NoDerives",
"gitHead": "ffd542c1deddb3033e16e0dae7557313ae09b05f" "gitHead": "ffd542c1deddb3033e16e0dae7557313ae09b05f"
} }
+2 -2
View File
@@ -1,9 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "target": "es2022",
"lib": [ "lib": [
"ESNext", "ESNext",
"ES2019", "es2022",
"dom" "dom"
], ],
"moduleResolution": "node", "moduleResolution": "node",
+29
View File
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"incremental": false,
"composite": false,
"target": "es2022",
"moduleDetection": "auto",
"module": "commonjs",
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"declaration": false,
"declarationMap": false,
"downlevelIteration": false,
"inlineSourceMap": false,
"sourceMap": false
},
"exclude": [
"node_modules",
"dist",
".tsup"
]
}