@scalar/nuxt 0.5.20 → 0.5.22
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/dist/module.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { ApiReference } from "@scalar/api-reference";
|
|
3
3
|
import { useColorMode } from "@scalar/use-hooks/useColorMode";
|
|
4
|
-
import { createWorkspaceStore } from "@scalar/workspace-store/client";
|
|
5
4
|
import {
|
|
6
5
|
useAsyncData,
|
|
7
6
|
useFetch,
|
|
@@ -52,7 +51,6 @@ if (!document.value) {
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
props.configuration.content = document.value;
|
|
56
54
|
if (!document) {
|
|
57
55
|
throw new Error(
|
|
58
56
|
"You must provide a document for Scalar API References. Either provide a spec URL/content, or enable experimental openAPI in the Nitro config."
|
|
@@ -86,39 +84,21 @@ onMounted(() => {
|
|
|
86
84
|
window.document.getElementById("scalar-color-mode-script")?.remove();
|
|
87
85
|
});
|
|
88
86
|
const { origin } = useRequestURL();
|
|
87
|
+
const route = useRoute();
|
|
89
88
|
const config = {
|
|
90
89
|
baseServerURL: origin,
|
|
91
90
|
_integration: "nuxt",
|
|
92
91
|
layout: "modern",
|
|
93
|
-
...props.configuration
|
|
92
|
+
...props.configuration,
|
|
93
|
+
// Match the workspace-store name/slug to the route name
|
|
94
|
+
slug: route.name,
|
|
95
|
+
// Set the fetched spec to the config content to prevent ApiReferenceLayout from fetching it again on the client side
|
|
96
|
+
content: document.value
|
|
94
97
|
};
|
|
95
|
-
const route = useRoute();
|
|
96
|
-
const store = createWorkspaceStore();
|
|
97
|
-
let parsedDocument;
|
|
98
|
-
if (typeof document.value === "string") {
|
|
99
|
-
try {
|
|
100
|
-
parsedDocument = JSON.parse(document.value);
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error("Failed to parse OpenAPI document:", error);
|
|
103
|
-
throw new Error("Invalid OpenAPI document format");
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
if (document.value && typeof document.value === "object") {
|
|
107
|
-
parsedDocument = document.value;
|
|
108
|
-
} else {
|
|
109
|
-
throw new Error("Document must be a valid OpenAPI object");
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
store.addDocument({
|
|
113
|
-
name: route.name,
|
|
114
|
-
document: parsedDocument
|
|
115
|
-
});
|
|
116
98
|
</script>
|
|
117
99
|
|
|
118
100
|
<template>
|
|
119
|
-
<
|
|
120
|
-
:configuration="config"
|
|
121
|
-
:store />
|
|
101
|
+
<ApiReference :configuration="config" />
|
|
122
102
|
</template>
|
|
123
103
|
|
|
124
104
|
<style>
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"testing",
|
|
21
21
|
"vue"
|
|
22
22
|
],
|
|
23
|
-
"version": "0.5.
|
|
23
|
+
"version": "0.5.22",
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=20"
|
|
26
26
|
},
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@nuxt/kit": "^4.0.0",
|
|
41
|
-
"vue": "^3.5.
|
|
42
|
-
"@scalar/api-
|
|
43
|
-
"@scalar/
|
|
44
|
-
"@scalar/
|
|
45
|
-
"@scalar/
|
|
46
|
-
"@scalar/
|
|
41
|
+
"vue": "^3.5.21",
|
|
42
|
+
"@scalar/api-client": "2.9.0",
|
|
43
|
+
"@scalar/types": "0.4.0",
|
|
44
|
+
"@scalar/workspace-store": "0.18.0",
|
|
45
|
+
"@scalar/api-reference": "1.39.0",
|
|
46
|
+
"@scalar/use-hooks": "0.3.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@nuxt/devtools": "^2.6.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/node": "^22.9.0",
|
|
55
55
|
"cross-env": "^7.0.3",
|
|
56
56
|
"nuxt": "^4.1.0",
|
|
57
|
-
"vite": "7.1.
|
|
57
|
+
"vite": "7.1.11",
|
|
58
58
|
"vitest": "3.2.4"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
@@ -62,11 +62,8 @@
|
|
|
62
62
|
"dev": "pnpm dev:prepare && nuxi dev playground",
|
|
63
63
|
"dev:build": "nuxi build playground",
|
|
64
64
|
"dev:prepare": "nuxi prepare && nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"lint:check": "scalar-lint-check",
|
|
68
|
-
"lint:fix": "scalar-lint-fix",
|
|
69
|
-
"test:watch": "vitest watch",
|
|
65
|
+
"test": "vitest",
|
|
66
|
+
"test:e2e": "playwright test",
|
|
70
67
|
"types:check": "NUXT_TELEMETRY_DISABLED=true nuxi typecheck"
|
|
71
68
|
}
|
|
72
69
|
}
|