@mlightcad/dxf-json-converter 1.9.0 → 1.9.1

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 mlightcad
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mlightcad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,56 +1,59 @@
1
- # @mlightcad/dxf-json-converter
2
-
3
- The `dxf-json-converter` package provides a DXF file converter for the RealDWG-Web ecosystem, enabling reading and conversion of DXF files into the AutoCAD-like drawing database structure. It is based on [@mlightcad/dxf-json](https://www.npmjs.com/package/@mlightcad/dxf-json).
4
-
5
- ## Overview
6
-
7
- This package implements a DXF file converter compatible with the RealDWG-Web data model. It allows you to register DXF file support in your application and convert DXF files into the in-memory drawing database.
8
-
9
- DXF parsing is provided through a dedicated Web Worker bundle (`dxf-parser-worker.js`). **This converter is intended for Web Worker use only.** That restriction is not because parsing cannot run on the main thread in principle; it is a deliberate licensing choice. `@mlightcad/dxf-json` is GPL-3.0, and loading it in a separate worker bundle helps keep copyleft parser code apart from the main MIT-licensed application so license obligations are easier to manage.
10
-
11
- ## Key Features
12
-
13
- - **DXF File Support**: Read and convert DXF files to the drawing database
14
- - **Worker-based Parsing**: Required by design for GPL license isolation
15
- - **Integration**: Designed to work with the RealDWG-Web data model and converter manager
16
-
17
- ## Installation
18
-
19
- ```bash
20
- npm install @mlightcad/dxf-json-converter
21
- ```
22
-
23
- > **Peer dependencies:**
24
- > - `@mlightcad/data-model`
25
-
26
- ## Usage Example
27
-
28
- ```typescript
29
- import { AcDbDatabaseConverterManager, AcDbFileType } from '@mlightcad/data-model';
30
- import { AcDbDxfConverter } from '@mlightcad/dxf-json-converter';
31
-
32
- const dxfConverter = new AcDbDxfConverter({
33
- useWorker: true,
34
- parserWorkerUrl: './assets/dxf-parser-worker.js'
35
- });
36
- AcDbDatabaseConverterManager.instance.register(AcDbFileType.DXF, dxfConverter);
37
- ```
38
-
39
- Deploy `dxf-parser-worker.js` from this package's `dist/` folder to a public URL accessible by your application.
40
-
41
- ## API
42
-
43
- - **AcDbDxfConverter**: Main converter class for DXF files (extends `AcDbDatabaseConverter`)
44
-
45
- ## Dependencies
46
-
47
- - **@mlightcad/data-model**: Drawing database and entity definitions
48
- - **@mlightcad/dxf-json**: DXF file parser (GPL-3.0), loaded in the worker bundle by design for license isolation
49
-
50
- ## API Documentation
51
-
52
- For detailed API documentation, visit the [RealDWG-Web documentation](https://mlight-lee.github.io/realdwg-web/).
53
-
54
- ## Contributing
55
-
56
- This package is part of the RealDWG-Web monorepo. Please refer to the main project README for contribution guidelines.
1
+ # @mlightcad/dxf-json-converter
2
+
3
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
4
+ [![npm version](https://img.shields.io/npm/v/@mlightcad/dxf-json-converter.svg)](https://www.npmjs.com/package/@mlightcad/dxf-json-converter)
5
+
6
+ The `dxf-json-converter` package provides a DXF file converter for the RealDWG-Web ecosystem, enabling reading and conversion of DXF files into the AutoCAD-like drawing database structure. It is based on [@mlightcad/dxf-json](https://www.npmjs.com/package/@mlightcad/dxf-json).
7
+
8
+ ## Overview
9
+
10
+ This package implements a DXF file converter compatible with the RealDWG-Web data model. It allows you to register DXF file support in your application and convert DXF files into the in-memory drawing database.
11
+
12
+ DXF parsing is provided through a dedicated Web Worker bundle (`dxf-parser-worker.js`). **This converter is intended for Web Worker use only.** That restriction is not because parsing cannot run on the main thread in principle; it is a deliberate licensing choice. `@mlightcad/dxf-json` is GPL-3.0, and loading it in a separate worker bundle helps keep copyleft parser code apart from the main MIT-licensed application so license obligations are easier to manage.
13
+
14
+ ## Key Features
15
+
16
+ - **DXF File Support**: Read and convert DXF files to the drawing database
17
+ - **Worker-based Parsing**: Required by design for GPL license isolation
18
+ - **Integration**: Designed to work with the RealDWG-Web data model and converter manager
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @mlightcad/dxf-json-converter
24
+ ```
25
+
26
+ > **Peer dependencies:**
27
+ > - `@mlightcad/data-model`
28
+
29
+ ## Usage Example
30
+
31
+ ```typescript
32
+ import { AcDbDatabaseConverterManager, AcDbFileType } from '@mlightcad/data-model';
33
+ import { AcDbDxfConverter } from '@mlightcad/dxf-json-converter';
34
+
35
+ const dxfConverter = new AcDbDxfConverter({
36
+ useWorker: true,
37
+ parserWorkerUrl: './assets/dxf-parser-worker.js'
38
+ });
39
+ AcDbDatabaseConverterManager.instance.register(AcDbFileType.DXF, dxfConverter);
40
+ ```
41
+
42
+ Deploy `dxf-parser-worker.js` from this package's `dist/` folder to a public URL accessible by your application.
43
+
44
+ ## API
45
+
46
+ - **AcDbDxfConverter**: Main converter class for DXF files (extends `AcDbDatabaseConverter`)
47
+
48
+ ## Dependencies
49
+
50
+ - **@mlightcad/data-model**: Drawing database and entity definitions
51
+ - **@mlightcad/dxf-json**: DXF file parser (GPL-3.0), loaded in the worker bundle by design for license isolation
52
+
53
+ ## API Documentation
54
+
55
+ For detailed API documentation, visit the [RealDWG-Web documentation](https://mlight-lee.github.io/realdwg-web/).
56
+
57
+ ## Contributing
58
+
59
+ This package is part of the RealDWG-Web monorepo. Please refer to the main project README for contribution guidelines.
@@ -54,59 +54,7 @@ var vr = [
54
54
  throw new Error("Invalid constructor argument for AcDbDwgVersion");
55
55
  }
56
56
  return e;
57
- }(), br;
58
- (function(e) {
59
- e[e.UTF8 = 0] = "UTF8", e[e.US_ASCII = 1] = "US_ASCII", e[e.ISO_8859_1 = 2] = "ISO_8859_1", e[e.ISO_8859_2 = 3] = "ISO_8859_2", e[e.ISO_8859_3 = 4] = "ISO_8859_3", e[e.ISO_8859_4 = 5] = "ISO_8859_4", e[e.ISO_8859_5 = 6] = "ISO_8859_5", e[e.ISO_8859_6 = 7] = "ISO_8859_6", e[e.ISO_8859_7 = 8] = "ISO_8859_7", e[e.ISO_8859_8 = 9] = "ISO_8859_8", e[e.ISO_8859_9 = 10] = "ISO_8859_9", e[e.CP437 = 11] = "CP437", e[e.CP850 = 12] = "CP850", e[e.CP852 = 13] = "CP852", e[e.CP855 = 14] = "CP855", e[e.CP857 = 15] = "CP857", e[e.CP860 = 16] = "CP860", e[e.CP861 = 17] = "CP861", e[e.CP863 = 18] = "CP863", e[e.CP864 = 19] = "CP864", e[e.CP865 = 20] = "CP865", e[e.CP869 = 21] = "CP869", e[e.CP932 = 22] = "CP932", e[e.MACINTOSH = 23] = "MACINTOSH", e[e.BIG5 = 24] = "BIG5", e[e.CP949 = 25] = "CP949", e[e.JOHAB = 26] = "JOHAB", e[e.CP866 = 27] = "CP866", e[e.ANSI_1250 = 28] = "ANSI_1250", e[e.ANSI_1251 = 29] = "ANSI_1251", e[e.ANSI_1252 = 30] = "ANSI_1252", e[e.GB2312 = 31] = "GB2312", e[e.ANSI_1253 = 32] = "ANSI_1253", e[e.ANSI_1254 = 33] = "ANSI_1254", e[e.ANSI_1255 = 34] = "ANSI_1255", e[e.ANSI_1256 = 35] = "ANSI_1256", e[e.ANSI_1257 = 36] = "ANSI_1257", e[e.ANSI_874 = 37] = "ANSI_874", e[e.ANSI_932 = 38] = "ANSI_932", e[e.ANSI_936 = 39] = "ANSI_936", e[e.ANSI_949 = 40] = "ANSI_949", e[e.ANSI_950 = 41] = "ANSI_950", e[e.ANSI_1361 = 42] = "ANSI_1361", e[e.UTF16 = 43] = "UTF16", e[e.ANSI_1258 = 44] = "ANSI_1258", e[e.UNDEFINED = 255] = "UNDEFINED";
60
- })(br || (br = {}));
61
- var Ka = [
62
- "utf-8",
63
- "utf-8",
64
- "iso-8859-1",
65
- "iso-8859-2",
66
- "iso-8859-3",
67
- "iso-8859-4",
68
- "iso-8859-5",
69
- "iso-8859-6",
70
- "iso-8859-7",
71
- "iso-8859-8",
72
- "iso-8859-9",
73
- "utf-8",
74
- "utf-8",
75
- "utf-8",
76
- "utf-8",
77
- "utf-8",
78
- "utf-8",
79
- "utf-8",
80
- "utf-8",
81
- "utf-8",
82
- "utf-8",
83
- "utf-8",
84
- "shift-jis",
85
- "macintosh",
86
- "big5",
87
- "utf-8",
88
- "utf-8",
89
- "ibm866",
90
- "windows-1250",
91
- "windows-1251",
92
- "windows-1252",
93
- "gbk",
94
- "windows-1253",
95
- "windows-1254",
96
- "windows-1255",
97
- "windows-1256",
98
- "windows-1257",
99
- "windows-874",
100
- "shift-jis",
101
- "gbk",
102
- "euc-kr",
103
- "big5",
104
- "utf-8",
105
- "utf-16le",
106
- "windows-1258"
107
- ], Za = function(e) {
108
- return Ka[e];
109
- }, Ja = function(e, a, n, t) {
57
+ }(), Ka = function(e, a, n, t) {
110
58
  function c(s) {
111
59
  return s instanceof n ? s : new n(function(i) {
112
60
  i(s);
@@ -132,7 +80,7 @@ var Ka = [
132
80
  }
133
81
  d((t = t.apply(e, a || [])).next());
134
82
  });
135
- }, $a = function(e, a) {
83
+ }, Za = function(e, a) {
136
84
  var n = { label: 0, sent: function() {
137
85
  if (s[0] & 1) throw s[1];
138
86
  return s[1];
@@ -191,16 +139,16 @@ var Ka = [
191
139
  if (d[0] & 5) throw d[1];
192
140
  return { value: d[0] ? d[1] : void 0, done: !0 };
193
141
  }
194
- }, qa = function() {
142
+ }, Ja = function() {
195
143
  function e() {
196
144
  this.setupMessageHandler();
197
145
  }
198
146
  return e.prototype.setupMessageHandler = function() {
199
147
  var a = this;
200
148
  self.onmessage = function(n) {
201
- return Ja(a, void 0, void 0, function() {
149
+ return Ka(a, void 0, void 0, function() {
202
150
  var t, c, s, i, m;
203
- return $a(this, function(l) {
151
+ return Za(this, function(l) {
204
152
  switch (l.label) {
205
153
  case 0:
206
154
  t = n.data, c = t.id, s = t.input, l.label = 1;
@@ -225,7 +173,59 @@ var Ka = [
225
173
  };
226
174
  self.postMessage(s);
227
175
  }, e;
228
- }(), A, Ce, O, N, ke, j, fe, K, C, Z, Y, Ie, be, he, R, J, _e, we, Ee, ge, Re, Fe, Pe, F, $, T, xe, Ve, I, k, Be, _, Ue, q, g, He, Q, Te, ir, lr, X, Ge, ve, P, ee, re, ae, We, je, ne, Oe, Se, dr, Ye, ye, te, Ne, D, oe, V, pr, L, ur, se, B, Ae, Xe, De, U, ce, H, ie, mr, Le, G;
176
+ }(), br;
177
+ (function(e) {
178
+ e[e.UTF8 = 0] = "UTF8", e[e.US_ASCII = 1] = "US_ASCII", e[e.ISO_8859_1 = 2] = "ISO_8859_1", e[e.ISO_8859_2 = 3] = "ISO_8859_2", e[e.ISO_8859_3 = 4] = "ISO_8859_3", e[e.ISO_8859_4 = 5] = "ISO_8859_4", e[e.ISO_8859_5 = 6] = "ISO_8859_5", e[e.ISO_8859_6 = 7] = "ISO_8859_6", e[e.ISO_8859_7 = 8] = "ISO_8859_7", e[e.ISO_8859_8 = 9] = "ISO_8859_8", e[e.ISO_8859_9 = 10] = "ISO_8859_9", e[e.CP437 = 11] = "CP437", e[e.CP850 = 12] = "CP850", e[e.CP852 = 13] = "CP852", e[e.CP855 = 14] = "CP855", e[e.CP857 = 15] = "CP857", e[e.CP860 = 16] = "CP860", e[e.CP861 = 17] = "CP861", e[e.CP863 = 18] = "CP863", e[e.CP864 = 19] = "CP864", e[e.CP865 = 20] = "CP865", e[e.CP869 = 21] = "CP869", e[e.CP932 = 22] = "CP932", e[e.MACINTOSH = 23] = "MACINTOSH", e[e.BIG5 = 24] = "BIG5", e[e.CP949 = 25] = "CP949", e[e.JOHAB = 26] = "JOHAB", e[e.CP866 = 27] = "CP866", e[e.ANSI_1250 = 28] = "ANSI_1250", e[e.ANSI_1251 = 29] = "ANSI_1251", e[e.ANSI_1252 = 30] = "ANSI_1252", e[e.GB2312 = 31] = "GB2312", e[e.ANSI_1253 = 32] = "ANSI_1253", e[e.ANSI_1254 = 33] = "ANSI_1254", e[e.ANSI_1255 = 34] = "ANSI_1255", e[e.ANSI_1256 = 35] = "ANSI_1256", e[e.ANSI_1257 = 36] = "ANSI_1257", e[e.ANSI_874 = 37] = "ANSI_874", e[e.ANSI_932 = 38] = "ANSI_932", e[e.ANSI_936 = 39] = "ANSI_936", e[e.ANSI_949 = 40] = "ANSI_949", e[e.ANSI_950 = 41] = "ANSI_950", e[e.ANSI_1361 = 42] = "ANSI_1361", e[e.UTF16 = 43] = "UTF16", e[e.ANSI_1258 = 44] = "ANSI_1258", e[e.UNDEFINED = 255] = "UNDEFINED";
179
+ })(br || (br = {}));
180
+ var $a = [
181
+ "utf-8",
182
+ "utf-8",
183
+ "iso-8859-1",
184
+ "iso-8859-2",
185
+ "iso-8859-3",
186
+ "iso-8859-4",
187
+ "iso-8859-5",
188
+ "iso-8859-6",
189
+ "iso-8859-7",
190
+ "iso-8859-8",
191
+ "iso-8859-9",
192
+ "utf-8",
193
+ "utf-8",
194
+ "utf-8",
195
+ "utf-8",
196
+ "utf-8",
197
+ "utf-8",
198
+ "utf-8",
199
+ "utf-8",
200
+ "utf-8",
201
+ "utf-8",
202
+ "utf-8",
203
+ "shift-jis",
204
+ "macintosh",
205
+ "big5",
206
+ "utf-8",
207
+ "utf-8",
208
+ "ibm866",
209
+ "windows-1250",
210
+ "windows-1251",
211
+ "windows-1252",
212
+ "gbk",
213
+ "windows-1253",
214
+ "windows-1254",
215
+ "windows-1255",
216
+ "windows-1256",
217
+ "windows-1257",
218
+ "windows-874",
219
+ "shift-jis",
220
+ "gbk",
221
+ "euc-kr",
222
+ "big5",
223
+ "utf-8",
224
+ "utf-16le",
225
+ "windows-1258"
226
+ ], qa = function(e) {
227
+ return $a[e];
228
+ }, A, Ce, O, N, ke, j, fe, K, C, Z, Y, Ie, be, he, R, J, _e, we, Ee, ge, Re, Fe, Pe, F, $, T, xe, Ve, I, k, Be, _, Ue, q, g, He, Q, Te, ir, lr, X, Ge, ve, P, ee, re, ae, We, je, ne, Oe, Se, dr, Ye, ye, te, Ne, D, oe, V, pr, L, ur, se, B, Ae, Xe, De, U, ce, H, ie, mr, Le, G;
229
229
  (A = {})[A.None = 0] = "None", A[A.Anonymous = 1] = "Anonymous", A[A.NonConstant = 2] = "NonConstant", A[A.Xref = 4] = "Xref", A[A.XrefOverlay = 8] = "XrefOverlay", A[A.ExternallyDependent = 16] = "ExternallyDependent", A[A.ResolvedOrDependent = 32] = "ResolvedOrDependent", A[A.ReferencedXref = 64] = "ReferencedXref";
230
230
  (Ce = {})[Ce.BYBLOCK = 0] = "BYBLOCK", Ce[Ce.BYLAYER = 256] = "BYLAYER";
231
231
  (O = {})[O.Rotated = 0] = "Rotated", O[O.Aligned = 1] = "Aligned", O[O.Angular = 2] = "Angular", O[O.Diameter = 3] = "Diameter", O[O.Radius = 4] = "Radius", O[O.Angular3Point = 5] = "Angular3Point", O[O.Ordinate = 6] = "Ordinate", O[O.ReferenceIsExclusive = 32] = "ReferenceIsExclusive", O[O.IsOrdinateXTypeFlag = 64] = "IsOrdinateXTypeFlag", O[O.IsCustomTextPositionFlag = 128] = "IsCustomTextPositionFlag";
@@ -1869,7 +1869,7 @@ class vo {
1869
1869
  const me = (h = y[w + 2]) == null ? void 0 : h.trim();
1870
1870
  if (me) {
1871
1871
  const cr = br[me];
1872
- m = Za(cr);
1872
+ m = qa(cr);
1873
1873
  }
1874
1874
  }
1875
1875
  if (i && m)
@@ -1879,7 +1879,7 @@ class vo {
1879
1879
  return { version: i, encoding: m };
1880
1880
  }
1881
1881
  }
1882
- class Oo extends qa {
1882
+ class Oo extends Ja {
1883
1883
  async executeTask(a) {
1884
1884
  return new vo().parse(a);
1885
1885
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/dxf-json-converter",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "license": "GPL-3.0",
5
5
  "type": "module",
6
6
  "repository": {
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "vite": "^5.2.10",
41
- "@mlightcad/data-model": "1.9.0"
41
+ "@mlightcad/data-model": "1.9.1"
42
42
  },
43
43
  "peerDependencies": {
44
- "@mlightcad/data-model": "1.9.0"
44
+ "@mlightcad/data-model": "1.9.1"
45
45
  },
46
46
  "scripts": {
47
47
  "analyze": "pnpm run analyze:lib && pnpm run analyze:worker",