@scalar/fastify-api-reference 0.6.2 → 0.6.4
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/CHANGELOG.md +107 -0
- package/dist/index.cjs +37 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +47 -1
- package/dist/templates/fastify-api-reference.js +40935 -25291
- package/package.json +8 -6
- package/dist/fastifyApiReference.js +0 -23
- package/dist/templates/render.d.ts +0 -2
- package/dist/templates/render.d.ts.map +0 -1
- package/dist/templates/render.js +0 -69
- package/dist/vite-plugins/index.d.ts +0 -3
- package/dist/vite-plugins/index.d.ts.map +0 -1
- package/dist/vite-plugins/index.js +0 -2
- package/dist/vite-plugins/nodeExternals.d.ts +0 -8
- package/dist/vite-plugins/nodeExternals.d.ts.map +0 -1
- package/dist/vite-plugins/nodeExternals.js +0 -14
- package/dist/vite-plugins/nodeShims.d.ts +0 -6
- package/dist/vite-plugins/nodeShims.d.ts.map +0 -1
- package/dist/vite-plugins/nodeShims.js +0 -32
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @scalar/fastify-api-reference
|
|
2
|
+
|
|
3
|
+
## 0.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 048555c6: feat: add CHANGELOG.md to the package
|
|
8
|
+
- Updated dependencies [449305f4]
|
|
9
|
+
- Updated dependencies [3e912c75]
|
|
10
|
+
- Updated dependencies [048555c6]
|
|
11
|
+
- Updated dependencies [df62875a]
|
|
12
|
+
- @scalar/api-reference@0.6.4
|
|
13
|
+
|
|
14
|
+
## 0.6.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 5288e2ce: fix: node shims for the fastify plugin
|
|
19
|
+
|
|
20
|
+
## 0.6.2
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 64daacf3: chore: improve Node.js build
|
|
25
|
+
- effc1f31: feat: add new HTML API based on script tags
|
|
26
|
+
chore: deprecate old div based HTML API
|
|
27
|
+
- Updated dependencies [75a69ba7]
|
|
28
|
+
- Updated dependencies [effc1f31]
|
|
29
|
+
- Updated dependencies [75a69ba7]
|
|
30
|
+
- Updated dependencies [b03a09c7]
|
|
31
|
+
- Updated dependencies [11270915]
|
|
32
|
+
- @scalar/api-reference@0.6.3
|
|
33
|
+
|
|
34
|
+
## 0.6.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- fdca56a9: feat: bundle JS with the plugin
|
|
39
|
+
- 33e32a86: refactor: use templating engine
|
|
40
|
+
- Updated dependencies [b184bdf2]
|
|
41
|
+
- Updated dependencies [e9861139]
|
|
42
|
+
- Updated dependencies [8751c874]
|
|
43
|
+
- Updated dependencies [addd9fa2]
|
|
44
|
+
- @scalar/api-reference@0.6.2
|
|
45
|
+
|
|
46
|
+
## 0.6.0
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- 3333a2fb: refactor: new fastify plugin, rename prefix to routePrefix
|
|
51
|
+
|
|
52
|
+
## 0.5.0
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- 87fda5af: chore: update dependencies
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- ef080a26: chore: format package.json
|
|
61
|
+
- 87fda5af: feat: optionally pass a callback to the spec option
|
|
62
|
+
- 26f96c50: fix: types (again)
|
|
63
|
+
|
|
64
|
+
## 0.4.2
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- d51aebe5: chore: remove source files from packages
|
|
69
|
+
- 478b200c: fix: types
|
|
70
|
+
|
|
71
|
+
## 0.4.1
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- f029be41: fix: custom TypeScript type for the fastify plugin
|
|
76
|
+
- 10498d9d: chore: add README
|
|
77
|
+
- 494083a0: add more information to the package.json
|
|
78
|
+
|
|
79
|
+
## 0.4.0
|
|
80
|
+
|
|
81
|
+
### Minor Changes
|
|
82
|
+
|
|
83
|
+
- 5057e213: make npm packages public :-)
|
|
84
|
+
|
|
85
|
+
## 0.3.2
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 237e28b0: fix: ESM support for fastify api reference package
|
|
90
|
+
|
|
91
|
+
## 0.3.1
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- 53d9bae: fix: make fastify an external dependency
|
|
96
|
+
|
|
97
|
+
## 0.3.0
|
|
98
|
+
|
|
99
|
+
### Minor Changes
|
|
100
|
+
|
|
101
|
+
- b0f5221: manually releasing all packages to make sure the lastest version is on npm
|
|
102
|
+
|
|
103
|
+
## 0.2.0
|
|
104
|
+
|
|
105
|
+
### Minor Changes
|
|
106
|
+
|
|
107
|
+
- a ton of fixes, new fastify plugin
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const ejs = require("ejs");
|
|
3
|
+
const fp = require("fastify-plugin");
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const fastifyApiReference = async (fastify, options) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
if (!((_a = options.apiReference) == null ? void 0 : _a.spec) && !((_b = options.apiReference) == null ? void 0 : _b.specUrl)) {
|
|
9
|
+
console.warn(
|
|
10
|
+
"[@scalar/fastify-api-reference] You didn’t provide a spec or specUrl. Please provide one of these options."
|
|
11
|
+
);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
fastify.get(options.routePrefix ?? "/", async (_, reply) => {
|
|
15
|
+
reply.header("Content-Type", "text/html; charset=utf-8");
|
|
16
|
+
const html = await ejs.renderFile(
|
|
17
|
+
path.resolve(`${__dirname}/../dist/templates/index.ejs`),
|
|
18
|
+
{
|
|
19
|
+
options
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
reply.send(html);
|
|
23
|
+
});
|
|
24
|
+
fastify.get(
|
|
25
|
+
(options.routePrefix ?? "/") + "/fastify-api-reference.js",
|
|
26
|
+
async (_, reply) => {
|
|
27
|
+
reply.header("Content-Type", "application/javascript; charset=utf-8");
|
|
28
|
+
const content = fs.readFileSync(
|
|
29
|
+
path.resolve(`${__dirname}/../dist/templates/fastify-api-reference.js`),
|
|
30
|
+
"utf8"
|
|
31
|
+
);
|
|
32
|
+
reply.send(content);
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
const fastifyApiReference$1 = fp(fastifyApiReference);
|
|
37
|
+
module.exports = fastifyApiReference$1;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './fastifyApiReference
|
|
1
|
+
export { default } from './fastifyApiReference';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import __path from "path";
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from "url";
|
|
3
|
+
import { createRequire as __createRequire } from "module";
|
|
4
|
+
const __getFilename = () => __fileURLToPath(import.meta.url);
|
|
5
|
+
const __getDirname = () => __path.dirname(__getFilename());
|
|
6
|
+
const __dirname = __getDirname();
|
|
7
|
+
const __filename = __getFilename();
|
|
8
|
+
const self = globalThis;
|
|
9
|
+
const require2 = __createRequire(import.meta.url);
|
|
10
|
+
import ejs from "ejs";
|
|
11
|
+
import fp from "fastify-plugin";
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
const fastifyApiReference = async (fastify, options) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
if (!((_a = options.apiReference) == null ? void 0 : _a.spec) && !((_b = options.apiReference) == null ? void 0 : _b.specUrl)) {
|
|
17
|
+
console.warn(
|
|
18
|
+
"[@scalar/fastify-api-reference] You didn’t provide a spec or specUrl. Please provide one of these options."
|
|
19
|
+
);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
fastify.get(options.routePrefix ?? "/", async (_, reply) => {
|
|
23
|
+
reply.header("Content-Type", "text/html; charset=utf-8");
|
|
24
|
+
const html = await ejs.renderFile(
|
|
25
|
+
path.resolve(`${__dirname}/../dist/templates/index.ejs`),
|
|
26
|
+
{
|
|
27
|
+
options
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
reply.send(html);
|
|
31
|
+
});
|
|
32
|
+
fastify.get(
|
|
33
|
+
(options.routePrefix ?? "/") + "/fastify-api-reference.js",
|
|
34
|
+
async (_, reply) => {
|
|
35
|
+
reply.header("Content-Type", "application/javascript; charset=utf-8");
|
|
36
|
+
const content = fs.readFileSync(
|
|
37
|
+
path.resolve(`${__dirname}/../dist/templates/fastify-api-reference.js`),
|
|
38
|
+
"utf8"
|
|
39
|
+
);
|
|
40
|
+
reply.send(content);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
const fastifyApiReference$1 = fp(fastifyApiReference);
|
|
45
|
+
export {
|
|
46
|
+
fastifyApiReference$1 as default
|
|
47
|
+
};
|