@mlightcad/libredwg-web 0.6.9 → 0.6.10

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.
@@ -556,6 +556,17 @@ export class LibreDwgConverter {
556
556
  .data;
557
557
  const color = libredwg.dwg_dynapi_entity_value(item, 'color')
558
558
  .data;
559
+ const ltypeRef = libredwg.dwg_dynapi_entity_value(item, 'ltype')
560
+ .data;
561
+ let ltypeName = 'Continuous';
562
+ if (ltypeRef) {
563
+ try {
564
+ ltypeName = libredwg.dwg_ref_get_object_name(ltypeRef);
565
+ }
566
+ catch {
567
+ // ref may be invalid in some DWG files
568
+ }
569
+ }
559
570
  // - 0xc0 for ByLayer (also c3 and rgb of 0x100)
560
571
  // - 0xc1 for ByBlock (also c3 and rgb of 0)
561
572
  // - 0xc2 for entities (default), with names with an additional name flag RC
@@ -583,7 +594,7 @@ export class LibreDwgConverter {
583
594
  color: rgbColor,
584
595
  colorName: color.name,
585
596
  transparency: color.alpha,
586
- lineType: '',
597
+ lineType: ltypeName,
587
598
  frozen: frozen != 0,
588
599
  off: off != 0,
589
600
  frozenInNew: frozenInNew != 0,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@mlightcad/libredwg-web",
3
3
  "description": "A DWG/DXF JavaScript parser based on libredwg",
4
- "license": "GPL-2.0-only",
4
+ "license": "GPL-3.0",
5
5
  "private": false,
6
- "version": "0.6.9",
6
+ "version": "0.6.10",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "repository": {
@@ -72,7 +72,7 @@
72
72
  "build": "tsc && vite build && cp -rf wasm examples/ && cp -rf dist examples/",
73
73
  "build:prepare": "mkdir -p ../../build-wasm && cd ../../build-wasm && emconfigure ../configure CFLAGS=\"-O2 -sUSE_ZLIB=1\" CC=emcc --enable-release --disable-docs --disable-write --disable-python --disable-bindings --disable-shared --disable-json --disable-dxf --enable-partial --enable-experimental",
74
74
  "build:obj": "cd ../../build-wasm && emmake make",
75
- "build:wasm": "cd ../../build-wasm && emcc ../bindings/javascript/embind/*.cpp src/*.o -O2 -lembind -std=c++11 -Isrc -I../src -I../include -o libredwg-web.js -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_ES6=1 -s MODULARIZE=1 -s EXPORT_NAME=\"createModule\" -sEXPORTED_RUNTIME_METHODS=FS,ENV,ccall,cwrap,UTF8ToString,stringToNewUTF8,setValue --emit-tsd libredwg-web.d.ts",
75
+ "build:wasm": "cd ../../build-wasm && emcc ../bindings/javascript/embind/*.cpp src/*.o -O2 -lembind -std=c++17 -Isrc -I../src -I../include -o libredwg-web.js -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_ES6=1 -s MODULARIZE=1 -s EXPORT_NAME=\"createModule\" -sEXPORTED_RUNTIME_METHODS=FS,ENV,ccall,cwrap,UTF8ToString,stringToNewUTF8,setValue --emit-tsd libredwg-web.d.ts",
76
76
  "clean": "rm -rf ../../build-wasm ./docs ./dist ./lib",
77
77
  "copy": "cp -f ../../build-wasm/libredwg-web.d.ts ../../build-wasm/libredwg-web.js ../../build-wasm/libredwg-web.wasm wasm/ && cp -f ../../build-wasm/libredwg-web.js src/",
78
78
  "format": "prettier --config ./.prettierrc.js --write src/**/*.{ts,js}",
@@ -10,10 +10,9 @@ declare namespace RuntimeExports {
10
10
  export let currentPath: string;
11
11
  export let initialized: boolean;
12
12
  export let ignorePermissions: boolean;
13
- export { ErrnoError };
14
13
  export let filesystems: any;
15
14
  export let syncFSRequests: number;
16
- export let readFiles: {};
15
+ export { ErrnoError };
17
16
  export { FSStream };
18
17
  export { FSNode };
19
18
  export function lookupPath(path: any, opts?: {}): {
@@ -114,11 +113,10 @@ declare namespace RuntimeExports {
114
113
  export function llseek(stream: any, offset: any, whence: any): any;
115
114
  export function read(stream: any, buffer: any, offset: any, length: any, position: any): any;
116
115
  export function write(stream: any, buffer: any, offset: any, length: any, position: any, canOwn: any): any;
117
- export function allocate(stream: any, offset: any, length: any): void;
118
116
  export function mmap(stream: any, length: any, position: any, prot: any, flags: any): any;
119
117
  export function msync(stream: any, buffer: any, offset: any, length: any, mmapFlags: any): any;
120
118
  export function ioctl(stream: any, cmd: any, arg: any): any;
121
- export function readFile(path: any, opts?: {}): any;
119
+ export function readFile(path: any, opts?: {}): Uint8Array<any>;
122
120
  export function writeFile(path: any, data: any, opts?: {}): void;
123
121
  export function cwd(): any;
124
122
  export function chdir(path: any): void;
@@ -152,10 +150,10 @@ declare namespace RuntimeExports {
152
150
  /**
153
151
  * @param {string|null=} returnType
154
152
  * @param {Array=} argTypes
155
- * @param {Arguments|Array=} args
153
+ * @param {Array=} args
156
154
  * @param {Object=} opts
157
155
  */
158
- function ccall(ident: any, returnType?: (string | null) | undefined, argTypes?: any[] | undefined, args?: (Arguments | any[]) | undefined, opts?: any | undefined): any;
156
+ function ccall(ident: any, returnType?: (string | null) | undefined, argTypes?: any[] | undefined, args?: any[] | undefined, opts?: any | undefined): any;
159
157
  /**
160
158
  * @param {string=} returnType
161
159
  * @param {Array=} argTypes
@@ -171,13 +169,11 @@ declare namespace RuntimeExports {
171
169
  * maximum number of bytes to read. You can omit this parameter to scan the
172
170
  * string until the first 0 byte. If maxBytesToRead is passed, and the string
173
171
  * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
174
- * string will cut short at that byte index (i.e. maxBytesToRead will not
175
- * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
176
- * frequent uses of UTF8ToString() with and without maxBytesToRead may throw
177
- * JS JIT optimizations off, so it is worth to consider consistently using one
172
+ * string will cut short at that byte index.
173
+ * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
178
174
  * @return {string}
179
175
  */
180
- function UTF8ToString(ptr: number, maxBytesToRead?: number | undefined): string;
176
+ function UTF8ToString(ptr: number, maxBytesToRead?: number | undefined, ignoreNul?: boolean | undefined): string;
181
177
  function stringToNewUTF8(str: any): any;
182
178
  /**
183
179
  * @param {number} ptr
@@ -185,17 +181,6 @@ declare namespace RuntimeExports {
185
181
  * @param {string} type
186
182
  */
187
183
  function setValue(ptr: number, value: number, type?: string): void;
188
- let HEAPF32: any;
189
- let HEAPF64: any;
190
- let HEAP_DATA_VIEW: any;
191
- let HEAP8: any;
192
- let HEAPU8: any;
193
- let HEAP16: any;
194
- let HEAPU16: any;
195
- let HEAP32: any;
196
- let HEAPU32: any;
197
- let HEAP64: any;
198
- let HEAPU64: any;
199
184
  }
200
185
  declare class ErrnoError {
201
186
  constructor(errno: any);
@@ -247,6 +232,8 @@ export interface ClassHandle {
247
232
  delete(): void;
248
233
  deleteLater(): this;
249
234
  isDeleted(): boolean;
235
+ // @ts-ignore - If targeting lower than ESNext, this symbol might not exist.
236
+ [Symbol.dispose](): void;
250
237
  clone(): this;
251
238
  }
252
239
  export interface Dwg_Version_TypeValue<T extends number> {