diff options
author | 2023-08-02 16:27:36 -0700 | |
---|---|---|
committer | 2023-08-02 16:27:36 -0700 | |
commit | c2a77cf7ec9de9eadf938046bdf78e58561c8a6d (patch) | |
tree | 0f90f1b323061455875333c9f40592b303585973 /src/bun.js/modules/EventsModule.h | |
parent | 7656b4b17e91f15b58eeab8f45b78c416ec6a045 (diff) | |
download | bun-c2a77cf7ec9de9eadf938046bdf78e58561c8a6d.tar.gz bun-c2a77cf7ec9de9eadf938046bdf78e58561c8a6d.tar.zst bun-c2a77cf7ec9de9eadf938046bdf78e58561c8a6d.zip |
Rewrite built-in modules to use CommonJS over ESM (#3814)
* stfdsafsd
sadffdsa
stuff
finish commonjs stuff
asdf
not done but work
not done but work
not done yet but this is how far i am
remove files
lol
update built files
uncomment everything in events lol
export default
stuff
* afdsafsd
* its not perfect but almost done
* okay
* cool
* remove temp file
* finish rebase
* revert settings.json
* a
* ch-ch-ch-ch-changes
* okay
* remove this check in release for now
* sxdcfghnjm,
* lkjhgf
* fmt
* filename can be null
* Update NodeModuleModule.h
* weee
* fmt
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/modules/EventsModule.h')
-rw-r--r-- | src/bun.js/modules/EventsModule.h | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/bun.js/modules/EventsModule.h b/src/bun.js/modules/EventsModule.h deleted file mode 100644 index 7d53ff838..000000000 --- a/src/bun.js/modules/EventsModule.h +++ /dev/null @@ -1,58 +0,0 @@ -#include "JavaScriptCore/JSGlobalObject.h" -#include "ZigGlobalObject.h" - -namespace Zig { -using namespace WebCore; - -inline void generateEventsSourceCode(JSC::JSGlobalObject *lexicalGlobalObject, - JSC::Identifier moduleKey, - Vector<JSC::Identifier, 4> &exportNames, - JSC::MarkedArgumentBuffer &exportValues) { - JSC::VM &vm = lexicalGlobalObject->vm(); - GlobalObject *globalObject = - reinterpret_cast<GlobalObject *>(lexicalGlobalObject); - - exportNames.append(JSC::Identifier::fromString(vm, "EventEmitter"_s)); - exportValues.append( - WebCore::JSEventEmitter::getConstructor(vm, globalObject)); - - exportNames.append(JSC::Identifier::fromString(vm, "getEventListeners"_s)); - exportValues.append(JSC::JSFunction::create( - vm, lexicalGlobalObject, 0, MAKE_STATIC_STRING_IMPL("getEventListeners"), - Events_functionGetEventListeners, ImplementationVisibility::Public)); - exportNames.append(JSC::Identifier::fromString(vm, "listenerCount"_s)); - exportValues.append(JSC::JSFunction::create( - vm, lexicalGlobalObject, 0, MAKE_STATIC_STRING_IMPL("listenerCount"), - Events_functionListenerCount, ImplementationVisibility::Public)); - exportNames.append(JSC::Identifier::fromString(vm, "once"_s)); - exportValues.append(JSC::JSFunction::create( - vm, lexicalGlobalObject, 0, MAKE_STATIC_STRING_IMPL("once"), - Events_functionOnce, ImplementationVisibility::Public)); - exportNames.append(JSC::Identifier::fromString(vm, "on"_s)); - exportValues.append(JSC::JSFunction::create( - vm, lexicalGlobalObject, 0, MAKE_STATIC_STRING_IMPL("on"), - Events_functionOn, ImplementationVisibility::Public)); - exportNames.append( - JSC::Identifier::fromString(vm, "captureRejectionSymbol"_s)); - exportValues.append(Symbol::create( - vm, vm.symbolRegistry().symbolForKey("nodejs.rejection"_s))); - - JSFunction *eventEmitterModuleCJS = - jsCast<JSFunction *>(WebCore::JSEventEmitter::getConstructor( - vm, reinterpret_cast<Zig::GlobalObject *>(globalObject))); - - eventEmitterModuleCJS->putDirect( - vm, - PropertyName( - Identifier::fromUid(vm.symbolRegistry().symbolForKey("CommonJS"_s))), - jsNumber(0), 0); - - for (size_t i = 0; i < exportNames.size(); i++) { - eventEmitterModuleCJS->putDirect(vm, exportNames[i], exportValues.at(i), 0); - } - - exportNames.append(JSC::Identifier::fromString(vm, "default"_s)); - exportValues.append(eventEmitterModuleCJS); -} - -} // namespace Zig |