@scalar/astro 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Scalar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ <!--
2
+ This file is auto-generated by the Scalar README generator.
3
+ Command: pnpm --filter @scalar-internal/build-scripts start generate-readme
4
+
5
+ Do not edit this file manually. Changes will be lost when the file is regenerated.
6
+ -->
7
+
8
+ # Scalar API Reference for Astro
9
+
10
+ [![Version](https://img.shields.io/npm/v/@scalar/astro)](https://www.npmjs.com/package/@scalar/astro)
11
+ [![Downloads](https://img.shields.io/npm/dm/@scalar/astro)](https://www.npmjs.com/package/@scalar/astro)
12
+ [![License](https://img.shields.io/npm/l/@scalar/astro)](https://www.npmjs.com/package/@scalar/astro)
13
+ [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/scalar)
14
+
15
+ Scalar API Reference Component for Astro
16
+
17
+ ## Documentation
18
+
19
+ [Read the documentation here](https://guides.scalar.com/scalar/scalar-api-references/integrations/astro)
20
+
21
+ ## Community
22
+
23
+ We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/scalar>
24
+
25
+ ## License
26
+
27
+ The source code in this repository is licensed under [MIT](https://github.com/scalar/scalar/blob/main/LICENSE).
package/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ // Do not write code directly here, instead use the `src` folder!
2
+ // Then, use this file to export everything you want your user to access.
3
+
4
+ import ScalarComponent from './src/ScalarComponent.astro'
5
+
6
+ export { ScalarComponent }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@scalar/astro",
3
+ "description": "Scalar API Reference Component for Astro",
4
+ "license": "MIT",
5
+ "author": "Scalar (https://github.com/scalar)",
6
+ "homepage": "https://github.com/scalar/scalar",
7
+ "bugs": "https://github.com/scalar/scalar/issues/new/choose",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/scalar/scalar.git",
11
+ "directory": "integrations/astro"
12
+ },
13
+ "keywords": [
14
+ "astro-component",
15
+ "utils",
16
+ "scalar",
17
+ "openapi",
18
+ "swagger"
19
+ ],
20
+ "version": "0.1.0",
21
+ "engines": {
22
+ "node": ">=20"
23
+ },
24
+ "type": "module",
25
+ "exports": {
26
+ ".": "./index.ts"
27
+ },
28
+ "files": [
29
+ "src",
30
+ "index.ts"
31
+ ],
32
+ "readme": {
33
+ "title": "Scalar API Reference for Astro",
34
+ "badges": [
35
+ {
36
+ "type": "npm-version"
37
+ },
38
+ {
39
+ "type": "npm-downloads"
40
+ },
41
+ {
42
+ "type": "npm-license"
43
+ }
44
+ ],
45
+ "documentation": "https://guides.scalar.com/scalar/scalar-api-references/integrations/astro"
46
+ },
47
+ "dependencies": {
48
+ "@scalar/core": "0.3.22"
49
+ },
50
+ "devDependencies": {
51
+ "astro": "^4.0.0 || ^5.0.0"
52
+ },
53
+ "peerDependencies": {
54
+ "astro": "^4.0.0 || ^5.0.0"
55
+ },
56
+ "scripts": {
57
+ "dev": "cd playground && pnpm dev"
58
+ }
59
+ }
@@ -0,0 +1,24 @@
1
+ ---
2
+ import { getHtmlDocument, type HtmlRenderingConfiguration } from '@scalar/core/libs/html-rendering'
3
+
4
+ export interface Props {
5
+ configuration: Partial<HtmlRenderingConfiguration>
6
+ }
7
+
8
+ /**
9
+ * The default configuration for the API Reference.
10
+ */
11
+ const DEFAULT_CONFIGURATION: Partial<HtmlRenderingConfiguration> = {
12
+ // TODO :Add the integration name to the configuration once the first release went out to allow the value
13
+ // _integration: 'astro',
14
+ }
15
+
16
+ const { configuration } = Astro.props
17
+
18
+ const html = getHtmlDocument({
19
+ ...DEFAULT_CONFIGURATION,
20
+ ...configuration,
21
+ })
22
+ ---
23
+
24
+ <div set:html={html}></div>