@swagger-api/apidom-parser-adapter-json 0.76.1 → 0.76.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/cjs/adapter-browser.cjs +1 -1
- package/cjs/adapter-node.cjs +1 -1
- package/cjs/adapter.cjs +1 -1
- package/cjs/lexical-analysis/browser-patch.cjs +1 -1
- package/cjs/lexical-analysis/browser.cjs +1 -1
- package/cjs/lexical-analysis/node.cjs +1 -1
- package/cjs/syntactic-analysis/TreeCursorIterator.cjs +1 -1
- package/cjs/syntactic-analysis/direct/index.cjs +1 -1
- package/cjs/syntactic-analysis/direct/visitors/CstVisitor.cjs +1 -1
- package/cjs/syntactic-analysis/indirect/index.cjs +2 -3
- package/cjs/syntactic-analysis/indirect/visitors/CstVisitor.cjs +1 -1
- package/cjs/syntactic-analysis/indirect/visitors/JsonAstVisitor.cjs +1 -1
- package/dist/apidom-parser-adapter-json.browser.js +17674 -19793
- package/dist/apidom-parser-adapter-json.browser.min.js +1 -1
- package/es/{adapter-node.js → adapter-browser.mjs} +5 -5
- package/es/{adapter-browser.js → adapter-node.mjs} +5 -5
- package/es/{adapter.js → adapter.mjs} +1 -1
- package/es/lexical-analysis/{browser.js → browser.mjs} +1 -1
- package/es/syntactic-analysis/{TreeCursorIterator.js → TreeCursorIterator.mjs} +2 -6
- package/es/syntactic-analysis/{TreeCursorSyntaxNode.js → TreeCursorSyntaxNode.mjs} +2 -12
- package/es/syntactic-analysis/direct/{index.js → index.mjs} +6 -8
- package/es/syntactic-analysis/direct/visitors/{CstVisitor.js → CstVisitor.mjs} +1 -1
- package/es/syntactic-analysis/indirect/{index.js → index.mjs} +3 -3
- package/es/syntactic-analysis/indirect/visitors/{CstVisitor.js → CstVisitor.mjs} +1 -1
- package/es/syntactic-analysis/indirect/visitors/{JsonAstVisitor.js → JsonAstVisitor.mjs} +4 -6
- package/package.json +10 -10
- /package/es/lexical-analysis/{browser-patch.js → browser-patch.mjs} +0 -0
- /package/es/lexical-analysis/{node.js → node.mjs} +0 -0
- /package/es/{media-types.js → media-types.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import lexicalAnalysis from "./lexical-analysis/
|
|
2
|
-
import syntacticAnalysisDirect from "./syntactic-analysis/direct/index.
|
|
3
|
-
import syntacticAnalysisIndirect from "./syntactic-analysis/indirect/index.
|
|
4
|
-
import { detectionRegExp } from "./adapter.
|
|
5
|
-
export { mediaTypes, namespace } from "./adapter.
|
|
1
|
+
import lexicalAnalysis from "./lexical-analysis/browser.mjs";
|
|
2
|
+
import syntacticAnalysisDirect from "./syntactic-analysis/direct/index.mjs";
|
|
3
|
+
import syntacticAnalysisIndirect from "./syntactic-analysis/indirect/index.mjs";
|
|
4
|
+
import { detectionRegExp } from "./adapter.mjs";
|
|
5
|
+
export { mediaTypes, namespace } from "./adapter.mjs";
|
|
6
6
|
export { detectionRegExp };
|
|
7
7
|
export { lexicalAnalysis, syntacticAnalysisDirect as syntacticAnalysis, syntacticAnalysisDirect, syntacticAnalysisIndirect };
|
|
8
8
|
export const detect = async source => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import lexicalAnalysis from "./lexical-analysis/
|
|
2
|
-
import syntacticAnalysisDirect from "./syntactic-analysis/direct/index.
|
|
3
|
-
import syntacticAnalysisIndirect from "./syntactic-analysis/indirect/index.
|
|
4
|
-
import { detectionRegExp } from "./adapter.
|
|
5
|
-
export { mediaTypes, namespace } from "./adapter.
|
|
1
|
+
import lexicalAnalysis from "./lexical-analysis/node.mjs";
|
|
2
|
+
import syntacticAnalysisDirect from "./syntactic-analysis/direct/index.mjs";
|
|
3
|
+
import syntacticAnalysisIndirect from "./syntactic-analysis/indirect/index.mjs";
|
|
4
|
+
import { detectionRegExp } from "./adapter.mjs";
|
|
5
|
+
export { mediaTypes, namespace } from "./adapter.mjs";
|
|
6
6
|
export { detectionRegExp };
|
|
7
7
|
export { lexicalAnalysis, syntacticAnalysisDirect as syntacticAnalysis, syntacticAnalysisDirect, syntacticAnalysisIndirect };
|
|
8
8
|
export const detect = async source => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createNamespace } from '@swagger-api/apidom-core';
|
|
2
|
-
export { default as mediaTypes } from "./media-types.
|
|
2
|
+
export { default as mediaTypes } from "./media-types.mjs";
|
|
3
3
|
export const namespace = createNamespace();
|
|
4
4
|
export const detectionRegExp =
|
|
5
5
|
// eslint-disable-next-line no-control-regex
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
let _Symbol$iterator;
|
|
3
|
-
import TreeCursorSyntaxNode from "./TreeCursorSyntaxNode.js";
|
|
4
|
-
_Symbol$iterator = Symbol.iterator;
|
|
1
|
+
import TreeCursorSyntaxNode from "./TreeCursorSyntaxNode.mjs";
|
|
5
2
|
class TreeCursorIterator {
|
|
6
3
|
constructor(cursor) {
|
|
7
|
-
_defineProperty(this, "cursor", void 0);
|
|
8
4
|
this.cursor = cursor;
|
|
9
5
|
}
|
|
10
6
|
document() {
|
|
@@ -37,7 +33,7 @@ class TreeCursorIterator {
|
|
|
37
33
|
ERROR() {
|
|
38
34
|
return new TreeCursorSyntaxNode(this.cursor).setHasError(this.cursor);
|
|
39
35
|
}
|
|
40
|
-
*[
|
|
36
|
+
*[Symbol.iterator]() {
|
|
41
37
|
let node;
|
|
42
38
|
if (this.cursor.nodeType in this) {
|
|
43
39
|
// @ts-ignore
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
1
|
class TreeCursorSyntaxNode {
|
|
2
|
+
hasError = false;
|
|
3
|
+
children = [];
|
|
3
4
|
constructor(cursor) {
|
|
4
|
-
_defineProperty(this, "type", void 0);
|
|
5
|
-
_defineProperty(this, "startPosition", void 0);
|
|
6
|
-
_defineProperty(this, "endPosition", void 0);
|
|
7
|
-
_defineProperty(this, "startIndex", void 0);
|
|
8
|
-
_defineProperty(this, "endIndex", void 0);
|
|
9
|
-
_defineProperty(this, "text", void 0);
|
|
10
|
-
_defineProperty(this, "isNamed", void 0);
|
|
11
|
-
_defineProperty(this, "isMissing", void 0);
|
|
12
|
-
_defineProperty(this, "fieldName", void 0);
|
|
13
|
-
_defineProperty(this, "hasError", false);
|
|
14
|
-
_defineProperty(this, "children", []);
|
|
15
5
|
this.type = cursor.nodeType;
|
|
16
6
|
this.startPosition = cursor.startPosition;
|
|
17
7
|
this.endPosition = cursor.endPosition;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
1
|
import { visit, getNodeType as getCSTNodeType, isNode as isCSTNode } from '@swagger-api/apidom-ast';
|
|
5
2
|
import { isElement, isParseResultElement, keyMap as keyMapApiDOM, getNodeType as getNodeTypeApiDOM } from '@swagger-api/apidom-core';
|
|
6
|
-
import CstVisitor from "./visitors/CstVisitor.
|
|
7
|
-
import TreeCursorIterator from "../TreeCursorIterator.
|
|
8
|
-
const keyMap =
|
|
3
|
+
import CstVisitor from "./visitors/CstVisitor.mjs";
|
|
4
|
+
import TreeCursorIterator from "../TreeCursorIterator.mjs";
|
|
5
|
+
const keyMap = {
|
|
9
6
|
document: ['children'],
|
|
10
7
|
object: ['children'],
|
|
11
8
|
array: ['children'],
|
|
12
9
|
string: ['children'],
|
|
13
10
|
property: ['children'],
|
|
14
11
|
key: ['children'],
|
|
15
|
-
error: ['children']
|
|
16
|
-
|
|
12
|
+
error: ['children'],
|
|
13
|
+
...keyMapApiDOM
|
|
14
|
+
};
|
|
17
15
|
const getNodeType = node => {
|
|
18
16
|
if (isParseResultElement(node)) {
|
|
19
17
|
return 'ParseResultElement';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import stampit from 'stampit';
|
|
2
2
|
import { BooleanElement, NullElement, NumberElement, ParseResultElement, SourceMapElement, MemberElement, ObjectElement, ArrayElement, StringElement, AnnotationElement, isPrimitiveElement } from '@swagger-api/apidom-core';
|
|
3
|
-
import TreeCursorSyntaxNode from "../../TreeCursorSyntaxNode.
|
|
3
|
+
import TreeCursorSyntaxNode from "../../TreeCursorSyntaxNode.mjs";
|
|
4
4
|
/* eslint-disable no-underscore-dangle */
|
|
5
5
|
const CstVisitor = stampit({
|
|
6
6
|
props: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { visit } from '@swagger-api/apidom-ast';
|
|
2
|
-
import TreeCursorIterator from "../TreeCursorIterator.
|
|
3
|
-
import CstVisitor, { keyMap as cstKeyMap } from "./visitors/CstVisitor.
|
|
4
|
-
import JsonAstVisitor, { keyMap as astKeyMap, isNode, getNodeType } from "./visitors/JsonAstVisitor.
|
|
2
|
+
import TreeCursorIterator from "../TreeCursorIterator.mjs";
|
|
3
|
+
import CstVisitor, { keyMap as cstKeyMap } from "./visitors/CstVisitor.mjs";
|
|
4
|
+
import JsonAstVisitor, { keyMap as astKeyMap, isNode, getNodeType } from "./visitors/JsonAstVisitor.mjs";
|
|
5
5
|
/**
|
|
6
6
|
* This version of syntactic analysis does following transformations:
|
|
7
7
|
* TreeSitter CST -> JSON AST -> ApiDOM
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import stampit from 'stampit';
|
|
2
2
|
import { JsonArray, JsonDocument, JsonFalse, JsonNull, JsonNumber, JsonObject, JsonKey, JsonProperty, JsonString, JsonStringContent, JsonTrue, ParseResult, Position, Point, Literal, Error } from '@swagger-api/apidom-ast';
|
|
3
|
-
import TreeCursorSyntaxNode from "../../TreeCursorSyntaxNode.
|
|
3
|
+
import TreeCursorSyntaxNode from "../../TreeCursorSyntaxNode.mjs";
|
|
4
4
|
export const keyMap = {
|
|
5
5
|
document: ['children'],
|
|
6
6
|
object: ['children'],
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
1
|
import stampit from 'stampit';
|
|
5
2
|
import { JsonArray, JsonDocument, JsonObject, JsonProperty, ParseResult, Error, isNode as isCSTNode, getNodeType as getCSTNodeType } from '@swagger-api/apidom-ast';
|
|
6
3
|
import { ParseResultElement, ObjectElement, SourceMapElement, MemberElement, ArrayElement, BooleanElement, NullElement, NumberElement, StringElement, AnnotationElement, isParseResultElement, isPrimitiveElement, isElement, keyMap as keyMapApiDOM, getNodeType as getNodeTypeApiDOM } from '@swagger-api/apidom-core';
|
|
7
|
-
export const keyMap =
|
|
4
|
+
export const keyMap = {
|
|
8
5
|
// @ts-ignore
|
|
9
6
|
[ParseResult.type]: ['children'],
|
|
10
7
|
// @ts-ignore
|
|
@@ -16,8 +13,9 @@ export const keyMap = _objectSpread({
|
|
|
16
13
|
// @ts-ignore
|
|
17
14
|
[JsonArray.type]: ['children'],
|
|
18
15
|
// @ts-ignore
|
|
19
|
-
[Error.type]: ['children']
|
|
20
|
-
|
|
16
|
+
[Error.type]: ['children'],
|
|
17
|
+
...keyMapApiDOM
|
|
18
|
+
};
|
|
21
19
|
export const getNodeType = node => {
|
|
22
20
|
if (isParseResultElement(node)) {
|
|
23
21
|
return 'ParseResultElement';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swagger-api/apidom-parser-adapter-json",
|
|
3
|
-
"version": "0.76.
|
|
3
|
+
"version": "0.76.2",
|
|
4
4
|
"description": "Parser adapter for parsing JSON documents into base namespace.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": [
|
|
11
|
-
"./es/lexical-analysis/browser-patch.
|
|
11
|
+
"./es/lexical-analysis/browser-patch.mjs",
|
|
12
12
|
"./cjs/lexical-analysis/browser-patch.cjs"
|
|
13
13
|
],
|
|
14
14
|
"unpkg": "./dist/apidom-parser-apdater-json.browser.min.js",
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
"types": "./types/dist.d.ts",
|
|
18
18
|
"node": {
|
|
19
|
-
"import": "./es/adapter-node.
|
|
19
|
+
"import": "./es/adapter-node.mjs",
|
|
20
20
|
"require": "./cjs/adapter-node.cjs"
|
|
21
21
|
},
|
|
22
22
|
"browser": {
|
|
23
|
-
"import": "./es/adapter-browser.
|
|
23
|
+
"import": "./es/adapter-browser.mjs"
|
|
24
24
|
},
|
|
25
25
|
"default": "./cjs/adapter-node.cjs"
|
|
26
26
|
},
|
|
27
27
|
"types": "./types/dist.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 es --extensions '.ts' --root-mode 'upward'",
|
|
30
|
+
"build:es": "npm run build:wasm && npm run build:wasm:copy && cross-env BABEL_ENV=es babel src --out-dir es --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
|
|
31
31
|
"build:cjs": "npm run build:wasm && npm run build:wasm:copy && BABEL_ENV=cjs babel src --out-dir cjs --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'",
|
|
32
|
-
"build:umd:browser": "npm run build:wasm && npm run build:wasm:copy && cross-env BABEL_ENV=browser
|
|
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
33
|
"build:wasm": "node ../../scripts/file-exists.js ../../node_modules/tree-sitter-json/tree-sitter-json.wasm && exit 0 || cd ../../node_modules/tree-sitter-json && tree-sitter generate --abi=13 ./grammar.js && tree-sitter build-wasm && node-gyp rebuild",
|
|
34
34
|
"build:wasm:copy": "copyfiles -u 4 ../../node_modules/tree-sitter-json/tree-sitter-json.wasm wasm",
|
|
35
35
|
"lint": "eslint ./",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"license": "Apache-2.0",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/runtime-corejs3": "^7.20.7",
|
|
56
|
-
"@swagger-api/apidom-ast": "^0.76.
|
|
57
|
-
"@swagger-api/apidom-core": "^0.76.
|
|
58
|
-
"@swagger-api/apidom-error": "^0.76.
|
|
56
|
+
"@swagger-api/apidom-ast": "^0.76.2",
|
|
57
|
+
"@swagger-api/apidom-core": "^0.76.2",
|
|
58
|
+
"@swagger-api/apidom-error": "^0.76.2",
|
|
59
59
|
"@types/ramda": "~0.29.3",
|
|
60
60
|
"ramda": "~0.29.0",
|
|
61
61
|
"ramda-adjunct": "^4.1.1",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"README.md",
|
|
79
79
|
"CHANGELOG.md"
|
|
80
80
|
],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "8c6c02f813a663cfaf0ac0963f2b4fd25b8dffe8"
|
|
82
82
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|