|
| 1 | +import os from 'node:os' |
| 2 | +import path from 'node:path' |
| 3 | +import { candidate, css, html, json, test } from '../utils' |
| 4 | + |
| 5 | +const STANDALONE_BINARY = (() => { |
| 6 | + switch (os.platform()) { |
| 7 | + case 'win32': |
| 8 | + return 'tailwindcss-windows-x64.exe' |
| 9 | + case 'darwin': |
| 10 | + return os.arch() === 'x64' ? 'tailwindcss-macos-x64' : 'tailwindcss-macos-arm64' |
| 11 | + case 'linux': |
| 12 | + return os.arch() === 'x64' ? 'tailwindcss-linux-x64' : 'tailwindcss-linux-arm64' |
| 13 | + default: |
| 14 | + throw new Error(`Unsupported platform: ${os.platform()} ${os.arch()}`) |
| 15 | + } |
| 16 | +})() |
| 17 | + |
| 18 | +test( |
| 19 | + 'includes first-party plugins', |
| 20 | + { |
| 21 | + fs: { |
| 22 | + 'package.json': json` |
| 23 | + { |
| 24 | + "dependencies": { |
| 25 | + "tailwindcss": "workspace:^", |
| 26 | + "@tailwindcss/cli": "workspace:^" |
| 27 | + } |
| 28 | + } |
| 29 | + `, |
| 30 | + 'index.html': html` |
| 31 | + <div className="prose"> |
| 32 | + <h1>Headline</h1> |
| 33 | + </div> |
| 34 | + <input type="text" class="form-input" /> |
| 35 | + <div class="aspect-w-16"></div> |
| 36 | + `, |
| 37 | + 'src/index.css': css` |
| 38 | + @import 'tailwindcss/theme' theme(reference); |
| 39 | + @import 'tailwindcss/utilities'; |
| 40 | +
|
| 41 | + @plugin '@tailwindcss/forms'; |
| 42 | + @plugin '@tailwindcss/typography'; |
| 43 | + @plugin '@tailwindcss/aspect-ratio'; |
| 44 | + `, |
| 45 | + }, |
| 46 | + }, |
| 47 | + async ({ fs, exec }) => { |
| 48 | + await exec( |
| 49 | + `${path.resolve(__dirname, `../../packages/@tailwindcss-standalone/dist/${STANDALONE_BINARY}`)} --input src/index.css --output dist/out.css`, |
| 50 | + ) |
| 51 | + |
| 52 | + await fs.expectFileToContain('dist/out.css', [ |
| 53 | + candidate`form-input`, |
| 54 | + candidate`prose`, |
| 55 | + candidate`aspect-w-16`, |
| 56 | + ]) |
| 57 | + }, |
| 58 | +) |
0 commit comments