aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/CommonJSModuleRecord.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/CommonJSModuleRecord.h')
-rw-r--r--src/bun.js/bindings/CommonJSModuleRecord.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/bun.js/bindings/CommonJSModuleRecord.h b/src/bun.js/bindings/CommonJSModuleRecord.h
index 20941f454..e38d2e083 100644
--- a/src/bun.js/bindings/CommonJSModuleRecord.h
+++ b/src/bun.js/bindings/CommonJSModuleRecord.h
@@ -1,3 +1,4 @@
+#pragma once
#include "root.h"
#include "headers-handwritten.h"
@@ -22,7 +23,7 @@ public:
static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::OverridesPut;
mutable JSC::WriteBarrier<JSC::JSString> m_id;
- mutable JSC::WriteBarrier<JSC::JSString> m_filename;
+ mutable JSC::WriteBarrier<JSC::Unknown> m_filename;
mutable JSC::WriteBarrier<JSC::JSString> m_dirname;
mutable JSC::WriteBarrier<Unknown> m_paths;
mutable JSC::WriteBarrier<JSC::JSSourceCode> sourceCode;
@@ -32,18 +33,22 @@ public:
~JSCommonJSModule();
void finishCreation(JSC::VM& vm,
- JSC::JSString* id, JSC::JSString* filename,
+ JSC::JSString* id, JSValue filename,
JSC::JSString* dirname, JSC::JSSourceCode* sourceCode);
static JSC::Structure* createStructure(JSC::JSGlobalObject* globalObject);
- bool evaluate(Zig::GlobalObject* globalObject, const WTF::String& sourceURL, ResolvedSource resolvedSource);
+ bool evaluate(Zig::GlobalObject* globalObject, const WTF::String& sourceURL, ResolvedSource resolvedSource, bool isBuiltIn);
+ inline bool evaluate(Zig::GlobalObject* globalObject, const WTF::String& sourceURL, ResolvedSource resolvedSource)
+ {
+ return evaluate(globalObject, sourceURL, resolvedSource, false);
+ }
bool evaluate(Zig::GlobalObject* globalObject, const WTF::String& key, const SyntheticSourceProvider::SyntheticSourceGenerator& generator);
bool evaluate(Zig::GlobalObject* globalObject, const WTF::String& key, JSSourceCode* sourceCode);
static JSCommonJSModule* create(JSC::VM& vm, JSC::Structure* structure,
JSC::JSString* id,
- JSC::JSString* filename,
+ JSValue filename,
JSC::JSString* dirname, JSC::JSSourceCode* sourceCode);
static JSCommonJSModule* create(
@@ -96,7 +101,15 @@ JSC::Structure* createCommonJSModuleStructure(
std::optional<JSC::SourceCode> createCommonJSModule(
Zig::GlobalObject* globalObject,
- ResolvedSource source);
+ ResolvedSource source,
+ bool isBuiltIn);
+
+inline std::optional<JSC::SourceCode> createCommonJSModule(
+ Zig::GlobalObject* globalObject,
+ ResolvedSource source)
+{
+ return createCommonJSModule(globalObject, source, false);
+}
class RequireResolveFunctionPrototype final : public JSC::JSNonFinalObject {
public: