Clean up indent eslint errors
This commit is contained in:
parent
45ddbb6d67
commit
4f4456bde8
3 changed files with 561 additions and 561 deletions
|
@ -1,15 +1,15 @@
|
|||
(function () {
|
||||
const asar = process.binding('atom_common_asar');
|
||||
const child_process = require('child_process');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
const asar = process.binding('atom_common_asar');
|
||||
const child_process = require('child_process');
|
||||
const path = require('path');
|
||||
const util = require('util');
|
||||
|
||||
var hasProp = {}.hasOwnProperty;
|
||||
var hasProp = {}.hasOwnProperty;
|
||||
|
||||
// Cache asar archive objects.
|
||||
var cachedArchives = {};
|
||||
// Cache asar archive objects.
|
||||
var cachedArchives = {};
|
||||
|
||||
var getOrCreateArchive = function(p) {
|
||||
var getOrCreateArchive = function(p) {
|
||||
var archive;
|
||||
archive = cachedArchives[p];
|
||||
if (archive != null) {
|
||||
|
@ -20,10 +20,10 @@ var getOrCreateArchive = function(p) {
|
|||
return false;
|
||||
}
|
||||
return cachedArchives[p] = archive;
|
||||
};
|
||||
};
|
||||
|
||||
// Clean cache on quit.
|
||||
process.on('exit', function() {
|
||||
// Clean cache on quit.
|
||||
process.on('exit', function() {
|
||||
var archive, p, results;
|
||||
results = [];
|
||||
for (p in cachedArchives) {
|
||||
|
@ -32,10 +32,10 @@ process.on('exit', function() {
|
|||
results.push(archive.destroy());
|
||||
}
|
||||
return results;
|
||||
});
|
||||
});
|
||||
|
||||
// Separate asar package's path from full path.
|
||||
var splitPath = function(p) {
|
||||
// Separate asar package's path from full path.
|
||||
var splitPath = function(p) {
|
||||
var index;
|
||||
|
||||
// shortcut to disable asar.
|
||||
|
@ -55,18 +55,18 @@ var splitPath = function(p) {
|
|||
return [false];
|
||||
}
|
||||
return [true, p.substr(0, index + 5), p.substr(index + 6)];
|
||||
};
|
||||
};
|
||||
|
||||
// Convert asar archive's Stats object to fs's Stats object.
|
||||
var nextInode = 0;
|
||||
// Convert asar archive's Stats object to fs's Stats object.
|
||||
var nextInode = 0;
|
||||
|
||||
var uid = process.getuid != null ? process.getuid() : 0;
|
||||
var uid = process.getuid != null ? process.getuid() : 0;
|
||||
|
||||
var gid = process.getgid != null ? process.getgid() : 0;
|
||||
var gid = process.getgid != null ? process.getgid() : 0;
|
||||
|
||||
var fakeTime = new Date();
|
||||
var fakeTime = new Date();
|
||||
|
||||
var asarStatsToFsStats = function(stats) {
|
||||
var asarStatsToFsStats = function(stats) {
|
||||
return {
|
||||
dev: 1,
|
||||
ino: ++nextInode,
|
||||
|
@ -102,10 +102,10 @@ var asarStatsToFsStats = function(stats) {
|
|||
return false;
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Create a ENOENT error.
|
||||
var notFoundError = function(asarPath, filePath, callback) {
|
||||
// Create a ENOENT error.
|
||||
var notFoundError = function(asarPath, filePath, callback) {
|
||||
var error;
|
||||
error = new Error("ENOENT, " + filePath + " not found in " + asarPath);
|
||||
error.code = "ENOENT";
|
||||
|
@ -116,10 +116,10 @@ var notFoundError = function(asarPath, filePath, callback) {
|
|||
return process.nextTick(function() {
|
||||
return callback(error);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// Create a ENOTDIR error.
|
||||
var notDirError = function(callback) {
|
||||
// Create a ENOTDIR error.
|
||||
var notDirError = function(callback) {
|
||||
var error;
|
||||
error = new Error('ENOTDIR, not a directory');
|
||||
error.code = 'ENOTDIR';
|
||||
|
@ -130,10 +130,10 @@ var notDirError = function(callback) {
|
|||
return process.nextTick(function() {
|
||||
return callback(error);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// Create invalid archive error.
|
||||
var invalidArchiveError = function(asarPath, callback) {
|
||||
// Create invalid archive error.
|
||||
var invalidArchiveError = function(asarPath, callback) {
|
||||
var error;
|
||||
error = new Error("Invalid package " + asarPath);
|
||||
if (typeof callback !== 'function') {
|
||||
|
@ -142,10 +142,10 @@ var invalidArchiveError = function(asarPath, callback) {
|
|||
return process.nextTick(function() {
|
||||
return callback(error);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// Override APIs that rely on passing file path instead of content to C++.
|
||||
var overrideAPISync = function(module, name, arg) {
|
||||
// Override APIs that rely on passing file path instead of content to C++.
|
||||
var overrideAPISync = function(module, name, arg) {
|
||||
var old;
|
||||
if (arg == null) {
|
||||
arg = 0;
|
||||
|
@ -169,9 +169,9 @@ var overrideAPISync = function(module, name, arg) {
|
|||
arguments[arg] = newPath;
|
||||
return old.apply(this, arguments);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
var overrideAPI = function(module, name, arg) {
|
||||
var overrideAPI = function(module, name, arg) {
|
||||
var old;
|
||||
if (arg == null) {
|
||||
arg = 0;
|
||||
|
@ -199,10 +199,10 @@ var overrideAPI = function(module, name, arg) {
|
|||
arguments[arg] = newPath;
|
||||
return old.apply(this, arguments);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Override fs APIs.
|
||||
exports.wrapFsWithAsar = function(fs) {
|
||||
// Override fs APIs.
|
||||
exports.wrapFsWithAsar = function(fs) {
|
||||
var exists, existsSync, internalModuleReadFile, internalModuleStat, lstat, lstatSync, mkdir, mkdirSync, open, openSync, readFile, readFileSync, readdir, readdirSync, realpath, realpathSync, stat, statSync, statSyncNoException;
|
||||
lstatSync = fs.lstatSync;
|
||||
fs.lstatSync = function(p) {
|
||||
|
@ -583,5 +583,5 @@ exports.wrapFsWithAsar = function(fs) {
|
|||
overrideAPISync(require('module')._extensions, '.node', 1);
|
||||
overrideAPISync(fs, 'openSync');
|
||||
return overrideAPISync(child_process, 'execFileSync');
|
||||
};
|
||||
};
|
||||
})()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(function () {
|
||||
return function(process, require, asarSource) {
|
||||
return function(process, require, asarSource) {
|
||||
var createArchive, source;
|
||||
createArchive = process.binding('atom_common_asar').createArchive;
|
||||
|
||||
|
@ -13,5 +13,5 @@ return function(process, require, asarSource) {
|
|||
source = process.binding('natives');
|
||||
source['original-fs'] = source.fs;
|
||||
return source['fs'] = "var src = '(function (exports, require, module, __filename, __dirname) { ' +\n process.binding('natives')['original-fs'] +\n ' });';\nvar vm = require('vm');\nvar fn = vm.runInThisContext(src, { filename: 'fs.js' });\nfn(exports, require, module);\nvar asar = require('ATOM_SHELL_ASAR');\nasar.wrapFsWithAsar(exports);";
|
||||
};
|
||||
};
|
||||
})()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"rules": {
|
||||
"indent": [
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
{
|
||||
"SwitchCase": 1
|
||||
|
|
Loading…
Reference in a new issue