This commit is contained in:
parent
91e3421525
commit
cfb6e847a0
7 changed files with 26 additions and 5 deletions
2
DEPS
2
DEPS
|
@ -12,7 +12,7 @@ vars = {
|
|||
'chromium_version':
|
||||
'84c40395c741fa24ccbd9fc2c5828e2e97472952',
|
||||
'node_version':
|
||||
'696d8fb66d6f65fc82869d390e0d2078970b1eb4',
|
||||
'a86a4a160dc520c61a602c949a32a1bc4c0fc633',
|
||||
|
||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||
'pyyaml_version': '3.12',
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
process.type !== 'renderer'
|
||||
const isAsarDisabled = () => process.noAsar || envNoAsar
|
||||
|
||||
const internalBinding = process.internalBinding
|
||||
delete process.internalBinding
|
||||
|
||||
/**
|
||||
* @param {!Function} functionToCall
|
||||
* @param {!Array|undefined} args
|
||||
|
@ -669,8 +672,8 @@
|
|||
return files
|
||||
}
|
||||
|
||||
const { internalModuleReadJSON } = process.binding('fs')
|
||||
process.binding('fs').internalModuleReadJSON = pathArgument => {
|
||||
const { internalModuleReadJSON } = internalBinding('fs')
|
||||
internalBinding('fs').internalModuleReadJSON = pathArgument => {
|
||||
const { isAsar, asarPath, filePath } = splitPath(pathArgument)
|
||||
if (!isAsar) return internalModuleReadJSON(pathArgument)
|
||||
|
||||
|
@ -694,8 +697,8 @@
|
|||
return buffer.toString('utf8')
|
||||
}
|
||||
|
||||
const { internalModuleStat } = process.binding('fs')
|
||||
process.binding('fs').internalModuleStat = pathArgument => {
|
||||
const { internalModuleStat } = internalBinding('fs')
|
||||
internalBinding('fs').internalModuleStat = pathArgument => {
|
||||
const { isAsar, asarPath, filePath } = splitPath(pathArgument)
|
||||
if (!isAsar) return internalModuleStat(pathArgument)
|
||||
|
||||
|
|
BIN
spec/fixtures/api/electron-main-module/app.asar
vendored
Normal file
BIN
spec/fixtures/api/electron-main-module/app.asar
vendored
Normal file
Binary file not shown.
8
spec/fixtures/api/electron-main-module/app/index.js
vendored
Normal file
8
spec/fixtures/api/electron-main-module/app/index.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
try {
|
||||
require('some-module')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
process.exit(0)
|
1
spec/fixtures/api/electron-main-module/app/node_modules/some-module/main2.js
generated
vendored
Normal file
1
spec/fixtures/api/electron-main-module/app/node_modules/some-module/main2.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
// Nothing to do here
|
4
spec/fixtures/api/electron-main-module/app/node_modules/some-module/package.json
generated
vendored
Normal file
4
spec/fixtures/api/electron-main-module/app/node_modules/some-module/package.json
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "some-module",
|
||||
"main": "./main2.js"
|
||||
}
|
|
@ -578,4 +578,9 @@ describe('node feature', () => {
|
|||
.that.is.a('string')
|
||||
.and.matches(/^\d+\.\d+\.\d+\.\d+$/)
|
||||
})
|
||||
|
||||
it('can find a module using a package.json main field', () => {
|
||||
const result = ChildProcess.spawnSync(remote.process.execPath, [path.resolve(fixtures, 'api', 'electron-main-module', 'app.asar')])
|
||||
expect(result.status).to.equal(0)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue