mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 20:09:04 +00:00
[Bun.js] Fix entry point to only call default if it was a CommonJS transformed function
This commit is contained in:
@@ -3482,7 +3482,7 @@ pub const ServerEntryPoint = struct {
|
||||
\\//Auto-generated file
|
||||
\\import * as start from '{s}{s}';
|
||||
\\export * from '{s}{s}';
|
||||
\\if ('default' in start && typeof start.default == 'function') {{
|
||||
\\if ('default' in start && "__internalIsCommonJSNamespace" in globalThis && __internalIsCommonJSNamespace(start)) {{
|
||||
\\ start.default();
|
||||
\\}}
|
||||
,
|
||||
|
||||
@@ -19,6 +19,9 @@ export var regeneratorRuntime = BUN_RUNTIME.regeneratorRuntime;
|
||||
export var __exportValue = BUN_RUNTIME.__exportValue;
|
||||
export var __exportDefault = BUN_RUNTIME.__exportDefault;
|
||||
export var $$bun_runtime_json_parse = JSON.parse;
|
||||
export var __internalIsCommonJSNamespace =
|
||||
BUN_RUNTIME.__internalIsCommonJSNamespace;
|
||||
|
||||
globalThis.__internalIsCommonJSNamespace ||= __internalIsCommonJSNamespace;
|
||||
globalThis.require ||= BUN_RUNTIME.__require;
|
||||
globalThis.self ||= globalThis;
|
||||
|
||||
@@ -136,6 +136,11 @@ export var __commonJS = (cb, name) => {
|
||||
|
||||
export var __cJS2eSM = __commonJS;
|
||||
|
||||
export var __internalIsCommonJSNamespace = (namespace) =>
|
||||
typeof namespace === "object" &&
|
||||
"default" in namespace &&
|
||||
namespace.default[cjsRequireSymbol];
|
||||
|
||||
export var __require = (namespace) => {
|
||||
const namespaceType = typeof namespace;
|
||||
if (namespaceType === "function" && namespace[cjsRequireSymbol])
|
||||
|
||||
@@ -1 +1 @@
|
||||
7be53da538434cb0
|
||||
c6d7615ce951f3ae
|
||||
Reference in New Issue
Block a user