@speclynx/apidom-reference 4.0.2 → 4.0.3
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 +6 -0
- package/package.json +26 -27
- package/src/File.cjs +50 -0
- package/src/File.mjs +44 -0
- package/src/File.ts +63 -0
- package/src/Reference.cjs +31 -0
- package/src/Reference.mjs +27 -0
- package/src/Reference.ts +38 -0
- package/src/ReferenceSet.cjs +60 -0
- package/src/ReferenceSet.mjs +57 -0
- package/src/ReferenceSet.ts +73 -0
- package/src/bundle/index.cjs +61 -0
- package/src/bundle/index.mjs +55 -0
- package/src/bundle/index.ts +57 -0
- package/src/bundle/strategies/BundleStrategy.cjs +20 -0
- package/src/bundle/strategies/BundleStrategy.mjs +16 -0
- package/src/bundle/strategies/BundleStrategy.ts +27 -0
- package/src/bundle/strategies/openapi-3-1/index.cjs +35 -0
- package/src/bundle/strategies/openapi-3-1/index.mjs +29 -0
- package/src/bundle/strategies/openapi-3-1/index.ts +57 -0
- package/src/configuration/empty.cjs +9 -0
- package/src/configuration/empty.mjs +1 -0
- package/src/configuration/empty.ts +1 -0
- package/src/configuration/saturated.cjs +88 -0
- package/src/configuration/saturated.mjs +80 -0
- package/src/configuration/saturated.ts +72 -0
- package/src/dereference/index.cjs +90 -0
- package/src/dereference/index.mjs +83 -0
- package/src/dereference/index.ts +96 -0
- package/src/dereference/strategies/DereferenceStrategy.cjs +20 -0
- package/src/dereference/strategies/DereferenceStrategy.mjs +16 -0
- package/src/dereference/strategies/DereferenceStrategy.ts +27 -0
- package/src/dereference/strategies/apidom/index.cjs +89 -0
- package/src/dereference/strategies/apidom/index.mjs +83 -0
- package/src/dereference/strategies/apidom/index.ts +128 -0
- package/src/dereference/strategies/apidom/selectors/element-id.cjs +47 -0
- package/src/dereference/strategies/apidom/selectors/element-id.mjs +41 -0
- package/src/dereference/strategies/apidom/selectors/element-id.ts +48 -0
- package/src/dereference/strategies/apidom/visitor.cjs +266 -0
- package/src/dereference/strategies/apidom/visitor.mjs +259 -0
- package/src/dereference/strategies/apidom/visitor.ts +316 -0
- package/src/dereference/strategies/arazzo-1/index.cjs +109 -0
- package/src/dereference/strategies/arazzo-1/index.mjs +100 -0
- package/src/dereference/strategies/arazzo-1/index.ts +158 -0
- package/src/dereference/strategies/arazzo-1/selectors/$anchor.cjs +12 -0
- package/src/dereference/strategies/arazzo-1/selectors/$anchor.mjs +1 -0
- package/src/dereference/strategies/arazzo-1/selectors/$anchor.ts +9 -0
- package/src/dereference/strategies/arazzo-1/selectors/uri.cjs +8 -0
- package/src/dereference/strategies/arazzo-1/selectors/uri.mjs +1 -0
- package/src/dereference/strategies/arazzo-1/selectors/uri.ts +5 -0
- package/src/dereference/strategies/arazzo-1/source-descriptions.cjs +248 -0
- package/src/dereference/strategies/arazzo-1/source-descriptions.mjs +243 -0
- package/src/dereference/strategies/arazzo-1/source-descriptions.ts +317 -0
- package/src/dereference/strategies/arazzo-1/util.cjs +37 -0
- package/src/dereference/strategies/arazzo-1/util.mjs +29 -0
- package/src/dereference/strategies/arazzo-1/util.ts +33 -0
- package/src/dereference/strategies/arazzo-1/visitor.cjs +507 -0
- package/src/dereference/strategies/arazzo-1/visitor.mjs +500 -0
- package/src/dereference/strategies/arazzo-1/visitor.ts +574 -0
- package/src/dereference/strategies/asyncapi-2/index.cjs +94 -0
- package/src/dereference/strategies/asyncapi-2/index.mjs +88 -0
- package/src/dereference/strategies/asyncapi-2/index.ts +133 -0
- package/src/dereference/strategies/asyncapi-2/visitor.cjs +501 -0
- package/src/dereference/strategies/asyncapi-2/visitor.mjs +494 -0
- package/src/dereference/strategies/asyncapi-2/visitor.ts +589 -0
- package/src/dereference/strategies/openapi-2/index.cjs +96 -0
- package/src/dereference/strategies/openapi-2/index.mjs +90 -0
- package/src/dereference/strategies/openapi-2/index.ts +136 -0
- package/src/dereference/strategies/openapi-2/visitor.cjs +629 -0
- package/src/dereference/strategies/openapi-2/visitor.mjs +622 -0
- package/src/dereference/strategies/openapi-2/visitor.ts +745 -0
- package/src/dereference/strategies/openapi-3-0/index.cjs +96 -0
- package/src/dereference/strategies/openapi-3-0/index.mjs +90 -0
- package/src/dereference/strategies/openapi-3-0/index.ts +134 -0
- package/src/dereference/strategies/openapi-3-0/visitor.cjs +622 -0
- package/src/dereference/strategies/openapi-3-0/visitor.mjs +615 -0
- package/src/dereference/strategies/openapi-3-0/visitor.ts +760 -0
- package/src/dereference/strategies/openapi-3-1/index.cjs +99 -0
- package/src/dereference/strategies/openapi-3-1/index.mjs +90 -0
- package/src/dereference/strategies/openapi-3-1/index.ts +141 -0
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +65 -0
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +54 -0
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.ts +64 -0
- package/src/dereference/strategies/openapi-3-1/selectors/uri.cjs +50 -0
- package/src/dereference/strategies/openapi-3-1/selectors/uri.mjs +42 -0
- package/src/dereference/strategies/openapi-3-1/selectors/uri.ts +54 -0
- package/src/dereference/strategies/openapi-3-1/util.cjs +68 -0
- package/src/dereference/strategies/openapi-3-1/util.mjs +59 -0
- package/src/dereference/strategies/openapi-3-1/util.ts +83 -0
- package/src/dereference/strategies/openapi-3-1/visitor.cjs +874 -0
- package/src/dereference/strategies/openapi-3-1/visitor.mjs +867 -0
- package/src/dereference/strategies/openapi-3-1/visitor.ts +1053 -0
- package/src/dereference/util.cjs +31 -0
- package/src/dereference/util.mjs +27 -0
- package/src/dereference/util.ts +29 -0
- package/src/errors/BundleError.cjs +10 -0
- package/src/errors/BundleError.mjs +7 -0
- package/src/errors/BundleError.ts +8 -0
- package/src/errors/DereferenceError.cjs +10 -0
- package/src/errors/DereferenceError.mjs +7 -0
- package/src/errors/DereferenceError.ts +8 -0
- package/src/errors/EvaluationElementIdError.cjs +10 -0
- package/src/errors/EvaluationElementIdError.mjs +7 -0
- package/src/errors/EvaluationElementIdError.ts +8 -0
- package/src/errors/EvaluationJsonSchema$anchorError.cjs +11 -0
- package/src/errors/EvaluationJsonSchema$anchorError.mjs +6 -0
- package/src/errors/EvaluationJsonSchema$anchorError.ts +8 -0
- package/src/errors/EvaluationJsonSchemaUriError.cjs +11 -0
- package/src/errors/EvaluationJsonSchemaUriError.mjs +6 -0
- package/src/errors/EvaluationJsonSchemaUriError.ts +8 -0
- package/src/errors/InvalidJsonSchema$anchorError.cjs +15 -0
- package/src/errors/InvalidJsonSchema$anchorError.mjs +10 -0
- package/src/errors/InvalidJsonSchema$anchorError.ts +12 -0
- package/src/errors/JsonSchema$anchorError.cjs +10 -0
- package/src/errors/JsonSchema$anchorError.mjs +7 -0
- package/src/errors/JsonSchema$anchorError.ts +8 -0
- package/src/errors/JsonSchemaUriError.cjs +10 -0
- package/src/errors/JsonSchemaUriError.mjs +7 -0
- package/src/errors/JsonSchemaUriError.ts +8 -0
- package/src/errors/MaximumBundleDepthError.cjs +11 -0
- package/src/errors/MaximumBundleDepthError.mjs +6 -0
- package/src/errors/MaximumBundleDepthError.ts +8 -0
- package/src/errors/MaximumDereferenceDepthError.cjs +11 -0
- package/src/errors/MaximumDereferenceDepthError.mjs +6 -0
- package/src/errors/MaximumDereferenceDepthError.ts +8 -0
- package/src/errors/MaximumResolveDepthError.cjs +11 -0
- package/src/errors/MaximumResolveDepthError.mjs +6 -0
- package/src/errors/MaximumResolveDepthError.ts +8 -0
- package/src/errors/ParseError.cjs +10 -0
- package/src/errors/ParseError.mjs +7 -0
- package/src/errors/ParseError.ts +8 -0
- package/src/errors/ParserError.cjs +11 -0
- package/src/errors/ParserError.mjs +6 -0
- package/src/errors/ParserError.ts +8 -0
- package/src/errors/PluginError.cjs +18 -0
- package/src/errors/PluginError.mjs +15 -0
- package/src/errors/PluginError.ts +15 -0
- package/src/errors/ResolveError.cjs +10 -0
- package/src/errors/ResolveError.mjs +7 -0
- package/src/errors/ResolveError.ts +8 -0
- package/src/errors/ResolverError.cjs +11 -0
- package/src/errors/ResolverError.mjs +6 -0
- package/src/errors/ResolverError.ts +8 -0
- package/src/errors/UnmatchedBundleStrategyError.cjs +11 -0
- package/src/errors/UnmatchedBundleStrategyError.mjs +6 -0
- package/src/errors/UnmatchedBundleStrategyError.ts +8 -0
- package/src/errors/UnmatchedDereferenceStrategyError.cjs +11 -0
- package/src/errors/UnmatchedDereferenceStrategyError.mjs +6 -0
- package/src/errors/UnmatchedDereferenceStrategyError.ts +8 -0
- package/src/errors/UnmatchedParserError.cjs +11 -0
- package/src/errors/UnmatchedParserError.mjs +6 -0
- package/src/errors/UnmatchedParserError.ts +8 -0
- package/src/errors/UnmatchedResolveStrategyError.cjs +11 -0
- package/src/errors/UnmatchedResolveStrategyError.mjs +6 -0
- package/src/errors/UnmatchedResolveStrategyError.ts +8 -0
- package/src/errors/UnmatchedResolverError.cjs +11 -0
- package/src/errors/UnmatchedResolverError.mjs +6 -0
- package/src/errors/UnmatchedResolverError.ts +8 -0
- package/src/errors/UnresolvableReferenceError.cjs +11 -0
- package/src/errors/UnresolvableReferenceError.mjs +6 -0
- package/src/errors/UnresolvableReferenceError.ts +8 -0
- package/src/index.cjs +146 -0
- package/src/index.mjs +103 -0
- package/src/index.ts +135 -0
- package/src/options/index.cjs +194 -0
- package/src/options/index.mjs +191 -0
- package/src/options/index.ts +239 -0
- package/src/options/util.cjs +24 -0
- package/src/options/util.mjs +19 -0
- package/src/options/util.ts +22 -0
- package/src/parse/index.cjs +69 -0
- package/src/parse/index.mjs +63 -0
- package/src/parse/index.ts +67 -0
- package/src/parse/parsers/Parser.cjs +62 -0
- package/src/parse/parsers/Parser.mjs +58 -0
- package/src/parse/parsers/Parser.ts +80 -0
- package/src/parse/parsers/apidom-json/index.cjs +70 -0
- package/src/parse/parsers/apidom-json/index.mjs +64 -0
- package/src/parse/parsers/apidom-json/index.ts +78 -0
- package/src/parse/parsers/arazzo-json-1/index.cjs +62 -0
- package/src/parse/parsers/arazzo-json-1/index.mjs +56 -0
- package/src/parse/parsers/arazzo-json-1/index.ts +76 -0
- package/src/parse/parsers/arazzo-json-1/source-descriptions.cjs +221 -0
- package/src/parse/parsers/arazzo-json-1/source-descriptions.mjs +214 -0
- package/src/parse/parsers/arazzo-json-1/source-descriptions.ts +280 -0
- package/src/parse/parsers/arazzo-yaml-1/index.cjs +62 -0
- package/src/parse/parsers/arazzo-yaml-1/index.mjs +56 -0
- package/src/parse/parsers/arazzo-yaml-1/index.ts +77 -0
- package/src/parse/parsers/arazzo-yaml-1/source-descriptions.cjs +12 -0
- package/src/parse/parsers/arazzo-yaml-1/source-descriptions.mjs +7 -0
- package/src/parse/parsers/arazzo-yaml-1/source-descriptions.ts +16 -0
- package/src/parse/parsers/asyncapi-json-2/index.cjs +54 -0
- package/src/parse/parsers/asyncapi-json-2/index.mjs +48 -0
- package/src/parse/parsers/asyncapi-json-2/index.ts +58 -0
- package/src/parse/parsers/asyncapi-yaml-2/index.cjs +54 -0
- package/src/parse/parsers/asyncapi-yaml-2/index.mjs +48 -0
- package/src/parse/parsers/asyncapi-yaml-2/index.ts +58 -0
- package/src/parse/parsers/binary/index-browser.cjs +56 -0
- package/src/parse/parsers/binary/index-browser.mjs +50 -0
- package/src/parse/parsers/binary/index-browser.ts +60 -0
- package/src/parse/parsers/binary/index-node.cjs +51 -0
- package/src/parse/parsers/binary/index-node.mjs +45 -0
- package/src/parse/parsers/binary/index-node.ts +57 -0
- package/src/parse/parsers/json/index.cjs +53 -0
- package/src/parse/parsers/json/index.mjs +47 -0
- package/src/parse/parsers/json/index.ts +52 -0
- package/src/parse/parsers/openapi-json-2/index.cjs +54 -0
- package/src/parse/parsers/openapi-json-2/index.mjs +48 -0
- package/src/parse/parsers/openapi-json-2/index.ts +58 -0
- package/src/parse/parsers/openapi-json-3-0/index.cjs +54 -0
- package/src/parse/parsers/openapi-json-3-0/index.mjs +48 -0
- package/src/parse/parsers/openapi-json-3-0/index.ts +59 -0
- package/src/parse/parsers/openapi-json-3-1/index.cjs +54 -0
- package/src/parse/parsers/openapi-json-3-1/index.mjs +48 -0
- package/src/parse/parsers/openapi-json-3-1/index.ts +59 -0
- package/src/parse/parsers/openapi-yaml-2/index.cjs +54 -0
- package/src/parse/parsers/openapi-yaml-2/index.mjs +48 -0
- package/src/parse/parsers/openapi-yaml-2/index.ts +58 -0
- package/src/parse/parsers/openapi-yaml-3-0/index.cjs +54 -0
- package/src/parse/parsers/openapi-yaml-3-0/index.mjs +48 -0
- package/src/parse/parsers/openapi-yaml-3-0/index.ts +59 -0
- package/src/parse/parsers/openapi-yaml-3-1/index.cjs +54 -0
- package/src/parse/parsers/openapi-yaml-3-1/index.mjs +48 -0
- package/src/parse/parsers/openapi-yaml-3-1/index.ts +59 -0
- package/src/parse/parsers/yaml-1-2/index.cjs +56 -0
- package/src/parse/parsers/yaml-1-2/index.mjs +50 -0
- package/src/parse/parsers/yaml-1-2/index.ts +60 -0
- package/src/resolve/index.cjs +67 -0
- package/src/resolve/index.mjs +60 -0
- package/src/resolve/index.ts +75 -0
- package/src/resolve/resolvers/HTTPResolver.cjs +45 -0
- package/src/resolve/resolvers/HTTPResolver.mjs +37 -0
- package/src/resolve/resolvers/HTTPResolver.ts +58 -0
- package/src/resolve/resolvers/Resolver.cjs +20 -0
- package/src/resolve/resolvers/Resolver.mjs +16 -0
- package/src/resolve/resolvers/Resolver.ts +25 -0
- package/src/resolve/resolvers/file/index-browser.cjs +24 -0
- package/src/resolve/resolvers/file/index-browser.mjs +19 -0
- package/src/resolve/resolvers/file/index-browser.ts +24 -0
- package/src/resolve/resolvers/file/index-node.cjs +49 -0
- package/src/resolve/resolvers/file/index-node.mjs +42 -0
- package/src/resolve/resolvers/file/index-node.ts +55 -0
- package/src/resolve/resolvers/http-axios/cache/MemoryCache.cjs +41 -0
- package/src/resolve/resolvers/http-axios/cache/MemoryCache.mjs +37 -0
- package/src/resolve/resolvers/http-axios/cache/MemoryCache.ts +46 -0
- package/src/resolve/resolvers/http-axios/index.cjs +113 -0
- package/src/resolve/resolvers/http-axios/index.mjs +105 -0
- package/src/resolve/resolvers/http-axios/index.ts +130 -0
- package/src/resolve/strategies/ResolveStrategy.cjs +20 -0
- package/src/resolve/strategies/ResolveStrategy.mjs +16 -0
- package/src/resolve/strategies/ResolveStrategy.ts +26 -0
- package/src/resolve/strategies/apidom/index.cjs +49 -0
- package/src/resolve/strategies/apidom/index.mjs +43 -0
- package/src/resolve/strategies/apidom/index.ts +78 -0
- package/src/resolve/strategies/asyncapi-2/index.cjs +49 -0
- package/src/resolve/strategies/asyncapi-2/index.mjs +43 -0
- package/src/resolve/strategies/asyncapi-2/index.ts +78 -0
- package/src/resolve/strategies/openapi-2/index.cjs +49 -0
- package/src/resolve/strategies/openapi-2/index.mjs +43 -0
- package/src/resolve/strategies/openapi-2/index.ts +78 -0
- package/src/resolve/strategies/openapi-3-0/index.cjs +49 -0
- package/src/resolve/strategies/openapi-3-0/index.mjs +43 -0
- package/src/resolve/strategies/openapi-3-0/index.ts +78 -0
- package/src/resolve/strategies/openapi-3-1/index.cjs +49 -0
- package/src/resolve/strategies/openapi-3-1/index.mjs +43 -0
- package/src/resolve/strategies/openapi-3-1/index.ts +78 -0
- package/src/resolve/util.cjs +37 -0
- package/src/resolve/util.mjs +30 -0
- package/src/resolve/util.ts +39 -0
- package/src/util/plugins.cjs +39 -0
- package/src/util/plugins.mjs +34 -0
- package/src/util/plugins.ts +37 -0
- package/src/util/url.cjs +288 -0
- package/src/util/url.mjs +274 -0
- package/src/util/url.ts +285 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _ramda = require("ramda");
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
const defaultOptions = {
|
|
30
|
+
parse: {
|
|
31
|
+
/**
|
|
32
|
+
* This is media type that will be used to parse the input.
|
|
33
|
+
*/
|
|
34
|
+
mediaType: 'text/plain',
|
|
35
|
+
/**
|
|
36
|
+
* Determines how different types of files will be parsed.
|
|
37
|
+
*
|
|
38
|
+
* You can add additional parsers of your own, replace an existing one with
|
|
39
|
+
* your own implementation, or remove any resolver by removing it from the list.
|
|
40
|
+
* It's recommended to keep the order of parser from most specific ones to most generic ones.
|
|
41
|
+
*/
|
|
42
|
+
parsers: [],
|
|
43
|
+
/**
|
|
44
|
+
* These options are merged with parser plugin instance before the plugin is run.
|
|
45
|
+
*/
|
|
46
|
+
parserOpts: {}
|
|
47
|
+
},
|
|
48
|
+
resolve: {
|
|
49
|
+
/**
|
|
50
|
+
* baseURI serves as a base for all relative URL found in ApiDOM references.
|
|
51
|
+
*/
|
|
52
|
+
baseURI: '',
|
|
53
|
+
/**
|
|
54
|
+
* Determines how References will be resolved.
|
|
55
|
+
*
|
|
56
|
+
* You can add additional resolvers of your own, replace an existing one with
|
|
57
|
+
* your own implementation, or remove any resolver by removing it from the list.
|
|
58
|
+
*/
|
|
59
|
+
resolvers: [],
|
|
60
|
+
/**
|
|
61
|
+
* These options are merged with resolver plugin instance before the plugin is run.
|
|
62
|
+
*/
|
|
63
|
+
resolverOpts: {},
|
|
64
|
+
/**
|
|
65
|
+
* Determines strategies how References are identified and processed by resolvers.
|
|
66
|
+
* Strategy is determined by media type.
|
|
67
|
+
*
|
|
68
|
+
* You can add additional resolver strategies of your own, replace an existing one with
|
|
69
|
+
* your own implementation, or remove any resolve strategy by removing it from the list.
|
|
70
|
+
*/
|
|
71
|
+
strategies: [],
|
|
72
|
+
/**
|
|
73
|
+
* These options are available in resolver strategy `canResolve` and `resolve` methods.
|
|
74
|
+
*/
|
|
75
|
+
strategyOpts: {},
|
|
76
|
+
/**
|
|
77
|
+
* Determines whether internal references will be resolved.
|
|
78
|
+
* Internal references will simply be ignored.
|
|
79
|
+
*/
|
|
80
|
+
internal: true,
|
|
81
|
+
/**
|
|
82
|
+
* Determines whether external references will be resolved.
|
|
83
|
+
* If this option is disabled, then none of above resolvers will be called.
|
|
84
|
+
* Instead, external references will simply be ignored.
|
|
85
|
+
*/
|
|
86
|
+
external: true,
|
|
87
|
+
/**
|
|
88
|
+
* Determines the maximum depth of resolve algorithms.
|
|
89
|
+
* By default, there is no limit.
|
|
90
|
+
*
|
|
91
|
+
* This option tracks the depth of the file tree not the depth of the dereference path.
|
|
92
|
+
*
|
|
93
|
+
* It can be set to any positive integer number or zero (0).
|
|
94
|
+
*
|
|
95
|
+
* The resolver should throw MaximumResolverDepthError if resolution depth
|
|
96
|
+
* is exceeded by this option.
|
|
97
|
+
*/
|
|
98
|
+
maxDepth: +Infinity
|
|
99
|
+
},
|
|
100
|
+
dereference: {
|
|
101
|
+
/**
|
|
102
|
+
* Determines strategies how ApiDOM is dereferenced.
|
|
103
|
+
* Strategy is determined by media type or by inspecting ApiDOM to be dereferenced.
|
|
104
|
+
*
|
|
105
|
+
* You can add additional dereference strategies of your own, replace an existing one with
|
|
106
|
+
* your own implementation, or remove any dereference strategy by removing it from the list.
|
|
107
|
+
*/
|
|
108
|
+
strategies: [],
|
|
109
|
+
/**
|
|
110
|
+
* These options are available in dereference strategy `canDereference` and `dereference` methods.
|
|
111
|
+
*/
|
|
112
|
+
strategyOpts: {},
|
|
113
|
+
/**
|
|
114
|
+
* This option accepts an instance of pre-computed ReferenceSet.
|
|
115
|
+
* If provided it will speed up the dereferencing significantly as the external
|
|
116
|
+
* resolution doesn't need to happen anymore.
|
|
117
|
+
*/
|
|
118
|
+
refSet: null,
|
|
119
|
+
/**
|
|
120
|
+
* Determines the maximum depth of dereferencing.
|
|
121
|
+
* By default, there is no limit.
|
|
122
|
+
*
|
|
123
|
+
* The maxDepth represents a number of references that needed to be followed
|
|
124
|
+
* before the eventual value was reached.
|
|
125
|
+
*
|
|
126
|
+
* It can be set to any positive integer number or zero (0).
|
|
127
|
+
*
|
|
128
|
+
* The dereferencing should throw MaximumDereferenceDepthError if dereferencing depth
|
|
129
|
+
* is exceeded by this option.
|
|
130
|
+
*/
|
|
131
|
+
maxDepth: +Infinity,
|
|
132
|
+
/**
|
|
133
|
+
* Determines how circular references are handled.
|
|
134
|
+
*
|
|
135
|
+
* "ignore" - circular reference are allowed
|
|
136
|
+
* "replace" - circular references are not allowed and are translated to RefElement
|
|
137
|
+
* "error" - circular references are not allowed and will throw an error
|
|
138
|
+
*/
|
|
139
|
+
circular: 'ignore',
|
|
140
|
+
/**
|
|
141
|
+
* This function is used to replace circular references when `circular` option is set to "replace".
|
|
142
|
+
* By default, it's an identity function. It means that circular references are replaced with RefElement.
|
|
143
|
+
*/
|
|
144
|
+
circularReplacer: _ramda.identity,
|
|
145
|
+
/**
|
|
146
|
+
* Determines whether the dereferencing process will be immutable.
|
|
147
|
+
* By default, the dereferencing process is immutable, which means that the original
|
|
148
|
+
* ApiDOM passed to the dereference process is NOT modified.
|
|
149
|
+
*
|
|
150
|
+
* true - the dereferencing process will be immutable (deep cloning of ApiDOM is involved)
|
|
151
|
+
* false - the dereferencing process will be mutable
|
|
152
|
+
*/
|
|
153
|
+
immutable: true,
|
|
154
|
+
/**
|
|
155
|
+
* Controls error handling during dereferencing.
|
|
156
|
+
*
|
|
157
|
+
* false - fail fast, throw on first error (default)
|
|
158
|
+
* true - skip unresolvable references silently, continue dereferencing
|
|
159
|
+
* (error) => void - callback invoked for each error; if the callback
|
|
160
|
+
* itself throws, dereferencing stops with that error
|
|
161
|
+
*/
|
|
162
|
+
continueOnError: false
|
|
163
|
+
},
|
|
164
|
+
bundle: {
|
|
165
|
+
/**
|
|
166
|
+
* Determines strategies how ApiDOM is bundled.
|
|
167
|
+
* Strategy is determined by media type or by inspecting ApiDOM to be bundled.
|
|
168
|
+
*
|
|
169
|
+
* You can add additional bundle strategies of your own, replace an existing one with
|
|
170
|
+
* your own implementation, or remove any bundle strategy by removing it from the list.
|
|
171
|
+
*/
|
|
172
|
+
strategies: [],
|
|
173
|
+
/**
|
|
174
|
+
* This option accepts an instance of pre-computed ReferenceSet.
|
|
175
|
+
* If provided it will speed up the bundling significantly as the external
|
|
176
|
+
* resolution doesn't need to happen anymore.
|
|
177
|
+
*/
|
|
178
|
+
refSet: null,
|
|
179
|
+
/**
|
|
180
|
+
* Determines the maximum depth of bundling.
|
|
181
|
+
* By default, there is no limit.
|
|
182
|
+
*
|
|
183
|
+
* The maxDepth represents a number of references that needed to be followed
|
|
184
|
+
* before the eventual value was reached.
|
|
185
|
+
*
|
|
186
|
+
* It can be set to any positive integer number or zero (0).
|
|
187
|
+
*
|
|
188
|
+
* The bundling should throw MaximumBundleDepthError if bundling depth
|
|
189
|
+
* is exceeded by this option.
|
|
190
|
+
*/
|
|
191
|
+
maxDepth: +Infinity
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var _default = exports.default = defaultOptions;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { identity } from 'ramda';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
const defaultOptions = {
|
|
27
|
+
parse: {
|
|
28
|
+
/**
|
|
29
|
+
* This is media type that will be used to parse the input.
|
|
30
|
+
*/
|
|
31
|
+
mediaType: 'text/plain',
|
|
32
|
+
/**
|
|
33
|
+
* Determines how different types of files will be parsed.
|
|
34
|
+
*
|
|
35
|
+
* You can add additional parsers of your own, replace an existing one with
|
|
36
|
+
* your own implementation, or remove any resolver by removing it from the list.
|
|
37
|
+
* It's recommended to keep the order of parser from most specific ones to most generic ones.
|
|
38
|
+
*/
|
|
39
|
+
parsers: [],
|
|
40
|
+
/**
|
|
41
|
+
* These options are merged with parser plugin instance before the plugin is run.
|
|
42
|
+
*/
|
|
43
|
+
parserOpts: {}
|
|
44
|
+
},
|
|
45
|
+
resolve: {
|
|
46
|
+
/**
|
|
47
|
+
* baseURI serves as a base for all relative URL found in ApiDOM references.
|
|
48
|
+
*/
|
|
49
|
+
baseURI: '',
|
|
50
|
+
/**
|
|
51
|
+
* Determines how References will be resolved.
|
|
52
|
+
*
|
|
53
|
+
* You can add additional resolvers of your own, replace an existing one with
|
|
54
|
+
* your own implementation, or remove any resolver by removing it from the list.
|
|
55
|
+
*/
|
|
56
|
+
resolvers: [],
|
|
57
|
+
/**
|
|
58
|
+
* These options are merged with resolver plugin instance before the plugin is run.
|
|
59
|
+
*/
|
|
60
|
+
resolverOpts: {},
|
|
61
|
+
/**
|
|
62
|
+
* Determines strategies how References are identified and processed by resolvers.
|
|
63
|
+
* Strategy is determined by media type.
|
|
64
|
+
*
|
|
65
|
+
* You can add additional resolver strategies of your own, replace an existing one with
|
|
66
|
+
* your own implementation, or remove any resolve strategy by removing it from the list.
|
|
67
|
+
*/
|
|
68
|
+
strategies: [],
|
|
69
|
+
/**
|
|
70
|
+
* These options are available in resolver strategy `canResolve` and `resolve` methods.
|
|
71
|
+
*/
|
|
72
|
+
strategyOpts: {},
|
|
73
|
+
/**
|
|
74
|
+
* Determines whether internal references will be resolved.
|
|
75
|
+
* Internal references will simply be ignored.
|
|
76
|
+
*/
|
|
77
|
+
internal: true,
|
|
78
|
+
/**
|
|
79
|
+
* Determines whether external references will be resolved.
|
|
80
|
+
* If this option is disabled, then none of above resolvers will be called.
|
|
81
|
+
* Instead, external references will simply be ignored.
|
|
82
|
+
*/
|
|
83
|
+
external: true,
|
|
84
|
+
/**
|
|
85
|
+
* Determines the maximum depth of resolve algorithms.
|
|
86
|
+
* By default, there is no limit.
|
|
87
|
+
*
|
|
88
|
+
* This option tracks the depth of the file tree not the depth of the dereference path.
|
|
89
|
+
*
|
|
90
|
+
* It can be set to any positive integer number or zero (0).
|
|
91
|
+
*
|
|
92
|
+
* The resolver should throw MaximumResolverDepthError if resolution depth
|
|
93
|
+
* is exceeded by this option.
|
|
94
|
+
*/
|
|
95
|
+
maxDepth: +Infinity
|
|
96
|
+
},
|
|
97
|
+
dereference: {
|
|
98
|
+
/**
|
|
99
|
+
* Determines strategies how ApiDOM is dereferenced.
|
|
100
|
+
* Strategy is determined by media type or by inspecting ApiDOM to be dereferenced.
|
|
101
|
+
*
|
|
102
|
+
* You can add additional dereference strategies of your own, replace an existing one with
|
|
103
|
+
* your own implementation, or remove any dereference strategy by removing it from the list.
|
|
104
|
+
*/
|
|
105
|
+
strategies: [],
|
|
106
|
+
/**
|
|
107
|
+
* These options are available in dereference strategy `canDereference` and `dereference` methods.
|
|
108
|
+
*/
|
|
109
|
+
strategyOpts: {},
|
|
110
|
+
/**
|
|
111
|
+
* This option accepts an instance of pre-computed ReferenceSet.
|
|
112
|
+
* If provided it will speed up the dereferencing significantly as the external
|
|
113
|
+
* resolution doesn't need to happen anymore.
|
|
114
|
+
*/
|
|
115
|
+
refSet: null,
|
|
116
|
+
/**
|
|
117
|
+
* Determines the maximum depth of dereferencing.
|
|
118
|
+
* By default, there is no limit.
|
|
119
|
+
*
|
|
120
|
+
* The maxDepth represents a number of references that needed to be followed
|
|
121
|
+
* before the eventual value was reached.
|
|
122
|
+
*
|
|
123
|
+
* It can be set to any positive integer number or zero (0).
|
|
124
|
+
*
|
|
125
|
+
* The dereferencing should throw MaximumDereferenceDepthError if dereferencing depth
|
|
126
|
+
* is exceeded by this option.
|
|
127
|
+
*/
|
|
128
|
+
maxDepth: +Infinity,
|
|
129
|
+
/**
|
|
130
|
+
* Determines how circular references are handled.
|
|
131
|
+
*
|
|
132
|
+
* "ignore" - circular reference are allowed
|
|
133
|
+
* "replace" - circular references are not allowed and are translated to RefElement
|
|
134
|
+
* "error" - circular references are not allowed and will throw an error
|
|
135
|
+
*/
|
|
136
|
+
circular: 'ignore',
|
|
137
|
+
/**
|
|
138
|
+
* This function is used to replace circular references when `circular` option is set to "replace".
|
|
139
|
+
* By default, it's an identity function. It means that circular references are replaced with RefElement.
|
|
140
|
+
*/
|
|
141
|
+
circularReplacer: identity,
|
|
142
|
+
/**
|
|
143
|
+
* Determines whether the dereferencing process will be immutable.
|
|
144
|
+
* By default, the dereferencing process is immutable, which means that the original
|
|
145
|
+
* ApiDOM passed to the dereference process is NOT modified.
|
|
146
|
+
*
|
|
147
|
+
* true - the dereferencing process will be immutable (deep cloning of ApiDOM is involved)
|
|
148
|
+
* false - the dereferencing process will be mutable
|
|
149
|
+
*/
|
|
150
|
+
immutable: true,
|
|
151
|
+
/**
|
|
152
|
+
* Controls error handling during dereferencing.
|
|
153
|
+
*
|
|
154
|
+
* false - fail fast, throw on first error (default)
|
|
155
|
+
* true - skip unresolvable references silently, continue dereferencing
|
|
156
|
+
* (error) => void - callback invoked for each error; if the callback
|
|
157
|
+
* itself throws, dereferencing stops with that error
|
|
158
|
+
*/
|
|
159
|
+
continueOnError: false
|
|
160
|
+
},
|
|
161
|
+
bundle: {
|
|
162
|
+
/**
|
|
163
|
+
* Determines strategies how ApiDOM is bundled.
|
|
164
|
+
* Strategy is determined by media type or by inspecting ApiDOM to be bundled.
|
|
165
|
+
*
|
|
166
|
+
* You can add additional bundle strategies of your own, replace an existing one with
|
|
167
|
+
* your own implementation, or remove any bundle strategy by removing it from the list.
|
|
168
|
+
*/
|
|
169
|
+
strategies: [],
|
|
170
|
+
/**
|
|
171
|
+
* This option accepts an instance of pre-computed ReferenceSet.
|
|
172
|
+
* If provided it will speed up the bundling significantly as the external
|
|
173
|
+
* resolution doesn't need to happen anymore.
|
|
174
|
+
*/
|
|
175
|
+
refSet: null,
|
|
176
|
+
/**
|
|
177
|
+
* Determines the maximum depth of bundling.
|
|
178
|
+
* By default, there is no limit.
|
|
179
|
+
*
|
|
180
|
+
* The maxDepth represents a number of references that needed to be followed
|
|
181
|
+
* before the eventual value was reached.
|
|
182
|
+
*
|
|
183
|
+
* It can be set to any positive integer number or zero (0).
|
|
184
|
+
*
|
|
185
|
+
* The bundling should throw MaximumBundleDepthError if bundling depth
|
|
186
|
+
* is exceeded by this option.
|
|
187
|
+
*/
|
|
188
|
+
maxDepth: +Infinity
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
export default defaultOptions;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { identity } from 'ramda';
|
|
2
|
+
import type { RefElement } from '@speclynx/apidom-datamodel';
|
|
3
|
+
|
|
4
|
+
import type Parser from '../parse/parsers/Parser.ts';
|
|
5
|
+
import type Resolver from '../resolve/resolvers/Resolver.ts';
|
|
6
|
+
import type ResolveStrategy from '../resolve/strategies/ResolveStrategy.ts';
|
|
7
|
+
import type DereferenceStrategy from '../dereference/strategies/DereferenceStrategy.ts';
|
|
8
|
+
import type ReferenceSet from '../ReferenceSet.ts';
|
|
9
|
+
import type BundleStrategy from '../bundle/strategies/BundleStrategy.ts';
|
|
10
|
+
import type UnresolvableReferenceError from '../errors/UnresolvableReferenceError.ts';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export interface ReferenceParseOptions {
|
|
16
|
+
mediaType: string;
|
|
17
|
+
parsers: Array<Parser>;
|
|
18
|
+
parserOpts: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export interface ReferenceResolveOptions {
|
|
25
|
+
baseURI: string;
|
|
26
|
+
resolvers: Array<Resolver>;
|
|
27
|
+
resolverOpts: Record<string, any>;
|
|
28
|
+
strategies: Array<ResolveStrategy>;
|
|
29
|
+
strategyOpts: Record<string, any>;
|
|
30
|
+
internal: boolean;
|
|
31
|
+
external: boolean;
|
|
32
|
+
maxDepth: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export interface ReferenceDereferenceOptions {
|
|
39
|
+
strategies: Array<DereferenceStrategy>;
|
|
40
|
+
strategyOpts: Record<string, any>;
|
|
41
|
+
refSet: null | ReferenceSet;
|
|
42
|
+
maxDepth: number;
|
|
43
|
+
circular: 'ignore' | 'replace' | 'error';
|
|
44
|
+
circularReplacer: (ref: RefElement) => unknown;
|
|
45
|
+
immutable: boolean;
|
|
46
|
+
continueOnError: boolean | ((error: UnresolvableReferenceError) => void);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface ReferenceBundleOptions {
|
|
53
|
+
strategies: Array<BundleStrategy>;
|
|
54
|
+
refSet: null | ReferenceSet;
|
|
55
|
+
maxDepth: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export interface ReferenceOptions {
|
|
62
|
+
readonly parse: ReferenceParseOptions;
|
|
63
|
+
readonly resolve: ReferenceResolveOptions;
|
|
64
|
+
readonly dereference: ReferenceDereferenceOptions;
|
|
65
|
+
readonly bundle: ReferenceBundleOptions;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
const defaultOptions: ReferenceOptions = {
|
|
72
|
+
parse: {
|
|
73
|
+
/**
|
|
74
|
+
* This is media type that will be used to parse the input.
|
|
75
|
+
*/
|
|
76
|
+
mediaType: 'text/plain',
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Determines how different types of files will be parsed.
|
|
80
|
+
*
|
|
81
|
+
* You can add additional parsers of your own, replace an existing one with
|
|
82
|
+
* your own implementation, or remove any resolver by removing it from the list.
|
|
83
|
+
* It's recommended to keep the order of parser from most specific ones to most generic ones.
|
|
84
|
+
*/
|
|
85
|
+
parsers: [],
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* These options are merged with parser plugin instance before the plugin is run.
|
|
89
|
+
*/
|
|
90
|
+
parserOpts: {},
|
|
91
|
+
},
|
|
92
|
+
resolve: {
|
|
93
|
+
/**
|
|
94
|
+
* baseURI serves as a base for all relative URL found in ApiDOM references.
|
|
95
|
+
*/
|
|
96
|
+
baseURI: '',
|
|
97
|
+
/**
|
|
98
|
+
* Determines how References will be resolved.
|
|
99
|
+
*
|
|
100
|
+
* You can add additional resolvers of your own, replace an existing one with
|
|
101
|
+
* your own implementation, or remove any resolver by removing it from the list.
|
|
102
|
+
*/
|
|
103
|
+
resolvers: [],
|
|
104
|
+
/**
|
|
105
|
+
* These options are merged with resolver plugin instance before the plugin is run.
|
|
106
|
+
*/
|
|
107
|
+
resolverOpts: {},
|
|
108
|
+
/**
|
|
109
|
+
* Determines strategies how References are identified and processed by resolvers.
|
|
110
|
+
* Strategy is determined by media type.
|
|
111
|
+
*
|
|
112
|
+
* You can add additional resolver strategies of your own, replace an existing one with
|
|
113
|
+
* your own implementation, or remove any resolve strategy by removing it from the list.
|
|
114
|
+
*/
|
|
115
|
+
strategies: [],
|
|
116
|
+
/**
|
|
117
|
+
* These options are available in resolver strategy `canResolve` and `resolve` methods.
|
|
118
|
+
*/
|
|
119
|
+
strategyOpts: {},
|
|
120
|
+
/**
|
|
121
|
+
* Determines whether internal references will be resolved.
|
|
122
|
+
* Internal references will simply be ignored.
|
|
123
|
+
*/
|
|
124
|
+
internal: true,
|
|
125
|
+
/**
|
|
126
|
+
* Determines whether external references will be resolved.
|
|
127
|
+
* If this option is disabled, then none of above resolvers will be called.
|
|
128
|
+
* Instead, external references will simply be ignored.
|
|
129
|
+
*/
|
|
130
|
+
external: true,
|
|
131
|
+
/**
|
|
132
|
+
* Determines the maximum depth of resolve algorithms.
|
|
133
|
+
* By default, there is no limit.
|
|
134
|
+
*
|
|
135
|
+
* This option tracks the depth of the file tree not the depth of the dereference path.
|
|
136
|
+
*
|
|
137
|
+
* It can be set to any positive integer number or zero (0).
|
|
138
|
+
*
|
|
139
|
+
* The resolver should throw MaximumResolverDepthError if resolution depth
|
|
140
|
+
* is exceeded by this option.
|
|
141
|
+
*/
|
|
142
|
+
maxDepth: +Infinity,
|
|
143
|
+
},
|
|
144
|
+
dereference: {
|
|
145
|
+
/**
|
|
146
|
+
* Determines strategies how ApiDOM is dereferenced.
|
|
147
|
+
* Strategy is determined by media type or by inspecting ApiDOM to be dereferenced.
|
|
148
|
+
*
|
|
149
|
+
* You can add additional dereference strategies of your own, replace an existing one with
|
|
150
|
+
* your own implementation, or remove any dereference strategy by removing it from the list.
|
|
151
|
+
*/
|
|
152
|
+
strategies: [],
|
|
153
|
+
/**
|
|
154
|
+
* These options are available in dereference strategy `canDereference` and `dereference` methods.
|
|
155
|
+
*/
|
|
156
|
+
strategyOpts: {},
|
|
157
|
+
/**
|
|
158
|
+
* This option accepts an instance of pre-computed ReferenceSet.
|
|
159
|
+
* If provided it will speed up the dereferencing significantly as the external
|
|
160
|
+
* resolution doesn't need to happen anymore.
|
|
161
|
+
*/
|
|
162
|
+
refSet: null,
|
|
163
|
+
/**
|
|
164
|
+
* Determines the maximum depth of dereferencing.
|
|
165
|
+
* By default, there is no limit.
|
|
166
|
+
*
|
|
167
|
+
* The maxDepth represents a number of references that needed to be followed
|
|
168
|
+
* before the eventual value was reached.
|
|
169
|
+
*
|
|
170
|
+
* It can be set to any positive integer number or zero (0).
|
|
171
|
+
*
|
|
172
|
+
* The dereferencing should throw MaximumDereferenceDepthError if dereferencing depth
|
|
173
|
+
* is exceeded by this option.
|
|
174
|
+
*/
|
|
175
|
+
maxDepth: +Infinity,
|
|
176
|
+
/**
|
|
177
|
+
* Determines how circular references are handled.
|
|
178
|
+
*
|
|
179
|
+
* "ignore" - circular reference are allowed
|
|
180
|
+
* "replace" - circular references are not allowed and are translated to RefElement
|
|
181
|
+
* "error" - circular references are not allowed and will throw an error
|
|
182
|
+
*/
|
|
183
|
+
circular: 'ignore',
|
|
184
|
+
/**
|
|
185
|
+
* This function is used to replace circular references when `circular` option is set to "replace".
|
|
186
|
+
* By default, it's an identity function. It means that circular references are replaced with RefElement.
|
|
187
|
+
*/
|
|
188
|
+
circularReplacer: identity,
|
|
189
|
+
/**
|
|
190
|
+
* Determines whether the dereferencing process will be immutable.
|
|
191
|
+
* By default, the dereferencing process is immutable, which means that the original
|
|
192
|
+
* ApiDOM passed to the dereference process is NOT modified.
|
|
193
|
+
*
|
|
194
|
+
* true - the dereferencing process will be immutable (deep cloning of ApiDOM is involved)
|
|
195
|
+
* false - the dereferencing process will be mutable
|
|
196
|
+
*/
|
|
197
|
+
immutable: true,
|
|
198
|
+
/**
|
|
199
|
+
* Controls error handling during dereferencing.
|
|
200
|
+
*
|
|
201
|
+
* false - fail fast, throw on first error (default)
|
|
202
|
+
* true - skip unresolvable references silently, continue dereferencing
|
|
203
|
+
* (error) => void - callback invoked for each error; if the callback
|
|
204
|
+
* itself throws, dereferencing stops with that error
|
|
205
|
+
*/
|
|
206
|
+
continueOnError: false,
|
|
207
|
+
},
|
|
208
|
+
bundle: {
|
|
209
|
+
/**
|
|
210
|
+
* Determines strategies how ApiDOM is bundled.
|
|
211
|
+
* Strategy is determined by media type or by inspecting ApiDOM to be bundled.
|
|
212
|
+
*
|
|
213
|
+
* You can add additional bundle strategies of your own, replace an existing one with
|
|
214
|
+
* your own implementation, or remove any bundle strategy by removing it from the list.
|
|
215
|
+
*/
|
|
216
|
+
strategies: [],
|
|
217
|
+
/**
|
|
218
|
+
* This option accepts an instance of pre-computed ReferenceSet.
|
|
219
|
+
* If provided it will speed up the bundling significantly as the external
|
|
220
|
+
* resolution doesn't need to happen anymore.
|
|
221
|
+
*/
|
|
222
|
+
refSet: null,
|
|
223
|
+
/**
|
|
224
|
+
* Determines the maximum depth of bundling.
|
|
225
|
+
* By default, there is no limit.
|
|
226
|
+
*
|
|
227
|
+
* The maxDepth represents a number of references that needed to be followed
|
|
228
|
+
* before the eventual value was reached.
|
|
229
|
+
*
|
|
230
|
+
* It can be set to any positive integer number or zero (0).
|
|
231
|
+
*
|
|
232
|
+
* The bundling should throw MaximumBundleDepthError if bundling depth
|
|
233
|
+
* is exceeded by this option.
|
|
234
|
+
*/
|
|
235
|
+
maxDepth: +Infinity,
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export default defaultOptions;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.merge = void 0;
|
|
5
|
+
var _ramda = require("ramda");
|
|
6
|
+
var _ramdaAdjunct = require("ramda-adjunct");
|
|
7
|
+
var _url = require("../util/url.cjs");
|
|
8
|
+
/**
|
|
9
|
+
* Algorithm for deep merging options.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const baseURILens = (0, _ramda.lens)((0, _ramda.path)(['resolve', 'baseURI']), (0, _ramda.assocPath)(['resolve', 'baseURI']));
|
|
13
|
+
const baseURIDefault = baseURI => (0, _ramdaAdjunct.isEmptyString)(baseURI) ? (0, _url.cwd)() : baseURI;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const merge = (lObj, rObj) => {
|
|
20
|
+
const withoutDefaults = (0, _ramda.mergeDeepRight)(lObj, rObj);
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
return (0, _ramda.over)(baseURILens, baseURIDefault, withoutDefaults);
|
|
23
|
+
};
|
|
24
|
+
exports.merge = merge;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { mergeDeepRight, lens, path, assocPath, over } from 'ramda';
|
|
2
|
+
import { isEmptyString } from 'ramda-adjunct';
|
|
3
|
+
import { cwd } from "../util/url.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Algorithm for deep merging options.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const baseURILens = lens(path(['resolve', 'baseURI']), assocPath(['resolve', 'baseURI']));
|
|
9
|
+
const baseURIDefault = baseURI => isEmptyString(baseURI) ? cwd() : baseURI;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const merge = (lObj, rObj) => {
|
|
16
|
+
const withoutDefaults = mergeDeepRight(lObj, rObj);
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
return over(baseURILens, baseURIDefault, withoutDefaults);
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mergeDeepRight, lens, path, assocPath, over } from 'ramda';
|
|
2
|
+
import { isEmptyString } from 'ramda-adjunct';
|
|
3
|
+
|
|
4
|
+
import { cwd } from '../util/url.ts';
|
|
5
|
+
import type { ReferenceOptions } from './index.ts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Algorithm for deep merging options.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const baseURILens = lens(path(['resolve', 'baseURI']), assocPath(['resolve', 'baseURI']));
|
|
12
|
+
const baseURIDefault = (baseURI: string) => (isEmptyString(baseURI) ? cwd() : baseURI);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const merge = (lObj: ReferenceOptions, rObj: Record<string, any>): ReferenceOptions => {
|
|
19
|
+
const withoutDefaults = mergeDeepRight(lObj, rObj);
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
return over(baseURILens, baseURIDefault, withoutDefaults);
|
|
22
|
+
};
|