@scalar/nuxt 0.0.29 → 0.0.34

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
@@ -3,7 +3,7 @@
3
3
  [![Version](https://img.shields.io/npm/v/%40scalar/nuxt)](https://www.npmjs.com/package/@scalar/nuxt)
4
4
  [![Downloads](https://img.shields.io/npm/dm/%40scalar/nuxt)](https://www.npmjs.com/package/@scalar/nuxt)
5
5
  [![License](https://img.shields.io/npm/l/%40scalar%2Fnuxt)](https://www.npmjs.com/package/@scalar/nuxt)
6
- [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/8HeZcRGPFS)
6
+ [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/scalar)
7
7
 
8
8
  This plugin provides an easy way to render a beautiful API reference based on a OpenAPI/Swagger file with Nuxt.
9
9
 
@@ -73,3 +73,37 @@ export default defineNuxtConfig({
73
73
  },
74
74
  })
75
75
  ```
76
+
77
+ For multiple references, pass in an array of configuration objects which extend on top of the base
78
+ config.
79
+
80
+ ```ts
81
+ export default defineNuxtConfig({
82
+ modules: ['@scalar/nuxt'],
83
+ scalar: {
84
+ darkMode: true,
85
+ metaData: {
86
+ title: 'API Documentation by Scalar',
87
+ },
88
+ proxy: 'https://api.scalar.com/request-proxy',
89
+ configurations: [
90
+ {
91
+ spec: {
92
+ url: 'https://cdn.scalar.com/spec/openapi_petstore.json',
93
+ },
94
+ pathRouting: {
95
+ basePath: '/petstore',
96
+ },
97
+ },
98
+ {
99
+ spec: {
100
+ url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json',
101
+ },
102
+ pathRouting: {
103
+ basePath: '/galaxy',
104
+ },
105
+ },
106
+ ],
107
+ },
108
+ })
109
+ ```
package/dist/module.d.mts CHANGED
@@ -10,7 +10,13 @@ type Configuration = Omit<ReferenceConfiguration, 'layout' | 'isEditable' | 'onS
10
10
  devtools: boolean;
11
11
  };
12
12
 
13
- type ModuleOptions = Configuration;
14
- declare const _default: _nuxt_schema.NuxtModule<Configuration>;
13
+ type ModuleOptions = {
14
+ /**
15
+ * For multiple references, pass an array of config objects into
16
+ * configurations. These configurations will extend over the base config
17
+ */
18
+ configurations: Configuration[];
19
+ } & Configuration;
20
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
15
21
 
16
22
  export { type ModuleOptions, _default as default };
package/dist/module.d.ts CHANGED
@@ -10,7 +10,13 @@ type Configuration = Omit<ReferenceConfiguration, 'layout' | 'isEditable' | 'onS
10
10
  devtools: boolean;
11
11
  };
12
12
 
13
- type ModuleOptions = Configuration;
14
- declare const _default: _nuxt_schema.NuxtModule<Configuration>;
13
+ type ModuleOptions = {
14
+ /**
15
+ * For multiple references, pass an array of config objects into
16
+ * configurations. These configurations will extend over the base config
17
+ */
18
+ configurations: Configuration[];
19
+ } & Configuration;
20
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
15
21
 
16
22
  export { type ModuleOptions, _default as default };
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@scalar/nuxt",
3
3
  "configKey": "scalar",
4
- "version": "0.0.29"
4
+ "version": "0.0.34"
5
5
  }
package/dist/module.mjs CHANGED
@@ -15,7 +15,8 @@ const module = defineNuxtModule({
15
15
  basePath: "/docs"
16
16
  },
17
17
  showSidebar: true,
18
- devtools: true
18
+ devtools: true,
19
+ configurations: []
19
20
  },
20
21
  setup(_options, _nuxt) {
21
22
  const resolver = createResolver(import.meta.url);
@@ -39,15 +40,31 @@ const module = defineNuxtModule({
39
40
  filePath: resolver.resolve("./runtime/components/ScalarApiReference.vue")
40
41
  });
41
42
  extendPages((pages) => {
42
- pages.push({
43
- name: "scalar",
44
- path: _options.pathRouting?.basePath + ":pathMatch(.*)*",
45
- meta: {
46
- configuration: _options,
47
- isOpenApiEnabled
48
- },
49
- file: resolver.resolve("./runtime/pages/ScalarPage.vue")
50
- });
43
+ if (_options.configurations.length) {
44
+ const { configurations, ...baseConfig } = _options;
45
+ configurations.forEach((_config, index) => {
46
+ const configuration = { ...baseConfig, ..._config };
47
+ pages.push({
48
+ name: "scalar-" + index,
49
+ path: configuration.pathRouting?.basePath + ":pathMatch(.*)*",
50
+ meta: {
51
+ configuration,
52
+ isOpenApiEnabled
53
+ },
54
+ file: resolver.resolve("./runtime/pages/ScalarPage.vue")
55
+ });
56
+ });
57
+ } else {
58
+ pages.push({
59
+ name: "scalar",
60
+ path: _options.pathRouting?.basePath + ":pathMatch(.*)*",
61
+ meta: {
62
+ configuration: _options,
63
+ isOpenApiEnabled
64
+ },
65
+ file: resolver.resolve("./runtime/pages/ScalarPage.vue")
66
+ });
67
+ }
51
68
  });
52
69
  if (_nuxt.options.dev && _options.devtools) {
53
70
  _nuxt.hook("devtools:customTabs", (tabs) => {
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
package/package.json CHANGED
@@ -5,6 +5,11 @@
5
5
  "author": "Scalar (https://github.com/scalar)",
6
6
  "homepage": "https://github.com/scalar/scalar",
7
7
  "bugs": "https://github.com/scalar/scalar/issues/new/choose",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/scalar/scalar.git",
11
+ "directory": "packages/nuxt"
12
+ },
8
13
  "keywords": [
9
14
  "api",
10
15
  "references",
@@ -15,7 +20,7 @@
15
20
  "testing",
16
21
  "vue"
17
22
  ],
18
- "version": "0.0.29",
23
+ "version": "0.0.34",
19
24
  "engines": {
20
25
  "node": ">=18"
21
26
  },
@@ -34,7 +39,7 @@
34
39
  ],
35
40
  "dependencies": {
36
41
  "@nuxt/kit": "^3.11.2",
37
- "@scalar/api-reference": "1.22.19"
42
+ "@scalar/api-reference": "1.22.24"
38
43
  },
39
44
  "devDependencies": {
40
45
  "@nuxt/devtools": "^1.1.5",