@cwcss/crosswind 0.1.5 → 0.2.0

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 (87) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +52 -0
  3. package/dist/bin/cli.js +14615 -0
  4. package/dist/build.d.ts +24 -0
  5. package/dist/config.d.ts +5 -0
  6. package/dist/generator.d.ts +31 -0
  7. package/dist/index.d.ts +10 -0
  8. package/dist/parser.d.ts +42 -0
  9. package/dist/plugin.d.ts +22 -0
  10. package/dist/preflight-forms.d.ts +5 -0
  11. package/dist/preflight.d.ts +2 -0
  12. package/dist/rules-advanced.d.ts +27 -0
  13. package/dist/rules-effects.d.ts +25 -0
  14. package/dist/rules-forms.d.ts +7 -0
  15. package/dist/rules-grid.d.ts +13 -0
  16. package/dist/rules-interactivity.d.ts +41 -0
  17. package/dist/rules-layout.d.ts +26 -0
  18. package/dist/rules-transforms.d.ts +33 -0
  19. package/dist/rules-typography.d.ts +41 -0
  20. package/dist/rules.d.ts +39 -0
  21. package/dist/scanner.d.ts +18 -0
  22. package/dist/src/index.js +12848 -0
  23. package/dist/transformer-compile-class.d.ts +37 -0
  24. package/{src/types.ts → dist/types.d.ts} +17 -86
  25. package/package.json +2 -16
  26. package/PLUGIN.md +0 -235
  27. package/benchmark/framework-comparison.bench.ts +0 -850
  28. package/bin/cli.ts +0 -365
  29. package/bin/crosswind +0 -0
  30. package/bin/headwind +0 -0
  31. package/build.ts +0 -8
  32. package/crosswind.config.ts +0 -9
  33. package/example/comprehensive.html +0 -70
  34. package/example/index.html +0 -21
  35. package/example/output.css +0 -236
  36. package/examples/plugin/README.md +0 -112
  37. package/examples/plugin/build.ts +0 -32
  38. package/examples/plugin/src/index.html +0 -34
  39. package/examples/plugin/src/index.ts +0 -7
  40. package/headwind +0 -2
  41. package/src/build.ts +0 -101
  42. package/src/config.ts +0 -529
  43. package/src/generator.ts +0 -2173
  44. package/src/index.ts +0 -10
  45. package/src/parser.ts +0 -1471
  46. package/src/plugin.ts +0 -118
  47. package/src/preflight-forms.ts +0 -229
  48. package/src/preflight.ts +0 -388
  49. package/src/rules-advanced.ts +0 -477
  50. package/src/rules-effects.ts +0 -461
  51. package/src/rules-forms.ts +0 -103
  52. package/src/rules-grid.ts +0 -241
  53. package/src/rules-interactivity.ts +0 -525
  54. package/src/rules-layout.ts +0 -385
  55. package/src/rules-transforms.ts +0 -412
  56. package/src/rules-typography.ts +0 -486
  57. package/src/rules.ts +0 -809
  58. package/src/scanner.ts +0 -84
  59. package/src/transformer-compile-class.ts +0 -275
  60. package/test/advanced-features.test.ts +0 -911
  61. package/test/arbitrary.test.ts +0 -396
  62. package/test/attributify.test.ts +0 -592
  63. package/test/bracket-syntax.test.ts +0 -1133
  64. package/test/build.test.ts +0 -99
  65. package/test/colors.test.ts +0 -934
  66. package/test/flexbox.test.ts +0 -669
  67. package/test/generator.test.ts +0 -597
  68. package/test/grid.test.ts +0 -584
  69. package/test/layout.test.ts +0 -404
  70. package/test/modifiers.test.ts +0 -417
  71. package/test/parser.test.ts +0 -564
  72. package/test/performance-regression.test.ts +0 -376
  73. package/test/performance.test.ts +0 -568
  74. package/test/plugin.test.ts +0 -160
  75. package/test/scanner.test.ts +0 -94
  76. package/test/sizing.test.ts +0 -481
  77. package/test/spacing.test.ts +0 -394
  78. package/test/transformer-compile-class.test.ts +0 -287
  79. package/test/transforms.test.ts +0 -448
  80. package/test/typography.test.ts +0 -632
  81. package/test/variants-form-states.test.ts +0 -225
  82. package/test/variants-group-peer.test.ts +0 -66
  83. package/test/variants-media.test.ts +0 -213
  84. package/test/variants-positional.test.ts +0 -58
  85. package/test/variants-pseudo-elements.test.ts +0 -47
  86. package/test/variants-state.test.ts +0 -62
  87. package/tsconfig.json +0 -18
@@ -1,99 +0,0 @@
1
- import { afterAll, beforeAll, describe, expect, it } from 'bun:test'
2
- import { mkdir, rm, writeFile } from 'node:fs/promises'
3
- import { join } from 'node:path'
4
- import { build, buildAndWrite } from '../src/build'
5
- import { defaultConfig } from '../src/config'
6
-
7
- const TEST_DIR = join(import.meta.dir, '.build-test')
8
-
9
- describe('build', () => {
10
- beforeAll(async () => {
11
- await mkdir(TEST_DIR, { recursive: true })
12
-
13
- await writeFile(
14
- join(TEST_DIR, 'test.html'),
15
- '<div class="flex p-4 m-2 bg-gray-500 text-white hover:bg-gray-600"></div>',
16
- )
17
- })
18
-
19
- afterAll(async () => {
20
- await rm(TEST_DIR, { recursive: true, force: true })
21
- })
22
-
23
- it('should build CSS from files', async () => {
24
- const config = {
25
- ...defaultConfig,
26
- content: [join(TEST_DIR, '*.html')],
27
- minify: false,
28
- }
29
-
30
- const result = await build(config)
31
-
32
- expect(result.css).toContain('.flex')
33
- expect(result.css).toContain('display: flex;')
34
- expect(result.css).toContain('.p-4')
35
- expect(result.css).toContain('padding: 1rem;')
36
- expect(result.css).toContain('.m-2')
37
- expect(result.css).toContain('margin: 0.5rem;')
38
- expect(result.css).toContain('.bg-gray-500')
39
- expect(result.css).toContain('background-color: oklch(55.1% 0.027 264.364);')
40
- expect(result.css).toContain('.text-white')
41
- expect(result.css).toContain('color: #fff;')
42
- expect(result.classes.size).toBeGreaterThan(0)
43
- expect(result.duration).toBeGreaterThan(0)
44
- })
45
-
46
- it('should include hover variants', async () => {
47
- const config = {
48
- ...defaultConfig,
49
- content: [join(TEST_DIR, '*.html')],
50
- minify: false,
51
- }
52
-
53
- const result = await build(config)
54
- expect(result.css).toContain(':hover')
55
- })
56
-
57
- it('should minify CSS when enabled', async () => {
58
- const config = {
59
- ...defaultConfig,
60
- content: [join(TEST_DIR, '*.html')],
61
- minify: true,
62
- }
63
-
64
- const result = await build(config)
65
- expect(result.css).not.toContain('\n ')
66
- expect(result.css).toContain('.flex{display:flex}')
67
- })
68
-
69
- it('should include safelist classes', async () => {
70
- const config = {
71
- ...defaultConfig,
72
- content: [join(TEST_DIR, '*.html')],
73
- safelist: ['container', 'hidden'],
74
- minify: false,
75
- }
76
-
77
- const result = await build(config)
78
- expect(result.css).toContain('.hidden')
79
- expect(result.classes.has('container')).toBe(true)
80
- expect(result.classes.has('hidden')).toBe(true)
81
- })
82
-
83
- it('should write CSS to file', async () => {
84
- const outputPath = join(TEST_DIR, 'output.css')
85
- const config = {
86
- ...defaultConfig,
87
- content: [join(TEST_DIR, '*.html')],
88
- output: outputPath,
89
- minify: false,
90
- }
91
-
92
- const result = await buildAndWrite(config)
93
- const file = Bun.file(outputPath)
94
- const content = await file.text()
95
-
96
- expect(content).toBe(result.css)
97
- expect(content).toContain('.flex')
98
- })
99
- })