54ef906832
* perf: use an internal module resolver instead of relative requires * perf: memoize the results of getting exported Electron properties * perf: make internal module changes consistent across sandboxed / bundled files
21 lines
504 B
JavaScript
21 lines
504 B
JavaScript
const common = require('@electron/internal/common/api/exports/electron')
|
|
const moduleList = require('@electron/internal/renderer/api/module-list')
|
|
|
|
// Import common modules.
|
|
common.defineProperties(exports)
|
|
|
|
for (const {
|
|
name,
|
|
file,
|
|
enabled = true,
|
|
private: isPrivate = false
|
|
} of moduleList) {
|
|
if (!enabled) {
|
|
continue
|
|
}
|
|
|
|
Object.defineProperty(exports, name, {
|
|
enumerable: !isPrivate,
|
|
get: common.memoizedGetter(() => require(`@electron/internal/renderer/api/${file}`))
|
|
})
|
|
}
|