Skip to content

Commit 155bf19

Browse files
committed
Fix the syntax error in libxml2raw.d.ts
1 parent b082aee commit 155bf19

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ The api may have breaking changes in patch versions.
1010

1111
## Why another xml lib?
1212

13-
Compiling C library libxml2 to WebAssembly brings benefits of both pure javascript implementation or native addons,
13+
Compiling C library [libxml2](https://gitlab.gnome.org/GNOME/libxml2) to WebAssembly
14+
brings benefits of both pure javascript implementation or native addons,
1415
and avoided their drawbacks:
1516

1617
- Good performance: roughly same as the native addons, and much better than pure javascript implementations
17-
- Better compatibility: don't need to compile to every platform, nodeJs version, or dependency libraries(e.g. glibc).
18-
- Comprehensive functionality(To be finished): backed by libxml2, we just need the wrapper.
18+
- Better compatibility: don't need to compile to every platform, nodeJs version,
19+
or dependency libraries(e.g. glibc); and supports browsers too.
20+
- Comprehensive functionality(To be finished): backed by libxml2,
21+
we just need some wrappers being callable by javascript.
1922

2023
## Documentation
2124

gulpfile.babel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { argv } from 'yargs';
77
const libxmlSrc = 'libxml2';
88
const libxmlBin = 'out';
99
const destDir = 'lib';
10-
const generated = 'libxml2raw.js';
10+
const generated = 'libxml2raw';
1111
const libxmlExportListFile = 'binding/exported-functions.txt';
1212
const libxmlExportRuntimeListFile = 'binding/exported-runtime-functions.txt';
1313

@@ -58,7 +58,7 @@ export function bind(cb) {
5858
'emcc',
5959
'-L.libs',
6060
'-lxml2',
61-
'-o', generated,
61+
'-o', `${generated}.js`,
6262
'--no-entry',
6363
'-s', 'MODULARIZE',
6464
'-s', 'ALLOW_MEMORY_GROWTH',
@@ -80,7 +80,7 @@ export function bind(cb) {
8080
}
8181

8282
export function dist() {
83-
return src(['./out/libxml2raw.*', './src/libxml2raw.*'])
83+
return src([`./${libxmlBin}/${generated}.*`, `./src/${generated}.*`])
8484
.pipe(dest(destDir));
8585
}
8686

src/libxml2raw.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export class LibXml2 {
1010
HEAP32: Int32Array;
1111
getValue(ptr: Pointer, type: string): number;
1212
lengthBytesUTF8(str: string): number;
13-
stringToUTF8(str: string, outPtr: CString, maxBytesToWrite: number): CStrng;
13+
stringToUTF8(str: string, outPtr: CString, maxBytesToWrite: number): CString;
1414
UTF8ToString(ptr: CString, maxBytesToRead?: number): string;
1515
_xmlNewDoc(): XmlDocPtr;
16-
_xmlFreeDoc(Doc: XmlDocPtr);
16+
_xmlFreeDoc(Doc: XmlDocPtr): void;
1717
_xmlReadMemory(
1818
buffer: CString,
1919
length: number,
@@ -22,15 +22,15 @@ export class LibXml2 {
2222
options: number,
2323
): XmlDocPtr;
2424
_malloc(size: number): Pointer;
25-
_free(memblock: Pointer);
25+
_free(memblock: Pointer): void;
2626
_xmlXPathNewContext(doc: XmlDocPtr): XmlXPathContextPtr;
27-
_xmlXPathFreeContext(context: XmlXPathContextPtr);
27+
_xmlXPathFreeContext(context: XmlXPathContextPtr): void;
2828
_xmlXPathNodeEval(
2929
node: XmlNodePtr,
3030
xpath: CString,
3131
context: XmlXPathContextPtr,
3232
): XmlXPathObjectPtr;
33-
_xmlXPathFreeObject(obj: XmlXPathObjectPtr);
33+
_xmlXPathFreeObject(obj: XmlXPathObjectPtr): void;
3434
_xmlDocGetRootElement(doc: XmlDocPtr): XmlNodePtr;
3535
_xmlHasProp(node: XmlNodePtr, name: CString): XmlAttrPtr;
3636
_xmlNodeGetContent(node: XmlNodePtr): CString;

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@
105105

106106
/* Completeness */
107107
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
108-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
108+
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
109109
}
110110
}

0 commit comments

Comments
 (0)