ChibraxOS 2
Changes: - kernel 6.0.2 - Broken init scripts - Switch to bun for better peroformance an easier ffi - Removed grup - Efi support without graphics (at least graphics werent tested) - Suppression de toutes les dépendance non libc - new splash - broken audio - typescript support - ls rewritten to be more reliable
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* DICKPICK is a image drawing library
|
||||
*/
|
||||
|
||||
const graphics = require('../../core/graphics')
|
||||
import * as graphics from '../../core/graphics'
|
||||
|
||||
/**
|
||||
* @param { number } x
|
||||
@@ -12,7 +12,7 @@ const graphics = require('../../core/graphics')
|
||||
* @param { number } dy length on the y axis
|
||||
* @param { string } color
|
||||
*/
|
||||
function drawRect(x, y, dx, dy, color) {
|
||||
export function drawRect(x, y, dx, dy, color) {
|
||||
const bitmap = {
|
||||
data: Buffer.alloc(dx*dy*4, Buffer.from(graphics.parseHexColor(color))),
|
||||
width: dx,
|
||||
@@ -28,7 +28,7 @@ function drawRect(x, y, dx, dy, color) {
|
||||
* @param { number[] } color
|
||||
* @returns { Pencil }
|
||||
*/
|
||||
function pencilFromBitmap(Bitmap, color) {
|
||||
export function pencilFromBitmap(Bitmap, color) {
|
||||
return { ...Bitmap, color }
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function pencilFromBitmap(Bitmap, color) {
|
||||
* @param { number } height
|
||||
* @returns
|
||||
*/
|
||||
function createBitmap(width, height) {
|
||||
export function createBitmap(width, height) {
|
||||
const data = Buffer.alloc(width * height * 4, Buffer.from([0, 0, 0, 0]));
|
||||
return { width, height, data }
|
||||
}
|
||||
@@ -47,7 +47,7 @@ function createBitmap(width, height) {
|
||||
* @param { number } x
|
||||
* @param { number } y
|
||||
*/
|
||||
function setPixel(pencil, x, y) {
|
||||
export function setPixel(pencil, x, y) {
|
||||
pencil.data.set(pencil.color, y*pencil.width*4 + x*4)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ function setPixel(pencil, x, y) {
|
||||
* @param { number } yc
|
||||
* @param { Pencil } pencil
|
||||
*/
|
||||
function symetrie8Axes(xc, yc, x, y, pencil) {
|
||||
export function symetrie8Axes(xc, yc, x, y, pencil) {
|
||||
setPixel(pencil, x+xc, y+yc)
|
||||
setPixel(pencil, x+xc,-y+yc)
|
||||
setPixel(pencil, -x+xc,-y+yc)
|
||||
@@ -78,7 +78,7 @@ function symetrie8Axes(xc, yc, x, y, pencil) {
|
||||
* @param { number } yc
|
||||
* @param { number } r
|
||||
*/
|
||||
function drawCircle(pencil, xc, yc, r) {
|
||||
export function drawCircle(pencil, xc, yc, r) {
|
||||
let x = 0
|
||||
let y = r
|
||||
let d = 3 - (2 * r);
|
||||
@@ -96,6 +96,3 @@ function drawCircle(pencil, xc, yc, r) {
|
||||
symetrie8Axes(xc, yc, x, y, pencil);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = { drawRect, setPixel, pencilFromBitmap, createBitmap, drawCircle }
|
||||
@@ -2,8 +2,6 @@
|
||||
/**
|
||||
* @type {{ [key: string]: string[] }}
|
||||
*/
|
||||
const aliases = {
|
||||
export default {
|
||||
ls: ["ls", "--color"]
|
||||
}
|
||||
|
||||
module.exports = aliases
|
||||
@@ -11,4 +11,4 @@ let environment = {
|
||||
}),
|
||||
}
|
||||
|
||||
module.exports = environment
|
||||
export default environment
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
//@ts-check
|
||||
const { isAlpha } = require('./utils')
|
||||
|
||||
|
||||
class Lexer{
|
||||
export default class Lexer{
|
||||
/**
|
||||
* @param { string } source
|
||||
*/
|
||||
@@ -55,8 +53,3 @@ class Lexer{
|
||||
// this.tokens.push(Token(tokenType, value))
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
Lexer
|
||||
}
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as crypto from 'crypto'
|
||||
import { tmpdir } from 'os';
|
||||
import * as fs from 'fs'
|
||||
import * as childProc from 'child_process'
|
||||
import * as pathUtil from 'path'
|
||||
|
||||
var
|
||||
IS_WIN = process.platform === 'win32',
|
||||
|
||||
@@ -15,10 +21,7 @@ var
|
||||
ALGORITHM_HASH = 'sha256',
|
||||
DEFAULT_ERR_MSG = 'The current environment doesn\'t support interactive reading from TTY.',
|
||||
|
||||
fs = require('fs'),
|
||||
TTY = process.binding('tty_wrap').TTY,
|
||||
childProc = require('child_process'),
|
||||
pathUtil = require('path'),
|
||||
|
||||
defaultOptions = {
|
||||
/* eslint-disable key-spacing */
|
||||
@@ -91,7 +94,7 @@ function _execFileSync(options, execOptions) {
|
||||
function getTempfile(name) {
|
||||
var suffix = '',
|
||||
filepath, fd;
|
||||
tempdir = tempdir || require('os').tmpdir();
|
||||
tempdir = tempdir || tmpdir();
|
||||
|
||||
while (true) {
|
||||
filepath = pathUtil.join(tempdir, name + suffix);
|
||||
@@ -116,7 +119,6 @@ function _execFileSync(options, execOptions) {
|
||||
pathStderr = getTempfile('readline-sync.stderr'),
|
||||
pathExit = getTempfile('readline-sync.exit'),
|
||||
pathDone = getTempfile('readline-sync.done'),
|
||||
crypto = require('crypto'),
|
||||
hostArgs, shellPath, shellArgs, exitCode, extMessage, shasum, decipher, password;
|
||||
|
||||
shasum = crypto.createHash(ALGORITHM_HASH);
|
||||
|
||||
@@ -1,41 +1,9 @@
|
||||
//@ts-check
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @returns { Promise<string> }
|
||||
*/
|
||||
async function getline(str) {
|
||||
process.stdout.write(str)
|
||||
process.stdin.resume()
|
||||
process.stdin.setEncoding('utf8')
|
||||
let line = ""
|
||||
return new Promise((res, rej) => {
|
||||
process.stdin.on('data', function(chunk) {
|
||||
|
||||
line += chunk
|
||||
if (chunk.toString('utf-8').endsWith('\n')) {
|
||||
process.stdin.pause()
|
||||
res(line.substring(0, line.length -1))
|
||||
}
|
||||
})
|
||||
process.stdin.on('error', function(err) {
|
||||
rej(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @param { string } str
|
||||
* @returns
|
||||
*/
|
||||
function isAlpha(str){
|
||||
export function isAlpha(str){
|
||||
return /^[a-zA-Z]*$/.test(str)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
isAlpha, getline
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user