mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-07 05:40:19 +03:00
chore: optimize verification: browser or server
This commit is contained in:
parent
7d44e6bdfb
commit
0acef35775
|
@ -2,14 +2,14 @@
|
|||
import { convertObj } from 'swagger2openapi';
|
||||
import { OpenAPISpec } from '../types';
|
||||
import { Source, Document, bundle, Config, RawConfig } from '@redocly/openapi-core';
|
||||
import { IS_BROWSER } from './dom';
|
||||
|
||||
export async function loadAndBundleSpec(specUrlOrObject: object | string): Promise<OpenAPISpec> {
|
||||
const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
||||
const rawConfig: RawConfig = {};
|
||||
const config = new Config(rawConfig);
|
||||
const bundleOpts = {
|
||||
config,
|
||||
base: isNode ? process.cwd() : window.location.href
|
||||
base: IS_BROWSER ? window.location.href : process.cwd()
|
||||
}
|
||||
|
||||
if (typeof specUrlOrObject === 'object' && specUrlOrObject !== null) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user