decord/source/56_genModule.js

175 lines
5.6 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 56
// Function ID: 1388
// Name: genModule
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 44, 63, 50]
2026-07-20 16:05:17 +00:00
// Module 56 (genModule)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
let require = arg1;
2026-07-20 16:05:17 +00:00
function genModule(arg0, arg1) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1;
2026-07-20 16:05:17 +00:00
if (arg0) {
const tmp3 = callback(arg0, 5);
const first = tmp3[0];
2026-07-23 10:11:24 +00:00
const require = tmp4;
const dependencyMap = tmp3[3];
callback = tmp3[4];
2026-07-20 16:05:17 +00:00
let tmp8 = !first.startsWith("RCT");
if (tmp8) {
tmp8 = !first.startsWith("RK");
}
2026-07-23 10:11:24 +00:00
require(44) /* invariant */(tmp8, `Module name prefixes should've been stripped by the native side but wasn't for ${obj}`);
2026-07-20 16:05:17 +00:00
if (!tmp3[1]) {
if (!arr) {
2026-07-23 10:11:24 +00:00
obj = { name: first };
2026-07-20 16:05:17 +00:00
return obj;
}
}
obj = {};
if (tmp3[2]) {
const item = arr.forEach((arg0, arg1) => {
2026-07-23 10:11:24 +00:00
let flag = table;
if (table) {
flag = outer1_7(table, arg1);
2026-07-20 16:05:17 +00:00
}
if (!flag) {
flag = false;
}
2026-07-23 10:11:24 +00:00
let flag2 = _slicedToArray;
if (_slicedToArray) {
flag2 = outer1_7(_slicedToArray, arg1);
const tmp4 = _slicedToArray;
2026-07-20 16:05:17 +00:00
}
if (!flag2) {
flag2 = false;
}
let tmp6 = !flag;
if (!tmp6) {
tmp6 = !flag2;
}
2026-07-23 10:11:24 +00:00
tmp4(table[1])(tmp6, "Cannot have a method that is both async and a sync hook");
2026-07-20 16:05:17 +00:00
let str = "promise";
if (!flag) {
let str2 = "async";
if (flag2) {
str2 = "sync";
}
str = str2;
}
2026-07-23 10:11:24 +00:00
obj[arg0] = (function genMethod(closure_0, arg1, type) {
let closure_1 = arg1;
let closure_2 = type;
let tmp = "promise" === type ? (function promiseMethodWrapper() {
2026-07-20 16:05:17 +00:00
const length = arguments.length;
const array = new Array(length);
for (let num = 0; num < length; num = num + 1) {
array[num] = arguments[num];
}
2026-07-23 10:11:24 +00:00
let error = new Error();
return new Promise((closure_0) => {
const error = arg1;
error(table[2]).default.enqueueNativeCall(array, error, closure_0, () => { ... }, () => { ... });
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
}) : (function nonPromiseMethodWrapper() {
2026-07-20 16:05:17 +00:00
const length = arguments.length;
const arr = new Array(length);
for (let num = 0; num < length; num = num + 1) {
arr[num] = arguments[num];
}
let tmp = null;
if (arr.length > 0) {
tmp = arr[arr.length - 1];
}
let tmp2 = null;
if (arr.length > 1) {
tmp2 = arr[arr.length - 2];
}
if ("function" === typeof tmp2) {
2026-07-23 10:11:24 +00:00
callback(type[1])(tmp3, "Cannot have a non-function arg after a function arg.");
2026-07-20 16:05:17 +00:00
}
let tmp8 = null;
if ("function" === typeof tmp) {
tmp8 = tmp;
}
let tmp9 = null;
if ("function" === typeof tmp2) {
tmp9 = tmp2;
}
const substr = arr.slice(0, arr.length - (tmp3 + tmp4));
2026-07-23 10:11:24 +00:00
if ("sync" === type) {
const _default2 = callback(type[2]).default;
return _default2.callNativeSyncHook(closure_0, callback, substr, tmp9, tmp8);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
const _default = callback(type[2]).default;
_default.enqueueNativeCall(closure_0, callback, substr, tmp9, tmp8);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
});
2026-07-20 16:05:17 +00:00
tmp.type = type;
return tmp;
2026-07-23 10:11:24 +00:00
})(closure_0, arg1, str);
2026-07-20 16:05:17 +00:00
});
}
2026-07-23 10:11:24 +00:00
let _Object = Object;
2026-07-20 16:05:17 +00:00
const merged = Object.assign(obj, tmp4);
if (null == obj.getConstants) {
obj.getConstants = () => {
2026-07-23 10:11:24 +00:00
let frozen = closure_1;
if (!closure_1) {
2026-07-20 16:05:17 +00:00
const _Object = Object;
frozen = Object.freeze({});
}
return frozen;
};
} else {
const _console = console;
const _HermesInternal = HermesInternal;
console.warn("Unable to define method 'getConstants()' on NativeModule '" + first + "'. NativeModule '" + first + "' already has a constant or method called 'getConstants'. Please remove it.");
}
const obj1 = { name: first, module: obj };
return obj1;
} else {
return null;
}
}
function arrayContains(arr) {
return -1 !== arr.indexOf(arg1);
}
global.__fbGenNativeModule = genModule;
let obj = {};
let nativeModuleProxy = obj;
if (global.nativeModuleProxy) {
nativeModuleProxy = global.nativeModuleProxy;
obj = nativeModuleProxy;
} else {
const __fbBatchedBridgeConfig = global.__fbBatchedBridgeConfig;
2026-07-23 10:11:24 +00:00
require("invariant")(__fbBatchedBridgeConfig, "__fbBatchedBridgeConfig is not set, cannot invoke native modules");
let closure_5 = require("defineLazyObjectProperty").default;
let item = __fbBatchedBridgeConfig.remoteModuleConfig || [].forEach((arg0, arg1) => {
let closure_0 = arg1;
let tmp = genModule(arg0, arg1);
const require = tmp;
2026-07-20 16:05:17 +00:00
if (tmp) {
if (tmp.module) {
nativeModuleProxy[tmp.name] = tmp.module;
} else {
const obj = {
get() {
2026-07-23 10:11:24 +00:00
tmp = tmp(outer1_2[1])(closure_0.nativeRequireModuleConfig, "Can't lazily create module without nativeRequireModuleConfig");
const tmp2 = outer1_6(closure_0.nativeRequireModuleConfig(tmp.name), closure_0);
2026-07-20 16:05:17 +00:00
let _module = tmp2;
if (tmp2) {
_module = tmp2.module;
}
return _module;
}
};
callback2(nativeModuleProxy, tmp.name, obj);
}
}
});
2026-07-23 10:11:24 +00:00
let arr = __fbBatchedBridgeConfig.remoteModuleConfig || [];
2026-07-20 16:05:17 +00:00
}
export default obj;