@dynect/base 0.13.0 → 0.13.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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/module.ts +20 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynect/base",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Reusable Nuxt base module — components, composables, utils, plugins and i18n from the Dynect design system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -81,8 +81,11 @@
81
81
  "reka-ui": "^2.9.7",
82
82
  "shadcn-nuxt": "^2.6.2",
83
83
  "signature_pad": "^5.1.3",
84
+ "@tailwindcss/vite": "^4.3.0",
84
85
  "tailwind-merge": "^3.5.0",
86
+ "tailwindcss": "^4.3.0",
85
87
  "tailwindcss-animate": "^1.0.7",
88
+ "tw-animate-css": "^1.4.0",
86
89
  "vaul-vue": "^0.4.1",
87
90
  "vee-validate": "^4.15.1",
88
91
  "vue-echarts": "^8.0.1",
@@ -97,10 +100,7 @@
97
100
  "@iconify-json/heroicons": "^1.2.3",
98
101
  "@iconify-json/lucide": "^1.2.106",
99
102
  "@iconify-json/mdi": "^1.2.3",
100
- "@tailwindcss/vite": "^4.3.0",
101
103
  "@types/node": "^25.6.2",
102
- "tailwindcss": "^4.3.0",
103
- "tw-animate-css": "^1.4.0",
104
104
  "typescript": "^6.0.3"
105
105
  }
106
106
  }
package/src/module.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { addComponentsDir, addImports, addImportsDir, addPlugin, createResolver, defineNuxtModule, installModule } from '@nuxt/kit';
2
+ import tailwindcss from '@tailwindcss/vite';
3
+ import { defu } from 'defu';
2
4
  import { existsSync } from 'node:fs';
3
5
  import { join } from 'node:path';
4
6
 
@@ -24,6 +26,8 @@ export interface DynectBaseOptions {
24
26
  /** Enable SSR width plugin. Default: true */
25
27
  ssrWidth?: boolean;
26
28
  };
29
+ /** Auto-register @tailwindcss/vite Vite plugin. Set false to disable (e.g. if already configured in nuxt.config). Default: true */
30
+ tailwind?: boolean;
27
31
  }
28
32
 
29
33
  const DIR_CONFIGS: Record<string, { prefix: string }> = {
@@ -42,6 +46,7 @@ export default defineNuxtModule<DynectBaseOptions>({
42
46
  defaults: {
43
47
  dirs: ['dynect', 'ui', 'base', 'chart'],
44
48
  global: true,
49
+ tailwind: true,
45
50
  veeValidate: {},
46
51
  colorMode: {},
47
52
  i18n: {},
@@ -108,6 +113,21 @@ export default defineNuxtModule<DynectBaseOptions>({
108
113
  });
109
114
  }
110
115
 
116
+ // ── Tailwind CSS v4 ──────────────────────────────────────────────────────
117
+ // Add @tailwindcss/vite plugin unless disabled or already present.
118
+ // "Already present" check: look for any plugin named @tailwindcss/vite:*
119
+ // so we don't double-process if the consuming app added it manually.
120
+ if (options.tailwind !== false) {
121
+ nuxt.hook('vite:extendConfig', (config) => {
122
+ const c = config as any;
123
+ const flat = ([...(c.plugins ?? [])]).flat().filter(Boolean) as { name?: string }[];
124
+ const alreadyAdded = flat.some((p) => typeof p.name === 'string' && p.name.startsWith('@tailwindcss/vite'));
125
+ if (!alreadyAdded) {
126
+ c.plugins = [...(c.plugins ?? []), tailwindcss()];
127
+ }
128
+ });
129
+ }
130
+
111
131
  // ── Install required Nuxt modules ────────────────────────────────────────
112
132
  if (options.shadcn !== false) {
113
133
  const shadcnComponentDir = isStandalone ? join(runtimeComponentsDir, 'ui') : '~/components/ui';