mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
@@ -2396,6 +2396,7 @@ pub const HardcodedModule = enum {
|
||||
.{ "node:child_process", .{ .path = "node:child_process" } },
|
||||
.{ "node:constants", .{ .path = "node:constants" } },
|
||||
.{ "node:console", .{ .path = "node:console" } },
|
||||
.{ "console", .{ .path = "node:console" } },
|
||||
.{ "node:querystring", .{ .path = "node:querystring" } },
|
||||
.{ "querystring", .{ .path = "node:querystring" } },
|
||||
.{ "node:domain", .{ .path = "node:domain" } },
|
||||
|
||||
@@ -292,11 +292,13 @@ DEFINE_NATIVE_MODULE(NodeModule) {
|
||||
exportNames.append(name);
|
||||
exportValues.append(value);
|
||||
};
|
||||
exportNames.reserveCapacity(14);
|
||||
exportValues.ensureCapacity(14);
|
||||
exportNames.reserveCapacity(15);
|
||||
exportValues.ensureCapacity(15);
|
||||
exportNames.append(vm.propertyNames->defaultKeyword);
|
||||
exportValues.append(defaultObject);
|
||||
|
||||
put(Identifier::fromString(vm, "Module"_s), defaultObject);
|
||||
|
||||
putNativeFn(Identifier::fromString(vm, "createRequire"_s),
|
||||
jsFunctionNodeModuleCreateRequire);
|
||||
putNativeFn(Identifier::fromString(vm, "paths"_s),
|
||||
|
||||
@@ -26,6 +26,10 @@ test("Module exists", () => {
|
||||
expect(Module).toBeDefined();
|
||||
});
|
||||
|
||||
test("module.Module exists", () => {
|
||||
expect(Module.Module === Module).toBeTrue();
|
||||
});
|
||||
|
||||
test("_nodeModulePaths() works", () => {
|
||||
expect(() => {
|
||||
_nodeModulePaths();
|
||||
|
||||
Reference in New Issue
Block a user