737e3de3fa
* Revert "refactor: don't expose deprecate as an internal module (#35311)"
This reverts commit 8424779906
.
* check crashed event warnings
17 lines
599 B
TypeScript
17 lines
599 B
TypeScript
const handleESModule = (loader: ElectronInternal.ModuleLoader) => () => {
|
|
const value = loader();
|
|
if (value.__esModule && value.default) return value.default;
|
|
return value;
|
|
};
|
|
|
|
// Attaches properties to |targetExports|.
|
|
export function defineProperties (targetExports: Object, moduleList: ElectronInternal.ModuleEntry[]) {
|
|
const descriptors: PropertyDescriptorMap = {};
|
|
for (const module of moduleList) {
|
|
descriptors[module.name] = {
|
|
enumerable: !module.private,
|
|
get: handleESModule(module.loader)
|
|
};
|
|
}
|
|
return Object.defineProperties(targetExports, descriptors);
|
|
}
|