2018-09-23 00:28:50 +12:00
|
|
|
'use strict'
|
|
|
|
|
2018-09-16 03:51:23 +10:00
|
|
|
;(function () { // eslint-disable-line
|
2018-10-26 16:22:05 +11:00
|
|
|
return function (source, require, asarSource) {
|
2018-04-07 20:43:32 +05:30
|
|
|
// Expose fs module without asar support.
|
2018-12-12 15:32:53 -06:00
|
|
|
|
|
|
|
// NB: Node's 'fs' and 'internal/fs/streams' have a lazy-loaded circular
|
|
|
|
// dependency. So to expose the unmodified Node 'fs' functionality here,
|
|
|
|
// we have to copy both 'fs' *and* 'internal/fs/streams' and modify the
|
|
|
|
// copies to depend on each other instead of on our asarified 'fs' code.
|
|
|
|
source['original-fs'] = source.fs.replace("require('internal/fs/streams')", "require('original-fs/streams')")
|
|
|
|
source['original-fs/streams'] = source['internal/fs/streams'].replace("require('fs')", "require('original-fs')")
|
2018-04-07 20:43:32 +05:30
|
|
|
|
2016-05-23 10:28:32 -07:00
|
|
|
// Make asar.js accessible via "require".
|
2018-04-07 20:43:32 +05:30
|
|
|
source.ELECTRON_ASAR = asarSource
|
2016-01-11 18:40:23 -08:00
|
|
|
|
2016-01-19 10:25:03 -08:00
|
|
|
// Monkey-patch the fs module.
|
2016-04-08 08:53:58 -07:00
|
|
|
require('ELECTRON_ASAR').wrapFsWithAsar(require('fs'))
|
2016-03-25 12:57:17 -07:00
|
|
|
}
|
|
|
|
})()
|