mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Merge import.meta.require and require to be the same thing (#3732)
* Merge import.meta.require and require to be the same thing * support `require` and BunPlugin (runtime plugin) * plugins * unused code * revert launch.json
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "./NodeModuleModule.h"
|
||||
|
||||
#include "CommonJSModuleRecord.h"
|
||||
#include "ImportMetaObject.h"
|
||||
#include "JavaScriptCore/JSBoundFunction.h"
|
||||
#include "JavaScriptCore/ObjectConstructor.h"
|
||||
@@ -126,14 +127,13 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionNodeModuleCreateRequire,
|
||||
if (callFrame->argumentCount() < 1) {
|
||||
throwTypeError(globalObject, scope,
|
||||
"createRequire() requires at least one argument"_s);
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsUndefined()));
|
||||
}
|
||||
|
||||
auto val = callFrame->uncheckedArgument(0).toWTFString(globalObject);
|
||||
RETURN_IF_EXCEPTION(scope, JSC::JSValue::encode(JSC::jsUndefined()));
|
||||
auto clientData = WebCore::clientData(vm);
|
||||
RELEASE_AND_RETURN(
|
||||
scope, JSValue::encode(Zig::ImportMetaObject::createRequireFunction(
|
||||
scope, JSValue::encode(Bun::JSCommonJSModule::createBoundRequireFunction(
|
||||
vm, globalObject, val)));
|
||||
}
|
||||
extern "C" EncodedJSValue Resolver__nodeModulePathsForJS(JSGlobalObject *,
|
||||
|
||||
Reference in New Issue
Block a user