-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): fix tailwind external subdependencies during standalone b…
…uild (#638) * fix(build): fix tailwind external subdependencies during standalone build * test: restore mocks * feat: re-implement to improve build time * fix: resolve all lightningcss platforms
- Loading branch information
Showing
14 changed files
with
186 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ | |
"www:build": "bun run --cwd packages/www build", | ||
"www:dev": "bun run --cwd packages/www dev", | ||
"www:deploy": "bun run build && bun run www:build && vercel --prod", | ||
"prepare": "husky" | ||
"prepare": "husky && bun run packages/brisa-tailwindcss/scripts/generate-json-deps.ts" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[ | ||
"lightningcss-darwin-x64", | ||
"lightningcss-linux-x64-gnu", | ||
"lightningcss-win32-x64-msvc", | ||
"lightningcss-win32-arm64-msvc", | ||
"lightningcss-darwin-arm64", | ||
"lightningcss-linux-arm64-gnu", | ||
"lightningcss-linux-arm-gnueabihf", | ||
"lightningcss-linux-arm64-musl", | ||
"lightningcss-linux-x64-musl", | ||
"lightningcss-freebsd-x64", | ||
"@alloc", | ||
"tapable", | ||
"jiti", | ||
"detect-libc", | ||
"nanoid", | ||
"@tailwindcss", | ||
"postcss", | ||
"enhanced-resolve", | ||
"picocolors", | ||
"tailwindcss", | ||
"graceful-fs", | ||
"lightningcss", | ||
"source-map-js" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,15 @@ | |
"name": "Brisa Team", | ||
"email": "[email protected]" | ||
}, | ||
"scripts": { | ||
"libs-json": "bun run scripts/generate-json-deps.ts" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/brisa-build/brisa.git", | ||
"directory": "packages/brisa-tailwindcss" | ||
}, | ||
"files": ["index.ts", "index.d.ts"], | ||
"files": ["index.ts", "index.d.ts", "libs.json"], | ||
"devDependencies": { | ||
"@tailwindcss/postcss": "4.0.0-alpha.33", | ||
"postcss": "8.4.49", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import packageJSON from '../package.json'; | ||
|
||
const TAILWIND_VERSION = packageJSON.devDependencies.tailwindcss; | ||
const tempDir = path.join(import.meta.dirname, 'temp'); | ||
|
||
fs.mkdirSync(tempDir); | ||
fs.writeFileSync( | ||
path.join(tempDir, 'package.json'), | ||
JSON.stringify({ | ||
dependencies: { | ||
tailwindcss: TAILWIND_VERSION, | ||
'@tailwindcss/postcss': TAILWIND_VERSION, | ||
}, | ||
}), | ||
); | ||
|
||
await Bun.$`cd ${tempDir} && bun i`.quiet(); | ||
|
||
const nodeModules = path.join(tempDir, 'node_modules'); | ||
const lightningcssPackage = JSON.parse( | ||
fs.readFileSync( | ||
path.join(nodeModules, 'lightningcss', 'package.json'), | ||
'utf-8', | ||
), | ||
); | ||
const libs = new Set(Object.keys(lightningcssPackage.optionalDependencies)); | ||
|
||
for (const lib of fs.readdirSync(nodeModules)) { | ||
if (lib.startsWith('.')) continue; | ||
libs.add(lib); | ||
} | ||
|
||
fs.writeFileSync( | ||
path.join(import.meta.dirname, '..', 'libs.json'), | ||
JSON.stringify([...libs]), | ||
); | ||
fs.rmSync(tempDir, { recursive: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters