Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,32 @@
#include "node.h"
#include "v8.h"
#include <assert.h>
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::Value;
namespace {
void MakeCallback(const FunctionCallbackInfo<Value>& args) {
assert(args[0]->IsObject());
assert(args[1]->IsFunction());
Isolate* isolate = args.GetIsolate();
Local<Object> recv = args[0].As<Object>();
Local<Function> method = args[1].As<Function>();
node::MakeCallback(isolate, recv, method, 0, nullptr,
node::async_context{0, 0});
}
void Initialize(Local<Object> exports) {
NODE_SET_METHOD(exports, "makeCallback", MakeCallback);
}
} // namespace
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)

View File

@ -0,0 +1,9 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
}
]
}

View File

@ -0,0 +1,43 @@
'use strict';
const common = require('../../common');
const assert = require('assert');
const domain = require('domain');
const binding = require(`./build/${common.buildType}/binding`);
function makeCallback(object, cb) {
binding.makeCallback(object, function someMethod() { setImmediate(cb); });
}
let latestWarning = null;
process.on('warning', (warning) => {
latestWarning = warning;
});
const d = domain.create();
class Resource {
constructor(domain) {
this.domain = domain;
}
}
// When domain is disabled, no warning will be emitted
makeCallback(new Resource(d), common.mustCall(() => {
assert.strictEqual(latestWarning, null);
d.run(common.mustCall(() => {
// No warning will be emitted when no domain property is applied
makeCallback({}, common.mustCall(() => {
assert.strictEqual(latestWarning, null);
// Warning is emitted when domain property is used and domain is enabled
makeCallback(new Resource(d), common.mustCall(() => {
assert.match(latestWarning.message,
/Triggered by calling someMethod on Resource\./);
assert.strictEqual(latestWarning.name, 'DeprecationWarning');
assert.strictEqual(latestWarning.code, 'DEP0097');
}));
}));
}));
}));