@scalar/nuxt 0.2.211 → 0.3.1
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/README.md
CHANGED
|
@@ -41,9 +41,7 @@ If you would like to add your own OpenAPI document you can do so with the follow
|
|
|
41
41
|
export default defineNuxtConfig({
|
|
42
42
|
modules: ['@scalar/nuxt'],
|
|
43
43
|
scalar: {
|
|
44
|
-
|
|
45
|
-
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml',
|
|
46
|
-
},
|
|
44
|
+
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml',
|
|
47
45
|
},
|
|
48
46
|
})
|
|
49
47
|
```
|
|
@@ -67,9 +65,7 @@ export default defineNuxtConfig({
|
|
|
67
65
|
pathRouting: {
|
|
68
66
|
basePath: '/scalar',
|
|
69
67
|
},
|
|
70
|
-
|
|
71
|
-
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml',
|
|
72
|
-
},
|
|
68
|
+
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml',
|
|
73
69
|
},
|
|
74
70
|
})
|
|
75
71
|
```
|
|
@@ -88,17 +84,13 @@ export default defineNuxtConfig({
|
|
|
88
84
|
proxyUrl: 'https://proxy.scalar.com',
|
|
89
85
|
configurations: [
|
|
90
86
|
{
|
|
91
|
-
|
|
92
|
-
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml,
|
|
93
|
-
},
|
|
87
|
+
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml,
|
|
94
88
|
pathRouting: {
|
|
95
89
|
basePath: '/yaml',
|
|
96
90
|
},
|
|
97
91
|
},
|
|
98
92
|
{
|
|
99
|
-
|
|
100
|
-
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json',
|
|
101
|
-
},
|
|
93
|
+
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json',
|
|
102
94
|
pathRouting: {
|
|
103
95
|
basePath: '/json',
|
|
104
96
|
},
|
package/dist/module.json
CHANGED
|
@@ -11,22 +11,27 @@ const props = defineProps<{
|
|
|
11
11
|
|
|
12
12
|
const isDark = ref(props.configuration.darkMode)
|
|
13
13
|
|
|
14
|
+
// @ts-expect-error support the old syntax for a bit
|
|
15
|
+
const content = props.configuration.spec?.content ?? props.configuration.content
|
|
16
|
+
// @ts-expect-error support the old syntax for a bit
|
|
17
|
+
const url = props.configuration.spec?.url ?? props.configuration.url
|
|
18
|
+
|
|
14
19
|
// Grab spec if we can
|
|
15
|
-
const
|
|
16
|
-
typeof
|
|
17
|
-
? toRaw(
|
|
18
|
-
:
|
|
19
|
-
? toRaw(
|
|
20
|
-
:
|
|
21
|
-
? await $fetch<string>(
|
|
20
|
+
const document =
|
|
21
|
+
typeof content === 'function'
|
|
22
|
+
? toRaw(content())
|
|
23
|
+
: content
|
|
24
|
+
? toRaw(content)
|
|
25
|
+
: url
|
|
26
|
+
? await $fetch<string>(url)
|
|
22
27
|
: await $fetch<string>('/_openapi.json')
|
|
23
28
|
|
|
24
29
|
// Check for empty spec
|
|
25
|
-
if (!
|
|
30
|
+
if (!document)
|
|
26
31
|
throw new Error('You must provide a document for Scalar API References')
|
|
27
32
|
|
|
28
|
-
const parsedSpec = reactive(await parse(
|
|
29
|
-
const rawSpec = JSON.stringify(
|
|
33
|
+
const parsedSpec = reactive(await parse(document))
|
|
34
|
+
const rawSpec = JSON.stringify(document)
|
|
30
35
|
|
|
31
36
|
// Load up the metadata
|
|
32
37
|
if (props.configuration?.metaData) useSeoMeta(props.configuration.metaData)
|
|
@@ -8,7 +8,11 @@ const meta = route.meta as Meta
|
|
|
8
8
|
// Ensure we have a spec
|
|
9
9
|
if (
|
|
10
10
|
!meta.isOpenApiEnabled &&
|
|
11
|
+
!meta.configuration?.url &&
|
|
12
|
+
!meta.configuration?.content &&
|
|
13
|
+
// @ts-expect-error support the old syntax for a bit
|
|
11
14
|
!meta.configuration?.spec?.url &&
|
|
15
|
+
// @ts-expect-error support the old syntax for a bit
|
|
12
16
|
!meta.configuration?.spec?.content
|
|
13
17
|
)
|
|
14
18
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"testing",
|
|
21
21
|
"vue"
|
|
22
22
|
],
|
|
23
|
-
"version": "0.
|
|
23
|
+
"version": "0.3.1",
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=18"
|
|
26
26
|
},
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@nuxt/kit": "^3.12.3",
|
|
42
|
-
"@scalar/api-client": "2.
|
|
43
|
-
"@scalar/
|
|
44
|
-
"@scalar/
|
|
42
|
+
"@scalar/api-client": "2.3.1",
|
|
43
|
+
"@scalar/api-reference": "1.28.1",
|
|
44
|
+
"@scalar/types": "0.1.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@nuxt/devtools": "^1.3.9",
|