@jesscss/plugin-node-modules 2.0.0-alpha.7 → 2.0.0-alpha.8

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 (2) hide show
  1. package/README.md +33 -72
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,74 +1,35 @@
1
1
  # @jesscss/plugin-node-modules
2
2
 
3
- Jess plugin for resolving and loading npm packages from `node_modules`.
4
-
5
- ## Overview
6
-
7
- This plugin provides npm/node_modules resolution and loading capabilities for all Jess language plugins. It uses Node's module resolution algorithm (`require.resolve`) to find and load npm packages.
8
-
9
- ## Usage
10
-
11
- ```typescript
12
- import { Compiler } from '@jesscss/jess';
13
- import nodeModulesPlugin from '@jesscss/plugin-node-modules';
14
-
15
- const compiler = new Compiler({
16
- compile: {
17
- plugins: [
18
- nodeModulesPlugin(),
19
- // ... other plugins
20
- ]
21
- }
22
- });
23
- ```
24
-
25
- ## API
26
-
27
- ### `resolvePackage(packageName: string): string | null`
28
-
29
- Resolve an npm package name to its absolute path.
30
-
31
- ```typescript
32
- const plugin = new NodeModulesPlugin();
33
- const path = plugin.resolvePackage('less-plugin-clean-css');
34
- // Returns: '/path/to/node_modules/less-plugin-clean-css/index.js' or null
35
- ```
36
-
37
- ### `loadPackage(packageName: string): Promise<Record<string, any> | null>`
38
-
39
- Load an npm package module.
40
-
41
- ```typescript
42
- const plugin = new NodeModulesPlugin();
43
- const module = await plugin.loadPackage('less-plugin-clean-css');
44
- // Returns: the module exports, or null if not found
45
- ```
46
-
47
- ### `tryResolvePackages(packageNames: string[]): Promise<{ name: string; module: Record<string, any> } | null>`
48
-
49
- Try to resolve a package name with multiple possible names. Returns the first successfully resolved package.
50
-
51
- ```typescript
52
- const plugin = new NodeModulesPlugin();
53
- const result = await plugin.tryResolvePackages([
54
- 'clean-css',
55
- 'less-plugin-clean-css'
56
- ]);
57
- // Returns: { name: 'less-plugin-clean-css', module: {...} } or null
58
- ```
59
-
60
- ## Integration with Other Plugins
61
-
62
- Other plugins (like `@jesscss/plugin-less-compat`) can use this plugin to resolve npm packages:
63
-
64
- ```typescript
65
- // In jess-plugin-less-compat
66
- const nodeModulesPlugin = plugins.find(p => p.name === 'node-modules');
67
- if (nodeModulesPlugin instanceof NodeModulesPlugin) {
68
- const module = await nodeModulesPlugin.loadPackage('less-plugin-clean-css');
69
- }
70
- ```
71
-
72
- ## Options
73
-
74
- - `enabled` (boolean, default: `true`): Whether to enable auto-resolution of npm packages.
3
+ **Import resolver that loads npm packages from `node_modules` — a seed of the
4
+ JavaScript-execution / CSS-in-JS story.**
5
+
6
+ This plugin gives Jess's language plugins a way to resolve and load npm packages
7
+ by name, using Node's module resolution (`require.resolve` /
8
+ `createRequire`). Other plugins use it to pull in packages referenced from a
9
+ stylesheet — for example [`@jesscss/plugin-less-compat`](../jess-plugin-less-compat)
10
+ resolving a Less `@plugin "package-name"` off `node_modules`.
11
+
12
+ ## Why it exists the convergence angle
13
+
14
+ One of the four tools [Jess](https://github.com/jesscss/jess) aims to converge is
15
+ **CSS-in-JS**: running real JavaScript inside your stylesheets (`@use` /
16
+ `@plugin`) so styles can be dynamic without leaving CSS files. Reaching npm
17
+ packages is a building block of that story. Paired with
18
+ [`@jesscss/plugin-js`](../jess-plugin-js) (which executes the modules), it lets a
19
+ stylesheet pull logic and data from the JS ecosystem.
20
+
21
+ That convergence is **roadmap — being proven through the alpha, not claimed as
22
+ done.** What ships here today is just the resolver seam; don't read it as a
23
+ finished CSS-in-JS system.
24
+
25
+ ## Status
26
+
27
+ **Alpha.** Part of Jess, the ground-up rewrite of Less.js (Jess *is* Less.js
28
+ v5). The programmatic plugin/compiler API is **not yet stabilized** — the `jess`
29
+ / `lessc` CLIs are the public surface for the alpha. Watch the
30
+ [docs site](https://jesscss.github.io/) for the API once it settles.
31
+
32
+ - Project overview & positioning: <https://github.com/jesscss/jess#readme>
33
+ - Docs: <https://jesscss.github.io/> (currently pre-alpha content)
34
+ - Issues: <https://github.com/jesscss/jess/issues>
35
+ - License: MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jesscss/plugin-node-modules",
3
- "version": "2.0.0-alpha.7",
3
+ "version": "2.0.0-alpha.8",
4
4
  "description": "Jess plugin for resolving and loading npm packages from node_modules",
5
5
  "main": "lib/index.cjs",
6
6
  "types": "lib/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "lib"
17
17
  ],
18
18
  "dependencies": {
19
- "@jesscss/core": "2.0.0-alpha.7"
19
+ "@jesscss/core": "2.0.0-alpha.8"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^20.0.0",