@swagger-api/apidom-parser-adapter-yaml-1-2 1.0.0-alpha.8 → 1.0.0-beta.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 +14 -0
- package/dist/20cf92ce276cf3be872fb26fd7985dd3.wasm +0 -0
- package/dist/apidom-parser-adapter-yaml-1-2.browser.js +4284 -495
- package/dist/apidom-parser-adapter-yaml1-2.browser.min.js +1 -1
- package/dist/fcc2efc64ace4e98eaa856cf3b3edf1f.wasm +0 -0
- package/package.json +32 -32
- package/{cjs → src}/adapter-browser.cjs +15 -1
- package/{es → src}/adapter-browser.mjs +17 -1
- package/{cjs → src}/adapter-node.cjs +15 -1
- package/{es → src}/adapter-node.mjs +17 -1
- package/{cjs → src}/adapter.cjs +3 -0
- package/{es → src}/adapter.mjs +3 -0
- package/{cjs → src}/lexical-analysis/browser.cjs +1 -0
- package/{es → src}/lexical-analysis/browser.mjs +1 -0
- package/{cjs → src}/lexical-analysis/node.cjs +2 -1
- package/{es → src}/lexical-analysis/node.mjs +2 -1
- package/{cjs → src}/media-types.cjs +7 -0
- package/{es → src}/media-types.mjs +8 -0
- package/{cjs → src}/syntactic-analysis/TreeCursorSyntaxNode.cjs +2 -10
- package/{es → src}/syntactic-analysis/TreeCursorSyntaxNode.mjs +2 -10
- package/{cjs → src}/syntactic-analysis/indirect/index.cjs +6 -1
- package/{es → src}/syntactic-analysis/indirect/index.mjs +5 -1
- package/types/apidom-parser-adapter-yaml-1-2.d.ts +71 -0
- package/wasm/tree-sitter-yaml.wasm +0 -0
- package/dist/23aac571c96605dc25219087ad291441.wasm +0 -0
- package/dist/d396281e11774e0afa7a40d620779b6d.wasm +0 -0
- package/types/dist.d.ts +0 -39
- /package/{cjs → src}/lexical-analysis/browser-patch.cjs +0 -0
- /package/{es → src}/lexical-analysis/browser-patch.mjs +0 -0
- /package/{cjs → src}/syntactic-analysis/TreeCursorIterator.cjs +0 -0
- /package/{es → src}/syntactic-analysis/TreeCursorIterator.mjs +0 -0
- /package/{cjs → src}/syntactic-analysis/indirect/visitors/CstVisitor.cjs +0 -0
- /package/{es → src}/syntactic-analysis/indirect/visitors/CstVisitor.mjs +0 -0
- /package/{cjs → src}/syntactic-analysis/indirect/visitors/YamlAstVisitor.cjs +0 -0
- /package/{es → src}/syntactic-analysis/indirect/visitors/YamlAstVisitor.mjs +0 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swagger-api/apidom-parser-adapter-yaml-1-2",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"description": "Parser adapter for parsing YAML documents into base namespace.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -8,39 +8,39 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": [
|
|
11
|
-
"./
|
|
12
|
-
"./
|
|
11
|
+
"./src/lexical-analysis/browser-patch.mjs",
|
|
12
|
+
"./src/lexical-analysis/browser-patch.cjs"
|
|
13
13
|
],
|
|
14
14
|
"unpkg": "./dist/apidom-parser-apdater-yaml-1-2.browser.min.js",
|
|
15
|
-
"main": "./
|
|
15
|
+
"main": "./src/adapter-node.cjs",
|
|
16
16
|
"exports": {
|
|
17
|
-
"types": "./types/
|
|
17
|
+
"types": "./types/apidom-parser-adapter-yaml-1-2.d.ts",
|
|
18
18
|
"node": {
|
|
19
|
-
"import": "./
|
|
20
|
-
"require": "./
|
|
19
|
+
"import": "./src/adapter-node.mjs",
|
|
20
|
+
"require": "./src/adapter-node.cjs"
|
|
21
21
|
},
|
|
22
22
|
"browser": {
|
|
23
|
-
"import": "./
|
|
23
|
+
"import": "./src/adapter-browser.mjs"
|
|
24
24
|
},
|
|
25
|
-
"default": "./
|
|
25
|
+
"default": "./src/adapter-node.cjs"
|
|
26
26
|
},
|
|
27
|
-
"types": "./types/
|
|
27
|
+
"types": "./types/apidom-parser-adapter-yaml-1-2.d.ts",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
|
|
30
|
-
"build:es": "npm run build:wasm && npm run build:wasm:copy && cross-env BABEL_ENV=es babel src --out-dir
|
|
31
|
-
"build:cjs": "npm run build:wasm && npm run build:wasm:copy && BABEL_ENV=cjs babel src --out-dir
|
|
30
|
+
"build:es": "npm run build:wasm && npm run build:wasm:copy && cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
|
|
31
|
+
"build:cjs": "npm run build:wasm && npm run build:wasm:copy && BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'",
|
|
32
32
|
"build:umd:browser": "npm run build:wasm && npm run build:wasm:copy && cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
|
|
33
|
-
"build:wasm": "node ../../scripts/file-exists.js ../../node_modules/tree-sitter-yaml/tree-sitter-yaml.wasm && exit 0 || cd ../../node_modules/tree-sitter-yaml &&
|
|
34
|
-
"build:wasm:copy": "copyfiles -u
|
|
33
|
+
"build:wasm": "node ../../scripts/file-exists.js ../../node_modules/@tree-sitter-grammars/tree-sitter-yaml/tree-sitter-yaml.wasm && exit 0 || cd ../../node_modules/@tree-sitter-grammars/tree-sitter-yaml && tree-sitter generate ./grammar.js && tree-sitter build --wasm && node-gyp rebuild",
|
|
34
|
+
"build:wasm:copy": "copyfiles -u 5 ../../node_modules/@tree-sitter-grammars/tree-sitter-yaml/tree-sitter-yaml.wasm wasm",
|
|
35
35
|
"lint": "eslint ./",
|
|
36
36
|
"lint:fix": "eslint ./ --fix",
|
|
37
|
-
"clean": "rimraf
|
|
38
|
-
"typescript:check-types": "tsc --noEmit",
|
|
39
|
-
"typescript:declaration": "tsc -p declaration.
|
|
40
|
-
"test": "cross-env NODE_ENV=test
|
|
41
|
-
"perf": "cross-env
|
|
42
|
-
"perf:lexical-analysis": "cross-env
|
|
43
|
-
"perf:parse-syntactic-analysis-indirect": "cross-env
|
|
37
|
+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
|
|
38
|
+
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
|
|
39
|
+
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
|
|
40
|
+
"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 NODE_NO_WARNINGS=1 mocha",
|
|
41
|
+
"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",
|
|
42
|
+
"perf:lexical-analysis": "cross-env BABEL_ENV=es babel ./test/perf/lexical-analysis.ts --out-file ./test/perf/lexical-analysis.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/lexical-analysis.mjs",
|
|
43
|
+
"perf:parse-syntactic-analysis-indirect": "cross-env BABEL_ENV=es babel ./test/perf/parse-syntactic-analysis-indirect.ts --out-file ./test/perf/parse-syntactic-analysis-indirect.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/parse-syntactic-analysis-indirect.mjs",
|
|
44
44
|
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
|
|
45
45
|
"postpack": "rimraf NOTICE LICENSES"
|
|
46
46
|
},
|
|
@@ -52,29 +52,29 @@
|
|
|
52
52
|
"license": "Apache-2.0",
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime-corejs3": "^7.20.7",
|
|
55
|
-
"@swagger-api/apidom-ast": "^1.0.0-
|
|
56
|
-
"@swagger-api/apidom-core": "^1.0.0-
|
|
57
|
-
"@swagger-api/apidom-error": "^1.0.0-
|
|
55
|
+
"@swagger-api/apidom-ast": "^1.0.0-beta.0",
|
|
56
|
+
"@swagger-api/apidom-core": "^1.0.0-beta.0",
|
|
57
|
+
"@swagger-api/apidom-error": "^1.0.0-beta.0",
|
|
58
|
+
"@tree-sitter-grammars/tree-sitter-yaml": "=0.6.1",
|
|
58
59
|
"@types/ramda": "~0.30.0",
|
|
59
60
|
"ramda": "~0.30.0",
|
|
60
61
|
"ramda-adjunct": "^5.0.0",
|
|
61
|
-
"tree-sitter": "=0.
|
|
62
|
-
"tree-sitter
|
|
63
|
-
"web-tree-sitter": "=0.20.3"
|
|
62
|
+
"tree-sitter": "=0.21.1",
|
|
63
|
+
"web-tree-sitter": "=0.24.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"tree-sitter-cli": "=0.
|
|
66
|
+
"tree-sitter-cli": "=0.24.3"
|
|
67
67
|
},
|
|
68
68
|
"files": [
|
|
69
|
-
"
|
|
69
|
+
"src/**/*.mjs",
|
|
70
|
+
"src/**/*.cjs",
|
|
70
71
|
"dist/",
|
|
71
|
-
"
|
|
72
|
-
"types/dist.d.ts",
|
|
72
|
+
"types/apidom-parser-adapter-yaml-1-2.d.ts",
|
|
73
73
|
"wasm/",
|
|
74
74
|
"LICENSES",
|
|
75
75
|
"NOTICE",
|
|
76
76
|
"README.md",
|
|
77
77
|
"CHANGELOG.md"
|
|
78
78
|
],
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "ed1426743ba9d9d581146e617ec1762df670320c"
|
|
80
80
|
}
|
|
@@ -10,15 +10,29 @@ exports.syntacticAnalysis = _index.default;
|
|
|
10
10
|
var _adapter = require("./adapter.cjs");
|
|
11
11
|
exports.mediaTypes = _adapter.mediaTypes;
|
|
12
12
|
exports.namespace = _adapter.namespace;
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
13
16
|
const detect = async source => {
|
|
14
17
|
try {
|
|
15
18
|
const cst = await (0, _browser.default)(source);
|
|
16
|
-
return cst.rootNode.
|
|
19
|
+
return !cst.rootNode.isError;
|
|
17
20
|
} catch {
|
|
18
21
|
return false;
|
|
19
22
|
}
|
|
20
23
|
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
21
32
|
exports.detect = detect;
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
22
36
|
const parse = async (source, {
|
|
23
37
|
sourceMap = false
|
|
24
38
|
} = {}) => {
|
|
@@ -2,14 +2,30 @@ import lexicalAnalysis from "./lexical-analysis/browser.mjs";
|
|
|
2
2
|
import syntacticAnalysis from "./syntactic-analysis/indirect/index.mjs";
|
|
3
3
|
export { mediaTypes, namespace } from "./adapter.mjs";
|
|
4
4
|
export { lexicalAnalysis, syntacticAnalysis };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
5
9
|
export const detect = async source => {
|
|
6
10
|
try {
|
|
7
11
|
const cst = await lexicalAnalysis(source);
|
|
8
|
-
return cst.rootNode.
|
|
12
|
+
return !cst.rootNode.isError;
|
|
9
13
|
} catch {
|
|
10
14
|
return false;
|
|
11
15
|
}
|
|
12
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
13
29
|
export const parse = async (source, {
|
|
14
30
|
sourceMap = false
|
|
15
31
|
} = {}) => {
|
|
@@ -10,15 +10,29 @@ exports.syntacticAnalysis = _index.default;
|
|
|
10
10
|
var _adapter = require("./adapter.cjs");
|
|
11
11
|
exports.mediaTypes = _adapter.mediaTypes;
|
|
12
12
|
exports.namespace = _adapter.namespace;
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
13
16
|
const detect = async source => {
|
|
14
17
|
try {
|
|
15
18
|
const cst = await (0, _node.default)(source);
|
|
16
|
-
return cst.rootNode.
|
|
19
|
+
return !cst.rootNode.isError;
|
|
17
20
|
} catch {
|
|
18
21
|
return false;
|
|
19
22
|
}
|
|
20
23
|
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
21
32
|
exports.detect = detect;
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
22
36
|
const parse = async (source, {
|
|
23
37
|
sourceMap = false
|
|
24
38
|
} = {}) => {
|
|
@@ -2,14 +2,30 @@ import lexicalAnalysis from "./lexical-analysis/node.mjs";
|
|
|
2
2
|
import syntacticAnalysis from "./syntactic-analysis/indirect/index.mjs";
|
|
3
3
|
export { mediaTypes, namespace } from "./adapter.mjs";
|
|
4
4
|
export { lexicalAnalysis, syntacticAnalysis };
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
5
9
|
export const detect = async source => {
|
|
6
10
|
try {
|
|
7
11
|
const cst = await lexicalAnalysis(source);
|
|
8
|
-
return cst.rootNode.
|
|
12
|
+
return !cst.rootNode.isError;
|
|
9
13
|
} catch {
|
|
10
14
|
return false;
|
|
11
15
|
}
|
|
12
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
13
29
|
export const parse = async (source, {
|
|
14
30
|
sourceMap = false
|
|
15
31
|
} = {}) => {
|
package/{cjs → src}/adapter.cjs
RENAMED
|
@@ -6,4 +6,7 @@ exports.namespace = exports.mediaTypes = void 0;
|
|
|
6
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
7
7
|
var _mediaTypes = _interopRequireDefault(require("./media-types.cjs"));
|
|
8
8
|
exports.mediaTypes = _mediaTypes.default;
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
const namespace = exports.namespace = (0, _apidomCore.createNamespace)();
|
package/{es → src}/adapter.mjs
RENAMED
|
@@ -18,6 +18,7 @@ let parserInitLock = null;
|
|
|
18
18
|
*
|
|
19
19
|
* Given JavaScript doesn't support true parallelism, this
|
|
20
20
|
* code should be as lazy as possible and temporal safety should be fine.
|
|
21
|
+
* @public
|
|
21
22
|
*/
|
|
22
23
|
const analyze = async source => {
|
|
23
24
|
if (parser === null && parserInitLock === null) {
|
|
@@ -13,6 +13,7 @@ let parserInitLock = null;
|
|
|
13
13
|
*
|
|
14
14
|
* Given JavaScript doesn't support true parallelism, this
|
|
15
15
|
* code should be as lazy as possible and temporal safety should be fine.
|
|
16
|
+
* @public
|
|
16
17
|
*/
|
|
17
18
|
const analyze = async source => {
|
|
18
19
|
if (parser === null && parserInitLock === null) {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
6
|
var _treeSitter = _interopRequireDefault(require("tree-sitter"));
|
|
7
|
-
var _treeSitterYaml = _interopRequireDefault(require("tree-sitter-yaml"));
|
|
7
|
+
var _treeSitterYaml = _interopRequireDefault(require("@tree-sitter-grammars/tree-sitter-yaml"));
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
|
|
10
10
|
const parser = new _treeSitter.default();
|
|
@@ -13,6 +13,7 @@ parser.setLanguage(_treeSitterYaml.default);
|
|
|
13
13
|
/**
|
|
14
14
|
* Lexical Analysis of source string using TreeSitter.
|
|
15
15
|
* This is Node.js version of TreeSitters Lexical Analysis.
|
|
16
|
+
* @public
|
|
16
17
|
*/
|
|
17
18
|
const analyze = async source => {
|
|
18
19
|
return parser.parse(source);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import Parser from 'tree-sitter';
|
|
2
2
|
// @ts-ignore
|
|
3
|
-
import YAMLLanguage from 'tree-sitter-yaml';
|
|
3
|
+
import YAMLLanguage from '@tree-sitter-grammars/tree-sitter-yaml';
|
|
4
4
|
const parser = new Parser();
|
|
5
5
|
parser.setLanguage(YAMLLanguage);
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Lexical Analysis of source string using TreeSitter.
|
|
9
9
|
* This is Node.js version of TreeSitters Lexical Analysis.
|
|
10
|
+
* @public
|
|
10
11
|
*/
|
|
11
12
|
const analyze = async source => {
|
|
12
13
|
return parser.parse(source);
|
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = exports.YamlMediaTypes = void 0;
|
|
5
5
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
class YamlMediaTypes extends _apidomCore.MediaTypes {
|
|
7
10
|
latest() {
|
|
8
11
|
return this[1];
|
|
9
12
|
}
|
|
10
13
|
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
11
18
|
exports.YamlMediaTypes = YamlMediaTypes;
|
|
12
19
|
const mediaTypes = new YamlMediaTypes('text/yaml', 'application/yaml');
|
|
13
20
|
var _default = exports.default = mediaTypes;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { MediaTypes } from '@swagger-api/apidom-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
2
6
|
export class YamlMediaTypes extends MediaTypes {
|
|
3
7
|
latest() {
|
|
4
8
|
return this[1];
|
|
5
9
|
}
|
|
6
10
|
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
7
15
|
const mediaTypes = new YamlMediaTypes('text/yaml', 'application/yaml');
|
|
8
16
|
export default mediaTypes;
|
|
@@ -63,19 +63,11 @@ class TreeCursorSyntaxNode {
|
|
|
63
63
|
return this.children.find(node => node.isNamed);
|
|
64
64
|
}
|
|
65
65
|
setFieldName(cursor) {
|
|
66
|
-
|
|
67
|
-
this.fieldName = cursor.currentFieldName();
|
|
68
|
-
} else {
|
|
69
|
-
this.fieldName = cursor.currentFieldName;
|
|
70
|
-
}
|
|
66
|
+
this.fieldName = cursor.currentFieldName;
|
|
71
67
|
return this;
|
|
72
68
|
}
|
|
73
69
|
setHasError(cursor) {
|
|
74
|
-
|
|
75
|
-
this.hasError = cursor.currentNode().hasError();
|
|
76
|
-
} else {
|
|
77
|
-
this.hasError = cursor.currentNode.hasError();
|
|
78
|
-
}
|
|
70
|
+
this.hasError = cursor.currentNode.hasError;
|
|
79
71
|
return this;
|
|
80
72
|
}
|
|
81
73
|
setPreviousSibling(previousSibling) {
|
|
@@ -59,19 +59,11 @@ class TreeCursorSyntaxNode {
|
|
|
59
59
|
return this.children.find(node => node.isNamed);
|
|
60
60
|
}
|
|
61
61
|
setFieldName(cursor) {
|
|
62
|
-
|
|
63
|
-
this.fieldName = cursor.currentFieldName();
|
|
64
|
-
} else {
|
|
65
|
-
this.fieldName = cursor.currentFieldName;
|
|
66
|
-
}
|
|
62
|
+
this.fieldName = cursor.currentFieldName;
|
|
67
63
|
return this;
|
|
68
64
|
}
|
|
69
65
|
setHasError(cursor) {
|
|
70
|
-
|
|
71
|
-
this.hasError = cursor.currentNode().hasError();
|
|
72
|
-
} else {
|
|
73
|
-
this.hasError = cursor.currentNode.hasError();
|
|
74
|
-
}
|
|
66
|
+
this.hasError = cursor.currentNode.hasError;
|
|
75
67
|
return this;
|
|
76
68
|
}
|
|
77
69
|
setPreviousSibling(previousSibling) {
|
|
@@ -8,10 +8,15 @@ var _apidomAst = require("@swagger-api/apidom-ast");
|
|
|
8
8
|
var _CstVisitor = _interopRequireWildcard(require("./visitors/CstVisitor.cjs"));
|
|
9
9
|
var _YamlAstVisitor = _interopRequireWildcard(require("./visitors/YamlAstVisitor.cjs"));
|
|
10
10
|
var _TreeCursorIterator = _interopRequireDefault(require("../TreeCursorIterator.cjs"));
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* This version of syntactic analysis does following transformations:
|
|
13
|
-
* TreeSitter CST -> YAML AST -> ApiDOM
|
|
17
|
+
* `TreeSitter CST -> YAML AST -> ApiDOM`
|
|
14
18
|
* Two traversals passes are needed to get from CST to ApiDOM.
|
|
19
|
+
* @public
|
|
15
20
|
*/
|
|
16
21
|
const analyze = (cst, {
|
|
17
22
|
sourceMap = false
|
|
@@ -2,10 +2,14 @@ import { visit, YamlJsonSchema as JsonSchema, YamlReferenceManager } from '@swag
|
|
|
2
2
|
import CstVisitor, { keyMap as cstKeyMap, isNode as isCstNode } from "./visitors/CstVisitor.mjs";
|
|
3
3
|
import YamlAstVisitor, { keyMap as astKeyMap, isNode as isAstNode, getNodeType as getAstNodeType } from "./visitors/YamlAstVisitor.mjs";
|
|
4
4
|
import TreeCursorIterator from "../TreeCursorIterator.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
5
8
|
/**
|
|
6
9
|
* This version of syntactic analysis does following transformations:
|
|
7
|
-
* TreeSitter CST -> YAML AST -> ApiDOM
|
|
10
|
+
* `TreeSitter CST -> YAML AST -> ApiDOM`
|
|
8
11
|
* Two traversals passes are needed to get from CST to ApiDOM.
|
|
12
|
+
* @public
|
|
9
13
|
*/
|
|
10
14
|
const analyze = (cst, {
|
|
11
15
|
sourceMap = false
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { MediaTypes } from '@swagger-api/apidom-core';
|
|
2
|
+
import { Namespace } from '@swagger-api/apidom-core';
|
|
3
|
+
import { ParseResultElement } from '@swagger-api/apidom-core';
|
|
4
|
+
import { Tree as Tree_2 } from 'web-tree-sitter';
|
|
5
|
+
import { Tree as Tree_3 } from 'tree-sitter';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare const detect: (source: string) => Promise<boolean>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Lexical Analysis of source string using WebTreeSitter.
|
|
14
|
+
* This is WebAssembly version of TreeSitters Lexical Analysis.
|
|
15
|
+
*
|
|
16
|
+
* Given JavaScript doesn't support true parallelism, this
|
|
17
|
+
* code should be as lazy as possible and temporal safety should be fine.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare const lexicalAnalysis: (source: string) => Promise<Tree_2>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare const mediaTypes: YamlMediaTypes;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare const namespace: Namespace;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare const parse: ParseFunction;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare type ParseFunction = (source: string, options?: ParseFunctionOptions) => Promise<ParseResultElement>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare interface ParseFunctionOptions {
|
|
46
|
+
sourceMap?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* This version of syntactic analysis does following transformations:
|
|
51
|
+
* `TreeSitter CST -> YAML AST -> ApiDOM`
|
|
52
|
+
* Two traversals passes are needed to get from CST to ApiDOM.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare const syntacticAnalysis: (cst: Tree, { sourceMap }?: {
|
|
56
|
+
sourceMap?: boolean | undefined;
|
|
57
|
+
}) => ParseResultElement;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export declare type Tree = Tree_2 | Tree_3;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export declare class YamlMediaTypes extends MediaTypes<string> {
|
|
68
|
+
latest(): string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { }
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/types/dist.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as _swagger_api_apidom_core from '@swagger-api/apidom-core';
|
|
2
|
-
import { ParseResultElement, MediaTypes } from '@swagger-api/apidom-core';
|
|
3
|
-
import { Tree as Tree$1 } from 'web-tree-sitter';
|
|
4
|
-
import { Tree as Tree$2 } from 'tree-sitter';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Lexical Analysis of source string using WebTreeSitter.
|
|
8
|
-
* This is WebAssembly version of TreeSitters Lexical Analysis.
|
|
9
|
-
*
|
|
10
|
-
* Given JavaScript doesn't support true parallelism, this
|
|
11
|
-
* code should be as lazy as possible and temporal safety should be fine.
|
|
12
|
-
*/
|
|
13
|
-
declare const analyze$1: (source: string) => Promise<Tree$1>;
|
|
14
|
-
|
|
15
|
-
type Tree = Tree$1 | Tree$2;
|
|
16
|
-
/**
|
|
17
|
-
* This version of syntactic analysis does following transformations:
|
|
18
|
-
* TreeSitter CST -> YAML AST -> ApiDOM
|
|
19
|
-
* Two traversals passes are needed to get from CST to ApiDOM.
|
|
20
|
-
*/
|
|
21
|
-
declare const analyze: (cst: Tree, { sourceMap }?: {
|
|
22
|
-
sourceMap?: boolean | undefined;
|
|
23
|
-
}) => ParseResultElement;
|
|
24
|
-
|
|
25
|
-
declare class YamlMediaTypes extends MediaTypes<string> {
|
|
26
|
-
latest(): string;
|
|
27
|
-
}
|
|
28
|
-
declare const mediaTypes: YamlMediaTypes;
|
|
29
|
-
|
|
30
|
-
declare const namespace: _swagger_api_apidom_core.Namespace;
|
|
31
|
-
|
|
32
|
-
declare const detect: (source: string) => Promise<boolean>;
|
|
33
|
-
interface ParseFunctionOptions {
|
|
34
|
-
sourceMap?: boolean;
|
|
35
|
-
}
|
|
36
|
-
type ParseFunction = (source: string, options?: ParseFunctionOptions) => Promise<ParseResultElement>;
|
|
37
|
-
declare const parse: ParseFunction;
|
|
38
|
-
|
|
39
|
-
export { detect, analyze$1 as lexicalAnalysis, mediaTypes, namespace, parse, analyze as syntacticAnalysis };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|