Merge branch 'babel' into develop

This commit is contained in:
peteruithoven 2017-07-24 15:52:27 +02:00
commit b366861326
23 changed files with 6323 additions and 611 deletions

19
.babelrc Normal file
View File

@ -0,0 +1,19 @@
{
"env": {
// transpile to common node & browser compatible js, keeping modules
"module": {
"presets": [
["latest", {
"modules": false
}]
]
},
// transpile to common node & browser compatible js, using commonjs
"main": {
"presets": ["latest"]
}
},
"plugins": [
"babel-plugin-transform-object-rest-spread"
]
}

6
.gitignore vendored
View File

@ -1,12 +1,10 @@
*.DS_Store *.DS_Store
jspm_packages jspm_package
node_modules node_modules
lib lib
module module
dist
bundle.js

4
.npmignore Normal file
View File

@ -0,0 +1,4 @@
node_modules
jspm_packages
example
simpleExample

View File

@ -1,478 +0,0 @@
SystemJS.config({
paths: {
"github:": "jspm_packages/github/",
"npm:": "jspm_packages/npm/",
"example/": "example/",
"slicer/": "src/"
},
browserConfig: {
"baseURL": "/"
},
devConfig: {
"map": {
"babel-runtime": "npm:babel-runtime@5.8.38",
"core-js": "npm:core-js@1.2.7",
"plugin-babel": "npm:systemjs-plugin-babel@0.0.12",
"react": "npm:react@15.3.2",
"domain": "github:jspm/nodelibs-domain@0.2.0-alpha",
"zlib": "github:jspm/nodelibs-zlib@0.2.0-alpha",
"https": "github:jspm/nodelibs-https@0.2.0-alpha",
"react-dom": "npm:react-dom@15.3.2",
"babel-plugin-transform-react-jsx": "npm:babel-plugin-transform-react-jsx@6.8.0",
"file-saver": "npm:file-saver@1.3.3"
},
"packages": {
"npm:babel-runtime@5.8.38": {
"map": {}
},
"npm:react@15.3.2": {
"map": {
"object-assign": "npm:object-assign@4.1.0",
"loose-envify": "npm:loose-envify@1.2.0",
"fbjs": "npm:fbjs@0.8.5"
}
},
"npm:fbjs@0.8.5": {
"map": {
"loose-envify": "npm:loose-envify@1.2.0",
"object-assign": "npm:object-assign@4.1.0",
"promise": "npm:promise@7.1.1",
"isomorphic-fetch": "npm:isomorphic-fetch@2.2.1",
"ua-parser-js": "npm:ua-parser-js@0.7.10",
"immutable": "npm:immutable@3.8.1",
"core-js": "npm:core-js@1.2.7"
}
},
"npm:loose-envify@1.2.0": {
"map": {
"js-tokens": "npm:js-tokens@1.0.3"
}
},
"npm:promise@7.1.1": {
"map": {
"asap": "npm:asap@2.0.5"
}
},
"npm:isomorphic-fetch@2.2.1": {
"map": {
"whatwg-fetch": "npm:whatwg-fetch@1.0.0",
"node-fetch": "npm:node-fetch@1.6.3"
}
},
"npm:node-fetch@1.6.3": {
"map": {
"encoding": "npm:encoding@0.1.12",
"is-stream": "npm:is-stream@1.1.0"
}
},
"npm:encoding@0.1.12": {
"map": {
"iconv-lite": "npm:iconv-lite@0.4.13"
}
},
"npm:browserify-zlib@0.1.4": {
"map": {
"readable-stream": "npm:readable-stream@2.1.5",
"pako": "npm:pako@0.2.9"
}
},
"npm:babel-plugin-transform-react-jsx@6.8.0": {
"map": {
"babel-helper-builder-react-jsx": "npm:babel-helper-builder-react-jsx@6.9.0",
"babel-plugin-syntax-jsx": "npm:babel-plugin-syntax-jsx@6.13.0",
"babel-runtime": "npm:babel-runtime@6.11.6"
}
},
"npm:babel-helper-builder-react-jsx@6.9.0": {
"map": {
"babel-runtime": "npm:babel-runtime@6.11.6",
"esutils": "npm:esutils@2.0.2",
"babel-types": "npm:babel-types@6.16.0",
"lodash": "npm:lodash@4.16.4"
}
},
"npm:babel-runtime@6.11.6": {
"map": {
"core-js": "npm:core-js@2.4.1",
"regenerator-runtime": "npm:regenerator-runtime@0.9.5"
}
},
"npm:babel-types@6.16.0": {
"map": {
"lodash": "npm:lodash@4.16.4",
"babel-runtime": "npm:babel-runtime@6.11.6",
"esutils": "npm:esutils@2.0.2",
"to-fast-properties": "npm:to-fast-properties@1.0.2"
}
},
"github:jspm/nodelibs-zlib@0.2.0-alpha": {
"map": {
"zlib-browserify": "npm:browserify-zlib@0.1.4"
}
},
"github:jspm/nodelibs-domain@0.2.0-alpha": {
"map": {
"domain-browserify": "npm:domain-browser@1.1.7"
}
}
}
},
transpiler: "plugin-babel",
packages: {
"slicer": {
"main": "index.js"
},
"example": {
"main": "example/index.js",
"format": "esm",
"meta": {
"*.js": {
"loader": "plugin-babel",
"babelOptions": {
"stage1": true,
"plugins": [
"babel-plugin-transform-react-jsx"
]
}
}
}
}
},
map: {
"babel": "npm:babel-core@5.8.38"
}
});
SystemJS.config({
packageConfigPaths: [
"npm:@*/*.json",
"npm:*.json",
"github:*/*.json"
],
map: {
"three": "npm:three@0.83.0",
"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",
"assert": "github:jspm/nodelibs-assert@0.2.0-alpha",
"buffer": "github:jspm/nodelibs-buffer@0.2.0-alpha",
"child_process": "github:jspm/nodelibs-child_process@0.2.0-alpha",
"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": "github:jspm/nodelibs-http@0.2.0-alpha",
"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": "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": "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": "github:jspm/nodelibs-url@0.2.0-alpha",
"util": "github:jspm/nodelibs-util@0.2.0-alpha",
"vm": "github:jspm/nodelibs-vm@0.2.0-alpha",
"worker": "github:casperlamboo/plugin-worker@master"
},
packages: {
"github:Doodle3D/clipper-js@master": {
"map": {
"clipper-lib": "npm:clipper-lib@1.0.0"
}
},
"npm:clipper-lib@1.0.0": {
"map": {}
},
"npm:stream-browserify@2.0.1": {
"map": {
"inherits": "npm:inherits@2.0.3",
"readable-stream": "npm:readable-stream@2.3.3"
}
},
"npm:buffer@4.9.1": {
"map": {
"base64-js": "npm:base64-js@1.2.1",
"isarray": "npm:isarray@1.0.0",
"ieee754": "npm:ieee754@1.1.8"
}
},
"npm:url@0.11.0": {
"map": {
"querystring": "npm:querystring@0.2.0",
"punycode": "npm:punycode@1.3.2"
}
},
"npm:readable-stream@2.1.5": {
"map": {
"string_decoder": "npm:string_decoder@0.10.31",
"inherits": "npm:inherits@2.0.3",
"isarray": "npm:isarray@1.0.0",
"buffer-shims": "npm:buffer-shims@1.0.0",
"core-util-is": "npm:core-util-is@1.0.2",
"process-nextick-args": "npm:process-nextick-args@1.0.7",
"util-deprecate": "npm:util-deprecate@1.0.2"
}
},
"npm:public-encrypt@4.0.0": {
"map": {
"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.5",
"bn.js": "npm:bn.js@4.11.7",
"miller-rabin": "npm:miller-rabin@4.0.0"
}
},
"npm:browserify-cipher@1.0.0": {
"map": {
"browserify-des": "npm:browserify-des@1.0.0",
"evp_bytestokey": "npm:evp_bytestokey@1.0.0",
"browserify-aes": "npm:browserify-aes@1.0.6"
}
},
"npm:create-ecdh@4.0.0": {
"map": {
"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.4",
"des.js": "npm:des.js@1.0.0"
}
},
"npm:evp_bytestokey@1.0.0": {
"map": {
"create-hash": "npm:create-hash@1.1.3"
}
},
"npm:browserify-aes@1.0.6": {
"map": {
"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.4",
"buffer-xor": "npm:buffer-xor@1.0.3"
}
},
"npm:browserify-rsa@4.0.1": {
"map": {
"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.7",
"brorand": "npm:brorand@1.1.0"
}
},
"npm:des.js@1.0.0": {
"map": {
"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",
"readable-stream": "npm:readable-stream@2.1.5",
"to-arraybuffer": "npm:to-arraybuffer@1.0.1",
"builtin-status-codes": "npm:builtin-status-codes@2.0.0",
"xtend": "npm:xtend@4.0.1"
}
},
"github:Doodle3D/clipper-js@1.0.2": {
"map": {
"Breush/clipper-lib": "github:Breush/clipper-lib@patch-1",
"clipper-lib": "npm:clipper-lib@6.2.1"
}
},
"npm:js-yaml@3.9.0": {
"map": {
"argparse": "npm:argparse@1.0.9",
"esprima": "npm:esprima@4.0.0"
}
},
"npm:argparse@1.0.9": {
"map": {
"sprintf-js": "npm:sprintf-js@1.0.3"
}
},
"github:jspm/nodelibs-buffer@0.2.0-alpha": {
"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"
}
},
"github:jspm/nodelibs-http@0.2.0-alpha": {
"map": {
"http-browserify": "npm:stream-http@2.4.0"
}
},
"github:jspm/nodelibs-url@0.2.0-alpha": {
"map": {
"url-browserify": "npm:url@0.11.0"
}
}
}
});

1641
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +1,35 @@
{ {
"jspm": { "name": "@doodle3d/doodle3d-slicer",
"name": "slicer", "version": "0.0.1",
"main": "index.js", "description": "JavaScript gcode slicer, Intended to use with the Doodle3D WiFi-Box # Usage",
"directories": { "main": "lib/index.js",
"lib": "src" "module": "module/index.js",
"esnext": "src/index.js",
"scripts": {
"prepare": "npm run build",
"build": "npm run build:main && npm run build:main:settings && npm run build:module && npm run build:module:settings ",
"build:main": "BABEL_ENV=main babel src -s -d lib",
"build:module": "BABEL_ENV=module babel src -s -d module",
"build:main:settings": "cp -r src/settings lib",
"build:module:settings": "cp -r src/settings module"
}, },
"dependencies": { "dependencies": {
"Doodle3D/clipper-js": "github:Doodle3D/clipper-js@master", "clipper-js": "^1.0.2",
"clipper-js": "github:Doodle3D/clipper-js@1.0.2", "three": "^0.83.0"
"js-yaml": "npm:js-yaml@^3.9.0",
"json": "github:systemjs/plugin-json@^0.1.2",
"text": "github:systemjs/plugin-text@^0.0.11",
"three": "npm:three@0.83.0",
"worker": "github:casperlamboo/plugin-worker@master"
}, },
"devDependencies": { "devDependencies": {
"babel-plugin-transform-react-jsx": "npm:babel-plugin-transform-react-jsx@^6.8.0", "babel-cli": "^6.24.1",
"babel-runtime": "npm:babel-runtime@^5.1.13", "babel-plugin-transform-object-rest-spread": "^6.23.0",
"core-js": "npm:core-js@^1.2.0", "babel-preset-latest": "^6.24.1"
"file-saver": "npm:file-saver@^1.3.3",
"domain": "github:jspm/nodelibs-domain@^0.2.0-alpha",
"https": "github:jspm/nodelibs-https@^0.2.0-alpha",
"plugin-babel": "npm:systemjs-plugin-babel@^0.0.12",
"react": "npm:react@^15.3.2",
"react-dom": "npm:react-dom@^15.3.2",
"zlib": "github:jspm/nodelibs-zlib@^0.2.0-alpha"
}, },
"peerDependencies": { "repository": {
"assert": "github:jspm/nodelibs-assert@^0.2.0-alpha", "type": "git",
"buffer": "github:jspm/nodelibs-buffer@^0.2.0-alpha", "url": "git+https://github.com/Doodle3D/Doodle3D-Slicer.git"
"child_process": "github:jspm/nodelibs-child_process@^0.2.0-alpha",
"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": "github:jspm/nodelibs-http@^0.2.0-alpha",
"module": "npm:jspm-nodelibs-module@^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": "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": "github:jspm/nodelibs-url@^0.2.0-alpha",
"util": "github:jspm/nodelibs-util@^0.2.0-alpha",
"vm": "github:jspm/nodelibs-vm@^0.2.0-alpha"
}, },
"overrides": { "author": "",
"npm:babel-runtime@5.8.38": { "license": "ISC",
"main": false, "bugs": {
"dependencies": {}, "url": "https://github.com/Doodle3D/Doodle3D-Slicer/issues"
"optionalDependencies": {
"core-js": "^1.2.0"
}
}, },
"npm:browserify-zlib@0.1.4": { "homepage": "https://github.com/Doodle3D/Doodle3D-Slicer#readme"
"dependencies": {
"readable-stream": "^2.0.2",
"pako": "~0.2.0"
},
"map": {
"_stream_transform": "readable-stream/transform"
}
},
"npm:inherits@2.0.3": {
"ignore": [
"test.js"
]
},
"npm:lodash@4.16.4": {
"map": {
"buffer": "@empty",
"process": "@empty"
}
},
"npm:pbkdf2@3.0.12": {
"main": "browser.js"
},
"npm:safe-buffer@5.1.1": {
"browser": "index.js"
}
}
},
"dependencies": {
"js-yaml": "^3.9.0"
},
"devDependencies": {
"jspm": "^0.17.0-beta.28"
}
} }

View File

@ -1,15 +0,0 @@
<!DOCTYPE>
<html>
<head>
<title>Doodle3D Slicer - Simple example</title>
<script type="text/javascript" src="../jspm_packages/system.js"></script>
<script type="text/javascript" src="../jspm.config.js"></script>
<script type="text/javascript">
System.import('simpleExample/index.js');
</script>
</head>
<body>
<div id="gcode"></div>
</body>
</html>

View File

@ -1,16 +1,20 @@
import 'three.js'; import * as THREE from 'three';
import * as SLICER from 'src/index.js'; import { defaultSettings, sliceGeometry } from 'doodle3d-slicer';
const settings = new SLICER.Settings({ const settings = {
...SLICER.printerSettings['ultimaker2go'], ...defaultSettings.base,
...SLICER.userSettings.low ...defaultSettings.material.pla,
}); ...defaultSettings.printer.ultimaker2go,
...defaultSettings.quality.high
};
const geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone(); const geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone();
const slicer = new SLICER.Slicer(); const onProgress = ({ progress: { done, total, action } }) => {
const percentage = `${(done / total * 100).toFixed()}%`
document.write(`<p>${action}, ${percentage}</p>`);
};
slicer.setGeometry(geometry); sliceGeometry(settings, geometry, null, false, onProgress).then(gcode => {
slicer.slice(settings, false).then(gcode => { document.body.innerHTML = gcode.replace(/(?:\r\n|\r|\n)/g, '<br />');
document.getElementById('gcode').innerHTML = gcode.replace(/(?:\r\n|\r|\n)/g, '<br />');
}); });

4513
simpleExample/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
{
"name": "doodle3d-simple-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack -p",
"start": "webpack-dev-server -w"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-polyfill": "^6.23.0",
"three": "^0.83.0"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-preset-latest": "^6.24.1",
"html-webpack-plugin": "^2.29.0",
"webpack": "^3.3.0",
"webpack-dev-server": "^2.5.1",
"worker-loader": "^0.8.1",
"yml-loader": "^2.1.0"
}
}

View File

@ -0,0 +1,56 @@
const path = require('path');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const HTMLWebpackPlugin = require('html-webpack-plugin');
const babelLoader = {
loader: 'babel-loader',
options: {
presets: [
['latest', {
'modules': false,
'loose': true
}]
],
plugins: [require('babel-plugin-transform-object-rest-spread')],
babelrc: false
}
}
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
alias: {
'doodle3d-slicer': path.resolve(__dirname, '../src/index.js')
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: babelLoader
},
{
test: /\.yml$/,
use: 'yml-loader'
},
{
test: /\.worker\.js$/,
use: ['worker-loader', babelLoader]
}
]
},
plugins: [
new HTMLWebpackPlugin({
title: 'Doodle3D Slicer - Simple example'
}),
],
devtool: "source-map",
devServer: {
contentBase: 'dist'
}
};

View File

@ -1,15 +1,14 @@
import { sliceGeometry, sliceMesh } from './slicer.js'; import { sliceGeometry, sliceMesh } from './slicer.js';
import baseSettings from './settings/default.yml!text'; import baseSettings from './settings/default.yml';
import printerSettings from './settings/printer.yml!text'; import printerSettings from './settings/printer.yml';
import materialSettings from './settings/material.yml!text'; import materialSettings from './settings/material.yml';
import qualitySettings from './settings/quality.yml!text'; import qualitySettings from './settings/quality.yml';
import yaml from 'js-yaml';
const defaultSettings = { const defaultSettings = {
base: yaml.safeLoad(baseSettings), base: baseSettings,
printer: yaml.safeLoad(printerSettings), printer: printerSettings,
material: yaml.safeLoad(materialSettings), material: materialSettings,
quality: yaml.safeLoad(qualitySettings) quality: qualitySettings
}; };
export { export {

View File

@ -1,4 +1,4 @@
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
import { PRECISION } from '../constants.js'; import { PRECISION } from '../constants.js';
const offsetOptions = { const offsetOptions = {

View File

@ -1,6 +1,6 @@
import { PRECISION } from '../constants.js' import { PRECISION } from '../constants.js'
import getFillTemplate from './getFillTemplate.js'; import getFillTemplate from './getFillTemplate.js';
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
export default function generateInfills(slices, settings) { export default function generateInfills(slices, settings) {
let { let {

View File

@ -1,4 +1,4 @@
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
export default function calculateOutlines(slices, settings) { export default function calculateOutlines(slices, settings) {
for (let layer = 0; layer < slices.length; layer ++) { for (let layer = 0; layer < slices.length; layer ++) {

View File

@ -1,5 +1,5 @@
import getFillTemplate from './getFillTemplate.js'; import getFillTemplate from './getFillTemplate.js';
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
import { PRECISION } from '../constants.js'; import { PRECISION } from '../constants.js';
export default function generateSupport(slices, settings) { export default function generateSupport(slices, settings) {

View File

@ -1,4 +1,4 @@
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
export default function getFillTemplate(bounds, size, even, uneven) { export default function getFillTemplate(bounds, size, even, uneven) {
const paths = []; const paths = [];

View File

@ -1,4 +1,4 @@
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
export default class { export default class {
constructor() { constructor() {

View File

@ -1,5 +1,5 @@
import * as THREE from 'three'; import * as THREE from 'three';
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
export default function intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings) { export default function intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings) {
const layers = []; const layers = [];

View File

@ -1,5 +1,5 @@
import * as THREE from 'three'; import * as THREE from 'three';
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
export default function optimizePaths(slices, settings) { export default function optimizePaths(slices, settings) {
const start = new THREE.Vector2(0, 0); const start = new THREE.Vector2(0, 0);

View File

@ -1,4 +1,4 @@
import Shape from 'Doodle3D/clipper-js'; import Shape from 'clipper-js';
import Slice from './helpers/Slice.js'; import Slice from './helpers/Slice.js';
import { CLEAN_DELTA, PRECISION } from '../constants.js'; import { CLEAN_DELTA, PRECISION } from '../constants.js';

View File

@ -1,6 +1,6 @@
import * as THREE from 'three'; import * as THREE from 'three';
import slice from './sliceActions/slice.js'; import slice from './sliceActions/slice.js';
import SlicerWorker from './slicerWorker.js!worker'; import SlicerWorker from './slicer.worker.js';
export function sliceMesh(settings, mesh, sync = false, onProgress) { export function sliceMesh(settings, mesh, sync = false, onProgress) {
if (typeof mesh === 'undefined' || !mesh.isMesh) { if (typeof mesh === 'undefined' || !mesh.isMesh) {