@style-contract/binary-win32-x64 0.6.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/LICENSE +21 -0
- package/README.md +128 -0
- package/package.json +22 -0
- package/style-contract.exe +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ivan Kobtsev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# StyleContract
|
|
2
|
+
|
|
3
|
+
StyleContract is a fast, standalone Rust CLI that verifies the contract between TypeScript CSS Module references and CSS/SCSS declarations. It detects missing symbols, unused classes and `:export` keys, empty style rules, unsafe module-to-module stylesheet imports, naming mismatches, and dynamic accesses that cannot be checked safely.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Install through npm. The matching precompiled executable is selected automatically:
|
|
8
|
+
|
|
9
|
+
```console
|
|
10
|
+
npm install --save-dev style-contract
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Precompiled packages are available for Windows, macOS, and Linux on x64 and ARM64. Linux supports both glibc and musl. Package managers that omit optional dependencies are not supported because the native executable is delivered as a platform-specific optional dependency.
|
|
14
|
+
|
|
15
|
+
The platform packages use names such as `@style-contract/binary-win32-x64`. They are implementation details and should not be installed directly.
|
|
16
|
+
|
|
17
|
+
It can then be run from package scripts or directly with `npx`:
|
|
18
|
+
|
|
19
|
+
```console
|
|
20
|
+
npx style-contract --convention camel-to-kebab
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Alternatively, build and install directly from the Rust source:
|
|
24
|
+
|
|
25
|
+
```console
|
|
26
|
+
cargo install --path .
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Use
|
|
30
|
+
|
|
31
|
+
Choose exactly one naming convention on the command line or in a config file:
|
|
32
|
+
|
|
33
|
+
```console
|
|
34
|
+
style-contract --convention camel-case
|
|
35
|
+
style-contract --convention kebab-case
|
|
36
|
+
style-contract --convention camel-to-kebab
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`camel-case` accepts both lower-camel names such as `primaryButton` and capitalized names such as `ComponentRoot`. `camel-to-kebab` continues to require lower-camel TypeScript references and maps `styles.primaryButton` to `.primary-button`. `kebab-case` references use bracket notation such as `styles["primary-button"]`.
|
|
40
|
+
|
|
41
|
+
Available options:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
--source <PATH> Source folder (default: ./src)
|
|
45
|
+
--output <minimal|rich> Output style (default: rich)
|
|
46
|
+
--config <PATH> JSON5 configuration file (auto: ./style-contract.json)
|
|
47
|
+
--exclude <PATH> Excluded folder; repeat as needed
|
|
48
|
+
--include <PATH> Re-include a folder below an exclusion
|
|
49
|
+
--ignore-exports[=BOOL] Enable or explicitly disable :export checks
|
|
50
|
+
--rule <RULE:SEVERITY> Set a rule to error, warning, or off
|
|
51
|
+
--tsconfig <PATH> tsconfig used for paths aliases (default: ./tsconfig.json)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
CLI paths are resolved from the working directory. Paths in a config file are resolved from that file's directory. Include and exclude folders must exist beneath the source folder. A tsconfig is optional when no aliases are needed.
|
|
55
|
+
|
|
56
|
+
With no explicit `--config`, StyleContract automatically loads `./style-contract.json` when it exists. Use `--config` to select another file. JSON5 comments and trailing commas are supported regardless of the filename extension:
|
|
57
|
+
|
|
58
|
+
```json5
|
|
59
|
+
{
|
|
60
|
+
convention: "camel-to-kebab",
|
|
61
|
+
output: "rich",
|
|
62
|
+
source: "./src",
|
|
63
|
+
exclude: ["./src/generated"],
|
|
64
|
+
include: [],
|
|
65
|
+
ignoreExports: false,
|
|
66
|
+
tsconfig: "./tsconfig.json",
|
|
67
|
+
rules: {
|
|
68
|
+
"unused-export": "warning",
|
|
69
|
+
"unused-dependent-class": "warning",
|
|
70
|
+
"naming-convention-global": "off",
|
|
71
|
+
"empty-rule": "warning",
|
|
72
|
+
"module-to-module-import": "warning",
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Explicit CLI values replace matching config values. Supplying any CLI entries for `--exclude`, `--include`, or `--rule` replaces that configured collection. `--ignore-exports=false` can disable a value enabled by the config.
|
|
78
|
+
|
|
79
|
+
Supported rules:
|
|
80
|
+
|
|
81
|
+
- `missing-symbol`
|
|
82
|
+
- `unused-class`
|
|
83
|
+
- `unused-dependent-class` (off by default)
|
|
84
|
+
- `unused-export`
|
|
85
|
+
- `naming-convention-local`
|
|
86
|
+
- `naming-convention-global`
|
|
87
|
+
- `dynamic-reference`
|
|
88
|
+
- `empty-rule`
|
|
89
|
+
- `module-to-module-import`
|
|
90
|
+
|
|
91
|
+
All enabled rules are errors except `naming-convention-global`, `dynamic-reference`, `empty-rule`, and `module-to-module-import`, which are warnings. `unused-dependent-class` is disabled by default; when enabled, it verifies that classes declared in same-element compound selectors are used together with a complete prerequisite class path in one JSX `className` expression. `empty-rule` reports selector blocks that contain only whitespace or comments; empty `:export` and structural at-rule blocks are not reported. `module-to-module-import` reports `@use`, `@forward`, and `@import` dependencies from one `.module.css` or `.module.scss` file to another. Imports from ordinary non-module stylesheets remain allowed. The warning exists because Sass merges the imported module's classes into the importing module's generated class map, which can expose unexpected classes and compound through transitive import chains.
|
|
92
|
+
|
|
93
|
+
Previous `no-*` rule IDs remain accepted as configuration aliases, and the legacy `naming-convention` override remains available as an alias for both convention rules. For example:
|
|
94
|
+
|
|
95
|
+
```console
|
|
96
|
+
style-contract --convention camel-to-kebab \
|
|
97
|
+
--exclude ./src/generated \
|
|
98
|
+
--include ./src/generated/checked \
|
|
99
|
+
--rule unused-export:warning
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Diagnostics follow `path:line:column severity rule message`. Exit code `0` means no errors, `1` means rule errors were found, and `2` means configuration or analysis failed.
|
|
103
|
+
|
|
104
|
+
Rich output uses compiler-style diagnostics, terminal colors, linked-looking source locations, and compact per-source error/warning totals. Use `--output minimal` for the original single-line format. Colors are disabled when output is redirected or the `NO_COLOR` environment variable is set.
|
|
105
|
+
|
|
106
|
+
## Static-analysis boundary
|
|
107
|
+
|
|
108
|
+
The MVP supports `.ts`, `.tsx`, `.css`, and `.scss`, default or namespace CSS Module imports, relative imports, tsconfig `baseUrl`/`paths`, dot and literal bracket access, and static destructuring. It recognizes literal class selectors, nested literal SCSS selectors, empty selector blocks, `:export` blocks, CSS Modules `:global`/`:local` functions and blocks, Sass `@use`/`@forward`/`@import` dependencies, Sass `@extend`, and same-file or relative-file CSS Modules `composes` references.
|
|
109
|
+
|
|
110
|
+
Classes in `.module.css` and `.module.scss` are local by default. Classes in other stylesheets are global by default. Global classes are checked against the warning-level global convention rule, but are not CSS Module exports and therefore do not participate in missing or unused checks.
|
|
111
|
+
|
|
112
|
+
Dynamic Sass-generated selectors and computed accesses such as `styles[name]` produce warnings. Because their complete usage cannot be proven, unused-symbol findings are suppressed for that stylesheet. StyleContract detects module-to-module Sass dependencies but does not evaluate Sass or flatten imported classes into the importing module's symbol table. Sass evaluation and `composes` evaluation remain outside the MVP.
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```console
|
|
117
|
+
cargo fmt --check
|
|
118
|
+
cargo clippy --all-targets --all-features -- -D warnings
|
|
119
|
+
cargo test
|
|
120
|
+
cargo build --release
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Release
|
|
124
|
+
|
|
125
|
+
Releases are published from version tags. Before the first release, create or claim the `@style-contract` organization on npm, grant the publisher access to it, and add an npm automation token to the GitHub repository as the `NPM_TOKEN` Actions secret.
|
|
126
|
+
|
|
127
|
+
Keep the version in `package.json`, `Cargo.toml`, `Cargo.lock`, and every platform package dependency identical. The release verifier enforces this. Push a tag matching that version, such as `v0.6.0`; the release workflow builds and publishes all eight platform packages before publishing `style-contract`.
|
|
128
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@style-contract/binary-win32-x64",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Precompiled StyleContract binary for win32/x64",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/IvanKobtsev/StyleContract.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"os": [
|
|
11
|
+
"win32"
|
|
12
|
+
],
|
|
13
|
+
"cpu": [
|
|
14
|
+
"x64"
|
|
15
|
+
],
|
|
16
|
+
"files": [
|
|
17
|
+
"style-contract.exe"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
Binary file
|