@jscad/io 2.4.5 → 3.0.0-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 CHANGED
@@ -3,543 +3,320 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [2.4.5](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.4...@jscad/io@2.4.5) (2023-04-30)
7
-
8
- **Note:** Version bump only for package @jscad/io
6
+ # [3.0.0-alpha.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.3...@jscad/io@3.0.0-alpha.0) (2023-10-09)
9
7
 
8
+ ### Bug Fixes
10
9
 
10
+ * **io:** fix io after V3 refactoring ([7a12bbd](https://github.com/jscad/OpenJSCAD.org/commit/7a12bbdb7b4b3df792a4c5b3c8b30a6a985a48f0))
11
11
 
12
+ ### Features
12
13
 
14
+ * **3mf-deserializer:** initial version of 3MF deserializer and tests ([b22a27f](https://github.com/jscad/OpenJSCAD.org/commit/b22a27fa14c4f42b9160553cdd7b3c126ac72459))
15
+ * **cli:** reworked logic to use new io package exports and functions ([#1199](https://github.com/jscad/OpenJSCAD.org/issues/1199)) ([71a3d27](https://github.com/jscad/OpenJSCAD.org/commit/71a3d27a4cf416b1a9fea57a1fe40f5cfdaa905c))
16
+ * **modeling:** reworked exports to expose a flattened API ([8235238](https://github.com/jscad/OpenJSCAD.org/commit/8235238ad63d063f1e501478cae1208deb130a9c))
17
+ * **regl-renderer:** added rollup configuration to create ES6 bundle, adjusted imports and exports ([#1259](https://github.com/jscad/OpenJSCAD.org/issues/1259)) ([47a66bc](https://github.com/jscad/OpenJSCAD.org/commit/47a66bc07a137a748ce8571ea5d043ebaab9418d))
13
18
 
14
- ## [2.4.4](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.3...@jscad/io@2.4.4) (2022-11-26)
19
+ ## [2.4.6](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.5...@jscad/io@2.4.6) (2023-06-27)
15
20
 
16
21
  **Note:** Version bump only for package @jscad/io
17
22
 
23
+ ## [2.4.5](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.4...@jscad/io@2.4.5) (2023-04-30)
18
24
 
25
+ **Note:** Version bump only for package @jscad/io
19
26
 
27
+ ## [2.4.4](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.3...@jscad/io@2.4.4) (2022-11-26)
20
28
 
29
+ **Note:** Version bump only for package @jscad/io
21
30
 
22
31
  ## [2.4.3](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.2...@jscad/io@2.4.3) (2022-09-23)
23
32
 
24
33
  **Note:** Version bump only for package @jscad/io
25
34
 
26
-
27
-
28
-
29
-
30
35
  ## [2.4.2](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.1...@jscad/io@2.4.2) (2022-08-21)
31
36
 
32
37
  **Note:** Version bump only for package @jscad/io
33
38
 
34
-
35
-
36
-
37
-
38
39
  ## [2.4.1](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.4.0...@jscad/io@2.4.1) (2022-07-17)
39
40
 
40
41
  **Note:** Version bump only for package @jscad/io
41
42
 
42
-
43
-
44
-
45
-
46
43
  # [2.4.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.3.3...@jscad/io@2.4.0) (2022-06-12)
47
44
 
48
-
49
45
  ### Features
50
46
 
51
47
  * **x3d-serializer:** enhanced to convert 2D geometry and path to X3D Polyline2D ([#1091](https://github.com/jscad/OpenJSCAD.org/issues/1091)) ([4f763a8](https://github.com/jscad/OpenJSCAD.org/commit/4f763a8def39f3b0454f2079f3c1fd7da52dd880))
52
48
 
53
-
54
-
55
-
56
-
57
49
  ## [2.3.3](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.3.2...@jscad/io@2.3.3) (2022-05-15)
58
50
 
59
51
  **Note:** Version bump only for package @jscad/io
60
52
 
61
-
62
-
63
-
64
-
65
53
  ## [2.3.2](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.3.1...@jscad/io@2.3.2) (2022-04-24)
66
54
 
67
55
  **Note:** Version bump only for package @jscad/io
68
56
 
69
-
70
-
71
-
72
-
73
57
  ## [2.3.1](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.3.0...@jscad/io@2.3.1) (2022-04-03)
74
58
 
75
59
  **Note:** Version bump only for package @jscad/io
76
60
 
77
-
78
-
79
-
80
-
81
61
  # [2.3.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.2.6...@jscad/io@2.3.0) (2022-04-03)
82
62
 
83
-
84
63
  ### Features
85
64
 
86
65
  * **3mf-serializer:** new serializer from JSCAD geometry to 3MF packages ([6b51aed](https://github.com/jscad/OpenJSCAD.org/commit/6b51aed63ee40674822a04ced773564552689763))
87
66
 
88
-
89
-
90
-
91
-
92
67
  ## [2.2.6](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.2.5...@jscad/io@2.2.6) (2022-03-13)
93
68
 
94
69
  **Note:** Version bump only for package @jscad/io
95
70
 
96
-
97
-
98
-
99
-
100
71
  ## [2.2.5](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.2.4...@jscad/io@2.2.5) (2022-03-06)
101
72
 
102
73
  **Note:** Version bump only for package @jscad/io
103
74
 
104
-
105
-
106
-
107
-
108
75
  ## [2.2.4](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.2.3...@jscad/io@2.2.4) (2022-02-19)
109
76
 
110
77
  **Note:** Version bump only for package @jscad/io
111
78
 
112
-
113
-
114
-
115
-
116
79
  ## [2.2.3](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.2.2...@jscad/io@2.2.3) (2022-01-23)
117
80
 
118
81
  **Note:** Version bump only for package @jscad/io
119
82
 
120
-
121
-
122
-
123
-
124
83
  ## [2.2.2](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.2.1...@jscad/io@2.2.2) (2021-12-26)
125
84
 
126
85
  **Note:** Version bump only for package @jscad/io
127
86
 
128
-
129
-
130
-
131
-
132
87
  ## [2.2.1](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.2.0...@jscad/io@2.2.1) (2021-12-11)
133
88
 
134
89
  **Note:** Version bump only for package @jscad/io
135
90
 
136
-
137
-
138
-
139
-
140
91
  # [2.2.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.1.0...@jscad/io@2.2.0) (2021-11-07)
141
92
 
142
-
143
93
  ### Features
144
94
 
145
95
  * **io:** new serializer for OBJ ([#942](https://github.com/jscad/OpenJSCAD.org/issues/942)) ([baaae18](https://github.com/jscad/OpenJSCAD.org/commit/baaae18ad55252ec71b074bd85dea7d137a22eb8))
146
96
 
147
-
148
-
149
-
150
-
151
97
  # [2.1.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.9...@jscad/io@2.1.0) (2021-10-17)
152
98
 
153
-
154
99
  ### Features
155
100
 
156
101
  * **io:** added registration of x3d-deserializer ([57aee3f](https://github.com/jscad/OpenJSCAD.org/commit/57aee3fee0626e8dd13bd89ea4a6a5f3f108bd54))
157
102
 
158
-
159
-
160
-
161
-
162
103
  ## [2.0.9](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.8...@jscad/io@2.0.9) (2021-10-04)
163
104
 
164
105
  **Note:** Version bump only for package @jscad/io
165
106
 
166
-
167
-
168
-
169
-
170
107
  ## [2.0.8](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.7...@jscad/io@2.0.8) (2021-09-27)
171
108
 
172
109
  **Note:** Version bump only for package @jscad/io
173
110
 
174
-
175
-
176
-
177
-
178
111
  ## [2.0.7](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.6...@jscad/io@2.0.7) (2021-09-09)
179
112
 
180
113
  **Note:** Version bump only for package @jscad/io
181
114
 
182
-
183
-
184
-
185
-
186
115
  ## [2.0.6](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.5...@jscad/io@2.0.6) (2021-06-20)
187
116
 
188
117
  **Note:** Version bump only for package @jscad/io
189
118
 
190
-
191
-
192
-
193
-
194
119
  ## [2.0.5](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.4...@jscad/io@2.0.5) (2021-06-11)
195
120
 
196
-
197
121
  ### Bug Fixes
198
122
 
199
123
  * **io:** corrected assembly of serialization options in generateOutputData ([c57d8da](https://github.com/jscad/OpenJSCAD.org/commit/c57d8daa23db27992bc0c09137d1df51c2f039e8))
200
124
 
201
-
202
-
203
-
204
-
205
125
  ## [2.0.4](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.3...@jscad/io@2.0.4) (2021-06-01)
206
126
 
207
127
  **Note:** Version bump only for package @jscad/io
208
128
 
209
-
210
-
211
-
212
-
213
129
  ## [2.0.3](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.2...@jscad/io@2.0.3) (2021-04-20)
214
130
 
215
131
  **Note:** Version bump only for package @jscad/io
216
132
 
217
-
218
-
219
-
220
-
221
133
  ## [2.0.2](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.0...@jscad/io@2.0.2) (2021-04-17)
222
134
 
223
-
224
135
  ### Bug Fixes
225
136
 
226
137
  * **all:** fix json import ([#675](https://github.com/jscad/OpenJSCAD.org/issues/675)) ([05caf60](https://github.com/jscad/OpenJSCAD.org/commit/05caf60efc3f090313b3e0bddcc0b4f94de67c78))
227
138
  * **io:** io revisited ([#714](https://github.com/jscad/OpenJSCAD.org/issues/714)) ([22f04f1](https://github.com/jscad/OpenJSCAD.org/commit/22f04f1b2894a82e24952655875e73b74727bf86))
228
139
 
229
-
230
-
231
-
232
-
233
140
  ## [2.0.1](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.0...@jscad/io@2.0.1) (2021-04-15)
234
141
 
235
-
236
142
  ### Bug Fixes
237
143
 
238
144
  * **all:** fix json import ([#675](https://github.com/jscad/OpenJSCAD.org/issues/675)) ([05caf60](https://github.com/jscad/OpenJSCAD.org/commit/05caf60efc3f090313b3e0bddcc0b4f94de67c78))
239
145
  * **io:** io revisited ([#714](https://github.com/jscad/OpenJSCAD.org/issues/714)) ([22f04f1](https://github.com/jscad/OpenJSCAD.org/commit/22f04f1b2894a82e24952655875e73b74727bf86))
240
146
 
241
-
242
-
243
-
244
-
245
147
  # [2.0.0](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.13...@jscad/io@2.0.0) (2021-04-12)
246
148
 
247
149
  **Note:** Version bump only for package @jscad/io
248
150
 
249
-
250
-
251
-
252
-
253
151
  # [2.0.0-alpha.13](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.12...@jscad/io@2.0.0-alpha.13) (2021-03-07)
254
152
 
255
153
  **Note:** Version bump only for package @jscad/io
256
154
 
257
-
258
-
259
-
260
-
261
155
  # [2.0.0-alpha.12](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.11...@jscad/io@2.0.0-alpha.12) (2021-02-07)
262
156
 
263
157
  **Note:** Version bump only for package @jscad/io
264
158
 
265
-
266
-
267
-
268
-
269
159
  # [2.0.0-alpha.11](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.10...@jscad/io@2.0.0-alpha.11) (2021-01-02)
270
160
 
271
161
  **Note:** Version bump only for package @jscad/io
272
162
 
273
-
274
-
275
-
276
-
277
163
  # [2.0.0-alpha.10](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.9...@jscad/io@2.0.0-alpha.10) (2020-12-04)
278
164
 
279
165
  **Note:** Version bump only for package @jscad/io
280
166
 
281
-
282
-
283
-
284
-
285
167
  # [2.0.0-alpha.9](https://github.com/jscad/OpenJSCAD.org/compare/@jscad/io@2.0.0-alpha.8...@jscad/io@2.0.0-alpha.9) (2020-11-07)
286
168
 
287
-
288
169
  ### Bug Fixes
289
170
 
290
171
  * **io:** io revisited ([#714](https://github.com/jscad/OpenJSCAD.org/issues/714)) ([22f04f1](https://github.com/jscad/OpenJSCAD.org/commit/22f04f1b2894a82e24952655875e73b74727bf86))
291
172
 
292
-
293
-
294
-
295
-
296
173
  # [2.0.0-alpha.8](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.7...@jscad/io@2.0.0-alpha.8) (2020-10-24)
297
174
 
298
175
  **Note:** Version bump only for package @jscad/io
299
176
 
300
-
301
-
302
-
303
-
304
177
  # [2.0.0-alpha.7](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.6...@jscad/io@2.0.0-alpha.7) (2020-10-11)
305
178
 
306
179
  **Note:** Version bump only for package @jscad/io
307
180
 
308
-
309
-
310
-
311
-
312
181
  # [2.0.0-alpha.6](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.5...@jscad/io@2.0.0-alpha.6) (2020-09-29)
313
182
 
314
183
  **Note:** Version bump only for package @jscad/io
315
184
 
316
-
317
-
318
-
319
-
320
185
  # [2.0.0-alpha.5](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.4...@jscad/io@2.0.0-alpha.5) (2020-09-28)
321
186
 
322
187
  **Note:** Version bump only for package @jscad/io
323
188
 
324
-
325
-
326
-
327
-
328
189
  # [2.0.0-alpha.4](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.3...@jscad/io@2.0.0-alpha.4) (2020-09-19)
329
190
 
330
-
331
191
  ### Bug Fixes
332
192
 
333
193
  * **all:** fix json import ([#675](https://github.com/jscad/io/issues/675)) ([05caf60](https://github.com/jscad/io/commit/05caf60efc3f090313b3e0bddcc0b4f94de67c78))
334
194
 
335
-
336
-
337
-
338
-
339
195
  # [2.0.0-alpha.3](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.2...@jscad/io@2.0.0-alpha.3) (2020-09-08)
340
196
 
341
197
  **Note:** Version bump only for package @jscad/io
342
198
 
343
-
344
-
345
-
346
-
347
199
  # [2.0.0-alpha.2](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.1...@jscad/io@2.0.0-alpha.2) (2020-09-02)
348
200
 
349
201
  **Note:** Version bump only for package @jscad/io
350
202
 
351
-
352
-
353
-
354
-
355
203
  # [2.0.0-alpha.1](https://github.com/jscad/io/compare/@jscad/io@2.0.0-alpha.0...@jscad/io@2.0.0-alpha.1) (2020-08-19)
356
204
 
357
205
  **Note:** Version bump only for package @jscad/io
358
206
 
359
-
360
-
361
-
362
-
363
207
  # 2.0.0-alpha.0 (2020-08-13)
364
208
 
365
209
  ### Features
366
210
 
367
211
  * **io:** merge IO packages into main repository (#436)
368
212
 
369
-
370
-
371
-
372
-
373
213
  <a name="0.5.0"></a>
374
214
  # [0.5.0](https://github.com/jscad/io/compare/@jscad/io@0.4.8...@jscad/io@0.5.0) (2018-11-25)
375
215
 
376
-
377
216
  ### Features
378
217
 
379
218
  * **scad-deserializer:** added old openscad-openjscad-translator to the packages ([#75](https://github.com/jscad/io/issues/75)) ([0a20323](https://github.com/jscad/io/commit/0a20323))
380
219
 
381
-
382
-
383
-
384
220
  <a name="0.4.8"></a>
385
221
  ## [0.4.8](https://github.com/jscad/io/compare/@jscad/io@0.4.7...@jscad/io@0.4.8) (2018-11-22)
386
222
 
387
-
388
-
389
-
390
223
  **Note:** Version bump only for package @jscad/io
391
224
 
392
225
  <a name="0.4.7"></a>
393
226
  ## [0.4.7](https://github.com/jscad/io/compare/@jscad/io@0.4.6...@jscad/io@0.4.7) (2018-09-02)
394
227
 
395
-
396
-
397
-
398
228
  **Note:** Version bump only for package @jscad/io
399
229
 
400
230
  <a name="0.4.6"></a>
401
231
  ## [0.4.6](https://github.com/jscad/io/compare/@jscad/io@0.4.5...@jscad/io@0.4.6) (2018-06-11)
402
232
 
403
-
404
-
405
-
406
233
  **Note:** Version bump only for package @jscad/io
407
234
 
408
235
  <a name="0.4.5"></a>
409
236
  ## [0.4.5](https://github.com/jscad/io/compare/@jscad/io@0.4.4...@jscad/io@0.4.5) (2018-05-24)
410
237
 
411
-
412
-
413
-
414
238
  **Note:** Version bump only for package @jscad/io
415
239
 
416
240
  <a name="0.4.4"></a>
417
241
  ## [0.4.4](https://github.com/jscad/io/compare/@jscad/io@0.4.3...@jscad/io@0.4.4) (2018-04-07)
418
242
 
419
-
420
-
421
-
422
243
  **Note:** Version bump only for package @jscad/io
423
244
 
424
245
  <a name="0.4.3"></a>
425
246
  ## [0.4.3](https://github.com/jscad/io/compare/@jscad/io@0.4.2...@jscad/io@0.4.3) (2018-04-01)
426
247
 
427
-
428
-
429
-
430
248
  **Note:** Version bump only for package @jscad/io
431
249
 
432
250
  <a name="0.4.2"></a>
433
251
  ## [0.4.2](https://github.com/jscad/io/compare/@jscad/io@0.4.1...@jscad/io@0.4.2) (2018-04-01)
434
252
 
435
-
436
-
437
-
438
253
  **Note:** Version bump only for package @jscad/io
439
254
 
440
255
  <a name="0.4.1"></a>
441
256
  ## [0.4.1](https://github.com/jscad/io/compare/@jscad/io@0.4.0...@jscad/io@0.4.1) (2018-03-15)
442
257
 
443
-
444
-
445
-
446
258
  **Note:** Version bump only for package @jscad/io
447
259
 
448
260
  <a name="0.4.0"></a>
449
261
  # [0.4.0](https://github.com/jscad/io/compare/@jscad/io@0.3.12...@jscad/io@0.4.0) (2018-02-24)
450
262
 
451
-
452
263
  ### Features
453
264
 
454
265
  * **DXF Deserializer:** Adds dxf deserializer and all associated code ([ae4a6c0](https://github.com/jscad/io/commit/ae4a6c0)), closes [#10](https://github.com/jscad/io/issues/10)
455
266
 
456
-
457
-
458
-
459
267
  <a name="0.3.12"></a>
460
268
  ## [0.3.12](https://github.com/jscad/io/compare/@jscad/io@0.3.11...@jscad/io@0.3.12) (2017-12-14)
461
269
 
462
-
463
-
464
-
465
270
  **Note:** Version bump only for package @jscad/io
466
271
 
467
272
  <a name="0.3.11"></a>
468
273
  ## [0.3.11](https://github.com/jscad/io/compare/@jscad/io@0.3.10...@jscad/io@0.3.11) (2017-12-14)
469
274
 
470
-
471
-
472
-
473
275
  **Note:** Version bump only for package @jscad/io
474
276
 
475
277
  <a name="0.3.10"></a>
476
278
  ## [0.3.10](https://github.com/jscad/io/compare/@jscad/io@0.3.9...@jscad/io@0.3.10) (2017-11-29)
477
279
 
478
-
479
-
480
-
481
280
  **Note:** Version bump only for package @jscad/io
482
281
 
483
282
  <a name="0.3.9"></a>
484
283
  ## [0.3.9](https://github.com/jscad/io/compare/@jscad/io@0.3.8...@jscad/io@0.3.9) (2017-11-20)
485
284
 
486
-
487
-
488
-
489
285
  **Note:** Version bump only for package @jscad/io
490
286
 
491
287
  <a name="0.3.8"></a>
492
288
  ## [0.3.8](https://github.com/jscad/io/compare/@jscad/io@0.3.7...@jscad/io@0.3.8) (2017-11-14)
493
289
 
494
-
495
-
496
-
497
290
  **Note:** Version bump only for package @jscad/io
498
291
 
499
292
  <a name="0.3.7"></a>
500
293
  ## [0.3.7](https://github.com/jscad/io/compare/@jscad/io@0.3.6...@jscad/io@0.3.7) (2017-11-04)
501
294
 
502
-
503
-
504
-
505
295
  **Note:** Version bump only for package @jscad/io
506
296
 
507
297
  <a name="0.3.6"></a>
508
298
  ## [0.3.6](https://github.com/jscad/io/compare/@jscad/io@0.3.5...@jscad/io@0.3.6) (2017-11-04)
509
299
 
510
-
511
-
512
-
513
300
  **Note:** Version bump only for package @jscad/io
514
301
 
515
302
  <a name="0.3.5"></a>
516
303
  ## [0.3.5](https://github.com/jscad/io/compare/@jscad/io@0.3.4...@jscad/io@0.3.5) (2017-10-30)
517
304
 
518
-
519
-
520
-
521
305
  **Note:** Version bump only for package @jscad/io
522
306
 
523
307
  <a name="0.3.4"></a>
524
308
  ## [0.3.4](https://github.com/jscad/io/compare/@jscad/io@0.3.3...@jscad/io@0.3.4) (2017-10-15)
525
309
 
526
-
527
-
528
-
529
310
  **Note:** Version bump only for package @jscad/io
530
311
 
531
312
  <a name="0.3.3"></a>
532
313
  ## [0.3.3](https://github.com/jscad/io/compare/@jscad/io@0.3.2...@jscad/io@0.3.3) (2017-10-10)
533
314
 
534
-
535
-
536
-
537
315
  **Note:** Version bump only for package @jscad/io
538
316
 
539
317
  <a name="0.3.2"></a>
540
318
  ## 0.3.2 (2017-10-10)
541
319
 
542
-
543
320
  ### Bug Fixes
544
321
 
545
322
  * **io:** fixed bad version numbers for svg de/serializers ([#28](https://github.com/jscad/io/issues/28)) ([60d239c](https://github.com/jscad/io/commit/60d239c))
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  [![License](https://img.shields.io/github/license/jscad/OpenJSCAD.org)](https://github.com/jscad/OpenJSCAD.org/blob/master/LICENSE)
10
10
 
11
11
  [![User Group](https://img.shields.io/badge/maintained%20by-user%20group-blue)](https://openjscad.nodebb.com/)
12
- [![Lerna](https://img.shields.io/badge/maintained%20with-lerna-blue)](https://lerna.js.org/)
12
+ [![lerna--lite](https://img.shields.io/badge/maintained%20with-lerna--lite-e137ff)](https://github.com/ghiscoding/lerna-lite)
13
13
  [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-blue)](https://standardjs.com)
14
14
 
15
15
  [![Backers](https://img.shields.io/opencollective/backers/openjscad)](https://opencollective.com/openjscad)
@@ -26,20 +26,19 @@ This package is a metapackage and includes all the input/output format handling
26
26
  ie: file data => JSCAD code or JSCAD geometry
27
27
 
28
28
  Following formats are supported as inputs
29
- - [AMF](../amf-deserializer)
30
29
  - [DXF](../dxf-deserializer)
31
30
  - [JSON](../json-deserializer)
32
31
  - [OBJ](../obj-deserializer)
33
32
  - [STL (binary, ASCII)](../stl-deserializer)
34
33
  - [SVG](../svg-deserializer)
35
34
  - [X3D](../x3d-deserializer)
35
+ - [3MF](../3mf-deserializer)
36
36
 
37
37
  ### Outputs/ Serializers
38
38
 
39
39
  ie: geometry => blob
40
40
 
41
41
  Following formats are supported as outputs
42
- - [AMF](../amf-serializer)
43
42
  - [DXF](../dxf-serializer)
44
43
  - [JSON](../json-serializer)
45
44
  - [OBJ](../obj-serializer)
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@jscad/io",
3
- "version": "2.4.5",
3
+ "version": "3.0.0-alpha.0",
4
4
  "description": "Meta Package for JSCAD IO Packages",
5
5
  "homepage": "https://openjscad.xyz/",
6
6
  "repository": "https://github.com/jscad/OpenJSCAD.org",
7
- "main": "index.js",
8
- "scripts": {},
7
+ "main": "src/index.js",
8
+ "type": "module",
9
+ "scripts": {
10
+ "coverage": "c8 --all --reporter=html --reporter=text npm test",
11
+ "test": "ava --verbose --timeout 2m './tests/*.test.js'"
12
+ },
9
13
  "contributors": [
10
14
  {
11
15
  "name": "Rene K. Mueller",
12
- "url": "http://renekmueller.com"
16
+ "url": "https://github.com/Spiritdude"
13
17
  },
14
18
  {
15
19
  "name": "z3dev",
@@ -17,7 +21,7 @@
17
21
  },
18
22
  {
19
23
  "name": "Mark 'kaosat-dev' Moissette",
20
- "url": "http://kaosat.net"
24
+ "url": "https://github.com/kaosat-dev"
21
25
  }
22
26
  ],
23
27
  "keywords": [
@@ -30,24 +34,27 @@
30
34
  ],
31
35
  "license": "MIT",
32
36
  "dependencies": {
33
- "@jscad/3mf-serializer": "2.1.8",
34
- "@jscad/amf-deserializer": "2.3.4",
35
- "@jscad/amf-serializer": "2.1.14",
36
- "@jscad/array-utils": "2.1.4",
37
- "@jscad/dxf-deserializer": "2.3.21",
38
- "@jscad/dxf-serializer": "2.1.14",
39
- "@jscad/io-utils": "2.0.24",
40
- "@jscad/json-deserializer": "2.0.25",
41
- "@jscad/json-serializer": "2.0.24",
42
- "@jscad/modeling": "2.11.1",
43
- "@jscad/obj-deserializer": "2.0.24",
44
- "@jscad/obj-serializer": "2.1.14",
45
- "@jscad/stl-deserializer": "2.1.21",
46
- "@jscad/stl-serializer": "2.1.14",
47
- "@jscad/svg-deserializer": "2.5.5",
48
- "@jscad/svg-serializer": "2.3.12",
49
- "@jscad/x3d-deserializer": "2.2.4",
50
- "@jscad/x3d-serializer": "2.4.4"
37
+ "@jscad/3mf-deserializer": "3.0.0-alpha.0",
38
+ "@jscad/3mf-serializer": "3.0.0-alpha.0",
39
+ "@jscad/array-utils": "3.0.0-alpha.0",
40
+ "@jscad/dxf-deserializer": "3.0.0-alpha.0",
41
+ "@jscad/dxf-serializer": "3.0.0-alpha.0",
42
+ "@jscad/io-utils": "3.0.0-alpha.0",
43
+ "@jscad/json-deserializer": "3.0.0-alpha.0",
44
+ "@jscad/json-serializer": "3.0.0-alpha.0",
45
+ "@jscad/modeling": "3.0.0-alpha.0",
46
+ "@jscad/obj-deserializer": "3.0.0-alpha.0",
47
+ "@jscad/obj-serializer": "3.0.0-alpha.0",
48
+ "@jscad/stl-deserializer": "3.0.0-alpha.0",
49
+ "@jscad/stl-serializer": "3.0.0-alpha.0",
50
+ "@jscad/svg-deserializer": "3.0.0-alpha.0",
51
+ "@jscad/svg-serializer": "3.0.0-alpha.0",
52
+ "@jscad/x3d-deserializer": "3.0.0-alpha.0",
53
+ "@jscad/x3d-serializer": "3.0.0-alpha.0"
54
+ },
55
+ "devDependencies": {
56
+ "ava": "^4.3.3",
57
+ "c8": "^8.0.0"
51
58
  },
52
- "gitHead": "4313974b50957018d2edd010e3a251f59bea46a4"
59
+ "gitHead": "3656d36ed9cd738ab884e86aae5a2ce08d52adf7"
53
60
  }
@@ -0,0 +1,61 @@
1
+ import { deserializers } from './deserializers.js'
2
+
3
+ /*
4
+ * Transform the source into ES6 javascript
5
+ */
6
+
7
+ // no transform required, just pass through the source
8
+ const nullTransform = (options, source) => source
9
+
10
+ // TODO : how to transform CommonJS code?
11
+ const transformers = {
12
+ 'application/javascript': nullTransform
13
+ }
14
+
15
+ /**
16
+ * Deserialize the given source as per the given mimeType.
17
+ * Options can be provided to over-ride or suppliment the defaults used during deserialization.
18
+ * Options must include 'output' as either 'script' or 'geometry'.
19
+ * @param {Object} options - options used during deserializing
20
+ * @param {String} mimeType - MIME type of the file
21
+ * @param {String} source - the contents of the file
22
+ * @return {[objects]|string} a list of objects (geometry) or a string (script)
23
+ *
24
+ * @example
25
+ * const mimetype = getMimeType('svg')
26
+ * const myobjects = deserialize({output: 'geometry', target: 'path2'}, mimetype, source)
27
+ */
28
+ export const deserialize = (options, mimeType, source) => {
29
+ // commonly used defaults from the deserializers
30
+ const defaults = {
31
+ addMetaData: true,
32
+ segments: 32
33
+ }
34
+ options = Object.assign({}, defaults, options)
35
+
36
+ if (options.output) {
37
+ if (options.output === 'script') {
38
+ // transform souce code if possible
39
+ if (mimeType in transformers) {
40
+ const transformer = transformers[mimeType]
41
+ return transformer(options, source)
42
+ }
43
+ // deserialize know formats if possible
44
+ if (mimeType in deserializers) {
45
+ const deserializer = deserializers[mimeType]
46
+ return deserializer(options, source)
47
+ }
48
+ throw new Error(`Unknown mime type (${mimeType})`)
49
+ }
50
+
51
+ if (options.output === 'geometry') {
52
+ // deserialize know formats if possible
53
+ if (mimeType in deserializers) {
54
+ const deserializer = deserializers[mimeType]
55
+ return deserializer(options, source)
56
+ }
57
+ throw new Error(`Unknown mime type (${mimeType})`)
58
+ }
59
+ }
60
+ throw new Error(`Unknown output option (${options.output}), only 'script' or 'geometry' allowed`)
61
+ }
@@ -0,0 +1,16 @@
1
+ import * as mf3DeSerializer from '@jscad/3mf-deserializer'
2
+ import * as dxfDeSerializer from '@jscad/dxf-deserializer'
3
+ import * as jsonDeSerializer from '@jscad/json-deserializer'
4
+ import * as objDeSerializer from '@jscad/obj-deserializer'
5
+ import * as stlDeSerializer from '@jscad/stl-deserializer'
6
+ import * as svgDeSerializer from '@jscad/svg-deserializer'
7
+ import * as x3dDeSerializer from '@jscad/x3d-deserializer'
8
+
9
+ export const deserializers = {}
10
+ deserializers[mf3DeSerializer.mimeType] = mf3DeSerializer.deserialize
11
+ deserializers[dxfDeSerializer.mimeType] = dxfDeSerializer.deserialize
12
+ deserializers[jsonDeSerializer.mimeType] = jsonDeSerializer.deserialize
13
+ deserializers[objDeSerializer.mimeType] = objDeSerializer.deserialize
14
+ deserializers[stlDeSerializer.mimeType] = stlDeSerializer.deserialize
15
+ deserializers[svgDeSerializer.mimeType] = svgDeSerializer.deserialize
16
+ deserializers[x3dDeSerializer.mimeType] = x3dDeSerializer.deserialize
@@ -1,13 +1,14 @@
1
- const { geometries } = require('@jscad/modeling')
1
+ import { geom2, geom3, path2 } from '@jscad/modeling'
2
2
 
3
3
  // handled format descriptions
4
- // note: order is important as regular expressions are created from extentions
5
- const formats = {
4
+ // note: order is important as regular expressions are created from extensions
5
+ // see https://www.iana.org/assignments/media-types/media-types.xhtml
6
+ export const supportedFormats = {
6
7
  stl: {
7
8
  displayName: 'STL (Binary)',
8
9
  description: 'STereoLithography, Binary',
9
10
  extension: 'stl',
10
- mimetype: 'application/sla',
11
+ mimetype: 'model/stl',
11
12
  deserializable: true,
12
13
  convertGeom3: false,
13
14
  convertGeom2: false
@@ -16,7 +17,7 @@ const formats = {
16
17
  displayName: 'STL (ASCII)',
17
18
  description: 'STereoLithography, ASCII',
18
19
  extension: 'stl',
19
- mimetype: 'application/sla',
20
+ mimetype: 'model/stl',
20
21
  deserializable: false, // just once
21
22
  convertGeom3: true,
22
23
  convertGeom2: false
@@ -25,25 +26,16 @@ const formats = {
25
26
  displayName: 'STL (Binary)',
26
27
  description: 'STereoLithography, Binary',
27
28
  extension: 'stl',
28
- mimetype: 'application/sla',
29
+ mimetype: 'model/stl',
29
30
  deserializable: false, // just once
30
31
  convertGeom3: true,
31
32
  convertGeom2: false
32
33
  },
33
- amf: {
34
- displayName: 'AMF (experimental)',
35
- description: 'Additive Manufacturing File Format',
36
- extension: 'amf',
37
- mimetype: 'application/amf+xml',
38
- deserializable: true,
39
- convertGeom3: true,
40
- convertGeom2: false
41
- },
42
34
  dxf: {
43
35
  displayName: 'DXF (ASCII)',
44
36
  description: 'AutoCAD Drawing Exchange Format',
45
37
  extension: 'dxf',
46
- mimetype: 'application/dxf',
38
+ mimetype: 'image/vnd.dxf',
47
39
  deserializable: true,
48
40
  convertGeom3: true,
49
41
  convertGeom2: true
@@ -79,7 +71,7 @@ const formats = {
79
71
  displayName: 'OBJ',
80
72
  description: 'Wavefront OBJ File',
81
73
  extension: 'obj',
82
- mimetype: 'text/plain',
74
+ mimetype: 'model/obj',
83
75
  deserializable: true,
84
76
  convertGeom3: true,
85
77
  convertGeom2: false
@@ -107,42 +99,26 @@ const formats = {
107
99
  description: '3D Manufacturing Format',
108
100
  extension: '3mf',
109
101
  mimetype: 'model/3mf',
110
- deserializable: false,
102
+ deserializable: true,
111
103
  convertGeom3: true,
112
104
  convertGeom2: false
113
105
  }
114
106
  }
115
107
 
116
- // handled input formats that can be converted to jscad code
117
- const conversionFormats = [
118
- // 3D file formats
119
- 'amf',
120
- 'js',
121
- 'jscad',
122
- 'obj',
123
- 'scad',
124
- 'stl',
125
- 'dxf',
126
- // 2D file formats
127
- 'svg',
128
- 'ttf',
129
- 'woff'
130
- ]
131
-
132
- const supportedFormatsForObjects = (objects) => {
108
+ export const supportedFormatsForObjects = (objects) => {
133
109
  const objectFormats = []
134
110
  let found3Dsolid = false
135
111
  let found2Dsolid = false
136
112
  for (let i = 0; i < objects.length; i++) {
137
- if (geometries.geom3.isA(objects[i])) { found3Dsolid = true }
138
- if (geometries.geom2.isA(objects[i]) || geometries.path2.isA(objects[i])) { found2Dsolid = true }
113
+ if (geom3.isA(objects[i])) { found3Dsolid = true }
114
+ if (geom2.isA(objects[i]) || path2.isA(objects[i])) { found2Dsolid = true }
139
115
  }
140
- for (const format in formats) {
141
- if (found3Dsolid && formats[format].convertGeom3 === true) {
116
+ for (const format in supportedFormats) {
117
+ if (found3Dsolid && supportedFormats[format].convertGeom3 === true) {
142
118
  objectFormats[objectFormats.length] = format
143
119
  continue // only add once
144
120
  }
145
- if (found2Dsolid && formats[format].convertGeom2 === true) {
121
+ if (found2Dsolid && supportedFormats[format].convertGeom2 === true) {
146
122
  objectFormats[objectFormats.length] = format
147
123
  }
148
124
  }
@@ -150,12 +126,12 @@ const supportedFormatsForObjects = (objects) => {
150
126
  }
151
127
 
152
128
  // Return a list of extensions as used by the serializers
153
- const supportedOutputExtensions = () => {
129
+ export const supportedOutputExtensions = () => {
154
130
  const supported = []
155
- for (const format in formats) {
156
- if (formats[format].convertGeom3 === true || formats[format].convertGeom2 === true) {
157
- if (supported.indexOf(formats[format].extension) < 0) {
158
- supported.push(formats[format].extension)
131
+ for (const format in supportedFormats) {
132
+ if (supportedFormats[format].convertGeom3 === true || supportedFormats[format].convertGeom2 === true) {
133
+ if (supported.indexOf(supportedFormats[format].extension) < 0) {
134
+ supported.push(supportedFormats[format].extension)
159
135
  }
160
136
  }
161
137
  }
@@ -163,10 +139,10 @@ const supportedOutputExtensions = () => {
163
139
  }
164
140
 
165
141
  // Return a list of formats as used by the serializers
166
- const supportedOutputFormats = () => {
142
+ export const supportedOutputFormats = () => {
167
143
  const supported = []
168
- for (const format in formats) {
169
- if (formats[format].convertGeom3 === true || formats[format].convertGeom2 === true) {
144
+ for (const format in supportedFormats) {
145
+ if (supportedFormats[format].convertGeom3 === true || supportedFormats[format].convertGeom2 === true) {
170
146
  supported.push(format)
171
147
  }
172
148
  }
@@ -175,21 +151,29 @@ const supportedOutputFormats = () => {
175
151
 
176
152
  // Return a list of file extensions as used by the deserializers
177
153
  // See also code-loading/transfromSources.js
178
- const supportedInputExtensions = () => {
154
+ export const supportedInputExtensions = () => {
179
155
  const supported = []
180
- for (const format in formats) {
181
- if (formats[format].deserializable === true) {
182
- supported.push(formats[format].extension)
156
+ for (const format in supportedFormats) {
157
+ if (supportedFormats[format].deserializable === true) {
158
+ supported.push(supportedFormats[format].extension)
183
159
  }
184
160
  }
185
161
  return supported
186
162
  }
187
163
 
188
- module.exports = {
189
- formats,
190
- conversionFormats,
191
- supportedInputExtensions,
192
- supportedOutputExtensions,
193
- supportedOutputFormats,
194
- supportedFormatsForObjects
164
+ export const getMimeType = (extension) => {
165
+ for (const format in supportedFormats) {
166
+ const meta = supportedFormats[format]
167
+ if (meta.extension === extension) return meta.mimetype
168
+ if (format === extension) return meta.mimetype
169
+ }
170
+ return null
171
+ }
172
+
173
+ export const getExtension = (mimeType) => {
174
+ for (const format in supportedFormats) {
175
+ const meta = supportedFormats[format]
176
+ if (meta.mimetype === mimeType) return meta.extension
177
+ }
178
+ return null
195
179
  }
package/src/index.js ADDED
@@ -0,0 +1,14 @@
1
+ export { deserialize } from './deserialize.js'
2
+ export { deserializers } from './deserializers.js'
3
+
4
+ export { serialize } from './serialize.js'
5
+ export { serializers } from './serializers.js'
6
+
7
+ export {
8
+ supportedFormats,
9
+ getMimeType,
10
+ supportedInputExtensions,
11
+ supportedOutputExtensions,
12
+ supportedOutputFormats,
13
+ supportedFormatsForObjects
14
+ } from './formats.js'
@@ -1,16 +1,17 @@
1
+ import { toArray } from '@jscad/array-utils'
1
2
 
2
- const { toArray } = require('@jscad/array-utils')
3
- const { formats } = require('./formats')
4
- const amfSerializer = require('@jscad/amf-serializer')
5
- const dxfSerializer = require('@jscad/dxf-serializer')
6
- const jsonSerializer = require('@jscad/json-serializer')
7
- const objSerializer = require('@jscad/obj-serializer')
8
- const stlSerializer = require('@jscad/stl-serializer')
9
- const svgSerializer = require('@jscad/svg-serializer')
10
- const x3dSerializer = require('@jscad/x3d-serializer')
11
- const m3fSerializer = require('@jscad/3mf-serializer') // UG javascript doesn't allow names with leading #
3
+ import * as amfSerializer from '@jscad/amf-serializer'
4
+ import * as dxfSerializer from '@jscad/dxf-serializer'
5
+ import * as jsonSerializer from '@jscad/json-serializer'
6
+ import * as objSerializer from '@jscad/obj-serializer'
7
+ import * as stlSerializer from '@jscad/stl-serializer'
8
+ import * as svgSerializer from '@jscad/svg-serializer'
9
+ import * as x3dSerializer from '@jscad/x3d-serializer'
10
+ import * as m3fSerializer from '@jscad/3mf-serializer' // UG javascript doesn't allow names with leading #
12
11
 
13
- const prepareOutput = (objects, params) => {
12
+ import { supportedFormats } from './formats.js'
13
+
14
+ export const prepareOutput = (objects, params) => {
14
15
  const defaults = {
15
16
  format: undefined,
16
17
  version: '0.0.0'
@@ -38,11 +39,11 @@ const prepareOutput = (objects, params) => {
38
39
  '3mf': m3fSerializer, // Geom3 to 3MF
39
40
  json: jsonSerializer, // Geom3 or Geom2 to JSON
40
41
  js: {
41
- mimeType: formats.js.mimetype,
42
+ mimeType: supportedFormats.js.mimetype,
42
43
  serialize: (options, objects) => toArray(objects) // js , pass through
43
44
  },
44
45
  jscad: {
45
- mimeType: formats.jscad.mimetype,
46
+ mimeType: supportedFormats.jscad.mimetype,
46
47
  serialize: (options, objects) => toArray(objects) // jscad , pass through
47
48
  },
48
49
  undefined: () => {
@@ -54,5 +55,3 @@ const prepareOutput = (objects, params) => {
54
55
  const mimeType = outputFormatHandlers[format].mimeType
55
56
  return { data, mimeType }
56
57
  }
57
-
58
- module.exports = prepareOutput
@@ -0,0 +1,35 @@
1
+ import { flatten } from '@jscad/array-utils'
2
+
3
+ import { serializers } from './serializers.js'
4
+
5
+ /**
6
+ * Serialize the given objects as per the given mimeType into the external format.
7
+ * Options can be provided to over-ride or suppliment the defaults used during serialization.
8
+ * See each serializer package for available options.
9
+ * @param {Object} options - options used during deserializing
10
+ * @param {String} mimeType - MIME type of the file
11
+ * @param {Object} objects - one or more objects of which to serialize
12
+ * @return {Object} an object containing the serialize data as well as mime type
13
+ *
14
+ * @example
15
+ * const mimetype = getMimeType('svg')
16
+ * const shapes = [primitives.cirlce(), primitives.star()]
17
+ * const output = serialize({units: 'inches'}, mimetype, shapes)
18
+ */
19
+ export const serialize = (options, mimeType, ...objects) => {
20
+ const defaults = {
21
+ unit: 'mm',
22
+ statusCallback: null
23
+ }
24
+ options = Object.assign({}, defaults, options)
25
+
26
+ objects = flatten(objects)
27
+
28
+ if (mimeType in serializers) {
29
+ const serializer = serializers[mimeType]
30
+ const data = serializer(options, ...objects)
31
+ return { data, mimeType }
32
+ } else {
33
+ throw new Error(`Unknown mime type (${mimeType})`)
34
+ }
35
+ }
@@ -0,0 +1,21 @@
1
+ import * as mf3Serializer from '@jscad/3mf-serializer'
2
+ import * as dxfSerializer from '@jscad/dxf-serializer'
3
+ import * as jsonSerializer from '@jscad/json-serializer'
4
+ import * as objSerializer from '@jscad/obj-serializer'
5
+ import * as stlSerializer from '@jscad/stl-serializer'
6
+ import * as svgSerializer from '@jscad/svg-serializer'
7
+ import * as x3dSerializer from '@jscad/x3d-serializer'
8
+
9
+ // default serializer
10
+ const defaultSerialize = (options, ...objects) => objects
11
+
12
+ export const serializers = {}
13
+ serializers[mf3Serializer.mimeType] = mf3Serializer.serialize
14
+ serializers[dxfSerializer.mimeType] = dxfSerializer.serialize
15
+ serializers[jsonSerializer.mimeType] = jsonSerializer.serialize
16
+ serializers[objSerializer.mimeType] = objSerializer.serialize
17
+ serializers[stlSerializer.mimeType] = stlSerializer.serialize
18
+ serializers[svgSerializer.mimeType] = svgSerializer.serialize
19
+ serializers[x3dSerializer.mimeType] = x3dSerializer.serialize
20
+
21
+ serializers['application/javascript'] = defaultSerialize
@@ -0,0 +1,45 @@
1
+ import test from 'ava'
2
+
3
+ import { countOf } from '../../test/helpers/countOf.js'
4
+
5
+ import { deserialize, getMimeType } from '../src/index.js'
6
+
7
+ test('deserialize svg (simple) to objects', (t) => {
8
+ const mimeType = 'image/svg+xml'
9
+ const objects = deserialize({ output: 'geometry' }, mimeType, source1)
10
+ const expected1 = [{
11
+ isClosed: false,
12
+ points: [[3, -3], [4, -2], [0, 0]],
13
+ transforms: [
14
+ 1, 0, 0, 0,
15
+ 0, 1, 0, 0,
16
+ 0, 0, 1, 0,
17
+ 0, 0, 0, 1
18
+ ]
19
+ }]
20
+ t.deepEqual(expected1, objects)
21
+ })
22
+
23
+ test('deserialize svg (simple) to script', (t) => {
24
+ const mimeType = getMimeType('svg')
25
+ const script = deserialize({ output: 'script', addMetaData: false }, mimeType, source1)
26
+ t.is(countOf('main(params)', script), 1)
27
+ t.is(countOf('path2', script), 3)
28
+ })
29
+
30
+ const source1 = `<?xml version="1.0" encoding="UTF-8"?>
31
+ <!-- Created by JSCAD SVG Serializer -->
32
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
33
+ <svg width="4mm" height="3mm" viewBox="0 0 4 3" fill="none" fill-rule="evenodd" stroke-width="0.1px" version="1.1" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
34
+ <g>
35
+ <path d="M3 3L4 2L0 0"/>
36
+ </g>
37
+ </svg>
38
+ `
39
+
40
+ test('deserialize JS code to JS code', (t) => {
41
+ const mimeType = 'application/javascript'
42
+ const code = 'const a - 1;'
43
+ const script = deserialize({ output: 'script', addMetaData: false }, mimeType, code)
44
+ t.deepEqual(script, code)
45
+ })
@@ -0,0 +1,37 @@
1
+ import test from 'ava'
2
+
3
+ import { line } from '@jscad/modeling'
4
+
5
+ import { serialize } from '../src/index.js'
6
+
7
+ test('serialize 2D path (simple) objects to svg', (t) => {
8
+ const mimeType = 'image/svg+xml'
9
+ // simple open path
10
+ const object1 = line([[0, 0], [1, 1], [-3, 3]])
11
+ const observed = serialize({}, mimeType, object1)
12
+ t.deepEqual(observed, expected1)
13
+ })
14
+
15
+ const expected1 = {
16
+ data: [`<?xml version="1.0" encoding="UTF-8"?>
17
+ <!-- Created by JSCAD SVG Serializer -->
18
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
19
+ <svg width="4mm" height="3mm" viewBox="0 0 4 3" fill="none" fill-rule="evenodd" stroke-width="0.1px" version="1.1" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
20
+ <g>
21
+ <path d="M3 3L4 2L0 0"/>
22
+ </g>
23
+ </svg>
24
+ `],
25
+ mimeType: 'image/svg+xml'
26
+ }
27
+
28
+ test('serialize JS code to JS code', (t) => {
29
+ const mimeType = 'application/javascript'
30
+ const code = 'const a - 1;'
31
+ const observed = serialize({}, mimeType, code)
32
+ const expected = {
33
+ data: [code],
34
+ mimeType: 'application/javascript'
35
+ }
36
+ t.deepEqual(observed, expected)
37
+ })
package/deserializers.js DELETED
@@ -1,19 +0,0 @@
1
- const amfDeSerializer = require('@jscad/amf-deserializer')
2
- const dxfDeSerializer = require('@jscad/dxf-deserializer')
3
- const jsonDeSerializer = require('@jscad/json-deserializer')
4
- const objDeSerializer = require('@jscad/obj-deserializer')
5
- // const scadDeSerializer = require('@jscad/scad-deserializer') //FIXME: upgrade, fix before re-enabling
6
- const stlDeSerializer = require('@jscad/stl-deserializer')
7
- const svgDeSerializer = require('@jscad/svg-deserializer')
8
- const x3dDeSerializer = require('@jscad/x3d-deserializer')
9
-
10
- const deserializers = {}
11
- deserializers[amfDeSerializer.extension] = amfDeSerializer.deserialize
12
- deserializers[dxfDeSerializer.extension] = dxfDeSerializer.deserialize
13
- deserializers[jsonDeSerializer.extension] = jsonDeSerializer.deserialize
14
- deserializers[objDeSerializer.extension] = objDeSerializer.deserialize
15
- deserializers[stlDeSerializer.extension] = stlDeSerializer.deserialize
16
- deserializers[svgDeSerializer.extension] = svgDeSerializer.deserialize
17
- deserializers[x3dDeSerializer.extension] = x3dDeSerializer.deserialize
18
-
19
- module.exports = deserializers
package/index.js DELETED
@@ -1,31 +0,0 @@
1
- const { makeBlob, convertToBlob } = require('@jscad/io-utils')
2
-
3
- const amfSerializer = require('@jscad/amf-serializer')
4
- const dxfSerializer = require('@jscad/dxf-serializer')
5
- const jsonSerializer = require('@jscad/json-serializer')
6
- const objSerializer = require('@jscad/obj-serializer')
7
- const stlSerializer = require('@jscad/stl-serializer')
8
- const svgSerializer = require('@jscad/svg-serializer')
9
- const x3dSerializer = require('@jscad/x3d-serializer')
10
- const m3fSerializer = require('@jscad/3mf-serializer')
11
-
12
- const prepareOutput = require('./prepareOutput')
13
- const deserializers = require('./deserializers')
14
-
15
- const solidsAsBlob = (solids, params) => convertToBlob(prepareOutput(solids, params))
16
-
17
- module.exports = {
18
- makeBlob,
19
- solidsAsBlob,
20
-
21
- amfSerializer,
22
- dxfSerializer,
23
- jsonSerializer,
24
- objSerializer,
25
- stlSerializer,
26
- svgSerializer,
27
- x3dSerializer,
28
- m3fSerializer, // UG javascript doesn't allow names with leading digit
29
-
30
- deserializers
31
- }