@ -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' , } ) ;
} ) ;
} ) ;