diff options
author | 2022-08-26 04:38:28 +0200 | |
---|---|---|
committer | 2022-08-25 19:38:28 -0700 | |
commit | 7a734e0a28d8782de404de13362f0b822ea91c11 (patch) | |
tree | c56944346223fe9996c4144ab3ae6b85433909a1 /src/bun.js/javascript.zig | |
parent | e0b35b3086b00fb27f950a72a082b360a3dad891 (diff) | |
download | bun-7a734e0a28d8782de404de13362f0b822ea91c11.tar.gz bun-7a734e0a28d8782de404de13362f0b822ea91c11.tar.zst bun-7a734e0a28d8782de404de13362f0b822ea91c11.zip |
feat: implement native os module (#1115)
* feat: implement os module
* revert(bun-error): package-lock.json
* feat: implement EOL
* feat: implement EOL
* feat: implement arch function
* feat: implement homedir function
* add comptime to homedir if
* feat: add platform function
* feat: implement type function
* feat: add hostname (not sure iff works on all platforms)
* chore: make requested changes
* fix: change toValueGC into toValue in arch function
* add EOL, devNull constant variables
* fix: store only string
* feat: add tests
* feat: add endianness
* ususe toValue for devNull & EOL
* feat: implement endianness & fix release
* revert javascript.zig fix
* feat: implement tmpdir
* feat: implement totalmem, freemem, uptime
* feat: loadavg
* feat: implement version
* feat: add userInfo
* feat: implement totalmem for macos
* feat: add getPriority (not finished, waiting for dc response)
* feat: finish userInfo implementation
* feat: implement cpus, not done
* feat: finish getPriority implementation & stats cpus()
* feat: implement setPriority
* reemove test.c
* feat: implement constants.dlope.xn, constants.priority.x, constants.UV_UDP_REUSEADDR
* feat: implement signals, errno
* updated cpus function, stilldoesnt work
* increase object length
* feat: add t more ests
* feat: add cpus()
* remov some files
* fix: handle empty array
* started working on interface addresses (in C)
ill use C++ after it work
* fix interface_addresses
* Improved getCpuInfo code, decreased ram usage, increased speed
* getCpuTime optimizations
* started working on networkInterfaces
* feat: networkInterfaces implementation
* delete unnecessary files
* add benchs & fix code
* add tests
* add missing benchs
* Increased buffer of getCpuInfo to 2048, it should skip few iterations
* remove hardcoded constants
* feat: implement errno constants
* fix getWindowsErrorConstant
* feat: add signal constants
* feat: implement priority constants
* remove duplications
* fix: change value to ?i16
* fix(__defineConstant): make some parameters comptime, change value to ?i32
* fix: add E to ERRNO constants, add SIG to SIG constants
* feat: add dlopen constants
* change functions to private
* feat: add UV_UDP_REUSEADDR
* fix typo
* simplify functions
* rename functions in bindings
* feat: implement loadavg for darwin
* feat: implement system uptime
* feat: implement get free memory for darwin
* fix system memory bindings
* feat: implement network interfaces for darwin
* code cleanup
* feat: support for macos version & release
* some fixes
* MacOS support for CpuInfo
* Fixed minor mistake in getCpuInfo_B
* Delete test.zig
* Update c_cpp_properties.json
* Update tasks.json
* feat: implement scopeid
* feat: implement cidr 🚀
* remove unnecesarry changes
* remove unnecesarry changes
* chore: requested changes
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* chore: requested changes
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* chore: requested changes
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* chore: requested changes
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* chore: requested changes
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* chore: requested changes
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* chore: requested changes
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* fix: import string
* fix: change IPV6 to IPv6
* fix some things
* chore: make requested changes
* revert: launch.json
* fix test
* Fixed few memory leaks
* testing
* again
* added len
* another test
* improved parsing
* added small check
* Bonk
* FINISH 🚀🚀🚀🚀🚀🚀
* Update tasks.json
* NetworkInterface test
* FINISH 🚀🚀🚀
Co-authored-by: Fire-The-Fox <gajdos.jan77@gmail.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to '')
-rw-r--r-- | src/bun.js/javascript.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index fc1817b9b..9b7446d9c 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -859,6 +859,15 @@ pub const VirtualMachine = struct { .tag = ResolvedSource.Tag.@"node:process", }; }, + .@"node:os" => { + return ResolvedSource{ + .allocator = null, + .source_code = ZigString.init(Node.Os.code), + .specifier = ZigString.init("node:os"), + .source_url = ZigString.init("node:os"), + .hash = 0, + }; + }, .@"bun:ffi" => { return ResolvedSource{ .allocator = null, @@ -2791,6 +2800,7 @@ pub const HardcodedModule = enum { @"node:fs/promises", @"node:http", @"node:module", + @"node:os", @"node:stream", @"node:path", @"node:perf_hooks", @@ -2824,6 +2834,7 @@ pub const HardcodedModule = enum { .{ "node:fs/promises", HardcodedModule.@"node:fs/promises" }, .{ "node:http", HardcodedModule.@"node:http" }, .{ "node:module", HardcodedModule.@"node:module" }, + .{ "node:os", HardcodedModule.@"node:os" }, .{ "node:path", HardcodedModule.@"node:path" }, .{ "node:path/posix", HardcodedModule.@"node:path" }, .{ "node:path/win32", HardcodedModule.@"node:path" }, @@ -2835,6 +2846,7 @@ pub const HardcodedModule = enum { .{ "node:timers", HardcodedModule.@"node:timers" }, .{ "node:timers/promises", HardcodedModule.@"node:timers/promises" }, .{ "node:url", HardcodedModule.@"node:url" }, + .{ "os", HardcodedModule.@"node:os" }, .{ "path", HardcodedModule.@"node:path" }, .{ "process", HardcodedModule.@"node:process" }, .{ "streams", HardcodedModule.@"node:stream" }, @@ -2866,6 +2878,7 @@ pub const HardcodedModule = enum { .{ "node:fs/promises", "node:fs/promises" }, .{ "node:http", "node:http" }, .{ "node:module", "node:module" }, + .{ "node:os", "node:os" }, .{ "node:path", "node:path" }, .{ "node:path/posix", "node:path" }, .{ "node:path/win32", "node:path" }, @@ -2877,6 +2890,7 @@ pub const HardcodedModule = enum { .{ "node:timers", "node:timers" }, .{ "node:timers/promises", "node:timers/promises" }, .{ "node:url", "node:url" }, + .{ "os", "node:os" }, .{ "path", "node:path" }, .{ "path/posix", "node:path" }, .{ "path/win32", "node:path" }, |