@jesscss/less-parser 2.0.0-alpha.8 → 2.0.0-alpha.9
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 +27 -10
- package/lib/ast/grammar.d.ts +2 -0
- package/lib/ast/grammar.d.ts.map +1 -0
- package/lib/grammar.cjs +39855 -31054
- package/lib/grammar.d.ts.map +1 -1
- package/lib/grammar.js +39855 -31054
- package/lib/index.cjs +49609 -15
- package/lib/index.d.ts +4 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +49607 -5
- package/lib/parse-error.d.ts +15 -0
- package/lib/parse-error.d.ts.map +1 -0
- package/package.json +9 -24
- package/lib/builders.d.ts +0 -381
- package/lib/builders.d.ts.map +0 -1
- package/lib/functional-parser.cjs +0 -2654
- package/lib/functional-parser.d.ts +0 -18
- package/lib/functional-parser.d.ts.map +0 -1
- package/lib/functional-parser.js +0 -2589
- package/lib/jess.cjs +0 -3968
- package/lib/jess.d.ts +0 -7
- package/lib/jess.d.ts.map +0 -1
- package/lib/jess.js +0 -3962
- package/lib/lessParser.d.ts +0 -38
- package/lib/lessParser.d.ts.map +0 -1
- package/lib/lessRecursiveParser.d.ts +0 -99
- package/lib/lessRecursiveParser.d.ts.map +0 -1
- package/lib/lessTokens.d.ts +0 -23
- package/lib/lessTokens.d.ts.map +0 -1
- package/lib/productions/guards.d.ts +0 -113
- package/lib/productions/guards.d.ts.map +0 -1
- package/lib/productions/index.d.ts +0 -5
- package/lib/productions/index.d.ts.map +0 -1
- package/lib/productions/root.d.ts +0 -38
- package/lib/productions/root.d.ts.map +0 -1
- package/lib/productions/selectors.d.ts +0 -41
- package/lib/productions/selectors.d.ts.map +0 -1
- package/lib/productions/values.d.ts +0 -35
- package/lib/productions/values.d.ts.map +0 -1
- package/lib/utils.d.ts +0 -9
- package/lib/utils.d.ts.map +0 -1
- package/src/__tests__/debug-log.ts +0 -35
- package/src/__tests__/wall5-parse.test.ts +0 -67
- package/src/builders.ts +0 -3190
- package/src/cst.ts +0 -25
- package/src/functional-parser.ts +0 -162
- package/src/grammar.ts +0 -870
- package/src/index.ts +0 -19
- package/src/jess.ts +0 -6
- package/src/lessParser.ts +0 -120
- package/src/lessRecursiveParser.ts +0 -279
- package/src/lessTokens.ts +0 -350
- package/src/productions/guards.ts +0 -1066
- package/src/productions/index.ts +0 -29
- package/src/productions/root.ts +0 -1613
- package/src/productions/selectors.ts +0 -1309
- package/src/productions/values.ts +0 -1449
- package/src/utils.ts +0 -178
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# @jesscss/less-parser
|
|
2
2
|
|
|
3
|
-
The Less grammar, layered on the CSS base parser
|
|
3
|
+
The Less grammar, layered on the CSS base parser, with core-free CST entry points.
|
|
4
4
|
|
|
5
|
-
> **Status: alpha.** Part of [Jess](https://github.com/jesscss/jess)
|
|
5
|
+
> **Status: alpha.** Part of [Jess](https://github.com/jesscss/jess). The broader
|
|
6
|
+
> language/tooling picture is still early. Expect gaps and
|
|
7
|
+
> [report bugs](https://github.com/jesscss/jess/issues). Docs live at
|
|
8
|
+
> [jesscss.github.io](https://jesscss.github.io/).
|
|
6
9
|
|
|
7
10
|
## What it is
|
|
8
11
|
|
|
@@ -17,10 +20,10 @@ general-purpose JavaScript parser** in its
|
|
|
17
20
|
Jess uses when it compiles `.less` — the "Now" tier of the language roadmap, and
|
|
18
21
|
the one dialect shipping in the alpha.
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
23
|
+
The default `parse()` operation constructs canonical AST v2 `Stylesheet` directly
|
|
24
|
+
through parser-local Parseman reductions. Use the explicit `./cst` entry when a
|
|
25
|
+
language-service or document consumer needs a CST. The package has no
|
|
26
|
+
core-owned parser driver or AST construction host.
|
|
24
27
|
|
|
25
28
|
## Install
|
|
26
29
|
|
|
@@ -28,7 +31,20 @@ Two ways to use it:
|
|
|
28
31
|
npm install @jesscss/less-parser
|
|
29
32
|
```
|
|
30
33
|
|
|
31
|
-
`@jesscss/core` is an
|
|
34
|
+
`@jesscss/core` is an optional peer for consumers using the default AST v2
|
|
35
|
+
`parse()` result. The explicit CST and grammar subpaths remain core-free.
|
|
36
|
+
Those explicit entries expose Parseman types and grammar values, so consumers
|
|
37
|
+
of them must also provide the package's `parseman` peer.
|
|
38
|
+
|
|
39
|
+
## Canonical AST parsing
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import { parse } from '@jesscss/less-parser'
|
|
43
|
+
|
|
44
|
+
const stylesheet = parse('@c: red;\n.foo { color: @c; }')
|
|
45
|
+
|
|
46
|
+
stylesheet.type // 'Stylesheet'
|
|
47
|
+
```
|
|
32
48
|
|
|
33
49
|
## Standalone usage (core-free)
|
|
34
50
|
|
|
@@ -58,8 +74,7 @@ Pass a different `startRule` (any capitalized grammar rule, e.g. `'SelectorList'
|
|
|
58
74
|
| `@jesscss/less-parser/cst` | `parseLessCst` | Core-free parse of a Less string to a CST. |
|
|
59
75
|
| `@jesscss/less-parser/cst` | `LessCstNode`, `LessCstLeaf`, `LessCstError`, `LessCstChild`, `LessCstParseResult`, `LessCstType` (types) | CST type definitions (aliases of the shared `@jesscss/css-parser/cst` types). |
|
|
60
76
|
| `@jesscss/less-parser/grammar` | `lessGrammar` | The compiled Less grammar (a rule map). Extend it with `compose()` or drive it directly with parseman's `run`. |
|
|
61
|
-
| `@jesscss/less-parser` (`.`) | `
|
|
62
|
-
| `@jesscss/less-parser/jess` | `LessParser`, `LessGrammar`, `parseLessFn`, … | Internal Jess-facing surface. |
|
|
77
|
+
| `@jesscss/less-parser` (`.`) | `parse` | Parse Less directly to canonical AST v2 `Stylesheet`. It does not load the CST grammar. |
|
|
63
78
|
|
|
64
79
|
## Default CST shape
|
|
65
80
|
|
|
@@ -146,4 +161,6 @@ type BuildHost = (
|
|
|
146
161
|
|
|
147
162
|
## Part of Jess
|
|
148
163
|
|
|
149
|
-
This package is developed as part of [Jess](https://github.com/jesscss/jess)
|
|
164
|
+
This package is developed as part of [Jess](https://github.com/jesscss/jess).
|
|
165
|
+
Jess translates a Less string into the core Jess AST, which the compiler then
|
|
166
|
+
evaluates and renders to CSS. Licensed MIT.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/ast/grammar.ts"],"names":[],"mappings":"AA49CA,eAAO,MAAM,cAAc,8CAuhGvB,CAAC"}
|