From a4598f3bd4a7725c645841c736ee17e6d04073e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Obernd=C3=B6rfer?= Date: Mon, 31 Mar 2014 16:09:23 +0200 Subject: [PATCH] Generate openpgp.js without source map. New source map target is openpgp_debug.js. Change dependency of workers: openpgp.worker.js -> openpgp.js, openpgp.worker.min.js -> openpgp.min.js. Remove openpgp.js with maps from unittests-bundle.js --- Gruntfile.js | 36 ++++++++++++++++++++++------------ src/worker/worker.js | 2 +- test/crypto/cipher/aes.js | 2 +- test/crypto/cipher/blowfish.js | 2 +- test/crypto/cipher/cast5.js | 2 +- test/crypto/cipher/des.js | 2 +- test/crypto/cipher/twofish.js | 2 +- test/crypto/crypto.js | 2 +- test/crypto/hash/md5.js | 2 +- test/crypto/hash/ripemd.js | 2 +- test/crypto/hash/sha.js | 2 +- test/general/armor.js | 2 +- test/general/basic.js | 2 +- test/general/key.js | 2 +- test/general/keyring.js | 2 +- test/general/packet.js | 2 +- test/general/signature.js | 2 +- test/unittests.html | 1 - test/worker/api.js | 2 +- 19 files changed, 41 insertions(+), 30 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 497917b9..b76f4d8b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,18 +4,18 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), browserify: { - openpgp_nodebug: { + openpgp: { files: { - 'dist/openpgp_nodebug.js': [ './src/index.js' ] + 'dist/openpgp.js': [ './src/index.js' ] }, options: { standalone: 'openpgp', external: [ 'crypto', 'node-localstorage' ] } }, - openpgp: { + openpgp_debug: { files: { - 'dist/openpgp.js': [ './src/index.js' ] + 'dist/openpgp_debug.js': [ './src/index.js' ] }, options: { debug: true, @@ -28,14 +28,17 @@ module.exports = function(grunt) { 'dist/openpgp.worker.js': [ './src/worker/worker.js' ] } }, + worker_min: { + files: { + 'dist/openpgp.worker.min.js': [ './src/worker/worker.js' ] + } + }, unittests: { files: { - 'test/lib/unittests-bundle.js': [] + 'test/lib/unittests-bundle.js': [ './test/unittests.js' ] }, options: { - debug: true, - alias: './test/unittests.js:unittests', - external: [ 'openpgp' ] + external: [ 'openpgp', 'crypto', 'node-localstorage' ] } } }, @@ -48,19 +51,28 @@ module.exports = function(grunt) { to: 'OpenPGP.js v<%= pkg.version %>' }] }, - openpgp_nodebug: { - src: ['dist/openpgp_nodebug.js'], - dest: ['dist/openpgp_nodebug.js'], + openpgp_debug: { + src: ['dist/openpgp_debug.js'], + dest: ['dist/openpgp_debug.js'], replacements: [{ from: /OpenPGP.js VERSION/g, to: 'OpenPGP.js v<%= pkg.version %>' }] + }, + worker_min: { + src: ['dist/openpgp.worker.min.js'], + dest: ['dist/openpgp.worker.min.js'], + replacements: [{ + from: "importScripts('openpgp.js')", + to: "importScripts('openpgp.min.js')" + }] } }, uglify: { openpgp: { files: { - 'dist/openpgp.min.js' : [ 'dist/openpgp_nodebug.js' ] + 'dist/openpgp.min.js' : [ 'dist/openpgp.js' ], + 'dist/openpgp.worker.min.js' : [ 'dist/openpgp.worker.min.js' ] } }, options: { diff --git a/src/worker/worker.js b/src/worker/worker.js index 68e7d628..3ab531ad 100644 --- a/src/worker/worker.js +++ b/src/worker/worker.js @@ -17,7 +17,7 @@ window = {}; // to make UMD bundles work -importScripts('openpgp.min.js'); +importScripts('openpgp.js'); var MIN_SIZE_RANDOM_BUFFER = 40000; var MAX_SIZE_RANDOM_BUFFER = 60000; diff --git a/test/crypto/cipher/aes.js b/test/crypto/cipher/aes.js index 833e3f90..6cc1f3ca 100644 --- a/test/crypto/cipher/aes.js +++ b/test/crypto/cipher/aes.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, chai = require('chai'), diff --git a/test/crypto/cipher/blowfish.js b/test/crypto/cipher/blowfish.js index 2600a06b..81100dd7 100644 --- a/test/crypto/cipher/blowfish.js +++ b/test/crypto/cipher/blowfish.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, BFencrypt = openpgp.crypto.cipher.blowfish, diff --git a/test/crypto/cipher/cast5.js b/test/crypto/cipher/cast5.js index 6a222fde..40ab972e 100644 --- a/test/crypto/cipher/cast5.js +++ b/test/crypto/cipher/cast5.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, chai = require('chai'), diff --git a/test/crypto/cipher/des.js b/test/crypto/cipher/des.js index 64149e23..1be7e80f 100644 --- a/test/crypto/cipher/des.js +++ b/test/crypto/cipher/des.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, chai = require('chai'), diff --git a/test/crypto/cipher/twofish.js b/test/crypto/cipher/twofish.js index 0ad46dde..e2ee828c 100644 --- a/test/crypto/cipher/twofish.js +++ b/test/crypto/cipher/twofish.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, chai = require('chai'), diff --git a/test/crypto/crypto.js b/test/crypto/crypto.js index bda39828..acd43981 100644 --- a/test/crypto/crypto.js +++ b/test/crypto/crypto.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var chai = require('chai'), expect = chai.expect; diff --git a/test/crypto/hash/md5.js b/test/crypto/hash/md5.js index fb431b0a..b3d0a777 100644 --- a/test/crypto/hash/md5.js +++ b/test/crypto/hash/md5.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, MD5 = openpgp.crypto.hash.md5, diff --git a/test/crypto/hash/ripemd.js b/test/crypto/hash/ripemd.js index df153e04..75c353c9 100644 --- a/test/crypto/hash/ripemd.js +++ b/test/crypto/hash/ripemd.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, RMDstring = openpgp.crypto.hash.ripemd, diff --git a/test/crypto/hash/sha.js b/test/crypto/hash/sha.js index cd4166d0..ce8da58a 100644 --- a/test/crypto/hash/sha.js +++ b/test/crypto/hash/sha.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var util = openpgp.util, hash = openpgp.crypto.hash, diff --git a/test/general/armor.js b/test/general/armor.js index 76cfdc98..3e3f0a77 100644 --- a/test/general/armor.js +++ b/test/general/armor.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var chai = require('chai'), expect = chai.expect; diff --git a/test/general/basic.js b/test/general/basic.js index 7c090dea..a9f1e621 100644 --- a/test/general/basic.js +++ b/test/general/basic.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var chai = require('chai'), expect = chai.expect; diff --git a/test/general/key.js b/test/general/key.js index 42da9d2f..cebf55fa 100644 --- a/test/general/key.js +++ b/test/general/key.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var chai = require('chai'), expect = chai.expect; diff --git a/test/general/keyring.js b/test/general/keyring.js index 4e77dcaf..7fe8c06e 100644 --- a/test/general/keyring.js +++ b/test/general/keyring.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var keyring = new openpgp.Keyring(), chai = require('chai'), diff --git a/test/general/packet.js b/test/general/packet.js index a2f4d74e..ecac10ff 100644 --- a/test/general/packet.js +++ b/test/general/packet.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var chai = require('chai'), expect = chai.expect; diff --git a/test/general/signature.js b/test/general/signature.js index 0bcc2e21..85a9809a 100644 --- a/test/general/signature.js +++ b/test/general/signature.js @@ -1,6 +1,6 @@ 'use strict'; -var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('../../src/index'); +var openpgp = typeof window != 'undefined' && window.openpgp ? window.openpgp : require('openpgp'); var chai = require('chai'), expect = chai.expect; diff --git a/test/unittests.html b/test/unittests.html index 5c1093c8..7a79064c 100644 --- a/test/unittests.html +++ b/test/unittests.html @@ -18,7 +18,6 @@