summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/os.ts
AgeCommit message (Collapse)Author
2024-10-31fix(node): Implement `os.userInfo` properly, add missing `toPrimitive` (#24702)Nathan Whitaker
Fixes the implementation of `os.userInfo`, and adds a missing `toPrimitive` for `tmpdir`. This allows us to enable the corresponding node_compat test.
2024-08-28refactor(ext): throw new error instead of throw error (#25272)Ian Bull
To ensure consistency across the codebase, this commit refactors the code in the `ext` folder to use `throw new Error`` instead of `throw` for throwing errors. Fixes https://github.com/denoland/deno/issues/25270
2024-07-24fix(node): Run node compat tests listed in the `ignore` field (and fix the ↵Nathan Whitaker
ones that fail) (#24631) The intent is that those tests will be executed, but our check that the files are up to date won't overwrite the contents of the tests. This is useful when a test needs some manual edits to work. It turns out we weren't actually running them. --- This ended up turning into a couple of small bug fixes to get the tests passing: - We weren't canonicalizing the exec path properly (it sometimes still had `..` or `.` in it) - We weren't accepting strings in `process.exit` There was one failure I couldn't figure out quickly, so I disabled the test for now, and filed a follow up issue: #24694
2024-05-16fix(ext/node): homedir() `getpwuid`/`SHGetKnownFolderPath` fallback (#23841)Divy Srivastava
**Unix**: Returns the value of the HOME environment variable if it is set even if it is an empty string. Otherwise, it tries to determine the home directory by invoking the [getpwuid_r](https://linux.die.net/man/3/getpwuid_r) function with the UID of the current user. **Windows**: Returns the value of the USERPROFILE environment variable if it is set and it is not an empty string. Otherwise, it tries to determine the home directory by invoking the [SHGetKnownFolderPath](https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath) function with [FOLDERID_Profile](https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid). Fixes https://github.com/denoland/deno/issues/23824
2024-01-29refactor: migrate 'ext/node' extension to virtual ops module (#22157)Bartek Iwańczuk
Follow up to https://github.com/denoland/deno/pull/22135
2024-01-10refactor: use `core.ensureFastOps()` (#21888)Kenta Moriuchi
2024-01-10fix: android support (#19437)cions
<!-- Before submitting a PR, please read https://deno.com/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> --------- Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-02fix(ext/node): implement os.machine (#21751)Divy Srivastava
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-28fix(node): Implement os.cpus() (#21697)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/21666 Zero added dependency and tries to match the libuv implementation
2023-11-30fix(ext/node): fix os.freemem (#21347)Yoshiya Hinosawa
2023-09-30feat(node/os): Add `availableParallelism` (#20745)Rui He
2023-09-24fix(ext/node): simplified array.from + map (#20653)Mikhail
`Array.from` has optional second argument. Calling `map` is not required for this case.
2023-08-16fix(ext/node): allow for the reassignment of userInfo() on Windows (#20165)Evan
The goal of this PR is to address issue #20106 where a `TypeError` occurs when the variables `uid` and `gid` from `userInfo()` in `node:os` are reassigned if the user is on Windows. Both `uid` and `gid` are marked as `const` therefore producing a `TypeError` when the two are reassigned. This PR achieves that goal by marking `uid` and `gid` as `let`
2023-07-31feat(node/os): implement getPriority, setPriority & userInfo (#19370)Leo Kettmeir
Takes #4202 over Closes #17850 --------- Co-authored-by: ecyrbe <ecyrbe@gmail.com>
2023-07-02refactor: rename built-in node modules from ext:deno_node/ to node: (#19680)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19510
2023-06-27chore(ext/node): disable prefer-primordials on a per-file basis (#19553)Kenta Moriuchi
2023-06-12feat: Adaptations to support OpenBSD port (#19153)VlkrS
2023-03-28Reland "refactor: remove Deno[Deno.internal].nodeUnstable namespace" (#18475)Bartek Iwańczuk
This reverts commit 357bcfcf79fee92195e37bb3f05e247908f207c5.
2023-03-27Revert "refactor: remove Deno[Deno.internal].nodeUnstable namespace (… ↵Bartek Iwańczuk
(#18458) …#18449)" This reverts commit d1a9c4cd7ce0c19ddf9c7c52c0d35d6124a7677d. Appears this made CI very flaky on macOS, but I can't repeat it locally yet
2023-03-27refactor: remove Deno[Deno.internal].nodeUnstable namespace (#18449)Bartek Iwańczuk
Since we can preserve ops in the snapshot these days, we no longer need to have "Deno[Deno.internal].nodeUnstable" namespace. Instead, various built-in Node.js modules can use appropriate APIs directly.
2023-03-08refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme ↵Bartek Iwańczuk
for snapshotted modules (#18041) This commit renames "deno_core::InternalModuleLoader" to "ExtModuleLoader" and changes the specifiers used by the modules loaded from this loader to "ext:". "internal:" scheme was really ambiguous and it's more characters than "ext:", which should result in slightly smaller snapshot size. Closes https://github.com/denoland/deno/issues/18020
2023-03-05refactor(core): include_js_files! 'dir' option doesn't change specifiers ↵Bartek Iwańczuk
(#18019) This commit changes "include_js_files!" macro from "deno_core" in a way that "dir" option doesn't cause specifiers to be rewritten to include it. Example: ``` include_js_files! { dir "js", "hello.js", } ``` The above definition required embedders to use: `import ... from "internal:<ext_name>/js/hello.js"`. But with this change, the "js" directory in which the files are stored is an implementation detail, which for embedders results in: `import ... from "internal:<ext_name>/hello.js"`. The directory the files are stored in, is an implementation detail and in some cases might result in a significant size difference for the snapshot. As an example, in "deno_node" extension, we store the source code in "polyfills" directory; which resulted in each specifier to look like "internal:deno_node/polyfills/<module_name>", but with this change it's "internal:deno_node/<module_name>". Given that "deno_node" has over 100 files, many of them having several import specifiers to the same extension, this change removes 10 characters from each import specifier.
2023-02-14feat(ext/node): embed std/node into the snapshot (#17724)Bartek Iwańczuk
This commit moves "deno_std/node" in "ext/node" crate. The code is transpiled and snapshotted during the build process. During the first pass a minimal amount of work was done to create the snapshot, a lot of code in "ext/node" depends on presence of "Deno" global. This code will be gradually fixed in the follow up PRs to migrate it to import relevant APIs from "internal:" modules. Currently the code from snapshot is not used in any way, and all Node/npm compatibility still uses code from "https://deno.land/std/node" (or from the location specified by "DENO_NODE_COMPAT_URL"). This will also be handled in a follow up PRs. --------- Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>