Skip to content

Commit 360aa1c

Browse files
authored
Upgrade Scalar dependencies (#3626)
1 parent ccc0975 commit 360aa1c

File tree

7 files changed

+522
-38
lines changed

7 files changed

+522
-38
lines changed

.changeset/healthy-masks-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@gitbook/openapi-parser": patch
3+
---
4+
5+
Upgrade Scalar dependencies

bun.lock

Lines changed: 503 additions & 26 deletions
Large diffs are not rendered by default.

packages/openapi-parser/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
"version": "3.0.1",
1313
"sideEffects": false,
1414
"dependencies": {
15-
"@scalar/openapi-parser": "^0.18.0",
16-
"@scalar/openapi-types": "^0.1.9"
15+
"@scalar/json-magic": "^0.3.1",
16+
"@scalar/openapi-parser": "^0.20.1",
17+
"@scalar/openapi-types": "^0.3.7"
1718
},
1819
"devDependencies": {
1920
"@tsconfig/strictest": "^2.0.5",

packages/openapi-parser/src/filesystem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { bundle } from '@scalar/openapi-parser';
2-
import { parseJson, parseYaml } from '@scalar/openapi-parser/plugins-browser';
1+
import { bundle } from '@scalar/json-magic/bundle';
2+
import { parseJson, parseYaml } from '@scalar/json-magic/bundle/plugins/browser';
33
import type { ParseOpenAPIInput } from './parse';
44
import { fetchURL } from './scalar-plugins/fetchURL';
55
import { fetchURLs } from './scalar-plugins/fetchURLs';

packages/openapi-parser/src/parse.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import type { AnyObject, ErrorObject, bundle } from '@scalar/openapi-parser';
1+
import type { Plugin } from '@scalar/json-magic/bundle';
2+
import type { AnyObject, ErrorObject } from '@scalar/openapi-parser';
23
import { OpenAPIParseError } from './error';
34
import type { Filesystem, OpenAPIV3xDocument } from './types';
45
import { convertOpenAPIV2ToOpenAPIV3 } from './v2';
56
import { parseOpenAPIV3 } from './v3';
67

7-
export type ParsePlugin = Parameters<typeof bundle>[1]['plugins'][number];
8-
98
export interface ParseOpenAPIInput {
109
/**
1110
* The API definition to parse.
@@ -19,7 +18,7 @@ export interface ParseOpenAPIInput {
1918
* Options for the parser.
2019
*/
2120
options?: {
22-
plugins?: ParsePlugin[];
21+
plugins?: Plugin[];
2322
};
2423
}
2524

packages/openapi-parser/src/scalar-plugins/fetchURL.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import type { Plugin } from '@scalar/json-magic/bundle';
12
import { normalize } from '@scalar/openapi-parser';
2-
import type { ParsePlugin } from '../parse';
33

44
export const fetchUrlsDefaultConfiguration = {
55
limit: 40,
66
};
77

8-
export const fetchURL = (): ParsePlugin => ({
8+
export const fetchURL = (): Plugin => ({
9+
type: 'loader',
910
validate(value) {
1011
return URL.canParse(value);
1112
},

packages/openapi-parser/src/scalar-plugins/fetchURLs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import type { Plugin } from '@scalar/json-magic/bundle';
12
import { normalize } from '@scalar/openapi-parser';
2-
import type { ParsePlugin } from '../parse';
33

44
export const fetchUrlsDefaultConfiguration = {
55
limit: 40,
@@ -15,7 +15,7 @@ export const fetchURLs = (customConfiguration: {
1515
* Limit the number of requests. Set to `false` to disable the limit.
1616
*/
1717
limit?: number | false;
18-
}): ParsePlugin => {
18+
}): Plugin => {
1919
// State
2020
let numberOfRequests = 0;
2121

@@ -26,6 +26,7 @@ export const fetchURLs = (customConfiguration: {
2626
};
2727

2828
return {
29+
type: 'loader',
2930
validate(value) {
3031
// Not a string
3132
if (typeof value !== 'string') {

0 commit comments

Comments
 (0)