@strifeapp/astro 1.0.0 → 1.0.2

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.
@@ -0,0 +1,9 @@
1
+ import type { AstroIntegration } from 'astro';
2
+ import type { IAuthOptions } from 'ravendb';
3
+ export type IntegrationOptions = IAuthOptions & {
4
+ certificate?: string;
5
+ password?: string;
6
+ urls?: string[];
7
+ database?: string;
8
+ };
9
+ export default function strifeIntegration(options?: IntegrationOptions): AstroIntegration;
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ import { vitePluginStrifeStore } from './vite-plugin-strife-store';
2
+ const defaultClientConfig = {
3
+ type: 'pfx',
4
+ };
5
+ export default function strifeIntegration(options = {}) {
6
+ // Validate options
7
+ /* if (!options.apiKey) {
8
+ throw new Error('[@yourcms/astro]: The `apiKey` option is required')
9
+ } */
10
+ return {
11
+ name: '@strife/astro',
12
+ hooks: {
13
+ 'astro:config:setup': ({ updateConfig, injectRoute, injectScript }) => {
14
+ // Update Vite/Astro config if needed
15
+ updateConfig({
16
+ vite: {
17
+ plugins: [
18
+ // Add your Vite plugins here
19
+ vitePluginStrifeStore({
20
+ ...defaultClientConfig,
21
+ ...options
22
+ })
23
+ ],
24
+ // Add other Vite config options
25
+ }
26
+ });
27
+ // Add CMS dashboard route if needed
28
+ /* if (options.basePath) {
29
+ injectRoute({
30
+ pattern: `/${options.basePath}`,
31
+ entrypoint: '@yourcms/astro/dashboard.astro',
32
+ prerender: false
33
+ })
34
+ } */
35
+ // Inject any client-side scripts
36
+ /* injectScript('page-ssr', `
37
+ import { store } from "strife:store";
38
+ globalThis.store = store;
39
+ `) */
40
+ }
41
+ }
42
+ };
43
+ }
@@ -0,0 +1,3 @@
1
+ import type { IntegrationOptions } from './index';
2
+ import type { PluginOption } from 'vite';
3
+ export declare function vitePluginStrifeStore(config: IntegrationOptions): PluginOption;
@@ -0,0 +1,33 @@
1
+ //import type {ClientConfig} from '@sanity/client'
2
+ import serialize from 'serialize-javascript';
3
+ const virtualModuleId = 'strife:store';
4
+ const resolvedVirtualModuleId = '\0' + virtualModuleId;
5
+ export function vitePluginStrifeStore(config) {
6
+ return {
7
+ name: 'strife:store',
8
+ resolveId(id) {
9
+ if (id === virtualModuleId) {
10
+ return resolvedVirtualModuleId;
11
+ }
12
+ },
13
+ load(id) {
14
+ if (id === resolvedVirtualModuleId) {
15
+ return `
16
+ import { DocumentStore } from "ravendb";
17
+
18
+ const authOptions = {
19
+ type: 'pfx',
20
+ certificate: Buffer.from(${serialize(config.certificate)}, 'base64'),
21
+ password: ${serialize(config.password)},
22
+ };
23
+
24
+ export const store = new DocumentStore(
25
+ ${serialize(config.urls ? config.urls : [])},
26
+ ${serialize(config.database || 'default')},
27
+ authOptions
28
+ ).initialize();
29
+ `;
30
+ }
31
+ },
32
+ };
33
+ }
package/package.json CHANGED
@@ -1,21 +1,35 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.0",
4
- "description": "An Astro integration for Strife",
3
+ "version": "1.0.2",
4
+ "description": "Official Strife Astro integration",
5
+ "keywords": [
6
+ "astro-integration",
7
+ "withastro",
8
+ "strife"
9
+ ],
5
10
  "main": "dist/index.js",
6
11
  "types": "dist/index.d.ts",
12
+ "type": "module",
7
13
  "scripts": {
8
- "astro:add": "node scripts/add.js",
9
14
  "build": "tsc"
10
15
  },
16
+ "exports": {
17
+ ".": "./dist/index.js",
18
+ "./vite-plugin-strife-store": "./dist/vite-plugin-strife-store.js"
19
+ },
11
20
  "files": [
12
- "dist",
13
- "scripts"
21
+ "dist"
14
22
  ],
15
23
  "dependencies": {
16
- "astro": "^5.3.0"
24
+ "astro": "^5.3.0",
25
+ "ravendb": "^6.0.0",
26
+ "serialize-javascript": "^6.0.2"
17
27
  },
18
28
  "devDependencies": {
19
29
  "typescript": "^5.7.3"
20
- }
30
+ },
31
+ "peerDependencies": {
32
+ "astro": "^4.0.0 || ^5.0.0",
33
+ "ravendb": "^6.0.0"
34
+ }
21
35
  }