@speclynx/apidom-reference 1.12.1
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 +86 -0
- package/LICENSE +202 -0
- package/LICENSES/AFL-3.0.txt +182 -0
- package/LICENSES/Apache-2.0.txt +202 -0
- package/LICENSES/BSD-3-Clause.txt +26 -0
- package/LICENSES/MIT.txt +9 -0
- package/NOTICE +65 -0
- package/README.md +2107 -0
- package/dist/167.apidom-reference.browser.js +10 -0
- package/dist/167.apidom-reference.browser.min.js +1 -0
- package/dist/451.apidom-reference.browser.js +10 -0
- package/dist/451.apidom-reference.browser.min.js +1 -0
- package/dist/9786785aaddf11f37840fad896531940.wasm +0 -0
- package/dist/apidom-reference.browser.js +85376 -0
- package/dist/apidom-reference.browser.min.js +1 -0
- package/package.json +304 -0
- package/src/File.cjs +50 -0
- package/src/File.mjs +44 -0
- package/src/Reference.cjs +31 -0
- package/src/Reference.mjs +27 -0
- package/src/ReferenceSet.cjs +60 -0
- package/src/ReferenceSet.mjs +57 -0
- package/src/bundle/index.cjs +61 -0
- package/src/bundle/index.mjs +55 -0
- package/src/bundle/strategies/BundleStrategy.cjs +20 -0
- package/src/bundle/strategies/BundleStrategy.mjs +16 -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/configuration/empty.cjs +9 -0
- package/src/configuration/empty.mjs +1 -0
- package/src/configuration/saturated.cjs +95 -0
- package/src/configuration/saturated.mjs +87 -0
- package/src/dereference/index.cjs +86 -0
- package/src/dereference/index.mjs +79 -0
- package/src/dereference/strategies/DereferenceStrategy.cjs +20 -0
- package/src/dereference/strategies/DereferenceStrategy.mjs +16 -0
- package/src/dereference/strategies/apidom/index.cjs +89 -0
- package/src/dereference/strategies/apidom/index.mjs +84 -0
- package/src/dereference/strategies/apidom/selectors/element-id.cjs +36 -0
- package/src/dereference/strategies/apidom/selectors/element-id.mjs +30 -0
- package/src/dereference/strategies/apidom/visitor.cjs +165 -0
- package/src/dereference/strategies/apidom/visitor.mjs +159 -0
- package/src/dereference/strategies/asyncapi-2/index.cjs +100 -0
- package/src/dereference/strategies/asyncapi-2/index.mjs +94 -0
- package/src/dereference/strategies/asyncapi-2/visitor.cjs +412 -0
- package/src/dereference/strategies/asyncapi-2/visitor.mjs +406 -0
- package/src/dereference/strategies/openapi-2/index.cjs +102 -0
- package/src/dereference/strategies/openapi-2/index.mjs +96 -0
- package/src/dereference/strategies/openapi-2/visitor.cjs +530 -0
- package/src/dereference/strategies/openapi-2/visitor.mjs +524 -0
- package/src/dereference/strategies/openapi-3-0/index.cjs +102 -0
- package/src/dereference/strategies/openapi-3-0/index.mjs +96 -0
- package/src/dereference/strategies/openapi-3-0/visitor.cjs +519 -0
- package/src/dereference/strategies/openapi-3-0/visitor.mjs +513 -0
- package/src/dereference/strategies/openapi-3-1/index.cjs +105 -0
- package/src/dereference/strategies/openapi-3-1/index.mjs +96 -0
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +66 -0
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +55 -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/util.cjs +67 -0
- package/src/dereference/strategies/openapi-3-1/util.mjs +58 -0
- package/src/dereference/strategies/openapi-3-1/visitor.cjs +776 -0
- package/src/dereference/strategies/openapi-3-1/visitor.mjs +770 -0
- package/src/dereference/util.cjs +31 -0
- package/src/dereference/util.mjs +27 -0
- package/src/errors/BundleError.cjs +10 -0
- package/src/errors/BundleError.mjs +7 -0
- package/src/errors/DereferenceError.cjs +10 -0
- package/src/errors/DereferenceError.mjs +7 -0
- package/src/errors/EvaluationElementIdError.cjs +10 -0
- package/src/errors/EvaluationElementIdError.mjs +7 -0
- package/src/errors/EvaluationJsonSchema$anchorError.cjs +11 -0
- package/src/errors/EvaluationJsonSchema$anchorError.mjs +6 -0
- package/src/errors/EvaluationJsonSchemaUriError.cjs +11 -0
- package/src/errors/EvaluationJsonSchemaUriError.mjs +6 -0
- package/src/errors/InvalidJsonSchema$anchorError.cjs +15 -0
- package/src/errors/InvalidJsonSchema$anchorError.mjs +10 -0
- package/src/errors/JsonSchema$anchorError.cjs +10 -0
- package/src/errors/JsonSchema$anchorError.mjs +7 -0
- package/src/errors/JsonSchemaUriError.cjs +10 -0
- package/src/errors/JsonSchemaUriError.mjs +7 -0
- package/src/errors/MaximumBundleDepthError.cjs +11 -0
- package/src/errors/MaximumBundleDepthError.mjs +6 -0
- package/src/errors/MaximumDereferenceDepthError.cjs +11 -0
- package/src/errors/MaximumDereferenceDepthError.mjs +6 -0
- package/src/errors/MaximumResolveDepthError.cjs +11 -0
- package/src/errors/MaximumResolveDepthError.mjs +6 -0
- package/src/errors/ParseError.cjs +10 -0
- package/src/errors/ParseError.mjs +7 -0
- package/src/errors/ParserError.cjs +11 -0
- package/src/errors/ParserError.mjs +6 -0
- package/src/errors/PluginError.cjs +18 -0
- package/src/errors/PluginError.mjs +15 -0
- package/src/errors/ResolveError.cjs +10 -0
- package/src/errors/ResolveError.mjs +7 -0
- package/src/errors/ResolverError.cjs +11 -0
- package/src/errors/ResolverError.mjs +6 -0
- package/src/errors/UnmatchedBundleStrategyError.cjs +11 -0
- package/src/errors/UnmatchedBundleStrategyError.mjs +6 -0
- package/src/errors/UnmatchedDereferenceStrategyError.cjs +11 -0
- package/src/errors/UnmatchedDereferenceStrategyError.mjs +6 -0
- package/src/errors/UnmatchedResolveStrategyError.cjs +11 -0
- package/src/errors/UnmatchedResolveStrategyError.mjs +6 -0
- package/src/errors/UnmatchedResolverError.cjs +11 -0
- package/src/errors/UnmatchedResolverError.mjs +6 -0
- package/src/index.cjs +142 -0
- package/src/index.mjs +101 -0
- package/src/options/index.cjs +185 -0
- package/src/options/index.mjs +182 -0
- package/src/options/util.cjs +24 -0
- package/src/options/util.mjs +19 -0
- package/src/parse/index.cjs +69 -0
- package/src/parse/index.mjs +63 -0
- package/src/parse/parsers/Parser.cjs +48 -0
- package/src/parse/parsers/Parser.mjs +44 -0
- package/src/parse/parsers/api-design-systems-json/index.cjs +55 -0
- package/src/parse/parsers/api-design-systems-json/index.mjs +49 -0
- package/src/parse/parsers/api-design-systems-yaml/index.cjs +54 -0
- package/src/parse/parsers/api-design-systems-yaml/index.mjs +48 -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/arazzo-json-1/index.cjs +55 -0
- package/src/parse/parsers/arazzo-json-1/index.mjs +49 -0
- package/src/parse/parsers/arazzo-yaml-1/index.cjs +54 -0
- package/src/parse/parsers/arazzo-yaml-1/index.mjs +48 -0
- package/src/parse/parsers/asyncapi-json-2/index.cjs +55 -0
- package/src/parse/parsers/asyncapi-json-2/index.mjs +49 -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/binary/index-browser.cjs +56 -0
- package/src/parse/parsers/binary/index-browser.mjs +50 -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/json/index.cjs +54 -0
- package/src/parse/parsers/json/index.mjs +48 -0
- package/src/parse/parsers/openapi-json-2/index.cjs +55 -0
- package/src/parse/parsers/openapi-json-2/index.mjs +49 -0
- package/src/parse/parsers/openapi-json-3-0/index.cjs +55 -0
- package/src/parse/parsers/openapi-json-3-0/index.mjs +49 -0
- package/src/parse/parsers/openapi-json-3-1/index.cjs +55 -0
- package/src/parse/parsers/openapi-json-3-1/index.mjs +49 -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-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-1/index.cjs +54 -0
- package/src/parse/parsers/openapi-yaml-3-1/index.mjs +48 -0
- package/src/parse/parsers/yaml-1-2/index.cjs +54 -0
- package/src/parse/parsers/yaml-1-2/index.mjs +48 -0
- package/src/resolve/index.cjs +67 -0
- package/src/resolve/index.mjs +60 -0
- package/src/resolve/resolvers/HTTPResolver.cjs +38 -0
- package/src/resolve/resolvers/HTTPResolver.mjs +31 -0
- package/src/resolve/resolvers/Resolver.cjs +20 -0
- package/src/resolve/resolvers/Resolver.mjs +16 -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-node.cjs +49 -0
- package/src/resolve/resolvers/file/index-node.mjs +42 -0
- package/src/resolve/resolvers/http-axios/index.cjs +80 -0
- package/src/resolve/resolvers/http-axios/index.mjs +73 -0
- package/src/resolve/strategies/ResolveStrategy.cjs +20 -0
- package/src/resolve/strategies/ResolveStrategy.mjs +16 -0
- package/src/resolve/strategies/apidom/index.cjs +49 -0
- package/src/resolve/strategies/apidom/index.mjs +43 -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/openapi-2/index.cjs +49 -0
- package/src/resolve/strategies/openapi-2/index.mjs +43 -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-1/index.cjs +49 -0
- package/src/resolve/strategies/openapi-3-1/index.mjs +43 -0
- package/src/resolve/util.cjs +37 -0
- package/src/resolve/util.mjs +30 -0
- package/src/util/plugins.cjs +44 -0
- package/src/util/plugins.mjs +37 -0
- package/src/util/url.cjs +288 -0
- package/src/util/url.mjs +274 -0
- package/types/File.d.ts +24 -0
- package/types/Reference.d.ts +23 -0
- package/types/ReferenceSet.d.ts +25 -0
- package/types/apidom-reference.d.ts +584 -0
- package/types/bundle/index.d.ts +7 -0
- package/types/bundle/strategies/BundleStrategy.d.ts +19 -0
- package/types/bundle/strategies/openapi-3-1/index.d.ts +26 -0
- package/types/configuration/empty.d.ts +1 -0
- package/types/configuration/saturated.d.ts +1 -0
- package/types/dereference/index.d.ts +11 -0
- package/types/dereference/strategies/DereferenceStrategy.d.ts +19 -0
- package/types/dereference/strategies/apidom/index.d.ts +30 -0
- package/types/dereference/strategies/apidom/selectors/element-id.d.ts +11 -0
- package/types/dereference/strategies/apidom/visitor.d.ts +32 -0
- package/types/dereference/strategies/asyncapi-2/index.d.ts +31 -0
- package/types/dereference/strategies/asyncapi-2/visitor.d.ts +43 -0
- package/types/dereference/strategies/openapi-2/index.d.ts +32 -0
- package/types/dereference/strategies/openapi-2/visitor.d.ts +47 -0
- package/types/dereference/strategies/openapi-3-0/index.d.ts +31 -0
- package/types/dereference/strategies/openapi-3-0/visitor.d.ts +49 -0
- package/types/dereference/strategies/openapi-3-1/index.d.ts +32 -0
- package/types/dereference/strategies/openapi-3-1/selectors/$anchor.d.ts +22 -0
- package/types/dereference/strategies/openapi-3-1/selectors/uri.d.ts +12 -0
- package/types/dereference/strategies/openapi-3-1/util.d.ts +21 -0
- package/types/dereference/strategies/openapi-3-1/visitor.d.ts +52 -0
- package/types/dereference/util.d.ts +9 -0
- package/types/errors/BundleError.d.ts +7 -0
- package/types/errors/DereferenceError.d.ts +7 -0
- package/types/errors/EvaluationElementIdError.d.ts +7 -0
- package/types/errors/EvaluationJsonSchema$anchorError.d.ts +7 -0
- package/types/errors/EvaluationJsonSchemaUriError.d.ts +7 -0
- package/types/errors/InvalidJsonSchema$anchorError.d.ts +8 -0
- package/types/errors/JsonSchema$anchorError.d.ts +7 -0
- package/types/errors/JsonSchemaUriError.d.ts +7 -0
- package/types/errors/MaximumBundleDepthError.d.ts +7 -0
- package/types/errors/MaximumDereferenceDepthError.d.ts +7 -0
- package/types/errors/MaximumResolveDepthError.d.ts +7 -0
- package/types/errors/ParseError.d.ts +7 -0
- package/types/errors/ParserError.d.ts +7 -0
- package/types/errors/PluginError.d.ts +12 -0
- package/types/errors/ResolveError.d.ts +7 -0
- package/types/errors/ResolverError.d.ts +7 -0
- package/types/errors/UnmatchedBundleStrategyError.d.ts +7 -0
- package/types/errors/UnmatchedDereferenceStrategyError.d.ts +7 -0
- package/types/errors/UnmatchedResolveStrategyError.d.ts +7 -0
- package/types/errors/UnmatchedResolverError.d.ts +7 -0
- package/types/index.d.ts +75 -0
- package/types/options/index.d.ts +62 -0
- package/types/options/util.d.ts +5 -0
- package/types/parse/index.d.ts +7 -0
- package/types/parse/parsers/Parser.d.ts +38 -0
- package/types/parse/parsers/api-design-systems-json/index.d.ts +21 -0
- package/types/parse/parsers/api-design-systems-yaml/index.d.ts +20 -0
- package/types/parse/parsers/apidom-json/index.d.ts +24 -0
- package/types/parse/parsers/arazzo-json-1/index.d.ts +21 -0
- package/types/parse/parsers/arazzo-yaml-1/index.d.ts +20 -0
- package/types/parse/parsers/asyncapi-json-2/index.d.ts +21 -0
- package/types/parse/parsers/asyncapi-yaml-2/index.d.ts +20 -0
- package/types/parse/parsers/binary/index-browser.d.ts +21 -0
- package/types/parse/parsers/binary/index-node.d.ts +21 -0
- package/types/parse/parsers/json/index.d.ts +20 -0
- package/types/parse/parsers/openapi-json-2/index.d.ts +21 -0
- package/types/parse/parsers/openapi-json-3-0/index.d.ts +21 -0
- package/types/parse/parsers/openapi-json-3-1/index.d.ts +21 -0
- package/types/parse/parsers/openapi-yaml-2/index.d.ts +20 -0
- package/types/parse/parsers/openapi-yaml-3-0/index.d.ts +20 -0
- package/types/parse/parsers/openapi-yaml-3-1/index.d.ts +20 -0
- package/types/parse/parsers/yaml-1-2/index.d.ts +20 -0
- package/types/resolve/index.d.ts +12 -0
- package/types/resolve/resolvers/HTTPResolver.d.ts +22 -0
- package/types/resolve/resolvers/Resolver.d.ts +17 -0
- package/types/resolve/resolvers/file/index-browser.d.ts +12 -0
- package/types/resolve/resolvers/file/index-node.d.ts +20 -0
- package/types/resolve/resolvers/http-axios/index.d.ts +30 -0
- package/types/resolve/strategies/ResolveStrategy.d.ts +19 -0
- package/types/resolve/strategies/apidom/index.d.ts +27 -0
- package/types/resolve/strategies/asyncapi-2/index.d.ts +27 -0
- package/types/resolve/strategies/openapi-2/index.d.ts +27 -0
- package/types/resolve/strategies/openapi-3-0/index.d.ts +27 -0
- package/types/resolve/strategies/openapi-3-1/index.d.ts +27 -0
- package/types/resolve/util.d.ts +6 -0
- package/types/util/plugins.d.ts +14 -0
- package/types/util/url.d.ts +106 -0
package/package.json
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@speclynx/apidom-reference",
|
|
3
|
+
"version": "1.12.1",
|
|
4
|
+
"description": "Advanced algorithms for semantic ApiDOM manipulations like dereferencing or resolution.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public",
|
|
7
|
+
"registry": "https://registry.npmjs.org",
|
|
8
|
+
"provenance": true
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"./src/configuration/saturated.mjs",
|
|
13
|
+
"./src/configuration/saturated.cjs"
|
|
14
|
+
],
|
|
15
|
+
"unpkg": "./dist/apidom-reference.browser.min.js",
|
|
16
|
+
"browser": {
|
|
17
|
+
"./src/parse/parsers/binary/index-node.cjs": "./src/parse/parsers/binary/index-browser.cjs",
|
|
18
|
+
"./src/resolve/resolvers/file/index-node.cjs": "./src/resolve/resolvers/file/index-browser.cjs",
|
|
19
|
+
"./src/parse/parsers/binary/index-node.mjs": "./src/parse/parsers/binary/index-browser.mjs",
|
|
20
|
+
"./src/resolve/resolvers/file/index-node.mjs": "./src/resolve/resolvers/file/index-browser.mjs"
|
|
21
|
+
},
|
|
22
|
+
"main": "./src/configuration/saturated.cjs",
|
|
23
|
+
"types": "./types/apidom-reference.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./src/configuration/saturated.mjs",
|
|
27
|
+
"require": "./src/configuration/saturated.cjs",
|
|
28
|
+
"types": "./types/apidom-reference.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./configuration/saturated": {
|
|
31
|
+
"import": "./src/configuration/saturated.mjs",
|
|
32
|
+
"require": "./src/configuration/saturated.cjs",
|
|
33
|
+
"types": "./types/apidom-reference.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./configuration/empty": {
|
|
36
|
+
"import": "./src/configuration/empty.mjs",
|
|
37
|
+
"require": "./src/configuration/empty.cjs",
|
|
38
|
+
"types": "./types/apidom-reference.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./resolve/resolvers/file": {
|
|
41
|
+
"browser": {
|
|
42
|
+
"import": "./src/resolve/resolvers/file/index-browser.mjs",
|
|
43
|
+
"require": "./src/resolve/resolvers/file/index-browser.cjs",
|
|
44
|
+
"types": "./types/resolve/resolvers/file/index-browser.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"default": {
|
|
47
|
+
"import": "./src/resolve/resolvers/file/index-node.mjs",
|
|
48
|
+
"require": "./src/resolve/resolvers/file/index-node.cjs",
|
|
49
|
+
"types": "./types/resolve/resolvers/file/index-node.d.ts"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"./resolve/resolvers/http-axios": {
|
|
53
|
+
"import": "./src/resolve/resolvers/http-axios/index.mjs",
|
|
54
|
+
"require": "./src/resolve/resolvers/http-axios/index.cjs",
|
|
55
|
+
"types": "./types/resolve/resolvers/http-axios/index.d.ts"
|
|
56
|
+
},
|
|
57
|
+
"./resolve/strategies/apidom": {
|
|
58
|
+
"import": "./src/resolve/strategies/apidom/index.mjs",
|
|
59
|
+
"require": "./src/resolve/strategies/apidom/index.cjs",
|
|
60
|
+
"types": "./types/resolve/strategies/apidom/index.d.ts"
|
|
61
|
+
},
|
|
62
|
+
"./resolve/strategies/asyncapi-2": {
|
|
63
|
+
"import": "./src/resolve/strategies/asyncapi-2/index.mjs",
|
|
64
|
+
"require": "./src/resolve/strategies/asyncapi-2/index.cjs",
|
|
65
|
+
"types": "./types/resolve/strategies/asyncapi-2/index.d.ts"
|
|
66
|
+
},
|
|
67
|
+
"./resolve/strategies/openapi-2": {
|
|
68
|
+
"import": "./src/resolve/strategies/openapi-2/index.mjs",
|
|
69
|
+
"require": "./src/resolve/strategies/openapi-2/index.cjs",
|
|
70
|
+
"types": "./types/resolve/strategies/openapi-2/index.d.ts"
|
|
71
|
+
},
|
|
72
|
+
"./resolve/strategies/openapi-3-0": {
|
|
73
|
+
"import": "./src/resolve/strategies/openapi-3-0/index.mjs",
|
|
74
|
+
"require": "./src/resolve/strategies/openapi-3-0/index.cjs",
|
|
75
|
+
"types": "./types/resolve/strategies/openapi-3-0/index.d.ts"
|
|
76
|
+
},
|
|
77
|
+
"./resolve/strategies/openapi-3-1": {
|
|
78
|
+
"import": "./src/resolve/strategies/openapi-3-1/index.mjs",
|
|
79
|
+
"require": "./src/resolve/strategies/openapi-3-1/index.cjs",
|
|
80
|
+
"types": "./types/resolve/strategies/openapi-3-1/index.d.ts"
|
|
81
|
+
},
|
|
82
|
+
"./parse/parsers/api-design-systems-json": {
|
|
83
|
+
"import": "./src/parse/parsers/api-design-systems-json/index.mjs",
|
|
84
|
+
"require": "./src/parse/parsers/api-design-systems-json/index.cjs",
|
|
85
|
+
"types": "./types/parse/parsers/api-design-systems-json/index.d.ts"
|
|
86
|
+
},
|
|
87
|
+
"./parse/parsers/api-design-systems-yaml": {
|
|
88
|
+
"import": "./src/parse/parsers/api-design-systems-yaml/index.mjs",
|
|
89
|
+
"require": "./src/parse/parsers/api-design-systems-yaml/index.cjs",
|
|
90
|
+
"types": "./types/parse/parsers/api-design-systems-yaml/index.d.ts"
|
|
91
|
+
},
|
|
92
|
+
"./parse/parsers/asyncapi-json-2": {
|
|
93
|
+
"import": "./src/parse/parsers/asyncapi-json-2/index.mjs",
|
|
94
|
+
"require": "./src/parse/parsers/asyncapi-json-2/index.cjs",
|
|
95
|
+
"types": "./types/parse/parsers/asyncapi-json-2/index.d.ts"
|
|
96
|
+
},
|
|
97
|
+
"./parse/parsers/asyncapi-yaml-2": {
|
|
98
|
+
"import": "./src/parse/parsers/asyncapi-yaml-2/index.mjs",
|
|
99
|
+
"require": "./src/parse/parsers/asyncapi-yaml-2/index.cjs",
|
|
100
|
+
"types": "./types/parse/parsers/asyncapi-yaml-2/index.d.ts"
|
|
101
|
+
},
|
|
102
|
+
"./parse/parsers/arazzo-json-1": {
|
|
103
|
+
"import": "./src/parse/parsers/arazzo-json-1/index.mjs",
|
|
104
|
+
"require": "./src/parse/parsers/arazzo-json-1/index.cjs",
|
|
105
|
+
"types": "./types/parse/parsers/arazzo-json-1/index.d.ts"
|
|
106
|
+
},
|
|
107
|
+
"./parse/parsers/arazzo-yaml-1": {
|
|
108
|
+
"import": "./src/parse/parsers/arazzo-yaml-1/index.mjs",
|
|
109
|
+
"require": "./src/parse/parsers/arazzo-yaml-1/index.cjs",
|
|
110
|
+
"types": "./types/parse/parsers/arazzo-yaml-1/index.d.ts"
|
|
111
|
+
},
|
|
112
|
+
"./parse/parsers/apidom-json": {
|
|
113
|
+
"import": "./src/parse/parsers/apidom-json/index.mjs",
|
|
114
|
+
"require": "./src/parse/parsers/apidom-json/index.cjs",
|
|
115
|
+
"types": "./types/parse/parsers/apidom-json/index.d.ts"
|
|
116
|
+
},
|
|
117
|
+
"./parse/parsers/binary": {
|
|
118
|
+
"browser": {
|
|
119
|
+
"import": "./src/parse/parsers/binary/index-browser.mjs",
|
|
120
|
+
"require": "./src/parse/parsers/binary/index-browser.cjs",
|
|
121
|
+
"types": "./types/parse/parsers/binary/index-browser.d.ts"
|
|
122
|
+
},
|
|
123
|
+
"default": {
|
|
124
|
+
"import": "./src/parse/parsers/binary/index-node.mjs",
|
|
125
|
+
"require": "./src/parse/parsers/binary/index-node.cjs",
|
|
126
|
+
"types": "./types/parse/parsers/binary/index-node.d.ts"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"./parse/parsers/json": {
|
|
130
|
+
"import": "./src/parse/parsers/json/index.mjs",
|
|
131
|
+
"require": "./src/parse/parsers/json/index.cjs",
|
|
132
|
+
"types": "./types/parse/parsers/json/index.d.ts"
|
|
133
|
+
},
|
|
134
|
+
"./parse/parsers/openapi-json-2": {
|
|
135
|
+
"import": "./src/parse/parsers/openapi-json-2/index.mjs",
|
|
136
|
+
"require": "./src/parse/parsers/openapi-json-2/index.cjs",
|
|
137
|
+
"types": "./types/parse/parsers/openapi-json-2/index.d.ts"
|
|
138
|
+
},
|
|
139
|
+
"./parse/parsers/openapi-yaml-2": {
|
|
140
|
+
"import": "./src/parse/parsers/openapi-yaml-2/index.mjs",
|
|
141
|
+
"require": "./src/parse/parsers/openapi-yaml-2/index.cjs",
|
|
142
|
+
"types": "./types/parse/parsers/openapi-yaml-2/index.d.ts"
|
|
143
|
+
},
|
|
144
|
+
"./parse/parsers/openapi-json-3-0": {
|
|
145
|
+
"import": "./src/parse/parsers/openapi-json-3-0/index.mjs",
|
|
146
|
+
"require": "./src/parse/parsers/openapi-json-3-0/index.cjs",
|
|
147
|
+
"types": "./types/parse/parsers/openapi-json-3-0/index.d.ts"
|
|
148
|
+
},
|
|
149
|
+
"./parse/parsers/openapi-json-3-1": {
|
|
150
|
+
"import": "./src/parse/parsers/openapi-json-3-1/index.mjs",
|
|
151
|
+
"require": "./src/parse/parsers/openapi-json-3-1/index.cjs",
|
|
152
|
+
"types": "./types/parse/parsers/openapi-json-3-1/index.d.ts"
|
|
153
|
+
},
|
|
154
|
+
"./parse/parsers/openapi-yaml-3-0": {
|
|
155
|
+
"import": "./src/parse/parsers/openapi-yaml-3-0/index.mjs",
|
|
156
|
+
"require": "./src/parse/parsers/openapi-yaml-3-0/index.cjs",
|
|
157
|
+
"types": "./types/parse/parsers/openapi-yaml-3-0/index.d.ts"
|
|
158
|
+
},
|
|
159
|
+
"./parse/parsers/openapi-yaml-3-1": {
|
|
160
|
+
"import": "./src/parse/parsers/openapi-yaml-3-1/index.mjs",
|
|
161
|
+
"require": "./src/parse/parsers/openapi-yaml-3-1/index.cjs",
|
|
162
|
+
"types": "./types/parse/parsers/openapi-yaml-3-1/index.d.ts"
|
|
163
|
+
},
|
|
164
|
+
"./parse/parsers/yaml-1-2": {
|
|
165
|
+
"import": "./src/parse/parsers/yaml-1-2/index.mjs",
|
|
166
|
+
"require": "./src/parse/parsers/yaml-1-2/index.cjs",
|
|
167
|
+
"types": "./types/parse/parsers/yaml-1-2/index.d.ts"
|
|
168
|
+
},
|
|
169
|
+
"./dereference/strategies/apidom": {
|
|
170
|
+
"import": "./src/dereference/strategies/apidom/index.mjs",
|
|
171
|
+
"require": "./src/dereference/strategies/apidom/index.cjs",
|
|
172
|
+
"types": "./types/dereference/strategies/apidom/index.d.ts"
|
|
173
|
+
},
|
|
174
|
+
"./dereference/strategies/apidom/selectors/element-id": {
|
|
175
|
+
"import": "./src/dereference/strategies/apidom/selectors/element-id.mjs",
|
|
176
|
+
"require": "./src/dereference/strategies/apidom/selectors/element-id.cjs",
|
|
177
|
+
"types": "./types/dereference/strategies/apidom/selectors/element-id.d.ts"
|
|
178
|
+
},
|
|
179
|
+
"./dereference/strategies/asyncapi-2": {
|
|
180
|
+
"import": "./src/dereference/strategies/asyncapi-2/index.mjs",
|
|
181
|
+
"require": "./src/dereference/strategies/asyncapi-2/index.cjs",
|
|
182
|
+
"types": "./types/dereference/strategies/asyncapi-2/index.d.ts"
|
|
183
|
+
},
|
|
184
|
+
"./dereference/strategies/openapi-2": {
|
|
185
|
+
"import": "./src/dereference/strategies/openapi-2/index.mjs",
|
|
186
|
+
"require": "./src/dereference/strategies/openapi-2/index.cjs",
|
|
187
|
+
"types": "./types/dereference/strategies/openapi-2/index.d.ts"
|
|
188
|
+
},
|
|
189
|
+
"./dereference/strategies/openapi-3-0": {
|
|
190
|
+
"import": "./src/dereference/strategies/openapi-3-0/index.mjs",
|
|
191
|
+
"require": "./src/dereference/strategies/openapi-3-0/index.cjs",
|
|
192
|
+
"types": "./types/dereference/strategies/openapi-3-0/index.d.ts"
|
|
193
|
+
},
|
|
194
|
+
"./dereference/strategies/openapi-3-1": {
|
|
195
|
+
"import": "./src/dereference/strategies/openapi-3-1/index.mjs",
|
|
196
|
+
"require": "./src/dereference/strategies/openapi-3-1/index.cjs",
|
|
197
|
+
"types": "./types/dereference/strategies/openapi-3-1/index.d.ts"
|
|
198
|
+
},
|
|
199
|
+
"./dereference/strategies/openapi-3-1/selectors/$anchor": {
|
|
200
|
+
"import": "./src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs",
|
|
201
|
+
"require": "./src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs",
|
|
202
|
+
"types": "./types/dereference/strategies/openapi-3-1/selectors/$anchor.d.ts"
|
|
203
|
+
},
|
|
204
|
+
"./dereference/strategies/openapi-3-1/selectors/uri": {
|
|
205
|
+
"import": "./src/dereference/strategies/openapi-3-1/selectors/uri.mjs",
|
|
206
|
+
"require": "./src/dereference/strategies/openapi-3-1/selectors/uri.cjs",
|
|
207
|
+
"types": "./types/dereference/strategies/openapi-3-1/selectors/uri.d.ts"
|
|
208
|
+
},
|
|
209
|
+
"./bundle/strategies/openapi-3-1": {
|
|
210
|
+
"import": "./src/bundle/strategies/openapi-3-1/index.mjs",
|
|
211
|
+
"require": "./src/bundle/strategies/openapi-3-1/index.cjs",
|
|
212
|
+
"types": "./types/bundle/strategies/openapi-3-1/index.d.ts"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"scripts": {
|
|
216
|
+
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
|
|
217
|
+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
|
|
218
|
+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'",
|
|
219
|
+
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
|
|
220
|
+
"lint": "eslint ./",
|
|
221
|
+
"lint:fix": "eslint ./ --fix",
|
|
222
|
+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
|
|
223
|
+
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
|
|
224
|
+
"perf": "cross-env BABEL_ENV=es babel ./test/perf/index.ts --out-file ./test/perf/index.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/index.mjs",
|
|
225
|
+
"perf:openapi-3-1-dereference": "cross-env BABEL_ENV=es babel ./test/perf/openapi-3-1-dereference.ts --out-file ./test/perf/openapi-3-1-dereference.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/openapi-3-1-dereference.mjs",
|
|
226
|
+
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
|
|
227
|
+
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
|
|
228
|
+
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
|
|
229
|
+
"postpack": "rimraf NOTICE LICENSES"
|
|
230
|
+
},
|
|
231
|
+
"repository": {
|
|
232
|
+
"type": "git",
|
|
233
|
+
"url": "git+https://github.com/speclynx/apidom.git"
|
|
234
|
+
},
|
|
235
|
+
"author": "Vladimir Gorej",
|
|
236
|
+
"license": "Apache-2.0",
|
|
237
|
+
"dependencies": {
|
|
238
|
+
"@babel/runtime-corejs3": "^7.28.4",
|
|
239
|
+
"@speclynx/apidom-core": "^1.12.1",
|
|
240
|
+
"@speclynx/apidom-error": "^1.12.1",
|
|
241
|
+
"@types/ramda": "~0.30.0",
|
|
242
|
+
"axios": "^1.13.0",
|
|
243
|
+
"minimatch": "^7.4.6",
|
|
244
|
+
"process": "^0.11.10",
|
|
245
|
+
"ramda": "~0.32.0",
|
|
246
|
+
"ramda-adjunct": "^6.0.0"
|
|
247
|
+
},
|
|
248
|
+
"optionalDependencies": {
|
|
249
|
+
"@speclynx/apidom-json-pointer": "^1.12.1",
|
|
250
|
+
"@speclynx/apidom-ns-arazzo-1": "^1.12.1",
|
|
251
|
+
"@speclynx/apidom-ns-asyncapi-2": "^1.12.1",
|
|
252
|
+
"@speclynx/apidom-ns-openapi-2": "^1.12.1",
|
|
253
|
+
"@speclynx/apidom-ns-openapi-3-0": "^1.12.1",
|
|
254
|
+
"@speclynx/apidom-ns-openapi-3-1": "^1.12.1",
|
|
255
|
+
"@speclynx/apidom-parser-adapter-api-design-systems-json": "^1.12.1",
|
|
256
|
+
"@speclynx/apidom-parser-adapter-api-design-systems-yaml": "^1.12.1",
|
|
257
|
+
"@speclynx/apidom-parser-adapter-arazzo-json-1": "^1.12.1",
|
|
258
|
+
"@speclynx/apidom-parser-adapter-arazzo-yaml-1": "^1.12.1",
|
|
259
|
+
"@speclynx/apidom-parser-adapter-asyncapi-json-2": "^1.12.1",
|
|
260
|
+
"@speclynx/apidom-parser-adapter-asyncapi-yaml-2": "^1.12.1",
|
|
261
|
+
"@speclynx/apidom-parser-adapter-json": "^1.12.1",
|
|
262
|
+
"@speclynx/apidom-parser-adapter-openapi-json-2": "^1.12.1",
|
|
263
|
+
"@speclynx/apidom-parser-adapter-openapi-json-3-0": "^1.12.1",
|
|
264
|
+
"@speclynx/apidom-parser-adapter-openapi-json-3-1": "^1.12.1",
|
|
265
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-2": "^1.12.1",
|
|
266
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-3-0": "^1.12.1",
|
|
267
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-3-1": "^1.12.1",
|
|
268
|
+
"@speclynx/apidom-parser-adapter-yaml-1-2": "^1.12.1"
|
|
269
|
+
},
|
|
270
|
+
"devDependencies": {
|
|
271
|
+
"@speclynx/apidom-json-pointer": "*",
|
|
272
|
+
"@speclynx/apidom-ns-arazzo-1": "*",
|
|
273
|
+
"@speclynx/apidom-ns-asyncapi-2": "*",
|
|
274
|
+
"@speclynx/apidom-ns-openapi-2": "*",
|
|
275
|
+
"@speclynx/apidom-ns-openapi-3-0": "*",
|
|
276
|
+
"@speclynx/apidom-ns-openapi-3-1": "*",
|
|
277
|
+
"@speclynx/apidom-parser-adapter-api-design-systems-json": "*",
|
|
278
|
+
"@speclynx/apidom-parser-adapter-api-design-systems-yaml": "*",
|
|
279
|
+
"@speclynx/apidom-parser-adapter-arazzo-json-1": "*",
|
|
280
|
+
"@speclynx/apidom-parser-adapter-arazzo-yaml-1": "*",
|
|
281
|
+
"@speclynx/apidom-parser-adapter-asyncapi-json-2": "*",
|
|
282
|
+
"@speclynx/apidom-parser-adapter-asyncapi-yaml-2": "*",
|
|
283
|
+
"@speclynx/apidom-parser-adapter-json": "*",
|
|
284
|
+
"@speclynx/apidom-parser-adapter-openapi-json-2": "*",
|
|
285
|
+
"@speclynx/apidom-parser-adapter-openapi-json-3-0": "*",
|
|
286
|
+
"@speclynx/apidom-parser-adapter-openapi-json-3-1": "*",
|
|
287
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-2": "*",
|
|
288
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-3-0": "*",
|
|
289
|
+
"@speclynx/apidom-parser-adapter-openapi-yaml-3-1": "*",
|
|
290
|
+
"@speclynx/apidom-parser-adapter-yaml-1-2": "*",
|
|
291
|
+
"axios-mock-adapter": "^2.0.0"
|
|
292
|
+
},
|
|
293
|
+
"files": [
|
|
294
|
+
"src/**/*.mjs",
|
|
295
|
+
"src/**/*.cjs",
|
|
296
|
+
"dist/",
|
|
297
|
+
"types/",
|
|
298
|
+
"LICENSES",
|
|
299
|
+
"NOTICE",
|
|
300
|
+
"README.md",
|
|
301
|
+
"CHANGELOG.md"
|
|
302
|
+
],
|
|
303
|
+
"gitHead": "49be88493f922c4ace2e4ebc0f23387ccb62c4fc"
|
|
304
|
+
}
|
package/src/File.cjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _ramda = require("ramda");
|
|
7
|
+
var _ramdaAdjunct = require("ramda-adjunct");
|
|
8
|
+
var url = _interopRequireWildcard(require("./util/url.cjs"));
|
|
9
|
+
/**
|
|
10
|
+
* This class represents a File object with url and data.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class File {
|
|
18
|
+
uri;
|
|
19
|
+
mediaType;
|
|
20
|
+
data;
|
|
21
|
+
parseResult;
|
|
22
|
+
constructor({
|
|
23
|
+
uri,
|
|
24
|
+
mediaType = 'text/plain',
|
|
25
|
+
data,
|
|
26
|
+
parseResult
|
|
27
|
+
}) {
|
|
28
|
+
this.uri = uri;
|
|
29
|
+
this.mediaType = mediaType;
|
|
30
|
+
this.data = data;
|
|
31
|
+
this.parseResult = parseResult;
|
|
32
|
+
}
|
|
33
|
+
get extension() {
|
|
34
|
+
if ((0, _ramdaAdjunct.isString)(this.uri)) {
|
|
35
|
+
return url.getExtension(this.uri);
|
|
36
|
+
}
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
toString() {
|
|
40
|
+
if (typeof this.data === 'string') {
|
|
41
|
+
return this.data;
|
|
42
|
+
}
|
|
43
|
+
if (this.data instanceof ArrayBuffer || ['ArrayBuffer'].includes((0, _ramda.type)(this.data)) || ArrayBuffer.isView(this.data)) {
|
|
44
|
+
const textDecoder = new TextDecoder('utf-8');
|
|
45
|
+
return textDecoder.decode(this.data);
|
|
46
|
+
}
|
|
47
|
+
return String(this.data);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var _default = exports.default = File;
|
package/src/File.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type } from 'ramda';
|
|
2
|
+
import { isString } from 'ramda-adjunct';
|
|
3
|
+
import * as url from "./util/url.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* This class represents a File object with url and data.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class File {
|
|
12
|
+
uri;
|
|
13
|
+
mediaType;
|
|
14
|
+
data;
|
|
15
|
+
parseResult;
|
|
16
|
+
constructor({
|
|
17
|
+
uri,
|
|
18
|
+
mediaType = 'text/plain',
|
|
19
|
+
data,
|
|
20
|
+
parseResult
|
|
21
|
+
}) {
|
|
22
|
+
this.uri = uri;
|
|
23
|
+
this.mediaType = mediaType;
|
|
24
|
+
this.data = data;
|
|
25
|
+
this.parseResult = parseResult;
|
|
26
|
+
}
|
|
27
|
+
get extension() {
|
|
28
|
+
if (isString(this.uri)) {
|
|
29
|
+
return url.getExtension(this.uri);
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
if (typeof this.data === 'string') {
|
|
35
|
+
return this.data;
|
|
36
|
+
}
|
|
37
|
+
if (this.data instanceof ArrayBuffer || ['ArrayBuffer'].includes(type(this.data)) || ArrayBuffer.isView(this.data)) {
|
|
38
|
+
const textDecoder = new TextDecoder('utf-8');
|
|
39
|
+
return textDecoder.decode(this.data);
|
|
40
|
+
}
|
|
41
|
+
return String(this.data);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default File;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class Reference {
|
|
13
|
+
uri;
|
|
14
|
+
depth;
|
|
15
|
+
value;
|
|
16
|
+
refSet;
|
|
17
|
+
errors;
|
|
18
|
+
constructor({
|
|
19
|
+
uri,
|
|
20
|
+
depth = 0,
|
|
21
|
+
refSet,
|
|
22
|
+
value
|
|
23
|
+
}) {
|
|
24
|
+
this.uri = uri;
|
|
25
|
+
this.value = value;
|
|
26
|
+
this.depth = depth;
|
|
27
|
+
this.refSet = refSet;
|
|
28
|
+
this.errors = [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var _default = exports.default = Reference;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
class Reference {
|
|
9
|
+
uri;
|
|
10
|
+
depth;
|
|
11
|
+
value;
|
|
12
|
+
refSet;
|
|
13
|
+
errors;
|
|
14
|
+
constructor({
|
|
15
|
+
uri,
|
|
16
|
+
depth = 0,
|
|
17
|
+
refSet,
|
|
18
|
+
value
|
|
19
|
+
}) {
|
|
20
|
+
this.uri = uri;
|
|
21
|
+
this.value = value;
|
|
22
|
+
this.depth = depth;
|
|
23
|
+
this.refSet = refSet;
|
|
24
|
+
this.errors = [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export default Reference;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _ramdaAdjunct = require("ramda-adjunct");
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
class ReferenceSet {
|
|
14
|
+
rootRef;
|
|
15
|
+
refs;
|
|
16
|
+
circular;
|
|
17
|
+
constructor({
|
|
18
|
+
refs = [],
|
|
19
|
+
circular = false
|
|
20
|
+
} = {}) {
|
|
21
|
+
this.refs = [];
|
|
22
|
+
this.circular = circular;
|
|
23
|
+
refs.forEach(this.add.bind(this));
|
|
24
|
+
}
|
|
25
|
+
get size() {
|
|
26
|
+
return this.refs.length;
|
|
27
|
+
}
|
|
28
|
+
add(reference) {
|
|
29
|
+
if (!this.has(reference)) {
|
|
30
|
+
this.refs.push(reference);
|
|
31
|
+
this.rootRef = this.rootRef === undefined ? reference : this.rootRef;
|
|
32
|
+
reference.refSet = this;
|
|
33
|
+
}
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
merge(anotherRefSet) {
|
|
37
|
+
for (const reference of anotherRefSet.values()) {
|
|
38
|
+
this.add(reference);
|
|
39
|
+
}
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
has(thing) {
|
|
43
|
+
const uri = (0, _ramdaAdjunct.isString)(thing) ? thing : thing.uri;
|
|
44
|
+
return (0, _ramdaAdjunct.isNotUndefined)(this.find(ref => ref.uri === uri));
|
|
45
|
+
}
|
|
46
|
+
find(predicate) {
|
|
47
|
+
return this.refs.find(predicate);
|
|
48
|
+
}
|
|
49
|
+
*values() {
|
|
50
|
+
yield* this.refs;
|
|
51
|
+
}
|
|
52
|
+
clean() {
|
|
53
|
+
this.refs.forEach(ref => {
|
|
54
|
+
ref.refSet = undefined;
|
|
55
|
+
});
|
|
56
|
+
this.rootRef = undefined;
|
|
57
|
+
this.refs.length = 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
var _default = exports.default = ReferenceSet;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isNotUndefined, isString } from 'ramda-adjunct';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class ReferenceSet {
|
|
11
|
+
rootRef;
|
|
12
|
+
refs;
|
|
13
|
+
circular;
|
|
14
|
+
constructor({
|
|
15
|
+
refs = [],
|
|
16
|
+
circular = false
|
|
17
|
+
} = {}) {
|
|
18
|
+
this.refs = [];
|
|
19
|
+
this.circular = circular;
|
|
20
|
+
refs.forEach(this.add.bind(this));
|
|
21
|
+
}
|
|
22
|
+
get size() {
|
|
23
|
+
return this.refs.length;
|
|
24
|
+
}
|
|
25
|
+
add(reference) {
|
|
26
|
+
if (!this.has(reference)) {
|
|
27
|
+
this.refs.push(reference);
|
|
28
|
+
this.rootRef = this.rootRef === undefined ? reference : this.rootRef;
|
|
29
|
+
reference.refSet = this;
|
|
30
|
+
}
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
merge(anotherRefSet) {
|
|
34
|
+
for (const reference of anotherRefSet.values()) {
|
|
35
|
+
this.add(reference);
|
|
36
|
+
}
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
has(thing) {
|
|
40
|
+
const uri = isString(thing) ? thing : thing.uri;
|
|
41
|
+
return isNotUndefined(this.find(ref => ref.uri === uri));
|
|
42
|
+
}
|
|
43
|
+
find(predicate) {
|
|
44
|
+
return this.refs.find(predicate);
|
|
45
|
+
}
|
|
46
|
+
*values() {
|
|
47
|
+
yield* this.refs;
|
|
48
|
+
}
|
|
49
|
+
clean() {
|
|
50
|
+
this.refs.forEach(ref => {
|
|
51
|
+
ref.refSet = undefined;
|
|
52
|
+
});
|
|
53
|
+
this.rootRef = undefined;
|
|
54
|
+
this.refs.length = 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export default ReferenceSet;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ramda = require("ramda");
|
|
8
|
+
var _File = _interopRequireDefault(require("../File.cjs"));
|
|
9
|
+
var plugins = _interopRequireWildcard(require("../util/plugins.cjs"));
|
|
10
|
+
var _UnmatchedBundleStrategyError = _interopRequireDefault(require("../errors/UnmatchedBundleStrategyError.cjs"));
|
|
11
|
+
var _BundleError = _interopRequireDefault(require("../errors/BundleError.cjs"));
|
|
12
|
+
var _index = _interopRequireDefault(require("../parse/index.cjs"));
|
|
13
|
+
var _util = require("../options/util.cjs");
|
|
14
|
+
var url = _interopRequireWildcard(require("../util/url.cjs"));
|
|
15
|
+
/**
|
|
16
|
+
* Bundle a file with all its external references to a compound document.
|
|
17
|
+
*/
|
|
18
|
+
const bundle = async (uri, options) => {
|
|
19
|
+
const {
|
|
20
|
+
refSet
|
|
21
|
+
} = options.bundle;
|
|
22
|
+
const sanitizedURI = url.sanitize(uri);
|
|
23
|
+
const mergedOptions = (0, _util.merge)(options, {
|
|
24
|
+
resolve: {
|
|
25
|
+
baseURI: sanitizedURI
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
let parseResult;
|
|
29
|
+
|
|
30
|
+
// if refSet was provided, use it to avoid unnecessary parsing
|
|
31
|
+
if (refSet !== null && refSet.has(sanitizedURI)) {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
({
|
|
34
|
+
value: parseResult
|
|
35
|
+
} = refSet.find((0, _ramda.propEq)(sanitizedURI, 'uri')));
|
|
36
|
+
} else {
|
|
37
|
+
parseResult = await (0, _index.default)(uri, mergedOptions);
|
|
38
|
+
}
|
|
39
|
+
const file = new _File.default({
|
|
40
|
+
uri: mergedOptions.resolve.baseURI,
|
|
41
|
+
parseResult,
|
|
42
|
+
mediaType: mergedOptions.parse.mediaType
|
|
43
|
+
});
|
|
44
|
+
const bundleStrategies = await plugins.filter('canBundle', [file, mergedOptions], mergedOptions.bundle.strategies);
|
|
45
|
+
|
|
46
|
+
// we couldn't find any bundle strategy for this File
|
|
47
|
+
if ((0, _ramda.isEmpty)(bundleStrategies)) {
|
|
48
|
+
throw new _UnmatchedBundleStrategyError.default(file.uri);
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const {
|
|
52
|
+
result
|
|
53
|
+
} = await plugins.run('bundle', [file, mergedOptions], bundleStrategies);
|
|
54
|
+
return result;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
throw new _BundleError.default(`Error while bundling file "${file.uri}"`, {
|
|
57
|
+
cause: error
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var _default = exports.default = bundle;
|