@jentic/arazzo-parser 1.0.0-alpha.3 → 1.0.0-alpha.5
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/CHANGELOG.md +12 -0
- package/README.md +95 -21
- package/dist/jentic-arazzo-parser.browser.js +221 -200
- package/dist/jentic-arazzo-parser.browser.min.js +1 -1
- package/package.json +9 -9
- package/src/index.cjs +54 -59
- package/src/index.mjs +54 -58
- package/types/arazzo-parser.d.ts +12 -33
- package/dist/937fc7a248317278ae14.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jentic/arazzo-parser",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"description": "Parser for Arazzo Documents producing SpecLynx ApiDOM data model.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arazzo",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"license": "Apache-2.0",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
51
|
-
"@speclynx/apidom-datamodel": "
|
|
52
|
-
"@speclynx/apidom-error": "
|
|
53
|
-
"@speclynx/apidom-ns-arazzo-1": "
|
|
54
|
-
"@speclynx/apidom-parser": "
|
|
55
|
-
"@speclynx/apidom-parser-adapter-arazzo-json-1": "
|
|
56
|
-
"@speclynx/apidom-parser-adapter-arazzo-yaml-1": "
|
|
57
|
-
"@speclynx/apidom-reference": "
|
|
51
|
+
"@speclynx/apidom-datamodel": "2.5.1",
|
|
52
|
+
"@speclynx/apidom-error": "2.5.1",
|
|
53
|
+
"@speclynx/apidom-ns-arazzo-1": "2.5.1",
|
|
54
|
+
"@speclynx/apidom-parser": "2.5.1",
|
|
55
|
+
"@speclynx/apidom-parser-adapter-arazzo-json-1": "2.5.1",
|
|
56
|
+
"@speclynx/apidom-parser-adapter-arazzo-yaml-1": "2.5.1",
|
|
57
|
+
"@speclynx/apidom-reference": "2.5.1",
|
|
58
58
|
"ramda-adjunct": "^6.0.0"
|
|
59
59
|
},
|
|
60
60
|
"files": [
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"README.md",
|
|
68
68
|
"CHANGELOG.md"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "65bd559465321bc72189e7367e5465b2d91565be"
|
|
71
71
|
}
|
package/src/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.
|
|
6
|
+
exports.defaultOptions = void 0;
|
|
7
7
|
exports.parse = parse;
|
|
8
8
|
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
9
9
|
var _apidomNsArazzo = require("@speclynx/apidom-ns-arazzo-1");
|
|
@@ -18,19 +18,30 @@ var _httpAxios = _interopRequireDefault(require("@speclynx/apidom-reference/reso
|
|
|
18
18
|
var _ramdaAdjunct = require("ramda-adjunct");
|
|
19
19
|
var _ParseError = _interopRequireDefault(require("./errors/ParseError.cjs"));
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Default reference options for parsing Arazzo Documents.
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
const defaultOptions = exports.defaultOptions = {
|
|
25
|
+
parse: {
|
|
26
|
+
parsers: [new _arazzoJson.default({
|
|
27
|
+
allowEmpty: false,
|
|
28
|
+
sourceMap: false
|
|
29
|
+
}), new _arazzoYaml.default({
|
|
30
|
+
allowEmpty: false,
|
|
31
|
+
sourceMap: false
|
|
32
|
+
})],
|
|
33
|
+
parserOpts: {}
|
|
34
|
+
},
|
|
35
|
+
resolve: {
|
|
36
|
+
resolvers: [new _file.default({
|
|
37
|
+
fileAllowList: ['*.json', '*.yaml', '*.yml']
|
|
38
|
+
}), new _httpAxios.default({
|
|
39
|
+
timeout: 5000,
|
|
40
|
+
redirects: 5,
|
|
41
|
+
withCredentials: false
|
|
42
|
+
})],
|
|
43
|
+
resolverOpts: {}
|
|
44
|
+
}
|
|
34
45
|
};
|
|
35
46
|
const parser = new _apidomParser.default();
|
|
36
47
|
parser.use(jsonParserAdapter);
|
|
@@ -39,7 +50,7 @@ parser.use(yamlParserAdapter);
|
|
|
39
50
|
/**
|
|
40
51
|
* Parses an Arazzo Document from an object.
|
|
41
52
|
* @param source - The Arazzo Document as a plain object
|
|
42
|
-
* @param options -
|
|
53
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
43
54
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
44
55
|
* @public
|
|
45
56
|
*/
|
|
@@ -47,7 +58,7 @@ parser.use(yamlParserAdapter);
|
|
|
47
58
|
/**
|
|
48
59
|
* Parses an Arazzo Document from a string or URI.
|
|
49
60
|
* @param source - The Arazzo Document as string content, or a file system path / HTTP(S) URL
|
|
50
|
-
* @param options -
|
|
61
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
51
62
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
52
63
|
* @throws ParseError - When parsing fails for any reason. The original error is available via the `cause` property.
|
|
53
64
|
* @public
|
|
@@ -62,42 +73,47 @@ parser.use(yamlParserAdapter);
|
|
|
62
73
|
* 3. URI string - treats as a file system path or HTTP(S) URL and resolves the document
|
|
63
74
|
*
|
|
64
75
|
* @param source - The Arazzo Document as an object, string content, or a file system path / HTTP(S) URL
|
|
65
|
-
* @param options -
|
|
76
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
66
77
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
67
78
|
* @throws ParseError - When parsing fails for any reason. The original error is available via the `cause` property.
|
|
68
79
|
*
|
|
69
80
|
* @example
|
|
70
|
-
*
|
|
71
|
-
*
|
|
81
|
+
* Parse from object
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const result = await parse({ arazzo: '1.0.1', info: {...} });
|
|
84
|
+
* ```
|
|
72
85
|
*
|
|
73
86
|
* @example
|
|
74
|
-
*
|
|
75
|
-
*
|
|
87
|
+
* Parse inline JSON
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const result = await parse('{"arazzo": "1.0.1", "info": {...}}');
|
|
90
|
+
* ```
|
|
76
91
|
*
|
|
77
92
|
* @example
|
|
78
|
-
*
|
|
93
|
+
* Parse from file
|
|
94
|
+
* ```typescript
|
|
79
95
|
* const result = await parse('/path/to/arazzo.json');
|
|
96
|
+
* ```
|
|
80
97
|
*
|
|
81
98
|
* @example
|
|
82
|
-
*
|
|
99
|
+
* Parse from URL
|
|
100
|
+
* ```typescript
|
|
83
101
|
* const result = await parse('https://example.com/arazzo.yaml');
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* Parse with custom options
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const result = await parse('/path/to/arazzo.json', customOptions);
|
|
108
|
+
* ```
|
|
84
109
|
* @public
|
|
85
110
|
*/
|
|
86
111
|
async function parse(source, options = {}) {
|
|
87
|
-
const mergedOptions =
|
|
88
|
-
...defaultParseOptions,
|
|
89
|
-
...options
|
|
90
|
-
};
|
|
91
|
-
const {
|
|
92
|
-
strict,
|
|
93
|
-
sourceMap,
|
|
94
|
-
parserOpts,
|
|
95
|
-
resolverOpts
|
|
96
|
-
} = mergedOptions;
|
|
112
|
+
const mergedOptions = (0, _empty.mergeOptions)(defaultOptions, options);
|
|
97
113
|
|
|
98
114
|
// attempt to parse source as plain object
|
|
99
115
|
if ((0, _ramdaAdjunct.isPlainObject)(source)) {
|
|
100
|
-
if (sourceMap) {
|
|
116
|
+
if (mergedOptions.parse?.parserOpts?.sourceMap) {
|
|
101
117
|
throw new _ParseError.default('sourceMap option is not supported when parsing from object: source maps cannot be inferred from plain objects');
|
|
102
118
|
}
|
|
103
119
|
const parseResult = new _apidomDatamodel.ParseResultElement();
|
|
@@ -110,8 +126,8 @@ async function parse(source, options = {}) {
|
|
|
110
126
|
// next try to parse the source assuming it contains Arazzo Document
|
|
111
127
|
try {
|
|
112
128
|
return await parser.parse(source, {
|
|
113
|
-
sourceMap,
|
|
114
|
-
strict
|
|
129
|
+
sourceMap: mergedOptions.parse?.parserOpts?.sourceMap,
|
|
130
|
+
strict: mergedOptions.parse?.parserOpts?.strict
|
|
115
131
|
});
|
|
116
132
|
} catch (error) {
|
|
117
133
|
if (error instanceof _apidomParser.ParserError && error.message !== 'Source did not match any registered parsers') {
|
|
@@ -123,32 +139,11 @@ async function parse(source, options = {}) {
|
|
|
123
139
|
|
|
124
140
|
// next we assume that source is either file system URI or HTTP(S) URL
|
|
125
141
|
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
allowEmpty: false,
|
|
130
|
-
sourceMap,
|
|
131
|
-
strict
|
|
132
|
-
}), new _arazzoYaml.default({
|
|
133
|
-
allowEmpty: false,
|
|
134
|
-
sourceMap,
|
|
135
|
-
strict
|
|
136
|
-
})],
|
|
137
|
-
parserOpts
|
|
138
|
-
},
|
|
139
|
-
resolve: {
|
|
140
|
-
resolvers: [new _file.default({
|
|
141
|
-
fileAllowList: ['*.json', '*.yaml', '*.yml']
|
|
142
|
-
}), new _httpAxios.default({
|
|
143
|
-
timeout: 5000,
|
|
144
|
-
redirects: 5,
|
|
145
|
-
withCredentials: false
|
|
146
|
-
})],
|
|
147
|
-
resolverOpts
|
|
148
|
-
}
|
|
149
|
-
});
|
|
142
|
+
const parseResult = await (0, _empty.parse)(source, mergedOptions);
|
|
143
|
+
parseResult.meta.set('retrievalURI', source);
|
|
144
|
+
return parseResult;
|
|
150
145
|
} catch (error) {
|
|
151
|
-
throw new _ParseError.default(
|
|
146
|
+
throw new _ParseError.default(`Failed to parse Arazzo Document from "${source}"`, {
|
|
152
147
|
cause: error
|
|
153
148
|
});
|
|
154
149
|
}
|
package/src/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { refractArazzoSpecification1 } from '@speclynx/apidom-ns-arazzo-1';
|
|
|
3
3
|
import ApiDOMParser, { ParserError } from '@speclynx/apidom-parser';
|
|
4
4
|
import * as jsonParserAdapter from '@speclynx/apidom-parser-adapter-arazzo-json-1';
|
|
5
5
|
import * as yamlParserAdapter from '@speclynx/apidom-parser-adapter-arazzo-yaml-1';
|
|
6
|
-
import { parse as parseURI } from '@speclynx/apidom-reference/configuration/empty';
|
|
6
|
+
import { parse as parseURI, mergeOptions } from '@speclynx/apidom-reference/configuration/empty';
|
|
7
7
|
import ArazzoJSON1Parser from '@speclynx/apidom-reference/parse/parsers/arazzo-json-1';
|
|
8
8
|
import ArazzoYAML1Parser from '@speclynx/apidom-reference/parse/parsers/arazzo-yaml-1';
|
|
9
9
|
import FileResolver from '@speclynx/apidom-reference/resolve/resolvers/file';
|
|
@@ -11,18 +11,30 @@ import HTTPResolverAxios from '@speclynx/apidom-reference/resolve/resolvers/http
|
|
|
11
11
|
import { isPlainObject } from 'ramda-adjunct';
|
|
12
12
|
import ParseError from "./errors/ParseError.mjs";
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Default reference options for parsing Arazzo Documents.
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
export const defaultOptions = {
|
|
18
|
+
parse: {
|
|
19
|
+
parsers: [new ArazzoJSON1Parser({
|
|
20
|
+
allowEmpty: false,
|
|
21
|
+
sourceMap: false
|
|
22
|
+
}), new ArazzoYAML1Parser({
|
|
23
|
+
allowEmpty: false,
|
|
24
|
+
sourceMap: false
|
|
25
|
+
})],
|
|
26
|
+
parserOpts: {}
|
|
27
|
+
},
|
|
28
|
+
resolve: {
|
|
29
|
+
resolvers: [new FileResolver({
|
|
30
|
+
fileAllowList: ['*.json', '*.yaml', '*.yml']
|
|
31
|
+
}), new HTTPResolverAxios({
|
|
32
|
+
timeout: 5000,
|
|
33
|
+
redirects: 5,
|
|
34
|
+
withCredentials: false
|
|
35
|
+
})],
|
|
36
|
+
resolverOpts: {}
|
|
37
|
+
}
|
|
26
38
|
};
|
|
27
39
|
const parser = new ApiDOMParser();
|
|
28
40
|
parser.use(jsonParserAdapter);
|
|
@@ -31,7 +43,7 @@ parser.use(yamlParserAdapter);
|
|
|
31
43
|
/**
|
|
32
44
|
* Parses an Arazzo Document from an object.
|
|
33
45
|
* @param source - The Arazzo Document as a plain object
|
|
34
|
-
* @param options -
|
|
46
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
35
47
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
36
48
|
* @public
|
|
37
49
|
*/
|
|
@@ -39,7 +51,7 @@ parser.use(yamlParserAdapter);
|
|
|
39
51
|
/**
|
|
40
52
|
* Parses an Arazzo Document from a string or URI.
|
|
41
53
|
* @param source - The Arazzo Document as string content, or a file system path / HTTP(S) URL
|
|
42
|
-
* @param options -
|
|
54
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
43
55
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
44
56
|
* @throws ParseError - When parsing fails for any reason. The original error is available via the `cause` property.
|
|
45
57
|
* @public
|
|
@@ -54,42 +66,47 @@ parser.use(yamlParserAdapter);
|
|
|
54
66
|
* 3. URI string - treats as a file system path or HTTP(S) URL and resolves the document
|
|
55
67
|
*
|
|
56
68
|
* @param source - The Arazzo Document as an object, string content, or a file system path / HTTP(S) URL
|
|
57
|
-
* @param options -
|
|
69
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
58
70
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
59
71
|
* @throws ParseError - When parsing fails for any reason. The original error is available via the `cause` property.
|
|
60
72
|
*
|
|
61
73
|
* @example
|
|
62
|
-
*
|
|
63
|
-
*
|
|
74
|
+
* Parse from object
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const result = await parse({ arazzo: '1.0.1', info: {...} });
|
|
77
|
+
* ```
|
|
64
78
|
*
|
|
65
79
|
* @example
|
|
66
|
-
*
|
|
67
|
-
*
|
|
80
|
+
* Parse inline JSON
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const result = await parse('{"arazzo": "1.0.1", "info": {...}}');
|
|
83
|
+
* ```
|
|
68
84
|
*
|
|
69
85
|
* @example
|
|
70
|
-
*
|
|
86
|
+
* Parse from file
|
|
87
|
+
* ```typescript
|
|
71
88
|
* const result = await parse('/path/to/arazzo.json');
|
|
89
|
+
* ```
|
|
72
90
|
*
|
|
73
91
|
* @example
|
|
74
|
-
*
|
|
92
|
+
* Parse from URL
|
|
93
|
+
* ```typescript
|
|
75
94
|
* const result = await parse('https://example.com/arazzo.yaml');
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* Parse with custom options
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const result = await parse('/path/to/arazzo.json', customOptions);
|
|
101
|
+
* ```
|
|
76
102
|
* @public
|
|
77
103
|
*/
|
|
78
104
|
export async function parse(source, options = {}) {
|
|
79
|
-
const mergedOptions =
|
|
80
|
-
...defaultParseOptions,
|
|
81
|
-
...options
|
|
82
|
-
};
|
|
83
|
-
const {
|
|
84
|
-
strict,
|
|
85
|
-
sourceMap,
|
|
86
|
-
parserOpts,
|
|
87
|
-
resolverOpts
|
|
88
|
-
} = mergedOptions;
|
|
105
|
+
const mergedOptions = mergeOptions(defaultOptions, options);
|
|
89
106
|
|
|
90
107
|
// attempt to parse source as plain object
|
|
91
108
|
if (isPlainObject(source)) {
|
|
92
|
-
if (sourceMap) {
|
|
109
|
+
if (mergedOptions.parse?.parserOpts?.sourceMap) {
|
|
93
110
|
throw new ParseError('sourceMap option is not supported when parsing from object: source maps cannot be inferred from plain objects');
|
|
94
111
|
}
|
|
95
112
|
const parseResult = new ParseResultElement();
|
|
@@ -102,8 +119,8 @@ export async function parse(source, options = {}) {
|
|
|
102
119
|
// next try to parse the source assuming it contains Arazzo Document
|
|
103
120
|
try {
|
|
104
121
|
return await parser.parse(source, {
|
|
105
|
-
sourceMap,
|
|
106
|
-
strict
|
|
122
|
+
sourceMap: mergedOptions.parse?.parserOpts?.sourceMap,
|
|
123
|
+
strict: mergedOptions.parse?.parserOpts?.strict
|
|
107
124
|
});
|
|
108
125
|
} catch (error) {
|
|
109
126
|
if (error instanceof ParserError && error.message !== 'Source did not match any registered parsers') {
|
|
@@ -115,32 +132,11 @@ export async function parse(source, options = {}) {
|
|
|
115
132
|
|
|
116
133
|
// next we assume that source is either file system URI or HTTP(S) URL
|
|
117
134
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
allowEmpty: false,
|
|
122
|
-
sourceMap,
|
|
123
|
-
strict
|
|
124
|
-
}), new ArazzoYAML1Parser({
|
|
125
|
-
allowEmpty: false,
|
|
126
|
-
sourceMap,
|
|
127
|
-
strict
|
|
128
|
-
})],
|
|
129
|
-
parserOpts
|
|
130
|
-
},
|
|
131
|
-
resolve: {
|
|
132
|
-
resolvers: [new FileResolver({
|
|
133
|
-
fileAllowList: ['*.json', '*.yaml', '*.yml']
|
|
134
|
-
}), new HTTPResolverAxios({
|
|
135
|
-
timeout: 5000,
|
|
136
|
-
redirects: 5,
|
|
137
|
-
withCredentials: false
|
|
138
|
-
})],
|
|
139
|
-
resolverOpts
|
|
140
|
-
}
|
|
141
|
-
});
|
|
135
|
+
const parseResult = await parseURI(source, mergedOptions);
|
|
136
|
+
parseResult.meta.set('retrievalURI', source);
|
|
137
|
+
return parseResult;
|
|
142
138
|
} catch (error) {
|
|
143
|
-
throw new ParseError(
|
|
139
|
+
throw new ParseError(`Failed to parse Arazzo Document from "${source}"`, {
|
|
144
140
|
cause: error
|
|
145
141
|
});
|
|
146
142
|
}
|
package/types/arazzo-parser.d.ts
CHANGED
|
@@ -1,56 +1,35 @@
|
|
|
1
|
+
import type { ApiDOMReferenceOptions } from '@speclynx/apidom-reference';
|
|
1
2
|
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* Default options for parsing Arazzo Documents.
|
|
5
|
+
* Default reference options for parsing Arazzo Documents.
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const defaultOptions: Options;
|
|
9
|
+
|
|
10
|
+
declare type Options = PartialDeep<ApiDOMReferenceOptions>;
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Parses an Arazzo Document from an object.
|
|
11
14
|
* @param source - The Arazzo Document as a plain object
|
|
12
|
-
* @param options -
|
|
15
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
13
16
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
14
17
|
* @public
|
|
15
18
|
*/
|
|
16
|
-
export declare function parse(source: Record<string, unknown>, options?:
|
|
19
|
+
export declare function parse(source: Record<string, unknown>, options?: Options): Promise<ParseResultElement>;
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Parses an Arazzo Document from a string or URI.
|
|
20
23
|
* @param source - The Arazzo Document as string content, or a file system path / HTTP(S) URL
|
|
21
|
-
* @param options -
|
|
24
|
+
* @param options - Reference options (uses defaultOptions when not provided)
|
|
22
25
|
* @returns A promise that resolves to the parsed Arazzo Document as ApiDOM data model
|
|
23
26
|
* @throws ParseError - When parsing fails for any reason. The original error is available via the `cause` property.
|
|
24
27
|
* @public
|
|
25
28
|
*/
|
|
26
|
-
export declare function parse(source: string, options?:
|
|
29
|
+
export declare function parse(source: string, options?: Options): Promise<ParseResultElement>;
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*/
|
|
32
|
-
export declare interface ParseOptions {
|
|
33
|
-
/**
|
|
34
|
-
* Whether to enforce strict parsing mode.
|
|
35
|
-
* Strict parsing mode is using native JSON and YAML parsers without source maps and error recovery.
|
|
36
|
-
* @defaultValue true
|
|
37
|
-
*/
|
|
38
|
-
readonly strict?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Whether to include source maps in the parsed result.
|
|
41
|
-
* @defaultValue false
|
|
42
|
-
*/
|
|
43
|
-
readonly sourceMap?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Additional options passed to the underlying parsers.
|
|
46
|
-
* @defaultValue \{\}
|
|
47
|
-
*/
|
|
48
|
-
readonly parserOpts?: Record<string, unknown>;
|
|
49
|
-
/**
|
|
50
|
-
* Additional options passed to the underlying resolvers.
|
|
51
|
-
* @defaultValue \{\}
|
|
52
|
-
*/
|
|
53
|
-
readonly resolverOpts?: Record<string, unknown>;
|
|
54
|
-
}
|
|
31
|
+
declare type PartialDeep<T> = {
|
|
32
|
+
[P in keyof T]?: T[P] extends object ? PartialDeep<T[P]> : T[P];
|
|
33
|
+
};
|
|
55
34
|
|
|
56
35
|
export { }
|
|
Binary file
|