mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Mark some more commonjs modules
This commit is contained in:
@@ -1,15 +1,33 @@
|
||||
#include "../bindings/ZigGlobalObject.h"
|
||||
#include "../bindings/JSStringDecoder.h"
|
||||
#include "../bindings/ZigGlobalObject.h"
|
||||
#include "JavaScriptCore/JSGlobalObject.h"
|
||||
|
||||
namespace Zig {
|
||||
|
||||
inline void generateStringDecoderSourceCode(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);
|
||||
inline void
|
||||
generateStringDecoderSourceCode(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, "StringDecoder"_s));
|
||||
exportValues.append(globalObject->JSStringDecoder());
|
||||
exportNames.append(JSC::Identifier::fromString(vm, "StringDecoder"_s));
|
||||
exportValues.append(globalObject->JSStringDecoder());
|
||||
|
||||
JSC::JSObject *defaultObject = constructEmptyObject(globalObject);
|
||||
defaultObject->putDirect(vm,
|
||||
PropertyName(Identifier::fromUid(
|
||||
vm.symbolRegistry().symbolForKey("CommonJS"_s))),
|
||||
jsNumber(0), 0);
|
||||
|
||||
for (size_t i = 0; i < exportNames.size(); i++) {
|
||||
defaultObject->putDirect(vm, exportNames[i], exportValues.at(i), 0);
|
||||
}
|
||||
|
||||
exportNames.append(vm.propertyNames->defaultKeyword);
|
||||
exportValues.append(defaultObject);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Zig
|
||||
|
||||
@@ -62,6 +62,15 @@ inline void generateTTYSourceCode(JSC::JSGlobalObject *lexicalGlobalObject,
|
||||
tty->putDirect(vm, JSC::Identifier::fromString(vm, "WriteStream"_s), notimpl);
|
||||
exportValues.append(notimpl);
|
||||
|
||||
tty->putDirect(vm,
|
||||
PropertyName(Identifier::fromUid(
|
||||
vm.symbolRegistry().symbolForKey("CommonJS"_s))),
|
||||
jsNumber(0), 0);
|
||||
|
||||
for (size_t i = 0; i < exportNames.size(); i++) {
|
||||
tty->putDirect(vm, exportNames[i], exportValues.at(i), 0);
|
||||
}
|
||||
|
||||
exportNames.append(vm.propertyNames->defaultKeyword);
|
||||
exportValues.append(tty);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user