@scalar/fastify-api-reference 1.25.118 → 1.25.119
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 +9 -0
- package/dist/fastifyApiReference.d.ts.map +1 -1
- package/dist/index.js +5 -15
- package/dist/js/standalone.js +1826 -1830
- package/dist/utils/getJavaScriptFile.d.ts.map +1 -1
- package/package.json +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastifyApiReference.d.ts","sourceRoot":"","sources":["../src/fastifyApiReference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"fastifyApiReference.d.ts","sourceRoot":"","sources":["../src/fastifyApiReference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAI9F,OAAO,KAAK,EAAmC,0BAA0B,EAAE,MAAM,YAAY,CAAA;AA2B7F;;GAEG;AACH,eAAO,MAAM,UAAU,s4EAwEtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,YAAa,0BAA0B,WAkB7D,CAAA;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,0BAA0B,UAgB/D;AAED,QAAA,MAAM,mBAAmB,sIAgMxB,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -19645,11 +19645,7 @@ function getJavaScriptFile() {
|
|
|
19645
19645
|
path.resolve(`${dirname}/../../dist/js/standalone.js`)
|
|
19646
19646
|
].find((file) => fs.existsSync(file));
|
|
19647
19647
|
if (filePath === void 0) {
|
|
19648
|
-
throw new Error(
|
|
19649
|
-
`JavaScript file not found: ${path.resolve(
|
|
19650
|
-
`${dirname}/js/standalone.js`
|
|
19651
|
-
)}`
|
|
19652
|
-
);
|
|
19648
|
+
throw new Error(`JavaScript file not found: ${path.resolve(`${dirname}/js/standalone.js`)}`);
|
|
19653
19649
|
}
|
|
19654
19650
|
return fs.readFileSync(filePath, "utf8");
|
|
19655
19651
|
}
|
|
@@ -19665,10 +19661,7 @@ const getOpenApiDocumentEndpoints = (openApiDocumentEndpoints) => {
|
|
|
19665
19661
|
return { json, yaml };
|
|
19666
19662
|
};
|
|
19667
19663
|
const RELATIVE_JAVASCRIPT_PATH = "js/scalar.js";
|
|
19668
|
-
const getJavaScriptUrl = (routePrefix) => `${getRoutePrefix(routePrefix)}/${RELATIVE_JAVASCRIPT_PATH}`.replace(
|
|
19669
|
-
/\/\//g,
|
|
19670
|
-
"/"
|
|
19671
|
-
);
|
|
19664
|
+
const getJavaScriptUrl = (routePrefix) => `${getRoutePrefix(routePrefix)}/${RELATIVE_JAVASCRIPT_PATH}`.replace(/\/\//g, "/");
|
|
19672
19665
|
const defaultCss = `
|
|
19673
19666
|
.light-mode {
|
|
19674
19667
|
color-scheme: light;
|
|
@@ -19810,10 +19803,7 @@ const fastifyApiReference = fp(
|
|
|
19810
19803
|
const fileContent = getJavaScriptFile();
|
|
19811
19804
|
const hooks = {};
|
|
19812
19805
|
if (options.hooks) {
|
|
19813
|
-
const additionalHooks = [
|
|
19814
|
-
"onRequest",
|
|
19815
|
-
"preHandler"
|
|
19816
|
-
];
|
|
19806
|
+
const additionalHooks = ["onRequest", "preHandler"];
|
|
19817
19807
|
for (const hook of additionalHooks) {
|
|
19818
19808
|
if (options.hooks[hook]) hooks[hook] = options.hooks[hook];
|
|
19819
19809
|
}
|
|
@@ -19837,7 +19827,7 @@ const fastifyApiReference = fp(
|
|
|
19837
19827
|
const spec = getLoadedSpecIfAvailable();
|
|
19838
19828
|
const filename = await getSpecFilenameSlug(spec);
|
|
19839
19829
|
const json = JSON.parse(await spec.toJson());
|
|
19840
|
-
return reply.header("Content-Type",
|
|
19830
|
+
return reply.header("Content-Type", "application/json").header("Content-Disposition", `filename=${filename}.json`).header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Methods", "*").send(json);
|
|
19841
19831
|
}
|
|
19842
19832
|
});
|
|
19843
19833
|
const openApiSpecUrlYaml = `${getRoutePrefix(options.routePrefix)}${getOpenApiDocumentEndpoints(options.openApiDocumentEndpoints).yaml}`;
|
|
@@ -19851,7 +19841,7 @@ const fastifyApiReference = fp(
|
|
|
19851
19841
|
const spec = getLoadedSpecIfAvailable();
|
|
19852
19842
|
const filename = await getSpecFilenameSlug(spec);
|
|
19853
19843
|
const yaml = await spec.toYaml();
|
|
19854
|
-
return reply.header("Content-Type",
|
|
19844
|
+
return reply.header("Content-Type", "application/yaml").header("Content-Disposition", `filename=${filename}.yaml`).header("Access-Control-Allow-Origin", "*").header("Access-Control-Allow-Methods", "*").send(yaml);
|
|
19855
19845
|
}
|
|
19856
19846
|
});
|
|
19857
19847
|
const doesNotIgnoreTrailingSlash = fastify.initialConfig.ignoreTrailingSlash !== true;
|