update scalar config to use @scalar/types

This commit is contained in:
inyourtime
2024-10-03 10:01:58 +07:00
parent d5f8713b81
commit 6efc3fa642
8 changed files with 6 additions and 1028 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -1,7 +1,5 @@
import { Elysia, InternalRoute } from 'elysia'
import { Elysia } from 'elysia'
import { swagger } from '../src/index'
import { plugin } from './plugin'
import { registerSchemaPath } from '../src/utils'
const app = new Elysia()
.use(
@@ -39,6 +37,5 @@ const app = new Elysia()
}
})
)
// .use(plugin)
.get('/id/:id?', 'a')
.listen(3000)

View File

@@ -36,11 +36,6 @@
"types": "./dist/scalar/theme.d.ts",
"import": "./dist/scalar/theme.mjs",
"require": "./dist/cjs/scalar/theme.js"
},
"./scalar/types": {
"types": "./dist/scalar/types/index.d.ts",
"import": "./dist/scalar/types/index.mjs",
"require": "./dist/cjs/scalar/types/index.js"
}
},
"keywords": [
@@ -66,7 +61,6 @@
},
"devDependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@scalar/api-reference": "^1.25.21",
"@types/bun": "1.1.6",
"elysia": ">= 1.1.0-rc.2",
"eslint": "9.6.0",
@@ -74,6 +68,7 @@
"typescript": "^5.5.3"
},
"dependencies": {
"@scalar/types": "^0.0.12",
"openapi-types": "^12.1.3",
"pathe": "^1.1.2"
}

View File

@@ -7,7 +7,7 @@ import { ScalarRender } from './scalar'
import { filterPaths, registerSchemaPath } from './utils'
import type { OpenAPIV3 } from 'openapi-types'
import type { ReferenceConfiguration } from '@scalar/api-reference'
import type { ReferenceConfiguration } from '@scalar/types'
import type { ElysiaSwaggerConfig } from './types'
/**

View File

@@ -1,6 +1,6 @@
import scalarElysiaTheme from './theme'
import type { OpenAPIV3 } from 'openapi-types'
import type { ReferenceConfiguration } from '@scalar/api-reference'
import type { ReferenceConfiguration } from '@scalar/types'
export const ScalarRender = (
info: OpenAPIV3.InfoObject,

View File

@@ -1,12 +0,0 @@
export type SpecConfiguration = {
/** URL to a Swagger/OpenAPI file */
url?: string;
/** Swagger/Open API spec */
content?: string | Record<string, any> | (() => Record<string, any>);
/** The result of @scalar/swagger-parser */
preparsedContent?: Record<any, any>;
};
export type ReferenceLayoutType = 'modern' | 'classic';
export type ThemeId = 'alternate' | 'default' | 'moon' | 'purple' | 'solarized' | 'none';

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
import type { OpenAPIV3 } from 'openapi-types'
import type { ReferenceConfiguration } from '@scalar/api-reference'
import type { ReferenceConfiguration } from '@scalar/types'
import type { SwaggerUIOptions } from './swagger/types'
export interface ElysiaSwaggerConfig<Path extends string = '/swagger'> {
@@ -44,7 +44,7 @@ export interface ElysiaSwaggerConfig<Path extends string = '/swagger'> {
/**
* Scalar configuration to customize scalar
*'
* @see https://github.com/scalar/scalar
* @see https://github.com/scalar/scalar/blob/main/documentation/configuration.md
*/
scalarConfig?: ReferenceConfiguration
/**