chore(project): shrink bundle sizes

Reduces the size of bpmn-js {Viewer, NavigatedViewer, Modeler}
bundles by roughly eight percent:

* module concat / tree-shake produced production bundle
* bump diagram-js version to fix <this> used in ManhattanLayout
  utility
This commit is contained in:
Nico Rehwaldt 2017-11-19 13:31:06 +01:00 committed by Philipp Fromme
parent 2441b153f6
commit cfcf5ddd41
3 changed files with 466 additions and 140 deletions

436
package-lock.json generated
View File

@ -95,17 +95,6 @@
"integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=",
"dev": true
},
"align-text": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
"integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
"dev": true,
"requires": {
"kind-of": "3.2.2",
"longest": "1.0.1",
"repeat-string": "1.6.1"
}
},
"amdefine": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
@ -315,6 +304,16 @@
"js-tokens": "3.0.2"
}
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "2.5.1",
"regenerator-runtime": "0.11.0"
}
},
"backo2": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
@ -479,6 +478,57 @@
"umd": "3.0.1"
}
},
"browser-pack-flat": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/browser-pack-flat/-/browser-pack-flat-3.0.5.tgz",
"integrity": "sha512-cn6WERUiZuIgv2LWiwKB8/5wwI2SrjkW3nZmL1oEp2nvMNqZWXuxOgvjrOM6+fnhthLOBko+RB0aYSerLb5GNA==",
"dev": true,
"requires": {
"JSONStream": "1.3.1",
"combine-source-map": "0.8.0",
"convert-source-map": "1.5.0",
"count-lines": "0.1.2",
"dedent": "0.7.0",
"identifierfy": "1.1.1",
"is-require": "0.0.1",
"magic-string": "0.22.4",
"path-parse": "1.0.5",
"scope-analyzer": "1.0.0",
"stream-combiner": "0.2.2",
"through2": "2.0.3",
"transform-ast": "2.2.1",
"umd": "3.0.1",
"wrap-comment": "1.0.1"
},
"dependencies": {
"combine-source-map": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz",
"integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=",
"dev": true,
"requires": {
"convert-source-map": "1.1.3",
"inline-source-map": "0.6.2",
"lodash.memoize": "3.0.4",
"source-map": "0.5.7"
},
"dependencies": {
"convert-source-map": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz",
"integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=",
"dev": true
}
}
},
"convert-source-map": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz",
"integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=",
"dev": true
}
}
},
"browser-resolve": {
"version": "1.11.2",
"resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz",
@ -882,6 +932,18 @@
"integrity": "sha1-0JxLUoAKpMB44t2BqGmqyQ0uVOc=",
"dev": true
},
"call-matcher": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/call-matcher/-/call-matcher-1.0.1.tgz",
"integrity": "sha1-UTTQd5hPcSpU2tPL9i3ijc5BbKg=",
"dev": true,
"requires": {
"core-js": "2.5.1",
"deep-equal": "1.0.1",
"espurify": "1.7.0",
"estraverse": "4.2.0"
}
},
"caller-path": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",
@ -925,16 +987,6 @@
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
},
"center-align": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
"integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=",
"dev": true,
"requires": {
"align-text": "0.1.4",
"lazy-cache": "1.0.4"
}
},
"chai": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz",
@ -1172,6 +1224,46 @@
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==",
"dev": true
},
"common-shake": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/common-shake/-/common-shake-2.0.2.tgz",
"integrity": "sha512-FS+V3q90bmUYGAJrZ1azUBFxQtLrtoeEyALuRnlzTHnAY0LXLk0RQlJKp4QlttmtxEFDbdwKy14HVbFOYUz6nA==",
"dev": true,
"requires": {
"acorn": "5.2.1",
"debug": "2.6.9",
"escope": "3.6.0"
},
"dependencies": {
"acorn": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz",
"integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==",
"dev": true
}
}
},
"common-shakeify": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/common-shakeify/-/common-shakeify-0.4.4.tgz",
"integrity": "sha512-P/YuKyXWs3kcg3IuTJIzE7g/+VCLIeFILP3E9KItxS+llTx+7ILyvMj3XJxiTy1TT3YI0AK4fkE/Bh1N6vI48A==",
"dev": true,
"requires": {
"common-shake": "2.0.2",
"convert-source-map": "1.5.0",
"through2": "2.0.3",
"transform-ast": "2.2.1",
"wrap-comment": "1.0.1"
},
"dependencies": {
"convert-source-map": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz",
"integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=",
"dev": true
}
}
},
"component-bind": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz",
@ -1344,6 +1436,12 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
"dev": true
},
"count-lines": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/count-lines/-/count-lines-0.1.2.tgz",
"integrity": "sha1-4zST+2hgqC9xWdgjeEP7+u/uWWI=",
"dev": true
},
"create-ecdh": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz",
@ -1476,6 +1574,12 @@
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true
},
"dedent": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz",
"integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=",
"dev": true
},
"deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
@ -1485,6 +1589,12 @@
"type-detect": "4.0.5"
}
},
"deep-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
"integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=",
"dev": true
},
"deep-is": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
@ -1670,6 +1780,12 @@
"sentence-case": "1.1.3"
}
},
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
"dev": true
},
"duplexer2": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz",
@ -1922,6 +2038,27 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"escodegen": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz",
"integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==",
"dev": true,
"requires": {
"esprima": "3.1.3",
"estraverse": "4.2.0",
"esutils": "2.0.2",
"optionator": "0.8.2",
"source-map": "0.5.7"
},
"dependencies": {
"esprima": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz",
"integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=",
"dev": true
}
}
},
"escope": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz",
@ -2033,6 +2170,15 @@
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
"dev": true
},
"espurify": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/espurify/-/espurify-1.7.0.tgz",
"integrity": "sha1-HFz2y8zDLm9jk4C9T5kfq5up0iY=",
"dev": true,
"requires": {
"core-js": "2.5.1"
}
},
"esquery": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz",
@ -2058,6 +2204,12 @@
"integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=",
"dev": true
},
"estree-walk": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/estree-walk/-/estree-walk-2.2.0.tgz",
"integrity": "sha512-6gUr3kGNVEfL6pcIiGBrSkhoEQPkv8laQy1lUDpaxT4AvlBxf/UYSueOEb6Wq1cG5Ct6xQSkFCHoJcZlijpUAg==",
"dev": true
},
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
@ -2512,6 +2664,12 @@
"is-property": "1.0.2"
}
},
"get-assigned-identifiers": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.0.0.tgz",
"integrity": "sha512-q+zCftBb/CaoLAnLwfvTcqfHf9f0slXbYDrmRq08ag4TBFCuHrhmSniH1ORH9unlLfeBWSRcWK5LhONHHADUkA==",
"dev": true
},
"get-caller-file": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz",
@ -3259,6 +3417,16 @@
"integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=",
"dev": true
},
"identifierfy": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/identifierfy/-/identifierfy-1.1.1.tgz",
"integrity": "sha1-j5Y2UK+jautC8v8O0V8pX/BAr/A=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"esutils": "2.0.2"
}
},
"ids": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/ids/-/ids-0.2.0.tgz",
@ -3519,6 +3687,12 @@
"integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=",
"dev": true
},
"is-require": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/is-require/-/is-require-0.0.1.tgz",
"integrity": "sha1-DR5tk+OAs1OG9HRUP//Jpm1Bgl4=",
"dev": true
},
"is-resolvable": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz",
@ -3970,12 +4144,6 @@
}
}
},
"lazy-cache": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz",
"integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=",
"dev": true
},
"lcid": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
@ -4086,12 +4254,6 @@
"integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=",
"dev": true
},
"longest": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
"dev": true
},
"lower-case": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz",
@ -4110,6 +4272,15 @@
"integrity": "sha1-sJ0VmdizbtWxb1lYlRXZ0UvC/Yg=",
"dev": true
},
"magic-string": {
"version": "0.22.4",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.4.tgz",
"integrity": "sha512-kxBL06p6iO2qPBHsqGK2b3cRwiRGpnmSuVWNhwHcMX7qJOUr1HvricYP1LZOCdkQBUp0jiWg2d6WJwR3vYgByw==",
"dev": true,
"requires": {
"vlq": "0.2.3"
}
},
"md5.js": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz",
@ -4138,6 +4309,15 @@
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
"dev": true
},
"merge-source-map": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.0.4.tgz",
"integrity": "sha1-pd5GU42uhNQRTMXqArR3KmNGcB8=",
"dev": true,
"requires": {
"source-map": "0.5.7"
}
},
"methods": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/methods/-/methods-0.0.1.tgz",
@ -4346,6 +4526,26 @@
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"multi-stage-sourcemap": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/multi-stage-sourcemap/-/multi-stage-sourcemap-0.2.1.tgz",
"integrity": "sha1-sJ/IWG6qF/gdV1xK0C4Pej9rEQU=",
"dev": true,
"requires": {
"source-map": "0.1.43"
},
"dependencies": {
"source-map": {
"version": "0.1.43",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz",
"integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=",
"dev": true,
"requires": {
"amdefine": "1.0.1"
}
}
}
},
"mute-stream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz",
@ -5155,6 +5355,12 @@
"integrity": "sha1-4Mk1QsV0UhvqE98PlIjtgqt3xdo=",
"dev": true
},
"regenerator-runtime": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz",
"integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==",
"dev": true
},
"regex-cache": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz",
@ -5288,15 +5494,6 @@
"onetime": "1.1.0"
}
},
"right-align": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
"integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=",
"dev": true,
"requires": {
"align-text": "0.1.4"
}
},
"rimraf": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
@ -5348,6 +5545,16 @@
"resolved": "https://registry.npmjs.org/saxen/-/saxen-5.4.1.tgz",
"integrity": "sha512-+S3caYmsxFRxxGjuA+nH8DMTcIzu9rJBfSvUy14gu2/DHRSgq2SsyCHeJ8FkJlT9R29JZXIujCM+vXPHG4AN7Q=="
},
"scope-analyzer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/scope-analyzer/-/scope-analyzer-1.0.0.tgz",
"integrity": "sha512-8yVVX+J+jaQIrDHmkXugoCp4g/IiNGufy00UcfMSBLmQRgwm8JvRkfWVhdJAAk3CI3bfEi10EYEPMqPb6Gx4Sw==",
"dev": true,
"requires": {
"estree-walk": "2.2.0",
"get-assigned-identifiers": "1.0.0"
}
},
"semver": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
@ -5709,6 +5916,16 @@
"readable-stream": "2.3.3"
}
},
"stream-combiner": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
"dev": true,
"requires": {
"duplexer": "0.1.1",
"through": "2.3.8"
}
},
"stream-combiner2": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz",
@ -6059,6 +6276,42 @@
"punycode": "1.4.1"
}
},
"transform-ast": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/transform-ast/-/transform-ast-2.2.1.tgz",
"integrity": "sha512-/ZxIOPIte7f6HCs6CASsMc3bFZEicMm8bPYzn9Rgc8P9+1gJ9xLpY5bOuKGTm3Ma+IlJW/4DGa8ApKOmEMSKiw==",
"dev": true,
"requires": {
"acorn": "5.2.1",
"convert-source-map": "1.5.0",
"is-buffer": "1.1.6",
"magic-string": "0.21.3",
"merge-source-map": "1.0.4"
},
"dependencies": {
"acorn": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz",
"integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==",
"dev": true
},
"convert-source-map": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz",
"integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=",
"dev": true
},
"magic-string": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.21.3.tgz",
"integrity": "sha1-h+IBAJ6/3m9G3FdXMFpwr3HjFiQ=",
"dev": true,
"requires": {
"vlq": "0.2.3"
}
}
}
},
"tryit": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz",
@ -6118,51 +6371,21 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
"uglify-js": {
"version": "2.8.29",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz",
"integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=",
"uglify-es": {
"version": "3.1.9",
"resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.1.9.tgz",
"integrity": "sha512-wVSiJKHDgDDFmxTVVvnbAH6IpamAFHYDI+5JvwPdaqIMnk8kRTX2JKwq1Fx7gb2+Jj5Dus8kzvIpKkWOMNU51w==",
"dev": true,
"requires": {
"source-map": "0.5.7",
"uglify-to-browserify": "1.0.2",
"yargs": "3.10.0"
"commander": "2.11.0",
"source-map": "0.6.1"
},
"dependencies": {
"camelcase": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
"integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=",
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"cliui": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
"integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=",
"dev": true,
"requires": {
"center-align": "0.1.3",
"right-align": "0.1.3",
"wordwrap": "0.0.2"
}
},
"wordwrap": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
"integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=",
"dev": true
},
"yargs": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
"integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=",
"dev": true,
"requires": {
"camelcase": "1.2.1",
"cliui": "2.1.0",
"decamelize": "1.2.0",
"window-size": "0.1.0"
}
}
}
},
@ -6184,6 +6407,43 @@
"integrity": "sha1-iuVW4RAR9jwllnCKiDclnwGz1g4=",
"dev": true
},
"unassert": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/unassert/-/unassert-1.5.1.tgz",
"integrity": "sha1-y8iOw4dBfFpeTALTzQe+mL11/3Y=",
"dev": true,
"requires": {
"acorn": "4.0.13",
"call-matcher": "1.0.1",
"deep-equal": "1.0.1",
"espurify": "1.7.0",
"estraverse": "4.2.0",
"esutils": "2.0.2",
"object-assign": "4.1.1"
}
},
"unassertify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/unassertify/-/unassertify-2.1.0.tgz",
"integrity": "sha512-CB3C3vbOwrZydRuGdU8H421r4/qhM8RLuEOo3G+wEFf7kDP4TR+7oDuj1yOik5pUzXMaJmzxICM7akupP1AlJw==",
"dev": true,
"requires": {
"acorn": "5.2.1",
"convert-source-map": "1.1.3",
"escodegen": "1.9.0",
"multi-stage-sourcemap": "0.2.1",
"through": "2.3.8",
"unassert": "1.5.1"
},
"dependencies": {
"acorn": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz",
"integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==",
"dev": true
}
}
},
"underscore": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz",
@ -6324,6 +6584,12 @@
"extsprintf": "1.3.0"
}
},
"vlq": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz",
"integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==",
"dev": true
},
"vm-browserify": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz",
@ -6491,6 +6757,12 @@
"strip-ansi": "3.0.1"
}
},
"wrap-comment": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/wrap-comment/-/wrap-comment-1.0.1.tgz",
"integrity": "sha512-APccrMwl/ont0RHFTXNAQfM647duYYEfs6cngrIyTByTI0xbWnDnPSptFZhS68L4WCjt2ZxuhCFwuY6Pe88KZQ==",
"dev": true
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",

View File

@ -34,11 +34,13 @@
],
"license": "SEE LICENSE IN LICENSE",
"devDependencies": {
"browser-pack-flat": "^3.0.5",
"browserify": "^13.0.0",
"browserify-derequire": "^0.9.1",
"bundle-collapser": "^1.1.1",
"chai": "^4.1.2",
"chai-match": "^1.1.1",
"common-shakeify": "^0.4.4",
"eslint": "^3.19.0",
"eslint-plugin-mocha": "^4.9.0",
"grunt": "^0.4.4",
@ -69,12 +71,13 @@
"source-map-concat": "^1.0.0",
"stringify": "^3.1.0",
"time-grunt": "^0.3.2",
"uglify-js": "^2.4.16",
"uglify-es": "^3.1.9",
"unassertify": "^2.1.0",
"watchify": "^3.7.0"
},
"dependencies": {
"bpmn-moddle": "^1.1.0",
"diagram-js": "^0.22.1",
"diagram-js": "^0.22.3",
"diagram-js-direct-editing": "^0.19.0",
"diagram-js-origin": "^0.15.2",
"ids": "^0.2.0",

View File

@ -2,12 +2,16 @@
var browserify = require('browserify'),
derequire = require('browserify-derequire'),
UglifyJS = require('uglify-js'),
collapse = require('bundle-collapser/plugin'),
concat = require('source-map-concat'),
fs = require('fs'),
path = require('path');
path = require('path'),
flattenBundle = require('browser-pack-flat/plugin'),
commonShake = require('common-shakeify'),
unassertify = require('unassertify'),
uglify = require('uglify-es');
var assign = Object.assign;
var BANNER = fs.readFileSync(__dirname + '/banner.txt', 'utf8'),
BANNER_MIN = fs.readFileSync(__dirname + '/banner-min.txt', 'utf8');
@ -46,27 +50,23 @@ function extractSourceMap(content) {
}
function uglify(bundle, preamble) {
return UglifyJS.minify(bundle.code, {
fromString: true,
output: {
preamble: preamble
}
});
}
function Timer() {
this.reset();
}
Timer.prototype.done = function(message) {
console.log(message, '[' + (this.now() - this.start) + 'ms]');
console.log(message, '[' + (this.now() - this.s) + 'ms]');
this.reset();
};
Timer.prototype.reset = function() {
this.start = this.now();
this.s = this.now();
};
Timer.prototype.start = function(msg) {
console.log('start: ' + msg);
this.reset();
};
Timer.prototype.now = function() {
@ -89,74 +89,125 @@ module.exports = function(grunt) {
var browserifyOptions = {
standalone: 'BpmnJS',
debug: true,
builtins: false,
insertGlobalVars: {
process: function () {
return 'undefined';
process: function() {
return 'undefined';
},
Buffer: function () {
return 'undefined';
Buffer: function() {
return 'undefined';
}
}
};
var timer = new Timer();
var targetFileBase = path.join(dest, variant);
var banner = grunt.template.process(BANNER, grunt.config.get()),
bannerMin = grunt.template.process(BANNER_MIN, grunt.config.get());
browserify(browserifyOptions)
.plugin(derequire)
.plugin(collapse)
.add(src)
.bundle(function(err, result) {
var timer = new Timer();
timer.done('bundled');
var fns = [
if (err) {
return done(err);
}
// production
function(done) {
var bundled, minified;
timer.start('build prod');
bundled = extractSourceMap(result.toString('utf8'));
browserify(browserifyOptions)
.transform(unassertify)
.plugin(commonShake)
.plugin(flattenBundle)
.plugin(collapse)
.plugin(derequire)
.add(src)
.bundle(function(err, result) {
timer.done('extracted source map');
timer.done('bundled');
try {
minified = uglify(bundled, bannerMin);
} catch (e) {
return done(e);
}
if (err) {
return done(err);
}
timer.done('minified');
var str = result.toString('utf-8');
var bannerBundled;
var minified = uglify.minify(str, {
compress: true,
mangle: true,
output: {
preamble: bannerMin
}
});
try {
bannerBundled = concat([ bundled ])
.prepend(banner + '\n')
.add('//# sourceMappingURL=' + variant + '.js.map')
.toStringWithSourceMap();
} catch (e) {
console.error(e.stack);
throw e;
}
timer.done('minified');
timer.done('added banner');
grunt.file.write(targetFileBase + '.min.js', minified.code, 'utf8');
grunt.file.write(targetFileBase + '.js', bannerBundled.code, 'utf8');
grunt.file.write(targetFileBase + '.js.map', bannerBundled.map, 'utf8');
timer.done('saved');
grunt.file.write(targetFileBase + '.min.js', minified.code, 'utf8');
done();
});
},
timer.done('all saved');
// development
function(done) {
done();
});
timer.start('build dev');
browserify(assign({ debug: true }, browserifyOptions))
.plugin(collapse)
.plugin(derequire)
.add(src)
.bundle(function(err, result) {
timer.done('bundled');
if (err) {
return done(err);
}
try {
var bundled = extractSourceMap(result.toString('utf8'));
timer.done('extracted source map');
var bannerBundled =
concat([ bundled ])
.prepend(banner + '\n')
.add('//# sourceMappingURL=./' + variant + '.js.map')
.toStringWithSourceMap();
timer.done('added banner');
grunt.file.write(targetFileBase + '.js', bannerBundled.code, 'utf8');
grunt.file.write(targetFileBase + '.js.map', bannerBundled.map, 'utf8');
timer.done('all saved');
} catch (e) {
return done(e);
}
done();
});
}
];
function next(err) {
if (err) {
return done(err);
}
var fn = fns.shift();
if (!fn) {
return done();
} else {
fn(next);
}
}
next();
});