@speclynx/apidom-reference 1.12.2 → 2.1.0
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 +25 -0
- package/NOTICE +16 -7
- package/README.md +0 -33
- package/dist/167.apidom-reference.browser.min.js +1 -1
- package/dist/451.apidom-reference.browser.min.js +1 -1
- package/dist/apidom-reference.browser.js +29265 -23972
- package/dist/apidom-reference.browser.min.js +1 -1
- package/package.json +24 -57
- package/src/configuration/saturated.cjs +34 -42
- package/src/configuration/saturated.mjs +0 -8
- package/src/dereference/index.cjs +4 -4
- package/src/dereference/index.mjs +1 -1
- package/src/dereference/strategies/apidom/index.cjs +7 -7
- package/src/dereference/strategies/apidom/index.mjs +5 -6
- package/src/dereference/strategies/apidom/selectors/element-id.cjs +4 -2
- package/src/dereference/strategies/apidom/selectors/element-id.mjs +5 -3
- package/src/dereference/strategies/apidom/visitor.cjs +31 -17
- package/src/dereference/strategies/apidom/visitor.mjs +25 -12
- package/src/dereference/strategies/asyncapi-2/index.cjs +6 -9
- package/src/dereference/strategies/asyncapi-2/index.mjs +6 -10
- package/src/dereference/strategies/asyncapi-2/visitor.cjs +67 -80
- package/src/dereference/strategies/asyncapi-2/visitor.mjs +59 -72
- package/src/dereference/strategies/openapi-2/index.cjs +6 -9
- package/src/dereference/strategies/openapi-2/index.mjs +6 -10
- package/src/dereference/strategies/openapi-2/visitor.cjs +91 -100
- package/src/dereference/strategies/openapi-2/visitor.mjs +81 -90
- package/src/dereference/strategies/openapi-3-0/index.cjs +6 -9
- package/src/dereference/strategies/openapi-3-0/index.mjs +6 -10
- package/src/dereference/strategies/openapi-3-0/visitor.cjs +92 -115
- package/src/dereference/strategies/openapi-3-0/visitor.mjs +74 -97
- package/src/dereference/strategies/openapi-3-1/index.cjs +6 -9
- package/src/dereference/strategies/openapi-3-1/index.mjs +6 -10
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs +2 -1
- package/src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs +3 -2
- package/src/dereference/strategies/openapi-3-1/selectors/uri.cjs +2 -2
- package/src/dereference/strategies/openapi-3-1/selectors/uri.mjs +2 -2
- package/src/dereference/strategies/openapi-3-1/util.cjs +3 -2
- package/src/dereference/strategies/openapi-3-1/util.mjs +4 -3
- package/src/dereference/strategies/openapi-3-1/visitor.cjs +130 -156
- package/src/dereference/strategies/openapi-3-1/visitor.mjs +106 -132
- package/src/dereference/util.cjs +2 -2
- package/src/dereference/util.mjs +1 -1
- package/src/parse/parsers/apidom-json/index.cjs +5 -5
- package/src/parse/parsers/apidom-json/index.mjs +2 -2
- package/src/parse/parsers/arazzo-json-1/index.cjs +1 -2
- package/src/parse/parsers/arazzo-json-1/index.mjs +1 -2
- package/src/parse/parsers/asyncapi-json-2/index.cjs +1 -2
- package/src/parse/parsers/asyncapi-json-2/index.mjs +1 -2
- package/src/parse/parsers/binary/index-browser.cjs +3 -3
- package/src/parse/parsers/binary/index-browser.mjs +1 -1
- package/src/parse/parsers/binary/index-node.cjs +3 -3
- package/src/parse/parsers/binary/index-node.mjs +1 -1
- package/src/parse/parsers/json/index.cjs +1 -2
- package/src/parse/parsers/json/index.mjs +1 -2
- package/src/parse/parsers/openapi-json-2/index.cjs +1 -2
- package/src/parse/parsers/openapi-json-2/index.mjs +1 -2
- package/src/parse/parsers/openapi-json-3-0/index.cjs +1 -2
- package/src/parse/parsers/openapi-json-3-0/index.mjs +1 -2
- package/src/parse/parsers/openapi-json-3-1/index.cjs +1 -2
- package/src/parse/parsers/openapi-json-3-1/index.mjs +1 -2
- package/src/resolve/index.cjs +4 -4
- package/src/resolve/index.mjs +1 -1
- package/types/File.d.ts +1 -1
- package/types/Reference.d.ts +1 -1
- package/types/ReferenceSet.d.ts +1 -1
- package/types/apidom-reference.d.ts +8 -9
- package/types/bundle/index.d.ts +1 -1
- package/types/bundle/strategies/BundleStrategy.d.ts +1 -1
- package/types/bundle/strategies/openapi-3-1/index.d.ts +1 -1
- package/types/dereference/index.d.ts +1 -1
- package/types/dereference/strategies/DereferenceStrategy.d.ts +1 -1
- package/types/dereference/strategies/apidom/index.d.ts +1 -1
- package/types/dereference/strategies/apidom/selectors/element-id.d.ts +1 -1
- package/types/dereference/strategies/apidom/visitor.d.ts +3 -2
- package/types/dereference/strategies/asyncapi-2/index.d.ts +2 -2
- package/types/dereference/strategies/asyncapi-2/visitor.d.ts +5 -14
- package/types/dereference/strategies/openapi-2/index.d.ts +2 -2
- package/types/dereference/strategies/openapi-2/visitor.d.ts +6 -17
- package/types/dereference/strategies/openapi-3-0/index.d.ts +2 -2
- package/types/dereference/strategies/openapi-3-0/visitor.d.ts +7 -20
- package/types/dereference/strategies/openapi-3-1/index.d.ts +2 -2
- package/types/dereference/strategies/openapi-3-1/selectors/$anchor.d.ts +1 -1
- package/types/dereference/strategies/openapi-3-1/selectors/uri.d.ts +1 -1
- package/types/dereference/strategies/openapi-3-1/util.d.ts +1 -1
- package/types/dereference/strategies/openapi-3-1/visitor.d.ts +8 -23
- package/types/dereference/util.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/options/index.d.ts +1 -1
- package/types/parse/index.d.ts +1 -1
- package/types/parse/parsers/Parser.d.ts +1 -1
- package/types/parse/parsers/apidom-json/index.d.ts +1 -1
- package/types/parse/parsers/arazzo-json-1/index.d.ts +1 -2
- package/types/parse/parsers/arazzo-yaml-1/index.d.ts +1 -1
- package/types/parse/parsers/asyncapi-json-2/index.d.ts +1 -2
- package/types/parse/parsers/asyncapi-yaml-2/index.d.ts +1 -1
- package/types/parse/parsers/binary/index-browser.d.ts +1 -1
- package/types/parse/parsers/binary/index-node.d.ts +1 -1
- package/types/parse/parsers/json/index.d.ts +1 -2
- package/types/parse/parsers/openapi-json-2/index.d.ts +1 -2
- package/types/parse/parsers/openapi-json-3-0/index.d.ts +1 -2
- package/types/parse/parsers/openapi-json-3-1/index.d.ts +1 -2
- package/types/parse/parsers/openapi-yaml-2/index.d.ts +1 -1
- package/types/parse/parsers/openapi-yaml-3-0/index.d.ts +1 -1
- package/types/parse/parsers/openapi-yaml-3-1/index.d.ts +1 -1
- package/types/parse/parsers/yaml-1-2/index.d.ts +1 -1
- package/types/resolve/index.d.ts +1 -1
- package/src/parse/parsers/api-design-systems-json/index.cjs +0 -55
- package/src/parse/parsers/api-design-systems-json/index.mjs +0 -49
- package/src/parse/parsers/api-design-systems-yaml/index.cjs +0 -54
- package/src/parse/parsers/api-design-systems-yaml/index.mjs +0 -48
- package/types/parse/parsers/api-design-systems-json/index.d.ts +0 -21
- package/types/parse/parsers/api-design-systems-yaml/index.d.ts +0 -20
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { Element, Namespace } from '@speclynx/apidom-
|
|
2
|
-
import {
|
|
1
|
+
import { Element, Namespace } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { Path } from '@speclynx/apidom-traverse';
|
|
3
3
|
import Reference from '../../../Reference.ts';
|
|
4
4
|
import { AncestorLineage } from '../../util.ts';
|
|
5
5
|
import type { ReferenceOptions } from '../../../options/index.ts';
|
|
6
|
-
/**
|
|
7
|
-
* Custom mutation replacer.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare const mutationReplacer: (newElement: Element, oldElement: Element, key: string | number, parent: Element | undefined) => void;
|
|
11
6
|
/**
|
|
12
7
|
* @public
|
|
13
8
|
*/
|
|
@@ -32,21 +27,11 @@ declare class OpenAPI3_1DereferenceVisitor {
|
|
|
32
27
|
constructor({ reference, namespace, options, indirections, ancestors, refractCache, }: OpenAPI3_1DereferenceVisitorOptions);
|
|
33
28
|
protected toBaseURI(uri: string): string;
|
|
34
29
|
protected toReference(uri: string): Promise<Reference>;
|
|
35
|
-
protected toAncestorLineage(
|
|
36
|
-
ReferenceElement(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}): Promise<any>;
|
|
42
|
-
LinkElement(linkElement: LinkElement, key: string | number, parent: Element | undefined, path: (string | number)[], ancestors: [Element | Element[]], link: {
|
|
43
|
-
replaceWith: (element: Element, replacer: typeof mutationReplacer) => void;
|
|
44
|
-
}): Promise<LinkElement | undefined>;
|
|
45
|
-
ExampleElement(exampleElement: ExampleElement, key: string | number, parent: Element | undefined, path: (string | number)[], ancestors: [Element | Element[]], link: {
|
|
46
|
-
replaceWith: (element: Element, replacer: typeof mutationReplacer) => void;
|
|
47
|
-
}): Promise<ExampleElement | undefined>;
|
|
48
|
-
SchemaElement(referencingElement: SchemaElement, key: string | number, parent: Element | undefined, path: (string | number)[], ancestors: [Element | Element[]], link: {
|
|
49
|
-
replaceWith: (element: Element, replacer: typeof mutationReplacer) => void;
|
|
50
|
-
}): Promise<any>;
|
|
30
|
+
protected toAncestorLineage(path: Path<Element>): [AncestorLineage<Element>, Set<Element>];
|
|
31
|
+
ReferenceElement(path: Path<Element>): Promise<void>;
|
|
32
|
+
PathItemElement(path: Path<Element>): Promise<void>;
|
|
33
|
+
LinkElement(path: Path<Element>): Promise<void>;
|
|
34
|
+
ExampleElement(path: Path<Element>): Promise<void>;
|
|
35
|
+
SchemaElement(path: Path<Element>): Promise<void>;
|
|
51
36
|
}
|
|
52
37
|
export default OpenAPI3_1DereferenceVisitor;
|
package/types/index.d.ts
CHANGED
package/types/options/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefElement } from '
|
|
1
|
+
import type { RefElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import type Parser from '../parse/parsers/Parser.ts';
|
|
3
3
|
import type Resolver from '../resolve/resolvers/Resolver.ts';
|
|
4
4
|
import type ResolveStrategy from '../resolve/strategies/ResolveStrategy.ts';
|
package/types/parse/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Namespace, ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { Namespace, ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -12,7 +12,6 @@ export interface ArazzoJSON1ParserOptions extends Omit<ParserOptions, 'name'> {
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
declare class ArazzoJSON1Parser extends Parser {
|
|
15
|
-
syntacticAnalysis?: 'direct' | 'indirect';
|
|
16
15
|
refractorOpts: object;
|
|
17
16
|
constructor(options?: ArazzoJSON1ParserOptions);
|
|
18
17
|
canParse(file: File): Promise<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -12,7 +12,6 @@ export interface AsyncAPIJSON2ParserOptions extends Omit<ParserOptions, 'name'>
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
declare class AsyncAPIJSON2Parser extends Parser {
|
|
15
|
-
syntacticAnalysis?: 'direct' | 'indirect';
|
|
16
15
|
refractorOpts: object;
|
|
17
16
|
constructor(options?: AsyncAPIJSON2ParserOptions);
|
|
18
17
|
canParse(file: File): Promise<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -12,7 +12,6 @@ export interface JSONParserOptions extends Omit<ParserOptions, 'name'> {
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
declare class JSONParser extends Parser {
|
|
15
|
-
syntacticAnalysis?: 'direct' | 'indirect';
|
|
16
15
|
constructor(options?: JSONParserOptions);
|
|
17
16
|
canParse(file: File): Promise<boolean>;
|
|
18
17
|
parse(file: File): Promise<ParseResultElement>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -12,7 +12,6 @@ export interface OpenAPIJSON2ParserOptions extends Omit<ParserOptions, 'name'> {
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
declare class OpenAPIJSON2Parser extends Parser {
|
|
15
|
-
syntacticAnalysis?: 'direct' | 'indirect';
|
|
16
15
|
refractorOpts: object;
|
|
17
16
|
constructor(options?: OpenAPIJSON2ParserOptions);
|
|
18
17
|
canParse(file: File): Promise<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -12,7 +12,6 @@ export interface OpenAPIJSON3_0ParserOptions extends Omit<ParserOptions, 'name'>
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
declare class OpenAPIJSON3_0Parser extends Parser {
|
|
15
|
-
syntacticAnalysis?: 'direct' | 'indirect';
|
|
16
15
|
refractorOpts: object;
|
|
17
16
|
constructor(options?: OpenAPIJSON3_0ParserOptions);
|
|
18
17
|
canParse(file: File): Promise<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -12,7 +12,6 @@ export interface OpenAPIJSON3_1ParserOptions extends Omit<ParserOptions, 'name'>
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
declare class OpenAPIJSON3_1Parser extends Parser {
|
|
15
|
-
syntacticAnalysis?: 'direct' | 'indirect';
|
|
16
15
|
refractorOpts: object;
|
|
17
16
|
constructor(options?: OpenAPIJSON3_1ParserOptions);
|
|
18
17
|
canParse(file: File): Promise<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-
|
|
1
|
+
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
3
|
import File from '../../../File.ts';
|
|
4
4
|
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
package/types/resolve/index.d.ts
CHANGED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _ramda = require("ramda");
|
|
7
|
-
var _apidomParserAdapterApiDesignSystemsJson = require("@speclynx/apidom-parser-adapter-api-design-systems-json");
|
|
8
|
-
var _ParserError = _interopRequireDefault(require("../../../errors/ParserError.cjs"));
|
|
9
|
-
var _Parser = _interopRequireDefault(require("../Parser.cjs"));
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
class APIDesignSystemsJSONParser extends _Parser.default {
|
|
18
|
-
syntacticAnalysis;
|
|
19
|
-
refractorOpts;
|
|
20
|
-
constructor(options) {
|
|
21
|
-
const {
|
|
22
|
-
fileExtensions = [],
|
|
23
|
-
mediaTypes = _apidomParserAdapterApiDesignSystemsJson.mediaTypes,
|
|
24
|
-
...rest
|
|
25
|
-
} = options ?? {};
|
|
26
|
-
super({
|
|
27
|
-
...rest,
|
|
28
|
-
name: 'api-design-systems-json',
|
|
29
|
-
fileExtensions,
|
|
30
|
-
mediaTypes
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
async canParse(file) {
|
|
34
|
-
const hasSupportedFileExtension = this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension);
|
|
35
|
-
const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType);
|
|
36
|
-
if (!hasSupportedFileExtension) return false;
|
|
37
|
-
if (hasSupportedMediaType) return true;
|
|
38
|
-
if (!hasSupportedMediaType) {
|
|
39
|
-
return (0, _apidomParserAdapterApiDesignSystemsJson.detect)(file.toString());
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
async parse(file) {
|
|
44
|
-
const source = file.toString();
|
|
45
|
-
try {
|
|
46
|
-
const parserOpts = (0, _ramda.pick)(['sourceMap', 'syntacticAnalysis', 'refractorOpts'], this);
|
|
47
|
-
return await (0, _apidomParserAdapterApiDesignSystemsJson.parse)(source, parserOpts);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
throw new _ParserError.default(`Error parsing "${file.uri}"`, {
|
|
50
|
-
cause: error
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
var _default = exports.default = APIDesignSystemsJSONParser;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { pick } from 'ramda';
|
|
2
|
-
import { parse, mediaTypes as ADSMediaTypes, detect } from '@speclynx/apidom-parser-adapter-api-design-systems-json';
|
|
3
|
-
import ParserError from "../../../errors/ParserError.mjs";
|
|
4
|
-
import Parser from "../Parser.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
class APIDesignSystemsJSONParser extends Parser {
|
|
12
|
-
syntacticAnalysis;
|
|
13
|
-
refractorOpts;
|
|
14
|
-
constructor(options) {
|
|
15
|
-
const {
|
|
16
|
-
fileExtensions = [],
|
|
17
|
-
mediaTypes = ADSMediaTypes,
|
|
18
|
-
...rest
|
|
19
|
-
} = options ?? {};
|
|
20
|
-
super({
|
|
21
|
-
...rest,
|
|
22
|
-
name: 'api-design-systems-json',
|
|
23
|
-
fileExtensions,
|
|
24
|
-
mediaTypes
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async canParse(file) {
|
|
28
|
-
const hasSupportedFileExtension = this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension);
|
|
29
|
-
const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType);
|
|
30
|
-
if (!hasSupportedFileExtension) return false;
|
|
31
|
-
if (hasSupportedMediaType) return true;
|
|
32
|
-
if (!hasSupportedMediaType) {
|
|
33
|
-
return detect(file.toString());
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
async parse(file) {
|
|
38
|
-
const source = file.toString();
|
|
39
|
-
try {
|
|
40
|
-
const parserOpts = pick(['sourceMap', 'syntacticAnalysis', 'refractorOpts'], this);
|
|
41
|
-
return await parse(source, parserOpts);
|
|
42
|
-
} catch (error) {
|
|
43
|
-
throw new ParserError(`Error parsing "${file.uri}"`, {
|
|
44
|
-
cause: error
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export default APIDesignSystemsJSONParser;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _ramda = require("ramda");
|
|
7
|
-
var _apidomParserAdapterApiDesignSystemsYaml = require("@speclynx/apidom-parser-adapter-api-design-systems-yaml");
|
|
8
|
-
var _ParserError = _interopRequireDefault(require("../../../errors/ParserError.cjs"));
|
|
9
|
-
var _Parser = _interopRequireDefault(require("../Parser.cjs"));
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
class APIDesignSystemsYAMLParser extends _Parser.default {
|
|
18
|
-
refractorOpts;
|
|
19
|
-
constructor(options) {
|
|
20
|
-
const {
|
|
21
|
-
fileExtensions = [],
|
|
22
|
-
mediaTypes = _apidomParserAdapterApiDesignSystemsYaml.mediaTypes,
|
|
23
|
-
...rest
|
|
24
|
-
} = options ?? {};
|
|
25
|
-
super({
|
|
26
|
-
...rest,
|
|
27
|
-
name: 'api-design-systems-yaml',
|
|
28
|
-
fileExtensions,
|
|
29
|
-
mediaTypes
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async canParse(file) {
|
|
33
|
-
const hasSupportedFileExtension = this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension);
|
|
34
|
-
const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType);
|
|
35
|
-
if (!hasSupportedFileExtension) return false;
|
|
36
|
-
if (hasSupportedMediaType) return true;
|
|
37
|
-
if (!hasSupportedMediaType) {
|
|
38
|
-
return (0, _apidomParserAdapterApiDesignSystemsYaml.detect)(file.toString());
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
async parse(file) {
|
|
43
|
-
const source = file.toString();
|
|
44
|
-
try {
|
|
45
|
-
const parserOpts = (0, _ramda.pick)(['sourceMap', 'refractorOpts'], this);
|
|
46
|
-
return await (0, _apidomParserAdapterApiDesignSystemsYaml.parse)(source, parserOpts);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
throw new _ParserError.default(`Error parsing "${file.uri}"`, {
|
|
49
|
-
cause: error
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
var _default = exports.default = APIDesignSystemsYAMLParser;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { pick } from 'ramda';
|
|
2
|
-
import { parse, mediaTypes as ADSMediaTypes, detect } from '@speclynx/apidom-parser-adapter-api-design-systems-yaml';
|
|
3
|
-
import ParserError from "../../../errors/ParserError.mjs";
|
|
4
|
-
import Parser from "../Parser.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
class APIDesignSystemsYAMLParser extends Parser {
|
|
12
|
-
refractorOpts;
|
|
13
|
-
constructor(options) {
|
|
14
|
-
const {
|
|
15
|
-
fileExtensions = [],
|
|
16
|
-
mediaTypes = ADSMediaTypes,
|
|
17
|
-
...rest
|
|
18
|
-
} = options ?? {};
|
|
19
|
-
super({
|
|
20
|
-
...rest,
|
|
21
|
-
name: 'api-design-systems-yaml',
|
|
22
|
-
fileExtensions,
|
|
23
|
-
mediaTypes
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async canParse(file) {
|
|
27
|
-
const hasSupportedFileExtension = this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension);
|
|
28
|
-
const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType);
|
|
29
|
-
if (!hasSupportedFileExtension) return false;
|
|
30
|
-
if (hasSupportedMediaType) return true;
|
|
31
|
-
if (!hasSupportedMediaType) {
|
|
32
|
-
return detect(file.toString());
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
async parse(file) {
|
|
37
|
-
const source = file.toString();
|
|
38
|
-
try {
|
|
39
|
-
const parserOpts = pick(['sourceMap', 'refractorOpts'], this);
|
|
40
|
-
return await parse(source, parserOpts);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
throw new ParserError(`Error parsing "${file.uri}"`, {
|
|
43
|
-
cause: error
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export default APIDesignSystemsYAMLParser;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-core';
|
|
2
|
-
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
|
-
import File from '../../../File.ts';
|
|
4
|
-
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
5
|
-
export type { default as File, FileOptions } from '../../../File.ts';
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export interface APIDesignSystemsJSONParserOptions extends Omit<ParserOptions, 'name'> {
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
declare class APIDesignSystemsJSONParser extends Parser {
|
|
15
|
-
syntacticAnalysis?: 'direct' | 'indirect';
|
|
16
|
-
refractorOpts: object;
|
|
17
|
-
constructor(options?: APIDesignSystemsJSONParserOptions);
|
|
18
|
-
canParse(file: File): Promise<boolean>;
|
|
19
|
-
parse(file: File): Promise<ParseResultElement>;
|
|
20
|
-
}
|
|
21
|
-
export default APIDesignSystemsJSONParser;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ParseResultElement } from '@speclynx/apidom-core';
|
|
2
|
-
import Parser, { ParserOptions } from '../Parser.ts';
|
|
3
|
-
import File from '../../../File.ts';
|
|
4
|
-
export type { default as Parser, ParserOptions } from '../Parser.ts';
|
|
5
|
-
export type { default as File, FileOptions } from '../../../File.ts';
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export interface APIDesignSystemsYAMLParserOptions extends Omit<ParserOptions, 'name'> {
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
declare class APIDesignSystemsYAMLParser extends Parser {
|
|
15
|
-
refractorOpts: object;
|
|
16
|
-
constructor(options?: APIDesignSystemsYAMLParserOptions);
|
|
17
|
-
canParse(file: File): Promise<boolean>;
|
|
18
|
-
parse(file: File): Promise<ParseResultElement>;
|
|
19
|
-
}
|
|
20
|
-
export default APIDesignSystemsYAMLParser;
|