@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.
Files changed (49) hide show
  1. package/README.md +35 -25
  2. package/lib/index.cjs +13 -821
  3. package/lib/index.d.ts +0 -3
  4. package/lib/index.js +15 -786
  5. package/lib/plugin.d.ts +17 -109
  6. package/package.json +5 -15
  7. package/lib/less-adapter.cjs +0 -216
  8. package/lib/less-adapter.js +0 -181
  9. package/lib/less-compat-structures.cjs +0 -378
  10. package/lib/less-compat-structures.d.ts +0 -108
  11. package/lib/less-compat-structures.js +0 -374
  12. package/lib/nodes/at-rule.d.ts +0 -2
  13. package/lib/nodes/attribute-selector.d.ts +0 -2
  14. package/lib/nodes/call.d.ts +0 -2
  15. package/lib/nodes/color.d.ts +0 -2
  16. package/lib/nodes/combinator.d.ts +0 -2
  17. package/lib/nodes/comment.d.ts +0 -2
  18. package/lib/nodes/condition.d.ts +0 -2
  19. package/lib/nodes/declaration.d.ts +0 -2
  20. package/lib/nodes/dimension.d.ts +0 -2
  21. package/lib/nodes/expression.d.ts +0 -2
  22. package/lib/nodes/extend.d.ts +0 -2
  23. package/lib/nodes/import.d.ts +0 -2
  24. package/lib/nodes/index.d.ts +0 -45
  25. package/lib/nodes/keyword.d.ts +0 -2
  26. package/lib/nodes/list.d.ts +0 -3
  27. package/lib/nodes/mixin.d.ts +0 -2
  28. package/lib/nodes/negative.d.ts +0 -2
  29. package/lib/nodes/operation.d.ts +0 -2
  30. package/lib/nodes/paren.d.ts +0 -2
  31. package/lib/nodes/quoted.d.ts +0 -2
  32. package/lib/nodes/reference.d.ts +0 -2
  33. package/lib/nodes/ruleset.d.ts +0 -2
  34. package/lib/nodes/selector.d.ts +0 -3
  35. package/lib/nodes/sequence.d.ts +0 -2
  36. package/lib/nodes/url.d.ts +0 -2
  37. package/lib/nodes/var-declaration.d.ts +0 -2
  38. package/lib/plugin-utils.d.ts +0 -20
  39. package/lib/transform/adapter.d.ts +0 -31
  40. package/lib/transform/from-less.d.ts +0 -30
  41. package/lib/transform/index.cjs +0 -13
  42. package/lib/transform/index.d.ts +0 -7
  43. package/lib/transform/index.js +0 -3
  44. package/lib/transform/less-adapter.d.ts +0 -29
  45. package/lib/transform/to-less.d.ts +0 -17
  46. package/lib/transform/type-map.d.ts +0 -27
  47. package/lib/transform.cjs +0 -1045
  48. package/lib/transform.js +0 -1015
  49. package/lib/types.d.ts +0 -158
package/README.md CHANGED
@@ -1,38 +1,48 @@
1
1
  # @jesscss/plugin-less-compat
2
2
 
3
- **The Less.js 4.x compatibility bridge — run existing Less plugins and visitors
4
- against the Jess AST.**
3
+ **An AST-v2 native-function contribution package.**
5
4
 
6
- [Jess](https://github.com/jesscss/jess) *is* Less.js v5, but the Less 4.x
7
- ecosystem has years of plugins and visitors written against the old Less AST.
8
- This package bridges the two: it converts a Jess `Rules` tree to a
9
- Less.js-compatible tree, runs Less 4.x visitors over it, and converts the result
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
- - **Bidirectional transformation** between Jess AST nodes and Less.js AST nodes,
20
- with lazy per-field conversion so only the fields a visitor touches are
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
- ## Status
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
- **Alpha / experimental.** It works for the plugins it has been exercised against
29
- (e.g. `less-plugin-autoprefix`, `less-plugin-clean-css`, `less-plugin-dls`), but
30
- it has not been validated across the whole Less plugin ecosystem, and the surface
31
- may change. If you need broad, battle-tested Less-plugin support today, use
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
- The programmatic plugin/compiler API is **not yet stabilized** — the `jess` /
35
- `lessc` CLIs are the public surface for the alpha. Watch the
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