@cross-css/native-darwin-arm64 0.2.0 → 0.3.0
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 +41 -2
- package/package.json +1 -1
- package/xcss.node +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cross-css/native
|
|
2
|
+
|
|
3
|
+
Native Node.js bindings for XCSS parsing, analysis, and scoped CSS generation.
|
|
4
|
+
Consumers do not need Rust or Sass installed; platform packages provide binaries.
|
|
5
|
+
|
|
6
|
+
```js
|
|
7
|
+
import { Compiler, inspect } from '@cross-css/native'
|
|
8
|
+
const compiler = new Compiler()
|
|
9
|
+
compiler.setFile('button.xcss', 1, '.button { padding: --space * 2; }')
|
|
10
|
+
const result = compiler.compile('button.xcss')
|
|
11
|
+
if (!result.success) throw new Error(JSON.stringify(result.diagnostics))
|
|
12
|
+
const artifact = result.artifacts.find(item => item.moduleId === 'button.xcss')
|
|
13
|
+
console.log(artifact.css, artifact.classes, artifact.sourceMap)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Use normalized, project-relative module IDs and increasing revisions. File updates
|
|
17
|
+
reuse other parse trees. `removeFile(id, revision)` retains the deletion revision
|
|
18
|
+
so stale updates cannot resurrect files. Host adapters load files and resolve
|
|
19
|
+
imports; the native compiler performs no filesystem access.
|
|
20
|
+
|
|
21
|
+
`inspect(source).imports` returns injection/composition specifiers. Supply
|
|
22
|
+
`setResolution(importer, specifier, targetOrNull)` for each. All project files
|
|
23
|
+
should be loaded to support globally unique injection resolution.
|
|
24
|
+
|
|
25
|
+
`compile(entry, minify?, bundle?)` returns success, artifacts, and diagnostics.
|
|
26
|
+
Default artifacts are per-module scoped CSS with class mappings, custom-property
|
|
27
|
+
names, original-source maps, native imports, composition stylesheet dependencies,
|
|
28
|
+
and source dependencies. Bundling combines only composition dependencies and
|
|
29
|
+
rebases their assets to the entry. Injection dependencies contribute definitions
|
|
30
|
+
only. Diagnostics carry stable codes, severity, module ID, byte span, related
|
|
31
|
+
locations, and one-based UTF-16 line/column positions. Errors return no artifacts.
|
|
32
|
+
|
|
33
|
+
`index.d.ts` is generated from napi-rs binding metadata during the native build.
|
|
34
|
+
# Editor queries
|
|
35
|
+
|
|
36
|
+
Version 0.3.0 also exports `LanguageService` and `languageServiceCapabilities()`.
|
|
37
|
+
The service accepts the same versioned in-memory updates as `Compiler`, with file
|
|
38
|
+
URIs supported as identities. `document(uri)` returns diagnostics and semantic
|
|
39
|
+
tokens; `definition`, `references`, and `hover` accept zero-based UTF-16 positions.
|
|
40
|
+
These APIs do not compile CSS or read files. See the repository's
|
|
41
|
+
[language-service contract](https://github.com/IvanKobtsev/XCSS/blob/main/docs/language-service.md).
|
|
2
42
|
|
|
3
|
-
Internal native Node.js bindings for the XCSS compiler. Most users should install `@cross-css/vite-plugin` instead; it selects this package and the correct precompiled platform binary automatically.
|
package/package.json
CHANGED
package/xcss.node
CHANGED
|
Binary file
|