Clean up no-unused-vars lint errors
This commit is contained in:
parent
ccce284a5b
commit
70bcb0ac5a
36 changed files with 228 additions and 344 deletions
|
@ -203,7 +203,7 @@
|
|||
|
||||
// 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;
|
||||
var exists, existsSync, internalModuleReadFile, internalModuleStat, lstat, lstatSync, mkdir, mkdirSync, readFile, readFileSync, readdir, readdirSync, realpath, realpathSync, stat, statSync, statSyncNoException;
|
||||
lstatSync = fs.lstatSync;
|
||||
fs.lstatSync = function(p) {
|
||||
var archive, asarPath, filePath, isAsar, ref, stats;
|
||||
|
@ -242,8 +242,7 @@
|
|||
};
|
||||
statSync = fs.statSync;
|
||||
fs.statSync = function(p) {
|
||||
var asarPath, filePath, isAsar, ref;
|
||||
ref = splitPath(p), isAsar = ref[0], asarPath = ref[1], filePath = ref[2];
|
||||
var isAsar = splitPath(p)[0];
|
||||
if (!isAsar) {
|
||||
return statSync(p);
|
||||
}
|
||||
|
@ -253,8 +252,7 @@
|
|||
};
|
||||
stat = fs.stat;
|
||||
fs.stat = function(p, callback) {
|
||||
var asarPath, filePath, isAsar, ref;
|
||||
ref = splitPath(p), isAsar = ref[0], asarPath = ref[1], filePath = ref[2];
|
||||
var isAsar = splitPath(p)[0];
|
||||
if (!isAsar) {
|
||||
return stat(p, callback);
|
||||
}
|
||||
|
@ -352,7 +350,6 @@
|
|||
}
|
||||
return archive.stat(filePath) !== false;
|
||||
};
|
||||
open = fs.open;
|
||||
readFile = fs.readFile;
|
||||
fs.readFile = function(p, options, callback) {
|
||||
var archive, asarPath, buffer, encoding, fd, filePath, info, isAsar, realPath, ref;
|
||||
|
@ -402,10 +399,8 @@
|
|||
return callback(error, encoding ? buffer.toString(encoding) : buffer);
|
||||
});
|
||||
};
|
||||
openSync = fs.openSync;
|
||||
readFileSync = fs.readFileSync;
|
||||
fs.readFileSync = function(p, opts) {
|
||||
|
||||
// this allows v8 to optimize this function
|
||||
var archive, asarPath, buffer, encoding, fd, filePath, info, isAsar, options, realPath, ref;
|
||||
options = opts;
|
||||
|
@ -557,11 +552,11 @@
|
|||
if (process.platform === 'win32') {
|
||||
mkdir = fs.mkdir;
|
||||
fs.mkdir = function(p, mode, callback) {
|
||||
var asarPath, filePath, isAsar, ref;
|
||||
var filePath, isAsar, ref;
|
||||
if (typeof mode === 'function') {
|
||||
callback = mode;
|
||||
}
|
||||
ref = splitPath(p), isAsar = ref[0], asarPath = ref[1], filePath = ref[2];
|
||||
ref = splitPath(p), isAsar = ref[0], filePath = ref[2];
|
||||
if (isAsar && filePath.length) {
|
||||
return notDirError(callback);
|
||||
}
|
||||
|
@ -569,8 +564,8 @@
|
|||
};
|
||||
mkdirSync = fs.mkdirSync;
|
||||
fs.mkdirSync = function(p, mode) {
|
||||
var asarPath, filePath, isAsar, ref;
|
||||
ref = splitPath(p), isAsar = ref[0], asarPath = ref[1], filePath = ref[2];
|
||||
var filePath, isAsar, ref;
|
||||
ref = splitPath(p), isAsar = ref[0], filePath = ref[2];
|
||||
if (isAsar && filePath.length) {
|
||||
notDirError();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
(function () {
|
||||
return function(process, require, asarSource) {
|
||||
var createArchive, source;
|
||||
createArchive = process.binding('atom_common_asar').createArchive;
|
||||
|
||||
// Make asar.coffee accessible via "require".
|
||||
process.binding('natives').ATOM_SHELL_ASAR = asarSource;
|
||||
|
||||
|
@ -10,7 +7,7 @@
|
|||
require('ATOM_SHELL_ASAR').wrapFsWithAsar(require('fs'));
|
||||
|
||||
// Make graceful-fs work with asar.
|
||||
source = process.binding('natives');
|
||||
var 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,14 +1,11 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const timers = require('timers');
|
||||
const Module = require('module');
|
||||
|
||||
process.atomBinding = function(name) {
|
||||
var e, error;
|
||||
try {
|
||||
return process.binding("atom_" + process.type + "_" + name);
|
||||
} catch (error) {
|
||||
e = error;
|
||||
if (/No such module/.test(e.message)) {
|
||||
return process.binding("atom_common_" + name);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue