Comparing version 0.12.1 to 0.12.2
@@ -46,2 +46,3 @@ (function() { | ||
/* | ||
@@ -55,7 +56,6 @@ createPackageFromFiles - Create an asar-archive from a list of filenames | ||
callback: The callback function. Accepts (err). | ||
*/ | ||
*/ | ||
module.exports.createPackageFromFiles = function(src, dest, filenames, metadata, options, callback) { | ||
var file, filenamesSorted, files, filesystem, handleFile, insertsDone, missing, names, next, ordering, orderingFiles, pathComponent, pathComponents, str, total, _i, _j, _k, _l, _len, _len1, _len2, _len3; | ||
var file, filenamesSorted, files, filesystem, handleFile, i, insertsDone, j, k, l, len, len1, len2, len3, missing, names, next, ordering, orderingFiles, pathComponent, pathComponents, str, total; | ||
if (metadata == null) { | ||
@@ -78,8 +78,8 @@ metadata = {}; | ||
ordering = []; | ||
for (_i = 0, _len = orderingFiles.length; _i < _len; _i++) { | ||
file = orderingFiles[_i]; | ||
for (i = 0, len = orderingFiles.length; i < len; i++) { | ||
file = orderingFiles[i]; | ||
pathComponents = file.split(path.sep); | ||
str = src; | ||
for (_j = 0, _len1 = pathComponents.length; _j < _len1; _j++) { | ||
pathComponent = pathComponents[_j]; | ||
for (j = 0, len1 = pathComponents.length; j < len1; j++) { | ||
pathComponent = pathComponents[j]; | ||
str = path.join(str, pathComponent); | ||
@@ -92,4 +92,4 @@ ordering.push(str); | ||
total = filenames.length; | ||
for (_k = 0, _len2 = ordering.length; _k < _len2; _k++) { | ||
file = ordering[_k]; | ||
for (k = 0, len2 = ordering.length; k < len2; k++) { | ||
file = ordering[k]; | ||
if (filenamesSorted.indexOf(file) === -1 && filenames.indexOf(file) !== -1) { | ||
@@ -99,4 +99,4 @@ filenamesSorted.push(file); | ||
} | ||
for (_l = 0, _len3 = filenames.length; _l < _len3; _l++) { | ||
file = filenames[_l]; | ||
for (l = 0, len3 = filenames.length; l < len3; l++) { | ||
file = filenames[l]; | ||
if (filenamesSorted.indexOf(file) === -1) { | ||
@@ -203,3 +203,3 @@ filenamesSorted.push(file); | ||
module.exports.extractAll = function(archive, dest) { | ||
var content, destFilename, error, file, filename, filenames, filesystem, followLinks, linkDestPath, linkSrcPath, linkTo, relativePath, _i, _len, _results; | ||
var content, destFilename, error, file, filename, filenames, filesystem, followLinks, i, len, linkDestPath, linkSrcPath, linkTo, relativePath, results; | ||
filesystem = disk.readFilesystemSync(archive); | ||
@@ -209,5 +209,5 @@ filenames = filesystem.listFiles(); | ||
mkdirp.sync(dest); | ||
_results = []; | ||
for (_i = 0, _len = filenames.length; _i < _len; _i++) { | ||
filename = filenames[_i]; | ||
results = []; | ||
for (i = 0, len = filenames.length; i < len; i++) { | ||
filename = filenames[i]; | ||
filename = filename.substr(1); | ||
@@ -217,3 +217,3 @@ destFilename = path.join(dest, filename); | ||
if (file.files) { | ||
_results.push(mkdirp.sync(destFilename)); | ||
results.push(mkdirp.sync(destFilename)); | ||
} else if (file.link) { | ||
@@ -229,11 +229,11 @@ linkSrcPath = path.dirname(path.join(dest, file.link)); | ||
linkTo = path.join(relativePath, path.basename(file.link)); | ||
_results.push(fs.symlinkSync(linkTo, destFilename)); | ||
results.push(fs.symlinkSync(linkTo, destFilename)); | ||
} else { | ||
content = disk.readFileSync(filesystem, filename, file); | ||
_results.push(fs.writeFileSync(destFilename, content)); | ||
results.push(fs.writeFileSync(destFilename, content)); | ||
} | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
}).call(this); |
@@ -12,8 +12,8 @@ (function() { | ||
return glob(dir + '/**/*', options, function(error, filenames) { | ||
var filename, stat, _i, _len; | ||
var filename, i, len, stat; | ||
if (error) { | ||
return callback(error); | ||
} | ||
for (_i = 0, _len = filenames.length; _i < _len; _i++) { | ||
filename = filenames[_i]; | ||
for (i = 0, len = filenames.length; i < len; i++) { | ||
filename = filenames[i]; | ||
stat = fs.lstatSync(filename); | ||
@@ -20,0 +20,0 @@ if (stat.isFile()) { |
@@ -38,3 +38,3 @@ (function() { | ||
try { | ||
copyFileToSync("" + dest + ".unpacked", filesystem.src, filename); | ||
copyFileToSync(dest + ".unpacked", filesystem.src, filename); | ||
} catch (_error) { | ||
@@ -123,3 +123,3 @@ error = _error; | ||
if (info.unpacked) { | ||
buffer = fs.readFileSync(path.join("" + filesystem.src + ".unpacked", filename)); | ||
buffer = fs.readFileSync(path.join(filesystem.src + ".unpacked", filename)); | ||
} else { | ||
@@ -126,0 +126,0 @@ fd = fs.openSync(filesystem.src, 'r'); |
@@ -22,7 +22,7 @@ (function() { | ||
Filesystem.prototype.searchNodeFromDirectory = function(p) { | ||
var dir, dirs, json, _i, _len; | ||
var dir, dirs, i, json, len; | ||
json = this.header; | ||
dirs = p.split(path.sep); | ||
for (_i = 0, _len = dirs.length; _i < _len; _i++) { | ||
dir = dirs[_i]; | ||
for (i = 0, len = dirs.length; i < len; i++) { | ||
dir = dirs[i]; | ||
if (dir !== '.') { | ||
@@ -36,3 +36,3 @@ json = json.files[dir]; | ||
Filesystem.prototype.searchNodeFromPath = function(p) { | ||
var name, node, _base; | ||
var base, name, node; | ||
p = path.relative(this.src, p); | ||
@@ -47,4 +47,4 @@ if (!p) { | ||
} | ||
if ((_base = node.files)[name] == null) { | ||
_base[name] = {}; | ||
if ((base = node.files)[name] == null) { | ||
base[name] = {}; | ||
} | ||
@@ -64,4 +64,3 @@ return node.files[name]; | ||
Filesystem.prototype.insertFile = function(p, shouldUnpack, file, options, callback) { | ||
var dirNode, handler, node, tr, | ||
_this = this; | ||
var dirNode, handler, node, tr; | ||
dirNode = this.searchNodeFromPath(path.dirname(p)); | ||
@@ -75,16 +74,18 @@ node = this.searchNodeFromPath(p); | ||
} | ||
handler = function() { | ||
var size; | ||
size = file.transformed ? file.transformed.stat.size : file.stat.size; | ||
if (size > 4294967295) { | ||
throw new Error("" + p + ": file size can not be larger than 4.2GB"); | ||
} | ||
node.size = size; | ||
node.offset = _this.offset.toString(); | ||
if (process.platform !== 'win32' && file.stat.mode & 0x40) { | ||
node.executable = true; | ||
} | ||
_this.offset.add(UINT64(size)); | ||
return callback(); | ||
}; | ||
handler = (function(_this) { | ||
return function() { | ||
var size; | ||
size = file.transformed ? file.transformed.stat.size : file.stat.size; | ||
if (size > 4294967295) { | ||
throw new Error(p + ": file size can not be larger than 4.2GB"); | ||
} | ||
node.size = size; | ||
node.offset = _this.offset.toString(); | ||
if (process.platform !== 'win32' && file.stat.mode & 0x40) { | ||
node.executable = true; | ||
} | ||
_this.offset.add(UINT64(size)); | ||
return callback(); | ||
}; | ||
})(this); | ||
tr = options.transform && options.transform(p); | ||
@@ -117,3 +118,3 @@ if (tr) { | ||
if (link.substr(0, 2) === '..') { | ||
throw new Error("" + p + ": file links out of the package"); | ||
throw new Error(p + ": file links out of the package"); | ||
} | ||
@@ -128,13 +129,13 @@ node = this.searchNodeFromPath(p); | ||
fillFilesFromHeader = function(p, json) { | ||
var f, fullPath, _results; | ||
var f, fullPath, results; | ||
if (!json.files) { | ||
return; | ||
} | ||
_results = []; | ||
results = []; | ||
for (f in json.files) { | ||
fullPath = path.join(p, f); | ||
files.push(fullPath); | ||
_results.push(fillFilesFromHeader(fullPath, json.files[f])); | ||
results.push(fillFilesFromHeader(fullPath, json.files[f])); | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -141,0 +142,0 @@ fillFilesFromHeader('/', this.header); |
@@ -36,8 +36,8 @@ (function() { | ||
createSnapshot = function(src, dest, filenames, metadata, options, callback) { | ||
var arch, builddir, compiled, content, error, file, filename, relativeFilename, script, snapshotdir, str, target, version, _i, _len; | ||
var arch, builddir, compiled, content, error, file, filename, i, len, relativeFilename, script, snapshotdir, str, target, version; | ||
try { | ||
src = path.resolve(src); | ||
content = {}; | ||
for (_i = 0, _len = filenames.length; _i < _len; _i++) { | ||
filename = filenames[_i]; | ||
for (i = 0, len = filenames.length; i < len; i++) { | ||
filename = filenames[i]; | ||
file = metadata[filename]; | ||
@@ -44,0 +44,0 @@ if ((file.type === 'file' || file.type === 'link') && filename.substr(-3) === '.js') { |
{ | ||
"main": "./lib/asar.js", | ||
"name": "asar", | ||
"description": "Creating atom-shell app packages", | ||
"version": "0.12.1", | ||
"description": "Creating Electron app packages", | ||
"version": "0.12.2", | ||
"bin": { | ||
@@ -29,3 +29,3 @@ "asar": "bin/asar" | ||
"glob": "^6.0.4", | ||
"minimatch": "^3.0.0", | ||
"minimatch": "^3.0.3", | ||
"mkdirp": "^0.5.0", | ||
@@ -32,0 +32,0 @@ "mksnapshot": "^0.3.0", |
# asar - Electron Archive | ||
[![build status](http://img.shields.io/travis/electron/asar.svg?style=flat-square)](https://travis-ci.org/electron/asar) | ||
[![Travis build status](https://travis-ci.org/electron/asar.svg?branch=master)](https://travis-ci.org/electron/asar) | ||
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/k0158woosmypinrc/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/asar/branch/master) | ||
[![dependencies](http://img.shields.io/david/electron/asar.svg?style=flat-square)](https://david-dm.org/electron/asar) | ||
@@ -5,0 +6,0 @@ [![npm version](http://img.shields.io/npm/v/asar.svg?style=flat-square)](https://npmjs.org/package/asar) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194
29407
10
582
Updatedminimatch@^3.0.3