@cdk8s/awscdk-resolver 0.0.318 → 0.0.319
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/.jsii +3 -3
- package/lib/resolve.js +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/package.json +14 -14
- package/node_modules/@aws-sdk/client-sso/package.json +13 -13
- package/node_modules/@aws-sdk/core/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +4 -4
- package/node_modules/@aws-sdk/nested-clients/package.json +13 -13
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js +30 -0
- package/node_modules/@aws-sdk/util-endpoints/dist-es/index.js +1 -0
- package/node_modules/@aws-sdk/util-endpoints/dist-es/resolveDefaultAwsRegionalEndpointsConfig.js +21 -0
- package/node_modules/@aws-sdk/util-endpoints/dist-types/index.d.ts +1 -0
- package/node_modules/@aws-sdk/util-endpoints/dist-types/resolveDefaultAwsRegionalEndpointsConfig.d.ts +56 -0
- package/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/index.d.ts +1 -0
- package/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/resolveDefaultAwsRegionalEndpointsConfig.d.ts +35 -0
- package/node_modules/@aws-sdk/util-endpoints/package.json +2 -1
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +20 -20
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +80 -6
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +20 -20
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/MapSchema.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js +10 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpBindingProtocol.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ListSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/MapSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/StructureSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpBindingProtocol.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +3 -0
- package/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +2 -2
- package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +4 -4
- package/node_modules/@smithy/fetch-http-handler/dist-types/fetch-http-handler.d.ts +1 -1
- package/node_modules/@smithy/fetch-http-handler/dist-types/ts3.4/fetch-http-handler.d.ts +1 -1
- package/node_modules/@smithy/fetch-http-handler/package.json +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +5 -2
- package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js +3 -0
- package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-es/endpointMiddleware.js +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +5 -2
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +5 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -9
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +4 -3
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +7 -6
- package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/package.json +1 -1
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-stream/package.json +3 -3
- package/node_modules/fast-xml-parser/CHANGELOG.md +77 -0
- package/node_modules/fast-xml-parser/README.md +39 -52
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.d.cts +458 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
- package/node_modules/fast-xml-parser/package.json +36 -20
- package/node_modules/fast-xml-parser/src/cli/cli.js +16 -12
- package/node_modules/fast-xml-parser/src/cli/man.js +6 -1
- package/node_modules/fast-xml-parser/src/cli/read.js +30 -79
- package/node_modules/fast-xml-parser/src/fxp.d.ts +52 -9
- package/node_modules/fast-xml-parser/src/fxp.js +11 -8
- package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-parser/src/util.js +14 -18
- package/node_modules/fast-xml-parser/src/{v5 → v6}/CharsSymbol.js +1 -1
- package/node_modules/fast-xml-parser/src/{v5/valueParsers → v6}/EntitiesParser.js +3 -6
- package/node_modules/fast-xml-parser/src/{v5 → v6}/OptionsBuilder.js +3 -6
- package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/BaseOutputBuilder.js +1 -3
- package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsArrBuilder.js +3 -3
- package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsMinArrBuilder.js +3 -5
- package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsObjBuilder.js +3 -5
- package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/ParserOptionsBuilder.js +6 -11
- package/node_modules/fast-xml-parser/src/{v5 → v6}/TagPath.js +1 -1
- package/node_modules/fast-xml-parser/src/{v5 → v6}/TagPathMatcher.js +3 -5
- package/node_modules/fast-xml-parser/src/{v5 → v6}/XMLParser.js +3 -5
- package/node_modules/fast-xml-parser/src/{v5 → v6}/Xml2JsParser.js +8 -10
- package/node_modules/fast-xml-parser/src/{v5 → v6}/XmlPartReader.js +24 -26
- package/node_modules/fast-xml-parser/src/{v5 → v6}/XmlSpecialTagsReader.js +5 -12
- package/node_modules/fast-xml-parser/src/{v5 → v6}/inputSource/BufferSource.js +1 -3
- package/node_modules/fast-xml-parser/src/{v5 → v6}/inputSource/StringSource.js +1 -3
- package/node_modules/fast-xml-parser/src/{v5 → v6/valueParsers}/EntitiesParser.js +3 -5
- package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/booleanParser.js +1 -2
- package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/booleanParserExt.js +1 -2
- package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/currency.js +1 -3
- package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/join.js +1 -2
- package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/number.js +2 -4
- package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/trim.js +1 -3
- package/node_modules/fast-xml-parser/src/validator.js +5 -5
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +17 -13
- package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +1 -2
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +288 -71
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +3 -5
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +28 -23
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +21 -8
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +8 -2
- package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +22 -7
- package/node_modules/strnum/.github/SECURITY.md +5 -0
- package/node_modules/strnum/CHANGELOG.md +11 -0
- package/node_modules/strnum/algo.stflow +84 -0
- package/node_modules/strnum/package.json +2 -1
- package/node_modules/strnum/strnum.js +53 -35
- package/node_modules/strnum/strnum.test.js +9 -1
- package/node_modules/strnum/test.js +9 -0
- package/package.json +4 -4
- /package/node_modules/fast-xml-parser/src/{v5 → v6}/Report.js +0 -0
@@ -1,92 +1,43 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
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
|
13
|
-
// all 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
|
21
|
-
// THE SOFTWARE
|
3
|
+
import { Transform } from 'stream';
|
22
4
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
const rte = require('readtoend');
|
30
|
-
|
31
|
-
http.get('http://nodejs.org', function(response) {
|
32
|
-
rte.readToEnd(response, function(err, body) {
|
33
|
-
console.log(body);
|
34
|
-
});
|
35
|
-
});
|
36
|
-
|
37
|
-
*/
|
38
|
-
|
39
|
-
let stream = require('stream');
|
40
|
-
const util = require('util');
|
41
|
-
|
42
|
-
if (!stream.Transform) {
|
43
|
-
stream = require('readable-stream');
|
44
|
-
}
|
45
|
-
|
46
|
-
function ReadToEnd(opts) {
|
47
|
-
if (!(this instanceof ReadToEnd)) {
|
48
|
-
return new ReadToEnd(opts);
|
5
|
+
export default class ReadToEnd extends Transform {
|
6
|
+
constructor(options = {}) {
|
7
|
+
super(options);
|
8
|
+
this._encoding = options.encoding || 'utf8';
|
9
|
+
this._buffer = '';
|
49
10
|
}
|
50
11
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
57
|
-
|
58
|
-
module.exports = ReadToEnd;
|
59
|
-
util.inherits(ReadToEnd, stream.Transform);
|
60
|
-
|
61
|
-
ReadToEnd.prototype._transform = function(chunk, encoding, done) {
|
62
|
-
this._buff += chunk.toString(this._rte_encoding);
|
63
|
-
this.push(chunk);
|
64
|
-
done();
|
65
|
-
};
|
66
|
-
|
67
|
-
ReadToEnd.prototype._flush = function(done) {
|
68
|
-
this.emit('complete', undefined, this._buff);
|
69
|
-
done();
|
70
|
-
};
|
12
|
+
_transform(chunk, encoding, done) {
|
13
|
+
this._buffer += chunk.toString(this._encoding);
|
14
|
+
this.push(chunk);
|
15
|
+
done();
|
16
|
+
}
|
71
17
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
options = {};
|
18
|
+
_flush(done) {
|
19
|
+
this.emit('complete', null, this._buffer);
|
20
|
+
done();
|
76
21
|
}
|
77
22
|
|
78
|
-
|
23
|
+
static readToEnd(stream, options, callback) {
|
24
|
+
if (typeof options === 'function') {
|
25
|
+
callback = options;
|
26
|
+
options = {};
|
27
|
+
}
|
79
28
|
|
80
|
-
|
29
|
+
const dest = new ReadToEnd(options);
|
81
30
|
|
82
|
-
|
83
|
-
stream.unpipe(dest);
|
84
|
-
cb(err);
|
85
|
-
});
|
31
|
+
stream.pipe(dest);
|
86
32
|
|
87
|
-
|
33
|
+
stream.on('error', (err) => {
|
34
|
+
stream.unpipe(dest);
|
35
|
+
callback(err);
|
36
|
+
});
|
88
37
|
|
89
|
-
|
38
|
+
dest.on('complete', callback);
|
39
|
+
dest.resume();
|
90
40
|
|
91
|
-
|
92
|
-
}
|
41
|
+
return dest;
|
42
|
+
}
|
43
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
type X2jOptions = {
|
1
|
+
export type X2jOptions = {
|
2
2
|
/**
|
3
3
|
* Preserve the order of tags in resulting JS object
|
4
4
|
*
|
@@ -30,9 +30,17 @@ type X2jOptions = {
|
|
30
30
|
/**
|
31
31
|
* Whether to ignore attributes when parsing
|
32
32
|
*
|
33
|
+
* When `true` - ignores all the attributes
|
34
|
+
*
|
35
|
+
* When `false` - parses all the attributes
|
36
|
+
*
|
37
|
+
* When `Array<string | RegExp>` - filters out attributes that match provided patterns
|
38
|
+
*
|
39
|
+
* When `Function` - calls the function for each attribute and filters out those for which the function returned `true`
|
40
|
+
*
|
33
41
|
* Defaults to `true`
|
34
42
|
*/
|
35
|
-
ignoreAttributes?: boolean;
|
43
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPath: string) => boolean);
|
36
44
|
|
37
45
|
/**
|
38
46
|
* Whether to remove namespace string from tag and attribute names
|
@@ -202,16 +210,22 @@ type X2jOptions = {
|
|
202
210
|
* Defaults to `(tagName, jPath, attrs) => tagName`
|
203
211
|
*/
|
204
212
|
updateTag?: (tagName: string, jPath: string, attrs: {[k: string]: string}) => string | boolean;
|
213
|
+
|
214
|
+
/**
|
215
|
+
* If true, adds a Symbol to all object nodes, accessible by {@link XMLParser.getMetaDataSymbol} with
|
216
|
+
* metadata about each the node in the XML file.
|
217
|
+
*/
|
218
|
+
captureMetaData?: boolean;
|
205
219
|
};
|
206
220
|
|
207
|
-
type strnumOptions = {
|
221
|
+
export type strnumOptions = {
|
208
222
|
hex: boolean;
|
209
223
|
leadingZeros: boolean,
|
210
224
|
skipLike?: RegExp,
|
211
225
|
eNotation?: boolean
|
212
226
|
}
|
213
227
|
|
214
|
-
type validationOptions = {
|
228
|
+
export type validationOptions = {
|
215
229
|
/**
|
216
230
|
* Whether to allow attributes without value
|
217
231
|
*
|
@@ -227,7 +241,7 @@ type validationOptions = {
|
|
227
241
|
unpairedTags?: string[];
|
228
242
|
};
|
229
243
|
|
230
|
-
type XmlBuilderOptions = {
|
244
|
+
export type XmlBuilderOptions = {
|
231
245
|
/**
|
232
246
|
* Give a prefix to the attribute name in the resulting JS object
|
233
247
|
*
|
@@ -250,11 +264,19 @@ type XmlBuilderOptions = {
|
|
250
264
|
textNodeName?: string;
|
251
265
|
|
252
266
|
/**
|
253
|
-
* Whether to ignore attributes when
|
267
|
+
* Whether to ignore attributes when building
|
268
|
+
*
|
269
|
+
* When `true` - ignores all the attributes
|
270
|
+
*
|
271
|
+
* When `false` - builds all the attributes
|
272
|
+
*
|
273
|
+
* When `Array<string | RegExp>` - filters out attributes that match provided patterns
|
274
|
+
*
|
275
|
+
* When `Function` - calls the function for each attribute and filters out those for which the function returned `true`
|
254
276
|
*
|
255
277
|
* Defaults to `true`
|
256
278
|
*/
|
257
|
-
ignoreAttributes?: boolean;
|
279
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPath: string) => boolean);
|
258
280
|
|
259
281
|
/**
|
260
282
|
* Give a property name to set CDATA values to instead of merging to tag's text value
|
@@ -373,7 +395,7 @@ type XmlBuilderOptions = {
|
|
373
395
|
|
374
396
|
type ESchema = string | object | Array<string|object>;
|
375
397
|
|
376
|
-
type ValidationError = {
|
398
|
+
export type ValidationError = {
|
377
399
|
err: {
|
378
400
|
code: string;
|
379
401
|
msg: string,
|
@@ -391,6 +413,18 @@ export class XMLParser {
|
|
391
413
|
* @param entityValue {string} Eg: '\r'
|
392
414
|
*/
|
393
415
|
addEntity(entityIdentifier: string, entityValue: string): void;
|
416
|
+
|
417
|
+
/**
|
418
|
+
* Returns a Symbol that can be used to access the {@link XMLMetaData}
|
419
|
+
* property on a node.
|
420
|
+
*
|
421
|
+
* If Symbol is not available in the environment, an ordinary property is used
|
422
|
+
* and the name of the property is here returned.
|
423
|
+
*
|
424
|
+
* The XMLMetaData property is only present when {@link X2jOptions.captureMetaData}
|
425
|
+
* is true in the options.
|
426
|
+
*/
|
427
|
+
static getMetaDataSymbol() : Symbol;
|
394
428
|
}
|
395
429
|
|
396
430
|
export class XMLValidator{
|
@@ -398,5 +432,14 @@ export class XMLValidator{
|
|
398
432
|
}
|
399
433
|
export class XMLBuilder {
|
400
434
|
constructor(options?: XmlBuilderOptions);
|
401
|
-
build(jObj: any):
|
435
|
+
build(jObj: any): string;
|
436
|
+
}
|
437
|
+
|
438
|
+
/**
|
439
|
+
* This object is available on nodes via the symbol {@link XMLParser.getMetaDataSymbol}
|
440
|
+
* when {@link X2jOptions.captureMetaData} is true.
|
441
|
+
*/
|
442
|
+
export interface XMLMetaData {
|
443
|
+
/** The index, if available, of the character where the XML node began in the input stream. */
|
444
|
+
startIndex?: number;
|
402
445
|
}
|
@@ -1,11 +1,14 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
import {validate} from './validator.js';
|
4
|
+
import XMLParser from './xmlparser/XMLParser.js';
|
5
|
+
import XMLBuilder from './xmlbuilder/json2xml.js';
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
const XMLValidator = {
|
8
|
+
validate: validate
|
9
|
+
}
|
10
|
+
export {
|
11
|
+
XMLParser,
|
12
|
+
XMLValidator,
|
13
|
+
XMLBuilder
|
14
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export default function getIgnoreAttributesFn(ignoreAttributes) {
|
2
|
+
if (typeof ignoreAttributes === 'function') {
|
3
|
+
return ignoreAttributes
|
4
|
+
}
|
5
|
+
if (Array.isArray(ignoreAttributes)) {
|
6
|
+
return (attrName) => {
|
7
|
+
for (const pattern of ignoreAttributes) {
|
8
|
+
if (typeof pattern === 'string' && attrName === pattern) {
|
9
|
+
return true
|
10
|
+
}
|
11
|
+
if (pattern instanceof RegExp && pattern.test(attrName)) {
|
12
|
+
return true
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return () => false
|
18
|
+
}
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
|
4
4
|
const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
|
5
|
-
const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*'
|
5
|
+
export const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';
|
6
6
|
const regexName = new RegExp('^' + nameRegexp + '$');
|
7
7
|
|
8
|
-
|
8
|
+
export function getAllMatches(string, regex) {
|
9
9
|
const matches = [];
|
10
10
|
let match = regex.exec(string);
|
11
11
|
while (match) {
|
@@ -19,27 +19,27 @@ const getAllMatches = function(string, regex) {
|
|
19
19
|
match = regex.exec(string);
|
20
20
|
}
|
21
21
|
return matches;
|
22
|
-
}
|
22
|
+
}
|
23
23
|
|
24
|
-
const isName = function(string) {
|
24
|
+
export const isName = function(string) {
|
25
25
|
const match = regexName.exec(string);
|
26
26
|
return !(match === null || typeof match === 'undefined');
|
27
|
-
}
|
27
|
+
}
|
28
28
|
|
29
|
-
|
29
|
+
export function isExist(v) {
|
30
30
|
return typeof v !== 'undefined';
|
31
|
-
}
|
31
|
+
}
|
32
32
|
|
33
|
-
|
33
|
+
export function isEmptyObject(obj) {
|
34
34
|
return Object.keys(obj).length === 0;
|
35
|
-
}
|
35
|
+
}
|
36
36
|
|
37
37
|
/**
|
38
38
|
* Copy all the properties of a into b.
|
39
39
|
* @param {*} target
|
40
40
|
* @param {*} a
|
41
41
|
*/
|
42
|
-
|
42
|
+
export function merge(target, a, arrayMode) {
|
43
43
|
if (a) {
|
44
44
|
const keys = Object.keys(a); // will return an array of own properties
|
45
45
|
const len = keys.length; //don't make it inline
|
@@ -51,22 +51,18 @@ exports.merge = function(target, a, arrayMode) {
|
|
51
51
|
}
|
52
52
|
}
|
53
53
|
}
|
54
|
-
}
|
54
|
+
}
|
55
55
|
/* exports.merge =function (b,a){
|
56
56
|
return Object.assign(b,a);
|
57
57
|
} */
|
58
58
|
|
59
|
-
|
59
|
+
export function getValue(v) {
|
60
60
|
if (exports.isExist(v)) {
|
61
61
|
return v;
|
62
62
|
} else {
|
63
63
|
return '';
|
64
64
|
}
|
65
|
-
}
|
65
|
+
}
|
66
66
|
|
67
67
|
// const fakeCall = function(a) {return a;};
|
68
|
-
// const fakeCallNoReturn = function() {};
|
69
|
-
|
70
|
-
exports.isName = isName;
|
71
|
-
exports.getAllMatches = getAllMatches;
|
72
|
-
exports.nameRegexp = nameRegexp;
|
68
|
+
// const fakeCallNoReturn = function() {};
|
@@ -13,11 +13,10 @@ const htmlEntities = {
|
|
13
13
|
"copyright" : { regex: /&(copy|#169);/g, val: "©" },
|
14
14
|
"reg" : { regex: /&(reg|#174);/g, val: "®" },
|
15
15
|
"inr" : { regex: /&(inr|#8377);/g, val: "₹" },
|
16
|
-
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.
|
17
|
-
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.
|
16
|
+
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 10)) },
|
17
|
+
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 16)) },
|
18
18
|
};
|
19
|
-
|
20
|
-
class EntitiesParser{
|
19
|
+
export default class EntitiesParser{
|
21
20
|
constructor(replaceHtmlEntities) {
|
22
21
|
this.replaceHtmlEntities = replaceHtmlEntities;
|
23
22
|
this.docTypeEntities = {};
|
@@ -103,5 +102,3 @@ function validateEntityName(name){
|
|
103
102
|
}
|
104
103
|
return name;
|
105
104
|
}
|
106
|
-
|
107
|
-
module.exports = EntitiesParser;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
import {JsObjOutputBuilder} from './OutputBuilders/JsObjBuilder.js';
|
3
3
|
|
4
|
-
const defaultOptions = {
|
4
|
+
export const defaultOptions = {
|
5
5
|
preserveOrder: false,
|
6
6
|
removeNSPrefix: false, // remove NS from tag name or attribute name if true
|
7
7
|
//ignoreRootElement : false,
|
@@ -35,7 +35,7 @@ const defaultOptions = {
|
|
35
35
|
OutputBuilder: new JsObjOutputBuilder(),
|
36
36
|
};
|
37
37
|
|
38
|
-
const buildOptions = function(options) {
|
38
|
+
export const buildOptions = function(options) {
|
39
39
|
const finalOptions = { ... defaultOptions};
|
40
40
|
copyProperties(finalOptions,options)
|
41
41
|
return finalOptions;
|
@@ -59,6 +59,3 @@ function copyProperties(target, source) {
|
|
59
59
|
}
|
60
60
|
}
|
61
61
|
}
|
62
|
-
|
63
|
-
exports.buildOptions = buildOptions;
|
64
|
-
exports.defaultOptions = defaultOptions;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
import {buildOptions,registerCommonValueParsers} from './ParserOptionsBuilder.js';
|
2
2
|
|
3
|
-
class OutputBuilder{
|
3
|
+
export default class OutputBuilder{
|
4
4
|
constructor(options){
|
5
5
|
this.options = buildOptions(options);
|
6
6
|
this.registeredParsers = registerCommonValueParsers(this.options);
|
@@ -16,7 +16,7 @@ class OutputBuilder{
|
|
16
16
|
}
|
17
17
|
|
18
18
|
const rootName = '!js_arr';
|
19
|
-
|
19
|
+
import BaseOutputBuilder from './BaseOutputBuilder.js';
|
20
20
|
|
21
21
|
class JsArrBuilder extends BaseOutputBuilder{
|
22
22
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
import {buildOptions,registerCommonValueParsers} from"./ParserOptionsBuilder";
|
2
2
|
|
3
|
-
class OutputBuilder{
|
3
|
+
export default class OutputBuilder{
|
4
4
|
constructor(options){
|
5
5
|
this.options = buildOptions(options);
|
6
6
|
this.registeredParsers = registerCommonValueParsers(this.options);
|
@@ -15,7 +15,7 @@ class OutputBuilder{
|
|
15
15
|
}
|
16
16
|
}
|
17
17
|
|
18
|
-
|
18
|
+
import BaseOutputBuilder from "./BaseOutputBuilder.js";
|
19
19
|
const rootName = '^';
|
20
20
|
|
21
21
|
class JsMinArrBuilder extends BaseOutputBuilder{
|
@@ -98,5 +98,3 @@ class JsMinArrBuilder extends BaseOutputBuilder{
|
|
98
98
|
return this.root[rootName];
|
99
99
|
}
|
100
100
|
}
|
101
|
-
|
102
|
-
module.exports = OutputBuilder;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
|
3
|
+
import {buildOptions,registerCommonValueParsers} from './ParserOptionsBuilder.js';
|
4
4
|
|
5
|
-
class OutputBuilder{
|
5
|
+
export default class OutputBuilder{
|
6
6
|
constructor(builderOptions){
|
7
7
|
this.options = buildOptions(builderOptions);
|
8
8
|
this.registeredParsers = registerCommonValueParsers(this.options);
|
@@ -17,7 +17,7 @@ class OutputBuilder{
|
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
20
|
-
|
20
|
+
import BaseOutputBuilder from './BaseOutputBuilder.js';
|
21
21
|
const rootName = '^';
|
22
22
|
|
23
23
|
class JsObjBuilder extends BaseOutputBuilder{
|
@@ -152,5 +152,3 @@ class JsObjBuilder extends BaseOutputBuilder{
|
|
152
152
|
function isEmpty(obj) {
|
153
153
|
return Object.keys(obj).length === 0;
|
154
154
|
}
|
155
|
-
|
156
|
-
module.exports = OutputBuilder;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import trimParser from "../valueParsers/trim";
|
2
|
+
import booleanParser from "../valueParsers/booleanParser";
|
3
|
+
import currencyParser from "../valueParsers/currency";
|
4
|
+
import numberParser from "../valueParsers/number";
|
5
5
|
|
6
6
|
const defaultOptions={
|
7
7
|
nameFor:{
|
@@ -44,7 +44,7 @@ const defaultOptions={
|
|
44
44
|
const withJoin = ["trim","join", /*"entities",*/"number","boolean","currency"/*, "date"*/]
|
45
45
|
const withoutJoin = ["trim", /*"entities",*/"number","boolean","currency"/*, "date"*/]
|
46
46
|
|
47
|
-
function buildOptions(options){
|
47
|
+
export function buildOptions(options){
|
48
48
|
//clone
|
49
49
|
const finalOptions = { ... defaultOptions};
|
50
50
|
|
@@ -78,7 +78,7 @@ function copyProperties(target, source) {
|
|
78
78
|
}
|
79
79
|
}
|
80
80
|
|
81
|
-
function registerCommonValueParsers(options){
|
81
|
+
export function registerCommonValueParsers(options){
|
82
82
|
return {
|
83
83
|
"trim": new trimParser(),
|
84
84
|
// "join": this.entityParser.parse,
|
@@ -92,8 +92,3 @@ function registerCommonValueParsers(options){
|
|
92
92
|
// "date": this.entityParser.parse,
|
93
93
|
}
|
94
94
|
}
|
95
|
-
|
96
|
-
module.exports = {
|
97
|
-
buildOptions : buildOptions,
|
98
|
-
registerCommonValueParsers: registerCommonValueParsers
|
99
|
-
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
import {TagPath} from './TagPath.js';
|
2
2
|
|
3
|
-
class TagPathMatcher{
|
3
|
+
export default class TagPathMatcher{
|
4
4
|
constructor(stack,node){
|
5
5
|
this.stack = stack;
|
6
6
|
this.node= node;
|
@@ -10,6 +10,4 @@ class TagPathMatcher{
|
|
10
10
|
const tagPath = new TagPath(path);
|
11
11
|
return tagPath.match(this.stack, this.node);
|
12
12
|
}
|
13
|
-
}
|
14
|
-
|
15
|
-
module.exports = TagPathMatcher;
|
13
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import { buildOptions} from './OptionsBuilder.js';
|
2
|
+
import Xml2JsParser from './Xml2JsParser.js';
|
3
3
|
|
4
|
-
class XMLParser{
|
4
|
+
export default class XMLParser{
|
5
5
|
|
6
6
|
constructor(options){
|
7
7
|
this.externalEntities = {};
|
@@ -81,5 +81,3 @@ function isStream(stream){
|
|
81
81
|
if(stream && typeof stream.read === "function" && typeof stream.on === "function" && typeof stream.readableEnded === "boolean") return true;
|
82
82
|
return false;
|
83
83
|
}
|
84
|
-
|
85
|
-
module.exports = XMLParser;
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
import StringSource from './inputSource/StringSource.js';
|
2
|
+
import BufferSource from './inputSource/BufferSource.js';
|
3
|
+
import {readTagExp,readClosingTagName} from './XmlPartReader.js';
|
4
|
+
import {readComment, readCdata,readDocType,readPiTag} from './XmlSpecialTagsReader.js';
|
5
|
+
import TagPath from './TagPath.js';
|
6
|
+
import TagPathMatcher from './TagPathMatcher.js';
|
7
|
+
import EntitiesParser from './EntitiesParser.js';
|
8
8
|
|
9
9
|
//To hold the data of current tag
|
10
10
|
//This is usually used to compare jpath expression against current tag
|
@@ -16,7 +16,7 @@ class TagDetail{
|
|
16
16
|
}
|
17
17
|
}
|
18
18
|
|
19
|
-
class Xml2JsParser {
|
19
|
+
export default class Xml2JsParser {
|
20
20
|
constructor(options) {
|
21
21
|
this.options = options;
|
22
22
|
|
@@ -233,5 +233,3 @@ function resolveNameSpace(name, removeNSPrefix) {
|
|
233
233
|
}
|
234
234
|
return name;
|
235
235
|
}
|
236
|
-
|
237
|
-
module.exports = Xml2JsParser;
|