Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruspty init #1

Merged
merged 34 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
332f488
init
szymonkaliski Jan 23, 2024
4ae50c4
improve README
szymonkaliski Jan 24, 2024
3919c51
reshuffle ok/err handling
szymonkaliski Jan 24, 2024
d7b2dc4
ends -> pty_pair
szymonkaliski Jan 24, 2024
bd9c350
use ? in some places
szymonkaliski Jan 24, 2024
2017095
use ? in more places
szymonkaliski Jan 24, 2024
09a11d5
even more ?
szymonkaliski Jan 24, 2024
f6e080c
check result from termios
szymonkaliski Jan 24, 2024
33fc4cb
a comment
szymonkaliski Jan 24, 2024
8b02228
alpha version
szymonkaliski Jan 24, 2024
995c997
release alpha publicly
szymonkaliski Jan 24, 2024
8a02443
github ci
szymonkaliski Jan 24, 2024
ce10aaf
ci with bun
szymonkaliski Jan 24, 2024
5cdc61f
try install bun in docker
szymonkaliski Jan 24, 2024
128d5f1
more ci bun
szymonkaliski Jan 24, 2024
0924a4c
try bun docker container
szymonkaliski Jan 24, 2024
248bc68
adjust cwd test
szymonkaliski Jan 24, 2024
556be27
skip cwd test, fails on ci for whatever reason
szymonkaliski Jan 24, 2024
31967b7
try to fix test issue on linux ci
Jan 24, 2024
4bb01a6
skip flaky env test
szymonkaliski Jan 24, 2024
cea74ad
1.0.0-alpha.1
szymonkaliski Jan 24, 2024
6601371
testing publishing
szymonkaliski Jan 24, 2024
2916690
1.0.0-alpha.2
szymonkaliski Jan 24, 2024
05d79d8
1.0.0
szymonkaliski Jan 24, 2024
800eb43
more ci debugging
szymonkaliski Jan 24, 2024
0ce7f2a
force publish flow for v1.0.0
szymonkaliski Jan 24, 2024
742535b
undo force publish from previous commit
szymonkaliski Jan 24, 2024
1846e20
some info on publishing
szymonkaliski Jan 24, 2024
25a0071
new test & prettier
szymonkaliski Jan 30, 2024
0dcf1e7
attempt at cleaning up CI a bit
szymonkaliski Jan 30, 2024
cc0b74e
close the fd after child.wait()
szymonkaliski Jan 31, 2024
645d292
move around usafe {}
szymonkaliski Jan 31, 2024
852d90e
check for error when getting fcntl flags
szymonkaliski Jan 31, 2024
e06f061
more readable size using an object with named fields
szymonkaliski Jan 31, 2024
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
197 changes: 197 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# End of https://www.toptal.com/developers/gitignore/api/node

# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

# End of https://www.toptal.com/developers/gitignore/api/macos

# Created by https://www.toptal.com/developers/gitignore/api/windows
# Edit at https://www.toptal.com/developers/gitignore?templates=windows

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/windows

#Added by cargo

/target
Cargo.lock

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

*.node
13 changes: 13 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
target
Cargo.lock
.cargo
.github
npm
.eslintrc
.prettierignore
rustfmt.toml
yarn.lock
*.node
.yarn
__test__
renovate.json
21 changes: 21 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
edition = "2021"
name = "replit_ruspty"
version = "1.0.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "2.12.2", default-features = false, features = ["napi4"] }
napi-derive = "2.12.2"
rustix = "0.38.30"
rustix-openpty = "0.1.1"
libc = "0.2.152"

[build-dependencies]
napi-build = "2.0.1"

[profile.release]
lto = true
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `@replit/ruspty` - PTY for Bun (and Node) through Rust FFI

Running:

- `bun install`
- `bun run build`
- `bun test`

The code mainly targets Bun, but does work in Node too.

The Rust PTY implementation is cargo-culted from [Alacritty's Unix TTY code](https://github.com/alacritty/alacritty/blob/master/alacritty_terminal/src/tty/unix.rs).
szymonkaliski marked this conversation as resolved.
Show resolved Hide resolved

5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extern crate napi_build;

fn main() {
napi_build::setup();
}
Binary file added bun.lockb
Binary file not shown.
11 changes: 11 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* tslint:disable */
/* eslint-disable */

/* auto-generated by NAPI-RS */

export class Pty {
fd: number
pid: number
constructor(command: string, args: Array<string>, envs: Record<string, string>, dir: string, size: [cols: number, rows: number], onExit: (err: null | Error, exitCode: number) => void)
resize(size: [cols: number, rows: number]): void
}
jackyzha0 marked this conversation as resolved.
Show resolved Hide resolved
Loading