@nuasite/nua 0.0.56 → 0.0.59
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 +47 -25
- package/package.json +10 -6
- package/src/config.ts +69 -0
- package/src/integration.ts +1 -1
- package/src/types.ts +3 -3
package/README.md
CHANGED
|
@@ -29,44 +29,66 @@ same toolchain will execute locally.
|
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Use the nua config wrapper for the simplest setup:
|
|
33
33
|
|
|
34
|
-
```
|
|
35
|
-
// astro.config.
|
|
36
|
-
import
|
|
37
|
-
import { defineConfig } from 'astro/config'
|
|
34
|
+
```ts
|
|
35
|
+
// astro.config.ts
|
|
36
|
+
import { defineConfig } from '@nuasite/nua/config'
|
|
38
37
|
|
|
39
|
-
export default defineConfig(
|
|
40
|
-
integrations: [nua()],
|
|
41
|
-
})
|
|
38
|
+
export default defineConfig()
|
|
42
39
|
```
|
|
43
40
|
|
|
44
|
-
This single
|
|
45
|
-
|
|
41
|
+
This single line gives you:
|
|
42
|
+
|
|
43
|
+
- Tailwind CSS 4 via `@tailwindcss/vite`
|
|
44
|
+
- MDX support via `@astrojs/mdx`
|
|
45
|
+
- Sitemap generation via `@astrojs/sitemap`
|
|
46
|
+
- CMS markers via `@nuasite/cms-marker`
|
|
47
|
+
- Page markdown output via `@nuasite/llm-enhancements`
|
|
48
|
+
- Sensible defaults: `site: 'http://localhost:4321'`, `vite.build.sourcemap: true`
|
|
46
49
|
|
|
47
50
|
### Configuration options
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
Pass standard Astro config options, plus a `nua` key for integration settings:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { defineConfig } from '@nuasite/nua/config'
|
|
50
56
|
|
|
51
|
-
```js
|
|
52
57
|
export default defineConfig({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
],
|
|
58
|
+
site: 'https://example.com',
|
|
59
|
+
nua: {
|
|
60
|
+
tailwindcss: true, // Enable/disable Tailwind CSS (default: true)
|
|
61
|
+
mdx: true, // Enable/disable MDX support (default: true)
|
|
62
|
+
sitemap: true, // Enable/disable sitemap generation (default: true)
|
|
63
|
+
cmsMarker: true, // Enable/disable CMS markers (default: true)
|
|
64
|
+
pageMarkdown: true, // Enable/disable page markdown output (default: true)
|
|
65
|
+
},
|
|
62
66
|
})
|
|
63
67
|
```
|
|
64
68
|
|
|
65
69
|
Pass `false` to disable a feature, or pass an options object to customize it:
|
|
66
70
|
|
|
67
|
-
```
|
|
68
|
-
nua
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
```ts
|
|
72
|
+
import { defineConfig } from '@nuasite/nua/config'
|
|
73
|
+
|
|
74
|
+
export default defineConfig({
|
|
75
|
+
nua: {
|
|
76
|
+
sitemap: { filter: (page) => !page.includes('/draft/') },
|
|
77
|
+
mdx: { remarkPlugins: [myRemarkPlugin] },
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Using the integration directly
|
|
83
|
+
|
|
84
|
+
If you prefer more control, import the integration separately:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
// astro.config.ts
|
|
88
|
+
import nua from '@nuasite/nua/integration'
|
|
89
|
+
import { defineConfig } from 'astro/config'
|
|
90
|
+
|
|
91
|
+
export default defineConfig({
|
|
92
|
+
integrations: [nua()],
|
|
71
93
|
})
|
|
72
94
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuasite/nua",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"types": "./src/index.ts",
|
|
11
11
|
"import": "./src/index.ts"
|
|
12
12
|
},
|
|
13
|
+
"./config": {
|
|
14
|
+
"types": "./src/config.ts",
|
|
15
|
+
"import": "./src/config.ts"
|
|
16
|
+
},
|
|
13
17
|
"./integration": {
|
|
14
18
|
"types": "./src/integration.ts",
|
|
15
19
|
"import": "./src/integration.ts"
|
|
@@ -35,11 +39,11 @@
|
|
|
35
39
|
"@astrojs/mdx": "4.3.8",
|
|
36
40
|
"@astrojs/rss": "4.0.13",
|
|
37
41
|
"@astrojs/sitemap": "3.6.0",
|
|
38
|
-
"@nuasite/
|
|
39
|
-
"@nuasite/cli": "0.0.
|
|
40
|
-
"@nuasite/cms-marker": "0.0.
|
|
41
|
-
"@nuasite/components": "0.0.
|
|
42
|
-
"@nuasite/core": "0.0.
|
|
42
|
+
"@nuasite/llm-enhancements": "0.0.59",
|
|
43
|
+
"@nuasite/cli": "0.0.59",
|
|
44
|
+
"@nuasite/cms-marker": "0.0.59",
|
|
45
|
+
"@nuasite/components": "0.0.59",
|
|
46
|
+
"@nuasite/core": "0.0.59",
|
|
43
47
|
"@tailwindcss/vite": "^4.1.11",
|
|
44
48
|
"astro": "^5.16.6",
|
|
45
49
|
"flowbite": "3.1.2",
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { defineConfig as astroDefineConfig } from 'astro/config'
|
|
2
|
+
import type { AstroUserConfig } from 'astro/config'
|
|
3
|
+
import nua from './integration'
|
|
4
|
+
import type { NuaIntegrationOptions } from './types'
|
|
5
|
+
|
|
6
|
+
export type { NuaIntegrationOptions } from './types'
|
|
7
|
+
|
|
8
|
+
export interface NuaConfig extends AstroUserConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Configure the nua integration options.
|
|
11
|
+
* Set to `false` to disable the nua integration entirely.
|
|
12
|
+
*/
|
|
13
|
+
nua?: NuaIntegrationOptions | false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Wrapper around Astro's `defineConfig` with nua integration pre-configured.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* // astro.config.ts
|
|
22
|
+
* import { defineConfig } from '@nuasite/nua/config'
|
|
23
|
+
*
|
|
24
|
+
* export default defineConfig({
|
|
25
|
+
* site: 'https://example.com',
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // With nua options
|
|
32
|
+
* import { defineConfig } from '@nuasite/nua/config'
|
|
33
|
+
*
|
|
34
|
+
* export default defineConfig({
|
|
35
|
+
* site: 'https://example.com',
|
|
36
|
+
* nua: {
|
|
37
|
+
* sitemap: false,
|
|
38
|
+
* tailwindcss: true,
|
|
39
|
+
* },
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function defineConfig(config: NuaConfig = {}) {
|
|
44
|
+
const { nua: nuaOptions, integrations = [], vite = {}, ...astroConfig } = config
|
|
45
|
+
|
|
46
|
+
const mergedVite = {
|
|
47
|
+
...vite,
|
|
48
|
+
build: {
|
|
49
|
+
sourcemap: true,
|
|
50
|
+
...vite.build,
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const defaults = {
|
|
55
|
+
site: 'http://localhost:4321',
|
|
56
|
+
vite: mergedVite,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// If nua is explicitly disabled, just pass through to Astro
|
|
60
|
+
if (nuaOptions === false) {
|
|
61
|
+
return astroDefineConfig({ ...defaults, ...astroConfig, integrations })
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return astroDefineConfig({
|
|
65
|
+
...defaults,
|
|
66
|
+
...astroConfig,
|
|
67
|
+
integrations: [nua(nuaOptions), ...integrations],
|
|
68
|
+
})
|
|
69
|
+
}
|
package/src/integration.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mdx from '@astrojs/mdx'
|
|
2
2
|
import sitemap from '@astrojs/sitemap'
|
|
3
3
|
import cmsMarker from '@nuasite/cms-marker'
|
|
4
|
-
import pageMarkdown from '
|
|
4
|
+
import pageMarkdown from '../../llm-enhancements/src'
|
|
5
5
|
import tailwindcss from '@tailwindcss/vite'
|
|
6
6
|
import type { AstroIntegration } from 'astro'
|
|
7
7
|
import { type NuaIntegrationOptions, resolveOptions } from './types'
|
package/src/types.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Options as MdxOptions } from '@astrojs/mdx'
|
|
2
2
|
import type { SitemapOptions } from '@astrojs/sitemap'
|
|
3
3
|
import type { CmsMarkerOptions } from '@nuasite/cms-marker'
|
|
4
|
-
import type { PageMarkdownOptions } from '
|
|
4
|
+
import type { PageMarkdownOptions } from '../../llm-enhancements/src'
|
|
5
5
|
|
|
6
6
|
export type { Options as MdxOptions } from '@astrojs/mdx'
|
|
7
7
|
export type { SitemapOptions } from '@astrojs/sitemap'
|
|
8
8
|
export type { CmsMarkerOptions } from '@nuasite/cms-marker'
|
|
9
|
-
export type { PageMarkdownOptions } from '
|
|
9
|
+
export type { PageMarkdownOptions } from '../../llm-enhancements/src'
|
|
10
10
|
|
|
11
11
|
export interface NuaIntegrationOptions {
|
|
12
12
|
/** Enable/disable or configure @nuasite/cms-marker (default: true) */
|
|
13
13
|
cmsMarker?: boolean | CmsMarkerOptions
|
|
14
|
-
/** Enable/disable or configure @nuasite/
|
|
14
|
+
/** Enable/disable or configure @nuasite/llm-enhancements (default: true) */
|
|
15
15
|
pageMarkdown?: boolean | PageMarkdownOptions
|
|
16
16
|
/** Enable/disable or configure @astrojs/mdx (default: true) */
|
|
17
17
|
mdx?: boolean | MdxOptions
|