@jesscss/scss-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 CHANGED
@@ -2,7 +2,14 @@
2
2
 
3
3
  An SCSS grammar for Jess, layered on the CSS base parser — **experimental, and not the focus of the Less alpha.**
4
4
 
5
- > **Status: experimental / roadmap.** Part of [Jess](https://github.com/jesscss/jess), which *is* Less.js v5. Only `.less` rendering ships today. SCSS is **not a goal of this phase** — this parser is early and exists to seed the future **"Sass+"** dialect (roadmap milestone #2, after Less.js). Don't rely on it for production; prefer [`@jesscss/css-parser`](https://www.npmjs.com/package/@jesscss/css-parser) / [`@jesscss/less-parser`](https://www.npmjs.com/package/@jesscss/less-parser). [Report bugs](https://github.com/jesscss/jess/issues); docs live at [jesscss.github.io](https://jesscss.github.io/).
5
+ > **Status: experimental / roadmap.** Part of
6
+ > [Jess](https://github.com/jesscss/jess). The current alpha ships through
7
+ > `.less`; SCSS is **not a goal of this phase**. This parser is early and exists
8
+ > to seed the future **"Sass+"** dialect. Don't rely on it for production;
9
+ > prefer [`@jesscss/css-parser`](https://www.npmjs.com/package/@jesscss/css-parser)
10
+ > / [`@jesscss/less-parser`](https://www.npmjs.com/package/@jesscss/less-parser).
11
+ > [Report bugs](https://github.com/jesscss/jess/issues); docs live at
12
+ > [jesscss.github.io](https://jesscss.github.io/).
6
13
 
7
14
  ## What it is
8
15
 
@@ -21,10 +28,13 @@ trails it), and the seed for the roadmap "Sass+" dialect rather than a shipped
21
28
  Sass replacement. The language roadmap is ordered: **Now Less.js → Next Sass+ →
22
29
  Final `.jess`.**
23
30
 
24
- Two ways to use it:
31
+ Two parser representations are available:
25
32
 
26
- - **As part of Jess** — the default `.` entry is wired into `@jesscss/core` and produces the core AST the Jess compiler evaluates. This is the internal, core-coupled path.
27
- - **As a standalone CST parser** the `./cst` entry has **no dependency on `@jesscss/core`**. Install just this package and parse SCSS source text into a concrete syntax tree (CST). You can also plug your own builders onto the grammar to produce your own AST instead of the default CST.
33
+ - **Canonical AST v2** — the default `parse()` entry constructs a `Stylesheet`
34
+ directly through parser-local Parseman reductions.
35
+ - **Explicit CST** — the `./cst` entry has **no dependency on
36
+ `@jesscss/core`** and parses SCSS source text into a concrete syntax tree for
37
+ language-service/document consumers.
28
38
 
29
39
  ## Install
30
40
 
@@ -32,7 +42,20 @@ Two ways to use it:
32
42
  npm install @jesscss/scss-parser
33
43
  ```
34
44
 
35
- `@jesscss/core` is an **optional** peer dependency — needed only for the core-coupled `.` entry, not for `./cst` or `./grammar`.
45
+ `@jesscss/core` is an **optional** peer dependency — needed for the default
46
+ AST v2 `parse()` entry, not for `./cst` or `./grammar`.
47
+ Those explicit entries expose Parseman types and grammar values, so consumers
48
+ of them must also provide the package's `parseman` peer.
49
+
50
+ ## Canonical AST parsing
51
+
52
+ ```js
53
+ import { parse } from '@jesscss/scss-parser'
54
+
55
+ const stylesheet = parse('$c: red;\n.foo { color: $c; }')
56
+
57
+ stylesheet.type // 'Stylesheet'
58
+ ```
36
59
 
37
60
  ## Standalone usage (core-free)
38
61
 
@@ -62,8 +85,7 @@ Pass a different `startRule` (any capitalized grammar rule) to parse a fragment.
62
85
  | `@jesscss/scss-parser/cst` | `parseScssCst` | Core-free parse of an SCSS string to a CST. |
63
86
  | `@jesscss/scss-parser/cst` | `ScssCstNode`, `ScssCstLeaf`, `ScssCstError`, `ScssCstChild`, `ScssCstParseResult`, `ScssCstType` (types) | CST type definitions (aliases of the shared `@jesscss/css-parser/cst` types). |
64
87
  | `@jesscss/scss-parser/grammar` | `scssGrammar` | The compiled SCSS grammar (a rule map). Extend it with `compose()` or drive it directly with parseman's `run`. |
65
- | `@jesscss/scss-parser` (`.`) | `ScssParser` (also `Parser`), `parseScssFn`, `scssGrammar`, tokens, | The Jess-internal barrel. **Core-coupled** (the functional parser builds the core AST). Prefer `./cst` if you don't need `@jesscss/core`. |
66
- | `@jesscss/scss-parser/jess` | `ScssParser`, `ScssGrammar`, `parseScssFn`, … | Internal Jess-facing surface. |
88
+ | `@jesscss/scss-parser` (`.`) | `parse` | Parse SCSS directly to canonical AST v2 `Stylesheet`. It does not load the CST grammar. |
67
89
 
68
90
  ## Default CST shape
69
91
 
@@ -146,4 +168,7 @@ type BuildHost = (
146
168
 
147
169
  ## Part of Jess
148
170
 
149
- This package is developed as part of [Jess](https://github.com/jesscss/jess), the Less.js v5 rewrite. SCSS is the least-mature Jess dialect and is not the focus of the Less alpha — it seeds the roadmap "Sass+" dialect. For production use, prefer `@jesscss/css-parser` / `@jesscss/less-parser`. Licensed MIT.
171
+ This package is developed as part of [Jess](https://github.com/jesscss/jess).
172
+ SCSS is the least-mature Jess dialect and is not the focus of the current
173
+ alpha; it seeds the roadmap "Sass+" dialect. For production use, prefer
174
+ `@jesscss/css-parser` / `@jesscss/less-parser`. Licensed MIT.