@cross-css/native-darwin-arm64 0.2.0 → 0.3.1

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 (3) hide show
  1. package/README.md +64 -2
  2. package/package.json +1 -1
  3. package/xcss.node +0 -0
package/README.md CHANGED
@@ -1,3 +1,65 @@
1
- # `@cross-css/native`
1
+ # @cross-css/native
2
2
 
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.
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).
42
+
43
+
44
+
45
+ ## CSS declaration validation inputs (API v2, native 0.3.1)
46
+
47
+ `LanguageService.cssDeclarations(uri)` returns `{ revision, declarations }` from
48
+ the same analysis snapshot as other editor queries, without compiling CSS.
49
+ Each declaration contains `property`, `propertyRange`, `valueRange`, `context`,
50
+ `checkable`, and ordered `parts`. Ranges are zero-based UTF-16 positions in the
51
+ original source. Context is stylesheet, rule, injection, keyframes, or at-rule.
52
+ Each part contains a `range` and either literal `text` or a resolved `valueType`;
53
+ the other field is absent. Literal gaps, whitespace, comments, and CSS function
54
+ syntax are retained. Resolved parameters and declared custom-property references
55
+ use the existing analyzer's types, never their initializer or call-site argument.
56
+ Arithmetic with a known analysis result type is exposed as a single typed part.
57
+
58
+ Unknown references, native var(), recovery regions, transition groups and other
59
+ unsupported transformations make values uncheckable; property names remain
60
+ available. Parts on uncheckable declarations are incomplete and must not be
61
+ validated. XCSS directives, variable registrations, and direct declarations in
62
+ at-rule bodies (descriptors) are excluded. Rules nested inside at-rules remain
63
+ eligible. Consumers may substitute representative CSS values for typed parts;
64
+ this is a broad compatibility check, not proof for all values of that type.
65
+ Changes to any file or resolution invalidate the snapshot revision.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cross-css/native-darwin-arm64",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Precompiled XCSS native binding for darwin/arm64",
5
5
  "license": "MIT",
6
6
  "author": "Ivan Kobtsev",
package/xcss.node CHANGED
Binary file