Fix the remaining cases of inconsistent spacing and trailing commas in objects, and enable the comma-dangle
and object-curly-spacing
ESLint rules
http://eslint.org/docs/rules/comma-dangle http://eslint.org/docs/rules/object-curly-spacing *Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch. ```diff diff --git a/gulpfile.js b/gulpfile.js index d18b9c58..7d47fd8d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1247,7 +1247,8 @@ gulp.task('gh-pages-git', ['gh-pages-prepare', 'wintersmith'], function () { var reason = process.env['PDFJS_UPDATE_REASON']; safeSpawnSync('git', ['init'], { cwd: GH_PAGES_DIR, }); - safeSpawnSync('git', ['remote', 'add', 'origin', REPO], { cwd: GH_PAGES_DIR, }); + safeSpawnSync('git', ['remote', 'add', 'origin', REPO], + { cwd: GH_PAGES_DIR, }); safeSpawnSync('git', ['add', '-A'], { cwd: GH_PAGES_DIR, }); safeSpawnSync('git', [ 'commit', '-am', 'gh-pages site created via gulpfile.js script', ```
This commit is contained in:
parent
a3fae906a6
commit
4a906955c4
@ -102,6 +102,13 @@
|
|||||||
"brace-style": ["error", "1tbs", {
|
"brace-style": ["error", "1tbs", {
|
||||||
"allowSingleLine": false,
|
"allowSingleLine": false,
|
||||||
}],
|
}],
|
||||||
|
"comma-dangle": ["error", {
|
||||||
|
"arrays": "ignore",
|
||||||
|
"objects": "always",
|
||||||
|
"imports": "never",
|
||||||
|
"exports": "always",
|
||||||
|
"functions": "never",
|
||||||
|
}],
|
||||||
"comma-spacing": ["error", { "before": false, "after": true, }],
|
"comma-spacing": ["error", { "before": false, "after": true, }],
|
||||||
"comma-style": ["error", "last"],
|
"comma-style": ["error", "last"],
|
||||||
"eol-last": "error",
|
"eol-last": "error",
|
||||||
@ -118,6 +125,7 @@
|
|||||||
"no-tabs": "error",
|
"no-tabs": "error",
|
||||||
"no-trailing-spaces": ["error", { "skipBlankLines": false, }],
|
"no-trailing-spaces": ["error", { "skipBlankLines": false, }],
|
||||||
"no-whitespace-before-property": "error",
|
"no-whitespace-before-property": "error",
|
||||||
|
"object-curly-spacing": ["error", "always"],
|
||||||
"operator-linebreak": ["error", "after", { "overrides": { ":": "ignore", } }],
|
"operator-linebreak": ["error", "after", { "overrides": { ":": "ignore", } }],
|
||||||
"quotes": ["error", "single"],
|
"quotes": ["error", "single"],
|
||||||
"semi-spacing": ["error", { "before": false, "after": true, }],
|
"semi-spacing": ["error", { "before": false, "after": true, }],
|
||||||
|
2
external/builder/builder.js
vendored
2
external/builder/builder.js
vendored
@ -53,7 +53,7 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
throw new Error('No JavaScript expression given at ' + loc());
|
throw new Error('No JavaScript expression given at ' + loc());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return vm.runInNewContext(code, defines, {displayErrors: false});
|
return vm.runInNewContext(code, defines, { displayErrors: false, });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error('Could not evaluate "' + code + '" at ' + loc() + '\n' +
|
throw new Error('Could not evaluate "' + code + '" at ' + loc() + '\n' +
|
||||||
e.name + ': ' + e.message);
|
e.name + ': ' + e.message);
|
||||||
|
16
external/builder/preprocessor2.js
vendored
16
external/builder/preprocessor2.js
vendored
@ -22,7 +22,7 @@ function evalWithDefines(code, defines, loc) {
|
|||||||
if (!code || !code.trim()) {
|
if (!code || !code.trim()) {
|
||||||
throw new Error('No JavaScript expression given');
|
throw new Error('No JavaScript expression given');
|
||||||
}
|
}
|
||||||
return vm.runInNewContext(code, defines, {displayErrors: false});
|
return vm.runInNewContext(code, defines, { displayErrors: false, });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePreprocessorAction(ctx, actionName, args, loc) {
|
function handlePreprocessorAction(ctx, actionName, args, loc) {
|
||||||
@ -36,7 +36,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
|
|||||||
throw new Error('No code for testing is given');
|
throw new Error('No code for testing is given');
|
||||||
}
|
}
|
||||||
var isTrue = !!evalWithDefines(arg.value, ctx.defines);
|
var isTrue = !!evalWithDefines(arg.value, ctx.defines);
|
||||||
return {type: 'Literal', value: isTrue, loc: loc};
|
return { type: 'Literal', value: isTrue, loc: loc, };
|
||||||
case 'eval':
|
case 'eval':
|
||||||
arg = args[0];
|
arg = args[0];
|
||||||
if (!arg || arg.type !== 'Literal' ||
|
if (!arg || arg.type !== 'Literal' ||
|
||||||
@ -46,7 +46,7 @@ function handlePreprocessorAction(ctx, actionName, args, loc) {
|
|||||||
var result = evalWithDefines(arg.value, ctx.defines);
|
var result = evalWithDefines(arg.value, ctx.defines);
|
||||||
if (typeof result === 'boolean' || typeof result === 'string' ||
|
if (typeof result === 'boolean' || typeof result === 'string' ||
|
||||||
typeof result === 'number') {
|
typeof result === 'number') {
|
||||||
return {type: 'Literal', value: result, loc: loc};
|
return { type: 'Literal', value: result, loc: loc, };
|
||||||
}
|
}
|
||||||
if (typeof result === 'object') {
|
if (typeof result === 'object') {
|
||||||
var parsedObj = acorn.parse('(' + JSON.stringify(result) + ')');
|
var parsedObj = acorn.parse('(' + JSON.stringify(result) + ')');
|
||||||
@ -94,7 +94,7 @@ function postprocessNode(ctx, node) {
|
|||||||
return node.consequent;
|
return node.consequent;
|
||||||
} else if (isLiteral(node.test, false)) {
|
} else if (isLiteral(node.test, false)) {
|
||||||
// if (false) stmt1; else stmt2; => stmt2
|
// if (false) stmt1; else stmt2; => stmt2
|
||||||
return node.alternate || {type: 'EmptyStatement', loc: node.loc};
|
return node.alternate || { type: 'EmptyStatement', loc: node.loc, };
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'ConditionalExpression':
|
case 'ConditionalExpression':
|
||||||
@ -110,13 +110,13 @@ function postprocessNode(ctx, node) {
|
|||||||
if (node.operator === 'typeof' &&
|
if (node.operator === 'typeof' &&
|
||||||
isPDFJSPreprocessor(node.argument)) {
|
isPDFJSPreprocessor(node.argument)) {
|
||||||
// typeof PDFJSDev => 'object'
|
// typeof PDFJSDev => 'object'
|
||||||
return {type: 'Literal', value: 'object', loc: node.loc};
|
return { type: 'Literal', value: 'object', loc: node.loc, };
|
||||||
}
|
}
|
||||||
if (node.operator === '!' &&
|
if (node.operator === '!' &&
|
||||||
node.argument.type === 'Literal' &&
|
node.argument.type === 'Literal' &&
|
||||||
typeof node.argument.value === 'boolean') {
|
typeof node.argument.value === 'boolean') {
|
||||||
// !true => false, !false => true
|
// !true => false, !false => true
|
||||||
return {type: 'Literal', value: !node.argument.value, loc: node.loc};
|
return { type: 'Literal', value: !node.argument.value, loc: node.loc, };
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'LogicalExpression':
|
case 'LogicalExpression':
|
||||||
@ -157,7 +157,7 @@ function postprocessNode(ctx, node) {
|
|||||||
return {
|
return {
|
||||||
type: 'Literal',
|
type: 'Literal',
|
||||||
value: (node.operator[0] === '=') === equal,
|
value: (node.operator[0] === '=') === equal,
|
||||||
loc: node.loc
|
loc: node.loc,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ function preprocessPDFJSCode(ctx, code) {
|
|||||||
var format = ctx.format || {
|
var format = ctx.format || {
|
||||||
indent: {
|
indent: {
|
||||||
style: ' ',
|
style: ' ',
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
var parseOptions = {
|
var parseOptions = {
|
||||||
locations: true,
|
locations: true,
|
||||||
|
4
external/builder/test-fixtures_esprima.js
vendored
4
external/builder/test-fixtures_esprima.js
vendored
@ -21,8 +21,8 @@ files.forEach(function(expectationFilename) {
|
|||||||
var defines = {
|
var defines = {
|
||||||
TRUE: true,
|
TRUE: true,
|
||||||
FALSE: false,
|
FALSE: false,
|
||||||
OBJ: {obj: {i: 1}, j: 2},
|
OBJ: { obj: { i: 1, }, j: 2, },
|
||||||
TEXT: 'text'
|
TEXT: 'text',
|
||||||
};
|
};
|
||||||
var map = {
|
var map = {
|
||||||
'import-alias': 'import-name',
|
'import-alias': 'import-name',
|
||||||
|
2
external/systemjs/plugin-babel-cached.js
vendored
2
external/systemjs/plugin-babel-cached.js
vendored
@ -26,7 +26,7 @@ function getDb() {
|
|||||||
var request = indexedDB.open(dbName, dbVersion);
|
var request = indexedDB.open(dbName, dbVersion);
|
||||||
request.onupgradeneeded = function() {
|
request.onupgradeneeded = function() {
|
||||||
var db = request.result;
|
var db = request.result;
|
||||||
db.createObjectStore(dbCacheTable, {keyPath: 'address'});
|
db.createObjectStore(dbCacheTable, { keyPath: 'address', });
|
||||||
};
|
};
|
||||||
request.onsuccess = function() {
|
request.onsuccess = function() {
|
||||||
var db = request.result;
|
var db = request.result;
|
||||||
|
167
gulpfile.js
167
gulpfile.js
@ -106,13 +106,13 @@ function safeSpawnSync(command, parameters, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createStringSource(filename, content) {
|
function createStringSource(filename, content) {
|
||||||
var source = stream.Readable({ objectMode: true });
|
var source = stream.Readable({ objectMode: true, });
|
||||||
source._read = function () {
|
source._read = function () {
|
||||||
this.push(new gutil.File({
|
this.push(new gutil.File({
|
||||||
cwd: '',
|
cwd: '',
|
||||||
base: '',
|
base: '',
|
||||||
path: filename,
|
path: filename,
|
||||||
contents: new Buffer(content)
|
contents: new Buffer(content),
|
||||||
}));
|
}));
|
||||||
this.push(null);
|
this.push(null);
|
||||||
};
|
};
|
||||||
@ -126,7 +126,7 @@ function createWebpackConfig(defines, output) {
|
|||||||
var versionInfo = getVersionJSON();
|
var versionInfo = getVersionJSON();
|
||||||
var bundleDefines = builder.merge(defines, {
|
var bundleDefines = builder.merge(defines, {
|
||||||
BUNDLE_VERSION: versionInfo.version,
|
BUNDLE_VERSION: versionInfo.version,
|
||||||
BUNDLE_BUILD: versionInfo.commit
|
BUNDLE_BUILD: versionInfo.commit,
|
||||||
});
|
});
|
||||||
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
||||||
var enableSourceMaps = !bundleDefines.FIREFOX && !bundleDefines.MOZCENTRAL &&
|
var enableSourceMaps = !bundleDefines.FIREFOX && !bundleDefines.MOZCENTRAL &&
|
||||||
@ -137,7 +137,7 @@ function createWebpackConfig(defines, output) {
|
|||||||
return {
|
return {
|
||||||
output: output,
|
output: output,
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack2.BannerPlugin({banner: licenseHeader, raw: true}),
|
new webpack2.BannerPlugin({ banner: licenseHeader, raw: true, }),
|
||||||
new BlockRequirePlugin()
|
new BlockRequirePlugin()
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -145,7 +145,7 @@ function createWebpackConfig(defines, output) {
|
|||||||
'pdfjs': path.join(__dirname, 'src'),
|
'pdfjs': path.join(__dirname, 'src'),
|
||||||
'pdfjs-web': path.join(__dirname, 'web'),
|
'pdfjs-web': path.join(__dirname, 'web'),
|
||||||
'pdfjs-lib': path.join(__dirname, 'web/pdfjs'),
|
'pdfjs-lib': path.join(__dirname, 'web/pdfjs'),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
devtool: enableSourceMaps ? 'source-map' : undefined,
|
devtool: enableSourceMaps ? 'source-map' : undefined,
|
||||||
module: {
|
module: {
|
||||||
@ -155,19 +155,19 @@ function createWebpackConfig(defines, output) {
|
|||||||
exclude: /src\/core\/(glyphlist|unicode)/, // babel is too slow
|
exclude: /src\/core\/(glyphlist|unicode)/, // babel is too slow
|
||||||
options: {
|
options: {
|
||||||
presets: pdfjsNext ? undefined : ['es2015'],
|
presets: pdfjsNext ? undefined : ['es2015'],
|
||||||
plugins: ['transform-es2015-modules-commonjs']
|
plugins: ['transform-es2015-modules-commonjs'],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
loader: path.join(__dirname, 'external/webpack/pdfjsdev-loader.js'),
|
loader: path.join(__dirname, 'external/webpack/pdfjsdev-loader.js'),
|
||||||
options: {
|
options: {
|
||||||
rootPath: __dirname,
|
rootPath: __dirname,
|
||||||
saveComments: false,
|
saveComments: false,
|
||||||
defines: bundleDefines
|
defines: bundleDefines,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ function createBundle(defines) {
|
|||||||
filename: mainOutputName,
|
filename: mainOutputName,
|
||||||
library: mainAMDName,
|
library: mainAMDName,
|
||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
umdNamedDefine: true
|
umdNamedDefine: true,
|
||||||
});
|
});
|
||||||
var mainOutput = gulp.src('./src/pdf.js')
|
var mainOutput = gulp.src('./src/pdf.js')
|
||||||
.pipe(webpack2Stream(mainFileConfig))
|
.pipe(webpack2Stream(mainFileConfig))
|
||||||
@ -260,7 +260,7 @@ function createBundle(defines) {
|
|||||||
filename: workerOutputName,
|
filename: workerOutputName,
|
||||||
library: workerAMDName,
|
library: workerAMDName,
|
||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
umdNamedDefine: true
|
umdNamedDefine: true,
|
||||||
});
|
});
|
||||||
var workerOutput = gulp.src('./src/pdf.worker.js')
|
var workerOutput = gulp.src('./src/pdf.worker.js')
|
||||||
.pipe(webpack2Stream(workerFileConfig))
|
.pipe(webpack2Stream(workerFileConfig))
|
||||||
@ -273,7 +273,7 @@ function createWebBundle(defines) {
|
|||||||
var viewerOutputName = 'viewer.js';
|
var viewerOutputName = 'viewer.js';
|
||||||
|
|
||||||
var viewerFileConfig = createWebpackConfig(defines, {
|
var viewerFileConfig = createWebpackConfig(defines, {
|
||||||
filename: viewerOutputName
|
filename: viewerOutputName,
|
||||||
});
|
});
|
||||||
return gulp.src('./web/viewer.js')
|
return gulp.src('./web/viewer.js')
|
||||||
.pipe(webpack2Stream(viewerFileConfig));
|
.pipe(webpack2Stream(viewerFileConfig));
|
||||||
@ -287,7 +287,7 @@ function createComponentsBundle(defines) {
|
|||||||
filename: componentsOutputName,
|
filename: componentsOutputName,
|
||||||
library: componentsAMDName,
|
library: componentsAMDName,
|
||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
umdNamedDefine: true
|
umdNamedDefine: true,
|
||||||
});
|
});
|
||||||
return gulp.src('./web/pdf_viewer.component.js')
|
return gulp.src('./web/pdf_viewer.component.js')
|
||||||
.pipe(webpack2Stream(componentsFileConfig))
|
.pipe(webpack2Stream(componentsFileConfig))
|
||||||
@ -303,7 +303,7 @@ function createCompatibilityBundle(defines) {
|
|||||||
filename: compatibilityOutputName,
|
filename: compatibilityOutputName,
|
||||||
library: compatibilityAMDName,
|
library: compatibilityAMDName,
|
||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
umdNamedDefine: true
|
umdNamedDefine: true,
|
||||||
});
|
});
|
||||||
return gulp.src('./web/compatibility.js')
|
return gulp.src('./web/compatibility.js')
|
||||||
.pipe(webpack2Stream(compatibilityFileConfig));
|
.pipe(webpack2Stream(compatibilityFileConfig));
|
||||||
@ -342,7 +342,7 @@ function getTempFile(prefix, suffix) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createTestSource(testsName) {
|
function createTestSource(testsName) {
|
||||||
var source = stream.Readable({ objectMode: true });
|
var source = stream.Readable({ objectMode: true, });
|
||||||
source._read = function () {
|
source._read = function () {
|
||||||
console.log();
|
console.log();
|
||||||
console.log('### Running ' + testsName + ' tests');
|
console.log('### Running ' + testsName + ' tests');
|
||||||
@ -380,7 +380,7 @@ function createTestSource(testsName) {
|
|||||||
}
|
}
|
||||||
args.push('--browserManifestFile=' + PDF_BROWSERS);
|
args.push('--browserManifestFile=' + PDF_BROWSERS);
|
||||||
|
|
||||||
var testProcess = spawn('node', args, {cwd: TEST_DIR, stdio: 'inherit'});
|
var testProcess = spawn('node', args, { cwd: TEST_DIR, stdio: 'inherit', });
|
||||||
testProcess.on('close', function (code) {
|
testProcess.on('close', function (code) {
|
||||||
source.push(null);
|
source.push(null);
|
||||||
});
|
});
|
||||||
@ -409,7 +409,7 @@ function makeRef(done, noPrompts) {
|
|||||||
args.push('--noPrompts');
|
args.push('--noPrompts');
|
||||||
}
|
}
|
||||||
args.push('--browserManifestFile=' + PDF_BROWSERS);
|
args.push('--browserManifestFile=' + PDF_BROWSERS);
|
||||||
var testProcess = spawn('node', args, {cwd: TEST_DIR, stdio: 'inherit'});
|
var testProcess = spawn('node', args, { cwd: TEST_DIR, stdio: 'inherit', });
|
||||||
testProcess.on('close', function (code) {
|
testProcess.on('close', function (code) {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -451,7 +451,7 @@ gulp.task('buildnumber', function (done) {
|
|||||||
createStringSource('version.json', JSON.stringify({
|
createStringSource('version.json', JSON.stringify({
|
||||||
version: version,
|
version: version,
|
||||||
build: buildNumber,
|
build: buildNumber,
|
||||||
commit: buildCommit
|
commit: buildCommit,
|
||||||
}, null, 2))
|
}, null, 2))
|
||||||
.pipe(gulp.dest(BUILD_DIR))
|
.pipe(gulp.dest(BUILD_DIR))
|
||||||
.on('end', done);
|
.on('end', done);
|
||||||
@ -514,13 +514,13 @@ gulp.task('locale', function () {
|
|||||||
createStringSource('chrome.manifest.inc', chromeManifestContent)
|
createStringSource('chrome.manifest.inc', chromeManifestContent)
|
||||||
.pipe(gulp.dest(METADATA_OUTPUT)),
|
.pipe(gulp.dest(METADATA_OUTPUT)),
|
||||||
gulp.src(L10N_DIR + '/{' + locales.join(',') + '}' +
|
gulp.src(L10N_DIR + '/{' + locales.join(',') + '}' +
|
||||||
'/{viewer,chrome}.properties', {base: L10N_DIR})
|
'/{viewer,chrome}.properties', { base: L10N_DIR, })
|
||||||
.pipe(gulp.dest(EXTENSION_LOCALE_OUTPUT)),
|
.pipe(gulp.dest(EXTENSION_LOCALE_OUTPUT)),
|
||||||
|
|
||||||
createStringSource('locale.properties', viewerOutput)
|
createStringSource('locale.properties', viewerOutput)
|
||||||
.pipe(gulp.dest(VIEWER_LOCALE_OUTPUT)),
|
.pipe(gulp.dest(VIEWER_LOCALE_OUTPUT)),
|
||||||
gulp.src(L10N_DIR + '/{' + locales.join(',') + '}' +
|
gulp.src(L10N_DIR + '/{' + locales.join(',') + '}' +
|
||||||
'/viewer.properties', {base: L10N_DIR})
|
'/viewer.properties', { base: L10N_DIR, })
|
||||||
.pipe(gulp.dest(VIEWER_LOCALE_OUTPUT))
|
.pipe(gulp.dest(VIEWER_LOCALE_OUTPUT))
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -598,22 +598,22 @@ function preprocessJS(source, defines, cleanup) {
|
|||||||
gulp.task('generic', ['buildnumber', 'locale'], function () {
|
gulp.task('generic', ['buildnumber', 'locale'], function () {
|
||||||
console.log();
|
console.log();
|
||||||
console.log('### Creating generic viewer');
|
console.log('### Creating generic viewer');
|
||||||
var defines = builder.merge(DEFINES, {GENERIC: true});
|
var defines = builder.merge(DEFINES, { GENERIC: true, });
|
||||||
|
|
||||||
rimraf.sync(GENERIC_DIR);
|
rimraf.sync(GENERIC_DIR);
|
||||||
|
|
||||||
return merge([
|
return merge([
|
||||||
createBundle(defines).pipe(gulp.dest(GENERIC_DIR + 'build')),
|
createBundle(defines).pipe(gulp.dest(GENERIC_DIR + 'build')),
|
||||||
createWebBundle(defines).pipe(gulp.dest(GENERIC_DIR + 'web')),
|
createWebBundle(defines).pipe(gulp.dest(GENERIC_DIR + 'web')),
|
||||||
gulp.src(COMMON_WEB_FILES, {base: 'web/'})
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
||||||
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
||||||
gulp.src('LICENSE').pipe(gulp.dest(GENERIC_DIR)),
|
gulp.src('LICENSE').pipe(gulp.dest(GENERIC_DIR)),
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'web/locale/*/viewer.properties',
|
'web/locale/*/viewer.properties',
|
||||||
'web/locale/locale.properties'
|
'web/locale/locale.properties'
|
||||||
], {base: 'web/'}).pipe(gulp.dest(GENERIC_DIR + 'web')),
|
], { base: 'web/', }).pipe(gulp.dest(GENERIC_DIR + 'web')),
|
||||||
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
||||||
{base: 'external/bcmaps'})
|
{ base: 'external/bcmaps', })
|
||||||
.pipe(gulp.dest(GENERIC_DIR + 'web/cmaps')),
|
.pipe(gulp.dest(GENERIC_DIR + 'web/cmaps')),
|
||||||
preprocessHTML('web/viewer.html', defines)
|
preprocessHTML('web/viewer.html', defines)
|
||||||
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
||||||
@ -628,7 +628,7 @@ gulp.task('generic', ['buildnumber', 'locale'], function () {
|
|||||||
gulp.task('components', ['buildnumber'], function () {
|
gulp.task('components', ['buildnumber'], function () {
|
||||||
console.log();
|
console.log();
|
||||||
console.log('### Creating generic components');
|
console.log('### Creating generic components');
|
||||||
var defines = builder.merge(DEFINES, {COMPONENTS: true, GENERIC: true});
|
var defines = builder.merge(DEFINES, { COMPONENTS: true, GENERIC: true, });
|
||||||
|
|
||||||
rimraf.sync(COMPONENTS_DIR);
|
rimraf.sync(COMPONENTS_DIR);
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ gulp.task('components', ['buildnumber'], function () {
|
|||||||
gulp.task('singlefile', ['buildnumber'], function () {
|
gulp.task('singlefile', ['buildnumber'], function () {
|
||||||
console.log();
|
console.log();
|
||||||
console.log('### Creating singlefile build');
|
console.log('### Creating singlefile build');
|
||||||
var defines = builder.merge(DEFINES, {SINGLE_FILE: true});
|
var defines = builder.merge(DEFINES, { SINGLE_FILE: true, });
|
||||||
|
|
||||||
var SINGLE_FILE_BUILD_DIR = SINGLE_FILE_DIR + 'build/';
|
var SINGLE_FILE_BUILD_DIR = SINGLE_FILE_DIR + 'build/';
|
||||||
|
|
||||||
@ -663,21 +663,21 @@ gulp.task('singlefile', ['buildnumber'], function () {
|
|||||||
gulp.task('minified-pre', ['buildnumber', 'locale'], function () {
|
gulp.task('minified-pre', ['buildnumber', 'locale'], function () {
|
||||||
console.log();
|
console.log();
|
||||||
console.log('### Creating minified viewer');
|
console.log('### Creating minified viewer');
|
||||||
var defines = builder.merge(DEFINES, {MINIFIED: true, GENERIC: true});
|
var defines = builder.merge(DEFINES, { MINIFIED: true, GENERIC: true, });
|
||||||
|
|
||||||
rimraf.sync(MINIFIED_DIR);
|
rimraf.sync(MINIFIED_DIR);
|
||||||
|
|
||||||
return merge([
|
return merge([
|
||||||
createBundle(defines).pipe(gulp.dest(MINIFIED_DIR + 'build')),
|
createBundle(defines).pipe(gulp.dest(MINIFIED_DIR + 'build')),
|
||||||
createWebBundle(defines).pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
createWebBundle(defines).pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
||||||
gulp.src(COMMON_WEB_FILES, {base: 'web/'})
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
||||||
.pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
.pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'web/locale/*/viewer.properties',
|
'web/locale/*/viewer.properties',
|
||||||
'web/locale/locale.properties'
|
'web/locale/locale.properties'
|
||||||
], {base: 'web/'}).pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
], { base: 'web/', }).pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
||||||
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
||||||
{base: 'external/bcmaps'})
|
{ base: 'external/bcmaps', })
|
||||||
.pipe(gulp.dest(MINIFIED_DIR + 'web/cmaps')),
|
.pipe(gulp.dest(MINIFIED_DIR + 'web/cmaps')),
|
||||||
|
|
||||||
preprocessHTML('web/viewer.html', defines)
|
preprocessHTML('web/viewer.html', defines)
|
||||||
@ -701,7 +701,7 @@ gulp.task('minified-post', ['minified-pre'], function () {
|
|||||||
|
|
||||||
var UglifyJS = require('uglify-js');
|
var UglifyJS = require('uglify-js');
|
||||||
// V8 chokes on very long sequences. Works around that.
|
// V8 chokes on very long sequences. Works around that.
|
||||||
var optsForHugeFile = {compress: {sequences: false}};
|
var optsForHugeFile = { compress: { sequences: false, }, };
|
||||||
|
|
||||||
fs.writeFileSync(MINIFIED_DIR + '/web/pdf.viewer.js',
|
fs.writeFileSync(MINIFIED_DIR + '/web/pdf.viewer.js',
|
||||||
UglifyJS.minify(viewerFiles).code);
|
UglifyJS.minify(viewerFiles).code);
|
||||||
@ -750,13 +750,13 @@ gulp.task('firefox-pre', ['buildnumber', 'locale'], function () {
|
|||||||
return merge([
|
return merge([
|
||||||
createBundle(defines).pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'build')),
|
createBundle(defines).pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'build')),
|
||||||
createWebBundle(defines).pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'web')),
|
createWebBundle(defines).pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'web')),
|
||||||
gulp.src(COMMON_WEB_FILES, {base: 'web/'})
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
||||||
.pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'web')),
|
.pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'web')),
|
||||||
gulp.src(FIREFOX_EXTENSION_DIR + 'locale/**/*.properties',
|
gulp.src(FIREFOX_EXTENSION_DIR + 'locale/**/*.properties',
|
||||||
{base: FIREFOX_EXTENSION_DIR})
|
{ base: FIREFOX_EXTENSION_DIR, })
|
||||||
.pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
.pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
||||||
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
||||||
{base: 'external/bcmaps'})
|
{ base: 'external/bcmaps', })
|
||||||
.pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'web/cmaps')),
|
.pipe(gulp.dest(FIREFOX_BUILD_CONTENT_DIR + 'web/cmaps')),
|
||||||
|
|
||||||
preprocessHTML('web/viewer.html', defines)
|
preprocessHTML('web/viewer.html', defines)
|
||||||
@ -781,7 +781,7 @@ gulp.task('firefox-pre', ['buildnumber', 'locale'], function () {
|
|||||||
localizedMetadata))
|
localizedMetadata))
|
||||||
.pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
.pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
||||||
gulp.src(FIREFOX_EXTENSION_DIR + 'chrome/content.js',
|
gulp.src(FIREFOX_EXTENSION_DIR + 'chrome/content.js',
|
||||||
{base: FIREFOX_EXTENSION_DIR})
|
{ base: FIREFOX_EXTENSION_DIR, })
|
||||||
.pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
.pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
||||||
gulp.src('LICENSE').pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
gulp.src('LICENSE').pipe(gulp.dest(FIREFOX_BUILD_DIR)),
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ gulp.task('firefox', ['firefox-pre'], function (done) {
|
|||||||
var zipExecOptions = {
|
var zipExecOptions = {
|
||||||
cwd: FIREFOX_BUILD_DIR,
|
cwd: FIREFOX_BUILD_DIR,
|
||||||
// Set timezone to UTC before calling zip to get reproducible results.
|
// Set timezone to UTC before calling zip to get reproducible results.
|
||||||
env: {'TZ': 'UTC'},
|
env: { 'TZ': 'UTC', },
|
||||||
};
|
};
|
||||||
|
|
||||||
exec('zip -r ' + FIREFOX_EXTENSION_NAME + ' ' +
|
exec('zip -r ' + FIREFOX_EXTENSION_NAME + ' ' +
|
||||||
@ -858,10 +858,10 @@ gulp.task('mozcentral-pre', ['buildnumber', 'locale'], function () {
|
|||||||
return merge([
|
return merge([
|
||||||
createBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'build')),
|
createBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'build')),
|
||||||
createWebBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
createWebBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
||||||
gulp.src(COMMON_WEB_FILES, {base: 'web/'})
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
||||||
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
||||||
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
||||||
{base: 'external/bcmaps'})
|
{ base: 'external/bcmaps', })
|
||||||
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web/cmaps')),
|
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web/cmaps')),
|
||||||
|
|
||||||
preprocessHTML('web/viewer.html', defines)
|
preprocessHTML('web/viewer.html', defines)
|
||||||
@ -923,15 +923,15 @@ gulp.task('chromium-pre', ['buildnumber', 'locale'], function () {
|
|||||||
return merge([
|
return merge([
|
||||||
createBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'build')),
|
createBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'build')),
|
||||||
createWebBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
createWebBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
||||||
gulp.src(COMMON_WEB_FILES, {base: 'web/'})
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
||||||
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
||||||
|
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'web/locale/*/viewer.properties',
|
'web/locale/*/viewer.properties',
|
||||||
'web/locale/locale.properties'
|
'web/locale/locale.properties'
|
||||||
], {base: 'web/'}).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
], { base: 'web/', }).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
||||||
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
||||||
{base: 'external/bcmaps'})
|
{ base: 'external/bcmaps', })
|
||||||
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web/cmaps')),
|
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web/cmaps')),
|
||||||
|
|
||||||
preprocessHTML('web/viewer.html', defines)
|
preprocessHTML('web/viewer.html', defines)
|
||||||
@ -946,7 +946,7 @@ gulp.task('chromium-pre', ['buildnumber', 'locale'], function () {
|
|||||||
gulp.src([
|
gulp.src([
|
||||||
'extensions/chromium/**/*.{html,js,css,png}',
|
'extensions/chromium/**/*.{html,js,css,png}',
|
||||||
'extensions/chromium/preferences_schema.json'
|
'extensions/chromium/preferences_schema.json'
|
||||||
], {base: 'extensions/chromium/'})
|
], { base: 'extensions/chromium/', })
|
||||||
.pipe(gulp.dest(CHROME_BUILD_DIR)),
|
.pipe(gulp.dest(CHROME_BUILD_DIR)),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -999,11 +999,11 @@ gulp.task('lib', ['buildnumber'], function () {
|
|||||||
GENERIC: true,
|
GENERIC: true,
|
||||||
LIB: true,
|
LIB: true,
|
||||||
BUNDLE_VERSION: versionInfo.version,
|
BUNDLE_VERSION: versionInfo.version,
|
||||||
BUNDLE_BUILD: versionInfo.commit
|
BUNDLE_BUILD: versionInfo.commit,
|
||||||
}),
|
}),
|
||||||
map: {
|
map: {
|
||||||
'pdfjs-lib': '../pdf'
|
'pdfjs-lib': '../pdf',
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
||||||
var preprocessor2 = require('./external/builder/preprocessor2.js');
|
var preprocessor2 = require('./external/builder/preprocessor2.js');
|
||||||
@ -1012,19 +1012,19 @@ gulp.task('lib', ['buildnumber'], function () {
|
|||||||
'src/{core,display}/*.js',
|
'src/{core,display}/*.js',
|
||||||
'src/shared/{compatibility,util}.js',
|
'src/shared/{compatibility,util}.js',
|
||||||
'src/{pdf,pdf.worker}.js',
|
'src/{pdf,pdf.worker}.js',
|
||||||
], {base: 'src/'}),
|
], { base: 'src/', }),
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'web/*.js',
|
'web/*.js',
|
||||||
'!web/pdfjs.js',
|
'!web/pdfjs.js',
|
||||||
'!web/viewer.js',
|
'!web/viewer.js',
|
||||||
'!web/compatibility.js',
|
'!web/compatibility.js',
|
||||||
], {base: '.'}),
|
], { base: '.', }),
|
||||||
gulp.src('test/unit/*.js', {base: '.'}),
|
gulp.src('test/unit/*.js', { base: '.', }),
|
||||||
]).pipe(transform(preprocess))
|
]).pipe(transform(preprocess))
|
||||||
.pipe(gulp.dest('build/lib/'));
|
.pipe(gulp.dest('build/lib/'));
|
||||||
return merge([
|
return merge([
|
||||||
buildLib,
|
buildLib,
|
||||||
gulp.src('external/streams/streams-lib.js', {base: '.'})
|
gulp.src('external/streams/streams-lib.js', { base: '.', })
|
||||||
.pipe(gulp.dest('build/')),
|
.pipe(gulp.dest('build/')),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -1056,12 +1056,12 @@ gulp.task('publish', ['generic'], function (done) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test', ['generic'], function () {
|
gulp.task('test', ['generic'], function () {
|
||||||
return streamqueue({ objectMode: true },
|
return streamqueue({ objectMode: true, },
|
||||||
createTestSource('unit'), createTestSource('browser'));
|
createTestSource('unit'), createTestSource('browser'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('bottest', ['generic'], function () {
|
gulp.task('bottest', ['generic'], function () {
|
||||||
return streamqueue({ objectMode: true },
|
return streamqueue({ objectMode: true, },
|
||||||
createTestSource('unit'), createTestSource('font'),
|
createTestSource('unit'), createTestSource('font'),
|
||||||
createTestSource('browser (no reftest)'));
|
createTestSource('browser (no reftest)'));
|
||||||
});
|
});
|
||||||
@ -1103,13 +1103,13 @@ gulp.task('baseline', function (done) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
|
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
|
||||||
exec(initializeCommand, { cwd: workingDirectory }, function (error) {
|
exec(initializeCommand, { cwd: workingDirectory, }, function (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
done(new Error('Baseline clone/fetch failed.'));
|
done(new Error('Baseline clone/fetch failed.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec('git checkout ' + baselineCommit, { cwd: workingDirectory },
|
exec('git checkout ' + baselineCommit, { cwd: workingDirectory, },
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
done(new Error('Baseline commit checkout failed.'));
|
done(new Error('Baseline commit checkout failed.'));
|
||||||
@ -1125,7 +1125,7 @@ gulp.task('baseline', function (done) {
|
|||||||
gulp.task('unittestcli', ['lib'], function (done) {
|
gulp.task('unittestcli', ['lib'], function (done) {
|
||||||
var args = ['JASMINE_CONFIG_PATH=test/unit/clitests.json'];
|
var args = ['JASMINE_CONFIG_PATH=test/unit/clitests.json'];
|
||||||
var testProcess = spawn('node_modules/.bin/jasmine', args,
|
var testProcess = spawn('node_modules/.bin/jasmine', args,
|
||||||
{stdio: 'inherit'});
|
{ stdio: 'inherit', });
|
||||||
testProcess.on('close', function (code) {
|
testProcess.on('close', function (code) {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
done(new Error('Unit tests failed.'));
|
done(new Error('Unit tests failed.'));
|
||||||
@ -1141,7 +1141,7 @@ gulp.task('lint', function (done) {
|
|||||||
|
|
||||||
// Ensure that we lint the Firefox specific *.jsm files too.
|
// Ensure that we lint the Firefox specific *.jsm files too.
|
||||||
var options = ['node_modules/eslint/bin/eslint', '--ext', '.js,.jsm', '.'];
|
var options = ['node_modules/eslint/bin/eslint', '--ext', '.js,.jsm', '.'];
|
||||||
var esLintProcess = spawn('node', options, {stdio: 'inherit'});
|
var esLintProcess = spawn('node', options, { stdio: 'inherit', });
|
||||||
esLintProcess.on('close', function (code) {
|
esLintProcess.on('close', function (code) {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
done(new Error('ESLint failed.'));
|
done(new Error('ESLint failed.'));
|
||||||
@ -1212,16 +1212,16 @@ gulp.task('gh-pages-prepare', ['web-pre'], function () {
|
|||||||
|
|
||||||
// 'vinyl' because web/viewer.html needs its BOM.
|
// 'vinyl' because web/viewer.html needs its BOM.
|
||||||
return merge([
|
return merge([
|
||||||
vinyl.src(GENERIC_DIR + '**/*', {base: GENERIC_DIR, stripBOM: false})
|
vinyl.src(GENERIC_DIR + '**/*', { base: GENERIC_DIR, stripBOM: false, })
|
||||||
.pipe(gulp.dest(GH_PAGES_DIR)),
|
.pipe(gulp.dest(GH_PAGES_DIR)),
|
||||||
gulp.src([FIREFOX_BUILD_DIR + '*.xpi',
|
gulp.src([FIREFOX_BUILD_DIR + '*.xpi',
|
||||||
FIREFOX_BUILD_DIR + '*.rdf'])
|
FIREFOX_BUILD_DIR + '*.rdf'])
|
||||||
.pipe(gulp.dest(GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/')),
|
.pipe(gulp.dest(GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/')),
|
||||||
gulp.src(CHROME_BUILD_DIR + '*.crx')
|
gulp.src(CHROME_BUILD_DIR + '*.crx')
|
||||||
.pipe(gulp.dest(GH_PAGES_DIR + EXTENSION_SRC_DIR + 'chromium/')),
|
.pipe(gulp.dest(GH_PAGES_DIR + EXTENSION_SRC_DIR + 'chromium/')),
|
||||||
gulp.src('test/features/**/*', {base: 'test/'})
|
gulp.src('test/features/**/*', { base: 'test/', })
|
||||||
.pipe(gulp.dest(GH_PAGES_DIR)),
|
.pipe(gulp.dest(GH_PAGES_DIR)),
|
||||||
gulp.src(JSDOC_BUILD_DIR + '**/*', {base: JSDOC_BUILD_DIR})
|
gulp.src(JSDOC_BUILD_DIR + '**/*', { base: JSDOC_BUILD_DIR, })
|
||||||
.pipe(gulp.dest(GH_PAGES_DIR + 'api/draft/')),
|
.pipe(gulp.dest(GH_PAGES_DIR + 'api/draft/')),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -1246,14 +1246,15 @@ gulp.task('gh-pages-git', ['gh-pages-prepare', 'wintersmith'], function () {
|
|||||||
var VERSION = getVersionJSON().version;
|
var VERSION = getVersionJSON().version;
|
||||||
var reason = process.env['PDFJS_UPDATE_REASON'];
|
var reason = process.env['PDFJS_UPDATE_REASON'];
|
||||||
|
|
||||||
safeSpawnSync('git', ['init'], {cwd: GH_PAGES_DIR});
|
safeSpawnSync('git', ['init'], { cwd: GH_PAGES_DIR, });
|
||||||
safeSpawnSync('git', ['remote', 'add', 'origin', REPO], {cwd: GH_PAGES_DIR});
|
safeSpawnSync('git', ['remote', 'add', 'origin', REPO],
|
||||||
safeSpawnSync('git', ['add', '-A'], {cwd: GH_PAGES_DIR});
|
{ cwd: GH_PAGES_DIR, });
|
||||||
|
safeSpawnSync('git', ['add', '-A'], { cwd: GH_PAGES_DIR, });
|
||||||
safeSpawnSync('git', [
|
safeSpawnSync('git', [
|
||||||
'commit', '-am', 'gh-pages site created via gulpfile.js script',
|
'commit', '-am', 'gh-pages site created via gulpfile.js script',
|
||||||
'-m', 'PDF.js version ' + VERSION + (reason ? ' - ' + reason : '')
|
'-m', 'PDF.js version ' + VERSION + (reason ? ' - ' + reason : '')
|
||||||
], {cwd: GH_PAGES_DIR});
|
], { cwd: GH_PAGES_DIR, });
|
||||||
safeSpawnSync('git', ['branch', '-m', 'gh-pages'], {cwd: GH_PAGES_DIR});
|
safeSpawnSync('git', ['branch', '-m', 'gh-pages'], { cwd: GH_PAGES_DIR, });
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
console.log('Website built in ' + GH_PAGES_DIR);
|
console.log('Website built in ' + GH_PAGES_DIR);
|
||||||
@ -1296,12 +1297,12 @@ gulp.task('dist-repo-prepare', ['dist-pre'], function () {
|
|||||||
'worker-loader': '^0.8.0', // used in external/dist/webpack.json
|
'worker-loader': '^0.8.0', // used in external/dist/webpack.json
|
||||||
},
|
},
|
||||||
browser: {
|
browser: {
|
||||||
'node-ensure': false
|
'node-ensure': false,
|
||||||
},
|
},
|
||||||
format: 'amd', // to not allow system.js to choose 'cjs'
|
format: 'amd', // to not allow system.js to choose 'cjs'
|
||||||
repository: {
|
repository: {
|
||||||
type: 'git',
|
type: 'git',
|
||||||
url: DIST_REPO_URL
|
url: DIST_REPO_URL,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
var packageJsonSrc =
|
var packageJsonSrc =
|
||||||
@ -1320,17 +1321,17 @@ gulp.task('dist-repo-prepare', ['dist-pre'], function () {
|
|||||||
createStringSource('bower.json', JSON.stringify(bowerManifest, null, 2));
|
createStringSource('bower.json', JSON.stringify(bowerManifest, null, 2));
|
||||||
|
|
||||||
return merge([
|
return merge([
|
||||||
gulp.src('external/streams/streams-lib.js', {base: '.'})
|
gulp.src('external/streams/streams-lib.js', { base: '.', })
|
||||||
.pipe(gulp.dest('build/dist/')),
|
.pipe(gulp.dest('build/dist/')),
|
||||||
packageJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
packageJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
||||||
bowerJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
bowerJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
||||||
vinyl.src('external/dist/**/*',
|
vinyl.src('external/dist/**/*',
|
||||||
{base: 'external/dist', stripBOM: false})
|
{ base: 'external/dist', stripBOM: false, })
|
||||||
.pipe(gulp.dest(DIST_DIR)),
|
.pipe(gulp.dest(DIST_DIR)),
|
||||||
gulp.src(GENERIC_DIR + 'LICENSE')
|
gulp.src(GENERIC_DIR + 'LICENSE')
|
||||||
.pipe(gulp.dest(DIST_DIR)),
|
.pipe(gulp.dest(DIST_DIR)),
|
||||||
gulp.src(GENERIC_DIR + 'web/cmaps/**/*',
|
gulp.src(GENERIC_DIR + 'web/cmaps/**/*',
|
||||||
{base: GENERIC_DIR + 'web'})
|
{ base: GENERIC_DIR + 'web', })
|
||||||
.pipe(gulp.dest(DIST_DIR)),
|
.pipe(gulp.dest(DIST_DIR)),
|
||||||
gulp.src([
|
gulp.src([
|
||||||
GENERIC_DIR + 'build/pdf.js',
|
GENERIC_DIR + 'build/pdf.js',
|
||||||
@ -1347,9 +1348,9 @@ gulp.task('dist-repo-prepare', ['dist-pre'], function () {
|
|||||||
gulp.src(MINIFIED_DIR + 'build/pdf.worker.js')
|
gulp.src(MINIFIED_DIR + 'build/pdf.worker.js')
|
||||||
.pipe(rename('pdf.worker.min.js'))
|
.pipe(rename('pdf.worker.min.js'))
|
||||||
.pipe(gulp.dest(DIST_DIR + 'build/')),
|
.pipe(gulp.dest(DIST_DIR + 'build/')),
|
||||||
gulp.src(COMPONENTS_DIR + '**/*', {base: COMPONENTS_DIR})
|
gulp.src(COMPONENTS_DIR + '**/*', { base: COMPONENTS_DIR, })
|
||||||
.pipe(gulp.dest(DIST_DIR + 'web/')),
|
.pipe(gulp.dest(DIST_DIR + 'web/')),
|
||||||
gulp.src(LIB_DIR + '**/*', {base: LIB_DIR})
|
gulp.src(LIB_DIR + '**/*', { base: LIB_DIR, })
|
||||||
.pipe(gulp.dest(DIST_DIR + 'lib/')),
|
.pipe(gulp.dest(DIST_DIR + 'lib/')),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@ -1362,10 +1363,10 @@ gulp.task('dist-repo-git', ['dist-repo-prepare'], function () {
|
|||||||
|
|
||||||
var reason = process.env['PDFJS_UPDATE_REASON'];
|
var reason = process.env['PDFJS_UPDATE_REASON'];
|
||||||
var message = 'PDF.js version ' + VERSION + (reason ? ' - ' + reason : '');
|
var message = 'PDF.js version ' + VERSION + (reason ? ' - ' + reason : '');
|
||||||
safeSpawnSync('git', ['add', '*'], {cwd: DIST_DIR});
|
safeSpawnSync('git', ['add', '*'], { cwd: DIST_DIR, });
|
||||||
safeSpawnSync('git', ['commit', '-am', message], {cwd: DIST_DIR});
|
safeSpawnSync('git', ['commit', '-am', message], { cwd: DIST_DIR, });
|
||||||
safeSpawnSync('git', ['tag', '-a', 'v' + VERSION, '-m', message],
|
safeSpawnSync('git', ['tag', '-a', 'v' + VERSION, '-m', message],
|
||||||
{cwd: DIST_DIR});
|
{ cwd: DIST_DIR, });
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
console.log('Done. Push with');
|
console.log('Done. Push with');
|
||||||
@ -1385,7 +1386,7 @@ gulp.task('mozcentralbaseline', ['baseline'], function (done) {
|
|||||||
|
|
||||||
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
|
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
|
||||||
safeSpawnSync('gulp', ['mozcentral'],
|
safeSpawnSync('gulp', ['mozcentral'],
|
||||||
{env: process.env, cwd: workingDirectory, stdio: 'inherit'});
|
{ env: process.env, cwd: workingDirectory, stdio: 'inherit', });
|
||||||
|
|
||||||
// Copy the mozcentral build to the mozcentral baseline directory.
|
// Copy the mozcentral build to the mozcentral baseline directory.
|
||||||
rimraf.sync(MOZCENTRAL_BASELINE_DIR);
|
rimraf.sync(MOZCENTRAL_BASELINE_DIR);
|
||||||
@ -1395,10 +1396,10 @@ gulp.task('mozcentralbaseline', ['baseline'], function (done) {
|
|||||||
.pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR))
|
.pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR))
|
||||||
.on('end', function () {
|
.on('end', function () {
|
||||||
// Commit the mozcentral baseline.
|
// Commit the mozcentral baseline.
|
||||||
safeSpawnSync('git', ['init'], {cwd: MOZCENTRAL_BASELINE_DIR});
|
safeSpawnSync('git', ['init'], { cwd: MOZCENTRAL_BASELINE_DIR, });
|
||||||
safeSpawnSync('git', ['add', '.'], {cwd: MOZCENTRAL_BASELINE_DIR});
|
safeSpawnSync('git', ['add', '.'], { cwd: MOZCENTRAL_BASELINE_DIR, });
|
||||||
safeSpawnSync('git', ['commit', '-m', '"mozcentral baseline"'],
|
safeSpawnSync('git', ['commit', '-m', '"mozcentral baseline"'],
|
||||||
{cwd: MOZCENTRAL_BASELINE_DIR});
|
{ cwd: MOZCENTRAL_BASELINE_DIR, });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1418,10 +1419,10 @@ gulp.task('mozcentraldiff', ['mozcentral', 'mozcentralbaseline'],
|
|||||||
gulp.src([BUILD_DIR + 'mozcentral/**/*'])
|
gulp.src([BUILD_DIR + 'mozcentral/**/*'])
|
||||||
.pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR))
|
.pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR))
|
||||||
.on('end', function () {
|
.on('end', function () {
|
||||||
safeSpawnSync('git', ['add', '-A'], {cwd: MOZCENTRAL_BASELINE_DIR});
|
safeSpawnSync('git', ['add', '-A'], { cwd: MOZCENTRAL_BASELINE_DIR, });
|
||||||
var diff = safeSpawnSync('git',
|
var diff = safeSpawnSync('git',
|
||||||
['diff', '--binary', '--cached', '--unified=8'],
|
['diff', '--binary', '--cached', '--unified=8'],
|
||||||
{cwd: MOZCENTRAL_BASELINE_DIR}).stdout;
|
{ cwd: MOZCENTRAL_BASELINE_DIR, }).stdout;
|
||||||
|
|
||||||
createStringSource(MOZCENTRAL_DIFF_FILE, diff)
|
createStringSource(MOZCENTRAL_DIFF_FILE, diff)
|
||||||
.pipe(gulp.dest(BUILD_DIR))
|
.pipe(gulp.dest(BUILD_DIR))
|
||||||
@ -1436,8 +1437,8 @@ gulp.task('mozcentraldiff', ['mozcentral', 'mozcentralbaseline'],
|
|||||||
gulp.task('externaltest', function () {
|
gulp.task('externaltest', function () {
|
||||||
gutil.log('Running test-fixtures.js');
|
gutil.log('Running test-fixtures.js');
|
||||||
safeSpawnSync('node', ['external/builder/test-fixtures.js'],
|
safeSpawnSync('node', ['external/builder/test-fixtures.js'],
|
||||||
{stdio: 'inherit'});
|
{ stdio: 'inherit', });
|
||||||
gutil.log('Running test-fixtures_esprima.js');
|
gutil.log('Running test-fixtures_esprima.js');
|
||||||
safeSpawnSync('node', ['external/builder/test-fixtures_esprima.js'],
|
safeSpawnSync('node', ['external/builder/test-fixtures_esprima.js'],
|
||||||
{stdio: 'inherit'});
|
{ stdio: 'inherit', });
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
packages: {
|
packages: {
|
||||||
'': {
|
'': {
|
||||||
defaultExtension: 'js',
|
defaultExtension: 'js',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
paths: {
|
paths: {
|
||||||
'pdfjs': new URL('src', baseLocation).href,
|
'pdfjs': new URL('src', baseLocation).href,
|
||||||
@ -58,7 +58,7 @@
|
|||||||
babelOptions: {
|
babelOptions: {
|
||||||
es2015: false,
|
es2015: false,
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
map: {
|
map: {
|
||||||
'plugin-babel': new URL(PluginBabelPath, baseLocation).href,
|
'plugin-babel': new URL(PluginBabelPath, baseLocation).href,
|
||||||
@ -66,6 +66,6 @@
|
|||||||
new URL(SystemJSPluginBabelPath, baseLocation).href,
|
new URL(SystemJSPluginBabelPath, baseLocation).href,
|
||||||
'plugin-babel-cached': new URL(PluginBabelCachePath, baseLocation).href,
|
'plugin-babel-cached': new URL(PluginBabelCachePath, baseLocation).href,
|
||||||
},
|
},
|
||||||
transpiler: isCachingPossible ? 'plugin-babel-cached' : 'plugin-babel'
|
transpiler: isCachingPossible ? 'plugin-babel-cached' : 'plugin-babel',
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user