@jesscss/plugin-less-compat 2.0.0-alpha.5 → 2.0.0-alpha.7
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/README.md +3 -2
- package/lib/index.cjs +844 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +800 -9
- package/lib/less-adapter.cjs +216 -0
- package/lib/less-adapter.js +181 -0
- package/lib/less-compat-structures.cjs +378 -0
- package/lib/less-compat-structures.d.ts +2 -2
- package/lib/less-compat-structures.js +367 -512
- package/lib/nodes/at-rule.d.ts +2 -6
- package/lib/nodes/attribute-selector.d.ts +2 -6
- package/lib/nodes/call.d.ts +2 -6
- package/lib/nodes/color.d.ts +1 -5
- package/lib/nodes/combinator.d.ts +1 -5
- package/lib/nodes/comment.d.ts +1 -5
- package/lib/nodes/condition.d.ts +2 -6
- package/lib/nodes/declaration.d.ts +2 -6
- package/lib/nodes/dimension.d.ts +1 -5
- package/lib/nodes/expression.d.ts +2 -6
- package/lib/nodes/extend.d.ts +1 -5
- package/lib/nodes/import.d.ts +2 -6
- package/lib/nodes/keyword.d.ts +1 -5
- package/lib/nodes/list.d.ts +2 -5
- package/lib/nodes/mixin.d.ts +2 -6
- package/lib/nodes/negative.d.ts +2 -6
- package/lib/nodes/operation.d.ts +2 -6
- package/lib/nodes/paren.d.ts +2 -6
- package/lib/nodes/quoted.d.ts +1 -5
- package/lib/nodes/reference.d.ts +1 -8
- package/lib/nodes/ruleset.d.ts +2 -6
- package/lib/nodes/selector.d.ts +2 -7
- package/lib/nodes/sequence.d.ts +2 -9
- package/lib/nodes/url.d.ts +1 -5
- package/lib/nodes/var-declaration.d.ts +2 -6
- package/lib/plugin.d.ts +44 -16
- package/lib/transform/adapter.d.ts +31 -0
- package/lib/transform/index.cjs +13 -0
- package/lib/transform/index.d.ts +1 -1
- package/lib/transform/index.js +3 -8
- package/lib/transform/less-adapter.d.ts +29 -0
- package/lib/transform.cjs +1045 -0
- package/lib/transform.js +1015 -0
- package/lib/types.d.ts +153 -28
- package/package.json +13 -12
- package/lib/index.js.map +0 -1
- package/lib/less-compat-structures.js.map +0 -1
- package/lib/nodes/at-rule.js +0 -72
- package/lib/nodes/at-rule.js.map +0 -1
- package/lib/nodes/attribute-selector.js +0 -54
- package/lib/nodes/attribute-selector.js.map +0 -1
- package/lib/nodes/call.js +0 -83
- package/lib/nodes/call.js.map +0 -1
- package/lib/nodes/color.js +0 -57
- package/lib/nodes/color.js.map +0 -1
- package/lib/nodes/combinator.js +0 -34
- package/lib/nodes/combinator.js.map +0 -1
- package/lib/nodes/comment.js +0 -41
- package/lib/nodes/comment.js.map +0 -1
- package/lib/nodes/condition.js +0 -60
- package/lib/nodes/condition.js.map +0 -1
- package/lib/nodes/declaration.js +0 -81
- package/lib/nodes/declaration.js.map +0 -1
- package/lib/nodes/dimension.js +0 -47
- package/lib/nodes/dimension.js.map +0 -1
- package/lib/nodes/expression.js +0 -44
- package/lib/nodes/expression.js.map +0 -1
- package/lib/nodes/extend.js +0 -57
- package/lib/nodes/extend.js.map +0 -1
- package/lib/nodes/import.js +0 -63
- package/lib/nodes/import.js.map +0 -1
- package/lib/nodes/index.js +0 -308
- package/lib/nodes/index.js.map +0 -1
- package/lib/nodes/keyword.js +0 -36
- package/lib/nodes/keyword.js.map +0 -1
- package/lib/nodes/list.js +0 -150
- package/lib/nodes/list.js.map +0 -1
- package/lib/nodes/mixin.js +0 -62
- package/lib/nodes/mixin.js.map +0 -1
- package/lib/nodes/negative.js +0 -42
- package/lib/nodes/negative.js.map +0 -1
- package/lib/nodes/operation.js +0 -63
- package/lib/nodes/operation.js.map +0 -1
- package/lib/nodes/paren.js +0 -42
- package/lib/nodes/paren.js.map +0 -1
- package/lib/nodes/quoted.js +0 -57
- package/lib/nodes/quoted.js.map +0 -1
- package/lib/nodes/reference.js +0 -80
- package/lib/nodes/reference.js.map +0 -1
- package/lib/nodes/ruleset.js +0 -108
- package/lib/nodes/ruleset.js.map +0 -1
- package/lib/nodes/selector.js +0 -226
- package/lib/nodes/selector.js.map +0 -1
- package/lib/nodes/sequence.js +0 -75
- package/lib/nodes/sequence.js.map +0 -1
- package/lib/nodes/url.js +0 -42
- package/lib/nodes/url.js.map +0 -1
- package/lib/nodes/var-declaration.js +0 -60
- package/lib/nodes/var-declaration.js.map +0 -1
- package/lib/plugin-utils.js +0 -100
- package/lib/plugin-utils.js.map +0 -1
- package/lib/plugin.js +0 -1027
- package/lib/plugin.js.map +0 -1
- package/lib/transform/from-less.js +0 -170
- package/lib/transform/from-less.js.map +0 -1
- package/lib/transform/index.js.map +0 -1
- package/lib/transform/proxy.d.ts +0 -32
- package/lib/transform/proxy.js +0 -138
- package/lib/transform/proxy.js.map +0 -1
- package/lib/transform/to-less.js +0 -128
- package/lib/transform/to-less.js.map +0 -1
- package/lib/transform/type-map.js +0 -105
- package/lib/transform/type-map.js.map +0 -1
- package/lib/types.js +0 -5
- package/lib/types.js.map +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type mapping utilities for converting between Jess and Less node types
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Map Jess node types to Less node types
|
|
6
|
-
*
|
|
7
|
-
* @param jessType - The Jess node type
|
|
8
|
-
* @returns The corresponding Less node type
|
|
9
|
-
*/
|
|
10
|
-
export function mapJessTypeToLessType(jessType) {
|
|
11
|
-
const typeMap = {
|
|
12
|
-
Ruleset: 'Ruleset',
|
|
13
|
-
Declaration: 'Declaration',
|
|
14
|
-
SelectorList: 'Selector',
|
|
15
|
-
ComplexSelector: 'Selector',
|
|
16
|
-
CompoundSelector: 'Selector',
|
|
17
|
-
BasicSelector: 'Element', // Note: Less's Element includes combinator
|
|
18
|
-
Combinator: 'Combinator',
|
|
19
|
-
AttributeSelector: 'Attribute',
|
|
20
|
-
Dimension: 'Dimension',
|
|
21
|
-
Num: 'Dimension',
|
|
22
|
-
Reference: 'Variable', // Default, but can be Variable/Property/VariableCall
|
|
23
|
-
Mixin: 'MixinDefinition',
|
|
24
|
-
Call: 'Call',
|
|
25
|
-
Operation: 'Operation',
|
|
26
|
-
Expression: 'Expression',
|
|
27
|
-
Sequence: 'Expression',
|
|
28
|
-
Quoted: 'Quoted',
|
|
29
|
-
Url: 'URL',
|
|
30
|
-
Color: 'Color',
|
|
31
|
-
Comment: 'Comment',
|
|
32
|
-
AtRule: 'AtRule',
|
|
33
|
-
StyleImport: 'Import',
|
|
34
|
-
Extend: 'Extend',
|
|
35
|
-
Condition: 'Condition',
|
|
36
|
-
Paren: 'Paren',
|
|
37
|
-
Negative: 'Negative',
|
|
38
|
-
List: 'Value',
|
|
39
|
-
VarDeclaration: 'Assignment',
|
|
40
|
-
Keyword: 'Keyword'
|
|
41
|
-
};
|
|
42
|
-
return typeMap[jessType] || jessType;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Map Less node types to Jess node types
|
|
46
|
-
*
|
|
47
|
-
* @param lessType - The Less node type
|
|
48
|
-
* @returns The corresponding Jess node type
|
|
49
|
-
*/
|
|
50
|
-
export function mapLessTypeToJessType(lessType) {
|
|
51
|
-
const typeMap = {
|
|
52
|
-
Ruleset: 'Ruleset',
|
|
53
|
-
Declaration: 'Declaration',
|
|
54
|
-
Selector: 'SelectorList', // Less Selector → Jess SelectorList
|
|
55
|
-
Element: 'BasicSelector', // Note: Less Element includes combinator
|
|
56
|
-
Combinator: 'Combinator',
|
|
57
|
-
Attribute: 'AttributeSelector',
|
|
58
|
-
Dimension: 'Dimension',
|
|
59
|
-
Variable: 'Reference',
|
|
60
|
-
Property: 'Reference',
|
|
61
|
-
VariableCall: 'Reference',
|
|
62
|
-
MixinDefinition: 'Mixin',
|
|
63
|
-
MixinCall: 'Call',
|
|
64
|
-
Call: 'Call',
|
|
65
|
-
Operation: 'Operation',
|
|
66
|
-
Expression: 'Expression',
|
|
67
|
-
Quoted: 'Quoted',
|
|
68
|
-
URL: 'Url',
|
|
69
|
-
Color: 'Color',
|
|
70
|
-
Comment: 'Comment',
|
|
71
|
-
AtRule: 'AtRule',
|
|
72
|
-
// Less.js v2 used "Directive" - map to AtRule for compatibility
|
|
73
|
-
Directive: 'AtRule',
|
|
74
|
-
// Less.js v2 used "Rule" - map to Declaration for compatibility
|
|
75
|
-
Rule: 'Declaration',
|
|
76
|
-
Import: 'StyleImport',
|
|
77
|
-
Extend: 'Extend',
|
|
78
|
-
Condition: 'Condition',
|
|
79
|
-
Paren: 'Paren',
|
|
80
|
-
Negative: 'Negative',
|
|
81
|
-
Value: 'List',
|
|
82
|
-
Assignment: 'VarDeclaration',
|
|
83
|
-
Keyword: 'Keyword'
|
|
84
|
-
};
|
|
85
|
-
return typeMap[lessType] || lessType;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get Less typeIndex for a Jess node type
|
|
89
|
-
*
|
|
90
|
-
* Less.js uses typeIndex for visitor caching. This function
|
|
91
|
-
* maps Jess types to their corresponding Less typeIndex values.
|
|
92
|
-
*
|
|
93
|
-
* @param jessType - The Jess node type
|
|
94
|
-
* @returns The Less typeIndex, or undefined if not found
|
|
95
|
-
*/
|
|
96
|
-
export function getLessTypeIndex(_jessType) {
|
|
97
|
-
// Less.js assigns typeIndex dynamically, so we'll need to
|
|
98
|
-
// either:
|
|
99
|
-
// 1. Import Less's tree module and access typeIndex
|
|
100
|
-
// 2. Maintain our own mapping
|
|
101
|
-
// 3. Set typeIndex dynamically when creating proxies
|
|
102
|
-
// For now, return undefined - will be set during proxy creation
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=type-map.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-map.js","sourceRoot":"","sources":["../../src/transform/type-map.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,MAAM,OAAO,GAA2B;QACtC,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,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AAW;QACtB,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,QAAQ;QAChB,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,QAAQ;QAChB,gEAAgE;QAChE,SAAS,EAAE,QAAQ;QACnB,gEAAgE;QAChE,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,WAAW;QACtB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,gBAAgB;QAC5B,OAAO,EAAE,SAAS;KACnB,CAAC;IAEF,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;AACvC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,0DAA0D;IAC1D,UAAU;IACV,oDAAoD;IACpD,8BAA8B;IAC9B,qDAAqD;IAErD,gEAAgE;IAChE,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/lib/types.js
DELETED
package/lib/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|