@webmate-studio/builder 0.1.4 → 0.1.6
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/package.json +3 -2
- package/src/tailwind-generator-v4.js +24 -18
- package/src/tailwind-generator.js +25 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webmate-studio/builder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Webmate Studio Component Builder",
|
|
6
6
|
"keywords": [
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"@tailwindcss/cli": "^4.1.0",
|
|
28
|
+
"@webmate-studio/builder": "^0.1.5",
|
|
27
29
|
"@webmate-studio/core": "^0.1.0",
|
|
28
30
|
"@webmate-studio/parser": "^0.1.0",
|
|
29
31
|
"alpinejs": "^3.15.0",
|
|
@@ -38,7 +40,6 @@
|
|
|
38
40
|
"react-dom": "^19.2.0",
|
|
39
41
|
"svelte": "^5.41.2",
|
|
40
42
|
"tailwindcss": "^4.1.0",
|
|
41
|
-
"@tailwindcss/cli": "^4.1.0",
|
|
42
43
|
"vue": "^3.5.22"
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -16,25 +16,31 @@ const execAsync = promisify(exec);
|
|
|
16
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
17
|
const __dirname = dirname(__filename);
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// Import createRequire for resolving packages
|
|
20
20
|
import { createRequire } from 'module';
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Get tailwindcss CLI path for execution
|
|
25
|
+
* @returns {string} Path to tailwindcss CLI
|
|
26
|
+
*/
|
|
27
|
+
function getTailwindCommand() {
|
|
28
|
+
try {
|
|
29
|
+
// Try to resolve @tailwindcss/cli package which contains the actual binary
|
|
30
|
+
const cliPath = require.resolve('@tailwindcss/cli');
|
|
31
|
+
return cliPath;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
// Fallback: try to find tailwindcss package and use its CLI
|
|
34
|
+
try {
|
|
35
|
+
const tailwindPackagePath = require.resolve('tailwindcss/package.json');
|
|
36
|
+
const tailwindDir = dirname(tailwindPackagePath);
|
|
37
|
+
// Tailwind v4 uses @tailwindcss/cli
|
|
38
|
+
const cliPath = join(tailwindDir, '..', '@tailwindcss', 'cli', 'dist', 'index.js');
|
|
39
|
+
return cliPath;
|
|
40
|
+
} catch (e2) {
|
|
41
|
+
throw new Error('Could not find @tailwindcss/cli. Please install it: npm install @tailwindcss/cli');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
/**
|
|
@@ -277,8 +283,8 @@ ${themeCSS}
|
|
|
277
283
|
|
|
278
284
|
// Run Tailwind v4 CLI
|
|
279
285
|
// Tailwind v4 auto-detects HTML files in the same directory
|
|
280
|
-
const
|
|
281
|
-
|
|
286
|
+
const tailwindCliPath = getTailwindCommand();
|
|
287
|
+
const command = `node "${tailwindCliPath}" -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
282
288
|
|
|
283
289
|
// Set NODE_PATH so tailwindcss module can be resolved
|
|
284
290
|
const builderNodeModules = join(__dirname, "..", "node_modules");
|
|
@@ -16,25 +16,31 @@ const execAsync = promisify(exec);
|
|
|
16
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
17
|
const __dirname = dirname(__filename);
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// Import createRequire for resolving packages
|
|
20
20
|
import { createRequire } from 'module';
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Get tailwindcss CLI path for execution
|
|
25
|
+
* @returns {string} Path to tailwindcss CLI
|
|
26
|
+
*/
|
|
27
|
+
function getTailwindCommand() {
|
|
28
|
+
try {
|
|
29
|
+
// Try to resolve @tailwindcss/cli package which contains the actual binary
|
|
30
|
+
const cliPath = require.resolve('@tailwindcss/cli');
|
|
31
|
+
return cliPath;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
// Fallback: try to find tailwindcss package and use its CLI
|
|
34
|
+
try {
|
|
35
|
+
const tailwindPackagePath = require.resolve('tailwindcss/package.json');
|
|
36
|
+
const tailwindDir = dirname(tailwindPackagePath);
|
|
37
|
+
// Tailwind v4 uses @tailwindcss/cli
|
|
38
|
+
const cliPath = join(tailwindDir, '..', '@tailwindcss', 'cli', 'dist', 'index.js');
|
|
39
|
+
return cliPath;
|
|
40
|
+
} catch (e2) {
|
|
41
|
+
throw new Error('Could not find @tailwindcss/cli. Please install it: npm install @tailwindcss/cli');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
/**
|
|
@@ -255,8 +261,9 @@ export async function generateTailwindCSS(classes, options = {}) {
|
|
|
255
261
|
const dummyHTML = `<div class="${classArray.join(' ')}"></div>`;
|
|
256
262
|
writeFileSync(htmlPath, dummyHTML);
|
|
257
263
|
|
|
258
|
-
// Run Tailwind CLI
|
|
259
|
-
const
|
|
264
|
+
// Run Tailwind CLI
|
|
265
|
+
const tailwindCliPath = getTailwindCommand();
|
|
266
|
+
const command = `node "${tailwindCliPath}" -c "${configPath}" -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
260
267
|
|
|
261
268
|
const { stdout } = await execAsync(command, {
|
|
262
269
|
maxBuffer: 10 * 1024 * 1024 // 10MB buffer
|