@scalar/openapi-parser 0.21.2 → 0.22.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
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @scalar/openapi-parser
|
|
2
2
|
|
|
3
|
+
## 0.22.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [15c4240]
|
|
8
|
+
- @scalar/openapi-types@0.4.1
|
|
9
|
+
- @scalar/openapi-upgrader@0.1.2
|
|
10
|
+
|
|
11
|
+
## 0.22.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [008a0f3]
|
|
16
|
+
- @scalar/openapi-types@0.4.0
|
|
17
|
+
- @scalar/openapi-upgrader@0.1.1
|
|
18
|
+
|
|
19
|
+
## 0.22.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- 4951456: feat: merge yaml aliases for in-mem representation
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [4951456]
|
|
28
|
+
- @scalar/json-magic@0.6.0
|
|
29
|
+
|
|
3
30
|
## 0.21.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/utils/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/utils/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI/C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,CAiClG"}
|
package/dist/utils/normalize.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/normalize.ts"],
|
|
4
|
-
"sourcesContent": ["import type { UnknownObject } from '@scalar/types/utils'\nimport { parse } from 'yaml'\n\nimport type { Filesystem } from '@/types/index'\nimport { isFilesystem } from './is-filesystem'\n\n/**\n * Normalize the OpenAPI document (YAML, JSON, object) to a JavaScript object.\n *\n * Doesn't modify the object if it's a `Filesystem` (multiple files) already.\n */\nexport function normalize(content: string | UnknownObject | Filesystem): UnknownObject | Filesystem {\n if (content === null) {\n return undefined\n }\n\n if (typeof content === 'string') {\n if (content.trim() === '') {\n return undefined\n }\n\n try {\n return JSON.parse(content)\n } catch (_error) {\n // Does it look like YAML?\n const hasColon = /^[^:]+:/.test(content)\n const isJson = content.slice(0, 50).trimStart().startsWith('{')\n\n if (!hasColon || isJson) {\n return undefined\n }\n\n return parse(content, {\n maxAliasCount: 10000,\n })\n }\n }\n\n if (isFilesystem(content)) {\n return content\n }\n\n return content\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,aAAa;
|
|
4
|
+
"sourcesContent": ["import type { UnknownObject } from '@scalar/types/utils'\nimport { parse } from 'yaml'\n\nimport type { Filesystem } from '@/types/index'\n\nimport { isFilesystem } from './is-filesystem'\n\n/**\n * Normalize the OpenAPI document (YAML, JSON, object) to a JavaScript object.\n *\n * Doesn't modify the object if it's a `Filesystem` (multiple files) already.\n */\nexport function normalize(content: string | UnknownObject | Filesystem): UnknownObject | Filesystem {\n if (content === null) {\n return undefined\n }\n\n if (typeof content === 'string') {\n if (content.trim() === '') {\n return undefined\n }\n\n try {\n return JSON.parse(content)\n } catch (_error) {\n // Does it look like YAML?\n const hasColon = /^[^:]+:/.test(content)\n const isJson = content.slice(0, 50).trimStart().startsWith('{')\n\n if (!hasColon || isJson) {\n return undefined\n }\n\n return parse(content, {\n maxAliasCount: 10000,\n merge: true,\n })\n }\n }\n\n if (isFilesystem(content)) {\n return content\n }\n\n return content\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,aAAa;AAItB,SAAS,oBAAoB;AAOtB,SAAS,UAAU,SAA0E;AAClG,MAAI,YAAY,MAAM;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,YAAY,UAAU;AAC/B,QAAI,QAAQ,KAAK,MAAM,IAAI;AACzB,aAAO;AAAA,IACT;AAEA,QAAI;AACF,aAAO,KAAK,MAAM,OAAO;AAAA,IAC3B,SAAS,QAAQ;AAEf,YAAM,WAAW,UAAU,KAAK,OAAO;AACvC,YAAM,SAAS,QAAQ,MAAM,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,GAAG;AAE9D,UAAI,CAAC,YAAY,QAAQ;AACvB,eAAO;AAAA,MACT;AAEA,aAAO,MAAM,SAAS;AAAA,QACpB,eAAe;AAAA,QACf,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,aAAa,OAAO,GAAG;AACzB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"parser",
|
|
18
18
|
"typescript"
|
|
19
19
|
],
|
|
20
|
-
"version": "0.
|
|
20
|
+
"version": "0.22.2",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"jsonpointer": "^5.0.1",
|
|
55
55
|
"leven": "^4.0.0",
|
|
56
56
|
"yaml": "2.8.0",
|
|
57
|
-
"@scalar/json-magic": "0.
|
|
58
|
-
"@scalar/openapi-
|
|
59
|
-
"@scalar/openapi-
|
|
57
|
+
"@scalar/json-magic": "0.6.0",
|
|
58
|
+
"@scalar/openapi-upgrader": "0.1.2",
|
|
59
|
+
"@scalar/openapi-types": "0.4.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@apidevtools/swagger-parser": "10.1.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"just-diff": "^6.0.2",
|
|
67
67
|
"tinybench": "^2.8.0",
|
|
68
68
|
"vite": "7.1.5",
|
|
69
|
-
"@scalar/types": "0.
|
|
69
|
+
"@scalar/types": "0.3.1",
|
|
70
70
|
"@scalar/build-tooling": "0.2.7"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|