@scalar/schemas 0.8.4 → 0.10.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 +48 -0
- package/dist/api-reference/api-reference-configuration.d.ts +12 -0
- package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
- package/dist/api-reference/api-reference-configuration.js +11 -1
- package/dist/api-reference/html-rendering-configuration.d.ts +15 -2
- package/dist/api-reference/html-rendering-configuration.d.ts.map +1 -1
- package/dist/api-reference/html-rendering-configuration.js +16 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# @scalar/schemas
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#10074](https://github.com/scalar/scalar/pull/10074): feat(api-reference)!: the tree layout is the schema renderer
|
|
8
|
+
|
|
9
|
+
The tree layout is the schema renderer, so every visual baseline that renders a schema changes with this release and is regenerated per suite.
|
|
10
|
+
|
|
11
|
+
- [#10074](https://github.com/scalar/scalar/pull/10074): feat(api-reference): the tree schema layout
|
|
12
|
+
|
|
13
|
+
The tree layout replaces the bordered card per nesting level and the "Show Child Attributes" pill with the visual grammar of a tree: a continuous rail per depth that hangs from the parent property's text column, and a discrete disclosure control in each expandable property's own gutter. The control is a real button whose accessible name is the property name alone and whose child count rides `aria-describedby`; property descriptions stay visible instead of being swallowed into a button label. Types render as token runs — `array of Planet` instead of `array Planet[]`, with a `$ref` link as the type itself — collapsed objects show a preview of what they hold, short enums render inline in the type position or wrap as chips instead of a row per value, and a `$ref` cycle says `recursive` in its own signature line instead of offering a toggle that descends forever. Rails fade with depth, capped so the deepest ones never wash out into the page. In a narrow container — the same `max-width: 900px` query the sections already use — the indent tightens and the controls shrink, so a deep tree still fits and the outermost control clears the page edge instead of being clipped by it. Collapsed subtrees that were opened once stay reachable with find-in-page via `hidden="until-found"` where the engine supports it, against a budget shared by every tree in the reference, with Safari falling back to unmounting exactly as before.
|
|
14
|
+
|
|
15
|
+
Printing temporarily expands the whole tree and restores the reader's expansion state afterwards.
|
|
16
|
+
|
|
17
|
+
- [#10074](https://github.com/scalar/scalar/pull/10074): feat(api-reference): one disclosure grammar across every surface in the tree layout
|
|
18
|
+
|
|
19
|
+
The tree layout now reaches the surfaces the schema renderer never covered. Response headers fold into the tree as a child group named Headers, keyed into the expansion store so expand-all and deep links finally reach them — and the headers card's long-standing CSS syntax error is fixed along the way. Callbacks trade their native `details`/`summary` for the gutter control, and gain breadcrumbs, so a property inside a callback body is addressable for the first time. AsyncAPI message headers and payloads gain breadcrumbs the same way. Parameter rows keep rendering their type, required marker and description inline: a disclosure may hide child elements, never child information, and the classic layout starts passing `collapsableItems` — previously omitted, which silently made `expandAllResponses` a no-op there. Model properties in the classic layout gain anchors.
|
|
20
|
+
|
|
21
|
+
Group titles — Body, Responses, Query Parameters, Callbacks — become real headings through the document outline (`operationSection`, level 4), never hardcoded tags.
|
|
22
|
+
|
|
23
|
+
One flagged feature ships with this: `schemaKeyboardNav` (default off) adds APG-tree arrow-key navigation over the gutter toggles.
|
|
24
|
+
|
|
25
|
+
- [#10102](https://github.com/scalar/scalar/pull/10102): Allow response hooks to return a replacement Response before the client processes its body, status, and headers. Add the onResponseReceived configuration callback for API References. Existing hooks can still read responses and return nothing.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#10126](https://github.com/scalar/scalar/pull/10126): refactor(api-reference): remove the legacy schema layout and the `schemaLayout` option
|
|
30
|
+
|
|
31
|
+
The legacy schema layout — a bordered card per nesting level behind a "Show Child Attributes" pill — is deleted, together with the `schemaLayout` configuration option that selected it. The tree layout is the only schema renderer.
|
|
32
|
+
|
|
33
|
+
The `schemaLayout` option never shipped in a release, so there is no `schemaLayout` value to remove from your configuration. Five translation keys the deleted markup owned are removed from `ApiReferenceTranslations`, and therefore from the `ApiReferenceTranslationKey` union: `schema.childAttributes`, `schema.hideChildAttributes`, `schema.showChildAttributes`, `operation.hideHeaders` and `operation.showHeaders`. They labelled the "Show Child Attributes" pill and the headers disclosure toggle, neither of which renders any more. If you override any of them in `localization.translations`, delete those entries — TypeScript will otherwise report an unknown-property error on the object literal.
|
|
34
|
+
|
|
35
|
+
The class names the tree already carried (`.schema-card`, `.property`, `.property--level-N` and their family) are unchanged, so `customCss` keeps working.
|
|
36
|
+
|
|
37
|
+
## 0.9.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- [#9981](https://github.com/scalar/scalar/pull/9981): Load the modern ESM build of the API Reference by default
|
|
42
|
+
|
|
43
|
+
The generated HTML now loads the code-split ESM build (`.../@scalar/api-reference/esm.js`, added in #9871) as a `<script type="module">` by default, instead of the monolithic UMD bundle. Because it is code-split, less JavaScript blocks the first render.
|
|
44
|
+
|
|
45
|
+
To keep the classic UMD bundle (loaded via `<script src>` and the `window.Scalar` global), set `cdn` to a UMD URL — for example to pin a version — or pass `bundle: false`. You can also pass `bundle: 'https://.../esm.js'` to load a specific ESM build.
|
|
46
|
+
|
|
47
|
+
When a `nonce` is set (a strict, nonce-based CSP) the UMD bundle is used automatically, because the ESM build's `import`-loaded chunks cannot be nonced. Pass `bundle: true` to force the ESM build if your CSP uses `'strict-dynamic'`.
|
|
48
|
+
|
|
49
|
+
- [#9937](https://github.com/scalar/scalar/pull/9937): Add a way to open the request body editor in the Form view by default. Set the `defaultRequestBodyView: 'form'` config option, or the `x-scalar-default-request-body-view` extension in your OpenAPI document (which also works per source). Defaults to `raw`, and falls back to `raw` when a body cannot be shown as a form.
|
|
50
|
+
|
|
3
51
|
## 0.8.4
|
|
4
52
|
|
|
5
53
|
## 0.8.3
|
|
@@ -109,6 +109,7 @@ export declare const apiReferenceConfigurationSchema: import("@scalar/validation
|
|
|
109
109
|
targetKey: LiteralSchema<TargetId>;
|
|
110
110
|
clientKey: LiteralSchema<ClientId<TargetId>>;
|
|
111
111
|
}>>;
|
|
112
|
+
defaultRequestBodyView: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [LiteralSchema<"form">, LiteralSchema<"raw">]>>;
|
|
112
113
|
customCss: import("@scalar/validation").OptionalSchema<import("@scalar/validation").StringSchema>;
|
|
113
114
|
onServerChange: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(input: string) => void>>;
|
|
114
115
|
onDocumentSelect: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<() => void>>;
|
|
@@ -123,6 +124,10 @@ export declare const apiReferenceConfigurationSchema: import("@scalar/validation
|
|
|
123
124
|
requestBuilder: unknown;
|
|
124
125
|
envVariables: Record<string, string>;
|
|
125
126
|
}) => Promise<void> | void>>;
|
|
127
|
+
onResponseReceived: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(input: {
|
|
128
|
+
response: Response;
|
|
129
|
+
request: Request;
|
|
130
|
+
}) => Response | void | Promise<Response | void>>>;
|
|
126
131
|
onShowMore: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(tagId: string) => Promise<void> | void>>;
|
|
127
132
|
onSidebarClick: import("@scalar/validation").OptionalSchema<import("@scalar/validation").FunctionSchema<(href: string) => Promise<void> | void>>;
|
|
128
133
|
pathRouting: import("@scalar/validation").OptionalSchema<import("@scalar/validation").ObjectSchema<{
|
|
@@ -169,6 +174,7 @@ export declare const apiReferenceConfigurationSchema: import("@scalar/validation
|
|
|
169
174
|
tagsSorter: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [LiteralSchema<"alpha">, import("@scalar/validation").FunctionSchema<(a: any, b: any) => number>]>>;
|
|
170
175
|
operationsSorter: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [LiteralSchema<"alpha">, LiteralSchema<"method">, import("@scalar/validation").FunctionSchema<(a: any, b: any) => number>]>>;
|
|
171
176
|
orderSchemaPropertiesBy: import("@scalar/validation").UnionSchema<readonly [LiteralSchema<"alpha">, LiteralSchema<"preserve">]>;
|
|
177
|
+
schemaKeyboardNav: import("@scalar/validation").BooleanSchema;
|
|
172
178
|
orderRequiredPropertiesFirst: import("@scalar/validation").BooleanSchema;
|
|
173
179
|
}>]>;
|
|
174
180
|
export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unknown) => {
|
|
@@ -229,6 +235,7 @@ export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unkno
|
|
|
229
235
|
expandAllResponses: boolean;
|
|
230
236
|
expandAllSchemaProperties: boolean;
|
|
231
237
|
orderSchemaPropertiesBy: "alpha" | "preserve";
|
|
238
|
+
schemaKeyboardNav: boolean;
|
|
232
239
|
orderRequiredPropertiesFirst: boolean;
|
|
233
240
|
} & {
|
|
234
241
|
proxy?: string | undefined;
|
|
@@ -291,6 +298,7 @@ export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unkno
|
|
|
291
298
|
targetKey: "c" | "r" | "go" | "rust" | "clojure" | "csharp" | "dart" | "fsharp" | "http" | "java" | "js" | "julia" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "ruby" | "shell" | "swift";
|
|
292
299
|
clientKey: "laravel" | "fetch" | "http" | "libcurl" | "httr2" | "native" | "reqwest" | "clj_http" | "httpclient" | "restsharp" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "aiohttp" | "httpx_sync" | "httpx_async" | "httpie" | "wget";
|
|
293
300
|
} | undefined;
|
|
301
|
+
defaultRequestBodyView?: "form" | "raw" | undefined;
|
|
294
302
|
customCss?: string | undefined;
|
|
295
303
|
onServerChange?: ((input: string) => void) | undefined;
|
|
296
304
|
onDocumentSelect?: (() => void) | undefined;
|
|
@@ -305,6 +313,10 @@ export declare const apiReferenceConfigurationWithSourceSchema: (rawInput: unkno
|
|
|
305
313
|
requestBuilder: unknown;
|
|
306
314
|
envVariables: Record<string, string>;
|
|
307
315
|
}) => Promise<void> | void) | undefined;
|
|
316
|
+
onResponseReceived?: ((input: {
|
|
317
|
+
response: Response;
|
|
318
|
+
request: Request;
|
|
319
|
+
}) => Response | void | Promise<Response | void>) | undefined;
|
|
308
320
|
onShowMore?: ((tagId: string) => Promise<void> | void) | undefined;
|
|
309
321
|
onSidebarClick?: ((href: string) => Promise<void> | void) | undefined;
|
|
310
322
|
pathRouting?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-reference-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EACL,KAAK,aAAa,EAanB,MAAM,oBAAoB,CAAA;AAO3B,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2GF,aAAa,CAAC,QAAQ,CAAC;mBACvB,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"api-reference-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EACL,KAAK,aAAa,EAanB,MAAM,oBAAoB,CAAA;AAO3B,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2GF,aAAa,CAAC,QAAQ,CAAC;mBACv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AK,MAAM;iCAG9B;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;+BAG9B;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;qCAIpD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;mCAKvD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM;4BAGnD;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,MAAM;wBAG3E,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS;gCA+Bb,GAAG,KAAK,GAAG,KAAK,MAAM;iDAGG,GAAG,KAAK,GAAG,KAAK,MAAM;CA4FvG,CAAA"}
|
|
@@ -101,6 +101,9 @@ export const apiReferenceConfigurationSchema = intersection([
|
|
|
101
101
|
}), {
|
|
102
102
|
typeComment: 'Determine the HTTP client that is selected by default',
|
|
103
103
|
}),
|
|
104
|
+
defaultRequestBodyView: optional(union([literal('form'), literal('raw')]), {
|
|
105
|
+
typeComment: 'Initial view for the request body editor with structured (JSON/YAML) bodies',
|
|
106
|
+
}),
|
|
104
107
|
customCss: optional(string(), {
|
|
105
108
|
typeComment: 'Custom CSS to be added to the page',
|
|
106
109
|
}),
|
|
@@ -119,6 +122,9 @@ export const apiReferenceConfigurationSchema = intersection([
|
|
|
119
122
|
onRequestBuilt: optional(fn(), {
|
|
120
123
|
typeComment: 'Fired right before the outbound request is sent; callback receives the exact fetch Request that goes over the wire. Experimental API.',
|
|
121
124
|
}),
|
|
125
|
+
onResponseReceived: optional(fn(), {
|
|
126
|
+
typeComment: 'Fired before response processing. Return a Response to replace it, or nothing to keep it.',
|
|
127
|
+
}),
|
|
122
128
|
onShowMore: optional(fn(), {
|
|
123
129
|
typeComment: 'onShowMore is fired when the user clicks the "Show more" button on the references',
|
|
124
130
|
}),
|
|
@@ -186,7 +192,7 @@ export const apiReferenceConfigurationSchema = intersection([
|
|
|
186
192
|
}),
|
|
187
193
|
expandAllSchemaProperties: boolean({
|
|
188
194
|
default: false,
|
|
189
|
-
typeComment: 'Whether to expand all nested schema properties by default.
|
|
195
|
+
typeComment: 'Whether to expand all nested schema properties by default. Each row keeps its own disclosure control, so nested sections can still be collapsed manually. Warning: this can cause performance issues on big documents',
|
|
190
196
|
}),
|
|
191
197
|
tagsSorter: optional(union([literal('alpha'), fn()]), {
|
|
192
198
|
typeComment: 'Function to sort tags',
|
|
@@ -197,6 +203,10 @@ export const apiReferenceConfigurationSchema = intersection([
|
|
|
197
203
|
orderSchemaPropertiesBy: union([literal('alpha'), literal('preserve')], {
|
|
198
204
|
typeComment: 'Order the schema properties by',
|
|
199
205
|
}),
|
|
206
|
+
schemaKeyboardNav: boolean({
|
|
207
|
+
default: false,
|
|
208
|
+
typeComment: 'Arrow-key navigation over the schema disclosure toggles (APG tree bindings). Off until screen-reader interaction questions are settled',
|
|
209
|
+
}),
|
|
200
210
|
orderRequiredPropertiesFirst: boolean({
|
|
201
211
|
default: true,
|
|
202
212
|
typeComment: 'Sort the schema properties by required ones first',
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
export declare const htmlRenderingConfigurationSchema: import("@scalar/validation").ObjectSchema<{
|
|
2
2
|
/**
|
|
3
|
-
* The URL to the Scalar API Reference
|
|
3
|
+
* The URL to the Scalar API Reference UMD bundle (the classic build that registers `window.Scalar`
|
|
4
|
+
* and is loaded via `<script src>`).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
+
* Setting it selects the UMD build instead of the default ESM build — use it to pin a specific
|
|
7
|
+
* version of the classic bundle.
|
|
6
8
|
*
|
|
7
9
|
* @default https://cdn.jsdelivr.net/npm/@scalar/api-reference
|
|
8
10
|
*
|
|
9
11
|
* @example https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.122
|
|
10
12
|
*/
|
|
11
13
|
cdn: import("@scalar/validation").StringSchema;
|
|
14
|
+
/**
|
|
15
|
+
* Which build to load. The modern, code-split ESM build is the default.
|
|
16
|
+
*
|
|
17
|
+
* Pass a URL string to load a specific ESM build, or `false` to fall back to the classic UMD bundle.
|
|
18
|
+
* When set, `bundle` takes precedence over both `cdn` and the `nonce` fallback.
|
|
19
|
+
*
|
|
20
|
+
* When a `nonce` is set (a strict, nonce-based CSP) the UMD bundle is used by default, because the
|
|
21
|
+
* ESM build's `import`-loaded chunks cannot be nonced. Pass `bundle: true` to force the ESM build if
|
|
22
|
+
* your CSP uses `'strict-dynamic'`.
|
|
23
|
+
*/
|
|
24
|
+
bundle: import("@scalar/validation").OptionalSchema<import("@scalar/validation").UnionSchema<readonly [import("@scalar/validation").StringSchema, import("@scalar/validation").BooleanSchema]>>;
|
|
12
25
|
pageTitle: import("@scalar/validation").StringSchema;
|
|
13
26
|
/**
|
|
14
27
|
* A Content Security Policy (CSP) nonce to apply to the generated inline `<script>` and `<style>`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-rendering-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/html-rendering-configuration.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC;IAC3C
|
|
1
|
+
{"version":3,"file":"html-rendering-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/html-rendering-configuration.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC;IAC3C;;;;;;;;;;OAUG;;IAIH;;;;;;;;;OASG;;;IAKH;;;;;OAKG;;EAEH,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { object, optional, string } from '@scalar/validation';
|
|
1
|
+
import { boolean, object, optional, string, union } from '@scalar/validation';
|
|
2
2
|
export const htmlRenderingConfigurationSchema = object({
|
|
3
3
|
/**
|
|
4
|
-
* The URL to the Scalar API Reference
|
|
4
|
+
* The URL to the Scalar API Reference UMD bundle (the classic build that registers `window.Scalar`
|
|
5
|
+
* and is loaded via `<script src>`).
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* Setting it selects the UMD build instead of the default ESM build — use it to pin a specific
|
|
8
|
+
* version of the classic bundle.
|
|
7
9
|
*
|
|
8
10
|
* @default https://cdn.jsdelivr.net/npm/@scalar/api-reference
|
|
9
11
|
*
|
|
@@ -12,6 +14,17 @@ export const htmlRenderingConfigurationSchema = object({
|
|
|
12
14
|
cdn: string({
|
|
13
15
|
default: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
|
|
14
16
|
}),
|
|
17
|
+
/**
|
|
18
|
+
* Which build to load. The modern, code-split ESM build is the default.
|
|
19
|
+
*
|
|
20
|
+
* Pass a URL string to load a specific ESM build, or `false` to fall back to the classic UMD bundle.
|
|
21
|
+
* When set, `bundle` takes precedence over both `cdn` and the `nonce` fallback.
|
|
22
|
+
*
|
|
23
|
+
* When a `nonce` is set (a strict, nonce-based CSP) the UMD bundle is used by default, because the
|
|
24
|
+
* ESM build's `import`-loaded chunks cannot be nonced. Pass `bundle: true` to force the ESM build if
|
|
25
|
+
* your CSP uses `'strict-dynamic'`.
|
|
26
|
+
*/
|
|
27
|
+
bundle: optional(union([string(), boolean()])),
|
|
15
28
|
pageTitle: string({
|
|
16
29
|
default: 'Scalar API Reference',
|
|
17
30
|
}),
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"schemas",
|
|
15
15
|
"scalar"
|
|
16
16
|
],
|
|
17
|
-
"version": "0.
|
|
17
|
+
"version": "0.10.0",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=22"
|
|
20
20
|
},
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"CHANGELOG.md"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@scalar/helpers": "0.
|
|
44
|
+
"@scalar/helpers": "0.12.0",
|
|
45
45
|
"@scalar/validation": "0.6.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"vitest": "4.1.10",
|
|
49
|
-
"@scalar/types": "0.
|
|
49
|
+
"@scalar/types": "0.20.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|