debugging add module support
This commit is contained in:
@@ -4644,6 +4644,18 @@ function initNativeEnvironment(source) {
|
||||
const msg = JSON.parse(data);
|
||||
const payload = msg.payload;
|
||||
switch (msg.cmd) {
|
||||
case "":
|
||||
const { name, content } = payload;
|
||||
Reflect.apply(jsRegisterModule, undefined, [
|
||||
name,
|
||||
Reflect.apply((function (__module) {
|
||||
eval(`(function (module, exports, require) {
|
||||
${content}
|
||||
})(__module, __module.exports, doric.__require__)`);
|
||||
return __module.exports;
|
||||
}), undefined, [{ exports: {} }])
|
||||
]);
|
||||
break;
|
||||
case "DEBUG_RES":
|
||||
const contextId = msg.payload.contextId;
|
||||
resolve(contextId);
|
||||
|
@@ -53,6 +53,24 @@ async function initNativeEnvironment(source: string) {
|
||||
const msg = JSON.parse(data as string) as MSG
|
||||
const payload = msg.payload
|
||||
switch (msg.cmd) {
|
||||
case "":
|
||||
const { name, content } = payload as {
|
||||
name: string,
|
||||
content: string
|
||||
}
|
||||
Reflect.apply(
|
||||
doric.jsRegisterModule,
|
||||
undefined,
|
||||
[
|
||||
name,
|
||||
Reflect.apply((function (__module: { exports: object }) {
|
||||
eval(`(function (module, exports, require) {
|
||||
${content}
|
||||
})(__module, __module.exports, doric.__require__)`)
|
||||
return __module.exports
|
||||
}), undefined, [{ exports: {} }])
|
||||
]);
|
||||
break;
|
||||
case "DEBUG_RES":
|
||||
const contextId = msg.payload.contextId as string;
|
||||
resolve(contextId);
|
||||
|
@@ -54,6 +54,18 @@ function initNativeEnvironment(source) {
|
||||
const msg = JSON.parse(data);
|
||||
const payload = msg.payload;
|
||||
switch (msg.cmd) {
|
||||
case "":
|
||||
const { name, content } = payload;
|
||||
Reflect.apply(doric.jsRegisterModule, undefined, [
|
||||
name,
|
||||
Reflect.apply((function (__module) {
|
||||
eval(`(function (module, exports, require) {
|
||||
${content}
|
||||
})(__module, __module.exports, doric.__require__)`);
|
||||
return __module.exports;
|
||||
}), undefined, [{ exports: {} }])
|
||||
]);
|
||||
break;
|
||||
case "DEBUG_RES":
|
||||
const contextId = msg.payload.contextId;
|
||||
resolve(contextId);
|
||||
|
Reference in New Issue
Block a user