2016-03-05 00:36:46 +09:00
|
|
|
/* Copyright 2016 Mozilla Foundation
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
Switch to using ESLint, instead of JSHint, for linting
*Please note that most of the necessary code adjustments were made in PR 7890.*
ESLint has a number of advantageous properties, compared to JSHint. Among those are:
- The ability to find subtle bugs, thanks to more rules (e.g. PR 7881).
- Much more customizable in general, and many rules allow fine-tuned behaviour rather than the just the on/off rules in JSHint.
- Many more rules that can help developers avoid bugs, and a lot of rules that can be used to enforce a consistent coding style. The latter should be particularily useful for new contributors (and reduce the amount of stylistic review comments necessary).
- The ability to easily specify exactly what rules to use/not to use, as opposed to JSHint which has a default set. *Note:* in future JSHint version some of the rules we depend on will be removed, according to warnings in http://jshint.com/docs/options/, so we wouldn't be able to update without losing lint coverage.
- More easily disable one, or more, rules temporarily. In JSHint this requires using a numeric code, which isn't very user friendly, whereas in ESLint the rule name is simply used instead.
By default there's no rules enabled in ESLint, but there are some default rule sets available. However, to prevent linting failures if we update ESLint in the future, it seemed easier to just explicitly specify what rules we want.
Obviously this makes the ESLint config file somewhat bigger than the old JSHint config file, but given how rarely that one has been updated over the years I don't think that matters too much.
I've tried, to the best of my ability, to ensure that we enable the same rules for ESLint that we had for JSHint. Furthermore, I've also enabled a number of rules that seemed to make sense, both to catch possible errors *and* various style guide violations.
Despite the ESLint README claiming that it's slower that JSHint, https://github.com/eslint/eslint#how-does-eslint-performance-compare-to-jshint, locally this patch actually reduces the runtime for `gulp` lint (by approximately 20-25%).
A couple of stylistic rules that would have been nice to enable, but where our code currently differs to much to make it feasible:
- `comma-dangle`, controls trailing commas in Objects and Arrays (among others).
- `object-curly-spacing`, controls spacing inside of Objects.
- `spaced-comment`, used to enforce spaces after `//` and `/*. (This is made difficult by the fact that there's still some usage of the old preprocessor left.)
Rules that I indend to look into possibly enabling in follow-ups, if it seems to make sense: `no-else-return`, `no-lonely-if`, `brace-style` with the `allowSingleLine` parameter removed.
Useful links:
- http://eslint.org/docs/user-guide/configuring
- http://eslint.org/docs/rules/
2016-12-15 23:52:29 +09:00
|
|
|
/* eslint-env node */
|
2017-04-28 20:40:47 +09:00
|
|
|
/* eslint-disable object-shorthand */
|
2016-03-05 00:36:46 +09:00
|
|
|
/* globals target */
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2018-04-04 07:19:13 +09:00
|
|
|
var autoprefixer = require('autoprefixer');
|
2017-12-31 03:47:08 +09:00
|
|
|
var fancylog = require('fancy-log');
|
2016-03-05 05:14:56 +09:00
|
|
|
var fs = require('fs');
|
2016-03-05 00:36:46 +09:00
|
|
|
var gulp = require('gulp');
|
2018-04-04 07:19:13 +09:00
|
|
|
var postcss = require('gulp-postcss');
|
2017-02-04 23:19:46 +09:00
|
|
|
var rename = require('gulp-rename');
|
2017-02-07 23:53:33 +09:00
|
|
|
var replace = require('gulp-replace');
|
2017-03-02 02:11:39 +09:00
|
|
|
var transform = require('gulp-transform');
|
2016-10-16 23:06:37 +09:00
|
|
|
var mkdirp = require('mkdirp');
|
2017-02-22 07:24:07 +09:00
|
|
|
var path = require('path');
|
2016-03-05 05:14:56 +09:00
|
|
|
var rimraf = require('rimraf');
|
2016-03-05 00:36:46 +09:00
|
|
|
var stream = require('stream');
|
2016-04-23 07:20:47 +09:00
|
|
|
var exec = require('child_process').exec;
|
2016-05-02 23:58:29 +09:00
|
|
|
var spawn = require('child_process').spawn;
|
2017-04-15 04:28:46 +09:00
|
|
|
var spawnSync = require('child_process').spawnSync;
|
2016-04-23 07:20:47 +09:00
|
|
|
var streamqueue = require('streamqueue');
|
2017-01-11 02:50:38 +09:00
|
|
|
var merge = require('merge-stream');
|
2016-04-27 06:28:36 +09:00
|
|
|
var zip = require('gulp-zip');
|
2017-02-09 07:32:15 +09:00
|
|
|
var webpack2 = require('webpack');
|
|
|
|
var webpackStream = require('webpack-stream');
|
2017-12-31 03:47:08 +09:00
|
|
|
var Vinyl = require('vinyl');
|
|
|
|
var vfs = require('vinyl-fs');
|
2016-03-05 00:36:46 +09:00
|
|
|
|
2016-03-05 05:14:56 +09:00
|
|
|
var BUILD_DIR = 'build/';
|
|
|
|
var L10N_DIR = 'l10n/';
|
2016-05-02 23:58:29 +09:00
|
|
|
var TEST_DIR = 'test/';
|
2017-02-04 23:19:46 +09:00
|
|
|
var EXTENSION_SRC_DIR = 'extensions/';
|
2016-03-05 05:14:56 +09:00
|
|
|
|
2017-02-22 07:24:07 +09:00
|
|
|
var BASELINE_DIR = BUILD_DIR + 'baseline/';
|
2017-04-28 04:42:07 +09:00
|
|
|
var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline/';
|
2017-02-04 23:19:46 +09:00
|
|
|
var GENERIC_DIR = BUILD_DIR + 'generic/';
|
|
|
|
var COMPONENTS_DIR = BUILD_DIR + 'components/';
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
var IMAGE_DECODERS_DIR = BUILD_DIR + 'image_decoders';
|
2017-02-04 23:19:46 +09:00
|
|
|
var MINIFIED_DIR = BUILD_DIR + 'minified/';
|
2017-04-15 04:28:46 +09:00
|
|
|
var JSDOC_BUILD_DIR = BUILD_DIR + 'jsdoc/';
|
|
|
|
var GH_PAGES_DIR = BUILD_DIR + 'gh-pages/';
|
2017-04-19 04:00:53 +09:00
|
|
|
var SRC_DIR = 'src/';
|
|
|
|
var LIB_DIR = BUILD_DIR + 'lib/';
|
|
|
|
var DIST_DIR = BUILD_DIR + 'dist/';
|
2017-02-04 23:19:46 +09:00
|
|
|
var COMMON_WEB_FILES = [
|
|
|
|
'web/images/*.{png,svg,gif,cur}',
|
|
|
|
'web/debugger.js'
|
|
|
|
];
|
2017-04-28 05:59:45 +09:00
|
|
|
var MOZCENTRAL_DIFF_FILE = 'mozcentral.diff';
|
2017-02-04 23:19:46 +09:00
|
|
|
|
2017-04-15 04:28:46 +09:00
|
|
|
var REPO = 'git@github.com:mozilla/pdf.js.git';
|
2017-04-19 04:00:53 +09:00
|
|
|
var DIST_REPO_URL = 'https://github.com/mozilla/pdfjs-dist';
|
2017-04-15 04:28:46 +09:00
|
|
|
|
2017-02-04 23:19:46 +09:00
|
|
|
var builder = require('./external/builder/builder.js');
|
2016-04-23 07:20:47 +09:00
|
|
|
|
|
|
|
var CONFIG_FILE = 'pdfjs.config';
|
|
|
|
var config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString());
|
|
|
|
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
// Default Autoprefixer config used for generic, components, minified-pre
|
2018-04-04 21:51:29 +09:00
|
|
|
var AUTOPREFIXER_CONFIG = {
|
|
|
|
browsers: [
|
|
|
|
'last 2 versions',
|
|
|
|
'Chrome >= 49', // Last supported on Windows XP
|
|
|
|
'Firefox >= 52', // Last supported on Windows XP
|
|
|
|
'Firefox ESR',
|
|
|
|
'IE >= 11',
|
2018-06-21 15:12:30 +09:00
|
|
|
'Safari >= 9',
|
2018-04-04 21:51:29 +09:00
|
|
|
'> 0.5%',
|
|
|
|
'not dead',
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2016-04-23 07:20:47 +09:00
|
|
|
var DEFINES = {
|
|
|
|
PRODUCTION: true,
|
2018-06-12 00:25:50 +09:00
|
|
|
TESTING: false,
|
2016-04-23 07:20:47 +09:00
|
|
|
// The main build targets:
|
|
|
|
GENERIC: false,
|
|
|
|
FIREFOX: false,
|
|
|
|
MOZCENTRAL: false,
|
|
|
|
CHROME: false,
|
|
|
|
MINIFIED: false,
|
2017-03-14 01:35:33 +09:00
|
|
|
COMPONENTS: false,
|
2017-04-25 05:07:00 +09:00
|
|
|
LIB: false,
|
2017-10-16 01:42:15 +09:00
|
|
|
SKIP_BABEL: false,
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
IMAGE_DECODERS: false,
|
2016-04-23 07:20:47 +09:00
|
|
|
};
|
2016-03-05 00:36:46 +09:00
|
|
|
|
2017-04-28 06:21:26 +09:00
|
|
|
function safeSpawnSync(command, parameters, options) {
|
|
|
|
// Execute all commands in a shell.
|
|
|
|
options = options || {};
|
|
|
|
options.shell = true;
|
2017-05-03 22:17:31 +09:00
|
|
|
// `options.shell = true` requires parameters to be quoted.
|
|
|
|
parameters = parameters.map((param) => {
|
|
|
|
if (!/[\s`~!#$*(){\[|\\;'"<>?]/.test(param)) {
|
|
|
|
return param;
|
|
|
|
}
|
|
|
|
return '\"' + param.replace(/([$\\"`])/g, '\\$1') + '\"';
|
|
|
|
});
|
2017-04-28 06:21:26 +09:00
|
|
|
|
|
|
|
var result = spawnSync(command, parameters, options);
|
|
|
|
if (result.status !== 0) {
|
|
|
|
console.log('Error: command "' + command + '" with parameters "' +
|
|
|
|
parameters + '" exited with code ' + result.status);
|
|
|
|
process.exit(result.status);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-03-05 00:36:46 +09:00
|
|
|
function createStringSource(filename, content) {
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var source = stream.Readable({ objectMode: true, });
|
2016-03-05 00:36:46 +09:00
|
|
|
source._read = function () {
|
2017-12-31 03:47:08 +09:00
|
|
|
this.push(new Vinyl({
|
2016-03-05 00:36:46 +09:00
|
|
|
path: filename,
|
2018-05-20 23:18:54 +09:00
|
|
|
contents: Buffer.from(content),
|
2016-03-05 00:36:46 +09:00
|
|
|
}));
|
|
|
|
this.push(null);
|
|
|
|
};
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
2017-02-09 07:32:15 +09:00
|
|
|
function createWebpackConfig(defines, output) {
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var versionInfo = getVersionJSON();
|
|
|
|
var bundleDefines = builder.merge(defines, {
|
|
|
|
BUNDLE_VERSION: versionInfo.version,
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
BUNDLE_BUILD: versionInfo.commit,
|
2018-06-12 00:25:50 +09:00
|
|
|
TESTING: (defines.TESTING || process.env['TESTING'] === 'true'),
|
2017-02-09 07:32:15 +09:00
|
|
|
});
|
2017-12-16 14:31:43 +09:00
|
|
|
var licenseHeaderLibre =
|
|
|
|
fs.readFileSync('./src/license_header_libre.js').toString();
|
2017-05-04 02:17:18 +09:00
|
|
|
var enableSourceMaps = !bundleDefines.FIREFOX && !bundleDefines.MOZCENTRAL &&
|
2018-12-14 01:41:27 +09:00
|
|
|
!bundleDefines.CHROME && !bundleDefines.TESTING;
|
2017-10-16 01:42:15 +09:00
|
|
|
var skipBabel = bundleDefines.SKIP_BABEL ||
|
|
|
|
process.env['SKIP_BABEL'] === 'true';
|
2017-02-09 07:32:15 +09:00
|
|
|
|
2018-05-20 22:18:43 +09:00
|
|
|
// Required to expose e.g., the `window` object.
|
|
|
|
output.globalObject = 'this';
|
|
|
|
|
2017-02-09 07:32:15 +09:00
|
|
|
return {
|
2018-05-20 22:18:43 +09:00
|
|
|
mode: 'none',
|
2017-02-09 07:32:15 +09:00
|
|
|
output: output,
|
2018-05-20 22:18:43 +09:00
|
|
|
performance: {
|
|
|
|
hints: false, // Disable messages about larger file sizes.
|
|
|
|
},
|
2017-02-09 07:32:15 +09:00
|
|
|
plugins: [
|
2017-12-16 14:31:43 +09:00
|
|
|
new webpack2.BannerPlugin({ banner: licenseHeaderLibre, raw: true, }),
|
2017-02-09 07:32:15 +09:00
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'pdfjs': path.join(__dirname, 'src'),
|
|
|
|
'pdfjs-web': path.join(__dirname, 'web'),
|
2017-05-31 10:38:22 +09:00
|
|
|
'pdfjs-lib': path.join(__dirname, 'web/pdfjs'),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
},
|
2017-02-09 07:32:15 +09:00
|
|
|
},
|
2017-05-04 02:17:18 +09:00
|
|
|
devtool: enableSourceMaps ? 'source-map' : undefined,
|
2017-02-09 07:32:15 +09:00
|
|
|
module: {
|
2018-05-20 22:18:43 +09:00
|
|
|
rules: [
|
2017-03-06 23:42:48 +09:00
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
2018-05-30 09:38:03 +09:00
|
|
|
// babel is too slow
|
|
|
|
exclude: /src[\\\/]core[\\\/](glyphlist|unicode)/,
|
2017-03-06 23:42:48 +09:00
|
|
|
options: {
|
2018-11-23 20:52:29 +09:00
|
|
|
presets: skipBabel ? undefined : ['@babel/preset-env'],
|
2018-07-30 20:58:09 +09:00
|
|
|
plugins: [
|
2018-11-23 20:52:29 +09:00
|
|
|
'@babel/plugin-transform-modules-commonjs',
|
|
|
|
['@babel/plugin-transform-runtime', {
|
2018-07-30 20:58:09 +09:00
|
|
|
'helpers': false,
|
|
|
|
'regenerator': true,
|
|
|
|
}],
|
|
|
|
],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
},
|
2017-03-06 23:42:48 +09:00
|
|
|
},
|
2017-02-09 07:32:15 +09:00
|
|
|
{
|
|
|
|
loader: path.join(__dirname, 'external/webpack/pdfjsdev-loader.js'),
|
|
|
|
options: {
|
|
|
|
rootPath: __dirname,
|
2017-02-09 07:35:58 +09:00
|
|
|
saveComments: false,
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
defines: bundleDefines,
|
|
|
|
},
|
2017-03-06 23:42:48 +09:00
|
|
|
},
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
],
|
|
|
|
},
|
2017-07-09 22:19:16 +09:00
|
|
|
// Avoid shadowing actual Node.js variables with polyfills, by disabling
|
|
|
|
// polyfills/mocks - https://webpack.js.org/configuration/node/
|
2017-09-30 04:42:31 +09:00
|
|
|
node: false,
|
2017-02-09 07:32:15 +09:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function webpack2Stream(config) {
|
|
|
|
// Replacing webpack1 to webpack2 in the webpack-stream.
|
|
|
|
return webpackStream(config, webpack2);
|
2016-04-23 07:20:47 +09:00
|
|
|
}
|
|
|
|
|
2017-02-07 23:53:33 +09:00
|
|
|
function getVersionJSON() {
|
|
|
|
return JSON.parse(fs.readFileSync(BUILD_DIR + 'version.json').toString());
|
|
|
|
}
|
|
|
|
|
2016-05-12 07:58:17 +09:00
|
|
|
function checkChromePreferencesFile(chromePrefsPath, webPrefsPath) {
|
|
|
|
var chromePrefs = JSON.parse(fs.readFileSync(chromePrefsPath).toString());
|
|
|
|
var chromePrefsKeys = Object.keys(chromePrefs.properties);
|
2018-02-17 09:09:17 +09:00
|
|
|
chromePrefsKeys = chromePrefsKeys.filter(function (key) {
|
|
|
|
var description = chromePrefs.properties[key].description;
|
|
|
|
// Deprecated keys are allowed in the managed preferences file.
|
|
|
|
// The code maintained is responsible for adding migration logic to
|
|
|
|
// extensions/chromium/options/migration.js and web/chromecom.js .
|
|
|
|
return !description || !description.startsWith('DEPRECATED.');
|
|
|
|
});
|
2016-05-12 07:58:17 +09:00
|
|
|
chromePrefsKeys.sort();
|
|
|
|
var webPrefs = JSON.parse(fs.readFileSync(webPrefsPath).toString());
|
|
|
|
var webPrefsKeys = Object.keys(webPrefs);
|
|
|
|
webPrefsKeys.sort();
|
2016-05-29 23:44:50 +09:00
|
|
|
var telemetryIndex = chromePrefsKeys.indexOf('disableTelemetry');
|
|
|
|
if (telemetryIndex >= 0) {
|
|
|
|
chromePrefsKeys.splice(telemetryIndex, 1);
|
|
|
|
} else {
|
|
|
|
console.log('Warning: disableTelemetry key not found in chrome prefs!');
|
|
|
|
return false;
|
|
|
|
}
|
2016-05-12 07:58:17 +09:00
|
|
|
if (webPrefsKeys.length !== chromePrefsKeys.length) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return webPrefsKeys.every(function (value, index) {
|
|
|
|
return chromePrefsKeys[index] === value &&
|
|
|
|
chromePrefs.properties[value].default === webPrefs[value];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-02-09 07:32:15 +09:00
|
|
|
function replaceWebpackRequire() {
|
|
|
|
// Produced bundles can be rebundled again, avoid collisions (e.g. in api.js)
|
|
|
|
// by renaming __webpack_require__ to something else.
|
|
|
|
return replace('__webpack_require__', '__w_pdfjs_require__');
|
2016-04-23 07:20:47 +09:00
|
|
|
}
|
|
|
|
|
2018-03-16 05:49:28 +09:00
|
|
|
function replaceJSRootName(amdName, jsName) {
|
2017-02-09 07:48:37 +09:00
|
|
|
// Saving old-style JS module name.
|
|
|
|
return replace('root["' + amdName + '"] = factory()',
|
|
|
|
'root["' + amdName + '"] = root.' + jsName + ' = factory()');
|
|
|
|
}
|
|
|
|
|
2016-04-23 07:20:47 +09:00
|
|
|
function createBundle(defines) {
|
|
|
|
console.log();
|
|
|
|
console.log('### Bundling files into pdf.js');
|
|
|
|
|
|
|
|
var mainAMDName = 'pdfjs-dist/build/pdf';
|
|
|
|
var mainOutputName = 'pdf.js';
|
|
|
|
|
2017-02-09 07:32:15 +09:00
|
|
|
var mainFileConfig = createWebpackConfig(defines, {
|
|
|
|
filename: mainOutputName,
|
|
|
|
library: mainAMDName,
|
|
|
|
libraryTarget: 'umd',
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
umdNamedDefine: true,
|
2017-02-09 07:32:15 +09:00
|
|
|
});
|
|
|
|
var mainOutput = gulp.src('./src/pdf.js')
|
|
|
|
.pipe(webpack2Stream(mainFileConfig))
|
2017-02-09 07:48:37 +09:00
|
|
|
.pipe(replaceWebpackRequire())
|
2018-03-16 05:49:28 +09:00
|
|
|
.pipe(replaceJSRootName(mainAMDName, 'pdfjsLib'));
|
2017-02-09 07:32:15 +09:00
|
|
|
|
|
|
|
var workerAMDName = 'pdfjs-dist/build/pdf.worker';
|
|
|
|
var workerOutputName = 'pdf.worker.js';
|
|
|
|
|
|
|
|
var workerFileConfig = createWebpackConfig(defines, {
|
|
|
|
filename: workerOutputName,
|
|
|
|
library: workerAMDName,
|
|
|
|
libraryTarget: 'umd',
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
umdNamedDefine: true,
|
2017-02-09 07:32:15 +09:00
|
|
|
});
|
2018-03-16 05:49:28 +09:00
|
|
|
|
2017-02-09 07:32:15 +09:00
|
|
|
var workerOutput = gulp.src('./src/pdf.worker.js')
|
|
|
|
.pipe(webpack2Stream(workerFileConfig))
|
2017-02-09 07:48:37 +09:00
|
|
|
.pipe(replaceWebpackRequire())
|
2018-03-16 05:49:28 +09:00
|
|
|
.pipe(replaceJSRootName(workerAMDName, 'pdfjsWorker'));
|
2017-02-09 07:32:15 +09:00
|
|
|
return merge([mainOutput, workerOutput]);
|
2016-04-23 07:20:47 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
function createWebBundle(defines) {
|
2017-02-09 07:32:15 +09:00
|
|
|
var viewerOutputName = 'viewer.js';
|
2016-04-23 07:20:47 +09:00
|
|
|
|
2017-02-09 07:32:15 +09:00
|
|
|
var viewerFileConfig = createWebpackConfig(defines, {
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
filename: viewerOutputName,
|
2017-02-09 07:32:15 +09:00
|
|
|
});
|
|
|
|
return gulp.src('./web/viewer.js')
|
|
|
|
.pipe(webpack2Stream(viewerFileConfig));
|
|
|
|
}
|
|
|
|
|
|
|
|
function createComponentsBundle(defines) {
|
|
|
|
var componentsAMDName = 'pdfjs-dist/web/pdf_viewer';
|
|
|
|
var componentsOutputName = 'pdf_viewer.js';
|
|
|
|
|
|
|
|
var componentsFileConfig = createWebpackConfig(defines, {
|
|
|
|
filename: componentsOutputName,
|
|
|
|
library: componentsAMDName,
|
|
|
|
libraryTarget: 'umd',
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
umdNamedDefine: true,
|
2017-02-09 07:32:15 +09:00
|
|
|
});
|
|
|
|
return gulp.src('./web/pdf_viewer.component.js')
|
|
|
|
.pipe(webpack2Stream(componentsFileConfig))
|
2017-02-09 07:48:37 +09:00
|
|
|
.pipe(replaceWebpackRequire())
|
2018-03-16 05:49:28 +09:00
|
|
|
.pipe(replaceJSRootName(componentsAMDName, 'pdfjsViewer'));
|
2016-04-23 07:20:47 +09:00
|
|
|
}
|
|
|
|
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
function createImageDecodersBundle(defines) {
|
|
|
|
var imageDecodersAMDName = 'pdfjs-dist/image_decoders/pdf.image_decoders';
|
|
|
|
var imageDecodersOutputName = 'pdf.image_decoders.js';
|
|
|
|
|
|
|
|
var componentsFileConfig = createWebpackConfig(defines, {
|
|
|
|
filename: imageDecodersOutputName,
|
|
|
|
library: imageDecodersAMDName,
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
umdNamedDefine: true,
|
|
|
|
});
|
|
|
|
return gulp.src('./src/pdf.image_decoders.js')
|
|
|
|
.pipe(webpack2Stream(componentsFileConfig))
|
|
|
|
.pipe(replaceWebpackRequire())
|
|
|
|
.pipe(replaceJSRootName(imageDecodersAMDName, 'pdfjsImageDecoders'));
|
|
|
|
}
|
|
|
|
|
2016-05-02 23:58:29 +09:00
|
|
|
function checkFile(path) {
|
|
|
|
try {
|
|
|
|
var stat = fs.lstatSync(path);
|
|
|
|
return stat.isFile();
|
|
|
|
} catch (e) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-11 02:50:38 +09:00
|
|
|
function checkDir(path) {
|
|
|
|
try {
|
|
|
|
var stat = fs.lstatSync(path);
|
|
|
|
return stat.isDirectory();
|
|
|
|
} catch (e) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-15 04:28:46 +09:00
|
|
|
function replaceInFile(path, find, replacement) {
|
|
|
|
var content = fs.readFileSync(path).toString();
|
|
|
|
content = content.replace(find, replacement);
|
|
|
|
fs.writeFileSync(path, content);
|
|
|
|
}
|
|
|
|
|
2017-02-04 23:19:46 +09:00
|
|
|
function getTempFile(prefix, suffix) {
|
|
|
|
mkdirp.sync(BUILD_DIR + 'tmp/');
|
|
|
|
var bytes = require('crypto').randomBytes(6).toString('hex');
|
|
|
|
var path = BUILD_DIR + 'tmp/' + prefix + bytes + suffix;
|
|
|
|
fs.writeFileSync(path, '');
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
2018-08-04 09:48:47 +09:00
|
|
|
function createTestSource(testsName, bot) {
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var source = stream.Readable({ objectMode: true, });
|
2016-05-02 23:58:29 +09:00
|
|
|
source._read = function () {
|
|
|
|
console.log();
|
|
|
|
console.log('### Running ' + testsName + ' tests');
|
|
|
|
|
|
|
|
var PDF_TEST = process.env['PDF_TEST'] || 'test_manifest.json';
|
|
|
|
var PDF_BROWSERS = process.env['PDF_BROWSERS'] ||
|
|
|
|
'resources/browser_manifests/browser_manifest.json';
|
|
|
|
|
|
|
|
if (!checkFile('test/' + PDF_BROWSERS)) {
|
|
|
|
console.log('Browser manifest file test/' + PDF_BROWSERS +
|
|
|
|
' does not exist.');
|
|
|
|
console.log('Copy and adjust the example in ' +
|
|
|
|
'test/resources/browser_manifests.');
|
|
|
|
this.emit('error', new Error('Missing manifest file'));
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
var args = ['test.js'];
|
|
|
|
switch (testsName) {
|
|
|
|
case 'browser':
|
|
|
|
args.push('--reftest', '--manifestFile=' + PDF_TEST);
|
|
|
|
break;
|
|
|
|
case 'browser (no reftest)':
|
|
|
|
args.push('--manifestFile=' + PDF_TEST);
|
|
|
|
break;
|
|
|
|
case 'unit':
|
|
|
|
args.push('--unitTest');
|
|
|
|
break;
|
|
|
|
case 'font':
|
|
|
|
args.push('--fontTest');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
this.emit('error', new Error('Unknown name: ' + testsName));
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
args.push('--browserManifestFile=' + PDF_BROWSERS);
|
2018-08-04 09:48:47 +09:00
|
|
|
if (bot) {
|
|
|
|
args.push('--strictVerify');
|
|
|
|
}
|
2016-05-02 23:58:29 +09:00
|
|
|
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var testProcess = spawn('node', args, { cwd: TEST_DIR, stdio: 'inherit', });
|
2016-05-02 23:58:29 +09:00
|
|
|
testProcess.on('close', function (code) {
|
|
|
|
source.push(null);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
2018-08-04 09:48:47 +09:00
|
|
|
function makeRef(done, bot) {
|
2017-02-25 08:12:02 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Creating reference images');
|
|
|
|
|
|
|
|
var PDF_BROWSERS = process.env['PDF_BROWSERS'] ||
|
|
|
|
'resources/browser_manifests/browser_manifest.json';
|
|
|
|
|
|
|
|
if (!checkFile('test/' + PDF_BROWSERS)) {
|
|
|
|
console.log('Browser manifest file test/' + PDF_BROWSERS +
|
|
|
|
' does not exist.');
|
|
|
|
console.log('Copy and adjust the example in ' +
|
|
|
|
'test/resources/browser_manifests.');
|
|
|
|
done(new Error('Missing manifest file'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var args = ['test.js', '--masterMode'];
|
2018-08-04 09:48:47 +09:00
|
|
|
if (bot) {
|
|
|
|
args.push('--noPrompts', '--strictVerify');
|
2017-02-25 08:12:02 +09:00
|
|
|
}
|
|
|
|
args.push('--browserManifestFile=' + PDF_BROWSERS);
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var testProcess = spawn('node', args, { cwd: TEST_DIR, stdio: 'inherit', });
|
2017-02-25 08:12:02 +09:00
|
|
|
testProcess.on('close', function (code) {
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('default', function(done) {
|
2016-03-05 00:36:46 +09:00
|
|
|
console.log('Available tasks:');
|
2018-11-19 02:33:23 +09:00
|
|
|
var tasks = Object.keys(gulp.registry().tasks());
|
2016-03-05 00:36:46 +09:00
|
|
|
tasks.sort();
|
|
|
|
tasks.forEach(function (taskName) {
|
|
|
|
console.log(' ' + taskName);
|
|
|
|
});
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
2016-03-05 00:36:46 +09:00
|
|
|
});
|
|
|
|
|
2016-04-23 07:20:47 +09:00
|
|
|
gulp.task('buildnumber', function (done) {
|
|
|
|
console.log();
|
|
|
|
console.log('### Getting extension build number');
|
|
|
|
|
|
|
|
exec('git log --format=oneline ' + config.baseVersion + '..',
|
|
|
|
function (err, stdout, stderr) {
|
|
|
|
var buildNumber = 0;
|
|
|
|
if (!err) {
|
|
|
|
// Build number is the number of commits since base version
|
|
|
|
buildNumber = stdout ? stdout.match(/\n/g).length : 0;
|
2018-06-30 01:22:10 +09:00
|
|
|
} else {
|
|
|
|
console.log('This is not a Git repository; using default build number.');
|
2016-04-23 07:20:47 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
console.log('Extension build number: ' + buildNumber);
|
|
|
|
|
|
|
|
var version = config.versionPrefix + buildNumber;
|
|
|
|
|
|
|
|
exec('git log --format="%h" -n 1', function (err, stdout, stderr) {
|
|
|
|
var buildCommit = '';
|
|
|
|
if (!err) {
|
|
|
|
buildCommit = stdout.replace('\n', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
createStringSource('version.json', JSON.stringify({
|
|
|
|
version: version,
|
|
|
|
build: buildNumber,
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
commit: buildCommit,
|
2016-04-23 07:20:47 +09:00
|
|
|
}, null, 2))
|
|
|
|
.pipe(gulp.dest(BUILD_DIR))
|
|
|
|
.on('end', done);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-01-11 02:50:38 +09:00
|
|
|
gulp.task('locale', function () {
|
|
|
|
var VIEWER_LOCALE_OUTPUT = 'web/locale/';
|
|
|
|
var METADATA_OUTPUT = 'extensions/firefox/';
|
|
|
|
var EXTENSION_LOCALE_OUTPUT = 'extensions/firefox/locale/';
|
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('### Building localization files');
|
|
|
|
|
|
|
|
rimraf.sync(EXTENSION_LOCALE_OUTPUT);
|
|
|
|
mkdirp.sync(EXTENSION_LOCALE_OUTPUT);
|
|
|
|
rimraf.sync(VIEWER_LOCALE_OUTPUT);
|
|
|
|
mkdirp.sync(VIEWER_LOCALE_OUTPUT);
|
|
|
|
|
|
|
|
var subfolders = fs.readdirSync(L10N_DIR);
|
|
|
|
subfolders.sort();
|
|
|
|
var metadataContent = '';
|
|
|
|
var chromeManifestContent = '';
|
|
|
|
var viewerOutput = '';
|
|
|
|
var locales = [];
|
|
|
|
for (var i = 0; i < subfolders.length; i++) {
|
|
|
|
var locale = subfolders[i];
|
|
|
|
var path = L10N_DIR + locale;
|
|
|
|
if (!checkDir(path)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!/^[a-z][a-z]([a-z])?(-[A-Z][A-Z])?$/.test(locale)) {
|
|
|
|
console.log('Skipping invalid locale: ' + locale);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
mkdirp.sync(EXTENSION_LOCALE_OUTPUT + '/' + locale);
|
|
|
|
mkdirp.sync(VIEWER_LOCALE_OUTPUT + '/' + locale);
|
|
|
|
|
|
|
|
locales.push(locale);
|
|
|
|
|
|
|
|
chromeManifestContent += 'locale pdf.js ' + locale + ' locale/' +
|
|
|
|
locale + '/\n';
|
|
|
|
|
|
|
|
if (checkFile(path + '/viewer.properties')) {
|
|
|
|
viewerOutput += '[' + locale + ']\n' +
|
|
|
|
'@import url(' + locale + '/viewer.properties)\n\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (checkFile(path + '/metadata.inc')) {
|
|
|
|
var metadata = fs.readFileSync(path + '/metadata.inc').toString();
|
|
|
|
metadataContent += metadata;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return merge([
|
|
|
|
createStringSource('metadata.inc', metadataContent)
|
|
|
|
.pipe(gulp.dest(METADATA_OUTPUT)),
|
|
|
|
createStringSource('chrome.manifest.inc', chromeManifestContent)
|
|
|
|
.pipe(gulp.dest(METADATA_OUTPUT)),
|
|
|
|
gulp.src(L10N_DIR + '/{' + locales.join(',') + '}' +
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
'/{viewer,chrome}.properties', { base: L10N_DIR, })
|
2017-01-11 02:50:38 +09:00
|
|
|
.pipe(gulp.dest(EXTENSION_LOCALE_OUTPUT)),
|
|
|
|
|
|
|
|
createStringSource('locale.properties', viewerOutput)
|
|
|
|
.pipe(gulp.dest(VIEWER_LOCALE_OUTPUT)),
|
|
|
|
gulp.src(L10N_DIR + '/{' + locales.join(',') + '}' +
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
'/viewer.properties', { base: L10N_DIR, })
|
2017-01-11 02:50:38 +09:00
|
|
|
.pipe(gulp.dest(VIEWER_LOCALE_OUTPUT))
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('cmaps', function (done) {
|
2017-01-11 02:50:38 +09:00
|
|
|
var CMAP_INPUT = 'external/cmaps';
|
|
|
|
var VIEWER_CMAP_OUTPUT = 'external/bcmaps';
|
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('### Building cmaps');
|
|
|
|
|
|
|
|
// Testing a file that usually present.
|
|
|
|
if (!checkFile(CMAP_INPUT + '/UniJIS-UCS2-H')) {
|
|
|
|
console.log('./external/cmaps has no cmap files, download them from:');
|
|
|
|
console.log(' https://github.com/adobe-type-tools/cmap-resources');
|
|
|
|
throw new Error('cmap files were not found');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove old bcmap files.
|
|
|
|
fs.readdirSync(VIEWER_CMAP_OUTPUT).forEach(function (file) {
|
|
|
|
if (/\.bcmap$/i.test(file)) {
|
|
|
|
fs.unlinkSync(VIEWER_CMAP_OUTPUT + '/' + file);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var compressCmaps =
|
|
|
|
require('./external/cmapscompress/compress.js').compressCmaps;
|
|
|
|
compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true);
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
2017-01-11 02:50:38 +09:00
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('bundle', gulp.series('buildnumber', function () {
|
2017-02-04 23:19:46 +09:00
|
|
|
return createBundle(DEFINES).pipe(gulp.dest(BUILD_DIR));
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-04-23 07:20:47 +09:00
|
|
|
|
2017-02-04 23:19:46 +09:00
|
|
|
function preprocessCSS(source, mode, defines, cleanup) {
|
|
|
|
var outName = getTempFile('~preprocess', '.css');
|
2017-04-29 02:47:20 +09:00
|
|
|
builder.preprocessCSS(mode, source, outName);
|
2017-02-04 23:19:46 +09:00
|
|
|
var out = fs.readFileSync(outName).toString();
|
|
|
|
fs.unlinkSync(outName);
|
|
|
|
if (cleanup) {
|
|
|
|
// Strip out all license headers in the middle.
|
|
|
|
var reg = /\n\/\* Copyright(.|\n)*?Mozilla Foundation(.|\n)*?\*\//g;
|
|
|
|
out = out.replace(reg, '');
|
|
|
|
}
|
|
|
|
|
|
|
|
var i = source.lastIndexOf('/');
|
|
|
|
return createStringSource(source.substr(i + 1), out);
|
|
|
|
}
|
|
|
|
|
|
|
|
function preprocessHTML(source, defines) {
|
|
|
|
var outName = getTempFile('~preprocess', '.html');
|
2017-04-29 02:47:20 +09:00
|
|
|
builder.preprocess(source, outName, defines);
|
2017-02-04 23:19:46 +09:00
|
|
|
var out = fs.readFileSync(outName).toString();
|
|
|
|
fs.unlinkSync(outName);
|
|
|
|
|
|
|
|
var i = source.lastIndexOf('/');
|
|
|
|
return createStringSource(source.substr(i + 1), out);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Builds the generic production viewer that should be compatible with most
|
|
|
|
// modern HTML5 browsers.
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('generic', gulp.series('buildnumber', 'locale', function () {
|
2017-02-04 23:19:46 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Creating generic viewer');
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var defines = builder.merge(DEFINES, { GENERIC: true, });
|
2017-02-04 23:19:46 +09:00
|
|
|
|
|
|
|
rimraf.sync(GENERIC_DIR);
|
|
|
|
|
|
|
|
return merge([
|
|
|
|
createBundle(defines).pipe(gulp.dest(GENERIC_DIR + 'build')),
|
|
|
|
createWebBundle(defines).pipe(gulp.dest(GENERIC_DIR + 'web')),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
|
|
|
gulp.src('LICENSE').pipe(gulp.dest(GENERIC_DIR)),
|
|
|
|
gulp.src([
|
|
|
|
'web/locale/*/viewer.properties',
|
|
|
|
'web/locale/locale.properties'
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
], { base: 'web/', }).pipe(gulp.dest(GENERIC_DIR + 'web')),
|
2017-02-04 23:19:46 +09:00
|
|
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ base: 'external/bcmaps', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(GENERIC_DIR + 'web/cmaps')),
|
|
|
|
preprocessHTML('web/viewer.html', defines)
|
|
|
|
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
|
|
|
preprocessCSS('web/viewer.css', 'generic', defines, true)
|
2018-04-04 21:51:29 +09:00
|
|
|
.pipe(postcss([autoprefixer(AUTOPREFIXER_CONFIG)]))
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
|
|
|
|
|
|
|
gulp.src('web/compressed.tracemonkey-pldi-09.pdf')
|
|
|
|
.pipe(gulp.dest(GENERIC_DIR + 'web')),
|
|
|
|
]);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-04-23 07:20:47 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('components', gulp.series('buildnumber', function () {
|
2017-02-04 23:19:46 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Creating generic components');
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var defines = builder.merge(DEFINES, { COMPONENTS: true, GENERIC: true, });
|
2017-02-04 23:19:46 +09:00
|
|
|
|
|
|
|
rimraf.sync(COMPONENTS_DIR);
|
|
|
|
|
|
|
|
var COMPONENTS_IMAGES = [
|
|
|
|
'web/images/annotation-*.svg',
|
|
|
|
'web/images/loading-icon.gif',
|
|
|
|
'web/images/shadow.png',
|
|
|
|
'web/images/texture.png',
|
|
|
|
];
|
|
|
|
|
|
|
|
return merge([
|
2017-02-09 07:32:15 +09:00
|
|
|
createComponentsBundle(defines).pipe(gulp.dest(COMPONENTS_DIR)),
|
2017-02-04 23:19:46 +09:00
|
|
|
gulp.src(COMPONENTS_IMAGES).pipe(gulp.dest(COMPONENTS_DIR + 'images')),
|
|
|
|
preprocessCSS('web/pdf_viewer.css', 'components', defines, true)
|
2018-04-04 21:51:29 +09:00
|
|
|
.pipe(postcss([autoprefixer(AUTOPREFIXER_CONFIG)]))
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(COMPONENTS_DIR)),
|
|
|
|
]);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-04-23 07:20:47 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('image_decoders', gulp.series('buildnumber', function() {
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Creating image decoders');
|
|
|
|
var defines = builder.merge(DEFINES, { GENERIC: true,
|
|
|
|
IMAGE_DECODERS: true, });
|
|
|
|
|
|
|
|
return createImageDecodersBundle(defines).pipe(gulp.dest(IMAGE_DECODERS_DIR));
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('minified-pre', gulp.series('buildnumber', 'locale', function () {
|
2017-02-04 23:19:46 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Creating minified viewer');
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var defines = builder.merge(DEFINES, { MINIFIED: true, GENERIC: true, });
|
2017-02-04 23:19:46 +09:00
|
|
|
|
|
|
|
rimraf.sync(MINIFIED_DIR);
|
|
|
|
|
|
|
|
return merge([
|
|
|
|
createBundle(defines).pipe(gulp.dest(MINIFIED_DIR + 'build')),
|
|
|
|
createWebBundle(defines).pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
createImageDecodersBundle(builder.merge(defines, { IMAGE_DECODERS: true, }))
|
|
|
|
.pipe(gulp.dest(MINIFIED_DIR + 'image_decoders')),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
|
|
|
gulp.src([
|
|
|
|
'web/locale/*/viewer.properties',
|
|
|
|
'web/locale/locale.properties'
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
], { base: 'web/', }).pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
2017-02-04 23:19:46 +09:00
|
|
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ base: 'external/bcmaps', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MINIFIED_DIR + 'web/cmaps')),
|
|
|
|
|
|
|
|
preprocessHTML('web/viewer.html', defines)
|
|
|
|
.pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
|
|
|
preprocessCSS('web/viewer.css', 'minified', defines, true)
|
2018-04-04 21:51:29 +09:00
|
|
|
.pipe(postcss([autoprefixer(AUTOPREFIXER_CONFIG)]))
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
|
|
|
|
|
|
|
gulp.src('web/compressed.tracemonkey-pldi-09.pdf')
|
|
|
|
.pipe(gulp.dest(MINIFIED_DIR + 'web')),
|
|
|
|
]);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-04-23 07:20:47 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('minified-post', gulp.series('minified-pre', function (done) {
|
2017-08-27 21:18:04 +09:00
|
|
|
var pdfFile = fs.readFileSync(MINIFIED_DIR + '/build/pdf.js').toString();
|
|
|
|
var pdfWorkerFile =
|
|
|
|
fs.readFileSync(MINIFIED_DIR + '/build/pdf.worker.js').toString();
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
var pdfImageDecodersFile = fs.readFileSync(MINIFIED_DIR +
|
|
|
|
'/image_decoders/pdf.image_decoders.js').toString();
|
2017-08-27 21:18:04 +09:00
|
|
|
var viewerFiles = {
|
|
|
|
'pdf.js': pdfFile,
|
|
|
|
'viewer.js': fs.readFileSync(MINIFIED_DIR + '/web/viewer.js').toString(),
|
|
|
|
};
|
2017-04-19 04:00:53 +09:00
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('### Minifying js files');
|
|
|
|
|
2018-11-23 20:06:07 +09:00
|
|
|
var Terser = require('terser');
|
2017-04-19 04:00:53 +09:00
|
|
|
// V8 chokes on very long sequences. Works around that.
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var optsForHugeFile = { compress: { sequences: false, }, };
|
2017-04-19 04:00:53 +09:00
|
|
|
|
2017-04-28 06:21:26 +09:00
|
|
|
fs.writeFileSync(MINIFIED_DIR + '/web/pdf.viewer.js',
|
2018-11-23 20:06:07 +09:00
|
|
|
Terser.minify(viewerFiles).code);
|
2017-04-28 06:21:26 +09:00
|
|
|
fs.writeFileSync(MINIFIED_DIR + '/build/pdf.min.js',
|
2018-11-23 20:06:07 +09:00
|
|
|
Terser.minify(pdfFile).code);
|
2017-04-28 06:21:26 +09:00
|
|
|
fs.writeFileSync(MINIFIED_DIR + '/build/pdf.worker.min.js',
|
2018-11-23 20:06:07 +09:00
|
|
|
Terser.minify(pdfWorkerFile, optsForHugeFile).code);
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
fs.writeFileSync(MINIFIED_DIR + 'image_decoders/pdf.image_decoders.min.js',
|
2018-11-23 20:06:07 +09:00
|
|
|
Terser.minify(pdfImageDecodersFile).code);
|
2017-04-19 04:00:53 +09:00
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('### Cleaning js files');
|
|
|
|
|
|
|
|
fs.unlinkSync(MINIFIED_DIR + '/web/viewer.js');
|
|
|
|
fs.unlinkSync(MINIFIED_DIR + '/web/debugger.js');
|
|
|
|
fs.unlinkSync(MINIFIED_DIR + '/build/pdf.js');
|
|
|
|
fs.unlinkSync(MINIFIED_DIR + '/build/pdf.worker.js');
|
|
|
|
fs.renameSync(MINIFIED_DIR + '/build/pdf.min.js',
|
|
|
|
MINIFIED_DIR + '/build/pdf.js');
|
|
|
|
fs.renameSync(MINIFIED_DIR + '/build/pdf.worker.min.js',
|
|
|
|
MINIFIED_DIR + '/build/pdf.worker.js');
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
fs.renameSync(MINIFIED_DIR + '/image_decoders/pdf.image_decoders.min.js',
|
|
|
|
MINIFIED_DIR + '/image_decoders/pdf.image_decoders.js');
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
|
|
|
}));
|
2017-02-07 23:53:33 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('minified', gulp.series('minified-post'));
|
2017-04-19 04:00:53 +09:00
|
|
|
|
2018-03-17 00:46:57 +09:00
|
|
|
function preprocessDefaultPreferences(content) {
|
|
|
|
var preprocessor2 = require('./external/builder/preprocessor2.js');
|
|
|
|
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
|
|
|
|
2018-08-28 22:45:05 +09:00
|
|
|
var GLOBALS = '/* eslint-disable */\n';
|
2018-03-17 00:46:57 +09:00
|
|
|
var MODIFICATION_WARNING =
|
2018-08-28 22:45:05 +09:00
|
|
|
'//\n// THIS FILE IS GENERATED AUTOMATICALLY, DO NOT EDIT MANUALLY!\n//\n';
|
2018-03-17 00:46:57 +09:00
|
|
|
|
|
|
|
content = preprocessor2.preprocessPDFJSCode({
|
|
|
|
rootPath: __dirname,
|
|
|
|
defines: DEFINES,
|
|
|
|
}, content);
|
|
|
|
|
2018-08-28 22:45:05 +09:00
|
|
|
return (licenseHeader + '\n' + GLOBALS + '\n' + MODIFICATION_WARNING + '\n' +
|
|
|
|
content + '\n');
|
2018-03-17 00:46:57 +09:00
|
|
|
}
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('mozcentral-pre', gulp.series('buildnumber', 'locale', function () {
|
2017-02-04 23:19:46 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Building mozilla-central extension');
|
2017-10-16 01:42:15 +09:00
|
|
|
var defines = builder.merge(DEFINES, { MOZCENTRAL: true, SKIP_BABEL: true, });
|
2017-02-04 23:19:46 +09:00
|
|
|
|
|
|
|
var MOZCENTRAL_DIR = BUILD_DIR + 'mozcentral/',
|
|
|
|
MOZCENTRAL_EXTENSION_DIR = MOZCENTRAL_DIR + 'browser/extensions/pdfjs/',
|
|
|
|
MOZCENTRAL_CONTENT_DIR = MOZCENTRAL_EXTENSION_DIR + 'content/',
|
|
|
|
FIREFOX_EXTENSION_DIR = 'extensions/firefox/',
|
|
|
|
MOZCENTRAL_L10N_DIR = MOZCENTRAL_DIR + 'browser/locales/en-US/pdfviewer/',
|
2018-03-16 06:26:11 +09:00
|
|
|
FIREFOX_CONTENT_DIR = EXTENSION_SRC_DIR + '/firefox/content/';
|
2017-02-04 23:19:46 +09:00
|
|
|
|
|
|
|
// Clear out everything in the firefox extension build directory
|
|
|
|
rimraf.sync(MOZCENTRAL_DIR);
|
|
|
|
|
2017-04-28 23:20:21 +09:00
|
|
|
var versionJSON = getVersionJSON();
|
|
|
|
var version = versionJSON.version, commit = versionJSON.commit;
|
2017-02-07 23:53:33 +09:00
|
|
|
|
2017-02-04 23:19:46 +09:00
|
|
|
return merge([
|
|
|
|
createBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'build')),
|
|
|
|
createWebBundle(defines).pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
|
|
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ base: 'external/bcmaps', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web/cmaps')),
|
|
|
|
|
|
|
|
preprocessHTML('web/viewer.html', defines)
|
|
|
|
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
|
|
|
preprocessCSS('web/viewer.css', 'mozcentral', defines, true)
|
2018-04-04 21:51:29 +09:00
|
|
|
.pipe(postcss([
|
|
|
|
autoprefixer({ browsers: ['last 1 firefox versions'], })
|
|
|
|
]))
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR + 'web')),
|
|
|
|
|
2017-02-10 19:46:14 +09:00
|
|
|
gulp.src(FIREFOX_EXTENSION_DIR + 'locale/en-US/*.properties')
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MOZCENTRAL_L10N_DIR)),
|
|
|
|
gulp.src(FIREFOX_EXTENSION_DIR + 'README.mozilla')
|
2017-02-07 23:53:33 +09:00
|
|
|
.pipe(replace(/\bPDFJSSCRIPT_VERSION\b/g, version))
|
2017-04-28 05:33:53 +09:00
|
|
|
.pipe(replace(/\bPDFJSSCRIPT_COMMIT\b/g, commit))
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(MOZCENTRAL_EXTENSION_DIR)),
|
|
|
|
gulp.src('LICENSE').pipe(gulp.dest(MOZCENTRAL_EXTENSION_DIR)),
|
2018-03-17 00:46:57 +09:00
|
|
|
gulp.src(FIREFOX_CONTENT_DIR + 'PdfJsDefaultPreferences.jsm')
|
|
|
|
.pipe(transform('utf8', preprocessDefaultPreferences))
|
|
|
|
.pipe(gulp.dest(MOZCENTRAL_CONTENT_DIR)),
|
2017-02-04 23:19:46 +09:00
|
|
|
]);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2017-02-04 23:19:46 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('mozcentral', gulp.series('mozcentral-pre'));
|
2017-02-07 23:53:33 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('chromium-pre', gulp.series('buildnumber', 'locale', function () {
|
2017-02-04 23:19:46 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Building Chromium extension');
|
2018-07-30 20:58:09 +09:00
|
|
|
var defines = builder.merge(DEFINES, { CHROME: true, });
|
2017-02-04 23:19:46 +09:00
|
|
|
|
|
|
|
var CHROME_BUILD_DIR = BUILD_DIR + '/chromium/',
|
|
|
|
CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + '/content/';
|
|
|
|
|
|
|
|
// Clear out everything in the chrome extension build directory
|
|
|
|
rimraf.sync(CHROME_BUILD_DIR);
|
2017-02-07 23:53:33 +09:00
|
|
|
|
|
|
|
var version = getVersionJSON().version;
|
|
|
|
|
2017-02-04 23:19:46 +09:00
|
|
|
return merge([
|
|
|
|
createBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'build')),
|
|
|
|
createWebBundle(defines).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src(COMMON_WEB_FILES, { base: 'web/', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
|
|
|
|
|
|
|
gulp.src([
|
|
|
|
'web/locale/*/viewer.properties',
|
|
|
|
'web/locale/locale.properties'
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
], { base: 'web/', }).pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
2017-02-04 23:19:46 +09:00
|
|
|
gulp.src(['external/bcmaps/*.bcmap', 'external/bcmaps/LICENSE'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ base: 'external/bcmaps', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web/cmaps')),
|
|
|
|
|
|
|
|
preprocessHTML('web/viewer.html', defines)
|
|
|
|
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
|
|
|
preprocessCSS('web/viewer.css', 'chrome', defines, true)
|
2018-04-04 21:51:29 +09:00
|
|
|
.pipe(postcss([autoprefixer({ browsers: ['chrome >= 49'], })]))
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(CHROME_BUILD_CONTENT_DIR + 'web')),
|
|
|
|
|
|
|
|
gulp.src('LICENSE').pipe(gulp.dest(CHROME_BUILD_DIR)),
|
2017-02-07 23:53:33 +09:00
|
|
|
gulp.src('extensions/chromium/manifest.json')
|
|
|
|
.pipe(replace(/\bPDFJSSCRIPT_VERSION\b/g, version))
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(CHROME_BUILD_DIR)),
|
2017-02-07 23:53:33 +09:00
|
|
|
gulp.src([
|
|
|
|
'extensions/chromium/**/*.{html,js,css,png}',
|
|
|
|
'extensions/chromium/preferences_schema.json'
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
], { base: 'extensions/chromium/', })
|
2017-02-04 23:19:46 +09:00
|
|
|
.pipe(gulp.dest(CHROME_BUILD_DIR)),
|
|
|
|
]);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-04-23 07:20:47 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('chromium', gulp.series('chromium-pre'));
|
2017-02-07 23:53:33 +09:00
|
|
|
|
2016-10-16 23:06:37 +09:00
|
|
|
gulp.task('jsdoc', function (done) {
|
|
|
|
console.log();
|
|
|
|
console.log('### Generating documentation (JSDoc)');
|
|
|
|
|
|
|
|
var JSDOC_FILES = [
|
|
|
|
'src/doc_helper.js',
|
|
|
|
'src/display/api.js',
|
|
|
|
'src/shared/util.js',
|
|
|
|
'src/core/annotation.js'
|
|
|
|
];
|
|
|
|
|
2017-04-15 04:28:46 +09:00
|
|
|
rimraf(JSDOC_BUILD_DIR, function () {
|
|
|
|
mkdirp(JSDOC_BUILD_DIR, function () {
|
|
|
|
var command = '"node_modules/.bin/jsdoc" -d ' + JSDOC_BUILD_DIR + ' ' +
|
2016-10-16 23:06:37 +09:00
|
|
|
JSDOC_FILES.join(' ');
|
|
|
|
exec(command, done);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('lib', gulp.series('buildnumber', function () {
|
2017-07-09 22:19:16 +09:00
|
|
|
// When we create a bundle, webpack is run on the source and it will replace
|
|
|
|
// require with __webpack_require__. When we want to use the real require,
|
|
|
|
// __non_webpack_require__ has to be used.
|
|
|
|
// In this target, we don't create a bundle, so we have to replace the
|
|
|
|
// occurences of __non_webpack_require__ ourselves.
|
|
|
|
function babelPluginReplaceNonWebPackRequire(babel) {
|
|
|
|
return {
|
|
|
|
visitor: {
|
|
|
|
Identifier(path, state) {
|
|
|
|
if (path.node.name === '__non_webpack_require__') {
|
|
|
|
path.replaceWith(babel.types.identifier('require'));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2017-03-02 02:11:39 +09:00
|
|
|
function preprocess(content) {
|
2018-12-02 02:08:32 +09:00
|
|
|
var skipBabel = process.env['SKIP_BABEL'] === 'true' ||
|
|
|
|
/\/\*\s*no-babel-preset\s*\*\//.test(content);
|
2017-03-02 02:11:39 +09:00
|
|
|
content = preprocessor2.preprocessPDFJSCode(ctx, content);
|
2017-03-06 23:42:48 +09:00
|
|
|
content = babel.transform(content, {
|
|
|
|
sourceType: 'module',
|
2018-12-02 02:08:32 +09:00
|
|
|
presets: skipBabel ? undefined : ['@babel/preset-env'],
|
2017-07-09 22:19:16 +09:00
|
|
|
plugins: [
|
2018-11-23 20:52:29 +09:00
|
|
|
'@babel/plugin-transform-modules-commonjs',
|
|
|
|
['@babel/plugin-transform-runtime', {
|
2018-07-30 20:58:09 +09:00
|
|
|
'helpers': false,
|
|
|
|
'regenerator': true,
|
|
|
|
}],
|
2017-07-09 22:19:16 +09:00
|
|
|
babelPluginReplaceNonWebPackRequire,
|
|
|
|
],
|
2017-03-06 23:42:48 +09:00
|
|
|
}).code;
|
2018-11-23 20:52:29 +09:00
|
|
|
// eslint-disable-next-line max-len
|
|
|
|
var removeCjsSrc = /^(var\s+\w+\s*=\s*(_interopRequireDefault\()?require\(".*?)(?:\/src)(\/[^"]*"\)\)?;)$/gm;
|
|
|
|
content = content.replace(removeCjsSrc, (all, prefix, interop, suffix) => {
|
2017-03-02 02:11:39 +09:00
|
|
|
return prefix + suffix;
|
|
|
|
});
|
2017-12-16 14:31:43 +09:00
|
|
|
return licenseHeaderLibre + content;
|
2017-03-02 02:11:39 +09:00
|
|
|
}
|
2018-11-23 20:52:29 +09:00
|
|
|
var babel = require('@babel/core');
|
2017-03-02 02:11:39 +09:00
|
|
|
var versionInfo = getVersionJSON();
|
|
|
|
var ctx = {
|
|
|
|
rootPath: __dirname,
|
|
|
|
saveComments: false,
|
|
|
|
defines: builder.merge(DEFINES, {
|
|
|
|
GENERIC: true,
|
2017-04-25 05:07:00 +09:00
|
|
|
LIB: true,
|
2017-03-02 02:11:39 +09:00
|
|
|
BUNDLE_VERSION: versionInfo.version,
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
BUNDLE_BUILD: versionInfo.commit,
|
2018-06-12 00:25:50 +09:00
|
|
|
TESTING: process.env['TESTING'] === 'true',
|
2017-05-31 10:38:22 +09:00
|
|
|
}),
|
|
|
|
map: {
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
'pdfjs-lib': '../pdf',
|
|
|
|
},
|
2017-03-02 02:11:39 +09:00
|
|
|
};
|
2017-12-16 14:31:43 +09:00
|
|
|
var licenseHeaderLibre =
|
|
|
|
fs.readFileSync('./src/license_header_libre.js').toString();
|
2017-03-02 02:11:39 +09:00
|
|
|
var preprocessor2 = require('./external/builder/preprocessor2.js');
|
2017-04-14 00:16:52 +09:00
|
|
|
var buildLib = merge([
|
2017-03-02 02:11:39 +09:00
|
|
|
gulp.src([
|
2018-06-04 19:52:43 +09:00
|
|
|
'src/{core,display,shared}/*.js',
|
|
|
|
'!src/shared/{cffStandardStrings,fonts_utils}.js',
|
2017-03-02 02:11:39 +09:00
|
|
|
'src/{pdf,pdf.worker}.js',
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
], { base: 'src/', }),
|
2017-03-05 02:26:24 +09:00
|
|
|
gulp.src([
|
2017-07-06 22:08:37 +09:00
|
|
|
'examples/node/domstubs.js',
|
2017-03-05 02:26:24 +09:00
|
|
|
'web/*.js',
|
2018-06-04 19:52:43 +09:00
|
|
|
'!web/{pdfjs,viewer}.js',
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
], { base: '.', }),
|
|
|
|
gulp.src('test/unit/*.js', { base: '.', }),
|
2017-09-30 06:34:54 +09:00
|
|
|
]).pipe(transform('utf8', preprocess))
|
2017-03-02 02:11:39 +09:00
|
|
|
.pipe(gulp.dest('build/lib/'));
|
2017-04-14 00:16:52 +09:00
|
|
|
return merge([
|
|
|
|
buildLib,
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src('external/streams/streams-lib.js', { base: '.', })
|
2017-04-14 00:16:52 +09:00
|
|
|
.pipe(gulp.dest('build/')),
|
2018-07-04 01:32:39 +09:00
|
|
|
gulp.src('external/url/url-lib.js', { base: '.', })
|
|
|
|
.pipe(gulp.dest('build/')),
|
2017-04-14 00:16:52 +09:00
|
|
|
]);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2017-02-07 23:53:33 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('publish', gulp.series('generic', function (done) {
|
2016-04-27 06:28:36 +09:00
|
|
|
var version = JSON.parse(
|
|
|
|
fs.readFileSync(BUILD_DIR + 'version.json').toString()).version;
|
|
|
|
|
|
|
|
config.stableVersion = config.betaVersion;
|
|
|
|
config.betaVersion = version;
|
|
|
|
|
|
|
|
createStringSource(CONFIG_FILE, JSON.stringify(config, null, 2))
|
|
|
|
.pipe(gulp.dest('.'))
|
|
|
|
.on('end', function () {
|
|
|
|
var targetName = 'pdfjs-' + version + '-dist.zip';
|
|
|
|
gulp.src(BUILD_DIR + 'generic/**')
|
|
|
|
.pipe(zip(targetName))
|
|
|
|
.pipe(gulp.dest(BUILD_DIR))
|
|
|
|
.on('end', function () {
|
|
|
|
console.log('Built distribution file: ' + targetName);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-04-27 06:28:36 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('testing-pre', function(done) {
|
2018-06-12 00:25:50 +09:00
|
|
|
process.env['TESTING'] = 'true';
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
2018-06-12 00:25:50 +09:00
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('test', gulp.series('testing-pre', 'generic', 'components',
|
|
|
|
function() {
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
return streamqueue({ objectMode: true, },
|
2016-05-02 23:58:29 +09:00
|
|
|
createTestSource('unit'), createTestSource('browser'));
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-05-02 23:58:29 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('bottest', gulp.series('testing-pre', 'generic', 'components',
|
|
|
|
function() {
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
return streamqueue({ objectMode: true, },
|
2018-08-04 09:48:47 +09:00
|
|
|
createTestSource('unit', true), createTestSource('font', true),
|
|
|
|
createTestSource('browser (no reftest)', true));
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-05-02 23:58:29 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('browsertest', gulp.series('testing-pre', 'generic', 'components',
|
|
|
|
function() {
|
2016-05-02 23:58:29 +09:00
|
|
|
return createTestSource('browser');
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-05-02 23:58:29 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('unittest', gulp.series('testing-pre', 'generic', 'components',
|
|
|
|
function() {
|
2016-05-02 23:58:29 +09:00
|
|
|
return createTestSource('unit');
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-05-02 23:58:29 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('fonttest', gulp.series('testing-pre', function() {
|
2016-05-02 23:58:29 +09:00
|
|
|
return createTestSource('font');
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-05-02 23:58:29 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('makeref', gulp.series('testing-pre', 'generic', 'components',
|
|
|
|
function(done) {
|
2017-02-25 08:12:02 +09:00
|
|
|
makeRef(done);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-05-02 23:58:29 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('botmakeref', gulp.series('testing-pre', 'generic', 'components',
|
2018-06-12 00:25:50 +09:00
|
|
|
function(done) {
|
2017-02-25 08:12:02 +09:00
|
|
|
makeRef(done, true);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-05-02 23:58:29 +09:00
|
|
|
|
2017-02-22 07:24:07 +09:00
|
|
|
gulp.task('baseline', function (done) {
|
|
|
|
console.log();
|
|
|
|
console.log('### Creating baseline environment');
|
|
|
|
|
|
|
|
var baselineCommit = process.env['BASELINE'];
|
|
|
|
if (!baselineCommit) {
|
|
|
|
done(new Error('Missing baseline commit. Specify the BASELINE variable.'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var initializeCommand = 'git fetch origin';
|
|
|
|
if (!checkDir(BASELINE_DIR)) {
|
|
|
|
mkdirp.sync(BASELINE_DIR);
|
|
|
|
initializeCommand = 'git clone ../../ .';
|
|
|
|
}
|
|
|
|
|
|
|
|
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
exec(initializeCommand, { cwd: workingDirectory, }, function (error) {
|
2017-02-22 07:24:07 +09:00
|
|
|
if (error) {
|
|
|
|
done(new Error('Baseline clone/fetch failed.'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
exec('git checkout ' + baselineCommit, { cwd: workingDirectory, },
|
2017-02-22 07:24:07 +09:00
|
|
|
function (error) {
|
|
|
|
if (error) {
|
|
|
|
done(new Error('Baseline commit checkout failed.'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('Baseline commit "' + baselineCommit + '" checked out.');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('unittestcli', gulp.series('testing-pre', 'lib', function(done) {
|
2018-12-02 02:08:32 +09:00
|
|
|
var options = ['node_modules/jasmine/bin/jasmine',
|
|
|
|
'JASMINE_CONFIG_PATH=test/unit/clitests.json'];
|
|
|
|
var jasmineProcess = spawn('node', options, { stdio: 'inherit', });
|
|
|
|
jasmineProcess.on('close', function(code) {
|
2017-01-10 06:43:45 +09:00
|
|
|
if (code !== 0) {
|
|
|
|
done(new Error('Unit tests failed.'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
done();
|
|
|
|
});
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2017-01-10 06:43:45 +09:00
|
|
|
|
2016-05-02 23:58:29 +09:00
|
|
|
gulp.task('lint', function (done) {
|
|
|
|
console.log();
|
|
|
|
console.log('### Linting JS files');
|
|
|
|
|
Switch to using ESLint, instead of JSHint, for linting
*Please note that most of the necessary code adjustments were made in PR 7890.*
ESLint has a number of advantageous properties, compared to JSHint. Among those are:
- The ability to find subtle bugs, thanks to more rules (e.g. PR 7881).
- Much more customizable in general, and many rules allow fine-tuned behaviour rather than the just the on/off rules in JSHint.
- Many more rules that can help developers avoid bugs, and a lot of rules that can be used to enforce a consistent coding style. The latter should be particularily useful for new contributors (and reduce the amount of stylistic review comments necessary).
- The ability to easily specify exactly what rules to use/not to use, as opposed to JSHint which has a default set. *Note:* in future JSHint version some of the rules we depend on will be removed, according to warnings in http://jshint.com/docs/options/, so we wouldn't be able to update without losing lint coverage.
- More easily disable one, or more, rules temporarily. In JSHint this requires using a numeric code, which isn't very user friendly, whereas in ESLint the rule name is simply used instead.
By default there's no rules enabled in ESLint, but there are some default rule sets available. However, to prevent linting failures if we update ESLint in the future, it seemed easier to just explicitly specify what rules we want.
Obviously this makes the ESLint config file somewhat bigger than the old JSHint config file, but given how rarely that one has been updated over the years I don't think that matters too much.
I've tried, to the best of my ability, to ensure that we enable the same rules for ESLint that we had for JSHint. Furthermore, I've also enabled a number of rules that seemed to make sense, both to catch possible errors *and* various style guide violations.
Despite the ESLint README claiming that it's slower that JSHint, https://github.com/eslint/eslint#how-does-eslint-performance-compare-to-jshint, locally this patch actually reduces the runtime for `gulp` lint (by approximately 20-25%).
A couple of stylistic rules that would have been nice to enable, but where our code currently differs to much to make it feasible:
- `comma-dangle`, controls trailing commas in Objects and Arrays (among others).
- `object-curly-spacing`, controls spacing inside of Objects.
- `spaced-comment`, used to enforce spaces after `//` and `/*. (This is made difficult by the fact that there's still some usage of the old preprocessor left.)
Rules that I indend to look into possibly enabling in follow-ups, if it seems to make sense: `no-else-return`, `no-lonely-if`, `brace-style` with the `allowSingleLine` parameter removed.
Useful links:
- http://eslint.org/docs/user-guide/configuring
- http://eslint.org/docs/rules/
2016-12-15 23:52:29 +09:00
|
|
|
// Ensure that we lint the Firefox specific *.jsm files too.
|
2017-10-15 20:38:53 +09:00
|
|
|
var options = ['node_modules/eslint/bin/eslint', '--ext', '.js,.jsm', '.',
|
|
|
|
'--report-unused-disable-directives'];
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
var esLintProcess = spawn('node', options, { stdio: 'inherit', });
|
Switch to using ESLint, instead of JSHint, for linting
*Please note that most of the necessary code adjustments were made in PR 7890.*
ESLint has a number of advantageous properties, compared to JSHint. Among those are:
- The ability to find subtle bugs, thanks to more rules (e.g. PR 7881).
- Much more customizable in general, and many rules allow fine-tuned behaviour rather than the just the on/off rules in JSHint.
- Many more rules that can help developers avoid bugs, and a lot of rules that can be used to enforce a consistent coding style. The latter should be particularily useful for new contributors (and reduce the amount of stylistic review comments necessary).
- The ability to easily specify exactly what rules to use/not to use, as opposed to JSHint which has a default set. *Note:* in future JSHint version some of the rules we depend on will be removed, according to warnings in http://jshint.com/docs/options/, so we wouldn't be able to update without losing lint coverage.
- More easily disable one, or more, rules temporarily. In JSHint this requires using a numeric code, which isn't very user friendly, whereas in ESLint the rule name is simply used instead.
By default there's no rules enabled in ESLint, but there are some default rule sets available. However, to prevent linting failures if we update ESLint in the future, it seemed easier to just explicitly specify what rules we want.
Obviously this makes the ESLint config file somewhat bigger than the old JSHint config file, but given how rarely that one has been updated over the years I don't think that matters too much.
I've tried, to the best of my ability, to ensure that we enable the same rules for ESLint that we had for JSHint. Furthermore, I've also enabled a number of rules that seemed to make sense, both to catch possible errors *and* various style guide violations.
Despite the ESLint README claiming that it's slower that JSHint, https://github.com/eslint/eslint#how-does-eslint-performance-compare-to-jshint, locally this patch actually reduces the runtime for `gulp` lint (by approximately 20-25%).
A couple of stylistic rules that would have been nice to enable, but where our code currently differs to much to make it feasible:
- `comma-dangle`, controls trailing commas in Objects and Arrays (among others).
- `object-curly-spacing`, controls spacing inside of Objects.
- `spaced-comment`, used to enforce spaces after `//` and `/*. (This is made difficult by the fact that there's still some usage of the old preprocessor left.)
Rules that I indend to look into possibly enabling in follow-ups, if it seems to make sense: `no-else-return`, `no-lonely-if`, `brace-style` with the `allowSingleLine` parameter removed.
Useful links:
- http://eslint.org/docs/user-guide/configuring
- http://eslint.org/docs/rules/
2016-12-15 23:52:29 +09:00
|
|
|
esLintProcess.on('close', function (code) {
|
2016-05-02 23:58:29 +09:00
|
|
|
if (code !== 0) {
|
Switch to using ESLint, instead of JSHint, for linting
*Please note that most of the necessary code adjustments were made in PR 7890.*
ESLint has a number of advantageous properties, compared to JSHint. Among those are:
- The ability to find subtle bugs, thanks to more rules (e.g. PR 7881).
- Much more customizable in general, and many rules allow fine-tuned behaviour rather than the just the on/off rules in JSHint.
- Many more rules that can help developers avoid bugs, and a lot of rules that can be used to enforce a consistent coding style. The latter should be particularily useful for new contributors (and reduce the amount of stylistic review comments necessary).
- The ability to easily specify exactly what rules to use/not to use, as opposed to JSHint which has a default set. *Note:* in future JSHint version some of the rules we depend on will be removed, according to warnings in http://jshint.com/docs/options/, so we wouldn't be able to update without losing lint coverage.
- More easily disable one, or more, rules temporarily. In JSHint this requires using a numeric code, which isn't very user friendly, whereas in ESLint the rule name is simply used instead.
By default there's no rules enabled in ESLint, but there are some default rule sets available. However, to prevent linting failures if we update ESLint in the future, it seemed easier to just explicitly specify what rules we want.
Obviously this makes the ESLint config file somewhat bigger than the old JSHint config file, but given how rarely that one has been updated over the years I don't think that matters too much.
I've tried, to the best of my ability, to ensure that we enable the same rules for ESLint that we had for JSHint. Furthermore, I've also enabled a number of rules that seemed to make sense, both to catch possible errors *and* various style guide violations.
Despite the ESLint README claiming that it's slower that JSHint, https://github.com/eslint/eslint#how-does-eslint-performance-compare-to-jshint, locally this patch actually reduces the runtime for `gulp` lint (by approximately 20-25%).
A couple of stylistic rules that would have been nice to enable, but where our code currently differs to much to make it feasible:
- `comma-dangle`, controls trailing commas in Objects and Arrays (among others).
- `object-curly-spacing`, controls spacing inside of Objects.
- `spaced-comment`, used to enforce spaces after `//` and `/*. (This is made difficult by the fact that there's still some usage of the old preprocessor left.)
Rules that I indend to look into possibly enabling in follow-ups, if it seems to make sense: `no-else-return`, `no-lonely-if`, `brace-style` with the `allowSingleLine` parameter removed.
Useful links:
- http://eslint.org/docs/user-guide/configuring
- http://eslint.org/docs/rules/
2016-12-15 23:52:29 +09:00
|
|
|
done(new Error('ESLint failed.'));
|
2016-05-02 23:58:29 +09:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-12 07:58:17 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Checking supplemental files');
|
|
|
|
|
|
|
|
if (!checkChromePreferencesFile(
|
|
|
|
'extensions/chromium/preferences_schema.json',
|
|
|
|
'web/default_preferences.json')) {
|
|
|
|
done(new Error('chromium/preferences_schema is not in sync.'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-02 23:58:29 +09:00
|
|
|
console.log('files checked, no errors found');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('server', function () {
|
2016-03-05 00:36:46 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Starting local server');
|
|
|
|
|
|
|
|
var WebServer = require('./test/webserver.js').WebServer;
|
|
|
|
var server = new WebServer();
|
|
|
|
server.port = 8888;
|
|
|
|
server.start();
|
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('clean', function(done) {
|
2016-03-05 05:14:56 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Cleaning up project builds');
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
rimraf(BUILD_DIR, done);
|
2016-03-05 05:14:56 +09:00
|
|
|
});
|
|
|
|
|
2016-03-05 00:36:46 +09:00
|
|
|
gulp.task('makefile', function () {
|
|
|
|
var makefileContent = 'help:\n\tgulp\n\n';
|
|
|
|
var targetsNames = [];
|
|
|
|
for (var i in target) {
|
|
|
|
makefileContent += i + ':\n\tgulp ' + i + '\n\n';
|
|
|
|
targetsNames.push(i);
|
|
|
|
}
|
|
|
|
makefileContent += '.PHONY: ' + targetsNames.join(' ') + '\n';
|
|
|
|
return createStringSource('Makefile', makefileContent)
|
|
|
|
.pipe(gulp.dest('.'));
|
|
|
|
});
|
|
|
|
|
2016-04-23 07:23:25 +09:00
|
|
|
gulp.task('importl10n', function(done) {
|
2016-03-05 05:14:56 +09:00
|
|
|
var locales = require('./external/importL10n/locales.js');
|
|
|
|
|
|
|
|
console.log();
|
2017-05-20 06:39:22 +09:00
|
|
|
console.log('### Importing translations from mozilla-central');
|
2016-03-05 05:14:56 +09:00
|
|
|
|
|
|
|
if (!fs.existsSync(L10N_DIR)) {
|
|
|
|
fs.mkdirSync(L10N_DIR);
|
|
|
|
}
|
2016-04-23 07:23:25 +09:00
|
|
|
locales.downloadL10n(L10N_DIR, done);
|
2016-03-05 05:14:56 +09:00
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('gh-pages-prepare', function () {
|
2017-04-15 04:28:46 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Creating web site');
|
|
|
|
|
|
|
|
rimraf.sync(GH_PAGES_DIR);
|
|
|
|
|
2017-12-31 03:47:08 +09:00
|
|
|
// 'vfs' because web/viewer.html needs its BOM.
|
2017-04-15 04:28:46 +09:00
|
|
|
return merge([
|
2017-12-31 03:47:08 +09:00
|
|
|
vfs.src(GENERIC_DIR + '**/*', { base: GENERIC_DIR, stripBOM: false, })
|
|
|
|
.pipe(gulp.dest(GH_PAGES_DIR)),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src('test/features/**/*', { base: 'test/', })
|
2017-04-15 04:28:46 +09:00
|
|
|
.pipe(gulp.dest(GH_PAGES_DIR)),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src(JSDOC_BUILD_DIR + '**/*', { base: JSDOC_BUILD_DIR, })
|
2017-04-15 04:28:46 +09:00
|
|
|
.pipe(gulp.dest(GH_PAGES_DIR + 'api/draft/')),
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('wintersmith', function (done) {
|
2017-04-15 04:28:46 +09:00
|
|
|
var wintersmith = require('wintersmith');
|
|
|
|
var env = wintersmith('docs/config.json');
|
|
|
|
env.build(GH_PAGES_DIR, function (error) {
|
|
|
|
if (error) {
|
|
|
|
return done(error);
|
|
|
|
}
|
|
|
|
replaceInFile(GH_PAGES_DIR + '/getting_started/index.html',
|
|
|
|
/STABLE_VERSION/g, config.stableVersion);
|
|
|
|
replaceInFile(GH_PAGES_DIR + '/getting_started/index.html',
|
|
|
|
/BETA_VERSION/g, config.betaVersion);
|
2018-10-28 03:57:01 +09:00
|
|
|
|
|
|
|
// Hide the beta version button if there is only a stable version.
|
|
|
|
const groupClass = config.betaVersion ? 'btn-group-vertical centered' : '';
|
|
|
|
const hiddenClass = config.betaVersion ? '' : 'hidden';
|
|
|
|
replaceInFile(GH_PAGES_DIR + '/getting_started/index.html',
|
|
|
|
/GROUP_CLASS/g, groupClass);
|
|
|
|
replaceInFile(GH_PAGES_DIR + '/getting_started/index.html',
|
|
|
|
/HIDDEN_CLASS/g, hiddenClass);
|
|
|
|
|
2017-04-15 04:28:46 +09:00
|
|
|
console.log('Done building with wintersmith.');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('gh-pages-git', function (done) {
|
2017-04-15 04:28:46 +09:00
|
|
|
var VERSION = getVersionJSON().version;
|
|
|
|
var reason = process.env['PDFJS_UPDATE_REASON'];
|
|
|
|
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
safeSpawnSync('git', ['init'], { cwd: GH_PAGES_DIR, });
|
|
|
|
safeSpawnSync('git', ['remote', 'add', 'origin', REPO],
|
|
|
|
{ cwd: GH_PAGES_DIR, });
|
|
|
|
safeSpawnSync('git', ['add', '-A'], { cwd: GH_PAGES_DIR, });
|
2017-04-28 06:21:26 +09:00
|
|
|
safeSpawnSync('git', [
|
2017-04-15 04:28:46 +09:00
|
|
|
'commit', '-am', 'gh-pages site created via gulpfile.js script',
|
|
|
|
'-m', 'PDF.js version ' + VERSION + (reason ? ' - ' + reason : '')
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
], { cwd: GH_PAGES_DIR, });
|
|
|
|
safeSpawnSync('git', ['branch', '-m', 'gh-pages'], { cwd: GH_PAGES_DIR, });
|
2017-04-15 04:28:46 +09:00
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('Website built in ' + GH_PAGES_DIR);
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
2017-04-15 04:28:46 +09:00
|
|
|
});
|
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('web', gulp.series('generic', 'jsdoc', 'gh-pages-prepare',
|
|
|
|
'wintersmith', 'gh-pages-git'));
|
2017-04-15 04:28:46 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('dist-pre', gulp.series('generic', 'components', 'image_decoders',
|
|
|
|
'lib', 'minified', function() {
|
2017-04-19 04:00:53 +09:00
|
|
|
var VERSION = getVersionJSON().version;
|
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('### Cloning baseline distribution');
|
|
|
|
|
|
|
|
rimraf.sync(DIST_DIR);
|
|
|
|
mkdirp.sync(DIST_DIR);
|
2017-04-28 06:21:26 +09:00
|
|
|
safeSpawnSync('git', ['clone', '--depth', '1', DIST_REPO_URL, DIST_DIR]);
|
2017-04-19 04:00:53 +09:00
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('### Overwriting all files');
|
|
|
|
rimraf.sync(path.join(DIST_DIR, '*'));
|
|
|
|
|
|
|
|
// Rebuilding manifests
|
|
|
|
var DIST_NAME = 'pdfjs-dist';
|
|
|
|
var DIST_DESCRIPTION = 'Generic build of Mozilla\'s PDF.js library.';
|
|
|
|
var DIST_KEYWORDS = ['Mozilla', 'pdf', 'pdf.js'];
|
|
|
|
var DIST_HOMEPAGE = 'http://mozilla.github.io/pdf.js/';
|
|
|
|
var DIST_BUGS_URL = 'https://github.com/mozilla/pdf.js/issues';
|
|
|
|
var DIST_LICENSE = 'Apache-2.0';
|
|
|
|
var npmManifest = {
|
|
|
|
name: DIST_NAME,
|
|
|
|
version: VERSION,
|
|
|
|
main: 'build/pdf.js',
|
|
|
|
description: DIST_DESCRIPTION,
|
|
|
|
keywords: DIST_KEYWORDS,
|
|
|
|
homepage: DIST_HOMEPAGE,
|
|
|
|
bugs: DIST_BUGS_URL,
|
|
|
|
license: DIST_LICENSE,
|
|
|
|
dependencies: {
|
|
|
|
'node-ensure': '^0.0.0', // shim for node for require.ensure
|
2018-05-20 22:18:43 +09:00
|
|
|
'worker-loader': '^2.0.0', // used in external/dist/webpack.json
|
2017-12-08 07:10:12 +09:00
|
|
|
},
|
|
|
|
peerDependencies: {
|
2018-05-20 22:18:43 +09:00
|
|
|
'webpack': '^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0', // from 'worker-loader'
|
2017-04-19 04:00:53 +09:00
|
|
|
},
|
|
|
|
browser: {
|
2017-08-25 00:57:18 +09:00
|
|
|
'fs': false,
|
|
|
|
'http': false,
|
|
|
|
'https': false,
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
'node-ensure': false,
|
2018-07-26 19:01:10 +09:00
|
|
|
'zlib': false,
|
2017-04-19 04:00:53 +09:00
|
|
|
},
|
|
|
|
format: 'amd', // to not allow system.js to choose 'cjs'
|
|
|
|
repository: {
|
|
|
|
type: 'git',
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
url: DIST_REPO_URL,
|
2017-04-19 04:00:53 +09:00
|
|
|
},
|
|
|
|
};
|
|
|
|
var packageJsonSrc =
|
|
|
|
createStringSource('package.json', JSON.stringify(npmManifest, null, 2));
|
|
|
|
var bowerManifest = {
|
|
|
|
name: DIST_NAME,
|
|
|
|
version: VERSION,
|
|
|
|
main: [
|
|
|
|
'build/pdf.js',
|
|
|
|
'build/pdf.worker.js',
|
|
|
|
],
|
|
|
|
ignore: [],
|
|
|
|
keywords: DIST_KEYWORDS,
|
|
|
|
};
|
|
|
|
var bowerJsonSrc =
|
|
|
|
createStringSource('bower.json', JSON.stringify(bowerManifest, null, 2));
|
|
|
|
|
|
|
|
return merge([
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src('external/streams/streams-lib.js', { base: '.', })
|
2018-07-04 01:32:39 +09:00
|
|
|
.pipe(gulp.dest('build/dist/')),
|
|
|
|
gulp.src('external/url/url-lib.js', { base: '.', })
|
2017-04-14 00:16:52 +09:00
|
|
|
.pipe(gulp.dest('build/dist/')),
|
2017-04-19 04:00:53 +09:00
|
|
|
packageJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
|
|
|
bowerJsonSrc.pipe(gulp.dest(DIST_DIR)),
|
2017-12-31 03:47:08 +09:00
|
|
|
vfs.src('external/dist/**/*',
|
|
|
|
{ base: 'external/dist', stripBOM: false, })
|
|
|
|
.pipe(gulp.dest(DIST_DIR)),
|
2017-04-19 04:00:53 +09:00
|
|
|
gulp.src(GENERIC_DIR + 'LICENSE')
|
|
|
|
.pipe(gulp.dest(DIST_DIR)),
|
|
|
|
gulp.src(GENERIC_DIR + 'web/cmaps/**/*',
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ base: GENERIC_DIR + 'web', })
|
2017-04-19 04:00:53 +09:00
|
|
|
.pipe(gulp.dest(DIST_DIR)),
|
|
|
|
gulp.src([
|
|
|
|
GENERIC_DIR + 'build/pdf.js',
|
2017-05-04 02:17:18 +09:00
|
|
|
GENERIC_DIR + 'build/pdf.js.map',
|
2017-04-19 04:00:53 +09:00
|
|
|
GENERIC_DIR + 'build/pdf.worker.js',
|
2017-05-04 02:17:18 +09:00
|
|
|
GENERIC_DIR + 'build/pdf.worker.js.map',
|
2017-04-19 04:00:53 +09:00
|
|
|
SRC_DIR + 'pdf.worker.entry.js',
|
|
|
|
]).pipe(gulp.dest(DIST_DIR + 'build/')),
|
|
|
|
gulp.src(MINIFIED_DIR + 'build/pdf.js')
|
|
|
|
.pipe(rename('pdf.min.js'))
|
|
|
|
.pipe(gulp.dest(DIST_DIR + 'build/')),
|
|
|
|
gulp.src(MINIFIED_DIR + 'build/pdf.worker.js')
|
|
|
|
.pipe(rename('pdf.worker.min.js'))
|
|
|
|
.pipe(gulp.dest(DIST_DIR + 'build/')),
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
gulp.src(MINIFIED_DIR + 'image_decoders/pdf.image_decoders.js')
|
|
|
|
.pipe(rename('pdf.image_decoders.min.js'))
|
|
|
|
.pipe(gulp.dest(DIST_DIR + 'image_decoders/')),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src(COMPONENTS_DIR + '**/*', { base: COMPONENTS_DIR, })
|
2017-04-19 04:00:53 +09:00
|
|
|
.pipe(gulp.dest(DIST_DIR + 'web/')),
|
Add a `gulp image_decoders` command to allow packaging/distributing the image decoders (i.e. jpg.js, jpx.js, jbig2.js) separately from the main PDF.js library
Please note that the standalone `pdf.image_decoders.js` file will be including the complete `src/shared/util.js` file, despite only using parts of it.[1] This was done *purposely*, to not negatively impact the readability/maintainability of the core PDF.js code.
Furthermore, to ensure that the compatibility is the same in the regular PDF.js library *and* in the the standalone image decoders, `src/shared/compatibility.js` was included as well.
To (hopefully) prevent future complaints about the size of the built `pdf.image_decoders.js` file, a few existing async-related polyfills are being skipped (since all of the image decoders are completely synchronous).
Obviously this required adding a couple of pre-processor statements, but given that these are all limited to "compatibility" code, I think this might be OK!?
---
[1] However, please note that previous commits moved `PageViewport` and `MessageHandler` out of `src/shared/util.js` which reduced its size.
2018-05-16 20:49:26 +09:00
|
|
|
gulp.src(IMAGE_DECODERS_DIR + '**/*', { base: IMAGE_DECODERS_DIR, })
|
|
|
|
.pipe(gulp.dest(DIST_DIR + 'image_decoders')),
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
gulp.src(LIB_DIR + '**/*', { base: LIB_DIR, })
|
2017-04-19 04:00:53 +09:00
|
|
|
.pipe(gulp.dest(DIST_DIR + 'lib/')),
|
|
|
|
]);
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2017-04-19 04:00:53 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('dist-install', gulp.series('dist-pre', function (done) {
|
2017-05-11 08:28:18 +09:00
|
|
|
var distPath = DIST_DIR;
|
|
|
|
var opts = {};
|
|
|
|
var installPath = process.env['PDFJS_INSTALL_PATH'];
|
|
|
|
if (installPath) {
|
|
|
|
opts.cwd = installPath;
|
|
|
|
distPath = path.relative(installPath, distPath);
|
|
|
|
}
|
|
|
|
safeSpawnSync('npm', ['install', distPath], opts);
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
|
|
|
}));
|
2017-05-11 08:28:18 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('dist-repo-git', gulp.series('dist-pre', function (done) {
|
2017-04-19 04:00:53 +09:00
|
|
|
var VERSION = getVersionJSON().version;
|
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('### Committing changes');
|
|
|
|
|
|
|
|
var reason = process.env['PDFJS_UPDATE_REASON'];
|
|
|
|
var message = 'PDF.js version ' + VERSION + (reason ? ' - ' + reason : '');
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
safeSpawnSync('git', ['add', '*'], { cwd: DIST_DIR, });
|
|
|
|
safeSpawnSync('git', ['commit', '-am', message], { cwd: DIST_DIR, });
|
2017-04-28 06:21:26 +09:00
|
|
|
safeSpawnSync('git', ['tag', '-a', 'v' + VERSION, '-m', message],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ cwd: DIST_DIR, });
|
2017-04-19 04:00:53 +09:00
|
|
|
|
|
|
|
console.log();
|
|
|
|
console.log('Done. Push with');
|
|
|
|
console.log(' cd ' + DIST_DIR + '; ' +
|
|
|
|
'git push --tags ' + DIST_REPO_URL + ' master');
|
|
|
|
console.log();
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
|
|
|
}));
|
2017-04-19 04:00:53 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('dist', gulp.series('dist-repo-git'));
|
2017-04-19 04:00:53 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('mozcentralbaseline', gulp.series('baseline', function (done) {
|
2017-04-28 04:42:07 +09:00
|
|
|
console.log();
|
|
|
|
console.log('### Creating mozcentral baseline environment');
|
2017-02-04 23:19:46 +09:00
|
|
|
|
2017-04-28 04:42:07 +09:00
|
|
|
// Create a mozcentral build.
|
|
|
|
rimraf.sync(BASELINE_DIR + BUILD_DIR);
|
2016-03-05 00:36:46 +09:00
|
|
|
|
2017-04-28 06:21:26 +09:00
|
|
|
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
|
|
|
|
safeSpawnSync('gulp', ['mozcentral'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ env: process.env, cwd: workingDirectory, stdio: 'inherit', });
|
2017-04-28 04:42:07 +09:00
|
|
|
|
|
|
|
// Copy the mozcentral build to the mozcentral baseline directory.
|
|
|
|
rimraf.sync(MOZCENTRAL_BASELINE_DIR);
|
|
|
|
mkdirp.sync(MOZCENTRAL_BASELINE_DIR);
|
|
|
|
|
|
|
|
gulp.src([BASELINE_DIR + BUILD_DIR + 'mozcentral/**/*'])
|
|
|
|
.pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR))
|
|
|
|
.on('end', function () {
|
|
|
|
// Commit the mozcentral baseline.
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
safeSpawnSync('git', ['init'], { cwd: MOZCENTRAL_BASELINE_DIR, });
|
|
|
|
safeSpawnSync('git', ['add', '.'], { cwd: MOZCENTRAL_BASELINE_DIR, });
|
2017-04-28 06:21:26 +09:00
|
|
|
safeSpawnSync('git', ['commit', '-m', '"mozcentral baseline"'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ cwd: MOZCENTRAL_BASELINE_DIR, });
|
2017-04-28 04:42:07 +09:00
|
|
|
done();
|
|
|
|
});
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2016-03-05 00:36:46 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('mozcentraldiff', gulp.series('mozcentral', 'mozcentralbaseline',
|
2017-04-28 05:59:45 +09:00
|
|
|
function (done) {
|
|
|
|
console.log();
|
|
|
|
console.log('### Creating mozcentral diff');
|
|
|
|
|
|
|
|
// Create the diff between the current mozcentral build and the
|
|
|
|
// baseline mozcentral build, which both exist at this point.
|
|
|
|
// The mozcentral baseline directory is a Git repository, so we
|
|
|
|
// remove all files and copy the current mozcentral build files
|
|
|
|
// into it to create the diff.
|
|
|
|
rimraf.sync(MOZCENTRAL_BASELINE_DIR + '*');
|
|
|
|
|
|
|
|
gulp.src([BUILD_DIR + 'mozcentral/**/*'])
|
|
|
|
.pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR))
|
|
|
|
.on('end', function () {
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
safeSpawnSync('git', ['add', '-A'], { cwd: MOZCENTRAL_BASELINE_DIR, });
|
2017-04-28 06:21:26 +09:00
|
|
|
var diff = safeSpawnSync('git',
|
2017-04-28 05:59:45 +09:00
|
|
|
['diff', '--binary', '--cached', '--unified=8'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ cwd: MOZCENTRAL_BASELINE_DIR, }).stdout;
|
2017-04-28 05:59:45 +09:00
|
|
|
|
|
|
|
createStringSource(MOZCENTRAL_DIFF_FILE, diff)
|
|
|
|
.pipe(gulp.dest(BUILD_DIR))
|
|
|
|
.on('end', function () {
|
|
|
|
console.log('Result diff can be found at ' + BUILD_DIR +
|
|
|
|
MOZCENTRAL_DIFF_FILE);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2018-11-19 02:33:23 +09:00
|
|
|
}));
|
2017-05-04 02:16:37 +09:00
|
|
|
|
2018-11-19 02:33:23 +09:00
|
|
|
gulp.task('externaltest', function (done) {
|
2017-12-31 03:47:08 +09:00
|
|
|
fancylog('Running test-fixtures.js');
|
2017-05-04 02:16:37 +09:00
|
|
|
safeSpawnSync('node', ['external/builder/test-fixtures.js'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ stdio: 'inherit', });
|
2017-12-31 03:47:08 +09:00
|
|
|
fancylog('Running test-fixtures_esprima.js');
|
2017-05-04 02:16:37 +09:00
|
|
|
safeSpawnSync('node', ['external/builder/test-fixtures_esprima.js'],
|
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',
```
2017-06-03 00:13:35 +09:00
|
|
|
{ stdio: 'inherit', });
|
2018-11-19 02:33:23 +09:00
|
|
|
done();
|
2017-05-04 02:16:37 +09:00
|
|
|
});
|