Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2ba6cae
Adde .gitignore
arfadinov Oct 27, 2025
740d079
Change development to bun environment
arfadinov Oct 27, 2025
652a675
Change source to typescript
arfadinov Oct 27, 2025
4121636
Added dist to the list
arfadinov Oct 28, 2025
762b77c
Added tools for dev dependencies
arfadinov Oct 28, 2025
c773936
Added tools for dev dependencies and exports for esm and commonjs
arfadinov Oct 28, 2025
3993151
refactor(idk)
arfadinov Oct 28, 2025
7327f3d
tsconfig for types
arfadinov Oct 28, 2025
b0b788a
Using bun's bundler to build scripts
arfadinov Oct 28, 2025
ca61607
Changed docgen to ts
arfadinov Oct 28, 2025
2bd545a
Replaced to another dir
arfadinov Oct 28, 2025
7fa3998
Removed in favor of index.ts
arfadinov Oct 28, 2025
6c18b2e
Renaming extensions to ts
arfadinov Oct 28, 2025
237dbff
refactor(idk)
arfadinov Oct 28, 2025
30bef23
currently build with bun env
arfadinov Oct 28, 2025
174085f
refactor(): I hate this config file
arfadinov Oct 28, 2025
86f7a12
Removed cjs bundling in favor of typescript for cleaner dist
arfadinov Oct 28, 2025
4fd2d81
Rechecks
arfadinov Oct 28, 2025
1719f13
Changed default module to cjs
arfadinov Oct 28, 2025
b6659e6
refactor(): again
arfadinov Oct 28, 2025
3f46076
Changed the directory for directive purpose
arfadinov Oct 28, 2025
ef501ee
new(): tis a roadmap :D
arfadinov Oct 28, 2025
7160576
modify(): added .env to the list
arfadinov Oct 28, 2025
ba2e08f
modify():
arfadinov Oct 28, 2025
270510d
new(): commonjs test module
arfadinov Oct 28, 2025
c5c0f8a
modify(): added commentas
arfadinov Oct 28, 2025
1fc37e6
generate metadata
arfadinov Oct 29, 2025
fa31751
gitignore
arfadinov Oct 29, 2025
d84967f
Added zod for polyfill
arfadinov Oct 29, 2025
727d171
refactor()
arfadinov Oct 29, 2025
80e3684
refactor()
arfadinov Oct 30, 2025
cb13abf
refactor()
arfadinov Oct 30, 2025
3cd0b25
build()
arfadinov Oct 30, 2025
fd641e0
refactor()
arfadinov Oct 30, 2025
8cbbe11
i signed the wrong account
Kino7916 Oct 30, 2025
b46cbb2
remove test file
Kino7916 Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.env
.proto
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# QuorielEdge
An extended set of functions for ForgeScript, designed to optimize workflows, simplify the execution of various tasks, and support script integration and processing.
A super-set of ForgeScript, designed to optimize workflows, apply community patches, simplify the execution of various tasks, and support script integration and processing.



## Installation
```
npm i github:quoriel/edge
```bash
# Install using your package managers

# Using NPM
npm install github:quoriel/edge

# or using 3rd package managers
yarn install github:quoriel/edge
pnpm install github:quoriel/edge
bun install github:quoriel/edge
```

## Connection
Expand All @@ -18,4 +28,21 @@ const client = new ForgeClient({
});

client.login("...");
```

## Building from source
You can clone this repository to your project workspace
> The code were build with bun's transpiler (ESM) and TypeScript (CJS)

```bash
# Run the following commands
# Using Bun
bun run build

# or using NodeJS v23
# Make sure to install bun if you're using nodejs
# npm install --save-dev bun

node --experimental-strip-types scripts/build.ts

```
7 changes: 7 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Roadmap
This is an extension focused as a super-set for forgescript and potentially optimizing the internal interpeter's workflow for better time execution

## Core Features
- [] Better approach for function implementation
- [] Bytecode
- [] Serverless execution
106 changes: 106 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion metadata/functions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"$execution","description":"Executes code exported as a string from the specified file","version":"1.0.0","output":["Unknown"],"brackets":true,"unwrap":true,"args":[{"name":"path","description":"File path","type":"String","required":true,"rest":false}]},{"name":"$jsonAssign","description":"Combines multiple JSON objects into a single JSON object","version":"1.0.0","output":["Json"],"brackets":true,"unwrap":true,"args":[{"name":"json","description":"JSON objects for merging","type":"Json","required":true,"rest":true}]},{"name":"$require","description":"Dynamically loads the module","version":"1.0.0","output":["Unknown"],"brackets":true,"unwrap":true,"args":[{"name":"path","description":"Module path","type":"String","required":true,"rest":false}]},{"name":"$requireCache","description":"Deletes a module from the cache or reloads it (including dependencies)","version":"1.0.0","output":["Boolean"],"brackets":true,"unwrap":true,"args":[{"name":"path","description":"Module path","type":"String","required":true,"rest":false},{"name":"type","description":"Type of action","type":"Enum","enum":["delete","update"],"required":true,"rest":false,"enumName":"ActionType"},{"name":"recursive","description":"Whether to clear cache recursively","type":"Boolean","rest":false}]}]
[{"name":"$execution","description":"Executes code exported as a string from the specified file","version":"1.0.0","output":["Unknown"],"brackets":true,"unwrap":true,"args":[{"name":"path","description":"File path","type":"String","required":true,"rest":false}]},{"name":"$jsonAssign","description":"Combines multiple JSON objects into a single JSON object","version":"1.0.0","output":["Json"],"brackets":true,"unwrap":true,"args":[{"name":"json","description":"JSON objects for merging","type":"Json","required":true,"rest":true}]},{"name":"$append","description":"Appends items into the last of list","unwrap":true,"brackets":true,"args":[{"name":"sourcesToAppend","description":"The source or target of items to be inserted","type":"Unknown","rest":false,"required":true},{"name":"items","description":"The items to append","type":"Unknown","rest":true,"required":true}],"category":"object","version":"1.0.0"},{"name":"$delete","description":"Deletes a key from an object or context","unwrap":true,"brackets":true,"args":[{"name":"propertyKey","description":"The name of the property or key of object","type":"String","rest":false,"required":true},{"name":"object","description":"The source of object","type":"Unknown","rest":false,"required":false}],"category":"object","version":"1.0.0"},{"name":"$deserialize","description":"Deserializes a serialized input into an object","unwrap":true,"brackets":true,"args":[{"name":"input","description":"The input that is to be deserialized","type":"String","rest":false,"required":false},{"name":"deserializer","description":"A deserializer instance or name of a registered service","type":"Unknown","rest":false,"required":false}],"category":"object","version":"1.0.0"},{"name":"$require","description":"Loads the module to $require","output":["Unknown"],"brackets":true,"unwrap":true,"args":[{"name":"path","description":"Module path","type":"String","required":true,"rest":false}],"category":"object","version":"1.0.0"},{"name":"$serialize","description":"Serializes an object into a serializer","unwrap":true,"brackets":true,"args":[{"name":"object","description":"The object that is to be serialized","type":"Unknown","rest":false,"required":false},{"name":"serializer","description":"A serializer instance or name of a registered service","type":"Unknown","rest":false,"required":false}],"category":"object","version":"1.0.0"},{"name":"$requireCache","description":"Deletes a module from the cache or reloads it (including dependencies)","version":"1.0.0","output":["Boolean"],"brackets":true,"unwrap":true,"args":[{"name":"path","description":"Module path","type":"String","required":true,"rest":false},{"name":"type","description":"Type of action","type":"Enum","enum":["delete","update"],"required":true,"rest":false,"enumName":"ActionType"},{"name":"recursive","description":"Whether to clear cache recursively","type":"Boolean","rest":false}]}]
2 changes: 1 addition & 1 deletion metadata/paths.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"functions":"src/functions"}
{"functions":"src/functions"}
22 changes: 18 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@
"name": "@quoriel/edge",
"description": "A set of additional functions for ForgeScript to simplify work with various scripts and tasks",
"version": "1.0.0",
"main": "src/main.js",
"author": "Mlad (https://github.com/eolthar)",
"license": "GPL-3.0",
"scripts": {
"docgen": "node src/docgen.js"
"docgen": "bun run scripts/docgen",
"build": "bun run build:src && bun run build:types",
"build:src": "bun run scripts/build",
"build:types": "bunx tsc -p tsconfig.json",
"watch:types": "bunx tsc --watch -p tsconfig.json"
},
"dependencies": {
"@tryforge/forgescript": "^2.4.1"
}
"@tryforge/forgescript": "^2.4.1",
"zod": "^4.1.12"
},
"devDependencies": {
"@types/bun": "^1.3.1",
"toml": "^3.0.0",
"typescript": "^5.9.3"
},
"exports": [
"./dist/index.js",
"./dist/index.mjs"
],
"types": "./dist/types"
}
28 changes: 28 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Glob } from "bun";
import { rmSync } from "fs";

const sourceDirectory = 'src/**/*.ts'
const glob = new Glob(sourceDirectory)
var entrypoints = [...glob.scanSync()]
entrypoints = entrypoints.map((x) => `${x}`)

const BuildOptions: Bun.BuildConfig = {
entrypoints: entrypoints,
splitting: true,
target: 'node',
tsconfig: 'tsconfig.json',
external: ['@tryforge/forgescript'],
naming: '[dir]/[name].mjs',
root: 'src'
}

// Clear existing dist
rmSync('dist', { recursive: true, force: true })

// Transpiling for ES Modules
Bun.build({...BuildOptions, format: 'esm', outdir: 'dist'})

// Transpiling for CommonJS
// # Use tsc since its cleaner
// BuildOptions.splitting = false
// Bun.build({...BuildOptions, format: 'cjs', outdir: 'dist/cjs'})
4 changes: 4 additions & 0 deletions scripts/docgen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { generateMetadata } from "@tryforge/forgescript";
import { resolve } from "path";

generateMetadata(resolve(process.cwd(), 'dist/functions'), "functions")
2 changes: 0 additions & 2 deletions src/docgen.js

This file was deleted.

35 changes: 35 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ForgeExtension, FunctionManager, type ForgeClient } from "@tryforge/forgescript";
import { name, description, version } from '../package.json'
import { resolve, extname } from "path";
import { globSync } from "fs";

export class QuorielExtension extends ForgeExtension {
public readonly name = name
public readonly description = description
public readonly version = version

public init(client: ForgeClient) {
// The internal handler doesn't support
// Dynamic script extension
// eg. .mjs, .ts, .cjs
const fnEntrypoints = globSync(`${__dirname}/functions/**/*${extname(__filename)}`)
let modules = []

for (const fname of fnEntrypoints) {
const module = require(fname)
if ('default' in module) {
modules.push(module.default)
continue;
}

if (Array.isArray(module)) {
modules.push(...module)
continue;
}

modules.push(module);
}

FunctionManager.addMany(modules)
}
}
18 changes: 12 additions & 6 deletions src/functions/execution.js → src/functions/execution.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
const { Logger, NativeFunction, ArgType, Compiler, Interpreter } = require("@tryforge/forgescript");
const { resolve } = require("path");
const { existsSync } = require("fs");
import {
Compiler,
Interpreter,
ArgType,
NativeFunction,
Logger
} from '@tryforge/forgescript'
import { resolve } from 'path'
import { existsSync } from 'fs';

exports.default = new NativeFunction({
export default new NativeFunction({
name: "$execution",
description: "Executes code exported as a string from the specified file",
version: "1.0.0",
Expand Down Expand Up @@ -31,9 +37,9 @@ exports.default = new NativeFunction({
data: Compiler.compile(code)
});
return result === null ? this.stop() : this.success(result);
} catch (error) {
} catch (error:unknown) {
Logger.error(error);
return this.error(error);
return this.error(error as Error);
}
}
});
Loading