astro-cljs-plugin 0.0.1
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 +42 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +8022 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# astro-cljs-plugin
|
|
2
|
+
|
|
3
|
+
Zero-config ClojureScript integration for Astro.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
- **Zero Config**: Automatically discovers and exports components from your `.cljs` files. No manual `:exports` required in `shadow-cljs.edn`.
|
|
7
|
+
- **React-Powered**: Works seamlessly with [UIX](https://github.com/pitch-io/uix) and [Helix](https://github.com/lilactown/helix).
|
|
8
|
+
- **Bundled Engine**: Internally bundles and manages the [shadow-cljs-vite-plugin](https://github.com/sean/clj-astro/tree/main/packages/shadow-cljs-vite-plugin) for a unified experience.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
This integration **requires** the `@astrojs/react` plugin to be installed and configured in your Astro project to handle the underlying React rendering.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
```bash
|
|
15
|
+
npm install astro-cljs-plugin
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
Add the integration to your `astro.config.mjs`:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { defineConfig } from 'astro/config';
|
|
23
|
+
import react from '@astrojs/react';
|
|
24
|
+
import cljs from 'astro-cljs-plugin';
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
integrations: [
|
|
28
|
+
react(),
|
|
29
|
+
cljs({
|
|
30
|
+
buildIds: ['app']
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configuration Options
|
|
37
|
+
|
|
38
|
+
| Option | Type | Default | Description |
|
|
39
|
+
| :--- | :--- | :--- | :--- |
|
|
40
|
+
| `debug` | `boolean` | `false` | Enable verbose logging for the integration and Vite plugin. |
|
|
41
|
+
| `buildIds` | `string[]` | `['app']` | The shadow-cljs build IDs defined in your config to watch/build. |
|
|
42
|
+
| `configPath` | `string` | `'./shadow-cljs.edn'` | Path to your shadow-cljs configuration file. |
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AstroIntegration } from 'astro';
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
import { ShadowCljsOptions } from 'shadow-cljs-vite-plugin';
|
|
4
|
+
|
|
5
|
+
interface ClojurePluginOptions {
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
buildId?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Vite plugin to handle .cljs file imports
|
|
11
|
+
*/
|
|
12
|
+
declare function clojurePlugin(options?: ClojurePluginOptions): Plugin;
|
|
13
|
+
|
|
14
|
+
interface ClojureIntegrationOptions extends ClojurePluginOptions, Partial<ShadowCljsOptions> {
|
|
15
|
+
/**
|
|
16
|
+
* Enable debug logging
|
|
17
|
+
*/
|
|
18
|
+
debug?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Astro integration for ClojureScript support
|
|
22
|
+
*
|
|
23
|
+
* This works alongside shadow-cljs-vite-plugin:
|
|
24
|
+
* - shadow-cljs-vite-plugin manages shadow-cljs compilation and provides virtual modules
|
|
25
|
+
* - This plugin transforms .cljs imports into React wrappers that use those modules
|
|
26
|
+
*
|
|
27
|
+
* Prerequisites:
|
|
28
|
+
* - shadow-cljs.edn must have builds for SSR and client
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```astro
|
|
32
|
+
* ---
|
|
33
|
+
* import MyComponent from '../components/MyComponent.cljs';
|
|
34
|
+
* ---
|
|
35
|
+
*
|
|
36
|
+
* <MyComponent client:load />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function clojureIntegration(options?: ClojureIntegrationOptions): AstroIntegration;
|
|
40
|
+
|
|
41
|
+
export { type ClojureIntegrationOptions, type ClojurePluginOptions, clojurePlugin, clojureIntegration as default };
|