mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
28 lines
662 B
C++
28 lines
662 B
C++
/*
|
|
*/
|
|
#include <bun-native-bundler-plugin-api/bundler_plugin.h>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <node_api.h>
|
|
|
|
#ifdef _WIN32
|
|
#define BUN_PLUGIN_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define BUN_PLUGIN_EXPORT
|
|
#endif
|
|
|
|
napi_value HelloWorld(napi_env env, napi_callback_info info) {
|
|
napi_value result;
|
|
napi_create_string_utf8(env, "hello world", NAPI_AUTO_LENGTH, &result);
|
|
return result;
|
|
}
|
|
|
|
napi_value Init(napi_env env, napi_value exports) {
|
|
napi_value fn;
|
|
napi_create_function(env, nullptr, 0, HelloWorld, nullptr, &fn);
|
|
napi_set_named_property(env, exports, "helloWorld", fn);
|
|
return exports;
|
|
}
|
|
|
|
NAPI_MODULE(NODE_GYP_MODULE_NAME, Init)
|