brisa-tailwindcss 0.1.6-canary.3 → 0.1.7-canary.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/index.d.ts CHANGED
@@ -19,4 +19,5 @@ export default function tailwindCSS(): {
19
19
  content: string;
20
20
  applyDefaultWhenEvery: (content: string) => boolean;
21
21
  };
22
+ afterBuild(brisaConstants: BrisaConstants): void | Promise<void>;
22
23
  };
package/index.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import tailwindcss from '@tailwindcss/postcss';
2
2
  import postcss from 'postcss';
3
+ import fs from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import libs from './libs.json';
3
6
 
4
7
  // Note: is not bundled here to avoid issues with lightningcss
5
8
  export default function brisaTailwindcss() {
@@ -20,5 +23,40 @@ export default function brisaTailwindcss() {
20
23
  `,
21
24
  applyDefaultWhenEvery: (content: string) => !content.includes('tailwind'),
22
25
  },
26
+ // Tailwind has a subdependency called lightwindcss, which cannot be included in the bundle
27
+ // https://github.com/parcel-bundler/lightningcss/issues/701
28
+ // then as a solution is to put it as "external" so the build works correctly. However, for the standalone
29
+ // build to continue being standalone, it needs this dependency along with all its subdependencies to
30
+ // work correctly. As a solution, we install tailwind in the build folder and in this way the problem is solved.
31
+ // Issue: https://github.com/brisa-build/brisa/issues/637
32
+ async afterBuild({ BUILD_DIR, LOG_PREFIX }) {
33
+ const start = Date.now();
34
+ const destNodeModules = path.join(BUILD_DIR, 'node_modules');
35
+ const nodeModules = Bun.resolveSync('brisa', BUILD_DIR).split('brisa')[0];
36
+
37
+ console.log(LOG_PREFIX.INFO, '');
38
+ console.log(
39
+ LOG_PREFIX.WAIT,
40
+ ' Embedding TailwindCSS in the build folder...',
41
+ );
42
+
43
+ await Promise.all(
44
+ libs.map(async (lib) => {
45
+ const from = path.join(nodeModules, lib);
46
+ const to = path.join(destNodeModules, lib);
47
+
48
+ if (await fs.exists(from)) {
49
+ return fs.cp(from, to, { recursive: true });
50
+ }
51
+ }),
52
+ );
53
+
54
+ const milliseconds = Date.now() - start;
55
+ console.log(
56
+ LOG_PREFIX.INFO,
57
+ LOG_PREFIX.TICK,
58
+ `TailwindCSS embedded in ${milliseconds}ms`,
59
+ );
60
+ },
23
61
  };
24
62
  }
package/libs.json ADDED
@@ -0,0 +1,25 @@
1
+ [
2
+ "lightningcss-darwin-x64",
3
+ "lightningcss-linux-x64-gnu",
4
+ "lightningcss-win32-x64-msvc",
5
+ "lightningcss-win32-arm64-msvc",
6
+ "lightningcss-darwin-arm64",
7
+ "lightningcss-linux-arm64-gnu",
8
+ "lightningcss-linux-arm-gnueabihf",
9
+ "lightningcss-linux-arm64-musl",
10
+ "lightningcss-linux-x64-musl",
11
+ "lightningcss-freebsd-x64",
12
+ "@alloc",
13
+ "tapable",
14
+ "jiti",
15
+ "detect-libc",
16
+ "nanoid",
17
+ "@tailwindcss",
18
+ "postcss",
19
+ "enhanced-resolve",
20
+ "picocolors",
21
+ "tailwindcss",
22
+ "graceful-fs",
23
+ "lightningcss",
24
+ "source-map-js"
25
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brisa-tailwindcss",
3
- "version": "0.1.6-canary.3",
3
+ "version": "0.1.7-canary.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -10,12 +10,15 @@
10
10
  "name": "Brisa Team",
11
11
  "email": "contact@brisa.build.com"
12
12
  },
13
+ "scripts": {
14
+ "libs-json": "bun run scripts/generate-json-deps.ts"
15
+ },
13
16
  "repository": {
14
17
  "type": "git",
15
18
  "url": "git+https://github.com/brisa-build/brisa.git",
16
19
  "directory": "packages/brisa-tailwindcss"
17
20
  },
18
- "files": ["index.ts", "index.d.ts"],
21
+ "files": ["index.ts", "index.d.ts", "libs.json"],
19
22
  "devDependencies": {
20
23
  "@tailwindcss/postcss": "4.0.0-alpha.33",
21
24
  "postcss": "8.4.49",