xmlbuilder2
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -5,3 +5,7 @@ # Change Log | ||
## [1.4.0] - 2020-02-28 | ||
- Added callback API (See [#2](https://github.com/oozcitak/xmlbuilder2/issues/2)). | ||
## [1.3.0] - 2020-02-18 | ||
@@ -37,2 +41,3 @@ | ||
[1.4.0]: https://github.com/oozcitak/xmlbuilder2/compare/v1.3.0...v1.4.0 | ||
[1.3.0]: https://github.com/oozcitak/xmlbuilder2/compare/v1.2.1...v1.3.0 | ||
@@ -39,0 +44,0 @@ [1.2.1]: https://github.com/oozcitak/xmlbuilder2/compare/v1.2.0...v1.2.1 |
@@ -1,2 +0,2 @@ | ||
import { XMLBuilderCreateOptions, ExpandObject, XMLBuilder, WriterOptions, XMLSerializedValue, XMLBuilderStream, StreamWriterOptions } from './interfaces'; | ||
import { XMLBuilderCreateOptions, ExpandObject, XMLBuilder, WriterOptions, XMLSerializedValue, XMLBuilderCB, XMLBuilderCBOptions } from './interfaces'; | ||
import { Node } from '@oozcitak/dom/lib/dom/interfaces'; | ||
@@ -148,16 +148,16 @@ /** | ||
/** | ||
* Creates an XML builder document stream. | ||
* Creates an XML builder which serializes the document in chunks. | ||
* | ||
* @param options - stream writer options | ||
* @param options - callback builder options | ||
* | ||
* @returns XML builder stream | ||
* @returns callback builder | ||
*/ | ||
export declare function documentStream(options: StreamWriterOptions): XMLBuilderStream; | ||
export declare function createCB(options: XMLBuilderCBOptions): XMLBuilderCB; | ||
/** | ||
* Creates an XML builder fragment stream. | ||
* Creates an XML builder which serializes the fragment in chunks. | ||
* | ||
* @param options - stream writer options | ||
* @param options - callback builder options | ||
* | ||
* @returns XML builder stream | ||
* @returns callback builder | ||
*/ | ||
export declare function fragmentStream(options: StreamWriterOptions): XMLBuilderStream; | ||
export declare function fragmentCB(options: XMLBuilderCBOptions): XMLBuilderCB; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const util_3 = require("util"); | ||
const stream_1 = require("./stream"); | ||
const callback_1 = require("./callback"); | ||
/** @inheritdoc */ | ||
@@ -138,23 +138,23 @@ function builder(p1, p2) { | ||
/** | ||
* Creates an XML builder document stream. | ||
* Creates an XML builder which serializes the document in chunks. | ||
* | ||
* @param options - stream writer options | ||
* @param options - callback builder options | ||
* | ||
* @returns XML builder stream | ||
* @returns callback builder | ||
*/ | ||
function documentStream(options) { | ||
return new stream_1.XMLBuilderStreamImpl(options); | ||
function createCB(options) { | ||
return new callback_1.XMLBuilderCBImpl(options); | ||
} | ||
exports.documentStream = documentStream; | ||
exports.createCB = createCB; | ||
/** | ||
* Creates an XML builder fragment stream. | ||
* Creates an XML builder which serializes the fragment in chunks. | ||
* | ||
* @param options - stream writer options | ||
* @param options - callback builder options | ||
* | ||
* @returns XML builder stream | ||
* @returns callback builder | ||
*/ | ||
function fragmentStream(options) { | ||
return new stream_1.XMLBuilderStreamImpl(options, true); | ||
function fragmentCB(options) { | ||
return new callback_1.XMLBuilderCBImpl(options, true); | ||
} | ||
exports.fragmentStream = fragmentStream; | ||
exports.fragmentCB = fragmentCB; | ||
function isXMLBuilderCreateOptions(obj) { | ||
@@ -161,0 +161,0 @@ if (!util_1.isPlainObject(obj)) |
@@ -761,5 +761,5 @@ import { Node, Document } from "@oozcitak/dom/lib/dom/interfaces"; | ||
/** | ||
* Represents a readable XML document stream. | ||
* Builds and serializes an XML document in chunks. | ||
*/ | ||
export interface XMLBuilderStream { | ||
export interface XMLBuilderCB { | ||
/** | ||
@@ -772,5 +772,5 @@ * Creates a new element node and appends it to the list of child nodes. | ||
* | ||
* @returns the XML stream | ||
* @returns the builder | ||
*/ | ||
ele(namespace: string | null, name: string, attributes?: AttributesObject): XMLBuilderStream; | ||
ele(namespace: string | null, name: string, attributes?: AttributesObject): XMLBuilderCB; | ||
/** | ||
@@ -782,5 +782,5 @@ * Creates a new element node and appends it to the list of child nodes. | ||
* | ||
* @returns the XML stream | ||
* @returns callback builder | ||
*/ | ||
ele(name: string, attributes?: AttributesObject): XMLBuilderStream; | ||
ele(name: string, attributes?: AttributesObject): XMLBuilderCB; | ||
/** | ||
@@ -793,5 +793,5 @@ * Creates or updates an element attribute. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
att(namespace: string | null, name: string, value: string): XMLBuilderStream; | ||
att(namespace: string | null, name: string, value: string): XMLBuilderCB; | ||
/** | ||
@@ -803,5 +803,5 @@ * Creates or updates an element attribute. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
att(name: string, value: string): XMLBuilderStream; | ||
att(name: string, value: string): XMLBuilderCB; | ||
/** | ||
@@ -812,5 +812,5 @@ * Creates or updates an element attribute. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
att(obj: AttributesObject): XMLBuilderStream; | ||
att(obj: AttributesObject): XMLBuilderCB; | ||
/** | ||
@@ -821,5 +821,5 @@ * Creates a new text node and appends it to the list of child nodes. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
txt(content: string): XMLBuilderStream; | ||
txt(content: string): XMLBuilderCB; | ||
/** | ||
@@ -830,5 +830,5 @@ * Creates a new comment node and appends it to the list of child nodes. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
com(content: string): XMLBuilderStream; | ||
com(content: string): XMLBuilderCB; | ||
/** | ||
@@ -839,5 +839,5 @@ * Creates a new CDATA node and appends it to the list of child nodes. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
dat(content: string): XMLBuilderStream; | ||
dat(content: string): XMLBuilderCB; | ||
/** | ||
@@ -850,5 +850,5 @@ * Creates a new processing instruction node and appends it to the list of | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
ins(target: string, content?: string): XMLBuilderStream; | ||
ins(target: string, content?: string): XMLBuilderCB; | ||
/** | ||
@@ -861,5 +861,5 @@ * Creates new processing instruction nodes by expanding the given object and | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
ins(target: PIObject): XMLBuilderStream; | ||
ins(target: PIObject): XMLBuilderCB; | ||
/** | ||
@@ -870,3 +870,3 @@ * Creates the XML declaration. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
@@ -877,3 +877,3 @@ dec(options?: { | ||
standalone?: boolean; | ||
}): XMLBuilderStream; | ||
}): XMLBuilderCB; | ||
/** | ||
@@ -884,24 +884,24 @@ * Creates a new DocType node and inserts it into the document. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
dtd(options: DTDOptions & { | ||
name: string; | ||
}): XMLBuilderStream; | ||
}): XMLBuilderCB; | ||
/** | ||
* Closes the current element node. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
up(): XMLBuilderStream; | ||
up(): XMLBuilderCB; | ||
/** | ||
* Completes serializing the XML document. | ||
* | ||
* @returns current element node | ||
* @returns callback builder | ||
*/ | ||
end(): XMLBuilderStream; | ||
end(): XMLBuilderCB; | ||
} | ||
/** | ||
* Defines the options passed to the object writer. | ||
* Defines the options passed to the callback builder. | ||
*/ | ||
export declare type StreamWriterOptions = { | ||
export declare type XMLBuilderCBOptions = { | ||
/** | ||
@@ -987,3 +987,3 @@ * A callback function which is called when a chunk of XML is serialized. | ||
*/ | ||
export declare const DefaultStreamWriterOptions: Partial<StreamWriterOptions>; | ||
export declare const DefaultXMLBuilderCBOptions: Partial<XMLBuilderCBOptions>; | ||
export {}; |
@@ -41,3 +41,3 @@ "use strict"; | ||
*/ | ||
exports.DefaultStreamWriterOptions = { | ||
exports.DefaultXMLBuilderCBOptions = { | ||
error: (() => { }), | ||
@@ -44,0 +44,0 @@ wellFormed: false, |
{ | ||
"name": "xmlbuilder2", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"keywords": [ | ||
@@ -65,3 +65,3 @@ "xml", | ||
"perf": "npm run pretest && ts-node ./perf/perf.ts", | ||
"stream-perf": "npm run pretest && ts-node ./perf/stream-perf.ts", | ||
"perf-cb": "npm run pretest && ts-node ./perf/perf-cb.ts", | ||
"prof-serialize": "npm run pretest && rm -f isolate-*-v8.log && node --prof ./perf/prof-serialize.js && find . -name isolate-*-v8.log -exec mv {} isolate-v8.log ; && node --prof-process isolate-v8.log > isolate-serialize.log && rm isolate-v8.log", | ||
@@ -68,0 +68,0 @@ "prepare": "npm run test", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
329404
0