@bookklik/senangstart-css 0.2.10 → 0.2.12
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/.agent/skills/add-utility/SKILL.md +65 -0
- package/.agent/workflows/add-utility.md +2 -0
- package/.agent/workflows/build.md +2 -0
- package/.agent/workflows/dev.md +2 -0
- package/AGENTS.md +30 -0
- package/dist/senangstart-css.js +362 -151
- package/dist/senangstart-css.min.js +175 -174
- package/dist/senangstart-tw.js +4 -4
- package/dist/senangstart-tw.min.js +1 -1
- package/docs/ms/reference/visual/ring-color.md +2 -2
- package/docs/ms/reference/visual/ring-offset.md +3 -3
- package/docs/ms/reference/visual/ring.md +5 -5
- package/docs/public/assets/senangstart-css.min.js +175 -174
- package/docs/public/llms.txt +10 -10
- package/docs/reference/visual/ring-color.md +2 -2
- package/docs/reference/visual/ring-offset.md +3 -3
- package/docs/reference/visual/ring.md +5 -5
- package/package.json +1 -1
- package/src/cdn/tw-conversion-engine.js +4 -4
- package/src/cli/commands/build.js +42 -14
- package/src/cli/commands/dev.js +157 -93
- package/src/compiler/generators/css.js +371 -199
- package/src/compiler/tokenizer.js +25 -23
- package/src/core/tokenizer-core.js +46 -19
- package/src/definitions/visual-borders.js +10 -10
- package/src/utils/common.js +456 -39
- package/src/utils/node-io.js +82 -0
- package/tests/integration/dev-recovery.test.js +231 -0
- package/tests/unit/cli/memory-limits.test.js +169 -0
- package/tests/unit/compiler/css-generation-error-handling.test.js +204 -0
- package/tests/unit/compiler/generators/css-errors.test.js +102 -0
- package/tests/unit/convert-tailwind.test.js +518 -442
- package/tests/unit/utils/common.test.js +376 -26
- package/tests/unit/utils/file-timeout.test.js +154 -0
- package/tests/unit/utils/theme-validation.test.js +181 -0
- package/tests/unit/compiler/generators/css.coverage.test.js +0 -833
- package/tests/unit/convert-tailwind.cli.test.js +0 -95
- package/tests/unit/security.test.js +0 -206
- /package/tests/unit/{convert-tailwind.coverage.test.js → convert-tailwind-edgecases.test.js} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SenangStart CSS - CSS Generator Robustness Tests
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it } from 'node:test';
|
|
6
|
+
import assert from 'node:assert';
|
|
7
|
+
import {
|
|
8
|
+
generateCSS,
|
|
9
|
+
generateCSSWithErrors
|
|
10
|
+
} from '../../../../src/compiler/generators/css.js';
|
|
11
|
+
import { createTestConfig } from '../../../helpers/test-utils.js';
|
|
12
|
+
|
|
13
|
+
describe('CSS Generator - Robustness', () => {
|
|
14
|
+
|
|
15
|
+
describe('generateCSSWithErrors', () => {
|
|
16
|
+
|
|
17
|
+
it('returns empty CSS and error for invalid config', () => {
|
|
18
|
+
const result = generateCSSWithErrors([], null);
|
|
19
|
+
assert.strictEqual(result.css, '');
|
|
20
|
+
assert.ok(result.errors.length > 0);
|
|
21
|
+
assert.strictEqual(result.errors[0].type, 'config');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns empty CSS and error for invalid tokens', () => {
|
|
25
|
+
const config = createTestConfig();
|
|
26
|
+
const result = generateCSSWithErrors(null, config);
|
|
27
|
+
assert.strictEqual(result.css, '');
|
|
28
|
+
assert.ok(result.errors.length > 0);
|
|
29
|
+
assert.strictEqual(result.errors[0].type, 'tokens');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('reports error for malformed token object', () => {
|
|
33
|
+
const config = createTestConfig();
|
|
34
|
+
const tokens = ['not-an-object'];
|
|
35
|
+
const result = generateCSSWithErrors(tokens, config);
|
|
36
|
+
|
|
37
|
+
assert.ok(result.errors.length > 0);
|
|
38
|
+
assert.strictEqual(result.errors[0].type, 'token_format');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('continues processing valid tokens after a malformed one', () => {
|
|
42
|
+
const config = createTestConfig();
|
|
43
|
+
const tokens = [
|
|
44
|
+
'invalid',
|
|
45
|
+
{ property: 'p', value: 'medium', attrType: 'space', raw: 'p:medium' }
|
|
46
|
+
];
|
|
47
|
+
const result = generateCSSWithErrors(tokens, config);
|
|
48
|
+
|
|
49
|
+
assert.ok(result.css.includes('padding: var(--s-medium)'));
|
|
50
|
+
assert.ok(result.errors.length > 0);
|
|
51
|
+
assert.strictEqual(result.errors[0].type, 'token_format');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('reports error when generateRule fails to return a rule', () => {
|
|
55
|
+
const config = createTestConfig();
|
|
56
|
+
const tokens = [
|
|
57
|
+
{ property: 'nonexistent', value: 'value', attrType: 'unknown', raw: 'unknown:value' }
|
|
58
|
+
];
|
|
59
|
+
const result = generateCSSWithErrors(tokens, config);
|
|
60
|
+
|
|
61
|
+
assert.ok(result.errors.length > 0);
|
|
62
|
+
assert.strictEqual(result.errors[0].type, 'rule_generation');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('handles exceptions in rule generation gracefully', () => {
|
|
66
|
+
const config = createTestConfig();
|
|
67
|
+
// Token that might cause issues if not handled
|
|
68
|
+
const tokens = [
|
|
69
|
+
{ property: null, value: null, attrType: 'layout', raw: 'bad' }
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const result = generateCSSWithErrors(tokens, config);
|
|
73
|
+
assert.ok(result.errors.length > 0);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('generateCSS (Backward Compatibility)', () => {
|
|
79
|
+
|
|
80
|
+
it('returns string even when errors occur', () => {
|
|
81
|
+
const config = createTestConfig();
|
|
82
|
+
const tokens = ['invalid'];
|
|
83
|
+
const css = generateCSS(tokens, config);
|
|
84
|
+
|
|
85
|
+
assert.strictEqual(typeof css, 'string');
|
|
86
|
+
// Should still contain variables if config is valid
|
|
87
|
+
assert.ok(css.includes(':root'));
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('generates valid CSS for valid tokens', () => {
|
|
91
|
+
const config = createTestConfig();
|
|
92
|
+
const tokens = [
|
|
93
|
+
{ property: 'flex', value: 'flex', attrType: 'layout', raw: 'flex' }
|
|
94
|
+
];
|
|
95
|
+
const css = generateCSS(tokens, config);
|
|
96
|
+
|
|
97
|
+
assert.ok(css.includes('display: flex'));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
});
|