@jesscss/plugin-less-compat 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 +35 -25
- package/lib/index.cjs +13 -821
- package/lib/index.d.ts +0 -3
- package/lib/index.js +15 -786
- package/lib/plugin.d.ts +17 -109
- package/package.json +5 -15
- package/lib/less-adapter.cjs +0 -216
- package/lib/less-adapter.js +0 -181
- package/lib/less-compat-structures.cjs +0 -378
- package/lib/less-compat-structures.d.ts +0 -108
- package/lib/less-compat-structures.js +0 -374
- package/lib/nodes/at-rule.d.ts +0 -2
- package/lib/nodes/attribute-selector.d.ts +0 -2
- package/lib/nodes/call.d.ts +0 -2
- package/lib/nodes/color.d.ts +0 -2
- package/lib/nodes/combinator.d.ts +0 -2
- package/lib/nodes/comment.d.ts +0 -2
- package/lib/nodes/condition.d.ts +0 -2
- package/lib/nodes/declaration.d.ts +0 -2
- package/lib/nodes/dimension.d.ts +0 -2
- package/lib/nodes/expression.d.ts +0 -2
- package/lib/nodes/extend.d.ts +0 -2
- package/lib/nodes/import.d.ts +0 -2
- package/lib/nodes/index.d.ts +0 -45
- package/lib/nodes/keyword.d.ts +0 -2
- package/lib/nodes/list.d.ts +0 -3
- package/lib/nodes/mixin.d.ts +0 -2
- package/lib/nodes/negative.d.ts +0 -2
- package/lib/nodes/operation.d.ts +0 -2
- package/lib/nodes/paren.d.ts +0 -2
- package/lib/nodes/quoted.d.ts +0 -2
- package/lib/nodes/reference.d.ts +0 -2
- package/lib/nodes/ruleset.d.ts +0 -2
- package/lib/nodes/selector.d.ts +0 -3
- package/lib/nodes/sequence.d.ts +0 -2
- package/lib/nodes/url.d.ts +0 -2
- package/lib/nodes/var-declaration.d.ts +0 -2
- package/lib/plugin-utils.d.ts +0 -20
- package/lib/transform/adapter.d.ts +0 -31
- package/lib/transform/from-less.d.ts +0 -30
- package/lib/transform/index.cjs +0 -13
- package/lib/transform/index.d.ts +0 -7
- package/lib/transform/index.js +0 -3
- package/lib/transform/less-adapter.d.ts +0 -29
- package/lib/transform/to-less.d.ts +0 -17
- package/lib/transform/type-map.d.ts +0 -27
- package/lib/transform.cjs +0 -1045
- package/lib/transform.js +0 -1015
- package/lib/types.d.ts +0 -158
package/README.md
CHANGED
|
@@ -1,38 +1,48 @@
|
|
|
1
1
|
# @jesscss/plugin-less-compat
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
against the Jess AST.**
|
|
3
|
+
**An AST-v2 native-function contribution package.**
|
|
5
4
|
|
|
6
|
-
[Jess](https://github.com/jesscss/jess)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
back — so tools like autoprefixing or minification plugins can keep working
|
|
11
|
-
against Jess-compiled stylesheets.
|
|
12
|
-
|
|
13
|
-
It's the load-bearing piece of the eventual **`less@5` adoption layer**: the seam
|
|
14
|
-
that lets a Less 4.x project move onto Jess without abandoning its existing plugin
|
|
15
|
-
setup.
|
|
5
|
+
[Jess](https://github.com/jesscss/jess) accepts typed AST-v2 `Fn` values here.
|
|
6
|
+
The public compiler does **not** support Less 4 visitors, `functionRegistry`
|
|
7
|
+
callbacks, `@plugin` scripts, post-processors, or conversion between Less tree
|
|
8
|
+
nodes and Jess values.
|
|
16
9
|
|
|
17
10
|
## How it works
|
|
18
11
|
|
|
19
|
-
- **
|
|
20
|
-
|
|
21
|
-
materialized.
|
|
22
|
-
- **Visitor support** — Less 4.x visitors run over the converted tree.
|
|
23
|
-
- Package resolution for `@plugin "name"` is delegated to
|
|
24
|
-
[`@jesscss/plugin-node-modules`](../jess-plugin-node-modules).
|
|
12
|
+
- **Native functions only** — pass `Fn` values from `@jesscss/core/value`; their
|
|
13
|
+
bodies receive typed values and `FnCtx` capabilities.
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
For example, migrate a Less `functionRegistry.add('increment', fn)` contribution
|
|
16
|
+
to a typed function and register it through `functions`:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { Compiler } from 'jess';
|
|
20
|
+
import { defineFunction, makeDimension } from '@jesscss/core/value';
|
|
21
|
+
import lessCompatPlugin from '@jesscss/plugin-less-compat';
|
|
22
|
+
|
|
23
|
+
const increment = defineFunction('increment', {
|
|
24
|
+
params: [{ kinds: ['Dimension'] }] as const,
|
|
25
|
+
body: value => makeDimension(value.number + 1, value.unit)
|
|
26
|
+
});
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const compiler = new Compiler({
|
|
29
|
+
compile: { plugins: [lessCompatPlugin({ functions: [increment] })] }
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The old `plugins`/`functionRegistry` option is not a compatibility shim: it is
|
|
34
|
+
not part of this package's public options. Legacy Less visitors, tree values,
|
|
35
|
+
and script-plugin hooks must be migrated to an AST-v2 plugin or run under
|
|
32
36
|
Less.js directly.
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
## Status
|
|
39
|
+
|
|
40
|
+
**Alpha / experimental.** The supported public route is native function
|
|
41
|
+
contribution only. If you need Less visitors, `functionRegistry`, script-plugin,
|
|
42
|
+
or post-processor support today, use Less.js directly.
|
|
43
|
+
|
|
44
|
+
The programmatic plugin/compiler API is **not yet stabilized** — the `jess` CLI
|
|
45
|
+
is the documented public surface for the alpha. Watch the
|
|
36
46
|
[docs site](https://jesscss.github.io/) for the API once it settles. Current
|
|
37
47
|
design notes live in [DESIGN.md](./DESIGN.md).
|
|
38
48
|
|