aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/runtime.footer.node.js83
-rw-r--r--src/runtime.zig5
3 files changed, 90 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 211226c55..de7bd11c3 100644
--- a/Makefile
+++ b/Makefile
@@ -474,6 +474,8 @@ fallback_decoder:
runtime_js:
@NODE_ENV=production esbuild --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
@NODE_ENV=production esbuild --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-with-refresh.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.out.refresh.js; cat src/runtime.footer.with-refresh.js >> src/runtime.out.refresh.js
+ @NODE_ENV=production esbuild --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.node.pre.out.js; cat src/runtime.node.pre.out.js src/runtime.footer.node.js > src/runtime.node.out.js
+ @NODE_ENV=production esbuild --define:process.env.NODE_ENV="production" --target=esnext --bundle src/runtime/index-without-hmr.ts --format=iife --platform=node --global-name=BUN_RUNTIME --minify --external:/bun:* > src/runtime.bun.pre.out.js; cat src/runtime.bun.pre.out.js src/runtime.footer.bun.js > src/runtime.bun.out.js
runtime_js_dev:
@NODE_ENV=development esbuild --define:process.env.NODE_ENV="development" --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME --external:/bun:* > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js
diff --git a/src/runtime.footer.node.js b/src/runtime.footer.node.js
new file mode 100644
index 000000000..7d2b3a649
--- /dev/null
+++ b/src/runtime.footer.node.js
@@ -0,0 +1,83 @@
+import * as __$module from "node:module";
+export var $$m = BUN_RUNTIME.$$m;
+export var __markAsModule = BUN_RUNTIME.__markAsModule;
+export var $$lzy = BUN_RUNTIME.$$lzy;
+export var __toModule = BUN_RUNTIME.__toModule;
+export var __commonJS = BUN_RUNTIME.__commonJS;
+export var __require = BUN_RUNTIME.__require;
+export var __name = BUN_RUNTIME.__name;
+export var __export = BUN_RUNTIME.__export;
+export var __reExport = BUN_RUNTIME.__reExport;
+export var __cJS2eSM = BUN_RUNTIME.__cJS2eSM;
+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;
+var require = __$module.createRequire(import.meta.url);
+var process =
+ globalThis.process ||
+ new Proxy(
+ {},
+ {
+ get: function (target, prop, receiver) {
+ var _process = require("process");
+ target = process = _process;
+ return Reflect.get(_process, prop, receiver);
+ },
+ apply: function (target, thisArg, argumentsList) {
+ var _process = require("process");
+ target = process = _process;
+ return Reflect.apply(target, thisArg, argumentsList);
+ },
+ defineProperty(target, key, descriptor) {
+ var _process = require("process");
+ target = process = _process;
+ return Reflect.defineProperty(_process, key, descriptor);
+ },
+ construct: function (target, args) {
+ var _process = require("process");
+ target = process = _process;
+ return Reflect.construct(_process, args);
+ },
+ has: function (target, prop, receiver) {
+ var _process = require("process");
+ target = process = _process;
+ return Reflect.has(_process, prop, receiver);
+ },
+ }
+ );
+
+var Buffer =
+ globalThis.Buffer ||
+ new Proxy(
+ {},
+ {
+ get: function (target, prop, receiver) {
+ var NewBuffer = require("buffer").Buffer;
+ target = Buffer = NewBuffer;
+ return Reflect.get(NewBuffer, prop, receiver);
+ },
+ apply: function (target, thisArg, argumentsList) {
+ var NewBuffer = require("buffer").Buffer;
+ target = Buffer = NewBuffer;
+ return Reflect.apply(target, thisArg, argumentsList);
+ },
+ defineProperty(target, key, descriptor) {
+ var NewBuffer = require("buffer").Buffer;
+ target = Buffer = NewBuffer;
+ return Reflect.defineProperty(NewBuffer, key, descriptor);
+ },
+ construct: function (target, args) {
+ var NewBuffer = require("buffer").Buffer;
+ target = Buffer = NewBuffer;
+ return Reflect.construct(NewBuffer, args);
+ },
+ has: function (target, prop, receiver) {
+ var NewBuffer = require("buffer").Buffer;
+ target = Buffer = NewBuffer;
+ return Reflect.has(NewBuffer, prop, receiver);
+ },
+ }
+ );
diff --git a/src/runtime.zig b/src/runtime.zig
index 11862f544..e33b31961 100644
--- a/src/runtime.zig
+++ b/src/runtime.zig
@@ -164,6 +164,7 @@ pub const Fallback = struct {
pub const Runtime = struct {
pub const ProdSourceContent = @embedFile("./runtime.out.js");
+ pub const ProdSourceContentNode = @embedFile("./runtime.node.out.js");
pub const ProdSourceContentBun = @embedFile("./runtime.bun.out.js");
pub const ProdSourceContentWithRefresh = @embedFile("./runtime.out.refresh.js");
@@ -193,6 +194,10 @@ pub const Runtime = struct {
return sourceContentWithoutRefresh();
}
+ pub inline fn sourceContentNode() string {
+ return ProdSourceContentNode;
+ }
+
pub inline fn sourceContentBun() string {
return ProdSourceContentBun;
}