Skip to content
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
6 changes: 6 additions & 0 deletions crates/perry-hir/src/lower/lower_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,21 @@ fn is_cjs_style_native_default_import(module_name: &str) -> bool {
module_name,
"async_hooks"
<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> origin/main
| "constants"
| "events"
| "os"
| "path"
<<<<<<< HEAD
=======
=======
| "events"
| "os"
| "path"
| "punycode"
>>>>>>> origin/main
>>>>>>> origin/main
| "querystring"
| "sys"
Expand Down
6 changes: 6 additions & 0 deletions crates/perry-hir/src/lower/module_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ fn is_cjs_style_native_default_import(module_name: &str) -> bool {
module_name,
"async_hooks"
<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> origin/main
| "constants"
| "events"
| "os"
| "path"
<<<<<<< HEAD
=======
=======
| "events"
| "os"
| "path"
| "punycode"
>>>>>>> origin/main
>>>>>>> origin/main
| "querystring"
| "sys"
Expand Down
15 changes: 15 additions & 0 deletions crates/perry-runtime/src/object/native_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1339,12 +1339,17 @@ pub(crate) fn native_module_enumerable_keys(module_name: &str) -> Option<&'stati
"path.default" => Some(PATH_DEFAULT_KEYS),
"path.posix" | "path.win32" => Some(&[b"_makeLong"]),
"fs" => Some(FS_NAMESPACE_KEYS),
<<<<<<< HEAD
"constants" => Some(deprecated_constants_namespace_keys()),
"constants.default" => Some(deprecated_constants_keys()),
=======
<<<<<<< HEAD
"constants" => Some(deprecated_constants_namespace_keys()),
"constants.default" => Some(deprecated_constants_keys()),
=======
"constants" => Some(deprecated_constants_keys()),
"buffer" => Some(BUFFER_NAMESPACE_KEYS),
>>>>>>> origin/main
>>>>>>> origin/main
"querystring" => Some(QUERYSTRING_NAMESPACE_KEYS),
"querystring.default" => Some(QUERYSTRING_DEFAULT_KEYS),
Expand Down Expand Up @@ -1443,10 +1448,14 @@ fn create_cjs_default_namespace(module_name: &str) -> Option<f64> {
fn cjs_default_export_value(module_name: &str) -> Option<f64> {
match module_name {
"events" => Some(bound_native_callable_export_value("events", "EventEmitter")),
<<<<<<< HEAD
"async_hooks" | "constants" | "os" | "path" | "querystring" | "url" | "util" => {
=======
<<<<<<< HEAD
"async_hooks" | "constants" | "os" | "path" | "querystring" | "url" | "util" => {
=======
"async_hooks" | "os" | "path" | "punycode" | "querystring" | "url" | "util" => {
>>>>>>> origin/main
>>>>>>> origin/main
create_cjs_default_namespace(module_name)
}
Expand Down Expand Up @@ -4577,6 +4586,9 @@ pub(crate) unsafe fn get_native_module_constant(
_ => None,
},
<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> origin/main
"constants" => match property {
"default" if !is_cjs_default_object => cjs_default_export_value("constants"),
_ => fs_const(property)
Expand All @@ -4594,6 +4606,8 @@ pub(crate) unsafe fn get_native_module_constant(
}
}),
},
<<<<<<< HEAD
=======
=======
"constants" => fs_const(property)
.or_else(|| fs_const_tail(property))
Expand All @@ -4616,6 +4630,7 @@ pub(crate) unsafe fn get_native_module_constant(
_ => None,
},
"sqlite.constants" => sqlite_const(property),
>>>>>>> origin/main
>>>>>>> origin/main
"path" => match property {
"default" if !is_cjs_default_object => cjs_default_export_value("path"),
Expand Down
6 changes: 6 additions & 0 deletions crates/perry-runtime/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,17 @@ pub extern "C" fn js_process_get_builtin_module(id: f64) -> f64 {
return f64::from_bits(crate::value::TAG_UNDEFINED);
};
<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> origin/main
if module_name == "constants" {
let cjs_default = "constants.default";
return crate::object::js_create_native_module_namespace(
cjs_default.as_ptr(),
cjs_default.len(),
);
<<<<<<< HEAD
=======
=======
if module_name == "timers/promises" {
return unsafe {
Expand All @@ -564,6 +569,7 @@ pub extern "C" fn js_process_get_builtin_module(id: f64) -> f64 {
"timers_promises".len() as u32,
)
};
>>>>>>> origin/main
>>>>>>> origin/main
}
crate::object::js_create_native_module_namespace(module_name.as_ptr(), module_name.len())
Expand Down
Loading