From 1d2a9ba9658d26202bfc6f835b91a4709997679b Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Tue, 18 Jul 2017 12:38:03 +0200 Subject: [PATCH] use npm version of three.js --- README.md | 2 +- example/save.js | 2 +- jspm.config.js | 308 ++++++++++-------- package.json | 25 +- src/GCode.js | 2 +- src/Slicer.js | 2 +- .../calculateLayersIntersections.js | 2 +- src/sliceActions/createLines.js | 2 +- src/sliceActions/intersectionsToShapes.js | 2 +- src/sliceActions/optimizePaths.js | 2 +- src/slicerWorker.js | 2 +- 11 files changed, 200 insertions(+), 151 deletions(-) diff --git a/README.md b/README.md index 3957352..29498ea 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ JavaScript gcode slicer, Intended to use with the Doodle3D WiFi-Box # Usage ```javascript -import THREE from 'three.js'; +import * as THREE from 'three'; import * as SLICER from 'doodle3d-slicer'; const settings = new SLICER.Settings({ diff --git a/example/save.js b/example/save.js index f6e114b..353ef0d 100644 --- a/example/save.js +++ b/example/save.js @@ -1,4 +1,4 @@ -import 'three.js'; +import * as THREE from 'three'; import { defaultSettings, Slicer } from 'src/index.js'; import { saveAs } from 'file-saver'; diff --git a/jspm.config.js b/jspm.config.js index ea1ba2b..0200395 100644 --- a/jspm.config.js +++ b/jspm.config.js @@ -139,8 +139,7 @@ SystemJS.config({ } }, map: { - "babel": "npm:babel-core@5.8.38", - "three.js/loaders/STLLoader": "github:mrdoob/three.js@r83/examples/js/loaders/STLLoader.js" + "babel": "npm:babel-core@5.8.38" } }); @@ -151,31 +150,31 @@ SystemJS.config({ "github:*/*.json" ], map: { + "three": "npm:three@0.83.0", "progress-promise": "npm:progress-promise@0.0.6", "text": "github:systemjs/plugin-text@0.0.11", "js-yaml": "npm:js-yaml@3.9.0", "clipper-js": "github:Doodle3D/clipper-js@1.0.2", - "three.js": "github:mrdoob/three.js@r83", "assert": "github:jspm/nodelibs-assert@0.2.0-alpha", "buffer": "github:jspm/nodelibs-buffer@0.2.0-alpha", "child_process": "npm:jspm-nodelibs-child_process@0.2.0", - "constants": "npm:jspm-nodelibs-constants@0.2.0", - "crypto": "npm:jspm-nodelibs-crypto@0.2.0", - "events": "npm:jspm-nodelibs-events@0.2.0", + "constants": "github:jspm/nodelibs-constants@0.2.0-alpha", + "crypto": "github:jspm/nodelibs-crypto@0.2.0-alpha", + "events": "github:jspm/nodelibs-events@0.2.2", "fs": "github:jspm/nodelibs-fs@0.2.0-alpha", "http": "npm:jspm-nodelibs-http@0.2.0", "json": "github:systemjs/plugin-json@0.1.2", "Doodle3D/clipper-js": "github:Doodle3D/clipper-js@master", "module": "npm:jspm-nodelibs-module@0.2.0", - "os": "npm:jspm-nodelibs-os@0.2.0", + "os": "github:jspm/nodelibs-os@0.2.2", "path": "github:jspm/nodelibs-path@0.2.3", "process": "github:jspm/nodelibs-process@0.2.0-alpha", - "stream": "npm:jspm-nodelibs-stream@0.2.0", - "string_decoder": "npm:jspm-nodelibs-string_decoder@0.2.0", + "stream": "github:jspm/nodelibs-stream@0.2.0-alpha", + "string_decoder": "github:jspm/nodelibs-string_decoder@0.2.0-alpha", "tty": "npm:jspm-nodelibs-tty@0.2.0", "url": "npm:jspm-nodelibs-url@0.2.0", "util": "github:jspm/nodelibs-util@0.2.0-alpha", - "vm": "npm:jspm-nodelibs-vm@0.2.0", + "vm": "github:jspm/nodelibs-vm@0.2.0-alpha", "worker": "github:casperlamboo/plugin-worker@master" }, packages: { @@ -190,12 +189,12 @@ SystemJS.config({ "npm:stream-browserify@2.0.1": { "map": { "inherits": "npm:inherits@2.0.3", - "readable-stream": "npm:readable-stream@2.1.5" + "readable-stream": "npm:readable-stream@2.3.3" } }, "npm:buffer@4.9.1": { "map": { - "base64-js": "npm:base64-js@1.2.0", + "base64-js": "npm:base64-js@1.2.1", "isarray": "npm:isarray@1.0.0", "ieee754": "npm:ieee754@1.1.8" } @@ -217,61 +216,22 @@ SystemJS.config({ "util-deprecate": "npm:util-deprecate@1.0.2" } }, - "npm:crypto-browserify@3.11.0": { - "map": { - "inherits": "npm:inherits@2.0.3", - "browserify-cipher": "npm:browserify-cipher@1.0.0", - "create-hash": "npm:create-hash@1.1.2", - "browserify-sign": "npm:browserify-sign@4.0.0", - "pbkdf2": "npm:pbkdf2@3.0.9", - "public-encrypt": "npm:public-encrypt@4.0.0", - "randombytes": "npm:randombytes@2.0.3", - "diffie-hellman": "npm:diffie-hellman@5.0.2", - "create-ecdh": "npm:create-ecdh@4.0.0", - "create-hmac": "npm:create-hmac@1.1.4" - } - }, - "npm:browserify-sign@4.0.0": { - "map": { - "create-hash": "npm:create-hash@1.1.2", - "inherits": "npm:inherits@2.0.3", - "create-hmac": "npm:create-hmac@1.1.4", - "parse-asn1": "npm:parse-asn1@5.0.0", - "elliptic": "npm:elliptic@6.3.2", - "bn.js": "npm:bn.js@4.11.6", - "browserify-rsa": "npm:browserify-rsa@4.0.1" - } - }, - "npm:create-hash@1.1.2": { - "map": { - "inherits": "npm:inherits@2.0.3", - "ripemd160": "npm:ripemd160@1.0.1", - "cipher-base": "npm:cipher-base@1.0.3", - "sha.js": "npm:sha.js@2.4.5" - } - }, "npm:public-encrypt@4.0.0": { "map": { - "randombytes": "npm:randombytes@2.0.3", - "create-hash": "npm:create-hash@1.1.2", - "parse-asn1": "npm:parse-asn1@5.0.0", - "bn.js": "npm:bn.js@4.11.6", + "randombytes": "npm:randombytes@2.0.5", + "create-hash": "npm:create-hash@1.1.3", + "parse-asn1": "npm:parse-asn1@5.1.0", + "bn.js": "npm:bn.js@4.11.7", "browserify-rsa": "npm:browserify-rsa@4.0.1" } }, "npm:diffie-hellman@5.0.2": { "map": { - "randombytes": "npm:randombytes@2.0.3", - "bn.js": "npm:bn.js@4.11.6", + "randombytes": "npm:randombytes@2.0.5", + "bn.js": "npm:bn.js@4.11.7", "miller-rabin": "npm:miller-rabin@4.0.0" } }, - "npm:create-hmac@1.1.4": { - "map": { - "create-hash": "npm:create-hash@1.1.2", - "inherits": "npm:inherits@2.0.3" - } - }, "npm:browserify-cipher@1.0.0": { "map": { "browserify-des": "npm:browserify-des@1.0.0", @@ -281,55 +241,41 @@ SystemJS.config({ }, "npm:create-ecdh@4.0.0": { "map": { - "elliptic": "npm:elliptic@6.3.2", - "bn.js": "npm:bn.js@4.11.6" - } - }, - "npm:parse-asn1@5.0.0": { - "map": { - "create-hash": "npm:create-hash@1.1.2", - "pbkdf2": "npm:pbkdf2@3.0.9", - "browserify-aes": "npm:browserify-aes@1.0.6", - "evp_bytestokey": "npm:evp_bytestokey@1.0.0", - "asn1.js": "npm:asn1.js@4.8.1" + "elliptic": "npm:elliptic@6.4.0", + "bn.js": "npm:bn.js@4.11.7" } }, "npm:browserify-des@1.0.0": { "map": { "inherits": "npm:inherits@2.0.3", - "cipher-base": "npm:cipher-base@1.0.3", + "cipher-base": "npm:cipher-base@1.0.4", "des.js": "npm:des.js@1.0.0" } }, "npm:evp_bytestokey@1.0.0": { "map": { - "create-hash": "npm:create-hash@1.1.2" + "create-hash": "npm:create-hash@1.1.3" } }, "npm:browserify-aes@1.0.6": { "map": { - "create-hash": "npm:create-hash@1.1.2", + "create-hash": "npm:create-hash@1.1.3", "evp_bytestokey": "npm:evp_bytestokey@1.0.0", "inherits": "npm:inherits@2.0.3", - "cipher-base": "npm:cipher-base@1.0.3", + "cipher-base": "npm:cipher-base@1.0.4", "buffer-xor": "npm:buffer-xor@1.0.3" } }, - "npm:sha.js@2.4.5": { - "map": { - "inherits": "npm:inherits@2.0.3" - } - }, "npm:browserify-rsa@4.0.1": { "map": { - "bn.js": "npm:bn.js@4.11.6", - "randombytes": "npm:randombytes@2.0.3" + "bn.js": "npm:bn.js@4.11.7", + "randombytes": "npm:randombytes@2.0.5" } }, "npm:miller-rabin@4.0.0": { "map": { - "bn.js": "npm:bn.js@4.11.6", - "brorand": "npm:brorand@1.0.6" + "bn.js": "npm:bn.js@4.11.7", + "brorand": "npm:brorand@1.1.0" } }, "npm:des.js@1.0.0": { @@ -338,36 +284,6 @@ SystemJS.config({ "minimalistic-assert": "npm:minimalistic-assert@1.0.0" } }, - "npm:hash.js@1.0.3": { - "map": { - "inherits": "npm:inherits@2.0.3" - } - }, - "npm:pbkdf2@3.0.9": { - "map": { - "create-hmac": "npm:create-hmac@1.1.4" - } - }, - "npm:elliptic@6.3.2": { - "map": { - "bn.js": "npm:bn.js@4.11.6", - "inherits": "npm:inherits@2.0.3", - "brorand": "npm:brorand@1.0.6", - "hash.js": "npm:hash.js@1.0.3" - } - }, - "npm:cipher-base@1.0.3": { - "map": { - "inherits": "npm:inherits@2.0.3" - } - }, - "npm:asn1.js@4.8.1": { - "map": { - "bn.js": "npm:bn.js@4.11.6", - "inherits": "npm:inherits@2.0.3", - "minimalistic-assert": "npm:minimalistic-assert@1.0.0" - } - }, "npm:stream-http@2.4.0": { "map": { "inherits": "npm:inherits@2.0.3", @@ -377,31 +293,11 @@ SystemJS.config({ "xtend": "npm:xtend@4.0.1" } }, - "npm:jspm-nodelibs-crypto@0.2.0": { - "map": { - "crypto-browserify": "npm:crypto-browserify@3.11.0" - } - }, "npm:jspm-nodelibs-http@0.2.0": { "map": { "http-browserify": "npm:stream-http@2.4.0" } }, - "npm:jspm-nodelibs-os@0.2.0": { - "map": { - "os-browserify": "npm:os-browserify@0.2.1" - } - }, - "npm:jspm-nodelibs-stream@0.2.0": { - "map": { - "stream-browserify": "npm:stream-browserify@2.0.1" - } - }, - "npm:jspm-nodelibs-string_decoder@0.2.0": { - "map": { - "string_decoder-browserify": "npm:string_decoder@0.10.31" - } - }, "npm:jspm-nodelibs-url@0.2.0": { "map": { "url-browserify": "npm:url@0.11.0" @@ -428,6 +324,156 @@ SystemJS.config({ "map": { "buffer-browserify": "npm:buffer@4.9.1" } + }, + "github:jspm/nodelibs-crypto@0.2.0-alpha": { + "map": { + "crypto-browserify": "npm:crypto-browserify@3.11.1" + } + }, + "npm:crypto-browserify@3.11.1": { + "map": { + "browserify-cipher": "npm:browserify-cipher@1.0.0", + "browserify-sign": "npm:browserify-sign@4.0.4", + "create-ecdh": "npm:create-ecdh@4.0.0", + "create-hash": "npm:create-hash@1.1.3", + "create-hmac": "npm:create-hmac@1.1.6", + "diffie-hellman": "npm:diffie-hellman@5.0.2", + "inherits": "npm:inherits@2.0.3", + "pbkdf2": "npm:pbkdf2@3.0.12", + "public-encrypt": "npm:public-encrypt@4.0.0", + "randombytes": "npm:randombytes@2.0.5" + } + }, + "npm:browserify-sign@4.0.4": { + "map": { + "create-hash": "npm:create-hash@1.1.3", + "create-hmac": "npm:create-hmac@1.1.6", + "inherits": "npm:inherits@2.0.3", + "elliptic": "npm:elliptic@6.4.0", + "bn.js": "npm:bn.js@4.11.7", + "parse-asn1": "npm:parse-asn1@5.1.0", + "browserify-rsa": "npm:browserify-rsa@4.0.1" + } + }, + "npm:create-hash@1.1.3": { + "map": { + "inherits": "npm:inherits@2.0.3", + "ripemd160": "npm:ripemd160@2.0.1", + "sha.js": "npm:sha.js@2.4.8", + "cipher-base": "npm:cipher-base@1.0.4" + } + }, + "npm:create-hmac@1.1.6": { + "map": { + "create-hash": "npm:create-hash@1.1.3", + "inherits": "npm:inherits@2.0.3", + "ripemd160": "npm:ripemd160@2.0.1", + "safe-buffer": "npm:safe-buffer@5.1.1", + "sha.js": "npm:sha.js@2.4.8", + "cipher-base": "npm:cipher-base@1.0.4" + } + }, + "npm:randombytes@2.0.5": { + "map": { + "safe-buffer": "npm:safe-buffer@5.1.1" + } + }, + "npm:pbkdf2@3.0.12": { + "map": { + "create-hmac": "npm:create-hmac@1.1.6", + "ripemd160": "npm:ripemd160@2.0.1", + "safe-buffer": "npm:safe-buffer@5.1.1", + "sha.js": "npm:sha.js@2.4.8", + "create-hash": "npm:create-hash@1.1.3" + } + }, + "npm:ripemd160@2.0.1": { + "map": { + "inherits": "npm:inherits@2.0.3", + "hash-base": "npm:hash-base@2.0.2" + } + }, + "npm:sha.js@2.4.8": { + "map": { + "inherits": "npm:inherits@2.0.3" + } + }, + "npm:elliptic@6.4.0": { + "map": { + "inherits": "npm:inherits@2.0.3", + "bn.js": "npm:bn.js@4.11.7", + "hmac-drbg": "npm:hmac-drbg@1.0.1", + "hash.js": "npm:hash.js@1.1.3", + "brorand": "npm:brorand@1.1.0", + "minimalistic-crypto-utils": "npm:minimalistic-crypto-utils@1.0.1", + "minimalistic-assert": "npm:minimalistic-assert@1.0.0" + } + }, + "npm:parse-asn1@5.1.0": { + "map": { + "browserify-aes": "npm:browserify-aes@1.0.6", + "create-hash": "npm:create-hash@1.1.3", + "evp_bytestokey": "npm:evp_bytestokey@1.0.0", + "pbkdf2": "npm:pbkdf2@3.0.12", + "asn1.js": "npm:asn1.js@4.9.1" + } + }, + "npm:cipher-base@1.0.4": { + "map": { + "safe-buffer": "npm:safe-buffer@5.1.1", + "inherits": "npm:inherits@2.0.3" + } + }, + "npm:hash-base@2.0.2": { + "map": { + "inherits": "npm:inherits@2.0.3" + } + }, + "npm:hmac-drbg@1.0.1": { + "map": { + "hash.js": "npm:hash.js@1.1.3", + "minimalistic-assert": "npm:minimalistic-assert@1.0.0", + "minimalistic-crypto-utils": "npm:minimalistic-crypto-utils@1.0.1" + } + }, + "npm:hash.js@1.1.3": { + "map": { + "inherits": "npm:inherits@2.0.3", + "minimalistic-assert": "npm:minimalistic-assert@1.0.0" + } + }, + "npm:asn1.js@4.9.1": { + "map": { + "bn.js": "npm:bn.js@4.11.7", + "inherits": "npm:inherits@2.0.3", + "minimalistic-assert": "npm:minimalistic-assert@1.0.0" + } + }, + "github:jspm/nodelibs-stream@0.2.0-alpha": { + "map": { + "stream-browserify": "npm:stream-browserify@2.0.1" + } + }, + "npm:readable-stream@2.3.3": { + "map": { + "inherits": "npm:inherits@2.0.3", + "isarray": "npm:isarray@1.0.0", + "safe-buffer": "npm:safe-buffer@5.1.1", + "string_decoder": "npm:string_decoder@1.0.3", + "util-deprecate": "npm:util-deprecate@1.0.2", + "process-nextick-args": "npm:process-nextick-args@1.0.7", + "core-util-is": "npm:core-util-is@1.0.2" + } + }, + "npm:string_decoder@1.0.3": { + "map": { + "safe-buffer": "npm:safe-buffer@5.1.1" + } + }, + "github:jspm/nodelibs-string_decoder@0.2.0-alpha": { + "map": { + "string_decoder-browserify": "npm:string_decoder@0.10.31" + } } } }); diff --git a/package.json b/package.json index 10d7f62..ba5baf5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "json": "github:systemjs/plugin-json@^0.1.2", "progress-promise": "npm:progress-promise@^0.0.6", "text": "github:systemjs/plugin-text@^0.0.11", - "three.js": "github:mrdoob/three.js@r83", + "three": "npm:three@0.83.0", "worker": "github:casperlamboo/plugin-worker@master" }, "devDependencies": { @@ -31,26 +31,23 @@ "assert": "github:jspm/nodelibs-assert@^0.2.0-alpha", "buffer": "github:jspm/nodelibs-buffer@^0.2.0-alpha", "child_process": "npm:jspm-nodelibs-child_process@^0.2.0", - "constants": "npm:jspm-nodelibs-constants@^0.2.0", - "crypto": "npm:jspm-nodelibs-crypto@^0.2.0", - "events": "npm:jspm-nodelibs-events@^0.2.0", + "constants": "github:jspm/nodelibs-constants@^0.2.0-alpha", + "crypto": "github:jspm/nodelibs-crypto@^0.2.0-alpha", + "events": "github:jspm/nodelibs-events@^0.2.0-alpha", "fs": "github:jspm/nodelibs-fs@^0.2.0-alpha", "http": "npm:jspm-nodelibs-http@^0.2.0", "module": "npm:jspm-nodelibs-module@^0.2.0", - "os": "npm:jspm-nodelibs-os@^0.2.0", + "os": "github:jspm/nodelibs-os@^0.2.0-alpha", "path": "github:jspm/nodelibs-path@^0.2.0-alpha", "process": "github:jspm/nodelibs-process@^0.2.0-alpha", - "stream": "npm:jspm-nodelibs-stream@^0.2.0", - "string_decoder": "npm:jspm-nodelibs-string_decoder@^0.2.0", + "stream": "github:jspm/nodelibs-stream@^0.2.0-alpha", + "string_decoder": "github:jspm/nodelibs-string_decoder@^0.2.0-alpha", "tty": "npm:jspm-nodelibs-tty@^0.2.0", "url": "npm:jspm-nodelibs-url@^0.2.0", "util": "github:jspm/nodelibs-util@^0.2.0-alpha", - "vm": "npm:jspm-nodelibs-vm@^0.2.0" + "vm": "github:jspm/nodelibs-vm@^0.2.0-alpha" }, "overrides": { - "github:mrdoob/three.js@r83": { - "format": "global" - }, "npm:babel-runtime@5.8.38": { "main": false, "dependencies": {}, @@ -77,6 +74,12 @@ "buffer": "@empty", "process": "@empty" } + }, + "npm:pbkdf2@3.0.12": { + "main": "browser.js" + }, + "npm:safe-buffer@5.1.1": { + "browser": "index.js" } } }, diff --git a/src/GCode.js b/src/GCode.js index 0fd5199..18f0261 100644 --- a/src/GCode.js +++ b/src/GCode.js @@ -1,4 +1,4 @@ -import * as THREE from 'three.js'; +import * as THREE from 'three'; const MOVE = 'G'; const M_COMMAND = 'M'; diff --git a/src/Slicer.js b/src/Slicer.js index 2e2be20..280a6df 100644 --- a/src/Slicer.js +++ b/src/Slicer.js @@ -1,4 +1,4 @@ -import * as THREE from 'three.js'; +import * as THREE from 'three'; import slice from './sliceActions/slice.js'; import SlicerWorker from './slicerWorker.js!worker'; import ProgressPromise from 'progress-promise'; diff --git a/src/sliceActions/calculateLayersIntersections.js b/src/sliceActions/calculateLayersIntersections.js index b8d3aa8..76b0e9f 100644 --- a/src/sliceActions/calculateLayersIntersections.js +++ b/src/sliceActions/calculateLayersIntersections.js @@ -1,4 +1,4 @@ -import * as THREE from 'three.js'; +import * as THREE from 'three'; export default function calculateLayersIntersections(lines, settings) { const { layerHeight, dimensions: { z: dimensionsZ } } = settings; diff --git a/src/sliceActions/createLines.js b/src/sliceActions/createLines.js index b7f1e6e..188f1c3 100644 --- a/src/sliceActions/createLines.js +++ b/src/sliceActions/createLines.js @@ -1,4 +1,4 @@ -import * as THREE from 'three.js'; +import * as THREE from 'three'; function addLine(geometry, lineLookup, lines, a, b, isFlat) { const index = lines.length; diff --git a/src/sliceActions/intersectionsToShapes.js b/src/sliceActions/intersectionsToShapes.js index 06c5f79..6e24ce2 100644 --- a/src/sliceActions/intersectionsToShapes.js +++ b/src/sliceActions/intersectionsToShapes.js @@ -1,4 +1,4 @@ -import * as THREE from 'three.js'; +import * as THREE from 'three'; import Shape from 'Doodle3D/clipper-js'; export default function intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings) { diff --git a/src/sliceActions/optimizePaths.js b/src/sliceActions/optimizePaths.js index 071cc50..cc5fec5 100644 --- a/src/sliceActions/optimizePaths.js +++ b/src/sliceActions/optimizePaths.js @@ -1,4 +1,4 @@ -import * as THREE from 'three.js'; +import * as THREE from 'three'; import Shape from 'Doodle3D/clipper-js'; export default function optimizePaths(slices, settings) { diff --git a/src/slicerWorker.js b/src/slicerWorker.js index 78e6654..a761bd4 100644 --- a/src/slicerWorker.js +++ b/src/slicerWorker.js @@ -1,5 +1,5 @@ import slice from './sliceActions/slice.js'; -import * as THREE from 'three.js'; +import * as THREE from 'three'; const loader = new THREE.JSONLoader();