@nuasite/nua 0.2.2 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/integration.ts +22 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuasite/nua",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "module": "src/index.ts",
@@ -39,11 +39,11 @@
39
39
  "@astrojs/mdx": "4.3.8",
40
40
  "@astrojs/rss": "4.0.13",
41
41
  "@astrojs/sitemap": "3.6.0",
42
- "@nuasite/llm-enhancements": "0.2.2",
43
- "@nuasite/cli": "0.2.2",
44
- "@nuasite/cms": "0.2.2",
45
- "@nuasite/components": "0.2.2",
46
- "@nuasite/core": "0.2.2",
42
+ "@nuasite/llm-enhancements": "0.3.0",
43
+ "@nuasite/cli": "0.3.0",
44
+ "@nuasite/cms": "0.3.0",
45
+ "@nuasite/components": "0.3.0",
46
+ "@nuasite/core": "0.3.0",
47
47
  "@tailwindcss/vite": "^4.1.11",
48
48
  "@tailwindcss/typography": "^0.5.19",
49
49
  "astro": "^5.16.6",
@@ -12,7 +12,7 @@ export default function nua(options: NuaIntegrationOptions = {}): AstroIntegrati
12
12
  return {
13
13
  name: '@nuasite/nua',
14
14
  hooks: {
15
- 'astro:config:setup': ({ updateConfig, logger }) => {
15
+ 'astro:config:setup': ({ updateConfig, command, injectScript, logger }) => {
16
16
  const integrations: AstroIntegration[] = []
17
17
  const vitePlugins = []
18
18
 
@@ -44,6 +44,27 @@ export default function nua(options: NuaIntegrationOptions = {}): AstroIntegrati
44
44
  logger.info('Sitemap enabled')
45
45
  }
46
46
 
47
+ // Hide Astro's dev toolbar in dev mode.
48
+ // We cannot set devToolbar.enabled = false because Astro ties
49
+ // source file annotations (data-astro-source-file) to that flag,
50
+ // and the CMS needs those annotations to map elements to source files.
51
+ if (command === 'dev') {
52
+ injectScript(
53
+ 'page',
54
+ `
55
+ const tb = document.querySelector('astro-dev-toolbar');
56
+ if (tb) tb.style.display = 'none';
57
+ else {
58
+ const o = new MutationObserver((_, obs) => {
59
+ const el = document.querySelector('astro-dev-toolbar');
60
+ if (el) { el.style.display = 'none'; obs.disconnect(); }
61
+ });
62
+ o.observe(document.documentElement, { childList: true, subtree: true });
63
+ }
64
+ `,
65
+ )
66
+ }
67
+
47
68
  // Inject Vite plugins and integrations
48
69
  updateConfig({
49
70
  vite: {