@jscad/3mf-deserializer 3.0.0-alpha.0 → 3.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE +1 -1
- package/dist/jscad-3mf-deserializer.es.js +4 -4
- package/dist/jscad-3mf-deserializer.min.js +4 -4
- package/package.json +4 -4
- package/rollup.config.js +1 -1
- package/src/index.js +0 -2
- package/src/model.js +2 -2
- package/src/parse.js +5 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jscad/3mf-deserializer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-alpha.0",
|
|
4
4
|
"description": "3MF Deserializer for JSCAD",
|
|
5
5
|
"homepage": "https://openjscad.xyz/",
|
|
6
6
|
"repository": "https://github.com/jscad/OpenJSCAD.org/",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@jscad/array-utils": "3.0.
|
|
36
|
-
"@jscad/modeling": "3.0.
|
|
35
|
+
"@jscad/array-utils": "3.0.1-alpha.0",
|
|
36
|
+
"@jscad/modeling": "3.0.1-alpha.0",
|
|
37
37
|
"fflate": "^0.7.3",
|
|
38
38
|
"saxes": "^6.0.0"
|
|
39
39
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"rollup-plugin-banner": "^0.2.1",
|
|
48
48
|
"rollup-plugin-version-injector": "^1.3.3"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "0660b5c1f1a5faf54d4cfae1cb85bb94182a8d32"
|
|
51
51
|
}
|
package/rollup.config.js
CHANGED
|
@@ -24,6 +24,6 @@ export default {
|
|
|
24
24
|
nodeResolve(),
|
|
25
25
|
banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'),
|
|
26
26
|
versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }),
|
|
27
|
-
terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} })
|
|
27
|
+
terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } })
|
|
28
28
|
]
|
|
29
29
|
}
|
package/src/index.js
CHANGED
|
@@ -72,8 +72,6 @@ const deserialize = (options, input) => {
|
|
|
72
72
|
return options.output === 'script' ? translateModels(options, models) : instantiateModels(options, models)
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const isBuffer = (obj) => (obj.byteLength !== undefined && typeof obj.slice === 'function')
|
|
76
|
-
|
|
77
75
|
const mimeType = 'model/3mf'
|
|
78
76
|
|
|
79
77
|
export {
|
package/src/model.js
CHANGED
|
@@ -16,8 +16,8 @@ export const parseModel = (options, source) => {
|
|
|
16
16
|
// parse the 3MF contents (XML)
|
|
17
17
|
const { objects, materials, colorgroups, items } = parse(source)
|
|
18
18
|
if (objects.length === 0) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
throw new Error('3MF parsing failed, no valid 3MF objects retrieved')
|
|
20
|
+
}
|
|
21
21
|
|
|
22
22
|
// get a list of objects to include in the results
|
|
23
23
|
const buildItems = []
|
package/src/parse.js
CHANGED
|
@@ -160,11 +160,10 @@ const getProperty = (object, triangle) => {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
const create3mfParser = (src, storage) => {
|
|
163
|
-
|
|
163
|
+
const { items, materials, colorgroups, objects } = storage
|
|
164
164
|
|
|
165
165
|
let model = null
|
|
166
166
|
let objLast = null // last object found
|
|
167
|
-
let objList = []
|
|
168
167
|
|
|
169
168
|
// create a parser for the XML
|
|
170
169
|
const parser = new saxes.SaxesParser()
|
|
@@ -272,10 +271,10 @@ const create3mfParser = (src, storage) => {
|
|
|
272
271
|
}
|
|
273
272
|
|
|
274
273
|
export const parse = (src) => {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
const items = [] // build items list
|
|
275
|
+
const materials = [] // materials list
|
|
276
|
+
const colorgroups = [] // colorgroups list
|
|
277
|
+
const objects = [] // objects list
|
|
279
278
|
|
|
280
279
|
create3mfParser(src, { items, materials, colorgroups, objects })
|
|
281
280
|
return { items, materials, colorgroups, objects }
|