Skip to content

Remove rudimentary node bindings and undocumented %node extension #6285

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

Merged
merged 3 commits into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
- Introduced a new `%ffi` extension that provides a more robust mechanism for JavaScript function interoperation by considering function arity in type constraints. This enhancement improves safety when dealing with JavaScript functions by enforcing type constraints based on the arity of the function. [PR #6251](https://github.com/rescript-lang/rescript-compiler/pull/6251)
- Extended untagged variants with function types https://github.com/rescript-lang/rescript-compiler/pull/6279

#### :boom: Breaking Change

- Remove rudimentary node bindings and undocumented `%node` extension. https://github.com/rescript-lang/rescript-compiler/pull/6285

#### :bug: Bug Fix

- Fix issue where uncurried type internals leak in type error. https://github.com/rescript-lang/rescript-compiler/pull/6264
Expand Down
35 changes: 0 additions & 35 deletions jscomp/frontend/ast_exp_extension.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,41 +69,6 @@ let handle_extension e (self : Bs_ast_mapper.mapper)
(Exp.ident ~loc {loc; txt = Lident "timed"})))
| _ ->
Location.raise_errorf ~loc "expect a boolean expression in the payload")
| "bs.node" | "node" -> (
let strip s =
match s with
| "_module" -> "module"
| x -> x
in
match Ast_payload.as_ident payload with
| Some
{
txt =
Lident
(("__filename" | "__dirname" | "_module" | "require") as name);
loc;
} ->
let exp = Ast_exp_handle_external.handle_external loc (strip name) in
let typ =
Ast_core_type.lift_option_type
(if name = "_module" then
Typ.constr ~loc {txt = Ldot (Lident "Node", "node_module"); loc} []
else if name = "require" then
Typ.constr ~loc {txt = Ldot (Lident "Node", "node_require"); loc} []
else Ast_literal.type_string ~loc ())
in
Exp.constraint_ ~loc exp typ
| Some _ | None -> (
match payload with
| PTyp _ ->
Location.raise_errorf ~loc
"Illegal payload, expect an expression payload instead of type \
payload"
| PPat _ ->
Location.raise_errorf ~loc
"Illegal payload, expect an expression payload instead of pattern \
payload"
| _ -> Location.raise_errorf ~loc "Illegal payload"))
| "bs.debugger" | "debugger" ->
{e with pexp_desc = Ast_exp_handle_external.handle_debugger loc payload}
| "bs.obj" | "obj" -> (
Expand Down
84 changes: 0 additions & 84 deletions jscomp/others/node.ml

This file was deleted.

40 changes: 0 additions & 40 deletions jscomp/others/node_buffer.res

This file was deleted.

49 changes: 0 additions & 49 deletions jscomp/others/node_child_process.res

This file was deleted.

133 changes: 0 additions & 133 deletions jscomp/others/node_fs.res

This file was deleted.

27 changes: 0 additions & 27 deletions jscomp/others/node_module.res

This file was deleted.

Loading