Skip to content

Commit e4b21b6

Browse files
author
Benjamin Pasero
committed
Merge branch 'master' into ben/sqlite
2 parents 7e9546a + cdabfc3 commit e4b21b6

226 files changed

Lines changed: 4999 additions & 4512 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/gulpfile.mixin.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const es = require('event-stream');
1313
const util = require('./lib/util');
1414
const remote = require('gulp-remote-src');
1515
const zip = require('gulp-vinyl-zip');
16-
const assign = require('object-assign');
1716

1817
const pkg = require('../package.json');
1918

@@ -55,7 +54,7 @@ gulp.task('mixin', function () {
5554
.pipe(util.rebase(2))
5655
.pipe(productJsonFilter)
5756
.pipe(buffer())
58-
.pipe(json(o => assign({}, require('../product.json'), o)))
57+
.pipe(json(o => Object.assign({}, require('../product.json'), o)))
5958
.pipe(productJsonFilter.restore);
6059

6160
all = es.merge(mixin);

build/lib/asar.js

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@
44
*--------------------------------------------------------------------------------------------*/
55
'use strict';
66
Object.defineProperty(exports, "__esModule", { value: true });
7-
var path = require("path");
8-
var es = require("event-stream");
9-
var pickle = require('chromium-pickle-js');
10-
var Filesystem = require('asar/lib/filesystem');
11-
var VinylFile = require("vinyl");
12-
var minimatch = require("minimatch");
7+
const path = require("path");
8+
const es = require("event-stream");
9+
const pickle = require('chromium-pickle-js');
10+
const Filesystem = require('asar/lib/filesystem');
11+
const VinylFile = require("vinyl");
12+
const minimatch = require("minimatch");
1313
function createAsar(folderPath, unpackGlobs, destFilename) {
14-
var shouldUnpackFile = function (file) {
15-
for (var i = 0; i < unpackGlobs.length; i++) {
14+
const shouldUnpackFile = (file) => {
15+
for (let i = 0; i < unpackGlobs.length; i++) {
1616
if (minimatch(file.relative, unpackGlobs[i])) {
1717
return true;
1818
}
1919
}
2020
return false;
2121
};
22-
var filesystem = new Filesystem(folderPath);
23-
var out = [];
22+
const filesystem = new Filesystem(folderPath);
23+
const out = [];
2424
// Keep track of pending inserts
25-
var pendingInserts = 0;
26-
var onFileInserted = function () { pendingInserts--; };
25+
let pendingInserts = 0;
26+
let onFileInserted = () => { pendingInserts--; };
2727
// Do not insert twice the same directory
28-
var seenDir = {};
29-
var insertDirectoryRecursive = function (dir) {
28+
const seenDir = {};
29+
const insertDirectoryRecursive = (dir) => {
3030
if (seenDir[dir]) {
3131
return;
3232
}
33-
var lastSlash = dir.lastIndexOf('/');
33+
let lastSlash = dir.lastIndexOf('/');
3434
if (lastSlash === -1) {
3535
lastSlash = dir.lastIndexOf('\\');
3636
}
@@ -40,16 +40,16 @@ function createAsar(folderPath, unpackGlobs, destFilename) {
4040
seenDir[dir] = true;
4141
filesystem.insertDirectory(dir);
4242
};
43-
var insertDirectoryForFile = function (file) {
44-
var lastSlash = file.lastIndexOf('/');
43+
const insertDirectoryForFile = (file) => {
44+
let lastSlash = file.lastIndexOf('/');
4545
if (lastSlash === -1) {
4646
lastSlash = file.lastIndexOf('\\');
4747
}
4848
if (lastSlash !== -1) {
4949
insertDirectoryRecursive(file.substring(0, lastSlash));
5050
}
5151
};
52-
var insertFile = function (relativePath, stat, shouldUnpack) {
52+
const insertFile = (relativePath, stat, shouldUnpack) => {
5353
insertDirectoryForFile(relativePath);
5454
pendingInserts++;
5555
filesystem.insertFile(relativePath, shouldUnpack, { stat: stat }, {}, onFileInserted);
@@ -59,13 +59,13 @@ function createAsar(folderPath, unpackGlobs, destFilename) {
5959
return;
6060
}
6161
if (!file.stat.isFile()) {
62-
throw new Error("unknown item in stream!");
62+
throw new Error(`unknown item in stream!`);
6363
}
64-
var shouldUnpack = shouldUnpackFile(file);
64+
const shouldUnpack = shouldUnpackFile(file);
6565
insertFile(file.relative, { size: file.contents.length, mode: file.stat.mode }, shouldUnpack);
6666
if (shouldUnpack) {
6767
// The file goes outside of xx.asar, in a folder xx.asar.unpacked
68-
var relative = path.relative(folderPath, file.path);
68+
const relative = path.relative(folderPath, file.path);
6969
this.queue(new VinylFile({
7070
cwd: folderPath,
7171
base: folderPath,
@@ -79,34 +79,33 @@ function createAsar(folderPath, unpackGlobs, destFilename) {
7979
out.push(file.contents);
8080
}
8181
}, function () {
82-
var _this = this;
83-
var finish = function () {
82+
let finish = () => {
8483
{
85-
var headerPickle = pickle.createEmpty();
84+
const headerPickle = pickle.createEmpty();
8685
headerPickle.writeString(JSON.stringify(filesystem.header));
87-
var headerBuf = headerPickle.toBuffer();
88-
var sizePickle = pickle.createEmpty();
86+
const headerBuf = headerPickle.toBuffer();
87+
const sizePickle = pickle.createEmpty();
8988
sizePickle.writeUInt32(headerBuf.length);
90-
var sizeBuf = sizePickle.toBuffer();
89+
const sizeBuf = sizePickle.toBuffer();
9190
out.unshift(headerBuf);
9291
out.unshift(sizeBuf);
9392
}
94-
var contents = Buffer.concat(out);
93+
const contents = Buffer.concat(out);
9594
out.length = 0;
96-
_this.queue(new VinylFile({
95+
this.queue(new VinylFile({
9796
cwd: folderPath,
9897
base: folderPath,
9998
path: destFilename,
10099
contents: contents
101100
}));
102-
_this.queue(null);
101+
this.queue(null);
103102
};
104103
// Call finish() only when all file inserts have finished...
105104
if (pendingInserts === 0) {
106105
finish();
107106
}
108107
else {
109-
onFileInserted = function () {
108+
onFileInserted = () => {
110109
pendingInserts--;
111110
if (pendingInserts === 0) {
112111
finish();

0 commit comments

Comments
 (0)